@motion-proto/live-tokens 0.6.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -13
- package/dist-plugin/index.cjs +854 -226
- package/dist-plugin/index.d.cts +2 -1
- package/dist-plugin/index.d.ts +2 -1
- package/dist-plugin/index.js +852 -225
- package/package.json +26 -40
- package/src/{styles → app}/site.css +1 -1
- package/src/{component-editor → editor/component-editor}/BadgeEditor.svelte +8 -82
- package/src/{component-editor → editor/component-editor}/CalloutEditor.svelte +4 -4
- package/src/{component-editor → editor/component-editor}/CardEditor.svelte +28 -76
- package/src/{component-editor → editor/component-editor}/CollapsibleSectionEditor.svelte +37 -30
- package/src/{component-editor → editor/component-editor}/CornerBadgeEditor.svelte +31 -93
- package/src/{component-editor → editor/component-editor}/DialogEditor.svelte +60 -57
- package/src/editor/component-editor/ImageEditor.svelte +30 -0
- package/src/{component-editor → editor/component-editor}/InlineEditActionsEditor.svelte +6 -4
- package/src/editor/component-editor/MenuSelectEditor.svelte +160 -0
- package/src/{component-editor → editor/component-editor}/NotificationEditor.svelte +67 -38
- package/src/{component-editor → editor/component-editor}/ProgressBarEditor.svelte +5 -4
- package/src/{component-editor → editor/component-editor}/RadioButtonEditor.svelte +3 -3
- package/src/editor/component-editor/SectionDividerEditor.svelte +565 -0
- package/src/{component-editor → editor/component-editor}/SegmentedControlEditor.svelte +2 -2
- package/src/{component-editor → editor/component-editor}/StandardButtonsEditor.svelte +29 -21
- package/src/{component-editor → editor/component-editor}/TabBarEditor.svelte +9 -14
- package/src/{component-editor → editor/component-editor}/TableEditor.svelte +9 -18
- package/src/{component-editor → editor/component-editor}/TooltipEditor.svelte +11 -47
- package/src/editor/component-editor/editors.d.ts +10 -0
- package/src/{component-editor → editor/component-editor}/registry.ts +28 -18
- package/src/{component-editor → editor/component-editor}/scaffolding/AngleDial.svelte +54 -15
- package/src/{component-editor → editor/component-editor}/scaffolding/ComponentEditorBase.svelte +3 -51
- package/src/{component-editor → editor/component-editor}/scaffolding/ComponentFileManager.svelte +151 -424
- package/src/{component-editor → editor/component-editor}/scaffolding/ComponentFileMenu.svelte +18 -170
- package/src/{component-editor → editor/component-editor}/scaffolding/ComponentsTab.svelte +2 -2
- package/src/{component-editor → editor/component-editor}/scaffolding/CopyFromMenu.svelte +44 -4
- package/src/{component-editor → editor/component-editor}/scaffolding/FieldsetWrapper.svelte +1 -1
- package/src/{component-editor → editor/component-editor}/scaffolding/LinkageChart.svelte +6 -6
- package/src/{component-editor → editor/component-editor}/scaffolding/LinkedBlock.svelte +6 -12
- package/src/editor/component-editor/scaffolding/NonStylableConfig.svelte +38 -0
- package/src/editor/component-editor/scaffolding/RadialShapePad.svelte +483 -0
- package/src/{component-editor → editor/component-editor}/scaffolding/SaveAsDialog.svelte +66 -12
- package/src/editor/component-editor/scaffolding/ShadowBackdrop.svelte +85 -0
- package/src/editor/component-editor/scaffolding/ShadowBackdropControls.svelte +132 -0
- package/src/editor/component-editor/scaffolding/StateBlock.svelte +345 -0
- package/src/{component-editor → editor/component-editor}/scaffolding/TokenLayout.svelte +17 -12
- package/src/{component-editor → editor/component-editor}/scaffolding/TypeEditor.svelte +13 -1
- package/src/editor/component-editor/scaffolding/VariantGroup.svelte +858 -0
- package/src/{component-editor → editor/component-editor}/scaffolding/buildTypeGroupTokens.ts +1 -0
- package/src/{component-editor → editor/component-editor}/scaffolding/editorContext.ts +19 -9
- package/src/{component-editor → editor/component-editor}/scaffolding/linkedBlock.ts +2 -2
- package/src/{component-editor → editor/component-editor}/scaffolding/types.ts +25 -0
- package/src/{lib → editor/core/components}/componentConfigKeys.ts +8 -0
- package/src/{lib → editor/core/components}/componentConfigService.ts +3 -3
- package/src/{lib → editor/core/components}/componentPersist.ts +11 -9
- package/src/editor/core/flashStatus.ts +30 -0
- package/src/{lib → editor/core/fonts}/fontLoader.ts +2 -2
- package/src/{lib → editor/core/fonts}/fontMigration.ts +4 -4
- package/src/{lib → editor/core/fonts}/fontParse.ts +1 -1
- package/src/editor/core/manifests/manifestService.ts +171 -0
- package/src/editor/core/palettes/familySwap.ts +99 -0
- package/src/{lib → editor/core/palettes}/paletteDerivation.ts +71 -2
- package/src/{lib → editor/core/palettes}/tokenRegistry.ts +9 -6
- package/src/editor/core/productionPulse.ts +37 -0
- package/src/{lib → editor/core/routing}/router.ts +1 -1
- package/src/{lib/files/versionedFileResource.ts → editor/core/storage/files/versionedFileResourceClient.ts} +8 -1
- package/src/{lib → editor/core/store}/editorCore.ts +24 -8
- package/src/{lib → editor/core/store}/editorPersistence.ts +3 -3
- package/src/{lib → editor/core/store}/editorRenderer.ts +2 -2
- package/src/{lib → editor/core/store}/editorStore.ts +222 -28
- package/src/{lib → editor/core/store}/editorTypes.ts +56 -13
- package/src/editor/core/store/gradientSource.ts +192 -0
- package/src/editor/core/themes/migrations/2026-05-19-collapsiblesection-drop-frame-surface.ts +28 -0
- package/src/editor/core/themes/migrations/2026-05-19-sectiondivider-rich-gradient.ts +35 -0
- package/src/editor/core/themes/migrations/2026-05-20-sectiondivider-slim-variants.ts +82 -0
- package/src/editor/core/themes/migrations/2026-05-21-sectiondivider-spacing-to-padding.ts +24 -0
- package/src/editor/core/themes/migrations/2026-05-22-sectiondivider-intrinsics-to-css.ts +81 -0
- package/src/{lib → editor/core/themes}/migrations/index.ts +10 -0
- package/src/{lib → editor/core/themes}/slices/columns.ts +2 -2
- package/src/{lib → editor/core/themes}/slices/components.ts +20 -6
- package/src/{lib → editor/core/themes}/slices/fonts.ts +1 -1
- package/src/{lib → editor/core/themes}/slices/gradients.ts +89 -14
- package/src/{lib → editor/core/themes}/slices/overlays.ts +1 -1
- package/src/{lib → editor/core/themes}/slices/palettes.ts +1 -1
- package/src/{lib → editor/core/themes}/slices/shadows.ts +3 -3
- package/src/{lib → editor/core/themes}/themeInit.ts +8 -8
- package/src/{lib → editor/core/themes}/themeService.ts +6 -6
- package/src/{lib → editor/core/themes}/themeTypes.ts +67 -8
- package/src/editor/index.ts +69 -0
- package/src/{lib → editor/overlay}/ColumnsOverlay.svelte +0 -1
- package/src/{lib → editor/overlay}/LiveEditorOverlay.svelte +80 -129
- package/src/{lib → editor/overlay}/columnsOverlay.ts +2 -2
- package/src/{pages → editor/pages}/ComponentEditorPage.svelte +12 -12
- package/src/{pages → editor/pages}/Editor.svelte +4 -4
- package/src/{pages → editor/pages}/EditorShell.svelte +18 -36
- package/src/{styles → editor/styles}/ui-editor.css +43 -22
- package/src/{styles → editor/styles}/ui-form-controls.css +23 -24
- package/src/{ui → editor/ui}/BezierCurveEditor.svelte +119 -68
- package/src/{ui → editor/ui}/ColorEditPanel.svelte +13 -13
- package/src/{ui → editor/ui}/EditorViewSwitcher.svelte +7 -6
- package/src/editor/ui/FileLoadList.svelte +367 -0
- package/src/editor/ui/FilePill.svelte +80 -0
- package/src/editor/ui/FontStackEditor.svelte +499 -0
- package/src/editor/ui/GradientEditor.svelte +690 -0
- package/src/{ui → editor/ui}/GradientStopPicker.svelte +12 -4
- package/src/editor/ui/ManifestFileManager.svelte +438 -0
- package/src/{ui → editor/ui}/PaletteEditor.svelte +180 -673
- package/src/editor/ui/ProjectFontsSection.svelte +638 -0
- package/src/{ui → editor/ui}/SurfacesTab.svelte +3 -3
- package/src/{ui → editor/ui}/TextTab.svelte +3 -3
- package/src/editor/ui/ThemeFileManager.svelte +783 -0
- package/src/{ui → editor/ui}/UICopyPopover.svelte +4 -4
- package/src/{ui → editor/ui}/UIFontFamilySelector.svelte +6 -7
- package/src/{ui → editor/ui}/UIFontSizeSelector.svelte +4 -1
- package/src/editor/ui/UIInfoPopover.svelte +243 -0
- package/src/editor/ui/UILetterSpacingSelector.svelte +65 -0
- package/src/{ui → editor/ui}/UILineHeightSelector.svelte +5 -5
- package/src/{ui → editor/ui}/UILinkToggle.svelte +2 -2
- package/src/{ui → editor/ui}/UIPaddingSelector.svelte +6 -6
- package/src/{ui → editor/ui}/UIPaletteSelector.svelte +57 -30
- package/src/editor/ui/UIPillButton.svelte +168 -0
- package/src/{ui → editor/ui}/UIRadio.svelte +2 -2
- package/src/{ui → editor/ui}/UIRelinkConfirmPopover.svelte +4 -4
- package/src/editor/ui/UISegmentedControl.svelte +114 -0
- package/src/editor/ui/UISquareButton.svelte +172 -0
- package/src/{ui → editor/ui}/UITokenSelector.svelte +14 -11
- package/src/{ui → editor/ui}/UIVariantSelector.svelte +1 -1
- package/src/{ui → editor/ui}/VariablesTab.svelte +46 -17
- package/src/{ui → editor/ui}/palette/GradientStopEditor.svelte +13 -13
- package/src/{ui → editor/ui}/palette/OverridesPanel.svelte +24 -47
- package/src/{ui → editor/ui}/palette/PaletteBase.svelte +11 -8
- package/src/{ui → editor/ui}/palette/paletteEditorState.ts +1 -1
- package/src/editor/ui/palette/paletteMath.ts +275 -0
- package/src/{ui → editor/ui}/sections/ColumnsSection.svelte +137 -18
- package/src/{ui → editor/ui}/sections/GradientsSection.svelte +8 -8
- package/src/{ui → editor/ui}/sections/OverlaysSection.svelte +18 -18
- package/src/{ui → editor/ui}/sections/ShadowsSection.svelte +23 -23
- package/src/{ui → editor/ui}/sections/TokenScaleTable.svelte +3 -3
- package/src/{components → system/components}/Badge.svelte +0 -36
- package/src/{components → system/components}/Button.svelte +2 -2
- package/src/{components → system/components}/Card.svelte +34 -60
- package/src/{components → system/components}/CollapsibleSection.svelte +25 -2
- package/src/{components → system/components}/CornerBadge.svelte +8 -24
- package/src/{components → system/components}/Dialog.svelte +1 -1
- package/src/system/components/FloatingTokenTags.css +275 -0
- package/src/system/components/FloatingTokenTags.svelte +543 -0
- package/src/{components → system/components}/InlineEditActions.svelte +6 -4
- package/src/system/components/MenuSelect.svelte +229 -0
- package/src/{components → system/components}/Notification.svelte +8 -1
- package/src/{components → system/components}/ProgressBar.svelte +29 -11
- package/src/system/components/SectionDivider.svelte +560 -0
- package/src/{components → system/components}/SegmentedControl.svelte +49 -43
- package/src/{components → system/components}/TabBar.svelte +81 -65
- package/src/{components → system/components}/Table.svelte +17 -3
- package/src/{components → system/components}/Tooltip.svelte +6 -4
- package/src/system/styles/CONVENTIONS.md +178 -0
- package/src/system/styles/fonts.css +20 -0
- package/src/system/styles/tokens.css +601 -0
- package/src/system/styles/tokens.generated.css +544 -0
- package/src/component-editor/ImageEditor.svelte +0 -74
- package/src/component-editor/SectionDividerEditor.svelte +0 -265
- package/src/component-editor/scaffolding/DividerEditor.svelte +0 -94
- package/src/component-editor/scaffolding/GradientCard.svelte +0 -296
- package/src/component-editor/scaffolding/NonStylableConfig.svelte +0 -62
- package/src/component-editor/scaffolding/ShadowBackdrop.svelte +0 -37
- package/src/component-editor/scaffolding/ShadowBackdropControls.svelte +0 -61
- package/src/component-editor/scaffolding/StateBlock.svelte +0 -132
- package/src/component-editor/scaffolding/VariantGroup.svelte +0 -310
- package/src/components/SectionDivider.svelte +0 -483
- package/src/data/google-fonts.json +0 -75
- package/src/lib/index.ts +0 -68
- package/src/lib/presetService.ts +0 -214
- package/src/lib/productionPulse.ts +0 -32
- package/src/styles/fonts.css +0 -30
- package/src/styles/tokens.css +0 -1324
- package/src/ui/FontStackEditor.svelte +0 -361
- package/src/ui/GradientEditor.svelte +0 -470
- package/src/ui/PresetFileManager.svelte +0 -1116
- package/src/ui/ProjectFontsSection.svelte +0 -645
- package/src/ui/ThemeFileManager.svelte +0 -1020
- package/src/ui/UnsavedComponentsDialog.svelte +0 -315
- /package/src/{component-editor → editor/component-editor}/index.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/DemoHeader.svelte +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/componentSectionType.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/componentSources.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/defaultSections.ts +0 -0
- /package/src/{component-editor → editor/component-editor}/scaffolding/siblings.ts +0 -0
- /package/src/{lib → editor/core}/cssVarSync.ts +0 -0
- /package/src/{lib → editor/core/palettes}/oklch.ts +0 -0
- /package/src/{lib → editor/core/routing}/navLinkTypes.ts +0 -0
- /package/src/{lib → editor/core/routing}/parentRouteStore.ts +0 -0
- /package/src/{lib → editor/core/storage}/storage.ts +0 -0
- /package/src/{lib → editor/core/store}/editorConfig.ts +0 -0
- /package/src/{lib → editor/core/store}/editorConfigStore.ts +0 -0
- /package/src/{lib → editor/core/store}/editorKeybindings.ts +0 -0
- /package/src/{lib → editor/core/store}/editorViewStore.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-04-24-component-prefix-and-suffix-renames.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-04-24-legacy-keys-and-bg-to-canvas.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-04-27-segmentedcontrol-disabled-flatten.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-05-08-collapsiblesection-frame-and-cleanup.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-05-08-collapsiblesection-variant-namespace.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-05-10-sectiondivider-gradient-stops.ts +0 -0
- /package/src/{lib → editor/core/themes}/migrations/2026-05-13-primary-to-brand.ts +0 -0
- /package/src/{lib → editor/core/themes}/parsers/globalRootBlock.ts +0 -0
- /package/src/{lib → editor/core/themes}/slices/domainVars.ts +0 -0
- /package/src/{lib → editor/overlay}/overlayState.ts +0 -0
- /package/src/{pages → editor/pages}/ComponentEditorPage.svelte.d.ts +0 -0
- /package/src/{pages → editor/pages}/Editor.svelte.d.ts +0 -0
- /package/src/{ui → editor/ui}/Toggle.svelte +0 -0
- /package/src/{ui → editor/ui}/UIDialog.svelte +0 -0
- /package/src/{ui → editor/ui}/UIFontWeightSelector.svelte +0 -0
- /package/src/{ui → editor/ui}/UIOptionItem.svelte +0 -0
- /package/src/{ui → editor/ui}/UIOptionList.svelte +0 -0
- /package/src/{ui → editor/ui}/UIRadioGroup.svelte +0 -0
- /package/src/{lib → editor/ui}/copyPopover.ts +0 -0
- /package/src/{ui → editor/ui}/curveEngine.ts +0 -0
- /package/src/{ui → editor/ui}/index.ts +0 -0
- /package/src/{ui → editor/ui}/keepInViewport.ts +0 -0
- /package/src/{ui → editor/ui}/palette/ScaleCurveEditor.svelte +0 -0
- /package/src/{lib → editor/ui}/scrollSection.ts +0 -0
- /package/src/{ui → editor/ui}/sections/tokenScales.ts +0 -0
- /package/src/{ui → editor/ui}/variantScales.ts +0 -0
- /package/src/{assets → system/assets}/newspaper.webp +0 -0
- /package/src/{assets → system/assets}/offering.webp +0 -0
- /package/src/{components → system/components}/Callout.svelte +0 -0
- /package/src/{components → system/components}/Image.svelte +0 -0
- /package/src/{components → system/components}/RadioButton.svelte +0 -0
- /package/src/{components → system/components}/types.ts +0 -0
- /package/src/{styles → system/styles}/_padding.scss +0 -0
- /package/src/{styles → system/styles}/fonts/Fraunces/Fraunces-italic-latin-ext.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Fraunces/Fraunces-italic-latin.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Fraunces/Fraunces-roman-latin-ext.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Fraunces/Fraunces-roman-latin.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Manrope/Manrope-latin-ext.woff2 +0 -0
- /package/src/{styles → system/styles}/fonts/Manrope/Manrope-latin.woff2 +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motion-proto/live-tokens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Design token editor with live CSS variable editing. Svelte 5 + Vite 6/7.",
|
|
6
6
|
"keywords": [
|
|
@@ -19,24 +19,9 @@
|
|
|
19
19
|
"homepage": "https://github.com/motionproto/live-tokens",
|
|
20
20
|
"bugs": "https://github.com/motionproto/live-tokens/issues",
|
|
21
21
|
"files": [
|
|
22
|
-
"src/
|
|
23
|
-
"src/
|
|
24
|
-
"src/
|
|
25
|
-
"src/components",
|
|
26
|
-
"src/pages/Editor.svelte",
|
|
27
|
-
"src/pages/Editor.svelte.d.ts",
|
|
28
|
-
"src/pages/EditorShell.svelte",
|
|
29
|
-
"src/pages/ComponentEditorPage.svelte",
|
|
30
|
-
"src/pages/ComponentEditorPage.svelte.d.ts",
|
|
31
|
-
"src/styles/ui-editor.css",
|
|
32
|
-
"src/styles/ui-form-controls.css",
|
|
33
|
-
"src/styles/fonts.css",
|
|
34
|
-
"src/styles/fonts",
|
|
35
|
-
"src/styles/_padding.scss",
|
|
36
|
-
"src/styles/tokens.css",
|
|
37
|
-
"src/styles/site.css",
|
|
38
|
-
"src/data",
|
|
39
|
-
"src/assets",
|
|
22
|
+
"src/editor",
|
|
23
|
+
"src/system",
|
|
24
|
+
"src/app/site.css",
|
|
40
25
|
"dist-plugin",
|
|
41
26
|
"!**/*.test.ts",
|
|
42
27
|
"!**/*.spec.ts",
|
|
@@ -44,43 +29,44 @@
|
|
|
44
29
|
],
|
|
45
30
|
"exports": {
|
|
46
31
|
".": {
|
|
47
|
-
"svelte": "./src/
|
|
48
|
-
"types": "./src/
|
|
49
|
-
"default": "./src/
|
|
32
|
+
"svelte": "./src/editor/index.ts",
|
|
33
|
+
"types": "./src/editor/index.ts",
|
|
34
|
+
"default": "./src/editor/index.ts"
|
|
50
35
|
},
|
|
51
36
|
"./component-editor": {
|
|
52
|
-
"svelte": "./src/component-editor/index.ts",
|
|
53
|
-
"types": "./src/component-editor/index.ts",
|
|
54
|
-
"default": "./src/component-editor/index.ts"
|
|
37
|
+
"svelte": "./src/editor/component-editor/index.ts",
|
|
38
|
+
"types": "./src/editor/component-editor/index.ts",
|
|
39
|
+
"default": "./src/editor/component-editor/index.ts"
|
|
55
40
|
},
|
|
56
41
|
"./ui": {
|
|
57
|
-
"svelte": "./src/ui/index.ts",
|
|
58
|
-
"types": "./src/ui/index.ts",
|
|
59
|
-
"default": "./src/ui/index.ts"
|
|
42
|
+
"svelte": "./src/editor/ui/index.ts",
|
|
43
|
+
"types": "./src/editor/ui/index.ts",
|
|
44
|
+
"default": "./src/editor/ui/index.ts"
|
|
60
45
|
},
|
|
61
46
|
"./editor": {
|
|
62
|
-
"types": "./src/pages/Editor.svelte.d.ts",
|
|
63
|
-
"svelte": "./src/pages/Editor.svelte",
|
|
64
|
-
"default": "./src/pages/Editor.svelte"
|
|
47
|
+
"types": "./src/editor/pages/Editor.svelte.d.ts",
|
|
48
|
+
"svelte": "./src/editor/pages/Editor.svelte",
|
|
49
|
+
"default": "./src/editor/pages/Editor.svelte"
|
|
65
50
|
},
|
|
66
51
|
"./component-editor-page": {
|
|
67
|
-
"types": "./src/pages/ComponentEditorPage.svelte.d.ts",
|
|
68
|
-
"svelte": "./src/pages/ComponentEditorPage.svelte",
|
|
69
|
-
"default": "./src/pages/ComponentEditorPage.svelte"
|
|
52
|
+
"types": "./src/editor/pages/ComponentEditorPage.svelte.d.ts",
|
|
53
|
+
"svelte": "./src/editor/pages/ComponentEditorPage.svelte",
|
|
54
|
+
"default": "./src/editor/pages/ComponentEditorPage.svelte"
|
|
70
55
|
},
|
|
71
56
|
"./components/*": {
|
|
72
|
-
"svelte": "./src/components/*",
|
|
73
|
-
"default": "./src/components/*"
|
|
57
|
+
"svelte": "./src/system/components/*",
|
|
58
|
+
"default": "./src/system/components/*"
|
|
74
59
|
},
|
|
75
60
|
"./vite-plugin": {
|
|
76
61
|
"types": "./dist-plugin/index.d.ts",
|
|
77
62
|
"import": "./dist-plugin/index.js",
|
|
78
63
|
"require": "./dist-plugin/index.cjs"
|
|
79
64
|
},
|
|
80
|
-
"./styles/ui-editor.css": "./src/styles/ui-editor.css",
|
|
81
|
-
"./
|
|
82
|
-
"./
|
|
83
|
-
"./
|
|
65
|
+
"./styles/ui-editor.css": "./src/editor/styles/ui-editor.css",
|
|
66
|
+
"./app/tokens.css": "./src/system/styles/tokens.css",
|
|
67
|
+
"./app/tokens.generated.css": "./src/system/styles/tokens.generated.css",
|
|
68
|
+
"./app/site.css": "./src/app/site.css",
|
|
69
|
+
"./app/fonts.css": "./src/system/styles/fonts.css"
|
|
84
70
|
},
|
|
85
71
|
"scripts": {
|
|
86
72
|
"dev": "vite",
|
|
@@ -24,7 +24,7 @@ h2 {
|
|
|
24
24
|
font-size: var(--font-size-2xl);
|
|
25
25
|
font-weight: var(--font-weight-semibold);
|
|
26
26
|
color: var(--text-primary);
|
|
27
|
-
letter-spacing:
|
|
27
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
28
28
|
margin: var(--space-32) 0 var(--space-12);
|
|
29
29
|
line-height: var(--line-height-sm);
|
|
30
30
|
overflow-wrap: break-word;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupColorTokens } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
|
-
import { badgeVariants } from '
|
|
4
|
+
import { badgeVariants } from '../../system/components/Badge.svelte';
|
|
5
5
|
|
|
6
6
|
export const component = 'badge';
|
|
7
7
|
const variants = badgeVariants;
|
|
@@ -59,56 +59,18 @@
|
|
|
59
59
|
</script>
|
|
60
60
|
|
|
61
61
|
<script lang="ts">
|
|
62
|
-
import Badge from '
|
|
62
|
+
import Badge from '../../system/components/Badge.svelte';
|
|
63
63
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
64
64
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
65
|
-
import { editorState } from '../
|
|
65
|
+
import { editorState } from '../core/store/editorStore';
|
|
66
66
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
67
67
|
import { buildSiblings } from './scaffolding/siblings';
|
|
68
|
-
import ShadowBackdrop from './scaffolding/ShadowBackdrop.svelte';
|
|
69
|
-
import ShadowBackdropControls from './scaffolding/ShadowBackdropControls.svelte';
|
|
70
|
-
import UIRadioGroup from '../ui/UIRadioGroup.svelte';
|
|
71
68
|
|
|
72
69
|
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
73
70
|
let visibleVariantTokens = $derived((v: Variant) => withLinkedDisabled(variantTokens(v), linked.varSet));
|
|
74
|
-
|
|
75
|
-
let bgMode: 'image' | 'color' = $state('image');
|
|
76
|
-
const bgVar = '--backdrop-badge-surface';
|
|
77
|
-
|
|
78
|
-
// Preview-only props for Badge's floating/anchor/flush features (not persisted).
|
|
79
|
-
// For corner-anchored use, prefer the dedicated CornerBadge component; Badge.floating
|
|
80
|
-
// is the low-level escape hatch for off-corner floating placements.
|
|
81
|
-
let floating: boolean = $state(false);
|
|
82
|
-
let flush: boolean = $state(false);
|
|
83
|
-
let anchor: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' = $state('bottom-right');
|
|
84
|
-
const anchorOptions = [
|
|
85
|
-
{ value: 'top-left' as const, label: 'TL' },
|
|
86
|
-
{ value: 'top-right' as const, label: 'TR' },
|
|
87
|
-
{ value: 'bottom-left' as const, label: 'BL' },
|
|
88
|
-
{ value: 'bottom-right' as const, label: 'BR' },
|
|
89
|
-
];
|
|
90
71
|
</script>
|
|
91
72
|
|
|
92
|
-
<ComponentEditorBase {component} title="Badge" description="Pill-shaped badges with color variants.
|
|
93
|
-
{#snippet config()}
|
|
94
|
-
|
|
95
|
-
<ShadowBackdropControls bind:mode={bgMode} colorVariable={bgVar} />
|
|
96
|
-
<label class="float-toggle">
|
|
97
|
-
<input type="checkbox" bind:checked={floating} />
|
|
98
|
-
<span>Floating preview</span>
|
|
99
|
-
</label>
|
|
100
|
-
{#if floating}
|
|
101
|
-
<label class="float-toggle">
|
|
102
|
-
<input type="checkbox" bind:checked={flush} />
|
|
103
|
-
<span>Flush corner</span>
|
|
104
|
-
</label>
|
|
105
|
-
<div class="anchor-control">
|
|
106
|
-
<span>Anchor</span>
|
|
107
|
-
<UIRadioGroup bind:value={anchor} name="badge-anchor" options={anchorOptions} />
|
|
108
|
-
</div>
|
|
109
|
-
{/if}
|
|
110
|
-
|
|
111
|
-
{/snippet}
|
|
73
|
+
<ComponentEditorBase {component} title="Badge" description="Pill-shaped badges with color variants." tokens={allTokens} {linked} variants={variantOptions}>
|
|
112
74
|
{#each variants as v}
|
|
113
75
|
<VariantGroup
|
|
114
76
|
name={v}
|
|
@@ -118,18 +80,10 @@
|
|
|
118
80
|
{component}
|
|
119
81
|
siblings={buildSiblings(variants, v, (sv) => ({ [sv]: variantTokens(sv) }), (sv) => ({ [sv]: variantTypeGroups(sv) }))}
|
|
120
82
|
>
|
|
121
|
-
<
|
|
122
|
-
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</div>
|
|
126
|
-
{:else}
|
|
127
|
-
<div class="badge-showcase-grid">
|
|
128
|
-
<Badge variant={v}>{v.charAt(0).toUpperCase() + v.slice(1)}</Badge>
|
|
129
|
-
<Badge variant={v} icon="fa-solid fa-dice-d20">With Icon</Badge>
|
|
130
|
-
</div>
|
|
131
|
-
{/if}
|
|
132
|
-
</ShadowBackdrop>
|
|
83
|
+
<div class="badge-showcase-grid">
|
|
84
|
+
<Badge variant={v}>{v.charAt(0).toUpperCase() + v.slice(1)}</Badge>
|
|
85
|
+
<Badge variant={v} icon="fa-solid fa-dice-d20">With Icon</Badge>
|
|
86
|
+
</div>
|
|
133
87
|
</VariantGroup>
|
|
134
88
|
{/each}
|
|
135
89
|
</ComponentEditorBase>
|
|
@@ -141,32 +95,4 @@
|
|
|
141
95
|
gap: var(--space-8);
|
|
142
96
|
align-items: center;
|
|
143
97
|
}
|
|
144
|
-
|
|
145
|
-
/* Anchor parent for floating-preview mode — gives the badge a positioned ancestor
|
|
146
|
-
and a visible surface so blur/offset/flush are observable. */
|
|
147
|
-
.floating-stage {
|
|
148
|
-
position: relative;
|
|
149
|
-
width: 100%;
|
|
150
|
-
min-height: 160px;
|
|
151
|
-
border-radius: var(--ui-radius-md);
|
|
152
|
-
background: rgba(0, 0, 0, 0.15);
|
|
153
|
-
overflow: hidden;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.float-toggle {
|
|
157
|
-
display: inline-flex;
|
|
158
|
-
align-items: center;
|
|
159
|
-
gap: var(--ui-space-4);
|
|
160
|
-
font-size: var(--ui-font-size-sm);
|
|
161
|
-
color: var(--ui-text-secondary);
|
|
162
|
-
cursor: pointer;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.anchor-control {
|
|
166
|
-
display: inline-flex;
|
|
167
|
-
align-items: center;
|
|
168
|
-
gap: var(--ui-space-8);
|
|
169
|
-
font-size: var(--ui-font-size-sm);
|
|
170
|
-
color: var(--ui-text-secondary);
|
|
171
|
-
}
|
|
172
98
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { buildTypeGroupColorTokens } from './scaffolding/buildTypeGroupTokens';
|
|
3
3
|
import type { Token, TypeGroupConfig } from './scaffolding/types';
|
|
4
|
-
import { calloutVariants } from '
|
|
4
|
+
import { calloutVariants } from '../../system/components/Callout.svelte';
|
|
5
5
|
|
|
6
6
|
export const component = 'callout';
|
|
7
7
|
const variants = calloutVariants;
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
71
|
<script lang="ts">
|
|
72
|
-
import Callout from '
|
|
72
|
+
import Callout from '../../system/components/Callout.svelte';
|
|
73
73
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
74
74
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
75
|
-
import { editorState } from '../
|
|
75
|
+
import { editorState } from '../core/store/editorStore';
|
|
76
76
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
77
77
|
import { buildSiblings } from './scaffolding/siblings';
|
|
78
78
|
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
};
|
|
88
88
|
</script>
|
|
89
89
|
|
|
90
|
-
<ComponentEditorBase {component} title="Callout" description="Bordered callout box with semantic info / success / warning / danger variants, label + message text.
|
|
90
|
+
<ComponentEditorBase {component} title="Callout" description="Bordered callout box with semantic info / success / warning / danger variants, label + message text." tokens={allTokens} {linked} variants={variantOptions}>
|
|
91
91
|
{#each variants as v}
|
|
92
92
|
<VariantGroup
|
|
93
93
|
name={v}
|
|
@@ -4,41 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
export const component = 'card';
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
// Within each state we keep object shape props (surface/border/border-width/radius/padding/shadow) together.
|
|
9
|
-
// Title and body are nested elements with their own typography.
|
|
7
|
+
// Hover overrides only border + shadow; rest inherits default. `element` groups tokens by frame/header/body.
|
|
10
8
|
const states: Record<string, Token[]> = {
|
|
11
9
|
default: [
|
|
12
|
-
{ label: 'surface color', groupKey: 'surface', variable: '--card-default-surface' },
|
|
13
|
-
{ label: '
|
|
14
|
-
{ label: 'border
|
|
15
|
-
{ label: '
|
|
16
|
-
{ label: '
|
|
17
|
-
{ label: '
|
|
18
|
-
{ label: '
|
|
19
|
-
{ label: '
|
|
20
|
-
{ label: '
|
|
21
|
-
{ label: '
|
|
10
|
+
{ label: 'surface color', groupKey: 'surface', variable: '--card-default-surface', element: 'frame' },
|
|
11
|
+
{ label: 'border color', groupKey: 'border', variable: '--card-default-border', element: 'frame' },
|
|
12
|
+
{ label: 'border width', canBeLinked: true, groupKey: 'border-width', variable: '--card-default-border-width', element: 'frame' },
|
|
13
|
+
{ label: 'corner radius', canBeLinked: true, groupKey: 'radius', variable: '--card-default-radius', element: 'frame' },
|
|
14
|
+
{ label: 'card shadow', canBeLinked: true, groupKey: 'shadow', variable: '--card-default-shadow', element: 'frame' },
|
|
15
|
+
{ label: 'background blur', canBeLinked: true, groupKey: 'blur', variable: '--card-default-blur', element: 'frame' },
|
|
16
|
+
{ label: 'header color', groupKey: 'surface', variable: '--card-default-header-surface', element: 'header' },
|
|
17
|
+
{ label: 'header padding', canBeLinked: true, groupKey: 'header-padding', variable: '--card-default-header-padding', element: 'header' },
|
|
18
|
+
{ label: 'icon size', canBeLinked: true, groupKey: 'icon-size', variable: '--card-default-icon-size', element: 'header' },
|
|
19
|
+
{ label: 'body padding', canBeLinked: true, groupKey: 'body-padding', variable: '--card-default-body-padding', element: 'body' },
|
|
22
20
|
],
|
|
23
21
|
hover: [
|
|
24
|
-
{ label: 'surface color', groupKey: 'surface', variable: '--card-hover-surface' },
|
|
25
|
-
{ label: 'header color', groupKey: 'surface', variable: '--card-hover-header-surface' },
|
|
26
22
|
{ label: 'border color', groupKey: 'border', variable: '--card-hover-border' },
|
|
27
|
-
{ label: 'border width', canBeLinked: true, groupKey: 'border-width', variable: '--card-hover-border-width' },
|
|
28
|
-
{ label: 'corner radius', canBeLinked: true, groupKey: 'radius', variable: '--card-hover-radius' },
|
|
29
|
-
{ label: 'header padding', canBeLinked: true, groupKey: 'header-padding', variable: '--card-hover-header-padding' },
|
|
30
|
-
{ label: 'body padding', canBeLinked: true, groupKey: 'body-padding', variable: '--card-hover-body-padding' },
|
|
31
23
|
{ label: 'card shadow', canBeLinked: true, groupKey: 'shadow', variable: '--card-hover-shadow' },
|
|
32
|
-
{ label: 'background blur', canBeLinked: true, groupKey: 'blur', variable: '--card-hover-blur' },
|
|
33
|
-
{ label: 'icon size', canBeLinked: true, groupKey: 'icon-size', variable: '--card-hover-icon-size' },
|
|
34
24
|
],
|
|
35
25
|
};
|
|
36
26
|
|
|
37
|
-
//
|
|
27
|
+
// Typography shared across states (no hover overrides).
|
|
38
28
|
const typeGroups: Record<string, TypeGroupConfig[]> = {
|
|
39
29
|
default: [
|
|
40
30
|
{
|
|
41
|
-
legend: '
|
|
31
|
+
legend: 'title',
|
|
32
|
+
element: 'header',
|
|
42
33
|
colorVariable: '--card-default-title',
|
|
43
34
|
familyVariable: '--card-default-title-font-family',
|
|
44
35
|
sizeVariable: '--card-default-title-font-size',
|
|
@@ -46,7 +37,8 @@
|
|
|
46
37
|
lineHeightVariable: '--card-default-title-line-height',
|
|
47
38
|
},
|
|
48
39
|
{
|
|
49
|
-
legend: '
|
|
40
|
+
legend: 'body',
|
|
41
|
+
element: 'body',
|
|
50
42
|
colorVariable: '--card-default-body',
|
|
51
43
|
familyVariable: '--card-default-body-font-family',
|
|
52
44
|
sizeVariable: '--card-default-body-font-size',
|
|
@@ -54,46 +46,19 @@
|
|
|
54
46
|
lineHeightVariable: '--card-default-body-line-height',
|
|
55
47
|
},
|
|
56
48
|
],
|
|
57
|
-
hover: [
|
|
58
|
-
{
|
|
59
|
-
legend: 'card title',
|
|
60
|
-
colorVariable: '--card-hover-title',
|
|
61
|
-
familyVariable: '--card-hover-title-font-family',
|
|
62
|
-
sizeVariable: '--card-hover-title-font-size',
|
|
63
|
-
weightVariable: '--card-hover-title-font-weight',
|
|
64
|
-
lineHeightVariable: '--card-hover-title-line-height',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
legend: 'card body',
|
|
68
|
-
colorVariable: '--card-hover-body',
|
|
69
|
-
familyVariable: '--card-hover-body-font-family',
|
|
70
|
-
sizeVariable: '--card-hover-body-font-size',
|
|
71
|
-
weightVariable: '--card-hover-body-font-weight',
|
|
72
|
-
lineHeightVariable: '--card-hover-body-line-height',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
49
|
};
|
|
76
50
|
|
|
77
|
-
// Title type tokens (linked across states, but title and body are different objects so they don't link to each other).
|
|
78
51
|
const typeGroupTokens: Token[] = [
|
|
79
52
|
{ label: 'font family', canBeLinked: true, groupKey: 'title-font-family', variable: '--card-default-title-font-family' },
|
|
80
|
-
{ label: 'font family', canBeLinked: true, groupKey: 'title-font-family', variable: '--card-hover-title-font-family' },
|
|
81
53
|
{ label: 'font size', canBeLinked: true, groupKey: 'title-font-size', variable: '--card-default-title-font-size' },
|
|
82
|
-
{ label: 'font size', canBeLinked: true, groupKey: 'title-font-size', variable: '--card-hover-title-font-size' },
|
|
83
54
|
{ label: 'font weight', canBeLinked: true, groupKey: 'title-font-weight', variable: '--card-default-title-font-weight' },
|
|
84
|
-
{ label: 'font weight', canBeLinked: true, groupKey: 'title-font-weight', variable: '--card-hover-title-font-weight' },
|
|
85
55
|
{ label: 'line height', canBeLinked: true, groupKey: 'title-line-height', variable: '--card-default-title-line-height' },
|
|
86
|
-
{ label: 'line height', canBeLinked: true, groupKey: 'title-line-height', variable: '--card-hover-title-line-height' },
|
|
87
56
|
{ label: 'font family', canBeLinked: true, groupKey: 'body-font-family', variable: '--card-default-body-font-family' },
|
|
88
|
-
{ label: 'font family', canBeLinked: true, groupKey: 'body-font-family', variable: '--card-hover-body-font-family' },
|
|
89
57
|
{ label: 'font size', canBeLinked: true, groupKey: 'body-font-size', variable: '--card-default-body-font-size' },
|
|
90
|
-
{ label: 'font size', canBeLinked: true, groupKey: 'body-font-size', variable: '--card-hover-body-font-size' },
|
|
91
58
|
{ label: 'font weight', canBeLinked: true, groupKey: 'body-font-weight', variable: '--card-default-body-font-weight' },
|
|
92
|
-
{ label: 'font weight', canBeLinked: true, groupKey: 'body-font-weight', variable: '--card-hover-body-font-weight' },
|
|
93
59
|
{ label: 'line height', canBeLinked: true, groupKey: 'body-line-height', variable: '--card-default-body-line-height' },
|
|
94
|
-
{ label: 'line height', canBeLinked: true, groupKey: 'body-line-height', variable: '--card-hover-body-line-height' },
|
|
95
60
|
];
|
|
96
|
-
// Cross-state linked block
|
|
61
|
+
// Cross-state linked block; linkable props sourced from default state.
|
|
97
62
|
const linkableContexts = new Map<string, string>([
|
|
98
63
|
['--card-default-border-width', 'card'],
|
|
99
64
|
['--card-default-radius', 'card'],
|
|
@@ -119,14 +84,11 @@
|
|
|
119
84
|
</script>
|
|
120
85
|
|
|
121
86
|
<script lang="ts">
|
|
122
|
-
import Card from '
|
|
87
|
+
import Card from '../../system/components/Card.svelte';
|
|
123
88
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
124
89
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
125
|
-
import { editorState } from '../
|
|
90
|
+
import { editorState } from '../core/store/editorStore';
|
|
126
91
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
127
|
-
import ShadowBackdrop from './scaffolding/ShadowBackdrop.svelte';
|
|
128
|
-
import ShadowBackdropControls from './scaffolding/ShadowBackdropControls.svelte';
|
|
129
|
-
|
|
130
92
|
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
131
93
|
|
|
132
94
|
let visibleStates = $derived(Object.fromEntries(
|
|
@@ -134,23 +96,15 @@
|
|
|
134
96
|
) as Record<string, Token[]>);
|
|
135
97
|
|
|
136
98
|
let hoverEnabled = $state(true);
|
|
137
|
-
let bgMode: 'image' | 'color' = $state('image');
|
|
138
|
-
const bgVar = '--backdrop-card-surface';
|
|
139
99
|
</script>
|
|
140
100
|
|
|
141
|
-
<ComponentEditorBase {component} title="Card" description="Generic card with icon, title, and slotted body.
|
|
142
|
-
{#snippet config()}
|
|
143
|
-
|
|
144
|
-
<ShadowBackdropControls bind:mode={bgMode} colorVariable={bgVar} />
|
|
145
|
-
|
|
146
|
-
{/snippet}
|
|
101
|
+
<ComponentEditorBase {component} title="Card" description="Generic card with icon, title, and slotted body." tokens={allTokens} {linked}>
|
|
147
102
|
<VariantGroup
|
|
148
103
|
name="card"
|
|
149
104
|
title="Card"
|
|
150
105
|
states={visibleStates}
|
|
151
106
|
{typeGroups}
|
|
152
107
|
{component}
|
|
153
|
-
|
|
154
108
|
>
|
|
155
109
|
{#snippet stateActions(stateName)}
|
|
156
110
|
{#if stateName === 'hover'}
|
|
@@ -161,16 +115,14 @@
|
|
|
161
115
|
{/if}
|
|
162
116
|
{/snippet}
|
|
163
117
|
{#snippet children({ activeState })}
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{/snippet}
|
|
173
|
-
</VariantGroup>
|
|
118
|
+
{@const previewClass = activeState === 'hover' ? 'force-hover' : (hoverEnabled ? '' : 'no-hover')}
|
|
119
|
+
<div class="card-demo">
|
|
120
|
+
<Card title="Card title" class={previewClass}>
|
|
121
|
+
<p style="margin: 0;">Slotted body content. Hover the card (or switch the editor to the Hover state) to preview hover styling.</p>
|
|
122
|
+
</Card>
|
|
123
|
+
</div>
|
|
124
|
+
{/snippet}
|
|
125
|
+
</VariantGroup>
|
|
174
126
|
</ComponentEditorBase>
|
|
175
127
|
|
|
176
128
|
<style>
|
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
const VARIANTS = ['chromeless', 'divider', 'container'] as const;
|
|
8
8
|
type Variant = typeof VARIANTS[number];
|
|
9
|
+
// CSS-layer state names (used in the var names) vs UI-layer labels (shown in
|
|
10
|
+
// the editor). The CSS keeps the historical `active` slug for compatibility;
|
|
11
|
+
// the UI surfaces it as "Current" because users read `:active` as click-press.
|
|
9
12
|
const HEADER_STATES = ['default', 'hover', 'active'] as const;
|
|
10
13
|
type HeaderState = typeof HEADER_STATES[number];
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const HEADER_STATE_LABELS: Record<HeaderState, string> = {
|
|
15
|
+
default: 'Default',
|
|
16
|
+
hover: 'Hover',
|
|
17
|
+
active: 'Current',
|
|
18
|
+
};
|
|
15
19
|
|
|
16
20
|
const VARIANT_LABELS: Record<Variant, string> = {
|
|
17
21
|
chromeless: 'Chromeless',
|
|
@@ -21,7 +25,7 @@
|
|
|
21
25
|
|
|
22
26
|
// Header tokens per variant. Chromeless has no chrome; divider exposes the
|
|
23
27
|
// bottom-border (the divider line) per state; container's outer chrome lives
|
|
24
|
-
// in
|
|
28
|
+
// in the Container part so the header strip just owns surface + padding + text.
|
|
25
29
|
function headerStateTokens(v: Variant, s: HeaderState): Token[] {
|
|
26
30
|
const p = `--collapsiblesection-${v}-${s}`;
|
|
27
31
|
const base: Token[] = [
|
|
@@ -39,17 +43,17 @@
|
|
|
39
43
|
return base;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
// Container
|
|
43
|
-
const
|
|
44
|
-
{ label: 'surface color', groupKey: 'surface', variable: '--collapsiblesection-container-frame-surface' },
|
|
46
|
+
// Container part: the always-on outer chrome of the Container variant only.
|
|
47
|
+
const containerPartTokens: Token[] = [
|
|
45
48
|
{ label: 'border color', groupKey: 'border', variable: '--collapsiblesection-container-frame-border' },
|
|
46
49
|
{ label: 'border width', canBeLinked: true, groupKey: 'border-width', variable: '--collapsiblesection-container-frame-border-width' },
|
|
47
50
|
{ label: 'corner radius', canBeLinked: true, groupKey: 'radius', variable: '--collapsiblesection-container-frame-radius' },
|
|
48
51
|
];
|
|
49
52
|
|
|
50
|
-
//
|
|
51
|
-
// its own surface so the
|
|
52
|
-
|
|
53
|
+
// Body: revealed content area. Chromeless/divider only own padding; container
|
|
54
|
+
// also paints its own surface so the body can read distinct from the header.
|
|
55
|
+
// (CSS var name keeps the `expanded` slug for backward compatibility.)
|
|
56
|
+
function bodyTokens(v: Variant): Token[] {
|
|
53
57
|
const p = `--collapsiblesection-${v}-expanded`;
|
|
54
58
|
const tokens: Token[] = [];
|
|
55
59
|
if (v === 'container') tokens.push({ label: 'surface color', groupKey: 'surface', variable: `${p}-surface` });
|
|
@@ -57,21 +61,24 @@
|
|
|
57
61
|
return tokens;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
64
|
+
// Two-tier "Element / State" key convention. VariantGroup detects the " / "
|
|
65
|
+
// separator and renders a parts strip on top with a state sub-strip beneath
|
|
66
|
+
// when the active part has interaction states. Parts:
|
|
67
|
+
// - Container: outer chrome (container variant only) — no sub-states
|
|
68
|
+
// - Header: the always-visible bar — has Default/Hover/Current states
|
|
69
|
+
// - Body: the revealed content panel — no sub-states
|
|
63
70
|
function variantStates(v: Variant): Record<string, Token[]> {
|
|
64
71
|
const out: Record<string, Token[]> = {};
|
|
65
|
-
if (v === 'container') out
|
|
66
|
-
for (const s of HEADER_STATES) out[s] = headerStateTokens(v, s);
|
|
67
|
-
out
|
|
72
|
+
if (v === 'container') out['Container'] = containerPartTokens;
|
|
73
|
+
for (const s of HEADER_STATES) out[`Header / ${HEADER_STATE_LABELS[s]}`] = headerStateTokens(v, s);
|
|
74
|
+
out['Body'] = bodyTokens(v);
|
|
68
75
|
return out;
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
// Label typography only attaches to header states;
|
|
72
|
-
// own text.
|
|
78
|
+
// Label typography only attaches to header states; Container and Body don't
|
|
79
|
+
// own text. Keys match the corresponding entries in `variantStates`.
|
|
73
80
|
function variantTypeGroups(v: Variant): Record<string, TypeGroupConfig[]> {
|
|
74
|
-
return Object.fromEntries(HEADER_STATES.map((s) => [s
|
|
81
|
+
return Object.fromEntries(HEADER_STATES.map((s) => [`Header / ${HEADER_STATE_LABELS[s]}`, [{
|
|
75
82
|
legend: 'label',
|
|
76
83
|
colorVariable: `--collapsiblesection-${v}-${s}-label`,
|
|
77
84
|
familyVariable: `--collapsiblesection-${v}-${s}-label-font-family`,
|
|
@@ -118,11 +125,11 @@
|
|
|
118
125
|
</script>
|
|
119
126
|
|
|
120
127
|
<script lang="ts">
|
|
121
|
-
import CollapsibleSection from '
|
|
128
|
+
import CollapsibleSection from '../../system/components/CollapsibleSection.svelte';
|
|
122
129
|
import VariantGroup from './scaffolding/VariantGroup.svelte';
|
|
123
130
|
import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
|
|
124
131
|
import { buildSiblings } from './scaffolding/siblings';
|
|
125
|
-
import { editorState } from '../
|
|
132
|
+
import { editorState } from '../core/store/editorStore';
|
|
126
133
|
import { computeLinkedBlock, withLinkedDisabled } from './scaffolding/linkedBlock';
|
|
127
134
|
|
|
128
135
|
let linked = $derived(computeLinkedBlock(component, linkableContexts, allTokens, $editorState));
|
|
@@ -132,7 +139,7 @@
|
|
|
132
139
|
) as Record<string, Token[]>);
|
|
133
140
|
</script>
|
|
134
141
|
|
|
135
|
-
<ComponentEditorBase {component} title="Collapsible Section" description="Expandable section with chevron toggle. Variants: chromeless, divider, container.
|
|
142
|
+
<ComponentEditorBase {component} title="Collapsible Section" description="Expandable section with chevron toggle. Variants: chromeless, divider, container." tokens={allTokens} {linked} variants={variantOptions}>
|
|
136
143
|
{#each VARIANTS as v}
|
|
137
144
|
<VariantGroup
|
|
138
145
|
name={v}
|
|
@@ -144,20 +151,20 @@
|
|
|
144
151
|
|
|
145
152
|
>
|
|
146
153
|
{#snippet children({ activeState })}
|
|
147
|
-
|
|
148
|
-
{@const
|
|
149
|
-
{@const forceClass = activeState === '
|
|
150
|
-
{@const forceActive = activeState === '
|
|
154
|
+
{@const isContainerPart = activeState === 'Container'}
|
|
155
|
+
{@const isBody = activeState === 'Body'}
|
|
156
|
+
{@const forceClass = activeState === 'Header / Hover' ? 'force-hover' : ''}
|
|
157
|
+
{@const forceActive = activeState === 'Header / Current'}
|
|
151
158
|
<CollapsibleSection
|
|
152
159
|
variant={v}
|
|
153
160
|
label="Click to expand"
|
|
154
|
-
expanded={
|
|
161
|
+
expanded={isBody}
|
|
155
162
|
active={forceActive}
|
|
156
163
|
class={forceClass}
|
|
157
164
|
>
|
|
158
165
|
<p style="margin: 0; color: var(--text-secondary);">
|
|
159
|
-
{#if
|
|
160
|
-
(
|
|
166
|
+
{#if isContainerPart}
|
|
167
|
+
(Container) — outer chrome only; switch to Body to see the content area.
|
|
161
168
|
{:else}
|
|
162
169
|
This content is revealed when the section is expanded. Any content can go here.
|
|
163
170
|
{/if}
|