@motion-proto/live-tokens 0.50.0 → 0.53.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 (91) hide show
  1. package/.claude/skills/live-tokens-adjust-shape-space/SKILL.md +7 -1
  2. package/CHANGELOG.md +108 -0
  3. package/bin/adjust.mjs +16 -39
  4. package/bin/generate-theme.mjs +20 -6
  5. package/dist-plugin/adjust/index.cjs +781 -21
  6. package/dist-plugin/adjust/index.d.cts +2 -1
  7. package/dist-plugin/adjust/index.d.ts +2 -1
  8. package/dist-plugin/adjust/index.js +43 -21
  9. package/dist-plugin/{chunk-6OZFXIQI.js → chunk-232GZGQU.js} +207 -12
  10. package/dist-plugin/chunk-NE6N66EE.js +753 -0
  11. package/dist-plugin/{chunk-76TFDTJO.js → chunk-PB2JTK2H.js} +179 -128
  12. package/dist-plugin/{chunk-44RSTAII.js → chunk-TKZBVIW5.js} +33 -5
  13. package/dist-plugin/chunk-YR6GPXW2.js +129 -0
  14. package/dist-plugin/generateColorsAndType/index.cjs +135 -63
  15. package/dist-plugin/generateColorsAndType/index.d.cts +2 -1
  16. package/dist-plugin/generateColorsAndType/index.d.ts +2 -1
  17. package/dist-plugin/generateColorsAndType/index.js +28 -784
  18. package/dist-plugin/{themeTypes-DSwKq-bj.d.ts → index-DpTIRZ2H.d.cts} +67 -26
  19. package/dist-plugin/{themeTypes-DSwKq-bj.d.cts → index-DpTIRZ2H.d.ts} +67 -26
  20. package/dist-plugin/index.cjs +1254 -140
  21. package/dist-plugin/index.js +106 -82
  22. package/dist-plugin/migrateData/index.cjs +956 -14
  23. package/dist-plugin/migrateData/index.js +10 -3
  24. package/dist-plugin/tokensCssMigrations/index.cjs +71 -5
  25. package/dist-plugin/tokensCssMigrations/index.d.cts +20 -9
  26. package/dist-plugin/tokensCssMigrations/index.d.ts +20 -9
  27. package/dist-plugin/tokensCssMigrations/index.js +4 -1
  28. package/package.json +8 -4
  29. package/src/editor/component-editor/NotificationEditor.svelte +6 -0
  30. package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +9 -23
  31. package/src/editor/component-editor/scaffolding/LinkedBlock.svelte +8 -8
  32. package/src/editor/core/components/adjustAliases.ts +49 -22
  33. package/src/editor/core/components/aliasKinds.ts +7 -2
  34. package/src/editor/core/components/componentConfigService.ts +1 -1
  35. package/src/editor/core/palettes/oklch.ts +3 -137
  36. package/src/editor/core/palettes/paletteDerivation.ts +79 -37
  37. package/src/editor/core/store/editorStore.ts +7 -197
  38. package/src/editor/core/store/editorTypes.ts +9 -30
  39. package/src/editor/core/themes/generateColorsAndType.ts +18 -8
  40. package/src/editor/core/themes/lookSummary.ts +3 -25
  41. package/src/editor/core/themes/migrateComponentConfig.ts +205 -0
  42. package/src/editor/core/themes/migrations/2026-05-19-sectiondivider-rich-gradient.ts +1 -1
  43. package/src/editor/core/themes/migrations/2026-05-20-sectiondivider-slim-variants.ts +1 -1
  44. package/src/editor/core/themes/migrations/2026-05-22-sectiondivider-intrinsics-to-css.ts +1 -1
  45. package/src/editor/core/themes/parsers/gradient.ts +211 -0
  46. package/src/editor/core/themes/slices/gradients.ts +5 -58
  47. package/src/editor/core/themes/themeService.ts +22 -9
  48. package/src/editor/core/themes/themeTypes.ts +89 -27
  49. package/src/editor/docs/content/editing-tokens.md +6 -2
  50. package/src/editor/docs/content/themes-workflow.md +9 -11
  51. package/src/editor/docs/content/where-themes-live.md +2 -2
  52. package/src/editor/docs/content.generated.ts +3 -3
  53. package/src/editor/index.ts +1 -0
  54. package/src/editor/styles/ui-editor.css +5 -2
  55. package/src/editor/ui/BezierCurveEditor.svelte +90 -67
  56. package/src/editor/ui/PaletteEditor.svelte +180 -59
  57. package/src/editor/ui/ThemePanel.svelte +24 -15
  58. package/src/editor/ui/Toggle.svelte +36 -24
  59. package/src/editor/ui/UIPillButton.svelte +1 -1
  60. package/src/editor/ui/UIReveal.svelte +47 -0
  61. package/src/editor/ui/UISquareButton.svelte +1 -1
  62. package/src/editor/ui/colors/ColorStory.svelte +12 -8
  63. package/src/editor/ui/colors/ColorsTab.svelte +4 -5
  64. package/src/editor/ui/curveEngine.ts +101 -21
  65. package/src/editor/ui/palette/OverridesPanel.svelte +23 -8
  66. package/src/editor/ui/palette/PaletteBase.svelte +17 -78
  67. package/src/editor/ui/palette/PaletteJumpButton.svelte +3 -3
  68. package/src/editor/ui/palette/ScaleCurveEditor.svelte +110 -20
  69. package/src/editor/ui/palette/curveSummary.ts +20 -0
  70. package/src/editor/ui/palette/dockMagnify.ts +5 -13
  71. package/src/editor/ui/palette/paletteMath.ts +7 -4
  72. package/src/live-tokens/data/colors-and-type/autumn.json +528 -528
  73. package/src/live-tokens/data/colors-and-type/default.json +247 -247
  74. package/src/live-tokens/data/colors-and-type/halloween.json +532 -532
  75. package/src/live-tokens/data/colors-and-type/midnight-study.json +538 -538
  76. package/src/live-tokens/data/colors-and-type/ocean.json +521 -521
  77. package/src/live-tokens/data/colors-and-type/royal-velvet.json +532 -532
  78. package/src/live-tokens/data/colors-and-type/spring-meadow.json +504 -504
  79. package/src/live-tokens/data/colors-and-type/sunset.json +531 -531
  80. package/src/live-tokens/data/themes/autumn.json +604 -568
  81. package/src/live-tokens/data/themes/halloween.json +584 -583
  82. package/src/live-tokens/data/themes/midnight-study.json +673 -605
  83. package/src/live-tokens/data/themes/ocean.json +597 -561
  84. package/src/live-tokens/data/themes/royal-velvet.json +574 -573
  85. package/src/live-tokens/data/themes/spring-meadow.json +590 -556
  86. package/src/live-tokens/data/themes/sunset.json +632 -571
  87. package/src/live-tokens/data/tokens.generated.css +282 -282
  88. package/src/system/components/FloatingTokenTags.css +0 -1
  89. package/src/system/internal/backgroundContrast.ts +7 -0
  90. package/src/system/internal/oklch.ts +189 -0
  91. package/src/system/styles/tokens.css +283 -283
@@ -4,9 +4,12 @@
4
4
  * (`--color-brand-500`); the renderer wraps them in `var(...)` so palette
5
5
  * edits flow through.
6
6
  */
7
- import type { EditorState, GradientToken, GradientTokenStop, GradientType, GradientAliasValue } from '../../store/editorTypes';
7
+ import type { EditorState, GradientToken, GradientTokenStop, GradientType } from '../../store/editorTypes';
8
8
  import type { GradientDiskToken } from '../themeTypes';
