LivePanels.Canvas.Layout.Strategy behaviour (livepanels v0.1.0)

Copy Markdown View Source

Behaviour for headless canvas layout strategies.

Strategies receive a %LivePanels.Canvas.Layout.Context{} plus normalized params. They return placement maps only. LivePanels owns authorization, reducer application, history, persistence, shared fanout, and browser projection.

Summary

Types

placement()

@type placement() :: %{
  :id => String.t(),
  :space => :world,
  :anchor => :top_left,
  :x => integer(),
  :y => integer(),
  optional(:w) => number(),
  optional(:h) => number()
}

Callbacks

plan(t, t)

@callback plan(LivePanels.Canvas.Layout.Context.t(), LivePanels.Canvas.Layout.Options.t()) ::
  {:ok, [placement()]} | {:error, term()}