@adea-ai/ui 0.152.2 → 0.152.4
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.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.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.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.map +1 -1
- 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.map +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.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.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/model-selector/model-selector.tsx +4 -1
- 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/package.json +11 -11
- package/registry.json +65 -65
- package/src/components/composites/model-selector/model-selector.tsx +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-reorder-dialog.js","names":["ArrowDown","ArrowUp","For","Show","createEffect","createSignal","on","onCleanup","Accessor","Button","Dialog","DialogClose","DialogContent","DialogDescription","DialogFooter","DialogHeader","DialogTitle","ActionButton","moveTarget","moveWorkspace","WorkspaceMoveDirection","WorkspaceReorderItem","id","name","fixed","WorkspaceReorderDialogProps","open","onOpenChange","workspaces","onReorder","ids","Promise","title","restoreFocusRef","HTMLElement","WorkspaceReorderDialog","props","status","setStatus","error","setError","pending","setPending","list","HTMLOListElement","session","disposed","frame","undefined","cancelAnimationFrame","defer","focusMove","owner","direction","restore","row","querySelector","CSS","escape","wanted","other","target","getAttribute","document","activeElement","focus","preventScroll","requestAnimationFrame","move","item","next","current","indexOf","length","_$createComponent","children","_el$","_tmpl$","_$use","el","_$insert","each","_el$4","_tmpl$4","_el$5","firstChild","when","fallback","_tmpl$5","const","variant","size","aria-label","tooltip","disabled","onClick","_$effect","_$setAttribute","_el$2","_tmpl$2","_el$3","_tmpl$3","as","_$createComponent","_$setAttribute"],"sources":["../../../../src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx"],"sourcesContent":["import { ArrowDown, ArrowUp } from 'lucide-solid'\nimport { For, Show, createEffect, createSignal, on, onCleanup, type Accessor } from 'solid-js'\nimport { Button } from '../../ui/button'\nimport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '../../ui/dialog'\nimport { ActionButton } from '../action-button'\nimport { moveTarget, moveWorkspace, type WorkspaceMoveDirection } from './workspace-order'\n\nexport type WorkspaceReorderItem = {\n id: string\n name: string\n fixed?: boolean\n}\n\nexport type WorkspaceReorderDialogProps = {\n open: boolean\n onOpenChange(open: boolean): void\n workspaces: readonly WorkspaceReorderItem[]\n /** Receives the full id order after one move. May be async; a rejection shows an error. */\n onReorder(ids: readonly string[]): void | Promise<void>\n title?: string\n /** Where focus returns on close; the menu item that opened the dialog is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/**\n * WorkspaceReorderDialog.\n *\n * Ordering by buttons, not by dragging, so it works from the keyboard and with\n * a screen reader: every row has a labelled Move up and Move down. Each move is\n * reported to the host straight away (there is no Save), the moved row keeps\n * focus on the control that was used, and the new position is announced.\n *\n * One save runs at a time, even across a close and reopen: the moves stay\n * disabled until the host's promise settles. A save that finishes after the\n * dialog has closed reports nothing here (the host owns any failure it wants\n * to surface) and never moves focus.\n */\nexport function WorkspaceReorderDialog(props: WorkspaceReorderDialogProps) {\n const [status, setStatus] = createSignal('')\n const [error, setError] = createSignal('')\n const [pending, setPending] = createSignal(false)\n let list: HTMLOListElement | undefined\n // Each open and each close starts a new session. A save belongs to the session\n // it began in; once the dialog has closed (or closed and reopened) its result\n // no longer speaks for what is on screen, so it must not touch the status\n // line or focus. `pending` is deliberately not reset with the session: the\n // host's save is still running, so the next move waits for it instead of\n // running a second save beside it.\n let session = 0\n let disposed = false\n let frame: number | undefined\n\n createEffect(\n on(\n () => props.open,\n () => {\n session += 1\n if (frame !== undefined) cancelAnimationFrame(frame)\n frame = undefined\n setStatus('')\n setError('')\n },\n { defer: true }\n )\n )\n onCleanup(() => {\n disposed = true\n session += 1\n if (frame !== undefined) cancelAnimationFrame(frame)\n })\n\n const focusMove = (owner: number, id: string, direction: WorkspaceMoveDirection) => {\n // The host re-renders the rows with the new order, which replaces the control\n // that had focus; focus the same control once it exists, or its sibling when\n // the move reached an edge. Try at once so keys pressed right after a save\n // still reach the dialog, and again next frame for a host that renders later.\n if (frame !== undefined) cancelAnimationFrame(frame)\n const restore = () => {\n if (disposed || owner !== session || !props.open) return\n const row = list?.querySelector<HTMLElement>(`[data-reorder-id=\"${CSS.escape(id)}\"]`)\n const wanted = row?.querySelector<HTMLElement>(`[data-move=\"${direction}\"]`)\n const other = row?.querySelector<HTMLElement>(\n `[data-move=\"${direction === 'up' ? 'down' : 'up'}\"]`\n )\n const target = wanted?.getAttribute('aria-disabled') === 'true' ? other : wanted\n if (target && document.activeElement !== target) target.focus({ preventScroll: true })\n }\n restore()\n frame = requestAnimationFrame(() => {\n frame = undefined\n restore()\n })\n }\n\n const move = async (item: WorkspaceReorderItem, direction: WorkspaceMoveDirection) => {\n if (pending()) return\n const next = moveWorkspace(props.workspaces, item.id, direction)\n if (!next) return\n const owner = session\n const current = () => !disposed && owner === session && props.open\n setError('')\n setPending(true)\n try {\n await props.onReorder(next)\n if (current())\n setStatus(`Moved ${item.name} to position ${next.indexOf(item.id) + 1} of ${next.length}.`)\n } catch {\n if (current()) {\n setStatus('')\n setError('Could not save the order. Try again.')\n }\n } finally {\n if (!disposed) setPending(false)\n if (current()) focusMove(owner, item.id, direction)\n }\n }\n\n return (\n <Dialog open={props.open} onOpenChange={props.onOpenChange}>\n <DialogContent class=\"w-full max-w-sm\" restoreFocusRef={props.restoreFocusRef}>\n <DialogHeader>\n <DialogTitle>{props.title ?? 'Reorder workspaces'}</DialogTitle>\n <DialogDescription>\n Move a workspace up or down. The order is saved as you go.\n </DialogDescription>\n </DialogHeader>\n <ol\n ref={(el) => (list = el)}\n class=\"flex flex-col gap-1\"\n aria-label=\"Workspace order\"\n aria-busy={pending()}\n >\n <For each={props.workspaces}>\n {(item) => (\n <li\n data-reorder-id={item.id}\n class=\"flex items-center gap-2 rounded-md border border-border px-3 py-1.5\"\n >\n <span class=\"min-w-0 flex-1 truncate text-sm\">{item.name}</span>\n <Show\n when={!item.fixed}\n fallback={<span class=\"text-xs text-muted-foreground\">Always first</span>}\n >\n <For each={['up', 'down'] as const}>\n {(direction) => (\n <ActionButton\n variant=\"ghost\"\n size=\"icon-sm\"\n data-move={direction}\n aria-label={`Move ${item.name} ${direction}`}\n tooltip={`Move ${direction}`}\n disabled={\n pending() ||\n moveTarget(props.workspaces, item.id, direction) === undefined\n }\n onClick={() => void move(item, direction)}\n >\n <Show when={direction === 'up'} fallback={<ArrowDown aria-hidden=\"true\" />}>\n <ArrowUp aria-hidden=\"true\" />\n </Show>\n </ActionButton>\n )}\n </For>\n </Show>\n </li>\n )}\n </For>\n </ol>\n <p role=\"status\" aria-live=\"polite\" class=\"min-h-5 text-xs text-muted-foreground\">\n {status()}\n </p>\n <Show when={error()}>\n <p role=\"alert\" class=\"text-xs text-destructive\">\n {error()}\n </p>\n </Show>\n <DialogFooter>\n <DialogClose as={Button} variant=\"outline\" size=\"sm\">\n Done\n </DialogClose>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgBmC,uBAAuBC,OAAoC;CACzE,MAAM,CAACC,QAAQC,aAAajC,aAAa,EAAE;CAC3C,MAAM,CAACkC,OAAOC,YAAYnC,aAAa,EAAE;CACzC,MAAM,CAACoC,SAASC,cAAcrC,aAAa,KAAK;CAChD,IAAIsC;CAOJ,IAAIE,UAAU;CACd,IAAIC,WAAW;CACf,IAAIC;CAEJ3C,aACEE,SACQ8B,MAAMV,YACN;EACJmB,WAAW;EACX,IAAIE,UAAUC,KAAAA,GAAWC,qBAAqBF,KAAK;EACnDA,QAAQC,KAAAA;EACRV,UAAU,EAAE;EACZE,SAAS,EAAE;CACb,GACA,EAAEU,OAAO,KAAK,CAChB,CACF;CACA3C,gBAAgB;EACduC,WAAW;EACXD,WAAW;EACX,IAAIE,UAAUC,KAAAA,GAAWC,qBAAqBF,KAAK;CACrD,CAAC;CAED,MAAMI,aAAaC,OAAe9B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WAAWkB,MAAMR,YAAYyC,KAAK/C,IAAI+B,SAAS,MAAML,KAAAA;aAAS;aAEhE+C,eAAe,KAAK3B,KAAKC,MAAMhB,SAAS;aAAC,IAAAsB,WAAA;cAAA,OAAAD,gBAExCvE,MAAI;eAACmF,MAAMjC,cAAc;eAAI,IAAEkC,WAAQ;gBAAA,OAAAb,gBAAG1E,WAAS,EAAA,eAAA,OAAA,CAAA;eAAA;eAAA,IAAA2E,WAAA;gBAAA,OAAAD,gBACjDzE,SAAO,EAAA,eAAA,OAAA,CAAA;eAAA;cAAA,CAAA;aAAA;YAAA,CAAA;WAGb,CAAA;UAAA;SAAA,CAAA,GAAA,IAAA;SAAA+F,aAAAC,aAAAf,OAAA,mBA1BYb,KAAK/C,EAAE,CAAA;SAAA,OAAA4D;QAAA,EAAA,CAAA;OA8B3B,CAAA,CAAA;OAAAc,aAAAC,aAAArB,MAAA,aAnCQnC,QAAQ,CAAC,CAAA;OAAA,OAAAmC;MAAA,EAAA,CAAA;aAAA;OAAA,IAAAsB,QAAAC,QAAA;OAAAnB,OAAAkB,OAuCnB7D,MAAM;OAAA,OAAA6D;MAAA,EAAA,CAAA;MAAAxB,gBAERvE,MAAI;OAAA,IAACmF,OAAI;QAAA,OAAE/C,MAAM;OAAC;OAAA,IAAAoC,WAAA;QAAA,IAAAyB,QAAAC,QAAA;QAAArB,OAAAoB,OAEd7D,KAAK;QAAA,OAAA6D;OAAA;MAAA,CAAA;MAAA1B,gBAGT5D,cAAY,EAAA,IAAA6D,WAAA;OAAA,OAAAD,gBACV/D,aAAW;QAAC2F,IAAI7F;QAAQiF,SAAO;QAAWC,MAAI;QAAAhB,UAAA;OAAA,CAAA;MAAA,EAAA,CAAA;KAAA;IAAA;GAAA,CAAA;EAAA;CAAA,CAAA;AAOzD"}
|
|
1
|
+
{"version":3,"file":"workspace-reorder-dialog.js","names":["ArrowDown","ArrowUp","For","Show","createEffect","createSignal","on","onCleanup","Button","Dialog","DialogClose","DialogContent","DialogDescription","DialogFooter","DialogHeader","DialogTitle","ActionButton","moveTarget","moveWorkspace","id","name","fixed","open","onOpenChange","workspaces","onReorder","title","restoreFocusRef","WorkspaceReorderDialog","props","status","setStatus","error","setError","pending","setPending","list","session","disposed","frame","undefined","cancelAnimationFrame","defer","focusMove","owner","direction","restore","row","querySelector","CSS","escape","wanted","other","target","getAttribute","document","activeElement","focus","preventScroll","requestAnimationFrame","move","item","next","current","indexOf","length","_$createComponent","children","_el$","_tmpl$","_$use","el","_$insert","each","_el$4","_tmpl$4","_el$5","firstChild","when","fallback","_tmpl$5","variant","size","tooltip","disabled","onClick","_$effect","_$setAttribute","_el$2","_tmpl$2","_el$3","_tmpl$3","as"],"sources":["../../../../src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx"],"sourcesContent":["import { ArrowDown, ArrowUp } from 'lucide-solid'\nimport { For, Show, createEffect, createSignal, on, onCleanup, type Accessor } from 'solid-js'\nimport { Button } from '../../ui/button'\nimport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '../../ui/dialog'\nimport { ActionButton } from '../action-button'\nimport { moveTarget, moveWorkspace, type WorkspaceMoveDirection } from './workspace-order'\n\nexport type WorkspaceReorderItem = {\n id: string\n name: string\n fixed?: boolean\n}\n\nexport type WorkspaceReorderDialogProps = {\n open: boolean\n onOpenChange(open: boolean): void\n workspaces: readonly WorkspaceReorderItem[]\n /** Receives the full id order after one move. May be async; a rejection shows an error. */\n onReorder(ids: readonly string[]): void | Promise<void>\n title?: string\n /** Where focus returns on close; the menu item that opened the dialog is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/**\n * WorkspaceReorderDialog.\n *\n * Ordering by buttons, not by dragging, so it works from the keyboard and with\n * a screen reader: every row has a labelled Move up and Move down. Each move is\n * reported to the host straight away (there is no Save), the moved row keeps\n * focus on the control that was used, and the new position is announced.\n *\n * One save runs at a time, even across a close and reopen: the moves stay\n * disabled until the host's promise settles. A save that finishes after the\n * dialog has closed reports nothing here (the host owns any failure it wants\n * to surface) and never moves focus.\n */\nexport function WorkspaceReorderDialog(props: WorkspaceReorderDialogProps) {\n const [status, setStatus] = createSignal('')\n const [error, setError] = createSignal('')\n const [pending, setPending] = createSignal(false)\n let list: HTMLOListElement | undefined\n // Each open and each close starts a new session. A save belongs to the session\n // it began in; once the dialog has closed (or closed and reopened) its result\n // no longer speaks for what is on screen, so it must not touch the status\n // line or focus. `pending` is deliberately not reset with the session: the\n // host's save is still running, so the next move waits for it instead of\n // running a second save beside it.\n let session = 0\n let disposed = false\n let frame: number | undefined\n\n createEffect(\n on(\n () => props.open,\n () => {\n session += 1\n if (frame !== undefined) cancelAnimationFrame(frame)\n frame = undefined\n setStatus('')\n setError('')\n },\n { defer: true }\n )\n )\n onCleanup(() => {\n disposed = true\n session += 1\n if (frame !== undefined) cancelAnimationFrame(frame)\n })\n\n const focusMove = (owner: number, id: string, direction: WorkspaceMoveDirection) => {\n // The host re-renders the rows with the new order, which replaces the control\n // that had focus; focus the same control once it exists, or its sibling when\n // the move reached an edge. Try at once so keys pressed right after a save\n // still reach the dialog, and again next frame for a host that renders later.\n if (frame !== undefined) cancelAnimationFrame(frame)\n const restore = () => {\n if (disposed || owner !== session || !props.open) return\n const row = list?.querySelector<HTMLElement>(`[data-reorder-id=\"${CSS.escape(id)}\"]`)\n const wanted = row?.querySelector<HTMLElement>(`[data-move=\"${direction}\"]`)\n const other = row?.querySelector<HTMLElement>(\n `[data-move=\"${direction === 'up' ? 'down' : 'up'}\"]`\n )\n const target = wanted?.getAttribute('aria-disabled') === 'true' ? other : wanted\n if (target && document.activeElement !== target) target.focus({ preventScroll: true })\n }\n restore()\n frame = requestAnimationFrame(() => {\n frame = undefined\n restore()\n })\n }\n\n const move = async (item: WorkspaceReorderItem, direction: WorkspaceMoveDirection) => {\n if (pending()) return\n const next = moveWorkspace(props.workspaces, item.id, direction)\n if (!next) return\n const owner = session\n const current = () => !disposed && owner === session && props.open\n setError('')\n setPending(true)\n try {\n await props.onReorder(next)\n if (current())\n setStatus(`Moved ${item.name} to position ${next.indexOf(item.id) + 1} of ${next.length}.`)\n } catch {\n if (current()) {\n setStatus('')\n setError('Could not save the order. Try again.')\n }\n } finally {\n if (!disposed) setPending(false)\n if (current()) focusMove(owner, item.id, direction)\n }\n }\n\n return (\n <Dialog open={props.open} onOpenChange={props.onOpenChange}>\n <DialogContent class=\"w-full max-w-sm\" restoreFocusRef={props.restoreFocusRef}>\n <DialogHeader>\n <DialogTitle>{props.title ?? 'Reorder workspaces'}</DialogTitle>\n <DialogDescription>\n Move a workspace up or down. The order is saved as you go.\n </DialogDescription>\n </DialogHeader>\n <ol\n ref={(el) => (list = el)}\n class=\"flex flex-col gap-1\"\n aria-label=\"Workspace order\"\n aria-busy={pending()}\n >\n <For each={props.workspaces}>\n {(item) => (\n <li\n data-reorder-id={item.id}\n class=\"flex items-center gap-2 rounded-md border border-border px-3 py-1.5\"\n >\n <span class=\"min-w-0 flex-1 truncate text-sm\">{item.name}</span>\n <Show\n when={!item.fixed}\n fallback={<span class=\"text-xs text-muted-foreground\">Always first</span>}\n >\n <For each={['up', 'down'] as const}>\n {(direction) => (\n <ActionButton\n variant=\"ghost\"\n size=\"icon-sm\"\n data-move={direction}\n aria-label={`Move ${item.name} ${direction}`}\n tooltip={`Move ${direction}`}\n disabled={\n pending() ||\n moveTarget(props.workspaces, item.id, direction) === undefined\n }\n onClick={() => void move(item, direction)}\n >\n <Show when={direction === 'up'} fallback={<ArrowDown aria-hidden=\"true\" />}>\n <ArrowUp aria-hidden=\"true\" />\n </Show>\n </ActionButton>\n )}\n </For>\n </Show>\n </li>\n )}\n </For>\n </ol>\n <p role=\"status\" aria-live=\"polite\" class=\"min-h-5 text-xs text-muted-foreground\">\n {status()}\n </p>\n <Show when={error()}>\n <p role=\"alert\" class=\"text-xs text-destructive\">\n {error()}\n </p>\n </Show>\n <DialogFooter>\n <DialogClose as={Button} variant=\"outline\" size=\"s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AAA;OAAA,OAAAkC;MAAA,EAAA,CAAA;aAAA;OAAA,IAAAoB,QAAAC,QAAA;OAAAjB,OAAAgB,OAuCnB1D,MAAM;OAAA,OAAA0D;MAAA,EAAA,CAAA;MAAAtB,gBAER/D,MAAI;OAAA,IAAC2E,OAAI;QAAA,OAAE9C,MAAM;OAAC;OAAA,IAAAmC,WAAA;QAAA,IAAAuB,QAAAC,QAAA;QAAAnB,OAAAkB,OAEd1D,KAAK;QAAA,OAAA0D;OAAA;MAAA,CAAA;MAAAxB,gBAGTrD,cAAY,EAAA,IAAAsD,WAAA;OAAA,OAAAD,gBACVxD,aAAW;QAACkF,IAAIpF;QAAQyE,SAAO;QAAWC,MAAI;QAAAf,UAAA;OAAA,CAAA;MAAA,EAAA,CAAA;KAAA;IAAA;GAAA,CAAA;EAAA;CAAA,CAAA;AAOzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-switcher.js","names":["ArrowDownUp","ChevronDown","Plus","Settings","JSX","Dynamic","For","Show","createSignal","createUniqueId","onCleanup","cn","DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuItem","DropdownMenuLabel","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuSeparator","DropdownMenuTrigger","ActionButton","loadReorderDialog","ReorderDialog","Awaited","ReturnType","WorkspaceSwitcherItem","id","name","mark","Element","detail","fixed","WorkspaceSwitcherProps","workspaces","value","onValueChange","onCreate","createLabel","onManage","manageLabel","onReorder","ids","Promise","reorderLabel","reorderErrorLabel","label","placeholder","disabled","class","drawMark","copy","Node","cloneNode","WorkspaceSwitcher","props","labelId","open","setOpen","reordering","setReordering","reorderDialog","setReorderDialog","reorderFailed","setReorderFailed","cancelPending","openPending","trigger","HTMLElement","current","find","item","canReorder","undefined","filter","length","loadDialog","then","module","WorkspaceReorderDialog","warm","next","requestReorder","waiting","loaded","menuClosed","stop","document","removeEventListener","onKey","afterMenuClose","openWhenReady","event","KeyboardEvent","key","addEventListener","success","_$createComponent","modal","onOpenChange","children","as","variant","size","ref","el","tooltip","_el$","_tmpl$","_$setAttribute","_el$2","_tmpl$2","_$insert","_c$","_$memo","_el$3","_tmpl$3","align","sideOffset","onChange","String","each","closeOnSelect","data-workspace-id","_el$4","_el$5","_tmpl$4","when","onSelect","onSelectAfterClose","component","restoreFocusRef","_$createComponent","_$memo"],"sources":["../../../../src/components/composites/workspace-switcher/workspace-switcher.tsx"],"sourcesContent":["import { ArrowDownUp, ChevronDown, Plus, Settings } from 'lucide-solid'\nimport type { JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { For, Show, createSignal, createUniqueId, onCleanup } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu'\nimport { ActionButton } from '../action-button'\n\n// The dialog is only reachable from a menu item, so it stays out of the code\n// that ships with the switcher and loads on demand.\nconst loadReorderDialog = () => import('./workspace-reorder-dialog')\ntype ReorderDialog = Awaited<ReturnType<typeof loadReorderDialog>>['WorkspaceReorderDialog']\n\n/**\n * WorkspaceSwitcher.\n *\n * The workspace picker that sits in the top bar beside the sidebar toggle. One\n * ghost button shows the current workspace's mark and name; pressing it opens a\n * radio list of the others. Choosing one only changes what the window is\n * looking at: the switcher reports the id and the host decides what that means,\n * which is why it carries no status of its own and never closes, restarts or\n * moves anything.\n *\n * It is deliberately the simple interaction (a single menu, not a nested\n * accordion): the sidebar below it already shows what is inside the chosen\n * workspace, so the switcher's only job is to name the workspace and let the\n * user change it.\n */\nexport type WorkspaceSwitcherItem = {\n id: string\n name: string\n /**\n * The workspace's mark, drawn in the trigger and in its row. Decorative.\n *\n * A DOM node can sit in one place, so the current workspace's mark would have\n * to be in the trigger and its menu row at once. Pass a function to draw a\n * fresh mark in each place (the preferred form). A node built once is also\n * safe: the trigger keeps it and the current row gets a copy, which carries\n * no event handlers or reactive bindings, so keep marks static.\n */\n mark: JSX.Element | (() => JSX.Element)\n /** A quiet trailing readout in the row, e.g. an unread count. Optional. */\n detail?: JSX.Element\n /** Pinned to the top of the order, e.g. Home: it cannot be moved and nothing moves above it. */\n fixed?: boolean\n}\n\nexport type WorkspaceSwitcherProps = {\n workspaces: readonly WorkspaceSwitcherItem[]\n /** The current workspace's id. */\n value: string | undefined\n onValueChange(id: string): void\n /** Offered at the foot of the menu when present. */\n onCreate?(): void\n createLabel?: string\n /** Offered beside the create action when present: open the current workspace's settings. */\n onManage?(): void\n manageLabel?: string\n /**\n * Offered when present and at least two workspaces can move: opens a dialog\n * with Move up and Move down on each row. Receives the full id order after\n * each move; the host saves it and passes the workspaces back in that order.\n */\n onReorder?(ids: readonly string[]): void | Promise<void>\n reorderLabel?: string\n /** Replaces the \"Reorder workspaces…\" item when the dialog could not be loaded. */\n reorderErrorLabel?: string\n /** The menu's heading; also the trigger's accessible-name prefix. */\n label?: string\n /** Shown while no workspace is current. */\n placeholder?: string\n disabled?: boolean\n class?: string\n}\n\n/**\n * Draws one placement of a mark. A function draws anew each time; a node that is\n * already placed elsewhere is copied so the original stays where it is.\n */\nfunction drawMark(mark: WorkspaceSwitcherItem['mark'], copy: boolean): JSX.Element {\n if (typeof mark === 'function') return mark()\n return copy && mark instanceof Node ? mark.cloneNode(true) : mark\n}\n\nexport function WorkspaceSwitcher(props: WorkspaceSwitcherProps) {\n // Reference visible mark text as well as the workspace name for speech-input matching.\n const labelId = createUniqueId()\n const [open, setOpen] = createSignal(false)\n const [reordering, setReordering] = createSignal(false)\n const [reorderDialog, setReorderDialog] = createSignal<ReorderDialog>()\n const [reorderFailed, setReorderFailed] = createSignal(false)\n let cancelPending: (() => void) | undefined\n let openPending: (() => void) | undefined\n let trigger: HTMLElement | undefined\n const current = () => props.workspaces.find((item) => item.id === props.value)\n const label = () => props.label ?? 'Workspaces'\n const canReorder = () =>\n props.onReorder !== undefined && props.workspaces.filter((item) => !item.fixed).length > 1\n\n // Fetch the dialog's code. Safe to call early and often: the browser keeps one\n // copy, and a failure is remembered here instead of surfacing as an unhandled\n // rejection, so the switcher keeps working without reordering.\n const loadDialog = () =>\n loadReorderDialog().then(\n (module) => {\n setReorderDialog(() => module.WorkspaceReorderDialog)\n return true\n },\n () => {\n setReorderFailed(true)\n return false\n }\n )\n // Warm the chunk while the menu is open, so choosing the item rarely waits.\n const warm = (next: boolean) => {\n if (next) {\n // Reopening is new intent, including keyboard activation: an older\n // delayed reorder must not open after another workspace or action wins.\n cancelPending?.()\n }\n setOpen(next)\n if (next && canReorder() && !reorderDialog()) void loadDialog()\n }\n // Choosing the item while the code is still arriving must not open the dialog\n // late: nothing on screen can take Escape or an outside click yet, so either\n // of them withdraws the request, and the dialog opens only if the user waits.\n // The request starts on select; the dialog opens only once the menu has\n // closed, so it captures the trigger as its opener.\n const requestReorder = () => {\n cancelPending?.()\n let waiting = true\n let loaded = !!reorderDialog()\n let menuClosed = false\n const stop = () => {\n waiting = false\n document.removeEventListener('keydown', onKey, true)\n document.removeEventListener('pointerdown', stop, true)\n if (cancelPending === stop) cancelPending = undefined\n if (openPending === afterMenuClose) openPending = undefined\n }\n const openWhenReady = () => {\n if (!waiting || !loaded || !menuClosed) return\n stop()\n setReordering(true)\n }\n const afterMenuClose = () => {\n menuClosed = true\n openWhenReady()\n }\n const onKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') stop()\n }\n document.addEventListener('keydown', onKey, true)\n document.addEventListener('pointerdown', stop, true)\n cancelPending = stop\n openPending = afterMenuClose\n if (!loaded)\n void loadDialog().then((success) => {\n if (!success) stop()\n else {\n loaded = true\n openWhenReady()\n }\n })\n }\n onCleanup(() => cancelPending?.())\n\n return (\n <>\n <DropdownMenu modal={false} open={open()} onOpenChange={warm}>\n <DropdownMenuTrigger\n as={ActionButton}\n variant=\"ghost\"\n size=\"sm\"\n disabled={props.disabled}\n ref={(el: HTMLElement) => (trigger = el)}\n data-slot=\"workspace-switcher\"\n tooltip={`Workspace: ${current()?.name ?? props.placeholder ?? 'Choose workspace'}`}\n aria-labelledby={`${labelId}-action ${labelId}-mark ${labelId}-name`}\n class={cn('max-w-full min-w-0 shrink', props.class)}\n >\n <span id={`${labelId}-action`} class=\"sr-only\">\n Switch workspace, current:\n </span>\n <span id={`${labelId}-mark`} aria-hidden=\"true\" class=\"flex shrink-0\">\n {current() && drawMark(current()!.mark, false)}\n </span>{' '}\n <span id={`${labelId}-name`} class=\"min-w-0 max-w-40 truncate\">\n {current()?.name ?? props.placeholder ?? 'Choose workspace'}\n </span>\n <ChevronDown aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" sideOffset={6} class=\"min-w-56\">\n <DropdownMenuGroup>\n <DropdownMenuLabel>{label()}</DropdownMenuLabel>\n <DropdownMenuRadioGroup\n value={props.value}\n onChange={(value) => {\n setOpen(false)\n const id = String(value)\n if (id !== props.value) props.onValueChange(id)\n }}\n >\n <For each={props.workspaces}>\n {(item) => (\n <DropdownMenuRadioItem value={item.id} closeOnSelect data-workspace-id={item.id}>\n <span aria-hidden=\"true\" class=\"flex shrink-0\">\n {drawMark(item.mark, item.id === props.value)}\n </span>\n <span class=\"min-w-0 flex-1 truncate\">{item.name}</span>\n <Show when={item.detail}>{item.detail}</Show>\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuRadioGroup>\n </DropdownMenuGroup>\n <Show when={props.onCreate || props.onManage || canReorder()}>\n <DropdownMenuSeparator />\n <Show when={props.onCreate}>\n <DropdownMenuItem onSelect={() => props.onCreate?.()}>\n <Plus aria-hidden=\"true\" />\n {props.createLabel ?? 'New workspace'}\n </DropdownMenuItem>\n </Show>\n <Show when={canReorder()}>\n <DropdownMenuItem\n disabled={reorderFailed()}\n onSelect={requestReorder}\n onSelectAfterClose={() => openPending?.()}\n >\n <ArrowDownUp aria-hidden=\"true\" />\n {reorderFailed()\n ? (props.reorderErrorLabel ?? 'Couldn’t load reordering. Reload to try again.')\n : (props.reorderLabel ?? 'Reorder workspaces…')}\n </DropdownMenuItem>\n </Show>\n <Show when={props.onManage}>\n <DropdownMenuItem onSelect={() => props.onManage?.()}>\n <Settings aria-hidden=\"true\" />\n {props.manageLabel ?? 'Workspace settings…'}\n </DropdownMenuItem>\n </Show>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n <Show when={reorderDialog() && props.onReorder}>\n {(onReorder) => (\n <Dynamic\n component={reorderDialog()}\n open={reordering()}\n onOpenChange={setReordering}\n workspaces={props.workspaces}\n onReorder={onReorder()}\n restoreFocusRef={() => trigger}\n />\n )}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAMsB,0BAA0B,OAAO;;;;;AAqEvC,SAAS4B,SAASrB,MAAqCsB,MAA4B;CACjF,IAAI,OAAOtB,SAAS,YAAY,OAAOA,KAAK;CAC5C,OAAOsB,QAAQtB,gBAAgBuB,OAAOvB,KAAKwB,UAAU,IAAI,IAAIxB;AAC/D;AAEA,SAAgByB,kBAAkBC,OAA+B;CAE/D,MAAMC,UAAU/C,eAAe;CAC/B,MAAM,CAACgD,MAAMC,WAAWlD,aAAa,KAAK;CAC1C,MAAM,CAACmD,YAAYC,iBAAiBpD,aAAa,KAAK;CACtD,MAAM,CAACqD,eAAeC,oBAAoBtD,aAA4B;CACtE,MAAM,CAACuD,eAAeC,oBAAoBxD,aAAa,KAAK;CAC5D,IAAIyD;CACJ,IAAIC;CACJ,IAAIC;CACJ,MAAME,gBAAgBd,MAAMrB,WAAWoC,MAAMC,SAASA,KAAK5C,OAAO4B,MAAMpB,KAAK;CAC7E,MAAMW,cAAcS,MAAMT,SAAS;CACnC,MAAM0B,mBACJjB,MAAMd,cAAcgC,KAAAA,KAAalB,MAAMrB,WAAWwC,QAAQH,SAAS,CAACA,KAAKvC,KAAK,CAAC,CAAC2C,SAAS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AAyD,gBAMpD1F,MAAI;EAAA,IAACwH,OAAI;GAAA,OAAEb,WAAA,CAAA,CAAArD,cAAc,CAAC,CAAA,CAAA,KAAIN,MAAMd;EAAS;EAAA2D,WAC1C3D,cAASwD,gBACR5F,SAAO;GAAA,IACN6H,YAAS;IAAA,OAAErE,cAAc;GAAC;GAAA,IAC1BJ,OAAI;IAAA,OAAEE,WAAW;GAAC;GAClBwC,cAAcvC;GAAa,IAC3B1B,aAAU;IAAA,OAAEqB,MAAMrB;GAAU;GAAA,IAC5BO,YAAS;IAAA,OAAEA,UAAU;GAAC;GACtB0F,uBAAuBhE;EAAO,CAAA;CAEjC,CAAA,CAAA;AAIT"}
|
|
1
|
+
{"version":3,"file":"workspace-switcher.js","names":["ArrowDownUp","ChevronDown","Plus","Settings","Dynamic","For","Show","createSignal","createUniqueId","onCleanup","cn","DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuItem","DropdownMenuLabel","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuSeparator","DropdownMenuTrigger","ActionButton","loadReorderDialog","id","name","mark","detail","fixed","workspaces","value","onValueChange","onCreate","createLabel","onManage","manageLabel","onReorder","reorderLabel","reorderErrorLabel","label","placeholder","disabled","class","drawMark","copy","Node","cloneNode","WorkspaceSwitcher","props","labelId","open","setOpen","reordering","setReordering","reorderDialog","setReorderDialog","reorderFailed","setReorderFailed","cancelPending","openPending","trigger","current","find","item","canReorder","undefined","filter","length","loadDialog","then","module","WorkspaceReorderDialog","warm","next","requestReorder","waiting","loaded","menuClosed","stop","document","removeEventListener","onKey","afterMenuClose","openWhenReady","event","key","addEventListener","success","_$createComponent","modal","onOpenChange","children","as","variant","size","ref","el","tooltip","_el$","_tmpl$","_$setAttribute","_el$2","_tmpl$2","_$insert","_c$","_$memo","_el$3","_tmpl$3","align","sideOffset","onChange","String","each","closeOnSelect","_el$4","_el$5","_tmpl$4","when","onSelect","onSelectAfterClose","component","restoreFocusRef"],"sources":["../../../../src/components/composites/workspace-switcher/workspace-switcher.tsx"],"sourcesContent":["import { ArrowDownUp, ChevronDown, Plus, Settings } from 'lucide-solid'\nimport type { JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { For, Show, createSignal, createUniqueId, onCleanup } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu'\nimport { ActionButton } from '../action-button'\n\n// The dialog is only reachable from a menu item, so it stays out of the code\n// that ships with the switcher and loads on demand.\nconst loadReorderDialog = () => import('./workspace-reorder-dialog')\ntype ReorderDialog = Awaited<ReturnType<typeof loadReorderDialog>>['WorkspaceReorderDialog']\n\n/**\n * WorkspaceSwitcher.\n *\n * The workspace picker that sits in the top bar beside the sidebar toggle. One\n * ghost button shows the current workspace's mark and name; pressing it opens a\n * radio list of the others. Choosing one only changes what the window is\n * looking at: the switcher reports the id and the host decides what that means,\n * which is why it carries no status of its own and never closes, restarts or\n * moves anything.\n *\n * It is deliberately the simple interaction (a single menu, not a nested\n * accordion): the sidebar below it already shows what is inside the chosen\n * workspace, so the switcher's only job is to name the workspace and let the\n * user change it.\n */\nexport type WorkspaceSwitcherItem = {\n id: string\n name: string\n /**\n * The workspace's mark, drawn in the trigger and in its row. Decorative.\n *\n * A DOM node can sit in one place, so the current workspace's mark would have\n * to be in the trigger and its menu row at once. Pass a function to draw a\n * fresh mark in each place (the preferred form). A node built once is also\n * safe: the trigger keeps it and the current row gets a copy, which carries\n * no event handlers or reactive bindings, so keep marks static.\n */\n mark: JSX.Element | (() => JSX.Element)\n /** A quiet trailing readout in the row, e.g. an unread count. Optional. */\n detail?: JSX.Element\n /** Pinned to the top of the order, e.g. Home: it cannot be moved and nothing moves above it. */\n fixed?: boolean\n}\n\nexport type WorkspaceSwitcherProps = {\n workspaces: readonly WorkspaceSwitcherItem[]\n /** The current workspace's id. */\n value: string | undefined\n onValueChange(id: string): void\n /** Offered at the foot of the menu when present. */\n onCreate?(): void\n createLabel?: string\n /** Offered beside the create action when present: open the current workspace's settings. */\n onManage?(): void\n manageLabel?: string\n /**\n * Offered when present and at least two workspaces can move: opens a dialog\n * with Move up and Move down on each row. Receives the full id order after\n * each move; the host saves it and passes the workspaces back in that order.\n */\n onReorder?(ids: readonly string[]): void | Promise<void>\n reorderLabel?: string\n /** Replaces the \"Reorder workspaces…\" item when the dialog could not be loaded. */\n reorderErrorLabel?: string\n /** The menu's heading; also the trigger's accessible-name prefix. */\n label?: string\n /** Shown while no workspace is current. */\n placeholder?: string\n disabled?: boolean\n class?: string\n}\n\n/**\n * Draws one placement of a mark. A function draws anew each time; a node that is\n * already placed elsewhere is copied so the original stays where it is.\n */\nfunction drawMark(mark: WorkspaceSwitcherItem['mark'], copy: boolean): JSX.Element {\n if (typeof mark === 'function') return mark()\n return copy && mark instanceof Node ? mark.cloneNode(true) : mark\n}\n\nexport function WorkspaceSwitcher(props: WorkspaceSwitcherProps) {\n // Reference visible mark text as well as the workspace name for speech-input matching.\n const labelId = createUniqueId()\n const [open, setOpen] = createSignal(false)\n const [reordering, setReordering] = createSignal(false)\n const [reorderDialog, setReorderDialog] = createSignal<ReorderDialog>()\n const [reorderFailed, setReorderFailed] = createSignal(false)\n let cancelPending: (() => void) | undefined\n let openPending: (() => void) | undefined\n let trigger: HTMLElement | undefined\n const current = () => props.workspaces.find((item) => item.id === props.value)\n const label = () => props.label ?? 'Workspaces'\n const canReorder = () =>\n props.onReorder !== undefined && props.workspaces.filter((item) => !item.fixed).length > 1\n\n // Fetch the dialog's code. Safe to call early and often: the browser keeps one\n // copy, and a failure is remembered here instead of surfacing as an unhandled\n // rejection, so the switcher keeps working without reordering.\n const loadDialog = () =>\n loadReorderDialog().then(\n (module) => {\n setReorderDialog(() => module.WorkspaceReorderDialog)\n return true\n },\n () => {\n setReorderFailed(true)\n return false\n }\n )\n // Warm the chunk while the menu is open, so choosing the item rarely waits.\n const warm = (next: boolean) => {\n if (next) {\n // Reopening is new intent, including keyboard activation: an older\n // delayed reorder must not open after another workspace or action wins.\n cancelPending?.()\n }\n setOpen(next)\n if (next && canReorder() && !reorderDialog()) void loadDialog()\n }\n // Choosing the item while the code is still arriving must not open the dialog\n // late: nothing on screen can take Escape or an outside click yet, so either\n // of them withdraws the request, and the dialog opens only if the user waits.\n // The request starts on select; the dialog opens only once the menu has\n // closed, so it captures the trigger as its opener.\n const requestReorder = () => {\n cancelPending?.()\n let waiting = true\n let loaded = !!reorderDialog()\n let menuClosed = false\n const stop = () => {\n waiting = false\n document.removeEventListener('keydown', onKey, true)\n document.removeEventListener('pointerdown', stop, true)\n if (cancelPending === stop) cancelPending = undefined\n if (openPending === afterMenuClose) openPending = undefined\n }\n const openWhenReady = () => {\n if (!waiting || !loaded || !menuClosed) return\n stop()\n setReordering(true)\n }\n const afterMenuClose = () => {\n menuClosed = true\n openWhenReady()\n }\n const onKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') stop()\n }\n document.addEventListener('keydown', onKey, true)\n document.addEventListener('pointerdown', stop, true)\n cancelPending = stop\n openPending = afterMenuClose\n if (!loaded)\n void loadDialog().then((success) => {\n if (!success) stop()\n else {\n loaded = true\n openWhenReady()\n }\n })\n }\n onCleanup(() => cancelPending?.())\n\n return (\n <>\n <DropdownMenu modal={false} open={open()} onOpenChange={warm}>\n <DropdownMenuTrigger\n as={ActionButton}\n variant=\"ghost\"\n size=\"sm\"\n disabled={props.disabled}\n ref={(el: HTMLElement) => (trigger = el)}\n data-slot=\"workspace-switcher\"\n tooltip={`Workspace: ${current()?.name ?? props.placeholder ?? 'Choose workspace'}`}\n aria-labelledby={`${labelId}-action ${labelId}-mark ${labelId}-name`}\n class={cn('max-w-full min-w-0 shrink', props.class)}\n >\n <span id={`${labelId}-action`} class=\"sr-only\">\n Switch workspace, current:\n </span>\n <span id={`${labelId}-mark`} aria-hidden=\"true\" class=\"flex shrink-0\">\n {current() && drawMark(current()!.mark, false)}\n </span>{' '}\n <span id={`${labelId}-name`} class=\"min-w-0 max-w-40 truncate\">\n {current()?.name ?? props.placeholder ?? 'Choose workspace'}\n </span>\n <ChevronDown aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" sideOffset={6} class=\"min-w-56\">\n <DropdownMenuGroup>\n <DropdownMenuLabel>{label()}</DropdownMenuLabel>\n <DropdownMenuRadioGroup\n value={props.value}\n onChange={(value) => {\n setOpen(false)\n const id = String(value)\n if (id !== props.value) props.onValueChange(id)\n }}\n >\n <For each={props.workspaces}>\n {(item) => (\n <DropdownMenuRadioItem value={item.id} closeOnSelect data-workspace-id={item.id}>\n <span aria-hidden=\"true\" class=\"flex shrink-0\">\n {drawMark(item.mark, item.id === props.value)}\n </span>\n <span class=\"min-w-0 flex-1 truncate\">{item.name}</span>\n <Show when={item.detail}>{item.detail}</Show>\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuRadioGroup>\n </DropdownMenuGroup>\n <Show when={props.onCreate || props.onManage || canReorder()}>\n <DropdownMenuSeparator />\n <Show when={props.onCreate}>\n <DropdownMenuItem onSelect={() => props.onCreate?.()}>\n <Plus aria-hidden=\"true\" />\n {props.createLabel ?? 'New workspace'}\n </DropdownMenuItem>\n </Show>\n <Show when={canReorder()}>\n <DropdownMenuItem\n disabled={reorderFailed()}\n onSelect={requestReorder}\n onSelectAfterClose={() => openPending?.()}\n >\n <ArrowDownUp aria-hidden=\"true\" />\n {reorderFailed()\n ? (props.reorderErrorLabel ?? 'Couldn’t load reordering. Reload to try again.')\n : (props.reorderLabel ?? 'Reorder workspaces…')}\n </DropdownMenuItem>\n </Show>\n <Show when={props.onManage}>\n <DropdownMenuItem onSelect={() => props.onManage?.()}>\n <Settings aria-hidden=\"true\" />\n {props.manageLabel ?? 'Workspace settings…'}\n </DropdownMenuItem>\n </Show>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n <Show when={reorderDialog() && props.onReorder}>\n {(onReorder) => (\n <Dynamic\n component={reorderDialog()}\n open={reordering()}\n onOpenChange={setReordering}\n workspaces={props.workspaces}\n onReorder={onReorder()}\n restoreFocusRef={() => trigger}\n />\n )}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAMqB,0BAA0B,OAAO;;;;;AAqEvC,SAASoB,SAASjB,MAAqCkB,MAA4B;CACjF,IAAI,OAAOlB,SAAS,YAAY,OAAOA,KAAK;CAC5C,OAAOkB,QAAQlB,gBAAgBmB,OAAOnB,KAAKoB,UAAU,IAAI,IAAIpB;AAC/D;AAEA,SAAgBqB,kBAAkBC,OAA+B;CAE/D,MAAMC,UAAUvC,eAAe;CAC/B,MAAM,CAACwC,MAAMC,WAAW1C,aAAa,KAAK;CAC1C,MAAM,CAAC2C,YAAYC,iBAAiB5C,aAAa,KAAK;CACtD,MAAM,CAAC6C,eAAeC,oBAAoB9C,aAA4B;CACtE,MAAM,CAAC+C,eAAeC,oBAAoBhD,aAAa,KAAK;CAC5D,IAAIiD;CACJ,IAAIC;CACJ,IAAIC;CACJ,MAAMC,gBAAgBb,MAAMnB,WAAWiC,MAAMC,SAASA,KAAKvC,OAAOwB,MAAMlB,KAAK;CAC7E,MAAMS,cAAcS,MAAMT,SAAS;CACnC,MAAMyB,mBACJhB,MAAMZ,cAAc6B,KAAAA,KAAajB,MAAMnB,WAAWqC,QAAQH,SAAS,CAACA,KAAKnC,KAAK,CAAC,CAACuC,SAAS;CAK3F,MAAMC,mBACJ7C,kBAAkB,CAAC,CAAC8C,MACjBC,WAAW;EACVf,uBAAuBe,OAAOC,sBAAsB;EACpD,OAAO;CACT,SACM;EACJd,iBAAiB,IAAI;EACrB,OAAO;CACT,CACF;CAEF,MAAMe,QAAQC,SAAkB;EAC9B,IAAIA,MAGFf,gBAAgB;EAElBP,QAAQsB,IAAI;EACZ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GAAC;GAClBsC,cAAcrC;GAAa,IAC3BxB,aAAU;IAAA,OAAEmB,MAAMnB;GAAU;GAAA,IAC5BO,YAAS;IAAA,OAAEA,UAAU;GAAC;GACtBqF,uBAAuB7D;EAAO,CAAA;CAEjC,CAAA,CAAA;AAIT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-composer.js","names":["
|
|
1
|
+
{"version":3,"file":"chat-composer.js","names":["ChatComposerShell","PasteTokenEditor","pruneBlocks","blocks","createBlockId","onChange","pasteTokens","onSubmit","input","AtomicChatComposer","props","_$createComponent","_$mergeProps","createSubmitExtra","text","map","block","renderInput","ref","r$","_ref$","value","resetKey","inputLabel","placeholder","disabled","readOnly","composing","onCompositionStart","onCompositionEnd","onFocus","onBlur","onKeyDown"],"sources":["../../../../src/components/conversation/atomic/chat-composer.tsx"],"sourcesContent":["/*\n * Controlled atomic token composer translated from KiroCrew ChatInput.tsx and\n * PasteHighlightLayer.tsx at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport { type ChatComposerSharedProps, type ChatComposerSubmitInput } from '../chat-composer'\nimport { ChatComposerShell } from '../internal/chat-composer-shell'\nimport { PasteTokenEditor, type PasteTokenDraft } from '../paste-token-editor'\nimport { pruneBlocks, type PasteBlock } from '../paste-tokens'\n\nexport type ChatComposerPasteTokens = {\n /** Current host-owned backing blocks, paired with `value`. */\n blocks: readonly PasteBlock[]\n /** Synchronous host identity allocation; the UI owns no persistent identity. */\n createBlockId: () => string\n /** One synchronous update for the complete text and surviving blocks. */\n onChange: (draft: PasteTokenDraft) => void\n}\n\nexport type AtomicChatComposerProps = ChatComposerSharedProps & {\n pasteTokens: ChatComposerPasteTokens\n onSubmit: (input: ChatComposerSubmitInput & { blocks: PasteBlock[] }) => void | Promise<void>\n}\n\n/** Atomic editor entry, sharing the plain composer's private composition shell. */\nexport function AtomicChatComposer(props: AtomicChatComposerProps) {\n return (\n <ChatComposerShell\n {...props}\n createSubmitExtra={({ text }) => ({\n blocks: pruneBlocks(text, [...props.pasteTokens.blocks]).map((block) => ({ ...block })),\n })}\n onSubmit={props.onSubmit}\n renderInput={(input) => (\n <PasteTokenEditor\n ref={input.ref}\n value={input.value()}\n resetKey={input.resetKey()}\n blocks={props.pasteTokens.blocks}\n createBlockId={props.pasteTokens.createBlockId}\n onChange={props.pasteTokens.onChange}\n inputLabel={input.inputLabel()}\n placeholder={input.placeholder()}\n disabled={input.disabled()}\n readOnly={input.readOnly()}\n composing={input.composing}\n onCompositionStart={input.onCompositionStart}\n onCompositionEnd={input.onCompositionEnd}\n onFocus={input.onFocus}\n onBlur={input.onBlur}\n onKeyDown={input.onKeyDown}\n />\n )}\n />\n )\n}\n"],"mappings":";;;;;;AA0BA,SAAgBS,mBAAmBC,OAAgC;CACjE,OAAAC,gBACGX,mBAAiBY,WACZF,OAAK;EACTG,oBAAoB,EAAEC,YAAY,EAChCX,QAAQD,YAAYY,MAAM,CAAC,GAAGJ,MAAMJ,YAAYH,MAAM,CAAC,CAAC,CAACY,KAAKC,WAAW,EAAE,GAAGA,MAAM,EAAE,EACxF;EAAE,IACFT,WAAQ;GAAA,OAAEG,MAAMH;EAAQ;EACxBU,cAAcT,UAAKG,gBAChBV,kBAAgB;GAAAiB,IAAAC,IAAA;IAAA,IAAAC,QACVZ,MAAMU;IAAG,OAAAE,UAAA,aAAAA,MAAAD,EAAA,IAATX,MAAMU,MAAGC;GAAA;GAAA,IACdE,QAAK;IAAA,OAAEb,MAAMa,MAAM;GAAC;GAAA,IACpBC,WAAQ;IAAA,OAAEd,MAAMc,SAAS;GAAC;GAAA,IAC1BnB,SAAM;IAAA,OAAEO,MAAMJ,YAAYH;GAAM;GAAA,IAChCC,gBAAa;IAAA,OAAEM,MAAMJ,YAAYF;GAAa;GAAA,IAC9CC,WAAQ;IAAA,OAAEK,MAAMJ,YAAYD;GAAQ;GAAA,IACpCkB,aAAU;IAAA,OAAEf,MAAMe,WAAW;GAAC;GAAA,IAC9BC,cAAW;IAAA,OAAEhB,MAAMgB,YAAY;GAAC;GAAA,IAChCC,WAAQ;IAAA,OAAEjB,MAAMiB,SAAS;GAAC;GAAA,IAC1BC,WAAQ;IAAA,OAAElB,MAAMkB,SAAS;GAAC;GAAA,IAC1BC,YAAS;IAAA,OAAEnB,MAAMmB;GAAS;GAAA,IAC1BC,qBAAkB;IAAA,OAAEpB,MAAMoB;GAAkB;GAAA,IAC5CC,mBAAgB;IAAA,OAAErB,MAAMqB;GAAgB;GAAA,IACxCC,UAAO;IAAA,OAAEtB,MAAMsB;GAAO;GAAA,IACtBC,SAAM;IAAA,OAAEvB,MAAMuB;GAAM;GAAA,IACpBC,YAAS;IAAA,OAAExB,MAAMwB;GAAS;EAAA,CAAA;CAE7B,CAAA,CAAA;AAGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"busy-send-button.js","names":["ArrowUpFromLine","ChevronDown","Target","For","Show","createUniqueId","Button","ButtonGroup","DropdownMenu","DropdownMenuContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuSeparator","DropdownMenuTrigger","
|
|
1
|
+
{"version":3,"file":"busy-send-button.js","names":["ArrowUpFromLine","ChevronDown","Target","For","Show","createUniqueId","Button","ButtonGroup","DropdownMenu","DropdownMenuContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuSeparator","DropdownMenuTrigger","mode","onModeChange","onFire","disabled","selectionDisabled","unavailable","alternateActionHint","modes","labels","steer","queue","descriptions","BusySendButton","props","reasonId","reason","variant","_el$","_tmpl$2","_$insert","_$createComponent","placement","modal","children","label","type","size","undefined","onClick","when","fallback","as","hideArrow","tabKey","value","onChange","each","closeOnSelect","_el$3","_tmpl$3","_el$4","firstChild","_el$5","nextSibling","message","_el$6","_tmpl$4","_el$2","_tmpl$","_el$7","_tmpl$5","_$setAttribute"],"sources":["../../../src/components/conversation/busy-send-button.tsx"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/components/BusySendButton.tsx\n * at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport { ArrowUpFromLine, ChevronDown, Target } from 'lucide-solid'\nimport { For, Show, createUniqueId } from 'solid-js'\nimport { Button } from '../ui/button'\nimport { ButtonGroup } from '../ui/button-group'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../ui/dropdown-menu'\n\nexport type BusySendMode = 'steer' | 'queue'\nexport type BusySendButtonProps = {\n mode: BusySendMode\n onModeChange: (mode: BusySendMode) => void\n /** Executes only the selected action. The host owns the draft and command. */\n onFire: () => void\n /** An empty draft or pending delivery disables fire, but not choosing a mode. */\n disabled?: boolean\n /** Disable mode selection when the host has no authority to change preferences. */\n selectionDisabled?: boolean\n /** Host capability/authority failures: unavailable rows remain visible. */\n unavailable?: Partial<Record<BusySendMode, string>>\n /** Supply only when the host implements this alternate-action keyboard chord. */\n alternateActionHint?: string\n}\n\nconst modes: BusySendMode[] = ['steer', 'queue']\nconst labels = { steer: 'Steer', queue: 'Queue' }\nconst descriptions = {\n steer: 'Act on this right away',\n queue: 'Run after the current work finishes',\n}\n\n/**\n * Kiro's split action/menu composition, with app-owned mode and availability.\n * Picking a mode never fires it. Persistence, migration and same-session\n * broadcasts belong to the consumer; this component has no storage or global listeners.\n * Kobalte replaces the donor manual portal/positioning and document listeners:\n * arrows wrap and selection/Escape return focus, and Tab cycles the enabled\n * rows as the donor's did (`tabKey=\"cycle\"`). No force-reset timer or runtime\n * authority is translated from the adjacent donor stop flow.\n */\nexport function BusySendButton(props: BusySendButtonProps) {\n const reasonId = createUniqueId()\n const reason = () => props.unavailable?.[props.mode]\n const variant = () => (props.mode === 'steer' ? ('default' as const) : ('secondary' as const))\n return (\n <div data-slot=\"busy-send-button\" class=\"flex w-fit flex-col gap-1\">\n <DropdownMenu placement=\"top-end\" modal={false}>\n <ButtonGroup label=\"Send while busy\">\n <Button\n type=\"button\"\n size=\"icon-sm\"\n variant={variant()}\n aria-label={props.mode === 'steer' ? 'Steer' : 'Queue message'}\n aria-describedby={reason() ? reasonId : undefined}\n disabled={props.disabled || !!reason()}\n onClick={() => {\n if (!props.disabled && !reason()) props.onFire()\n }}\n >\n <Show when={props.mode === 'steer'} fallback={<ArrowUpFromLine />}>\n <Target />\n </Show>\n </Button>\n <DropdownMenuTrigger\n as={Button}\n type=\"button\"\n size=\"icon-sm\"\n variant={variant()}\n aria-label=\"Send options\"\n disabled={props.selectionDisabled}\n >\n <ChevronDown />\n </DropdownMenuTrigger>\n </ButtonGroup>\n <DropdownMenuContent hideArrow tabKey=\"cycle\">\n <DropdownMenuRadioGroup\n value={props.mode}\n onChange={(value) => {\n if (\n (value === 'steer' || value === 'queue') &&\n !props.selectionDisabled &&\n !props.unavailable?.[value]\n )\n props.onModeChange(value)\n }}\n >\n <For each={modes}>\n {(mode) => (\n <DropdownMenuRadioItem\n value={mode}\n closeOnSelect\n disabled={props.selectionDisabled || !!props.unavailable?.[mode]}\n >\n <Show when={mode === 'steer'} fallback={<ArrowUpFromLine />}>\n <Target />\n </Show>\n <div class=\"flex min-w-0 flex-col gap-1\">\n <span>{labels[mode]}</span>\n <span class=\"text-muted-foreground text-xs\">{descriptions[mode]}</span>\n <Show when={props.unavailable?.[mode]}>\n {(message) => <span class=\"text-muted-foreground text-xs\">{message()}</span>}\n </Show>\n </div>\n </DropdownMenuRadioItem>\n )}\n </For>\n </DropdownMenuRadioGroup>\n <Show when={props.alternateActionHint}>\n <DropdownMenuSeparator />\n <p class=\"text-muted-foreground px-2 py-1 text-xs\">{props.alternateActionHint}</p>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n <Show when={reason()}>\n {(message) => (\n <p id={reasonId} class=\"text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,OAAI;cAAA,OAAEhB,MAAMR,cAAcL;aAAK;aAAAuB,WACjCqB,mBAAO;cAAA,IAAAC,QAAAC,QAAA;cAAA3B,OAAA0B,OAAkDD,OAAO;cAAA,OAAAC;aAAA,EAAA,CAAA;YAAU,CAAA,GAAA,IAAA;YAAA,OAAAP;WAAA,EAAA,CAAA,CAAA;UAAA;SAAA,CAAA;QAInF,CAAA;OAAA;MAAA,CAAA,GAAAlB,gBAGJ9B,MAAI;OAAA,IAACuC,OAAI;QAAA,OAAEhB,MAAMP;OAAmB;OAAA,IAAAiB,WAAA;QAAA,OAAA,CAAAH,gBAClCtB,uBAAqB,CAAA,CAAA,UAAA;SAAA,IAAAiD,QAAAC,OAAA;SAAA7B,OAAA4B,aAC8BlC,MAAMP,mBAAmB;SAAA,OAAAyC;QAAA,EAAA,CAAA,CAAA;OAAA;MAAA,CAAA,CAAA;KAAA;IAAA,CAAA,CAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA5B,OAAAF,MAAAG,gBAIlF9B,MAAI;GAAA,IAACuC,OAAI;IAAA,OAAEd,OAAO;GAAC;GAAAQ,WAChBqB,mBAAO;IAAA,IAAAK,QAAAC,QAAA;IAAAC,aAAAF,OAAA,MACAnC,QAAQ;IAAAK,OAAA8B,OACZL,OAAO;IAAA,OAAAK;GAAA,EAAA,CAAA;EAEX,CAAA,GAAA,IAAA;EAAA,OAAAhC;CAAA,EAAA,CAAA;AAIT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-composer.js","names":["
|
|
1
|
+
{"version":3,"file":"chat-composer.js","names":["ChatComposerShell","value","disabled","readOnly","placeholder","inputLabel","onValueChange","input","ChatComposer","props","_$createComponent","_$mergeProps","createSubmitExtra","renderInput","_el$","_tmpl$","_$addEventListener","onKeyDown","onBlur","onFocus","onCompositionEnd","onCompositionStart","$$input","event","currentTarget","_ref$","ref","_$use","_$effect","_p$","_v$","_v$2","_v$3","_v$4","e","_$setAttribute","t","a","o","undefined","_$delegateEvents"],"sources":["../../../src/components/conversation/chat-composer.tsx"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/components/ChatInput.tsx\n * at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport type { JSX } from 'solid-js'\nimport type { BusySendButtonProps, BusySendMode } from './busy-send-button'\nimport { ChatComposerShell } from './internal/chat-composer-shell'\n\nexport type ChatComposerControl = {\n /** Focus this instance; false when it is unavailable or collapsed. */\n focus: () => boolean\n /** A typing intent, unlike merely navigating to a conversation. */\n expandAndFocus: () => boolean\n}\n\nexport type ChatComposerSharedProps = {\n value: string\n /** Host scope fence; changes discard local feedback, not the host draft. */\n resetKey?: unknown\n disabled?: boolean\n readOnly?: boolean\n /** A visible capability or connectivity reason. */\n blockedReason?: string\n placeholder?: string\n inputLabel?: string\n /** Opt-in and controlled: the library neither persists nor broadcasts it. */\n collapse?: { value: boolean; onChange: (value: boolean) => void }\n controlRef?: (control: ChatComposerControl | undefined) => void\n /** Host payload eligibility by action; explicit false refuses even a nonempty draft. */\n sendableActions?: Partial<Record<'send' | BusySendMode, boolean>>\n busy?: Omit<BusySendButtonProps, 'onFire' | 'disabled' | 'alternateActionHint'>\n knowledge?: JSX.Element\n followUps?: JSX.Element\n band?: JSX.Element\n approval?: JSX.Element\n notices?: JSX.Element\n attachments?: JSX.Element\n leadingActions?: JSX.Element\n trailingActions?: JSX.Element\n /** Host-contributed menu items; no upload, skill or permission services here. */\n menuItems?: JSX.Element\n context?: JSX.Element\n /** Host derives this from the pending approval presentation, not UI policy. */\n approvalFocus?: boolean\n}\n\nexport type ChatComposerSubmitInput = {\n text: string\n action: 'send' | BusySendMode\n}\n\nexport type ChatComposerProps = ChatComposerSharedProps & {\n onValueChange: (value: string) => void\n onSubmit: (input: ChatComposerSubmitInput) => void | Promise<void>\n}\n\n/** Plain-text entry. `AtomicChatComposer` adds atomic paste tokens over the same shell. */\nexport function ChatComposer(props: ChatComposerProps) {\n return (\n <ChatComposerShell\n {...props}\n createSubmitExtra={() => ({})}\n renderInput={(input) => (\n <textarea\n ref={input.ref}\n data-slot=\"composer-input\"\n aria-label={input.inputLabel()}\n class=\"field-sizing-content text-foreground placeholder:text-muted-foreground min-h-11 max-h-36 w-full resize-none border-0 bg-transparent px-4 py-3 text-sm outline-none disabled:opacity-50\"\n value={input.value()}\n onInput={(event) => props.onValueChange(event.currentTarget.value)}\n disabled={input.disabled()}\n readOnly={input.readOnly()}\n placeholder={input.placeholder()}\n rows={1}\n onCompositionStart={input.onCompositionStart}\n onCompositionEnd={input.onCompositionEnd}\n onFocus={input.onFocus}\n onBlur={input.onBlur}\n onKeyDown={input.onKeyDown}\n />\n )}\n />\n )\n}\n"],"mappings":";;;;;AA2DA,SAAgBQ,aAAaC,OAA0B;CACrD,OAAAC,gBACGV,mBAAiBW,WACZF,OAAK;EACTG,0BAA0B,CAAC;EAC3BC,cAAcN,iBAAK;GAAA,IAAAO,OAAAC,OAAA;GAAAC,iBAAAF,MAAA,WAgBJP,MAAMU,WAAS,IAAA;GAAAD,iBAAAF,MAAA,QADlBP,MAAMW,MAAM;GAAAF,iBAAAF,MAAA,SADXP,MAAMY,OAAO;GAAAH,iBAAAF,MAAA,kBADJP,MAAMa,gBAAgB;GAAAJ,iBAAAF,MAAA,oBADpBP,MAAMc,kBAAkB;GAAAP,KAAAQ,WALlCC,UAAUd,MAAMH,cAAciB,MAAMC,cAAcvB,KAAK;GAAC,IAAAwB,QAL7DlB,MAAMmB;GAAG,OAAAD,UAAA,aAAAE,IAAAF,OAAAX,IAAA,IAATP,MAAMmB,MAAGZ;GAAAc,QAAAC,QAAA;IAAA,IAAAC,MAEFvB,MAAMF,WAAW,GAAC0B,OAIpBxB,MAAML,SAAS,GAAC8B,OAChBzB,MAAMJ,SAAS,GAAC8B,OACb1B,MAAMH,YAAY;IAAC0B,QAAAD,IAAAK,KAAAC,aAAArB,MAAA,cAAAe,IAAAK,IAAAJ,GAAA;IAAAC,SAAAF,IAAAO,MAAAtB,KAAAZ,WAAA2B,IAAAO,IAAAL;IAAAC,SAAAH,IAAAQ,MAAAvB,KAAAX,WAAA0B,IAAAQ,IAAAL;IAAAC,SAAAJ,IAAAS,KAAAH,aAAArB,MAAA,eAAAe,IAAAS,IAAAL,IAAA;IAAA,OAAAJ;GAAA,GAAA;IAAAK,GAAAK,KAAAA;IAAAH,GAAAG,KAAAA;IAAAF,GAAAE,KAAAA;IAAAD,GAAAC,KAAAA;GAAA,CAAA;GAAAX,aAAAd,KAAAb,QAJzBM,MAAMN,MAAM,CAAC;GAAA,OAAAa;EAAA,EAAA,CAAA;CAYvB,CAAA,CAAA;AAGP;AAAC0B,eAAA,CAAA,SAAA,SAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composer-menu.js","names":["
|
|
1
|
+
{"version":3,"file":"composer-menu.js","names":["splitProps","cn","overlaySurface","Button","label","ComposerMenu","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children","ComposerMenuItem","_$createComponent","variant"],"sources":["../../../src/components/conversation/composer-menu.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { overlaySurface } from '#lib/overlay'\nimport { Button } from '../ui/button'\n\nexport type ComposerMenuProps = ComponentProps<'div'> & {\n /** A name for what the menu offers, e.g. \"Mention an Agent\". */\n label?: string\n}\n\n/**\n * ComposerMenu.\n *\n * The panel a composer raises above the field: mention suggestions while the\n * reader types a name, the picker of what can be attached, follow-up prompts.\n * It is deliberately *not* a `Menu`: there is no trigger and no focus trap —\n * the reader keeps typing while it is open, and it opens and closes on the\n * draft's own grammar rather than on a button press.\n *\n * Rows are `ComposerMenuItem`s; anything else a caller renders (a checkbox\n * list, a heading) sits inside the same panel. Placement stays with the host —\n * a suggestion menu renders in the composer's `menu` slot, a picker anchors to\n * its own control.\n */\nexport function ComposerMenu(props: ComposerMenuProps) {\n const [local, rest] = splitProps(props, ['class', 'label', 'children'])\n\n return (\n <div\n role=\"group\"\n aria-label={local.label}\n data-slot=\"composer-menu\"\n class={cn(\n overlaySurface,\n 'flex max-h-56 min-w-60 flex-col gap-0.5 overflow-y-auto p-1',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\nexport type ComposerMenuItemProps = ComponentProps<typeof Button>\n\n/**\n * ComposerMenuItem.\n *\n * One row of a `ComposerMenu`. A ghost button stretched across the panel —\n * the same row every menu in the library draws, so a suggestion never reads as\n * a stray button floating over the draft.\n */\nexport function ComposerMenuItem(props: ComposerMenuItemProps) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <Button\n variant=\"ghost\"\n class={cn('w-full justify-start gap-2 text-start font-normal', local.class)}\n {...rest}\n >\n {local.children}\n </Button>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgBK,aAAaC,OAA0B;CACrD,MAAM,CAACC,OAAOC,QAAQR,WAAWM,OAAO;EAAC;EAAS;EAAS;CAAU,CAAC;CAEtE,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,gBAAA;IAAA,OAGgBL,MAAMH;GAAK;GAAA,KAAA,WAAA;IAAA,OAEhBH,GACLC,gBACA,+DACAK,MAAMM,KACR;GAAC;EAAA,GACGL,IAAI,GAAA,OAAA,IAAA;EAAAM,OAAAL,YAEPF,MAAMQ,QAAQ;EAAA,OAAAN;CAAA,EAAA,CAAA;AAGrB;;;;;;;;AAWA,SAAgBO,iBAAiBV,OAA8B;CAC7D,MAAM,CAACC,OAAOC,QAAQR,WAAWM,OAAO,CAAC,SAAS,UAAU,CAAC;CAE7D,OAAAW,gBACGd,QAAMS,WAAA;EACLM,SAAO;EAAA,KAAA,WAAA;GAAA,OACAjB,GAAG,qDAAqDM,MAAMM,KAAK;EAAC;CAAA,GACvEL,MAAI,EAAA,IAAAO,WAAA;EAAA,OAEPR,MAAMQ;CAAQ,EAAA,CAAA,CAAA;AAGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-avatar.js","names":["
|
|
1
|
+
{"version":3,"file":"conversation-avatar.js","names":["Show","splitProps","Dynamic","Bot","Sparkles","User","cn","kind","size","GLYPHS","user","agent","system","ConversationAvatar","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_$createComponent","when","children","fallback","_el$2","_tmpl$2","component"],"sources":["../../../src/components/conversation/conversation-avatar.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { Bot, Sparkles, User } from 'lucide-solid'\nimport { cn } from '#lib/utils'\n\n/**\n * ConversationAvatar.\n *\n * The speaker's mark in a transcript. Three kinds, and the distinction matters\n * visually: a person, an agent, and the system itself are different *voices*, and a\n * transcript where all three look alike is one the reader has to decode line by\n * line.\n *\n * The avatar is decorative — the speaker's name is in the message's accessible name\n * — so it is `aria-hidden` and carries no text of its own. A caller with a real\n * image passes it as children.\n */\nexport type ConversationAvatarKind = 'user' | 'agent' | 'system'\n\nexport type ConversationAvatarProps = ComponentProps<'span'> & {\n kind: ConversationAvatarKind\n /** Draw the mark larger, for the sender's own messages. */\n size?: 'md' | 'lg'\n}\n\nconst GLYPHS = { user: User, agent: Bot, system: Sparkles } as const\n\nexport function ConversationAvatar(props: ConversationAvatarProps) {\n const [local, rest] = splitProps(props, ['class', 'kind', 'size', 'children'])\n\n return (\n <span\n data-slot=\"conversation-avatar\"\n aria-hidden=\"true\"\n class={cn(\n 'grid shrink-0 place-items-center rounded-full border border-border',\n local.size === 'lg' ? 'size-8' : 'size-7',\n {\n 'bg-primary-subtle text-primary': local.kind === 'user',\n 'bg-card text-foreground': local.kind === 'agent',\n 'bg-muted text-muted-foreground': local.kind === 'system',\n },\n local.class\n )}\n {...rest}\n >\n <Show\n when={local.children}\n fallback={\n <span class=\"grid size-4 place-items-center [&_svg]:size-4\">\n <Dynamic component={GLYPHS[local.kind]} />\n </span>\n }\n >\n {local.children}\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;;;AA0BA,IAAMS,SAAS;CAAEC,MAAML;CAAMM,OAAOR;CAAKS,QAAQR;AAAS;AAE1D,SAAgBS,mBAAmBC,OAAgC;CACjE,MAAM,CAACC,OAAOC,QAAQf,WAAWa,OAAO;EAAC;EAAS;EAAQ;EAAQ;CAAU,CAAC;CAE7E,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAIWd,GACL,sEACAS,MAAMP,SAAS,OAAO,WAAW,UACjC;IACE,kCAAkCO,MAAMR,SAAS;IACjD,2BAA2BQ,MAAMR,SAAS;IAC1C,kCAAkCQ,MAAMR,SAAS;GACnD,GACAQ,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,IAAA;EAAAM,OAAAL,MAAAM,gBAEPvB,MAAI;GAAA,IACHwB,OAAI;IAAA,OAAET,MAAMU;GAAQ;GAAA,IACpBC,WAAQ;IAAA,cAAA;KAAA,IAAAC,QAAAC,QAAA;KAAAN,OAAAK,OAAAJ,gBAEHrB,SAAO,EAAA,IAAC2B,YAAS;MAAA,OAAEpB,OAAOM,MAAMR;KAAK,EAAA,CAAA,CAAA;KAAA,OAAAoB;IAAA,EAAA,CAAA;GAAA;GAAA,IAAAF,WAAA;IAAA,OAIzCV,MAAMU;GAAQ;EAAA,CAAA,CAAA;EAAA,OAAAR;CAAA,EAAA,CAAA;AAIvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-pane.js","names":["
|
|
1
|
+
{"version":3,"file":"conversation-pane.js","names":["Show","splitProps","cn","header","children","composer","thread","gutter","ConversationPane","props","local","rest","threadOpen","undefined","_el$","_tmpl$","_el$2","firstChild","_$spread","_$mergeProps","class","_$insert","_$createComponent","when","_el$3","_tmpl$2","_$effect","_$className","_el$4","_el$5"],"sources":["../../../src/components/conversation/conversation-pane.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\nexport type ConversationPaneProps = ComponentProps<'section'> & {\n /** Above the transcript: the conversation's identity and its actions. */\n header?: JSX.Element\n /** The transcript — typically a `ConversationSurface` with `gutter`. */\n children: JSX.Element\n composer?: JSX.Element\n /**\n * The thread side panel. Its presence opens the second column; at narrow\n * widths the panel overlays the conversation instead of squeezing it, and\n * the conversation chrome steps aside — out of the accessibility tree with\n * it, which is why the overlay hides with `visibility` rather than paint.\n */\n thread?: JSX.Element\n /**\n * Apply the shared page gutters to the composer, tracking the transcript's\n * own gutter (`ConversationSurface`'s `gutter`) so the two read as one pane.\n */\n gutter?: boolean\n}\n\n/**\n * ConversationPane.\n *\n * The frame a conversation lives in: a header above, the transcript, a composer\n * below, and — while a thread is open — the thread panel beside all of it.\n *\n * The layout earns its place in the library because the thread is where\n * applications get it wrong. Two impulses both fail: shrinking the transcript\n * to make room turns a busy thread into a one-word-per-line stripe, and\n * *hiding* the transcript with `display: none` unmounts it, losing scroll\n * position and DOM. So the desktop layout gives the thread a fixed column and\n * leaves the transcript fluid; below the collapse width the panel overlays the\n * conversation in full and the conversation steps aside invisibly — still\n * mounted, still in the DOM, gone from the accessibility tree.\n *\n * Reach for `Chat` (composites) instead when the conversation needs a notices row\n * between the header and the thread and has no thread panel; this frame is the\n * one with the side thread.\n */\nexport function ConversationPane(props: ConversationPaneProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'header',\n 'composer',\n 'thread',\n 'gutter',\n 'children',\n ])\n const threadOpen = () => local.thread !== undefined\n\n return (\n <section\n data-slot=\"conversation-pane\"\n data-conversation-thread-open={threadOpen() || undefined}\n class={cn(\n 'relative grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)_auto]',\n threadOpen()\n ? 'grid-cols-1 md:grid-cols-[minmax(20rem,1fr)_minmax(18rem,22rem)] lg:grid-cols-[minmax(24rem,1fr)_minmax(20rem,26rem)]'\n : 'grid-cols-1',\n local.class\n )}\n {...rest}\n >\n <Show when={local.header}>\n {(header) => (\n <div class={cn('col-start-1 row-start-1 min-w-0', threadOpen() && 'max-md:invisible')}>\n {header()}\n </div>\n )}\n </Show>\n\n <div\n class={cn(\n 'col-start-1 row-start-2 flex min-h-0 min-w-0 flex-col',\n threadOpen() && 'max-md:invisible'\n )}\n >\n {local.children}\n </div>\n\n <Show when={local.composer}>\n {(composer) => (\n <div\n class={cn(\n 'col-start-1 row-start-3 min-w-0',\n local.gutter && 'mx-[clamp(0.8rem,3vw,2.5rem)] mb-[1.15rem] max-[30rem]:mx-2',\n threadOpen() && 'max-md:invisible'\n )}\n >\n {composer()}\n </div>\n )}\n </Show>\n\n <Show when={local.thread}>\n {(thread) => (\n <div\n class={cn(\n 'min-h-0 min-w-0',\n threadOpen() &&\n 'max-md:absolute max-md:inset-0 max-md:z-(--z-docked) max-md:*:border-s-0 md:col-start-2 md:row-span-3 md:row-start-1'\n )}\n >\n {thread()}\n </div>\n )}\n </Show>\n </section>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgBQ,iBAAiBC,OAA8B;CAC7D,MAAM,CAACC,OAAOC,QAAQV,WAAWQ,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CACD,MAAMG,mBAAmBF,MAAMJ,WAAWO,KAAAA;CAE1C,cAAA;EAAA,IAAAC,OAAAC,OAAA,GAAAC,QAAAF,KAAAG;EAAAC,OAAAJ,MAAAK,WAAA;GAAA,KAAA,mCAAA;IAAA,OAGmCP,WAAW,KAAKC,KAAAA;GAAS;GAAA,KAAA,WAAA;IAAA,OACjDX,GACL,oEACAU,WAAW,IACP,0HACA,eACJF,MAAMU,KACR;GAAC;EAAA,GACGT,IAAI,GAAA,OAAA,IAAA;EAAAU,OAAAP,MAAAQ,gBAEPtB,MAAI;GAAA,IAACuB,OAAI;IAAA,OAAEb,MAAMP;GAAM;GAAAC,WACpBD,kBAAM;IAAA,IAAAqB,QAAAC,QAAA;IAAAJ,OAAAG,OAEHrB,MAAM;IAAAuB,aAAAC,UAAAH,OADGtB,GAAG,mCAAmCU,WAAW,KAAK,kBAAkB,CAAC,CAAA;IAAA,OAAAY;GAAA,EAAA,CAAA;EAGtF,CAAA,GAAAR,KAAA;EAAAK,OAAAL,aASAN,MAAMN,QAAQ;EAAAiB,OAAAP,MAAAQ,gBAGhBtB,MAAI;GAAA,IAACuB,OAAI;IAAA,OAAEb,MAAML;GAAQ;GAAAD,WACtBC,oBAAQ;IAAA,IAAAuB,QAAAH,QAAA;IAAAJ,OAAAO,OAQLvB,QAAQ;IAAAqB,aAAAC,UAAAC,OANF1B,GACL,mCACAQ,MAAMH,UAAU,+DAChBK,WAAW,KAAK,kBAClB,CAAC,CAAA;IAAA,OAAAgB;GAAA,EAAA,CAAA;EAIJ,CAAA,GAAA,IAAA;EAAAP,OAAAP,MAAAQ,gBAGFtB,MAAI;GAAA,IAACuB,OAAI;IAAA,OAAEb,MAAMJ;GAAM;GAAAF,WACpBE,kBAAM;IAAA,IAAAuB,QAAAJ,QAAA;IAAAJ,OAAAQ,OAQHvB,MAAM;IAAAoB,aAAAC,UAAAE,OANA3B,GACL,mBACAU,WAAW,KACT,sHACJ,CAAC,CAAA;IAAA,OAAAiB;GAAA,EAAA,CAAA;EAIJ,CAAA,GAAA,IAAA;EAAAH,aAAAC,UAAAX,OAjCMd,GACL,yDACAU,WAAW,KAAK,kBAClB,CAAC,CAAA;EAAA,OAAAE;CAAA,EAAA,CAAA;AAkCT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-surface.js","names":["ArrowDown","
|
|
1
|
+
{"version":3,"file":"conversation-surface.js","names":["ArrowDown","Show","splitProps","callHandler","cn","Button","createScrollFollow","threshold","follow","resetKey","initialReadingPosition","onReadingPositionChange","position","empty","header","gutter","onFollowHold","hold","contentRef","ConversationSurface","props","local","rest","enabled","initialPosition","onPositionChange","onScroll","event","_el$","_tmpl$2","_el$2","firstChild","_el$3","addEventListener","_$use","element","bindScroller","ref","_$spread","_$mergeProps","tabindex","class","bindContent","_$insert","_$createComponent","when","children","fallback","_el$5","_tmpl$3","atBottom","_el$4","_tmpl$","type","size","variant","onClick","jump","_$effect","_$className"],"sources":["../../../src/components/conversation/conversation-surface.tsx"],"sourcesContent":["import { ArrowDown } from 'lucide-solid'\nimport type { ComponentProps, JSX, Ref } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { cn } from '#lib/utils'\nimport { Button } from '../ui/button'\nimport { createScrollFollow } from './scroll-follow'\nimport type { ConversationReadingPosition, ScrollFollowHold } from './scroll-follow'\nimport { DEFAULT_BOTTOM_THRESHOLD } from './scroll-follow-core'\n\nexport type { ConversationReadingPosition }\n\n/**\n * ConversationSurface.\n *\n * The scrolling transcript. Its job is small and it is the difference between a\n * transcript that stays readable as it grows and one that fights the reader:\n *\n * - **Stick to the bottom.** New messages scroll into view only when the reader is\n * already at the bottom. Someone reading back through history must not be yanked\n * to the end by an arriving message, and that is the single most common way a\n * chat surface is made unusable.\n * - **Offer a way back.** Once the reader is not at the bottom, a control appears\n * that returns them. Pixel distance cannot prove an unread message count.\n * - **`overscroll-contain`.** The transcript scrolls to its end and stops, rather\n * than dragging the pane behind it — which in a desktop shell means the whole\n * window moves.\n */\nexport type ConversationSurfaceProps = ComponentProps<'div'> & {\n /** How far from the bottom still counts as \"at the bottom\", in px. */\n threshold?: number\n /** Disable automatic positioning while the host owns scroll restoration. */\n follow?: boolean\n /** Optional conversation identity: changing it re-arms follow at the bottom. */\n resetKey?: string\n /** Host snapshot consumed on mount/identity reset, never on ordinary prop updates. */\n initialReadingPosition?: ConversationReadingPosition\n /** Actual follow intent and native offset; storage/identity remain host-owned. */\n onReadingPositionChange?: (position: ConversationReadingPosition) => void\n /** Rendered above the transcript when there is nothing in it. */\n empty?: JSX.Element\n /** A header that scrolls with the transcript, e.g. a day divider or a banner. */\n header?: JSX.Element\n /**\n * The shared page gutter: reading padding inside the scroller plus a stable\n * gutter, so the scrollbar never shifts the text when it appears. The page\n * frame around the surface is `ConversationPane`'s job.\n */\n gutter?: boolean\n /**\n * Receives the surface's `hold`, once, when it is created. A host that moves content\n * under a reader who is following (a history load that lands after the conversation\n * changed) opens a hold around it, so the move is not read as the reader scrolling away.\n */\n onFollowHold?: (hold: ScrollFollowHold) => void\n /**\n * The element that wraps the transcript's rows (header included). A host that\n * keeps the reader's place across an insert observes its size, because rows that\n * size themselves late move the reader without adding or removing a node.\n */\n contentRef?: Ref<HTMLDivElement>\n}\n\nexport function ConversationSurface(props: ConversationSurfaceProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'threshold',\n 'follow',\n 'resetKey',\n 'initialReadingPosition',\n 'onReadingPositionChange',\n 'empty',\n 'header',\n 'gutter',\n 'onFollowHold',\n 'contentRef',\n 'children',\n 'onScroll',\n 'ref',\n 'tabindex',\n ])\n // Kobalte provides the control's semantics; transcript follow is a native\n // geometry contract. KiroCrew's plain-scroller controller handles streaming,\n // content collapse and pane resizing without treating them as user consent.\n const follow = createScrollFollow({\n enabled: () => local.follow !== false,\n resetKey: () => local.resetKey,\n threshold: () => local.threshold ?? DEFAULT_BOTTOM_THRESHOLD,\n initialPosition: () => local.initialReadingPosition,\n onPositionChange: (position) => local.onReadingPositionChange?.(position),\n })\n local.onFollowHold?.(follow.hold)\n const onScroll: JSX.EventHandlerUnion<HTMLDivElement, Event> = (event) => {\n follow.onScroll()\n callHandler(local.onScroll, event)\n }\n\n return (\n <div\n data-slot=\"conversation-surface\"\n class={cn('relative flex min-h-0 flex-1 flex-col', local.class)}\n >\n <div\n ref={(element) => {\n follow.bindScroller(element)\n if (typeof local.ref === 'function') local.ref(element)\n }}\n onScroll={onScroll}\n tabindex={local.tabindex ?? 0}\n class={cn(\n 'min-h-0 flex-1 overflow-y-auto overscroll-contain',\n local.gutter &&\n 'px-[clamp(0.8rem,3vw,2.5rem)] pt-[1.35rem] pb-[1.1rem] [scrollbar-gutter:stable] max-[30rem]:px-2'\n )}\n {...rest}\n >\n <div\n ref={(element) => {\n follow.bindContent(element)\n if (typeof local.contentRef === 'function') local.contentRef(element)\n }}\n data-slot=\"conversation-content\"\n >\n <Show when={local.header}>{local.header}</Show>\n <Show when={local.children} fallback={<div class=\"p-4\">{local.empty}</div>}>\n {local.children}\n </Show>\n </div>\n </div>\n\n <Show when={!follow.atBottom()}>\n <div class=\"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"secondary\"\n class=\"pointer-events-auto gap-1.5 shadow-md\"\n onClick={follow.jump}\n >\n <ArrowDown />\n Jump to latest\n </Button>\n </div>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;AA+DA,SAAgBmB,oBAAoBC,OAAiC;CACnE,MAAM,CAACC,OAAOC,QAAQpB,WAAWkB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CAID,MAAMZ,SAASF,mBAAmB;EAChCiB,eAAeF,MAAMb,WAAW;EAChCC,gBAAgBY,MAAMZ;EACtBF,iBAAiBc,MAAMd,aAAAA;EACvBiB,uBAAuBH,MAAMX;EAC7Be,mBAAmBb,aAAaS,MAAMV,0BAA0BC,QAAQ;CAC1E,CAAC;CACDS,MAAML,eAAeR,OAAOS,IAAI;CAChC,MAAMS,YAA0DC,UAAU;EACxEnB,OAAOkB,SAAS;EAChBvB,YAAYkB,MAAMK,UAAUC,KAAK;CACnC;CAEA,cAAA;EAAA,IAAAC,OAAAC,QAAA,GAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAC;EAAAD,MAAAG,iBAAA,UAUgBP,QAAQ;EAAAQ,KAJ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,WAAS,CAAA,CAAA,GAAA,gBAAA;KAAA;IAAA,CAAA,CAAA;IAAA,OAAAmD;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAO,aAAAC,UAAA/B,MAvCTxB,GAAG,yCAAyCiB,MAAMoB,KAAK,CAAC,CAAA;EAAA,OAAAb;CAAA,EAAA,CAAA;AA8CrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-composer-shell.js","names":["ChevronsDownUp","ChevronsUpDown","MoreHorizontal","ArrowUp","Show","createEffect","on","onCleanup","onMount","Accessor","JSX","ChatComposerControl","ChatComposerSharedProps","ChatComposerSubmitInput","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","Spinner","BusySendButton","BusySendMode","createComposerCore","ChatComposerInputRenderProps","ref","element","HTMLTextAreaElement","value","resetKey","inputLabel","placeholder","disabled","readOnly","composing","onCompositionStart","onCompositionEnd","onFocus","onBlur","onKeyDown","event","KeyboardEvent","ChatComposerShellProps","createSubmitExtra","input","Extra","onSubmit","Promise","renderInput","props","Element","ChatComposerShell","composer","failureMessage","pending","field","restoreBar","HTMLButtonElement","root","HTMLDivElement","focusFrame","focusTarget","selection","start","end","direction","active","collapsed","collapse","unavailable","blockedReason","cancelFocus","undefined","cancelAnimationFrame","requestFocus","target","requester","document","activeElement","requestAnimationFrame","approvalFocus","current","body","contains","focus","setSelectionRange","Math","min","length","yieldInputRestore","changeCollapsed","selectionStart","selectionEnd","selectionDirection","onChange","control","expandAndFocus","controlRef","reset","defer","action","busy","mode","canSend","selected","sendableActions","trim","submit","base","text","preview","first","split","find","line","slice","handleInputKeyDown","dismissError","key","shiftKey","defaultPrevented","claimEnter","metaKey","ctrlKey","_el$","_tmpl$1","_el$5","firstChild","_$use","_$insert","_$createComponent","when","children","knowledge","_el$2","_tmpl$","followUps","_el$3","_tmpl$2","band","_el$4","_tmpl$3","approval","_el$6","_tmpl$4","notices","_el$7","_tmpl$5","_el$8","_tmpl$6","error","message","_el$14","_tmpl$10","fallback","type","variant","size","aria-label","onClick","_tmpl$11","_el$16","_tmpl$12","_el$9","_tmpl$9","_el$1","_el$10","_el$12","nextSibling","addEventListener","preventDefault","attachments","_el$0","_tmpl$7","removeEventListener","menuItems","placement","as","onCloseAutoFocus","_$memo","onSelect","_tmpl$8","leadingActions","trailingActions","label","_$mergeProps","alternateActionHint","onFire","context","_el$13","_tmpl$0","_$createComponent","_$memo","_$mergeProps"],"sources":["../../../../src/components/conversation/internal/chat-composer-shell.tsx"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/components/ChatInput.tsx\n * at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport { ChevronsDownUp, ChevronsUpDown, MoreHorizontal, ArrowUp } from 'lucide-solid'\nimport { Show, createEffect, on, onCleanup, onMount, type Accessor, type JSX } from 'solid-js'\nimport type {\n ChatComposerControl,\n ChatComposerSharedProps,\n ChatComposerSubmitInput,\n} from '../chat-composer'\nimport { Button } from '../../ui/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu'\nimport { Spinner } from '../../ui/spinner'\nimport { BusySendButton, type BusySendMode } from '../busy-send-button'\nimport { createComposerCore } from '../composer-core'\n\n/** Private typed seam: public wrappers supply the native or atomic input. */\ntype ChatComposerInputRenderProps = {\n ref: (element: HTMLTextAreaElement | undefined) => void\n value: Accessor<string>\n resetKey: Accessor<unknown>\n inputLabel: Accessor<string>\n placeholder: Accessor<string>\n disabled: Accessor<boolean | undefined>\n readOnly: Accessor<boolean>\n composing: Accessor<boolean>\n onCompositionStart: () => void\n onCompositionEnd: () => void\n onFocus: () => void\n onBlur: () => void\n onKeyDown: (event: KeyboardEvent) => void\n}\n\ntype ChatComposerShellProps<Extra extends object> = ChatComposerSharedProps & {\n createSubmitExtra: (input: ChatComposerSubmitInput) => Extra\n onSubmit: (input: ChatComposerSubmitInput & Extra) => void | Promise<void>\n renderInput: (props: ChatComposerInputRenderProps) => JSX.Element\n}\n\n/**\n * Kiro's composer assembly: context/options, adjacent band, approval/notices,\n * staged content, input/action groups and a context shelf. Reading collapse\n * really unmounts the input and shelf and offers a labeled way back with draft\n * preview. The host retains the only draft, identities, preferences and services.\n *\n * Kobalte owns the options menu. Scoped imperative typing intent replaces the\n * donor global lookup/broadcast so a second composer cannot receive this draft\n * or focus. No animation starts from hidden geometry, no global shortcut, and no\n * runtime/permission/voice/optimizer authority is copied. More specific chips,\n * approval decisions and staged-content semantics are supplied by their owners.\n */\nexport function ChatComposerShell<Extra extends object>(props: ChatComposerShellProps<Extra>) {\n const composer = createComposerCore({\n failureMessage: 'Message not sent. Your draft is kept.',\n })\n const pending = composer.pending\n let field: HTMLTextAreaElement | undefined\n let restoreBar: HTMLButtonElement | undefined\n let root: HTMLDivElement | undefined\n let focusFrame: number | undefined\n let focusTarget: 'input' | 'bar' | undefined\n let selection:\n | { start: number; end: number; direction: 'forward' | 'backward' | 'none' }\n | undefined\n let active = true\n const collapsed = () => props.collapse?.value === true\n const unavailable = () => props.disabled || props.readOnly || !!props.blockedReason\n const cancelFocus = () => {\n if (focusFrame !== undefined) cancelAnimationFrame(focusFrame)\n focusFrame = undefined\n }\n const requestFocus = (target: 'input' | 'bar') => {\n cancelFocus()\n focusTarget = target\n const requester = document.activeElement\n focusFrame = requestAnimationFrame(() => {\n focusFrame = undefined\n if (!active || props.approvalFocus) return\n // Focus that moved elsewhere since the request (another conversation,\n // say, while a collapse or expand waited for this frame) is a newer\n // owner; taking it back would also drop whatever is being typed there.\n const current = document.activeElement\n if (\n current &&\n current !== document.body &&\n current !== requester &&\n !root?.contains(current)\n ) {\n focusTarget = undefined\n if (target === 'input') selection = undefined\n return\n }\n if (target === 'bar' && collapsed()) restoreBar?.focus()\n if (target === 'input' && !collapsed() && !props.disabled && field) {\n field.focus()\n if (selection)\n field.setSelectionRange(\n Math.min(selection.start, field.value.length),\n Math.min(selection.end, field.value.length),\n selection.direction\n )\n }\n focusTarget = undefined\n })\n }\n /**\n * A press or key in the input before the deferred expand restore runs is a\n * newer selection owner: the restore must not move its caret back.\n */\n const yieldInputRestore = () => {\n if (focusTarget !== 'input') return\n cancelFocus()\n focusTarget = undefined\n selection = undefined\n }\n const changeCollapsed = (value: boolean) => {\n if (!props.collapse || props.approvalFocus) return\n if (value && field)\n selection = {\n start: field.selectionStart,\n end: field.selectionEnd,\n direction: field.selectionDirection,\n }\n props.collapse.onChange(value)\n requestFocus(value ? 'bar' : 'input')\n }\n const control: ChatComposerControl = {\n focus() {\n if (collapsed() || props.approvalFocus || props.disabled || !field) return false\n field.focus()\n return true\n },\n expandAndFocus() {\n if (props.approvalFocus || props.disabled) return false\n if (collapsed()) changeCollapsed(false)\n else requestFocus('input')\n return true\n },\n }\n onMount(() => props.controlRef?.(control))\n createEffect(\n on(\n () => props.resetKey,\n () => {\n selection = undefined\n cancelFocus()\n focusTarget = undefined\n composer.reset()\n },\n { defer: true }\n )\n )\n onCleanup(() => {\n active = false\n cancelFocus()\n props.controlRef?.(undefined)\n })\n const action = (): 'send' | BusySendMode => props.busy?.mode ?? 'send'\n const canSend = (selected: 'send' | BusySendMode = action()) =>\n !unavailable() &&\n !pending() &&\n (props.sendableActions?.[selected] ?? props.value.trim().length > 0) &&\n !(selected !== 'send' && props.busy?.unavailable?.[selected])\n const submit = (selected: 'send' | BusySendMode = action()) => {\n if (!canSend(selected)) return\n const base: ChatComposerSubmitInput = { text: props.value, action: selected }\n const input = { ...base, ...props.createSubmitExtra(base) }\n void composer.submit(() => props.onSubmit(input))\n }\n const preview = () => {\n const first =\n props.value\n .split('\\n')\n .find((line) => line.trim().length > 0)\n ?.trim() ?? ''\n return first.length > 120 ? `${first.slice(0, 120)}…` : first\n }\n const handleInputKeyDown = (event: KeyboardEvent) => {\n yieldInputRestore()\n if (composer.dismissError(event)) return\n // Shift never sends here: Cmd/Ctrl+Enter is the busy composer's alternate action.\n if (event.key !== 'Enter' || event.shiftKey || event.defaultPrevented) return\n if (composer.claimEnter(event)) {\n const selected =\n props.busy && (event.metaKey || event.ctrlKey)\n ? props.busy.mode === 'steer'\n ? 'queue'\n : 'steer'\n : action()\n submit(selected)\n }\n }\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"chat-composer\"\n class=\"mx-auto flex w-full max-w-4xl flex-col px-4 pb-1\"\n >\n <Show when={!props.approvalFocus}>\n <Show when={props.knowledge}>\n <div data-slot=\"composer-knowledge\">{props.knowledge}</div>\n </Show>\n <Show when={props.followUps}>\n <div data-slot=\"composer-follow-ups\">{props.followUps}</div>\n </Show>\n </Show>\n <Show when={props.band}>\n <div data-slot=\"composer-band\">{props.band}</div>\n </Show>\n <div aria-hidden=\"true\" class=\"h-1.5 shrink-0\" />\n <Show when={props.approval}>\n <div data-slot=\"composer-approval\">{props.approval}</div>\n </Show>\n <Show when={props.notices}>\n <div data-slot=\"composer-notices\">{props.notices}</div>\n </Show>\n <Show when={props.blockedReason}>\n <p role=\"status\" class=\"text-muted-foreground mb-1 text-xs\">\n {props.blockedReason}\n </p>\n </Show>\n <Show when={composer.error()}>\n {(message) => (\n <p role=\"alert\" class=\"text-foreground mb-1 border-s-2 border-destructive ps-2 text-xs\">\n {message()}\n </p>\n )}\n </Show>\n <Show when={!props.approvalFocus}>\n <Show\n when={!collapsed()}\n fallback={\n <Button\n ref={(element) => {\n restoreBar = element\n onCleanup(() => {\n if (restoreBar === element) restoreBar = undefined\n })\n }}\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n class=\"w-full justify-start\"\n aria-expanded={false}\n aria-label={`Show the message input${preview() ? `: ${preview()}` : ''}`}\n onClick={() => changeCollapsed(false)}\n >\n <ChevronsUpDown />\n <span aria-hidden=\"true\" class=\"shrink-0\">\n Show the message input\n </span>{' '}\n <Show when={preview()}>\n <span aria-hidden=\"true\" class=\"min-w-0 flex-1 truncate\">\n {preview()}\n </span>\n </Show>\n </Button>\n }\n >\n <form\n data-slot=\"composer-input-box\"\n class=\"border-input bg-card flex flex-col overflow-hidden rounded-2xl border transition-colors focus-within:border-ring\"\n onSubmit={(event) => {\n event.preventDefault()\n submit()\n }}\n >\n <Show when={props.attachments}>\n <div data-slot=\"composer-staged-content\">{props.attachments}</div>\n </Show>\n {props.renderInput({\n ref: (element) => {\n field = element\n if (element) {\n element.addEventListener('pointerdown', yieldInputRestore)\n onCleanup(() => {\n element.removeEventListener('pointerdown', yieldInputRestore)\n if (field === element) field = undefined\n })\n }\n },\n value: () => props.value,\n resetKey: () => props.resetKey,\n inputLabel: () => props.inputLabel ?? 'Message',\n placeholder: () => props.placeholder ?? 'Write a message…',\n disabled: () => props.disabled,\n readOnly: () => props.readOnly || pending(),\n composing: composer.composing,\n onCompositionStart: composer.onCompositionStart,\n onCompositionEnd: composer.onCompositionEnd,\n onFocus: composer.onFocus,\n onBlur: composer.onBlur,\n onKeyDown: handleInputKeyDown,\n })}\n <div\n data-slot=\"composer-action-row\"\n class=\"flex items-center justify-between gap-2 px-2.5 pb-2 pt-0.5\"\n >\n <div class=\"flex min-w-0 items-center gap-1\">\n <Show when={props.collapse || props.menuItems}>\n <DropdownMenu placement=\"top-start\">\n <DropdownMenuTrigger\n as={Button}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label=\"Message input options\"\n >\n <MoreHorizontal />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n onCloseAutoFocus={(event) => {\n if (focusTarget) event.preventDefault()\n }}\n >\n {props.menuItems}\n <Show when={props.collapse}>\n <DropdownMenuItem onSelect={() => changeCollapsed(true)}>\n <ChevronsDownUp />\n <div class=\"flex min-w-0 flex-col\">\n <span>Collapse the message input</span>\n <span class=\"text-muted-foreground text-xs\">\n Make room to read; keep your draft\n </span>\n </div>\n </DropdownMenuItem>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n </Show>\n {props.leadingActions}\n </div>\n <div class=\"flex shrink-0 items-center gap-1\">\n {props.trailingActions}\n <Show\n when={props.busy}\n fallback={\n <Button\n type=\"submit\"\n size=\"icon-sm\"\n disabled={!canSend()}\n aria-label={pending() ? 'Sending message' : 'Send message'}\n >\n <Show when={pending()} fallback={<ArrowUp />}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n </Button>\n }\n >\n {(busy) => (\n <BusySendButton\n {...busy()}\n alternateActionHint={\n canSend(busy().mode === 'steer' ? 'queue' : 'steer')\n ? 'Ctrl/Cmd+Enter uses the other action'\n : undefined\n }\n disabled={!canSend()}\n onFire={() => submit()}\n />\n )}\n </Show>\n </div>\n </div>\n </form>\n <Show when={props.context}>\n <div data-slot=\"composer-context\" class=\"flex min-w-0 items-center gap-2 pt-1\">\n {props.context}\n </div>\n </Show>\n </Show>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgBkD,kBAAwCF,OAAsC;CAC5F,MAAMG,WAAW7B,mBAAmB,EAClC8B,gBAAgB,wCAClB,CAAC;CACD,MAAMC,UAAUF,SAASE;CACzB,IAAIC;CACJ,IAAIC;CACJ,IAAIE;CACJ,IAAIE;CACJ,IAAIC;CACJ,IAAIC;CAGJ,IAAII,SAAS;CACb,MAAMC,kBAAkBlB,MAAMmB,UAAUxC,UAAU;CAClD,MAAMyC,oBAAoBpB,MAAMjB,YAAYiB,MAAMhB,YAAY,CAAC,CAACgB,MAAMqB;CACtE,MAAMC,oBAAoB;EACxB,IAAIX,eAAeY,KAAAA,GAAWC,qBAAqBb,UAAU;EAC7DA,aAAaY,KAAAA;CACf;CACA,MAAME,gBAAgBC,WAA4B;EAChDJ,YAAY;EACZV,cAAcc;EACd,MAAMC,YAAYC,SAASC;EAC3BlB,aAAamB,4BAA4B;GACvCnB,aAAaY,KAAAA;GACb,IAAI,CAACN,UAAUjB,MAAM+B,eAAe;GAIpC,MAAMC,UAAUJ,SAASC;GACzB,IACEG,WACAA,YAA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H,WAAQ;WAAA,OAAE,CAACuE,QAAQ;UAAC;UAAA,KAAA,gBAAA;WAAA,OACRjD,QAAQ,IAAI,oBAAoB;UAAc;UAAA,IAAA8E,WAAA;WAAA,OAAAF,gBAEzD7H,MAAI;YAAA,IAAC8H,OAAI;aAAA,OAAE7E,QAAQ;YAAC;YAAA,IAAEoG,WAAQ;aAAA,OAAAxB,gBAAG9H,SAAO,CAAA,CAAA;YAAA;YAAA,IAAAgI,WAAA;aAAA,OAAAF,gBACtC9G,SAAO;cAACyI,MAAI;cAAM2B,OAAO;aAAK,CAAA;YAAA;WAAA,CAAA;UAAA;SAAA,CAAA;QAAA;QAAApD,WAKnC/B,SAAI6B,gBACH7G,gBAAcoK,WACTpF,MAAI;SAAA,IACRqF,sBAAmB;UAAA,OACjBnF,QAAQF,KAAK,CAAC,CAACC,SAAS,UAAU,UAAU,OAAO,IAC/C,yCACA9B,KAAAA;SAAS;SAAA,IAEfxC,WAAQ;UAAA,OAAE,CAACuE,QAAQ;SAAC;SACpBoF,cAAchF,OAAO;QAAC,CAAA,CAAA;OAEzB,CAAA,GAAA,IAAA;OAAA,OAAAwD;MAAA,EAAA,CAAA,GAAAjC,gBAKR7H,MAAI;OAAA,IAAC8H,OAAI;QAAA,OAAElF,MAAM2I;OAAO;OAAA,IAAAxD,WAAA;QAAA,IAAAyD,SAAAC,QAAA;QAAA7D,OAAA4D,cAEpB5I,MAAM2I,OAAO;QAAA,OAAAC;OAAA;MAAA,CAAA,CAAA;KAAA;IAAA,CAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAjE;CAAA,EAAA,CAAA;AAO5B"}
|
|
1
|
+
{"version":3,"file":"chat-composer-shell.js","names":["ChevronsDownUp","ChevronsUpDown","MoreHorizontal","ArrowUp","Show","createEffect","on","onCleanup","onMount","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","Spinner","BusySendButton","createComposerCore","ref","element","value","resetKey","inputLabel","placeholder","disabled","readOnly","composing","onCompositionStart","onCompositionEnd","onFocus","onBlur","onKeyDown","event","createSubmitExtra","input","onSubmit","renderInput","props","ChatComposerShell","composer","failureMessage","pending","field","restoreBar","root","focusFrame","focusTarget","selection","start","end","direction","active","collapsed","collapse","unavailable","blockedReason","cancelFocus","undefined","cancelAnimationFrame","requestFocus","target","requester","document","activeElement","requestAnimationFrame","approvalFocus","current","body","contains","focus","setSelectionRange","Math","min","length","yieldInputRestore","changeCollapsed","selectionStart","selectionEnd","selectionDirection","onChange","control","expandAndFocus","controlRef","reset","defer","action","busy","mode","canSend","selected","sendableActions","trim","submit","base","text","preview","first","split","find","line","slice","handleInputKeyDown","dismissError","key","shiftKey","defaultPrevented","claimEnter","metaKey","ctrlKey","_el$","_tmpl$1","_el$5","firstChild","_$use","_$insert","_$createComponent","when","children","knowledge","_el$2","_tmpl$","followUps","_el$3","_tmpl$2","band","_el$4","_tmpl$3","approval","_el$6","_tmpl$4","notices","_el$7","_tmpl$5","_el$8","_tmpl$6","error","message","_el$14","_tmpl$10","fallback","type","variant","size","onClick","_tmpl$11","_el$16","_tmpl$12","_el$9","_tmpl$9","_el$1","_el$10","_el$12","nextSibling","addEventListener","preventDefault","attachments","_el$0","_tmpl$7","removeEventListener","menuItems","placement","as","onCloseAutoFocus","_$memo","onSelect","_tmpl$8","leadingActions","trailingActions","label","_$mergeProps","alternateActionHint","onFire","context","_el$13","_tmpl$0"],"sources":["../../../../src/components/conversation/internal/chat-composer-shell.tsx"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/components/ChatInput.tsx\n * at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport { ChevronsDownUp, ChevronsUpDown, MoreHorizontal, ArrowUp } from 'lucide-solid'\nimport { Show, createEffect, on, onCleanup, onMount, type Accessor, type JSX } from 'solid-js'\nimport type {\n ChatComposerControl,\n ChatComposerSharedProps,\n ChatComposerSubmitInput,\n} from '../chat-composer'\nimport { Button } from '../../ui/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu'\nimport { Spinner } from '../../ui/spinner'\nimport { BusySendButton, type BusySendMode } from '../busy-send-button'\nimport { createComposerCore } from '../composer-core'\n\n/** Private typed seam: public wrappers supply the native or atomic input. */\ntype ChatComposerInputRenderProps = {\n ref: (element: HTMLTextAreaElement | undefined) => void\n value: Accessor<string>\n resetKey: Accessor<unknown>\n inputLabel: Accessor<string>\n placeholder: Accessor<string>\n disabled: Accessor<boolean | undefined>\n readOnly: Accessor<boolean>\n composing: Accessor<boolean>\n onCompositionStart: () => void\n onCompositionEnd: () => void\n onFocus: () => void\n onBlur: () => void\n onKeyDown: (event: KeyboardEvent) => void\n}\n\ntype ChatComposerShellProps<Extra extends object> = ChatComposerSharedProps & {\n createSubmitExtra: (input: ChatComposerSubmitInput) => Extra\n onSubmit: (input: ChatComposerSubmitInput & Extra) => void | Promise<void>\n renderInput: (props: ChatComposerInputRenderProps) => JSX.Element\n}\n\n/**\n * Kiro's composer assembly: context/options, adjacent band, approval/notices,\n * staged content, input/action groups and a context shelf. Reading collapse\n * really unmounts the input and shelf and offers a labeled way back with draft\n * preview. The host retains the only draft, identities, preferences and services.\n *\n * Kobalte owns the options menu. Scoped imperative typing intent replaces the\n * donor global lookup/broadcast so a second composer cannot receive this draft\n * or focus. No animation starts from hidden geometry, no global shortcut, and no\n * runtime/permission/voice/optimizer authority is copied. More specific chips,\n * approval decisions and staged-content semantics are supplied by their owners.\n */\nexport function ChatComposerShell<Extra extends object>(props: ChatComposerShellProps<Extra>) {\n const composer = createComposerCore({\n failureMessage: 'Message not sent. Your draft is kept.',\n })\n const pending = composer.pending\n let field: HTMLTextAreaElement | undefined\n let restoreBar: HTMLButtonElement | undefined\n let root: HTMLDivElement | undefined\n let focusFrame: number | undefined\n let focusTarget: 'input' | 'bar' | undefined\n let selection:\n | { start: number; end: number; direction: 'forward' | 'backward' | 'none' }\n | undefined\n let active = true\n const collapsed = () => props.collapse?.value === true\n const unavailable = () => props.disabled || props.readOnly || !!props.blockedReason\n const cancelFocus = () => {\n if (focusFrame !== undefined) cancelAnimationFrame(focusFrame)\n focusFrame = undefined\n }\n const requestFocus = (target: 'input' | 'bar') => {\n cancelFocus()\n focusTarget = target\n const requester = document.activeElement\n focusFrame = requestAnimationFrame(() => {\n focusFrame = undefined\n if (!active || props.approvalFocus) return\n // Focus that moved elsewhere since the request (another conversation,\n // say, while a collapse or expand waited for this frame) is a newer\n // owner; taking it back would also drop whatever is being typed there.\n const current = document.activeElement\n if (\n current &&\n current !== document.body &&\n current !== requester &&\n !root?.contains(current)\n ) {\n focusTarget = undefined\n if (target === 'input') selection = undefined\n return\n }\n if (target === 'bar' && collapsed()) restoreBar?.focus()\n if (target === 'input' && !collapsed() && !props.disabled && field) {\n field.focus()\n if (selection)\n field.setSelectionRange(\n Math.min(selection.start, field.value.length),\n Math.min(selection.end, field.value.length),\n selection.direction\n )\n }\n focusTarget = undefined\n })\n }\n /**\n * A press or key in the input before the deferred expand restore runs is a\n * newer selection owner: the restore must not move its caret back.\n */\n const yieldInputRestore = () => {\n if (focusTarget !== 'input') return\n cancelFocus()\n focusTarget = undefined\n selection = undefined\n }\n const changeCollapsed = (value: boolean) => {\n if (!props.collapse || props.approvalFocus) return\n if (value && field)\n selection = {\n start: field.selectionStart,\n end: field.selectionEnd,\n direction: field.selectionDirection,\n }\n props.collapse.onChange(value)\n requestFocus(value ? 'bar' : 'input')\n }\n const control: ChatComposerControl = {\n focus() {\n if (collapsed() || props.approvalFocus || props.disabled || !field) return false\n field.focus()\n return true\n },\n expandAndFocus() {\n if (props.approvalFocus || props.disabled) return false\n if (collapsed()) changeCollapsed(false)\n else requestFocus('input')\n return true\n },\n }\n onMount(() => props.controlRef?.(control))\n createEffect(\n on(\n () => props.resetKey,\n () => {\n selection = undefined\n cancelFocus()\n focusTarget = undefined\n composer.reset()\n },\n { defer: true }\n )\n )\n onCleanup(() => {\n active = false\n cancelFocus()\n props.controlRef?.(undefined)\n })\n const action = (): 'send' | BusySendMode => props.busy?.mode ?? 'send'\n const canSend = (selected: 'send' | BusySendMode = action()) =>\n !unavailable() &&\n !pending() &&\n (props.sendableActions?.[selected] ?? props.value.trim().length > 0) &&\n !(selected !== 'send' && props.busy?.unavailable?.[selected])\n const submit = (selected: 'send' | BusySendMode = action()) => {\n if (!canSend(selected)) return\n const base: ChatComposerSubmitInput = { text: props.value, action: selected }\n const input = { ...base, ...props.createSubmitExtra(base) }\n void composer.submit(() => props.onSubmit(input))\n }\n const preview = () => {\n const first =\n props.value\n .split('\\n')\n .find((line) => line.trim().length > 0)\n ?.trim() ?? ''\n return first.length > 120 ? `${first.slice(0, 120)}…` : first\n }\n const handleInputKeyDown = (event: KeyboardEvent) => {\n yieldInputRestore()\n if (composer.dismissError(event)) return\n // Shift never sends here: Cmd/Ctrl+Enter is the busy composer's alternate action.\n if (event.key !== 'Enter' || event.shiftKey || event.defaultPrevented) return\n if (composer.claimEnter(event)) {\n const selected =\n props.busy && (event.metaKey || event.ctrlKey)\n ? props.busy.mode === 'steer'\n ? 'queue'\n : 'steer'\n : action()\n submit(selected)\n }\n }\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"chat-composer\"\n class=\"mx-auto flex w-full max-w-4xl flex-col px-4 pb-1\"\n >\n <Show when={!props.approvalFocus}>\n <Show when={props.knowledge}>\n <div data-slot=\"composer-knowledge\">{props.knowledge}</div>\n </Show>\n <Show when={props.followUps}>\n <div data-slot=\"composer-follow-ups\">{props.followUps}</div>\n </Show>\n </Show>\n <Show when={props.band}>\n <div data-slot=\"composer-band\">{props.band}</div>\n </Show>\n <div aria-hidden=\"true\" class=\"h-1.5 shrink-0\" />\n <Show when={props.approval}>\n <div data-slot=\"composer-approval\">{props.approval}</div>\n </Show>\n <Show when={props.notices}>\n <div data-slot=\"composer-notices\">{props.notices}</div>\n </Show>\n <Show when={props.blockedReason}>\n <p role=\"status\" class=\"text-muted-foreground mb-1 text-xs\">\n {props.blockedReason}\n </p>\n </Show>\n <Show when={composer.error()}>\n {(message) => (\n <p role=\"alert\" class=\"text-foreground mb-1 border-s-2 border-destructive ps-2 text-xs\">\n {message()}\n </p>\n )}\n </Show>\n <Show when={!props.approvalFocus}>\n <Show\n when={!collapsed()}\n fallback={\n <Button\n ref={(element) => {\n restoreBar = element\n onCleanup(() => {\n if (restoreBar === element) restoreBar = undefined\n })\n }}\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n class=\"w-full justify-start\"\n aria-expanded={false}\n aria-label={`Show the message input${preview() ? `: ${preview()}` : ''}`}\n onClick={() => changeCollapsed(false)}\n >\n <ChevronsUpDown />\n <span aria-hidden=\"true\" class=\"shrink-0\">\n Show the message input\n </span>{' '}\n <Show when={preview()}>\n <span aria-hidden=\"true\" class=\"min-w-0 flex-1 truncate\">\n {preview()}\n </span>\n </Show>\n </Button>\n }\n >\n <form\n data-slot=\"composer-input-box\"\n class=\"border-input bg-card flex flex-col overflow-hidden rounded-2xl border transition-colors focus-within:border-ring\"\n onSubmit={(event) => {\n event.preventDefault()\n submit()\n }}\n >\n <Show when={props.attachments}>\n <div data-slot=\"composer-staged-content\">{props.attachments}</div>\n </Show>\n {props.renderInput({\n ref: (element) => {\n field = element\n if (element) {\n element.addEventListener('pointerdown', yieldInputRestore)\n onCleanup(() => {\n element.removeEventListener('pointerdown', yieldInputRestore)\n if (field === element) field = undefined\n })\n }\n },\n value: () => props.value,\n resetKey: () => props.resetKey,\n inputLabel: () => props.inputLabel ?? 'Message',\n placeholder: () => props.placeholder ?? 'Write a message…',\n disabled: () => props.disabled,\n readOnly: () => props.readOnly || pending(),\n composing: composer.composing,\n onCompositionStart: composer.onCompositionStart,\n onCompositionEnd: composer.onCompositionEnd,\n onFocus: composer.onFocus,\n onBlur: composer.onBlur,\n onKeyDown: handleInputKeyDown,\n })}\n <div\n data-slot=\"composer-action-row\"\n class=\"flex items-center justify-between gap-2 px-2.5 pb-2 pt-0.5\"\n >\n <div class=\"flex min-w-0 items-center gap-1\">\n <Show when={props.collapse || props.menuItems}>\n <DropdownMenu placement=\"top-start\">\n <DropdownMenuTrigger\n as={Button}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label=\"Message input options\"\n >\n <MoreHorizontal />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n onCloseAutoFocus={(event) => {\n if (focusTarget) event.preventDefault()\n }}\n >\n {props.menuItems}\n <Show when={props.collapse}>\n <DropdownMenuItem onSelect={() => changeCollapsed(true)}>\n <ChevronsDownUp />\n <div class=\"flex min-w-0 flex-col\">\n <span>Collapse the message input</span>\n <span class=\"text-muted-foreground text-xs\">\n Make room to read; keep your draft\n </span>\n </div>\n </DropdownMenuItem>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n </Show>\n {props.leadingActions}\n </div>\n <div class=\"flex shrink-0 items-center gap-1\">\n {props.trailingActions}\n <Show\n when={props.busy}\n fallback={\n <Button\n type=\"submit\"\n size=\"icon-sm\"\n disabled={!canSend()}\n aria-label={pending() ? 'Sending message' : 'Send message'}\n >\n <Show when={pending()} fallback={<ArrowUp />}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n </Button>\n }\n >\n {(busy) => (\n <BusySendButton\n {...busy()}\n alternateActionHint={\n canSend(busy().mode === 'steer' ? 'queue' : 'steer')\n ? 'Ctrl/Cmd+Enter uses the other action'\n : undefined\n }\n disabled={!canSend()}\n onFire={() => submit()}\n />\n )}\n </Show>\n </div>\n </div>\n </form>\n <Show when={props.context}>\n <div data-slot=\"composer-context\" class=\"flex min-w-0 items-center gap-2 pt-1\">\n {props.context}\n </div>\n </Show>\n </Show>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgBqC,kBAAwCD,OAAsC;CAC5F,MAAME,WAAWtB,mBAAmB,EAClCuB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