@motion-proto/live-tokens 0.13.0 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motion-proto/live-tokens",
3
- "version": "0.13.0",
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": [
@@ -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