@adea-ai/ui 0.151.11 → 0.151.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NOTICE +3 -2
- package/dist/components/composites/about-dialog/about-dialog.d.ts.map +1 -1
- package/dist/components/composites/about-dialog/about-dialog.js +27 -48
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.d.ts +2 -2
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +4 -22
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -4
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +1 -10
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +2 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +3 -2
- 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 +1 -0
- 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 +28 -53
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +7 -47
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/index.d.ts +1 -0
- package/dist/components/composites/appearance-editor/index.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/index.js +2 -1
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +8 -11
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +5 -4
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -12
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.d.ts +2 -2
- package/dist/components/composites/chat/chat.d.ts.map +1 -1
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.js +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +3 -3
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation-model.d.ts +3 -12
- package/dist/components/composites/confirmation/confirmation-model.d.ts.map +1 -1
- package/dist/components/composites/confirmation/confirmation-model.js +5 -17
- package/dist/components/composites/confirmation/confirmation-model.js.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-model.js +1 -1
- package/dist/components/composites/context/context-model.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.d.ts +5 -12
- package/dist/components/composites/file-tree/build-file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +26 -30
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.d.ts +2 -2
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +4 -30
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/index.d.ts +2 -1
- package/dist/components/composites/file-tree/index.d.ts.map +1 -1
- package/dist/components/composites/file-tree/index.js +2 -1
- package/dist/components/composites/help-center/help-center.d.ts.map +1 -1
- package/dist/components/composites/help-center/help-center.js +9 -20
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.d.ts.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +7 -11
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/citation.d.ts.map +1 -1
- package/dist/components/composites/inline-citation/citation.js +2 -1
- package/dist/components/composites/inline-citation/citation.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +2 -1
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.d.ts +4 -5
- package/dist/components/composites/message-scroller/message-scroller.d.ts.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +19 -13
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.d.ts +4 -3
- package/dist/components/composites/message-scroller/scroll-anchor.d.ts.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js +5 -3
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +1 -1
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- 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 +2 -3
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.d.ts +2 -2
- package/dist/components/composites/queue/queue.d.ts.map +1 -1
- package/dist/components/composites/queue/queue.js +57 -64
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/index.js +3 -1
- package/dist/components/composites/reasoning/reasoning.d.ts +2 -3
- package/dist/components/composites/reasoning/reasoning.d.ts.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +5 -20
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +3 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +1 -1
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/sources/index.js +2 -1
- package/dist/components/composites/sources/source.d.ts +3 -8
- package/dist/components/composites/sources/source.d.ts.map +1 -1
- package/dist/components/composites/sources/source.js +5 -30
- package/dist/components/composites/sources/source.js.map +1 -1
- package/dist/components/composites/sources/sources.js +2 -1
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.d.ts.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +3 -12
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/subagent/subagent.d.ts +3 -1
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
- package/dist/components/composites/subagent/subagent.js +5 -17
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.d.ts.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js +3 -2
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.d.ts +2 -3
- package/dist/components/composites/task/task.d.ts.map +1 -1
- package/dist/components/composites/task/task.js +49 -109
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/terminal-model.d.ts +1 -2
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal-model.js +7 -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 +3 -12
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.d.ts.map +1 -1
- package/dist/components/composites/test-results/test-results.js +3 -12
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.d.ts +0 -1
- package/dist/components/composites/tool/tool.d.ts.map +1 -1
- package/dist/components/composites/tool/tool.js +47 -41
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree-navigation.d.ts +6 -2
- package/dist/components/composites/tree/tree-navigation.d.ts.map +1 -1
- package/dist/components/composites/tree/tree-navigation.js +18 -1
- package/dist/components/composites/tree/tree-navigation.js.map +1 -1
- package/dist/components/composites/tree/tree.d.ts +6 -0
- package/dist/components/composites/tree/tree.d.ts.map +1 -1
- package/dist/components/composites/tree/tree.js +30 -4
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +7 -8
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.d.ts +2 -26
- package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +47 -125
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/update-dialog/update-model.d.ts +65 -0
- package/dist/components/composites/update-dialog/update-model.d.ts.map +1 -0
- package/dist/components/composites/update-dialog/update-model.js +75 -0
- package/dist/components/composites/update-dialog/update-model.js.map +1 -0
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.d.ts.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +3 -16
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.d.ts.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +10 -14
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/busy-send-button.d.ts +3 -5
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
- package/dist/components/conversation/busy-send-button.js +4 -15
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.d.ts +1 -1
- package/dist/components/conversation/chat-composer.d.ts.map +1 -1
- package/dist/components/conversation/chat-composer.js +1 -1
- package/dist/components/conversation/chat-composer.js.map +1 -1
- package/dist/components/conversation/composer-core.d.ts +35 -0
- package/dist/components/conversation/composer-core.d.ts.map +1 -0
- package/dist/components/conversation/composer-core.js +68 -0
- package/dist/components/conversation/composer-core.js.map +1 -0
- package/dist/components/conversation/composer-menu.d.ts +1 -1
- package/dist/components/conversation/composer-menu.d.ts.map +1 -1
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-pane.d.ts +4 -1
- package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
- package/dist/components/conversation/conversation-pane.js +4 -0
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.d.ts +9 -6
- package/dist/components/conversation/conversation-surface.d.ts.map +1 -1
- package/dist/components/conversation/conversation-surface.js +7 -5
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/ime-guard.d.ts +1 -0
- package/dist/components/conversation/ime-guard.d.ts.map +1 -1
- package/dist/components/conversation/ime-guard.js +5 -0
- package/dist/components/conversation/ime-guard.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 +16 -50
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts +1 -3
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +15 -32
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.d.ts +10 -11
- package/dist/components/conversation/message-row.d.ts.map +1 -1
- package/dist/components/conversation/message-row.js +24 -49
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.d.ts.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +7 -17
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/paste-tokens.d.ts +10 -1
- package/dist/components/conversation/paste-tokens.d.ts.map +1 -1
- package/dist/components/conversation/paste-tokens.js +26 -2
- package/dist/components/conversation/paste-tokens.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +30 -79
- package/dist/components/conversation/scroll-follow-core.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow-core.js +65 -54
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts +5 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +27 -91
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/conversation/thread-panel.d.ts +0 -2
- package/dist/components/conversation/thread-panel.d.ts.map +1 -1
- 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 +4 -16
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/conversation/transcript-folding.d.ts +0 -1
- package/dist/components/conversation/transcript-folding.d.ts.map +1 -1
- package/dist/components/conversation/transcript-folding.js +1 -1
- package/dist/components/conversation/transcript-folding.js.map +1 -1
- package/dist/components/conversation/transcript-grouping.d.ts +8 -0
- package/dist/components/conversation/transcript-grouping.d.ts.map +1 -1
- package/dist/components/conversation/transcript-grouping.js +17 -3
- package/dist/components/conversation/transcript-grouping.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts +12 -0
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +53 -17
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/index.d.ts +1 -1
- package/dist/components/layout/contextual-sidebar/index.d.ts.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js.map +1 -1
- package/dist/components/layout/floating-preview/index.js +2 -2
- package/dist/components/layout/floating-preview/model.d.ts +21 -55
- package/dist/components/layout/floating-preview/model.d.ts.map +1 -1
- package/dist/components/layout/floating-preview/model.js +33 -88
- package/dist/components/layout/floating-preview/model.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 +11 -5
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.d.ts +18 -22
- package/dist/components/layout/shell-top-bar/shell-top-bar.d.ts.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js +4 -2
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts +0 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.js +2 -8
- package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts +0 -9
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +148 -128
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/index.d.ts +2 -1
- package/dist/components/layout/sidebar-nav/index.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/index.js +2 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.d.ts +10 -0
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.d.ts.map +1 -0
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js +18 -0
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js.map +1 -0
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.d.ts +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts +5 -9
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -23
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/geometry.d.ts.map +1 -1
- package/dist/components/layout/split-layout/geometry.js +2 -2
- package/dist/components/layout/split-layout/geometry.js.map +1 -1
- package/dist/components/layout/split-layout/index.js +2 -2
- package/dist/components/layout/split-layout/model.d.ts.map +1 -1
- package/dist/components/layout/split-layout/model.js +4 -4
- package/dist/components/layout/split-layout/model.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts +5 -0
- 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 +17 -10
- 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 +5 -0
- package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +17 -10
- 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 +54 -47
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/split-layout/tree.d.ts +2 -0
- package/dist/components/layout/split-layout/tree.d.ts.map +1 -1
- package/dist/components/layout/split-layout/tree.js +5 -1
- package/dist/components/layout/split-layout/tree.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.d.ts +2 -9
- package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +4 -8
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/top-bar/window-chrome.d.ts +13 -0
- package/dist/components/layout/top-bar/window-chrome.d.ts.map +1 -0
- package/dist/components/layout/top-bar/window-chrome.js +12 -0
- package/dist/components/layout/top-bar/window-chrome.js.map +1 -0
- package/dist/components/motion/presence.d.ts +1 -1
- package/dist/components/motion/presence.d.ts.map +1 -1
- package/dist/components/motion/presence.js +1 -4
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts +3 -1
- package/dist/components/theme/appearance-panel.d.ts.map +1 -1
- package/dist/components/theme/appearance-panel.js +17 -9
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/index.d.ts +1 -1
- package/dist/components/theme/index.d.ts.map +1 -1
- package/dist/components/theme/index.js +5 -4
- package/dist/components/theme/lazy.d.ts +31 -5
- package/dist/components/theme/lazy.d.ts.map +1 -1
- package/dist/components/theme/lazy.js +39 -6
- package/dist/components/theme/lazy.js.map +1 -0
- package/dist/components/theme/script-projection.d.ts +17 -0
- package/dist/components/theme/script-projection.d.ts.map +1 -0
- package/dist/components/theme/script-projection.js +17 -0
- package/dist/components/theme/script-projection.js.map +1 -0
- package/dist/components/theme/script.js +3 -1
- package/dist/components/theme/theme-api.d.ts +14 -0
- package/dist/components/theme/theme-api.d.ts.map +1 -0
- package/dist/components/theme/theme-catalogue-source.d.ts.map +1 -1
- package/dist/components/theme/theme-catalogue-source.js +3 -2
- package/dist/components/theme/theme-catalogue-source.js.map +1 -1
- package/dist/components/theme/theme-document.d.ts +112 -10
- package/dist/components/theme/theme-document.d.ts.map +1 -1
- package/dist/components/theme/{theme-document-core.js → theme-document.js} +20 -10
- package/dist/components/theme/theme-document.js.map +1 -0
- package/dist/components/theme/theme-mode-toggle.d.ts +1 -1
- package/dist/components/theme/theme-mode-toggle.d.ts.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-persistence.d.ts +6 -5
- package/dist/components/theme/theme-persistence.d.ts.map +1 -1
- package/dist/components/theme/theme-persistence.js +48 -80
- package/dist/components/theme/theme-persistence.js.map +1 -1
- package/dist/components/theme/theme-picker.d.ts +1 -1
- package/dist/components/theme/theme-picker.d.ts.map +1 -1
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.d.ts +16 -16
- package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
- package/dist/components/theme/theme-provider-value.js +33 -42
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-provider.d.ts +3 -9
- package/dist/components/theme/theme-provider.d.ts.map +1 -1
- package/dist/components/theme/theme-provider.js +8 -7
- package/dist/components/theme/theme-provider.js.map +1 -1
- package/dist/components/theme/theme-script.d.ts +24 -25
- package/dist/components/theme/theme-script.d.ts.map +1 -1
- package/dist/components/theme/theme-script.js +45 -39
- package/dist/components/theme/theme-script.js.map +1 -1
- package/dist/components/theme/theme-state.d.ts +241 -9
- package/dist/components/theme/theme-state.d.ts.map +1 -1
- package/dist/components/theme/{theme-state-core.js → theme-state.js} +10 -11
- package/dist/components/theme/theme-state.js.map +1 -0
- package/dist/components/theme/theme-toggle.d.ts +1 -1
- package/dist/components/theme/theme-toggle.d.ts.map +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/theme/token-projection-options.d.ts +3 -0
- package/dist/components/theme/token-projection-options.d.ts.map +1 -0
- package/dist/components/theme/token-projection-options.js +9 -0
- package/dist/components/theme/token-projection-options.js.map +1 -0
- package/dist/components/theme/token-projection.d.ts +22 -0
- package/dist/components/theme/token-projection.d.ts.map +1 -0
- package/dist/components/theme/token-projection.js +1 -0
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +7 -5
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +40 -36
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/attachment/attachment.d.ts.map +1 -1
- package/dist/components/ui/attachment/attachment.js +5 -16
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar/avatar.js +5 -2
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/board/board.d.ts +0 -3
- package/dist/components/ui/board/board.d.ts.map +1 -1
- package/dist/components/ui/board/board.js +3 -6
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/button-group/button-group.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.d.ts.map +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/chart/chart.d.ts +0 -3
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/code-block/code-block.d.ts +0 -2
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +8 -24
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/command/command.d.ts.map +1 -1
- package/dist/components/ui/command/command.js +56 -48
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +8 -30
- package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +13 -121
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.d.ts +46 -0
- package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -0
- package/dist/components/ui/dialog/dialog-layer.js +169 -0
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -0
- package/dist/components/ui/dialog/dialog.d.ts +20 -26
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +69 -187
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer/drawer.js +5 -8
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +39 -53
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +135 -191
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts +46 -0
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/menu-parts.js +176 -0
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -0
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.d.ts +1 -2
- package/dist/components/ui/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js +4 -21
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts +19 -33
- package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar/menubar.js +21 -116
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/index.js +2 -1
- package/dist/components/ui/message/message.d.ts +0 -1
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/message/parse-message-text.d.ts +20 -2
- package/dist/components/ui/message/parse-message-text.d.ts.map +1 -1
- package/dist/components/ui/message/parse-message-text.js +94 -28
- package/dist/components/ui/message/parse-message-text.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts +5 -12
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +61 -77
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts +0 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/popover/popover.d.ts +1 -3
- package/dist/components/ui/popover/popover.d.ts.map +1 -1
- package/dist/components/ui/popover/popover.js +1 -22
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable/resizable.js +12 -6
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts +4 -6
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +31 -32
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/text-link/index.d.ts.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.d.ts +1 -1
- package/dist/components/ui/toggle-group/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js +2 -7
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts +17 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +40 -20
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/index.d.ts +1 -1
- package/dist/components/ui/trace/index.d.ts.map +1 -1
- package/dist/components/ui/trace/index.js +1 -1
- package/dist/components/ui/trace/trace.d.ts +44 -3
- package/dist/components/ui/trace/trace.d.ts.map +1 -1
- package/dist/components/ui/trace/trace.js +87 -15
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/index.js +34 -28
- package/dist/lib/accent-presets.d.ts +7 -4
- package/dist/lib/accent-presets.d.ts.map +1 -1
- package/dist/lib/accent-presets.js +10 -5
- package/dist/lib/accent-presets.js.map +1 -1
- package/dist/lib/accent-roles.d.ts +20 -1
- package/dist/lib/accent-roles.d.ts.map +1 -1
- package/dist/lib/accent-roles.js +34 -26
- 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 +4 -4
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/async-action.d.ts +42 -0
- package/dist/lib/async-action.d.ts.map +1 -0
- package/dist/lib/async-action.js +61 -0
- package/dist/lib/async-action.js.map +1 -0
- package/dist/lib/breakpoints.d.ts +8 -0
- package/dist/lib/breakpoints.d.ts.map +1 -0
- package/dist/lib/breakpoints.js +11 -0
- package/dist/lib/breakpoints.js.map +1 -0
- package/dist/lib/bytes.d.ts +8 -0
- package/dist/lib/bytes.d.ts.map +1 -0
- package/dist/lib/bytes.js +20 -0
- package/dist/lib/bytes.js.map +1 -0
- package/dist/lib/clipboard.d.ts +13 -0
- package/dist/lib/clipboard.d.ts.map +1 -1
- package/dist/lib/clipboard.js +32 -1
- package/dist/lib/clipboard.js.map +1 -1
- package/dist/lib/events.d.ts +14 -0
- package/dist/lib/events.d.ts.map +1 -0
- package/dist/lib/events.js +16 -0
- package/dist/lib/events.js.map +1 -0
- package/dist/lib/external-link.d.ts +19 -0
- package/dist/lib/external-link.d.ts.map +1 -0
- package/dist/lib/external-link.js +27 -0
- package/dist/lib/external-link.js.map +1 -0
- package/dist/lib/font-catalog.d.ts +3 -6
- package/dist/lib/font-catalog.d.ts.map +1 -1
- package/dist/lib/font-catalog.js +16 -12
- package/dist/lib/font-catalog.js.map +1 -1
- package/dist/lib/font-zoom.d.ts +4 -4
- package/dist/lib/font-zoom.d.ts.map +1 -1
- package/dist/lib/font-zoom.js +9 -12
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/overlay.d.ts +29 -1
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +32 -16
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/preference-store.d.ts +13 -3
- package/dist/lib/preference-store.d.ts.map +1 -1
- package/dist/lib/preference-store.js +27 -37
- package/dist/lib/preference-store.js.map +1 -1
- package/dist/lib/resize-separator.d.ts +15 -0
- package/dist/lib/resize-separator.d.ts.map +1 -0
- package/dist/lib/resize-separator.js +23 -0
- package/dist/lib/resize-separator.js.map +1 -0
- package/dist/lib/safe-script.d.ts +19 -1
- package/dist/lib/safe-script.d.ts.map +1 -1
- package/dist/lib/safe-script.js +19 -1
- package/dist/lib/safe-script.js.map +1 -1
- package/dist/lib/scroll-geometry.d.ts +33 -0
- package/dist/lib/scroll-geometry.d.ts.map +1 -0
- package/dist/lib/scroll-geometry.js +48 -0
- package/dist/lib/scroll-geometry.js.map +1 -0
- package/dist/lib/text.d.ts +13 -0
- package/dist/lib/text.d.ts.map +1 -0
- package/dist/lib/text.js +30 -0
- package/dist/lib/text.js.map +1 -0
- package/dist/lib/theme-accents.d.ts +2 -0
- package/dist/lib/theme-accents.d.ts.map +1 -1
- package/dist/lib/theme-accents.js +2 -2
- package/dist/lib/theme-accents.js.map +1 -1
- package/dist/lib/theme-catalogue.d.ts.map +1 -1
- package/dist/lib/theme-catalogue.js +3 -4
- package/dist/lib/theme-catalogue.js.map +1 -1
- package/dist/lib/theme-css.d.ts +14 -1
- package/dist/lib/theme-css.d.ts.map +1 -1
- package/dist/lib/theme-css.js +25 -48
- package/dist/lib/theme-css.js.map +1 -1
- package/dist/lib/theme-defaults.d.ts +33 -5
- package/dist/lib/theme-defaults.d.ts.map +1 -1
- package/dist/lib/theme-defaults.generated.d.ts +1 -1
- package/dist/lib/theme-defaults.generated.d.ts.map +1 -1
- package/dist/lib/theme-defaults.generated.js.map +1 -1
- package/dist/lib/theme-defaults.js +59 -3
- package/dist/lib/theme-defaults.js.map +1 -1
- package/dist/lib/theme-engine-light.d.ts +6 -0
- package/dist/lib/theme-engine-light.d.ts.map +1 -1
- package/dist/lib/theme-engine-light.js +71 -57
- package/dist/lib/theme-engine-light.js.map +1 -1
- package/dist/lib/theme-engine.d.ts +20 -22
- package/dist/lib/theme-engine.d.ts.map +1 -1
- package/dist/lib/theme-engine.js +19 -6
- package/dist/lib/theme-engine.js.map +1 -1
- package/dist/lib/theme-records.d.ts +3 -3
- package/dist/lib/theme-records.d.ts.map +1 -1
- package/dist/lib/theme-records.js +20 -59
- package/dist/lib/theme-records.js.map +1 -1
- package/dist/lib/theme-types.d.ts +174 -0
- package/dist/lib/theme-types.d.ts.map +1 -0
- package/dist/lib/theme-types.js +105 -0
- package/dist/lib/theme-types.js.map +1 -0
- package/dist/lib/themes.d.ts +4 -159
- package/dist/lib/themes.d.ts.map +1 -1
- package/dist/lib/themes.js +14 -33
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +0 -1
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/url.d.ts +9 -0
- package/dist/lib/url.d.ts.map +1 -0
- package/dist/lib/url.js +24 -0
- package/dist/lib/url.js.map +1 -0
- package/dist/lib/version-notes.d.ts.map +1 -1
- package/dist/lib/version-notes.js +3 -10
- package/dist/lib/version-notes.js.map +1 -1
- package/dist/r/about-dialog.json +2 -1
- package/dist/r/action-button.json +2 -1
- package/dist/r/alert-dialog.json +1 -0
- package/dist/r/appearance-editor.json +1 -1
- package/dist/r/checkpoint.json +0 -2
- package/dist/r/code-block.json +1 -0
- package/dist/r/confirmation.json +0 -1
- package/dist/r/context-menu.json +2 -2
- package/dist/r/context.json +0 -1
- package/dist/r/conversation.json +6 -5
- package/dist/r/dialog.json +5 -0
- package/dist/r/drawer.json +0 -1
- package/dist/r/dropdown-menu.json +5 -0
- package/dist/r/lib.json +51 -1
- package/dist/r/menubar.json +2 -2
- package/dist/r/model-selector.json +0 -1
- package/dist/r/reasoning.json +2 -1
- package/dist/r/registry.json +120 -46
- package/dist/r/shell-top-bar.json +1 -0
- package/dist/r/sidebar-nav.json +5 -0
- package/dist/r/sources.json +2 -2
- package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +22 -42
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +9 -35
- package/dist/r/src/components/composites/action-button/action-button.tsx +5 -7
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -11
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +8 -5
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +8 -6
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +30 -82
- package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +11 -77
- package/dist/r/src/components/composites/appearance-editor/index.ts +1 -0
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +9 -13
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +16 -18
- package/dist/r/src/components/composites/chat/chat.tsx +2 -2
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +3 -3
- package/dist/r/src/components/composites/confirmation/confirmation-model.ts +9 -17
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +2 -2
- package/dist/r/src/components/composites/context/context-model.ts +1 -1
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +21 -39
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +5 -58
- package/dist/r/src/components/composites/file-tree/index.ts +1 -1
- package/dist/r/src/components/composites/help-center/help-center.tsx +8 -21
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +10 -11
- package/dist/r/src/components/composites/inline-citation/citation.ts +2 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +3 -2
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +30 -30
- package/dist/r/src/components/composites/message-scroller/scroll-anchor.ts +5 -5
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +3 -2
- package/dist/r/src/components/composites/model-selector/models.ts +1 -1
- package/dist/r/src/components/composites/plan/plan.tsx +1 -4
- package/dist/r/src/components/composites/queue/queue.tsx +8 -11
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +5 -23
- package/dist/r/src/components/composites/settings/settings-layout.tsx +3 -2
- package/dist/r/src/components/composites/settings/settings-navigation.tsx +4 -1
- package/dist/r/src/components/composites/sources/source.ts +7 -53
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -12
- package/dist/r/src/components/composites/subagent/subagent.tsx +7 -17
- package/dist/r/src/components/composites/suggestion/suggestion.tsx +4 -3
- package/dist/r/src/components/composites/task/task.tsx +21 -64
- package/dist/r/src/components/composites/terminal/terminal-model.ts +4 -4
- package/dist/r/src/components/composites/terminal/terminal.tsx +3 -12
- package/dist/r/src/components/composites/test-results/test-results.tsx +3 -12
- package/dist/r/src/components/composites/tool/tool.tsx +34 -40
- package/dist/r/src/components/composites/tree/tree-navigation.ts +22 -2
- package/dist/r/src/components/composites/tree/tree.tsx +47 -3
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +10 -14
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +66 -200
- package/dist/r/src/components/composites/update-dialog/update-model.ts +137 -0
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
- package/dist/r/src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx +1 -18
- package/dist/r/src/components/composites/workspace-switcher/workspace-switcher.tsx +16 -19
- package/dist/r/src/components/conversation/busy-send-button.tsx +7 -34
- package/dist/r/src/components/conversation/chat-composer.tsx +1 -1
- package/dist/r/src/components/conversation/composer-core.ts +76 -0
- package/dist/r/src/components/conversation/composer-menu.tsx +1 -1
- package/dist/r/src/components/conversation/conversation-pane.tsx +4 -1
- package/dist/r/src/components/conversation/conversation-surface.tsx +23 -10
- package/dist/r/src/components/conversation/ime-guard.ts +6 -0
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +24 -65
- package/dist/r/src/components/conversation/message-composer.tsx +24 -54
- package/dist/r/src/components/conversation/message-row.tsx +33 -47
- package/dist/r/src/components/conversation/paste-token-editor.tsx +13 -16
- package/dist/r/src/components/conversation/paste-tokens.ts +36 -1
- package/dist/r/src/components/conversation/scroll-follow-core.ts +66 -137
- package/dist/r/src/components/conversation/scroll-follow.ts +26 -67
- package/dist/r/src/components/conversation/thread-panel.tsx +2 -4
- package/dist/r/src/components/conversation/transcript-composition.tsx +9 -33
- package/dist/r/src/components/conversation/transcript-folding.ts +2 -2
- package/dist/r/src/components/conversation/transcript-grouping.ts +18 -3
- package/dist/r/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +80 -22
- package/dist/r/src/components/layout/contextual-sidebar/index.ts +1 -0
- package/dist/r/src/components/layout/contextual-sidebar/mobile-contextual-sidebar.tsx +1 -1
- package/dist/r/src/components/layout/floating-preview/model.ts +57 -195
- package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +6 -12
- package/dist/r/src/components/layout/shell-top-bar/shell-top-bar.tsx +47 -54
- package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -11
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +95 -107
- package/dist/r/src/components/layout/sidebar-nav/index.ts +1 -2
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +15 -0
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav-resize-handle.tsx +1 -4
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +9 -27
- package/dist/r/src/components/layout/split-layout/geometry.ts +2 -9
- package/dist/r/src/components/layout/split-layout/model.ts +3 -6
- package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +12 -6
- package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +12 -6
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +46 -61
- package/dist/r/src/components/layout/split-layout/tree.ts +5 -0
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +16 -38
- package/dist/r/src/components/layout/top-bar/window-chrome.ts +23 -0
- package/dist/r/src/components/motion/presence.tsx +1 -3
- package/dist/r/src/components/theme/appearance-panel.tsx +28 -19
- package/dist/r/src/components/theme/index.ts +1 -22
- package/dist/r/src/components/theme/lazy.ts +36 -26
- package/dist/r/src/components/theme/script-projection.ts +40 -0
- package/dist/r/src/components/theme/theme-api.ts +30 -0
- package/dist/r/src/components/theme/theme-catalogue-source.ts +3 -2
- package/dist/r/src/components/theme/theme-document.ts +248 -23
- package/dist/r/src/components/theme/theme-mode-toggle.tsx +1 -1
- package/dist/r/src/components/theme/theme-persistence.ts +74 -130
- package/dist/r/src/components/theme/theme-picker.tsx +2 -2
- package/dist/r/src/components/theme/theme-provider-value.ts +64 -69
- package/dist/r/src/components/theme/theme-provider.tsx +5 -24
- package/dist/r/src/components/theme/theme-script.ts +100 -47
- package/dist/r/src/components/theme/theme-state.ts +350 -10
- package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
- package/dist/r/src/components/theme/token-projection-options.ts +14 -0
- package/dist/r/src/components/theme/token-projection.ts +37 -0
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +43 -43
- package/dist/r/src/components/ui/attachment/attachment.tsx +4 -17
- package/dist/r/src/components/ui/avatar/avatar.tsx +3 -2
- package/dist/r/src/components/ui/board/board.tsx +4 -10
- package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
- package/dist/r/src/components/ui/chart/chart.tsx +0 -3
- package/dist/r/src/components/ui/code-block/code-block.tsx +7 -26
- package/dist/r/src/components/ui/command/command.tsx +43 -39
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +18 -168
- package/dist/r/src/components/ui/dialog/dialog-layer.tsx +266 -0
- package/dist/r/src/components/ui/dialog/dialog.tsx +77 -271
- package/dist/r/src/components/ui/drawer/drawer.tsx +5 -23
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +204 -226
- package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +220 -0
- package/dist/r/src/components/ui/field/field.tsx +1 -1
- package/dist/r/src/components/ui/field/number-field.tsx +1 -1
- package/dist/r/src/components/ui/hover-card/hover-card.tsx +4 -11
- package/dist/r/src/components/ui/menubar/menubar.tsx +36 -169
- package/dist/r/src/components/ui/message/message.tsx +0 -1
- package/dist/r/src/components/ui/message/parse-message-text.ts +80 -32
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -39
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +0 -1
- package/dist/r/src/components/ui/popover/popover.tsx +5 -11
- package/dist/r/src/components/ui/resizable/resizable.tsx +6 -16
- package/dist/r/src/components/ui/sheet/sheet.tsx +30 -42
- package/dist/r/src/components/ui/text-link/index.ts +0 -1
- package/dist/r/src/components/ui/toggle-group/toggle-group.tsx +3 -11
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +47 -26
- package/dist/r/src/components/ui/trace/index.ts +7 -0
- package/dist/r/src/components/ui/trace/trace.tsx +100 -9
- package/dist/r/src/lib/accent-presets.ts +12 -8
- package/dist/r/src/lib/accent-roles.ts +43 -29
- package/dist/r/src/lib/appearance-font-settings.ts +5 -5
- package/dist/r/src/lib/async-action.ts +72 -0
- package/dist/r/src/lib/breakpoints.ts +7 -0
- package/dist/r/src/lib/bytes.ts +20 -0
- package/dist/r/src/lib/clipboard.ts +43 -0
- package/dist/r/src/lib/events.ts +17 -0
- package/dist/r/src/lib/external-link.ts +42 -0
- package/dist/r/src/lib/font-catalog.ts +4 -6
- package/dist/r/src/lib/font-zoom.ts +9 -14
- package/dist/r/src/lib/overlay.ts +55 -18
- package/dist/r/src/lib/preference-store.ts +36 -34
- package/dist/r/src/lib/resize-separator.ts +36 -0
- package/dist/r/src/lib/safe-script.ts +19 -1
- package/dist/r/src/lib/scroll-geometry.ts +69 -0
- package/dist/r/src/lib/text.ts +49 -0
- package/dist/r/src/lib/theme-accents.ts +1 -1
- package/dist/r/src/lib/theme-catalogue.ts +3 -4
- package/dist/r/src/lib/theme-css.ts +33 -54
- package/dist/r/src/lib/theme-defaults.generated.ts +1 -1
- package/dist/r/src/lib/theme-defaults.ts +55 -7
- package/dist/r/src/lib/theme-engine-light.ts +88 -72
- package/dist/r/src/lib/theme-engine.ts +29 -33
- package/dist/r/src/lib/theme-records.ts +33 -69
- package/dist/r/src/lib/theme-types.ts +199 -0
- package/dist/r/src/lib/themes.ts +33 -196
- package/dist/r/src/lib/tokens.ts +0 -1
- package/dist/r/src/lib/url.ts +25 -0
- package/dist/r/src/lib/version-notes.ts +3 -9
- package/dist/r/src/styles/theme-variants.css +32 -32
- package/dist/r/src/styles/theme.css +17 -13
- package/dist/r/subagent.json +0 -2
- package/dist/r/suggestion.json +0 -1
- package/dist/r/theming.json +21 -21
- package/dist/r/top-bar.json +5 -0
- package/dist/r/trace.json +1 -0
- package/dist/r/update-dialog.json +5 -0
- package/package.json +22 -8
- package/registry.json +120 -46
- package/src/components/composites/about-dialog/about-dialog.tsx +22 -42
- package/src/components/composites/account-menu/account-menu.tsx +9 -35
- package/src/components/composites/action-button/action-button.tsx +5 -7
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -11
- package/src/components/composites/appearance-editor/appearance-choices.tsx +8 -5
- package/src/components/composites/appearance-editor/appearance-editor.tsx +8 -6
- package/src/components/composites/appearance-editor/appearance-rows.tsx +30 -82
- package/src/components/composites/appearance-editor/font-settings-group.tsx +11 -77
- package/src/components/composites/appearance-editor/index.ts +1 -0
- package/src/components/composites/catalog-browser/catalog-browser.tsx +9 -13
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +16 -18
- package/src/components/composites/chat/chat.tsx +2 -2
- package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/src/components/composites/checkpoint/checkpoint.tsx +3 -3
- package/src/components/composites/confirmation/confirmation-model.ts +9 -17
- package/src/components/composites/confirmation/confirmation.tsx +2 -2
- package/src/components/composites/context/context-model.ts +1 -1
- package/src/components/composites/file-tree/build-file-tree.ts +21 -39
- package/src/components/composites/file-tree/file-tree.tsx +5 -58
- package/src/components/composites/file-tree/index.ts +1 -1
- package/src/components/composites/help-center/help-center.tsx +8 -21
- package/src/components/composites/icon-picker/icon-picker.tsx +10 -11
- package/src/components/composites/inline-citation/citation.ts +2 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +3 -2
- package/src/components/composites/message-scroller/message-scroller.tsx +30 -30
- package/src/components/composites/message-scroller/scroll-anchor.ts +5 -5
- package/src/components/composites/model-selector/model-selector.tsx +3 -2
- package/src/components/composites/model-selector/models.ts +1 -1
- package/src/components/composites/plan/plan.tsx +1 -4
- package/src/components/composites/queue/queue.tsx +8 -11
- package/src/components/composites/reasoning/reasoning.tsx +5 -23
- package/src/components/composites/settings/settings-layout.tsx +3 -2
- package/src/components/composites/settings/settings-navigation.tsx +4 -1
- package/src/components/composites/sources/source.ts +7 -53
- package/src/components/composites/stack-trace/stack-trace.tsx +3 -12
- package/src/components/composites/subagent/subagent.tsx +7 -17
- package/src/components/composites/suggestion/suggestion.tsx +4 -3
- package/src/components/composites/task/task.tsx +21 -64
- package/src/components/composites/terminal/terminal-model.ts +4 -4
- package/src/components/composites/terminal/terminal.tsx +3 -12
- package/src/components/composites/test-results/test-results.tsx +3 -12
- package/src/components/composites/tool/tool.tsx +34 -40
- package/src/components/composites/tree/tree-navigation.ts +22 -2
- package/src/components/composites/tree/tree.tsx +47 -3
- package/src/components/composites/update-dialog/channel-control.tsx +10 -14
- package/src/components/composites/update-dialog/update-dialog.tsx +66 -200
- package/src/components/composites/update-dialog/update-model.ts +137 -0
- package/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
- package/src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx +1 -18
- package/src/components/composites/workspace-switcher/workspace-switcher.tsx +16 -19
- package/src/components/conversation/busy-send-button.tsx +7 -34
- package/src/components/conversation/chat-composer.tsx +1 -1
- package/src/components/conversation/composer-core.ts +76 -0
- package/src/components/conversation/composer-menu.tsx +1 -1
- package/src/components/conversation/conversation-pane.tsx +4 -1
- package/src/components/conversation/conversation-surface.tsx +23 -10
- package/src/components/conversation/ime-guard.ts +6 -0
- package/src/components/conversation/internal/chat-composer-shell.tsx +24 -65
- package/src/components/conversation/message-composer.tsx +24 -54
- package/src/components/conversation/message-row.tsx +33 -47
- package/src/components/conversation/paste-token-editor.tsx +13 -16
- package/src/components/conversation/paste-tokens.ts +36 -1
- package/src/components/conversation/scroll-follow-core.ts +66 -137
- package/src/components/conversation/scroll-follow.ts +26 -67
- package/src/components/conversation/thread-panel.tsx +2 -4
- package/src/components/conversation/transcript-composition.tsx +9 -33
- package/src/components/conversation/transcript-folding.ts +2 -2
- package/src/components/conversation/transcript-grouping.ts +18 -3
- package/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +80 -22
- package/src/components/layout/contextual-sidebar/index.ts +1 -0
- package/src/components/layout/contextual-sidebar/mobile-contextual-sidebar.tsx +1 -1
- package/src/components/layout/floating-preview/model.ts +57 -195
- package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +6 -12
- package/src/components/layout/shell-top-bar/shell-top-bar.tsx +47 -54
- package/src/components/layout/side-rail/side-rail-context.ts +1 -11
- package/src/components/layout/side-rail/side-rail.tsx +95 -107
- package/src/components/layout/sidebar-nav/index.ts +1 -2
- package/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +15 -0
- package/src/components/layout/sidebar-nav/sidebar-nav-resize-handle.tsx +1 -4
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +9 -27
- package/src/components/layout/split-layout/geometry.ts +2 -9
- package/src/components/layout/split-layout/model.ts +3 -6
- package/src/components/layout/split-layout/resize-controller-core-retry.tsx +12 -6
- package/src/components/layout/split-layout/resize-controller-core.tsx +12 -6
- package/src/components/layout/split-layout/split-layout.tsx +46 -61
- package/src/components/layout/split-layout/tree.ts +5 -0
- package/src/components/layout/top-bar/top-bar.tsx +16 -38
- package/src/components/layout/top-bar/window-chrome.ts +23 -0
- package/src/components/motion/presence.tsx +1 -3
- package/src/components/theme/appearance-panel.tsx +28 -19
- package/src/components/theme/index.ts +1 -22
- package/src/components/theme/lazy.ts +36 -26
- package/src/components/theme/script-projection.ts +40 -0
- package/src/components/theme/theme-api.ts +30 -0
- package/src/components/theme/theme-catalogue-source.ts +3 -2
- package/src/components/theme/theme-document.ts +248 -23
- package/src/components/theme/theme-mode-toggle.tsx +1 -1
- package/src/components/theme/theme-persistence.ts +74 -130
- package/src/components/theme/theme-picker.tsx +2 -2
- package/src/components/theme/theme-provider-value.ts +64 -69
- package/src/components/theme/theme-provider.tsx +5 -24
- package/src/components/theme/theme-script.ts +100 -47
- package/src/components/theme/theme-state.ts +350 -10
- package/src/components/theme/theme-toggle.tsx +1 -1
- package/src/components/theme/token-projection-options.ts +14 -0
- package/src/components/theme/token-projection.ts +37 -0
- package/src/components/ui/alert-dialog/alert-dialog.tsx +43 -43
- package/src/components/ui/attachment/attachment.tsx +4 -17
- package/src/components/ui/avatar/avatar.tsx +3 -2
- package/src/components/ui/board/board.tsx +4 -10
- package/src/components/ui/button-group/button-group.tsx +1 -1
- package/src/components/ui/chart/chart.tsx +0 -3
- package/src/components/ui/code-block/code-block.tsx +7 -26
- package/src/components/ui/command/command.tsx +43 -39
- package/src/components/ui/context-menu/context-menu.tsx +18 -168
- package/src/components/ui/dialog/dialog-layer.tsx +266 -0
- package/src/components/ui/dialog/dialog.tsx +77 -271
- package/src/components/ui/drawer/drawer.tsx +5 -23
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +204 -226
- package/src/components/ui/dropdown-menu/menu-parts.tsx +220 -0
- package/src/components/ui/field/field.tsx +1 -1
- package/src/components/ui/field/number-field.tsx +1 -1
- package/src/components/ui/hover-card/hover-card.tsx +4 -11
- package/src/components/ui/menubar/menubar.tsx +36 -169
- package/src/components/ui/message/message.tsx +0 -1
- package/src/components/ui/message/parse-message-text.ts +80 -32
- package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -39
- package/src/components/ui/navigation-menu/navigation-menu.tsx +0 -1
- package/src/components/ui/popover/popover.tsx +5 -11
- package/src/components/ui/resizable/resizable.tsx +6 -16
- package/src/components/ui/sheet/sheet.tsx +30 -42
- package/src/components/ui/text-link/index.ts +0 -1
- package/src/components/ui/toggle-group/toggle-group.tsx +3 -11
- package/src/components/ui/tooltip/tooltip.tsx +47 -26
- package/src/components/ui/trace/index.ts +7 -0
- package/src/components/ui/trace/trace.tsx +100 -9
- package/src/lib/accent-presets.ts +12 -8
- package/src/lib/accent-roles.ts +43 -29
- package/src/lib/appearance-font-settings.ts +5 -5
- package/src/lib/async-action.ts +72 -0
- package/src/lib/breakpoints.ts +7 -0
- package/src/lib/bytes.ts +20 -0
- package/src/lib/clipboard.ts +43 -0
- package/src/lib/events.ts +17 -0
- package/src/lib/external-link.ts +42 -0
- package/src/lib/font-catalog.ts +4 -6
- package/src/lib/font-zoom.ts +9 -14
- package/src/lib/overlay.ts +55 -18
- package/src/lib/preference-store.ts +36 -34
- package/src/lib/resize-separator.ts +36 -0
- package/src/lib/safe-script.ts +19 -1
- package/src/lib/scroll-geometry.ts +69 -0
- package/src/lib/text.ts +49 -0
- package/src/lib/theme-accents.ts +1 -1
- package/src/lib/theme-catalogue.ts +3 -4
- package/src/lib/theme-css.ts +33 -54
- package/src/lib/theme-defaults.generated.ts +1 -1
- package/src/lib/theme-defaults.ts +55 -7
- package/src/lib/theme-engine-light.ts +88 -72
- package/src/lib/theme-engine.ts +29 -33
- package/src/lib/theme-records.ts +33 -69
- package/src/lib/theme-types.ts +199 -0
- package/src/lib/themes.ts +33 -196
- package/src/lib/tokens.ts +0 -1
- package/src/lib/url.ts +25 -0
- package/src/lib/version-notes.ts +3 -9
- package/src/styles/theme-variants.css +32 -32
- package/src/styles/theme.css +17 -13
- package/dist/components/conversation/paste-preview.d.ts +0 -11
- package/dist/components/conversation/paste-preview.d.ts.map +0 -1
- package/dist/components/conversation/paste-preview.js +0 -27
- package/dist/components/conversation/paste-preview.js.map +0 -1
- package/dist/components/theme/theme-document-core.d.ts +0 -123
- package/dist/components/theme/theme-document-core.d.ts.map +0 -1
- package/dist/components/theme/theme-document-core.js.map +0 -1
- package/dist/components/theme/theme-provider-core.d.ts +0 -19
- package/dist/components/theme/theme-provider-core.d.ts.map +0 -1
- package/dist/components/theme/theme-provider-core.js +0 -27
- package/dist/components/theme/theme-provider-core.js.map +0 -1
- package/dist/components/theme/theme-provider-lazy.d.ts +0 -28
- package/dist/components/theme/theme-provider-lazy.d.ts.map +0 -1
- package/dist/components/theme/theme-provider-lazy.js +0 -35
- package/dist/components/theme/theme-provider-lazy.js.map +0 -1
- package/dist/components/theme/theme-state-core.d.ts +0 -248
- package/dist/components/theme/theme-state-core.d.ts.map +0 -1
- package/dist/components/theme/theme-state-core.js.map +0 -1
- package/dist/r/src/components/conversation/paste-preview.ts +0 -35
- package/dist/r/src/components/theme/theme-document-core.ts +0 -262
- package/dist/r/src/components/theme/theme-provider-core.tsx +0 -40
- package/dist/r/src/components/theme/theme-provider-lazy.tsx +0 -34
- package/dist/r/src/components/theme/theme-state-core.ts +0 -364
- package/src/components/conversation/paste-preview.ts +0 -35
- package/src/components/theme/theme-document-core.ts +0 -262
- package/src/components/theme/theme-provider-core.tsx +0 -40
- package/src/components/theme/theme-provider-lazy.tsx +0 -34
- package/src/components/theme/theme-state-core.ts +0 -364
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","names":["CircleAlert","Info","TriangleAlert","Show","splitProps","ComponentProps","JSX","Dynamic","cn","cva","VariantProps","ChatProps","header","Element","notices","composer","Chat","props","local","rest","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$spread","_$mergeProps","class","_$insert","children","ChatHeaderProps","Omit","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","ChatNoticeProps","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","ChatEmptyProps","suggestions","ChatEmpty","_el$15","_tmpl$9","_el$16","_el$17","_el$18","_tmpl$8","_$mergeProps","_$createComponent","_$memo","_$className"],"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.\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 /** The composer. */\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"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E,MAAMwC,WAAW;IAAA,OAAA2B;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAtD,OAAAkD,QAAArC,gBAG/EzC,MAAI;GAAA,IAAC0C,OAAI;IAAA,OAAE3B,MAAM6D;GAAW;GAAA,IAAA/C,WAAA;IAAA,OAAGd,MAAM6D;GAAW;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAE;CAAA,EAAA,CAAA;AAGvD"}
|
|
1
|
+
{"version":3,"file":"chat.js","names":["CircleAlert","Info","TriangleAlert","Show","splitProps","ComponentProps","JSX","Dynamic","cn","cva","VariantProps","ChatProps","header","Element","notices","composer","Chat","props","local","rest","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$spread","_$mergeProps","class","_$insert","children","ChatHeaderProps","Omit","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","ChatNoticeProps","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","ChatEmptyProps","suggestions","ChatEmpty","_el$15","_tmpl$9","_el$16","_el$17","_el$18","_tmpl$8","_$mergeProps","_$createComponent","_$memo","_$className"],"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,SAAgBgB,KAAKC,OAAkB;CACrC,MAAM,CAACC,OAAOC,QAAQf,WAAWa,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,OAGWrB,GACL,gIACAU,MAAMY,KACR;EAAC,EAAA,GACGX,IAAI,GAAA,OAAA,IAAA;EAAAY,OAAAT,aAE0BJ,MAAMN,MAAM;EAAAmB,OAAAP,aACEN,MAAM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A;EAAA,CAAA,GAAA,IAAA;EAAAE,aAAAC,UAAAZ,QAjBtDzD,GAAG,kCAAkC;GAC1C,0BAA0BU,MAAMkC,QAAQ,YAAY;GACpD,gBAAgBlC,MAAMkC,SAAS;GAC/B,oBAAoBlC,MAAMkC,SAAS;EACrC,CAAC,CAAC,CAAA;EAAA,OAAAW;CAAA,EAAA,CAAA;AAiBV;;AAUA,SAAgBiB,UAAU/D,OAAuB;CAC/C,MAAM,CAACC,OAAOC,QAAQf,WAAWa,OAAO;EAAC;EAAS;EAAS;EAAe;CAAa,CAAC;CACxF,cAAA;EAAA,IAAAgE,SAAAC,QAAA,GAAAC,SAAAF,OAAA1D,YAAA6D,SAAAD,OAAA5D;EAAAK,OAAAqD,QAAApD,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWrB,GACL,6GACAU,MAAMY,KACR;EAAC,EAAA,GACGX,IAAI,GAAA,OAAA,IAAA;EAAAY,OAAAqD,cAG+DlE,MAAMiB,KAAK;EAAAJ,OAAAoD,QAAAvC,gBAC/EzC,MAAI;GAAA,IAAC0C,OAAI;IAAA,OAAE3B,MAAMwC;GAAW;GAAA,IAAA1B,WAAA;IAAA,IAAAqD,SAAAC,QAAA;IAAAvD,OAAAsD,cACgCnE,MAAMwC,WAAW;IAAA,OAAA2B;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAtD,OAAAkD,QAAArC,gBAG/EzC,MAAI;GAAA,IAAC0C,OAAI;IAAA,OAAE3B,MAAM6D;GAAW;GAAA,IAAA/C,WAAA;IAAA,OAAGd,MAAM6D;GAAW;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAE;CAAA,EAAA,CAAA;AAGvD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { boundText } from "
|
|
1
|
+
import { boundText } from "../../../lib/text.js";
|
|
2
2
|
// src/components/composites/checkpoint/checkpoint-model.ts
|
|
3
3
|
/** The checkpoint's name as drawn; a blank label is the honest generic word. */
|
|
4
4
|
function checkpointLabel(label) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint-model.js","names":[],"sources":["../../../../src/components/composites/checkpoint/checkpoint-model.ts"],"sourcesContent":["import { boundText } from '
|
|
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"}
|
|
@@ -3,8 +3,8 @@ import { Button } from "../../ui/button/button.js";
|
|
|
3
3
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "../../ui/alert-dialog/alert-dialog.js";
|
|
4
4
|
import { Marker } from "../../ui/marker/marker.js";
|
|
5
5
|
import { Spinner } from "../../ui/spinner/spinner.js";
|
|
6
|
-
import {
|
|
7
|
-
import { boundText } from "
|
|
6
|
+
import { settleAction } from "../../../lib/async-action.js";
|
|
7
|
+
import { boundText } from "../../../lib/text.js";
|
|
8
8
|
import { checkpointLabel, checkpointStatus, restoreControl, restoreDialogCopy } from "./checkpoint-model.js";
|
|
9
9
|
import { className, createComponent, effect, insert, memo, mergeProps, setAttribute, spread, template, use } from "solid-js/web";
|
|
10
10
|
import { Flag } from "lucide-solid";
|
|
@@ -40,7 +40,7 @@ function Checkpoint(props) {
|
|
|
40
40
|
inflight = true;
|
|
41
41
|
setFailure(void 0);
|
|
42
42
|
setFollowed("restoring");
|
|
43
|
-
const result = await
|
|
43
|
+
const result = await settleAction(local.onRestore);
|
|
44
44
|
inflight = false;
|
|
45
45
|
if (result.ok) setFollowed("restored");
|
|
46
46
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.js","names":["Flag","createEffect","createMemo","createSignal","createUniqueId","on","Show","splitProps","ComponentProps","cn","Button","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogTitle","AlertDialogTrigger","Marker","Spinner","settleDecision","boundText","checkpointLabel","checkpointStatus","restoreControl","restoreDialogCopy","CheckpointState","CheckpointProps","Omit","label","time","state","onRestore","Promise","consequence","restoreLabel","disabledReason","error","Checkpoint","props","local","rest","uid","reasonId","followed","setFollowed","failure","setFailure","undefined","confirming","setConfirming","inflight","root","HTMLDivElement","status","HTMLParagraphElement","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","aria-disabled","aria-describedby","_$memo","title","description","onClick","_el$","_tmpl$","_el$2","firstChild","_$use","element","_$spread","_$mergeProps","data-state","class","_$insert","icon","tone","action","_$setAttribute","_$effect","_$className","_$createComponent","_$memo","_$mergeProps","_$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 { settleDecision } from '../confirmation/confirmation-model'\nimport { boundText } from '../sources/source'\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 settleDecision(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,SAAgBwC,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQpC,WAAWkC,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMI,WAAW,GADLzC,eACQwC,EAAG;CACvB,MAAM,CAACE,UAAUC,eAAe5C,aAA8B,MAAM;CACpE,MAAM,CAAC6C,SAASC,cAAc9C,aAAiC+C,KAAAA,CAAS;CACxE,MAAM,CAACC,YAAYC,iBAAiBjD,a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AA;GAAA,CAAA;EAAA;CAAA,CAAA,CAM3C;CAED,cAAA;EAAA,IAAAqD,OAAAC,OAAA,GAAAC,QAAAF,KAAAG;EAAAC,KAEUC,YAAazC,OAAOyC,SAAQL,IAAA;EAAAM,OAAAN,MAAAO,WAAA;GAAA,KAAA,gBAAA;IAAA,OAEtBhE,MAAM;GAAC;GAAA,KAAA,WAAA;IAAA,OACZS,MAAMyD;GAAK;EAAA,GACdxD,IAAI,GAAA,OAAA,IAAA;EAAAyD,OAAAV,MAAAf,gBAEPvD,QAAM;GACL8D,SAAO;GAAA,IACPmB,OAAI;IAAA,OAAA1B,gBAAG3E,MAAI,CAAA,CAAA;GAAA;GAAA,IACXsG,OAAI;IAAA,OAAErE,MAAM,MAAM,WAAW,WAAW;GAAS;GAAA,IACjDF,QAAK;IAAA,OAAEP,gBAAgBkB,MAAMX,KAAK;GAAC;GAAA,IACnCyD,cAAW;IAAA,OAAEF,WAAA,CAAA,CAAA5C,MAAMV,IAAI,CAAA,CAAA,IAAGT,UAAUmB,MAAMV,MAAM,EAAE,IAAIkB,KAAAA;GAAS;GAAA,IAC/DqD,SAAM;IAAA,OAAE7B,cAAc;GAAC;EAAA,CAAA,GAAAkB,KAAA;EAAAE,KAMjBC,YAAavC,SAASuC,SAAQH,KAAA;EAAAY,aAAAZ,OAAA,MADhC/C,QAAQ;EAAAuD,OAAAR,OASXhC,UAAU;EAAA6C,aAAAC,UAAAd,OALJnF,GAAG,iEAAiE;GACzE,oBAAoBwB,MAAM,MAAM;GAChC,yBAAyBA,MAAM,MAAM;EACvC,CAAC,CAAC,CAAA;EAAA,OAAAyD;CAAA,EAAA,CAAA;AAMV"}
|
|
1
|
+
{"version":3,"file":"checkpoint.js","names":["Flag","createEffect","createMemo","createSignal","createUniqueId","on","Show","splitProps","ComponentProps","cn","Button","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogTitle","AlertDialogTrigger","Marker","Spinner","settleAction","boundText","checkpointLabel","checkpointStatus","restoreControl","restoreDialogCopy","CheckpointState","CheckpointProps","Omit","label","time","state","onRestore","Promise","consequence","restoreLabel","disabledReason","error","Checkpoint","props","local","rest","uid","reasonId","followed","setFollowed","failure","setFailure","undefined","confirming","setConfirming","inflight","root","HTMLDivElement","status","HTMLParagraphElement","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","aria-disabled","aria-describedby","_$memo","title","description","onClick","_el$","_tmpl$","_el$2","firstChild","_$use","element","_$spread","_$mergeProps","data-state","class","_$insert","icon","tone","action","_$setAttribute","_$effect","_$className","_$createComponent","_$memo","_$mergeProps","_$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,SAAgBwC,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQpC,WAAWkC,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMI,WAAW,GADLzC,eACQwC,EAAG;CACvB,MAAM,CAACE,UAAUC,eAAe5C,aAA8B,MAAM;CACpE,MAAM,CAAC6C,SAASC,cAAc9C,aAAiC+C,KAAAA,CAAS;CACxE,MAAM,CAACC,YAAYC,iBAAiBjD,aAAa,KAAK;CACtD,IAAIkD,WAAW;CACf,IAAIC;CACJ,IAAIE;CAEJ,MAAMvB,cAA+BS,MAAMT,SAASa,SAAS;CAC7D,MAAMP,cAAcG,MAAMH,SAASS,QAAQ;CAC3C,MAAMU,gBAAgBhC,eAAegB,MAAMR,cAAcgB,KAAAA,GAAWjB,MAAM,GAAGS,MAAMJ,cAAc;CACjG,MAAMqB,aAAahC,kBAAkBe,MAAMX,OAAOW,MAAMN,WAAW;CACnE,MAAMwB,mBAAmBnC,iBAAiBQ,MAAM,GAAGM,MAAM,GAAGG,MAAMJ,cAAc;CAEhF,MAAMuB,UAAU,YAAY;EAC1B,IAAIR,YAAYK,QAAQ,CAAC,CAACI,UAAU;EACpCT,WAAW;EACXJ,WAAWC,KAAAA,CAAS;EACpBH,YAAY,WAAW;EACvB,MAAMgB,SAAS,MAAMzC,aAAaoB,MAAMR,SAAS;EACjDmB,WAAW;EACX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AAEF,WAAA,CAAA,CAAA5C,MAAMV,IAAI,CAAA,CAAA,IAAGT,UAAUmB,MAAMV,MAAM,EAAE,IAAIkB,KAAAA;GAAS;GAAA,IAC/DqD,SAAM;IAAA,OAAE7B,cAAc;GAAC;EAAA,CAAA,GAAAkB,KAAA;EAAAE,KAMjBC,YAAavC,SAASuC,SAAQH,KAAA;EAAAY,aAAAZ,OAAA,MADhC/C,QAAQ;EAAAuD,OAAAR,OASXhC,UAAU;EAAA6C,aAAAC,UAAAd,OALJnF,GAAG,iEAAiE;GACzE,oBAAoBwB,MAAM,MAAM;GAChC,yBAAyBA,MAAM,MAAM;EACvC,CAAC,CAAC,CAAA;EAAA,OAAAyD;CAAA,EAAA,CAAA;AAMV"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SettledAction } from '#lib/async-action';
|
|
1
2
|
/**
|
|
2
3
|
* Where a request for approval stands.
|
|
3
4
|
*
|
|
@@ -17,18 +18,8 @@ export declare function isAwaitingAnswer(state: ConfirmationState): boolean;
|
|
|
17
18
|
* "by Ana" is a fact only the host knows.
|
|
18
19
|
*/
|
|
19
20
|
export declare function confirmationOutcome(state: ConfirmationState, by?: string, at?: string): string | undefined;
|
|
20
|
-
export type DecisionResult =
|
|
21
|
-
|
|
22
|
-
} | {
|
|
23
|
-
ok: false;
|
|
24
|
-
message: string;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Run a host handler that may be synchronous, asynchronous, or throw, and report
|
|
28
|
-
* the outcome as data. A rejection's own message is shown (bounded) because the
|
|
29
|
-
* host usually knows why; a non-Error rejection gets a plain sentence instead of
|
|
30
|
-
* "[object Object]".
|
|
31
|
-
*/
|
|
21
|
+
export type DecisionResult = SettledAction;
|
|
22
|
+
/** `settleAction` with the confirmation's own sentence for a non-Error rejection. */
|
|
32
23
|
export declare function settleDecision(handler: (() => void | Promise<void>) | undefined): Promise<DecisionResult>;
|
|
33
24
|
/**
|
|
34
25
|
* Why a choice is not available, in words. A host `disabledReason` outranks the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation-model.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/confirmation/confirmation-model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"confirmation-model.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/confirmation/confirmation-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGpE;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAA;AAE/F,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAElE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,EACxB,EAAE,CAAC,EAAE,MAAM,EACX,EAAE,CAAC,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAapB;AAED,MAAM,MAAM,cAAc,GAAG,aAAa,CAAA;AAI1C,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,GAChD,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,KAAK,EAAE,iBAAiB,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,OAAO,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,MAAM,GAAG,SAAS,CAQrB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { settleAction } from "../../../lib/async-action.js";
|
|
2
|
+
import { boundText } from "../../../lib/text.js";
|
|
2
3
|
// src/components/composites/confirmation/confirmation-model.ts
|
|
3
4
|
/** Whether the choice is still open, which is exactly when the buttons are drawn. */
|
|
4
5
|
function isAwaitingAnswer(state) {
|
|
@@ -17,22 +18,9 @@ function confirmationOutcome(state, by, at) {
|
|
|
17
18
|
return `${base}${who ? ` by ${who}` : ""}${when ? ` at ${when}` : ""}`;
|
|
18
19
|
}
|
|
19
20
|
var DEFAULT_FAILURE = "Your answer could not be sent. Try again.";
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* host usually knows why; a non-Error rejection gets a plain sentence instead of
|
|
24
|
-
* "[object Object]".
|
|
25
|
-
*/
|
|
26
|
-
async function settleDecision(handler) {
|
|
27
|
-
try {
|
|
28
|
-
await handler?.();
|
|
29
|
-
return { ok: true };
|
|
30
|
-
} catch (error) {
|
|
31
|
-
return {
|
|
32
|
-
ok: false,
|
|
33
|
-
message: (error instanceof Error ? boundText(error.message, 200) : "") || DEFAULT_FAILURE
|
|
34
|
-
};
|
|
35
|
-
}
|
|
21
|
+
/** `settleAction` with the confirmation's own sentence for a non-Error rejection. */
|
|
22
|
+
function settleDecision(handler) {
|
|
23
|
+
return settleAction(handler, DEFAULT_FAILURE);
|
|
36
24
|
}
|
|
37
25
|
/**
|
|
38
26
|
* Why a choice is not available, in words. A host `disabledReason` outranks the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation-model.js","names":[],"sources":["../../../../src/components/composites/confirmation/confirmation-model.ts"],"sourcesContent":["import { boundText } from '
|
|
1
|
+
{"version":3,"file":"confirmation-model.js","names":[],"sources":["../../../../src/components/composites/confirmation/confirmation-model.ts"],"sourcesContent":["import { settleAction, type SettledAction } from '#lib/async-action'\nimport { REASON_TEXT_LIMIT, boundText } from '#lib/text'\n\n/**\n * Where a request for approval stands.\n *\n * - `requested`: waiting on the reader. The only state with live buttons.\n * - `approved` / `denied`: settled; the record of the answer.\n * - `expired`: nobody can answer it any more (the run moved on, a timeout).\n * - `unavailable`: it is still open, but this client cannot answer it right now\n * (offline, no authority, another client holds it). The buttons stay visible and\n * disabled so the reader can see what was asked and why they cannot answer.\n */\nexport type ConfirmationState = 'requested' | 'approved' | 'denied' | 'expired' | 'unavailable'\n\n/** Whether the choice is still open, which is exactly when the buttons are drawn. */\nexport function isAwaitingAnswer(state: ConfirmationState): boolean {\n return state === 'requested' || state === 'unavailable'\n}\n\n/**\n * The one line that replaces the buttons once the request settles. Who and when\n * appear only if the host supplied them: \"Approved\" is a fact the state gives,\n * \"by Ana\" is a fact only the host knows.\n */\nexport function confirmationOutcome(\n state: ConfirmationState,\n by?: string,\n at?: string\n): string | undefined {\n const base =\n state === 'approved'\n ? 'Approved'\n : state === 'denied'\n ? 'Denied'\n : state === 'expired'\n ? 'Expired without an answer'\n : undefined\n if (base === undefined) return undefined\n const who = by ? boundText(by, 60) : ''\n const when = at ? boundText(at, 40) : ''\n return `${base}${who ? ` by ${who}` : ''}${when ? ` at ${when}` : ''}`\n}\n\nexport type DecisionResult = SettledAction\n\nconst DEFAULT_FAILURE = 'Your answer could not be sent. Try again.'\n\n/** `settleAction` with the confirmation's own sentence for a non-Error rejection. */\nexport function settleDecision(\n handler: (() => void | Promise<void>) | undefined\n): Promise<DecisionResult> {\n return settleAction(handler, DEFAULT_FAILURE)\n}\n\n/**\n * Why a choice is not available, in words. A host `disabledReason` outranks the\n * built-in sentence for a missing handler, and a request that is `unavailable`\n * without a reason still says so rather than showing dead buttons.\n */\nexport function decisionReason(options: {\n state: ConfirmationState\n disabledReason?: string\n hasHandler: boolean\n unavailableFallback: string\n missingFallback: string\n}): string | undefined {\n const hostReason = options.disabledReason\n ? boundText(options.disabledReason, REASON_TEXT_LIMIT)\n : ''\n if (hostReason) return hostReason\n if (options.state === 'unavailable') return options.unavailableFallback\n if (!options.hasHandler) return options.missingFallback\n return undefined\n}\n"],"mappings":";;;;AAgBA,SAAgB,iBAAiB,OAAmC;CAClE,OAAO,UAAU,eAAe,UAAU;AAC5C;;;;;;AAOA,SAAgB,oBACd,OACA,IACA,IACoB;CACpB,MAAM,OACJ,UAAU,aACN,aACA,UAAU,WACR,WACA,UAAU,YACR,8BACA,KAAA;CACV,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAC/B,MAAM,MAAM,KAAK,UAAU,IAAI,EAAE,IAAI;CACrC,MAAM,OAAO,KAAK,UAAU,IAAI,EAAE,IAAI;CACtC,OAAO,GAAG,OAAO,MAAM,OAAO,QAAQ,KAAK,OAAO,OAAO,SAAS;AACpE;AAIA,IAAM,kBAAkB;;AAGxB,SAAgB,eACd,SACyB;CACzB,OAAO,aAAa,SAAS,eAAe;AAC9C;;;;;;AAOA,SAAgB,eAAe,SAMR;CACrB,MAAM,aAAa,QAAQ,iBACvB,UAAU,QAAQ,gBAAA,GAAiC,IACnD;CACJ,IAAI,YAAY,OAAO;CACvB,IAAI,QAAQ,UAAU,eAAe,OAAO,QAAQ;CACpD,IAAI,CAAC,QAAQ,YAAY,OAAO,QAAQ;AAE1C"}
|
|
@@ -3,7 +3,7 @@ import { Button } from "../../ui/button/button.js";
|
|
|
3
3
|
import { CodeBlock } from "../../ui/code-block/code-block.js";
|
|
4
4
|
import { DiffBlock } from "../../ui/diff-block/diff-block.js";
|
|
5
5
|
import { Spinner } from "../../ui/spinner/spinner.js";
|
|
6
|
-
import { boundText } from "
|
|
6
|
+
import { boundText } from "../../../lib/text.js";
|
|
7
7
|
import { confirmationOutcome, decisionReason, isAwaitingAnswer, settleDecision } from "./confirmation-model.js";
|
|
8
8
|
import { createComponent, insert, memo, mergeProps, setAttribute, spread, template, use } from "solid-js/web";
|
|
9
9
|
import { Ban, Check, Clock, Lock, ShieldQuestion } from "lucide-solid";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation.js","names":["Ban","Check","Clock","Lock","ShieldQuestion","createEffect","createSignal","createUniqueId","Show","splitProps","ComponentProps","JSX","cn","Button","CodeBlock","DiffBlock","Spinner","boundText","confirmationOutcome","decisionReason","isAwaitingAnswer","settleDecision","ConfirmationState","ConfirmationDetails","Readonly","kind","code","language","title","patch","ConfirmationProps","Omit","state","description","details","onApprove","Promise","onDeny","approveLabel","denyLabel","disabledReason","error","resolvedBy","resolvedAt","children","Element","Choice","Confirmation","props","local","rest","uid","titleId","reasonId","awaiting","pending","setPending","undefined","failure","setFailure","inflight","root","HTMLElement","outcome","HTMLParagraphElement","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","data-state","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","Extract","complete","wrap","maxHeight","diff","_el$11","_tmpl$8","_$mergeProps","_$createComponent","_$memo"],"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 { boundText } from '../sources/source'\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, 240) : 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<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />\n </div>\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyFA,SAAgB+C,aAAaC,OAA0B;CACrD,MAAM,CAACC,OAAOC,QAAQzC,WAAWuC,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CACD,MAAMG,MAAM5C,eAAe;CAC3B,MAAM6C,UAAU,GAAGD,IAAG;CACtB,MAAME,WAAW,GAAGF,IAAG;CACvB,MAAMnB,cAAiCiB,MAAMjB,SAAS;CACtD,MAAMsB,iBAAiBlC,iBAAiBY,MAAM,CAAC;CAC/C,MAAM,CAACuB,SAASC,cAAclD,aAAiCmD,KAAAA,CAAS;CACxE,MAAM,CAACC,SAASC,cAAcrD,aAAiCmD,KAAAA,CAAS;CACxE,IAAIG,WAAW;CACf,IAAIC;CACJ,IAAIE;CAEJ,MAAME,aAAaC,SAAmDC,YAAoB;EACxF,IAAIZ,QAAQ,MAAME,KAAAA,GAAW,OAAO;EACpC,OAAOtC,eAAe;GACpBa,OAAOA,MAAM;GACbQ,gBAAgBS,MAAMT;GACtB4B,YAAYF,YAAYT,KAAAA;GACxBY,qBAAqB;GACrBC,iBAAiBH;EACnB,CAAC;CACH;CACA,MAAMI,sBAAsBN,UAAUhB,MAAMd,WAAW,kCAAkC;CACzF,MAAMqC,mBAAmBP,UAAUhB,MAAMZ,QAAQ,gCAAgC;CAEjF,MAAMoC,gBAAgB,CAAC,GAAG,IAAIC,IAAI,CAACH,cAAc,GAAGC,WAAW,CAAC,CAAC,CAACG,OAAOC,OAAO,CAAC,CAAC,CAAC,CAACC,KAAK,GAAG;CAC5F,MAAMpC,cAAeQ,MAAMR,QAAQxB,UAAUgC,MAAMR,OAAO,GAAG,IAAIiB,QAAQ;CAEzE,MAAMoB,SAAS,OAAOC,WAAmB;EACvC,MAAMb,UAAUa,WAAW,YA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D,QAAQrH,UAAUqH,OAAOC,KAAK,KAAK9E,KAAAA,IAAYA,KAAAA;AACxD;AAEA,SAAS4D,QAAQrE,OAAyC;CACxD,OAAA+D,gBACGvG,MAAI;EAAA,IACHwG,OAAI;GAAA,OAAEoB,WAAApF,MAAMd,QAAQT,SAAS,MAAM,CAAA,CAAA,KAAIuB,MAAMd;EAAO;EAAA,IACpDoF,WAAQ;GAAA,OAAAP,gBACLjG,WAAS;IACRoH,MAAI;IAAA,IACJxG,OAAI;KAAA,OAAGsB,MAAMd,QAA2DR;IAAI;IAAA,IAC5EC,WAAQ;KAAA,OAAE0G,QACPrF,MAAMd,QAA2DP,UAClE,EACF;IAAC;IAAA,IACDC,QAAK;KAAA,OAAEyG,QAAQrF,MAAMd,QAAQN,OAAO,EAAE;IAAC;IACvC6G,UAAQ;IACRC,MAAI;IACJC,WAAS;GAAA,CAAA;EAAA;EAAA/F,WAIXgG,gBAEA;GAAA,IAAAC,SAAAC,QAAA;GAAAhC,OAAA+B,QAAA9B,gBAOGhG,WAAS;IAAA,IACRc,QAAK;KAAA,OAAG+G,KAAK,CAAC,CAAoD/G;IAAK;IAAA,IACvED,QAAK;KAAA,OAAEyG,QAAQO,KAAK,CAAC,CAAChH,OAAO,EAAE;IAAC;IAChC6G,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","ComponentProps","JSX","cn","Button","CodeBlock","DiffBlock","Spinner","REASON_TEXT_LIMIT","boundText","confirmationOutcome","decisionReason","isAwaitingAnswer","settleDecision","ConfirmationState","ConfirmationDetails","Readonly","kind","code","language","title","patch","ConfirmationProps","Omit","state","description","details","onApprove","Promise","onDeny","approveLabel","denyLabel","disabledReason","error","resolvedBy","resolvedAt","children","Element","Choice","Confirmation","props","local","rest","uid","titleId","reasonId","awaiting","pending","setPending","undefined","failure","setFailure","inflight","root","HTMLElement","outcome","HTMLParagraphElement","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","data-state","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","Extract","complete","wrap","maxHeight","diff","_el$11","_tmpl$8","_$mergeProps","_$createComponent","_$memo"],"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<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />\n </div>\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyFA,SAAgBgD,aAAaC,OAA0B;CAC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AAA,OAAEoB,WAAApF,MAAMd,QAAQT,SAAS,MAAM,CAAA,CAAA,KAAIuB,MAAMd;EAAO;EAAA,IACpDoF,WAAQ;GAAA,OAAAP,gBACLlG,WAAS;IACRqH,MAAI;IAAA,IACJxG,OAAI;KAAA,OAAGsB,MAAMd,QAA2DR;IAAI;IAAA,IAC5EC,WAAQ;KAAA,OAAE0G,QACPrF,MAAMd,QAA2DP,UAClE,EACF;IAAC;IAAA,IACDC,QAAK;KAAA,OAAEyG,QAAQrF,MAAMd,QAAQN,OAAO,EAAE;IAAC;IACvC6G,UAAQ;IACRC,MAAI;IACJC,WAAS;GAAA,CAAA;EAAA;EAAA/F,WAIXgG,gBAEA;GAAA,IAAAC,SAAAC,QAAA;GAAAhC,OAAA+B,QAAA9B,gBAOGjG,WAAS;IAAA,IACRe,QAAK;KAAA,OAAG+G,KAAK,CAAC,CAAoD/G;IAAK;IAAA,IACvED,QAAK;KAAA,OAAEyG,QAAQO,KAAK,CAAC,CAAChH,OAAO,EAAE;IAAC;IAChC6G,UAAQ;GAAA,CAAA,CAAA;GAAA,OAAAI;EAAA,EAAA,CAAA;CAGb,CAAA;AAGP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { boundText } from "
|
|
1
|
+
import { boundText } from "../../../lib/text.js";
|
|
2
2
|
// src/components/composites/context/context-model.ts
|
|
3
3
|
/** A usable figure: a finite, non-negative number. NaN, Infinity and negatives are "unknown". */
|
|
4
4
|
function isFigure(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-model.js","names":[],"sources":["../../../../src/components/composites/context/context-model.ts"],"sourcesContent":["import { boundText } from '
|
|
1
|
+
{"version":3,"file":"context-model.js","names":[],"sources":["../../../../src/components/composites/context/context-model.ts"],"sourcesContent":["import { boundText } from '#lib/text'\n\n/**\n * The figures a host may know about a context window. Every one is optional and\n * means \"the host told us\", so absence is never rendered as zero: `used: 0` is a\n * fresh conversation, a missing `used` is an unknown.\n */\nexport type ContextBreakdown = Readonly<{\n input?: number\n output?: number\n cacheRead?: number\n cacheWrite?: number\n reasoning?: number\n}>\n\nexport type ContextCost = Readonly<{\n amount: number\n /** An ISO 4217 code such as `USD`. Without one the amount is shown unlabelled. */\n currency?: string\n}>\n\nexport type ContextFigures = Readonly<{\n /** Tokens in the window now. */\n used?: number\n /** The window's size. */\n total?: number\n breakdown?: ContextBreakdown\n cost?: ContextCost\n}>\n\n/** A usable figure: a finite, non-negative number. NaN, Infinity and negatives are \"unknown\". */\nexport function isFigure(value: number | undefined): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= 0\n}\n\nconst BREAKDOWN_ROWS = [\n ['input', 'Input'],\n ['output', 'Output'],\n ['cacheRead', 'Cache read'],\n ['cacheWrite', 'Cache write'],\n ['reasoning', 'Reasoning'],\n] as const\n\n/** The breakdown entries the host actually supplied, in a fixed reading order. */\nexport function breakdownRows(\n breakdown: ContextBreakdown | undefined\n): readonly { key: string; label: string; value: number }[] {\n if (!breakdown) return []\n const rows: { key: string; label: string; value: number }[] = []\n for (const [key, label] of BREAKDOWN_ROWS) {\n const value = breakdown[key]\n if (isFigure(value)) rows.push({ key, label, value })\n }\n return rows\n}\n\n/**\n * Whether there is anything to show. When there is not, the trigger is not\n * rendered at all: an empty gauge or \"0%\" would assert an empty window.\n */\nexport function hasContextFigures(figures: ContextFigures): boolean {\n return (\n isFigure(figures.used) ||\n isFigure(figures.total) ||\n breakdownRows(figures.breakdown).length > 0 ||\n (figures.cost !== undefined && isFigure(figures.cost.amount))\n )\n}\n\n/**\n * Percentage of the window used, rounded. Needs both figures and a non-empty\n * window; it is not clamped, because \"112%\" is the truth about an overrun and a\n * clamp would hide it (the ring is what saturates, not the number).\n */\nexport function contextPercent(\n used: number | undefined,\n total: number | undefined\n): number | undefined {\n if (!isFigure(used) || !isFigure(total) || total <= 0) return undefined\n return Math.round((used / total) * 100)\n}\n\nexport type ContextLevel = 'normal' | 'high' | 'critical' | 'full'\n\n/**\n * How full, in steps. The step changes an icon and a word as well as a colour, so\n * it reads without colour vision and in a screen reader.\n */\nexport function contextLevel(percent: number | undefined): ContextLevel {\n if (percent === undefined) return 'normal'\n if (percent >= 100) return 'full'\n if (percent >= 90) return 'critical'\n if (percent >= 75) return 'high'\n return 'normal'\n}\n\nexport function contextLevelWord(level: ContextLevel): string | undefined {\n switch (level) {\n case 'high':\n return 'Getting full'\n case 'critical':\n return 'Nearly full'\n case 'full':\n return 'Full'\n case 'normal':\n return undefined\n }\n}\n\n/** Compact token count for the trigger: 950, 1.2K, 48.2K, 1.3M. */\nexport function formatTokens(value: number, locale = 'en-US'): string {\n return new Intl.NumberFormat(locale, { notation: 'compact', maximumFractionDigits: 1 }).format(\n value\n )\n}\n\n/** The exact count for the popover. */\nexport function formatExact(value: number, locale = 'en-US'): string {\n return new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(value)\n}\n\n/**\n * Money, with its currency symbol when the code is valid. An unrecognised code\n * (`Intl` throws a RangeError) is shown as written, bounded, rather than being\n * swapped for a currency the host never named.\n */\nexport function formatCost(cost: ContextCost, locale = 'en-US'): string {\n const digits = { minimumFractionDigits: 2, maximumFractionDigits: cost.amount < 1 ? 4 : 2 }\n if (!cost.currency) return new Intl.NumberFormat(locale, digits).format(cost.amount)\n try {\n return new Intl.NumberFormat(locale, {\n ...digits,\n style: 'currency',\n currency: cost.currency,\n }).format(cost.amount)\n } catch {\n return `${new Intl.NumberFormat(locale, digits).format(cost.amount)} ${boundText(cost.currency, 8)}`\n }\n}\n\n/**\n * The trigger's accessible name: the whole claim in words. Percent when both\n * figures are known, else the most informative thing that is.\n */\nexport function contextLabel(figures: ContextFigures, locale = 'en-US'): string | undefined {\n const percent = contextPercent(figures.used, figures.total)\n if (percent !== undefined) {\n const word = contextLevelWord(contextLevel(percent))\n return `${percent}% of context used${word ? `, ${word.toLowerCase()}` : ''}`\n }\n if (isFigure(figures.used)) return `${formatTokens(figures.used, locale)} tokens used`\n if (isFigure(figures.total)) return `${formatTokens(figures.total, locale)} token context window`\n if (breakdownRows(figures.breakdown).length > 0) return 'Token usage'\n if (figures.cost && isFigure(figures.cost.amount))\n return `Cost ${formatCost(figures.cost, locale)}`\n return undefined\n}\n\n/** The short visible text inside the trigger. Always a prefix-compatible part of `contextLabel`. */\nexport function contextShort(figures: ContextFigures, locale = 'en-US'): string | undefined {\n const percent = contextPercent(figures.used, figures.total)\n if (percent !== undefined) return `${percent}%`\n if (isFigure(figures.used)) return formatTokens(figures.used, locale)\n if (isFigure(figures.total)) return formatTokens(figures.total, locale)\n if (breakdownRows(figures.breakdown).length > 0) return 'Usage'\n if (figures.cost && isFigure(figures.cost.amount)) return formatCost(figures.cost, locale)\n return undefined\n}\n"],"mappings":";;;AA+BA,SAAgB,SAAS,OAA4C;CACnE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,SAAS;AACzE;AAEA,IAAM,iBAAiB;CACrB,CAAC,SAAS,OAAO;CACjB,CAAC,UAAU,QAAQ;CACnB,CAAC,aAAa,YAAY;CAC1B,CAAC,cAAc,aAAa;CAC5B,CAAC,aAAa,WAAW;AAC3B;;AAGA,SAAgB,cACd,WAC0D;CAC1D,IAAI,CAAC,WAAW,OAAO,CAAC;CACxB,MAAM,OAAwD,CAAC;CAC/D,KAAK,MAAM,CAAC,KAAK,UAAU,gBAAgB;EACzC,MAAM,QAAQ,UAAU;EACxB,IAAI,SAAS,KAAK,GAAG,KAAK,KAAK;GAAE;GAAK;GAAO;EAAM,CAAC;CACtD;CACA,OAAO;AACT;;;;;AAMA,SAAgB,kBAAkB,SAAkC;CAClE,OACE,SAAS,QAAQ,IAAI,KACrB,SAAS,QAAQ,KAAK,KACtB,cAAc,QAAQ,SAAS,CAAC,CAAC,SAAS,KACzC,QAAQ,SAAS,KAAA,KAAa,SAAS,QAAQ,KAAK,MAAM;AAE/D;;;;;;AAOA,SAAgB,eACd,MACA,OACoB;CACpB,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,K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eAAe,QAAQ,MAAM,QAAQ,KAAK;CAC1D,IAAI,YAAY,KAAA,GAAW;EACzB,MAAM,OAAO,iBAAiB,aAAa,OAAO,CAAC;EACnD,OAAO,GAAG,QAAQ,mBAAmB,OAAO,KAAK,KAAK,YAAY,MAAM;CAC1E;CACA,IAAI,SAAS,QAAQ,IAAI,GAAG,OAAO,GAAG,aAAa,QAAQ,MAAM,MAAM,EAAE;CACzE,IAAI,SAAS,QAAQ,KAAK,GAAG,OAAO,GAAG,aAAa,QAAQ,OAAO,MAAM,EAAE;CAC3E,IAAI,cAAc,QAAQ,SAAS,CAAC,CAAC,SAAS,GAAG,OAAO;CACxD,IAAI,QAAQ,QAAQ,SAAS,QAAQ,KAAK,MAAM,GAC9C,OAAO,QAAQ,WAAW,QAAQ,MAAM,MAAM;AAElD;;AAGA,SAAgB,aAAa,SAAyB,SAAS,SAA6B;CAC1F,MAAM,UAAU,eAAe,QAAQ,MAAM,QAAQ,KAAK;CAC1D,IAAI,YAAY,KAAA,GAAW,OAAO,GAAG,QAAQ;CAC7C,IAAI,SAAS,QAAQ,IAAI,GAAG,OAAO,aAAa,QAAQ,MAAM,MAAM;CACpE,IAAI,SAAS,QAAQ,KAAK,GAAG,OAAO,aAAa,QAAQ,OAAO,MAAM;CACtE,IAAI,cAAc,QAAQ,SAAS,CAAC,CAAC,SAAS,GAAG,OAAO;CACxD,IAAI,QAAQ,QAAQ,SAAS,QAAQ,KAAK,MAAM,GAAG,OAAO,WAAW,QAAQ,MAAM,MAAM;AAE3F"}
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* Everything is iterative. A path with ten thousand segments, or a tree five
|
|
15
15
|
* thousand files wide, must not be able to overflow the stack or stall the page.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
/** Every change kind, in the order a summary names them. */
|
|
18
|
+
declare const FILE_CHANGE_KINDS: readonly ['added', 'modified', 'deleted', 'renamed'];
|
|
19
|
+
export type FileChangeKind = (typeof FILE_CHANGE_KINDS)[number];
|
|
18
20
|
export type FileChangeInput = Readonly<{
|
|
19
21
|
path: string;
|
|
20
22
|
/** Absent means the host did not say; the tree makes no statement about the file. */
|
|
@@ -111,12 +113,8 @@ export declare function clampWindow(window: RowWindow, total: number, page: numb
|
|
|
111
113
|
* a 5 000-row tree from being a multi-second freeze.
|
|
112
114
|
*/
|
|
113
115
|
export declare function revealInWindow(window: RowWindow, index: number, total: number, page: number): RowWindow;
|
|
114
|
-
export type ChangeCounts = Readonly<{
|
|
116
|
+
export type ChangeCounts = Readonly<Record<FileChangeKind, number> & {
|
|
115
117
|
total: number;
|
|
116
|
-
added: number;
|
|
117
|
-
modified: number;
|
|
118
|
-
deleted: number;
|
|
119
|
-
renamed: number;
|
|
120
118
|
/** Files with no change kind supplied. */
|
|
121
119
|
unspecified: number;
|
|
122
120
|
}>;
|
|
@@ -129,10 +127,5 @@ export declare function countChanges(roots: readonly FileTreeNode[]): ChangeCoun
|
|
|
129
127
|
export declare function describeChanges(counts: ChangeCounts): string;
|
|
130
128
|
/** The words for a change, which are drawn on the row and so also spoken. */
|
|
131
129
|
export declare const FILE_CHANGE_LABELS: Readonly<Record<FileChangeKind, string>>;
|
|
132
|
-
|
|
133
|
-
* The row a typed prefix jumps to. One typed letter searches from the row after
|
|
134
|
-
* the active one, so pressing it again cycles; a longer string searches from the
|
|
135
|
-
* active row, so refining a match does not skip past it. Matching ignores case.
|
|
136
|
-
*/
|
|
137
|
-
export declare function typeaheadIndex(labels: readonly string[], activeIndex: number, query: string): number;
|
|
130
|
+
export {};
|
|
138
131
|
//# sourceMappingURL=build-file-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-file-tree.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/file-tree/build-file-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,
|
|
1
|
+
{"version":3,"file":"build-file-tree.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/file-tree/build-file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AC,CAAA;AAEhE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAIrF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,SAAS,CAWX;AAMD,MAAM,MAAM,YAAY,GAAG,QAAQ,CACjC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAA;CACpB,CACF,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,CAmBzE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAS5D;AAED,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAKvE,CAAA"}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
// src/components/composites/file-tree/build-file-tree.ts
|
|
2
|
+
/**
|
|
3
|
+
* The model behind the changed-files tree: paths in, a folder tree out, and the
|
|
4
|
+
* small pure rules the view needs (what is visible, what to say about the
|
|
5
|
+
* changes, what a typed letter jumps to).
|
|
6
|
+
*
|
|
7
|
+
* Paths come from an agent, which means from a model, which means they are
|
|
8
|
+
* untrusted text. They are used here as labels and as ids, never as places to
|
|
9
|
+
* read or write, and the builder is strict about what counts as a path at all:
|
|
10
|
+
* a `..` segment, a control character or a bidirectional override rejects the
|
|
11
|
+
* path rather than being cleaned up, because a cleaned-up path is a different
|
|
12
|
+
* path and the tree would be making a claim the input did not. Rejected paths
|
|
13
|
+
* are returned, not dropped silently, so the view can say how many it ignored.
|
|
14
|
+
*
|
|
15
|
+
* Everything is iterative. A path with ten thousand segments, or a tree five
|
|
16
|
+
* thousand files wide, must not be able to overflow the stack or stall the page.
|
|
17
|
+
*/
|
|
18
|
+
/** Every change kind, in the order a summary names them. */
|
|
19
|
+
var FILE_CHANGE_KINDS = [
|
|
20
|
+
"added",
|
|
21
|
+
"modified",
|
|
22
|
+
"deleted",
|
|
23
|
+
"renamed"
|
|
24
|
+
];
|
|
2
25
|
/** Deeper paths are rejected: no real repository nests this far, and a row's indent would be unusable. */
|
|
3
26
|
var FILE_TREE_MAX_DEPTH = 256;
|
|
4
27
|
var MAX_SEGMENT_LENGTH = 1024;
|
|
@@ -48,12 +71,7 @@ function compareNodes(a, b) {
|
|
|
48
71
|
function safeCount(value) {
|
|
49
72
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : void 0;
|
|
50
73
|
}
|
|
51
|
-
var CHANGE_KINDS =
|
|
52
|
-
"added",
|
|
53
|
-
"modified",
|
|
54
|
-
"deleted",
|
|
55
|
-
"renamed"
|
|
56
|
-
]);
|
|
74
|
+
var CHANGE_KINDS = new Set(FILE_CHANGE_KINDS);
|
|
57
75
|
/**
|
|
58
76
|
* Build the tree. Folders sort before files, then by name without regard to
|
|
59
77
|
* case. A path that is both a file and the parent of another path is a folder
|
|
@@ -285,12 +303,7 @@ function countChanges(roots) {
|
|
|
285
303
|
function describeChanges(counts) {
|
|
286
304
|
if (counts.total === 0) return "No changed files";
|
|
287
305
|
const parts = [];
|
|
288
|
-
for (const kind of [
|
|
289
|
-
"added",
|
|
290
|
-
"modified",
|
|
291
|
-
"deleted",
|
|
292
|
-
"renamed"
|
|
293
|
-
]) if (counts[kind] > 0) parts.push(`${counts[kind].toLocaleString()} ${kind}`);
|
|
306
|
+
for (const kind of FILE_CHANGE_KINDS) if (counts[kind] > 0) parts.push(`${counts[kind].toLocaleString()} ${kind}`);
|
|
294
307
|
const noun = counts.total === 1 ? "file" : "files";
|
|
295
308
|
const head = `${counts.total.toLocaleString()} ${noun} changed`;
|
|
296
309
|
return parts.length > 0 ? `${head}: ${parts.join(", ")}` : head;
|
|
@@ -302,23 +315,6 @@ var FILE_CHANGE_LABELS = {
|
|
|
302
315
|
deleted: "Deleted",
|
|
303
316
|
renamed: "Renamed"
|
|
304
317
|
};
|
|
305
|
-
|
|
306
|
-
* The row a typed prefix jumps to. One typed letter searches from the row after
|
|
307
|
-
* the active one, so pressing it again cycles; a longer string searches from the
|
|
308
|
-
* active row, so refining a match does not skip past it. Matching ignores case.
|
|
309
|
-
*/
|
|
310
|
-
function typeaheadIndex(labels, activeIndex, query) {
|
|
311
|
-
const needle = query.toLowerCase();
|
|
312
|
-
if (needle === "" || labels.length === 0) return -1;
|
|
313
|
-
const repeated = needle.length > 1 && [...needle].every((char) => char === needle[0]);
|
|
314
|
-
const prefix = repeated ? needle[0] : needle;
|
|
315
|
-
const first = needle.length === 1 || repeated ? activeIndex + 1 : Math.max(0, activeIndex);
|
|
316
|
-
for (let offset = 0; offset < labels.length; offset += 1) {
|
|
317
|
-
const index = (first + offset) % labels.length;
|
|
318
|
-
if (labels[index].toLowerCase().startsWith(prefix)) return index;
|
|
319
|
-
}
|
|
320
|
-
return -1;
|
|
321
|
-
}
|
|
322
|
-
export { FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, buildFileTree, clampWindow, countChanges, describeChanges, flattenFileTree, indexFileTree, initialExpanded, normalizePath, revealInWindow, typeaheadIndex };
|
|
318
|
+
export { FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, buildFileTree, clampWindow, countChanges, describeChanges, flattenFileTree, indexFileTree, initialExpanded, normalizePath, revealInWindow };
|
|
323
319
|
|
|
324
320
|
//# sourceMappingURL=build-file-tree.js.map
|