@lostgradient/cinder 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/README.md +163 -0
- package/components.json +390 -3
- package/dist/_internal/chart/chart-focus-ring.d.ts +57 -0
- package/dist/_internal/chart/chart-utilities.d.ts +2 -0
- package/dist/_internal/chart/heatmap-utilities.d.ts +60 -0
- package/dist/components/accordion/index.js +14 -1
- package/dist/components/alert/alert.schema.js +3 -3
- package/dist/components/alert/alert.types.d.ts +3 -2
- package/dist/components/alert/index.js +3 -2
- package/dist/components/alert-dialog/index.js +11 -2
- package/dist/components/area-chart/area-chart.css +57 -7
- package/dist/components/area-chart/index.js +283 -40
- package/dist/components/avatar-group/avatar-group.css +2 -3
- package/dist/components/badge/badge.css +17 -0
- package/dist/components/badge/badge.schema.js +6 -1
- package/dist/components/badge/badge.types.d.ts +7 -0
- package/dist/components/badge/index.js +4 -2
- package/dist/components/bar-chart/bar-chart.css +57 -7
- package/dist/components/bar-chart/index.js +233 -45
- package/dist/components/button/button.css +5 -3
- package/dist/components/button/index.js +11 -2
- package/dist/components/capability-gate/capability-gate.css +131 -0
- package/dist/components/capability-gate/capability-gate.schema.d.ts +3 -0
- package/dist/components/capability-gate/capability-gate.schema.js +128 -0
- package/dist/components/capability-gate/capability-gate.svelte.d.ts +19 -0
- package/dist/components/capability-gate/capability-gate.types.d.ts +70 -0
- package/dist/components/capability-gate/capability-gate.variables.d.ts +2 -0
- package/dist/components/capability-gate/capability-gate.variables.js +61 -0
- package/dist/components/capability-gate/index.d.ts +5 -0
- package/dist/components/capability-gate/index.js +285 -0
- package/dist/components/card/card.css +4 -0
- package/dist/components/card/card.schema.js +5 -1
- package/dist/components/card/card.svelte.d.ts +1 -1
- package/dist/components/card/card.types.d.ts +4 -0
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +8 -4
- package/dist/components/chat/index.css +2 -2
- package/dist/components/chat/index.js +159 -81
- package/dist/components/choice-grid/choice-grid-context.d.ts +23 -0
- package/dist/components/choice-grid/choice-grid.css +27 -0
- package/dist/components/choice-grid/choice-grid.schema.d.ts +3 -0
- package/dist/components/choice-grid/choice-grid.schema.js +121 -0
- package/dist/components/choice-grid/choice-grid.svelte.d.ts +20 -0
- package/dist/components/choice-grid/choice-grid.types.d.ts +122 -0
- package/dist/components/choice-grid/choice-grid.variables.d.ts +2 -0
- package/dist/components/choice-grid/choice-grid.variables.js +61 -0
- package/dist/components/choice-grid/index.d.ts +13 -0
- package/dist/components/choice-grid/index.js +466 -0
- package/dist/components/choice-grid-item/choice-grid-item.css +139 -0
- package/dist/components/choice-grid-item/choice-grid-item.schema.d.ts +3 -0
- package/dist/components/choice-grid-item/choice-grid-item.schema.js +93 -0
- package/dist/components/choice-grid-item/choice-grid-item.svelte.d.ts +17 -0
- package/dist/components/choice-grid-item/choice-grid-item.types.d.ts +24 -0
- package/dist/components/choice-grid-item/choice-grid-item.variables.d.ts +2 -0
- package/dist/components/choice-grid-item/choice-grid-item.variables.js +61 -0
- package/dist/components/choice-grid-item/index.d.ts +5 -0
- package/dist/components/choice-grid-item/index.js +203 -0
- package/dist/components/color-field/color-field.css +6 -9
- package/dist/components/color-picker/color-picker.css +31 -24
- package/dist/components/color-swatch-picker/color-swatch-picker.css +6 -9
- package/dist/components/confirm-dialog/index.js +11 -2
- package/dist/components/context-menu/index.js +114 -43
- package/dist/components/context-menu-trigger/index.js +6 -4
- package/dist/components/data-table/data-table.css +30 -0
- package/dist/components/data-table/data-table.schema.d.ts +3 -0
- package/dist/components/data-table/data-table.schema.js +103 -0
- package/dist/components/data-table/data-table.svelte.d.ts +39 -0
- package/dist/components/data-table/data-table.types.d.ts +86 -0
- package/dist/components/data-table/data-table.variables.d.ts +2 -0
- package/dist/components/data-table/data-table.variables.js +61 -0
- package/dist/components/data-table/index.d.ts +5 -0
- package/dist/components/data-table/index.js +591 -0
- package/dist/components/diff-viewer/index.js +14 -3
- package/dist/components/dropdown/index.js +115 -46
- package/dist/components/dropdown-item/dropdown-item.schema.js +13 -1
- package/dist/components/dropdown-item/dropdown-item.svelte.d.ts +1 -1
- package/dist/components/dropdown-item/dropdown-item.types.d.ts +46 -2
- package/dist/components/dropdown-item/index.d.ts +1 -1
- package/dist/components/dropdown-item/index.js +97 -28
- package/dist/components/floating-action-button/floating-action-button.css +4 -2
- package/dist/components/json-schema-editor/index.js +29 -4
- package/dist/components/keyboard-shortcuts/index.d.ts +5 -0
- package/dist/components/keyboard-shortcuts/index.js +238 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.css +84 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.schema.d.ts +3 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.schema.js +87 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.svelte.d.ts +17 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.types.d.ts +42 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.variables.d.ts +2 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.variables.js +61 -0
- package/dist/components/line-chart/index.js +283 -40
- package/dist/components/line-chart/line-chart.css +57 -8
- package/dist/components/markdown-editor/index.js +129 -51
- package/dist/components/matrix-chart/index.d.ts +5 -0
- package/dist/components/matrix-chart/index.js +1232 -0
- package/dist/components/matrix-chart/matrix-chart.css +50 -0
- package/dist/components/matrix-chart/matrix-chart.schema.d.ts +3 -0
- package/dist/components/matrix-chart/matrix-chart.schema.js +123 -0
- package/dist/components/matrix-chart/matrix-chart.svelte.d.ts +20 -0
- package/dist/components/matrix-chart/matrix-chart.types.d.ts +52 -0
- package/dist/components/matrix-chart/matrix-chart.variables.d.ts +2 -0
- package/dist/components/matrix-chart/matrix-chart.variables.js +61 -0
- package/dist/components/media-controls/index.d.ts +5 -0
- package/dist/components/media-controls/index.js +338 -0
- package/dist/components/media-controls/media-controls.css +112 -0
- package/dist/components/media-controls/media-controls.schema.d.ts +3 -0
- package/dist/components/media-controls/media-controls.schema.js +125 -0
- package/dist/components/media-controls/media-controls.svelte.d.ts +18 -0
- package/dist/components/media-controls/media-controls.types.d.ts +77 -0
- package/dist/components/media-controls/media-controls.variables.d.ts +2 -0
- package/dist/components/media-controls/media-controls.variables.js +61 -0
- package/dist/components/navigation-bar/navigation-bar.schema.js +5 -5
- package/dist/components/navigation-bar/navigation-bar.types.d.ts +2 -1
- package/dist/components/pricing-card/index.d.ts +5 -0
- package/dist/components/pricing-card/index.js +406 -0
- package/dist/components/pricing-card/pricing-card.css +173 -0
- package/dist/components/pricing-card/pricing-card.schema.d.ts +3 -0
- package/dist/components/pricing-card/pricing-card.schema.js +100 -0
- package/dist/components/pricing-card/pricing-card.svelte.d.ts +18 -0
- package/dist/components/pricing-card/pricing-card.types.d.ts +47 -0
- package/dist/components/pricing-card/pricing-card.variables.d.ts +2 -0
- package/dist/components/pricing-card/pricing-card.variables.js +61 -0
- package/dist/components/review-editor/index.js +212 -132
- package/dist/components/share-card/index.d.ts +5 -0
- package/dist/components/share-card/index.js +446 -0
- package/dist/components/share-card/share-card.css +115 -0
- package/dist/components/share-card/share-card.schema.d.ts +3 -0
- package/dist/components/share-card/share-card.schema.js +113 -0
- package/dist/components/share-card/share-card.svelte.d.ts +18 -0
- package/dist/components/share-card/share-card.types.d.ts +66 -0
- package/dist/components/share-card/share-card.variables.d.ts +2 -0
- package/dist/components/share-card/share-card.variables.js +61 -0
- package/dist/components/shortcut-hint/index.d.ts +5 -0
- package/dist/components/shortcut-hint/index.js +197 -0
- package/dist/components/shortcut-hint/shortcut-hint.css +26 -0
- package/dist/components/shortcut-hint/shortcut-hint.schema.d.ts +3 -0
- package/dist/components/shortcut-hint/shortcut-hint.schema.js +96 -0
- package/dist/components/shortcut-hint/shortcut-hint.svelte.d.ts +17 -0
- package/dist/components/shortcut-hint/shortcut-hint.types.d.ts +33 -0
- package/dist/components/shortcut-hint/shortcut-hint.variables.d.ts +2 -0
- package/dist/components/shortcut-hint/shortcut-hint.variables.js +61 -0
- package/dist/components/skip-link/index.d.ts +4 -0
- package/dist/components/skip-link/index.js +180 -0
- package/dist/components/skip-link/skip-link.schema.d.ts +3 -0
- package/dist/components/skip-link/skip-link.schema.js +76 -0
- package/dist/components/skip-link/skip-link.svelte.d.ts +19 -0
- package/dist/components/skip-link/skip-link.types.d.ts +38 -0
- package/dist/components/skip-link/skip-link.variables.d.ts +2 -0
- package/dist/components/skip-link/skip-link.variables.js +61 -0
- package/dist/components/spectrogram/index.d.ts +5 -0
- package/dist/components/spectrogram/index.js +1156 -0
- package/dist/components/spectrogram/spectrogram.css +43 -0
- package/dist/components/spectrogram/spectrogram.schema.d.ts +3 -0
- package/dist/components/spectrogram/spectrogram.schema.js +103 -0
- package/dist/components/spectrogram/spectrogram.svelte.d.ts +21 -0
- package/dist/components/spectrogram/spectrogram.types.d.ts +60 -0
- package/dist/components/spectrogram/spectrogram.variables.d.ts +2 -0
- package/dist/components/spectrogram/spectrogram.variables.js +61 -0
- package/dist/components/spectrum-chart/index.d.ts +5 -0
- package/dist/components/spectrum-chart/index.js +1056 -0
- package/dist/components/spectrum-chart/spectrum-chart.css +49 -0
- package/dist/components/spectrum-chart/spectrum-chart.schema.d.ts +3 -0
- package/dist/components/spectrum-chart/spectrum-chart.schema.js +97 -0
- package/dist/components/spectrum-chart/spectrum-chart.svelte.d.ts +21 -0
- package/dist/components/spectrum-chart/spectrum-chart.types.d.ts +41 -0
- package/dist/components/spectrum-chart/spectrum-chart.variables.d.ts +2 -0
- package/dist/components/spectrum-chart/spectrum-chart.variables.js +61 -0
- package/dist/components/status-dot/status-dot.css +8 -0
- package/dist/components/status-dot/status-dot.schema.js +3 -3
- package/dist/components/status-dot/status-dot.types.d.ts +5 -2
- package/dist/components/subscription-badge/index.d.ts +5 -0
- package/dist/components/subscription-badge/index.js +383 -0
- package/dist/components/subscription-badge/subscription-badge.css +18 -0
- package/dist/components/subscription-badge/subscription-badge.schema.d.ts +3 -0
- package/dist/components/subscription-badge/subscription-badge.schema.js +77 -0
- package/dist/components/subscription-badge/subscription-badge.svelte.d.ts +19 -0
- package/dist/components/subscription-badge/subscription-badge.types.d.ts +28 -0
- package/dist/components/subscription-badge/subscription-badge.variables.d.ts +2 -0
- package/dist/components/subscription-badge/subscription-badge.variables.js +61 -0
- package/dist/components/tab/index.js +14 -1
- package/dist/components/table/index.js +26 -17
- package/dist/components/table-cell/index.js +18 -9
- package/dist/components/table-cell/table-cell.schema.js +5 -1
- package/dist/components/table-cell/table-cell.types.d.ts +16 -1
- package/dist/components/tabs/index.js +14 -1
- package/dist/components/waveform/index.d.ts +5 -0
- package/dist/components/waveform/index.js +1075 -0
- package/dist/components/waveform/waveform.css +53 -0
- package/dist/components/waveform/waveform.schema.d.ts +3 -0
- package/dist/components/waveform/waveform.schema.js +98 -0
- package/dist/components/waveform/waveform.svelte.d.ts +20 -0
- package/dist/components/waveform/waveform.types.d.ts +42 -0
- package/dist/components/waveform/waveform.variables.d.ts +2 -0
- package/dist/components/waveform/waveform.variables.js +61 -0
- package/dist/index.d.ts +33 -2
- package/dist/index.js +144 -115
- package/dist/server/components/accordion/index.js +14 -1
- package/dist/server/components/alert/alert.schema.js +3 -3
- package/dist/server/components/alert/index.js +3 -2
- package/dist/server/components/alert-dialog/index.js +12 -3
- package/dist/server/components/area-chart/index.css +50 -3
- package/dist/server/components/area-chart/index.js +181 -2
- package/dist/server/components/avatar-group/index.css +1 -1
- package/dist/server/components/badge/badge.schema.js +6 -1
- package/dist/server/components/badge/index.css +4 -0
- package/dist/server/components/badge/index.js +3 -1
- package/dist/server/components/bar-chart/index.css +50 -3
- package/dist/server/components/bar-chart/index.js +166 -2
- package/dist/server/components/button/index.css +1 -1
- package/dist/server/components/button/index.js +12 -3
- package/dist/server/components/capability-gate/capability-gate.schema.js +110 -0
- package/dist/server/components/capability-gate/capability-gate.variables.js +43 -0
- package/dist/server/components/capability-gate/index.css +121 -0
- package/dist/server/components/capability-gate/index.js +168 -0
- package/dist/server/components/card/card.schema.js +5 -1
- package/dist/server/components/card/index.css +9 -1
- package/dist/server/components/card/index.js +3 -2
- package/dist/server/components/chat/index.css +2 -2
- package/dist/server/components/chat/index.js +78 -19
- package/dist/server/components/choice-grid/choice-grid.schema.js +103 -0
- package/dist/server/components/choice-grid/choice-grid.variables.js +43 -0
- package/dist/server/components/choice-grid/index.css +103 -0
- package/dist/server/components/choice-grid/index.js +383 -0
- package/dist/server/components/choice-grid-item/choice-grid-item.schema.js +75 -0
- package/dist/server/components/choice-grid-item/choice-grid-item.variables.js +43 -0
- package/dist/server/components/choice-grid-item/index.css +86 -0
- package/dist/server/components/choice-grid-item/index.js +139 -0
- package/dist/server/components/color-field/index.css +2 -4
- package/dist/server/components/color-picker/index.css +14 -10
- package/dist/server/components/color-swatch-picker/index.css +2 -4
- package/dist/server/components/confirm-dialog/index.js +12 -3
- package/dist/server/components/context-menu/index.js +72 -20
- package/dist/server/components/context-menu-trigger/index.js +6 -4
- package/dist/server/components/data-table/data-table.schema.js +85 -0
- package/dist/server/components/data-table/data-table.variables.js +43 -0
- package/dist/server/components/data-table/index.css +182 -0
- package/dist/server/components/data-table/index.js +469 -0
- package/dist/server/components/diff-viewer/index.js +14 -3
- package/dist/server/components/dropdown/index.js +67 -17
- package/dist/server/components/dropdown-item/dropdown-item.schema.js +13 -1
- package/dist/server/components/dropdown-item/index.js +67 -17
- package/dist/server/components/floating-action-button/index.css +1 -1
- package/dist/server/components/json-schema-editor/index.js +29 -4
- package/dist/server/components/keyboard-shortcuts/index.css +86 -0
- package/dist/server/components/keyboard-shortcuts/index.js +149 -0
- package/dist/server/components/keyboard-shortcuts/keyboard-shortcuts.schema.js +69 -0
- package/dist/server/components/keyboard-shortcuts/keyboard-shortcuts.variables.js +43 -0
- package/dist/server/components/line-chart/index.css +50 -3
- package/dist/server/components/line-chart/index.js +181 -2
- package/dist/server/components/markdown-editor/index.js +78 -19
- package/dist/server/components/matrix-chart/index.css +52 -0
- package/dist/server/components/matrix-chart/index.js +1026 -0
- package/dist/server/components/matrix-chart/matrix-chart.schema.js +105 -0
- package/dist/server/components/matrix-chart/matrix-chart.variables.js +43 -0
- package/dist/server/components/media-controls/index.css +109 -0
- package/dist/server/components/media-controls/index.js +192 -0
- package/dist/server/components/media-controls/media-controls.schema.js +107 -0
- package/dist/server/components/media-controls/media-controls.variables.js +43 -0
- package/dist/server/components/navigation-bar/navigation-bar.schema.js +5 -5
- package/dist/server/components/pricing-card/index.css +131 -0
- package/dist/server/components/pricing-card/index.js +258 -0
- package/dist/server/components/pricing-card/pricing-card.schema.js +82 -0
- package/dist/server/components/pricing-card/pricing-card.variables.js +43 -0
- package/dist/server/components/review-editor/index.css +2 -2
- package/dist/server/components/review-editor/index.js +80 -19
- package/dist/server/components/share-card/index.css +113 -0
- package/dist/server/components/share-card/index.js +270 -0
- package/dist/server/components/share-card/share-card.schema.js +95 -0
- package/dist/server/components/share-card/share-card.variables.js +43 -0
- package/dist/server/components/shortcut-hint/index.css +28 -0
- package/dist/server/components/shortcut-hint/index.js +134 -0
- package/dist/server/components/shortcut-hint/shortcut-hint.schema.js +78 -0
- package/dist/server/components/shortcut-hint/shortcut-hint.variables.js +43 -0
- package/dist/server/components/skip-link/index.js +141 -0
- package/dist/server/components/skip-link/skip-link.schema.js +58 -0
- package/dist/server/components/skip-link/skip-link.variables.js +43 -0
- package/dist/server/components/spectrogram/index.css +45 -0
- package/dist/server/components/spectrogram/index.js +970 -0
- package/dist/server/components/spectrogram/spectrogram.schema.js +85 -0
- package/dist/server/components/spectrogram/spectrogram.variables.js +43 -0
- package/dist/server/components/spectrum-chart/index.css +51 -0
- package/dist/server/components/spectrum-chart/index.js +871 -0
- package/dist/server/components/spectrum-chart/spectrum-chart.schema.js +79 -0
- package/dist/server/components/spectrum-chart/spectrum-chart.variables.js +43 -0
- package/dist/server/components/status-dot/index.css +8 -0
- package/dist/server/components/status-dot/status-dot.schema.js +3 -3
- package/dist/server/components/subscription-badge/index.css +2 -0
- package/dist/server/components/subscription-badge/index.js +339 -0
- package/dist/server/components/subscription-badge/subscription-badge.schema.js +59 -0
- package/dist/server/components/subscription-badge/subscription-badge.variables.js +43 -0
- package/dist/server/components/tab/index.js +14 -1
- package/dist/server/components/table/index.js +13 -8
- package/dist/server/components/table-cell/index.js +13 -8
- package/dist/server/components/table-cell/table-cell.schema.js +5 -1
- package/dist/server/components/tabs/index.js +14 -1
- package/dist/server/components/waveform/index.css +55 -0
- package/dist/server/components/waveform/index.js +907 -0
- package/dist/server/components/waveform/waveform.schema.js +80 -0
- package/dist/server/components/waveform/waveform.variables.js +43 -0
- package/dist/server/index.css +1137 -55
- package/dist/server/index.js +4225 -1750
- package/package.json +380 -2
- package/src/_internal/chart/chart-focus-ring.ts +209 -0
- package/src/_internal/chart/chart-utilities.ts +4 -0
- package/src/_internal/chart/heatmap-utilities.ts +159 -0
- package/src/components/accordion/accordion.examples.json +1 -0
- package/src/components/alert/README.md +5 -5
- package/src/components/alert/alert.schema.json +2 -2
- package/src/components/alert/alert.schema.ts +3 -2
- package/src/components/alert/alert.svelte +5 -1
- package/src/components/alert/alert.types.ts +3 -2
- package/src/components/area-chart/README.md +62 -0
- package/src/components/area-chart/area-chart.css +57 -7
- package/src/components/area-chart/area-chart.svelte +128 -10
- package/src/components/avatar-group/avatar-group.css +2 -3
- package/src/components/avatar-group/avatar-group.examples.json +1 -0
- package/src/components/backdrop/README.md +56 -0
- package/src/components/badge/README.md +6 -5
- package/src/components/badge/badge.css +17 -0
- package/src/components/badge/badge.schema.json +5 -0
- package/src/components/badge/badge.schema.ts +6 -0
- package/src/components/badge/badge.svelte +2 -0
- package/src/components/badge/badge.types.ts +7 -0
- package/src/components/bar-chart/README.md +65 -0
- package/src/components/bar-chart/bar-chart.css +57 -7
- package/src/components/bar-chart/bar-chart.svelte +94 -13
- package/src/components/button/button.css +5 -3
- package/src/components/button/button.examples.json +1 -0
- package/src/components/button/button.svelte +15 -0
- package/src/components/capability-gate/README.md +60 -0
- package/src/components/capability-gate/capability-gate.css +131 -0
- package/src/components/capability-gate/capability-gate.examples.json +19 -0
- package/src/components/capability-gate/capability-gate.schema.json +68 -0
- package/src/components/capability-gate/capability-gate.schema.ts +72 -0
- package/src/components/capability-gate/capability-gate.svelte +186 -0
- package/src/components/capability-gate/capability-gate.types.ts +83 -0
- package/src/components/capability-gate/capability-gate.variables.json +1 -0
- package/src/components/capability-gate/capability-gate.variables.ts +3 -0
- package/src/components/capability-gate/index.ts +10 -0
- package/src/components/card/README.md +1 -0
- package/src/components/card/card.css +4 -0
- package/src/components/card/card.examples.json +6 -0
- package/src/components/card/card.schema.json +4 -0
- package/src/components/card/card.schema.ts +5 -0
- package/src/components/card/card.svelte +9 -2
- package/src/components/card/card.types.ts +4 -0
- package/src/components/card/index.ts +1 -1
- package/src/components/chat/README.md +81 -0
- package/src/components/chat/container/chat-jump-controls.svelte +12 -9
- package/src/components/chat/input/chat-input.svelte +7 -8
- package/src/components/chat/message/chat-message.svelte +15 -20
- package/src/components/chat/message/tool-call-group.svelte +10 -4
- package/src/components/choice-grid/README.md +66 -0
- package/src/components/choice-grid/choice-grid-context.ts +30 -0
- package/src/components/choice-grid/choice-grid.css +27 -0
- package/src/components/choice-grid/choice-grid.examples.json +31 -0
- package/src/components/choice-grid/choice-grid.schema.json +61 -0
- package/src/components/choice-grid/choice-grid.schema.ts +70 -0
- package/src/components/choice-grid/choice-grid.svelte +272 -0
- package/src/components/choice-grid/choice-grid.types.ts +152 -0
- package/src/components/choice-grid/choice-grid.variables.json +1 -0
- package/src/components/choice-grid/choice-grid.variables.ts +3 -0
- package/src/components/choice-grid/index.ts +22 -0
- package/src/components/choice-grid-item/README.md +41 -0
- package/src/components/choice-grid-item/choice-grid-item.css +139 -0
- package/src/components/choice-grid-item/choice-grid-item.schema.json +32 -0
- package/src/components/choice-grid-item/choice-grid-item.schema.ts +38 -0
- package/src/components/choice-grid-item/choice-grid-item.svelte +139 -0
- package/src/components/choice-grid-item/choice-grid-item.types.ts +30 -0
- package/src/components/choice-grid-item/choice-grid-item.variables.json +1 -0
- package/src/components/choice-grid-item/choice-grid-item.variables.ts +3 -0
- package/src/components/choice-grid-item/index.ts +6 -0
- package/src/components/click-away-listener/README.md +50 -0
- package/src/components/color-field/color-field.css +6 -9
- package/src/components/color-picker/color-picker.css +31 -24
- package/src/components/color-swatch-picker/color-swatch-picker.css +6 -9
- package/src/components/command-menu/README.md +61 -0
- package/src/components/confirm-dialog/confirm-dialog.examples.json +6 -0
- package/src/components/context-menu/README.md +55 -0
- package/src/components/context-menu-trigger/README.md +50 -0
- package/src/components/context-menu-trigger/context-menu-trigger.svelte +5 -3
- package/src/components/data-table/README.md +67 -0
- package/src/components/data-table/data-table.css +30 -0
- package/src/components/data-table/data-table.examples.json +19 -0
- package/src/components/data-table/data-table.schema.json +43 -0
- package/src/components/data-table/data-table.schema.ts +50 -0
- package/src/components/data-table/data-table.svelte +106 -0
- package/src/components/data-table/data-table.types.ts +89 -0
- package/src/components/data-table/data-table.variables.json +1 -0
- package/src/components/data-table/data-table.variables.ts +3 -0
- package/src/components/data-table/index.ts +6 -0
- package/src/components/diff-viewer/README.md +59 -0
- package/src/components/diff-viewer/front-matter-header.svelte +20 -4
- package/src/components/dropdown-group/README.md +52 -0
- package/src/components/dropdown-item/README.md +10 -7
- package/src/components/dropdown-item/dropdown-item.schema.json +12 -0
- package/src/components/dropdown-item/dropdown-item.schema.ts +14 -0
- package/src/components/dropdown-item/dropdown-item.svelte +108 -25
- package/src/components/dropdown-item/dropdown-item.types.ts +58 -2
- package/src/components/dropdown-item/index.ts +6 -1
- package/src/components/floating-action-button/README.md +53 -0
- package/src/components/floating-action-button/floating-action-button.css +4 -2
- package/src/components/form-section/form-section.examples.json +6 -0
- package/src/components/hover-card/README.md +60 -0
- package/src/components/json-schema-editor/README.md +59 -0
- package/src/components/kanban-board/README.md +62 -0
- package/src/components/keyboard-shortcuts/README.md +51 -0
- package/src/components/keyboard-shortcuts/index.ts +10 -0
- package/src/components/keyboard-shortcuts/keyboard-shortcuts.css +84 -0
- package/src/components/keyboard-shortcuts/keyboard-shortcuts.examples.json +13 -0
- package/src/components/keyboard-shortcuts/keyboard-shortcuts.schema.json +27 -0
- package/src/components/keyboard-shortcuts/keyboard-shortcuts.schema.ts +31 -0
- package/src/components/keyboard-shortcuts/keyboard-shortcuts.svelte +91 -0
- package/src/components/keyboard-shortcuts/keyboard-shortcuts.types.ts +46 -0
- package/src/components/keyboard-shortcuts/keyboard-shortcuts.variables.json +1 -0
- package/src/components/keyboard-shortcuts/keyboard-shortcuts.variables.ts +3 -0
- package/src/components/line-chart/README.md +61 -0
- package/src/components/line-chart/line-chart.css +57 -8
- package/src/components/line-chart/line-chart.svelte +128 -10
- package/src/components/link/README.md +55 -0
- package/src/components/markdown-editor/README.md +70 -0
- package/src/components/markdown-editor/editor-toolbar/toolbar-button.svelte +9 -4
- package/src/components/markdown-editor/editor-toolbar/toolbar-dropdown.svelte +9 -4
- package/src/components/markdown-editor/prosemirror.css +4 -2
- package/src/components/matrix-chart/README.md +61 -0
- package/src/components/matrix-chart/index.ts +10 -0
- package/src/components/matrix-chart/matrix-chart.css +50 -0
- package/src/components/matrix-chart/matrix-chart.examples.json +19 -0
- package/src/components/matrix-chart/matrix-chart.schema.json +63 -0
- package/src/components/matrix-chart/matrix-chart.schema.ts +67 -0
- package/src/components/matrix-chart/matrix-chart.svelte +336 -0
- package/src/components/matrix-chart/matrix-chart.types.ts +56 -0
- package/src/components/matrix-chart/matrix-chart.variables.json +1 -0
- package/src/components/matrix-chart/matrix-chart.variables.ts +3 -0
- package/src/components/media-controls/README.md +60 -0
- package/src/components/media-controls/index.ts +6 -0
- package/src/components/media-controls/media-controls.css +112 -0
- package/src/components/media-controls/media-controls.examples.json +19 -0
- package/src/components/media-controls/media-controls.schema.json +65 -0
- package/src/components/media-controls/media-controls.schema.ts +69 -0
- package/src/components/media-controls/media-controls.svelte +238 -0
- package/src/components/media-controls/media-controls.types.ts +80 -0
- package/src/components/media-controls/media-controls.variables.json +1 -0
- package/src/components/media-controls/media-controls.variables.ts +3 -0
- package/src/components/menu-bar/README.md +53 -0
- package/src/components/navigation-bar/README.md +1 -1
- package/src/components/navigation-bar/navigation-bar.schema.json +4 -4
- package/src/components/navigation-bar/navigation-bar.schema.ts +4 -4
- package/src/components/navigation-bar/navigation-bar.types.ts +2 -1
- package/src/components/pricing-card/README.md +55 -0
- package/src/components/pricing-card/index.ts +6 -0
- package/src/components/pricing-card/pricing-card.css +173 -0
- package/src/components/pricing-card/pricing-card.examples.json +19 -0
- package/src/components/pricing-card/pricing-card.schema.json +40 -0
- package/src/components/pricing-card/pricing-card.schema.ts +44 -0
- package/src/components/pricing-card/pricing-card.svelte +70 -0
- package/src/components/pricing-card/pricing-card.types.ts +49 -0
- package/src/components/pricing-card/pricing-card.variables.json +1 -0
- package/src/components/pricing-card/pricing-card.variables.ts +3 -0
- package/src/components/review-editor/README.md +64 -0
- package/src/components/review-editor/comment-composer.svelte +8 -8
- package/src/components/review-editor/comment-list.svelte +10 -1
- package/src/components/search-field/search-field.examples.json +13 -0
- package/src/components/segment/README.md +55 -0
- package/src/components/share-card/README.md +58 -0
- package/src/components/share-card/index.ts +6 -0
- package/src/components/share-card/share-card.css +115 -0
- package/src/components/share-card/share-card.examples.json +19 -0
- package/src/components/share-card/share-card.schema.json +53 -0
- package/src/components/share-card/share-card.schema.ts +57 -0
- package/src/components/share-card/share-card.svelte +330 -0
- package/src/components/share-card/share-card.types.ts +69 -0
- package/src/components/share-card/share-card.variables.json +1 -0
- package/src/components/share-card/share-card.variables.ts +3 -0
- package/src/components/shortcut-hint/README.md +52 -0
- package/src/components/shortcut-hint/index.ts +6 -0
- package/src/components/shortcut-hint/shortcut-hint.css +26 -0
- package/src/components/shortcut-hint/shortcut-hint.examples.json +13 -0
- package/src/components/shortcut-hint/shortcut-hint.schema.json +36 -0
- package/src/components/shortcut-hint/shortcut-hint.schema.ts +40 -0
- package/src/components/shortcut-hint/shortcut-hint.svelte +62 -0
- package/src/components/shortcut-hint/shortcut-hint.types.ts +35 -0
- package/src/components/shortcut-hint/shortcut-hint.variables.json +1 -0
- package/src/components/shortcut-hint/shortcut-hint.variables.ts +3 -0
- package/src/components/side-navigation/side-navigation.examples.json +6 -0
- package/src/components/skip-link/README.md +50 -0
- package/src/components/skip-link/index.ts +5 -0
- package/src/components/skip-link/skip-link.examples.json +13 -0
- package/src/components/skip-link/skip-link.schema.json +16 -0
- package/src/components/skip-link/skip-link.schema.ts +20 -0
- package/src/components/skip-link/skip-link.svelte +86 -0
- package/src/components/skip-link/skip-link.types.ts +40 -0
- package/src/components/skip-link/skip-link.variables.json +1 -0
- package/src/components/skip-link/skip-link.variables.ts +3 -0
- package/src/components/spectrogram/README.md +58 -0
- package/src/components/spectrogram/index.ts +10 -0
- package/src/components/spectrogram/spectrogram.css +43 -0
- package/src/components/spectrogram/spectrogram.examples.json +13 -0
- package/src/components/spectrogram/spectrogram.schema.json +43 -0
- package/src/components/spectrogram/spectrogram.schema.ts +47 -0
- package/src/components/spectrogram/spectrogram.svelte +284 -0
- package/src/components/spectrogram/spectrogram.types.ts +63 -0
- package/src/components/spectrogram/spectrogram.variables.json +1 -0
- package/src/components/spectrogram/spectrogram.variables.ts +3 -0
- package/src/components/spectrum-chart/README.md +57 -0
- package/src/components/spectrum-chart/index.ts +10 -0
- package/src/components/spectrum-chart/spectrum-chart.css +49 -0
- package/src/components/spectrum-chart/spectrum-chart.examples.json +13 -0
- package/src/components/spectrum-chart/spectrum-chart.schema.json +37 -0
- package/src/components/spectrum-chart/spectrum-chart.schema.ts +41 -0
- package/src/components/spectrum-chart/spectrum-chart.svelte +247 -0
- package/src/components/spectrum-chart/spectrum-chart.types.ts +44 -0
- package/src/components/spectrum-chart/spectrum-chart.variables.json +1 -0
- package/src/components/spectrum-chart/spectrum-chart.variables.ts +3 -0
- package/src/components/status-dot/README.md +7 -7
- package/src/components/status-dot/status-dot.css +8 -0
- package/src/components/status-dot/status-dot.schema.json +2 -2
- package/src/components/status-dot/status-dot.schema.ts +3 -2
- package/src/components/status-dot/status-dot.types.ts +13 -2
- package/src/components/subscription-badge/README.md +50 -0
- package/src/components/subscription-badge/index.ts +6 -0
- package/src/components/subscription-badge/subscription-badge.css +18 -0
- package/src/components/subscription-badge/subscription-badge.examples.json +19 -0
- package/src/components/subscription-badge/subscription-badge.schema.json +16 -0
- package/src/components/subscription-badge/subscription-badge.schema.ts +21 -0
- package/src/components/subscription-badge/subscription-badge.svelte +69 -0
- package/src/components/subscription-badge/subscription-badge.types.ts +37 -0
- package/src/components/subscription-badge/subscription-badge.variables.json +1 -0
- package/src/components/subscription-badge/subscription-badge.variables.ts +3 -0
- package/src/components/table-cell/README.md +6 -5
- package/src/components/table-cell/table-cell.schema.json +4 -0
- package/src/components/table-cell/table-cell.schema.ts +5 -0
- package/src/components/table-cell/table-cell.svelte +9 -3
- package/src/components/table-cell/table-cell.types.ts +16 -1
- package/src/components/tag-input/README.md +75 -0
- package/src/components/typography/README.md +51 -0
- package/src/components/waveform/README.md +57 -0
- package/src/components/waveform/index.ts +6 -0
- package/src/components/waveform/waveform.css +53 -0
- package/src/components/waveform/waveform.examples.json +19 -0
- package/src/components/waveform/waveform.schema.json +38 -0
- package/src/components/waveform/waveform.schema.ts +42 -0
- package/src/components/waveform/waveform.svelte +286 -0
- package/src/components/waveform/waveform.types.ts +45 -0
- package/src/components/waveform/waveform.variables.json +1 -0
- package/src/components/waveform/waveform.variables.ts +3 -0
- package/src/index.ts +85 -2
- package/src/styles/components.css +13 -0
- package/src/styles/shell.css +3 -0
- package/src/styles/tokens-base.css +59 -22
|
@@ -45,8 +45,10 @@
|
|
|
45
45
|
user-select: text;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/* Selected-node styling, not keyboard focus. Keep the geometry distinct from
|
|
49
|
+
the shared focus ring while using a theme token instead of an upstream literal. */
|
|
48
50
|
.ProseMirror-selectednode {
|
|
49
|
-
outline: 2px solid
|
|
51
|
+
outline: 2px solid var(--cinder-accent);
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/* Make sure li selections wrap around markers */
|
|
@@ -61,7 +63,7 @@
|
|
|
61
63
|
right: -2px;
|
|
62
64
|
top: -2px;
|
|
63
65
|
bottom: -2px;
|
|
64
|
-
border: 2px solid
|
|
66
|
+
border: 2px solid var(--cinder-accent);
|
|
65
67
|
pointer-events: none;
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# MatrixChart
|
|
2
|
+
|
|
3
|
+
Categorical × categorical heatmap for dense analytics, confusion matrices, and correlation grids.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { MatrixChart } from '@lostgradient/cinder/matrix-chart';
|
|
10
|
+
</script>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Guidance
|
|
14
|
+
|
|
15
|
+
### Use When
|
|
16
|
+
|
|
17
|
+
- Showing density or magnitude across two categorical dimensions simultaneously.
|
|
18
|
+
- Rendering a confusion matrix where rows are actual classes and columns are predicted classes.
|
|
19
|
+
|
|
20
|
+
### Avoid When
|
|
21
|
+
|
|
22
|
+
- Showing a continuous trend over time — use line-chart instead.
|
|
23
|
+
- Comparing discrete category totals — use bar-chart instead.
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
<!-- generated:props:start -->
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Required | Default | Description |
|
|
30
|
+
| --------------------- | --------------------------------------------------- | -------- | ------- | ----------- |
|
|
31
|
+
| `class` | `string` | no | — | |
|
|
32
|
+
| `colorScale` | `"sequential"` \| `"diverging"` | no | — | |
|
|
33
|
+
| `data` | `object`[] | yes | — | |
|
|
34
|
+
| `dataTableCaption` | `string` | no | — | |
|
|
35
|
+
| `dataTableVisibility` | `"screen-reader-only"` \| `"visible"` \| `"hidden"` | no | — | |
|
|
36
|
+
| `description` | `string` | no | — | |
|
|
37
|
+
| `height` | `number` | no | — | |
|
|
38
|
+
| `label` | `string` | yes | — | |
|
|
39
|
+
| `loading` | `boolean` | no | — | |
|
|
40
|
+
| `showCellLabels` | `boolean` | no | — | |
|
|
41
|
+
| `valueField` | `string` | yes | — | |
|
|
42
|
+
| `xField` | `string` | yes | — | |
|
|
43
|
+
| `yField` | `string` | yes | — | |
|
|
44
|
+
|
|
45
|
+
<!-- generated:props:end -->
|
|
46
|
+
|
|
47
|
+
## CSS Variables
|
|
48
|
+
|
|
49
|
+
<!-- generated:variables:start -->
|
|
50
|
+
|
|
51
|
+
This component does not declare any local CSS variables.
|
|
52
|
+
|
|
53
|
+
<!-- generated:variables:end -->
|
|
54
|
+
|
|
55
|
+
## Subcomponents
|
|
56
|
+
|
|
57
|
+
<!-- generated:subcomponents:start -->
|
|
58
|
+
|
|
59
|
+
None.
|
|
60
|
+
|
|
61
|
+
<!-- generated:subcomponents:end -->
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
|
|
2
|
+
@layer cinder.components {
|
|
3
|
+
.cinder-matrix-chart {
|
|
4
|
+
display: grid;
|
|
5
|
+
gap: var(--cinder-space-3);
|
|
6
|
+
color: var(--cinder-text);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cinder-matrix-chart__description {
|
|
10
|
+
margin: 0;
|
|
11
|
+
color: var(--cinder-text-muted);
|
|
12
|
+
font-size: var(--cinder-text-sm);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cinder-matrix-chart__viewport {
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cinder-matrix-chart svg {
|
|
20
|
+
display: block;
|
|
21
|
+
inline-size: 100%;
|
|
22
|
+
block-size: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.cinder-matrix-chart__cell {
|
|
26
|
+
rx: 2;
|
|
27
|
+
stroke: var(--cinder-surface);
|
|
28
|
+
stroke-width: 1.5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cinder-matrix-chart__cell-label {
|
|
32
|
+
font-size: var(--cinder-text-xs);
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.cinder-matrix-chart__tick-label {
|
|
37
|
+
fill: var(--cinder-text-muted);
|
|
38
|
+
font-size: var(--cinder-text-xs);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.cinder-matrix-chart__state {
|
|
42
|
+
position: absolute;
|
|
43
|
+
inset: 0;
|
|
44
|
+
display: grid;
|
|
45
|
+
place-items: center;
|
|
46
|
+
color: var(--cinder-text-muted);
|
|
47
|
+
background: color-mix(in oklch, var(--cinder-surface) 88%, transparent);
|
|
48
|
+
z-index: 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../schemas/examples.schema.json",
|
|
3
|
+
"component": "matrix-chart",
|
|
4
|
+
"import": "@lostgradient/cinder/matrix-chart",
|
|
5
|
+
"examples": [
|
|
6
|
+
{
|
|
7
|
+
"id": "confusion-matrix",
|
|
8
|
+
"title": "Confusion matrix",
|
|
9
|
+
"description": "A 3-class confusion matrix showing predicted vs actual classification results.",
|
|
10
|
+
"code": "<script lang=\"ts\">\n import { MatrixChart } from '@lostgradient/cinder/matrix-chart';\n\n const data = [\n { actual: 'Cat', predicted: 'Cat', count: 50 },\n { actual: 'Cat', predicted: 'Dog', count: 5 },\n { actual: 'Cat', predicted: 'Bird', count: 2 },\n { actual: 'Dog', predicted: 'Cat', count: 3 },\n { actual: 'Dog', predicted: 'Dog', count: 42 },\n { actual: 'Dog', predicted: 'Bird', count: 1 },\n { actual: 'Bird', predicted: 'Cat', count: 4 },\n { actual: 'Bird', predicted: 'Dog', count: 2 },\n { actual: 'Bird', predicted: 'Bird', count: 38 },\n ];\n</script>\n\n<MatrixChart\n label=\"Confusion matrix — Animal classifier\"\n description=\"Rows are actual classes; columns are predicted classes. Diagonal cells are correct predictions.\"\n {data}\n xField=\"predicted\"\n yField=\"actual\"\n valueField=\"count\"\n colorScale=\"sequential\"\n dataTableVisibility=\"visible\"\n/>\n"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "performance-heatmap",
|
|
14
|
+
"title": "Performance heatmap",
|
|
15
|
+
"description": "Team performance scores across quarters, colored with a diverging scale.",
|
|
16
|
+
"code": "<script lang=\"ts\">\n import { MatrixChart } from '@lostgradient/cinder/matrix-chart';\n\n const data = [\n { team: 'Engineering', quarter: 'Q1', score: 82 },\n { team: 'Engineering', quarter: 'Q2', score: 91 },\n { team: 'Engineering', quarter: 'Q3', score: 78 },\n { team: 'Engineering', quarter: 'Q4', score: 95 },\n { team: 'Design', quarter: 'Q1', score: 74 },\n { team: 'Design', quarter: 'Q2', score: 68 },\n { team: 'Design', quarter: 'Q3', score: 85 },\n { team: 'Design', quarter: 'Q4', score: 90 },\n { team: 'Marketing', quarter: 'Q1', score: 60 },\n { team: 'Marketing', quarter: 'Q2', score: 72 },\n { team: 'Marketing', quarter: 'Q3', score: 65 },\n { team: 'Marketing', quarter: 'Q4', score: 88 },\n { team: 'Sales', quarter: 'Q1', score: 88 },\n { team: 'Sales', quarter: 'Q2', score: 93 },\n { team: 'Sales', quarter: 'Q3', score: 97 },\n { team: 'Sales', quarter: 'Q4', score: 84 },\n ];\n</script>\n\n<MatrixChart\n label=\"Team performance scores by quarter\"\n description=\"Higher scores indicate stronger team performance for the period.\"\n {data}\n xField=\"quarter\"\n yField=\"team\"\n valueField=\"score\"\n colorScale=\"diverging\"\n dataTableVisibility=\"visible\"\n/>\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"label": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"description": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"data": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": {
|
|
16
|
+
"anyOf": [
|
|
17
|
+
{
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "number"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "null"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"xField": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"yField": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"valueField": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"colorScale": {
|
|
40
|
+
"enum": ["sequential", "diverging"]
|
|
41
|
+
},
|
|
42
|
+
"showCellLabels": {
|
|
43
|
+
"type": "boolean"
|
|
44
|
+
},
|
|
45
|
+
"height": {
|
|
46
|
+
"type": "number"
|
|
47
|
+
},
|
|
48
|
+
"loading": {
|
|
49
|
+
"type": "boolean"
|
|
50
|
+
},
|
|
51
|
+
"dataTableCaption": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
},
|
|
54
|
+
"dataTableVisibility": {
|
|
55
|
+
"enum": ["screen-reader-only", "visible", "hidden"]
|
|
56
|
+
},
|
|
57
|
+
"class": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"required": ["data", "label", "valueField", "xField", "yField"]
|
|
63
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ComponentSchema } from '../../schema-types';
|
|
2
|
+
|
|
3
|
+
const schema = {
|
|
4
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
label: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
},
|
|
10
|
+
description: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
},
|
|
13
|
+
data: {
|
|
14
|
+
type: 'array',
|
|
15
|
+
items: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
additionalProperties: {
|
|
18
|
+
anyOf: [
|
|
19
|
+
{
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'number',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'null',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
xField: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
},
|
|
35
|
+
yField: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
},
|
|
38
|
+
valueField: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
},
|
|
41
|
+
colorScale: {
|
|
42
|
+
enum: ['sequential', 'diverging'],
|
|
43
|
+
},
|
|
44
|
+
showCellLabels: {
|
|
45
|
+
type: 'boolean',
|
|
46
|
+
},
|
|
47
|
+
height: {
|
|
48
|
+
type: 'number',
|
|
49
|
+
},
|
|
50
|
+
loading: {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
},
|
|
53
|
+
dataTableCaption: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
},
|
|
56
|
+
dataTableVisibility: {
|
|
57
|
+
enum: ['screen-reader-only', 'visible', 'hidden'],
|
|
58
|
+
},
|
|
59
|
+
class: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
additionalProperties: false,
|
|
64
|
+
required: ['data', 'label', 'valueField', 'xField', 'yField'],
|
|
65
|
+
} satisfies ComponentSchema;
|
|
66
|
+
|
|
67
|
+
export default schema as ComponentSchema;
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* @cinder
|
|
4
|
+
* @category data-display
|
|
5
|
+
* @status alpha
|
|
6
|
+
* @purpose Categorical × categorical heatmap for dense analytics, confusion matrices, and correlation grids.
|
|
7
|
+
* @tag chart
|
|
8
|
+
* @tag heatmap
|
|
9
|
+
* @tag matrix
|
|
10
|
+
* @tag analytics
|
|
11
|
+
* @useWhen Showing density or magnitude across two categorical dimensions simultaneously.
|
|
12
|
+
* @useWhen Rendering a confusion matrix where rows are actual classes and columns are predicted classes.
|
|
13
|
+
* @avoidWhen Showing a continuous trend over time — use line-chart instead.
|
|
14
|
+
* @avoidWhen Comparing discrete category totals — use bar-chart instead.
|
|
15
|
+
* @related bar-chart, line-chart, area-chart
|
|
16
|
+
*/
|
|
17
|
+
export type { MatrixChartProps, MatrixChartSchemaProps } from './matrix-chart.types.ts';
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { dataTableClass } from '../../_internal/chart/chart-utilities.ts';
|
|
22
|
+
import {
|
|
23
|
+
heatmapCellFill,
|
|
24
|
+
heatmapDomain,
|
|
25
|
+
heatmapLabelFill,
|
|
26
|
+
toFiniteOrNull,
|
|
27
|
+
} from '../../_internal/chart/heatmap-utilities.ts';
|
|
28
|
+
import { classNames } from '../../utilities/class-names.ts';
|
|
29
|
+
import type { MatrixChartProps } from './matrix-chart.types.ts';
|
|
30
|
+
|
|
31
|
+
let {
|
|
32
|
+
label,
|
|
33
|
+
description,
|
|
34
|
+
data,
|
|
35
|
+
xField,
|
|
36
|
+
yField,
|
|
37
|
+
valueField,
|
|
38
|
+
colorScale = 'sequential',
|
|
39
|
+
showCellLabels = true,
|
|
40
|
+
height = 280,
|
|
41
|
+
loading = false,
|
|
42
|
+
dataTableCaption,
|
|
43
|
+
dataTableVisibility = 'screen-reader-only',
|
|
44
|
+
class: customClassName,
|
|
45
|
+
empty,
|
|
46
|
+
loadingContent,
|
|
47
|
+
id,
|
|
48
|
+
...rest
|
|
49
|
+
}: MatrixChartProps = $props();
|
|
50
|
+
|
|
51
|
+
const generatedId = $props.id();
|
|
52
|
+
const rootId = $derived(id ?? generatedId);
|
|
53
|
+
const descriptionId = $derived(description ? `${rootId}-description` : undefined);
|
|
54
|
+
|
|
55
|
+
// Geometry constants
|
|
56
|
+
const marginTop = 40;
|
|
57
|
+
const marginRight = 16;
|
|
58
|
+
const marginBottom = 16;
|
|
59
|
+
const marginLeft = 80;
|
|
60
|
+
|
|
61
|
+
let measuredWidth = $state(400);
|
|
62
|
+
let rootElement = $state<HTMLElement>();
|
|
63
|
+
|
|
64
|
+
$effect(() => {
|
|
65
|
+
const element = rootElement;
|
|
66
|
+
if (!element) return;
|
|
67
|
+
// Guard for SSR / test environments without ResizeObserver — fall back to a
|
|
68
|
+
// one-shot measurement so the chart still renders at a sensible width.
|
|
69
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
70
|
+
const rect = element.getBoundingClientRect();
|
|
71
|
+
if (rect.width > 0) measuredWidth = rect.width;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const observer = new ResizeObserver((entries) => {
|
|
75
|
+
const entry = entries[0];
|
|
76
|
+
// Ignore zero-width measurements (element hidden / display:none) so the
|
|
77
|
+
// last good width is kept instead of collapsing the chart geometry to a
|
|
78
|
+
// degenerate 1px viewport, matching the getBoundingClientRect fallback.
|
|
79
|
+
if (entry && entry.contentRect.width > 0) measuredWidth = entry.contentRect.width;
|
|
80
|
+
});
|
|
81
|
+
observer.observe(element);
|
|
82
|
+
return () => observer.disconnect();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const plotWidth = $derived(Math.max(1, measuredWidth - marginLeft - marginRight));
|
|
86
|
+
const plotHeight = $derived(Math.max(1, height - marginTop - marginBottom));
|
|
87
|
+
|
|
88
|
+
// Collect unique x and y labels in insertion order
|
|
89
|
+
const xLabels = $derived.by(() => {
|
|
90
|
+
const seen = new Set<string>();
|
|
91
|
+
const result: string[] = [];
|
|
92
|
+
for (const datum of data) {
|
|
93
|
+
const value = datum[xField];
|
|
94
|
+
if (value === null || value === undefined) continue;
|
|
95
|
+
const label = String(value);
|
|
96
|
+
if (!seen.has(label)) {
|
|
97
|
+
seen.add(label);
|
|
98
|
+
result.push(label);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const yLabels = $derived.by(() => {
|
|
105
|
+
const seen = new Set<string>();
|
|
106
|
+
const result: string[] = [];
|
|
107
|
+
for (const datum of data) {
|
|
108
|
+
const value = datum[yField];
|
|
109
|
+
if (value === null || value === undefined) continue;
|
|
110
|
+
const label = String(value);
|
|
111
|
+
if (!seen.has(label)) {
|
|
112
|
+
seen.add(label);
|
|
113
|
+
result.push(label);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const isEmpty = $derived(xLabels.length === 0 || yLabels.length === 0);
|
|
120
|
+
|
|
121
|
+
// Cell pixel dimensions
|
|
122
|
+
const cellWidth = $derived(xLabels.length > 0 ? plotWidth / xLabels.length : 0);
|
|
123
|
+
const cellHeight = $derived(yLabels.length > 0 ? plotHeight / yLabels.length : 0);
|
|
124
|
+
|
|
125
|
+
// Build value lookup and find min/max for color scaling
|
|
126
|
+
type CellData = {
|
|
127
|
+
/** Stable, collision-free key built from the grid indices (labels may contain `::`). */
|
|
128
|
+
key: string;
|
|
129
|
+
xLabel: string;
|
|
130
|
+
yLabel: string;
|
|
131
|
+
value: number | null;
|
|
132
|
+
x: number;
|
|
133
|
+
y: number;
|
|
134
|
+
width: number;
|
|
135
|
+
height: number;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// Nested x → (y → value) lookup. A nested map avoids the string-join collision
|
|
139
|
+
// where `x="A::B", y="C"` and `x="A", y="B::C"` would share a flat `A::B::C` key.
|
|
140
|
+
const valueLookup = $derived.by((): Map<string, Map<string, number | null>> => {
|
|
141
|
+
const lookup = new Map<string, Map<string, number | null>>();
|
|
142
|
+
for (const datum of data) {
|
|
143
|
+
const xRaw = datum[xField];
|
|
144
|
+
const yRaw = datum[yField];
|
|
145
|
+
if (xRaw === null || xRaw === undefined) continue;
|
|
146
|
+
if (yRaw === null || yRaw === undefined) continue;
|
|
147
|
+
const xKey = String(xRaw);
|
|
148
|
+
const yKey = String(yRaw);
|
|
149
|
+
let column = lookup.get(xKey);
|
|
150
|
+
if (!column) {
|
|
151
|
+
column = new Map<string, number | null>();
|
|
152
|
+
lookup.set(xKey, column);
|
|
153
|
+
}
|
|
154
|
+
// Non-finite values (NaN / Infinity) are treated as missing rather than
|
|
155
|
+
// poisoning the domain, normalization, and color-mix percentages.
|
|
156
|
+
column.set(yKey, toFiniteOrNull(datum[valueField]));
|
|
157
|
+
}
|
|
158
|
+
return lookup;
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
function lookupValue(xLabel: string, yLabel: string): number | null {
|
|
162
|
+
return valueLookup.get(xLabel)?.get(yLabel) ?? null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const cells = $derived.by((): CellData[] => {
|
|
166
|
+
const result: CellData[] = [];
|
|
167
|
+
for (const [yIndex, currentYLabel] of yLabels.entries()) {
|
|
168
|
+
for (const [xIndex, currentXLabel] of xLabels.entries()) {
|
|
169
|
+
result.push({
|
|
170
|
+
key: `${xIndex}:${yIndex}`,
|
|
171
|
+
xLabel: currentXLabel,
|
|
172
|
+
yLabel: currentYLabel,
|
|
173
|
+
value: lookupValue(currentXLabel, currentYLabel),
|
|
174
|
+
x: xIndex * cellWidth,
|
|
175
|
+
y: yIndex * cellHeight,
|
|
176
|
+
width: cellWidth,
|
|
177
|
+
height: cellHeight,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return result;
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Domain over the finite values only (shared with Spectrogram). Diverging is
|
|
185
|
+
// zero-centred inside the utility so 0 always maps to the neutral midpoint.
|
|
186
|
+
const domain = $derived(heatmapDomain(cells.map((cell) => cell.value)));
|
|
187
|
+
|
|
188
|
+
function cellFill(value: number | null): string {
|
|
189
|
+
return heatmapCellFill(value, domain, colorScale);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function formatValue(value: number | null): string {
|
|
193
|
+
if (value === null) return '';
|
|
194
|
+
return new Intl.NumberFormat(undefined, { maximumFractionDigits: 2 }).format(value);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function cellLabelFill(value: number | null): string {
|
|
198
|
+
return heatmapLabelFill(value, domain, colorScale);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const hasDataTable = $derived(dataTableVisibility !== 'hidden');
|
|
202
|
+
|
|
203
|
+
// Table rows for the data table fallback: xLabel × yLabel grid. Reuses the
|
|
204
|
+
// nested lookup (O(1) per cell) instead of scanning the flattened cells array.
|
|
205
|
+
const tableRows = $derived.by(() => {
|
|
206
|
+
return yLabels.map((currentYLabel) => {
|
|
207
|
+
const values = xLabels.map((currentXLabel) => ({
|
|
208
|
+
xLabel: currentXLabel,
|
|
209
|
+
value: lookupValue(currentXLabel, currentYLabel),
|
|
210
|
+
}));
|
|
211
|
+
return { yLabel: currentYLabel, values };
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
</script>
|
|
215
|
+
|
|
216
|
+
<figure
|
|
217
|
+
{...rest}
|
|
218
|
+
bind:this={rootElement}
|
|
219
|
+
id={rootId}
|
|
220
|
+
class={classNames('cinder-matrix-chart', customClassName)}
|
|
221
|
+
aria-label={label}
|
|
222
|
+
aria-describedby={descriptionId}
|
|
223
|
+
data-cinder-color-scale={colorScale}
|
|
224
|
+
>
|
|
225
|
+
{#if description}
|
|
226
|
+
<p id={descriptionId} class="cinder-matrix-chart__description">{description}</p>
|
|
227
|
+
{/if}
|
|
228
|
+
<div
|
|
229
|
+
class="cinder-matrix-chart__viewport"
|
|
230
|
+
style:height="{height}px"
|
|
231
|
+
data-cinder-loading={loading || undefined}
|
|
232
|
+
>
|
|
233
|
+
{#if loading}
|
|
234
|
+
<div class="cinder-matrix-chart__state">
|
|
235
|
+
{#if loadingContent}{@render loadingContent()}{:else}Loading chart…{/if}
|
|
236
|
+
</div>
|
|
237
|
+
{:else if isEmpty}
|
|
238
|
+
<div class="cinder-matrix-chart__state">
|
|
239
|
+
{#if empty}{@render empty()}{:else}No chart data{/if}
|
|
240
|
+
</div>
|
|
241
|
+
{/if}
|
|
242
|
+
<svg
|
|
243
|
+
role="img"
|
|
244
|
+
viewBox={`0 0 ${measuredWidth} ${height}`}
|
|
245
|
+
aria-hidden={loading || isEmpty ? 'true' : undefined}
|
|
246
|
+
aria-labelledby={!loading && !isEmpty ? `${rootId}-svg-title` : undefined}
|
|
247
|
+
>
|
|
248
|
+
{#if !loading && !isEmpty}
|
|
249
|
+
<title id="{rootId}-svg-title">{label}</title>
|
|
250
|
+
{/if}
|
|
251
|
+
<!-- The plot only renders with data and when not loading — otherwise the
|
|
252
|
+
heatmap cells/labels would draw under the loading or empty overlay
|
|
253
|
+
(data may be present while loading, so isEmpty alone is not enough). -->
|
|
254
|
+
{#if !loading && !isEmpty}
|
|
255
|
+
<g transform={`translate(${marginLeft}, ${marginTop})`}>
|
|
256
|
+
<!-- X-axis labels (column headers) -->
|
|
257
|
+
{#each xLabels as xLabel, index (xLabel)}
|
|
258
|
+
<text
|
|
259
|
+
class="cinder-matrix-chart__tick-label"
|
|
260
|
+
x={index * cellWidth + cellWidth / 2}
|
|
261
|
+
y={-8}
|
|
262
|
+
text-anchor="middle"
|
|
263
|
+
dominant-baseline="auto">{xLabel}</text
|
|
264
|
+
>
|
|
265
|
+
{/each}
|
|
266
|
+
<!-- Y-axis labels (row headers) -->
|
|
267
|
+
{#each yLabels as yLabel, index (yLabel)}
|
|
268
|
+
<text
|
|
269
|
+
class="cinder-matrix-chart__tick-label"
|
|
270
|
+
x={-8}
|
|
271
|
+
y={index * cellHeight + cellHeight / 2}
|
|
272
|
+
text-anchor="end"
|
|
273
|
+
dominant-baseline="middle">{yLabel}</text
|
|
274
|
+
>
|
|
275
|
+
{/each}
|
|
276
|
+
<!-- Matrix cells -->
|
|
277
|
+
{#each cells as cell (cell.key)}
|
|
278
|
+
<g>
|
|
279
|
+
<rect
|
|
280
|
+
class="cinder-matrix-chart__cell"
|
|
281
|
+
x={cell.x}
|
|
282
|
+
y={cell.y}
|
|
283
|
+
width={cell.width}
|
|
284
|
+
height={cell.height}
|
|
285
|
+
fill={cellFill(cell.value)}
|
|
286
|
+
aria-hidden="true"
|
|
287
|
+
data-cinder-x={cell.xLabel}
|
|
288
|
+
data-cinder-y={cell.yLabel}
|
|
289
|
+
>
|
|
290
|
+
<title
|
|
291
|
+
>{cell.xLabel} × {cell.yLabel}: {cell.value !== null
|
|
292
|
+
? formatValue(cell.value)
|
|
293
|
+
: 'no data'}</title
|
|
294
|
+
>
|
|
295
|
+
</rect>
|
|
296
|
+
{#if showCellLabels && cell.value !== null}
|
|
297
|
+
<text
|
|
298
|
+
class="cinder-matrix-chart__cell-label"
|
|
299
|
+
x={cell.x + cell.width / 2}
|
|
300
|
+
y={cell.y + cell.height / 2}
|
|
301
|
+
text-anchor="middle"
|
|
302
|
+
dominant-baseline="middle"
|
|
303
|
+
fill={cellLabelFill(cell.value)}
|
|
304
|
+
aria-hidden="true">{formatValue(cell.value)}</text
|
|
305
|
+
>
|
|
306
|
+
{/if}
|
|
307
|
+
</g>
|
|
308
|
+
{/each}
|
|
309
|
+
</g>
|
|
310
|
+
{/if}
|
|
311
|
+
</svg>
|
|
312
|
+
</div>
|
|
313
|
+
{#if hasDataTable}
|
|
314
|
+
<table class={dataTableClass(dataTableVisibility)}>
|
|
315
|
+
<caption>{dataTableCaption ?? label}</caption>
|
|
316
|
+
<thead>
|
|
317
|
+
<tr>
|
|
318
|
+
<th scope="col">{yField}</th>
|
|
319
|
+
{#each xLabels as xLabel (xLabel)}
|
|
320
|
+
<th scope="col">{xLabel}</th>
|
|
321
|
+
{/each}
|
|
322
|
+
</tr>
|
|
323
|
+
</thead>
|
|
324
|
+
<tbody>
|
|
325
|
+
{#each tableRows as row (row.yLabel)}
|
|
326
|
+
<tr>
|
|
327
|
+
<th scope="row">{row.yLabel}</th>
|
|
328
|
+
{#each row.values as cell (cell.xLabel)}
|
|
329
|
+
<td>{cell.value !== null ? formatValue(cell.value) : '—'}</td>
|
|
330
|
+
{/each}
|
|
331
|
+
</tr>
|
|
332
|
+
{/each}
|
|
333
|
+
</tbody>
|
|
334
|
+
</table>
|
|
335
|
+
{/if}
|
|
336
|
+
</figure>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ChartDataTableVisibility } from '../chart.types.ts';
|
|
4
|
+
|
|
5
|
+
export type MatrixColorScale = 'sequential' | 'diverging';
|
|
6
|
+
|
|
7
|
+
export type MatrixChartDatum = Record<string, string | number | null | undefined>;
|
|
8
|
+
|
|
9
|
+
export type MatrixChartProps = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
10
|
+
/** Accessible label for the chart. Required for screen readers. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Optional description rendered below the label. */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** Rows of data. Each row must contain xField, yField, and valueField. */
|
|
15
|
+
data: MatrixChartDatum[];
|
|
16
|
+
/** Key on each datum used for the x-axis (columns). */
|
|
17
|
+
xField: string;
|
|
18
|
+
/** Key on each datum used for the y-axis (rows). */
|
|
19
|
+
yField: string;
|
|
20
|
+
/** Key on each datum used for the numeric cell value. */
|
|
21
|
+
valueField: string;
|
|
22
|
+
/** Color interpolation scale. Default `sequential`. */
|
|
23
|
+
colorScale?: MatrixColorScale;
|
|
24
|
+
/** Show cell value labels. Default `true`. */
|
|
25
|
+
showCellLabels?: boolean;
|
|
26
|
+
/** Pixel height of the chart viewport. Default `280`. */
|
|
27
|
+
height?: number;
|
|
28
|
+
/** Whether the chart is in a loading state. */
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
/** Custom data table caption; falls back to `label`. */
|
|
31
|
+
dataTableCaption?: string;
|
|
32
|
+
/** Controls data table visibility. Default `screen-reader-only`. */
|
|
33
|
+
dataTableVisibility?: ChartDataTableVisibility;
|
|
34
|
+
/** Custom class applied to the root element. */
|
|
35
|
+
class?: string;
|
|
36
|
+
/** Snippet rendered when the chart has no data. */
|
|
37
|
+
empty?: Snippet;
|
|
38
|
+
/** Snippet rendered while the chart is loading. */
|
|
39
|
+
loadingContent?: Snippet;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type MatrixChartSchemaProps = {
|
|
43
|
+
label: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
data: Record<string, string | number | null>[];
|
|
46
|
+
xField: string;
|
|
47
|
+
yField: string;
|
|
48
|
+
valueField: string;
|
|
49
|
+
colorScale?: MatrixColorScale;
|
|
50
|
+
showCellLabels?: boolean;
|
|
51
|
+
height?: number;
|
|
52
|
+
loading?: boolean;
|
|
53
|
+
dataTableCaption?: string;
|
|
54
|
+
dataTableVisibility?: ChartDataTableVisibility;
|
|
55
|
+
class?: string;
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|