Composition / foldkit-composition

Mental model

code, deployed                                data, stored
Block    a name, a props Schema,              Document
         its Regions, the Content it is         roots: [id, ...]
Catalog  the Blocks one context allows,         nodes: { id: { block, props, regions } }
         and which may be a root
                     \                          /
                      Composition.validate(catalog, document) → [] | diagnostics

A Region is a stored position inside a Block where other Blocks go, such as a Hero's actions. It accepts Blocks by Content, what a Block is (Section, Flow, Interactive), not by name, so a Region written today accepts a Block written next year.

Install

bash
pnpm add foldkit-composition
ts
import { Block, Catalog, Composition, Content, Region } from 'foldkit-composition'