@motion-proto/live-tokens 0.46.0 → 0.46.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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.46.1 — The Colors view collapses on its own width
4
+
5
+ ### Fixed
6
+
7
+ - **Colors view collapses by pane width, not viewport width.** `.pane` is now a
8
+ `container: pane / inline-size`, and the harmony columns (`44rem`) and wheel
9
+ rail (`26rem`) collapse against it. The pane is one column of a two-pane grid,
10
+ so a wide standalone window narrowed it just as the docked panel does while
11
+ the old `@media (max-width: 720px)` query never fired.
12
+
13
+ - **Swatch rows and derived-scale strips rank instead of shrinking to slivers.**
14
+ Below `28rem` of their own container both switch from flex to
15
+ `repeat(auto-fill, minmax(...))` grids, keeping a readable chip width and
16
+ wrapping into ranks. `auto-fill` holds the tracks steady, so a short last rank
17
+ never stretches.
18
+
19
+ - **`UIMenuButton` anchors correctly inside a container-type ancestor.** A
20
+ `container-type` (or transformed) ancestor re-parents a fixed element's
21
+ containing block off the viewport origin, so the menu landed offset from its
22
+ computed position. It now measures where it landed and re-anchors.
23
+
3
24
  ## 0.46.0 — Harmony axes are numbered, and you assign them with a picker
4
25
 
5
26
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motion-proto/live-tokens",
3
- "version": "0.46.0",
3
+ "version": "0.46.1",
4
4
  "type": "module",
5
5
  "description": "Design token editor with live CSS variable editing. Svelte 5 + Vite 8.",
6
6
  "keywords": [
@@ -120,6 +120,14 @@
120
120
  }
121
121
  menu.style.left = `${left}px`;
122
122
  menu.style.top = `${top}px`;
123
+ // A container-type (or transformed) ancestor re-parents the fixed
124
+ // containing block off the viewport origin; measure where the menu landed
125
+ // and re-anchor so the viewport math above still holds.
126
+ const placed = menu.getBoundingClientRect();
127
+ if (Math.abs(placed.left - left) > 0.5 || Math.abs(placed.top - top) > 0.5) {
128
+ menu.style.left = `${left - (placed.left - left)}px`;
129
+ menu.style.top = `${top - (placed.top - top)}px`;
130
+ }
123
131
  menu.style.visibility = 'visible';
124
132
  }
125
133
 
@@ -339,7 +339,11 @@
339
339
  }
340
340
  }
341
341
 
342
+ /* The pane is one column of a two-pane grid, so it goes narrow on a wide
343
+ standalone window just as it does in the docked panel. Every collapse
344
+ below keys on the pane's own width, never the viewport's. */
342
345
  .pane {
346
+ container: pane / inline-size;
343
347
  display: flex;
344
348
  flex-direction: column;
345
349
  gap: var(--ui-space-32);
@@ -434,9 +438,8 @@
434
438
  gap: var(--ui-space-6);
435
439
  }
436
440
 
437
- /* The docked panel's iframe viewport is the panel itself, so this collapse
438
- fires there long before the standalone page ever gets this narrow. */
439
- @media (max-width: 720px) {
441
+ /* Below this the three columns squeeze the swatches into slivers. */
442
+ @container pane (max-width: 44rem) {
440
443
  .harmony-cols {
441
444
  grid-template-columns: minmax(0, 1fr);
442
445
  }
@@ -446,8 +449,10 @@
446
449
  justify-content: center;
447
450
  transform: rotate(90deg);
448
451
  }
452
+ }
449
453
 
450
- /* Below the wheel's minimum the rail is taller than the disc it flanks. */
454
+ /* Below the wheel's minimum the rail is taller than the disc it flanks. */
455
+ @container pane (max-width: 26rem) {
451
456
  .wheel-row {
452
457
  flex-direction: column;
453
458
  align-items: stretch;
@@ -572,6 +577,7 @@
572
577
  }
573
578
 
574
579
  .swatch-rows {
580
+ container: swatches / inline-size;
575
581
  display: flex;
576
582
  flex-direction: column;
577
583
  gap: var(--ui-space-8);
@@ -593,6 +599,17 @@
593
599
  outline-color: var(--ui-text-primary);
594
600
  }
595
601
 
602
+ /* Too narrow for one swatch per family: wrap into ranks that keep a readable
603
+ swatch width rather than shrinking toward slivers. auto-fill keeps every
604
+ rank on the same tracks, so a short last rank never stretches. */
605
+ @container swatches (max-width: 28rem) {
606
+ .swatch-row {
607
+ display: grid;
608
+ grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
609
+ gap: var(--ui-space-8);
610
+ }
611
+ }
612
+
596
613
  /* Every swatch keeps one width: selection reads in the frame's height alone,
597
614
  so nothing in the row shifts sideways as the selection moves. */
598
615
  .swatch {
@@ -51,33 +51,51 @@
51
51
  }
52
52
  </script>
53
53
 
54
- <div class="strip" role="group" aria-label={`${spec.label} derived scale`}>
55
- {#each steps as s, i (s.label)}
56
- <div
57
- class="spot"
58
- class:anchored={anchoredStep === i}
59
- class:background={backgroundStep === i}
60
- style:flex-grow={dockGrow(i, anchoredStep)}
61
- title={stepTitle(s, i)}
62
- >
63
- <span class="chip" style:background={s.hex}>
64
- <span class="aa" class:fail={!s.aa} style:color={s.textHex}>Aa</span>
65
- </span>
66
- <span class="step-label">{s.label}</span>
67
- </div>
68
- {/each}
54
+ <div class="strip-viewport">
55
+ <div class="strip" role="group" aria-label={`${spec.label} derived scale`}>
56
+ {#each steps as s, i (s.label)}
57
+ <div
58
+ class="spot"
59
+ class:anchored={anchoredStep === i}
60
+ class:background={backgroundStep === i}
61
+ style:flex-grow={dockGrow(i, anchoredStep)}
62
+ title={stepTitle(s, i)}
63
+ >
64
+ <span class="chip" style:background={s.hex}>
65
+ <span class="aa" class:fail={!s.aa} style:color={s.textHex}>Aa</span>
66
+ </span>
67
+ <span class="step-label">{s.label}</span>
68
+ </div>
69
+ {/each}
70
+ </div>
69
71
  </div>
70
72
  {#if isGradient}
71
73
  <p class="hint">The page background is currently a gradient; the base color takes over when gradient mode is off.</p>
72
74
  {/if}
73
75
 
74
76
  <style>
77
+ .strip-viewport {
78
+ container: strip / inline-size;
79
+ min-width: 0;
80
+ }
81
+
75
82
  .strip {
76
83
  display: flex;
77
84
  align-items: flex-end;
78
85
  gap: var(--ui-space-4);
79
86
  }
80
87
 
88
+ /* Eleven steps shrink to slivers before the pane is done narrowing: below
89
+ that, rank the chips on a grid that keeps a readable width. Grid ignores
90
+ the dock-magnify flex-grow, so the anchored step reads by height alone. */
91
+ @container strip (max-width: 28rem) {
92
+ .strip {
93
+ display: grid;
94
+ grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr));
95
+ gap: var(--ui-space-8) var(--ui-space-4);
96
+ }
97
+ }
98
+
81
99
  .spot {
82
100
  flex: 1 1 0;
83
101
  min-width: 0;