@kerfjs/ui 5.0.0-beta.54 → 5.0.0-beta.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +3 -2
  2. package/ai/component-catalog-v2.json +58 -1
  3. package/ai/component-catalog.json +105 -8
  4. package/ai/public-api-signatures-v1.md +265 -28
  5. package/ai/skill.md +6 -4
  6. package/ai/webawesome-jsx-signatures-v1.md +1 -1
  7. package/dist/browser/popup-menu.js +3 -0
  8. package/dist/catalog-resources.d.ts +1 -1
  9. package/dist/catalog.d.ts +10 -4
  10. package/dist/catalog.js +243 -300
  11. package/dist/catalog.js.map +1 -1
  12. package/dist/{chunk-7IUSV4XG.js → chunk-24PHKUR3.js} +2 -2
  13. package/dist/chunk-24PHKUR3.js.map +1 -0
  14. package/dist/chunk-4BIMLITI.js +92 -0
  15. package/dist/chunk-4BIMLITI.js.map +1 -0
  16. package/dist/{chunk-ZK5EGVFP.js → chunk-5OLVUEND.js} +12 -2
  17. package/dist/chunk-5OLVUEND.js.map +1 -0
  18. package/dist/{chunk-CMUIXJZM.js → chunk-BSKEH3UC.js} +2 -2
  19. package/dist/{chunk-CMUIXJZM.js.map → chunk-BSKEH3UC.js.map} +1 -1
  20. package/dist/chunk-EAX2GSS4.js +384 -0
  21. package/dist/chunk-EAX2GSS4.js.map +1 -0
  22. package/dist/chunk-KH6VUGHU.js +399 -0
  23. package/dist/chunk-KH6VUGHU.js.map +1 -0
  24. package/dist/{chunk-BJJKFVWW.js → chunk-LZXQVUGN.js} +2 -2
  25. package/dist/chunk-LZXQVUGN.js.map +1 -0
  26. package/dist/chunk-N7FHFNT6.js +55 -0
  27. package/dist/chunk-N7FHFNT6.js.map +1 -0
  28. package/dist/{chunk-KPNTVB7A.js → chunk-R754MHXX.js} +3 -3
  29. package/dist/{chunk-KPNTVB7A.js.map → chunk-R754MHXX.js.map} +1 -1
  30. package/dist/{chunk-HJKRCKDR.js → chunk-RNRUVPJ3.js} +4 -2
  31. package/dist/chunk-RNRUVPJ3.js.map +1 -0
  32. package/dist/collapsible-panel.d.ts +40 -13
  33. package/dist/collapsible-panel.js +41 -10
  34. package/dist/collapsible-panel.js.map +1 -1
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +17 -16
  37. package/dist/list-header.js +1 -1
  38. package/dist/list-inset-text.d.ts +7 -1
  39. package/dist/list-inset-text.js +2 -1
  40. package/dist/panel-toolbar-BFQxFITu.d.ts +52 -0
  41. package/dist/popup-menu-register.d.ts +9 -0
  42. package/dist/popup-menu-register.js +30 -0
  43. package/dist/popup-menu-register.js.map +1 -0
  44. package/dist/popup-menu.d.ts +71 -0
  45. package/dist/popup-menu.js +3 -0
  46. package/dist/popup-menu.js.map +1 -0
  47. package/dist/state-banner.js +1 -1
  48. package/dist/styles/catalog/components/catalog-example.css +0 -16
  49. package/dist/styles/catalog/components/catalog-stage.css +8 -13
  50. package/dist/styles/catalog/components/catalog.css +8 -18
  51. package/dist/styles/catalog.css +0 -5
  52. package/dist/styles/popup-menu.css +12 -0
  53. package/dist/styles/state-banner.css +13 -4
  54. package/dist/styles/styles.css +1 -0
  55. package/dist/styles/tab-bar.css +31 -3
  56. package/dist/styles/toolbar-control-group.css +13 -0
  57. package/dist/styles/toolbar.css +43 -2
  58. package/dist/styles/workbench.css +31 -0
  59. package/dist/text.js +1 -1
  60. package/dist/token-search-field.d.ts +10 -1
  61. package/dist/token-search-field.js +1 -1
  62. package/dist/{types-CEsieBZi.d.ts → types-D6vzj-VT.d.ts} +15 -0
  63. package/dist/wire-catalog.d.ts +13 -1
  64. package/dist/wire-catalog.js +18 -3
  65. package/dist/wire-catalog.js.map +1 -1
  66. package/dist/wire-sidebar.js +6 -3
  67. package/dist/wire-sidebar.js.map +1 -1
  68. package/dist/wire-token-search-fields.js +1 -1
  69. package/dist/wire-workbench.js +1 -350
  70. package/dist/wire-workbench.js.map +1 -1
  71. package/dist/workbench.d.ts +107 -6
  72. package/dist/workbench.js +11 -208
  73. package/dist/workbench.js.map +1 -1
  74. package/docs/accessibility.md +12 -1
  75. package/docs/catalog.md +27 -9
  76. package/docs/collapsible-panel.md +55 -0
  77. package/docs/component-contract.md +2 -2
  78. package/docs/component-selection.md +25 -17
  79. package/docs/design/templates/state-banner/danger-dark.svg +1 -1
  80. package/docs/design/templates/state-banner/danger.svg +1 -1
  81. package/docs/design/templates/state-banner/info-dark.svg +1 -1
  82. package/docs/design/templates/state-banner/info.svg +1 -1
  83. package/docs/design/templates/state-banner/success-dark.svg +1 -1
  84. package/docs/design/templates/state-banner/success.svg +1 -1
  85. package/docs/design/templates/state-banner/warning-dark.svg +1 -1
  86. package/docs/design/templates/state-banner/warning.svg +1 -1
  87. package/docs/design/templates/state-banner-dark.svg +1 -1
  88. package/docs/design/templates/state-banner.svg +1 -1
  89. package/docs/layout.md +5 -0
  90. package/docs/recipes.md +44 -37
  91. package/docs/surface-scaffold.md +1 -1
  92. package/docs/ux-demo.md +6 -2
  93. package/docs/workbench.md +92 -7
  94. package/llms.txt +6 -5
  95. package/package.json +13 -2
  96. package/ux-demo/recipes/app-shell.tsx +141 -223
  97. package/ux-demo/recipes/collapsible-sidebar.tsx +44 -75
  98. package/ux-demo/recipes/list-detail-dialog.tsx +150 -54
  99. package/ux-demo/recipes/mount-recipe.ts +0 -5
  100. package/ux-demo/recipes/types.ts +0 -1
  101. package/dist/chunk-7IUSV4XG.js.map +0 -1
  102. package/dist/chunk-BJJKFVWW.js.map +0 -1
  103. package/dist/chunk-HJKRCKDR.js.map +0 -1
  104. package/dist/chunk-ZK5EGVFP.js.map +0 -1
  105. package/dist/styles/catalog/components/catalog-detail.css +0 -35
  106. package/dist/styles/catalog/components/catalog-resource-footer.css +0 -37
  107. package/dist/styles/catalog/components/catalog-secondary-sections.css +0 -38
  108. package/dist/styles/catalog/components/catalog-section-list.css +0 -22
  109. package/dist/styles/catalog/components/catalog-sidebar.css +0 -82
