Figler.Scene.Graph.Patch (figler v0.1.0-beta.1)

Copy Markdown View Source

Data-first graph patch operations.

Resolver stages emit patches instead of mutating node fields directly. Keeping patches as ordinary structs makes graph changes easy to test, diff, and record in provenance before any Figma-specific rule language exists.

Summary

Functions

Applies one or more patches to a graph.

Creates a field assignment patch.

Creates a component swap intent patch.

Types

t()

@type t() :: %Figler.Scene.Graph.Patch{
  field: atom() | nil,
  meta: map(),
  op: :set | :swap,
  source: atom(),
  target: Figler.Scene.Graph.GUID.graph_guid(),
  value: term()
}

Functions

apply_all(graph, patch)

@spec apply_all(Figler.Scene.Graph.t(), t() | [t()]) :: Figler.Scene.Graph.t()

Applies one or more patches to a graph.

set(target, field, value, opts \\ [])

Creates a field assignment patch.

swap(target, component_guid, opts \\ [])

Creates a component swap intent patch.