# StatifierBlocks v0.3.0 - Table of Contents

> Block document model, one-way SCXML compiler, and LiveView editor components for composing Statifier statecharts

## Pages

- [StatifierBlocks](readme.md)
- [Changelog](changelog.md)

## Modules

- [StatifierBlocks](StatifierBlocks.md): Block document model, one-way SCXML compiler, and LiveView editor
components for composing [Statifier](https://github.com/riddler/statifier-ex)
statecharts from typed blocks.
- [StatifierBlocks.Connectors](StatifierBlocks.Connectors.md): Connector geometry: pure functions from measured rectangles to SVG path
data (ADR-0005 decision 10, and the 2026-08-29 amendment to decision 7).
- [StatifierBlocks.Connectors.Edge](StatifierBlocks.Connectors.Edge.md): One connector: the vocabulary it is drawn in, and its SVG path data.
- [StatifierBlocks.Connectors.Rect](StatifierBlocks.Connectors.Rect.md): One measured rectangle, in the stage's untransformed coordinate space.
- [StatifierBlocks.Datamodel](StatifierBlocks.Datamodel.md): The host's datamodel as the editor consumes it, and the one check it
makes against it (ADR-0005 decision 11, amended 2026-08-29 as 11e-11g).
- [StatifierBlocks.DurationInput](StatifierBlocks.DurationInput.md): The `:duration` control's reading of the text an author typed.
- [StatifierBlocks.Shell](StatifierBlocks.Shell.md): The shell's arrangement, as pure functions (ADR-0005, the 2026-08-29 shell
amendment: rulings 1A, 2A, 3A, 7A, 8A).

- Document model
  - [StatifierBlocks.Block](StatifierBlocks.Block.md): One node of a block document (ADR-0001).
  - [StatifierBlocks.Document](StatifierBlocks.Document.md): A block document: one tree, one envelope (ADR-0001).
  - [StatifierBlocks.Id](StatifierBlocks.Id.md): Mints block and document ids: `"blk_" <> uxid` and `"bdoc_" <> uxid`,
following the family's identifier convention (st-ADR-0008, as amended to
drop the `uxid` dependency and mint inline -
`statifier-ex/lib/statifier/machine_state.ex:571-585`).
  - [StatifierBlocks.SlotValidation](StatifierBlocks.SlotValidation.md): ADR-0002 decision 6's two properties, checked over a whole document
against a palette: declared slots are the complete set a block may carry
(`:undeclared_slot`), and a slot's child count must satisfy the arity
its type declares for it (`:slot_arity_violated`).

- Block types and assignability
  - [StatifierBlocks.Assignability](StatifierBlocks.Assignability.md): May this block land in this slot? Answered by two independent gates -
structural admission by kind tag, and data-flow compatibility by opaque
string identity plus a host-supplied widening relation (ADR-0003).
  - [StatifierBlocks.Assignability.Relation](StatifierBlocks.Assignability.Relation.md): A host's widening relation. Consulted only after identity has failed, so
an implementation can only widen, never narrow (ADR-0003 decision 6).
  - [StatifierBlocks.BlockType](StatifierBlocks.BlockType.md): The authoring-time extension seam. A host implements this behaviour once
per palette entry; the `core.*` structural vocabulary this package will
ship itself lands in a later record (ADR-0002 decision 10) and is not
present yet.
  - [StatifierBlocks.Palette](StatifierBlocks.Palette.md): A palette names the block types a host makes available: a map from a
block's `type_name` to the module implementing `StatifierBlocks.BlockType`
for it (ADR-0002 decision 2).

- Core block vocabulary
  - [StatifierBlocks.Core](StatifierBlocks.Core.md): The `core.*` structural vocabulary: the block types this package ships
itself (ADR-0002 decision 10).
  - [StatifierBlocks.Core.Assign](StatifierBlocks.Core.Assign.md): `core.assign`: a leaf step that writes one literal to one datamodel path.
  - [StatifierBlocks.Core.Branch](StatifierBlocks.Core.Branch.md): `core.branch`: one slot per condition arm, plus `otherwise` (ADR-0002
decision 10).
  - [StatifierBlocks.Core.Duration](StatifierBlocks.Core.Duration.md): The two duration spellings a `:duration` field may hold, and the one
