Editing UI
Saved data and its editing UI are separate. Parameters declare what is saved: IDs, types, defaults, constraints and scopes, which persistence, validation, Undo and project commands (including MCP) rely on. How they are edited is chosen at three levels, from no code to custom UI. Choose the smallest level, and the smallest editor, that does what was asked: a request for a changeable emoji is one string parameter (and a size if wanted), not a choice between emoji, text and uploaded artwork. editing-levels.tsx shows all three.
Generated controls (default). Every parameter gets a control: text field, switch, slider and number, segmented choice or menu, colour, date or month, file chooser with import. Nothing to write.
Arranged controls.
controlson the template, a spread, a box or an element arranges the generated controls of that scope's parameters: order, titled groups, labels, descriptions, and conditions. At the template level it arranges the document parameters in Book settings, below the fixed format choice.tsxcontrols: ['show', { group: 'Stamp', when: { show: true }, controls: [ 'text', { parameter: 'tilt', label: 'Rotation', description: 'Negative values turn it counter-clockwise.' }, 'ink', ] }],An entry is a parameter ID,
{ parameter, label?, description?, when? }, or{ group, description?, controls, when? }.whennames other parameters of the same scope and the values they must have (all must match; an array matches any of its values). For boxes, passcontrolsasbox.photo(label, parameters, { controls })or inbox.markdown's options.- A parameter left out of
controlsgets no generated control. It keeps its value, its validation and its project commands, so use this for values only a custom editor or an agent sets. A document parameter left out of a non-empty template-levelcontrolslist loads with adeclaration-control-missingwarning in the Book check, since a new setting is easily forgotten there. A document editor's own parameters, and parameters a spread marks on the page asdocument.<id>withctx.editorctx.Text, are exempt. controls: []shows no generated controls for the scope while keeping every declaration. A group needs at least one entry.- A condition only hides a control. The value stays saved and validated, and comes back when the condition holds again. Conditions are presentation: they never remove a declaration or change a saved ID.
- Click-to-edit follows the box's or element's
controlsfor its own parameters. A parameter a node explicitly shows withctx.editorctx.Textis always editable on that node. - The authoring types check entry IDs against the scope's parameters. Loading the template reports unknown or repeated IDs, a parameter a custom editor owns (an element editor's, or a document editor's at the template level), conditions on unknown parameters, on the control's own value, or on values the parameter can never have.
- Controls that can hide themselves for good load with a
declaration-control-cyclewarning in the Book check: a control inside a group shown only depending on that control (a group shown whileshowis on that containsshow), or controls whose conditions depend on each other (A shown only when B is on, B only when A is on). For layout (spread) parameters, the warning is given per spread: a spread that marks one of them on the page withctx.editorctx.Textgets none, since that node's popover always shows it, while another spread of the same layout that marks none of them (for example because its values hide the marked node) gets the warning on itself. Marking a box's or element's own parameter does not count: its popover follows the samecontrolsand conditions. For document parameters, the warning is dropped when any spread marks one of the cycle's parameters asdocument.<id>, since that node's popover shows it from any page.
- A parameter left out of
A custom editor for an element, below.
Presentation uses the export artwork path (ctx.mode === 'export'), including final text flow and crop geometry. Templates should omit editing scaffolding there, just as for PDF output.
Photo capture time, location and camera are described under Photo metadata. The editor's photo views also sort and group photos that have no EXIF capture time by their file's modification time, shown as an estimate; that estimate is editor-only and never reaches templates. Photo views compare camera wall times as shot, and show estimated modification times in the computer's local timezone, so mixed cameras and file dates group consistently. Sorting and grouping are per-book view preferences and do not change the rendered book.
Where editing happens
Click a box, element, or marked node to edit it. Generated item controls and photo controls share a fixed position at the bottom center of the visible canvas; the selected item remains outlined on the page. The sidebar lists items without repeating their controls.
- Photo boxes: clicking a placed photo selects it to drag and pinch. Its toolbar has a More photo actions menu for Replace photo…, Remove photo (also Backspace or Delete while the photo is selected), and Crop values…, alongside the box's own parameters and any other parameters the template marks the box with (such as a spread setting shown in its caption). An empty photo box (or one whose frame the template rotates) opens a popover with Choose photo and the same settings.
- Markdown boxes: clicking one opens a popover with its text (assign, import, show), its place in the text flow, its parameters and any parameters the template marks it with.
- Elements: an element with a custom editor opens it at the same bottom-center canvas position, with a scrolling body and a fixed header with × to close. The canvas stays scrollable, and the element's other parameters appear below the custom controls. Spread parameters the editor declares in
spreadare edited there too; other spread parameters marked on such an element stay in the sidebar. Any other element opens a popover with its generated controls. - Marked nodes: a node marked with
ctx.Textorctx.editopens a popover for those parameters. A node smaller than the box under it wins, so a heading over a photo edits the heading. A parameter may be shown by several nodes, such asctx.Text parameter="heading"on both pages: each is its own place to edit, the selection outline follows the occurrence clicked and Tab reaches each, while all of them edit the same saved value. The sidebar lists the parameter once. - The sidebar holds the spread's layout, the spread parameters nothing on the page edits, content kept for other layouts, and a list of what the page edits: marked nodes such as
ctx.Textheadings (in reading order), then the declared boxes and elements. The list shows what each holds and opens the same editors, so empty, overlapping and keyboard users reach everything. Boxes and elements are told apart by identity, never by position, so two at the same place each edit their own values. A box or element the layout does not render right now opens the same bottom panel with its declared parameters and a note that it is hidden. Format and document parameters live together in the template controls, named for the template. The app header uses the book’s file name. Menus open the editing surfaces; they do not duplicate custom controls.