@adea-ai/ui 0.152.3 → 0.153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +469 -580
- package/dist/components/composites/account-menu/account-menu.d.ts +5 -0
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +37 -13
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.d.ts +2 -1
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +92 -66
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +57 -57
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +9 -9
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.d.ts +7 -7
- package/dist/components/composites/appearance-editor/theme-preview.d.ts +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +6 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +36 -36
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +4 -4
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.d.ts.map +1 -1
- package/dist/components/composites/chat/chat.js +33 -37
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts +3 -3
- package/dist/components/composites/checkpoint/checkpoint-model.js +2 -2
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.d.ts +2 -2
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.d.ts +2 -2
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.d.ts +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +7 -3
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -3
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/citation.d.ts +1 -1
- package/dist/components/composites/inline-citation/citation.js +1 -1
- package/dist/components/composites/inline-citation/citation.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts +2 -2
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +22 -22
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.d.ts +5 -0
- package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row.js +75 -83
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.d.ts +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts +4 -4
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/model-selector/models.d.ts +2 -2
- package/dist/components/composites/model-selector/models.js +1 -1
- package/dist/components/composites/model-selector/models.js.map +1 -1
- package/dist/components/composites/plan/plan.d.ts.map +1 -1
- package/dist/components/composites/plan/plan.js +17 -15
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.d.ts.map +1 -1
- package/dist/components/composites/queue/queue.js +5 -7
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.d.ts +4 -4
- package/dist/components/composites/reasoning/reasoning.js +4 -4
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +63 -14
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +32 -32
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/source.d.ts +1 -1
- package/dist/components/composites/sources/source.js.map +1 -1
- package/dist/components/composites/sources/sources.d.ts +2 -2
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/parse-stack-trace.js +4 -4
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.d.ts.map +1 -1
- package/dist/components/composites/stat/stat.js +14 -16
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
- package/dist/components/composites/subagent/subagent.js +6 -4
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/task/task.d.ts +1 -1
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.d.ts +3 -3
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal-model.d.ts +3 -3
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal-model.js +1 -1
- package/dist/components/composites/terminal/terminal-model.js.map +1 -1
- package/dist/components/composites/terminal/terminal.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal.js +24 -11
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results-model.d.ts +4 -4
- package/dist/components/composites/test-results/test-results-model.js +2 -2
- package/dist/components/composites/test-results/test-results-model.js.map +1 -1
- package/dist/components/composites/test-results/test-results.d.ts +1 -1
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.d.ts +4 -4
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.d.ts +1 -1
- package/dist/components/composites/tree/tree.d.ts.map +1 -1
- package/dist/components/composites/tree/tree.js +25 -18
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.d.ts +10 -4
- package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +14 -19
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/index.d.ts +1 -1
- package/dist/components/composites/update-dialog/index.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +4 -5
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.d.ts.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +19 -20
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
- package/dist/components/conversation/busy-send-button.js +18 -20
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/composer-menu.d.ts +3 -3
- package/dist/components/conversation/composer-menu.js +3 -3
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +2 -4
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
- package/dist/components/conversation/conversation-pane.js +6 -5
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +3 -7
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +76 -76
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +32 -38
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.d.ts.map +1 -1
- package/dist/components/conversation/message-row.js +79 -73
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +7 -7
- package/dist/components/conversation/scroll-follow-core.js +4 -4
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +19 -4
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/conversation/thread-panel.d.ts.map +1 -1
- package/dist/components/conversation/thread-panel.js +23 -23
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.d.ts.map +1 -1
- package/dist/components/conversation/transcript-composition.js +2 -2
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.d.ts +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +4 -6
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/page/page.d.ts.map +1 -1
- package/dist/components/layout/page/page.js +17 -17
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +2 -4
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.d.ts.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +16 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts +1 -1
- package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +35 -34
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +23 -23
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +2 -2
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.d.ts +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +7 -7
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/motion/presence.d.ts +2 -2
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts +5 -5
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.d.ts +1 -1
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/theme-catalogue-source.d.ts +2 -2
- package/dist/components/theme/theme-catalogue-source.js +2 -2
- package/dist/components/theme/theme-catalogue-source.js.map +1 -1
- package/dist/components/theme/theme-context.d.ts +2 -2
- package/dist/components/theme/theme-context.js +3 -3
- package/dist/components/theme/theme-context.js.map +1 -1
- package/dist/components/theme/theme-document.d.ts.map +1 -1
- package/dist/components/theme/theme-document.js +14 -9
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-picker.d.ts +5 -5
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.d.ts +0 -6
- package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
- package/dist/components/theme/theme-provider-value.js +9 -3
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-script.d.ts +14 -0
- package/dist/components/theme/theme-script.d.ts.map +1 -1
- package/dist/components/theme/theme-script.js +1 -0
- package/dist/components/theme/theme-script.js.map +1 -1
- package/dist/components/theme/theme-state.d.ts +7 -7
- package/dist/components/theme/theme-state.js.map +1 -1
- package/dist/components/theme/theme-toggle.d.ts +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/alert/alert.d.ts.map +1 -1
- package/dist/components/ui/alert/alert.js +4 -3
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +3 -3
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.d.ts.map +1 -1
- package/dist/components/ui/board/board.js +10 -6
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/bubble/bubble.d.ts.map +1 -1
- package/dist/components/ui/bubble/bubble.js +6 -4
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/button-group/button-group.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.js +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +6 -6
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.d.ts +4 -4
- package/dist/components/ui/callout/callout.js +4 -4
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.d.ts +2 -2
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.d.ts +4 -4
- package/dist/components/ui/carousel/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart-options.d.ts +7 -7
- package/dist/components/ui/chart/chart-options.js +9 -9
- package/dist/components/ui/chart/chart-options.js.map +1 -1
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js +16 -7
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +8 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +8 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/command/command.d.ts +4 -4
- package/dist/components/ui/command/command.js +4 -4
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.js +13 -13
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.d.ts +0 -4
- package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +17 -1
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +4 -3
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.d.ts +6 -6
- package/dist/components/ui/diff-block/diff-block.js +3 -3
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts +3 -3
- package/dist/components/ui/drawer/drawer.js +2 -2
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +5 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -1
- package/dist/components/ui/empty/empty-state.js +33 -36
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.d.ts +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +7 -7
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +15 -15
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.d.ts +1 -1
- package/dist/components/ui/field/number-field.js +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.d.ts +1 -1
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input-group/input-group.d.ts +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.d.ts +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.d.ts.map +1 -1
- package/dist/components/ui/item/item.js +26 -26
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.d.ts +2 -2
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/kbd/platform-modifier.d.ts +3 -3
- package/dist/components/ui/kbd/platform-modifier.js +3 -3
- package/dist/components/ui/kbd/platform-modifier.js.map +1 -1
- package/dist/components/ui/label/label.d.ts +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.d.ts.map +1 -1
- package/dist/components/ui/marker/marker.js +17 -19
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts +2 -2
- package/dist/components/ui/menubar/menubar.js +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js +16 -18
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +7 -11
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.d.ts +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +5 -4
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +2 -4
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.d.ts.map +1 -1
- package/dist/components/ui/popover/popover.js +11 -4
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/progress/progress.js +6 -8
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +73 -73
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +12 -6
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts +2 -2
- package/dist/components/ui/resizable/resizable.js +3 -3
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/select/select.d.ts +3 -3
- package/dist/components/ui/select/select.js +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +4 -3
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.d.ts +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.d.ts +1 -1
- package/dist/components/ui/spinner/spinner.js +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.d.ts +13 -13
- package/dist/components/ui/status-chip/status-chip.d.ts.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +11 -11
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +8 -6
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.d.ts +4 -4
- package/dist/components/ui/tabs/tabs.js +4 -4
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/textarea/textarea.d.ts +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.d.ts.map +1 -1
- package/dist/components/ui/toast/toast.js +13 -15
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.js +1 -1
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts +51 -0
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js +103 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +1 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -1
- package/dist/components/ui/tooltip/index.js +3 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +6 -5
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.d.ts.map +1 -1
- package/dist/components/ui/trace/trace.js +17 -17
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.d.ts +3 -3
- package/dist/components/ui/typography/typography.js +5 -5
- package/dist/components/ui/typography/typography.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/lib/accent-presets.d.ts +1 -1
- package/dist/lib/accent-presets.js.map +1 -1
- package/dist/lib/accent-roles.d.ts +2 -2
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/accent-roles.js.map +1 -1
- package/dist/lib/appearance-font-settings.d.ts.map +1 -1
- package/dist/lib/appearance-font-settings.js +15 -7
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/create-poll.d.ts +39 -0
- package/dist/lib/create-poll.d.ts.map +1 -0
- package/dist/lib/create-poll.js +116 -0
- package/dist/lib/create-poll.js.map +1 -0
- package/dist/lib/font-zoom.d.ts +1 -1
- package/dist/lib/font-zoom.js +1 -1
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/keyed-rows.d.ts +2 -1
- package/dist/lib/keyed-rows.d.ts.map +1 -1
- package/dist/lib/keyed-rows.js +3 -2
- package/dist/lib/keyed-rows.js.map +1 -1
- package/dist/lib/overlay.d.ts +5 -5
- package/dist/lib/overlay.js +5 -5
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/preference-store.d.ts +2 -2
- package/dist/lib/preference-store.js +2 -2
- package/dist/lib/preference-store.js.map +1 -1
- package/dist/lib/safe-script.d.ts +2 -2
- package/dist/lib/safe-script.js +2 -2
- package/dist/lib/safe-script.js.map +1 -1
- package/dist/lib/scroll-geometry.d.ts +1 -1
- package/dist/lib/scroll-geometry.js +1 -1
- package/dist/lib/scroll-geometry.js.map +1 -1
- package/dist/lib/text.d.ts +1 -1
- package/dist/lib/text.js +1 -1
- package/dist/lib/text.js.map +1 -1
- package/dist/lib/theme-accents.js +3 -3
- package/dist/lib/theme-accents.js.map +1 -1
- package/dist/lib/theme-css.js.map +1 -1
- package/dist/lib/theme-defaults.d.ts +4 -4
- package/dist/lib/theme-defaults.js +4 -4
- package/dist/lib/theme-defaults.js.map +1 -1
- package/dist/lib/theme-engine-light.js.map +1 -1
- package/dist/lib/theme-engine.d.ts +2 -2
- package/dist/lib/theme-engine.js +2 -2
- package/dist/lib/theme-engine.js.map +1 -1
- package/dist/lib/theme-projection.d.ts +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-projection.js.map +1 -1
- package/dist/lib/theme-records.d.ts +2 -2
- package/dist/lib/theme-records.js +2 -2
- package/dist/lib/theme-records.js.map +1 -1
- package/dist/lib/theme-types.d.ts +1 -1
- package/dist/lib/theme-types.js.map +1 -1
- package/dist/lib/themes.d.ts +13 -13
- package/dist/lib/themes.js +13 -13
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts +2 -2
- package/dist/lib/tokens.js +1 -1
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.d.ts +2 -2
- package/dist/lib/tooltip-focus-gate.js +2 -2
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/variants.d.ts +4 -4
- package/dist/lib/variants.js +1 -1
- package/dist/lib/variants.js.map +1 -1
- package/dist/lib/version-notes.d.ts +4 -4
- package/dist/lib/version-notes.js +4 -4
- package/dist/lib/version-notes.js.map +1 -1
- package/dist/lint.js.map +1 -1
- package/dist/r/account-menu.json +1 -0
- package/dist/r/lib.json +5 -0
- package/dist/r/registry.json +11 -0
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/dist/r/src/components/composites/action-button/action-button.tsx +124 -78
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/dist/r/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/dist/r/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/dist/r/src/components/composites/chat/chat.tsx +15 -9
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/dist/r/src/components/composites/context/context.tsx +2 -2
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/dist/r/src/components/composites/inline-citation/citation.ts +1 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/dist/r/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/dist/r/src/components/composites/list-row/list-row.tsx +69 -73
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -4
- package/dist/r/src/components/composites/model-selector/models.ts +2 -2
- package/dist/r/src/components/composites/plan/plan.tsx +19 -11
- package/dist/r/src/components/composites/queue/queue.tsx +5 -3
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/dist/r/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/dist/r/src/components/composites/settings/settings.tsx +14 -6
- package/dist/r/src/components/composites/sources/source.ts +1 -1
- package/dist/r/src/components/composites/sources/sources.tsx +2 -2
- package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/dist/r/src/components/composites/stat/stat.tsx +20 -16
- package/dist/r/src/components/composites/subagent/subagent.tsx +6 -4
- package/dist/r/src/components/composites/task/task.tsx +1 -1
- package/dist/r/src/components/composites/terminal/ansi.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal-model.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal.tsx +24 -12
- package/dist/r/src/components/composites/test-results/test-results-model.ts +4 -4
- package/dist/r/src/components/composites/test-results/test-results.tsx +1 -1
- package/dist/r/src/components/composites/tool/tool.tsx +4 -4
- package/dist/r/src/components/composites/tree/tree.tsx +31 -15
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/dist/r/src/components/composites/update-dialog/index.ts +1 -0
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/dist/r/src/components/conversation/busy-send-button.tsx +6 -2
- package/dist/r/src/components/conversation/composer-menu.tsx +3 -3
- package/dist/r/src/components/conversation/conversation-avatar.tsx +1 -1
- package/dist/r/src/components/conversation/conversation-pane.tsx +8 -5
- package/dist/r/src/components/conversation/conversation-surface.tsx +2 -2
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/dist/r/src/components/conversation/message-composer.tsx +4 -6
- package/dist/r/src/components/conversation/message-row.tsx +34 -26
- package/dist/r/src/components/conversation/scroll-follow-core.ts +8 -8
- package/dist/r/src/components/conversation/scroll-follow.ts +24 -8
- package/dist/r/src/components/conversation/thread-panel.tsx +7 -3
- package/dist/r/src/components/conversation/transcript-composition.tsx +4 -2
- package/dist/r/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/dist/r/src/components/layout/page/page.tsx +15 -11
- package/dist/r/src/components/layout/panel/panel.tsx +1 -1
- package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +38 -22
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/dist/r/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +8 -6
- package/dist/r/src/components/motion/presence.tsx +2 -2
- package/dist/r/src/components/theme/appearance-panel.tsx +5 -5
- package/dist/r/src/components/theme/lazy.ts +1 -1
- package/dist/r/src/components/theme/theme-catalogue-source.ts +2 -2
- package/dist/r/src/components/theme/theme-context.ts +3 -3
- package/dist/r/src/components/theme/theme-document.ts +22 -11
- package/dist/r/src/components/theme/theme-picker.tsx +5 -5
- package/dist/r/src/components/theme/theme-provider-value.ts +15 -3
- package/dist/r/src/components/theme/theme-script.ts +20 -0
- package/dist/r/src/components/theme/theme-state.ts +7 -7
- package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
- package/dist/r/src/components/ui/alert/alert.tsx +4 -3
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/dist/r/src/components/ui/badge/badge.tsx +2 -2
- package/dist/r/src/components/ui/board/board.tsx +17 -5
- package/dist/r/src/components/ui/bubble/bubble.tsx +6 -4
- package/dist/r/src/components/ui/button/button.tsx +2 -2
- package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
- package/dist/r/src/components/ui/calendar/calendar.tsx +2 -2
- package/dist/r/src/components/ui/callout/callout.tsx +4 -4
- package/dist/r/src/components/ui/card/card.tsx +2 -2
- package/dist/r/src/components/ui/carousel/carousel.tsx +6 -6
- package/dist/r/src/components/ui/chart/chart-options.ts +9 -9
- package/dist/r/src/components/ui/chart/chart.tsx +14 -1
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/dist/r/src/components/ui/code-block/code-block.tsx +14 -7
- package/dist/r/src/components/ui/command/command.tsx +7 -7
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/dist/r/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/dist/r/src/components/ui/dialog/dialog-layer.tsx +27 -1
- package/dist/r/src/components/ui/dialog/dialog.tsx +4 -3
- package/dist/r/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/dist/r/src/components/ui/drawer/drawer.tsx +3 -3
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/dist/r/src/components/ui/empty/empty-state.tsx +23 -18
- package/dist/r/src/components/ui/empty/empty.tsx +1 -1
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/dist/r/src/components/ui/field/field.tsx +15 -7
- package/dist/r/src/components/ui/field/number-field.tsx +1 -1
- package/dist/r/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/dist/r/src/components/ui/input-group/input-group.tsx +1 -1
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/dist/r/src/components/ui/item/item.tsx +24 -18
- package/dist/r/src/components/ui/kbd/kbd.tsx +2 -2
- package/dist/r/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/dist/r/src/components/ui/label/label.tsx +1 -1
- package/dist/r/src/components/ui/marker/marker.tsx +9 -5
- package/dist/r/src/components/ui/menubar/menubar.tsx +2 -2
- package/dist/r/src/components/ui/message/message.tsx +14 -13
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/dist/r/src/components/ui/native-select/native-select.tsx +1 -1
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/dist/r/src/components/ui/pagination/pagination.tsx +1 -1
- package/dist/r/src/components/ui/popover/popover.tsx +4 -2
- package/dist/r/src/components/ui/progress/progress.tsx +5 -3
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/dist/r/src/components/ui/resizable/resizable.tsx +5 -5
- package/dist/r/src/components/ui/select/select.tsx +4 -4
- package/dist/r/src/components/ui/sheet/sheet.tsx +4 -3
- package/dist/r/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/dist/r/src/components/ui/slider/slider.tsx +1 -1
- package/dist/r/src/components/ui/spinner/spinner.tsx +1 -1
- package/dist/r/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/dist/r/src/components/ui/switch/switch.tsx +9 -6
- package/dist/r/src/components/ui/tabs/tabs.tsx +4 -4
- package/dist/r/src/components/ui/textarea/textarea.tsx +1 -1
- package/dist/r/src/components/ui/toast/toast.tsx +6 -4
- package/dist/r/src/components/ui/toggle/toggle.tsx +1 -1
- package/dist/r/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/dist/r/src/components/ui/tooltip/index.ts +1 -0
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/dist/r/src/components/ui/trace/trace.tsx +13 -9
- package/dist/r/src/components/ui/typography/typography.tsx +5 -5
- package/dist/r/src/lib/accent-presets.ts +1 -1
- package/dist/r/src/lib/accent-roles.ts +2 -2
- package/dist/r/src/lib/appearance-font-settings.ts +18 -7
- package/dist/r/src/lib/create-poll.ts +150 -0
- package/dist/r/src/lib/font-zoom.ts +3 -3
- package/dist/r/src/lib/keyed-rows.ts +3 -2
- package/dist/r/src/lib/overlay.ts +5 -5
- package/dist/r/src/lib/preference-store.ts +2 -2
- package/dist/r/src/lib/safe-script.ts +2 -2
- package/dist/r/src/lib/scroll-geometry.ts +1 -1
- package/dist/r/src/lib/text.ts +1 -1
- package/dist/r/src/lib/theme-accents.ts +3 -3
- package/dist/r/src/lib/theme-css.ts +2 -2
- package/dist/r/src/lib/theme-defaults.ts +4 -4
- package/dist/r/src/lib/theme-engine-light.ts +2 -2
- package/dist/r/src/lib/theme-engine.ts +2 -2
- package/dist/r/src/lib/theme-projection.ts +2 -2
- package/dist/r/src/lib/theme-records.ts +2 -2
- package/dist/r/src/lib/theme-types.ts +1 -1
- package/dist/r/src/lib/themes.ts +14 -14
- package/dist/r/src/lib/tokens.ts +2 -2
- package/dist/r/src/lib/tooltip-focus-gate.ts +11 -11
- package/dist/r/src/lib/utils.ts +1 -1
- package/dist/r/src/lib/variants.ts +4 -4
- package/dist/r/src/lib/version-notes.ts +4 -4
- package/dist/r/src/styles/base.css +12 -43
- package/dist/r/src/styles/fonts.css +1 -1
- package/dist/r/src/styles/theme.css +35 -35
- package/dist/r/tooltip.json +5 -0
- package/package.json +2 -1
- package/registry.json +11 -0
- package/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/src/components/composites/action-button/action-button.tsx +124 -78
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/src/components/composites/chat/chat.tsx +15 -9
- package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/src/components/composites/context/context.tsx +2 -2
- package/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/src/components/composites/inline-citation/citation.ts +1 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/src/components/composites/list-row/list-row.tsx +69 -73
- package/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/src/components/composites/model-selector/model-selector.tsx +4 -4
- package/src/components/composites/model-selector/models.ts +2 -2
- package/src/components/composites/plan/plan.tsx +19 -11
- package/src/components/composites/queue/queue.tsx +5 -3
- package/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/src/components/composites/settings/settings.tsx +14 -6
- package/src/components/composites/sources/source.ts +1 -1
- package/src/components/composites/sources/sources.tsx +2 -2
- package/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/src/components/composites/stat/stat.tsx +20 -16
- package/src/components/composites/subagent/subagent.tsx +6 -4
- package/src/components/composites/task/task.tsx +1 -1
- package/src/components/composites/terminal/ansi.ts +3 -3
- package/src/components/composites/terminal/terminal-model.ts +3 -3
- package/src/components/composites/terminal/terminal.tsx +24 -12
- package/src/components/composites/test-results/test-results-model.ts +4 -4
- package/src/components/composites/test-results/test-results.tsx +1 -1
- package/src/components/composites/tool/tool.tsx +4 -4
- package/src/components/composites/tree/tree.tsx +31 -15
- package/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/src/components/composites/update-dialog/index.ts +1 -0
- package/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/src/components/conversation/busy-send-button.tsx +6 -2
- package/src/components/conversation/composer-menu.tsx +3 -3
- package/src/components/conversation/conversation-avatar.tsx +1 -1
- package/src/components/conversation/conversation-pane.tsx +8 -5
- package/src/components/conversation/conversation-surface.tsx +2 -2
- package/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/src/components/conversation/message-composer.tsx +4 -6
- package/src/components/conversation/message-row.tsx +34 -26
- package/src/components/conversation/scroll-follow-core.ts +8 -8
- package/src/components/conversation/scroll-follow.ts +24 -8
- package/src/components/conversation/thread-panel.tsx +7 -3
- package/src/components/conversation/transcript-composition.tsx +4 -2
- package/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/src/components/layout/page/page.tsx +15 -11
- package/src/components/layout/panel/panel.tsx +1 -1
- package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/src/components/layout/side-rail/side-rail.tsx +38 -22
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/src/components/layout/top-bar/top-bar.tsx +8 -6
- package/src/components/motion/presence.tsx +2 -2
- package/src/components/theme/appearance-panel.tsx +5 -5
- package/src/components/theme/lazy.ts +1 -1
- package/src/components/theme/theme-catalogue-source.ts +2 -2
- package/src/components/theme/theme-context.ts +3 -3
- package/src/components/theme/theme-document.ts +22 -11
- package/src/components/theme/theme-picker.tsx +5 -5
- package/src/components/theme/theme-provider-value.ts +15 -3
- package/src/components/theme/theme-script.ts +20 -0
- package/src/components/theme/theme-state.ts +7 -7
- package/src/components/theme/theme-toggle.tsx +1 -1
- package/src/components/ui/alert/alert.tsx +4 -3
- package/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/src/components/ui/badge/badge.tsx +2 -2
- package/src/components/ui/board/board.tsx +17 -5
- package/src/components/ui/bubble/bubble.tsx +6 -4
- package/src/components/ui/button/button.tsx +2 -2
- package/src/components/ui/button-group/button-group.tsx +1 -1
- package/src/components/ui/calendar/calendar.tsx +2 -2
- package/src/components/ui/callout/callout.tsx +4 -4
- package/src/components/ui/card/card.tsx +2 -2
- package/src/components/ui/carousel/carousel.tsx +6 -6
- package/src/components/ui/chart/chart-options.ts +9 -9
- package/src/components/ui/chart/chart.tsx +14 -1
- package/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/src/components/ui/code-block/code-block.tsx +14 -7
- package/src/components/ui/command/command.tsx +7 -7
- package/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/src/components/ui/dialog/dialog-layer.tsx +27 -1
- package/src/components/ui/dialog/dialog.tsx +4 -3
- package/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/src/components/ui/drawer/drawer.tsx +3 -3
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/src/components/ui/empty/empty-state.tsx +23 -18
- package/src/components/ui/empty/empty.tsx +1 -1
- package/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/src/components/ui/field/field.tsx +15 -7
- package/src/components/ui/field/number-field.tsx +1 -1
- package/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/src/components/ui/input-group/input-group.tsx +1 -1
- package/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/src/components/ui/item/item.tsx +24 -18
- package/src/components/ui/kbd/kbd.tsx +2 -2
- package/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/src/components/ui/label/label.tsx +1 -1
- package/src/components/ui/marker/marker.tsx +9 -5
- package/src/components/ui/menubar/menubar.tsx +2 -2
- package/src/components/ui/message/message.tsx +14 -13
- package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/src/components/ui/native-select/native-select.tsx +1 -1
- package/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/src/components/ui/pagination/pagination.tsx +1 -1
- package/src/components/ui/popover/popover.tsx +4 -2
- package/src/components/ui/progress/progress.tsx +5 -3
- package/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/src/components/ui/resizable/resizable.tsx +5 -5
- package/src/components/ui/select/select.tsx +4 -4
- package/src/components/ui/sheet/sheet.tsx +4 -3
- package/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/src/components/ui/slider/slider.tsx +1 -1
- package/src/components/ui/spinner/spinner.tsx +1 -1
- package/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/src/components/ui/switch/switch.tsx +9 -6
- package/src/components/ui/tabs/tabs.tsx +4 -4
- package/src/components/ui/textarea/textarea.tsx +1 -1
- package/src/components/ui/toast/toast.tsx +6 -4
- package/src/components/ui/toggle/toggle.tsx +1 -1
- package/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/src/components/ui/tooltip/index.ts +1 -0
- package/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/src/components/ui/trace/trace.tsx +13 -9
- package/src/components/ui/typography/typography.tsx +5 -5
- package/src/index.ts +1 -0
- package/src/lib/accent-presets.ts +1 -1
- package/src/lib/accent-roles.ts +2 -2
- package/src/lib/appearance-font-settings.ts +18 -7
- package/src/lib/create-poll.ts +150 -0
- package/src/lib/font-zoom.ts +3 -3
- package/src/lib/keyed-rows.ts +3 -2
- package/src/lib/overlay.ts +5 -5
- package/src/lib/preference-store.ts +2 -2
- package/src/lib/safe-script.ts +2 -2
- package/src/lib/scroll-geometry.ts +1 -1
- package/src/lib/text.ts +1 -1
- package/src/lib/theme-accents.ts +3 -3
- package/src/lib/theme-css.ts +2 -2
- package/src/lib/theme-defaults.ts +4 -4
- package/src/lib/theme-engine-light.ts +2 -2
- package/src/lib/theme-engine.ts +2 -2
- package/src/lib/theme-projection.ts +2 -2
- package/src/lib/theme-records.ts +2 -2
- package/src/lib/theme-types.ts +1 -1
- package/src/lib/themes.ts +14 -14
- package/src/lib/tokens.ts +2 -2
- package/src/lib/tooltip-focus-gate.ts +11 -11
- package/src/lib/utils.ts +1 -1
- package/src/lib/variants.ts +4 -4
- package/src/lib/version-notes.ts +4 -4
- package/src/lint/index.ts +1 -1
- package/src/styles/base.css +12 -43
- package/src/styles/fonts.css +1 -1
- package/src/styles/theme.css +35 -35
- package/src/styles/themes/aardvark-blue.css +98 -0
- package/src/styles/themes/aardvark-ink.css +98 -0
- package/src/styles/themes/adea-dark-colorblind.css +98 -0
- package/src/styles/themes/adea-dark-high-contrast.css +98 -0
- package/src/styles/themes/adea-dark.css +47 -0
- package/src/styles/themes/adea-light-colorblind.css +141 -0
- package/src/styles/themes/adea-light-high-contrast.css +141 -0
- package/src/styles/themes/adea-light.css +47 -0
- package/src/styles/themes/ayu-light.css +141 -0
- package/src/styles/themes/ayu-mirage.css +98 -0
- package/src/styles/themes/ayu.css +98 -0
- package/src/styles/themes/catppuccin-frappe.css +98 -0
- package/src/styles/themes/catppuccin-latte.css +141 -0
- package/src/styles/themes/catppuccin-macchiato.css +98 -0
- package/src/styles/themes/catppuccin-mocha.css +98 -0
- package/src/styles/themes/dracula.css +98 -0
- package/src/styles/themes/everforest-dark.css +98 -0
- package/src/styles/themes/everforest-light.css +141 -0
- package/src/styles/themes/gruvbox-dark.css +98 -0
- package/src/styles/themes/gruvbox-light.css +141 -0
- package/src/styles/themes/kanagawa.css +98 -0
- package/src/styles/themes/monokai.css +98 -0
- package/src/styles/themes/nord-light.css +141 -0
- package/src/styles/themes/nord.css +98 -0
- package/src/styles/themes/one-dark.css +98 -0
- package/src/styles/themes/rosepine-dawn.css +141 -0
- package/src/styles/themes/rosepine-moon.css +98 -0
- package/src/styles/themes/rosepine.css +98 -0
- package/src/styles/themes/solarized-dark.css +98 -0
- package/src/styles/themes/solarized-light.css +141 -0
- package/src/styles/themes/tokyonight-day.css +141 -0
- package/src/styles/themes/tokyonight-night.css +98 -0
- package/src/styles/themes/tokyonight-storm.css +98 -0
- package/src/styles/themes/vesper.css +98 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.js","names":["ListChecks","createMemo","createSignal","For","Index","Show","splitProps","cn","Attachment","AttachmentList","Button","ScrollArea","TraceLine","TraceMark","WORK_STATUS_LABELS","WORK_TRACE_STATUS","name","kind","size","text","description","status","files","TASK_ITEM_STATUS_LABELS","VISIBLE_FILES","MAX_TEXT","bound","max","length","slice","taskProgress","items","done","total","some","item","undefined","filter","taskProgressLabel","progress","statusLabel","TaskItemRow","props","local","rest","showAllFiles","setShowAllFiles","shownFiles","hiddenFiles","_el$","_tmpl$2","_el$2","firstChild","_el$3","_$spread","_$mergeProps","class","_$insert","_$createComponent","slot","_$memo","completed","icon","_tmpl$3","when","children","_el$6","_tmpl$4","_el$8","_tmpl$5","each","file","_el$9","_tmpl$6","variant","_el$4","_tmpl$","type","onClick","value","_$effect","_p$","_v$","_v$2","e","_$setAttribute","t","_$className","label","TaskItemList","role","_el$0","_tmpl$7","itemsLabel","Task","derivedMeta","title","list","meta"],"sources":["../../../../src/components/composites/task/task.tsx"],"sourcesContent":["import { ListChecks } from 'lucide-solid'\nimport {\n createMemo,\n createSignal,\n For,\n Index,\n Show,\n splitProps,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Attachment, AttachmentList, type AttachmentKind } from '../../ui/attachment'\nimport { Button } from '../../ui/button'\nimport { ScrollArea } from '../../ui/scroll-area'\nimport {\n TraceLine,\n TraceMark,\n WORK_STATUS_LABELS,\n WORK_TRACE_STATUS,\n type TraceLineProps,\n type WorkStatus,\n} from '../../ui/trace'\n\n/**\n * Task.\n *\n * One piece of work the agent is doing, as a `TraceLine` that opens onto its\n * items: a title, then a list in which each item is a sentence, optionally a\n * status, and optionally the files it touched. Reach for `Plan` when the list is\n * a proposal the person approves, for `Queue` when it is the agent's running\n * todo list, and for a `Trace` of tool calls when the items are things that\n * *ran* — a Task item is a statement about work, not a record of a call.\n *\n * ## Items wrap; lines do not\n *\n * A `TraceLine` truncates its title to one row, which is right for \"Read\n * src/app.tsx\" and wrong for \"Backfill locale from profile.language, falling\n * back to en\". Items are therefore their own rows with the same mark and colour\n * vocabulary as a Trace line but wrapping text, clamped to three lines so a\n * pasted paragraph cannot take the column. `TaskItemRow` and `TaskItemList` are\n * exported because `Plan` and `Queue` are built from them.\n *\n * ## Status is a claim\n *\n * An item shows a mark and speaks a word only when the host supplied `status`.\n * The \"2 of 4 done\" in the header is derived from those statuses and appears\n * only if at least one item has one; items without a status are counted in the\n * total and not in \"done\" (see `taskProgress`). A task with no items is a plain\n * line: there is nothing to open, and an empty disclosure is a control that\n * does nothing.\n *\n * ## Files are untrusted metadata\n *\n * File chips are `Attachment` chips with no handlers, so they are text: a name\n * is never a link or a path. Past six, the rest sit behind one toggle button\n * whose label changes in place, so keyboard focus survives opening and closing\n * it.\n */\nexport type TaskItemStatus = WorkStatus\n\nexport type TaskFile = Readonly<{\n name: string\n kind?: AttachmentKind\n /** Bytes. */\n size?: number\n}>\n\nexport type TaskItem = Readonly<{\n /** Only needed for the host's own bookkeeping; rows are kept by position. */\n id?: string\n text: string\n description?: string\n status?: TaskItemStatus\n files?: readonly TaskFile[]\n}>\n\nexport const TASK_ITEM_STATUS_LABELS: Readonly<Record<TaskItemStatus, string>> = WORK_STATUS_LABELS\n\n/** Visible files per item before the rest go behind a toggle. */\nconst VISIBLE_FILES = 6\n/** Characters of item text kept; the rest of a pasted wall is not a todo. */\nconst MAX_TEXT = 1_000\n\nfunction bound(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}…` : text\n}\n\n/**\n * How many items are done, or nothing at all when no item carries a status.\n * Items without a status count toward the total: the host did not say they were\n * finished, so they are not.\n */\nexport function taskProgress(\n items: readonly Pick<TaskItem, 'status'>[]\n): Readonly<{ done: number; total: number }> | undefined {\n if (!items.some((item) => item.status !== undefined)) return undefined\n return {\n done: items.filter((item) => item.status === 'complete').length,\n total: items.length,\n }\n}\n\n/** `2 of 4 done`, in words. */\nexport function taskProgressLabel(progress: { done: number; total: number }): string {\n return `${progress.done} of ${progress.total} done`\n}\n\nexport type TaskItemRowProps = Omit<ComponentProps<'li'>, 'children'> & {\n text: string\n description?: string\n status?: TaskItemStatus\n files?: readonly TaskFile[]\n /** Spoken in place of the default status word. */\n statusLabel?: string\n}\n\nexport function TaskItemRow(props: TaskItemRowProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'text',\n 'description',\n 'status',\n 'files',\n 'statusLabel',\n ])\n const [showAllFiles, setShowAllFiles] = createSignal(false)\n const files = () => local.files ?? []\n const shownFiles = () => (showAllFiles() ? files() : files().slice(0, VISIBLE_FILES))\n const hiddenFiles = () => files().length - VISIBLE_FILES\n const text = () => bound(local.text, MAX_TEXT)\n\n return (\n <li\n data-slot=\"task-item\"\n data-status={local.status}\n class={cn('flex min-w-0 gap-2 rounded-md px-1.5 py-0.5', local.class)}\n {...rest}\n >\n <TraceMark\n slot=\"task-item-mark\"\n class=\"mt-0.5\"\n status={local.status ? WORK_TRACE_STATUS[local.status] : undefined}\n completed={local.status === 'complete'}\n icon={\n local.status ? undefined : <span class=\"size-1 rounded-full bg-muted-foreground/60\" />\n }\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\n <p\n title={text()}\n class={cn(\n 'm-0 line-clamp-3 text-sm [overflow-wrap:anywhere] whitespace-pre-wrap text-foreground',\n {\n 'text-muted-foreground': local.status === 'complete' || local.status === 'skipped',\n 'text-destructive': local.status === 'failed',\n }\n )}\n >\n {text()}\n <Show when={local.status}>\n {(status) => (\n <span class=\"sr-only\"> {local.statusLabel ?? TASK_ITEM_STATUS_LABELS[status()]}</span>\n )}\n </Show>\n </p>\n <Show when={local.description}>\n {(description) => (\n <p class=\"m-0 line-clamp-3 text-xs [overflow-wrap:anywhere] text-muted-foreground/80\">\n {bound(description(), MAX_TEXT)}\n </p>\n )}\n </Show>\n <Show when={files().length > 0}>\n <AttachmentList aria-label=\"Files\" class=\"gap-1\">\n <For each={shownFiles()}>\n {(file) => (\n <li class=\"min-w-0 max-w-full\">\n <Attachment variant=\"chip\" name={file.name} kind={file.kind} size={file.size} />\n </li>\n )}\n </For>\n <Show when={hiddenFiles() > 0}>\n <li class=\"flex items-center\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"2xs\"\n aria-expanded={showAllFiles()}\n onClick={() => setShowAllFiles((value) => !value)}\n >\n {showAllFiles() ? 'Show fewer files' : `Show ${hiddenFiles()} more files`}\n </Button>\n </li>\n </Show>\n </AttachmentList>\n </Show>\n </div>\n </li>\n )\n}\n\nexport type TaskItemListProps = Omit<ComponentProps<'div'>, 'children'> & {\n /** The list's accessible name. A scrolling region without one is an unlabelled tab stop. */\n label: string\n children?: JSX.Element\n}\n\n/**\n * The items, bounded. Two hundred todo items must scroll inside their line and\n * not push the answer out of view; the region is keyboard-focusable and named,\n * which is what makes the overflow reachable without a pointer.\n */\nexport function TaskItemList(props: TaskItemListProps) {\n const [local, rest] = splitProps(props, ['class', 'label', 'children'])\n return (\n <ScrollArea\n role=\"region\"\n aria-label={local.label}\n class={cn('max-h-72', local.class)}\n {...rest}\n >\n <ul role=\"list\" class=\"m-0 flex list-none flex-col gap-0.5 p-0\">\n {local.children}\n </ul>\n </ScrollArea>\n )\n}\n\nexport type TaskProps = Omit<\n TraceLineProps,\n 'description' | 'href' | 'onSelect' | 'selectHaspopup' | 'children'\n> & {\n items: readonly TaskItem[]\n /** The item list's accessible name. Defaults to the title when it is a string. */\n itemsLabel?: string\n}\n\nexport function Task(props: TaskProps) {\n const [local, rest] = splitProps(props, ['items', 'itemsLabel', 'icon', 'meta', 'title'])\n const progress = createMemo(() => taskProgress(local.items))\n const derivedMeta = () => {\n const value = progress()\n return value ? taskProgressLabel(value) : undefined\n }\n const label = () =>\n local.itemsLabel ?? (typeof local.title === 'string' ? `${local.title} items` : 'Task items')\n\n const list = () => (\n <TaskItemList label={label()}>\n <Index each={local.items}>\n {(item) => (\n <TaskItemRow\n text={item().text}\n description={item().description}\n status={item().status}\n files={item().files}\n />\n )}\n </Index>\n </TaskItemList>\n )\n\n return (\n <TraceLine\n icon={local.icon ?? <ListChecks />}\n title={local.title}\n meta={local.meta ?? derivedMeta()}\n {...rest}\n >\n {local.items.length > 0 ? list : undefined}\n </TraceLine>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6EA,IAAauB,0BAAoET;;AAGjF,IAAMU,gBAAgB;;AAEtB,IAAMC,WAAW;AAEjB,SAASC,MA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C,WAAA;EAAA,IACRO,OAAI;GAAA,OAAEnB,MAAMmB,QAAIJ,gBAAK1D,YAAU,CAAA,CAAA;EAAG;EAAA,IAClCgG,QAAK;GAAA,OAAErD,MAAMqD;EAAK;EAAA,IAClBE,OAAI;GAAA,OAAEvD,MAAMuD,QAAQH,YAAY;EAAC;CAAA,GAC7BnD,MAAI,EAAA,IAAAqB,WAAA;EAAA,OAEPtB,MAAMZ,MAAMH,SAAS,IAAIqE,OAAO7D,KAAAA;CAAS,EAAA,CAAA,CAAA;AAGhD"}
|
|
1
|
+
{"version":3,"file":"task.js","names":["ListChecks","createMemo","createSignal","For","Index","Show","splitProps","cn","Attachment","AttachmentList","Button","ScrollArea","TraceLine","TraceMark","WORK_STATUS_LABELS","WORK_TRACE_STATUS","name","kind","size","text","description","status","files","TASK_ITEM_STATUS_LABELS","VISIBLE_FILES","MAX_TEXT","bound","max","length","slice","taskProgress","items","done","total","some","item","undefined","filter","taskProgressLabel","progress","statusLabel","TaskItemRow","props","local","rest","showAllFiles","setShowAllFiles","shownFiles","hiddenFiles","_el$","_tmpl$2","_el$2","firstChild","_el$3","_$spread","_$mergeProps","class","_$insert","_$createComponent","slot","_$memo","completed","icon","_tmpl$3","when","children","_el$6","_tmpl$4","_el$8","_tmpl$5","each","file","_el$9","_tmpl$6","variant","_el$4","_tmpl$","type","onClick","value","_$effect","_p$","_v$","_v$2","e","_$setAttribute","t","_$className","label","TaskItemList","role","_el$0","_tmpl$7","itemsLabel","Task","derivedMeta","title","list","meta"],"sources":["../../../../src/components/composites/task/task.tsx"],"sourcesContent":["import { ListChecks } from 'lucide-solid'\nimport {\n createMemo,\n createSignal,\n For,\n Index,\n Show,\n splitProps,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Attachment, AttachmentList, type AttachmentKind } from '../../ui/attachment'\nimport { Button } from '../../ui/button'\nimport { ScrollArea } from '../../ui/scroll-area'\nimport {\n TraceLine,\n TraceMark,\n WORK_STATUS_LABELS,\n WORK_TRACE_STATUS,\n type TraceLineProps,\n type WorkStatus,\n} from '../../ui/trace'\n\n/**\n * Task.\n *\n * One piece of work the agent is doing, as a `TraceLine` that opens onto its\n * items: a title, then a list in which each item is a sentence, optionally a\n * status, and optionally the files it touched. Reach for `Plan` when the list is\n * a proposal the person approves, for `Queue` when it is the agent's running\n * todo list, and for a `Trace` of tool calls when the items are things that\n * *ran*, a Task item is a statement about work, not a record of a call.\n *\n * ## Items wrap; lines do not\n *\n * A `TraceLine` truncates its title to one row, which is right for \"Read\n * src/app.tsx\" and wrong for \"Backfill locale from profile.language, falling\n * back to en\". Items are therefore their own rows with the same mark and colour\n * vocabulary as a Trace line but wrapping text, clamped to three lines so a\n * pasted paragraph cannot take the column. `TaskItemRow` and `TaskItemList` are\n * exported because `Plan` and `Queue` are built from them.\n *\n * ## Status is a claim\n *\n * An item shows a mark and speaks a word only when the host supplied `status`.\n * The \"2 of 4 done\" in the header is derived from those statuses and appears\n * only if at least one item has one; items without a status are counted in the\n * total and not in \"done\" (see `taskProgress`). A task with no items is a plain\n * line: there is nothing to open, and an empty disclosure is a control that\n * does nothing.\n *\n * ## Files are untrusted metadata\n *\n * File chips are `Attachment` chips with no handlers, so they are text: a name\n * is never a link or a path. Past six, the rest sit behind one toggle button\n * whose label changes in place, so keyboard focus survives opening and closing\n * it.\n */\nexport type TaskItemStatus = WorkStatus\n\nexport type TaskFile = Readonly<{\n name: string\n kind?: AttachmentKind\n /** Bytes. */\n size?: number\n}>\n\nexport type TaskItem = Readonly<{\n /** Only needed for the host's own bookkeeping; rows are kept by position. */\n id?: string\n text: string\n description?: string\n status?: TaskItemStatus\n files?: readonly TaskFile[]\n}>\n\nexport const TASK_ITEM_STATUS_LABELS: Readonly<Record<TaskItemStatus, string>> = WORK_STATUS_LABELS\n\n/** Visible files per item before the rest go behind a toggle. */\nconst VISIBLE_FILES = 6\n/** Characters of item text kept; the rest of a pasted wall is not a todo. */\nconst MAX_TEXT = 1_000\n\nfunction bound(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}…` : text\n}\n\n/**\n * How many items are done, or nothing at all when no item carries a status.\n * Items without a status count toward the total: the host did not say they were\n * finished, so they are not.\n */\nexport function taskProgress(\n items: readonly Pick<TaskItem, 'status'>[]\n): Readonly<{ done: number; total: number }> | undefined {\n if (!items.some((item) => item.status !== undefined)) return undefined\n return {\n done: items.filter((item) => item.status === 'complete').length,\n total: items.length,\n }\n}\n\n/** `2 of 4 done`, in words. */\nexport function taskProgressLabel(progress: { done: number; total: number }): string {\n return `${progress.done} of ${progress.total} done`\n}\n\nexport type TaskItemRowProps = Omit<ComponentProps<'li'>, 'children'> & {\n text: string\n description?: string\n status?: TaskItemStatus\n files?: readonly TaskFile[]\n /** Spoken in place of the default status word. */\n statusLabel?: string\n}\n\nexport function TaskItemRow(props: TaskItemRowProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'text',\n 'description',\n 'status',\n 'files',\n 'statusLabel',\n ])\n const [showAllFiles, setShowAllFiles] = createSignal(false)\n const files = () => local.files ?? []\n const shownFiles = () => (showAllFiles() ? files() : files().slice(0, VISIBLE_FILES))\n const hiddenFiles = () => files().length - VISIBLE_FILES\n const text = () => bound(local.text, MAX_TEXT)\n\n return (\n <li\n data-slot=\"task-item\"\n data-status={local.status}\n class={cn('flex min-w-0 gap-2 rounded-md px-1.5 py-0.5', local.class)}\n {...rest}\n >\n <TraceMark\n slot=\"task-item-mark\"\n class=\"mt-0.5\"\n status={local.status ? WORK_TRACE_STATUS[local.status] : undefined}\n completed={local.status === 'complete'}\n icon={\n local.status ? undefined : <span class=\"size-1 rounded-full bg-muted-foreground/60\" />\n }\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\n <p\n title={text()}\n class={cn(\n 'm-0 line-clamp-3 text-sm [overflow-wrap:anywhere] whitespace-pre-wrap text-foreground',\n {\n 'text-muted-foreground': local.status === 'complete' || local.status === 'skipped',\n 'text-destructive': local.status === 'failed',\n }\n )}\n >\n {text()}\n <Show when={local.status}>\n {(status) => (\n <span class=\"sr-only\"> {local.statusLabel ?? TASK_ITEM_STATUS_LABELS[status()]}</span>\n )}\n </Show>\n </p>\n <Show when={local.description}>\n {(description) => (\n <p class=\"m-0 line-clamp-3 text-xs [overflow-wrap:anywhere] text-muted-foreground/80\">\n {bound(description(), MAX_TEXT)}\n </p>\n )}\n </Show>\n <Show when={files().length > 0}>\n <AttachmentList aria-label=\"Files\" class=\"gap-1\">\n <For each={shownFiles()}>\n {(file) => (\n <li class=\"min-w-0 max-w-full\">\n <Attachment variant=\"chip\" name={file.name} kind={file.kind} size={file.size} />\n </li>\n )}\n </For>\n <Show when={hiddenFiles() > 0}>\n <li class=\"flex items-center\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"2xs\"\n aria-expanded={showAllFiles()}\n onClick={() => setShowAllFiles((value) => !value)}\n >\n {showAllFiles() ? 'Show fewer files' : `Show ${hiddenFiles()} more files`}\n </Button>\n </li>\n </Show>\n </AttachmentList>\n </Show>\n </div>\n </li>\n )\n}\n\nexport type TaskItemListProps = Omit<ComponentProps<'div'>, 'children'> & {\n /** The list's accessible name. A scrolling region without one is an unlabelled tab stop. */\n label: string\n children?: JSX.Element\n}\n\n/**\n * The items, bounded. Two hundred todo items must scroll inside their line and\n * not push the answer out of view; the region is keyboard-focusable and named,\n * which is what makes the overflow reachable without a pointer.\n */\nexport function TaskItemList(props: TaskItemListProps) {\n const [local, rest] = splitProps(props, ['class', 'label', 'children'])\n return (\n <ScrollArea\n role=\"region\"\n aria-label={local.label}\n class={cn('max-h-72', local.class)}\n {...rest}\n >\n <ul role=\"list\" class=\"m-0 flex list-none flex-col gap-0.5 p-0\">\n {local.children}\n </ul>\n </ScrollArea>\n )\n}\n\nexport type TaskProps = Omit<\n TraceLineProps,\n 'description' | 'href' | 'onSelect' | 'selectHaspopup' | 'children'\n> & {\n items: readonly TaskItem[]\n /** The item list's accessible name. Defaults to the title when it is a string. */\n itemsLabel?: string\n}\n\nexport function Task(props: TaskProps) {\n const [local, rest] = splitProps(props, ['items', 'itemsLabel', 'icon', 'meta', 'title'])\n const progress = createMemo(() => taskProgress(local.items))\n const derivedMeta = () => {\n const value = progress()\n return value ? taskProgressLabel(value) : undefined\n }\n const label = () =>\n local.itemsLabel ?? (typeof local.title === 'string' ? `${local.title} items` : 'Task items')\n\n const list = () => (\n <TaskItemList label={label()}>\n <Index each={local.items}>\n {(item) => (\n <TaskItemRow\n text={item().text}\n description={item().description}\n status={item().status}\n files={item().files}\n />\n )}\n </Index>\n </TaskItemList>\n )\n\n return (\n <TraceLine\n icon={local.icon ?? <ListChecks />}\n title={local.title}\n meta={local.meta ?? derivedMeta()}\n {...rest}\n >\n {local.items.length > 0 ? list : undefined}\n </TraceLine>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6EA,IAAauB,0BAAoET;;AAGjF,IAAMU,gBAAgB;;AAEtB,IAAMC,WAAW;AAEjB,SAASC,MAAMP,MAAcQ,KAAqB;CAChD,OAAOR,KAAKS,SAASD,MAAM,GAAGR,KAAKU,MAAM,GAAGF,GAAG,EAAC,KAAMR;AACxD;;;;;;AAOA,SAAgBW,aACdC,OACuD;CACvD,IAAI,CAACA,MAAMG,MAAMC,SAASA,KAAKd,WAAWe,KAAAA,CAAS,GAAG,OAAOA,KAAAA;CAC7D,OAAO;EACLJ,MAAMD,MAAMM,QAAQF,SAASA,KAAKd,WAAW,UAAU,CAAC,CAACO;EACzDK,OAAOF,MAAMH;CACf;AACF;;AAGA,SAAgBU,kBAAkBC,UAAmD;CACnF,OAAO,GAAGA,SAASP,KAAI,MAAOO,SAASN,MAAK;AAC9C;AAWA,SAAgBQ,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQtC,WAAWoC,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;CAAa,CACd;CACD,MAAM,CAACG,cAAcC,mBAAmB5C,aAAa,KAAK;CAC1D,MAAMoB,cAAcqB,MAAMrB,SAAS,CA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cACJ7C,MAAMkD,eAAe,OAAOlD,MAAMqD,UAAU,WAAW,GAAGrD,MAAMqD,MAAK,UAAW;CAElF,MAAMC,aAAOvC,gBACV+B,cAAY;EAAA,IAACD,QAAK;GAAA,OAAEA,MAAM;EAAC;EAAA,IAAAvB,WAAA;GAAA,OAAAP,gBACzBtD,OAAK;IAAA,IAACkE,OAAI;KAAA,OAAE3B,MAAMZ;IAAK;IAAAkC,WACpB9B,SAAIuB,gBACHjB,aAAW;KAAA,IACVtB,OAAI;MAAA,OAAEgB,KAAK,CAAC,CAAChB;KAAI;KAAA,IACjBC,cAAW;MAAA,OAAEe,KAAK,CAAC,CAACf;KAAW;KAAA,IAC/BC,SAAM;MAAA,OAAEc,KAAK,CAAC,CAACd;KAAM;KAAA,IACrBC,QAAK;MAAA,OAAEa,KAAK,CAAC,CAACb;KAAK;IAAA,CAAA;GAEtB,CAAA;EAAA;CAAA,CAAA;CAKP,OAAAoC,gBACG9C,WAAS2C,WAAA;EAAA,IACRO,OAAI;GAAA,OAAEnB,MAAMmB,QAAIJ,gBAAK1D,YAAU,CAAA,CAAA;EAAG;EAAA,IAClCgG,QAAK;GAAA,OAAErD,MAAMqD;EAAK;EAAA,IAClBE,OAAI;GAAA,OAAEvD,MAAMuD,QAAQH,YAAY;EAAC;CAAA,GAC7BnD,MAAI,EAAA,IAAAqB,WAAA;EAAA,OAEPtB,MAAMZ,MAAMH,SAAS,IAAIqE,OAAO7D,KAAAA;CAAS,EAAA,CAAA,CAAA;AAGhD"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* A terminal's text, read safely.
|
|
3
3
|
*
|
|
4
4
|
* Command output is untrusted bytes, not text: it carries colour for the human
|
|
5
|
-
* who ran the command, cursor control for a screen that is not here, and
|
|
6
|
-
* a hostile program
|
|
5
|
+
* who ran the command, cursor control for a screen that is not here, and, from
|
|
6
|
+
* a hostile program, sequences that ask a terminal emulator to rewrite its
|
|
7
7
|
* title, write to the clipboard (OSC 52) or hide what it printed. This parser
|
|
8
8
|
* accepts exactly the part a transcript can honour and drops the rest:
|
|
9
9
|
*
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* ## Why a stateful parser
|
|
29
29
|
*
|
|
30
|
-
* Output arrives in chunks that split anywhere
|
|
30
|
+
* Output arrives in chunks that split anywhere, inside an escape sequence, in
|
|
31
31
|
* the middle of a line. `createAnsiParser` keeps the half-read sequence, the
|
|
32
32
|
* current style and the line being written between `write` calls, so a chunk
|
|
33
33
|
* boundary changes nothing about the result. Finished lines are immutable and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ansi.js","names":[],"sources":["../../../../src/components/composites/terminal/ansi.ts"],"sourcesContent":["/**\n * A terminal's text, read safely.\n *\n * Command output is untrusted bytes, not text: it carries colour for the human\n * who ran the command, cursor control for a screen that is not here, and — from\n * a hostile program — sequences that ask a terminal emulator to rewrite its\n * title, write to the clipboard (OSC 52) or hide what it printed. This parser\n * accepts exactly the part a transcript can honour and drops the rest:\n *\n * - **Kept:** printable text, `\\n`, `\\r` (the cursor returns to column 0 and\n * later text overwrites, which is how a progress bar redraws itself), `\\b`\n * (the cursor steps back one column), tab, `ESC[…K` (erase in line, which\n * progress bars pair with `\\r`), and SGR `ESC[…m` for the sixteen theme\n * colours, bold, dim, italic, underline, strike-through and reverse video.\n * - **Mapped:** 256-colour and truecolour SGR become the nearest of the sixteen,\n * so the output keeps the theme's palette and its contrast guarantees instead\n * of a program's idea of \"dark blue\" on a light terminal.\n * - **Dropped, never echoed:** every other CSI (cursor movement, scrolling,\n * private modes), OSC, DCS/SOS/PM/APC strings, charset designations, the 8-bit\n * C1 forms of all of these, every other control character, and the Unicode\n * bidirectional overrides that make text read differently from how it is\n * stored. A malformed or truncated sequence is dropped with its payload, so a\n * half-received `ESC[3` never shows up as the text \"3\".\n *\n * Nothing here produces markup. The result is plain strings with a style object,\n * and the renderer decides what a style looks like.\n *\n * ## Why a stateful parser\n *\n * Output arrives in chunks that split anywhere — inside an escape sequence, in\n * the middle of a line. `createAnsiParser` keeps the half-read sequence, the\n * current style and the line being written between `write` calls, so a chunk\n * boundary changes nothing about the result. Finished lines are immutable and\n * never touched again, which is what lets a renderer keep their DOM while the\n * last line keeps growing. `parseAnsi` is the same thing run once.\n */\n\n/** An index into the sixteen-colour palette: 0–7 normal, 8–15 bright. */\nexport type AnsiColor = number\n\nexport type AnsiStyle = Readonly<{\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: true\n dim?: true\n italic?: true\n underline?: true\n strike?: true\n inverse?: true\n}>\n\nexport type AnsiSegment = Readonly<{ text: string; style: AnsiStyle }>\n\nexport type AnsiLine = Readonly<{\n segments: readonly AnsiSegment[]\n /** Characters past `maxLineLength` that were not kept. Zero for most lines. */\n truncated: number\n}>\n\nexport type AnsiParserOptions = {\n /** Characters kept per line; the rest are counted in `truncated`. Default 10 000. */\n maxLineLength?: number\n /**\n * Finished lines kept. The oldest are discarded (and counted in `droppedLines`)\n * past this, so a command that prints for an hour cannot grow the parser\n * without bound. Default 200 000.\n */\n retainLines?: number\n}\n\nexport type AnsiParser = {\n /** Feed the next chunk. Chunks may split anywhere, including inside an escape. */\n write(chunk: string): void\n /** Finished lines, oldest first. The array is mutated in place as lines arrive. */\n readonly lines: readonly AnsiLine[]\n /** The line still being written, or `undefined` while it is empty. */\n openLine(): AnsiLine | undefined\n /** Finished lines discarded because of `retainLines`. */\n readonly droppedLines: number\n}\n\nexport const ANSI_MAX_LINE_LENGTH = 10_000\nexport const ANSI_RETAIN_LINES = 200_000\n\n/** Longest CSI parameter string worth reading; a real SGR is under 40 characters. */\nconst CSI_MAX = 256\n\nconst PLAIN: AnsiStyle = Object.freeze({})\nconst styleCache = new Map<string, AnsiStyle>()\nconst STYLE_CACHE_LIMIT = 4096\n\n/**\n * Styles are shared by value so a long run of identical style compares by\n * reference when cells are merged into segments, and so a million coloured\n * characters do not allocate a million style objects.\n */\nfunction intern(style: {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}): AnsiStyle {\n const key = [\n style.fg ?? '',\n style.bg ?? '',\n style.bold ? 'b' : '',\n style.dim ? 'd' : '',\n style.italic ? 'i' : '',\n style.underline ? 'u' : '',\n style.strike ? 's' : '',\n style.inverse ? 'r' : '',\n ].join('|')\n if (key === '|||||||') return PLAIN\n const cached = styleCache.get(key)\n if (cached) return cached\n const next: AnsiStyle = Object.freeze({\n ...(style.fg !== undefined && { fg: style.fg }),\n ...(style.bg !== undefined && { bg: style.bg }),\n ...(style.bold && { bold: true as const }),\n ...(style.dim && { dim: true as const }),\n ...(style.italic && { italic: true as const }),\n ...(style.underline && { underline: true as const }),\n ...(style.strike && { strike: true as const }),\n ...(style.inverse && { inverse: true as const }),\n })\n if (styleCache.size < STYLE_CACHE_LIMIT) styleCache.set(key, next)\n return next\n}\n\n/** Whether a style paints nothing, so the renderer can emit a bare text node. */\nexport function isPlainStyle(style: AnsiStyle): boolean {\n return (\n style.fg === undefined &&\n style.bg === undefined &&\n !style.bold &&\n !style.dim &&\n !style.italic &&\n !style.underline &&\n !style.strike &&\n !style.inverse\n )\n}\n\n/**\n * The colours a style actually paints. Reverse video swaps them; a swapped side\n * with no colour of its own resolves to the terminal's default foreground or\n * background (`'default-fg'`, `'default-bg'`), which are themselves theme tokens.\n */\nexport type ResolvedColors = Readonly<{\n fg: AnsiColor | 'default-bg' | undefined\n bg: AnsiColor | 'default-fg' | undefined\n}>\n\nexport function resolveColors(style: AnsiStyle): ResolvedColors {\n if (!style.inverse) return { fg: style.fg, bg: style.bg }\n return { fg: style.bg ?? 'default-bg', bg: style.fg ?? 'default-fg' }\n}\n\n// The xterm default palette, used only to decide which of the sixteen theme\n// colours an extended colour is closest to.\nconst XTERM_16: readonly (readonly [number, number, number])[] = [\n [0, 0, 0],\n [205, 0, 0],\n [0, 205, 0],\n [205, 205, 0],\n [0, 0, 238],\n [205, 0, 205],\n [0, 205, 205],\n [229, 229, 229],\n [127, 127, 127],\n [255, 0, 0],\n [0, 255, 0],\n [255, 255, 0],\n [92, 92, 255],\n [255, 0, 255],\n [0, 255, 255],\n [255, 255, 255],\n]\nconst CUBE_LEVELS = [0, 95, 135, 175, 215, 255] as const\n\nconst clamp = (value: number) => Math.min(255, Math.max(0, Math.round(value) || 0))\n\n/** The palette index (0–15) nearest to an RGB colour. Channels are clamped to 0–255. */\nexport function nearestAnsiColor(r: number, g: number, b: number): AnsiColor {\n const red = clamp(r)\n const green = clamp(g)\n const blue = clamp(b)\n let best = 0\n let bestDistance = Infinity\n for (let index = 0; index < XTERM_16.length; index += 1) {\n const [pr, pg, pb] = XTERM_16[index]!\n // The weights are the \"redmean\" approximation: cheap, and much closer to how\n // the eye separates two colours than plain Euclidean distance.\n const meanRed = (red + pr) / 2\n const dr = red - pr\n const dg = green - pg\n const db = blue - pb\n const distance =\n (2 + meanRed / 256) * dr * dr + 4 * dg * dg + (2 + (255 - meanRed) / 256) * db * db\n if (distance < bestDistance) {\n bestDistance = distance\n best = index\n }\n }\n return best\n}\n\n/** Map a 256-colour index to the sixteen. Out-of-range indices give `undefined`. */\nexport function ansi256ToColor(index: number): AnsiColor | undefined {\n if (!Number.isInteger(index) || index < 0 || index > 255) return undefined\n if (index < 16) return index\n if (index >= 232) {\n const grey = 8 + (index - 232) * 10\n return nearestAnsiColor(grey, grey, grey)\n }\n const cube = index - 16\n return nearestAnsiColor(\n CUBE_LEVELS[Math.floor(cube / 36)]!,\n CUBE_LEVELS[Math.floor(cube / 6) % 6]!,\n CUBE_LEVELS[cube % 6]!\n )\n}\n\ntype MutableStyle = {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}\n\n/** A parameter is a short run of digits; anything else is not a number we trust. */\nfunction toNumber(token: string | undefined): number | undefined {\n if (token === undefined) return undefined\n if (token === '') return 0\n if (token.length > 5 || !/^\\d+$/.test(token)) return undefined\n return Number(token)\n}\n\n/**\n * Apply one SGR parameter list to a style. Unknown parameters are skipped one\n * at a time, so a program using a code we ignore still gets the colours around\n * it. Extended colours (38/48) consume their operands whether or not they are\n * valid, so a malformed one cannot be re-read as unrelated codes.\n */\nfunction applySgr(current: AnsiStyle, params: string): AnsiStyle {\n const style: MutableStyle = { ...current }\n const tokens = params === '' ? ['0'] : params.split(';')\n\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i]!\n // The colon form `38:2::r:g:b` carries its operands in one token.\n if (token.includes(':')) {\n const parts = token.split(':')\n const head = toNumber(parts[0])\n if (head === 38 || head === 48) {\n const color = extendedColor(parts[1] === undefined ? [] : parts.slice(1), true)\n if (color !== null) assign(style, head, color)\n } else if (head === 4) {\n if (parts[1] === '0') style.underline = false\n else style.underline = true\n }\n continue\n }\n\n const code = toNumber(token)\n if (code === undefined) continue\n\n if (code === 38 || code === 48) {\n const mode = toNumber(tokens[i + 1])\n const count = mode === 5 ? 1 : mode === 2 ? 3 : 0\n const operands = tokens.slice(i + 2, i + 2 + count)\n i += 1 + count\n const color = extendedColor([String(mode ?? ''), ...operands], false)\n if (color !== null) assign(style, code, color)\n continue\n }\n if (code === 58) {\n // Underline colour: consumed so its operands are not read as codes, then ignored.\n const mode = toNumber(tokens[i + 1])\n i += 1 + (mode === 5 ? 1 : mode === 2 ? 3 : 0)\n continue\n }\n\n if (code === 0) {\n delete style.fg\n delete style.bg\n style.bold = style.dim = style.italic = style.underline = false\n style.strike = style.inverse = false\n } else if (code === 1) style.bold = true\n else if (code === 2) style.dim = true\n else if (code === 3) style.italic = true\n else if (code === 4 || code === 21) style.underline = true\n else if (code === 7) style.inverse = true\n else if (code === 9) style.strike = true\n else if (code === 22) style.bold = style.dim = false\n else if (code === 23) style.italic = false\n else if (code === 24) style.underline = false\n else if (code === 27) style.inverse = false\n else if (code === 29) style.strike = false\n else if (code >= 30 && code <= 37) style.fg = code - 30\n else if (code === 39) delete style.fg\n else if (code >= 40 && code <= 47) style.bg = code - 40\n else if (code === 49) delete style.bg\n else if (code >= 90 && code <= 97) style.fg = code - 90 + 8\n else if (code >= 100 && code <= 107) style.bg = code - 100 + 8\n // Blink (5, 6), conceal (8), overline (53) and the rest are ignored. Conceal\n // in particular is not honoured: output must not be able to hide itself.\n }\n return intern(style)\n}\n\n/** The colour an extended-colour operand list names, or `null` when it is invalid. */\nfunction extendedColor(parts: readonly string[], colon: boolean): AnsiColor | null {\n const mode = toNumber(parts[0])\n if (mode === 5) {\n const index = toNumber(parts[1])\n const color = index === undefined ? undefined : ansi256ToColor(index)\n return color ?? null\n }\n if (mode === 2) {\n // In the colon form a colour-space id may precede the channels, empty or not.\n const channels = colon && parts.length > 4 ? parts.slice(2) : parts.slice(1)\n const [r, g, b] = channels.slice(0, 3).map(toNumber)\n if (r === undefined || g === undefined || b === undefined) return null\n if (r > 255 || g > 255 || b > 255) return null\n return nearestAnsiColor(r, g, b)\n }\n return null\n}\n\nfunction assign(style: MutableStyle, code: number, color: AnsiColor): void {\n if (code === 38) style.fg = color\n else style.bg = color\n}\n\n/** Characters that are never rendered: C0 except tab, DEL, C1, and bidi controls. */\nfunction isDroppedControl(code: number): boolean {\n return (\n (code < 0x20 && code !== 0x09) ||\n code === 0x7f ||\n (code >= 0x80 && code <= 0x9f) ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069) ||\n code === 0x2028 ||\n code === 0x2029\n )\n}\n\ntype Run = { text: string; style: AnsiStyle }\n\n/**\n * The line being written. While the cursor only ever moves right it is a list of\n * styled runs, which is cheap; the first time something moves it left (`\\r`,\n * `\\b`) it becomes one cell per UTF-16 unit so later text can overwrite.\n */\nclass LineBuffer {\n private runs: Run[] = []\n private cells: string[] | undefined\n private cellStyles: AnsiStyle[] | undefined\n private cursor = 0\n private length = 0\n private dropped = 0\n /** A `\\r` seen but not yet applied: `\\r\\n` is by far the common case. */\n private pendingReturn = false\n\n constructor(private readonly max: number) {}\n\n isEmpty(): boolean {\n return this.length === 0 && this.dropped === 0\n }\n\n put(text: string, style: AnsiStyle): void {\n if (text === '') return\n this.applyReturn()\n if (this.cells === undefined) {\n const room = this.max - this.length\n if (room <= 0) {\n this.dropped += text.length\n return\n }\n const kept = text.length > room ? text.slice(0, room) : text\n this.dropped += text.length - kept.length\n const last = this.runs[this.runs.length - 1]\n if (last && last.style === style) last.text += kept\n else this.runs.push({ text: kept, style })\n this.length += kept.length\n this.cursor = this.length\n return\n }\n for (let i = 0; i < text.length; i += 1) this.putCell(text[i]!, style)\n }\n\n private putCell(char: string, style: AnsiStyle): void {\n const cells = this.cells!\n const styles = this.cellStyles!\n if (this.cursor >= this.max) {\n this.dropped += 1\n return\n }\n while (cells.length < this.cursor) {\n cells.push(' ')\n styles.push(PLAIN)\n }\n cells[this.cursor] = char\n styles[this.cursor] = style\n this.cursor += 1\n this.length = cells.length\n }\n\n carriageReturn(): void {\n this.pendingReturn = true\n }\n\n backspace(): void {\n this.applyReturn()\n if (this.cursor === 0) return\n this.toCells()\n this.cursor -= 1\n }\n\n /** `ESC[nK`: 0 from the cursor to the end, 1 start to cursor, 2 the whole line. */\n eraseInLine(mode: number): void {\n this.applyReturn()\n if (mode === 0 && this.cursor >= this.length) return\n this.toCells()\n const cells = this.cells!\n const styles = this.cellStyles!\n if (mode === 0) {\n cells.length = this.cursor\n styles.length = this.cursor\n } else if (mode === 1) {\n for (let i = 0; i <= this.cursor && i < cells.length; i += 1) {\n cells[i] = ' '\n styles[i] = PLAIN\n }\n } else if (mode === 2) {\n cells.length = 0\n styles.length = 0\n }\n this.length = cells.length\n }\n\n private applyReturn(): void {\n if (!this.pendingReturn) return\n this.pendingReturn = false\n if (this.length === 0) {\n this.cursor = 0\n return\n }\n this.toCells()\n this.cursor = 0\n }\n\n private toCells(): void {\n if (this.cells !== undefined) return\n const cells: string[] = []\n const styles: AnsiStyle[] = []\n for (const run of this.runs) {\n for (let i = 0; i < run.text.length; i += 1) {\n cells.push(run.text[i]!)\n styles.push(run.style)\n }\n }\n this.cells = cells\n this.cellStyles = styles\n this.runs = []\n this.cursor = Math.min(this.cursor, cells.length)\n }\n\n snapshot(): AnsiLine {\n const segments: AnsiSegment[] = []\n if (this.cells === undefined) {\n for (const run of this.runs) segments.push({ text: run.text, style: run.style })\n } else {\n const cells = this.cells\n const styles = this.cellStyles!\n let start = 0\n for (let i = 1; i <= cells.length; i += 1) {\n if (i === cells.length || styles[i] !== styles[start]) {\n segments.push({ text: cells.slice(start, i).join(''), style: styles[start]! })\n start = i\n }\n }\n }\n return { segments, truncated: this.dropped }\n }\n\n reset(): void {\n this.runs = []\n this.cells = undefined\n this.cellStyles = undefined\n this.cursor = 0\n this.length = 0\n this.dropped = 0\n this.pendingReturn = false\n }\n}\n\ntype State = 'text' | 'esc' | 'esc-intermediate' | 'csi' | 'string' | 'string-esc'\n\nexport function createAnsiParser(options: AnsiParserOptions = {}): AnsiParser {\n const maxLine = Math.max(1, Math.floor(options.maxLineLength ?? ANSI_MAX_LINE_LENGTH))\n const retain = Math.max(1, Math.floor(options.retainLines ?? ANSI_RETAIN_LINES))\n const lines: AnsiLine[] = []\n let droppedLines = 0\n const line = new LineBuffer(maxLine)\n let style: AnsiStyle = PLAIN\n let state: State = 'text'\n let csi = ''\n let csiOverflow = false\n // Only the 7-bit `ESC [` introducer is honoured. The 8-bit form is consumed so\n // its parameters are not echoed, but it never changes the style: it is a rarity\n // in real output and a favourite of filter-evasion payloads.\n let csiHonoured = true\n\n const finishLine = () => {\n lines.push(line.snapshot())\n line.reset()\n // Trim in blocks so the common append stays O(1) amortised.\n if (lines.length > retain + Math.max(64, retain >> 3)) {\n const excess = lines.length - retain\n lines.splice(0, excess)\n droppedLines += excess\n }\n }\n\n const runCsi = (final: string) => {\n if (csiOverflow || !csiHonoured) return\n // Only plain numeric parameters are honoured; a private marker (`?`, `>`,\n // `<`, `=`) or an intermediate byte makes this some other command entirely.\n if (!/^[\\d;:]*$/.test(csi)) return\n if (final === 'm') style = applySgr(style, csi)\n else if (final === 'K') {\n const mode = toNumber(csi.split(';')[0])\n if (mode !== undefined && mode <= 2) line.eraseInLine(mode)\n }\n }\n\n function write(chunk: string): void {\n for (let i = 0; i < chunk.length; i += 1) {\n const code = chunk.charCodeAt(i)\n\n switch (state) {\n case 'text': {\n if (!isDroppedControl(code)) {\n // Take the whole run of ordinary characters at once.\n let end = i + 1\n while (end < chunk.length && !isDroppedControl(chunk.charCodeAt(end))) end += 1\n line.put(chunk.slice(i, end), style)\n i = end - 1\n break\n }\n if (code === 0x1b) state = 'esc'\n else if (code === 0x0a) finishLine()\n else if (code === 0x0d) line.carriageReturn()\n else if (code === 0x08) line.backspace()\n else if (code === 0x9b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = false\n } else if (\n code === 0x9d ||\n code === 0x90 ||\n code === 0x98 ||\n code === 0x9e ||\n code === 0x9f\n ) {\n state = 'string'\n }\n // Every other control character is dropped.\n break\n }\n case 'esc': {\n if (code === 0x5b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = true\n } else if (\n code === 0x5d ||\n code === 0x50 ||\n code === 0x58 ||\n code === 0x5e ||\n code === 0x5f\n ) {\n state = 'string'\n } else if (code >= 0x20 && code <= 0x2f) state = 'esc-intermediate'\n else if (code >= 0x30 && code <= 0x7e) state = 'text'\n else if (code === 0x1b) state = 'esc'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'esc-intermediate': {\n if (code >= 0x20 && code <= 0x2f) break\n if (code >= 0x30 && code <= 0x7e) state = 'text'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'csi': {\n if (code >= 0x20 && code <= 0x3f) {\n if (csi.length < CSI_MAX) csi += chunk[i]\n else csiOverflow = true\n } else if (code >= 0x40 && code <= 0x7e) {\n runCsi(chunk[i]!)\n state = 'text'\n } else if (code === 0x1b) state = 'esc'\n else {\n // A control character or non-ASCII byte cannot be part of a CSI: the\n // sequence was malformed. Drop it and read this character normally.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string': {\n if (code === 0x07 || code === 0x9c) state = 'text'\n else if (code === 0x1b) state = 'string-esc'\n else if (code === 0x0a || code === 0x0d) {\n // No real title or clipboard payload spans a line. Ending here bounds\n // what an unterminated string can swallow to the rest of its line.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string-esc': {\n if (code === 0x5c) state = 'text'\n else {\n state = 'esc'\n i -= 1\n }\n break\n }\n }\n }\n }\n\n return {\n write,\n lines,\n openLine: () => (line.isEmpty() ? undefined : line.snapshot()),\n get droppedLines() {\n return droppedLines\n },\n }\n}\n\n/** Parse a whole output at once: finished lines plus the open one, if any. */\nexport function parseAnsi(text: string, options?: AnsiParserOptions): AnsiLine[] {\n const parser = createAnsiParser(options)\n parser.write(text)\n const open = parser.openLine()\n return open ? [...parser.lines, open] : [...parser.lines]\n}\n\n/**\n * The whole output as a reader sees it, for the clipboard: every line, none\n * shortened, with escape sequences and overwritten text resolved away.\n */\nexport function ansiPlainText(text: string): string {\n const parser = createAnsiParser({\n maxLineLength: Number.POSITIVE_INFINITY,\n retainLines: Number.POSITIVE_INFINITY,\n })\n parser.write(text)\n const open = parser.openLine()\n // Finished lines carry their newline even when only control sequences follow.\n return [...parser.lines.map(ansiLineText), open ? ansiLineText(open) : ''].join('\\n')\n}\n\n/** A line's text with styling removed, for tests and for accessible names. */\nexport function ansiLineText(line: AnsiLine): string {\n return line.segments.map((segment) => segment.text).join('')\n}\n"],"mappings":";AAiFA,IAAa,uBAAuB;AACpC,IAAa,oBAAoB;;AAGjC,IAAM,UAAU;AAEhB,IAAM,QAAmB,OAAO,OAAO,CAAC,CAAC;AACzC,IAAM,6BAAa,IAAI,IAAuB;AAC9C,IAAM,oBAAoB;;;;;;AAO1B,SAAS,OAAO,OASF;CACZ,MAAM,MAAM;EACV,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,MAAM,OAAO,MAAM;EACnB,MAAM,MAAM,MAAM;EAClB,MAAM,SAAS,MAA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Q;UAC7B;MAGH,QAAQ;MACR,KAAK;KACP;KACA;IAEF,KAAK;KACH,IAAI,SAAS,KAAQ,SAAS,KAAM,QAAQ;UACvC,IAAI,SAAS,IAAM,QAAQ;UAC3B,IAAI,SAAS,MAAQ,SAAS,IAAM;MAGvC,QAAQ;MACR,KAAK;KACP;KACA;IAEF,KAAK,cACH,IAAI,SAAS,IAAM,QAAQ;SACtB;KACH,QAAQ;KACR,KAAK;IACP;GAGJ;EACF;CACF;CAEA,OAAO;EACL;EACA;EACA,gBAAiB,KAAK,QAAQ,IAAI,KAAA,IAAY,KAAK,SAAS;EAC5D,IAAI,eAAe;GACjB,OAAO;EACT;CACF;AACF;;AAGA,SAAgB,UAAU,MAAc,SAAyC;CAC/E,MAAM,SAAS,iBAAiB,OAAO;CACvC,OAAO,MAAM,IAAI;CACjB,MAAM,OAAO,OAAO,SAAS;CAC7B,OAAO,OAAO,CAAC,GAAG,OAAO,OAAO,IAAI,IAAI,CAAC,GAAG,OAAO,KAAK;AAC1D;;;;;AAMA,SAAgB,cAAc,MAAsB;CAClD,MAAM,SAAS,iBAAiB;EAC9B,eAAe,OAAO;EACtB,aAAa,OAAO;CACtB,CAAC;CACD,OAAO,MAAM,IAAI;CACjB,MAAM,OAAO,OAAO,SAAS;CAE7B,OAAO,CAAC,GAAG,OAAO,MAAM,IAAI,YAAY,GAAG,OAAO,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,IAAI;AACtF;;AAGA,SAAgB,aAAa,MAAwB;CACnD,OAAO,KAAK,SAAS,KAAK,YAAY,QAAQ,IAAI,CAAC,CAAC,KAAK,EAAE;AAC7D"}
|
|
1
|
+
{"version":3,"file":"ansi.js","names":[],"sources":["../../../../src/components/composites/terminal/ansi.ts"],"sourcesContent":["/**\n * A terminal's text, read safely.\n *\n * Command output is untrusted bytes, not text: it carries colour for the human\n * who ran the command, cursor control for a screen that is not here, and, from\n * a hostile program, sequences that ask a terminal emulator to rewrite its\n * title, write to the clipboard (OSC 52) or hide what it printed. This parser\n * accepts exactly the part a transcript can honour and drops the rest:\n *\n * - **Kept:** printable text, `\\n`, `\\r` (the cursor returns to column 0 and\n * later text overwrites, which is how a progress bar redraws itself), `\\b`\n * (the cursor steps back one column), tab, `ESC[…K` (erase in line, which\n * progress bars pair with `\\r`), and SGR `ESC[…m` for the sixteen theme\n * colours, bold, dim, italic, underline, strike-through and reverse video.\n * - **Mapped:** 256-colour and truecolour SGR become the nearest of the sixteen,\n * so the output keeps the theme's palette and its contrast guarantees instead\n * of a program's idea of \"dark blue\" on a light terminal.\n * - **Dropped, never echoed:** every other CSI (cursor movement, scrolling,\n * private modes), OSC, DCS/SOS/PM/APC strings, charset designations, the 8-bit\n * C1 forms of all of these, every other control character, and the Unicode\n * bidirectional overrides that make text read differently from how it is\n * stored. A malformed or truncated sequence is dropped with its payload, so a\n * half-received `ESC[3` never shows up as the text \"3\".\n *\n * Nothing here produces markup. The result is plain strings with a style object,\n * and the renderer decides what a style looks like.\n *\n * ## Why a stateful parser\n *\n * Output arrives in chunks that split anywhere, inside an escape sequence, in\n * the middle of a line. `createAnsiParser` keeps the half-read sequence, the\n * current style and the line being written between `write` calls, so a chunk\n * boundary changes nothing about the result. Finished lines are immutable and\n * never touched again, which is what lets a renderer keep their DOM while the\n * last line keeps growing. `parseAnsi` is the same thing run once.\n */\n\n/** An index into the sixteen-colour palette: 0–7 normal, 8–15 bright. */\nexport type AnsiColor = number\n\nexport type AnsiStyle = Readonly<{\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: true\n dim?: true\n italic?: true\n underline?: true\n strike?: true\n inverse?: true\n}>\n\nexport type AnsiSegment = Readonly<{ text: string; style: AnsiStyle }>\n\nexport type AnsiLine = Readonly<{\n segments: readonly AnsiSegment[]\n /** Characters past `maxLineLength` that were not kept. Zero for most lines. */\n truncated: number\n}>\n\nexport type AnsiParserOptions = {\n /** Characters kept per line; the rest are counted in `truncated`. Default 10 000. */\n maxLineLength?: number\n /**\n * Finished lines kept. The oldest are discarded (and counted in `droppedLines`)\n * past this, so a command that prints for an hour cannot grow the parser\n * without bound. Default 200 000.\n */\n retainLines?: number\n}\n\nexport type AnsiParser = {\n /** Feed the next chunk. Chunks may split anywhere, including inside an escape. */\n write(chunk: string): void\n /** Finished lines, oldest first. The array is mutated in place as lines arrive. */\n readonly lines: readonly AnsiLine[]\n /** The line still being written, or `undefined` while it is empty. */\n openLine(): AnsiLine | undefined\n /** Finished lines discarded because of `retainLines`. */\n readonly droppedLines: number\n}\n\nexport const ANSI_MAX_LINE_LENGTH = 10_000\nexport const ANSI_RETAIN_LINES = 200_000\n\n/** Longest CSI parameter string worth reading; a real SGR is under 40 characters. */\nconst CSI_MAX = 256\n\nconst PLAIN: AnsiStyle = Object.freeze({})\nconst styleCache = new Map<string, AnsiStyle>()\nconst STYLE_CACHE_LIMIT = 4096\n\n/**\n * Styles are shared by value so a long run of identical style compares by\n * reference when cells are merged into segments, and so a million coloured\n * characters do not allocate a million style objects.\n */\nfunction intern(style: {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}): AnsiStyle {\n const key = [\n style.fg ?? '',\n style.bg ?? '',\n style.bold ? 'b' : '',\n style.dim ? 'd' : '',\n style.italic ? 'i' : '',\n style.underline ? 'u' : '',\n style.strike ? 's' : '',\n style.inverse ? 'r' : '',\n ].join('|')\n if (key === '|||||||') return PLAIN\n const cached = styleCache.get(key)\n if (cached) return cached\n const next: AnsiStyle = Object.freeze({\n ...(style.fg !== undefined && { fg: style.fg }),\n ...(style.bg !== undefined && { bg: style.bg }),\n ...(style.bold && { bold: true as const }),\n ...(style.dim && { dim: true as const }),\n ...(style.italic && { italic: true as const }),\n ...(style.underline && { underline: true as const }),\n ...(style.strike && { strike: true as const }),\n ...(style.inverse && { inverse: true as const }),\n })\n if (styleCache.size < STYLE_CACHE_LIMIT) styleCache.set(key, next)\n return next\n}\n\n/** Whether a style paints nothing, so the renderer can emit a bare text node. */\nexport function isPlainStyle(style: AnsiStyle): boolean {\n return (\n style.fg === undefined &&\n style.bg === undefined &&\n !style.bold &&\n !style.dim &&\n !style.italic &&\n !style.underline &&\n !style.strike &&\n !style.inverse\n )\n}\n\n/**\n * The colours a style actually paints. Reverse video swaps them; a swapped side\n * with no colour of its own resolves to the terminal's default foreground or\n * background (`'default-fg'`, `'default-bg'`), which are themselves theme tokens.\n */\nexport type ResolvedColors = Readonly<{\n fg: AnsiColor | 'default-bg' | undefined\n bg: AnsiColor | 'default-fg' | undefined\n}>\n\nexport function resolveColors(style: AnsiStyle): ResolvedColors {\n if (!style.inverse) return { fg: style.fg, bg: style.bg }\n return { fg: style.bg ?? 'default-bg', bg: style.fg ?? 'default-fg' }\n}\n\n// The xterm default palette, used only to decide which of the sixteen theme\n// colours an extended colour is closest to.\nconst XTERM_16: readonly (readonly [number, number, number])[] = [\n [0, 0, 0],\n [205, 0, 0],\n [0, 205, 0],\n [205, 205, 0],\n [0, 0, 238],\n [205, 0, 205],\n [0, 205, 205],\n [229, 229, 229],\n [127, 127, 127],\n [255, 0, 0],\n [0, 255, 0],\n [255, 255, 0],\n [92, 92, 255],\n [255, 0, 255],\n [0, 255, 255],\n [255, 255, 255],\n]\nconst CUBE_LEVELS = [0, 95, 135, 175, 215, 255] as const\n\nconst clamp = (value: number) => Math.min(255, Math.max(0, Math.round(value) || 0))\n\n/** The palette index (0–15) nearest to an RGB colour. Channels are clamped to 0–255. */\nexport function nearestAnsiColor(r: number, g: number, b: number): AnsiColor {\n const red = clamp(r)\n const green = clamp(g)\n const blue = clamp(b)\n let best = 0\n let bestDistance = Infinity\n for (let index = 0; index < XTERM_16.length; index += 1) {\n const [pr, pg, pb] = XTERM_16[index]!\n // The weights are the \"redmean\" approximation: cheap, and much closer to how\n // the eye separates two colours than plain Euclidean distance.\n const meanRed = (red + pr) / 2\n const dr = red - pr\n const dg = green - pg\n const db = blue - pb\n const distance =\n (2 + meanRed / 256) * dr * dr + 4 * dg * dg + (2 + (255 - meanRed) / 256) * db * db\n if (distance < bestDistance) {\n bestDistance = distance\n best = index\n }\n }\n return best\n}\n\n/** Map a 256-colour index to the sixteen. Out-of-range indices give `undefined`. */\nexport function ansi256ToColor(index: number): AnsiColor | undefined {\n if (!Number.isInteger(index) || index < 0 || index > 255) return undefined\n if (index < 16) return index\n if (index >= 232) {\n const grey = 8 + (index - 232) * 10\n return nearestAnsiColor(grey, grey, grey)\n }\n const cube = index - 16\n return nearestAnsiColor(\n CUBE_LEVELS[Math.floor(cube / 36)]!,\n CUBE_LEVELS[Math.floor(cube / 6) % 6]!,\n CUBE_LEVELS[cube % 6]!\n )\n}\n\ntype MutableStyle = {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}\n\n/** A parameter is a short run of digits; anything else is not a number we trust. */\nfunction toNumber(token: string | undefined): number | undefined {\n if (token === undefined) return undefined\n if (token === '') return 0\n if (token.length > 5 || !/^\\d+$/.test(token)) return undefined\n return Number(token)\n}\n\n/**\n * Apply one SGR parameter list to a style. Unknown parameters are skipped one\n * at a time, so a program using a code we ignore still gets the colours around\n * it. Extended colours (38/48) consume their operands whether or not they are\n * valid, so a malformed one cannot be re-read as unrelated codes.\n */\nfunction applySgr(current: AnsiStyle, params: string): AnsiStyle {\n const style: MutableStyle = { ...current }\n const tokens = params === '' ? ['0'] : params.split(';')\n\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i]!\n // The colon form `38:2::r:g:b` carries its operands in one token.\n if (token.includes(':')) {\n const parts = token.split(':')\n const head = toNumber(parts[0])\n if (head === 38 || head === 48) {\n const color = extendedColor(parts[1] === undefined ? [] : parts.slice(1), true)\n if (color !== null) assign(style, head, color)\n } else if (head === 4) {\n if (parts[1] === '0') style.underline = false\n else style.underline = true\n }\n continue\n }\n\n const code = toNumber(token)\n if (code === undefined) continue\n\n if (code === 38 || code === 48) {\n const mode = toNumber(tokens[i + 1])\n const count = mode === 5 ? 1 : mode === 2 ? 3 : 0\n const operands = tokens.slice(i + 2, i + 2 + count)\n i += 1 + count\n const color = extendedColor([String(mode ?? ''), ...operands], false)\n if (color !== null) assign(style, code, color)\n continue\n }\n if (code === 58) {\n // Underline colour: consumed so its operands are not read as codes, then ignored.\n const mode = toNumber(tokens[i + 1])\n i += 1 + (mode === 5 ? 1 : mode === 2 ? 3 : 0)\n continue\n }\n\n if (code === 0) {\n delete style.fg\n delete style.bg\n style.bold = style.dim = style.italic = style.underline = false\n style.strike = style.inverse = false\n } else if (code === 1) style.bold = true\n else if (code === 2) style.dim = true\n else if (code === 3) style.italic = true\n else if (code === 4 || code === 21) style.underline = true\n else if (code === 7) style.inverse = true\n else if (code === 9) style.strike = true\n else if (code === 22) style.bold = style.dim = false\n else if (code === 23) style.italic = false\n else if (code === 24) style.underline = false\n else if (code === 27) style.inverse = false\n else if (code === 29) style.strike = false\n else if (code >= 30 && code <= 37) style.fg = code - 30\n else if (code === 39) delete style.fg\n else if (code >= 40 && code <= 47) style.bg = code - 40\n else if (code === 49) delete style.bg\n else if (code >= 90 && code <= 97) style.fg = code - 90 + 8\n else if (code >= 100 && code <= 107) style.bg = code - 100 + 8\n // Blink (5, 6), conceal (8), overline (53) and the rest are ignored. Conceal\n // in particular is not honoured: output must not be able to hide itself.\n }\n return intern(style)\n}\n\n/** The colour an extended-colour operand list names, or `null` when it is invalid. */\nfunction extendedColor(parts: readonly string[], colon: boolean): AnsiColor | null {\n const mode = toNumber(parts[0])\n if (mode === 5) {\n const index = toNumber(parts[1])\n const color = index === undefined ? undefined : ansi256ToColor(index)\n return color ?? null\n }\n if (mode === 2) {\n // In the colon form a colour-space id may precede the channels, empty or not.\n const channels = colon && parts.length > 4 ? parts.slice(2) : parts.slice(1)\n const [r, g, b] = channels.slice(0, 3).map(toNumber)\n if (r === undefined || g === undefined || b === undefined) return null\n if (r > 255 || g > 255 || b > 255) return null\n return nearestAnsiColor(r, g, b)\n }\n return null\n}\n\nfunction assign(style: MutableStyle, code: number, color: AnsiColor): void {\n if (code === 38) style.fg = color\n else style.bg = color\n}\n\n/** Characters that are never rendered: C0 except tab, DEL, C1, and bidi controls. */\nfunction isDroppedControl(code: number): boolean {\n return (\n (code < 0x20 && code !== 0x09) ||\n code === 0x7f ||\n (code >= 0x80 && code <= 0x9f) ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069) ||\n code === 0x2028 ||\n code === 0x2029\n )\n}\n\ntype Run = { text: string; style: AnsiStyle }\n\n/**\n * The line being written. While the cursor only ever moves right it is a list of\n * styled runs, which is cheap; the first time something moves it left (`\\r`,\n * `\\b`) it becomes one cell per UTF-16 unit so later text can overwrite.\n */\nclass LineBuffer {\n private runs: Run[] = []\n private cells: string[] | undefined\n private cellStyles: AnsiStyle[] | undefined\n private cursor = 0\n private length = 0\n private dropped = 0\n /** A `\\r` seen but not yet applied: `\\r\\n` is by far the common case. */\n private pendingReturn = false\n\n constructor(private readonly max: number) {}\n\n isEmpty(): boolean {\n return this.length === 0 && this.dropped === 0\n }\n\n put(text: string, style: AnsiStyle): void {\n if (text === '') return\n this.applyReturn()\n if (this.cells === undefined) {\n const room = this.max - this.length\n if (room <= 0) {\n this.dropped += text.length\n return\n }\n const kept = text.length > room ? text.slice(0, room) : text\n this.dropped += text.length - kept.length\n const last = this.runs[this.runs.length - 1]\n if (last && last.style === style) last.text += kept\n else this.runs.push({ text: kept, style })\n this.length += kept.length\n this.cursor = this.length\n return\n }\n for (let i = 0; i < text.length; i += 1) this.putCell(text[i]!, style)\n }\n\n private putCell(char: string, style: AnsiStyle): void {\n const cells = this.cells!\n const styles = this.cellStyles!\n if (this.cursor >= this.max) {\n this.dropped += 1\n return\n }\n while (cells.length < this.cursor) {\n cells.push(' ')\n styles.push(PLAIN)\n }\n cells[this.cursor] = char\n styles[this.cursor] = style\n this.cursor += 1\n this.length = cells.length\n }\n\n carriageReturn(): void {\n this.pendingReturn = true\n }\n\n backspace(): void {\n this.applyReturn()\n if (this.cursor === 0) return\n this.toCells()\n this.cursor -= 1\n }\n\n /** `ESC[nK`: 0 from the cursor to the end, 1 start to cursor, 2 the whole line. */\n eraseInLine(mode: number): void {\n this.applyReturn()\n if (mode === 0 && this.cursor >= this.length) return\n this.toCells()\n const cells = this.cells!\n const styles = this.cellStyles!\n if (mode === 0) {\n cells.length = this.cursor\n styles.length = this.cursor\n } else if (mode === 1) {\n for (let i = 0; i <= this.cursor && i < cells.length; i += 1) {\n cells[i] = ' '\n styles[i] = PLAIN\n }\n } else if (mode === 2) {\n cells.length = 0\n styles.length = 0\n }\n this.length = cells.length\n }\n\n private applyReturn(): void {\n if (!this.pendingReturn) return\n this.pendingReturn = false\n if (this.length === 0) {\n this.cursor = 0\n return\n }\n this.toCells()\n this.cursor = 0\n }\n\n private toCells(): void {\n if (this.cells !== undefined) return\n const cells: string[] = []\n const styles: AnsiStyle[] = []\n for (const run of this.runs) {\n for (let i = 0; i < run.text.length; i += 1) {\n cells.push(run.text[i]!)\n styles.push(run.style)\n }\n }\n this.cells = cells\n this.cellStyles = styles\n this.runs = []\n this.cursor = Math.min(this.cursor, cells.length)\n }\n\n snapshot(): AnsiLine {\n const segments: AnsiSegment[] = []\n if (this.cells === undefined) {\n for (const run of this.runs) segments.push({ text: run.text, style: run.style })\n } else {\n const cells = this.cells\n const styles = this.cellStyles!\n let start = 0\n for (let i = 1; i <= cells.length; i += 1) {\n if (i === cells.length || styles[i] !== styles[start]) {\n segments.push({ text: cells.slice(start, i).join(''), style: styles[start]! })\n start = i\n }\n }\n }\n return { segments, truncated: this.dropped }\n }\n\n reset(): void {\n this.runs = []\n this.cells = undefined\n this.cellStyles = undefined\n this.cursor = 0\n this.length = 0\n this.dropped = 0\n this.pendingReturn = false\n }\n}\n\ntype State = 'text' | 'esc' | 'esc-intermediate' | 'csi' | 'string' | 'string-esc'\n\nexport function createAnsiParser(options: AnsiParserOptions = {}): AnsiParser {\n const maxLine = Math.max(1, Math.floor(options.maxLineLength ?? ANSI_MAX_LINE_LENGTH))\n const retain = Math.max(1, Math.floor(options.retainLines ?? ANSI_RETAIN_LINES))\n const lines: AnsiLine[] = []\n let droppedLines = 0\n const line = new LineBuffer(maxLine)\n let style: AnsiStyle = PLAIN\n let state: State = 'text'\n let csi = ''\n let csiOverflow = false\n // Only the 7-bit `ESC [` introducer is honoured. The 8-bit form is consumed so\n // its parameters are not echoed, but it never changes the style: it is a rarity\n // in real output and a favourite of filter-evasion payloads.\n let csiHonoured = true\n\n const finishLine = () => {\n lines.push(line.snapshot())\n line.reset()\n // Trim in blocks so the common append stays O(1) amortised.\n if (lines.length > retain + Math.max(64, retain >> 3)) {\n const excess = lines.length - retain\n lines.splice(0, excess)\n droppedLines += excess\n }\n }\n\n const runCsi = (final: string) => {\n if (csiOverflow || !csiHonoured) return\n // Only plain numeric parameters are honoured; a private marker (`?`, `>`,\n // `<`, `=`) or an intermediate byte makes this some other command entirely.\n if (!/^[\\d;:]*$/.test(csi)) return\n if (final === 'm') style = applySgr(style, csi)\n else if (final === 'K') {\n const mode = toNumber(csi.split(';')[0])\n if (mode !== undefined && mode <= 2) line.eraseInLine(mode)\n }\n }\n\n function write(chunk: string): void {\n for (let i = 0; i < chunk.length; i += 1) {\n const code = chunk.charCodeAt(i)\n\n switch (state) {\n case 'text': {\n if (!isDroppedControl(code)) {\n // Take the whole run of ordinary characters at once.\n let end = i + 1\n while (end < chunk.length && !isDroppedControl(chunk.charCodeAt(end))) end += 1\n line.put(chunk.slice(i, end), style)\n i = end - 1\n break\n }\n if (code === 0x1b) state = 'esc'\n else if (code === 0x0a) finishLine()\n else if (code === 0x0d) line.carriageReturn()\n else if (code === 0x08) line.backspace()\n else if (code === 0x9b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = false\n } else if (\n code === 0x9d ||\n code === 0x90 ||\n code === 0x98 ||\n code === 0x9e ||\n code === 0x9f\n ) {\n state = 'string'\n }\n // Every other control character is dropped.\n break\n }\n case 'esc': {\n if (code === 0x5b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = true\n } else if (\n code === 0x5d ||\n code === 0x50 ||\n code === 0x58 ||\n code === 0x5e ||\n code === 0x5f\n ) {\n state = 'string'\n } else if (code >= 0x20 && code <= 0x2f) state = 'esc-intermediate'\n else if (code >= 0x30 && code <= 0x7e) state = 'text'\n else if (code === 0x1b) state = 'esc'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'esc-intermediate': {\n if (code >= 0x20 && code <= 0x2f) break\n if (code >= 0x30 && code <= 0x7e) state = 'text'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'csi': {\n if (code >= 0x20 && code <= 0x3f) {\n if (csi.length < CSI_MAX) csi += chunk[i]\n else csiOverflow = true\n } else if (code >= 0x40 && code <= 0x7e) {\n runCsi(chunk[i]!)\n state = 'text'\n } else if (code === 0x1b) state = 'esc'\n else {\n // A control character or non-ASCII byte cannot be part of a CSI: the\n // sequence was malformed. Drop it and read this character normally.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string': {\n if (code === 0x07 || code === 0x9c) state = 'text'\n else if (code === 0x1b) state = 'string-esc'\n else if (code === 0x0a || code === 0x0d) {\n // No real title or clipboard payload spans a line. Ending here bounds\n // what an unterminated string can swallow to the rest of its line.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string-esc': {\n if (code === 0x5c) state = 'text'\n else {\n state = 'esc'\n i -= 1\n }\n break\n }\n }\n }\n }\n\n return {\n write,\n lines,\n openLine: () => (line.isEmpty() ? undefined : line.snapshot()),\n get droppedLines() {\n return droppedLines\n },\n }\n}\n\n/** Parse a whole output at once: finished lines plus the open one, if any. */\nexport function parseAnsi(text: string, options?: AnsiParserOptions): AnsiLine[] {\n const parser = createAnsiParser(options)\n parser.write(text)\n const open = parser.openLine()\n return open ? [...parser.lines, open] : [...parser.lines]\n}\n\n/**\n * The whole output as a reader sees it, for the clipboard: every line, none\n * shortened, with escape sequences and overwritten text resolved away.\n */\nexport function ansiPlainText(text: string): string {\n const parser = createAnsiParser({\n maxLineLength: Number.POSITIVE_INFINITY,\n retainLines: Number.POSITIVE_INFINITY,\n })\n parser.write(text)\n const open = parser.openLine()\n // Finished lines carry their newline even when only control sequences follow.\n return [...parser.lines.map(ansiLineText), open ? ansiLineText(open) : ''].join('\\n')\n}\n\n/** A line's text with styling removed, for tests and for accessible names. */\nexport function ansiLineText(line: AnsiLine): string {\n return line.segments.map((segment) => segment.text).join('')\n}\n"],"mappings":";AAiFA,IAAa,uBAAuB;AACpC,IAAa,oBAAoB;;AAGjC,IAAM,UAAU;AAEhB,IAAM,QAAmB,OAAO,OAAO,CAAC,CAAC;AACzC,IAAM,6BAAa,IAAI,IAAuB;AAC9C,IAAM,oBAAoB;;;;;;AAO1B,SAAS,OAAO,OASF;CACZ,MAAM,MAAM;EACV,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,MAAM,OAAO,MAAM;EACnB,MAAM,MAAM,MAAM;EAClB,MAAM,SAAS,MAAM;EACrB,MAAM,YAAY,MAAM;EACxB,MAAM,SAAS,MAAM;EACrB,MAAM,UAAU,MAAM;CACxB,CAAC,CAAC,KAAK,GAAG;CACV,IAAI,QAAQ,WAAW,OAAO;CAC9B,MAAM,SAAS,WAAW,IAAI,GAAG;CACjC,IAAI,QAAQ,OAAO;CACnB,MAAM,OAAkB,OAAO,OAAO;EACpC,GAAI,MAAM,OAAO,KAAA,KAAa,EAAE,IAAI,MAAM,GAAG;EAC7C,GAAI,MAAM,OAAO,KAAA,KAAa,EAAE,IAAI,MAAM,GAAG;EAC7C,GAAI,MAAM,QAAQ,EAAE,MAAM,KAAc;EACxC,GAAI,MAAM,OAAO,EAAE,KAAK,KAAc;EACtC,GAAI,MAAM,UAAU,EAAE,QAAQ,KAAc;EAC5C,GAAI,MAAM,aAAa,EAAE,WAAW,KAAc;EAClD,GAAI,MAAM,UAAU,EAAE,QAAQ,KAAc;EAC5C,GAAI,MAAM,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IAAI,IAAI,CAAC,GAAG,OAAO,KAAK;AAC1D;;;;;AAMA,SAAgB,cAAc,MAAsB;CAClD,MAAM,SAAS,iBAAiB;EAC9B,eAAe,OAAO;EACtB,aAAa,OAAO;CACtB,CAAC;CACD,OAAO,MAAM,IAAI;CACjB,MAAM,OAAO,OAAO,SAAS;CAE7B,OAAO,CAAC,GAAG,OAAO,MAAM,IAAI,YAAY,GAAG,OAAO,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,IAAI;AACtF;;AAGA,SAAgB,aAAa,MAAwB;CACnD,OAAO,KAAK,SAAS,KAAK,YAAY,QAAQ,IAAI,CAAC,CAAC,KAAK,EAAE;AAC7D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The terminal's pure decisions: what its status says, which lines are mounted,
|
|
3
3
|
* and whether the reader is at the end. They live apart from the component so
|
|
4
|
-
* the rules that are easy to get subtly wrong
|
|
5
|
-
* lines", a tolerance that yanks the reader back to the bottom
|
|
4
|
+
* the rules that are easy to get subtly wrong, an off-by-one in "N earlier
|
|
5
|
+
* lines", a tolerance that yanks the reader back to the bottom, have tests.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* What the host knows about the command. Absent means no statement: a terminal
|
|
@@ -18,7 +18,7 @@ export type TerminalStatus = {
|
|
|
18
18
|
};
|
|
19
19
|
/** The words for a status, which are also what a screen reader hears. */
|
|
20
20
|
export declare function terminalStatusLabel(status: TerminalStatus): string;
|
|
21
|
-
/** Whether a status is a non-zero exit
|
|
21
|
+
/** Whether a status is a non-zero exit, the one thing the header tones as a failure. */
|
|
22
22
|
export declare function isFailedExit(status: TerminalStatus | undefined): boolean;
|
|
23
23
|
export type TerminalWindow = Readonly<{
|
|
24
24
|
/** Index of the first mounted finished line. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-model.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/terminal/terminal-model.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,GACpB;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,CAAA;AAE1B,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAIlE;AAED,
|
|
1
|
+
{"version":3,"file":"terminal-model.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/terminal/terminal-model.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,GACpB;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,CAAA;AAE1B,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAIlE;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,OAAO,CAExE;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAA;IACX,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAA;IAClB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAA;IACd,0FAA0F;IAC1F,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAA;IACf,2FAA2F;IAC3F,IAAI,EAAE,OAAO,CAAA;CACd,CAAC,CAAA;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,GACjB,cAAc,CA8BhB;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAEjG"}
|
|
@@ -6,7 +6,7 @@ function terminalStatusLabel(status) {
|
|
|
6
6
|
if (status.state === "cancelled") return "Cancelled";
|
|
7
7
|
return Number.isInteger(status.code) ? `Exited with code ${status.code}` : "Exited";
|
|
8
8
|
}
|
|
9
|
-
/** Whether a status is a non-zero exit
|
|
9
|
+
/** Whether a status is a non-zero exit, the one thing the header tones as a failure. */
|
|
10
10
|
function isFailedExit(status) {
|
|
11
11
|
return status?.state === "exited" && Number.isInteger(status.code) && status.code !== 0;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-model.js","names":[],"sources":["../../../../src/components/composites/terminal/terminal-model.ts"],"sourcesContent":["import { isAtEnd } from '#lib/scroll-geometry'\n\n/**\n * The terminal's pure decisions: what its status says, which lines are mounted,\n * and whether the reader is at the end. They live apart from the component so\n * the rules that are easy to get subtly wrong
|
|
1
|
+
{"version":3,"file":"terminal-model.js","names":[],"sources":["../../../../src/components/composites/terminal/terminal-model.ts"],"sourcesContent":["import { isAtEnd } from '#lib/scroll-geometry'\n\n/**\n * The terminal's pure decisions: what its status says, which lines are mounted,\n * and whether the reader is at the end. They live apart from the component so\n * the rules that are easy to get subtly wrong, an off-by-one in \"N earlier\n * lines\", a tolerance that yanks the reader back to the bottom, have tests.\n */\n\n/**\n * What the host knows about the command. Absent means no statement: a terminal\n * handed output with no status does not say whether the command is still running.\n */\nexport type TerminalStatus =\n | { state: 'running' }\n | { state: 'exited'; code: number }\n | { state: 'cancelled' }\n\n/** The words for a status, which are also what a screen reader hears. */\nexport function terminalStatusLabel(status: TerminalStatus): string {\n if (status.state === 'running') return 'Running'\n if (status.state === 'cancelled') return 'Cancelled'\n return Number.isInteger(status.code) ? `Exited with code ${status.code}` : 'Exited'\n}\n\n/** Whether a status is a non-zero exit, the one thing the header tones as a failure. */\nexport function isFailedExit(status: TerminalStatus | undefined): boolean {\n return status?.state === 'exited' && Number.isInteger(status.code) && status.code !== 0\n}\n\nexport type TerminalWindow = Readonly<{\n /** Index of the first mounted finished line. */\n start: number\n /** Index after the last mounted finished line. */\n end: number\n /** Retained lines before `start` that \"show earlier\" can reveal. */\n revealable: number\n /** Every earlier line not on screen, including those the parser discarded. */\n hidden: number\n /** Retained finished lines after `end`: output that arrived while the view was parked. */\n later: number\n /** Lines of the parked view that retention discarded before the reader moved on. */\n evicted: number\n /** The whole parked view was discarded, so the oldest retained lines are shown instead. */\n lost: boolean\n}>\n\n/**\n * The slice of the retained lines that is mounted. `limit` is how many finished\n * lines to show; the rest are counted, not rendered, because a terminal that\n * mounts every line of a long build is a frozen page.\n *\n * While the reader follows the tail the slice ends at the newest line. Once they\n * have scrolled away it is *parked*: `anchorEnd` is the number of lines (counting\n * the ones retention already discarded) that existed when they left, and the\n * slice stays ending there while output keeps arriving, so what they are reading\n * does not move under them. If retention discards the lines they were reading,\n * `evicted` says how many, and when all of them are gone `lost` is set and the\n * oldest retained lines are shown, because the nearest thing that still exists\n * is better than a blank box.\n */\nexport function terminalWindow(\n retained: number,\n dropped: number,\n limit: number,\n anchorEnd?: number\n): TerminalWindow {\n const size = Math.max(1, Math.floor(limit))\n if (anchorEnd === undefined || anchorEnd >= dropped + retained) {\n const start = Math.max(0, retained - size)\n return {\n start,\n end: retained,\n revealable: start,\n hidden: start + dropped,\n later: 0,\n evicted: 0,\n lost: false,\n }\n }\n const wantedStart = Math.max(0, anchorEnd - size)\n const lost = anchorEnd <= dropped\n const end = lost ? Math.min(retained, size) : anchorEnd - dropped\n const start = lost ? 0 : Math.max(0, end - size)\n const evicted = lost\n ? anchorEnd - wantedStart\n : Math.max(0, Math.min(dropped, anchorEnd) - wantedStart)\n return {\n start,\n end,\n revealable: start,\n hidden: start + dropped,\n later: retained - end,\n evicted,\n lost,\n }\n}\n\n/** The limit after one \"show earlier\" press: one more page, never past what exists. */\nexport function revealEarlier(limit: number, page: number, retained: number): number {\n return Math.min(Math.max(retained, 1), limit + Math.max(1, Math.floor(page)))\n}\n\n/**\n * Whether a scroller is showing its end. This decides whether new output\n * follows the reader: at the bottom it does, anywhere else the view is theirs.\n * It is the transcript's own rule, so every following view agrees on \"the end\".\n */\nexport function isAtBottom(scrollHeight: number, scrollTop: number, clientHeight: number): boolean {\n return isAtEnd({ scrollHeight, scrollTop, clientHeight })\n}\n"],"mappings":";;;AAmBA,SAAgB,oBAAoB,QAAgC;CAClE,IAAI,OAAO,UAAU,WAAW,OAAO;CACvC,IAAI,OAAO,UAAU,aAAa,OAAO;CACzC,OAAO,OAAO,UAAU,OAAO,IAAI,IAAI,oBAAoB,OAAO,SAAS;AAC7E;;AAGA,SAAgB,aAAa,QAA6C;CACxE,OAAO,QAAQ,UAAU,YAAY,OAAO,UAAU,OAAO,IAAI,KAAK,OAAO,SAAS;AACxF;;;;;;;;;;;;;;;AAiCA,SAAgB,eACd,UACA,SACA,OACA,WACgB;CAChB,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC;CAC1C,IAAI,cAAc,KAAA,KAAa,aAAa,UAAU,UAAU;EAC9D,MAAM,QAAQ,KAAK,IAAI,GAAG,WAAW,IAAI;EACzC,OAAO;GACL;GACA,KAAK;GACL,YAAY;GACZ,QAAQ,QAAQ;GAChB,OAAO;GACP,SAAS;GACT,MAAM;EACR;CACF;CACA,MAAM,cAAc,KAAK,IAAI,GAAG,YAAY,IAAI;CAChD,MAAM,OAAO,aAAa;CAC1B,MAAM,MAAM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MAAM,CAAA;IAC3B,sGAAsG;IACtG,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,wEAAwE;IACxE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAA;CAC/B,CAAA;AAED,yCAAyC;AACzC,eAAO,MAAM,kBAAkB,OAAO,CAAA;AAwItC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/terminal/terminal.tsx"],"names":[],"mappings":"AASA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,UAAU,CAAA;AAYjB,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAA;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACpE,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,yFAAyF;IACzF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,sGAAsG;IACtG,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,wEAAwE;IACxE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAA;CAC/B,CAAA;AAED,yCAAyC;AACzC,eAAO,MAAM,kBAAkB,OAAO,CAAA;AAwItC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kCA8T5C"}
|
|
@@ -195,15 +195,28 @@ function Terminal$1(props) {
|
|
|
195
195
|
createEffect(on(() => local.output === "", (empty) => {
|
|
196
196
|
if (empty) setLimit(pageSize());
|
|
197
197
|
}, { defer: true }));
|
|
198
|
-
const outputRows =
|
|
198
|
+
const outputRows = {
|
|
199
|
+
get length() {
|
|
200
|
+
return outputRowCount();
|
|
201
|
+
},
|
|
202
|
+
at(index) {
|
|
203
|
+
revision();
|
|
204
|
+
return index === parser.lines.length ? parser.openLine() : parser.lines[index];
|
|
205
|
+
},
|
|
206
|
+
slice(start, end) {
|
|
207
|
+
revision();
|
|
208
|
+
const rows = parser.lines.slice(start, Math.min(end, parser.lines.length));
|
|
209
|
+
const open = parser.openLine();
|
|
210
|
+
if (open && end > parser.lines.length && start <= parser.lines.length) rows.push(open);
|
|
211
|
+
return rows;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const outputRowCount = createMemo(() => {
|
|
199
215
|
revision();
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (open) rows.push(open);
|
|
203
|
-
return rows;
|
|
204
|
-
}, [], { equals: false });
|
|
216
|
+
return parser.lines.length + (parser.openLine() ? 1 : 0);
|
|
217
|
+
});
|
|
205
218
|
const [parked, setParked] = createSignal();
|
|
206
|
-
const total = () => parser.droppedLines + outputRows
|
|
219
|
+
const total = () => parser.droppedLines + outputRows.length;
|
|
207
220
|
const anchorEnd = () => {
|
|
208
221
|
const current = revision();
|
|
209
222
|
const position = parked();
|
|
@@ -211,13 +224,13 @@ function Terminal$1(props) {
|
|
|
211
224
|
};
|
|
212
225
|
const lineWindow = createMemo(() => {
|
|
213
226
|
revision();
|
|
214
|
-
return terminalWindow(outputRows
|
|
227
|
+
return terminalWindow(outputRows.length, parser.droppedLines, limit(), anchorEnd());
|
|
215
228
|
});
|
|
216
229
|
const visibleRows = createMemo(() => {
|
|
217
230
|
revision();
|
|
218
231
|
const start = lineWindow().start;
|
|
219
232
|
const end = lineWindow().end;
|
|
220
|
-
const rows = outputRows
|
|
233
|
+
const rows = outputRows.slice(start, end);
|
|
221
234
|
const position = parked();
|
|
222
235
|
if (position?.epoch === revision() && position.open) {
|
|
223
236
|
const retainedIndex = position.end - 1 - parser.droppedLines;
|
|
@@ -229,7 +242,7 @@ function Terminal$1(props) {
|
|
|
229
242
|
const position = parked();
|
|
230
243
|
if (position?.epoch !== revision() || !position.open) return false;
|
|
231
244
|
const retainedIndex = position.end - 1 - parser.droppedLines;
|
|
232
|
-
const current = outputRows()
|
|
245
|
+
const current = outputRows.at(retainedIndex);
|
|
233
246
|
return current !== void 0 && !sameAnsiLine(position.open, current);
|
|
234
247
|
};
|
|
235
248
|
const newerRows = () => lineWindow().later + (changedParkedLine() ? 1 : 0);
|
|
@@ -400,7 +413,7 @@ function Terminal$1(props) {
|
|
|
400
413
|
return createComponent(Button, {
|
|
401
414
|
variant: "ghost",
|
|
402
415
|
size: "2xs",
|
|
403
|
-
onClick: () => setLimit(revealEarlier(limit(), pageSize(), outputRows
|
|
416
|
+
onClick: () => setLimit(revealEarlier(limit(), pageSize(), outputRows.length)),
|
|
404
417
|
get children() {
|
|
405
418
|
return [
|
|
406
419
|
"Show ",
|