@adea-ai/ui 0.152.4 → 0.153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +469 -580
- package/dist/components/composites/account-menu/account-menu.d.ts +5 -0
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +37 -13
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.d.ts +2 -1
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +92 -66
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +57 -57
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +9 -9
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.d.ts +7 -7
- package/dist/components/composites/appearance-editor/theme-preview.d.ts +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +6 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +36 -36
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +4 -4
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.d.ts.map +1 -1
- package/dist/components/composites/chat/chat.js +33 -37
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts +3 -3
- package/dist/components/composites/checkpoint/checkpoint-model.js +2 -2
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.d.ts +2 -2
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.d.ts +2 -2
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.d.ts +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +7 -3
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -3
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/citation.d.ts +1 -1
- package/dist/components/composites/inline-citation/citation.js +1 -1
- package/dist/components/composites/inline-citation/citation.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts +2 -2
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +22 -22
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.d.ts +5 -0
- package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row.js +75 -83
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.d.ts +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts +4 -4
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/model-selector/models.d.ts +2 -2
- package/dist/components/composites/model-selector/models.js +1 -1
- package/dist/components/composites/model-selector/models.js.map +1 -1
- package/dist/components/composites/plan/plan.d.ts.map +1 -1
- package/dist/components/composites/plan/plan.js +17 -15
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.d.ts.map +1 -1
- package/dist/components/composites/queue/queue.js +5 -7
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.d.ts +4 -4
- package/dist/components/composites/reasoning/reasoning.js +4 -4
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +63 -14
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +32 -32
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/source.d.ts +1 -1
- package/dist/components/composites/sources/source.js.map +1 -1
- package/dist/components/composites/sources/sources.d.ts +2 -2
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/parse-stack-trace.js +4 -4
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.d.ts.map +1 -1
- package/dist/components/composites/stat/stat.js +14 -16
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
- package/dist/components/composites/subagent/subagent.js +6 -4
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/task/task.d.ts +1 -1
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.d.ts +3 -3
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal-model.d.ts +3 -3
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal-model.js +1 -1
- package/dist/components/composites/terminal/terminal-model.js.map +1 -1
- package/dist/components/composites/terminal/terminal.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal.js +24 -11
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results-model.d.ts +4 -4
- package/dist/components/composites/test-results/test-results-model.js +2 -2
- package/dist/components/composites/test-results/test-results-model.js.map +1 -1
- package/dist/components/composites/test-results/test-results.d.ts +1 -1
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.d.ts +4 -4
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.d.ts +1 -1
- package/dist/components/composites/tree/tree.d.ts.map +1 -1
- package/dist/components/composites/tree/tree.js +25 -18
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.d.ts +10 -4
- package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +14 -19
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/index.d.ts +1 -1
- package/dist/components/composites/update-dialog/index.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +4 -5
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.d.ts.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +19 -20
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
- package/dist/components/conversation/busy-send-button.js +18 -20
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/composer-menu.d.ts +3 -3
- package/dist/components/conversation/composer-menu.js +3 -3
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +2 -4
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
- package/dist/components/conversation/conversation-pane.js +6 -5
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +3 -7
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +76 -76
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +32 -38
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.d.ts.map +1 -1
- package/dist/components/conversation/message-row.js +79 -73
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +7 -7
- package/dist/components/conversation/scroll-follow-core.js +4 -4
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +19 -4
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/conversation/thread-panel.d.ts.map +1 -1
- package/dist/components/conversation/thread-panel.js +23 -23
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.d.ts.map +1 -1
- package/dist/components/conversation/transcript-composition.js +2 -2
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.d.ts +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +4 -6
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/page/page.d.ts.map +1 -1
- package/dist/components/layout/page/page.js +17 -17
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +2 -4
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.d.ts.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +16 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts +1 -1
- package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +35 -34
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +23 -23
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +2 -2
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.d.ts +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +7 -7
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/motion/presence.d.ts +2 -2
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts +5 -5
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.d.ts +1 -1
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/theme-catalogue-source.d.ts +2 -2
- package/dist/components/theme/theme-catalogue-source.js +2 -2
- package/dist/components/theme/theme-catalogue-source.js.map +1 -1
- package/dist/components/theme/theme-context.d.ts +2 -2
- package/dist/components/theme/theme-context.js +3 -3
- package/dist/components/theme/theme-context.js.map +1 -1
- package/dist/components/theme/theme-document.d.ts.map +1 -1
- package/dist/components/theme/theme-document.js +14 -9
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-picker.d.ts +5 -5
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.d.ts +0 -6
- package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
- package/dist/components/theme/theme-provider-value.js +9 -3
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-script.d.ts +14 -0
- package/dist/components/theme/theme-script.d.ts.map +1 -1
- package/dist/components/theme/theme-script.js +1 -0
- package/dist/components/theme/theme-script.js.map +1 -1
- package/dist/components/theme/theme-state.d.ts +7 -7
- package/dist/components/theme/theme-state.js.map +1 -1
- package/dist/components/theme/theme-toggle.d.ts +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/alert/alert.d.ts.map +1 -1
- package/dist/components/ui/alert/alert.js +4 -3
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +3 -3
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.d.ts.map +1 -1
- package/dist/components/ui/board/board.js +10 -6
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/bubble/bubble.d.ts.map +1 -1
- package/dist/components/ui/bubble/bubble.js +6 -4
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/button-group/button-group.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.js +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +6 -6
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.d.ts +4 -4
- package/dist/components/ui/callout/callout.js +4 -4
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.d.ts +2 -2
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.d.ts +4 -4
- package/dist/components/ui/carousel/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart-options.d.ts +7 -7
- package/dist/components/ui/chart/chart-options.js +9 -9
- package/dist/components/ui/chart/chart-options.js.map +1 -1
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js +16 -7
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +8 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +8 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/command/command.d.ts +4 -4
- package/dist/components/ui/command/command.js +4 -4
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.js +13 -13
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.d.ts +0 -4
- package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +17 -1
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +4 -3
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.d.ts +6 -6
- package/dist/components/ui/diff-block/diff-block.js +3 -3
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts +3 -3
- package/dist/components/ui/drawer/drawer.js +2 -2
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +5 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -1
- package/dist/components/ui/empty/empty-state.js +33 -36
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.d.ts +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +7 -7
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +15 -15
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.d.ts +1 -1
- package/dist/components/ui/field/number-field.js +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.d.ts +1 -1
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input-group/input-group.d.ts +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.d.ts +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.d.ts.map +1 -1
- package/dist/components/ui/item/item.js +26 -26
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.d.ts +2 -2
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/kbd/platform-modifier.d.ts +3 -3
- package/dist/components/ui/kbd/platform-modifier.js +3 -3
- package/dist/components/ui/kbd/platform-modifier.js.map +1 -1
- package/dist/components/ui/label/label.d.ts +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.d.ts.map +1 -1
- package/dist/components/ui/marker/marker.js +17 -19
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts +2 -2
- package/dist/components/ui/menubar/menubar.js +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js +16 -18
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +7 -11
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.d.ts +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +5 -4
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +2 -4
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.d.ts.map +1 -1
- package/dist/components/ui/popover/popover.js +11 -4
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/progress/progress.js +6 -8
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +73 -73
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +12 -6
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts +2 -2
- package/dist/components/ui/resizable/resizable.js +3 -3
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/select/select.d.ts +3 -3
- package/dist/components/ui/select/select.js +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +4 -3
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.d.ts +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.d.ts +1 -1
- package/dist/components/ui/spinner/spinner.js +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.d.ts +13 -13
- package/dist/components/ui/status-chip/status-chip.d.ts.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +11 -11
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +8 -6
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.d.ts +4 -4
- package/dist/components/ui/tabs/tabs.js +4 -4
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/textarea/textarea.d.ts +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.d.ts.map +1 -1
- package/dist/components/ui/toast/toast.js +13 -15
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.js +1 -1
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts +51 -0
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js +103 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +1 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -1
- package/dist/components/ui/tooltip/index.js +3 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +6 -5
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.d.ts.map +1 -1
- package/dist/components/ui/trace/trace.js +17 -17
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.d.ts +3 -3
- package/dist/components/ui/typography/typography.js +5 -5
- package/dist/components/ui/typography/typography.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/lib/accent-presets.d.ts +1 -1
- package/dist/lib/accent-presets.js.map +1 -1
- package/dist/lib/accent-roles.d.ts +2 -2
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/accent-roles.js.map +1 -1
- package/dist/lib/appearance-font-settings.d.ts.map +1 -1
- package/dist/lib/appearance-font-settings.js +15 -7
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/create-poll.d.ts +39 -0
- package/dist/lib/create-poll.d.ts.map +1 -0
- package/dist/lib/create-poll.js +116 -0
- package/dist/lib/create-poll.js.map +1 -0
- package/dist/lib/font-zoom.d.ts +1 -1
- package/dist/lib/font-zoom.js +1 -1
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/keyed-rows.d.ts +2 -1
- package/dist/lib/keyed-rows.d.ts.map +1 -1
- package/dist/lib/keyed-rows.js +3 -2
- package/dist/lib/keyed-rows.js.map +1 -1
- package/dist/lib/overlay.d.ts +5 -5
- package/dist/lib/overlay.js +5 -5
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/preference-store.d.ts +2 -2
- package/dist/lib/preference-store.js +2 -2
- package/dist/lib/preference-store.js.map +1 -1
- package/dist/lib/safe-script.d.ts +2 -2
- package/dist/lib/safe-script.js +2 -2
- package/dist/lib/safe-script.js.map +1 -1
- package/dist/lib/scroll-geometry.d.ts +1 -1
- package/dist/lib/scroll-geometry.js +1 -1
- package/dist/lib/scroll-geometry.js.map +1 -1
- package/dist/lib/text.d.ts +1 -1
- package/dist/lib/text.js +1 -1
- package/dist/lib/text.js.map +1 -1
- package/dist/lib/theme-accents.js +3 -3
- package/dist/lib/theme-accents.js.map +1 -1
- package/dist/lib/theme-css.js.map +1 -1
- package/dist/lib/theme-defaults.d.ts +4 -4
- package/dist/lib/theme-defaults.js +4 -4
- package/dist/lib/theme-defaults.js.map +1 -1
- package/dist/lib/theme-engine-light.js.map +1 -1
- package/dist/lib/theme-engine.d.ts +2 -2
- package/dist/lib/theme-engine.js +2 -2
- package/dist/lib/theme-engine.js.map +1 -1
- package/dist/lib/theme-projection.d.ts +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-projection.js.map +1 -1
- package/dist/lib/theme-records.d.ts +2 -2
- package/dist/lib/theme-records.js +2 -2
- package/dist/lib/theme-records.js.map +1 -1
- package/dist/lib/theme-types.d.ts +1 -1
- package/dist/lib/theme-types.js.map +1 -1
- package/dist/lib/themes.d.ts +13 -13
- package/dist/lib/themes.js +13 -13
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts +2 -2
- package/dist/lib/tokens.js +1 -1
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.d.ts +2 -2
- package/dist/lib/tooltip-focus-gate.js +2 -2
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/variants.d.ts +4 -4
- package/dist/lib/variants.js +1 -1
- package/dist/lib/variants.js.map +1 -1
- package/dist/lib/version-notes.d.ts +4 -4
- package/dist/lib/version-notes.js +4 -4
- package/dist/lib/version-notes.js.map +1 -1
- package/dist/lint.js.map +1 -1
- package/dist/r/account-menu.json +1 -0
- package/dist/r/lib.json +5 -0
- package/dist/r/registry.json +11 -0
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/dist/r/src/components/composites/action-button/action-button.tsx +124 -78
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/dist/r/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/dist/r/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/dist/r/src/components/composites/chat/chat.tsx +15 -9
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/dist/r/src/components/composites/context/context.tsx +2 -2
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/dist/r/src/components/composites/inline-citation/citation.ts +1 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/dist/r/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/dist/r/src/components/composites/list-row/list-row.tsx +69 -73
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -4
- package/dist/r/src/components/composites/model-selector/models.ts +2 -2
- package/dist/r/src/components/composites/plan/plan.tsx +19 -11
- package/dist/r/src/components/composites/queue/queue.tsx +5 -3
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/dist/r/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/dist/r/src/components/composites/settings/settings.tsx +14 -6
- package/dist/r/src/components/composites/sources/source.ts +1 -1
- package/dist/r/src/components/composites/sources/sources.tsx +2 -2
- package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/dist/r/src/components/composites/stat/stat.tsx +20 -16
- package/dist/r/src/components/composites/subagent/subagent.tsx +6 -4
- package/dist/r/src/components/composites/task/task.tsx +1 -1
- package/dist/r/src/components/composites/terminal/ansi.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal-model.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal.tsx +24 -12
- package/dist/r/src/components/composites/test-results/test-results-model.ts +4 -4
- package/dist/r/src/components/composites/test-results/test-results.tsx +1 -1
- package/dist/r/src/components/composites/tool/tool.tsx +4 -4
- package/dist/r/src/components/composites/tree/tree.tsx +31 -15
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/dist/r/src/components/composites/update-dialog/index.ts +1 -0
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/dist/r/src/components/conversation/busy-send-button.tsx +6 -2
- package/dist/r/src/components/conversation/composer-menu.tsx +3 -3
- package/dist/r/src/components/conversation/conversation-avatar.tsx +1 -1
- package/dist/r/src/components/conversation/conversation-pane.tsx +8 -5
- package/dist/r/src/components/conversation/conversation-surface.tsx +2 -2
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/dist/r/src/components/conversation/message-composer.tsx +4 -6
- package/dist/r/src/components/conversation/message-row.tsx +34 -26
- package/dist/r/src/components/conversation/scroll-follow-core.ts +8 -8
- package/dist/r/src/components/conversation/scroll-follow.ts +24 -8
- package/dist/r/src/components/conversation/thread-panel.tsx +7 -3
- package/dist/r/src/components/conversation/transcript-composition.tsx +4 -2
- package/dist/r/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/dist/r/src/components/layout/page/page.tsx +15 -11
- package/dist/r/src/components/layout/panel/panel.tsx +1 -1
- package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +38 -22
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/dist/r/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +8 -6
- package/dist/r/src/components/motion/presence.tsx +2 -2
- package/dist/r/src/components/theme/appearance-panel.tsx +5 -5
- package/dist/r/src/components/theme/lazy.ts +1 -1
- package/dist/r/src/components/theme/theme-catalogue-source.ts +2 -2
- package/dist/r/src/components/theme/theme-context.ts +3 -3
- package/dist/r/src/components/theme/theme-document.ts +22 -11
- package/dist/r/src/components/theme/theme-picker.tsx +5 -5
- package/dist/r/src/components/theme/theme-provider-value.ts +15 -3
- package/dist/r/src/components/theme/theme-script.ts +20 -0
- package/dist/r/src/components/theme/theme-state.ts +7 -7
- package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
- package/dist/r/src/components/ui/alert/alert.tsx +4 -3
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/dist/r/src/components/ui/badge/badge.tsx +2 -2
- package/dist/r/src/components/ui/board/board.tsx +17 -5
- package/dist/r/src/components/ui/bubble/bubble.tsx +6 -4
- package/dist/r/src/components/ui/button/button.tsx +2 -2
- package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
- package/dist/r/src/components/ui/calendar/calendar.tsx +2 -2
- package/dist/r/src/components/ui/callout/callout.tsx +4 -4
- package/dist/r/src/components/ui/card/card.tsx +2 -2
- package/dist/r/src/components/ui/carousel/carousel.tsx +6 -6
- package/dist/r/src/components/ui/chart/chart-options.ts +9 -9
- package/dist/r/src/components/ui/chart/chart.tsx +14 -1
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/dist/r/src/components/ui/code-block/code-block.tsx +14 -7
- package/dist/r/src/components/ui/command/command.tsx +7 -7
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/dist/r/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/dist/r/src/components/ui/dialog/dialog-layer.tsx +27 -1
- package/dist/r/src/components/ui/dialog/dialog.tsx +4 -3
- package/dist/r/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/dist/r/src/components/ui/drawer/drawer.tsx +3 -3
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/dist/r/src/components/ui/empty/empty-state.tsx +23 -18
- package/dist/r/src/components/ui/empty/empty.tsx +1 -1
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/dist/r/src/components/ui/field/field.tsx +15 -7
- package/dist/r/src/components/ui/field/number-field.tsx +1 -1
- package/dist/r/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/dist/r/src/components/ui/input-group/input-group.tsx +1 -1
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/dist/r/src/components/ui/item/item.tsx +24 -18
- package/dist/r/src/components/ui/kbd/kbd.tsx +2 -2
- package/dist/r/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/dist/r/src/components/ui/label/label.tsx +1 -1
- package/dist/r/src/components/ui/marker/marker.tsx +9 -5
- package/dist/r/src/components/ui/menubar/menubar.tsx +2 -2
- package/dist/r/src/components/ui/message/message.tsx +14 -13
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/dist/r/src/components/ui/native-select/native-select.tsx +1 -1
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/dist/r/src/components/ui/pagination/pagination.tsx +1 -1
- package/dist/r/src/components/ui/popover/popover.tsx +4 -2
- package/dist/r/src/components/ui/progress/progress.tsx +5 -3
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/dist/r/src/components/ui/resizable/resizable.tsx +5 -5
- package/dist/r/src/components/ui/select/select.tsx +4 -4
- package/dist/r/src/components/ui/sheet/sheet.tsx +4 -3
- package/dist/r/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/dist/r/src/components/ui/slider/slider.tsx +1 -1
- package/dist/r/src/components/ui/spinner/spinner.tsx +1 -1
- package/dist/r/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/dist/r/src/components/ui/switch/switch.tsx +9 -6
- package/dist/r/src/components/ui/tabs/tabs.tsx +4 -4
- package/dist/r/src/components/ui/textarea/textarea.tsx +1 -1
- package/dist/r/src/components/ui/toast/toast.tsx +6 -4
- package/dist/r/src/components/ui/toggle/toggle.tsx +1 -1
- package/dist/r/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/dist/r/src/components/ui/tooltip/index.ts +1 -0
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/dist/r/src/components/ui/trace/trace.tsx +13 -9
- package/dist/r/src/components/ui/typography/typography.tsx +5 -5
- package/dist/r/src/lib/accent-presets.ts +1 -1
- package/dist/r/src/lib/accent-roles.ts +2 -2
- package/dist/r/src/lib/appearance-font-settings.ts +18 -7
- package/dist/r/src/lib/create-poll.ts +150 -0
- package/dist/r/src/lib/font-zoom.ts +3 -3
- package/dist/r/src/lib/keyed-rows.ts +3 -2
- package/dist/r/src/lib/overlay.ts +5 -5
- package/dist/r/src/lib/preference-store.ts +2 -2
- package/dist/r/src/lib/safe-script.ts +2 -2
- package/dist/r/src/lib/scroll-geometry.ts +1 -1
- package/dist/r/src/lib/text.ts +1 -1
- package/dist/r/src/lib/theme-accents.ts +3 -3
- package/dist/r/src/lib/theme-css.ts +2 -2
- package/dist/r/src/lib/theme-defaults.ts +4 -4
- package/dist/r/src/lib/theme-engine-light.ts +2 -2
- package/dist/r/src/lib/theme-engine.ts +2 -2
- package/dist/r/src/lib/theme-projection.ts +2 -2
- package/dist/r/src/lib/theme-records.ts +2 -2
- package/dist/r/src/lib/theme-types.ts +1 -1
- package/dist/r/src/lib/themes.ts +14 -14
- package/dist/r/src/lib/tokens.ts +2 -2
- package/dist/r/src/lib/tooltip-focus-gate.ts +11 -11
- package/dist/r/src/lib/utils.ts +1 -1
- package/dist/r/src/lib/variants.ts +4 -4
- package/dist/r/src/lib/version-notes.ts +4 -4
- package/dist/r/src/styles/base.css +12 -43
- package/dist/r/src/styles/fonts.css +1 -1
- package/dist/r/src/styles/theme.css +35 -35
- package/dist/r/tooltip.json +5 -0
- package/package.json +2 -1
- package/registry.json +11 -0
- package/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/src/components/composites/action-button/action-button.tsx +124 -78
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/src/components/composites/chat/chat.tsx +15 -9
- package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/src/components/composites/context/context.tsx +2 -2
- package/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/src/components/composites/inline-citation/citation.ts +1 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/src/components/composites/list-row/list-row.tsx +69 -73
- package/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/src/components/composites/model-selector/model-selector.tsx +4 -4
- package/src/components/composites/model-selector/models.ts +2 -2
- package/src/components/composites/plan/plan.tsx +19 -11
- package/src/components/composites/queue/queue.tsx +5 -3
- package/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/src/components/composites/settings/settings.tsx +14 -6
- package/src/components/composites/sources/source.ts +1 -1
- package/src/components/composites/sources/sources.tsx +2 -2
- package/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/src/components/composites/stat/stat.tsx +20 -16
- package/src/components/composites/subagent/subagent.tsx +6 -4
- package/src/components/composites/task/task.tsx +1 -1
- package/src/components/composites/terminal/ansi.ts +3 -3
- package/src/components/composites/terminal/terminal-model.ts +3 -3
- package/src/components/composites/terminal/terminal.tsx +24 -12
- package/src/components/composites/test-results/test-results-model.ts +4 -4
- package/src/components/composites/test-results/test-results.tsx +1 -1
- package/src/components/composites/tool/tool.tsx +4 -4
- package/src/components/composites/tree/tree.tsx +31 -15
- package/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/src/components/composites/update-dialog/index.ts +1 -0
- package/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/src/components/conversation/busy-send-button.tsx +6 -2
- package/src/components/conversation/composer-menu.tsx +3 -3
- package/src/components/conversation/conversation-avatar.tsx +1 -1
- package/src/components/conversation/conversation-pane.tsx +8 -5
- package/src/components/conversation/conversation-surface.tsx +2 -2
- package/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/src/components/conversation/message-composer.tsx +4 -6
- package/src/components/conversation/message-row.tsx +34 -26
- package/src/components/conversation/scroll-follow-core.ts +8 -8
- package/src/components/conversation/scroll-follow.ts +24 -8
- package/src/components/conversation/thread-panel.tsx +7 -3
- package/src/components/conversation/transcript-composition.tsx +4 -2
- package/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/src/components/layout/page/page.tsx +15 -11
- package/src/components/layout/panel/panel.tsx +1 -1
- package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/src/components/layout/side-rail/side-rail.tsx +38 -22
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/src/components/layout/top-bar/top-bar.tsx +8 -6
- package/src/components/motion/presence.tsx +2 -2
- package/src/components/theme/appearance-panel.tsx +5 -5
- package/src/components/theme/lazy.ts +1 -1
- package/src/components/theme/theme-catalogue-source.ts +2 -2
- package/src/components/theme/theme-context.ts +3 -3
- package/src/components/theme/theme-document.ts +22 -11
- package/src/components/theme/theme-picker.tsx +5 -5
- package/src/components/theme/theme-provider-value.ts +15 -3
- package/src/components/theme/theme-script.ts +20 -0
- package/src/components/theme/theme-state.ts +7 -7
- package/src/components/theme/theme-toggle.tsx +1 -1
- package/src/components/ui/alert/alert.tsx +4 -3
- package/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/src/components/ui/badge/badge.tsx +2 -2
- package/src/components/ui/board/board.tsx +17 -5
- package/src/components/ui/bubble/bubble.tsx +6 -4
- package/src/components/ui/button/button.tsx +2 -2
- package/src/components/ui/button-group/button-group.tsx +1 -1
- package/src/components/ui/calendar/calendar.tsx +2 -2
- package/src/components/ui/callout/callout.tsx +4 -4
- package/src/components/ui/card/card.tsx +2 -2
- package/src/components/ui/carousel/carousel.tsx +6 -6
- package/src/components/ui/chart/chart-options.ts +9 -9
- package/src/components/ui/chart/chart.tsx +14 -1
- package/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/src/components/ui/code-block/code-block.tsx +14 -7
- package/src/components/ui/command/command.tsx +7 -7
- package/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/src/components/ui/dialog/dialog-layer.tsx +27 -1
- package/src/components/ui/dialog/dialog.tsx +4 -3
- package/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/src/components/ui/drawer/drawer.tsx +3 -3
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/src/components/ui/empty/empty-state.tsx +23 -18
- package/src/components/ui/empty/empty.tsx +1 -1
- package/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/src/components/ui/field/field.tsx +15 -7
- package/src/components/ui/field/number-field.tsx +1 -1
- package/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/src/components/ui/input-group/input-group.tsx +1 -1
- package/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/src/components/ui/item/item.tsx +24 -18
- package/src/components/ui/kbd/kbd.tsx +2 -2
- package/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/src/components/ui/label/label.tsx +1 -1
- package/src/components/ui/marker/marker.tsx +9 -5
- package/src/components/ui/menubar/menubar.tsx +2 -2
- package/src/components/ui/message/message.tsx +14 -13
- package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/src/components/ui/native-select/native-select.tsx +1 -1
- package/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/src/components/ui/pagination/pagination.tsx +1 -1
- package/src/components/ui/popover/popover.tsx +4 -2
- package/src/components/ui/progress/progress.tsx +5 -3
- package/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/src/components/ui/resizable/resizable.tsx +5 -5
- package/src/components/ui/select/select.tsx +4 -4
- package/src/components/ui/sheet/sheet.tsx +4 -3
- package/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/src/components/ui/slider/slider.tsx +1 -1
- package/src/components/ui/spinner/spinner.tsx +1 -1
- package/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/src/components/ui/switch/switch.tsx +9 -6
- package/src/components/ui/tabs/tabs.tsx +4 -4
- package/src/components/ui/textarea/textarea.tsx +1 -1
- package/src/components/ui/toast/toast.tsx +6 -4
- package/src/components/ui/toggle/toggle.tsx +1 -1
- package/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/src/components/ui/tooltip/index.ts +1 -0
- package/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/src/components/ui/trace/trace.tsx +13 -9
- package/src/components/ui/typography/typography.tsx +5 -5
- package/src/index.ts +1 -0
- package/src/lib/accent-presets.ts +1 -1
- package/src/lib/accent-roles.ts +2 -2
- package/src/lib/appearance-font-settings.ts +18 -7
- package/src/lib/create-poll.ts +150 -0
- package/src/lib/font-zoom.ts +3 -3
- package/src/lib/keyed-rows.ts +3 -2
- package/src/lib/overlay.ts +5 -5
- package/src/lib/preference-store.ts +2 -2
- package/src/lib/safe-script.ts +2 -2
- package/src/lib/scroll-geometry.ts +1 -1
- package/src/lib/text.ts +1 -1
- package/src/lib/theme-accents.ts +3 -3
- package/src/lib/theme-css.ts +2 -2
- package/src/lib/theme-defaults.ts +4 -4
- package/src/lib/theme-engine-light.ts +2 -2
- package/src/lib/theme-engine.ts +2 -2
- package/src/lib/theme-projection.ts +2 -2
- package/src/lib/theme-records.ts +2 -2
- package/src/lib/theme-types.ts +1 -1
- package/src/lib/themes.ts +14 -14
- package/src/lib/tokens.ts +2 -2
- package/src/lib/tooltip-focus-gate.ts +11 -11
- package/src/lib/utils.ts +1 -1
- package/src/lib/variants.ts +4 -4
- package/src/lib/version-notes.ts +4 -4
- package/src/lint/index.ts +1 -1
- package/src/styles/base.css +12 -43
- package/src/styles/fonts.css +1 -1
- package/src/styles/theme.css +35 -35
- package/src/styles/themes/aardvark-blue.css +98 -0
- package/src/styles/themes/aardvark-ink.css +98 -0
- package/src/styles/themes/adea-dark-colorblind.css +98 -0
- package/src/styles/themes/adea-dark-high-contrast.css +98 -0
- package/src/styles/themes/adea-dark.css +47 -0
- package/src/styles/themes/adea-light-colorblind.css +141 -0
- package/src/styles/themes/adea-light-high-contrast.css +141 -0
- package/src/styles/themes/adea-light.css +47 -0
- package/src/styles/themes/ayu-light.css +141 -0
- package/src/styles/themes/ayu-mirage.css +98 -0
- package/src/styles/themes/ayu.css +98 -0
- package/src/styles/themes/catppuccin-frappe.css +98 -0
- package/src/styles/themes/catppuccin-latte.css +141 -0
- package/src/styles/themes/catppuccin-macchiato.css +98 -0
- package/src/styles/themes/catppuccin-mocha.css +98 -0
- package/src/styles/themes/dracula.css +98 -0
- package/src/styles/themes/everforest-dark.css +98 -0
- package/src/styles/themes/everforest-light.css +141 -0
- package/src/styles/themes/gruvbox-dark.css +98 -0
- package/src/styles/themes/gruvbox-light.css +141 -0
- package/src/styles/themes/kanagawa.css +98 -0
- package/src/styles/themes/monokai.css +98 -0
- package/src/styles/themes/nord-light.css +141 -0
- package/src/styles/themes/nord.css +98 -0
- package/src/styles/themes/one-dark.css +98 -0
- package/src/styles/themes/rosepine-dawn.css +141 -0
- package/src/styles/themes/rosepine-moon.css +98 -0
- package/src/styles/themes/rosepine.css +98 -0
- package/src/styles/themes/solarized-dark.css +98 -0
- package/src/styles/themes/solarized-light.css +141 -0
- package/src/styles/themes/tokyonight-day.css +141 -0
- package/src/styles/themes/tokyonight-night.css +98 -0
- package/src/styles/themes/tokyonight-storm.css +98 -0
- package/src/styles/themes/vesper.css +98 -0
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInpu
|
|
|
26
26
|
import { ValueCombobox } from "./components/ui/combobox/value-combobox.js";
|
|
27
27
|
import { isCustomAccent, normalizeCustomAccent, paintAccentRoles, resolveAccentRoles } from "./lib/accent-roles.js";
|
|
28
28
|
import { Spinner } from "./components/ui/spinner/spinner.js";
|
|
29
|
+
import { createDeferredTooltip } from "./components/ui/tooltip/deferred-tooltip.js";
|
|
29
30
|
import { ActionButton } from "./components/composites/action-button/action-button.js";
|
|
30
31
|
import { CODE_BLOCK_LINE_LIMIT, CodeBlock, InlineCode, TALL_CODE_BLOCK_PX } from "./components/ui/code-block/code-block.js";
|
|
31
32
|
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandHint, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, CommandStatus } from "./components/ui/command/command.js";
|
|
@@ -141,7 +142,7 @@ import { ThemeProvider } from "./components/theme/theme-provider.js";
|
|
|
141
142
|
import { ThemeToggle } from "./components/theme/theme-toggle.js";
|
|
142
143
|
import { ThemeModeToggle } from "./components/theme/theme-mode-toggle.js";
|
|
143
144
|
import { AccountMenu, createAppMenuItems } from "./components/composites/account-menu/account-menu.js";
|
|
144
|
-
import {
|
|
145
|
+
import { createPoll } from "./lib/create-poll.js";
|
|
145
146
|
import { CatalogBrowser } from "./components/composites/catalog-browser/catalog-browser.js";
|
|
146
147
|
import { CatalogDetail, CatalogDetailSection } from "./components/composites/catalog-browser/catalog-detail.js";
|
|
147
148
|
import { ListRowControl } from "./components/composites/list-row/list-row-control.js";
|
|
@@ -191,7 +192,7 @@ import { PalettePreview, ThemeMiniature, ThemeMiniatureSplit } from "./component
|
|
|
191
192
|
import { SettingsRow } from "./components/composites/appearance-editor/appearance-rows.js";
|
|
192
193
|
import { AccentPicker, isCustomAccentValue } from "./components/composites/accent-picker/accent-picker.js";
|
|
193
194
|
import { AppearanceEditor, AppearanceEditorActions, AppearancePopover } from "./components/composites/appearance-editor/appearance-editor.js";
|
|
194
|
-
import {
|
|
195
|
+
import { writeClipboardText } from "./lib/clipboard.js";
|
|
195
196
|
import { UpdateDialog } from "./components/composites/update-dialog/update-dialog.js";
|
|
196
197
|
import { UpdateChannelControl } from "./components/composites/update-dialog/channel-control.js";
|
|
197
198
|
import { AboutDialog } from "./components/composites/about-dialog/about-dialog.js";
|
|
@@ -203,5 +204,6 @@ import { WorkspaceReorderDialog } from "./components/composites/workspace-switch
|
|
|
203
204
|
import { MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MarkImageError, centredSquare, checkMarkImageFile, isMarkImageDataUrl, markImageFromFile, markImageProblemCopy } from "./components/composites/icon-picker/image-data-url.js";
|
|
204
205
|
import { isShellIconKey, resolveShellIcon, shellIconEntries, shellIconLabel } from "./components/composites/icon-picker/shell-icons.js";
|
|
205
206
|
import { IconPicker, IconPickerDropdown } from "./components/composites/icon-picker/icon-picker.js";
|
|
207
|
+
import { formatBytes, formatReleaseDate, plainTextFromMarkdown } from "./lib/version-notes.js";
|
|
206
208
|
import { allTokens, colorTokens, densityTokens, designTokens, elevationTokens, motionTokens, radiusTokens, typographyTokens, undocumentedTokenAliases, zIndexTokens } from "./lib/tokens.js";
|
|
207
|
-
export { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, APPEARANCE_EDITOR_FONT_AXES, APPEARANCE_EDITOR_FONT_SIZE_MAX, APPEARANCE_EDITOR_FONT_SIZE_MIN, AboutDialog, AccentPicker, AccentSwatchGroups, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountMenu, ActionButton, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnnotationSurface, AppShell, AppShellBody, AppShellContent, AppShellMain, AppearanceEditor, AppearanceEditorActions, AppearanceFontSettingsGroup, AppearancePanel, AppearancePopover, SettingsRow as AppearanceSettingsRow, AspectRatio, Attachment, AttachmentCard, AttachmentList, Avatar, AvatarFallback, AvatarImage, Badge, Board, BoardCardBody, BoardCardTitle, BoardCardTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Bubble, BusySendButton, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHAIN_OF_THOUGHT_STATUS_LABELS, CODE_BLOCK_LINE_LIMIT, CalendarSurface, Callout, CalloutTitle, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CatalogBrowser, CatalogDetail, CatalogDetailSection, ChainOfThought, ChainOfThoughtResult, ChainOfThoughtResults, ChainOfThoughtStep, Chat, ChatComposer, ChatEmpty, ChatHeader, ChatNotice, Checkbox, CheckboxDescription, CheckboxLabel, Checkpoint, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandHint, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, CommandStatus, ComposerAttachmentButton, ComposerHint, ComposerMenu, ComposerMenuItem, Confirmation, Context, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContextualSidebar, ConversationAvatar, ConversationPane, ConversationSurface, DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, DatePicker, DetailPanel, DetailPanelBody, DetailPanelField, DetailPanelHeader, DetailPanelSection, Dialog, DialogClose, DialogCloseButton, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffBlock, DiffSummary, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, EntityIcon, FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, FILE_TREE_MAX_ROWS, FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, Field, FieldDescription, FieldError, FieldGroup, FieldInput, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTextArea, FileTree, FloatingPreview, FormField, Heading, HelpCenter, HoverCard, HoverCardContent, HoverCardTrigger, IconPicker, IconPickerDropdown, InlineCitation, InlineCode, Input, InputControl, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputOtp, InputOtpCaret, Item, ItemDescription, ItemEmpty, ItemGroup, ItemGroupEntry, ItemTitle, Kbd, KbdChord, KbdGroup, Label, ListGroup, ListRow, ListRowControl, MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MAX_LAYOUT_DEPTH, MAX_LAYOUT_LEAVES, MAX_SPLIT_RATIO, MIN_SPLIT_RATIO, MODEL_SEARCH_THRESHOLD, MarkImageError, Marker, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Message, MessageActions, MessageBody, MessageComposer, MessageContent, MessageDayDivider, MessageFooter, MessageGroup, MessageHeader, MessageRow, MessageScroller, MessageText, ModalDialog, ModelSelector, Motion, NativeSelect, NavigationMenu, NavigationMenuContent, NavigationMenuGroup, NavigationMenuGroupLabel, NavigationMenuItem, NavigationMenuMenu, NavigationMenuSeparator, NavigationMenuTrigger, NavigationMenuViewport, NumberField, OrbitItem, OrbitLayout, PASTE_THRESHOLD_CHARS, PASTE_THRESHOLD_LINES, PASTE_TOKEN_REGEX, Page, PageHeader, PageHeaderActions, PageHeaderContent, PageHeaderDescription, PageHeaderTitle, PageSection, Pagination, PaginationEllipsis, PaginationItem, PaginationNext, PaginationPrevious, PalettePreview, Panel, PanelActions, PanelBody, PanelCard, PanelDescription, PanelFooter, PanelHeader, PanelPlaceholder, PanelTitle, PanelToolbar, PixelPane, PixelResizeHandle, Plan, Popover, PopoverAnchor, PopoverCloseButton, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Presence, Progress, PropertyList, PropertyRow, PropertyTerm, PropertyValue, Questionnaire, Queue, QueueFollowUps, REDUCED_TRANSPARENCY_QUERY, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, SOURCE_SNIPPET_LIMIT, SOURCE_TITLE_LIMIT, STACK_MAX_LINES, STACK_TRACE_MAX_BLOCKS, SceneControls, ScrollArea, SecretInputGroup, Select, SelectChevronsUpDown, SelectContent, SelectItem, SelectLabel, SelectSection, SelectTrigger, SelectValue, Separator, SettingsField, SettingsLayout, SettingsNavigation, SettingsPage, SettingsRow$1 as SettingsRow, SettingsSection, Sheet, SheetBody, SheetCloseButton, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShellRail, ShellTopBar, SideRail, SideRailButton, SideRailContent, SideRailFooter, SideRailHeader, SideRailItem, SideRailSection, SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavLabel, SidebarNavResizeHandle, SidebarNavRow, SidebarNavSection, SidebarNavTitle, Skeleton, SkipLink, Slider, Sources, Spinner, SplitLayout, StackTrace, Stat, StatGroup, StatusBar, StatusBarItem, StatusBarSpacer, StatusChip, StatusList, Subagent, Suggestion, Suggestions, Switch, SwitchDescription, SwitchLabel, TALL_CODE_BLOCK_PX, TASK_ITEM_STATUS_LABELS, TERMINAL_MAX_LINES, TEST_RESULTS_LIST_LIMIT, TOOL_STATUS_LABELS, TOOL_VALUE_MAX_CHARS, TRACE_STATUS_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableNumericCell, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Task, TaskItemList, TaskItemRow, Terminal, TestResults, Text, TextLink, Textarea, ThemeMiniature, ThemeMiniatureSplit, ThemeModeToggle, ThemePicker, ThemePreview, ThemeProvider, ThemeSwatch, ThemeToggle, ThreadPanel, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TopBar, TopBarBreadcrumb, TopBarPill, TopBarSearch, TopBarSection, TopBarTitle, Trace, TraceDetail, TraceError, TraceLine, TraceMark, TranscriptComposition, Tree, TreeRow, TreeRowActions, UpdateChannelControl, UpdateDialog, ValueCombobox, VirtualWindow, WORK_STATUS_LABELS, WORK_TRACE_STATUS, WorkspaceMark, WorkspaceReorderDialog, WorkspaceSwitcher, accentPresets, alertVariants, allTokens, ansi256ToColor, ansiLineText, appearancePreviewThemes, applyAppearanceFontSettings, badgeVariants, boardCardTitleVariants, boundText, breakdownRows, bubbleVariants, buildFileTree, builtinThemes, buttonVariants, calloutVariants, captureAnchor, cardVariants, centredSquare, chatNoticeVariants, checkMarkImageFile, checkpointLabel, checkpointStatus, citationLabel, citationName, clampFloatingPreviewPosition, clampSplitRatio, clampWindow, classifyFrame, closePane, cn, colorTokens, computeLayoutFrames, confirmationOutcome, contextLabel, contextLevel, contextLevelWord, contextPercent, contextShort, contrastRatio, controlInteractive, controlSize, controlSizeIcon, controlSizes, countChanges, countLeaves, countLines, createAnsiParser, createAppMenuItems, createLayoutState, createVersionedPersistence, cva, decisionReason, dedentLines, defaultDarkThemeId, defaultLightThemeId, defaultPreferenceStorage, defaultThemeSelection, densityTokens, describeChanges, describeCount, describeFrameGroup, designTokens, diffLineVariants, diffStats, diffTargetPath, editorPaletteFor, elevationTokens, entityIconVariants, expandAll, findModel, findTokenRanges, firstFailureKey, flattenFileTree, focusPane, fontOptions, fontSettingsBootstrapScript, fontZoomShortcut, formatAttachmentSize, formatBytes, formatCost, formatDuration, formatExact, formatReleaseDate, formatDuration$1 as formatTestDuration, formatToken, formatTokens, formatToolValue, frameLocation, groupModels, groupStackEntries, hasContextFigures, headingElement, headingVariants, indexFileTree, initialExpanded, initialsFrom, safeScriptStringLiteral as inlineScriptLiteral, isAwaitingAnswer, isCustomAccent, isCustomAccentValue, isFailedExit, isFigure, isMarkImageDataUrl, isPasteBlock, isPlainStyle, isQuestionAnswered, isShellIconKey, isThemeAccentId, itemVariants, kbdChordKeys, kbdGroupVariants, kbdVariants, keyedRows, layoutDepth, listLeaves, listedCounts, localStoragePersistence, markImageFromFile, markImageProblemCopy, markerVariants, messageCitations, modelSearchValue, monogram, motionTokens, movePane, moveTarget, moveWorkspace, nearestAnsiColor, needsSearch, neighborLeaf, nextCitationMode, nextSeq, normalizeAppearanceEditorFontSettings, normalizeAppearanceEditorFontSize, normalizeCustomAccent, normalizeEfforts, normalizeLayout, normalizePath, normalizeSurface, paintAccentRoles, parseAnsi, parseDiff, parseInline, parseMessageText, parseStackTrace, partitionQueue, placeCitationMarkers, plainTextFromMarkdown, platformModifierKey, pruneBlocks, quarantineRecord, radiusTokens, readLegacyValue, readVersionedRecord, reasoningTitle, recollapsePastes, reconcileCounts, recoveryEnvelope, recoveryKeyFor, remapCarriedBlocks, resizeFloatingPreview, resizeSplit, resolveAccentPreset, resolveAccentRoles, resolveColors, resolveEffort, resolveFloatingPreviewFrame, resolveShellIcon, resolveSurface, resolveSurfaceState, resolveVariant, resolvedDensity, restoreAnchor, restoreControl, restoreDialogCopy, revealInWindow, safeHref, safePreviewSrc, safeSourceUrl, searchShortcutKeyshortcuts, searchShortcutLabel, settleDecision, sheetVariants, shellIconEntries, shellIconLabel, shouldCollapse, sidebarNavItemClass, sidebarNavItemStateClass, sourceHost, sourceTitle, sourcesLabel, splitLocation, splitPane, splitPaneBalanced, statusDotVariants, stepAppearanceFontSizes, stepCountLabel, stripTrailingBlankLines, suiteKey, suiteState, surfaceAlpha, surfaceInteractive, swapPanes, taskProgress, taskProgressLabel, terminalCssVariables, terminalStatusLabel, testKey, textElement, textVariants, textareaVariants, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themeScript, themeSurfaces, themesForAppearance, toast, toaster, toggleVariants, tokenRangeAt, tokensAsHex, transcriptDisclosureKey, typeaheadIndex, typographyTokens, undoClosePane, undocumentedTokenAliases, useOptionalTheme, useSideRail, useTheme, validateTheme, validateThemeRegistry, variantFromRecord, withAccent, wrapIndex, writeClipboardText, writeVersionedRecord, zIndexTokens };
|
|
209
|
+
export { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, APPEARANCE_EDITOR_FONT_AXES, APPEARANCE_EDITOR_FONT_SIZE_MAX, APPEARANCE_EDITOR_FONT_SIZE_MIN, AboutDialog, AccentPicker, AccentSwatchGroups, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountMenu, ActionButton, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnnotationSurface, AppShell, AppShellBody, AppShellContent, AppShellMain, AppearanceEditor, AppearanceEditorActions, AppearanceFontSettingsGroup, AppearancePanel, AppearancePopover, SettingsRow as AppearanceSettingsRow, AspectRatio, Attachment, AttachmentCard, AttachmentList, Avatar, AvatarFallback, AvatarImage, Badge, Board, BoardCardBody, BoardCardTitle, BoardCardTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Bubble, BusySendButton, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHAIN_OF_THOUGHT_STATUS_LABELS, CODE_BLOCK_LINE_LIMIT, CalendarSurface, Callout, CalloutTitle, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CatalogBrowser, CatalogDetail, CatalogDetailSection, ChainOfThought, ChainOfThoughtResult, ChainOfThoughtResults, ChainOfThoughtStep, Chat, ChatComposer, ChatEmpty, ChatHeader, ChatNotice, Checkbox, CheckboxDescription, CheckboxLabel, Checkpoint, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandHint, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, CommandStatus, ComposerAttachmentButton, ComposerHint, ComposerMenu, ComposerMenuItem, Confirmation, Context, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContextualSidebar, ConversationAvatar, ConversationPane, ConversationSurface, DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, DatePicker, DetailPanel, DetailPanelBody, DetailPanelField, DetailPanelHeader, DetailPanelSection, Dialog, DialogClose, DialogCloseButton, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffBlock, DiffSummary, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, EntityIcon, FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, FILE_TREE_MAX_ROWS, FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, Field, FieldDescription, FieldError, FieldGroup, FieldInput, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTextArea, FileTree, FloatingPreview, FormField, Heading, HelpCenter, HoverCard, HoverCardContent, HoverCardTrigger, IconPicker, IconPickerDropdown, InlineCitation, InlineCode, Input, InputControl, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputOtp, InputOtpCaret, Item, ItemDescription, ItemEmpty, ItemGroup, ItemGroupEntry, ItemTitle, Kbd, KbdChord, KbdGroup, Label, ListGroup, ListRow, ListRowControl, MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MAX_LAYOUT_DEPTH, MAX_LAYOUT_LEAVES, MAX_SPLIT_RATIO, MIN_SPLIT_RATIO, MODEL_SEARCH_THRESHOLD, MarkImageError, Marker, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Message, MessageActions, MessageBody, MessageComposer, MessageContent, MessageDayDivider, MessageFooter, MessageGroup, MessageHeader, MessageRow, MessageScroller, MessageText, ModalDialog, ModelSelector, Motion, NativeSelect, NavigationMenu, NavigationMenuContent, NavigationMenuGroup, NavigationMenuGroupLabel, NavigationMenuItem, NavigationMenuMenu, NavigationMenuSeparator, NavigationMenuTrigger, NavigationMenuViewport, NumberField, OrbitItem, OrbitLayout, PASTE_THRESHOLD_CHARS, PASTE_THRESHOLD_LINES, PASTE_TOKEN_REGEX, Page, PageHeader, PageHeaderActions, PageHeaderContent, PageHeaderDescription, PageHeaderTitle, PageSection, Pagination, PaginationEllipsis, PaginationItem, PaginationNext, PaginationPrevious, PalettePreview, Panel, PanelActions, PanelBody, PanelCard, PanelDescription, PanelFooter, PanelHeader, PanelPlaceholder, PanelTitle, PanelToolbar, PixelPane, PixelResizeHandle, Plan, Popover, PopoverAnchor, PopoverCloseButton, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Presence, Progress, PropertyList, PropertyRow, PropertyTerm, PropertyValue, Questionnaire, Queue, QueueFollowUps, REDUCED_TRANSPARENCY_QUERY, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, SOURCE_SNIPPET_LIMIT, SOURCE_TITLE_LIMIT, STACK_MAX_LINES, STACK_TRACE_MAX_BLOCKS, SceneControls, ScrollArea, SecretInputGroup, Select, SelectChevronsUpDown, SelectContent, SelectItem, SelectLabel, SelectSection, SelectTrigger, SelectValue, Separator, SettingsField, SettingsLayout, SettingsNavigation, SettingsPage, SettingsRow$1 as SettingsRow, SettingsSection, Sheet, SheetBody, SheetCloseButton, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShellRail, ShellTopBar, SideRail, SideRailButton, SideRailContent, SideRailFooter, SideRailHeader, SideRailItem, SideRailSection, SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavLabel, SidebarNavResizeHandle, SidebarNavRow, SidebarNavSection, SidebarNavTitle, Skeleton, SkipLink, Slider, Sources, Spinner, SplitLayout, StackTrace, Stat, StatGroup, StatusBar, StatusBarItem, StatusBarSpacer, StatusChip, StatusList, Subagent, Suggestion, Suggestions, Switch, SwitchDescription, SwitchLabel, TALL_CODE_BLOCK_PX, TASK_ITEM_STATUS_LABELS, TERMINAL_MAX_LINES, TEST_RESULTS_LIST_LIMIT, TOOL_STATUS_LABELS, TOOL_VALUE_MAX_CHARS, TRACE_STATUS_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableNumericCell, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Task, TaskItemList, TaskItemRow, Terminal, TestResults, Text, TextLink, Textarea, ThemeMiniature, ThemeMiniatureSplit, ThemeModeToggle, ThemePicker, ThemePreview, ThemeProvider, ThemeSwatch, ThemeToggle, ThreadPanel, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TopBar, TopBarBreadcrumb, TopBarPill, TopBarSearch, TopBarSection, TopBarTitle, Trace, TraceDetail, TraceError, TraceLine, TraceMark, TranscriptComposition, Tree, TreeRow, TreeRowActions, UpdateChannelControl, UpdateDialog, ValueCombobox, VirtualWindow, WORK_STATUS_LABELS, WORK_TRACE_STATUS, WorkspaceMark, WorkspaceReorderDialog, WorkspaceSwitcher, accentPresets, alertVariants, allTokens, ansi256ToColor, ansiLineText, appearancePreviewThemes, applyAppearanceFontSettings, badgeVariants, boardCardTitleVariants, boundText, breakdownRows, bubbleVariants, buildFileTree, builtinThemes, buttonVariants, calloutVariants, captureAnchor, cardVariants, centredSquare, chatNoticeVariants, checkMarkImageFile, checkpointLabel, checkpointStatus, citationLabel, citationName, clampFloatingPreviewPosition, clampSplitRatio, clampWindow, classifyFrame, closePane, cn, colorTokens, computeLayoutFrames, confirmationOutcome, contextLabel, contextLevel, contextLevelWord, contextPercent, contextShort, contrastRatio, controlInteractive, controlSize, controlSizeIcon, controlSizes, countChanges, countLeaves, countLines, createAnsiParser, createAppMenuItems, createDeferredTooltip, createLayoutState, createPoll, createVersionedPersistence, cva, decisionReason, dedentLines, defaultDarkThemeId, defaultLightThemeId, defaultPreferenceStorage, defaultThemeSelection, densityTokens, describeChanges, describeCount, describeFrameGroup, designTokens, diffLineVariants, diffStats, diffTargetPath, editorPaletteFor, elevationTokens, entityIconVariants, expandAll, findModel, findTokenRanges, firstFailureKey, flattenFileTree, focusPane, fontOptions, fontSettingsBootstrapScript, fontZoomShortcut, formatAttachmentSize, formatBytes, formatCost, formatDuration, formatExact, formatReleaseDate, formatDuration$1 as formatTestDuration, formatToken, formatTokens, formatToolValue, frameLocation, groupModels, groupStackEntries, hasContextFigures, headingElement, headingVariants, indexFileTree, initialExpanded, initialsFrom, safeScriptStringLiteral as inlineScriptLiteral, isAwaitingAnswer, isCustomAccent, isCustomAccentValue, isFailedExit, isFigure, isMarkImageDataUrl, isPasteBlock, isPlainStyle, isQuestionAnswered, isShellIconKey, isThemeAccentId, itemVariants, kbdChordKeys, kbdGroupVariants, kbdVariants, keyedRows, layoutDepth, listLeaves, listedCounts, localStoragePersistence, markImageFromFile, markImageProblemCopy, markerVariants, messageCitations, modelSearchValue, monogram, motionTokens, movePane, moveTarget, moveWorkspace, nearestAnsiColor, needsSearch, neighborLeaf, nextCitationMode, nextSeq, normalizeAppearanceEditorFontSettings, normalizeAppearanceEditorFontSize, normalizeCustomAccent, normalizeEfforts, normalizeLayout, normalizePath, normalizeSurface, paintAccentRoles, parseAnsi, parseDiff, parseInline, parseMessageText, parseStackTrace, partitionQueue, placeCitationMarkers, plainTextFromMarkdown, platformModifierKey, pruneBlocks, quarantineRecord, radiusTokens, readLegacyValue, readVersionedRecord, reasoningTitle, recollapsePastes, reconcileCounts, recoveryEnvelope, recoveryKeyFor, remapCarriedBlocks, resizeFloatingPreview, resizeSplit, resolveAccentPreset, resolveAccentRoles, resolveColors, resolveEffort, resolveFloatingPreviewFrame, resolveShellIcon, resolveSurface, resolveSurfaceState, resolveVariant, resolvedDensity, restoreAnchor, restoreControl, restoreDialogCopy, revealInWindow, safeHref, safePreviewSrc, safeSourceUrl, searchShortcutKeyshortcuts, searchShortcutLabel, settleDecision, sheetVariants, shellIconEntries, shellIconLabel, shouldCollapse, sidebarNavItemClass, sidebarNavItemStateClass, sourceHost, sourceTitle, sourcesLabel, splitLocation, splitPane, splitPaneBalanced, statusDotVariants, stepAppearanceFontSizes, stepCountLabel, stripTrailingBlankLines, suiteKey, suiteState, surfaceAlpha, surfaceInteractive, swapPanes, taskProgress, taskProgressLabel, terminalCssVariables, terminalStatusLabel, testKey, textElement, textVariants, textareaVariants, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themeScript, themeSurfaces, themesForAppearance, toast, toaster, toggleVariants, tokenRangeAt, tokensAsHex, transcriptDisclosureKey, typeaheadIndex, typographyTokens, undoClosePane, undocumentedTokenAliases, useOptionalTheme, useSideRail, useTheme, validateTheme, validateThemeRegistry, variantFromRecord, withAccent, wrapIndex, writeClipboardText, writeVersionedRecord, zIndexTokens };
|
|
@@ -12,7 +12,7 @@ export declare function isPresetAccentId(id: string): boolean;
|
|
|
12
12
|
* The accent axis.
|
|
13
13
|
*
|
|
14
14
|
* adea's accent presets, as a selection rather than a constant. `theme` is the
|
|
15
|
-
* default and means "the variant's own primary"
|
|
15
|
+
* default and means "the variant's own primary", monochrome in adea's palette,
|
|
16
16
|
* and each named preset overrides the interactive roles through the
|
|
17
17
|
* `[data-accent]` blocks in `theme.css`.
|
|
18
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accent-presets.js","names":[],"sources":["../../src/lib/accent-presets.ts"],"sourcesContent":["import { ACCENTS, getAccent } from '@adea-ai/themes'\nimport { THEME_DEFAULT_ID } from './theme-defaults'\n\n/*\n * Its own module so the theme provider's start-up path (the stored-preference reader\n * and the boot script both need the preset ids) does not import the token manifest in\n * `tokens.ts`, which is 20 KB of documentation data a provider never reads.\n */\n\n/**\n * A preset by id (`blue`), or `undefined` for `theme`, a theme-carried accent or an\n * unknown id. The catalogue's own lookup, re-exported rather than copied so a host's\n * stored-preference reader resolves an id exactly as the catalogue does without\n * importing `lib/themes`.\n */\nexport { getAccent }\n\n/** Whether an id names one of the six presets (not `theme`, not a theme-carried accent). */\nexport function isPresetAccentId(id: string): boolean {\n return getAccent(id) !== undefined\n}\n\n/**\n * The accent axis.\n *\n * adea's accent presets, as a selection rather than a constant. `theme` is the\n * default and means \"the variant's own primary\"
|
|
1
|
+
{"version":3,"file":"accent-presets.js","names":[],"sources":["../../src/lib/accent-presets.ts"],"sourcesContent":["import { ACCENTS, getAccent } from '@adea-ai/themes'\nimport { THEME_DEFAULT_ID } from './theme-defaults'\n\n/*\n * Its own module so the theme provider's start-up path (the stored-preference reader\n * and the boot script both need the preset ids) does not import the token manifest in\n * `tokens.ts`, which is 20 KB of documentation data a provider never reads.\n */\n\n/**\n * A preset by id (`blue`), or `undefined` for `theme`, a theme-carried accent or an\n * unknown id. The catalogue's own lookup, re-exported rather than copied so a host's\n * stored-preference reader resolves an id exactly as the catalogue does without\n * importing `lib/themes`.\n */\nexport { getAccent }\n\n/** Whether an id names one of the six presets (not `theme`, not a theme-carried accent). */\nexport function isPresetAccentId(id: string): boolean {\n return getAccent(id) !== undefined\n}\n\n/**\n * The accent axis.\n *\n * adea's accent presets, as a selection rather than a constant. `theme` is the\n * default and means \"the variant's own primary\", monochrome in adea's palette,\n * and each named preset overrides the interactive roles through the\n * `[data-accent]` blocks in `theme.css`.\n *\n * These are the same six presets `accentPresets` exports in adea's own\n * `appearance.ts`, and the values match. A consumer's appearance picker and the\n * workshop's theme toolbar read this one list, so the two cannot disagree about\n * what a preset is called or what colour it is.\n */\nexport type AccentPreset = {\n /** The `data-accent` value. `theme` is the variant's own primary. */\n id: string\n label: string\n /** What the preset is for, in the gallery and in a picker. */\n description: string\n /** The accent as it appears in the light theme. Absent for `theme`. */\n light?: string\n /** The accent as it appears in the dark theme. Absent for `theme`. */\n dark?: string\n}\n\nexport const accentPresets: readonly AccentPreset[] = Object.freeze([\n {\n id: THEME_DEFAULT_ID,\n label: 'Theme',\n description:\n \"The variant's own primary. Neutral in adea's palette, so the interface stays monochrome.\",\n },\n ...ACCENTS,\n])\n\n/**\n * The six brand accent presets, in the order a picker should show them: the list\n * `accentPresets` carries after its own `theme` entry.\n *\n * Here and not beside the theme table in `lib/themes.ts` because a bundler places a\n * module whole, and a host that wants only the list should not ship the 34-theme\n * catalogue with it.\n */\nexport const accents = ACCENTS\n"],"mappings":";;;;AAkBA,SAAgB,iBAAiB,IAAqB;CACpD,OAAO,UAAU,EAAE,MAAM,KAAA;AAC3B;AA2BA,IAAa,gBAAyC,OAAO,OAAO,CAClE;CACE,IAAI;CACJ,OAAO;CACP,aACE;AACJ,GACA,GAAG,OACL,CAAC;;;;;;;;;AAUD,IAAa,UAAU"}
|
|
@@ -45,8 +45,8 @@ export declare function normalizeAccentValue(value: string, background: string,
|
|
|
45
45
|
*
|
|
46
46
|
* Deliberately narrower than {@link parseColor}. A stored accent is compared,
|
|
47
47
|
* deduplicated and used as an attribute, so it has one spelling; a host that
|
|
48
|
-
* accepts `#abc` in a field expands it before storing. Anything else
|
|
49
|
-
* `rgb()`, a short or alpha form, a non-string
|
|
48
|
+
* accepts `#abc` in a field expands it before storing. Anything else, a name, an
|
|
49
|
+
* `rgb()`, a short or alpha form, a non-string, is not an accent and returns
|
|
50
50
|
* `undefined`.
|
|
51
51
|
*/
|
|
52
52
|
export declare function normalizeCustomAccent(value: unknown): string | undefined;
|
package/dist/lib/accent-roles.js
CHANGED
|
@@ -118,8 +118,8 @@ function normalizeAccentValue(value, background, minimum = 3) {
|
|
|
118
118
|
*
|
|
119
119
|
* Deliberately narrower than {@link parseColor}. A stored accent is compared,
|
|
120
120
|
* deduplicated and used as an attribute, so it has one spelling; a host that
|
|
121
|
-
* accepts `#abc` in a field expands it before storing. Anything else
|
|
122
|
-
* `rgb()`, a short or alpha form, a non-string
|
|
121
|
+
* accepts `#abc` in a field expands it before storing. Anything else, a name, an
|
|
122
|
+
* `rgb()`, a short or alpha form, a non-string, is not an accent and returns
|
|
123
123
|
* `undefined`.
|
|
124
124
|
*/
|
|
125
125
|
function normalizeCustomAccent(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accent-roles.js","names":["parseCanonicalColor","canonicalContrastRatio","getAccent"],"sources":["../../src/lib/accent-roles.ts"],"sourcesContent":["/*\n * Copyright (c) 2026 Wing\n * SPDX-License-Identifier: MIT\n *\n * The colour helpers, the contrast gate and the custom-accent grammar are\n * substantially translated from Zeron's `Color` and `AccentRoles`\n * (https://github.com/zeronsh/zeron), as Adea's accepted port of them in\n * `packages/ui/src/components/appearance.ts` expresses it. Extracted here so the\n * shared provider and Adea run one implementation; `@adea-ai/themes` owns the\n * colour engine (parsing, contrast, repair, the preset values and their roles).\n * See NOTICE.\n */\n\nimport {\n accentRoles,\n accentValue,\n primarySubtleCss,\n type AccentPreset,\n type AccentRoles as CatalogueAccentRoles,\n} from '@adea-ai/themes'\nimport {\n contrastRatio as canonicalContrastRatio,\n oklchToHex,\n parseColor as parseCanonicalColor,\n repairContrast,\n type Oklch,\n} from '@adea-ai/themes/oklch'\nimport { getAccent } from './accent-presets'\nimport { isThemeAccentId } from './theme-accents'\nimport { THEME_DEFAULT_ID } from './theme-defaults'\nimport type { ThemeAppearance } from './theme-types'\n\n/**\n * Accent colour maths and the roles an accent paints.\n *\n * Three questions live here, and none of them touches the document or a signal:\n *\n * - **What colour is this?** `parseColor`, `colorToHex`, `contrastRatio` and\n * `ensureContrast` are the hex helpers a host needs around an accent (an\n * imported theme's colours, a colour field). Hex is the host preference format;\n * the catalogue's colour engine does the maths.\n * - **Is this accent readable on this surface?** The *contrast floor*. A preset is\n * curated, so the catalogue already measured it against its own themes and the\n * floor is the identity for it; a custom `#rrggbb` is anyone's choice, so it is\n * raised until it clears the floor and can never ship unreadable. A host that\n * imports themes (whose backgrounds the catalogue never saw) turns the floor on\n * for presets too.\n * - **Which custom properties does an accent own?** `AccentRoles`, written on\n * `<html>` by the provider and onto one element by {@link paintAccentRoles}.\n */\n\nexport type RgbColor = Readonly<{ r: number; g: number; b: number; a: number }>\n\nconst HEX = /^#([0-9a-fA-F]+)$/\n\n/** Parse a hex colour (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`). `undefined` for anything else. */\nexport function parseColor(value: string): RgbColor | undefined {\n const match = HEX.exec(value.trim())\n const digits = match?.[1]\n if (!digits) return undefined\n if (digits.length === 3 || digits.length === 4) {\n const [r, g, b, a] = [...digits].map((digit) => Number.parseInt(digit + digit, 16))\n return { r: r!, g: g!, b: b!, a: a ?? 255 }\n }\n if (digits.length === 6 || digits.length === 8) {\n const byte = (index: number) => Number.parseInt(digits.slice(index, index + 2), 16)\n return { r: byte(0), g: byte(2), b: byte(4), a: digits.length === 8 ? byte(6) : 255 }\n }\n return undefined\n}\n\nfunction toHexByte(value: number): string {\n return value.toString(16).padStart(2, '0')\n}\n\n/** `#rrggbb`, or `#rrggbbaa` when the colour is not opaque. */\nexport function colorToHex(color: RgbColor): string {\n const opaque = `#${toHexByte(color.r)}${toHexByte(color.g)}${toHexByte(color.b)}`\n return color.a === 255 ? opaque : `${opaque}${toHexByte(color.a)}`\n}\n\nfunction blendOver(foreground: RgbColor, background: RgbColor): RgbColor {\n const alpha = foreground.a / 255\n const blend = (front: number, back: number) => Math.round(front * alpha + back * (1 - alpha))\n return {\n r: blend(foreground.r, background.r),\n g: blend(foreground.g, background.g),\n b: blend(foreground.b, background.b),\n a: 255,\n }\n}\n\nfunction toCanonicalColor(color: RgbColor): Oklch | undefined {\n return parseCanonicalColor(colorToHex({ ...color, a: 255 }))\n}\n\n/** WCAG contrast ratio between two colours. Alpha composites over the background first. */\nexport function contrastRatio(\n foreground: RgbColor | string,\n background: RgbColor | string\n): number {\n const front = typeof foreground === 'string' ? parseColor(foreground) : foreground\n const back = typeof background === 'string' ? parseColor(background) : background\n if (!front || !back) return 0\n const opaqueFront = front.a === 255 ? front : blendOver(front, back)\n const foregroundColor = toCanonicalColor(opaqueFront)\n const backgroundColor = toCanonicalColor(back)\n if (!foregroundColor || !backgroundColor) return 0\n return canonicalContrastRatio(foregroundColor, backgroundColor)\n}\n\nconst WHITE: RgbColor = { r: 255, g: 255, b: 255, a: 255 }\nconst WHITE_OKLCH: Oklch = { l: 1, c: 0, h: 0 }\n\n/**\n * The nearest colour to `source` that reaches `minimum` against `canvas`, as hex.\n *\n * The catalogue's `repairContrast` is asked for a little more than the floor, in\n * 0.001 steps up to 0.05, because the result is rounded to 8-bit hex and the\n * rounded colour is what is measured: asking for exactly the floor can land a hair\n * under it after rounding. If nothing in that range survives the rounding, white or\n * black stands in, whichever clears the floor.\n */\nfunction repairedHex(source: Oklch, canvas: Oklch, minimum: number): string {\n for (let margin = 0; margin <= 0.05; margin = Number((margin + 0.001).toFixed(3))) {\n const repaired = repairContrast(source, canvas, minimum + margin)\n if (!repaired.satisfied) continue\n const hex = oklchToHex(repaired.color)\n const rounded = parseCanonicalColor(hex)\n if (rounded && canonicalContrastRatio(rounded, canvas) >= minimum) return hex\n }\n return canonicalContrastRatio(WHITE_OKLCH, canvas) >= minimum ? '#ffffff' : '#000000'\n}\n\n/** Preserve the host hex shape while delegating contrast repair to the catalogue. */\nexport function ensureContrast(color: RgbColor, background: RgbColor, minimum: number): RgbColor {\n if (contrastRatio(color, background) >= minimum) return color\n\n const renderedColor = color.a === 255 ? color : blendOver(color, background)\n const source = toCanonicalColor(renderedColor)\n const canvas = toCanonicalColor(background)\n if (!source || !canvas) return color\n return parseColor(repairedHex(source, canvas, minimum))!\n}\n\n/** The contrast an accent is held to against its surface unless the host sets another. */\nexport const DEFAULT_ACCENT_CONTRAST_FLOOR = 3\n\n/**\n * Normalise a custom accent against a surface: unparseable input is rejected\n * (`undefined`), and any accepted colour is raised to `minimum` so an accent can\n * never ship unreadable. Accepts every CSS hex length; for the stored grammar use\n * {@link normalizeCustomAccent}.\n */\nexport function normalizeAccentValue(\n value: string,\n background: string,\n minimum: number = DEFAULT_ACCENT_CONTRAST_FLOOR\n): string | undefined {\n const parsed = parseColor(value)\n if (!parsed) return undefined\n const backdrop = parseColor(background) ?? WHITE\n return colorToHex(ensureContrast(parsed, backdrop, minimum))\n}\n\n/**\n * The stored form of a custom accent: `#rrggbb`, six digits, opaque, lower case.\n *\n * Deliberately narrower than {@link parseColor}. A stored accent is compared,\n * deduplicated and used as an attribute, so it has one spelling; a host that\n * accepts `#abc` in a field expands it before storing. Anything else — a name, an\n * `rgb()`, a short or alpha form, a non-string — is not an accent and returns\n * `undefined`.\n */\nexport function normalizeCustomAccent(value: unknown): string | undefined {\n return typeof value === 'string' && CUSTOM_ACCENT_PATTERN.test(value)\n ? value.toLowerCase()\n : undefined\n}\n\n/** The stored grammar of a custom accent, for code that cannot call {@link normalizeCustomAccent}. */\nexport const CUSTOM_ACCENT_PATTERN = /^#[0-9a-fA-F]{6}$/\n\n/** Whether a selection's accent is the custom `#rrggbb` form (any letter case). */\nexport function isCustomAccent(value: unknown): boolean {\n return normalizeCustomAccent(value) !== undefined\n}\n\n/**\n * A stored accent selection in its one spelling, or `undefined` when it is none of\n * the four kinds: `theme`, a preset id, a theme-derived slot (`ansi-blue`, kept\n * whenever it names a slot, because the next pair may offer it), or a custom colour.\n * Readability is settled when an accent is painted, never when it is read.\n */\nexport function normalizeAccentSelection(value: unknown): string | undefined {\n if (typeof value !== 'string') return undefined\n if (value === THEME_DEFAULT_ID || getAccent(value) || isThemeAccentId(value)) return value\n return normalizeCustomAccent(value)\n}\n\n/**\n * The roles an accent paints, as CSS values: the catalogue's `AccentRoles`, so the\n * provider, the generated stylesheet and a host's own paint cannot disagree about\n * what a role is. `primarySubtle` is an expression over `var(--primary)`; the\n * document writer never sets it (see {@link accentOverrideVariables}), an element\n * paint must.\n */\nexport type AccentRoles = CatalogueAccentRoles\n\n/** What an accent resolves against: the surface it sits on and the theme it sits in. */\nexport type AccentTarget = {\n /** The theme, or only its appearance. A theme gives the tint its measured strength. */\n target: Parameters<typeof accentRoles>[1]\n /** The surface the accent must read on. Without it nothing can be measured or repaired. */\n background: string | undefined\n /**\n * The contrast to hold the accent to against `background`. Absent, a preset is\n * painted verbatim and a custom colour is held to {@link DEFAULT_ACCENT_CONTRAST_FLOOR}.\n */\n floor?: number\n /**\n * The accents the selected theme pair carries (`ansi-blue`…), for an id that is\n * neither a preset nor a colour.\n */\n themeAccents?: readonly AccentPreset[]\n}\n\nfunction appearanceOf(target: AccentTarget['target']): ThemeAppearance {\n return typeof target === 'string' ? target : target.appearance\n}\n\n/**\n * `value` raised to `floor` against `background` as hex, or `value` itself when it\n * already clears the floor, is not a colour, or there is no surface to measure it on.\n *\n * Returning the argument itself is what makes the floor the identity for a preset\n * that already reads: the caller compares and keeps the catalogue's own roles.\n */\nfunction gateColor(value: string, background: string | undefined, floor: number): string {\n const source = parseCanonicalColor(value)\n const canvas = background ? parseCanonicalColor(background) : undefined\n if (!source || !canvas) return value\n if (canonicalContrastRatio(source, canvas) >= floor) return value\n return repairedHex(source, canvas, floor)\n}\n\n/**\n * The roles for a preset (or a custom colour made into one), held to the floor.\n *\n * A preset that clears the floor keeps the catalogue's roles untouched. One that\n * does not is repaired to the nearest passing colour and the whole role set is\n * rebuilt from the repaired value, so the label, hover and ring follow it instead\n * of describing a colour that is no longer on screen.\n */\nexport function accentRolesForPreset(\n preset: AccentPreset,\n context: AccentTarget\n): AccentRoles | undefined {\n const appearance = appearanceOf(context.target)\n const requested = accentValue(preset, appearance)\n if (!parseCanonicalColor(requested)) return undefined\n\n const floor = context.floor\n if (floor === undefined) return accentRoles(preset, context.target)\n\n const gated = gateColor(requested, context.background, floor)\n if (gated === requested) return accentRoles(preset, context.target)\n\n const roles = accentRoles({ ...preset, light: gated, dark: gated }, context.target)\n // The tint's strength is measured against the primary it will sit over, and the\n // repaired primary is not one the theme's own measurement saw.\n return { ...roles, primarySubtle: primarySubtleCss(context.target, '--primary', [gated]) }\n}\n\n/**\n * Resolve an accent selection to its roles, or `undefined` when it overrides nothing.\n *\n * `undefined` is \"use the theme's own primary\": the literal `theme`, an id that is\n * neither a preset, an offered theme accent nor a colour, and a colour that does not\n * parse. A host that wants one of those to mean something else decides before\n * asking (Adea's codec maps a stored `theme` to its default preset when it reads).\n */\nexport function resolveAccentRoles(accent: string, context: AccentTarget): AccentRoles | undefined {\n if (accent === THEME_DEFAULT_ID) return undefined\n\n const custom = normalizeCustomAccent(accent)\n if (custom) {\n const floor = context.floor ?? DEFAULT_ACCENT_CONTRAST_FLOOR\n return accentRolesForPreset(\n { id: 'custom', label: 'Custom', description: '', light: custom, dark: custom },\n { ...context, floor }\n )\n }\n\n const preset =\n getAccent(accent) ?? context.themeAccents?.find((candidate) => candidate.id === accent)\n return preset ? accentRolesForPreset(preset, context) : undefined\n}\n\n/** The custom property each accent role paints, in the order they are written. */\nconst ACCENT_ROLE_PROPERTIES = {\n primary: '--primary',\n primaryForeground: '--primary-foreground',\n primaryHover: '--primary-hover',\n primarySubtle: '--primary-subtle',\n ring: '--ring',\n} as const satisfies Record<keyof AccentRoles, string>\n\ntype AccentPaintProperty = (typeof ACCENT_ROLE_PROPERTIES)[keyof AccentRoles]\n\n/**\n * The custom properties an accent override owns on `<html>`.\n *\n * `--primary-subtle` is deliberately not among them. It is a `color-mix()` over\n * `var(--primary)`, so on the same element it follows an accent by itself, and its\n * strength is the theme's, measured to keep body text at 4.5:1 on the tint.\n * Writing one here would replace that measurement with the argument's.\n */\nexport function accentOverrideVariables(roles: AccentRoles): Record<string, string> {\n const properties: Record<string, string> = {}\n for (const [role, property] of Object.entries(ACCENT_ROLE_PROPERTIES)) {\n if (role !== 'primarySubtle') properties[property] = roles[role as keyof AccentRoles]\n }\n return properties\n}\n\n/** The custom properties {@link paintAccentRoles} writes and clears. */\nexport const ACCENT_PAINT_PROPERTIES: readonly AccentPaintProperty[] = Object.freeze(\n Object.values(ACCENT_ROLE_PROPERTIES)\n)\n\n/**\n * Scope an accent to one element and its descendants.\n *\n * Unlike the document, an element must write `--primary-subtle` too. A custom\n * property that uses `var()` is resolved where it is declared, so the tint inherited\n * from `<html>` is already a mix over *`<html>`'s* primary and an element that only\n * overrides `--primary` would keep the old tint. Declared here, the same expression\n * resolves against this element's primary.\n *\n * `undefined` clears every property, and the element inherits the document's accent\n * again.\n */\nexport function paintAccentRoles(\n element: { style: Pick<CSSStyleDeclaration, 'setProperty' | 'removeProperty'> },\n roles: AccentRoles | undefined\n): void {\n for (const [role, property] of Object.entries(ACCENT_ROLE_PROPERTIES)) {\n if (roles) element.style.setProperty(property, roles[role as keyof AccentRoles])\n else element.style.removeProperty(property)\n }\n}\n"],"mappings":";;;;;;AAqDA,IAAM,MAAM;;AAGZ,SAAgB,WAAW,OAAqC;CAE9D,MAAM,SADQ,IAAI,KAAK,MAAM,KAAK,CACnB,CAAA,GAAQ;CACvB,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,IAAI,OAAO,WAAW,KAAK,OAAO,WAAW,GAAG;EAC9C,MAAM,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,UAAU,OAAO,SAAS,QAAQ,OAAO,EAAE,CAAC;EAClF,OAAO;GAAK;GAAO;GAAO;GAAI,GAAG,KAAK;EAAI;CAC5C;CACA,IAAI,OAAO,WAAW,KAAK,OAAO,WAAW,GAAG;EAC9C,MAAM,QAAQ,UAAkB,OAAO,SAAS,OAAO,MAAM,OAAO,QAAQ,CAAC,GAAG,EAAE;EAClF,OAAO;GAAE,GAAG,KAAK,CAAC;GAAG,GAAG,KAAK,CAAC;GAAG,GAAG,KAAK,CAAC;GAAG,GAAG,OAAO,WAAW,IAAI,KAAK,CAAC,IAAI;EAAI;CACtF;AAEF;AAEA,SAAS,UAAU,OAAuB;CACxC,OAAO,MAAM,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;AAC3C;;AAGA,SAAgB,WAAW,OAAyB;CAClD,MAAM,SAAS,IAAI,UAAU,MAAM,CAAC,IAAI,UAAU,MAAM,CAAC,IAAI,UAAU,MAAM,CAAC;CAC9E,OAAO,MAAM,MAAM,MAAM,SAAS,GAAG,SAAS,UAAU,MAAM,CAAC;AACjE;AAEA,SAAS,UAAU,YAAsB,YAAgC;CACvE,MAAM,QAAQ,WAAW,IAAI;CAC7B,MAAM,SAAS,OAAe,SAAiB,KAAK,MAAM,QAAQ,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iB,WAAW,YAAY,MAAM;CAE7D,OAAO;AACT;;AAGA,IAAa,0BAA0D,OAAO,OAC5E,OAAO,OAAO,sBAAsB,CACtC;;;;;;;;;;;;;AAcA,SAAgB,iBACd,SACA,OACM;CACN,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,sBAAsB,GAClE,IAAI,OAAO,QAAQ,MAAM,YAAY,UAAU,MAAM,KAA0B;MAC1E,QAAQ,MAAM,eAAe,QAAQ;AAE9C"}
|
|
1
|
+
{"version":3,"file":"accent-roles.js","names":["parseCanonicalColor","canonicalContrastRatio","getAccent"],"sources":["../../src/lib/accent-roles.ts"],"sourcesContent":["/*\n * Copyright (c) 2026 Wing\n * SPDX-License-Identifier: MIT\n *\n * The colour helpers, the contrast gate and the custom-accent grammar are\n * substantially translated from Zeron's `Color` and `AccentRoles`\n * (https://github.com/zeronsh/zeron), as Adea's accepted port of them in\n * `packages/ui/src/components/appearance.ts` expresses it. Extracted here so the\n * shared provider and Adea run one implementation; `@adea-ai/themes` owns the\n * colour engine (parsing, contrast, repair, the preset values and their roles).\n * See NOTICE.\n */\n\nimport {\n accentRoles,\n accentValue,\n primarySubtleCss,\n type AccentPreset,\n type AccentRoles as CatalogueAccentRoles,\n} from '@adea-ai/themes'\nimport {\n contrastRatio as canonicalContrastRatio,\n oklchToHex,\n parseColor as parseCanonicalColor,\n repairContrast,\n type Oklch,\n} from '@adea-ai/themes/oklch'\nimport { getAccent } from './accent-presets'\nimport { isThemeAccentId } from './theme-accents'\nimport { THEME_DEFAULT_ID } from './theme-defaults'\nimport type { ThemeAppearance } from './theme-types'\n\n/**\n * Accent colour maths and the roles an accent paints.\n *\n * Three questions live here, and none of them touches the document or a signal:\n *\n * - **What colour is this?** `parseColor`, `colorToHex`, `contrastRatio` and\n * `ensureContrast` are the hex helpers a host needs around an accent (an\n * imported theme's colours, a colour field). Hex is the host preference format;\n * the catalogue's colour engine does the maths.\n * - **Is this accent readable on this surface?** The *contrast floor*. A preset is\n * curated, so the catalogue already measured it against its own themes and the\n * floor is the identity for it; a custom `#rrggbb` is anyone's choice, so it is\n * raised until it clears the floor and can never ship unreadable. A host that\n * imports themes (whose backgrounds the catalogue never saw) turns the floor on\n * for presets too.\n * - **Which custom properties does an accent own?** `AccentRoles`, written on\n * `<html>` by the provider and onto one element by {@link paintAccentRoles}.\n */\n\nexport type RgbColor = Readonly<{ r: number; g: number; b: number; a: number }>\n\nconst HEX = /^#([0-9a-fA-F]+)$/\n\n/** Parse a hex colour (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`). `undefined` for anything else. */\nexport function parseColor(value: string): RgbColor | undefined {\n const match = HEX.exec(value.trim())\n const digits = match?.[1]\n if (!digits) return undefined\n if (digits.length === 3 || digits.length === 4) {\n const [r, g, b, a] = [...digits].map((digit) => Number.parseInt(digit + digit, 16))\n return { r: r!, g: g!, b: b!, a: a ?? 255 }\n }\n if (digits.length === 6 || digits.length === 8) {\n const byte = (index: number) => Number.parseInt(digits.slice(index, index + 2), 16)\n return { r: byte(0), g: byte(2), b: byte(4), a: digits.length === 8 ? byte(6) : 255 }\n }\n return undefined\n}\n\nfunction toHexByte(value: number): string {\n return value.toString(16).padStart(2, '0')\n}\n\n/** `#rrggbb`, or `#rrggbbaa` when the colour is not opaque. */\nexport function colorToHex(color: RgbColor): string {\n const opaque = `#${toHexByte(color.r)}${toHexByte(color.g)}${toHexByte(color.b)}`\n return color.a === 255 ? opaque : `${opaque}${toHexByte(color.a)}`\n}\n\nfunction blendOver(foreground: RgbColor, background: RgbColor): RgbColor {\n const alpha = foreground.a / 255\n const blend = (front: number, back: number) => Math.round(front * alpha + back * (1 - alpha))\n return {\n r: blend(foreground.r, background.r),\n g: blend(foreground.g, background.g),\n b: blend(foreground.b, background.b),\n a: 255,\n }\n}\n\nfunction toCanonicalColor(color: RgbColor): Oklch | undefined {\n return parseCanonicalColor(colorToHex({ ...color, a: 255 }))\n}\n\n/** WCAG contrast ratio between two colours. Alpha composites over the background first. */\nexport function contrastRatio(\n foreground: RgbColor | string,\n background: RgbColor | string\n): number {\n const front = typeof foreground === 'string' ? parseColor(foreground) : foreground\n const back = typeof background === 'string' ? parseColor(background) : background\n if (!front || !back) return 0\n const opaqueFront = front.a === 255 ? front : blendOver(front, back)\n const foregroundColor = toCanonicalColor(opaqueFront)\n const backgroundColor = toCanonicalColor(back)\n if (!foregroundColor || !backgroundColor) return 0\n return canonicalContrastRatio(foregroundColor, backgroundColor)\n}\n\nconst WHITE: RgbColor = { r: 255, g: 255, b: 255, a: 255 }\nconst WHITE_OKLCH: Oklch = { l: 1, c: 0, h: 0 }\n\n/**\n * The nearest colour to `source` that reaches `minimum` against `canvas`, as hex.\n *\n * The catalogue's `repairContrast` is asked for a little more than the floor, in\n * 0.001 steps up to 0.05, because the result is rounded to 8-bit hex and the\n * rounded colour is what is measured: asking for exactly the floor can land a hair\n * under it after rounding. If nothing in that range survives the rounding, white or\n * black stands in, whichever clears the floor.\n */\nfunction repairedHex(source: Oklch, canvas: Oklch, minimum: number): string {\n for (let margin = 0; margin <= 0.05; margin = Number((margin + 0.001).toFixed(3))) {\n const repaired = repairContrast(source, canvas, minimum + margin)\n if (!repaired.satisfied) continue\n const hex = oklchToHex(repaired.color)\n const rounded = parseCanonicalColor(hex)\n if (rounded && canonicalContrastRatio(rounded, canvas) >= minimum) return hex\n }\n return canonicalContrastRatio(WHITE_OKLCH, canvas) >= minimum ? '#ffffff' : '#000000'\n}\n\n/** Preserve the host hex shape while delegating contrast repair to the catalogue. */\nexport function ensureContrast(color: RgbColor, background: RgbColor, minimum: number): RgbColor {\n if (contrastRatio(color, background) >= minimum) return color\n\n const renderedColor = color.a === 255 ? color : blendOver(color, background)\n const source = toCanonicalColor(renderedColor)\n const canvas = toCanonicalColor(background)\n if (!source || !canvas) return color\n return parseColor(repairedHex(source, canvas, minimum))!\n}\n\n/** The contrast an accent is held to against its surface unless the host sets another. */\nexport const DEFAULT_ACCENT_CONTRAST_FLOOR = 3\n\n/**\n * Normalise a custom accent against a surface: unparseable input is rejected\n * (`undefined`), and any accepted colour is raised to `minimum` so an accent can\n * never ship unreadable. Accepts every CSS hex length; for the stored grammar use\n * {@link normalizeCustomAccent}.\n */\nexport function normalizeAccentValue(\n value: string,\n background: string,\n minimum: number = DEFAULT_ACCENT_CONTRAST_FLOOR\n): string | undefined {\n const parsed = parseColor(value)\n if (!parsed) return undefined\n const backdrop = parseColor(background) ?? WHITE\n return colorToHex(ensureContrast(parsed, backdrop, minimum))\n}\n\n/**\n * The stored form of a custom accent: `#rrggbb`, six digits, opaque, lower case.\n *\n * Deliberately narrower than {@link parseColor}. A stored accent is compared,\n * deduplicated and used as an attribute, so it has one spelling; a host that\n * accepts `#abc` in a field expands it before storing. Anything else, a name, an\n * `rgb()`, a short or alpha form, a non-string, is not an accent and returns\n * `undefined`.\n */\nexport function normalizeCustomAccent(value: unknown): string | undefined {\n return typeof value === 'string' && CUSTOM_ACCENT_PATTERN.test(value)\n ? value.toLowerCase()\n : undefined\n}\n\n/** The stored grammar of a custom accent, for code that cannot call {@link normalizeCustomAccent}. */\nexport const CUSTOM_ACCENT_PATTERN = /^#[0-9a-fA-F]{6}$/\n\n/** Whether a selection's accent is the custom `#rrggbb` form (any letter case). */\nexport function isCustomAccent(value: unknown): boolean {\n return normalizeCustomAccent(value) !== undefined\n}\n\n/**\n * A stored accent selection in its one spelling, or `undefined` when it is none of\n * the four kinds: `theme`, a preset id, a theme-derived slot (`ansi-blue`, kept\n * whenever it names a slot, because the next pair may offer it), or a custom colour.\n * Readability is settled when an accent is painted, never when it is read.\n */\nexport function normalizeAccentSelection(value: unknown): string | undefined {\n if (typeof value !== 'string') return undefined\n if (value === THEME_DEFAULT_ID || getAccent(value) || isThemeAccentId(value)) return value\n return normalizeCustomAccent(value)\n}\n\n/**\n * The roles an accent paints, as CSS values: the catalogue's `AccentRoles`, so the\n * provider, the generated stylesheet and a host's own paint cannot disagree about\n * what a role is. `primarySubtle` is an expression over `var(--primary)`; the\n * document writer never sets it (see {@link accentOverrideVariables}), an element\n * paint must.\n */\nexport type AccentRoles = CatalogueAccentRoles\n\n/** What an accent resolves against: the surface it sits on and the theme it sits in. */\nexport type AccentTarget = {\n /** The theme, or only its appearance. A theme gives the tint its measured strength. */\n target: Parameters<typeof accentRoles>[1]\n /** The surface the accent must read on. Without it nothing can be measured or repaired. */\n background: string | undefined\n /**\n * The contrast to hold the accent to against `background`. Absent, a preset is\n * painted verbatim and a custom colour is held to {@link DEFAULT_ACCENT_CONTRAST_FLOOR}.\n */\n floor?: number\n /**\n * The accents the selected theme pair carries (`ansi-blue`…), for an id that is\n * neither a preset nor a colour.\n */\n themeAccents?: readonly AccentPreset[]\n}\n\nfunction appearanceOf(target: AccentTarget['target']): ThemeAppearance {\n return typeof target === 'string' ? target : target.appearance\n}\n\n/**\n * `value` raised to `floor` against `background` as hex, or `value` itself when it\n * already clears the floor, is not a colour, or there is no surface to measure it on.\n *\n * Returning the argument itself is what makes the floor the identity for a preset\n * that already reads: the caller compares and keeps the catalogue's own roles.\n */\nfunction gateColor(value: string, background: string | undefined, floor: number): string {\n const source = parseCanonicalColor(value)\n const canvas = background ? parseCanonicalColor(background) : undefined\n if (!source || !canvas) return value\n if (canonicalContrastRatio(source, canvas) >= floor) return value\n return repairedHex(source, canvas, floor)\n}\n\n/**\n * The roles for a preset (or a custom colour made into one), held to the floor.\n *\n * A preset that clears the floor keeps the catalogue's roles untouched. One that\n * does not is repaired to the nearest passing colour and the whole role set is\n * rebuilt from the repaired value, so the label, hover and ring follow it instead\n * of describing a colour that is no longer on screen.\n */\nexport function accentRolesForPreset(\n preset: AccentPreset,\n context: AccentTarget\n): AccentRoles | undefined {\n const appearance = appearanceOf(context.target)\n const requested = accentValue(preset, appearance)\n if (!parseCanonicalColor(requested)) return undefined\n\n const floor = context.floor\n if (floor === undefined) return accentRoles(preset, context.target)\n\n const gated = gateColor(requested, context.background, floor)\n if (gated === requested) return accentRoles(preset, context.target)\n\n const roles = accentRoles({ ...preset, light: gated, dark: gated }, context.target)\n // The tint's strength is measured against the primary it will sit over, and the\n // repaired primary is not one the theme's own measurement saw.\n return { ...roles, primarySubtle: primarySubtleCss(context.target, '--primary', [gated]) }\n}\n\n/**\n * Resolve an accent selection to its roles, or `undefined` when it overrides nothing.\n *\n * `undefined` is \"use the theme's own primary\": the literal `theme`, an id that is\n * neither a preset, an offered theme accent nor a colour, and a colour that does not\n * parse. A host that wants one of those to mean something else decides before\n * asking (Adea's codec maps a stored `theme` to its default preset when it reads).\n */\nexport function resolveAccentRoles(accent: string, context: AccentTarget): AccentRoles | undefined {\n if (accent === THEME_DEFAULT_ID) return undefined\n\n const custom = normalizeCustomAccent(accent)\n if (custom) {\n const floor = context.floor ?? DEFAULT_ACCENT_CONTRAST_FLOOR\n return accentRolesForPreset(\n { id: 'custom', label: 'Custom', description: '', light: custom, dark: custom },\n { ...context, floor }\n )\n }\n\n const preset =\n getAccent(accent) ?? context.themeAccents?.find((candidate) => candidate.id === accent)\n return preset ? accentRolesForPreset(preset, context) : undefined\n}\n\n/** The custom property each accent role paints, in the order they are written. */\nconst ACCENT_ROLE_PROPERTIES = {\n primary: '--primary',\n primaryForeground: '--primary-foreground',\n primaryHover: '--primary-hover',\n primarySubtle: '--primary-subtle',\n ring: '--ring',\n} as const satisfies Record<keyof AccentRoles, string>\n\ntype AccentPaintProperty = (typeof ACCENT_ROLE_PROPERTIES)[keyof AccentRoles]\n\n/**\n * The custom properties an accent override owns on `<html>`.\n *\n * `--primary-subtle` is deliberately not among them. It is a `color-mix()` over\n * `var(--primary)`, so on the same element it follows an accent by itself, and its\n * strength is the theme's, measured to keep body text at 4.5:1 on the tint.\n * Writing one here would replace that measurement with the argument's.\n */\nexport function accentOverrideVariables(roles: AccentRoles): Record<string, string> {\n const properties: Record<string, string> = {}\n for (const [role, property] of Object.entries(ACCENT_ROLE_PROPERTIES)) {\n if (role !== 'primarySubtle') properties[property] = roles[role as keyof AccentRoles]\n }\n return properties\n}\n\n/** The custom properties {@link paintAccentRoles} writes and clears. */\nexport const ACCENT_PAINT_PROPERTIES: readonly AccentPaintProperty[] = Object.freeze(\n Object.values(ACCENT_ROLE_PROPERTIES)\n)\n\n/**\n * Scope an accent to one element and its descendants.\n *\n * Unlike the document, an element must write `--primary-subtle` too. A custom\n * property that uses `var()` is resolved where it is declared, so the tint inherited\n * from `<html>` is already a mix over *`<html>`'s* primary and an element that only\n * overrides `--primary` would keep the old tint. Declared here, the same expression\n * resolves against this element's primary.\n *\n * `undefined` clears every property, and the element inherits the document's accent\n * again.\n */\nexport function paintAccentRoles(\n element: { style: Pick<CSSStyleDeclaration, 'setProperty' | 'removeProperty'> },\n roles: AccentRoles | undefined\n): void {\n for (const [role, property] of Object.entries(ACCENT_ROLE_PROPERTIES)) {\n if (roles) element.style.setProperty(property, roles[role as keyof AccentRoles])\n else element.style.removeProperty(property)\n }\n}\n"],"mappings":";;;;;;AAqDA,IAAM,MAAM;;AAGZ,SAAgB,WAAW,OAAqC;CAE9D,MAAM,SADQ,IAAI,KAAK,MAAM,KAAK,CACnB,CAAA,GAAQ;CACvB,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,IAAI,OAAO,WAAW,KAAK,OAAO,WAAW,GAAG;EAC9C,MAAM,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,UAAU,OAAO,SAAS,QAAQ,OAAO,EAAE,CAAC;EAClF,OAAO;GAAK;GAAO;GAAO;GAAI,GAAG,KAAK;EAAI;CAC5C;CACA,IAAI,OAAO,WAAW,KAAK,OAAO,WAAW,GAAG;EAC9C,MAAM,QAAQ,UAAkB,OAAO,SAAS,OAAO,MAAM,OAAO,QAAQ,CAAC,GAAG,EAAE;EAClF,OAAO;GAAE,GAAG,KAAK,CAAC;GAAG,GAAG,KAAK,CAAC;GAAG,GAAG,KAAK,CAAC;GAAG,GAAG,OAAO,WAAW,IAAI,KAAK,CAAC,IAAI;EAAI;CACtF;AAEF;AAEA,SAAS,UAAU,O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IAC7E,MAAM,EAAE,4BAA4B,CAAA;IACpC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,CAAA;AAEF,0EAA0E;AAC1E,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CACjD,MAAM,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,CAC9D,CAAA;AAED,eAAO,MAAM,+BAA+B,KAAK,CAAA;AACjD,eAAO,MAAM,+BAA+B,KAAK,CAAA;AAEjD,+DAA+D;AAC/D,eAAO,MAAM,uCAAuC,EAAE,4BAIpD,CAAA;AAEF,MAAM,MAAM,sCAAsC,GAAG,QAAQ,CAAC;IAC5D,QAAQ,EAAE,4BAA4B,CAAA;IACtC,iFAAiF;IACjF,aAAa,EAAE,SAAS,wBAAwB,EAAE,CAAA;CACnD,CAAC,CAAA;AA8DF,oFAAoF;AACpF,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ1F;AAED;;;;;;;GAOG;AACH,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,OAAO,GACvB,sCAAsC,CA+CxC;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,iBAAiB,GAAG,cAAc,GAAG,OAAO,CAAC,EACrE,KAAK,EAAE,OAAO,GACb,sCAAsC,CAiCxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAajG"}
|
|
@@ -116,20 +116,28 @@ function normalizeAppearanceEditorFontSettings(value, legacyUiFamily) {
|
|
|
116
116
|
function applyAppearanceFontSettings(root, value) {
|
|
117
117
|
const normalized = normalizeAppearanceEditorFontSettings(value);
|
|
118
118
|
const { settings } = normalized;
|
|
119
|
+
const readAttribute = root.getAttribute;
|
|
120
|
+
const setAttribute = (name, next) => {
|
|
121
|
+
if (readAttribute?.call(root, name) !== next) root.setAttribute(name, next);
|
|
122
|
+
};
|
|
123
|
+
const style = root.style;
|
|
124
|
+
const setProperty = (name, next) => {
|
|
125
|
+
if (style.getPropertyValue?.(name) !== next) style.setProperty(name, next);
|
|
126
|
+
};
|
|
119
127
|
root.removeAttribute("data-font");
|
|
120
|
-
|
|
128
|
+
setAttribute("data-font-settings", "");
|
|
121
129
|
for (const axis of APPEARANCE_EDITOR_FONT_AXES) {
|
|
122
130
|
const projection = fontAxisProjection[axis];
|
|
123
131
|
const setting = settings[axis];
|
|
124
132
|
const option = fontProjectionById[setting.family];
|
|
125
133
|
if (setting.family === "system") root.removeAttribute(projection.familyAttribute);
|
|
126
|
-
else
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
else setAttribute(projection.familyAttribute, setting.family);
|
|
135
|
+
setProperty(projection.familyProperty, `var(${option.familyVariables[axis]})`);
|
|
136
|
+
setProperty(projection.sizeProperty, String(setting.size) + "px");
|
|
137
|
+
setProperty(projection.scaleProperty, String(setting.size / projection.defaultSize));
|
|
130
138
|
if (axis === "ui") {
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
setProperty("--ui-tracking", option.uiTracking);
|
|
140
|
+
setProperty("--ui-word-spacing", option.uiWordSpacing);
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
143
|
return normalized;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appearance-font-settings.js","names":[],"sources":["../../src/lib/appearance-font-settings.ts"],"sourcesContent":["import { DEFAULT_FONT_ID, fontOptions, type FontOption } from '#lib/font-catalog'\nimport { safeScriptStringLiteral } from '#lib/safe-script'\n\nexport const APPEARANCE_EDITOR_FONT_AXES = ['ui', 'content', 'code'] as const\n\nexport type AppearanceEditorFontAxis = (typeof APPEARANCE_EDITOR_FONT_AXES)[number]\nexport type AppearanceEditorFontFamilyId = FontOption['id']\n\nexport type AppearanceEditorFontSetting = Readonly<{\n /** A stable id from the shared font catalogue, never a CSS family string. */\n family: AppearanceEditorFontFamilyId\n /** A pixel size, normalized to the supported range. */\n size: number\n}>\n\n/** The host-owned choices edited by the shared appearance composition. */\nexport type AppearanceEditorFontSettings = Readonly<\n Record<AppearanceEditorFontAxis, AppearanceEditorFontSetting>\n>\n\nexport const APPEARANCE_EDITOR_FONT_SIZE_MIN = 10\nexport const APPEARANCE_EDITOR_FONT_SIZE_MAX = 32\n\n/** New preferences use the platform face in each text role. */\nexport const DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS: AppearanceEditorFontSettings = Object.freeze({\n ui: Object.freeze({ family: DEFAULT_FONT_ID, size: 14 }),\n content: Object.freeze({ family: DEFAULT_FONT_ID, size: 14 }),\n code: Object.freeze({ family: DEFAULT_FONT_ID, size: 12 }),\n})\n\nexport type NormalizedAppearanceEditorFontSettings = Readonly<{\n settings: AppearanceEditorFontSettings\n /** Axes whose persisted family or size was unavailable or outside its limits. */\n recoveredAxes: readonly AppearanceEditorFontAxis[]\n}>\n\nconst fontProjectionById = Object.freeze(\n Object.fromEntries(\n fontOptions.map((option) => [\n option.id,\n {\n familyVariables: option.familyVariables,\n uiTracking: option.uiTracking,\n uiWordSpacing: option.uiWordSpacing,\n },\n ])\n ) as Record<\n AppearanceEditorFontFamilyId,\n Pick<FontOption, 'familyVariables' | 'uiTracking' | 'uiWordSpacing'>\n >\n)\nconst fontAxisProjection = Object.freeze({\n ui: Object.freeze({\n familyAttribute: 'data-ui-font',\n familyProperty: '--font-ui',\n sizeProperty: '--font-ui-size',\n scaleProperty: '--font-ui-scale',\n defaultSize: DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS.ui.size,\n }),\n content: Object.freeze({\n familyAttribute: 'data-content-font',\n familyProperty: '--font-content',\n sizeProperty: '--font-content-size',\n scaleProperty: '--font-content-scale',\n defaultSize: DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS.content.size,\n }),\n code: Object.freeze({\n familyAttribute: 'data-code-font',\n familyProperty: '--font-code',\n sizeProperty: '--font-code-size',\n scaleProperty: '--font-code-scale',\n defaultSize: DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS.code.size,\n }),\n})\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction hasOwn(value: Record<string, unknown>, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(value, key)\n}\n\nfunction normalizeFamily(value: unknown): AppearanceEditorFontFamilyId | undefined {\n return typeof value === 'string' && hasOwn(fontProjectionById, value)\n ? (value as AppearanceEditorFontFamilyId)\n : undefined\n}\n\nfunction clampFontSize(value: number): number {\n return Math.min(\n APPEARANCE_EDITOR_FONT_SIZE_MAX,\n Math.max(APPEARANCE_EDITOR_FONT_SIZE_MIN, Math.round(value))\n )\n}\n\n/** Normalize a single number-input value; invalid edits return the current size. */\nexport function normalizeAppearanceEditorFontSize(value: unknown, fallback: number): number {\n const parsed =\n typeof value === 'number'\n ? value\n : typeof value === 'string' && value.trim() !== ''\n ? Number(value)\n : Number.NaN\n return Number.isFinite(parsed) ? clampFontSize(parsed) : clampFontSize(fallback)\n}\n\n/**\n * Recover persisted font choices against the shared font catalogue.\n *\n * `legacyUiFamily` lets a host migrate its previous single font field into the\n * UI axis. Content and code remain on the new System defaults during that\n * migration. Missing settings are ordinary defaults; an unknown saved id or an\n * invalid size is reported through `recoveredAxes` for the host's notice.\n */\nexport function normalizeAppearanceEditorFontSettings(\n value: unknown,\n legacyUiFamily?: unknown\n): NormalizedAppearanceEditorFontSettings {\n const source = isRecord(value) ? value : undefined\n const malformedRoot = value !== undefined && value !== null && source === undefined\n const recovered = new Set<AppearanceEditorFontAxis>()\n const settings = {} as Record<AppearanceEditorFontAxis, AppearanceEditorFontSetting>\n\n for (const axis of APPEARANCE_EDITOR_FONT_AXES) {\n const axisPresent = source ? hasOwn(source, axis) : false\n const axisValue = source?.[axis]\n const axisSource = isRecord(axisValue) ? axisValue : undefined\n const fallback = DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS[axis]\n\n if (malformedRoot || (axisPresent && axisSource === undefined)) recovered.add(axis)\n\n const hasFamily = axisSource ? hasOwn(axisSource, 'family') : false\n const familyInput = hasFamily\n ? axisSource?.['family']\n : axis === 'ui' && legacyUiFamily !== undefined\n ? legacyUiFamily\n : undefined\n const family = normalizeFamily(familyInput) ?? fallback.family\n if (\n (hasFamily || (axis === 'ui' && legacyUiFamily !== undefined)) &&\n !normalizeFamily(familyInput)\n ) {\n recovered.add(axis)\n }\n\n const hasSize = axisSource ? hasOwn(axisSource, 'size') : false\n const sizeInput = axisSource?.['size']\n const size = hasSize\n ? normalizeAppearanceEditorFontSize(sizeInput, fallback.size)\n : fallback.size\n if (\n hasSize &&\n (typeof sizeInput !== 'number' || !Number.isFinite(sizeInput) || sizeInput !== size)\n ) {\n recovered.add(axis)\n }\n\n settings[axis] = Object.freeze({ family, size })\n }\n\n return Object.freeze({\n settings: Object.freeze(settings),\n recoveredAxes: Object.freeze(APPEARANCE_EDITOR_FONT_AXES.filter((axis) => recovered.has(axis))),\n })\n}\n\n/**\n * Project normalized font preferences onto a document root.\n *\n * This is shared by `ThemeProvider` and hosts that own their own appearance\n * persistence, so UI/content/code use the same catalogue ids, theme tokens,\n * sizes, and projected CSS variables. The marker activates the optional role\n * stylesheet and survives CSS import reordering.\n */\nexport function applyAppearanceFontSettings(\n root: Pick<HTMLElement, 'removeAttribute' | 'setAttribute' | 'style'>,\n value: unknown\n): NormalizedAppearanceEditorFontSettings {\n const normalized = normalizeAppearanceEditorFontSettings(value)\n const { settings } = normalized\n\n root.removeAttribute('data-font')\n root.setAttribute('data-font-settings', '')\n for (const axis of APPEARANCE_EDITOR_FONT_AXES) {\n const projection = fontAxisProjection[axis]\n const setting = settings[axis]\n const option = fontProjectionById[setting.family]\n if (setting.family === DEFAULT_FONT_ID) root.removeAttribute(projection.familyAttribute)\n else root.setAttribute(projection.familyAttribute, setting.family)\n root.style.setProperty(projection.familyProperty, `var(${option.familyVariables[axis]})`)\n root.style.setProperty(projection.sizeProperty, String(setting.size) + 'px')\n root.style.setProperty(projection.scaleProperty, String(setting.size / projection.defaultSize))\n if (axis === 'ui') {\n root.style.setProperty('--ui-tracking', option.uiTracking)\n root.style.setProperty('--ui-word-spacing', option.uiWordSpacing)\n }\n }\n\n return normalized\n}\n\n/**\n * Generate a safe inline prepaint script for a host-owned appearance record.\n *\n * The stored object is read from `localStorage[storageKey].fonts`. A legacy\n * top-level `font` family migrates into UI only; content/code use the shared\n * defaults. The script applies the same catalogue whitelist, limits, attributes,\n * and CSS properties as `applyAppearanceFontSettings` before styles paint. When\n * `persistedVersion` is supplied, only a record with that exact top-level version\n * is used; absent or mismatched records receive the System defaults.\n */\nexport function fontSettingsBootstrapScript(storageKey: string, persistedVersion?: number): string {\n if (persistedVersion !== undefined && !Number.isSafeInteger(persistedVersion)) {\n throw new RangeError('persistedVersion must be a safe integer')\n }\n const axisConfig = JSON.stringify(fontAxisProjection)\n const fontProjection = JSON.stringify(fontProjectionById)\n const fontIds = `[${fontOptions.map((option) => safeScriptStringLiteral(option.id)).join(',')}]`\n const persistedVersionGuard =\n persistedVersion === undefined\n ? ''\n : `&&parsed.version===Number(${safeScriptStringLiteral(String(persistedVersion))})`\n\n return `(function(){var r=document.documentElement;var axes=JSON.parse(${safeScriptStringLiteral(axisConfig)});var projection=JSON.parse(${safeScriptStringLiteral(fontProjection)});var ids=${fontIds};var has=function(v,k){return Object.prototype.hasOwnProperty.call(v,k)};var record=function(v){return typeof v==='object'&&v!==null&&!Array.isArray(v)};var p={};try{var raw=localStorage.getItem(${safeScriptStringLiteral(storageKey)});var parsed=raw?JSON.parse(raw):{};if(record(parsed)${persistedVersionGuard})p=parsed;}catch(e){}var saved=record(p.fonts)?p.fonts:{};var valid=function(v,d){return ids.indexOf(v)!==-1?v:d};var size=function(v,d){var n=typeof v==='number'?v:typeof v==='string'&&v.trim()!==''?Number(v):NaN;return Number.isFinite(n)?Math.min(${APPEARANCE_EDITOR_FONT_SIZE_MAX},Math.max(${APPEARANCE_EDITOR_FONT_SIZE_MIN},Math.round(n))):d};r.setAttribute('data-font-settings','');for(var axis in axes){if(!has(axes,axis))continue;var spec=axes[axis];var candidate=saved[axis];var value=record(candidate)?candidate:{};var legacyUi=axis==='ui'&&!has(value,'family');var family=legacyUi?valid(p.font,'system'):valid(value.family,'system');var font=projection[family];if(family==='system')r.removeAttribute(spec.familyAttribute);else r.setAttribute(spec.familyAttribute,family);r.style.setProperty(spec.familyProperty,'var('+font.familyVariables[axis]+')');var px=size(value.size,spec.defaultSize);r.style.setProperty(spec.sizeProperty,px+'px');r.style.setProperty(spec.scaleProperty,String(px/spec.defaultSize));if(axis==='ui'){r.style.setProperty('--ui-tracking',font.uiTracking);r.style.setProperty('--ui-word-spacing',font.uiWordSpacing);}}r.removeAttribute('data-font');})();`\n}\n"],"mappings":";;;AAGA,IAAa,8BAA8B;CAAC;CAAM;CAAW;AAAM;AAiBnE,IAAa,kCAAkC;AAC/C,IAAa,kCAAkC;;AAG/C,IAAa,0CAAwE,OAAO,OAAO;CACjG,IAAI,OAAO,OAAO;EAAE,QAAQ;EAAiB,MAAM;CAAG,CAAC;CACvD,SAAS,OAAO,OAAO;EAAE,QAAQ;EAAiB,MAAM;CAAG,CAAC;CAC5D,MAAM,OAAO,OAAO;EAAE,QAAQ;EAAiB,MAAM;CAAG,CAAC;AAC3D,CAAC;AAQD,IAAM,qBAAqB,OAAO,OAChC,OAAO,YACL,YAAY,KAAK,WAAW,CAC1B,OAAO,IACP;CACE,iBAAiB,OAAO;CACxB,YAAY,OAAO;CACnB,eAAe,OAAO;AACxB,CACF,CAAC,CACH,CAIF;AACA,IAAM,qBAAqB,OAAO,OAAO;CACvC,IAAI,OAAO,OAAO;EAChB,iBAAiB;EACjB,gBAAgB;EAChB,cAAc;EACd,eAAe;EACf,aAAa,wCAAwC,GAAG;CAC1D,CAAC;CACD,SAAS,OAAO,OAAO;EACrB,iBAAi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Y,WAAW,cAAc,OAAO,QAAQ,IAAI,IAAI,IAAI;EAC3E,KAAK,MAAM,YAAY,WAAW,eAAe,OAAO,QAAQ,OAAO,WAAW,WAAW,CAAC;EAC9F,IAAI,SAAS,MAAM;GACjB,KAAK,MAAM,YAAY,iBAAiB,OAAO,UAAU;GACzD,KAAK,MAAM,YAAY,qBAAqB,OAAO,aAAa;EAClE;CACF;CAEA,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,4BAA4B,YAAoB,kBAAmC;CACjG,IAAI,qBAAqB,KAAA,KAAa,CAAC,OAAO,cAAc,gBAAgB,GAC1E,MAAM,IAAI,WAAW,yCAAyC;CAEhE,MAAM,aAAa,KAAK,UAAU,kBAAkB;CACpD,MAAM,iBAAiB,KAAK,UAAU,kBAAkB;CACxD,MAAM,UAAU,IAAI,YAAY,KAAK,WAAW,wBAAwB,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;CAC9F,MAAM,wBACJ,qBAAqB,KAAA,IACjB,KACA,6BAA6B,wBAAwB,OAAO,gBAAgB,CAAC,EAAE;CAErF,OAAO,kEAAkE,wBAAwB,UAAU,EAAE,8BAA8B,wBAAwB,cAAc,EAAE,YAAY,QAAQ,qMAAqM,wBAAwB,UAAU,EAAE,uDAAuD,sBAAsB;AAC/f"}
|
|
1
|
+
{"version":3,"file":"appearance-font-settings.js","names":[],"sources":["../../src/lib/appearance-font-settings.ts"],"sourcesContent":["import { DEFAULT_FONT_ID, fontOptions, type FontOption } from '#lib/font-catalog'\nimport { safeScriptStringLiteral } from '#lib/safe-script'\n\nexport const APPEARANCE_EDITOR_FONT_AXES = ['ui', 'content', 'code'] as const\n\nexport type AppearanceEditorFontAxis = (typeof APPEARANCE_EDITOR_FONT_AXES)[number]\nexport type AppearanceEditorFontFamilyId = FontOption['id']\n\nexport type AppearanceEditorFontSetting = Readonly<{\n /** A stable id from the shared font catalogue, never a CSS family string. */\n family: AppearanceEditorFontFamilyId\n /** A pixel size, normalized to the supported range. */\n size: number\n}>\n\n/** The host-owned choices edited by the shared appearance composition. */\nexport type AppearanceEditorFontSettings = Readonly<\n Record<AppearanceEditorFontAxis, AppearanceEditorFontSetting>\n>\n\nexport const APPEARANCE_EDITOR_FONT_SIZE_MIN = 10\nexport const APPEARANCE_EDITOR_FONT_SIZE_MAX = 32\n\n/** New preferences use the platform face in each text role. */\nexport const DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS: AppearanceEditorFontSettings = Object.freeze({\n ui: Object.freeze({ family: DEFAULT_FONT_ID, size: 14 }),\n content: Object.freeze({ family: DEFAULT_FONT_ID, size: 14 }),\n code: Object.freeze({ family: DEFAULT_FONT_ID, size: 12 }),\n})\n\nexport type NormalizedAppearanceEditorFontSettings = Readonly<{\n settings: AppearanceEditorFontSettings\n /** Axes whose persisted family or size was unavailable or outside its limits. */\n recoveredAxes: readonly AppearanceEditorFontAxis[]\n}>\n\nconst fontProjectionById = Object.freeze(\n Object.fromEntries(\n fontOptions.map((option) => [\n option.id,\n {\n familyVariables: option.familyVariables,\n uiTracking: option.uiTracking,\n uiWordSpacing: option.uiWordSpacing,\n },\n ])\n ) as Record<\n AppearanceEditorFontFamilyId,\n Pick<FontOption, 'familyVariables' | 'uiTracking' | 'uiWordSpacing'>\n >\n)\nconst fontAxisProjection = Object.freeze({\n ui: Object.freeze({\n familyAttribute: 'data-ui-font',\n familyProperty: '--font-ui',\n sizeProperty: '--font-ui-size',\n scaleProperty: '--font-ui-scale',\n defaultSize: DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS.ui.size,\n }),\n content: Object.freeze({\n familyAttribute: 'data-content-font',\n familyProperty: '--font-content',\n sizeProperty: '--font-content-size',\n scaleProperty: '--font-content-scale',\n defaultSize: DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS.content.size,\n }),\n code: Object.freeze({\n familyAttribute: 'data-code-font',\n familyProperty: '--font-code',\n sizeProperty: '--font-code-size',\n scaleProperty: '--font-code-scale',\n defaultSize: DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS.code.size,\n }),\n})\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction hasOwn(value: Record<string, unknown>, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(value, key)\n}\n\nfunction normalizeFamily(value: unknown): AppearanceEditorFontFamilyId | undefined {\n return typeof value === 'string' && hasOwn(fontProjectionById, value)\n ? (value as AppearanceEditorFontFamilyId)\n : undefined\n}\n\nfunction clampFontSize(value: number): number {\n return Math.min(\n APPEARANCE_EDITOR_FONT_SIZE_MAX,\n Math.max(APPEARANCE_EDITOR_FONT_SIZE_MIN, Math.round(value))\n )\n}\n\n/** Normalize a single number-input value; invalid edits return the current size. */\nexport function normalizeAppearanceEditorFontSize(value: unknown, fallback: number): number {\n const parsed =\n typeof value === 'number'\n ? value\n : typeof value === 'string' && value.trim() !== ''\n ? Number(value)\n : Number.NaN\n return Number.isFinite(parsed) ? clampFontSize(parsed) : clampFontSize(fallback)\n}\n\n/**\n * Recover persisted font choices against the shared font catalogue.\n *\n * `legacyUiFamily` lets a host migrate its previous single font field into the\n * UI axis. Content and code remain on the new System defaults during that\n * migration. Missing settings are ordinary defaults; an unknown saved id or an\n * invalid size is reported through `recoveredAxes` for the host's notice.\n */\nexport function normalizeAppearanceEditorFontSettings(\n value: unknown,\n legacyUiFamily?: unknown\n): NormalizedAppearanceEditorFontSettings {\n const source = isRecord(value) ? value : undefined\n const malformedRoot = value !== undefined && value !== null && source === undefined\n const recovered = new Set<AppearanceEditorFontAxis>()\n const settings = {} as Record<AppearanceEditorFontAxis, AppearanceEditorFontSetting>\n\n for (const axis of APPEARANCE_EDITOR_FONT_AXES) {\n const axisPresent = source ? hasOwn(source, axis) : false\n const axisValue = source?.[axis]\n const axisSource = isRecord(axisValue) ? axisValue : undefined\n const fallback = DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS[axis]\n\n if (malformedRoot || (axisPresent && axisSource === undefined)) recovered.add(axis)\n\n const hasFamily = axisSource ? hasOwn(axisSource, 'family') : false\n const familyInput = hasFamily\n ? axisSource?.['family']\n : axis === 'ui' && legacyUiFamily !== undefined\n ? legacyUiFamily\n : undefined\n const family = normalizeFamily(familyInput) ?? fallback.family\n if (\n (hasFamily || (axis === 'ui' && legacyUiFamily !== undefined)) &&\n !normalizeFamily(familyInput)\n ) {\n recovered.add(axis)\n }\n\n const hasSize = axisSource ? hasOwn(axisSource, 'size') : false\n const sizeInput = axisSource?.['size']\n const size = hasSize\n ? normalizeAppearanceEditorFontSize(sizeInput, fallback.size)\n : fallback.size\n if (\n hasSize &&\n (typeof sizeInput !== 'number' || !Number.isFinite(sizeInput) || sizeInput !== size)\n ) {\n recovered.add(axis)\n }\n\n settings[axis] = Object.freeze({ family, size })\n }\n\n return Object.freeze({\n settings: Object.freeze(settings),\n recoveredAxes: Object.freeze(APPEARANCE_EDITOR_FONT_AXES.filter((axis) => recovered.has(axis))),\n })\n}\n\n/**\n * Project normalized font preferences onto a document root.\n *\n * This is shared by `ThemeProvider` and hosts that own their own appearance\n * persistence, so UI/content/code use the same catalogue ids, theme tokens,\n * sizes, and projected CSS variables. The marker activates the optional role\n * stylesheet and survives CSS import reordering.\n */\nexport function applyAppearanceFontSettings(\n root: Pick<HTMLElement, 'removeAttribute' | 'setAttribute' | 'style'>,\n value: unknown\n): NormalizedAppearanceEditorFontSettings {\n const normalized = normalizeAppearanceEditorFontSettings(value)\n const { settings } = normalized\n\n // Only changed values are written: this runs on every theme pass, and an\n // unchanged attribute or property rewritten still dirties the document's style.\n const readAttribute = (root as Partial<Pick<HTMLElement, 'getAttribute'>>).getAttribute\n const setAttribute = (name: string, next: string) => {\n if (readAttribute?.call(root, name) !== next) root.setAttribute(name, next)\n }\n const style = root.style as Pick<CSSStyleDeclaration, 'setProperty'> &\n Partial<Pick<CSSStyleDeclaration, 'getPropertyValue'>>\n const setProperty = (name: string, next: string) => {\n if (style.getPropertyValue?.(name) !== next) style.setProperty(name, next)\n }\n root.removeAttribute('data-font')\n setAttribute('data-font-settings', '')\n for (const axis of APPEARANCE_EDITOR_FONT_AXES) {\n const projection = fontAxisProjection[axis]\n const setting = settings[axis]\n const option = fontProjectionById[setting.family]\n if (setting.family === DEFAULT_FONT_ID) root.removeAttribute(projection.familyAttribute)\n else setAttribute(projection.familyAttribute, setting.family)\n setProperty(projection.familyProperty, `var(${option.familyVariables[axis]})`)\n setProperty(projection.sizeProperty, String(setting.size) + 'px')\n setProperty(projection.scaleProperty, String(setting.size / projection.defaultSize))\n if (axis === 'ui') {\n setProperty('--ui-tracking', option.uiTracking)\n setProperty('--ui-word-spacing', option.uiWordSpacing)\n }\n }\n\n return normalized\n}\n\n/**\n * Generate a safe inline prepaint script for a host-owned appearance record.\n *\n * The stored object is read from `localStorage[storageKey].fonts`. A legacy\n * top-level `font` family migrates into UI only; content/code use the shared\n * defaults. The script applies the same catalogue whitelist, limits, attributes,\n * and CSS properties as `applyAppearanceFontSettings` before styles paint. When\n * `persistedVersion` is supplied, only a record with that exact top-level version\n * is used; absent or mismatched records receive the System defaults.\n */\nexport function fontSettingsBootstrapScript(storageKey: string, persistedVersion?: number): string {\n if (persistedVersion !== undefined && !Number.isSafeInteger(persistedVersion)) {\n throw new RangeError('persistedVersion must be a safe integer')\n }\n const axisConfig = JSON.stringify(fontAxisProjection)\n const fontProjection = JSON.stringify(fontProjectionById)\n const fontIds = `[${fontOptions.map((option) => safeScriptStringLiteral(option.id)).join(',')}]`\n const persistedVersionGuard =\n persistedVersion === undefined\n ? ''\n : `&&parsed.version===Number(${safeScriptStringLiteral(String(persistedVersion))})`\n\n return `(function(){var r=document.documentElement;var axes=JSON.parse(${safeScriptStringLiteral(axisConfig)});var projection=JSON.parse(${safeScriptStringLiteral(fontProjection)});var ids=${fontIds};var has=function(v,k){return Object.prototype.hasOwnProperty.call(v,k)};var record=function(v){return typeof v==='object'&&v!==null&&!Array.isArray(v)};var p={};try{var raw=localStorage.getItem(${safeScriptStringLiteral(storageKey)});var parsed=raw?JSON.parse(raw):{};if(record(parsed)${persistedVersionGuard})p=parsed;}catch(e){}var saved=record(p.fonts)?p.fonts:{};var valid=function(v,d){return ids.indexOf(v)!==-1?v:d};var size=function(v,d){var n=typeof v==='number'?v:typeof v==='string'&&v.trim()!==''?Number(v):NaN;return Number.isFinite(n)?Math.min(${APPEARANCE_EDITOR_FONT_SIZE_MAX},Math.max(${APPEARANCE_EDITOR_FONT_SIZE_MIN},Math.round(n))):d};r.setAttribute('data-font-settings','');for(var axis in axes){if(!has(axes,axis))continue;var spec=axes[axis];var candidate=saved[axis];var value=record(candidate)?candidate:{};var legacyUi=axis==='ui'&&!has(value,'family');var family=legacyUi?valid(p.font,'system'):valid(value.family,'system');var font=projection[family];if(family==='system')r.removeAttribute(spec.familyAttribute);else r.setAttribute(spec.familyAttribute,family);r.style.setProperty(spec.familyProperty,'var('+font.familyVariables[axis]+')');var px=size(value.size,spec.defaultSize);r.style.setProperty(spec.sizeProperty,px+'px');r.style.setProperty(spec.scaleProperty,String(px/spec.defaultSize));if(axis==='ui'){r.style.setProperty('--ui-tracking',font.uiTracking);r.style.setProperty('--ui-word-spacing',font.uiWordSpacing);}}r.removeAttribute('data-font');})();`\n}\n"],"mappings":";;;AAGA,IAAa,8BAA8B;CAAC;CAAM;CAAW;AAAM;AAiBnE,IAAa,kCAAkC;AAC/C,IAAa,kCAAkC;;AAG/C,IAAa,0CAAwE,OAAO,OAAO;CACjG,IAAI,OAAO,OAAO;EAAE,QAAQ;EAAiB,MAAM;CAAG,CAAC;CACvD,SAAS,OAAO,OAAO;EAAE,QAAQ;EAAiB,MAAM;CAAG,CAAC;CAC5D,MAAM,OAAO,OAAO;EAAE,QAAQ;EAAiB,MAAM;CAAG,CAAC;AAC3D,CAAC;AAQD,IAAM,qBAAqB,OAAO,OAChC,OAAO,YACL,YAAY,KAAK,WAAW,CAC1B,OAAO,IACP;CACE,iBAAiB,OAAO;CACxB,YAAY,OAAO;CACnB,eAAe,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@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
export type PollOptions = {
|
|
3
|
+
/** Run once as soon as the poll starts, before the first interval. Default `true`. */
|
|
4
|
+
immediate?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Keep polling while the document is hidden (a background tab, a minimised
|
|
7
|
+
* window). Default `false`: a hidden page pauses, and becoming visible again
|
|
8
|
+
* runs at once when an interval was missed, then resumes the schedule.
|
|
9
|
+
*/
|
|
10
|
+
whileHidden?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type Poll = {
|
|
13
|
+
/** Run now, outside the schedule, and restart the interval from here. */
|
|
14
|
+
refresh: () => Promise<void>;
|
|
15
|
+
/** Whether a run is in flight. */
|
|
16
|
+
running: Accessor<boolean>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A polling loop with the behaviour every hand-written one has to remember.
|
|
20
|
+
*
|
|
21
|
+
* - **Paused while hidden.** A background window does not wake the CPU or hit the
|
|
22
|
+
* network for data nobody can see; on return it catches up with one run.
|
|
23
|
+
* - **No overlap.** The next interval is scheduled after the previous run settles,
|
|
24
|
+
* so a slow request cannot stack up behind itself.
|
|
25
|
+
* - **Reactive interval.** `interval` may be an accessor; `false` (or `0`) stops the
|
|
26
|
+
* loop, and a new value reschedules it.
|
|
27
|
+
* - **Owned.** It stops with the owner that created it.
|
|
28
|
+
*
|
|
29
|
+
* A failed run is the task's business: a rejection is caught so the loop survives,
|
|
30
|
+
* and the next interval runs as usual.
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* const poll = createPoll(() => refetch(), 5_000)
|
|
34
|
+
* // after a user action that changes the data:
|
|
35
|
+
* void poll.refresh()
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function createPoll(task: () => unknown, interval: number | false | Accessor<number | false>, options?: PollOptions): Poll;
|
|
39
|
+
//# sourceMappingURL=create-poll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-poll.d.ts","sourceRoot":"","sources":["../../src/lib/create-poll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxF,MAAM,MAAM,WAAW,GAAG;IACxB,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,yEAAyE;IACzE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,kCAAkC;IAClC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC3B,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,OAAO,EACnB,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,EACnD,OAAO,GAAE,WAAgB,GACxB,IAAI,CAwGN"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { isServer } from "solid-js/web";
|
|
2
|
+
import { createEffect, createSignal, onCleanup, untrack } from "solid-js";
|
|
3
|
+
// src/lib/create-poll.ts
|
|
4
|
+
/**
|
|
5
|
+
* A polling loop with the behaviour every hand-written one has to remember.
|
|
6
|
+
*
|
|
7
|
+
* - **Paused while hidden.** A background window does not wake the CPU or hit the
|
|
8
|
+
* network for data nobody can see; on return it catches up with one run.
|
|
9
|
+
* - **No overlap.** The next interval is scheduled after the previous run settles,
|
|
10
|
+
* so a slow request cannot stack up behind itself.
|
|
11
|
+
* - **Reactive interval.** `interval` may be an accessor; `false` (or `0`) stops the
|
|
12
|
+
* loop, and a new value reschedules it.
|
|
13
|
+
* - **Owned.** It stops with the owner that created it.
|
|
14
|
+
*
|
|
15
|
+
* A failed run is the task's business: a rejection is caught so the loop survives,
|
|
16
|
+
* and the next interval runs as usual.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* const poll = createPoll(() => refetch(), 5_000)
|
|
20
|
+
* // after a user action that changes the data:
|
|
21
|
+
* void poll.refresh()
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function createPoll(task, interval, options = {}) {
|
|
25
|
+
const [running, setRunning] = createSignal(false);
|
|
26
|
+
const [hidden, setHidden] = createSignal(!isServer && !options.whileHidden && typeof document !== "undefined" && document.hidden);
|
|
27
|
+
const period = typeof interval === "function" ? interval : () => interval;
|
|
28
|
+
let timer;
|
|
29
|
+
let missed = false;
|
|
30
|
+
let disposed = false;
|
|
31
|
+
let inFlight;
|
|
32
|
+
const clear = () => {
|
|
33
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
34
|
+
timer = void 0;
|
|
35
|
+
};
|
|
36
|
+
const schedule = () => {
|
|
37
|
+
clear();
|
|
38
|
+
const ms = untrack(period);
|
|
39
|
+
if (disposed || !ms || ms <= 0) return;
|
|
40
|
+
timer = setTimeout(() => {
|
|
41
|
+
timer = void 0;
|
|
42
|
+
if (untrack(hidden)) {
|
|
43
|
+
missed = true;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
run();
|
|
47
|
+
}, ms);
|
|
48
|
+
};
|
|
49
|
+
const run = () => {
|
|
50
|
+
if (inFlight) return inFlight;
|
|
51
|
+
clear();
|
|
52
|
+
setRunning(true);
|
|
53
|
+
let result;
|
|
54
|
+
try {
|
|
55
|
+
result = task();
|
|
56
|
+
} catch {
|
|
57
|
+
result = void 0;
|
|
58
|
+
}
|
|
59
|
+
inFlight = Promise.resolve(result).catch(() => {}).then(() => {
|
|
60
|
+
inFlight = void 0;
|
|
61
|
+
if (!disposed) {
|
|
62
|
+
setRunning(false);
|
|
63
|
+
schedule();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return inFlight;
|
|
67
|
+
};
|
|
68
|
+
if (!isServer && !options.whileHidden && typeof document !== "undefined") {
|
|
69
|
+
const onVisibility = () => setHidden(document.hidden);
|
|
70
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
71
|
+
onCleanup(() => document.removeEventListener("visibilitychange", onVisibility));
|
|
72
|
+
}
|
|
73
|
+
let started = false;
|
|
74
|
+
let lastPeriod = false;
|
|
75
|
+
let rescheduleOnVisible = false;
|
|
76
|
+
createEffect(() => {
|
|
77
|
+
const ms = period();
|
|
78
|
+
const isHidden = hidden();
|
|
79
|
+
if (isServer) return;
|
|
80
|
+
const periodChanged = ms !== lastPeriod;
|
|
81
|
+
lastPeriod = ms;
|
|
82
|
+
if (!ms || ms <= 0) {
|
|
83
|
+
clear();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!started) {
|
|
87
|
+
started = true;
|
|
88
|
+
if (options.immediate === false || isHidden) {
|
|
89
|
+
missed = isHidden && options.immediate !== false;
|
|
90
|
+
schedule();
|
|
91
|
+
} else run();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (isHidden) {
|
|
95
|
+
if (periodChanged) rescheduleOnVisible = true;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const reschedule = periodChanged || rescheduleOnVisible;
|
|
99
|
+
rescheduleOnVisible = false;
|
|
100
|
+
if (missed) {
|
|
101
|
+
missed = false;
|
|
102
|
+
run();
|
|
103
|
+
} else if (reschedule && !inFlight) schedule();
|
|
104
|
+
});
|
|
105
|
+
onCleanup(() => {
|
|
106
|
+
disposed = true;
|
|
107
|
+
clear();
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
refresh: run,
|
|
111
|
+
running
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export { createPoll };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=create-poll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-poll.js","names":[],"sources":["../../src/lib/create-poll.ts"],"sourcesContent":["import { createEffect, createSignal, onCleanup, untrack, type Accessor } from 'solid-js'\nimport { isServer } from 'solid-js/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\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n }\n\n const schedule = () => {\n clear()\n const ms = untrack(period)\n if (disposed || !ms || ms <= 0) return\n timer = setTimeout(() => {\n timer = undefined\n if (untrack(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 let started = false\n let lastPeriod: number | false = false\n let rescheduleOnVisible = false\n createEffect(() => {\n const ms = period()\n const isHidden = hidden()\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 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;CAEJ,MAAM,cAAc;EAClB,IAAI,UAA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F;EACA,MAAM,aAAa,iBAAiB;EACpC,sBAAsB;EACtB,IAAI,QAAQ;GACV,SAAS;GACT,IAAS;EACX,OAAO,IAAI,cAAc,CAAC,UAAU,SAAS;CAC/C,CAAC;CAED,gBAAgB;EACd,WAAW;EACX,MAAM;CACR,CAAC;CAED,OAAO;EAAE,SAAS;EAAK;CAAQ;AACjC"}
|
package/dist/lib/font-zoom.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function fontZoomShortcut(event: {
|
|
|
16
16
|
}): FontZoomIntent | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Step every text tier by `delta` pixels, clamped to the range the appearance editor
|
|
19
|
-
* enforces. The axes move together
|
|
19
|
+
* enforces. The axes move together, that is what makes the chord read as zoom, and
|
|
20
20
|
* each keeps its own family choice.
|
|
21
21
|
*/
|
|
22
22
|
export declare function stepAppearanceFontSizes(fonts: unknown, delta: 1 | -1): AppearanceEditorFontSettings;
|
package/dist/lib/font-zoom.js
CHANGED
|
@@ -15,7 +15,7 @@ function fontZoomShortcut(event) {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Step every text tier by `delta` pixels, clamped to the range the appearance editor
|
|
18
|
-
* enforces. The axes move together
|
|
18
|
+
* enforces. The axes move together, that is what makes the chord read as zoom, and
|
|
19
19
|
* each keeps its own family choice.
|
|
20
20
|
*/
|
|
21
21
|
function stepAppearanceFontSizes(fonts, delta) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-zoom.js","names":[],"sources":["../../src/lib/font-zoom.ts"],"sourcesContent":["/*\n * Copyright (c) 2026 Wing\n * Licensed under the MIT License.\n *\n * The platform zoom chords, mapped onto Adea's three text roles.\n *\n * macOS (and Windows/Linux) zoom shortcuts
|
|
1
|
+
{"version":3,"file":"font-zoom.js","names":[],"sources":["../../src/lib/font-zoom.ts"],"sourcesContent":["/*\n * Copyright (c) 2026 Wing\n * Licensed under the MIT License.\n *\n * The platform zoom chords, mapped onto Adea's three text roles.\n *\n * macOS (and Windows/Linux) zoom shortcuts: Cmd/Ctrl with `=`, `+`, `-`, or\n * `0`, normally scale the browser's page zoom. In Adea every text element is\n * already tied to one of the three appearance font tiers (the UI tier drives\n * the whole `text-*` scale through `--font-ui-scale`; content and code roles\n * scale through their own tokens), so stepping those tiers reproduces zoom\n * while keeping the app inside its tokenized, persisted type system: the page\n * layout, menus, sheets, and terminals reflow live from the same projection\n * the appearance editor writes.\n *\n * Translated from Adea's accepted port (`packages/ui/src/components/font-zoom.ts`) so\n * the shared provider and Adea run one implementation. See NOTICE.\n */\nimport {\n APPEARANCE_EDITOR_FONT_AXES,\n normalizeAppearanceEditorFontSettings,\n normalizeAppearanceEditorFontSize,\n type AppearanceEditorFontSettings,\n} from '#lib/appearance-font-settings'\n\n/** What the user's zoom chord asked for. */\nexport type FontZoomIntent = 'in' | 'out' | 'reset'\n\n/**\n * Classify the platform zoom chord: Cmd (macOS) or Ctrl (other platforms)\n * with `=`/`+` zooming in, `-` zooming out, and `0` resetting to the System\n * defaults. Unmodified keys, Alt-modified chords, and IME composition never\n * count, so typing and text editing are untouched.\n */\nexport function fontZoomShortcut(event: {\n key: string\n metaKey: boolean\n ctrlKey: boolean\n altKey: boolean\n isComposing?: boolean\n}): FontZoomIntent | undefined {\n if (event.isComposing || event.altKey) return undefined\n if (!(event.metaKey || event.ctrlKey)) return undefined\n if (event.key === '=' || event.key === '+') return 'in'\n if (event.key === '-') return 'out'\n if (event.key === '0') return 'reset'\n return undefined\n}\n\n/**\n * Step every text tier by `delta` pixels, clamped to the range the appearance editor\n * enforces. The axes move together, that is what makes the chord read as zoom, and\n * each keeps its own family choice.\n */\nexport function stepAppearanceFontSizes(\n fonts: unknown,\n delta: 1 | -1\n): AppearanceEditorFontSettings {\n const current = normalizeAppearanceEditorFontSettings(fonts).settings\n const step = (size: number) => normalizeAppearanceEditorFontSize(size + delta, size)\n return {\n ui: { ...current.ui, size: step(current.ui.size) },\n content: { ...current.content, size: step(current.content.size) },\n code: { ...current.code, size: step(current.code.size) },\n }\n}\n\n/** @deprecated Use `APPEARANCE_EDITOR_FONT_AXES` from `@adea-ai/ui/lib/appearance-font-settings`. */\nexport const FONT_ZOOM_AXES = APPEARANCE_EDITOR_FONT_AXES\n"],"mappings":";;;;;;;;AAkCA,SAAgB,iBAAiB,OAMF;CAC7B,IAAI,MAAM,eAAe,MAAM,QAAQ,OAAO,KAAA;CAC9C,IAAI,EAAE,MAAM,WAAW,MAAM,UAAU,OAAO,KAAA;CAC9C,IAAI,MAAM,QAAQ,OAAO,MAAM,QAAQ,KAAK,OAAO;CACnD,IAAI,MAAM,QAAQ,KAAK,OAAO;CAC9B,IAAI,MAAM,QAAQ,KAAK,OAAO;AAEhC;;;;;;AAOA,SAAgB,wBACd,OACA,OAC8B;CAC9B,MAAM,UAAU,sCAAsC,KAAK,CAAC,CAAC;CAC7D,MAAM,QAAQ,SAAiB,kCAAkC,OAAO,OAAO,IAAI;CACnF,OAAO;EACL,IAAI;GAAE,GAAG,QAAQ;GAAI,MAAM,KAAK,QAAQ,GAAG,IAAI;EAAE;EACjD,SAAS;GAAE,GAAG,QAAQ;GAAS,MAAM,KAAK,QAAQ,QAAQ,IAAI;EAAE;EAChE,MAAM;GAAE,GAAG,QAAQ;GAAM,MAAM,KAAK,QAAQ,KAAK,IAAI;EAAE;CACzD;AACF;;AAGA,IAAa,iBAAiB"}
|
package/dist/lib/keyed-rows.d.ts
CHANGED
|
@@ -24,7 +24,8 @@ export type KeyedRow<T> = Readonly<{
|
|
|
24
24
|
*
|
|
25
25
|
* `equals` decides whether a fresh item replaces the row's stored value. The
|
|
26
26
|
* default treats every new object as a change, which is correct for a projection
|
|
27
|
-
* whose fields are all rendered
|
|
27
|
+
* whose fields are all rendered; the same object passed again is not one, so a
|
|
28
|
+
* list that rebuilds its array around unchanged items updates no row. Pass a field-level comparator — a version
|
|
28
29
|
* stamp, a revision number — to skip redundant downstream updates entirely.
|
|
29
30
|
*
|
|
30
31
|
* ```tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyed-rows.d.ts","sourceRoot":"","sources":["../../src/lib/keyed-rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAElE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAAA;AAEzD
|
|
1
|
+
{"version":3,"file":"keyed-rows.d.ts","sourceRoot":"","sources":["../../src/lib/keyed-rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAElE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAC5B,IAAI,EAAE,MAAM,SAAS,CAAC,EAAE,EACxB,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,EACnB,MAAM,GAAE,KAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,OAAO,CAAS,GAC1D,QAAQ,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CA6BlC"}
|