Composition / foldkit-composition
Reading a Document
Composition.index(document)says where each reachable node is: its parent, Region and index. It is derived, never stored, and computed once per Document value.Composition.describe(catalog, document)writes the Document as indented text, one node per line, with a Block the Catalog does not know marked?and a label that says more than the name after it (Banner "Promo banner").Catalog.describe(catalog)lists each Block's words, props, Regions, Content and metadata, for a person, a tool or an agent.Block.words({ label, description, group })says what a Block is called and what it is for, each word in place of the one before; the label defaults to the name spaced (PostListis "Post list"). It is a pipe step, so an application words a Block another package defined:Text.pipe(Block.words({ group: 'Text' })). An editor's palette and an agent's tool both read it. An appearance axis names its values the same way, withlabels: { lg: 'Large' }.Block.decode(block, props)decodes stored props to the Block's typed props, andPropsOf<typeof Heading>is their type.Block.annotate(metadata)attaches an interpreter'sfoldkit-metadata, such as the control an editor draws a prop with. The Block knows no annotation's meaning.