StatifierBlocks (StatifierBlocks v0.1.0)

Copy Markdown View Source

Block document model, one-way SCXML compiler, and LiveView editor components for composing Statifier statecharts from typed blocks.

A block document is the authoring artifact: a tree of typed blocks that a person composes in an editor. The compiler turns that document into SCXML in one direction only - the document is the source of truth, and the chart it produces is a build product. Nothing decompiles a chart back into blocks.

This module is the package's root and carries no functions. The map below is where to start; the README's worked example runs the whole path end to end.

The model

ModuleWhat it is
StatifierBlocks.Blockone node: {type, id, type_version, config, slots} and nothing else (ADR-0001)
StatifierBlocks.Documentthe tree plus its envelope: the pre-order walk, path lookup, validation, canonical JSON, content hash, decode
StatifierBlocks.BlockTypethe behaviour a block type implements, including config_schema/1 and its optional value_path (ADR-0002)
StatifierBlocks.Palettea caller-supplied type_name => module value - never application config, never a named process
StatifierBlocks.Corethe seven core.* structural types this package ships
StatifierBlocks.Assignabilitymay this block land in this slot, by kind tag and by host-widened data-flow type (ADR-0003)

The compile

ModuleWhat it is
StatifierBlocks.Compilercompile/3: a total function of {document, palette} (ADR-0004)
StatifierBlocks.Compiledwhat one successful compile produced
StatifierBlocks.Provenancewhich generated element came from which block, keyed by state id and by byte span
StatifierBlocks.CompilationRecordthe join between document identity and chart identity

The editor

ModuleWhat it is
StatifierBlocks.Editthe pure command algebra - insert, remove, move, update config, each with its inverse (ADR-0005)
StatifierBlocks.Edit.Historythe undo/redo stack over that algebra, and the palette-aware gate on it
StatifierBlocks.ViewModeleverything a renderer needs, derived from {document, palette} and stored nowhere
StatifierBlocks.Editorthe LiveView component a host embeds

LiveView is an optional dependency and every Editor.* module is compiled behind a presence guard, so a host that only compiles documents pulls in none of it and compiles no editor code at all. Everything above the editor row is available in that tree.