Composition / API

foldkit-composition/surface

foldkit-composition/surface: Blocks that show a feature.

A Surface-backed Block places a foldkit-surface Surface, such as a cart summary, where an author puts it, with params its props give. The Surface still owns what it reads and which Messages it may send; the Block only chooses where the feature appears and with which params.

SurfaceBlock.reads(catalog, document) is every Surface Block on the page as one Projection over the Model, keyed by node, and SurfaceBlock.active is it as an active Surface, so whatever the Surfaces read is fetched, and resumed under SSR, as their own reads are. The Renderer hands each node its value as data, and the Block's value(data) reads it typed.

SurfaceBlock.families(catalog, { from, document }) is the same Blocks as one Surface.each family per Block for Remote and SSR, where per-node requirements, retention, and coverage matter rather than one combined read. Rendering still reads through reads and data.

The Block holds its Surface, whose type carries the application's Model. Where the Catalog is itself part of that Model, as it is when a form places the page Builder, that is circular: a Block there names what it reads, as a Query Block does, rather than holding it.

Namespaces

SurfaceBlockA Block that shows a Surface's feature.

Functions

dataOfA page's reads as a Renderer's data: each node's value, or nothing while inactive.

Interfaces

PageReadsThe page's reads as an active Surface, whose Projection says what it reads: each node's value.