@adea-ai/ui 0.151.11 → 0.151.12

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 (67) hide show
  1. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
  2. package/dist/components/composites/appearance-editor/appearance-rows.js +16 -3
  3. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  4. package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts +12 -0
  5. package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts.map +1 -1
  6. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +51 -16
  7. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
  8. package/dist/components/layout/contextual-sidebar/index.d.ts +1 -1
  9. package/dist/components/layout/contextual-sidebar/index.d.ts.map +1 -1
  10. package/dist/components/layout/shell-top-bar/shell-top-bar.d.ts +16 -10
  11. package/dist/components/layout/shell-top-bar/shell-top-bar.d.ts.map +1 -1
  12. package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -1
  13. package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
  14. package/dist/components/theme/script-projection.d.ts +17 -0
  15. package/dist/components/theme/script-projection.d.ts.map +1 -0
  16. package/dist/components/theme/script-projection.js +16 -0
  17. package/dist/components/theme/script-projection.js.map +1 -0
  18. package/dist/components/theme/theme-document-core.d.ts +5 -4
  19. package/dist/components/theme/theme-document-core.d.ts.map +1 -1
  20. package/dist/components/theme/theme-document-core.js +13 -3
  21. package/dist/components/theme/theme-document-core.js.map +1 -1
  22. package/dist/components/theme/theme-provider-value.d.ts +2 -1
  23. package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
  24. package/dist/components/theme/theme-provider-value.js +7 -0
  25. package/dist/components/theme/theme-provider-value.js.map +1 -1
  26. package/dist/components/theme/theme-script.d.ts +12 -0
  27. package/dist/components/theme/theme-script.d.ts.map +1 -1
  28. package/dist/components/theme/theme-script.js +14 -5
  29. package/dist/components/theme/theme-script.js.map +1 -1
  30. package/dist/components/theme/theme-state-core.d.ts +6 -0
  31. package/dist/components/theme/theme-state-core.d.ts.map +1 -1
  32. package/dist/components/theme/theme-state-core.js.map +1 -1
  33. package/dist/components/theme/token-projection-options.d.ts +3 -0
  34. package/dist/components/theme/token-projection-options.d.ts.map +1 -0
  35. package/dist/components/theme/token-projection-options.js +9 -0
  36. package/dist/components/theme/token-projection-options.js.map +1 -0
  37. package/dist/components/theme/token-projection.d.ts +22 -0
  38. package/dist/components/theme/token-projection.d.ts.map +1 -0
  39. package/dist/components/theme/token-projection.js +1 -0
  40. package/dist/r/appearance-editor.json +1 -1
  41. package/dist/r/lib.json +1 -1
  42. package/dist/r/registry.json +18 -3
  43. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +17 -9
  44. package/dist/r/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +76 -19
  45. package/dist/r/src/components/layout/contextual-sidebar/index.ts +1 -0
  46. package/dist/r/src/components/layout/shell-top-bar/shell-top-bar.tsx +22 -14
  47. package/dist/r/src/components/theme/script-projection.ts +40 -0
  48. package/dist/r/src/components/theme/theme-document-core.ts +17 -4
  49. package/dist/r/src/components/theme/theme-provider-value.ts +11 -1
  50. package/dist/r/src/components/theme/theme-script.ts +52 -4
  51. package/dist/r/src/components/theme/theme-state-core.ts +6 -0
  52. package/dist/r/src/components/theme/token-projection-options.ts +14 -0
  53. package/dist/r/src/components/theme/token-projection.ts +37 -0
  54. package/dist/r/theming.json +16 -1
  55. package/package.json +14 -2
  56. package/registry.json +18 -3
  57. package/src/components/composites/appearance-editor/appearance-rows.tsx +17 -9
  58. package/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +76 -19
  59. package/src/components/layout/contextual-sidebar/index.ts +1 -0
  60. package/src/components/layout/shell-top-bar/shell-top-bar.tsx +22 -14
  61. package/src/components/theme/script-projection.ts +40 -0
  62. package/src/components/theme/theme-document-core.ts +17 -4
  63. package/src/components/theme/theme-provider-value.ts +11 -1
  64. package/src/components/theme/theme-script.ts +52 -4
  65. package/src/components/theme/theme-state-core.ts +6 -0
  66. package/src/components/theme/token-projection-options.ts +14 -0
  67. package/src/components/theme/token-projection.ts +37 -0
@@ -1 +1 @@
1
- {"version":3,"file":"appearance-rows.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/appearance-editor/appearance-rows.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAkD,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AA2BnF,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,GAAG,CAAC,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAA;CACtB,eA4BA;AAED,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,SAAS,CAAA;CACnB,CAAA;AAkQD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,UAAU,EAAE,OAAO,GAAG,MAAM,CAAA;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,SAAS,CAAA;IAClB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B,eAwBA;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,OAAO,EAAE,SAAS,CAAA;IAClB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B,eAgCA"}
1
+ {"version":3,"file":"appearance-rows.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/appearance-editor/appearance-rows.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAkD,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AA2BnF,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,GAAG,CAAC,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAA;CACtB,eA4BA;AAED,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,SAAS,CAAA;CACnB,CAAA;AAqQD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,UAAU,EAAE,OAAO,GAAG,MAAM,CAAA;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,SAAS,CAAA;IAClB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B,eAwBA;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,OAAO,EAAE,SAAS,CAAA;IAClB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B,eAqCA"}
@@ -67,7 +67,14 @@ function ThemeSelectMenu(props) {
67
67
  onCleanup(() => {
68
68
  focusLifecycleVersion += 1;
69
69
  });
70
- const selected = createMemo(() => props.options.find((option) => option.id === props.selectedId) ?? props.options.find((option) => option.id === props.triggerPreview.id));
70
+ const selected = createMemo(() => {
71
+ const options = props.options;
72
+ const selectedId = props.selectedId;
73
+ const matched = options.find((option) => option.id === selectedId);
74
+ if (matched) return matched;
75
+ const previewId = props.triggerPreview.id;
76
+ return options.find((option) => option.id === previewId);
77
+ });
71
78
  const selectedName = () => selected()?.name ?? props.triggerPreview.name;
72
79
  const closeMenu = () => {
73
80
  if (menuOpen()) focusLifecycleVersion += 1;
@@ -318,8 +325,14 @@ function TerminalRow(props) {
318
325
  description: theme.description,
319
326
  preview: theme
320
327
  }))]);
