@adea-ai/ui 0.162.6 → 0.162.8
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 +5 -5
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +3 -3
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js +2 -2
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +22 -22
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +10 -10
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +13 -13
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +12 -12
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +13 -13
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +9 -9
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +10 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +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 +5 -5
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.js +7 -7
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +5 -5
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +13 -13
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.js +7 -7
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +9 -9
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.js +5 -5
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +10 -10
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/icon-picker/image-data-url.js.map +1 -1
- package/dist/components/composites/icon-picker/shell-icons.js +117 -117
- package/dist/components/composites/icon-picker/shell-icons.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +7 -7
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.js +2 -2
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +7 -7
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +12 -12
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.js +5 -5
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/prompt-input/prompt-input.js +3 -3
- package/dist/components/composites/prompt-input/prompt-input.js.map +1 -1
- package/dist/components/composites/queue/queue.js +13 -13
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +5 -5
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js +16 -16
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +2 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +2 -2
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.js +5 -5
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.js +5 -5
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.js +2 -2
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +10 -10
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.js +6 -6
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.js +5 -5
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js +2 -2
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.js +5 -5
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.js +1 -1
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js +18 -18
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.js +17 -17
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.js +5 -5
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.js +6 -6
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +1 -1
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +23 -23
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +2 -2
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +6 -6
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +11 -11
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/atomic/chat-composer.js +1 -1
- package/dist/components/conversation/busy-send-button.js +10 -10
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.js +1 -1
- package/dist/components/conversation/composer-core.js +1 -1
- package/dist/components/conversation/composer-menu.js +2 -2
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +7 -7
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.js +1 -1
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +5 -5
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +9 -9
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.js +9 -9
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.js +13 -13
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +1 -1
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/scroll-follow.js +1 -1
- package/dist/components/conversation/thread-panel.js +5 -5
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.js +5 -5
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +2 -2
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js +7 -7
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/page/page.js +2 -2
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +1 -1
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-pane/pixel-pane.js +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +5 -5
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js +5 -5
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -2
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +2 -2
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -5
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/pane-focus.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +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 +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +7 -7
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +5 -5
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
- package/dist/components/motion/presence.js +1 -1
- package/dist/components/theme/appearance-panel.js +3 -3
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.js +3 -3
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/script-projection.js +1 -1
- package/dist/components/theme/theme-catalogue-source.js +1 -1
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js +7 -7
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-picker.js +2 -2
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.js +1 -1
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-provider.js +1 -1
- package/dist/components/theme/theme-toggle.js +7 -7
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js +13 -13
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.js +12 -12
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +14 -14
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +2 -2
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js +16 -16
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +1 -1
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.js +2 -2
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +7 -7
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble/bubble.js +2 -2
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button-group/button-group.js +2 -2
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +8 -8
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.js +2 -2
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.js +8 -8
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart.js +2 -2
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +6 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.js +6 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +7 -7
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js +21 -21
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/value-combobox.js +1 -1
- package/dist/components/ui/command/command.js +23 -23
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -2
- package/dist/components/ui/detail-panel/detail-panel.js +5 -5
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +2 -2
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +21 -21
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.js +2 -2
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js +14 -14
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +10 -10
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.js +5 -5
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +2 -2
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.js +14 -14
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js +2 -2
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js +10 -10
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input/input-control.js +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.js +2 -2
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js +2 -2
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.js +2 -2
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.js +2 -2
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js +7 -7
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.js +3 -3
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +2 -2
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js +5 -5
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +18 -18
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +28 -28
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.js +15 -15
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.js +5 -5
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +10 -10
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +9 -9
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js +11 -11
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js +21 -21
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/separator/separator.js +5 -5
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js +6 -6
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.js +5 -5
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js +5 -5
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +2 -2
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.js +4 -4
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/table/table.js +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +7 -7
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +2 -2
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js +7 -7
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.js +6 -6
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js +7 -8
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.js +6 -6
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -1
- package/dist/components/ui/tooltip/lazy-tooltip.js +2 -2
- package/dist/components/ui/tooltip/tooltip.js +10 -10
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.js +19 -19
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.js +2 -2
- package/dist/lib/accent-presets.js +1 -1
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/async-action.js +1 -1
- package/dist/lib/create-poll.js +1 -1
- package/dist/lib/create-poll.js.map +1 -1
- package/dist/lib/external-link.js +1 -1
- package/dist/lib/external-link.js.map +1 -1
- package/dist/lib/fast-icon.js +1 -1
- package/dist/lib/theme-css.js +1 -1
- package/dist/lib/theme-engine-light.js +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-records.js +1 -1
- package/dist/lib/themes.js +1 -1
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/vite/source-parser.js +1 -1
- package/dist/vite/tailwind-sources.js +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","names":["<section\n data-slot=\"chat\"\n class={cn(\n 'grid h-full min-h-0 min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_auto_minmax(0,1fr)_auto] bg-background text-foreground',\n local.class\n )}\n {...rest}\n >\n <div class=\"row-start-1 min-w-0\">{local.header}</div>\n <div class=\"row-start-2 flex min-w-0 flex-col\">{local.notices}</div>\n <div class=\"row-start-3 flex min-h-0 min-w-0 flex-col\">{local.children}</div>\n <div class=\"row-start-4 min-w-0\">{local.composer}</div>\n </section>","<Show when={local.subtitle}>\n {(subtitleSlot) => (\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{subtitleSlot()}</p>\n )}\n </Show>","<Show when={local.status}>{(statusSlot) => <>{statusSlot()}</>}</Show>","{statusSlot()}","<header\n data-slot=\"chat-header\"\n class={cn(\n 'flex min-h-topbar min-w-0 items-center gap-3 border-b border-border px-4 py-2',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <h2 class=\"m-0 truncate text-sm font-semibold tracking-tight\">{local.title}</h2>\n <Show when={local.subtitle}>\n {(subtitleSlot) => (\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{subtitleSlot()}</p>\n )}\n </Show>\n </div>\n <Show when={local.status}>{(statusSlot) => <>{statusSlot()}</>}</Show>\n <Show when={local.actions}>\n {(actionsSlot) => <div class=\"flex shrink-0 items-center gap-1\">{actionsSlot()}</div>}\n </Show>\n </header>","<Show when={local.actions}>\n {(actionsSlot) => <div class=\"flex shrink-0 items-center gap-1\">{actionsSlot()}</div>}\n </Show>","<Dynamic component={Glyph()} />","<Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {descriptionSlot()}\n </p>\n )}\n </Show>","<Show when={local.action}>\n {(actionSlot) => <div class=\"flex shrink-0 items-center gap-1.5\">{actionSlot()}</div>}\n </Show>","<div\n data-slot=\"chat-notice\"\n role={local.live === 'assertive' ? 'alert' : local.live === 'polite' ? 'status' : undefined}\n class={cn(chatNoticeVariants({ tone: local.tone }), local.class)}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n class={cn('mt-0.5 shrink-0 [&_svg]:size-4', {\n 'text-muted-foreground': (local.tone ?? 'info') === 'info',\n 'text-warning': local.tone === 'warning',\n 'text-destructive': local.tone === 'danger',\n })}\n >\n <Dynamic component={Glyph()} />\n </span>\n <div class=\"min-w-0 flex-1\">\n <p class=\"m-0 font-medium [overflow-wrap:anywhere]\">{local.title}</p>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {descriptionSlot()}\n </p>\n )}\n </Show>\n </div>\n <Show when={local.action}>\n {(actionSlot) => <div class=\"flex shrink-0 items-center gap-1.5\">{actionSlot()}</div>}\n </Show>\n </div>","<Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{descriptionSlot()}</p>\n )}\n </Show>","<Show when={local.suggestions}>{(suggestionsSlot) => <>{suggestionsSlot()}</>}</Show>","{suggestionsSlot()}","<div\n data-slot=\"chat-empty\"\n class={cn(\n 'mx-auto flex min-h-full w-full max-w-xl flex-col items-center justify-center gap-4 px-6 py-10 text-center',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex flex-col gap-1\">\n <h3 class=\"m-0 text-base font-semibold tracking-tight text-balance\">{local.title}</h3>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{descriptionSlot()}</p>\n )}\n </Show>\n </div>\n <Show when={local.suggestions}>{(suggestionsSlot) => <>{suggestionsSlot()}</>}</Show>\n </div>","CircleAlert","LucideCircleAlert","Info","LucideInfo","TriangleAlert","LucideTriangleAlert","_$readShallow"],"sources":["../../../../src/components/composites/chat/chat.tsx"],"sourcesContent":["import {\n CircleAlert as LucideCircleAlert,\n Info as LucideInfo,\n TriangleAlert as LucideTriangleAlert,\n} from '@lucide/solid'\nimport { Show, omit } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport { Dynamic } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst CircleAlert = fastIcon(LucideCircleAlert)\nconst Info = fastIcon(LucideInfo)\nconst TriangleAlert = fastIcon(LucideTriangleAlert)\n\n/**\n * Chat.\n *\n * The frame a conversation lives in: a header, a strip for things the reader\n * must know before reading anything else, the thread, and the composer. It is a\n * layout and nothing more — the thread is a `MessageScroller`, the input is a\n * composer, and what happens in between is the host's — which is why it takes\n * slots instead of data. `ConversationPane` is the other frame: reach for it when\n * the conversation opens a side thread rather than showing notices.\n *\n * ## Why notices have their own row\n *\n * \"The connection dropped\", \"this transcript has a gap\", \"this session is\n * read-only\" are about the whole conversation, not about a turn, and they must\n * not scroll away with the turns. They sit between the header and the thread in\n * their own grid track, so a notice appearing never steals the thread's row and\n * collapses to zero height when there are none. Each notice states its cause in\n * words and carries its own remedy (`action`); one that reports a *change*\n * (`live`) is announced, one that describes a standing condition is not.\n *\n * ## Layout\n *\n * `h-full min-h-0`, so the thread scrolls inside the frame rather than the page\n * growing, and a `min-w-0` track, so a long unbroken token in a turn cannot widen\n * the whole conversation. Nothing here sets a width: the reading column is the\n * turn's, and the composer sets its own measure.\n */\nexport type ChatProps = ComponentProps<'section'> & {\n header?: JSX.Element\n /** `ChatNotice`s. The row collapses when this is empty. */\n notices?: JSX.Element\n composer?: JSX.Element\n}\n\nexport function Chat(props: ChatProps) {\n const local = props\n const rest = omit(props, 'class', 'header', 'notices', 'composer', 'children')\n return (\n <section\n data-slot=\"chat\"\n class={cn(\n 'grid h-full min-h-0 min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_auto_minmax(0,1fr)_auto] bg-background text-foreground',\n local.class\n )}\n {...rest}\n >\n <div class=\"row-start-1 min-w-0\">{local.header}</div>\n <div class=\"row-start-2 flex min-w-0 flex-col\">{local.notices}</div>\n <div class=\"row-start-3 flex min-h-0 min-w-0 flex-col\">{local.children}</div>\n <div class=\"row-start-4 min-w-0\">{local.composer}</div>\n </section>\n )\n}\n\nexport type ChatHeaderProps = Omit<ComponentProps<'header'>, 'title'> & {\n title: JSX.Element\n /** One line under the title: identity, scope, generation. */\n subtitle?: JSX.Element\n /** The conversation's state in words (a `StatusChip`). */\n status?: JSX.Element\n /** Host actions: rename, archive, hand off. */\n actions?: JSX.Element\n}\n\nexport function ChatHeader(props: ChatHeaderProps) {\n const local = props\n const rest = omit(props, 'class', 'title', 'subtitle', 'status', 'actions')\n return (\n <header\n data-slot=\"chat-header\"\n class={cn(\n 'flex min-h-topbar min-w-0 items-center gap-3 border-b border-border px-4 py-2',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <h2 class=\"m-0 truncate text-sm font-semibold tracking-tight\">{local.title}</h2>\n <Show when={local.subtitle}>\n {(subtitleSlot) => (\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{subtitleSlot()}</p>\n )}\n </Show>\n </div>\n <Show when={local.status}>{(statusSlot) => <>{statusSlot()}</>}</Show>\n <Show when={local.actions}>\n {(actionsSlot) => <div class=\"flex shrink-0 items-center gap-1\">{actionsSlot()}</div>}\n </Show>\n </header>\n )\n}\n\nexport const chatNoticeVariants = cva(\n 'flex min-w-0 items-start gap-2.5 border-b px-4 py-2 text-sm',\n {\n variants: {\n tone: {\n info: 'border-border bg-muted/40',\n warning: 'border-warning/30 bg-warning-subtle',\n danger: 'border-destructive/30 bg-destructive-subtle',\n },\n },\n defaultVariants: { tone: 'info' },\n }\n)\n\nexport type ChatNoticeProps = Omit<ComponentProps<'div'>, 'title'> &\n VariantProps<typeof chatNoticeVariants> & {\n title: JSX.Element\n description?: JSX.Element\n /** The remedy: Reconnect, Jump to terminal. */\n action?: JSX.Element\n /** Announce it. Use for a change (connection lost), not a standing condition. */\n live?: 'polite' | 'assertive'\n }\n\nexport function ChatNotice(props: ChatNoticeProps) {\n const local = props\n const rest = omit(props, 'class', 'tone', 'title', 'description', 'action', 'live')\n const Glyph = () =>\n local.tone === 'danger' ? CircleAlert : local.tone === 'warning' ? TriangleAlert : Info\n return (\n <div\n data-slot=\"chat-notice\"\n role={local.live === 'assertive' ? 'alert' : local.live === 'polite' ? 'status' : undefined}\n class={cn(chatNoticeVariants({ tone: local.tone }), local.class)}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n class={cn('mt-0.5 shrink-0 [&_svg]:size-4', {\n 'text-muted-foreground': (local.tone ?? 'info') === 'info',\n 'text-warning': local.tone === 'warning',\n 'text-destructive': local.tone === 'danger',\n })}\n >\n <Dynamic component={Glyph()} />\n </span>\n <div class=\"min-w-0 flex-1\">\n <p class=\"m-0 font-medium [overflow-wrap:anywhere]\">{local.title}</p>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {descriptionSlot()}\n </p>\n )}\n </Show>\n </div>\n <Show when={local.action}>\n {(actionSlot) => <div class=\"flex shrink-0 items-center gap-1.5\">{actionSlot()}</div>}\n </Show>\n </div>\n )\n}\n\nexport type ChatEmptyProps = Omit<ComponentProps<'div'>, 'title'> & {\n title: JSX.Element\n description?: JSX.Element\n /** Prompt chips (`Suggestions`), shown only when the host has real ones. */\n suggestions?: JSX.Element\n}\n\n/** A conversation with no turns yet. Centred in the thread, never in a card. */\nexport function ChatEmpty(props: ChatEmptyProps) {\n const local = props\n const rest = omit(props, 'class', 'title', 'description', 'suggestions')\n return (\n <div\n data-slot=\"chat-empty\"\n class={cn(\n 'mx-auto flex min-h-full w-full max-w-xl flex-col items-center justify-center gap-4 px-6 py-10 text-center',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex flex-col gap-1\">\n <h3 class=\"m-0 text-base font-semibold tracking-tight text-balance\">{local.title}</h3>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{descriptionSlot()}</p>\n )}\n </Show>\n </div>\n <Show when={local.suggestions}>{(suggestionsSlot) => <>{suggestionsSlot()}</>}</Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAaA,IAAMc,gBAAc,SAASC,WAAiB;AAC9C,IAAMC,SAAO,SAASC,IAAU;AAChC,IAAMC,kBAAgB,SAASC,aAAmB;AAoClD,SAAgB,KAAK,OAAkB;CACrC,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,UAAU,WAAW,YAAY,UAAU;CAE3E,IAAA,OAAA,OAYS;CAJP,IAAA,QAAA,KAAA;CACA,IAAA,QAAA,MAAA;CACA,IAAA,QAAA,MAAA;CACA,IAAA,QAAA,MAAA;CALA,OAAA,MAAA,CAAA;EALA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GACL,gIACA,MAAM,KACR;EAAC;CACO,GAAJ,IAAA,GAAA,IAAA;CAEJ,OAAA,aAAiC;EAAC,OAAA,MAAM;CAAM,CAAM;CACpD,OAAA,aAA+C;EAAC,OAAA,MAAM;CAAO,CAAM;CACnE,OAAA,aAAuD;EAAC,OAAA,MAAM;CAAQ,CAAM;CAC5E,OAAA,aAAiC;EAAC,OAAA,MAAM;CAAQ,CAAM;CAZ1D,OACEnB;AAcJ;AAYA,SAAgB,WAAW,OAAwB;CACjD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,SAAS,YAAY,UAAU,SAAS;CAExE,IAAA,QAAA,QAoBQ;CAZN,IAAA,QAAA,MAAA;CACE,IAAA,QAAA,MAAA;CATJ,IAAA,QAAA,MAAA;;CAME,OAAA,OAAA,CAAA;EAL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AA;CAGF,OAAA,cAAoE;EAAC,OAAA,MAAM;CAAK,CAAK;CADvF,OAAA,QAEEC,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAW;EAA7BA,WACI,2BACA;GAAgF,IAAA,SAAA,QAAA;GAAhF,OAAA,QAA2D,eAAqB;GAAhF,OAAA;EAAgF,EAAA,CAAA;CAE9E,CAAA,GANR,IAOK;CAfP,OAAA,QAgBEC,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAW;EAA7BA,WAAiC,oBAAsBC,KAAC,eAAiB;CAAW,CAAA,GAhBtF,IAiBK;CAlBP,OACEC;AAmBJ"}
|
|
1
|
+
{"version":3,"file":"chat.js","names":["<section\n data-slot=\"chat\"\n class={cn(\n 'grid h-full min-h-0 min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_auto_minmax(0,1fr)_auto] bg-background text-foreground',\n local.class\n )}\n {...rest}\n >\n <div class=\"row-start-1 min-w-0\">{local.header}</div>\n <div class=\"row-start-2 flex min-w-0 flex-col\">{local.notices}</div>\n <div class=\"row-start-3 flex min-h-0 min-w-0 flex-col\">{local.children}</div>\n <div class=\"row-start-4 min-w-0\">{local.composer}</div>\n </section>","<Show when={local.subtitle}>\n {(subtitleSlot) => (\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{subtitleSlot()}</p>\n )}\n </Show>","<Show when={local.status}>{(statusSlot) => <>{statusSlot()}</>}</Show>","{statusSlot()}","<header\n data-slot=\"chat-header\"\n class={cn(\n 'flex min-h-topbar min-w-0 items-center gap-3 border-b border-border px-4 py-2',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <h2 class=\"m-0 truncate text-sm font-semibold tracking-tight\">{local.title}</h2>\n <Show when={local.subtitle}>\n {(subtitleSlot) => (\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{subtitleSlot()}</p>\n )}\n </Show>\n </div>\n <Show when={local.status}>{(statusSlot) => <>{statusSlot()}</>}</Show>\n <Show when={local.actions}>\n {(actionsSlot) => <div class=\"flex shrink-0 items-center gap-1\">{actionsSlot()}</div>}\n </Show>\n </header>","<Show when={local.actions}>\n {(actionsSlot) => <div class=\"flex shrink-0 items-center gap-1\">{actionsSlot()}</div>}\n </Show>","<Dynamic component={Glyph()} />","<Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {descriptionSlot()}\n </p>\n )}\n </Show>","<Show when={local.action}>\n {(actionSlot) => <div class=\"flex shrink-0 items-center gap-1.5\">{actionSlot()}</div>}\n </Show>","<div\n data-slot=\"chat-notice\"\n role={local.live === 'assertive' ? 'alert' : local.live === 'polite' ? 'status' : undefined}\n class={cn(chatNoticeVariants({ tone: local.tone }), local.class)}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n class={cn('mt-0.5 shrink-0 [&_svg]:size-4', {\n 'text-muted-foreground': (local.tone ?? 'info') === 'info',\n 'text-warning': local.tone === 'warning',\n 'text-destructive': local.tone === 'danger',\n })}\n >\n <Dynamic component={Glyph()} />\n </span>\n <div class=\"min-w-0 flex-1\">\n <p class=\"m-0 font-medium [overflow-wrap:anywhere]\">{local.title}</p>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {descriptionSlot()}\n </p>\n )}\n </Show>\n </div>\n <Show when={local.action}>\n {(actionSlot) => <div class=\"flex shrink-0 items-center gap-1.5\">{actionSlot()}</div>}\n </Show>\n </div>","<Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{descriptionSlot()}</p>\n )}\n </Show>","<Show when={local.suggestions}>{(suggestionsSlot) => <>{suggestionsSlot()}</>}</Show>","{suggestionsSlot()}","<div\n data-slot=\"chat-empty\"\n class={cn(\n 'mx-auto flex min-h-full w-full max-w-xl flex-col items-center justify-center gap-4 px-6 py-10 text-center',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex flex-col gap-1\">\n <h3 class=\"m-0 text-base font-semibold tracking-tight text-balance\">{local.title}</h3>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{descriptionSlot()}</p>\n )}\n </Show>\n </div>\n <Show when={local.suggestions}>{(suggestionsSlot) => <>{suggestionsSlot()}</>}</Show>\n </div>","LucideCircleAlert","LucideInfo","LucideTriangleAlert","_$spread","_$insert","_$effect","_$readShallow","_$className"],"sources":["../../../../src/components/composites/chat/chat.tsx"],"sourcesContent":["import {\n CircleAlert as LucideCircleAlert,\n Info as LucideInfo,\n TriangleAlert as LucideTriangleAlert,\n} from '@lucide/solid'\nimport { Show, omit } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport { Dynamic } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst CircleAlert = fastIcon(LucideCircleAlert)\nconst Info = fastIcon(LucideInfo)\nconst TriangleAlert = fastIcon(LucideTriangleAlert)\n\n/**\n * Chat.\n *\n * The frame a conversation lives in: a header, a strip for things the reader\n * must know before reading anything else, the thread, and the composer. It is a\n * layout and nothing more — the thread is a `MessageScroller`, the input is a\n * composer, and what happens in between is the host's — which is why it takes\n * slots instead of data. `ConversationPane` is the other frame: reach for it when\n * the conversation opens a side thread rather than showing notices.\n *\n * ## Why notices have their own row\n *\n * \"The connection dropped\", \"this transcript has a gap\", \"this session is\n * read-only\" are about the whole conversation, not about a turn, and they must\n * not scroll away with the turns. They sit between the header and the thread in\n * their own grid track, so a notice appearing never steals the thread's row and\n * collapses to zero height when there are none. Each notice states its cause in\n * words and carries its own remedy (`action`); one that reports a *change*\n * (`live`) is announced, one that describes a standing condition is not.\n *\n * ## Layout\n *\n * `h-full min-h-0`, so the thread scrolls inside the frame rather than the page\n * growing, and a `min-w-0` track, so a long unbroken token in a turn cannot widen\n * the whole conversation. Nothing here sets a width: the reading column is the\n * turn's, and the composer sets its own measure.\n */\nexport type ChatProps = ComponentProps<'section'> & {\n header?: JSX.Element\n /** `ChatNotice`s. The row collapses when this is empty. */\n notices?: JSX.Element\n composer?: JSX.Element\n}\n\nexport function Chat(props: ChatProps) {\n const local = props\n const rest = omit(props, 'class', 'header', 'notices', 'composer', 'children')\n return (\n <section\n data-slot=\"chat\"\n class={cn(\n 'grid h-full min-h-0 min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_auto_minmax(0,1fr)_auto] bg-background text-foreground',\n local.class\n )}\n {...rest}\n >\n <div class=\"row-start-1 min-w-0\">{local.header}</div>\n <div class=\"row-start-2 flex min-w-0 flex-col\">{local.notices}</div>\n <div class=\"row-start-3 flex min-h-0 min-w-0 flex-col\">{local.children}</div>\n <div class=\"row-start-4 min-w-0\">{local.composer}</div>\n </section>\n )\n}\n\nexport type ChatHeaderProps = Omit<ComponentProps<'header'>, 'title'> & {\n title: JSX.Element\n /** One line under the title: identity, scope, generation. */\n subtitle?: JSX.Element\n /** The conversation's state in words (a `StatusChip`). */\n status?: JSX.Element\n /** Host actions: rename, archive, hand off. */\n actions?: JSX.Element\n}\n\nexport function ChatHeader(props: ChatHeaderProps) {\n const local = props\n const rest = omit(props, 'class', 'title', 'subtitle', 'status', 'actions')\n return (\n <header\n data-slot=\"chat-header\"\n class={cn(\n 'flex min-h-topbar min-w-0 items-center gap-3 border-b border-border px-4 py-2',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <h2 class=\"m-0 truncate text-sm font-semibold tracking-tight\">{local.title}</h2>\n <Show when={local.subtitle}>\n {(subtitleSlot) => (\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{subtitleSlot()}</p>\n )}\n </Show>\n </div>\n <Show when={local.status}>{(statusSlot) => <>{statusSlot()}</>}</Show>\n <Show when={local.actions}>\n {(actionsSlot) => <div class=\"flex shrink-0 items-center gap-1\">{actionsSlot()}</div>}\n </Show>\n </header>\n )\n}\n\nexport const chatNoticeVariants = cva(\n 'flex min-w-0 items-start gap-2.5 border-b px-4 py-2 text-sm',\n {\n variants: {\n tone: {\n info: 'border-border bg-muted/40',\n warning: 'border-warning/30 bg-warning-subtle',\n danger: 'border-destructive/30 bg-destructive-subtle',\n },\n },\n defaultVariants: { tone: 'info' },\n }\n)\n\nexport type ChatNoticeProps = Omit<ComponentProps<'div'>, 'title'> &\n VariantProps<typeof chatNoticeVariants> & {\n title: JSX.Element\n description?: JSX.Element\n /** The remedy: Reconnect, Jump to terminal. */\n action?: JSX.Element\n /** Announce it. Use for a change (connection lost), not a standing condition. */\n live?: 'polite' | 'assertive'\n }\n\nexport function ChatNotice(props: ChatNoticeProps) {\n const local = props\n const rest = omit(props, 'class', 'tone', 'title', 'description', 'action', 'live')\n const Glyph = () =>\n local.tone === 'danger' ? CircleAlert : local.tone === 'warning' ? TriangleAlert : Info\n return (\n <div\n data-slot=\"chat-notice\"\n role={local.live === 'assertive' ? 'alert' : local.live === 'polite' ? 'status' : undefined}\n class={cn(chatNoticeVariants({ tone: local.tone }), local.class)}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n class={cn('mt-0.5 shrink-0 [&_svg]:size-4', {\n 'text-muted-foreground': (local.tone ?? 'info') === 'info',\n 'text-warning': local.tone === 'warning',\n 'text-destructive': local.tone === 'danger',\n })}\n >\n <Dynamic component={Glyph()} />\n </span>\n <div class=\"min-w-0 flex-1\">\n <p class=\"m-0 font-medium [overflow-wrap:anywhere]\">{local.title}</p>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {descriptionSlot()}\n </p>\n )}\n </Show>\n </div>\n <Show when={local.action}>\n {(actionSlot) => <div class=\"flex shrink-0 items-center gap-1.5\">{actionSlot()}</div>}\n </Show>\n </div>\n )\n}\n\nexport type ChatEmptyProps = Omit<ComponentProps<'div'>, 'title'> & {\n title: JSX.Element\n description?: JSX.Element\n /** Prompt chips (`Suggestions`), shown only when the host has real ones. */\n suggestions?: JSX.Element\n}\n\n/** A conversation with no turns yet. Centred in the thread, never in a card. */\nexport function ChatEmpty(props: ChatEmptyProps) {\n const local = props\n const rest = omit(props, 'class', 'title', 'description', 'suggestions')\n return (\n <div\n data-slot=\"chat-empty\"\n class={cn(\n 'mx-auto flex min-h-full w-full max-w-xl flex-col items-center justify-center gap-4 px-6 py-10 text-center',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex flex-col gap-1\">\n <h3 class=\"m-0 text-base font-semibold tracking-tight text-balance\">{local.title}</h3>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{descriptionSlot()}</p>\n )}\n </Show>\n </div>\n <Show when={local.suggestions}>{(suggestionsSlot) => <>{suggestionsSlot()}</>}</Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAaA,IAAM,cAAc,SAASc,aAAiB;AAC9C,IAAM,OAAO,SAASC,MAAU;AAChC,IAAM,gBAAgB,SAASC,eAAmB;AAoClD,SAAgB,KAAK,OAAkB;CACrC,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,UAAU,WAAW,YAAY,UAAU;CAE3E,IAAA,OAAA,OAYS;CAJP,IAAA,QAAA,KAAA;CACA,IAAA,QAAA,MAAA;CACA,IAAA,QAAA,MAAA;CACA,IAAA,QAAA,MAAA;CALAC,OAAA,MAAA,CAAA;EALA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GACL,gIACA,MAAM,KACR;EAAC;CACO,GAAJ,IAAA,GAAA,IAAA;CAEJC,OAAA,aAAiC;EAAC,OAAA,MAAM;CAAM,CAAM;CACpDA,OAAA,aAA+C;EAAC,OAAA,MAAM;CAAO,CAAM;CACnEA,OAAA,aAAuD;EAAC,OAAA,MAAM;CAAQ,CAAM;CAC5EA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AA;;CAbR,OACEZ;AA+BJ;;AAUA,SAAgB,UAAU,OAAuB;CAC/C,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,SAAS,eAAe,aAAa;CAErE,IAAA,SAAA,QAiBK;CATH,IAAA,SAAA,OAAA;CACE,IAAA,SAAA,OAAA;CAHFQ,OAAA,QAAA,CAAA;EALA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GACL,6GACA,MAAM,KACR;EAAC;CACO,GAAJ,IAAA,GAAA,IAAA;CAGFC,OAAA,cAAoE;EAAC,OAAA,MAAM;CAAK,CAAK;CADvFA,OAAA,QAEER,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAW;EAA7BA,WACI,2BACA;GAAgF,IAAA,SAAA,QAAA;GAAhFQ,OAAA,QAA2D,eAAqB;GAAhF,OAAA;EAAgF,EAAA,CAAA;CAE9E,CAAA,GANR,IAOK;CAfPA,OAAA,QAgBEP,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAW;EAA7BA,WAAiC,oBAAsBC,KAAC,eAAiB;CAAW,CAAA,GAhBtF,IAiBK;CAlBP,OACEC;AAmBJ"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { className, createComponent, effect, insert, memo, readShallow, ref, setAttribute, spread, template } from "@solidjs/web";
|
|
2
|
+
import { Flag as Flag$1 } from "@lucide/solid";
|
|
3
|
+
import { Show, createEffect, createMemo, createSignal, createUniqueId, omit } from "solid-js";
|
|
1
4
|
import { cn } from "../../../lib/utils.js";
|
|
2
5
|
import { Button } from "../../ui/button/button.js";
|
|
3
6
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "../../ui/alert-dialog/alert-dialog.js";
|
|
@@ -7,12 +10,9 @@ import { settleAction } from "../../../lib/async-action.js";
|
|
|
7
10
|
import { boundText } from "../../../lib/text.js";
|
|
8
11
|
import { checkpointLabel, checkpointStatus, restoreControl, restoreDialogCopy } from "./checkpoint-model.js";
|
|
9
12
|
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
10
|
-
import { className, createComponent, effect, insert, memo, readShallow, ref, setAttribute, spread, template } from "@solidjs/web";
|
|
11
|
-
import { Flag } from "@lucide/solid";
|
|
12
|
-
import { Show, createEffect, createMemo, createSignal, createUniqueId, omit } from "solid-js";
|
|
13
13
|
// src/components/composites/checkpoint/checkpoint.tsx
|
|
14
14
|
var _tmpl$ = /* @__PURE__ */ template(`<div><p role=status tabindex=-1>`);
|
|
15
|
-
var Flag
|
|
15
|
+
var Flag = fastIcon(Flag$1);
|
|
16
16
|
function Checkpoint(props) {
|
|
17
17
|
const local = props;
|
|
18
18
|
const rest = omit(props, "class", "label", "time", "state", "onRestore", "consequence", "restoreLabel", "disabledReason", "error");
|
|
@@ -127,7 +127,7 @@ function Checkpoint(props) {
|
|
|
127
127
|
insert(_el$, createComponent(Marker, {
|
|
128
128
|
variant: "rule",
|
|
129
129
|
get icon() {
|
|
130
|
-
return createComponent(Flag
|
|
130
|
+
return createComponent(Flag, {});
|
|
131
131
|
},
|
|
132
132
|
get tone() {
|
|
133
133
|
return state() === "failed" ? "danger" : "neutral";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.js","names":["<Show when={control().visible}>\n <AlertDialog\n open={confirming()}\n onOpenChange={(open: boolean) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled ? 'true' : undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </Show>","<AlertDialog\n open={confirming()}\n onOpenChange={(open: boolean) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled ? 'true' : undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>","onOpenChange={(open: boolean) => setConfirming(open && !control().disabled)}","<AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled ? 'true' : undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>","as={Button}","variant=\"ghost\"","size=\"2xs\"","<Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>","<Spinner size=\"xs\" label={false} />","size=\"xs\"","label={false}","{state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}","<AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>","<AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>","<AlertDialogTitle>{copy().title}</AlertDialogTitle>","<AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>","class=\"[overflow-wrap:anywhere]\"","<AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>","<AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>","<AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>","onClick={() => void restore()}","ref={(element) => (root = element)}","<Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />","variant=\"rule\"","<Flag />","local.time ? boundText(local.time, 60) : undefined","<div\n ref={(element) => (root = element)}\n data-slot=\"checkpoint\"\n data-state={state()}\n class={local.class}\n {...rest}\n >\n <Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />\n {/* Always present, so a state change is a change to a live region rather than\n the arrival of one. Empty while idle, which takes no space. */}\n <p\n id={reasonId}\n ref={(element) => (status = element)}\n role=\"status\"\n tabindex=\"-1\"\n class={cn('m-0 text-center text-xs outline-none [overflow-wrap:anywhere]', {\n 'text-destructive': state() === 'failed',\n 'text-muted-foreground': state() !== 'failed',\n })}\n >\n {statusText()}\n </p>\n </div>","ref={(element) => (status = element)}","Flag","LucideFlag","_$readShallow"],"sources":["../../../../src/components/composites/checkpoint/checkpoint.tsx"],"sourcesContent":["import { Flag as LucideFlag } from '@lucide/solid'\nimport { createEffect, createMemo, createSignal, createUniqueId, Show, omit } from 'solid-js'\nimport { type ComponentProps } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from '../../ui/alert-dialog'\nimport { Marker } from '../../ui/marker'\nimport { Spinner } from '../../ui/spinner'\nimport { settleAction } from '#lib/async-action'\nimport { boundText } from '#lib/text'\nimport {\n checkpointLabel,\n checkpointStatus,\n restoreControl,\n restoreDialogCopy,\n type CheckpointState,\n} from './checkpoint-model'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Flag = fastIcon(LucideFlag)\n\n/**\n * Checkpoint.\n *\n * A point in the conversation the host can name: a divider in the transcript with\n * a label and a time. It always renders, as a `Marker`, the quietest thing in the\n * column, and it is honest about what it is:\n *\n * - **Without `onRestore` it is only a marker.** Not a disabled button, not a\n * greyed-out \"Restore\": nothing. Whether a checkpoint can be returned to is a\n * fact about the host's storage and permissions, and a control that implies it\n * can would be a claim nobody made.\n * - **With `onRestore` it offers Restore, and Restore asks first.** An\n * `AlertDialog` (Escape and the scrim do nothing; every exit is a named choice)\n * states what will change in the host's own words (`consequence`) before the\n * handler is called. A restore throws work away; the confirmation is the point.\n *\n * ## States\n *\n * `idle` → `restoring` → `restored`, or `failed` with `error`. Pass `state` to\n * drive it from the host; omit it and the component follows the promise\n * `onRestore` returns. The status sentence is a live region that exists from the\n * start, so a change is announced. While restoring, the control stays focusable\n * (`aria-disabled`, not `disabled`) so focus is not dropped when the dialog hands\n * it back; once restored the control goes and focus moves to the status line.\n *\n * A restore that cannot happen now takes `disabledReason`, shown in words under\n * the divider; the host decides, the component explains.\n */\nexport type CheckpointProps = Omit<ComponentProps<'div'>, 'children' | 'onError'> & {\n /** The checkpoint's name. Defaults to \"Checkpoint\". */\n label?: string\n /** When it was taken, already formatted for the reader. */\n time?: string\n state?: CheckpointState\n /** Supplying this is what makes the checkpoint restorable. */\n onRestore?: () => void | Promise<void>\n /** What restoring will change, in the host's words. Shown in the confirmation. */\n consequence?: string\n restoreLabel?: string\n /** Why Restore cannot be used right now. */\n disabledReason?: string\n /** Why a restore failed. */\n error?: string\n}\n\nexport function Checkpoint(props: CheckpointProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'label',\n 'time',\n 'state',\n 'onRestore',\n 'consequence',\n 'restoreLabel',\n 'disabledReason',\n 'error'\n )\n const uid = createUniqueId()\n const reasonId = `${uid}-status`\n const [followed, setFollowed] = createSignal<CheckpointState>('idle')\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n const [confirming, setConfirming] = createSignal(false)\n let inflight = false\n let root: HTMLDivElement | undefined\n let status: HTMLParagraphElement | undefined\n\n const state = (): CheckpointState => local.state ?? followed()\n const error = () => local.error ?? failure()\n const control = () => restoreControl(local.onRestore !== undefined, state(), local.disabledReason)\n const copy = () => restoreDialogCopy(local.label, local.consequence)\n const statusText = () => checkpointStatus(state(), error(), local.disabledReason)\n\n const restore = async () => {\n if (inflight || control().disabled) return\n inflight = true\n setFailure(undefined)\n setFollowed('restoring')\n const result = await settleAction(local.onRestore)\n inflight = false\n if (result.ok) {\n setFollowed('restored')\n } else {\n setFailure(result.message)\n setFollowed('failed')\n }\n }\n\n // The control is replaced by the status line on success; do not strand focus.\n // A memo, so the effect only re-runs when the state crosses into or out of\n // `restored`, not on every change that leaves it where it was.\n const restored = createMemo(() => state() === 'restored')\n createEffect(\n restored,\n (isRestored) => {\n if (!isRestored) return\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n status?.focus()\n }\n },\n { defer: true }\n )\n\n // Built once. `Marker` reads `action` twice (to test it, then to draw it), and a\n // JSX prop re-creates its component on every read: a second AlertDialog root\n // would portal a second, invisible-to-the-tree dialog when this one opens.\n const restoreAction = createMemo(() => (\n <Show when={control().visible}>\n <AlertDialog\n open={confirming()}\n onOpenChange={(open: boolean) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled ? 'true' : undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </Show>\n ))\n\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"checkpoint\"\n data-state={state()}\n class={local.class}\n {...rest}\n >\n <Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />\n {/* Always present, so a state change is a change to a live region rather than\n the arrival of one. Empty while idle, which takes no space. */}\n <p\n id={reasonId}\n ref={(element) => (status = element)}\n role=\"status\"\n tabindex=\"-1\"\n class={cn('m-0 text-center text-xs outline-none [overflow-wrap:anywhere]', {\n 'text-destructive': state() === 'failed',\n 'text-muted-foreground': state() !== 'failed',\n })}\n >\n {statusText()}\n </p>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AA8BA,IAAM4B,SAAO,SAASC,IAAU;AA+ChC,SAAgB,WAAW,OAAwB;CACjD,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,SACA,QACA,SACA,aACA,eACA,gBACA,kBACA,OACF;CAEA,MAAM,WAAW,GADL,eACQ,EAAI;CACxB,MAAM,CAAC,UAAU,eAAe,aAA8B,MAAM;CACpE,MAAM,CAAC,SAAS,cAAc,aAAiC,KAAA,CAAS;CACxE,MAAM,CAAC,YAAY,iBAAiB,aAAa,KAAK;CACtD,IAAI,WAAW;CACf,IAAI;CACJ,IAAI;CAEJ,MAAM,cAA+B,MAAM,SAAS,SAAS;CAC7D,MAAM,cAAc,MAAM,SAAS,QAAQ;CAC3C,MAAM,gBAAgB,eAAe,MAAM,cAAc,KAAA,GAAW,MAAM,GAAG,MAAM,cAAc;CACjG,MAAM,aAAa,kBAAkB,MAAM,OAAO,MAAM,WAAW;CACnE,MAAM,mBAAmB,iBAAiB,MAAM,GAAG,MAAM,GAAG,MAAM,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AAM,WAAW,WAAW;EAAS;EACjD,IAAA,QAAA;GAAO,OAAA,gBAAgB,MAAM,KAAK;EAAC;EACnC,IAAA,cAAA;GAAaC,OAAAA,WAAAA;IAAM,OAAA,CAAA,CAAA,MAAA;GAA2C,CAAA,CAAC,CAAD,IAApC,UAAU,MAAM,MAAM,EAAE,IAAI,KAAA;EAAS;EAC/D,IAAA,SAAA;GAAQ,OAAA,cAAc;EAAC;CACxB,CAAA,GAdHC,KA6BK;CAXD,aAAA,OAAA,MAAI,QAAQ;CACZ,UAAA;EAAM,QAAA,YAAa,SAAS;CAAQ,GAApCC,KAAoC;CAFtC,OAAA,OAUG,UACA;CAND,aAAAG,YAAO,GAAG,iEAAiE;EACzE,oBAAoB,MAAM,MAAM;EAChC,yBAAyB,MAAM,MAAM;CACvC,CAAC,CAAC,IAHF,KAAA,QAAA;EAGE,UAAA,OAAA,KAAA,GAAA;;CA1BR,OACEJ;AA+BJ"}
|
|
1
|
+
{"version":3,"file":"checkpoint.js","names":["<Show when={control().visible}>\n <AlertDialog\n open={confirming()}\n onOpenChange={(open: boolean) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled ? 'true' : undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </Show>","<AlertDialog\n open={confirming()}\n onOpenChange={(open: boolean) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled ? 'true' : undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>","onOpenChange={(open: boolean) => setConfirming(open && !control().disabled)}","<AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled ? 'true' : undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>","as={Button}","variant=\"ghost\"","size=\"2xs\"","<Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>","<Spinner size=\"xs\" label={false} />","size=\"xs\"","label={false}","{state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}","<AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>","<AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>","<AlertDialogTitle>{copy().title}</AlertDialogTitle>","<AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>","class=\"[overflow-wrap:anywhere]\"","<AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>","<AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>","<AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>","onClick={() => void restore()}","ref={(element) => (root = element)}","<Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />","variant=\"rule\"","<Flag />","local.time ? boundText(local.time, 60) : undefined","<div\n ref={(element) => (root = element)}\n data-slot=\"checkpoint\"\n data-state={state()}\n class={local.class}\n {...rest}\n >\n <Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />\n {/* Always present, so a state change is a change to a live region rather than\n the arrival of one. Empty while idle, which takes no space. */}\n <p\n id={reasonId}\n ref={(element) => (status = element)}\n role=\"status\"\n tabindex=\"-1\"\n class={cn('m-0 text-center text-xs outline-none [overflow-wrap:anywhere]', {\n 'text-destructive': state() === 'failed',\n 'text-muted-foreground': state() !== 'failed',\n })}\n >\n {statusText()}\n </p>\n </div>","ref={(element) => (status = element)}","LucideFlag","_$spread","_$ref","_$insert","_$setAttribute","_$effect","_$readShallow","_$className"],"sources":["../../../../src/components/composites/checkpoint/checkpoint.tsx"],"sourcesContent":["import { Flag as LucideFlag } from '@lucide/solid'\nimport { createEffect, createMemo, createSignal, createUniqueId, Show, omit } from 'solid-js'\nimport { type ComponentProps } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from '../../ui/alert-dialog'\nimport { Marker } from '../../ui/marker'\nimport { Spinner } from '../../ui/spinner'\nimport { settleAction } from '#lib/async-action'\nimport { boundText } from '#lib/text'\nimport {\n checkpointLabel,\n checkpointStatus,\n restoreControl,\n restoreDialogCopy,\n type CheckpointState,\n} from './checkpoint-model'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Flag = fastIcon(LucideFlag)\n\n/**\n * Checkpoint.\n *\n * A point in the conversation the host can name: a divider in the transcript with\n * a label and a time. It always renders, as a `Marker`, the quietest thing in the\n * column, and it is honest about what it is:\n *\n * - **Without `onRestore` it is only a marker.** Not a disabled button, not a\n * greyed-out \"Restore\": nothing. Whether a checkpoint can be returned to is a\n * fact about the host's storage and permissions, and a control that implies it\n * can would be a claim nobody made.\n * - **With `onRestore` it offers Restore, and Restore asks first.** An\n * `AlertDialog` (Escape and the scrim do nothing; every exit is a named choice)\n * states what will change in the host's own words (`consequence`) before the\n * handler is called. A restore throws work away; the confirmation is the point.\n *\n * ## States\n *\n * `idle` → `restoring` → `restored`, or `failed` with `error`. Pass `state` to\n * drive it from the host; omit it and the component follows the promise\n * `onRestore` returns. The status sentence is a live region that exists from the\n * start, so a change is announced. While restoring, the control stays focusable\n * (`aria-disabled`, not `disabled`) so focus is not dropped when the dialog hands\n * it back; once restored the control goes and focus moves to the status line.\n *\n * A restore that cannot happen now takes `disabledReason`, shown in words under\n * the divider; the host decides, the component explains.\n */\nexport type CheckpointProps = Omit<ComponentProps<'div'>, 'children' | 'onError'> & {\n /** The checkpoint's name. Defaults to \"Checkpoint\". */\n label?: string\n /** When it was taken, already formatted for the reader. */\n time?: string\n state?: CheckpointState\n /** Supplying this is what makes the checkpoint restorable. */\n onRestore?: () => void | Promise<void>\n /** What restoring will change, in the host's words. Shown in the confirmation. */\n consequence?: string\n restoreLabel?: string\n /** Why Restore cannot be used right now. */\n disabledReason?: string\n /** Why a restore failed. */\n error?: string\n}\n\nexport function Checkpoint(props: CheckpointProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'label',\n 'time',\n 'state',\n 'onRestore',\n 'consequence',\n 'restoreLabel',\n 'disabledReason',\n 'error'\n )\n const uid = createUniqueId()\n const reasonId = `${uid}-status`\n const [followed, setFollowed] = createSignal<CheckpointState>('idle')\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n const [confirming, setConfirming] = createSignal(false)\n let inflight = false\n let root: HTMLDivElement | undefined\n let status: HTMLParagraphElement | undefined\n\n const state = (): CheckpointState => local.state ?? followed()\n const error = () => local.error ?? failure()\n const control = () => restoreControl(local.onRestore !== undefined, state(), local.disabledReason)\n const copy = () => restoreDialogCopy(local.label, local.consequence)\n const statusText = () => checkpointStatus(state(), error(), local.disabledReason)\n\n const restore = async () => {\n if (inflight || control().disabled) return\n inflight = true\n setFailure(undefined)\n setFollowed('restoring')\n const result = await settleAction(local.onRestore)\n inflight = false\n if (result.ok) {\n setFollowed('restored')\n } else {\n setFailure(result.message)\n setFollowed('failed')\n }\n }\n\n // The control is replaced by the status line on success; do not strand focus.\n // A memo, so the effect only re-runs when the state crosses into or out of\n // `restored`, not on every change that leaves it where it was.\n const restored = createMemo(() => state() === 'restored')\n createEffect(\n restored,\n (isRestored) => {\n if (!isRestored) return\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n status?.focus()\n }\n },\n { defer: true }\n )\n\n // Built once. `Marker` reads `action` twice (to test it, then to draw it), and a\n // JSX prop re-creates its component on every read: a second AlertDialog root\n // would portal a second, invisible-to-the-tree dialog when this one opens.\n const restoreAction = createMemo(() => (\n <Show when={control().visible}>\n <AlertDialog\n open={confirming()}\n onOpenChange={(open: boolean) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled ? 'true' : undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </Show>\n ))\n\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"checkpoint\"\n data-state={state()}\n class={local.class}\n {...rest}\n >\n <Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />\n {/* Always present, so a state change is a change to a live region rather than\n the arrival of one. Empty while idle, which takes no space. */}\n <p\n id={reasonId}\n ref={(element) => (status = element)}\n role=\"status\"\n tabindex=\"-1\"\n class={cn('m-0 text-center text-xs outline-none [overflow-wrap:anywhere]', {\n 'text-destructive': state() === 'failed',\n 'text-muted-foreground': state() !== 'failed',\n })}\n >\n {statusText()}\n </p>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AA8BA,IAAM,OAAO,SAAS4B,MAAU;AA+ChC,SAAgB,WAAW,OAAwB;CACjD,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,SACA,QACA,SACA,aACA,eACA,gBACA,kBACA,OACF;CAEA,MAAM,WAAW,GADL,eACQ,EAAI;CACxB,MAAM,CAAC,UAAU,eAAe,aAA8B,MAAM;CACpE,MAAM,CAAC,SAAS,cAAc,aAAiC,KAAA,CAAS;CACxE,MAAM,CAAC,YAAY,iBAAiB,aAAa,KAAK;CACtD,IAAI,WAAW;CACf,IAAI;CACJ,IAAI;CAEJ,MAAM,cAA+B,MAAM,SAAS,SAAS;CAC7D,MAAM,cAAc,MAAM,SAAS,QAAQ;CAC3C,MAAM,gBAAgB,eAAe,MAAM,cAAc,KAAA,GAAW,MAAM,GAAG,MAAM,cAAc;CACjG,MAAM,aAAa,kBAAkB,MAAM,OAAO,MAAM,WAAW;CACnE,MAAM,mBAAmB,iBAAiB,MAAM,GAAG,MAAM,GAAG,MAAM,cAAc;CAEhF,MAAM,UAAU,YAAY;EAC1B,IAAI,YAAY,QAAQ,CAAC,CAAC,UAAU;EACpC,WAAW;EACX,WAAW,KAAA,CAAS;EACpB,YAAY,WAAW;EACvB,MAAM,SAAS,MAAM,aAAa,MAAM,SAAS;EACjD,WAAW;EACX,IAAI,OAAO,IACT,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,IAAI,KAAA;EAAS;EAC/D,IAAA,SAAA;GAAQ,OAAA,cAAc;EAAC;CACxB,CAAA,GAdHC,KA6BK;CAXDM,aAAA,OAAA,MAAI,QAAQ;CACZF,UAAA;EAAM,QAAA,YAAa,SAAS;CAAQ,GAApCH,KAAoC;CAFtCI,OAAA,OAUG,UACA;CANDE,aAAAC,YAAO,GAAG,iEAAiE;EACzE,oBAAoB,MAAM,MAAM;EAChC,yBAAyB,MAAM,MAAM;CACvC,CAAC,CAAC,IAHF,KAAA,QAAA;EAGEC,UAAA,OAAA,KAAA,GAAA;;CA1BR,OACET;AA+BJ"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { createComponent, insert, memo, mergeProps, ref, setAttribute, spread, template } from "@solidjs/web";
|
|
2
|
+
import { Ban as Ban$1, Check as Check$1, Clock as Clock$1, Lock as Lock$1, ShieldQuestion as ShieldQuestion$1 } from "@lucide/solid";
|
|
3
|
+
import { Show, createEffect, createMemo, createSignal, createUniqueId, omit } from "solid-js";
|
|
1
4
|
import { cn } from "../../../lib/utils.js";
|
|
2
5
|
import { Button } from "../../ui/button/button.js";
|
|
3
6
|
import { CodeBlock } from "../../ui/code-block/code-block.js";
|
|
@@ -6,9 +9,6 @@ import { Spinner } from "../../ui/spinner/spinner.js";
|
|
|
6
9
|
import { boundText } from "../../../lib/text.js";
|
|
7
10
|
import { confirmationOutcome, decisionReason, isAwaitingAnswer, settleDecision } from "./confirmation-model.js";
|
|
8
11
|
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
9
|
-
import { createComponent, insert, memo, mergeProps, ref, setAttribute, spread, template } from "@solidjs/web";
|
|
10
|
-
import { Ban, Check, Clock, Lock, ShieldQuestion } from "@lucide/solid";
|
|
11
|
-
import { Show, createEffect, createMemo, createSignal, createUniqueId, omit } from "solid-js";
|
|
12
12
|
// src/components/composites/confirmation/confirmation.tsx
|
|
13
13
|
var _tmpl$ = /* @__PURE__ */ template(`<section><header class="flex items-start gap-2.5"><span aria-hidden=true class="mt-0.5 text-muted-foreground [&_svg]:size-4"><!><!><!><!><!></span><div class="min-w-0 flex-1"><h3 class="m-0 text-sm font-semibold [overflow-wrap:anywhere]"></h3></div></header><!><!><!>`);
|
|
14
14
|
var _tmpl$2 = /* @__PURE__ */ template(`<p class="m-0 mt-0.5 text-xs text-muted-foreground [overflow-wrap:anywhere]">`);
|
|
@@ -18,11 +18,11 @@ var _tmpl$5 = /* @__PURE__ */ template(`<p role=alert class="m-0 text-xs text-de
|
|
|
18
18
|
var _tmpl$6 = /* @__PURE__ */ template(`<footer class="flex flex-wrap items-center justify-end gap-2"><!><span role=status class=visually-hidden>`);
|
|
19
19
|
var _tmpl$7 = /* @__PURE__ */ template(`<p tabindex=-1 role=status class="m-0 flex items-center gap-1.5 text-xs text-muted-foreground outline-none">`);
|
|
20
20
|
var _tmpl$8 = /* @__PURE__ */ template(`<div role=region aria-label="Proposed changes"tabindex=0 class="max-h-64 overflow-auto rounded-xl outline-none focus-visible:ring-3 focus-visible:ring-primary-subtle">`);
|
|
21
|
-
var Ban
|
|
22
|
-
var Check
|
|
23
|
-
var Clock
|
|
24
|
-
var Lock
|
|
25
|
-
var ShieldQuestion
|
|
21
|
+
var Ban = fastIcon(Ban$1);
|
|
22
|
+
var Check = fastIcon(Check$1);
|
|
23
|
+
var Clock = fastIcon(Clock$1);
|
|
24
|
+
var Lock = fastIcon(Lock$1);
|
|
25
|
+
var ShieldQuestion = fastIcon(ShieldQuestion$1);
|
|
26
26
|
function Confirmation(props) {
|
|
27
27
|
const local = props;
|
|
28
28
|
const rest = omit(props, "class", "state", "title", "description", "details", "onApprove", "onDeny", "approveLabel", "denyLabel", "disabledReason", "error", "resolvedBy", "resolvedAt", "children");
|
|
@@ -116,7 +116,7 @@ function Confirmation(props) {
|
|
|
116
116
|
return state() === "approved";
|
|
117
117
|
});
|
|
118
118
|
return () => {
|
|
119
|
-
return _c$() ? createComponent(Check
|
|
119
|
+
return _c$() ? createComponent(Check, { class: "text-success" }) : void 0;
|
|
120
120
|
};
|
|
121
121
|
})(), _el$4);
|
|
122
122
|
insert(_el$3, (() => {
|
|
@@ -124,7 +124,7 @@ function Confirmation(props) {
|
|
|
124
124
|
return state() === "denied";
|
|
125
125
|
});
|
|
126
126
|
return () => {
|
|
127
|
-
return _c$2() ? createComponent(Ban
|
|
127
|
+
return _c$2() ? createComponent(Ban, {}) : void 0;
|
|
128
128
|
};
|
|
129
129
|
})(), _el$5);
|
|
130
130
|
insert(_el$3, (() => {
|
|
@@ -132,7 +132,7 @@ function Confirmation(props) {
|
|
|
132
132
|
return state() === "expired";
|
|
133
133
|
});
|
|
134
134
|
return () => {
|
|
135
|
-
return _c$3() ? createComponent(Clock
|
|
135
|
+
return _c$3() ? createComponent(Clock, {}) : void 0;
|
|
136
136
|
};
|
|
137
137
|
})(), _el$6);
|
|
138
138
|
insert(_el$3, (() => {
|
|
@@ -140,7 +140,7 @@ function Confirmation(props) {
|
|
|
140
140
|
return state() === "unavailable";
|
|
141
141
|
});
|
|
142
142
|
return () => {
|
|
143
|
-
return _c$4() ? createComponent(Lock
|
|
143
|
+
return _c$4() ? createComponent(Lock, {}) : void 0;
|
|
144
144
|
};
|
|
145
145
|
})(), _el$7);
|
|
146
146
|
insert(_el$3, (() => {
|
|
@@ -148,7 +148,7 @@ function Confirmation(props) {
|
|
|
148
148
|
return state() === "requested";
|
|
149
149
|
});
|
|
150
150
|
return () => {
|
|
151
|
-
return _c$5() ? createComponent(ShieldQuestion
|
|
151
|
+
return _c$5() ? createComponent(ShieldQuestion, {}) : void 0;
|
|
152
152
|
};
|
|
153
153
|
})(), _el$8);
|
|
154
154
|
setAttribute(_el$10, "id", titleId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation.js","names":["ref={(element) => (root = element)}","<Check class=\"text-success\" />","class=\"text-success\"","<span aria-hidden=\"true\" class=\"mt-0.5 text-muted-foreground [&_svg]:size-4\">\n <Show when={state() === 'approved'}>\n <Check class=\"text-success\" />\n </Show>\n <Show when={state() === 'denied'}>\n <Ban />\n </Show>\n <Show when={state() === 'expired'}>\n <Clock />\n </Show>\n <Show when={state() === 'unavailable'}>\n <Lock />\n </Show>\n <Show when={state() === 'requested'}>\n <ShieldQuestion />\n </Show>\n </span>","<Ban />","<Clock />","<Lock />","<ShieldQuestion />","<Show when={local.details}>{(details) => <Details details={details()} />}</Show>","<Details details={details()} />","<section\n ref={(element) => (root = element)}\n data-slot=\"confirmation\"\n data-state={state()}\n aria-labelledby={titleId}\n class={cn(\n 'flex w-full max-w-xl min-w-0 flex-col gap-3 rounded-xl border bg-card p-4',\n {\n 'border-ring': awaiting(),\n 'border-border': !awaiting(),\n },\n local.class\n )}\n {...rest}\n >\n <header class=\"flex items-start gap-2.5\">\n <span aria-hidden=\"true\" class=\"mt-0.5 text-muted-foreground [&_svg]:size-4\">\n <Show when={state() === 'approved'}>\n <Check class=\"text-success\" />\n </Show>\n <Show when={state() === 'denied'}>\n <Ban />\n </Show>\n <Show when={state() === 'expired'}>\n <Clock />\n </Show>\n <Show when={state() === 'unavailable'}>\n <Lock />\n </Show>\n <Show when={state() === 'requested'}>\n <ShieldQuestion />\n </Show>\n </span>\n <div class=\"min-w-0 flex-1\">\n <h3 id={titleId} class=\"m-0 text-sm font-semibold [overflow-wrap:anywhere]\">\n {boundText(local.title, 200)}\n </h3>\n <Show when={local.description}>\n <p class=\"m-0 mt-0.5 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {boundText(local.description ?? '', 400)}\n </p>\n </Show>\n </div>\n <Show when={awaiting()}>\n <span class=\"shrink-0 text-xs text-muted-foreground\">\n {state() === 'requested' ? 'Needs your answer' : 'Cannot be answered now'}\n </span>\n </Show>\n </header>\n\n <Show when={local.details}>{(details) => <Details details={details()} />}</Show>\n\n {local.children}\n\n <Show\n when={awaiting()}\n fallback={\n <p\n ref={(element) => (outcome = element)}\n tabindex=\"-1\"\n role=\"status\"\n class=\"m-0 flex items-center gap-1.5 text-xs text-muted-foreground outline-none\"\n >\n {confirmationOutcome(state(), local.resolvedBy, local.resolvedAt)}\n </p>\n }\n >\n <Show when={reasons()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>\n </Show>\n <Show when={error()}>\n <p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>\n </Show>\n <footer class=\"flex flex-wrap items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>\n <Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>\n {/* Present from the start: a live region inserted with its text is not reliably announced. */}\n <span role=\"status\" class=\"visually-hidden\">\n {pending() !== undefined ? 'Sending your answer' : ''}\n </span>\n </footer>\n </Show>\n </section>","<Show when={reasons()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>\n </Show>","<p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>","<Show when={error()}>\n <p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>\n </Show>","<p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>","<Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>","type=\"button\"","variant=\"outline\"","size=\"sm\"","<Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>","<Spinner size=\"sm\" label={false} />","label={false}","local.denyLabel ?? 'Deny'","<footer class=\"flex flex-wrap items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>\n <Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>\n {/* Present from the start: a live region inserted with its text is not reliably announced. */}\n <span role=\"status\" class=\"visually-hidden\">\n {pending() !== undefined ? 'Sending your answer' : ''}\n </span>\n </footer>","<Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>","<Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>","local.approveLabel ?? 'Approve'","ref={(element) => (outcome = element)}","<Show\n when={props.details.kind === 'diff' && props.details}\n fallback={\n <CodeBlock\n size=\"sm\"\n code={(props.details as Extract<ConfirmationDetails, { kind: 'code' }>).code}\n language={bounded(\n (props.details as Extract<ConfirmationDetails, { kind: 'code' }>).language,\n 24\n )}\n title={bounded(props.details.title, 80)}\n complete\n wrap\n maxHeight=\"14rem\"\n />\n }\n >\n {(diff) => (\n // The diff block has no height cap of its own, so the cap lives here; a\n // scroller must be focusable, hence the labelled region and tab stop.\n <div\n role=\"region\"\n aria-label=\"Proposed changes\"\n tabindex=\"0\"\n class=\"max-h-64 overflow-auto rounded-xl outline-none focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <DiffBlock\n patch={(diff() as Extract<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />\n </div>\n )}\n </Show>","props.details.kind === 'diff' && props.details","<CodeBlock\n size=\"sm\"\n code={(props.details as Extract<ConfirmationDetails, { kind: 'code' }>).code}\n language={bounded(\n (props.details as Extract<ConfirmationDetails, { kind: 'code' }>).language,\n 24\n )}\n title={bounded(props.details.title, 80)}\n complete\n wrap\n maxHeight=\"14rem\"\n />","maxHeight=\"14rem\"","<DiffBlock\n patch={(diff() as Extract<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />","Ban","LucideBan","Check","LucideCheck","Clock","LucideClock","Lock","LucideLock","ShieldQuestion","LucideShieldQuestion"],"sources":["../../../../src/components/composites/confirmation/confirmation.tsx"],"sourcesContent":["import {\n Ban as LucideBan,\n Check as LucideCheck,\n Clock as LucideClock,\n Lock as LucideLock,\n ShieldQuestion as LucideShieldQuestion,\n} from '@lucide/solid'\nimport { createEffect, createMemo, createSignal, createUniqueId, Show, omit } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { CodeBlock } from '../../ui/code-block'\nimport { DiffBlock } from '../../ui/diff-block'\nimport { Spinner } from '../../ui/spinner'\nimport { REASON_TEXT_LIMIT, boundText } from '#lib/text'\nimport {\n confirmationOutcome,\n decisionReason,\n isAwaitingAnswer,\n settleDecision,\n type ConfirmationState,\n} from './confirmation-model'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Ban = fastIcon(LucideBan)\nconst Check = fastIcon(LucideCheck)\nconst Clock = fastIcon(LucideClock)\nconst Lock = fastIcon(LucideLock)\nconst ShieldQuestion = fastIcon(LucideShieldQuestion)\n\n/**\n * Confirmation.\n *\n * The agent has stopped a tool and will not continue until the person approves or\n * denies it. Like `Questionnaire`, this is one of the two elements in a transcript\n * the reader *must* act on, so it is allowed a card surface — and the border is\n * the focus ring's colour only while it is waiting. Once answered it drops to a\n * hairline and a one-line record, because a settled decision should read as\n * history, not as something still asking.\n *\n * ## It shows what is being approved, and nothing else\n *\n * `title` and `description` say what the tool wants to do; `details` is the\n * evidence, rendered as `CodeBlock size=\"sm\"` (a command, a request) or\n * `DiffBlock` (a patch). Details are text: never interpreted, and a long one\n * scrolls inside its block. Approve and Deny exist only while the request is\n * open; afterwards they are replaced by the outcome, with *who* and *when* only if\n * the host supplied them.\n *\n * ## The host owns authority\n *\n * Whether this client may answer is not decided here. No handler, or a host\n * `disabledReason`, or the `unavailable` state, leaves the buttons visible and\n * disabled with the reason beside them in words — never hidden, because a reader\n * who cannot see the choice cannot tell whether the agent is waiting on them.\n *\n * ## Answering is a round trip\n *\n * `onApprove` / `onDeny` may return a promise. While one is pending both buttons\n * refuse input (a synchronous guard as well as the signal, so a double click in\n * one tick cannot submit twice) and the pressed one shows a spinner. A failure\n * shows `error` (or the rejection's own message) and re-enables the buttons. The\n * buttons use `aria-disabled` rather than `disabled`: a native disabled button\n * drops focus, and the reader's place would be lost mid-decision. When the state\n * settles, focus moves to the outcome line if it was in the card, so a keyboard\n * user is not stranded on a control that no longer exists.\n */\nexport type ConfirmationDetails =\n | Readonly<{ kind: 'code'; code: string; language?: string; title?: string }>\n | Readonly<{ kind: 'diff'; patch: string; title?: string }>\n\nexport type ConfirmationProps = Omit<ComponentProps<'section'>, 'title' | 'onError'> & {\n state?: ConfirmationState\n /** What the tool wants to do, as a short sentence. */\n title: string\n description?: string\n details?: ConfirmationDetails\n onApprove?: () => void | Promise<void>\n onDeny?: () => void | Promise<void>\n approveLabel?: string\n denyLabel?: string\n /** Why the choice cannot be made right now; shown in words beside the buttons. */\n disabledReason?: string\n /** A failed answer, in words. Overrides the rejection's own message. */\n error?: string\n /** Who answered, once settled. Omit if unknown; nothing is assumed. */\n resolvedBy?: string\n /** When it was answered, already formatted for the reader. Omit if unknown. */\n resolvedAt?: string\n /** Extra content between the details and the buttons. */\n children?: JSX.Element\n}\n\ntype Choice = 'approve' | 'deny'\n\nexport function Confirmation(props: ConfirmationProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'state',\n 'title',\n 'description',\n 'details',\n 'onApprove',\n 'onDeny',\n 'approveLabel',\n 'denyLabel',\n 'disabledReason',\n 'error',\n 'resolvedBy',\n 'resolvedAt',\n 'children'\n )\n const uid = createUniqueId()\n const titleId = `${uid}-title`\n const reasonId = `${uid}-reason`\n const state = (): ConfirmationState => local.state ?? 'requested'\n const awaiting = () => isAwaitingAnswer(state())\n const [pending, setPending] = createSignal<Choice | undefined>(undefined)\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n let inflight = false\n let root: HTMLElement | undefined\n let outcome: HTMLParagraphElement | undefined\n\n const reasonFor = (handler: (() => void | Promise<void>) | undefined, missing: string) => {\n if (pending() !== undefined) return 'Your answer is being sent.'\n return decisionReason({\n state: state(),\n disabledReason: local.disabledReason,\n hasHandler: handler !== undefined,\n unavailableFallback: 'This request cannot be answered right now.',\n missingFallback: missing,\n })\n }\n const approveReason = () => reasonFor(local.onApprove, 'Approving is not available here.')\n const denyReason = () => reasonFor(local.onDeny, 'Denying is not available here.')\n // One sentence per distinct reason, so two identical reasons are not read twice.\n const reasons = () => [...new Set([approveReason(), denyReason()].filter(Boolean))].join(' ')\n const error = () => (local.error ? boundText(local.error, REASON_TEXT_LIMIT) : failure())\n\n const choose = async (choice: Choice) => {\n const handler = choice === 'approve' ? local.onApprove : local.onDeny\n const blocked = choice === 'approve' ? approveReason() : denyReason()\n if (inflight || blocked || !awaiting()) return\n inflight = true\n setPending(choice)\n setFailure(undefined)\n const result = await settleDecision(handler)\n inflight = false\n setPending(undefined)\n if (!result.ok) setFailure(result.message)\n }\n\n // The buttons are replaced by the outcome line; keep a keyboard reader in the card.\n // A memo, so the effect re-runs only when the answer state flips; the apply phase\n // gets the previous value, undefined on the first run.\n const isAwaiting = createMemo(awaiting)\n createEffect(isAwaiting, (now, was) => {\n if (was && !now) {\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n outcome?.focus()\n }\n }\n })\n\n const buttonProps = (choice: Choice) => {\n const blocked = () => (choice === 'approve' ? approveReason() : denyReason())\n const disabled = () => pending() !== undefined || blocked() !== undefined\n // Getters, so the spread keeps both attributes following the state.\n return {\n get 'aria-disabled'() {\n return disabled() ? ('true' as const) : undefined\n },\n get 'aria-describedby'() {\n return blocked() ? reasonId : undefined\n },\n onClick: () => void choose(choice),\n }\n }\n\n return (\n <section\n ref={(element) => (root = element)}\n data-slot=\"confirmation\"\n data-state={state()}\n aria-labelledby={titleId}\n class={cn(\n 'flex w-full max-w-xl min-w-0 flex-col gap-3 rounded-xl border bg-card p-4',\n {\n 'border-ring': awaiting(),\n 'border-border': !awaiting(),\n },\n local.class\n )}\n {...rest}\n >\n <header class=\"flex items-start gap-2.5\">\n <span aria-hidden=\"true\" class=\"mt-0.5 text-muted-foreground [&_svg]:size-4\">\n <Show when={state() === 'approved'}>\n <Check class=\"text-success\" />\n </Show>\n <Show when={state() === 'denied'}>\n <Ban />\n </Show>\n <Show when={state() === 'expired'}>\n <Clock />\n </Show>\n <Show when={state() === 'unavailable'}>\n <Lock />\n </Show>\n <Show when={state() === 'requested'}>\n <ShieldQuestion />\n </Show>\n </span>\n <div class=\"min-w-0 flex-1\">\n <h3 id={titleId} class=\"m-0 text-sm font-semibold [overflow-wrap:anywhere]\">\n {boundText(local.title, 200)}\n </h3>\n <Show when={local.description}>\n <p class=\"m-0 mt-0.5 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {boundText(local.description ?? '', 400)}\n </p>\n </Show>\n </div>\n <Show when={awaiting()}>\n <span class=\"shrink-0 text-xs text-muted-foreground\">\n {state() === 'requested' ? 'Needs your answer' : 'Cannot be answered now'}\n </span>\n </Show>\n </header>\n\n <Show when={local.details}>{(details) => <Details details={details()} />}</Show>\n\n {local.children}\n\n <Show\n when={awaiting()}\n fallback={\n <p\n ref={(element) => (outcome = element)}\n tabindex=\"-1\"\n role=\"status\"\n class=\"m-0 flex items-center gap-1.5 text-xs text-muted-foreground outline-none\"\n >\n {confirmationOutcome(state(), local.resolvedBy, local.resolvedAt)}\n </p>\n }\n >\n <Show when={reasons()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>\n </Show>\n <Show when={error()}>\n <p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>\n </Show>\n <footer class=\"flex flex-wrap items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>\n <Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>\n {/* Present from the start: a live region inserted with its text is not reliably announced. */}\n <span role=\"status\" class=\"visually-hidden\">\n {pending() !== undefined ? 'Sending your answer' : ''}\n </span>\n </footer>\n </Show>\n </section>\n )\n}\n\n/** A name from the host or the model, cleaned and clipped before it reaches a header. */\nfunction bounded(value: string | undefined, limit: number): string | undefined {\n return value ? boundText(value, limit) || undefined : undefined\n}\n\nfunction Details(props: { details: ConfirmationDetails }) {\n return (\n <Show\n when={props.details.kind === 'diff' && props.details}\n fallback={\n <CodeBlock\n size=\"sm\"\n code={(props.details as Extract<ConfirmationDetails, { kind: 'code' }>).code}\n language={bounded(\n (props.details as Extract<ConfirmationDetails, { kind: 'code' }>).language,\n 24\n )}\n title={bounded(props.details.title, 80)}\n complete\n wrap\n maxHeight=\"14rem\"\n />\n }\n >\n {(diff) => (\n // The diff block has no height cap of its own, so the cap lives here; a\n // scroller must be focusable, hence the labelled region and tab stop.\n <div\n role=\"region\"\n aria-label=\"Proposed changes\"\n tabindex=\"0\"\n class=\"max-h-64 overflow-auto rounded-xl outline-none focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <DiffBlock\n patch={(diff() as Extract<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />\n </div>\n )}\n </Show>\n )\n}\n"],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AAAA,MAAAA;EACE,IAAA,OAAA;GAAMC,OAAAA,WAAAA;IAAM,OAAA,MAAA,QAAQ,SAAS;GAAsB,CAAA,CAAC,CAAD,KAAZ,MAAM;EAAO;EACpD,IAAA,WAAA;GACEC,OAAAA,gBAAAA,WAAAA;IACEZ,MAAK;IACL,IAAA,OAAA;KAAO,OAAA,MAAM,QAA2D;IAAI;IAC5E,IAAA,WAAA;KAAU,OAAA,QACP,MAAM,QAA2D,UAClE,EACF;IAAC;IACD,IAAA,QAAA;KAAO,OAAA,QAAQ,MAAM,QAAQ,OAAO,EAAE;IAAC;IACvC,UAAA;IACA,MAAA;IACAa,WAAU;GACX,CAAA;EACH;EAfFH,WAiBI,gBAGA;GAWK,IAAA,SAAA,QAAA;GAXL,OAAA,QAMEI,gBAAAA,WAAAA;IACE,IAAA,QAAA;KAAQ,OAAA,KAAK,CAAA,CAAqD;IAAK;IACvE,IAAA,QAAA;KAAO,OAAA,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE;IAAC;IAChC,UAAA;GACD,CAAA,CACE;GAXL,OAAA;EAWK,EAAA,CAAA;CAEH,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"confirmation.js","names":["ref={(element) => (root = element)}","<Check class=\"text-success\" />","class=\"text-success\"","<span aria-hidden=\"true\" class=\"mt-0.5 text-muted-foreground [&_svg]:size-4\">\n <Show when={state() === 'approved'}>\n <Check class=\"text-success\" />\n </Show>\n <Show when={state() === 'denied'}>\n <Ban />\n </Show>\n <Show when={state() === 'expired'}>\n <Clock />\n </Show>\n <Show when={state() === 'unavailable'}>\n <Lock />\n </Show>\n <Show when={state() === 'requested'}>\n <ShieldQuestion />\n </Show>\n </span>","<Ban />","<Clock />","<Lock />","<ShieldQuestion />","<Show when={local.details}>{(details) => <Details details={details()} />}</Show>","<Details details={details()} />","<section\n ref={(element) => (root = element)}\n data-slot=\"confirmation\"\n data-state={state()}\n aria-labelledby={titleId}\n class={cn(\n 'flex w-full max-w-xl min-w-0 flex-col gap-3 rounded-xl border bg-card p-4',\n {\n 'border-ring': awaiting(),\n 'border-border': !awaiting(),\n },\n local.class\n )}\n {...rest}\n >\n <header class=\"flex items-start gap-2.5\">\n <span aria-hidden=\"true\" class=\"mt-0.5 text-muted-foreground [&_svg]:size-4\">\n <Show when={state() === 'approved'}>\n <Check class=\"text-success\" />\n </Show>\n <Show when={state() === 'denied'}>\n <Ban />\n </Show>\n <Show when={state() === 'expired'}>\n <Clock />\n </Show>\n <Show when={state() === 'unavailable'}>\n <Lock />\n </Show>\n <Show when={state() === 'requested'}>\n <ShieldQuestion />\n </Show>\n </span>\n <div class=\"min-w-0 flex-1\">\n <h3 id={titleId} class=\"m-0 text-sm font-semibold [overflow-wrap:anywhere]\">\n {boundText(local.title, 200)}\n </h3>\n <Show when={local.description}>\n <p class=\"m-0 mt-0.5 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {boundText(local.description ?? '', 400)}\n </p>\n </Show>\n </div>\n <Show when={awaiting()}>\n <span class=\"shrink-0 text-xs text-muted-foreground\">\n {state() === 'requested' ? 'Needs your answer' : 'Cannot be answered now'}\n </span>\n </Show>\n </header>\n\n <Show when={local.details}>{(details) => <Details details={details()} />}</Show>\n\n {local.children}\n\n <Show\n when={awaiting()}\n fallback={\n <p\n ref={(element) => (outcome = element)}\n tabindex=\"-1\"\n role=\"status\"\n class=\"m-0 flex items-center gap-1.5 text-xs text-muted-foreground outline-none\"\n >\n {confirmationOutcome(state(), local.resolvedBy, local.resolvedAt)}\n </p>\n }\n >\n <Show when={reasons()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>\n </Show>\n <Show when={error()}>\n <p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>\n </Show>\n <footer class=\"flex flex-wrap items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>\n <Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>\n {/* Present from the start: a live region inserted with its text is not reliably announced. */}\n <span role=\"status\" class=\"visually-hidden\">\n {pending() !== undefined ? 'Sending your answer' : ''}\n </span>\n </footer>\n </Show>\n </section>","<Show when={reasons()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>\n </Show>","<p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>","<Show when={error()}>\n <p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>\n </Show>","<p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>","<Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>","type=\"button\"","variant=\"outline\"","size=\"sm\"","<Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>","<Spinner size=\"sm\" label={false} />","label={false}","local.denyLabel ?? 'Deny'","<footer class=\"flex flex-wrap items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>\n <Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>\n {/* Present from the start: a live region inserted with its text is not reliably announced. */}\n <span role=\"status\" class=\"visually-hidden\">\n {pending() !== undefined ? 'Sending your answer' : ''}\n </span>\n </footer>","<Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>","<Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>","local.approveLabel ?? 'Approve'","ref={(element) => (outcome = element)}","<Show\n when={props.details.kind === 'diff' && props.details}\n fallback={\n <CodeBlock\n size=\"sm\"\n code={(props.details as Extract<ConfirmationDetails, { kind: 'code' }>).code}\n language={bounded(\n (props.details as Extract<ConfirmationDetails, { kind: 'code' }>).language,\n 24\n )}\n title={bounded(props.details.title, 80)}\n complete\n wrap\n maxHeight=\"14rem\"\n />\n }\n >\n {(diff) => (\n // The diff block has no height cap of its own, so the cap lives here; a\n // scroller must be focusable, hence the labelled region and tab stop.\n <div\n role=\"region\"\n aria-label=\"Proposed changes\"\n tabindex=\"0\"\n class=\"max-h-64 overflow-auto rounded-xl outline-none focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <DiffBlock\n patch={(diff() as Extract<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />\n </div>\n )}\n </Show>","props.details.kind === 'diff' && props.details","<CodeBlock\n size=\"sm\"\n code={(props.details as Extract<ConfirmationDetails, { kind: 'code' }>).code}\n language={bounded(\n (props.details as Extract<ConfirmationDetails, { kind: 'code' }>).language,\n 24\n )}\n title={bounded(props.details.title, 80)}\n complete\n wrap\n maxHeight=\"14rem\"\n />","maxHeight=\"14rem\"","<DiffBlock\n patch={(diff() as Extract<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />","LucideBan","LucideCheck","LucideClock","LucideLock","LucideShieldQuestion","_$spread","_$ref","_$insert","_$setAttribute"],"sources":["../../../../src/components/composites/confirmation/confirmation.tsx"],"sourcesContent":["import {\n Ban as LucideBan,\n Check as LucideCheck,\n Clock as LucideClock,\n Lock as LucideLock,\n ShieldQuestion as LucideShieldQuestion,\n} from '@lucide/solid'\nimport { createEffect, createMemo, createSignal, createUniqueId, Show, omit } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { CodeBlock } from '../../ui/code-block'\nimport { DiffBlock } from '../../ui/diff-block'\nimport { Spinner } from '../../ui/spinner'\nimport { REASON_TEXT_LIMIT, boundText } from '#lib/text'\nimport {\n confirmationOutcome,\n decisionReason,\n isAwaitingAnswer,\n settleDecision,\n type ConfirmationState,\n} from './confirmation-model'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Ban = fastIcon(LucideBan)\nconst Check = fastIcon(LucideCheck)\nconst Clock = fastIcon(LucideClock)\nconst Lock = fastIcon(LucideLock)\nconst ShieldQuestion = fastIcon(LucideShieldQuestion)\n\n/**\n * Confirmation.\n *\n * The agent has stopped a tool and will not continue until the person approves or\n * denies it. Like `Questionnaire`, this is one of the two elements in a transcript\n * the reader *must* act on, so it is allowed a card surface — and the border is\n * the focus ring's colour only while it is waiting. Once answered it drops to a\n * hairline and a one-line record, because a settled decision should read as\n * history, not as something still asking.\n *\n * ## It shows what is being approved, and nothing else\n *\n * `title` and `description` say what the tool wants to do; `details` is the\n * evidence, rendered as `CodeBlock size=\"sm\"` (a command, a request) or\n * `DiffBlock` (a patch). Details are text: never interpreted, and a long one\n * scrolls inside its block. Approve and Deny exist only while the request is\n * open; afterwards they are replaced by the outcome, with *who* and *when* only if\n * the host supplied them.\n *\n * ## The host owns authority\n *\n * Whether this client may answer is not decided here. No handler, or a host\n * `disabledReason`, or the `unavailable` state, leaves the buttons visible and\n * disabled with the reason beside them in words — never hidden, because a reader\n * who cannot see the choice cannot tell whether the agent is waiting on them.\n *\n * ## Answering is a round trip\n *\n * `onApprove` / `onDeny` may return a promise. While one is pending both buttons\n * refuse input (a synchronous guard as well as the signal, so a double click in\n * one tick cannot submit twice) and the pressed one shows a spinner. A failure\n * shows `error` (or the rejection's own message) and re-enables the buttons. The\n * buttons use `aria-disabled` rather than `disabled`: a native disabled button\n * drops focus, and the reader's place would be lost mid-decision. When the state\n * settles, focus moves to the outcome line if it was in the card, so a keyboard\n * user is not stranded on a control that no longer exists.\n */\nexport type ConfirmationDetails =\n | Readonly<{ kind: 'code'; code: string; language?: string; title?: string }>\n | Readonly<{ kind: 'diff'; patch: string; title?: string }>\n\nexport type ConfirmationProps = Omit<ComponentProps<'section'>, 'title' | 'onError'> & {\n state?: ConfirmationState\n /** What the tool wants to do, as a short sentence. */\n title: string\n description?: string\n details?: ConfirmationDetails\n onApprove?: () => void | Promise<void>\n onDeny?: () => void | Promise<void>\n approveLabel?: string\n denyLabel?: string\n /** Why the choice cannot be made right now; shown in words beside the buttons. */\n disabledReason?: string\n /** A failed answer, in words. Overrides the rejection's own message. */\n error?: string\n /** Who answered, once settled. Omit if unknown; nothing is assumed. */\n resolvedBy?: string\n /** When it was answered, already formatted for the reader. Omit if unknown. */\n resolvedAt?: string\n /** Extra content between the details and the buttons. */\n children?: JSX.Element\n}\n\ntype Choice = 'approve' | 'deny'\n\nexport function Confirmation(props: ConfirmationProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'state',\n 'title',\n 'description',\n 'details',\n 'onApprove',\n 'onDeny',\n 'approveLabel',\n 'denyLabel',\n 'disabledReason',\n 'error',\n 'resolvedBy',\n 'resolvedAt',\n 'children'\n )\n const uid = createUniqueId()\n const titleId = `${uid}-title`\n const reasonId = `${uid}-reason`\n const state = (): ConfirmationState => local.state ?? 'requested'\n const awaiting = () => isAwaitingAnswer(state())\n const [pending, setPending] = createSignal<Choice | undefined>(undefined)\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n let inflight = false\n let root: HTMLElement | undefined\n let outcome: HTMLParagraphElement | undefined\n\n const reasonFor = (handler: (() => void | Promise<void>) | undefined, missing: string) => {\n if (pending() !== undefined) return 'Your answer is being sent.'\n return decisionReason({\n state: state(),\n disabledReason: local.disabledReason,\n hasHandler: handler !== undefined,\n unavailableFallback: 'This request cannot be answered right now.',\n missingFallback: missing,\n })\n }\n const approveReason = () => reasonFor(local.onApprove, 'Approving is not available here.')\n const denyReason = () => reasonFor(local.onDeny, 'Denying is not available here.')\n // One sentence per distinct reason, so two identical reasons are not read twice.\n const reasons = () => [...new Set([approveReason(), denyReason()].filter(Boolean))].join(' ')\n const error = () => (local.error ? boundText(local.error, REASON_TEXT_LIMIT) : failure())\n\n const choose = async (choice: Choice) => {\n const handler = choice === 'approve' ? local.onApprove : local.onDeny\n const blocked = choice === 'approve' ? approveReason() : denyReason()\n if (inflight || blocked || !awaiting()) return\n inflight = true\n setPending(choice)\n setFailure(undefined)\n const result = await settleDecision(handler)\n inflight = false\n setPending(undefined)\n if (!result.ok) setFailure(result.message)\n }\n\n // The buttons are replaced by the outcome line; keep a keyboard reader in the card.\n // A memo, so the effect re-runs only when the answer state flips; the apply phase\n // gets the previous value, undefined on the first run.\n const isAwaiting = createMemo(awaiting)\n createEffect(isAwaiting, (now, was) => {\n if (was && !now) {\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n outcome?.focus()\n }\n }\n })\n\n const buttonProps = (choice: Choice) => {\n const blocked = () => (choice === 'approve' ? approveReason() : denyReason())\n const disabled = () => pending() !== undefined || blocked() !== undefined\n // Getters, so the spread keeps both attributes following the state.\n return {\n get 'aria-disabled'() {\n return disabled() ? ('true' as const) : undefined\n },\n get 'aria-describedby'() {\n return blocked() ? reasonId : undefined\n },\n onClick: () => void choose(choice),\n }\n }\n\n return (\n <section\n ref={(element) => (root = element)}\n data-slot=\"confirmation\"\n data-state={state()}\n aria-labelledby={titleId}\n class={cn(\n 'flex w-full max-w-xl min-w-0 flex-col gap-3 rounded-xl border bg-card p-4',\n {\n 'border-ring': awaiting(),\n 'border-border': !awaiting(),\n },\n local.class\n )}\n {...rest}\n >\n <header class=\"flex items-start gap-2.5\">\n <span aria-hidden=\"true\" class=\"mt-0.5 text-muted-foreground [&_svg]:size-4\">\n <Show when={state() === 'approved'}>\n <Check class=\"text-success\" />\n </Show>\n <Show when={state() === 'denied'}>\n <Ban />\n </Show>\n <Show when={state() === 'expired'}>\n <Clock />\n </Show>\n <Show when={state() === 'unavailable'}>\n <Lock />\n </Show>\n <Show when={state() === 'requested'}>\n <ShieldQuestion />\n </Show>\n </span>\n <div class=\"min-w-0 flex-1\">\n <h3 id={titleId} class=\"m-0 text-sm font-semibold [overflow-wrap:anywhere]\">\n {boundText(local.title, 200)}\n </h3>\n <Show when={local.description}>\n <p class=\"m-0 mt-0.5 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {boundText(local.description ?? '', 400)}\n </p>\n </Show>\n </div>\n <Show when={awaiting()}>\n <span class=\"shrink-0 text-xs text-muted-foreground\">\n {state() === 'requested' ? 'Needs your answer' : 'Cannot be answered now'}\n </span>\n </Show>\n </header>\n\n <Show when={local.details}>{(details) => <Details details={details()} />}</Show>\n\n {local.children}\n\n <Show\n when={awaiting()}\n fallback={\n <p\n ref={(element) => (outcome = element)}\n tabindex=\"-1\"\n role=\"status\"\n class=\"m-0 flex items-center gap-1.5 text-xs text-muted-foreground outline-none\"\n >\n {confirmationOutcome(state(), local.resolvedBy, local.resolvedAt)}\n </p>\n }\n >\n <Show when={reasons()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>\n </Show>\n <Show when={error()}>\n <p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>\n </Show>\n <footer class=\"flex flex-wrap items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>\n <Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>\n {/* Present from the start: a live region inserted with its text is not reliably announced. */}\n <span role=\"status\" class=\"visually-hidden\">\n {pending() !== undefined ? 'Sending your answer' : ''}\n </span>\n </footer>\n </Show>\n </section>\n )\n}\n\n/** A name from the host or the model, cleaned and clipped before it reaches a header. */\nfunction bounded(value: string | undefined, limit: number): string | undefined {\n return value ? boundText(value, limit) || undefined : undefined\n}\n\nfunction Details(props: { details: ConfirmationDetails }) {\n return (\n <Show\n when={props.details.kind === 'diff' && props.details}\n fallback={\n <CodeBlock\n size=\"sm\"\n code={(props.details as Extract<ConfirmationDetails, { kind: 'code' }>).code}\n language={bounded(\n (props.details as Extract<ConfirmationDetails, { kind: 'code' }>).language,\n 24\n )}\n title={bounded(props.details.title, 80)}\n complete\n wrap\n maxHeight=\"14rem\"\n />\n }\n >\n {(diff) => (\n // The diff block has no height cap of its own, so the cap lives here; a\n // scroller must be focusable, hence the labelled region and tab stop.\n <div\n role=\"region\"\n aria-label=\"Proposed changes\"\n tabindex=\"0\"\n class=\"max-h-64 overflow-auto rounded-xl outline-none focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <DiffBlock\n patch={(diff() as Extract<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />\n </div>\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyBA,IAAM,MAAM,SAASiC,KAAS;AAC9B,IAAM,QAAQ,SAASC,OAAW;AAClC,IAAM,QAAQ,SAASC,OAAW;AAClC,IAAM,OAAO,SAASC,MAAU;AAChC,IAAM,iBAAiB,SAASC,gBAAoB;AAmEpD,SAAgB,aAAa,OAA0B;CACrD,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,SACA,SACA,eACA,WACA,aACA,UACA,gBACA,aACA,kBACA,SACA,cACA,cACA,UACF;CACA,MAAM,MAAM,e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C;IACD,IAAA,QAAA;KAAO,OAAA,QAAQ,MAAM,QAAQ,OAAO,EAAE;IAAC;IACvC,UAAA;IACA,MAAA;IACAa,WAAU;GACX,CAAA;EACH;EAfFH,WAiBI,gBAGA;GAWK,IAAA,SAAA,QAAA;GAXLY,OAAA,QAMER,gBAAAA,WAAAA;IACE,IAAA,QAAA;KAAQ,OAAA,KAAK,CAAA,CAAqD;IAAK;IACvE,IAAA,QAAA;KAAO,OAAA,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE;IAAC;IAChC,UAAA;GACD,CAAA,CACE;GAXL,OAAA;EAWK,EAAA,CAAA;CAEH,CAAA;AAEV"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { className, createComponent, effect, insert, memo, readShallow, setAttribute, template } from "@solidjs/web";
|
|
2
|
+
import { OctagonAlert as OctagonAlert$1, TriangleAlert as TriangleAlert$1 } from "@lucide/solid";
|
|
3
|
+
import { For, Show, omit } from "solid-js";
|
|
1
4
|
import { cn } from "../../../lib/utils.js";
|
|
2
5
|
import { slotted } from "../../../lib/slotted.js";
|
|
3
6
|
import { Button } from "../../ui/button/button.js";
|
|
@@ -5,9 +8,6 @@ import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "../../ui/
|
|
|
5
8
|
import { Progress } from "../../ui/progress/progress.js";
|
|
6
9
|
import { breakdownRows, contextLabel, contextLevel, contextLevelWord, contextPercent, contextShort, formatCost, formatExact, hasContextFigures, isFigure } from "./context-model.js";
|
|
7
10
|
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
8
|
-
import { className, createComponent, effect, insert, memo, readShallow, setAttribute, template } from "@solidjs/web";
|
|
9
|
-
import { OctagonAlert, TriangleAlert } from "@lucide/solid";
|
|
10
|
-
import { For, Show, omit } from "solid-js";
|
|
11
11
|
// src/components/composites/context/context.tsx
|
|
12
12
|
var _tmpl$ = /* @__PURE__ */ template(`<span aria-hidden=true>`);
|
|
13
13
|
var _tmpl$2 = /* @__PURE__ */ template(`<span aria-hidden=true class=tabular-nums>`);
|
|
@@ -15,8 +15,8 @@ var _tmpl$3 = /* @__PURE__ */ template(`<div class="flex flex-col gap-2 px-2 pb-
|
|
|
15
15
|
var _tmpl$4 = /* @__PURE__ */ template(`<p><span class=text-foreground>`);
|
|
16
16
|
var _tmpl$5 = /* @__PURE__ */ template(`<svg aria-hidden=true viewBox="0 0 16 16"fill=none class=size-4><circle cx=8 cy=8 r=6 stroke-width=2 class=stroke-border></circle><circle cx=8 cy=8 r=6 stroke-width=2 stroke-linecap=round transform="rotate(-90 8 8)"class=stroke-primary>`);
|
|
17
17
|
var _tmpl$6 = /* @__PURE__ */ template(`<div class="flex items-baseline justify-between gap-4"><dt class=text-muted-foreground></dt><dd class="m-0 text-end tabular-nums">`);
|
|
18
|
-
var OctagonAlert
|
|
19
|
-
var TriangleAlert
|
|
18
|
+
var OctagonAlert = fastIcon(OctagonAlert$1);
|
|
19
|
+
var TriangleAlert = fastIcon(TriangleAlert$1);
|
|
20
20
|
var ContextTriggerButton = slotted(Button, "context");
|
|
21
21
|
var RING_CIRCUMFERENCE = 2 * Math.PI * 6;
|
|
22
22
|
function Context(props) {
|
|
@@ -76,7 +76,7 @@ function Context(props) {
|
|
|
76
76
|
return level() === "high";
|
|
77
77
|
});
|
|
78
78
|
return () => {
|
|
79
|
-
return _c$() ? createComponent(TriangleAlert
|
|
79
|
+
return _c$() ? createComponent(TriangleAlert, {}) : createComponent(OctagonAlert, {});
|
|
80
80
|
};
|
|
81
81
|
})());
|
|
82
82
|
effect(() => readShallow(cn({
|
|
@@ -136,7 +136,7 @@ function Context(props) {
|
|
|
136
136
|
return level() === "high";
|
|
137
137
|
});
|
|
138
138
|
return () => {
|
|
139
|
-
return _c$7() ? createComponent(TriangleAlert
|
|
139
|
+
return _c$7() ? createComponent(TriangleAlert, { class: "size-4" }) : createComponent(OctagonAlert, { class: "size-4" });
|
|
140
140
|
};
|
|
141
141
|
})(), _el$12);
|
|
142
142
|
insert(_el$12, levelWord);
|