Actor-scoped undo/redo history projection returned by
LivePanels.Canvas.Read.history/1.
Applications may inspect this struct for read-only UI state such as enabling undo and redo controls. This module also owns the socket-first and transaction-first history command helpers.
Summary
Types
Opaque versioned history effect captured while reducers build a patch entry.
Opaque history effect capture options.
Opaque versioned history patch entry.
Opaque side of a versioned history patch entry.
First argument accepted by history command helpers.
Functions
Returns whether the current history projection has an entry to redo.
Returns whether the current history projection has an entry to undo.
Summarizes the layout impact of one history entry for app-owned activity UI.
Reapplies history and returns the command result.
Reapplies the next entry in the current actor's canvas history.
Returns the number of redo entries in a history projection.
Returns redo entries in next-first order.
Rewinds history and returns the command result.
Rewinds the current actor's canvas history.
Returns the number of undo entries in a history projection.
Returns undo entries in newest-first order.
Types
@type command_result() :: LivePanels.Canvas.Command.result()
@type effect() :: map()
Opaque versioned history effect captured while reducers build a patch entry.
@type effect_capture() :: map()
Opaque history effect capture options.
@type entry() :: patch()
@type entry_delta() :: %{ item_delta: integer(), item_total: non_neg_integer(), connector_delta: integer(), connector_total: non_neg_integer(), changed_items: non_neg_integer() }
@type patch() :: map()
Opaque versioned history patch entry.
History entries are tagged maps using internal keys such as
:__livepanels_history_patch__. Host code should use helper functions such as
entry_delta/1, undo_entries/1, and redo_entries/1 instead of depending
on the serialized map shape.
@type patch_side() :: map()
Opaque side of a versioned history patch entry.
@type socket() :: Phoenix.LiveView.Socket.t()
@type target() :: LivePanels.Canvas.command_target()
First argument accepted by history command helpers.
Pass a LiveView socket for a standalone command, or a
LivePanels.Canvas.Transaction context inside LivePanels.Canvas.transaction/2.
Functions
Returns whether the current history projection has an entry to redo.
Returns whether the current history projection has an entry to undo.
@spec entry_delta(entry() | map()) :: entry_delta()
Summarizes the layout impact of one history entry for app-owned activity UI.
@spec redo(target()) :: command_result()
Reapplies history and returns the command result.
Reapplies the next entry in the current actor's canvas history.
@spec redo_count(t() | term()) :: non_neg_integer()
Returns the number of redo entries in a history projection.
Returns redo entries in next-first order.
@spec undo(target()) :: command_result()
Rewinds history and returns the command result.
Rewinds the current actor's canvas history.
@spec undo_count(t() | term()) :: non_neg_integer()
Returns the number of undo entries in a history projection.
Returns undo entries in newest-first order.