@cueplusplus/ui 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +825 -0
- package/README.md +1 -1
- package/dist/agent-runtime/tool-call-card.js +7 -3
- package/dist/brand/_chassis.d.ts +1 -1
- package/dist/brand/cue-mark.d.ts +1 -1
- package/dist/brand/cue-mark.js +1 -1
- package/dist/charts/ramps.js +1 -1
- package/dist/chat/agent-pile.js +2 -1
- package/dist/chat/ask-box.js +4 -3
- package/dist/chat/delegation-card.js +3 -2
- package/dist/chat/message-list.js +3 -2
- package/dist/chat/message.js +17 -7
- package/dist/chrome/_edge-scroller.js +2 -1
- package/dist/chrome/_status-bar.js +9 -3
- package/dist/chrome/_tabs-scroll.d.ts +1 -1
- package/dist/chrome/_tabs-scroll.js +1 -1
- package/dist/chrome/app-bar.js +9 -3
- package/dist/chrome/app-shell.js +2 -1
- package/dist/chrome/band.d.ts +18 -12
- package/dist/chrome/band.js +18 -32
- package/dist/chrome/eyebrow.d.ts +13 -5
- package/dist/chrome/eyebrow.js +18 -7
- package/dist/chrome/footer.d.ts +5 -0
- package/dist/chrome/footer.js +14 -3
- package/dist/chrome/navigation-menu.js +4 -2
- package/dist/chrome/page-shell.js +8 -5
- package/dist/chrome/panel.d.ts +5 -2
- package/dist/chrome/panel.js +8 -4
- package/dist/chrome/row.js +6 -3
- package/dist/chrome/scroll-area.js +2 -1
- package/dist/chrome/section-header.js +13 -4
- package/dist/chrome/segmented-control.js +12 -3
- package/dist/chrome/status-bar.js +2 -1
- package/dist/chrome/tabs.js +11 -3
- package/dist/chrome/toolbar.js +2 -1
- package/dist/chrome/tree.js +3 -2
- package/dist/color/_thumb.js +9 -3
- package/dist/color/color-area.js +1 -1
- package/dist/color/color-swatch.js +1 -1
- package/dist/configurator/_overrides.js +13 -4
- package/dist/configurator/configurator.js +4 -1
- package/dist/configurator/export-dialog.js +5 -2
- package/dist/configurator/panel-sections.js +6 -2
- package/dist/configurator/token-editor.js +4 -1
- package/dist/date/calendar.js +12 -8
- package/dist/dmx/channel-matrix.js +3 -2
- package/dist/dmx/dmx-bar.js +1 -1
- package/dist/dmx/dmx-strip.js +1 -1
- package/dist/dmx/universe-grid.js +3 -2
- package/dist/elements/activity-graph.js +3 -3
- package/dist/elements/agent-card.js +3 -3
- package/dist/elements/approval-card.js +3 -3
- package/dist/elements/artifact-card.js +2 -2
- package/dist/elements/background-inbox.js +2 -2
- package/dist/elements/canvas-split.js +2 -2
- package/dist/elements/chart.js +1 -1
- package/dist/elements/chat-panel.js +2 -2
- package/dist/elements/checkpoint-history.js +2 -2
- package/dist/elements/clamp.js +2 -1
- package/dist/elements/code-diff.js +1 -1
- package/dist/elements/code-runner.js +1 -1
- package/dist/elements/command-palette.js +6 -5
- package/dist/elements/comparison-card.js +2 -2
- package/dist/elements/composer.js +9 -8
- package/dist/elements/computer-use.js +1 -1
- package/dist/elements/confidence-marker.js +2 -1
- package/dist/elements/connection-state.js +1 -1
- package/dist/elements/context-breakdown.js +1 -1
- package/dist/elements/context-usage.js +1 -1
- package/dist/elements/conversation-search.js +4 -3
- package/dist/elements/cost-meter.js +1 -1
- package/dist/elements/data-table.js +2 -2
- package/dist/elements/day-separator.js +1 -1
- package/dist/elements/diagram.js +1 -1
- package/dist/elements/document-reference.js +3 -3
- package/dist/elements/draft-restore.js +1 -1
- package/dist/elements/edit-message.js +4 -3
- package/dist/elements/elements.css +26 -5
- package/dist/elements/elicitation-form.js +3 -3
- package/dist/elements/empty-state.js +2 -1
- package/dist/elements/error-state.js +1 -1
- package/dist/elements/feedback-dialog.js +4 -3
- package/dist/elements/file-tree.js +2 -2
- package/dist/elements/flow-graph.js +2 -2
- package/dist/elements/guardrail-notice.js +3 -3
- package/dist/elements/image-generation.js +1 -1
- package/dist/elements/inline-citation.js +3 -3
- package/dist/elements/job-progress.js +3 -3
- package/dist/elements/launcher-bubble.js +2 -2
- package/dist/elements/loading-state.js +1 -1
- package/dist/elements/map-answer.js +3 -2
- package/dist/elements/markdown.js +5 -4
- package/dist/elements/math-block.js +1 -1
- package/dist/elements/mcp-server-panel.js +3 -3
- package/dist/elements/message-attachment.js +4 -4
- package/dist/elements/message-pair.js +1 -1
- package/dist/elements/message-queue.js +2 -2
- package/dist/elements/mobile-composer.js +4 -3
- package/dist/elements/model-picker.js +3 -3
- package/dist/elements/onboarding.js +2 -2
- package/dist/elements/permission-grant.js +2 -2
- package/dist/elements/permission-scopes.js +5 -4
- package/dist/elements/prompt-library.js +7 -6
- package/dist/elements/queue-dock.js +4 -3
- package/dist/elements/quota-banner.js +1 -1
- package/dist/elements/quote-reply.js +1 -1
- package/dist/elements/read-aloud.js +2 -2
- package/dist/elements/reasoning-panel.js +2 -1
- package/dist/elements/recommendation-card.d.ts +1 -1
- package/dist/elements/recommendation-card.js +2 -2
- package/dist/elements/regenerate-menu.js +2 -2
- package/dist/elements/research-report.js +1 -1
- package/dist/elements/retrieval-chunks.js +1 -1
- package/dist/elements/revert-dock.js +5 -4
- package/dist/elements/reviewable-diff.js +1 -1
- package/dist/elements/schedule-card.js +3 -3
- package/dist/elements/score-breakdown.js +1 -1
- package/dist/elements/scroll-anchor.js +2 -2
- package/dist/elements/settings-panel.js +3 -2
- package/dist/elements/shared-conversation.js +2 -2
- package/dist/elements/sources.js +4 -3
- package/dist/elements/speaker-identity.js +1 -1
- package/dist/elements/spec-sheet.js +1 -1
- package/dist/elements/streaming-text.js +1 -1
- package/dist/elements/subagent-list.js +2 -2
- package/dist/elements/suggestions.js +1 -1
- package/dist/elements/surfaces.d.ts +1 -1
- package/dist/elements/surfaces.js +2 -1
- package/dist/elements/tail-status.js +1 -1
- package/dist/elements/terminal-block.js +1 -1
- package/dist/elements/thread-list.js +1 -1
- package/dist/elements/thread-search.js +5 -4
- package/dist/elements/timeline.js +1 -1
- package/dist/elements/todo-list.js +2 -2
- package/dist/elements/tool-call.js +4 -3
- package/dist/elements/tool-error.js +2 -2
- package/dist/elements/tool-group.js +1 -1
- package/dist/elements/tool-timeline.js +4 -3
- package/dist/elements/trace-waterfall.js +1 -1
- package/dist/elements/verdict-row.js +2 -2
- package/dist/elements/voice-conversation.js +3 -2
- package/dist/elements/web-preview.js +1 -1
- package/dist/elements/web-search.js +2 -2
- package/dist/elements/work-collapse.js +2 -1
- package/dist/flow/node-card.js +3 -2
- package/dist/flow/use-flow-theme.js +2 -1
- package/dist/forms/_chassis.d.ts +26 -6
- package/dist/forms/_chassis.js +33 -8
- package/dist/forms/_listbox.js +8 -5
- package/dist/forms/checkbox.js +8 -2
- package/dist/forms/env-var-input.js +3 -2
- package/dist/forms/field.d.ts +2 -1
- package/dist/forms/field.js +15 -4
- package/dist/forms/file-upload.js +3 -2
- package/dist/forms/number-field.js +2 -1
- package/dist/forms/password-input.js +4 -2
- package/dist/forms/radio-group.js +6 -2
- package/dist/forms/rating.js +2 -1
- package/dist/forms/scrub-input.js +2 -1
- package/dist/forms/search-input.js +2 -1
- package/dist/forms/select.js +5 -2
- package/dist/forms/slider.js +6 -2
- package/dist/forms/switch.js +6 -2
- package/dist/forms/textarea.js +2 -1
- package/dist/forms/toggle.js +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/instruments/_data-row.js +2 -1
- package/dist/instruments/app-window-frame.js +1 -1
- package/dist/instruments/code-block.js +8 -2
- package/dist/instruments/group-bar.js +1 -1
- package/dist/instruments/ledger.js +6 -2
- package/dist/instruments/log-viewer.js +4 -3
- package/dist/instruments/progress.js +5 -2
- package/dist/instruments/seam-grid.js +5 -3
- package/dist/instruments/stat.js +10 -3
- package/dist/instruments/table.js +28 -10
- package/dist/instruments/terminal-frame.js +4 -2
- package/dist/instruments/usage-chart.js +1 -1
- package/dist/layout/_collapse.js +6 -1
- package/dist/layout/bento.js +7 -4
- package/dist/layout/breadcrumb.js +7 -3
- package/dist/layout/card.js +12 -6
- package/dist/layout/carousel.js +3 -2
- package/dist/layout/collapsible.js +5 -1
- package/dist/layout/container.js +2 -1
- package/dist/layout/description-list.js +4 -1
- package/dist/layout/frames.js +11 -5
- package/dist/layout/item.js +3 -2
- package/dist/layout/link.d.ts +16 -0
- package/dist/layout/link.js +22 -3
- package/dist/layout/pagination.js +2 -1
- package/dist/layout/preview.d.ts +32 -12
- package/dist/layout/preview.js +149 -40
- package/dist/layout/resizable.js +2 -1
- package/dist/layout/sidebar.js +11 -3
- package/dist/layout/stepper.js +6 -2
- package/dist/lib/cn.js +29 -2
- package/dist/midi/piano-keyboard.js +3 -2
- package/dist/midi/spectrum-visualizer.js +1 -1
- package/dist/midi/threshold-rail.js +2 -1
- package/dist/midi/timeline-ruler.js +1 -1
- package/dist/overlays/_surface.d.ts +72 -12
- package/dist/overlays/_surface.js +84 -12
- package/dist/overlays/command-palette.js +9 -5
- package/dist/overlays/dialog.d.ts +5 -0
- package/dist/overlays/dialog.js +6 -1
- package/dist/overlays/info-tip.js +2 -1
- package/dist/overlays/menubar.js +3 -1
- package/dist/overlays/popover.js +2 -1
- package/dist/overlays/toast.js +6 -2
- package/dist/overlays/tooltip.js +4 -1
- package/dist/primitives/button.d.ts +15 -0
- package/dist/primitives/button.js +40 -11
- package/dist/primitives/chip.d.ts +19 -1
- package/dist/primitives/chip.js +39 -17
- package/dist/primitives/kbd.d.ts +6 -0
- package/dist/primitives/kbd.js +10 -1
- package/dist/primitives/skeleton.js +1 -1
- package/dist/system/_focus-ring-field.js +29 -0
- package/dist/system/_focus-ring.js +125 -0
- package/dist/system/_paint-glow.js +22 -3
- package/dist/system/_paint-rest-shade.js +32 -0
- package/dist/system/_paint-rim.js +22 -4
- package/dist/system/_paint-stroke-surface-1.js +1 -1
- package/dist/system/_paint-stroke-surface-2.js +14 -1
- package/dist/system/_paint-texture.js +5 -2
- package/dist/system/_style-app-bar.js +65 -0
- package/dist/system/_style-band.js +57 -0
- package/dist/system/_style-body-leading.js +21 -0
- package/dist/system/_style-body-size.js +30 -0
- package/dist/system/_style-body-weight.js +24 -0
- package/dist/system/_style-body.js +27 -0
- package/dist/system/_style-caption.js +19 -0
- package/dist/system/_style-card-pad.js +43 -0
- package/dist/system/_style-check.js +33 -0
- package/dist/system/_style-chip.js +103 -0
- package/dist/system/_style-code.js +13 -0
- package/dist/system/_style-collapse.js +14 -0
- package/dist/system/_style-control-face.js +29 -0
- package/dist/system/_style-control-label.js +22 -0
- package/dist/system/_style-control-step.js +22 -0
- package/dist/system/_style-control.js +76 -0
- package/dist/system/_style-data-face.js +28 -0
- package/dist/system/_style-description.js +23 -0
- package/dist/system/_style-eyebrow.js +43 -0
- package/dist/system/_style-footer-rule.js +47 -0
- package/dist/system/_style-gutter.js +17 -0
- package/dist/system/_style-help-ink.js +14 -0
- package/dist/system/_style-help.js +29 -0
- package/dist/system/_style-input-face.js +34 -0
- package/dist/system/_style-kbd.js +46 -0
- package/dist/system/_style-label-case.js +36 -0
- package/dist/system/_style-label-face.js +32 -0
- package/dist/system/_style-label-ink.js +29 -0
- package/dist/system/_style-label-leading.js +14 -0
- package/dist/system/_style-label-size.js +36 -0
- package/dist/system/_style-label-tracking.js +45 -0
- package/dist/system/_style-label-weight.js +40 -0
- package/dist/system/_style-lede.js +49 -0
- package/dist/system/_style-link.js +46 -0
- package/dist/system/_style-menu.js +30 -0
- package/dist/system/_style-nav-item.js +41 -0
- package/dist/system/_style-nav-voice.js +43 -0
- package/dist/system/_style-option.js +42 -0
- package/dist/system/_style-overlay-title.js +35 -0
- package/dist/system/_style-page-title.js +48 -0
- package/dist/system/_style-popover-pad.js +13 -0
- package/dist/system/_style-quiet-ink.js +13 -0
- package/dist/system/_style-row-pad.js +13 -0
- package/dist/system/_style-seam.js +43 -0
- package/dist/system/_style-section-rule.js +26 -0
- package/dist/system/_style-segment.js +30 -0
- package/dist/system/_style-segmented-control.js +86 -0
- package/dist/system/_style-selected.js +36 -0
- package/dist/system/_style-stage-marks.js +26 -0
- package/dist/system/_style-tab.js +71 -0
- package/dist/system/_style-textarea.js +21 -0
- package/dist/system/_style-title.js +37 -0
- package/dist/system/_style-tooltip.js +17 -0
- package/dist/system/density.d.ts +15 -5
- package/dist/system/density.js +188 -25
- package/dist/system/index.d.ts +2 -2
- package/dist/system/index.js +2 -2
- package/dist/system/overrides.d.ts +1 -0
- package/dist/system/overrides.js +151 -3
- package/dist/system/portal.d.ts +3 -2
- package/dist/system/portal.js +22 -10
- package/dist/system/prepaint.d.ts +21 -5
- package/dist/system/prepaint.js +3 -1
- package/dist/system/published.d.ts +1 -0
- package/dist/system/published.js +131 -0
- package/dist/system/theme-provider.d.ts +118 -21
- package/dist/system/theme-provider.js +362 -73
- package/dist/system/theme-registry.d.ts +2 -1
- package/dist/system/theme-registry.js +27 -10
- package/dist/system/use-density.js +4 -3
- package/dist/system/use-theme.d.ts +5 -2
- package/dist/system/use-theme.js +7 -4
- package/dist/system/vocabulary.js +2 -2
- package/dist/theming/create-theme.js +12 -6
- package/dist/theming/serialize.d.ts +34 -2
- package/dist/theming/serialize.js +86 -4
- package/manifest/components/accordion.json +7 -1
- package/manifest/components/agent-pile.json +3 -0
- package/manifest/components/alert-dialog.json +29 -3
- package/manifest/components/app-bar.json +19 -2
- package/manifest/components/app-shell.json +5 -0
- package/manifest/components/ask-box.json +3 -1
- package/manifest/components/autocomplete.json +38 -1
- package/manifest/components/band.json +7 -3
- package/manifest/components/bento.json +12 -1
- package/manifest/components/breadcrumb.json +8 -1
- package/manifest/components/button.json +27 -3
- package/manifest/components/calendar.json +7 -0
- package/manifest/components/card.json +22 -1
- package/manifest/components/carousel.json +4 -1
- package/manifest/components/channel-matrix.json +31 -3
- package/manifest/components/chart-tooltip-content.json +29 -3
- package/manifest/components/chat-empty-state.json +3 -1
- package/manifest/components/checkbox-group.json +14 -0
- package/manifest/components/checkbox.json +14 -0
- package/manifest/components/chip.json +16 -1
- package/manifest/components/clamp.json +3 -1
- package/manifest/components/code-block.json +10 -1
- package/manifest/components/collapsible.json +13 -2
- package/manifest/components/color-area.json +4 -2
- package/manifest/components/color-field.json +10 -0
- package/manifest/components/color-picker.json +10 -0
- package/manifest/components/color-slider.json +3 -1
- package/manifest/components/colors-section.json +9 -1
- package/manifest/components/combobox.json +38 -1
- package/manifest/components/command-palette.json +28 -3
- package/manifest/components/composer-actions.json +3 -0
- package/manifest/components/composer-attach-button.json +3 -0
- package/manifest/components/composer-attachment-chip.json +3 -0
- package/manifest/components/composer-attachments.json +3 -0
- package/manifest/components/composer-bar.json +3 -0
- package/manifest/components/composer-command-item.json +3 -0
- package/manifest/components/composer-context.json +3 -0
- package/manifest/components/composer-input.json +3 -0
- package/manifest/components/composer-menu-item.json +3 -0
- package/manifest/components/composer-menu.json +3 -0
- package/manifest/components/composer-model-item.json +3 -0
- package/manifest/components/composer-model-trigger.json +3 -0
- package/manifest/components/composer-person-item.json +3 -0
- package/manifest/components/composer-send.json +3 -0
- package/manifest/components/composer-toolbar.json +3 -0
- package/manifest/components/composer-voice-button.json +3 -0
- package/manifest/components/composer-voice.json +3 -0
- package/manifest/components/composer.json +10 -0
- package/manifest/components/confidence-marker.json +3 -1
- package/manifest/components/container.json +2 -1
- package/manifest/components/context-menu.json +29 -3
- package/manifest/components/conversation-search.json +3 -1
- package/manifest/components/cue-mark.json +2 -2
- package/manifest/components/cue-portal-frame.json +1 -1
- package/manifest/components/data-row.json +3 -1
- package/manifest/components/data-tree.json +3 -1
- package/manifest/components/date-field.json +10 -0
- package/manifest/components/date-picker.json +10 -0
- package/manifest/components/date-range-picker.json +10 -0
- package/manifest/components/delegation-card.json +3 -1
- package/manifest/components/density.json +15 -7
- package/manifest/components/description-list.json +6 -1
- package/manifest/components/dialog.json +30 -3
- package/manifest/components/disclosure.json +13 -2
- package/manifest/components/dmx-bar.json +28 -3
- package/manifest/components/dmx-strip.json +28 -3
- package/manifest/components/drawer.json +29 -3
- package/manifest/components/dropdown-menu.json +29 -3
- package/manifest/components/edit-message.json +3 -1
- package/manifest/components/elements-command-palette.json +3 -1
- package/manifest/components/elements-composer.json +3 -0
- package/manifest/components/empty-state-composer.json +3 -1
- package/manifest/components/empty-state-greeting.json +3 -1
- package/manifest/components/empty-state-suggestion.json +3 -1
- package/manifest/components/empty-state-suggestions.json +3 -1
- package/manifest/components/env-var-input.json +10 -1
- package/manifest/components/export-dialog.json +6 -1
- package/manifest/components/eyebrow.json +13 -2
- package/manifest/components/feedback-dialog.json +3 -0
- package/manifest/components/field-description.json +14 -0
- package/manifest/components/field-error.json +14 -0
- package/manifest/components/field-label.json +15 -1
- package/manifest/components/field.json +14 -0
- package/manifest/components/file-upload.json +3 -0
- package/manifest/components/footer.json +14 -1
- package/manifest/components/frames.json +14 -1
- package/manifest/components/hover-card.json +29 -3
- package/manifest/components/info-tip.json +3 -0
- package/manifest/components/input-group.json +10 -0
- package/manifest/components/input.json +10 -0
- package/manifest/components/item.json +3 -1
- package/manifest/components/kbd.json +10 -1
- package/manifest/components/ledger.json +9 -2
- package/manifest/components/link.json +10 -0
- package/manifest/components/log-viewer.json +3 -0
- package/manifest/components/map-answer.json +3 -1
- package/manifest/components/markdown-text.json +3 -0
- package/manifest/components/menubar.json +32 -4
- package/manifest/components/message-list.json +3 -0
- package/manifest/components/message.json +6 -1
- package/manifest/components/mobile-composer.json +3 -1
- package/manifest/components/multi-select.json +38 -1
- package/manifest/components/musical-time-input.json +10 -0
- package/manifest/components/navigation-menu.json +32 -3
- package/manifest/components/node-card.json +3 -0
- package/manifest/components/number-field.json +10 -1
- package/manifest/components/otp-field.json +9 -0
- package/manifest/components/page-shell.json +14 -0
- package/manifest/components/pagination.json +3 -0
- package/manifest/components/panel-header.json +10 -0
- package/manifest/components/panel.json +11 -1
- package/manifest/components/password-input.json +10 -1
- package/manifest/components/permission-scopes.json +3 -1
- package/manifest/components/piano-keyboard.json +3 -0
- package/manifest/components/popover.json +30 -3
- package/manifest/components/preset-section.json +9 -1
- package/manifest/components/preview.json +24 -10
- package/manifest/components/progress.json +6 -1
- package/manifest/components/prompt-library.json +3 -1
- package/manifest/components/queue-dock.json +3 -1
- package/manifest/components/radio-group.json +8 -0
- package/manifest/components/radio.json +8 -0
- package/manifest/components/rating.json +4 -1
- package/manifest/components/reasoning-panel.json +3 -1
- package/manifest/components/recommendation-card.json +1 -1
- package/manifest/components/resizable.json +4 -1
- package/manifest/components/revert-dock.json +3 -1
- package/manifest/components/row.json +5 -1
- package/manifest/components/scroll-area.json +4 -2
- package/manifest/components/scrollable-tabs-list.json +18 -0
- package/manifest/components/scrub-input.json +10 -1
- package/manifest/components/seam-cell.json +1 -0
- package/manifest/components/seam-grid.json +1 -0
- package/manifest/components/seam-list.json +5 -1
- package/manifest/components/search-input.json +10 -1
- package/manifest/components/section-header.json +15 -2
- package/manifest/components/segmented-control.json +16 -0
- package/manifest/components/select.json +17 -0
- package/manifest/components/settings-panel.json +3 -0
- package/manifest/components/shape-section.json +9 -1
- package/manifest/components/sheet.json +29 -3
- package/manifest/components/shimmer-label.json +3 -0
- package/manifest/components/sidebar.json +19 -2
- package/manifest/components/slider.json +8 -0
- package/manifest/components/sources.json +3 -1
- package/manifest/components/stat.json +9 -0
- package/manifest/components/status-bar.json +4 -0
- package/manifest/components/stepper.json +8 -0
- package/manifest/components/swap-label.json +3 -0
- package/manifest/components/switch.json +8 -0
- package/manifest/components/table-scroll-region.json +20 -2
- package/manifest/components/table.json +20 -2
- package/manifest/components/tabs.json +19 -1
- package/manifest/components/tags-input.json +38 -1
- package/manifest/components/terminal-frame.json +3 -0
- package/manifest/components/textarea.json +12 -0
- package/manifest/components/theme-configurator.json +29 -3
- package/manifest/components/theme-provider.json +31 -19
- package/manifest/components/thread-search.json +3 -1
- package/manifest/components/threshold-rail.json +3 -0
- package/manifest/components/time-field.json +10 -0
- package/manifest/components/toast.json +30 -2
- package/manifest/components/toggle.json +4 -0
- package/manifest/components/token-editor.json +6 -1
- package/manifest/components/tool-call-card.json +9 -2
- package/manifest/components/tool-call.json +3 -1
- package/manifest/components/tool-timeline.json +3 -1
- package/manifest/components/toolbar.json +3 -1
- package/manifest/components/tooltip.json +31 -3
- package/manifest/components/tree-visibility-toggle.json +3 -0
- package/manifest/components/tree.json +3 -0
- package/manifest/components/universe-grid.json +3 -0
- package/manifest/components/voice-conversation.json +3 -0
- package/manifest/components/work-collapse.json +3 -1
- package/manifest/manifest.json +204 -184
- package/manifest/tokens.json +241 -4
- package/package.json +5 -5
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
import { useIsomorphicInsertionEffect, useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
4
|
-
import {
|
|
4
|
+
import { published, usePublish, useRead } from "./published.js";
|
|
5
|
+
import { AmbientThemeContext, DeferRestateContext, DensityContext, PaintContext, RootAxesContext, StyleSetContext, rootAxes, useFollowedAxes, useMountedWhen, useRestateReady } from "./density.js";
|
|
5
6
|
import { buildRegistry, isPaint, isStyleSet, vocabulary, warnOnce } from "./vocabulary.js";
|
|
6
|
-
import { OverridesContext, inlineOverrides, overridesCss, reportOverrides } from "./overrides.js";
|
|
7
|
+
import { OverridesContext, followerColorsCss, inlineOverrides, overridesCss, reportOverrides } from "./overrides.js";
|
|
7
8
|
import { DEFAULT_STORAGE_KEY } from "./prepaint.js";
|
|
8
9
|
import { ThemeRegistryContext } from "./theme-registry.js";
|
|
9
10
|
import * as React from "react";
|
|
@@ -45,9 +46,15 @@ const DEFAULT_RESOLVED_MODE = "dark";
|
|
|
45
46
|
* Ambient theme state. `null` outside a provider, which is how `useTheme()`
|
|
46
47
|
* knows to throw and how the portal helpers know to use the defaults.
|
|
47
48
|
*
|
|
49
|
+
* Carried as a `Published` (see `published.ts`), like every context whose
|
|
50
|
+
* value the root's restore moves: a setter or a prop moves the context, as any
|
|
51
|
+
* context moves, and the restore — which lands while a streamed Suspense
|
|
52
|
+
* boundary below can still be server HTML — is posted beside it instead, so no
|
|
53
|
+
* boundary is told anything changed.
|
|
54
|
+
*
|
|
48
55
|
* Internal: consumers read it through `useTheme()`.
|
|
49
56
|
*/
|
|
50
|
-
const ThemeContext = React.createContext(null);
|
|
57
|
+
const ThemeContext = React.createContext(published(null));
|
|
51
58
|
/**
|
|
52
59
|
* The nearest provider's `fontScale`, published on its own so portal roots can
|
|
53
60
|
* republish it. A portal mounts outside the provider's DOM subtree and so
|
|
@@ -60,6 +67,34 @@ const ThemeContext = React.createContext(null);
|
|
|
60
67
|
const FontScaleContext = React.createContext(null);
|
|
61
68
|
/** Effective font-family overrides from the nearest provider chain. */
|
|
62
69
|
const FontFamiliesContext = React.createContext(null);
|
|
70
|
+
/**
|
|
71
|
+
* The pairing a portal container made right now should wear in place of the
|
|
72
|
+
* one its render read, or `null` for "the one it read".
|
|
73
|
+
*
|
|
74
|
+
* Not `null` under a persisting root until something there is edited, and
|
|
75
|
+
* then it is the visitor's STORED pairing — the one the restore lands on. A
|
|
76
|
+
* container is made and stamped in a layout effect of the very first commit,
|
|
77
|
+
* before the root's restore has run, and re-stamped in the commit after it,
|
|
78
|
+
* before the restore's correction has reached its render; in both, what
|
|
79
|
+
* `useTheme().font` says is the pairing the server rendered. That is right for
|
|
80
|
+
* markup, which has to hydrate against it, and wrong for a container, which is
|
|
81
|
+
* not hydrated and is enough, stamped with the default pairing for one commit,
|
|
82
|
+
* for the engine to start fetching the default's webfont for glyphs nobody
|
|
83
|
+
* sees (see `storedSeed`). After an edit the render's reading is the truth.
|
|
84
|
+
*
|
|
85
|
+
* A function rather than a value, and the same function for the root's whole
|
|
86
|
+
* life, so the context never moves: the restore must not move one (see
|
|
87
|
+
* `published.ts`). A `Preview` stage that names a pairing of its own hands its
|
|
88
|
+
* subtree {@link NO_PAIRING_SEED}; a nested provider passes the root's on.
|
|
89
|
+
*
|
|
90
|
+
* Internal: the portal stamp is the one reader.
|
|
91
|
+
*/
|
|
92
|
+
const PairingSeedContext = React.createContext(noPairingSeed);
|
|
93
|
+
function noPairingSeed() {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
/** The seed of a subtree whose pairing is named: the one its render read. Internal. */
|
|
97
|
+
const NO_PAIRING_SEED = noPairingSeed;
|
|
63
98
|
function isOneOf(allowed, value) {
|
|
64
99
|
return typeof value === "string" && allowed.includes(value);
|
|
65
100
|
}
|
|
@@ -144,21 +179,41 @@ function writePreferences(storageKey, preferences) {
|
|
|
144
179
|
*
|
|
145
180
|
* Rendering: `<div data-cue-root data-theme data-density data-mode style={{ colorScheme, --cue-font-scale }}>`
|
|
146
181
|
* (or the single child when `asChild`), plus `data-style` when — and only when —
|
|
147
|
-
* a style set is in force
|
|
182
|
+
* a style set is in force, and `data-paint` on the same terms for a pack. The
|
|
183
|
+
* `theme`/`density`/`font`/`mode`/`styleSet`/`paint` props are
|
|
148
184
|
* *initial* values — the provider holds the state so `setTheme` and friends can
|
|
149
185
|
* drive it — but a changed prop is adopted after mount, so a controlling parent
|
|
150
186
|
* still works.
|
|
151
187
|
*
|
|
188
|
+
* A **nested** provider stamps only what it names. One that names no theme,
|
|
189
|
+
* rung, mode, set or pack follows each of them from around it, live — a
|
|
190
|
+
* preference the root restores after mount, or a setter called at the root,
|
|
191
|
+
* reaches it, its `useTheme()` and its portals — and restates none of them on
|
|
192
|
+
* its element, so inheritance carries the outer attributes through. Naming a
|
|
193
|
+
* theme or a mode stamps theme, rung and mode together (a theme's light block
|
|
194
|
+
* and its rung rules are compound selectors), and restates the set and the pack
|
|
195
|
+
* in force beside them, so their blocks — whose values read the theme — resolve
|
|
196
|
+
* against this element's theme rather than the page's; naming only a rung
|
|
197
|
+
* stamps it as a `<Density>` island does.
|
|
198
|
+
*
|
|
152
199
|
* The font pairing is the one axis that never lands on this element: it has no
|
|
153
200
|
* island form, `<html>` is its only home, and restating it here would shadow the
|
|
154
201
|
* pre-paint stamp for the whole page on the first frame. See the `stamp` object
|
|
155
202
|
* below.
|
|
156
203
|
*
|
|
204
|
+
* The other axes wait for the same reason at a root that persists: its server
|
|
205
|
+
* markup, and its first client render, carry `data-cue-root` and no axis
|
|
206
|
+
* attribute or `color-scheme`, so the page inherits the visitor's stored axes
|
|
207
|
+
* from the pre-paint stamp on `<html>`. The restore lands before the first
|
|
208
|
+
* paint, and the element then states what it restored. Read the document's
|
|
209
|
+
* axes off `<html>`, not off this element, before hydration.
|
|
210
|
+
*
|
|
157
211
|
* Persistence and the pre-paint contract: setters write
|
|
158
212
|
* `{ theme, density, font, mode }` to `localStorage[storageKey]`, plus a `style`
|
|
159
|
-
* key holding the style set when there is one
|
|
160
|
-
*
|
|
161
|
-
*
|
|
213
|
+
* key holding the style set when there is one and a `paint` key holding the pack
|
|
214
|
+
* when there is one — each omitted entirely when there is not, so an application
|
|
215
|
+
* that never touches either axis writes the same four-key object it always
|
|
216
|
+
* wrote. That is exactly what
|
|
162
217
|
* {@link prepaintScript} reads to stamp `<html>` before the first paint. The
|
|
163
218
|
* outermost provider keeps `<html>` in sync while the app runs (and restores the
|
|
164
219
|
* previous stamp on unmount) so the page ground, UA scrollbars and form controls
|
|
@@ -176,13 +231,16 @@ function writePreferences(storageKey, preferences) {
|
|
|
176
231
|
* <App />
|
|
177
232
|
* </ThemeProvider>
|
|
178
233
|
*/
|
|
179
|
-
function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityProp, mode: modeProp
|
|
180
|
-
const ambient =
|
|
234
|
+
function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityProp, mode: modeProp, font: fontProp, styleSet: styleSetProp, paint: paintProp, fontScale = 1, fontFamilies, overrides, storageKey = DEFAULT_STORAGE_KEY, persistPreferences = true, nonce, asChild = false, className, style: styleProp, children }) {
|
|
235
|
+
const ambient = useRead(ThemeContext);
|
|
181
236
|
const isRoot = ambient === null;
|
|
182
|
-
const outerStyleSet =
|
|
183
|
-
const outerPaint =
|
|
184
|
-
const
|
|
185
|
-
const
|
|
237
|
+
const outerStyleSet = useRead(StyleSetContext);
|
|
238
|
+
const outerPaint = useRead(PaintContext);
|
|
239
|
+
const outerDensity = useRead(DensityContext);
|
|
240
|
+
const outerDefersRestate = React.useContext(DeferRestateContext);
|
|
241
|
+
const outerRootAxes = React.useContext(RootAxesContext);
|
|
242
|
+
const ambientRegistry = useRead(ThemeRegistryContext);
|
|
243
|
+
const themes = useSameElements(themesProp ?? ambientRegistry?.themes ?? EMPTY);
|
|
186
244
|
const vocab = React.useMemo(() => vocabulary(themes), [themes]);
|
|
187
245
|
React.useMemo(() => {
|
|
188
246
|
if (process.env.NODE_ENV === "production") return;
|
|
@@ -205,13 +263,27 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
205
263
|
const initialTheme = themeProp ?? (isRoot ? themes[0]?.name : ambient?.theme) ?? DEFAULT_THEME;
|
|
206
264
|
const initialDensity = densityProp ?? vocab.preferredDensity(initialTheme);
|
|
207
265
|
const initialFont = fontProp ?? vocab.preferredFont(initialTheme);
|
|
208
|
-
const initialStyleSet = styleSetProp ??
|
|
209
|
-
const initialPaint = paintProp ??
|
|
210
|
-
const [
|
|
211
|
-
const [densityState, setDensityState] = React.useState(initialDensity);
|
|
212
|
-
const [
|
|
266
|
+
const initialStyleSet = styleSetProp ?? null;
|
|
267
|
+
const initialPaint = paintProp ?? null;
|
|
268
|
+
const [themeState, setThemeState] = React.useState(isRoot ? initialTheme : themeProp ?? null);
|
|
269
|
+
const [densityState, setDensityState] = React.useState(isRoot ? initialDensity : densityProp ?? null);
|
|
270
|
+
const [modeState, setModeState] = React.useState(isRoot ? modeProp ?? DEFAULT_MODE : modeProp ?? null);
|
|
271
|
+
const theme = themeState ?? ambient?.theme ?? DEFAULT_THEME;
|
|
272
|
+
const mode = modeState ?? ambient?.mode ?? DEFAULT_MODE;
|
|
273
|
+
const namesColour = themeState !== null || modeState !== null;
|
|
213
274
|
const [styleSet, setStyleSetState] = React.useState(initialStyleSet);
|
|
214
275
|
const [paint, setPaintState] = React.useState(initialPaint);
|
|
276
|
+
const [edits, setEdits] = React.useState(0);
|
|
277
|
+
/**
|
|
278
|
+
* The stored pairing, for a portal container made before anything was edited
|
|
279
|
+
* (see `PairingSeedContext`); `null` once something was, or when nothing was
|
|
280
|
+
* stored. Filled in on the first render, below, once the pairing is derived.
|
|
281
|
+
*/
|
|
282
|
+
const pairingSeed = React.useRef(void 0);
|
|
283
|
+
const edited = React.useCallback(() => {
|
|
284
|
+
pairingSeed.current = null;
|
|
285
|
+
setEdits((n) => n + 1);
|
|
286
|
+
}, []);
|
|
215
287
|
const [storedSeed] = React.useState(() => {
|
|
216
288
|
if (!isRoot || !persistPreferences) return {
|
|
217
289
|
theme: initialTheme,
|
|
@@ -230,14 +302,38 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
230
302
|
const [systemMode, setSystemMode] = React.useState(DEFAULT_RESOLVED_MODE);
|
|
231
303
|
const restoredKey = React.useRef(null);
|
|
232
304
|
const [restored, setRestored] = React.useState(false);
|
|
305
|
+
const awaitingRestore = isRoot && persistPreferences && !restored;
|
|
233
306
|
const manifest = React.useMemo(() => themes.find((m) => m.name === theme) ?? null, [themes, theme]);
|
|
234
307
|
if (vocab.themes !== null && manifest === null) warnOnce(`theme "${theme}" is not registered; useTheme().manifest is null and only the base axes are offered. Add its manifest to ThemeProvider's themes prop.`);
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
308
|
+
const requestedDensity = densityState ?? outerDensity ?? ambient?.density ?? vocab.preferredDensity(theme);
|
|
309
|
+
const density = vocab.acceptsDensity(theme, requestedDensity) ? requestedDensity : vocab.preferredDensity(theme);
|
|
310
|
+
if (density !== requestedDensity && densityState !== null) warnOnce(`density "${densityState}" is not offered by theme "${theme}"; using "${density}"`);
|
|
311
|
+
const stampsRungAlone = !namesColour && (densityState !== null || density !== requestedDensity);
|
|
312
|
+
const stampsComponent = asChild && React.isValidElement(children) && typeof children.type !== "string";
|
|
313
|
+
const stampsOwnAxes = stampsComponent && namesColour;
|
|
314
|
+
const followed = useFollowedAxes(stampsComponent ? {} : {
|
|
315
|
+
theme: !isRoot && themeState === null && (namesColour || stampsRungAlone),
|
|
316
|
+
mode: !isRoot && namesColour && modeState === null,
|
|
317
|
+
density: !isRoot && namesColour && densityState === null
|
|
318
|
+
});
|
|
319
|
+
const fontTheme = awaitingRestore ? storedSeed.theme : theme;
|
|
238
320
|
const font = vocab.acceptsFont(fontTheme, rawFont) ? rawFont : vocab.preferredFont(fontTheme);
|
|
239
321
|
if (font !== rawFont) warnOnce(`font "${rawFont}" is not offered by theme "${fontTheme}"; using "${font}"`);
|
|
240
|
-
const
|
|
322
|
+
const servedFont = vocab.acceptsFont(initialTheme, initialFont) ? initialFont : vocab.preferredFont(initialTheme);
|
|
323
|
+
if (pairingSeed.current === void 0) pairingSeed.current = awaitingRestore ? font : null;
|
|
324
|
+
const readPairingSeed = React.useCallback(() => pairingSeed.current ?? null, []);
|
|
325
|
+
const outerPairingSeed = React.useContext(PairingSeedContext);
|
|
326
|
+
const nestedPairingSeed = React.useCallback(() => {
|
|
327
|
+
const seed = outerPairingSeed();
|
|
328
|
+
if (seed === null) return null;
|
|
329
|
+
return vocab.acceptsFont(theme, seed) ? seed : vocab.preferredFont(theme);
|
|
330
|
+
}, [
|
|
331
|
+
outerPairingSeed,
|
|
332
|
+
vocab,
|
|
333
|
+
theme
|
|
334
|
+
]);
|
|
335
|
+
const pairingSeedBelow = isRoot ? readPairingSeed : themeState !== null ? nestedPairingSeed : outerPairingSeed;
|
|
336
|
+
const resolvedMode = !namesColour && ambient !== null ? ambient.resolvedMode : manifest?.supportsLight === false ? "dark" : mode === "system" ? systemMode : mode;
|
|
241
337
|
useIsomorphicLayoutEffect(() => {
|
|
242
338
|
if (!isRoot) return;
|
|
243
339
|
if (!persistPreferences) {
|
|
@@ -256,6 +352,7 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
256
352
|
styleSet,
|
|
257
353
|
paint
|
|
258
354
|
});
|
|
355
|
+
pairingSeed.current = next.font;
|
|
259
356
|
setThemeState(next.theme);
|
|
260
357
|
setDensityState(next.density);
|
|
261
358
|
setRootFontState(next.font);
|
|
@@ -286,19 +383,42 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
286
383
|
styleSet: styleSetProp,
|
|
287
384
|
paint: paintProp
|
|
288
385
|
};
|
|
289
|
-
|
|
290
|
-
if (previous.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (previous.
|
|
386
|
+
let adopted = false;
|
|
387
|
+
if (previous.theme !== themeProp && themeProp !== void 0) {
|
|
388
|
+
setThemeState(themeProp);
|
|
389
|
+
adopted = true;
|
|
390
|
+
}
|
|
391
|
+
if (previous.density !== densityProp && densityProp !== void 0) {
|
|
392
|
+
setDensityState(densityProp);
|
|
393
|
+
adopted = true;
|
|
394
|
+
}
|
|
395
|
+
if (previous.mode !== modeProp) {
|
|
396
|
+
if (modeProp !== void 0) setModeState(modeProp);
|
|
397
|
+
else if (isRoot) setModeState(DEFAULT_MODE);
|
|
398
|
+
adopted = true;
|
|
399
|
+
}
|
|
400
|
+
if (previous.font !== fontProp && fontProp !== void 0) {
|
|
401
|
+
setRootFontState(fontProp);
|
|
402
|
+
adopted = true;
|
|
403
|
+
}
|
|
404
|
+
if (previous.styleSet !== styleSetProp && styleSetProp !== void 0) {
|
|
405
|
+
setStyleSetState(styleSetProp);
|
|
406
|
+
adopted = true;
|
|
407
|
+
}
|
|
408
|
+
if (previous.paint !== paintProp && paintProp !== void 0) {
|
|
409
|
+
setPaintState(paintProp);
|
|
410
|
+
adopted = true;
|
|
411
|
+
}
|
|
412
|
+
if (adopted) edited();
|
|
295
413
|
}, [
|
|
414
|
+
isRoot,
|
|
296
415
|
themeProp,
|
|
297
416
|
densityProp,
|
|
298
417
|
modeProp,
|
|
299
418
|
fontProp,
|
|
300
419
|
styleSetProp,
|
|
301
|
-
paintProp
|
|
420
|
+
paintProp,
|
|
421
|
+
edited
|
|
302
422
|
]);
|
|
303
423
|
useIsomorphicLayoutEffect(() => {
|
|
304
424
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
@@ -310,7 +430,7 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
310
430
|
}, []);
|
|
311
431
|
const stateRef = React.useRef({
|
|
312
432
|
theme,
|
|
313
|
-
density:
|
|
433
|
+
density: requestedDensity,
|
|
314
434
|
mode,
|
|
315
435
|
font: rawFont,
|
|
316
436
|
styleSet,
|
|
@@ -319,13 +439,40 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
319
439
|
useIsomorphicLayoutEffect(() => {
|
|
320
440
|
stateRef.current = {
|
|
321
441
|
theme,
|
|
322
|
-
density:
|
|
442
|
+
density: requestedDensity,
|
|
323
443
|
mode,
|
|
324
444
|
font: rawFont,
|
|
325
445
|
styleSet,
|
|
326
446
|
paint
|
|
327
447
|
};
|
|
328
448
|
});
|
|
449
|
+
const heldNow = React.useRef({
|
|
450
|
+
theme: themeState,
|
|
451
|
+
density: densityState,
|
|
452
|
+
mode: modeState,
|
|
453
|
+
font: rootFont,
|
|
454
|
+
styleSet,
|
|
455
|
+
paint
|
|
456
|
+
});
|
|
457
|
+
useIsomorphicLayoutEffect(() => {
|
|
458
|
+
heldNow.current = {
|
|
459
|
+
theme: themeState,
|
|
460
|
+
density: densityState,
|
|
461
|
+
mode: modeState,
|
|
462
|
+
font: rootFont,
|
|
463
|
+
styleSet,
|
|
464
|
+
paint
|
|
465
|
+
};
|
|
466
|
+
});
|
|
467
|
+
/** `true` when `value` is what `axis` holds already; otherwise records it as held and returns `false`. */
|
|
468
|
+
const holds = React.useCallback((axis, value) => {
|
|
469
|
+
if (Object.is(heldNow.current[axis], value)) return true;
|
|
470
|
+
heldNow.current = {
|
|
471
|
+
...heldNow.current,
|
|
472
|
+
[axis]: value
|
|
473
|
+
};
|
|
474
|
+
return false;
|
|
475
|
+
}, []);
|
|
329
476
|
const persist = React.useCallback((patch) => {
|
|
330
477
|
const next = {
|
|
331
478
|
...stateRef.current,
|
|
@@ -340,31 +487,67 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
340
487
|
storageKey
|
|
341
488
|
]);
|
|
342
489
|
const setTheme = React.useCallback((next) => {
|
|
490
|
+
if (holds("theme", next)) return;
|
|
343
491
|
setThemeState(next);
|
|
492
|
+
edited();
|
|
344
493
|
persist({ theme: next });
|
|
345
|
-
}, [
|
|
494
|
+
}, [
|
|
495
|
+
persist,
|
|
496
|
+
edited,
|
|
497
|
+
holds
|
|
498
|
+
]);
|
|
346
499
|
const setDensity = React.useCallback((next) => {
|
|
500
|
+
if (holds("density", next)) return;
|
|
347
501
|
setDensityState(next);
|
|
502
|
+
edited();
|
|
348
503
|
persist({ density: next });
|
|
349
|
-
}, [
|
|
504
|
+
}, [
|
|
505
|
+
persist,
|
|
506
|
+
edited,
|
|
507
|
+
holds
|
|
508
|
+
]);
|
|
350
509
|
const setMode = React.useCallback((next) => {
|
|
510
|
+
if (holds("mode", next)) return;
|
|
351
511
|
setModeState(next);
|
|
512
|
+
edited();
|
|
352
513
|
persist({ mode: next });
|
|
353
|
-
}, [
|
|
514
|
+
}, [
|
|
515
|
+
persist,
|
|
516
|
+
edited,
|
|
517
|
+
holds
|
|
518
|
+
]);
|
|
354
519
|
const rootSetFont = React.useCallback((next) => {
|
|
520
|
+
if (holds("font", next)) return;
|
|
355
521
|
setRootFontState(next);
|
|
522
|
+
edited();
|
|
356
523
|
persist({ font: next });
|
|
357
|
-
}, [
|
|
524
|
+
}, [
|
|
525
|
+
persist,
|
|
526
|
+
edited,
|
|
527
|
+
holds
|
|
528
|
+
]);
|
|
358
529
|
/** Nested providers hand the axis straight up: one document, one pairing. */
|
|
359
530
|
const setFont = isRoot ? rootSetFont : ambient.setFont;
|
|
360
531
|
const setStyleSet = React.useCallback((next) => {
|
|
532
|
+
if (holds("styleSet", next)) return;
|
|
361
533
|
setStyleSetState(next);
|
|
534
|
+
edited();
|
|
362
535
|
persist({ styleSet: next });
|
|
363
|
-
}, [
|
|
536
|
+
}, [
|
|
537
|
+
persist,
|
|
538
|
+
edited,
|
|
539
|
+
holds
|
|
540
|
+
]);
|
|
364
541
|
const setPaint = React.useCallback((next) => {
|
|
542
|
+
if (holds("paint", next)) return;
|
|
365
543
|
setPaintState(next);
|
|
544
|
+
edited();
|
|
366
545
|
persist({ paint: next });
|
|
367
|
-
}, [
|
|
546
|
+
}, [
|
|
547
|
+
persist,
|
|
548
|
+
edited,
|
|
549
|
+
holds
|
|
550
|
+
]);
|
|
368
551
|
const originalStamp = React.useRef(null);
|
|
369
552
|
useIsomorphicInsertionEffect(() => {
|
|
370
553
|
if (!isRoot || typeof document === "undefined") return;
|
|
@@ -385,7 +568,8 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
385
568
|
mode: root.getAttribute("data-mode"),
|
|
386
569
|
style: root.getAttribute("data-style"),
|
|
387
570
|
paint: root.getAttribute("data-paint"),
|
|
388
|
-
colorScheme: root.style.colorScheme
|
|
571
|
+
colorScheme: root.style.colorScheme,
|
|
572
|
+
fontScale: root.style.getPropertyValue("--cue-font-scale")
|
|
389
573
|
};
|
|
390
574
|
const write = (name, value) => {
|
|
391
575
|
if (root.getAttribute(name) !== value) root.setAttribute(name, value);
|
|
@@ -402,6 +586,11 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
402
586
|
} else write("data-paint", next.paint);
|
|
403
587
|
const scheme = (themes.find((m) => m.name === next.theme) ?? null)?.supportsLight === false ? "dark" : next.mode === "system" ? "light dark" : next.mode;
|
|
404
588
|
if (root.style.colorScheme !== scheme) root.style.colorScheme = scheme;
|
|
589
|
+
const scale = fontScale === 1 ? "" : String(fontScale);
|
|
590
|
+
if (root.style.getPropertyValue("--cue-font-scale") !== scale) {
|
|
591
|
+
if (scale === "") root.style.removeProperty("--cue-font-scale");
|
|
592
|
+
else root.style.setProperty("--cue-font-scale", scale);
|
|
593
|
+
}
|
|
405
594
|
}, [
|
|
406
595
|
isRoot,
|
|
407
596
|
restored,
|
|
@@ -412,6 +601,8 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
412
601
|
font,
|
|
413
602
|
mode,
|
|
414
603
|
styleSet,
|
|
604
|
+
paint,
|
|
605
|
+
fontScale,
|
|
415
606
|
themes,
|
|
416
607
|
vocab
|
|
417
608
|
]);
|
|
@@ -431,16 +622,10 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
431
622
|
restore("data-style", original.style);
|
|
432
623
|
restore("data-paint", original.paint);
|
|
433
624
|
root.style.colorScheme = original.colorScheme;
|
|
625
|
+
if (original.fontScale === "") root.style.removeProperty("--cue-font-scale");
|
|
626
|
+
else root.style.setProperty("--cue-font-scale", original.fontScale);
|
|
434
627
|
}, []);
|
|
435
628
|
const effectiveStyleSet = styleSet ?? outerStyleSet;
|
|
436
|
-
/**
|
|
437
|
-
* The pack in force, for the same reason and with the same caveat: it is what
|
|
438
|
-
* `useTheme().paint` reports, and it does NOT feed the `data-paint` stamp.
|
|
439
|
-
* That stays on this provider's own `paint` state, so a root that named none
|
|
440
|
-
* stamps nothing on itself and nothing on `<html>` however much is stamped
|
|
441
|
-
* around it — which keeps a `<Density paint>` island out of the document-wide
|
|
442
|
-
* attribute and out of the storage the pre-paint script reads back.
|
|
443
|
-
*/
|
|
444
629
|
const effectivePaint = paint ?? outerPaint;
|
|
445
630
|
const contextValue = React.useMemo(() => ({
|
|
446
631
|
theme,
|
|
@@ -491,8 +676,27 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
491
676
|
]);
|
|
492
677
|
const overridesKey = JSON.stringify(overrides ?? null);
|
|
493
678
|
const inline = React.useMemo(() => inlineOverrides(overrides, resolvedMode), [overridesKey, resolvedMode]);
|
|
679
|
+
const colorEdit = Object.values(overrides?.colors?.dark ?? {}).some((value) => value !== void 0) || Object.values(overrides?.colors?.light ?? {}).some((value) => value !== void 0);
|
|
680
|
+
const inheritsRootMode = !isRoot && !namesColour && !stampsComponent && colorEdit && (outerRootAxes.mode || outerRootAxes.theme);
|
|
681
|
+
const inheritedMounted = useMountedWhen(inheritsRootMode);
|
|
682
|
+
const colorsFollowMode = isRoot ? awaitingRestore : namesColour ? followed.mode : inheritsRootMode && !inheritedMounted && outerRootAxes.mode;
|
|
683
|
+
const colorsFollowTheme = isRoot ? awaitingRestore : namesColour ? followed.theme : inheritsRootMode && !inheritedMounted && outerRootAxes.theme;
|
|
684
|
+
const followerColors = React.useMemo(() => colorEdit && (colorsFollowMode || colorsFollowTheme) ? followerColorsCss(overrides, {
|
|
685
|
+
mode: colorsFollowMode ? null : mode,
|
|
686
|
+
supportsLight: colorsFollowTheme ? null : manifest?.supportsLight !== false,
|
|
687
|
+
darkOnly: colorsFollowTheme ? themes.filter((m) => !m.supportsLight).map((m) => m.name) : []
|
|
688
|
+
}) : null, [
|
|
689
|
+
overridesKey,
|
|
690
|
+
colorEdit,
|
|
691
|
+
colorsFollowMode,
|
|
692
|
+
colorsFollowTheme,
|
|
693
|
+
mode,
|
|
694
|
+
manifest?.supportsLight,
|
|
695
|
+
themes
|
|
696
|
+
]);
|
|
697
|
+
const inlineFonts = React.useMemo(() => inlineOverrides(overrides?.fonts === void 0 ? void 0 : { fonts: overrides.fonts }, "dark"), [overridesKey]);
|
|
494
698
|
const overridesStyle = React.useMemo(() => overridesCss(overrides), [overridesKey]);
|
|
495
|
-
const parentOverrides =
|
|
699
|
+
const parentOverrides = useRead(OverridesContext);
|
|
496
700
|
const effectiveOverrides = React.useMemo(() => {
|
|
497
701
|
const merged = {
|
|
498
702
|
...parentOverrides,
|
|
@@ -510,28 +714,51 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
510
714
|
theme
|
|
511
715
|
]);
|
|
512
716
|
const style = React.useMemo(() => ({
|
|
513
|
-
colorScheme: manifest?.supportsLight === false ? "dark" : mode === "system" ? "light dark" : mode,
|
|
717
|
+
...awaitingRestore || !namesColour || followed.theme || followed.mode && manifest?.supportsLight !== false ? null : { colorScheme: manifest?.supportsLight === false ? "dark" : mode === "system" ? "light dark" : mode },
|
|
514
718
|
"--cue-font-scale": fontScale,
|
|
515
719
|
...fontFamilies?.sans === void 0 ? null : { "--cue-font-sans": fontFamilies.sans },
|
|
516
720
|
...fontFamilies?.mono === void 0 ? null : { "--cue-font-mono": fontFamilies.mono },
|
|
517
|
-
...inline,
|
|
721
|
+
...followerColors === null ? inline : inlineFonts,
|
|
518
722
|
...styleProp
|
|
519
723
|
}), [
|
|
724
|
+
awaitingRestore,
|
|
725
|
+
namesColour,
|
|
726
|
+
followed.mode,
|
|
727
|
+
followed.theme,
|
|
520
728
|
manifest?.supportsLight,
|
|
521
729
|
mode,
|
|
522
730
|
fontScale,
|
|
523
731
|
fontFamilies?.sans,
|
|
524
732
|
fontFamilies?.mono,
|
|
525
733
|
inline,
|
|
734
|
+
inlineFonts,
|
|
735
|
+
followerColors,
|
|
526
736
|
styleProp
|
|
527
737
|
]);
|
|
528
|
-
const
|
|
529
|
-
"data-
|
|
530
|
-
"data-
|
|
738
|
+
const colourStamp = namesColour ? {
|
|
739
|
+
...followed.theme ? null : { "data-theme": theme },
|
|
740
|
+
...followed.density ? null : { "data-density": density },
|
|
741
|
+
...followed.mode ? null : { "data-mode": mode },
|
|
742
|
+
...followed.marker === null ? null : { "data-cue-follows": followed.marker }
|
|
743
|
+
} : stampsRungAlone ? {
|
|
531
744
|
"data-density": density,
|
|
532
|
-
"data-
|
|
533
|
-
...
|
|
534
|
-
|
|
745
|
+
...followed.theme ? null : { "data-cue-theme": theme },
|
|
746
|
+
...followed.marker === null ? null : { "data-cue-follows": followed.marker }
|
|
747
|
+
} : null;
|
|
748
|
+
const wantsRestate = !isRoot && namesColour && (effectiveStyleSet !== null || effectivePaint !== null);
|
|
749
|
+
const restates = useRestateReady(wantsRestate) && wantsRestate;
|
|
750
|
+
const stampedStyleSet = restates ? effectiveStyleSet : styleSet;
|
|
751
|
+
const stampedPaint = restates ? effectivePaint : paint;
|
|
752
|
+
const colorsKey = followerColors === null || followerColors.css === "" ? null : { "data-cue-colors": followerColors.key };
|
|
753
|
+
const stamp = awaitingRestore ? {
|
|
754
|
+
"data-cue-root": "",
|
|
755
|
+
...colorsKey
|
|
756
|
+
} : {
|
|
757
|
+
"data-cue-root": "",
|
|
758
|
+
...colourStamp,
|
|
759
|
+
...stampedStyleSet === null ? null : { "data-style": stampedStyleSet },
|
|
760
|
+
...stampedPaint === null ? null : { "data-paint": stampedPaint },
|
|
761
|
+
...colorsKey
|
|
535
762
|
};
|
|
536
763
|
let root;
|
|
537
764
|
if (asChild) {
|
|
@@ -550,6 +777,11 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
550
777
|
style,
|
|
551
778
|
children
|
|
552
779
|
});
|
|
780
|
+
const colorLayer = followerColors === null || followerColors.css === "" ? null : /* @__PURE__ */ jsx("style", {
|
|
781
|
+
...nonce === void 0 ? null : { nonce },
|
|
782
|
+
"data-cue-colors-for": followerColors.key,
|
|
783
|
+
children: followerColors.css
|
|
784
|
+
});
|
|
553
785
|
const densityLayer = overridesStyle === "" ? null : /* @__PURE__ */ jsx("style", {
|
|
554
786
|
...nonce === void 0 ? null : { nonce },
|
|
555
787
|
"data-cue-overrides": "",
|
|
@@ -586,23 +818,68 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
586
818
|
nonce,
|
|
587
819
|
children: tree
|
|
588
820
|
});
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
821
|
+
const inputs = [
|
|
822
|
+
edits,
|
|
823
|
+
...themes,
|
|
824
|
+
themeProp,
|
|
825
|
+
densityProp,
|
|
826
|
+
modeProp,
|
|
827
|
+
fontProp,
|
|
828
|
+
styleSetProp,
|
|
829
|
+
paintProp,
|
|
830
|
+
overridesKey,
|
|
831
|
+
persistPreferences,
|
|
832
|
+
storageKey,
|
|
833
|
+
React.useContext(ThemeContext),
|
|
834
|
+
React.useContext(ThemeRegistryContext),
|
|
835
|
+
React.useContext(OverridesContext),
|
|
836
|
+
React.useContext(DensityContext),
|
|
837
|
+
React.useContext(StyleSetContext),
|
|
838
|
+
React.useContext(PaintContext)
|
|
839
|
+
];
|
|
840
|
+
const publishedRegistry = usePublish(registry, inputs);
|
|
841
|
+
const publishedTheme = usePublish(contextValue, inputs, isRoot && persistPreferences ? () => servedFont === contextValue.font ? contextValue : {
|
|
842
|
+
...contextValue,
|
|
843
|
+
font: servedFont
|
|
844
|
+
} : void 0);
|
|
845
|
+
const publishedAmbient = usePublish(theme, inputs);
|
|
846
|
+
const publishedOverrides = usePublish(effectiveOverrides, inputs);
|
|
847
|
+
const publishedDensity = usePublish(density, inputs);
|
|
848
|
+
const publishedStyleSet = usePublish(effectiveStyleSet, inputs);
|
|
849
|
+
const publishedPaint = usePublish(effectivePaint, inputs);
|
|
850
|
+
return withCspContext(/* @__PURE__ */ jsx(DeferRestateContext.Provider, {
|
|
851
|
+
value: isRoot ? persistPreferences : outerDefersRestate,
|
|
852
|
+
children: /* @__PURE__ */ jsx(RootAxesContext.Provider, {
|
|
853
|
+
value: isRoot ? rootAxes(persistPreferences, persistPreferences, persistPreferences) : rootAxes(outerRootAxes.theme && themeState === null && !stampsOwnAxes, outerRootAxes.mode && modeState === null && !stampsOwnAxes, outerRootAxes.density && densityState === null && !stampsOwnAxes),
|
|
854
|
+
children: /* @__PURE__ */ jsx(ThemeRegistryContext.Provider, {
|
|
855
|
+
value: publishedRegistry,
|
|
856
|
+
children: /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
857
|
+
value: publishedTheme,
|
|
858
|
+
children: /* @__PURE__ */ jsx(AmbientThemeContext.Provider, {
|
|
859
|
+
value: publishedAmbient,
|
|
860
|
+
children: /* @__PURE__ */ jsx(FontScaleContext.Provider, {
|
|
861
|
+
value: fontScale,
|
|
862
|
+
children: /* @__PURE__ */ jsx(FontFamiliesContext.Provider, {
|
|
863
|
+
value: effectiveFontFamilies,
|
|
864
|
+
children: /* @__PURE__ */ jsx(PairingSeedContext.Provider, {
|
|
865
|
+
value: pairingSeedBelow,
|
|
866
|
+
children: /* @__PURE__ */ jsx(OverridesContext.Provider, {
|
|
867
|
+
value: publishedOverrides,
|
|
868
|
+
children: /* @__PURE__ */ jsx(DensityContext.Provider, {
|
|
869
|
+
value: publishedDensity,
|
|
870
|
+
children: /* @__PURE__ */ jsx(StyleSetContext.Provider, {
|
|
871
|
+
value: publishedStyleSet,
|
|
872
|
+
children: /* @__PURE__ */ jsxs(PaintContext.Provider, {
|
|
873
|
+
value: publishedPaint,
|
|
874
|
+
children: [
|
|
875
|
+
root,
|
|
876
|
+
colorLayer,
|
|
877
|
+
densityLayer
|
|
878
|
+
]
|
|
879
|
+
})
|
|
880
|
+
})
|
|
881
|
+
})
|
|
882
|
+
})
|
|
606
883
|
})
|
|
607
884
|
})
|
|
608
885
|
})
|
|
@@ -612,5 +889,17 @@ function ThemeProvider({ themes: themesProp, theme: themeProp, density: densityP
|
|
|
612
889
|
})
|
|
613
890
|
}));
|
|
614
891
|
}
|
|
892
|
+
/**
|
|
893
|
+
* `list` itself, or the array this hook returned last time when that one holds
|
|
894
|
+
* the same elements — so a caller that builds an equal array on every render
|
|
895
|
+
* hands on one identity.
|
|
896
|
+
*/
|
|
897
|
+
function useSameElements(list) {
|
|
898
|
+
const [kept, setKept] = React.useState(list);
|
|
899
|
+
if (kept === list) return kept;
|
|
900
|
+
if (kept.length === list.length && kept.every((item, i) => Object.is(item, list[i]))) return kept;
|
|
901
|
+
setKept(list);
|
|
902
|
+
return list;
|
|
903
|
+
}
|
|
615
904
|
//#endregion
|
|
616
|
-
export { FontFamiliesContext, FontScaleContext, ThemeContext, ThemeProvider };
|
|
905
|
+
export { FontFamiliesContext, FontScaleContext, NO_PAIRING_SEED, PairingSeedContext, ThemeContext, ThemeProvider };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./published.js";
|
|
1
2
|
import { ThemeRegistry } from "./vocabulary.js";
|
|
2
3
|
import "react";
|
|
3
4
|
import { DensityEntry, FontEntry, ThemeManifest } from "@cueplusplus/theme-base";
|
|
@@ -40,7 +41,7 @@ declare function useThemes(): readonly ThemeManifest[];
|
|
|
40
41
|
*/
|
|
41
42
|
declare function useDensities(): readonly DensityEntry[];
|
|
42
43
|
/**
|
|
43
|
-
* The font pairings, by the same rule: the base
|
|
44
|
+
* The font pairings, by the same rule: the base twelve, then the active theme's.
|
|
44
45
|
*
|
|
45
46
|
* @throws If called outside a `<ThemeProvider>`.
|
|
46
47
|
* @example
|