@adea-ai/ui 0.162.0 → 0.162.2

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 (28) hide show
  1. package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
  2. package/dist/components/composites/appearance-editor/appearance-choices.js +11 -3
  3. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  4. package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
  5. package/dist/components/composites/appearance-editor/appearance-editor.js +1 -4
  6. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  7. package/dist/components/composites/appearance-editor/appearance-rows.d.ts +2 -0
  8. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
  9. package/dist/components/composites/appearance-editor/appearance-rows.js +4 -1
  10. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  11. package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
  12. package/dist/components/composites/settings/settings-navigation.js +13 -4
  13. package/dist/components/composites/settings/settings-navigation.js.map +1 -1
  14. package/dist/lib/tooltip-focus-gate.d.ts +9 -0
  15. package/dist/lib/tooltip-focus-gate.d.ts.map +1 -1
  16. package/dist/lib/tooltip-focus-gate.js +14 -2
  17. package/dist/lib/tooltip-focus-gate.js.map +1 -1
  18. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +9 -3
  19. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +3 -7
  20. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +8 -1
  21. package/dist/r/src/components/composites/settings/settings-navigation.tsx +33 -6
  22. package/dist/r/src/lib/tooltip-focus-gate.ts +22 -1
  23. package/package.json +1 -1
  24. package/src/components/composites/appearance-editor/appearance-choices.tsx +9 -3
  25. package/src/components/composites/appearance-editor/appearance-editor.tsx +3 -7
  26. package/src/components/composites/appearance-editor/appearance-rows.tsx +8 -1
  27. package/src/components/composites/settings/settings-navigation.tsx +33 -6
  28. package/src/lib/tooltip-focus-gate.ts +22 -1