321
- const selectedOption = () => options().find((option) => option.id === props.selectedId);
322
- const description = () => selectedOption() && selectedOption()?.id !== "theme" ? `The terminal follows ${selectedOption()?.name}.` : "The terminal follows the interface theme.";
328
+ const selectedOption = createMemo(() => {
329
+ const selectedId = props.selectedId;
330
+ return options().find((option) => option.id === selectedId);
331
+ });
332
+ const description = () => {
333
+ const option = selectedOption();
334
+ return option && option.id !== "theme" ? `The terminal follows ${option.name}.` : "The terminal follows the interface theme.";
335
+ };
323
336
  return createComponent(SettingsRow, {
324
337
  title: "Terminal",
325
338
  get icon() {
@@ -1 +1 @@
1
- {"version":3,"file":"appearance-rows.js","names":["AdeaTheme","AdeaThemeRecord","For","Show","createMemo","createSignal","onCleanup","JSX","ChevronDown","Moon","SquareTerminal","Sun","cn","Button","DropdownMenu","DropdownMenuContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuTrigger","PalettePreview","ThemeMenuPreview","POINTER_FOCUS_TARGET_SELECTOR","isTabStop","element","HTMLElement","tabIndex","matches","hasAttribute","getAttribute","closest","getClientRects","length","SettingsRow","props","title","icon","Element","description","stacked","children","_el$","_tmpl$2","_el$2","firstChild","_el$3","_el$4","nextSibling","_el$5","_el$7","_$insert","_$createComponent","when","_el$6","_tmpl$","_$effect","_p$","_v$","_v$2","e","_$className","t","undefined","ThemeOption","id","name","preview","ThemeSelectMenu","label","selectedId","triggerPreview","options","disabled","onSelect","portalMount","setPortalMount","HTMLDivElement","triggerElement","setTriggerElement","HTMLButtonElement","menuOpen","setMenuOpen","focusOutsideTarget","setFocusOutsideTarget","restoreTriggerFocus","setRestoreTriggerFocus","focusTargetAfterTab","focusLifecycleVersion","selected","find","option","selectedName","closeMenu","moveFocusOnTab","event","KeyboardEvent","key","isComposing","trigger","parentDialog","focusScope","ownerDocument","body","focusStops","Array","from","querySelectorAll","filter","orderedFocusStops","toSorted","a","b","triggerIndex","indexOf","direction","shiftKey","adjacent","at","stopPropagation","preventDefault","focus","preventScroll","_el$8","_tmpl$4","_$use","modal","open","onOpenChange","ref","as","variant","size","aria-label","_el$9","_tmpl$3","_el$0","theme","onInteractOutside","detail","originalEvent","type","target","contains","focusTarget","onFocusOutside","onEscapeKeyDown","onCloseAutoFocus","lifecycleVersion","shouldRestore","isConnected","queueMicrotask","activeElement","document","isMenuFocus","isTriggerFocus","value","onChange","each","textValue","closeOnSelect","_el$1","_tmpl$6","_el$10","_el$11","_tmpl$5","ThemeRow","appearance","themes","map","_$memo","TerminalRow","selectedOption","_$createComponent","_$className","_$memo"],"sources":["../../../../src/components/composites/appearance-editor/appearance-rows.tsx"],"sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2026 Wing\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n// Retains the compact divided row and palette-preview selector from the pinned\n// Zeron/Adea composition; Kobalte owns option navigation and nested dismissal.\n// One shared menu serves the light, dark, and terminal rows: each option is a\n// compact theme preview with its name and one-line description beside it, and\n// the menu sizes to that content instead of clipping it at the trigger width.\nimport type { AdeaTheme, AdeaThemeRecord } from '@adea-ai/themes'\nimport { For, Show, createMemo, createSignal, onCleanup, type JSX } from 'solid-js'\nimport { ChevronDown, Moon, SquareTerminal, Sun } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu/dropdown-menu'\nimport { PalettePreview, ThemeMenuPreview } from './theme-preview'\n\nconst POINTER_FOCUS_TARGET_SELECTOR =\n 'a[href], area[href], button, input, select, textarea, iframe, [tabindex], [contenteditable], details > summary:first-of-type'\n\nfunction isTabStop(element: HTMLElement) {\n return (\n (element.tabIndex >= 0 ||\n (element.matches('details > summary:first-of-type') && !element.hasAttribute('tabindex'))) &&\n !element.matches(':disabled') &&\n element.getAttribute('aria-disabled') !== 'true' &&\n element.closest('[hidden], [inert], [aria-hidden=\"true\"]') === null &&\n element.getClientRects().length > 0\n )\n}\n\nexport function SettingsRow(props: {\n title: string\n icon: JSX.Element\n description?: JSX.Element\n stacked?: boolean\n children: JSX.Element\n}) {\n return (\n <section\n class={cn('flex gap-3 px-4 py-4', {\n 'flex-col': props.stacked,\n 'flex-wrap items-center': !props.stacked,\n })}\n >\n {/* Reserve readable copy before choosing a side-by-side control row.\n Wrapping follows the actual host width and enlarged text, rather\n than a viewport breakpoint that also matches a narrow popover. */}\n <div class={cn('flex min-w-0 flex-1 items-center gap-3', { 'basis-48': !props.stacked })}>\n <span\n class=\"flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4\"\n aria-hidden=\"true\"\n >\n {props.icon}\n </span>\n <div class=\"min-w-0\">\n <h3 class=\"text-sm font-medium\">{props.title}</h3>\n <Show when={props.description}>\n <div class=\"mt-0.5 text-xs text-muted-foreground\">{props.description}</div>\n </Show>\n </div>\n </div>\n <div class=\"min-w-0 max-w-full shrink-0\">{props.children}</div>\n </section>\n )\n}\n\n/** One selectable palette in a theme menu. */\nexport type ThemeOption = {\n id: string\n name: string\n description?: string\n preview: AdeaTheme\n}\n\n/**\n * The shared theme picker. Kobalte handles menu navigation and dismissal;\n * this component moves Tab to the adjacent browser-reported stop because\n * menus consume Tab by default. Enumerating elements and checking their native\n * tabIndex keeps details summaries in the order while preserving explicit\n * tabindex overrides. The menu width follows its content (bounded by the\n * popper's available width) so a long theme name and its description render\n * fully instead of truncating at the trigger's width.\n */\nfunction ThemeSelectMenu(props: {\n /** Row title; prefixes the trigger's accessible name and labels the group. */\n label: string\n selectedId: string\n /** Palette shown on the trigger; hosts pass the accent-applied preview. */\n triggerPreview: AdeaTheme\n options: readonly ThemeOption[]\n disabled?: boolean\n onSelect: (id: string) => void\n}) {\n const [portalMount, setPortalMount] = createSignal<HTMLDivElement>()\n const [triggerElement, setTriggerElement] = createSignal<HTMLButtonElement>()\n const [menuOpen, setMenuOpen] = createSignal(false)\n const [focusOutsideTarget, setFocusOutsideTarget] = createSignal<HTMLElement>()\n const [restoreTriggerFocus, setRestoreTriggerFocus] = createSignal(false)\n let focusTargetAfterTab: HTMLElement | undefined\n let focusLifecycleVersion = 0\n onCleanup(() => {\n focusLifecycleVersion += 1\n })\n const selected = createMemo(\n () =>\n props.options.find((option) => option.id === props.selectedId) ??\n props.options.find((option) => option.id === props.triggerPreview.id)\n )\n const selectedName = () => selected()?.name ?? props.triggerPreview.name\n const closeMenu = () => {\n if (menuOpen()) focusLifecycleVersion += 1\n setMenuOpen(false)\n }\n const moveFocusOnTab = (event: KeyboardEvent) => {\n if (event.key !== 'Tab' || event.isComposing) return\n\n const trigger = triggerElement()\n if (!trigger) return\n const parentDialog = portalMount()?.closest<HTMLElement>('[role=\"dialog\"]')\n const focusScope = parentDialog ?? portalMount()?.ownerDocument.body\n if (!focusScope) return\n\n const focusStops = Array.from(focusScope.querySelectorAll<HTMLElement>('*')).filter(\n (element) =>\n isTabStop(element) &&\n element.closest('[role=\"menu\"], [hidden], [inert], [aria-hidden=\"true\"]') === null\n )\n const orderedFocusStops = [\n ...focusStops\n .filter((element) => element.tabIndex > 0)\n .toSorted((a, b) => a.tabIndex - b.tabIndex),\n ...focusStops.filter((element) => element.tabIndex <= 0),\n ]\n const triggerIndex = orderedFocusStops.indexOf(trigger)\n const direction = event.shiftKey ? -1 : 1\n const adjacent =\n orderedFocusStops[triggerIndex + direction] ??\n (parentDialog ? (direction > 0 ? orderedFocusStops[0] : orderedFocusStops.at(-1)) : undefined)\n\n event.stopPropagation()\n setRestoreTriggerFocus(false)\n if (adjacent) {\n event.preventDefault()\n focusTargetAfterTab = adjacent\n setFocusOutsideTarget(adjacent)\n closeMenu()\n adjacent.focus({ preventScroll: true })\n } else {\n focusTargetAfterTab = undefined\n setFocusOutsideTarget(undefined)\n closeMenu()\n }\n }\n return (\n <div ref={setPortalMount}>\n <DropdownMenu\n modal={false}\n open={menuOpen()}\n onOpenChange={(open) => {\n if (open !== menuOpen()) focusLifecycleVersion += 1\n setMenuOpen(open)\n if (open) {\n focusTargetAfterTab = undefined\n setFocusOutsideTarget(undefined)\n setRestoreTriggerFocus(false)\n }\n }}\n >\n <DropdownMenuTrigger\n ref={setTriggerElement}\n as={Button}\n variant=\"outline\"\n size=\"sm\"\n aria-label={`${props.label}: ${selectedName()}`}\n disabled={props.disabled || props.options.length === 0}\n class=\"w-full justify-between sm:w-52\"\n >\n <span class=\"flex min-w-0 flex-1 items-center gap-2\">\n <PalettePreview theme={props.triggerPreview} />\n <span class=\"min-w-0 flex-1 truncate\">{selectedName()}</span>\n </span>\n <ChevronDown aria-hidden=\"true\" class=\"shrink-0 text-muted-foreground\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n portalMount={portalMount()}\n // A fixed height with its own scroll: an adaptive cap measured the\n // host panel instead, and opening a long theme list scrolled the\n // sidebar to reveal the menu. The content scrolls internally at the\n // cap, so the panel around the trigger never moves. Width still\n // follows content (at least the trigger width, never wider than the\n // popper allows) so long theme names render in full with padding for\n // the selection indicator instead of truncating at the anchor width.\n class=\"max-h-80 w-max min-w-(--kb-popper-anchor-width) max-w-(--kb-popper-content-available-width) overflow-x-hidden overflow-y-auto\"\n onInteractOutside={(event) => {\n if (event.detail.originalEvent.type !== 'pointerdown') return\n const parentDialog = portalMount()?.closest<HTMLElement>('[role=\"dialog\"]')\n const focusScope = parentDialog ?? portalMount()?.ownerDocument.body\n const target = event.detail.originalEvent.target\n if (!(target instanceof Element) || !focusScope?.contains(target)) return\n\n const focusTarget = target.closest<HTMLElement>(POINTER_FOCUS_TARGET_SELECTOR)\n if (focusTarget && isTabStop(focusTarget)) {\n setRestoreTriggerFocus(false)\n setFocusOutsideTarget(focusTarget)\n } else {\n setRestoreTriggerFocus(true)\n }\n }}\n onFocusOutside={(event) => {\n // The containing dialog or document body can briefly reclaim\n // focus when the menu opens. Keep that handoff from dismissing\n // it; focus moving to another descendant still closes the menu.\n const parentDialog = portalMount()?.closest<HTMLElement>('[role=\"dialog\"]')\n const focusScope = parentDialog ?? portalMount()?.ownerDocument.body\n const target = event.detail.originalEvent.target\n if (target === focusScope) {\n event.preventDefault()\n } else if (target instanceof HTMLElement && focusScope?.contains(target)) {\n setRestoreTriggerFocus(false)\n setFocusOutsideTarget(target)\n }\n }}\n onEscapeKeyDown={() => setRestoreTriggerFocus(true)}\n onCloseAutoFocus={(event) => {\n // A prior menu instance can finish its focus cleanup after this\n // row has already reopened. Do not let that cleanup steal focus.\n if (menuOpen()) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus()\n const focusTarget = focusTargetAfterTab ?? focusOutsideTarget()\n focusTargetAfterTab = undefined\n setFocusOutsideTarget(undefined)\n setRestoreTriggerFocus(false)\n if (shouldRestore) {\n // The saved focus may be the containing dialog rather than\n // the trigger when WebKit opens this menu from a pointer click.\n event.preventDefault()\n triggerElement()?.focus({ preventScroll: true })\n return\n }\n\n const parentDialog = portalMount()?.closest<HTMLElement>('[role=\"dialog\"]')\n const focusScope = parentDialog ?? portalMount()?.ownerDocument.body\n if (focusTarget?.isConnected && focusScope?.contains(focusTarget)) {\n // Preserve the intended in-scope destination across\n // Kobalte's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || menuOpen()) return\n\n const activeElement = document.activeElement\n const isMenuFocus =\n activeElement instanceof HTMLElement &&\n activeElement.closest('[role=\"menu\"]') !== null\n const isTriggerFocus = activeElement === triggerElement()\n if (\n activeElement !== focusTarget &&\n (activeElement === document.body ||\n activeElement === focusScope ||\n isMenuFocus ||\n isTriggerFocus)\n ) {\n focusTarget.focus({ preventScroll: true })\n }\n })\n return\n }\n\n const activeElement = document.activeElement\n if (\n focusScope &&\n activeElement instanceof HTMLElement &&\n activeElement !== focusScope &&\n focusScope.contains(activeElement) &&\n activeElement.closest('[role=\"menu\"]') === null\n ) {\n // Preserve a real focus target in this scope instead of\n // restoring the stale element captured when the menu mounted. A\n // focused menu item is about to unmount, so Kobalte must restore\n // focus to the trigger instead.\n event.preventDefault()\n }\n }}\n >\n <DropdownMenuRadioGroup\n value={selected()?.id ?? ''}\n aria-label={`${props.label} options`}\n on:keydown={moveFocusOnTab}\n onChange={(id) => {\n if (!props.disabled && typeof id === 'string') props.onSelect(id)\n }}\n >\n <For each={props.options}>\n {(option) => (\n <DropdownMenuRadioItem\n value={option.id}\n textValue={option.name}\n closeOnSelect={true}\n disabled={props.disabled}\n onSelect={() => setRestoreTriggerFocus(true)}\n >\n <ThemeMenuPreview theme={option.preview} />\n <span class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span class=\"truncate\">{option.name}</span>\n {/* Visual affordance only: the accessible name stays the\n theme name, which is what keyboard and test callers\n match on. */}\n <Show when={option.description}>\n <span\n aria-hidden=\"true\"\n class=\"line-clamp-2 max-w-44 text-2xs text-muted-foreground\"\n >\n {option.description}\n </span>\n </Show>\n </span>\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n )\n}\n\n/**\n * A compact persistent theme choice for one appearance.\n */\nexport function ThemeRow(props: {\n appearance: 'light' | 'dark'\n selectedId: string\n preview: AdeaTheme\n themes: readonly AdeaThemeRecord[]\n disabled?: boolean\n onSelect: (id: string) => void\n}) {\n const label = () => (props.appearance === 'light' ? 'Light theme' : 'Dark theme')\n const options = createMemo<ThemeOption[]>(() =>\n props.themes\n .filter((theme) => theme.appearance === props.appearance)\n .map((theme) => ({\n id: theme.id,\n name: theme.name,\n description: theme.description,\n preview: theme,\n }))\n )\n return (\n <SettingsRow title={label()} icon={props.appearance === 'light' ? <Sun /> : <Moon />}>\n <ThemeSelectMenu\n label={label()}\n selectedId={props.selectedId}\n triggerPreview={props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />\n </SettingsRow>\n )\n}\n\n/**\n * A terminal palette choice independent of the light/dark rows. The first\n * option (`'theme'`) follows the interface theme, painted with the resolved\n * preview; every catalogue record follows, both appearances, because the\n * terminal paints one fixed ANSI palette rather than an appearance axis.\n */\nexport function TerminalRow(props: {\n selectedId: string\n /** Resolved interface theme: the `theme` option's palette and the fallback. */\n preview: AdeaTheme\n themes: readonly AdeaThemeRecord[]\n disabled?: boolean\n onSelect: (id: string) => void\n}) {\n const options = createMemo<ThemeOption[]>(() => [\n {\n id: 'theme',\n name: 'UI theme',\n description: 'Uses the interface theme.',\n preview: props.preview,\n },\n ...props.themes.map((theme) => ({\n id: theme.id,\n name: theme.name,\n description: theme.description,\n preview: theme,\n })),\n ])\n const selectedOption = () => options().find((option) => option.id === props.selectedId)\n const description = () =>\n selectedOption() && selectedOption()?.id !== 'theme'\n ? `The terminal follows ${selectedOption()?.name}.`\n : 'The terminal follows the interface theme.'\n return (\n <SettingsRow title=\"Terminal\" icon={<SquareTerminal />} description={description()}>\n <ThemeSelectMenu\n label=\"Terminal\"\n selectedId={props.selectedId}\n triggerPreview={selectedOption()?.preview ?? props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />\n </SettingsRow>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AA0CA,IAAMqB,gCACJ;AAEF,SAASC,UAAUC,SAAsB;CACvC,QACGA,QAAQE,YAAY,KAClBF,QAAQG,QAAQ,iCAAiC,KAAK,CAACH,QAAQI,aAAa,UAAU,MACzF,CAACJ,QAAQG,QAAQ,WAAW,KAC5BH,QAAQK,aAAa,eAAe,MAAM,UAC1CL,QAAQM,QAAQ,2CAAyC,MAAM,QAC/DN,QAAQO,eAAe,CAAC,CAACC,SAAS;AAEtC;AAEA,SAAgBC,YAAYC,OAMzB;CACD,cAAA;EAAA,IAAAO,OAAAC,QAAA,GAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAC,YAAAE,QAAAD,MAAAE,aAAAC,QAAAF,MAAA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EA,QAAQ;IAAC;IAAA,IAClBC,WAAQ;KAAA,OAAEtC,MAAMsC;IAAQ;IAAA,IACxBC,WAAQ;KAAA,OAAEvC,MAAMuC;IAAQ;GAAA,CAAA;EAAA;CAAA,CAAA;AAIhC"}
1
+ {"version":3,"file":"appearance-rows.js","names":["AdeaTheme","AdeaThemeRecord","For","Show","createMemo","createSignal","onCleanup","JSX","ChevronDown","Moon","SquareTerminal","Sun","cn","Button","DropdownMenu","DropdownMenuContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuTrigger","PalettePreview","ThemeMenuPreview","POINTER_FOCUS_TARGET_SELECTOR","isTabStop","element","HTMLElement","tabIndex","matches","hasAttribute","getAttribute","closest","getClientRects","length","SettingsRow","props","title","icon","Element","description","stacked","children","_el$","_tmpl$2","_el$2","firstChild","_el$3","_el$4","nextSibling","_el$5","_el$7","_$insert","_$createComponent","when","_el$6","_tmpl$","_$effect","_p$","_v$","_v$2","e","_$className","t","undefined","ThemeOption","id","name","preview","ThemeSelectMenu","label","selectedId","triggerPreview","options","disabled","onSelect","portalMount","setPortalMount","HTMLDivElement","triggerElement","setTriggerElement","HTMLButtonElement","menuOpen","setMenuOpen","focusOutsideTarget","setFocusOutsideTarget","restoreTriggerFocus","setRestoreTriggerFocus","focusTargetAfterTab","focusLifecycleVersion","selected","matched","find","option","previewId","selectedName","closeMenu","moveFocusOnTab","event","KeyboardEvent","key","isComposing","trigger","parentDialog","focusScope","ownerDocument","body","focusStops","Array","from","querySelectorAll","filter","orderedFocusStops","toSorted","a","b","triggerIndex","indexOf","direction","shiftKey","adjacent","at","stopPropagation","preventDefault","focus","preventScroll","_el$8","_tmpl$4","_$use","modal","open","onOpenChange","ref","as","variant","size","aria-label","_el$9","_tmpl$3","_el$0","theme","onInteractOutside","detail","originalEvent","type","target","contains","focusTarget","onFocusOutside","onEscapeKeyDown","onCloseAutoFocus","lifecycleVersion","shouldRestore","isConnected","queueMicrotask","activeElement","document","isMenuFocus","isTriggerFocus","value","onChange","each","textValue","closeOnSelect","_el$1","_tmpl$6","_el$10","_el$11","_tmpl$5","ThemeRow","appearance","themes","map","_$memo","TerminalRow","selectedOption","_$createComponent","_$className","_$memo"],"sources":["../../../../src/components/composites/appearance-editor/appearance-rows.tsx"],"sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2026 Wing\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n// Retains the compact divided row and palette-preview selector from the pinned\n// Zeron/Adea composition; Kobalte owns option navigation and nested dismissal.\n// One shared menu serves the light, dark, and terminal rows: each option is a\n// compact theme preview with its name and one-line description beside it, and\n// the menu sizes to that content instead of clipping it at the trigger width.\nimport type { AdeaTheme, AdeaThemeRecord } from '@adea-ai/themes'\nimport { For, Show, createMemo, createSignal, onCleanup, type JSX } from 'solid-js'\nimport { ChevronDown, Moon, SquareTerminal, Sun } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu/dropdown-menu'\nimport { PalettePreview, ThemeMenuPreview } from './theme-preview'\n\nconst POINTER_FOCUS_TARGET_SELECTOR =\n 'a[href], area[href], button, input, select, textarea, iframe, [tabindex], [contenteditable], details > summary:first-of-type'\n\nfunction isTabStop(element: HTMLElement) {\n return (\n (element.tabIndex >= 0 ||\n (element.matches('details > summary:first-of-type') && !element.hasAttribute('tabindex'))) &&\n !element.matches(':disabled') &&\n element.getAttribute('aria-disabled') !== 'true' &&\n element.closest('[hidden], [inert], [aria-hidden=\"true\"]') === null &&\n element.getClientRects().length > 0\n )\n}\n\nexport function SettingsRow(props: {\n title: string\n icon: JSX.Element\n description?: JSX.Element\n stacked?: boolean\n children: JSX.Element\n}) {\n return (\n <section\n class={cn('flex gap-3 px-4 py-4', {\n 'flex-col': props.stacked,\n 'flex-wrap items-center': !props.stacked,\n })}\n >\n {/* Reserve readable copy before choosing a side-by-side control row.\n Wrapping follows the actual host width and enlarged text, rather\n than a viewport breakpoint that also matches a narrow popover. */}\n <div class={cn('flex min-w-0 flex-1 items-center gap-3', { 'basis-48': !props.stacked })}>\n <span\n class=\"flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4\"\n aria-hidden=\"true\"\n >\n {props.icon}\n </span>\n <div class=\"min-w-0\">\n <h3 class=\"text-sm font-medium\">{props.title}</h3>\n <Show when={props.description}>\n <div class=\"mt-0.5 text-xs text-muted-foreground\">{props.description}</div>\n </Show>\n </div>\n </div>\n <div class=\"min-w-0 max-w-full shrink-0\">{props.children}</div>\n </section>\n )\n}\n\n/** One selectable palette in a theme menu. */\nexport type ThemeOption = {\n id: string\n name: string\n description?: string\n preview: AdeaTheme\n}\n\n/**\n * The shared theme picker. Kobalte handles menu navigation and dismissal;\n * this component moves Tab to the adjacent browser-reported stop because\n * menus consume Tab by default. Enumerating elements and checking their native\n * tabIndex keeps details summaries in the order while preserving explicit\n * tabindex overrides. The menu width follows its content (bounded by the\n * popper's available width) so a long theme name and its description render\n * fully instead of truncating at the trigger's width.\n */\nfunction ThemeSelectMenu(props: {\n /** Row title; prefixes the trigger's accessible name and labels the group. */\n label: string\n selectedId: string\n /** Palette shown on the trigger; hosts pass the accent-applied preview. */\n triggerPreview: AdeaTheme\n options: readonly ThemeOption[]\n disabled?: boolean\n onSelect: (id: string) => void\n}) {\n const [portalMount, setPortalMount] = createSignal<HTMLDivElement>()\n const [triggerElement, setTriggerElement] = createSignal<HTMLButtonElement>()\n const [menuOpen, setMenuOpen] = createSignal(false)\n const [focusOutsideTarget, setFocusOutsideTarget] = createSignal<HTMLElement>()\n const [restoreTriggerFocus, setRestoreTriggerFocus] = createSignal(false)\n let focusTargetAfterTab: HTMLElement | undefined\n let focusLifecycleVersion = 0\n onCleanup(() => {\n focusLifecycleVersion += 1\n })\n const selected = createMemo(() => {\n const options = props.options\n const selectedId = props.selectedId\n const matched = options.find((option) => option.id === selectedId)\n if (matched) return matched\n const previewId = props.triggerPreview.id\n return options.find((option) => option.id === previewId)\n })\n const selectedName = () => selected()?.name ?? props.triggerPreview.name\n const closeMenu = () => {\n if (menuOpen()) focusLifecycleVersion += 1\n setMenuOpen(false)\n }\n const moveFocusOnTab = (event: KeyboardEvent) => {\n if (event.key !== 'Tab' || event.isComposing) return\n\n const trigger = triggerElement()\n if (!trigger) return\n const parentDialog = portalMount()?.closest<HTMLElement>('[role=\"dialog\"]')\n const focusScope = parentDialog ?? portalMount()?.ownerDocument.body\n if (!focusScope) return\n\n const focusStops = Array.from(focusScope.querySelectorAll<HTMLElement>('*')).filter(\n (element) =>\n isTabStop(element) &&\n element.closest('[role=\"menu\"], [hidden], [inert], [aria-hidden=\"true\"]') === null\n )\n const orderedFocusStops = [\n ...focusStops\n .filter((element) => element.tabIndex > 0)\n .toSorted((a, b) => a.tabIndex - b.tabIndex),\n ...focusStops.filter((element) => element.tabIndex <= 0),\n ]\n const triggerIndex = orderedFocusStops.indexOf(trigger)\n const direction = event.shiftKey ? -1 : 1\n const adjacent =\n orderedFocusStops[triggerIndex + direction] ??\n (parentDialog ? (direction > 0 ? orderedFocusStops[0] : orderedFocusStops.at(-1)) : undefined)\n\n event.stopPropagation()\n setRestoreTriggerFocus(false)\n if (adjacent) {\n event.preventDefault()\n focusTargetAfterTab = adjacent\n setFocusOutsideTarget(adjacent)\n closeMenu()\n adjacent.focus({ preventScroll: true })\n } else {\n focusTargetAfterTab = undefined\n setFocusOutsideTarget(undefined)\n closeMenu()\n }\n }\n return (\n <div ref={setPortalMount}>\n <DropdownMenu\n modal={false}\n open={menuOpen()}\n onOpenChange={(open) => {\n if (open !== menuOpen()) focusLifecycleVersion += 1\n setMenuOpen(open)\n if (open) {\n focusTargetAfterTab = undefined\n setFocusOutsideTarget(undefined)\n setRestoreTriggerFocus(false)\n }\n }}\n >\n <DropdownMenuTrigger\n ref={setTriggerElement}\n as={Button}\n variant=\"outline\"\n size=\"sm\"\n aria-label={`${props.label}: ${selectedName()}`}\n disabled={props.disabled || props.options.length === 0}\n class=\"w-full justify-between sm:w-52\"\n >\n <span class=\"flex min-w-0 flex-1 items-center gap-2\">\n <PalettePreview theme={props.triggerPreview} />\n <span class=\"min-w-0 flex-1 truncate\">{selectedName()}</span>\n </span>\n <ChevronDown aria-hidden=\"true\" class=\"shrink-0 text-muted-foreground\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n portalMount={portalMount()}\n // A fixed height with its own scroll: an adaptive cap measured the\n // host panel instead, and opening a long theme list scrolled the\n // sidebar to reveal the menu. The content scrolls internally at the\n // cap, so the panel around the trigger never moves. Width still\n // follows content (at least the trigger width, never wider than the\n // popper allows) so long theme names render in full with padding for\n // the selection indicator instead of truncating at the anchor width.\n class=\"max-h-80 w-max min-w-(--kb-popper-anchor-width) max-w-(--kb-popper-content-available-width) overflow-x-hidden overflow-y-auto\"\n onInteractOutside={(event) => {\n if (event.detail.originalEvent.type !== 'pointerdown') return\n const parentDialog = portalMount()?.closest<HTMLElement>('[role=\"dialog\"]')\n const focusScope = parentDialog ?? portalMount()?.ownerDocument.body\n const target = event.detail.originalEvent.target\n if (!(target instanceof Element) || !focusScope?.contains(target)) return\n\n const focusTarget = target.closest<HTMLElement>(POINTER_FOCUS_TARGET_SELECTOR)\n if (focusTarget && isTabStop(focusTarget)) {\n setRestoreTriggerFocus(false)\n setFocusOutsideTarget(focusTarget)\n } else {\n setRestoreTriggerFocus(true)\n }\n }}\n onFocusOutside={(event) => {\n // The containing dialog or document body can briefly reclaim\n // focus when the menu opens. Keep that handoff from dismissing\n // it; focus moving to another descendant still closes the menu.\n const parentDialog = portalMount()?.closest<HTMLElement>('[role=\"dialog\"]')\n const focusScope = parentDialog ?? portalMount()?.ownerDocument.body\n const target = event.detail.originalEvent.target\n if (target === focusScope) {\n event.preventDefault()\n } else if (target instanceof HTMLElement && focusScope?.contains(target)) {\n setRestoreTriggerFocus(false)\n setFocusOutsideTarget(target)\n }\n }}\n onEscapeKeyDown={() => setRestoreTriggerFocus(true)}\n onCloseAutoFocus={(event) => {\n // A prior menu instance can finish its focus cleanup after this\n // row has already reopened. Do not let that cleanup steal focus.\n if (menuOpen()) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus()\n const focusTarget = focusTargetAfterTab ?? focusOutsideTarget()\n focusTargetAfterTab = undefined\n setFocusOutsideTarget(undefined)\n setRestoreTriggerFocus(false)\n if (shouldRestore) {\n // The saved focus may be the containing dialog rather than\n // the trigger when WebKit opens this menu from a pointer click.\n event.preventDefault()\n triggerElement()?.focus({ preventScroll: true })\n return\n }\n\n const parentDialog = portalMount()?.closest<HTMLElement>('[role=\"dialog\"]')\n const focusScope = parentDialog ?? portalMount()?.ownerDocument.body\n if (focusTarget?.isConnected && focusScope?.contains(focusTarget)) {\n // Preserve the intended in-scope destination across\n // Kobalte's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || menuOpen()) return\n\n const activeElement = document.activeElement\n const isMenuFocus =\n activeElement instanceof HTMLElement &&\n activeElement.closest('[role=\"menu\"]') !== null\n const isTriggerFocus = activeElement === triggerElement()\n if (\n activeElement !== focusTarget &&\n (activeElement === document.body ||\n activeElement === focusScope ||\n isMenuFocus ||\n isTriggerFocus)\n ) {\n focusTarget.focus({ preventScroll: true })\n }\n })\n return\n }\n\n const activeElement = document.activeElement\n if (\n focusScope &&\n activeElement instanceof HTMLElement &&\n activeElement !== focusScope &&\n focusScope.contains(activeElement) &&\n activeElement.closest('[role=\"menu\"]') === null\n ) {\n // Preserve a real focus target in this scope instead of\n // restoring the stale element captured when the menu mounted. A\n // focused menu item is about to unmount, so Kobalte must restore\n // focus to the trigger instead.\n event.preventDefault()\n }\n }}\n >\n <DropdownMenuRadioGroup\n value={selected()?.id ?? ''}\n aria-label={`${props.label} options`}\n on:keydown={moveFocusOnTab}\n onChange={(id) => {\n if (!props.disabled && typeof id === 'string') props.onSelect(id)\n }}\n >\n <For each={props.options}>\n {(option) => (\n <DropdownMenuRadioItem\n value={option.id}\n textValue={option.name}\n closeOnSelect={true}\n disabled={props.disabled}\n onSelect={() => setRestoreTriggerFocus(true)}\n >\n <ThemeMenuPreview theme={option.preview} />\n <span class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span class=\"truncate\">{option.name}</span>\n {/* Visual affordance only: the accessible name stays the\n theme name, which is what keyboard and test callers\n match on. */}\n <Show when={option.description}>\n <span\n aria-hidden=\"true\"\n class=\"line-clamp-2 max-w-44 text-2xs text-muted-foreground\"\n >\n {option.description}\n </span>\n </Show>\n </span>\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n )\n}\n\n/**\n * A compact persistent theme choice for one appearance.\n */\nexport function ThemeRow(props: {\n appearance: 'light' | 'dark'\n selectedId: string\n preview: AdeaTheme\n themes: readonly AdeaThemeRecord[]\n disabled?: boolean\n onSelect: (id: string) => void\n}) {\n const label = () => (props.appearance === 'light' ? 'Light theme' : 'Dark theme')\n const options = createMemo<ThemeOption[]>(() =>\n props.themes\n .filter((theme) => theme.appearance === props.appearance)\n .map((theme) => ({\n id: theme.id,\n name: theme.name,\n description: theme.description,\n preview: theme,\n }))\n )\n return (\n <SettingsRow title={label()} icon={props.appearance === 'light' ? <Sun /> : <Moon />}>\n <ThemeSelectMenu\n label={label()}\n selectedId={props.selectedId}\n triggerPreview={props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />\n </SettingsRow>\n )\n}\n\n/**\n * A terminal palette choice independent of the light/dark rows. The first\n * option (`'theme'`) follows the interface theme, painted with the resolved\n * preview; every catalogue record follows, both appearances, because the\n * terminal paints one fixed ANSI palette rather than an appearance axis.\n */\nexport function TerminalRow(props: {\n selectedId: string\n /** Resolved interface theme: the `theme` option's palette and the fallback. */\n preview: AdeaTheme\n themes: readonly AdeaThemeRecord[]\n disabled?: boolean\n onSelect: (id: string) => void\n}) {\n const options = createMemo<ThemeOption[]>(() => [\n {\n id: 'theme',\n name: 'UI theme',\n description: 'Uses the interface theme.',\n preview: props.preview,\n },\n ...props.themes.map((theme) => ({\n id: theme.id,\n name: theme.name,\n description: theme.description,\n preview: theme,\n })),\n ])\n const selectedOption = createMemo(() => {\n const selectedId = props.selectedId\n return options().find((option) => option.id === selectedId)\n })\n const description = () => {\n const option = selectedOption()\n return option && option.id !== 'theme'\n ? `The terminal follows ${option.name}.`\n : 'The terminal follows the interface theme.'\n }\n return (\n <SettingsRow title=\"Terminal\" icon={<SquareTerminal />} description={description()}>\n <ThemeSelectMenu\n label=\"Terminal\"\n selectedId={props.selectedId}\n triggerPreview={selectedOption()?.preview ?? props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />\n </SettingsRow>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AA0CA,IAAMqB,gCACJ;AAEF,SAASC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AanC,MAAMmC;EACzB,OAAOE,QAAQ,CAAC,CAACmB,MAAMC,WAAWA,OAAO3B,OAAOK,UAAU;CAC5D,CAAC;CACD,MAAM/B,oBAAoB;EACxB,MAAMqD,SAASkF,eAAe;EAC9B,OAAOlF,UAAUA,OAAO3B,OAAO,UAC3B,wBAAwB2B,OAAO1B,KAAI,KACnC;CACN;CACA,OAAAd,gBACGlB,aAAW;EAACE,OAAK;EAAA,IAAYC,OAAI;GAAA,OAAAe,gBAAGxC,gBAAc,CAAA,CAAA;EAAA;EAAA,IAAK2B,cAAW;GAAA,OAAEA,YAAY;EAAC;EAAA,IAAAE,WAAA;GAAA,OAAAW,gBAC/EgB,iBAAe;IACdC,OAAK;IAAA,IACLC,aAAU;KAAA,OAAEnC,MAAMmC;IAAU;IAAA,IAC5BC,iBAAc;KAAA,OAAEuG,eAAe,CAAC,EAAE3G,WAAWhC,MAAMgC;IAAO;IAAA,IAC1DK,UAAO;KAAA,OAAEA,QAAQ;IAAC;IAAA,IAClBC,WAAQ;KAAA,OAAEtC,MAAMsC;IAAQ;IAAA,IACxBC,WAAQ;KAAA,OAAEvC,MAAMuC;IAAQ;GAAA,CAAA;EAAA;CAAA,CAAA;AAIhC"}
@@ -5,6 +5,12 @@ export type ContextualSidebarRenderContext = {
5
5
  /** Mount nested popovers and menus inside the mobile dialog's accessibility tree. */
6
6
  portalMount(): HTMLElement | undefined;
7
7
  };
8
+ export type ContextualSidebarModeTransition = {
9
+ phase: 'before' | 'after';
10
+ from: 'desktop' | 'mobile';
11
+ to: 'desktop' | 'mobile';
12
+ desktopSidebar: HTMLElement | undefined;
13
+ };
8
14
  export type ContextualSidebarProps = {
9
15
  /** Stable host id prefix; generated when omitted. */
10
16
  id?: string;
@@ -27,6 +33,12 @@ export type ContextualSidebarProps = {
27
33
  * hosts can select `desktop` or the shared mobile `Sheet` themselves.
28
34
  */
29
35
  responsiveMode?: 'auto' | 'desktop' | 'mobile';
36
+ /**
37
+ * Coordinate host layout before a runtime mode change and after its DOM settles.
38
+ * A superseded transition or unmounted sidebar does not emit an after phase.
39
+ * Initial mode resolution does not emit either phase.
40
+ */
41
+ onResponsiveModeTransition?(event: ContextualSidebarModeTransition): void;
30
42
  /** Current host-owned pixel width, reflected by the resize handle. */
31
43
  width: number;
32
44
  minimum: number;
@@ -1 +1 @@
1
- {"version":3,"file":"contextual-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/contextual-sidebar/contextual-sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAe7C,MAAM,MAAM,8BAA8B,GAAG;IAC3C,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAA;IACf,qFAAqF;IACrF,WAAW,IAAI,WAAW,GAAG,SAAS,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,qDAAqD;IACrD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACrC,8EAA8E;IAC9E,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAA;IAC9C,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,sEAAsE;IACtE,eAAe,CAAC,EAAE,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAC,CAAA;IACnD,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9E,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACnD,iEAAiE;IACjE,MAAM,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,0EAA0E;IAC1E,OAAO,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,oEAAoE;IACpE,MAAM,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eA+L9D"}
1
+ {"version":3,"file":"contextual-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/contextual-sidebar/contextual-sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAuB7C,MAAM,MAAM,8BAA8B,GAAG;IAC3C,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAA;IACf,qFAAqF;IACr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,IAAI,CAAA;IAC9E,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACnD,iEAAiE;IACjE,MAAM,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,0EAA0E;IAC1E,OAAO,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,oEAAoE;IACpE,MAAM,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAmO9D"}
@@ -2,7 +2,7 @@ import { cn } from "../../../lib/utils.js";
2
2
  import { SidebarNav, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavTitle } from "../sidebar-nav/sidebar-nav.js";
3
3
  import { PixelResizeHandle } from "../pixel-resize-handle/pixel-resize-handle.js";
4
4
  import { createComponent, memo } from "solid-js/web";
5
- import { Show, createEffect, createSignal, createUniqueId, onCleanup, untrack } from "solid-js";
5
+ import { Show, createEffect, createMemo, createSignal, createUniqueId, onCleanup, untrack } from "solid-js";
6
6
  // src/components/layout/contextual-sidebar/contextual-sidebar.tsx
7
7
  /**
8
8
  * ContextualSidebar.
@@ -18,6 +18,45 @@ function ContextualSidebar(props) {
18
18
  let mobileLoadPending = false;
19
19
  let mobileLoadSettled = false;
20
20
  let responsiveModeInitialized = false;
21
+ let desktopSidebar;
22
+ let transitionGeneration = 0;
23
+ let pendingMode;
24
+ let disposed = false;
25
+ onCleanup(() => {
26
+ disposed = true;
27
+ transitionGeneration += 1;
28
+ });
29
+ const transition = (next, closeStaleOpen) => {
30
+ if (pendingMode === next) return;
31
+ const previous = untrack(isMobile);
32
+ const changed = responsiveModeInitialized && previous !== next;
33
+ const generation = changed || pendingMode !== void 0 ? ++transitionGeneration : transitionGeneration;
34
+ pendingMode = next;
35
+ const event = {
36
+ from: previous ? "mobile" : "desktop",
37
+ to: next ? "mobile" : "desktop",
38
+ desktopSidebar
39
+ };
40
+ try {
41
+ if (changed) untrack(() => props.onResponsiveModeTransition?.({
42
+ ...event,
43
+ phase: "before"
44
+ }));
45
+ if (disposed || generation !== transitionGeneration) return;
46
+ if (closeStaleOpen) untrack(() => props.onOpenChange(false));
47
+ if (disposed || generation !== transitionGeneration) return;
48
+ if (next) loadMobile();
49
+ setIsMobile(next);
50
+ if (changed) queueMicrotask(() => {
51
+ if (!disposed && generation === transitionGeneration && untrack(isMobile) === next) untrack(() => props.onResponsiveModeTransition?.({
52
+ ...event,
53
+ phase: "after"
54
+ }));
55
+ });
56
+ } finally {
57
+ if (generation === transitionGeneration) pendingMode = void 0;
58
+ }
59
+ };
21
60
  const loadMobile = () => {
22
61
  if (mobileLoadPending || mobileLoadSettled) return;
23
62
  mobileLoadPending = true;
@@ -43,8 +82,9 @@ function ContextualSidebar(props) {
43
82
  const mount = mobileMount();
44
83
  return mount?.connected && mount.element.isConnected ? mount.element : void 0;
45
84
  };
85
+ const responsiveMode = createMemo(() => props.responsiveMode ?? "auto");
46
86
  createEffect(() => {
47
- const mode = props.responsiveMode ?? "auto";
87
+ const mode = responsiveMode();
48
88
  const wasMobile = untrack(isMobile);
49
89
  let media;
50
90
  let viewportListener;
@@ -53,29 +93,22 @@ function ContextualSidebar(props) {
53
93
  mobileLoadPending = false;
54
94
  if (media && viewportListener) media.removeEventListener("change", viewportListener);
55
95
  });
56
- if (mode === "desktop") setIsMobile(false);
96
+ if (mode === "desktop") transition(false, false);
57
97
  else if (mode === "mobile") {
58
- if (responsiveModeInitialized ? !wasMobile && untrack(() => props.open) : untrack(() => props.wideViewportAtLoad && props.open)) untrack(() => props.onOpenChange(false));
59
- loadMobile();
60
- setIsMobile(true);
98
+ const shouldCloseStaleOpen = responsiveModeInitialized ? !wasMobile && untrack(() => props.open) : untrack(() => props.wideViewportAtLoad && props.open);
99
+ transition(true, Boolean(shouldCloseStaleOpen));
61
100
  } else {
62
101
  const mediaQuery = window.matchMedia("(max-width: 48rem)");
63
102
  media = mediaQuery;
64
103
  const updateViewport = () => {
65
104
  const nextIsMobile = mediaQuery.matches;
66
105
  const wasNarrow = untrack(isMobile);
67
- if (nextIsMobile) loadMobile();
68
- if (nextIsMobile && !wasNarrow) props.onOpenChange(false);
69
- setIsMobile(nextIsMobile);
106
+ transition(nextIsMobile, nextIsMobile && !wasNarrow);
70
107
  };
71
108
  viewportListener = updateViewport;
72
- if (media.matches) {
73
- if (!responsiveModeInitialized && untrack(() => props.wideViewportAtLoad && props.open)) untrack(() => props.onOpenChange(false));
74
- else if (responsiveModeInitialized && !wasMobile) untrack(() => props.onOpenChange(false));
75
- loadMobile();
76
- }
77
- setIsMobile(mediaQuery.matches);
78
- mediaQuery.addEventListener("change", updateViewport);
109
+ const shouldCloseStaleOpen = media.matches && (!responsiveModeInitialized ? untrack(() => props.wideViewportAtLoad && props.open) : !wasMobile);
110
+ transition(media.matches, Boolean(shouldCloseStaleOpen));
111
+ if (!disposed) mediaQuery.addEventListener("change", updateViewport);
79
112
  }
80
113
  responsiveModeInitialized = true;
81
114
  });
@@ -88,6 +121,7 @@ function ContextualSidebar(props) {
88
121
  const navigationId = `${id}-${mobile ? "mobile" : "desktop"}`;
89
122
  onCleanup(() => {
90
123
  if (mobile && mobileMount()?.element === element) setMobileMount(void 0);
124
+ if (!mobile && desktopSidebar === element) desktopSidebar = void 0;
91
125
  element = void 0;
92
126
  props.onSidebarElement?.(void 0, mobile);
93
127
  });
@@ -109,6 +143,7 @@ function ContextualSidebar(props) {
109
143
  },
110
144
  ref: (node) => {
111
145
  element = node;
146
+ if (!mobile) desktopSidebar = node;
112
147
  if (mobile) {
113
148
  setMobileMount({
114
149
  element: node,
@@ -1 +1 @@
1
- {"version":3,"file":"contextual-sidebar.js","names":["Accessor","JSX","Show","createEffect","createSignal","createUniqueId","onCleanup","untrack","cn","SidebarNav","SidebarNavContent","SidebarNavFooter","SidebarNavHeader","SidebarNavTitle","PixelResizeHandle","MobileModule","MobileLoad","error","ContextualSidebarRenderContext","mobile","portalMount","HTMLElement","ContextualSidebarProps","id","label","title","titleVisibility","open","onOpenChange","responsiveMode","width","minimum","maximum","step","wideViewportAtLoad","resizeLabel","resizeGrip","restoreFocusRef","onSidebarElement","element","sidebarClass","sheetClass","headerClass","contentClass","footerClass","headingAs","header","context","Element","content","footer","onWidthChange","onWidthCommit","ContextualSidebar","props","isMobile","setIsMobile","mobileLoad","setMobileLoad","mobileLoadGeneration","mobileLoadPending","mobileLoadSettled","responsiveModeInitialized","loadMobile","generation","then","module","mobileMount","setMobileMount","connected","mount","isConnected","undefined","mode","wasMobile","media","MediaQueryList","viewportListener","removeEventListener","shouldCloseStaleOpen","mediaQuery","window","matchMedia","updateViewport","nextIsMobile","matches","wasNarrow","addEventListener","renderSidebar","navigationId","_$createComponent","as","aria-label","aria-hidden","inert","data-open","String","ref","node","queueMicrotask","class","children","when","side","value","grip","controls","onChange","onCommit","fallback","_$memo","_wide","keyed","loaded","MobileSidebar","_$createComponent","_$memo"],"sources":["../../../../src/components/layout/contextual-sidebar/contextual-sidebar.tsx"],"sourcesContent":["import type { Accessor, JSX } from 'solid-js'\nimport { Show, createEffect, createSignal, createUniqueId, onCleanup, untrack } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport {\n SidebarNav,\n SidebarNavContent,\n SidebarNavFooter,\n SidebarNavHeader,\n SidebarNavTitle,\n} from '../sidebar-nav/sidebar-nav'\nimport { PixelResizeHandle } from '../pixel-resize-handle/pixel-resize-handle'\n\ntype MobileModule = typeof import('./mobile-contextual-sidebar')\ntype MobileLoad = MobileModule | { error: unknown }\n\nexport type ContextualSidebarRenderContext = {\n /** Whether the slot is being rendered inside the modal mobile sheet. */\n mobile: boolean\n /** Mount nested popovers and menus inside the mobile dialog's accessibility tree. */\n portalMount(): HTMLElement | undefined\n}\n\nexport type ContextualSidebarProps = {\n /** Stable host id prefix; generated when omitted. */\n id?: string\n /** Landmark name shared by the desktop and mobile navigation. */\n label: string\n /** Visible navigation title and mobile dialog title. */\n title: string\n /**\n * Where the title row shows. `always` (default) draws it on desktop and in\n * the mobile sheet; `mobile` keeps the desktop title for assistive\n * technology only and drops the desktop row, for hosts whose top bar\n * already names the context. A `header` slot keeps the row visible.\n */\n titleVisibility?: 'always' | 'mobile'\n /** Host-controlled expanded state for the desktop panel and mobile dialog. */\n open: boolean\n onOpenChange(open: boolean): void\n /**\n * Presentation mode. `auto` (default) uses the built-in viewport breakpoint;\n * hosts can select `desktop` or the shared mobile `Sheet` themselves.\n */\n responsiveMode?: 'auto' | 'desktop' | 'mobile'\n /** Current host-owned pixel width, reflected by the resize handle. */\n width: number\n minimum: number\n maximum: number\n step?: number\n /** Pass the host's initial viewport seed to distinguish stale desktop state. */\n wideViewportAtLoad?: boolean\n resizeLabel?: string\n /**\n * The resize edge's grip: the quieter rung by default, or the bordered chip\n * for hosts that want the heavier affordance.\n */\n resizeGrip?: 'chip' | 'rung'\n /** Stable external opener used when the modal mobile sheet closes. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n /** Called with the nav node so a host can project width onto its layout root. */\n onSidebarElement?: (element: HTMLElement | undefined, mobile: boolean) => void\n /** Host-owned layout classes applied to both nav instances. */\n sidebarClass?: string\n /** Host-owned responsive constraints for the modal sheet. */\n sheetClass?: string\n headerClass?: string\n contentClass?: string\n footerClass?: string\n headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n /** Optional action/content slot alongside the shared heading. */\n header?(context: ContextualSidebarRenderContext): JSX.Element\n /** View-specific navigation rows, projects, rooms, files, or sessions. */\n content(context: ContextualSidebarRenderContext): JSX.Element\n /** Optional view-specific footer, such as an archive affordance. */\n footer?(context: ContextualSidebarRenderContext): JSX.Element\n onWidthChange(width: number): void\n onWidthCommit?(width: number): void\n}\n\n/**\n * ContextualSidebar.\n *\n * Shared navigation geometry and interaction policy for an application's\n * contextual sidebar. The host keeps ownership of the actual grid width,\n * persisted preference, open state, and view-specific navigation content.\n */\nexport function ContextualSidebar(props: ContextualSidebarProps) {\n const [isMobile, setIsMobile] = createSignal(false)\n const [mobileLoad, setMobileLoad] = createSignal<MobileLoad>()\n let mobileLoadGeneration = 0\n let mobileLoadPending = false\n let mobileLoadSettled = false\n let responsiveModeInitialized = false\n // Keep the resolved component mounted across viewport changes for Sheet cleanup.\n const loadMobile = () => {\n if (mobileLoadPending || mobileLoadSettled) return\n mobileLoadPending = true\n const generation = ++mobileLoadGeneration\n // Native module caching shares successful loads without keeping a rejected promise.\n void import('./mobile-contextual-sidebar').then(\n (module) => {\n if (generation === mobileLoadGeneration) {\n mobileLoadPending = false\n mobileLoadSettled = true\n setMobileLoad(module)\n }\n },\n (error: unknown) => {\n if (generation === mobileLoadGeneration) {\n mobileLoadPending = false\n mobileLoadSettled = true\n setMobileLoad({ error })\n }\n }\n )\n }\n const [mobileMount, setMobileMount] = createSignal<\n { element: HTMLElement; connected: boolean } | undefined\n >()\n const id = props.id ?? `contextual-sidebar-${createUniqueId()}`\n const resizeLabel = () => props.resizeLabel ?? `Resize ${props.label}`\n const portalMount = () => {\n const mount = mobileMount()\n return mount?.connected && mount.element.isConnected ? mount.element : undefined\n }\n\n createEffect(() => {\n const mode = props.responsiveMode ?? 'auto'\n const wasMobile = untrack(isMobile)\n let media: MediaQueryList | undefined\n let viewportListener: (() => void) | undefined\n\n onCleanup(() => {\n mobileLoadGeneration += 1\n mobileLoadPending = false\n if (media && viewportListener) media.removeEventListener('change', viewportListener)\n })\n\n if (mode === 'desktop') {\n setIsMobile(false)\n } else if (mode === 'mobile') {\n // An explicit host transition into mobile must not briefly open a Sheet\n // with stale desktop-expanded state. An initial wide-loaded seed still\n // marks an open value as stale, including in host-selected mobile mode.\n const shouldCloseStaleOpen = responsiveModeInitialized\n ? !wasMobile && untrack(() => props.open)\n : untrack(() => props.wideViewportAtLoad && props.open)\n if (shouldCloseStaleOpen) untrack(() => props.onOpenChange(false))\n loadMobile()\n setIsMobile(true)\n } else {\n const mediaQuery = window.matchMedia('(max-width: 48rem)')\n media = mediaQuery\n const updateViewport = () => {\n const nextIsMobile = mediaQuery.matches\n const wasNarrow = untrack(isMobile)\n if (nextIsMobile) loadMobile()\n // Close before mounting a modal. A desktop-expanded host state is not\n // mobile intent, and opening the Sheet for one frame can steal focus.\n if (nextIsMobile && !wasNarrow) props.onOpenChange(false)\n setIsMobile(nextIsMobile)\n }\n viewportListener = updateViewport\n\n // Preserve a narrow-boot open intent. Initial auto and mobile modes use\n // the viewport seed to clear stale state; runtime transitions close it.\n if (media.matches) {\n if (!responsiveModeInitialized && untrack(() => props.wideViewportAtLoad && props.open)) {\n untrack(() => props.onOpenChange(false))\n } else if (responsiveModeInitialized && !wasMobile) {\n untrack(() => props.onOpenChange(false))\n }\n loadMobile()\n }\n setIsMobile(mediaQuery.matches)\n mediaQuery.addEventListener('change', updateViewport)\n }\n\n responsiveModeInitialized = true\n })\n\n const renderSidebar = (mobile: boolean) => {\n let element: HTMLElement | undefined\n const context: ContextualSidebarRenderContext = {\n mobile,\n portalMount: () => (mobile ? portalMount() : undefined),\n }\n const navigationId = `${id}-${mobile ? 'mobile' : 'desktop'}`\n\n onCleanup(() => {\n if (mobile && mobileMount()?.element === element) setMobileMount(undefined)\n element = undefined\n props.onSidebarElement?.(undefined, mobile)\n })\n\n return (\n <SidebarNav\n as=\"aside\"\n id={navigationId}\n aria-label={props.label}\n aria-hidden={!mobile && !props.open ? 'true' : undefined}\n inert={!mobile && !props.open}\n data-contextual-sidebar={mobile ? 'mobile' : 'desktop'}\n data-open={mobile ? undefined : String(props.open)}\n ref={(node) => {\n element = node\n if (mobile) {\n setMobileMount({ element: node, connected: node.isConnected })\n queueMicrotask(() => {\n if (node.isConnected && mobileMount()?.element === node)\n setMobileMount({ element: node, connected: true })\n })\n }\n props.onSidebarElement?.(node, mobile)\n }}\n class={cn('relative h-full w-full max-w-full', props.sidebarClass)}\n >\n <Show when={!mobile && props.open}>\n <PixelResizeHandle\n // The ruler spans the sidebar as a pointer-events-none overlay; lift\n // it above the neighbouring pane so the edge stays grabbable.\n class=\"z-(--z-docked)\"\n side=\"left\"\n value={props.width}\n minimum={props.minimum}\n maximum={props.maximum}\n step={props.step}\n label={resizeLabel()}\n grip={props.resizeGrip ?? 'rung'}\n controls={navigationId}\n onChange={props.onWidthChange}\n onCommit={props.onWidthCommit}\n />\n </Show>\n <Show when={!mobile || mobileMount()?.connected}>\n <Show\n when={mobile || props.titleVisibility !== 'mobile' || props.header}\n fallback={\n <SidebarNavTitle as={props.headingAs ?? 'h2'} class=\"sr-only\">\n {props.title}\n </SidebarNavTitle>\n }\n >\n <SidebarNavHeader class={cn(mobile && 'pe-12', props.headerClass)}>\n <SidebarNavTitle as={props.headingAs ?? 'h2'}>{props.title}</SidebarNavTitle>\n {props.header?.(context)}\n </SidebarNavHeader>\n </Show>\n <SidebarNavContent class={props.contentClass}>{props.content(context)}</SidebarNavContent>\n {props.footer ? (\n <SidebarNavFooter class={props.footerClass}>{props.footer(context)}</SidebarNavFooter>\n ) : null}\n </Show>\n </SidebarNav>\n )\n }\n\n return (\n <>\n <Show when={!isMobile()}>{(_wide) => renderSidebar(false)}</Show>\n <Show when={mobileLoad()} keyed>\n {(loaded) => {\n if ('error' in loaded) throw loaded.error\n return (\n <loaded.MobileSidebar\n open={isMobile() && props.open}\n onOpenChange={props.onOpenChange}\n label={props.label}\n sheetClass={props.sheetClass}\n restoreFocusRef={props.restoreFocusRef}\n renderSidebar={() => renderSidebar(true)}\n />\n )\n }}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAsFA,SAAgBqD,kBAAkBC,OAA+B;CAC/D,MAAM,CAACC,UAAUC,eAAepD,aAAa,KAAK;CAClD,MAAM,CAACqD,YAAYC,iBAAiBtD,aAAyB;CAC7D,IAAIuD,uBAAuB;CAC3B,IAAIC,oBAAoB;CACxB,IAAIC,oBAAoB;CACxB,IAAIC,4BAA4B;CAEhC,MAAMC,mBAAmB;EACvB,IAAIH,qBAAqBC,mBAAmB;EAC5CD,oBAAoB;EACpB,MAAMI,aAAa,EAAEL;EAErB,OAAY,iCAA8B,CAACM,MACxCC,WAAW;GACV,IAAIF,eAAeL,sBAAsB;IACvCC,oBAAoB;IACpBC,oBAAoB;IACpBH,cAAcQ,MAAM;GACtB;EACF,IACCjD,UAAmB;GAClB,IAAI+C,eAAeL,sBAAsB;IACvCC,oBAAoB;IACpBC,oBAAoB;IACpBH,cAAc,EAAEzC,MAAM,CAAC;GACzB;EACF,CACF;CACF;CACA,MAAM,CAACkD,aAAaC,kBAAkBhE,aAEpC;CACF,MAAMmB,KAAK+B,MAAM/B,MAAM,sBAAsBlB,eAAe;CAC5D,MAAM8B,oBAAoBmB,MAAMnB,eAAe,UAAUmB,MAAM9B;CAC/D,MAAMJ,oBAAoB;EACxB,MAAMkD,QAAQH,YAAY;EAC1B,OAAOG,OAAOD,aAAaC,MAAM/B,QAAQgC,cAAcD,MAAM/B,UAAUiC,KAAAA;CACzE;CAEArE,mBAAmB;EACjB,MAAMsE,OAAOnB,MAAMzB,kBAAkB;EACrC,MAAM6C,YAAYnE,QAAQgD,QAAQ;EAClC,IAAIoB;EACJ,IAAIE;EAEJvE,gBAAgB;GACdqD,wBAAwB;GACxBC,oBAAoB;GACpB,IAAIe,SAASE,kBAAkBF,MAAMG,oBAAoB,UAAUD,gBAAgB;EACrF,CAAC;EAED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AAW;QAAA,IAAAyD,WAAA;SAAA,OAAG/C,MAAMJ,OAAOH,OAAO;QAAC;OAAA,CAAA,IAChE,IAAI;MAAA;KAAA;IAAA,CAAA,CAAA;GAAA;EAAA,CAAA;CAIhB;CAEA,OAAA,CAAA2C,gBAEKxF,MAAI;EAAA,IAACoG,OAAI;GAAA,OAAE,CAAC/C,SAAS;EAAC;EAAA8C,WAAIU,UAAUvB,cAAc,KAAK;CAAC,CAAA,GAAAE,gBACxDxF,MAAI;EAAA,IAACoG,OAAI;GAAA,OAAE7C,WAAW;EAAC;EAAEuD,OAAK;EAAAX,WAC3BY,WAAW;GACX,IAAI,WAAWA,QAAQ,MAAMA,OAAOhG;GACpC,OAAAyE,gBACGuB,OAAOC,eAAa;IAAA,IACnBvF,OAAI;KAAA,OAAEmF,WAAA,CAAA,CAAAvD,SAAS,CAAC,CAAA,CAAA,KAAID,MAAM3B;IAAI;IAAA,IAC9BC,eAAY;KAAA,OAAE0B,MAAM1B;IAAY;IAAA,IAChCJ,QAAK;KAAA,OAAE8B,MAAM9B;IAAK;IAAA,IAClBiB,aAAU;KAAA,OAAEa,MAAMb;IAAU;IAAA,IAC5BJ,kBAAe;KAAA,OAAEiB,MAAMjB;IAAe;IACtCmD,qBAAqBA,cAAc,IAAI;GAAC,CAAA;EAG9C;CAAC,CAAA,CAAA;AAIT"}
1
+ {"version":3,"file":"contextual-sidebar.js","names":["Accessor","JSX","Show","createEffect","createMemo","createSignal","createUniqueId","onCleanup","untrack","cn","SidebarNav","SidebarNavContent","SidebarNavFooter","SidebarNavHeader","SidebarNavTitle","PixelResizeHandle","MobileModule","MobileLoad","error","ContextualSidebarRenderContext","mobile","portalMount","HTMLElement","ContextualSidebarModeTransition","phase","from","to","desktopSidebar","ContextualSidebarProps","id","label","title","titleVisibility","open","onOpenChange","responsiveMode","onResponsiveModeTransition","event","width","minimum","maximum","step","wideViewportAtLoad","resizeLabel","resizeGrip","restoreFocusRef","onSidebarElement","element","sidebarClass","sheetClass","headerClass","contentClass","footerClass","headingAs","header","context","Element","content","footer","onWidthChange","onWidthCommit","ContextualSidebar","props","isMobile","setIsMobile","mobileLoad","setMobileLoad","mobileLoadGeneration","mobileLoadPending","mobileLoadSettled","responsiveModeInitialized","transitionGeneration","pendingMode","disposed","transition","next","closeStaleOpen","previous","changed","generation","undefined","const","loadMobile","queueMicrotask","then","module","mobileMount","setMobileMount","connected","mount","isConnected","mode","wasMobile","media","MediaQueryList","viewportListener","removeEventListener","shouldCloseStaleOpen","Boolean","mediaQuery","window","matchMedia","updateViewport","nextIsMobile","matches","wasNarrow","addEventListener","renderSidebar","navigationId","_$createComponent","as","aria-label","aria-hidden","inert","data-open","String","ref","node","class","children","when","side","value","grip","controls","onChange","onCommit","fallback","_$memo","_wide","keyed","loaded","MobileSidebar","_$createComponent","_$memo"],"sources":["../../../../src/components/layout/contextual-sidebar/contextual-sidebar.tsx"],"sourcesContent":["import type { Accessor, JSX } from 'solid-js'\nimport {\n Show,\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n onCleanup,\n untrack,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport {\n SidebarNav,\n SidebarNavContent,\n SidebarNavFooter,\n SidebarNavHeader,\n SidebarNavTitle,\n} from '../sidebar-nav/sidebar-nav'\nimport { PixelResizeHandle } from '../pixel-resize-handle/pixel-resize-handle'\n\ntype MobileModule = typeof import('./mobile-contextual-sidebar')\ntype MobileLoad = MobileModule | { error: unknown }\n\nexport type ContextualSidebarRenderContext = {\n /** Whether the slot is being rendered inside the modal mobile sheet. */\n mobile: boolean\n /** Mount nested popovers and menus inside the mobile dialog's accessibility tree. */\n portalMount(): HTMLElement | undefined\n}\n\nexport type ContextualSidebarModeTransition = {\n phase: 'before' | 'after'\n from: 'desktop' | 'mobile'\n to: 'desktop' | 'mobile'\n desktopSidebar: HTMLElement | undefined\n}\n\nexport type ContextualSidebarProps = {\n /** Stable host id prefix; generated when omitted. */\n id?: string\n /** Landmark name shared by the desktop and mobile navigation. */\n label: string\n /** Visible navigation title and mobile dialog title. */\n title: string\n /**\n * Where the title row shows. `always` (default) draws it on desktop and in\n * the mobile sheet; `mobile` keeps the desktop title for assistive\n * technology only and drops the desktop row, for hosts whose top bar\n * already names the context. A `header` slot keeps the row visible.\n */\n titleVisibility?: 'always' | 'mobile'\n /** Host-controlled expanded state for the desktop panel and mobile dialog. */\n open: boolean\n onOpenChange(open: boolean): void\n /**\n * Presentation mode. `auto` (default) uses the built-in viewport breakpoint;\n * hosts can select `desktop` or the shared mobile `Sheet` themselves.\n */\n responsiveMode?: 'auto' | 'desktop' | 'mobile'\n /**\n * Coordinate host layout before a runtime mode change and after its DOM settles.\n * A superseded transition or unmounted sidebar does not emit an after phase.\n * Initial mode resolution does not emit either phase.\n */\n onResponsiveModeTransition?(event: ContextualSidebarModeTransition): void\n /** Current host-owned pixel width, reflected by the resize handle. */\n width: number\n minimum: number\n maximum: number\n step?: number\n /** Pass the host's initial viewport seed to distinguish stale desktop state. */\n wideViewportAtLoad?: boolean\n resizeLabel?: string\n /**\n * The resize edge's grip: the quieter rung by default, or the bordered chip\n * for hosts that want the heavier affordance.\n */\n resizeGrip?: 'chip' | 'rung'\n /** Stable external opener used when the modal mobile sheet closes. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n /** Called with the nav node so a host can project width onto its layout root. */\n onSidebarElement?: (element: HTMLElement | undefined, mobile: boolean) => void\n /** Host-owned layout classes applied to both nav instances. */\n sidebarClass?: string\n /** Host-owned responsive constraints for the modal sheet. */\n sheetClass?: string\n headerClass?: string\n contentClass?: string\n footerClass?: string\n headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n /** Optional action/content slot alongside the shared heading. */\n header?(context: ContextualSidebarRenderContext): JSX.Element\n /** View-specific navigation rows, projects, rooms, files, or sessions. */\n content(context: ContextualSidebarRenderContext): JSX.Element\n /** Optional view-specific footer, such as an archive affordance. */\n footer?(context: ContextualSidebarRenderContext): JSX.Element\n onWidthChange(width: number): void\n onWidthCommit?(width: number): void\n}\n\n/**\n * ContextualSidebar.\n *\n * Shared navigation geometry and interaction policy for an application's\n * contextual sidebar. The host keeps ownership of the actual grid width,\n * persisted preference, open state, and view-specific navigation content.\n */\nexport function ContextualSidebar(props: ContextualSidebarProps) {\n const [isMobile, setIsMobile] = createSignal(false)\n const [mobileLoad, setMobileLoad] = createSignal<MobileLoad>()\n let mobileLoadGeneration = 0\n let mobileLoadPending = false\n let mobileLoadSettled = false\n let responsiveModeInitialized = false\n let desktopSidebar: HTMLElement | undefined\n let transitionGeneration = 0\n let pendingMode: boolean | undefined\n let disposed = false\n onCleanup(() => {\n disposed = true\n transitionGeneration += 1\n })\n\n const transition = (next: boolean, closeStaleOpen: boolean) => {\n // The host may synchronously update its props from either callback, which\n // re-enters the responsive effect before this transition has finished.\n if (pendingMode === next) return\n const previous = untrack(isMobile)\n const changed = responsiveModeInitialized && previous !== next\n const generation =\n changed || pendingMode !== undefined ? ++transitionGeneration : transitionGeneration\n pendingMode = next\n const event = {\n from: previous ? ('mobile' as const) : ('desktop' as const),\n to: next ? ('mobile' as const) : ('desktop' as const),\n desktopSidebar,\n }\n try {\n if (changed) untrack(() => props.onResponsiveModeTransition?.({ ...event, phase: 'before' }))\n if (disposed || generation !== transitionGeneration) return\n if (closeStaleOpen) untrack(() => props.onOpenChange(false))\n if (disposed || generation !== transitionGeneration) return\n if (next) loadMobile()\n setIsMobile(next)\n if (changed) {\n queueMicrotask(() => {\n if (!disposed && generation === transitionGeneration && untrack(isMobile) === next)\n untrack(() => props.onResponsiveModeTransition?.({ ...event, phase: 'after' }))\n })\n }\n } finally {\n if (generation === transitionGeneration) pendingMode = undefined\n }\n }\n // Keep the resolved component mounted across viewport changes for Sheet cleanup.\n const loadMobile = () => {\n if (mobileLoadPending || mobileLoadSettled) return\n mobileLoadPending = true\n const generation = ++mobileLoadGeneration\n // Native module caching shares successful loads without keeping a rejected promise.\n void import('./mobile-contextual-sidebar').then(\n (module) => {\n if (generation === mobileLoadGeneration) {\n mobileLoadPending = false\n mobileLoadSettled = true\n setMobileLoad(module)\n }\n },\n (error: unknown) => {\n if (generation === mobileLoadGeneration) {\n mobileLoadPending = false\n mobileLoadSettled = true\n setMobileLoad({ error })\n }\n }\n )\n }\n const [mobileMount, setMobileMount] = createSignal<\n { element: HTMLElement; connected: boolean } | undefined\n >()\n const id = props.id ?? `contextual-sidebar-${createUniqueId()}`\n const resizeLabel = () => props.resizeLabel ?? `Resize ${props.label}`\n const portalMount = () => {\n const mount = mobileMount()\n return mount?.connected && mount.element.isConnected ? mount.element : undefined\n }\n\n const responsiveMode = createMemo(() => props.responsiveMode ?? 'auto')\n createEffect(() => {\n const mode = responsiveMode()\n const wasMobile = untrack(isMobile)\n let media: MediaQueryList | undefined\n let viewportListener: (() => void) | undefined\n\n onCleanup(() => {\n mobileLoadGeneration += 1\n mobileLoadPending = false\n if (media && viewportListener) media.removeEventListener('change', viewportListener)\n })\n\n if (mode === 'desktop') {\n transition(false, false)\n } else if (mode === 'mobile') {\n // An explicit host transition into mobile must not briefly open a Sheet\n // with stale desktop-expanded state. An initial wide-loaded seed still\n // marks an open value as stale, including in host-selected mobile mode.\n const shouldCloseStaleOpen = responsiveModeInitialized\n ? !wasMobile && untrack(() => props.open)\n : untrack(() => props.wideViewportAtLoad && props.open)\n transition(true, Boolean(shouldCloseStaleOpen))\n } else {\n const mediaQuery = window.matchMedia('(max-width: 48rem)')\n media = mediaQuery\n const updateViewport = () => {\n const nextIsMobile = mediaQuery.matches\n const wasNarrow = untrack(isMobile)\n // Close before mounting a modal. A desktop-expanded host state is not\n // mobile intent, and opening the Sheet for one frame can steal focus.\n transition(nextIsMobile, nextIsMobile && !wasNarrow)\n }\n viewportListener = updateViewport\n\n // Preserve a narrow-boot open intent. Initial auto and mobile modes use\n // the viewport seed to clear stale state; runtime transitions close it.\n const shouldCloseStaleOpen =\n media.matches &&\n (!responsiveModeInitialized\n ? untrack(() => props.wideViewportAtLoad && props.open)\n : !wasMobile)\n transition(media.matches, Boolean(shouldCloseStaleOpen))\n if (!disposed) mediaQuery.addEventListener('change', updateViewport)\n }\n\n responsiveModeInitialized = true\n })\n\n const renderSidebar = (mobile: boolean) => {\n let element: HTMLElement | undefined\n const context: ContextualSidebarRenderContext = {\n mobile,\n portalMount: () => (mobile ? portalMount() : undefined),\n }\n const navigationId = `${id}-${mobile ? 'mobile' : 'desktop'}`\n\n onCleanup(() => {\n if (mobile && mobileMount()?.element === element) setMobileMount(undefined)\n if (!mobile && desktopSidebar === element) desktopSidebar = undefined\n element = undefined\n props.onSidebarElement?.(undefined, mobile)\n })\n\n return (\n <SidebarNav\n as=\"aside\"\n id={navigationId}\n aria-label={props.label}\n aria-hidden={!mobile && !props.open ? 'true' : undefined}\n inert={!mobile && !props.open}\n data-contextual-sidebar={mobile ? 'mobile' : 'desktop'}\n data-open={mobile ? undefined : String(props.open)}\n ref={(node) => {\n element = node\n if (!mobile) desktopSidebar = node\n if (mobile) {\n setMobileMount({ element: node, connected: node.isConnected })\n queueMicrotask(() => {\n if (node.isConnected && mobileMount()?.element === node)\n setMobileMount({ element: node, connected: true })\n })\n }\n props.onSidebarElement?.(node, mobile)\n }}\n class={cn('relative h-full w-full max-w-full', props.sidebarClass)}\n >\n <Show when={!mobile && props.open}>\n <PixelResizeHandle\n // The ruler spans the sidebar as a pointer-events-none overlay; lift\n // it above the neighbouring pane so the edge stays grabbable.\n class=\"z-(--z-docked)\"\n side=\"left\"\n value={props.width}\n minimum={props.minimum}\n maximum={props.maximum}\n step={props.step}\n label={resizeLabel()}\n grip={props.resizeGrip ?? 'rung'}\n controls={navigationId}\n onChange={props.onWidthChange}\n onCommit={props.onWidthCommit}\n />\n </Show>\n <Show when={!mobile || mobileMount()?.connected}>\n <Show\n when={mobile || props.titleVisibility !== 'mobile' || props.header}\n fallback={\n <SidebarNavTitle as={props.headingAs ?? 'h2'} class=\"sr-only\">\n {props.title}\n </SidebarNavTitle>\n }\n >\n <SidebarNavHeader class={cn(mobile && 'pe-12', props.headerClass)}>\n <SidebarNavTitle as={props.headingAs ?? 'h2'}>{props.title}</SidebarNavTitle>\n {props.header?.(context)}\n </SidebarNavHeader>\n </Show>\n <SidebarNavContent class={props.contentClass}>{props.content(context)}</SidebarNavContent>\n {props.footer ? (\n <SidebarNavFooter class={props.footerClass}>{props.footer(context)}</SidebarNavFooter>\n ) : null}\n </Show>\n </SidebarNav>\n )\n }\n\n return (\n <>\n <Show when={!isMobile()}>{(_wide) => renderSidebar(false)}</Show>\n <Show when={mobileLoad()} keyed>\n {(loaded) => {\n if ('error' in loaded) throw loaded.error\n return (\n <loaded.MobileSidebar\n open={isMobile() && props.open}\n onOpenChange={props.onOpenChange}\n label={props.label}\n sheetClass={props.sheetClass}\n restoreFocusRef={props.restoreFocusRef}\n renderSidebar={() => renderSidebar(true)}\n />\n )\n }}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AA2GA,SAAgB6D,kBAAkBC,OAA+B;CAC/D,MAAM,CAACC,UAAUC,eAAe3D,aAAa,KAAK;CAClD,MAAM,CAAC4D,YAAYC,iBAAiB7D,aAAyB;CAC7D,IAAI8D,uBAAuB;CAC3B,IAAIC,oBAAoB;CACxB,IAAIC,oBAAoB;CACxB,IAAIC,4BAA4B;CAChC,IAAI3C;CACJ,IAAI4C,uBAAuB;CAC3B,IAAIC;CACJ,IAAIC,WAAW;CACflE,gBAAgB;EACdkE,WAAW;EACXF,wBAAwB;CAC1B,CAAC;CAED,MAAMG,cAAcC,MAAeC,mBAA4B;EAG7D,IAAIJ,gBAAgBG,MAAM;EAC1B,MAAME,WAAWrE,QAAQuD,QAAQ;EACjC,MAAMe,UAAUR,6BAA6BO,aAAaF;EAC1D,MAAMI,aACJD,WAAWN,gBAAgBQ,KAAAA,IAAY,EAAET,uBAAuBA;EAClEC,cAAcG;EACd,MAAMtC,QAAQ;GACZZ,MAAMoD,WAAY,WAAsB;GACxCnD,IAAIiD,OAAQ,WAAsB;GAClChD;EACF;EACA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;SAAA,OAAGzD,MAAML,QAAQF,OAAO;QAAC;OAAA,CAAA;OAAAyE,WACpEA,WAAA,CAAA,CAAAlE,MAAMJ,MAAM,CAAA,CAAA,IAAAmD,gBACVjG,kBAAgB;QAAA,KAAA,WAAA;SAAA,OAAQkD,MAAMV;QAAW;QAAA,IAAAmE,WAAA;SAAA,OAAGzD,MAAMJ,OAAOH,OAAO;QAAC;OAAA,CAAA,IAChE,IAAI;MAAA;KAAA;IAAA,CAAA,CAAA;GAAA;EAAA,CAAA;CAIhB;CAEA,OAAA,CAAAsD,gBAEK3G,MAAI;EAAA,IAACsH,OAAI;GAAA,OAAE,CAACzD,SAAS;EAAC;EAAAwD,WAAIU,UAAUtB,cAAc,KAAK;CAAC,CAAA,GAAAE,gBACxD3G,MAAI;EAAA,IAACsH,OAAI;GAAA,OAAEvD,WAAW;EAAC;EAAEiE,OAAK;EAAAX,WAC3BY,WAAW;GACX,IAAI,WAAWA,QAAQ,MAAMA,OAAOjH;GACpC,OAAA2F,gBACGsB,OAAOC,eAAa;IAAA,IACnBnG,OAAI;KAAA,OAAE+F,WAAA,CAAA,CAAAjE,SAAS,CAAC,CAAA,CAAA,KAAID,MAAM7B;IAAI;IAAA,IAC9BC,eAAY;KAAA,OAAE4B,MAAM5B;IAAY;IAAA,IAChCJ,QAAK;KAAA,OAAEgC,MAAMhC;IAAK;IAAA,IAClBmB,aAAU;KAAA,OAAEa,MAAMb;IAAU;IAAA,IAC5BJ,kBAAe;KAAA,OAAEiB,MAAMjB;IAAe;IACtC8D,qBAAqBA,cAAc,IAAI;GAAC,CAAA;EAG9C;CAAC,CAAA,CAAA;AAIT"}
@@ -1,3 +1,3 @@
1
- export { ContextualSidebar, type ContextualSidebarProps, type ContextualSidebarRenderContext, } from './contextual-sidebar';
1
+ export { ContextualSidebar, type ContextualSidebarProps, type ContextualSidebarRenderContext, type ContextualSidebarModeTransition, } from './contextual-sidebar';
2
2
  export { PixelResizeHandle, type PixelResizeHandleProps } from '../pixel-resize-handle';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/contextual-sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,GACpC,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/contextual-sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,GACrC,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAA"}
@@ -12,14 +12,15 @@ import type { ComponentProps, JSX } from 'solid-js';
12
12
  *
13
13
  * ## Why the divider tracks the sidebar
14
14
  *
15
- * With the sidebar open the divider lands on the sidebar's trailing edge, so the
16
- * bar reads as the rail and sidebar's header on one side and the content's
17
- * header on the other. The bar spans the rail and the sidebar (they sit under
18
- * it), so the leading half is as wide as `--rail-width` plus the sidebar's width
19
- * less the bar's own start padding. The host publishes the width as
20
- * `--shell-sidebar-width` on an ancestor; the fallback of 17rem matches the
21
- * default sidebar. Below the 48rem breakpoint the sidebar is a drawer and the
22
- * leading half is only as wide as its controls.
15
+ * When the host marks an inline sidebar open, the divider lands on the sidebar's
16
+ * trailing edge, so the bar reads as the rail and sidebar's header on one side
17
+ * and the content's header on the other. The bar spans the rail and the sidebar
18
+ * (they sit under it), so the leading half is as wide as `--rail-width` plus the
19
+ * sidebar's width less the bar's own start padding. The host publishes the width
20
+ * as `--shell-sidebar-width` on an ancestor; the fallback of 17rem matches the
21
+ * default sidebar. The default behavior keeps the leading half with its controls
22
+ * below 48rem. A host that keeps the sidebar inline at narrow widths opts into
23
+ * `alignSidebarAtNarrow` so the divider still tracks it.
23
24
  *
24
25
  * ## Narrow windows
25
26
  *
@@ -44,10 +45,15 @@ export type ShellTopBarProps = Omit<ComponentProps<'header'>, 'children'> & {
44
45
  /** The workspace switcher. */
45
46
  workspace?: JSX.Element;
46
47
  /**
47
- * Whether the sidebar is open at wide widths. Open, the divider aligns with
48
- * the sidebar's edge; closed, the leading half hugs its controls.
48
+ * Whether the sidebar is open. Its width applies at wide widths by default.
49
49
  */
50
50
  sidebarOpen?: boolean;
51
+ /**
52
+ * Also align the open sidebar below the default 48rem breakpoint. Use this
53
+ * when the host keeps the sidebar inline at narrow widths; drawer layouts keep
54
+ * the default controls-only leading half.
55
+ */
56
+ alignSidebarAtNarrow?: boolean;
51
57
  /**
52
58
  * The open sidebar's width in pixels. Published as `--shell-sidebar-width` on
53
59
  * the bar so the divider tracks a resizable sidebar; leave it unset to use an
@@ -1 +1 @@
1
- {"version":3,"file":"shell-top-bar.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/shell-top-bar/shell-top-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAKnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC1E,kEAAkE;IAClE,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACxB,iCAAiC;IACjC,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAC3B,8BAA8B;IAC9B,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iFAAiF;IACjF,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACxB,yBAAyB;IACzB,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACpB,gDAAgD;IAChD,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,qDAAqD;IACrD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,gDAAgD;IAChD,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,eAoHlD"}
1
+ {"version":3,"file":"shell-top-bar.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/shell-top-bar/shell-top-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAKnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC1E,kEAAkE;IAClE,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACxB,iCAAiC;IACjC,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAC3B,8BAA8B;IAC9B,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iFAAiF;IACjF,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACxB,yBAAyB;IACzB,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACpB,gDAAgD;IAChD,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,qDAAqD;IACrD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,gDAAgD;IAChD,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,eAsHlD"}
@@ -18,6 +18,7 @@ function ShellTopBar(props) {
18
18
  "sidebarToggle",
19
19
  "workspace",
20
20
  "sidebarOpen",
21
+ "alignSidebarAtNarrow",
21
22
  "sidebarWidth",
22
23
  "breadcrumb",
23
24
  "search",
@@ -118,7 +119,7 @@ function ShellTopBar(props) {
118
119
  }
119
120
  }), null);
120
121
  effect((_p$) => {
121
- var _v$ = local.sidebarOpen ? "true" : "false", _v$2 = cn("window-no-drag flex min-h-[calc(var(--topbar-height)-1px)] max-w-full min-w-0 shrink-0 flex-wrap items-center gap-x-2 gap-y-1 pe-3", local.sidebarOpen && "md:w-[calc(var(--rail-width)+var(--shell-sidebar-width,17rem)-var(--shell-top-bar-inset))]");
122
+ var _v$ = local.sidebarOpen ? "true" : "false", _v$2 = cn("window-no-drag flex min-h-[calc(var(--topbar-height)-1px)] max-w-full min-w-0 shrink-0 flex-wrap items-center gap-x-2 gap-y-1 pe-3", local.sidebarOpen && (local.alignSidebarAtNarrow ? "w-[calc(var(--rail-width)+var(--shell-sidebar-width,17rem)-var(--shell-top-bar-inset))]" : "md:w-[calc(var(--rail-width)+var(--shell-sidebar-width,17rem)-var(--shell-top-bar-inset))]"));
122
123
  _v$ !== _p$.e && setAttribute(_el$2, "data-sidebar-open", _p$.e = _v$);
123
124
  _v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
124
125
  return _p$;
@@ -1 +1 @@
1
- {"version":3,"file":"shell-top-bar.js","names":["ComponentProps","JSX","children","Show","splitProps","cn","Separator","ShellTopBarProps","Omit","navigation","Element","sidebarToggle","workspace","sidebarOpen","sidebarWidth","breadcrumb","search","actions","draggable","macosInset","windowsInset","glass","ShellTopBar","props","local","rest","_el$","_tmpl$8","_el$2","firstChild","_$spread","_$mergeProps","class","style","_$memo","undefined","_$insert","_$createComponent","when","_el$3","_tmpl$","_el$4","_tmpl$2","_el$5","_tmpl$3","orientation","_el$6","_tmpl$4","_tmpl$5","_el$8","_tmpl$6","_el$9","_tmpl$7","_$effect","_p$","_v$","_v$2","e","_$setAttribute","t","_$className","_$mergeProps","_$memo","_$createComponent","_$setAttribute","_$className"],"sources":["../../../../src/components/layout/shell-top-bar/shell-top-bar.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { children, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Separator } from '../../ui/separator'\n\n/**\n * ShellTopBar.\n *\n * The window's top bar as both applications draw it. It has two halves with a\n * vertical divider between them:\n *\n * - **Leading**: history arrows, the sidebar toggle and the workspace\n * switcher, in that order. This is the part that belongs to the window.\n * - **Content**: breadcrumbs, search and the view's actions. This is the part\n * that belongs to the view, and it always sits to the right of the divider.\n *\n * ## Why the divider tracks the sidebar\n *\n * With the sidebar open the divider lands on the sidebar's trailing edge, so the\n * bar reads as the rail and sidebar's header on one side and the content's\n * header on the other. The bar spans the rail and the sidebar (they sit under\n * it), so the leading half is as wide as `--rail-width` plus the sidebar's width\n * less the bar's own start padding. The host publishes the width as\n * `--shell-sidebar-width` on an ancestor; the fallback of 17rem matches the\n * default sidebar. Below the 48rem breakpoint the sidebar is a drawer and the\n * leading half is only as wide as its controls.\n *\n * ## Narrow windows\n *\n * The bar is its own container. Below 34rem the search drops to a row of its\n * own so the leading controls, the breadcrumb and the actions keep their room;\n * the breadcrumb is the first thing to truncate.\n *\n * The bar never spills past its window. When the leading controls are wider than\n * the window (a 320px viewport at 200% text), they wrap onto a second row inside\n * the leading half instead of being cut off or pushing the page sideways, and\n * the actions are capped to the bar and scroll if they are still too wide.\n *\n * On a frameless desktop window the bar is the drag region (`draggable`) and\n * every control opts back out; `macosInset` and `windowsInset` reserve the\n * native window controls.\n */\nexport type ShellTopBarProps = Omit<ComponentProps<'header'>, 'children'> & {\n /** History arrows. Rendered first, left of the sidebar toggle. */\n navigation?: JSX.Element\n /** The sidebar toggle button. */\n sidebarToggle?: JSX.Element\n /** The workspace switcher. */\n workspace?: JSX.Element\n /**\n * Whether the sidebar is open at wide widths. Open, the divider aligns with\n * the sidebar's edge; closed, the leading half hugs its controls.\n */\n sidebarOpen?: boolean\n /**\n * The open sidebar's width in pixels. Published as `--shell-sidebar-width` on\n * the bar so the divider tracks a resizable sidebar; leave it unset to use an\n * ancestor's variable or the 17rem default.\n */\n sidebarWidth?: number\n /** Breadcrumbs or the view's title. Takes the free space and truncates first. */\n breadcrumb?: JSX.Element\n /** The view's search. */\n search?: JSX.Element\n /** The view's actions, at the trailing edge. */\n actions?: JSX.Element\n /** Make the bar a drag region, for a frameless window. */\n draggable?: boolean\n /** Reserve space for the macOS traffic lights. */\n macosInset?: boolean\n /** Reserve space for the Windows caption buttons. */\n windowsInset?: boolean\n /** Blur the content scrolling under the bar. */\n glass?: boolean\n}\n\nexport function ShellTopBar(props: ShellTopBarProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'navigation',\n 'sidebarToggle',\n 'workspace',\n 'sidebarOpen',\n 'sidebarWidth',\n 'breadcrumb',\n 'search',\n 'actions',\n 'draggable',\n 'macosInset',\n 'windowsInset',\n 'glass',\n ])\n\n // Resolve each slot once: a JSX prop is a getter that builds its elements on\n // every read, so testing it with `Show` and then rendering it would build\n // (and run the refs of) two copies.\n const navigation = children(() => local.navigation)\n const sidebarToggle = children(() => local.sidebarToggle)\n const workspace = children(() => local.workspace)\n const breadcrumb = children(() => local.breadcrumb)\n const search = children(() => local.search)\n const actions = children(() => local.actions)\n\n return (\n <header\n data-slot=\"shell-top-bar\"\n class={cn(\n /* Rows are one pixel short of the top bar height so the bottom border keeps\n the bar at exactly --topbar-height, like the shared TopBar: docked\n panels and sidebar headers measure from that edge. */\n '@container/shell-top-bar relative z-(--z-sticky) flex min-h-topbar shrink-0 flex-wrap items-center border-b border-border bg-card text-card-foreground',\n local.glass && 'glass-panel',\n local.draggable && 'window-drag',\n /* Each edge gets exactly one inline-padding utility, for the reason the\n shared TopBar documents: two would tie-break by build order. The inset\n is also published as a variable so the leading half can subtract it. */\n local.macosInset\n ? 'window-inset-macos [--shell-top-bar-inset:84px]'\n : 'ps-3 [--shell-top-bar-inset:0.75rem]',\n local.windowsInset ? 'window-inset-windows' : 'pe-3',\n local.class\n )}\n style={\n local.sidebarWidth === undefined\n ? undefined\n : { '--shell-sidebar-width': `${local.sidebarWidth}px` }\n }\n {...rest}\n >\n <div\n data-slot=\"shell-top-bar-leading\"\n data-sidebar-open={local.sidebarOpen ? 'true' : 'false'}\n class={cn(\n 'window-no-drag flex min-h-[calc(var(--topbar-height)-1px)] max-w-full min-w-0 shrink-0 flex-wrap items-center gap-x-2 gap-y-1 pe-3',\n /* Wide and open: span the rail and the sidebar so the divider lands on\n the sidebar's edge. The sidebar's own border is the 1px the divider\n overlaps, so no extra allowance is needed. */\n local.sidebarOpen &&\n 'md:w-[calc(var(--rail-width)+var(--shell-sidebar-width,17rem)-var(--shell-top-bar-inset))]'\n )}\n >\n <Show when={navigation()}>\n <div data-slot=\"shell-top-bar-navigation\" class=\"flex shrink-0 items-center gap-2\">\n {navigation()}\n </div>\n </Show>\n <Show when={sidebarToggle()}>\n <div data-slot=\"shell-top-bar-toggle\" class=\"flex shrink-0 items-center\">\n {sidebarToggle()}\n </div>\n </Show>\n <Show when={workspace()}>\n <div data-slot=\"shell-top-bar-workspace\" class=\"flex min-w-0 items-center\">\n {workspace()}\n </div>\n </Show>\n </div>\n <Separator\n orientation=\"vertical\"\n data-slot=\"shell-top-bar-divider\"\n aria-hidden=\"true\"\n class=\"data-[orientation=vertical]:h-5\"\n />\n <Show when={breadcrumb()}>\n <div\n data-slot=\"shell-top-bar-breadcrumb\"\n class=\"window-no-drag flex h-[calc(var(--topbar-height)-1px)] min-w-0 flex-1 items-center truncate ps-3 text-sm [&_:is(a,button)]:window-no-drag\"\n >\n {breadcrumb()}\n </div>\n </Show>\n <Show when={!breadcrumb()}>\n <div class=\"min-w-0 flex-1\" aria-hidden=\"true\" />\n </Show>\n <Show when={search()}>\n <div\n data-slot=\"shell-top-bar-search\"\n class=\"window-no-drag min-w-0 max-w-md shrink basis-72 px-3 @max-[34rem]/shell-top-bar:order-last @max-[34rem]/shell-top-bar:max-w-none @max-[34rem]/shell-top-bar:basis-full @max-[34rem]/shell-top-bar:pb-2\"\n >\n {search()}\n </div>\n </Show>\n <Show when={actions()}>\n <div\n data-slot=\"shell-top-bar-actions\"\n class=\"window-no-drag flex h-[calc(var(--topbar-height)-1px)] max-w-full min-w-0 shrink-0 items-center gap-2 overflow-x-auto overflow-y-hidden ps-1 @max-[34rem]/shell-top-bar:mb-0.5\"\n >\n {actions()}\n </div>\n </Show>\n </header>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AA4EA,SAAgBsB,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAKD,MAAMd,aAAaP,eAAesB,MAAMf,UAAU;CAClD,MAAME,gBAAgBT,eAAesB,MAAMb,aAAa;CACxD,MAAMC,YAAYV,eAAesB,MAAMZ,SAAS;CAChD,MAAMG,aAAab,eAAesB,MAAMT,UAAU;CAClD,MAAMC,SAASd,eAAesB,MAAMR,MAAM;CAC1C,MAAMC,UAAUf,eAAesB,MAAMP,OAAO;CAE5C,cAAA;EAAA,IAAAS,OAAAC,QAAA,GAAAC,QAAAF,KAAAG;EAAAC,OAAAJ,MAAAK,WAAA;GAAA,KAAA,WAAA;IAAA,OAGW1B,GAIL,0JACAmB,MAAMH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AAAV,MAAAW,gBAGdlC,MAAI;GAAA,IAACmC,OAAI;IAAA,OAAE,CAACvB,WAAW;GAAC;GAAA,IAAAb,WAAA;IAAA,OAAA8C,QAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAZ,OAAAV,MAAAW,gBAGxBlC,MAAI;GAAA,IAACmC,OAAI;IAAA,OAAEtB,OAAO;GAAC;GAAA,IAAAd,WAAA;IAAA,IAAA+C,QAAAC,QAAA;IAAAd,OAAAa,OAKfjC,MAAM;IAAA,OAAAiC;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAb,OAAAV,MAAAW,gBAGVlC,MAAI;GAAA,IAACmC,OAAI;IAAA,OAAErB,QAAQ;GAAC;GAAA,IAAAf,WAAA;IAAA,IAAAiD,QAAAC,QAAA;IAAAhB,OAAAe,OAKhBlC,OAAO;IAAA,OAAAkC;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAE,QAAAC,QAAA;GAAA,IAAAC,MAxDS/B,MAAMX,cAAc,SAAS,SAAO2C,OAChDnD,GACL,sIAIAmB,MAAMX,eACJ,4FACJ;GAAC0C,QAAAD,IAAAG,KAAAC,aAAA9B,OAAA,qBAAA0B,IAAAG,IAAAF,GAAA;GAAAC,SAAAF,IAAAK,KAAAC,UAAAhC,OAAA0B,IAAAK,IAAAH,IAAA;GAAA,OAAAF;EAAA,GAAA;GAAAG,GAAAtB,KAAAA;GAAAwB,GAAAxB,KAAAA;EAAA,CAAA;EAAA,OAAAT;CAAA,EAAA,CAAA;AAqDT"}
1
+ {"version":3,"file":"shell-top-bar.js","names":["ComponentProps","JSX","children","Show","splitProps","cn","Separator","ShellTopBarProps","Omit","navigation","Element","sidebarToggle","workspace","sidebarOpen","alignSidebarAtNarrow","sidebarWidth","breadcrumb","search","actions","draggable","macosInset","windowsInset","glass","ShellTopBar","props","local","rest","_el$","_tmpl$8","_el$2","firstChild","_$spread","_$mergeProps","class","style","_$memo","undefined","_$insert","_$createComponent","when","_el$3","_tmpl$","_el$4","_tmpl$2","_el$5","_tmpl$3","orientation","_el$6","_tmpl$4","_tmpl$5","_el$8","_tmpl$6","_el$9","_tmpl$7","_$effect","_p$","_v$","_v$2","e","_$setAttribute","t","_$className","_$mergeProps","_$memo","_$createComponent","_$setAttribute","_$className"],"sources":["../../../../src/components/layout/shell-top-bar/shell-top-bar.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { children, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Separator } from '../../ui/separator'\n\n/**\n * ShellTopBar.\n *\n * The window's top bar as both applications draw it. It has two halves with a\n * vertical divider between them:\n *\n * - **Leading**: history arrows, the sidebar toggle and the workspace\n * switcher, in that order. This is the part that belongs to the window.\n * - **Content**: breadcrumbs, search and the view's actions. This is the part\n * that belongs to the view, and it always sits to the right of the divider.\n *\n * ## Why the divider tracks the sidebar\n *\n * When the host marks an inline sidebar open, the divider lands on the sidebar's\n * trailing edge, so the bar reads as the rail and sidebar's header on one side\n * and the content's header on the other. The bar spans the rail and the sidebar\n * (they sit under it), so the leading half is as wide as `--rail-width` plus the\n * sidebar's width less the bar's own start padding. The host publishes the width\n * as `--shell-sidebar-width` on an ancestor; the fallback of 17rem matches the\n * default sidebar. The default behavior keeps the leading half with its controls\n * below 48rem. A host that keeps the sidebar inline at narrow widths opts into\n * `alignSidebarAtNarrow` so the divider still tracks it.\n *\n * ## Narrow windows\n *\n * The bar is its own container. Below 34rem the search drops to a row of its\n * own so the leading controls, the breadcrumb and the actions keep their room;\n * the breadcrumb is the first thing to truncate.\n *\n * The bar never spills past its window. When the leading controls are wider than\n * the window (a 320px viewport at 200% text), they wrap onto a second row inside\n * the leading half instead of being cut off or pushing the page sideways, and\n * the actions are capped to the bar and scroll if they are still too wide.\n *\n * On a frameless desktop window the bar is the drag region (`draggable`) and\n * every control opts back out; `macosInset` and `windowsInset` reserve the\n * native window controls.\n */\nexport type ShellTopBarProps = Omit<ComponentProps<'header'>, 'children'> & {\n /** History arrows. Rendered first, left of the sidebar toggle. */\n navigation?: JSX.Element\n /** The sidebar toggle button. */\n sidebarToggle?: JSX.Element\n /** The workspace switcher. */\n workspace?: JSX.Element\n /**\n * Whether the sidebar is open. Its width applies at wide widths by default.\n */\n sidebarOpen?: boolean\n /**\n * Also align the open sidebar below the default 48rem breakpoint. Use this\n * when the host keeps the sidebar inline at narrow widths; drawer layouts keep\n * the default controls-only leading half.\n */\n alignSidebarAtNarrow?: boolean\n /**\n * The open sidebar's width in pixels. Published as `--shell-sidebar-width` on\n * the bar so the divider tracks a resizable sidebar; leave it unset to use an\n * ancestor's variable or the 17rem default.\n */\n sidebarWidth?: number\n /** Breadcrumbs or the view's title. Takes the free space and truncates first. */\n breadcrumb?: JSX.Element\n /** The view's search. */\n search?: JSX.Element\n /** The view's actions, at the trailing edge. */\n actions?: JSX.Element\n /** Make the bar a drag region, for a frameless window. */\n draggable?: boolean\n /** Reserve space for the macOS traffic lights. */\n macosInset?: boolean\n /** Reserve space for the Windows caption buttons. */\n windowsInset?: boolean\n /** Blur the content scrolling under the bar. */\n glass?: boolean\n}\n\nexport function ShellTopBar(props: ShellTopBarProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'navigation',\n 'sidebarToggle',\n 'workspace',\n 'sidebarOpen',\n 'alignSidebarAtNarrow',\n 'sidebarWidth',\n 'breadcrumb',\n 'search',\n 'actions',\n 'draggable',\n 'macosInset',\n 'windowsInset',\n 'glass',\n ])\n\n // Resolve each slot once: a JSX prop is a getter that builds its elements on\n // every read, so testing it with `Show` and then rendering it would build\n // (and run the refs of) two copies.\n const navigation = children(() => local.navigation)\n const sidebarToggle = children(() => local.sidebarToggle)\n const workspace = children(() => local.workspace)\n const breadcrumb = children(() => local.breadcrumb)\n const search = children(() => local.search)\n const actions = children(() => local.actions)\n\n return (\n <header\n data-slot=\"shell-top-bar\"\n class={cn(\n /* Rows are one pixel short of the top bar height so the bottom border keeps\n the bar at exactly --topbar-height, like the shared TopBar: docked\n panels and sidebar headers measure from that edge. */\n '@container/shell-top-bar relative z-(--z-sticky) flex min-h-topbar shrink-0 flex-wrap items-center border-b border-border bg-card text-card-foreground',\n local.glass && 'glass-panel',\n local.draggable && 'window-drag',\n /* Each edge gets exactly one inline-padding utility, for the reason the\n shared TopBar documents: two would tie-break by build order. The inset\n is also published as a variable so the leading half can subtract it. */\n local.macosInset\n ? 'window-inset-macos [--shell-top-bar-inset:84px]'\n : 'ps-3 [--shell-top-bar-inset:0.75rem]',\n local.windowsInset ? 'window-inset-windows' : 'pe-3',\n local.class\n )}\n style={\n local.sidebarWidth === undefined\n ? undefined\n : { '--shell-sidebar-width': `${local.sidebarWidth}px` }\n }\n {...rest}\n >\n <div\n data-slot=\"shell-top-bar-leading\"\n data-sidebar-open={local.sidebarOpen ? 'true' : 'false'}\n class={cn(\n 'window-no-drag flex min-h-[calc(var(--topbar-height)-1px)] max-w-full min-w-0 shrink-0 flex-wrap items-center gap-x-2 gap-y-1 pe-3',\n /* Open sidebar: preserve wide-only alignment unless the host opts into\n the same geometry below the breakpoint. */\n local.sidebarOpen &&\n (local.alignSidebarAtNarrow\n ? 'w-[calc(var(--rail-width)+var(--shell-sidebar-width,17rem)-var(--shell-top-bar-inset))]'\n : 'md:w-[calc(var(--rail-width)+var(--shell-sidebar-width,17rem)-var(--shell-top-bar-inset))]')\n )}\n >\n <Show when={navigation()}>\n <div data-slot=\"shell-top-bar-navigation\" class=\"flex shrink-0 items-center gap-2\">\n {navigation()}\n </div>\n </Show>\n <Show when={sidebarToggle()}>\n <div data-slot=\"shell-top-bar-toggle\" class=\"flex shrink-0 items-center\">\n {sidebarToggle()}\n </div>\n </Show>\n <Show when={workspace()}>\n <div data-slot=\"shell-top-bar-workspace\" class=\"flex min-w-0 items-center\">\n {workspace()}\n </div>\n </Show>\n </div>\n <Separator\n orientation=\"vertical\"\n data-slot=\"shell-top-bar-divider\"\n aria-hidden=\"true\"\n class=\"data-[orientation=vertical]:h-5\"\n />\n <Show when={breadcrumb()}>\n <div\n data-slot=\"shell-top-bar-breadcrumb\"\n class=\"window-no-drag flex h-[calc(var(--topbar-height)-1px)] min-w-0 flex-1 items-center truncate ps-3 text-sm [&_:is(a,button)]:window-no-drag\"\n >\n {breadcrumb()}\n </div>\n </Show>\n <Show when={!breadcrumb()}>\n <div class=\"min-w-0 flex-1\" aria-hidden=\"true\" />\n </Show>\n <Show when={search()}>\n <div\n data-slot=\"shell-top-bar-search\"\n class=\"window-no-drag min-w-0 max-w-md shrink basis-72 px-3 @max-[34rem]/shell-top-bar:order-last @max-[34rem]/shell-top-bar:max-w-none @max-[34rem]/shell-top-bar:basis-full @max-[34rem]/shell-top-bar:pb-2\"\n >\n {search()}\n </div>\n </Show>\n <Show when={actions()}>\n <div\n data-slot=\"shell-top-bar-actions\"\n class=\"window-no-drag flex h-[calc(var(--topbar-height)-1px)] max-w-full min-w-0 shrink-0 items-center gap-2 overflow-x-auto overflow-y-hidden ps-1 @max-[34rem]/shell-top-bar:mb-0.5\"\n >\n {actions()}\n </div>\n </Show>\n </header>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAkFA,SAAgBuB,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQtB,WAAWoB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAKD,MAAMf,aAAaP,eAAeuB,MAAMhB,UAAU;CAClD,MAAME,gBAAgBT,eAAeuB,MAAMd,aAAa;CACxD,MAAMC,YAAYV,eAAeuB,MAAMb,SAAS;CAChD,MAAMI,aAAad,eAAeuB,MAAMT,UAAU;CAClD,MAAMC,SAASf,eAAeuB,MAAMR,MAAM;CAC1C,MAAMC,UAAUhB,eAAeuB,MAAMP,OAAO;CAE5C,cAAA;EAAA,IAAAS,OAAAC,QAAA,GAAAC,QAAAF,KAAAG;EAAAC,OAAAJ,MAAAK,WAAA;GAAA,KAAA,WAAA;IAAA,OAGW3B,GAIL,0JACAoB,MAAMH,SAA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