@motion-proto/live-tokens 0.42.0 → 0.43.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.43.0 — The editor opens on Tokens
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **The editor's view no longer carries across sessions.** Opening the editor in
|
|
8
|
+
a fresh tab always lands on Tokens; previously it restored whichever of
|
|
9
|
+
Tokens / Colors / Components you last used, so a session that ended on Colors
|
|
10
|
+
reopened there indefinitely. `editorViewStore` moved the active view from
|
|
11
|
+
`localStorage` to `sessionStorage`, which keeps the two things that did depend
|
|
12
|
+
on the round-trip: the parent window and the overlay iframe stay in sync (same
|
|
13
|
+
tab, same origin, so they share one storage area and its `storage` events),
|
|
14
|
+
and an in-page deep link that calls `setEditorView()` before opening the
|
|
15
|
+
overlay still lands on the view it asked for. The sidebar's condensed/expanded
|
|
16
|
+
state is a durable preference and stays in `localStorage`. A stale
|
|
17
|
+
`lt.editorView` left in `localStorage` by an earlier version is ignored, not
|
|
18
|
+
migrated.
|
|
19
|
+
|
|
3
20
|
## 0.42.0 — Canvas, and every ramp places its base color
|
|
4
21
|
|
|
5
22
|
### Changed (breaking)
|
package/package.json
CHANGED
|
@@ -10,9 +10,14 @@ function isEditorView(v: unknown): v is EditorView {
|
|
|
10
10
|
return v === 'tokens' || v === 'components' || v === 'colors';
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
// Session-scoped, not persistent: opening the editor fresh always starts on
|
|
14
|
+
// Tokens. Within a session it still round-trips, which is what the parent
|
|
15
|
+
// window / overlay iframe pair and in-page deep links (setEditorView before
|
|
16
|
+
// opening the overlay) rely on — same-origin frames in a tab share one
|
|
17
|
+
// sessionStorage area and its `storage` events.
|
|
13
18
|
function readView(): EditorView {
|
|
14
19
|
try {
|
|
15
|
-
const v =
|
|
20
|
+
const v = sessionStorage.getItem(VIEW_KEY);
|
|
16
21
|
if (isEditorView(v)) return v;
|
|
17
22
|
} catch {}
|
|
18
23
|
return 'tokens';
|
|
@@ -32,14 +37,14 @@ export const sidebarCondensed = writable<SidebarCondensed>(readCondensed());
|
|
|
32
37
|
export const selectedComponent = writable<string>('button');
|
|
33
38
|
|
|
34
39
|
editorView.subscribe((v) => {
|
|
35
|
-
try {
|
|
40
|
+
try { sessionStorage.setItem(VIEW_KEY, v); } catch {}
|
|
36
41
|
});
|
|
37
42
|
|
|
38
43
|
sidebarCondensed.subscribe((v) => {
|
|
39
44
|
try { localStorage.setItem(CONDENSED_KEY, v === 'auto' ? 'auto' : String(v)); } catch {}
|
|
40
45
|
});
|
|
41
46
|
|
|
42
|
-
// Cross-window sync: parent and overlay iframe share
|
|
47
|
+
// Cross-window sync: parent and overlay iframe share web storage but each have
|
|
43
48
|
// their own module state. `storage` events fire in the *other* window when one
|
|
44
49
|
// writes, so we mirror the new value into this window's store.
|
|
45
50
|
if (typeof window !== 'undefined') {
|