@motion-proto/live-tokens 0.12.1 → 0.13.1

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.
@@ -632,7 +632,7 @@ function themeFileApi(opts) {
632
632
  const COMPONENT_CONFIGS_DIR = dataDirs.componentConfigsDir;
633
633
  const MANIFESTS_DIR = dataDirs.manifestsDir;
634
634
  const CSS_PATH = import_path3.default.resolve(opts.tokensCssPath);
635
- const GENERATED_CSS_PATH = opts.tokensGeneratedCssPath ? import_path3.default.resolve(opts.tokensGeneratedCssPath) : import_path3.default.join(import_path3.default.dirname(CSS_PATH), "tokens.generated.css");
635
+ const GENERATED_CSS_PATH = opts.tokensGeneratedCssPath ? import_path3.default.resolve(opts.tokensGeneratedCssPath) : import_path3.default.join(dataDirs.dataDir, "tokens.generated.css");
636
636
  const FONTS_CSS_PATH = opts.fontsCssPath ? import_path3.default.resolve(opts.fontsCssPath) : import_path3.default.join(import_path3.default.dirname(CSS_PATH), "fonts.css");
637
637
  const API_BASE = opts.apiBase ?? "/api/live-tokens";
638
638
  const COMPONENTS_SRC_DIR = opts.componentsSrcDir ? import_path3.default.resolve(opts.componentsSrcDir) : import_path3.default.resolve("src/system/components");
@@ -595,7 +595,7 @@ function themeFileApi(opts) {
595
595
  const COMPONENT_CONFIGS_DIR = dataDirs.componentConfigsDir;
596
596
  const MANIFESTS_DIR = dataDirs.manifestsDir;
597
597
  const CSS_PATH = path3.resolve(opts.tokensCssPath);
598
- const GENERATED_CSS_PATH = opts.tokensGeneratedCssPath ? path3.resolve(opts.tokensGeneratedCssPath) : path3.join(path3.dirname(CSS_PATH), "tokens.generated.css");
598
+ const GENERATED_CSS_PATH = opts.tokensGeneratedCssPath ? path3.resolve(opts.tokensGeneratedCssPath) : path3.join(dataDirs.dataDir, "tokens.generated.css");
599
599
  const FONTS_CSS_PATH = opts.fontsCssPath ? path3.resolve(opts.fontsCssPath) : path3.join(path3.dirname(CSS_PATH), "fonts.css");
600
600
  const API_BASE = opts.apiBase ?? "/api/live-tokens";
601
601
  const COMPONENTS_SRC_DIR = opts.componentsSrcDir ? path3.resolve(opts.componentsSrcDir) : path3.resolve("src/system/components");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motion-proto/live-tokens",
3
- "version": "0.12.1",
3
+ "version": "0.13.1",
4
4
  "type": "module",
5
5
  "description": "Design token editor with live CSS variable editing. Svelte 5 + Vite 6/7.",
6
6
  "keywords": [
@@ -22,6 +22,7 @@
22
22
  "src/editor",
23
23
  "src/system",
24
24
  "src/app/site.css",
25
+ "src/live-tokens/data/tokens.generated.css",
25
26
  "dist-plugin",
26
27
  ".claude/skills",
27
28
  "bin",
@@ -71,7 +72,7 @@
71
72
  },
72
73
  "./styles/ui-editor.css": "./src/editor/styles/ui-editor.css",
73
74
  "./app/tokens.css": "./src/system/styles/tokens.css",
74
- "./app/tokens.generated.css": "./src/system/styles/tokens.generated.css",
75
+ "./app/tokens.generated.css": "./src/live-tokens/data/tokens.generated.css",
75
76
  "./app/site.css": "./src/app/site.css",
76
77
  "./app/fonts.css": "./src/system/styles/fonts.css"
77
78
  },
@@ -63,11 +63,20 @@
63
63
  });
64
64
 
65
65
  // The /components route renders the same component-editor surface as the
66
- // overlay's components view. Pair them: when the page is /components, flip
67
- // the overlay to tokens so the two surfaces don't stack.
66
+ // overlay's components view. Pair them: on entering /components, flip the
67
+ // overlay to tokens so the two surfaces don't stack. Fires only on route
68
+ // change, not on every editorView change — otherwise cross-window storage
69
+ // sync re-triggers the rule, which writes editorView, which fires another
70
+ // storage event, which fires the rule again. The result is heavy re-render
71
+ // cascades (the storage handler regularly took >1s in practice) and a
72
+ // visible flicker as the view bounces.
73
+ let prevRoute: string | undefined;
68
74
  run(() => {
69
- if ($route === '/components' && $editorView === 'components') {
70
- editorView.set('tokens');
75
+ const r = $route;
76
+ if (r === prevRoute) return;
77
+ prevRoute = r;
78
+ if (r === '/components') {
79
+ editorView.update((v) => (v === 'components' ? 'tokens' : v));
71
80
  }
72
81
  });
73
82