@adea-ai/ui 0.152.3 → 0.153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +469 -580
- package/dist/components/composites/account-menu/account-menu.d.ts +5 -0
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +37 -13
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.d.ts +2 -1
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +92 -66
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +57 -57
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +9 -9
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.d.ts +7 -7
- package/dist/components/composites/appearance-editor/theme-preview.d.ts +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +6 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +36 -36
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +4 -4
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.d.ts.map +1 -1
- package/dist/components/composites/chat/chat.js +33 -37
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts +3 -3
- package/dist/components/composites/checkpoint/checkpoint-model.js +2 -2
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.d.ts +2 -2
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.d.ts +2 -2
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.d.ts +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +7 -3
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -3
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/citation.d.ts +1 -1
- package/dist/components/composites/inline-citation/citation.js +1 -1
- package/dist/components/composites/inline-citation/citation.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts +2 -2
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +22 -22
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.d.ts +5 -0
- package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row.js +75 -83
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.d.ts +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts +4 -4
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/model-selector/models.d.ts +2 -2
- package/dist/components/composites/model-selector/models.js +1 -1
- package/dist/components/composites/model-selector/models.js.map +1 -1
- package/dist/components/composites/plan/plan.d.ts.map +1 -1
- package/dist/components/composites/plan/plan.js +17 -15
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.d.ts.map +1 -1
- package/dist/components/composites/queue/queue.js +5 -7
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.d.ts +4 -4
- package/dist/components/composites/reasoning/reasoning.js +4 -4
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +63 -14
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +32 -32
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/source.d.ts +1 -1
- package/dist/components/composites/sources/source.js.map +1 -1
- package/dist/components/composites/sources/sources.d.ts +2 -2
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/parse-stack-trace.js +4 -4
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.d.ts.map +1 -1
- package/dist/components/composites/stat/stat.js +14 -16
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
- package/dist/components/composites/subagent/subagent.js +6 -4
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/task/task.d.ts +1 -1
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.d.ts +3 -3
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal-model.d.ts +3 -3
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal-model.js +1 -1
- package/dist/components/composites/terminal/terminal-model.js.map +1 -1
- package/dist/components/composites/terminal/terminal.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal.js +24 -11
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results-model.d.ts +4 -4
- package/dist/components/composites/test-results/test-results-model.js +2 -2
- package/dist/components/composites/test-results/test-results-model.js.map +1 -1
- package/dist/components/composites/test-results/test-results.d.ts +1 -1
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.d.ts +4 -4
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.d.ts +1 -1
- package/dist/components/composites/tree/tree.d.ts.map +1 -1
- package/dist/components/composites/tree/tree.js +25 -18
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.d.ts +10 -4
- package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +14 -19
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/index.d.ts +1 -1
- package/dist/components/composites/update-dialog/index.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +4 -5
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.d.ts.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +19 -20
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
- package/dist/components/conversation/busy-send-button.js +18 -20
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/composer-menu.d.ts +3 -3
- package/dist/components/conversation/composer-menu.js +3 -3
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +2 -4
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
- package/dist/components/conversation/conversation-pane.js +6 -5
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +3 -7
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +76 -76
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +32 -38
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.d.ts.map +1 -1
- package/dist/components/conversation/message-row.js +79 -73
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +7 -7
- package/dist/components/conversation/scroll-follow-core.js +4 -4
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +19 -4
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/conversation/thread-panel.d.ts.map +1 -1
- package/dist/components/conversation/thread-panel.js +23 -23
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.d.ts.map +1 -1
- package/dist/components/conversation/transcript-composition.js +2 -2
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.d.ts +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +4 -6
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/page/page.d.ts.map +1 -1
- package/dist/components/layout/page/page.js +17 -17
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +2 -4
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.d.ts.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +16 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts +1 -1
- package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +35 -34
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +23 -23
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +2 -2
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.d.ts +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +7 -7
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/motion/presence.d.ts +2 -2
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts +5 -5
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.d.ts +1 -1
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/theme-catalogue-source.d.ts +2 -2
- package/dist/components/theme/theme-catalogue-source.js +2 -2
- package/dist/components/theme/theme-catalogue-source.js.map +1 -1
- package/dist/components/theme/theme-context.d.ts +2 -2
- package/dist/components/theme/theme-context.js +3 -3
- package/dist/components/theme/theme-context.js.map +1 -1
- package/dist/components/theme/theme-document.d.ts.map +1 -1
- package/dist/components/theme/theme-document.js +14 -9
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-picker.d.ts +5 -5
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.d.ts +0 -6
- package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
- package/dist/components/theme/theme-provider-value.js +9 -3
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-script.d.ts +14 -0
- package/dist/components/theme/theme-script.d.ts.map +1 -1
- package/dist/components/theme/theme-script.js +1 -0
- package/dist/components/theme/theme-script.js.map +1 -1
- package/dist/components/theme/theme-state.d.ts +7 -7
- package/dist/components/theme/theme-state.js.map +1 -1
- package/dist/components/theme/theme-toggle.d.ts +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/alert/alert.d.ts.map +1 -1
- package/dist/components/ui/alert/alert.js +4 -3
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +3 -3
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.d.ts.map +1 -1
- package/dist/components/ui/board/board.js +10 -6
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/bubble/bubble.d.ts.map +1 -1
- package/dist/components/ui/bubble/bubble.js +6 -4
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/button-group/button-group.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.js +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +6 -6
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.d.ts +4 -4
- package/dist/components/ui/callout/callout.js +4 -4
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.d.ts +2 -2
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.d.ts +4 -4
- package/dist/components/ui/carousel/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart-options.d.ts +7 -7
- package/dist/components/ui/chart/chart-options.js +9 -9
- package/dist/components/ui/chart/chart-options.js.map +1 -1
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js +16 -7
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +8 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +8 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/command/command.d.ts +4 -4
- package/dist/components/ui/command/command.js +4 -4
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.js +13 -13
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.d.ts +0 -4
- package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +17 -1
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +4 -3
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.d.ts +6 -6
- package/dist/components/ui/diff-block/diff-block.js +3 -3
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts +3 -3
- package/dist/components/ui/drawer/drawer.js +2 -2
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +5 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -1
- package/dist/components/ui/empty/empty-state.js +33 -36
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.d.ts +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +7 -7
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +15 -15
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.d.ts +1 -1
- package/dist/components/ui/field/number-field.js +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.d.ts +1 -1
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input-group/input-group.d.ts +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.d.ts +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.d.ts.map +1 -1
- package/dist/components/ui/item/item.js +26 -26
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.d.ts +2 -2
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/kbd/platform-modifier.d.ts +3 -3
- package/dist/components/ui/kbd/platform-modifier.js +3 -3
- package/dist/components/ui/kbd/platform-modifier.js.map +1 -1
- package/dist/components/ui/label/label.d.ts +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.d.ts.map +1 -1
- package/dist/components/ui/marker/marker.js +17 -19
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts +2 -2
- package/dist/components/ui/menubar/menubar.js +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js +16 -18
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +7 -11
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.d.ts +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +5 -4
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +2 -4
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.d.ts.map +1 -1
- package/dist/components/ui/popover/popover.js +11 -4
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/progress/progress.js +6 -8
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +73 -73
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +12 -6
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts +2 -2
- package/dist/components/ui/resizable/resizable.js +3 -3
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/select/select.d.ts +3 -3
- package/dist/components/ui/select/select.js +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +4 -3
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.d.ts +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.d.ts +1 -1
- package/dist/components/ui/spinner/spinner.js +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.d.ts +13 -13
- package/dist/components/ui/status-chip/status-chip.d.ts.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +11 -11
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +8 -6
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.d.ts +4 -4
- package/dist/components/ui/tabs/tabs.js +4 -4
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/textarea/textarea.d.ts +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.d.ts.map +1 -1
- package/dist/components/ui/toast/toast.js +13 -15
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.js +1 -1
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts +51 -0
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js +103 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +1 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -1
- package/dist/components/ui/tooltip/index.js +3 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +6 -5
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.d.ts.map +1 -1
- package/dist/components/ui/trace/trace.js +17 -17
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.d.ts +3 -3
- package/dist/components/ui/typography/typography.js +5 -5
- package/dist/components/ui/typography/typography.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/lib/accent-presets.d.ts +1 -1
- package/dist/lib/accent-presets.js.map +1 -1
- package/dist/lib/accent-roles.d.ts +2 -2
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/accent-roles.js.map +1 -1
- package/dist/lib/appearance-font-settings.d.ts.map +1 -1
- package/dist/lib/appearance-font-settings.js +15 -7
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/create-poll.d.ts +39 -0
- package/dist/lib/create-poll.d.ts.map +1 -0
- package/dist/lib/create-poll.js +116 -0
- package/dist/lib/create-poll.js.map +1 -0
- package/dist/lib/font-zoom.d.ts +1 -1
- package/dist/lib/font-zoom.js +1 -1
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/keyed-rows.d.ts +2 -1
- package/dist/lib/keyed-rows.d.ts.map +1 -1
- package/dist/lib/keyed-rows.js +3 -2
- package/dist/lib/keyed-rows.js.map +1 -1
- package/dist/lib/overlay.d.ts +5 -5
- package/dist/lib/overlay.js +5 -5
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/preference-store.d.ts +2 -2
- package/dist/lib/preference-store.js +2 -2
- package/dist/lib/preference-store.js.map +1 -1
- package/dist/lib/safe-script.d.ts +2 -2
- package/dist/lib/safe-script.js +2 -2
- package/dist/lib/safe-script.js.map +1 -1
- package/dist/lib/scroll-geometry.d.ts +1 -1
- package/dist/lib/scroll-geometry.js +1 -1
- package/dist/lib/scroll-geometry.js.map +1 -1
- package/dist/lib/text.d.ts +1 -1
- package/dist/lib/text.js +1 -1
- package/dist/lib/text.js.map +1 -1
- package/dist/lib/theme-accents.js +3 -3
- package/dist/lib/theme-accents.js.map +1 -1
- package/dist/lib/theme-css.js.map +1 -1
- package/dist/lib/theme-defaults.d.ts +4 -4
- package/dist/lib/theme-defaults.js +4 -4
- package/dist/lib/theme-defaults.js.map +1 -1
- package/dist/lib/theme-engine-light.js.map +1 -1
- package/dist/lib/theme-engine.d.ts +2 -2
- package/dist/lib/theme-engine.js +2 -2
- package/dist/lib/theme-engine.js.map +1 -1
- package/dist/lib/theme-projection.d.ts +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-projection.js.map +1 -1
- package/dist/lib/theme-records.d.ts +2 -2
- package/dist/lib/theme-records.js +2 -2
- package/dist/lib/theme-records.js.map +1 -1
- package/dist/lib/theme-types.d.ts +1 -1
- package/dist/lib/theme-types.js.map +1 -1
- package/dist/lib/themes.d.ts +13 -13
- package/dist/lib/themes.js +13 -13
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts +2 -2
- package/dist/lib/tokens.js +1 -1
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.d.ts +2 -2
- package/dist/lib/tooltip-focus-gate.js +2 -2
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/variants.d.ts +4 -4
- package/dist/lib/variants.js +1 -1
- package/dist/lib/variants.js.map +1 -1
- package/dist/lib/version-notes.d.ts +4 -4
- package/dist/lib/version-notes.js +4 -4
- package/dist/lib/version-notes.js.map +1 -1
- package/dist/lint.js.map +1 -1
- package/dist/r/account-menu.json +1 -0
- package/dist/r/lib.json +5 -0
- package/dist/r/registry.json +11 -0
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/dist/r/src/components/composites/action-button/action-button.tsx +124 -78
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/dist/r/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/dist/r/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/dist/r/src/components/composites/chat/chat.tsx +15 -9
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/dist/r/src/components/composites/context/context.tsx +2 -2
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/dist/r/src/components/composites/inline-citation/citation.ts +1 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/dist/r/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/dist/r/src/components/composites/list-row/list-row.tsx +69 -73
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -4
- package/dist/r/src/components/composites/model-selector/models.ts +2 -2
- package/dist/r/src/components/composites/plan/plan.tsx +19 -11
- package/dist/r/src/components/composites/queue/queue.tsx +5 -3
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/dist/r/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/dist/r/src/components/composites/settings/settings.tsx +14 -6
- package/dist/r/src/components/composites/sources/source.ts +1 -1
- package/dist/r/src/components/composites/sources/sources.tsx +2 -2
- package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/dist/r/src/components/composites/stat/stat.tsx +20 -16
- package/dist/r/src/components/composites/subagent/subagent.tsx +6 -4
- package/dist/r/src/components/composites/task/task.tsx +1 -1
- package/dist/r/src/components/composites/terminal/ansi.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal-model.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal.tsx +24 -12
- package/dist/r/src/components/composites/test-results/test-results-model.ts +4 -4
- package/dist/r/src/components/composites/test-results/test-results.tsx +1 -1
- package/dist/r/src/components/composites/tool/tool.tsx +4 -4
- package/dist/r/src/components/composites/tree/tree.tsx +31 -15
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/dist/r/src/components/composites/update-dialog/index.ts +1 -0
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/dist/r/src/components/conversation/busy-send-button.tsx +6 -2
- package/dist/r/src/components/conversation/composer-menu.tsx +3 -3
- package/dist/r/src/components/conversation/conversation-avatar.tsx +1 -1
- package/dist/r/src/components/conversation/conversation-pane.tsx +8 -5
- package/dist/r/src/components/conversation/conversation-surface.tsx +2 -2
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/dist/r/src/components/conversation/message-composer.tsx +4 -6
- package/dist/r/src/components/conversation/message-row.tsx +34 -26
- package/dist/r/src/components/conversation/scroll-follow-core.ts +8 -8
- package/dist/r/src/components/conversation/scroll-follow.ts +24 -8
- package/dist/r/src/components/conversation/thread-panel.tsx +7 -3
- package/dist/r/src/components/conversation/transcript-composition.tsx +4 -2
- package/dist/r/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/dist/r/src/components/layout/page/page.tsx +15 -11
- package/dist/r/src/components/layout/panel/panel.tsx +1 -1
- package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +38 -22
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/dist/r/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +8 -6
- package/dist/r/src/components/motion/presence.tsx +2 -2
- package/dist/r/src/components/theme/appearance-panel.tsx +5 -5
- package/dist/r/src/components/theme/lazy.ts +1 -1
- package/dist/r/src/components/theme/theme-catalogue-source.ts +2 -2
- package/dist/r/src/components/theme/theme-context.ts +3 -3
- package/dist/r/src/components/theme/theme-document.ts +22 -11
- package/dist/r/src/components/theme/theme-picker.tsx +5 -5
- package/dist/r/src/components/theme/theme-provider-value.ts +15 -3
- package/dist/r/src/components/theme/theme-script.ts +20 -0
- package/dist/r/src/components/theme/theme-state.ts +7 -7
- package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
- package/dist/r/src/components/ui/alert/alert.tsx +4 -3
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/dist/r/src/components/ui/badge/badge.tsx +2 -2
- package/dist/r/src/components/ui/board/board.tsx +17 -5
- package/dist/r/src/components/ui/bubble/bubble.tsx +6 -4
- package/dist/r/src/components/ui/button/button.tsx +2 -2
- package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
- package/dist/r/src/components/ui/calendar/calendar.tsx +2 -2
- package/dist/r/src/components/ui/callout/callout.tsx +4 -4
- package/dist/r/src/components/ui/card/card.tsx +2 -2
- package/dist/r/src/components/ui/carousel/carousel.tsx +6 -6
- package/dist/r/src/components/ui/chart/chart-options.ts +9 -9
- package/dist/r/src/components/ui/chart/chart.tsx +14 -1
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/dist/r/src/components/ui/code-block/code-block.tsx +14 -7
- package/dist/r/src/components/ui/command/command.tsx +7 -7
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/dist/r/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/dist/r/src/components/ui/dialog/dialog-layer.tsx +27 -1
- package/dist/r/src/components/ui/dialog/dialog.tsx +4 -3
- package/dist/r/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/dist/r/src/components/ui/drawer/drawer.tsx +3 -3
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/dist/r/src/components/ui/empty/empty-state.tsx +23 -18
- package/dist/r/src/components/ui/empty/empty.tsx +1 -1
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/dist/r/src/components/ui/field/field.tsx +15 -7
- package/dist/r/src/components/ui/field/number-field.tsx +1 -1
- package/dist/r/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/dist/r/src/components/ui/input-group/input-group.tsx +1 -1
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/dist/r/src/components/ui/item/item.tsx +24 -18
- package/dist/r/src/components/ui/kbd/kbd.tsx +2 -2
- package/dist/r/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/dist/r/src/components/ui/label/label.tsx +1 -1
- package/dist/r/src/components/ui/marker/marker.tsx +9 -5
- package/dist/r/src/components/ui/menubar/menubar.tsx +2 -2
- package/dist/r/src/components/ui/message/message.tsx +14 -13
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/dist/r/src/components/ui/native-select/native-select.tsx +1 -1
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/dist/r/src/components/ui/pagination/pagination.tsx +1 -1
- package/dist/r/src/components/ui/popover/popover.tsx +4 -2
- package/dist/r/src/components/ui/progress/progress.tsx +5 -3
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/dist/r/src/components/ui/resizable/resizable.tsx +5 -5
- package/dist/r/src/components/ui/select/select.tsx +4 -4
- package/dist/r/src/components/ui/sheet/sheet.tsx +4 -3
- package/dist/r/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/dist/r/src/components/ui/slider/slider.tsx +1 -1
- package/dist/r/src/components/ui/spinner/spinner.tsx +1 -1
- package/dist/r/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/dist/r/src/components/ui/switch/switch.tsx +9 -6
- package/dist/r/src/components/ui/tabs/tabs.tsx +4 -4
- package/dist/r/src/components/ui/textarea/textarea.tsx +1 -1
- package/dist/r/src/components/ui/toast/toast.tsx +6 -4
- package/dist/r/src/components/ui/toggle/toggle.tsx +1 -1
- package/dist/r/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/dist/r/src/components/ui/tooltip/index.ts +1 -0
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/dist/r/src/components/ui/trace/trace.tsx +13 -9
- package/dist/r/src/components/ui/typography/typography.tsx +5 -5
- package/dist/r/src/lib/accent-presets.ts +1 -1
- package/dist/r/src/lib/accent-roles.ts +2 -2
- package/dist/r/src/lib/appearance-font-settings.ts +18 -7
- package/dist/r/src/lib/create-poll.ts +150 -0
- package/dist/r/src/lib/font-zoom.ts +3 -3
- package/dist/r/src/lib/keyed-rows.ts +3 -2
- package/dist/r/src/lib/overlay.ts +5 -5
- package/dist/r/src/lib/preference-store.ts +2 -2
- package/dist/r/src/lib/safe-script.ts +2 -2
- package/dist/r/src/lib/scroll-geometry.ts +1 -1
- package/dist/r/src/lib/text.ts +1 -1
- package/dist/r/src/lib/theme-accents.ts +3 -3
- package/dist/r/src/lib/theme-css.ts +2 -2
- package/dist/r/src/lib/theme-defaults.ts +4 -4
- package/dist/r/src/lib/theme-engine-light.ts +2 -2
- package/dist/r/src/lib/theme-engine.ts +2 -2
- package/dist/r/src/lib/theme-projection.ts +2 -2
- package/dist/r/src/lib/theme-records.ts +2 -2
- package/dist/r/src/lib/theme-types.ts +1 -1
- package/dist/r/src/lib/themes.ts +14 -14
- package/dist/r/src/lib/tokens.ts +2 -2
- package/dist/r/src/lib/tooltip-focus-gate.ts +11 -11
- package/dist/r/src/lib/utils.ts +1 -1
- package/dist/r/src/lib/variants.ts +4 -4
- package/dist/r/src/lib/version-notes.ts +4 -4
- package/dist/r/src/styles/base.css +12 -43
- package/dist/r/src/styles/fonts.css +1 -1
- package/dist/r/src/styles/theme.css +35 -35
- package/dist/r/tooltip.json +5 -0
- package/package.json +2 -1
- package/registry.json +11 -0
- package/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/src/components/composites/action-button/action-button.tsx +124 -78
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/src/components/composites/chat/chat.tsx +15 -9
- package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/src/components/composites/context/context.tsx +2 -2
- package/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/src/components/composites/inline-citation/citation.ts +1 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/src/components/composites/list-row/list-row.tsx +69 -73
- package/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/src/components/composites/model-selector/model-selector.tsx +4 -4
- package/src/components/composites/model-selector/models.ts +2 -2
- package/src/components/composites/plan/plan.tsx +19 -11
- package/src/components/composites/queue/queue.tsx +5 -3
- package/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/src/components/composites/settings/settings.tsx +14 -6
- package/src/components/composites/sources/source.ts +1 -1
- package/src/components/composites/sources/sources.tsx +2 -2
- package/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/src/components/composites/stat/stat.tsx +20 -16
- package/src/components/composites/subagent/subagent.tsx +6 -4
- package/src/components/composites/task/task.tsx +1 -1
- package/src/components/composites/terminal/ansi.ts +3 -3
- package/src/components/composites/terminal/terminal-model.ts +3 -3
- package/src/components/composites/terminal/terminal.tsx +24 -12
- package/src/components/composites/test-results/test-results-model.ts +4 -4
- package/src/components/composites/test-results/test-results.tsx +1 -1
- package/src/components/composites/tool/tool.tsx +4 -4
- package/src/components/composites/tree/tree.tsx +31 -15
- package/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/src/components/composites/update-dialog/index.ts +1 -0
- package/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/src/components/conversation/busy-send-button.tsx +6 -2
- package/src/components/conversation/composer-menu.tsx +3 -3
- package/src/components/conversation/conversation-avatar.tsx +1 -1
- package/src/components/conversation/conversation-pane.tsx +8 -5
- package/src/components/conversation/conversation-surface.tsx +2 -2
- package/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/src/components/conversation/message-composer.tsx +4 -6
- package/src/components/conversation/message-row.tsx +34 -26
- package/src/components/conversation/scroll-follow-core.ts +8 -8
- package/src/components/conversation/scroll-follow.ts +24 -8
- package/src/components/conversation/thread-panel.tsx +7 -3
- package/src/components/conversation/transcript-composition.tsx +4 -2
- package/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/src/components/layout/page/page.tsx +15 -11
- package/src/components/layout/panel/panel.tsx +1 -1
- package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/src/components/layout/side-rail/side-rail.tsx +38 -22
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/src/components/layout/top-bar/top-bar.tsx +8 -6
- package/src/components/motion/presence.tsx +2 -2
- package/src/components/theme/appearance-panel.tsx +5 -5
- package/src/components/theme/lazy.ts +1 -1
- package/src/components/theme/theme-catalogue-source.ts +2 -2
- package/src/components/theme/theme-context.ts +3 -3
- package/src/components/theme/theme-document.ts +22 -11
- package/src/components/theme/theme-picker.tsx +5 -5
- package/src/components/theme/theme-provider-value.ts +15 -3
- package/src/components/theme/theme-script.ts +20 -0
- package/src/components/theme/theme-state.ts +7 -7
- package/src/components/theme/theme-toggle.tsx +1 -1
- package/src/components/ui/alert/alert.tsx +4 -3
- package/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/src/components/ui/badge/badge.tsx +2 -2
- package/src/components/ui/board/board.tsx +17 -5
- package/src/components/ui/bubble/bubble.tsx +6 -4
- package/src/components/ui/button/button.tsx +2 -2
- package/src/components/ui/button-group/button-group.tsx +1 -1
- package/src/components/ui/calendar/calendar.tsx +2 -2
- package/src/components/ui/callout/callout.tsx +4 -4
- package/src/components/ui/card/card.tsx +2 -2
- package/src/components/ui/carousel/carousel.tsx +6 -6
- package/src/components/ui/chart/chart-options.ts +9 -9
- package/src/components/ui/chart/chart.tsx +14 -1
- package/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/src/components/ui/code-block/code-block.tsx +14 -7
- package/src/components/ui/command/command.tsx +7 -7
- package/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/src/components/ui/dialog/dialog-layer.tsx +27 -1
- package/src/components/ui/dialog/dialog.tsx +4 -3
- package/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/src/components/ui/drawer/drawer.tsx +3 -3
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/src/components/ui/empty/empty-state.tsx +23 -18
- package/src/components/ui/empty/empty.tsx +1 -1
- package/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/src/components/ui/field/field.tsx +15 -7
- package/src/components/ui/field/number-field.tsx +1 -1
- package/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/src/components/ui/input-group/input-group.tsx +1 -1
- package/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/src/components/ui/item/item.tsx +24 -18
- package/src/components/ui/kbd/kbd.tsx +2 -2
- package/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/src/components/ui/label/label.tsx +1 -1
- package/src/components/ui/marker/marker.tsx +9 -5
- package/src/components/ui/menubar/menubar.tsx +2 -2
- package/src/components/ui/message/message.tsx +14 -13
- package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/src/components/ui/native-select/native-select.tsx +1 -1
- package/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/src/components/ui/pagination/pagination.tsx +1 -1
- package/src/components/ui/popover/popover.tsx +4 -2
- package/src/components/ui/progress/progress.tsx +5 -3
- package/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/src/components/ui/resizable/resizable.tsx +5 -5
- package/src/components/ui/select/select.tsx +4 -4
- package/src/components/ui/sheet/sheet.tsx +4 -3
- package/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/src/components/ui/slider/slider.tsx +1 -1
- package/src/components/ui/spinner/spinner.tsx +1 -1
- package/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/src/components/ui/switch/switch.tsx +9 -6
- package/src/components/ui/tabs/tabs.tsx +4 -4
- package/src/components/ui/textarea/textarea.tsx +1 -1
- package/src/components/ui/toast/toast.tsx +6 -4
- package/src/components/ui/toggle/toggle.tsx +1 -1
- package/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/src/components/ui/tooltip/index.ts +1 -0
- package/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/src/components/ui/trace/trace.tsx +13 -9
- package/src/components/ui/typography/typography.tsx +5 -5
- package/src/index.ts +1 -0
- package/src/lib/accent-presets.ts +1 -1
- package/src/lib/accent-roles.ts +2 -2
- package/src/lib/appearance-font-settings.ts +18 -7
- package/src/lib/create-poll.ts +150 -0
- package/src/lib/font-zoom.ts +3 -3
- package/src/lib/keyed-rows.ts +3 -2
- package/src/lib/overlay.ts +5 -5
- package/src/lib/preference-store.ts +2 -2
- package/src/lib/safe-script.ts +2 -2
- package/src/lib/scroll-geometry.ts +1 -1
- package/src/lib/text.ts +1 -1
- package/src/lib/theme-accents.ts +3 -3
- package/src/lib/theme-css.ts +2 -2
- package/src/lib/theme-defaults.ts +4 -4
- package/src/lib/theme-engine-light.ts +2 -2
- package/src/lib/theme-engine.ts +2 -2
- package/src/lib/theme-projection.ts +2 -2
- package/src/lib/theme-records.ts +2 -2
- package/src/lib/theme-types.ts +1 -1
- package/src/lib/themes.ts +14 -14
- package/src/lib/tokens.ts +2 -2
- package/src/lib/tooltip-focus-gate.ts +11 -11
- package/src/lib/utils.ts +1 -1
- package/src/lib/variants.ts +4 -4
- package/src/lib/version-notes.ts +4 -4
- package/src/lint/index.ts +1 -1
- package/src/styles/base.css +12 -43
- package/src/styles/fonts.css +1 -1
- package/src/styles/theme.css +35 -35
- package/src/styles/themes/aardvark-blue.css +98 -0
- package/src/styles/themes/aardvark-ink.css +98 -0
- package/src/styles/themes/adea-dark-colorblind.css +98 -0
- package/src/styles/themes/adea-dark-high-contrast.css +98 -0
- package/src/styles/themes/adea-dark.css +47 -0
- package/src/styles/themes/adea-light-colorblind.css +141 -0
- package/src/styles/themes/adea-light-high-contrast.css +141 -0
- package/src/styles/themes/adea-light.css +47 -0
- package/src/styles/themes/ayu-light.css +141 -0
- package/src/styles/themes/ayu-mirage.css +98 -0
- package/src/styles/themes/ayu.css +98 -0
- package/src/styles/themes/catppuccin-frappe.css +98 -0
- package/src/styles/themes/catppuccin-latte.css +141 -0
- package/src/styles/themes/catppuccin-macchiato.css +98 -0
- package/src/styles/themes/catppuccin-mocha.css +98 -0
- package/src/styles/themes/dracula.css +98 -0
- package/src/styles/themes/everforest-dark.css +98 -0
- package/src/styles/themes/everforest-light.css +141 -0
- package/src/styles/themes/gruvbox-dark.css +98 -0
- package/src/styles/themes/gruvbox-light.css +141 -0
- package/src/styles/themes/kanagawa.css +98 -0
- package/src/styles/themes/monokai.css +98 -0
- package/src/styles/themes/nord-light.css +141 -0
- package/src/styles/themes/nord.css +98 -0
- package/src/styles/themes/one-dark.css +98 -0
- package/src/styles/themes/rosepine-dawn.css +141 -0
- package/src/styles/themes/rosepine-moon.css +98 -0
- package/src/styles/themes/rosepine.css +98 -0
- package/src/styles/themes/solarized-dark.css +98 -0
- package/src/styles/themes/solarized-light.css +141 -0
- package/src/styles/themes/tokyonight-day.css +141 -0
- package/src/styles/themes/tokyonight-night.css +98 -0
- package/src/styles/themes/tokyonight-storm.css +98 -0
- package/src/styles/themes/vesper.css +98 -0
|
@@ -19,6 +19,8 @@ function anotherLayerOpen(content, opener) {
|
|
|
19
19
|
* The focus-return half of the layer rules, for a layer whose open state is
|
|
20
20
|
* `open`. Returns the autofocus handlers to give the Kobalte content.
|
|
21
21
|
*/
|
|
22
|
+
/** How long a closed layer may wait for its opener to become focusable again. */
|
|
23
|
+
var FOCUS_RESTORE_DEADLINE_MS = 1e3;
|
|
22
24
|
function createDialogFocusReturn(open, options) {
|
|
23
25
|
const focusCycles = /* @__PURE__ */ new WeakMap();
|
|
24
26
|
let activeFocusCycle;
|
|
@@ -57,7 +59,14 @@ function createDialogFocusReturn(open, options) {
|
|
|
57
59
|
finishFocusCycle(cycle);
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
|
-
if (
|
|
62
|
+
if (!cycle.openerEligible) {
|
|
63
|
+
finishFocusCycle(cycle);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (opener.closest("[inert], [aria-hidden=\"true\"]")) {
|
|
67
|
+
if (cycle.deadlinePassed) finishFocusCycle(cycle);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
61
70
|
if (cycle.openerEligible && canRestoreFocus(opener)) opener.focus({ preventScroll: true });
|
|
62
71
|
finishFocusCycle(cycle);
|
|
63
72
|
});
|
|
@@ -79,6 +88,7 @@ function createDialogFocusReturn(open, options) {
|
|
|
79
88
|
closed: false,
|
|
80
89
|
focusMovedOutside: false,
|
|
81
90
|
closeAutoFocusScheduled: false,
|
|
91
|
+
deadlinePassed: false,
|
|
82
92
|
onFocusIn: (focusEvent) => {
|
|
83
93
|
const target = focusEvent.target;
|
|
84
94
|
if (!(target instanceof HTMLElement) || target === document.body || target === document.documentElement) return;
|
|
@@ -119,6 +129,12 @@ function createDialogFocusReturn(open, options) {
|
|
|
119
129
|
subtree: true
|
|
120
130
|
});
|
|
121
131
|
scheduleFocusRestore(cycle);
|
|
132
|
+
cycle.fallbackTimer = window.setTimeout(() => {
|
|
133
|
+
cycle.fallbackTimer = void 0;
|
|
134
|
+
cycle.deadlinePassed = true;
|
|
135
|
+
cycle.observer?.disconnect();
|
|
136
|
+
if (cycle.frame === void 0) finishFocusCycle(cycle);
|
|
137
|
+
}, FOCUS_RESTORE_DEADLINE_MS);
|
|
122
138
|
};
|
|
123
139
|
onCleanup(() => {
|
|
124
140
|
const cycle = activeFocusCycle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-layer.js","names":["useDialogContext","createRenderEffect","onCleanup","TooltipEscapeTargetContext","event","restoreFocusRef","HTMLElement","onOpenAutoFocus","onCloseAutoFocus","content","opener","openerEligible","closed","focusMovedOutside","closeAutoFocusScheduled","frame","fallbackTimer","observer","MutationObserver","onFocusIn","openLayers","Set","isVisible","element","isConnected","getClientRects","length","canRestoreFocus","target","document","body","documentElement","closest","matches","anotherLayerOpen","layer","contains","createDialogFocusReturn","open","options","focusCycles","WeakMap","activeFocusCycle","pendingOpener","pendingOpenerEligible","active","activeElement","finishFocusCycle","cycle","undefined","window","cancelAnimationFrame","clearTimeout","disconnect","removeEventListener","delete","markClosed","scheduleFocusRestore","requestAnimationFrame","focusIsAvailable","Node","focus","preventScroll","currentTarget","openerWasCaptured","openerElement","focusEvent","set","add","addEventListener","get","defaultPrevented","observe","attributes","attributeFilter","childList","subtree","queueMicrotask","setTimeout","createDialogLayer","isOpen","DialogEscapeTarget","props","onEscapeKeyDown","children","dialog","dismiss","close","_$createComponent","Provider","value","contentRef"],"sources":["../../../../src/components/ui/dialog/dialog-layer.tsx"],"sourcesContent":["import { useDialogContext } from '@kobalte/core/dialog'\nimport type { Accessor, JSX } from 'solid-js'\nimport { createRenderEffect, onCleanup } from 'solid-js'\nimport { TooltipEscapeTargetContext } from '../tooltip/tooltip'\n\n/**\n * The rules the kit's dialog-shaped layers share, so a caller never wires them\n * by hand:\n *\n * 1. Focus returns to whatever had it before the layer opened. Kobalte only\n * returns focus to its own `Trigger`; a controlled layer opened from a menu\n * row, a shortcut or another layer would otherwise drop focus on `<body>`.\n * Dialog, AlertDialog, Sheet and the command palette.\n * 2. An Escape that a tooltip inside the layer swallowed still closes the layer\n * (see `TooltipEscapeTargetContext`). Dialog, AlertDialog and Sheet only;\n * the command palette does not provide it.\n *\n * Private to the overlay kit: content components apply it; callers pass\n * `restoreFocusRef` when the opener is gone by the time the layer opens.\n */\n\ntype AutoFocusHandler = (event: Event) => void\n\nexport type DialogLayerOptions = {\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n onOpenAutoFocus?: AutoFocusHandler\n onCloseAutoFocus?: AutoFocusHandler\n}\n\ntype FocusCycle = {\n content: HTMLElement\n opener: HTMLElement | null\n openerEligible: boolean\n closed: boolean\n focusMovedOutside: boolean\n closeAutoFocusScheduled: boolean\n frame?: number\n fallbackTimer?: number\n observer?: MutationObserver\n onFocusIn: (event: FocusEvent) => void\n}\n\n/** The kit's dialog layers that are open now, so a closing layer can tell a newer one took over. */\nconst openLayers = new Set<HTMLElement>()\n\nfunction isVisible(element: HTMLElement) {\n return element.isConnected && element.getClientRects().length > 0\n}\n\nfunction canRestoreFocus(target: HTMLElement): boolean {\n return (\n target !== document.body &&\n target !== document.documentElement &&\n !target.closest('[inert], [aria-hidden=\"true\"]') &&\n !target.matches(':disabled') &&\n isVisible(target)\n )\n}\n\nfunction anotherLayerOpen(content: HTMLElement, opener: HTMLElement): boolean {\n for (const layer of openLayers) {\n if (\n layer !== content &&\n !content.contains(layer) &&\n !layer.contains(opener) &&\n !layer.closest('[aria-hidden=\"true\"], [inert]') &&\n isVisible(layer)\n ) {\n return true\n }\n }\n return false\n}\n\n/**\n * The focus-return half of the layer rules, for a layer whose open state is\n * `open`. Returns the autofocus handlers to give the Kobalte content.\n */\nexport function createDialogFocusReturn(\n open: Accessor<boolean>,\n options: DialogLayerOptions\n): { onOpenAutoFocus: AutoFocusHandler; onCloseAutoFocus: AutoFocusHandler } {\n const focusCycles = new WeakMap<HTMLElement, FocusCycle>()\n let activeFocusCycle: FocusCycle | undefined\n let pendingOpener: HTMLElement | null = null\n let pendingOpenerEligible = false\n\n // Captured while the open state changes, before Kobalte's effects move focus\n // into the layer and before a closing menu takes its row out of the page.\n createRenderEffect(() => {\n if (!open() || typeof document === 'undefined') {\n pendingOpener = null\n pendingOpenerEligible = false\n return\n }\n const active = options.restoreFocusRef?.() ?? document.activeElement\n pendingOpener = active instanceof HTMLElement ? active : null\n pendingOpenerEligible = active instanceof HTMLElement && canRestoreFocus(active)\n })\n\n const finishFocusCycle = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) window.cancelAnimationFrame(cycle.frame)\n if (cycle.fallbackTimer !== undefined) window.clearTimeout(cycle.fallbackTimer)\n cycle.observer?.disconnect()\n document.removeEventListener('focusin', cycle.onFocusIn)\n openLayers.delete(cycle.content)\n if (activeFocusCycle === cycle) activeFocusCycle = undefined\n }\n\n const markClosed = (cycle: FocusCycle) => {\n cycle.closed = true\n openLayers.delete(cycle.content)\n }\n\n const scheduleFocusRestore = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) return\n cycle.frame = window.requestAnimationFrame(() => {\n cycle.frame = undefined\n const opener = cycle.opener\n const active = document.activeElement\n const focusIsAvailable =\n active === document.body ||\n active === document.documentElement ||\n active === cycle.content ||\n (active instanceof Node && cycle.content.contains(active))\n if (\n activeFocusCycle !== cycle ||\n !cycle.closed ||\n cycle.focusMovedOutside ||\n !opener ||\n !isVisible(opener) ||\n opener.matches(':disabled') ||\n !focusIsAvailable ||\n anotherLayerOpen(cycle.content, opener)\n ) {\n finishFocusCycle(cycle)\n return\n }\n\n // Kobalte removes the `inert` / `aria-hidden` it put on the background\n // only after the layer unmounts; the observer below brings us back here.\n if (opener.closest('[inert], [aria-hidden=\"true\"]')) return\n if (cycle.openerEligible && canRestoreFocus(opener)) {\n opener.focus({ preventScroll: true })\n }\n finishFocusCycle(cycle)\n })\n }\n\n const onOpenAutoFocus = (event: Event) => {\n const element = event.currentTarget\n if (element instanceof HTMLElement) {\n if (activeFocusCycle) finishFocusCycle(activeFocusCycle)\n\n const openerWasCaptured = pendingOpener !== null\n const opener = pendingOpener ?? document.activeElement\n const openerEligible = openerWasCaptured\n ? pendingOpenerEligible\n : opener instanceof HTMLElement && canRestoreFocus(opener)\n pendingOpener = null\n pendingOpenerEligible = false\n const openerElement = opener instanceof HTMLElement ? opener : null\n const cycle: FocusCycle = {\n content: element,\n opener: openerElement,\n openerEligible,\n closed: false,\n focusMovedOutside: false,\n closeAutoFocusScheduled: false,\n onFocusIn: (focusEvent) => {\n const target = focusEvent.target\n if (\n !(target instanceof HTMLElement) ||\n target === document.body ||\n target === document.documentElement\n ) {\n return\n }\n if (target === element || element.contains(target) || target === openerElement) {\n if (!cycle.closed) cycle.focusMovedOutside = false\n return\n }\n cycle.focusMovedOutside = true\n },\n }\n focusCycles.set(element, cycle)\n activeFocusCycle = cycle\n openLayers.add(element)\n document.addEventListener('focusin', cycle.onFocusIn)\n }\n options.onOpenAutoFocus?.(event)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n const element = event.currentTarget\n const cycle = element instanceof HTMLElement ? focusCycles.get(element) : undefined\n options.onCloseAutoFocus?.(event)\n\n if (!cycle) return\n markClosed(cycle)\n\n // A caller that prevents Kobalte's close autofocus owns the focus decision.\n if (event.defaultPrevented) {\n finishFocusCycle(cycle)\n return\n }\n\n if (cycle.fallbackTimer !== undefined) {\n window.clearTimeout(cycle.fallbackTimer)\n cycle.fallbackTimer = undefined\n }\n cycle.closeAutoFocusScheduled = true\n cycle.observer = new MutationObserver(() => scheduleFocusRestore(cycle))\n cycle.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'inert'],\n childList: true,\n subtree: true,\n })\n scheduleFocusRestore(cycle)\n }\n\n onCleanup(() => {\n const cycle = activeFocusCycle\n if (!cycle) return\n markClosed(cycle)\n\n // Kobalte dispatches the close autofocus from a timer after unmount. If the\n // content never dispatches it, release the focus listener after that timer.\n queueMicrotask(() => {\n if (cycle.closeAutoFocusScheduled) return\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n if (!cycle.closeAutoFocusScheduled) finishFocusCycle(cycle)\n }, 0)\n })\n })\n\n return { onOpenAutoFocus, onCloseAutoFocus }\n}\n\n/** The layer rules for a content rendered inside a Kobalte Dialog or AlertDialog root. */\nexport function createDialogLayer(options: DialogLayerOptions) {\n return createDialogFocusReturn(useDialogContext().isOpen, options)\n}\n\n/**\n * Lets an Escape swallowed by a tooltip inside the layer close the layer. The\n * content's own `onEscapeKeyDown` sees that Escape first, so a layer that\n * blocks Escape (a dirty form, a save in flight) stays blocked.\n */\nexport function DialogEscapeTarget(props: {\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n children?: JSX.Element\n}) {\n const dialog = useDialogContext()\n const dismiss = (event: KeyboardEvent) => {\n props.onEscapeKeyDown?.(event)\n if (!event.defaultPrevented) dialog.close()\n }\n return (\n <TooltipEscapeTargetContext.Provider value={{ element: dialog.contentRef, dismiss }}>\n {props.children}\n </TooltipEscapeTargetContext.Provider>\n )\n}\n"],"mappings":";;;;;;AA2CA,IAAMoB,6BAAa,IAAIC,IAAiB;AAExC,SAASC,UAAUC,SAAsB;CACvC,OAAOA,QAAQC,eAAeD,QAAQE,eAAe,CAAC,CAACC,SAAS;AAClE;AAEA,SAASC,gBAAgBC,QAA8B;CACrD,OACEA,WAAWC,SAASC,QACpBF,WAAWC,SAASE,mBACpB,CAACH,OAAOI,QAAQ,iCAA+B,KAC/C,CAACJ,OAAOK,QAAQ,WAAW,KAC3BX,UAAUM,MAAM;AAEpB;AAEA,SAASM,iBAAiBzB,SAAsBC,QAA8B;CAC5E,KAAK,MAAMyB,SAASf,YAClB,IACEe,UAAU1B,WACV,CAACA,QAAQ2B,SAASD,KAAK,KACvB,CAACA,MAAMC,SAAS1B,MAAM,KACtB,CAACyB,MAAMH,QAAQ,iCAA+B,KAC9CV,UAAUa,KAAK,GAEf,OAAO;CAGX,OAAO;AACT;;;;;AAMA,SAAgBE,wBACdC,MACAC,SAC2E;CAC3E,MAAMC,8BAAc,IAAIC,QAAiC;CACzD,IAAIC;CACJ,IAAIC,gBAAoC;CACxC,IAAIC,wBAAwB;CAI5B3C,yBAAyB;EACvB,IAAI,CAACqC,KAAK,KAAK,OAAOT,aAAa,aAAa;GAC9Cc,gBAAgB;GAChBC,wBAAwB;GACxB;EACF;EACA,MAAMC,SAASN,QAAQlC,kBAAkB,KAAKwB,SAASiB;EACvDH,gBAAgBE,kBAAkBvC,cAAc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|
|
1
|
+
{"version":3,"file":"dialog-layer.js","names":["useDialogContext","createRenderEffect","onCleanup","TooltipEscapeTargetContext","event","restoreFocusRef","HTMLElement","onOpenAutoFocus","onCloseAutoFocus","content","opener","openerEligible","closed","focusMovedOutside","closeAutoFocusScheduled","deadlinePassed","frame","fallbackTimer","observer","MutationObserver","onFocusIn","openLayers","Set","isVisible","element","isConnected","getClientRects","length","canRestoreFocus","target","document","body","documentElement","closest","matches","anotherLayerOpen","layer","contains","FOCUS_RESTORE_DEADLINE_MS","createDialogFocusReturn","open","options","focusCycles","WeakMap","activeFocusCycle","pendingOpener","pendingOpenerEligible","active","activeElement","finishFocusCycle","cycle","undefined","window","cancelAnimationFrame","clearTimeout","disconnect","removeEventListener","delete","markClosed","scheduleFocusRestore","requestAnimationFrame","focusIsAvailable","Node","focus","preventScroll","currentTarget","openerWasCaptured","openerElement","focusEvent","set","add","addEventListener","get","defaultPrevented","observe","attributes","attributeFilter","childList","subtree","setTimeout","queueMicrotask","createDialogLayer","isOpen","DialogEscapeTarget","props","onEscapeKeyDown","children","dialog","dismiss","close","_$createComponent","Provider","value","contentRef"],"sources":["../../../../src/components/ui/dialog/dialog-layer.tsx"],"sourcesContent":["import { useDialogContext } from '@kobalte/core/dialog'\nimport type { Accessor, JSX } from 'solid-js'\nimport { createRenderEffect, onCleanup } from 'solid-js'\nimport { TooltipEscapeTargetContext } from '../tooltip/tooltip'\n\n/**\n * The rules the kit's dialog-shaped layers share, so a caller never wires them\n * by hand:\n *\n * 1. Focus returns to whatever had it before the layer opened. Kobalte only\n * returns focus to its own `Trigger`; a controlled layer opened from a menu\n * row, a shortcut or another layer would otherwise drop focus on `<body>`.\n * Dialog, AlertDialog, Sheet and the command palette.\n * 2. An Escape that a tooltip inside the layer swallowed still closes the layer\n * (see `TooltipEscapeTargetContext`). Dialog, AlertDialog and Sheet only;\n * the command palette does not provide it.\n *\n * Private to the overlay kit: content components apply it; callers pass\n * `restoreFocusRef` when the opener is gone by the time the layer opens.\n */\n\ntype AutoFocusHandler = (event: Event) => void\n\nexport type DialogLayerOptions = {\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n onOpenAutoFocus?: AutoFocusHandler\n onCloseAutoFocus?: AutoFocusHandler\n}\n\ntype FocusCycle = {\n content: HTMLElement\n opener: HTMLElement | null\n openerEligible: boolean\n closed: boolean\n focusMovedOutside: boolean\n closeAutoFocusScheduled: boolean\n /** The restore deadline passed: stop waiting on the opener after the frame that is due. */\n deadlinePassed: boolean\n frame?: number\n fallbackTimer?: number\n observer?: MutationObserver\n onFocusIn: (event: FocusEvent) => void\n}\n\n/** The kit's dialog layers that are open now, so a closing layer can tell a newer one took over. */\nconst openLayers = new Set<HTMLElement>()\n\nfunction isVisible(element: HTMLElement) {\n return element.isConnected && element.getClientRects().length > 0\n}\n\nfunction canRestoreFocus(target: HTMLElement): boolean {\n return (\n target !== document.body &&\n target !== document.documentElement &&\n !target.closest('[inert], [aria-hidden=\"true\"]') &&\n !target.matches(':disabled') &&\n isVisible(target)\n )\n}\n\nfunction anotherLayerOpen(content: HTMLElement, opener: HTMLElement): boolean {\n for (const layer of openLayers) {\n if (\n layer !== content &&\n !content.contains(layer) &&\n !layer.contains(opener) &&\n !layer.closest('[aria-hidden=\"true\"], [inert]') &&\n isVisible(layer)\n ) {\n return true\n }\n }\n return false\n}\n\n/**\n * The focus-return half of the layer rules, for a layer whose open state is\n * `open`. Returns the autofocus handlers to give the Kobalte content.\n */\n/** How long a closed layer may wait for its opener to become focusable again. */\nconst FOCUS_RESTORE_DEADLINE_MS = 1000\n\nexport function createDialogFocusReturn(\n open: Accessor<boolean>,\n options: DialogLayerOptions\n): { onOpenAutoFocus: AutoFocusHandler; onCloseAutoFocus: AutoFocusHandler } {\n const focusCycles = new WeakMap<HTMLElement, FocusCycle>()\n let activeFocusCycle: FocusCycle | undefined\n let pendingOpener: HTMLElement | null = null\n let pendingOpenerEligible = false\n\n // Captured while the open state changes, before Kobalte's effects move focus\n // into the layer and before a closing menu takes its row out of the page.\n createRenderEffect(() => {\n if (!open() || typeof document === 'undefined') {\n pendingOpener = null\n pendingOpenerEligible = false\n return\n }\n const active = options.restoreFocusRef?.() ?? document.activeElement\n pendingOpener = active instanceof HTMLElement ? active : null\n pendingOpenerEligible = active instanceof HTMLElement && canRestoreFocus(active)\n })\n\n const finishFocusCycle = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) window.cancelAnimationFrame(cycle.frame)\n if (cycle.fallbackTimer !== undefined) window.clearTimeout(cycle.fallbackTimer)\n cycle.observer?.disconnect()\n document.removeEventListener('focusin', cycle.onFocusIn)\n openLayers.delete(cycle.content)\n if (activeFocusCycle === cycle) activeFocusCycle = undefined\n }\n\n const markClosed = (cycle: FocusCycle) => {\n cycle.closed = true\n openLayers.delete(cycle.content)\n }\n\n const scheduleFocusRestore = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) return\n cycle.frame = window.requestAnimationFrame(() => {\n cycle.frame = undefined\n const opener = cycle.opener\n const active = document.activeElement\n const focusIsAvailable =\n active === document.body ||\n active === document.documentElement ||\n active === cycle.content ||\n (active instanceof Node && cycle.content.contains(active))\n if (\n activeFocusCycle !== cycle ||\n !cycle.closed ||\n cycle.focusMovedOutside ||\n !opener ||\n !isVisible(opener) ||\n opener.matches(':disabled') ||\n !focusIsAvailable ||\n anotherLayerOpen(cycle.content, opener)\n ) {\n finishFocusCycle(cycle)\n return\n }\n\n // Nothing to restore: stop watching the document now.\n if (!cycle.openerEligible) {\n finishFocusCycle(cycle)\n return\n }\n // Kobalte removes the `inert` / `aria-hidden` it put on the background\n // only after the layer unmounts; the observer below brings us back here.\n if (opener.closest('[inert], [aria-hidden=\"true\"]')) {\n if (cycle.deadlinePassed) finishFocusCycle(cycle)\n return\n }\n if (cycle.openerEligible && canRestoreFocus(opener)) {\n opener.focus({ preventScroll: true })\n }\n finishFocusCycle(cycle)\n })\n }\n\n const onOpenAutoFocus = (event: Event) => {\n const element = event.currentTarget\n if (element instanceof HTMLElement) {\n if (activeFocusCycle) finishFocusCycle(activeFocusCycle)\n\n const openerWasCaptured = pendingOpener !== null\n const opener = pendingOpener ?? document.activeElement\n const openerEligible = openerWasCaptured\n ? pendingOpenerEligible\n : opener instanceof HTMLElement && canRestoreFocus(opener)\n pendingOpener = null\n pendingOpenerEligible = false\n const openerElement = opener instanceof HTMLElement ? opener : null\n const cycle: FocusCycle = {\n content: element,\n opener: openerElement,\n openerEligible,\n closed: false,\n focusMovedOutside: false,\n closeAutoFocusScheduled: false,\n deadlinePassed: false,\n onFocusIn: (focusEvent) => {\n const target = focusEvent.target\n if (\n !(target instanceof HTMLElement) ||\n target === document.body ||\n target === document.documentElement\n ) {\n return\n }\n if (target === element || element.contains(target) || target === openerElement) {\n if (!cycle.closed) cycle.focusMovedOutside = false\n return\n }\n cycle.focusMovedOutside = true\n },\n }\n focusCycles.set(element, cycle)\n activeFocusCycle = cycle\n openLayers.add(element)\n document.addEventListener('focusin', cycle.onFocusIn)\n }\n options.onOpenAutoFocus?.(event)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n const element = event.currentTarget\n const cycle = element instanceof HTMLElement ? focusCycles.get(element) : undefined\n options.onCloseAutoFocus?.(event)\n\n if (!cycle) return\n markClosed(cycle)\n\n // A caller that prevents Kobalte's close autofocus owns the focus decision.\n if (event.defaultPrevented) {\n finishFocusCycle(cycle)\n return\n }\n\n if (cycle.fallbackTimer !== undefined) {\n window.clearTimeout(cycle.fallbackTimer)\n cycle.fallbackTimer = undefined\n }\n cycle.closeAutoFocusScheduled = true\n cycle.observer = new MutationObserver(() => scheduleFocusRestore(cycle))\n cycle.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'inert'],\n childList: true,\n subtree: true,\n })\n scheduleFocusRestore(cycle)\n // The observer watches every mutation in the document. If the opener stays\n // under an `inert` or `aria-hidden` that is not this layer's, nothing above\n // finishes the cycle, and a streaming page would schedule a frame per DOM\n // change for good. Kobalte clears its own markers within a frame or two.\n // The deadline stops the watching, not a restore already asked for: a busy\n // or throttled page (WebKit under load) can hold the frame past it.\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n cycle.deadlinePassed = true\n cycle.observer?.disconnect()\n if (cycle.frame === undefined) finishFocusCycle(cycle)\n }, FOCUS_RESTORE_DEADLINE_MS)\n }\n\n onCleanup(() => {\n const cycle = activeFocusCycle\n if (!cycle) return\n markClosed(cycle)\n\n // Kobalte dispatches the close autofocus from a timer after unmount. If the\n // content never dispatches it, release the focus listener after that timer.\n queueMicrotask(() => {\n if (cycle.closeAutoFocusScheduled) return\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n if (!cycle.closeAutoFocusScheduled) finishFocusCycle(cycle)\n }, 0)\n })\n })\n\n return { onOpenAutoFocus, onCloseAutoFocus }\n}\n\n/** The layer rules for a content rendered inside a Kobalte Dialog or AlertDialog root. */\nexport function createDialogLayer(options: DialogLayerOptions) {\n return createDialogFocusReturn(useDialogContext().isOpen, options)\n}\n\n/**\n * Lets an Escape swallowed by a tooltip inside the layer close the layer. The\n * content's own `onEscapeKeyDown` sees that Escape first, so a layer that\n * blocks Escape (a dirty form, a save in flight) stays blocked.\n */\nexport function DialogEscapeTarget(props: {\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n children?: JSX.Element\n}) {\n const dialog = useDialogContext()\n const dismiss = (event: KeyboardEvent) => {\n props.onEscapeKeyDown?.(event)\n if (!event.defaultPrevented) dialog.close()\n }\n return (\n <TooltipEscapeTargetContext.Provider value={{ element: dialog.contentRef, dismiss }}>\n {props.children}\n </TooltipEscapeTargetContext.Provider>\n )\n}\n"],"mappings":";;;;;;AA6CA,IAAMqB,6BAAa,IAAIC,IAAiB;AAExC,SAASC,UAAUC,SAAsB;CACvC,OAAOA,QAAQC,eAAeD,QAAQE,eAAe,CAAC,CAACC,SAAS;AAClE;AAEA,SAASC,gBAAgBC,QAA8B;CACrD,OACEA,WAAWC,SAASC,QACpBF,WAAWC,SAASE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AK,EAAE,cAAc,CAAC,KAAK,CAAC,eAGxD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,KAAK,CAAC,eAG5E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,WAAW,CAAC,eAGxF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,WAAW,CAAC,eAGlF;AAED,0CAA0C;AAC1C,eAAO,MAAM,iBAAiB,oBAAc,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip/tooltip.js";
|
|
|
4
4
|
import { DialogEscapeTarget, createDialogLayer } from "./dialog-layer.js";
|
|
5
5
|
import { className, createComponent, effect, insert, memo, mergeProps, spread, template } from "solid-js/web";
|
|
6
6
|
import { X } from "lucide-solid";
|
|
7
|
-
import { Show, splitProps } from "solid-js";
|
|
7
|
+
import { Show, children, splitProps } from "solid-js";
|
|
8
8
|
import { Content, Dialog, Overlay, Portal as DialogPortal, Root as Dialog$1, Trigger as DialogTrigger } from "@kobalte/core/dialog";
|
|
9
9
|
// src/components/ui/dialog/dialog.tsx
|
|
10
10
|
var _tmpl$ = /*#__PURE__*/ template(`<div>`);
|
|
@@ -47,6 +47,7 @@ function DialogContent(props) {
|
|
|
47
47
|
},
|
|
48
48
|
onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event)
|
|
49
49
|
});
|
|
50
|
+
const closeButton = children(() => local.closeButton);
|
|
50
51
|
return createComponent(Dialog.Portal, { get children() {
|
|
51
52
|
return [createComponent(DialogOverlay, {}), (() => {
|
|
52
53
|
var _el$ = _tmpl$();
|
|
@@ -67,7 +68,7 @@ function DialogContent(props) {
|
|
|
67
68
|
get children() {
|
|
68
69
|
return [memo(() => local.children), createComponent(Show, {
|
|
69
70
|
get when() {
|
|
70
|
-
return
|
|
71
|
+
return closeButton() !== false;
|
|
71
72
|
},
|
|
72
73
|
get children() {
|
|
73
74
|
return createComponent(Tooltip, { get children() {
|
|
@@ -81,7 +82,7 @@ function DialogContent(props) {
|
|
|
81
82
|
},
|
|
82
83
|
"class": overlayCornerClose,
|
|
83
84
|
get children() {
|
|
84
|
-
return
|
|
85
|
+
return closeButton() ?? createComponent(X, { "class": "size-4" });
|
|
85
86
|
}
|
|
86
87
|
}), createComponent(TooltipContent, { get children() {
|
|
87
88
|
return memo(() => !!local.closeLabel)() ? `${local.closeLabel}.` : "Close dialog.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":["KobalteDialog","KobalteDialogContent","KobalteDialogOverlay","X","Show","splitProps","dialogSurface","overlayCornerClose","overlayDescription","overlayFooter","overlayHeader","overlayMotion","overlayPositioner","overlayScrim","overlayScrimMotion","overlayTitle","cn","Tooltip","TooltipContent","TooltipTrigger","createDialogLayer","DialogEscapeTarget","Portal","DialogOverlay","props","local","rest","_$createComponent","_$mergeProps","class","closeButton","closeLabel","positioner","size","initialFocus","restoreFocusRef","HTMLElement","dialogContentSizes","sm","md","lg","xl","DialogContent","layer","onOpenAutoFocus","event","defaultPrevented","currentTarget","preventDefault","focus","preventScroll","onCloseAutoFocus","children","_el$","_tmpl$","_$insert","onEscapeKeyDown","_$memo","when","as","CloseButton","_$effect","_$className","DialogHeader","band","_el$2","_tmpl$2","_$spread","DialogFooter","_el$3","_tmpl$3","DialogTitle","Title","DialogDescription","Description","DialogClose","DialogCloseButton"],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import {\n Dialog as KobalteDialog,\n Content as KobalteDialogContent,\n Overlay as KobalteDialogOverlay,\n} from '@kobalte/core/dialog'\n// AlertDialog assigns to the shared DialogRoot.Content object, so these named exports stay role-stable.\nimport { X } from 'lucide-solid'\nimport type { Accessor, ComponentProps, JSX } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayCornerClose,\n overlayDescription,\n overlayFooter,\n overlayHeader,\n overlayMotion,\n overlayPositioner,\n overlayScrim,\n overlayScrimMotion,\n overlayTitle,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'\nimport { createDialogLayer, DialogEscapeTarget } from './dialog-layer'\n\n/**\n * Dialog.\n *\n * A modal surface for a decision or a short task. `Dialog.Portal` keeps the\n * panel out of the app's stacking and overflow contexts, `Dialog.Overlay`\n * dims what is behind it, and Kobalte handles the focus trap, the escape key\n * and scroll locking. Focus returns on close to whatever had it before the\n * dialog opened, trigger or not (pass `restoreFocusRef` when that control is\n * gone by then, such as a menu row).\n *\n * The close button is part of the content rather than optional, because every\n * modal needs a way out that is not the keyboard. A dialog whose only exit is\n * Escape is a trap for anyone using a pointer.\n */\nexport {\n Root as Dialog,\n Trigger as DialogTrigger,\n Portal as DialogPortal,\n} from '@kobalte/core/dialog'\n\nexport function DialogOverlay(props: ComponentProps<typeof KobalteDialogOverlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialogOverlay class={cn(overlayScrim, overlayScrimMotion, local.class)} {...rest} />\n )\n}\n\nexport type DialogContentProps = ComponentProps<typeof KobalteDialogContent> & {\n /**\n * Replaces the default close button. Pass `false` to remove it — only for a\n * dialog that cannot be dismissed (an update that must finish); anything the\n * user can escape from needs the button.\n */\n closeButton?: JSX.Element | false\n /**\n * The corner close's accessible name. Defaults to \"Close\". Name it for the\n * dialog (\"Close version and updates\") when the footer also has a text\n * \"Close\", so the two controls do not share one name.\n */\n closeLabel?: string\n /** Use a 1rem inset as the positioner bounds for tall, viewport-filling surfaces. */\n positioner?: 'default' | 'inset'\n /**\n * The panel's maximum width. `md` (32rem) is the default and right for a\n * confirmation or a short form; `sm` (28rem) for a single question; `lg`\n * (42rem) for a picker or a form with two columns; `xl` (48rem) for a\n * multi-step flow that needs a table or a preview beside its fields.\n */\n size?: DialogContentSize\n /**\n * Where focus lands on open. `first-control` (the default) is the first\n * tabbable control; `panel` focuses the panel itself, for a dialog whose\n * content should be read before an action is reached (an About box, an\n * update summary).\n */\n initialFocus?: 'first-control' | 'panel'\n /** The control to focus on close when the one focused before opening is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/** The dialog width ladder, so a caller picks a rung instead of a `max-w-*`. */\nexport const dialogContentSizes = {\n sm: 'max-w-md',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n xl: 'max-w-3xl',\n} as const\n\nexport type DialogContentSize = keyof typeof dialogContentSizes\n\nexport function DialogContent(props: DialogContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'closeButton',\n 'closeLabel',\n 'positioner',\n 'size',\n 'initialFocus',\n 'restoreFocusRef',\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n ])\n const layer = createDialogLayer({\n restoreFocusRef: local.restoreFocusRef,\n onOpenAutoFocus: (event) => {\n local.onOpenAutoFocus?.(event)\n if (\n local.initialFocus === 'panel' &&\n !event.defaultPrevented &&\n event.currentTarget instanceof HTMLElement\n ) {\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n }\n },\n onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event),\n })\n\n return (\n <KobalteDialog.Portal>\n <DialogOverlay />\n <div class={cn(overlayPositioner, local.positioner === 'inset' && 'inset-4 grid-rows-1 p-0')}>\n <KobalteDialogContent\n class={cn(\n dialogSurface,\n overlayMotion,\n 'relative grid max-h-full w-full gap-4 overflow-y-auto p-5',\n dialogContentSizes[local.size ?? 'md'],\n local.class\n )}\n {...rest}\n onOpenAutoFocus={layer.onOpenAutoFocus}\n onCloseAutoFocus={layer.onCloseAutoFocus}\n >\n <DialogEscapeTarget onEscapeKeyDown={props.onEscapeKeyDown}>\n {local.children}\n <Show when={local.closeButton !== false}>\n {/* The corner close is icon-only, so it carries the shared tooltip\n treatment. */}\n <Tooltip>\n <TooltipTrigger\n as={KobalteDialog.CloseButton}\n data-slot=\"dialog-corner-close\"\n aria-label={local.closeLabel ?? 'Close'}\n class={overlayCornerClose}\n >\n {local.closeButton ?? <X class=\"size-4\" />}\n </TooltipTrigger>\n <TooltipContent>\n {local.closeLabel ? `${local.closeLabel}.` : 'Close dialog.'}\n </TooltipContent>\n </Tooltip>\n </Show>\n </DialogEscapeTarget>\n </KobalteDialogContent>\n </div>\n </KobalteDialog.Portal>\n )\n}\n\n/**\n * The dialog's title block. `band` steps it onto the elevation ladder's\n * subtle-fill rung (`--muted`), the same treatment as the sheet parts' band —\n * for the dialog family whose panel anatomy matches a sheet's (a title band\n * over a full-bleed shell, such as a settings dialog) rather than the centred\n * modal's documented flat surface. See `SheetFooter` for the rung's rationale.\n */\nexport function DialogHeader(props: ComponentProps<'div'> & { band?: boolean }) {\n const [local, rest] = splitProps(props, ['class', 'band'])\n return (\n <div\n data-slot=\"dialog-header\"\n class={cn(overlayHeader, 'pe-6', { 'bg-muted': local.band }, local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"dialog-footer\" class={cn(overlayFooter, local.class)} {...rest} />\n}\n\nexport function DialogTitle(props: ComponentProps<typeof KobalteDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DialogDescription(props: ComponentProps<typeof KobalteDialog.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\n/**\n * A close control of the caller's own, polymorphic — for a footer's text\n * \"Cancel\" or \"Close\", which is a different control from the corner icon the\n * content draws. Take it as `as={Button}` so it carries the button's variants\n * rather than a copied class string.\n */\nexport function DialogClose(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n\n/** The earlier name for `DialogClose`. */\nexport const DialogCloseButton = DialogClose\n"],"mappings":";;;;;;;;;;;;AA6CA,SAAgBuB,cAAcC,OAAoD;CAChF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGzB,SAAoB0B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGH,cAAcC,oBAAoBW,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAE5F;;AAoCA,IAAaW,qBAAqB;CAChCC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAIA,SAAgBC,cAAclB,OAA2B;CACvD,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAkB,CACnB;CACD,MAAMmB,QAAQvB,kBAAkB;EAC9Be,iBAAiBV,MAAMU;EACvBS,kBAAkBC,UAAU;GAC1BpB,MAAMmB,kBAAkBC,KAAK;GAC7B,IACEpB,MAAMS,iBAAiB,WACvB,CAACW,MAAMC,oBACPD,MAAME,yBAAyBX,aAC/B;IACAS,MAAMG,eAAe;IACrBH,MAAME,cAAcE,MAAM,EAAEC,eAAe,KAAK,CAAC;GACnD;EACF;EACAC,mBAAmBN,UAAUpB,MAAM0B,mBAAmBN,KAAK;CAC7D,CAAC;CAED,OAAAlB,gBACG3B,OAAcsB,QAAM,EAAA,IAAA8B,WAAA;EAAA,OAAA,CAAAzB,gBAClBJ,eAAa,CAAA,CAAA,UAAA;GAAA,IAAA8B,OAAAC,OAAA;GAAAC,OAAAF,MAAA1B,gBAEX1B,SAAoB2B,WAAA,EAAA,KAAA,WAAA;IAAA,OACZZ,GACLV,eACAK,eACA,6DACA0B,mBAAmBZ,MAAMQ,QAAQ,OACjCR,MAAMI,KACR;GAAC,EAAA,GACGH,MAAI;IAAA,IACRkB,kBAAe;KAAA,OAAED,MAAMC;IAAe;IA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AAoBD"}
|
|
1
|
+
{"version":3,"file":"dialog.js","names":["KobalteDialog","KobalteDialogContent","KobalteDialogOverlay","X","children","resolveChildren","Show","splitProps","dialogSurface","overlayCornerClose","overlayDescription","overlayFooter","overlayHeader","overlayMotion","overlayPositioner","overlayScrim","overlayScrimMotion","overlayTitle","cn","Tooltip","TooltipContent","TooltipTrigger","createDialogLayer","DialogEscapeTarget","Portal","DialogOverlay","props","local","rest","_$createComponent","_$mergeProps","class","closeButton","closeLabel","positioner","size","initialFocus","restoreFocusRef","HTMLElement","dialogContentSizes","sm","md","lg","xl","DialogContent","layer","onOpenAutoFocus","event","defaultPrevented","currentTarget","preventDefault","focus","preventScroll","onCloseAutoFocus","_el$","_tmpl$","_$insert","onEscapeKeyDown","_$memo","when","as","CloseButton","_$effect","_$className","DialogHeader","band","_el$2","_tmpl$2","_$spread","DialogFooter","_el$3","_tmpl$3","DialogTitle","Title","DialogDescription","Description","DialogClose","DialogCloseButton"],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import {\n Dialog as KobalteDialog,\n Content as KobalteDialogContent,\n Overlay as KobalteDialogOverlay,\n} from '@kobalte/core/dialog'\n// AlertDialog assigns to the shared DialogRoot.Content object, so these named exports stay role-stable.\nimport { X } from 'lucide-solid'\nimport type { Accessor, ComponentProps, JSX } from 'solid-js'\nimport { children as resolveChildren, Show, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayCornerClose,\n overlayDescription,\n overlayFooter,\n overlayHeader,\n overlayMotion,\n overlayPositioner,\n overlayScrim,\n overlayScrimMotion,\n overlayTitle,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'\nimport { createDialogLayer, DialogEscapeTarget } from './dialog-layer'\n\n/**\n * Dialog.\n *\n * A modal surface for a decision or a short task. `Dialog.Portal` keeps the\n * panel out of the app's stacking and overflow contexts, `Dialog.Overlay`\n * dims what is behind it, and Kobalte handles the focus trap, the escape key\n * and scroll locking. Focus returns on close to whatever had it before the\n * dialog opened, trigger or not (pass `restoreFocusRef` when that control is\n * gone by then, such as a menu row).\n *\n * The close button is part of the content rather than optional, because every\n * modal needs a way out that is not the keyboard. A dialog whose only exit is\n * Escape is a trap for anyone using a pointer.\n */\nexport {\n Root as Dialog,\n Trigger as DialogTrigger,\n Portal as DialogPortal,\n} from '@kobalte/core/dialog'\n\nexport function DialogOverlay(props: ComponentProps<typeof KobalteDialogOverlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialogOverlay class={cn(overlayScrim, overlayScrimMotion, local.class)} {...rest} />\n )\n}\n\nexport type DialogContentProps = ComponentProps<typeof KobalteDialogContent> & {\n /**\n * Replaces the default close button. Pass `false` to remove it — only for a\n * dialog that cannot be dismissed (an update that must finish); anything the\n * user can escape from needs the button.\n */\n closeButton?: JSX.Element | false\n /**\n * The corner close's accessible name. Defaults to \"Close\". Name it for the\n * dialog (\"Close version and updates\") when the footer also has a text\n * \"Close\", so the two controls do not share one name.\n */\n closeLabel?: string\n /** Use a 1rem inset as the positioner bounds for tall, viewport-filling surfaces. */\n positioner?: 'default' | 'inset'\n /**\n * The panel's maximum width. `md` (32rem) is the default and right for a\n * confirmation or a short form; `sm` (28rem) for a single question; `lg`\n * (42rem) for a picker or a form with two columns; `xl` (48rem) for a\n * multi-step flow that needs a table or a preview beside its fields.\n */\n size?: DialogContentSize\n /**\n * Where focus lands on open. `first-control` (the default) is the first\n * tabbable control; `panel` focuses the panel itself, for a dialog whose\n * content should be read before an action is reached (an About box, an\n * update summary).\n */\n initialFocus?: 'first-control' | 'panel'\n /** The control to focus on close when the one focused before opening is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/** The dialog width ladder, so a caller picks a rung instead of a `max-w-*`. */\nexport const dialogContentSizes = {\n sm: 'max-w-md',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n xl: 'max-w-3xl',\n} as const\n\nexport type DialogContentSize = keyof typeof dialogContentSizes\n\nexport function DialogContent(props: DialogContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'closeButton',\n 'closeLabel',\n 'positioner',\n 'size',\n 'initialFocus',\n 'restoreFocusRef',\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n ])\n const layer = createDialogLayer({\n restoreFocusRef: local.restoreFocusRef,\n onOpenAutoFocus: (event) => {\n local.onOpenAutoFocus?.(event)\n if (\n local.initialFocus === 'panel' &&\n !event.defaultPrevented &&\n event.currentTarget instanceof HTMLElement\n ) {\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n }\n },\n onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event),\n })\n\n const closeButton = resolveChildren(() => local.closeButton)\n return (\n <KobalteDialog.Portal>\n <DialogOverlay />\n <div class={cn(overlayPositioner, local.positioner === 'inset' && 'inset-4 grid-rows-1 p-0')}>\n <KobalteDialogContent\n class={cn(\n dialogSurface,\n overlayMotion,\n 'relative grid max-h-full w-full gap-4 overflow-y-auto p-5',\n dialogContentSizes[local.size ?? 'md'],\n local.class\n )}\n {...rest}\n onOpenAutoFocus={layer.onOpenAutoFocus}\n onCloseAutoFocus={layer.onCloseAutoFocus}\n >\n <DialogEscapeTarget onEscapeKeyDown={props.onEscapeKeyDown}>\n {local.children}\n <Show when={closeButton() !== false}>\n {/* The corner close is icon-only, so it carries the shared tooltip\n treatment. */}\n <Tooltip>\n <TooltipTrigger\n as={KobalteDialog.CloseButton}\n data-slot=\"dialog-corner-close\"\n aria-label={local.closeLabel ?? 'Close'}\n class={overlayCornerClose}\n >\n {closeButton() ?? <X class=\"size-4\" />}\n </TooltipTrigger>\n <TooltipContent>\n {local.closeLabel ? `${local.closeLabel}.` : 'Close dialog.'}\n </TooltipContent>\n </Tooltip>\n </Show>\n </DialogEscapeTarget>\n </KobalteDialogContent>\n </div>\n </KobalteDialog.Portal>\n )\n}\n\n/**\n * The dialog's title block. `band` steps it onto the elevation ladder's\n * subtle-fill rung (`--muted`), the same treatment as the sheet parts' band —\n * for the dialog family whose panel anatomy matches a sheet's (a title band\n * over a full-bleed shell, such as a settings dialog) rather than the centred\n * modal's documented flat surface. See `SheetFooter` for the rung's rationale.\n */\nexport function DialogHeader(props: ComponentProps<'div'> & { band?: boolean }) {\n const [local, rest] = splitProps(props, ['class', 'band'])\n return (\n <div\n data-slot=\"dialog-header\"\n class={cn(overlayHeader, 'pe-6', { 'bg-muted': local.band }, local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"dialog-footer\" class={cn(overlayFooter, local.class)} {...rest} />\n}\n\nexport function DialogTitle(props: ComponentProps<typeof KobalteDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DialogDescription(props: ComponentProps<typeof KobalteDialog.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\n/**\n * A close control of the caller's own, polymorphic — for a footer's text\n * \"Cancel\" or \"Close\", which is a different control from the corner icon the\n * content draws. Take it as `as={Button}` so it carries the button's variants\n * rather than a copied class string.\n */\nexport function DialogClose(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n\n/** The earlier name for `DialogClose`. */\nexport const DialogCloseButton = DialogClose\n"],"mappings":";;;;;;;;;;;;AA6CA,SAAgByB,cAAcC,OAAoD;CAChF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACG3B,SAAoB4B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGH,cAAcC,oBAAoBW,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAE5F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A,IAAA4C,QAAAC,QAAA;EAAAH,OAAAE,OAAAxC,WAAA,EAAA,KAAA,WAAA;GAAA,OAA6CZ,GAAGP,eAAegB,MAAMI,KAAK;EAAC,EAAA,GAAMH,IAAI,GAAA,OAAA,KAAA;EAAA,OAAA0C;CAAA,EAAA,CAAA;AACvF;AAEA,SAAgBE,YAAY9C,OAAmD;CAC7E,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ7B,OAAcyE,OAAK3C,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGD,cAAcU,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAC5E;AAEA,SAAgB8C,kBAAkBhD,OAAyD;CACzF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ7B,OAAc2E,aAAW7C,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGR,oBAAoBiB,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AACxF;;;;;;;AAQA,SAAgBgD,YAAYlD,OAAyD;CACnF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ7B,OAAc6D,aAAW/B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAG,cAAcS,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAClF;;AAGA,IAAaiD,oBAAoBD"}
|
|
@@ -8,7 +8,7 @@ import { type VariantProps } from '#lib/variants';
|
|
|
8
8
|
* fix from a caller: whether a line is an addition, a deletion, a hunk header,
|
|
9
9
|
* a file header, or context depends on state — a line beginning with `+++` is a
|
|
10
10
|
* file header *before* the first hunk and an added line beginning with `++`
|
|
11
|
-
* *inside* one
|
|
11
|
+
* *inside* one, and a renderer that tested prefixes without that state would
|
|
12
12
|
* mis-colour real patches.
|
|
13
13
|
*
|
|
14
14
|
* The line grammar:
|
|
@@ -23,13 +23,13 @@ import { type VariantProps } from '#lib/variants';
|
|
|
23
23
|
* | anything else, including a leading space | context |
|
|
24
24
|
*
|
|
25
25
|
* Tones are pairs of surface and text, so an addition is readable in both
|
|
26
|
-
* polarities and with any accent
|
|
26
|
+
* polarities and with any accent, the greens and reds are the theme's own
|
|
27
27
|
* `success` and `destructive` at low alpha, not fixed hexes. Colour is never the
|
|
28
28
|
* only signal: the gutter carries `+` or `-` as well, which is what makes the
|
|
29
29
|
* block usable in greyscale and by anyone who cannot separate the two hues.
|
|
30
30
|
*
|
|
31
31
|
* Split (side-by-side) view is deliberately not implemented. It is a different
|
|
32
|
-
* layout algorithm
|
|
32
|
+
* layout algorithm, pairing deletions with additions across hunks, and a
|
|
33
33
|
* half-correct one is worse than none. `view="unified"` is the only value, and
|
|
34
34
|
* the prop exists so that adding the second is not a breaking change.
|
|
35
35
|
*/
|
|
@@ -51,7 +51,7 @@ export type DiffLine = Readonly<{
|
|
|
51
51
|
* `headerState` is what makes `---` and `+++` unambiguous: git writes them as
|
|
52
52
|
* file headers before the first `@@` and as content after it, and the two need
|
|
53
53
|
* different tones. `oldLine`/`newLine` are tracked so the gutter can number both
|
|
54
|
-
* sides
|
|
54
|
+
* sides, the numbers a reader uses to find the change in their editor.
|
|
55
55
|
*/
|
|
56
56
|
export declare function parseDiff(patch: string): readonly DiffLine[];
|
|
57
57
|
/** The counts a diff summary reports: how much was added and removed. */
|
|
@@ -60,8 +60,8 @@ export declare function diffStats(lines: readonly DiffLine[]): Readonly<{
|
|
|
60
60
|
removed: number;
|
|
61
61
|
}>;
|
|
62
62
|
/**
|
|
63
|
-
* The target path from a unified diff's file header. Prefers `+++ b/<path
|
|
64
|
-
* git's explicit new-side marker
|
|
63
|
+
* The target path from a unified diff's file header. Prefers `+++ b/<path>`,
|
|
64
|
+
* git's explicit new-side marker, and skips `/dev/null`, which marks an added
|
|
65
65
|
* or deleted side rather than naming a file. Only lines outside a hunk are
|
|
66
66
|
* considered, for the same reason the parser tracks state.
|
|
67
67
|
*/
|
|
@@ -15,7 +15,7 @@ var HUNK_HEADER = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
|
|
|
15
15
|
* `headerState` is what makes `---` and `+++` unambiguous: git writes them as
|
|
16
16
|
* file headers before the first `@@` and as content after it, and the two need
|
|
17
17
|
* different tones. `oldLine`/`newLine` are tracked so the gutter can number both
|
|
18
|
-
* sides
|
|
18
|
+
* sides, the numbers a reader uses to find the change in their editor.
|
|
19
19
|
*/
|
|
20
20
|
function parseDiff(patch) {
|
|
21
21
|
const lines = [];
|
|
@@ -102,8 +102,8 @@ function diffStats(lines) {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
* The target path from a unified diff's file header. Prefers `+++ b/<path
|
|
106
|
-
* git's explicit new-side marker
|
|
105
|
+
* The target path from a unified diff's file header. Prefers `+++ b/<path>`,
|
|
106
|
+
* git's explicit new-side marker, and skips `/dev/null`, which marks an added
|
|
107
107
|
* or deleted side rather than naming a file. Only lines outside a hunk are
|
|
108
108
|
* considered, for the same reason the parser tracks state.
|
|
109
109
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-block.js","names":["createMemo","For","Show","splitProps","cva","cn","kind","text","marker","oldLine","newLine","HUNK_HEADER","parseDiff","patch","lines","inHunk","raw","replace","split","test","match","exec","Number","push","isFileHeader","startsWith","slice","numbered","line","show","Boolean","diffStats","added","removed","diffTargetPath","git","plain","fromHeader","diffLineVariants","variants","add","delete","context","hunk","header","meta","defaultVariants","title","complete","showLineNumbers","actions","DiffBlock","props","local","rest","stats","name","pop","_el$","_tmpl$2","_el$2","firstChild","_el$4","nextSibling","_el$6","_el$9","_el$1","_el$10","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","children","_el$12","_tmpl$4","_el$15","_el$16","_el$17","when","_el$13","_tmpl$3","_el$14","_c$","_$memo","_c$2","_$effect","_$className","_tmpl$","_$setAttribute","DiffSummary","onSelect","_el$18","_tmpl$5","_el$19","_el$21","_el$24","$$click","_$delegateEvents"],"sources":["../../../../src/components/ui/diff-block/diff-block.tsx"],"sourcesContent":["import { createMemo, For, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * DiffBlock.\n *\n * A unified diff, classified and toned. Parsing lives here because the\n * classification is the part that is easy to get subtly wrong and impossible to\n * fix from a caller: whether a line is an addition, a deletion, a hunk header,\n * a file header, or context depends on state — a line beginning with `+++` is a\n * file header *before* the first hunk and an added line beginning with `++`\n * *inside* one — and a renderer that tested prefixes without that state would\n * mis-colour real patches.\n *\n * The line grammar:\n *\n * | Prefix | Meaning |\n * | --- | --- |\n * | `diff --git`, `index`, `---`, `+++` (before a hunk) | file header |\n * | `@@` | hunk header |\n * | `+` | addition |\n * | `-` | deletion |\n * | `\\` | the \"no newline at end of file\" marker |\n * | anything else, including a leading space | context |\n *\n * Tones are pairs of surface and text, so an addition is readable in both\n * polarities and with any accent — the greens and reds are the theme's own\n * `success` and `destructive` at low alpha, not fixed hexes. Colour is never the\n * only signal: the gutter carries `+` or `-` as well, which is what makes the\n * block usable in greyscale and by anyone who cannot separate the two hues.\n *\n * Split (side-by-side) view is deliberately not implemented. It is a different\n * layout algorithm — pairing deletions with additions across hunks — and a\n * half-correct one is worse than none. `view=\"unified\"` is the only value, and\n * the prop exists so that adding the second is not a breaking change.\n */\n\nexport type DiffLineKind = 'add' | 'delete' | 'context' | 'hunk' | 'header' | 'meta'\n\nexport type DiffLine = Readonly<{\n kind: DiffLineKind\n /** The line without its diff prefix. */\n text: string\n /** The prefix as written: `+`, `-`, a space, or nothing for a header. */\n marker: string\n /** The old-side line number, when the line exists on the old side. */\n oldLine?: number\n /** The new-side line number, when the line exists on the new side. */\n newLine?: number\n}>\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/\n\n/**\n * Classify a unified diff.\n *\n * `headerState` is what makes `---` and `+++` unambiguous: git writes them as\n * file headers before the first `@@` and as content after it, and the two need\n * different tones. `oldLine`/`newLine` are tracked so the gutter can number both\n * sides — the numbers a reader uses to find the change in their editor.\n */\nexport function parseDiff(patch: string): readonly DiffLine[] {\n const lines: DiffLine[] = []\n let inHunk = false\n let oldLine = 0\n let newLine = 0\n\n for (const raw of patch.replace(/\\n$/, '').split('\\n')) {\n if (HUNK_HEADER.test(raw)) {\n const match = HUNK_HEADER.exec(raw)!\n oldLine = Number(match[1])\n newLine = Number(match[2])\n inHunk = true\n lines.push({ kind: 'hunk', text: raw, marker: '' })\n continue\n }\n\n if (!inHunk) {\n const isFileHeader =\n raw.startsWith('diff --git') ||\n raw.startsWith('index ') ||\n raw.startsWith('new file') ||\n raw.startsWith('deleted file') ||\n raw.startsWith('similarity index') ||\n raw.startsWith('rename ') ||\n raw.startsWith('--- ') ||\n raw.startsWith('+++ ')\n lines.push({ kind: isFileHeader ? 'header' : 'meta', text: raw, marker: '' })\n continue\n }\n\n if (raw.startsWith('\\\\')) {\n lines.push({ kind: 'meta', text: raw, marker: '' })\n continue\n }\n\n const marker = raw[0] ?? ' '\n if (marker === '+') {\n lines.push({ kind: 'add', text: raw.slice(1), marker, newLine })\n newLine += 1\n } else if (marker === '-') {\n lines.push({ kind: 'delete', text: raw.slice(1), marker, oldLine })\n oldLine += 1\n } else {\n lines.push({ kind: 'context', text: raw.slice(1), marker: ' ', oldLine, newLine })\n oldLine += 1\n newLine += 1\n }\n }\n\n return lines\n}\n\n/**\n * Whether a line gets gutter numbers. A hunk header and a file header are\n * structural, so numbering them would put a number on a line that has none.\n */\nfunction numbered(line: DiffLine, show: boolean | undefined): boolean {\n return Boolean(show) && line.kind !== 'hunk' && line.kind !== 'header' && line.kind !== 'meta'\n}\n\n/** The counts a diff summary reports: how much was added and removed. */\nexport function diffStats(\n lines: readonly DiffLine[]\n): Readonly<{ added: number; removed: number }> {\n let added = 0\n let removed = 0\n for (const line of lines) {\n if (line.kind === 'add') added += 1\n else if (line.kind === 'delete') removed += 1\n }\n return { added, removed }\n}\n\n/**\n * The target path from a unified diff's file header. Prefers `+++ b/<path>` —\n * git's explicit new-side marker — and skips `/dev/null`, which marks an added\n * or deleted side rather than naming a file. Only lines outside a hunk are\n * considered, for the same reason the parser tracks state.\n */\nexport function diffTargetPath(patch: string): string | null {\n for (const line of patch.split('\\n')) {\n if (line.startsWith('@@')) break\n const git = /^\\+\\+\\+ b\\/(.+?)(?:\\t|$)/.exec(line)\n if (git) return git[1]!\n const plain = /^\\+\\+\\+ ([^\\s/][^\\t]*?)(?:\\t|$)/.exec(line)\n if (plain && plain[1] !== '/dev/null') return plain[1]!\n const fromHeader = /^diff --git a\\/.+ b\\/(.+)/.exec(line)\n if (fromHeader) return fromHeader[1]!\n }\n return null\n}\n\nexport const diffLineVariants = cva('flex items-baseline font-code text-code', {\n variants: {\n kind: {\n add: 'bg-success-subtle text-foreground',\n delete: 'bg-destructive-subtle text-foreground',\n context: 'text-foreground',\n hunk: 'bg-muted text-muted-foreground',\n header: 'bg-muted font-semibold text-foreground',\n meta: 'text-muted-foreground italic',\n },\n },\n defaultVariants: { kind: 'context' },\n})\n\nexport type DiffBlockProps = Omit<ComponentProps<'div'>, 'children'> &\n VariantProps<typeof diffLineVariants> & {\n /** The unified diff. */\n patch: string\n /** A filename. Defaults to the path in the patch's header, or \"diff\". */\n title?: string\n /** False while the patch is still streaming. */\n complete?: boolean\n /** Show the two line-number gutters. Off for a fragment with no line numbers. */\n showLineNumbers?: boolean\n /** Extra header controls. */\n actions?: JSX.Element\n }\n\nexport function DiffBlock(props: DiffBlockProps) {\n const [local, rest] = splitProps(props, [\n 'patch',\n 'title',\n 'complete',\n 'showLineNumbers',\n 'actions',\n 'class',\n ])\n\n const lines = createMemo(() => parseDiff(local.patch))\n const stats = createMemo(() => diffStats(lines()))\n const name = () => local.title ?? diffTargetPath(local.patch)?.split('/').pop() ?? 'diff'\n\n return (\n <div\n class={cn('overflow-hidden rounded-xl border border-border bg-card', local.class)}\n {...rest}\n >\n <div class=\"flex items-center justify-between gap-2 border-b border-border px-3 py-1\">\n <span class=\"flex min-w-0 items-baseline gap-2\">\n <span class=\"truncate font-code text-code text-foreground\">{name()}</span>\n {/* The counts are text, so the summary survives greyscale and a reader\n who cannot separate the two line tones still gets the shape of it. */}\n <span class=\"shrink-0 font-code text-code text-muted-foreground\">\n <span class=\"text-foreground\">+{stats().added}</span>{' '}\n <span class=\"text-foreground\">−{stats().removed}</span>\n </span>\n </span>\n {local.actions}\n </div>\n <div\n class=\"scroll-fade overflow-x-auto\"\n tabindex=\"0\"\n role=\"region\"\n aria-label={`Diff for ${name()}`}\n >\n <div class=\"min-w-fit\">\n <For each={lines()}>\n {(line) => (\n <div class={diffLineVariants({ kind: line.kind })}>\n <Show when={numbered(line, local.showLineNumbers)}>\n <span\n class=\"w-10 shrink-0 pr-2 text-right text-code text-muted-foreground tabular-nums select-none\"\n aria-hidden=\"true\"\n >\n {line.oldLine ?? ''}\n </span>\n <span\n class=\"w-10 shrink-0 pr-2 text-right text-code text-muted-foreground tabular-nums select-none\"\n aria-hidden=\"true\"\n >\n {line.newLine ?? ''}\n </span>\n </Show>\n {/* The marker is the signal that is not a colour. */}\n <span class=\"w-4 shrink-0 text-center select-none\" aria-hidden=\"true\">\n {line.kind === 'add' ? '+' : line.kind === 'delete' ? '−' : ''}\n </span>\n <span class=\"min-w-0 whitespace-pre pr-4\">\n {/* A screen reader gets the kind as a word, not a glyph. */}\n <span class=\"visually-hidden\">\n {line.kind === 'add' ? 'Added: ' : line.kind === 'delete' ? 'Removed: ' : ''}\n </span>\n {line.text || ' '}\n </span>\n </div>\n )}\n </For>\n </div>\n <Show when={!local.complete}>\n <p class=\"px-3 py-1 text-xs text-muted-foreground italic\">Generating diff…</p>\n </Show>\n </div>\n </div>\n )\n}\n\n/**\n * A diff summary line, for a list of changes rather than one patch: the file and\n * its counts. Uses `CodeBlock`'s height rules and nothing else, because a summary\n * is a row and not a surface.\n */\nexport function DiffSummary(props: { patch: string; class?: string; onSelect?: () => void }) {\n const stats = createMemo(() => diffStats(parseDiff(props.patch)))\n const name = () => diffTargetPath(props.patch) ?? 'diff'\n\n return (\n <button\n type=\"button\"\n class={cn(\n 'flex w-full items-baseline justify-between gap-3 rounded-md px-2 py-1 text-left font-code text-code hover:bg-muted',\n props.class\n )}\n onClick={() => props.onSelect?.()}\n >\n <span class=\"truncate text-foreground\">{name()}</span>\n <span class=\"shrink-0 text-code\">\n <span class=\"text-foreground\">+{stats().added}</span>{' '}\n <span class=\"text-foreground\">−{stats().removed}</span>\n </span>\n </button>\n )\n}\n"],"mappings":";;;;;;;;;;AAoDA,IAAMW,cAAc;;;;;;;;;AAUpB,SAAgBC,UAAUC,OAAoC;CAC5D,MAAMC,QAAoB,CAAA;CAC1B,IAAIC,SAAS;CACb,IAAIN,UAAU;CACd,IAAIC,UAAU;CAEd,KAAK,MAAMM,OAAOH,MAAMI,QAAQ,OAAO,EAAE,CAAC,CAACC,MAAM,IAAI,GAAG;EACtD,IAAIP,YAAYQ,KAAKH,GAAG,GAAG;GACzB,MAAMI,QAAQT,YAAYU,KAAKL,GAAG;GAClCP,UAAUa,OAAOF,MAAM,EAAE;GACzBV,UAAUY,OAAOF,MAAM,EAAE;GACzBL,SAAS;GACTD,MAAMS,KAAK;IAAEjB,MAAM;IAAQC,MAAMS;IAAKR,QAAQ;GAAG,CAAC;GAClD;EACF;EAEA,IAAI,CAACO,QAAQ;GACX,MAAMS,eACJR,IAAIS,WAAW,YAAY,KAC3BT,IAAIS,WAAW,QAAQ,KACvBT,IAAIS,WAAW,UAAU,KACzBT,IAAIS,WAAW,cAAc,KAC7BT,IAAIS,WAAW,kBAAkB,KACjCT,IAAIS,WAAW,SAAS,KACxBT,IAAIS,WAAW,MAAM,KACrBT,IAAIS,WAAW,MAAM;GACvBX,MAAMS,KAAK;IAAEjB,MA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A,IAAC8E,OAAI;IAAA,OAAE,CAAC3B,MAAML;GAAQ;GAAA,IAAA0B,WAAA;IAAA,OAAAe,OAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAF,aAAAG,aAAAxB,OAAA,cAnCf,YAAYV,KAAK,GAAG,CAAA;EAAA,OAAAE;CAAA,EAAA,CAAA;AAyCxC;;;;;;AAOA,SAAgBiC,YAAYvC,OAAiE;CAC3F,MAAMG,QAAQvD,iBAAiB+B,UAAUnB,UAAUwC,MAAMvC,KAAK,CAAC,CAAC;CAChE,MAAM2C,aAAatB,eAAekB,MAAMvC,KAAK,KAAK;CAElD,cAAA;EAAA,IAAAgF,SAAAC,QAAA,GAAAC,SAAAF,OAAAhC,YAAAmC,SAAAD,OAAAhC,YAAAF;EAAAmC,OAAAnC;EAAA,IAAAoC,SAAAD,OAAAjC,YAAAA;EAAAkC,OAAApC;EAAAgC,OAAAK,gBAOmB9C,MAAMwC,WAAW;EAACrB,OAAAwB,QAEOvC,IAAI;EAAAe,OAAAyB,cAEVzC,MAAM,CAAC,CAACvB,OAAK,IAAA;EAAAuC,OAAA0B,cACb1C,MAAM,CAAC,CAACtB,SAAO,IAAA;EAAAsD,aAAAC,UAAAK,QAT1CxF,GACL,sHACA+C,MAAMkB,KACR,CAAC,CAAA;EAAA,OAAAuB;CAAA,EAAA,CAAA;AAUP;AAACM,eAAA,CAAA,OAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"diff-block.js","names":["createMemo","For","Show","splitProps","cva","cn","kind","text","marker","oldLine","newLine","HUNK_HEADER","parseDiff","patch","lines","inHunk","raw","replace","split","test","match","exec","Number","push","isFileHeader","startsWith","slice","numbered","line","show","Boolean","diffStats","added","removed","diffTargetPath","git","plain","fromHeader","diffLineVariants","variants","add","delete","context","hunk","header","meta","defaultVariants","title","complete","showLineNumbers","actions","DiffBlock","props","local","rest","stats","name","pop","_el$","_tmpl$2","_el$2","firstChild","_el$4","nextSibling","_el$6","_el$9","_el$1","_el$10","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","children","_el$12","_tmpl$4","_el$15","_el$16","_el$17","when","_el$13","_tmpl$3","_el$14","_c$","_$memo","_c$2","_$effect","_$className","_tmpl$","_$setAttribute","DiffSummary","onSelect","_el$18","_tmpl$5","_el$19","_el$21","_el$24","$$click","_$delegateEvents"],"sources":["../../../../src/components/ui/diff-block/diff-block.tsx"],"sourcesContent":["import { createMemo, For, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * DiffBlock.\n *\n * A unified diff, classified and toned. Parsing lives here because the\n * classification is the part that is easy to get subtly wrong and impossible to\n * fix from a caller: whether a line is an addition, a deletion, a hunk header,\n * a file header, or context depends on state — a line beginning with `+++` is a\n * file header *before* the first hunk and an added line beginning with `++`\n * *inside* one, and a renderer that tested prefixes without that state would\n * mis-colour real patches.\n *\n * The line grammar:\n *\n * | Prefix | Meaning |\n * | --- | --- |\n * | `diff --git`, `index`, `---`, `+++` (before a hunk) | file header |\n * | `@@` | hunk header |\n * | `+` | addition |\n * | `-` | deletion |\n * | `\\` | the \"no newline at end of file\" marker |\n * | anything else, including a leading space | context |\n *\n * Tones are pairs of surface and text, so an addition is readable in both\n * polarities and with any accent, the greens and reds are the theme's own\n * `success` and `destructive` at low alpha, not fixed hexes. Colour is never the\n * only signal: the gutter carries `+` or `-` as well, which is what makes the\n * block usable in greyscale and by anyone who cannot separate the two hues.\n *\n * Split (side-by-side) view is deliberately not implemented. It is a different\n * layout algorithm, pairing deletions with additions across hunks, and a\n * half-correct one is worse than none. `view=\"unified\"` is the only value, and\n * the prop exists so that adding the second is not a breaking change.\n */\n\nexport type DiffLineKind = 'add' | 'delete' | 'context' | 'hunk' | 'header' | 'meta'\n\nexport type DiffLine = Readonly<{\n kind: DiffLineKind\n /** The line without its diff prefix. */\n text: string\n /** The prefix as written: `+`, `-`, a space, or nothing for a header. */\n marker: string\n /** The old-side line number, when the line exists on the old side. */\n oldLine?: number\n /** The new-side line number, when the line exists on the new side. */\n newLine?: number\n}>\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/\n\n/**\n * Classify a unified diff.\n *\n * `headerState` is what makes `---` and `+++` unambiguous: git writes them as\n * file headers before the first `@@` and as content after it, and the two need\n * different tones. `oldLine`/`newLine` are tracked so the gutter can number both\n * sides, the numbers a reader uses to find the change in their editor.\n */\nexport function parseDiff(patch: string): readonly DiffLine[] {\n const lines: DiffLine[] = []\n let inHunk = false\n let oldLine = 0\n let newLine = 0\n\n for (const raw of patch.replace(/\\n$/, '').split('\\n')) {\n if (HUNK_HEADER.test(raw)) {\n const match = HUNK_HEADER.exec(raw)!\n oldLine = Number(match[1])\n newLine = Number(match[2])\n inHunk = true\n lines.push({ kind: 'hunk', text: raw, marker: '' })\n continue\n }\n\n if (!inHunk) {\n const isFileHeader =\n raw.startsWith('diff --git') ||\n raw.startsWith('index ') ||\n raw.startsWith('new file') ||\n raw.startsWith('deleted file') ||\n raw.startsWith('similarity index') ||\n raw.startsWith('rename ') ||\n raw.startsWith('--- ') ||\n raw.startsWith('+++ ')\n lines.push({ kind: isFileHeader ? 'header' : 'meta', text: raw, marker: '' })\n continue\n }\n\n if (raw.startsWith('\\\\')) {\n lines.push({ kind: 'meta', text: raw, marker: '' })\n continue\n }\n\n const marker = raw[0] ?? ' '\n if (marker === '+') {\n lines.push({ kind: 'add', text: raw.slice(1), marker, newLine })\n newLine += 1\n } else if (marker === '-') {\n lines.push({ kind: 'delete', text: raw.slice(1), marker, oldLine })\n oldLine += 1\n } else {\n lines.push({ kind: 'context', text: raw.slice(1), marker: ' ', oldLine, newLine })\n oldLine += 1\n newLine += 1\n }\n }\n\n return lines\n}\n\n/**\n * Whether a line gets gutter numbers. A hunk header and a file header are\n * structural, so numbering them would put a number on a line that has none.\n */\nfunction numbered(line: DiffLine, show: boolean | undefined): boolean {\n return Boolean(show) && line.kind !== 'hunk' && line.kind !== 'header' && line.kind !== 'meta'\n}\n\n/** The counts a diff summary reports: how much was added and removed. */\nexport function diffStats(\n lines: readonly DiffLine[]\n): Readonly<{ added: number; removed: number }> {\n let added = 0\n let removed = 0\n for (const line of lines) {\n if (line.kind === 'add') added += 1\n else if (line.kind === 'delete') removed += 1\n }\n return { added, removed }\n}\n\n/**\n * The target path from a unified diff's file header. Prefers `+++ b/<path>`,\n * git's explicit new-side marker, and skips `/dev/null`, which marks an added\n * or deleted side rather than naming a file. Only lines outside a hunk are\n * considered, for the same reason the parser tracks state.\n */\nexport function diffTargetPath(patch: string): string | null {\n for (const line of patch.split('\\n')) {\n if (line.startsWith('@@')) break\n const git = /^\\+\\+\\+ b\\/(.+?)(?:\\t|$)/.exec(line)\n if (git) return git[1]!\n const plain = /^\\+\\+\\+ ([^\\s/][^\\t]*?)(?:\\t|$)/.exec(line)\n if (plain && plain[1] !== '/dev/null') return plain[1]!\n const fromHeader = /^diff --git a\\/.+ b\\/(.+)/.exec(line)\n if (fromHeader) return fromHeader[1]!\n }\n return null\n}\n\nexport const diffLineVariants = cva('flex items-baseline font-code text-code', {\n variants: {\n kind: {\n add: 'bg-success-subtle text-foreground',\n delete: 'bg-destructive-subtle text-foreground',\n context: 'text-foreground',\n hunk: 'bg-muted text-muted-foreground',\n header: 'bg-muted font-semibold text-foreground',\n meta: 'text-muted-foreground italic',\n },\n },\n defaultVariants: { kind: 'context' },\n})\n\nexport type DiffBlockProps = Omit<ComponentProps<'div'>, 'children'> &\n VariantProps<typeof diffLineVariants> & {\n /** The unified diff. */\n patch: string\n /** A filename. Defaults to the path in the patch's header, or \"diff\". */\n title?: string\n /** False while the patch is still streaming. */\n complete?: boolean\n /** Show the two line-number gutters. Off for a fragment with no line numbers. */\n showLineNumbers?: boolean\n /** Extra header controls. */\n actions?: JSX.Element\n }\n\nexport function DiffBlock(props: DiffBlockProps) {\n const [local, rest] = splitProps(props, [\n 'patch',\n 'title',\n 'complete',\n 'showLineNumbers',\n 'actions',\n 'class',\n ])\n\n const lines = createMemo(() => parseDiff(local.patch))\n const stats = createMemo(() => diffStats(lines()))\n const name = () => local.title ?? diffTargetPath(local.patch)?.split('/').pop() ?? 'diff'\n\n return (\n <div\n class={cn('overflow-hidden rounded-xl border border-border bg-card', local.class)}\n {...rest}\n >\n <div class=\"flex items-center justify-between gap-2 border-b border-border px-3 py-1\">\n <span class=\"flex min-w-0 items-baseline gap-2\">\n <span class=\"truncate font-code text-code text-foreground\">{name()}</span>\n {/* The counts are text, so the summary survives greyscale and a reader\n who cannot separate the two line tones still gets the shape of it. */}\n <span class=\"shrink-0 font-code text-code text-muted-foreground\">\n <span class=\"text-foreground\">+{stats().added}</span>{' '}\n <span class=\"text-foreground\">−{stats().removed}</span>\n </span>\n </span>\n {local.actions}\n </div>\n <div\n class=\"scroll-fade overflow-x-auto\"\n tabindex=\"0\"\n role=\"region\"\n aria-label={`Diff for ${name()}`}\n >\n <div class=\"min-w-fit\">\n <For each={lines()}>\n {(line) => (\n <div class={diffLineVariants({ kind: line.kind })}>\n <Show when={numbered(line, local.showLineNumbers)}>\n <span\n class=\"w-10 shrink-0 pr-2 text-right text-code text-muted-foreground tabular-nums select-none\"\n aria-hidden=\"true\"\n >\n {line.oldLine ?? ''}\n </span>\n <span\n class=\"w-10 shrink-0 pr-2 text-right text-code text-muted-foreground tabular-nums select-none\"\n aria-hidden=\"true\"\n >\n {line.newLine ?? ''}\n </span>\n </Show>\n {/* The marker is the signal that is not a colour. */}\n <span class=\"w-4 shrink-0 text-center select-none\" aria-hidden=\"true\">\n {line.kind === 'add' ? '+' : line.kind === 'delete' ? '−' : ''}\n </span>\n <span class=\"min-w-0 whitespace-pre pr-4\">\n {/* A screen reader gets the kind as a word, not a glyph. */}\n <span class=\"visually-hidden\">\n {line.kind === 'add' ? 'Added: ' : line.kind === 'delete' ? 'Removed: ' : ''}\n </span>\n {line.text || ' '}\n </span>\n </div>\n )}\n </For>\n </div>\n <Show when={!local.complete}>\n <p class=\"px-3 py-1 text-xs text-muted-foreground italic\">Generating diff…</p>\n </Show>\n </div>\n </div>\n )\n}\n\n/**\n * A diff summary line, for a list of changes rather than one patch: the file and\n * its counts. Uses `CodeBlock`'s height rules and nothing else, because a summary\n * is a row and not a surface.\n */\nexport function DiffSummary(props: { patch: string; class?: string; onSelect?: () => void }) {\n const stats = createMemo(() => diffStats(parseDiff(props.patch)))\n const name = () => diffTargetPath(props.patch) ?? 'diff'\n\n return (\n <button\n type=\"button\"\n class={cn(\n 'flex w-full items-baseline justify-between gap-3 rounded-md px-2 py-1 text-left font-code text-code hover:bg-muted',\n props.class\n )}\n onClick={() => props.onSelect?.()}\n >\n <span class=\"truncate text-foreground\">{name()}</span>\n <span class=\"shrink-0 text-code\">\n <span class=\"text-foreground\">+{stats().added}</span>{' '}\n <span class=\"text-foreground\">−{stats().removed}</span>\n </span>\n </button>\n )\n}\n"],"mappings":";;;;;;;;;;AAoDA,IAAMW,cAAc;;;;;;;;;AAUpB,SAAgBC,UAAUC,OAAoC;CAC5D,MAAMC,QAAoB,CAAA;CAC1B,IAAIC,SAAS;CACb,IAAIN,UAAU;CACd,IAAIC,UAAU;CAEd,KAAK,MAAMM,OAAOH,MAAMI,QAAQ,OAAO,EAAE,CAAC,CAACC,MAAM,IAAI,GAAG;EACtD,IAAIP,YAAYQ,KAAKH,GAAG,GAAG;GACzB,MAAMI,QAAQT,YAAYU,KAAKL,GAAG;GAClCP,UAAUa,OAAOF,MAAM,EAAE;GACzBV,UAAUY,OAAOF,MAAM,EAAE;GACzBL,SAAS;GACTD,MAAMS,KAAK;IAAEjB,MAAM;IAAQC,MAAMS;IAAKR,QAAQ;GAAG,CAAC;GAClD;EACF;EAEA,IAAI,CAACO,QAAQ;GACX,MAAMS,eACJR,IAAIS,WAAW,YAAY,KAC3BT,IAAIS,WAAW,QAAQ,KACvBT,IAAIS,WAAW,UAAU,KACzBT,IAAIS,WAAW,cAAc,KAC7BT,IAAIS,WAAW,kBAAkB,KACjCT,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C,CAAA;IAAA,OAAAqE;GAAA,EAAA,CAAA;EA2BlD,CAAA,CAAA;EAAAJ,OAAAL,OAAAM,gBAGJtE,MAAI;GAAA,IAAC8E,OAAI;IAAA,OAAE,CAAC3B,MAAML;GAAQ;GAAA,IAAA0B,WAAA;IAAA,OAAAe,OAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAF,aAAAG,aAAAxB,OAAA,cAnCf,YAAYV,KAAK,GAAG,CAAA;EAAA,OAAAE;CAAA,EAAA,CAAA;AAyCxC;;;;;;AAOA,SAAgBiC,YAAYvC,OAAiE;CAC3F,MAAMG,QAAQvD,iBAAiB+B,UAAUnB,UAAUwC,MAAMvC,KAAK,CAAC,CAAC;CAChE,MAAM2C,aAAatB,eAAekB,MAAMvC,KAAK,KAAK;CAElD,cAAA;EAAA,IAAAgF,SAAAC,QAAA,GAAAC,SAAAF,OAAAhC,YAAAmC,SAAAD,OAAAhC,YAAAF;EAAAmC,OAAAnC;EAAA,IAAAoC,SAAAD,OAAAjC,YAAAA;EAAAkC,OAAApC;EAAAgC,OAAAK,gBAOmB9C,MAAMwC,WAAW;EAACrB,OAAAwB,QAEOvC,IAAI;EAAAe,OAAAyB,cAEVzC,MAAM,CAAC,CAACvB,OAAK,IAAA;EAAAuC,OAAA0B,cACb1C,MAAM,CAAC,CAACtB,SAAO,IAAA;EAAAsD,aAAAC,UAAAK,QAT1CxF,GACL,sHACA+C,MAAMkB,KACR,CAAC,CAAA;EAAA,OAAAuB;CAAA,EAAA,CAAA;AAUP;AAACM,eAAA,CAAA,OAAA,CAAA"}
|
|
@@ -5,12 +5,12 @@ import type { ComponentProps } from 'solid-js';
|
|
|
5
5
|
*
|
|
6
6
|
* A sheet the user can drag away: it opens from an edge, carries a handle, and
|
|
7
7
|
* closes by swipe as well as by button. That drag affordance is the reason to
|
|
8
|
-
* choose it over Sheet
|
|
8
|
+
* choose it over Sheet, the gesture is for content the user is *finishing*
|
|
9
9
|
* with (a summary, a queue, a confirmation), not for browsing.
|
|
10
10
|
*
|
|
11
11
|
* On a large window a Drawer is usually the wrong control: dragging is a touch
|
|
12
12
|
* idiom, and on a desktop the same content is better as a Sheet or a Dialog.
|
|
13
|
-
* The exceptions are the surfaces a pointer also drags naturally
|
|
13
|
+
* The exceptions are the surfaces a pointer also drags naturally, a bottom
|
|
14
14
|
* console, a media panel.
|
|
15
15
|
*
|
|
16
16
|
* corvu supplies the drag physics, the snap points and the pointer capture.
|
|
@@ -31,7 +31,7 @@ export type DrawerContentProps = Omit<ComponentProps<typeof DrawerPrimitive.Cont
|
|
|
31
31
|
*
|
|
32
32
|
* It is an affordance, not the drag target: corvu makes the whole sheet
|
|
33
33
|
* draggable, exactly as the platform's own sheets behave. So this is
|
|
34
|
-
* `aria-hidden` decoration that tells the user the sheet can be pulled
|
|
34
|
+
* `aria-hidden` decoration that tells the user the sheet can be pulled, it
|
|
35
35
|
* carries no behaviour and must not be the only thing that moves.
|
|
36
36
|
*/
|
|
37
37
|
withHandle?: boolean;
|
|
@@ -13,12 +13,12 @@ var _tmpl$4 = /*#__PURE__*/ template(`<div data-slot=drawer-footer>`);
|
|
|
13
13
|
*
|
|
14
14
|
* A sheet the user can drag away: it opens from an edge, carries a handle, and
|
|
15
15
|
* closes by swipe as well as by button. That drag affordance is the reason to
|
|
16
|
-
* choose it over Sheet
|
|
16
|
+
* choose it over Sheet, the gesture is for content the user is *finishing*
|
|
17
17
|
* with (a summary, a queue, a confirmation), not for browsing.
|
|
18
18
|
*
|
|
19
19
|
* On a large window a Drawer is usually the wrong control: dragging is a touch
|
|
20
20
|
* idiom, and on a desktop the same content is better as a Sheet or a Dialog.
|
|
21
|
-
* The exceptions are the surfaces a pointer also drags naturally
|
|
21
|
+
* The exceptions are the surfaces a pointer also drags naturally, a bottom
|
|
22
22
|
* console, a media panel.
|
|
23
23
|
*
|
|
24
24
|
* corvu supplies the drag physics, the snap points and the pointer capture.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","names":["DrawerPrimitive","splitProps","overlayDescription","overlayFooter","overlayHeader","overlayTitle","cn","Drawer","props","_$createComponent","DrawerTrigger","Trigger","DrawerOverlay","Overlay","local","rest","_$mergeProps","class","Content","withHandle","DrawerContent","Portal","children","_$memo","_el$","_tmpl$","_$effect","_$className","DrawerTitle","Label","DrawerDescription","Description","DrawerCloseButton","Close","DrawerHeader","_el$2","_tmpl$2","_$spread","DrawerBody","_el$3","_tmpl$3","DrawerFooter","_el$4","_tmpl$4"],"sources":["../../../../src/components/ui/drawer/drawer.tsx"],"sourcesContent":["import DrawerPrimitive from '@corvu/drawer'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { overlayDescription, overlayFooter, overlayHeader, overlayTitle } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * Drawer.\n *\n * A sheet the user can drag away: it opens from an edge, carries a handle, and\n * closes by swipe as well as by button. That drag affordance is the reason to\n * choose it over Sheet
|
|
1
|
+
{"version":3,"file":"drawer.js","names":["DrawerPrimitive","splitProps","overlayDescription","overlayFooter","overlayHeader","overlayTitle","cn","Drawer","props","_$createComponent","DrawerTrigger","Trigger","DrawerOverlay","Overlay","local","rest","_$mergeProps","class","Content","withHandle","DrawerContent","Portal","children","_$memo","_el$","_tmpl$","_$effect","_$className","DrawerTitle","Label","DrawerDescription","Description","DrawerCloseButton","Close","DrawerHeader","_el$2","_tmpl$2","_$spread","DrawerBody","_el$3","_tmpl$3","DrawerFooter","_el$4","_tmpl$4"],"sources":["../../../../src/components/ui/drawer/drawer.tsx"],"sourcesContent":["import DrawerPrimitive from '@corvu/drawer'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { overlayDescription, overlayFooter, overlayHeader, overlayTitle } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * Drawer.\n *\n * A sheet the user can drag away: it opens from an edge, carries a handle, and\n * closes by swipe as well as by button. That drag affordance is the reason to\n * choose it over Sheet, the gesture is for content the user is *finishing*\n * with (a summary, a queue, a confirmation), not for browsing.\n *\n * On a large window a Drawer is usually the wrong control: dragging is a touch\n * idiom, and on a desktop the same content is better as a Sheet or a Dialog.\n * The exceptions are the surfaces a pointer also drags naturally, a bottom\n * console, a media panel.\n *\n * corvu supplies the drag physics, the snap points and the pointer capture.\n */\nexport function Drawer(props: ComponentProps<typeof DrawerPrimitive>) {\n return <DrawerPrimitive {...props} />\n}\n\nexport function DrawerTrigger(props: ComponentProps<typeof DrawerPrimitive.Trigger>) {\n return <DrawerPrimitive.Trigger {...props} />\n}\n\nexport function DrawerOverlay(props: ComponentProps<typeof DrawerPrimitive.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <DrawerPrimitive.Overlay\n class={cn(\n 'fixed inset-0 z-(--z-drawer) bg-scrim/50',\n 'data-[open]:animate-in data-[open]:fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type DrawerContentProps = Omit<ComponentProps<typeof DrawerPrimitive.Content>, 'side'> & {\n /**\n * Not accepted here. corvu reads the side from the root `Drawer`, which uses it\n * for the drag axis and publishes it as `data-side`; a `side` on the content\n * would type-check through the polymorphic props and be silently ignored,\n * leaving the drawer on the bottom edge. Set `<Drawer side=\"right\">` instead.\n */\n side?: never\n /**\n * Draw the grabber at the leading edge of the sheet.\n *\n * It is an affordance, not the drag target: corvu makes the whole sheet\n * draggable, exactly as the platform's own sheets behave. So this is\n * `aria-hidden` decoration that tells the user the sheet can be pulled, it\n * carries no behaviour and must not be the only thing that moves.\n */\n withHandle?: boolean\n}\n\nexport function DrawerContent(props: DrawerContentProps) {\n const [local, rest] = splitProps(props, ['class', 'withHandle', 'children'])\n\n return (\n <DrawerPrimitive.Portal>\n <DrawerOverlay />\n <DrawerPrimitive.Content\n class={cn(\n 'group/drawer bg-background text-foreground fixed z-(--z-drawer) flex flex-col border-border shadow-lg',\n 'data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:max-h-[85vh] data-[side=bottom]:rounded-t-xl data-[side=bottom]:border-t',\n 'data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:max-h-[85vh] data-[side=top]:rounded-b-xl data-[side=top]:border-b',\n 'data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:w-80 data-[side=left]:rounded-e-xl data-[side=left]:border-e',\n 'data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:w-80 data-[side=right]:rounded-s-xl data-[side=right]:border-s',\n local.class\n )}\n {...rest}\n >\n {local.withHandle ? (\n <span\n aria-hidden=\"true\"\n class={cn(\n 'bg-muted shrink-0 self-center',\n 'group-data-[side=bottom]/drawer:mt-2 group-data-[side=bottom]/drawer:h-1.5 group-data-[side=bottom]/drawer:w-10 group-data-[side=bottom]/drawer:rounded-full'\n )}\n />\n ) : null}\n {local.children}\n </DrawerPrimitive.Content>\n </DrawerPrimitive.Portal>\n )\n}\n\nexport function DrawerTitle(props: ComponentProps<typeof DrawerPrimitive.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Label class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DrawerDescription(props: ComponentProps<typeof DrawerPrimitive.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\nexport function DrawerCloseButton(props: ComponentProps<typeof DrawerPrimitive.Close>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Close class={cn('focus-ring', local.class)} {...rest} />\n}\n\nexport function DrawerHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div data-slot=\"drawer-header\" class={cn(overlayHeader, 'p-5 pb-3', local.class)} {...rest} />\n )\n}\n\nexport function DrawerBody(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"drawer-body\"\n class={cn('min-h-0 flex-1 overflow-y-auto px-5 pb-4', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DrawerFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div data-slot=\"drawer-footer\" class={cn(overlayFooter, 'p-5 pt-3', local.class)} {...rest} />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgBO,OAAOC,OAA+C;CACpE,OAAAC,gBAAQT,iBAAoBQ,KAAK;AACnC;AAEA,SAAgBE,cAAcF,OAAuD;CACnF,OAAAC,gBAAQT,gBAAgBW,SAAYH,KAAK;AAC3C;AAEA,SAAgBI,cAAcJ,OAAuD;CACnF,MAAM,CAACM,OAAOC,QAAQd,WAAWO,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAC,gBACGT,gBAAgBa,SAAOG,WAAA,EAAA,KAAA,WAAA;EAAA,OACfV,GACL,4CACA,mGACAQ,MAAMG,KACR;CAAC,EAAA,GACGF,IAAI,CAAA;AAGd;AAqBA,SAAgBK,cAAcZ,OAA2B;CACvD,MAAM,CAACM,OAAOC,QAAQd,WAAWO,OAAO;EAAC;EAAS;EAAc;CAAU,CAAC;CAE3E,OAAAC,gBACGT,gBAAgBqB,QAAM,EAAA,IAAAC,WAAA;EAAA,OAAA,CAAAb,gBACpBG,eAAa,CAAA,CAAA,GAAAH,gBACbT,gBAAgBkB,SAAOF,WAAA,EAAA,KAAA,WAAA;GAAA,OACfV,GACL,yGACA,wJACA,sIACA,oIACA,0IACAQ,MAAMG,KACR;EAAC,EAAA,GACGF,MAAI,EAAA,IAAAO,WAAA;GAAA,OAAA,CAAAC,WAEPA,WAAA,CAAA,CAAAT,MAAMK,UAAU,CAAA,CAAA,WAAA;IAAA,IAAAK,OAAAC,OAAA;IAAAC,aAAAC,UAAAH,MAGNlB,GACL,iCACA,8JACF,CAAC,CAAA;IAAA,OAAAkB;GAAA,EAAA,CAAA,IAED,IAAI,GAAAD,WACPT,MAAMQ,QAAQ,CAAA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,OAAAE,OAAAvB,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWV,GAAG,4CAA4CQ,MAAMG,KAAK;EAAC,EAAA,GAC9DF,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAwB;CAAA,EAAA,CAAA;AAGd;AAEA,SAAgBE,aAAajC,OAA8B;CACzD,MAAM,CAACM,OAAOC,QAAQd,WAAWO,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAAkC,QAAAC,QAAA;EAAAN,OAAAK,OAAA1B,WAAA,EAAA,KAAA,WAAA;GAAA,OACwCV,GAAGH,eAAe,YAAYW,MAAMG,KAAK;EAAC,EAAA,GAAMF,IAAI,GAAA,OAAA,KAAA;EAAA,OAAA2B;CAAA,EAAA,CAAA;AAE9F"}
|
|
@@ -8,8 +8,8 @@ import type { ComponentProps } from 'solid-js';
|
|
|
8
8
|
* selected value needs the field-style control, and Popover for arbitrary
|
|
9
9
|
* content.
|
|
10
10
|
*
|
|
11
|
-
* Kobalte supplies the full menu contract
|
|
12
|
-
* highlight, Escape to close and return focus
|
|
11
|
+
* Kobalte supplies the full menu contract, arrow keys, typeahead, the roving
|
|
12
|
+
* highlight, Escape to close and return focus, which is exactly what a
|
|
13
13
|
* hand-rolled `div` with click handlers gets wrong.
|
|
14
14
|
* Menus are nonmodal by default so their generated focus guards do not become
|
|
15
15
|
* invalid direct children of the ARIA menu. Set `modal` explicitly when the
|
|
@@ -19,7 +19,7 @@ import type { ComponentProps } from 'solid-js';
|
|
|
19
19
|
* highlighted tint while keeping its label on the body foreground. Pairing it
|
|
20
20
|
* with an AlertDialog is the caller's job.
|
|
21
21
|
*
|
|
22
|
-
* An item that opens something else
|
|
22
|
+
* An item that opens something else, a dialog, a sheet, passes it as
|
|
23
23
|
* `onSelectAfterClose`, which runs once the menu has closed and returned focus
|
|
24
24
|
* to its trigger, so the next layer captures the trigger as the control to
|
|
25
25
|
* return to.
|
|
@@ -35,7 +35,7 @@ export type DropdownMenuContentProps = ComponentProps<typeof KobalteDropdownMenu
|
|
|
35
35
|
/**
|
|
36
36
|
* Kept for callers that hid the arrow explicitly; the arrow is now hidden by
|
|
37
37
|
* default. Pass `false` to draw one. The default flipped because Kobalte
|
|
38
|
-
* reserves half of the arrow's 30px box as popper gutter
|
|
38
|
+
* reserves half of the arrow's 30px box as popper gutter, a menu anchored to
|
|
39
39
|
* its trigger floated 15px off it, which read as a gap rather than as a
|
|
40
40
|
* pointer, and every anchored caller already passed `hideArrow`.
|
|
41
41
|
*/
|
|
@@ -63,7 +63,7 @@ declare const parts: {
|
|
|
63
63
|
};
|
|
64
64
|
export declare function DropdownMenuItem(props: ComponentProps<typeof parts.Item> & {
|
|
65
65
|
/**
|
|
66
|
-
* Runs after the menu has closed and returned focus to its trigger
|
|
66
|
+
* Runs after the menu has closed and returned focus to its trigger, the
|
|
67
67
|
* place to open a dialog or sheet, which then returns focus to the trigger.
|
|
68
68
|
*/
|
|
69
69
|
onSelectAfterClose?: () => void;
|
|
@@ -16,8 +16,8 @@ var DropdownMenuScopeContext = createContext();
|
|
|
16
16
|
* selected value needs the field-style control, and Popover for arbitrary
|
|
17
17
|
* content.
|
|
18
18
|
*
|
|
19
|
-
* Kobalte supplies the full menu contract
|
|
20
|
-
* highlight, Escape to close and return focus
|
|
19
|
+
* Kobalte supplies the full menu contract, arrow keys, typeahead, the roving
|
|
20
|
+
* highlight, Escape to close and return focus, which is exactly what a
|
|
21
21
|
* hand-rolled `div` with click handlers gets wrong.
|
|
22
22
|
* Menus are nonmodal by default so their generated focus guards do not become
|
|
23
23
|
* invalid direct children of the ARIA menu. Set `modal` explicitly when the
|
|
@@ -27,7 +27,7 @@ var DropdownMenuScopeContext = createContext();
|
|
|
27
27
|
* highlighted tint while keeping its label on the body foreground. Pairing it
|
|
28
28
|
* with an AlertDialog is the caller's job.
|
|
29
29
|
*
|
|
30
|
-
* An item that opens something else
|
|
30
|
+
* An item that opens something else, a dialog, a sheet, passes it as
|
|
31
31
|
* `onSelectAfterClose`, which runs once the menu has closed and returned focus
|
|
32
32
|
* to its trigger, so the next layer captures the trigger as the control to
|
|
33
33
|
* return to.
|