Composition / foldkit-builder

Helpers

Each helper that may have no answer returns an Option, as the Model's selected, hovered, refused and drag are. The Model stores them as null (Schema.OptionFromNullOr), so a saved Builder, such as a CMS draft, is JSON.

  • PageBuilder.placeFor(document, selected, block) is where the palette puts a new node: inside the selection when a Region there accepts it, else after the selection, else last among the roots, or last in the last Region on the page with room that accepts it; none where the Block can go nowhere.
  • PageBuilder.patternAt(document, selected, pattern) is the same for a pattern, by its root's Block; none for a pattern the Catalog lacks. Its use is one usePattern edit, undone as one.
  • PageBuilder.moveBy(document, id, delta) is the Operation that moves a node among its siblings; none at an end.
  • PageBuilder.dropAt(document, source, target, zone) is where a drag over target would put dragged; none where the page refuses it.
  • PageBuilder.keyPressed(model, key, modifiers) is what a key on the layers or the canvas sends, for Foldkit's OnKeyDownPreventDefault: KeyPressed for a key a command binds, none for another or while text is edited.
  • PageBuilder.keyCommand(model, key, modifiers) is the Message a shortcut runs in the Model given; none for a key with nothing to do there.
  • PageBuilder.replace(model, document) and PageBuilder.settle(model) are what the form control's fill and settle do.

Limits

  • One node is selected at a time.
  • The plain view is plain, and names its panels in English. The drawn editor is foldkit-mixins-builder.
  • A starting props value must encode with its Block's Schema.