@motion-proto/live-tokens 0.88.0 → 0.89.2

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/package.json +1 -1
  3. package/src/editor/component-editor/ImageEditor.svelte +25 -14
  4. package/src/live-tokens/data/themes/autumn.json +4 -0
  5. package/src/live-tokens/data/themes/halloween.json +4 -0
  6. package/src/live-tokens/data/themes/midnight-study.json +4 -0
  7. package/src/live-tokens/data/themes/ocean.json +4 -0
  8. package/src/live-tokens/data/themes/royal-velvet.json +4 -0
  9. package/src/live-tokens/data/themes/sketchy.json +4 -0
  10. package/src/live-tokens/data/themes/spring-meadow.json +4 -0
  11. package/src/live-tokens/data/themes/sunset.json +4 -0
  12. package/src/system/components/Image.svelte +18 -4
  13. package/src/testing-js/{chunk-NXRFTTVL.js → chunk-GKO27NGN.js} +2 -2
  14. package/src/testing-js/{chunk-FTLASW2R.js → chunk-SHBYZUPD.js} +16 -13
  15. package/src/testing-js/chunk-SHBYZUPD.js.map +1 -0
  16. package/src/testing-js/{chunk-U7OJE5DU.js → chunk-X6KHEVIG.js} +61 -30
  17. package/src/testing-js/chunk-X6KHEVIG.js.map +1 -0
  18. package/src/testing-js/component-behavior.contract.js +1 -1
  19. package/src/testing-js/component-editor.contract.js +2 -2
  20. package/src/testing-js/component-render.contract.js +69 -35
  21. package/src/testing-js/component-render.contract.js.map +1 -1
  22. package/src/testing-js/index.js +2 -2
  23. package/src/testing-js/page-compliance.contract.js +1 -1
  24. package/src/testing-js/vitest.js +2 -2
  25. package/src/testing-js/chunk-FTLASW2R.js.map +0 -1
  26. package/src/testing-js/chunk-U7OJE5DU.js.map +0 -1
  27. /package/src/testing-js/{chunk-NXRFTTVL.js.map → chunk-GKO27NGN.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.89.2 — Faster component tests
4
+
5
+ ### Changed
6
+
7
+ - **`check-component --tests` runs faster.** The declared-paint check probes
8
+ each view's properties in one browser call, and the token-selector check
9
+ clicks through one selector per component and opens every other property's
10
+ dropdown in one call per view. Across the 29 shipped components the two
11
+ checks drop from 321s to 191s. They still fail on the same defects: a
12
+ wrong or missing part, a pseudo-element, an SVG paint, and a dropdown with
13
+ nothing to pick.
14
+ - **The npm publish waits for Verify.** A release push no longer runs the
15
+ unit tests and the live-editing suite twice. The publish workflow gates on
16
+ the Verify run for the tagged commit and runs only the packaging checks.
17
+
18
+ ## 0.89.1 — Publish gate stops its dev server
19
+
20
+ ### Fixed
21
+
22
+ - **The component gate stops the dev server it starts.** It launched
23
+ `npx vite`, and stopping npx left vite running, still writing into the
24
+ gate's temp folder while cleanup removed it. Cleanup failed with ENOTEMPTY,
25
+ and 0.89.0 never reached npm. The gate now runs vite directly and waits for
26
+ it to exit.
27
+
28
+ ## 0.89.0 — Bare images
29
+
30
+ ### Added
31
+
32
+ - **`Image` takes `variant="bare"`.** A bare image shows the picture with no
33
+ border and no shadow, for art that carries its own edge: cut-out art,
34
+ screenshots with their own frame, photos that bleed into a section. It has
35
+ its own `--image-bare-*` tokens (radius, border, border width, shadow),
36
+ editable under the Bare tab in the editor. They default to no radius, a
37
+ transparent zero-width border, and no shadow. The shipped themes carry them.
38
+
39
+ ### Changed (breaking)
40
+
41
+ - **`Image`'s height prop is `size`.** `variant` now picks the frame style
42
+ (`default` or `bare`), and `size` takes the heights `variant` used to:
43
+ `default`, `banner`, `medium`, `compact`. Rewrite `<Image variant="banner">`
44
+ as `<Image size="banner">`. `check-page` reports each old use as an
45
+ `unknown-prop-value` finding.
46
+
3
47
  ## 0.88.0 — Eval results on the testing page
4
48
 
5
49
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motion-proto/live-tokens",
3
- "version": "0.88.0",
3
+ "version": "0.89.2",
4
4
  "type": "module",
5
5
  "description": "Design token editor with live CSS variable editing. Svelte 5 + Vite 8.",
6
6
  "keywords": [
@@ -3,18 +3,25 @@
3
3
 
4
4
  export const component = 'image';
5
5
 
6
- // Single object: image frame.
7
- const states: Record<string, Token[]> = {
8
- image: [
9
- { label: 'border color', groupKey: 'border', variable: '--image-default-border' },
10
- { label: 'border width', groupKey: 'width', variable: '--image-default-border-width' },
11
- { label: 'corner radius', groupKey: 'radius', variable: '--image-default-radius' },
12
- { label: 'image shadow', groupKey: 'shadow', variable: '--image-default-shadow' },
13
- { label: 'zoom amount', groupKey: 'scale', variable: '--image-zoom-scale' },
14
- ],
15
- };
6
+ const variants = ['default', 'bare'] as const;
7
+ type Variant = typeof variants[number];
16
8
 
17
- export const allTokens: Token[] = Object.values(states).flat();
9
+ function frameTokens(v: Variant): Token[] {
10
+ return [
11
+ { label: 'border color', groupKey: 'border', variable: `--image-${v}-border` },
12
+ { label: 'border width', groupKey: 'width', variable: `--image-${v}-border-width` },
13
+ { label: 'corner radius', groupKey: 'radius', variable: `--image-${v}-radius` },
14
+ { label: 'image shadow', groupKey: 'shadow', variable: `--image-${v}-shadow` },
15
+ ];
16
+ }
17
+ const zoomScale: Token = { label: 'zoom amount', groupKey: 'scale', variable: '--image-zoom-scale' };
18
+ function variantStates(v: Variant): Record<string, Token[]> {
19
+ return { [v]: v === 'default' ? [...frameTokens(v), zoomScale] : frameTokens(v) };
20
+ }
21
+
22
+ export const allTokens: Token[] = variants.flatMap((v) => Object.values(variantStates(v)).flat());
23
+
24
+ const variantOptions = variants.map((v) => ({ value: v, label: v.charAt(0).toUpperCase() + v.slice(1) }));
18
25
 
19
26
  // Global zoom defaults. `none` = off; `scale(...)` = on. `--image-zoom-enabled` scales the
20
27
  // content within the masked frame (overflow scaling); `--image-grow-enabled` scales the whole
@@ -42,6 +49,7 @@
42
49
  import Image from '../../system/components/Image.svelte';
43
50
  import VariantGroup from './scaffolding/VariantGroup.svelte';
44
51
  import ComponentEditorBase from './scaffolding/ComponentEditorBase.svelte';
52
+ import { buildSiblings } from './scaffolding/siblings';
45
53
  import demoImageUrl from '../../system/assets/offering.webp';
46
54
  import { editorState, setComponentAlias } from '../core/store/editorStore';
47
55
 
@@ -66,8 +74,8 @@
66
74
  const setOverflowScaling = (checked: boolean) => applyZoom(useZoom, checked);
67
75
  </script>
68
76
 
69
- <ComponentEditorBase {component} title="Image" description="Framed image with rounded corners, border, and shadow." tokens={allTokens}>
70
- <VariantGroup name="image" title="Image" {states} {component}>
77
+ <ComponentEditorBase {component} title="Image" description="Picture in the page flow. Default frames it with rounded corners, a border, and a shadow. Bare shows the picture alone." tokens={allTokens} variants={variantOptions}>
78
+ <VariantGroup name="default" title="Default" states={variantStates('default')} {component} siblings={buildSiblings(variants, 'default', variantStates)}>
71
79
  {#snippet stateActions()}
72
80
  <label class="zoom-enable">
73
81
  <input type="checkbox" checked={useZoom} onchange={(e) => setUseZoom(e.currentTarget.checked)} />
@@ -78,7 +86,7 @@
78
86
  <span>Overflow scaling (mask zoom to frame)</span>
79
87
  </label>
80
88
  {/snippet}
81
- <Image src={demoImageUrl} alt="Demo" variant="banner" zoom={useZoom ? undefined : false} {overflowScaling} forceHover={useZoom} />
89
+ <Image src={demoImageUrl} alt="Demo" size="banner" zoom={useZoom ? undefined : false} {overflowScaling} forceHover={useZoom} />
82
90
  <p class="zoom-help">
83
91
  Use zoom on hover: every image scales on hover (a page can still force it per image with the
84
92
  <code>zoom</code> prop). Overflow scaling on (default): the content zooms inside the fixed frame,
@@ -86,6 +94,9 @@
86
94
  <code>overflowScaling</code>.
87
95
  </p>
88
96
  </VariantGroup>
97
+ <VariantGroup name="bare" title="Bare" states={variantStates('bare')} {component} siblings={buildSiblings(variants, 'bare', variantStates)}>
98
+ <Image src={demoImageUrl} alt="Demo" variant="bare" size="banner" />
99
+ </VariantGroup>
89
100
  </ComponentEditorBase>
90
101
 
91
102
  <style>
@@ -3128,6 +3128,10 @@
3128
3128
  "--image-default-border": "--border-neutral",
3129
3129
  "--image-default-border-width": "--border-width-1",
3130
3130
  "--image-default-shadow": "--shadow-md",
3131
+ "--image-bare-radius": "--radius-none",
3132
+ "--image-bare-border": "--color-transparent",
3133
+ "--image-bare-border-width": "--border-width-0",
3134
+ "--image-bare-shadow": "--shadow-none",
3131
3135
  "--image-zoom-scale": "--scale-sm"
3132
3136
  }
3133
3137
  },
@@ -3167,6 +3167,10 @@
3167
3167
  "--image-default-border": "--border-neutral",
3168
3168
  "--image-default-border-width": "--border-width-3",
3169
3169
  "--image-default-shadow": "--shadow-md",
3170
+ "--image-bare-radius": "--radius-none",
3171
+ "--image-bare-border": "--color-transparent",
3172
+ "--image-bare-border-width": "--border-width-0",
3173
+ "--image-bare-shadow": "--shadow-none",
3170
3174
  "--image-zoom-scale": "--scale-sm"
3171
3175
  }
