@adea-ai/ui 0.162.6 → 0.162.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/about-dialog/about-dialog.js +5 -5
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +3 -3
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js +2 -2
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +22 -22
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +10 -10
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +13 -13
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +12 -12
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +13 -13
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +9 -9
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +10 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -5
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.js +7 -7
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +5 -5
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +13 -13
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.js +7 -7
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +9 -9
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.js +5 -5
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +10 -10
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/icon-picker/image-data-url.js.map +1 -1
- package/dist/components/composites/icon-picker/shell-icons.js +117 -117
- package/dist/components/composites/icon-picker/shell-icons.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +7 -7
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.js +2 -2
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +7 -7
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +12 -12
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.js +5 -5
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/prompt-input/prompt-input.js +3 -3
- package/dist/components/composites/prompt-input/prompt-input.js.map +1 -1
- package/dist/components/composites/queue/queue.js +13 -13
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +5 -5
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js +16 -16
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +2 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +2 -2
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.js +5 -5
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.js +5 -5
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.js +2 -2
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +10 -10
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.js +6 -6
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.js +5 -5
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js +2 -2
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.js +5 -5
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.js +1 -1
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js +18 -18
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.js +17 -17
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.js +5 -5
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.js +6 -6
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +1 -1
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +23 -23
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +2 -2
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +6 -6
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +11 -11
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/atomic/chat-composer.js +1 -1
- package/dist/components/conversation/busy-send-button.js +10 -10
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.js +1 -1
- package/dist/components/conversation/composer-core.js +1 -1
- package/dist/components/conversation/composer-menu.js +2 -2
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +7 -7
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.js +1 -1
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +5 -5
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +9 -9
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.js +9 -9
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.js +13 -13
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +1 -1
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/scroll-follow.js +1 -1
- package/dist/components/conversation/thread-panel.js +5 -5
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.js +5 -5
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +2 -2
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js +7 -7
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/page/page.js +2 -2
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +1 -1
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-pane/pixel-pane.js +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +5 -5
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js +5 -5
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -2
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +2 -2
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -5
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/pane-focus.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +7 -7
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +5 -5
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
- package/dist/components/motion/presence.js +1 -1
- package/dist/components/theme/appearance-panel.js +3 -3
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.js +3 -3
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/script-projection.js +1 -1
- package/dist/components/theme/theme-catalogue-source.js +1 -1
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js +7 -7
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-picker.js +2 -2
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.js +1 -1
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-provider.js +1 -1
- package/dist/components/theme/theme-toggle.js +7 -7
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js +13 -13
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.js +12 -12
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +14 -14
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +2 -2
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js +16 -16
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +1 -1
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.js +2 -2
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +7 -7
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble/bubble.js +2 -2
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button-group/button-group.js +2 -2
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +8 -8
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.js +2 -2
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.js +8 -8
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart.js +2 -2
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +6 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.js +6 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +7 -7
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js +21 -21
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/value-combobox.js +1 -1
- package/dist/components/ui/command/command.js +23 -23
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -2
- package/dist/components/ui/detail-panel/detail-panel.js +5 -5
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +2 -2
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +21 -21
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.js +2 -2
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js +14 -14
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +10 -10
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.js +5 -5
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +2 -2
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.js +14 -14
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js +2 -2
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js +10 -10
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input/input-control.js +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.js +2 -2
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js +2 -2
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.js +2 -2
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.js +2 -2
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js +7 -7
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.js +3 -3
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +2 -2
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js +5 -5
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +18 -18
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +28 -28
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.js +15 -15
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.js +5 -5
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +10 -10
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +9 -9
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js +11 -11
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js +21 -21
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/separator/separator.js +5 -5
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js +6 -6
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.js +5 -5
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js +5 -5
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +2 -2
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.js +4 -4
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/table/table.js +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +7 -7
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +2 -2
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js +7 -7
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.js +6 -6
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js +7 -8
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.js +6 -6
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -1
- package/dist/components/ui/tooltip/lazy-tooltip.js +2 -2
- package/dist/components/ui/tooltip/tooltip.js +10 -10
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.js +19 -19
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.js +2 -2
- package/dist/lib/accent-presets.js +1 -1
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/async-action.js +1 -1
- package/dist/lib/create-poll.js +1 -1
- package/dist/lib/create-poll.js.map +1 -1
- package/dist/lib/external-link.js +1 -1
- package/dist/lib/external-link.js.map +1 -1
- package/dist/lib/fast-icon.js +1 -1
- package/dist/lib/theme-css.js +1 -1
- package/dist/lib/theme-engine-light.js +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-records.js +1 -1
- package/dist/lib/themes.js +1 -1
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/vite/source-parser.js +1 -1
- package/dist/vite/tailwind-sources.js +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":["<Show when={hasContextFigures(figures)}>\n <Popover placement={local.placement ?? 'top'} gutter={6}>\n <PopoverTrigger\n as={ContextTriggerButton}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>\n <PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>\n </Popover>\n </Show>","<Popover placement={local.placement ?? 'top'} gutter={6}>\n <PopoverTrigger\n as={ContextTriggerButton}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>\n <PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>\n </Popover>","gutter={6}","<PopoverTrigger\n as={ContextTriggerButton}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>","as={ContextTriggerButton}","variant=\"ghost\"","size=\"xs\"","<Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>","<Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>","<Ring percent={percent() ?? 0} />","<TriangleAlert />","<OctagonAlert />","<span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>","<PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>","class=\"w-72 max-w-full\"","<PopoverTitle>Context window</PopoverTitle>","<Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />","minValue={0}","maxValue={100}","label=\"Context used\"","getValueLabel={() => `${percent()}% used`}","<div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>","<TriangleAlert class=\"size-4\" />","class=\"size-4\"","<OctagonAlert class=\"size-4\" />","<p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>","<Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />","label=\"Used\"","<dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>","<Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />","label=\"Window\"","<Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />","label=\"Remaining\"","<For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>","<Row label={row.label} value={formatExact(row.value, locale())} />","<Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>","<Row label=\"Cost\" value={formatCost(value(), locale())} />","label=\"Cost\"","<circle cx=\"8\" cy=\"8\" r={RING_RADIUS} stroke-width=\"2\" class=\"stroke-border\" />","<svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"size-4\">\n <circle cx=\"8\" cy=\"8\" r={RING_RADIUS} stroke-width=\"2\" class=\"stroke-border\" />\n <circle\n cx=\"8\"\n cy=\"8\"\n r={RING_RADIUS}\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-dasharray={`${filled()} ${RING_CIRCUMFERENCE}`}\n transform=\"rotate(-90 8 8)\"\n class=\"stroke-primary\"\n />\n </svg>","<div class=\"flex items-baseline justify-between gap-4\">\n <dt class=\"text-muted-foreground\">{props.label}</dt>\n <dd class=\"m-0 text-end tabular-nums\">{props.value}</dd>\n </div>","OctagonAlert","LucideOctagonAlert","TriangleAlert","LucideTriangleAlert","_$readShallow"],"sources":["../../../../src/components/composites/context/context.tsx"],"sourcesContent":["import {\n OctagonAlert as LucideOctagonAlert,\n TriangleAlert as LucideTriangleAlert,\n} from '@lucide/solid'\nimport { For, Show, omit } from 'solid-js'\nimport { type ComponentProps } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { slotted } from '#lib/slotted'\nimport { Button } from '../../ui/button'\nimport { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '../../ui/popover'\nimport { Progress } from '../../ui/progress'\nimport {\n breakdownRows,\n contextLabel,\n contextLevel,\n contextLevelWord,\n contextPercent,\n contextShort,\n formatCost,\n formatExact,\n hasContextFigures,\n isFigure,\n type ContextFigures,\n type ContextLevel,\n} from './context-model'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst OctagonAlert = fastIcon(LucideOctagonAlert)\nconst TriangleAlert = fastIcon(LucideTriangleAlert)\n\n/**\n * Context.\n *\n * How much of the model's context window is in use, as a compact trigger that\n * opens the figures behind it. It sits next to the composer, where the reader\n * decides whether to keep going or start fresh, so the trigger is small and the\n * detail is a press away rather than permanent chrome.\n *\n * ## Every figure is a claim, so every figure is optional\n *\n * A host passes whatever it knows: `used`, `total`, a `breakdown` (input, output,\n * cache read and write, reasoning), a `cost`. A missing value is omitted, never\n * drawn as 0, which would say \"empty\" about a window nobody measured, and when\n * *nothing* is known the trigger is not rendered at all (`hasContextFigures`).\n * Nothing is estimated here; the one derived row, \"Remaining\", appears only when\n * both `used` and `total` are known and `used` does not exceed `total`.\n *\n * ## Never colour alone\n *\n * The ring shows the fraction; past 75% the ring gives way to a warning glyph\n * (triangle, then octagon at 90% and above), the popover says \"Getting full\",\n * \"Nearly full\" or \"Full\" in words, and the trigger's accessible name speaks the\n * same. An overrun is reported as it is (\"112%\"); only the ring saturates.\n *\n * It is a `Popover`, not a hover card: the figures must be reachable by keyboard\n * and by touch, and Escape closes it and returns focus to the trigger.\n */\nexport type ContextProps = ContextFigures & {\n /** BCP 47 tag for number formatting. Defaults to `en-US`, so output is stable. */\n locale?: string\n placement?: ComponentProps<typeof Popover>['placement']\n class?: string\n}\n\n// A circle of radius 6 in a 16-unit box; the dash array is the fraction of this.\n// ui-sdk parts write their own data-slot; the rendered element restores ours.\nconst ContextTriggerButton = slotted(Button, 'context')\n\nconst RING_RADIUS = 6\nconst RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS\n\nexport function Context(props: ContextProps) {\n const local = props\n const figures = omit(props, 'locale', 'placement', 'class')\n const locale = () => local.locale ?? 'en-US'\n const percent = () => contextPercent(figures.used, figures.total)\n const level = (): ContextLevel => contextLevel(percent())\n const levelWord = () => contextLevelWord(level())\n const rows = () => breakdownRows(figures.breakdown)\n const remaining = () =>\n isFigure(figures.used) && isFigure(figures.total) && figures.used <= figures.total\n ? figures.total - figures.used\n : undefined\n const cost = () => (figures.cost && isFigure(figures.cost.amount) ? figures.cost : undefined)\n\n return (\n <Show when={hasContextFigures(figures)}>\n <Popover placement={local.placement ?? 'top'} gutter={6}>\n <PopoverTrigger\n as={ContextTriggerButton}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>\n <PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>\n </Popover>\n </Show>\n )\n}\n\nfunction Ring(props: { percent: number }) {\n const filled = () => (RING_CIRCUMFERENCE * Math.min(Math.max(props.percent, 0), 100)) / 100\n return (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"size-4\">\n <circle cx=\"8\" cy=\"8\" r={RING_RADIUS} stroke-width=\"2\" class=\"stroke-border\" />\n <circle\n cx=\"8\"\n cy=\"8\"\n r={RING_RADIUS}\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-dasharray={`${filled()} ${RING_CIRCUMFERENCE}`}\n transform=\"rotate(-90 8 8)\"\n class=\"stroke-primary\"\n />\n </svg>\n )\n}\n\nfunction Row(props: { label: string; value: string }) {\n return (\n <div class=\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YK;CAVH,IAAA,SADAU,OAAAA,WACA;CAME,aAAkB,GAAG,OAAO,EAAE,GAAG,uBAAjC,QAAA;EAAqD,aAAA,QAAA,oBAAA,GAAA;;CAT3D,OACEC;AAcJ;AAEA,SAAS,IAAI,OAAyC;CAElD,IAAA,SAAA,QAGK;CAFH,IAAA,SAAA,OAAA;CACA,IAAA,SAAA,OAAA;CADA,OAAA,cAAkC;EAAC,OAAA,MAAM;CAAK,CAAK;CACnD,OAAA,cAAsC;EAAC,OAAA,MAAM;CAAK,CAAK;CAH3D,OACEC;AAKJ"}
|
|
1
|
+
{"version":3,"file":"context.js","names":["<Show when={hasContextFigures(figures)}>\n <Popover placement={local.placement ?? 'top'} gutter={6}>\n <PopoverTrigger\n as={ContextTriggerButton}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>\n <PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>\n </Popover>\n </Show>","<Popover placement={local.placement ?? 'top'} gutter={6}>\n <PopoverTrigger\n as={ContextTriggerButton}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>\n <PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>\n </Popover>","gutter={6}","<PopoverTrigger\n as={ContextTriggerButton}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>","as={ContextTriggerButton}","variant=\"ghost\"","size=\"xs\"","<Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>","<Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>","<Ring percent={percent() ?? 0} />","<TriangleAlert />","<OctagonAlert />","<span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>","<PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>","class=\"w-72 max-w-full\"","<PopoverTitle>Context window</PopoverTitle>","<Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />","minValue={0}","maxValue={100}","label=\"Context used\"","getValueLabel={() => `${percent()}% used`}","<div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>","<TriangleAlert class=\"size-4\" />","class=\"size-4\"","<OctagonAlert class=\"size-4\" />","<p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>","<Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />","label=\"Used\"","<dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>","<Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />","label=\"Window\"","<Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />","label=\"Remaining\"","<For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>","<Row label={row.label} value={formatExact(row.value, locale())} />","<Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>","<Row label=\"Cost\" value={formatCost(value(), locale())} />","label=\"Cost\"","<circle cx=\"8\" cy=\"8\" r={RING_RADIUS} stroke-width=\"2\" class=\"stroke-border\" />","<svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"size-4\">\n <circle cx=\"8\" cy=\"8\" r={RING_RADIUS} stroke-width=\"2\" class=\"stroke-border\" />\n <circle\n cx=\"8\"\n cy=\"8\"\n r={RING_RADIUS}\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-dasharray={`${filled()} ${RING_CIRCUMFERENCE}`}\n transform=\"rotate(-90 8 8)\"\n class=\"stroke-primary\"\n />\n </svg>","<div class=\"flex items-baseline justify-between gap-4\">\n <dt class=\"text-muted-foreground\">{props.label}</dt>\n <dd class=\"m-0 text-end tabular-nums\">{props.value}</dd>\n </div>","LucideOctagonAlert","LucideTriangleAlert","_$insert","_$effect","_$readShallow","_$className","_$setAttribute"],"sources":["../../../../src/components/composites/context/context.tsx"],"sourcesContent":["import {\n OctagonAlert as LucideOctagonAlert,\n TriangleAlert as LucideTriangleAlert,\n} from '@lucide/solid'\nimport { For, Show, omit } from 'solid-js'\nimport { type ComponentProps } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { slotted } from '#lib/slotted'\nimport { Button } from '../../ui/button'\nimport { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '../../ui/popover'\nimport { Progress } from '../../ui/progress'\nimport {\n breakdownRows,\n contextLabel,\n contextLevel,\n contextLevelWord,\n contextPercent,\n contextShort,\n formatCost,\n formatExact,\n hasContextFigures,\n isFigure,\n type ContextFigures,\n type ContextLevel,\n} from './context-model'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst OctagonAlert = fastIcon(LucideOctagonAlert)\nconst TriangleAlert = fastIcon(LucideTriangleAlert)\n\n/**\n * Context.\n *\n * How much of the model's context window is in use, as a compact trigger that\n * opens the figures behind it. It sits next to the composer, where the reader\n * decides whether to keep going or start fresh, so the trigger is small and the\n * detail is a press away rather than permanent chrome.\n *\n * ## Every figure is a claim, so every figure is optional\n *\n * A host passes whatever it knows: `used`, `total`, a `breakdown` (input, output,\n * cache read and write, reasoning), a `cost`. A missing value is omitted, never\n * drawn as 0, which would say \"empty\" about a window nobody measured, and when\n * *nothing* is known the trigger is not rendered at all (`hasContextFigures`).\n * Nothing is estimated here; the one derived row, \"Remaining\", appears only when\n * both `used` and `total` are known and `used` does not exceed `total`.\n *\n * ## Never colour alone\n *\n * The ring shows the fraction; past 75% the ring gives way to a warning glyph\n * (triangle, then octagon at 90% and above), the popover says \"Getting full\",\n * \"Nearly full\" or \"Full\" in words, and the trigger's accessible name speaks the\n * same. An overrun is reported as it is (\"112%\"); only the ring saturates.\n *\n * It is a `Popover`, not a hover card: the figures must be reachable by keyboard\n * and by touch, and Escape closes it and returns focus to the trigger.\n */\nexport type ContextProps = ContextFigures & {\n /** BCP 47 tag for number formatting. Defaults to `en-US`, so output is stable. */\n locale?: string\n placement?: ComponentProps<typeof Popover>['placement']\n class?: string\n}\n\n// A circle of radius 6 in a 16-unit box; the dash array is the fraction of this.\n// ui-sdk parts write their own data-slot; the rendered element restores ours.\nconst ContextTriggerButton = slotted(Button, 'context')\n\nconst RING_RADIUS = 6\nconst RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS\n\nexport function Context(props: ContextProps) {\n const local = props\n const figures = omit(props, 'locale', 'placement', 'class')\n const locale = () => local.locale ?? 'en-US'\n const percent = () => contextPercent(figures.used, figures.total)\n const level = (): ContextLevel => contextLevel(percent())\n const levelWord = () => contextLevelWord(level())\n const rows = () => breakdownRows(figures.breakdown)\n const remaining = () =>\n isFigure(figures.used) && isFigure(figures.total) && figures.used <= figures.total\n ? figures.total - figures.used\n : undefined\n const cost = () => (figures.cost && isFigure(figures.cost.amount) ? figures.cost : undefined)\n\n return (\n <Show when={hasContextFigures(figures)}>\n <Popover placement={local.placement ?? 'top'} gutter={6}>\n <PopoverTrigger\n as={ContextTriggerButton}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>\n <PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>\n </Popover>\n </Show>\n )\n}\n\nfunction Ring(props: { percent: number }) {\n const filled = () => (RING_CIRCUMFERENCE * Math.min(Math.max(props.percent, 0), 100)) / 100\n return (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"size-4\">\n <circle cx=\"8\" cy=\"8\" r={RING_RADIUS} stroke-width=\"2\" class=\"stroke-border\" />\n <circle\n cx=\"8\"\n cy=\"8\"\n r={RING_RADIUS}\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-dasharray={`${filled()} ${RING_CIRCUMFERENCE}`}\n transform=\"rotate(-90 8 8)\"\n class=\"stroke-primary\"\n />\n </svg>\n )\n}\n\nfunction Row(props: { label: string; value: string }) {\n return (\n <div class=\"flex items-baseline justify-between gap-4\">\n <dt class=\"text-muted-foreground\">{props.label}</dt>\n <dd class=\"m-0 text-end tabular-nums\">{props.value}</dd>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAM,eAAe,SAASyC,cAAkB;AAChD,IAAM,gBAAgB,SAASC,eAAmB;AAsClD,IAAM,uBAAuB,QAAQ,QAAQ,SAAS;AAGtD,IAAM,qBAAqB,IAAI,KAAK,KAAK;AAEzC,SAAgB,QAAQ,OAAqB;CAC3C,MAAM,QAAQ;CACd,MAAM,UAAU,KAAK,OAAO,UAAU,aAAa,OAAO;CAC1D,MAAM,eAAe,MAAM,UAAU;CACrC,MAAM,gBAAgB,eAAe,QAAQ,MAAM,QAAQ,KAAK;CAChE,MAAM,cAA4B,aAAa,QAAQ,CAAC;CACxD,MAAM,kBAAkB,iBAAiB,MAAM,CAAC;CAChD,MAAM,aAAa,cAAc,QAAQ,SAAS;CAClD,MAAM,kBACJ,SAAS,QAAQ,IAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,QAAQ,QAAQ,QAAQ,QACzE,QAAQ,QAAQ,QAAQ,OACxB,KAAA;CACN,MAAM,aAAc,QAAQ,QAAQ,SAAS,QAAQ,KAAK,MAAM,IAAI,QAAQ,OAAO,KAAA;CAEnF,OACE1C,WAAAA;;GAAY,OAAA,CAAA,CAAA,kBAAkB,OAAO;EAmF/B,CAAA,CAAC,CAAD,IAlFJC,gBAAAA,SAAAA;GAAS,IAAA,YAAA;IAAW,OAAA,MAAM,aAAa;GAAK;GAAEC,QAAQ;GAAtD,IAAA,WAAA;IAAyD,O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AA;MA2CK,EAAA,CAAA,CA5CN;KA6Ce;IA/EjB,CAAA,CAAA;GAgFQ;EAlFX,CAAA,IAAA,KAAA;CAmFM,CAAA;AAEV;AAEA,SAAS,KAAK,OAA4B;CACxC,MAAM,eAAgB,qBAAqB,KAAK,IAAI,KAAK,IAAI,MAAM,SAAS,CAAC,GAAG,GAAG,IAAK;CAEtF,IAAA,SAAA,QAYK;CAVH,IAAA,SADAU,OAAAA,WACA;CAMEM,aAAkB,GAAG,OAAO,EAAE,GAAG,uBAAjC,QAAA;EAAqDG,aAAA,QAAA,oBAAA,GAAA;;CAT3D,OACER;AAcJ;AAEA,SAAS,IAAI,OAAyC;CAElD,IAAA,SAAA,QAGK;CAFH,IAAA,SAAA,OAAA;CACA,IAAA,SAAA,OAAA;CADAI,OAAA,cAAkC;EAAC,OAAA,MAAM;CAAK,CAAK;CACnDA,OAAA,cAAsC;EAAC,OAAA,MAAM;CAAK,CAAK;CAH3D,OACEH;AAKJ"}
|
|
@@ -223,7 +223,7 @@ function initialExpanded(roots, spec, fileCount) {
|
|
|
223
223
|
for (const id of spec) open.add(id);
|
|
224
224
|
return open;
|
|
225
225
|
}
|
|
226
|
-
const depth = spec === true ?
|
|
226
|
+
const depth = spec === true ? 1e400 : spec === false ? 0 : typeof spec === "number" ? Math.max(0, Math.floor(spec)) : fileCount <= 100 ? 1e400 : 1;
|
|
227
227
|
const stack = roots.map((node) => [node, 1]);
|
|
228
228
|
while (stack.length > 0) {
|
|
229
229
|
const [node, level] = stack.pop();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-file-tree.js","names":[],"sources":["../../../../src/components/composites/file-tree/build-file-tree.ts"],"sourcesContent":["/**\n * The model behind the changed-files tree: paths in, a folder tree out, and the\n * small pure rules the view needs (what is visible, what to say about the\n * changes, what a typed letter jumps to).\n *\n * Paths come from an agent, which means from a model, which means they are\n * untrusted text. They are used here as labels and as ids, never as places to\n * read or write, and the builder is strict about what counts as a path at all:\n * a `..` segment, a control character or a bidirectional override rejects the\n * path rather than being cleaned up, because a cleaned-up path is a different\n * path and the tree would be making a claim the input did not. Rejected paths\n * are returned, not dropped silently, so the view can say how many it ignored.\n *\n * Everything is iterative. A path with ten thousand segments, or a tree five\n * thousand files wide, must not be able to overflow the stack or stall the page.\n */\n\n/** Every change kind, in the order a summary names them. */\nconst FILE_CHANGE_KINDS = ['added', 'modified', 'deleted', 'renamed'] as const\n\nexport type FileChangeKind = (typeof FILE_CHANGE_KINDS)[number]\n\nexport type FileChangeInput = Readonly<{\n path: string\n /** Absent means the host did not say; the tree makes no statement about the file. */\n change?: FileChangeKind\n /** For a rename, where the file was. Shown as text only. */\n renamedFrom?: string\n additions?: number\n deletions?: number\n}>\n\nexport type FileTreeNode = Readonly<{\n /** The normalised path, `/`-separated. Unique within a tree. */\n id: string\n /** The label. For a compacted folder chain this is `a/b/c`. */\n name: string\n kind: 'file' | 'directory'\n change?: FileChangeKind\n renamedFrom?: string\n additions?: number\n deletions?: number\n children: readonly FileTreeNode[]\n /** Files at or below this node. A file counts itself. */\n fileCount: number\n}>\n\nexport type FileTreeBuild = Readonly<{\n roots: readonly FileTreeNode[]\n /** Inputs that were not accepted as paths, exactly as given. */\n rejected: readonly string[]\n /** Inputs that named a path already present. The first one wins. */\n duplicates: number\n fileCount: number\n}>\n\nexport type BuildFileTreeOptions = {\n /** Merge a folder with a single folder child into one row (`src/lib`). Default true. */\n compact?: boolean\n}\n\n/** Deeper paths are rejected: no real repository nests this far, and a row's indent would be unusable. */\nexport const FILE_TREE_MAX_DEPTH = 256\nconst MAX_SEGMENT_LENGTH = 1024\n\nfunction hasForbiddenCharacter(value: string): boolean {\n for (let i = 0; i < value.length; i += 1) {\n const code = value.charCodeAt(i)\n if (\n code < 0x20 ||\n (code >= 0x7f && code <= 0x9f) ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069) ||\n code === 0x2028 ||\n code === 0x2029\n ) {\n return true\n }\n }\n return false\n}\n\n/**\n * A path as its segments, or `null` when it is not acceptable. Both separators\n * are accepted, empty and `.` segments are dropped (`a//b`, `./a`, trailing `/`),\n * and a leading separator is dropped, so an absolute path becomes relative to\n * the tree's root rather than escaping it.\n */\nexport function normalizePath(path: unknown): string[] | null {\n if (typeof path !== 'string' || hasForbiddenCharacter(path)) return null\n const segments: string[] = []\n let start = 0\n for (let i = 0; i <= path.length; i += 1) {\n if (i !== path.length && path[i] !== '/' && path[i] !== '\\\\') continue\n const segment = path.slice(start, i)\n start = i + 1\n if (segment === '' || segment === '.') continue\n if (segment === '..' || segment.length > MAX_SEGMENT_LENGTH) return null\n segments.push(segment)\n if (segments.length > FILE_TREE_MAX_DEPTH) return null\n }\n return segments.length === 0 ? null : segments\n}\n\ntype Draft = {\n id: string\n name: string\n children: Map<string, Draft>\n change?: FileChangeKind\n renamedFrom?: string\n additions?: number\n deletions?: number\n explicit: boolean\n}\n\nfunction newDraft(id: string, name: string): Draft {\n return { id, name, children: new Map(), explicit: false }\n}\n\nfunction compareNodes(a: FileTreeNode, b: FileTreeNode): number {\n if (a.kind !== b.kind) return a.kind === 'directory' ? -1 : 1\n const left = a.name.toLowerCase()\n const right = b.name.toLowerCase()\n if (left !== right) return left < right ? -1 : 1\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0\n}\n\nfunction safeCount(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) && value >= 0\n ? Math.floor(value)\n : undefined\n}\n\nconst CHANGE_KINDS: ReadonlySet<string> = new Set(FILE_CHANGE_KINDS)\n\n/**\n * Build the tree. Folders sort before files, then by name without regard to\n * case. A path that is both a file and the parent of another path is a folder\n * that keeps the file entry's change (a file replaced by a directory is a real\n * thing to report).\n */\nexport function buildFileTree(\n paths: readonly (string | FileChangeInput)[],\n options: BuildFileTreeOptions = {}\n): FileTreeBuild {\n const root = newDraft('', '')\n const rejected: string[] = []\n let duplicates = 0\n\n for (const input of paths) {\n const entry: FileChangeInput | undefined =\n typeof input === 'string'\n ? { path: input }\n : input && typeof input === 'object'\n ? input\n : undefined\n const segments = normalizePath(entry?.path)\n if (!entry || !segments) {\n rejected.push(\n typeof input === 'string' ? input : String((input as { path?: unknown })?.path ?? '')\n )\n continue\n }\n\n let node = root\n let id = ''\n for (const segment of segments) {\n id = id === '' ? segment : `${id}/${segment}`\n let child = node.children.get(segment)\n if (!child) {\n child = newDraft(id, segment)\n node.children.set(segment, child)\n }\n node = child\n }\n if (node.explicit) {\n duplicates += 1\n continue\n }\n node.explicit = true\n if (entry.change && CHANGE_KINDS.has(entry.change)) node.change = entry.change\n if (typeof entry.renamedFrom === 'string' && !hasForbiddenCharacter(entry.renamedFrom)) {\n node.renamedFrom = entry.renamedFrom\n }\n node.additions = safeCount(entry.additions)\n node.deletions = safeCount(entry.deletions)\n }\n\n // Pre-order flatten, then fold back in reverse: a child always has a larger\n // index than its parent, so one backwards pass builds every node after its\n // children without recursion.\n const order: Draft[] = []\n const parentOf: number[] = []\n const stack: [Draft, number][] = [...root.children.values()].map((draft) => [draft, -1])\n while (stack.length > 0) {\n const [draft, parent] = stack.pop()!\n const index = order.length\n order.push(draft)\n parentOf.push(parent)\n for (const child of draft.children.values()) stack.push([child, index])\n }\n\n const built: FileTreeNode[][] = order.map(() => [])\n const roots: FileTreeNode[] = []\n const compact = options.compact !== false\n let fileCount = 0\n\n for (let index = order.length - 1; index >= 0; index -= 1) {\n const draft = order[index]!\n const children = built[index]!.toSorted(compareNodes)\n let node: FileTreeNode\n const only = children.length === 1 ? children[0]! : undefined\n if (compact && only?.kind === 'directory' && draft.change === undefined) {\n // A folder holding only another folder reads as one row: `src/lib`, not two.\n node = { ...only, name: `${draft.name}/${only.name}` }\n } else if (children.length > 0) {\n node = {\n id: draft.id,\n name: draft.name,\n kind: 'directory',\n ...(draft.change && { change: draft.change }),\n ...(draft.renamedFrom !== undefined && { renamedFrom: draft.renamedFrom }),\n children,\n fileCount: children.reduce((sum, child) => sum + child.fileCount, 0),\n }\n } else {\n fileCount += 1\n node = {\n id: draft.id,\n name: draft.name,\n kind: 'file',\n ...(draft.change && { change: draft.change }),\n ...(draft.renamedFrom !== undefined && { renamedFrom: draft.renamedFrom }),\n ...(draft.additions !== undefined && { additions: draft.additions }),\n ...(draft.deletions !== undefined && { deletions: draft.deletions }),\n children: [],\n fileCount: 1,\n }\n }\n const parent = parentOf[index]!\n if (parent === -1) roots.push(node)\n else built[parent]!.push(node)\n }\n\n roots.sort(compareNodes)\n return { roots, rejected, duplicates, fileCount }\n}\n\n// ---------------------------------------------------------------------------\n// Projection\n// ---------------------------------------------------------------------------\n\nexport type FileTreeRow = Readonly<{\n node: FileTreeNode\n /** One-based depth. */\n level: number\n parentId: string | null\n expanded: boolean\n}>\n\n/**\n * The rows that are on screen, in reading order. A collapsed folder's subtree\n * is never visited, so toggling a folder in a 5 000-file tree costs the size of\n * what is visible, not of what exists.\n */\nexport function flattenFileTree(\n roots: readonly FileTreeNode[],\n expanded: ReadonlySet<string>\n): FileTreeRow[] {\n const rows: FileTreeRow[] = []\n const stack: [FileTreeNode, number, string | null][] = []\n for (let i = roots.length - 1; i >= 0; i -= 1) stack.push([roots[i]!, 1, null])\n while (stack.length > 0) {\n const [node, level, parentId] = stack.pop()!\n const open = node.kind === 'directory' && expanded.has(node.id)\n rows.push({ node, level, parentId, expanded: open })\n if (open) {\n for (let i = node.children.length - 1; i >= 0; i -= 1) {\n stack.push([node.children[i]!, level + 1, node.id])\n }\n }\n }\n return rows\n}\n\n/** Every node by id, for turning a row id back into its node. */\nexport function indexFileTree(roots: readonly FileTreeNode[]): Map<string, FileTreeNode> {\n const index = new Map<string, FileTreeNode>()\n const stack = [...roots]\n while (stack.length > 0) {\n const node = stack.pop()!\n index.set(node.id, node)\n for (const child of node.children) stack.push(child)\n }\n return index\n}\n\nexport type FileTreeExpansion = boolean | number | readonly string[] | undefined\n\n/** Tree this small opens fully by default; a larger one opens only its top level. */\nexport const FILE_TREE_AUTO_EXPAND_LIMIT = 100\n\n/**\n * Which folders start open. `true` opens every folder, a number opens folders up\n * to that depth (1 is the top level), a list opens exactly those ids, `false`\n * none. Unset is \"auto\": everything for a small tree, the top level for a large\n * one, because a tree that opens 5 000 rows is the freeze this exists to avoid.\n */\nexport function initialExpanded(\n roots: readonly FileTreeNode[],\n spec: FileTreeExpansion,\n fileCount: number\n): Set<string> {\n const open = new Set<string>()\n if (Array.isArray(spec)) {\n for (const id of spec) open.add(id)\n return open\n }\n const depth =\n spec === true\n ? Infinity\n : spec === false\n ? 0\n : typeof spec === 'number'\n ? Math.max(0, Math.floor(spec))\n : fileCount <= FILE_TREE_AUTO_EXPAND_LIMIT\n ? Infinity\n : 1\n const stack: [FileTreeNode, number][] = roots.map((node) => [node, 1])\n while (stack.length > 0) {\n const [node, level] = stack.pop()!\n if (node.kind !== 'directory' || level > depth) continue\n open.add(node.id)\n for (const child of node.children) stack.push([child, level + 1])\n }\n return open\n}\n\n// ---------------------------------------------------------------------------\n// Mounted window\n// ---------------------------------------------------------------------------\n\n/** The slice of visible rows that is mounted: `start` inclusive, `end` exclusive. */\nexport type RowWindow = Readonly<{ start: number; end: number }>\n\n/**\n * A window clamped to what exists, and never narrower than one page when that\n * many rows are there. Rows collapse and files are removed while a window is\n * held, so every read goes through this.\n */\nexport function clampWindow(window: RowWindow, total: number, page: number): RowWindow {\n if (total <= 0) return { start: 0, end: 0 }\n const start = Math.min(Math.max(0, window.start), total - 1)\n return { start, end: Math.min(total, Math.max(window.end, start + Math.max(1, page))) }\n}\n\n/**\n * The window after the keyboard (or typeahead) asks for a row. A row inside the\n * window changes nothing. A row just outside it, an arrow key at the edge, grows\n * the window by one page, so walking the tree costs a page at a time. Anything\n * further is a jump (End, Home, a typed letter): the window moves to the page that\n * holds the row instead of mounting every row between, which is what keeps End on\n * a 5 000-row tree from being a multi-second freeze.\n */\nexport function revealInWindow(\n window: RowWindow,\n index: number,\n total: number,\n page: number\n): RowWindow {\n const current = clampWindow(window, total, page)\n if (index < 0 || index >= total) return current\n if (index >= current.start && index < current.end) return current\n if (index === current.start - 1) {\n return { start: Math.max(0, current.start - page), end: current.end }\n }\n if (index === current.end)\n return { start: current.start, end: Math.min(total, current.end + page) }\n const start = Math.floor(index / page) * page\n return { start, end: Math.min(total, start + page) }\n}\n\n// ---------------------------------------------------------------------------\n// Words\n// ---------------------------------------------------------------------------\n\nexport type ChangeCounts = Readonly<\n Record<FileChangeKind, number> & {\n total: number\n /** Files with no change kind supplied. */\n unspecified: number\n }\n>\n\nexport function countChanges(roots: readonly FileTreeNode[]): ChangeCounts {\n const counts: { -readonly [K in keyof ChangeCounts]: number } = {\n total: 0,\n added: 0,\n modified: 0,\n deleted: 0,\n renamed: 0,\n unspecified: 0,\n }\n const stack = [...roots]\n while (stack.length > 0) {\n const node = stack.pop()!\n for (const child of node.children) stack.push(child)\n if (node.kind !== 'file') continue\n counts.total += 1\n if (node.change) counts[node.change] += 1\n else counts.unspecified += 1\n }\n return counts\n}\n\n/**\n * The summary in words: \"12 files changed: 3 added, 8 modified, 1 deleted\". Only\n * kinds that occur are named, and files with no kind are not folded into any of\n * them. Empty is empty, not \"0 files changed\".\n */\nexport function describeChanges(counts: ChangeCounts): string {\n if (counts.total === 0) return 'No changed files'\n const parts: string[] = []\n for (const kind of FILE_CHANGE_KINDS) {\n if (counts[kind] > 0) parts.push(`${counts[kind].toLocaleString()} ${kind}`)\n }\n const noun = counts.total === 1 ? 'file' : 'files'\n const head = `${counts.total.toLocaleString()} ${noun} changed`\n return parts.length > 0 ? `${head}: ${parts.join(', ')}` : head\n}\n\n/** The words for a change, which are drawn on the row and so also spoken. */\nexport const FILE_CHANGE_LABELS: Readonly<Record<FileChangeKind, string>> = {\n added: 'Added',\n modified: 'Modified',\n deleted: 'Deleted',\n renamed: 'Renamed',\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAM,oBAAoB;CAAC;CAAS;CAAY;CAAW;AAAS;;AA4CpE,IAAa,sBAAsB;AACnC,IAAM,qBAAqB;AAE3B,SAAS,sBAA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EAAO,KAAK,KAAK,IAAI,OAAO,QAAQ,MAAM,IAAI;CAAE;CAC1E,MAAM,QAAQ,KAAK,MAAM,QAAQ,IAAI,IAAI;CACzC,OAAO;EAAE;EAAO,KAAK,KAAK,IAAI,OAAO,QAAQ,IAAI;CAAE;AACrD;AAcA,SAAgB,aAAa,OAA8C;CACzE,MAAM,SAA0D;EAC9D,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;EACT,SAAS;EACT,aAAa;CACf;CACA,MAAM,QAAQ,CAAC,GAAG,KAAK;CACvB,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,OAAO,MAAM,IAAI;EACvB,KAAK,MAAM,SAAS,KAAK,UAAU,MAAM,KAAK,KAAK;EACnD,IAAI,KAAK,SAAS,QAAQ;EAC1B,OAAO,SAAS;EAChB,IAAI,KAAK,QAAQ,OAAO,KAAK,WAAW;OACnC,OAAO,eAAe;CAC7B;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,gBAAgB,QAA8B;CAC5D,IAAI,OAAO,UAAU,GAAG,OAAO;CAC/B,MAAM,QAAkB,CAAC;CACzB,KAAK,MAAM,QAAQ,mBACjB,IAAI,OAAO,QAAQ,GAAG,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,eAAe,EAAE,GAAG,MAAM;CAE7E,MAAM,OAAO,OAAO,UAAU,IAAI,SAAS;CAC3C,MAAM,OAAO,GAAG,OAAO,MAAM,eAAe,EAAE,GAAG,KAAK;CACtD,OAAO,MAAM,SAAS,IAAI,GAAG,KAAK,IAAI,MAAM,KAAK,IAAI,MAAM;AAC7D;;AAGA,IAAa,qBAA+D;CAC1E,OAAO;CACP,UAAU;CACV,SAAS;CACT,SAAS;AACX"}
|
|
1
|
+
{"version":3,"file":"build-file-tree.js","names":[],"sources":["../../../../src/components/composites/file-tree/build-file-tree.ts"],"sourcesContent":["/**\n * The model behind the changed-files tree: paths in, a folder tree out, and the\n * small pure rules the view needs (what is visible, what to say about the\n * changes, what a typed letter jumps to).\n *\n * Paths come from an agent, which means from a model, which means they are\n * untrusted text. They are used here as labels and as ids, never as places to\n * read or write, and the builder is strict about what counts as a path at all:\n * a `..` segment, a control character or a bidirectional override rejects the\n * path rather than being cleaned up, because a cleaned-up path is a different\n * path and the tree would be making a claim the input did not. Rejected paths\n * are returned, not dropped silently, so the view can say how many it ignored.\n *\n * Everything is iterative. A path with ten thousand segments, or a tree five\n * thousand files wide, must not be able to overflow the stack or stall the page.\n */\n\n/** Every change kind, in the order a summary names them. */\nconst FILE_CHANGE_KINDS = ['added', 'modified', 'deleted', 'renamed'] as const\n\nexport type FileChangeKind = (typeof FILE_CHANGE_KINDS)[number]\n\nexport type FileChangeInput = Readonly<{\n path: string\n /** Absent means the host did not say; the tree makes no statement about the file. */\n change?: FileChangeKind\n /** For a rename, where the file was. Shown as text only. */\n renamedFrom?: string\n additions?: number\n deletions?: number\n}>\n\nexport type FileTreeNode = Readonly<{\n /** The normalised path, `/`-separated. Unique within a tree. */\n id: string\n /** The label. For a compacted folder chain this is `a/b/c`. */\n name: string\n kind: 'file' | 'directory'\n change?: FileChangeKind\n renamedFrom?: string\n additions?: number\n deletions?: number\n children: readonly FileTreeNode[]\n /** Files at or below this node. A file counts itself. */\n fileCount: number\n}>\n\nexport type FileTreeBuild = Readonly<{\n roots: readonly FileTreeNode[]\n /** Inputs that were not accepted as paths, exactly as given. */\n rejected: readonly string[]\n /** Inputs that named a path already present. The first one wins. */\n duplicates: number\n fileCount: number\n}>\n\nexport type BuildFileTreeOptions = {\n /** Merge a folder with a single folder child into one row (`src/lib`). Default true. */\n compact?: boolean\n}\n\n/** Deeper paths are rejected: no real repository nests this far, and a row's indent would be unusable. */\nexport const FILE_TREE_MAX_DEPTH = 256\nconst MAX_SEGMENT_LENGTH = 1024\n\nfunction hasForbiddenCharacter(value: string): boolean {\n for (let i = 0; i < value.length; i += 1) {\n const code = value.charCodeAt(i)\n if (\n code < 0x20 ||\n (code >= 0x7f && code <= 0x9f) ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069) ||\n code === 0x2028 ||\n code === 0x2029\n ) {\n return true\n }\n }\n return false\n}\n\n/**\n * A path as its segments, or `null` when it is not acceptable. Both separators\n * are accepted, empty and `.` segments are dropped (`a//b`, `./a`, trailing `/`),\n * and a leading separator is dropped, so an absolute path becomes relative to\n * the tree's root rather than escaping it.\n */\nexport function normalizePath(path: unknown): string[] | null {\n if (typeof path !== 'string' || hasForbiddenCharacter(path)) return null\n const segments: string[] = []\n let start = 0\n for (let i = 0; i <= path.length; i += 1) {\n if (i !== path.length && path[i] !== '/' && path[i] !== '\\\\') continue\n const segment = path.slice(start, i)\n start = i + 1\n if (segment === '' || segment === '.') continue\n if (segment === '..' || segment.length > MAX_SEGMENT_LENGTH) return null\n segments.push(segment)\n if (segments.length > FILE_TREE_MAX_DEPTH) return null\n }\n return segments.length === 0 ? null : segments\n}\n\ntype Draft = {\n id: string\n name: string\n children: Map<string, Draft>\n change?: FileChangeKind\n renamedFrom?: string\n additions?: number\n deletions?: number\n explicit: boolean\n}\n\nfunction newDraft(id: string, name: string): Draft {\n return { id, name, children: new Map(), explicit: false }\n}\n\nfunction compareNodes(a: FileTreeNode, b: FileTreeNode): number {\n if (a.kind !== b.kind) return a.kind === 'directory' ? -1 : 1\n const left = a.name.toLowerCase()\n const right = b.name.toLowerCase()\n if (left !== right) return left < right ? -1 : 1\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0\n}\n\nfunction safeCount(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) && value >= 0\n ? Math.floor(value)\n : undefined\n}\n\nconst CHANGE_KINDS: ReadonlySet<string> = new Set(FILE_CHANGE_KINDS)\n\n/**\n * Build the tree. Folders sort before files, then by name without regard to\n * case. A path that is both a file and the parent of another path is a folder\n * that keeps the file entry's change (a file replaced by a directory is a real\n * thing to report).\n */\nexport function buildFileTree(\n paths: readonly (string | FileChangeInput)[],\n options: BuildFileTreeOptions = {}\n): FileTreeBuild {\n const root = newDraft('', '')\n const rejected: string[] = []\n let duplicates = 0\n\n for (const input of paths) {\n const entry: FileChangeInput | undefined =\n typeof input === 'string'\n ? { path: input }\n : input && typeof input === 'object'\n ? input\n : undefined\n const segments = normalizePath(entry?.path)\n if (!entry || !segments) {\n rejected.push(\n typeof input === 'string' ? input : String((input as { path?: unknown })?.path ?? '')\n )\n continue\n }\n\n let node = root\n let id = ''\n for (const segment of segments) {\n id = id === '' ? segment : `${id}/${segment}`\n let child = node.children.get(segment)\n if (!child) {\n child = newDraft(id, segment)\n node.children.set(segment, child)\n }\n node = child\n }\n if (node.explicit) {\n duplicates += 1\n continue\n }\n node.explicit = true\n if (entry.change && CHANGE_KINDS.has(entry.change)) node.change = entry.change\n if (typeof entry.renamedFrom === 'string' && !hasForbiddenCharacter(entry.renamedFrom)) {\n node.renamedFrom = entry.renamedFrom\n }\n node.additions = safeCount(entry.additions)\n node.deletions = safeCount(entry.deletions)\n }\n\n // Pre-order flatten, then fold back in reverse: a child always has a larger\n // index than its parent, so one backwards pass builds every node after its\n // children without recursion.\n const order: Draft[] = []\n const parentOf: number[] = []\n const stack: [Draft, number][] = [...root.children.values()].map((draft) => [draft, -1])\n while (stack.length > 0) {\n const [draft, parent] = stack.pop()!\n const index = order.length\n order.push(draft)\n parentOf.push(parent)\n for (const child of draft.children.values()) stack.push([child, index])\n }\n\n const built: FileTreeNode[][] = order.map(() => [])\n const roots: FileTreeNode[] = []\n const compact = options.compact !== false\n let fileCount = 0\n\n for (let index = order.length - 1; index >= 0; index -= 1) {\n const draft = order[index]!\n const children = built[index]!.toSorted(compareNodes)\n let node: FileTreeNode\n const only = children.length === 1 ? children[0]! : undefined\n if (compact && only?.kind === 'directory' && draft.change === undefined) {\n // A folder holding only another folder reads as one row: `src/lib`, not two.\n node = { ...only, name: `${draft.name}/${only.name}` }\n } else if (children.length > 0) {\n node = {\n id: draft.id,\n name: draft.name,\n kind: 'directory',\n ...(draft.change && { change: draft.change }),\n ...(draft.renamedFrom !== undefined && { renamedFrom: draft.renamedFrom }),\n children,\n fileCount: children.reduce((sum, child) => sum + child.fileCount, 0),\n }\n } else {\n fileCount += 1\n node = {\n id: draft.id,\n name: draft.name,\n kind: 'file',\n ...(draft.change && { change: draft.change }),\n ...(draft.renamedFrom !== undefined && { renamedFrom: draft.renamedFrom }),\n ...(draft.additions !== undefined && { additions: draft.additions }),\n ...(draft.deletions !== undefined && { deletions: draft.deletions }),\n children: [],\n fileCount: 1,\n }\n }\n const parent = parentOf[index]!\n if (parent === -1) roots.push(node)\n else built[parent]!.push(node)\n }\n\n roots.sort(compareNodes)\n return { roots, rejected, duplicates, fileCount }\n}\n\n// ---------------------------------------------------------------------------\n// Projection\n// ---------------------------------------------------------------------------\n\nexport type FileTreeRow = Readonly<{\n node: FileTreeNode\n /** One-based depth. */\n level: number\n parentId: string | null\n expanded: boolean\n}>\n\n/**\n * The rows that are on screen, in reading order. A collapsed folder's subtree\n * is never visited, so toggling a folder in a 5 000-file tree costs the size of\n * what is visible, not of what exists.\n */\nexport function flattenFileTree(\n roots: readonly FileTreeNode[],\n expanded: ReadonlySet<string>\n): FileTreeRow[] {\n const rows: FileTreeRow[] = []\n const stack: [FileTreeNode, number, string | null][] = []\n for (let i = roots.length - 1; i >= 0; i -= 1) stack.push([roots[i]!, 1, null])\n while (stack.length > 0) {\n const [node, level, parentId] = stack.pop()!\n const open = node.kind === 'directory' && expanded.has(node.id)\n rows.push({ node, level, parentId, expanded: open })\n if (open) {\n for (let i = node.children.length - 1; i >= 0; i -= 1) {\n stack.push([node.children[i]!, level + 1, node.id])\n }\n }\n }\n return rows\n}\n\n/** Every node by id, for turning a row id back into its node. */\nexport function indexFileTree(roots: readonly FileTreeNode[]): Map<string, FileTreeNode> {\n const index = new Map<string, FileTreeNode>()\n const stack = [...roots]\n while (stack.length > 0) {\n const node = stack.pop()!\n index.set(node.id, node)\n for (const child of node.children) stack.push(child)\n }\n return index\n}\n\nexport type FileTreeExpansion = boolean | number | readonly string[] | undefined\n\n/** Tree this small opens fully by default; a larger one opens only its top level. */\nexport const FILE_TREE_AUTO_EXPAND_LIMIT = 100\n\n/**\n * Which folders start open. `true` opens every folder, a number opens folders up\n * to that depth (1 is the top level), a list opens exactly those ids, `false`\n * none. Unset is \"auto\": everything for a small tree, the top level for a large\n * one, because a tree that opens 5 000 rows is the freeze this exists to avoid.\n */\nexport function initialExpanded(\n roots: readonly FileTreeNode[],\n spec: FileTreeExpansion,\n fileCount: number\n): Set<string> {\n const open = new Set<string>()\n if (Array.isArray(spec)) {\n for (const id of spec) open.add(id)\n return open\n }\n const depth =\n spec === true\n ? Infinity\n : spec === false\n ? 0\n : typeof spec === 'number'\n ? Math.max(0, Math.floor(spec))\n : fileCount <= FILE_TREE_AUTO_EXPAND_LIMIT\n ? Infinity\n : 1\n const stack: [FileTreeNode, number][] = roots.map((node) => [node, 1])\n while (stack.length > 0) {\n const [node, level] = stack.pop()!\n if (node.kind !== 'directory' || level > depth) continue\n open.add(node.id)\n for (const child of node.children) stack.push([child, level + 1])\n }\n return open\n}\n\n// ---------------------------------------------------------------------------\n// Mounted window\n// ---------------------------------------------------------------------------\n\n/** The slice of visible rows that is mounted: `start` inclusive, `end` exclusive. */\nexport type RowWindow = Readonly<{ start: number; end: number }>\n\n/**\n * A window clamped to what exists, and never narrower than one page when that\n * many rows are there. Rows collapse and files are removed while a window is\n * held, so every read goes through this.\n */\nexport function clampWindow(window: RowWindow, total: number, page: number): RowWindow {\n if (total <= 0) return { start: 0, end: 0 }\n const start = Math.min(Math.max(0, window.start), total - 1)\n return { start, end: Math.min(total, Math.max(window.end, start + Math.max(1, page))) }\n}\n\n/**\n * The window after the keyboard (or typeahead) asks for a row. A row inside the\n * window changes nothing. A row just outside it, an arrow key at the edge, grows\n * the window by one page, so walking the tree costs a page at a time. Anything\n * further is a jump (End, Home, a typed letter): the window moves to the page that\n * holds the row instead of mounting every row between, which is what keeps End on\n * a 5 000-row tree from being a multi-second freeze.\n */\nexport function revealInWindow(\n window: RowWindow,\n index: number,\n total: number,\n page: number\n): RowWindow {\n const current = clampWindow(window, total, page)\n if (index < 0 || index >= total) return current\n if (index >= current.start && index < current.end) return current\n if (index === current.start - 1) {\n return { start: Math.max(0, current.start - page), end: current.end }\n }\n if (index === current.end)\n return { start: current.start, end: Math.min(total, current.end + page) }\n const start = Math.floor(index / page) * page\n return { start, end: Math.min(total, start + page) }\n}\n\n// ---------------------------------------------------------------------------\n// Words\n// ---------------------------------------------------------------------------\n\nexport type ChangeCounts = Readonly<\n Record<FileChangeKind, number> & {\n total: number\n /** Files with no change kind supplied. */\n unspecified: number\n }\n>\n\nexport function countChanges(roots: readonly FileTreeNode[]): ChangeCounts {\n const counts: { -readonly [K in keyof ChangeCounts]: number } = {\n total: 0,\n added: 0,\n modified: 0,\n deleted: 0,\n renamed: 0,\n unspecified: 0,\n }\n const stack = [...roots]\n while (stack.length > 0) {\n const node = stack.pop()!\n for (const child of node.children) stack.push(child)\n if (node.kind !== 'file') continue\n counts.total += 1\n if (node.change) counts[node.change] += 1\n else counts.unspecified += 1\n }\n return counts\n}\n\n/**\n * The summary in words: \"12 files changed: 3 added, 8 modified, 1 deleted\". Only\n * kinds that occur are named, and files with no kind are not folded into any of\n * them. Empty is empty, not \"0 files changed\".\n */\nexport function describeChanges(counts: ChangeCounts): string {\n if (counts.total === 0) return 'No changed files'\n const parts: string[] = []\n for (const kind of FILE_CHANGE_KINDS) {\n if (counts[kind] > 0) parts.push(`${counts[kind].toLocaleString()} ${kind}`)\n }\n const noun = counts.total === 1 ? 'file' : 'files'\n const head = `${counts.total.toLocaleString()} ${noun} changed`\n return parts.length > 0 ? `${head}: ${parts.join(', ')}` : head\n}\n\n/** The words for a change, which are drawn on the row and so also spoken. */\nexport const FILE_CHANGE_LABELS: Readonly<Record<FileChangeKind, string>> = {\n added: 'Added',\n modified: 'Modified',\n deleted: 'Deleted',\n renamed: 'Renamed',\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAM,oBA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yleProperty, spread, template } from "@solidjs/web";
|
|
2
|
+
import { File as File$1, Folder as Folder$1, FolderOpen as FolderOpen$1 } from "@lucide/solid";
|
|
3
|
+
import { For, Show, createMemo, createProjection, createSignal, omit } from "solid-js";
|
|
1
4
|
import { keyedRows } from "../../../lib/keyed-rows.js";
|
|
2
5
|
import { cn } from "../../../lib/utils.js";
|
|
3
6
|
import { Button } from "../../ui/button/button.js";
|
|
@@ -5,9 +8,6 @@ import { Badge } from "../../ui/badge/badge.js";
|
|
|
5
8
|
import { Tree, TreeRow } from "../tree/tree.js";
|
|
6
9
|
import { FILE_CHANGE_LABELS, buildFileTree, clampWindow, countChanges, describeChanges, flattenFileTree, indexFileTree, initialExpanded, revealInWindow } from "./build-file-tree.js";
|
|
7
10
|
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
8
|
-
import { className, createComponent, effect, insert, memo, readShallow, setAttribute, setStyleProperty, spread, template } from "@solidjs/web";
|
|
9
|
-
import { File, Folder, FolderOpen } from "@lucide/solid";
|
|
10
|
-
import { For, Show, createMemo, createProjection, createSignal, omit } from "solid-js";
|
|
11
11
|
// src/components/composites/file-tree/file-tree.tsx
|
|
12
12
|
var _tmpl$ = /* @__PURE__ */ template(`<span>`);
|
|
13
13
|
var _tmpl$2 = /* @__PURE__ */ template(`<span class=sr-only>, renamed from `);
|
|
@@ -20,9 +20,9 @@ var _tmpl$8 = /* @__PURE__ */ template(`<p data-slot=file-tree-summary class="m-
|
|
|
20
20
|
var _tmpl$9 = /* @__PURE__ */ template(`<p class="m-0 text-xs text-muted-foreground">No changed files`);
|
|
21
21
|
var _tmpl$10 = /* @__PURE__ */ template(`<div>`);
|
|
22
22
|
var _tmpl$11 = /* @__PURE__ */ template(`<div class="scroll-fade overflow-auto rounded-md">`);
|
|
23
|
-
var File
|
|
24
|
-
var Folder
|
|
25
|
-
var FolderOpen
|
|
23
|
+
var File = fastIcon(File$1);
|
|
24
|
+
var Folder = fastIcon(Folder$1);
|
|
25
|
+
var FolderOpen = fastIcon(FolderOpen$1);
|
|
26
26
|
var FILE_TREE_MAX_ROWS = 500;
|
|
27
27
|
var CHANGE_VARIANT = {
|
|
28
28
|
added: "success",
|
|
@@ -336,13 +336,13 @@ function FileTree(props) {
|
|
|
336
336
|
return entry.item().node.kind === "directory";
|
|
337
337
|
})() ? memo(() => {
|
|
338
338
|
return !!entry.item().expanded;
|
|
339
|
-
})() ? createComponent(FolderOpen
|
|
339
|
+
})() ? createComponent(FolderOpen, {
|
|
340
340
|
"aria-hidden": "true",
|
|
341
341
|
class: "text-muted-foreground"
|
|
342
|
-
}) : createComponent(Folder
|
|
342
|
+
}) : createComponent(Folder, {
|
|
343
343
|
"aria-hidden": "true",
|
|
344
344
|
class: "text-muted-foreground"
|
|
345
|
-
}) : createComponent(File
|
|
345
|
+
}) : createComponent(File, {
|
|
346
346
|
"aria-hidden": "true",
|
|
347
347
|
class: "text-muted-foreground"
|
|
348
348
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-tree.js","names":["title={node().id}","<Show when={node().renamedFrom}>\n <span class=\"sr-only\">, renamed from {node().renamedFrom}</span>\n </Show>","<Show when={node().kind === 'file' && (node().additions || node().deletions)}>\n <span class=\"font-code text-2xs tabular-nums\">\n <Show when={node().additions !== undefined}>\n <span class=\"text-foreground\">+{node().additions}</span>\n </Show>{' '}\n <Show when={node().deletions !== undefined}>\n <span class=\"text-foreground\">−{node().deletions}</span>\n </Show>\n </span>\n </Show>","<span class=\"font-code text-2xs tabular-nums\">\n <Show when={node().additions !== undefined}>\n <span class=\"text-foreground\">+{node().additions}</span>\n </Show>{' '}\n <Show when={node().deletions !== undefined}>\n <span class=\"text-foreground\">−{node().deletions}</span>\n </Show>\n </span>","<Show when={node().kind === 'directory' && !props.row.expanded}>\n <span class=\"text-2xs tabular-nums\">\n {node().fileCount.toLocaleString()} {node().fileCount === 1 ? 'file' : 'files'}\n </span>\n </Show>","<span class=\"text-2xs tabular-nums\">\n {node().fileCount.toLocaleString()} {node().fileCount === 1 ? 'file' : 'files'}\n </span>","<Show when={node().change}>\n {(change) => (\n <Badge variant={CHANGE_VARIANT[change()]} size=\"sm\">\n {FILE_CHANGE_LABELS[change()]}\n </Badge>\n )}\n </Show>","<Badge variant={CHANGE_VARIANT[change()]} size=\"sm\">\n {FILE_CHANGE_LABELS[change()]}\n </Badge>","size=\"sm\"","<p data-slot=\"file-tree-summary\" class=\"m-0 text-xs text-muted-foreground\">\n {describeChanges(counts())}\n <Show when={build().rejected.length > 0}>\n {' '}\n · {build().rejected.length.toLocaleString()}{' '}\n {build().rejected.length === 1 ? 'path' : 'paths'} ignored as not valid\n </Show>\n </p>","{build().rejected.length.toLocaleString()}","{build().rejected.length === 1 ? 'path' : 'paths'}","<div data-slot=\"file-tree\" class={cn('flex min-w-0 flex-col gap-1', local.class)} {...rest}>\n <Show when={local.showSummary !== false}>\n <p data-slot=\"file-tree-summary\" class=\"m-0 text-xs text-muted-foreground\">\n {describeChanges(counts())}\n <Show when={build().rejected.length > 0}>\n {' '}\n · {build().rejected.length.toLocaleString()}{' '}\n {build().rejected.length === 1 ? 'path' : 'paths'} ignored as not valid\n </Show>\n </p>\n </Show>\n <Show when={rows().length === 0 && local.showSummary === false}>\n <p class=\"m-0 text-xs text-muted-foreground\">No changed files</p>\n </Show>\n <Show when={rows().length > 0}>\n <Show when={rowsBefore() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n <div class=\"scroll-fade overflow-auto rounded-md\" style={{ 'max-height': maxHeight() }}>\n <Tree\n aria-label={local.label ?? 'Changed files'}\n visibleItems={items()}\n activeId={activeId()}\n onActiveIdChange={setActiveId}\n onExpand={toggle}\n onActivate={(id) => activate(id)}\n onSelectItem={(id) => select(id)}\n onRequestReveal={reveal}\n selectionMode={selectable() ? 'single' : undefined}\n typeaheadLabel={(id) => nodes().get(id)?.name ?? ''}\n >\n <For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>\n </Tree>\n </div>\n <Show when={rowsAfter() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n </Show>\n </div>","<p class=\"m-0 text-xs text-muted-foreground\">No changed files</p>","<Show when={rowsBefore() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>","<Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>","variant=\"ghost\"","size=\"2xs\"","onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }","Math.min(rowsBefore(), pageSize()).toLocaleString()","rowsBefore().toLocaleString()","<div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>","<Tree\n aria-label={local.label ?? 'Changed files'}\n visibleItems={items()}\n activeId={activeId()}\n onActiveIdChange={setActiveId}\n onExpand={toggle}\n onActivate={(id) => activate(id)}\n onSelectItem={(id) => select(id)}\n onRequestReveal={reveal}\n selectionMode={selectable() ? 'single' : undefined}\n typeaheadLabel={(id) => nodes().get(id)?.name ?? ''}\n >\n <For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>\n </Tree>","onActiveIdChange={setActiveId}","onExpand={toggle}","onActivate={(id) => activate(id)}","onSelectItem={(id) => select(id)}","onRequestReveal={reveal}","typeaheadLabel={(id) => nodes().get(id)?.name ?? ''}","<For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>","<TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>","selectable() ? isSelected(entry.item().node.id) : undefined","entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )","<FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />","class=\"text-muted-foreground\"","<Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />","<File aria-hidden=\"true\" class=\"text-muted-foreground\" />","<RowTrailing row={entry.item()} />","<RowContent row={entry.item()} />","<Show when={rowsAfter() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>","<Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>","onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }","Math.min(rowsAfter(), pageSize()).toLocaleString()","rowsAfter().toLocaleString()","<div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>","File","LucideFile","Folder","LucideFolder","FolderOpen","LucideFolderOpen","_$readShallow","_$setAttribute"],"sources":["../../../../src/components/composites/file-tree/file-tree.tsx"],"sourcesContent":["import {\n File as LucideFile,\n Folder as LucideFolder,\n FolderOpen as LucideFolderOpen,\n} from '@lucide/solid'\nimport { createMemo, createProjection, createSignal, For, Show, omit } from 'solid-js'\nimport { type ComponentProps } from '@solidjs/web'\nimport { keyedRows } from '#lib/keyed-rows'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Badge } from '../../ui/badge'\nimport { Tree, TreeRow, type TreeItemDescriptor } from '../tree'\nimport {\n buildFileTree,\n clampWindow,\n countChanges,\n describeChanges,\n FILE_CHANGE_LABELS,\n flattenFileTree,\n indexFileTree,\n initialExpanded,\n revealInWindow,\n type RowWindow,\n type FileChangeInput,\n type FileChangeKind,\n type FileTreeExpansion,\n type FileTreeNode,\n type FileTreeRow,\n} from './build-file-tree'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst File = fastIcon(LucideFile)\nconst Folder = fastIcon(LucideFolder)\nconst FolderOpen = fastIcon(LucideFolderOpen)\n\n/**\n * FileTree.\n *\n * The files an agent changed, as a folder tree. It is for a change set — dozens\n * to thousands of paths with an optional change kind each — and not for browsing\n * a workspace: it has no rename, drag, or filesystem action, and it never opens\n * anything. Reach for `Trace` lines when the agent touched two or three files, and\n * for the shared `Tree` directly when the host owns a real file explorer.\n *\n * ## Built on `Tree`, and why that fits\n *\n * `Tree` supplies the treeitem semantics and the WAI-ARIA keyboard model (arrows,\n * Home/End, roving tab stop) and leaves the projection to the host. A changed-file\n * tree is small enough that the whole projection can live in memory, and the\n * `Tree` contract for a mounted window — a complete `visibleItems` list with only\n * some rows rendered, `onRequestReveal` to mount a row the keyboard moved to — is\n * exactly the seam a bounded render needs, so this adds no navigation code of\n * its own. Typeahead is `Tree`'s too, searching row names: a typed prefix jumps\n * to the next row whose name starts with it.\n *\n * ## Large trees\n *\n * A collapsed folder's subtree is never visited or rendered, so a 5 000-file tree\n * costs what is visible. A tree of more than 100 files starts with only its top\n * level open (`defaultExpanded` overrides). Past `maxRows` visible rows only a\n * window of them is mounted, with a control above and below to move it a page at\n * a time. The full list is what keyboard navigation walks: an arrow key at the\n * window's edge grows it by a page, and a jump (End, Home, a typed letter) moves\n * it to the page holding the target instead of mounting every row between, so End\n * on a tree of thousands of open rows stays one page of work.\n *\n * ## Changes are claims\n *\n * A change kind is drawn — as a word on the row, so it is also spoken — only for a\n * file the host gave one. A file without one is listed and nothing more is said.\n * The summary counts what was supplied, and is silent about files with no kind.\n * Paths that are not acceptable (`..` segments, control characters) are not drawn;\n * their number is stated, so the list is never quietly shorter than the input.\n *\n * ## Selection is the host's\n *\n * Rows select only when `onSelect` is supplied; without it no row is selectable\n * and `aria-selected` is not set. Enter or a click on a folder expands it; on a\n * file it selects. Space selects either. The tree never opens a file itself — the\n * path is untrusted text, and what it means on this machine is the host's call.\n */\nexport type FileTreeProps = Omit<ComponentProps<'div'>, 'children' | 'onSelect'> & {\n /** Paths, or paths with a change kind. Both `/` and `\\` separate segments. */\n files: readonly (string | FileChangeInput)[]\n /** The tree's accessible name. Default \"Changed files\". */\n label?: string\n /**\n * Which folders start open: `true` all, `false` none, a number to that depth,\n * or a list of ids. Unset opens a small tree fully and a large one at its top level.\n */\n defaultExpanded?: FileTreeExpansion\n /** Merge a folder with a single folder child into one row. Default true. */\n compact?: boolean\n /** The selected node's id. Meaningful only with `onSelect`. */\n selected?: string\n /** Make rows selectable. Omit and nothing is selectable. */\n onSelect?: (path: string, node: FileTreeNode) => void\n /** Height of the tree box, which scrolls past it. A number is pixels. Default `20rem`. */\n maxHeight?: number | string\n /** Visible rows mounted at once; more are added a page at a time. Default 500. */\n maxRows?: number\n /** Show the count of changes above the tree. Default true. */\n showSummary?: boolean\n}\n\nexport const FILE_TREE_MAX_ROWS = 500\n\nconst CHANGE_VARIANT: Readonly<\n Record<FileChangeKind, 'success' | 'warning' | 'destructive' | 'info'>\n> = {\n added: 'success',\n modified: 'warning',\n deleted: 'destructive',\n renamed: 'info',\n}\n\nfunction sameRow(previous: FileTreeRow, next: FileTreeRow) {\n return (\n previous.node === next.node &&\n previous.expanded === next.expanded &&\n previous.level === next.level &&\n previous.parentId === next.parentId\n )\n}\n\nfunction descriptor(row: FileTreeRow): TreeItemDescriptor {\n return {\n id: row.node.id,\n parentId: row.parentId,\n level: row.level,\n expandable: row.node.kind === 'directory',\n expanded: row.expanded,\n }\n}\n\nfunction RowContent(props: { row: FileTreeRow }) {\n const node = () => props.row.node\n return (\n <>\n <span\n class={cn('truncate', {\n 'text-muted-foreground line-through': node().change === 'deleted',\n })}\n title={node().id}\n >\n {node().name}\n </span>\n <Show when={node().renamedFrom}>\n <span class=\"sr-only\">, renamed from {node().renamedFrom}</span>\n </Show>\n </>\n )\n}\n\nfunction RowTrailing(props: { row: FileTreeRow }) {\n const node = () => props.row.node\n return (\n <>\n <Show when={node().kind === 'file' && (node().additions || node().deletions)}>\n <span class=\"font-code text-2xs tabular-nums\">\n <Show when={node().additions !== undefined}>\n <span class=\"text-foreground\">+{node().additions}</span>\n </Show>{' '}\n <Show when={node().deletions !== undefined}>\n <span class=\"text-foreground\">−{node().deletions}</span>\n </Show>\n </span>\n </Show>\n <Show when={node().kind === 'directory' && !props.row.expanded}>\n <span class=\"text-2xs tabular-nums\">\n {node().fileCount.toLocaleString()} {node().fileCount === 1 ? 'file' : 'files'}\n </span>\n </Show>\n {/* The word is the signal; the tint only helps a sighted reader find it. */}\n <Show when={node().change}>\n {(change) => (\n <Badge variant={CHANGE_VARIANT[change()]} size=\"sm\">\n {FILE_CHANGE_LABELS[change()]}\n </Badge>\n )}\n </Show>\n </>\n )\n}\n\nexport function FileTree(props: FileTreeProps) {\n const local = props\n const rest = omit(\n props,\n 'files',\n 'label',\n 'defaultExpanded',\n 'compact',\n 'selected',\n 'onSelect',\n 'maxHeight',\n 'maxRows',\n 'showSummary',\n 'class'\n )\n\n const build = createMemo(() => buildFileTree(local.files, { compact: local.compact }))\n const nodes = createMemo(() => indexFileTree(build().roots))\n const counts = createMemo(() => countChanges(build().roots))\n\n // Folders the tree has already decided about. A change set that grows while\n // the agent works opens its new folders by the same rule as the first render,\n // and never reopens one the reader closed.\n // A writable derivation: a new tree re-derives from the previous set (the\n // reader's toggles included), and a toggle writes it directly.\n let seen = new Set<string>()\n const [expanded, setExpanded] = createSignal<ReadonlySet<string>>((previous) => {\n const { roots, fileCount } = build()\n const wanted = initialExpanded(roots, local.defaultExpanded, fileCount)\n const folders = new Set<string>()\n for (const [id, node] of nodes()) if (node.kind === 'directory') folders.add(id)\n const next = new Set([...(previous ?? [])].filter((id) => folders.has(id)))\n for (const id of wanted) if (!seen.has(id)) next.add(id)\n seen = folders\n return next\n })\n\n const rows = createMemo(() => flattenFileTree(build().roots, expanded()))\n const pageSize = () => Math.max(1, Math.floor(local.maxRows ?? FILE_TREE_MAX_ROWS))\n const [requested, setRequested] = createSignal<RowWindow>({ start: 0, end: 0 })\n const mountedWindow = createMemo(() =>\n clampWindow(\n requested().end === 0 ? { start: 0, end: pageSize() } : requested(),\n rows().length,\n pageSize()\n )\n )\n const items = createMemo(() => rows().map(descriptor))\n // Flattening returns a fresh row object for every row on each expand or collapse;\n // only a row whose own fields changed should update, not all of them.\n const mounted = keyedRows(\n () => rows().slice(mountedWindow().start, mountedWindow().end),\n (row) => row.node.id,\n sameRow\n )\n const rowsBefore = () => mountedWindow().start\n const rowsAfter = () => Math.max(0, rows().length - mountedWindow().end)\n\n const [activeId, setActiveId] = createSignal<string | null>(null)\n const selectable = () => local.onSelect !== undefined\n // Keyed by row id, so a new selection notifies only the row leaving it and the\n // row entering it, not every mounted row.\n const selectedRows = createProjection<Record<string, true>>((draft) => {\n const id = local.selected\n for (const key of Object.keys(draft)) if (key !== id) delete draft[key]\n if (id !== undefined) draft[id] = true\n }, {})\n const isSelected = (id: string) => selectedRows[id] === true\n\n const toggle = (id: string, open: boolean) => {\n setExpanded((current) => {\n const next = new Set(current)\n if (open) next.add(id)\n else next.delete(id)\n return next\n })\n }\n\n /** Mount the rows around one the keyboard is moving to, so focus can land on it. */\n const reveal = (id: string) => {\n const index = rows().findIndex((row) => row.node.id === id)\n setRequested(revealInWindow(mountedWindow(), index, rows().length, pageSize()))\n }\n\n const select = (id: string) => {\n const node = nodes().get(id)\n if (node) local.onSelect?.(id, node)\n }\n const activate = (id: string) => {\n const node = nodes().get(id)\n if (!node) return\n if (node.kind === 'directory') toggle(id, !expanded().has(id))\n else select(id)\n }\n\n const maxHeight = () =>\n typeof local.maxHeight === 'number' ? `${local.maxHeight}px` : (local.maxHeight ?? '20rem')\n\n return (\n <div data-slot=\"file-tree\" class={cn('flex min-w-0 flex-col gap-1', local.class)} {...rest}>\n <Show when={local.showSummary !== false}>\n <p data-slot=\"file-tree-summary\" class=\"m-0 text-xs text-muted-foreground\">\n {describeChanges(counts())}\n <Show when={build().rejected.length > 0}>\n {' '}\n · {build().rejected.length.toLocaleString()}{' '}\n {build().rejected.length === 1 ? 'path' : 'paths'} ignored as not valid\n </Show>\n </p>\n </Show>\n <Show when={rows().length === 0 && local.showSummary === false}>\n <p class=\"m-0 text-xs text-muted-foreground\">No changed files</p>\n </Show>\n <Show when={rows().length > 0}>\n <Show when={rowsBefore() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n <div class=\"scroll-fade overflow-auto rounded-md\" style={{ 'max-height': maxHeight() }}>\n <Tree\n aria-label={local.label ?? 'Changed files'}\n visibleItems={items()}\n activeId={activeId()}\n onActiveIdChange={setActiveId}\n onExpand={toggle}\n onActivate={(id) => activate(id)}\n onSelectItem={(id) => select(id)}\n onRequestReveal={reveal}\n selectionMode={selectable() ? 'single' : undefined}\n typeaheadLabel={(id) => nodes().get(id)?.name ?? ''}\n >\n <For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>\n </Tree>\n </div>\n <Show when={rowsAfter() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAM6C,SAAO,SAASC,IAAU;AAChC,IAAMC,WAAS,SAASC,MAAY;AACpC,IAAMC,eAAa,SAASC,UAAgB;AAwE5C,IAAa,qBAAqB;AAElC,IAAM,iBAEF;CACF,OAAO;CACP,UAAU;C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;QACvB,KAAK,KAAK,IAAI,KAAK,CAAC,CAAC,QAAQ,cAAc,CAAC,CAAC,MAAM,SAAS,CAAC;OAC/D,CAAC;OAPL,IAAA,WAAA;QASC,OAAA;;SACOC,WAAAA;UAAK,OAAA,KAAA,IAAI,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,eAAe;;SAAE;SACxDC,WAAAA;UAAU,OAAA,UAAA,CAAC,CAAC,eAAe;;SAAE;QAD1B;OAEE;MACL,CAAA,CAAA;MAfP,OACEC;KAeI;;GAtEP,IADD,KAAA;EAwEM;CAAC,EAAA,CAAD,GAtFRhC,MAuFK;CAxFP,OACEA;AAyFJ"}
|
|
1
|
+
{"version":3,"file":"file-tree.js","names":["title={node().id}","<Show when={node().renamedFrom}>\n <span class=\"sr-only\">, renamed from {node().renamedFrom}</span>\n </Show>","<Show when={node().kind === 'file' && (node().additions || node().deletions)}>\n <span class=\"font-code text-2xs tabular-nums\">\n <Show when={node().additions !== undefined}>\n <span class=\"text-foreground\">+{node().additions}</span>\n </Show>{' '}\n <Show when={node().deletions !== undefined}>\n <span class=\"text-foreground\">−{node().deletions}</span>\n </Show>\n </span>\n </Show>","<span class=\"font-code text-2xs tabular-nums\">\n <Show when={node().additions !== undefined}>\n <span class=\"text-foreground\">+{node().additions}</span>\n </Show>{' '}\n <Show when={node().deletions !== undefined}>\n <span class=\"text-foreground\">−{node().deletions}</span>\n </Show>\n </span>","<Show when={node().kind === 'directory' && !props.row.expanded}>\n <span class=\"text-2xs tabular-nums\">\n {node().fileCount.toLocaleString()} {node().fileCount === 1 ? 'file' : 'files'}\n </span>\n </Show>","<span class=\"text-2xs tabular-nums\">\n {node().fileCount.toLocaleString()} {node().fileCount === 1 ? 'file' : 'files'}\n </span>","<Show when={node().change}>\n {(change) => (\n <Badge variant={CHANGE_VARIANT[change()]} size=\"sm\">\n {FILE_CHANGE_LABELS[change()]}\n </Badge>\n )}\n </Show>","<Badge variant={CHANGE_VARIANT[change()]} size=\"sm\">\n {FILE_CHANGE_LABELS[change()]}\n </Badge>","size=\"sm\"","<p data-slot=\"file-tree-summary\" class=\"m-0 text-xs text-muted-foreground\">\n {describeChanges(counts())}\n <Show when={build().rejected.length > 0}>\n {' '}\n · {build().rejected.length.toLocaleString()}{' '}\n {build().rejected.length === 1 ? 'path' : 'paths'} ignored as not valid\n </Show>\n </p>","{build().rejected.length.toLocaleString()}","{build().rejected.length === 1 ? 'path' : 'paths'}","<div data-slot=\"file-tree\" class={cn('flex min-w-0 flex-col gap-1', local.class)} {...rest}>\n <Show when={local.showSummary !== false}>\n <p data-slot=\"file-tree-summary\" class=\"m-0 text-xs text-muted-foreground\">\n {describeChanges(counts())}\n <Show when={build().rejected.length > 0}>\n {' '}\n · {build().rejected.length.toLocaleString()}{' '}\n {build().rejected.length === 1 ? 'path' : 'paths'} ignored as not valid\n </Show>\n </p>\n </Show>\n <Show when={rows().length === 0 && local.showSummary === false}>\n <p class=\"m-0 text-xs text-muted-foreground\">No changed files</p>\n </Show>\n <Show when={rows().length > 0}>\n <Show when={rowsBefore() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n <div class=\"scroll-fade overflow-auto rounded-md\" style={{ 'max-height': maxHeight() }}>\n <Tree\n aria-label={local.label ?? 'Changed files'}\n visibleItems={items()}\n activeId={activeId()}\n onActiveIdChange={setActiveId}\n onExpand={toggle}\n onActivate={(id) => activate(id)}\n onSelectItem={(id) => select(id)}\n onRequestReveal={reveal}\n selectionMode={selectable() ? 'single' : undefined}\n typeaheadLabel={(id) => nodes().get(id)?.name ?? ''}\n >\n <For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>\n </Tree>\n </div>\n <Show when={rowsAfter() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n </Show>\n </div>","<p class=\"m-0 text-xs text-muted-foreground\">No changed files</p>","<Show when={rowsBefore() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>","<Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>","variant=\"ghost\"","size=\"2xs\"","onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }","Math.min(rowsBefore(), pageSize()).toLocaleString()","rowsBefore().toLocaleString()","<div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>","<Tree\n aria-label={local.label ?? 'Changed files'}\n visibleItems={items()}\n activeId={activeId()}\n onActiveIdChange={setActiveId}\n onExpand={toggle}\n onActivate={(id) => activate(id)}\n onSelectItem={(id) => select(id)}\n onRequestReveal={reveal}\n selectionMode={selectable() ? 'single' : undefined}\n typeaheadLabel={(id) => nodes().get(id)?.name ?? ''}\n >\n <For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>\n </Tree>","onActiveIdChange={setActiveId}","onExpand={toggle}","onActivate={(id) => activate(id)}","onSelectItem={(id) => select(id)}","onRequestReveal={reveal}","typeaheadLabel={(id) => nodes().get(id)?.name ?? ''}","<For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>","<TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>","selectable() ? isSelected(entry.item().node.id) : undefined","entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )","<FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />","class=\"text-muted-foreground\"","<Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />","<File aria-hidden=\"true\" class=\"text-muted-foreground\" />","<RowTrailing row={entry.item()} />","<RowContent row={entry.item()} />","<Show when={rowsAfter() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>","<Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>","onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }","Math.min(rowsAfter(), pageSize()).toLocaleString()","rowsAfter().toLocaleString()","<div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>","LucideFile","LucideFolder","LucideFolderOpen","_$insert","_$effect","_$readShallow","_$className","_$setAttribute","_$spread","_$setStyleProperty"],"sources":["../../../../src/components/composites/file-tree/file-tree.tsx"],"sourcesContent":["import {\n File as LucideFile,\n Folder as LucideFolder,\n FolderOpen as LucideFolderOpen,\n} from '@lucide/solid'\nimport { createMemo, createProjection, createSignal, For, Show, omit } from 'solid-js'\nimport { type ComponentProps } from '@solidjs/web'\nimport { keyedRows } from '#lib/keyed-rows'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Badge } from '../../ui/badge'\nimport { Tree, TreeRow, type TreeItemDescriptor } from '../tree'\nimport {\n buildFileTree,\n clampWindow,\n countChanges,\n describeChanges,\n FILE_CHANGE_LABELS,\n flattenFileTree,\n indexFileTree,\n initialExpanded,\n revealInWindow,\n type RowWindow,\n type FileChangeInput,\n type FileChangeKind,\n type FileTreeExpansion,\n type FileTreeNode,\n type FileTreeRow,\n} from './build-file-tree'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst File = fastIcon(LucideFile)\nconst Folder = fastIcon(LucideFolder)\nconst FolderOpen = fastIcon(LucideFolderOpen)\n\n/**\n * FileTree.\n *\n * The files an agent changed, as a folder tree. It is for a change set — dozens\n * to thousands of paths with an optional change kind each — and not for browsing\n * a workspace: it has no rename, drag, or filesystem action, and it never opens\n * anything. Reach for `Trace` lines when the agent touched two or three files, and\n * for the shared `Tree` directly when the host owns a real file explorer.\n *\n * ## Built on `Tree`, and why that fits\n *\n * `Tree` supplies the treeitem semantics and the WAI-ARIA keyboard model (arrows,\n * Home/End, roving tab stop) and leaves the projection to the host. A changed-file\n * tree is small enough that the whole projection can live in memory, and the\n * `Tree` contract for a mounted window — a complete `visibleItems` list with only\n * some rows rendered, `onRequestReveal` to mount a row the keyboard moved to — is\n * exactly the seam a bounded render needs, so this adds no navigation code of\n * its own. Typeahead is `Tree`'s too, searching row names: a typed prefix jumps\n * to the next row whose name starts with it.\n *\n * ## Large trees\n *\n * A collapsed folder's subtree is never visited or rendered, so a 5 000-file tree\n * costs what is visible. A tree of more than 100 files starts with only its top\n * level open (`defaultExpanded` overrides). Past `maxRows` visible rows only a\n * window of them is mounted, with a control above and below to move it a page at\n * a time. The full list is what keyboard navigation walks: an arrow key at the\n * window's edge grows it by a page, and a jump (End, Home, a typed letter) moves\n * it to the page holding the target instead of mounting every row between, so End\n * on a tree of thousands of open rows stays one page of work.\n *\n * ## Changes are claims\n *\n * A change kind is drawn — as a word on the row, so it is also spoken — only for a\n * file the host gave one. A file without one is listed and nothing more is said.\n * The summary counts what was supplied, and is silent about files with no kind.\n * Paths that are not acceptable (`..` segments, control characters) are not drawn;\n * their number is stated, so the list is never quietly shorter than the input.\n *\n * ## Selection is the host's\n *\n * Rows select only when `onSelect` is supplied; without it no row is selectable\n * and `aria-selected` is not set. Enter or a click on a folder expands it; on a\n * file it selects. Space selects either. The tree never opens a file itself — the\n * path is untrusted text, and what it means on this machine is the host's call.\n */\nexport type FileTreeProps = Omit<ComponentProps<'div'>, 'children' | 'onSelect'> & {\n /** Paths, or paths with a change kind. Both `/` and `\\` separate segments. */\n files: readonly (string | FileChangeInput)[]\n /** The tree's accessible name. Default \"Changed files\". */\n label?: string\n /**\n * Which folders start open: `true` all, `false` none, a number to that depth,\n * or a list of ids. Unset opens a small tree fully and a large one at its top level.\n */\n defaultExpanded?: FileTreeExpansion\n /** Merge a folder with a single folder child into one row. Default true. */\n compact?: boolean\n /** The selected node's id. Meaningful only with `onSelect`. */\n selected?: string\n /** Make rows selectable. Omit and nothing is selectable. */\n onSelect?: (path: string, node: FileTreeNode) => void\n /** Height of the tree box, which scrolls past it. A number is pixels. Default `20rem`. */\n maxHeight?: number | string\n /** Visible rows mounted at once; more are added a page at a time. Default 500. */\n maxRows?: number\n /** Show the count of changes above the tree. Default true. */\n showSummary?: boolean\n}\n\nexport const FILE_TREE_MAX_ROWS = 500\n\nconst CHANGE_VARIANT: Readonly<\n Record<FileChangeKind, 'success' | 'warning' | 'destructive' | 'info'>\n> = {\n added: 'success',\n modified: 'warning',\n deleted: 'destructive',\n renamed: 'info',\n}\n\nfunction sameRow(previous: FileTreeRow, next: FileTreeRow) {\n return (\n previous.node === next.node &&\n previous.expanded === next.expanded &&\n previous.level === next.level &&\n previous.parentId === next.parentId\n )\n}\n\nfunction descriptor(row: FileTreeRow): TreeItemDescriptor {\n return {\n id: row.node.id,\n parentId: row.parentId,\n level: row.level,\n expandable: row.node.kind === 'directory',\n expanded: row.expanded,\n }\n}\n\nfunction RowContent(props: { row: FileTreeRow }) {\n const node = () => props.row.node\n return (\n <>\n <span\n class={cn('truncate', {\n 'text-muted-foreground line-through': node().change === 'deleted',\n })}\n title={node().id}\n >\n {node().name}\n </span>\n <Show when={node().renamedFrom}>\n <span class=\"sr-only\">, renamed from {node().renamedFrom}</span>\n </Show>\n </>\n )\n}\n\nfunction RowTrailing(props: { row: FileTreeRow }) {\n const node = () => props.row.node\n return (\n <>\n <Show when={node().kind === 'file' && (node().additions || node().deletions)}>\n <span class=\"font-code text-2xs tabular-nums\">\n <Show when={node().additions !== undefined}>\n <span class=\"text-foreground\">+{node().additions}</span>\n </Show>{' '}\n <Show when={node().deletions !== undefined}>\n <span class=\"text-foreground\">−{node().deletions}</span>\n </Show>\n </span>\n </Show>\n <Show when={node().kind === 'directory' && !props.row.expanded}>\n <span class=\"text-2xs tabular-nums\">\n {node().fileCount.toLocaleString()} {node().fileCount === 1 ? 'file' : 'files'}\n </span>\n </Show>\n {/* The word is the signal; the tint only helps a sighted reader find it. */}\n <Show when={node().change}>\n {(change) => (\n <Badge variant={CHANGE_VARIANT[change()]} size=\"sm\">\n {FILE_CHANGE_LABELS[change()]}\n </Badge>\n )}\n </Show>\n </>\n )\n}\n\nexport function FileTree(props: FileTreeProps) {\n const local = props\n const rest = omit(\n props,\n 'files',\n 'label',\n 'defaultExpanded',\n 'compact',\n 'selected',\n 'onSelect',\n 'maxHeight',\n 'maxRows',\n 'showSummary',\n 'class'\n )\n\n const build = createMemo(() => buildFileTree(local.files, { compact: local.compact }))\n const nodes = createMemo(() => indexFileTree(build().roots))\n const counts = createMemo(() => countChanges(build().roots))\n\n // Folders the tree has already decided about. A change set that grows while\n // the agent works opens its new folders by the same rule as the first render,\n // and never reopens one the reader closed.\n // A writable derivation: a new tree re-derives from the previous set (the\n // reader's toggles included), and a toggle writes it directly.\n let seen = new Set<string>()\n const [expanded, setExpanded] = createSignal<ReadonlySet<string>>((previous) => {\n const { roots, fileCount } = build()\n const wanted = initialExpanded(roots, local.defaultExpanded, fileCount)\n const folders = new Set<string>()\n for (const [id, node] of nodes()) if (node.kind === 'directory') folders.add(id)\n const next = new Set([...(previous ?? [])].filter((id) => folders.has(id)))\n for (const id of wanted) if (!seen.has(id)) next.add(id)\n seen = folders\n return next\n })\n\n const rows = createMemo(() => flattenFileTree(build().roots, expanded()))\n const pageSize = () => Math.max(1, Math.floor(local.maxRows ?? FILE_TREE_MAX_ROWS))\n const [requested, setRequested] = createSignal<RowWindow>({ start: 0, end: 0 })\n const mountedWindow = createMemo(() =>\n clampWindow(\n requested().end === 0 ? { start: 0, end: pageSize() } : requested(),\n rows().length,\n pageSize()\n )\n )\n const items = createMemo(() => rows().map(descriptor))\n // Flattening returns a fresh row object for every row on each expand or collapse;\n // only a row whose own fields changed should update, not all of them.\n const mounted = keyedRows(\n () => rows().slice(mountedWindow().start, mountedWindow().end),\n (row) => row.node.id,\n sameRow\n )\n const rowsBefore = () => mountedWindow().start\n const rowsAfter = () => Math.max(0, rows().length - mountedWindow().end)\n\n const [activeId, setActiveId] = createSignal<string | null>(null)\n const selectable = () => local.onSelect !== undefined\n // Keyed by row id, so a new selection notifies only the row leaving it and the\n // row entering it, not every mounted row.\n const selectedRows = createProjection<Record<string, true>>((draft) => {\n const id = local.selected\n for (const key of Object.keys(draft)) if (key !== id) delete draft[key]\n if (id !== undefined) draft[id] = true\n }, {})\n const isSelected = (id: string) => selectedRows[id] === true\n\n const toggle = (id: string, open: boolean) => {\n setExpanded((current) => {\n const next = new Set(current)\n if (open) next.add(id)\n else next.delete(id)\n return next\n })\n }\n\n /** Mount the rows around one the keyboard is moving to, so focus can land on it. */\n const reveal = (id: string) => {\n const index = rows().findIndex((row) => row.node.id === id)\n setRequested(revealInWindow(mountedWindow(), index, rows().length, pageSize()))\n }\n\n const select = (id: string) => {\n const node = nodes().get(id)\n if (node) local.onSelect?.(id, node)\n }\n const activate = (id: string) => {\n const node = nodes().get(id)\n if (!node) return\n if (node.kind === 'directory') toggle(id, !expanded().has(id))\n else select(id)\n }\n\n const maxHeight = () =>\n typeof local.maxHeight === 'number' ? `${local.maxHeight}px` : (local.maxHeight ?? '20rem')\n\n return (\n <div data-slot=\"file-tree\" class={cn('flex min-w-0 flex-col gap-1', local.class)} {...rest}>\n <Show when={local.showSummary !== false}>\n <p data-slot=\"file-tree-summary\" class=\"m-0 text-xs text-muted-foreground\">\n {describeChanges(counts())}\n <Show when={build().rejected.length > 0}>\n {' '}\n · {build().rejected.length.toLocaleString()}{' '}\n {build().rejected.length === 1 ? 'path' : 'paths'} ignored as not valid\n </Show>\n </p>\n </Show>\n <Show when={rows().length === 0 && local.showSummary === false}>\n <p class=\"m-0 text-xs text-muted-foreground\">No changed files</p>\n </Show>\n <Show when={rows().length > 0}>\n <Show when={rowsBefore() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n <div class=\"scroll-fade overflow-auto rounded-md\" style={{ 'max-height': maxHeight() }}>\n <Tree\n aria-label={local.label ?? 'Changed files'}\n visibleItems={items()}\n activeId={activeId()}\n onActiveIdChange={setActiveId}\n onExpand={toggle}\n onActivate={(id) => activate(id)}\n onSelectItem={(id) => select(id)}\n onRequestReveal={reveal}\n selectionMode={selectable() ? 'single' : undefined}\n typeaheadLabel={(id) => nodes().get(id)?.name ?? ''}\n >\n <For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? isSelected(entry.item().node.id) : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>\n </Tree>\n </div>\n <Show when={rowsAfter() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAM,OAAO,SAAS6C,MAAU;AAChC,IAAM,SAAS,SAASC,QAAY;AACpC,IAAM,aAAa,SAASC,YAAgB;AAwE5C,IAAa,qBAAqB;AAElC,IAAM,iBAEF;CACF,OAAO;CACP,UAAU;CACV,SAAS;CACT,SAAS;AACX;AAEA,SAAS,QAAQ,UAAuB,MAAmB;CACzD,OACE,SAAS,SAAS,KAAK,QACvB,SAAS,aAAa,KAAK,YAC3B,SAAS,UAAU,KAAK,SACxB,SAAS,aAAa,KAAK;AAE/B;AAEA,SAA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;SACOC,WAAAA;UAAK,OAAA,KAAA,IAAI,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,eAAe;;SAAE;SACxDC,WAAAA;UAAU,OAAA,UAAA,CAAC,CAAC,eAAe;;SAAE;QAD1B;OAEE;MACL,CAAA,CAAA;MAfP,OACEC;KAeI;;GAtEP,IADD,KAAA;EAwEM;CAAC,EAAA,CAAD,GAtFRhC,MAuFK;CAxFP,OACEA;AAyFJ"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { className, createComponent, effect, insert, memo, readShallow, template } from "@solidjs/web";
|
|
2
|
+
import { For } from "solid-js";
|
|
3
|
+
import { ExternalLink as ExternalLink$1 } from "@lucide/solid";
|
|
1
4
|
import { createExternalLinkOpener } from "../../../lib/external-link.js";
|
|
2
5
|
import { cn } from "../../../lib/utils.js";
|
|
3
6
|
import { ActionButton } from "../action-button/action-button.js";
|
|
@@ -6,9 +9,6 @@ import { Card, CardContent, CardHeader } from "../../ui/card/card.js";
|
|
|
6
9
|
import { Kbd, KbdGroup } from "../../ui/kbd/kbd.js";
|
|
7
10
|
import { Heading } from "../../ui/typography/typography.js";
|
|
8
11
|
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
9
|
-
import { className, createComponent, effect, insert, memo, readShallow, template } from "@solidjs/web";
|
|
10
|
-
import { ExternalLink } from "@lucide/solid";
|
|
11
|
-
import { For } from "solid-js";
|
|
12
12
|
// src/components/composites/help-center/help-center.tsx
|
|
13
13
|
var _tmpl$ = /* @__PURE__ */ template(`<h2 class="text-base font-semibold text-foreground">Keyboard shortcuts`);
|
|
14
14
|
var _tmpl$2 = /* @__PURE__ */ template(`<ul class="flex flex-col gap-3">`);
|
|
@@ -19,7 +19,7 @@ var _tmpl$6 = /* @__PURE__ */ template(`<div class="flex flex-col gap-2"><p clas
|
|
|
19
19
|
var _tmpl$7 = /* @__PURE__ */ template(`<li class="flex flex-wrap items-center justify-between gap-2"><span class=text-sm>`);
|
|
20
20
|
var _tmpl$8 = /* @__PURE__ */ template(`<li class="flex min-w-0 flex-col items-start gap-1"><!><!>`);
|
|
21
21
|
var _tmpl$9 = /* @__PURE__ */ template(`<p class="text-sm text-muted-foreground">`);
|
|
22
|
-
var ExternalLink
|
|
22
|
+
var ExternalLink = fastIcon(ExternalLink$1);
|
|
23
23
|
/** A shared help page: real keyboard shortcuts and the application's project resources. */
|
|
24
24
|
function HelpCenter(props) {
|
|
25
25
|
const links = createExternalLinkOpener({
|
|
@@ -112,7 +112,7 @@ function HelpCenter(props) {
|
|
|
112
112
|
get children() {
|
|
113
113
|
return [memo(() => {
|
|
114
114
|
return link.label;
|
|
115
|
-
}), createComponent(ExternalLink
|
|
115
|
+
}), createComponent(ExternalLink, { "aria-hidden": "true" })];
|
|
116
116
|
}
|
|
117
117
|
}), _el$18);
|
|
118
118
|
insert(_el$17, (() => {
|