@adea-ai/ui 0.152.3 → 0.153.0
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/README.md +469 -580
- package/dist/components/composites/account-menu/account-menu.d.ts +5 -0
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +37 -13
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.d.ts +2 -1
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +92 -66
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +57 -57
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +9 -9
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.d.ts +7 -7
- package/dist/components/composites/appearance-editor/theme-preview.d.ts +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.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +6 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +36 -36
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +4 -4
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.d.ts.map +1 -1
- package/dist/components/composites/chat/chat.js +33 -37
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts +3 -3
- package/dist/components/composites/checkpoint/checkpoint-model.js +2 -2
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.d.ts +2 -2
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.d.ts +2 -2
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.d.ts +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.d.ts.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +7 -3
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -3
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/citation.d.ts +1 -1
- package/dist/components/composites/inline-citation/citation.js +1 -1
- package/dist/components/composites/inline-citation/citation.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts +2 -2
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +22 -22
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.d.ts +5 -0
- package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row.js +75 -83
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.d.ts +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts +4 -4
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/model-selector/models.d.ts +2 -2
- package/dist/components/composites/model-selector/models.js +1 -1
- package/dist/components/composites/model-selector/models.js.map +1 -1
- package/dist/components/composites/plan/plan.d.ts.map +1 -1
- package/dist/components/composites/plan/plan.js +17 -15
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.d.ts.map +1 -1
- package/dist/components/composites/queue/queue.js +5 -7
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.d.ts +4 -4
- package/dist/components/composites/reasoning/reasoning.js +4 -4
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +63 -14
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +32 -32
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/source.d.ts +1 -1
- package/dist/components/composites/sources/source.js.map +1 -1
- package/dist/components/composites/sources/sources.d.ts +2 -2
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/parse-stack-trace.js +4 -4
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.d.ts.map +1 -1
- package/dist/components/composites/stat/stat.js +14 -16
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
- package/dist/components/composites/subagent/subagent.js +6 -4
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/task/task.d.ts +1 -1
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.d.ts +3 -3
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal-model.d.ts +3 -3
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal-model.js +1 -1
- package/dist/components/composites/terminal/terminal-model.js.map +1 -1
- package/dist/components/composites/terminal/terminal.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal.js +24 -11
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results-model.d.ts +4 -4
- package/dist/components/composites/test-results/test-results-model.js +2 -2
- package/dist/components/composites/test-results/test-results-model.js.map +1 -1
- package/dist/components/composites/test-results/test-results.d.ts +1 -1
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.d.ts +4 -4
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.d.ts +1 -1
- package/dist/components/composites/tree/tree.d.ts.map +1 -1
- package/dist/components/composites/tree/tree.js +25 -18
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.d.ts +10 -4
- package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +14 -19
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/index.d.ts +1 -1
- package/dist/components/composites/update-dialog/index.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +4 -5
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.d.ts.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +19 -20
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
- package/dist/components/conversation/busy-send-button.js +18 -20
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/composer-menu.d.ts +3 -3
- package/dist/components/conversation/composer-menu.js +3 -3
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +2 -4
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
- package/dist/components/conversation/conversation-pane.js +6 -5
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +3 -7
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +76 -76
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +32 -38
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.d.ts.map +1 -1
- package/dist/components/conversation/message-row.js +79 -73
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +7 -7
- package/dist/components/conversation/scroll-follow-core.js +4 -4
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +19 -4
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/conversation/thread-panel.d.ts.map +1 -1
- package/dist/components/conversation/thread-panel.js +23 -23
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.d.ts.map +1 -1
- package/dist/components/conversation/transcript-composition.js +2 -2
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.d.ts +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.d.ts.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +4 -6
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/page/page.d.ts.map +1 -1
- package/dist/components/layout/page/page.js +17 -17
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +2 -4
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.d.ts.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +16 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts +1 -1
- package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +35 -34
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +23 -23
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +2 -2
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.d.ts +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.d.ts.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +7 -7
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/motion/presence.d.ts +2 -2
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts +5 -5
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.d.ts +1 -1
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/theme-catalogue-source.d.ts +2 -2
- package/dist/components/theme/theme-catalogue-source.js +2 -2
- package/dist/components/theme/theme-catalogue-source.js.map +1 -1
- package/dist/components/theme/theme-context.d.ts +2 -2
- package/dist/components/theme/theme-context.js +3 -3
- package/dist/components/theme/theme-context.js.map +1 -1
- package/dist/components/theme/theme-document.d.ts.map +1 -1
- package/dist/components/theme/theme-document.js +14 -9
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-picker.d.ts +5 -5
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.d.ts +0 -6
- package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
- package/dist/components/theme/theme-provider-value.js +9 -3
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-script.d.ts +14 -0
- package/dist/components/theme/theme-script.d.ts.map +1 -1
- package/dist/components/theme/theme-script.js +1 -0
- package/dist/components/theme/theme-script.js.map +1 -1
- package/dist/components/theme/theme-state.d.ts +7 -7
- package/dist/components/theme/theme-state.js.map +1 -1
- package/dist/components/theme/theme-toggle.d.ts +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/alert/alert.d.ts.map +1 -1
- package/dist/components/ui/alert/alert.js +4 -3
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +3 -3
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/badge/badge.d.ts +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.d.ts.map +1 -1
- package/dist/components/ui/board/board.js +10 -6
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/bubble/bubble.d.ts.map +1 -1
- package/dist/components/ui/bubble/bubble.js +6 -4
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/button-group/button-group.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.js +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +6 -6
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.d.ts +4 -4
- package/dist/components/ui/callout/callout.js +4 -4
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.d.ts +2 -2
- 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.d.ts +4 -4
- package/dist/components/ui/carousel/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart-options.d.ts +7 -7
- package/dist/components/ui/chart/chart-options.js +9 -9
- package/dist/components/ui/chart/chart-options.js.map +1 -1
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js +16 -7
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +8 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +8 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/command/command.d.ts +4 -4
- package/dist/components/ui/command/command.js +4 -4
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.js +13 -13
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.d.ts +0 -4
- package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +17 -1
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +4 -3
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.d.ts +6 -6
- package/dist/components/ui/diff-block/diff-block.js +3 -3
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts +3 -3
- package/dist/components/ui/drawer/drawer.js +2 -2
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +5 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -1
- package/dist/components/ui/empty/empty-state.js +33 -36
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.d.ts +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.d.ts.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +7 -7
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +15 -15
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.d.ts +1 -1
- package/dist/components/ui/field/number-field.js +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.d.ts +1 -1
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input-group/input-group.d.ts +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.d.ts +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.d.ts.map +1 -1
- package/dist/components/ui/item/item.js +26 -26
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.d.ts +2 -2
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/kbd/platform-modifier.d.ts +3 -3
- package/dist/components/ui/kbd/platform-modifier.js +3 -3
- package/dist/components/ui/kbd/platform-modifier.js.map +1 -1
- package/dist/components/ui/label/label.d.ts +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.d.ts.map +1 -1
- package/dist/components/ui/marker/marker.js +17 -19
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts +2 -2
- package/dist/components/ui/menubar/menubar.js +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js +16 -18
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +7 -11
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.d.ts +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +5 -4
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +2 -4
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.d.ts.map +1 -1
- package/dist/components/ui/popover/popover.js +11 -4
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/progress/progress.js +6 -8
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +73 -73
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +12 -6
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts +2 -2
- package/dist/components/ui/resizable/resizable.js +3 -3
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/select/select.d.ts +3 -3
- package/dist/components/ui/select/select.js +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +4 -3
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.d.ts +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.d.ts +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.d.ts +1 -1
- package/dist/components/ui/spinner/spinner.js +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.d.ts +13 -13
- package/dist/components/ui/status-chip/status-chip.d.ts.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +11 -11
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +8 -6
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.d.ts +4 -4
- package/dist/components/ui/tabs/tabs.js +4 -4
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/textarea/textarea.d.ts +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.d.ts.map +1 -1
- package/dist/components/ui/toast/toast.js +13 -15
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.js +1 -1
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts +51 -0
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js +103 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +1 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -1
- package/dist/components/ui/tooltip/index.js +3 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +6 -5
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.d.ts.map +1 -1
- package/dist/components/ui/trace/trace.js +17 -17
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.d.ts +3 -3
- package/dist/components/ui/typography/typography.js +5 -5
- package/dist/components/ui/typography/typography.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/lib/accent-presets.d.ts +1 -1
- package/dist/lib/accent-presets.js.map +1 -1
- package/dist/lib/accent-roles.d.ts +2 -2
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/accent-roles.js.map +1 -1
- package/dist/lib/appearance-font-settings.d.ts.map +1 -1
- package/dist/lib/appearance-font-settings.js +15 -7
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/create-poll.d.ts +39 -0
- package/dist/lib/create-poll.d.ts.map +1 -0
- package/dist/lib/create-poll.js +116 -0
- package/dist/lib/create-poll.js.map +1 -0
- package/dist/lib/font-zoom.d.ts +1 -1
- package/dist/lib/font-zoom.js +1 -1
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/keyed-rows.d.ts +2 -1
- package/dist/lib/keyed-rows.d.ts.map +1 -1
- package/dist/lib/keyed-rows.js +3 -2
- package/dist/lib/keyed-rows.js.map +1 -1
- package/dist/lib/overlay.d.ts +5 -5
- package/dist/lib/overlay.js +5 -5
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/preference-store.d.ts +2 -2
- package/dist/lib/preference-store.js +2 -2
- package/dist/lib/preference-store.js.map +1 -1
- package/dist/lib/safe-script.d.ts +2 -2
- package/dist/lib/safe-script.js +2 -2
- package/dist/lib/safe-script.js.map +1 -1
- package/dist/lib/scroll-geometry.d.ts +1 -1
- package/dist/lib/scroll-geometry.js +1 -1
- package/dist/lib/scroll-geometry.js.map +1 -1
- package/dist/lib/text.d.ts +1 -1
- package/dist/lib/text.js +1 -1
- package/dist/lib/text.js.map +1 -1
- package/dist/lib/theme-accents.js +3 -3
- package/dist/lib/theme-accents.js.map +1 -1
- package/dist/lib/theme-css.js.map +1 -1
- package/dist/lib/theme-defaults.d.ts +4 -4
- package/dist/lib/theme-defaults.js +4 -4
- package/dist/lib/theme-defaults.js.map +1 -1
- package/dist/lib/theme-engine-light.js.map +1 -1
- package/dist/lib/theme-engine.d.ts +2 -2
- package/dist/lib/theme-engine.js +2 -2
- package/dist/lib/theme-engine.js.map +1 -1
- package/dist/lib/theme-projection.d.ts +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-projection.js.map +1 -1
- package/dist/lib/theme-records.d.ts +2 -2
- package/dist/lib/theme-records.js +2 -2
- package/dist/lib/theme-records.js.map +1 -1
- package/dist/lib/theme-types.d.ts +1 -1
- package/dist/lib/theme-types.js.map +1 -1
- package/dist/lib/themes.d.ts +13 -13
- package/dist/lib/themes.js +13 -13
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts +2 -2
- package/dist/lib/tokens.js +1 -1
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.d.ts +2 -2
- package/dist/lib/tooltip-focus-gate.js +2 -2
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/variants.d.ts +4 -4
- package/dist/lib/variants.js +1 -1
- package/dist/lib/variants.js.map +1 -1
- package/dist/lib/version-notes.d.ts +4 -4
- package/dist/lib/version-notes.js +4 -4
- package/dist/lib/version-notes.js.map +1 -1
- package/dist/lint.js.map +1 -1
- package/dist/r/account-menu.json +1 -0
- package/dist/r/lib.json +5 -0
- package/dist/r/registry.json +11 -0
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/dist/r/src/components/composites/action-button/action-button.tsx +124 -78
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/dist/r/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/dist/r/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/dist/r/src/components/composites/chat/chat.tsx +15 -9
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/dist/r/src/components/composites/context/context.tsx +2 -2
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/dist/r/src/components/composites/inline-citation/citation.ts +1 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/dist/r/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/dist/r/src/components/composites/list-row/list-row.tsx +69 -73
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -4
- package/dist/r/src/components/composites/model-selector/models.ts +2 -2
- package/dist/r/src/components/composites/plan/plan.tsx +19 -11
- package/dist/r/src/components/composites/queue/queue.tsx +5 -3
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/dist/r/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/dist/r/src/components/composites/settings/settings.tsx +14 -6
- package/dist/r/src/components/composites/sources/source.ts +1 -1
- package/dist/r/src/components/composites/sources/sources.tsx +2 -2
- package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/dist/r/src/components/composites/stat/stat.tsx +20 -16
- package/dist/r/src/components/composites/subagent/subagent.tsx +6 -4
- package/dist/r/src/components/composites/task/task.tsx +1 -1
- package/dist/r/src/components/composites/terminal/ansi.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal-model.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal.tsx +24 -12
- package/dist/r/src/components/composites/test-results/test-results-model.ts +4 -4
- package/dist/r/src/components/composites/test-results/test-results.tsx +1 -1
- package/dist/r/src/components/composites/tool/tool.tsx +4 -4
- package/dist/r/src/components/composites/tree/tree.tsx +31 -15
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/dist/r/src/components/composites/update-dialog/index.ts +1 -0
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/dist/r/src/components/conversation/busy-send-button.tsx +6 -2
- package/dist/r/src/components/conversation/composer-menu.tsx +3 -3
- package/dist/r/src/components/conversation/conversation-avatar.tsx +1 -1
- package/dist/r/src/components/conversation/conversation-pane.tsx +8 -5
- package/dist/r/src/components/conversation/conversation-surface.tsx +2 -2
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/dist/r/src/components/conversation/message-composer.tsx +4 -6
- package/dist/r/src/components/conversation/message-row.tsx +34 -26
- package/dist/r/src/components/conversation/scroll-follow-core.ts +8 -8
- package/dist/r/src/components/conversation/scroll-follow.ts +24 -8
- package/dist/r/src/components/conversation/thread-panel.tsx +7 -3
- package/dist/r/src/components/conversation/transcript-composition.tsx +4 -2
- package/dist/r/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/dist/r/src/components/layout/page/page.tsx +15 -11
- package/dist/r/src/components/layout/panel/panel.tsx +1 -1
- package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +38 -22
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/dist/r/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +8 -6
- package/dist/r/src/components/motion/presence.tsx +2 -2
- package/dist/r/src/components/theme/appearance-panel.tsx +5 -5
- package/dist/r/src/components/theme/lazy.ts +1 -1
- package/dist/r/src/components/theme/theme-catalogue-source.ts +2 -2
- package/dist/r/src/components/theme/theme-context.ts +3 -3
- package/dist/r/src/components/theme/theme-document.ts +22 -11
- package/dist/r/src/components/theme/theme-picker.tsx +5 -5
- package/dist/r/src/components/theme/theme-provider-value.ts +15 -3
- package/dist/r/src/components/theme/theme-script.ts +20 -0
- package/dist/r/src/components/theme/theme-state.ts +7 -7
- package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
- package/dist/r/src/components/ui/alert/alert.tsx +4 -3
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/dist/r/src/components/ui/badge/badge.tsx +2 -2
- package/dist/r/src/components/ui/board/board.tsx +17 -5
- package/dist/r/src/components/ui/bubble/bubble.tsx +6 -4
- package/dist/r/src/components/ui/button/button.tsx +2 -2
- package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
- package/dist/r/src/components/ui/calendar/calendar.tsx +2 -2
- package/dist/r/src/components/ui/callout/callout.tsx +4 -4
- package/dist/r/src/components/ui/card/card.tsx +2 -2
- package/dist/r/src/components/ui/carousel/carousel.tsx +6 -6
- package/dist/r/src/components/ui/chart/chart-options.ts +9 -9
- package/dist/r/src/components/ui/chart/chart.tsx +14 -1
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/dist/r/src/components/ui/code-block/code-block.tsx +14 -7
- package/dist/r/src/components/ui/command/command.tsx +7 -7
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/dist/r/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/dist/r/src/components/ui/dialog/dialog-layer.tsx +27 -1
- package/dist/r/src/components/ui/dialog/dialog.tsx +4 -3
- package/dist/r/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/dist/r/src/components/ui/drawer/drawer.tsx +3 -3
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/dist/r/src/components/ui/empty/empty-state.tsx +23 -18
- package/dist/r/src/components/ui/empty/empty.tsx +1 -1
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/dist/r/src/components/ui/field/field.tsx +15 -7
- package/dist/r/src/components/ui/field/number-field.tsx +1 -1
- package/dist/r/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/dist/r/src/components/ui/input-group/input-group.tsx +1 -1
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/dist/r/src/components/ui/item/item.tsx +24 -18
- package/dist/r/src/components/ui/kbd/kbd.tsx +2 -2
- package/dist/r/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/dist/r/src/components/ui/label/label.tsx +1 -1
- package/dist/r/src/components/ui/marker/marker.tsx +9 -5
- package/dist/r/src/components/ui/menubar/menubar.tsx +2 -2
- package/dist/r/src/components/ui/message/message.tsx +14 -13
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/dist/r/src/components/ui/native-select/native-select.tsx +1 -1
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/dist/r/src/components/ui/pagination/pagination.tsx +1 -1
- package/dist/r/src/components/ui/popover/popover.tsx +4 -2
- package/dist/r/src/components/ui/progress/progress.tsx +5 -3
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/dist/r/src/components/ui/resizable/resizable.tsx +5 -5
- package/dist/r/src/components/ui/select/select.tsx +4 -4
- package/dist/r/src/components/ui/sheet/sheet.tsx +4 -3
- package/dist/r/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/dist/r/src/components/ui/slider/slider.tsx +1 -1
- package/dist/r/src/components/ui/spinner/spinner.tsx +1 -1
- package/dist/r/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/dist/r/src/components/ui/switch/switch.tsx +9 -6
- package/dist/r/src/components/ui/tabs/tabs.tsx +4 -4
- package/dist/r/src/components/ui/textarea/textarea.tsx +1 -1
- package/dist/r/src/components/ui/toast/toast.tsx +6 -4
- package/dist/r/src/components/ui/toggle/toggle.tsx +1 -1
- package/dist/r/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/dist/r/src/components/ui/tooltip/index.ts +1 -0
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/dist/r/src/components/ui/trace/trace.tsx +13 -9
- package/dist/r/src/components/ui/typography/typography.tsx +5 -5
- package/dist/r/src/lib/accent-presets.ts +1 -1
- package/dist/r/src/lib/accent-roles.ts +2 -2
- package/dist/r/src/lib/appearance-font-settings.ts +18 -7
- package/dist/r/src/lib/create-poll.ts +150 -0
- package/dist/r/src/lib/font-zoom.ts +3 -3
- package/dist/r/src/lib/keyed-rows.ts +3 -2
- package/dist/r/src/lib/overlay.ts +5 -5
- package/dist/r/src/lib/preference-store.ts +2 -2
- package/dist/r/src/lib/safe-script.ts +2 -2
- package/dist/r/src/lib/scroll-geometry.ts +1 -1
- package/dist/r/src/lib/text.ts +1 -1
- package/dist/r/src/lib/theme-accents.ts +3 -3
- package/dist/r/src/lib/theme-css.ts +2 -2
- package/dist/r/src/lib/theme-defaults.ts +4 -4
- package/dist/r/src/lib/theme-engine-light.ts +2 -2
- package/dist/r/src/lib/theme-engine.ts +2 -2
- package/dist/r/src/lib/theme-projection.ts +2 -2
- package/dist/r/src/lib/theme-records.ts +2 -2
- package/dist/r/src/lib/theme-types.ts +1 -1
- package/dist/r/src/lib/themes.ts +14 -14
- package/dist/r/src/lib/tokens.ts +2 -2
- package/dist/r/src/lib/tooltip-focus-gate.ts +11 -11
- package/dist/r/src/lib/utils.ts +1 -1
- package/dist/r/src/lib/variants.ts +4 -4
- package/dist/r/src/lib/version-notes.ts +4 -4
- package/dist/r/src/styles/base.css +12 -43
- package/dist/r/src/styles/fonts.css +1 -1
- package/dist/r/src/styles/theme.css +35 -35
- package/dist/r/tooltip.json +5 -0
- package/package.json +2 -1
- package/registry.json +11 -0
- package/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/src/components/composites/action-button/action-button.tsx +124 -78
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/src/components/composites/chat/chat.tsx +15 -9
- package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/src/components/composites/context/context.tsx +2 -2
- package/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/src/components/composites/inline-citation/citation.ts +1 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/src/components/composites/list-row/list-row.tsx +69 -73
- package/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/src/components/composites/model-selector/model-selector.tsx +4 -4
- package/src/components/composites/model-selector/models.ts +2 -2
- package/src/components/composites/plan/plan.tsx +19 -11
- package/src/components/composites/queue/queue.tsx +5 -3
- package/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/src/components/composites/settings/settings.tsx +14 -6
- package/src/components/composites/sources/source.ts +1 -1
- package/src/components/composites/sources/sources.tsx +2 -2
- package/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/src/components/composites/stat/stat.tsx +20 -16
- package/src/components/composites/subagent/subagent.tsx +6 -4
- package/src/components/composites/task/task.tsx +1 -1
- package/src/components/composites/terminal/ansi.ts +3 -3
- package/src/components/composites/terminal/terminal-model.ts +3 -3
- package/src/components/composites/terminal/terminal.tsx +24 -12
- package/src/components/composites/test-results/test-results-model.ts +4 -4
- package/src/components/composites/test-results/test-results.tsx +1 -1
- package/src/components/composites/tool/tool.tsx +4 -4
- package/src/components/composites/tree/tree.tsx +31 -15
- package/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/src/components/composites/update-dialog/index.ts +1 -0
- package/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/src/components/conversation/busy-send-button.tsx +6 -2
- package/src/components/conversation/composer-menu.tsx +3 -3
- package/src/components/conversation/conversation-avatar.tsx +1 -1
- package/src/components/conversation/conversation-pane.tsx +8 -5
- package/src/components/conversation/conversation-surface.tsx +2 -2
- package/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/src/components/conversation/message-composer.tsx +4 -6
- package/src/components/conversation/message-row.tsx +34 -26
- package/src/components/conversation/scroll-follow-core.ts +8 -8
- package/src/components/conversation/scroll-follow.ts +24 -8
- package/src/components/conversation/thread-panel.tsx +7 -3
- package/src/components/conversation/transcript-composition.tsx +4 -2
- package/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/src/components/layout/page/page.tsx +15 -11
- package/src/components/layout/panel/panel.tsx +1 -1
- package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/src/components/layout/side-rail/side-rail.tsx +38 -22
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/src/components/layout/top-bar/top-bar.tsx +8 -6
- package/src/components/motion/presence.tsx +2 -2
- package/src/components/theme/appearance-panel.tsx +5 -5
- package/src/components/theme/lazy.ts +1 -1
- package/src/components/theme/theme-catalogue-source.ts +2 -2
- package/src/components/theme/theme-context.ts +3 -3
- package/src/components/theme/theme-document.ts +22 -11
- package/src/components/theme/theme-picker.tsx +5 -5
- package/src/components/theme/theme-provider-value.ts +15 -3
- package/src/components/theme/theme-script.ts +20 -0
- package/src/components/theme/theme-state.ts +7 -7
- package/src/components/theme/theme-toggle.tsx +1 -1
- package/src/components/ui/alert/alert.tsx +4 -3
- package/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/src/components/ui/badge/badge.tsx +2 -2
- package/src/components/ui/board/board.tsx +17 -5
- package/src/components/ui/bubble/bubble.tsx +6 -4
- package/src/components/ui/button/button.tsx +2 -2
- package/src/components/ui/button-group/button-group.tsx +1 -1
- package/src/components/ui/calendar/calendar.tsx +2 -2
- package/src/components/ui/callout/callout.tsx +4 -4
- package/src/components/ui/card/card.tsx +2 -2
- package/src/components/ui/carousel/carousel.tsx +6 -6
- package/src/components/ui/chart/chart-options.ts +9 -9
- package/src/components/ui/chart/chart.tsx +14 -1
- package/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/src/components/ui/code-block/code-block.tsx +14 -7
- package/src/components/ui/command/command.tsx +7 -7
- package/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/src/components/ui/dialog/dialog-layer.tsx +27 -1
- package/src/components/ui/dialog/dialog.tsx +4 -3
- package/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/src/components/ui/drawer/drawer.tsx +3 -3
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/src/components/ui/empty/empty-state.tsx +23 -18
- package/src/components/ui/empty/empty.tsx +1 -1
- package/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/src/components/ui/field/field.tsx +15 -7
- package/src/components/ui/field/number-field.tsx +1 -1
- package/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/src/components/ui/input-group/input-group.tsx +1 -1
- package/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/src/components/ui/item/item.tsx +24 -18
- package/src/components/ui/kbd/kbd.tsx +2 -2
- package/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/src/components/ui/label/label.tsx +1 -1
- package/src/components/ui/marker/marker.tsx +9 -5
- package/src/components/ui/menubar/menubar.tsx +2 -2
- package/src/components/ui/message/message.tsx +14 -13
- package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/src/components/ui/native-select/native-select.tsx +1 -1
- package/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/src/components/ui/pagination/pagination.tsx +1 -1
- package/src/components/ui/popover/popover.tsx +4 -2
- package/src/components/ui/progress/progress.tsx +5 -3
- package/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/src/components/ui/resizable/resizable.tsx +5 -5
- package/src/components/ui/select/select.tsx +4 -4
- package/src/components/ui/sheet/sheet.tsx +4 -3
- package/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/src/components/ui/slider/slider.tsx +1 -1
- package/src/components/ui/spinner/spinner.tsx +1 -1
- package/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/src/components/ui/switch/switch.tsx +9 -6
- package/src/components/ui/tabs/tabs.tsx +4 -4
- package/src/components/ui/textarea/textarea.tsx +1 -1
- package/src/components/ui/toast/toast.tsx +6 -4
- package/src/components/ui/toggle/toggle.tsx +1 -1
- package/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/src/components/ui/tooltip/index.ts +1 -0
- package/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/src/components/ui/trace/trace.tsx +13 -9
- package/src/components/ui/typography/typography.tsx +5 -5
- package/src/index.ts +1 -0
- package/src/lib/accent-presets.ts +1 -1
- package/src/lib/accent-roles.ts +2 -2
- package/src/lib/appearance-font-settings.ts +18 -7
- package/src/lib/create-poll.ts +150 -0
- package/src/lib/font-zoom.ts +3 -3
- package/src/lib/keyed-rows.ts +3 -2
- package/src/lib/overlay.ts +5 -5
- package/src/lib/preference-store.ts +2 -2
- package/src/lib/safe-script.ts +2 -2
- package/src/lib/scroll-geometry.ts +1 -1
- package/src/lib/text.ts +1 -1
- package/src/lib/theme-accents.ts +3 -3
- package/src/lib/theme-css.ts +2 -2
- package/src/lib/theme-defaults.ts +4 -4
- package/src/lib/theme-engine-light.ts +2 -2
- package/src/lib/theme-engine.ts +2 -2
- package/src/lib/theme-projection.ts +2 -2
- package/src/lib/theme-records.ts +2 -2
- package/src/lib/theme-types.ts +1 -1
- package/src/lib/themes.ts +14 -14
- package/src/lib/tokens.ts +2 -2
- package/src/lib/tooltip-focus-gate.ts +11 -11
- package/src/lib/utils.ts +1 -1
- package/src/lib/variants.ts +4 -4
- package/src/lib/version-notes.ts +4 -4
- package/src/lint/index.ts +1 -1
- package/src/styles/base.css +12 -43
- package/src/styles/fonts.css +1 -1
- package/src/styles/theme.css +35 -35
- package/src/styles/themes/aardvark-blue.css +98 -0
- package/src/styles/themes/aardvark-ink.css +98 -0
- package/src/styles/themes/adea-dark-colorblind.css +98 -0
- package/src/styles/themes/adea-dark-high-contrast.css +98 -0
- package/src/styles/themes/adea-dark.css +47 -0
- package/src/styles/themes/adea-light-colorblind.css +141 -0
- package/src/styles/themes/adea-light-high-contrast.css +141 -0
- package/src/styles/themes/adea-light.css +47 -0
- package/src/styles/themes/ayu-light.css +141 -0
- package/src/styles/themes/ayu-mirage.css +98 -0
- package/src/styles/themes/ayu.css +98 -0
- package/src/styles/themes/catppuccin-frappe.css +98 -0
- package/src/styles/themes/catppuccin-latte.css +141 -0
- package/src/styles/themes/catppuccin-macchiato.css +98 -0
- package/src/styles/themes/catppuccin-mocha.css +98 -0
- package/src/styles/themes/dracula.css +98 -0
- package/src/styles/themes/everforest-dark.css +98 -0
- package/src/styles/themes/everforest-light.css +141 -0
- package/src/styles/themes/gruvbox-dark.css +98 -0
- package/src/styles/themes/gruvbox-light.css +141 -0
- package/src/styles/themes/kanagawa.css +98 -0
- package/src/styles/themes/monokai.css +98 -0
- package/src/styles/themes/nord-light.css +141 -0
- package/src/styles/themes/nord.css +98 -0
- package/src/styles/themes/one-dark.css +98 -0
- package/src/styles/themes/rosepine-dawn.css +141 -0
- package/src/styles/themes/rosepine-moon.css +98 -0
- package/src/styles/themes/rosepine.css +98 -0
- package/src/styles/themes/solarized-dark.css +98 -0
- package/src/styles/themes/solarized-light.css +141 -0
- package/src/styles/themes/tokyonight-day.css +141 -0
- package/src/styles/themes/tokyonight-night.css +98 -0
- package/src/styles/themes/tokyonight-storm.css +98 -0
- package/src/styles/themes/vesper.css +98 -0
|
@@ -7,7 +7,7 @@ import { type TraceLineProps, type WorkStatus } from '../../ui/trace';
|
|
|
7
7
|
* compared them", then each source and each comparison as its own line. Reach for
|
|
8
8
|
* `Reasoning` when the thinking is prose, for `Plan` when the steps are a
|
|
9
9
|
* proposal still to be carried out, and for a plain `Trace` when each line is a
|
|
10
|
-
* tool call
|
|
10
|
+
* tool call, a step here is a statement about the agent's *method*, whatever
|
|
11
11
|
* the host chooses to put in it.
|
|
12
12
|
*
|
|
13
13
|
* Nothing here knows how the steps were produced. The host passes the summary and
|
|
@@ -16,11 +16,11 @@ import { type TraceLineProps, type WorkStatus } from '../../ui/trace';
|
|
|
16
16
|
*
|
|
17
17
|
* ## Steps
|
|
18
18
|
*
|
|
19
|
-
* A `ChainOfThoughtStep` is a `TraceLine` with a three-state `status
|
|
19
|
+
* A `ChainOfThoughtStep` is a `TraceLine` with a three-state `status`, `complete`
|
|
20
20
|
* (keeps its own icon, or a tick), `active` (running mark and shimmer) and
|
|
21
21
|
* `pending` (dashed mark). Every status is also spoken. A step without a status
|
|
22
|
-
* makes no claim at all. A step's `children` are its evidence
|
|
23
|
-
* badges, a snippet
|
|
22
|
+
* makes no claim at all. A step's `children` are its evidence, search-result
|
|
23
|
+
* badges, a snippet, and are open by default: someone who unfolded the summary
|
|
24
24
|
* to see the working wants to see what the working found, and one more click per
|
|
25
25
|
* step to read it defeats the point of the summary.
|
|
26
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-of-thought.js","names":["ListOrdered","children","resolveChildren","splitProps","cn","Badge","Trace","TraceLine","WORK_STATUS_LABELS","WORK_TRACE_STATUS","CHAIN_OF_THOUGHT_STATUS_LABELS","complete","active","pending","summary","stepsLabel","ChainOfThought","props","local","rest","steps","hasSteps","toArray","length","stepList","_$createComponent","size","_$mergeProps","icon","title","undefined","label","status","ChainOfThoughtStep","_$memo","statusLabel","defaultOpen","ChainOfThoughtResults","_el$","_tmpl$","_$spread","class","_$insert","ChainOfThoughtResult","_el$2","_tmpl$3","variant","_el$3","_tmpl$2"],"sources":["../../../../src/components/composites/chain-of-thought/chain-of-thought.tsx"],"sourcesContent":["import { ListOrdered } from 'lucide-solid'\nimport { children as resolveChildren, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Badge } from '../../ui/badge'\nimport {\n Trace,\n TraceLine,\n WORK_STATUS_LABELS,\n WORK_TRACE_STATUS,\n type TraceLineProps,\n type WorkStatus,\n} from '../../ui/trace'\n\n/**\n * ChainOfThought.\n *\n * A summary line that opens onto the steps behind it: \"Searched 3 sources and\n * compared them\", then each source and each comparison as its own line. Reach for\n * `Reasoning` when the thinking is prose, for `Plan` when the steps are a\n * proposal still to be carried out, and for a plain `Trace` when each line is a\n * tool call
|
|
1
|
+
{"version":3,"file":"chain-of-thought.js","names":["ListOrdered","children","resolveChildren","splitProps","cn","Badge","Trace","TraceLine","WORK_STATUS_LABELS","WORK_TRACE_STATUS","CHAIN_OF_THOUGHT_STATUS_LABELS","complete","active","pending","summary","stepsLabel","ChainOfThought","props","local","rest","steps","hasSteps","toArray","length","stepList","_$createComponent","size","_$mergeProps","icon","title","undefined","label","status","ChainOfThoughtStep","_$memo","statusLabel","defaultOpen","ChainOfThoughtResults","_el$","_tmpl$","_$spread","class","_$insert","ChainOfThoughtResult","_el$2","_tmpl$3","variant","_el$3","_tmpl$2"],"sources":["../../../../src/components/composites/chain-of-thought/chain-of-thought.tsx"],"sourcesContent":["import { ListOrdered } from 'lucide-solid'\nimport { children as resolveChildren, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Badge } from '../../ui/badge'\nimport {\n Trace,\n TraceLine,\n WORK_STATUS_LABELS,\n WORK_TRACE_STATUS,\n type TraceLineProps,\n type WorkStatus,\n} from '../../ui/trace'\n\n/**\n * ChainOfThought.\n *\n * A summary line that opens onto the steps behind it: \"Searched 3 sources and\n * compared them\", then each source and each comparison as its own line. Reach for\n * `Reasoning` when the thinking is prose, for `Plan` when the steps are a\n * proposal still to be carried out, and for a plain `Trace` when each line is a\n * tool call, a step here is a statement about the agent's *method*, whatever\n * the host chooses to put in it.\n *\n * Nothing here knows how the steps were produced. The host passes the summary and\n * the steps it wants shown; the component does not imply there is more, and a\n * summary with no steps is a plain line.\n *\n * ## Steps\n *\n * A `ChainOfThoughtStep` is a `TraceLine` with a three-state `status`, `complete`\n * (keeps its own icon, or a tick), `active` (running mark and shimmer) and\n * `pending` (dashed mark). Every status is also spoken. A step without a status\n * makes no claim at all. A step's `children` are its evidence, search-result\n * badges, a snippet, and are open by default: someone who unfolded the summary\n * to see the working wants to see what the working found, and one more click per\n * step to read it defeats the point of the summary.\n *\n * `description` is a single truncated row beside the label. Anything longer\n * belongs in `children`.\n *\n * Both parts are lines: put a `ChainOfThought` inside a `Trace`, next to the\n * other activity of the turn.\n */\nexport type ChainOfThoughtStepStatus = Extract<WorkStatus, 'complete' | 'active' | 'pending'>\n\nexport const CHAIN_OF_THOUGHT_STATUS_LABELS: Readonly<Record<ChainOfThoughtStepStatus, string>> = {\n complete: 'Done',\n active: WORK_STATUS_LABELS.active,\n pending: WORK_STATUS_LABELS.pending,\n}\n\nexport type ChainOfThoughtProps = Omit<\n TraceLineProps,\n 'title' | 'href' | 'onSelect' | 'selectHaspopup' | 'children'\n> & {\n /** The steps, as `ChainOfThoughtStep`s. */\n children?: JSX.Element\n /** The one-line account of what the steps add up to. */\n summary?: JSX.Element\n /** The steps' accessible name. */\n stepsLabel?: string\n}\n\nexport function ChainOfThought(props: ChainOfThoughtProps) {\n const [local, rest] = splitProps(props, ['summary', 'stepsLabel', 'icon', 'children'])\n // Resolved once so the steps are created once: a step keeps its own open state\n // and its DOM while the summary is folded and unfolded.\n const steps = resolveChildren(() => local.children)\n const hasSteps = () => steps.toArray().length > 0\n const stepList = () => (\n <Trace size=\"sm\" aria-label={local.stepsLabel ?? 'Steps'}>\n {steps()}\n </Trace>\n )\n\n return (\n <TraceLine icon={local.icon ?? <ListOrdered />} title={local.summary ?? 'Steps'} {...rest}>\n {hasSteps() ? stepList : undefined}\n </TraceLine>\n )\n}\n\nexport type ChainOfThoughtStepProps = Omit<\n TraceLineProps,\n 'title' | 'status' | 'href' | 'onSelect' | 'selectHaspopup'\n> & {\n label: JSX.Element\n status?: ChainOfThoughtStepStatus\n}\n\nexport function ChainOfThoughtStep(props: ChainOfThoughtStepProps) {\n const [local, rest] = splitProps(props, ['label', 'status', 'statusLabel', 'defaultOpen'])\n return (\n <TraceLine\n title={local.label}\n status={local.status ? WORK_TRACE_STATUS[local.status] : undefined}\n statusLabel={\n local.status\n ? (local.statusLabel ?? CHAIN_OF_THOUGHT_STATUS_LABELS[local.status])\n : undefined\n }\n defaultOpen={local.defaultOpen ?? true}\n {...rest}\n />\n )\n}\n\n/** Evidence for a step: the sources it searched, as a wrapping row of badges. */\nexport function ChainOfThoughtResults(props: ComponentProps<'ul'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <ul\n role=\"list\"\n data-slot=\"chain-of-thought-results\"\n class={cn('m-0 flex min-w-0 list-none flex-wrap gap-1.5 p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>\n )\n}\n\nexport type ChainOfThoughtResultProps = Omit<ComponentProps<'li'>, 'children'> & {\n /** Rendered as text. A long label truncates and keeps its full text in `title`. */\n label: string\n icon?: JSX.Element\n}\n\nexport function ChainOfThoughtResult(props: ChainOfThoughtResultProps) {\n const [local, rest] = splitProps(props, ['class', 'label', 'icon'])\n return (\n <li data-slot=\"chain-of-thought-result\" class={cn('min-w-0 max-w-full', local.class)} {...rest}>\n <Badge variant=\"outline\" class=\"max-w-full min-w-0\" title={local.label}>\n {local.icon}\n <span class=\"truncate\">{local.label}</span>\n </Badge>\n </li>\n )\n}\n"],"mappings":";;;;;;;;;;AA6CA,IAAaU,iCAAqF;CAChGC,UAAU;CACVC,QAAQJ,mBAAmBI;CAC3BC,SAASL,mBAAmBK;AAC9B;AAcA,SAAgBG,eAAeC,OAA4B;CACzD,MAAM,CAACC,OAAOC,QAAQhB,WAAWc,OAAO;EAAC;EAAW;EAAc;EAAQ;CAAU,CAAC;CAGrF,MAAMG,QAAQlB,eAAsBgB,MAAMjB,QAAQ;CAClD,MAAMoB,iBAAiBD,MAAME,QAAQ,CAAC,CAACC,SAAS;CAChD,MAAMC,iBAAWC,gBACdnB,OAAK;EAACoB,MAAI;EAAA,KAAA,gBAAA;GAAA,OAAk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,GAAG,CAAC,OAAO,CAAA;CACtB,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAyBhD;AAED,eAAO,MAAM,kBAAkB;;8EAY9B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,GAChE,YAAY,CAAC,OAAO,kBAAkB,CAAC,GAAG;IACxC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACpB,iFAAiF;IACjF,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;CAC9B,CAAA;AAEH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eA2ChD;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,GAAG;IAClE,KAAK,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAC1B,CAAA;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAsB9C"}
|
|
@@ -5,14 +5,14 @@ import { CircleAlert, Info, TriangleAlert } from "lucide-solid";
|
|
|
5
5
|
import { Show, splitProps } from "solid-js";
|
|
6
6
|
// src/components/composites/chat/chat.tsx
|
|
7
7
|
var _tmpl$ = /*#__PURE__*/ template(`<section data-slot=chat><div class="row-start-1 min-w-0"></div><div class="row-start-2 flex min-w-0 flex-col"></div><div class="row-start-3 flex min-h-0 min-w-0 flex-col"></div><div class="row-start-4 min-w-0">`);
|
|
8
|
-
var _tmpl$2 = /*#__PURE__*/ template(`<
|
|
9
|
-
var _tmpl$3 = /*#__PURE__*/ template(`<
|
|
10
|
-
var _tmpl$4 = /*#__PURE__*/ template(`<
|
|
11
|
-
var _tmpl$5 = /*#__PURE__*/ template(`<
|
|
12
|
-
var _tmpl$6 = /*#__PURE__*/ template(`<
|
|
13
|
-
var _tmpl$7 = /*#__PURE__*/ template(`<div
|
|
14
|
-
var _tmpl$8 = /*#__PURE__*/ template(`<
|
|
15
|
-
var _tmpl$9 = /*#__PURE__*/ template(`<
|
|
8
|
+
var _tmpl$2 = /*#__PURE__*/ template(`<header data-slot=chat-header><div class="flex min-w-0 flex-1 flex-col"><h2 class="m-0 truncate text-sm font-semibold tracking-tight">`);
|
|
9
|
+
var _tmpl$3 = /*#__PURE__*/ template(`<p class="m-0 truncate text-xs text-muted-foreground">`);
|
|
10
|
+
var _tmpl$4 = /*#__PURE__*/ template(`<div class="flex shrink-0 items-center gap-1">`);
|
|
11
|
+
var _tmpl$5 = /*#__PURE__*/ template(`<div data-slot=chat-notice><span aria-hidden=true></span><div class="min-w-0 flex-1"><p class="m-0 font-medium [overflow-wrap:anywhere]">`);
|
|
12
|
+
var _tmpl$6 = /*#__PURE__*/ template(`<p class="m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]">`);
|
|
13
|
+
var _tmpl$7 = /*#__PURE__*/ template(`<div class="flex shrink-0 items-center gap-1.5">`);
|
|
14
|
+
var _tmpl$8 = /*#__PURE__*/ template(`<div data-slot=chat-empty><div class="flex flex-col gap-1"><h3 class="m-0 text-base font-semibold tracking-tight text-balance">`);
|
|
15
|
+
var _tmpl$9 = /*#__PURE__*/ template(`<p class="m-0 text-sm text-muted-foreground text-balance">`);
|
|
16
16
|
function Chat(props) {
|
|
17
17
|
const [local, rest] = splitProps(props, [
|
|
18
18
|
"class",
|
|
@@ -42,7 +42,7 @@ function ChatHeader(props) {
|
|
|
42
42
|
"actions"
|
|
43
43
|
]);
|
|
44
44
|
return (() => {
|
|
45
|
-
var _el$6 = _tmpl$
|
|
45
|
+
var _el$6 = _tmpl$2(), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild;
|
|
46
46
|
spread(_el$6, mergeProps({ get ["class"]() {
|
|
47
47
|
return cn("flex min-h-topbar min-w-0 items-center gap-3 border-b border-border px-4 py-2", local.class);
|
|
48
48
|
} }, rest), false, true);
|
|
@@ -51,29 +51,27 @@ function ChatHeader(props) {
|
|
|
51
51
|
get when() {
|
|
52
52
|
return local.subtitle;
|
|
53
53
|
},
|
|
54
|
-
|
|
55
|
-
var _el$9 = _tmpl$
|
|
56
|
-
insert(_el$9,
|
|
54
|
+
children: (subtitleSlot) => (() => {
|
|
55
|
+
var _el$9 = _tmpl$3();
|
|
56
|
+
insert(_el$9, subtitleSlot);
|
|
57
57
|
return _el$9;
|
|
58
|
-
}
|
|
58
|
+
})()
|
|
59
59
|
}), null);
|
|
60
60
|
insert(_el$6, createComponent(Show, {
|
|
61
61
|
get when() {
|
|
62
62
|
return local.status;
|
|
63
63
|
},
|
|
64
|
-
|
|
65
|
-
return local.status;
|
|
66
|
-
}
|
|
64
|
+
children: (statusSlot) => memo(statusSlot)
|
|
67
65
|
}), null);
|
|
68
66
|
insert(_el$6, createComponent(Show, {
|
|
69
67
|
get when() {
|
|
70
68
|
return local.actions;
|
|
71
69
|
},
|
|
72
|
-
|
|
73
|
-
var _el$0 = _tmpl$
|
|
74
|
-
insert(_el$0,
|
|
70
|
+
children: (actionsSlot) => (() => {
|
|
71
|
+
var _el$0 = _tmpl$4();
|
|
72
|
+
insert(_el$0, actionsSlot);
|
|
75
73
|
return _el$0;
|
|
76
|
-
}
|
|
74
|
+
})()
|
|
77
75
|
}), null);
|
|
78
76
|
return _el$6;
|
|
79
77
|
})();
|
|
@@ -97,7 +95,7 @@ function ChatNotice(props) {
|
|
|
97
95
|
]);
|
|
98
96
|
const Glyph = () => local.tone === "danger" ? CircleAlert : local.tone === "warning" ? TriangleAlert : Info;
|
|
99
97
|
return (() => {
|
|
100
|
-
var _el$1 = _tmpl$
|
|
98
|
+
var _el$1 = _tmpl$5(), _el$10 = _el$1.firstChild, _el$11 = _el$10.nextSibling, _el$12 = _el$11.firstChild;
|
|
101
99
|
spread(_el$1, mergeProps({
|
|
102
100
|
get role() {
|
|
103
101
|
return memo(() => local.live === "assertive")() ? "alert" : local.live === "polite" ? "status" : void 0;
|
|
@@ -114,21 +112,21 @@ function ChatNotice(props) {
|
|
|
114
112
|
get when() {
|
|
115
113
|
return local.description;
|
|
116
114
|
},
|
|
117
|
-
|
|
118
|
-
var _el$13 = _tmpl$
|
|
119
|
-
insert(_el$13,
|
|
115
|
+
children: (descriptionSlot) => (() => {
|
|
116
|
+
var _el$13 = _tmpl$6();
|
|
117
|
+
insert(_el$13, descriptionSlot);
|
|
120
118
|
return _el$13;
|
|
121
|
-
}
|
|
119
|
+
})()
|
|
122
120
|
}), null);
|
|
123
121
|
insert(_el$1, createComponent(Show, {
|
|
124
122
|
get when() {
|
|
125
123
|
return local.action;
|
|
126
124
|
},
|
|
127
|
-
|
|
128
|
-
var _el$14 = _tmpl$
|
|
129
|
-
insert(_el$14,
|
|
125
|
+
children: (actionSlot) => (() => {
|
|
126
|
+
var _el$14 = _tmpl$7();
|
|
127
|
+
insert(_el$14, actionSlot);
|
|
130
128
|
return _el$14;
|
|
131
|
-
}
|
|
129
|
+
})()
|
|
132
130
|
}), null);
|
|
133
131
|
effect(() => className(_el$10, cn("mt-0.5 shrink-0 [&_svg]:size-4", {
|
|
134
132
|
"text-muted-foreground": (local.tone ?? "info") === "info",
|
|
@@ -147,7 +145,7 @@ function ChatEmpty(props) {
|
|
|
147
145
|
"suggestions"
|
|
148
146
|
]);
|
|
149
147
|
return (() => {
|
|
150
|
-
var _el$15 = _tmpl$
|
|
148
|
+
var _el$15 = _tmpl$8(), _el$16 = _el$15.firstChild, _el$17 = _el$16.firstChild;
|
|
151
149
|
spread(_el$15, mergeProps({ get ["class"]() {
|
|
152
150
|
return cn("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", local.class);
|
|
153
151
|
} }, rest), false, true);
|
|
@@ -156,19 +154,17 @@ function ChatEmpty(props) {
|
|
|
156
154
|
get when() {
|
|
157
155
|
return local.description;
|
|
158
156
|
},
|
|
159
|
-
|
|
160
|
-
var _el$18 = _tmpl$
|
|
161
|
-
insert(_el$18,
|
|
157
|
+
children: (descriptionSlot) => (() => {
|
|
158
|
+
var _el$18 = _tmpl$9();
|
|
159
|
+
insert(_el$18, descriptionSlot);
|
|
162
160
|
return _el$18;
|
|
163
|
-
}
|
|
161
|
+
})()
|
|
164
162
|
}), null);
|
|
165
163
|
insert(_el$15, createComponent(Show, {
|
|
166
164
|
get when() {
|
|
167
165
|
return local.suggestions;
|
|
168
166
|
},
|
|
169
|
-
|
|
170
|
-
return local.suggestions;
|
|
171
|
-
}
|
|
167
|
+
children: (suggestionsSlot) => memo(suggestionsSlot)
|
|
172
168
|
}), null);
|
|
173
169
|
return _el$15;
|
|
174
170
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","names":["CircleAlert","Info","TriangleAlert","Show","splitProps","Dynamic","cn","cva","header","notices","composer","Chat","props","local","rest","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$spread","_$mergeProps","class","_$insert","children","title","subtitle","status","actions","ChatHeader","_el$6","_tmpl$4","_el$7","_el$8","_$createComponent","when","_el$9","_tmpl$2","_el$0","_tmpl$3","chatNoticeVariants","variants","tone","info","warning","danger","defaultVariants","description","action","live","ChatNotice","Glyph","_el$1","_tmpl$7","_el$10","_el$11","_el$12","role","_$memo","undefined","component","_el$13","_tmpl$5","_el$14","_tmpl$6","_$effect","_$className","suggestions","ChatEmpty","_el$15","_tmpl$9","_el$16","_el$17","_el$18","_tmpl$8"],"sources":["../../../../src/components/composites/chat/chat.tsx"],"sourcesContent":["import { CircleAlert, Info, TriangleAlert } from 'lucide-solid'\nimport { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\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, rest] = splitProps(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, rest] = splitProps(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 <p class=\"m-0 truncate text-xs text-muted-foreground\">{local.subtitle}</p>\n </Show>\n </div>\n <Show when={local.status}>{local.status}</Show>\n <Show when={local.actions}>\n <div class=\"flex shrink-0 items-center gap-1\">{local.actions}</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, rest] = splitProps(props, [\n 'class',\n 'tone',\n 'title',\n 'description',\n 'action',\n 'live',\n ])\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 <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {local.description}\n </p>\n </Show>\n </div>\n <Show when={local.action}>\n <div class=\"flex shrink-0 items-center gap-1.5\">{local.action}</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, rest] = splitProps(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 <p class=\"m-0 text-sm text-muted-foreground text-balance\">{local.description}</p>\n </Show>\n </div>\n <Show when={local.suggestions}>{local.suggestions}</Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwCA,SAAgBW,KAAKC,OAAkB;CACrC,MAAM,CAACC,OAAOC,QAAQV,WAAWQ,OAAO;EAAC;EAAS;EAAU;EAAW;EAAY;CAAU,CAAC;CAC9F,cAAA;EAAA,IAAAG,OAAAC,OAAA,GAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MA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AA,CAAA;AAGvD"}
|
|
1
|
+
{"version":3,"file":"chat.js","names":["CircleAlert","Info","TriangleAlert","Show","splitProps","Dynamic","cn","cva","header","notices","composer","Chat","props","local","rest","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$spread","_$mergeProps","class","_$insert","children","title","subtitle","status","actions","ChatHeader","_el$6","_tmpl$2","_el$7","_el$8","_$createComponent","when","subtitleSlot","_el$9","_tmpl$3","statusSlot","_$memo","actionsSlot","_el$0","_tmpl$4","chatNoticeVariants","variants","tone","info","warning","danger","defaultVariants","description","action","live","ChatNotice","Glyph","_el$1","_tmpl$5","_el$10","_el$11","_el$12","role","undefined","component","descriptionSlot","_el$13","_tmpl$6","actionSlot","_el$14","_tmpl$7","_$effect","_$className","suggestions","ChatEmpty","_el$15","_tmpl$8","_el$16","_el$17","_el$18","_tmpl$9","suggestionsSlot"],"sources":["../../../../src/components/composites/chat/chat.tsx"],"sourcesContent":["import { CircleAlert, Info, TriangleAlert } from 'lucide-solid'\nimport { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\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, rest] = splitProps(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, rest] = splitProps(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, rest] = splitProps(props, [\n 'class',\n 'tone',\n 'title',\n 'description',\n 'action',\n 'live',\n ])\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, rest] = splitProps(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":";;;;;;;;;;;;;;;AAwCA,SAAgBW,KAAKC,OAAkB;CACrC,MAAM,CAACC,OAAOC,QAAQV,WAAWQ,OAAO;EAAC;EAAS;EAAU;EAAW;EAAY;CAAU,CAAC;CAC9F,cAAA;EAAA,IAAAG,OAAAC,OAAA,GAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAG,aAAAC,QAAAF,MAAAC,aAAAE,QAAAD,MAAAD;EAAAG,OAAAR,MAAAS,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWlB,GACL,gIACAO,MAAMY,KACR;EAAC,EAAA,GACGX,IAAI,GAAA,OAAA,IAAA;EAAAY,OAAAT,aAE0BJ,MAAML,MAAM;EAAAkB,OAAAP,aACEN,MAAMJ,OAAO;EAAAiB,OAAAL,aACLR,MAAMc,QAAQ;EAAAD,OAAAJ,aACpCT,MAAMH,QAAQ;EAAA,OAAAK;CAAA,EAAA,CAAA;AAGtD;AAYA,SAAgBiB,W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S;GAC/B,oBAAoBpC,MAAMoC,SAAS;EACrC,CAAC,CAAC,CAAA;EAAA,OAAAU;CAAA,EAAA,CAAA;AAmBV;;AAUA,SAAgBiB,UAAUhE,OAAuB;CAC/C,MAAM,CAACC,OAAOC,QAAQV,WAAWQ,OAAO;EAAC;EAAS;EAAS;EAAe;CAAa,CAAC;CACxF,cAAA;EAAA,IAAAiE,SAAAC,QAAA,GAAAC,SAAAF,OAAA3D,YAAA8D,SAAAD,OAAA7D;EAAAK,OAAAsD,QAAArD,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWlB,GACL,6GACAO,MAAMY,KACR;EAAC,EAAA,GACGX,IAAI,GAAA,OAAA,IAAA;EAAAY,OAAAsD,cAG+DnE,MAAMe,KAAK;EAAAF,OAAAqD,QAAA1C,gBAC/ElC,MAAI;GAAA,IAACmC,OAAI;IAAA,OAAEzB,MAAMyC;GAAW;GAAA3B,WACzBwC,2BAAe;IAAA,IAAAc,SAAAC,QAAA;IAAAxD,OAAAuD,QAC4Cd,eAAe;IAAA,OAAAc;GAAA,EAAA,CAAA;EAC3E,CAAA,GAAA,IAAA;EAAAvD,OAAAmD,QAAAxC,gBAGJlC,MAAI;GAAA,IAACmC,OAAI;IAAA,OAAEzB,MAAM8D;GAAW;GAAAhD,WAAIwD,oBAAexC,KAAQwC,eAAe;EAAM,CAAA,GAAA,IAAA;EAAA,OAAAN;CAAA,EAAA,CAAA;AAGnF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Where a restore stands. `idle` is the resting state of a checkpoint that has
|
|
3
3
|
* not been restored from; the other three are only ever set because something
|
|
4
|
-
* happened
|
|
4
|
+
* happened, the host passes them, or the component sets them from the promise
|
|
5
5
|
* `onRestore` returned.
|
|
6
6
|
*/
|
|
7
7
|
export type CheckpointState = 'idle' | 'restoring' | 'restored' | 'failed';
|
|
@@ -24,8 +24,8 @@ export declare function restoreDialogCopy(label: string | undefined, consequence
|
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* Whether the Restore control exists, and whether it can be used. It exists only
|
|
27
|
-
* when the host passed a handler
|
|
28
|
-
* look as if it can
|
|
27
|
+
* when the host passed a handler, a checkpoint that cannot be restored must not
|
|
28
|
+
* look as if it can, and goes once the restore has succeeded.
|
|
29
29
|
*/
|
|
30
30
|
export declare function restoreControl(hasHandler: boolean, state: CheckpointState, disabledReason: string | undefined): {
|
|
31
31
|
visible: boolean;
|
|
@@ -33,8 +33,8 @@ function restoreDialogCopy(label, consequence) {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Whether the Restore control exists, and whether it can be used. It exists only
|
|
36
|
-
* when the host passed a handler
|
|
37
|
-
* look as if it can
|
|
36
|
+
* when the host passed a handler, a checkpoint that cannot be restored must not
|
|
37
|
+
* look as if it can, and goes once the restore has succeeded.
|
|
38
38
|
*/
|
|
39
39
|
function restoreControl(hasHandler, state, disabledReason) {
|
|
40
40
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint-model.js","names":[],"sources":["../../../../src/components/composites/checkpoint/checkpoint-model.ts"],"sourcesContent":["import { REASON_TEXT_LIMIT, boundText } from '#lib/text'\n\n/**\n * Where a restore stands. `idle` is the resting state of a checkpoint that has\n * not been restored from; the other three are only ever set because something\n * happened
|
|
1
|
+
{"version":3,"file":"checkpoint-model.js","names":[],"sources":["../../../../src/components/composites/checkpoint/checkpoint-model.ts"],"sourcesContent":["import { REASON_TEXT_LIMIT, boundText } from '#lib/text'\n\n/**\n * Where a restore stands. `idle` is the resting state of a checkpoint that has\n * not been restored from; the other three are only ever set because something\n * happened, the host passes them, or the component sets them from the promise\n * `onRestore` returned.\n */\nexport type CheckpointState = 'idle' | 'restoring' | 'restored' | 'failed'\n\n/** The checkpoint's name as drawn; a blank label is the honest generic word. */\nexport function checkpointLabel(label: string | undefined): string {\n return (label ? boundText(label, 80) : '') || 'Checkpoint'\n}\n\n/**\n * The sentence for the status region. `idle` says nothing, because a\n * checkpoint that has not been touched makes no statement. A failure carries the\n * host's text when there is one.\n */\nexport function checkpointStatus(\n state: CheckpointState,\n error?: string,\n disabledReason?: string\n): string | undefined {\n switch (state) {\n case 'restoring':\n return 'Restoring…'\n case 'restored':\n return 'Restored'\n case 'failed': {\n const detail = error ? boundText(error, REASON_TEXT_LIMIT) : ''\n return detail ? `Restore failed: ${detail}` : 'Restore failed'\n }\n case 'idle':\n return disabledReason ? boundText(disabledReason, REASON_TEXT_LIMIT) : undefined\n }\n}\n\n/**\n * The confirmation dialog's words. The host's `consequence` is what actually\n * names what will change, so it is used verbatim (bounded); without one the dialog\n * says only what a restore always means and does not guess at the rest.\n */\nexport function restoreDialogCopy(\n label: string | undefined,\n consequence: string | undefined\n): { title: string; description: string } {\n return {\n title: `Restore to “${checkpointLabel(label)}”?`,\n description: consequence\n ? boundText(consequence, 400)\n : 'Restoring returns to this checkpoint.',\n }\n}\n\n/**\n * Whether the Restore control exists, and whether it can be used. It exists only\n * when the host passed a handler, a checkpoint that cannot be restored must not\n * look as if it can, and goes once the restore has succeeded.\n */\nexport function restoreControl(\n hasHandler: boolean,\n state: CheckpointState,\n disabledReason: string | undefined\n): { visible: boolean; disabled: boolean } {\n return {\n visible: hasHandler && state !== 'restored',\n disabled: state === 'restoring' || disabledReason !== undefined,\n }\n}\n"],"mappings":";;;AAWA,SAAgB,gBAAgB,OAAmC;CACjE,QAAQ,QAAQ,UAAU,OAAO,EAAE,IAAI,OAAO;AAChD;;;;;;AAOA,SAAgB,iBACd,OACA,OACA,gBACoB;CACpB,QAAQ,OAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,UAAU;GACb,MAAM,SAAS,QAAQ,UAAU,OAAA,GAAwB,IAAI;GAC7D,OAAO,SAAS,mBAAmB,WAAW;EAChD;EACA,KAAK,QACH,OAAO,iBAAiB,UAAU,gBAAA,GAAiC,IAAI,KAAA;CAC3E;AACF;;;;;;AAOA,SAAgB,kBACd,OACA,aACwC;CACxC,OAAO;EACL,OAAO,eAAe,gBAAgB,KAAK,EAAE;EAC7C,aAAa,cACT,UAAU,aAAa,GAAG,IAC1B;CACN;AACF;;;;;;AAOA,SAAgB,eACd,YACA,OACA,gBACyC;CACzC,OAAO;EACL,SAAS,cAAc,UAAU;EACjC,UAAU,UAAU,eAAe,mBAAmB,KAAA;CACxD;AACF"}
|
|
@@ -4,8 +4,8 @@ import { type CheckpointState } from './checkpoint-model';
|
|
|
4
4
|
* Checkpoint.
|
|
5
5
|
*
|
|
6
6
|
* A point in the conversation the host can name: a divider in the transcript with
|
|
7
|
-
* a label and a time. It always renders
|
|
8
|
-
* column
|
|
7
|
+
* a label and a time. It always renders, as a `Marker`, the quietest thing in the
|
|
8
|
+
* column, and it is honest about what it is:
|
|
9
9
|
*
|
|
10
10
|
* - **Without `onRestore` it is only a marker.** Not a disabled button, not a
|
|
11
11
|
* greyed-out "Restore": nothing. Whether a checkpoint can be returned to is a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.js","names":["Flag","createEffect","createMemo","createSignal","createUniqueId","on","Show","splitProps","cn","Button","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogTitle","AlertDialogTrigger","Marker","Spinner","settleAction","boundText","checkpointLabel","checkpointStatus","restoreControl","restoreDialogCopy","label","time","state","onRestore","consequence","restoreLabel","disabledReason","error","Checkpoint","props","local","rest","uid","reasonId","followed","setFollowed","failure","setFailure","undefined","confirming","setConfirming","inflight","root","status","control","copy","statusText","restore","disabled","result","ok","message","restored","active","document","activeElement","body","contains","focus","defer","restoreAction","_$createComponent","when","visible","children","open","onOpenChange","as","variant","size","_$memo","title","description","onClick","_el$","_tmpl$","_el$2","firstChild","_$use","element","_$spread","_$mergeProps","class","_$insert","icon","tone","action","_$setAttribute","_$effect","_$className"],"sources":["../../../../src/components/composites/checkpoint/checkpoint.tsx"],"sourcesContent":["import { Flag } from 'lucide-solid'\nimport {\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n on,\n Show,\n splitProps,\n type ComponentProps,\n} from 'solid-js'\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'\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, rest] = splitProps(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 createEffect(\n on(\n () => state() === 'restored',\n (restored) => {\n if (!restored) 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\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) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled || 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":";;;;;;;;;;;;;AAiFA,SAAgBmC,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQ/B,WAAW6B,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMI,WAAW,GADLpC,eACQmC,EAA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Id","on","Show","splitProps","cn","Button","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogTitle","AlertDialogTrigger","Marker","Spinner","settleAction","boundText","checkpointLabel","checkpointStatus","restoreControl","restoreDialogCopy","label","time","state","onRestore","consequence","restoreLabel","disabledReason","error","Checkpoint","props","local","rest","uid","reasonId","followed","setFollowed","failure","setFailure","undefined","confirming","setConfirming","inflight","root","status","control","copy","statusText","restore","disabled","result","ok","message","restored","active","document","activeElement","body","contains","focus","defer","restoreAction","_$createComponent","when","visible","children","open","onOpenChange","as","variant","size","_$memo","title","description","onClick","_el$","_tmpl$","_el$2","firstChild","_$use","element","_$spread","_$mergeProps","class","_$insert","icon","tone","action","_$setAttribute","_$effect","_$className"],"sources":["../../../../src/components/composites/checkpoint/checkpoint.tsx"],"sourcesContent":["import { Flag } from 'lucide-solid'\nimport {\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n on,\n Show,\n splitProps,\n type ComponentProps,\n} from 'solid-js'\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'\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, rest] = splitProps(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 createEffect(\n on(\n () => state() === 'restored',\n (restored) => {\n if (!restored) 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\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) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled || 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":";;;;;;;;;;;;;AAiFA,SAAgBmC,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQ/B,WAAW6B,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMI,WAAW,GADLpC,eACQmC,EAAG;CACvB,MAAM,CAACE,UAAUC,eAAevC,aAA8B,MAAM;CACpE,MAAM,CAACwC,SAASC,cAAczC,aAAiC0C,KAAAA,CAAS;CACxE,MAAM,CAACC,YAAYC,iBAAiB5C,aAAa,KAAK;CACtD,IAAI6C,WAAW;CACf,IAAIC;CACJ,IAAIC;CAEJ,MAAMrB,cAA+BQ,MAAMR,SAASY,SAAS;CAC7D,MAAMP,cAAcG,MAAMH,SAASS,QAAQ;CAC3C,MAAMQ,gBAAgB1B,eAAeY,MAAMP,cAAce,KAAAA,GAAWhB,MAAM,GAAGQ,MAAMJ,cAAc;CACjG,MAAMmB,aAAa1B,kBAAkBW,MAAMV,OAAOU,MAAMN,WAAW;CACnE,MAAMsB,mBAAmB7B,iBAAiBK,MAAM,GAAGK,MAAM,GAAGG,MAAMJ,cAAc;CAEhF,MAAMqB,UAAU,YAAY;EAC1B,IAAIN,YAAYG,QAAQ,CAAC,CAACI,UAAU;EACpCP,WAAW;EACXJ,WAAWC,KAAAA,CAAS;EACpBH,YAAY,WAAW;EACvB,MAAMc,SAAS,MAAMnC,aAAagB,MAAMP,SAA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,iBAAiB,CAAA;IACzB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,mBAAmB,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,MAAM,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/confirmation/confirmation.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,GAAG,EACT,MAAM,UAAU,CAAA;AAOjB,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAA;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC3E,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE7D,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,GAAG;IACrF,KAAK,CAAC,EAAE,iBAAiB,CAAA;IACzB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,mBAAmB,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,MAAM,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAqLpD"}
|
|
@@ -100,7 +100,7 @@ function Confirmation(props) {
|
|
|
100
100
|
return cn("flex w-full max-w-xl min-w-0 flex-col gap-3 rounded-xl border bg-card p-4", {
|
|
101
101
|
"border-ring": awaiting(),
|
|
102
102
|
"border-border": !awaiting()
|
|
103
|
-
});
|
|
103
|
+
}, local.class);
|
|
104
104
|
}
|
|
105
105
|
}, rest), false, true);
|
|
106
106
|
insert(_el$3, createComponent(Show, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation.js","names":["Ban","Check","Clock","Lock","ShieldQuestion","createEffect","createSignal","createUniqueId","Show","splitProps","cn","Button","CodeBlock","DiffBlock","Spinner","boundText","confirmationOutcome","decisionReason","isAwaitingAnswer","settleDecision","kind","code","language","title","patch","state","description","details","onApprove","onDeny","approveLabel","denyLabel","disabledReason","error","resolvedBy","resolvedAt","children","Confirmation","props","local","rest","uid","titleId","reasonId","awaiting","pending","setPending","undefined","failure","setFailure","inflight","root","outcome","reasonFor","handler","missing","hasHandler","unavailableFallback","missingFallback","approveReason","denyReason","reasons","Set","filter","Boolean","join","choose","choice","blocked","result","ok","message","wasAwaiting","now","active","document","activeElement","body","contains","focus","buttonProps","disabled","onClick","_el$","_tmpl$6","_el$2","firstChild","_el$3","_el$4","nextSibling","_el$5","_$use","element","_$setAttribute","_$spread","_$mergeProps","_$insert","_$createComponent","when","_el$6","_tmpl$","_el$7","_tmpl$2","Details","fallback","_el$10","_tmpl$7","_el$8","_tmpl$3","_el$9","_tmpl$4","_el$0","_tmpl$5","_el$1","type","variant","size","label","_$memo","bounded","value","limit","complete","wrap","maxHeight","diff","_el$11","_tmpl$8"],"sources":["../../../../src/components/composites/confirmation/confirmation.tsx"],"sourcesContent":["import { Ban, Check, Clock, Lock, ShieldQuestion } from 'lucide-solid'\nimport {\n createEffect,\n createSignal,\n createUniqueId,\n Show,\n splitProps,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\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'\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, rest] = splitProps(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 // The previous value is kept by hand: `on(..., { defer: true })` does not record the\n // input of its skipped first run, so its \"previous\" is undefined on the first change.\n let wasAwaiting = awaiting()\n createEffect(() => {\n const now = awaiting()\n if (wasAwaiting && !now) {\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n outcome?.focus()\n }\n }\n wasAwaiting = now\n })\n\n const buttonProps = (choice: Choice) => {\n const blocked = () => (choice === 'approve' ? approveReason() : denyReason())\n const disabled = () => pending() !== undefined || blocked() !== undefined\n return {\n 'aria-disabled': disabled() || undefined,\n 'aria-describedby': blocked() ? reasonId : undefined,\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('flex w-full max-w-xl min-w-0 flex-col gap-3 rounded-xl border bg-card p-4', {\n 'border-ring': awaiting(),\n 'border-border': !awaiting(),\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<Confirmation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QzG,UAAUyG,OAAOC,KAAK,KAAK1E,KAAAA,IAAYA,KAAAA;AACxD;AAEA,SAASwD,QAAQjE,OAAyC;CACxD,OAAA2D,gBACGzF,MAAI;EAAA,IACH0F,OAAI;GAAA,OAAEoB,WAAAhF,MAAMX,QAAQP,SAAS,MAAM,CAAA,CAAA,KAAIkB,MAAMX;EAAO;EAAA,IACpD6E,WAAQ;GAAA,OAAAP,gBACLrF,WAAS;IACRwG,MAAI;IAAA,IACJ/F,OAAI;KAAA,OAAGiB,MAAMX,QAA2DN;IAAI;IAAA,IAC5EC,WAAQ;KAAA,OAAEiG,QACPjF,MAAMX,QAA2DL,UAClE,EACF;IAAC;IAAA,IACDC,QAAK;KAAA,OAAEgG,QAAQjF,MAAMX,QAAQJ,OAAO,EAAE;IAAC;IACvCmG,UAAQ;IACRC,MAAI;IACJC,WAAS;GAAA,CAAA;EAAA;EAAAxF,WAIXyF,gBAEA;GAAA,IAAAC,SAAAC,QAAA;GAAA/B,OAAA8B,QAAA7B,gBAOGpF,WAAS;IAAA,IACRW,QAAK;KAAA,OAAGqG,KAAK,CAAC,CAAoDrG;IAAK;IAAA,IACvED,QAAK;KAAA,OAAEgG,QAAQM,KAAK,CAAC,CAACtG,OAAO,EAAE;IAAC;IAChCmG,UAAQ;GAAA,CAAA,CAAA;GAAA,OAAAI;EAAA,EAAA,CAAA;CAGb,CAAA;AAGP"}
|
|
1
|
+
{"version":3,"file":"confirmation.js","names":["Ban","Check","Clock","Lock","ShieldQuestion","createEffect","createSignal","createUniqueId","Show","splitProps","cn","Button","CodeBlock","DiffBlock","Spinner","boundText","confirmationOutcome","decisionReason","isAwaitingAnswer","settleDecision","kind","code","language","title","patch","state","description","details","onApprove","onDeny","approveLabel","denyLabel","disabledReason","error","resolvedBy","resolvedAt","children","Confirmation","props","local","rest","uid","titleId","reasonId","awaiting","pending","setPending","undefined","failure","setFailure","inflight","root","outcome","reasonFor","handler","missing","hasHandler","unavailableFallback","missingFallback","approveReason","denyReason","reasons","Set","filter","Boolean","join","choose","choice","blocked","result","ok","message","wasAwaiting","now","active","document","activeElement","body","contains","focus","buttonProps","disabled","onClick","_el$","_tmpl$6","_el$2","firstChild","_el$3","_el$4","nextSibling","_el$5","_$use","element","_$setAttribute","_$spread","_$mergeProps","class","_$insert","_$createComponent","when","_el$6","_tmpl$","_el$7","_tmpl$2","Details","fallback","_el$10","_tmpl$7","_el$8","_tmpl$3","_el$9","_tmpl$4","_el$0","_tmpl$5","_el$1","type","variant","size","label","_$memo","bounded","value","limit","complete","wrap","maxHeight","diff","_el$11","_tmpl$8"],"sources":["../../../../src/components/composites/confirmation/confirmation.tsx"],"sourcesContent":["import { Ban, Check, Clock, Lock, ShieldQuestion } from 'lucide-solid'\nimport {\n createEffect,\n createSignal,\n createUniqueId,\n Show,\n splitProps,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\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'\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, rest] = splitProps(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 // The previous value is kept by hand: `on(..., { defer: true })` does not record the\n // input of its skipped first run, so its \"previous\" is undefined on the first change.\n let wasAwaiting = awaiting()\n createEffect(() => {\n const now = awaiting()\n if (wasAwaiting && !now) {\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n outcome?.focus()\n }\n }\n wasAwaiting = now\n })\n\n const buttonProps = (choice: Choice) => {\n const blocked = () => (choice === 'approve' ? approveReason() : denyReason())\n const disabled = () => pending() !== undefined || blocked() !== undefined\n return {\n 'aria-disabled': disabled() || undefined,\n 'aria-describedby': blocked() ? reasonId : undefined,\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":";;;;;;;;;;;;;;;;;;;AAyFA,SAAgBqC,aAAaC,OAA0B;CACrD,MAAM,CAACC,OAAOC,QAAQ/B,WAAW6B,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CACD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gBACLtF,WAAS;IACRyG,MAAI;IAAA,IACJhG,OAAI;KAAA,OAAGiB,MAAMX,QAA2DN;IAAI;IAAA,IAC5EC,WAAQ;KAAA,OAAEkG,QACPlF,MAAMX,QAA2DL,UAClE,EACF;IAAC;IAAA,IACDC,QAAK;KAAA,OAAEiG,QAAQlF,MAAMX,QAAQJ,OAAO,EAAE;IAAC;IACvCoG,UAAQ;IACRC,MAAI;IACJC,WAAS;GAAA,CAAA;EAAA;EAAAzF,WAIX0F,gBAEA;GAAA,IAAAC,SAAAC,QAAA;GAAA/B,OAAA8B,QAAA7B,gBAOGrF,WAAS;IAAA,IACRW,QAAK;KAAA,OAAGsG,KAAK,CAAC,CAAoDtG;IAAK;IAAA,IACvED,QAAK;KAAA,OAAEiG,QAAQM,KAAK,CAAC,CAACvG,OAAO,EAAE;IAAC;IAChCoG,UAAQ;GAAA,CAAA,CAAA;GAAA,OAAAI;EAAA,EAAA,CAAA;CAGb,CAAA;AAGP"}
|
|
@@ -12,8 +12,8 @@ import { type ContextFigures } from './context-model';
|
|
|
12
12
|
* ## Every figure is a claim, so every figure is optional
|
|
13
13
|
*
|
|
14
14
|
* A host passes whatever it knows: `used`, `total`, a `breakdown` (input, output,
|
|
15
|
-
* cache read and write, reasoning), a `cost`. A missing value is omitted
|
|
16
|
-
* drawn as 0, which would say "empty" about a window nobody measured
|
|
15
|
+
* cache read and write, reasoning), a `cost`. A missing value is omitted, never
|
|
16
|
+
* drawn as 0, which would say "empty" about a window nobody measured, and when
|
|
17
17
|
* *nothing* is known the trigger is not rendered at all (`hasContextFigures`).
|
|
18
18
|
* Nothing is estimated here; the one derived row, "Remaining", appears only when
|
|
19
19
|
* both `used` and `total` are known and `used` does not exceed `total`.
|