Bundle / foldkit-bundle
Drawing with what the parent holds
A child's view reads its own Model and the inputs the parent's view passes.
A fact only the parent holds, such as whether a write the child started has
been answered, reaches it through viewInputs in the placement config, which
rewrites those inputs at every draw:
const Shown = Shelf.at(Notice, {
// Whether the page is online is the page's to know; the notice draws it.
viewInputs: (model, given) => ({ ...given, offline: !model.online }),
})given is what Shown.view(model, h, inputs) was called with, and the
function returns the inputs the child's view takes. It reads; it changes no
Model. Crud.editor places its form this way, so the drawn form reads busy
while its save is in flight.
A view that takes no inputs ((model, h)) refuses viewInputs as a type
error: it would never be called, so what it adds would never show. A bundle
made without a view takes it, since its view is the page's to draw: its
inputs are NoView, not void.
Presets
bundle.with(args) binds the args, so a placement gives none:
const PrefersDark = MediaQuery.with({ query: '(prefers-color-scheme: dark)' })
Page.place(PrefersDark, 'dark')Page.place(bundle, field, config) is Page.at without a separate declaration,
for a Message union built another way.