bun run demo:desktop opens the travel notebook using only built-in views. Select a section, choose a document, then press Show checklist in the toolbar (or ⌘2). Check a task, navigate away and return: the notebook model, not a Swift shell, owns the checkmark. bun run demo:workspace opens the original custom SwiftUI rendering shown in the recording.h.desktop the sole top-level element to fill the surface, including when the window resizes. Other top-level views retain the original centered layout. Built-in views accept size: { width?, height?, minWidth?, minHeight? } in nonnegative points. Omit a size constraint to let AppKit choose. Layouts accept renderer-managed children, including components and registered leaves. Use h.label for text outside stack and row.| Builder | Native behavior |
stack, row | NSStackView; spacing (default 8), equal-edge padding, cross-axis alignment: leading, center, trailing or fill. For a row, leading/trailing on its cross-axis mean top/bottom. |
grid | NSGridView; positive integer columns (default 2), spacing. Children flow row by row in renderer order. |
split | Draggable NSSplitView panes, arranged side-by-side for axis: "horizontal" (default), top/bottom for "vertical". Set minimum pane sizes on the children. |
scroll | Vertical NSScrollView; the document stack fits the viewport width. on("scroll", ({x, y}) => …) observes clip bounds in points. For large homogeneous data, use the collections below instead. |
material | NSVisualEffectView, with material of sidebar, content, header, or popover. The system resolves appearance and accessibility settings. |
image | NSImageView. source takes one SF Symbol symbol or local fileURL, plus a description for accessibility. No remote fetch. |
label | textStyle: { font?, color?, wrap? }; fonts body, headline, title, caption, monospaced; adaptive colors label, secondary, accent, red. |
12345h.table .prop("columns", [{ id: "title", title: "Document" }, { id: "place", title: "Place", width: 120 }]) .prop("rows", [{ id: "journal", title: "Postcards", cells: { place: "Naples" } }]) .prop("selection", model.documentID) .on("select", id => Message.Select({ id }))
list is a headerless single-column NSTableView; table displays named columns. outline uses NSOutlineView and accepts recursive children arrays on rows. Each row needs a unique, stable string id across the entire collection and a title. A cell uses cells[column.id] if provided; otherwise the title column (or first column) uses title. AppKit recycles offscreen cells; the row data crosses the bridge as a snapshot, not a streamed or paged data provider. Reuse a rows array while the data has not changed.select sends a row ID, or null on deselection. Omit selection for native ownership, or supply a string or null to keep selection controlled. An ignored change restores the model selection. Reordering rows does not change their identity; an outline remembers keyed branches' expansion. Selecting a nested item opens its ancestors. Duplicate row/column IDs are errors.{ id, title, symbol?, key? }. Handle on("action", id => …) to receive its ID, not its display label. Key equivalents are local to the key window, not system hotkeys. Prefer a single desktop per window.| Builder | Contract |
desktop | title, toolbar (NSToolbar actions), commands (key window's Commands menu), contextMenu (native context menu at the desktop), and windowAction: { id, action: "minimize" | "zoom" | "close" }. Supply a fresh request ID for each intentional action. Window creation belongs to the embedder; removing the desktop restores its previous chrome. |
menuButton | Native pull-down button, title plus items (actions). |
navigation | page is a zero-based index into the ordered children. The inactive native pages detach but keep their state. Set page from model state to implement Back/Forward; this does not create global navigation history. |
popover, sheet | title labels a native trigger button. The children become the content of a transient NSPopover or document-modal sheet. Escape or Done dismisses; dismiss carries null. Focus returns to the prior responder if it still belongs to the presenting window. |
alert | title labels the trigger, message and detail describe the alert, and items describe the buttons in order. Respond to action for the choice the user actually made. |
inputArea marks a specific region (give it a size or children). Set label for accessibility. Its background and passive labels/images receive pointer events; embedded controls retain their normal click and key handling. An area listening for key accepts first responder on click. No application-wide monitor or cancellable DOM event is installed.hover: boolean on enter/exit of its tracking area in the key window.pointer: { phase: "down" | "up" | "move" | "drag", x, y, button, clicks, shift, command, control, option }, for primary-button interactions and pointer motion. Coordinates are local points measured from the top-left.key: { phase: "down" | "up", characters, code, repeat, shift, command, control, option }. Menu shortcuts and AppKit key traversal retain their native meanings. Use editable controls for text/IME input.resize: { width, height } in points; successive frame changes during layout are coalesced.drop: { files: string[], text: string | null } for a copy from the dragging pasteboard. files contains file URL strings, not bytes, persistent permissions or security-scoped bookmarks. Set dragText to start native text drags from this region.