@motion-proto/live-tokens 0.7.1 → 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.
Files changed (85) hide show
  1. package/dist-plugin/index.cjs +707 -90
  2. package/dist-plugin/index.d.cts +1 -0
  3. package/dist-plugin/index.d.ts +1 -0
  4. package/dist-plugin/index.js +707 -90
  5. package/package.json +2 -1
  6. package/src/app/site.css +1 -1
  7. package/src/editor/component-editor/CollapsibleSectionEditor.svelte +34 -27
  8. package/src/editor/component-editor/DialogEditor.svelte +4 -4
  9. package/src/editor/component-editor/NotificationEditor.svelte +3 -1
  10. package/src/editor/component-editor/SectionDividerEditor.svelte +439 -112
  11. package/src/editor/component-editor/StandardButtonsEditor.svelte +13 -1
  12. package/src/editor/component-editor/editors.d.ts +10 -0
  13. package/src/editor/component-editor/scaffolding/AngleDial.svelte +52 -13
  14. package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +10 -11
  15. package/src/editor/component-editor/scaffolding/LinkedBlock.svelte +0 -1
  16. package/src/editor/component-editor/scaffolding/RadialShapePad.svelte +483 -0
  17. package/src/editor/component-editor/scaffolding/ShadowBackdrop.svelte +15 -2
  18. package/src/editor/component-editor/scaffolding/StateBlock.svelte +103 -15
  19. package/src/editor/component-editor/scaffolding/TokenLayout.svelte +9 -6
  20. package/src/editor/component-editor/scaffolding/TypeEditor.svelte +13 -1
  21. package/src/editor/component-editor/scaffolding/VariantGroup.svelte +239 -25
  22. package/src/editor/component-editor/scaffolding/buildTypeGroupTokens.ts +1 -0
  23. package/src/editor/component-editor/scaffolding/types.ts +11 -0
  24. package/src/editor/core/components/componentConfigKeys.ts +8 -0
  25. package/src/editor/core/components/componentConfigService.ts +2 -2
  26. package/src/editor/core/components/componentPersist.ts +7 -5
  27. package/src/editor/core/manifests/manifestService.ts +58 -3
  28. package/src/editor/core/palettes/familySwap.ts +99 -0
  29. package/src/editor/core/palettes/paletteDerivation.ts +69 -0
  30. package/src/editor/core/palettes/tokenRegistry.ts +4 -1
  31. package/src/editor/core/store/editorStore.ts +206 -12
  32. package/src/editor/core/store/editorTypes.ts +55 -12
  33. package/src/editor/core/store/gradientSource.ts +192 -0
  34. package/src/editor/core/themes/migrations/2026-05-19-collapsiblesection-drop-frame-surface.ts +28 -0
  35. package/src/editor/core/themes/migrations/2026-05-19-sectiondivider-rich-gradient.ts +35 -0
  36. package/src/editor/core/themes/migrations/2026-05-20-sectiondivider-slim-variants.ts +82 -0
  37. package/src/editor/core/themes/migrations/2026-05-21-sectiondivider-spacing-to-padding.ts +24 -0
  38. package/src/editor/core/themes/migrations/2026-05-22-sectiondivider-intrinsics-to-css.ts +81 -0
  39. package/src/editor/core/themes/migrations/index.ts +10 -0
  40. package/src/editor/core/themes/slices/components.ts +18 -4
  41. package/src/editor/core/themes/slices/gradients.ts +88 -13
  42. package/src/editor/core/themes/themeInit.ts +2 -2
  43. package/src/editor/core/themes/themeTypes.ts +56 -1
  44. package/src/editor/overlay/ColumnsOverlay.svelte +0 -1
  45. package/src/editor/overlay/LiveEditorOverlay.svelte +1 -4
  46. package/src/editor/styles/ui-editor.css +1 -0
  47. package/src/editor/styles/ui-form-controls.css +19 -20
  48. package/src/editor/ui/BezierCurveEditor.svelte +114 -63
  49. package/src/editor/ui/EditorViewSwitcher.svelte +0 -1
  50. package/src/editor/ui/FileLoadList.svelte +22 -5
  51. package/src/editor/ui/FontStackEditor.svelte +214 -76
  52. package/src/editor/ui/GradientEditor.svelte +435 -215
  53. package/src/editor/ui/GradientStopPicker.svelte +11 -3
  54. package/src/editor/ui/ManifestFileManager.svelte +71 -4
  55. package/src/editor/ui/PaletteEditor.svelte +52 -79
  56. package/src/editor/ui/ProjectFontsSection.svelte +328 -293
  57. package/src/editor/ui/ThemeFileManager.svelte +0 -4
  58. package/src/editor/ui/UIFontFamilySelector.svelte +0 -1
  59. package/src/editor/ui/UIFontSizeSelector.svelte +3 -0
  60. package/src/editor/ui/UIInfoPopover.svelte +0 -1
  61. package/src/editor/ui/UILetterSpacingSelector.svelte +65 -0
  62. package/src/editor/ui/UIPaletteSelector.svelte +31 -4
  63. package/src/editor/ui/UIPillButton.svelte +33 -3
  64. package/src/editor/ui/UISegmentedControl.svelte +114 -0
  65. package/src/editor/ui/UITokenSelector.svelte +4 -1
  66. package/src/editor/ui/VariablesTab.svelte +41 -35
  67. package/src/editor/ui/palette/OverridesPanel.svelte +14 -37
  68. package/src/editor/ui/palette/PaletteBase.svelte +3 -3
  69. package/src/editor/ui/sections/ColumnsSection.svelte +1 -2
  70. package/src/editor/ui/sections/GradientsSection.svelte +1 -1
  71. package/src/editor/ui/sections/OverlaysSection.svelte +1 -1
  72. package/src/editor/ui/sections/ShadowsSection.svelte +1 -1
  73. package/src/system/components/Button.svelte +2 -2
  74. package/src/system/components/Card.svelte +29 -1
  75. package/src/system/components/CollapsibleSection.svelte +25 -2
  76. package/src/system/components/FloatingTokenTags.css +43 -24
  77. package/src/system/components/FloatingTokenTags.svelte +88 -137
  78. package/src/system/components/Notification.svelte +8 -1
  79. package/src/system/components/SectionDivider.svelte +456 -379
  80. package/src/system/styles/CONVENTIONS.md +1 -1
  81. package/src/system/styles/fonts.css +3 -16
  82. package/src/system/styles/tokens.css +356 -1199
  83. package/src/system/styles/tokens.generated.css +544 -0
  84. package/src/editor/component-editor/scaffolding/DividerEditor.svelte +0 -94
  85. package/src/editor/component-editor/scaffolding/GradientCard.svelte +0 -296
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motion-proto/live-tokens",
3
- "version": "0.7.1",
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": [
@@ -64,6 +64,7 @@
64
64
  },