3172
3176
  },
@@ -3185,6 +3185,10 @@
3185
3185
  "--image-default-border": "--border-neutral",
3186
3186
  "--image-default-border-width": "--border-width-1",
3187
3187
  "--image-default-shadow": "--shadow-md",
3188
+ "--image-bare-radius": "--radius-none",
3189
+ "--image-bare-border": "--color-transparent",
3190
+ "--image-bare-border-width": "--border-width-0",
3191
+ "--image-bare-shadow": "--shadow-none",
3188
3192
  "--image-zoom-scale": "--scale-sm"
3189
3193
  }
3190
3194
  },
@@ -3127,6 +3127,10 @@
3127
3127
  "--image-default-border": "--border-neutral",
3128
3128
  "--image-default-border-width": "--border-width-1",
3129
3129
  "--image-default-shadow": "--shadow-md",
3130
+ "--image-bare-radius": "--radius-none",
3131
+ "--image-bare-border": "--color-transparent",
3132
+ "--image-bare-border-width": "--border-width-0",
3133
+ "--image-bare-shadow": "--shadow-none",
3130
3134
  "--image-zoom-scale": "--scale-sm"
3131
3135
  }
3132
3136
  },
@@ -3158,6 +3158,10 @@
3158
3158
  "--image-default-border": "--border-neutral",