@@ -1 +1 @@
1
- {"version":3,"file":"appearance-rows.js","names":["<Show when={props.description}>\n {(descriptionSlot) => (\n <div class=\"mt-0.5 text-xs text-muted-foreground\">{descriptionSlot()}</div>\n )}\n </Show>","class={cn('flex min-w-0 flex-1 items-center gap-3', { 'basis-48': !props.stacked })}","<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 {(descriptionSlot) => (\n <div class=\"mt-0.5 text-xs text-muted-foreground\">{descriptionSlot()}</div>\n )}\n </Show>\n </div>\n </div>\n <div class=\"min-w-0 max-w-full shrink-0\">{props.children}</div>\n </section>","ref={setPortalMount}","<DropdownMenu\n modal={false}\n open={menuOpen()}\n onOpenChange={(next: boolean) => {\n if (next !== open) focusLifecycleVersion += 1\n open = next\n setMenuOpen(next)\n if (next) {\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"\n tabKey=\"leave\"\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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = 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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}\n onEscapeKeyDown={() => {\n restoreTriggerFocus = true\n }}\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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu 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 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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","modal={false}","onOpenChange={(next: boolean) => {\n if (next !== open) focusLifecycleVersion += 1\n open = next\n setMenuOpen(next)\n if (next) {\n focusOutsideTarget = undefined\n restoreTriggerFocus = false\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>","ref={setTriggerElement}","as={Button}","variant=\"outline\"","size=\"sm\"","class=\"w-full justify-between sm:w-52\"","<PalettePreview theme={props.triggerPreview} />","<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>","<ChevronDown aria-hidden=\"true\" class=\"shrink-0 text-muted-foreground\" />","class=\"shrink-0 text-muted-foreground\"","<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-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"\n tabKey=\"leave\"\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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = 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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}\n onEscapeKeyDown={() => {\n restoreTriggerFocus = true\n }}\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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu 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 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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","class=\"max-h-80 w-max min-w-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"","tabKey=\"leave\"","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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = true\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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}","onEscapeKeyDown={() => {\n restoreTriggerFocus = 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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu must restore\n // focus to the trigger instead.\n event.preventDefault()\n }\n }}","<DropdownMenuRadioGroup\n value={selected()?.id ?? ''}\n aria-label={`${props.label} options`}\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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","onChange={(id) => {\n if (!props.disabled && typeof id === 'string') props.onSelect(id)\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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","<DropdownMenuRadioItem\n value={option.id}\n textValue={option.name}\n closeOnSelect={true}\n disabled={props.disabled}\n // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","closeOnSelect={true}","<ThemeMenuPreview theme={option.preview} />","<div ref={setPortalMount}>\n <DropdownMenu\n modal={false}\n open={menuOpen()}\n onOpenChange={(next: boolean) => {\n if (next !== open) focusLifecycleVersion += 1\n open = next\n setMenuOpen(next)\n if (next) {\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"\n tabKey=\"leave\"\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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = 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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}\n onEscapeKeyDown={() => {\n restoreTriggerFocus = true\n }}\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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu 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 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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","<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>","props.appearance === 'light' ? <Sun /> : <Moon />","<Sun />","<Moon />","<ThemeSelectMenu\n label={label()}\n selectedId={props.selectedId}\n triggerPreview={props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />","<PinnedThemeRow {...props} title=\"Terminal\" subject=\"The terminal\" icon={<SquareTerminal />} />","title=\"Terminal\"","subject=\"The terminal\"","<SquareTerminal />","<PinnedThemeRow {...props} title=\"Code\" subject=\"Code\" icon={<Code />} />","title=\"Code\"","subject=\"Code\"","<Code />","<SettingsRow\n title={props.sectioned ? 'Theme' : props.title}\n icon={props.icon}\n description={props.sectioned ? undefined : description()}\n >\n <ThemeSelectMenu\n label={props.title}\n selectedId={props.selectedId}\n triggerPreview={selectedOption()?.preview ?? props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />\n </SettingsRow>","props.sectioned ? 'Theme' : props.title","props.sectioned ? undefined : description()","<ThemeSelectMenu\n label={props.title}\n selectedId={props.selectedId}\n triggerPreview={selectedOption()?.preview ?? props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />","ChevronDown","LucideChevronDown","Code","LucideCode","Moon","LucideMoon","SquareTerminal","LucideSquareTerminal","Sun","LucideSun","_$readShallow"],"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; the menu primitive 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 } from 'solid-js'\nimport { type JSX } from '@solidjs/web'\nimport {\n ChevronDown as LucideChevronDown,\n Code as LucideCode,\n Moon as LucideMoon,\n SquareTerminal as LucideSquareTerminal,\n Sun as LucideSun,\n} from '@lucide/solid'\nimport { cn } from '#lib/utils'\nimport { THEME_DEFAULT_ID } from '#lib/theme-defaults'\nimport { Button } from '../../ui/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuTrigger,\n tabStopAt,\n} from '../../ui/dropdown-menu/dropdown-menu'\nimport { PalettePreview, ThemeMenuPreview } from './theme-preview'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronDown = fastIcon(LucideChevronDown)\nconst Code = fastIcon(LucideCode)\nconst Moon = fastIcon(LucideMoon)\nconst SquareTerminal = fastIcon(LucideSquareTerminal)\nconst Sun = fastIcon(LucideSun)\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 {(descriptionSlot) => (\n <div class=\"mt-0.5 text-xs text-muted-foreground\">{descriptionSlot()}</div>\n )}\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. The menu primitive handles menu navigation and dismissal; Tab\n * leaves the menu for the adjacent stop (`tabKey=\"leave\"`). The menu width\n * follows its content (bounded by the popper's available width) so a long\n * theme name and its description render fully instead of truncating at the\n * 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 // Focus bookkeeping the dismissal handlers share. Plain variables, not\n // signals: the handlers run back to back within one close (Escape, then the\n // focus return) and a signal read would still see the value from before the\n // last write until the next flush. Only `menuOpen` is drawn, so it alone is\n // also a signal.\n const [menuOpen, setMenuOpen] = createSignal(false)\n let open = false\n let focusOutsideTarget: HTMLElement | undefined\n let restoreTriggerFocus = false\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\n return (\n <div ref={setPortalMount}>\n <DropdownMenu\n modal={false}\n open={menuOpen()}\n onOpenChange={(next: boolean) => {\n if (next !== open) focusLifecycleVersion += 1\n open = next\n setMenuOpen(next)\n if (next) {\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"\n tabKey=\"leave\"\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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = 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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}\n onEscapeKeyDown={() => {\n restoreTriggerFocus = true\n }}\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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu 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 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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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: PinnedThemeRowProps) {\n return (\n <PinnedThemeRow {...props} title=\"Terminal\" subject=\"The terminal\" icon={<SquareTerminal />} />\n )\n}\n\n/**\n * The code palette (editor, diff and file views), chosen the same way as the\n * terminal: `'theme'` follows the interface theme, any catalogue record pins\n * that theme's syntax colours and the canvas they were measured on.\n */\nexport function CodeRow(props: PinnedThemeRowProps) {\n return <PinnedThemeRow {...props} title=\"Code\" subject=\"Code\" icon={<Code />} />\n}\n\ntype PinnedThemeRowProps = {\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 /**\n * The row sits under a tab that already names its subject, so it is titled\n * for what it sets (\"Theme\") and carries no description. The menu keeps the\n * subject in its accessible name.\n */\n sectioned?: boolean\n onSelect: (id: string) => void\n}\n\nfunction PinnedThemeRow(\n props: PinnedThemeRowProps & { title: string; subject: string; icon: JSX.Element }\n) {\n const options = createMemo<ThemeOption[]>(() => [\n {\n id: THEME_DEFAULT_ID,\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_DEFAULT_ID\n ? `${props.subject} follows ${option.name}.`\n : `${props.subject} follows the interface theme.`\n }\n return (\n <SettingsRow\n title={props.sectioned ? 'Theme' : props.title}\n icon={props.icon}\n description={props.sectioned ? undefined : description()}\n >\n <ThemeSelectMenu\n label={props.title}\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":";;;;;;;;;;;;;;;;AAqDA,IAAMgD,gBAAc,SAASC,WAAiB;AAC9C,IAAMC,SAAO,SAASC,IAAU;AAChC,IAAMC,SAAO,SAASC,IAAU;AAChC,IAAMC,mBAAiB,SAASC,cAAoB;AACpD,IAAMC,QAAM,SAASC,GAAS;AAE9B,SAAgB,YAAY,OAMzB;CAEC,IAAA,OAAA,OA0BS;CAjBP,IAAA,QAAA,KAAA;CACE,IAAA,QAAA,MAAA;CAMA,IAAA,QAAA,MAAA;CACE,IAAA,QAAA,MAAA;CAQJ,IAAA,QAAA,MAAA;CAfE,OAAA,aAIE;EAAC,OAAA,MAAM;CAAI,CACP;CAEJ,OA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AC9C;EACE,IAAI;EACJ,MAAM;EACN,aAAa;EACb,SAAS,MAAM;CACjB,GACA,GAAG,MAAM,OAAO,KAAK,WAAW;EAC9B,IAAI,MAAM;EACV,MAAM,MAAM;EACZ,aAAa,MAAM;EACnB,SAAS;CACX,EAAE,CACJ,CAAC;CACD,MAAM,iBAAiB,iBAAiB;EACtC,MAAM,aAAa,MAAM;EACzB,OAAO,QAAQ,CAAC,CAAC,MAAM,WAAW,OAAO,OAAO,UAAU;CAC5D,CAAC;CACD,MAAM,oBAAoB;EACxB,MAAM,SAAS,eAAe;EAC9B,OAAO,UAAU,OAAO,OAAA,UACpB,GAAG,MAAM,QAAQ,WAAW,OAAO,KAAK,KACxC,GAAG,MAAM,QAAQ;CACvB;CACA,OACEC,gBAAAA,aAAAA;EACE,IAAA,QAAA;GAAOC,OAAAA,WAAAA;IAAM,OAAA,CAAA,CAAA,MAAA;GAAgC,CAAA,CAAC,CAAD,IAApB,UAAU,MAAM;EAAK;EAC9C,IAAA,OAAA;GAAM,OAAA,MAAM;EAAI;EAChB,IAAA,cAAA;GAAaC,OAAAA,WAAAA;IAAM,OAAA,CAAA,CAAA,MAAA;GAAoC,CAAA,CAAC,CAAD,IAAxB,KAAA,IAAY,YAAY;EAAC;EAH1D,IAAA,WAAA;GAKEC,OAAAA,gBAAAA,iBAAAA;IACE,IAAA,QAAA;KAAO,OAAA,MAAM;IAAK;IAClB,IAAA,aAAA;KAAY,OAAA,MAAM;IAAU;IAC5B,IAAA,iBAAA;KAAgB,OAAA,eAAe,CAAC,EAAE,WAAW,MAAM;IAAO;IAC1D,IAAA,UAAA;KAAS,OAAA,QAAQ;IAAC;IAClB,IAAA,WAAA;KAAU,OAAA,MAAM;IAAQ;IACxB,IAAA,WAAA;KAAU,OAAA,MAAM;IAAQ;GACzB,CAAA;EACU;;AAEjB"}
1
+ {"version":3,"file":"appearance-rows.js","names":["<Show when={props.description}>\n {(descriptionSlot) => (\n <div class=\"mt-0.5 text-xs text-muted-foreground\">{descriptionSlot()}</div>\n )}\n </Show>","class={cn('flex min-w-0 flex-1 items-center gap-3', {\n 'basis-48': !props.stacked && !props.compact,\n 'basis-24': !props.stacked && props.compact,\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\n class={cn('flex min-w-0 flex-1 items-center gap-3', {\n 'basis-48': !props.stacked && !props.compact,\n 'basis-24': !props.stacked && props.compact,\n })}\n >\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 {(descriptionSlot) => (\n <div class=\"mt-0.5 text-xs text-muted-foreground\">{descriptionSlot()}</div>\n )}\n </Show>\n </div>\n </div>\n <div class=\"min-w-0 max-w-full shrink-0\">{props.children}</div>\n </section>","ref={setPortalMount}","<DropdownMenu\n modal={false}\n open={menuOpen()}\n onOpenChange={(next: boolean) => {\n if (next !== open) focusLifecycleVersion += 1\n open = next\n setMenuOpen(next)\n if (next) {\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"\n tabKey=\"leave\"\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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = 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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}\n onEscapeKeyDown={() => {\n restoreTriggerFocus = true\n }}\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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu 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 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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","modal={false}","onOpenChange={(next: boolean) => {\n if (next !== open) focusLifecycleVersion += 1\n open = next\n setMenuOpen(next)\n if (next) {\n focusOutsideTarget = undefined\n restoreTriggerFocus = false\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>","ref={setTriggerElement}","as={Button}","variant=\"outline\"","size=\"sm\"","class=\"w-full justify-between sm:w-52\"","<PalettePreview theme={props.triggerPreview} />","<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>","<ChevronDown aria-hidden=\"true\" class=\"shrink-0 text-muted-foreground\" />","class=\"shrink-0 text-muted-foreground\"","<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-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"\n tabKey=\"leave\"\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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = 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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}\n onEscapeKeyDown={() => {\n restoreTriggerFocus = true\n }}\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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu 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 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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","class=\"max-h-80 w-max min-w-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"","tabKey=\"leave\"","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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = true\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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}","onEscapeKeyDown={() => {\n restoreTriggerFocus = 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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu must restore\n // focus to the trigger instead.\n event.preventDefault()\n }\n }}","<DropdownMenuRadioGroup\n value={selected()?.id ?? ''}\n aria-label={`${props.label} options`}\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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","onChange={(id) => {\n if (!props.disabled && typeof id === 'string') props.onSelect(id)\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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","<DropdownMenuRadioItem\n value={option.id}\n textValue={option.name}\n closeOnSelect={true}\n disabled={props.disabled}\n // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","closeOnSelect={true}","<ThemeMenuPreview theme={option.preview} />","<div ref={setPortalMount}>\n <DropdownMenu\n modal={false}\n open={menuOpen()}\n onOpenChange={(next: boolean) => {\n if (next !== open) focusLifecycleVersion += 1\n open = next\n setMenuOpen(next)\n if (next) {\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"\n tabKey=\"leave\"\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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = 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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}\n onEscapeKeyDown={() => {\n restoreTriggerFocus = true\n }}\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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu 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 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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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>","<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>","props.appearance === 'light' ? <Sun /> : <Moon />","<Sun />","<Moon />","<ThemeSelectMenu\n label={label()}\n selectedId={props.selectedId}\n triggerPreview={props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />","<PinnedThemeRow {...props} title=\"Terminal\" subject=\"The terminal\" icon={<SquareTerminal />} />","title=\"Terminal\"","subject=\"The terminal\"","<SquareTerminal />","<PinnedThemeRow {...props} title=\"Code\" subject=\"Code\" icon={<Code />} />","title=\"Code\"","subject=\"Code\"","<Code />","<SettingsRow\n title={props.sectioned ? 'Theme' : props.title}\n icon={props.icon}\n description={props.sectioned ? undefined : description()}\n >\n <ThemeSelectMenu\n label={props.title}\n selectedId={props.selectedId}\n triggerPreview={selectedOption()?.preview ?? props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />\n </SettingsRow>","props.sectioned ? 'Theme' : props.title","props.sectioned ? undefined : description()","<ThemeSelectMenu\n label={props.title}\n selectedId={props.selectedId}\n triggerPreview={selectedOption()?.preview ?? props.preview}\n options={options()}\n disabled={props.disabled}\n onSelect={props.onSelect}\n />","ChevronDown","LucideChevronDown","Code","LucideCode","Moon","LucideMoon","SquareTerminal","LucideSquareTerminal","Sun","LucideSun","_$readShallow"],"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; the menu primitive 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 } from 'solid-js'\nimport { type JSX } from '@solidjs/web'\nimport {\n ChevronDown as LucideChevronDown,\n Code as LucideCode,\n Moon as LucideMoon,\n SquareTerminal as LucideSquareTerminal,\n Sun as LucideSun,\n} from '@lucide/solid'\nimport { cn } from '#lib/utils'\nimport { THEME_DEFAULT_ID } from '#lib/theme-defaults'\nimport { Button } from '../../ui/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuTrigger,\n tabStopAt,\n} from '../../ui/dropdown-menu/dropdown-menu'\nimport { PalettePreview, ThemeMenuPreview } from './theme-preview'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronDown = fastIcon(LucideChevronDown)\nconst Code = fastIcon(LucideCode)\nconst Moon = fastIcon(LucideMoon)\nconst SquareTerminal = fastIcon(LucideSquareTerminal)\nconst Sun = fastIcon(LucideSun)\n\nexport function SettingsRow(props: {\n title: string\n icon: JSX.Element\n description?: JSX.Element\n stacked?: boolean\n /** A short title with no subtitle: the control keeps the title's line at a narrow width. */\n compact?: 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\n class={cn('flex min-w-0 flex-1 items-center gap-3', {\n 'basis-48': !props.stacked && !props.compact,\n 'basis-24': !props.stacked && props.compact,\n })}\n >\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 {(descriptionSlot) => (\n <div class=\"mt-0.5 text-xs text-muted-foreground\">{descriptionSlot()}</div>\n )}\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. The menu primitive handles menu navigation and dismissal; Tab\n * leaves the menu for the adjacent stop (`tabKey=\"leave\"`). The menu width\n * follows its content (bounded by the popper's available width) so a long\n * theme name and its description render fully instead of truncating at the\n * 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 // Focus bookkeeping the dismissal handlers share. Plain variables, not\n // signals: the handlers run back to back within one close (Escape, then the\n // focus return) and a signal read would still see the value from before the\n // last write until the next flush. Only `menuOpen` is drawn, so it alone is\n // also a signal.\n const [menuOpen, setMenuOpen] = createSignal(false)\n let open = false\n let focusOutsideTarget: HTMLElement | undefined\n let restoreTriggerFocus = false\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\n return (\n <div ref={setPortalMount}>\n <DropdownMenu\n modal={false}\n open={menuOpen()}\n onOpenChange={(next: boolean) => {\n if (next !== open) focusLifecycleVersion += 1\n open = next\n setMenuOpen(next)\n if (next) {\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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-(--anchor-width) max-w-(--available-width) overflow-x-hidden overflow-y-auto\"\n tabKey=\"leave\"\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 = tabStopAt(target)\n if (focusTarget) {\n restoreTriggerFocus = false\n focusOutsideTarget = focusTarget\n } else {\n restoreTriggerFocus = 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 restoreTriggerFocus = false\n focusOutsideTarget = target\n }\n }}\n onEscapeKeyDown={() => {\n restoreTriggerFocus = true\n }}\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 (open) {\n event.preventDefault()\n return\n }\n\n const lifecycleVersion = focusLifecycleVersion\n const shouldRestore = restoreTriggerFocus\n const focusTarget = focusOutsideTarget\n focusOutsideTarget = undefined\n restoreTriggerFocus = 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 // the menu's deferred stale-focus restore.\n event.preventDefault()\n queueMicrotask(() => {\n if (lifecycleVersion !== focusLifecycleVersion || open) 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 the menu 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 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 // Choosing an option returns focus to the trigger. ui-sdk's\n // menu item takes `onSelect`, and DropdownMenuRadioItem passes\n // it through, though its prop type does not list it yet.\n {...({\n onSelect: () => {\n restoreTriggerFocus = true\n },\n } as object)}\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: PinnedThemeRowProps) {\n return (\n <PinnedThemeRow {...props} title=\"Terminal\" subject=\"The terminal\" icon={<SquareTerminal />} />\n )\n}\n\n/**\n * The code palette (editor, diff and file views), chosen the same way as the\n * terminal: `'theme'` follows the interface theme, any catalogue record pins\n * that theme's syntax colours and the canvas they were measured on.\n */\nexport function CodeRow(props: PinnedThemeRowProps) {\n return <PinnedThemeRow {...props} title=\"Code\" subject=\"Code\" icon={<Code />} />\n}\n\ntype PinnedThemeRowProps = {\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 /**\n * The row sits under a tab that already names its subject, so it is titled\n * for what it sets (\"Theme\") and carries no description. The menu keeps the\n * subject in its accessible name.\n */\n sectioned?: boolean\n onSelect: (id: string) => void\n}\n\nfunction PinnedThemeRow(\n props: PinnedThemeRowProps & { title: string; subject: string; icon: JSX.Element }\n) {\n const options = createMemo<ThemeOption[]>(() => [\n {\n id: THEME_DEFAULT_ID,\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_DEFAULT_ID\n ? `${props.subject} follows ${option.name}.`\n : `${props.subject} follows the interface theme.`\n }\n return (\n <SettingsRow\n title={props.sectioned ? 'Theme' : props.title}\n icon={props.icon}\n description={props.sectioned ? undefined : description()}\n >\n <ThemeSelectMenu\n label={props.title}\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":";;;;;;;;;;;;;;;;AAqDA,IAAMgD,gBAAc,SAASC,WAAiB;AAC9C,IAAMC,SAAO,SAASC,IAAU;AAChC,IAAMC,SAAO,SAASC,IAAU;AAChC,IAAMC,mBAAiB,SAASC,cAAoB;AACpD,IAAMC,QAAM,SAASC,GAAS;AAE9B,SAAgB,YAAY,OAQzB;CAEC,IAAA,OAAA,OA+BS;CAtBP,IAAA,QAAA,KAAA;CAME,IAAA,QAAA,MAAA;CAMA,IAAA,QAAA,MAAA;CACE,IAAA,QAAA,MAAA;CAQJ,IAAA,QAAA,MAAA;CAfE,OAAA,aAIE;EAAC,OAAA,MAA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":3,"file":"settings-navigation.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/settings/settings-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAOvC,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AAGzE,gFAAgF;AAChF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,kEAAkE;AAClE,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,SAAS,sBAAsB,EAAE,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,aAAa,EACb,YAAY,GAAG,UAAU,GAAG,aAAa,CAC1C,GAAG;IACF,6EAA6E;IAC7E,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAC1C,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC;iGAC6F;IAC7F,cAAc,CAAC,EACX,OAAO,GACP,CAAC,CACC,OAAO,EAAE,iBAAiB,GAAG,SAAS,KACnC,IAAI,CAAC,CAAA,CAAC,8EAA8E;IAC7F,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAgFD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAsChE"}
1
+ {"version":3,"file":"settings-navigation.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/settings/settings-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAOvC,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AAGzE,gFAAgF;AAChF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,kEAAkE;AAClE,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,SAAS,sBAAsB,EAAE,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,aAAa,EACb,YAAY,GAAG,UAAU,GAAG,aAAa,CAC1C,GAAG;IACF,6EAA6E;IAC7E,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAC1C,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC;iGAC6F;IAC7F,cAAc,CAAC,EACX,OAAO,GACP,CAAC,CACC,OAAO,EAAE,iBAAiB,GAAG,SAAS,KACnC,IAAI,CAAC,CAAA,CAAC,8EAA8E;IAC7F,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AA2GD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAsChE"}
@@ -33,8 +33,16 @@ var _tmpl$4 = /* @__PURE__ */ template(`<button>`);
33
33
  function scrollsOn(value) {
34
34
  return value === "auto" || value === "scroll";
35
35
  }
