Reconcile Emerge.Engine.Element trees into stable node ids and patch operations.
Summary
Functions
Assign fresh node ids to a tree without a previous version.
Reconcile a new tree against the previous vdom.
Types
@type ctx() :: %{ next_id: non_neg_integer(), seen: MapSet.t(), old_key_index: %{ optional(term()) => %{scope: scope_ref(), vnode: Emerge.Engine.VNode.t()} } }
@type result() :: {Emerge.Engine.VNode.t(), [Emerge.Engine.Patch.patch()], Emerge.Engine.Element.t()}
@type scope_ref() :: :root | {:children, non_neg_integer()} | {:nearby, non_neg_integer()}
Functions
@spec assign_ids(Emerge.Engine.Element.t()) :: {Emerge.Engine.VNode.t(), Emerge.Engine.Element.t()}
Assign fresh node ids to a tree without a previous version.
@spec assign_ids(Emerge.Engine.Element.t(), non_neg_integer()) :: {Emerge.Engine.VNode.t(), Emerge.Engine.Element.t(), non_neg_integer()}
@spec reconcile(Emerge.Engine.VNode.t() | nil, Emerge.Engine.Element.t()) :: result()
Reconcile a new tree against the previous vdom.
@spec reconcile( Emerge.Engine.VNode.t() | nil, Emerge.Engine.Element.t(), non_neg_integer() ) :: {Emerge.Engine.VNode.t(), [Emerge.Engine.Patch.patch()], Emerge.Engine.Element.t(), non_neg_integer()}