@adea-ai/ui 0.152.1 → 0.152.3
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.
- package/dist/components/composites/about-dialog/about-dialog.js +2 -2
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +3 -3
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +3 -0
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js +1 -1
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +3 -3
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +3 -3
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/atomic/chat-composer.js.map +1 -1
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.js.map +1 -1
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +1 -1
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js.map +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-pane/pixel-pane.js.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +1 -1
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts.map +1 -1
- package/dist/components/theme/appearance-panel.js +1 -1
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider.js.map +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/value-combobox.js.map +1 -1
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.js.map +1 -1
- package/dist/r/about-dialog.json +1 -1
- package/dist/r/accordion.json +1 -1
- package/dist/r/account-menu.json +1 -1
- package/dist/r/alert.json +1 -1
- package/dist/r/appearance-editor.json +1 -1
- package/dist/r/attachment.json +1 -1
- package/dist/r/breadcrumb.json +1 -1
- package/dist/r/calendar.json +1 -1
- package/dist/r/carousel.json +1 -1
- package/dist/r/catalog-browser.json +1 -1
- package/dist/r/chain-of-thought.json +1 -1
- package/dist/r/chat.json +1 -1
- package/dist/r/checkbox.json +1 -1
- package/dist/r/checkpoint.json +1 -1
- package/dist/r/code-block.json +1 -1
- package/dist/r/combobox.json +1 -1
- package/dist/r/command.json +1 -1
- package/dist/r/confirmation.json +1 -1
- package/dist/r/context.json +1 -1
- package/dist/r/conversation.json +1 -1
- package/dist/r/detail-panel.json +1 -1
- package/dist/r/dialog.json +1 -1
- package/dist/r/dropdown-menu.json +1 -1
- package/dist/r/empty.json +1 -1
- package/dist/r/file-tree.json +1 -1
- package/dist/r/floating-preview.json +1 -1
- package/dist/r/help-center.json +1 -1
- package/dist/r/icon-picker.json +1 -1
- package/dist/r/inline-citation.json +1 -1
- package/dist/r/lib.json +1 -1
- package/dist/r/message-scroller.json +1 -1
- package/dist/r/model-selector.json +1 -1
- package/dist/r/native-select.json +1 -1
- package/dist/r/navigation-menu.json +1 -1
- package/dist/r/pagination.json +1 -1
- package/dist/r/pixel-resize-handle.json +1 -1
- package/dist/r/plan.json +1 -1
- package/dist/r/questionnaire.json +1 -1
- package/dist/r/queue.json +1 -1
- package/dist/r/radio-group.json +1 -1
- package/dist/r/reasoning.json +1 -1
- package/dist/r/registry.json +65 -65
- package/dist/r/resizable.json +1 -1
- package/dist/r/scene-controls.json +1 -1
- package/dist/r/select.json +1 -1
- package/dist/r/settings.json +1 -1
- package/dist/r/sheet.json +1 -1
- package/dist/r/shell-rail.json +1 -1
- package/dist/r/sidebar-nav.json +1 -1
- package/dist/r/sources.json +1 -1
- package/dist/r/spinner.json +1 -1
- package/dist/r/split-layout.json +1 -1
- package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +2 -2
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -1
- package/dist/r/src/components/composites/terminal/terminal.tsx +2 -2
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +3 -3
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +3 -5
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
- package/dist/r/src/components/conversation/message-composer.tsx +1 -2
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +1 -1
- package/dist/r/src/components/theme/appearance-panel.tsx +2 -4
- package/dist/r/stack-trace.json +1 -1
- package/dist/r/stat.json +1 -1
- package/dist/r/subagent.json +1 -1
- package/dist/r/task.json +1 -1
- package/dist/r/terminal.json +1 -1
- package/dist/r/test-results.json +1 -1
- package/dist/r/theming.json +1 -1
- package/dist/r/toast.json +1 -1
- package/dist/r/tool.json +1 -1
- package/dist/r/top-bar.json +1 -1
- package/dist/r/trace.json +1 -1
- package/dist/r/tree.json +1 -1
- package/dist/r/update-dialog.json +1 -1
- package/dist/r/workspace-switcher.json +1 -1
- package/dist/vite/tailwind-sources.d.ts.map +1 -1
- package/dist/vite/tailwind-sources.js +49 -9
- package/dist/vite/tailwind-sources.js.map +1 -1
- package/package.json +11 -11
- package/registry.json +65 -65
- package/src/components/composites/about-dialog/about-dialog.tsx +2 -2
- package/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
- package/src/components/composites/model-selector/model-selector.tsx +4 -1
- package/src/components/composites/terminal/terminal.tsx +2 -2
- package/src/components/composites/update-dialog/channel-control.tsx +3 -3
- package/src/components/composites/update-dialog/update-dialog.tsx +3 -5
- package/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
- package/src/components/conversation/message-composer.tsx +1 -2
- package/src/components/layout/split-layout/split-layout.tsx +1 -1
- package/src/components/theme/appearance-panel.tsx +2 -4
- package/src/vite/tailwind-sources.ts +67 -7
|
@@ -348,6 +348,9 @@ function ModelSearch(props) {
|
|
|
348
348
|
get children() {
|
|
349
349
|
return createComponent(Command, {
|
|
350
350
|
label: "Choose a model",
|
|
351
|
+
get defaultValue() {
|
|
352
|
+
return memo(() => !!props.selected)() ? modelSearchValue(props.selected).trim() : void 0;
|
|
353
|
+
},
|
|
351
354
|
get children() {
|
|
352
355
|
return [createComponent(CommandInput, { placeholder: "Search models" }), createComponent(CommandList, { get children() {
|
|
353
356
|
return [createComponent(CommandEmpty, { children: "No model matches." }), createComponent(For, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-selector.js","names":["Brain","Check","ChevronsUpDown","createEffect","createMemo","createSignal","createUniqueId","For","Show","splitProps","cn","Button","Command","CommandEmpty","CommandGroup","CommandInput","CommandItem","CommandList","DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuLabel","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuTrigger","Popover","PopoverContent","PopoverTrigger","REASON_TEXT_LIMIT","boundText","findModel","groupModels","modelSearchValue","needsSearch","normalizeEfforts","resolveEffort","ModelOption","ModelSelectorProps","models","value","effort","onChange","id","onEffortChange","searchThreshold","disabledReason","label","class","ModelSelector","props","local","blocked","undefined","selected","efforts","effortChoice","reason","reasonId","describedBy","_el$","_tmpl$2","_el$2","firstChild","_$insert","_$createComponent","when","fallback","children","_el$4","_tmpl$3","_el$5","triggerText","length","ModelMenu","ModelSearch","choice","_el$6","_tmpl$4","_el$7","EffortMenu","_el$3","_tmpl$","_$setAttribute","_$effect","_p$","_v$","_v$2","e","_$className","t","ModelOptionBody","model","_el$8","_tmpl$7","_el$9","description","_el$0","_tmpl$5","_el$1","_tmpl$6","_el$10","PickerProps","ModelTrigger","empty","_el$11","_tmpl$8","_c$","_$memo","open","setOpen","groups","inert","onOpenChange","next","placement","gutter","as","variant","size","aria-label","aria-disabled","aria-describedby","hideArrow","each","group","provider","disabled","placeholder","heading","onSelect","_tmpl$9","ReturnType","find","_el$13","_tmpl$0","_el$14","_tmpl$1","_el$15","_el$16","_$createComponent","_$className","_$setAttribute","_$memo"],"sources":["../../../../src/components/composites/model-selector/model-selector.tsx"],"sourcesContent":["import { Brain, Check, ChevronsUpDown } from 'lucide-solid'\nimport {\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n For,\n Show,\n splitProps,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from '../../ui/command'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport { REASON_TEXT_LIMIT, boundText } from '#lib/text'\nimport {\n findModel,\n groupModels,\n modelSearchValue,\n needsSearch,\n normalizeEfforts,\n resolveEffort,\n type ModelOption,\n} from './models'\n\n/**\n * ModelSelector.\n *\n * Two controls in one group beside the composer: *which model*, and *how hard it\n * thinks*. They are one component because the second depends on the first — an\n * effort level belongs to a model, and switching model can make the chosen effort\n * meaningless — so a host should not have to keep two menus consistent by hand.\n *\n * ## What it takes and what it will not decide\n *\n * `models` carries each option's provider, optional description and optional\n * `disabledReason`; `value` and `effort` are the current choice; `onChange` and\n * `onEffortChange` report a new one. The component holds no selection of its own\n * (the host may veto, persist or reset it) and never decides what is allowed:\n *\n * - **An unavailable model stays in the list**, disabled, with the host's reason\n * beside it in words. Hiding it would leave the person guessing where it went.\n * - **No `onChange`, no menu.** The model is then plain text — a read-only\n * statement of what is running — not a button that does nothing. The same holds\n * for effort and `onEffortChange`.\n * - **Effort renders only when the selected model advertises `efforts`.** A model\n * that does not has no effort control, and a stored `effort` the model does not\n * offer is shown as unset rather than as a level the model never had.\n * - **A `value` that is not in the list is shown as given**, not swapped for a\n * model the person did not choose.\n * - `disabledReason` disables both and says why under the group.\n *\n * ## Short list or long\n *\n * Up to `searchThreshold` models (7) the model picker is a `DropdownMenu` with\n * radio rows grouped by provider: arrows, typeahead and Escape come from the menu\n * contract. Beyond it the list is a `Popover` holding a `Command` palette with a\n * search box, because scanning thirty rows is slower than typing four letters.\n * Both close on choice and return focus to the trigger. Triggers use\n * `aria-disabled` so a blocked control is still reachable and its reason read.\n */\nexport type ModelSelectorProps = {\n models: readonly ModelOption[]\n /** The selected model's id. */\n value?: string\n /** The selected effort's id. */\n effort?: string\n onChange?: (id: string) => void\n onEffortChange?: (effort: string) => void\n /** Show a search box above this many models. Default 7. */\n searchThreshold?: number\n /** Why neither control can be used right now. */\n disabledReason?: string\n /** The group's accessible name. */\n label?: string\n class?: string\n}\n\nexport function ModelSelector(props: ModelSelectorProps) {\n const [local] = splitProps(props, [\n 'models',\n 'value',\n 'effort',\n 'onChange',\n 'onEffortChange',\n 'searchThreshold',\n 'disabledReason',\n 'label',\n 'class',\n ])\n const blocked = () => local.disabledReason !== undefined\n const selected = () => findModel(local.models, local.value)\n const efforts = createMemo(() => normalizeEfforts(selected()?.efforts))\n const effortChoice = () => resolveEffort(selected(), local.effort)\n const reason = () =>\n local.disabledReason ? boundText(local.disabledReason, REASON_TEXT_LIMIT) : undefined\n const reasonId = `${createUniqueId()}-reason`\n const describedBy = () => (reason() ? reasonId : undefined)\n\n return (\n <div data-slot=\"model-selector\" class={cn('flex min-w-0 flex-col gap-1', local.class)}>\n <div\n role=\"group\"\n aria-label={local.label ?? 'Model and thinking effort'}\n class=\"flex min-w-0 items-center gap-1\"\n >\n <Show\n when={local.onChange}\n fallback={\n <Show when={local.value}>\n <span class=\"truncate px-2 text-sm text-muted-foreground\">\n <span class=\"visually-hidden\">Model: </span>\n {triggerText({ selected: selected(), value: local.value })}\n </span>\n </Show>\n }\n >\n <Show\n when={needsSearch(local.models.length, local.searchThreshold)}\n fallback={\n <ModelMenu\n models={local.models}\n selected={selected()}\n value={local.value}\n blocked={blocked()}\n describedBy={describedBy()}\n onChange={(id) => local.onChange?.(id)}\n />\n }\n >\n <ModelSearch\n models={local.models}\n selected={selected()}\n value={local.value}\n blocked={blocked()}\n describedBy={describedBy()}\n onChange={(id) => local.onChange?.(id)}\n />\n </Show>\n </Show>\n <Show when={efforts().length > 0}>\n <Show\n when={local.onEffortChange}\n fallback={\n <Show when={effortChoice()}>\n {(choice) => (\n <span class=\"flex items-center gap-1 truncate px-2 text-sm text-muted-foreground\">\n <Brain aria-hidden=\"true\" class=\"size-3.5 shrink-0\" />\n <span class=\"visually-hidden\">Thinking effort: </span>\n {choice().label}\n </span>\n )}\n </Show>\n }\n >\n <EffortMenu\n efforts={efforts()}\n value={effortChoice()?.id}\n blocked={blocked()}\n describedBy={describedBy()}\n onChange={(id) => local.onEffortChange?.(id)}\n />\n </Show>\n </Show>\n </div>\n <Show when={reason()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reason()}\n </p>\n </Show>\n </div>\n )\n}\n\nfunction triggerText(props: { selected?: ModelOption; value?: string }): string {\n if (props.selected) return boundText(props.selected.label, 60)\n return props.value ? boundText(props.value, 60) : 'Choose a model'\n}\n\nfunction ModelOptionBody(props: { model: ModelOption }) {\n return (\n <span class=\"flex min-w-0 flex-col\">\n <span class=\"[overflow-wrap:anywhere]\">{boundText(props.model.label, 60)}</span>\n <Show when={props.model.description}>\n <span class=\"text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {boundText(props.model.description ?? '', 160)}\n </span>\n </Show>\n <Show when={props.model.disabledReason}>\n <span class=\"text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n <span class=\"visually-hidden\">Unavailable: </span>\n {boundText(props.model.disabledReason ?? '', 160)}\n </span>\n </Show>\n </span>\n )\n}\n\ntype PickerProps = {\n models: readonly ModelOption[]\n selected?: ModelOption\n value?: string\n blocked: boolean\n describedBy?: string\n onChange: (id: string) => void\n}\n\nfunction ModelTrigger(props: { selected?: ModelOption; value?: string; empty: boolean }) {\n return (\n <>\n <span class=\"max-w-48 truncate\">\n {props.empty ? 'No models available' : triggerText(props)}\n </span>\n <ChevronsUpDown aria-hidden=\"true\" />\n </>\n )\n}\n\nfunction ModelMenu(props: PickerProps) {\n const [open, setOpen] = createSignal(false)\n const groups = createMemo(() => groupModels(props.models))\n const inert = () => props.blocked || props.models.length === 0\n\n createEffect(() => {\n if (inert()) setOpen(false)\n })\n\n return (\n <DropdownMenu\n open={open()}\n onOpenChange={(next) => setOpen(next && !inert())}\n placement=\"top-start\"\n gutter={6}\n >\n <DropdownMenuTrigger\n as={Button}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Model: ${props.models.length === 0 ? 'No models available' : triggerText(props)}`}\n aria-disabled={inert() || undefined}\n aria-describedby={props.describedBy}\n >\n <ModelTrigger\n selected={props.selected}\n value={props.value}\n empty={props.models.length === 0}\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent hideArrow class=\"w-72 max-w-full\">\n <DropdownMenuRadioGroup\n value={props.value ?? ''}\n onChange={(id: unknown) => {\n // Disabled rows cannot be activated, but the guard is the contract.\n const model = typeof id === 'string' ? findModel(props.models, id) : undefined\n if (!props.blocked && model && model.disabledReason === undefined) {\n props.onChange(model.id)\n }\n }}\n >\n <For each={groups()}>\n {(group) => (\n <DropdownMenuGroup>\n <DropdownMenuLabel>{group.provider}</DropdownMenuLabel>\n <For each={group.models}>\n {(model) => (\n <DropdownMenuRadioItem\n value={model.id}\n disabled={inert() || model.disabledReason !== undefined}\n >\n <ModelOptionBody model={model} />\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuGroup>\n )}\n </For>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\nfunction ModelSearch(props: PickerProps) {\n const [open, setOpen] = createSignal(false)\n const groups = createMemo(() => groupModels(props.models))\n\n createEffect(() => {\n if (props.blocked) setOpen(false)\n })\n\n return (\n <Popover\n open={open()}\n onOpenChange={(next) => setOpen(next && !props.blocked)}\n placement=\"top-start\"\n gutter={6}\n >\n <PopoverTrigger\n as={Button}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Model: ${triggerText(props)}`}\n aria-disabled={props.blocked || undefined}\n aria-describedby={props.describedBy}\n >\n <ModelTrigger selected={props.selected} value={props.value} empty={false} />\n </PopoverTrigger>\n <PopoverContent class=\"w-80 max-w-full\">\n <Command label=\"Choose a model\">\n <CommandInput placeholder=\"Search models\" />\n <CommandList>\n <CommandEmpty>No model matches.</CommandEmpty>\n <For each={groups()}>\n {(group) => (\n <CommandGroup heading={group.provider}>\n <For each={group.models}>\n {(model) => (\n <CommandItem\n value={modelSearchValue(model)}\n disabled={props.blocked || model.disabledReason !== undefined}\n onSelect={() => {\n if (props.blocked || model.disabledReason !== undefined) return\n props.onChange(model.id)\n setOpen(false)\n }}\n >\n <ModelOptionBody model={model} />\n <Show when={model.id === props.value}>\n <Check aria-hidden=\"true\" class=\"ms-auto text-primary\" />\n <span class=\"visually-hidden\">Current model</span>\n </Show>\n </CommandItem>\n )}\n </For>\n </CommandGroup>\n )}\n </For>\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n}\n\nfunction EffortMenu(props: {\n efforts: ReturnType<typeof normalizeEfforts>\n value?: string\n blocked: boolean\n describedBy?: string\n onChange: (id: string) => void\n}) {\n const [open, setOpen] = createSignal(false)\n const label = () => props.efforts.find((effort) => effort.id === props.value)?.label\n\n createEffect(() => {\n if (props.blocked) setOpen(false)\n })\n\n return (\n <DropdownMenu\n open={open()}\n onOpenChange={(next) => setOpen(next && !props.blocked)}\n placement=\"top-start\"\n gutter={6}\n >\n <DropdownMenuTrigger\n as={Button}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Thinking effort: ${label() ?? 'not set'}`}\n aria-disabled={props.blocked || undefined}\n aria-describedby={props.describedBy}\n >\n <Brain aria-hidden=\"true\" />\n <span aria-hidden=\"true\">{label() ?? 'Effort'}</span>\n </DropdownMenuTrigger>\n <DropdownMenuContent hideArrow class=\"w-56 max-w-full\">\n <DropdownMenuRadioGroup\n value={props.value ?? ''}\n onChange={(id: unknown) => {\n if (!props.blocked && typeof id === 'string') props.onChange(id)\n }}\n >\n <DropdownMenuGroup>\n <DropdownMenuLabel>Thinking effort</DropdownMenuLabel>\n <For each={props.efforts}>\n {(effort) => (\n <DropdownMenuRadioItem value={effort.id} disabled={props.blocked}>\n <span class=\"flex min-w-0 flex-col\">\n <span>{effort.label}</span>\n <Show when={effort.description}>\n <span class=\"text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {effort.description}\n </span>\n </Show>\n </span>\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuGroup>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8FA,SAAgBgD,cAAcC,OAA2B;CACvD,MAAM,CAACC,SAASzC,WAAWwC,OAAO;EAChC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CACD,MAAME,gBAAgBD,MAAML,mBAAmBO,KAAAA;CAC/C,MAAMC,iBAAiBvB,UAAUoB,MAAMZ,QAAQY,MAAMX,KAAK;CAC1D,MAAMe,UAAUlD,iBAAiB8B,iBAAiBmB,SAAS,CAAC,EAAEC,OAAO,CAAC;CACtE,MAAMC,qBAAqBpB,cAAckB,SAAS,GAAGH,MAAMV,MAAM;CACjE,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UAAA,IAAAgB,WAAA;WAAA,IAAAoE,SAAAC,QAAA,GAAAC,SAAAF,OAAAzE;WAAAC,OAAA0E,cAErDjG,OAAOM,KAAK;WAAAiB,OAAAwE,QAAAvE,gBAClBxD,MAAI;YAAA,IAACyD,OAAI;aAAA,OAAEzB,OAAOuD;YAAW;YAAA,IAAA5B,WAAA;aAAA,IAAAuE,SAAAzC,QAAA;aAAAlC,OAAA2E,cAEzBlG,OAAOuD,WAAW;aAAA,OAAA2C;YAAA;WAAA,CAAA,GAAA,IAAA;WAAA,OAAAH;UAAA;SAAA,CAAA;QAK5B,CAAA,CAAA;OAAA,EAAA,CAAA;MAAA;KAAA,CAAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAOf"}
|
|
1
|
+
{"version":3,"file":"model-selector.js","names":["Brain","Check","ChevronsUpDown","createEffect","createMemo","createSignal","createUniqueId","For","Show","splitProps","cn","Button","Command","CommandEmpty","CommandGroup","CommandInput","CommandItem","CommandList","DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuLabel","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuTrigger","Popover","PopoverContent","PopoverTrigger","boundText","findModel","groupModels","modelSearchValue","needsSearch","normalizeEfforts","resolveEffort","models","value","effort","onChange","id","onEffortChange","searchThreshold","disabledReason","label","class","ModelSelector","props","local","blocked","undefined","selected","efforts","effortChoice","reason","reasonId","describedBy","_el$","_tmpl$2","_el$2","firstChild","_$insert","_$createComponent","when","fallback","children","_el$4","_tmpl$3","triggerText","length","ModelMenu","ModelSearch","choice","_el$6","_tmpl$4","_el$7","EffortMenu","_el$3","_tmpl$","_$setAttribute","_$effect","_p$","_v$","_v$2","e","_$className","t","ModelOptionBody","model","_el$8","_tmpl$7","_el$9","description","_el$0","_tmpl$5","_el$1","_tmpl$6","ModelTrigger","empty","_el$11","_tmpl$8","_c$","_$memo","open","setOpen","groups","inert","onOpenChange","next","placement","gutter","as","variant","size","hideArrow","each","group","provider","disabled","defaultValue","trim","placeholder","heading","onSelect","_tmpl$9","find","_el$13","_tmpl$0","_el$14","_tmpl$1","_el$15","_el$16"],"sources":["../../../../src/components/composites/model-selector/model-selector.tsx"],"sourcesContent":["import { Brain, Check, ChevronsUpDown } from 'lucide-solid'\nimport {\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n For,\n Show,\n splitProps,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from '../../ui/command'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport { REASON_TEXT_LIMIT, boundText } from '#lib/text'\nimport {\n findModel,\n groupModels,\n modelSearchValue,\n needsSearch,\n normalizeEfforts,\n resolveEffort,\n type ModelOption,\n} from './models'\n\n/**\n * ModelSelector.\n *\n * Two controls in one group beside the composer: *which model*, and *how hard it\n * thinks*. They are one component because the second depends on the first — an\n * effort level belongs to a model, and switching model can make the chosen effort\n * meaningless — so a host should not have to keep two menus consistent by hand.\n *\n * ## What it takes and what it will not decide\n *\n * `models` carries each option's provider, optional description and optional\n * `disabledReason`; `value` and `effort` are the current choice; `onChange` and\n * `onEffortChange` report a new one. The component holds no selection of its own\n * (the host may veto, persist or reset it) and never decides what is allowed:\n *\n * - **An unavailable model stays in the list**, disabled, with the host's reason\n * beside it in words. Hiding it would leave the person guessing where it went.\n * - **No `onChange`, no menu.** The model is then plain text — a read-only\n * statement of what is running — not a button that does nothing. The same holds\n * for effort and `onEffortChange`.\n * - **Effort renders only when the selected model advertises `efforts`.** A model\n * that does not has no effort control, and a stored `effort` the model does not\n * offer is shown as unset rather than as a level the model never had.\n * - **A `value` that is not in the list is shown as given**, not swapped for a\n * model the person did not choose.\n * - `disabledReason` disables both and says why under the group.\n *\n * ## Short list or long\n *\n * Up to `searchThreshold` models (7) the model picker is a `DropdownMenu` with\n * radio rows grouped by provider: arrows, typeahead and Escape come from the menu\n * contract. Beyond it the list is a `Popover` holding a `Command` palette with a\n * search box, because scanning thirty rows is slower than typing four letters.\n * Both close on choice and return focus to the trigger. Triggers use\n * `aria-disabled` so a blocked control is still reachable and its reason read.\n */\nexport type ModelSelectorProps = {\n models: readonly ModelOption[]\n /** The selected model's id. */\n value?: string\n /** The selected effort's id. */\n effort?: string\n onChange?: (id: string) => void\n onEffortChange?: (effort: string) => void\n /** Show a search box above this many models. Default 7. */\n searchThreshold?: number\n /** Why neither control can be used right now. */\n disabledReason?: string\n /** The group's accessible name. */\n label?: string\n class?: string\n}\n\nexport function ModelSelector(props: ModelSelectorProps) {\n const [local] = splitProps(props, [\n 'models',\n 'value',\n 'effort',\n 'onChange',\n 'onEffortChange',\n 'searchThreshold',\n 'disabledReason',\n 'label',\n 'class',\n ])\n const blocked = () => local.disabledReason !== undefined\n const selected = () => findModel(local.models, local.value)\n const efforts = createMemo(() => normalizeEfforts(selected()?.efforts))\n const effortChoice = () => resolveEffort(selected(), local.effort)\n const reason = () =>\n local.disabledReason ? boundText(local.disabledReason, REASON_TEXT_LIMIT) : undefined\n const reasonId = `${createUniqueId()}-reason`\n const describedBy = () => (reason() ? reasonId : undefined)\n\n return (\n <div data-slot=\"model-selector\" class={cn('flex min-w-0 flex-col gap-1', local.class)}>\n <div\n role=\"group\"\n aria-label={local.label ?? 'Model and thinking effort'}\n class=\"flex min-w-0 items-center gap-1\"\n >\n <Show\n when={local.onChange}\n fallback={\n <Show when={local.value}>\n <span class=\"truncate px-2 text-sm text-muted-foreground\">\n <span class=\"visually-hidden\">Model: </span>\n {triggerText({ selected: selected(), value: local.value })}\n </span>\n </Show>\n }\n >\n <Show\n when={needsSearch(local.models.length, local.searchThreshold)}\n fallback={\n <ModelMenu\n models={local.models}\n selected={selected()}\n value={local.value}\n blocked={blocked()}\n describedBy={describedBy()}\n onChange={(id) => local.onChange?.(id)}\n />\n }\n >\n <ModelSearch\n models={local.models}\n selected={selected()}\n value={local.value}\n blocked={blocked()}\n describedBy={describedBy()}\n onChange={(id) => local.onChange?.(id)}\n />\n </Show>\n </Show>\n <Show when={efforts().length > 0}>\n <Show\n when={local.onEffortChange}\n fallback={\n <Show when={effortChoice()}>\n {(choice) => (\n <span class=\"flex items-center gap-1 truncate px-2 text-sm text-muted-foreground\">\n <Brain aria-hidden=\"true\" class=\"size-3.5 shrink-0\" />\n <span class=\"visually-hidden\">Thinking effort: </span>\n {choice().label}\n </span>\n )}\n </Show>\n }\n >\n <EffortMenu\n efforts={efforts()}\n value={effortChoice()?.id}\n blocked={blocked()}\n describedBy={describedBy()}\n onChange={(id) => local.onEffortChange?.(id)}\n />\n </Show>\n </Show>\n </div>\n <Show when={reason()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reason()}\n </p>\n </Show>\n </div>\n )\n}\n\nfunction triggerText(props: { selected?: ModelOption; value?: string }): string {\n if (props.selected) return boundText(props.selected.label, 60)\n return props.value ? boundText(props.value, 60) : 'Choose a model'\n}\n\nfunction ModelOptionBody(props: { model: ModelOption }) {\n return (\n <span class=\"flex min-w-0 flex-col\">\n <span class=\"[overflow-wrap:anywhere]\">{boundText(props.model.label, 60)}</span>\n <Show when={props.model.description}>\n <span class=\"text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {boundText(props.model.description ?? '', 160)}\n </span>\n </Show>\n <Show when={props.model.disabledReason}>\n <span class=\"text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n <span class=\"visually-hidden\">Unavailable: </span>\n {boundText(props.model.disabledReason ?? '', 160)}\n </span>\n </Show>\n </span>\n )\n}\n\ntype PickerProps = {\n models: readonly ModelOption[]\n selected?: ModelOption\n value?: string\n blocked: boolean\n describedBy?: string\n onChange: (id: string) => void\n}\n\nfunction ModelTrigger(props: { selected?: ModelOption; value?: string; empty: boolean }) {\n return (\n <>\n <span class=\"max-w-48 truncate\">\n {props.empty ? 'No models available' : triggerText(props)}\n </span>\n <ChevronsUpDown aria-hidden=\"true\" />\n </>\n )\n}\n\nfunction ModelMenu(props: PickerProps) {\n const [open, setOpen] = createSignal(false)\n const groups = createMemo(() => groupModels(props.models))\n const inert = () => props.blocked || props.models.length === 0\n\n createEffect(() => {\n if (inert()) setOpen(false)\n })\n\n return (\n <DropdownMenu\n open={open()}\n onOpenChange={(next) => setOpen(next && !inert())}\n placement=\"top-start\"\n gutter={6}\n >\n <DropdownMenuTrigger\n as={Button}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Model: ${props.models.length === 0 ? 'No models available' : triggerText(props)}`}\n aria-disabled={inert() || undefined}\n aria-describedby={props.describedBy}\n >\n <ModelTrigger\n selected={props.selected}\n value={props.value}\n empty={props.models.length === 0}\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent hideArrow class=\"w-72 max-w-full\">\n <DropdownMenuRadioGroup\n value={props.value ?? ''}\n onChange={(id: unknown) => {\n // Disabled rows cannot be activated, but the guard is the contract.\n const model = typeof id === 'string' ? findModel(props.models, id) : undefined\n if (!props.blocked && model && model.disabledReason === undefined) {\n props.onChange(model.id)\n }\n }}\n >\n <For each={groups()}>\n {(group) => (\n <DropdownMenuGroup>\n <DropdownMenuLabel>{group.provider}</DropdownMenuLabel>\n <For each={group.models}>\n {(model) => (\n <DropdownMenuRadioItem\n value={model.id}\n disabled={inert() || model.disabledReason !== undefined}\n >\n <ModelOptionBody model={model} />\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuGroup>\n )}\n </For>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\nfunction ModelSearch(props: PickerProps) {\n const [open, setOpen] = createSignal(false)\n const groups = createMemo(() => groupModels(props.models))\n\n createEffect(() => {\n if (props.blocked) setOpen(false)\n })\n\n return (\n <Popover\n open={open()}\n onOpenChange={(next) => setOpen(next && !props.blocked)}\n placement=\"top-start\"\n gutter={6}\n >\n <PopoverTrigger\n as={Button}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Model: ${triggerText(props)}`}\n aria-disabled={props.blocked || undefined}\n aria-describedby={props.describedBy}\n >\n <ModelTrigger selected={props.selected} value={props.value} empty={false} />\n </PopoverTrigger>\n <PopoverContent class=\"w-80 max-w-full\">\n <Command\n label=\"Choose a model\"\n defaultValue={props.selected ? modelSearchValue(props.selected).trim() : undefined}\n >\n <CommandInput placeholder=\"Search models\" />\n <CommandList>\n <CommandEmpty>No model matches.</CommandEmpty>\n <For each={groups()}>\n {(group) => (\n <CommandGroup heading={group.provider}>\n <For each={group.models}>\n {(model) => (\n <CommandItem\n value={modelSearchValue(model)}\n disabled={props.blocked || model.disabledReason !== undefined}\n onSelect={() => {\n if (props.blocked || model.disabledReason !== undefined) return\n props.onChange(model.id)\n setOpen(false)\n }}\n >\n <ModelOptionBody model={model} />\n <Show when={model.id === props.value}>\n <Check aria-hidden=\"true\" class=\"ms-auto text-primary\" />\n <span class=\"visually-hidden\">Current model</span>\n </Show>\n </CommandItem>\n )}\n </For>\n </CommandGroup>\n )}\n </For>\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n}\n\nfunction EffortMenu(props: {\n efforts: ReturnType<typeof normalizeEfforts>\n value?: string\n blocked: boolean\n describedBy?: string\n onChange: (id: string) => void\n}) {\n const [open, setOpen] = createSignal(false)\n const label = () => props.efforts.find((effort) => effort.id === props.value)?.label\n\n createEffect(() => {\n if (props.blocked) setOpen(false)\n })\n\n return (\n <DropdownMenu\n open={open()}\n onOpenChange={(next) => setOpen(next && !props.blocked)}\n placement=\"top-start\"\n gutter={6}\n >\n <DropdownMenuTrigger\n as={Button}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Thinking effort: ${label() ?? 'not set'}`}\n aria-disabled={props.blocked || undefined}\n aria-describedby={props.describedBy}\n >\n <Brain aria-hidden=\"true\" />\n <span aria-hidden=\"true\">{label() ?? 'Effort'}</span>\n </DropdownMenuTrigger>\n <DropdownMenuContent hideArrow class=\"w-56 max-w-full\">\n <DropdownMenuRadioGroup\n value={props.value ?? ''}\n onChange={(id: unknown) => {\n if (!props.blocked && typeof id === 'string') props.onChange(id)\n }}\n >\n <DropdownMenuGroup>\n <DropdownMenuLabel>Thinking effort</DropdownMenuLabel>\n <For each={props.efforts}>\n {(effort) => (\n <DropdownMenuRadioItem value={effort.id} disabled={props.blocked}>\n <span class=\"flex min-w-0 flex-col\">\n <span>{effort.label}</span>\n <Show when={effort.description}>\n <span class=\"text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {effort.description}\n </span>\n </Show>\n </span>\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuGroup>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8FA,SAAgB6C,cAAcC,OAA2B;CACvD,MAAM,CAACC,SAAStC,WAAWqC,OAAO;EAChC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CACD,MAAME,gBAAgBD,MAAML,mBAAmBO,KAAAA;CAC/C,MAAMC,iBAAiBrB,UAAUkB,MAAMZ,QAAQY,MAAMX,KAAK;CAC1D,MAAMe,UAAU/C,iBAAiB6B,iBAAiBiB,SAAS,CAAC,EAAEC,OAAO,CAAC;CACtE,MAAMC,qBAAqBlB,cAAcgB,SAAS,GAAGH,MAAMV,MAAM;CACjE,MAAMgB,eACJN,MAAML,iBAAiBd,UAAUmB,MAAML,gBAAAA,GAAiC,IAAIO,KAAAA;CAC9E,MAAMK,WAAW,GAAGhD,eAAe,EAAC;CACpC,MAAMiD,oBAAqBF,OAAO,IAAIC,WAAWL,KAAAA;CAEjD,cAAA;EAAA,IAAAO,OAAAC,QAAA,GAAAC,QAAAF,KAAAG;EAAAC,OAAAF,OAAAG,gBAOOrD,MAAI;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,QAAAlE,gBAClBrD,MAAI;YAAA,IAACsD,OAAI;aAAA,OAAEzB,OAAOsD;YAAW;YAAA,IAAA3B,WAAA;aAAA,IAAAkE,SAAArC,QAAA;aAAAjC,OAAAsE,cAEzB7F,OAAOsD,WAAW;aAAA,OAAAuC;YAAA;WAAA,CAAA,GAAA,IAAA;WAAA,OAAAH;UAAA;SAAA,CAAA;QAK5B,CAAA,CAAA;OAAA,EAAA,CAAA;MAAA;KAAA,CAAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAOf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","names":["ListTodo","createMemo","Index","Show","splitProps","
|
|
1
|
+
{"version":3,"file":"plan.js","names":["ListTodo","createMemo","Index","Show","splitProps","Progress","TraceDetail","TraceLine","TaskItemList","TaskItemRow","taskProgress","taskProgressLabel","label","description","status","steps","streaming","actions","Plan","props","local","rest","progress","undefined","meta","value","hasDetail","length","detail","_$createComponent","children","when","_el$","_tmpl$","_$insert","done","minValue","maxValue","Math","max","total","getValueLabel","each","step","text","_tmpl$2","_el$3","_tmpl$3","_$mergeProps","icon","statusLabel","defaultOpen"],"sources":["../../../../src/components/composites/plan/plan.tsx"],"sourcesContent":["import { ListTodo } from 'lucide-solid'\nimport { createMemo, Index, Show, splitProps, type JSX } from 'solid-js'\nimport { Progress } from '../../ui/progress'\nimport { TraceDetail, TraceLine, type TraceLineProps } from '../../ui/trace'\nimport {\n TaskItemList,\n TaskItemRow,\n taskProgress,\n taskProgressLabel,\n type TaskItemStatus,\n} from '../task'\n\n/**\n * Plan.\n *\n * What the agent intends to do, as a `TraceLine` that opens onto the steps: a\n * title, an optional description, the steps with their status, how far along\n * they are, and — when the host supplies them — the actions the reader can take\n * (approve, edit, run). Reach for `Task` when the list is a unit of work that is\n * already under way and not a proposal, for `Queue` when it is the agent's\n * running todo list, and for `ChainOfThought` when the steps describe how an\n * answer was reached rather than what will be done.\n *\n * ## It opens by default\n *\n * Unlike a tool call, the plan is the thing being decided or followed, so it\n * starts open (`defaultOpen={false}` folds it). A plan with no steps, no\n * description and no actions is a plain line.\n *\n * ## Progress is derived, in words\n *\n * \"2 of 5 steps done\" and the bar come from the steps' own `status` and appear\n * only when at least one step has one; a step with no status counts toward the\n * total and not toward \"done\" (the host did not say it was finished). The bar is\n * the shared `Progress`, which publishes the same phrase to assistive\n * technology, so the number is never only a length.\n *\n * ## Streaming\n *\n * While `streaming` the plan is still being written, so its length is not known\n * and no progress is claimed: the title shimmers, the line says \"Drafting\", and\n * a caret trails the last step. Finished steps keep their DOM while the last one\n * grows (rows are kept by position).\n *\n * ## The host owns authority\n *\n * `actions` is a slot. The plan neither enables nor disables what is in it, and\n * with no `actions` there are no controls — a plan the reader may not approve\n * simply has no Approve button.\n *\n * A `Plan` is a line: place it inside a `Trace`.\n */\nexport type PlanStepStatus = TaskItemStatus\n\nexport type PlanStep = Readonly<{\n id?: string\n label: string\n description?: string\n status?: PlanStepStatus\n}>\n\nexport type PlanProps = Omit<\n TraceLineProps,\n 'description' | 'href' | 'onSelect' | 'selectHaspopup' | 'children' | 'status' | 'statusLabel'\n> & {\n steps: readonly PlanStep[]\n /** What the plan is for, above the steps. */\n description?: JSX.Element\n /** True while the plan is still being generated. */\n streaming?: boolean\n /** Controls for the reader: approve, edit, run. Absent means there are none. */\n actions?: JSX.Element\n}\n\nexport function Plan(props: PlanProps) {\n const [local, rest] = splitProps(props, [\n 'steps',\n 'description',\n 'streaming',\n 'actions',\n 'icon',\n 'meta',\n 'defaultOpen',\n ])\n const progress = createMemo(() => (local.streaming ? undefined : taskProgress(local.steps)))\n const meta = () => {\n if (local.meta !== undefined) return local.meta\n if (local.streaming) return 'Drafting'\n const value = progress()\n return value ? taskProgressLabel(value) : undefined\n }\n const hasDetail = () =>\n local.steps.length > 0 ||\n local.description !== undefined ||\n local.actions !== undefined ||\n local.streaming === true\n\n const detail = () => (\n <TraceDetail class=\"flex flex-col gap-2\">\n <Show when={local.description}>\n <div class=\"text-sm text-muted-foreground\">{local.description}</div>\n </Show>\n <Show when={progress()}>\n {(value) => (\n <Progress\n value={value().done}\n minValue={0}\n maxValue={Math.max(1, value().total)}\n aria-label=\"Plan progress\"\n getValueLabel={({ value: done, max }) =>\n `${done} of ${max} ${max === 1 ? 'step' : 'steps'} done`\n }\n />\n )}\n </Show>\n <Show when={local.steps.length > 0}>\n <TaskItemList label=\"Plan steps\">\n <Index each={local.steps}>\n {(step) => (\n <TaskItemRow\n text={step().label}\n description={step().description}\n status={step().status}\n />\n )}\n </Index>\n </TaskItemList>\n </Show>\n <Show when={local.streaming}>\n <span class=\"streaming-caret\" aria-hidden=\"true\" />\n </Show>\n <Show when={local.actions}>\n <div data-slot=\"plan-actions\" class=\"flex flex-wrap items-center gap-2 pt-1\">\n {local.actions}\n </div>\n </Show>\n </TraceDetail>\n )\n\n return (\n <TraceLine\n icon={local.icon ?? <ListTodo />}\n status={local.streaming ? 'running' : undefined}\n statusLabel=\"Generating\"\n meta={meta()}\n defaultOpen={local.defaultOpen ?? true}\n {...rest}\n >\n {hasDetail() ? detail : undefined}\n </TraceLine>\n )\n}\n"],"mappings":";;;;;;;;;;AA0EA,SAAgBkB,KAAKC,OAAkB;CACrC,MAAM,CAACC,OAAOC,QAAQjB,WAAWe,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CAAa,CACd;CACD,MAAMG,WAAWrB,iBAAkBmB,MAAMJ,YAAYO,KAAAA,IAAYb,aAAaU,MAAML,KAAK,CAAE;CAC3F,MAAMS,aAAa;EACjB,IAAIJ,MAAMI,SAASD,KAAAA,GAAW,OAAOH,MAAMI;EAC3C,IAAIJ,MAAMJ,WAAW,OAAO;EAC5B,MAAMS,QAAQH,SAAS;EACvB,OAAOG,QAAQd,kBAAkBc,KAAK,IAAIF,KAAAA;CAC5C;CACA,MAAMG,kBACJN,MAAML,MAAMY,SAAS,KACrBP,MAAMP,gBAAgBU,KAAAA,KACtBH,MAAMH,YAAYM,KAAAA,K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AC4B,OAAI;MAAA,OAAEX,MAAMJ;KAAS;KAAA,IAAAc,WAAA;MAAA,OAAAe,QAAA;KAAA;IAAA,CAAA;IAAAhB,gBAG1B1B,MAAI;KAAA,IAAC4B,OAAI;MAAA,OAAEX,MAAMH;KAAO;KAAA,IAAAa,WAAA;MAAA,IAAAgB,QAAAC,QAAA;MAAAb,OAAAY,aAEpB1B,MAAMH,OAAO;MAAA,OAAA6B;KAAA;IAAA,CAAA;GAAA;EAAA;CAAA,CAAA;CAMtB,OAAAjB,gBACGtB,WAASyC,WAAA;EAAA,IACRC,OAAI;GAAA,OAAE7B,MAAM6B,QAAIpB,gBAAK7B,UAAQ,CAAA,CAAA;EAAG;EAAA,IAChCc,SAAM;GAAA,OAAEM,MAAMJ,YAAY,YAAYO,KAAAA;EAAS;EAC/C2B,aAAW;EAAA,IACX1B,OAAI;GAAA,OAAEA,KAAK;EAAC;EAAA,IACZ2B,cAAW;GAAA,OAAE/B,MAAM+B,eAAe;EAAI;CAAA,GAClC9B,MAAI,EAAA,IAAAS,WAAA;EAAA,OAEPJ,UAAU,IAAIE,SAASL,KAAAA;CAAS,EAAA,CAAA,CAAA;AAGvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","names":["CornerDownRight","ListChecks","ListTodo","MessageSquarePlus","X","createMemo","Index","onCleanup","Show","splitProps","ComponentProps","JSX","Button","Trace","TraceLine","WorkStatus","TaskItemList","TaskItemRow","QueueItemStatus","Extract","QueueItem","Readonly","id","text","description","status","partitionQueue","items","pending","completed","filter","item","itemCount","count","Count","props","noun","_el$","_tmpl$","_$insert","_el$2","_tmpl$2","QueueProps","Omit","pendingLabel","completedLabel","empty","Element","defaultCompletedOpen","Queue","local","rest","sections","_$createComponent","when","length","fallback","children","_$mergeProps","title","icon","meta","defaultOpen","label","each","QueueFollowUp","onRemove","REMOVE_LABEL_CHARS","FollowUpRow","remove","HTMLButtonElement","document","activeElement","buttons","closest","querySelectorAll","previous","Array","from","button","at","focus","slice","_el$3","_tmpl$3","_el$4","firstChild","ref","element","type","variant","size","aria-label","onClick","_$effect","_$setAttribute","QueueFollowUpsProps","QueueFollowUps","_$createComponent","_$mergeProps","_$setAttribute"],"sources":["../../../../src/components/composites/queue/queue.tsx"],"sourcesContent":["import { CornerDownRight, ListChecks, ListTodo, MessageSquarePlus, X } from 'lucide-solid'\nimport {\n createMemo,\n Index,\n onCleanup,\n Show,\n splitProps,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { Button } from '../../ui/button'\nimport { Trace, TraceLine, type WorkStatus } from '../../ui/trace'\nimport { TaskItemList, TaskItemRow } from '../task'\n\n/**\n * Queue.\n *\n * The agent's todo list, split the way a reader asks about it: what is still to\n * do, and what is already done. Two collapsible sections with their counts,\n * \"Pending\" open and \"Completed\" folded — the finished work is the record, the\n * pending work is the question. Reach for `Plan` when the list is a proposal\n * awaiting a decision, for `Task` when it is one piece of work with files\n * attached, and for `QueueFollowUps` (below) when the things waiting are\n * *messages from the person*, not work the agent set itself.\n *\n * ## Sorting is the host's statement, not ours\n *\n * An item is in the Completed section only if its `status` is `complete`.\n * Everything else — `pending`, `active`, or no status at all — is still to do,\n * which is what \"not marked done\" means; the mark shown matches (an item with\n * no status gets the pending mark, because it is in the Pending section). An\n * empty section is not drawn: \"Completed (0)\" is noise, and a list with nothing\n * in either section renders nothing, or the `empty` content if the host gave\n * some, rather than a heading over a void.\n *\n * ## Bounded\n *\n * Each section scrolls inside a capped, keyboard-focusable region, and rows are\n * kept by position, so a list of two hundred items does not push the answer out\n * of view and a status change updates a row instead of recreating it. Item text\n * wraps to three lines and is clamped (see `Task`).\n *\n * A `Queue` is a block (its own `Trace`) and can sit between other parts of a\n * turn.\n */\nexport type QueueItemStatus = Extract<WorkStatus, 'pending' | 'active' | 'complete'>\n\nexport type QueueItem = Readonly<{\n id?: string\n text: string\n description?: string\n status?: QueueItemStatus\n}>\n\n/** Split a todo list into the two sections. Order is preserved within each. */\nexport function partitionQueue(items: readonly QueueItem[]): Readonly<{\n pending: readonly QueueItem[]\n completed: readonly QueueItem[]\n}> {\n return {\n pending: items.filter((item) => item.status !== 'complete'),\n completed: items.filter((item) => item.status === 'complete'),\n }\n}\n\nfunction itemCount(count: number): string {\n return `${count} ${count === 1 ? 'item' : 'items'}`\n}\n\n/** The count, shown as a number and spoken as a phrase. */\nfunction Count(props: { count: number; noun?: string }) {\n return (\n <>\n <span aria-hidden=\"true\">{props.count}</span>\n <span class=\"sr-only\">{props.noun ?? itemCount(props.count)}</span>\n </>\n )\n}\n\nexport type QueueProps = Omit<ComponentProps<typeof Trace>, 'children'> & {\n items: readonly QueueItem[]\n pendingLabel?: string\n completedLabel?: string\n /** Shown when there is nothing in either section. Omit to draw nothing. */\n empty?: JSX.Element\n /** Open the Completed section initially. */\n defaultCompletedOpen?: boolean\n}\n\nexport function Queue(props: QueueProps) {\n const [local, rest] = splitProps(props, [\n 'items',\n 'pendingLabel',\n 'completedLabel',\n 'empty',\n 'defaultCompletedOpen',\n ])\n const sections = createMemo(() => partitionQueue(local.items))\n const pending = () => sections().pending\n const completed = () => sections().completed\n const pendingLabel = () => local.pendingLabel ?? 'Pending'\n const completedLabel = () => local.completedLabel ?? 'Completed'\n\n return (\n <Show\n when={local.items.length > 0}\n fallback={\n <Show when={local.empty}>\n <Trace aria-label=\"Queue\" {...rest}>\n <TraceLine title={local.empty} />\n </Trace>\n </Show>\n }\n >\n <Trace aria-label=\"Queue\" {...rest}>\n <Show when={pending().length > 0}>\n <TraceLine\n icon={<ListTodo />}\n title={pendingLabel()}\n meta={<Count count={pending().length} />}\n defaultOpen\n >\n {() => (\n <TaskItemList label={pendingLabel()}>\n <Index each={pending()}>\n {(item) => (\n <TaskItemRow\n text={item().text}\n description={item().description}\n status={item().status ?? 'pending'}\n />\n )}\n </Index>\n </TaskItemList>\n )}\n </TraceLine>\n </Show>\n <Show when={completed().length > 0}>\n <TraceLine\n icon={<ListChecks />}\n title={completedLabel()}\n meta={<Count count={completed().length} />}\n defaultOpen={local.defaultCompletedOpen ?? false}\n >\n {() => (\n <TaskItemList label={completedLabel()}>\n <Index each={completed()}>\n {(item) => (\n <TaskItemRow\n text={item().text}\n description={item().description}\n status=\"complete\"\n />\n )}\n </Index>\n </TaskItemList>\n )}\n </TraceLine>\n </Show>\n </Trace>\n </Show>\n )\n}\n\nexport type QueueFollowUp = Readonly<{\n id?: string\n text: string\n /** Removes it from the queue. Omit it and the row has no remove control. */\n onRemove?: () => void\n}>\n\nconst REMOVE_LABEL_CHARS = 60\n\nfunction FollowUpRow(props: { item: QueueFollowUp }) {\n let remove: HTMLButtonElement | undefined\n\n // Rows are kept by position, so removing a middle row leaves the focused\n // button where it is (now on the next message). Only the last row is ever\n // disposed under focus; hand focus to the one before it rather than to `body`.\n onCleanup(() => {\n if (!remove || document.activeElement !== remove) return\n const buttons = remove\n .closest('ul')\n ?.querySelectorAll<HTMLButtonElement>('button[data-slot=\"queue-follow-up-remove\"]')\n const previous = Array.from(buttons ?? []).filter((button) => button !== remove)\n previous.at(-1)?.focus()\n })\n\n const text = () =>\n props.item.text.length > 1_000 ? `${props.item.text.slice(0, 1_000)}…` : props.item.text\n const label = () =>\n props.item.text.length > REMOVE_LABEL_CHARS\n ? `${props.item.text.slice(0, REMOVE_LABEL_CHARS)}…`\n : props.item.text\n\n return (\n <li data-slot=\"queue-follow-up\" class=\"flex min-w-0 items-start gap-2 rounded-md px-1.5 py-0.5\">\n <CornerDownRight aria-hidden=\"true\" class=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground\" />\n <p\n title={text()}\n class=\"m-0 line-clamp-3 min-w-0 flex-1 text-sm [overflow-wrap:anywhere] whitespace-pre-wrap text-foreground\"\n >\n {text()}\n </p>\n <Show when={props.item.onRemove}>\n {(onRemove) => (\n <Button\n ref={(element) => (remove = element)}\n data-slot=\"queue-follow-up-remove\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-2xs\"\n class=\"shrink-0\"\n aria-label={`Remove queued message: ${label()}`}\n onClick={() => onRemove()()}\n >\n <X aria-hidden=\"true\" />\n </Button>\n )}\n </Show>\n </li>\n )\n}\n\nexport type QueueFollowUpsProps = Omit<ComponentProps<typeof Trace>, 'children'> & {\n items: readonly QueueFollowUp[]\n /** The section's title. */\n title?: string\n defaultOpen?: boolean\n}\n\n/**\n * Follow-up messages the person sent that have not been delivered yet. They are\n * the person's words, so they are shown as sent (wrapped, clamped to three\n * lines) rather than as work. The remove control exists per message only when\n * that message carries `onRemove`: whether it may still be withdrawn is the\n * runtime's to say, and a message past recall simply has no button. With no\n * messages the component draws nothing.\n */\nexport function QueueFollowUps(props: QueueFollowUpsProps) {\n const [local, rest] = splitProps(props, ['items', 'title', 'defaultOpen'])\n const title = () => local.title ?? 'Queued follow-ups'\n return (\n <Show when={local.items.length > 0}>\n <Trace aria-label={title()} {...rest}>\n <TraceLine\n icon={<MessageSquarePlus />}\n title={title()}\n meta={<Count count={local.items.length} noun={`${local.items.length} waiting`} />}\n defaultOpen={local.defaultOpen ?? true}\n >\n {() => (\n <TaskItemList label={title()}>\n <Index each={local.items}>{(item) => <FollowUpRow item={item()} />}</Index>\n </TaskItemList>\n )}\n </TraceLine>\n </Trace>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;AAuDA,SAAgB0B,eAAeC,OAG5B;CACD,OAAO;EACLC,SAASD,MAAMG,QAAQC,SAASA,KAAKN,WAAW,UAAU;EAC1DI,WAAWF,MAAMG,QAAQC,SAASA,KAAKN,WAAW,UAAU;CAC9D;AACF;AAEA,SAASO,UAAUC,OAAuB;CACxC,OAAO,GAAGA,MAAK,GAAIA,UAAU,IAAI,SAAS;AAC5C;;AAGA,SAASC,MAAMC,OAAyC;CACtD,OAAA,QAAA;EAAA,IAAAE,OAAAC,OAAA;EAAAC,OAAAF,YAE8BF,MAAMF,KAAK;EAAA,OAAAI;CAAA,EAAA,CAAA,UAAA;EAAA,IAAAG,QAAAC,QAAA;EAAAF,OAAAC,aACdL,MAAMC,QAAQJ,UAA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AC;MAAA,IAAAF,WAAA;OAAA,OAAAJ,gBACzB/C,OAAK;QAAA,IAAC0D,OAAI;SAAA,OAAEd,MAAMvB;QAAK;QAAA8B,WAAI1B,SAAIsB,gBAAMe,aAAW,EAAA,IAACrC,OAAI;SAAA,OAAEA,KAAK;QAAC,EAAA,CAAA;OAAI,CAAA;MAAA;KAAA,CAAA;IAErE,CAAA;GAAA,EAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAKX"}
|
|
1
|
+
{"version":3,"file":"queue.js","names":["CornerDownRight","ListChecks","ListTodo","MessageSquarePlus","X","createMemo","Index","onCleanup","Show","splitProps","Button","Trace","TraceLine","TaskItemList","TaskItemRow","text","description","status","partitionQueue","items","pending","completed","filter","item","itemCount","count","Count","props","noun","_el$","_tmpl$","_$insert","_el$2","_tmpl$2","pendingLabel","completedLabel","empty","defaultCompletedOpen","Queue","local","rest","sections","_$createComponent","when","length","fallback","children","_$mergeProps","title","icon","meta","defaultOpen","label","each","onRemove","REMOVE_LABEL_CHARS","FollowUpRow","remove","document","activeElement","buttons","closest","querySelectorAll","previous","Array","from","button","at","focus","slice","_el$3","_tmpl$3","_el$4","firstChild","ref","element","type","variant","size","onClick","_$effect","_$setAttribute","QueueFollowUps"],"sources":["../../../../src/components/composites/queue/queue.tsx"],"sourcesContent":["import { CornerDownRight, ListChecks, ListTodo, MessageSquarePlus, X } from 'lucide-solid'\nimport {\n createMemo,\n Index,\n onCleanup,\n Show,\n splitProps,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { Button } from '../../ui/button'\nimport { Trace, TraceLine, type WorkStatus } from '../../ui/trace'\nimport { TaskItemList, TaskItemRow } from '../task'\n\n/**\n * Queue.\n *\n * The agent's todo list, split the way a reader asks about it: what is still to\n * do, and what is already done. Two collapsible sections with their counts,\n * \"Pending\" open and \"Completed\" folded — the finished work is the record, the\n * pending work is the question. Reach for `Plan` when the list is a proposal\n * awaiting a decision, for `Task` when it is one piece of work with files\n * attached, and for `QueueFollowUps` (below) when the things waiting are\n * *messages from the person*, not work the agent set itself.\n *\n * ## Sorting is the host's statement, not ours\n *\n * An item is in the Completed section only if its `status` is `complete`.\n * Everything else — `pending`, `active`, or no status at all — is still to do,\n * which is what \"not marked done\" means; the mark shown matches (an item with\n * no status gets the pending mark, because it is in the Pending section). An\n * empty section is not drawn: \"Completed (0)\" is noise, and a list with nothing\n * in either section renders nothing, or the `empty` content if the host gave\n * some, rather than a heading over a void.\n *\n * ## Bounded\n *\n * Each section scrolls inside a capped, keyboard-focusable region, and rows are\n * kept by position, so a list of two hundred items does not push the answer out\n * of view and a status change updates a row instead of recreating it. Item text\n * wraps to three lines and is clamped (see `Task`).\n *\n * A `Queue` is a block (its own `Trace`) and can sit between other parts of a\n * turn.\n */\nexport type QueueItemStatus = Extract<WorkStatus, 'pending' | 'active' | 'complete'>\n\nexport type QueueItem = Readonly<{\n id?: string\n text: string\n description?: string\n status?: QueueItemStatus\n}>\n\n/** Split a todo list into the two sections. Order is preserved within each. */\nexport function partitionQueue(items: readonly QueueItem[]): Readonly<{\n pending: readonly QueueItem[]\n completed: readonly QueueItem[]\n}> {\n return {\n pending: items.filter((item) => item.status !== 'complete'),\n completed: items.filter((item) => item.status === 'complete'),\n }\n}\n\nfunction itemCount(count: number): string {\n return `${count} ${count === 1 ? 'item' : 'items'}`\n}\n\n/** The count, shown as a number and spoken as a phrase. */\nfunction Count(props: { count: number; noun?: string }) {\n return (\n <>\n <span aria-hidden=\"true\">{props.count}</span>\n <span class=\"sr-only\">{props.noun ?? itemCount(props.count)}</span>\n </>\n )\n}\n\nexport type QueueProps = Omit<ComponentProps<typeof Trace>, 'children'> & {\n items: readonly QueueItem[]\n pendingLabel?: string\n completedLabel?: string\n /** Shown when there is nothing in either section. Omit to draw nothing. */\n empty?: JSX.Element\n /** Open the Completed section initially. */\n defaultCompletedOpen?: boolean\n}\n\nexport function Queue(props: QueueProps) {\n const [local, rest] = splitProps(props, [\n 'items',\n 'pendingLabel',\n 'completedLabel',\n 'empty',\n 'defaultCompletedOpen',\n ])\n const sections = createMemo(() => partitionQueue(local.items))\n const pending = () => sections().pending\n const completed = () => sections().completed\n const pendingLabel = () => local.pendingLabel ?? 'Pending'\n const completedLabel = () => local.completedLabel ?? 'Completed'\n\n return (\n <Show\n when={local.items.length > 0}\n fallback={\n <Show when={local.empty}>\n <Trace aria-label=\"Queue\" {...rest}>\n <TraceLine title={local.empty} />\n </Trace>\n </Show>\n }\n >\n <Trace aria-label=\"Queue\" {...rest}>\n <Show when={pending().length > 0}>\n <TraceLine\n icon={<ListTodo />}\n title={pendingLabel()}\n meta={<Count count={pending().length} />}\n defaultOpen\n >\n {() => (\n <TaskItemList label={pendingLabel()}>\n <Index each={pending()}>\n {(item) => (\n <TaskItemRow\n text={item().text}\n description={item().description}\n status={item().status ?? 'pending'}\n />\n )}\n </Index>\n </TaskItemList>\n )}\n </TraceLine>\n </Show>\n <Show when={completed().length > 0}>\n <TraceLine\n icon={<ListChecks />}\n title={completedLabel()}\n meta={<Count count={completed().length} />}\n defaultOpen={local.defaultCompletedOpen ?? false}\n >\n {() => (\n <TaskItemList label={completedLabel()}>\n <Index each={completed()}>\n {(item) => (\n <TaskItemRow\n text={item().text}\n description={item().description}\n status=\"complete\"\n />\n )}\n </Index>\n </TaskItemList>\n )}\n </TraceLine>\n </Show>\n </Trace>\n </Show>\n )\n}\n\nexport type QueueFollowUp = Readonly<{\n id?: string\n text: string\n /** Removes it from the queue. Omit it and the row has no remove control. */\n onRemove?: () => void\n}>\n\nconst REMOVE_LABEL_CHARS = 60\n\nfunction FollowUpRow(props: { item: QueueFollowUp }) {\n let remove: HTMLButtonElement | undefined\n\n // Rows are kept by position, so removing a middle row leaves the focused\n // button where it is (now on the next message). Only the last row is ever\n // disposed under focus; hand focus to the one before it rather than to `body`.\n onCleanup(() => {\n if (!remove || document.activeElement !== remove) return\n const buttons = remove\n .closest('ul')\n ?.querySelectorAll<HTMLButtonElement>('button[data-slot=\"queue-follow-up-remove\"]')\n const previous = Array.from(buttons ?? []).filter((button) => button !== remove)\n previous.at(-1)?.focus()\n })\n\n const text = () =>\n props.item.text.length > 1_000 ? `${props.item.text.slice(0, 1_000)}…` : props.item.text\n const label = () =>\n props.item.text.length > REMOVE_LABEL_CHARS\n ? `${props.item.text.slice(0, REMOVE_LABEL_CHARS)}…`\n : props.item.text\n\n return (\n <li data-slot=\"queue-follow-up\" class=\"flex min-w-0 items-start gap-2 rounded-md px-1.5 py-0.5\">\n <CornerDownRight aria-hidden=\"true\" class=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground\" />\n <p\n title={text()}\n class=\"m-0 line-clamp-3 min-w-0 flex-1 text-sm [overflow-wrap:anywhere] whitespace-pre-wrap text-foreground\"\n >\n {text()}\n </p>\n <Show when={props.item.onRemove}>\n {(onRemove) => (\n <Button\n ref={(element) => (remove = element)}\n data-slot=\"queue-follow-up-remove\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-2xs\"\n class=\"shrink-0\"\n aria-label={`Remove queued message: ${label()}`}\n onClick={() => onRemove()()}\n >\n <X aria-hidden=\"true\" />\n </Button>\n )}\n </Show>\n </li>\n )\n}\n\nexport type QueueFollowUpsProps = Omit<ComponentProps<typeof Trace>, 'children'> & {\n items: readonly QueueFollowUp[]\n /** The section's title. */\n title?: string\n defaultOpen?: boolean\n}\n\n/**\n * Follow-up messages the person sent that have not been delivered yet. They are\n * the person's words, so they are shown as sent (wrapped, clamped to three\n * lines) rather than as work. The remove control exists per message only when\n * that message carries `onRemove`: whether it may still be withdrawn is the\n * runtime's to say, and a message past recall simply has no button. With no\n * messages the component draws nothing.\n */\nexport function QueueFollowUps(props: QueueFollowUpsProps) {\n const [local, rest] = splitProps(props, ['items', 'title', 'defaultOpen'])\n const title = () => local.title ?? 'Queued follow-ups'\n return (\n <Show when={local.items.length > 0}>\n <Trace aria-label={title()} {...rest}>\n <TraceLine\n icon={<MessageSquarePlus />}\n title={title()}\n meta={<Count count={local.items.length} noun={`${local.items.length} waiting`} />}\n defaultOpen={local.defaultOpen ?? true}\n >\n {() => (\n <TaskItemList label={title()}>\n <Index each={local.items}>{(item) => <FollowUpRow item={item()} />}</Index>\n </TaskItemList>\n )}\n </TraceLine>\n </Trace>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;AAuDA,SAAgBkB,eAAeC,OAG5B;CACD,OAAO;EACLC,SAASD,MAAMG,QAAQC,SAASA,KAAKN,WAAW,UAAU;EAC1DI,WAAWF,MAAMG,QAAQC,SAASA,KAAKN,WAAW,UAAU;CAC9D;AACF;AAEA,SAASO,UAAUC,OAAuB;CACxC,OAAO,GAAGA,MAAK,GAAIA,UAAU,IAAI,SAAS;AAC5C;;AAGA,SAASC,MAAMC,OAAyC;CACtD,OAAA,QAAA;EAAA,IAAAE,OAAAC,OAAA;EAAAC,OAAAF,YAE8BF,MAAMF,KAAK;EAAA,OAAAI;CAAA,EAAA,CAAA,UAAA;EAAA,IAAAG,QAAAC,QAAA;EAAAF,OAAAC,aACdL,MAAMC,QAAQJ,UAAUG,MAAMF,KAAK,CAAC;EAAA,OAAAO;CAAA,EAAA,CAAA,CAAA;AAGjE;AAYA,SAAgBM,MAAMX,OAAmB;CACvC,MAAM,CAACY,OAAOC,QAAQ/B,WAAWkB,OAAO;EACtC;EACA;EACA;EACA;EACA;CAAsB,CACvB;CACD,MAAMc,WAAWpC,iBAAiBa,eAAeqB,MAAMpB,KAAK,CAAC;CAC7D,MAAMC,gBAAgBqB,SAAS,CAAC,CAACrB;CACjC,MAAMC,kBAAkBoB,SAAS,CAAC,CAACpB;CACnC,MAAMa,qBAAqBK,MAAML,gBAAgB;CACjD,MAAMC,uBAAuBI,MAAMJ,kBAAkB;CAErD,OAAAO,gBACGlC,MAAI;EAAA,IACHmC,OAAI;GAAA,OAAEJ,MAAMpB,MAAMyB,SAAS;EAAC;EAAA,IAC5BC,WAAQ;GAAA,OAAAH,gBACLlC,MAAI;IAAA,IAACmC,OAAI;KAAA,OAAEJ,MAAMH;IAAK;IAAA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AC;EAAA,IAAAE,WAAA;GAAA,OAAAJ,gBAC/B/B,OAAKoC,WAAA,EAAA,KAAA,gBAAA;IAAA,OAAaC,MAAM;GAAC,EAAA,GAAMR,MAAI,EAAA,IAAAM,WAAA;IAAA,OAAAJ,gBACjC9B,WAAS;KAAA,IACRqC,OAAI;MAAA,OAAAP,gBAAGvC,mBAAiB,CAAA,CAAA;KAAA;KAAA,IACxB6C,QAAK;MAAA,OAAEA,MAAM;KAAC;KAAA,IACdE,OAAI;MAAA,OAAAR,gBAAGhB,OAAK;OAAA,IAACD,QAAK;QAAA,OAAEc,MAAMpB,MAAMyB;OAAM;OAAA,IAAEhB,OAAI;QAAA,OAAE,GAAGW,MAAMpB,MAAMyB,OAAM;OAAU;MAAA,CAAA;KAAA;KAAA,IAC7EO,cAAW;MAAA,OAAEZ,MAAMY,eAAe;KAAI;KAAAL,gBAErCJ,gBACE7B,cAAY;MAAA,IAACuC,QAAK;OAAA,OAAEJ,MAAM;MAAC;MAAA,IAAAF,WAAA;OAAA,OAAAJ,gBACzBpC,OAAK;QAAA,IAAC+C,OAAI;SAAA,OAAEd,MAAMpB;QAAK;QAAA2B,WAAIvB,SAAImB,gBAAMc,aAAW,EAAA,IAACjC,OAAI;SAAA,OAAEA,KAAK;QAAC,EAAA,CAAA;OAAI,CAAA;MAAA;KAAA,CAAA;IAErE,CAAA;GAAA,EAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAKX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning.js","names":["Brain","createEffect","createSignal","on","splitProps","
|
|
1
|
+
{"version":3,"file":"reasoning.js","names":["Brain","createEffect","createSignal","on","splitProps","isAtEnd","scrollGeometry","MessageText","ScrollArea","formatDuration","TraceDetail","TraceLine","reasoningTitle","state","streaming","duration","text","title","ReasoningBody","props","scroller","following","scrollTop","scrollHeight","_$createComponent","children","ref","element","role","onScroll","event","currentTarget","codeBlockProps","maxHeight","wrap","Reasoning","local","rest","chosen","setChosen","open","hasBody","trim","undefined","defer","body","_$mergeProps","icon","status","statusLabel","onOpenChange","value"],"sources":["../../../../src/components/composites/reasoning/reasoning.tsx"],"sourcesContent":["import { Brain } from 'lucide-solid'\nimport { createEffect, createSignal, on, splitProps, type JSX } from 'solid-js'\nimport { isAtEnd, scrollGeometry } from '#lib/scroll-geometry'\nimport { MessageText } from '../../ui/message'\nimport { ScrollArea } from '../../ui/scroll-area'\nimport { formatDuration, TraceDetail, TraceLine, type TraceLineProps } from '../../ui/trace'\n\nexport { formatDuration }\n\n/**\n * Reasoning.\n *\n * The agent's thinking, as a `TraceLine`: a title that says what state it is in,\n * and a body that is the text the host chose to show. Reach for `ChainOfThought`\n * when the thinking is a sequence of discrete steps with their own status, and\n * for a plain `MessageText` when the text is simply part of the answer.\n *\n * ## It shows what it is given, and nothing else\n *\n * `text` is whatever the host has decided is user-visible — a provider's reasoning\n * summary, a model's visible scratchpad. This component never implies there is\n * more behind it: no \"show full reasoning\" control, no placeholder body, no\n * ellipsis standing in for hidden content. With no `text` and no `streaming` the\n * line is a plain, non-expandable line titled \"Reasoning\", because there is\n * nothing to open.\n *\n * ## The title is the state\n *\n * - `streaming` — \"Thinking…\", with the running mark and shimmer.\n * - finished with a `duration` (seconds) — \"Thought for 4s\".\n * - finished without one — \"Reasoning\". A duration the host did not measure is\n * not invented.\n *\n * ## Open while it is arriving, closed once it is done\n *\n * While streaming the body is open so the reader can follow along; when the\n * stream ends it folds away so the settled transcript stays one quiet column. The\n * reader's own toggle wins in both directions and is remembered until the next\n * stream begins, so someone who closed it mid-stream is not re-opened and\n * someone who opened it afterwards is not folded. Pass `open` and `onOpenChange`\n * to own the state instead.\n *\n * ## Bounded, and stable while it grows\n *\n * The body is `MessageText`, so the text is untrusted and rendered as text (see\n * its doc comment), and earlier paragraphs keep their DOM while the last one\n * grows. The scroller is capped; while streaming it follows the newest text only\n * if the reader has not scrolled up, so reading the start of a long thought is\n * not interrupted by the end of it.\n */\n\n/** The line's title for a state. Exported so a host can say the same thing elsewhere. */\nexport function reasoningTitle(state: { streaming?: boolean; duration?: number }): string {\n if (state.streaming) return 'Thinking…'\n const duration = formatDuration(state.duration)\n return duration ? `Thought for ${duration}` : 'Reasoning'\n}\n\nexport type ReasoningProps = Omit<\n TraceLineProps,\n | 'title'\n | 'description'\n | 'status'\n | 'statusLabel'\n | 'defaultOpen'\n | 'children'\n | 'href'\n | 'onSelect'\n | 'selectHaspopup'\n> & {\n /** The reasoning the host marked as user-visible. Untrusted text. */\n text?: string\n /** True while text may still arrive. */\n streaming?: boolean\n /** Seconds the thinking took, if the host measured it. */\n duration?: number\n /** Replaces the state-derived title, e.g. for another language. */\n title?: JSX.Element\n}\n\nfunction ReasoningBody(props: { text: string; streaming?: boolean }) {\n let scroller: HTMLDivElement | undefined\n let following = true\n\n createEffect(() => {\n // Read for the dependency: new text is the event that may need following.\n void props.text\n if (props.streaming && following && scroller) scroller.scrollTop = scroller.scrollHeight\n })\n\n return (\n <TraceDetail>\n <ScrollArea\n ref={(element) => (scroller = element)}\n role=\"region\"\n aria-label=\"Reasoning text\"\n class=\"max-h-72\"\n onScroll={(event) => {\n following = isAtEnd(scrollGeometry(event.currentTarget))\n }}\n >\n <MessageText\n text={props.text}\n streaming={props.streaming}\n codeBlockProps={{ maxHeight: '16rem', wrap: true }}\n />\n </ScrollArea>\n </TraceDetail>\n )\n}\n\nexport function Reasoning(props: ReasoningProps) {\n const [local, rest] = splitProps(props, [\n 'text',\n 'streaming',\n 'duration',\n 'title',\n 'icon',\n 'open',\n 'onOpenChange',\n ])\n // `undefined` means \"the reader has not decided\", which is what lets the stream\n // open and close the line on its own.\n const [chosen, setChosen] = createSignal<boolean>()\n const open = () => local.open ?? chosen() ?? local.streaming === true\n const hasBody = () => (local.text ?? '').trim() !== '' || local.streaming === true\n\n createEffect(\n on(\n () => local.streaming,\n (streaming) => {\n if (streaming) setChosen(undefined)\n },\n { defer: true }\n )\n )\n\n const body = () => <ReasoningBody text={local.text ?? ''} streaming={local.streaming} />\n\n return (\n <TraceLine\n icon={local.icon ?? <Brain />}\n title={\n local.title ?? reasoningTitle({ streaming: local.streaming, duration: local.duration })\n }\n status={local.streaming ? 'running' : undefined}\n statusLabel=\"In progress\"\n open={open()}\n onOpenChange={(value) => {\n setChosen(value)\n local.onOpenChange?.(value)\n }}\n {...rest}\n >\n {hasBody() ? body : undefined}\n </TraceLine>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgBY,eAAeC,OAA2D;CACxF,IAAIA,MAAMC,WAAW,OAAO;CAC5B,MAAMC,WAAWN,eAAeI,MAAME,QAAQ;CAC9C,OAAOA,WAAW,eAAeA,aAAa;AAChD;AAwBA,SAASG,cAAcC,OAA8C;CACnE,IAAIC;CACJ,IAAIC,YAAY;CAEhBpB,mBAAmB;EAEjB,MAAWe;EACX,IAAIG,MAAML,aAAaO,aAAaD,UAAUA,SAASE,YAAYF,SAASG;CAC9E,CAAC;CAED,OAAAC,gBACGd,aAAW,EAAA,IAAAe,WAAA;EAAA,OAAAD,gBACThB,YAAU;GAAAkB,MACHC,YAAaP,WAAWO;GAC9BC,MAAI;GAAA,cAAA;GAAA,SAAA;GAGJC,WAAWC,UAAU;IACnBT,YAAYhB,QAAQC,eAAewB,MAAMC,aAAa,CAAC;GACzD;GAAC,IAAAN,WAAA;IAAA,OAAAD,gBAEAjB,aAAW;KAAA,IACVS,OAAI;MAAA,OAAEG,MAAMH;KAAI;KAAA,IAChBF,YAAS;MAAA,OAAEK,MAAML;KAAS;KAC1BkB,gBAAgB;MAAEC,WAAW;MAASC,MAAM;KAAK;IAAC,CAAA;GAAA;EAAA,CAAA;CAAA,EAAA,CAAA;AAK5D;AAEA,SAAgBC,UAAUhB,OAAuB;CAC/C,MAAM,CAACiB,OAAOC,QAAQjC,WAAWe,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CAAc,CACf;CAGD,MAAM,CAACmB,QAAQC,aAAarC,aAAsB;CAClD,MAAMsC,aAAaJ,MAAMI,QAAQF,OAAO,KAAKF,MAAMtB,cAAc;CACjE,MAAM2B,iBAAiBL,MAAMpB,QAAQ,GAAA,CAAI0B,KAAK,MAAM,MAAMN,MAAMtB,cAAc;CAE9Eb,aACEE,SACQiC,MAAMtB,YACXA,cAAc;EACb,IAAIA,WAAWyB,UAAUI,KAAAA,CAAS;CACpC,GACA,EAAEC,OAAO,KAAK,CAChB,CACF;CAEA,MAAMC,aAAOrB,gBAAON,eAAa;EAAA,IAACF,OAAI;GAAA,OAAEoB,MAAMpB,QAAQ;EAAE;EAAA,IAAEF,YAAS;GAAA,OAAEsB,MAAMtB;EAAS;CAAA,CAAA;CAEpF,OAAAU,gBACGb,WAASmC,WAAA;EAAA,IACRC,OAAI;GAAA,OAAEX,MAAMW,QAAIvB,gBAAKxB,OAAK,CAAA,CAAA;EAAG;EAAA,IAC7BiB,QAAK;GAAA,OACHmB,MAAMnB,SAASL,eAAe;IAAEE,WAAWsB,MAAMtB;IAAWC,UAAUqB,MAAMrB;GAAS,CAAC;EAAC;EAAA,IAEzFiC,SAAM;GAAA,OAAEZ,MAAMtB,YAAY,YAAY6B,KAAAA;EAAS;EAC/CM,aAAW;EAAA,IACXT,OAAI;GAAA,OAAEA,KAAK;EAAC;EACZU,eAAeC,UAAU;GACvBZ,UAAUY,KAAK;GACff,MAAMc,eAAeC,KAAK;EAC5B;CAAC,GACGd,MAAI,EAAA,IAAAZ,WAAA;EAAA,OAEPgB,QAAQ,IAAII,OAAOF,KAAAA;CAAS,EAAA,CAAA,CAAA;AAGnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene-controls.js","names":["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","ZoomIn","ZoomOut","createSignal","onCleanup","Show","JSX","ActionButton","SceneMovementDirection","SceneControlLabels","movementGroup","forward","forwardTooltip","left","leftTooltip","backward","backwardTooltip","right","rightTooltip","jump","jumpTooltip","zoomGroup","zoomOut","zoomIn","DEFAULT_LABELS","pointerSource","pointerId","keySource","key","SceneControlsProps","onMovementChange","direction","pressed","onJumpChange","onZoomIn","onZoomOut","labels","Partial","HoldActionProps","label","tooltip","createChangeCallback","children","Element","HoldAction","props","setPressed","sources","Set","activeChangeCallback","press","source","has","wasPressed","size","add","release","delete","callback","undefined","releaseAll","clear","onWindowPointerUp","event","PointerEvent","onWindowBlur","window","addEventListener","removeEventListener","_$createComponent","type","variant","aria-label","aria-pressed","onContextMenu","preventDefault","onPointerDown","button","currentTarget","setPointerCapture","onPointerUp","onPointerCancel","onLostPointerCapture","onKeyDown","onKeyUp","onBlur","onClick","detail","SceneControls","_el$","_tmpl$3","_el$5","firstChild","_$insert","when","_el$2","_tmpl$","_el$3","_el$4","nextSibling","_$effect","_$setAttribute","_el$6","_tmpl$2","_$createComponent","_$setAttribute"],"sources":["../../../../src/components/composites/scene-controls/scene-controls.tsx"],"sourcesContent":["import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ZoomIn, ZoomOut } from 'lucide-solid'\nimport { createSignal, onCleanup, Show, type JSX } from 'solid-js'\nimport { ActionButton } from '../action-button'\n\n/** A host-neutral direction reported while a movement control is held. */\nexport type SceneMovementDirection = 'forward' | 'left' | 'backward' | 'right'\n\n/** Accessible names and tooltip text for the shared scene controls. */\nexport type SceneControlLabels = {\n movementGroup: string\n forward: string\n forwardTooltip: string\n left: string\n leftTooltip: string\n backward: string\n backwardTooltip: string\n right: string\n rightTooltip: string\n jump: string\n jumpTooltip: string\n zoomGroup: string\n zoomOut: string\n zoomIn: string\n}\n\nconst DEFAULT_LABELS: SceneControlLabels = {\n movementGroup: 'Scene movement controls',\n forward: 'Move forward',\n forwardTooltip: 'Hold to move forward',\n left: 'Move left',\n leftTooltip: 'Hold to move left',\n backward: 'Move backward',\n backwardTooltip: 'Hold to move backward',\n right: 'Move right',\n rightTooltip: 'Hold to move right',\n jump: 'Jump',\n jumpTooltip: 'Hold to jump',\n zoomGroup: 'Camera zoom',\n zoomOut: 'Zoom out',\n zoomIn: 'Zoom in',\n}\n\nconst pointerSource = (pointerId: number) => `pointer:${pointerId}`\nconst keySource = (key: string) => `key:${key}`\n\nexport type SceneControlsProps = {\n /** Called on the transition into and out of each held movement direction. */\n onMovementChange?: (direction: SceneMovementDirection, pressed: boolean) => void\n /** Called when the jump action becomes pressed or released. */\n onJumpChange?: (pressed: boolean) => void\n /** Called once when zoom in is activated. */\n onZoomIn?: () => void\n /** Called once when zoom out is activated. */\n onZoomOut?: () => void\n /** Override the default English accessible names and tooltip copy. */\n labels?: Partial<SceneControlLabels>\n}\n\ntype HoldActionProps = {\n label: string\n tooltip: string\n createChangeCallback: () => (pressed: boolean) => void\n children: JSX.Element\n}\n\n/**\n * A held action that reports one down/up pair across pointer and keyboard input.\n *\n * The arrangement, rounded scrim group surfaces and release policy translate\n * Adea's on-screen scene controls; host key synthesis and scene APIs are replaced\n * by callbacks.\n */\nfunction HoldAction(props: HoldActionProps) {\n const [pressed, setPressed] = createSignal(false)\n const sources = new Set<string>()\n let activeChangeCallback: ((pressed: boolean) => void) | undefined\n\n const press = (source: string) => {\n if (sources.has(source)) return\n const wasPressed = sources.size > 0\n sources.add(source)\n if (!wasPressed) {\n setPressed(true)\n activeChangeCallback = props.createChangeCallback()\n activeChangeCallback(true)\n }\n }\n\n const release = (source: string) => {\n if (!sources.delete(source) || sources.size > 0) return\n setPressed(false)\n const callback = activeChangeCallback\n activeChangeCallback = undefined\n callback?.(false)\n }\n\n const releaseAll = () => {\n if (sources.size === 0) return\n sources.clear()\n setPressed(false)\n const callback = activeChangeCallback\n activeChangeCallback = undefined\n callback?.(false)\n }\n\n const onWindowPointerUp = (event: PointerEvent) => release(pointerSource(event.pointerId))\n const onWindowBlur = () => releaseAll()\n\n if (typeof window !== 'undefined') {\n window.addEventListener('pointerup', onWindowPointerUp)\n window.addEventListener('blur', onWindowBlur)\n }\n\n onCleanup(() => {\n releaseAll()\n if (typeof window !== 'undefined') {\n window.removeEventListener('pointerup', onWindowPointerUp)\n window.removeEventListener('blur', onWindowBlur)\n }\n })\n\n return (\n <ActionButton\n type=\"button\"\n variant=\"secondary\"\n size=\"icon-2xl\"\n aria-label={props.label}\n aria-pressed={pressed()}\n tooltip={props.tooltip}\n class=\"touch-none select-none\"\n onContextMenu={(event) => event.preventDefault()}\n onPointerDown={(event) => {\n if (event.button !== 0) return\n event.preventDefault()\n const source = pointerSource(event.pointerId)\n if (sources.has(source)) return\n try {\n event.currentTarget.setPointerCapture(event.pointerId)\n } catch {\n // Pointer capture is not available in every embedded browser. The\n // window pointerup fallback still closes this held action.\n }\n press(source)\n }}\n onPointerUp={(event) => release(pointerSource(event.pointerId))}\n onPointerCancel={(event) => release(pointerSource(event.pointerId))}\n onLostPointerCapture={(event) => release(pointerSource(event.pointerId))}\n onKeyDown={(event) => {\n if (event.key !== ' ' && event.key !== 'Enter') return\n event.preventDefault()\n press(keySource(event.key))\n }}\n onKeyUp={(event) => {\n if (event.key !== ' ' && event.key !== 'Enter') return\n event.preventDefault()\n release(keySource(event.key))\n }}\n onBlur={releaseAll}\n onClick={(event) => {\n // Assistive technology can activate a button without pointer or keyboard\n // down/up events. Treat that activation as one short held action.\n if (event.detail !== 0 || sources.size > 0) return\n press('activation')\n release('activation')\n }}\n >\n {props.children}\n </ActionButton>\n )\n}\n\n/**\n * Shared movement, jump and zoom controls for a host-rendered scene.\n *\n * Movement and jump callbacks receive pressed/released state from pointer and\n * keyboard input. Zoom callbacks fire on activation. The host owns positioning,\n * scene state and camera behavior.\n */\nexport function SceneControls(props: SceneControlsProps) {\n const labels = () => ({ ...DEFAULT_LABELS, ...props.labels })\n\n return (\n <div class=\"flex min-w-0 max-w-full flex-wrap items-end gap-3\">\n <Show when={props.onMovementChange}>\n <div\n role=\"group\"\n aria-label={labels().movementGroup}\n class=\"glass-scrim grid min-w-0 max-w-full grid-cols-3 gap-1.5 rounded-3xl p-2\"\n >\n <span aria-hidden=\"true\" />\n <HoldAction\n label={labels().forward}\n tooltip={labels().forwardTooltip}\n createChangeCallback={() => {\n const callback = props.onMovementChange\n return (pressed) => callback?.('forward', pressed)\n }}\n >\n <ArrowUp aria-hidden=\"true\" />\n </HoldAction>\n <span aria-hidden=\"true\" />\n <HoldAction\n label={labels().left}\n tooltip={labels().leftTooltip}\n createChangeCallback={() => {\n const callback = props.onMovementChange\n return (pressed) => callback?.('left', pressed)\n }}\n >\n <ArrowLeft aria-hidden=\"true\" />\n </HoldAction>\n <HoldAction\n label={labels().backward}\n tooltip={labels().backwardTooltip}\n createChangeCallback={() => {\n const callback = props.onMovementChange\n return (pressed) => callback?.('backward', pressed)\n }}\n >\n <ArrowDown aria-hidden=\"true\" />\n </HoldAction>\n <HoldAction\n label={labels().right}\n tooltip={labels().rightTooltip}\n createChangeCallback={() => {\n const callback = props.onMovementChange\n return (pressed) => callback?.('right', pressed)\n }}\n >\n <ArrowRight aria-hidden=\"true\" />\n </HoldAction>\n </div>\n </Show>\n <div class=\"ml-auto flex min-w-0 max-w-full flex-col items-end gap-2\">\n <Show when={props.onZoomIn || props.onZoomOut}>\n <div\n role=\"group\"\n aria-label={labels().zoomGroup}\n class=\"glass-scrim flex min-w-0 max-w-full flex-wrap gap-1.5 rounded-2xl p-1.5\"\n >\n <Show when={props.onZoomOut}>\n <ActionButton\n type=\"button\"\n variant=\"secondary\"\n size=\"icon-2xl\"\n aria-label={labels().zoomOut}\n tooltip={labels().zoomOut}\n onClick={() => props.onZoomOut?.()}\n >\n <ZoomOut aria-hidden=\"true\" />\n </ActionButton>\n </Show>\n <Show when={props.onZoomIn}>\n <ActionButton\n type=\"button\"\n variant=\"secondary\"\n size=\"icon-2xl\"\n aria-label={labels().zoomIn}\n tooltip={labels().zoomIn}\n onClick={() => props.onZoomIn?.()}\n >\n <ZoomIn aria-hidden=\"true\" />\n </ActionButton>\n </Show>\n </div>\n </Show>\n <Show when={props.onJumpChange}>\n <HoldAction\n label={labels().jump}\n tooltip={labels().jumpTooltip}\n createChangeCallback={() => {\n const callback = props.onJumpChange\n return (pressed) => callback?.(pressed)\n }}\n >\n <ArrowUp aria-hidden=\"true\" />\n </HoldAction>\n </Show>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAyBA,IAAM2B,iBAAqC;CACzCd,eAAe;CACfC,SAAS;CACTC,gBAAgB;CAChBC,MAAM;CACNC,aAAa;CACbC,UAAU;CACVC,iBAAiB;CACjBC,OAAO;CACPC,cAAc;CACdC,MAAM;CACNC,aAAa;CACbC,WAAW;CACXC,SAAS;CACTC,QAAQ;AACV;AAEA,IAAME,iBAAiBC,cAAsB,WAAWA;AACxD,IAAMC,aAAaC,QAAgB,OAAOA;;;;;;;;AA6B1C,SAASgB,WAAWC,OAAwB;CAC1C,MAAM,CAACb,SAASc,cAAc3C,aAAa,KAAK;CAChD,MAAM4C,0BAAU,IAAIC,IAAY;CAChC,IAAIC;CAEJ,MAAMC,SAASC,WAAmB;EAChC,IAAIJ,QAAQK,IAAID,MAAM,GAAG;EACzB,MAAME,aAAaN,QAAQO,OAAO;EAClCP,QAAQQ,IAAIJ,MAAM;EAClB,IAAI,CAACE,YAAY;GACfP,WAAW,IAAI;GACfG,uBAAuBJ,MAAMJ,qBAAqB;GAClDQ,qBAAqB,IAAI;EAC3B;CACF;CAEA,MAAMO,WAAWL,WAAmB;EAClC,IAAI,CAACJ,QAAQU,OAAON,MAAM,KAAKJ,QAAQO,OAAO,GAAG;EACjDR,WAAW,KAAK;EAChB,MAAMY,WAAWT;EACjBA,uBAAuBU,KAAAA;EACvBD,WAAW,KAAK;CAClB;CAEA,MAAME,mBAAmB;EACvB,IAAIb,QAAQO,SAAS,GAAG;EACxBP,QAAQc,MAAM;EACdf,WAAW,KAAK;EAChB,MAAMY,WAAWT;EACjBA,uBAAuBU,KAAAA;EACvBD,WAAW,KAAK;CAClB;CAEA,MAAMI,qBAAqBC,UAAwBP,QAAQ/B,cAAcsC,MAAMrC,SAAS,CAAC;CACzF,MAAMuC,qBAAqBL,WAAW;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CAAA;KAAA;IAAA,CAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAyF;CAAA,EAAA,CAAA;AAMpB"}
|
|
1
|
+
{"version":3,"file":"scene-controls.js","names":["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","ZoomIn","ZoomOut","createSignal","onCleanup","Show","ActionButton","movementGroup","forward","forwardTooltip","left","leftTooltip","backward","backwardTooltip","right","rightTooltip","jump","jumpTooltip","zoomGroup","zoomOut","zoomIn","DEFAULT_LABELS","pointerSource","pointerId","keySource","key","onMovementChange","pressed","onJumpChange","onZoomIn","onZoomOut","labels","label","tooltip","createChangeCallback","children","HoldAction","props","setPressed","sources","Set","activeChangeCallback","press","source","has","wasPressed","size","add","release","delete","callback","undefined","releaseAll","clear","onWindowPointerUp","event","onWindowBlur","window","addEventListener","removeEventListener","_$createComponent","type","variant","onContextMenu","preventDefault","onPointerDown","button","currentTarget","setPointerCapture","onPointerUp","onPointerCancel","onLostPointerCapture","onKeyDown","onKeyUp","onBlur","onClick","detail","SceneControls","_el$","_tmpl$3","_el$5","firstChild","_$insert","when","_el$2","_tmpl$","_el$4","nextSibling","_$effect","_$setAttribute","_el$6","_tmpl$2"],"sources":["../../../../src/components/composites/scene-controls/scene-controls.tsx"],"sourcesContent":["import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ZoomIn, ZoomOut } from 'lucide-solid'\nimport { createSignal, onCleanup, Show, type JSX } from 'solid-js'\nimport { ActionButton } from '../action-button'\n\n/** A host-neutral direction reported while a movement control is held. */\nexport type SceneMovementDirection = 'forward' | 'left' | 'backward' | 'right'\n\n/** Accessible names and tooltip text for the shared scene controls. */\nexport type SceneControlLabels = {\n movementGroup: string\n forward: string\n forwardTooltip: string\n left: string\n leftTooltip: string\n backward: string\n backwardTooltip: string\n right: string\n rightTooltip: string\n jump: string\n jumpTooltip: string\n zoomGroup: string\n zoomOut: string\n zoomIn: string\n}\n\nconst DEFAULT_LABELS: SceneControlLabels = {\n movementGroup: 'Scene movement controls',\n forward: 'Move forward',\n forwardTooltip: 'Hold to move forward',\n left: 'Move left',\n leftTooltip: 'Hold to move left',\n backward: 'Move backward',\n backwardTooltip: 'Hold to move backward',\n right: 'Move right',\n rightTooltip: 'Hold to move right',\n jump: 'Jump',\n jumpTooltip: 'Hold to jump',\n zoomGroup: 'Camera zoom',\n zoomOut: 'Zoom out',\n zoomIn: 'Zoom in',\n}\n\nconst pointerSource = (pointerId: number) => `pointer:${pointerId}`\nconst keySource = (key: string) => `key:${key}`\n\nexport type SceneControlsProps = {\n /** Called on the transition into and out of each held movement direction. */\n onMovementChange?: (direction: SceneMovementDirection, pressed: boolean) => void\n /** Called when the jump action becomes pressed or released. */\n onJumpChange?: (pressed: boolean) => void\n /** Called once when zoom in is activated. */\n onZoomIn?: () => void\n /** Called once when zoom out is activated. */\n onZoomOut?: () => void\n /** Override the default English accessible names and tooltip copy. */\n labels?: Partial<SceneControlLabels>\n}\n\ntype HoldActionProps = {\n label: string\n tooltip: string\n createChangeCallback: () => (pressed: boolean) => void\n children: JSX.Element\n}\n\n/**\n * A held action that reports one down/up pair across pointer and keyboard input.\n *\n * The arrangement, rounded scrim group surfaces and release policy translate\n * Adea's on-screen scene controls; host key synthesis and scene APIs are replaced\n * by callbacks.\n */\nfunction HoldAction(props: HoldActionProps) {\n const [pressed, setPressed] = createSignal(false)\n const sources = new Set<string>()\n let activeChangeCallback: ((pressed: boolean) => void) | undefined\n\n const press = (source: string) => {\n if (sources.has(source)) return\n const wasPressed = sources.size > 0\n sources.add(source)\n if (!wasPressed) {\n setPressed(true)\n activeChangeCallback = props.createChangeCallback()\n activeChangeCallback(true)\n }\n }\n\n const release = (source: string) => {\n if (!sources.delete(source) || sources.size > 0) return\n setPressed(false)\n const callback = activeChangeCallback\n activeChangeCallback = undefined\n callback?.(false)\n }\n\n const releaseAll = () => {\n if (sources.size === 0) return\n sources.clear()\n setPressed(false)\n const callback = activeChangeCallback\n activeChangeCallback = undefined\n callback?.(false)\n }\n\n const onWindowPointerUp = (event: PointerEvent) => release(pointerSource(event.pointerId))\n const onWindowBlur = () => releaseAll()\n\n if (typeof window !== 'undefined') {\n window.addEventListener('pointerup', onWindowPointerUp)\n window.addEventListener('blur', onWindowBlur)\n }\n\n onCleanup(() => {\n releaseAll()\n if (typeof window !== 'undefined') {\n window.removeEventListener('pointerup', onWindowPointerUp)\n window.removeEventListener('blur', onWindowBlur)\n }\n })\n\n return (\n <ActionButton\n type=\"button\"\n variant=\"secondary\"\n size=\"icon-2xl\"\n aria-label={props.label}\n aria-pressed={pressed()}\n tooltip={props.tooltip}\n class=\"touch-none select-none\"\n onContextMenu={(event) => event.preventDefault()}\n onPointerDown={(event) => {\n if (event.button !== 0) return\n event.preventDefault()\n const source = pointerSource(event.pointerId)\n if (sources.has(source)) return\n try {\n event.currentTarget.setPointerCapture(event.pointerId)\n } catch {\n // Pointer capture is not available in every embedded browser. The\n // window pointerup fallback still closes this held action.\n }\n press(source)\n }}\n onPointerUp={(event) => release(pointerSource(event.pointerId))}\n onPointerCancel={(event) => release(pointerSource(event.pointerId))}\n onLostPointerCapture={(event) => release(pointerSource(event.pointerId))}\n onKeyDown={(event) => {\n if (event.key !== ' ' && event.key !== 'Enter') return\n event.preventDefault()\n press(keySource(event.key))\n }}\n onKeyUp={(event) => {\n if (event.key !== ' ' && event.key !== 'Enter') return\n event.preventDefault()\n release(keySource(event.key))\n }}\n onBlur={releaseAll}\n onClick={(event) => {\n // Assistive technology can activate a button without pointer or keyboard\n // down/up events. Treat that activation as one short held action.\n if (event.detail !== 0 || sources.size > 0) return\n press('activation')\n release('activation')\n }}\n >\n {props.children}\n </ActionButton>\n )\n}\n\n/**\n * Shared movement, jump and zoom controls for a host-rendered scene.\n *\n * Movement and jump callbacks receive pressed/released state from pointer and\n * keyboard input. Zoom callbacks fire on activation. The host owns positioning,\n * scene state and camera behavior.\n */\nexport function SceneControls(props: SceneControlsProps) {\n const labels = () => ({ ...DEFAULT_LABELS, ...props.labels })\n\n return (\n <div class=\"flex min-w-0 max-w-full flex-wrap items-end gap-3\">\n <Show when={props.onMovementChange}>\n <div\n role=\"group\"\n aria-label={labels().movementGroup}\n class=\"glass-scrim grid min-w-0 max-w-full grid-cols-3 gap-1.5 rounded-3xl p-2\"\n >\n <span aria-hidden=\"true\" />\n <HoldAction\n label={labels().forward}\n tooltip={labels().forwardTooltip}\n createChangeCallback={() => {\n const callback = props.onMovementChange\n return (pressed) => callback?.('forward', pressed)\n }}\n >\n <ArrowUp aria-hidden=\"true\" />\n </HoldAction>\n <span aria-hidden=\"true\" />\n <HoldAction\n label={labels().left}\n tooltip={labels().leftTooltip}\n createChangeCallback={() => {\n const callback = props.onMovementChange\n return (pressed) => callback?.('left', pressed)\n }}\n >\n <ArrowLeft aria-hidden=\"true\" />\n </HoldAction>\n <HoldAction\n label={labels().backward}\n tooltip={labels().backwardTooltip}\n createChangeCallback={() => {\n const callback = props.onMovementChange\n return (pressed) => callback?.('backward', pressed)\n }}\n >\n <ArrowDown aria-hidden=\"true\" />\n </HoldAction>\n <HoldAction\n label={labels().right}\n tooltip={labels().rightTooltip}\n createChangeCallback={() => {\n const callback = props.onMovementChange\n return (pressed) => callback?.('right', pressed)\n }}\n >\n <ArrowRight aria-hidden=\"true\" />\n </HoldAction>\n </div>\n </Show>\n <div class=\"ml-auto flex min-w-0 max-w-full flex-col items-end gap-2\">\n <Show when={props.onZoomIn || props.onZoomOut}>\n <div\n role=\"group\"\n aria-label={labels().zoomGroup}\n class=\"glass-scrim flex min-w-0 max-w-full flex-wrap gap-1.5 rounded-2xl p-1.5\"\n >\n <Show when={props.onZoomOut}>\n <ActionButton\n type=\"button\"\n variant=\"secondary\"\n size=\"icon-2xl\"\n aria-label={labels().zoomOut}\n tooltip={labels().zoomOut}\n onClick={() => props.onZoomOut?.()}\n >\n <ZoomOut aria-hidden=\"true\" />\n </ActionButton>\n </Show>\n <Show when={props.onZoomIn}>\n <ActionButton\n type=\"button\"\n variant=\"secondary\"\n size=\"icon-2xl\"\n aria-label={labels().zoomIn}\n tooltip={labels().zoomIn}\n onClick={() => props.onZoomIn?.()}\n >\n <ZoomIn aria-hidden=\"true\" />\n </ActionButton>\n </Show>\n </div>\n </Show>\n <Show when={props.onJumpChange}>\n <HoldAction\n label={labels().jump}\n tooltip={labels().jumpTooltip}\n createChangeCallback={() => {\n const callback = props.onJumpChange\n return (pressed) => callback?.(pressed)\n }}\n >\n <ArrowUp aria-hidden=\"true\" />\n </HoldAction>\n </Show>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAyBA,IAAMwB,iBAAqC;CACzCd,eAAe;CACfC,SAAS;CACTC,gBAAgB;CAChBC,MAAM;CACNC,aAAa;CACbC,UAAU;CACVC,iBAAiB;CACjBC,OAAO;CACPC,cAAc;CACdC,MAAM;CACNC,aAAa;CACbC,WAAW;CACXC,SAAS;CACTC,QAAQ;AACV;AAEA,IAAME,iBAAiBC,cAAsB,WAAWA;AACxD,IAAMC,aAAaC,QAAgB,OAAOA;;;;;;;;AA6B1C,SAASW,WAAWC,OAAwB;CAC1C,MAAM,CAACV,SAASW,cAAcnC,aAAa,KAAK;CAChD,MAAMoC,0BAAU,IAAIC,IAAY;CAChC,IAAIC;CAEJ,MAAMC,SAASC,WAAmB;EAChC,IAAIJ,QAAQK,IAAID,MAAM,GAAG;EACzB,MAAME,aAAaN,QAAQO,OAAO;EAClCP,QAAQQ,IAAIJ,MAAM;EAClB,IAAI,CAACE,YAAY;GACfP,WAAW,IAAI;GACfG,uBAAuBJ,MAAMH,qBAAqB;GAClDO,qBAAqB,IAAI;EAC3B;CACF;CAEA,MAAMO,WAAWL,WAAmB;EAClC,IAAI,CAACJ,QAAQU,OAAON,MAAM,KAAKJ,QAAQO,OAAO,GAAG;EACjDR,WAAW,KAAK;EAChB,MAAMY,WAAWT;EACjBA,uBAAuBU,KAAAA;EACvBD,WAAW,KAAK;CAClB;CAEA,MAAME,mBAAmB;EACvB,IAAIb,QAAQO,SAAS,GAAG;EACxBP,QAAQ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AEF,OAAO,CAAC,CAACd;KAAW;KAC7BiB,4BAA4B;MAC1B,MAAMgB,WAAWb,MAAMT;MACvB,QAAQD,YAAYuB,WAAWvB,OAAO;KACxC;KAAC,IAAAQ,WAAA;MAAA,OAAAyB,gBAEA5D,SAAO,EAAA,eAAA,OAAA,CAAA;KAAA;IAAA,CAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAA8E;CAAA,EAAA,CAAA;AAMpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-layout.js","names":["
|
|
1
|
+
{"version":3,"file":"settings-layout.js","names":["createSignal","onCleanup","onMount","splitProps","MD_BREAKPOINT","cn","Tabs","SettingsNavigation","groups","value","onReselect","revealSelected","navigationLayout","children","RAIL_MEDIA_QUERY","railQuery","window","matchMedia","undefined","SettingsLayout","props","local","rest","wide","setWide","matches","query","update","addEventListener","removeEventListener","layout","requested","_$createComponent","_$mergeProps","orientation","class","_el$","_tmpl$","_$insert"],"sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { createSignal, onCleanup, onMount, splitProps } from 'solid-js'\nimport { MD_BREAKPOINT } from '#lib/breakpoints'\nimport { cn } from '#lib/utils'\nimport { Tabs } from '../../ui/tabs'\nimport { SettingsNavigation, type SettingsNavigationGroup } from './settings-navigation'\n\nexport type SettingsLayoutProps = Omit<\n ComponentProps<typeof Tabs>,\n 'children' | 'orientation' | 'value' | 'defaultValue' | 'onChange'\n> & {\n /** Grouped navigation entries; the host owns their values and panel content. */\n groups: readonly SettingsNavigationGroup[]\n /** Accessible name for the tab list. */\n 'aria-label': string\n /** The host-controlled selected destination. */\n value: string\n /** Updates the host-controlled selected destination. */\n onChange: (value: string) => void\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 scroll. */\n revealSelected?: boolean | ((trigger: HTMLButtonElement | undefined) => void)\n /**\n * How the section navigation sits beside the panels. `auto` (the default) is\n * the vertical rail from 48rem of viewport width up and a horizontal,\n * scrollable strip of tabs above the panels below it. `rail` and `strip` pin\n * one shape at every width.\n */\n navigationLayout?: SettingsNavigationLayout\n /** Panels must be rendered as `TabsContent` descendants. */\n children?: JSX.Element\n}\n\nexport type SettingsNavigationLayout = 'auto' | 'rail' | 'strip'\n\n/** Below the `md` breakpoint the rail becomes a strip. */\nconst RAIL_MEDIA_QUERY = `(min-width: ${MD_BREAKPOINT})`\n\nfunction railQuery(): MediaQueryList | undefined {\n return typeof window === 'undefined' || typeof window.matchMedia !== 'function'\n ? undefined\n : window.matchMedia(RAIL_MEDIA_QUERY)\n}\n\n/**\n * SettingsLayout.\n *\n * A controlled, vertical settings rail beside its scrollable panel viewport.\n * The host keeps ownership of selection, URL/hash state and panel content.\n *\n * Below 48rem the rail becomes a horizontal strip of tabs above the panels.\n * A 6rem rail at phone width clips every label, so this is the default rather\n * than an opt-in. It changes the tab root's orientation, not just its\n * styling: the list's `aria-orientation` and Kobalte's arrow keys (Up/Down on\n * the rail, Left/Right on the strip) follow the axis the reader sees. The\n * breakpoint is the viewport's, like CatalogBrowser's and ContextualSidebar's,\n * and is read before the first render so a phone never paints the rail. A\n * server render, which has no viewport, renders the rail.\n */\nexport function SettingsLayout(props: SettingsLayoutProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'groups',\n 'aria-label',\n 'value',\n 'onReselect',\n 'revealSelected',\n 'navigationLayout',\n ])\n\n const [wide, setWide] = createSignal(railQuery()?.matches ?? true)\n onMount(() => {\n const query = railQuery()\n if (!query) return\n const update = () => setWide(query.matches)\n update()\n query.addEventListener('change', update)\n onCleanup(() => query.removeEventListener('change', update))\n })\n const layout = (): 'rail' | 'strip' => {\n const requested = local.navigationLayout ?? 'auto'\n if (requested !== 'auto') return requested\n return wide() ? 'rail' : 'strip'\n }\n\n return (\n <Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>\n )\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAMc,mBAAmB,eAAeV,cAAa;AAErD,SAASW,YAAwC;CAC/C,OAAO,OAAOC,WAAW,eAAe,OAAOA,OAAOC,eAAe,aACjEC,KAAAA,IACAF,OAAOC,WAAWH,gBAAgB;AACxC;;;;;;;;;;;;;;;;AAiBA,SAAgBK,eAAeC,OAA4B;CACzD,MAAM,CAACC,OAAOC,QAAQnB,WAAWiB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAkB,CACnB;CAED,MAAM,CAACG,MAAMC,WAAWxB,aAAae,UAAU,CAAC,EAAEU,WAAW,IAAI;CACjEvB,cAAc;EACZ,MAAMwB,QAAQX,UAAU;EACxB,IAAI,CAACW,OAAO;EACZ,MAAMC,eAAeH,QAAQE,MAAMD,OAAO;EAC1CE,OAAO;EACPD,MAAME,iBAAiB,UAAUD,MAAM;EACvC1B,gBAAgByB,MAAMG,oBAAoB,UAAUF,MAAM,CAAC;CAC7D,CAAC;CACD,MAAMG,eAAiC;EACrC,MAAMC,YAAYV,MAAMT,oBAAoB;EAC5C,IAAImB,cAAc,QAAQ,OAAOA;EACjC,OAAOR,KAAK,IAAI,SAAS;CAC3B;CAEA,OAAAS,gBACG1B,MAAI2B,WACCX,MAAI;EAAA,IACRY,cAAW;GAAA,OAAEJ,OAAO,MAAM,SAAS,aAAa;EAAY;EAAA,KAAA,4BAAA;GAAA,OACpCA,OAAO;EAAC;EAAA,IAChCrB,QAAK;GAAA,OAAEY,MAAMZ;EAAK;EAAA,KAAA,WAAA;GAAA,OACXJ,GAAG,gCAAgCgB,MAAMc,KAAK;EAAC;EAAA,IAAAtB,WAAA;GAAA,OAAA,CAAAmB,gBAErDzB,oBAAkB;IAAA,KAAA,gBAAA;KAAA,OACLc,MAAM;IAAa;IAAA,IAC/Bb,SAAM;KAAA,OAAEa,MAAMb;IAAM;IAAA,IACpBC,QAAK;KAAA,OAAEY,MAAMZ;IAAK;IAAA,IAClBC,aAAU;KAAA,OAAEW,MAAMX;IAAU;IAAA,IAC5BC,iBAAc;KAAA,OAAEU,MAAMV;IAAc;IAAA,KAAA,WAAA;KAAA,OAC7BmB,OAAO,MAAM,SAAS,sBAAsBZ,KAAAA;IAAS;GAAA,CAAA,UAAA;IAAA,IAAAkB,OAAAC,OAAA;IAAAC,OAAAF,YAM3Df,MAAMR,QAAQ;IAAA,OAAAuB;GAAA,EAAA,CAAA,CAAA;EAAA;CAAA,CAAA,CAAA;AAIvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-navigation.js","names":["useTabsContext","JSX","createEffect","createUniqueId","onCleanup","Show","splitProps","cn","sidebarNavItemClass","sidebarNavItemStateClass","TabsList","TabsTrigger","TabsListProps","Text","SettingsNavigationItem","value","label","icon","Element","disabled","SettingsNavigationGroup","items","SettingsNavigationProps","Omit","groups","onReselect","revealSelected","trigger","HTMLButtonElement","scrollContainerNearest","container","HTMLElement","row","style","window","getComputedStyle","box","getBoundingClientRect","rowBox","overflowX","left","scrollLeft","right","overflowY","top","scrollTop","bottom","revealNearest","parentElement","SettingsNavigation","props","local","rest","tabs","strip","orientation","triggers","Map","groupIdPrefix","reveal","revealCurrent","get","addEventListener","removeEventListener","_$createComponent","_$mergeProps","aria-label","class","children","map","group","groupIndex","groupId","_el$","_tmpl$","_el$2","firstChild","_$setAttribute","_$insert","when","variant","tone","item","ref","element","set","delete","onClick","idle","_$memo","_el$3","_tmpl$2","_$effect","_$className","truncate","_$createComponent","_$mergeProps","_$memo","_$className"],"sources":["../../../../src/components/composites/settings/settings-navigation.tsx"],"sourcesContent":["import { useTabsContext } from '@kobalte/core/tabs'\nimport type { JSX } from 'solid-js'\nimport { createEffect, createUniqueId, onCleanup, Show, splitProps } 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 Kobalte\n * binds: `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 * Kobalte owns 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 */\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 */\nfunction scrollContainerNearest(container: HTMLElement, row: HTMLElement): void {\n const style = window.getComputedStyle(container)\n const box = container.getBoundingClientRect()\n const rowBox = row.getBoundingClientRect()\n if (style.overflowX === 'auto' || style.overflowX === 'scroll') {\n if (rowBox.left < box.left) container.scrollLeft += rowBox.left - box.left\n else if (rowBox.right > box.right) container.scrollLeft += rowBox.right - box.right\n }\n if (style.overflowY === 'auto' || style.overflowY === 'scroll') {\n if (rowBox.top < box.top) container.scrollTop += rowBox.top - box.top\n else if (rowBox.bottom > box.bottom) container.scrollTop += rowBox.bottom - box.bottom\n }\n}\n\nfunction revealNearest(row: HTMLElement): void {\n for (let container = row.parentElement; container; container = container.parentElement) {\n scrollContainerNearest(container, row)\n }\n}\n\nexport function SettingsNavigation(props: SettingsNavigationProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'aria-label',\n 'groups',\n 'value',\n 'onReselect',\n 'revealSelected',\n ])\n const tabs = useTabsContext()\n const strip = () => tabs.orientation() === 'horizontal'\n const triggers = new Map<string, HTMLButtonElement>()\n const groupIdPrefix = `settings-navigation-${createUniqueId()}`\n\n createEffect(() => {\n const value = local.value\n const reveal = local.revealSelected\n // Tracked so a rail that becomes a strip (or back) re-reveals on the new axis.\n strip()\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 window.addEventListener('resize', revealCurrent)\n onCleanup(() => window.removeEventListener('resize', revealCurrent))\n })\n\n return (\n <TabsList\n data-slot=\"settings-navigation\"\n aria-label={local['aria-label']}\n orientation={tabs.orientation()}\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 strip()\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 local.class\n )}\n {...rest}\n >\n {local.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 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={!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 data-slot=\"settings-navigation-trigger\"\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 (local.value === item.value) local.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 strip() ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !strip() })}>{item.label}</span>\n </TabsTrigger>\n ))}\n </div>\n )\n })}\n </TabsList>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,SAAS6B,uBAAuBC,WAAwBE,KAAwB;CAC9E,MAAMC,QAAQC,OAAOC,iBAAiBL,SAAS;CAC/C,MAAMM,MAAMN,UAAUO,sBAAsB;CAC5C,MAAMC,SAASN,IAAIK,sBAAsB;CACzC,IAAIJ,MAAMM,cAAc,UAAUN,MAAMM,cAAc,UAAU;EAC9D,IAAID,OAAOE,OAAOJ,IAAII,MAAMV,UAAUW,cAAcH,OAAOE,OAAOJ,IAAII;OACjE,IAAIF,OAAOI,QAAQN,IAAIM,OAAOZ,UAAUW,cAAcH,OAAOI,QAAQN,IAAIM;CAChF;CACA,IAAIT,MAAMU,cAAc,UAAUV,MAAMU,cAAc,UAAU;EAC9D,IAAIL,OAAOM,MAAMR,IAAIQ,KAAKd,UAAUe,aAAaP,OAAOM,MAAMR,IAAIQ;OAC7D,IAAIN,OAAOQ,SAASV,IAAIU,QAAQhB,UAAUe,aAAaP,OAAOQ,SAASV,IAAIU;CAClF;AACF;AAEA,SAASC,cAAcf,KAAwB;CAC7C,KAAK,IAAIF,YAAYE,IAAIgB,eAAelB,WAAWA,YAAYA,UAAUkB,eACvEnB,uBAAuBC,WAAWE,GAAG;AAEzC;AAEA,SAAgBiB,mBAAmBC,OAAgC;CACjE,MAAM,CAACC,OAAOC,QAAQ9C,WAAW4C,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;CAAgB,CACjB;CACD,MAAMG,OAAOrD,eAAe;CAC5B,MAAMsD,cAAcD,KAAKE,YAAY,MAAM;CAC3C,MAAMC,2BAAW,IAAIC,IAA+B;CACpD,MAAMC,gBAAgB,uBAAuBvD,eAAe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,aAAW;KAAA,aAAA;KAAA,oBAEQ6D;KAAO,IACzBzD,QAAK;MAAA,OAAEmE,KAAKnE;KAAK;KAAA,IACjBI,WAAQ;MAAA,OAAE+D,KAAK/D;KAAQ;KAAAgE,MACjBC,YAA2C;MAC/C,IAAIA,SAAS5B,SAAS6B,IAAIH,KAAKnE,OAAOqE,OAAO;WACxC5B,SAAS8B,OAAOJ,KAAKnE,KAAK;KACjC;KACAwE,eAAe;MACb,IAAIpC,MAAMpC,UAAUmE,KAAKnE,OAAOoC,MAAM1B,aAAayD,KAAKnE,KAAK;KAC/D;KAAC,KAAA,WAAA;MAAA,OACMR,GACLC,qBACAC,yBAAyB+E,MACzB,yGACAlC,MAAM,IAAI,oBAAoB,QAChC;KAAC;KAAA,IAAAc,WAAA;MAAA,OAAA,CAAAqB,WAEAP,KAAKjE,IAAI,UAAA;OAAA,IAAAyE,QAAAC,QAAA;OAAAb,OAAAY,aAC2CR,KAAKlE,KAAK;OAAA4E,aAAAC,UAAAH,OAAlDnF,GAAG,WAAW,EAAEuF,UAAU,CAACxC,MAAM,EAAE,CAAC,CAAC,CAAA;OAAA,OAAAoC;MAAA,EAAA,CAAA,CAAA;KAAA;IAAA,CAAA,CAErD,GAAC,IAAA;IAAAE,aAAAC,UAAApB,MA5CKlE,GACL,gBACA+C,MAAM,IACF,4GACA,kBACN,CAAC,CAAA;IAAA,OAAAmB;GAAA,EAAA,CAAA;EA0CP,CAAC;CAAC,EAAA,CAAA,CAAA;AAGR"}
|
|
1
|
+
{"version":3,"file":"settings-navigation.js","names":["useTabsContext","createEffect","createUniqueId","onCleanup","Show","splitProps","cn","sidebarNavItemClass","sidebarNavItemStateClass","TabsList","TabsTrigger","Text","value","label","icon","disabled","items","groups","onReselect","revealSelected","trigger","scrollContainerNearest","container","row","style","window","getComputedStyle","box","getBoundingClientRect","rowBox","overflowX","left","scrollLeft","right","overflowY","top","scrollTop","bottom","revealNearest","parentElement","SettingsNavigation","props","local","rest","tabs","strip","orientation","triggers","Map","groupIdPrefix","reveal","revealCurrent","get","addEventListener","removeEventListener","_$createComponent","_$mergeProps","class","children","map","group","groupIndex","groupId","_el$","_tmpl$","_el$2","firstChild","_$setAttribute","_$insert","when","variant","tone","item","ref","element","set","delete","onClick","idle","_$memo","_el$3","_tmpl$2","_$effect","_$className","truncate"],"sources":["../../../../src/components/composites/settings/settings-navigation.tsx"],"sourcesContent":["import { useTabsContext } from '@kobalte/core/tabs'\nimport type { JSX } from 'solid-js'\nimport { createEffect, createUniqueId, onCleanup, Show, splitProps } 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 Kobalte\n * binds: `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 * Kobalte owns 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 */\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 */\nfunction scrollContainerNearest(container: HTMLElement, row: HTMLElement): void {\n const style = window.getComputedStyle(container)\n const box = container.getBoundingClientRect()\n const rowBox = row.getBoundingClientRect()\n if (style.overflowX === 'auto' || style.overflowX === 'scroll') {\n if (rowBox.left < box.left) container.scrollLeft += rowBox.left - box.left\n else if (rowBox.right > box.right) container.scrollLeft += rowBox.right - box.right\n }\n if (style.overflowY === 'auto' || style.overflowY === 'scroll') {\n if (rowBox.top < box.top) container.scrollTop += rowBox.top - box.top\n else if (rowBox.bottom > box.bottom) container.scrollTop += rowBox.bottom - box.bottom\n }\n}\n\nfunction revealNearest(row: HTMLElement): void {\n for (let container = row.parentElement; container; container = container.parentElement) {\n scrollContainerNearest(container, row)\n }\n}\n\nexport function SettingsNavigation(props: SettingsNavigationProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'aria-label',\n 'groups',\n 'value',\n 'onReselect',\n 'revealSelected',\n ])\n const tabs = useTabsContext()\n const strip = () => tabs.orientation() === 'horizontal'\n const triggers = new Map<string, HTMLButtonElement>()\n const groupIdPrefix = `settings-navigation-${createUniqueId()}`\n\n createEffect(() => {\n const value = local.value\n const reveal = local.revealSelected\n // Tracked so a rail that becomes a strip (or back) re-reveals on the new axis.\n strip()\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 window.addEventListener('resize', revealCurrent)\n onCleanup(() => window.removeEventListener('resize', revealCurrent))\n })\n\n return (\n <TabsList\n data-slot=\"settings-navigation\"\n aria-label={local['aria-label']}\n orientation={tabs.orientation()}\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 strip()\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 local.class\n )}\n {...rest}\n >\n {local.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 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={!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 data-slot=\"settings-navigation-trigger\"\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 (local.value === item.value) local.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 strip() ? 'w-auto shrink-0' : 'w-full'\n )}\n >\n {item.icon}\n <span class={cn('min-w-0', { truncate: !strip() })}>{item.label}</span>\n </TabsTrigger>\n ))}\n </div>\n )\n })}\n </TabsList>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,SAASqB,uBAAuBC,WAAwBC,KAAwB;CAC9E,MAAMC,QAAQC,OAAOC,iBAAiBJ,SAAS;CAC/C,MAAMK,MAAML,UAAUM,sBAAsB;CAC5C,MAAMC,SAASN,IAAIK,sBAAsB;CACzC,IAAIJ,MAAMM,cAAc,UAAUN,MAAMM,cAAc,UAAU;EAC9D,IAAID,OAAOE,OAAOJ,IAAII,MAAMT,UAAUU,cAAcH,OAAOE,OAAOJ,IAAII;OACjE,IAAIF,OAAOI,QAAQN,IAAIM,OAAOX,UAAUU,cAAcH,OAAOI,QAAQN,IAAIM;CAChF;CACA,IAAIT,MAAMU,cAAc,UAAUV,MAAMU,cAAc,UAAU;EAC9D,IAAIL,OAAOM,MAAMR,IAAIQ,KAAKb,UAAUc,aAAaP,OAAOM,MAAMR,IAAIQ;OAC7D,IAAIN,OAAOQ,SAASV,IAAIU,QAAQf,UAAUc,aAAaP,OAAOQ,SAASV,IAAIU;CAClF;AACF;AAEA,SAASC,cAAcf,KAAwB;CAC7C,KAAK,IAAID,YAAYC,IAAIgB,eAAejB,WAAWA,YAAYA,UAAUiB,eACvElB,uBAAuBC,WAAWC,GAAG;AAEzC;AAEA,SAAgBiB,mBAAmBC,OAAgC;CACjE,MAAM,CAACC,OAAOC,QAAQtC,WAAWoC,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;CAAgB,CACjB;CACD,MAAMG,O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