@uniflowed/stylex 0.9.0 → 0.11.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/package.json +3 -3
- package/preset.js +43 -14
- package/tokens.stylex.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniflowed/stylex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Flow declarations for @uniflowed/stylex, part of the Unified Toolchain for Flow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/ubugeeei-prod/uf.git",
|
|
11
|
-
"directory": "
|
|
11
|
+
"directory": "npm/stylex"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
".": "./index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"!*.test.js"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@uniflowed/core": "0.
|
|
26
|
+
"@uniflowed/core": "0.11.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react-native": ">=0.86.0"
|
package/preset.js
CHANGED
|
@@ -234,36 +234,55 @@ const fields = stylex.create({
|
|
|
234
234
|
|
|
235
235
|
const overlays = stylex.create({
|
|
236
236
|
// Enter: the wash fades in over `durationSlow`, the same time as the panel
|
|
237
|
-
// in front of it.
|
|
237
|
+
// in front of it. Exit: it clears with the panel, in `durationBase` on the
|
|
238
|
+
// accelerating curve, while `@uniflowed/ui` keeps it on the page with
|
|
239
|
+
// `data-state="closed"` and `inert`. A fade is what reduced motion keeps,
|
|
240
|
+
// so it keeps both.
|
|
238
241
|
backdrop: {
|
|
239
242
|
position: "fixed",
|
|
240
243
|
inset: 0,
|
|
241
244
|
backgroundColor: ufTokens.scrim,
|
|
242
|
-
opacity: { default: 1, "@starting-style": 0 },
|
|
245
|
+
opacity: { default: 1, "@starting-style": 0, ":is([data-state=closed])": 0 },
|
|
243
246
|
transitionProperty: "opacity",
|
|
244
|
-
transitionDuration:
|
|
245
|
-
|
|
247
|
+
transitionDuration: {
|
|
248
|
+
default: ufTokens.durationSlow,
|
|
249
|
+
":is([data-state=closed])": ufTokens.durationBase,
|
|
250
|
+
},
|
|
251
|
+
transitionTimingFunction: {
|
|
252
|
+
default: ufTokens.easingEnter,
|
|
253
|
+
":is([data-state=closed])": ufTokens.easingExit,
|
|
254
|
+
},
|
|
246
255
|
},
|
|
247
256
|
// Enter: the panel fades in and grows from 96% of its size where it rests,
|
|
248
257
|
// on the decelerating curve, so it is legible almost at once and is seen
|
|
249
258
|
// settling rather than popping. The centring translate is part of both
|
|
250
|
-
// values, or the panel would start in the corner.
|
|
251
|
-
//
|
|
259
|
+
// values, or the panel would start in the corner. Exit: back to 96% as it
|
|
260
|
+
// fades, in `durationBase` on the accelerating curve. Under reduced motion
|
|
261
|
+
// both only fade: `--uf-exit-travel` is 0 there, so the scale does not jump.
|
|
252
262
|
dialog: {
|
|
253
263
|
position: "fixed",
|
|
254
264
|
top: "50%",
|
|
255
265
|
left: "50%",
|
|
256
|
-
|
|
266
|
+
"--uf-exit-travel": { default: "1", "@media (prefers-reduced-motion: reduce)": "0" },
|
|
267
|
+
opacity: { default: 1, "@starting-style": 0, ":is([data-state=closed])": 0 },
|
|
257
268
|
transform: {
|
|
258
269
|
default: "translate(-50%, -50%)",
|
|
259
270
|
"@starting-style": "translate(-50%, -50%) scale(0.96)",
|
|
271
|
+
":is([data-state=closed])":
|
|
272
|
+
"translate(-50%, -50%) scale(calc(1 - 0.04 * var(--uf-exit-travel)))",
|
|
260
273
|
},
|
|
261
274
|
transitionProperty: {
|
|
262
275
|
default: "opacity, transform",
|
|
263
276
|
"@media (prefers-reduced-motion: reduce)": "opacity",
|
|
264
277
|
},
|
|
265
|
-
transitionDuration:
|
|
266
|
-
|
|
278
|
+
transitionDuration: {
|
|
279
|
+
default: ufTokens.durationSlow,
|
|
280
|
+
":is([data-state=closed])": ufTokens.durationBase,
|
|
281
|
+
},
|
|
282
|
+
transitionTimingFunction: {
|
|
283
|
+
default: ufTokens.easingEnter,
|
|
284
|
+
":is([data-state=closed])": ufTokens.easingExit,
|
|
285
|
+
},
|
|
267
286
|
width: "calc(100% - 32px)",
|
|
268
287
|
maxWidth: "32rem",
|
|
269
288
|
backgroundColor: ufTokens.surface,
|
|
@@ -279,8 +298,9 @@ const overlays = stylex.create({
|
|
|
279
298
|
|
|
280
299
|
const menus = stylex.create({
|
|
281
300
|
// Enter: it fades in while travelling 4px out of its trigger, from the side
|
|
282
|
-
// `@uniflowed/ui` put it on (`data-side`), the way `
|
|
283
|
-
// does.
|
|
301
|
+
// `@uniflowed/ui` put it on (`data-side`), the way `npm/ui/registry/menu.js`
|
|
302
|
+
// does. Exit: back towards the trigger in `durationFast` on the
|
|
303
|
+
// accelerating curve. Under reduced motion both only fade.
|
|
284
304
|
menu: {
|
|
285
305
|
"--uf-enter-x": {
|
|
286
306
|
default: "0px",
|
|
@@ -292,17 +312,26 @@ const menus = stylex.create({
|
|
|
292
312
|
":is([data-side=top])": "4px",
|
|
293
313
|
":is([data-side=bottom])": "-4px",
|
|
294
314
|
},
|
|
295
|
-
|
|
315
|
+
"--uf-exit-travel": { default: "1", "@media (prefers-reduced-motion: reduce)": "0" },
|
|
316
|
+
opacity: { default: 1, "@starting-style": 0, ":is([data-state=closed])": 0 },
|
|
296
317
|
transform: {
|
|
297
318
|
default: "none",
|
|
298
319
|
"@starting-style": "translate(var(--uf-enter-x), var(--uf-enter-y))",
|
|
320
|
+
":is([data-state=closed])":
|
|
321
|
+
"translate(calc(var(--uf-enter-x) * var(--uf-exit-travel)), calc(var(--uf-enter-y) * var(--uf-exit-travel)))",
|
|
299
322
|
},
|
|
300
323
|
transitionProperty: {
|
|
301
324
|
default: "opacity, transform",
|
|
302
325
|
"@media (prefers-reduced-motion: reduce)": "opacity",
|
|
303
326
|
},
|
|
304
|
-
transitionDuration:
|
|
305
|
-
|
|
327
|
+
transitionDuration: {
|
|
328
|
+
default: ufTokens.durationBase,
|
|
329
|
+
":is([data-state=closed])": ufTokens.durationFast,
|
|
330
|
+
},
|
|
331
|
+
transitionTimingFunction: {
|
|
332
|
+
default: ufTokens.easingEnter,
|
|
333
|
+
":is([data-state=closed])": ufTokens.easingExit,
|
|
334
|
+
},
|
|
306
335
|
minWidth: "12rem",
|
|
307
336
|
margin: 0,
|
|
308
337
|
padding: ufTokens.space1,
|
package/tokens.stylex.js
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
// look is flat, and a gradient is a decision about a brand this module does
|
|
41
41
|
// not have, so neither is a token and neither appears in a default style.
|
|
42
42
|
// `crates/uf_stylex/src/tests/defaults.rs` compiles every default style —
|
|
43
|
-
// this module, `preset.js`, `theme.js` and every file in `
|
|
43
|
+
// this module, `preset.js`, `theme.js` and every file in `npm/ui/registry/` — and
|
|
44
44
|
// fails on a `box-shadow`, a `text-shadow`, a `drop-shadow()` or a gradient.
|
|
45
45
|
//
|
|
46
46
|
// # What is not a token
|