@crystal-ui/core 2.3.0 → 2.4.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/README.md +82 -23
- package/assets/core/preferences.d.ts +4 -4
- package/assets/core/preferences.js +4 -4
- package/assets/core/presets.d.ts +4 -3
- package/assets/core/presets.js +24 -18
- package/assets/core/spring.js +9 -10
- package/assets/core/state.js +7 -7
- package/assets/crystal.css +784 -284
- package/assets/crystal.d.ts +3 -3
- package/assets/crystal.js +100 -123
- package/assets/icons/heading-2.svg +1 -0
- package/assets/icons/heading-3.svg +1 -0
- package/assets/icons/heading-4.svg +1 -0
- package/assets/icons/link.svg +1 -0
- package/assets/icons/list-ordered.svg +1 -0
- package/assets/icons/list.svg +1 -0
- package/assets/icons/manifest.json +81 -2
- package/assets/icons/quote.svg +1 -0
- package/assets/icons/redo.svg +1 -0
- package/assets/icons/subscript.svg +1 -0
- package/assets/icons/undo.svg +1 -0
- package/assets/icons/unlink.svg +1 -0
- package/assets/motion.js +13 -12
- package/docs/accessibility.md +50 -54
- package/docs/adoption.md +33 -19
- package/docs/catalogue.md +113 -108
- package/docs/colors.md +67 -73
- package/docs/components.md +142 -66
- package/docs/icons.md +9 -3
- package/docs/materials.md +129 -117
- package/docs/motion-components.md +15 -15
- package/docs/motion.md +156 -158
- package/docs/principles.md +12 -12
- package/docs/tokens.md +129 -130
- package/engines.js +3 -3
- package/package.json +11 -3
- package/tokens/catalogue/01-layout.json +1 -1
- package/tokens/catalogue/02-navigation.json +4 -4
- package/tokens/catalogue/03-actions.json +2 -1
- package/tokens/catalogue/04-inputs.json +30 -22
- package/tokens/catalogue/05-data-display.json +9 -14
- package/tokens/catalogue/06-feedback.json +8 -6
- package/tokens/catalogue/07-overlays.json +4 -4
- package/tokens/catalogue/08-typography.json +12 -8
- package/tokens/catalogue/09-utility.json +1 -1
- package/tokens/catalogue/10-charts.json +7 -7
- package/tokens/catalogue/11-media.json +33 -20
- package/tokens/catalogue/12-commerce.json +4 -4
- package/tokens/catalogue/13-screens.json +2 -3
- package/tokens/catalogue/14-blocks.json +3 -3
- package/tokens/catalogue.json +176 -116
- package/tokens/crystal.tokens.json +6 -6
- package/tokens/motion-recipes.json +6 -6
- package/tokens/surface-recipes.json +3452 -0
- package/tokens/surfaces.json +48 -17
package/assets/crystal.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* The token resolver, as a module.
|
|
2
2
|
*
|
|
3
|
-
* `resolve` is the
|
|
4
|
-
*
|
|
3
|
+
* `resolve` is the reason this is importable. It turns a palette, a mode and a
|
|
4
|
+
* set of preferences into the custom properties a surface renders from. A
|
|
5
5
|
* library that can only load the generated stylesheet gets one palette at
|
|
6
|
-
* `:root`,
|
|
6
|
+
* `:root`, and the design system has six.
|
|
7
7
|
*/
|
|
8
8
|
export interface CrystalConfiguration {
|
|
9
9
|
palette?: string;
|
package/assets/crystal.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* Crystal. Pure token resolver + CSS exporter. No dependencies.
|
|
2
2
|
*
|
|
3
|
-
* Loadable two ways
|
|
3
|
+
* Loadable two ways. In a browser it is a script that reads
|
|
4
4
|
* `window.CRYSTAL_TOKENS` and publishes `window.Crystal`. Under a module loader it
|
|
5
5
|
* takes the flat token file directly and exports the same object.
|
|
6
6
|
*
|
|
7
|
-
* The second path exists because a platform library needs `resolve()
|
|
8
|
-
* palette, a mode and a set of preferences into the ~90 custom
|
|
9
|
-
* surface
|
|
10
|
-
* stylesheet, which carries one palette at `:root
|
|
11
|
-
* mode it offered was decoration. CONTRACT §1 says to reuse this
|
|
12
|
-
* rather than reimplement it,
|
|
7
|
+
* The second path exists because a platform library needs `resolve()`, which
|
|
8
|
+
* turns a palette, a mode and a set of preferences into the ~90 custom
|
|
9
|
+
* properties a surface renders from. Without it a library can only load the
|
|
10
|
+
* generated stylesheet, which carries one palette at `:root`, so every per-scope
|
|
11
|
+
* palette and mode it offered was decoration. CONTRACT §1 says to reuse this
|
|
12
|
+
* arithmetic rather than reimplement it, which requires that it can be imported. */
|
|
13
13
|
(function(root){
|
|
14
14
|
'use strict';
|
|
15
15
|
const data=root.CRYSTAL_TOKENS
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
if(!data) throw new Error('Load tokens.js before crystal.js');
|
|
18
18
|
/* `chartSeries1` is `--cr-chart-series-1`, not `--cr-chart-series1`. The digit
|
|
19
19
|
boundary is a word boundary here because Crystal already writes its numbered
|
|
20
|
-
properties that way
|
|
20
|
+
properties that way (`--cr-focus-feather-1` predates this), and a scale a
|
|
21
21
|
stylesheet indexes with `var(--cr-chart-series-#{$i})` reads as one. No role
|
|
22
22
|
name carried a digit before the series scale, so nothing renamed. */
|
|
23
23
|
const camelToKebab=s=>s.replace(/[A-Z]/g,m=>'-'+m.toLowerCase()).replace(/([a-z])(\d)/g,'$1-$2');
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
const tokens={};for(const [key,val] of Object.entries(p))tokens['--cr-'+camelToKebab(key)]=val;
|
|
45
45
|
/* Coloured glass casts a coloured shadow. The light a material refracts is the light
|
|
46
46
|
that reaches the surface beneath it, so the shadow carries the palette's companion
|
|
47
|
-
hue
|
|
48
|
-
|
|
47
|
+
hue instead of neutral grey. The mix is on the colour only. The alpha of each
|
|
48
|
+
layer is preserved exactly, because tinting a shadow must not also deepen it. */
|
|
49
49
|
const mixInto=(base,tint,amount)=>{
|
|
50
50
|
const [br,bg,bb]=base,[tr,tg,tb]=rgb(tint);
|
|
51
51
|
const m=(a,b)=>Math.round(a+(b-a)*amount);
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
'--cr-atmosphere-two':rgba(p.companion,s.atmosphere/100*(dark?.23:.19)),
|
|
67
67
|
/* Plastic is opaque, so it cannot refract; it emits. This is the palette's own
|
|
68
68
|
glow carried by the foundation, at the intensity the active scheme's atmosphere
|
|
69
|
-
setting asks for
|
|
69
|
+
setting asks for: the base glow of the primary plus the scheme's tint. */
|
|
70
70
|
'--cr-atmosphere-glow':rgba(p.glow,s.atmosphere/100*(dark?.18:.14)),
|
|
71
71
|
'--cr-acrylic-fill':s.reduced?p.surface:rgba(p.surface,Math.min(.94,tint+.1)),
|
|
72
72
|
'--cr-glass-fill':s.reduced?p.surface:rgba(p.surface,data.material.glassOpacity),
|
|
@@ -75,17 +75,15 @@
|
|
|
75
75
|
'--cr-content-own-fill':s.reduced?(p.contentOwnSurface||p.primarySoft):rgba(p.contentOwnSurface||p.primarySoft,data.material.contentOpacity),
|
|
76
76
|
'--cr-content-feather':s.reduced?'0px':data.material.contentFeather+'px',
|
|
77
77
|
/* How far the Haze content fill is held back from a Resin surface's own
|
|
78
|
-
rim. The fill and its feather
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
exactly what Crystal React did on sixteen surfaces. A recipe that only
|
|
82
|
-
one renderer knows is not a specification. */
|
|
78
|
+
rim. The fill and its feather are tokens, and the inset is published
|
|
79
|
+
with them: a platform library that reads only the tokens could
|
|
80
|
+
otherwise carry every Haze token and still paint no fill. */
|
|
83
81
|
'--cr-haze-inset':data.component.haze.inset+'px',
|
|
84
|
-
/* Control geometry
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
/* Control geometry: 26px boxes, a 44×28 track, .55 for a disabled
|
|
83
|
+
control. The same numbers are published as tokens a platform library
|
|
84
|
+
reads, and two statements of one value is the drift CONTRACT §1
|
|
85
|
+
forbids, so `crystal.css` reads these and its literal is the fallback
|
|
86
|
+
only. */
|
|
89
87
|
'--cr-action-disabled-opacity':String(data.component.action.disabledOpacity),
|
|
90
88
|
'--cr-choice-box-size':data.component.choice.boxSize+'px',
|
|
91
89
|
'--cr-choice-box-radius':data.component.choice.boxRadius+'px',
|
|
@@ -93,10 +91,9 @@
|
|
|
93
91
|
'--cr-switch-track-height':data.component.switch.trackHeight+'px',
|
|
94
92
|
/* Chart geometry. A chart's colours vary with the palette and arrive with
|
|
95
93
|
the other roles above; these do not vary at all. They are published
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
did — which is how two renderers end up with two of them. */
|
|
94
|
+
here because the catalogue says "line weight follows the stroke scale"
|
|
95
|
+
and "point size is a scale, not an arbitrary radius", and a scale
|
|
96
|
+
left to each renderer becomes two scales. */
|
|
100
97
|
'--cr-chart-stroke':data.component.chart.stroke+'px',
|
|
101
98
|
'--cr-chart-hairline':data.component.chart.hairline+'px',
|
|
102
99
|
'--cr-chart-point-min':data.component.chart.pointMin+'px',
|
|
@@ -112,14 +109,13 @@
|
|
|
112
109
|
'--cr-content-own-text':s.palette==='harbor'?p.text:p.onPrimarySoft,
|
|
113
110
|
'--cr-stone-feather':s.reduced?'0px':data.material.stoneFeather+'px',
|
|
114
111
|
/* Scrollbars.
|
|
115
|
-
The thumb is ink, not material.
|
|
116
|
-
surface colour is
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
both modes, which validate-tokens asserts.
|
|
112
|
+
The thumb is ink, not material. A thumb painted in the material's own
|
|
113
|
+
surface colour is invisible: a white thumb at 62% over a white Frost
|
|
114
|
+
panel is a white panel. The Frost thumb is the palette's ink, as the
|
|
115
|
+
panel's own text is, and the Resin thumb is the palette's primary,
|
|
116
|
+
because Resin is the floating control plane and a scrollbar there is a
|
|
117
|
+
control. Both clear 3:1 against surface, surfaceAlt and canvas in every
|
|
118
|
+
palette and both modes, which validate-tokens asserts.
|
|
123
119
|
The track stays a faint channel so the panel shows through. */
|
|
124
120
|
'--cr-scrollbar-width':data.component.scrollbar.width+'px',
|
|
125
121
|
'--cr-scrollbar-thumb-min':data.component.scrollbar.thumbMinLength+'px',
|
|
@@ -133,91 +129,75 @@
|
|
|
133
129
|
'--cr-overlay-tooltip-max-width':data.component.overlay.tooltipMaxWidth+'px',
|
|
134
130
|
/* Focus, as two properties rather than as a recipe each platform retypes.
|
|
135
131
|
Crystal's focus is a crisp 2px primary core at 3px offset inside a
|
|
136
|
-
four-layer feathered halo
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
must not load — so Crystal React read it on a Card and a Slider and got
|
|
145
|
-
nothing, and those two inset shadows have never painted. A value two
|
|
146
|
-
components depend on belongs to the system. */
|
|
132
|
+
four-layer feathered halo. `crystal.css` writes it out longhand, which
|
|
133
|
+
works for a stylesheet that can use `:focus-visible` on a native
|
|
134
|
+
element and is no use to a library styling a shell that wraps one.
|
|
135
|
+
Published here so there is one recipe, in one place, and CONTRACT §1
|
|
136
|
+
is kept. */
|
|
137
|
+
/* The inner edge a control's well is drawn with. A Card and a Slider both
|
|
138
|
+
read it, so it belongs to the system; the preview's own `controls.css`
|
|
139
|
+
is a layer a library must not load. */
|
|
147
140
|
'--cr-control-edge':rgba(p.outline,0.18),
|
|
148
|
-
/* The two tints the Resin control sheen is built from
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
with the rest of D-11.
|
|
141
|
+
/* The two tints the Resin control sheen is built from. Like
|
|
142
|
+
`--cr-control-edge` above, they are published here so the sheen ships
|
|
143
|
+
with the library and does not live only in the preview's
|
|
144
|
+
`controls.css`. Adopted 21 September 2026 with the rest of D-11.
|
|
153
145
|
|
|
154
146
|
`--cr-control-color` is the decorative tint that gives the control its
|
|
155
147
|
body; `--cr-control-light` is the glow that lights its top-left corner.
|
|
156
|
-
Both go
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
/* `color-mix` rather than a resolved `rgba`,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
makes the adoption exact. */
|
|
148
|
+
Both go down in dark mode, the opposite of the focus feathers. On a
|
|
149
|
+
deep canvas the sheen is already reading against very little, and
|
|
150
|
+
holding it at the light-mode strength makes a control look lit from
|
|
151
|
+
inside rather than lit from above. */
|
|
152
|
+
/* `color-mix` rather than a resolved `rgba`, the one place in this theme
|
|
153
|
+
that departs from the convention, for two measured reasons. A resolved
|
|
154
|
+
`rgba` alpha is quantised to 8 bits by the time a browser serialises it
|
|
155
|
+
(0.126 comes back as 0.125), and an A/B of the site against this
|
|
156
|
+
library put a worst channel delta of 2 on the playground's controls
|
|
157
|
+
from that alone. And a mix keeps the tint tracking `--cr-glow` and
|
|
158
|
+
`--cr-decorative`, so a product that retints either gets a sheen that
|
|
159
|
+
follows, where a resolved value would not. The preview writes these as
|
|
160
|
+
mixes, so a mix is also what makes the adoption exact. */
|
|
170
161
|
'--cr-control-color':`color-mix(in srgb,var(--cr-decorative) ${dark?7:8.4}%,transparent)`,
|
|
171
162
|
'--cr-control-light':`color-mix(in srgb,var(--cr-glow) ${dark?9.8:12.6}%,transparent)`,
|
|
172
163
|
'--cr-focus-core':p.primary,
|
|
173
164
|
'--cr-focus-core-width':'2px',
|
|
174
165
|
'--cr-focus-core-offset':'3px',
|
|
175
|
-
/* The four feather colours,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
alphas straight into `--cr-focus-ring`. That is precisely why the
|
|
180
|
-
dark-mode divergence could hide for so long: there was no property to
|
|
181
|
-
compare, so no gate could have been written that would have caught it.
|
|
182
|
-
Naming them is half of D-11's fix; the other half is that a product can
|
|
183
|
-
now retint the falloff without restating the whole recipe.
|
|
166
|
+
/* The four feather colours, `--cr-focus-feather-1` to `-4`, published
|
|
167
|
+
rather than inlined into `--cr-focus-ring`. A named property can be
|
|
168
|
+
compared by a gate, and a product can retint the falloff without
|
|
169
|
+
restating the whole recipe (D-11).
|
|
184
170
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
canvas and every consumer's went thin. Meridian decided on 21 September
|
|
189
|
-
2026 that the library carries it. */
|
|
171
|
+
Dark mode lifts them: 56/38/22/11 against light's 46/30/17/8. Without
|
|
172
|
+
the lift the falloff goes thin against a deep canvas. Meridian decided
|
|
173
|
+
on 21 September 2026 that the library carries it. */
|
|
190
174
|
...Object.fromEntries((dark?[56,38,22,11]:[46,30,17,8])
|
|
191
175
|
.map((pct,i)=>[`--cr-focus-feather-${i+1}`,rgba(p.primary,pct/100)])),
|
|
192
176
|
/* The broad layer's colour, and the one part of focus that is not the
|
|
193
177
|
primary: it is `--cr-decorative`, so the lift under a focused control
|
|
194
|
-
carries the palette's own shadow hue
|
|
195
|
-
purple.
|
|
178
|
+
carries the palette's own shadow hue instead of tinting everything
|
|
179
|
+
purple. */
|
|
196
180
|
'--cr-focus-shadow':rgba(p.decorative,0.27),
|
|
197
181
|
/* Six layers: the four-layer halo, then two that lift.
|
|
198
|
-
|
|
199
|
-
Spreads 1/3/6/11, not 2/6/12/22
|
|
200
|
-
request,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
Written as `var()` references to the properties above, which is the
|
|
213
|
-
shape the preview used. It keeps the recipe readable at the point of
|
|
214
|
-
use and it is what lets the two be compared layer by layer. */
|
|
182
|
+
|
|
183
|
+
Spreads are 1/3/6/11, not 2/6/12/22: the halo was halved at Meridian's
|
|
184
|
+
request, and 2/6/12/22 is the withdrawn recipe.
|
|
185
|
+
|
|
186
|
+
The pair beneath, `0 8px 18px` directional and `0 22px 40px` broad, is
|
|
187
|
+
the lift a focused control makes, which `components.md` describes as
|
|
188
|
+
Crystal's own behaviour. Meridian decided on 21 September that the
|
|
189
|
+
library carries them, so this is the whole recipe and the preview's
|
|
190
|
+
copy is redundant.
|
|
191
|
+
|
|
192
|
+
Written as `var()` references to the properties above, the shape the
|
|
193
|
+
preview uses. It keeps the recipe readable at the point of use and
|
|
194
|
+
lets the two be compared layer by layer. */
|
|
215
195
|
'--cr-focus-ring':[
|
|
216
196
|
...[[6,1,1],[16,3,2],[30,6,3],[54,11,4]]
|
|
217
197
|
.map(([blur,spread,n])=>`0 0 ${blur}px ${spread}px var(--cr-focus-feather-${n})`),
|
|
218
|
-
/* The directional layer borrows the second feather
|
|
219
|
-
fifth colour
|
|
220
|
-
|
|
198
|
+
/* The directional layer borrows the second feather instead of naming a
|
|
199
|
+
fifth colour: a lift that is a shade of the halo above it reads as
|
|
200
|
+
the same light source. */
|
|
221
201
|
'0 8px 18px var(--cr-focus-feather-2)',
|
|
222
202
|
'0 22px 40px var(--cr-focus-shadow)',
|
|
223
203
|
].join(','),
|
|
@@ -253,34 +233,31 @@
|
|
|
253
233
|
'--cr-edge':rgba(p.outline,dark?.34:.25),'--cr-rim':highlight,
|
|
254
234
|
/* The two inks the composed shadows are built from, exported so a one-off
|
|
255
235
|
shadow can be made of Crystal's ink instead of a literal.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
substitution rather than an invention. */
|
|
236
|
+
|
|
237
|
+
Crystal's shadow ink is palette-tinted: the base violet mixed with the
|
|
238
|
+
palette's companion, so a shadow in Ion is a different colour from a
|
|
239
|
+
shadow in Fuchsia, and it darkens in dark mode. A literal cannot do
|
|
240
|
+
either. `controls.css` carries eleven hard-coded `#080b24…` values, a
|
|
241
|
+
fixed dark navy, and those eleven shadows are the one part of the
|
|
242
|
+
preview that does not follow the palette. Naming the ink makes
|
|
243
|
+
replacing them a substitution (D-9). */
|
|
265
244
|
'--cr-shadow-contact':contact,
|
|
266
245
|
'--cr-shadow-cast':shadow,
|
|
267
246
|
'--cr-shadow-content':`0 ${2*e}px ${3*e}px ${contact}, 0 ${7*e}px ${15*e}px ${shadow}`,
|
|
268
247
|
'--cr-shadow-panel':`inset 0 1px 0 ${highlight}, 0 ${3*e}px ${5*e}px ${contact}, 0 ${14*e}px ${28*e}px ${shadow}`,
|
|
269
|
-
/* Resin's float,
|
|
270
|
-
`controls.css`
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
blessed distances divided by the default 125% elevation, so the default
|
|
283
|
-
renders what was approved and the slider now moves it. */
|
|
248
|
+
/* Resin's float, matching the approved baseline. The preview loads its
|
|
249
|
+
own hand-written literal from `controls.css`, `inset 0 2px 1px, inset
|
|
250
|
+
0 -1px 1px, 0 5px 9px #080b2412, 0 16px 30px #080b2420`, so that
|
|
251
|
+
literal is what the approved baseline shows, and this token is what
|
|
252
|
+
every platform library gets. The two must agree, or a library
|
|
253
|
+
following the token cannot reproduce the approved appearance.
|
|
254
|
+
The rims are the approved ones: 2px of light along the top where it
|
|
255
|
+
catches, and a light edge returning underneath. A dark lower inset
|
|
256
|
+
reads as an inner shadow instead of glass. The elevation is this
|
|
257
|
+
token's: tinted with the palette like every other Crystal shadow, and
|
|
258
|
+
scaled by the elevation control. The coefficients are the approved
|
|
259
|
+
distances divided by the default 125% elevation, so the default renders
|
|
260
|
+
what was approved and the slider moves it. */
|
|
284
261
|
'--cr-shadow-float':`inset 0 2px 1px ${highlight}, inset 0 -1px 1px ${highlight}, 0 ${4*e}px ${7.2*e}px ${contact}, 0 ${12.8*e}px ${24*e}px ${shadow}`,
|
|
285
262
|
'--cr-press':ms(data.motion.press),'--cr-state':ms(data.motion.state),'--cr-spatial':ms(data.motion.spatial),
|
|
286
263
|
'--cr-exit':ms(data.motion.exit),'--cr-motion-enabled':s.reduceMotion?'0':'1',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12h8" /><path d="M4 18V6" /><path d="M12 18V6" /><path d="M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12h8" /><path d="M4 18V6" /><path d="M12 18V6" /><path d="M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2" /><path d="M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 18V6" /><path d="M17 10v3a1 1 0 0 0 1 1h3" /><path d="M21 10v8" /><path d="M4 12h8" /><path d="M4 18V6" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" /><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5h10" /><path d="M11 12h10" /><path d="M11 19h10" /><path d="M4 4h1v5" /><path d="M4 9h2" /><path d="M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5h.01" /><path d="M3 12h.01" /><path d="M3 19h.01" /><path d="M8 5h13" /><path d="M8 12h13" /><path d="M8 19h13" /></svg>
|
|
@@ -6,14 +6,27 @@
|
|
|
6
6
|
"linecap": "round",
|
|
7
7
|
"linejoin": "round"
|
|
8
8
|
},
|
|
9
|
-
"total":
|
|
9
|
+
"total": 1022,
|
|
10
|
+
"required": [
|
|
11
|
+
"heading-2",
|
|
12
|
+
"heading-3",
|
|
13
|
+
"heading-4",
|
|
14
|
+
"link",
|
|
15
|
+
"list",
|
|
16
|
+
"list-ordered",
|
|
17
|
+
"quote",
|
|
18
|
+
"redo",
|
|
19
|
+
"subscript",
|
|
20
|
+
"undo",
|
|
21
|
+
"unlink"
|
|
22
|
+
],
|
|
10
23
|
"sources": {
|
|
11
24
|
"crystal": {
|
|
12
25
|
"count": 13,
|
|
13
26
|
"license": "Original work"
|
|
14
27
|
},
|
|
15
28
|
"lucide": {
|
|
16
|
-
"count":
|
|
29
|
+
"count": 1009,
|
|
17
30
|
"license": "ISC",
|
|
18
31
|
"notice": "core/licenses/lucide-LICENSE.txt"
|
|
19
32
|
}
|
|
@@ -2851,6 +2864,24 @@
|
|
|
2851
2864
|
"source": "lucide",
|
|
2852
2865
|
"license": "ISC"
|
|
2853
2866
|
},
|
|
2867
|
+
{
|
|
2868
|
+
"id": "heading-2",
|
|
2869
|
+
"name": "Heading 2",
|
|
2870
|
+
"source": "lucide",
|
|
2871
|
+
"license": "ISC"
|
|
2872
|
+
},
|
|
2873
|
+
{
|
|
2874
|
+
"id": "heading-3",
|
|
2875
|
+
"name": "Heading 3",
|
|
2876
|
+
"source": "lucide",
|
|
2877
|
+
"license": "ISC"
|
|
2878
|
+
},
|
|
2879
|
+
{
|
|
2880
|
+
"id": "heading-4",
|
|
2881
|
+
"name": "Heading 4",
|
|
2882
|
+
"source": "lucide",
|
|
2883
|
+
"license": "ISC"
|
|
2884
|
+
},
|
|
2854
2885
|
{
|
|
2855
2886
|
"id": "headphone-off",
|
|
2856
2887
|
"name": "Headphone Off",
|
|
@@ -3241,12 +3272,24 @@
|
|
|
3241
3272
|
"source": "lucide",
|
|
3242
3273
|
"license": "ISC"
|
|
3243
3274
|
},
|
|
3275
|
+
{
|
|
3276
|
+
"id": "link",
|
|
3277
|
+
"name": "Link",
|
|
3278
|
+
"source": "lucide",
|
|
3279
|
+
"license": "ISC"
|
|
3280
|
+
},
|
|
3244
3281
|
{
|
|
3245
3282
|
"id": "link-2-off",
|
|
3246
3283
|
"name": "Link 2 Off",
|
|
3247
3284
|
"source": "lucide",
|
|
3248
3285
|
"license": "ISC"
|
|
3249
3286
|
},
|
|
3287
|
+
{
|
|
3288
|
+
"id": "list",
|
|
3289
|
+
"name": "List",
|
|
3290
|
+
"source": "lucide",
|
|
3291
|
+
"license": "ISC"
|
|
3292
|
+
},
|
|
3250
3293
|
{
|
|
3251
3294
|
"id": "list-check",
|
|
3252
3295
|
"name": "List Check",
|
|
@@ -3289,6 +3332,12 @@
|
|
|
3289
3332
|
"source": "lucide",
|
|
3290
3333
|
"license": "ISC"
|
|
3291
3334
|
},
|
|
3335
|
+
{
|
|
3336
|
+
"id": "list-ordered",
|
|
3337
|
+
"name": "List Ordered",
|
|
3338
|
+
"source": "lucide",
|
|
3339
|
+
"license": "ISC"
|
|
3340
|
+
},
|
|
3292
3341
|
{
|
|
3293
3342
|
"id": "list-plus",
|
|
3294
3343
|
"name": "List Plus",
|
|
@@ -4309,6 +4358,12 @@
|
|
|
4309
4358
|
"source": "lucide",
|
|
4310
4359
|
"license": "ISC"
|
|
4311
4360
|
},
|
|
4361
|
+
{
|
|
4362
|
+
"id": "quote",
|
|
4363
|
+
"name": "Quote",
|
|
4364
|
+
"source": "lucide",
|
|
4365
|
+
"license": "ISC"
|
|
4366
|
+
},
|
|
4312
4367
|
{
|
|
4313
4368
|
"id": "rabbit",
|
|
4314
4369
|
"name": "Rabbit",
|
|
@@ -4399,6 +4454,12 @@
|
|
|
4399
4454
|
"source": "lucide",
|
|
4400
4455
|
"license": "ISC"
|
|
4401
4456
|
},
|
|
4457
|
+
{
|
|
4458
|
+
"id": "redo",
|
|
4459
|
+
"name": "Redo",
|
|
4460
|
+
"source": "lucide",
|
|
4461
|
+
"license": "ISC"
|
|
4462
|
+
},
|
|
4402
4463
|
{
|
|
4403
4464
|
"id": "redo-dot",
|
|
4404
4465
|
"name": "Redo Dot",
|
|
@@ -5275,6 +5336,12 @@
|
|
|
5275
5336
|
"source": "lucide",
|
|
5276
5337
|
"license": "ISC"
|
|
5277
5338
|
},
|
|
5339
|
+
{
|
|
5340
|
+
"id": "subscript",
|
|
5341
|
+
"name": "Subscript",
|
|
5342
|
+
"source": "lucide",
|
|
5343
|
+
"license": "ISC"
|
|
5344
|
+
},
|
|
5278
5345
|
{
|
|
5279
5346
|
"id": "subtitles",
|
|
5280
5347
|
"name": "Subtitles",
|
|
@@ -5671,6 +5738,12 @@
|
|
|
5671
5738
|
"source": "lucide",
|
|
5672
5739
|
"license": "ISC"
|
|
5673
5740
|
},
|
|
5741
|
+
{
|
|
5742
|
+
"id": "undo",
|
|
5743
|
+
"name": "Undo",
|
|
5744
|
+
"source": "lucide",
|
|
5745
|
+
"license": "ISC"
|
|
5746
|
+
},
|
|
5674
5747
|
{
|
|
5675
5748
|
"id": "undo-dot",
|
|
5676
5749
|
"name": "Undo Dot",
|
|
@@ -5689,6 +5762,12 @@
|
|
|
5689
5762
|
"source": "lucide",
|
|
5690
5763
|
"license": "ISC"
|
|
5691
5764
|
},
|
|
5765
|
+
{
|
|
5766
|
+
"id": "unlink",
|
|
5767
|
+
"name": "Unlink",
|
|
5768
|
+
"source": "lucide",
|
|
5769
|
+
"license": "ISC"
|
|
5770
|
+
},
|
|
5692
5771
|
{
|
|
5693
5772
|
"id": "unlock",
|
|
5694
5773
|
"name": "Unlock",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z" /><path d="M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7v6h-6" /><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="m4 5 8 8" /><path d="m12 5-8 8" /><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7v6h6" /><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" /><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" /><line x1="8" x2="8" y1="2" y2="5" /><line x1="2" x2="5" y1="8" y2="8" /><line x1="16" x2="16" y1="19" y2="22" /><line x1="19" x2="22" y1="16" y2="16" /></svg>
|
package/assets/motion.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Crystal material choreography. Every effect is cancellable, and every effect is finite
|
|
2
|
-
except a continuous indicator
|
|
2
|
+
except a continuous indicator (activity-turn, activity-travel, skeleton-sweep), which
|
|
3
3
|
repeats while its work is pending and is stopped by the caller when the work resolves. */
|
|
4
4
|
(function(root){
|
|
5
5
|
'use strict';
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
}
|
|
44
44
|
function runComponent(element,name,frames,base,engine,options={}){
|
|
45
45
|
if(!(element instanceof Element))throw new TypeError('CrystalMotion requires an element');
|
|
46
|
-
/* `once` coalesces repeats of the
|
|
46
|
+
/* `once` coalesces repeats of the same recipe on the same element. A continuous
|
|
47
47
|
control fires its event many times a second, and restarting a 400ms animation on
|
|
48
|
-
every one of them stops it partway and begins again
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
every one of them stops it partway and begins again, which makes a slider feel
|
|
49
|
+
choppy. A different recipe still interrupts, because it expresses a different
|
|
50
|
+
thing. A caller that wants a replay, as the catalogue does, omits the option. */
|
|
51
51
|
if(options.once&&element.dataset.crMotionName===name&&element.dataset.crMotionState==='running')
|
|
52
52
|
return Promise.resolve({status:'coalesced'});
|
|
53
53
|
stop(element);element.dataset.crMotionName=name;element.dataset.crMotionEngine=engine;
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
element.dataset.crMotionSignature=recipe.signature||'measured-layout';
|
|
56
56
|
if(reduced()){element.dataset.crMotionState='instant';return Promise.resolve({status:'instant'});}
|
|
57
57
|
const opts={duration:duration(base,options.rate),engine,easing:recipe.signature==='inertia'?'cubic-bezier(0.16, 0.7, 0.2, 1)':recipe.signature==='coalesce'?'cubic-bezier(0.34, 0.08, 0.24, 1)':'cubic-bezier(0.22, 0.65, 0.22, 1)'};
|
|
58
|
-
/* A continuous recipe travels at constant speed and repeats until stop()
|
|
59
|
-
returned promise settles only when it is cancelled, which
|
|
58
|
+
/* A continuous recipe travels at constant speed and repeats until stop(). The
|
|
59
|
+
returned promise settles only when it is cancelled, which the caller does
|
|
60
60
|
the moment the pending work resolves. */
|
|
61
61
|
if(recipe.loop){opts.easing=recipe.easing||'linear';opts.repeat=Infinity;}
|
|
62
62
|
/* A staggered mark waits its turn: `index` is its position and `count` how many
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
const animations=[CrystalEngines.frames(element,frames,opts)];
|
|
69
69
|
/* The optical layers are finite decoration on a transition. On a loop they would
|
|
70
70
|
repeat with it, and a feathered edge that ripples for as long as something is
|
|
71
|
-
loading is ambient motion
|
|
71
|
+
loading is ambient motion. */
|
|
72
72
|
if(!recipe.loop)opticalLayers(element,recipe,opts,animations);
|
|
73
73
|
active.set(element,animations);element.dataset.crMotionState='running';
|
|
74
74
|
return Promise.all(animations.map(animation=>animation.finished.then(()=>true,error=>{if(error.name!=='AbortError')throw error;return false;}))).then(results=>{
|
|
@@ -140,10 +140,11 @@
|
|
|
140
140
|
}
|
|
141
141
|
media.addEventListener('change',()=>{if(reduced())stopAll();});
|
|
142
142
|
document.addEventListener('visibilitychange',()=>{if(document.hidden)stopAll();});
|
|
143
|
-
/* Ambient motion
|
|
144
|
-
of Crystal at Meridian's direction. It was specified, built and
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
/* Ambient motion, which is what a surface does at rest, is deferred to a later
|
|
144
|
+
version of Crystal at Meridian's direction. It was specified, built and
|
|
145
|
+
measured, and what shipped was not good enough to keep. The record of that
|
|
146
|
+
work is in the request log. The optical layer remains for motion that a
|
|
147
|
+
person starts. */
|
|
147
148
|
|
|
148
149
|
root.CrystalMotion=Object.freeze({play,layout,duration,recipes:Object.freeze(recipes),stop,stopAll,reduced,direction,presets:Object.freeze([...Object.keys(durationNames),...Object.keys(recipes)])});
|
|
149
150
|
})(window);
|