@adea-ai/ui 0.151.12 → 0.151.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NOTICE +3 -2
- package/dist/components/composites/about-dialog/about-dialog.d.ts.map +1 -1
- package/dist/components/composites/about-dialog/about-dialog.js +27 -48
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.d.ts +2 -2
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +4 -22
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -4
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +1 -10
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +2 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +3 -2
- 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 +1 -0
- 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 +12 -50
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +7 -47
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/index.d.ts +1 -0
- package/dist/components/composites/appearance-editor/index.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/index.js +2 -1
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +8 -11
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +5 -4
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -12
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.d.ts +2 -2
- package/dist/components/composites/chat/chat.d.ts.map +1 -1
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.js +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +3 -3
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation-model.d.ts +3 -12
- package/dist/components/composites/confirmation/confirmation-model.d.ts.map +1 -1
- package/dist/components/composites/confirmation/confirmation-model.js +5 -17
- package/dist/components/composites/confirmation/confirmation-model.js.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-model.js +1 -1
- package/dist/components/composites/context/context-model.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.d.ts +5 -12
- package/dist/components/composites/file-tree/build-file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +26 -30
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.d.ts +2 -2
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +4 -30
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/index.d.ts +2 -1
- package/dist/components/composites/file-tree/index.d.ts.map +1 -1
- package/dist/components/composites/file-tree/index.js +2 -1
- package/dist/components/composites/help-center/help-center.d.ts.map +1 -1
- package/dist/components/composites/help-center/help-center.js +9 -20
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.d.ts.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +7 -11
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/citation.d.ts.map +1 -1
- package/dist/components/composites/inline-citation/citation.js +2 -1
- package/dist/components/composites/inline-citation/citation.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +2 -1
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.d.ts +4 -5
- package/dist/components/composites/message-scroller/message-scroller.d.ts.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +19 -13
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.d.ts +4 -3
- package/dist/components/composites/message-scroller/scroll-anchor.d.ts.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js +5 -3
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +1 -1
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- 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 +2 -3
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.d.ts +2 -2
- package/dist/components/composites/queue/queue.d.ts.map +1 -1
- package/dist/components/composites/queue/queue.js +57 -64
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/index.js +3 -1
- package/dist/components/composites/reasoning/reasoning.d.ts +2 -3
- package/dist/components/composites/reasoning/reasoning.d.ts.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +5 -20
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +3 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +1 -1
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/sources/index.js +2 -1
- package/dist/components/composites/sources/source.d.ts +3 -8
- package/dist/components/composites/sources/source.d.ts.map +1 -1
- package/dist/components/composites/sources/source.js +5 -30
- package/dist/components/composites/sources/source.js.map +1 -1
- package/dist/components/composites/sources/sources.js +2 -1
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.d.ts.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +3 -12
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/subagent/subagent.d.ts +3 -1
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
- package/dist/components/composites/subagent/subagent.js +5 -17
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.d.ts.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js +3 -2
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.d.ts +2 -3
- package/dist/components/composites/task/task.d.ts.map +1 -1
- package/dist/components/composites/task/task.js +49 -109
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/terminal-model.d.ts +1 -2
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal-model.js +7 -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 +3 -12
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.d.ts.map +1 -1
- package/dist/components/composites/test-results/test-results.js +3 -12
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.d.ts +0 -1
- package/dist/components/composites/tool/tool.d.ts.map +1 -1
- package/dist/components/composites/tool/tool.js +47 -41
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree-navigation.d.ts +6 -2
- package/dist/components/composites/tree/tree-navigation.d.ts.map +1 -1
- package/dist/components/composites/tree/tree-navigation.js +18 -1
- package/dist/components/composites/tree/tree-navigation.js.map +1 -1
- package/dist/components/composites/tree/tree.d.ts +6 -0
- package/dist/components/composites/tree/tree.d.ts.map +1 -1
- package/dist/components/composites/tree/tree.js +30 -4
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +7 -8
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.d.ts +2 -26
- package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +47 -125
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/update-dialog/update-model.d.ts +65 -0
- package/dist/components/composites/update-dialog/update-model.d.ts.map +1 -0
- package/dist/components/composites/update-dialog/update-model.js +75 -0
- package/dist/components/composites/update-dialog/update-model.js.map +1 -0
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.d.ts.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +3 -16
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.d.ts.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +10 -14
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/busy-send-button.d.ts +3 -5
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
- package/dist/components/conversation/busy-send-button.js +4 -15
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.d.ts +1 -1
- package/dist/components/conversation/chat-composer.d.ts.map +1 -1
- package/dist/components/conversation/chat-composer.js +1 -1
- package/dist/components/conversation/chat-composer.js.map +1 -1
- package/dist/components/conversation/composer-core.d.ts +35 -0
- package/dist/components/conversation/composer-core.d.ts.map +1 -0
- package/dist/components/conversation/composer-core.js +68 -0
- package/dist/components/conversation/composer-core.js.map +1 -0
- package/dist/components/conversation/composer-menu.d.ts +1 -1
- package/dist/components/conversation/composer-menu.d.ts.map +1 -1
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-pane.d.ts +4 -1
- package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
- package/dist/components/conversation/conversation-pane.js +4 -0
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.d.ts +9 -6
- package/dist/components/conversation/conversation-surface.d.ts.map +1 -1
- package/dist/components/conversation/conversation-surface.js +7 -5
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/ime-guard.d.ts +1 -0
- package/dist/components/conversation/ime-guard.d.ts.map +1 -1
- package/dist/components/conversation/ime-guard.js +5 -0
- package/dist/components/conversation/ime-guard.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 +16 -50
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts +1 -3
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +15 -32
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.d.ts +10 -11
- package/dist/components/conversation/message-row.d.ts.map +1 -1
- package/dist/components/conversation/message-row.js +24 -49
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.d.ts.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +7 -17
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/paste-tokens.d.ts +10 -1
- package/dist/components/conversation/paste-tokens.d.ts.map +1 -1
- package/dist/components/conversation/paste-tokens.js +26 -2
- package/dist/components/conversation/paste-tokens.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +30 -79
- package/dist/components/conversation/scroll-follow-core.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow-core.js +65 -54
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts +5 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +27 -91
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/conversation/thread-panel.d.ts +0 -2
- package/dist/components/conversation/thread-panel.d.ts.map +1 -1
- 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 +4 -16
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/conversation/transcript-folding.d.ts +0 -1
- package/dist/components/conversation/transcript-folding.d.ts.map +1 -1
- package/dist/components/conversation/transcript-folding.js +1 -1
- package/dist/components/conversation/transcript-folding.js.map +1 -1
- package/dist/components/conversation/transcript-grouping.d.ts +8 -0
- package/dist/components/conversation/transcript-grouping.d.ts.map +1 -1
- package/dist/components/conversation/transcript-grouping.js +17 -3
- package/dist/components/conversation/transcript-grouping.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +2 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js.map +1 -1
- package/dist/components/layout/floating-preview/index.js +2 -2
- package/dist/components/layout/floating-preview/model.d.ts +21 -55
- package/dist/components/layout/floating-preview/model.d.ts.map +1 -1
- package/dist/components/layout/floating-preview/model.js +33 -88
- package/dist/components/layout/floating-preview/model.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 +11 -5
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.d.ts +2 -12
- package/dist/components/layout/shell-top-bar/shell-top-bar.d.ts.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts +0 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.js +2 -8
- package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts +0 -9
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +148 -128
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/index.d.ts +2 -1
- package/dist/components/layout/sidebar-nav/index.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/index.js +2 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.d.ts +10 -0
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.d.ts.map +1 -0
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js +18 -0
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js.map +1 -0
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.d.ts +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts +5 -9
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -23
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/geometry.d.ts.map +1 -1
- package/dist/components/layout/split-layout/geometry.js +2 -2
- package/dist/components/layout/split-layout/geometry.js.map +1 -1
- package/dist/components/layout/split-layout/index.js +2 -2
- package/dist/components/layout/split-layout/model.d.ts.map +1 -1
- package/dist/components/layout/split-layout/model.js +4 -4
- package/dist/components/layout/split-layout/model.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts +5 -0
- 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 +17 -10
- 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 +5 -0
- package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +17 -10
- 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 +54 -47
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/split-layout/tree.d.ts +2 -0
- package/dist/components/layout/split-layout/tree.d.ts.map +1 -1
- package/dist/components/layout/split-layout/tree.js +5 -1
- package/dist/components/layout/split-layout/tree.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.d.ts +2 -9
- package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +4 -8
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/top-bar/window-chrome.d.ts +13 -0
- package/dist/components/layout/top-bar/window-chrome.d.ts.map +1 -0
- package/dist/components/layout/top-bar/window-chrome.js +12 -0
- package/dist/components/layout/top-bar/window-chrome.js.map +1 -0
- package/dist/components/motion/presence.d.ts +1 -1
- package/dist/components/motion/presence.d.ts.map +1 -1
- package/dist/components/motion/presence.js +1 -4
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts +3 -1
- package/dist/components/theme/appearance-panel.d.ts.map +1 -1
- package/dist/components/theme/appearance-panel.js +17 -9
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/index.d.ts +1 -1
- package/dist/components/theme/index.d.ts.map +1 -1
- package/dist/components/theme/index.js +5 -4
- package/dist/components/theme/lazy.d.ts +31 -5
- package/dist/components/theme/lazy.d.ts.map +1 -1
- package/dist/components/theme/lazy.js +39 -6
- package/dist/components/theme/lazy.js.map +1 -0
- package/dist/components/theme/script-projection.js +3 -2
- package/dist/components/theme/script-projection.js.map +1 -1
- package/dist/components/theme/script.js +3 -1
- package/dist/components/theme/theme-api.d.ts +14 -0
- package/dist/components/theme/theme-api.d.ts.map +1 -0
- package/dist/components/theme/theme-catalogue-source.d.ts.map +1 -1
- package/dist/components/theme/theme-catalogue-source.js +3 -2
- package/dist/components/theme/theme-catalogue-source.js.map +1 -1
- package/dist/components/theme/theme-document.d.ts +112 -10
- package/dist/components/theme/theme-document.d.ts.map +1 -1
- package/dist/components/theme/{theme-document-core.js → theme-document.js} +7 -7
- package/dist/components/theme/theme-document.js.map +1 -0
- package/dist/components/theme/theme-mode-toggle.d.ts +1 -1
- package/dist/components/theme/theme-mode-toggle.d.ts.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-persistence.d.ts +6 -5
- package/dist/components/theme/theme-persistence.d.ts.map +1 -1
- package/dist/components/theme/theme-persistence.js +48 -80
- package/dist/components/theme/theme-persistence.js.map +1 -1
- package/dist/components/theme/theme-picker.d.ts +1 -1
- package/dist/components/theme/theme-picker.d.ts.map +1 -1
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.d.ts +14 -15
- package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
- package/dist/components/theme/theme-provider-value.js +26 -42
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-provider.d.ts +3 -9
- package/dist/components/theme/theme-provider.d.ts.map +1 -1
- package/dist/components/theme/theme-provider.js +8 -7
- package/dist/components/theme/theme-provider.js.map +1 -1
- package/dist/components/theme/theme-script.d.ts +12 -25
- package/dist/components/theme/theme-script.d.ts.map +1 -1
- package/dist/components/theme/theme-script.js +35 -38
- package/dist/components/theme/theme-script.js.map +1 -1
- package/dist/components/theme/theme-state.d.ts +241 -9
- package/dist/components/theme/theme-state.d.ts.map +1 -1
- package/dist/components/theme/{theme-state-core.js → theme-state.js} +10 -11
- package/dist/components/theme/theme-state.js.map +1 -0
- package/dist/components/theme/theme-toggle.d.ts +1 -1
- package/dist/components/theme/theme-toggle.d.ts.map +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +7 -5
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +40 -36
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/attachment/attachment.d.ts.map +1 -1
- package/dist/components/ui/attachment/attachment.js +5 -16
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar/avatar.js +5 -2
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/board/board.d.ts +0 -3
- package/dist/components/ui/board/board.d.ts.map +1 -1
- package/dist/components/ui/board/board.js +3 -6
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/button-group/button-group.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.d.ts.map +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/chart/chart.d.ts +0 -3
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/code-block/code-block.d.ts +0 -2
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +8 -24
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/command/command.d.ts.map +1 -1
- package/dist/components/ui/command/command.js +56 -48
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +8 -30
- package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +13 -121
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.d.ts +46 -0
- package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -0
- package/dist/components/ui/dialog/dialog-layer.js +169 -0
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -0
- package/dist/components/ui/dialog/dialog.d.ts +20 -26
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +69 -187
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer/drawer.js +5 -8
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +39 -53
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +135 -191
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts +46 -0
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/menu-parts.js +176 -0
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -0
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.d.ts +1 -2
- package/dist/components/ui/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js +4 -21
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts +19 -33
- package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar/menubar.js +21 -116
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/index.js +2 -1
- package/dist/components/ui/message/message.d.ts +0 -1
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/message/parse-message-text.d.ts +20 -2
- package/dist/components/ui/message/parse-message-text.d.ts.map +1 -1
- package/dist/components/ui/message/parse-message-text.js +94 -28
- package/dist/components/ui/message/parse-message-text.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts +5 -12
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +61 -77
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts +0 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/popover/popover.d.ts +1 -3
- package/dist/components/ui/popover/popover.d.ts.map +1 -1
- package/dist/components/ui/popover/popover.js +1 -22
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable/resizable.js +12 -6
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts +4 -6
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +31 -32
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/text-link/index.d.ts.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.d.ts +1 -1
- package/dist/components/ui/toggle-group/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js +2 -7
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts +17 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +40 -20
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/index.d.ts +1 -1
- package/dist/components/ui/trace/index.d.ts.map +1 -1
- package/dist/components/ui/trace/index.js +1 -1
- package/dist/components/ui/trace/trace.d.ts +44 -3
- package/dist/components/ui/trace/trace.d.ts.map +1 -1
- package/dist/components/ui/trace/trace.js +87 -15
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/index.js +34 -28
- package/dist/lib/accent-presets.d.ts +7 -4
- package/dist/lib/accent-presets.d.ts.map +1 -1
- package/dist/lib/accent-presets.js +10 -5
- package/dist/lib/accent-presets.js.map +1 -1
- package/dist/lib/accent-roles.d.ts +20 -1
- package/dist/lib/accent-roles.d.ts.map +1 -1
- package/dist/lib/accent-roles.js +34 -26
- 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 +4 -4
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/async-action.d.ts +42 -0
- package/dist/lib/async-action.d.ts.map +1 -0
- package/dist/lib/async-action.js +61 -0
- package/dist/lib/async-action.js.map +1 -0
- package/dist/lib/breakpoints.d.ts +8 -0
- package/dist/lib/breakpoints.d.ts.map +1 -0
- package/dist/lib/breakpoints.js +11 -0
- package/dist/lib/breakpoints.js.map +1 -0
- package/dist/lib/bytes.d.ts +8 -0
- package/dist/lib/bytes.d.ts.map +1 -0
- package/dist/lib/bytes.js +20 -0
- package/dist/lib/bytes.js.map +1 -0
- package/dist/lib/clipboard.d.ts +13 -0
- package/dist/lib/clipboard.d.ts.map +1 -1
- package/dist/lib/clipboard.js +32 -1
- package/dist/lib/clipboard.js.map +1 -1
- package/dist/lib/events.d.ts +14 -0
- package/dist/lib/events.d.ts.map +1 -0
- package/dist/lib/events.js +16 -0
- package/dist/lib/events.js.map +1 -0
- package/dist/lib/external-link.d.ts +19 -0
- package/dist/lib/external-link.d.ts.map +1 -0
- package/dist/lib/external-link.js +27 -0
- package/dist/lib/external-link.js.map +1 -0
- package/dist/lib/font-catalog.d.ts +3 -6
- package/dist/lib/font-catalog.d.ts.map +1 -1
- package/dist/lib/font-catalog.js +16 -12
- package/dist/lib/font-catalog.js.map +1 -1
- package/dist/lib/font-zoom.d.ts +4 -4
- package/dist/lib/font-zoom.d.ts.map +1 -1
- package/dist/lib/font-zoom.js +9 -12
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/overlay.d.ts +29 -1
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +32 -16
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/preference-store.d.ts +13 -3
- package/dist/lib/preference-store.d.ts.map +1 -1
- package/dist/lib/preference-store.js +27 -37
- package/dist/lib/preference-store.js.map +1 -1
- package/dist/lib/resize-separator.d.ts +15 -0
- package/dist/lib/resize-separator.d.ts.map +1 -0
- package/dist/lib/resize-separator.js +23 -0
- package/dist/lib/resize-separator.js.map +1 -0
- package/dist/lib/safe-script.d.ts +19 -1
- package/dist/lib/safe-script.d.ts.map +1 -1
- package/dist/lib/safe-script.js +19 -1
- package/dist/lib/safe-script.js.map +1 -1
- package/dist/lib/scroll-geometry.d.ts +33 -0
- package/dist/lib/scroll-geometry.d.ts.map +1 -0
- package/dist/lib/scroll-geometry.js +48 -0
- package/dist/lib/scroll-geometry.js.map +1 -0
- package/dist/lib/text.d.ts +13 -0
- package/dist/lib/text.d.ts.map +1 -0
- package/dist/lib/text.js +30 -0
- package/dist/lib/text.js.map +1 -0
- package/dist/lib/theme-accents.d.ts +2 -0
- package/dist/lib/theme-accents.d.ts.map +1 -1
- package/dist/lib/theme-accents.js +2 -2
- package/dist/lib/theme-accents.js.map +1 -1
- package/dist/lib/theme-catalogue.d.ts.map +1 -1
- package/dist/lib/theme-catalogue.js +3 -4
- package/dist/lib/theme-catalogue.js.map +1 -1
- package/dist/lib/theme-css.d.ts +14 -1
- package/dist/lib/theme-css.d.ts.map +1 -1
- package/dist/lib/theme-css.js +25 -48
- package/dist/lib/theme-css.js.map +1 -1
- package/dist/lib/theme-defaults.d.ts +33 -5
- package/dist/lib/theme-defaults.d.ts.map +1 -1
- package/dist/lib/theme-defaults.generated.d.ts +1 -1
- package/dist/lib/theme-defaults.generated.d.ts.map +1 -1
- package/dist/lib/theme-defaults.generated.js.map +1 -1
- package/dist/lib/theme-defaults.js +59 -3
- package/dist/lib/theme-defaults.js.map +1 -1
- package/dist/lib/theme-engine-light.d.ts +6 -0
- package/dist/lib/theme-engine-light.d.ts.map +1 -1
- package/dist/lib/theme-engine-light.js +71 -57
- package/dist/lib/theme-engine-light.js.map +1 -1
- package/dist/lib/theme-engine.d.ts +20 -22
- package/dist/lib/theme-engine.d.ts.map +1 -1
- package/dist/lib/theme-engine.js +19 -6
- package/dist/lib/theme-engine.js.map +1 -1
- package/dist/lib/theme-records.d.ts +3 -3
- package/dist/lib/theme-records.d.ts.map +1 -1
- package/dist/lib/theme-records.js +20 -59
- package/dist/lib/theme-records.js.map +1 -1
- package/dist/lib/theme-types.d.ts +174 -0
- package/dist/lib/theme-types.d.ts.map +1 -0
- package/dist/lib/theme-types.js +105 -0
- package/dist/lib/theme-types.js.map +1 -0
- package/dist/lib/themes.d.ts +4 -159
- package/dist/lib/themes.d.ts.map +1 -1
- package/dist/lib/themes.js +14 -33
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +0 -1
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/url.d.ts +9 -0
- package/dist/lib/url.d.ts.map +1 -0
- package/dist/lib/url.js +24 -0
- package/dist/lib/url.js.map +1 -0
- package/dist/lib/version-notes.d.ts.map +1 -1
- package/dist/lib/version-notes.js +3 -10
- package/dist/lib/version-notes.js.map +1 -1
- package/dist/r/about-dialog.json +2 -1
- package/dist/r/action-button.json +2 -1
- package/dist/r/alert-dialog.json +1 -0
- package/dist/r/checkpoint.json +0 -2
- package/dist/r/code-block.json +1 -0
- package/dist/r/confirmation.json +0 -1
- package/dist/r/context-menu.json +2 -2
- package/dist/r/context.json +0 -1
- package/dist/r/conversation.json +6 -5
- package/dist/r/dialog.json +5 -0
- package/dist/r/drawer.json +0 -1
- package/dist/r/dropdown-menu.json +5 -0
- package/dist/r/lib.json +50 -0
- package/dist/r/menubar.json +2 -2
- package/dist/r/model-selector.json +0 -1
- package/dist/r/reasoning.json +2 -1
- package/dist/r/registry.json +102 -43
- package/dist/r/shell-top-bar.json +1 -0
- package/dist/r/sidebar-nav.json +5 -0
- package/dist/r/sources.json +2 -2
- package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +22 -42
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +9 -35
- package/dist/r/src/components/composites/action-button/action-button.tsx +5 -7
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -11
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +8 -5
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +8 -6
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +14 -74
- package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +11 -77
- package/dist/r/src/components/composites/appearance-editor/index.ts +1 -0
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +9 -13
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +16 -18
- package/dist/r/src/components/composites/chat/chat.tsx +2 -2
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +3 -3
- package/dist/r/src/components/composites/confirmation/confirmation-model.ts +9 -17
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +2 -2
- package/dist/r/src/components/composites/context/context-model.ts +1 -1
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +21 -39
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +5 -58
- package/dist/r/src/components/composites/file-tree/index.ts +1 -1
- package/dist/r/src/components/composites/help-center/help-center.tsx +8 -21
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +10 -11
- package/dist/r/src/components/composites/inline-citation/citation.ts +2 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +3 -2
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +30 -30
- package/dist/r/src/components/composites/message-scroller/scroll-anchor.ts +5 -5
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +3 -2
- package/dist/r/src/components/composites/model-selector/models.ts +1 -1
- package/dist/r/src/components/composites/plan/plan.tsx +1 -4
- package/dist/r/src/components/composites/queue/queue.tsx +8 -11
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +5 -23
- package/dist/r/src/components/composites/settings/settings-layout.tsx +3 -2
- package/dist/r/src/components/composites/settings/settings-navigation.tsx +4 -1
- package/dist/r/src/components/composites/sources/source.ts +7 -53
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -12
- package/dist/r/src/components/composites/subagent/subagent.tsx +7 -17
- package/dist/r/src/components/composites/suggestion/suggestion.tsx +4 -3
- package/dist/r/src/components/composites/task/task.tsx +21 -64
- package/dist/r/src/components/composites/terminal/terminal-model.ts +4 -4
- package/dist/r/src/components/composites/terminal/terminal.tsx +3 -12
- package/dist/r/src/components/composites/test-results/test-results.tsx +3 -12
- package/dist/r/src/components/composites/tool/tool.tsx +34 -40
- package/dist/r/src/components/composites/tree/tree-navigation.ts +22 -2
- package/dist/r/src/components/composites/tree/tree.tsx +47 -3
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +10 -14
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +66 -200
- package/dist/r/src/components/composites/update-dialog/update-model.ts +137 -0
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
- package/dist/r/src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx +1 -18
- package/dist/r/src/components/composites/workspace-switcher/workspace-switcher.tsx +16 -19
- package/dist/r/src/components/conversation/busy-send-button.tsx +7 -34
- package/dist/r/src/components/conversation/chat-composer.tsx +1 -1
- package/dist/r/src/components/conversation/composer-core.ts +76 -0
- package/dist/r/src/components/conversation/composer-menu.tsx +1 -1
- package/dist/r/src/components/conversation/conversation-pane.tsx +4 -1
- package/dist/r/src/components/conversation/conversation-surface.tsx +23 -10
- package/dist/r/src/components/conversation/ime-guard.ts +6 -0
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +24 -65
- package/dist/r/src/components/conversation/message-composer.tsx +24 -54
- package/dist/r/src/components/conversation/message-row.tsx +33 -47
- package/dist/r/src/components/conversation/paste-token-editor.tsx +13 -16
- package/dist/r/src/components/conversation/paste-tokens.ts +36 -1
- package/dist/r/src/components/conversation/scroll-follow-core.ts +66 -137
- package/dist/r/src/components/conversation/scroll-follow.ts +26 -67
- package/dist/r/src/components/conversation/thread-panel.tsx +2 -4
- package/dist/r/src/components/conversation/transcript-composition.tsx +9 -33
- package/dist/r/src/components/conversation/transcript-folding.ts +2 -2
- package/dist/r/src/components/conversation/transcript-grouping.ts +18 -3
- package/dist/r/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +4 -3
- package/dist/r/src/components/layout/contextual-sidebar/mobile-contextual-sidebar.tsx +1 -1
- package/dist/r/src/components/layout/floating-preview/model.ts +57 -195
- package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +6 -12
- package/dist/r/src/components/layout/shell-top-bar/shell-top-bar.tsx +32 -47
- package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -11
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +95 -107
- package/dist/r/src/components/layout/sidebar-nav/index.ts +1 -2
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +15 -0
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav-resize-handle.tsx +1 -4
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +9 -27
- package/dist/r/src/components/layout/split-layout/geometry.ts +2 -9
- package/dist/r/src/components/layout/split-layout/model.ts +3 -6
- package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +12 -6
- package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +12 -6
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +46 -61
- package/dist/r/src/components/layout/split-layout/tree.ts +5 -0
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +16 -38
- package/dist/r/src/components/layout/top-bar/window-chrome.ts +23 -0
- package/dist/r/src/components/motion/presence.tsx +1 -3
- package/dist/r/src/components/theme/appearance-panel.tsx +28 -19
- package/dist/r/src/components/theme/index.ts +1 -22
- package/dist/r/src/components/theme/lazy.ts +36 -26
- package/dist/r/src/components/theme/theme-api.ts +30 -0
- package/dist/r/src/components/theme/theme-catalogue-source.ts +3 -2
- package/dist/r/src/components/theme/theme-document.ts +248 -23
- package/dist/r/src/components/theme/theme-mode-toggle.tsx +1 -1
- package/dist/r/src/components/theme/theme-persistence.ts +74 -130
- package/dist/r/src/components/theme/theme-picker.tsx +2 -2
- package/dist/r/src/components/theme/theme-provider-value.ts +53 -68
- package/dist/r/src/components/theme/theme-provider.tsx +5 -24
- package/dist/r/src/components/theme/theme-script.ts +48 -43
- package/dist/r/src/components/theme/theme-state.ts +350 -10
- package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +43 -43
- package/dist/r/src/components/ui/attachment/attachment.tsx +4 -17
- package/dist/r/src/components/ui/avatar/avatar.tsx +3 -2
- package/dist/r/src/components/ui/board/board.tsx +4 -10
- package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
- package/dist/r/src/components/ui/chart/chart.tsx +0 -3
- package/dist/r/src/components/ui/code-block/code-block.tsx +7 -26
- package/dist/r/src/components/ui/command/command.tsx +43 -39
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +18 -168
- package/dist/r/src/components/ui/dialog/dialog-layer.tsx +266 -0
- package/dist/r/src/components/ui/dialog/dialog.tsx +77 -271
- package/dist/r/src/components/ui/drawer/drawer.tsx +5 -23
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +204 -226
- package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +220 -0
- package/dist/r/src/components/ui/field/field.tsx +1 -1
- package/dist/r/src/components/ui/field/number-field.tsx +1 -1
- package/dist/r/src/components/ui/hover-card/hover-card.tsx +4 -11
- package/dist/r/src/components/ui/menubar/menubar.tsx +36 -169
- package/dist/r/src/components/ui/message/message.tsx +0 -1
- package/dist/r/src/components/ui/message/parse-message-text.ts +80 -32
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -39
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +0 -1
- package/dist/r/src/components/ui/popover/popover.tsx +5 -11
- package/dist/r/src/components/ui/resizable/resizable.tsx +6 -16
- package/dist/r/src/components/ui/sheet/sheet.tsx +30 -42
- package/dist/r/src/components/ui/text-link/index.ts +0 -1
- package/dist/r/src/components/ui/toggle-group/toggle-group.tsx +3 -11
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +47 -26
- package/dist/r/src/components/ui/trace/index.ts +7 -0
- package/dist/r/src/components/ui/trace/trace.tsx +100 -9
- package/dist/r/src/lib/accent-presets.ts +12 -8
- package/dist/r/src/lib/accent-roles.ts +43 -29
- package/dist/r/src/lib/appearance-font-settings.ts +5 -5
- package/dist/r/src/lib/async-action.ts +72 -0
- package/dist/r/src/lib/breakpoints.ts +7 -0
- package/dist/r/src/lib/bytes.ts +20 -0
- package/dist/r/src/lib/clipboard.ts +43 -0
- package/dist/r/src/lib/events.ts +17 -0
- package/dist/r/src/lib/external-link.ts +42 -0
- package/dist/r/src/lib/font-catalog.ts +4 -6
- package/dist/r/src/lib/font-zoom.ts +9 -14
- package/dist/r/src/lib/overlay.ts +55 -18
- package/dist/r/src/lib/preference-store.ts +36 -34
- package/dist/r/src/lib/resize-separator.ts +36 -0
- package/dist/r/src/lib/safe-script.ts +19 -1
- package/dist/r/src/lib/scroll-geometry.ts +69 -0
- package/dist/r/src/lib/text.ts +49 -0
- package/dist/r/src/lib/theme-accents.ts +1 -1
- package/dist/r/src/lib/theme-catalogue.ts +3 -4
- package/dist/r/src/lib/theme-css.ts +33 -54
- package/dist/r/src/lib/theme-defaults.generated.ts +1 -1
- package/dist/r/src/lib/theme-defaults.ts +55 -7
- package/dist/r/src/lib/theme-engine-light.ts +88 -72
- package/dist/r/src/lib/theme-engine.ts +29 -33
- package/dist/r/src/lib/theme-records.ts +33 -69
- package/dist/r/src/lib/theme-types.ts +199 -0
- package/dist/r/src/lib/themes.ts +33 -196
- package/dist/r/src/lib/tokens.ts +0 -1
- package/dist/r/src/lib/url.ts +25 -0
- package/dist/r/src/lib/version-notes.ts +3 -9
- package/dist/r/src/styles/theme-variants.css +32 -32
- package/dist/r/src/styles/theme.css +17 -13
- package/dist/r/subagent.json +0 -2
- package/dist/r/suggestion.json +0 -1
- package/dist/r/theming.json +5 -20
- package/dist/r/top-bar.json +5 -0
- package/dist/r/trace.json +1 -0
- package/dist/r/update-dialog.json +5 -0
- package/package.json +9 -7
- package/registry.json +102 -43
- package/src/components/composites/about-dialog/about-dialog.tsx +22 -42
- package/src/components/composites/account-menu/account-menu.tsx +9 -35
- package/src/components/composites/action-button/action-button.tsx +5 -7
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -11
- package/src/components/composites/appearance-editor/appearance-choices.tsx +8 -5
- package/src/components/composites/appearance-editor/appearance-editor.tsx +8 -6
- package/src/components/composites/appearance-editor/appearance-rows.tsx +14 -74
- package/src/components/composites/appearance-editor/font-settings-group.tsx +11 -77
- package/src/components/composites/appearance-editor/index.ts +1 -0
- package/src/components/composites/catalog-browser/catalog-browser.tsx +9 -13
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +16 -18
- package/src/components/composites/chat/chat.tsx +2 -2
- package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/src/components/composites/checkpoint/checkpoint.tsx +3 -3
- package/src/components/composites/confirmation/confirmation-model.ts +9 -17
- package/src/components/composites/confirmation/confirmation.tsx +2 -2
- package/src/components/composites/context/context-model.ts +1 -1
- package/src/components/composites/file-tree/build-file-tree.ts +21 -39
- package/src/components/composites/file-tree/file-tree.tsx +5 -58
- package/src/components/composites/file-tree/index.ts +1 -1
- package/src/components/composites/help-center/help-center.tsx +8 -21
- package/src/components/composites/icon-picker/icon-picker.tsx +10 -11
- package/src/components/composites/inline-citation/citation.ts +2 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +3 -2
- package/src/components/composites/message-scroller/message-scroller.tsx +30 -30
- package/src/components/composites/message-scroller/scroll-anchor.ts +5 -5
- package/src/components/composites/model-selector/model-selector.tsx +3 -2
- package/src/components/composites/model-selector/models.ts +1 -1
- package/src/components/composites/plan/plan.tsx +1 -4
- package/src/components/composites/queue/queue.tsx +8 -11
- package/src/components/composites/reasoning/reasoning.tsx +5 -23
- package/src/components/composites/settings/settings-layout.tsx +3 -2
- package/src/components/composites/settings/settings-navigation.tsx +4 -1
- package/src/components/composites/sources/source.ts +7 -53
- package/src/components/composites/stack-trace/stack-trace.tsx +3 -12
- package/src/components/composites/subagent/subagent.tsx +7 -17
- package/src/components/composites/suggestion/suggestion.tsx +4 -3
- package/src/components/composites/task/task.tsx +21 -64
- package/src/components/composites/terminal/terminal-model.ts +4 -4
- package/src/components/composites/terminal/terminal.tsx +3 -12
- package/src/components/composites/test-results/test-results.tsx +3 -12
- package/src/components/composites/tool/tool.tsx +34 -40
- package/src/components/composites/tree/tree-navigation.ts +22 -2
- package/src/components/composites/tree/tree.tsx +47 -3
- package/src/components/composites/update-dialog/channel-control.tsx +10 -14
- package/src/components/composites/update-dialog/update-dialog.tsx +66 -200
- package/src/components/composites/update-dialog/update-model.ts +137 -0
- package/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
- package/src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx +1 -18
- package/src/components/composites/workspace-switcher/workspace-switcher.tsx +16 -19
- package/src/components/conversation/busy-send-button.tsx +7 -34
- package/src/components/conversation/chat-composer.tsx +1 -1
- package/src/components/conversation/composer-core.ts +76 -0
- package/src/components/conversation/composer-menu.tsx +1 -1
- package/src/components/conversation/conversation-pane.tsx +4 -1
- package/src/components/conversation/conversation-surface.tsx +23 -10
- package/src/components/conversation/ime-guard.ts +6 -0
- package/src/components/conversation/internal/chat-composer-shell.tsx +24 -65
- package/src/components/conversation/message-composer.tsx +24 -54
- package/src/components/conversation/message-row.tsx +33 -47
- package/src/components/conversation/paste-token-editor.tsx +13 -16
- package/src/components/conversation/paste-tokens.ts +36 -1
- package/src/components/conversation/scroll-follow-core.ts +66 -137
- package/src/components/conversation/scroll-follow.ts +26 -67
- package/src/components/conversation/thread-panel.tsx +2 -4
- package/src/components/conversation/transcript-composition.tsx +9 -33
- package/src/components/conversation/transcript-folding.ts +2 -2
- package/src/components/conversation/transcript-grouping.ts +18 -3
- package/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +4 -3
- package/src/components/layout/contextual-sidebar/mobile-contextual-sidebar.tsx +1 -1
- package/src/components/layout/floating-preview/model.ts +57 -195
- package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +6 -12
- package/src/components/layout/shell-top-bar/shell-top-bar.tsx +32 -47
- package/src/components/layout/side-rail/side-rail-context.ts +1 -11
- package/src/components/layout/side-rail/side-rail.tsx +95 -107
- package/src/components/layout/sidebar-nav/index.ts +1 -2
- package/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +15 -0
- package/src/components/layout/sidebar-nav/sidebar-nav-resize-handle.tsx +1 -4
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +9 -27
- package/src/components/layout/split-layout/geometry.ts +2 -9
- package/src/components/layout/split-layout/model.ts +3 -6
- package/src/components/layout/split-layout/resize-controller-core-retry.tsx +12 -6
- package/src/components/layout/split-layout/resize-controller-core.tsx +12 -6
- package/src/components/layout/split-layout/split-layout.tsx +46 -61
- package/src/components/layout/split-layout/tree.ts +5 -0
- package/src/components/layout/top-bar/top-bar.tsx +16 -38
- package/src/components/layout/top-bar/window-chrome.ts +23 -0
- package/src/components/motion/presence.tsx +1 -3
- package/src/components/theme/appearance-panel.tsx +28 -19
- package/src/components/theme/index.ts +1 -22
- package/src/components/theme/lazy.ts +36 -26
- package/src/components/theme/theme-api.ts +30 -0
- package/src/components/theme/theme-catalogue-source.ts +3 -2
- package/src/components/theme/theme-document.ts +248 -23
- package/src/components/theme/theme-mode-toggle.tsx +1 -1
- package/src/components/theme/theme-persistence.ts +74 -130
- package/src/components/theme/theme-picker.tsx +2 -2
- package/src/components/theme/theme-provider-value.ts +53 -68
- package/src/components/theme/theme-provider.tsx +5 -24
- package/src/components/theme/theme-script.ts +48 -43
- package/src/components/theme/theme-state.ts +350 -10
- package/src/components/theme/theme-toggle.tsx +1 -1
- package/src/components/ui/alert-dialog/alert-dialog.tsx +43 -43
- package/src/components/ui/attachment/attachment.tsx +4 -17
- package/src/components/ui/avatar/avatar.tsx +3 -2
- package/src/components/ui/board/board.tsx +4 -10
- package/src/components/ui/button-group/button-group.tsx +1 -1
- package/src/components/ui/chart/chart.tsx +0 -3
- package/src/components/ui/code-block/code-block.tsx +7 -26
- package/src/components/ui/command/command.tsx +43 -39
- package/src/components/ui/context-menu/context-menu.tsx +18 -168
- package/src/components/ui/dialog/dialog-layer.tsx +266 -0
- package/src/components/ui/dialog/dialog.tsx +77 -271
- package/src/components/ui/drawer/drawer.tsx +5 -23
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +204 -226
- package/src/components/ui/dropdown-menu/menu-parts.tsx +220 -0
- package/src/components/ui/field/field.tsx +1 -1
- package/src/components/ui/field/number-field.tsx +1 -1
- package/src/components/ui/hover-card/hover-card.tsx +4 -11
- package/src/components/ui/menubar/menubar.tsx +36 -169
- package/src/components/ui/message/message.tsx +0 -1
- package/src/components/ui/message/parse-message-text.ts +80 -32
- package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -39
- package/src/components/ui/navigation-menu/navigation-menu.tsx +0 -1
- package/src/components/ui/popover/popover.tsx +5 -11
- package/src/components/ui/resizable/resizable.tsx +6 -16
- package/src/components/ui/sheet/sheet.tsx +30 -42
- package/src/components/ui/text-link/index.ts +0 -1
- package/src/components/ui/toggle-group/toggle-group.tsx +3 -11
- package/src/components/ui/tooltip/tooltip.tsx +47 -26
- package/src/components/ui/trace/index.ts +7 -0
- package/src/components/ui/trace/trace.tsx +100 -9
- package/src/lib/accent-presets.ts +12 -8
- package/src/lib/accent-roles.ts +43 -29
- package/src/lib/appearance-font-settings.ts +5 -5
- package/src/lib/async-action.ts +72 -0
- package/src/lib/breakpoints.ts +7 -0
- package/src/lib/bytes.ts +20 -0
- package/src/lib/clipboard.ts +43 -0
- package/src/lib/events.ts +17 -0
- package/src/lib/external-link.ts +42 -0
- package/src/lib/font-catalog.ts +4 -6
- package/src/lib/font-zoom.ts +9 -14
- package/src/lib/overlay.ts +55 -18
- package/src/lib/preference-store.ts +36 -34
- package/src/lib/resize-separator.ts +36 -0
- package/src/lib/safe-script.ts +19 -1
- package/src/lib/scroll-geometry.ts +69 -0
- package/src/lib/text.ts +49 -0
- package/src/lib/theme-accents.ts +1 -1
- package/src/lib/theme-catalogue.ts +3 -4
- package/src/lib/theme-css.ts +33 -54
- package/src/lib/theme-defaults.generated.ts +1 -1
- package/src/lib/theme-defaults.ts +55 -7
- package/src/lib/theme-engine-light.ts +88 -72
- package/src/lib/theme-engine.ts +29 -33
- package/src/lib/theme-records.ts +33 -69
- package/src/lib/theme-types.ts +199 -0
- package/src/lib/themes.ts +33 -196
- package/src/lib/tokens.ts +0 -1
- package/src/lib/url.ts +25 -0
- package/src/lib/version-notes.ts +3 -9
- package/src/styles/theme-variants.css +32 -32
- package/src/styles/theme.css +17 -13
- package/dist/components/conversation/paste-preview.d.ts +0 -11
- package/dist/components/conversation/paste-preview.d.ts.map +0 -1
- package/dist/components/conversation/paste-preview.js +0 -27
- package/dist/components/conversation/paste-preview.js.map +0 -1
- package/dist/components/theme/theme-document-core.d.ts +0 -124
- package/dist/components/theme/theme-document-core.d.ts.map +0 -1
- package/dist/components/theme/theme-document-core.js.map +0 -1
- package/dist/components/theme/theme-provider-core.d.ts +0 -19
- package/dist/components/theme/theme-provider-core.d.ts.map +0 -1
- package/dist/components/theme/theme-provider-core.js +0 -27
- package/dist/components/theme/theme-provider-core.js.map +0 -1
- package/dist/components/theme/theme-provider-lazy.d.ts +0 -28
- package/dist/components/theme/theme-provider-lazy.d.ts.map +0 -1
- package/dist/components/theme/theme-provider-lazy.js +0 -35
- package/dist/components/theme/theme-provider-lazy.js.map +0 -1
- package/dist/components/theme/theme-state-core.d.ts +0 -254
- package/dist/components/theme/theme-state-core.d.ts.map +0 -1
- package/dist/components/theme/theme-state-core.js.map +0 -1
- package/dist/r/src/components/conversation/paste-preview.ts +0 -35
- package/dist/r/src/components/theme/theme-document-core.ts +0 -275
- package/dist/r/src/components/theme/theme-provider-core.tsx +0 -40
- package/dist/r/src/components/theme/theme-provider-lazy.tsx +0 -34
- package/dist/r/src/components/theme/theme-state-core.ts +0 -370
- package/src/components/conversation/paste-preview.ts +0 -35
- package/src/components/theme/theme-document-core.ts +0 -275
- package/src/components/theme/theme-provider-core.tsx +0 -40
- package/src/components/theme/theme-provider-lazy.tsx +0 -34
- package/src/components/theme/theme-state-core.ts +0 -370
|
@@ -1,18 +1,120 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import type { ThemeTokenProjectionOptions } from './token-projection';
|
|
2
|
+
import type { ThemeEngine } from '#lib/theme-engine';
|
|
3
|
+
import type { EditorRolesMode, ThemeAppearance, ThemeVariant } from '#lib/theme-types';
|
|
4
|
+
import { type SurfaceState } from '#lib/theme-surface';
|
|
5
|
+
import { type ThemeSelection } from './theme-state';
|
|
3
6
|
/**
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* The document half of the theme provider: the single writer of `<html>`.
|
|
8
|
+
*
|
|
9
|
+
* Written against the few members of an element it uses, so the rules can be tested
|
|
10
|
+
* on a stand-in. Every question the catalogue answers goes through the
|
|
11
|
+
* {@link ThemeEngine} it is given, so it imports no catalogue code or data.
|
|
8
12
|
*/
|
|
9
|
-
export
|
|
13
|
+
export type ThemeRoot = Pick<HTMLElement, 'classList' | 'dataset' | 'style' | 'removeAttribute' | 'setAttribute'>;
|
|
14
|
+
export type ThemeDocumentState = {
|
|
15
|
+
/** What the document shows: the committed selection, or a preview laid over it. */
|
|
16
|
+
selection: ThemeSelection;
|
|
17
|
+
appearance: ThemeAppearance;
|
|
18
|
+
variant: ThemeVariant;
|
|
19
|
+
/**
|
|
20
|
+
* The variant whose terminal palette is pinned over the interface variant's.
|
|
21
|
+
* Absent, the terminal follows the interface theme.
|
|
22
|
+
*/
|
|
23
|
+
terminalVariant?: ThemeVariant;
|
|
24
|
+
/**
|
|
25
|
+
* The resolved surface axis. Absent, the axis is off: no attribute and no
|
|
26
|
+
* `--surface-alpha` is written, and any this writer wrote before is removed.
|
|
27
|
+
*/
|
|
28
|
+
surface?: SurfaceState;
|
|
29
|
+
};
|
|
30
|
+
export type ThemeDocumentOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* Rewrites the custom properties just before they are written: the variant's
|
|
33
|
+
* roles with the accent laid over them. It sees every property of the pass and
|
|
34
|
+
* must return the full map; a name it drops is not written.
|
|
35
|
+
*/
|
|
36
|
+
transformTokens?: (tokens: Record<string, string>) => Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* The contrast an accent is held to against the variant's background. Absent, a
|
|
39
|
+
* preset is painted verbatim (the catalogue measured it for its own themes) and
|
|
40
|
+
* only a custom `#rrggbb` is held to the default floor of 3:1.
|
|
41
|
+
*/
|
|
42
|
+
accentContrastFloor?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Where a catalogue variant's palette comes from. `inline` (the default) writes
|
|
45
|
+
* every role onto the root. `stylesheet` writes none for a catalogue variant,
|
|
46
|
+
* because the host loads a stylesheet that carries a `[data-theme]` block for it;
|
|
47
|
+
* a variant the catalogue does not hold (a host's imported theme) is still written
|
|
48
|
+
* inline, since no stylesheet can know it. The accent, the terminal pin, the
|
|
49
|
+
* surface alpha and the fonts are written the same in both.
|
|
50
|
+
*
|
|
51
|
+
* Switching from an imported variant back to a catalogue one removes what the
|
|
52
|
+
* imported one wrote, so nothing inline outlives it to beat the stylesheet.
|
|
53
|
+
*/
|
|
54
|
+
palette?: 'inline' | 'stylesheet';
|
|
55
|
+
/**
|
|
56
|
+
* The `--editor-*` projection. `syntax` (the default) is the catalogue's quiet
|
|
57
|
+
* syntax roles, which is what `theme-variants.css` carries; `floor` holds every
|
|
58
|
+
* editor role to 4.5:1 on the canvas, as hex.
|
|
59
|
+
*
|
|
60
|
+
* With `palette: 'stylesheet'`, `floor` is the one palette write a catalogue
|
|
61
|
+
* variant still gets: the stylesheet is generated for the default projection, so
|
|
62
|
+
* the sixteen `--editor-*` properties are written inline over it. The rest of the
|
|
63
|
+
* palette stays in the stylesheet.
|
|
64
|
+
*/
|
|
65
|
+
editorRoles?: EditorRolesMode;
|
|
66
|
+
} & ThemeTokenProjectionOptions;
|
|
67
|
+
/**
|
|
68
|
+
* The custom properties a state paints: the variant's roles, an optional projection
|
|
69
|
+
* from the raw host map, the accent, the pinned terminal palette, the surface alpha,
|
|
70
|
+
* then `transformTokens`.
|
|
71
|
+
*
|
|
72
|
+
* The accent is applied *here* rather than left to the `[data-accent]` blocks in
|
|
73
|
+
* `theme.css`, because the properties are written inline and an inline declaration
|
|
74
|
+
* outranks every stylesheet selector however specific it is. The blocks still exist
|
|
75
|
+
* and are still correct — they are what styles the window before this runs — but
|
|
76
|
+
* they cannot win from here, so leaving the accent to them meant the attribute was
|
|
77
|
+
* set, the rules were present, and nothing changed on screen.
|
|
78
|
+
*/
|
|
79
|
+
export declare function themeDocumentTokens(engine: ThemeEngine, state: ThemeDocumentState, options?: ThemeDocumentOptions): {
|
|
10
80
|
tokens: Record<string, string>;
|
|
11
81
|
accented: boolean;
|
|
12
82
|
};
|
|
13
83
|
/**
|
|
14
|
-
* Write a state onto a root and report which custom properties it owns
|
|
15
|
-
*
|
|
84
|
+
* Write a state onto a root and report which custom properties it owns.
|
|
85
|
+
*
|
|
86
|
+
* Pass the previous call's return as `previous` and any palette property that pass
|
|
87
|
+
* wrote and this one does not is removed. For the catalogue the two sets are the
|
|
88
|
+
* same, so nothing is ever removed; it matters for a host variant that carries
|
|
89
|
+
* `tokens` the catalogue does not, which would otherwise stay inline, beating the
|
|
90
|
+
* stylesheet, after the user switched away from it.
|
|
91
|
+
*/
|
|
92
|
+
export declare function applyThemeToRoot(engine: ThemeEngine, root: ThemeRoot, state: ThemeDocumentState, options?: ThemeDocumentOptions, previous?: ReadonlySet<string>): ReadonlySet<string>;
|
|
93
|
+
/** What {@link applyWithoutTransitions} needs of a document. */
|
|
94
|
+
export type TransitionDocument = {
|
|
95
|
+
head: {
|
|
96
|
+
appendChild(node: unknown): unknown;
|
|
97
|
+
};
|
|
98
|
+
createElement(tag: 'style'): {
|
|
99
|
+
textContent: string | null;
|
|
100
|
+
offsetHeight?: number;
|
|
101
|
+
remove(): void;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Run `apply` with every CSS transition switched off for the frame that carries
|
|
106
|
+
* it, so a theme switch cannot animate page-wide.
|
|
107
|
+
*
|
|
108
|
+
* Without this, flipping the custom properties on `<html>` starts a transition on
|
|
109
|
+
* every element that declares one, and each fades from the old palette to the new
|
|
110
|
+
* over its own duration: a theme change that looks like a rendering fault. The
|
|
111
|
+
* rule is removed two frames later, after the browser has committed the new styles
|
|
112
|
+
* with transitions off, and `restore` runs it early (the provider calls it when it
|
|
113
|
+
* is disposed mid-switch).
|
|
114
|
+
*
|
|
115
|
+
* `schedule` is the frame source; it defaults to `requestAnimationFrame` and falls
|
|
116
|
+
* back to running at once where there is none, which leaves transitions on rather
|
|
117
|
+
* than off.
|
|
16
118
|
*/
|
|
17
|
-
export declare function
|
|
119
|
+
export declare function applyWithoutTransitions(doc: TransitionDocument, apply: () => void, schedule?: (callback: () => void) => void): () => void;
|
|
18
120
|
//# sourceMappingURL=theme-document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-document.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-document.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme-document.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-document.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEtF,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAEpE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,CAC1B,WAAW,EACX,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,iBAAiB,GAAG,cAAc,CACvE,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mFAAmF;IACnF,SAAS,EAAE,cAAc,CAAA;IACzB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,YAAY,CAAA;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5E;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IACjC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,eAAe,CAAA;CAC9B,GAAG,2BAA2B,CAAA;AAoB/B;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,kBAAkB,EACzB,OAAO,GAAE,oBAAyB,GACjC;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAiCvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,kBAAkB,EACzB,OAAO,GAAE,oBAAyB,EAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,WAAW,CAAC,MAAM,CAAC,CA6CrB;AAED,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE;QAAE,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;KAAE,CAAA;IAC7C,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG;QAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;QAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,MAAM,IAAI,IAAI,CAAA;KACf,CAAA;CACF,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,kBAAkB,EACvB,KAAK,EAAE,MAAM,IAAI,EACjB,QAAQ,GAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAsB,GACzD,MAAM,IAAI,CAqBZ"}
|
|
@@ -3,8 +3,8 @@ import { terminalCssVariables } from "../../lib/theme-css.js";
|
|
|
3
3
|
import { assertThemeTokenProjectionConfig } from "./token-projection-options.js";
|
|
4
4
|
import { isCustomAccent } from "../../lib/accent-roles.js";
|
|
5
5
|
import { surfaceAlpha } from "../../lib/theme-surface.js";
|
|
6
|
-
import { resolvedDensity } from "./theme-state
|
|
7
|
-
// src/components/theme/theme-document
|
|
6
|
+
import { resolvedDensity } from "./theme-state.js";
|
|
7
|
+
// src/components/theme/theme-document.ts
|
|
8
8
|
/**
|
|
9
9
|
* What a catalogue variant still writes inline when its palette is the stylesheet's:
|
|
10
10
|
* nothing, unless the editor projection is not the one the stylesheet was generated
|
|
@@ -26,7 +26,7 @@ function stylesheetOverrides(engine, variant, editorRoles) {
|
|
|
26
26
|
* they cannot win from here, so leaving the accent to them meant the attribute was
|
|
27
27
|
* set, the rules were present, and nothing changed on screen.
|
|
28
28
|
*/
|
|
29
|
-
function
|
|
29
|
+
function themeDocumentTokens(engine, state, options = {}) {
|
|
30
30
|
assertThemeTokenProjectionConfig(options.tokenProjection);
|
|
31
31
|
const properties = options.palette === "stylesheet" && engine.isCatalogueVariant(state.variant) ? stylesheetOverrides(engine, state.variant, options.editorRoles) : { ...engine.themeCssVariables(state.variant, { editor: options.editorRoles }) };
|
|
32
32
|
if (options.tokenProjection && !engine.isCatalogueVariant(state.variant)) {
|
|
@@ -59,8 +59,8 @@ function themeDocumentTokensWith(engine, state, options = {}) {
|
|
|
59
59
|
* `tokens` the catalogue does not, which would otherwise stay inline, beating the
|
|
60
60
|
* stylesheet, after the user switched away from it.
|
|
61
61
|
*/
|
|
62
|
-
function
|
|
63
|
-
const { tokens, accented } =
|
|
62
|
+
function applyThemeToRoot(engine, root, state, options = {}, previous) {
|
|
63
|
+
const { tokens, accented } = themeDocumentTokens(engine, state, options);
|
|
64
64
|
for (const [name, value] of Object.entries(tokens)) root.style.setProperty(name, value);
|
|
65
65
|
if (previous) {
|
|
66
66
|
for (const name of previous) if (!(name in tokens)) root.style.removeProperty(name);
|
|
@@ -122,6 +122,6 @@ function defaultSchedule(callback) {
|
|
|
122
122
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(callback);
|
|
123
123
|
else callback();
|
|
124
124
|
}
|
|
125
|
-
export {
|
|
125
|
+
export { applyThemeToRoot, applyWithoutTransitions, themeDocumentTokens };
|
|
126
126
|
|
|
127
|
-
//# sourceMappingURL=theme-document
|
|
127
|
+
//# sourceMappingURL=theme-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-document.js","names":[],"sources":["../../../src/components/theme/theme-document.ts"],"sourcesContent":["import {\n applyAppearanceFontSettings,\n normalizeAppearanceEditorFontSettings,\n} from '#lib/appearance-font-settings'\nimport { terminalCssVariables } from '#lib/theme-css'\nimport type { ThemeTokenProjectionOptions } from './token-projection'\nimport { assertThemeTokenProjectionConfig } from './token-projection-options'\nimport type { ThemeEngine } from '#lib/theme-engine'\nimport type { EditorRolesMode, ThemeAppearance, ThemeVariant } from '#lib/theme-types'\nimport { isCustomAccent } from '#lib/accent-roles'\nimport { surfaceAlpha, type SurfaceState } from '#lib/theme-surface'\nimport { resolvedDensity, type ThemeSelection } from './theme-state'\n\n/**\n * The document half of the theme provider: the single writer of `<html>`.\n *\n * Written against the few members of an element it uses, so the rules can be tested\n * on a stand-in. Every question the catalogue answers goes through the\n * {@link ThemeEngine} it is given, so it imports no catalogue code or data.\n */\nexport type ThemeRoot = Pick<\n HTMLElement,\n 'classList' | 'dataset' | 'style' | 'removeAttribute' | 'setAttribute'\n>\n\nexport type ThemeDocumentState = {\n /** What the document shows: the committed selection, or a preview laid over it. */\n selection: ThemeSelection\n appearance: ThemeAppearance\n variant: ThemeVariant\n /**\n * The variant whose terminal palette is pinned over the interface variant's.\n * Absent, the terminal follows the interface theme.\n */\n terminalVariant?: ThemeVariant\n /**\n * The resolved surface axis. Absent, the axis is off: no attribute and no\n * `--surface-alpha` is written, and any this writer wrote before is removed.\n */\n surface?: SurfaceState\n}\n\nexport type ThemeDocumentOptions = {\n /**\n * Rewrites the custom properties just before they are written: the variant's\n * roles with the accent laid over them. It sees every property of the pass and\n * must return the full map; a name it drops is not written.\n */\n transformTokens?: (tokens: Record<string, string>) => Record<string, string>\n /**\n * The contrast an accent is held to against the variant's background. Absent, a\n * preset is painted verbatim (the catalogue measured it for its own themes) and\n * only a custom `#rrggbb` is held to the default floor of 3:1.\n */\n accentContrastFloor?: number\n /**\n * Where a catalogue variant's palette comes from. `inline` (the default) writes\n * every role onto the root. `stylesheet` writes none for a catalogue variant,\n * because the host loads a stylesheet that carries a `[data-theme]` block for it;\n * a variant the catalogue does not hold (a host's imported theme) is still written\n * inline, since no stylesheet can know it. The accent, the terminal pin, the\n * surface alpha and the fonts are written the same in both.\n *\n * Switching from an imported variant back to a catalogue one removes what the\n * imported one wrote, so nothing inline outlives it to beat the stylesheet.\n */\n palette?: 'inline' | 'stylesheet'\n /**\n * The `--editor-*` projection. `syntax` (the default) is the catalogue's quiet\n * syntax roles, which is what `theme-variants.css` carries; `floor` holds every\n * editor role to 4.5:1 on the canvas, as hex.\n *\n * With `palette: 'stylesheet'`, `floor` is the one palette write a catalogue\n * variant still gets: the stylesheet is generated for the default projection, so\n * the sixteen `--editor-*` properties are written inline over it. The rest of the\n * palette stays in the stylesheet.\n */\n editorRoles?: EditorRolesMode\n} & ThemeTokenProjectionOptions\n\n/**\n * What a catalogue variant still writes inline when its palette is the stylesheet's:\n * nothing, unless the editor projection is not the one the stylesheet was generated\n * for.\n */\nfunction stylesheetOverrides(\n engine: ThemeEngine,\n variant: ThemeVariant,\n editorRoles: EditorRolesMode | undefined\n): Record<string, string> {\n if (editorRoles !== 'floor') return {}\n return Object.fromEntries(\n Object.entries(engine.themeCssVariables(variant, { editor: 'floor' })).filter(([name]) =>\n name.startsWith('--editor-')\n )\n )\n}\n\n/**\n * The custom properties a state paints: the variant's roles, an optional projection\n * from the raw host map, the accent, the pinned terminal palette, the surface alpha,\n * then `transformTokens`.\n *\n * The accent is applied *here* rather than left to the `[data-accent]` blocks in\n * `theme.css`, because the properties are written inline and an inline declaration\n * outranks every stylesheet selector however specific it is. The blocks still exist\n * and are still correct — they are what styles the window before this runs — but\n * they cannot win from here, so leaving the accent to them meant the attribute was\n * set, the rules were present, and nothing changed on screen.\n */\nexport function themeDocumentTokens(\n engine: ThemeEngine,\n state: ThemeDocumentState,\n options: ThemeDocumentOptions = {}\n): { tokens: Record<string, string>; accented: boolean } {\n assertThemeTokenProjectionConfig(options.tokenProjection)\n const fromStylesheet =\n options.palette === 'stylesheet' && engine.isCatalogueVariant(state.variant)\n const properties = fromStylesheet\n ? stylesheetOverrides(engine, state.variant, options.editorRoles)\n : { ...engine.themeCssVariables(state.variant, { editor: options.editorRoles }) }\n if (options.tokenProjection && !engine.isCatalogueVariant(state.variant)) {\n const rawTokens = state.variant.tokens ?? {}\n const projected = options.tokenProjection.project(rawTokens, options.tokenProjection.rules)\n for (const rule of options.tokenProjection.rules) {\n if (!rule || typeof rule.target !== 'string') continue\n if (Object.hasOwn(projected, rule.target)) {\n properties[rule.target] = projected[rule.target]!\n }\n }\n }\n const accent = engine.accentVariables(state.selection.accent, state.appearance, state.selection, {\n background: state.variant.colors.background,\n floor: options.accentContrastFloor,\n variantId: state.variant.id,\n })\n if (accent) Object.assign(properties, accent)\n // Written after the variant and the accent, so it wins over the interface\n // variant's own terminal ramp (and over the stylesheet's, which it outranks as an\n // inline declaration). Dropping the pin needs no removal of its own: the ramp is\n // then rewritten by the variant, or swept back to the stylesheet.\n if (state.terminalVariant) Object.assign(properties, terminalCssVariables(state.terminalVariant))\n if (state.surface) properties['--surface-alpha'] = surfaceAlpha[state.surface.surface]\n return {\n tokens: options.transformTokens ? options.transformTokens(properties) : properties,\n accented: accent !== undefined,\n }\n}\n\n/**\n * Write a state onto a root and report which custom properties it owns.\n *\n * Pass the previous call's return as `previous` and any palette property that pass\n * wrote and this one does not is removed. For the catalogue the two sets are the\n * same, so nothing is ever removed; it matters for a host variant that carries\n * `tokens` the catalogue does not, which would otherwise stay inline, beating the\n * stylesheet, after the user switched away from it.\n */\nexport function applyThemeToRoot(\n engine: ThemeEngine,\n root: ThemeRoot,\n state: ThemeDocumentState,\n options: ThemeDocumentOptions = {},\n previous?: ReadonlySet<string>\n): ReadonlySet<string> {\n const { tokens, accented } = themeDocumentTokens(engine, state, options)\n\n for (const [name, value] of Object.entries(tokens)) {\n root.style.setProperty(name, value)\n }\n if (previous) {\n for (const name of previous) {\n if (!(name in tokens)) root.style.removeProperty(name)\n }\n }\n\n root.classList.toggle('dark', state.appearance === 'dark')\n root.dataset['theme'] = state.variant.id\n root.dataset['appearance'] = state.appearance\n root.style.colorScheme = state.appearance\n\n // A custom colour has no stylesheet block to select, and its value is the\n // attribute's worst possible content, so it is reported as `custom`.\n if (!accented) root.removeAttribute('data-accent')\n else\n root.dataset['accent'] = isCustomAccent(state.selection.accent)\n ? 'custom'\n : state.selection.accent\n\n // The surface axis is opt-in, so its absence removes rather than defaults: a host\n // that never enables it keeps an `<html>` with neither attribute, and one that\n // turns it off leaves nothing behind. (`--surface-alpha` is swept with the tokens.)\n if (state.surface) {\n root.dataset['surface'] = state.surface.surface\n root.dataset['reduceTransparency'] = state.surface.reduceTransparencyActive ? 'true' : 'false'\n } else {\n root.removeAttribute('data-surface')\n root.removeAttribute('data-reduce-transparency')\n }\n\n applyAppearanceFontSettings(\n root,\n normalizeAppearanceEditorFontSettings(state.selection.fonts, state.selection.font).settings\n )\n\n if (resolvedDensity(state.selection) === 'comfortable') root.removeAttribute('data-density')\n else root.dataset['density'] = resolvedDensity(state.selection)\n\n return new Set(Object.keys(tokens))\n}\n\n/** What {@link applyWithoutTransitions} needs of a document. */\nexport type TransitionDocument = {\n head: { appendChild(node: unknown): unknown }\n createElement(tag: 'style'): {\n textContent: string | null\n offsetHeight?: number\n remove(): void\n }\n}\n\n/**\n * Run `apply` with every CSS transition switched off for the frame that carries\n * it, so a theme switch cannot animate page-wide.\n *\n * Without this, flipping the custom properties on `<html>` starts a transition on\n * every element that declares one, and each fades from the old palette to the new\n * over its own duration: a theme change that looks like a rendering fault. The\n * rule is removed two frames later, after the browser has committed the new styles\n * with transitions off, and `restore` runs it early (the provider calls it when it\n * is disposed mid-switch).\n *\n * `schedule` is the frame source; it defaults to `requestAnimationFrame` and falls\n * back to running at once where there is none, which leaves transitions on rather\n * than off.\n */\nexport function applyWithoutTransitions(\n doc: TransitionDocument,\n apply: () => void,\n schedule: (callback: () => void) => void = defaultSchedule\n): () => void {\n const style = doc.createElement('style')\n style.textContent = '*{transition:none !important}'\n doc.head.appendChild(style)\n // Reading a layout property forces the browser to commit the rule before the\n // properties change; without it the two can be batched into one style recalc.\n void style.offsetHeight\n let removed = false\n const restore = () => {\n if (removed) return\n removed = true\n style.remove()\n }\n try {\n apply()\n } catch (error) {\n restore()\n throw error\n }\n schedule(() => schedule(restore))\n return restore\n}\n\nfunction defaultSchedule(callback: () => void): void {\n if (typeof requestAnimationFrame === 'function') requestAnimationFrame(callback)\n else callback()\n}\n"],"mappings":";;;;;;;;;;;;AAqFA,SAAS,oBACP,QACA,SACA,aACwB;CACxB,IAAI,gBAAgB,SAAS,OAAO,CAAC;CACrC,OAAO,OAAO,YACZ,OAAO,QAAQ,OAAO,kBAAkB,SAAS,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAC9E,KAAK,WAAW,WAAW,CAC7B,CACF;AACF;;;;;;;;;;;;;AAcA,SAAgB,oBACd,QACA,OACA,UAAgC,CAAC,GACsB;CACvD,iCAAiC,QAAQ,eAAe;CAGxD,MAAM,aADJ,QAAQ,YAAY,gBAAgB,OAAO,mBAAmB,MAAM,OAAO,IAEzE,oBAAoB,QAAQ,MAAM,SAAS,QAAQ,WAAW,IAC9D,EAAE,GAAG,OAAO,kBAAkB,MAAM,SAAS,EAAE,QAAQ,QAAQ,YAAY,CAAC,EAAE;CAClF,IAAI,QAAQ,mBAAmB,CAAC,OAAO,mBAAmB,MAAM,OAAO,GAAG;EACxE,MAAM,YAAY,MAAM,QAAQ,UAAU,CAAC;EAC3C,MAAM,YAAY,QAAQ,gBAAgB,QAAQ,WAAW,QAAQ,gBAAgB,KAAK;EAC1F,KAAK,MAAM,QAAQ,QAAQ,gBAAgB,OAAO;GAChD,IAAI,CAAC,QAAQ,OAAO,KAAK,WAAW,UAAU;GAC9C,IAAI,OAAO,OAAO,WAAW,KAAK,MAAM,GACtC,WAAW,KAAK,UAAU,UAAU,KAAK;EAE7C;CACF;CACA,MAAM,SAAS,OAAO,gBAAgB,MAAM,UAAU,QAAQ,MAAM,YAAY,MAAM,WAAW;EAC/F,YAAY,MAAM,QAAQ,OAAO;EACjC,OAAO,QAAQ;EACf,WAAW,MAAM,QAAQ;CAC3B,CAAC;CACD,IAAI,QAAQ,OAAO,OAAO,YAAY,MAAM;CAK5C,IAAI,MAAM,iBAAiB,OAAO,OAAO,YAAY,qBAAqB,MAAM,eAAe,CAAC;CAChG,IAAI,MAAM,SAAS,WAAW,qBAAqB,aAAa,MAAM,QAAQ;CAC9E,OAAO;EACL,QAAQ,QAAQ,kBAAkB,QAAQ,gBAAgB,UAAU,IAAI;EACxE,UAAU,WAAW,KAAA;CACvB;AACF;;;;;;;;;;AAWA,SAAgB,iBACd,QACA,MACA,OACA,UAAgC,CAAC,GACjC,UACqB;CACrB,MAAM,EAAE,QAAQ,aAAa,oBAAoB,QAAQ,OAAO,OAAO;CAEvE,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,GAC/C,KAAK,MAAM,YAAY,MAAM,KAAK;CAEpC,IAAI,UACG;OAAA,MAAM,QAAQ,UACjB,IAAI,EAAE,QAAQ,SAAS,KAAK,MAAM,eAAe,IAAI;CAAA;CAIzD,KAAK,UAAU,OAAO,QAAQ,MAAM,eAAe,MAAM;CACzD,KAAK,QAAQ,WAAW,MAAM,QAAQ;CACtC,KAAK,QAAQ,gBAAgB,MAAM;CACnC,KAAK,MAAM,cAAc,MAAM;CAI/B,IAAI,CAAC,UAAU,KAAK,gBAAgB,aAAa;MAE/C,KAAK,QAAQ,YAAY,eAAe,MAAM,UAAU,MAAM,IAC1D,WACA,MAAM,UAAU;CAKtB,IAAI,MAAM,SAAS;EACjB,KAAK,QAAQ,aAAa,MAAM,QAAQ;EACxC,KAAK,QAAQ,wBAAwB,MAAM,QAAQ,2BAA2B,SAAS;CACzF,OAAO;EACL,KAAK,gBAAgB,cAAc;EACnC,KAAK,gBAAgB,0BAA0B;CACjD;CAEA,4BACE,MACA,sCAAsC,MAAM,UAAU,OAAO,MAAM,UAAU,IAAI,CAAC,CAAC,QACrF;CAEA,IAAI,gBAAgB,MAAM,SAAS,MAAM,eAAe,KAAK,gBAAgB,cAAc;MACtF,KAAK,QAAQ,aAAa,gBAAgB,MAAM,SAAS;CAE9D,OAAO,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC;AACpC;;;;;;;;;;;;;;;;AA2BA,SAAgB,wBACd,KACA,OACA,WAA2C,iBAC/B;CACZ,MAAM,QAAQ,IAAI,cAAc,OAAO;CACvC,MAAM,cAAc;CACpB,IAAI,KAAK,YAAY,KAAK;CAG1B,MAAW;CACX,IAAI,UAAU;CACd,MAAM,gBAAgB;EACpB,IAAI,SAAS;EACb,UAAU;EACV,MAAM,OAAO;CACf;CACA,IAAI;EACF,MAAM;CACR,SAAS,OAAO;EACd,QAAQ;EACR,MAAM;CACR;CACA,eAAe,SAAS,OAAO,CAAC;CAChC,OAAO;AACT;AAEA,SAAS,gBAAgB,UAA4B;CACnD,IAAI,OAAO,0BAA0B,YAAY,sBAAsB,QAAQ;MAC1E,SAAS;AAChB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps } from 'solid-js';
|
|
2
|
-
import { ToggleGroup } from '../ui/toggle-group
|
|
2
|
+
import { ToggleGroup } from '../ui/toggle-group';
|
|
3
3
|
/** Controlled appearance selection for hosts that own their preference storage. */
|
|
4
4
|
export type ThemeModeToggleProps = Omit<ComponentProps<typeof ToggleGroup>, 'children' | 'value' | 'onChange' | 'multiple'> & {
|
|
5
5
|
mode: 'light' | 'dark' | 'system';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-mode-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-mode-toggle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAmB,MAAM,
|
|
1
|
+
{"version":3,"file":"theme-mode-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-mode-toggle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAmB,MAAM,oBAAoB,CAAA;AASjE,mFAAmF;AACnF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,cAAc,CAAC,OAAO,WAAW,CAAC,EAClC,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAC/C,GAAG;IACF,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACjC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,KAAK,IAAI,CAAA;IACzD,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,kCAiC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-mode-toggle.js","names":["Monitor","Moon","Sun","ComponentProps","For","splitProps","ToggleGroup","ToggleGroupItem","Tooltip","TooltipContent","TooltipTrigger","APPEARANCES","value","label","icon","const","ThemeModeToggleProps","Omit","mode","onModeChange","withLabels","ThemeModeToggle","props","local","rest","_$createComponent","_$mergeProps","attached","multiple","onChange","option","find","candidate","aria-label","children","each","appearance","as","variant","size","_$memo","_el$","_tmpl$","_$insert","toLowerCase","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../src/components/theme/theme-mode-toggle.tsx"],"sourcesContent":["import { Monitor, Moon, Sun } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { ToggleGroup, ToggleGroupItem } from '../ui/toggle-group
|
|
1
|
+
{"version":3,"file":"theme-mode-toggle.js","names":["Monitor","Moon","Sun","ComponentProps","For","splitProps","ToggleGroup","ToggleGroupItem","Tooltip","TooltipContent","TooltipTrigger","APPEARANCES","value","label","icon","const","ThemeModeToggleProps","Omit","mode","onModeChange","withLabels","ThemeModeToggle","props","local","rest","_$createComponent","_$mergeProps","attached","multiple","onChange","option","find","candidate","aria-label","children","each","appearance","as","variant","size","_$memo","_el$","_tmpl$","_$insert","toLowerCase","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../src/components/theme/theme-mode-toggle.tsx"],"sourcesContent":["import { Monitor, Moon, Sun } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { ToggleGroup, ToggleGroupItem } from '../ui/toggle-group'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip'\n\nconst APPEARANCES = [\n { value: 'light', label: 'Light', icon: Sun },\n { value: 'dark', label: 'Dark', icon: Moon },\n { value: 'system', label: 'System', icon: Monitor },\n] as const\n\n/** Controlled appearance selection for hosts that own their preference storage. */\nexport type ThemeModeToggleProps = Omit<\n ComponentProps<typeof ToggleGroup>,\n 'children' | 'value' | 'onChange' | 'multiple'\n> & {\n mode: 'light' | 'dark' | 'system'\n onModeChange: (mode: 'light' | 'dark' | 'system') => void\n withLabels?: boolean\n}\n\nexport function ThemeModeToggle(props: ThemeModeToggleProps) {\n const [local, rest] = splitProps(props, ['mode', 'onModeChange', 'withLabels'])\n return (\n <ToggleGroup\n {...rest}\n attached\n multiple={false}\n value={local.mode}\n onChange={(value: string | null) => {\n const option = APPEARANCES.find((candidate) => candidate.value === value)\n if (option) local.onModeChange(option.value)\n }}\n aria-label={rest['aria-label'] ?? 'Appearance'}\n >\n <For each={APPEARANCES}>\n {(appearance) => (\n <Tooltip>\n <TooltipTrigger\n as={ToggleGroupItem}\n value={appearance.value}\n variant=\"outline\"\n size={local.withLabels ? 'sm' : 'icon-sm'}\n aria-label={appearance.label}\n >\n <appearance.icon aria-hidden=\"true\" />\n {local.withLabels ? <span>{appearance.label}</span> : null}\n </TooltipTrigger>\n <TooltipContent>Use {appearance.label.toLowerCase()} appearance</TooltipContent>\n </Tooltip>\n )}\n </For>\n </ToggleGroup>\n )\n}\n"],"mappings":";;;;;;;AAMA,IAAMW,cAAc;CAClB;EAAEC,OAAO;EAASC,OAAO;EAASC,MAAMZ;CAAI;CAC5C;EAAEU,OAAO;EAAQC,OAAO;EAAQC,MAAMb;CAAK;CAC3C;EAAEW,OAAO;EAAUC,OAAO;EAAUC,MAAMd;CAAQ;AAAC;AAarD,SAAgBqB,gBAAgBC,OAA6B;CAC3D,MAAM,CAACC,OAAOC,QAAQnB,WAAWiB,OAAO;EAAC;EAAQ;EAAgB;CAAY,CAAC;CAC9E,OAAAG,gBACGnB,aAAWoB,WACNF,MAAI;EACRG,UAAQ;EACRC,UAAU;EAAK,IACfhB,QAAK;GAAA,OAAEW,MAAML;EAAI;EACjBW,WAAWjB,UAAyB;GAClC,MAAMkB,SAASnB,YAAYoB,MAAMC,cAAcA,UAAUpB,UAAUA,KAAK;GACxE,IAAIkB,QAAQP,MAAMJ,aAAaW,OAAOlB,KAAK;EAC7C;EAAC,KAAA,gBAAA;GAAA,OACWY,KAAK,iBAAiB;EAAY;EAAA,IAAAU,WAAA;GAAA,OAAAT,gBAE7CrB,KAAG;IAAC+B,MAAMxB;IAAWuB,WAClBE,eAAUX,gBACTjB,SAAO,EAAA,IAAA0B,WAAA;KAAA,OAAA,CAAAT,gBACLf,gBAAc;MACb2B,IAAI9B;MAAe,IACnBK,QAAK;OAAA,OAAEwB,WAAWxB;MAAK;MACvB0B,SAAO;MAAA,IACPC,OAAI;OAAA,OAAEhB,MAAMH,aAAa,OAAO;MAAS;MAAA,KAAA,gBAAA;OAAA,OAC7BgB,WAAWvB;MAAK;MAAA,IAAAqB,WAAA;OAAA,OAAA,CAAAT,gBAE3BW,WAAWtB,MAAI,EAAA,eAAA,OAAA,CAAA,GAAA0B,WACfA,WAAA,CAAA,CAAAjB,MAAMH,UAAU,CAAA,CAAA,WAAA;QAAA,IAAAqB,OAAAC,OAAA;QAAAC,OAAAF,YAAUL,WAAWvB,KAAK;QAAA,OAAA4B;OAAA,EAAA,CAAA,IAAW,IAAI,CAAA;MAAA;KAAA,CAAA,GAAAhB,gBAE3DhB,gBAAc,EAAA,IAAAyB,WAAA;MAAA,OAAA;OAAA;OAAAM,WAAMJ,WAAWvB,MAAM+B,YAAY,CAAC;OAAA;MAAA;KAAA,EAAA,CAAA,CAAA;IAAA,EAAA,CAAA;GAEtD,CAAA;EAAA;CAAA,CAAA,CAAA;AAIT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PreferenceStorage } from '#lib/preference-store';
|
|
2
|
-
import { type ThemeSelection } from './theme-state
|
|
2
|
+
import { type ThemeSelection } from './theme-state';
|
|
3
3
|
/**
|
|
4
4
|
* Where a selection is kept between sessions.
|
|
5
5
|
*
|
|
@@ -27,10 +27,11 @@ export type ThemePersistence = {
|
|
|
27
27
|
/**
|
|
28
28
|
* The default persistence: one JSON document in `localStorage` under `key`.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* provider whose `storageKey` prop changes writes to the
|
|
30
|
+
* Every stored id is validated, and an id is kept even when nothing holds it today
|
|
31
|
+
* (a host's imported theme), exactly as {@link createVersionedPersistence} keeps what
|
|
32
|
+
* its codec decodes: the provider resolves an unknown id, it never rewrites one.
|
|
33
|
+
* `key` may be a function so a provider whose `storageKey` prop changes writes to the
|
|
34
|
+
* key it is now given.
|
|
34
35
|
*
|
|
35
36
|
* Blocked, full or absent storage is survivable in both directions: a read answers
|
|
36
37
|
* with the defaults and a write is dropped, so the preference simply lasts the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-persistence.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-persistence.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme-persistence.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-persistence.ts"],"names":[],"mappings":"AAIA,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAA0C,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAE3F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,CAAA;IAC3C,KAAK,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAA;CAClC,CAAA;AA+CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,gBAAgB,CAStF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,CAEhG;AAED,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAExF;AAED;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,eAAe,CAAC,EAAE,YAAY,GAAG,MAAM,CAAA;IACvC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,CAAC,GAAG,IAAI;IAChC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAC1E;;;OAGG;IACH,UAAU,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,CAAA;IAC/D;;;OAGG;IACH,QAAQ,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,CAAA;IAChD;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,GAAG,CAAA;CAChF,CAAA;AAED,0EAA0E;AAC1E,MAAM,MAAM,2BAA2B,GAAG;IACxC,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,iBAAiB,GAAG,SAAS,CAAA;IAC7C,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAC5C,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,EAC1B,OAAO,GAAE,2BAAgC,GACxC,gBAAgB,CA2ClB"}
|
|
@@ -1,57 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { accentPresets } from "../../lib/accent-presets.js";
|
|
1
|
+
import { normalizeAccentSelection } from "../../lib/accent-roles.js";
|
|
3
2
|
import { normalizeAppearanceEditorFontSettings } from "../../lib/appearance-font-settings.js";
|
|
4
|
-
import {
|
|
5
|
-
import { catalogueThemeAppearance, defaultDarkThemeId, defaultLightThemeId } from "../../lib/theme-defaults.js";
|
|
3
|
+
import { storedThemeId } from "../../lib/theme-defaults.js";
|
|
6
4
|
import { normalizeSurface } from "../../lib/theme-surface.js";
|
|
7
|
-
import { defaultPreferenceStorage, readLegacyValue, readVersionedRecord, recoveryKeyFor, writeVersionedRecord } from "../../lib/preference-store.js";
|
|
8
|
-
import { defaultThemeSelection, resolvedDensity } from "./theme-state
|
|
5
|
+
import { attemptStorage, defaultPreferenceStorage, readLegacyValue, readVersionedRecord, recoveryKeyFor, writeVersionedRecord } from "../../lib/preference-store.js";
|
|
6
|
+
import { defaultThemeSelection, resolvedDensity } from "./theme-state.js";
|
|
9
7
|
// src/components/theme/theme-persistence.ts
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* Only ever called inside a `try`: where storage is blocked — a sandboxed iframe, a
|
|
14
|
-
* privacy mode, a denied site-data permission — merely *reading* the `localStorage`
|
|
15
|
-
* global throws ("Access is denied", `SecurityError`), so even the `typeof` guard
|
|
16
|
-
* has to sit inside the `try` rather than in front of it. Without a store the
|
|
17
|
-
* preference lives only in the provider's signal for the session.
|
|
18
|
-
*/
|
|
19
|
-
function preferenceStore() {
|
|
20
|
-
return typeof localStorage === "undefined" ? void 0 : localStorage;
|
|
8
|
+
function isRecord(value) {
|
|
9
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21
10
|
}
|
|
22
11
|
/**
|
|
23
|
-
* The stored preference, validated against the
|
|
24
|
-
* reading it never loads the catalogue.
|
|
12
|
+
* The stored preference, validated against the policy in `lib/theme-defaults` and
|
|
13
|
+
* `lib/accent-roles`, so reading it never loads the catalogue.
|
|
25
14
|
*/
|
|
26
15
|
function readSelection(storageKey) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
} catch {
|
|
45
|
-
return defaultThemeSelection;
|
|
46
|
-
}
|
|
16
|
+
const parsed = attemptStorage(() => JSON.parse(defaultPreferenceStorage()?.getItem(storageKey) ?? "null"), null);
|
|
17
|
+
if (!isRecord(parsed)) return defaultThemeSelection;
|
|
18
|
+
const stored = parsed;
|
|
19
|
+
const fonts = normalizeAppearanceEditorFontSettings(stored.fonts, stored.font).settings;
|
|
20
|
+
return {
|
|
21
|
+
appearance: stored.appearance === "light" || stored.appearance === "dark" || stored.appearance === "system" ? stored.appearance : defaultThemeSelection.appearance,
|
|
22
|
+
lightThemeId: storedThemeId(stored.lightThemeId, "light") ?? "adea-light",
|
|
23
|
+
darkThemeId: storedThemeId(stored.darkThemeId, "dark") ?? "adea-dark",
|
|
24
|
+
accent: normalizeAccentSelection(stored.accent) ?? defaultThemeSelection.accent,
|
|
25
|
+
font: fonts.ui.family,
|
|
26
|
+
fonts,
|
|
27
|
+
density: resolvedDensity(stored),
|
|
28
|
+
terminalThemeId: typeof stored.terminalThemeId === "string" && stored.terminalThemeId.trim() !== "" ? stored.terminalThemeId : void 0,
|
|
29
|
+
surface: normalizeSurface(stored.surface),
|
|
30
|
+
reduceTransparency: typeof stored.reduceTransparency === "boolean" ? stored.reduceTransparency : void 0
|
|
31
|
+
};
|
|
47
32
|
}
|
|
48
33
|
/**
|
|
49
34
|
* The default persistence: one JSON document in `localStorage` under `key`.
|
|
50
35
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* provider whose `storageKey` prop changes writes to the
|
|
36
|
+
* Every stored id is validated, and an id is kept even when nothing holds it today
|
|
37
|
+
* (a host's imported theme), exactly as {@link createVersionedPersistence} keeps what
|
|
38
|
+
* its codec decodes: the provider resolves an unknown id, it never rewrites one.
|
|
39
|
+
* `key` may be a function so a provider whose `storageKey` prop changes writes to the
|
|
40
|
+
* key it is now given.
|
|
55
41
|
*
|
|
56
42
|
* Blocked, full or absent storage is survivable in both directions: a read answers
|
|
57
43
|
* with the defaults and a write is dropped, so the preference simply lasts the
|
|
@@ -62,9 +48,8 @@ function localStoragePersistence(key) {
|
|
|
62
48
|
return {
|
|
63
49
|
read: () => readSelection(keyOf()),
|
|
64
50
|
write(next) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} catch {}
|
|
51
|
+
const storage = defaultPreferenceStorage();
|
|
52
|
+
if (storage) writeVersionedRecord(storage, keyOf(), next);
|
|
68
53
|
}
|
|
69
54
|
};
|
|
70
55
|
}
|
|
@@ -77,17 +62,11 @@ function localStoragePersistence(key) {
|
|
|
77
62
|
* blank application.
|
|
78
63
|
*/
|
|
79
64
|
function readPersisted(persistence) {
|
|
80
|
-
|
|
81
|
-
return persistence.read();
|
|
82
|
-
} catch {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
65
|
+
return attemptStorage(() => persistence.read(), void 0);
|
|
85
66
|
}
|
|
86
67
|
/** Hand a selection to the store; a store that throws loses the preference, not the switch. */
|
|
87
68
|
function writePersisted(persistence, next) {
|
|
88
|
-
|
|
89
|
-
persistence.write(next);
|
|
90
|
-
} catch {}
|
|
69
|
+
attemptStorage(() => persistence.write(next), void 0);
|
|
91
70
|
}
|
|
92
71
|
/**
|
|
93
72
|
* A {@link ThemePersistence} over a versioned document and a host codec.
|
|
@@ -110,38 +89,27 @@ function createVersionedPersistence(schema, codec, options = {}) {
|
|
|
110
89
|
recoveryKey: recoveryKeyFor(schema)
|
|
111
90
|
};
|
|
112
91
|
let previous;
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return;
|
|
92
|
+
const readDocument = (storage) => {
|
|
93
|
+
const found = readVersionedRecord(storage, recordSchema, options.now);
|
|
94
|
+
if (found.status === "record") {
|
|
95
|
+
previous = found.record;
|
|
96
|
+
return codec.decode(found.record);
|
|
118
97
|
}
|
|
98
|
+
if (found.status !== "absent" || !schema.legacyAppearanceKey || !codec.fromLegacy) return;
|
|
99
|
+
const legacy = readLegacyValue(storage, schema.legacyAppearanceKey);
|
|
100
|
+
return legacy === null ? void 0 : codec.fromLegacy(legacy);
|
|
119
101
|
};
|
|
120
102
|
return {
|
|
121
103
|
read() {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (!storage) return fallback();
|
|
125
|
-
const found = readVersionedRecord(storage, recordSchema, options.now);
|
|
126
|
-
if (found.status === "record") {
|
|
127
|
-
previous = found.record;
|
|
128
|
-
return codec.decode(found.record);
|
|
129
|
-
}
|
|
130
|
-
if (found.status === "absent" && schema.legacyAppearanceKey && codec.fromLegacy) {
|
|
131
|
-
const legacy = readLegacyValue(storage, schema.legacyAppearanceKey);
|
|
132
|
-
const migrated = legacy === null ? void 0 : codec.fromLegacy(legacy);
|
|
133
|
-
if (migrated) return migrated;
|
|
134
|
-
}
|
|
135
|
-
} catch {}
|
|
136
|
-
return fallback();
|
|
104
|
+
const storage = attemptStorage(storageOf, void 0);
|
|
105
|
+
return (storage ? attemptStorage(() => readDocument(storage), void 0) : void 0) ?? attemptStorage(() => codec.defaults?.(), void 0);
|
|
137
106
|
},
|
|
138
107
|
write(next) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
} catch {}
|
|
108
|
+
const storage = attemptStorage(storageOf, void 0);
|
|
109
|
+
if (!storage) return;
|
|
110
|
+
const unencodable = Symbol();
|
|
111
|
+
const document = attemptStorage(() => codec.encode(next, previous), unencodable);
|
|
112
|
+
if (document !== unencodable && writeVersionedRecord(storage, schema.key, document)) previous = typeof document === "object" && document !== null ? document : void 0;
|
|
145
113
|
}
|
|
146
114
|
};
|
|
147
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-persistence.js","names":[],"sources":["../../../src/components/theme/theme-persistence.ts"],"sourcesContent":["import { normalizeCustomAccent } from '#lib/accent-roles'\nimport { accentPresets } from '#lib/accent-presets'\nimport { normalizeAppearanceEditorFontSettings } from '#lib/appearance-font-settings'\nimport { isThemeAccentId } from '#lib/theme-accents'\nimport {\n catalogueThemeAppearance,\n defaultDarkThemeId,\n defaultLightThemeId,\n} from '#lib/theme-defaults'\nimport { normalizeSurface } from '#lib/theme-surface'\nimport {\n defaultPreferenceStorage,\n readLegacyValue,\n readVersionedRecord,\n recoveryKeyFor,\n writeVersionedRecord,\n type PreferenceStorage,\n} from '#lib/preference-store'\nimport { defaultThemeSelection, resolvedDensity, type ThemeSelection } from './theme-state-core'\n\n/**\n * Where a selection is kept between sessions.\n *\n * The provider never touches storage itself; it asks a `ThemePersistence`. The\n * default is {@link localStoragePersistence}, which is what the provider always did.\n * A host that stores the preference in a different shape, under a versioned\n * envelope, or somewhere that is not `localStorage` supplies its own and the\n * resolution and application rules stay the shared ones.\n *\n * The contract is deliberately narrow, so that an implementation cannot make the\n * provider less safe than it was:\n *\n * - `read` is synchronous and runs once, when the provider is created. It may\n * repair or quarantine what it finds, and it must not throw: the provider\n * treats a throw as \"nothing stored\" and starts from the defaults.\n * - `write` runs only from `setSelection`. Never on mount, never from `preview`,\n * never as a side effect of reading, so the first write to a store is always a\n * user's decision. A throw is swallowed, because a full or blocked store must\n * not break the switch.\n */\nexport type ThemePersistence = {\n read(): Partial<ThemeSelection> | undefined\n write(next: ThemeSelection): void\n}\n\n/**\n * The preference store, or nothing.\n *\n * Only ever called inside a `try`: where storage is blocked — a sandboxed iframe, a\n * privacy mode, a denied site-data permission — merely *reading* the `localStorage`\n * global throws (\"Access is denied\", `SecurityError`), so even the `typeof` guard\n * has to sit inside the `try` rather than in front of it. Without a store the\n * preference lives only in the provider's signal for the session.\n */\nfunction preferenceStore(): Storage | undefined {\n return typeof localStorage === 'undefined' ? undefined : localStorage\n}\n\n/**\n * The stored preference, validated against the catalogue's ids (`theme-defaults`), so\n * reading it never loads the catalogue.\n */\nfunction readSelection(storageKey: string): ThemeSelection {\n try {\n const raw = preferenceStore()?.getItem(storageKey)\n if (!raw) return defaultThemeSelection\n const parsed = JSON.parse(raw) as Partial<ThemeSelection>\n const fonts = normalizeAppearanceEditorFontSettings(parsed.fonts, parsed.font).settings\n return {\n appearance:\n parsed.appearance === 'light' ||\n parsed.appearance === 'dark' ||\n parsed.appearance === 'system'\n ? parsed.appearance\n : defaultThemeSelection.appearance,\n // An unknown id would leave the document with no theme at all, so a stale\n // preference from an older catalogue falls back rather than applying nothing.\n lightThemeId:\n catalogueThemeAppearance(parsed.lightThemeId ?? '') === 'light'\n ? (parsed.lightThemeId as string)\n : defaultLightThemeId,\n darkThemeId:\n catalogueThemeAppearance(parsed.darkThemeId ?? '') === 'dark'\n ? (parsed.darkThemeId as string)\n : defaultDarkThemeId,\n // A theme accent is kept whenever it names a slot, even one the stored pair\n // cannot offer: the id is role-shaped so it survives a theme switch, and an\n // unoffered slot already resolves to the theme's own primary when applied. A\n // custom `#rrggbb` is kept in its one stored spelling; its readability is\n // settled when it is painted, not when it is read.\n accent:\n typeof parsed.accent === 'string' &&\n (accentPresets.some((preset) => preset.id === parsed.accent) ||\n isThemeAccentId(parsed.accent))\n ? parsed.accent\n : (normalizeCustomAccent(parsed.accent) ?? defaultThemeSelection.accent),\n font: fonts.ui.family,\n fonts,\n // Every axis has to be read back here, or it is lost twice: the provider's\n // document effect removes the `data-density` that `themeScript` set for the first paint, and\n // the next `setSelection` rewrites the store without it.\n density: resolvedDensity(parsed as ThemeSelection),\n // The newer axes are read back only when the store holds a usable value and are\n // otherwise left `undefined`, never defaulted: `JSON.stringify` drops them, so a\n // consumer that never sets one writes the bytes it always did. An id is kept as\n // stored, known or not, for the same reason a theme id the registry lacks is.\n terminalThemeId:\n typeof parsed.terminalThemeId === 'string' && parsed.terminalThemeId.trim() !== ''\n ? parsed.terminalThemeId\n : undefined,\n surface: normalizeSurface(parsed.surface),\n reduceTransparency:\n typeof parsed.reduceTransparency === 'boolean' ? parsed.reduceTransparency : undefined,\n }\n } catch {\n return defaultThemeSelection\n }\n}\n\n/**\n * The default persistence: one JSON document in `localStorage` under `key`.\n *\n * `read` is the provider's original `readSelection`, moved here unchanged — every\n * stored id is validated against the catalogue, so a stale preference falls back to\n * a default rather than reaching the document. `key` may be a function so a\n * provider whose `storageKey` prop changes writes to the key it is now given.\n *\n * Blocked, full or absent storage is survivable in both directions: a read answers\n * with the defaults and a write is dropped, so the preference simply lasts the\n * session.\n */\nexport function localStoragePersistence(key: string | (() => string)): ThemePersistence {\n const keyOf = () => (typeof key === 'function' ? key() : key)\n return {\n read: () => readSelection(keyOf()),\n write(next) {\n try {\n preferenceStore()?.setItem(keyOf(), JSON.stringify(next))\n } catch {\n // A full, blocked or unavailable store must not break the switch: the\n // preference simply does not survive the reload.\n }\n },\n }\n}\n\n/**\n * What a persistence knows, or nothing.\n *\n * The seam's `read` must not throw, and the provider does not rely on that: a host\n * persistence is code the design system has not seen, and a theme provider that\n * fails to mount because a store misbehaved has turned a lost preference into a\n * blank application.\n */\nexport function readPersisted(persistence: ThemePersistence): Partial<ThemeSelection> | undefined {\n try {\n return persistence.read()\n } catch {\n return undefined\n }\n}\n\n/** Hand a selection to the store; a store that throws loses the preference, not the switch. */\nexport function writePersisted(persistence: ThemePersistence, next: ThemeSelection): void {\n try {\n persistence.write(next)\n } catch {\n // Same contract as a full or blocked `localStorage`: the choice holds for the\n // session and does not survive the reload.\n }\n}\n\n/**\n * Where a host's versioned preference document lives. One schema describes the\n * document to both halves of the system: {@link createVersionedPersistence} reads and\n * writes it, and `themeScript(options)` reads it before first paint, so the two\n * cannot disagree about a key or a version.\n */\nexport type ThemeStorageSchema = {\n /** The storage key of the document. */\n key: string\n /**\n * The only top-level `version` read. Absent, the document is unversioned. A record\n * of any other version is quarantined (see `recoveryKey`), not interpreted.\n */\n version?: number\n /**\n * The document field that holds the appearance preference (`system`, `light`,\n * `dark`). Read by `themeScript`; the persistence leaves field names to the codec.\n * Default `appearance`.\n */\n appearanceField?: 'appearance' | 'mode'\n /**\n * An older single-value key (`light` | `dark` | `system`) read only while `key` is\n * absent, and never deleted. The persistence hands it to the codec's `fromLegacy`.\n */\n legacyAppearanceKey?: string\n /**\n * The stored library of imported themes, for `themeScript` only: an imported\n * theme's id and verbatim tokens, so the first paint can use the right variant. The\n * persistence neither reads nor writes it.\n */\n libraryKey?: string\n /** Where an unreadable document is kept. Default `${key}.recovery`. */\n recoveryKey?: string\n}\n\n/**\n * How a host's document maps to and from the shared {@link ThemeSelection}.\n *\n * The codec is the product schema: it decides which fields a document has, how an\n * unknown value is corrected, and what a fresh install looks like. The engine decides\n * everything about *storage*: what is quarantined, when the legacy key is read, and\n * that nothing is written until `setSelection` asks.\n */\nexport type VersionedCodec<Doc> = {\n /**\n * A readable record (the right JSON shape and version) as a selection patch. Fields\n * it leaves `undefined` fall back to the provider's defaults. It may keep an id the\n * catalogue lacks; the provider resolves it, it does not rewrite it.\n */\n decode(record: Readonly<Record<string, unknown>>): Partial<ThemeSelection>\n /**\n * The legacy key's value (never `null`) as a selection patch, or `undefined` for a\n * value it does not recognise. Called only when the main key is absent.\n */\n fromLegacy?(value: string): Partial<ThemeSelection> | undefined\n /**\n * What a store with nothing readable answers: a fresh install, an unreadable\n * document, a blocked store. Absent, the provider's own defaults apply.\n */\n defaults?(): Partial<ThemeSelection> | undefined\n /**\n * The document to store for a selection. `previous` is the record last read or\n * written, so a codec can carry a field the selection does not model.\n */\n encode(next: ThemeSelection, previous?: Readonly<Record<string, unknown>>): Doc\n}\n\n/** Seams for the storage and the clock; both default to the real ones. */\nexport type VersionedPersistenceOptions = {\n /** The store, or nothing. Called per access; default is `localStorage` (blocked-safe). */\n storage?: () => PreferenceStorage | undefined\n /** The clock for the recovery envelope's `capturedAt`. */\n now?: () => Date\n}\n\n/**\n * A {@link ThemePersistence} over a versioned document and a host codec.\n *\n * `read` follows the engine's rules (`lib/preference-store.ts`): the main key first;\n * an unreadable or unsupported document is quarantined byte for byte into the\n * recovery key and the codec's `defaults` answer; the legacy key only when the main\n * key is absent. It never writes the main key, so the first write is a user's\n * decision. `write` stores `codec.encode(next, previous)` as JSON and swallows a\n * failure.\n *\n * Neither method throws. The stored bytes are exactly what the codec encodes, so a\n * host keeps its keys, field names and bytes by keeping its codec.\n */\nexport function createVersionedPersistence<Doc>(\n schema: ThemeStorageSchema,\n codec: VersionedCodec<Doc>,\n options: VersionedPersistenceOptions = {}\n): ThemePersistence {\n const storageOf = options.storage ?? defaultPreferenceStorage\n const recordSchema = {\n key: schema.key,\n version: schema.version,\n recoveryKey: recoveryKeyFor(schema),\n }\n let previous: Readonly<Record<string, unknown>> | undefined\n\n const fallback = () => {\n try {\n return codec.defaults?.()\n } catch {\n return undefined\n }\n }\n\n return {\n read() {\n try {\n const storage = storageOf()\n if (!storage) return fallback()\n const found = readVersionedRecord(storage, recordSchema, options.now)\n if (found.status === 'record') {\n previous = found.record\n return codec.decode(found.record)\n }\n if (found.status === 'absent' && schema.legacyAppearanceKey && codec.fromLegacy) {\n const legacy = readLegacyValue(storage, schema.legacyAppearanceKey)\n const migrated = legacy === null ? undefined : codec.fromLegacy(legacy)\n if (migrated) return migrated\n }\n } catch {\n // A codec that throws on a record it cannot read is an unreadable store.\n }\n return fallback()\n },\n write(next) {\n try {\n const storage = storageOf()\n if (!storage) return\n const document = codec.encode(next, previous)\n if (writeVersionedRecord(storage, schema.key, document)) {\n previous =\n typeof document === 'object' && document !== null\n ? (document as Readonly<Record<string, unknown>>)\n : undefined\n }\n } catch {\n // An encoder that throws loses the preference, not the switch.\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsDA,SAAS,kBAAuC;CAC9C,OAAO,OAAO,iBAAiB,cAAc,KAAA,IAAY;AAC3D;;;;;AAMA,SAAS,cAAc,YAAoC;CACzD,IAAI;EACF,MAAM,MAAM,gBAAgB,CAAC,EAAE,QAAQ,UAAU;EACjD,IAAI,CAAC,KAAK,OAAO;EACjB,MAAM,SAAS,KAAK,MAAM,GAAG;EAC7B,MAAM,QAAQ,sCAAsC,OAAO,OAAO,OAAO,IAAI,CAAC,CAAC;EAC/E,OAAO;GACL,YACE,OAAO,eAAe,WACtB,OAAO,eAAe,UACtB,OAAO,eAAe,WAClB,OAAO,aACP,sBAAsB;GAG5B,cACE,yBAAyB,OAAO,gBAAgB,EAAE,MAAM,UACnD,OAAO,eACR;GACN,aACE,yBAAyB,OAAO,eAAe,EAAE,MAAM,SAClD,OAAO,cACR;GAMN,QACE,OAAO,OAAO,WAAW,aACxB,cAAc,MAAM,WAAW,OAAO,OAAO,OAAO,MAAM,KACzD,gBAAgB,OAAO,MAAM,KAC3B,OAAO,SACN,sBAAsB,OAAO,MAAM,KAAK,sBAAsB;GACrE,MAAM,MAAM,GAAG;GACf;GAIA,SAAS,gBAAgB,MAAwB;GAKjD,iBACE,OAAO,OAAO,oBAAoB,YAAY,OAAO,gBAAgB,KAAK,MAAM,KAC5E,OAAO,kBACP,KAAA;GACN,SAAS,iBAAiB,OAAO,OAAO;GACxC,oBACE,OAAO,OAAO,uBAAuB,YAAY,OAAO,qBAAqB,KAAA;EACjF;CACF,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;;;AAcA,SAAgB,wBAAwB,KAAgD;CACtF,MAAM,cAAe,OAAO,QAAQ,aAAa,IAAI,IAAI;CACzD,OAAO;EACL,YAAY,cAAc,MAAM,CAAC;EACjC,MAAM,MAAM;GACV,IAAI;IACF,gBAAgB,CAAC,EAAE,QAAQ,MAAM,GAAG,KAAK,UAAU,IAAI,CAAC;GAC1D,QAAQ,CAGR;EACF;CACF;AACF;;;;;;;;;AAUA,SAAgB,cAAc,aAAoE;CAChG,IAAI;EACF,OAAO,YAAY,KAAK;CAC1B,QAAQ;EACN;CACF;AACF;;AAGA,SAAgB,eAAe,aAA+B,MAA4B;CACxF,IAAI;EACF,YAAY,MAAM,IAAI;CACxB,QAAQ,CAGR;AACF;;;;;;;;;;;;;;AA0FA,SAAgB,2BACd,QACA,OACA,UAAuC,CAAC,GACtB;CAClB,MAAM,YAAY,QAAQ,WAAW;CACrC,MAAM,eAAe;EACnB,KAAK,OAAO;EACZ,SAAS,OAAO;EAChB,aAAa,eAAe,MAAM;CACpC;CACA,IAAI;CAEJ,MAAM,iBAAiB;EACrB,IAAI;GACF,OAAO,MAAM,WAAW;EAC1B,QAAQ;GACN;EACF;CACF;CAEA,OAAO;EACL,OAAO;GACL,IAAI;IACF,MAAM,UAAU,UAAU;IAC1B,IAAI,CAAC,SAAS,OAAO,SAAS;IAC9B,MAAM,QAAQ,oBAAoB,SAAS,cAAc,QAAQ,GAAG;IACpE,IAAI,MAAM,WAAW,UAAU;KAC7B,WAAW,MAAM;KACjB,OAAO,MAAM,OAAO,MAAM,MAAM;IAClC;IACA,IAAI,MAAM,WAAW,YAAY,OAAO,uBAAuB,MAAM,YAAY;KAC/E,MAAM,SAAS,gBAAgB,SAAS,OAAO,mBAAmB;KAClE,MAAM,WAAW,WAAW,OAAO,KAAA,IAAY,MAAM,WAAW,MAAM;KACtE,IAAI,UAAU,OAAO;IACvB;GACF,QAAQ,CAER;GACA,OAAO,SAAS;EAClB;EACA,MAAM,MAAM;GACV,IAAI;IACF,MAAM,UAAU,UAAU;IAC1B,IAAI,CAAC,SAAS;IACd,MAAM,WAAW,MAAM,OAAO,MAAM,QAAQ;IAC5C,IAAI,qBAAqB,SAAS,OAAO,KAAK,QAAQ,GACpD,WACE,OAAO,aAAa,YAAY,aAAa,OACxC,WACD,KAAA;GAEV,QAAQ,CAER;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"theme-persistence.js","names":[],"sources":["../../../src/components/theme/theme-persistence.ts"],"sourcesContent":["import { normalizeAccentSelection } from '#lib/accent-roles'\nimport { normalizeAppearanceEditorFontSettings } from '#lib/appearance-font-settings'\nimport { defaultDarkThemeId, defaultLightThemeId, storedThemeId } from '#lib/theme-defaults'\nimport { normalizeSurface } from '#lib/theme-surface'\nimport {\n attemptStorage,\n defaultPreferenceStorage,\n readLegacyValue,\n readVersionedRecord,\n recoveryKeyFor,\n writeVersionedRecord,\n type PreferenceStorage,\n} from '#lib/preference-store'\nimport { defaultThemeSelection, resolvedDensity, type ThemeSelection } from './theme-state'\n\n/**\n * Where a selection is kept between sessions.\n *\n * The provider never touches storage itself; it asks a `ThemePersistence`. The\n * default is {@link localStoragePersistence}, which is what the provider always did.\n * A host that stores the preference in a different shape, under a versioned\n * envelope, or somewhere that is not `localStorage` supplies its own and the\n * resolution and application rules stay the shared ones.\n *\n * The contract is deliberately narrow, so that an implementation cannot make the\n * provider less safe than it was:\n *\n * - `read` is synchronous and runs once, when the provider is created. It may\n * repair or quarantine what it finds, and it must not throw: the provider\n * treats a throw as \"nothing stored\" and starts from the defaults.\n * - `write` runs only from `setSelection`. Never on mount, never from `preview`,\n * never as a side effect of reading, so the first write to a store is always a\n * user's decision. A throw is swallowed, because a full or blocked store must\n * not break the switch.\n */\nexport type ThemePersistence = {\n read(): Partial<ThemeSelection> | undefined\n write(next: ThemeSelection): void\n}\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * The stored preference, validated against the policy in `lib/theme-defaults` and\n * `lib/accent-roles`, so reading it never loads the catalogue.\n */\nfunction readSelection(storageKey: string): ThemeSelection {\n const parsed = attemptStorage<unknown>(\n () => JSON.parse(defaultPreferenceStorage()?.getItem(storageKey) ?? 'null'),\n null\n )\n if (!isRecord(parsed)) return defaultThemeSelection\n const stored = parsed as Partial<Record<keyof ThemeSelection, unknown>>\n const fonts = normalizeAppearanceEditorFontSettings(stored.fonts, stored.font).settings\n return {\n appearance:\n stored.appearance === 'light' ||\n stored.appearance === 'dark' ||\n stored.appearance === 'system'\n ? stored.appearance\n : defaultThemeSelection.appearance,\n lightThemeId: storedThemeId(stored.lightThemeId, 'light') ?? defaultLightThemeId,\n darkThemeId: storedThemeId(stored.darkThemeId, 'dark') ?? defaultDarkThemeId,\n accent: normalizeAccentSelection(stored.accent) ?? defaultThemeSelection.accent,\n font: fonts.ui.family,\n fonts,\n // Every axis has to be read back here, or it is lost twice: the provider's\n // document effect removes the `data-density` that `themeScript` set for the first\n // paint, and the next `setSelection` rewrites the store without it.\n density: resolvedDensity(stored as ThemeSelection),\n // The newer axes are read back only when the store holds a usable value and are\n // otherwise left `undefined`, never defaulted: `JSON.stringify` drops them, so a\n // consumer that never sets one writes the bytes it always did.\n terminalThemeId:\n typeof stored.terminalThemeId === 'string' && stored.terminalThemeId.trim() !== ''\n ? stored.terminalThemeId\n : undefined,\n surface: normalizeSurface(stored.surface),\n reduceTransparency:\n typeof stored.reduceTransparency === 'boolean' ? stored.reduceTransparency : undefined,\n }\n}\n\n/**\n * The default persistence: one JSON document in `localStorage` under `key`.\n *\n * Every stored id is validated, and an id is kept even when nothing holds it today\n * (a host's imported theme), exactly as {@link createVersionedPersistence} keeps what\n * its codec decodes: the provider resolves an unknown id, it never rewrites one.\n * `key` may be a function so a provider whose `storageKey` prop changes writes to the\n * key it is now given.\n *\n * Blocked, full or absent storage is survivable in both directions: a read answers\n * with the defaults and a write is dropped, so the preference simply lasts the\n * session.\n */\nexport function localStoragePersistence(key: string | (() => string)): ThemePersistence {\n const keyOf = () => (typeof key === 'function' ? key() : key)\n return {\n read: () => readSelection(keyOf()),\n write(next) {\n const storage = defaultPreferenceStorage()\n if (storage) writeVersionedRecord(storage, keyOf(), next)\n },\n }\n}\n\n/**\n * What a persistence knows, or nothing.\n *\n * The seam's `read` must not throw, and the provider does not rely on that: a host\n * persistence is code the design system has not seen, and a theme provider that\n * fails to mount because a store misbehaved has turned a lost preference into a\n * blank application.\n */\nexport function readPersisted(persistence: ThemePersistence): Partial<ThemeSelection> | undefined {\n return attemptStorage(() => persistence.read(), undefined)\n}\n\n/** Hand a selection to the store; a store that throws loses the preference, not the switch. */\nexport function writePersisted(persistence: ThemePersistence, next: ThemeSelection): void {\n attemptStorage(() => persistence.write(next), undefined)\n}\n\n/**\n * Where a host's versioned preference document lives. One schema describes the\n * document to both halves of the system: {@link createVersionedPersistence} reads and\n * writes it, and `themeScript(options)` reads it before first paint, so the two\n * cannot disagree about a key or a version.\n */\nexport type ThemeStorageSchema = {\n /** The storage key of the document. */\n key: string\n /**\n * The only top-level `version` read. Absent, the document is unversioned. A record\n * of any other version is quarantined (see `recoveryKey`), not interpreted.\n */\n version?: number\n /**\n * The document field that holds the appearance preference (`system`, `light`,\n * `dark`). Read by `themeScript`; the persistence leaves field names to the codec.\n * Default `appearance`.\n */\n appearanceField?: 'appearance' | 'mode'\n /**\n * An older single-value key (`light` | `dark` | `system`) read only while `key` is\n * absent, and never deleted. The persistence hands it to the codec's `fromLegacy`.\n */\n legacyAppearanceKey?: string\n /**\n * The stored library of imported themes, for `themeScript` only: an imported\n * theme's id and verbatim tokens, so the first paint can use the right variant. The\n * persistence neither reads nor writes it.\n */\n libraryKey?: string\n /** Where an unreadable document is kept. Default `${key}.recovery`. */\n recoveryKey?: string\n}\n\n/**\n * How a host's document maps to and from the shared {@link ThemeSelection}.\n *\n * The codec is the product schema: it decides which fields a document has, how an\n * unknown value is corrected, and what a fresh install looks like. The engine decides\n * everything about *storage*: what is quarantined, when the legacy key is read, and\n * that nothing is written until `setSelection` asks.\n */\nexport type VersionedCodec<Doc> = {\n /**\n * A readable record (the right JSON shape and version) as a selection patch. Fields\n * it leaves `undefined` fall back to the provider's defaults. It may keep an id the\n * catalogue lacks; the provider resolves it, it does not rewrite it.\n */\n decode(record: Readonly<Record<string, unknown>>): Partial<ThemeSelection>\n /**\n * The legacy key's value (never `null`) as a selection patch, or `undefined` for a\n * value it does not recognise. Called only when the main key is absent.\n */\n fromLegacy?(value: string): Partial<ThemeSelection> | undefined\n /**\n * What a store with nothing readable answers: a fresh install, an unreadable\n * document, a blocked store. Absent, the provider's own defaults apply.\n */\n defaults?(): Partial<ThemeSelection> | undefined\n /**\n * The document to store for a selection. `previous` is the record last read or\n * written, so a codec can carry a field the selection does not model.\n */\n encode(next: ThemeSelection, previous?: Readonly<Record<string, unknown>>): Doc\n}\n\n/** Seams for the storage and the clock; both default to the real ones. */\nexport type VersionedPersistenceOptions = {\n /** The store, or nothing. Called per access; default is `localStorage` (blocked-safe). */\n storage?: () => PreferenceStorage | undefined\n /** The clock for the recovery envelope's `capturedAt`. */\n now?: () => Date\n}\n\n/**\n * A {@link ThemePersistence} over a versioned document and a host codec.\n *\n * `read` follows the engine's rules (`lib/preference-store.ts`): the main key first;\n * an unreadable or unsupported document is quarantined byte for byte into the\n * recovery key and the codec's `defaults` answer; the legacy key only when the main\n * key is absent. It never writes the main key, so the first write is a user's\n * decision. `write` stores `codec.encode(next, previous)` as JSON and swallows a\n * failure.\n *\n * Neither method throws. The stored bytes are exactly what the codec encodes, so a\n * host keeps its keys, field names and bytes by keeping its codec.\n */\nexport function createVersionedPersistence<Doc>(\n schema: ThemeStorageSchema,\n codec: VersionedCodec<Doc>,\n options: VersionedPersistenceOptions = {}\n): ThemePersistence {\n const storageOf = options.storage ?? defaultPreferenceStorage\n const recordSchema = {\n key: schema.key,\n version: schema.version,\n recoveryKey: recoveryKeyFor(schema),\n }\n let previous: Readonly<Record<string, unknown>> | undefined\n\n const readDocument = (storage: PreferenceStorage): Partial<ThemeSelection> | undefined => {\n const found = readVersionedRecord(storage, recordSchema, options.now)\n if (found.status === 'record') {\n previous = found.record\n return codec.decode(found.record)\n }\n if (found.status !== 'absent' || !schema.legacyAppearanceKey || !codec.fromLegacy) return\n const legacy = readLegacyValue(storage, schema.legacyAppearanceKey)\n return legacy === null ? undefined : codec.fromLegacy(legacy)\n }\n\n return {\n read() {\n const storage = attemptStorage(storageOf, undefined)\n // A codec that throws on a record it cannot read is an unreadable store.\n const found = storage ? attemptStorage(() => readDocument(storage), undefined) : undefined\n return found ?? attemptStorage(() => codec.defaults?.(), undefined)\n },\n write(next) {\n const storage = attemptStorage(storageOf, undefined)\n if (!storage) return\n const unencodable = Symbol()\n const document = attemptStorage<Doc | typeof unencodable>(\n () => codec.encode(next, previous),\n unencodable\n )\n if (document !== unencodable && writeVersionedRecord(storage, schema.key, document)) {\n previous =\n typeof document === 'object' && document !== null\n ? (document as Readonly<Record<string, unknown>>)\n : undefined\n }\n },\n }\n}\n"],"mappings":";;;;;;;AAwCA,SAAS,SAAS,OAA4D;CAC5E,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;AAMA,SAAS,cAAc,YAAoC;CACzD,MAAM,SAAS,qBACP,KAAK,MAAM,yBAAyB,CAAC,EAAE,QAAQ,UAAU,KAAK,MAAM,GAC1E,IACF;CACA,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO;CAC9B,MAAM,SAAS;CACf,MAAM,QAAQ,sCAAsC,OAAO,OAAO,OAAO,IAAI,CAAC,CAAC;CAC/E,OAAO;EACL,YACE,OAAO,eAAe,WACtB,OAAO,eAAe,UACtB,OAAO,eAAe,WAClB,OAAO,aACP,sBAAsB;EAC5B,cAAc,cAAc,OAAO,cAAc,OAAO,KAAA;EACxD,aAAa,cAAc,OAAO,aAAa,MAAM,KAAA;EACrD,QAAQ,yBAAyB,OAAO,MAAM,KAAK,sBAAsB;EACzE,MAAM,MAAM,GAAG;EACf;EAIA,SAAS,gBAAgB,MAAwB;EAIjD,iBACE,OAAO,OAAO,oBAAoB,YAAY,OAAO,gBAAgB,KAAK,MAAM,KAC5E,OAAO,kBACP,KAAA;EACN,SAAS,iBAAiB,OAAO,OAAO;EACxC,oBACE,OAAO,OAAO,uBAAuB,YAAY,OAAO,qBAAqB,KAAA;CACjF;AACF;;;;;;;;;;;;;;AAeA,SAAgB,wBAAwB,KAAgD;CACtF,MAAM,cAAe,OAAO,QAAQ,aAAa,IAAI,IAAI;CACzD,OAAO;EACL,YAAY,cAAc,MAAM,CAAC;EACjC,MAAM,MAAM;GACV,MAAM,UAAU,yBAAyB;GACzC,IAAI,SAAS,qBAAqB,SAAS,MAAM,GAAG,IAAI;EAC1D;CACF;AACF;;;;;;;;;AAUA,SAAgB,cAAc,aAAoE;CAChG,OAAO,qBAAqB,YAAY,KAAK,GAAG,KAAA,CAAS;AAC3D;;AAGA,SAAgB,eAAe,aAA+B,MAA4B;CACxF,qBAAqB,YAAY,MAAM,IAAI,GAAG,KAAA,CAAS;AACzD;;;;;;;;;;;;;;AA0FA,SAAgB,2BACd,QACA,OACA,UAAuC,CAAC,GACtB;CAClB,MAAM,YAAY,QAAQ,WAAW;CACrC,MAAM,eAAe;EACnB,KAAK,OAAO;EACZ,SAAS,OAAO;EAChB,aAAa,eAAe,MAAM;CACpC;CACA,IAAI;CAEJ,MAAM,gBAAgB,YAAoE;EACxF,MAAM,QAAQ,oBAAoB,SAAS,cAAc,QAAQ,GAAG;EACpE,IAAI,MAAM,WAAW,UAAU;GAC7B,WAAW,MAAM;GACjB,OAAO,MAAM,OAAO,MAAM,MAAM;EAClC;EACA,IAAI,MAAM,WAAW,YAAY,CAAC,OAAO,uBAAuB,CAAC,MAAM,YAAY;EACnF,MAAM,SAAS,gBAAgB,SAAS,OAAO,mBAAmB;EAClE,OAAO,WAAW,OAAO,KAAA,IAAY,MAAM,WAAW,MAAM;CAC9D;CAEA,OAAO;EACL,OAAO;GACL,MAAM,UAAU,eAAe,WAAW,KAAA,CAAS;GAGnD,QADc,UAAU,qBAAqB,aAAa,OAAO,GAAG,KAAA,CAAS,IAAI,KAAA,MACjE,qBAAqB,MAAM,WAAW,GAAG,KAAA,CAAS;EACpE;EACA,MAAM,MAAM;GACV,MAAM,UAAU,eAAe,WAAW,KAAA,CAAS;GACnD,IAAI,CAAC,SAAS;GACd,MAAM,cAAc,OAAO;GAC3B,MAAM,WAAW,qBACT,MAAM,OAAO,MAAM,QAAQ,GACjC,WACF;GACA,IAAI,aAAa,eAAe,qBAAqB,SAAS,OAAO,KAAK,QAAQ,GAChF,WACE,OAAO,aAAa,YAAY,aAAa,OACxC,WACD,KAAA;EAEV;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-picker.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"theme-picker.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG;IACtD,KAAK,EAAE,YAAY,CAAA;IACnB,yCAAyC;IACzC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAQD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kCAgClD;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACtD,KAAK,EAAE,YAAY,CAAA;IACnB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,kCAyCpD;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACrD,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CAC7C,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kCAwClD"}
|