Composition / foldkit-mixins-builder
A narrow editor
Where the editor is narrow, it can show one of its three panels at a time:
ts
const PageEditing = BuilderView.define(PageBuilder).pipe(
Style.attach(BuilderView.narrow('52rem')),
)- The width is the editor's own, not the window's. Below
widthof the containerbuilder, the Builder's root, thePanelspart shows: arole="group"of three buttons (Add, Layers, Settings), the chosen onearia-pressed, as the viewports are, and only the panel the Builder'spanelnames shows. Wider, the buttons are hidden (the Builder's default Style) and every panel shows. They are not ARIA tabs, which would promise arrow keys and a roving tab stop. - The Builder chooses the panel as it always has: a button sends
PanelChosen, and selecting a node on the page chooses Settings; a row clicked in the layers selects its node and keeps the layers showing. Each panel carries itsid,data-panelanddata-panel-shown, and each buttonaria-controlsit; a layout of your own that drawsPanelsshould draw the three panels. - It is in the
applayer, so it outranks an application's placing of the panels inappor an earlier layer; an unlayered style outranks every layer, and would show a hidden panel.narrow(width, { layer })puts it elsewhere.
As a form key
builder.inputWith(view) is the Builder's form control, builder.input, drawn
by another view. The form draws a Bundle-backed control with the Bundle's own
view, so no renderer is needed. With PageInput from the
Builder's example:
ts
import { Form } from 'foldkit-form'
const PageForm = Form.make('PageForm', PageInput, {
inputs: { document: PageBuilder.inputWith(BuilderView.submodel(PageEditing)) },
})The CMS example (examples/cms) places its page form this way.