LivePanels.Context (livepanels v0.1.0)

Copy Markdown View Source

Runtime identity contract shared by canvas LiveViews and item content LiveViews.

This module is documented as a runtime concept, not as a command surface. LivePanels builds and assigns %LivePanels.Context{} values while mounting canvas and item content LiveViews. The public entry point is assign_key/0; the remaining helpers are runtime-owned.

LivePanels assigns runtime state under :livepanels when a canvas or item content LiveView mounts. The context lives at socket.assigns.livepanels.context. Public helpers should read runtime identity through this struct instead of reaching for individual socket assigns. Canvas projections such as items, selection, history, clipboard, connectors, viewport, canvas state, and cursor mode also live under socket.assigns.livepanels; matching root assign names remain app-owned.

Summary

Functions

Returns the socket assign key that stores the LivePanels runtime projection.

Types

mode()

@type mode() :: :local | :shared

t()

@type t() :: %LivePanels.Context{
  canvas_id: String.t(),
  canvas_mode: mode(),
  client_id: String.t(),
  item_id: String.t() | nil,
  pubsub: module(),
  viewer_id: String.t()
}

Functions

assign_key()

@spec assign_key() :: :livepanels

Returns the socket assign key that stores the LivePanels runtime projection.