3159
3159
  "--image-default-border-width": "--border-width-2",
3160
3160
  "--image-default-shadow": "--shadow-md",
3161
+ "--image-bare-radius": "--radius-none",
3162
+ "--image-bare-border": "--color-transparent",
3163
+ "--image-bare-border-width": "--border-width-0",
3164
+ "--image-bare-shadow": "--shadow-none",
3161
3165
  "--image-zoom-scale": "--scale-sm"
3162
3166
  }
3163
3167
  },
@@ -3141,6 +3141,10 @@
3141
3141
  "--image-default-border": "--border-neutral",
3142
3142
  "--image-default-border-width": "--border-width-1",
3143
3143
  "--image-default-shadow": "--shadow-md",
3144
+ "--image-bare-radius": "--radius-none",
3145
+ "--image-bare-border": "--color-transparent",
3146
+ "--image-bare-border-width": "--border-width-0",
3147
+ "--image-bare-shadow": "--shadow-none",
3144
3148
  "--image-zoom-scale": "--scale-sm"
3145
3149
  }
3146
3150
  },
@@ -3114,6 +3114,10 @@
3114
3114
  "--image-default-border": "--border-neutral",
3115
3115
  "--image-default-border-width": "--border-width-1",
3116
3116
  "--image-default-shadow": "--shadow-md",
