@orioncactuscorp/ui 1.4.1 → 1.5.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 +5 -1
- package/dist/components/Modal/Modal.css +1 -1
- package/dist/components/Modal/Modal.js +297 -291
- package/dist/components/Modal/useModalDrag.js +387 -374
- package/dist/foundations/motion.css +1 -1
- package/dist/foundations.css +1 -1
- package/dist/styles.css +2 -2
- package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/contexts.d.ts +1 -0
- package/dist/ui/src/components/Modal/contexts.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
- package/dist/ui/src/utils/motion.d.ts +2 -2
- package/dist/ui/src/utils/motion.d.ts.map +1 -1
- package/dist/utils/motion.js +19 -10
- package/dist/vscode/oc-ui-vars.css +2 -0
- package/package.json +1 -1
- package/src/scss/foundations/motion.scss +2 -0
- package/src/scss/mixins/_motion.scss +8 -0
- package/src/scss/mixins/_motion.test.ts +21 -0
package/dist/utils/motion.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ocSpring as A } from "./spring.js";
|
|
2
|
-
const
|
|
2
|
+
const f = [
|
|
3
3
|
"feedback",
|
|
4
|
+
"fade",
|
|
4
5
|
"reject",
|
|
5
6
|
"disclosure",
|
|
6
7
|
"surface",
|
|
@@ -32,6 +33,7 @@ const y = [
|
|
|
32
33
|
},
|
|
33
34
|
durationByIntent: {
|
|
34
35
|
feedback: 0.2,
|
|
36
|
+
fade: 0.2,
|
|
35
37
|
reject: 0.32,
|
|
36
38
|
disclosure: 0.2,
|
|
37
39
|
surface: 0.26,
|
|
@@ -61,6 +63,7 @@ const y = [
|
|
|
61
63
|
},
|
|
62
64
|
timingByIntent: {
|
|
63
65
|
feedback: "ease",
|
|
66
|
+
fade: "ease",
|
|
64
67
|
reject: "ease",
|
|
65
68
|
disclosure: "ease",
|
|
66
69
|
surface: "ease",
|
|
@@ -90,6 +93,7 @@ const y = [
|
|
|
90
93
|
}
|
|
91
94
|
}, C = o, L = {
|
|
92
95
|
feedback: "feedback",
|
|
96
|
+
fade: "fade",
|
|
93
97
|
reject: "feedback",
|
|
94
98
|
disclosure: "fade",
|
|
95
99
|
surface: "fade",
|
|
@@ -161,7 +165,7 @@ const y = [
|
|
|
161
165
|
return !Number.isFinite(s) || s < 0 ? e : a[2] === "ms" ? s / 1e3 : s;
|
|
162
166
|
}, n = (t, e) => typeof t?.getPropertyValue == "function" ? t.getPropertyValue(e).trim() : "", E = (t, e) => {
|
|
163
167
|
const r = { ...t };
|
|
164
|
-
for (const a of
|
|
168
|
+
for (const a of f) {
|
|
165
169
|
const s = e?.[a];
|
|
166
170
|
s && (r[a] = {
|
|
167
171
|
...t[a],
|
|
@@ -228,6 +232,10 @@ function N(t) {
|
|
|
228
232
|
n(e, "--oc-motion-duration-feedback"),
|
|
229
233
|
o.durationByIntent.feedback
|
|
230
234
|
),
|
|
235
|
+
fade: i(
|
|
236
|
+
n(e, "--oc-motion-duration-fade"),
|
|
237
|
+
o.durationByIntent.fade
|
|
238
|
+
),
|
|
231
239
|
reject: i(
|
|
232
240
|
n(e, "--oc-motion-duration-reject"),
|
|
233
241
|
o.durationByIntent.reject
|
|
@@ -299,6 +307,7 @@ function N(t) {
|
|
|
299
307
|
},
|
|
300
308
|
timingByIntent: {
|
|
301
309
|
feedback: n(e, "--oc-motion-timing-feedback") || o.timingByIntent.feedback,
|
|
310
|
+
fade: n(e, "--oc-motion-timing-fade") || o.timingByIntent.fade,
|
|
302
311
|
reject: n(e, "--oc-motion-timing-reject") || o.timingByIntent.reject,
|
|
303
312
|
disclosure: n(e, "--oc-motion-timing-disclosure") || o.timingByIntent.disclosure,
|
|
304
313
|
surface: n(e, "--oc-motion-timing-surface") || o.timingByIntent.surface,
|
|
@@ -329,7 +338,7 @@ function N(t) {
|
|
|
329
338
|
};
|
|
330
339
|
}
|
|
331
340
|
function T(t, e = "auto") {
|
|
332
|
-
return l("intent", t,
|
|
341
|
+
return l("intent", t, f), l("reduced policy", e, S), e === "auto" ? L[t] : e;
|
|
333
342
|
}
|
|
334
343
|
function _(t) {
|
|
335
344
|
return V.has(t);
|
|
@@ -364,14 +373,14 @@ function Q({
|
|
|
364
373
|
element: B,
|
|
365
374
|
tokens: D
|
|
366
375
|
}) {
|
|
367
|
-
l("intent", t,
|
|
376
|
+
l("intent", t, f), l("phase", e, w), l("pace", r, R);
|
|
368
377
|
const x = G(a), P = H(s), u = K(
|
|
369
378
|
D ?? N(B)
|
|
370
|
-
),
|
|
379
|
+
), y = T(t, m), b = j({
|
|
371
380
|
property: p,
|
|
372
381
|
reducedMotion: c,
|
|
373
|
-
reducedPolicy:
|
|
374
|
-
}), F = c &&
|
|
382
|
+
reducedPolicy: y
|
|
383
|
+
}), F = c && y === "preserve" ? u.durationFactorPreserve : c ? u.durationFactorReduced : u.durationFactor, I = O(
|
|
375
384
|
u.durationByPhase,
|
|
376
385
|
t,
|
|
377
386
|
e,
|
|
@@ -397,7 +406,7 @@ function Q({
|
|
|
397
406
|
phase: e,
|
|
398
407
|
pace: r,
|
|
399
408
|
reduced: m,
|
|
400
|
-
reducedPolicy:
|
|
409
|
+
reducedPolicy: y,
|
|
401
410
|
reducedMotion: c,
|
|
402
411
|
property: p,
|
|
403
412
|
durationFactor: x,
|
|
@@ -414,7 +423,7 @@ function Q({
|
|
|
414
423
|
};
|
|
415
424
|
}
|
|
416
425
|
const X = {
|
|
417
|
-
intents:
|
|
426
|
+
intents: f,
|
|
418
427
|
phases: w,
|
|
419
428
|
paces: R,
|
|
420
429
|
reducedPolicies: S,
|
|
@@ -430,7 +439,7 @@ export {
|
|
|
430
439
|
_ as isOcMotionFeedbackSafeProperty,
|
|
431
440
|
X as ocMotion,
|
|
432
441
|
C as ocMotionDefaultTokens,
|
|
433
|
-
|
|
442
|
+
f as ocMotionIntents,
|
|
434
443
|
R as ocMotionPaces,
|
|
435
444
|
w as ocMotionPhases,
|
|
436
445
|
S as ocMotionReducedPolicies,
|
|
@@ -303,6 +303,7 @@
|
|
|
303
303
|
--oc-motion-duration-factor: initial;
|
|
304
304
|
--oc-motion-duration-factor-preserve: initial;
|
|
305
305
|
--oc-motion-duration-factor-reduced: initial;
|
|
306
|
+
--oc-motion-duration-fade: initial;
|
|
306
307
|
--oc-motion-duration-feedback: initial;
|
|
307
308
|
--oc-motion-duration-gesture: initial;
|
|
308
309
|
--oc-motion-duration-gesture-release: initial;
|
|
@@ -324,6 +325,7 @@
|
|
|
324
325
|
--oc-motion-timing-disclosure-exit: initial;
|
|
325
326
|
--oc-motion-timing-expand: initial;
|
|
326
327
|
--oc-motion-timing-expand-exit: initial;
|
|
328
|
+
--oc-motion-timing-fade: initial;
|
|
327
329
|
--oc-motion-timing-feedback: initial;
|
|
328
330
|
--oc-motion-timing-gesture: initial;
|
|
329
331
|
--oc-motion-timing-gesture-release: initial;
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
--oc-motion-pace-normal: 1;
|
|
17
17
|
--oc-motion-pace-slow: 1.35;
|
|
18
18
|
--oc-motion-duration-feedback: 0.2s;
|
|
19
|
+
--oc-motion-duration-fade: 0.2s;
|
|
19
20
|
--oc-motion-duration-reject: #{oc-spring-settle-duration(0.32s, smooth)};
|
|
20
21
|
--oc-motion-duration-disclosure: 0.2s;
|
|
21
22
|
--oc-motion-duration-disclosure-exit: 0.14s;
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
--oc-motion-duration-gesture-release: 0.52s;
|
|
32
33
|
--oc-motion-duration-ambient: 1.2s;
|
|
33
34
|
--oc-motion-timing-feedback: ease;
|
|
35
|
+
--oc-motion-timing-fade: ease;
|
|
34
36
|
--oc-motion-timing-reject: #{oc-spring-timing(0.32s, smooth, $samples: 64)};
|
|
35
37
|
--oc-motion-timing-disclosure: ease;
|
|
36
38
|
--oc-motion-timing-disclosure-exit: cubic-bezier(0.8, 0, 1, 1);
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// CSS-token tables keep non-spring transitions and reduced-motion output themeable.
|
|
8
8
|
$oc-motion-token-duration-by-intent: (
|
|
9
9
|
feedback: var(--oc-motion-duration-feedback),
|
|
10
|
+
fade: var(--oc-motion-duration-fade),
|
|
10
11
|
reject: var(--oc-motion-duration-reject),
|
|
11
12
|
disclosure: var(--oc-motion-duration-disclosure),
|
|
12
13
|
surface: var(--oc-motion-duration-surface),
|
|
@@ -19,6 +20,7 @@ $oc-motion-token-duration-by-intent: (
|
|
|
19
20
|
|
|
20
21
|
$oc-motion-token-timing-by-intent: (
|
|
21
22
|
feedback: var(--oc-motion-timing-feedback),
|
|
23
|
+
fade: var(--oc-motion-timing-fade),
|
|
22
24
|
reject: var(--oc-motion-timing-reject),
|
|
23
25
|
disclosure: var(--oc-motion-timing-disclosure),
|
|
24
26
|
surface: var(--oc-motion-timing-surface),
|
|
@@ -73,8 +75,11 @@ $oc-motion-token-pace-factor: (
|
|
|
73
75
|
slow: var(--oc-motion-pace-slow),
|
|
74
76
|
) !default;
|
|
75
77
|
|
|
78
|
+
// Amplitude maps accept every intent for vocabulary completeness; fade remains
|
|
79
|
+
// an opacity-first contract even though custom transforms can share spatial factors.
|
|
76
80
|
$oc-motion-token-scale-by-intent: (
|
|
77
81
|
feedback: var(--oc-motion-scale-factor-feedback),
|
|
82
|
+
fade: var(--oc-motion-scale-factor-spatial),
|
|
78
83
|
reject: var(--oc-motion-scale-factor-feedback),
|
|
79
84
|
disclosure: var(--oc-motion-scale-factor-spatial),
|
|
80
85
|
surface: var(--oc-motion-scale-factor-spatial),
|
|
@@ -87,6 +92,7 @@ $oc-motion-token-scale-by-intent: (
|
|
|
87
92
|
|
|
88
93
|
$oc-motion-token-distance-by-intent: (
|
|
89
94
|
feedback: var(--oc-motion-distance-factor-reject),
|
|
95
|
+
fade: var(--oc-motion-distance-factor-spatial),
|
|
90
96
|
reject: var(--oc-motion-distance-factor-reject),
|
|
91
97
|
disclosure: var(--oc-motion-distance-factor-spatial),
|
|
92
98
|
surface: var(--oc-motion-distance-factor-spatial),
|
|
@@ -100,6 +106,7 @@ $oc-motion-token-distance-by-intent: (
|
|
|
100
106
|
// Spring profiles need compile-time Sass values because oc-spring() samples timing curves.
|
|
101
107
|
$oc-motion-spring-duration-by-intent: (
|
|
102
108
|
feedback: 0.2s,
|
|
109
|
+
fade: 0.2s,
|
|
103
110
|
reject: 0.32s,
|
|
104
111
|
disclosure: 0.2s,
|
|
105
112
|
surface: 0.26s,
|
|
@@ -203,6 +210,7 @@ $oc-motion-spring-by-intent: (
|
|
|
203
210
|
|
|
204
211
|
$oc-motion-reduced-policy-by-intent: (
|
|
205
212
|
feedback: feedback,
|
|
213
|
+
fade: fade,
|
|
206
214
|
reject: feedback,
|
|
207
215
|
disclosure: fade,
|
|
208
216
|
surface: fade,
|
|
@@ -44,6 +44,27 @@ describe('motion utilities', () => {
|
|
|
44
44
|
);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
it('emits token-backed fade motion for simple opacity transitions', () => {
|
|
48
|
+
const result = compileMotion(`
|
|
49
|
+
.target {
|
|
50
|
+
@include oc-motion(opacity, fade);
|
|
51
|
+
}
|
|
52
|
+
`);
|
|
53
|
+
|
|
54
|
+
expect(result.css).toContain(
|
|
55
|
+
'transition: opacity calc(var(--oc-motion-duration-fade) * var(--oc-motion-duration-factor) * var(--oc-motion-pace-normal) * 1) var(--oc-motion-timing-fade);',
|
|
56
|
+
);
|
|
57
|
+
expect(result.css).toContain('@media (prefers-reduced-motion: reduce)');
|
|
58
|
+
expect(result.css).toContain('transition-property: opacity;');
|
|
59
|
+
expect(result.css).toContain(
|
|
60
|
+
'transition-duration: calc(var(--oc-motion-duration-fade) * var(--oc-motion-duration-factor-reduced) * var(--oc-motion-pace-normal) * 1);',
|
|
61
|
+
);
|
|
62
|
+
expect(result.css).toContain(
|
|
63
|
+
'transition-timing-function: var(--oc-motion-timing-fade);',
|
|
64
|
+
);
|
|
65
|
+
expect(result.css).not.toContain('linear(');
|
|
66
|
+
});
|
|
67
|
+
|
|
47
68
|
it('scales transform amplitude through motion scale factor tokens', () => {
|
|
48
69
|
const result = compileMotion(`
|
|
49
70
|
.feedback {
|