@adea-ai/ui 0.152.4 → 0.154.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +469 -580
- package/dist/NOTICE +10 -1
- package/dist/components/composites/account-menu/account-menu.d.ts +5 -0
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +37 -13
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.d.ts +2 -1
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +92 -66
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +57 -57
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +9 -9
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.d.ts +7 -7
- package/dist/components/composites/appearance-editor/theme-preview.d.ts +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +6 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +36 -36
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +4 -4
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.d.ts.map +1 -1
- package/dist/components/composites/chat/chat.js +33 -37
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts +3 -3
- package/dist/components/composites/checkpoint/checkpoint-model.js +2 -2
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.d.ts +2 -2
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.d.ts +2 -2
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.d.ts +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +7 -3
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -3
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/citation.d.ts +1 -1
- package/dist/components/composites/inline-citation/citation.js +1 -1
- package/dist/components/composites/inline-citation/citation.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts +2 -2
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +22 -22
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.d.ts +5 -0
- package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row.js +75 -83
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.d.ts +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts +19 -5
- package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +263 -29
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/model-selector/models.d.ts +2 -2
- package/dist/components/composites/model-selector/models.js +1 -1
- package/dist/components/composites/model-selector/models.js.map +1 -1
- package/dist/components/composites/plan/plan.d.ts.map +1 -1
- package/dist/components/composites/plan/plan.js +17 -15
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.d.ts.map +1 -1
- package/dist/components/composites/queue/queue.js +5 -7
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.d.ts +4 -4
- package/dist/components/composites/reasoning/reasoning.js +4 -4
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +63 -14
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +32 -32
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/source.d.ts +1 -1
- package/dist/components/composites/sources/source.js.map +1 -1
- package/dist/components/composites/sources/sources.d.ts +2 -2
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/parse-stack-trace.js +4 -4
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.d.ts +3 -3
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.d.ts.map +1 -1
- package/dist/components/composites/stat/stat.js +14 -16
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
- package/dist/components/composites/subagent/subagent.js +6 -4
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/task/task.d.ts +1 -1
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.d.ts +3 -3
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal-model.d.ts +3 -3
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal-model.js +1 -1
- package/dist/components/composites/terminal/terminal-model.js.map +1 -1
- package/dist/components/composites/terminal/terminal.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal.js +24 -11
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results-model.d.ts +4 -4
- package/dist/components/composites/test-results/test-results-model.js +2 -2
- package/dist/components/composites/test-results/test-results-model.js.map +1 -1
- package/dist/components/composites/test-results/test-results.d.ts +1 -1
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.d.ts +4 -4
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.d.ts +1 -1
- package/dist/components/composites/tree/tree.d.ts.map +1 -1
- package/dist/components/composites/tree/tree.js +25 -18
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.d.ts +10 -4
- package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +14 -19
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/index.d.ts +1 -1
- package/dist/components/composites/update-dialog/index.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +4 -5
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.d.ts.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +19 -20
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
- package/dist/components/conversation/busy-send-button.js +18 -20
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/composer-menu.d.ts +3 -3
- package/dist/components/conversation/composer-menu.js +3 -3
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +2 -4
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
- package/dist/components/conversation/conversation-pane.js +6 -5
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +3 -7
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +76 -76
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +32 -38
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.d.ts.map +1 -1
- package/dist/components/conversation/message-row.js +79 -73
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +7 -7
- package/dist/components/conversation/scroll-follow-core.js +4 -4
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +19 -4
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/conversation/thread-panel.d.ts.map +1 -1
- package/dist/components/conversation/thread-panel.js +23 -23
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.d.ts.map +1 -1
- package/dist/components/conversation/transcript-composition.js +2 -2
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.d.ts +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +4 -6
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/page/page.d.ts.map +1 -1
- package/dist/components/layout/page/page.js +17 -17
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +2 -4
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.d.ts.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +16 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail-context.d.ts +1 -1
- package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +62 -57
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +23 -23
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +25 -7
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +2 -2
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.d.ts +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +15 -14
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/motion/presence.d.ts +2 -2
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts +5 -5
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.d.ts +1 -1
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/theme-catalogue-source.d.ts +2 -2
- package/dist/components/theme/theme-catalogue-source.js +2 -2
- package/dist/components/theme/theme-catalogue-source.js.map +1 -1
- package/dist/components/theme/theme-context.d.ts +2 -2
- package/dist/components/theme/theme-context.js +3 -3
- package/dist/components/theme/theme-context.js.map +1 -1
- package/dist/components/theme/theme-document.d.ts.map +1 -1
- package/dist/components/theme/theme-document.js +14 -9
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-picker.d.ts +5 -5
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.d.ts +0 -6
- package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
- package/dist/components/theme/theme-provider-value.js +9 -3
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-script.d.ts +14 -0
- package/dist/components/theme/theme-script.d.ts.map +1 -1
- package/dist/components/theme/theme-script.js +1 -0
- package/dist/components/theme/theme-script.js.map +1 -1
- package/dist/components/theme/theme-state.d.ts +7 -7
- package/dist/components/theme/theme-state.js.map +1 -1
- package/dist/components/theme/theme-toggle.d.ts +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/alert/alert.d.ts.map +1 -1
- package/dist/components/ui/alert/alert.js +4 -3
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +3 -3
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.d.ts.map +1 -1
- package/dist/components/ui/board/board.js +10 -6
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/bubble/bubble.d.ts.map +1 -1
- package/dist/components/ui/bubble/bubble.js +6 -4
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/button-group/button-group.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.js +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +6 -6
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.d.ts +4 -4
- package/dist/components/ui/callout/callout.js +4 -4
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.d.ts +2 -2
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.d.ts +4 -4
- package/dist/components/ui/carousel/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart-options.d.ts +7 -7
- package/dist/components/ui/chart/chart-options.js +9 -9
- package/dist/components/ui/chart/chart-options.js.map +1 -1
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js +16 -7
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +8 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +8 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/command/command.d.ts +4 -4
- package/dist/components/ui/command/command.js +4 -4
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.js +13 -13
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.d.ts +0 -4
- package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +17 -1
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +4 -3
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.d.ts +6 -6
- package/dist/components/ui/diff-block/diff-block.js +3 -3
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts +3 -3
- package/dist/components/ui/drawer/drawer.js +2 -2
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +5 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -1
- package/dist/components/ui/empty/empty-state.js +33 -36
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.d.ts +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +7 -7
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +15 -15
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.d.ts +1 -1
- package/dist/components/ui/field/number-field.js +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.d.ts +1 -1
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input-group/input-group.d.ts +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.d.ts +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.d.ts.map +1 -1
- package/dist/components/ui/item/item.js +26 -26
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.d.ts +25 -12
- package/dist/components/ui/kbd/kbd.d.ts.map +1 -1
- package/dist/components/ui/kbd/kbd.js +44 -13
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/kbd/platform-modifier.d.ts +3 -3
- package/dist/components/ui/kbd/platform-modifier.js +3 -3
- package/dist/components/ui/kbd/platform-modifier.js.map +1 -1
- package/dist/components/ui/label/label.d.ts +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.d.ts.map +1 -1
- package/dist/components/ui/marker/marker.js +17 -19
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts +2 -2
- package/dist/components/ui/menubar/menubar.js +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js +16 -18
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +7 -11
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.d.ts +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +5 -4
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +2 -4
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.d.ts.map +1 -1
- package/dist/components/ui/popover/popover.js +11 -4
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/progress/progress.js +6 -8
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +73 -73
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +12 -6
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts +2 -2
- package/dist/components/ui/resizable/resizable.js +3 -3
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/select/select.d.ts +3 -3
- package/dist/components/ui/select/select.js +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +4 -3
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.d.ts +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.d.ts +1 -1
- package/dist/components/ui/spinner/spinner.js +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.d.ts +13 -13
- package/dist/components/ui/status-chip/status-chip.d.ts.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +11 -11
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +8 -6
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.d.ts +4 -4
- package/dist/components/ui/tabs/tabs.js +4 -4
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/textarea/textarea.d.ts +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.d.ts.map +1 -1
- package/dist/components/ui/toast/toast.js +13 -15
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.js +1 -1
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts +51 -0
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js +103 -0
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +1 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -1
- package/dist/components/ui/tooltip/index.js +3 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +6 -5
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.d.ts.map +1 -1
- package/dist/components/ui/trace/trace.js +17 -17
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.d.ts +3 -3
- package/dist/components/ui/typography/typography.js +5 -5
- package/dist/components/ui/typography/typography.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/lib/accent-presets.d.ts +1 -1
- package/dist/lib/accent-presets.js.map +1 -1
- package/dist/lib/accent-roles.d.ts +2 -2
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/accent-roles.js.map +1 -1
- package/dist/lib/appearance-font-settings.d.ts.map +1 -1
- package/dist/lib/appearance-font-settings.js +15 -7
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/create-poll.d.ts +39 -0
- package/dist/lib/create-poll.d.ts.map +1 -0
- package/dist/lib/create-poll.js +116 -0
- package/dist/lib/create-poll.js.map +1 -0
- package/dist/lib/font-zoom.d.ts +1 -1
- package/dist/lib/font-zoom.js +1 -1
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/keyed-rows.d.ts +2 -1
- package/dist/lib/keyed-rows.d.ts.map +1 -1
- package/dist/lib/keyed-rows.js +3 -2
- package/dist/lib/keyed-rows.js.map +1 -1
- package/dist/lib/overlay.d.ts +6 -6
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +6 -6
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/preference-store.d.ts +2 -2
- package/dist/lib/preference-store.js +2 -2
- package/dist/lib/preference-store.js.map +1 -1
- package/dist/lib/safe-script.d.ts +2 -2
- package/dist/lib/safe-script.js +2 -2
- package/dist/lib/safe-script.js.map +1 -1
- package/dist/lib/scroll-geometry.d.ts +1 -1
- package/dist/lib/scroll-geometry.js +1 -1
- package/dist/lib/scroll-geometry.js.map +1 -1
- package/dist/lib/text.d.ts +1 -1
- package/dist/lib/text.js +1 -1
- package/dist/lib/text.js.map +1 -1
- package/dist/lib/theme-accents.js +3 -3
- package/dist/lib/theme-accents.js.map +1 -1
- package/dist/lib/theme-css.js.map +1 -1
- package/dist/lib/theme-defaults.d.ts +4 -4
- package/dist/lib/theme-defaults.js +4 -4
- package/dist/lib/theme-defaults.js.map +1 -1
- package/dist/lib/theme-engine-light.js.map +1 -1
- package/dist/lib/theme-engine.d.ts +2 -2
- package/dist/lib/theme-engine.js +2 -2
- package/dist/lib/theme-engine.js.map +1 -1
- package/dist/lib/theme-projection.d.ts +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-projection.js.map +1 -1
- package/dist/lib/theme-records.d.ts +2 -2
- package/dist/lib/theme-records.js +2 -2
- package/dist/lib/theme-records.js.map +1 -1
- package/dist/lib/theme-types.d.ts +1 -1
- package/dist/lib/theme-types.js.map +1 -1
- package/dist/lib/themes.d.ts +13 -13
- package/dist/lib/themes.js +13 -13
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts +2 -2
- package/dist/lib/tokens.js +1 -1
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.d.ts +2 -2
- package/dist/lib/tooltip-focus-gate.js +2 -2
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/variants.d.ts +4 -4
- package/dist/lib/variants.js +1 -1
- package/dist/lib/variants.js.map +1 -1
- package/dist/lib/version-notes.d.ts +4 -4
- package/dist/lib/version-notes.js +4 -4
- package/dist/lib/version-notes.js.map +1 -1
- package/dist/lint.js.map +1 -1
- package/dist/r/account-menu.json +1 -0
- package/dist/r/lib.json +5 -0
- package/dist/r/model-selector.json +1 -0
- package/dist/r/registry.json +14 -0
- package/dist/r/side-rail.json +1 -0
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/dist/r/src/components/composites/action-button/action-button.tsx +124 -78
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/dist/r/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/dist/r/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/dist/r/src/components/composites/chat/chat.tsx +15 -9
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/dist/r/src/components/composites/context/context.tsx +2 -2
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/dist/r/src/components/composites/inline-citation/citation.ts +1 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/dist/r/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/dist/r/src/components/composites/list-row/list-row.tsx +69 -73
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +190 -14
- package/dist/r/src/components/composites/model-selector/models.ts +2 -2
- package/dist/r/src/components/composites/plan/plan.tsx +19 -11
- package/dist/r/src/components/composites/queue/queue.tsx +5 -3
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/dist/r/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/dist/r/src/components/composites/settings/settings.tsx +14 -6
- package/dist/r/src/components/composites/sources/source.ts +1 -1
- package/dist/r/src/components/composites/sources/sources.tsx +2 -2
- package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/dist/r/src/components/composites/stat/stat.tsx +20 -16
- package/dist/r/src/components/composites/subagent/subagent.tsx +6 -4
- package/dist/r/src/components/composites/task/task.tsx +1 -1
- package/dist/r/src/components/composites/terminal/ansi.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal-model.ts +3 -3
- package/dist/r/src/components/composites/terminal/terminal.tsx +24 -12
- package/dist/r/src/components/composites/test-results/test-results-model.ts +4 -4
- package/dist/r/src/components/composites/test-results/test-results.tsx +1 -1
- package/dist/r/src/components/composites/tool/tool.tsx +4 -4
- package/dist/r/src/components/composites/tree/tree.tsx +31 -15
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/dist/r/src/components/composites/update-dialog/index.ts +1 -0
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/dist/r/src/components/conversation/busy-send-button.tsx +6 -2
- package/dist/r/src/components/conversation/composer-menu.tsx +3 -3
- package/dist/r/src/components/conversation/conversation-avatar.tsx +1 -1
- package/dist/r/src/components/conversation/conversation-pane.tsx +8 -5
- package/dist/r/src/components/conversation/conversation-surface.tsx +2 -2
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/dist/r/src/components/conversation/message-composer.tsx +4 -6
- package/dist/r/src/components/conversation/message-row.tsx +34 -26
- package/dist/r/src/components/conversation/scroll-follow-core.ts +8 -8
- package/dist/r/src/components/conversation/scroll-follow.ts +24 -8
- package/dist/r/src/components/conversation/thread-panel.tsx +7 -3
- package/dist/r/src/components/conversation/transcript-composition.tsx +4 -2
- package/dist/r/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/dist/r/src/components/layout/page/page.tsx +15 -11
- package/dist/r/src/components/layout/panel/panel.tsx +1 -1
- package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +41 -28
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/dist/r/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +4 -6
- package/dist/r/src/components/motion/presence.tsx +2 -2
- package/dist/r/src/components/theme/appearance-panel.tsx +5 -5
- package/dist/r/src/components/theme/lazy.ts +1 -1
- package/dist/r/src/components/theme/theme-catalogue-source.ts +2 -2
- package/dist/r/src/components/theme/theme-context.ts +3 -3
- package/dist/r/src/components/theme/theme-document.ts +22 -11
- package/dist/r/src/components/theme/theme-picker.tsx +5 -5
- package/dist/r/src/components/theme/theme-provider-value.ts +15 -3
- package/dist/r/src/components/theme/theme-script.ts +20 -0
- package/dist/r/src/components/theme/theme-state.ts +7 -7
- package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
- package/dist/r/src/components/ui/alert/alert.tsx +4 -3
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/dist/r/src/components/ui/badge/badge.tsx +2 -2
- package/dist/r/src/components/ui/board/board.tsx +17 -5
- package/dist/r/src/components/ui/bubble/bubble.tsx +6 -4
- package/dist/r/src/components/ui/button/button.tsx +2 -2
- package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
- package/dist/r/src/components/ui/calendar/calendar.tsx +2 -2
- package/dist/r/src/components/ui/callout/callout.tsx +4 -4
- package/dist/r/src/components/ui/card/card.tsx +2 -2
- package/dist/r/src/components/ui/carousel/carousel.tsx +6 -6
- package/dist/r/src/components/ui/chart/chart-options.ts +9 -9
- package/dist/r/src/components/ui/chart/chart.tsx +14 -1
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/dist/r/src/components/ui/code-block/code-block.tsx +14 -7
- package/dist/r/src/components/ui/command/command.tsx +7 -7
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/dist/r/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/dist/r/src/components/ui/dialog/dialog-layer.tsx +25 -1
- package/dist/r/src/components/ui/dialog/dialog.tsx +4 -3
- package/dist/r/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/dist/r/src/components/ui/drawer/drawer.tsx +3 -3
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/dist/r/src/components/ui/empty/empty-state.tsx +23 -18
- package/dist/r/src/components/ui/empty/empty.tsx +1 -1
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/dist/r/src/components/ui/field/field.tsx +15 -7
- package/dist/r/src/components/ui/field/number-field.tsx +1 -1
- package/dist/r/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/dist/r/src/components/ui/input-group/input-group.tsx +1 -1
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/dist/r/src/components/ui/item/item.tsx +24 -18
- package/dist/r/src/components/ui/kbd/kbd.tsx +55 -14
- package/dist/r/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/dist/r/src/components/ui/label/label.tsx +1 -1
- package/dist/r/src/components/ui/marker/marker.tsx +9 -5
- package/dist/r/src/components/ui/menubar/menubar.tsx +2 -2
- package/dist/r/src/components/ui/message/message.tsx +14 -13
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/dist/r/src/components/ui/native-select/native-select.tsx +1 -1
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/dist/r/src/components/ui/pagination/pagination.tsx +1 -1
- package/dist/r/src/components/ui/popover/popover.tsx +4 -2
- package/dist/r/src/components/ui/progress/progress.tsx +5 -3
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/dist/r/src/components/ui/resizable/resizable.tsx +5 -5
- package/dist/r/src/components/ui/select/select.tsx +4 -4
- package/dist/r/src/components/ui/sheet/sheet.tsx +4 -3
- package/dist/r/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/dist/r/src/components/ui/slider/slider.tsx +1 -1
- package/dist/r/src/components/ui/spinner/spinner.tsx +1 -1
- package/dist/r/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/dist/r/src/components/ui/switch/switch.tsx +9 -6
- package/dist/r/src/components/ui/tabs/tabs.tsx +4 -4
- package/dist/r/src/components/ui/textarea/textarea.tsx +1 -1
- package/dist/r/src/components/ui/toast/toast.tsx +6 -4
- package/dist/r/src/components/ui/toggle/toggle.tsx +1 -1
- package/dist/r/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/dist/r/src/components/ui/tooltip/index.ts +1 -0
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/dist/r/src/components/ui/trace/trace.tsx +13 -9
- package/dist/r/src/components/ui/typography/typography.tsx +5 -5
- package/dist/r/src/lib/accent-presets.ts +1 -1
- package/dist/r/src/lib/accent-roles.ts +2 -2
- package/dist/r/src/lib/appearance-font-settings.ts +18 -7
- package/dist/r/src/lib/create-poll.ts +150 -0
- package/dist/r/src/lib/font-zoom.ts +3 -3
- package/dist/r/src/lib/keyed-rows.ts +3 -2
- package/dist/r/src/lib/overlay.ts +6 -6
- package/dist/r/src/lib/preference-store.ts +2 -2
- package/dist/r/src/lib/safe-script.ts +2 -2
- package/dist/r/src/lib/scroll-geometry.ts +1 -1
- package/dist/r/src/lib/text.ts +1 -1
- package/dist/r/src/lib/theme-accents.ts +3 -3
- package/dist/r/src/lib/theme-css.ts +2 -2
- package/dist/r/src/lib/theme-defaults.ts +4 -4
- package/dist/r/src/lib/theme-engine-light.ts +2 -2
- package/dist/r/src/lib/theme-engine.ts +2 -2
- package/dist/r/src/lib/theme-projection.ts +2 -2
- package/dist/r/src/lib/theme-records.ts +2 -2
- package/dist/r/src/lib/theme-types.ts +1 -1
- package/dist/r/src/lib/themes.ts +14 -14
- package/dist/r/src/lib/tokens.ts +2 -2
- package/dist/r/src/lib/tooltip-focus-gate.ts +11 -11
- package/dist/r/src/lib/utils.ts +1 -1
- package/dist/r/src/lib/variants.ts +4 -4
- package/dist/r/src/lib/version-notes.ts +4 -4
- package/dist/r/src/styles/base.css +12 -43
- package/dist/r/src/styles/fonts.css +1 -1
- package/dist/r/src/styles/theme.css +35 -35
- package/dist/r/tooltip.json +5 -0
- package/dist/r/top-bar.json +1 -0
- package/package.json +2 -1
- package/registry.json +14 -0
- package/src/components/composites/account-menu/account-menu.tsx +22 -2
- package/src/components/composites/action-button/action-button.tsx +124 -78
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
- package/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
- package/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
- package/src/components/composites/appearance-editor/appearance-types.ts +7 -7
- package/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
- package/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
- package/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
- package/src/components/composites/chat/chat.tsx +15 -9
- package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
- package/src/components/composites/checkpoint/checkpoint.tsx +2 -2
- package/src/components/composites/confirmation/confirmation.tsx +8 -4
- package/src/components/composites/context/context.tsx +2 -2
- package/src/components/composites/file-tree/build-file-tree.ts +1 -1
- package/src/components/composites/file-tree/file-tree.tsx +16 -2
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/src/components/composites/inline-citation/citation.ts +1 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +2 -2
- package/src/components/composites/list-row/list-row-control.tsx +31 -22
- package/src/components/composites/list-row/list-row.tsx +69 -73
- package/src/components/composites/message-scroller/message-scroller.tsx +1 -1
- package/src/components/composites/model-selector/model-selector.tsx +190 -14
- package/src/components/composites/model-selector/models.ts +2 -2
- package/src/components/composites/plan/plan.tsx +19 -11
- package/src/components/composites/queue/queue.tsx +5 -3
- package/src/components/composites/reasoning/reasoning.tsx +4 -4
- package/src/components/composites/settings/settings-navigation.tsx +57 -17
- package/src/components/composites/settings/settings.tsx +14 -6
- package/src/components/composites/sources/source.ts +1 -1
- package/src/components/composites/sources/sources.tsx +2 -2
- package/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
- package/src/components/composites/stack-trace/stack-trace.tsx +3 -3
- package/src/components/composites/stat/stat.tsx +20 -16
- package/src/components/composites/subagent/subagent.tsx +6 -4
- package/src/components/composites/task/task.tsx +1 -1
- package/src/components/composites/terminal/ansi.ts +3 -3
- package/src/components/composites/terminal/terminal-model.ts +3 -3
- package/src/components/composites/terminal/terminal.tsx +24 -12
- package/src/components/composites/test-results/test-results-model.ts +4 -4
- package/src/components/composites/test-results/test-results.tsx +1 -1
- package/src/components/composites/tool/tool.tsx +4 -4
- package/src/components/composites/tree/tree.tsx +31 -15
- package/src/components/composites/update-dialog/channel-control.tsx +17 -8
- package/src/components/composites/update-dialog/index.ts +1 -0
- package/src/components/composites/update-dialog/update-dialog.tsx +7 -7
- package/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
- package/src/components/conversation/busy-send-button.tsx +6 -2
- package/src/components/conversation/composer-menu.tsx +3 -3
- package/src/components/conversation/conversation-avatar.tsx +1 -1
- package/src/components/conversation/conversation-pane.tsx +8 -5
- package/src/components/conversation/conversation-surface.tsx +2 -2
- package/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
- package/src/components/conversation/message-composer.tsx +4 -6
- package/src/components/conversation/message-row.tsx +34 -26
- package/src/components/conversation/scroll-follow-core.ts +8 -8
- package/src/components/conversation/scroll-follow.ts +24 -8
- package/src/components/conversation/thread-panel.tsx +7 -3
- package/src/components/conversation/transcript-composition.tsx +4 -2
- package/src/components/layout/app-shell/app-shell.tsx +1 -1
- package/src/components/layout/app-shell/skip-link.tsx +3 -2
- package/src/components/layout/page/page.tsx +15 -11
- package/src/components/layout/panel/panel.tsx +1 -1
- package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
- package/src/components/layout/side-rail/side-rail-context.ts +1 -1
- package/src/components/layout/side-rail/side-rail.tsx +41 -28
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
- package/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
- package/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
- package/src/components/layout/split-layout/split-layout.tsx +6 -2
- package/src/components/layout/status-bar/status-bar.tsx +1 -1
- package/src/components/layout/top-bar/top-bar.tsx +4 -6
- package/src/components/motion/presence.tsx +2 -2
- package/src/components/theme/appearance-panel.tsx +5 -5
- package/src/components/theme/lazy.ts +1 -1
- package/src/components/theme/theme-catalogue-source.ts +2 -2
- package/src/components/theme/theme-context.ts +3 -3
- package/src/components/theme/theme-document.ts +22 -11
- package/src/components/theme/theme-picker.tsx +5 -5
- package/src/components/theme/theme-provider-value.ts +15 -3
- package/src/components/theme/theme-script.ts +20 -0
- package/src/components/theme/theme-state.ts +7 -7
- package/src/components/theme/theme-toggle.tsx +1 -1
- package/src/components/ui/alert/alert.tsx +4 -3
- package/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
- package/src/components/ui/badge/badge.tsx +2 -2
- package/src/components/ui/board/board.tsx +17 -5
- package/src/components/ui/bubble/bubble.tsx +6 -4
- package/src/components/ui/button/button.tsx +2 -2
- package/src/components/ui/button-group/button-group.tsx +1 -1
- package/src/components/ui/calendar/calendar.tsx +2 -2
- package/src/components/ui/callout/callout.tsx +4 -4
- package/src/components/ui/card/card.tsx +2 -2
- package/src/components/ui/carousel/carousel.tsx +6 -6
- package/src/components/ui/chart/chart-options.ts +9 -9
- package/src/components/ui/chart/chart.tsx +14 -1
- package/src/components/ui/checkbox/checkbox.tsx +9 -6
- package/src/components/ui/code-block/code-block.tsx +14 -7
- package/src/components/ui/command/command.tsx +7 -7
- package/src/components/ui/context-menu/context-menu.tsx +1 -1
- package/src/components/ui/detail-panel/detail-panel.tsx +5 -3
- package/src/components/ui/dialog/dialog-layer.tsx +25 -1
- package/src/components/ui/dialog/dialog.tsx +4 -3
- package/src/components/ui/diff-block/diff-block.tsx +6 -6
- package/src/components/ui/drawer/drawer.tsx +3 -3
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
- package/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
- package/src/components/ui/empty/empty-state.tsx +23 -18
- package/src/components/ui/empty/empty.tsx +1 -1
- package/src/components/ui/entity-icon/entity-icon.tsx +5 -1
- package/src/components/ui/field/field.tsx +15 -7
- package/src/components/ui/field/number-field.tsx +1 -1
- package/src/components/ui/hover-card/hover-card.tsx +1 -1
- package/src/components/ui/input-group/input-group.tsx +1 -1
- package/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/src/components/ui/item/item.tsx +24 -18
- package/src/components/ui/kbd/kbd.tsx +55 -14
- package/src/components/ui/kbd/platform-modifier.ts +3 -3
- package/src/components/ui/label/label.tsx +1 -1
- package/src/components/ui/marker/marker.tsx +9 -5
- package/src/components/ui/menubar/menubar.tsx +2 -2
- package/src/components/ui/message/message.tsx +14 -13
- package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
- package/src/components/ui/native-select/native-select.tsx +1 -1
- package/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
- package/src/components/ui/pagination/pagination.tsx +1 -1
- package/src/components/ui/popover/popover.tsx +4 -2
- package/src/components/ui/progress/progress.tsx +5 -3
- package/src/components/ui/questionnaire/questionnaire.tsx +10 -5
- package/src/components/ui/radio-group/radio-group.tsx +9 -6
- package/src/components/ui/resizable/resizable.tsx +5 -5
- package/src/components/ui/select/select.tsx +4 -4
- package/src/components/ui/sheet/sheet.tsx +4 -3
- package/src/components/ui/skeleton/skeleton.tsx +1 -1
- package/src/components/ui/slider/slider.tsx +1 -1
- package/src/components/ui/spinner/spinner.tsx +1 -1
- package/src/components/ui/status-chip/status-chip.tsx +13 -13
- package/src/components/ui/switch/switch.tsx +9 -6
- package/src/components/ui/tabs/tabs.tsx +4 -4
- package/src/components/ui/textarea/textarea.tsx +1 -1
- package/src/components/ui/toast/toast.tsx +6 -4
- package/src/components/ui/toggle/toggle.tsx +1 -1
- package/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
- package/src/components/ui/tooltip/index.ts +1 -0
- package/src/components/ui/tooltip/tooltip.tsx +6 -4
- package/src/components/ui/trace/trace.tsx +13 -9
- package/src/components/ui/typography/typography.tsx +5 -5
- package/src/index.ts +1 -0
- package/src/lib/accent-presets.ts +1 -1
- package/src/lib/accent-roles.ts +2 -2
- package/src/lib/appearance-font-settings.ts +18 -7
- package/src/lib/create-poll.ts +150 -0
- package/src/lib/font-zoom.ts +3 -3
- package/src/lib/keyed-rows.ts +3 -2
- package/src/lib/overlay.ts +6 -6
- package/src/lib/preference-store.ts +2 -2
- package/src/lib/safe-script.ts +2 -2
- package/src/lib/scroll-geometry.ts +1 -1
- package/src/lib/text.ts +1 -1
- package/src/lib/theme-accents.ts +3 -3
- package/src/lib/theme-css.ts +2 -2
- package/src/lib/theme-defaults.ts +4 -4
- package/src/lib/theme-engine-light.ts +2 -2
- package/src/lib/theme-engine.ts +2 -2
- package/src/lib/theme-projection.ts +2 -2
- package/src/lib/theme-records.ts +2 -2
- package/src/lib/theme-types.ts +1 -1
- package/src/lib/themes.ts +14 -14
- package/src/lib/tokens.ts +2 -2
- package/src/lib/tooltip-focus-gate.ts +11 -11
- package/src/lib/utils.ts +1 -1
- package/src/lib/variants.ts +4 -4
- package/src/lib/version-notes.ts +4 -4
- package/src/lint/index.ts +1 -1
- package/src/styles/base.css +12 -43
- package/src/styles/fonts.css +1 -1
- package/src/styles/theme.css +35 -35
- package/src/styles/themes/aardvark-blue.css +98 -0
- package/src/styles/themes/aardvark-ink.css +98 -0
- package/src/styles/themes/adea-dark-colorblind.css +98 -0
- package/src/styles/themes/adea-dark-high-contrast.css +98 -0
- package/src/styles/themes/adea-dark.css +47 -0
- package/src/styles/themes/adea-light-colorblind.css +141 -0
- package/src/styles/themes/adea-light-high-contrast.css +141 -0
- package/src/styles/themes/adea-light.css +47 -0
- package/src/styles/themes/ayu-light.css +141 -0
- package/src/styles/themes/ayu-mirage.css +98 -0
- package/src/styles/themes/ayu.css +98 -0
- package/src/styles/themes/catppuccin-frappe.css +98 -0
- package/src/styles/themes/catppuccin-latte.css +141 -0
- package/src/styles/themes/catppuccin-macchiato.css +98 -0
- package/src/styles/themes/catppuccin-mocha.css +98 -0
- package/src/styles/themes/dracula.css +98 -0
- package/src/styles/themes/everforest-dark.css +98 -0
- package/src/styles/themes/everforest-light.css +141 -0
- package/src/styles/themes/gruvbox-dark.css +98 -0
- package/src/styles/themes/gruvbox-light.css +141 -0
- package/src/styles/themes/kanagawa.css +98 -0
- package/src/styles/themes/monokai.css +98 -0
- package/src/styles/themes/nord-light.css +141 -0
- package/src/styles/themes/nord.css +98 -0
- package/src/styles/themes/one-dark.css +98 -0
- package/src/styles/themes/rosepine-dawn.css +141 -0
- package/src/styles/themes/rosepine-moon.css +98 -0
- package/src/styles/themes/rosepine.css +98 -0
- package/src/styles/themes/solarized-dark.css +98 -0
- package/src/styles/themes/solarized-light.css +141 -0
- package/src/styles/themes/tokyonight-day.css +141 -0
- package/src/styles/themes/tokyonight-night.css +98 -0
- package/src/styles/themes/tokyonight-storm.css +98 -0
- package/src/styles/themes/vesper.css +98 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","names":["splitProps","cva","cn","headingVariants","cardVariants","variants","size","default","sm","flush","defaultVariants","Card","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","CardHeader","_el$2","_tmpl$2","CardTitle","_el$3","_tmpl$3","leading","CardDescription","_el$4","_tmpl$4","CardAction","_el$5","_tmpl$5","CardContent","_el$6","_tmpl$6","CardFooter","_el$7","_tmpl$7"],"sources":["../../../../src/components/ui/card/card.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\nimport { headingVariants } from '../typography'\n\n/**\n * Card.\n *\n * A surface that sits on the canvas. Every card carries its own edge
|
|
1
|
+
{"version":3,"file":"card.js","names":["splitProps","cva","cn","headingVariants","cardVariants","variants","size","default","sm","flush","defaultVariants","Card","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","CardHeader","_el$2","_tmpl$2","CardTitle","_el$3","_tmpl$3","leading","CardDescription","_el$4","_tmpl$4","CardAction","_el$5","_tmpl$5","CardContent","_el$6","_tmpl$6","CardFooter","_el$7","_tmpl$7"],"sources":["../../../../src/components/ui/card/card.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\nimport { headingVariants } from '../typography'\n\n/**\n * Card.\n *\n * A surface that sits on the canvas. Every card carries its own edge, a\n * border, because in the light theme `--card` is one faint step off a white\n * `--background`, and a borderless card there all but disappears. Making the border\n * structural rather than optional is what stops one app's cards from reading\n * as floating panels and another's as nothing at all.\n *\n * The parts are separate components rather than a template because a card's\n * header, content and footer have different padding on purpose: the header and\n * footer are tight, the content breathes.\n *\n * `size` is the card's padding rung, so a caller never sets `p-*` or `gap-*` on\n * a card to make it denser. `sm` tightens the card and its header, content and\n * footer together (the parts' inline padding follows the card, so they stay\n * aligned with each other); `flush` removes the block padding and gap for a\n * card whose body is a list of rows or a scroll area that runs edge to edge.\n */\nexport const cardVariants = cva(\n 'bg-card text-card-foreground flex flex-col rounded-xl border border-border shadow-xs',\n {\n variants: {\n size: {\n /** 16px block padding and gap; the parts carry 16px inline padding. */\n default: 'gap-4 py-4',\n /** 12px everywhere: a dense settings or status card. */\n sm: 'gap-3 py-3 *:data-[slot=card-content]:px-3 *:data-[slot=card-footer]:px-3 *:data-[slot=card-header]:px-3',\n /** No block padding or gap: the card hosts a row list or a scroller. */\n flush: 'gap-0 py-0',\n },\n },\n defaultVariants: { size: 'default' },\n }\n)\n\nexport type CardProps = ComponentProps<'div'> & VariantProps<typeof cardVariants>\n\nexport function Card(props: CardProps) {\n const [local, rest] = splitProps(props, ['class', 'size'])\n return (\n <div data-slot=\"card\" class={cn(cardVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\n/**\n * The header is a grid so that `CardAction` has tracks to be placed in: the\n * action is a direct child that takes a second column spanning the title and\n * description rows. A flex column gives `col-start-2` nothing to land on and\n * the action would simply stack under the copy. The extra column exists only\n * for a direct-child action: a wrapper around it is then the header's single\n * grid item, so it keeps the full width. A header without an action lays out as\n * it always did (one full-width column, 4px between its children).\n */\nexport function CardHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"card-header\"\n class={cn(\n 'grid grid-cols-1 auto-rows-min gap-x-4 gap-y-1 px-4 has-[>[data-slot=card-action]]:grid-cols-[minmax(0,1fr)_auto]',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function CardTitle(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"card-title\"\n class={cn(headingVariants({ size: 'card', leading: 'none' }), local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardDescription(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"card-description\"\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardAction(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"card-action\"\n class={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardContent(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"card-content\" class={cn('px-4', local.class)} {...rest} />\n}\n\nexport function CardFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"card-footer\" class={cn('flex items-center px-4', local.class)} {...rest} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAaI,eAAeH,IAC1B,wFACA;CACEI,UAAU,EACRC,MAAM;;EAEJC,SAAS;;EAETC,IAAI;;EAEJC,OAAO;CACT,EACF;CACAC,iBAAiB,EAAEJ,MAAM,UAAU;AACrC,CACF;AAIA,SAAgBK,KAAKC,OAAkB;CACrC,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO,CAAC,SAAS,MAAM,CAAC;CACzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAC+BhB,GAAGE,aAAa,EAAEE,MAAMO,MAAMP,KAAK,CAAC,GAAGO,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAE9F;;;;;;;;;;AAWA,SAAgBK,WAAWR,OAA8B;CACvD,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAAS,QAAAC,QAAA;EAAAL,OAAAI,OAAAH,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWhB,GACL,qHACAW,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAO;CAAA,EAAA,CAAA;AAGd;AA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AAoB;CAAA,EAAA,CAAA;AAC/E;AAEA,SAAgBE,WAAWxB,OAA8B;CACvD,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAAyB,QAAAC,QAAA;EAAArB,OAAAoB,OAAAnB,WAAA,EAAA,KAAA,WAAA;GAAA,OAA2ChB,GAAG,0BAA0BW,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAuB;CAAA,EAAA,CAAA;AAChG"}
|
|
@@ -4,7 +4,7 @@ import type { EmblaCarouselType } from 'embla-carousel';
|
|
|
4
4
|
* Carousel.
|
|
5
5
|
*
|
|
6
6
|
* A horizontal scroller with snap points, over embla. The primitive owns the
|
|
7
|
-
* physics
|
|
7
|
+
* physics, momentum, snapping, drag, and this owns the two things a carousel
|
|
8
8
|
* always needs and embla deliberately leaves to the caller: a keyboard path and a
|
|
9
9
|
* way to tell how far along you are.
|
|
10
10
|
*
|
|
@@ -18,8 +18,8 @@ import type { EmblaCarouselType } from 'embla-carousel';
|
|
|
18
18
|
*
|
|
19
19
|
* `orientation="vertical"` exists because embla supports it and a vertical
|
|
20
20
|
* carousel is what a short list of cards becomes on a phone. It is a prop rather
|
|
21
|
-
* than a second component because every part
|
|
22
|
-
* buttons, the dots
|
|
21
|
+
* than a second component because every part, the track, the previous/next
|
|
22
|
+
* buttons, the dots, has the same relationship to the axis.
|
|
23
23
|
*
|
|
24
24
|
* The dot indicators are buttons, not spans: a carousel with twelve slides and a
|
|
25
25
|
* "go to slide 7" affordance is the only way to reach the seventh without
|
|
@@ -40,7 +40,7 @@ export type CarouselProps = {
|
|
|
40
40
|
loop?: boolean;
|
|
41
41
|
/** Show the previous/next controls. */
|
|
42
42
|
controls?: boolean;
|
|
43
|
-
/** Show the dot indicators. Off by default
|
|
43
|
+
/** Show the dot indicators. Off by default, a single-slide carousel needs none. */
|
|
44
44
|
dots?: boolean;
|
|
45
45
|
/** Accessible names. Override for a non-English application. */
|
|
46
46
|
previousLabel?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/carousel/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAEjG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAKvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG;IAC1B,8EAA8E;IAC9E,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,yEAAyE;IACzE,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,mFAAmF;IACnF,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/carousel/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAEjG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAKvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG;IAC1B,8EAA8E;IAC9E,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,yEAAyE;IACzE,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,mFAAmF;IACnF,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mFAAmF;IACnF,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACpC,mEAAmE;IACnE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,eA4H5C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,eAWA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","names":["createEffect","createSignal","For","onCleanup","Show","splitProps","createEmblaCarousel","ChevronLeft","ChevronRight","cn","Button","children","orientation","slidesToShow","align","loop","controls","dots","previousLabel","nextLabel","dotLabel","index","onApi","api","class","Carousel","props","local","rest","emblaRef","embla","axis","slidesToScroll","containScroll","selected","setSelected","count","setCount","canPrev","setCanPrev","canNext","setCanNext","sync","selectedScrollSnap","canScrollPrev","canScrollNext","scrollSnapList","length","on","off","_el$","_tmpl$3","_el$2","firstChild","_el$3","_$spread","_$mergeProps","_$use","_$insert","_$createComponent","when","_el$4","_tmpl$2","variant","size","disabled","onClick","scrollPrev","_el$5","_tmpl$","each","Array","from","_","_el$6","_tmpl$4","$$click","scrollTo","_$effect","_p$","_v$3","_v$4","_v$5","undefined","e","_$className","t","_$setAttribute","a","scrollNext","_v$","_v$2","CarouselSlide","_el$7","_tmpl$5","_v$6","_v$7","_$setStyleProperty","_$delegateEvents"],"sources":["../../../../src/components/ui/carousel/carousel.tsx"],"sourcesContent":["import { createEffect, createSignal, For, onCleanup, Show, splitProps, type JSX } from 'solid-js'\nimport createEmblaCarousel from 'embla-carousel-solid'\nimport type { EmblaCarouselType } from 'embla-carousel'\nimport { ChevronLeft, ChevronRight } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n/**\n * Carousel.\n *\n * A horizontal scroller with snap points, over embla. The primitive owns the\n * physics — momentum, snapping, drag — and this owns the two things a carousel\n * always needs and embla deliberately leaves to the caller: a keyboard path and a\n * way to tell how far along you are.\n *\n * **It is a scroll container, not a slide show.** `slidesToScroll` defaults to 1\n * and the track is keyboard-focusable, so arrow keys move between slides and a\n * slide that contains a link stays reachable. A carousel that hijacks the arrow\n * keys or hides its off-screen slides from the tab order is the standard\n * accessibility failure of this component, and both are avoided here by not\n * disabling anything: the slides stay in the DOM and in the tab order, and the\n * container scrolls.\n *\n * `orientation=\"vertical\"` exists because embla supports it and a vertical\n * carousel is what a short list of cards becomes on a phone. It is a prop rather\n * than a second component because every part — the track, the previous/next\n * buttons, the dots — has the same relationship to the axis.\n *\n * The dot indicators are buttons, not spans: a carousel with twelve slides and a\n * \"go to slide 7\" affordance is the only way to reach the seventh without\n * dragging through six. Each is labelled, because a row of unlabelled dots is a\n * row of identical controls to a screen reader.\n */\n\nexport type CarouselApi = EmblaCarouselType\n\nexport type CarouselProps = {\n /** The slides. Each is wrapped in its own element so embla can measure it. */\n children: JSX.Element\n /** The axis. Vertical is what a card list becomes on a narrow screen. */\n orientation?: 'horizontal' | 'vertical'\n /** How many slides are visible at once. */\n slidesToShow?: number\n /** Align the active slide to the start, centre, or end of the viewport. */\n align?: 'start' | 'center' | 'end'\n /** Whether dragging past the ends loops. Off by default: a loop hides the ends. */\n loop?: boolean\n /** Show the previous/next controls. */\n controls?: boolean\n /** Show the dot indicators. Off by default — a single-slide carousel needs none. */\n dots?: boolean\n /** Accessible names. Override for a non-English application. */\n previousLabel?: string\n nextLabel?: string\n /** The label for a dot, given a zero-based index. */\n dotLabel?: (index: number) => string\n /** Receives the embla API, for a caller that needs to drive it. */\n onApi?: (api: CarouselApi) => void\n class?: string\n}\n\nexport function Carousel(props: CarouselProps) {\n const [local, rest] = splitProps(props, [\n 'children',\n 'orientation',\n 'slidesToShow',\n 'align',\n 'loop',\n 'controls',\n 'dots',\n 'previousLabel',\n 'nextLabel',\n 'dotLabel',\n 'onApi',\n 'class',\n ])\n\n const orientation = () => local.orientation ?? 'horizontal'\n\n // The first element of the tuple is the ref setter, the second the accessor —\n // so `ref={emblaRef}` is the whole wiring.\n const [emblaRef, embla] = createEmblaCarousel(() => ({\n axis: orientation() === 'vertical' ? 'y' : 'x',\n loop: local.loop ?? false,\n align: local.align ?? 'start',\n slidesToScroll: 1,\n containScroll: 'trimSnaps',\n }))\n\n const [selected, setSelected] = createSignal(0)\n const [count, setCount] = createSignal(0)\n const [canPrev, setCanPrev] = createSignal(false)\n const [canNext, setCanNext] = createSignal(false)\n\n /**\n * The scroll event, not the select event alone: `select` fires on a settle, so a\n * drag in progress would leave the dots behind the thumb. `scroll` covers both.\n */\n createEffect(() => {\n const api = embla()\n if (!api) return\n local.onApi?.(api)\n\n const sync = () => {\n setSelected(api.selectedScrollSnap())\n setCanPrev(api.canScrollPrev())\n setCanNext(api.canScrollNext())\n }\n sync()\n setCount(api.scrollSnapList().length)\n\n api.on('select', sync)\n api.on('scroll', sync)\n api.on('reInit', sync)\n onCleanup(() => {\n api.off('select', sync)\n api.off('scroll', sync)\n api.off('reInit', sync)\n })\n })\n\n return (\n <div\n class={cn('group/carousel relative grid gap-2', local.class)}\n role=\"group\"\n aria-roledescription=\"carousel\"\n {...rest}\n >\n <div\n ref={emblaRef}\n // A scroll container has to be reachable by keyboard — the same\n // requirement the code block's scroller meets.\n tabindex=\"0\"\n class={cn(\n 'scroll-fade overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'\n )}\n aria-label=\"Carousel\"\n >\n <div class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}>\n {local.children}\n </div>\n </div>\n\n <Show when={local.controls ?? true}>\n <div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n </div>\n )\n}\n\n/**\n * One slide. `basis` is what makes `slidesToShow` work: embla measures the slide\n * elements, so a slide that is not sized to a fraction of the viewport would show\n * one per screen regardless of the setting.\n */\nexport function CarouselSlide(props: {\n children: JSX.Element\n /** How many slides share the viewport at this slide's widest breakpoint. */\n slidesToShow?: number\n class?: string\n}) {\n return (\n <div\n class={cn('min-w-0 shrink-0 grow-0', props.class)}\n style={{ 'flex-basis': `${100 / (props.slidesToShow ?? 1)}%` }}\n role=\"group\"\n aria-roledescription=\"slide\"\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AA6DA,SAAgByB,SAASC,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQvB,WAAWqB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMd,oBAAoBe,MAAMf,eAAe;CAI/C,MAAM,CAACiB,UAAUC,SAASxB,2BAA2B;EACnDyB,MAAMnB,YAAY,MAAM,aAAa,MAAM;EAC3CG,MAAMY,MAAMZ,QAAQ;EACpBD,OAAOa,MAAMb,SAAS;EACtBkB,gBAAgB;EAChBC,eAAe;CACjB,EAAE;CAEF,MAAM,CAACC,UAAUC,eAAelC,aAAa,CAAC;CAC9C,MAAM,CAACmC,OAAOC,YAAYpC,aAAa,CAAC;CACxC,MAAM,CAACqC,SAASC,cAActC,aAAa,KAAK;CAChD,MAAM,CAACuC,SAASC,cAAcxC,aAAa,KAAK;;;;;CAMhDD,mBAAmB;EACjB,MAAMuB,MAAMO,MAAM;EAClB,IAAI,CAACP,KAAK;EACVI,MAAML,QAAQC,GAAG;EAEjB,MAAMmB,aAAa;GACjBP,YAAYZ,IAAIoB,mBAAmB,CAAC;GACpCJ,WAAWhB,IAAIqB,cAAc,CAAC;GAC9BH,WAAWlB,IAAIsB,cAAc,CAAC;EAChC;EACAH,KAAK;EACLL,SAASd,IAAIuB,eAAe,CAAC,CAACC,MAAM;EAEpCxB,IAAIyB,GAAG,UAAUN,IAAI;EACrBnB,IAAIyB,GAAG,UAAUN,IAAI;EACrBnB,IAAIyB,GAAG,UAAUN,IAAI;EACrBvC,gBAAgB;GACdoB,IAAI0B,IAAI,UAAUP,IAAI;GACtBnB,IAAI0B,IAAI,UAAUP,IAAI;GACtBnB,IAAI0B,IAAI,UAAUP,IAAI;EACxB,CAAC;CACH,CAAC;CAED,cAAA;EAAA,IAAAQ,OAAAC,QAAA,GAAAC,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OAK3B;CACD,cAAA;EAAA,IAAAmE,QAAAC,QAAA;EAAApC,OAAAmC,aAOKnE,MAAMf,QAAQ;EAAAmE,QAAAC,QAAA;GAAA,IAAAgB,OALRtF,GAAG,2BAA2BiB,MAAMF,KAAK,GAACwE,OAC1B,GAAG,OAAOtE,MAAMb,gBAAgB,GAAE;GAAGkF,SAAAhB,IAAAK,KAAAC,UAAAQ,OAAAd,IAAAK,IAAAW,IAAA;GAAAC,SAAAjB,IAAAO,KAAAW,iBAAAJ,OAAA,cAAAd,IAAAO,IAAAU,IAAA;GAAA,OAAAjB;EAAA,GAAA;GAAAK,GAAAD,KAAAA;GAAAG,GAAAH,KAAAA;EAAA,CAAA;EAAA,OAAAU;CAAA,EAAA,CAAA;AAOlE;AAACK,eAAA,CAAA,OAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"carousel.js","names":["createEffect","createSignal","For","onCleanup","Show","splitProps","createEmblaCarousel","ChevronLeft","ChevronRight","cn","Button","children","orientation","slidesToShow","align","loop","controls","dots","previousLabel","nextLabel","dotLabel","index","onApi","api","class","Carousel","props","local","rest","emblaRef","embla","axis","slidesToScroll","containScroll","selected","setSelected","count","setCount","canPrev","setCanPrev","canNext","setCanNext","sync","selectedScrollSnap","canScrollPrev","canScrollNext","scrollSnapList","length","on","off","_el$","_tmpl$3","_el$2","firstChild","_el$3","_$spread","_$mergeProps","_$use","_$insert","_$createComponent","when","_el$4","_tmpl$2","variant","size","disabled","onClick","scrollPrev","_el$5","_tmpl$","each","Array","from","_","_el$6","_tmpl$4","$$click","scrollTo","_$effect","_p$","_v$3","_v$4","_v$5","undefined","e","_$className","t","_$setAttribute","a","scrollNext","_v$","_v$2","CarouselSlide","_el$7","_tmpl$5","_v$6","_v$7","_$setStyleProperty","_$delegateEvents"],"sources":["../../../../src/components/ui/carousel/carousel.tsx"],"sourcesContent":["import { createEffect, createSignal, For, onCleanup, Show, splitProps, type JSX } from 'solid-js'\nimport createEmblaCarousel from 'embla-carousel-solid'\nimport type { EmblaCarouselType } from 'embla-carousel'\nimport { ChevronLeft, ChevronRight } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n/**\n * Carousel.\n *\n * A horizontal scroller with snap points, over embla. The primitive owns the\n * physics, momentum, snapping, drag, and this owns the two things a carousel\n * always needs and embla deliberately leaves to the caller: a keyboard path and a\n * way to tell how far along you are.\n *\n * **It is a scroll container, not a slide show.** `slidesToScroll` defaults to 1\n * and the track is keyboard-focusable, so arrow keys move between slides and a\n * slide that contains a link stays reachable. A carousel that hijacks the arrow\n * keys or hides its off-screen slides from the tab order is the standard\n * accessibility failure of this component, and both are avoided here by not\n * disabling anything: the slides stay in the DOM and in the tab order, and the\n * container scrolls.\n *\n * `orientation=\"vertical\"` exists because embla supports it and a vertical\n * carousel is what a short list of cards becomes on a phone. It is a prop rather\n * than a second component because every part, the track, the previous/next\n * buttons, the dots, has the same relationship to the axis.\n *\n * The dot indicators are buttons, not spans: a carousel with twelve slides and a\n * \"go to slide 7\" affordance is the only way to reach the seventh without\n * dragging through six. Each is labelled, because a row of unlabelled dots is a\n * row of identical controls to a screen reader.\n */\n\nexport type CarouselApi = EmblaCarouselType\n\nexport type CarouselProps = {\n /** The slides. Each is wrapped in its own element so embla can measure it. */\n children: JSX.Element\n /** The axis. Vertical is what a card list becomes on a narrow screen. */\n orientation?: 'horizontal' | 'vertical'\n /** How many slides are visible at once. */\n slidesToShow?: number\n /** Align the active slide to the start, centre, or end of the viewport. */\n align?: 'start' | 'center' | 'end'\n /** Whether dragging past the ends loops. Off by default: a loop hides the ends. */\n loop?: boolean\n /** Show the previous/next controls. */\n controls?: boolean\n /** Show the dot indicators. Off by default, a single-slide carousel needs none. */\n dots?: boolean\n /** Accessible names. Override for a non-English application. */\n previousLabel?: string\n nextLabel?: string\n /** The label for a dot, given a zero-based index. */\n dotLabel?: (index: number) => string\n /** Receives the embla API, for a caller that needs to drive it. */\n onApi?: (api: CarouselApi) => void\n class?: string\n}\n\nexport function Carousel(props: CarouselProps) {\n const [local, rest] = splitProps(props, [\n 'children',\n 'orientation',\n 'slidesToShow',\n 'align',\n 'loop',\n 'controls',\n 'dots',\n 'previousLabel',\n 'nextLabel',\n 'dotLabel',\n 'onApi',\n 'class',\n ])\n\n const orientation = () => local.orientation ?? 'horizontal'\n\n // The first element of the tuple is the ref setter, the second the accessor,\n // so `ref={emblaRef}` is the whole wiring.\n const [emblaRef, embla] = createEmblaCarousel(() => ({\n axis: orientation() === 'vertical' ? 'y' : 'x',\n loop: local.loop ?? false,\n align: local.align ?? 'start',\n slidesToScroll: 1,\n containScroll: 'trimSnaps',\n }))\n\n const [selected, setSelected] = createSignal(0)\n const [count, setCount] = createSignal(0)\n const [canPrev, setCanPrev] = createSignal(false)\n const [canNext, setCanNext] = createSignal(false)\n\n /**\n * The scroll event, not the select event alone: `select` fires on a settle, so a\n * drag in progress would leave the dots behind the thumb. `scroll` covers both.\n */\n createEffect(() => {\n const api = embla()\n if (!api) return\n local.onApi?.(api)\n\n const sync = () => {\n setSelected(api.selectedScrollSnap())\n setCanPrev(api.canScrollPrev())\n setCanNext(api.canScrollNext())\n }\n sync()\n setCount(api.scrollSnapList().length)\n\n api.on('select', sync)\n api.on('scroll', sync)\n api.on('reInit', sync)\n onCleanup(() => {\n api.off('select', sync)\n api.off('scroll', sync)\n api.off('reInit', sync)\n })\n })\n\n return (\n <div\n class={cn('group/carousel relative grid gap-2', local.class)}\n role=\"group\"\n aria-roledescription=\"carousel\"\n {...rest}\n >\n <div\n ref={emblaRef}\n // A scroll container has to be reachable by keyboard, the same\n // requirement the code block's scroller meets.\n tabindex=\"0\"\n class={cn(\n 'scroll-fade overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'\n )}\n aria-label=\"Carousel\"\n >\n <div class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}>\n {local.children}\n </div>\n </div>\n\n <Show when={local.controls ?? true}>\n <div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n </div>\n )\n}\n\n/**\n * One slide. `basis` is what makes `slidesToShow` work: embla measures the slide\n * elements, so a slide that is not sized to a fraction of the viewport would show\n * one per screen regardless of the setting.\n */\nexport function CarouselSlide(props: {\n children: JSX.Element\n /** How many slides share the viewport at this slide's widest breakpoint. */\n slidesToShow?: number\n class?: string\n}) {\n return (\n <div\n class={cn('min-w-0 shrink-0 grow-0', props.class)}\n style={{ 'flex-basis': `${100 / (props.slidesToShow ?? 1)}%` }}\n role=\"group\"\n aria-roledescription=\"slide\"\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AA6DA,SAAgByB,SAASC,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQvB,WAAWqB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMd,oBAAoBe,MAAMf,eAAe;CAI/C,MAAM,CAACiB,UAAUC,SAASxB,2BAA2B;EACn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,OAAA,cAAAd,IAAAO,IAAAU,IAAA;GAAA,OAAAjB;EAAA,GAAA;GAAAK,GAAAD,KAAAA;GAAAG,GAAAH,KAAAA;EAAA,CAAA;EAAA,OAAAU;CAAA,EAAA,CAAA;AAOlE;AAACK,eAAA,CAAA,OAAA,CAAA"}
|
|
@@ -4,8 +4,8 @@ import type { ChartOptions } from 'chart.js';
|
|
|
4
4
|
* defaults and the merge rules are testable on their own.
|
|
5
5
|
*
|
|
6
6
|
* Every colour here is written as `var(--token)`. A canvas cannot read a custom
|
|
7
|
-
* property
|
|
8
|
-
* canvas ignores and paints in its default black
|
|
7
|
+
* property, `fillStyle = 'var(--chart-1)'` is an invalid colour, which the
|
|
8
|
+
* canvas ignores and paints in its default black, so these strings are the
|
|
9
9
|
* *declaration* of which token a colour comes from. The components resolve them
|
|
10
10
|
* against their own element at render time (see `resolveCssVariables` and the
|
|
11
11
|
* resolver in `chart.tsx`).
|
|
@@ -23,8 +23,8 @@ export type ChartScaleShape = 'cartesian' | 'radial' | 'none';
|
|
|
23
23
|
* Merge Chart.js options, later sources winning, object by object.
|
|
24
24
|
*
|
|
25
25
|
* Deep, because Chart.js options are deep: `{ scales: { x: { stacked: true } } }`
|
|
26
|
-
* means "also stack x", and a spread would replace the whole axis
|
|
27
|
-
* its tick colour, its font
|
|
26
|
+
* means "also stack x", and a spread would replace the whole axis, its grid,
|
|
27
|
+
* its tick colour, its font, with that one flag. Arrays, functions (scriptable
|
|
28
28
|
* options) and class instances (gradients, patterns) are values and replace
|
|
29
29
|
* rather than merge. No source is mutated.
|
|
30
30
|
*/
|
|
@@ -33,15 +33,15 @@ export declare function mergeChartOptions(...sources: (ChartOptions | undefined)
|
|
|
33
33
|
* The theme's defaults as Chart.js options.
|
|
34
34
|
*
|
|
35
35
|
* Exported so a caller can spread it and change one thing, rather than
|
|
36
|
-
* restating every colour. Everything a chart draws that is not data
|
|
36
|
+
* restating every colour. Everything a chart draws that is not data, grid,
|
|
37
37
|
* ticks, legend, tooltip — is decided here once, which is what makes two charts
|
|
38
38
|
* in one application look like they came from the same place. `overrides` is
|
|
39
39
|
* merged deeply; `shape` selects the scales the chart type has.
|
|
40
40
|
*/
|
|
41
41
|
export declare function chartOptions(overrides?: ChartOptions, shape?: ChartScaleShape): ChartOptions;
|
|
42
42
|
/**
|
|
43
|
-
* Replace every `var(--token)` string in `value
|
|
44
|
-
* arrays
|
|
43
|
+
* Replace every `var(--token)` string in `value`, options, datasets, nested
|
|
44
|
+
* arrays, with what `read` returns for the token, which may be a number (a
|
|
45
45
|
* length token read as pixels). A token `read` cannot
|
|
46
46
|
* resolve falls back to the `var()`'s own fallback, then to the string as
|
|
47
47
|
* written. Functions and class instances pass through untouched, so scriptable
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* defaults and the merge rules are testable on their own.
|
|
5
5
|
*
|
|
6
6
|
* Every colour here is written as `var(--token)`. A canvas cannot read a custom
|
|
7
|
-
* property
|
|
8
|
-
* canvas ignores and paints in its default black
|
|
7
|
+
* property, `fillStyle = 'var(--chart-1)'` is an invalid colour, which the
|
|
8
|
+
* canvas ignores and paints in its default black, so these strings are the
|
|
9
9
|
* *declaration* of which token a colour comes from. The components resolve them
|
|
10
10
|
* against their own element at render time (see `resolveCssVariables` and the
|
|
11
11
|
* resolver in `chart.tsx`).
|
|
@@ -37,8 +37,8 @@ var furniture = {
|
|
|
37
37
|
* The chart's type: the UI face from the font axis and a rung of the type scale,
|
|
38
38
|
* declared as tokens like the colours.
|
|
39
39
|
*
|
|
40
|
-
* Chart.js does not inherit the page's font
|
|
41
|
-
* family
|
|
40
|
+
* Chart.js does not inherit the page's font, it paints in its own default
|
|
41
|
+
* family, so every text a chart draws names `--font-sans` explicitly, and the
|
|
42
42
|
* chart follows `data-font` the same way it follows `.dark`. Everything is
|
|
43
43
|
* `--text-2xs`, the rung `ChartLegend` and the frame's metadata already use, so
|
|
44
44
|
* a canvas legend and an HTML one beside it are the same size.
|
|
@@ -112,8 +112,8 @@ function mergeInto(target, source) {
|
|
|
112
112
|
* Merge Chart.js options, later sources winning, object by object.
|
|
113
113
|
*
|
|
114
114
|
* Deep, because Chart.js options are deep: `{ scales: { x: { stacked: true } } }`
|
|
115
|
-
* means "also stack x", and a spread would replace the whole axis
|
|
116
|
-
* its tick colour, its font
|
|
115
|
+
* means "also stack x", and a spread would replace the whole axis, its grid,
|
|
116
|
+
* its tick colour, its font, with that one flag. Arrays, functions (scriptable
|
|
117
117
|
* options) and class instances (gradients, patterns) are values and replace
|
|
118
118
|
* rather than merge. No source is mutated.
|
|
119
119
|
*/
|
|
@@ -126,7 +126,7 @@ function mergeChartOptions(...sources) {
|
|
|
126
126
|
* The theme's defaults as Chart.js options.
|
|
127
127
|
*
|
|
128
128
|
* Exported so a caller can spread it and change one thing, rather than
|
|
129
|
-
* restating every colour. Everything a chart draws that is not data
|
|
129
|
+
* restating every colour. Everything a chart draws that is not data, grid,
|
|
130
130
|
* ticks, legend, tooltip — is decided here once, which is what makes two charts
|
|
131
131
|
* in one application look like they came from the same place. `overrides` is
|
|
132
132
|
* merged deeply; `shape` selects the scales the chart type has.
|
|
@@ -170,8 +170,8 @@ function chartOptions(overrides, shape = "cartesian") {
|
|
|
170
170
|
}
|
|
171
171
|
var cssVariable = /^\s*var\(\s*(--[\w-]+)\s*(?:,\s*(.*?))?\s*\)\s*$/;
|
|
172
172
|
/**
|
|
173
|
-
* Replace every `var(--token)` string in `value
|
|
174
|
-
* arrays
|
|
173
|
+
* Replace every `var(--token)` string in `value`, options, datasets, nested
|
|
174
|
+
* arrays, with what `read` returns for the token, which may be a number (a
|
|
175
175
|
* length token read as pixels). A token `read` cannot
|
|
176
176
|
* resolve falls back to the `var()`'s own fallback, then to the string as
|
|
177
177
|
* written. Functions and class instances pass through untouched, so scriptable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-options.js","names":[],"sources":["../../../../src/components/ui/chart/chart-options.ts"],"sourcesContent":["import type { ChartOptions } from 'chart.js'\n\n/**\n * The chart's options, as data: no Chart.js runtime and no DOM, so the theme's\n * defaults and the merge rules are testable on their own.\n *\n * Every colour here is written as `var(--token)`. A canvas cannot read a custom\n * property — `fillStyle = 'var(--chart-1)'` is an invalid colour, which the\n * canvas ignores and paints in its default black — so these strings are the\n * *declaration* of which token a colour comes from. The components resolve them\n * against their own element at render time (see `resolveCssVariables` and the\n * resolver in `chart.tsx`).\n */\n\n/** The five series colours, in the order a multi-series chart should use them. */\nexport const chartSeriesColors = [\n 'var(--chart-1)',\n 'var(--chart-2)',\n 'var(--chart-3)',\n 'var(--chart-4)',\n 'var(--chart-5)',\n] as const\n\n/**\n * The chart furniture, mapped onto existing semantic tokens rather than given\n * tokens of its own. A grid line is a line, so it is `--border`; an axis tick and\n * a legend label are secondary text, so they are `--muted-foreground`, whose\n * contrast on `--card` (the frame's surface) is already measured in\n * `tests/tokens.test.ts`. Dedicated `--chart-grid`/`--chart-axis`/`--chart-label`\n * tokens would be three more values to keep in step with these in every theme\n * for no difference anyone has asked for.\n */\nconst furniture = {\n grid: 'var(--border)',\n axis: 'var(--muted-foreground)',\n label: 'var(--muted-foreground)',\n surface: 'var(--card)',\n} as const\n\n/**\n * Which scales a chart type draws. Chart.js creates a scale for every key under\n * `options.scales` whatever the chart type, so cartesian defaults handed to a\n * doughnut draw an x and a y axis and a grid behind it. The shape keeps each\n * type's defaults to the scales it actually has.\n */\nexport type ChartScaleShape = 'cartesian' | 'radial' | 'none'\n\n/**\n * The chart's type: the UI face from the font axis and a rung of the type scale,\n * declared as tokens like the colours.\n *\n * Chart.js does not inherit the page's font — it paints in its own default\n * family — so every text a chart draws names `--font-sans` explicitly, and the\n * chart follows `data-font` the same way it follows `.dark`. Everything is\n * `--text-2xs`, the rung `ChartLegend` and the frame's metadata already use, so\n * a canvas legend and an HTML one beside it are the same size.\n *\n * Chart.js types `size` as a number of pixels. The token is a `rem` length, so\n * it is written as `var(--text-2xs)` here and the component resolves it to\n * pixels with the colours (see `resolveCssVariables` and `chart.tsx`); the cast\n * is that declaration, not a number.\n */\nfunction chartFont(weight?: number) {\n return {\n family: 'var(--font-sans)',\n size: 'var(--text-2xs)' as unknown as number,\n ...(weight === undefined ? {} : { weight }),\n }\n}\n\nconst tickFont = chartFont()\n\nfunction scalesFor(shape: ChartScaleShape): ChartOptions['scales'] {\n if (shape === 'cartesian') {\n return {\n x: {\n border: { color: furniture.grid },\n grid: { color: furniture.grid, drawTicks: false },\n ticks: { color: furniture.axis, font: tickFont },\n },\n y: {\n border: { display: false },\n grid: { color: furniture.grid, drawTicks: false },\n ticks: { color: furniture.axis, font: tickFont },\n },\n }\n }\n if (shape === 'radial') {\n return {\n r: {\n grid: { color: furniture.grid },\n angleLines: { color: furniture.grid },\n pointLabels: { color: furniture.axis, font: tickFont },\n // The default backdrop is a translucent white box, which is a white box\n // on a dark card. The frame's own surface makes it disappear in both.\n ticks: { color: furniture.axis, backdropColor: furniture.surface, font: tickFont },\n },\n }\n }\n return undefined\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null) return false\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null\n}\n\nfunction mergeInto(target: Record<string, unknown>, source: Record<string, unknown>) {\n for (const [key, value] of Object.entries(source)) {\n if (value === undefined) continue\n const current = target[key]\n target[key] =\n isPlainObject(value) && isPlainObject(current)\n ? mergeInto({ ...current }, value)\n : isPlainObject(value)\n ? mergeInto({}, value)\n : value\n }\n return target\n}\n\n/**\n * Merge Chart.js options, later sources winning, object by object.\n *\n * Deep, because Chart.js options are deep: `{ scales: { x: { stacked: true } } }`\n * means \"also stack x\", and a spread would replace the whole axis — its grid,\n * its tick colour, its font — with that one flag. Arrays, functions (scriptable\n * options) and class instances (gradients, patterns) are values and replace\n * rather than merge. No source is mutated.\n */\nexport function mergeChartOptions(...sources: (ChartOptions | undefined)[]): ChartOptions {\n const merged: Record<string, unknown> = {}\n for (const source of sources) {\n if (source) mergeInto(merged, source as Record<string, unknown>)\n }\n return merged as ChartOptions\n}\n\n/**\n * The theme's defaults as Chart.js options.\n *\n * Exported so a caller can spread it and change one thing, rather than\n * restating every colour. Everything a chart draws that is not data — grid,\n * ticks, legend, tooltip — is decided here once, which is what makes two charts\n * in one application look like they came from the same place. `overrides` is\n * merged deeply; `shape` selects the scales the chart type has.\n */\nexport function chartOptions(\n overrides?: ChartOptions,\n shape: ChartScaleShape = 'cartesian'\n): ChartOptions {\n return mergeChartOptions(\n {\n responsive: true,\n maintainAspectRatio: false,\n interaction: { mode: 'nearest', intersect: false },\n plugins: {\n legend: {\n labels: {\n color: furniture.label,\n boxWidth: 8,\n boxHeight: 8,\n usePointStyle: true,\n pointStyle: 'circle',\n font: chartFont(),\n },\n },\n tooltip: {\n backgroundColor: 'var(--popover)',\n titleColor: 'var(--popover-foreground)',\n bodyColor: 'var(--popover-foreground)',\n borderColor: 'var(--border)',\n borderWidth: 1,\n padding: 8,\n cornerRadius: 6,\n displayColors: true,\n boxWidth: 8,\n boxHeight: 8,\n usePointStyle: true,\n titleFont: chartFont(600),\n bodyFont: chartFont(),\n footerFont: chartFont(),\n },\n },\n scales: scalesFor(shape),\n },\n overrides\n )\n}\n\nconst cssVariable = /^\\s*var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.*?))?\\s*\\)\\s*$/\n\n/**\n * Replace every `var(--token)` string in `value` — options, datasets, nested\n * arrays — with what `read` returns for the token, which may be a number (a\n * length token read as pixels). A token `read` cannot\n * resolve falls back to the `var()`'s own fallback, then to the string as\n * written. Functions and class instances pass through untouched, so scriptable\n * options and gradients keep working.\n */\nexport function resolveCssVariables<T>(\n value: T,\n read: (name: string) => string | number | undefined\n): T {\n if (typeof value === 'string') {\n const match = cssVariable.exec(value)\n if (!match) return value\n const resolved = read(match[1]!)\n if (resolved !== undefined && resolved !== '') return resolved as T\n return (match[2] ? resolveCssVariables(match[2], read) : value) as T\n }\n if (Array.isArray(value)) {\n return value.map((entry: unknown) => resolveCssVariables(entry, read)) as T\n }\n if (isPlainObject(value)) {\n const resolved: Record<string, unknown> = {}\n for (const [key, entry] of Object.entries(value)) {\n resolved[key] = resolveCssVariables(entry, read)\n }\n return resolved as T\n }\n return value\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,IAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;AAWA,IAAM,YAAY;CAChB,MAAM;CACN,MAAM;CACN,OAAO;CACP,SAAS;AACX;;;;;;;;;;;;;;;;AAyBA,SAAS,UAAU,QAAiB;CAClC,OAAO;EACL,QAAQ;EACR,MAAM;EACN,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;CAC3C;AACF;AAEA,IAAM,WAAW,UAAU;AAE3B,SAAS,UAAU,OAAgD;CACjE,IAAI,UAAU,aACZ,OAAO;EACL,GAAG;GACD,QAAQ,EAAE,OAAO,UAAU,KAAK;GAChC,MAAM;IAAE,OAAO,UAAU;IAAM,WAAW;GAAM;GAChD,OAAO;IAAE,OAAO,UAAU;IAAM,MAAM;GAAS;EACjD;EACA,GAAG;GACD,QAAQ,EAAE,SAAS,MAAM;GACzB,MAAM;IAAE,OAAO,UAAU;IAAM,WAAW;GAAM;GAChD,OAAO;IAAE,OAAO,UAAU;IAAM,MAAM;GAAS;EACjD;CACF;CAEF,IAAI,UAAU,UACZ,OAAO,EACL,GAAG;EACD,MAAM,EAAE,OAAO,UAAU,KAAK;EAC9B,YAAY,EAAE,OAAO,UAAU,KAAK;EACpC,aAAa;GAAE,OAAO,UAAU;GAAM,MAAM;EAAS;EAGrD,OAAO;GAAE,OAAO,UAAU;GAAM,eAAe,UAAU;GAAS,MAAM;EAAS;CACnF,EACF;AAGJ;AAEA,SAAS,cAAc,OAAkD;CACvE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,YAAY,OAAO,eAAe,KAAK;CAC7C,OAAO,cAAc,OAAO,aAAa,cAAc;AACzD;AAEA,SAAS,UAAU,QAAiC,QAA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AI,IAAI;CAC3D;CACA,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,KAAK,UAAmB,oBAAoB,OAAO,IAAI,CAAC;CAEvE,IAAI,cAAc,KAAK,GAAG;EACxB,MAAM,WAAoC,CAAC;EAC3C,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,SAAS,OAAO,oBAAoB,OAAO,IAAI;EAEjD,OAAO;CACT;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"chart-options.js","names":[],"sources":["../../../../src/components/ui/chart/chart-options.ts"],"sourcesContent":["import type { ChartOptions } from 'chart.js'\n\n/**\n * The chart's options, as data: no Chart.js runtime and no DOM, so the theme's\n * defaults and the merge rules are testable on their own.\n *\n * Every colour here is written as `var(--token)`. A canvas cannot read a custom\n * property, `fillStyle = 'var(--chart-1)'` is an invalid colour, which the\n * canvas ignores and paints in its default black, so these strings are the\n * *declaration* of which token a colour comes from. The components resolve them\n * against their own element at render time (see `resolveCssVariables` and the\n * resolver in `chart.tsx`).\n */\n\n/** The five series colours, in the order a multi-series chart should use them. */\nexport const chartSeriesColors = [\n 'var(--chart-1)',\n 'var(--chart-2)',\n 'var(--chart-3)',\n 'var(--chart-4)',\n 'var(--chart-5)',\n] as const\n\n/**\n * The chart furniture, mapped onto existing semantic tokens rather than given\n * tokens of its own. A grid line is a line, so it is `--border`; an axis tick and\n * a legend label are secondary text, so they are `--muted-foreground`, whose\n * contrast on `--card` (the frame's surface) is already measured in\n * `tests/tokens.test.ts`. Dedicated `--chart-grid`/`--chart-axis`/`--chart-label`\n * tokens would be three more values to keep in step with these in every theme\n * for no difference anyone has asked for.\n */\nconst furniture = {\n grid: 'var(--border)',\n axis: 'var(--muted-foreground)',\n label: 'var(--muted-foreground)',\n surface: 'var(--card)',\n} as const\n\n/**\n * Which scales a chart type draws. Chart.js creates a scale for every key under\n * `options.scales` whatever the chart type, so cartesian defaults handed to a\n * doughnut draw an x and a y axis and a grid behind it. The shape keeps each\n * type's defaults to the scales it actually has.\n */\nexport type ChartScaleShape = 'cartesian' | 'radial' | 'none'\n\n/**\n * The chart's type: the UI face from the font axis and a rung of the type scale,\n * declared as tokens like the colours.\n *\n * Chart.js does not inherit the page's font, it paints in its own default\n * family, so every text a chart draws names `--font-sans` explicitly, and the\n * chart follows `data-font` the same way it follows `.dark`. Everything is\n * `--text-2xs`, the rung `ChartLegend` and the frame's metadata already use, so\n * a canvas legend and an HTML one beside it are the same size.\n *\n * Chart.js types `size` as a number of pixels. The token is a `rem` length, so\n * it is written as `var(--text-2xs)` here and the component resolves it to\n * pixels with the colours (see `resolveCssVariables` and `chart.tsx`); the cast\n * is that declaration, not a number.\n */\nfunction chartFont(weight?: number) {\n return {\n family: 'var(--font-sans)',\n size: 'var(--text-2xs)' as unknown as number,\n ...(weight === undefined ? {} : { weight }),\n }\n}\n\nconst tickFont = chartFont()\n\nfunction scalesFor(shape: ChartScaleShape): ChartOptions['scales'] {\n if (shape === 'cartesian') {\n return {\n x: {\n border: { color: furniture.grid },\n grid: { color: furniture.grid, drawTicks: false },\n ticks: { color: furniture.axis, font: tickFont },\n },\n y: {\n border: { display: false },\n grid: { color: furniture.grid, drawTicks: false },\n ticks: { color: furniture.axis, font: tickFont },\n },\n }\n }\n if (shape === 'radial') {\n return {\n r: {\n grid: { color: furniture.grid },\n angleLines: { color: furniture.grid },\n pointLabels: { color: furniture.axis, font: tickFont },\n // The default backdrop is a translucent white box, which is a white box\n // on a dark card. The frame's own surface makes it disappear in both.\n ticks: { color: furniture.axis, backdropColor: furniture.surface, font: tickFont },\n },\n }\n }\n return undefined\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null) return false\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null\n}\n\nfunction mergeInto(target: Record<string, unknown>, source: Record<string, unknown>) {\n for (const [key, value] of Object.entries(source)) {\n if (value === undefined) continue\n const current = target[key]\n target[key] =\n isPlainObject(value) && isPlainObject(current)\n ? mergeInto({ ...current }, value)\n : isPlainObject(value)\n ? mergeInto({}, value)\n : value\n }\n return target\n}\n\n/**\n * Merge Chart.js options, later sources winning, object by object.\n *\n * Deep, because Chart.js options are deep: `{ scales: { x: { stacked: true } } }`\n * means \"also stack x\", and a spread would replace the whole axis, its grid,\n * its tick colour, its font, with that one flag. Arrays, functions (scriptable\n * options) and class instances (gradients, patterns) are values and replace\n * rather than merge. No source is mutated.\n */\nexport function mergeChartOptions(...sources: (ChartOptions | undefined)[]): ChartOptions {\n const merged: Record<string, unknown> = {}\n for (const source of sources) {\n if (source) mergeInto(merged, source as Record<string, unknown>)\n }\n return merged as ChartOptions\n}\n\n/**\n * The theme's defaults as Chart.js options.\n *\n * Exported so a caller can spread it and change one thing, rather than\n * restating every colour. Everything a chart draws that is not data, grid,\n * ticks, legend, tooltip — is decided here once, which is what makes two charts\n * in one application look like they came from the same place. `overrides` is\n * merged deeply; `shape` selects the scales the chart type has.\n */\nexport function chartOptions(\n overrides?: ChartOptions,\n shape: ChartScaleShape = 'cartesian'\n): ChartOptions {\n return mergeChartOptions(\n {\n responsive: true,\n maintainAspectRatio: false,\n interaction: { mode: 'nearest', intersect: false },\n plugins: {\n legend: {\n labels: {\n color: furniture.label,\n boxWidth: 8,\n boxHeight: 8,\n usePointStyle: true,\n pointStyle: 'circle',\n font: chartFont(),\n },\n },\n tooltip: {\n backgroundColor: 'var(--popover)',\n titleColor: 'var(--popover-foreground)',\n bodyColor: 'var(--popover-foreground)',\n borderColor: 'var(--border)',\n borderWidth: 1,\n padding: 8,\n cornerRadius: 6,\n displayColors: true,\n boxWidth: 8,\n boxHeight: 8,\n usePointStyle: true,\n titleFont: chartFont(600),\n bodyFont: chartFont(),\n footerFont: chartFont(),\n },\n },\n scales: scalesFor(shape),\n },\n overrides\n )\n}\n\nconst cssVariable = /^\\s*var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.*?))?\\s*\\)\\s*$/\n\n/**\n * Replace every `var(--token)` string in `value`, options, datasets, nested\n * arrays, with what `read` returns for the token, which may be a number (a\n * length token read as pixels). A token `read` cannot\n * resolve falls back to the `var()`'s own fallback, then to the string as\n * written. Functions and class instances pass through untouched, so scriptable\n * options and gradients keep working.\n */\nexport function resolveCssVariables<T>(\n value: T,\n read: (name: string) => string | number | undefined\n): T {\n if (typeof value === 'string') {\n const match = cssVariable.exec(value)\n if (!match) return value\n const resolved = read(match[1]!)\n if (resolved !== undefined && resolved !== '') return resolved as T\n return (match[2] ? resolveCssVariables(match[2], read) : value) as T\n }\n if (Array.isArray(value)) {\n return value.map((entry: unknown) => resolveCssVariables(entry, read)) as T\n }\n if (isPlainObject(value)) {\n const resolved: Record<string, unknown> = {}\n for (const [key, entry] of Object.entries(value)) {\n resolved[key] = resolveCssVariables(entry, read)\n }\n return resolved as T\n }\n return value\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,IAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;AAWA,IAAM,YAAY;CAChB,MAAM;CACN,MAAM;CACN,OAAO;CACP,SAAS;AACX;;;;;;;;;;;;;;;;AAyBA,SAAS,UAAU,QAAiB;CAClC,OAAO;EACL,QAAQ;EACR,MAAM;EACN,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;CAC3C;AACF;AAEA,IAAM,WAAW,UAAU;AAE3B,SAAS,UAAU,OAAgD;CACjE,IAAI,UAAU,aACZ,OAAO;EACL,GAAG;GACD,QAAQ,EAAE,OAAO,UAAU,KAAK;GAChC,MAAM;IAAE,OAAO,UAAU;IAAM,WAAW;GAAM;GAChD,OAAO;IAAE,OAAO,UAAU;IAAM,MAAM;GAAS;EACjD;EACA,GAAG;GACD,QAAQ,EAAE,SAAS,MAAM;GACzB,MAAM;IAAE,OAAO,UAAU;IAAM,WAAW;GAAM;GAChD,OAAO;IAAE,OAAO,UAAU;IAAM,MAAM;GAAS;EACjD;CACF;CAEF,IAAI,UAAU,UACZ,O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AAS,MAAM,EAAE,CAAA;IACzB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,eAsBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,eAsCA;AAED,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,MAAM,EAAE,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACpD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,eAmBA;AAED,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -5,8 +5,8 @@ import { For, Show, createSignal, onCleanup, onMount, splitProps } from "solid-j
|
|
|
5
5
|
import { Bar, Bubble, Doughnut, Line, Pie, PolarArea, Radar, Scatter } from "solid-chartjs";
|
|
6
6
|
import { ArcElement, BarElement, CategoryScale, Chart, Filler, Legend, LineElement, LinearScale, LogarithmicScale, PointElement, RadialLinearScale, Tooltip } from "chart.js";
|
|
7
7
|
// src/components/ui/chart/chart.tsx
|
|
8
|
-
var _tmpl$ = /*#__PURE__*/ template(`<
|
|
9
|
-
var _tmpl$2 = /*#__PURE__*/ template(`<
|
|
8
|
+
var _tmpl$ = /*#__PURE__*/ template(`<figure><figcaption class="flex items-start justify-between gap-3"><div><h3 class="text-sm font-semibold text-foreground">`);
|
|
9
|
+
var _tmpl$2 = /*#__PURE__*/ template(`<p class="text-xs text-muted-foreground">`);
|
|
10
10
|
var _tmpl$3 = /*#__PURE__*/ template(`<div>`);
|
|
11
11
|
var _tmpl$4 = /*#__PURE__*/ template(`<ul>`);
|
|
12
12
|
var _tmpl$5 = /*#__PURE__*/ template(`<li class="flex items-center gap-1.5 text-2xs text-muted-foreground"><span class="size-2 shrink-0 rounded-full"aria-hidden=true>`);
|
|
@@ -72,7 +72,16 @@ Chart.register(CategoryScale, LinearScale, LogarithmicScale, RadialLinearScale,
|
|
|
72
72
|
* understand, whatever syntax a theme uses (`oklch()`, `color-mix()`, …).
|
|
73
73
|
*/
|
|
74
74
|
var swatch;
|
|
75
|
+
var canvasColors = /* @__PURE__ */ new Map();
|
|
75
76
|
function toCanvasColor(value) {
|
|
77
|
+
const cached = canvasColors.get(value);
|
|
78
|
+
if (cached !== void 0) return cached;
|
|
79
|
+
const converted = paintCanvasColor(value);
|
|
80
|
+
if (canvasColors.size >= 512) canvasColors.clear();
|
|
81
|
+
canvasColors.set(value, converted);
|
|
82
|
+
return converted;
|
|
83
|
+
}
|
|
84
|
+
function paintCanvasColor(value) {
|
|
76
85
|
if (typeof CSS === "undefined" || !CSS.supports("color", value)) return value;
|
|
77
86
|
if (swatch === void 0) {
|
|
78
87
|
const canvas = document.createElement("canvas");
|
|
@@ -157,17 +166,17 @@ function ChartFrame(props) {
|
|
|
157
166
|
"class"
|
|
158
167
|
]);
|
|
159
168
|
return (() => {
|
|
160
|
-
var _el$ = _tmpl$
|
|
169
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild;
|
|
161
170
|
insert(_el$4, () => local.title);
|
|
162
171
|
insert(_el$3, createComponent(Show, {
|
|
163
172
|
get when() {
|
|
164
173
|
return local.description;
|
|
165
174
|
},
|
|
166
|
-
|
|
167
|
-
var _el$5 = _tmpl$();
|
|
168
|
-
insert(_el$5,
|
|
175
|
+
children: (descriptionSlot) => (() => {
|
|
176
|
+
var _el$5 = _tmpl$2();
|
|
177
|
+
insert(_el$5, descriptionSlot);
|
|
169
178
|
return _el$5;
|
|
170
|
-
}
|
|
179
|
+
})()
|
|
171
180
|
}), null);
|
|
172
181
|
insert(_el$2, () => local.actions, null);
|
|
173
182
|
insert(_el$, () => local.children, null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.js","names":["For","Show","createSignal","onCleanup","onMount","splitProps","Dynamic","Bar","Bubble","Doughnut","Line","Pie","PolarArea","Radar","Scatter","ChartJs","ArcElement","BarElement","CategoryScale","Filler","Legend","LineElement","LinearScale","LogarithmicScale","PointElement","RadialLinearScale","ChartTooltip","cn","chartOptions","chartSeriesColors","mergeChartOptions","resolveCssVariables","registerChartPiece","piece","register","swatch","toCanvasColor","value","CSS","supports","undefined","canvas","document","createElement","width","height","getContext","willReadFrequently","globalCompositeOperation","fillStyle","fillRect","r","g","b","a","getImageData","data","Math","round","length","toCanvasValue","raw","match","exec","Number","parseFloat","getComputedStyle","documentElement","fontSize","createThemeResolver","element","revision","invalidate","equals","onFontsLoaded","observer","MutationObserver","observe","attributes","fonts","addEventListener","disconnect","removeEventListener","ref","el","resolve","style","resolved","Map","name","has","getPropertyValue","trim","set","get","title","description","actions","children","class","ChartFrame","props","local","_el$","_tmpl$2","_el$2","firstChild","_el$3","_el$4","_$insert","_$createComponent","when","_el$5","_tmpl$","_$effect","_$className","labels","series","label","color","options","stacked","datasetsFor","filled","map","entry","index","borderColor","backgroundColor","pointBackgroundColor","borderWidth","pointRadius","pointHoverRadius","tension","fill","seriesOptions","extra","shape","scales","x","y","LineChart","area","theme","_el$6","_tmpl$3","_ref$","_$use","datasets","BarChart","horizontal","_el$7","_ref$2","dataset","borderRadius","indexAxis","ScatterChart","_el$8","_ref$3","point","BubbleChart","_el$9","_ref$4","RadarChart","_el$0","_ref$5","restoreRadialScale","id","afterInit","chart","scale","PolarAreaChart","_el$1","_ref$6","plugins","DonutChart","cutout","component","_el$10","_ref$7","_","ChartLegend","_el$11","_tmpl$4","each","_el$12","_tmpl$5","_el$13","_$p","_$setStyleProperty"],"sources":["../../../../src/components/ui/chart/chart.tsx"],"sourcesContent":["import { For, Show, createSignal, onCleanup, onMount, splitProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { Bar, Bubble, Doughnut, Line, Pie, PolarArea, Radar, Scatter } from 'solid-chartjs'\nimport {\n Chart as ChartJs,\n ArcElement,\n BarElement,\n CategoryScale,\n Filler,\n Legend,\n LineElement,\n LinearScale,\n LogarithmicScale,\n PointElement,\n RadialLinearScale,\n Tooltip as ChartTooltip,\n} from 'chart.js'\nimport type { ChartOptions, ChartType, Plugin } from 'chart.js'\nimport { cn } from '#lib/utils'\nimport {\n chartOptions,\n chartSeriesColors,\n mergeChartOptions,\n resolveCssVariables,\n type ChartScaleShape,\n} from './chart-options'\n\n/**\n * Chart.\n *\n * A thin wrapper over Chart.js, themed through the same CSS custom properties as\n * everything else. The wrapper is thin on purpose: a design system's job here is\n * to make a chart *look like the rest of the application* — the palette, the\n * type scale, the tooltip surface, the grid lines — and not to re-implement\n * scales and axes, which is where a hand-rolled chart goes wrong.\n *\n * ## Registration, and why it is here rather than left to the caller\n *\n * Chart.js is tree-shakeable through explicit registration: nothing is bundled\n * until a controller, a scale or a plugin is registered. That is the whole reason\n * it was chosen over a batteries-included charting library, and it only pays off\n * if the registrations are scoped to what a component actually uses.\n *\n * This module registers the **shared** pieces once — scales, elements, tooltip,\n * legend, filler — and nothing else. The controllers are imported per component\n * so a `LineChart` does not carry the radar controller, and a consumer that\n * imports only `LineChart` gets only that. Measured: see the story for the\n * per-component figures the tree-shaking gate publishes.\n *\n * A caller with a chart type this file does not export registers its own\n * controller with `registerChartPiece`, which is the escape hatch rather than a\n * reason to widen the registration above.\n *\n * ## Theming\n *\n * Colours come from `--chart-1` through `--chart-5`, which every theme\n * defines, and the grid, ticks and labels from `--border` and\n * `--muted-foreground`. That means a chart follows the accent axis and the\n * appearance with no per-chart configuration — and a caller that wants a\n * specific series colour passes it explicitly, as a colour or as `var(--token)`.\n *\n * A canvas cannot read a custom property, so the options and datasets carry\n * `var(--token)` strings and each chart resolves them against its own element\n * when it renders, and again whenever the root's attributes change — the\n * `.dark` class, `data-accent`, `data-font`, an inline override. The type is\n * resolved the same way: `--font-sans` for the family and a type-scale rung for\n * the size, so a chart follows the font axis too. See `createThemeResolver`.\n */\n\n/**\n * Register a piece with Chart.js. The escape hatch for a caller's own chart type.\n *\n * `solid-chartjs` re-exports the typed components but not the registry, so\n * registration comes from `chart.js` itself — which is also the honest place for\n * it, since the registry is Chart.js's global.\n */\nexport function registerChartPiece(piece: Parameters<typeof ChartJs.register>[number]): void {\n ChartJs.register(piece)\n}\n\nChartJs.register(\n CategoryScale,\n LinearScale,\n LogarithmicScale,\n RadialLinearScale,\n PointElement,\n LineElement,\n BarElement,\n ArcElement,\n Filler,\n ChartTooltip,\n Legend\n)\n\nexport { chartOptions, chartSeriesColors }\n\n/**\n * One pixel to paint a colour on, shared by every chart.\n *\n * The canvas *paints* `oklch()`, but Chart.js also *parses* colours — to derive a\n * hover shade and to animate between two colours — and its parser reads only\n * rgb, hsl, hex and names. Painting the computed value and reading the pixel\n * back gives the sRGB colour the canvas would have drawn anyway, in a form both\n * understand, whatever syntax a theme uses (`oklch()`, `color-mix()`, …).\n */\nlet swatch: CanvasRenderingContext2D | null | undefined\n\nfunction toCanvasColor(value: string): string {\n if (typeof CSS === 'undefined' || !CSS.supports('color', value)) return value\n if (swatch === undefined) {\n const canvas = document.createElement('canvas')\n canvas.width = 1\n canvas.height = 1\n swatch = canvas.getContext('2d', { willReadFrequently: true })\n }\n if (!swatch) return value\n swatch.globalCompositeOperation = 'copy'\n swatch.fillStyle = value\n swatch.fillRect(0, 0, 1, 1)\n const [r, g, b, a] = swatch.getImageData(0, 0, 1, 1).data\n return `rgba(${r}, ${g}, ${b}, ${Math.round(((a ?? 255) / 255) * 1000) / 1000})`\n}\n\nconst length = /^(-?\\d*\\.?\\d+)(px|rem)$/\n\n/**\n * A token's computed value as a canvas option: a colour as an sRGB colour, a\n * `px`/`rem` length (a type-scale rung) as the number of pixels Chart.js wants,\n * and anything else — a font stack — as written.\n */\nfunction toCanvasValue(raw: string): string | number {\n const match = length.exec(raw)\n if (match) {\n const value = Number(match[1])\n if (match[2] === 'px') return value\n return value * (Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16)\n }\n return toCanvasColor(raw)\n}\n\n/**\n * Resolves `var(--token)` strings against a chart's element, and re-resolves\n * them when the theme changes.\n *\n * The element rather than the root, so a chart inside a subtree with its own\n * inline tokens takes those. The observer watches every attribute on `<html>`,\n * because that is where both applications switch appearance, accent and theme\n * (`.dark`, `data-accent`, `data-theme`, inline variables); a theme axis added\n * later is covered without touching this. It also re-resolves when a web font\n * finishes loading: a canvas draws text once, so a chart rendered before the\n * face selected by `data-font` arrived would otherwise keep the fallback face\n * until something else redrew it. Both are released with the chart.\n */\nfunction createThemeResolver() {\n let element: HTMLElement | undefined\n const [revision, invalidate] = createSignal(undefined, { equals: false })\n const onFontsLoaded = () => invalidate()\n\n onMount(() => {\n const observer = new MutationObserver(() => invalidate())\n observer.observe(document.documentElement, { attributes: true })\n const fonts = typeof document.fonts === 'undefined' ? undefined : document.fonts\n fonts?.addEventListener('loadingdone', onFontsLoaded)\n onCleanup(() => {\n observer.disconnect()\n fonts?.removeEventListener('loadingdone', onFontsLoaded)\n })\n })\n\n return {\n ref: (el: HTMLElement) => {\n element = el\n },\n resolve<T>(value: T): T {\n revision()\n if (!element || typeof getComputedStyle === 'undefined') return value\n const style = getComputedStyle(element)\n const resolved = new Map<string, string | number | undefined>()\n return resolveCssVariables(value, (name) => {\n if (!resolved.has(name)) {\n const raw = style.getPropertyValue(name).trim()\n resolved.set(name, raw ? toCanvasValue(raw) : undefined)\n }\n return resolved.get(name)\n })\n },\n }\n}\n\n/** A chart's frame: a bordered surface with a title and an optional description. */\nexport type ChartFrameProps = {\n /** The chart's title. Required — a chart with no name is not readable. */\n title: string\n /** What the chart shows. Announced to assistive technology, and drawn. */\n description?: string\n actions?: JSX.Element\n children: JSX.Element\n class?: string\n}\n\nexport function ChartFrame(props: ChartFrameProps) {\n const [local] = splitProps(props, ['title', 'description', 'actions', 'children', 'class'])\n\n return (\n <figure class={cn('grid gap-3 rounded-lg border border-border bg-card p-4', local.class)}>\n <figcaption class=\"flex items-start justify-between gap-3\">\n <div>\n <h3 class=\"text-sm font-semibold text-foreground\">{local.title}</h3>\n <Show when={local.description}>\n <p class=\"text-xs text-muted-foreground\">{local.description}</p>\n </Show>\n </div>\n {local.actions}\n </figcaption>\n {local.children}\n </figure>\n )\n}\n\ntype SeriesChartProps = {\n labels: readonly string[]\n /** One entry per series. `data` is aligned to `labels`. */\n series: readonly { label: string; data: readonly number[]; color?: string }[]\n /** Chart.js options, merged deeply over the theme's defaults. */\n options?: ChartOptions\n stacked?: boolean\n class?: string\n}\n\n/**\n * The data as Chart.js datasets, with the theme's colours applied in order and\n * the series' own colour winning when it has one.\n *\n * `fill: false` and a 2px border are deliberate: a filled line chart is a\n * different chart, and a 1px line at a 12px label size reads as a grid line.\n */\nfunction datasetsFor(series: SeriesChartProps['series'], filled: boolean) {\n return series.map((entry, index) => ({\n label: entry.label,\n data: [...entry.data],\n borderColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n pointBackgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n borderWidth: 2,\n pointRadius: 0,\n pointHoverRadius: 4,\n tension: 0.3,\n fill: filled,\n }))\n}\n\nfunction seriesOptions(\n props: SeriesChartProps,\n extra?: ChartOptions,\n shape: ChartScaleShape = 'cartesian'\n): ChartOptions {\n // Stacking is a cartesian idea; a radar has no x or y to stack, and naming\n // them would make Chart.js draw them.\n const stacked =\n props.stacked && shape === 'cartesian'\n ? { scales: { x: { stacked: true }, y: { stacked: true } } }\n : undefined\n return chartOptions(mergeChartOptions(extra, stacked, props.options), shape)\n}\n\n/** A line chart. The default for a series over time. */\nexport function LineChart(props: SeriesChartProps & { area?: boolean }) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Line\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, props.area ?? false),\n })}\n options={theme.resolve(seriesOptions(props))}\n />\n </div>\n )\n}\n\n/** A bar chart. `stacked` for parts of a whole over categories. */\nexport function BarChart(props: SeriesChartProps & { horizontal?: boolean }) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Bar\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, true).map((dataset) => ({\n ...dataset,\n borderWidth: 0,\n borderRadius: 3,\n })),\n })}\n options={theme.resolve(seriesOptions(props, { indexAxis: props.horizontal ? 'y' : 'x' }))}\n />\n </div>\n )\n}\n\n/** A scatter plot, for a correlation rather than a series. */\nexport function ScatterChart(props: {\n series: readonly { label: string; data: readonly { x: number; y: number }[]; color?: string }[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Scatter\n data={theme.resolve({\n datasets: props.series.map((entry, index) => ({\n label: entry.label,\n data: entry.data.map((point) => ({ ...point })),\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n pointRadius: 3,\n pointHoverRadius: 5,\n })),\n })}\n options={theme.resolve(chartOptions(props.options))}\n />\n </div>\n )\n}\n\n/** A bubble chart: scatter with a third dimension carried by the radius. */\nexport function BubbleChart(props: {\n series: readonly {\n label: string\n data: readonly { x: number; y: number; r: number }[]\n color?: string\n }[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Bubble\n data={theme.resolve({\n datasets: props.series.map((entry, index) => ({\n label: entry.label,\n data: entry.data.map((point) => ({ ...point })),\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n })),\n })}\n options={theme.resolve(chartOptions(props.options))}\n />\n </div>\n )\n}\n\n/** A radar chart, for a profile across fixed axes. */\nexport function RadarChart(props: SeriesChartProps) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Radar\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, true),\n })}\n options={theme.resolve(seriesOptions(props, undefined, 'radial'))}\n />\n </div>\n )\n}\n\n/**\n * Puts the themed radial scale back on a chart `solid-chartjs` has just created.\n *\n * `solid-chartjs` deletes `options.scales.r` for every chart type but radar when\n * it first creates a chart. Today that delete lands on a throwaway copy — Solid\n * compiles `options={…}` to a getter, so its next read rebuilds the object with\n * `r` intact — but that is an accident of how the prop is passed: a memoised or\n * static options object would lose the scale, and the polar area would fall back\n * to Chart.js's defaults (grey ticks on a translucent white box, which is a white\n * box on a dark card). Restoring it from this component's own options makes the\n * themed scale independent of both. Later option updates (every theme change)\n * pass `r` through untouched; only creation drops it.\n *\n * `afterInit` runs inside Chart.js's constructor, after the options are read and\n * before the first update builds the scales and draws, so the themed scale is in\n * place for the first frame — no default-styled frame, and no extra update. The\n * plugin is per instance, passed through the chart's `plugins` prop, so nothing\n * is registered globally.\n */\nfunction restoreRadialScale(options: () => ChartOptions): Plugin {\n return {\n id: 'adea-radial-scale',\n afterInit(chart) {\n const scale = options().scales?.['r']\n if (!scale) return\n chart.options.scales = { ...chart.options.scales, r: scale }\n },\n }\n}\n\n/** A polar area chart: radial bars, for a composition. */\nexport function PolarAreaChart(props: {\n labels: readonly string[]\n data: readonly number[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n const options = () => theme.resolve(chartOptions(props.options, 'radial'))\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <PolarArea\n plugins={[restoreRadialScale(options)]}\n data={theme.resolve({\n labels: [...props.labels],\n datasets: [\n {\n data: [...props.data],\n backgroundColor: [...chartSeriesColors],\n borderColor: 'var(--card)',\n borderWidth: 2,\n },\n ],\n })}\n options={options()}\n />\n </div>\n )\n}\n\n/**\n * A doughnut or a pie, for a composition with few enough slices to name.\n *\n * Both are one component because the only difference is the hole, and a caller\n * choosing between them is choosing a ratio rather than a chart. `cutout` is the\n * hole's share of the radius: 0 is a pie, 60% is the doughnut most dashboards\n * mean. A composition with more than about six slices should be a bar chart —\n * past that, the smallest slices become unreadable and their labels collide.\n */\nexport function DonutChart(props: {\n labels: readonly string[]\n data: readonly number[]\n /** The hole, as a percentage of the radius. 0 for a pie. */\n cutout?: number\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n // `Dynamic` rather than a local component accessor: Solid's JSX types require\n // a component reference, and an accessor returning one is a call in disguise.\n const component = () => (props.cutout === 0 ? Pie : Doughnut)\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Dynamic\n component={component()}\n data={theme.resolve({\n labels: [...props.labels],\n datasets: [\n {\n data: [...props.data],\n backgroundColor: props.labels.map(\n (_, index) => chartSeriesColors[index % chartSeriesColors.length]\n ),\n borderColor: 'var(--card)',\n borderWidth: 2,\n },\n ],\n })}\n options={theme.resolve(\n chartOptions(\n mergeChartOptions(\n props.cutout === 0\n ? undefined\n : ({\n cutout: `${props.cutout ?? 60}%`,\n } satisfies ChartOptions<'doughnut'> as ChartOptions),\n props.options\n ),\n 'none'\n )\n )}\n />\n </div>\n )\n}\n\n/** A legend built from the same five colours, for a chart whose legend is elsewhere. */\nexport function ChartLegend(props: {\n series: readonly { label: string; color?: string }[]\n class?: string\n}) {\n return (\n <ul class={cn('flex flex-wrap items-center gap-x-3 gap-y-1', props.class)}>\n <For each={props.series}>\n {(entry, index) => (\n <li class=\"flex items-center gap-1.5 text-2xs text-muted-foreground\">\n <span\n class=\"size-2 shrink-0 rounded-full\"\n style={{\n background: entry.color ?? chartSeriesColors[index() % chartSeriesColors.length],\n }}\n aria-hidden=\"true\"\n />\n {entry.label}\n </li>\n )}\n </For>\n </ul>\n )\n}\n\nexport type { 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","Line","Pie","PolarArea","Radar","Scatter","ChartJs","ArcElement","BarElement","CategoryScale","Filler","Legend","LineElement","LinearScale","LogarithmicScale","PointElement","RadialLinearScale","ChartTooltip","cn","chartOptions","chartSeriesColors","mergeChartOptions","resolveCssVariables","registerChartPiece","piece","register","swatch","canvasColors","Map","toCanvasColor","value","cached","get","undefined","converted","paintCanvasColor","size","clear","set","CSS","supports","canvas","document","createElement","width","height","getContext","willReadFrequently","globalCompositeOperation","fillStyle","fillRect","r","g","b","a","getImageData","data","Math","round","length","toCanvasValue","raw","match","exec","Number","parseFloat","getComputedStyle","documentElement","fontSize","createThemeResolver","element","revision","invalidate","equals","onFontsLoaded","observer","MutationObserver","observe","attributes","fonts","addEventListener","disconnect","removeEventListener","ref","el","resolve","style","resolved","name","has","getPropertyValue","trim","title","description","actions","children","class","ChartFrame","props","local","_el$","_tmpl$","_el$2","firstChild","_el$3","_el$4","_$insert","_$createComponent","when","descriptionSlot","_el$5","_tmpl$2","_$effect","_$className","labels","series","label","color","options","stacked","datasetsFor","filled","map","entry","index","borderColor","backgroundColor","pointBackgroundColor","borderWidth","pointRadius","pointHoverRadius","tension","fill","seriesOptions","extra","shape","scales","x","y","LineChart","area","theme","_el$6","_tmpl$3","_ref$","_$use","datasets","BarChart","horizontal","_el$7","_ref$2","dataset","borderRadius","indexAxis","ScatterChart","_el$8","_ref$3","point","BubbleChart","_el$9","_ref$4","RadarChart","_el$0","_ref$5","restoreRadialScale","id","afterInit","chart","scale","PolarAreaChart","_el$1","_ref$6","plugins","DonutChart","cutout","component","_el$10","_ref$7","_","ChartLegend","_el$11","_tmpl$4","each","_el$12","_tmpl$5","_el$13","_$p","_$setStyleProperty"],"sources":["../../../../src/components/ui/chart/chart.tsx"],"sourcesContent":["import { For, Show, createSignal, onCleanup, onMount, splitProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { Bar, Bubble, Doughnut, Line, Pie, PolarArea, Radar, Scatter } from 'solid-chartjs'\nimport {\n Chart as ChartJs,\n ArcElement,\n BarElement,\n CategoryScale,\n Filler,\n Legend,\n LineElement,\n LinearScale,\n LogarithmicScale,\n PointElement,\n RadialLinearScale,\n Tooltip as ChartTooltip,\n} from 'chart.js'\nimport type { ChartOptions, ChartType, Plugin } from 'chart.js'\nimport { cn } from '#lib/utils'\nimport {\n chartOptions,\n chartSeriesColors,\n mergeChartOptions,\n resolveCssVariables,\n type ChartScaleShape,\n} from './chart-options'\n\n/**\n * Chart.\n *\n * A thin wrapper over Chart.js, themed through the same CSS custom properties as\n * everything else. The wrapper is thin on purpose: a design system's job here is\n * to make a chart *look like the rest of the application* — the palette, the\n * type scale, the tooltip surface, the grid lines — and not to re-implement\n * scales and axes, which is where a hand-rolled chart goes wrong.\n *\n * ## Registration, and why it is here rather than left to the caller\n *\n * Chart.js is tree-shakeable through explicit registration: nothing is bundled\n * until a controller, a scale or a plugin is registered. That is the whole reason\n * it was chosen over a batteries-included charting library, and it only pays off\n * if the registrations are scoped to what a component actually uses.\n *\n * This module registers the **shared** pieces once — scales, elements, tooltip,\n * legend, filler — and nothing else. The controllers are imported per component\n * so a `LineChart` does not carry the radar controller, and a consumer that\n * imports only `LineChart` gets only that. Measured: see the story for the\n * per-component figures the tree-shaking gate publishes.\n *\n * A caller with a chart type this file does not export registers its own\n * controller with `registerChartPiece`, which is the escape hatch rather than a\n * reason to widen the registration above.\n *\n * ## Theming\n *\n * Colours come from `--chart-1` through `--chart-5`, which every theme\n * defines, and the grid, ticks and labels from `--border` and\n * `--muted-foreground`. That means a chart follows the accent axis and the\n * appearance with no per-chart configuration — and a caller that wants a\n * specific series colour passes it explicitly, as a colour or as `var(--token)`.\n *\n * A canvas cannot read a custom property, so the options and datasets carry\n * `var(--token)` strings and each chart resolves them against its own element\n * when it renders, and again whenever the root's attributes change — the\n * `.dark` class, `data-accent`, `data-font`, an inline override. The type is\n * resolved the same way: `--font-sans` for the family and a type-scale rung for\n * the size, so a chart follows the font axis too. See `createThemeResolver`.\n */\n\n/**\n * Register a piece with Chart.js. The escape hatch for a caller's own chart type.\n *\n * `solid-chartjs` re-exports the typed components but not the registry, so\n * registration comes from `chart.js` itself — which is also the honest place for\n * it, since the registry is Chart.js's global.\n */\nexport function registerChartPiece(piece: Parameters<typeof ChartJs.register>[number]): void {\n ChartJs.register(piece)\n}\n\nChartJs.register(\n CategoryScale,\n LinearScale,\n LogarithmicScale,\n RadialLinearScale,\n PointElement,\n LineElement,\n BarElement,\n ArcElement,\n Filler,\n ChartTooltip,\n Legend\n)\n\nexport { chartOptions, chartSeriesColors }\n\n/**\n * One pixel to paint a colour on, shared by every chart.\n *\n * The canvas *paints* `oklch()`, but Chart.js also *parses* colours — to derive a\n * hover shade and to animate between two colours — and its parser reads only\n * rgb, hsl, hex and names. Painting the computed value and reading the pixel\n * back gives the sRGB colour the canvas would have drawn anyway, in a form both\n * understand, whatever syntax a theme uses (`oklch()`, `color-mix()`, …).\n */\nlet swatch: CanvasRenderingContext2D | null | undefined\n\n// A computed colour string always paints the same pixel, so each is converted once.\n// Bounded so a long session of custom accents cannot grow it without limit.\nconst canvasColors = new Map<string, string>()\n\nfunction toCanvasColor(value: string): string {\n const cached = canvasColors.get(value)\n if (cached !== undefined) return cached\n const converted = paintCanvasColor(value)\n if (canvasColors.size >= 512) canvasColors.clear()\n canvasColors.set(value, converted)\n return converted\n}\n\nfunction paintCanvasColor(value: string): string {\n if (typeof CSS === 'undefined' || !CSS.supports('color', value)) return value\n if (swatch === undefined) {\n const canvas = document.createElement('canvas')\n canvas.width = 1\n canvas.height = 1\n swatch = canvas.getContext('2d', { willReadFrequently: true })\n }\n if (!swatch) return value\n swatch.globalCompositeOperation = 'copy'\n swatch.fillStyle = value\n swatch.fillRect(0, 0, 1, 1)\n const [r, g, b, a] = swatch.getImageData(0, 0, 1, 1).data\n return `rgba(${r}, ${g}, ${b}, ${Math.round(((a ?? 255) / 255) * 1000) / 1000})`\n}\n\nconst length = /^(-?\\d*\\.?\\d+)(px|rem)$/\n\n/**\n * A token's computed value as a canvas option: a colour as an sRGB colour, a\n * `px`/`rem` length (a type-scale rung) as the number of pixels Chart.js wants,\n * and anything else — a font stack — as written.\n */\nfunction toCanvasValue(raw: string): string | number {\n const match = length.exec(raw)\n if (match) {\n const value = Number(match[1])\n if (match[2] === 'px') return value\n return value * (Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16)\n }\n return toCanvasColor(raw)\n}\n\n/**\n * Resolves `var(--token)` strings against a chart's element, and re-resolves\n * them when the theme changes.\n *\n * The element rather than the root, so a chart inside a subtree with its own\n * inline tokens takes those. The observer watches every attribute on `<html>`,\n * because that is where both applications switch appearance, accent and theme\n * (`.dark`, `data-accent`, `data-theme`, inline variables); a theme axis added\n * later is covered without touching this. It also re-resolves when a web font\n * finishes loading: a canvas draws text once, so a chart rendered before the\n * face selected by `data-font` arrived would otherwise keep the fallback face\n * until something else redrew it. Both are released with the chart.\n */\nfunction createThemeResolver() {\n let element: HTMLElement | undefined\n const [revision, invalidate] = createSignal(undefined, { equals: false })\n const onFontsLoaded = () => invalidate()\n\n onMount(() => {\n const observer = new MutationObserver(() => invalidate())\n observer.observe(document.documentElement, { attributes: true })\n const fonts = typeof document.fonts === 'undefined' ? undefined : document.fonts\n fonts?.addEventListener('loadingdone', onFontsLoaded)\n onCleanup(() => {\n observer.disconnect()\n fonts?.removeEventListener('loadingdone', onFontsLoaded)\n })\n })\n\n return {\n ref: (el: HTMLElement) => {\n element = el\n },\n resolve<T>(value: T): T {\n revision()\n if (!element || typeof getComputedStyle === 'undefined') return value\n const style = getComputedStyle(element)\n const resolved = new Map<string, string | number | undefined>()\n return resolveCssVariables(value, (name) => {\n if (!resolved.has(name)) {\n const raw = style.getPropertyValue(name).trim()\n resolved.set(name, raw ? toCanvasValue(raw) : undefined)\n }\n return resolved.get(name)\n })\n },\n }\n}\n\n/** A chart's frame: a bordered surface with a title and an optional description. */\nexport type ChartFrameProps = {\n /** The chart's title. Required — a chart with no name is not readable. */\n title: string\n /** What the chart shows. Announced to assistive technology, and drawn. */\n description?: string\n actions?: JSX.Element\n children: JSX.Element\n class?: string\n}\n\nexport function ChartFrame(props: ChartFrameProps) {\n const [local] = splitProps(props, ['title', 'description', 'actions', 'children', 'class'])\n\n return (\n <figure class={cn('grid gap-3 rounded-lg border border-border bg-card p-4', local.class)}>\n <figcaption class=\"flex items-start justify-between gap-3\">\n <div>\n <h3 class=\"text-sm font-semibold text-foreground\">{local.title}</h3>\n <Show when={local.description}>\n {(descriptionSlot) => <p class=\"text-xs text-muted-foreground\">{descriptionSlot()}</p>}\n </Show>\n </div>\n {local.actions}\n </figcaption>\n {local.children}\n </figure>\n )\n}\n\ntype SeriesChartProps = {\n labels: readonly string[]\n /** One entry per series. `data` is aligned to `labels`. */\n series: readonly { label: string; data: readonly number[]; color?: string }[]\n /** Chart.js options, merged deeply over the theme's defaults. */\n options?: ChartOptions\n stacked?: boolean\n class?: string\n}\n\n/**\n * The data as Chart.js datasets, with the theme's colours applied in order and\n * the series' own colour winning when it has one.\n *\n * `fill: false` and a 2px border are deliberate: a filled line chart is a\n * different chart, and a 1px line at a 12px label size reads as a grid line.\n */\nfunction datasetsFor(series: SeriesChartProps['series'], filled: boolean) {\n return series.map((entry, index) => ({\n label: entry.label,\n data: [...entry.data],\n borderColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n pointBackgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n borderWidth: 2,\n pointRadius: 0,\n pointHoverRadius: 4,\n tension: 0.3,\n fill: filled,\n }))\n}\n\nfunction seriesOptions(\n props: SeriesChartProps,\n extra?: ChartOptions,\n shape: ChartScaleShape = 'cartesian'\n): ChartOptions {\n // Stacking is a cartesian idea; a radar has no x or y to stack, and naming\n // them would make Chart.js draw them.\n const stacked =\n props.stacked && shape === 'cartesian'\n ? { scales: { x: { stacked: true }, y: { stacked: true } } }\n : undefined\n return chartOptions(mergeChartOptions(extra, stacked, props.options), shape)\n}\n\n/** A line chart. The default for a series over time. */\nexport function LineChart(props: SeriesChartProps & { area?: boolean }) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Line\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, props.area ?? false),\n })}\n options={theme.resolve(seriesOptions(props))}\n />\n </div>\n )\n}\n\n/** A bar chart. `stacked` for parts of a whole over categories. */\nexport function BarChart(props: SeriesChartProps & { horizontal?: boolean }) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Bar\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, true).map((dataset) => ({\n ...dataset,\n borderWidth: 0,\n borderRadius: 3,\n })),\n })}\n options={theme.resolve(seriesOptions(props, { indexAxis: props.horizontal ? 'y' : 'x' }))}\n />\n </div>\n )\n}\n\n/** A scatter plot, for a correlation rather than a series. */\nexport function ScatterChart(props: {\n series: readonly { label: string; data: readonly { x: number; y: number }[]; color?: string }[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Scatter\n data={theme.resolve({\n datasets: props.series.map((entry, index) => ({\n label: entry.label,\n data: entry.data.map((point) => ({ ...point })),\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n pointRadius: 3,\n pointHoverRadius: 5,\n })),\n })}\n options={theme.resolve(chartOptions(props.options))}\n />\n </div>\n )\n}\n\n/** A bubble chart: scatter with a third dimension carried by the radius. */\nexport function BubbleChart(props: {\n series: readonly {\n label: string\n data: readonly { x: number; y: number; r: number }[]\n color?: string\n }[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Bubble\n data={theme.resolve({\n datasets: props.series.map((entry, index) => ({\n label: entry.label,\n data: entry.data.map((point) => ({ ...point })),\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n })),\n })}\n options={theme.resolve(chartOptions(props.options))}\n />\n </div>\n )\n}\n\n/** A radar chart, for a profile across fixed axes. */\nexport function RadarChart(props: SeriesChartProps) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Radar\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, true),\n })}\n options={theme.resolve(seriesOptions(props, undefined, 'radial'))}\n />\n </div>\n )\n}\n\n/**\n * Puts the themed radial scale back on a chart `solid-chartjs` has just created.\n *\n * `solid-chartjs` deletes `options.scales.r` for every chart type but radar when\n * it first creates a chart. Today that delete lands on a throwaway copy — Solid\n * compiles `options={…}` to a getter, so its next read rebuilds the object with\n * `r` intact — but that is an accident of how the prop is passed: a memoised or\n * static options object would lose the scale, and the polar area would fall back\n * to Chart.js's defaults (grey ticks on a translucent white box, which is a white\n * box on a dark card). Restoring it from this component's own options makes the\n * themed scale independent of both. Later option updates (every theme change)\n * pass `r` through untouched; only creation drops it.\n *\n * `afterInit` runs inside Chart.js's constructor, after the options are read and\n * before the first update builds the scales and draws, so the themed scale is in\n * place for the first frame — no default-styled frame, and no extra update. The\n * plugin is per instance, passed through the chart's `plugins` prop, so nothing\n * is registered globally.\n */\nfunction restoreRadialScale(options: () => ChartOptions): Plugin {\n return {\n id: 'adea-radial-scale',\n afterInit(chart) {\n const scale = options().scales?.['r']\n if (!scale) return\n chart.options.scales = { ...chart.options.scales, r: scale }\n },\n }\n}\n\n/** A polar area chart: radial bars, for a composition. */\nexport function PolarAreaChart(props: {\n labels: readonly string[]\n data: readonly number[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n const options = () => theme.resolve(chartOptions(props.options, 'radial'))\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <PolarArea\n plugins={[restoreRadialScale(options)]}\n data={theme.resolve({\n labels: [...props.labels],\n datasets: [\n {\n data: [...props.data],\n backgroundColor: [...chartSeriesColors],\n borderColor: 'var(--card)',\n borderWidth: 2,\n },\n ],\n })}\n options={options()}\n />\n </div>\n )\n}\n\n/**\n * A doughnut or a pie, for a composition with few enough slices to name.\n *\n * Both are one component because the only difference is the hole, and a caller\n * choosing between them is choosing a ratio rather than a chart. `cutout` is the\n * hole's share of the radius: 0 is a pie, 60% is the doughnut most dashboards\n * mean. A composition with more than about six slices should be a bar chart —\n * past that, the smallest slices become unreadable and their labels collide.\n */\nexport function DonutChart(props: {\n labels: readonly string[]\n data: readonly number[]\n /** The hole, as a percentage of the radius. 0 for a pie. */\n cutout?: number\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n // `Dynamic` rather than a local component accessor: Solid's JSX types require\n // a component reference, and an accessor returning one is a call in disguise.\n const component = () => (props.cutout === 0 ? Pie : Doughnut)\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Dynamic\n component={component()}\n data={theme.resolve({\n labels: [...props.labels],\n datasets: [\n {\n data: [...props.data],\n backgroundColor: props.labels.map(\n (_, index) => chartSeriesColors[index % chartSeriesColors.length]\n ),\n borderColor: 'var(--card)',\n borderWidth: 2,\n },\n ],\n })}\n options={theme.resolve(\n chartOptions(\n mergeChartOptions(\n props.cutout === 0\n ? undefined\n : ({\n cutout: `${props.cutout ?? 60}%`,\n } satisfies ChartOptions<'doughnut'> as ChartOptions),\n props.options\n ),\n 'none'\n )\n )}\n />\n </div>\n )\n}\n\n/** A legend built from the same five colours, for a chart whose legend is elsewhere. */\nexport function ChartLegend(props: {\n series: readonly { label: string; color?: string }[]\n class?: string\n}) {\n return (\n <ul class={cn('flex flex-wrap items-center gap-x-3 gap-y-1', props.class)}>\n <For each={props.series}>\n {(entry, index) => (\n <li class=\"flex items-center gap-1.5 text-2xs text-muted-foreground\">\n <span\n class=\"size-2 shrink-0 rounded-full\"\n style={{\n background: entry.color ?? chartSeriesColors[index() % chartSeriesColors.length],\n }}\n aria-hidden=\"true\"\n />\n {entry.label}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BAAAF,QAAA,cAJI9D,MAAMN,SAASjG,kBAAkBwG,MAAM,IAAIxG,kBAAkBuC,OAAO,CAAA;IAAA,OAAA4H;GAAA,EAAA,CAAA;EAMvF,CAAA,CAAA;EAAAvE,aAAAC,UAAAmE,QAbMlK,GAAG,+CAA+CgF,MAAMF,KAAK,CAAC,CAAA;EAAA,OAAAoF;CAAA,EAAA,CAAA;AAiB7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAKnD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAAE,UAAU,CAAC,GAAG;IACrF,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAKnD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAAE,UAAU,CAAC,GAAG;IACrF,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,eA0F5C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,eAGhF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,eAQ5F"}
|
|
@@ -2,7 +2,7 @@ import { useFormFieldControl } from "../../../lib/form-field.js";
|
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
3
|
import { createComponent, insert, memo, mergeProps, template } from "solid-js/web";
|
|
4
4
|
import { Check, Minus } from "lucide-solid";
|
|
5
|
-
import { splitProps } from "solid-js";
|
|
5
|
+
import { children, splitProps } from "solid-js";
|
|
6
6
|
import { Checkbox } from "@kobalte/core/checkbox";
|
|
7
7
|
// src/components/ui/checkbox/checkbox.tsx
|
|
8
8
|
var _tmpl$ = /*#__PURE__*/ template(`<div class="grid gap-0.5">`);
|
|
@@ -34,6 +34,8 @@ function Checkbox$1(props) {
|
|
|
34
34
|
"aria-invalid": local["aria-invalid"],
|
|
35
35
|
"aria-errormessage": local["aria-errormessage"]
|
|
36
36
|
});
|
|
37
|
+
const label = children(() => local.label);
|
|
38
|
+
const description = children(() => local.description);
|
|
37
39
|
return createComponent(Checkbox, mergeProps({
|
|
38
40
|
"data-slot": "checkbox",
|
|
39
41
|
get id() {
|
|
@@ -86,27 +88,27 @@ function Checkbox$1(props) {
|
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
90
|
}),
|
|
89
|
-
memo(() => local.children ?? (
|
|
91
|
+
memo(() => local.children ?? (label() || description() ? (() => {
|
|
90
92
|
var _el$ = _tmpl$();
|
|
91
93
|
insert(_el$, (() => {
|
|
92
|
-
var _c$ = memo(() => !!
|
|
94
|
+
var _c$ = memo(() => !!label());
|
|
93
95
|
return () => _c$() ? createComponent(Checkbox.Label, {
|
|
94
96
|
get ["class"]() {
|
|
95
97
|
return cn("text-sm font-medium", local.labelClass);
|
|
96
98
|
},
|
|
97
99
|
get children() {
|
|
98
|
-
return
|
|
100
|
+
return label();
|
|
99
101
|
}
|
|
100
102
|
}) : null;
|
|
101
103
|
})(), null);
|
|
102
104
|
insert(_el$, (() => {
|
|
103
|
-
var _c$2 = memo(() => !!
|
|
105
|
+
var _c$2 = memo(() => !!description());
|
|
104
106
|
return () => _c$2() ? createComponent(Checkbox.Description, {
|
|
105
107
|
get ["class"]() {
|
|
106
108
|
return cn("text-muted-foreground text-sm", local.descriptionClass);
|
|
107
109
|
},
|
|
108
110
|
get children() {
|
|
109
|
-
return
|
|
111
|
+
return description();
|
|
110
112
|
}
|
|
111
113
|
}) : null;
|
|
112
114
|
})(), null);
|