Canonical server-owned state for the abstract canvas model.
This module models canvas truth: items, domain models, actor selection,
stacking order, and layout serialization.
Runtime projection into LiveView sockets is wired internally by
LivePanels.Canvas.
Summary
Functions
Returns a single content-bearing item by id, or nil when the item is
absent or does not have a :content capability.
Returns the subset of items that carry a :content capability, keyed by id.
The compositor uses this projection to manage item content processes.
Creates a new canvas state from an id and a config map.
Persists the current layout payload through the configured layout store.
Serializes state to the canonical layout persistence codec.
Types
@type t() :: %LivePanels.Canvas.State{ clipboards: %{optional(String.t()) => map()}, declaration_removals: %{optional(String.t()) => non_neg_integer()}, extensions: [term()], histories: %{optional(String.t()) => LivePanels.Canvas.History.t()}, id: String.t(), interaction_lease_timeout_ms: pos_integer(), items: %{optional(String.t()) => LivePanels.Item.t()}, layout_store: module(), max_z_index: number(), mode: :local | :shared, plugin_state: map(), policy: term(), selections: %{optional(String.t()) => LivePanels.Canvas.Selection.t()}, server_layout_loaded: boolean(), viewport_anchors: map(), viewport_cursors: %{optional(String.t()) => String.t()}, viewport_sequence: [String.t()], z_order: [String.t()] }
Functions
@spec content(t(), String.t()) :: LivePanels.Item.t() | nil
Returns a single content-bearing item by id, or nil when the item is
absent or does not have a :content capability.
@spec content_items(t()) :: %{required(String.t()) => LivePanels.Item.t()}
Returns the subset of items that carry a :content capability, keyed by id.
The compositor uses this projection to manage item content processes.
Creates a new canvas state from an id and a config map.
The config map is assembled from the LivePanels.Canvas runtime attachment.
Keys: :canvas_mode, :layout_store,
:extensions, :layout_load_timeout_ms, :interaction_lease_timeout_ms.
Called by Runtime.do_mount/4 — not typically called directly.
Persists the current layout payload through the configured layout store.
Serializes state to the canonical layout persistence codec.