@motion-proto/live-tokens 0.89.2 → 0.90.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,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.90.1 — Sketch mode spares the editor overlay
4
+
5
+ ### Fixed
6
+
7
+ - **Sketch mode leaves the editor overlay's layout alone.** The layer picks
8
+ out components by bare class name, and the overlay's pull tab shares
9
+ TabBar's `.tab`. With a sketchstyle on, a pill docked to an edge lost its
10
+ tab's positioning and background, which left nothing on screen to pull it
11
+ back with. Every rule that paints or moves an element now skips anything
12
+ inside `[data-live-tokens-chrome]`. A sketch scope nested inside chrome
13
+ still draws, so a preview stage placed there keeps previewing. The guard
14
+ sits in `:where()` and adds no specificity, so page overrides of the layer
15
+ keep their order.
16
+
17
+ ## 0.90.0 — Thumbnail ratio for ImageLightbox
18
+
19
+ ### Added
20
+
21
+ - **ImageLightbox takes a `thumbAspect`.** The prop sets the thumbnail box's
22
+ ratio, such as `thumbAspect={4 / 3}`, and pairs with `fit="cover"` to crop
23
+ the thumbnail. The image still opens whole, at its own ratio. VideoLightbox
24
+ has had the same prop. A page no longer overrides the wrapper's inline
25
+ `aspect-ratio` with `!important`.
26
+
27
+ ### Fixed
28
+
29
+ - **A page's footer sits at the bottom of the page.** The router wrapper
30
+ added 12rem of padding under every page, in production as well as in dev,
31
+ so a footer ended above an empty band. The wrapper no longer pads the
32
+ page, and each page sets its own bottom spacing.
33
+
3
34
  ## 0.89.2 — Faster component tests
4
35
 
5
36
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motion-proto/live-tokens",
3
- "version": "0.89.2",
3
+ "version": "0.90.1",
4
4
  "type": "module",
5
5
  "description": "Design token editor with live CSS variable editing. Svelte 5 + Vite 8.",