3117
+ "--image-bare-radius": "--radius-none",
3118
+ "--image-bare-border": "--color-transparent",
3119
+ "--image-bare-border-width": "--border-width-0",
3120
+ "--image-bare-shadow": "--shadow-none",
3117
3121
  "--image-zoom-scale": "--scale-sm"
3118
3122
  }
3119
3123
  },
@@ -3166,6 +3166,10 @@
3166
3166
  "--image-default-border": "--border-neutral",
3167
3167
  "--image-default-border-width": "--border-width-1",
3168
3168
  "--image-default-shadow": "--shadow-md",
3169
+ "--image-bare-radius": "--radius-none",
3170
+ "--image-bare-border": "--color-transparent",
3171
+ "--image-bare-border-width": "--border-width-0",
3172
+ "--image-bare-shadow": "--shadow-none",
3169
3173
  "--image-zoom-scale": "--scale-sm"
3170
3174
  }
3171
3175
  },
@@ -10,7 +10,8 @@
10
10
  constraints: ['Page CSS paints decoration.'],
11
11
  props: {
12
12
  variant:
13
- "`default` keeps the picture's own proportions, `banner` gives it a tall frame, `medium` and `compact` shorter ones.",
13
+ '`default` frames the picture with a border and shadow. `bare` drops the frame for pictures that carry their own edge, such as cut-out art or screenshots.',
14
+ size: "`default` keeps the picture's own proportions, `banner` gives it a tall frame, `medium` and `compact` shorter ones.",
14
15
  },
15
16
  } satisfies CatalogueEntry;
16
17
  </script>
@@ -19,7 +20,8 @@
19
20
  interface Props {
20
21
  src: string;
21
22
  alt: string;
22
- variant?: 'default' | 'banner' | 'medium' | 'compact';
23
+ variant?: 'default' | 'bare';
24
+ size?: 'default' | 'banner' | 'medium' | 'compact';
23
25
  height?: string | undefined;
24
26
  /** Zoom the contents on hover (frame stays fixed). `undefined` inherits the editor's
25
27
  global "Use zoom" default; `true`/`false` force this instance on/off. */
@@ -42,6 +44,7 @@
42
44
  src,
43
45
  alt,
44
46
  variant = 'default',
47
+ size = 'default',
45
48
  height = undefined,
46
49
  zoom = undefined,
47
50
  overflowScaling = undefined,
@@ -52,14 +55,14 @@
52
55
  forceHover = false,
53
56
  }: Props = $props();
54
57
 
