@cueplusplus/ui 0.15.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 +1083 -0
- package/README.md +26 -0
- 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 +4 -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 +17 -1
- package/dist/chrome/_tabs-scroll.js +20 -3
- package/dist/chrome/app-bar.js +10 -3
- package/dist/chrome/app-shell.js +2 -1
- package/dist/chrome/band.d.ts +18 -12
- package/dist/chrome/band.js +19 -31
- 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 +9 -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-field.d.ts +2 -1
- package/dist/color/color-picker.d.ts +2 -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/date/date-field.d.ts +2 -1
- package/dist/date/date-picker.d.ts +2 -1
- package/dist/date/date-range-picker.d.ts +2 -1
- package/dist/date/time-field.d.ts +2 -1
- 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-size.d.ts +22 -0
- package/dist/forms/_chassis.d.ts +28 -15
- package/dist/forms/_chassis.js +34 -8
- package/dist/forms/_listbox.js +8 -5
- package/dist/forms/autocomplete.d.ts +2 -1
- package/dist/forms/checkbox.js +8 -2
- package/dist/forms/combobox.d.ts +2 -1
- package/dist/forms/env-var-input.d.ts +2 -1
- 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/index.d.ts +2 -1
- package/dist/forms/input-group.d.ts +2 -1
- package/dist/forms/input.d.ts +2 -1
- package/dist/forms/multi-select.d.ts +2 -1
- package/dist/forms/number-field.js +2 -1
- package/dist/forms/otp-field.d.ts +2 -1
- package/dist/forms/password-input.d.ts +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.d.ts +2 -1
- package/dist/forms/scrub-input.js +2 -1
- package/dist/forms/search-input.d.ts +2 -1
- package/dist/forms/search-input.js +2 -1
- package/dist/forms/select.d.ts +2 -1
- package/dist/forms/select.js +6 -2
- package/dist/forms/slider.js +6 -2
- package/dist/forms/switch.js +6 -2
- package/dist/forms/tags-input.d.ts +2 -1
- package/dist/forms/textarea.js +2 -1
- package/dist/forms/toggle-group.d.ts +1 -1
- package/dist/forms/toggle.d.ts +1 -1
- package/dist/forms/toggle.js +3 -1
- package/dist/index.d.ts +4 -3
- 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 +5 -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 +14 -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/musical-time-input.d.ts +2 -1
- 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 +86 -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 -10
- package/dist/primitives/chip.d.ts +20 -2
- 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-elevation.js +9 -0
- package/dist/system/_paint-glass.js +46 -0
- package/dist/system/_paint-glow.js +51 -0
- package/dist/system/_paint-ground-pattern.js +30 -0
- package/dist/system/_paint-rest-shade.js +32 -0
- package/dist/system/_paint-rim.js +59 -0
- package/dist/system/_paint-stroke-sunken.js +19 -0
- package/dist/system/_paint-stroke-surface-1.js +19 -0
- package/dist/system/_paint-stroke-surface-2.js +40 -0
- package/dist/system/_paint-texture.js +56 -0
- 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 +168 -60
- package/dist/system/theme-provider.js +375 -79
- 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 +38 -1
- package/manifest/components/app-bar.json +23 -2
- package/manifest/components/app-shell.json +5 -0
- package/manifest/components/ask-box.json +3 -1
- package/manifest/components/autocomplete.json +49 -1
- package/manifest/components/band.json +14 -3
- package/manifest/components/bento.json +12 -1
- package/manifest/components/breadcrumb.json +8 -1
- package/manifest/components/button.json +31 -3
- package/manifest/components/calendar.json +7 -0
- package/manifest/components/card.json +28 -1
- package/manifest/components/carousel.json +4 -1
- package/manifest/components/channel-matrix.json +40 -1
- package/manifest/components/chart-tooltip-content.json +38 -1
- 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 +14 -0
- package/manifest/components/color-picker.json +14 -0
- package/manifest/components/color-slider.json +3 -1
- package/manifest/components/colors-section.json +9 -1
- package/manifest/components/combobox.json +49 -1
- package/manifest/components/command-palette.json +37 -1
- 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 +14 -0
- package/manifest/components/confidence-marker.json +3 -1
- package/manifest/components/container.json +2 -1
- package/manifest/components/context-menu.json +38 -1
- 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 +14 -0
- package/manifest/components/date-picker.json +14 -0
- package/manifest/components/date-range-picker.json +14 -0
- package/manifest/components/delegation-card.json +3 -1
- package/manifest/components/density.json +21 -7
- package/manifest/components/description-list.json +6 -1
- package/manifest/components/dialog.json +39 -1
- package/manifest/components/disclosure.json +13 -2
- package/manifest/components/dmx-bar.json +37 -1
- package/manifest/components/dmx-strip.json +37 -1
- package/manifest/components/drawer.json +38 -1
- package/manifest/components/dropdown-menu.json +38 -1
- 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 +14 -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 +38 -1
- package/manifest/components/info-tip.json +3 -0
- package/manifest/components/input-group.json +14 -0
- package/manifest/components/input.json +14 -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 +10 -0
- package/manifest/components/map-answer.json +3 -1
- package/manifest/components/markdown-text.json +3 -0
- package/manifest/components/menubar.json +41 -2
- package/manifest/components/message-list.json +10 -0
- package/manifest/components/message.json +6 -1
- package/manifest/components/mobile-composer.json +3 -1
- package/manifest/components/multi-select.json +49 -1
- package/manifest/components/musical-time-input.json +14 -0
- package/manifest/components/navigation-menu.json +41 -1
- package/manifest/components/node-card.json +3 -0
- package/manifest/components/number-field.json +14 -1
- package/manifest/components/otp-field.json +13 -0
- package/manifest/components/page-shell.json +14 -0
- package/manifest/components/pagination.json +3 -0
- package/manifest/components/panel-header.json +12 -0
- package/manifest/components/panel.json +13 -1
- package/manifest/components/password-input.json +14 -1
- package/manifest/components/permission-scopes.json +3 -1
- package/manifest/components/piano-keyboard.json +3 -0
- package/manifest/components/popover.json +39 -1
- package/manifest/components/preset-section.json +9 -1
- package/manifest/components/preview.json +30 -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 +19 -0
- package/manifest/components/scrub-input.json +14 -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 +14 -1
- package/manifest/components/section-header.json +15 -2
- package/manifest/components/segmented-control.json +17 -0
- package/manifest/components/select.json +28 -0
- package/manifest/components/settings-panel.json +3 -0
- package/manifest/components/shape-section.json +9 -1
- package/manifest/components/sheet.json +38 -1
- 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 +20 -1
- package/manifest/components/tags-input.json +49 -1
- package/manifest/components/terminal-frame.json +3 -0
- package/manifest/components/textarea.json +16 -0
- package/manifest/components/theme-configurator.json +38 -1
- package/manifest/components/theme-provider.json +37 -19
- package/manifest/components/thread-search.json +3 -1
- package/manifest/components/threshold-rail.json +3 -0
- package/manifest/components/time-field.json +14 -0
- package/manifest/components/toast.json +39 -0
- package/manifest/components/toggle-group.json +1 -19
- package/manifest/components/toggle.json +3 -5
- 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 +4 -1
- package/manifest/components/tooltip.json +40 -1
- 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 +205 -185
- package/manifest/tokens.json +260 -4
- package/package.json +6 -6
|
@@ -22,7 +22,7 @@ interface PersistedPreferences {
|
|
|
22
22
|
*/
|
|
23
23
|
style?: string;
|
|
24
24
|
/**
|
|
25
|
-
* Last
|
|
25
|
+
* Last paint pack the user picked, or absent — which is what "no pack" means,
|
|
26
26
|
* for exactly the reason `style` above gives. An application that never
|
|
27
27
|
* touches this axis keeps storing the object it always stored, and the
|
|
28
28
|
* pre-paint script has no sixth value to hold an opinion about.
|
|
@@ -60,7 +60,7 @@ interface PrepaintDefaults {
|
|
|
60
60
|
*/
|
|
61
61
|
styleSet?: StyleSet;
|
|
62
62
|
/**
|
|
63
|
-
* The
|
|
63
|
+
* The paint pack an unstamped page opens on, or omitted for none.
|
|
64
64
|
*
|
|
65
65
|
* The second axis whose absence is a value, and it behaves exactly as
|
|
66
66
|
* `styleSet` does: omitted means the script REMOVES `data-paint` rather than
|
|
@@ -92,12 +92,28 @@ interface PrepaintOptions {
|
|
|
92
92
|
* every returning visitor's first frame in a theme they did not choose.
|
|
93
93
|
*/
|
|
94
94
|
themes?: readonly ThemeManifest[];
|
|
95
|
+
/**
|
|
96
|
+
* The root provider's `fontScale`, when it is not `1` — pass the same number
|
|
97
|
+
* you pass `<ThemeProvider fontScale>`.
|
|
98
|
+
*
|
|
99
|
+
* Every `--cue-text-*` token is `calc(<rung size> * var(--cue-font-scale, 1))`,
|
|
100
|
+
* and a custom property's `var()` is substituted where it is declared. The
|
|
101
|
+
* provider publishes the scale on its own element, but a root that persists
|
|
102
|
+
* restates no rung there until it has restored the visitor's, so until then
|
|
103
|
+
* the type tokens are declared on `<html>` — and without this, `<html>`
|
|
104
|
+
* declares no scale: the first frame sets every word at 1.0x and the restore
|
|
105
|
+
* moves it to the root's. Given, the script writes `--cue-font-scale` on
|
|
106
|
+
* `<html>`, and the root keeps it there once it has hydrated.
|
|
107
|
+
*
|
|
108
|
+
* Omitted or `1`, the script writes nothing and is byte for byte what it was.
|
|
109
|
+
*/
|
|
110
|
+
fontScale?: number;
|
|
95
111
|
}
|
|
96
112
|
/**
|
|
97
113
|
* Build the blocking inline script that stamps `data-theme`, `data-density`,
|
|
98
|
-
* `data-font`, `data-mode`, `data-style` and `color-scheme` on
|
|
99
|
-
* localStorage before the first paint, and removes `data-style`
|
|
100
|
-
* chose
|
|
114
|
+
* `data-font`, `data-mode`, `data-style`, `data-paint` and `color-scheme` on
|
|
115
|
+
* `<html>` from localStorage before the first paint, and removes `data-style`
|
|
116
|
+
* and `data-paint` when nothing chose a set or a pack.
|
|
101
117
|
*
|
|
102
118
|
* Render it as `<script dangerouslySetInnerHTML={{ __html: prepaintScript() }} />`
|
|
103
119
|
* in `<head>`, above everything else. The output never contains `</script>` and
|
package/dist/system/prepaint.js
CHANGED
|
@@ -50,6 +50,8 @@ function prepaintScript(storageKeyOrOptions = DEFAULT_STORAGE_KEY, defaultTheme
|
|
|
50
50
|
const storageKey = options.storageKey ?? "cue-ui";
|
|
51
51
|
if (typeof storageKey !== "string") throw new TypeError("prepaintScript storageKey must be a string");
|
|
52
52
|
const readStoredPreferences = options.readStoredPreferences ?? true;
|
|
53
|
+
const fontScale = options.fontScale ?? 1;
|
|
54
|
+
if (typeof fontScale !== "number" || !Number.isFinite(fontScale) || fontScale <= 0) throw new TypeError(`prepaintScript fontScale must be a positive number, not ${String(fontScale)}`);
|
|
53
55
|
const key = jsStringLiteral(storageKey);
|
|
54
56
|
const fallbackTheme = jsStringLiteral(defaults.theme);
|
|
55
57
|
const fallbackDensity = jsStringLiteral(defaults.density ?? vocab.preferredDensity(defaults.theme));
|
|
@@ -120,7 +122,7 @@ function prepaintScript(storageKeyOrOptions = DEFAULT_STORAGE_KEY, defaultTheme
|
|
|
120
122
|
*/
|
|
121
123
|
const paints = scriptSafe(JSON.stringify([...PAINTS]));
|
|
122
124
|
const fallbackPaint = defaults.paint === void 0 ? "null" : jsStringLiteral(defaults.paint);
|
|
123
|
-
return `!function(){try{var k=${key},e=document.documentElement,s=null;` + (readStoredPreferences ? "try{var r=localStorage.getItem(k);s=r?JSON.parse(r):null}catch(_){}" : "") + `s=s&&typeof s=="object"?s:{};var T=${themes},A=${axes},P=/^[a-z][a-z0-9-]*$/i;var t=T?(T.indexOf(s.theme)>-1?s.theme:${fallbackTheme}):(typeof s.theme=="string"&&P.test(s.theme)?s.theme:${fallbackTheme});var a=A[T?t:""]||A[""]||{d:[],f:[]};var d=a.d.indexOf(s.density)>-1?s.density:(a.d.indexOf(${fallbackDensity})>-1?${fallbackDensity}:(a.p&&a.d.indexOf(a.p)>-1?a.p:${baseDensity}));var f=a.f.indexOf(s.font)>-1?s.font:(a.f.indexOf(${fallbackFont})>-1?${fallbackFont}:(a.q&&a.f.indexOf(a.q)>-1?a.q:${baseFont}));var m=${modes}.indexOf(s.mode)>-1?s.mode:${fallbackMode};var S=${styleSets},y=S.indexOf(s.style)>-1?s.style:${fallbackStyleSet};var G=${paints},g=G.indexOf(s.paint)>-1?s.paint:${fallbackPaint};e.setAttribute("data-theme",t);e.setAttribute("data-density",d);e.setAttribute("data-font",f);e.setAttribute("data-mode",m);y?e.setAttribute("data-style",y):e.removeAttribute("data-style");g?e.setAttribute("data-paint",g):e.removeAttribute("data-paint")
|
|
125
|
+
return `!function(){try{var k=${key},e=document.documentElement,s=null;` + (readStoredPreferences ? "try{var r=localStorage.getItem(k);s=r?JSON.parse(r):null}catch(_){}" : "") + `s=s&&typeof s=="object"?s:{};var T=${themes},A=${axes},P=/^[a-z][a-z0-9-]*$/i;var t=T?(T.indexOf(s.theme)>-1?s.theme:${fallbackTheme}):(typeof s.theme=="string"&&P.test(s.theme)?s.theme:${fallbackTheme});var a=A[T?t:""]||A[""]||{d:[],f:[]};var d=a.d.indexOf(s.density)>-1?s.density:(a.d.indexOf(${fallbackDensity})>-1?${fallbackDensity}:(a.p&&a.d.indexOf(a.p)>-1?a.p:${baseDensity}));var f=a.f.indexOf(s.font)>-1?s.font:(a.f.indexOf(${fallbackFont})>-1?${fallbackFont}:(a.q&&a.f.indexOf(a.q)>-1?a.q:${baseFont}));var m=${modes}.indexOf(s.mode)>-1?s.mode:${fallbackMode};var S=${styleSets},y=S.indexOf(s.style)>-1?s.style:${fallbackStyleSet};var G=${paints},g=G.indexOf(s.paint)>-1?s.paint:${fallbackPaint};e.setAttribute("data-theme",t);e.setAttribute("data-density",d);e.setAttribute("data-font",f);e.setAttribute("data-mode",m);y?e.setAttribute("data-style",y):e.removeAttribute("data-style");g?e.setAttribute("data-paint",g):e.removeAttribute("data-paint");` + (fontScale === 1 ? "" : `e.style.setProperty("--cue-font-scale",${jsStringLiteral(String(fontScale))});`) + "e.style.colorScheme=a.l===false?\"dark\":(m===\"system\"?\"light dark\":m)}catch(_){}}()";
|
|
124
126
|
}
|
|
125
127
|
//#endregion
|
|
126
128
|
export { DEFAULT_STORAGE_KEY, prepaintScript };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "react";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
//#region src/system/published.ts
|
|
5
|
+
/**
|
|
6
|
+
* One per provider instance and context, for the provider's whole life.
|
|
7
|
+
*
|
|
8
|
+
* Internal.
|
|
9
|
+
*/
|
|
10
|
+
var Overlay = class {
|
|
11
|
+
posted = null;
|
|
12
|
+
listeners = /* @__PURE__ */ new Set();
|
|
13
|
+
subscribe = (listener) => {
|
|
14
|
+
this.listeners.add(listener);
|
|
15
|
+
return () => {
|
|
16
|
+
this.listeners.delete(listener);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/** The value `held` stands for now: its correction if one is posted for it, else its own value. */
|
|
20
|
+
resolve(held) {
|
|
21
|
+
const posted = this.posted;
|
|
22
|
+
return posted !== null && posted.key === held ? posted.value : held.value;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Say that `held` now stands for `value`.
|
|
26
|
+
*
|
|
27
|
+
* Nothing is told when nothing changes for a reader of `held`: a value equal
|
|
28
|
+
* to `held.value` clears only a post made for `held`, and one made for an
|
|
29
|
+
* older key is left alone, because no reader of the current key reads it.
|
|
30
|
+
*/
|
|
31
|
+
post(held, value) {
|
|
32
|
+
const posted = this.posted;
|
|
33
|
+
if (Object.is(value, held.value)) {
|
|
34
|
+
if (posted === null || posted.key !== held) return;
|
|
35
|
+
this.posted = null;
|
|
36
|
+
} else {
|
|
37
|
+
if (posted !== null && posted.key === held && Object.is(posted.value, value)) return;
|
|
38
|
+
this.posted = {
|
|
39
|
+
key: held,
|
|
40
|
+
value
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
for (const listener of [...this.listeners]) listener();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/** A value published once and never corrected: a context's value outside any provider. */
|
|
47
|
+
function published(value) {
|
|
48
|
+
return {
|
|
49
|
+
value,
|
|
50
|
+
server: value,
|
|
51
|
+
overlay: new Overlay()
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function sameInputs(a, b) {
|
|
55
|
+
if (a.length !== b.length) return false;
|
|
56
|
+
for (let i = 0; i < a.length; i += 1) if (!Object.is(a[i], b[i])) return false;
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Publish `value` from a provider.
|
|
61
|
+
*
|
|
62
|
+
* `inputs` are what may move the context: the provider's props and the edits
|
|
63
|
+
* its setters make, and the `Published` objects it read from the providers
|
|
64
|
+
* around it (`React.useContext`, not {@link useRead} — the object, whose
|
|
65
|
+
* identity changes only when theirs did). What must NOT be among them is
|
|
66
|
+
* anything a client-only correction moves: a root's restored state, the OS
|
|
67
|
+
* colour scheme, or a value read through {@link useRead}.
|
|
68
|
+
*
|
|
69
|
+
* When `inputs` change and `value` differs from what readers see now, the
|
|
70
|
+
* published object is new and holds this render's `value`: the context moves,
|
|
71
|
+
* as any context moves when its value does. When `value` is what readers
|
|
72
|
+
* already see — an edit that changed nothing this context carries — the object
|
|
73
|
+
* stays, so a new pack is no news to a reader of the rungs on offer. And when
|
|
74
|
+
* `inputs` did not change and `value` moved anyway, it moved because a
|
|
75
|
+
* correction reached this provider: the object stays, and the new value is
|
|
76
|
+
* posted to the overlay after the commit (the layout phase, still before the
|
|
77
|
+
* browser paints), for the readers below to pick up. A missing input therefore
|
|
78
|
+
* costs a synchronous catch-up render, never a wrong value.
|
|
79
|
+
*
|
|
80
|
+
* `served`, when given, is what this provider's first render put in the
|
|
81
|
+
* server's HTML where that differs from `value` — the one root whose first
|
|
82
|
+
* client render knowingly differs from the server's (see `ThemeProvider`'s
|
|
83
|
+
* pairing). Called once, on mount.
|
|
84
|
+
*/
|
|
85
|
+
function usePublish(value, inputs, served) {
|
|
86
|
+
const [overlay] = React.useState(() => new Overlay());
|
|
87
|
+
const [held, setHeld] = React.useState(() => ({
|
|
88
|
+
inputs,
|
|
89
|
+
published: {
|
|
90
|
+
value,
|
|
91
|
+
server: served === void 0 ? value : served(),
|
|
92
|
+
overlay
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
95
|
+
let current = held.published;
|
|
96
|
+
if (!sameInputs(held.inputs, inputs)) {
|
|
97
|
+
if (!Object.is(value, overlay.resolve(held.published))) current = {
|
|
98
|
+
value,
|
|
99
|
+
server: held.published.server,
|
|
100
|
+
overlay
|
|
101
|
+
};
|
|
102
|
+
setHeld({
|
|
103
|
+
inputs,
|
|
104
|
+
published: current
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
useIsomorphicLayoutEffect(() => {
|
|
108
|
+
overlay.post(current, value);
|
|
109
|
+
});
|
|
110
|
+
return current;
|
|
111
|
+
}
|
|
112
|
+
/** Read what a provider published: against the server's value while hydrating, corrected after. */
|
|
113
|
+
function useRead(context) {
|
|
114
|
+
const held = React.useContext(context);
|
|
115
|
+
return React.useSyncExternalStore(held.overlay.subscribe, () => held.overlay.resolve(held), () => held.server);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Read one slice of what a provider published, and re-render only when that
|
|
119
|
+
* slice changes.
|
|
120
|
+
*
|
|
121
|
+
* `select` must return the same object for the same input — a field of the
|
|
122
|
+
* value, not a copy of it. A reader that needs one part of a larger value (the
|
|
123
|
+
* registered themes, which no restore moves, out of a registry rebuilt for every
|
|
124
|
+
* active theme) then sits out every correction it does not read.
|
|
125
|
+
*/
|
|
126
|
+
function useReadSelected(context, select) {
|
|
127
|
+
const held = React.useContext(context);
|
|
128
|
+
return React.useSyncExternalStore(held.overlay.subscribe, () => select(held.overlay.resolve(held)), () => select(held.server));
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { Overlay, published, usePublish, useRead, useReadSelected };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./published.js";
|
|
1
2
|
import { TokenOverrides } from "./overrides.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { Paint, StyleSet } from "@cueplusplus/tokens";
|
|
@@ -15,7 +16,11 @@ interface ThemeContextValue {
|
|
|
15
16
|
* one a `setTheme` for an unknown preset leaves behind.
|
|
16
17
|
*/
|
|
17
18
|
manifest: ThemeManifest | null;
|
|
18
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Density the *provider* holds — a nested `<Density>` island does not change
|
|
21
|
+
* it. In a nested provider that names none, the rung stamped around it, which
|
|
22
|
+
* is what its subtree inherits.
|
|
23
|
+
*/
|
|
19
24
|
density: Density$1;
|
|
20
25
|
/** Mode as chosen, including the literal `"system"`. */
|
|
21
26
|
mode: Mode;
|
|
@@ -34,7 +39,7 @@ interface ThemeContextValue {
|
|
|
34
39
|
*/
|
|
35
40
|
styleSet: StyleSet | null;
|
|
36
41
|
/**
|
|
37
|
-
* The
|
|
42
|
+
* The paint pack in force on this subtree, or `null`.
|
|
38
43
|
*
|
|
39
44
|
* *In force*, not *named here*, exactly as `styleSet` is: a provider that
|
|
40
45
|
* names no pack reports the one stamped around it, so this and the
|
|
@@ -55,10 +60,11 @@ interface ThemeContextValue {
|
|
|
55
60
|
* Switch the style set this provider names, and persist the preference.
|
|
56
61
|
*
|
|
57
62
|
* `null` means *this provider names none* — not *no set applies*. The
|
|
58
|
-
* provider stops stamping
|
|
59
|
-
* `editorial` page goes back to
|
|
60
|
-
*
|
|
61
|
-
*
|
|
63
|
+
* provider stops stamping a set of its own, so a nested one under an outer
|
|
64
|
+
* `editorial` page goes back to `editorial` — inherited, or restated beside
|
|
65
|
+
* the theme if it names one — and `styleSet` above reports it, because that
|
|
66
|
+
* is what the DOM resolves to. At the root, where nothing is stamped around
|
|
67
|
+
* it, `null` and "no set" coincide.
|
|
62
68
|
*
|
|
63
69
|
* To positively leave an inherited set rather than stop naming one, pass
|
|
64
70
|
* {@link DEFAULT_STYLE_SET}: it stamps an attribute whose block restates the
|
|
@@ -66,7 +72,11 @@ interface ThemeContextValue {
|
|
|
66
72
|
* out-specify an ancestor's in a cascade.
|
|
67
73
|
*/
|
|
68
74
|
setStyleSet: (next: StyleSet | null) => void;
|
|
69
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* Switch the paint pack this provider names, and persist it at the root.
|
|
77
|
+
* `null` clears the attribute; in a nested provider that means following the
|
|
78
|
+
* pack stamped around it again, exactly as `setStyleSet(null)` does.
|
|
79
|
+
*/
|
|
70
80
|
setPaint: (next: Paint | null) => void;
|
|
71
81
|
}
|
|
72
82
|
/** Provider-owned font-family overrides that detached portals must republish. */
|
|
@@ -112,6 +122,13 @@ interface ThemeProviderProps {
|
|
|
112
122
|
/**
|
|
113
123
|
* Initial theme preset. Defaults to the first registered manifest's name, or
|
|
114
124
|
* `"cue"` with nothing registered. Changing it after mount adopts the new value.
|
|
125
|
+
*
|
|
126
|
+
* A nested provider that names **none** holds none: it stamps no
|
|
127
|
+
* `data-theme`, so the theme around it inherits through its element, and
|
|
128
|
+
* `useTheme().theme` inside it — and every portal opened inside it — follows
|
|
129
|
+
* that theme **live**, a theme the root restores from storage after mount
|
|
130
|
+
* included. Naming one makes it this provider's, stamped with the rung and
|
|
131
|
+
* mode in force beside it, whatever the root does.
|
|
115
132
|
*/
|
|
116
133
|
theme?: ThemeName;
|
|
117
134
|
/**
|
|
@@ -126,9 +143,23 @@ interface ThemeProviderProps {
|
|
|
126
143
|
*
|
|
127
144
|
* Changing it after mount adopts the new value; dropping it does not — a
|
|
128
145
|
* parent that stops naming a rung is not asking to move back to the theme's.
|
|
146
|
+
*
|
|
147
|
+
* A nested provider that names **none** follows the rung stamped around it
|
|
148
|
+
* live — the outer provider's, or a `<Density>` island's between them — and
|
|
149
|
+
* stamps none unless it re-themes or re-modes, in which case it restates the
|
|
150
|
+
* rung it follows. Naming one stamps it as a `<Density>` island would.
|
|
129
151
|
*/
|
|
130
152
|
density?: Density$1;
|
|
131
|
-
/**
|
|
153
|
+
/**
|
|
154
|
+
* Initial mode. Defaults to `"dark"` at the root; `"system"` tracks
|
|
155
|
+
* `prefers-color-scheme`.
|
|
156
|
+
*
|
|
157
|
+
* A nested provider that names **none** follows the mode around it live and
|
|
158
|
+
* stamps no `data-mode` or `color-scheme` of its own; `useTheme().mode` and
|
|
159
|
+
* `resolvedMode` inside it report the ambient pair. Naming one stamps it
|
|
160
|
+
* beside the theme in force, because a theme's light block is the compound
|
|
161
|
+
* `[data-theme][data-mode]`.
|
|
162
|
+
*/
|
|
132
163
|
mode?: Mode;
|
|
133
164
|
/**
|
|
134
165
|
* Initial font pairing.
|
|
@@ -146,12 +177,13 @@ interface ThemeProviderProps {
|
|
|
146
177
|
* **Root-level only.** There is no font island: a nested provider forwards
|
|
147
178
|
* this axis to the root, ignores this prop, and its `setFont` drives the root.
|
|
148
179
|
* A page that changed face halfway down is a page with a bug, and a specimen
|
|
149
|
-
* that genuinely wants one — a picker row, a docs page showing all
|
|
180
|
+
* that genuinely wants one — a picker row, a docs page showing all twelve —
|
|
150
181
|
* needs nothing from this library but `data-font` on a `<div>`.
|
|
151
182
|
*/
|
|
152
183
|
font?: FontName;
|
|
153
184
|
/**
|
|
154
|
-
* Page composition for this subtree: `console`, `editorial` or
|
|
185
|
+
* Page composition for this subtree: `console`, `editorial`, `marketing` or
|
|
186
|
+
* `graphite`.
|
|
155
187
|
*
|
|
156
188
|
* **`styleSet`, not `style`.** This interface already has a
|
|
157
189
|
* `style?: React.CSSProperties` a few lines below, applied to the provider
|
|
@@ -171,15 +203,39 @@ interface ThemeProviderProps {
|
|
|
171
203
|
* Like the other three axes this is an *initial* value the provider then holds
|
|
172
204
|
* as state, so `setStyleSet` can drive it; a changed prop is adopted after
|
|
173
205
|
* mount. Unlike the font pairing it has an island form, so a nested provider
|
|
174
|
-
* holds its own rather than handing the axis up to the root.
|
|
206
|
+
* that names a set holds its own rather than handing the axis up to the root.
|
|
207
|
+
*
|
|
208
|
+
* A nested provider that names **none** holds none: the set around it
|
|
209
|
+
* inherits through its element, and `useTheme().styleSet` inside it reports
|
|
210
|
+
* that set **live** — a stored set the root restores after mount, or a later
|
|
211
|
+
* `setStyleSet` at the root, reaches it and its portals. If it names a
|
|
212
|
+
* `theme` or a `mode`, it also restates that set as `data-style` on its
|
|
213
|
+
* element — still the page's set, followed live, never its own — because a
|
|
214
|
+
* set's block declares values that read the theme (a band's rule and
|
|
215
|
+
* ground), and a custom property resolves where it is declared: restated,
|
|
216
|
+
* they resolve against this island's theme instead of the page's.
|
|
175
217
|
*/
|
|
176
218
|
styleSet?: StyleSet;
|
|
177
219
|
/**
|
|
178
|
-
* A
|
|
179
|
-
* `data-paint
|
|
220
|
+
* A paint pack for this subtree. Opt-in: a provider that names none stamps no
|
|
221
|
+
* `data-paint` of its own. A nested one that names none follows the pack
|
|
222
|
+
* stamped around it **live**, through inheritance in the DOM and through
|
|
223
|
+
* `useTheme().paint` and its portals in React — and, if it names a `theme` or
|
|
224
|
+
* a `mode`, restates that pack as `data-paint` on its element, so the pack's
|
|
225
|
+
* strokes and inks (mixes of the theme's colours) resolve against this
|
|
226
|
+
* island's theme rather than the page's. One that names a pack keeps it
|
|
227
|
+
* whatever the root does.
|
|
180
228
|
*/
|
|
181
229
|
paint?: Paint;
|
|
182
|
-
/**
|
|
230
|
+
/**
|
|
231
|
+
* Multiplier on every text token, published as `--cue-font-scale`. Defaults to `1`.
|
|
232
|
+
*
|
|
233
|
+
* At a root that persists, pass the same number to
|
|
234
|
+
* `prepaintScript({ fontScale })`: until the root has restored the visitor's
|
|
235
|
+
* preferences, the type tokens the page reads are declared on `<html>`, and
|
|
236
|
+
* the script is what puts the scale there for the first frame. The root keeps
|
|
237
|
+
* it on `<html>` after that.
|
|
238
|
+
*/
|
|
183
239
|
fontScale?: number;
|
|
184
240
|
/** Optional app-owned font stacks, published as inline CUE font custom properties. */
|
|
185
241
|
fontFamilies?: FontFamilies;
|
|
@@ -199,6 +255,13 @@ interface ThemeProviderProps {
|
|
|
199
255
|
* onto portal containers — which mount on `<body>` and inherit nothing from
|
|
200
256
|
* here. They do not leak *out* of this provider: a nested provider's colour
|
|
201
257
|
* edit is scoped to its own subtree, and to portals opened from inside it.
|
|
258
|
+
* Under a root that persists, the server cannot know the visitor's mode, so
|
|
259
|
+
* until a root has restored, and until a nested provider whose mode is the
|
|
260
|
+
* root's has mounted, the colours are instead one small `<style>` beside this
|
|
261
|
+
* element, keyed on it and on `<html>`'s mode (and on `<html>`'s theme,
|
|
262
|
+
* where that decides the mode): the first frame is the visitor's mode with
|
|
263
|
+
* that mode's edit, never the other mode's. It carries `nonce`; refused by a
|
|
264
|
+
* policy, the edit waits for the mount.
|
|
202
265
|
*
|
|
203
266
|
* **Densities are one document-scoped `<style>` element**, because a rung is
|
|
204
267
|
* selected by attribute rather than inherited, and because
|
|
@@ -244,7 +307,9 @@ interface ThemeProviderProps {
|
|
|
244
307
|
*/
|
|
245
308
|
overrides?: TokenOverrides;
|
|
246
309
|
/**
|
|
247
|
-
* localStorage key holding `{ theme, density, font, mode }
|
|
310
|
+
* localStorage key holding `{ theme, density, font, mode }`, plus `style` when a
|
|
311
|
+
* style set has been chosen and `paint` when a pack has — each omitted, never
|
|
312
|
+
* stored as `null`, when none has. Defaults to `"cue-ui"`.
|
|
248
313
|
* Only the outermost provider reads or writes it — a nested provider is an
|
|
249
314
|
* island whose explicit props are the point, not a second preference store.
|
|
250
315
|
*/
|
|
@@ -252,51 +317,74 @@ interface ThemeProviderProps {
|
|
|
252
317
|
/** Restore and write root preferences in localStorage. Defaults to `true`. */
|
|
253
318
|
persistPreferences?: boolean;
|
|
254
319
|
/**
|
|
255
|
-
* The Content-Security-Policy nonce
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* `style-src
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
320
|
+
* The Content-Security-Policy nonce this provider hands on: to its own
|
|
321
|
+
* density-layer `<style>`, and — through Base UI's `CSPProvider` — to Base
|
|
322
|
+
* UI's scrollbar `<style>` and to the pre-hydration `<script>` a
|
|
323
|
+
* `<Slider thumbAlignment="edge">` renders. List it in `script-src`, and in
|
|
324
|
+
* whichever directive governs style elements: `style-src-elem` if the policy
|
|
325
|
+
* has one, otherwise `style-src`. It does not reach `ThemeConfigurator`'s
|
|
326
|
+
* `<style>` or the application's pre-paint `<script>`.
|
|
327
|
+
*
|
|
328
|
+
* The density layer — one `<style data-cue-overrides>` when
|
|
329
|
+
* `overrides.densities` yields a valid declaration (see
|
|
330
|
+
* {@link ThemeProviderProps.overrides}) — takes its nonce **from this prop
|
|
331
|
+
* alone**: not from an outer `CSPProvider`, and not from an outer
|
|
332
|
+
* `ThemeProvider`. A nested provider that sets its own `overrides.densities`
|
|
333
|
+
* needs its own `nonce`. So does the colour layer — one `<style
|
|
334
|
+
* data-cue-colors-for>` while `overrides.colors` waits on a mode that is
|
|
335
|
+
* `<html>`'s (see {@link ThemeProviderProps.overrides}); refused, the edit
|
|
336
|
+
* applies from the restore or the mount instead of the first frame.
|
|
337
|
+
*
|
|
338
|
+
* Base UI's scrollbar rule gets the nonce wherever React creates it in the
|
|
339
|
+
* browser. **It does not get it in server-rendered HTML** under a framework
|
|
340
|
+
* that hands React a script-only nonce, which includes Next.js 16: React's
|
|
341
|
+
* server renderer (19.2, and the canary Next.js 16 bundles) writes a
|
|
342
|
+
* `precedence` style's nonce only from its render option `nonce: { style }`.
|
|
343
|
+
* Allow that rule by hash, or turn on Base
|
|
344
|
+
* UI's `disableStyleElements` and ship the rule yourself;
|
|
345
|
+
* `docs/CONSUMING.md` §4.5 has both, with the hash.
|
|
273
346
|
*
|
|
274
347
|
* `prepaintScript()` returns a *string* the application renders in a
|
|
275
|
-
* `<script>` of its own
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* `CSPProvider`
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
348
|
+
* `<script>` of its own, so put the same nonce on that element yourself.
|
|
349
|
+
*
|
|
350
|
+
* **An outer `CSPProvider` that sets `disableStyleElements` is switched off
|
|
351
|
+
* inside this provider once a nonce is given.** Base UI's `CSPProvider`
|
|
352
|
+
* builds its context from its own props alone, so the one rendered here
|
|
353
|
+
* *replaces* an outer one rather than extending it. Either leave this prop
|
|
354
|
+
* unset — only when no `overrides.densities` needs it and, wherever a
|
|
355
|
+
* `<Slider thumbAlignment="edge">` renders, the outer provider carries the
|
|
356
|
+
* nonce — or render
|
|
357
|
+
* `<CSPProvider nonce={nonce} disableStyleElements>` again inside this
|
|
358
|
+
* provider's children (with the nonce, or Base UI's pre-hydration script
|
|
359
|
+
* there loses it), and again inside any nested provider given a nonce. An
|
|
360
|
+
* application already rendering its own `CSPProvider` can leave this prop
|
|
361
|
+
* unset: Base UI's pre-hydration script takes the outer nonce, and so does
|
|
362
|
+
* its scrollbar rule wherever React creates it in the browser — the case
|
|
363
|
+
* `base-ui-nonce-outer-provider.test.tsx` pins — but the density layer then
|
|
364
|
+
* has none.
|
|
365
|
+
*
|
|
366
|
+
* **A nonce cannot rescue a style ATTRIBUTE.** This provider's root always
|
|
367
|
+
* carries one — `color-scheme` and `--cue-font-scale`, plus `fontFamilies`,
|
|
368
|
+
* `overrides.colors`, `overrides.fonts` and `style` where given — and many
|
|
369
|
+
* components, and Base UI's form roots, render their own. A policy whose
|
|
370
|
+
* `style-src` (or, without one, `default-src`) does not allow all inline
|
|
371
|
+
* style — a nonce or a hash in it, or no `'unsafe-inline'` — therefore needs
|
|
372
|
+
* an explicit `style-src-attr 'unsafe-inline'`: a nonce or hash in the
|
|
373
|
+
* governing list makes the browser ignore `'unsafe-inline'`. The browser
|
|
374
|
+
* reports a refused attribute as a CSP violation; this library adds no
|
|
375
|
+
* warning of its own.
|
|
297
376
|
*/
|
|
298
377
|
nonce?: string;
|
|
299
|
-
/**
|
|
378
|
+
/**
|
|
379
|
+
* Stamp the single child element instead of rendering a wrapper `<div>`.
|
|
380
|
+
*
|
|
381
|
+
* A nested provider over a host element (`<section>`, `<main>`) behaves as
|
|
382
|
+
* its `<div>` would. Over a component it follows nothing from a persisting
|
|
383
|
+
* root before it mounts: it stamps the root's theme, mode and density from
|
|
384
|
+
* the server's first render, because the re-render that would correct them
|
|
385
|
+
* renders the component again, and a `<Suspense>` boundary the component
|
|
386
|
+
* creates would lose its streamed server HTML to it.
|
|
387
|
+
*/
|
|
300
388
|
asChild?: boolean;
|
|
301
389
|
/** Extra classes for the provider root. */
|
|
302
390
|
className?: string;
|
|
@@ -313,21 +401,41 @@ interface ThemeProviderProps {
|
|
|
313
401
|
*
|
|
314
402
|
* Rendering: `<div data-cue-root data-theme data-density data-mode style={{ colorScheme, --cue-font-scale }}>`
|
|
315
403
|
* (or the single child when `asChild`), plus `data-style` when — and only when —
|
|
316
|
-
* a style set is in force
|
|
404
|
+
* a style set is in force, and `data-paint` on the same terms for a pack. The
|
|
405
|
+
* `theme`/`density`/`font`/`mode`/`styleSet`/`paint` props are
|
|
317
406
|
* *initial* values — the provider holds the state so `setTheme` and friends can
|
|
318
407
|
* drive it — but a changed prop is adopted after mount, so a controlling parent
|
|
319
408
|
* still works.
|
|
320
409
|
*
|
|
410
|
+
* A **nested** provider stamps only what it names. One that names no theme,
|
|
411
|
+
* rung, mode, set or pack follows each of them from around it, live — a
|
|
412
|
+
* preference the root restores after mount, or a setter called at the root,
|
|
413
|
+
* reaches it, its `useTheme()` and its portals — and restates none of them on
|
|
414
|
+
* its element, so inheritance carries the outer attributes through. Naming a
|
|
415
|
+
* theme or a mode stamps theme, rung and mode together (a theme's light block
|
|
416
|
+
* and its rung rules are compound selectors), and restates the set and the pack
|
|
417
|
+
* in force beside them, so their blocks — whose values read the theme — resolve
|
|
418
|
+
* against this element's theme rather than the page's; naming only a rung
|
|
419
|
+
* stamps it as a `<Density>` island does.
|
|
420
|
+
*
|
|
321
421
|
* The font pairing is the one axis that never lands on this element: it has no
|
|
322
422
|
* island form, `<html>` is its only home, and restating it here would shadow the
|
|
323
423
|
* pre-paint stamp for the whole page on the first frame. See the `stamp` object
|
|
324
424
|
* below.
|
|
325
425
|
*
|
|
426
|
+
* The other axes wait for the same reason at a root that persists: its server
|
|
427
|
+
* markup, and its first client render, carry `data-cue-root` and no axis
|
|
428
|
+
* attribute or `color-scheme`, so the page inherits the visitor's stored axes
|
|
429
|
+
* from the pre-paint stamp on `<html>`. The restore lands before the first
|
|
430
|
+
* paint, and the element then states what it restored. Read the document's
|
|
431
|
+
* axes off `<html>`, not off this element, before hydration.
|
|
432
|
+
*
|
|
326
433
|
* Persistence and the pre-paint contract: setters write
|
|
327
434
|
* `{ theme, density, font, mode }` to `localStorage[storageKey]`, plus a `style`
|
|
328
|
-
* key holding the style set when there is one
|
|
329
|
-
*
|
|
330
|
-
*
|
|
435
|
+
* key holding the style set when there is one and a `paint` key holding the pack
|
|
436
|
+
* when there is one — each omitted entirely when there is not, so an application
|
|
437
|
+
* that never touches either axis writes the same four-key object it always
|
|
438
|
+
* wrote. That is exactly what
|
|
331
439
|
* {@link prepaintScript} reads to stamp `<html>` before the first paint. The
|
|
332
440
|
* outermost provider keeps `<html>` in sync while the app runs (and restores the
|
|
333
441
|
* previous stamp on unmount) so the page ground, UA scrollbars and form controls
|