@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,152 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Feedback state for a choice grid item. Neutral means no feedback applied.
|
|
6
|
+
* Correct / incorrect / pending communicate quiz or assessment results.
|
|
7
|
+
*/
|
|
8
|
+
export type ChoiceGridItemState = 'neutral' | 'correct' | 'incorrect' | 'pending';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Column layout for the grid. 'responsive' uses auto-fill with a minimum cell
|
|
12
|
+
* width. A number sets a fixed column count.
|
|
13
|
+
*/
|
|
14
|
+
export type ChoiceGridColumns = 'responsive' | 1 | 2 | 3 | 4;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Shape of the context object provided to ChoiceGridItem children.
|
|
18
|
+
*
|
|
19
|
+
* All members are getter properties on the context object so reads remain
|
|
20
|
+
* reactive inside `$derived` expressions in the children. Destructuring the
|
|
21
|
+
* context breaks reactivity; always access via `context.field`.
|
|
22
|
+
*/
|
|
23
|
+
export type ChoiceGridContext = {
|
|
24
|
+
/**
|
|
25
|
+
* The currently selected value (single-select mode) or null when nothing
|
|
26
|
+
* is selected. In multi-select mode this field is unused — children check
|
|
27
|
+
* `isSelected` instead.
|
|
28
|
+
*/
|
|
29
|
+
readonly value: string | null;
|
|
30
|
+
|
|
31
|
+
/** True when the grid allows multiple simultaneous selections. */
|
|
32
|
+
readonly multiple: boolean;
|
|
33
|
+
|
|
34
|
+
/** True when ALL items are disabled (the grid-level disabled prop). */
|
|
35
|
+
readonly disabled: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* True when `candidate` is currently selected (works for both single- and
|
|
39
|
+
* multi-select modes).
|
|
40
|
+
*/
|
|
41
|
+
isSelected: (candidate: string) => boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Select or toggle `candidate`. In single-select mode this sets the value;
|
|
45
|
+
* in multi-select mode this toggles the candidate in the values set.
|
|
46
|
+
*/
|
|
47
|
+
select: (candidate: string) => void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Register an item element with the parent so the parent can drive roving
|
|
51
|
+
* tabindex focus. `disabled` is tracked so disabled items are skipped by both
|
|
52
|
+
* the roving-tabindex computation and arrow-key navigation.
|
|
53
|
+
*/
|
|
54
|
+
register: (value: string, element: HTMLElement, disabled: boolean) => void;
|
|
55
|
+
|
|
56
|
+
/** Update the tracked disabled state for an already-registered item. */
|
|
57
|
+
setItemDisabled: (value: string, disabled: boolean) => void;
|
|
58
|
+
|
|
59
|
+
/** Remove an item from the registry on unmount. */
|
|
60
|
+
unregister: (value: string) => void;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Whether `candidate` should hold `tabindex="0"`. Must be called inside
|
|
64
|
+
* a `$derived` to remain reactive.
|
|
65
|
+
*/
|
|
66
|
+
isFocusable: (candidate: string) => boolean;
|
|
67
|
+
|
|
68
|
+
/** Items forward `keydown` here for shared arrow-key navigation. */
|
|
69
|
+
handleKeydown: (event: KeyboardEvent) => void;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Props for the `<ChoiceGrid>` parent component.
|
|
74
|
+
*/
|
|
75
|
+
export type ChoiceGridProps = Omit<
|
|
76
|
+
HTMLAttributes<HTMLDivElement>,
|
|
77
|
+
'role' | 'aria-label' | 'aria-labelledby'
|
|
78
|
+
> & {
|
|
79
|
+
/**
|
|
80
|
+
* The currently selected value (single-select mode). Bindable.
|
|
81
|
+
* Pass `null` or omit to start with no selection.
|
|
82
|
+
*/
|
|
83
|
+
value?: string | null;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Currently selected values (multi-select mode). Bindable. Only used when
|
|
87
|
+
* `multiple` is `true` — set `multiple` explicitly to switch modes; binding
|
|
88
|
+
* `values` alone does NOT enable multi-select.
|
|
89
|
+
*/
|
|
90
|
+
values?: string[];
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* When true the grid allows multiple simultaneous selections and reads/writes
|
|
94
|
+
* `values` instead of `value`. The ARIA role switches to `group` (items become
|
|
95
|
+
* `checkbox`); single-select uses `radiogroup` (items become `radio`).
|
|
96
|
+
*/
|
|
97
|
+
multiple?: boolean;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Column layout.
|
|
101
|
+
* - `'responsive'` — `auto-fill` at a minimum cell width (default).
|
|
102
|
+
* - `1 | 2 | 3 | 4` — fixed number of columns.
|
|
103
|
+
*/
|
|
104
|
+
columns?: ChoiceGridColumns;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Minimum cell width for `columns="responsive"`. Accepts any CSS
|
|
108
|
+
* `<length>` (e.g. `"12rem"`, `"200px"`). Default: `"10rem"`.
|
|
109
|
+
*/
|
|
110
|
+
minColumnWidth?: string;
|
|
111
|
+
|
|
112
|
+
/** Accessible label for the grid (required unless `ariaLabelledby` is set). */
|
|
113
|
+
ariaLabel?: string;
|
|
114
|
+
|
|
115
|
+
/** Id of an external element that labels this grid. */
|
|
116
|
+
ariaLabelledby?: string;
|
|
117
|
+
|
|
118
|
+
/** Disables all items in the grid. */
|
|
119
|
+
disabled?: boolean;
|
|
120
|
+
|
|
121
|
+
/** Additional class names merged with `.cinder-choice-grid`. */
|
|
122
|
+
class?: string;
|
|
123
|
+
|
|
124
|
+
/** `ChoiceGridItem` children. */
|
|
125
|
+
children: Snippet;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Props for the `<ChoiceGridItem>` leaf component.
|
|
130
|
+
*/
|
|
131
|
+
export type ChoiceGridItemProps = {
|
|
132
|
+
/**
|
|
133
|
+
* The value this item represents. Used as the key for selection state,
|
|
134
|
+
* roving tabindex registration, and ARIA attributes.
|
|
135
|
+
*/
|
|
136
|
+
value: string;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Feedback state for assessment / quiz usage. Defaults to `'neutral'`.
|
|
140
|
+
* Layout dimensions do NOT change across states (stable cell sizing guarantee).
|
|
141
|
+
*/
|
|
142
|
+
state?: ChoiceGridItemState;
|
|
143
|
+
|
|
144
|
+
/** When true this item cannot be selected or focused. */
|
|
145
|
+
disabled?: boolean;
|
|
146
|
+
|
|
147
|
+
/** Additional class names merged with `.cinder-choice-grid-item`. */
|
|
148
|
+
class?: string;
|
|
149
|
+
|
|
150
|
+
/** Item content — label text, an icon, or richer markup. */
|
|
151
|
+
children: Snippet;
|
|
152
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import ChoiceGridItem from '../choice-grid-item/choice-grid-item.svelte';
|
|
2
|
+
import './choice-grid.css';
|
|
3
|
+
import ChoiceGridRoot from './choice-grid.svelte';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `ChoiceGrid` is the parent compound component. It is also a namespace whose
|
|
7
|
+
* `Item` property exposes the compose-only leaf under its idiomatic name:
|
|
8
|
+
* `ChoiceGrid.Item`. The leaf remains importable individually from
|
|
9
|
+
* `@lostgradient/cinder/choice-grid-item`.
|
|
10
|
+
*/
|
|
11
|
+
const ChoiceGrid = Object.assign(ChoiceGridRoot, {
|
|
12
|
+
Item: ChoiceGridItem,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default ChoiceGrid;
|
|
16
|
+
export type {
|
|
17
|
+
ChoiceGridColumns,
|
|
18
|
+
ChoiceGridContext,
|
|
19
|
+
ChoiceGridItemState,
|
|
20
|
+
ChoiceGridProps,
|
|
21
|
+
} from './choice-grid.types.ts';
|
|
22
|
+
export { ChoiceGrid };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# ChoiceGridItem
|
|
2
|
+
|
|
3
|
+
Selectable answer tile used inside a ChoiceGrid; carries selected, disabled, correct, incorrect, and pending states without shifting cell dimensions.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
`ChoiceGridItem` is a compose-only leaf of [`ChoiceGrid`](../choice-grid/README.md).
|
|
8
|
+
The idiomatic API is `ChoiceGrid.Item`, reached through the parent
|
|
9
|
+
namespace — see the [ChoiceGrid README](../choice-grid/README.md#usage) for the
|
|
10
|
+
composed snippet. The flat `@lostgradient/cinder/choice-grid-item` subpath remains exported for
|
|
11
|
+
à-la-carte builds that import the leaf directly.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
<!-- generated:props:start -->
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Required | Default | Description |
|
|
18
|
+
| ---------- | ---------------------------------------------------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| `class` | `string` | no | — | Additional class names merged with `.cinder-choice-grid-item`. |
|
|
20
|
+
| `disabled` | `boolean` | no | — | When true this item cannot be selected or focused. |
|
|
21
|
+
| `state` | `"neutral"` \| `"correct"` \| `"incorrect"` \| `"pending"` | no | — | Feedback state for assessment / quiz usage. Defaults to `'neutral'`. Layout dimensions do NOT change across states (stable cell sizing guarantee). |
|
|
22
|
+
| `value` | `string` | yes | — | The value this item represents. Used as the key for selection state, roving tabindex registration, and ARIA attributes. |
|
|
23
|
+
| `children` | `(opaque)` | no | — | A function or snippet prop. Its shape is not captured by the JSON schema; see the component types for the exact signature. |
|
|
24
|
+
|
|
25
|
+
<!-- generated:props:end -->
|
|
26
|
+
|
|
27
|
+
## CSS Variables
|
|
28
|
+
|
|
29
|
+
<!-- generated:variables:start -->
|
|
30
|
+
|
|
31
|
+
This component does not declare any local CSS variables.
|
|
32
|
+
|
|
33
|
+
<!-- generated:variables:end -->
|
|
34
|
+
|
|
35
|
+
## Subcomponents
|
|
36
|
+
|
|
37
|
+
<!-- generated:subcomponents:start -->
|
|
38
|
+
|
|
39
|
+
None.
|
|
40
|
+
|
|
41
|
+
<!-- generated:subcomponents:end -->
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
|
|
2
|
+
|
|
3
|
+
@layer cinder.components {
|
|
4
|
+
/* ========================================
|
|
5
|
+
* CHOICE GRID ITEM — selectable answer tile
|
|
6
|
+
* ======================================== */
|
|
7
|
+
|
|
8
|
+
.cinder-choice-grid-item {
|
|
9
|
+
/* Stable sizing: min-height ensures cells never shrink when feedback state
|
|
10
|
+
* text/icons appear. Width is determined by the parent grid track. */
|
|
11
|
+
min-block-size: 4rem;
|
|
12
|
+
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
text-align: center;
|
|
17
|
+
padding: var(--cinder-space-4) var(--cinder-space-3);
|
|
18
|
+
border-radius: var(--cinder-radius-lg);
|
|
19
|
+
border: 2px solid var(--cinder-border-muted);
|
|
20
|
+
background: var(--cinder-surface);
|
|
21
|
+
color: var(--cinder-text);
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
user-select: none;
|
|
24
|
+
transition:
|
|
25
|
+
background 120ms ease,
|
|
26
|
+
border-color 120ms ease,
|
|
27
|
+
box-shadow 120ms ease;
|
|
28
|
+
outline: none; /* Focus ring provided via box-shadow below. */
|
|
29
|
+
|
|
30
|
+
/* Touch target: ensure at least 44px for mobile accessibility. */
|
|
31
|
+
touch-action: manipulation;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Item content wrapper — prevents the flex alignment from collapsing the
|
|
35
|
+
* children when they are shorter than the min-height baseline. */
|
|
36
|
+
.cinder-choice-grid-item__content {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: var(--cinder-space-1);
|
|
41
|
+
font-size: var(--cinder-text-base);
|
|
42
|
+
font-weight: var(--cinder-font-medium);
|
|
43
|
+
line-height: var(--cinder-leading-snug);
|
|
44
|
+
pointer-events: none; /* Clicks bubble to the item div. */
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ----------------------------------------
|
|
48
|
+
* Hover (non-touch devices only)
|
|
49
|
+
* ---------------------------------------- */
|
|
50
|
+
|
|
51
|
+
@media (hover: hover) {
|
|
52
|
+
/* Neutral hover only. Excludes selected and graded (correct/incorrect/
|
|
53
|
+
* pending) tiles so their accent/feedback colors aren't clobbered to a
|
|
54
|
+
* neutral raised fill on hover — those states own their own hover rules
|
|
55
|
+
* (or intentionally stay flat). */
|
|
56
|
+
.cinder-choice-grid-item:not([data-cinder-disabled]):not([data-cinder-selected]):not(
|
|
57
|
+
[data-cinder-state]
|
|
58
|
+
):hover {
|
|
59
|
+
border-color: var(--cinder-border);
|
|
60
|
+
background: var(--cinder-surface-raised);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* ----------------------------------------
|
|
65
|
+
* Focus ring
|
|
66
|
+
* ---------------------------------------- */
|
|
67
|
+
|
|
68
|
+
.cinder-choice-grid-item:focus-visible {
|
|
69
|
+
border-color: var(--cinder-accent);
|
|
70
|
+
box-shadow: var(--_cinder-focus-ring-shadow);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Forced Colors Mode — box-shadow rings are invisible; use a real outline. */
|
|
74
|
+
@media (forced-colors: active) {
|
|
75
|
+
.cinder-choice-grid-item:focus-visible {
|
|
76
|
+
outline: var(--cinder-ring-width) solid ButtonText;
|
|
77
|
+
outline-offset: 2px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* ----------------------------------------
|
|
82
|
+
* Selected state
|
|
83
|
+
* ---------------------------------------- */
|
|
84
|
+
|
|
85
|
+
/* Selected uses accent border + accent text with no filled background,
|
|
86
|
+
* matching the segmented-control convention. */
|
|
87
|
+
.cinder-choice-grid-item[data-cinder-selected] {
|
|
88
|
+
border-color: var(--cinder-accent);
|
|
89
|
+
color: var(--cinder-accent-text);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@media (hover: hover) {
|
|
93
|
+
/* Excludes graded tiles (a wrong pick can be both selected AND
|
|
94
|
+
* data-cinder-state) so hover doesn't flip their feedback border to accent
|
|
95
|
+
* — the feedback border must keep dominating on hover as it does at rest.
|
|
96
|
+
* Mirrors the neutral-hover guard above. */
|
|
97
|
+
.cinder-choice-grid-item[data-cinder-selected]:not([data-cinder-disabled]):not(
|
|
98
|
+
[data-cinder-state]
|
|
99
|
+
):hover {
|
|
100
|
+
border-color: var(--cinder-accent-hover);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* ----------------------------------------
|
|
105
|
+
* Disabled state
|
|
106
|
+
* ---------------------------------------- */
|
|
107
|
+
|
|
108
|
+
.cinder-choice-grid-item[data-cinder-disabled] {
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
opacity: 0.45;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* ----------------------------------------
|
|
114
|
+
* Feedback states — correct / incorrect / pending
|
|
115
|
+
* Dimensions are IDENTICAL to the neutral state (stable cell sizing guarantee).
|
|
116
|
+
* Only color / border / text change.
|
|
117
|
+
* ---------------------------------------- */
|
|
118
|
+
|
|
119
|
+
/* Correct */
|
|
120
|
+
.cinder-choice-grid-item[data-cinder-state='correct'] {
|
|
121
|
+
border-color: var(--cinder-color-success-border);
|
|
122
|
+
background: var(--cinder-color-success-bg);
|
|
123
|
+
color: var(--cinder-color-success-fg);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Incorrect */
|
|
127
|
+
.cinder-choice-grid-item[data-cinder-state='incorrect'] {
|
|
128
|
+
border-color: var(--cinder-color-danger-border);
|
|
129
|
+
background: var(--cinder-color-danger-bg);
|
|
130
|
+
color: var(--cinder-color-danger-fg);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Pending */
|
|
134
|
+
.cinder-choice-grid-item[data-cinder-state='pending'] {
|
|
135
|
+
border-color: var(--cinder-color-warning-border);
|
|
136
|
+
background: var(--cinder-color-warning-bg);
|
|
137
|
+
color: var(--cinder-color-warning-fg);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"value": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"description": "The value this item represents. Used as the key for selection state,\nroving tabindex registration, and ARIA attributes."
|
|
8
|
+
},
|
|
9
|
+
"state": {
|
|
10
|
+
"enum": ["neutral", "correct", "incorrect", "pending"],
|
|
11
|
+
"description": "Feedback state for assessment / quiz usage. Defaults to `'neutral'`.\nLayout dimensions do NOT change across states (stable cell sizing guarantee)."
|
|
12
|
+
},
|
|
13
|
+
"disabled": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"description": "When true this item cannot be selected or focused."
|
|
16
|
+
},
|
|
17
|
+
"class": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Additional class names merged with `.cinder-choice-grid-item`."
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"required": ["value"],
|
|
24
|
+
"metadata": {
|
|
25
|
+
"unsupportedProps": [
|
|
26
|
+
{
|
|
27
|
+
"name": "children",
|
|
28
|
+
"reason": "function-or-snippet"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
value: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
description:
|
|
10
|
+
'The value this item represents. Used as the key for selection state,\nroving tabindex registration, and ARIA attributes.',
|
|
11
|
+
},
|
|
12
|
+
state: {
|
|
13
|
+
enum: ['neutral', 'correct', 'incorrect', 'pending'],
|
|
14
|
+
description:
|
|
15
|
+
"Feedback state for assessment / quiz usage. Defaults to `'neutral'`.\nLayout dimensions do NOT change across states (stable cell sizing guarantee).",
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
description: 'When true this item cannot be selected or focused.',
|
|
20
|
+
},
|
|
21
|
+
class: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'Additional class names merged with `.cinder-choice-grid-item`.',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
required: ['value'],
|
|
28
|
+
metadata: {
|
|
29
|
+
unsupportedProps: [
|
|
30
|
+
{
|
|
31
|
+
name: 'children',
|
|
32
|
+
reason: 'function-or-snippet',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
} satisfies ComponentSchema;
|
|
37
|
+
|
|
38
|
+
export default schema as ComponentSchema;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* @cinder
|
|
4
|
+
* @category form
|
|
5
|
+
* @status alpha
|
|
6
|
+
* @purpose Selectable answer tile used inside a ChoiceGrid; carries selected, disabled, correct, incorrect, and pending states without shifting cell dimensions.
|
|
7
|
+
* @tag form
|
|
8
|
+
* @tag selection
|
|
9
|
+
* @tag quiz
|
|
10
|
+
* @useWhen Composing individual answer choices inside a ChoiceGrid parent.
|
|
11
|
+
* @avoidWhen Used outside a ChoiceGrid — this leaf requires the parent context.
|
|
12
|
+
* @related choice-grid
|
|
13
|
+
*/
|
|
14
|
+
export type {
|
|
15
|
+
ChoiceGridItemProps,
|
|
16
|
+
ChoiceGridItemState,
|
|
17
|
+
} from '../choice-grid/choice-grid.types.ts';
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import type { ChoiceGridItemProps } from './choice-grid-item.types.ts';
|
|
22
|
+
import { untrack } from 'svelte';
|
|
23
|
+
import { getChoiceGridContext } from '../choice-grid/choice-grid-context.ts';
|
|
24
|
+
import { classNames } from '../../utilities/class-names.ts';
|
|
25
|
+
import { rovingTabIndex } from '../../_internal/collection.ts';
|
|
26
|
+
import { devWarn } from '../../utilities/dev-warn.ts';
|
|
27
|
+
|
|
28
|
+
const ITEM_STATES = ['neutral', 'correct', 'incorrect', 'pending'] as const;
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
value,
|
|
32
|
+
// Renamed off `state` to avoid svelte-check treating the bare identifier as
|
|
33
|
+
// the `$state` rune; the public prop name is still `state`.
|
|
34
|
+
state: stateProp = 'neutral',
|
|
35
|
+
disabled = false,
|
|
36
|
+
class: className,
|
|
37
|
+
children,
|
|
38
|
+
}: ChoiceGridItemProps = $props();
|
|
39
|
+
|
|
40
|
+
// Validate the public `state` against the allowed union so a plain-JS or
|
|
41
|
+
// dynamic value can't emit an unsupported `data-cinder-state`. Invalid values
|
|
42
|
+
// fall back to neutral (no data attribute) with a dev warning.
|
|
43
|
+
const feedbackState = $derived(
|
|
44
|
+
(ITEM_STATES as readonly string[]).includes(stateProp) ? stateProp : 'neutral',
|
|
45
|
+
);
|
|
46
|
+
$effect(() => {
|
|
47
|
+
if (!(ITEM_STATES as readonly string[]).includes(stateProp)) {
|
|
48
|
+
devWarn(
|
|
49
|
+
`ChoiceGridItem: invalid state "${String(stateProp)}". Expected one of ${ITEM_STATES.join(', ')}. Falling back to "neutral".`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const context = getChoiceGridContext();
|
|
55
|
+
|
|
56
|
+
// `value` is the registry key and is fixed for the item's lifetime. Captured
|
|
57
|
+
// via untrack so a runtime mutation does not silently re-key the parent
|
|
58
|
+
// registry. EVERY ChoiceGrid interaction (selection, focusability, click)
|
|
59
|
+
// routes through `registeredValue`, never the live `value` prop, so a changing
|
|
60
|
+
// `value` can't desync the registry key from the selection/focus key. A
|
|
61
|
+
// changing `value` is unsupported and warned in development.
|
|
62
|
+
const registeredValue = untrack(() => value);
|
|
63
|
+
$effect(() => {
|
|
64
|
+
if (value !== registeredValue) {
|
|
65
|
+
devWarn(
|
|
66
|
+
`ChoiceGridItem: \`value\` changed from "${registeredValue}" to "${value}" after mount. ChoiceGridItem.value must be stable — give the item a fixed value (use {#key} to remount if the value must change). The grid keeps using the original value.`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const isSelected = $derived(context.isSelected(registeredValue));
|
|
72
|
+
const isDisabled = $derived(disabled || context.disabled);
|
|
73
|
+
const isFocusable = $derived(context.isFocusable(registeredValue));
|
|
74
|
+
const tabIndex = $derived(rovingTabIndex(isFocusable));
|
|
75
|
+
|
|
76
|
+
// In single-select mode, the item acts as a radio button (role="radio").
|
|
77
|
+
// In multi-select mode, the item acts as a checkbox (role="checkbox").
|
|
78
|
+
const role = $derived(context.multiple ? 'checkbox' : 'radio');
|
|
79
|
+
|
|
80
|
+
let elementRef: HTMLElement | null = $state(null);
|
|
81
|
+
|
|
82
|
+
// Effect A — mount/unmount registration. Uses untrack to avoid creating a
|
|
83
|
+
// reactive cycle: register/unregister write to a reactive version counter,
|
|
84
|
+
// reading that inside an effect would self-trigger an infinite loop.
|
|
85
|
+
$effect(() => {
|
|
86
|
+
const el = elementRef;
|
|
87
|
+
if (!el) return;
|
|
88
|
+
untrack(() => {
|
|
89
|
+
context.register(registeredValue, el, isDisabled);
|
|
90
|
+
});
|
|
91
|
+
return () => {
|
|
92
|
+
untrack(() => {
|
|
93
|
+
context.unregister(registeredValue);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Effect B — keep the parent's tracked disabled state in sync when this item's
|
|
99
|
+
// effective disabled state changes, so roving navigation and the focusable
|
|
100
|
+
// computation skip it. Reading isDisabled subscribes us; the write is untracked
|
|
101
|
+
// to stay out of the version-counter cycle.
|
|
102
|
+
$effect(() => {
|
|
103
|
+
const nextDisabled = isDisabled;
|
|
104
|
+
untrack(() => {
|
|
105
|
+
context.setItemDisabled(registeredValue, nextDisabled);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
function handleClick(): void {
|
|
110
|
+
if (isDisabled) return;
|
|
111
|
+
context.select(registeredValue);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function handleKeydown(event: KeyboardEvent): void {
|
|
115
|
+
// Always forward to the parent so arrow/Home/End navigation works even when
|
|
116
|
+
// this tile is disabled (a disabled tile that holds focus must not trap the
|
|
117
|
+
// keyboard). The parent's `select()` already refuses to activate a disabled
|
|
118
|
+
// item, so Space/Enter on a disabled tile is a safe no-op.
|
|
119
|
+
context.handleKeydown(event);
|
|
120
|
+
}
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<div
|
|
124
|
+
bind:this={elementRef}
|
|
125
|
+
{role}
|
|
126
|
+
aria-checked={isSelected}
|
|
127
|
+
aria-disabled={isDisabled || undefined}
|
|
128
|
+
tabindex={tabIndex}
|
|
129
|
+
class={classNames('cinder-choice-grid-item', className)}
|
|
130
|
+
data-cinder-selected={isSelected || undefined}
|
|
131
|
+
data-cinder-disabled={isDisabled || undefined}
|
|
132
|
+
data-cinder-state={feedbackState !== 'neutral' ? feedbackState : undefined}
|
|
133
|
+
onclick={handleClick}
|
|
134
|
+
onkeydown={handleKeydown}
|
|
135
|
+
>
|
|
136
|
+
<span class="cinder-choice-grid-item__content">
|
|
137
|
+
{@render children()}
|
|
138
|
+
</span>
|
|
139
|
+
</div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ChoiceGridItemState } from '../choice-grid/choice-grid.types.ts';
|
|
3
|
+
|
|
4
|
+
export type { ChoiceGridItemState };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Props for the `<ChoiceGridItem>` leaf component.
|
|
8
|
+
*/
|
|
9
|
+
export type ChoiceGridItemProps = {
|
|
10
|
+
/**
|
|
11
|
+
* The value this item represents. Used as the key for selection state,
|
|
12
|
+
* roving tabindex registration, and ARIA attributes.
|
|
13
|
+
*/
|
|
14
|
+
value: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Feedback state for assessment / quiz usage. Defaults to `'neutral'`.
|
|
18
|
+
* Layout dimensions do NOT change across states (stable cell sizing guarantee).
|
|
19
|
+
*/
|
|
20
|
+
state?: ChoiceGridItemState;
|
|
21
|
+
|
|
22
|
+
/** When true this item cannot be selected or focused. */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
|
|
25
|
+
/** Additional class names merged with `.cinder-choice-grid-item`. */
|
|
26
|
+
class?: string;
|
|
27
|
+
|
|
28
|
+
/** Item content — label text, an icon, or richer markup. */
|
|
29
|
+
children: Snippet;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# ClickAwayListener
|
|
2
|
+
|
|
3
|
+
Headless utility that calls a function when the user clicks or taps outside a subtree.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { ClickAwayListener } from '@lostgradient/cinder/click-away-listener';
|
|
10
|
+
</script>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Guidance
|
|
14
|
+
|
|
15
|
+
### Use When
|
|
16
|
+
|
|
17
|
+
- Building a custom inline-edit field, custom dropdown, or any overlay that should close on outside interaction.
|
|
18
|
+
|
|
19
|
+
### Avoid When
|
|
20
|
+
|
|
21
|
+
- Using Popover, Dropdown, or Modal — those handle click-away internally.
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
<!-- generated:props:start -->
|
|
26
|
+
|
|
27
|
+
| Prop | Type | Required | Default | Description |
|
|
28
|
+
| ------------- | ---------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `class` | `string` | no | — | Additional class names merged with the root element. |
|
|
30
|
+
| `enabled` | `boolean` | no | — | When false the document listener is detached and `onClickAway` is never called. Defaults to `true`. |
|
|
31
|
+
| `children` | `(opaque)` | no | — | A function or snippet prop. Its shape is not captured by the JSON schema; see the component types for the exact signature. |
|
|
32
|
+
| `onClickAway` | `(opaque)` | no | — | A function or snippet prop. Its shape is not captured by the JSON schema; see the component types for the exact signature. |
|
|
33
|
+
|
|
34
|
+
<!-- generated:props:end -->
|
|
35
|
+
|
|
36
|
+
## CSS Variables
|
|
37
|
+
|
|
38
|
+
<!-- generated:variables:start -->
|
|
39
|
+
|
|
40
|
+
This component does not declare any local CSS variables.
|
|
41
|
+
|
|
42
|
+
<!-- generated:variables:end -->
|
|
43
|
+
|
|
44
|
+
## Subcomponents
|
|
45
|
+
|
|
46
|
+
<!-- generated:subcomponents:start -->
|
|
47
|
+
|
|
48
|
+
None.
|
|
49
|
+
|
|
50
|
+
<!-- generated:subcomponents:end -->
|