Socket-first helpers for LivePanels item content.
use LivePanels.Item.Content.LiveView imports these helpers for LiveViews mounted inside a
canvas item. Item LiveViews that own mount/3 directly can import this
module after calling LivePanels.Item.Content.LiveView.mount_runtime/4.
These helpers dispatch requests to the parent canvas LiveView and return the
socket they receive. Helpers without an explicit item id read the current
item id from LivePanels.Context; during disconnected mount that id
may be absent, so those self-scoped helpers log a debug message and return
without dispatching.
notify/3 publishes to another item's topic. request/2 sends a
app-defined message to the parent canvas LiveView as
{:livepanels_item_request, message}.
Summary
Functions
Requests that the parent canvas add an item of type.
Requests that the parent canvas add an item attached to the current item.
Requests that the parent canvas add an item attached to parent_item_id.
Returns the canvas id for this item content LiveView.
Returns the current item's id, or nil before an item id is assigned.
Requests a props merge for the current item.
Requests a props merge for the item identified by item_id.
Publishes message to the item-scoped topic of another item LiveView.
Requests placement of the current item.
Requests placement of the item identified by item_id.
Requests that the parent canvas present an existing item.
Requests replacement of props on the current item.
Requests replacement of props on the item identified by item_id.
Requests removal of the current item.
Requests removal of the item identified by item_id.
Sends an app-defined request to the parent canvas LiveView.
Types
@type command_opts() :: keyword()
@type socket() :: Phoenix.LiveView.Socket.t()
Functions
@spec add(socket(), term(), command_opts()) :: socket()
Requests that the parent canvas add an item of type.
opts accepts the same item creation options as LivePanels.Canvas.Item.add/3.
@spec add_attached(socket(), term(), command_opts()) :: socket()
Requests that the parent canvas add an item attached to the current item.
During disconnected mount, the current item id may not be assigned yet;
in that case this helper logs a debug message and returns socket without
dispatching.
@spec add_attached(socket(), String.t(), term(), command_opts()) :: socket()
Requests that the parent canvas add an item attached to parent_item_id.
Returns the canvas id for this item content LiveView.
Returns the current item's id, or nil before an item id is assigned.
Requests a props merge for the current item.
During disconnected mount, the current item id may not be assigned yet;
in that case this helper logs a debug message and returns socket without
dispatching.
Requests a props merge for the item identified by item_id.
Publishes message to the item-scoped topic of another item LiveView.
The receiving item LiveView gets the message in handle_info/2. Item
LiveViews are subscribed to their own item topic automatically at mount.
Requests placement of the current item.
During disconnected mount, the current item id may not be assigned yet;
in that case this helper logs a debug message and returns socket without
dispatching.
Requests placement of the item identified by item_id.
@spec present(socket(), String.t(), command_opts()) :: socket()
Requests that the parent canvas present an existing item.
opts accepts the same presentation options as LivePanels.Canvas.Item.present/3.
Requests replacement of props on the current item.
During disconnected mount, the current item id may not be assigned yet;
in that case this helper logs a debug message and returns socket without
dispatching.
Requests replacement of props on the item identified by item_id.
Requests removal of the current item.
During disconnected mount, the current item id may not be assigned yet;
in that case this helper logs a debug message and returns socket without
dispatching.
Requests removal of the item identified by item_id.
Sends an app-defined request to the parent canvas LiveView.
The parent receives {:livepanels_item_request, message} in handle_info/2.
The runtime does not interpret the payload.