Socket-first item lifecycle, frame, visibility, props, and relationship commands.
These functions are the app-facing canvas item verbs. They enter the same command, authorization, event, reducer, persistence, and projection path used by browser events and shared canvases.
Canvas items are public structs. Applications that receive assigned item maps can
read and pattern match on %LivePanels.Item{} values directly.
Derived placement helpers such as move_by/3, move_to/3, resize_by/3,
and resize_to/3 read the target's current canvas state, then submit a
placement command. In a transaction this reads the transaction preview; on a
shared socket it reads the participant's last synced state and the coordinator
resolves concurrent commands by normal command ordering.
Summary
Types
First argument accepted by canvas item command helpers.
Functions
Adds an item to the canvas and returns the command result.
Adds an item to the canvas.
Adds an attached item and returns the command result.
Adds an item attached to an existing parent item.
Attaches an item and returns the command result.
Attaches an existing child item to an existing parent item.
Clears an item's host-owned props map and returns the command result.
Clears an item's host-owned props map.
Copies an item and returns the command result.
Copies an item to an application placement frame.
Deletes one key from an item's host-owned props map and returns the command result.
Deletes one key from an item's host-owned props map.
Detaches an item and returns the command result.
Detaches an item from its current parent.
Edits LivePanels-owned item metadata and returns the command result.
Edits LivePanels-owned item metadata.
Focuses an item and returns the command result.
Focuses an item and promotes it in the canvas z-order.
Groups items and returns the command result.
Groups items by assigning one group id to every item.
Hides an item and returns the command result.
Hides an existing item without removing it from canonical state.
Merges keys into an item's host-owned props map and returns the command result.
Merges keys into an item's host-owned props map.
Moves an item by a delta and returns the command result.
Moves an item by a delta.
Moves an item to an absolute position and returns the command result.
Moves an item to an absolute {x, y} world or viewport coordinate.
Places an item and returns the command result.
Places an item at an application placement frame.
Presents an item and returns the command result.
Presents an existing item by showing it, optionally placing and focusing it.
Replaces an item's host-owned props map and returns the command result.
Replaces an item's host-owned props map.
Removes an item, selected items, or grouped items and returns the command result.
Removes an item, selected items, or grouped items from the canvas.
Resizes an item by a delta and returns the command result.
Resizes an item by a width/height delta.
Resizes an item to an absolute size and returns the command result.
Resizes an item to an absolute {w, h} frame size.
Restricts items and returns the command result.
Restricts an item, grouped items, or selected items to participant client ids.
Shares items and returns the command result.
Shares an item, grouped items, or selected items with participant client ids.
Makes items visible to every participant and returns the command result.
Makes an item, grouped items, or selected items visible to every participant.
Shows an item and returns the command result.
Shows an existing item without changing its identity or layout.
Toggles an item's visibility and returns the command result.
Toggles an existing item's visibility.
Ungroups items and returns the command result.
Clears a group id from every item in the group.
Unshares items and returns the command result.
Removes participant client ids from an item visibility list.
Types
@type command_opts() :: keyword()
@type command_result() :: LivePanels.Canvas.Command.result()
@type group_ref() :: {:group, String.t()} | String.t() | LivePanels.Item.t()
@type item_ref() :: LivePanels.Item.ref()
@type item_scope() :: item_or_group_ref() | :selection | [item_ref()]
@type socket() :: Phoenix.LiveView.Socket.t()
@type target() :: LivePanels.Canvas.command_target()
First argument accepted by canvas item command helpers.
Pass a LiveView socket for a standalone command, or a
LivePanels.Canvas.Transaction context inside LivePanels.Canvas.transaction/2.
Functions
@spec add(target(), LivePanels.Item.item_type(), command_opts()) :: command_result()
Adds an item to the canvas and returns the command result.
@spec add!(target(), LivePanels.Item.item_type(), command_opts()) :: target()
Adds an item to the canvas.
@spec add_attached(target(), item_ref(), LivePanels.Item.item_type(), command_opts()) :: command_result()
Adds an attached item and returns the command result.
@spec add_attached!(target(), item_ref(), LivePanels.Item.item_type(), command_opts()) :: target()
Adds an item attached to an existing parent item.
@spec attach(target(), item_ref(), item_ref(), command_opts()) :: command_result()
Attaches an item and returns the command result.
@spec attach!(target(), item_ref(), item_ref(), command_opts()) :: target()
Attaches an existing child item to an existing parent item.
@spec clear_props(target(), item_ref()) :: command_result()
Clears an item's host-owned props map and returns the command result.
Clears an item's host-owned props map.
@spec copy_to(target(), item_ref(), LivePanels.Canvas.Placement.frame() | map()) :: command_result()
Copies an item and returns the command result.
@spec copy_to!(target(), item_ref(), LivePanels.Canvas.Placement.frame() | map()) :: target()
Copies an item to an application placement frame.
@spec delete_prop(target(), item_ref(), atom() | String.t()) :: command_result()
Deletes one key from an item's host-owned props map and returns the command result.
Deletes one key from an item's host-owned props map.
@spec detach(target(), item_ref()) :: command_result()
Detaches an item and returns the command result.
Detaches an item from its current parent.
@spec edit(target(), item_scope(), map() | keyword()) :: command_result()
Edits LivePanels-owned item metadata and returns the command result.
@spec edit!(target(), item_scope(), map() | keyword()) :: target()
Edits LivePanels-owned item metadata.
@spec focus(target(), item_ref()) :: command_result()
Focuses an item and returns the command result.
Focuses an item and promotes it in the canvas z-order.
@spec group(target(), [item_ref()], command_opts()) :: command_result()
Groups items and returns the command result.
@spec group!(target(), [item_ref()], command_opts()) :: target()
Groups items by assigning one group id to every item.
@spec hide(target(), item_ref()) :: command_result()
Hides an item and returns the command result.
Hides an existing item without removing it from canonical state.
@spec merge_props(target(), item_ref(), map()) :: command_result()
Merges keys into an item's host-owned props map and returns the command result.
Merges keys into an item's host-owned props map.
@spec move_by(target(), item_or_group_ref(), vector()) :: command_result()
Moves an item by a delta and returns the command result.
@spec move_by!(target(), item_or_group_ref(), vector()) :: target()
Moves an item by a delta.
@spec move_to(target(), item_or_group_ref(), vector()) :: command_result()
Moves an item to an absolute position and returns the command result.
@spec move_to!(target(), item_or_group_ref(), vector()) :: target()
Moves an item to an absolute {x, y} world or viewport coordinate.
@spec place( target(), item_or_group_ref(), LivePanels.Canvas.Placement.frame() | map() ) :: command_result()
Places an item and returns the command result.
@spec place!( target(), item_or_group_ref(), LivePanels.Canvas.Placement.frame() | map() ) :: target()
Places an item at an application placement frame.
Application frames require :x, :y, :w, and :h. Omitted :space and
:anchor default to :world and :top_left; explicit malformed values
raise.
@spec present(target(), item_ref(), command_opts()) :: command_result()
Presents an item and returns the command result.
@spec present!(target(), item_ref(), command_opts()) :: target()
Presents an existing item by showing it, optionally placing and focusing it.
@spec put_props(target(), item_ref(), map()) :: command_result()
Replaces an item's host-owned props map and returns the command result.
Replaces an item's host-owned props map.
@spec remove(target(), item_scope()) :: command_result()
Removes an item, selected items, or grouped items and returns the command result.
@spec remove!(target(), item_scope()) :: target()
Removes an item, selected items, or grouped items from the canvas.
@spec resize_by(target(), item_or_group_ref(), vector()) :: command_result()
Resizes an item by a delta and returns the command result.
@spec resize_by!(target(), item_or_group_ref(), vector()) :: target()
Resizes an item by a width/height delta.
@spec resize_to(target(), item_or_group_ref(), vector()) :: command_result()
Resizes an item to an absolute size and returns the command result.
@spec resize_to!(target(), item_or_group_ref(), vector()) :: target()
Resizes an item to an absolute {w, h} frame size.
@spec restrict(target(), item_scope(), [String.t()] | String.t()) :: command_result()
Restricts items and returns the command result.
@spec restrict!(target(), item_scope(), [String.t()] | String.t()) :: target()
Restricts an item, grouped items, or selected items to participant client ids.
@spec show(target(), item_ref()) :: command_result()
Shows an item and returns the command result.
Shows an existing item without changing its identity or layout.
@spec toggle_visibility(target(), item_ref()) :: command_result()
Toggles an item's visibility and returns the command result.
Toggles an existing item's visibility.
@spec ungroup(target(), group_ref()) :: command_result()
Ungroups items and returns the command result.
Clears a group id from every item in the group.