36
- /** The nearest-edge delta that brings `[start, end]` inside `[min, max]`. */
37
- function nearestDelta(start, end, min, max) {
36
+ /**
37
+ * The nearest-edge delta that brings `[start, end]` inside `[min, max]`. A range longer than
38
+ * the viewport cannot fit, so it aligns its leading edge (`leadingEnd` for a right-to-left
39
+ * inline axis), where the label starts. Settling on whichever edge overflows instead flips
40
+ * between the two on every reveal: a row-forced strip's full-width rows are wider than its
41
+ * scroller, so each reveal of the same row moved it the other way and the row's position
42
+ * depended on how many reveals had run, leaving it scrolled out of view half the time.
43
+ */
44
+ function nearestDelta(start, end, min, max, leadingEnd = false) {
45
+ if (end - start > max - min) return leadingEnd ? end - max : start - min;
38
46
  if (start < min) return start - min;
39
47
  if (end > max) return end - max;
40
48
  return 0;
@@ -62,6 +70,7 @@ function revealNearest(row) {
62
70
  container,
63
71
  x,
64
72
  y,
73
+ rtl: style.direction === "rtl",
65
74
  box: container.getBoundingClientRect()
66
75
  });
67
76
  }
@@ -72,8 +81,8 @@ function revealNearest(row) {
72
81
  let top = rowBox.top;
73
82
  let bottom = rowBox.bottom;
74
83
  const writes = [];
75
- for (const { container, x, y, box } of scrollers) {
76
- const dx = x ? nearestDelta(left, right, box.left, box.right) : 0;
84
+ for (const { container, x, y, rtl, box } of scrollers) {
85
+ const dx = x ? nearestDelta(left, right, box.left, box.right, rtl) : 0;
77
86
  const dy = y ? nearestDelta(top, bottom, box.top, box.bottom) : 0;
78
87
  if (dx === 0 && dy === 0) continue;
79
88
  writes.push({
@@ -1 +1 @@
1
- {"version":3,"file":"settings-navigation.js","names":["<TabsList\n aria-label={props['aria-label']}\n // The list's state carries the root's orientation, the axis its arrow keys\n // move on; the list reads it here, and the rows read it below.\n render={(part: Record<string, unknown>, state: ListState) => (\n <div\n {...part}\n data-slot=\"settings-navigation\"\n aria-orientation={state.orientation}\n class={cn(\n part.class as string,\n state.orientation === 'horizontal'\n ? // The block padding is the room the focus ring needs: a scroller\n // clips at its padding edge, and this one scrolls sideways only.\n 'scroll-fade w-full flex-row items-center gap-1 overflow-x-auto overflow-y-hidden border-b border-border px-2 py-1.5'\n : 'max-h-full min-h-0 flex-col items-stretch gap-2 overflow-x-hidden overflow-y-auto px-2 py-2',\n props.class\n )}\n />\n )}\n class={cn(\n // Positioned so the visually hidden group names are laid out (and\n // clipped) inside the list: unpositioned, their absolute boxes escape a\n // scrolled strip and widen the page by however far it has scrolled.\n 'relative flex min-w-0 shrink-0 justify-start',\n props.class\n )}\n {...rest}\n >\n {(state: ListState) => (\n <SettingsNavigationGroups {...props} strip={state.orientation === 'horizontal'} />\n )}\n </TabsList>","render={(part: Record<string, unknown>, state: ListState) => (\n <div\n {...part}\n data-slot=\"settings-navigation\"\n aria-orientation={state.orientation}\n class={cn(\n part.class as string,\n state.orientation === 'horizontal'\n ? // The block padding is the room the focus ring needs: a scroller\n // clips at its padding edge, and this one scrolls sideways only.\n 'scroll-fade w-full flex-row items-center gap-1 overflow-x-auto overflow-y-hidden border-b border-border px-2 py-1.5'\n : 'max-h-full min-h-0 flex-col items-stretch gap-2 overflow-x-hidden overflow-y-auto px-2 py-2',\n props.class\n )}\n />\n )}","<SettingsNavigationGroups {...props} strip={state.orientation === 'horizontal'} />","{props.groups.map((group, groupIndex) => {\n const groupId = `${groupIdPrefix}-group-${groupIndex}`\n return (\n <div\n role=\"none\"\n data-slot=\"settings-navigation-group\"\n class={cn(\n 'flex gap-0.5',\n props.strip\n ? 'shrink-0 flex-row items-center not-first:ms-1 not-first:border-s not-first:border-border not-first:ps-2'\n : 'min-w-0 flex-col'\n )}\n >\n <span id={groupId} class=\"sr-only\">\n {group.label}\n </span>\n <Show when={!props.strip}>\n {/* The overline role on the sidebar's own muted foreground. */}\n <Text\n variant=\"overline\"\n tone=\"inherit\"\n aria-hidden=\"true\"\n class=\"px-2 py-1.5 text-sidebar-muted-foreground\"\n >\n {group.label}\n </Text>\n </Show>\n {group.items.map((item) => (\n <TabsTrigger\n // The row keeps its own slot over the tab's `tabs-trigger`.\n render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}\n aria-describedby={groupId}\n value={item.value}\n disabled={item.disabled}\n ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}\n onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'h-row-lg justify-start border-0 px-3 py-2 text-left text-foreground data-[selected]:bg-primary-subtle',\n props.strip ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !props.strip })}>{item.label}</span>\n </TabsTrigger>\n ))}\n </div>\n )\n })}","<Text\n variant=\"overline\"\n tone=\"inherit\"\n aria-hidden=\"true\"\n class=\"px-2 py-1.5 text-sidebar-muted-foreground\"\n >\n {group.label}\n </Text>","variant=\"overline\"","tone=\"inherit\"","class=\"px-2 py-1.5 text-sidebar-muted-foreground\"","<div\n role=\"none\"\n data-slot=\"settings-navigation-group\"\n class={cn(\n 'flex gap-0.5',\n props.strip\n ? 'shrink-0 flex-row items-center not-first:ms-1 not-first:border-s not-first:border-border not-first:ps-2'\n : 'min-w-0 flex-col'\n )}\n >\n <span id={groupId} class=\"sr-only\">\n {group.label}\n </span>\n <Show when={!props.strip}>\n {/* The overline role on the sidebar's own muted foreground. */}\n <Text\n variant=\"overline\"\n tone=\"inherit\"\n aria-hidden=\"true\"\n class=\"px-2 py-1.5 text-sidebar-muted-foreground\"\n >\n {group.label}\n </Text>\n </Show>\n {group.items.map((item) => (\n <TabsTrigger\n // The row keeps its own slot over the tab's `tabs-trigger`.\n render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}\n aria-describedby={groupId}\n value={item.value}\n disabled={item.disabled}\n ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}\n onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'h-row-lg justify-start border-0 px-3 py-2 text-left text-foreground data-[selected]:bg-primary-subtle',\n props.strip ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !props.strip })}>{item.label}</span>\n </TabsTrigger>\n ))}\n </div>","<TabsTrigger\n // The row keeps its own slot over the tab's `tabs-trigger`.\n render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}\n aria-describedby={groupId}\n value={item.value}\n disabled={item.disabled}\n ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}\n onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'h-row-lg justify-start border-0 px-3 py-2 text-left text-foreground data-[selected]:bg-primary-subtle',\n props.strip ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !props.strip })}>{item.label}</span>\n </TabsTrigger>","render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}","ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}","onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}","item.icon","_$readShallow"],"sources":["../../../../src/components/composites/settings/settings-navigation.tsx"],"sourcesContent":["import type { JSX } from '@solidjs/web'\nimport { createEffect, createUniqueId, Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport {\n sidebarNavItemClass,\n sidebarNavItemStateClass,\n} from '../../layout/sidebar-nav/sidebar-nav-classes'\nimport { TabsList, TabsTrigger, type TabsListProps } from '../../ui/tabs'\nimport { Text } from '../../ui/typography'\n\n/** One host-owned destination in a settings tab list. Values must be unique. */\nexport type SettingsNavigationItem = {\n value: string\n label: string\n icon?: JSX.Element\n disabled?: boolean\n}\n\n/** A visible, accessibly named group of settings destinations. */\nexport type SettingsNavigationGroup = {\n label: string\n items: readonly SettingsNavigationItem[]\n}\n\nexport type SettingsNavigationProps = Omit<\n TabsListProps,\n 'appearance' | 'children' | 'orientation'\n> & {\n /** Groups are presentation only; the host owns the tab values and panels. */\n groups: readonly SettingsNavigationGroup[]\n /** The same controlled value supplied to the enclosing `Tabs`. */\n value: string\n /** Called when the already-selected destination is activated again. */\n onReselect?: (value: string) => void\n /** Reveal the selected row on value changes and window resizes. Defaults to nearest scrolling\n * of the ancestors that expose a scroll affordance; hidden-overflow ancestors never move. */\n revealSelected?:\n | boolean\n | ((\n trigger: HTMLButtonElement | undefined\n ) => void) /** Every tab list needs a label independent of its visible group headings. */\n 'aria-label': string\n}\n\n/**\n * SettingsNavigation.\n *\n * A grouped vertical tab list for sibling settings panels. It composes the\n * shared Tabs behaviour with the shared sidebar row recipe; the host supplies\n * the controlled value, panel content, icons and any persistence or routing.\n * Use ordinary tabs for a short, ungrouped row of view choices.\n *\n * The shape follows the enclosing `Tabs` orientation rather than a prop of its\n * own, so the visual axis can never disagree with the arrow keys the tabs\n * bind: `vertical` is the grouped rail, `horizontal` is a single scrollable\n * strip of tabs (what `SettingsLayout` shows below 48rem). The strip keeps the\n * groups in order, separated by a rule; their visible headings drop out, since\n * an overline between tabs reads as another tab, but each tab still carries its\n * group as its accessible description.\n *\n * ui-sdk's Tabs own roving focus, arrow keys, selection and tab/panel ARIA. This\n * component adds no URL, storage or host-specific state. Set\n * `revealSelected={false}` when the surrounding layout does not use an internal\n * scrolling viewport.\n */\nfunction scrollsOn(value: string): boolean {\n return value === 'auto' || value === 'scroll'\n}\n\n/** The nearest-edge delta that brings `[start, end]` inside `[min, max]`. */\nfunction nearestDelta(start: number, end: number, min: number, max: number): number {\n if (start < min) return start - min\n if (end > max) return end - max\n return 0\n}\n\n/**\n * Reveal by scrolling only the ancestors that expose a scroll affordance\n * (`auto` or `scroll`), by the exact nearest-edge delta. `scrollIntoView` also\n * pans `overflow: hidden` ancestors, which are programmatically scrollable but\n * give the user no way back, so one over-pan left earlier rows permanently\n * clipped outside the viewport with no scroll to recover them (#182).\n *\n * All reads happen before any write. Reading a box after a `scrollTop` write\n * forces a fresh layout, and walking the ancestors that way laid the page out\n * once per ancestor on every open (52 ms of forced layout at 4x CPU in the\n * Cortana audit). The row box is read once and shifted by each inner scroll,\n * which is exactly where the browser would report it after that write.\n */\nfunction revealNearest(row: HTMLElement): void {\n const scrollers: { container: HTMLElement; x: boolean; y: boolean; box: DOMRect }[] = []\n for (let container = row.parentElement; container; container = container.parentElement) {\n const style = window.getComputedStyle(container)\n const x = scrollsOn(style.overflowX)\n const y = scrollsOn(style.overflowY)\n if (x || y) scrollers.push({ container, x, y, box: container.getBoundingClientRect() })\n }\n if (scrollers.length === 0) return\n const rowBox = row.getBoundingClientRect()\n let left = rowBox.left\n let right = rowBox.right\n let top = rowBox.top\n let bottom = rowBox.bottom\n const writes: { container: HTMLElement; dx: number; dy: number }[] = []\n for (const { container, x, y, box } of scrollers) {\n const dx = x ? nearestDelta(left, right, box.left, box.right) : 0\n const dy = y ? nearestDelta(top, bottom, box.top, box.bottom) : 0\n if (dx === 0 && dy === 0) continue\n writes.push({ container, dx, dy })\n left -= dx\n right -= dx\n top -= dy\n bottom -= dy\n }\n for (const { container, dx, dy } of writes) {\n if (dx !== 0) container.scrollLeft += dx\n if (dy !== 0) container.scrollTop += dy\n }\n}\n\ntype ListState = { orientation: 'horizontal' | 'vertical' }\n\nexport function SettingsNavigation(props: SettingsNavigationProps) {\n const rest = omit(props, 'class', 'aria-label', 'groups', 'value', 'onReselect', 'revealSelected')\n\n return (\n <TabsList\n aria-label={props['aria-label']}\n // The list's state carries the root's orientation, the axis its arrow keys\n // move on; the list reads it here, and the rows read it below.\n render={(part: Record<string, unknown>, state: ListState) => (\n <div\n {...part}\n data-slot=\"settings-navigation\"\n aria-orientation={state.orientation}\n class={cn(\n part.class as string,\n state.orientation === 'horizontal'\n ? // The block padding is the room the focus ring needs: a scroller\n // clips at its padding edge, and this one scrolls sideways only.\n 'scroll-fade w-full flex-row items-center gap-1 overflow-x-auto overflow-y-hidden border-b border-border px-2 py-1.5'\n : 'max-h-full min-h-0 flex-col items-stretch gap-2 overflow-x-hidden overflow-y-auto px-2 py-2',\n props.class\n )}\n />\n )}\n class={cn(\n // Positioned so the visually hidden group names are laid out (and\n // clipped) inside the list: unpositioned, their absolute boxes escape a\n // scrolled strip and widen the page by however far it has scrolled.\n 'relative flex min-w-0 shrink-0 justify-start',\n props.class\n )}\n {...rest}\n >\n {(state: ListState) => (\n <SettingsNavigationGroups {...props} strip={state.orientation === 'horizontal'} />\n )}\n </TabsList>\n )\n}\n\nfunction SettingsNavigationGroups(\n props: Pick<SettingsNavigationProps, 'groups' | 'value' | 'onReselect' | 'revealSelected'> & {\n strip: boolean\n }\n) {\n const triggers = new Map<string, HTMLButtonElement>()\n const groupIdPrefix = `settings-navigation-${createUniqueId()}`\n\n createEffect(\n // Tracks the axis so a rail that becomes a strip (or back) re-reveals on it.\n () => ({ value: props.value, reveal: props.revealSelected, strip: props.strip }),\n ({ value, reveal }) => {\n if (reveal === false) return\n\n const revealCurrent = () => {\n const trigger = triggers.get(value)\n if (typeof reveal === 'function') reveal(trigger)\n else if (trigger) revealNearest(trigger)\n }\n\n revealCurrent()\n // A window drag fires resize per pointer move; one reveal per frame is enough.\n let frame = 0\n const onResize = () => {\n if (frame) return\n frame = requestAnimationFrame(() => {\n frame = 0\n revealCurrent()\n })\n }\n window.addEventListener('resize', onResize)\n return () => {\n window.removeEventListener('resize', onResize)\n if (frame) cancelAnimationFrame(frame)\n }\n }\n )\n\n return (\n <>\n {props.groups.map((group, groupIndex) => {\n const groupId = `${groupIdPrefix}-group-${groupIndex}`\n return (\n <div\n role=\"none\"\n data-slot=\"settings-navigation-group\"\n class={cn(\n 'flex gap-0.5',\n props.strip\n ? 'shrink-0 flex-row items-center not-first:ms-1 not-first:border-s not-first:border-border not-first:ps-2'\n : 'min-w-0 flex-col'\n )}\n >\n <span id={groupId} class=\"sr-only\">\n {group.label}\n </span>\n <Show when={!props.strip}>\n {/* The overline role on the sidebar's own muted foreground. */}\n <Text\n variant=\"overline\"\n tone=\"inherit\"\n aria-hidden=\"true\"\n class=\"px-2 py-1.5 text-sidebar-muted-foreground\"\n >\n {group.label}\n </Text>\n </Show>\n {group.items.map((item) => (\n <TabsTrigger\n // The row keeps its own slot over the tab's `tabs-trigger`.\n render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}\n aria-describedby={groupId}\n value={item.value}\n disabled={item.disabled}\n ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}\n onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'h-row-lg justify-start border-0 px-3 py-2 text-left text-foreground data-[selected]:bg-primary-subtle',\n props.strip ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !props.strip })}>{item.label}</span>\n </TabsTrigger>\n ))}\n </div>\n )\n })}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,SAAS,UAAU,OAAwB;CACzC,OAAO,UAAU,UAAU,UAAU;AACvC;;AAGA,SAAS,aAAa,OAAe,KAAa,KAAa,KAAqB;CAClF,IAAI,QAAQ,KAAK,OAAO,QAAQ;CAChC,IAAI,MAAM,KAAK,OAAO,MAAM;CAC5B,OAAO;AACT;;;;;;;;;;;;;;AAeA,SAAS,cAAc,KAAwB;CAC7C,MAAM,YAAgF,CAAC;CACvF,KAAK,IAAI,YAAY,IAAI,eAAe,WAAW,YAAY,UAAU,eAAe;EACtF,MAAM,QAAQ,OAAO,iBAAiB,SAAS;EAC/C,MAAM,IAAI,UAAU,MAAM,SAAS;EACnC,MAAM,IAAI,UAAU,MAAM,SAAS;EACnC,IAAI,KAAK,GAAG,UAAU,KAAK;GAAE;GAAW;GAAG;GAAG,KAAK,UAAU,sBAAsB;EAAE,CAAC;CACxF;CACA,IAAI,UAAU,WAAW,GAAG;CAC5B,MAAM,SAAS,IAAI,sBAAsB;CACzC,IAAI,OAAO,OAAO;CAClB,IAAI,QAAQ,OAAO;CACn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A,CAAA,MAAA,EAAM,aAAA,8BAAA,CAAA,GAAA,KAAA;MAAlB,OAAA;KAA2D,EAAA,CAAA;KAE7D,oBAAkB;KAClB,IAAA,QAAA;MAAO,OAAA,KAAK;KAAK;KACjB,IAAA,WAAA;MAAU,OAAA,KAAK;KAAQ;KACvBC,MAAM,YAA2C;MAC/C,IAAI,SAAS,SAAS,IAAI,KAAK,OAAO,OAAO;WACxC,SAAS,OAAO,KAAK,KAAK;KACjC;KACAC,eAAe;MACb,IAAI,MAAM,UAAU,KAAK,OAAO,MAAM,aAAa,KAAK,KAAK;KAC/D;KACA,IAAA,UAAA;MAAO,OAAA,GACL,qBACA,yBAAyB,MACzB,yGACA,MAAM,QAAQ,oBAAoB,QACpC;KAAC;KApBH,IAAA,WAAA;MAqBC,OAAA,CACEC,WAAAA;OAAK,OAAA,KAAA;MAAG,CAAA,UACT;OAA0E,IAAA,QAAA,QAAA;OAA1E,OAAA,aAAwD;QAAC,OAAA,KAAK;OAAK,CAAO;OAApE,aAAAC,YAAO,GAAG,WAAW,EAAE,UAAU,CAAC,MAAM,MAAM,CAAC,CAAC,IAAhD,KAAA,QAAA;QAAgD,UAAA,OAAA,KAAA,GAAA;;OAAtD,OAAA;MAA0E,EAAA,CAAA,CAD3E;KAEY;IACd,CAAA,CAAA;GAAC,GAlDJN,KAmDK;GAhDH,aAAAM,YAAO,GACL,gBACA,MAAM,QACF,4GACA,kBACN,CAAC,IALD,KAAA,QAAA;IAKC,UAAA,OAAA,KAAA,GAAA;;GATL,OACEN;EAqDJ,CAAC;CAAC,CAAA;AAGR"}
1
+ {"version":3,"file":"settings-navigation.js","names":["<TabsList\n aria-label={props['aria-label']}\n // The list's state carries the root's orientation, the axis its arrow keys\n // move on; the list reads it here, and the rows read it below.\n render={(part: Record<string, unknown>, state: ListState) => (\n <div\n {...part}\n data-slot=\"settings-navigation\"\n aria-orientation={state.orientation}\n class={cn(\n part.class as string,\n state.orientation === 'horizontal'\n ? // The block padding is the room the focus ring needs: a scroller\n // clips at its padding edge, and this one scrolls sideways only.\n 'scroll-fade w-full flex-row items-center gap-1 overflow-x-auto overflow-y-hidden border-b border-border px-2 py-1.5'\n : 'max-h-full min-h-0 flex-col items-stretch gap-2 overflow-x-hidden overflow-y-auto px-2 py-2',\n props.class\n )}\n />\n )}\n class={cn(\n // Positioned so the visually hidden group names are laid out (and\n // clipped) inside the list: unpositioned, their absolute boxes escape a\n // scrolled strip and widen the page by however far it has scrolled.\n 'relative flex min-w-0 shrink-0 justify-start',\n props.class\n )}\n {...rest}\n >\n {(state: ListState) => (\n <SettingsNavigationGroups {...props} strip={state.orientation === 'horizontal'} />\n )}\n </TabsList>","render={(part: Record<string, unknown>, state: ListState) => (\n <div\n {...part}\n data-slot=\"settings-navigation\"\n aria-orientation={state.orientation}\n class={cn(\n part.class as string,\n state.orientation === 'horizontal'\n ? // The block padding is the room the focus ring needs: a scroller\n // clips at its padding edge, and this one scrolls sideways only.\n 'scroll-fade w-full flex-row items-center gap-1 overflow-x-auto overflow-y-hidden border-b border-border px-2 py-1.5'\n : 'max-h-full min-h-0 flex-col items-stretch gap-2 overflow-x-hidden overflow-y-auto px-2 py-2',\n props.class\n )}\n />\n )}","<SettingsNavigationGroups {...props} strip={state.orientation === 'horizontal'} />","{props.groups.map((group, groupIndex) => {\n const groupId = `${groupIdPrefix}-group-${groupIndex}`\n return (\n <div\n role=\"none\"\n data-slot=\"settings-navigation-group\"\n class={cn(\n 'flex gap-0.5',\n props.strip\n ? 'shrink-0 flex-row items-center not-first:ms-1 not-first:border-s not-first:border-border not-first:ps-2'\n : 'min-w-0 flex-col'\n )}\n >\n <span id={groupId} class=\"sr-only\">\n {group.label}\n </span>\n <Show when={!props.strip}>\n {/* The overline role on the sidebar's own muted foreground. */}\n <Text\n variant=\"overline\"\n tone=\"inherit\"\n aria-hidden=\"true\"\n class=\"px-2 py-1.5 text-sidebar-muted-foreground\"\n >\n {group.label}\n </Text>\n </Show>\n {group.items.map((item) => (\n <TabsTrigger\n // The row keeps its own slot over the tab's `tabs-trigger`.\n render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}\n aria-describedby={groupId}\n value={item.value}\n disabled={item.disabled}\n ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}\n onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'h-row-lg justify-start border-0 px-3 py-2 text-left text-foreground data-[selected]:bg-primary-subtle',\n props.strip ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !props.strip })}>{item.label}</span>\n </TabsTrigger>\n ))}\n </div>\n )\n })}","<Text\n variant=\"overline\"\n tone=\"inherit\"\n aria-hidden=\"true\"\n class=\"px-2 py-1.5 text-sidebar-muted-foreground\"\n >\n {group.label}\n </Text>","variant=\"overline\"","tone=\"inherit\"","class=\"px-2 py-1.5 text-sidebar-muted-foreground\"","<div\n role=\"none\"\n data-slot=\"settings-navigation-group\"\n class={cn(\n 'flex gap-0.5',\n props.strip\n ? 'shrink-0 flex-row items-center not-first:ms-1 not-first:border-s not-first:border-border not-first:ps-2'\n : 'min-w-0 flex-col'\n )}\n >\n <span id={groupId} class=\"sr-only\">\n {group.label}\n </span>\n <Show when={!props.strip}>\n {/* The overline role on the sidebar's own muted foreground. */}\n <Text\n variant=\"overline\"\n tone=\"inherit\"\n aria-hidden=\"true\"\n class=\"px-2 py-1.5 text-sidebar-muted-foreground\"\n >\n {group.label}\n </Text>\n </Show>\n {group.items.map((item) => (\n <TabsTrigger\n // The row keeps its own slot over the tab's `tabs-trigger`.\n render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}\n aria-describedby={groupId}\n value={item.value}\n disabled={item.disabled}\n ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}\n onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'h-row-lg justify-start border-0 px-3 py-2 text-left text-foreground data-[selected]:bg-primary-subtle',\n props.strip ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !props.strip })}>{item.label}</span>\n </TabsTrigger>\n ))}\n </div>","<TabsTrigger\n // The row keeps its own slot over the tab's `tabs-trigger`.\n render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}\n aria-describedby={groupId}\n value={item.value}\n disabled={item.disabled}\n ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}\n onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'h-row-lg justify-start border-0 px-3 py-2 text-left text-foreground data-[selected]:bg-primary-subtle',\n props.strip ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !props.strip })}>{item.label}</span>\n </TabsTrigger>","render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}","ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}","onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}","item.icon","_$readShallow"],"sources":["../../../../src/components/composites/settings/settings-navigation.tsx"],"sourcesContent":["import type { JSX } from '@solidjs/web'\nimport { createEffect, createUniqueId, Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport {\n sidebarNavItemClass,\n sidebarNavItemStateClass,\n} from '../../layout/sidebar-nav/sidebar-nav-classes'\nimport { TabsList, TabsTrigger, type TabsListProps } from '../../ui/tabs'\nimport { Text } from '../../ui/typography'\n\n/** One host-owned destination in a settings tab list. Values must be unique. */\nexport type SettingsNavigationItem = {\n value: string\n label: string\n icon?: JSX.Element\n disabled?: boolean\n}\n\n/** A visible, accessibly named group of settings destinations. */\nexport type SettingsNavigationGroup = {\n label: string\n items: readonly SettingsNavigationItem[]\n}\n\nexport type SettingsNavigationProps = Omit<\n TabsListProps,\n 'appearance' | 'children' | 'orientation'\n> & {\n /** Groups are presentation only; the host owns the tab values and panels. */\n groups: readonly SettingsNavigationGroup[]\n /** The same controlled value supplied to the enclosing `Tabs`. */\n value: string\n /** Called when the already-selected destination is activated again. */\n onReselect?: (value: string) => void\n /** Reveal the selected row on value changes and window resizes. Defaults to nearest scrolling\n * of the ancestors that expose a scroll affordance; hidden-overflow ancestors never move. */\n revealSelected?:\n | boolean\n | ((\n trigger: HTMLButtonElement | undefined\n ) => void) /** Every tab list needs a label independent of its visible group headings. */\n 'aria-label': string\n}\n\n/**\n * SettingsNavigation.\n *\n * A grouped vertical tab list for sibling settings panels. It composes the\n * shared Tabs behaviour with the shared sidebar row recipe; the host supplies\n * the controlled value, panel content, icons and any persistence or routing.\n * Use ordinary tabs for a short, ungrouped row of view choices.\n *\n * The shape follows the enclosing `Tabs` orientation rather than a prop of its\n * own, so the visual axis can never disagree with the arrow keys the tabs\n * bind: `vertical` is the grouped rail, `horizontal` is a single scrollable\n * strip of tabs (what `SettingsLayout` shows below 48rem). The strip keeps the\n * groups in order, separated by a rule; their visible headings drop out, since\n * an overline between tabs reads as another tab, but each tab still carries its\n * group as its accessible description.\n *\n * ui-sdk's Tabs own roving focus, arrow keys, selection and tab/panel ARIA. This\n * component adds no URL, storage or host-specific state. Set\n * `revealSelected={false}` when the surrounding layout does not use an internal\n * scrolling viewport.\n */\nfunction scrollsOn(value: string): boolean {\n return value === 'auto' || value === 'scroll'\n}\n\n/**\n * The nearest-edge delta that brings `[start, end]` inside `[min, max]`. A range longer than\n * the viewport cannot fit, so it aligns its leading edge (`leadingEnd` for a right-to-left\n * inline axis), where the label starts. Settling on whichever edge overflows instead flips\n * between the two on every reveal: a row-forced strip's full-width rows are wider than its\n * scroller, so each reveal of the same row moved it the other way and the row's position\n * depended on how many reveals had run, leaving it scrolled out of view half the time.\n */\nfunction nearestDelta(\n start: number,\n end: number,\n min: number,\n max: number,\n leadingEnd = false\n): number {\n if (end - start > max - min) return leadingEnd ? end - max : start - min\n if (start < min) return start - min\n if (end > max) return end - max\n return 0\n}\n\n/**\n * Reveal by scrolling only the ancestors that expose a scroll affordance\n * (`auto` or `scroll`), by the exact nearest-edge delta. `scrollIntoView` also\n * pans `overflow: hidden` ancestors, which are programmatically scrollable but\n * give the user no way back, so one over-pan left earlier rows permanently\n * clipped outside the viewport with no scroll to recover them (#182).\n *\n * All reads happen before any write. Reading a box after a `scrollTop` write\n * forces a fresh layout, and walking the ancestors that way laid the page out\n * once per ancestor on every open (52 ms of forced layout at 4x CPU in the\n * Cortana audit). The row box is read once and shifted by each inner scroll,\n * which is exactly where the browser would report it after that write.\n */\nfunction revealNearest(row: HTMLElement): void {\n const scrollers: {\n container: HTMLElement\n x: boolean\n y: boolean\n rtl: boolean\n box: DOMRect\n }[] = []\n for (let container = row.parentElement; container; container = container.parentElement) {\n const style = window.getComputedStyle(container)\n const x = scrollsOn(style.overflowX)\n const y = scrollsOn(style.overflowY)\n if (x || y)\n scrollers.push({\n container,\n x,\n y,\n rtl: style.direction === 'rtl',\n box: container.getBoundingClientRect(),\n })\n }\n if (scrollers.length === 0) return\n const rowBox = row.getBoundingClientRect()\n let left = rowBox.left\n let right = rowBox.right\n let top = rowBox.top\n let bottom = rowBox.bottom\n const writes: { container: HTMLElement; dx: number; dy: number }[] = []\n for (const { container, x, y, rtl, box } of scrollers) {\n const dx = x ? nearestDelta(left, right, box.left, box.right, rtl) : 0\n const dy = y ? nearestDelta(top, bottom, box.top, box.bottom) : 0\n if (dx === 0 && dy === 0) continue\n writes.push({ container, dx, dy })\n left -= dx\n right -= dx\n top -= dy\n bottom -= dy\n }\n for (const { container, dx, dy } of writes) {\n if (dx !== 0) container.scrollLeft += dx\n if (dy !== 0) container.scrollTop += dy\n }\n}\n\ntype ListState = { orientation: 'horizontal' | 'vertical' }\n\nexport function SettingsNavigation(props: SettingsNavigationProps) {\n const rest = omit(props, 'class', 'aria-label', 'groups', 'value', 'onReselect', 'revealSelected')\n\n return (\n <TabsList\n aria-label={props['aria-label']}\n // The list's state carries the root's orientation, the axis its arrow keys\n // move on; the list reads it here, and the rows read it below.\n render={(part: Record<string, unknown>, state: ListState) => (\n <div\n {...part}\n data-slot=\"settings-navigation\"\n aria-orientation={state.orientation}\n class={cn(\n part.class as string,\n state.orientation === 'horizontal'\n ? // The block padding is the room the focus ring needs: a scroller\n // clips at its padding edge, and this one scrolls sideways only.\n 'scroll-fade w-full flex-row items-center gap-1 overflow-x-auto overflow-y-hidden border-b border-border px-2 py-1.5'\n : 'max-h-full min-h-0 flex-col items-stretch gap-2 overflow-x-hidden overflow-y-auto px-2 py-2',\n props.class\n )}\n />\n )}\n class={cn(\n // Positioned so the visually hidden group names are laid out (and\n // clipped) inside the list: unpositioned, their absolute boxes escape a\n // scrolled strip and widen the page by however far it has scrolled.\n 'relative flex min-w-0 shrink-0 justify-start',\n props.class\n )}\n {...rest}\n >\n {(state: ListState) => (\n <SettingsNavigationGroups {...props} strip={state.orientation === 'horizontal'} />\n )}\n </TabsList>\n )\n}\n\nfunction SettingsNavigationGroups(\n props: Pick<SettingsNavigationProps, 'groups' | 'value' | 'onReselect' | 'revealSelected'> & {\n strip: boolean\n }\n) {\n const triggers = new Map<string, HTMLButtonElement>()\n const groupIdPrefix = `settings-navigation-${createUniqueId()}`\n\n createEffect(\n // Tracks the axis so a rail that becomes a strip (or back) re-reveals on it.\n () => ({ value: props.value, reveal: props.revealSelected, strip: props.strip }),\n ({ value, reveal }) => {\n if (reveal === false) return\n\n const revealCurrent = () => {\n const trigger = triggers.get(value)\n if (typeof reveal === 'function') reveal(trigger)\n else if (trigger) revealNearest(trigger)\n }\n\n revealCurrent()\n // A window drag fires resize per pointer move; one reveal per frame is enough.\n let frame = 0\n const onResize = () => {\n if (frame) return\n frame = requestAnimationFrame(() => {\n frame = 0\n revealCurrent()\n })\n }\n window.addEventListener('resize', onResize)\n return () => {\n window.removeEventListener('resize', onResize)\n if (frame) cancelAnimationFrame(frame)\n }\n }\n )\n\n return (\n <>\n {props.groups.map((group, groupIndex) => {\n const groupId = `${groupIdPrefix}-group-${groupIndex}`\n return (\n <div\n role=\"none\"\n data-slot=\"settings-navigation-group\"\n class={cn(\n 'flex gap-0.5',\n props.strip\n ? 'shrink-0 flex-row items-center not-first:ms-1 not-first:border-s not-first:border-border not-first:ps-2'\n : 'min-w-0 flex-col'\n )}\n >\n <span id={groupId} class=\"sr-only\">\n {group.label}\n </span>\n <Show when={!props.strip}>\n {/* The overline role on the sidebar's own muted foreground. */}\n <Text\n variant=\"overline\"\n tone=\"inherit\"\n aria-hidden=\"true\"\n class=\"px-2 py-1.5 text-sidebar-muted-foreground\"\n >\n {group.label}\n </Text>\n </Show>\n {group.items.map((item) => (\n <TabsTrigger\n // The row keeps its own slot over the tab's `tabs-trigger`.\n render={(part: Record<string, unknown>) => (\n <button {...part} data-slot=\"settings-navigation-trigger\" />\n )}\n aria-describedby={groupId}\n value={item.value}\n disabled={item.disabled}\n ref={(element: HTMLButtonElement | undefined) => {\n if (element) triggers.set(item.value, element)\n else triggers.delete(item.value)\n }}\n onClick={() => {\n if (props.value === item.value) props.onReselect?.(item.value)\n }}\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'h-row-lg justify-start border-0 px-3 py-2 text-left text-foreground data-[selected]:bg-primary-subtle',\n props.strip ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !props.strip })}>{item.label}</span>\n </TabsTrigger>\n ))}\n </div>\n )\n })}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,SAAS,UAAU,OAAwB;C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,WAAAA;OAAK,OAAA,KAAA;MAAG,CAAA,UACT;OAA0E,IAAA,QAAA,QAAA;OAA1E,OAAA,aAAwD;QAAC,OAAA,KAAK;OAAK,CAAO;OAApE,aAAAC,YAAO,GAAG,WAAW,EAAE,UAAU,CAAC,MAAM,MAAM,CAAC,CAAC,IAAhD,KAAA,QAAA;QAAgD,UAAA,OAAA,KAAA,GAAA;;OAAtD,OAAA;MAA0E,EAAA,CAAA,CAD3E;KAEY;IACd,CAAA,CAAA;GAAC,GAlDJN,KAmDK;GAhDH,aAAAM,YAAO,GACL,gBACA,MAAM,QACF,4GACA,kBACN,CAAC,IALD,KAAA,QAAA;IAKC,UAAA,OAAA,KAAA,GAAA;;GATL,OACEN;EAqDJ,CAAC;CAAC,CAAA;AAGR"}
@@ -19,6 +19,15 @@ export declare function shouldSuppressTooltipFocus(input: {
19
19
  isButtonLike: boolean;
20
20
  keyboardIntentActive: boolean;
21
21
  }): boolean;
22
+ /**
23
+ * Whether a `pointermove` comes from a pointer that moved, rather than one a
24
+ * browser dispatched at the same position because content scrolled under it.
25
+ * An event without movement fields counts as travel.
26
+ */
27
+ export declare function pointerMoveTravelled(event: {
28
+ movementX?: number;
29
+ movementY?: number;
30
+ }): boolean;
22
31
  /**
23
32
  * Install the gate on a document. Idempotent per document; returns a disposer
24
33
  * that removes the listeners (used by tests and by the tooltip root, which
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-focus-gate.d.ts","sourceRoot":"","sources":["../../src/lib/tooltip-focus-gate.ts"],"names":[],"mappings":"AA6EA;;;2BAG2B;AAC3B,eAAO,MAAM,8BAA8B,MAAM,CAAA;AAiBjD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAOhE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,YAAY,EAAE,OAAO,CAAA;IACrB,oBAAoB,EAAE,OAAO,CAAA;CAC9B,GAAG,OAAO,CAEV;AAID;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,QAAmB,GAAG,MAAM,IAAI,CA8E5E;AAWD,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,IAAI,CAMlE;AAED,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,IAAI,CAYlE"}
1
+ {"version":3,"file":"tooltip-focus-gate.d.ts","sourceRoot":"","sources":["../../src/lib/tooltip-focus-gate.ts"],"names":[],"mappings":"AAqFA;;;2BAG2B;AAC3B,eAAO,MAAM,8BAA8B,MAAM,CAAA;AAiBjD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAOhE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,YAAY,EAAE,OAAO,CAAA;IACrB,oBAAoB,EAAE,OAAO,CAAA;CAC9B,GAAG,OAAO,CAEV;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAI/F;AAID;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,QAAmB,GAAG,MAAM,IAAI,CAgF5E;AAWD,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,IAAI,CAMlE;AAED,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,IAAI,CAYlE"}
@@ -38,6 +38,16 @@ function isButtonLikeFocusTarget(target) {
38
38
  function shouldSuppressTooltipFocus(input) {
39
39
  return input.isButtonLike && !input.keyboardIntentActive;
40
40
  }
41
+ /**
42
+ * Whether a `pointermove` comes from a pointer that moved, rather than one a
43
+ * browser dispatched at the same position because content scrolled under it.
44
+ * An event without movement fields counts as travel.
45
+ */
46
+ function pointerMoveTravelled(event) {
47
+ const { movementX, movementY } = event;
48
+ if (typeof movementX !== "number" || typeof movementY !== "number") return true;
49
+ return movementX !== 0 || movementY !== 0;
50
+ }
41
51
  var installedDocuments = /* @__PURE__ */ new WeakSet();
42
52
  /**
43
53
  * Install the gate on a document. Idempotent per document; returns a disposer
@@ -102,7 +112,9 @@ function installTooltipFocusGate(doc = document) {
102
112
  if (doc.activeElement !== phantom) return;
103
113
  if (typeof phantom.blur === "function") phantom.blur();
104
114
  };
105
- const onPointerMove = () => releasePhantomFocus();
115
+ const onPointerMove = (event) => {
116
+ if (pointerMoveTravelled(event)) releasePhantomFocus();
117
+ };
106
118
  doc.addEventListener("keydown", onKeyDown, true);
107
119
  doc.addEventListener("focus", onFocus, true);
108
120
  doc.addEventListener("pointerdown", onPointerDown, true);
@@ -147,6 +159,6 @@ function releaseTooltipFocusGate(targetDoc) {
147
159
  }
148
160
  gateHolders.set(doc, holders - 1);
149
161
  }
150
- export { TOOLTIP_FOCUS_INTENT_WINDOW_MS, acquireTooltipFocusGate, installTooltipFocusGate, isButtonLikeFocusTarget, isTabFocusTarget, releaseTooltipFocusGate, shouldSuppressTooltipFocus };
162
+ export { TOOLTIP_FOCUS_INTENT_WINDOW_MS, acquireTooltipFocusGate, installTooltipFocusGate, isButtonLikeFocusTarget, isTabFocusTarget, pointerMoveTravelled, releaseTooltipFocusGate, shouldSuppressTooltipFocus };
151
163
 
152
164
  //# sourceMappingURL=tooltip-focus-gate.js.map