form the engine reads.
  - [StatifierBlocks.Core.Emit](StatifierBlocks.Core.Emit.md): The SCXML shapes the `core.*` vocabulary compiles to (ADR-0004 decisions
2-4), and the small builders the core types share.
  - [StatifierBlocks.Core.Foreach](StatifierBlocks.Core.Foreach.md): `core.foreach`: a container whose body runs **once per item** of a
datamodel list (ADR-0004's 2026-08-29 amendment, F1 through F6).
  - [StatifierBlocks.Core.Group](StatifierBlocks.Core.Group.md): `core.group`: a boundary around a run of steps that interrupt rules can
fire against.
  - [StatifierBlocks.Core.Invoke](StatifierBlocks.Core.Invoke.md): `core.invoke`: a step that calls the host and waits for it to answer,
with an optional subtree for the failure case (ADR-0002 decision 10, as
amended 2026-08-29 section D).
  - [StatifierBlocks.Core.OnEvent](StatifierBlocks.Core.OnEvent.md): `core.on_event`: an interrupt handler, valid inside an `interrupts` slot
and nowhere else (ADR-0002 decision 10).
  - [StatifierBlocks.Core.Parallel](StatifierBlocks.Core.Parallel.md): `core.parallel`: one slot per lane, with no ordering between the lanes
(ADR-0002 decision 10).
  - [StatifierBlocks.Core.Raise](StatifierBlocks.Core.Raise.md): `core.raise`: a leaf that raises one event for an enclosing group's
interrupt rail (ADR-0002 decision 10's amendment, section D).
  - [StatifierBlocks.Core.ResumableGroup](StatifierBlocks.Core.ResumableGroup.md): `core.resumable_group`: a group whose `config` carries a history mode
(ADR-0002 decision 10).
  - [StatifierBlocks.Core.Send](StatifierBlocks.Core.Send.md): `core.send`: a leaf step that names an event and says **when**.
  - [StatifierBlocks.Core.Sequence](StatifierBlocks.Core.Sequence.md): `core.sequence`: an ordered run of steps, and the conventional document
root (ADR-0002 decision 10).
  - [StatifierBlocks.Core.Subchart](StatifierBlocks.Core.Subchart.md): `core.subchart`: a step that runs **another chart** and waits for it to
finish, routing on the outcome that chart finished with (ADR-0004's
2026-08-29 amendment, C1 through C3).
  - [StatifierBlocks.Core.Wait](StatifierBlocks.Core.Wait.md): `core.wait`: a leaf whose whole meaning is its config (ADR-0002 decision
10).

- Compiler
  - [StatifierBlocks.CompilationRecord](StatifierBlocks.CompilationRecord.md): The join between a block document and the chart it compiled to (ADR-0004
decision 7).
  - [StatifierBlocks.Compiled](StatifierBlocks.Compiled.md): What one successful compile produced (ADR-0004 decision 1).
  - [StatifierBlocks.Compiler](StatifierBlocks.Compiler.md): The one-way compile: a block document plus a palette in, one artifact out
(ADR-0004 decisions 1-4, 6-7).
  - [StatifierBlocks.Compiler.Attribution](StatifierBlocks.Compiler.Attribution.md): Resolves each element of one block's emission to the block an author
would recognise (ADR-0004 decision 5).
  - [StatifierBlocks.Compiler.Cancels](StatifierBlocks.Compiler.Cancels.md): The scope-shaped cancel: a delayed send armed by a child block is
cancelled in the `<onexit>` of the state that armed it (ADR-0004's
2026-08-29 amendment, "a delayed send's cancel, emitted in the arming
state's `<onexit>`").
  - [StatifierBlocks.Compiler.Chart](StatifierBlocks.Compiler.Chart.md): The Chart stage: run the generated SCXML through statifier's own
pipeline and route every finding back to a block (ADR-0004 decisions 9
and 10).
  - [StatifierBlocks.Compiler.Context](StatifierBlocks.Compiler.Context.md): What a block type is entitled to know while emitting, and nothing more
(ADR-0004 decision 4).
  - [StatifierBlocks.Compiler.DeclaredRoots](StatifierBlocks.Compiler.DeclaredRoots.md): How a block type contributes a **compiler-declared `<data>` root** to the
chart's one top-level `<datamodel>` (ADR-0004's 2026-08-29 foreach
amendment, F2 and F3), and the collision refusal F6 records.
  - [StatifierBlocks.Compiler.Finding](StatifierBlocks.Compiler.Finding.md): One thing the compiler has to say about one block (ADR-0004 decision 10).
  - [StatifierBlocks.Compiler.InvokeTypes](StatifierBlocks.Compiler.InvokeTypes.md): The two-registry gap, surfaced as data and linted only on request
(ADR-0004 decision 8).
  - [StatifierBlocks.Compiler.SensitivePaths](StatifierBlocks.Compiler.SensitivePaths.md): The secrets rule, checked against a document: a declared-sensitive
datamodel path may not be read into a trace-visible position (ADR-0002,
the accepted 2026-08-29 amendment "decision 7, an optional `sensitive?`
key, and the secrets rule behind it").
  - [StatifierBlocks.Compiler.Serializer](StatifierBlocks.Compiler.Serializer.md): Turns an `StatifierBlocks.Emission` tree into SCXML bytes, and records
where every one of them came from (ADR-0004 decisions 5 and 6).
  - [StatifierBlocks.Compiler.StateId](StatifierBlocks.Compiler.StateId.md): State ids derived from block ids by a pure function (ADR-0004 decision 3).
  - [StatifierBlocks.Emission](StatifierBlocks.Emission.md): One SCXML subtree, structurally (ADR-0004 decision 4).
  - [StatifierBlocks.Provenance](StatifierBlocks.Provenance.md): Which generated element came from which block (ADR-0004 decision 5).

- Edit algebra and view model
  - [StatifierBlocks.Edit](StatifierBlocks.Edit.md): The editor's command algebra. Pure, serializable, invertible - and
deliberately free of any UI framework dependency, so it is tested with
no editor shell present at all (ADR-0005 decision 1).
  - [StatifierBlocks.Edit.History](StatifierBlocks.Edit.History.md): Undo and redo over `StatifierBlocks.Edit.t()` commands (ADR-0005
decision 3), and the one funnel every editor command actually goes
through: `commit/4` runs `Edit.check_config/3` before `Edit.apply/2`, so
"invalid config never reaches the document" is a property of this
module, not a rule an editor shell has to remember to enforce itself.
  - [StatifierBlocks.Edit.Targets](StatifierBlocks.Edit.Targets.md): Drop-target enumeration (ADR-0005 decision 5): which slots would accept a
dragged block, at slot granularity rather than gap granularity.
  - [StatifierBlocks.Finding](StatifierBlocks.Finding.md): A finding as the editor renders it: normalized for presentation, and the
anchor routes it (ADR-0005 decision 11).
  - [StatifierBlocks.ViewModel](StatifierBlocks.ViewModel.md): Everything the editor renders, derived from `{document, palette,
findings}` (ADR-0005 decisions 9, 10, 11, 12, 13).
  - [StatifierBlocks.ViewModel.Field](StatifierBlocks.ViewModel.Field.md): One config field, its schema and its current value (ADR-0005 decision 9).
  - [StatifierBlocks.ViewModel.Form](StatifierBlocks.ViewModel.Form.md): A resolved node's config form: its fields, plus any `:config` finding
whose key matched no field (ADR-0005 decision 11's fourth routing row).

  - [StatifierBlocks.ViewModel.Node](StatifierBlocks.ViewModel.Node.md): One block, rendered: its resolved status, its presentation metadata,
its slots (recursive), its form, and its own findings.
  - [StatifierBlocks.ViewModel.PaletteGroup](StatifierBlocks.ViewModel.PaletteGroup.md): One palette section: types sharing `entry.group`, sorted by
`entry.order` then `entry.label` (ADR-0005 decision 10's grouping
rule).

  - [StatifierBlocks.ViewModel.Slot](StatifierBlocks.ViewModel.Slot.md): One named slot: declared or raw, with its children and its own findings.

- LiveView editor
  - [StatifierBlocks.Editor](StatifierBlocks.Editor.md): The block editor: the only stateful module in the package's rendered half
(ADR-0005 decisions 6, 8, 9, 13).
  - [StatifierBlocks.Editor.BlockNode](StatifierBlocks.Editor.BlockNode.md): One block's chrome, dispatching to its slots (ADR-0005 decisions 10, 11,
12, 13).
  - [StatifierBlocks.Editor.Canvas](StatifierBlocks.Editor.Canvas.md): The tree's root and the drag hook's element (ADR-0005 decisions 7, 13, 14).
  - [StatifierBlocks.Editor.ConfigForm](StatifierBlocks.Editor.ConfigForm.md): The selected block's config form (ADR-0005 decisions 9 and 13).
  - [StatifierBlocks.Editor.ConnectorLayer](StatifierBlocks.Editor.ConnectorLayer.md): The drawn connectors, and the element the measurement hook rides on
(ADR-0005 decision 10, and the 2026-08-29 amendment to decision 7).
  - [StatifierBlocks.Editor.Drawer](StatifierBlocks.Editor.Drawer.md): The full-width drawer row (ADR-0005, the 2026-08-29 shell amendment,
rulings 1A and 2A).
  - [StatifierBlocks.Editor.Field](StatifierBlocks.Editor.Field.md): One config field, dispatching on the closed field-type set (ADR-0005
decision 9, ADR-0002 decision 7).
  - [StatifierBlocks.Editor.Findings](StatifierBlocks.Editor.Findings.md): The document-level findings panel (ADR-0005 decision 11).
  - [StatifierBlocks.Editor.Icons](StatifierBlocks.Editor.Icons.md): The shipped default icon set, and the seam a host overrides it through
(ADR-0005 decision 10's `icon` key, decision 14's "markup, not styling"
line).
  - [StatifierBlocks.Editor.Inspector](StatifierBlocks.Editor.Inspector.md): The tabbed inspector: Config, Findings, Condition (ADR-0005, the 2026-08-29
shell amendment, ruling 3A).
  - [StatifierBlocks.Editor.PaletteBrowser](StatifierBlocks.Editor.PaletteBrowser.md): The grouped, searchable, filterable palette (ADR-0005 decisions 8, 10, 13).
  - [StatifierBlocks.Editor.Slot](StatifierBlocks.Editor.Slot.md): One named slot: its header, its children, its gaps, and its "+" buttons
(ADR-0005 decisions 5, 6, 8, 11, 13).
  - [StatifierBlocks.Editor.Toolbar](StatifierBlocks.Editor.Toolbar.md): The canvas toolbar (ADR-0005, the 2026-08-29 shell amendment, ruling 8A).

- Predicate evaluation
  - [StatifierBlocks.Predicates](StatifierBlocks.Predicates.md): The evaluation seam: a condition source string plus a binding context in,
`{:ok, boolean()} | {:error, reason()}` out, through `predicator`.
  - [StatifierBlocks.Predicates.Datamodel](StatifierBlocks.Predicates.Datamodel.md): The path/type index over a datamodel document (sb ADR-0006, accepted
2026-08-29), and the projections that record promises.
  - [StatifierBlocks.Predicates.TruthTable](StatifierBlocks.Predicates.TruthTable.md): A table spec plus rows in, a struct with per-cell outcomes, first-match-wins
selection and expectation status out.
  - [StatifierBlocks.Predicates.TruthTable.Cell](StatifierBlocks.Predicates.TruthTable.Cell.md): One row/column intersection: the raw evaluation `outcome`, whether the
column was `selected?` under first-match-wins, the row's declared
`expected` answer (if any), and the derived `status`. See
`StatifierBlocks.Predicates.TruthTable`'s moduledoc for what each
`status` value means.

  - [StatifierBlocks.Predicates.TruthTable.Column](StatifierBlocks.Predicates.TruthTable.Column.md): One truth-table column: a key, a display label, and a predicator source
string, or `source: nil` for the `otherwise` column.

  - [StatifierBlocks.Predicates.TruthTable.Row](StatifierBlocks.Predicates.TruthTable.Row.md): One truth-table row: the bindings that build its context, the resulting
cells (or a row-level `error` when the bindings themselves fail), and an
optional author-facing `note`.

