@adea-ai/ui 0.162.6 → 0.162.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/about-dialog/about-dialog.js +5 -5
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +3 -3
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js +2 -2
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +22 -22
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +10 -10
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +13 -13
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +12 -12
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +13 -13
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +9 -9
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +10 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -5
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.js +7 -7
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +5 -5
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +13 -13
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.js +7 -7
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +9 -9
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.js +5 -5
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +10 -10
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/icon-picker/image-data-url.js.map +1 -1
- package/dist/components/composites/icon-picker/shell-icons.js +117 -117
- package/dist/components/composites/icon-picker/shell-icons.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +7 -7
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.js +2 -2
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +7 -7
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +12 -12
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.js +5 -5
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/prompt-input/prompt-input.js +3 -3
- package/dist/components/composites/prompt-input/prompt-input.js.map +1 -1
- package/dist/components/composites/queue/queue.js +13 -13
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +5 -5
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js +16 -16
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +2 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +2 -2
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.js +5 -5
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.js +5 -5
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.js +2 -2
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +10 -10
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.js +6 -6
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.js +5 -5
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js +2 -2
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.js +5 -5
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.js +1 -1
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js +18 -18
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.js +17 -17
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.js +5 -5
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.js +6 -6
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +1 -1
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +23 -23
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +2 -2
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +6 -6
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +11 -11
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/atomic/chat-composer.js +1 -1
- package/dist/components/conversation/busy-send-button.js +10 -10
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.js +1 -1
- package/dist/components/conversation/composer-core.js +1 -1
- package/dist/components/conversation/composer-menu.js +2 -2
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +7 -7
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.js +1 -1
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +5 -5
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +9 -9
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.js +9 -9
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.js +13 -13
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +1 -1
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/scroll-follow.js +1 -1
- package/dist/components/conversation/thread-panel.js +5 -5
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.js +5 -5
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +2 -2
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js +7 -7
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/page/page.js +2 -2
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +1 -1
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-pane/pixel-pane.js +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +5 -5
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js +5 -5
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -2
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +2 -2
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -5
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/pane-focus.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +7 -7
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +5 -5
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
- package/dist/components/motion/presence.js +1 -1
- package/dist/components/theme/appearance-panel.js +3 -3
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.js +3 -3
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/script-projection.js +1 -1
- package/dist/components/theme/theme-catalogue-source.js +1 -1
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js +7 -7
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-picker.js +2 -2
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.js +1 -1
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-provider.js +1 -1
- package/dist/components/theme/theme-toggle.js +7 -7
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js +13 -13
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.js +12 -12
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +14 -14
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +2 -2
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js +16 -16
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +1 -1
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.js +2 -2
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +7 -7
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble/bubble.js +2 -2
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button-group/button-group.js +2 -2
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +8 -8
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.js +2 -2
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.js +8 -8
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart.js +2 -2
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +6 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.js +6 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +7 -7
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js +21 -21
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/value-combobox.js +1 -1
- package/dist/components/ui/command/command.js +23 -23
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -2
- package/dist/components/ui/detail-panel/detail-panel.js +5 -5
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +2 -2
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +21 -21
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.js +2 -2
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js +14 -14
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +10 -10
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.js +5 -5
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +2 -2
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.js +14 -14
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js +2 -2
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js +10 -10
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input/input-control.js +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.js +2 -2
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js +2 -2
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.js +2 -2
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.js +2 -2
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js +7 -7
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.js +3 -3
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +2 -2
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js +5 -5
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +18 -18
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +28 -28
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.js +15 -15
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.js +5 -5
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +10 -10
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +9 -9
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js +11 -11
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js +21 -21
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/separator/separator.js +5 -5
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js +6 -6
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.js +5 -5
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js +5 -5
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +2 -2
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.js +4 -4
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/table/table.js +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +7 -7
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +2 -2
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js +7 -7
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.js +6 -6
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js +7 -8
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.js +6 -6
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -1
- package/dist/components/ui/tooltip/lazy-tooltip.js +2 -2
- package/dist/components/ui/tooltip/tooltip.js +10 -10
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.js +19 -19
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.js +2 -2
- package/dist/lib/accent-presets.js +1 -1
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/async-action.js +1 -1
- package/dist/lib/create-poll.js +1 -1
- package/dist/lib/create-poll.js.map +1 -1
- package/dist/lib/external-link.js +1 -1
- package/dist/lib/external-link.js.map +1 -1
- package/dist/lib/fast-icon.js +1 -1
- package/dist/lib/theme-css.js +1 -1
- package/dist/lib/theme-engine-light.js +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-records.js +1 -1
- package/dist/lib/themes.js +1 -1
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/vite/source-parser.js +1 -1
- package/dist/vite/tailwind-sources.js +1 -1
- package/package.json +7 -7
package/dist/lib/accent-roles.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { accentRoles, accentValue, primarySubtleCss } from "@adea-ai/themes";
|
|
2
|
+
import { contrastRatio as contrastRatio$1, oklchToHex, parseColor as parseColor$1, repairContrast } from "@adea-ai/themes/oklch";
|
|
1
3
|
import { getAccent as getAccent$1 } from "./accent-presets.js";
|
|
2
4
|
import { isThemeAccentId } from "./theme-accents.js";
|
|
3
5
|
import "./theme-defaults.js";
|
|
4
|
-
import { accentRoles, accentValue, primarySubtleCss } from "@adea-ai/themes";
|
|
5
|
-
import { contrastRatio as contrastRatio$1, oklchToHex, parseColor as parseColor$1, repairContrast } from "@adea-ai/themes/oklch";
|
|
6
6
|
// src/lib/accent-roles.ts
|
|
7
7
|
var HEX = /^#([0-9a-fA-F]+)$/;
|
|
8
8
|
/** Parse a hex colour (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`). `undefined` for anything else. */
|
package/dist/lib/async-action.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { boundText } from "./text.js";
|
|
2
1
|
import { createSignal, getOwner, onCleanup } from "solid-js";
|
|
2
|
+
import { boundText } from "./text.js";
|
|
3
3
|
// src/lib/async-action.ts
|
|
4
4
|
/** How much of a rejection's own message is shown; the host usually knows why it failed. */
|
|
5
5
|
var ERROR_TEXT_LIMIT = 200;
|
package/dist/lib/create-poll.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-poll.js","names":[],"sources":["../../src/lib/create-poll.ts"],"sourcesContent":["import { createEffect, createSignal, onCleanup, type Accessor } from 'solid-js'\nimport { isServer } from '@solidjs/web'\n\nexport type PollOptions = {\n /** Run once as soon as the poll starts, before the first interval. Default `true`. */\n immediate?: boolean\n /**\n * Keep polling while the document is hidden (a background tab, a minimised\n * window). Default `false`: a hidden page pauses, and becoming visible again\n * runs at once when an interval was missed, then resumes the schedule.\n */\n whileHidden?: boolean\n}\n\nexport type Poll = {\n /** Run now, outside the schedule, and restart the interval from here. */\n refresh: () => Promise<void>\n /** Whether a run is in flight. */\n running: Accessor<boolean>\n}\n\n/**\n * A polling loop with the behaviour every hand-written one has to remember.\n *\n * - **Paused while hidden.** A background window does not wake the CPU or hit the\n * network for data nobody can see; on return it catches up with one run.\n * - **No overlap.** The next interval is scheduled after the previous run settles,\n * so a slow request cannot stack up behind itself.\n * - **Reactive interval.** `interval` may be an accessor; `false` (or `0`) stops the\n * loop, and a new value reschedules it.\n * - **Owned.** It stops with the owner that created it.\n *\n * A failed run is the task's business: a rejection is caught so the loop survives,\n * and the next interval runs as usual.\n *\n * ```ts\n * const poll = createPoll(() => refetch(), 5_000)\n * // after a user action that changes the data:\n * void poll.refresh()\n * ```\n */\nexport function createPoll(\n task: () => unknown,\n interval: number | false | Accessor<number | false>,\n options: PollOptions = {}\n): Poll {\n const [running, setRunning] = createSignal(false)\n const [hidden, setHidden] = createSignal(\n !isServer && !options.whileHidden && typeof document !== 'undefined' && document.hidden\n )\n const period = typeof interval === 'function' ? interval : () => interval\n let timer: ReturnType<typeof setTimeout> | undefined\n let missed = false\n let disposed = false\n let inFlight: Promise<void> | undefined\n let started = false\n let lastPeriod: number | false = false\n let rescheduleOnVisible = false\n\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n }\n\n const schedule = () => {\n clear()\n // The interval the effect last applied, not a fresh read: schedule runs from\n // timers and the effect's apply phase, neither of which tracks.\n const ms = lastPeriod\n if (disposed || !ms || ms <= 0) return\n timer = setTimeout(() => {\n timer = undefined\n if (hidden()) {\n missed = true\n return\n }\n void run()\n }, ms)\n }\n\n const run = (): Promise<void> => {\n if (inFlight) return inFlight\n clear()\n setRunning(true)\n // The task starts synchronously; only its settling is awaited. A task that\n // throws before returning is still a settled run, never a stuck one.\n let result: unknown\n try {\n result = task()\n } catch {\n result = undefined\n }\n inFlight = Promise.resolve(result)\n .catch(() => {\n // The task reports its own failures; the loop keeps going.\n })\n .then(() => {\n inFlight = undefined\n if (!disposed) {\n setRunning(false)\n schedule()\n }\n })\n return inFlight\n }\n\n if (!isServer && !options.whileHidden && typeof document !== 'undefined') {\n const onVisibility = () => setHidden(document.hidden)\n document.addEventListener('visibilitychange', onVisibility)\n onCleanup(() => document.removeEventListener('visibilitychange', onVisibility))\n }\n\n createEffect(\n () => ({ ms: period(), isHidden: hidden() }),\n ({ ms, isHidden }) => {\n if (isServer) return\n const periodChanged = ms !== lastPeriod\n lastPeriod = ms\n if (!ms || ms <= 0) {\n clear()\n return\n }\n if (!started) {\n started = true\n if (options.immediate === false || isHidden) {\n // A start while hidden owes the immediate run to the first visible moment.\n missed = isHidden && options.immediate !== false\n schedule()\n } else void run()\n return\n }\n if (isHidden) {\n // A new interval while hidden is owed a schedule on return: no timer may be\n // pending (a `false` cleared it), and nothing else would start one.\n if (periodChanged) rescheduleOnVisible = true\n return\n }\n const reschedule = periodChanged || rescheduleOnVisible\n rescheduleOnVisible = false\n if (missed) {\n missed = false\n void run()\n } else if (reschedule && !inFlight) schedule()\n }\n )\n\n onCleanup(() => {\n disposed = true\n clear()\n })\n\n return { refresh: run, running }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,WACd,MACA,UACA,UAAuB,CAAC,GAClB;CACN,MAAM,CAAC,SAAS,cAAc,aAAa,KAAK;CAChD,MAAM,CAAC,QAAQ,aAAa,aAC1B,CAAC,YAAY,CAAC,QAAQ,eAAe,OAAO,aAAa,eAAe,SAAS,MACnF;CACA,MAAM,SAAS,OAAO,aAAa,aAAa,iBAAiB;CACjE,IAAI;CACJ,IAAI,SAAS;CACb,IAAI,WAAW;CACf,IAAI;CACJ,IAAI,UAAU;CACd,IAAI,aAA6B;CACjC,IAAI,sBAAsB;CAE1B,MAAM,cAAc;EAClB,IAAI,UAAU,KAAA,GAAW,aAAa,KAAK;EAC3C,QAAQ,KAAA;CACV;CAEA,MAAM,iBAAiB;EACrB,MAAM;EAGN,MAAM,KAAK;EACX,IAAI,YAAY,CAAC,MAAM,MAAM,GAAG;EAChC,QAAQ,iBAAiB;GACvB,QAAQ,KAAA;GACR,IAAI,OAAO,GAAG;IACZ,SAAS;IACT;GACF;
|
|
1
|
+
{"version":3,"file":"create-poll.js","names":[],"sources":["../../src/lib/create-poll.ts"],"sourcesContent":["import { createEffect, createSignal, onCleanup, type Accessor } from 'solid-js'\nimport { isServer } from '@solidjs/web'\n\nexport type PollOptions = {\n /** Run once as soon as the poll starts, before the first interval. Default `true`. */\n immediate?: boolean\n /**\n * Keep polling while the document is hidden (a background tab, a minimised\n * window). Default `false`: a hidden page pauses, and becoming visible again\n * runs at once when an interval was missed, then resumes the schedule.\n */\n whileHidden?: boolean\n}\n\nexport type Poll = {\n /** Run now, outside the schedule, and restart the interval from here. */\n refresh: () => Promise<void>\n /** Whether a run is in flight. */\n running: Accessor<boolean>\n}\n\n/**\n * A polling loop with the behaviour every hand-written one has to remember.\n *\n * - **Paused while hidden.** A background window does not wake the CPU or hit the\n * network for data nobody can see; on return it catches up with one run.\n * - **No overlap.** The next interval is scheduled after the previous run settles,\n * so a slow request cannot stack up behind itself.\n * - **Reactive interval.** `interval` may be an accessor; `false` (or `0`) stops the\n * loop, and a new value reschedules it.\n * - **Owned.** It stops with the owner that created it.\n *\n * A failed run is the task's business: a rejection is caught so the loop survives,\n * and the next interval runs as usual.\n *\n * ```ts\n * const poll = createPoll(() => refetch(), 5_000)\n * // after a user action that changes the data:\n * void poll.refresh()\n * ```\n */\nexport function createPoll(\n task: () => unknown,\n interval: number | false | Accessor<number | false>,\n options: PollOptions = {}\n): Poll {\n const [running, setRunning] = createSignal(false)\n const [hidden, setHidden] = createSignal(\n !isServer && !options.whileHidden && typeof document !== 'undefined' && document.hidden\n )\n const period = typeof interval === 'function' ? interval : () => interval\n let timer: ReturnType<typeof setTimeout> | undefined\n let missed = false\n let disposed = false\n let inFlight: Promise<void> | undefined\n let started = false\n let lastPeriod: number | false = false\n let rescheduleOnVisible = false\n\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n }\n\n const schedule = () => {\n clear()\n // The interval the effect last applied, not a fresh read: schedule runs from\n // timers and the effect's apply phase, neither of which tracks.\n const ms = lastPeriod\n if (disposed || !ms || ms <= 0) return\n timer = setTimeout(() => {\n timer = undefined\n if (hidden()) {\n missed = true\n return\n }\n void run()\n }, ms)\n }\n\n const run = (): Promise<void> => {\n if (inFlight) return inFlight\n clear()\n setRunning(true)\n // The task starts synchronously; only its settling is awaited. A task that\n // throws before returning is still a settled run, never a stuck one.\n let result: unknown\n try {\n result = task()\n } catch {\n result = undefined\n }\n inFlight = Promise.resolve(result)\n .catch(() => {\n // The task reports its own failures; the loop keeps going.\n })\n .then(() => {\n inFlight = undefined\n if (!disposed) {\n setRunning(false)\n schedule()\n }\n })\n return inFlight\n }\n\n if (!isServer && !options.whileHidden && typeof document !== 'undefined') {\n const onVisibility = () => setHidden(document.hidden)\n document.addEventListener('visibilitychange', onVisibility)\n onCleanup(() => document.removeEventListener('visibilitychange', onVisibility))\n }\n\n createEffect(\n () => ({ ms: period(), isHidden: hidden() }),\n ({ ms, isHidden }) => {\n if (isServer) return\n const periodChanged = ms !== lastPeriod\n lastPeriod = ms\n if (!ms || ms <= 0) {\n clear()\n return\n }\n if (!started) {\n started = true\n if (options.immediate === false || isHidden) {\n // A start while hidden owes the immediate run to the first visible moment.\n missed = isHidden && options.immediate !== false\n schedule()\n } else void run()\n return\n }\n if (isHidden) {\n // A new interval while hidden is owed a schedule on return: no timer may be\n // pending (a `false` cleared it), and nothing else would start one.\n if (periodChanged) rescheduleOnVisible = true\n return\n }\n const reschedule = periodChanged || rescheduleOnVisible\n rescheduleOnVisible = false\n if (missed) {\n missed = false\n void run()\n } else if (reschedule && !inFlight) schedule()\n }\n )\n\n onCleanup(() => {\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CAChF;CAEA,oBACS;EAAE,IAAI,OAAO;EAAG,UAAU,OAAO;CAAE,KACzC,EAAE,IAAI,eAAe;EACpB,IAAI,UAAU;EACd,MAAM,gBAAgB,OAAO;EAC7B,aAAa;EACb,IAAI,CAAC,MAAM,MAAM,GAAG;GAClB,MAAM;GACN;EACF;EACA,IAAI,CAAC,SAAS;GACZ,UAAU;GACV,IAAI,QAAQ,cAAc,SAAS,UAAU;IAE3C,SAAS,YAAY,QAAQ,cAAc;IAC3C,SAAS;GACX,OAAY,IAAI;GAChB;EACF;EACA,IAAI,UAAU;GAGZ,IAAI,eAAe,sBAAsB;GACzC;EACF;EACA,MAAM,aAAa,iBAAiB;EACpC,sBAAsB;EACtB,IAAI,QAAQ;GACV,SAAS;GACJ,IAAI;EACX,OAAO,IAAI,cAAc,CAAC,UAAU,SAAS;CAC/C,CACF;CAEA,gBAAgB;EACd,WAAW;EACX,MAAM;CACR,CAAC;CAED,OAAO;EAAE,SAAS;EAAK;CAAQ;AACjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createLatestAction } from "./async-action.js";
|
|
2
1
|
import { createSignal } from "solid-js";
|
|
2
|
+
import { createLatestAction } from "./async-action.js";
|
|
3
3
|
// src/lib/external-link.ts
|
|
4
4
|
/** Opens an anchor's address through the host when the host supplies a way to. */
|
|
5
5
|
function createExternalLinkOpener(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-link.js","names":[],"sources":["../../src/lib/external-link.ts"],"sourcesContent":["import { createSignal, type Accessor } from 'solid-js'\nimport { createLatestAction } from './async-action'\n\nexport type ExternalLinkOpener = {\n /** The failure sentence while the newest open has failed, otherwise empty. */\n error: Accessor<string>\n /**\n * A link's click handler. With a host `open` the browser navigation is replaced\n * by it (a desktop shell opens the system browser); without one the anchor's\n * own `href` and `target` do the work.\n */\n onClick(url: string): (event: MouseEvent) => void\n /** Forgets the error and any open in flight, e.g. when the surface closes. */\n reset(): void\n}\n\n/** Opens an anchor's address through the host when the host supplies a way to. */\nexport function createExternalLinkOpener(options: {\n open: () => ((url: string) => Promise<void>) | undefined\n failure: string\n}): ExternalLinkOpener {\n const action = createLatestAction()\n const [error, setError] = createSignal('')\n return {\n error,\n reset() {\n action.invalidate()\n setError('')\n },\n onClick: (url) => (event) => {\n const open = options.open()\n if (!open) return\n event.preventDefault()\n setError('')\n void action\n .run(() => open(url))\n .then((outcome) => {\n if (outcome.status === 'failed') setError(options.failure)\n })\n },\n }\n}\n"],"mappings":";;;;AAiBA,SAAgB,yBAAyB,SAGlB;CACrB,MAAM,SAAS,mBAAmB;CAClC,MAAM,CAAC,OAAO,YAAY,aAAa,EAAE;CACzC,OAAO;EACL;EACA,QAAQ;GACN,OAAO,WAAW;GAClB,SAAS,EAAE;EACb;EACA,UAAU,SAAS,UAAU;GAC3B,MAAM,OAAO,QAAQ,KAAK;GAC1B,IAAI,CAAC,MAAM;GACX,MAAM,eAAe;GACrB,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"external-link.js","names":[],"sources":["../../src/lib/external-link.ts"],"sourcesContent":["import { createSignal, type Accessor } from 'solid-js'\nimport { createLatestAction } from './async-action'\n\nexport type ExternalLinkOpener = {\n /** The failure sentence while the newest open has failed, otherwise empty. */\n error: Accessor<string>\n /**\n * A link's click handler. With a host `open` the browser navigation is replaced\n * by it (a desktop shell opens the system browser); without one the anchor's\n * own `href` and `target` do the work.\n */\n onClick(url: string): (event: MouseEvent) => void\n /** Forgets the error and any open in flight, e.g. when the surface closes. */\n reset(): void\n}\n\n/** Opens an anchor's address through the host when the host supplies a way to. */\nexport function createExternalLinkOpener(options: {\n open: () => ((url: string) => Promise<void>) | undefined\n failure: string\n}): ExternalLinkOpener {\n const action = createLatestAction()\n const [error, setError] = createSignal('')\n return {\n error,\n reset() {\n action.invalidate()\n setError('')\n },\n onClick: (url) => (event) => {\n const open = options.open()\n if (!open) return\n event.preventDefault()\n setError('')\n void action\n .run(() => open(url))\n .then((outcome) => {\n if (outcome.status === 'failed') setError(options.failure)\n })\n },\n }\n}\n"],"mappings":";;;;AAiBA,SAAgB,yBAAyB,SAGlB;CACrB,MAAM,SAAS,mBAAmB;CAClC,MAAM,CAAC,OAAO,YAAY,aAAa,EAAE;CACzC,OAAO;EACL;EACA,QAAQ;GACN,OAAO,WAAW;GAClB,SAAS,EAAE;EACb;EACA,UAAU,SAAS,UAAU;GAC3B,MAAM,OAAO,QAAQ,KAAK;GAC1B,IAAI,CAAC,MAAM;GACX,MAAM,eAAe;GACrB,SAAS,EAAE;GACN,OACF,UAAU,KAAK,GAAG,CAAC,CAAC,CACpB,MAAM,YAAY;IACjB,IAAI,QAAQ,WAAW,UAAU,SAAS,QAAQ,OAAO;GAC3D,CAAC;EACL;CACF;AACF"}
|
package/dist/lib/fast-icon.js
CHANGED
package/dist/lib/theme-css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { THEME_EDITOR_PROPERTIES, THEME_TERMINAL_PROPERTIES, rolesAsProperties } from "./theme-types.js";
|
|
2
1
|
import { primaryHover } from "@adea-ai/themes";
|
|
3
2
|
import { formatOklch, oklchToHex, parseColor, shiftLightness } from "@adea-ai/themes/oklch";
|
|
3
|
+
import { THEME_EDITOR_PROPERTIES, THEME_TERMINAL_PROPERTIES, rolesAsProperties } from "./theme-types.js";
|
|
4
4
|
// src/lib/theme-css.ts
|
|
5
5
|
/**
|
|
6
6
|
* The mapping from a variant's roles to this system's custom properties, without the
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DEFAULT_FLOOR_EDITOR, DEFAULT_PRIMARY_SUBTLE, DEFAULT_THEME_ACCENTS, DEFAULT_VARIANTS } from "./theme-defaults.generated.js";
|
|
2
|
+
import { primarySubtleCss } from "@adea-ai/themes";
|
|
2
3
|
import { accentOverrideVariables, resolveAccentRoles } from "./accent-roles.js";
|
|
3
4
|
import { isThemeAccentId } from "./theme-accents.js";
|
|
4
5
|
import { themeCssVariablesWith } from "./theme-css.js";
|
|
5
6
|
import { defaultDarkThemeId, defaultLightThemeId, isDefaultThemeId } from "./theme-defaults.js";
|
|
6
7
|
import { needsData, pairNeedsData } from "./theme-engine.js";
|
|
7
|
-
import { primarySubtleCss } from "@adea-ai/themes";
|
|
8
8
|
// src/lib/theme-engine-light.ts
|
|
9
9
|
var defaultVariantList = [DEFAULT_VARIANTS[defaultLightThemeId], DEFAULT_VARIANTS[defaultDarkThemeId]];
|
|
10
10
|
var isShippedVariant = (variant) => isDefaultThemeId(variant.id) && DEFAULT_VARIANTS[variant.id] === variant;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import adeaDark from "@adea-ai/themes/themes/adea-dark";
|
|
2
|
+
import adeaLight from "@adea-ai/themes/themes/adea-light";
|
|
1
3
|
import { editorRolesHex, opaqueHex, parseVsCodeTheme, syntaxRolesHex, themeAccentPresets, vsCodeSyntax } from "@adea-ai/themes";
|
|
2
4
|
import { oklchToHex, parseColor as parseOklchColor } from "@adea-ai/themes/oklch";
|
|
3
5
|
import { shadcnDestructiveProjection, shadcnVariables } from "@adea-ai/themes/adapters/shadcn";
|
|
4
|
-
import adeaDark from "@adea-ai/themes/themes/adea-dark";
|
|
5
|
-
import adeaLight from "@adea-ai/themes/themes/adea-light";
|
|
6
6
|
import { toXtermTheme } from "@adea-ai/themes/adapters/xterm";
|
|
7
7
|
// src/lib/theme-projection.ts
|
|
8
8
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { THEME_COLOR_PROPERTIES, THEME_EDITOR_PROPERTIES, THEME_TERMINAL_PROPERTIES, pickRoles } from "./theme-types.js";
|
|
2
1
|
import { chartSeries, shadcnDestructiveProjection, statusForeground, syntaxRoles, tint } from "@adea-ai/themes";
|
|
3
2
|
import { shadcnVariables } from "@adea-ai/themes/adapters/shadcn";
|
|
3
|
+
import { THEME_COLOR_PROPERTIES, THEME_EDITOR_PROPERTIES, THEME_TERMINAL_PROPERTIES, pickRoles } from "./theme-types.js";
|
|
4
4
|
// src/lib/theme-records.ts
|
|
5
5
|
/**
|
|
6
6
|
* One catalogue record, as this system's {@link ThemeVariant}.
|
package/dist/lib/themes.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { accentForeground, contrastRatio, editorRolesHex, getAccent, getTheme, hasTheme, primarySubtleCss, themeAccentPresets, themes, themesByAppearance, validateCatalogue } from "@adea-ai/themes";
|
|
1
2
|
import { accentOverrideVariables, resolveAccentRoles } from "./accent-roles.js";
|
|
2
3
|
import { isThemeAccentId } from "./theme-accents.js";
|
|
3
4
|
import { terminalCssVariables, themeCssVariablesWith, tokensAsHex } from "./theme-css.js";
|
|
@@ -5,7 +6,6 @@ import { cataloguePair, defaultDarkThemeId, defaultLightThemeId, defaultThemePai
|
|
|
5
6
|
import { lazyVariantFromRecord, variantFromRecord } from "./theme-records.js";
|
|
6
7
|
import { THEME_EDITOR_PROPERTIES, pickRoles } from "./theme-types.js";
|
|
7
8
|
import { accents } from "./accent-presets.js";
|
|
8
|
-
import { accentForeground, contrastRatio, editorRolesHex, getAccent, getTheme, hasTheme, primarySubtleCss, themeAccentPresets, themes, themesByAppearance, validateCatalogue } from "@adea-ai/themes";
|
|
9
9
|
// src/lib/themes.ts
|
|
10
10
|
/**
|
|
11
11
|
* The theme registry, now a bridge.
|
package/dist/lib/themes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.js","names":["catalogue","themes"],"sources":["../../src/lib/themes.ts"],"sourcesContent":["/**\n * The theme registry, now a bridge.\n *\n * The catalogue itself lives in `@adea-ai/themes`. This module is what is left in\n * the design system: the translation between the catalogue's **canonical** role\n * names and the **shadcn** vocabulary every component here is written against, plus\n * the handful of custom properties this system declares that are presentations of\n * data the catalogue already holds, the `--terminal-*` ramp, the `--editor-*` ramp,\n * and `--chrome`.\n *\n * ## Why it is a bridge and not a copy\n *\n * This file used to hold thirteen themes as hand-written hex literal tables, with its\n * own contrast validator, its own terminal and editor palettes, and its own\n * provenance records. That is a lot of surface to maintain for one consumer of a\n * palette, and it meant every product that wanted the same themes, Adea, Cortana,\n * either imported this package or wrote its own. The catalogue moved out so that\n * there is one answer to \"what is Catppuccin Mocha\", and this file is the part that\n * genuinely belongs to the design system.\n *\n * It is deliberately thin. If you are looking for a colour, it is not here: see\n * `@adea-ai/themes`, whose README explains how the values are produced and whose\n * `NOTICE` records where every palette came from.\n *\n * ## The mapping, and the entry that is not a rename\n *\n * The package-owned `shadcnVariables` adapter maps canonical roles onto this\n * system's vocabulary. One entry will trip a reader: the catalogue's `accent`\n * becomes this system's `primary`, because in the shadcn vocabulary `--primary` is\n * the action colour, the fill of a primary button, the thing a focus ring is drawn\n * in, while `--accent` is a low-contrast hover wash. The catalogue's `accent` is\n * the former, so it goes to `--primary`, and `--accent` is filled from\n * `surfaceHover`, which is what shadcn components actually use it for.\n */\n\nimport {\n accentForeground,\n editorRolesHex,\n getAccent,\n getTheme,\n hasTheme,\n primarySubtleCss,\n themes as catalogue,\n themesByAppearance,\n themeAccentPresets,\n validateCatalogue,\n type AccentPreset,\n type AdeaTheme,\n type AdeaThemeRecord,\n type ContrastFinding,\n} from '@adea-ai/themes'\nimport { accentOverrideVariables, resolveAccentRoles, type AccentRoles } from './accent-roles'\nimport { isThemeAccentId } from './theme-accents'\nimport { themeCssVariablesWith } from './theme-css'\nimport { THEME_DEFAULT_ID, cataloguePair, defaultThemePair } from './theme-defaults'\nimport { lazyVariantFromRecord } from './theme-records'\nimport {\n THEME_EDITOR_PROPERTIES,\n pickRoles,\n type AccentVariableOptions,\n type EditorRolesMode,\n type ThemeAppearance,\n type ThemeCssVariableOptions,\n type ThemeEditorPalette,\n type ThemePair,\n type ThemeVariant,\n} from './theme-types'\n\nexport { accents } from './accent-presets'\nexport { isThemeAccentId } from './theme-accents'\nexport { terminalCssVariables, tokensAsHex } from './theme-css'\nexport { defaultDarkThemeId, defaultLightThemeId, resolveVariant } from './theme-defaults'\nexport { variantFromRecord } from './theme-records'\nexport type {\n AccentVariableOptions,\n EditorRolesMode,\n ThemeAppearance,\n ThemeColors,\n ThemeCssVariableOptions,\n ThemeEditorPalette,\n ThemeProvenance,\n ThemeTerminalPalette,\n ThemeVariant,\n} from './theme-types'\n\n/**\n * A variant's `--primary-subtle`: the tint over `var(--primary)` at the strength its\n * catalogue record measures (`primarySubtleAlpha`). A variant that is not in the\n * catalogue has nothing to measure, and gets its appearance's ceiling.\n */\nexport function primarySubtleFor(theme: Pick<ThemeVariant, 'id' | 'appearance'>): string {\n const record = getTheme(theme.id)\n return record ? primarySubtleCss(record) : primarySubtleCss(theme.appearance)\n}\n\n/**\n * The catalogue, in catalogue order.\n *\n * The `@__PURE__` marks let a bundler drop the whole table, and with it the catalogue,\n * from a consumer that imports only this module's catalogue-free helpers\n * (`tokensAsHex`, `isThemeAccentId`, `resolveVariant`…) and never reads it.\n */\nexport const builtinThemes: readonly ThemeVariant[] = /* @__PURE__ */ Object.freeze(\n /* @__PURE__ */ catalogue.map(lazyVariantFromRecord)\n)\n\nexport function themeById(id: string): ThemeVariant | undefined {\n if (!hasTheme(id)) return undefined\n return builtinThemes.find((theme) => theme.id === id)\n}\n\n/** The variants of one appearance, which is what a picker for that mode shows. */\nexport function themesForAppearance(appearance: ThemeAppearance): readonly ThemeVariant[] {\n const ids = new Set(themesByAppearance(appearance).map((theme) => theme.id))\n return builtinThemes.filter((theme) => ids.has(theme.id))\n}\n\n/** The families in the catalogue, in catalogue order. */\nexport function themeFamilies(): { family: string; label: string; themes: ThemeVariant[] }[] {\n const families = new Map<string, { family: string; label: string; themes: ThemeVariant[] }>()\n for (const theme of builtinThemes) {\n const entry = families.get(theme.family) ?? {\n family: theme.family,\n label: theme.familyLabel,\n themes: [],\n }\n entry.themes.push(theme)\n families.set(theme.family, entry)\n }\n return [...families.values()]\n}\n\n/**\n * The canonical catalogue records, in catalogue order.\n *\n * {@link builtinThemes} is this system's projection of the catalogue onto the\n * shadcn vocabulary, which is what a document is painted with. A *preview* of a\n * theme, the miniatures `AppearanceEditor` and `ThemeMiniature` draw, reads the\n * catalogue's own roles instead (`surfaceActive`, `borderMuted`, `textSubtle`…),\n * several of which the projection folds together. These are those records, so a\n * consumer hands the editor exactly what it takes rather than reconstructing it\n * from the projection.\n */\nexport const themeRecords: readonly AdeaThemeRecord[] = catalogue\n\nexport function themeRecordById(id: string): AdeaThemeRecord | undefined {\n return getTheme(id)\n}\n\n/** A light/dark theme pair by id, with the defaults standing in for an unknown id. */\nfunction recordPair(pair: ThemePair) {\n const { lightThemeId, darkThemeId } = cataloguePair(pair)\n return { light: getTheme(lightThemeId)!, dark: getTheme(darkThemeId)! }\n}\n\n/**\n * The accents the selected light/dark pair carries, offered beside the presets.\n *\n * Computed per pair rather than per theme because a theme accent is a *pair* of\n * values, like a preset: a slot is offered only when both themes can offer it.\n */\nexport function themeAccentsFor(\n lightThemeId: string,\n darkThemeId: string\n): readonly AccentPreset[] {\n const { light, dark } = recordPair({ lightThemeId, darkThemeId })\n return themeAccentPresets(light, dark)\n}\n\n/**\n * An accent id resolved against a theme pair: a preset, a theme accent the pair\n * offers, or `undefined` for `theme`, an unknown id, or a slot this pair cannot\n * offer, each of which means \"use the theme's own primary\".\n *\n * Theme accent ids are role-shaped (`ansi-blue`), so a stored one survives a theme\n * switch and resolves to the new theme's blue; when the new pair cannot offer the\n * slot it resolves to nothing, the same fallback a stale preset id gets.\n */\nexport function resolveAccentPreset(\n accentId: string,\n light: AdeaTheme,\n dark: AdeaTheme\n): AccentPreset | undefined {\n if (accentId === THEME_DEFAULT_ID) return undefined\n const preset = getAccent(accentId)\n if (preset) return preset\n if (!isThemeAccentId(accentId)) return undefined\n return themeAccentPresets(light, dark).find((option) => option.id === accentId)\n}\n\n/**\n * A theme with an accent laid over it, in the catalogue's own shape.\n *\n * The accent replaces `accent` and its measured label, which is all an accent\n * changes about a theme; `undefined` returns the theme untouched. This is the\n * overlay a host needs for `AppearanceEditor`'s `lightTheme`/`darkTheme`.\n */\nexport function withAccent<T extends AdeaTheme>(theme: T, accent: AccentPreset | undefined): T {\n if (!accent) return theme\n const value = theme.appearance === 'dark' ? accent.dark : accent.light\n return {\n ...theme,\n colors: { ...theme.colors, accent: value, accentForeground: accentForeground(value) },\n }\n}\n\n/**\n * The two preview themes an appearance selection resolves to, accent applied.\n *\n * The adapter between a stored selection and `AppearanceEditor`: it takes ids,\n * what a preference holds, and returns the canonical records the editor's\n * `lightTheme` and `darkTheme` props take, so a host does not map roles by hand.\n * Unknown ids fall back to the defaults and an accent the pair cannot offer falls\n * back to the theme's own, exactly as `ThemeProvider` resolves them.\n */\nexport function appearancePreviewThemes(selection: {\n lightThemeId: string\n darkThemeId: string\n accent: string\n}): { lightTheme: AdeaThemeRecord; darkTheme: AdeaThemeRecord } {\n const { light, dark } = recordPair(selection)\n const accent = resolveAccentPreset(selection.accent, light, dark)\n return { lightTheme: withAccent(light, accent), darkTheme: withAccent(dark, accent) }\n}\n\n/**\n * The properties an accent selection overrides, as CSS custom properties.\n *\n * ## Why this exists rather than relying on the `[data-accent]` blocks\n *\n * `theme.css` carries a `[data-accent='…']` block per preset, and those blocks are\n * correct, but they are unreachable at runtime. `ThemeProvider` writes a theme's\n * whole role set onto `<html>` as *inline* custom properties, and an inline\n * declaration outranks any stylesheet selector regardless of specificity. The\n * attribute was set, the rules existed, the values were right, and every one of the\n * seven accents rendered as the same blue.\n *\n * The blocks are kept, because they are what styles the window between the document\n * arriving and the provider mounting, which is the whole reason `themeScript`\n * exists. But the authoritative value has to be applied by the same code that\n * applies the theme, from the same source, or the two can drift again. So both the\n * provider and the CSS generator call `accentRoles` out of `@adea-ai/themes`, and\n * `tests/appearance-axes.test.ts` asserts the two agree value for value.\n *\n * A theme accent (`ansi-blue`) has no block: its value depends on the theme pair,\n * so it is resolved against `pair`, the selection's light and dark theme ids,\n * and only ever applied here. Without a pair it resolves against the defaults.\n *\n * Returns `undefined` for `theme`, the variant's own primary, for an id the\n * catalogue does not have, and for a theme accent the pair does not offer, so a\n * stale stored preference falls back to the theme rather than blanking the primary.\n */\nexport function accentVariables(\n accentId: string,\n appearance: ThemeAppearance,\n pair: ThemePair = defaultThemePair,\n options: AccentVariableOptions = {}\n): Record<string, string> | undefined {\n const roles = accentRolesForSelection(accentId, appearance, pair, options)\n return roles ? accentOverrideVariables(roles) : undefined\n}\n\n/**\n * An accent selection resolved to the full {@link AccentRoles}, against a theme\n * pair. {@link accentVariables} is the document half of this; an element-scoped\n * paint (`paintAccentRoles`) wants all of it, including the tint.\n */\nexport function accentRolesForSelection(\n accentId: string,\n appearance: ThemeAppearance,\n pair: ThemePair = defaultThemePair,\n options: AccentVariableOptions = {}\n): AccentRoles | undefined {\n if (accentId === THEME_DEFAULT_ID) return undefined\n const record = options.variantId ? getTheme(options.variantId) : undefined\n return resolveAccentRoles(accentId, {\n target: record ?? appearance,\n background: options.background,\n floor: options.floor,\n // Only an `ansi-*` id needs the pair's offering, and measuring it is not free.\n themeAccents: isThemeAccentId(accentId)\n ? themeAccentsFor(pair.lightThemeId, pair.darkThemeId)\n : undefined,\n })\n}\n\n/**\n * True for the catalogue's own variant, not a host's copy that merely shares its id.\n *\n * Identity rather than id, because a host's imported theme may reuse a catalogue id\n * with different colours, and projecting the catalogue's record for it would paint\n * the wrong palette.\n */\nexport function isCatalogueVariant(variant: ThemeVariant): boolean {\n return themeById(variant.id) === variant\n}\n\n/**\n * The editor palette held to 4.5:1, or `fallback` for a record that cannot reach it.\n *\n * Some palettes (an imported one, most often) cannot be repaired to the floor from\n * their own ramp within the catalogue's lightness budget, and `editorRolesHex` says\n * so by throwing. A palette that paints nothing is worse than one that paints its\n * quiet roles, so the throw is the cue to fall back rather than to fail. `project` is\n * a parameter so that path can be exercised: no catalogue theme takes it.\n */\nexport function floorEditorPalette(\n record: AdeaTheme,\n fallback: ThemeEditorPalette,\n project: (theme: AdeaTheme) => Record<keyof ThemeEditorPalette, string> = editorRolesHex\n): ThemeEditorPalette {\n try {\n return pickRoles(THEME_EDITOR_PROPERTIES, project(record))\n } catch {\n return fallback\n }\n}\n\nconst floorEditorCache = new Map<string, ThemeEditorPalette>()\n\n/**\n * The editor palette a variant paints under a projection.\n *\n * `floor` applies to the catalogue's own variants, whose record the catalogue holds.\n * A variant it does not hold (a host's imported theme) has no record to project and\n * keeps its own `editor`; such a theme normally carries its roles in `tokens`, which\n * win over either projection anyway. Computed once per theme: the repair is a search.\n */\nexport function editorPaletteFor(\n theme: ThemeVariant,\n mode: EditorRolesMode = 'syntax'\n): ThemeEditorPalette {\n if (mode !== 'floor' || !isCatalogueVariant(theme)) return theme.editor\n const cached = floorEditorCache.get(theme.id)\n if (cached) return cached\n const record = getTheme(theme.id)\n const palette = record ? floorEditorPalette(record, theme.editor) : theme.editor\n floorEditorCache.set(theme.id, palette)\n return palette\n}\n\n/**\n * The roles a variant sets, as CSS custom properties.\n *\n * The mapping itself is `themeCssVariablesWith` in `theme-css.ts`; this binds it to\n * the catalogue, which measures a theme's `--primary-subtle` strength\n * ({@link primarySubtleFor}) and projects its floor editor ramp\n * ({@link editorPaletteFor}). Absent `options`, the result is what it has always\n * been; the generated `theme-variants.css` and the design-system artifact are built\n * without it.\n */\nexport function themeCssVariables(\n theme: ThemeVariant,\n options: ThemeCssVariableOptions = {}\n): Record<string, string> {\n return themeCssVariablesWith(\n {\n primarySubtle: primarySubtleFor,\n editor: (variant, mode) => editorPaletteFor(variant, mode),\n },\n theme,\n options\n )\n}\n\n/* ---------------------------------------------------------------------------\n * Validation\n *\n * Delegated. The floors are the catalogue's, because they are what makes the\n * catalogue able to hold other people's palettes at all, and a second set of floors\n * here would be a second answer to the same question, and the one that drifts.\n * ------------------------------------------------------------------------- */\n\nexport type ThemeFinding = {\n themeId: string\n role: string\n message: string\n}\n\nfunction toFinding(finding: ContrastFinding): ThemeFinding {\n return { themeId: finding.themeId, role: finding.role, message: finding.message }\n}\n\n/** Validates one variant. The floors, and the reasoning behind them, live in the catalogue. */\nexport function validateTheme(theme: ThemeVariant): ThemeFinding[] {\n const record = catalogue.find((entry) => entry.id === theme.id)\n if (!record) {\n return [{ themeId: theme.id, role: 'id', message: `${theme.id} is not in the catalogue` }]\n }\n return validateCatalogue([record]).map(toFinding)\n}\n\n/** Validates the whole registry, including the catalogue-level invariants. */\nexport function validateThemeRegistry(\n themes: readonly ThemeVariant[] = builtinThemes\n): ThemeFinding[] {\n const records = themes\n .map((theme) => catalogue.find((entry) => entry.id === theme.id))\n .filter((record): record is AdeaThemeRecord => !!record)\n\n const orphaned = themes\n .filter((theme) => !hasTheme(theme.id))\n .map((theme) => ({\n themeId: theme.id,\n role: 'id',\n message: `${theme.id} is in the registry but not in the catalogue`,\n }))\n\n return [...orphaned, ...validateCatalogue(records).map(toFinding)]\n}\n\n/** Re-exported so a consumer measuring a colour does not need a second import. */\nexport { contrastRatio } from '@adea-ai/themes'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,SAAgB,iBAAiB,OAAwD;CACvF,MAAM,SAAS,SAAS,MAAM,EAAE;CAChC,OAAO,SAAS,iBAAiB,MAAM,IAAI,iBAAiB,MAAM,UAAU;AAC9E;;;;;;;;AASA,IAAa,gBAAyD,uBAAO,OAC3D,uBAAU,IAAI,qBAAqB,CACrD;AAEA,SAAgB,UAAU,IAAsC;CAC9D,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,KAAA;CAC1B,OAAO,cAAc,MAAM,UAAU,MAAM,OAAO,EAAE;AACtD;;AAGA,SAAgB,oBAAoB,YAAsD;CACxF,MAAM,MAAM,IAAI,IAAI,mBAAmB,UAAU,CAAC,CAAC,KAAK,UAAU,MAAM,EAAE,CAAC;CAC3E,OAAO,cAAc,QAAQ,UAAU,IAAI,IAAI,MAAM,EAAE,CAAC;AAC1D;;AAGA,SAAgB,gBAA6E;CAC3F,MAAM,2BAAW,IAAI,IAAuE;CAC5F,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,QAAQ,SAAS,IAAI,MAAM,MAAM,KAAK;GAC1C,QAAQ,MAAM;G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;CACxB,OAAO,sBACL;EACE,eAAe;EACf,SAAS,SAAS,SAAS,iBAAiB,SAAS,IAAI;CAC3D,GACA,OACA,OACF;AACF;AAgBA,SAAS,UAAU,SAAwC;CACzD,OAAO;EAAE,SAAS,QAAQ;EAAS,MAAM,QAAQ;EAAM,SAAS,QAAQ;CAAQ;AAClF;;AAGA,SAAgB,cAAc,OAAqC;CACjE,MAAM,SAASA,OAAU,MAAM,UAAU,MAAM,OAAO,MAAM,EAAE;CAC9D,IAAI,CAAC,QACH,OAAO,CAAC;EAAE,SAAS,MAAM;EAAI,MAAM;EAAM,SAAS,GAAG,MAAM,GAAG;CAA0B,CAAC;CAE3F,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,SAAS;AAClD;;AAGA,SAAgB,sBACd,WAAkC,eAClB;CAChB,MAAM,UAAUC,SACb,KAAK,UAAUD,OAAU,MAAM,UAAU,MAAM,OAAO,MAAM,EAAE,CAAC,CAAC,CAChE,QAAQ,WAAsC,CAAC,CAAC,MAAM;CAUzD,OAAO,CAAC,GARSC,SACd,QAAQ,UAAU,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC,CACtC,KAAK,WAAW;EACf,SAAS,MAAM;EACf,MAAM;EACN,SAAS,GAAG,MAAM,GAAG;CACvB,EAES,GAAU,GAAG,kBAAkB,OAAO,CAAC,CAAC,IAAI,SAAS,CAAC;AACnE"}
|
|
1
|
+
{"version":3,"file":"themes.js","names":["catalogue","themes"],"sources":["../../src/lib/themes.ts"],"sourcesContent":["/**\n * The theme registry, now a bridge.\n *\n * The catalogue itself lives in `@adea-ai/themes`. This module is what is left in\n * the design system: the translation between the catalogue's **canonical** role\n * names and the **shadcn** vocabulary every component here is written against, plus\n * the handful of custom properties this system declares that are presentations of\n * data the catalogue already holds, the `--terminal-*` ramp, the `--editor-*` ramp,\n * and `--chrome`.\n *\n * ## Why it is a bridge and not a copy\n *\n * This file used to hold thirteen themes as hand-written hex literal tables, with its\n * own contrast validator, its own terminal and editor palettes, and its own\n * provenance records. That is a lot of surface to maintain for one consumer of a\n * palette, and it meant every product that wanted the same themes, Adea, Cortana,\n * either imported this package or wrote its own. The catalogue moved out so that\n * there is one answer to \"what is Catppuccin Mocha\", and this file is the part that\n * genuinely belongs to the design system.\n *\n * It is deliberately thin. If you are looking for a colour, it is not here: see\n * `@adea-ai/themes`, whose README explains how the values are produced and whose\n * `NOTICE` records where every palette came from.\n *\n * ## The mapping, and the entry that is not a rename\n *\n * The package-owned `shadcnVariables` adapter maps canonical roles onto this\n * system's vocabulary. One entry will trip a reader: the catalogue's `accent`\n * becomes this system's `primary`, because in the shadcn vocabulary `--primary` is\n * the action colour, the fill of a primary button, the thing a focus ring is drawn\n * in, while `--accent` is a low-contrast hover wash. The catalogue's `accent` is\n * the former, so it goes to `--primary`, and `--accent` is filled from\n * `surfaceHover`, which is what shadcn components actually use it for.\n */\n\nimport {\n accentForeground,\n editorRolesHex,\n getAccent,\n getTheme,\n hasTheme,\n primarySubtleCss,\n themes as catalogue,\n themesByAppearance,\n themeAccentPresets,\n validateCatalogue,\n type AccentPreset,\n type AdeaTheme,\n type AdeaThemeRecord,\n type ContrastFinding,\n} from '@adea-ai/themes'\nimport { accentOverrideVariables, resolveAccentRoles, type AccentRoles } from './accent-roles'\nimport { isThemeAccentId } from './theme-accents'\nimport { themeCssVariablesWith } from './theme-css'\nimport { THEME_DEFAULT_ID, cataloguePair, defaultThemePair } from './theme-defaults'\nimport { lazyVariantFromRecord } from './theme-records'\nimport {\n THEME_EDITOR_PROPERTIES,\n pickRoles,\n type AccentVariableOptions,\n type EditorRolesMode,\n type ThemeAppearance,\n type ThemeCssVariableOptions,\n type ThemeEditorPalette,\n type ThemePair,\n type ThemeVariant,\n} from './theme-types'\n\nexport { accents } from './accent-presets'\nexport { isThemeAccentId } from './theme-accents'\nexport { terminalCssVariables, tokensAsHex } from './theme-css'\nexport { defaultDarkThemeId, defaultLightThemeId, resolveVariant } from './theme-defaults'\nexport { variantFromRecord } from './theme-records'\nexport type {\n AccentVariableOptions,\n EditorRolesMode,\n ThemeAppearance,\n ThemeColors,\n ThemeCssVariableOptions,\n ThemeEditorPalette,\n ThemeProvenance,\n ThemeTerminalPalette,\n ThemeVariant,\n} from './theme-types'\n\n/**\n * A variant's `--primary-subtle`: the tint over `var(--primary)` at the strength its\n * catalogue record measures (`primarySubtleAlpha`). A variant that is not in the\n * catalogue has nothing to measure, and gets its appearance's ceiling.\n */\nexport function primarySubtleFor(theme: Pick<ThemeVariant, 'id' | 'appearance'>): string {\n const record = getTheme(theme.id)\n return record ? primarySubtleCss(record) : primarySubtleCss(theme.appearance)\n}\n\n/**\n * The catalogue, in catalogue order.\n *\n * The `@__PURE__` marks let a bundler drop the whole table, and with it the catalogue,\n * from a consumer that imports only this module's catalogue-free helpers\n * (`tokensAsHex`, `isThemeAccentId`, `resolveVariant`…) and never reads it.\n */\nexport const builtinThemes: readonly ThemeVariant[] = /* @__PURE__ */ Object.freeze(\n /* @__PURE__ */ catalogue.map(lazyVariantFromRecord)\n)\n\nexport function themeById(id: string): ThemeVariant | undefined {\n if (!hasTheme(id)) return undefined\n return builtinThemes.find((theme) => theme.id === id)\n}\n\n/** The variants of one appearance, which is what a picker for that mode shows. */\nexport function themesForAppearance(appearance: ThemeAppearance): readonly ThemeVariant[] {\n const ids = new Set(themesByAppearance(appearance).map((theme) => theme.id))\n return builtinThemes.filter((theme) => ids.has(theme.id))\n}\n\n/** The families in the catalogue, in catalogue order. */\nexport function themeFamilies(): { family: string; label: string; themes: ThemeVariant[] }[] {\n const families = new Map<string, { family: string; label: string; themes: ThemeVariant[] }>()\n for (const theme of builtinThemes) {\n const entry = families.get(theme.family) ?? {\n family: theme.family,\n label: theme.familyLabel,\n themes: [],\n }\n entry.themes.push(theme)\n families.set(theme.family, entry)\n }\n return [...families.values()]\n}\n\n/**\n * The canonical catalogue records, in catalogue order.\n *\n * {@link builtinThemes} is this system's projection of the catalogue onto the\n * shadcn vocabulary, which is what a document is painted with. A *preview* of a\n * theme, the miniatures `AppearanceEditor` and `ThemeMiniature` draw, reads the\n * catalogue's own roles instead (`surfaceActive`, `borderMuted`, `textSubtle`…),\n * several of which the projection folds together. These are those records, so a\n * consumer hands the editor exactly what it takes rather than reconstructing it\n * from the projection.\n */\nexport const themeRecords: readonly AdeaThemeRecord[] = catalogue\n\nexport function themeRecordById(id: string): AdeaThemeRecord | undefined {\n return getTheme(id)\n}\n\n/** A light/dark theme pair by id, with the defaults standing in for an unknown id. */\nfunction recordPair(pair: ThemePair) {\n const { lightThemeId, darkThemeId } = cataloguePair(pair)\n return { light: getTheme(lightThemeId)!, dark: getTheme(darkThemeId)! }\n}\n\n/**\n * The accents the selected light/dark pair carries, offered beside the presets.\n *\n * Computed per pair rather than per theme because a theme accent is a *pair* of\n * values, like a preset: a slot is offered only when both themes can offer it.\n */\nexport function themeAccentsFor(\n lightThemeId: string,\n darkThemeId: string\n): readonly AccentPreset[] {\n const { light, dark } = recordPair({ lightThemeId, darkThemeId })\n return themeAccentPresets(light, dark)\n}\n\n/**\n * An accent id resolved against a theme pair: a preset, a theme accent the pair\n * offers, or `undefined` for `theme`, an unknown id, or a slot this pair cannot\n * offer, each of which means \"use the theme's own primary\".\n *\n * Theme accent ids are role-shaped (`ansi-blue`), so a stored one survives a theme\n * switch and resolves to the new theme's blue; when the new pair cannot offer the\n * slot it resolves to nothing, the same fallback a stale preset id gets.\n */\nexport function resolveAccentPreset(\n accentId: string,\n light: AdeaTheme,\n dark: AdeaTheme\n): AccentPreset | undefined {\n if (accentId === THEME_DEFAULT_ID) return undefined\n const preset = getAccent(accentId)\n if (preset) return preset\n if (!isThemeAccentId(accentId)) return undefined\n return themeAccentPresets(light, dark).find((option) => option.id === accentId)\n}\n\n/**\n * A theme with an accent laid over it, in the catalogue's own shape.\n *\n * The accent replaces `accent` and its measured label, which is all an accent\n * changes about a theme; `undefined` returns the theme untouched. This is the\n * overlay a host needs for `AppearanceEditor`'s `lightTheme`/`darkTheme`.\n */\nexport function withAccent<T extends AdeaTheme>(theme: T, accent: AccentPreset | undefined): T {\n if (!accent) return theme\n const value = theme.appearance === 'dark' ? accent.dark : accent.light\n return {\n ...theme,\n colors: { ...theme.colors, accent: value, accentForeground: accentForeground(value) },\n }\n}\n\n/**\n * The two preview themes an appearance selection resolves to, accent applied.\n *\n * The adapter between a stored selection and `AppearanceEditor`: it takes ids,\n * what a preference holds, and returns the canonical records the editor's\n * `lightTheme` and `darkTheme` props take, so a host does not map roles by hand.\n * Unknown ids fall back to the defaults and an accent the pair cannot offer falls\n * back to the theme's own, exactly as `ThemeProvider` resolves them.\n */\nexport function appearancePreviewThemes(selection: {\n lightThemeId: string\n darkThemeId: string\n accent: string\n}): { lightTheme: AdeaThemeRecord; darkTheme: AdeaThemeRecord } {\n const { light, dark } = recordPair(selection)\n const accent = resolveAccentPreset(selection.accent, light, dark)\n return { lightTheme: withAccent(light, accent), darkTheme: withAccent(dark, accent) }\n}\n\n/**\n * The properties an accent selection overrides, as CSS custom properties.\n *\n * ## Why this exists rather than relying on the `[data-accent]` blocks\n *\n * `theme.css` carries a `[data-accent='…']` block per preset, and those blocks are\n * correct, but they are unreachable at runtime. `ThemeProvider` writes a theme's\n * whole role set onto `<html>` as *inline* custom properties, and an inline\n * declaration outranks any stylesheet selector regardless of specificity. The\n * attribute was set, the rules existed, the values were right, and every one of the\n * seven accents rendered as the same blue.\n *\n * The blocks are kept, because they are what styles the window between the document\n * arriving and the provider mounting, which is the whole reason `themeScript`\n * exists. But the authoritative value has to be applied by the same code that\n * applies the theme, from the same source, or the two can drift again. So both the\n * provider and the CSS generator call `accentRoles` out of `@adea-ai/themes`, and\n * `tests/appearance-axes.test.ts` asserts the two agree value for value.\n *\n * A theme accent (`ansi-blue`) has no block: its value depends on the theme pair,\n * so it is resolved against `pair`, the selection's light and dark theme ids,\n * and only ever applied here. Without a pair it resolves against the defaults.\n *\n * Returns `undefined` for `theme`, the variant's own primary, for an id the\n * catalogue does not have, and for a theme accent the pair does not offer, so a\n * stale stored preference falls back to the theme rather than blanking the primary.\n */\nexport function accentVariables(\n accentId: string,\n appearance: ThemeAppearance,\n pair: ThemePair = defaultThemePair,\n options: AccentVariableOptions = {}\n): Record<string, string> | undefined {\n const roles = accentRolesForSelection(accentId, appearance, pair, options)\n return roles ? accentOverrideVariables(roles) : undefined\n}\n\n/**\n * An accent selection resolved to the full {@link AccentRoles}, against a theme\n * pair. {@link accentVariables} is the document half of this; an element-scoped\n * paint (`paintAccentRoles`) wants all of it, including the tint.\n */\nexport function accentRolesForSelection(\n accentId: string,\n appearance: ThemeAppearance,\n pair: ThemePair = defaultThemePair,\n options: AccentVariableOptions = {}\n): AccentRoles | undefined {\n if (accentId === THEME_DEFAULT_ID) return undefined\n const record = options.variantId ? getTheme(options.variantId) : undefined\n return resolveAccentRoles(accentId, {\n target: record ?? appearance,\n background: options.background,\n floor: options.floor,\n // Only an `ansi-*` id needs the pair's offering, and measuring it is not free.\n themeAccents: isThemeAccentId(accentId)\n ? themeAccentsFor(pair.lightThemeId, pair.darkThemeId)\n : undefined,\n })\n}\n\n/**\n * True for the catalogue's own variant, not a host's copy that merely shares its id.\n *\n * Identity rather than id, because a host's imported theme may reuse a catalogue id\n * with different colours, and projecting the catalogue's record for it would paint\n * the wrong palette.\n */\nexport function isCatalogueVariant(variant: ThemeVariant): boolean {\n return themeById(variant.id) === variant\n}\n\n/**\n * The editor palette held to 4.5:1, or `fallback` for a record that cannot reach it.\n *\n * Some palettes (an imported one, most often) cannot be repaired to the floor from\n * their own ramp within the catalogue's lightness budget, and `editorRolesHex` says\n * so by throwing. A palette that paints nothing is worse than one that paints its\n * quiet roles, so the throw is the cue to fall back rather than to fail. `project` is\n * a parameter so that path can be exercised: no catalogue theme takes it.\n */\nexport function floorEditorPalette(\n record: AdeaTheme,\n fallback: ThemeEditorPalette,\n project: (theme: AdeaTheme) => Record<keyof ThemeEditorPalette, string> = editorRolesHex\n): ThemeEditorPalette {\n try {\n return pickRoles(THEME_EDITOR_PROPERTIES, project(record))\n } catch {\n return fallback\n }\n}\n\nconst floorEditorCache = new Map<string, ThemeEditorPalette>()\n\n/**\n * The editor palette a variant paints under a projection.\n *\n * `floor` applies to the catalogue's own variants, whose record the catalogue holds.\n * A variant it does not hold (a host's imported theme) has no record to project and\n * keeps its own `editor`; such a theme normally carries its roles in `tokens`, which\n * win over either projection anyway. Computed once per theme: the repair is a search.\n */\nexport function editorPaletteFor(\n theme: ThemeVariant,\n mode: EditorRolesMode = 'syntax'\n): ThemeEditorPalette {\n if (mode !== 'floor' || !isCatalogueVariant(theme)) return theme.editor\n const cached = floorEditorCache.get(theme.id)\n if (cached) return cached\n const record = getTheme(theme.id)\n const palette = record ? floorEditorPalette(record, theme.editor) : theme.editor\n floorEditorCache.set(theme.id, palette)\n return palette\n}\n\n/**\n * The roles a variant sets, as CSS custom properties.\n *\n * The mapping itself is `themeCssVariablesWith` in `theme-css.ts`; this binds it to\n * the catalogue, which measures a theme's `--primary-subtle` strength\n * ({@link primarySubtleFor}) and projects its floor editor ramp\n * ({@link editorPaletteFor}). Absent `options`, the result is what it has always\n * been; the generated `theme-variants.css` and the design-system artifact are built\n * without it.\n */\nexport function themeCssVariables(\n theme: ThemeVariant,\n options: ThemeCssVariableOptions = {}\n): Record<string, string> {\n return themeCssVariablesWith(\n {\n primarySubtle: primarySubtleFor,\n editor: (variant, mode) => editorPaletteFor(variant, mode),\n },\n theme,\n options\n )\n}\n\n/* ---------------------------------------------------------------------------\n * Validation\n *\n * Delegated. The floors are the catalogue's, because they are what makes the\n * catalogue able to hold other people's palettes at all, and a second set of floors\n * here would be a second answer to the same question, and the one that drifts.\n * ------------------------------------------------------------------------- */\n\nexport type ThemeFinding = {\n themeId: string\n role: string\n message: string\n}\n\nfunction toFinding(finding: ContrastFinding): ThemeFinding {\n return { themeId: finding.themeId, role: finding.role, message: finding.message }\n}\n\n/** Validates one variant. The floors, and the reasoning behind them, live in the catalogue. */\nexport function validateTheme(theme: ThemeVariant): ThemeFinding[] {\n const record = catalogue.find((entry) => entry.id === theme.id)\n if (!record) {\n return [{ themeId: theme.id, role: 'id', message: `${theme.id} is not in the catalogue` }]\n }\n return validateCatalogue([record]).map(toFinding)\n}\n\n/** Validates the whole registry, including the catalogue-level invariants. */\nexport function validateThemeRegistry(\n themes: readonly ThemeVariant[] = builtinThemes\n): ThemeFinding[] {\n const records = themes\n .map((theme) => catalogue.find((entry) => entry.id === theme.id))\n .filter((record): record is AdeaThemeRecord => !!record)\n\n const orphaned = themes\n .filter((theme) => !hasTheme(theme.id))\n .map((theme) => ({\n themeId: theme.id,\n role: 'id',\n message: `${theme.id} is in the registry but not in the catalogue`,\n }))\n\n return [...orphaned, ...validateCatalogue(records).map(toFinding)]\n}\n\n/** Re-exported so a consumer measuring a colour does not need a second import. */\nexport { contrastRatio } from '@adea-ai/themes'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,SAAgB,iBAAiB,OAAwD;CACvF,MAAM,SAAS,SAAS,MAAM,EAAE;CAChC,OAAO,SAAS,iBAAiB,MAAM,IAAI,iBAAiB,MAAM,UAAU;AAC9E;;;;;;;;AASA,IAAa,gBAAyD,uBAAO,OAC3DA,uBAAU,IAAI,qBAAqB,CACrD;AAEA,SAAgB,UAAU,IAAsC;CAC9D,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,KAAA;CAC1B,OAAO,cAAc,MAAM,UAAU,MAAM,OAAO,EAAE;AACtD;;AAGA,SAAgB,oBAAoB,YAAsD;CACxF,MAAM,MAAM,IAAI,IAAI,mBAAmB,UAAU,CAAC,CAAC,KAAK,UAAU,MAAM,EAAE,CAAC;CAC3E,OAAO,cAAc,QAAQ,UAAU,IAAI,IAAI,MAAM,EAAE,CAAC;AAC1D;;AAGA,SAAgB,gBAA6E;CAC3F,MAAM,2BAAW,IAAI,IAAuE;CAC5F,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,QAAQ,SAAS,IAAI,MAAM,MAA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B,kBACd,OACA,UAAmC,CAAC,GACZ;CACxB,OAAO,sBACL;EACE,eAAe;EACf,SAAS,SAAS,SAAS,iBAAiB,SAAS,IAAI;CAC3D,GACA,OACA,OACF;AACF;AAgBA,SAAS,UAAU,SAAwC;CACzD,OAAO;EAAE,SAAS,QAAQ;EAAS,MAAM,QAAQ;EAAM,SAAS,QAAQ;CAAQ;AAClF;;AAGA,SAAgB,cAAc,OAAqC;CACjE,MAAM,SAASA,OAAU,MAAM,UAAU,MAAM,OAAO,MAAM,EAAE;CAC9D,IAAI,CAAC,QACH,OAAO,CAAC;EAAE,SAAS,MAAM;EAAI,MAAM;EAAM,SAAS,GAAG,MAAM,GAAG;CAA0B,CAAC;CAE3F,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,SAAS;AAClD;;AAGA,SAAgB,sBACdC,WAAkC,eAClB;CAChB,MAAM,UAAUA,SACb,KAAK,UAAUD,OAAU,MAAM,UAAU,MAAM,OAAO,MAAM,EAAE,CAAC,CAAC,CAChE,QAAQ,WAAsC,CAAC,CAAC,MAAM;CAUzD,OAAO,CAAC,GARSC,SACd,QAAQ,UAAU,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC,CACtC,KAAK,WAAW;EACf,SAAS,MAAM;EACf,MAAM;EACN,SAAS,GAAG,MAAM,GAAG;CACvB,EAES,GAAU,GAAG,kBAAkB,OAAO,CAAC,CAAC,IAAI,SAAS,CAAC;AACnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-focus-gate.js","names":[],"sources":["../../src/lib/tooltip-focus-gate.ts"],"sourcesContent":["/*\n * Tooltips open on active hover over the control, or on keyboard focus that\n * follows a Tab key press. They must never open from programmatic focus: the\n * autofocus a dialog or sheet gives its first control, and the focus a closing\n * overlay restores to its opener, both land on buttons that carry tooltips,\n * and the tooltip primitive opens immediately on focus and pins the tooltip\n * until blur. That is the \"tooltip auto-displays when a sheet opens\" report,\n * and the pinned tooltip is the \"tooltip gets stuck and never disappears\"\n * report: the pointer is nowhere near the control, so no pointer leave ever\n * closes it.\n *\n * The trigger listens for the native `focus` event on the trigger element, and\n * composites build tooltips internally (ActionButton renders one from its\n * `tooltip` prop), so the single interception point that covers every tooltip\n * is a capture-phase `focus` listener on `document`. When focus lands without a\n * keyboard-intent signal on a button-like element, the event is stopped before\n * any element listener runs: the tooltip never learns about the focus. Hover\n * opens are untouched (they ride pointer events), and the separate `focusin`\n * event still flows, so dialog focus-cycle tracking, `:focus-visible` styling,\n * and focus restoration all keep working. Focus still lands, only the event\n * is stopped, so `document.activeElement` and scripted `.blur()` behave.\n *\n * The keyboard-intent signal is a Tab key press immediately before the focus,\n * the only key that moves focus natively. Enter and Space open overlays too,\n * so any \"recent key\" window wide enough for those would let an overlay's own\n * autofocus back through; Tab-only keeps autofocus suppressed no matter how\n * the overlay was opened, while normal Tab navigation still announces each\n * control's tooltip (hover descriptions stay reachable from the keyboard).\n *\n * Suppression is scoped to button-like targets (`button`, `a[href]`,\n * `[role=\"button\"]`, `[role=\"link\"]`). Composite widgets that move focus\n * programmatically, menu items, listbox options, grid cells, are other\n * element types whose roving-focus highlighting must keep receiving focus\n * events, and text controls keep their own focus behaviour (select on focus,\n * caret placement).\n *\n * Suppressed focus is real as far as the DOM is concerned (`activeElement`\n * moves; only the event was stopped), and the tooltip interaction model treats\n * a trigger that is `activeElement` as keyboard-held: while a tooltip on it is\n * open, pointer movement away only *requests* a close and the request is\n * refused for as long as the pointer keeps moving. Left alone, a later real\n * hover on that control would open the tip and never let it leave, the\n * residual \"stuck\" case. The gate therefore treats a suppressed focus as a\n * phantom and releases it: the first pointer activity after the focus (a\n * pointer session taking over from a script) blurs the element. Keyboard\n * sessions never release it and never need to, keyboard focus moves by Tab,\n * which is never suppressed, so nothing pins; and the release only runs for\n * elements still holding `activeElement`, so a Tab already taken from the\n * phantom is left alone.\n *\n * Only a pointer that actually travels releases the phantom. WebKit (Safari,\n * WKWebView) dispatches a `pointermove` at the unchanged position whenever a\n * scroll moves content under a resting mouse, and a dialog's restored focus or\n * an autofocus usually scrolls its control into view, so releasing on any\n * move blurred focus no one had touched. That move reports no travel\n * (`movementX` and `movementY` are both 0); a move that reports no movement\n * fields at all still counts as travel (see `pointerMoveTravelled`).\n *\n * Focus that arrives while a pointer button is held belongs to a pointer\n * gesture, not to a tooltip: the pixel resize handle focuses its handle when a\n * drag starts and cancels the drag on blur, so a gesture focus must pass\n * through untouched (no suppression, no phantom, no release). A gesture's own\n * click behaviour already keeps tooltips closed, and the autofocus cases this\n * gate exists for all happen with the pointer up.\n *\n * A tab in a roving-focus tab list is the one button-like element whose\n * programmatic focus is the widget working as designed: a dialog's focus scope\n * and the tab list both put focus on the selected tab, and the tab list scrolls\n * it into view on every focus-in. Releasing that focus would hand it straight\n * back (the scope restores it), so every pointer move would re-suppress,\n * re-release and re-scroll the rail to the top, and a tab below the fold of a\n * large-font or short-window rail could not be clicked. A focus on `role=\"tab\"`\n * is therefore still hidden from the tooltip, so no tooltip opens from it, but\n * it is not tracked as a phantom and the pointer never blurs it.\n *\n * Independently of the gesture window, resize grips render as\n * `<button role=\"separator\">` and carry no tooltip, so they are excluded from\n * the button-like scope entirely (see `isButtonLikeFocusTarget`).\n *\n * The gate is installed by the `Tooltip` root for the lifetime of the first\n * tooltip in a document and removed when the last one unmounts, so every\n * consumer of the primitive, including composites that build their own\n * tooltips, inherits the contract without wiring of its own.\n */\n\n/** How long after a Tab key press a resulting focus event still counts as\n * keyboard navigation. The native focus move follows the key press\n * immediately; the window only has to bridge that dispatch, not a later\n * script-driven focus. */\nexport const TOOLTIP_FOCUS_INTENT_WINDOW_MS = 250\n\n/** Elements a tooltip-bearing control is rendered as. Everything else keeps\n * its native focus behaviour, and so do resize grips (see below). */\nconst BUTTON_LIKE_SELECTOR = 'button, a[href], [role=\"button\"], [role=\"link\"]'\n\n/**\n * Whether a focus event landing on this target could open a tooltip on a\n * button-like control. Accepts any Element (an SVG glyph inside a control,\n * for instance) and duck-types so the decision is testable without a DOM.\n */\nfunction buttonLikeControl(target: unknown): Element | null {\n const element = target as Element | null | undefined\n if (typeof element?.closest !== 'function') return null\n return element.closest(BUTTON_LIKE_SELECTOR)\n}\n\n/**\n * Whether the focus target is a tab of a roving-focus tab list. Its focus is\n * hidden from tooltips like any other programmatic focus, but it is never\n * released by the pointer (see the header).\n */\nexport function isTabFocusTarget(target: unknown): boolean {\n return buttonLikeControl(target)?.getAttribute?.('role') === 'tab'\n}\n\nexport function isButtonLikeFocusTarget(target: unknown): boolean {\n const control = buttonLikeControl(target)\n if (control === null) return false\n // Resize grips render as `<button role=\"separator\">` and focus themselves\n // when a pointer drag starts. They carry no tooltip, and the blur that\n // releases a suppressed focus would end the drag on its first move.\n return control.getAttribute?.('role') !== 'separator'\n}\n\n/**\n * The suppression decision: a button-like focus target hides a tooltip only\n * when no keyboard navigation is in flight. Anything else, a Tab-driven\n * focus, or focus on a non-button element, passes through untouched.\n */\nexport function shouldSuppressTooltipFocus(input: {\n isButtonLike: boolean\n keyboardIntentActive: boolean\n}): boolean {\n return input.isButtonLike && !input.keyboardIntentActive\n}\n\n/**\n * Whether a `pointermove` comes from a pointer that moved, rather than one a\n * browser dispatched at the same position because content scrolled under it.\n * An event without movement fields counts as travel.\n */\nexport function pointerMoveTravelled(event: { movementX?: number; movementY?: number }): boolean {\n const { movementX, movementY } = event\n if (typeof movementX !== 'number' || typeof movementY !== 'number') return true\n return movementX !== 0 || movementY !== 0\n}\n\nconst installedDocuments = new WeakSet<Document>()\n\n/**\n * Install the gate on a document. Idempotent per document; returns a disposer\n * that removes the listeners (used by tests and by the tooltip root, which\n * releases the gate when its document's last tooltip unmounts).\n */\nexport function installTooltipFocusGate(doc: Document = document): () => void {\n if (installedDocuments.has(doc)) return () => {}\n\n let lastTabKeyDownAt = Number.NEGATIVE_INFINITY\n /** True between a pointerdown and its pointerup/pointercancel: focus events\n * inside that window belong to a pointer gesture (drag bootstrap, press)\n * and must reach their element untouched. */\n let pointerGestureActive = false\n /** The element holding a suppressed programmatic focus, if it still holds\n * `activeElement`. One slot: a newer suppressed focus replaces an older\n * one, and anything that already lost focus needs no release. */\n let phantomFocusTarget: Element | undefined\n /** The phantom-release `pointermove` listener exists only while a phantom\n * does: a gate that parks a permanent pointer listener on every document\n * with a tooltip in it costs every page a standing listener for a state\n * that is live for a few hundred milliseconds at most. */\n let phantomReleaseAttached = false\n const onKeyDown = (event: KeyboardEvent) => {\n // A later activation key starts a different interaction: its overlay\n // autofocus must not inherit the preceding Tab navigation window.\n lastTabKeyDownAt = event.key === 'Tab' ? Date.now() : Number.NEGATIVE_INFINITY\n }\n const onPointerDown = () => {\n lastTabKeyDownAt = Number.NEGATIVE_INFINITY\n pointerGestureActive = true\n releasePhantomFocus()\n }\n const onPointerGestureEnd = () => {\n pointerGestureActive = false\n }\n const dropPhantom = () => {\n phantomFocusTarget = undefined\n if (phantomReleaseAttached) {\n phantomReleaseAttached = false\n doc.removeEventListener('pointermove', onPointerMove, true)\n }\n }\n const onFocus = (event: FocusEvent) => {\n // Focus that moves on retires the phantom: there is nothing left to\n // release, so the parked pointer listener goes with it.\n if (phantomFocusTarget && event.target !== phantomFocusTarget) dropPhantom()\n if (pointerGestureActive) return\n if (!isButtonLikeFocusTarget(event.target)) return\n const keyboardIntentActive = Date.now() - lastTabKeyDownAt <= TOOLTIP_FOCUS_INTENT_WINDOW_MS\n if (!shouldSuppressTooltipFocus({ isButtonLike: true, keyboardIntentActive })) return\n event.stopPropagation()\n if (isTabFocusTarget(event.target)) return\n phantomFocusTarget = event.target as Element\n if (!phantomReleaseAttached) {\n phantomReleaseAttached = true\n doc.addEventListener('pointermove', onPointerMove, true)\n }\n }\n const releasePhantomFocus = () => {\n if (pointerGestureActive) return\n if (!phantomFocusTarget) return\n const phantom = phantomFocusTarget\n dropPhantom()\n if ((doc as Document).activeElement !== phantom) return\n if (typeof (phantom as HTMLElement).blur === 'function') (phantom as HTMLElement).blur()\n }\n const onPointerMove = (event: PointerEvent) => {\n if (pointerMoveTravelled(event)) releasePhantomFocus()\n }\n\n doc.addEventListener('keydown', onKeyDown, true)\n doc.addEventListener('focus', onFocus, true)\n doc.addEventListener('pointerdown', onPointerDown, true)\n doc.addEventListener('pointerup', onPointerGestureEnd, true)\n doc.addEventListener('pointercancel', onPointerGestureEnd, true)\n installedDocuments.add(doc)\n return () => {\n doc.removeEventListener('keydown', onKeyDown, true)\n doc.removeEventListener('focus', onFocus, true)\n doc.removeEventListener('pointerdown', onPointerDown, true)\n doc.removeEventListener('pointerup', onPointerGestureEnd, true)\n doc.removeEventListener('pointercancel', onPointerGestureEnd, true)\n doc.removeEventListener('pointermove', onPointerMove, true)\n installedDocuments.delete(doc)\n }\n}\n\n/**\n * Reference-counted install for the tooltip root: the first tooltip in a\n * document acquires the gate, the last one to unmount releases it. The document\n * parameter exists so tests can drive the counter without a global DOM; the\n * production call site guards on the server render before calling.\n */\nconst gateHolders = new WeakMap<Document, number>()\nconst gateDisposers = new WeakMap<Document, () => void>()\n\nexport function acquireTooltipFocusGate(targetDoc?: Document): void {\n if (typeof document === 'undefined' && !targetDoc) return\n const doc = targetDoc ?? document\n const holders = gateHolders.get(doc) ?? 0\n gateHolders.set(doc, holders + 1)\n if (holders === 0) gateDisposers.set(doc, installTooltipFocusGate(doc))\n}\n\nexport function releaseTooltipFocusGate(targetDoc?: Document): void {\n if (typeof document === 'undefined' && !targetDoc) return\n const doc = targetDoc ?? document\n const holders = gateHolders.get(doc) ?? 0\n if (holders === 0) return\n if (holders === 1) {\n gateHolders.delete(doc)\n gateDisposers.get(doc)?.()\n gateDisposers.delete(doc)\n return\n }\n gateHolders.set(doc, holders - 1)\n}\n"],"mappings":";;;;;AAyFA,IAAa,iCAAiC;;;AAI9C,IAAM,uBAAuB;;;;;;AAO7B,SAAS,kBAAkB,QAAiC;CAC1D,MAAM,UAAU;CAChB,IAAI,OAAO,SAAS,YAAY,YAAY,OAAO;CACnD,OAAO,QAAQ,QAAQ,oBAAoB;AAC7C;;;;;;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U,CAAC;CAChC,IAAI,YAAY,GAAG,cAAc,IAAI,KAAK,wBAAwB,GAAG,CAAC;AACxE;AAEA,SAAgB,wBAAwB,WAA4B;CAClE,IAAI,OAAO,aAAa,eAAe,CAAC,WAAW;CACnD,MAAM,MAAM,aAAa;CACzB,MAAM,UAAU,YAAY,IAAI,GAAG,KAAK;CACxC,IAAI,YAAY,GAAG;CACnB,IAAI,YAAY,GAAG;EACjB,YAAY,OAAO,GAAG;EACtB,cAAc,IAAI,GAAG,CAAC,GAAG;EACzB,cAAc,OAAO,GAAG;EACxB;CACF;CACA,YAAY,IAAI,KAAK,UAAU,CAAC;AAClC"}
|
|
1
|
+
{"version":3,"file":"tooltip-focus-gate.js","names":[],"sources":["../../src/lib/tooltip-focus-gate.ts"],"sourcesContent":["/*\n * Tooltips open on active hover over the control, or on keyboard focus that\n * follows a Tab key press. They must never open from programmatic focus: the\n * autofocus a dialog or sheet gives its first control, and the focus a closing\n * overlay restores to its opener, both land on buttons that carry tooltips,\n * and the tooltip primitive opens immediately on focus and pins the tooltip\n * until blur. That is the \"tooltip auto-displays when a sheet opens\" report,\n * and the pinned tooltip is the \"tooltip gets stuck and never disappears\"\n * report: the pointer is nowhere near the control, so no pointer leave ever\n * closes it.\n *\n * The trigger listens for the native `focus` event on the trigger element, and\n * composites build tooltips internally (ActionButton renders one from its\n * `tooltip` prop), so the single interception point that covers every tooltip\n * is a capture-phase `focus` listener on `document`. When focus lands without a\n * keyboard-intent signal on a button-like element, the event is stopped before\n * any element listener runs: the tooltip never learns about the focus. Hover\n * opens are untouched (they ride pointer events), and the separate `focusin`\n * event still flows, so dialog focus-cycle tracking, `:focus-visible` styling,\n * and focus restoration all keep working. Focus still lands, only the event\n * is stopped, so `document.activeElement` and scripted `.blur()` behave.\n *\n * The keyboard-intent signal is a Tab key press immediately before the focus,\n * the only key that moves focus natively. Enter and Space open overlays too,\n * so any \"recent key\" window wide enough for those would let an overlay's own\n * autofocus back through; Tab-only keeps autofocus suppressed no matter how\n * the overlay was opened, while normal Tab navigation still announces each\n * control's tooltip (hover descriptions stay reachable from the keyboard).\n *\n * Suppression is scoped to button-like targets (`button`, `a[href]`,\n * `[role=\"button\"]`, `[role=\"link\"]`). Composite widgets that move focus\n * programmatically, menu items, listbox options, grid cells, are other\n * element types whose roving-focus highlighting must keep receiving focus\n * events, and text controls keep their own focus behaviour (select on focus,\n * caret placement).\n *\n * Suppressed focus is real as far as the DOM is concerned (`activeElement`\n * moves; only the event was stopped), and the tooltip interaction model treats\n * a trigger that is `activeElement` as keyboard-held: while a tooltip on it is\n * open, pointer movement away only *requests* a close and the request is\n * refused for as long as the pointer keeps moving. Left alone, a later real\n * hover on that control would open the tip and never let it leave, the\n * residual \"stuck\" case. The gate therefore treats a suppressed focus as a\n * phantom and releases it: the first pointer activity after the focus (a\n * pointer session taking over from a script) blurs the element. Keyboard\n * sessions never release it and never need to, keyboard focus moves by Tab,\n * which is never suppressed, so nothing pins; and the release only runs for\n * elements still holding `activeElement`, so a Tab already taken from the\n * phantom is left alone.\n *\n * Only a pointer that actually travels releases the phantom. WebKit (Safari,\n * WKWebView) dispatches a `pointermove` at the unchanged position whenever a\n * scroll moves content under a resting mouse, and a dialog's restored focus or\n * an autofocus usually scrolls its control into view, so releasing on any\n * move blurred focus no one had touched. That move reports no travel\n * (`movementX` and `movementY` are both 0); a move that reports no movement\n * fields at all still counts as travel (see `pointerMoveTravelled`).\n *\n * Focus that arrives while a pointer button is held belongs to a pointer\n * gesture, not to a tooltip: the pixel resize handle focuses its handle when a\n * drag starts and cancels the drag on blur, so a gesture focus must pass\n * through untouched (no suppression, no phantom, no release). A gesture's own\n * click behaviour already keeps tooltips closed, and the autofocus cases this\n * gate exists for all happen with the pointer up.\n *\n * A tab in a roving-focus tab list is the one button-like element whose\n * programmatic focus is the widget working as designed: a dialog's focus scope\n * and the tab list both put focus on the selected tab, and the tab list scrolls\n * it into view on every focus-in. Releasing that focus would hand it straight\n * back (the scope restores it), so every pointer move would re-suppress,\n * re-release and re-scroll the rail to the top, and a tab below the fold of a\n * large-font or short-window rail could not be clicked. A focus on `role=\"tab\"`\n * is therefore still hidden from the tooltip, so no tooltip opens from it, but\n * it is not tracked as a phantom and the pointer never blurs it.\n *\n * Independently of the gesture window, resize grips render as\n * `<button role=\"separator\">` and carry no tooltip, so they are excluded from\n * the button-like scope entirely (see `isButtonLikeFocusTarget`).\n *\n * The gate is installed by the `Tooltip` root for the lifetime of the first\n * tooltip in a document and removed when the last one unmounts, so every\n * consumer of the primitive, including composites that build their own\n * tooltips, inherits the contract without wiring of its own.\n */\n\n/** How long after a Tab key press a resulting focus event still counts as\n * keyboard navigation. The native focus move follows the key press\n * immediately; the window only has to bridge that dispatch, not a later\n * script-driven focus. */\nexport const TOOLTIP_FOCUS_INTENT_WINDOW_MS = 250\n\n/** Elements a tooltip-bearing control is rendered as. Everything else keeps\n * its native focus behaviour, and so do resize grips (see below). */\nconst BUTTON_LIKE_SELECTOR = 'button, a[href], [role=\"button\"], [role=\"link\"]'\n\n/**\n * Whether a focus event landing on this target could open a tooltip on a\n * button-like control. Accepts any Element (an SVG glyph inside a control,\n * for instance) and duck-types so the decision is testable without a DOM.\n */\nfunction buttonLikeControl(target: unknown): Element | null {\n const element = target as Element | null | undefined\n if (typeof element?.closest !== 'function') return null\n return element.closest(BUTTON_LIKE_SELECTOR)\n}\n\n/**\n * Whether the focus target is a tab of a roving-focus tab list. Its focus is\n * hidden from tooltips like any other programmatic focus, but it is never\n * released by the pointer (see the header).\n */\nexport function isTabFocusTarget(target: unknown): boolean {\n return buttonLikeControl(target)?.getAttribute?.('role') === 'tab'\n}\n\nexport function isButtonLikeFocusTarget(target: unknown): boolean {\n const control = buttonLikeControl(target)\n if (control === null) return false\n // Resize grips render as `<button role=\"separator\">` and focus themselves\n // when a pointer drag starts. They carry no tooltip, and the blur that\n // releases a suppressed focus would end the drag on its first move.\n return control.getAttribute?.('role') !== 'separator'\n}\n\n/**\n * The suppression decision: a button-like focus target hides a tooltip only\n * when no keyboard navigation is in flight. Anything else, a Tab-driven\n * focus, or focus on a non-button element, passes through untouched.\n */\nexport function shouldSuppressTooltipFocus(input: {\n isButtonLike: boolean\n keyboardIntentActive: boolean\n}): boolean {\n return input.isButtonLike && !input.keyboardIntentActive\n}\n\n/**\n * Whether a `pointermove` comes from a pointer that moved, rather than one a\n * browser dispatched at the same position because content scrolled under it.\n * An event without movement fields counts as travel.\n */\nexport function pointerMoveTravelled(event: { movementX?: number; movementY?: number }): boolean {\n const { movementX, movementY } = event\n if (typeof movementX !== 'number' || typeof movementY !== 'number') return true\n return movementX !== 0 || movementY !== 0\n}\n\nconst installedDocuments = new WeakSet<Document>()\n\n/**\n * Install the gate on a document. Idempotent per document; returns a disposer\n * that removes the listeners (used by tests and by the tooltip root, which\n * releases the gate when its document's last tooltip unmounts).\n */\nexport function installTooltipFocusGate(doc: Document = document): () => void {\n if (installedDocuments.has(doc)) return () => {}\n\n let lastTabKeyDownAt = Number.NEGATIVE_INFINITY\n /** True between a pointerdown and its pointerup/pointercancel: focus events\n * inside that window belong to a pointer gesture (drag bootstrap, press)\n * and must reach their element untouched. */\n let pointerGestureActive = false\n /** The element holding a suppressed programmatic focus, if it still holds\n * `activeElement`. One slot: a newer suppressed focus replaces an older\n * one, and anything that already lost focus needs no release. */\n let phantomFocusTarget: Element | undefined\n /** The phantom-release `pointermove` listener exists only while a phantom\n * does: a gate that parks a permanent pointer listener on every document\n * with a tooltip in it costs every page a standing listener for a state\n * that is live for a few hundred milliseconds at most. */\n let phantomReleaseAttached = false\n const onKeyDown = (event: KeyboardEvent) => {\n // A later activation key starts a different interaction: its overlay\n // autofocus must not inherit the preceding Tab navigation window.\n lastTabKeyDownAt = event.key === 'Tab' ? Date.now() : Number.NEGATIVE_INFINITY\n }\n const onPointerDown = () => {\n lastTabKeyDownAt = Number.NEGATIVE_INFINITY\n pointerGestureActive = true\n releasePhantomFocus()\n }\n const onPointerGestureEnd = () => {\n pointerGestureActive = false\n }\n const dropPhantom = () => {\n phantomFocusTarget = undefined\n if (phantomReleaseAttached) {\n phantomReleaseAttached = false\n doc.removeEventListener('pointermove', onPointerMove, true)\n }\n }\n const onFocus = (event: FocusEvent) => {\n // Focus that moves on retires the phantom: there is nothing left to\n // release, so the parked pointer listener goes with it.\n if (phantomFocusTarget && event.target !== phantomFocusTarget) dropPhantom()\n if (pointerGestureActive) return\n if (!isButtonLikeFocusTarget(event.target)) return\n const keyboardIntentActive = Date.now() - lastTabKeyDownAt <= TOOLTIP_FOCUS_INTENT_WINDOW_MS\n if (!shouldSuppressTooltipFocus({ isButtonLike: true, keyboardIntentActive })) return\n event.stopPropagation()\n if (isTabFocusTarget(event.target)) return\n phantomFocusTarget = event.target as Element\n if (!phantomReleaseAttached) {\n phantomReleaseAttached = true\n doc.addEventListener('pointermove', onPointerMove, true)\n }\n }\n const releasePhantomFocus = () => {\n if (pointerGestureActive) return\n if (!phantomFocusTarget) return\n const phantom = phantomFocusTarget\n dropPhantom()\n if ((doc as Document).activeElement !== phantom) return\n if (typeof (phantom as HTMLElement).blur === 'function') (phantom as HTMLElement).blur()\n }\n const onPointerMove = (event: PointerEvent) => {\n if (pointerMoveTravelled(event)) releasePhantomFocus()\n }\n\n doc.addEventListener('keydown', onKeyDown, true)\n doc.addEventListener('focus', onFocus, true)\n doc.addEventListener('pointerdown', onPointerDown, true)\n doc.addEventListener('pointerup', onPointerGestureEnd, true)\n doc.addEventListener('pointercancel', onPointerGestureEnd, true)\n installedDocuments.add(doc)\n return () => {\n doc.removeEventListener('keydown', onKeyDown, true)\n doc.removeEventListener('focus', onFocus, true)\n doc.removeEventListener('pointerdown', onPointerDown, true)\n doc.removeEventListener('pointerup', onPointerGestureEnd, true)\n doc.removeEventListener('pointercancel', onPointerGestureEnd, true)\n doc.removeEventListener('pointermove', onPointerMove, true)\n installedDocuments.delete(doc)\n }\n}\n\n/**\n * Reference-counted install for the tooltip root: the first tooltip in a\n * document acquires the gate, the last one to unmount releases it. The document\n * parameter exists so tests can drive the counter without a global DOM; the\n * production call site guards on the server render before calling.\n */\nconst gateHolders = new WeakMap<Document, number>()\nconst gateDisposers = new WeakMap<Document, () => void>()\n\nexport function acquireTooltipFocusGate(targetDoc?: Document): void {\n if (typeof document === 'undefined' && !targetDoc) return\n const doc = targetDoc ?? document\n const holders = gateHolders.get(doc) ?? 0\n gateHolders.set(doc, holders + 1)\n if (holders === 0) gateDisposers.set(doc, installTooltipFocusGate(doc))\n}\n\nexport function releaseTooltipFocusGate(targetDoc?: Document): void {\n if (typeof document === 'undefined' && !targetDoc) return\n const doc = targetDoc ?? document\n const holders = gateHolders.get(doc) ?? 0\n if (holders === 0) return\n if (holders === 1) {\n gateHolders.delete(doc)\n gateDisposers.get(doc)?.()\n gateDisposers.delete(doc)\n return\n }\n gateHolders.set(doc, holders - 1)\n}\n"],"mappings":";;;;;AAyFA,IAAa,iCAAiC;;;AAI9C,IAAM,uBAAuB;;;;;;AAO7B,SAAS,kBAAkB,QAAiC;CAC1D,MAAM,UAAU;CAChB,IAAI,OAAO,SAAS,YAAY,YAAY,OAAO;CACnD,OAAO,QAAQ,QAAQ,oBAAoB;AAC7C;;;;;;AAOA,SAAgB,iBAAiB,QAA0B;CACzD,OAAO,kBAAkB,MAAM,CAAC,EAAE,eAAe,MAAM,MAAM;AAC/D;AAEA,SAAgB,wBAAwB,QAA0B;CAChE,MAAM,UAAU,kBAAkB,MAAM;CACxC,IAAI,YAAY,MAAM,OAAO;CAI7B,OAAO,QAAQ,eAAe,MAAM,MAAM;AAC5C;;;;;;AAOA,SAAgB,2BAA2B,OAG/B;CACV,OAAO,MAAM,gBAAgB,CAAC,MAAM;AACtC;;;;;;AAOA,SAAgB,qBAAqB,OAA4D;CAC/F,MAAM,EAAE,WAAW,cAAc;CACjC,IAAI,OAAO,cAAc,YAAY,OAAO,cAAc,UAAU,OAAO;CAC3E,OAAO,cAAc,KAAK,cAAc;AAC1C;AAEA,IAAM,qCAAqB,IAAI,QAAkB;;;;;;AAOjD,SAAgB,wB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AAiB,SAAS,SAAS,IAAI;CAC3C,IAAI,iBAAiB,eAAe,eAAe,IAAI;CACvD,IAAI,iBAAiB,aAAa,qBAAqB,IAAI;CAC3D,IAAI,iBAAiB,iBAAiB,qBAAqB,IAAI;CAC/D,mBAAmB,IAAI,GAAG;CAC1B,aAAa;EACX,IAAI,oBAAoB,WAAW,WAAW,IAAI;EAClD,IAAI,oBAAoB,SAAS,SAAS,IAAI;EAC9C,IAAI,oBAAoB,eAAe,eAAe,IAAI;EAC1D,IAAI,oBAAoB,aAAa,qBAAqB,IAAI;EAC9D,IAAI,oBAAoB,iBAAiB,qBAAqB,IAAI;EAClE,IAAI,oBAAoB,eAAe,eAAe,IAAI;EAC1D,mBAAmB,OAAO,GAAG;CAC/B;AACF;;;;;;;AAQA,IAAM,8BAAc,IAAI,QAA0B;AAClD,IAAM,gCAAgB,IAAI,QAA8B;AAExD,SAAgB,wBAAwB,WAA4B;CAClE,IAAI,OAAO,aAAa,eAAe,CAAC,WAAW;CACnD,MAAM,MAAM,aAAa;CACzB,MAAM,UAAU,YAAY,IAAI,GAAG,KAAK;CACxC,YAAY,IAAI,KAAK,UAAU,CAAC;CAChC,IAAI,YAAY,GAAG,cAAc,IAAI,KAAK,wBAAwB,GAAG,CAAC;AACxE;AAEA,SAAgB,wBAAwB,WAA4B;CAClE,IAAI,OAAO,aAAa,eAAe,CAAC,WAAW;CACnD,MAAM,MAAM,aAAa;CACzB,MAAM,UAAU,YAAY,IAAI,GAAG,KAAK;CACxC,IAAI,YAAY,GAAG;CACnB,IAAI,YAAY,GAAG;EACjB,YAAY,OAAO,GAAG;EACtB,cAAc,IAAI,GAAG,CAAC,GAAG;EACzB,cAAc,OAAO,GAAG;EACxB;CACF;CACA,YAAY,IAAI,KAAK,UAAU,CAAC;AAClC"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import cn_tables_generated_default from "./cn-tables.generated.js";
|
|
2
1
|
import { createCn } from "cn/engine";
|
|
2
|
+
import cn_tables_generated_default from "./cn-tables.generated.js";
|
|
3
3
|
// src/lib/utils.ts
|
|
4
4
|
/**
|
|
5
5
|
* Merge conditional class values, letting the last conflicting utility win.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { extname } from "node:path";
|
|
2
1
|
import { parse } from "@babel/parser";
|
|
2
|
+
import { extname } from "node:path";
|
|
3
3
|
// src/vite/source-parser.ts
|
|
4
4
|
/** Parse source without depending on the TypeScript compiler's JavaScript API. */
|
|
5
5
|
function parseSource(file, source) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defaultExport, directRuntimeExports, dynamicRuntimeImports, hasRuntimeDeclaration, parseSource, runtimeReexports, selectNamespace, staticRuntimeImports } from "./source-parser.js";
|
|
2
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, symlinkSync, writeFileSync } from "node:fs";
|
|
4
3
|
import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { defaultExport, directRuntimeExports, dynamicRuntimeImports, hasRuntimeDeclaration, parseSource, runtimeReexports, selectNamespace, staticRuntimeImports } from "./source-parser.js";
|
|
5
5
|
import { normalizePath } from "vite";
|
|
6
6
|
// src/vite/tailwind-sources.ts
|
|
7
7
|
var defaultLabel = "ui-tailwind-sources";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/ui",
|
|
3
|
-
"version": "0.162.
|
|
3
|
+
"version": "0.162.7",
|
|
4
4
|
"description": "The Adea design system: ui-sdk-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adea",
|
|
@@ -190,8 +190,8 @@
|
|
|
190
190
|
"tw-animate-css": "^1.4.0"
|
|
191
191
|
},
|
|
192
192
|
"devDependencies": {
|
|
193
|
-
"@babel/core": "^8.1.
|
|
194
|
-
"@babel/parser": "^8.1.
|
|
193
|
+
"@babel/core": "^8.1.2",
|
|
194
|
+
"@babel/parser": "^8.1.2",
|
|
195
195
|
"@babel/preset-typescript": "^8.0.7",
|
|
196
196
|
"@solidjs/compiler": "2.0.2",
|
|
197
197
|
"@solidjs/vite-plugin": "3.0.1",
|
|
@@ -203,17 +203,17 @@
|
|
|
203
203
|
"solid-js": "2.0.3",
|
|
204
204
|
"storybook": "^10.6.7",
|
|
205
205
|
"storybook-solidjs-vite": "^10.7.4",
|
|
206
|
-
"vite": "^8.3.
|
|
206
|
+
"vite": "^8.3.8"
|
|
207
207
|
},
|
|
208
208
|
"peerDependencies": {
|
|
209
|
-
"@babel/core": "^8.
|
|
210
|
-
"@babel/parser": "^8.
|
|
209
|
+
"@babel/core": "^8.1.2",
|
|
210
|
+
"@babel/parser": "^8.1.2",
|
|
211
211
|
"@babel/preset-typescript": "^8.0.7",
|
|
212
212
|
"@solidjs/web": "^2.0.3",
|
|
213
213
|
"chart.js": "^4.6.1",
|
|
214
214
|
"embla-carousel": "^8.6.0",
|
|
215
215
|
"solid-js": "^2.0.3",
|
|
216
|
-
"vite": "^8.3.
|
|
216
|
+
"vite": "^8.3.8"
|
|
217
217
|
},
|
|
218
218
|
"peerDependenciesMeta": {
|
|
219
219
|
"@babel/core": {
|