@motion-proto/live-tokens 0.65.1 → 0.67.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 +184 -0
- package/dist-plugin/{chunk-NDJJORKJ.js → chunk-T4PMCFJN.js} +220 -114
- package/dist-plugin/index.cjs +253 -129
- package/dist-plugin/index.js +27 -9
- package/dist-plugin/migrateData/index.cjs +220 -114
- package/dist-plugin/migrateData/index.js +1 -1
- package/package.json +8 -1
- package/src/editor/bootstrap.ts +12 -0
- package/src/editor/core/productionPulse.ts +1 -1
- package/src/editor/core/sketch/index.ts +78 -21
- package/src/editor/core/sketch/maskField.ts +200 -62
- package/src/editor/core/sketch/sketchLayer.ts +10 -4
- package/src/editor/core/sketch/sketchRegistry.ts +98 -0
- package/src/editor/core/sketch/sketchStore.ts +110 -31
- package/src/editor/core/sketch/sketchStyleService.ts +3 -0
- package/src/editor/core/sketch/sketchStyles.ts +63 -96
- package/src/editor/core/themes/themeInit.ts +4 -13
- package/src/editor/docs/content/sketch-mode.md +82 -13
- package/src/editor/docs/content.generated.ts +1 -1
- package/src/editor/ui/sketch/SketchTab.svelte +219 -74
- package/src/live-tokens/data/sketch-styles/dashed.json +47 -0
- package/src/live-tokens/data/sketch-styles/dry.json +47 -0
- package/src/live-tokens/data/sketch-styles/hatched.json +47 -0
- package/src/live-tokens/data/sketch-styles/marker.json +47 -0
- package/src/live-tokens/data/sketch-styles/napkin.json +47 -0
- package/src/live-tokens/data/sketch-styles/pencil.json +47 -0
- package/src/live-tokens/data/sketch-styles/whiteboard.json +47 -0
- package/src/live-tokens/data/themes/autumn.json +4 -4
- package/src/live-tokens/data/themes/halloween.json +4 -4
- package/src/live-tokens/data/themes/midnight-study.json +4 -4
- package/src/live-tokens/data/themes/ocean.json +4 -4
- package/src/live-tokens/data/themes/royal-velvet.json +4 -4
- package/src/live-tokens/data/themes/sketchy.json +4 -4
- package/src/live-tokens/data/themes/spring-meadow.json +4 -4
- package/src/live-tokens/data/themes/sunset.json +4 -4
- package/src/system/components/Button.svelte +2 -2
- package/src/system/components/IconButton.svelte +2 -2
- package/src/system/styles/fonts.css +6 -6
- package/template/src/main.ts +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,189 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.67.0 — Every sketchstyle is a file
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **A saved sketchstyle ships with your site.** 0.66.0 carried the look a theme
|
|
8
|
+
holds into a build, which covers one look per theme. Everything else a project
|
|
9
|
+
saved in the Sketchstyle view stayed behind: the files live in
|
|
10
|
+
`src/live-tokens/data/sketch-styles/` and only the dev server could read them,
|
|
11
|
+
so a picker on a built site silently listed the shipped seven and nothing
|
|
12
|
+
else. Hand them to `bootLiveTokens` and they are real everywhere:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
const files = import.meta.glob('./live-tokens/data/sketch-styles/*.json', {
|
|
16
|
+
eager: true,
|
|
17
|
+
import: 'default',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
await bootLiveTokens(App, '#app', {
|
|
21
|
+
sketchLooks: Object.entries(files).map(([path, file]) => {
|
|
22
|
+
const id = path.split('/').pop().replace('.json', '');
|
|
23
|
+
return { id, label: file.name || id, settings: file.settings };
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Unlike `components`, these register in a build as well as in dev. Reaching a
|
|
29
|
+
published site is the whole point of them.
|
|
30
|
+
|
|
31
|
+
`create` writes this into `src/main.ts`, so a new project publishes what it
|
|
32
|
+
saves without wiring anything.
|
|
33
|
+
|
|
34
|
+
- **A Save pill in the Sketchstyle view**, which writes the dials back over the
|
|
35
|
+
sketchstyle you have selected. Updating a saved sketchstyle used to run
|
|
36
|
+
through the naming form: open it, accept the pre-filled label, submit, and
|
|
37
|
+
nothing on screen said a file had been replaced rather than created. Save
|
|
38
|
+
lights as soon as the dials leave the sketchstyle they name. On one of your
|
|
39
|
+
own it writes that file; on a shipped one it writes your project's own copy
|
|
40
|
+
under the same name, which takes its place in the list, and deleting that file
|
|
41
|
+
brings the shipped look back. **Save As** always creates, and starts its form
|
|
42
|
+
empty to say so.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- **Every sketchstyle ships as a file.** The seven looks were a constant in
|
|
47
|
+
`sketchStyles.ts`. The Sketchstyle view could save over one, but the thing it
|
|
48
|
+
saved over had no file to read, copy or compare against, so "restore the
|
|
49
|
+
shipped Pencil" meant trusting that a deleted file fell back to something
|
|
50
|
+
nobody could open. They now ship as JSON under
|
|
51
|
+
`src/live-tokens/data/sketch-styles/`, one per look, and the module reads
|
|
52
|
+
them: the file is the look.
|
|
53
|
+
|
|
54
|
+
A shipped sketchstyle behaves like a shipped colors-and-type. Save over one
|
|
55
|
+
and your project gets its own copy that shadows it; delete that copy and the
|
|
56
|
+
packaged file comes back. The listing marks which is which (`isPackage`), and
|
|
57
|
+
deleting a look that only the package ships answers 403 rather than reporting
|
|
58
|
+
success and leaving it on screen.
|
|
59
|
+
|
|
60
|
+
Pencil, Marker and Whiteboard ship with reworked ink coverage. Pencil's grain
|
|
61
|
+
is now stretched and turned rather than square (`maskBlobX` 40 to 525 at 67
|
|
62
|
+
degrees, on turbulence), Marker's blobs are twice the size over a much higher
|
|
63
|
+
floor with the softness off, and Whiteboard's streak is finer and harder with
|
|
64
|
+
more rotation on the jitter. The other four are unchanged.
|
|
65
|
+
|
|
66
|
+
- **Primary and secondary buttons rest one rung lower.**
|
|
67
|
+
`--button-primary-surface` moves from `--surface-brand-high` to
|
|
68
|
+
`--surface-brand` and `--button-secondary-surface` from
|
|
69
|
+
`--surface-neutral-high` to `--surface-neutral`, with `--iconbutton-*`
|
|
70
|
+
following. The border scale runs at the same lightness as the `-high` surface
|
|
71
|
+
rung, so a filled button was outlined in its own fill colour: the sketch
|
|
72
|
+
effect's hatch, which inks itself from the part's stroke, came out invisible
|
|
73
|
+
on exactly these two variants while Danger, Success, and Warning shaded
|
|
74
|
+
normally. Those three already rest on `-low`. This puts Primary and Secondary
|
|
75
|
+
on the rung Badge and CornerBadge already use, and lifts white text off the
|
|
76
|
+
surface by a further step. The eight preset themes carry the new value.
|
|
77
|
+
|
|
78
|
+
- **Ink coverage scales on two axes, and the px it states are the px it
|
|
79
|
+
paints.** The Scale dial fitted a whole number of blobs to a fixed 600px tile,
|
|
80
|
+
so it could only reach the sizes that divide 600: it read 250px at the top of
|
|
81
|
+
its travel and painted 300px, there was nothing above that at all, and every
|
|
82
|
+
reading in between was the nearest fit rather than the number on the dial. The
|
|
83
|
+
tile is now painted at whatever the dial says, which makes the px exact and
|
|
84
|
+
opens the travel to 8px speckle and 600px patches.
|
|
85
|
+
|
|
86
|
+
The dial is a pair, **Scale across** and **Scale down**, held together by a
|
|
87
|
+
chain. Click it and the two part company: blobs wider than they are tall read
|
|
88
|
+
as ink dragged sideways, taller than wide as a vertical grain, and the fill
|
|
89
|
+
keeps the same field underneath either way. Sketchstyles stored before the
|
|
90
|
+
split come back square and linked, which is the look they had.
|
|
91
|
+
|
|
92
|
+
Unlinked, a **Rotation** dial appears with them and points the stretch
|
|
93
|
+
wherever you like. It is offered only there because a field the same in every
|
|
94
|
+
direction is the same field turned. The tile still meets itself at every
|
|
95
|
+
setting: a turned pattern repeats seamlessly only at the angles that land the
|
|
96
|
+
page's own axes back on whole noise cells, so the dial takes the nearest of
|
|
97
|
+
those and reads back the turn it landed on, usually within a degree or two of
|
|
98
|
+
the one you asked for.
|
|
99
|
+
|
|
100
|
+
- **Shipped and saved sketchstyles are one list, in one id namespace.** A
|
|
101
|
+
sketchstyle named after a shipped one replaces it and keeps its place, so a
|
|
102
|
+
project that wants its own Pencil saves one. The Sketchstyle view shows a
|
|
103
|
+
single grid; the ✕ marks the rows your project owns.
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
|
|
107
|
+
- **Saving no longer reloads the page.** A project registers its saved
|
|
108
|
+
sketchstyles with `import.meta.glob`, which is what `create` writes into
|
|
109
|
+
`main.ts`, so writing one invalidated the entry module and Vite answered with
|
|
110
|
+
a full reload. The Sketchstyle view the save came from was torn down and
|
|
111
|
+
rebuilt mid-edit, which read as the editor closing itself every time you
|
|
112
|
+
pressed Save. The dev server now keeps every JSON under the data directory off
|
|
113
|
+
its watcher: the editor reads that directory over its own API and re-lists
|
|
114
|
+
after each write, so the page already holds what the reload would fetch.
|
|
115
|
+
`tokens.generated.css` and `fonts.css` stay watched, since the page really
|
|
116
|
+
does import them and CSS updates without a reload. A data file changed from
|
|
117
|
+
outside the editor, by a CLI run or a branch switch, now needs the page
|
|
118
|
+
reloaded by hand.
|
|
119
|
+
|
|
120
|
+
### Breaking
|
|
121
|
+
|
|
122
|
+
Pre-1.0, and the sketch API is days old. Every consumer we know of is in this
|
|
123
|
+
repo or in a site we own.
|
|
124
|
+
|
|
125
|
+
- `SKETCH_LOOKS` is now the `sketchLooks` store, since looks register after the
|
|
126
|
+
module is imported and a constant array would be stale. A picker reads
|
|
127
|
+
`$sketchLooks` the way it already reads `$themeSketchLook`.
|
|
128
|
+
- `USER_STYLE_PREFIX` and `selectSavedSketchStyle` are gone. A saved
|
|
129
|
+
sketchstyle's id is its file slug, so `setSketch(id)` and
|
|
130
|
+
`selectSketchStyle(id)` take it like any other.
|
|
131
|
+
- A `user:` id already in a browser's storage is stripped on read, so no
|
|
132
|
+
migration is needed and nobody loses their selection. Themes need nothing at
|
|
133
|
+
all: a theme has always stored its `sketchStyle` by value, never by id.
|
|
134
|
+
|
|
135
|
+
## 0.66.0 — A theme's sketchstyle reaches the built site
|
|
136
|
+
|
|
137
|
+
### Added
|
|
138
|
+
|
|
139
|
+
- **`seedSketchFromTheme` carries a theme's sketchstyle into a build.** A theme
|
|
140
|
+
saved from the Sketchstyle view carries its dials, and 0.63.0 said in as many
|
|
141
|
+
words that a built site ships no sketch. That left a theme half applied: the
|
|
142
|
+
page in dev drew with the look the theme records, the page a visitor gets drew
|
|
143
|
+
with whatever shipped preset the bundle happened to hold. Three links dropped
|
|
144
|
+
it, and only one of them was a decision. `initializeTheme` runs behind
|
|
145
|
+
`import.meta.env.DEV`, so nothing in a build ever read the field; the entry
|
|
146
|
+
point exported no way to apply a look it had not shipped; and there was
|
|
147
|
+
nothing for the field to be baked into, since the layer is an SVG filter bank
|
|
148
|
+
rather than a set of custom properties.
|
|
149
|
+
|
|
150
|
+
The new export is the whole route. Hand it the theme's `sketchStyle` field
|
|
151
|
+
before mounting and the built page draws with it:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { seedSketchFromTheme } from '@motion-proto/live-tokens/sketch';
|
|
155
|
+
|
|
156
|
+
seedSketchFromTheme(theme.sketchStyle);
|
|
157
|
+
await bootLiveTokens(App, '#app');
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
It takes the field raw and hydrates it, because a built site reads its theme
|
|
161
|
+
JSON with no dev server to run `normalizeTheme` over it first. Absent, `null`,
|
|
162
|
+
and anything that is not an object all mean no sketch, which is what absence
|
|
163
|
+
has always meant.
|
|
164
|
+
|
|
165
|
+
It is the rule boot already followed, not a second one: `initializeTheme` now
|
|
166
|
+
calls it too, so one piece of code decides what a theme's sketchstyle means at
|
|
167
|
+
boot in dev and in production. A visitor who has recorded a pick keeps it,
|
|
168
|
+
None included. The theme seeds a browser that has decided nothing and never
|
|
169
|
+
overwrites one that has, so calling it on every boot is safe.
|
|
170
|
+
|
|
171
|
+
Adopt still bakes nothing, and `tokens.generated.css` still holds token values
|
|
172
|
+
only. That half of 0.63.0's note stands; what it said about a built site
|
|
173
|
+
shipping no sketch does not.
|
|
174
|
+
|
|
175
|
+
- **`themeSketchLook` is the theme's own look, as a picker row.** A seeded look
|
|
176
|
+
that no shipped sketchstyle names read as `adjusted` through `sketchPick`, so
|
|
177
|
+
a picker could only label a look it had just booted into "Adjusted", and a
|
|
178
|
+
visitor who moved off it had no way back. The new store carries the same
|
|
179
|
+
`id`/`label`/`blurb` shape a shipped look has, `setSketch` takes its id, and
|
|
180
|
+
`sketchPick` reports it as the look it is. It is null when the theme carries
|
|
181
|
+
no sketchstyle, and null when what it carries is one of the shipped looks,
|
|
182
|
+
since that look's own row already names it.
|
|
183
|
+
|
|
184
|
+
- **`SketchStyle` is exported from `@motion-proto/live-tokens/sketch`**, so a
|
|
185
|
+
site can type the field it pulled out of its own theme JSON.
|
|
186
|
+
|
|
3
187
|
## 0.65.1 — applyFontStacks returns what it wrote
|
|
4
188
|
|
|
5
189
|
### Changed
|