65
65
  "./styles/ui-editor.css": "./src/editor/styles/ui-editor.css",
66
66
  "./app/tokens.css": "./src/system/styles/tokens.css",
67
+ "./app/tokens.generated.css": "./src/system/styles/tokens.generated.css",
67
68
  "./app/site.css": "./src/app/site.css",
68
69
  "./app/fonts.css": "./src/system/styles/fonts.css"
69
70
  },
package/src/app/site.css CHANGED
@@ -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: 0.01em;
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;
@@ -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
- function capitalize(s: string): string {
13
- return s.charAt(0).toUpperCase() + s.slice(1);
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 `frame` so the header strip itself just owns surface + padding + text.
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 has a single Frame ruleset for the always-on outer chrome.
43
- const frameTokens: Token[] = [
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
- // Expanded panel: chromeless/divider only own padding; container also paints
51
- // its own surface so the content area can read distinct from the header strip.
52
- function expandedTokens(v: Variant): Token[] {
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
- // Single per-variant state map: frame (container only), default/hover/active,
61
- // expanded. State-tab strip inside the VariantGroup walks this sequence so the
62
- // user moves through the whole variant from one tabbed surface.
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.frame = frameTokens;
66
- for (const s of HEADER_STATES) out[s] = headerStateTokens(v, s);
67
- out.expanded = expandedTokens(v);
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; frame and expanded don't
72
- // own text. VariantGroup tolerates a partial map.
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`,
@@ -144,20 +151,20 @@
144
151
 
145
152
  >
146
153
  {#snippet children({ activeState })}
147
- {@const isExpanded = activeState === 'expanded'}
148
- {@const isFrame = activeState === 'frame'}
149
- {@const forceClass = activeState === 'hover' ? 'force-hover' : ''}
150
- {@const forceActive = activeState === 'active'}
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={isExpanded}
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 isFrame}
160
- (Frame) — outer chrome only; expand the section to see content area styling.
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}
@@ -166,10 +166,10 @@
166
166
 
167
167
  :global(.ui-form-select.compact) {
168
168
  min-height: 1.75rem;
169
- padding: 0 var(--ui-space-8) !important;
170
- padding-right: var(--ui-space-24) !important;
171
- background-color: var(--ui-surface-low) !important;
172
- background-position: right var(--ui-space-8) center !important;
169
+ padding: 0 var(--ui-space-8);
170
+ padding-right: var(--ui-space-24);
171
+ background-color: var(--ui-surface-low);
172
+ background-position: right var(--ui-space-8) center;
173
173
  font-size: var(--ui-font-size-sm);
174
174
  width: 100%;
175
175
  }
@@ -6,10 +6,12 @@
6
6
  const variants = ['info', 'success', 'warning', 'danger'] as const;
7
7
  type Variant = typeof variants[number];
8
8
 
9
- // Per variant: notification frame (surface, border, border-width, radius, padding) + icon (color, size).
9
+ // Per variant: notification frame (surface, border, border-width, radius, padding) + icon (color, size)
10
+ // + action backdrop surface (paints behind the optional header action button).
10
11
  function variantTokens(v: Variant): Token[] {
11
12
  return [
12
13
  { label: 'surface color', groupKey: 'surface', variable: `--notification-${v}-surface` },
14
+ { label: 'action surface', groupKey: 'action-surface', variable: `--notification-${v}-action-surface` },
13
15
  { label: 'border color', groupKey: 'border', variable: `--notification-${v}-border` },
14
16
  { label: 'border width', canBeLinked: true, groupKey: 'border-width', variable: `--notification-${v}-border-width` },
15
17
  { label: 'corner radius', canBeLinked: true, groupKey: 'radius', variable: `--notification-${v}-radius` },