@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
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* @cinder
|
|
4
|
+
* @category data-display
|
|
5
|
+
* @status alpha
|
|
6
|
+
* @purpose Responsive SVG time × frequency heatmap for visualizing audio spectrogram data.
|
|
7
|
+
* @tag chart
|
|
8
|
+
* @tag spectrogram
|
|
9
|
+
* @tag signal
|
|
10
|
+
* @tag audio
|
|
11
|
+
* @useWhen Visualizing how frequency content of a signal changes over time (time × frequency heatmap).
|
|
12
|
+
* @useWhen Displaying pre-computed spectrogram frames from an FFT or short-time Fourier transform.
|
|
13
|
+
* @avoidWhen Only a single spectrum snapshot is needed — use spectrum-chart instead.
|
|
14
|
+
* @avoidWhen Real-time live audio spectrogram is needed — feed frames as props yourself.
|
|
15
|
+
* @avoidWhen A categorical × categorical heatmap without a time axis is needed — use matrix-chart instead.
|
|
16
|
+
* @related spectrum-chart, waveform, matrix-chart
|
|
17
|
+
*/
|
|
18
|
+
export type {
|
|
19
|
+
SpectrogramFrame,
|
|
20
|
+
SpectrogramProps,
|
|
21
|
+
SpectrogramSchemaProps,
|
|
22
|
+
} from './spectrogram.types.ts';
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import { dataTableClass } from '../../_internal/chart/chart-utilities.ts';
|
|
27
|
+
import {
|
|
28
|
+
heatmapCellFill,
|
|
29
|
+
heatmapDomainOfRows,
|
|
30
|
+
toFiniteOrNull,
|
|
31
|
+
} from '../../_internal/chart/heatmap-utilities.ts';
|
|
32
|
+
import { classNames } from '../../utilities/class-names.ts';
|
|
33
|
+
import type { SpectrogramProps } from './spectrogram.types.ts';
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
label,
|
|
37
|
+
description,
|
|
38
|
+
frames,
|
|
39
|
+
frequencyLabels,
|
|
40
|
+
height = 200,
|
|
41
|
+
loading = false,
|
|
42
|
+
dataTableVisibility = 'screen-reader-only',
|
|
43
|
+
dataTableCaption,
|
|
44
|
+
class: customClassName,
|
|
45
|
+
empty,
|
|
46
|
+
loadingContent,
|
|
47
|
+
id,
|
|
48
|
+
...rest
|
|
49
|
+
}: SpectrogramProps = $props();
|
|
50
|
+
|
|
51
|
+
const generatedId = $props.id();
|
|
52
|
+
const rootId = $derived(id ?? generatedId);
|
|
53
|
+
const descriptionId = $derived(description ? `${rootId}-description` : undefined);
|
|
54
|
+
|
|
55
|
+
const marginTop = 8;
|
|
56
|
+
const marginRight = 16;
|
|
57
|
+
const marginBottom = 32;
|
|
58
|
+
const marginLeft = 60;
|
|
59
|
+
|
|
60
|
+
let measuredWidth = $state(400);
|
|
61
|
+
let rootElement = $state<HTMLElement>();
|
|
62
|
+
|
|
63
|
+
$effect(() => {
|
|
64
|
+
const element = rootElement;
|
|
65
|
+
if (!element) return;
|
|
66
|
+
// Guard for SSR / test environments without ResizeObserver.
|
|
67
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
68
|
+
const rect = element.getBoundingClientRect();
|
|
69
|
+
if (rect.width > 0) measuredWidth = rect.width;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const observer = new ResizeObserver((entries) => {
|
|
73
|
+
const entry = entries[0];
|
|
74
|
+
// Ignore zero-width measurements (hidden / display:none) so the last good
|
|
75
|
+
// width is kept rather than collapsing the geometry, matching the fallback.
|
|
76
|
+
if (entry && entry.contentRect.width > 0) measuredWidth = entry.contentRect.width;
|
|
77
|
+
});
|
|
78
|
+
observer.observe(element);
|
|
79
|
+
return () => observer.disconnect();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const plotWidth = $derived(Math.max(1, measuredWidth - marginLeft - marginRight));
|
|
83
|
+
const plotHeight = $derived(Math.max(1, height - marginTop - marginBottom));
|
|
84
|
+
|
|
85
|
+
// Frequency-bin count is the MAX across frames so ragged input renders a full
|
|
86
|
+
// rectangular grid: shorter frames leave explicit missing cells rather than
|
|
87
|
+
// overflowing the plot or silently dropping rows.
|
|
88
|
+
const binCount = $derived(frames.reduce((max, frame) => Math.max(max, frame.bins.length), 0));
|
|
89
|
+
|
|
90
|
+
// The bin-index list [0, 1, …, binCount-1], computed once and reused for every
|
|
91
|
+
// frame's column rather than rebuilding an Array.from() per frame in the render
|
|
92
|
+
// loop.
|
|
93
|
+
const binIndices = $derived(Array.from({ length: binCount }, (_, index) => index));
|
|
94
|
+
|
|
95
|
+
// A frame with zero bins contributes no usable data; the chart is "empty" when
|
|
96
|
+
// there are no frames OR no frequency bins anywhere.
|
|
97
|
+
const isEmpty = $derived(frames.length === 0 || binCount === 0);
|
|
98
|
+
|
|
99
|
+
// Cell dimensions
|
|
100
|
+
const cellWidth = $derived(frames.length > 0 ? plotWidth / frames.length : 0);
|
|
101
|
+
const cellHeight = $derived(binCount > 0 ? plotHeight / binCount : 0);
|
|
102
|
+
|
|
103
|
+
// Read a frame's bin as a finite value or null (missing). Non-finite values
|
|
104
|
+
// (NaN/Infinity) and out-of-range indices (ragged frames) are missing.
|
|
105
|
+
function binValueAt(frameIndex: number, binIndex: number): number | null {
|
|
106
|
+
return toFiniteOrNull(frames[frameIndex]?.bins[binIndex]);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Global color domain over the finite values only (shared with MatrixChart).
|
|
110
|
+
// Computed in a single nested pass over the frames so a large frames × bins
|
|
111
|
+
// grid never materializes a full flattened copy of every bin.
|
|
112
|
+
const domain = $derived(heatmapDomainOfRows(frames.map((frame) => frame.bins)));
|
|
113
|
+
|
|
114
|
+
function cellFill(value: number | null): string {
|
|
115
|
+
return heatmapCellFill(value, domain, 'sequential');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Convert a bin index to a y-coordinate. Frequency increases UPWARD (the audio
|
|
119
|
+
// convention): bin 0 (lowest frequency) sits at the BOTTOM of the plot.
|
|
120
|
+
function binY(binIndex: number): number {
|
|
121
|
+
return plotHeight - (binIndex + 1) * cellHeight;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Frequency axis labels, one per bin index. A PARTIAL `frequencyLabels` is
|
|
125
|
+
// honoured per-index — a provided label is used where present, and bins beyond
|
|
126
|
+
// its length fall back to the numeric index (rather than discarding all of the
|
|
127
|
+
// provided labels just because later/ragged frames added extra bins).
|
|
128
|
+
const yLabels = $derived.by(() =>
|
|
129
|
+
Array.from({ length: binCount }, (_, index) => frequencyLabels?.[index] ?? String(index)),
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// Show a subset of y-axis labels
|
|
133
|
+
const maxYLabels = 8;
|
|
134
|
+
const yLabelStep = $derived(Math.max(1, Math.ceil(binCount / maxYLabels)));
|
|
135
|
+
|
|
136
|
+
// Show a subset of x-axis (time) labels
|
|
137
|
+
const maxXLabels = 10;
|
|
138
|
+
const xLabelStep = $derived(Math.max(1, Math.ceil(frames.length / maxXLabels)));
|
|
139
|
+
|
|
140
|
+
const hasDataTable = $derived(dataTableVisibility !== 'hidden');
|
|
141
|
+
|
|
142
|
+
// Table rows: each frame is a column; rows are frequency bins.
|
|
143
|
+
// For accessibility, sample every-Nth frame and bin so the full range is represented
|
|
144
|
+
// rather than silently truncating to first-N.
|
|
145
|
+
const maxTableFrames = 10;
|
|
146
|
+
const maxTableBins = 10;
|
|
147
|
+
const tableFrameStep = $derived(Math.max(1, Math.ceil(frames.length / maxTableFrames)));
|
|
148
|
+
const tableBinStep = $derived(Math.max(1, Math.ceil(binCount / maxTableBins)));
|
|
149
|
+
const tableFrames = $derived(
|
|
150
|
+
frames
|
|
151
|
+
.map((frame, frameIndex) => ({ frame, frameIndex }))
|
|
152
|
+
.filter((_, index) => index % tableFrameStep === 0)
|
|
153
|
+
.slice(0, maxTableFrames),
|
|
154
|
+
);
|
|
155
|
+
// Bins listed top-to-bottom to MATCH the visual: the SVG places bin 0 (lowest
|
|
156
|
+
// frequency) at the bottom, so the table's first row is the highest sampled
|
|
157
|
+
// bin and the last row is bin 0 — a screen-reader user reads the same vertical
|
|
158
|
+
// frequency order they would see.
|
|
159
|
+
const tableBinIndices = $derived(
|
|
160
|
+
Array.from({ length: binCount }, (_, index) => index)
|
|
161
|
+
.filter((index) => index % tableBinStep === 0)
|
|
162
|
+
.slice(0, maxTableBins)
|
|
163
|
+
.reverse(),
|
|
164
|
+
);
|
|
165
|
+
const isTruncated = $derived(frames.length > maxTableFrames || binCount > maxTableBins);
|
|
166
|
+
const tableCaption = $derived(
|
|
167
|
+
isTruncated
|
|
168
|
+
? `${dataTableCaption ?? label} (showing ${tableFrames.length} of ${frames.length} frames, ${tableBinIndices.length} of ${binCount} bins)`
|
|
169
|
+
: (dataTableCaption ?? label),
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
function formatValue(value: number | null): string {
|
|
173
|
+
if (value === null) return '—';
|
|
174
|
+
return new Intl.NumberFormat(undefined, { maximumFractionDigits: 3 }).format(value);
|
|
175
|
+
}
|
|
176
|
+
</script>
|
|
177
|
+
|
|
178
|
+
<figure
|
|
179
|
+
{...rest}
|
|
180
|
+
bind:this={rootElement}
|
|
181
|
+
id={rootId}
|
|
182
|
+
class={classNames('cinder-spectrogram', customClassName)}
|
|
183
|
+
aria-label={label}
|
|
184
|
+
aria-describedby={descriptionId}
|
|
185
|
+
>
|
|
186
|
+
{#if description}
|
|
187
|
+
<p id={descriptionId} class="cinder-spectrogram__description">{description}</p>
|
|
188
|
+
{/if}
|
|
189
|
+
<div
|
|
190
|
+
class="cinder-spectrogram__viewport"
|
|
191
|
+
style:height="{height}px"
|
|
192
|
+
data-cinder-loading={loading || undefined}
|
|
193
|
+
>
|
|
194
|
+
{#if loading}
|
|
195
|
+
<div class="cinder-spectrogram__state">
|
|
196
|
+
{#if loadingContent}{@render loadingContent()}{:else}Loading…{/if}
|
|
197
|
+
</div>
|
|
198
|
+
{:else if isEmpty}
|
|
199
|
+
<div class="cinder-spectrogram__state">
|
|
200
|
+
{#if empty}{@render empty()}{:else}No spectrogram data{/if}
|
|
201
|
+
</div>
|
|
202
|
+
{/if}
|
|
203
|
+
<svg
|
|
204
|
+
role="img"
|
|
205
|
+
viewBox={`0 0 ${measuredWidth} ${height}`}
|
|
206
|
+
aria-hidden={loading || isEmpty ? 'true' : undefined}
|
|
207
|
+
aria-labelledby={!loading && !isEmpty ? `${rootId}-svg-title` : undefined}
|
|
208
|
+
>
|
|
209
|
+
{#if !loading && !isEmpty}
|
|
210
|
+
<title id="{rootId}-svg-title">{label}</title>
|
|
211
|
+
{/if}
|
|
212
|
+
<!-- The plot only renders with data and when not loading — otherwise the
|
|
213
|
+
cells/labels would draw under the loading or empty overlay (frames may
|
|
214
|
+
be present while loading, so isEmpty alone is not enough). -->
|
|
215
|
+
{#if !loading && !isEmpty}
|
|
216
|
+
<g transform={`translate(${marginLeft}, ${marginTop})`}>
|
|
217
|
+
<!-- Frequency cells: a full frames × binCount rectangular grid. Ragged or
|
|
218
|
+
non-finite cells render as the "missing" fill. Low frequency (bin 0)
|
|
219
|
+
is at the bottom. -->
|
|
220
|
+
{#each frames as _frame, frameIndex (frameIndex)}
|
|
221
|
+
{#each binIndices as binIndex (binIndex)}
|
|
222
|
+
<rect
|
|
223
|
+
class="cinder-spectrogram__cell"
|
|
224
|
+
x={frameIndex * cellWidth}
|
|
225
|
+
y={binY(binIndex)}
|
|
226
|
+
width={cellWidth}
|
|
227
|
+
height={cellHeight}
|
|
228
|
+
fill={cellFill(binValueAt(frameIndex, binIndex))}
|
|
229
|
+
aria-hidden="true"
|
|
230
|
+
/>
|
|
231
|
+
{/each}
|
|
232
|
+
{/each}
|
|
233
|
+
<!-- Y-axis frequency labels (bin 0 / lowest frequency at the bottom) -->
|
|
234
|
+
{#each yLabels as yLabel, index (index)}
|
|
235
|
+
{#if index % yLabelStep === 0}
|
|
236
|
+
<text
|
|
237
|
+
class="cinder-spectrogram__tick-label"
|
|
238
|
+
x={-6}
|
|
239
|
+
y={binY(index) + cellHeight / 2}
|
|
240
|
+
text-anchor="end"
|
|
241
|
+
dominant-baseline="middle">{yLabel}</text
|
|
242
|
+
>
|
|
243
|
+
{/if}
|
|
244
|
+
{/each}
|
|
245
|
+
<!-- X-axis time labels -->
|
|
246
|
+
{#each frames as frame, index (index)}
|
|
247
|
+
{#if index % xLabelStep === 0}
|
|
248
|
+
<text
|
|
249
|
+
class="cinder-spectrogram__tick-label"
|
|
250
|
+
x={index * cellWidth + cellWidth / 2}
|
|
251
|
+
y={plotHeight + 16}
|
|
252
|
+
text-anchor="middle"
|
|
253
|
+
dominant-baseline="auto">{frame.label}</text
|
|
254
|
+
>
|
|
255
|
+
{/if}
|
|
256
|
+
{/each}
|
|
257
|
+
</g>
|
|
258
|
+
{/if}
|
|
259
|
+
</svg>
|
|
260
|
+
</div>
|
|
261
|
+
{#if hasDataTable}
|
|
262
|
+
<table class={dataTableClass(dataTableVisibility)}>
|
|
263
|
+
<caption>{tableCaption}</caption>
|
|
264
|
+
<thead>
|
|
265
|
+
<tr>
|
|
266
|
+
<th scope="col">Frequency bin</th>
|
|
267
|
+
{#each tableFrames as entry (entry.frameIndex)}
|
|
268
|
+
<th scope="col">{entry.frame.label}</th>
|
|
269
|
+
{/each}
|
|
270
|
+
</tr>
|
|
271
|
+
</thead>
|
|
272
|
+
<tbody>
|
|
273
|
+
{#each tableBinIndices as binIndex (binIndex)}
|
|
274
|
+
<tr>
|
|
275
|
+
<th scope="row">{yLabels[binIndex] ?? binIndex}</th>
|
|
276
|
+
{#each tableFrames as entry (entry.frameIndex)}
|
|
277
|
+
<td>{formatValue(binValueAt(entry.frameIndex, binIndex))}</td>
|
|
278
|
+
{/each}
|
|
279
|
+
</tr>
|
|
280
|
+
{/each}
|
|
281
|
+
</tbody>
|
|
282
|
+
</table>
|
|
283
|
+
{/if}
|
|
284
|
+
</figure>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ChartDataTableVisibility } from '../chart.types.ts';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A single time-frame of frequency-bin magnitudes.
|
|
7
|
+
* `label` identifies the time point (e.g. '0 ms', '10 ms').
|
|
8
|
+
* `bins` is an ordered array of frequency-bin magnitudes, one per column.
|
|
9
|
+
*/
|
|
10
|
+
export type SpectrogramFrame = {
|
|
11
|
+
/** Time-axis label for this frame, e.g. '0 ms' or 't=0'. */
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Magnitude values per frequency bin. A consistent length across frames is
|
|
15
|
+
* preferred, but ragged frames are supported: the grid uses the maximum bin
|
|
16
|
+
* count across all frames and renders any missing bins in shorter frames as
|
|
17
|
+
* "missing" cells. Non-finite values (NaN/Infinity) also render as missing.
|
|
18
|
+
*/
|
|
19
|
+
bins: number[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type SpectrogramProps = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
23
|
+
/** Accessible label for the chart. Required for screen readers. */
|
|
24
|
+
label: string;
|
|
25
|
+
/** Optional description rendered below the label. */
|
|
26
|
+
description?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Ordered sequence of time-domain frames. Each frame contains a label and an
|
|
29
|
+
* array of per-frequency-bin magnitudes.
|
|
30
|
+
*/
|
|
31
|
+
frames: SpectrogramFrame[];
|
|
32
|
+
/**
|
|
33
|
+
* Optional frequency-bin labels for the y-axis (e.g. ['100 Hz', '200 Hz', …]).
|
|
34
|
+
* When omitted, bins are labelled by index.
|
|
35
|
+
*/
|
|
36
|
+
frequencyLabels?: string[];
|
|
37
|
+
/** Pixel height of the chart. Default `200`. */
|
|
38
|
+
height?: number;
|
|
39
|
+
/** Whether the chart is in a loading state. */
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
/** Controls data table visibility. Default `screen-reader-only`. */
|
|
42
|
+
dataTableVisibility?: ChartDataTableVisibility;
|
|
43
|
+
/** Custom data table caption; falls back to `label`. */
|
|
44
|
+
dataTableCaption?: string;
|
|
45
|
+
/** Custom class applied to the root element. */
|
|
46
|
+
class?: string;
|
|
47
|
+
/** Snippet rendered when there are no frames. */
|
|
48
|
+
empty?: Snippet;
|
|
49
|
+
/** Snippet rendered while loading. */
|
|
50
|
+
loadingContent?: Snippet;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type SpectrogramSchemaProps = {
|
|
54
|
+
label: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
frames: SpectrogramFrame[];
|
|
57
|
+
frequencyLabels?: string[];
|
|
58
|
+
height?: number;
|
|
59
|
+
loading?: boolean;
|
|
60
|
+
dataTableVisibility?: ChartDataTableVisibility;
|
|
61
|
+
dataTableCaption?: string;
|
|
62
|
+
class?: string;
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# SpectrumChart
|
|
2
|
+
|
|
3
|
+
Responsive SVG frequency-bin bar chart for visualizing audio spectrum magnitude data.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { SpectrumChart } from '@lostgradient/cinder/spectrum-chart';
|
|
10
|
+
</script>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Guidance
|
|
14
|
+
|
|
15
|
+
### Use When
|
|
16
|
+
|
|
17
|
+
- Displaying pre-computed frequency-domain magnitude data from an FFT or spectrum analyzer.
|
|
18
|
+
- Showing a static frequency response or spectrum snapshot with labelled frequency bins.
|
|
19
|
+
|
|
20
|
+
### Avoid When
|
|
21
|
+
|
|
22
|
+
- Real-time live audio spectrum is needed — feed live AnalyserNode data as props yourself.
|
|
23
|
+
- A full time × frequency heatmap is needed — use spectrogram instead.
|
|
24
|
+
- General categorical bar comparison — use bar-chart instead.
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
<!-- generated:props:start -->
|
|
29
|
+
|
|
30
|
+
| Prop | Type | Required | Default | Description |
|
|
31
|
+
| --------------------- | --------------------------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `class` | `string` | no | — | |
|
|
33
|
+
| `dataTableCaption` | `string` | no | — | |
|
|
34
|
+
| `dataTableVisibility` | `"screen-reader-only"` \| `"visible"` \| `"hidden"` | no | — | |
|
|
35
|
+
| `description` | `string` | no | — | |
|
|
36
|
+
| `height` | `number` | no | — | |
|
|
37
|
+
| `label` | `string` | yes | — | |
|
|
38
|
+
| `loading` | `boolean` | no | — | |
|
|
39
|
+
| `bins` | `(opaque)` | no | — | A prop whose shape is not captured by the JSON schema; see the component types for the exact signature. |
|
|
40
|
+
|
|
41
|
+
<!-- generated:props:end -->
|
|
42
|
+
|
|
43
|
+
## CSS Variables
|
|
44
|
+
|
|
45
|
+
<!-- generated:variables:start -->
|
|
46
|
+
|
|
47
|
+
This component does not declare any local CSS variables.
|
|
48
|
+
|
|
49
|
+
<!-- generated:variables:end -->
|
|
50
|
+
|
|
51
|
+
## Subcomponents
|
|
52
|
+
|
|
53
|
+
<!-- generated:subcomponents:start -->
|
|
54
|
+
|
|
55
|
+
None.
|
|
56
|
+
|
|
57
|
+
<!-- generated:subcomponents:end -->
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './spectrum-chart.css';
|
|
2
|
+
import SpectrumChart from './spectrum-chart.svelte';
|
|
3
|
+
|
|
4
|
+
export default SpectrumChart;
|
|
5
|
+
export type {
|
|
6
|
+
SpectrumBin,
|
|
7
|
+
SpectrumChartProps,
|
|
8
|
+
SpectrumChartSchemaProps,
|
|
9
|
+
} from './spectrum-chart.types.ts';
|
|
10
|
+
export { SpectrumChart };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
|
|
2
|
+
@layer cinder.components {
|
|
3
|
+
.cinder-spectrum-chart {
|
|
4
|
+
display: grid;
|
|
5
|
+
gap: var(--cinder-space-3);
|
|
6
|
+
color: var(--cinder-text);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cinder-spectrum-chart__description {
|
|
10
|
+
margin: 0;
|
|
11
|
+
color: var(--cinder-text-muted);
|
|
12
|
+
font-size: var(--cinder-text-sm);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cinder-spectrum-chart__viewport {
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cinder-spectrum-chart svg {
|
|
20
|
+
display: block;
|
|
21
|
+
inline-size: 100%;
|
|
22
|
+
block-size: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.cinder-spectrum-chart__bar {
|
|
26
|
+
fill: var(--cinder-chart-series-1);
|
|
27
|
+
rx: 2;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.cinder-spectrum-chart__grid-line {
|
|
31
|
+
stroke: var(--cinder-border-muted);
|
|
32
|
+
stroke-dasharray: 3 3;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.cinder-spectrum-chart__tick-label {
|
|
36
|
+
fill: var(--cinder-text-muted);
|
|
37
|
+
font-size: var(--cinder-text-xs);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.cinder-spectrum-chart__state {
|
|
41
|
+
position: absolute;
|
|
42
|
+
inset: 0;
|
|
43
|
+
display: grid;
|
|
44
|
+
place-items: center;
|
|
45
|
+
color: var(--cinder-text-muted);
|
|
46
|
+
background: color-mix(in oklch, var(--cinder-surface) 88%, transparent);
|
|
47
|
+
z-index: 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../schemas/examples.schema.json",
|
|
3
|
+
"component": "spectrum-chart",
|
|
4
|
+
"import": "@lostgradient/cinder/spectrum-chart",
|
|
5
|
+
"examples": [
|
|
6
|
+
{
|
|
7
|
+
"id": "frequency-spectrum",
|
|
8
|
+
"title": "Frequency spectrum",
|
|
9
|
+
"description": "Pre-computed FFT magnitude spectrum showing frequency content of a signal.",
|
|
10
|
+
"code": "<script lang=\"ts\">\n import { SpectrumChart } from '@lostgradient/cinder/spectrum-chart';\n\n // Simulate a spectrum with a peak around 440 Hz (A4 note)\n const bins = [\n { label: '55 Hz', value: 0.02 },\n { label: '110 Hz', value: 0.05 },\n { label: '220 Hz', value: 0.12 },\n { label: '330 Hz', value: 0.18 },\n { label: '440 Hz', value: 0.95 },\n { label: '550 Hz', value: 0.15 },\n { label: '660 Hz', value: 0.08 },\n { label: '880 Hz', value: 0.04 },\n { label: '1.1 kHz', value: 0.03 },\n { label: '1.3 kHz', value: 0.02 },\n { label: '1.76 kHz', value: 0.01 },\n { label: '2.2 kHz', value: 0.005 },\n ];\n</script>\n\n<SpectrumChart\n label=\"Frequency spectrum — A4 note (440 Hz)\"\n description=\"Magnitude spectrum of a 440 Hz sine wave showing the fundamental and harmonics.\"\n {bins}\n height={180}\n dataTableVisibility=\"visible\"\n/>\n"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
"height": {
|
|
12
|
+
"type": "number"
|
|
13
|
+
},
|
|
14
|
+
"loading": {
|
|
15
|
+
"type": "boolean"
|
|
16
|
+
},
|
|
17
|
+
"dataTableVisibility": {
|
|
18
|
+
"enum": ["screen-reader-only", "visible", "hidden"]
|
|
19
|
+
},
|
|
20
|
+
"dataTableCaption": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"class": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["label"],
|
|
29
|
+
"metadata": {
|
|
30
|
+
"unsupportedProps": [
|
|
31
|
+
{
|
|
32
|
+
"name": "bins",
|
|
33
|
+
"reason": "unknown-shape"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
height: {
|
|
14
|
+
type: 'number',
|
|
15
|
+
},
|
|
16
|
+
loading: {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
},
|
|
19
|
+
dataTableVisibility: {
|
|
20
|
+
enum: ['screen-reader-only', 'visible', 'hidden'],
|
|
21
|
+
},
|
|
22
|
+
dataTableCaption: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
},
|
|
25
|
+
class: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
required: ['label'],
|
|
31
|
+
metadata: {
|
|
32
|
+
unsupportedProps: [
|
|
33
|
+
{
|
|
34
|
+
name: 'bins',
|
|
35
|
+
reason: 'unknown-shape',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
} satisfies ComponentSchema;
|
|
40
|
+
|
|
41
|
+
export default schema as ComponentSchema;
|