@motion-proto/live-tokens 0.47.1 → 0.48.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 (116) hide show
  1. package/.claude/skills/live-tokens-adjust-shape-space/SKILL.md +68 -0
  2. package/.claude/skills/live-tokens-create-component/SKILL.md +2 -2
  3. package/.claude/skills/live-tokens-generate-theme/SKILL.md +152 -0
  4. package/CHANGELOG.md +270 -0
  5. package/README.md +37 -26
  6. package/bin/adjust.mjs +254 -0
  7. package/bin/cli.mjs +94 -7
  8. package/bin/generate-theme.mjs +251 -0
  9. package/bin/migrate.mjs +95 -6
  10. package/dist-plugin/adjust/index.cjs +259 -0
  11. package/dist-plugin/adjust/index.d.cts +45 -0
  12. package/dist-plugin/adjust/index.d.ts +45 -0
  13. package/dist-plugin/adjust/index.js +176 -0
  14. package/dist-plugin/{chunk-H4TRUINI.js → chunk-44RSTAII.js} +0 -48
  15. package/dist-plugin/chunk-6OZFXIQI.js +316 -0
  16. package/dist-plugin/chunk-76TFDTJO.js +556 -0
  17. package/dist-plugin/chunk-D3ZVKOR4.js +52 -0
  18. package/dist-plugin/dataPaths-DBN0RPuT.d.cts +54 -0
  19. package/dist-plugin/dataPaths-DBN0RPuT.d.ts +54 -0
  20. package/dist-plugin/generateColorsAndType/index.cjs +1781 -0
  21. package/dist-plugin/generateColorsAndType/index.d.cts +81 -0
  22. package/dist-plugin/generateColorsAndType/index.d.ts +81 -0
  23. package/dist-plugin/generateColorsAndType/index.js +1210 -0
  24. package/dist-plugin/index.cjs +849 -531
  25. package/dist-plugin/index.d.cts +3 -2
  26. package/dist-plugin/index.d.ts +3 -2
  27. package/dist-plugin/index.js +658 -1132
  28. package/dist-plugin/migrateData/index.cjs +728 -0
  29. package/dist-plugin/migrateData/index.d.cts +60 -0
  30. package/dist-plugin/migrateData/index.d.ts +60 -0
  31. package/dist-plugin/migrateData/index.js +348 -0
  32. package/dist-plugin/themeTypes-DMHZOnUn.d.cts +211 -0
  33. package/dist-plugin/themeTypes-DMHZOnUn.d.ts +211 -0
  34. package/dist-plugin/tokensCssMigrations/index.cjs +2 -1
  35. package/dist-plugin/tokensCssMigrations/index.d.cts +3 -15
  36. package/dist-plugin/tokensCssMigrations/index.d.ts +3 -15
  37. package/dist-plugin/tokensCssMigrations/index.js +4 -2
  38. package/package.json +18 -4
  39. package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +183 -158
  40. package/src/editor/component-editor/scaffolding/ComponentFileMenu.svelte +0 -4
  41. package/src/editor/component-editor/scaffolding/SaveAsDialog.svelte +4 -4
  42. package/src/editor/component-editor/scaffolding/TokenLayout.svelte +2 -59
  43. package/src/editor/component-editor/scaffolding/VariantGroup.svelte +1 -1
  44. package/src/editor/core/components/adjustAliases.ts +180 -0
  45. package/src/editor/core/components/aliasKinds.ts +73 -0
  46. package/src/editor/core/components/componentConfigService.ts +26 -38
  47. package/src/editor/core/flashStatus.ts +1 -1
  48. package/src/editor/core/fonts/fontMigration.ts +13 -13
  49. package/src/editor/core/fonts/fontPairing.ts +35 -0
  50. package/src/editor/core/palettes/paletteDerivation.ts +83 -13
  51. package/src/editor/core/preview/lookPreview.ts +141 -0
  52. package/src/editor/core/productionPulse.ts +34 -21
  53. package/src/editor/core/storage/files/versionedFileResourceClient.ts +18 -45
  54. package/src/editor/core/store/editorConfigStore.ts +2 -2
  55. package/src/editor/core/store/editorPersistence.ts +0 -1
  56. package/src/editor/core/store/editorStore.ts +114 -51
  57. package/src/editor/core/store/editorTypes.ts +0 -1
  58. package/src/editor/core/store/gradientSource.ts +2 -2
  59. package/src/editor/core/themes/colorsAndTypeService.ts +95 -0
  60. package/src/editor/core/themes/generateColorsAndType.ts +433 -0
  61. package/src/editor/core/themes/loadRows.ts +64 -0
  62. package/src/editor/core/themes/lookSummary.ts +75 -0
  63. package/src/editor/core/themes/migrations/2026-04-24-legacy-keys-and-bg-to-canvas.ts +3 -3
  64. package/src/editor/core/themes/migrations/2026-05-13-primary-to-brand.ts +2 -2
  65. package/src/editor/core/themes/migrations/2026-05-26-drop-overlay-extra-stops.ts +3 -3
  66. package/src/editor/core/themes/migrations/2026-08-13-drop-legacy-shape-space-keys.ts +38 -0
  67. package/src/editor/core/themes/migrations/2026-08-15-line-height-scale-rename.ts +57 -0
  68. package/src/editor/core/themes/migrations/index.ts +19 -11
  69. package/src/editor/core/themes/slices/components.ts +4 -4
  70. package/src/editor/core/themes/slices/fonts.ts +1 -1
  71. package/src/editor/core/themes/slices/gradients.ts +22 -0
  72. package/src/editor/core/themes/slices/palettes.ts +2 -2
  73. package/src/editor/core/themes/themeInit.ts +21 -29
  74. package/src/editor/core/themes/themeService.ts +218 -78
  75. package/src/editor/core/themes/themeTypes.ts +94 -51
  76. package/src/editor/docs/Docs.svelte +1 -0
  77. package/src/editor/docs/chapters.ts +1 -0
  78. package/src/editor/docs/content/01-overview.md +1 -1
  79. package/src/editor/docs/content/editing-tokens.md +6 -6
  80. package/src/editor/docs/content/getting-started.md +9 -7
  81. package/src/editor/docs/content/themes-workflow.md +74 -34
  82. package/src/editor/docs/content/where-themes-live.md +61 -0
  83. package/src/editor/docs/content.generated.ts +5 -4
  84. package/src/editor/index.ts +27 -27
  85. package/src/editor/pages/ComponentEditorPage.svelte +2 -2
  86. package/src/editor/pages/EditorShell.svelte +4 -30
  87. package/src/editor/ui/FileLoadList.svelte +67 -7
  88. package/src/editor/ui/GradientEditor.svelte +3 -3
  89. package/src/editor/ui/ThemePanel.svelte +1067 -0
  90. package/src/editor/ui/UIDialog.svelte +11 -9
  91. package/src/editor/ui/index.ts +4 -2
  92. package/src/live-tokens/data/colors-and-type/autumn.json +2490 -0
  93. package/src/live-tokens/data/{themes → colors-and-type}/default.json +962 -549
  94. package/src/live-tokens/data/colors-and-type/halloween.json +2529 -0
  95. package/src/live-tokens/data/colors-and-type/midnight-study.json +2536 -0
  96. package/src/live-tokens/data/colors-and-type/ocean.json +2489 -0
  97. package/src/live-tokens/data/colors-and-type/royal-velvet.json +2520 -0
  98. package/src/live-tokens/data/colors-and-type/spring-meadow.json +2476 -0
  99. package/src/live-tokens/data/colors-and-type/sunset.json +2528 -0
  100. package/src/live-tokens/data/themes/autumn.json +3918 -0
  101. package/src/live-tokens/data/themes/halloween.json +3992 -0
  102. package/src/live-tokens/data/themes/midnight-study.json +3932 -0
  103. package/src/live-tokens/data/themes/ocean.json +3917 -0
  104. package/src/live-tokens/data/themes/royal-velvet.json +3983 -0
  105. package/src/live-tokens/data/themes/spring-meadow.json +3904 -0
  106. package/src/live-tokens/data/themes/sunset.json +3931 -0
  107. package/src/live-tokens/data/tokens.generated.css +129 -140
  108. package/src/system/styles/CONVENTIONS.md +1 -1
  109. package/src/system/styles/fonts.css +1 -1
  110. package/template/README.md +7 -5
  111. package/template/_gitignore +0 -6
  112. package/src/editor/core/components/componentPersist.ts +0 -62
  113. package/src/editor/core/manifests/manifestService.ts +0 -172
  114. package/src/editor/ui/ManifestFileManager.svelte +0 -446
  115. package/src/editor/ui/ThemeFileManager.svelte +0 -785
  116. package/src/live-tokens/data/manifests/default.json +0 -35
