@motion-proto/live-tokens 0.67.0 → 0.67.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 +22 -0
- package/README.md +67 -9
- package/dist-plugin/{chunk-T4PMCFJN.js → chunk-J2JT4UEA.js} +5 -5
- package/dist-plugin/index.cjs +5 -5
- package/dist-plugin/index.js +1 -1
- package/dist-plugin/migrateData/index.cjs +5 -5
- package/dist-plugin/migrateData/index.js +1 -1
- package/package.json +1 -1
- package/src/live-tokens/data/sketch-styles/napkin.json +4 -4
- package/src/live-tokens/data/sketch-styles/pencil.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.67.1 — The Napkin you tuned is the Napkin that ships
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Napkin's shipped dials match the look it was tuned to.** Four dials moved on
|
|
8
|
+
a theme's own copy of the sketchstyle and never reached the file the package
|
|
9
|
+
ships, so a project loading Napkin from the shipped set got a paler, softer
|
|
10
|
+
ballpoint than the one on screen. The ink floor lifts to 0.62 over a harder
|
|
11
|
+
mask edge, coverage runs to full, and instances vary a little less in size.
|
|
12
|
+
|
|
13
|
+
- **Pencil's blurb says what the grain does.** It is drawn long and on the
|
|
14
|
+
diagonal, the way a pencil shades, which the old sentence left out.
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
|
|
18
|
+
- **The README covers sketch mode.** What the layer is, the seven shipped looks
|
|
19
|
+
with the blurb each one carries, seeding a built site from a theme, registering
|
|
20
|
+
your own sketchstyles at boot, building a picker, and the four classes the
|
|
21
|
+
layer reserves for elements you draw yourself. A test pins each blurb to the
|
|
22
|
+
README, so a look renamed or reworded here fails the suite until the page
|
|
23
|
+
catches up.
|
|
24
|
+
|
|
3
25
|
## 0.67.0 — Every sketchstyle is a file
|
|
4
26
|
|
|
5
27
|
### Added
|
package/README.md
CHANGED
|
@@ -8,15 +8,16 @@ npm install @motion-proto/live-tokens
|
|
|
8
8
|
|
|
9
9
|
The editor is dev-only. Production builds get plain CSS variables and the components you used.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Features
|
|
12
12
|
|
|
13
13
|
- **Live token editing.** Colors, typography, spacing, radii, shadows, motion, palettes, and gradients. Every input writes a CSS variable, so the page repaints with no reload and no build step.
|
|
14
14
|
- **Live component editing.** 25 shipped Svelte components (Button, IconButton, Input, Card, Dialog, Badge, Callout, Table, Tooltip, Toggle, TabBar, SegmentedControl, RadioButton, MenuSelect, ProgressBar, CornerBadge, SectionDivider, CollapsibleSection, Notification, Image, ImageLightbox, CodeSnippet, SideNavigation, Panel, InlineEditActions) declare their design-token aliases in a `:global(:root)` block. Rewire an alias from the component's editor and it updates everywhere that component is used, on your real pages.
|
|
15
15
|
- **Four dev-only routes.** `/live-tokens/editor` for tokens, `/live-tokens/colors` for palettes, `/live-tokens/components` for per-component aliases, `/live-tokens/docs` for the user guide.
|
|
16
16
|
- **Editor overlay.** Pins to the top right of every dev page and opens the editor in a side panel or floating window, so you edit on the page you are styling. Its "Page Source" button opens the current page's `.svelte` file in VS Code.
|
|
17
17
|
- **Themes.** A theme is a whole look in one file: colors and type plus a config for every component, stored by value. Loading one changes a single pointer file, and nothing your site ships changes until you Adopt. Export a theme and import it into another project to restore the look in one step.
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
18
|
+
- **Eight example looks.** Autumn, Halloween, Midnight Study, Ocean, Royal Velvet, Sketchy, Spring Meadow, and Sunset each ship as a full theme: colors, a Google Fonts pairing, and a shape personality of radius, padding, gap, and border-width aliases. They ship inside the package, so trying one needs no local files. Load Motion Proto to return to the default. Saving over a preset writes a local copy that shadows the shipped one; delete the copy and the shipped version returns.
|
|
19
|
+
- **Sketch mode.** Redraws the page as if it had been drawn by hand. Seven looks ship as files, and the effect is a layer over your tokens rather than a change to them. See [Sketch mode](#sketch-mode).
|
|
20
|
+
- **Vite plugin.** Hosts the `/api/live-tokens/{colors-and-type,component-configs,themes,sketch-styles}/*` routes the editor reads and writes through. The single namespace keeps these routes clear of anything your app serves under `/api`.
|
|
20
21
|
- **Claude Code skills.** Six bundled skills that drive the package from plain English. See [Claude Code skills](#claude-code-skills).
|
|
21
22
|
|
|
22
23
|
## Install
|
|
@@ -84,7 +85,7 @@ bootLiveTokens(App, '#app');
|
|
|
84
85
|
|
|
85
86
|
For routes you cannot enumerate ahead of time (a `/:id`, a path prefix, a page shown only under some condition), add a `resolve` function from the current path to a `RouteEntry` and return `null` to fall through. Resolution order is `pages[path]`, then `resolve(path)`, then the `pages['/']` fallback, so adding `resolve` never changes how existing entries match. A resolved entry can carry `props`, letting one component serve many paths, and its `source` gives the dynamic route a working "Page Source" button.
|
|
86
87
|
|
|
87
|
-
Link-click interception follows the same route table. A left-click becomes an in-app `navigate()` only when the anchor asks for ordinary same-tab navigation
|
|
88
|
+
Link-click interception follows the same route table. A left-click becomes an in-app `navigate()` only when the anchor asks for ordinary same-tab navigation (no `target`, `download`, `rel="external"`, or modifier key) and `pages` or `resolve` claims the path. Anything else keeps the browser's own handling, so a link to a PDF or an image under `public/`, to a download, or to a path no route declares loads for real. Note that the `pages['/']` fallback renders an unmatched path without claiming it: link to a path no route declares and you get a page load, not a client-side swap.
|
|
88
89
|
|
|
89
90
|
```svelte
|
|
90
91
|
<LiveTokensRouter
|
|
@@ -131,11 +132,11 @@ Or copy `node_modules/@motion-proto/live-tokens/src/system/styles/tokens.css` in
|
|
|
131
132
|
|
|
132
133
|
`bootLiveTokens` and `<LiveTokensRouter>` are wrappers. The individual init functions (`initCssVarSync`, `initRouter`, `initColumnsOverlay`, `initEditorStore`, `initializeTheme`), `<LiveEditorOverlay>`, `<ColumnsOverlay>`, and the editor page exports (`@motion-proto/live-tokens/editor`, `@motion-proto/live-tokens/component-editor-page`) are all exported. Use them to build a custom shell: arbitrary markup per route, a foreign matcher, or your own overlay wiring. Dynamic and gated routes do not need this; use `resolve` above, which keeps the overlay, nav rail, and page source intact.
|
|
133
134
|
|
|
134
|
-
##
|
|
135
|
+
## The data directory
|
|
135
136
|
|
|
136
|
-
The plugin reads and writes under one folder, `src/live-tokens/data/`, which holds
|
|
137
|
+
The plugin reads and writes under one folder, `src/live-tokens/data/`, which holds four subdirectories it owns: `colors-and-type/`, `themes/`, `component-configs/`, and `sketch-styles/`.
|
|
137
138
|
|
|
138
|
-
`themes/` holds one file per whole look, plus `_active.json` naming the one the editor has open and `_production.json` naming the one your site ships. `colors-and-type/` and `component-configs/{comp}/` hold each layer's `default.json` baseline, any preset you save by name, and the `_working.json` buffer for edits you have not saved into the active theme. A buffer is a delta from the open theme, so ordinary theme switching leaves none behind.
|
|
139
|
+
`themes/` holds one file per whole look, plus `_active.json` naming the one the editor has open and `_production.json` naming the one your site ships. `colors-and-type/` and `component-configs/{comp}/` hold each layer's `default.json` baseline, any preset you save by name, and the `_working.json` buffer for edits you have not saved into the active theme. A buffer is a delta from the open theme, so ordinary theme switching leaves none behind. `sketch-styles/` holds one file per look, shipped and your own alike.
|
|
139
140
|
|
|
140
141
|
To move the data, create `live-tokens.config.json` at your project root:
|
|
141
142
|
|
|
@@ -256,6 +257,62 @@ bootLiveTokens(App, '#app', {
|
|
|
256
257
|
|
|
257
258
|
The component appears on `/live-tokens/components` under a **CUSTOM** group. Token rows, linked-block sharing, per-component config persistence, and reset-to-default behave exactly as they do for the built-in set. Import only from `@motion-proto/live-tokens` or `@motion-proto/live-tokens/component-editor`; never deep-import from `src/`.
|
|
258
259
|
|
|
260
|
+
## Sketch mode
|
|
261
|
+
|
|
262
|
+
Sketch mode redraws the page as if it had been drawn by hand. Every component keeps its own colors, spacing, and corners; what changes is the line it is drawn with. The effect is a layer over your tokens and never touches a value, so switching it off returns every component to exactly what its tokens say.
|
|
263
|
+
|
|
264
|
+
Seven looks ship with the package. Each is a full set of dials, and each ships as a file under `src/live-tokens/data/sketch-styles/`.
|
|
265
|
+
|
|
266
|
+
- **Pencil.** Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does. The grain is drawn long and on the diagonal, the way a pencil shades.
|
|
267
|
+
- **Marker.** Broad translucent nib gone round twice on the same line, so the overlap darkens and the ink pools where it slows.
|
|
268
|
+
- **Whiteboard.** The fattest nib on glass. One long smooth undulation, and a veined mask that streaks the fill like a half-wiped board.
|
|
269
|
+
- **Hatched.** An etching. The fill is angled shading, the outline a single hard-edged scratch that chatters along its length. No mask: the hatch is the texture.
|
|
270
|
+
- **Dashed.** A drafting outline. One slow drift along the ruler, broken into strokes, with jitter, mask and pressure all off. The clean pole.
|
|
271
|
+
- **Napkin.** Ballpoint in a hurry. Everything loose at once: a square wave sends every edge to full travel, and the second pass lands wherever it lands.
|
|
272
|
+
- **Dry marker.** Ink that ran out. One scratchy pass that breaks up along its length, over a fill the mask has worn nearly through in patches.
|
|
273
|
+
|
|
274
|
+
Open the Sketchstyle view in the editor, move whatever you like, and Save writes your dials to a file. Saving over a shipped look writes a local copy that shadows it; delete the copy and the shipped file returns, the same way presets work.
|
|
275
|
+
|
|
276
|
+
A theme carries a sketchstyle of its own, so a look travels with the theme that uses it.
|
|
277
|
+
|
|
278
|
+
### Ship the layer with your site
|
|
279
|
+
|
|
280
|
+
The dev server reads the open theme and paints what it carries. A built site has no server to ask, so hand it the field before mounting:
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
import { seedSketchFromTheme } from '@motion-proto/live-tokens/sketch';
|
|
284
|
+
import theme from './live-tokens/data/themes/sketchy.json';
|
|
285
|
+
|
|
286
|
+
seedSketchFromTheme(theme.sketchStyle);
|
|
287
|
+
await bootLiveTokens(App, '#app');
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Register your own sketchstyles at boot the way you register components:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
const files = import.meta.glob('./live-tokens/data/sketch-styles/*.json', {
|
|
294
|
+
eager: true,
|
|
295
|
+
import: 'default',
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
await bootLiveTokens(App, '#app', {
|
|
299
|
+
sketchLooks: Object.entries(files).map(([path, file]) => {
|
|
300
|
+
const id = path.split('/').pop().replace('.json', '');
|
|
301
|
+
return { id, label: file.name || id, settings: file.settings };
|
|
302
|
+
}),
|
|
303
|
+
});
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
The file's slug is the look's id, so a sketchstyle picked in the editor keeps working once the site is built. `create` writes this into `main.ts` already.
|
|
307
|
+
|
|
308
|
+
### Build a picker
|
|
309
|
+
|
|
310
|
+
`sketchLooks` is a store holding every look on offer, shipped and your own in one list. Give each row `setSketch(look.id)`, and add a None row yourself: off is a state of the effect rather than one of the looks. `themeSketchLook` carries the theme's own look as one more row, and reads null when the theme carries none.
|
|
311
|
+
|
|
312
|
+
### Draw your own elements
|
|
313
|
+
|
|
314
|
+
The layer redraws the shipped components and four classes it reserves for you: `sketch-surface` for a box, `sketch-container` for a large one, `sketch-chip` for a small one, and `sketch-rule` for a line. Pick by size, not by kind. The class opts an element in but names no colors, so state them yourself with `--sketch-fill`, `--sketch-stroke`, and `--sketch-radius`. The in-app guide at `/live-tokens/docs` covers every dial and the rules for images and icons.
|
|
315
|
+
|
|
259
316
|
## CLI
|
|
260
317
|
|
|
261
318
|
```bash
|
|
@@ -348,13 +405,13 @@ npx @motion-proto/live-tokens check-component <id>
|
|
|
348
405
|
|
|
349
406
|
The validator checks the file layout, the `:global(:root)` block, the token-suffix vocabulary, the state-before-property rule, the no-raw-color-defaults rule, the public-imports rule, and the `registerComponent({ id })` call. Exit code 0 means the static contract is met. Use it after Claude generates a component, and as a pre-commit guard on hand-authored ones.
|
|
350
407
|
|
|
351
|
-
##
|
|
408
|
+
## From edit to production
|
|
352
409
|
|
|
353
410
|
1. Edit on `/live-tokens/editor`, `/live-tokens/colors`, or `/live-tokens/components`. Edits sit in the working buffer (`_working.json`). **Save** in the Theme panel captures the buffer into the open theme at `<dataDir>/themes/{name}.json`.
|
|
354
411
|
2. **Adopt** the theme. It becomes the production theme, and its variables are baked into `tokens.generated.css` next to your authored `tokens.css`. Nothing else writes that file, so trying a look never changes what you ship.
|
|
355
412
|
3. `npm run build` bundles both as plain CSS. No editor code, no JSON lookups, no dev surfaces reach production.
|
|
356
413
|
|
|
357
|
-
## File ownership
|
|
414
|
+
## File ownership
|
|
358
415
|
|
|
359
416
|
Knowing which files the plugin touches matters when you upgrade the package or work in a repo you do not want overwritten. For how a saved look stays safe across upgrades while `tokens.css` holds the building blocks, see [TOKENS.md](./TOKENS.md).
|
|
360
417
|
|
|
@@ -377,6 +434,7 @@ Knowing which files the plugin touches matters when you upgrade the package or w
|
|
|
377
434
|
- `<dataDir>/colors-and-type/_working.json` and `<dataDir>/component-configs/{comp}/_working.json`, the buffers, written as you edit and cleared when a theme you open does not carry them.
|
|
378
435
|
- `<dataDir>/themes/{name}.json`, on every Save and Save As in the Theme panel.
|
|
379
436
|
- `<dataDir>/colors-and-type/{name}.json` and `<dataDir>/component-configs/{comp}/{name}.json`, only when you save a preset by name.
|
|
437
|
+
- `<dataDir>/sketch-styles/{name}.json`, on every Save and Save As in the Sketchstyle view. Saving over a shipped look writes this project's own copy under the same name; deleting it restores the shipped file.
|
|
380
438
|
- `tokens.generated.css` and `fonts.css`, regenerated from the production theme when you Adopt.
|
|
381
439
|
|
|
382
440
|
The plugin never writes your authored `tokens.css`. It holds defaults you are free to hand-edit, and the editor's overrides land in `tokens.generated.css`, which the app imports immediately after it.
|
|
@@ -273,7 +273,7 @@ var pencil_default = {
|
|
|
273
273
|
name: "Pencil",
|
|
274
274
|
settings: {
|
|
275
275
|
label: "Pencil",
|
|
276
|
-
blurb: "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does.
|
|
276
|
+
blurb: "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does. The grain is drawn long and on the diagonal, the way a pencil shades.",
|
|
277
277
|
fillTravel: 0.75,
|
|
278
278
|
strokeTravel: 1.25,
|
|
279
279
|
wobble: 30,
|
|
@@ -541,16 +541,16 @@ var napkin_default = {
|
|
|
541
541
|
maskBlobY: 150,
|
|
542
542
|
maskBlobLinked: true,
|
|
543
543
|
maskAngle: 0,
|
|
544
|
-
maskOutputMin: 0.
|
|
545
|
-
maskOutputMax:
|
|
544
|
+
maskOutputMin: 0.62,
|
|
545
|
+
maskOutputMax: 1,
|
|
546
546
|
maskOctaves: 2,
|
|
547
547
|
maskGrain: "fractal",
|
|
548
548
|
maskPosterize: 2,
|
|
549
|
-
maskSoftness:
|
|
549
|
+
maskSoftness: 5,
|
|
550
550
|
jitterX: 6,
|
|
551
551
|
jitterY: 6,
|
|
552
552
|
jitterRot: 1.8,
|
|
553
|
-
jitterScale: 0.
|
|
553
|
+
jitterScale: 0.075,
|
|
554
554
|
cornerSpread: 20,
|
|
555
555
|
cornerTravel: 17,
|
|
556
556
|
iconTravel: 2.25,
|
package/dist-plugin/index.cjs
CHANGED
|
@@ -1909,7 +1909,7 @@ var pencil_default = {
|
|
|
1909
1909
|
name: "Pencil",
|
|
1910
1910
|
settings: {
|
|
1911
1911
|
label: "Pencil",
|
|
1912
|
-
blurb: "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does.
|
|
1912
|
+
blurb: "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does. The grain is drawn long and on the diagonal, the way a pencil shades.",
|
|
1913
1913
|
fillTravel: 0.75,
|
|
1914
1914
|
strokeTravel: 1.25,
|
|
1915
1915
|
wobble: 30,
|
|
@@ -2177,16 +2177,16 @@ var napkin_default = {
|
|
|
2177
2177
|
maskBlobY: 150,
|
|
2178
2178
|
maskBlobLinked: true,
|
|
2179
2179
|
maskAngle: 0,
|
|
2180
|
-
maskOutputMin: 0.
|
|
2181
|
-
maskOutputMax:
|
|
2180
|
+
maskOutputMin: 0.62,
|
|
2181
|
+
maskOutputMax: 1,
|
|
2182
2182
|
maskOctaves: 2,
|
|
2183
2183
|
maskGrain: "fractal",
|
|
2184
2184
|
maskPosterize: 2,
|
|
2185
|
-
maskSoftness:
|
|
2185
|
+
maskSoftness: 5,
|
|
2186
2186
|
jitterX: 6,
|
|
2187
2187
|
jitterY: 6,
|
|
2188
2188
|
jitterRot: 1.8,
|
|
2189
|
-
jitterScale: 0.
|
|
2189
|
+
jitterScale: 0.075,
|
|
2190
2190
|
cornerSpread: 20,
|
|
2191
2191
|
cornerTravel: 17,
|
|
2192
2192
|
iconTravel: 2.25,
|
package/dist-plugin/index.js
CHANGED
|
@@ -1058,7 +1058,7 @@ var pencil_default = {
|
|
|
1058
1058
|
name: "Pencil",
|
|
1059
1059
|
settings: {
|
|
1060
1060
|
label: "Pencil",
|
|
1061
|
-
blurb: "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does.
|
|
1061
|
+
blurb: "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does. The grain is drawn long and on the diagonal, the way a pencil shades.",
|
|
1062
1062
|
fillTravel: 0.75,
|
|
1063
1063
|
strokeTravel: 1.25,
|
|
1064
1064
|
wobble: 30,
|
|
@@ -1326,16 +1326,16 @@ var napkin_default = {
|
|
|
1326
1326
|
maskBlobY: 150,
|
|
1327
1327
|
maskBlobLinked: true,
|
|
1328
1328
|
maskAngle: 0,
|
|
1329
|
-
maskOutputMin: 0.
|
|
1330
|
-
maskOutputMax:
|
|
1329
|
+
maskOutputMin: 0.62,
|
|
1330
|
+
maskOutputMax: 1,
|
|
1331
1331
|
maskOctaves: 2,
|
|
1332
1332
|
maskGrain: "fractal",
|
|
1333
1333
|
maskPosterize: 2,
|
|
1334
|
-
maskSoftness:
|
|
1334
|
+
maskSoftness: 5,
|
|
1335
1335
|
jitterX: 6,
|
|
1336
1336
|
jitterY: 6,
|
|
1337
1337
|
jitterRot: 1.8,
|
|
1338
|
-
jitterScale: 0.
|
|
1338
|
+
jitterScale: 0.075,
|
|
1339
1339
|
cornerSpread: 20,
|
|
1340
1340
|
cornerTravel: 17,
|
|
1341
1341
|
iconTravel: 2.25,
|
package/package.json
CHANGED
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"maskBlobY": 150,
|
|
26
26
|
"maskBlobLinked": true,
|
|
27
27
|
"maskAngle": 0,
|
|
28
|
-
"maskOutputMin": 0.
|
|
29
|
-
"maskOutputMax":
|
|
28
|
+
"maskOutputMin": 0.62,
|
|
29
|
+
"maskOutputMax": 1,
|
|
30
30
|
"maskOctaves": 2,
|
|
31
31
|
"maskGrain": "fractal",
|
|
32
32
|
"maskPosterize": 2,
|
|
33
|
-
"maskSoftness":
|
|
33
|
+
"maskSoftness": 5,
|
|
34
34
|
"jitterX": 6,
|
|
35
35
|
"jitterY": 6,
|
|
36
36
|
"jitterRot": 1.8,
|
|
37
|
-
"jitterScale": 0.
|
|
37
|
+
"jitterScale": 0.075,
|
|
38
38
|
"cornerSpread": 20,
|
|
39
39
|
"cornerTravel": 17,
|
|
40
40
|
"iconTravel": 2.25,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "Pencil",
|
|
3
3
|
"settings": {
|
|
4
4
|
"label": "Pencil",
|
|
5
|
-
"blurb": "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does.
|
|
5
|
+
"blurb": "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does. The grain is drawn long and on the diagonal, the way a pencil shades.",
|
|
6
6
|
"fillTravel": 0.75,
|
|
7
7
|
"strokeTravel": 1.25,
|
|
8
8
|
"wobble": 30,
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
},
|
|
45
45
|
"updatedAt": "2026-08-28T14:35:06.291Z",
|
|
46
46
|
"createdAt": "2026-08-28T14:35:06.291Z"
|
|
47
|
-
}
|
|
47
|
+
}
|