9
9
  import { mutate } from '../../store/editorCore';
10
+ import { formatGradientValue, formatGradientStops as formatStopList } from '../parsers/gradient';
11
+
12
+ export { formatGradientValue };
10
13
 
11
14
  export function makeDefaultGradients(): GradientToken[] {
12
15
  return [
@@ -70,67 +73,11 @@ export function loadGradientsFromFile(
70
73
  if (matches) next.gradients.tokens = structuredClone(gradients) as GradientToken[];
71
74
  }
72
75
 
73
- function formatGradientStop(s: GradientTokenStop): string {
74
- return `${formatGradientStopColor(s)} ${s.position}%`;
75
- }
76
-
77
76
  /** Stops portion only — used by the palette selector to materialize a
78
77
  * linear-gradient with a per-slot angle override while keeping the token's
79
78
  * stop list (and its `var(--color-…)` refs, which propagate palette edits). */
80
79
  export function formatGradientStops(t: GradientToken): string {
81
- return t.stops.map(formatGradientStop).join(', ');
82
- }
83
-
84
- /** Serialize a structured gradient value (theme token or component-owned)
85
- * into a CSS background declaration.
86
- * - `none` → `transparent` (no background paint).
87
- * - `solid` → the first stop's color (no gradient function).
88
- * - `linear` → `linear-gradient(<angle>, <stops>)`.
89
- * - `radial` → `radial-gradient(<shape> at <centerX>% 50%, <stops>)`.
90
- * centerX defaults to 50. Shape is `circle [radius]` when the
91
- * aspect ratio is 1 (or absent); for aspect ≠ 1 we emit
92
- * `ellipse rx ry` anchored to `radius || 100px`, area-preserved
93
- * so the R=1 boundary is continuous with the legacy circle. */
94
- export function formatGradientValue(v: GradientAliasValue): string {
95
- if (v.type === 'none') return 'transparent';
96
- if (v.type === 'solid') {
97
- const first = v.stops[0];
98
- if (!first) return 'transparent';
99
- return formatGradientStopColor(first);
100
- }
101
- const stops = v.stops.map(formatGradientStop).join(', ');
102
- if (v.type === 'linear') return `linear-gradient(${v.angle}deg, ${stops})`;
103
- const cx = v.centerX ?? 50;
104
- return `radial-gradient(${formatRadialShape(v)} at ${cx}% 50%, ${stops})`;
105
- }
106
-
107
- /** Default base radius (px) when the gradient has no explicit `radius` but
108
- * needs concrete dimensions to express its aspect ratio. Chosen as a
109
- * pleasant-looking mid-size that reads as a "soft glow" inside typical
110
- * component containers; the user can dial `radius` to override. */
111
- const DEFAULT_RADIAL_BASE_PX = 100;
112
-
113
- function formatRadialShape(v: GradientAliasValue): string {
114
- const ax = v.aspectX ?? 1;
115
- const ay = v.aspectY ?? 1;
116
- if (ax === 1 && ay === 1) {
117
- return v.radius && v.radius > 0 ? `circle ${v.radius}px` : 'circle';
118
- }
119
- const base = v.radius && v.radius > 0 ? v.radius : DEFAULT_RADIAL_BASE_PX;
120
- const rx = base * ax;
121
- const ry = base * ay;
122
- return `ellipse ${rx.toFixed(2)}px ${ry.toFixed(2)}px`;
123
- }
124
-
125
- /** Resolve a stop's color + opacity into a CSS color value without the
126
- * trailing `${position}%`. Shared by the gradient-stop formatter (which
127
- * appends the position) and the solid path (which doesn't). */
128
- function formatGradientStopColor(s: GradientTokenStop): string {
129
- const base = s.color.startsWith('--') ? `var(${s.color})` : s.color;
130
- const opacity = s.opacity ?? 100;
131
- return opacity >= 100
132
- ? base
133
- : `color-mix(in srgb, ${base} ${opacity}%, transparent)`;
80
+ return formatStopList(t.stops);
134
81
  }
135
82
 
136
83
  function formatGradient(t: GradientToken): string {
@@ -1,15 +1,19 @@
1
- import type { Theme, ThemeMeta, ThemeBundle, ColorsAndType, ComponentConfig } from './themeTypes';
1
+ import type { Theme, ThemeMeta, ThemeBundle, ColorsAndType, ComponentConfig, ThemeFillReport } from './themeTypes';
2
2
  import { versionedFileResource } from '../storage/files/versionedFileResourceClient';
3
3
  import { API_BASE } from '../storage/apiBase';
4
4
  import { liveMovedSinceBake } from '../productionPulse';
5
5
  import { listComponents, getActiveComponentConfig } from '../components/componentConfigService';
6
6
  import { getActiveColorsAndType } from './colorsAndTypeService';
7
7
  import { broadcastAppliedTheme, hydrateAppliedTheme } from './themeDocumentSync';
8
+ import { CURRENT_COMPONENT_SCHEMA_VERSION } from './migrations';
9
+ import { THEME_SCHEMA_VERSION } from './themeTypes';
10
+
11
+ export type { ThemeFillReport };
8
12
 
9
13
  /**
10
14
  * REST client for theme files, the documents of the editor. A theme carries a
11
15
  * whole look by value: the colors and type plus a config for every component
12
- * that is off its default. One theme is open (`themes/_active.json`) and one is
16
+ * this install has. One theme is open (`themes/_active.json`) and one is
13
17
  * published (`themes/_production.json`); the live look is the open theme plus
14
18
  * whatever the `_working` buffers hold over it.
15
19
  *
@@ -61,6 +65,9 @@ export interface ApplyThemeResult {
61
65
  componentConfigs: Record<string, ComponentConfig>;
62
66
  /** Components the theme carries data for that this install doesn't have. */
63
67
  skippedComponents: string[];
68
+ /** What the completeness fill (`normalizeTheme`) had to add to reach this
69
+ * theme, reported so the panel can name it. */
70
+ filled: ThemeFillReport;
64
71
  }
65
72
 
66
73
  /**
@@ -128,8 +135,9 @@ function withoutLiveMarkers<T extends { _fileName?: string; _source?: unknown }>
128
135
 
129
136
  /**
130
137
  * The look as it stands: the live colors and type plus the live config of
131
- * every component that sits off its default, all by value. Delta encoding — a
132
- * component absent from the map runs the local default, which stays canonical.
138
+ * every component this install has, all by value. A theme is a complete
139
+ * document (`docs/plans/theme-completeness.md`), so the capture carries every
140
+ * component, not just the ones off their default.
133
141
  *
134
142
  * Everything comes from the live read doors, so a capture takes the buffers
135
143
  * over the open theme's own copies. The colors and type are normalised on the
@@ -141,10 +149,10 @@ async function captureLook(): Promise<Pick<Theme, 'colorsAndType' | 'componentCo
141
149
  if (!liveColorsAndType) {
142
150
  throw new Error('No live colors and type to capture');
143
151
  }
144
- const overridden = (await listComponents()).filter((c) => c.source !== 'default');
145
- const configs = await Promise.all(overridden.map((c) => getActiveComponentConfig(c.name)));
152
+ const components = await listComponents();
153
+ const configs = await Promise.all(components.map((c) => getActiveComponentConfig(c.name)));
146
154
  const componentConfigs: Record<string, ComponentConfig> = {};
147
- overridden.forEach((c, i) => {
155
+ components.forEach((c, i) => {
148
156
  const config = configs[i];
149
157
  if (config) componentConfigs[c.name] = withoutLiveMarkers(config);
150
158
  });
@@ -166,7 +174,8 @@ export async function saveAsTheme(
166
174
  name: displayName,
167
175
  createdAt: now,
168
176
  updatedAt: now,
169
- schemaVersion: 3,
177
+ schemaVersion: THEME_SCHEMA_VERSION,
178
+ componentSchemaVersion: CURRENT_COMPONENT_SCHEMA_VERSION,
170
179
  ...look,
171
180
  });
172
181
  liveMovedSinceBake.set(true);
@@ -188,7 +197,8 @@ export async function saveActiveTheme(displayName?: string): Promise<void> {
188
197
  name: displayName ?? active.name,
189
198
  createdAt: active.createdAt,
190
199
  updatedAt: new Date().toISOString(),
191
- schemaVersion: 3,
200
+ schemaVersion: THEME_SCHEMA_VERSION,
201
+ componentSchemaVersion: CURRENT_COMPONENT_SCHEMA_VERSION,
192
202
  ...look,
193
203
  });
194
204
  liveMovedSinceBake.set(true);
@@ -203,6 +213,9 @@ export interface ImportThemeResult {
203
213
  /** Refs a v1 bundle failed to carry, as `colors-and-type:<name>` /
204
214
  * `<comp>/<name>`. Each fell back to the default. */
205
215
  dropped: string[];
216
+ /** What the completeness fill (`normalizeTheme`) had to add to reach this
217
+ * theme, reported so the panel can name it. */
218
+ filled: ThemeFillReport;
206
219
  }
207
220
 
208
221
  /**
@@ -1,6 +1,23 @@
1
1
  import type { CurveAnchor } from '../../ui/curveEngine';
2
+ import type { GradientValue } from './parsers/gradient';
2
3
  import type { Oklch } from '../palettes/oklch';
3
4
  import type { HarmonyAxis } from '../palettes/colorHarmony';
5
+ /** Single source of truth for the theme schema version
6
+ * (docs/plans/theme-completeness.md, Wave 2 step 5). It lives here, on the
7
+ * shipped side: `vite-plugin/` is build tooling and is not in the tarball, so
8
+ * anything under `src/` that reaches into it resolves in this repo and
9
+ * nowhere else. `normalizeTheme.ts` re-exports this. */
10
+ export const THEME_SCHEMA_VERSION = 4;
11
+
12
+ /** What the completeness fill had to add to reach a whole theme. `components`
13
+ * names each component the input carried no entry for; `aliases` counts keys
14
+ * added to components it did carry; `orphans` counts keys it carries that the
15
+ * current default no longer declares. */
16
+ export interface ThemeFillReport {
17
+ components: string[];
18
+ aliases: number;
19
+ orphans: number;
20
+ }
4
21
 
5
22
  export type GradientStyle = 'linear' | 'radial' | 'conic';
6
23
 
@@ -16,8 +33,17 @@ export interface PaletteConfig {
16
33
  baseColor: Oklch;
17
34
  lightnessCurve: CurveAnchor[];
18
35
  saturationCurve: CurveAnchor[];
19
- scaleCurves: Record<string, { lightness: CurveAnchor[]; saturation: CurveAnchor[] }>;
36
+ /** Signed hue offset in degrees per step, applied on top of the base hue.
37
+ * Absent means flat zero: the palette holds one hue, which is what every
38
+ * theme saved before this field did. */
39
+ hueCurve?: CurveAnchor[];
40
+ scaleCurves: Record<string, { lightness: CurveAnchor[]; saturation: CurveAnchor[]; hue?: CurveAnchor[] }>;
20
41
  curveOffset: Record<string, number>;
42
+ /** Per curve key: are the tangents derived from the points, or held by hand?
43
+ * Only an explicit switch-off is recorded. A missing key means the curve's own
44
+ * shape answers (`isAutoSmoothCurve`), which is what every theme saved before
45
+ * the flag existed relies on. */
46
+ curveAutoSmooth?: Record<string, boolean>;
21
47
  overrides: Record<string, Oklch>;
22
48
  snappedScales: string[];
23
49
  emptyMode?: 'solid' | 'gradient';
@@ -30,11 +56,12 @@ export interface PaletteConfig {
30
56
  /**
31
57
  * Where the base color sits in the ramp while `anchorToBase` is on: the
32
58
  * PALETTE_STEPS index whose curve anchors are pinned to the base color
33
- * (lightness = base L, saturation = multiplier 100). `displacedL` /
34
- * `displacedS` remember the y of a pre-existing anchor (endpoint or
35
- * user-authored) the placement overwrote at that x, so moving the
36
- * placement or toggling off restores it instead of deleting it.
37
- * `priorLightnessEndpoints` / `priorSaturationEndpoints` remember the two
59
+ * (lightness = base L, saturation = multiplier 100, hue delta = 0 when a
60
+ * hue curve exists). `displacedL` / `displacedS` / `displacedH` remember
61
+ * the y of a pre-existing anchor (endpoint or user-authored) the placement
62
+ * overwrote at that x, so moving the placement or toggling off restores it
63
+ * instead of deleting it. `priorLightnessEndpoints` /
64
+ * `priorSaturationEndpoints` / `priorHueEndpoints` remember the two
38
65
  * endpoints exactly as they stood before the curve's first-ever placement
39
66
  * (a smoothed reshape, not algebraically invertible the way a later
40
67
  * scaled-handle re-placement is), so a clear can still restore the true
@@ -44,8 +71,10 @@ export interface PaletteConfig {
44
71
  step: number;
45
72
  displacedL?: number;
46
73
  displacedS?: number;
74
+ displacedH?: number;
47
75
  priorLightnessEndpoints?: [CurveAnchor, CurveAnchor];
48
76
  priorSaturationEndpoints?: [CurveAnchor, CurveAnchor];
77
+ priorHueEndpoints?: [CurveAnchor, CurveAnchor];
49
78
  };
50
79
  /**
51
80
  * Set to true by importers when they overlay `cssVariables[--color-{ns}-*]`
@@ -111,11 +140,22 @@ export interface GradientDiskToken {
111
140
  }
112
141
 
113
142
  /**
114
- * Where a live read resolved from: the unsaved `_working` buffer, the open
115
- * theme's embedded copy, or the shipped default. A `working` source is an
116
- * unsaved delta from the active theme.
143
+ * Where a live component config resolved from: the unsaved `_working`
144
+ * buffer, or the open theme's embedded copy. Every theme carries every
145
+ * component complete, so `working` is the only genuine divergence —
146
+ * anything else is what the open document itself resolves to.
147
+ */
148
+ export type LiveSource = 'working' | 'theme';
149
+
150
+ /**
151
+ * Where a live colors-and-type read resolved from. Unlike `LiveSource`, this
152
+ * keeps a third value: colors-and-type resolution is unchanged by the theme
153
+ * completeness work (docs/plans/theme-completeness.md Wave 4), so `default`
154
+ * still answers the one case completeness can't reach — the open theme's
155
+ * file itself is unreadable (a stale pointer, or deleted mid-session), so
156
+ * there is no document to resolve `working` or `theme` against.
117
157
  */
118
- export type LiveSource = 'working' | 'theme' | 'default';
158
+ export type ColorsAndTypeSource = 'working' | 'theme' | 'default';
119
159
 
120
160
  export interface ColorsAndType {
121
161
  name: string;
@@ -136,8 +176,8 @@ export interface ColorsAndType {
136
176
  * handlers; read by `themeInit` to seed `openThemeSlug`. Not persisted.
137
177
  */
138
178
  _fileName?: string;
139
- /** Server-attached marker: which of the three live layers answered. */
140
- _source?: LiveSource;
179
+ /** Server-attached marker: which live layer answered. See `ColorsAndTypeSource`. */
180
+ _source?: ColorsAndTypeSource;
141
181
  /**
142
182
  * Migration stamp. Absent on legacy files, treated as 0; the loader runs
143
183
  * any registered theme migrations whose `fromVersion >= file.schemaVersion`.
@@ -162,7 +202,7 @@ export interface ColorsAndTypeMeta {
162
202
  * gradients that can't compress to a single string. */
163
203
  export type AliasDiskValue =
164
204
  | string
165
- | { kind: 'gradient'; value: { type: 'linear' | 'radial' | 'solid' | 'none'; angle: number; radius?: number; centerX?: number; aspectX?: number; aspectY?: number; stops: { position: number; color: string; opacity?: number }[] } };
205
+ | { kind: 'gradient'; value: GradientValue };
166
206
 
167
207
  export interface ComponentConfig {
168
208
  name: string;
@@ -176,7 +216,10 @@ export interface ComponentConfig {
176
216
  * theme, not a config file. Set by the component-configs GET handlers.
177
217
  */
178
218
  _fileName?: string;
179
- /** Server-attached marker: which of the three live layers answered. */
219
+ /** Server-attached marker: which live layer answered — `working` the
220
+ * buffer, `theme` the open document's embedded copy. No third value:
221
+ * every theme carries every component, so there is no shipped-default
222
+ * layer left to report (unlike `ColorsAndTypeSource`). */
180
223
  _source?: LiveSource;
181
224
  /**
182
225
  * Migration stamp. Absent on legacy files, treated as 0. See `ColorsAndType.schemaVersion`.
@@ -192,11 +235,11 @@ export interface ComponentConfigMeta {
192
235
 
193
236
  /**
194
237
  * A saved look, encapsulated: the colors and type plus a config for every
195
- * component that sits off its default, all carried by value. Themes are the
196
- * documents of the editor. Applying one opens it by clearing the reserved
197
- * `_working` buffers and updating `themes/_active.json`; live reads fall through
198
- * to its embedded copies. Saving captures live deltas back into it; Adopt
199
- * publishes it, and only then is
238
+ * component this install has, all carried by value. Themes are the documents
239
+ * of the editor. Applying one opens it by clearing the reserved `_working`
240
+ * buffers and updating `themes/_active.json`; live reads fall through to its
241
+ * embedded copies. Saving captures live deltas back into it; Adopt publishes
242
+ * it, and only then is
200
243
  * `tokens.generated.css` rebaked.
201
244
  */
202
245
  export interface Theme {
@@ -205,14 +248,32 @@ export interface Theme {
205
248
  updatedAt: string;
206
249
  /** Migration stamp. 1 was the pointer form (colors-and-type + config
207
250
  * basenames); 2 encapsulated it under a `theme` key; 3 spells that key
208
- * `colorsAndType`. The server rewrites older files at boot. */
209
- schemaVersion: 3;
251
+ * `colorsAndType`; 4 makes the theme complete (`docs/plans/
252
+ * theme-completeness.md`, Wave 2) — every known component and every alias
253
+ * key its `default.json` declares, by value. The server rewrites older
254
+ * files at boot. */
255
+ schemaVersion: typeof THEME_SCHEMA_VERSION;
210
256
  /** Full colors-and-type content. */
211
257
  colorsAndType: ColorsAndType;
212
- /** Component id → its config. Delta encoding: a component absent here is on
213
- * its default. Defaults are never inlined — the local `default.json` derived
214
- * from the component source is canonical, and a frozen copy would drift. */
258
+ /** Component id → its config, by value, one entry per component this
259
+ * install has and every alias key that component's `default.json`
260
+ * declares. `normalizeTheme` migrates each embedded config to the current
261
+ * component schema and then fills any gap from the local default, on every
262
+ * read (Waves 1 and 2 of `docs/plans/theme-completeness.md`); both the
263
+ * migration and the fill are persisted on the next write, so a theme is a
264
+ * whole-look document rather than a diff against a moving baseline.
265
+ * `component-configs/<id>/default.json` is the derivation product of that
266
+ * component's `:global(:root)`, not a resolution layer this map defers to
267
+ * — a config for a component this install does not have, or an alias key
268
+ * its current default no longer declares, is kept exactly as read (RJC 3)
269
+ * rather than dropped. */
215
270
  componentConfigs: Record<string, ComponentConfig>;
271
+ /** Migration stamp for every embedded component config in this theme, one
272
+ * field for all of them: `CURRENT_COMPONENT_SCHEMA_VERSION` is a single
273
+ * global counter over every component migration, so a per-entry stamp would
274
+ * buy no isolation. `normalizeTheme` sets this on every read; an embedded
275
+ * config's own `schemaVersion` (if hand-authored) is ignored and stripped. */
276
+ componentSchemaVersion: number;
216
277
  /** Server-attached file-name marker. Same role as `ColorsAndType._fileName`. */
217
278
  _fileName?: string;
218
279
  }
@@ -226,13 +287,14 @@ export interface Theme {
226
287
  */
227
288
  export interface ThemeBundle {
228
289
  /** Discriminator for safe identification of bundle JSON files. Paired with
229
- * the version below: import accepts this kind only at v3, and the
290
+ * the version below: import accepts this kind at v3 and v4, and the
230
291
  * `manifest-bundle` every release through 0.47.1 wrote only at v1. */
231
292
  kind: 'theme-bundle';
232
293
  /** Tracks the enclosed theme's schema. Import still accepts 1, where the
233
294
  * envelope carried a pointer theme plus separately inlined colors and type
234
- * and `${component}/${configName}`-keyed configs. */
235
- schemaVersion: 3;
295
+ * and `${component}/${configName}`-keyed configs, and 3, from before the
296
+ * Wave 2 completeness bump — `normalizeTheme` fills either on the way in. */
297
+ schemaVersion: typeof THEME_SCHEMA_VERSION;
236
298
  /** Sender's `@motion-proto/live-tokens` package version. Receiver can
237
299
  * compare to its own to warn about compatibility drift. */
238
300
  liveTokensVersion: string;
@@ -20,8 +20,12 @@ Success, Warning, Info, Danger, and a few more) has:
20
20
 
21
21
  - **Base colour.** Pick a hex; the palette derives an 11-step ramp (100 to 950)
22
22
  from it.
23
- - **Curves.** Two curves shape how lightness and saturation fall off across the
24
- ramp. Drag the handles to bias it darker, lighter, or more saturated.
23
+ - **Curves.** Three curves shape the ramp, in stack order: Hue, Saturation,
24
+ Lightness. Drag the handles to bias it warmer or cooler, more or less
25
+ saturated, darker or lighter. Hue drifts the ramp's temperature without
26
+ moving contrast, because OKLCH hue rotation is close to lightness-preserving.
27
+ It holds ±45 degrees; a bigger shift belongs on the base colour or the
28
+ harmony axis.
25
29
  - **Overrides.** Lock a single step to a hand-picked hex when the curve doesn't
26
30
  land where you want.
27
31
 
@@ -5,14 +5,14 @@ Save your work, switch between looks, and ship one to production.
5
5
  ## The Theme panel
6
6
 
7
7
  The **Theme** panel at the foot of the editor sidebar holds the whole look:
8
- colors, type, and a setting for every component you changed, in one file. It
9
- carries the name the look ships under, whether production is running it, and
10
- **Adopt**. Two parts sit under it, each a read-out rather than a file to manage.
8
+ colors, type, and a setting for every component, in one file. It carries the
9
+ name the look ships under, whether production is running it, and **Adopt**.
10
+ Two parts sit under it, each a read-out rather than a file to manage.
11
11
 
12
12
  - **Colors & Type** holds the design tokens. Components read those tokens to
13
13
  define their appearance. It names the two faces the page is showing.
14
- - **Components** counts how many components run something the theme does not
15
- carry, and opens the component editors.
14
+ - **Components** counts how many components have an unsaved edit that has not
15
+ been saved into the theme, and opens the component editors.
16
16
 
17
17
  A theme holds its own copy of every part, so one theme can never break another.
18
18
 
@@ -21,8 +21,7 @@ A theme holds its own copy of every part, so one theme can never break another.
21
21
  A theme is a document, and the editor works the way any editor does.
22
22
 
23
23
  - **A theme** is a named JSON file in `src/live-tokens/data/themes/`. It carries
24
- the whole look: the colors and type plus a setting for every component you
25
- changed.
24
+ the whole look: the colors and type plus a setting for every component.
26
25
  - **The open theme** is the one the editor is working on, named in
27
26
  `themes/_active.json`. One at a time.
28
27
  - **Your unsaved edits** are what the page shows right now. The editor keeps
@@ -60,10 +59,9 @@ to it, and the editor never overwrites it, so start your own with **Save As**.
60
59
  **Load**—or clicking the active theme's name—opens the Theme Picker. Picking a
61
60
  theme shows it on the page as a preview with nothing written to disk, so you can
62
61
  try each look and compare. **Save** in that window opens and adopts the previewed
63
- theme in one step: the active pointer changes, the buffers clear, components it
64
- does not carry fall through to their defaults, the editor works on it, and
65
- production ships it. **Cancel** returns you to where you were. Previewing alone
66
- never changes what your site ships.
62
+ theme in one step: the active pointer changes, the buffers clear, the editor
63
+ works on it, and production ships it. **Cancel** returns you to where you were.
64
+ Previewing alone never changes what your site ships.
67
65
 
68
66
  **Colors and type only. Keep my shapes.** narrows the load to the palette and
69
67
  the fonts: your component settings stay as they are and the theme you have open
@@ -27,8 +27,8 @@ src/system/styles/
27
27
  ```
28
28
 
29
29
  A saved theme carries the whole look by value: the colors and type plus a
30
- setting for every component you changed. It depends on no other file, so
31
- deleting anything else never breaks it.
30
+ setting for every component. It depends on no other file, so deleting
31
+ anything else never breaks it.
32
32
 
33
33
  ## What writes when
34
34
 
@@ -4,8 +4,8 @@
4
4
  export const docContent: Record<string, string> = {
5
5
  "01-overview": "# Overview\n\nLive Tokens is a design system for building Svelte microsites quickly. You\nstyle your site by editing tokens and components in a live editor. When it looks right, you save the theme and ship it.\n\n## How it works\n\n- The editor runs in your dev server, on top of your real pages. You style in\n context, not in a separate sandbox.\n- Every change updates a CSS variable, so the page repaints instantly. No\n reload, no build step.\n- Saving writes a small JSON file into your project. Shipping bakes your chosen\n theme into a plain CSS file that the build bundles.\n- The editor is dev-only. Production ships plain CSS variables and the\n components you used, nothing else.\n\n## What you can edit\n\n- **Tokens**: the design-system primitives, colour palettes, type, spacing,\n radius, shadow, and gradients, that apply across your whole site.\n- **Components**: the package ships about 25 editable components (Button,\n IconButton, Card, Dialog, Table, and more). You style components by changing\n the tokens assigned to each property.\n\n## Where to go next\n\n- **[Getting started](getting-started.md)**: scaffold a project and make your\n first edit.\n- **[Editing tokens](editing-tokens.md)**: a tour of the editor.\n- **[Themes](themes-workflow.md)**: save, switch, and ship.\n- **[Creating components](creating-components.md)**: make your own components\n editable.\n",
6
6
  "creating-components": "# Creating components\n\nThe package ships about 25 editable components. When you need one it doesn't\nhave, you can make your own Svelte component editable, so anyone using the\neditor can re-point its colours, type, and spacing without touching code.\n\nThe simplest way is to ask Claude. The package bundles a Claude Code skill that\nknows the conventions, writes the files, and checks the result for you.\n\n## Install the skills\n\n```bash\nnpx @motion-proto/live-tokens setup-claude\n```\n\nThis copies the bundled skills into your project's `.claude/skills/`. Once\nthey're there, Claude Code picks them up automatically.\n\n## Ask for a component\n\nDescribe what you want in plain English. Phrases like these trigger the skill:\n\n- \"Add a Toggle component to live-tokens\"\n- \"Make this Svelte component editable in the live-tokens editor\"\n- \"Create a Stat component with a value and a label\"\n\nClaude asks any clarifying questions it needs (which variants, which states,\nwhich parts), then writes the component, registers it with the editor, and runs\nits verification checklist. When it finishes, open `/live-tokens/components` to see your new\ncomponent in the editor and confirm everything works.\n\n## What you get\n\n- A runtime component whose editable properties default to your theme tokens.\n- An editor entry that appears under **Custom** in the `/live-tokens/components` view.\n- The naming and wiring handled for you, so the component fits the system.\n\nAdvanced authors who want to write a component by hand can read the naming and\nstate-model conventions shipped in the package\n(`src/system/styles/CONVENTIONS.md` and the skill's own `SKILL.md`).\n",
7
- "editing-tokens": "# Editing tokens\n\nA tour of the editor. The page behind it repaints on every change; saving\nwrites a theme file you can reload later.\n\nThe editor has two views:\n\n- **Tokens**: the design-system primitives (colour, type, spacing, and so on).\n They apply everywhere your site uses them.\n- **Components**: per-component editors. Re-Assign what tokens a component uses\n without changing the underlying system.\n\nThis page covers **Tokens**. For components, see\n[Creating components](creating-components.md).\n\n## Palettes\n\nMost colour work happens here. Each palette (Brand, Accent, Neutral, Canvas,\nSuccess, Warning, Info, Danger, and a few more) has:\n\n- **Base colour.** Pick a hex; the palette derives an 11-step ramp (100 to 950)\n from it.\n- **Curves.** Two curves shape how lightness and saturation fall off across the\n ramp. Drag the handles to bias it darker, lighter, or more saturated.\n- **Overrides.** Lock a single step to a hand-picked hex when the curve doesn't\n land where you want.\n\nEditing a palette base ripples through every colour that depends on it, in real\ntime. Colours use OKLCH, so the ramp stays perceptually even across hues\nwithout muddy mid-tones.\n\n## Type\n\n- **Fonts.** Add sources from Google Fonts, Adobe (Typekit), a CSS URL, or an\n inline `@font-face`. The font loads in the page as soon as you add it.\n- **Stacks.** Named font cascades you reference by token, such as a display\n stack and a body stack.\n- **Sizes and weights.** A t-shirt scale (xs, sm, md, lg, xl, 2xl…) for size and\n a numeric scale (100 to 900) for weight.\n\n## Spacing, radius, shadow\n\nNumeric scales with a slider per step.\n\n- **Spacing**: the padding, gap, and margin scale.\n- **Radius**: none through full.\n- **Shadow**: colour, offset, blur, spread, and opacity per step, with stacked\n shadows supported.\n\nChange a step and every element using it repaints.\n\n## Overlays and gradients\n\n- **Overlays** are translucent tints layered over surfaces, like the subtle\n tint a card gets on hover. Set a colour and opacity per state.\n- **Gradients** are reusable gradient tokens with a stop list and direction, for\n hero panels and accent backgrounds.\n\n## Columns\n\nThe page-grid overlay. Set column count, gutter, and outer margin, and toggle\nthe visual guide with `Cmd/Ctrl+G`. Pages built on the column system reflow\nlive.\n\n## Saving\n\nThe editor saves to your browser continuously, so work survives a reload\nmid-edit. Writing a file is a separate step: the **Theme** panel at the foot of\nthe sidebar has **Save**, **Save As**, and **Load**, and each theme is one JSON\nfile under `src/live-tokens/data/themes/`.\n\nThe header gives you undo/redo (`Cmd/Ctrl+Z`, `Cmd/Ctrl+Shift+Z`). You can keep\nmany themes side by side; one is open at a time, and only **Adopt** publishes\none. See [Themes](themes-workflow.md) for the full lifecycle.\n",
7
+ "editing-tokens": "# Editing tokens\n\nA tour of the editor. The page behind it repaints on every change; saving\nwrites a theme file you can reload later.\n\nThe editor has two views:\n\n- **Tokens**: the design-system primitives (colour, type, spacing, and so on).\n They apply everywhere your site uses them.\n- **Components**: per-component editors. Re-Assign what tokens a component uses\n without changing the underlying system.\n\nThis page covers **Tokens**. For components, see\n[Creating components](creating-components.md).\n\n## Palettes\n\nMost colour work happens here. Each palette (Brand, Accent, Neutral, Canvas,\nSuccess, Warning, Info, Danger, and a few more) has:\n\n- **Base colour.** Pick a hex; the palette derives an 11-step ramp (100 to 950)\n from it.\n- **Curves.** Three curves shape the ramp, in stack order: Hue, Saturation,\n Lightness. Drag the handles to bias it warmer or cooler, more or less\n saturated, darker or lighter. Hue drifts the ramp's temperature without\n moving contrast, because OKLCH hue rotation is close to lightness-preserving.\n It holds ±45 degrees; a bigger shift belongs on the base colour or the\n harmony axis.\n- **Overrides.** Lock a single step to a hand-picked hex when the curve doesn't\n land where you want.\n\nEditing a palette base ripples through every colour that depends on it, in real\ntime. Colours use OKLCH, so the ramp stays perceptually even across hues\nwithout muddy mid-tones.\n\n## Type\n\n- **Fonts.** Add sources from Google Fonts, Adobe (Typekit), a CSS URL, or an\n inline `@font-face`. The font loads in the page as soon as you add it.\n- **Stacks.** Named font cascades you reference by token, such as a display\n stack and a body stack.\n- **Sizes and weights.** A t-shirt scale (xs, sm, md, lg, xl, 2xl…) for size and\n a numeric scale (100 to 900) for weight.\n\n## Spacing, radius, shadow\n\nNumeric scales with a slider per step.\n\n- **Spacing**: the padding, gap, and margin scale.\n- **Radius**: none through full.\n- **Shadow**: colour, offset, blur, spread, and opacity per step, with stacked\n shadows supported.\n\nChange a step and every element using it repaints.\n\n## Overlays and gradients\n\n- **Overlays** are translucent tints layered over surfaces, like the subtle\n tint a card gets on hover. Set a colour and opacity per state.\n- **Gradients** are reusable gradient tokens with a stop list and direction, for\n hero panels and accent backgrounds.\n\n## Columns\n\nThe page-grid overlay. Set column count, gutter, and outer margin, and toggle\nthe visual guide with `Cmd/Ctrl+G`. Pages built on the column system reflow\nlive.\n\n## Saving\n\nThe editor saves to your browser continuously, so work survives a reload\nmid-edit. Writing a file is a separate step: the **Theme** panel at the foot of\nthe sidebar has **Save**, **Save As**, and **Load**, and each theme is one JSON\nfile under `src/live-tokens/data/themes/`.\n\nThe header gives you undo/redo (`Cmd/Ctrl+Z`, `Cmd/Ctrl+Shift+Z`). You can keep\nmany themes side by side; one is open at a time, and only **Adopt** publishes\none. See [Themes](themes-workflow.md) for the full lifecycle.\n",
8
8
  "getting-started": "# Getting started\n\nScaffold a live token site in a moments. You need Node 20 or later, a\npackage manager (npm, pnpm, or yarn), and a browser. Open claude code in your repo and start building.\n\n## Scaffold a new app\n\n```bash\nnpm create @motion-proto/live-tokens@latest my-app\ncd my-app\nnpm install\nnpm run dev\n```\n\nOpen the URL Vite prints (usually `http://localhost:5173`). You get a\none-page Svelte + Vite app that depends on the published package, with the\neditor wired up and the full component set ready to import.\n\n`npx @motion-proto/live-tokens create my-app` runs the same scaffold without\nthe initialiser package.\n\n### What the scaffold gives you\n\nEvery editable file lives under `src/` and is committed, so `npm install` and\nversion upgrades never touch your styles. The package code stays in\n`node_modules`.\n\n| Path | What it is |\n|------|------------|\n| `src/pages/Home.svelte` | The starter page. Replace it with your own content. |\n| `src/App.svelte` | Your routes. `<LiveTokensRouter>` adds dev-only routes under a reserved `/live-tokens/*` namespace: `/live-tokens/editor`, `/live-tokens/components`, and `/live-tokens/docs`. |\n| `src/system/styles/tokens.css` | Your base token vocabulary, hand-authored. |\n| `src/styles/site.css` | Themed page typography, yours to edit. |\n\n## Your first edit\n\n1. Run `npm run dev` and open the home page.\n2. Click **Open Token Editor**, or visit `/live-tokens/editor`. The editor opens beside\n the page.\n3. Open **Palettes**, pick **Brand**, and change the base hex. The page\n repaints as you type.\n4. In the **Theme** panel at the foot of the sidebar, choose **Save As**. Your\n theme appears as JSON under `src/live-tokens/data/themes/`.\n5. Reload. The editor reopens on your theme, so the page returns as you left\n it.\n\n## What you just changed\n\nEvery edit sets a CSS custom property on `:root`. Your components read those\nproperties through `var(--...)`. There is no token build step and no\npreprocessor rewriting your code: the page renders against plain CSS variables\nthe editor swaps live.\n\nTo ship, click **Adopt** in the Theme panel. That saves the open theme and bakes\nit into `src/live-tokens/data/tokens.generated.css`, which your build bundles\nalongside `tokens.css`. Adopt is the only action that changes what your site\nships, so try any look you like first. The editor itself never reaches\nproduction.\n\nAlready have a Svelte 5 + Vite app? The\n[README](https://github.com/motionproto/live-tokens#readme) covers installing\ninto an existing project.\n\n## Where to go next\n\n- **[Editing tokens](editing-tokens.md)**: a tour of the editor.\n- **[Themes](themes-workflow.md)**: save, switch, and ship.\n- **[Creating components](creating-components.md)**: make your own component\n editable.\n",
9
- "themes-workflow": "# Themes\n\nSave your work, switch between looks, and ship one to production.\n\n## The Theme panel\n\nThe **Theme** panel at the foot of the editor sidebar holds the whole look:\ncolors, type, and a setting for every component you changed, in one file. It\ncarries the name the look ships under, whether production is running it, and\n**Adopt**. Two parts sit under it, each a read-out rather than a file to manage.\n\n- **Colors & Type** holds the design tokens. Components read those tokens to\n define their appearance. It names the two faces the page is showing.\n- **Components** counts how many components run something the theme does not\n carry, and opens the component editors.\n\nA theme holds its own copy of every part, so one theme can never break another.\n\n## How themes work\n\nA theme is a document, and the editor works the way any editor does.\n\n- **A theme** is a named JSON file in `src/live-tokens/data/themes/`. It carries\n the whole look: the colors and type plus a setting for every component you\n changed.\n- **The open theme** is the one the editor is working on, named in\n `themes/_active.json`. One at a time.\n- **Your unsaved edits** are what the page shows right now. The editor keeps\n them in your browser as you work and writes them to a buffer, `_working.json`,\n one slot per part of the look. **Save** captures that buffer into the open\n theme.\n- **The production theme** is the one your site ships, named in\n `themes/_production.json`. **Adopt** changes it; saving a preset in the Theme\n Picker performs that Adopt for you.\n\nAbsence is the answer for anything untouched: a buffer exists only where the\nlive look diverges from the active theme, so a newly opened theme has none.\n\n## Saving\n\nIn the Theme panel:\n\n- **Save** captures the look on screen into the open theme. Your colors and type\n go in as part of it, so there is nothing to save first.\n- **Save As** names a new theme. Use it for your first save and for forking.\n\nComponent editors keep their own unsaved state. If one or more components are\nwaiting when you use **Save**, **Save As**, or **Adopt**, the Theme panel offers\nto save all of them before continuing. You can accept once instead of visiting\neach component, or cancel to review them individually. A component editor's\n**Save As** creates a reusable component preset.\n\nNames are tidied to lowercase with hyphens, so \"My Brand!\" becomes `my-brand`,\nand a leading underscore is dropped: those names are reserved for the buffer.\n**Motion Proto** is the built-in theme and is read-only. You can always return\nto it, and the editor never overwrites it, so start your own with **Save As**.\n\n## Switching\n\n**Load**—or clicking the active theme's name—opens the Theme Picker. Picking a\ntheme shows it on the page as a preview with nothing written to disk, so you can\ntry each look and compare. **Save** in that window opens and adopts the previewed\ntheme in one step: the active pointer changes, the buffers clear, components it\ndoes not carry fall through to their defaults, the editor works on it, and\nproduction ships it. **Cancel** returns you to where you were. Previewing alone\nnever changes what your site ships.\n\n**Colors and type only. Keep my shapes.** narrows the load to the palette and\nthe fonts: your component settings stay as they are and the theme you have open\nstays open. Saved colors and type files are listed there too, marked *colors &\ntype*, and picking one is always that narrower load.\n\n## Shipping\n\n**Adopt**, in the Theme panel, is the \"ship it\" step, and it ships the whole\nlook. It saves the open theme, then bakes that theme into\n`src/live-tokens/data/tokens.generated.css`, which your build bundles alongside\n`tokens.css`: the colors and type plus every component the theme carries. Fonts\nregenerate to match. The line under the theme name says whether production is\nrunning this theme.\n\nProduction is one saved theme, so nothing else publishes. Trying a look, moving\na token, saving a theme: all of it leaves the generated CSS alone until you\nAdopt. A component editor's Adopt runs the same whole-look step, because a\ncomponent never ships alone. Adopting while Motion Proto is open saves your look\nas a theme of your own first, since the built-in one is read-only.\n\nProduction builds (`npm run build`) ship only that plain CSS and your\ncomponents. No editor, no JSON loading, no runtime indirection.\n\n## Keeping your work safe\n\nEverything under `src/live-tokens/data/` is plain JSON, so commit it. Themes show\nup as readable diffs you can review per branch, and the buffer shows up as the\nwork you have not saved into a theme yet. Nothing is backed up anywhere else:\ngit is your safety net. To experiment freely, **Save As** a new name first, then\nedit.\n\n## Where to go next\n\n- **[Where themes live](where-themes-live.md)**: the files behind all of this,\n and what writes each one.\n- **[Creating components](creating-components.md)**: make your own components\n editable in the same editor.\n",
10
- "where-themes-live": "# Where themes live\n\nEverything the editor writes is plain JSON and CSS inside your project. There\nis no database and no hidden state: the files are the storage, and git is the\nhistory.\n\n## The data tree\n\n```\nsrc/live-tokens/data/\n themes/\n _active.json names the theme the editor has open\n _production.json names the theme your site ships\n default.json Motion Proto, the built-in look, rewritten at boot\n my-brand.json a saved theme: the whole look in one file\n colors-and-type/\n _working.json unsaved colors and type edits\n component-configs/\n button/\n default.json Button's shipped settings, derived at boot\n _working.json unsaved Button edits\n my-button.json a preset you saved from the Button editor\n tokens.generated.css the baked CSS your production build ships\nsrc/system/styles/\n tokens.css your token vocabulary, hand-authored, never written\n fonts.css font imports, rewritten when you Adopt\n```\n\nA saved theme carries the whole look by value: the colors and type plus a\nsetting for every component you changed. It depends on no other file, so\ndeleting anything else never breaks it.\n\n## What writes when\n\n- **Editing** changes the page through CSS variables. The editor keeps your\n edits in the browser as you work and writes them to the `_working.json`\n buffers when you save a component. When the Theme panel finds several dirty\n components, **Save all** writes those buffers together.\n- **Save** captures the buffers into the open theme's file. That file is the\n durable copy of your look; matching buffers are then removed.\n- **Load** clears the buffers and points `themes/_active.json` at the theme you\n picked. Live reads fall through to that file. Nothing else changes, so trying\n looks is free and ordinary switching changes only the pointer.\n- **Adopt** points `themes/_production.json` at the open theme, bakes it into\n `tokens.generated.css`, and rewrites `fonts.css` to match. It is the only\n action that changes what your site ships.\n\nThe `default.json` files are the shipped baseline. The editor derives them at\nboot and refreshes them when the package updates; it never saves your work\nover them.\n\nProjects upgraded from 0.48 may initially contain working files copied from the\nactive theme. On the first dev-server boot, exact copies are removed\nautomatically. Any file that differs is kept as unsaved work, so no migration\ncommand is required.\n\n## What to commit\n\nAll of it. The data tree is designed to live in git: themes diff readably, the\ntwo pointers say what is open and what ships, and a `_working.json` in a diff\nis exactly the work you have not yet saved into a theme. Nothing is backed up\nanywhere else.\n\n## Where to go next\n\n- **[Themes](themes-workflow.md)**: the workflow built on these files: saving,\n loading, and shipping.\n",
9
+ "themes-workflow": "# Themes\n\nSave your work, switch between looks, and ship one to production.\n\n## The Theme panel\n\nThe **Theme** panel at the foot of the editor sidebar holds the whole look:\ncolors, type, and a setting for every component, in one file. It carries the\nname the look ships under, whether production is running it, and **Adopt**.\nTwo parts sit under it, each a read-out rather than a file to manage.\n\n- **Colors & Type** holds the design tokens. Components read those tokens to\n define their appearance. It names the two faces the page is showing.\n- **Components** counts how many components have an unsaved edit that has not\n been saved into the theme, and opens the component editors.\n\nA theme holds its own copy of every part, so one theme can never break another.\n\n## How themes work\n\nA theme is a document, and the editor works the way any editor does.\n\n- **A theme** is a named JSON file in `src/live-tokens/data/themes/`. It carries\n the whole look: the colors and type plus a setting for every component.\n- **The open theme** is the one the editor is working on, named in\n `themes/_active.json`. One at a time.\n- **Your unsaved edits** are what the page shows right now. The editor keeps\n them in your browser as you work and writes them to a buffer, `_working.json`,\n one slot per part of the look. **Save** captures that buffer into the open\n theme.\n- **The production theme** is the one your site ships, named in\n `themes/_production.json`. **Adopt** changes it; saving a preset in the Theme\n Picker performs that Adopt for you.\n\nAbsence is the answer for anything untouched: a buffer exists only where the\nlive look diverges from the active theme, so a newly opened theme has none.\n\n## Saving\n\nIn the Theme panel:\n\n- **Save** captures the look on screen into the open theme. Your colors and type\n go in as part of it, so there is nothing to save first.\n- **Save As** names a new theme. Use it for your first save and for forking.\n\nComponent editors keep their own unsaved state. If one or more components are\nwaiting when you use **Save**, **Save As**, or **Adopt**, the Theme panel offers\nto save all of them before continuing. You can accept once instead of visiting\neach component, or cancel to review them individually. A component editor's\n**Save As** creates a reusable component preset.\n\nNames are tidied to lowercase with hyphens, so \"My Brand!\" becomes `my-brand`,\nand a leading underscore is dropped: those names are reserved for the buffer.\n**Motion Proto** is the built-in theme and is read-only. You can always return\nto it, and the editor never overwrites it, so start your own with **Save As**.\n\n## Switching\n\n**Load**—or clicking the active theme's name—opens the Theme Picker. Picking a\ntheme shows it on the page as a preview with nothing written to disk, so you can\ntry each look and compare. **Save** in that window opens and adopts the previewed\ntheme in one step: the active pointer changes, the buffers clear, the editor\nworks on it, and production ships it. **Cancel** returns you to where you were.\nPreviewing alone never changes what your site ships.\n\n**Colors and type only. Keep my shapes.** narrows the load to the palette and\nthe fonts: your component settings stay as they are and the theme you have open\nstays open. Saved colors and type files are listed there too, marked *colors &\ntype*, and picking one is always that narrower load.\n\n## Shipping\n\n**Adopt**, in the Theme panel, is the \"ship it\" step, and it ships the whole\nlook. It saves the open theme, then bakes that theme into\n`src/live-tokens/data/tokens.generated.css`, which your build bundles alongside\n`tokens.css`: the colors and type plus every component the theme carries. Fonts\nregenerate to match. The line under the theme name says whether production is\nrunning this theme.\n\nProduction is one saved theme, so nothing else publishes. Trying a look, moving\na token, saving a theme: all of it leaves the generated CSS alone until you\nAdopt. A component editor's Adopt runs the same whole-look step, because a\ncomponent never ships alone. Adopting while Motion Proto is open saves your look\nas a theme of your own first, since the built-in one is read-only.\n\nProduction builds (`npm run build`) ship only that plain CSS and your\ncomponents. No editor, no JSON loading, no runtime indirection.\n\n## Keeping your work safe\n\nEverything under `src/live-tokens/data/` is plain JSON, so commit it. Themes show\nup as readable diffs you can review per branch, and the buffer shows up as the\nwork you have not saved into a theme yet. Nothing is backed up anywhere else:\ngit is your safety net. To experiment freely, **Save As** a new name first, then\nedit.\n\n## Where to go next\n\n- **[Where themes live](where-themes-live.md)**: the files behind all of this,\n and what writes each one.\n- **[Creating components](creating-components.md)**: make your own components\n editable in the same editor.\n",
10
+ "where-themes-live": "# Where themes live\n\nEverything the editor writes is plain JSON and CSS inside your project. There\nis no database and no hidden state: the files are the storage, and git is the\nhistory.\n\n## The data tree\n\n```\nsrc/live-tokens/data/\n themes/\n _active.json names the theme the editor has open\n _production.json names the theme your site ships\n default.json Motion Proto, the built-in look, rewritten at boot\n my-brand.json a saved theme: the whole look in one file\n colors-and-type/\n _working.json unsaved colors and type edits\n component-configs/\n button/\n default.json Button's shipped settings, derived at boot\n _working.json unsaved Button edits\n my-button.json a preset you saved from the Button editor\n tokens.generated.css the baked CSS your production build ships\nsrc/system/styles/\n tokens.css your token vocabulary, hand-authored, never written\n fonts.css font imports, rewritten when you Adopt\n```\n\nA saved theme carries the whole look by value: the colors and type plus a\nsetting for every component. It depends on no other file, so deleting\nanything else never breaks it.\n\n## What writes when\n\n- **Editing** changes the page through CSS variables. The editor keeps your\n edits in the browser as you work and writes them to the `_working.json`\n buffers when you save a component. When the Theme panel finds several dirty\n components, **Save all** writes those buffers together.\n- **Save** captures the buffers into the open theme's file. That file is the\n durable copy of your look; matching buffers are then removed.\n- **Load** clears the buffers and points `themes/_active.json` at the theme you\n picked. Live reads fall through to that file. Nothing else changes, so trying\n looks is free and ordinary switching changes only the pointer.\n- **Adopt** points `themes/_production.json` at the open theme, bakes it into\n `tokens.generated.css`, and rewrites `fonts.css` to match. It is the only\n action that changes what your site ships.\n\nThe `default.json` files are the shipped baseline. The editor derives them at\nboot and refreshes them when the package updates; it never saves your work\nover them.\n\nProjects upgraded from 0.48 may initially contain working files copied from the\nactive theme. On the first dev-server boot, exact copies are removed\nautomatically. Any file that differs is kept as unsaved work, so no migration\ncommand is required.\n\n## What to commit\n\nAll of it. The data tree is designed to live in git: themes diff readably, the\ntwo pointers say what is open and what ships, and a `_working.json` in a diff\nis exactly the work you have not yet saved into a theme. Nothing is backed up\nanywhere else.\n\n## Where to go next\n\n- **[Themes](themes-workflow.md)**: the workflow built on these files: saving,\n loading, and shipping.\n",
11
11
  };
@@ -36,6 +36,7 @@ export type {
36
36
  ColorsAndType,
37
37
  ColorsAndTypeMeta,
38
38
  LiveSource,
39
+ ColorsAndTypeSource,
39
40
  GradientStyle,
40
41
  GradientStop,
41
42
  FontSource,
@@ -36,10 +36,13 @@
36
36
  --ui-gray-850: #c7c7c7;
37
37
  --ui-gray-950: #f2f2f2;
38
38
 
39
+ /* Every level down to muted clears WCAG AA (4.5:1) on the chrome surfaces
40
+ it lands on, so no rung of the ramp is unreadable: muted bottoms out at
41
+ 4.66:1 on --ui-surface. Only disabled sits below AA, which 1.4.3 exempts. */
39
42
  --ui-text-primary: #ffffff;
40
43
  --ui-text-secondary: var(--ui-gray-800);
41
- --ui-text-tertiary: var(--ui-gray-700);
42
- --ui-text-muted: var(--ui-gray-500);
44
+ --ui-text-tertiary: var(--ui-gray-750);
45
+ --ui-text-muted: var(--ui-gray-700);
43
46
  --ui-text-disabled: var(--ui-gray-400);
44
47
  --ui-text-accent: var(--ui-gray-950);
45
48
  --ui-text-success: var(--ui-gray-850);