55
- const variantHeights: Record<string, string | undefined> = {
58
+ const sizeHeights: Record<string, string | undefined> = {
56
59
  default: undefined,
57
60
  banner: '360px',
58
61
  medium: '240px',
59
62
  compact: '180px',
60
63
  };
61
64
 
62
- let resolvedHeight = $derived(height ?? variantHeights[variant]);
65
+ let resolvedHeight = $derived(height ?? sizeHeights[size]);
63
66
 
64
67
  // Per-instance override of the global zoom intrinsics. `undefined` for a variable leaves
65
68
  // :root in charge. Exactly one of the two transforms is ever the scale (the other `none`),
@@ -80,6 +83,7 @@
80
83
 
81
84
  <div
82
85
  class="image"
86
+ class:bare={variant === 'bare'}
83
87
  class:force-hover={forceHover}
84
88
  style:height={resolvedHeight}
85
89
  style:--image-zoom-enabled={contentHover}
@@ -94,6 +98,10 @@
94
98
  --image-default-border: var(--border-neutral);
95
99
  --image-default-border-width: var(--border-width-1);
96
100
  --image-default-shadow: var(--shadow-md);
101
+ --image-bare-radius: var(--radius-none);
102
+ --image-bare-border: var(--color-transparent);
103
+ --image-bare-border-width: var(--border-width-0);
104
+ --image-bare-shadow: var(--shadow-none);
97
105
  --image-zoom-scale: var(--scale-sm);
98
106
  /* Hover-scale targets. Contained mode (`overflowScaling`) scales the content within the
99
107
  masked frame; grow mode scales the whole frame so it grows past its box. Each is `none`
@@ -111,6 +119,12 @@
111
119
  transition: transform var(--duration-300) var(--ease-out-cubic);
112
120
  }
113
121
 
122
+ .image.bare {
123
+ border-radius: var(--image-bare-radius);
124
+ border: var(--image-bare-border-width) solid var(--image-bare-border);
125
+ box-shadow: var(--image-bare-shadow);
126
+ }
127
+
114
128
  img {
115
129
  width: 100%;
116
130
  height: 100%;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CONTRACTS_MODULE_ENV
3
- } from "./chunk-FTLASW2R.js";
3
+ } from "./chunk-SHBYZUPD.js";
4
4
 
5
5
  // src/testing/vitest.ts
6
6
  import path from "path";
@@ -54,4 +54,4 @@ function createVitestConfig(viteConfig, options = {}) {
54
54
  export {
55
55
  createVitestConfig
56
56
  };
57
- //# sourceMappingURL=chunk-NXRFTTVL.js.map
57
+ //# sourceMappingURL=chunk-GKO27NGN.js.map
@@ -1022,29 +1022,32 @@ var iconButtonContract = {
1022
1022
  };
1023
1023
 
1024
1024
  // src/testing/contracts/image.ts
1025
+ function framePaints(v) {
1026
+ return {
1027
+ root: {
1028
+ borderTopColor: `--image-${v}-border`,
1029
+ borderTopWidth: `--image-${v}-border-width`,
1030
+ borderRadius: `--image-${v}-radius`,
1031
+ boxShadow: `--image-${v}-shadow`
1032
+ }
1033
+ };
1034
+ }
1025
1035
  var imageContract = {
1026
1036
  id: "image",
1027
1037
  origin: "system",
1038
+ view: { variant: "Default" },
1028
1039
  root: "root",
1029
1040
  parts: {
1030
1041
  root: ".image",
1031
1042
  img: ".image img"
1032
1043
  },
1033
1044
  properties: [
1034
- {
1035
- paints: {
1036
- root: {
1037
- borderTopColor: "--image-default-border",
1038
- borderTopWidth: "--image-default-border-width",
1039
- borderRadius: "--image-default-radius",
1040
- boxShadow: "--image-default-shadow"
1041
- }
1042
- }
1043
- }
1045
+ { variant: "Default", paints: framePaints("default") },
1046
+ { variant: "Bare", paints: framePaints("bare") }
1044
1047
  ],
1045
1048
  states: {
1046
1049
  applicable: false,
1047
- reason: "the editor renders one token group (image) with no state strip"
1050
+ reason: "each variant is one frame preset with one state, so the editor renders no state strip"
1048
1051
  },
1049
1052
  uncovered: {
1050
1053
  "--image-zoom-scale": "consumed inside transform: scale(), never appears verbatim in a computed style"
@@ -1392,7 +1395,7 @@ var inputContract = {
1392
1395
  placeholder: { color: "--input-default-placeholder" }
1393
1396
  }
1394
1397
  },
1395
- // `assertPaintsFromToken` (here) drives a controlled pixel probe, so a
1398
+ // `assertProperties` (here) drives a controlled pixel probe, so a
1396
1399
  // unitless line-height round-trips fine. `assertPaintMap` (states, below)
1397
1400
  // reads the real, already-resolved value through `normalize()`, which
1398
1401
  // cannot recompute a unitless multiplier outside the field's own
@@ -3732,4 +3735,4 @@ export {
3732
3735
  allContracts,
3733
3736
  selectedContracts
3734
3737
  };
3735
- //# sourceMappingURL=chunk-FTLASW2R.js.map
3738
+ //# sourceMappingURL=chunk-SHBYZUPD.js.map