@@ -0,0 +1,81 @@
1
+ import { F as FontSource, b as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, C as ColorsAndType } from '../themeTypes-DMHZOnUn.cjs';
2
+ export { r as readLiveTokensConfig, a as resolveDataDirs } from '../dataPaths-DBN0RPuT.cjs';
3
+
4
+ /**
5
+ * Pure palette → CSS-variable derivation.
6
+ *
7
+ * Mirrors the logic that previously lived only inside `PaletteEditor.svelte`'s
8
+ * reactive emission, but as standalone functions so the editor store can emit
9
+ * palette-derived vars at boot without requiring any editor component to be
10
+ * mounted. Without this module the disabled-state preview (and any other
11
+ * `var(--surface-neutral)` consumer) reads a stale value on reload until the
12
+ * user opens the LiveEditorOverlay and mounts the PaletteEditors.
13
+ *
14
+ * The PaletteEditor still owns *editing* preview (draft hex picked but not
15
+ * yet committed to overrides). Once committed via the store, this module
16
+ * derives the same CSS vars from the persisted config.
17
+ */
18
+
19
+ type SchemeDirection = 'light' | 'dark';
20
+
21
+ /**
22
+ * Brief → generator: a full ColorsAndType from 10 OKLCH seeds + a scheme, with
23
+ * AA floors enforced on derived text tokens. Seed *selection* lives in the
24
+ * live-tokens-generate-theme skill; the CLI reaches this via
25
+ * `dist-plugin/generateColorsAndType`, so keep this module Node-safe (no DOM).
26
+ */
27
+
28
+ interface ColorsAndTypeBrief {
29
+ name: string;
30
+ scheme: SchemeDirection;
31
+ /** One seed per palette label (all 10 required); hex string or numeric OKLCH. */
32
+ seeds: Record<string, Oklch | string>;
33
+ /** Advisory record of the harmony reasoning; seeds stay ground truth. */
34
+ harmony?: {
35
+ mode: HarmonyMode;
36
+ };
37
+ /** Page-background sky. Off by default; the skill turns it on only when the
38
+ * mood brief evokes atmosphere. The engine derives the stops itself, on the
39
+ * scheme's safe side of the Canvas anchor. */
40
+ canvasGradient?: boolean;
41
+ }
42
+ /** Non-color content carried forward from the currently active colors and type
43
+ * so gradients, shadows, component aliases, and fonts survive regeneration. */
44
+ interface CarryForward {
45
+ cssVariables?: Record<string, string>;
46
+ fontSources?: FontSource[];
47
+ fontStacks?: FontStack[];
48
+ gradients?: GradientDiskToken[];
49
+ }
50
+ interface ContrastCheck {
51
+ textVar: string;
52
+ floor: number;
53
+ /** Worst (lowest-ratio) surface this text was checked against. */
54
+ against: string;
55
+ ratio: number;
56
+ pass: boolean;
57
+ corrected: boolean;
58
+ }
59
+ interface GenerateColorsAndTypeReport {
60
+ scheme: SchemeDirection;
61
+ checks: ContrastCheck[];
62
+ failures: string[];
63
+ /** 'recipes' when the engine replaced absent/stock swatch gradients with the
64
+ * family-relative recipes; 'carried' when user-tuned ones rode through. */
65
+ gradients: 'recipes' | 'carried';
66
+ /** Present when the brief opted into the page-background sky: either
67
+ * 'on, <sky> → <anchor>' or a 'skipped — …' explanation when the Canvas
68
+ * anchors at the ramp edge and leaves no room. */
69
+ canvasGradient?: string;
70
+ }
71
+ interface GenerateColorsAndTypeResult {
72
+ colorsAndType: ColorsAndType;
73
+ slug: string;
74
+ report: GenerateColorsAndTypeReport;
75
+ }
76
+ declare function buildColorsAndTypeFromSeeds(brief: ColorsAndTypeBrief, carry?: CarryForward, now?: string): GenerateColorsAndTypeResult;
77
+
78
+ /** Sanitize a display name to a safe file name. Pure — no DOM, no fs. */
79
+ declare function sanitizeFileName(name: string): string;
80
+
81
+ export { type CarryForward, type ColorsAndTypeBrief, type ContrastCheck, type GenerateColorsAndTypeReport, type GenerateColorsAndTypeResult, buildColorsAndTypeFromSeeds, sanitizeFileName };
@@ -0,0 +1,81 @@
1
+ import { F as FontSource, b as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, C as ColorsAndType } from '../themeTypes-DMHZOnUn.js';
2
+ export { r as readLiveTokensConfig, a as resolveDataDirs } from '../dataPaths-DBN0RPuT.js';
3
+
4
+ /**
5
+ * Pure palette → CSS-variable derivation.
6
+ *
7
+ * Mirrors the logic that previously lived only inside `PaletteEditor.svelte`'s
8
+ * reactive emission, but as standalone functions so the editor store can emit
9
+ * palette-derived vars at boot without requiring any editor component to be
10
+ * mounted. Without this module the disabled-state preview (and any other
11
+ * `var(--surface-neutral)` consumer) reads a stale value on reload until the
12
+ * user opens the LiveEditorOverlay and mounts the PaletteEditors.
13
+ *
14
+ * The PaletteEditor still owns *editing* preview (draft hex picked but not
15
+ * yet committed to overrides). Once committed via the store, this module
16
+ * derives the same CSS vars from the persisted config.
17
+ */
18
+
19
+ type SchemeDirection = 'light' | 'dark';
20
+
21
+ /**
22
+ * Brief → generator: a full ColorsAndType from 10 OKLCH seeds + a scheme, with
23
+ * AA floors enforced on derived text tokens. Seed *selection* lives in the
24
+ * live-tokens-generate-theme skill; the CLI reaches this via
25
+ * `dist-plugin/generateColorsAndType`, so keep this module Node-safe (no DOM).
26
+ */
27
+
28
+ interface ColorsAndTypeBrief {
29
+ name: string;
30
+ scheme: SchemeDirection;
31
+ /** One seed per palette label (all 10 required); hex string or numeric OKLCH. */
32
+ seeds: Record<string, Oklch | string>;
33
+ /** Advisory record of the harmony reasoning; seeds stay ground truth. */
34
+ harmony?: {
35
+ mode: HarmonyMode;
36
+ };
37
+ /** Page-background sky. Off by default; the skill turns it on only when the
38
+ * mood brief evokes atmosphere. The engine derives the stops itself, on the
39
+ * scheme's safe side of the Canvas anchor. */
40
+ canvasGradient?: boolean;
41
+ }
42
+ /** Non-color content carried forward from the currently active colors and type
43
+ * so gradients, shadows, component aliases, and fonts survive regeneration. */
44
+ interface CarryForward {
45
+ cssVariables?: Record<string, string>;
46
+ fontSources?: FontSource[];
47
+ fontStacks?: FontStack[];
48
+ gradients?: GradientDiskToken[];
49
+ }
50
+ interface ContrastCheck {
51
+ textVar: string;
52
+ floor: number;
53
+ /** Worst (lowest-ratio) surface this text was checked against. */
54
+ against: string;
55
+ ratio: number;
56
+ pass: boolean;
57
+ corrected: boolean;
58
+ }
59
+ interface GenerateColorsAndTypeReport {
60
+ scheme: SchemeDirection;
61
+ checks: ContrastCheck[];
62
+ failures: string[];
63
+ /** 'recipes' when the engine replaced absent/stock swatch gradients with the
64
+ * family-relative recipes; 'carried' when user-tuned ones rode through. */
65
+ gradients: 'recipes' | 'carried';
66
+ /** Present when the brief opted into the page-background sky: either
67
+ * 'on, <sky> → <anchor>' or a 'skipped — …' explanation when the Canvas
68
+ * anchors at the ramp edge and leaves no room. */
69
+ canvasGradient?: string;
70
+ }
71
+ interface GenerateColorsAndTypeResult {
72
+ colorsAndType: ColorsAndType;
73
+ slug: string;
74
+ report: GenerateColorsAndTypeReport;
75
+ }
76
+ declare function buildColorsAndTypeFromSeeds(brief: ColorsAndTypeBrief, carry?: CarryForward, now?: string): GenerateColorsAndTypeResult;
77
+
78
+ /** Sanitize a display name to a safe file name. Pure — no DOM, no fs. */
79
+ declare function sanitizeFileName(name: string): string;
80
+
81
+ export { type CarryForward, type ColorsAndTypeBrief, type ContrastCheck, type GenerateColorsAndTypeReport, type GenerateColorsAndTypeResult, buildColorsAndTypeFromSeeds, sanitizeFileName };