6
6
  "keywords": [
@@ -370,6 +370,15 @@ const UNCLIPPED = PART_SPECS.filter((p) => !p.clips).map((p) => p.sel).join(', '
370
370
  const CLIPPED = PART_SPECS.filter((p) => p.clips).map((p) => p.sel).join(', ');
371
371
  const UNMASKED = PART_SPECS.filter((p) => p.unmasked).map((p) => p.sel).join(', ');
372
372
 
373
+ /** Keeps the layer off the editor's own UI on the host page. The part
374
+ selectors are bare class names, and the overlay's `.tab` matched TabBar's:
375
+ the docked pill lost its positioning and its pull tab drew invisible. A
376
+ scope nested inside chrome draws again, so a preview stage placed there
377
+ still previews. `:where` adds no weight, so overrides keep their order. */
378
+ const OUTSIDE_CHROME =
379
+ ':where(:not([data-live-tokens-chrome], [data-live-tokens-chrome] *),' +
380
+ ' [data-live-tokens-chrome] [data-sketch] *)';
381
+
373
382
  export function buildDefsMarkup(s: SketchStyleSettings): string {
374
383
  /**
375
384
  * `warp` is the shape stage: one wave of noise whose wavelength spans a whole
@@ -697,9 +706,9 @@ const WARP_FREQUENCY = 0.08;
697
706
 
698
707
  export function buildStylesheet(s: SketchStyleSettings): string {
699
708
  const on = '[data-sketch]';
700
- const parts = `:is(${PARTS})`;
709
+ const parts = `:is(${PARTS})${OUTSIDE_CHROME}`;
701
710
  const el = `${on} ${parts}`;
702
- const strokeEl = `${on} :is(${STROKE_PARTS})`;
711
+ const strokeEl = `${on} :is(${STROKE_PARTS})${OUTSIDE_CHROME}`;
703
712
 
704
713
  // `--radius-none` is a bare `0`, so a part the theme leaves square hands the
705
714
  // corner maths a number where it needs a length: `calc(0 + 0.95 * 16px)` is
@@ -780,7 +789,7 @@ export function buildStylesheet(s: SketchStyleSettings): string {
780
789
  const iconSel = `[class*="fa-"], svg:not([${DEFS_ATTR}])`;
781
790
  const iconsOn = s.iconTravel > 0 || s.iconMaskOn;
782
791
  const icons = iconsOn
783
- ? `${on} :is(${iconSel}){` +
792
+ ? `${on} :is(${iconSel})${OUTSIDE_CHROME}{` +
784
793
  (s.iconTravel > 0
785
794
  ? `filter:var(--sketch-icon-off, var(--sketch-icon-filter, url(#${ID}-icon-0)));`
786
795
  : '') +
@@ -876,14 +885,14 @@ export function buildStylesheet(s: SketchStyleSettings): string {
876
885
  `background:transparent !important;border-color:transparent !important;` +
877
886
  `box-shadow:none !important;` +
878
887
  `}` +
879
- `${on} :is(${UNCLIPPED}){overflow:visible !important;}` +
888
+ `${on} :is(${UNCLIPPED})${OUTSIDE_CHROME}{overflow:visible !important;}` +
880
889
  // The five that keep their clip take the drawn radii on the host, so what
881
890
  // the clip cuts turns the same way the ink does at the corners. It cannot
882
891
  // follow the displacement, which is a filter and has no geometry to clip to.
883
892
  `${el}:is(${CLIPPED}){${corners}}` +
884
893
  // Only parts that sit in flow. Forcing this onto an absolutely-positioned
885
894
  // part would drop it back to its flow position.
886
- `${on} :is(${FLOW_PARTS}){position:relative;}`;
895
+ `${on} :is(${FLOW_PARTS})${OUTSIDE_CHROME}{position:relative;}`;
887
896
 
888
897
  // Fill layer. Own seed, own offset, sits behind the content.
889
898
  //
@@ -988,7 +997,7 @@ export function buildStylesheet(s: SketchStyleSettings): string {
988
997
  // per-instance cycle as the fill offset, so no two components retrace alike.
989
998
  const retraceStep = s.retraceOffset.toFixed(2);
990
999
  const retrace = s.retracePass === 'copy'
991
- ? `[data-sketch][data-sketch-passes='double'] :is(${STROKE_PARTS})::after{` +
1000
+ ? `[data-sketch][data-sketch-passes='double'] :is(${STROKE_PARTS})${OUTSIDE_CHROME}::after{` +
992
1001
  `--sketch-retrace:drop-shadow(` +
993
1002
  `calc(var(--sketch-jx, 0.6) * ${retraceStep}px)` +
994
1003
  ` calc(var(--sketch-jy, -0.4) * ${retraceStep}px)` +
@@ -647,14 +647,13 @@
647
647
  /* Desktop: lock the docs surface to the viewport so only the content column
648
648
  scrolls — the rail is full-height and immovable, and there is never an
649
649
  empty band under the page. The router wrapper (.lt-app) assumes window-
650
- scroll pages (min-height + a 12rem bottom pad); neutralise that here, for
650
+ scroll pages (min-height); neutralise that here, for
651
651
  the docs route only, via :has. The doubled .lt-app outranks the wrapper's
652
652
  own scoped rule on a specificity tie. */
653
653
  @media (min-width: 961px) {
654
654
  :global(.lt-app.lt-app:has(.docs-page)) {
655
655
  height: 100vh;
656
656
  min-height: 0;
657
- padding-bottom: 0;
658
657
  overflow: hidden;
659
658
  }
660
659
  .docs-page { height: 100%; overflow: hidden; }
@@ -297,7 +297,6 @@
297
297
  width: 100%;
298
298
  min-height: 100vh;
299
299
  color: var(--text-primary);
300
- padding-bottom: 12rem;
301
300
  /* Set by LiveEditorOverlay when docked-open. Extends layout past the
302
301
  fixed panel so the viewport can scroll to reveal hidden content. */
303
302
  padding-right: var(--lt-overlay-scroll-pad, 0px);
@@ -305,14 +304,12 @@
305
304
 
306
305
  .lt-app.is-editor,
307
306
  .lt-app.is-colors {
308
- padding-bottom: 0;
309
307
  background: black;
310
308
  }
311
309
 
312
310
  .lt-app.is-component-editor {
313
311
  min-height: 0;
314
312
  height: 100vh;
315
- padding-bottom: 0;
316
313
  padding-right: 0;
317
314
  background: black;
318
315
  overflow: hidden;
@@ -9,6 +9,10 @@
9
9
  { when: 'a video clip the reader opens from its still.', use: 'videolightbox' },
10
10
  { when: 'slides or pages the reader reads in order.', use: 'slidepager' },
11
11
  ],
12
+ props: {
13
+ thumbAspect:
14
+ 'the ratio the thumbnail box holds, when it should not be the image\'s own. The image still opens whole, at its own ratio.',
15
+ },
12
16
  } satisfies CatalogueEntry;
13
17
  </script>
14
18
 
@@ -33,10 +37,12 @@
33
37
  single-entry array behaves exactly like a lone `src`. */
34
38
  images?: GalleryImage[];
35
39
  maxWidth?: number | string | undefined;
40
+ /** The thumbnail box's ratio, when it differs from the image's own. */
41
+ thumbAspect?: number | undefined;
36
42
  /** Closed-thumbnail object-fit. `cover` crops the thumbnail to fill its box;
37
43
  the expanded modal always uses `contain` so the whole image stays visible.
38
- `cover` only crops when the thumbnail has its own box (an aspect from
39
- `width`/`height`, or a CSS-constrained container). */
44
+ `cover` only crops when the thumbnail box differs from the image's shape
45
+ (a `thumbAspect`, or a CSS-constrained container). */
40
46
  fit?: 'contain' | 'cover';
41
47
  /** Where the tile's shadow lands. Both modes read
42
48
  `--imagelightbox-tile-shadow`: `box` casts it from the tile's rectangle,
@@ -94,6 +100,7 @@
94
100
  height = undefined,
95
101
  images = undefined,
96
102
  maxWidth = undefined,
103
+ thumbAspect = undefined,
97
104
  fit = 'contain',
98
105
  shadow = 'box',
99
106
  surface = undefined,
@@ -188,7 +195,7 @@
188
195
  return m ? m.w / m.h : undefined;
189
196
  };
190
197
  const naturalWidthOf = (it?: GalleryImage) => (it ? (it.width ?? measured[it.src]?.w) : undefined);
191
- const coverAspect = $derived(aspectOf(cover)); // inline thumbnail box
198
+ const tileAspect = $derived(thumbAspect ?? aspectOf(cover));
192
199
  const aspect = $derived(aspectOf(current)); // open modal box
193
200
 
194
201
  // Internal `scale` is relative to the fitted stage, so a natural-size cap is
@@ -620,7 +627,7 @@
620
627
 
621
628
  <div
622
629
  class="image-lightbox-wrapper"
623
- style:aspect-ratio={coverAspect ? `${coverAspect}` : undefined}
630
+ style:aspect-ratio={tileAspect ? `${tileAspect}` : undefined}
624
631
  style:max-width={typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth}
625
632
  >
626
633
  <button