@motion-proto/live-tokens 0.45.0 → 0.46.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 (38) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist-plugin/index.cjs +1 -1
  3. package/dist-plugin/index.js +1 -1
  4. package/package.json +1 -1
  5. package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +0 -1
  6. package/src/editor/component-editor/scaffolding/ComponentFileMenu.svelte +1 -1
  7. package/src/editor/core/palettes/colorHarmony.ts +35 -6
  8. package/src/editor/core/palettes/paletteDerivation.ts +1 -1
  9. package/src/editor/core/store/editorTypes.ts +2 -2
  10. package/src/editor/docs/CodeBlock.svelte +0 -2
  11. package/src/editor/docs/Docs.svelte +0 -3
  12. package/src/editor/pages/ComponentEditorPage.svelte +3 -5
  13. package/src/editor/pages/EditorShell.svelte +3 -5
  14. package/src/editor/ui/ColorEditPanel.svelte +19 -22
  15. package/src/editor/ui/EditorViewSwitcher.svelte +2 -3
  16. package/src/editor/ui/FileLoadList.svelte +7 -9
  17. package/src/editor/ui/ManifestFileManager.svelte +1 -3
  18. package/src/editor/ui/ProjectFontsSection.svelte +0 -4
  19. package/src/editor/ui/SurfacesTab.svelte +3 -3
  20. package/src/editor/ui/TextStylesSection.svelte +6 -8
  21. package/src/editor/ui/ThemeFileManager.svelte +1 -3
  22. package/src/editor/ui/UIEasingSelector.svelte +0 -2
  23. package/src/editor/ui/UIFontFamilySelector.svelte +9 -3
  24. package/src/editor/ui/UIMenuButton.svelte +230 -0
  25. package/src/editor/ui/UIPaletteSelector.svelte +0 -1
  26. package/src/editor/ui/VariablesTab.svelte +3 -4
  27. package/src/editor/ui/colors/AxisNumeral.svelte +70 -0
  28. package/src/editor/ui/colors/ColorReadouts.svelte +0 -2
  29. package/src/editor/ui/colors/ColorWheel.svelte +48 -29
  30. package/src/editor/ui/colors/ColorsTab.svelte +361 -172
  31. package/src/editor/ui/colors/HarmonyAxesList.svelte +264 -141
  32. package/src/editor/ui/colors/LightnessBar.svelte +0 -2
  33. package/src/editor/ui/colors/harmonyDrag.ts +10 -0
  34. package/src/editor/ui/colors/harmonyModeIcons.ts +5 -0
  35. package/src/editor/ui/colors/paletteBaseColor.ts +25 -17
  36. package/src/live-tokens/data/tokens.generated.css +28 -28
  37. package/src/system/components/ImageLightbox.svelte +0 -2
  38. package/src/system/components/SectionDivider.svelte +4 -4
@@ -19,7 +19,7 @@
19
19
 
20
20
  import { get } from 'svelte/store';
21
21
  import type { Oklch } from '../../core/palettes/oklch';
22
- import { AXIS_ROLES } from '../../core/palettes/colorHarmony';
22
+ import { axisLabel } from '../../core/palettes/colorHarmony';
23
23
  import { PALETTE_SPECS, syncBaseAnchor, type PaletteSpec } from '../../core/palettes/paletteDerivation';
24
24
  import { defaultPaletteConfig } from '../palette/paletteMath';
25
25
  import { mutate, transaction, editorState } from '../../core/store/editorStore';
@@ -106,7 +106,7 @@ export function setAxisHue(index: number, hue: number, familyChroma?: number): v
106
106
  const base = axis.family !== null ? get(editorState).palettes[axis.family]?.baseColor : undefined;
107
107
  const colorNoop = !base || (base.h === h && (c === undefined || base.c === c));
108
108
  if (axis.hue === h && colorNoop) return;
109
- mutate(`colors: ${AXIS_ROLES[index]} axis hue`, (s) => {
109
+ mutate(`colors: ${axisLabel(index)} hue`, (s) => {
110
110
  applyAxisHue(s, index, h, c);
111
111
  });
112
112
  }
@@ -145,39 +145,47 @@ function applyAxisHue(s: EditorState, index: number, hue: number, chroma: number
145
145
  }
146
146
  }
147
147
 