@@ -1 +1 @@
1
- {"version":3,"sources":["../src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AAA,CAAA;AAC9D,IAAA,SAAA,CAAU,IAAA;AAAA,MACR,qBAAA;AAAA,QACE,IAAA;AAAA,QACA,MACE,KAAK,OAAA,CAAQA,SAAQ,IACjB,IAAA,GACA,IAAA,CAAK,cAA2BA,SAAQ,CAAA;AAAA,QAC9C,aAAA;AAAA,QACA;AAAA;AACF,KACF;AAAA,EACF;AAEA,EAAA,OAAO,MAAM;AACX,IAAA,UAAA,IAAa;AACb,IAAA,UAAA,GAAa,MAAA;AACb,IAAA,KAAA,MAAW,OAAA,IAAW,SAAA,CAAU,MAAA,CAAO,CAAC,GAAG,OAAA,EAAQ;AAAA,EACrD,CAAA;AACF","file":"wire-workbench.js","sourcesContent":["// The transient-overlay behavior `wireWorkbench` gives Workbench panels that\n// present as overlays: a responsive overlay starts collapsed when its\n// breakpoint begins to apply, an open overlay takes focus and keeps Tab inside\n// it, and it closes on Escape or a press outside it. It mirrors `wireSidebar`'s\n// compact overlay (the ARIA dialog pattern). Internal.\n\nimport { effect, type Signal } from 'kerfjs';\n\nimport type { WorkbenchPanelKey } from './workbench-resize.js';\n\n/** A Workbench panel whose app-owned `collapsed` signal the wiring may write. */\nexport interface WorkbenchOverlayPanel {\n key: WorkbenchPanelKey;\n collapsed: Signal<boolean>;\n}\n\n/** Each panel's own element, never a nested Workbench's. */\nconst PANEL_SELECTORS: Record<WorkbenchPanelKey, string> = {\n leftRail: ':scope > [data-workbench-rail=\"left\"]',\n rightRail: ':scope > [data-workbench-rail=\"right\"]',\n bottomDrawer: ':scope > .kui-workbench__center > [data-workbench-drawer]',\n};\n\nconst RESTORE_PANELS: Record<WorkbenchPanelKey, string> = {\n leftRail: 'left',\n rightRail: 'right',\n bottomDrawer: 'bottom',\n};\n\nconst FOCUSABLE =\n 'a[href],area[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * The panel's focusable controls, in tab order. Only an open panel is ever\n * asked. The selector drops disabled controls and `tabindex=\"-1\"`; a\n * rendered control the CSS hides (the separator of a panel whose responsive\n * overlay breakpoint applies is `display: none`) is dropped too, or Tab would\n * wrap from a control focus can never reach. Where `checkVisibility` is\n * missing, every matched control counts.\n */\nconst focusables = (element: HTMLElement): HTMLElement[] =>\n [...element.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (control) =>\n typeof control.checkVisibility !== 'function' ||\n control.checkVisibility(),\n );\n\n/**\n * Wire transient overlay behavior for the given panels of the Workbench that\n * `findWorkbench` returns (looked up on use, so the Workbench may render after\n * wire-up). The app still owns each `collapsed` signal; this wiring only\n * writes it:\n *\n * - When a panel's `responsiveOverlayAt` breakpoint begins to apply (at\n * wire-up, on first render, or on a crossing), its inline collapsed state is\n * remembered and the panel collapses, so no overlay covers the work area\n * until the user opens it. When the breakpoint stops applying (or on\n * disposal) the remembered state comes back. These presentation changes\n * skip the collapse motion.\n * - A panel that opens while it presents as an overlay takes focus: its\n * first focusable control (else the panel itself) is focused, without\n * scrolling its sliding content. While an overlay is open, Tab and\n * Shift+Tab cycle through the controls of the overlay that holds focus\n * (else the most recently opened one) and never reach the work area it\n * covers — the ARIA dialog pattern `wireSidebar`'s compact overlay follows.\n * Inline panels are left alone.\n * - Escape closes the open overlay panel that holds focus, else the most\n * recently opened one; a press that starts and ends outside an open overlay\n * panel closes it. Static `presentation: \"overlay\"` panels are included.\n * - Focus stranded in a panel that closes — however it closed, including\n * through the app's own control inside it — returns to the control that\n * had it when the panel opened, else to the panel's restore control, else\n * to a control outside it whose `aria-controls` names the panel (or an\n * element inside it). The last covers a panel that was already open at\n * wire-up, which has no recorded opener. Focus a press inside the panel\n * dropped to the body counts as stranded too: Safari and macOS WebKit\n * never focus a clicked button, so pressing the panel's own close control\n * blurs the focused control before the click closes the panel. Focus the\n * user has since moved to any element is left where it is.\n * - With `exclusive`, a panel that opens while it presents as an overlay\n * closes every other open overlay panel, so overlays never cover each\n * other's controls. Inline panels are never closed by it.\n *\n * Returns a disposer.\n */\nexport function wireWorkbenchOverlays(\n root: HTMLElement,\n findWorkbench: () => HTMLElement | null,\n panels: readonly WorkbenchOverlayPanel[],\n exclusive = false,\n): () => void {\n const ownerDocument = root.ownerDocument;\n const disposers: Array<() => void> = [];\n // Open panels, most recently opened last, and each one's opener: the\n // control that had focus when it opened.\n const openOrder: WorkbenchOverlayPanel[] = [];\n const openers = new Map<WorkbenchOverlayPanel, HTMLElement>();\n // The open panel the latest press started in while focus was inside it,\n // until focus next lands anywhere. Safari and macOS WebKit never focus a\n // clicked button, so pressing a panel's own close control blurs the focused\n // control to the body before the click closes the panel; this is how the\n // close still counts as leaving focus stranded in it.\n let pressedFocus: WorkbenchOverlayPanel | undefined;\n\n const panelElement = (panel: WorkbenchOverlayPanel): HTMLElement | null =>\n findWorkbench()?.querySelector<HTMLElement>(PANEL_SELECTORS[panel.key]) ??\n null;\n /** Whether the panel's responsive overlay breakpoint currently applies. */\n const responsive = (element: HTMLElement): boolean =>\n element.dataset.presentation === 'inline' &&\n element.hasAttribute('data-responsive-overlay-at') &&\n globalThis.getComputedStyle(element).position === 'absolute';\n const overlaid = (element: HTMLElement): boolean =>\n element.dataset.presentation === 'overlay' || responsive(element);\n\n /** Where focus goes when a panel it was in closes. */\n const restoreTarget = (\n panel: WorkbenchOverlayPanel,\n element: HTMLElement | null,\n ): HTMLElement | undefined => {\n const opener = openers.get(panel);\n // An opener inside another panel that has closed since (an exclusive\n // overlay closes the one it was opened from) would strand focus there too.\n if (\n opener?.isConnected &&\n !element?.contains(opener) &&\n !panels.some(\n (other) =>\n other.collapsed.peek() && panelElement(other)?.contains(opener),\n )\n )\n return opener;\n const side = RESTORE_PANELS[panel.key];\n const restore = findWorkbench()\n ?.querySelector<HTMLElement>(\n `.kui-workbench__restore[data-panel=\"${side}\"]`,\n )\n ?.querySelector<HTMLElement>(FOCUSABLE);\n return restore ?? (element ? controller(element) : undefined);\n };\n /**\n * A control outside the panel that names it, or an element inside it, in\n * its `aria-controls`: the app's toggle for a panel with no opener.\n */\n const controller = (element: HTMLElement): HTMLElement | undefined => {\n const ids = new Set(\n [element, ...element.querySelectorAll('[id]')].map((node) => node.id),\n );\n ids.delete('');\n return [\n ...ownerDocument.querySelectorAll<HTMLElement>('[aria-controls]'),\n ].find(\n (control) =>\n !element.contains(control) &&\n control.matches(FOCUSABLE) &&\n control\n .getAttribute('aria-controls')!\n .split(/\\s+/)\n .some((id) => ids.has(id)),\n );\n };\n const rescueFocus = (panel: WorkbenchOverlayPanel): void => {\n const element = panelElement(panel);\n const target = restoreTarget(panel, element);\n if (target) {\n target.focus();\n return;\n }\n // An app that renders its restore control after this write has not\n // produced it yet; look again once the current batch settles.\n globalThis.queueMicrotask(() => {\n if (!panel.collapsed.peek()) return;\n const later = restoreTarget(panel, panelElement(panel));\n const active = ownerDocument.activeElement;\n if (later) later.focus();\n else if (active instanceof HTMLElement && element?.contains(active))\n active.blur();\n });\n };\n\n /**\n * A presentation-driven write: no collapse motion, because nothing the user\n * did moved the panel. The app's render has normally applied the new state\n * by the time the write returns, so the content's transition is suspended\n * across one style flush.\n */\n const adapt = (\n panel: WorkbenchOverlayPanel,\n element: HTMLElement,\n collapsed: boolean,\n ): void => {\n if (panel.collapsed.peek() === collapsed) return;\n const stranded = collapsed && element.contains(ownerDocument.activeElement);\n panel.collapsed.value = collapsed;\n // Every Workbench panel renders its content wrapper, and never with a\n // style of its own, so the attribute goes again once the flush is done.\n const content = element.querySelector<HTMLElement>(\n ':scope > .kui-workbench__panel-content',\n )!;\n content.style.transition = 'none';\n void globalThis.getComputedStyle(content).transform;\n content.removeAttribute('style');\n // The collapse effect has normally returned the focus already; on\n // disposal, after the effects are gone, this is what returns it.\n if (stranded && element.contains(ownerDocument.activeElement))\n rescueFocus(panel);\n };\n\n // The inline collapsed state of each panel whose responsive overlay\n // currently applies, restored when it stops applying.\n const inlineState = new Map<WorkbenchOverlayPanel, boolean>();\n const sync = (): void => {\n for (const panel of panels) {\n const element = panelElement(panel);\n if (!element) continue;\n const active = responsive(element);\n if (active && !inlineState.has(panel)) {\n inlineState.set(panel, panel.collapsed.peek());\n adapt(panel, element, true);\n } else if (!active && inlineState.has(panel)) {\n const remembered = inlineState.get(panel)!;\n inlineState.delete(panel);\n adapt(panel, element, remembered);\n }\n }\n };\n\n // The Workbench is its own breakpoint container, so its size is what moves a\n // panel across the breakpoint. It may render after wire-up or be replaced,\n // and the app may change a presentation, so both are observed too.\n let observed: HTMLElement | null = null;\n const resizeObserver =\n typeof globalThis.ResizeObserver === 'function'\n ? new globalThis.ResizeObserver(() => sync())\n : undefined;\n /** Observe the current Workbench; whether it changed. */\n const track = (): boolean => {\n const workbench = findWorkbench();\n if (workbench === observed) return false;\n if (observed) resizeObserver?.unobserve(observed);\n observed = workbench;\n if (workbench) resizeObserver?.observe(workbench);\n return true;\n };\n const mutationObserver = new MutationObserver((records) => {\n if (track() || records.some((record) => record.type === 'attributes'))\n sync();\n });\n mutationObserver.observe(root, {\n attributes: true,\n attributeFilter: ['data-presentation', 'data-responsive-overlay-at'],\n childList: true,\n subtree: true,\n });\n disposers.push(() => {\n mutationObserver.disconnect();\n resizeObserver?.disconnect();\n });\n track();\n sync();\n\n for (const panel of panels) {\n let previous = panel.collapsed.peek();\n if (!previous) openOrder.push(panel);\n disposers.push(\n effect(() => {\n const collapsed = panel.collapsed.value;\n if (collapsed === previous) return;\n previous = collapsed;\n const index = openOrder.indexOf(panel);\n if (index >= 0) openOrder.splice(index, 1);\n if (collapsed) {\n // Whatever closed the panel — Escape, an outside press, a\n // breakpoint, or the app's own control inside it — focus left in\n // it would be stranded in a hidden panel. So would focus that a\n // press inside it dropped to the body (see `pressedFocus`).\n const active = ownerDocument.activeElement;\n if (\n panelElement(panel)?.contains(active) ||\n (pressedFocus === panel &&\n (active === null || active === ownerDocument.body))\n )\n rescueFocus(panel);\n return;\n }\n openOrder.push(panel);\n const element = panelElement(panel);\n const active = ownerDocument.activeElement;\n if (\n active instanceof HTMLElement &&\n active !== ownerDocument.body &&\n !element?.contains(active)\n )\n openers.set(panel, active);\n else openers.delete(panel);\n if (!element || !overlaid(element)) return;\n // Opening an overlay closes the others. Their collapse effects run\n // after this one, by which time focus has moved into this panel, so\n // none of them hands it back to an opener.\n if (exclusive)\n for (const [other] of openOverlays())\n if (other !== panel) other.collapsed.value = true;\n // An overlay covers the work area, so focus moves in with it rather\n // than staying on a control it may cover. Without preventScroll the\n // browser scrolls the panel's clipped, still-sliding content to reveal\n // the target, which then unwinds as the slide finishes.\n (focusables(element)[0] ?? element).focus({ preventScroll: true });\n }),\n );\n }\n\n /** The open overlay panels with their elements, most recent last. */\n const openOverlays = (): Array<[WorkbenchOverlayPanel, HTMLElement]> =>\n openOrder.flatMap((panel): Array<[WorkbenchOverlayPanel, HTMLElement]> => {\n const element = panelElement(panel);\n return !panel.collapsed.peek() && element && overlaid(element)\n ? [[panel, element]]\n : [];\n });\n\n const onKeydown = (event: KeyboardEvent): void => {\n if (\n (event.key !== 'Escape' && event.key !== 'Tab') ||\n event.defaultPrevented\n )\n return;\n const open = openOverlays();\n if (open.length === 0) return;\n const active = ownerDocument.activeElement;\n const [panel, element] =\n open.find(([, candidate]) => candidate.contains(active)) ??\n open[open.length - 1]!;\n if (event.key === 'Escape') {\n event.preventDefault();\n // The collapse effect returns focus stranded inside it.\n panel.collapsed.value = true;\n return;\n }\n // Tab stays inside the open overlay: it wraps at either end, and focus\n // that is somewhere else (the app moved it, or the panel had no control\n // to take it when it opened) comes back in.\n const items = focusables(element);\n if (items.length === 0) return;\n const first = items[0]!;\n const last = items[items.length - 1]!;\n const inside = element.contains(active);\n if (event.shiftKey && (!inside || active === first)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && (!inside || active === last)) {\n event.preventDefault();\n first.focus();\n }\n };\n\n // An outside press closes an open overlay when it both starts and ends\n // outside it. Deciding at the click lets an app toggle that closes the panel\n // run first, and a press that opens a panel never closes it.\n let pressed: WorkbenchOverlayPanel[] = [];\n const onPointerdown = (event: PointerEvent): void => {\n const path = event.composedPath();\n pressed = openOverlays()\n .filter(([, element]) => !path.includes(element))\n .map(([panel]) => panel);\n // Before the press's default action moves focus: the open panel it\n // started in, when focus was inside that panel too.\n const active = ownerDocument.activeElement;\n pressedFocus = panels.find((panel) => {\n if (panel.collapsed.peek()) return false;\n const element = panelElement(panel);\n return !!element && path.includes(element) && element.contains(active);\n });\n };\n // Focus landing anywhere is a deliberate move the rescue must not undo.\n const onFocusin = (): void => {\n pressedFocus = undefined;\n };\n const onClick = (event: MouseEvent): void => {\n const candidates = pressed;\n pressed = [];\n const path = event.composedPath();\n for (const [panel, element] of openOverlays())\n if (candidates.includes(panel) && !path.includes(element))\n panel.collapsed.value = true;\n };\n ownerDocument.addEventListener('keydown', onKeydown);\n ownerDocument.addEventListener('pointerdown', onPointerdown, true);\n ownerDocument.addEventListener('click', onClick);\n ownerDocument.addEventListener('focusin', onFocusin, true);\n disposers.push(() => {\n ownerDocument.removeEventListener('keydown', onKeydown);\n ownerDocument.removeEventListener('pointerdown', onPointerdown, true);\n ownerDocument.removeEventListener('click', onClick);\n ownerDocument.removeEventListener('focusin', onFocusin, true);\n });\n\n return () => {\n for (const dispose of disposers.splice(0)) dispose();\n // After every observer and effect is gone, so handing the inline state\n // back cannot re-enter the wiring.\n for (const [panel, remembered] of inlineState) {\n const element = panelElement(panel);\n if (element) adapt(panel, element, remembered);\n else panel.collapsed.value = remembered;\n }\n inlineState.clear();\n };\n}\n","import { effect, type ReadonlySignal, type Signal } from 'kerfjs';\n\nimport type { DeviceClass } from './device-class.js';\nimport { type ResizeLimit, wireResizeHandles } from './resize-wiring.js';\nimport {\n wireWorkbenchOverlays,\n type WorkbenchOverlayPanel,\n} from './workbench-overlays.js';\nimport {\n type WorkbenchPanelKey,\n workbenchRegionId,\n} from './workbench-resize.js';\n\nexport type { WorkbenchPanelKey };\n\n/** Minimal `localStorage`-shaped store, so the persistence hook is testable. */\nexport interface WorkbenchStorage {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n}\n\n/** One Workbench panel's app-owned state. */\nexport interface WireWorkbenchPanel {\n /**\n * The app-owned size signal a `resizable` panel renders as its `size`.\n * `wireWorkbench` writes each committed resize here; collapsing never\n * touches it, so an expanded panel returns at the size it had. Omit it for\n * a panel that is not resizable.\n */\n size?: Signal<number>;\n /**\n * When set with `size`, the size is loaded from and saved to `storage`\n * under this key, so the panel remembers the user's size.\n */\n storageKey?: string;\n /**\n * The app-owned signal the panel renders as its `collapsed`. With it (and\n * `dismissOverlays`, on by default) `wireWorkbench` treats the panel as a\n * transient overlay while it presents as one: it collapses when its\n * `responsiveOverlayAt` breakpoint begins to apply and gets its inline state\n * back when the breakpoint stops applying, an open overlay takes focus and\n * keeps Tab inside it, and it closes on Escape or a press outside it.\n */\n collapsed?: Signal<boolean>;\n}\n\n/** A resize the user made, after `wireWorkbench` wrote it to the size signal. */\nexport interface WorkbenchResize {\n panel: WorkbenchPanelKey;\n size: number;\n source: 'keyboard' | 'pointer';\n}\n\nexport interface WireWorkbenchOptions {\n /** The `id` the `Workbench` was rendered with. */\n id: string;\n /**\n * The wired panels, keyed like the `Workbench` props. Render a panel given\n * a `size` with `resizable` and `size={panel.size.value}`, and one given a\n * `collapsed` signal with `collapsed={panel.collapsed.value}`.\n */\n panels: Partial<Record<WorkbenchPanelKey, WireWorkbenchPanel>>;\n /**\n * When provided, resizing is suspended while `deviceClass.compact` is true —\n * the classes where rails become overlay drawers or are replaced.\n */\n deviceClass?: ReadonlySignal<DeviceClass>;\n /** Persistence store (default `globalThis.localStorage`, if present). */\n storage?: WorkbenchStorage;\n /** Keyboard step in px (default 16). */\n step?: number;\n /** Shift+arrow step in px (default 64). */\n largeStep?: number;\n /** Called after each committed resize. */\n onResize?: (change: WorkbenchResize) => void;\n /**\n * Treat the panels given a `collapsed` signal as transient overlays while\n * they present as overlays (default `true`), like `wireSidebar`'s compact\n * overlay: a panel whose `responsiveOverlayAt` breakpoint begins to apply\n * starts collapsed, with no collapse motion, and gets its inline collapsed\n * state back when the breakpoint stops applying (and on disposal); an open\n * overlay panel, responsive or `presentation: \"overlay\"`, closes on Escape\n * or a press that starts and ends outside it. A panel that opens as an\n * overlay takes focus on its first focusable control, and while it is open\n * Tab and Shift+Tab cycle through its controls instead of reaching the\n * work area it covers (the ARIA dialog pattern of `wireSidebar`'s compact\n * overlay); inline panels never move focus. Focus stranded in a closing\n * panel — however it closed, the app's own control inside it included —\n * returns to the control that had it when the panel opened, else to the\n * panel's restore control, else to a control outside the panel whose\n * `aria-controls` names it (each panel's `id` is its region id, e.g.\n * `studio-left-rail`) — the fallback for a panel already open at wire-up.\n * An opener inside a panel that has closed since is skipped. `false` leaves\n * every `collapsed` write and all focus handling to the app.\n */\n dismissOverlays?: boolean;\n /**\n * Keep overlays exclusive (default `true`), like `wireSidebar`'s\n * `exclusiveCompact`: when a panel opens while it presents as an overlay,\n * every other open overlay panel — rails and the bottom drawer alike —\n * closes, so one overlay never covers another's controls. Panels presenting\n * inline are never closed by it. Applies only with `dismissOverlays`.\n */\n exclusiveOverlays?: boolean;\n}\n\nfunction defaultStorage(): WorkbenchStorage | undefined {\n try {\n return globalThis.localStorage ?? undefined;\n } catch {\n return undefined;\n }\n}\n\n/** A stored size, or undefined when the stored text is not a usable size. */\nfunction storedSize(text: string | null) {\n if (text === null) return undefined;\n const size = Number(text);\n return Number.isFinite(size) && size > 0 ? Math.round(size) : undefined;\n}\n\n/** A double-quoted CSS attribute-selector value. */\nconst quoted = (value: string) =>\n `\"${value.replaceAll('\\\\', '\\\\\\\\').replaceAll('\"', '\\\\\"')}\"`;\n\nconst px = (value: string) => Number.parseFloat(value) || 0;\n\n/**\n * The largest size a resizable panel may take while the work area keeps its\n * minimum: for a rail, its minimum width (the Workbench's `mainMinSize`,\n * rendered as `data-main-min-size`) — the Workbench width, less that minimum,\n * the other in-flow rails as shown, and the rail's own safe-area extent and\n * border; for the bottom drawer, its minimum height (`mainMinHeight`, rendered\n * as `data-main-min-height`) — the work-area column's height, less that\n * minimum and the drawer's own safe-area extent and border. A panel the\n * container has already squeezed is held at the size it shows, so it can\n * shrink but not grow. Without layout (no box yet) or a minimum, the panel's\n * own maximum stands.\n */\nconst mainRoomLimit: ResizeLimit = (region, { max }) => {\n const horizontal = region.dataset.axis === 'horizontal';\n // A rail's parent is the Workbench; the drawer's is the work-area column.\n const container = region.parentElement;\n const workbench = horizontal ? container : container?.parentElement;\n const mainMin = Number(\n horizontal\n ? workbench?.dataset.mainMinSize\n : workbench?.dataset.mainMinHeight,\n );\n if (!container || !(mainMin > 0)) return max;\n const box = container.getBoundingClientRect();\n const room = horizontal ? box.width : box.height;\n if (room <= 0) return max;\n let others = 0;\n if (horizontal)\n for (const rail of container.children) {\n if (\n rail === region ||\n !rail.matches('.kui-workbench__rail') ||\n globalThis.getComputedStyle(rail).position === 'absolute'\n )\n continue;\n others += rail.getBoundingClientRect().width;\n }\n const style = globalThis.getComputedStyle(region);\n const size = px(region.style.getPropertyValue('--kui-resizable-region-size'));\n const border =\n style.boxSizing === 'border-box'\n ? 0\n : horizontal\n ? px(style.borderInlineStartWidth) + px(style.borderInlineEndWidth)\n : px(style.borderBlockStartWidth) + px(style.borderBlockEndWidth);\n // The track is the size plus the panel's safe-area extent (its flex basis).\n const extent = px(style.flexBasis) - size + border;\n return Math.floor(room - Math.min(mainMin, room) - others - extent);\n};\n\n/**\n * Wire a `Workbench`'s panels. For `resizable` panels given a `size` signal:\n * pointer drags and arrow / Shift+arrow / Home / End on each panel's\n * separator, clamped to the panel's limits and to the room that leaves the\n * work area its minimum width and height, committed to the app-owned size signals.\n * Optional persistence loads and saves each size; optional `deviceClass`\n * suspends resizing on compact classes. Collapse stays the app's `collapsed`\n * flag and never changes a size. For panels given a `collapsed` signal,\n * overlays are transient (`dismissOverlays`): a responsive overlay starts\n * collapsed, an open overlay takes focus and keeps Tab inside it, it closes\n * on Escape or an outside press, and\n * opening one overlay closes the others (`exclusiveOverlays`). Returns a disposer. See `docs/23-app-layouts.md` §3.3.\n */\nexport function wireWorkbench(\n root: HTMLElement,\n {\n id,\n panels,\n deviceClass,\n storage = defaultStorage(),\n step,\n largeStep,\n onResize,\n dismissOverlays = true,\n exclusiveOverlays = true,\n }: WireWorkbenchOptions,\n): () => void {\n const keys = Object.keys(panels) as WorkbenchPanelKey[];\n const entries = keys.flatMap((key) => {\n const size = panels[key]?.size;\n return size\n ? [\n {\n key,\n size,\n storageKey: panels[key]!.storageKey,\n regionId: workbenchRegionId(id, key),\n },\n ]\n : [];\n });\n const byRegion = new Map(entries.map((entry) => [entry.regionId, entry]));\n const disposers: Array<() => void> = [];\n\n // Seed from storage before any effect runs, so the first render after\n // wire-up already has the remembered size; then mirror every size change.\n for (const { size, storageKey } of entries) {\n if (!storageKey || !storage) continue;\n const seed = storedSize(storage.getItem(storageKey));\n if (seed !== undefined) size.value = seed;\n disposers.push(\n effect(() => {\n storage.setItem(storageKey, String(size.value));\n }),\n );\n }\n\n // Each panel is matched by its own region id, so this wiring never drives a\n // ResizableRegion or another Workbench below the same root.\n const selector = entries\n .map(\n ({ regionId }) =>\n `[data-resizable=\"true\"][data-region-id=${quoted(regionId)}]`,\n )\n .join(', ');\n const start = () =>\n wireResizeHandles(\n root,\n {\n step,\n largeStep,\n onCommit: ({ id: regionId, size, source }) => {\n // The selector only matches configured panels.\n const entry = byRegion.get(regionId)!;\n entry.size.value = size;\n onResize?.({ panel: entry.key, size, source });\n },\n },\n selector,\n mainRoomLimit,\n );\n\n let stopResize: (() => void) | undefined;\n if (selector) {\n if (deviceClass) {\n disposers.push(\n effect(() => {\n const compact = deviceClass.value.compact;\n stopResize?.();\n stopResize = compact ? undefined : start();\n }),\n );\n } else {\n stopResize = start();\n }\n }\n\n const overlayPanels = keys.flatMap((key): WorkbenchOverlayPanel[] => {\n const collapsed = panels[key]?.collapsed;\n return collapsed ? [{ key, collapsed }] : [];\n });\n if (dismissOverlays && overlayPanels.length > 0) {\n const selector = `[data-component=\"workbench\"][id=${quoted(id)}]`;\n disposers.push(\n wireWorkbenchOverlays(\n root,\n () =>\n root.matches(selector)\n ? root\n : root.querySelector<HTMLElement>(selector),\n overlayPanels,\n exclusiveOverlays,\n ),\n );\n }\n\n return () => {\n stopResize?.();\n stopResize = undefined;\n for (const dispose of disposers.splice(0)) dispose();\n };\n}\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"wire-workbench.js"}
@@ -1,13 +1,68 @@
1
1
  import { SafeHtml } from 'kerfjs';
2
2
  import { ResizableRegionSeparator, ResizableRegionCollapseMotion, ResizableRegionContentOverflow, ResizableRegionPresentation, ResizableRegionRestorePosition } from './resizable-region.js';
3
3
  import { K as KerfUiContent } from './semantic-content-BbzjvSu9.js';
4
+ import { a as PanelToolbar, b as PanelToggle } from './panel-toolbar-BFQxFITu.js';
5
+ import { ToolbarProps } from './toolbar.js';
6
+ import './lucide-icon.js';
7
+ import 'lucide';
8
+ import './divider-sides-BzB6rphT.js';
9
+ import './pane.js';
10
+
11
+ /** The standard toggle a Workbench renders for a panel (see {@link PanelToggle}). */
12
+ type WorkbenchPanelToggle = PanelToggle;
13
+ /**
14
+ * A Workbench panel's top toolbar, composed by the Workbench so its groups can
15
+ * follow the panel's open state (see {@link PanelToolbar} for the roles).
16
+ * A collapsed rail's `constant` groups and toggle go to the leading edge of
17
+ * `mainToolbar` (left rail) or its trailing edge (right rail); a collapsed
18
+ * drawer's go to the trailing edge of `mainBottomToolbar`, else to a
19
+ * `FloatingToolbar` in the work area's bottom-end corner.
20
+ */
21
+ type WorkbenchPanelToolbar = PanelToolbar;
22
+ /** The work area's top toolbar; collapsed rails add their groups to it. */
23
+ interface WorkbenchMainToolbar {
24
+ label: string;
25
+ /** The work area's title, usually an extra-large `ToolbarText`. */
26
+ title?: KerfUiContent;
27
+ /** Groups after the title. */
28
+ leading?: KerfUiContent;
29
+ center?: KerfUiContent;
30
+ /** Groups at the trailing edge, before a collapsed right rail's groups. */
31
+ trailing?: KerfUiContent;
32
+ /** The toolbar's narrow-width policy (see `Toolbar.responsive`). */
33
+ responsive?: ToolbarProps['responsive'];
34
+ responsiveAt?: ToolbarProps['responsiveAt'];
35
+ }
36
+ /** The work area's bottom toolbar; a collapsed drawer adds its groups to it. */
37
+ interface WorkbenchMainBottomToolbar {
38
+ label: string;
39
+ leading?: KerfUiContent;
40
+ trailing?: KerfUiContent;
41
+ }
42
+ /**
43
+ * The work area: the app's `main` under `mainToolbar` (and above
44
+ * `mainBottomToolbar`), with each collapsed panel's groups added to the
45
+ * toolbar on its side. Without either toolbar, `main` renders as given.
46
+ */
47
+ /**
48
+ * Whether the work area's header or footer chrome stays pinned (`fixed`) or
49
+ * scrolls away with the content (`scroll`).
50
+ */
51
+ type WorkbenchChromePlacement = 'fixed' | 'scroll';
4
52
 
5
53
  /**
6
54
  * The Workbench container breakpoint below which a panel presents as an
7
55
  * overlay: `narrow` (704px or less) or `compact` (448px or less) — the same
8
- * breakpoints as `ResizableRegion`'s `responsiveFillAt`.
56
+ * breakpoints as `ResizableRegion`'s `responsiveFillAt` — or `never` to keep
57
+ * it inline at every width.
9
58
  */
10
- type WorkbenchResponsiveOverlayAt = 'compact' | 'narrow';
59
+ type WorkbenchResponsiveOverlayAt = 'compact' | 'narrow' | 'never';
60
+ /**
61
+ * How wide a rail's overlay is in a compact (448px or less) Workbench: `inset`
62
+ * fills the Workbench less a dismiss margin on the side away from the rail's
63
+ * edge, so a press beside it closes it; `full` fills the Workbench.
64
+ */
65
+ type WorkbenchCompactOverlay = 'inset' | 'full';
11
66
  /** Drag-resize limits for a resizable Workbench panel, in px. */
12
67
  interface WorkbenchPanelResizable {
13
68
  /** Smallest size (default 180 for a rail, 120 for the drawer). */
@@ -18,6 +73,14 @@ interface WorkbenchPanelResizable {
18
73
  /** A collapsible Workbench panel — a side rail or the bottom drawer. */
19
74
  interface WorkbenchPanel {
20
75
  content: KerfUiContent;
76
+ /**
77
+ * The panel's top toolbar, composed by the Workbench: its `constant` groups
78
+ * and standard `toggle` move to the work area's toolbar while the panel is
79
+ * collapsed. With it, `content` renders in a `Pane` below the toolbar.
80
+ */
81
+ toolbar?: WorkbenchPanelToolbar;
82
+ /** Optional bottom toolbar under a `toolbar` panel's content. */
83
+ footer?: KerfUiContent;
21
84
  /** Whether the panel is currently collapsed (the app owns this). */
22
85
  collapsed?: boolean;
23
86
  /**
@@ -43,13 +106,22 @@ interface WorkbenchPanel {
43
106
  * Present the panel as an overlay, without a separator, below a Workbench
44
107
  * container breakpoint, and inline above it — the CSS decides, so the app
45
108
  * needs no device-class check. A rail overlays from its side at full
46
- * height; the bottom drawer overlays the bottom of the work-area column.
109
+ * height, over the work area and an open drawer; the bottom drawer
110
+ * overlays the bottom of the work-area column. Rails default to `narrow`
111
+ * (pass `never` to keep one inline); the drawer defaults to inline.
47
112
  */
48
113
  responsiveOverlayAt?: WorkbenchResponsiveOverlayAt;
114
+ /**
115
+ * A rail's overlay width in a compact Workbench (default `inset`: the
116
+ * Workbench less `--kui-workbench-overlay-dismiss-margin`, 44px). Ignored
117
+ * by the drawer.
118
+ */
119
+ compactOverlay?: WorkbenchCompactOverlay;
49
120
  /**
50
121
  * Control shown while collapsed, in a safe-area-aware corner of the
51
122
  * Workbench (not the viewport); the bottom drawer's sits in the work-area
52
- * column.
123
+ * column. Prefer `toolbar.toggle`, which the Workbench relocates into the
124
+ * work area's toolbar (or this corner when that toolbar is absent).
53
125
  */
54
126
  restoreControl?: SafeHtml;
55
127
  restorePosition?: ResizableRegionRestorePosition;
@@ -64,6 +136,35 @@ interface WorkbenchProps {
64
136
  label: string;
65
137
  /** The central work area. */
66
138
  main: KerfUiContent;
139
+ /**
140
+ * The work area's top toolbar. A collapsed left rail's `constant` groups
141
+ * and toggle lead it; a collapsed right rail's trail it. With it, `main`
142
+ * renders in a `Pane` below the toolbar.
143
+ */
144
+ mainToolbar?: WorkbenchMainToolbar;
145
+ /**
146
+ * Fixed content under `mainToolbar` — supporting copy such as a
147
+ * description — divided from the scrolling `main` below it.
148
+ */
149
+ mainHeader?: KerfUiContent;
150
+ /**
151
+ * Fixed content over `mainBottomToolbar` — a status line or a resource
152
+ * toolbar — divided from the scrolling `main` above it.
153
+ */
154
+ mainFooter?: KerfUiContent;
155
+ /**
156
+ * The work area's bottom toolbar. A collapsed drawer's `constant` groups and
157
+ * toggle trail it; without it they float in the work area's corner.
158
+ */
159
+ mainBottomToolbar?: WorkbenchMainBottomToolbar;
160
+ /**
161
+ * Whether `mainToolbar` and `mainHeader` stay pinned (`fixed`, default) or
162
+ * scroll away with `main` (`scroll`) — useful where large text would leave
163
+ * pinned chrome little room.
164
+ */
165
+ mainHeaderPlacement?: WorkbenchChromePlacement;
166
+ /** The same for `mainFooter` and `mainBottomToolbar` (default `fixed`). */
167
+ mainFooterPlacement?: WorkbenchChromePlacement;
67
168
  leftRail?: WorkbenchPanel;
68
169
  rightRail?: WorkbenchPanel;
69
170
  bottomDrawer?: WorkbenchPanel;
@@ -100,6 +201,6 @@ interface WorkbenchProps {
100
201
  * lives outside it and stays reachable). A panel may opt in to drag and keyboard resizing with
101
202
  * `resizable`, which `wireWorkbench` drives. See `docs/23-app-layouts.md` §3.3.
102
203
  */
103
- declare function Workbench({ id, label, main, leftRail, rightRail, bottomDrawer, mainMinSize, mainMinHeight, className, slot, }: WorkbenchProps): SafeHtml;
204
+ declare function Workbench({ id, label, main, leftRail, rightRail, bottomDrawer, mainToolbar, mainHeader, mainFooter, mainBottomToolbar, mainHeaderPlacement, mainFooterPlacement, mainMinSize, mainMinHeight, className, slot, }: WorkbenchProps): SafeHtml;
104
205
 
105
- export { Workbench, type WorkbenchPanel, type WorkbenchPanelResizable, type WorkbenchProps, type WorkbenchResponsiveOverlayAt };
206
+ export { Workbench, type WorkbenchChromePlacement, type WorkbenchCompactOverlay, type WorkbenchMainBottomToolbar, type WorkbenchMainToolbar, type WorkbenchPanel, type WorkbenchPanelResizable, type WorkbenchPanelToggle, type WorkbenchPanelToolbar, type WorkbenchProps, type WorkbenchResponsiveOverlayAt };
package/dist/workbench.js CHANGED
@@ -1,212 +1,15 @@
1
- import { WORKBENCH_MAIN_MIN_SIZE, WORKBENCH_MAIN_MIN_HEIGHT, workbenchRegionId, WORKBENCH_RESIZE_DEFAULTS } from './chunk-PSHUSWQH.js';
2
- import { clampRegionSize, ResizeGrip } from './chunk-VHADGP3B.js';
3
- import { jsxs, jsx } from 'kerfjs/jsx-runtime';
1
+ export { Workbench } from './chunk-EAX2GSS4.js';
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
4
12
 
5
- var EDGES = {
6
- leftRail: "end",
7
- rightRail: "start",
8
- bottomDrawer: "start"
9
- };
10
- var DEFAULT_LABELS = {
11
- leftRail: "left rail",
12
- rightRail: "right rail",
13
- bottomDrawer: "bottom drawer"
14
- };
15
- function resolveResize(id, key, panel) {
16
- if (!panel.resizable) return void 0;
17
- const defaults = WORKBENCH_RESIZE_DEFAULTS[key];
18
- const limits = panel.resizable === true ? {} : panel.resizable;
19
- const min = limits.min ?? defaults.min;
20
- const max = Math.max(min, limits.max ?? defaults.max);
21
- return {
22
- regionId: workbenchRegionId(id, key),
23
- axis: key === "bottomDrawer" ? "vertical" : "horizontal",
24
- edge: EDGES[key],
25
- size: clampRegionSize(panel.size ?? defaults.size, min, max),
26
- min,
27
- max
28
- };
29
- }
30
- var resizeAttributes = (resize) => resize ? {
31
- "data-resizable": "true",
32
- "data-region-id": resize.regionId,
33
- "data-axis": resize.axis,
34
- "data-edge": resize.edge
35
- } : {};
36
- function panelStyle(panel, resize, sizeProperty) {
37
- if (resize) return `--kui-resizable-region-size:${resize.size}px`;
38
- return panel.size ? `${sizeProperty}: ${panel.size}px` : void 0;
39
- }
40
- function PanelHandle({
41
- panel,
42
- resize,
43
- label
44
- }) {
45
- const inert = Boolean(panel.collapsed) || (panel.presentation ?? "inline") !== "inline";
46
- return /* @__PURE__ */ jsx(
47
- "div",
48
- {
49
- class: "kui-workbench__handle",
50
- role: "separator",
51
- tabindex: inert ? "-1" : "0",
52
- "aria-label": `Resize ${label}`,
53
- "aria-orientation": resize.axis === "horizontal" ? "vertical" : "horizontal",
54
- "aria-valuemin": resize.min,
55
- "aria-valuemax": resize.max,
56
- "aria-valuenow": resize.size,
57
- "aria-hidden": inert ? "true" : void 0,
58
- "data-kui-resize-handle": true,
59
- "data-region-id": resize.regionId,
60
- children: /* @__PURE__ */ jsx("span", { class: "kui-workbench__handle-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ResizeGrip, { axis: resize.axis }) })
61
- }
62
- );
63
- }
64
- function hiddenFromAccessibility(panel) {
65
- return panel.collapsed || panel.presentation === "hidden" ? "true" : void 0;
66
- }
67
- function Rail({
68
- id,
69
- side,
70
- panel
71
- }) {
72
- const key = side === "left" ? "leftRail" : "rightRail";
73
- const resize = resolveResize(id, key, panel);
74
- return /* @__PURE__ */ jsxs(
75
- "aside",
76
- {
77
- id: workbenchRegionId(id, key),
78
- class: `kui-workbench__rail kui-workbench__rail--${side}`,
79
- "data-workbench-rail": side,
80
- "data-collapsed": String(panel.collapsed ?? false),
81
- "data-separator": panel.separator ?? "auto",
82
- "data-collapse-motion": panel.collapseMotion ?? "slide",
83
- "data-content-overflow": panel.contentOverflow ?? "clip",
84
- "data-presentation": panel.presentation ?? "inline",
85
- "data-responsive-overlay-at": panel.responsiveOverlayAt,
86
- ...resizeAttributes(resize),
87
- "aria-label": panel.label || void 0,
88
- "aria-hidden": hiddenFromAccessibility(panel),
89
- inert: Boolean(panel.collapsed),
90
- style: panelStyle(panel, resize, "--kui-workbench-rail-width"),
91
- children: [
92
- /* @__PURE__ */ jsx(
93
- "div",
94
- {
95
- class: "kui-workbench__panel-content",
96
- inert: Boolean(panel.collapsed),
97
- children: panel.content
98
- }
99
- ),
100
- resize && /* @__PURE__ */ jsx(
101
- PanelHandle,
102
- {
103
- panel,
104
- resize,
105
- label: panel.label || DEFAULT_LABELS[key]
106
- }
107
- )
108
- ]
109
- }
110
- );
111
- }
112
- function Drawer({ id, panel }) {
113
- const resize = resolveResize(id, "bottomDrawer", panel);
114
- return /* @__PURE__ */ jsxs(
115
- "section",
116
- {
117
- id: workbenchRegionId(id, "bottomDrawer"),
118
- class: "kui-workbench__drawer",
119
- "data-workbench-drawer": true,
120
- "data-collapsed": String(panel.collapsed ?? false),
121
- "data-separator": panel.separator ?? "auto",
122
- "data-collapse-motion": panel.collapseMotion ?? "slide",
123
- "data-content-overflow": panel.contentOverflow ?? "clip",
124
- "data-presentation": panel.presentation ?? "inline",
125
- "data-responsive-overlay-at": panel.responsiveOverlayAt,
126
- ...resizeAttributes(resize),
127
- "aria-label": panel.label || void 0,
128
- "aria-hidden": hiddenFromAccessibility(panel),
129
- inert: Boolean(panel.collapsed),
130
- style: panelStyle(panel, resize, "--kui-workbench-drawer-height"),
131
- children: [
132
- /* @__PURE__ */ jsx(
133
- "div",
134
- {
135
- class: "kui-workbench__panel-content",
136
- inert: Boolean(panel.collapsed),
137
- children: panel.content
138
- }
139
- ),
140
- resize && /* @__PURE__ */ jsx(
141
- PanelHandle,
142
- {
143
- panel,
144
- resize,
145
- label: panel.label || DEFAULT_LABELS.bottomDrawer
146
- }
147
- )
148
- ]
149
- }
150
- );
151
- }
152
- function restore(panel, side, position) {
153
- if (!panel?.collapsed || !panel.restoreControl || panel.presentation === "hidden")
154
- return "";
155
- return /* @__PURE__ */ jsx(
156
- "div",
157
- {
158
- class: "kui-workbench__restore",
159
- "data-panel": side,
160
- "data-position": panel.restorePosition ?? position,
161
- children: panel.restoreControl
162
- }
163
- );
164
- }
165
- function Workbench({
166
- id,
167
- label,
168
- main,
169
- leftRail,
170
- rightRail,
171
- bottomDrawer,
172
- mainMinSize = WORKBENCH_MAIN_MIN_SIZE,
173
- mainMinHeight = WORKBENCH_MAIN_MIN_HEIGHT,
174
- className = "",
175
- slot
176
- }) {
177
- const px = (value) => Math.max(0, Math.round(value));
178
- const mainMin = leftRail || rightRail ? px(mainMinSize) : void 0;
179
- const mainMinBlock = bottomDrawer ? px(mainMinHeight) : void 0;
180
- const style = [
181
- mainMin === void 0 ? "" : `--_kui-workbench-main-min-width:${mainMin}px`,
182
- mainMinBlock === void 0 ? "" : `--_kui-workbench-main-min-height:${mainMinBlock}px`
183
- ].filter(Boolean).join(";");
184
- return /* @__PURE__ */ jsxs(
185
- "section",
186
- {
187
- class: `kui-workbench ${className}`.trim(),
188
- id,
189
- "data-component": "workbench",
190
- "data-main-min-size": mainMin === void 0 ? void 0 : String(mainMin),
191
- "data-main-min-height": mainMinBlock === void 0 ? void 0 : String(mainMinBlock),
192
- style: style || void 0,
193
- "aria-label": label,
194
- slot,
195
- children: [
196
- leftRail && /* @__PURE__ */ jsx(Rail, { id, side: "left", panel: leftRail }),
197
- restore(leftRail, "left", "bottom-start"),
198
- /* @__PURE__ */ jsxs("div", { class: "kui-workbench__center", children: [
199
- /* @__PURE__ */ jsx("div", { class: "kui-workbench__main", "data-workbench-main": true, children: main }),
200
- bottomDrawer && /* @__PURE__ */ jsx(Drawer, { id, panel: bottomDrawer }),
201
- restore(bottomDrawer, "bottom", "bottom-end")
202
- ] }),
203
- rightRail && /* @__PURE__ */ jsx(Rail, { id, side: "right", panel: rightRail }),
204
- restore(rightRail, "right", "bottom-end")
205
- ]
206
- }
207
- );
208
- }
209
13
 
210
- export { Workbench };
211
14
 
212
15
  //# sourceMappingURL=workbench.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/workbench.tsx"],"names":[],"mappings":";;;;AA6HA,IAAM,KAAA,GAAwD;AAAA,EAC5D,QAAA,EAAU,KAAA;AAAA,EACV,SAAA,EAAW,OAAA;AAAA,EACX,YAAA,EAAc;AAChB,CAAA;AAEA,IAAM,cAAA,GAAoD;AAAA,EACxD,QAAA,EAAU,WAAA;AAAA,EACV,SAAA,EAAW,YAAA;AAAA,EACX,YAAA,EAAc;AAChB,CAAA;AAEA,SAAS,aAAA,CACP,EAAA,EACA,GAAA,EACA,KAAA,EAC4B;AAC5B,EAAA,IAAI,CAAC,KAAA,CAAM,SAAA,EAAW,OAAO,MAAA;AAC7B,EAAA,MAAM,QAAA,GAA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s';\n\nimport {\n clampRegionSize,\n type ResizableRegionAxis,\n type ResizableRegionCollapseMotion,\n type ResizableRegionContentOverflow,\n type ResizableRegionEdge,\n type ResizableRegionPresentation,\n type ResizableRegionRestorePosition,\n type ResizableRegionSeparator,\n} from './resizable-region.js';\nimport { ResizeGrip } from './resize-grip.js';\nimport type { KerfUiContent } from './semantic-content.js';\nimport {\n WORKBENCH_MAIN_MIN_HEIGHT,\n WORKBENCH_MAIN_MIN_SIZE,\n WORKBENCH_RESIZE_DEFAULTS,\n type WorkbenchPanelKey,\n workbenchRegionId,\n} from './workbench-resize.js';\n\n/**\n * The Workbench container breakpoint below which a panel presents as an\n * overlay: `narrow` (704px or less) or `compact` (448px or less) — the same\n * breakpoints as `ResizableRegion`'s `responsiveFillAt`.\n */\nexport type WorkbenchResponsiveOverlayAt = 'compact' | 'narrow';\n\n/** Drag-resize limits for a resizable Workbench panel, in px. */\nexport interface WorkbenchPanelResizable {\n /** Smallest size (default 180 for a rail, 120 for the drawer). */\n min?: number;\n /** Largest size (default 480). */\n max?: number;\n}\n\n/** A collapsible Workbench panel — a side rail or the bottom drawer. */\nexport interface WorkbenchPanel {\n content: KerfUiContent;\n /** Whether the panel is currently collapsed (the app owns this). */\n collapsed?: boolean;\n /**\n * Rail width, or drawer height, in px. Overrides the CSS default. For a\n * resizable panel it is the current size (default 280 for a rail, 220 for\n * the drawer), clamped to the limits; the app owns it and `wireWorkbench`\n * reports each resize.\n */\n size?: number;\n /**\n * Opt in to drag and keyboard resizing on the panel's inner separator:\n * `true` for the default limits, or `{ min, max }`. Off by default. Pair it\n * with `wireWorkbench` from `@kerfjs/ui/wire-workbench`.\n */\n resizable?: boolean | WorkbenchPanelResizable;\n /** Accessible name for the panel region. */\n label?: string;\n separator?: ResizableRegionSeparator;\n collapseMotion?: ResizableRegionCollapseMotion;\n contentOverflow?: ResizableRegionContentOverflow;\n presentation?: ResizableRegionPresentation;\n /**\n * Present the panel as an overlay, without a separator, below a Workbench\n * container breakpoint, and inline above it — the CSS decides, so the app\n * needs no device-class check. A rail overlays from its side at full\n * height; the bottom drawer overlays the bottom of the work-area column.\n */\n responsiveOverlayAt?: WorkbenchResponsiveOverlayAt;\n /**\n * Control shown while collapsed, in a safe-area-aware corner of the\n * Workbench (not the viewport); the bottom drawer's sits in the work-area\n * column.\n */\n restoreControl?: SafeHtml;\n restorePosition?: ResizableRegionRestorePosition;\n}\n\nexport interface WorkbenchProps {\n /**\n * The Workbench's `id`. Each panel's `id` derives from it —\n * `<id>-left-rail`, `<id>-right-rail`, `<id>-bottom-drawer` — so a toggle\n * can name the panel it shows and hides with `aria-controls`.\n */\n id: string;\n label: string;\n /** The central work area. */\n main: KerfUiContent;\n leftRail?: WorkbenchPanel;\n rightRail?: WorkbenchPanel;\n bottomDrawer?: WorkbenchPanel;\n /**\n * Minimum width, in px, the work area keeps beside the inline rails, fixed\n * or `resizable` (default 320; `0` turns it off). Resizing a rail stops\n * where the work area would drop below it, and inline rails shrink\n * proportionally when the Workbench gets narrower. Workbenches without a\n * rail ignore it.\n */\n mainMinSize?: number;\n /**\n * Minimum height, in px, the work area keeps above an inline bottom drawer,\n * fixed or `resizable` (default 120; `0` turns it off) — the drawer's\n * counterpart of `mainMinSize`. Resizing the drawer stops where the work\n * area would drop below it, and the drawer shrinks when the Workbench gets\n * shorter. Workbenches without a drawer ignore it.\n */\n mainMinHeight?: number;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\ninterface ResolvedResize {\n regionId: string;\n axis: ResizableRegionAxis;\n edge: ResizableRegionEdge;\n size: number;\n min: number;\n max: number;\n}\n\n/**\n * Each panel's separator is its inner edge. Growing the left rail moves that\n * edge toward the inline end; growing the right rail or the drawer moves it\n * toward the start — the same edge vocabulary `ResizableRegion` uses.\n */\nconst EDGES: Record<WorkbenchPanelKey, ResizableRegionEdge> = {\n leftRail: 'end',\n rightRail: 'start',\n bottomDrawer: 'start',\n};\n\nconst DEFAULT_LABELS: Record<WorkbenchPanelKey, string> = {\n leftRail: 'left rail',\n rightRail: 'right rail',\n bottomDrawer: 'bottom drawer',\n};\n\nfunction resolveResize(\n id: string,\n key: WorkbenchPanelKey,\n panel: WorkbenchPanel,\n): ResolvedResize | undefined {\n if (!panel.resizable) return undefined;\n const defaults = WORKBENCH_RESIZE_DEFAULTS[key];\n const limits = panel.resizable === true ? {} : panel.resizable;\n const min = limits.min ?? defaults.min;\n const max = Math.max(min, limits.max ?? defaults.max);\n return {\n regionId: workbenchRegionId(id, key),\n axis: key === 'bottomDrawer' ? 'vertical' : 'horizontal',\n edge: EDGES[key],\n size: clampRegionSize(panel.size ?? defaults.size, min, max),\n min,\n max,\n };\n}\n\n/** The attributes a resizable panel adds for the resize wiring to read. */\nconst resizeAttributes = (resize: ResolvedResize | undefined) =>\n resize\n ? {\n 'data-resizable': 'true',\n 'data-region-id': resize.regionId,\n 'data-axis': resize.axis,\n 'data-edge': resize.edge,\n }\n : {};\n\n/**\n * A resizable panel's size lives in the resize wiring's track property, so a\n * drag or key press resizes the panel before the app re-renders; the CSS maps\n * it onto the rail width or drawer height.\n */\nfunction panelStyle(\n panel: WorkbenchPanel,\n resize: ResolvedResize | undefined,\n sizeProperty: string,\n) {\n if (resize) return `--kui-resizable-region-size:${resize.size}px`;\n return panel.size ? `${sizeProperty}: ${panel.size}px` : undefined;\n}\n\n/**\n * The separator a resizable panel owns: the same focusable `role=\"separator\"`\n * contract a `ResizableRegion` handle carries, so one resize wiring drives\n * both. It leaves the tab order while the panel is collapsed or not inline.\n */\nfunction PanelHandle({\n panel,\n resize,\n label,\n}: {\n panel: WorkbenchPanel;\n resize: ResolvedResize;\n label: string;\n}) {\n const inert =\n Boolean(panel.collapsed) || (panel.presentation ?? 'inline') !== 'inline';\n return (\n <div\n class=\"kui-workbench__handle\"\n role=\"separator\"\n tabindex={inert ? '-1' : '0'}\n aria-label={`Resize ${label}`}\n aria-orientation={\n resize.axis === 'horizontal' ? 'vertical' : 'horizontal'\n }\n aria-valuemin={resize.min}\n aria-valuemax={resize.max}\n aria-valuenow={resize.size}\n aria-hidden={inert ? 'true' : undefined}\n data-kui-resize-handle\n data-region-id={resize.regionId}\n >\n <span class=\"kui-workbench__handle-icon\" aria-hidden=\"true\">\n <ResizeGrip axis={resize.axis} />\n </span>\n </div>\n );\n}\n\n/**\n * A collapsed panel leaves the accessibility tree as a whole, like a collapsed\n * `CollapsiblePanel`: its content and separator are already inert or hidden,\n * so the labeled landmark would otherwise stay behind, empty, for a screen\n * reader to land on. Its restore control renders outside it and stays\n * reachable.\n */\nfunction hiddenFromAccessibility(panel: WorkbenchPanel) {\n return panel.collapsed || panel.presentation === 'hidden'\n ? ('true' as const)\n : undefined;\n}\n\nfunction Rail({\n id,\n side,\n panel,\n}: {\n id: string;\n side: 'left' | 'right';\n panel: WorkbenchPanel;\n}) {\n const key: WorkbenchPanelKey = side === 'left' ? 'leftRail' : 'rightRail';\n const resize = resolveResize(id, key, panel);\n return (\n <aside\n id={workbenchRegionId(id, key)}\n class={`kui-workbench__rail kui-workbench__rail--${side}`}\n data-workbench-rail={side}\n data-collapsed={String(panel.collapsed ?? false)}\n data-separator={panel.separator ?? 'auto'}\n data-collapse-motion={panel.collapseMotion ?? 'slide'}\n data-content-overflow={panel.contentOverflow ?? 'clip'}\n data-presentation={panel.presentation ?? 'inline'}\n data-responsive-overlay-at={panel.responsiveOverlayAt}\n {...resizeAttributes(resize)}\n aria-label={panel.label || undefined}\n aria-hidden={hiddenFromAccessibility(panel)}\n inert={Boolean(panel.collapsed)}\n style={panelStyle(panel, resize, '--kui-workbench-rail-width')}\n >\n <div\n class=\"kui-workbench__panel-content\"\n inert={Boolean(panel.collapsed)}\n >\n {panel.content}\n </div>\n {resize && (\n <PanelHandle\n panel={panel}\n resize={resize}\n label={panel.label || DEFAULT_LABELS[key]}\n />\n )}\n </aside>\n );\n}\n\nfunction Drawer({ id, panel }: { id: string; panel: WorkbenchPanel }) {\n const resize = resolveResize(id, 'bottomDrawer', panel);\n return (\n <section\n id={workbenchRegionId(id, 'bottomDrawer')}\n class=\"kui-workbench__drawer\"\n data-workbench-drawer\n data-collapsed={String(panel.collapsed ?? false)}\n data-separator={panel.separator ?? 'auto'}\n data-collapse-motion={panel.collapseMotion ?? 'slide'}\n data-content-overflow={panel.contentOverflow ?? 'clip'}\n data-presentation={panel.presentation ?? 'inline'}\n data-responsive-overlay-at={panel.responsiveOverlayAt}\n {...resizeAttributes(resize)}\n aria-label={panel.label || undefined}\n aria-hidden={hiddenFromAccessibility(panel)}\n inert={Boolean(panel.collapsed)}\n style={panelStyle(panel, resize, '--kui-workbench-drawer-height')}\n >\n <div\n class=\"kui-workbench__panel-content\"\n inert={Boolean(panel.collapsed)}\n >\n {panel.content}\n </div>\n {resize && (\n <PanelHandle\n panel={panel}\n resize={resize}\n label={panel.label || DEFAULT_LABELS.bottomDrawer}\n />\n )}\n </section>\n );\n}\n\n/** A collapsed panel's restore control, outside the clipped panel. */\nfunction restore(\n panel: WorkbenchPanel | undefined,\n side: 'left' | 'right' | 'bottom',\n position: ResizableRegionRestorePosition,\n) {\n if (\n !panel?.collapsed ||\n !panel.restoreControl ||\n panel.presentation === 'hidden'\n )\n return '';\n return (\n <div\n class=\"kui-workbench__restore\"\n data-panel={side}\n data-position={panel.restorePosition ?? position}\n >\n {panel.restoreControl}\n </div>\n );\n}\n\n/**\n * The Xcode-like multi-panel workspace: a collapsible left rail, right rail, and\n * bottom drawer around a central work area (any absent). Collapsing snaps the\n * panel's track to zero in one reflow while its fixed-size content slides out via\n * a composited transform — the instant-width / sliding-content technique, so the\n * work area relayouts once, not per frame. Bottom-drawer content stays anchored\n * to the shell's stable bottom edge throughout that transition. The app owns\n * each `collapsed` flag; the collapse is pure CSS. A collapsed panel renders\n * `inert` and `aria-hidden`, so neither Tab nor assistive technology reaches\n * controls that have slid out of view or an empty landmark (its restore control\n * lives outside it and stays reachable). A panel may opt in to drag and keyboard resizing with\n * `resizable`, which `wireWorkbench` drives. See `docs/23-app-layouts.md` §3.3.\n */\nexport function Workbench({\n id,\n label,\n main,\n leftRail,\n rightRail,\n bottomDrawer,\n mainMinSize = WORKBENCH_MAIN_MIN_SIZE,\n mainMinHeight = WORKBENCH_MAIN_MIN_HEIGHT,\n className = '',\n slot,\n}: WorkbenchProps) {\n // Each work-area minimum applies only on an axis a panel shares with it:\n // the width beside a rail, the height above the drawer.\n const px = (value: number) => Math.max(0, Math.round(value));\n const mainMin = leftRail || rightRail ? px(mainMinSize) : undefined;\n const mainMinBlock = bottomDrawer ? px(mainMinHeight) : undefined;\n const style = [\n mainMin === undefined ? '' : `--_kui-workbench-main-min-width:${mainMin}px`,\n mainMinBlock === undefined\n ? ''\n : `--_kui-workbench-main-min-height:${mainMinBlock}px`,\n ]\n .filter(Boolean)\n .join(';');\n return (\n <section\n class={`kui-workbench ${className}`.trim()}\n id={id}\n data-component=\"workbench\"\n data-main-min-size={mainMin === undefined ? undefined : String(mainMin)}\n data-main-min-height={\n mainMinBlock === undefined ? undefined : String(mainMinBlock)\n }\n style={style || undefined}\n aria-label={label}\n slot={slot}\n >\n {leftRail && <Rail id={id} side=\"left\" panel={leftRail} />}\n {restore(leftRail, 'left', 'bottom-start')}\n <div class=\"kui-workbench__center\">\n <div class=\"kui-workbench__main\" data-workbench-main>\n {main}\n </div>\n {bottomDrawer && <Drawer id={id} panel={bottomDrawer} />}\n {restore(bottomDrawer, 'bottom', 'bottom-end')}\n </div>\n {rightRail && <Rail id={id} side=\"right\" panel={rightRail} />}\n {restore(rightRail, 'right', 'bottom-end')}\n </section>\n );\n}\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"workbench.js"}
@@ -35,7 +35,7 @@ Use `presentation="toolbar-borderless"` inside a `ToolbarControlGroup`, with
35
35
  parent paints the composed focus ring. `selectedPresentation="icon-only"` hides
36
36
  only the visible selected label—the required `label` or `ariaLabel` still names
37
37
  the combobox. An icon-only trigger keeps its disclosure caret: the selected icon
38
- and caret form one pill with the same geometry as a popup-menu `wa-dropdown`
38
+ and caret form one pill with the same geometry as a `PopupMenu`
39
39
  trigger (8px inline padding on both sides, 12px from the icon to the caret, a
40
40
  40px default or 32px compact control height), so the caret still signals a
41
41
  choice list. Inside a group the trigger is inset evenly on every side (2px in a
@@ -81,6 +81,17 @@ repeated and out-of-order completions, cancellation, instance isolation, and
81
81
  removal. `tests/browser/select-lifecycle.spec.ts` repeats animation/resize/reopen
82
82
  sequences at wide and narrow widths in Chromium, Firefox, and WebKit.
83
83
 
84
+ ## PopupMenu
85
+
86
+ `PopupMenu` renders a Web Awesome dropdown, so the menu roles, arrow-key and
87
+ typeahead navigation, Escape, and focus return to the trigger come from
88
+ `wa-dropdown`. Kerf's part is the trigger's name. A Web Awesome button takes its
89
+ name from its content and ignores an `aria-label` on the host, so an icon-only
90
+ trigger requires `label`, which renders as visually hidden text inside the
91
+ button; a trigger with visible `text` is named by that text. Group headings render as the dropdown's native menu labels, and
92
+ dividers are presentational. A disabled item stays in the menu but cannot be
93
+ chosen; disable the whole trigger only when every command is unavailable.
94
+
84
95
  ## ListActionRow
85
96
 
86
97
  `ListActionRow` renders a noninteractive visual root containing primary and
package/docs/catalog.md CHANGED
@@ -6,6 +6,15 @@ footer that the kerf UI catalog itself uses. Point it at your own components and
6
6
  you get the same shell without rebuilding it. Like the app layouts, it is a
7
7
  subpath-only, tree-shakeable module that adds nothing to the main barrel.
8
8
 
9
+ The shell is a [`Workbench`](workbench.md) built entirely from `@kerfjs/ui`
10
+ components: the sidebar is its left rail and the active entry its work area. So
11
+ the sidebar behaves like any Workbench rail — its standard toggle moves into the
12
+ entry toolbar while it is collapsed, and on a small screen (a Workbench narrower
13
+ than 704px) it overlays the stage, one tap from the entry toolbar, filling the
14
+ width less a 44px strip that closes it, instead of squeezing the stage. Pass the
15
+ app's `collapsed` signal to `wireCatalog` so that overlay closes on Escape, on a
16
+ press outside, and when an entry is chosen from it.
17
+
9
18
  ```bash
10
19
  npm install @kerfjs/ui # kerfjs is a peer; @kerfjs/ui/select/register is needed only if entries use `related`
11
20
  ```
@@ -36,9 +45,9 @@ expanded? }`. When `collapsible`, the label is a disclosure toggle controlling
36
45
  sidebar content), and `status` (a footer status line).
37
46
 
38
47
  Per-entry `resources` render as "open in new tab" links in the footer, and
39
- `related` renders a "Related entries" popup menu — a `single` `ToolbarControlGroup`
40
- around a `wa-dropdown` (grouped by each entry's `group`), so register its elements
41
- with `@kerfjs/ui/select/register` when you use it.
48
+ `related` renders a "Related entries" `PopupMenu` in a `single`
49
+ `ToolbarControlGroup` (grouped by each entry's `group`), so register its elements
50
+ with `@kerfjs/ui/popup-menu/register` when you use it.
42
51
 
43
52
  ## Catalog demo authoring contract
44
53
 
@@ -249,8 +258,8 @@ Set `revealSelection: true` on `wireCatalog` for a long desktop sidebar. After
249
258
  `onSelect` updates controlled state, the helper waits one animation frame, finds
250
259
  the exact matching `data-item-id`, and scrolls it into view without changing
251
260
  focus. A newer selection or disposal cancels the pending reveal. The default
252
- media guard is the Catalog desktop layout (`min-width: 52.01rem`), so compact
253
- layouts keep their existing scroll position.
261
+ media guard follows the Workbench's inline sidebar (`min-width: 44.01rem`), so a
262
+ closed phone overlay is never scrolled behind the user's back.
254
263
 
255
264
  Pass an options object instead of `true` to customize `block`, `inline`,
256
265
  `behavior`, or `media`; `media: false` deliberately enables the behavior at all
@@ -384,6 +393,12 @@ revealCatalogEntry(app, initial, { block: "center" });
384
393
  - **`active`** is domain state (which entry is shown) — the app's signal, updated in
385
394
  `onSelect`, read to compute `content`.
386
395
  - **`collapsed`** is transient UI — the app's signal, flipped in `onToggleSidebar`.
396
+ Pass the same signal as `wireCatalog`'s `collapsed` option so the sidebar is
397
+ wired as a Workbench rail (transient on small screens, focus handed to the
398
+ relocated toggle).
399
+ - **`headerPlacement` / `footerPlacement`** choose whether the entry toolbar and the
400
+ status + resource footer stay pinned (`fixed`, default) or scroll with the preview
401
+ (`scroll`) — useful where large text would leave pinned chrome little room.
387
402
  - **`theme`** is a global preference — the app's signal; `wireCatalog` only reports
388
403
  the toggle, the app applies the theme (the shell reads `theme` to show the toggle's
389
404
  opposite-state label). Omit `theme` to hide the toggle entirely.
@@ -397,7 +412,10 @@ matching options on `wireCatalog`) if they collide with your own action table.
397
412
 
398
413
  ## CSS
399
414
 
400
- `Catalog` composes public primitives (`Toolbar`, `ListHeader`, `ListItem`, `Select`,
401
- …). Import `@kerfjs/ui/styles.css` for the whole layer, or `@kerfjs/ui/catalog.css`
402
- plus each composed primitive's CSS. The shell is theme-aware and responsive: it
403
- stacks the sidebar above the detail below ~832px and hides it when collapsed.
415
+ `Catalog` composes public components (`Workbench`, `Pane`, `Toolbar`, `List`,
416
+ `ListHeader`, `ListItem`, `ListInsetText`, `Text`, …) and owns only the preview stage
417
+ (the checkerboard and centered canvas), the geometry overlay, the example viewport
418
+ options, and the brand mark's size. Import `@kerfjs/ui/styles.css` for the whole
419
+ layer, or `@kerfjs/ui/catalog.css` plus `@kerfjs/ui/workbench.css` and each composed
420
+ primitive's CSS. Like any Workbench it needs a definite containing height — the
421
+ `@kerfjs/ui/document.css` baseline's `.kui-app-root`.