@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,330 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* @cinder
|
|
4
|
+
* @category action
|
|
5
|
+
* @status alpha
|
|
6
|
+
* @purpose Compact share card with copy-link, copy-text, and native navigator.share actions, with accessible success announcements and graceful fallback when navigator.share is unavailable.
|
|
7
|
+
* @tag action
|
|
8
|
+
* @tag clipboard
|
|
9
|
+
* @useWhen Offering a quick way to share a link or text with copy and native share options.
|
|
10
|
+
* @useWhen Presenting a result, invite link, or exported report link with sharing affordances.
|
|
11
|
+
* @avoidWhen Generating the share text or images — compose ShareCard with your own copy generation logic.
|
|
12
|
+
* @avoidWhen Posting directly to social media or analytics — wire those externally.
|
|
13
|
+
* @related copy-button, card, button
|
|
14
|
+
*/
|
|
15
|
+
export type { ShareCardAction, ShareCardProps } from './share-card.types.ts';
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { onDestroy } from 'svelte';
|
|
20
|
+
import { BROWSER } from 'esm-env';
|
|
21
|
+
|
|
22
|
+
import { classNames } from '../../utilities/class-names.ts';
|
|
23
|
+
import { copyToClipboard } from '../../utilities/clipboard.ts';
|
|
24
|
+
import VisuallyHiddenLiveRegion from '../_visually-hidden-live-region.svelte';
|
|
25
|
+
import type { ShareCardAction, ShareCardProps } from './share-card.types.ts';
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
value,
|
|
29
|
+
title,
|
|
30
|
+
description,
|
|
31
|
+
actions,
|
|
32
|
+
copyLinkLabel = 'Copy link',
|
|
33
|
+
copiedLabel = 'Copied!',
|
|
34
|
+
shareLabel = 'Share',
|
|
35
|
+
confirmDuration = 2000,
|
|
36
|
+
preview,
|
|
37
|
+
class: customClassName,
|
|
38
|
+
...rest
|
|
39
|
+
}: ShareCardProps = $props();
|
|
40
|
+
|
|
41
|
+
// Track which action is in the "copied" state by its key.
|
|
42
|
+
let copiedKey = $state<string | null>(null);
|
|
43
|
+
let resetTimer: ReturnType<typeof setTimeout> | undefined;
|
|
44
|
+
let announcement = $state('');
|
|
45
|
+
|
|
46
|
+
// Detect native share support. Only available in a browser with a secure origin.
|
|
47
|
+
const canNativeShare = $derived(
|
|
48
|
+
BROWSER && typeof navigator !== 'undefined' && typeof navigator.share === 'function',
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
let announceTimer: ReturnType<typeof setTimeout> | undefined;
|
|
52
|
+
|
|
53
|
+
// Clear BOTH transient timers — the copied-state reset AND any pending
|
|
54
|
+
// announcement auto-clear — so a new copy/share cycle never has a stale timer
|
|
55
|
+
// from a previous cycle mutating the current state out from under it.
|
|
56
|
+
function clearTimer() {
|
|
57
|
+
if (resetTimer !== undefined) {
|
|
58
|
+
clearTimeout(resetTimer);
|
|
59
|
+
resetTimer = undefined;
|
|
60
|
+
}
|
|
61
|
+
if (announceTimer !== undefined) {
|
|
62
|
+
clearTimeout(announceTimer);
|
|
63
|
+
announceTimer = undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Set a transient announcement that auto-clears to '' after the confirmation
|
|
68
|
+
// window, so a stale message isn't left in the live region and the NEXT
|
|
69
|
+
// announcement (even an identical one) re-fires because the prop transitions
|
|
70
|
+
// through ''. A single write — the live region (VisuallyHiddenLiveRegion) owns
|
|
71
|
+
// the blank-then-set re-announce timing, matching copy-button / media-controls.
|
|
72
|
+
function announce(message: string) {
|
|
73
|
+
if (announceTimer !== undefined) clearTimeout(announceTimer);
|
|
74
|
+
announcement = message;
|
|
75
|
+
announceTimer = setTimeout(() => {
|
|
76
|
+
announcement = '';
|
|
77
|
+
}, confirmDuration);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function handleCopy(key: string, text: string, successMessage = copiedLabel) {
|
|
81
|
+
let succeeded = false;
|
|
82
|
+
try {
|
|
83
|
+
succeeded = await copyToClipboard(text);
|
|
84
|
+
} catch {
|
|
85
|
+
succeeded = false;
|
|
86
|
+
}
|
|
87
|
+
if (!succeeded) {
|
|
88
|
+
// Clear any lingering "copied" state from a previous success so a failed
|
|
89
|
+
// attempt doesn't leave a button stuck showing the copied label. Route the
|
|
90
|
+
// failure through announce() so it auto-clears and a second identical
|
|
91
|
+
// failure re-announces (the live region only fires on a change).
|
|
92
|
+
clearTimer();
|
|
93
|
+
copiedKey = null;
|
|
94
|
+
announce('Copy failed');
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
clearTimer();
|
|
98
|
+
copiedKey = key;
|
|
99
|
+
// The success message is overridable so a fallback copy (after a failed
|
|
100
|
+
// native share) announces the full story rather than overwriting the
|
|
101
|
+
// "Share failed" notice with a bare "Copied!". announce() owns the message
|
|
102
|
+
// lifecycle; resetTimer owns only the copied visual state.
|
|
103
|
+
announce(successMessage);
|
|
104
|
+
resetTimer = setTimeout(() => {
|
|
105
|
+
copiedKey = null;
|
|
106
|
+
}, confirmDuration);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Heuristic: an absolute http(s) URL shares as `url`, anything else as `text`.
|
|
110
|
+
function looksLikeUrl(candidate: string): boolean {
|
|
111
|
+
return /^https?:\/\//i.test(candidate.trim());
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function buildShareData(): ShareData {
|
|
115
|
+
const shareData: ShareData = looksLikeUrl(value) ? { url: value } : { text: value };
|
|
116
|
+
if (title) shareData.title = title;
|
|
117
|
+
return shareData;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function handleNativeShare() {
|
|
121
|
+
if (!canNativeShare) {
|
|
122
|
+
// Native share unavailable — fall back to copying the value.
|
|
123
|
+
await handleCopy('share-fallback', value);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const shareData = buildShareData();
|
|
127
|
+
// Respect navigator.canShare when present so an unsupported payload falls
|
|
128
|
+
// back to copy instead of rejecting.
|
|
129
|
+
if (typeof navigator.canShare === 'function' && !navigator.canShare(shareData)) {
|
|
130
|
+
await handleCopy('share-fallback', value);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
await navigator.share(shareData);
|
|
135
|
+
announce('Shared successfully');
|
|
136
|
+
} catch (error) {
|
|
137
|
+
// A user-cancelled share rejects with AbortError — NOT a failure, stay
|
|
138
|
+
// silent. Every other rejection (NotAllowedError, TypeError, platform
|
|
139
|
+
// failure) is real: announce it and fall back to copy so the value is
|
|
140
|
+
// never lost.
|
|
141
|
+
if (error instanceof DOMException && error.name === 'AbortError') return;
|
|
142
|
+
// Announce the full outcome on the fallback copy so the "share failed"
|
|
143
|
+
// notice isn't overwritten by a bare "Copied!".
|
|
144
|
+
await handleCopy('share-fallback', value, 'Share failed. Copied to clipboard instead.');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Accessible label for the read-only value region — "Link to share" only when
|
|
149
|
+
// the value actually looks like a URL, otherwise "Text to share".
|
|
150
|
+
const valueRegionLabel = $derived(looksLikeUrl(value) ? 'Link to share' : 'Text to share');
|
|
151
|
+
|
|
152
|
+
onDestroy(() => {
|
|
153
|
+
// clearTimer() clears BOTH resetTimer and announceTimer.
|
|
154
|
+
clearTimer();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Build the default actions when no explicit actions are provided. The default
|
|
158
|
+
// surface always offers copy (the universal fallback); the native-share button
|
|
159
|
+
// is added only where `navigator.share` exists, so there is no redundant
|
|
160
|
+
// "Share" button that merely re-copies on unsupported platforms. A consumer who
|
|
161
|
+
// wants a share button that copies-when-unavailable can pass an explicit action
|
|
162
|
+
// with `useNativeShare: true` — `handleNativeShare` falls back to copy for it.
|
|
163
|
+
const resolvedActions = $derived.by((): ShareCardAction[] => {
|
|
164
|
+
if (actions) return actions;
|
|
165
|
+
const defaultActions: ShareCardAction[] = [
|
|
166
|
+
{
|
|
167
|
+
key: 'copy-link',
|
|
168
|
+
label: copyLinkLabel,
|
|
169
|
+
copyValue: value,
|
|
170
|
+
},
|
|
171
|
+
];
|
|
172
|
+
if (canNativeShare) {
|
|
173
|
+
defaultActions.push({
|
|
174
|
+
key: 'native-share',
|
|
175
|
+
label: shareLabel,
|
|
176
|
+
useNativeShare: true,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return defaultActions;
|
|
180
|
+
});
|
|
181
|
+
</script>
|
|
182
|
+
|
|
183
|
+
<div {...rest} class={classNames('cinder-share-card', customClassName)}>
|
|
184
|
+
{#if preview}
|
|
185
|
+
<div class="cinder-share-card__preview">
|
|
186
|
+
{@render preview()}
|
|
187
|
+
</div>
|
|
188
|
+
{/if}
|
|
189
|
+
|
|
190
|
+
{#if title || description}
|
|
191
|
+
<div class="cinder-share-card__meta">
|
|
192
|
+
{#if title}
|
|
193
|
+
<p class="cinder-share-card__title">{title}</p>
|
|
194
|
+
{/if}
|
|
195
|
+
{#if description}
|
|
196
|
+
<p class="cinder-share-card__description">{description}</p>
|
|
197
|
+
{/if}
|
|
198
|
+
</div>
|
|
199
|
+
{/if}
|
|
200
|
+
|
|
201
|
+
<!-- Value display: truncated read-only URL/text field -->
|
|
202
|
+
<div class="cinder-share-card__value" aria-label={valueRegionLabel}>
|
|
203
|
+
<span class="cinder-share-card__value-text" title={value}>{value}</span>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<div class="cinder-share-card__actions" role="group" aria-label="Share actions">
|
|
207
|
+
{#each resolvedActions as action (action.key)}
|
|
208
|
+
{#if action.key === 'native-share' || action.useNativeShare}
|
|
209
|
+
<!-- When native share is unavailable or fails, `handleNativeShare` falls
|
|
210
|
+
back to a clipboard copy keyed `share-fallback`. Reflect that copied
|
|
211
|
+
state on the share button so the visual matches the live-region
|
|
212
|
+
announcement instead of silently staying on the Share label. -->
|
|
213
|
+
{@const shareCopied = copiedKey === 'share-fallback'}
|
|
214
|
+
<button
|
|
215
|
+
type="button"
|
|
216
|
+
class="cinder-share-card__action"
|
|
217
|
+
data-cinder-action={action.key}
|
|
218
|
+
data-cinder-copied={shareCopied ? '' : undefined}
|
|
219
|
+
onclick={() => {
|
|
220
|
+
// Honour a consumer onClick (analytics/side-effects) on the native
|
|
221
|
+
// share action too, then run the share. `void` marks the floating
|
|
222
|
+
// promise as intentional (the handler is synchronous).
|
|
223
|
+
action.onClick?.();
|
|
224
|
+
void handleNativeShare();
|
|
225
|
+
}}
|
|
226
|
+
aria-label={shareCopied ? copiedLabel : action.label}
|
|
227
|
+
>
|
|
228
|
+
{#if shareCopied}
|
|
229
|
+
<!-- Copied state icon (after a fallback copy) -->
|
|
230
|
+
<span class="cinder-share-card__action-icon" aria-hidden="true">
|
|
231
|
+
<svg
|
|
232
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
233
|
+
viewBox="0 0 24 24"
|
|
234
|
+
fill="none"
|
|
235
|
+
stroke="currentColor"
|
|
236
|
+
stroke-width="2"
|
|
237
|
+
stroke-linecap="round"
|
|
238
|
+
stroke-linejoin="round"
|
|
239
|
+
class="cinder-share-card__icon"
|
|
240
|
+
>
|
|
241
|
+
<polyline points="20,6 9,17 4,12" />
|
|
242
|
+
</svg>
|
|
243
|
+
</span>
|
|
244
|
+
{copiedLabel}
|
|
245
|
+
{:else}
|
|
246
|
+
<!-- Share icon -->
|
|
247
|
+
<span class="cinder-share-card__action-icon" aria-hidden="true">
|
|
248
|
+
<svg
|
|
249
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
250
|
+
viewBox="0 0 24 24"
|
|
251
|
+
fill="none"
|
|
252
|
+
stroke="currentColor"
|
|
253
|
+
stroke-width="2"
|
|
254
|
+
stroke-linecap="round"
|
|
255
|
+
stroke-linejoin="round"
|
|
256
|
+
class="cinder-share-card__icon"
|
|
257
|
+
>
|
|
258
|
+
<circle cx="18" cy="5" r="3" />
|
|
259
|
+
<circle cx="6" cy="12" r="3" />
|
|
260
|
+
<circle cx="18" cy="19" r="3" />
|
|
261
|
+
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49" />
|
|
262
|
+
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49" />
|
|
263
|
+
</svg>
|
|
264
|
+
</span>
|
|
265
|
+
{action.label}
|
|
266
|
+
{/if}
|
|
267
|
+
</button>
|
|
268
|
+
{:else}
|
|
269
|
+
<button
|
|
270
|
+
type="button"
|
|
271
|
+
class="cinder-share-card__action"
|
|
272
|
+
data-cinder-action={action.key}
|
|
273
|
+
data-cinder-copied={copiedKey === action.key ? '' : undefined}
|
|
274
|
+
onclick={() => {
|
|
275
|
+
// onClick is a side-effect callback (e.g. analytics), NOT an
|
|
276
|
+
// override — run it AND still perform the copy when copyValue is
|
|
277
|
+
// present, matching the native-share button's behaviour. An empty
|
|
278
|
+
// string is a legitimate copyValue, so test for `undefined`, not
|
|
279
|
+
// truthiness. `void` marks the floating promise as intentional.
|
|
280
|
+
action.onClick?.();
|
|
281
|
+
if (action.copyValue !== undefined) {
|
|
282
|
+
void handleCopy(action.key, action.copyValue);
|
|
283
|
+
}
|
|
284
|
+
}}
|
|
285
|
+
aria-label={copiedKey === action.key ? copiedLabel : action.label}
|
|
286
|
+
>
|
|
287
|
+
{#if copiedKey === action.key}
|
|
288
|
+
<!-- Copied state icon -->
|
|
289
|
+
<span class="cinder-share-card__action-icon" aria-hidden="true">
|
|
290
|
+
<svg
|
|
291
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
292
|
+
viewBox="0 0 24 24"
|
|
293
|
+
fill="none"
|
|
294
|
+
stroke="currentColor"
|
|
295
|
+
stroke-width="2"
|
|
296
|
+
stroke-linecap="round"
|
|
297
|
+
stroke-linejoin="round"
|
|
298
|
+
class="cinder-share-card__icon"
|
|
299
|
+
>
|
|
300
|
+
<polyline points="20,6 9,17 4,12" />
|
|
301
|
+
</svg>
|
|
302
|
+
</span>
|
|
303
|
+
{copiedLabel}
|
|
304
|
+
{:else}
|
|
305
|
+
<!-- Copy icon -->
|
|
306
|
+
<span class="cinder-share-card__action-icon" aria-hidden="true">
|
|
307
|
+
<svg
|
|
308
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
309
|
+
viewBox="0 0 24 24"
|
|
310
|
+
fill="none"
|
|
311
|
+
stroke="currentColor"
|
|
312
|
+
stroke-width="2"
|
|
313
|
+
stroke-linecap="round"
|
|
314
|
+
stroke-linejoin="round"
|
|
315
|
+
class="cinder-share-card__icon"
|
|
316
|
+
>
|
|
317
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
|
|
318
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
319
|
+
</svg>
|
|
320
|
+
</span>
|
|
321
|
+
{action.label}
|
|
322
|
+
{/if}
|
|
323
|
+
</button>
|
|
324
|
+
{/if}
|
|
325
|
+
{/each}
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
<!-- Announce copy/share outcomes to assistive technology. -->
|
|
330
|
+
<VisuallyHiddenLiveRegion message={announcement} />
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
/** An action to include in the share card. */
|
|
5
|
+
export type ShareCardAction = {
|
|
6
|
+
/** Unique key for this action. */
|
|
7
|
+
key: string;
|
|
8
|
+
/** Visible label for the action button. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Text to copy when this action is triggered (used for copy-link/copy-text). */
|
|
11
|
+
copyValue?: string;
|
|
12
|
+
/** Called when this action button is clicked. */
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
/** Whether to use navigator.share for this action. */
|
|
15
|
+
useNativeShare?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** Props for the ShareCard component. */
|
|
19
|
+
export type ShareCardProps = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'> & {
|
|
20
|
+
/** The URL or text to share/copy. */
|
|
21
|
+
value: string;
|
|
22
|
+
/** Human-readable title for the share card. */
|
|
23
|
+
title?: string;
|
|
24
|
+
/** Additional descriptive text below the title. */
|
|
25
|
+
description?: string;
|
|
26
|
+
/** Explicit actions to show. When omitted, default copy-link and native-share actions are rendered. */
|
|
27
|
+
actions?: ShareCardAction[];
|
|
28
|
+
/** Label for the copy-link button. @default "Copy link" */
|
|
29
|
+
copyLinkLabel?: string;
|
|
30
|
+
/** Label shown after a successful copy. @default "Copied!" */
|
|
31
|
+
copiedLabel?: string;
|
|
32
|
+
/** Label for the native-share button. Only shown when navigator.share is available. @default "Share" */
|
|
33
|
+
shareLabel?: string;
|
|
34
|
+
/** Duration in ms to show the copied confirmation state. @default 2000 */
|
|
35
|
+
confirmDuration?: number;
|
|
36
|
+
/** Preview content slot rendered above the actions. */
|
|
37
|
+
preview?: Snippet;
|
|
38
|
+
/** Additional class names merged with `.cinder-share-card`. */
|
|
39
|
+
class?: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Cinder-specific props for ShareCard, used by the schema generator.
|
|
44
|
+
*/
|
|
45
|
+
export interface ShareCardSchemaProps {
|
|
46
|
+
/** The URL or text to share/copy. */
|
|
47
|
+
value: string;
|
|
48
|
+
/** Human-readable title for the share card. */
|
|
49
|
+
title?: string;
|
|
50
|
+
/** Additional descriptive text. */
|
|
51
|
+
description?: string;
|
|
52
|
+
/** Label for the copy-link button. */
|
|
53
|
+
copyLinkLabel?: string;
|
|
54
|
+
/** Label shown after a successful copy. */
|
|
55
|
+
copiedLabel?: string;
|
|
56
|
+
/** Label for the native-share button. */
|
|
57
|
+
shareLabel?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Duration in ms to show the copied confirmation state.
|
|
60
|
+
* @default 2000
|
|
61
|
+
*/
|
|
62
|
+
confirmDuration?: number;
|
|
63
|
+
/** Additional class names merged with `.cinder-share-card`. */
|
|
64
|
+
class?: string;
|
|
65
|
+
/** Explicit actions to show. When omitted, default copy + native-share actions render. */
|
|
66
|
+
actions?: ShareCardAction[];
|
|
67
|
+
/** Preview content slot rendered above the actions. */
|
|
68
|
+
preview?: Snippet;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ShortcutHint
|
|
2
|
+
|
|
3
|
+
Inline shortcut hint that renders a key combo via Kbd alongside an action label, with an accessible text representation not reliant on visual keycaps alone.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { ShortcutHint } from '@lostgradient/cinder/shortcut-hint';
|
|
10
|
+
</script>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Guidance
|
|
14
|
+
|
|
15
|
+
### Use When
|
|
16
|
+
|
|
17
|
+
- Showing a keyboard shortcut inline beside a label in a toolbar button, menu item, or tooltip.
|
|
18
|
+
- Pairing with command-palette items to surface available shortcuts.
|
|
19
|
+
|
|
20
|
+
### Avoid When
|
|
21
|
+
|
|
22
|
+
- Displaying a full shortcut reference table — use keyboard-shortcuts instead.
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
<!-- generated:props:start -->
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Required | Default | Description |
|
|
29
|
+
| -------------- | ----------------------- | -------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `class` | `string` | no | — | Additional class names merged with `.cinder-shortcut-hint`. |
|
|
31
|
+
| `keys` | `string`[] | yes | — | The key sequence to display. |
|
|
32
|
+
| `keysLabel` | `string` | no | — | Accessible label for the key combo. |
|
|
33
|
+
| `keysPosition` | `"before"` \| `"after"` | no | `"after"` | Position of keys relative to children. |
|
|
34
|
+
| `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. |
|
|
35
|
+
|
|
36
|
+
<!-- generated:props:end -->
|
|
37
|
+
|
|
38
|
+
## CSS Variables
|
|
39
|
+
|
|
40
|
+
<!-- generated:variables:start -->
|
|
41
|
+
|
|
42
|
+
This component does not declare any local CSS variables.
|
|
43
|
+
|
|
44
|
+
<!-- generated:variables:end -->
|
|
45
|
+
|
|
46
|
+
## Subcomponents
|
|
47
|
+
|
|
48
|
+
<!-- generated:subcomponents:start -->
|
|
49
|
+
|
|
50
|
+
None.
|
|
51
|
+
|
|
52
|
+
<!-- generated:subcomponents:end -->
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
|
|
2
|
+
@layer cinder.components {
|
|
3
|
+
.cinder-shortcut-hint {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--cinder-space-1);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cinder-shortcut-hint__label {
|
|
10
|
+
color: var(--cinder-text);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.cinder-shortcut-hint__keys {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: var(--cinder-space-1);
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.cinder-shortcut-hint__separator {
|
|
21
|
+
font-size: var(--cinder-text-xs);
|
|
22
|
+
color: var(--cinder-text-muted);
|
|
23
|
+
line-height: 1;
|
|
24
|
+
user-select: none;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../schemas/examples.schema.json",
|
|
3
|
+
"component": "shortcut-hint",
|
|
4
|
+
"import": "@lostgradient/cinder/shortcut-hint",
|
|
5
|
+
"examples": [
|
|
6
|
+
{
|
|
7
|
+
"id": "toolbar",
|
|
8
|
+
"title": "Toolbar shortcut hints",
|
|
9
|
+
"description": "Inline shortcut hints in a compact toolbar, keys positioned after the label.",
|
|
10
|
+
"code": "<script lang=\"ts\">\n import { ShortcutHint } from '@lostgradient/cinder/shortcut-hint';\n</script>\n\n<div style=\"display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;\">\n <ShortcutHint keys={['Ctrl', 'S']}>Save</ShortcutHint>\n <ShortcutHint keys={['Ctrl', 'Z']}>Undo</ShortcutHint>\n <ShortcutHint keys={['Escape']}>Cancel</ShortcutHint>\n <ShortcutHint keys={['Space']} keysLabel=\"Space bar\" keysPosition=\"before\">Play</ShortcutHint>\n</div>\n"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"keys": {
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"description": "The key sequence to display."
|
|
11
|
+
},
|
|
12
|
+
"keysLabel": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Accessible label for the key combo."
|
|
15
|
+
},
|
|
16
|
+
"keysPosition": {
|
|
17
|
+
"enum": ["before", "after"],
|
|
18
|
+
"description": "Position of keys relative to children.",
|
|
19
|
+
"default": "after"
|
|
20
|
+
},
|
|
21
|
+
"class": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Additional class names merged with `.cinder-shortcut-hint`."
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"required": ["keys"],
|
|
28
|
+
"metadata": {
|
|
29
|
+
"unsupportedProps": [
|
|
30
|
+
{
|
|
31
|
+
"name": "children",
|
|
32
|
+
"reason": "function-or-snippet"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
keys: {
|
|
8
|
+
type: 'array',
|
|
9
|
+
items: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
description: 'The key sequence to display.',
|
|
13
|
+
},
|
|
14
|
+
keysLabel: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Accessible label for the key combo.',
|
|
17
|
+
},
|
|
18
|
+
keysPosition: {
|
|
19
|
+
enum: ['before', 'after'],
|
|
20
|
+
description: 'Position of keys relative to children.',
|
|
21
|
+
default: 'after',
|
|
22
|
+
},
|
|
23
|
+
class: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Additional class names merged with `.cinder-shortcut-hint`.',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
required: ['keys'],
|
|
30
|
+
metadata: {
|
|
31
|
+
unsupportedProps: [
|
|
32
|
+
{
|
|
33
|
+
name: 'children',
|
|
34
|
+
reason: 'function-or-snippet',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
} satisfies ComponentSchema;
|
|
39
|
+
|
|
40
|
+
export default schema as ComponentSchema;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* @cinder
|
|
4
|
+
* @category typography
|
|
5
|
+
* @status alpha
|
|
6
|
+
* @purpose Inline shortcut hint that renders a key combo via Kbd alongside an action label, with an accessible text representation not reliant on visual keycaps alone.
|
|
7
|
+
* @tag shortcut
|
|
8
|
+
* @tag inline
|
|
9
|
+
* @useWhen Showing a keyboard shortcut inline beside a label in a toolbar button, menu item, or tooltip.
|
|
10
|
+
* @useWhen Pairing with command-palette items to surface available shortcuts.
|
|
11
|
+
* @avoidWhen Displaying a full shortcut reference table — use keyboard-shortcuts instead.
|
|
12
|
+
* @related kbd, keyboard-shortcuts, tooltip
|
|
13
|
+
*/
|
|
14
|
+
export type { ShortcutHintProps } from './shortcut-hint.types.ts';
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { classNames } from '../../utilities/class-names.ts';
|
|
19
|
+
import Kbd from '../kbd/kbd.svelte';
|
|
20
|
+
import type { ShortcutHintProps } from './shortcut-hint.types.ts';
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
keys,
|
|
24
|
+
keysLabel,
|
|
25
|
+
children,
|
|
26
|
+
keysPosition = 'after',
|
|
27
|
+
class: customClassName,
|
|
28
|
+
...rest
|
|
29
|
+
}: ShortcutHintProps = $props();
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Build a screen-reader–friendly label for the key combo.
|
|
33
|
+
*/
|
|
34
|
+
const resolvedKeysLabel = $derived(keysLabel ?? keys.join(' plus '));
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<!--
|
|
38
|
+
The visual keycaps are aria-hidden so assistive technology never encounters the
|
|
39
|
+
raw Kbd glyphs; the spoken representation is a single cinder-sr-only text node
|
|
40
|
+
("Ctrl plus S") — a more reliable strategy than aria-label on a generic span.
|
|
41
|
+
Keycaps are inlined (not a {#snippet}) to avoid a Svelte 5 + happy-dom snippet
|
|
42
|
+
ordering quirk when a snippet is the first child of an {#if} branch.
|
|
43
|
+
-->
|
|
44
|
+
<span {...rest} class={classNames('cinder-shortcut-hint', customClassName)}>
|
|
45
|
+
{#if children && keysPosition === 'after'}
|
|
46
|
+
<span class="cinder-shortcut-hint__label">{@render children()}</span>
|
|
47
|
+
{/if}
|
|
48
|
+
|
|
49
|
+
<span class="cinder-shortcut-hint__keys" aria-hidden="true">
|
|
50
|
+
{#each keys as key, index (key + index)}
|
|
51
|
+
<Kbd label={key} size="sm" />
|
|
52
|
+
{#if index < keys.length - 1}
|
|
53
|
+
<span class="cinder-shortcut-hint__separator">+</span>
|
|
54
|
+
{/if}
|
|
55
|
+
{/each}
|
|
56
|
+
</span>
|
|
57
|
+
<span class="cinder-sr-only">{resolvedKeysLabel}</span>
|
|
58
|
+
|
|
59
|
+
{#if children && keysPosition === 'before'}
|
|
60
|
+
<span class="cinder-shortcut-hint__label">{@render children()}</span>
|
|
61
|
+
{/if}
|
|
62
|
+
</span>
|