148
- /** Bind a family to an axis; the family adopts the axis hue (c + L kept).
149
- * Trade-places semantics: whatever occupied the destination takes the source's
150
- * position (another axis, adopting its hue, or Unassigned). One mutate. */
151
- export function bindFamilyToAxis(family: string, index: number): void {
148
+ /** Bind a family to an axis; the axis moves to the family's hue. Trade-places
149
+ * semantics: whatever occupied the destination takes the source's position
150
+ * (another axis, which likewise moves to it, or unassigned). One mutate.
151
+ * Returns whether any axis hue moved, which is what makes an applied harmony
152
+ * mode untrue — the caller drops to Custom on that. */
153
+ export function bindFamilyToAxis(family: string, index: number): boolean {
152
154
  const srcIndex = get(editorState).harmonyAxes.findIndex((a) => a.family === family);
153
- if (srcIndex === index) return;
154
- mutate(`colors: bind ${family}`, (s) => {
155
+ if (srcIndex === index) return false;
156
+ let hueMoved = false;
157
+ mutate(`colors: assign ${family}`, (s) => {
155
158
  const axes = s.harmonyAxes;
156
159
  const occupant = axes[index].family;
157
160
  axes[index].family = family;
158
- adoptAxisHue(s, family, axes[index].hue);
159
- // Source was another axis: the occupant trades into it (adopting its hue).
160
- // Source was Unassigned (-1): the occupant simply floats free, color kept.
161
+ hueMoved = takeSeedHue(s, index, family);
162
+ // Source was another axis: the occupant trades into it, keeping its color
163
+ // and taking that axis to its hue. Source was unassigned (-1): the occupant
164
+ // simply floats free, color kept.
161
165
  if (srcIndex !== -1) {
162
166
  axes[srcIndex].family = occupant;
163
- if (occupant !== null) adoptAxisHue(s, occupant, axes[srcIndex].hue);
167
+ if (occupant !== null) hueMoved = takeSeedHue(s, srcIndex, occupant) || hueMoved;
164
168
  }
165
169
  });
170
+ return hueMoved;
166
171
  }
167
172
 
168
173
  /** Unbind; the family keeps its current color, the axis keeps its hue. */
169
174
  export function unbindFamily(family: string): void {
170
175
  const idx = get(editorState).harmonyAxes.findIndex((a) => a.family === family);
171
176
  if (idx === -1) return;
172
- mutate(`colors: unbind ${family}`, (s) => {
177
+ mutate(`colors: unassign ${family}`, (s) => {
173
178
  s.harmonyAxes[idx].family = null;
174
179
  });
175
180
  }
176
181
 
177
- function adoptAxisHue(s: EditorState, family: string, hue: number): void {
178
- const cfg = ensureConfig(s, family);
179
- cfg.baseColor = { l: cfg.baseColor.l, c: cfg.baseColor.c, h: normHue(hue) };
180
- syncBaseAnchor(cfg);
182
+ /** Assignment must never repaint a seed the user chose, so the axis is what
183
+ * moves. Harmony modes and axis drags stay the steps that move colors. */
184
+ function takeSeedHue(s: EditorState, index: number, family: string): boolean {
185
+ const hue = normHue(ensureConfig(s, family).baseColor.h);
186
+ if (s.harmonyAxes[index].hue === hue) return false;
187
+ s.harmonyAxes[index].hue = hue;
188
+ return true;
181
189
  }
182
190
 
183
191
  /** Set several seed colors in ONE undo entry (harmony apply, global rotate). */
@@ -125,6 +125,34 @@
125
125
  --text-accent-tertiary: #4d7271;
126
126
  --text-accent-muted: #3c4847;
127
127
  --text-accent-disabled: #313232;
128
+ --color-special-100: #d2c8ff;
129
+ --color-special-200: #b19cff;
130
+ --color-special-300: #9673f5;
131
+ --color-special-400: #7d54db;
132
+ --color-special-500: #6634c4;
133
+ --color-special-600: #5407af;
134
+ --color-special-700: #3f0088;
135
+ --color-special-800: #2d0064;
136
+ --color-special-850: #1d0046;
137
+ --color-special-900: #10002d;
138
+ --color-special-950: #060019;
139
+ --surface-special-lowest: #0f002b;
140
+ --surface-special-lower: #250055;
141
+ --surface-special-low: #3d0084;
142
+ --surface-special: #5700b7;
143
+ --surface-special-high: #6c3bcb;
144
+ --surface-special-higher: #8161d8;
145
+ --surface-special-highest: #9983e4;
146
+ --border-special-faint: #29005c;
147
+ --border-special-subtle: #4b009f;
148
+ --border-special: #6b34ce;
149
+ --border-special-medium: #8c5df8;
150
+ --border-special-strong: #ac93ff;
151
+ --text-special: #baa9ff;
152
+ --text-special-secondary: #8665e0;
153
+ --text-special-tertiary: #5c4e8b;
154
+ --text-special-muted: #3e3a4f;
155
+ --text-special-disabled: #303032;
128
156
  --color-canvas-100: #cecfe5;
129
157
  --color-canvas-200: #abacc2;
130
158
  --color-canvas-300: #8d8da4;
@@ -212,34 +240,6 @@
212
240
  --text-alternate-tertiary: #8a8786;
213
241
  --text-alternate-muted: #545352;
214
242
  --text-alternate-disabled: #3b3b3b;
215
- --color-special-100: #d2c8ff;
216
- --color-special-200: #b19cff;
217
- --color-special-300: #9673f5;
218
- --color-special-400: #7d54db;
219
- --color-special-500: #6634c4;
220
- --color-special-600: #5407af;
221
- --color-special-700: #3f0088;
222
- --color-special-800: #2d0064;
223
- --color-special-850: #1d0046;
224
- --color-special-900: #10002d;
225
- --color-special-950: #060019;
226
- --surface-special-lowest: #0f002b;
227
- --surface-special-lower: #250055;
228
- --surface-special-low: #3d0084;
229
- --surface-special: #5700b7;
230
- --surface-special-high: #6c3bcb;
231
- --surface-special-higher: #8161d8;
232
- --surface-special-highest: #9983e4;
233
- --border-special-faint: #29005c;
234
- --border-special-subtle: #4b009f;
235
- --border-special: #6b34ce;
236
- --border-special-medium: #8c5df8;
237
- --border-special-strong: #ac93ff;
238
- --text-special: #baa9ff;
239
- --text-special-secondary: #8665e0;
240
- --text-special-tertiary: #5c4e8b;
241
- --text-special-muted: #3e3a4f;
242
- --text-special-disabled: #303032;
243
243
  --color-info-100: #9adbff;
244
244
  --color-info-200: #4ebbf1;
245
245
  --color-info-300: #109bd4;
@@ -916,7 +916,6 @@
916
916
  backdrop-filter: blur(var(--blur-md));
917
917
  font-family: var(--font-mono);
918
918
  font-size: var(--font-size-xs);
919
- letter-spacing: var(--letter-spacing-wider);
920
919
  opacity: 0;
921
920
  pointer-events: none;
922
921
  }
@@ -949,7 +948,6 @@
949
948
  text-align: center;
950
949
  font-family: var(--font-mono);
951
950
  font-size: var(--font-size-xs);
952
- letter-spacing: var(--letter-spacing-wider);
953
951
  padding: 0 var(--space-4);
954
952
  }
955
953
 
@@ -212,7 +212,7 @@
212
212
  --sectiondivider-lg-eyebrow-font-family: var(--font-sans);
213
213
  --sectiondivider-lg-eyebrow-font-weight: var(--font-weight-medium);
214
214
  --sectiondivider-lg-eyebrow-font-size: var(--font-size-md);
215
- --sectiondivider-lg-eyebrow-letter-spacing: var(--letter-spacing-wide);
215
+ --sectiondivider-lg-eyebrow-letter-spacing: var(--letter-spacing-normal);
216
216
  --sectiondivider-lg-padding: var(--space-0);
217
217
  --sectiondivider-lg-title-padding: var(--space-2);
218
218
  --sectiondivider-lg-description-padding: var(--space-0);
@@ -243,7 +243,7 @@
243
243
  --sectiondivider-md-eyebrow-font-family: var(--font-sans);
244
244
  --sectiondivider-md-eyebrow-font-weight: var(--font-weight-medium);
245
245
  --sectiondivider-md-eyebrow-font-size: var(--font-size-sm);
246
- --sectiondivider-md-eyebrow-letter-spacing: var(--letter-spacing-wide);
246
+ --sectiondivider-md-eyebrow-letter-spacing: var(--letter-spacing-normal);
247
247
  --sectiondivider-md-padding: var(--space-0);
248
248
  --sectiondivider-md-title-padding: var(--space-2);
249
249
  --sectiondivider-md-description-padding: var(--space-0);
@@ -274,7 +274,7 @@
274
274
  --sectiondivider-sm-eyebrow-font-family: var(--font-sans);
275
275
  --sectiondivider-sm-eyebrow-font-weight: var(--font-weight-medium);
276
276
  --sectiondivider-sm-eyebrow-font-size: var(--font-size-xs);
277
- --sectiondivider-sm-eyebrow-letter-spacing: var(--letter-spacing-wide);
277
+ --sectiondivider-sm-eyebrow-letter-spacing: var(--letter-spacing-normal);
278
278
  --sectiondivider-sm-padding: var(--space-0);
279
279
  --sectiondivider-sm-title-padding: var(--space-2);
280
280
  --sectiondivider-sm-description-padding: var(--space-0);
@@ -546,7 +546,7 @@
546
546
  display: inline-flex;
547
547
  }
548
548
 
549
- /* Eyebrow visibility + uppercase flow from per-variant CSS vars. */
549
+ /* Eyebrow visibility + text transform flow from per-variant CSS vars. */
550
550
  .divider-eyebrow {
551
551
  display: var(--_divider-eyebrow-display);
552
552
  font-family: var(--_divider-eyebrow-font-family);