@pieai/swimmer-ui-kit 2.11.0 → 2.12.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 +14 -0
- package/dist/index.d.ts +25 -1
- package/dist/index.js +1205 -1094
- package/dist/liquid-presence.js +90 -90
- package/dist/{reducedMotion-C7O9ls34.js → liquidGooeySpring-WwyGKGPL.js} +83 -83
- package/package.json +1 -1
|
@@ -1,48 +1,64 @@
|
|
|
1
1
|
import { useEffect as e, useState as t } from "react";
|
|
2
2
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
|
+
//#region src/reducedMotion.ts
|
|
4
|
+
function a() {
|
|
5
|
+
return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
6
|
+
}
|
|
7
|
+
function o(e, t) {
|
|
8
|
+
let n = e;
|
|
9
|
+
return typeof e.addEventListener == "function" ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : typeof n.addListener == "function" ? (n.addListener(t), () => n.removeListener?.(t)) : () => {};
|
|
10
|
+
}
|
|
11
|
+
function s() {
|
|
12
|
+
let [n, r] = t(() => a()?.matches ?? !1);
|
|
13
|
+
return e(() => {
|
|
14
|
+
let e = a();
|
|
15
|
+
if (e) return r(e.matches), o(e, (e) => r(e.matches));
|
|
16
|
+
}, []), n;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
3
19
|
//#region src/liquidGooeyBudget.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
20
|
+
var c = 2, l = 48e4, u = 2, d = l, f = 0;
|
|
21
|
+
function p(e, t) {
|
|
6
22
|
return Number.isFinite(e) ? Math.max(0, Math.floor(e)) : t;
|
|
7
23
|
}
|
|
8
|
-
function
|
|
24
|
+
function m() {
|
|
9
25
|
return {
|
|
10
|
-
maxAnimatedGroups:
|
|
11
|
-
maxFilterArea:
|
|
12
|
-
activeGroups:
|
|
26
|
+
maxAnimatedGroups: u,
|
|
27
|
+
maxFilterArea: d,
|
|
28
|
+
activeGroups: f
|
|
13
29
|
};
|
|
14
30
|
}
|
|
15
|
-
function
|
|
31
|
+
function h(e) {
|
|
16
32
|
if (typeof e == "number") {
|
|
17
|
-
|
|
33
|
+
u = p(e, 0);
|
|
18
34
|
return;
|
|
19
35
|
}
|
|
20
|
-
e.maxAnimatedGroups !== void 0 && (
|
|
36
|
+
e.maxAnimatedGroups !== void 0 && (u = p(e.maxAnimatedGroups, 0)), e.maxFilterArea !== void 0 && (d = p(e.maxFilterArea, 0));
|
|
21
37
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
38
|
+
function g(e) {
|
|
39
|
+
return f >= u || (Number.isFinite(e) ? Math.max(0, e) : Infinity) > d ? !1 : (f += 1, !0);
|
|
24
40
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
41
|
+
function _() {
|
|
42
|
+
f > 0 && --f;
|
|
27
43
|
}
|
|
28
44
|
//#endregion
|
|
29
45
|
//#region src/liquidGooeyFilter.tsx
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
return e <= 0 ? t : Math.min(t,
|
|
46
|
+
var v = "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 60 -29.5", y = 1.3, b = 1 / .3902;
|
|
47
|
+
function x(e, t) {
|
|
48
|
+
return e <= 0 ? t : Math.min(t, b * e / y);
|
|
33
49
|
}
|
|
34
|
-
var
|
|
50
|
+
var S = {
|
|
35
51
|
waviness: 0,
|
|
36
52
|
wavinessFreq: .018
|
|
37
53
|
};
|
|
38
|
-
function
|
|
54
|
+
function C(e) {
|
|
39
55
|
return e.spread === 0 ? "shape" : "bin";
|
|
40
56
|
}
|
|
41
|
-
function
|
|
57
|
+
function w(e, t) {
|
|
42
58
|
return t !== null || e.some((e) => e.spread !== 0);
|
|
43
59
|
}
|
|
44
|
-
function
|
|
45
|
-
let i = [], a =
|
|
60
|
+
function T({ index: e, shadow: t }) {
|
|
61
|
+
let i = [], a = C(t), o = a;
|
|
46
62
|
return t.spread !== 0 && (i.push(/* @__PURE__ */ r("feMorphology", {
|
|
47
63
|
in: o,
|
|
48
64
|
operator: t.spread > 0 ? "erode" : "dilate",
|
|
@@ -72,7 +88,7 @@ function S({ index: e, shadow: t }) {
|
|
|
72
88
|
result: `shadow-${e}`
|
|
73
89
|
}, "fill")), /* @__PURE__ */ r(n, { children: i });
|
|
74
90
|
}
|
|
75
|
-
function
|
|
91
|
+
function E({ index: e, shadow: t }) {
|
|
76
92
|
let i = [], a = "shape";
|
|
77
93
|
return t.spread !== 0 && (i.push(/* @__PURE__ */ r("feMorphology", {
|
|
78
94
|
in: "bin",
|
|
@@ -98,7 +114,7 @@ function C({ index: e, shadow: t }) {
|
|
|
98
114
|
result: `shadow-${e}`
|
|
99
115
|
}, "fill")), /* @__PURE__ */ r(n, { children: i });
|
|
100
116
|
}
|
|
101
|
-
function
|
|
117
|
+
function D({ stroke: e }) {
|
|
102
118
|
let t = [];
|
|
103
119
|
return t.push(/* @__PURE__ */ r("feMorphology", {
|
|
104
120
|
in: "bin",
|
|
@@ -120,8 +136,8 @@ function w({ stroke: e }) {
|
|
|
120
136
|
result: "stroke-out"
|
|
121
137
|
}, "fill")), /* @__PURE__ */ r(n, { children: t });
|
|
122
138
|
}
|
|
123
|
-
function
|
|
124
|
-
let u =
|
|
139
|
+
function O({ blur: e, contrast: t, shadows: a, stroke: o, gloss: s = 0, waviness: c = S.waviness, wavinessFreq: l = S.wavinessFreq }) {
|
|
140
|
+
let u = x(e, t), d = Math.round((.5 - 5 / 12 * u) * 100) / 100, f = c > 0;
|
|
125
141
|
return /* @__PURE__ */ i(n, { children: [
|
|
126
142
|
/* @__PURE__ */ r("feGaussianBlur", {
|
|
127
143
|
in: "SourceGraphic",
|
|
@@ -189,20 +205,20 @@ function T({ blur: e, contrast: t, shadows: a, stroke: o, gloss: s = 0, waviness
|
|
|
189
205
|
result: "shape"
|
|
190
206
|
})
|
|
191
207
|
] }) : null,
|
|
192
|
-
|
|
208
|
+
w(a, o) ? /* @__PURE__ */ r("feColorMatrix", {
|
|
193
209
|
in: "shape",
|
|
194
210
|
type: "matrix",
|
|
195
|
-
values:
|
|
211
|
+
values: v,
|
|
196
212
|
result: "bin"
|
|
197
213
|
}) : null,
|
|
198
|
-
a.map((e, t) => e.inset ? /* @__PURE__ */ r(
|
|
214
|
+
a.map((e, t) => e.inset ? /* @__PURE__ */ r(T, {
|
|
199
215
|
index: t,
|
|
200
216
|
shadow: e
|
|
201
|
-
}, t) : /* @__PURE__ */ r(
|
|
217
|
+
}, t) : /* @__PURE__ */ r(E, {
|
|
202
218
|
index: t,
|
|
203
219
|
shadow: e
|
|
204
220
|
}, t)),
|
|
205
|
-
o ? /* @__PURE__ */ r(
|
|
221
|
+
o ? /* @__PURE__ */ r(D, { stroke: o }) : null,
|
|
206
222
|
a.length > 0 || o ? /* @__PURE__ */ i("feMerge", { children: [
|
|
207
223
|
a.map((e, t) => e.inset ? -1 : t).filter((e) => e >= 0).reverse().map((e) => /* @__PURE__ */ r("feMergeNode", { in: `shadow-${e}` }, e)),
|
|
208
224
|
/* @__PURE__ */ r("feMergeNode", { in: "shape" }),
|
|
@@ -213,7 +229,7 @@ function T({ blur: e, contrast: t, shadows: a, stroke: o, gloss: s = 0, waviness
|
|
|
213
229
|
}
|
|
214
230
|
//#endregion
|
|
215
231
|
//#region src/liquidGooeyGeometry.ts
|
|
216
|
-
function
|
|
232
|
+
function k(e, t) {
|
|
217
233
|
let n = 0, r = 0, i = e;
|
|
218
234
|
for (; i && i !== t && t.contains(i);) n += i.offsetLeft, r += i.offsetTop, i = i.offsetParent;
|
|
219
235
|
return {
|
|
@@ -221,7 +237,7 @@ function E(e, t) {
|
|
|
221
237
|
y: r
|
|
222
238
|
};
|
|
223
239
|
}
|
|
224
|
-
function
|
|
240
|
+
function A(e, t, n) {
|
|
225
241
|
let r = getComputedStyle(e), i = (e) => {
|
|
226
242
|
let r = e.split(" ")[0] ?? "";
|
|
227
243
|
return r.endsWith("%") ? (parseFloat(r) || 0) / 100 * Math.min(t, n) : parseFloat(r) || 0;
|
|
@@ -233,7 +249,7 @@ function D(e, t, n) {
|
|
|
233
249
|
i(r.borderBottomLeftRadius)
|
|
234
250
|
];
|
|
235
251
|
}
|
|
236
|
-
function
|
|
252
|
+
function j(e) {
|
|
237
253
|
return typeof e == "number" ? [
|
|
238
254
|
e,
|
|
239
255
|
e,
|
|
@@ -241,16 +257,16 @@ function O(e) {
|
|
|
241
257
|
e
|
|
242
258
|
] : e;
|
|
243
259
|
}
|
|
244
|
-
function
|
|
260
|
+
function M(e, t, n, r, i) {
|
|
245
261
|
let [a, o, s, c] = i.map((e) => Math.max(0, e)), l = Math.min(1, n / Math.max(1e-6, a + o), n / Math.max(1e-6, c + s), r / Math.max(1e-6, a + c), r / Math.max(1e-6, o + s));
|
|
246
262
|
return a *= l, o *= l, s *= l, c *= l, `M ${e + a} ${t} H ${e + n - o} A ${o} ${o} 0 0 1 ${e + n} ${t + o} V ${t + r - s} A ${s} ${s} 0 0 1 ${e + n - s} ${t + r} H ${e + c} A ${c} ${c} 0 0 1 ${e} ${t + r - c} V ${t + a} A ${a} ${a} 0 0 1 ${e + a} ${t} Z`;
|
|
247
263
|
}
|
|
248
|
-
var
|
|
249
|
-
function
|
|
264
|
+
var N = 44;
|
|
265
|
+
function P(e) {
|
|
250
266
|
let t = e + 1831565813 >>> 0;
|
|
251
267
|
return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
252
268
|
}
|
|
253
|
-
function
|
|
269
|
+
function F(e, t, n, r) {
|
|
254
270
|
let i = Math.max(0, e - 2 * n), a = Math.max(0, t - 2 * n), o = Math.PI / 2 * n, s = [
|
|
255
271
|
i,
|
|
256
272
|
o,
|
|
@@ -302,19 +318,19 @@ function M(e, t, n, r) {
|
|
|
302
318
|
default: return f(Math.PI, n, n);
|
|
303
319
|
}
|
|
304
320
|
}
|
|
305
|
-
var
|
|
306
|
-
function
|
|
307
|
-
let o = Math.min(n, r), s = Math.min(Math.max(0, a.amplitude), o *
|
|
308
|
-
if (s < .15 || o <= 0) return
|
|
321
|
+
var I = .18;
|
|
322
|
+
function L(e, t, n, r, i, a) {
|
|
323
|
+
let o = Math.min(n, r), s = Math.min(Math.max(0, a.amplitude), o * I);
|
|
324
|
+
if (s < .15 || o <= 0) return M(e, t, n, r, i);
|
|
309
325
|
let c = Math.min(Math.max(...i, 0), o / 2), l = a.seed ?? 7, u = Math.max(2, Math.round(a.lobes ?? 3)), d = a.phase ?? 0, f = [];
|
|
310
326
|
for (let e = 0; e < u; e += 1) f.push({
|
|
311
327
|
k: e + 2,
|
|
312
|
-
a:
|
|
313
|
-
p:
|
|
328
|
+
a: P(l * 31 + e) * .6 + .4,
|
|
329
|
+
p: P(l * 57 + e) * Math.PI * 2
|
|
314
330
|
});
|
|
315
331
|
let p = f.reduce((e, t) => e + t.a, 0) || 1, m = [];
|
|
316
|
-
for (let i = 0; i <
|
|
317
|
-
let a = i /
|
|
332
|
+
for (let i = 0; i < N; i += 1) {
|
|
333
|
+
let a = i / N, o = F(n, r, c, a), l = 0;
|
|
318
334
|
for (let { k: e, a: t, p: n } of f) l += t * Math.sin(2 * Math.PI * e * a + n + d);
|
|
319
335
|
let u = (l / p + 1) / 2 * s;
|
|
320
336
|
m.push([e + o.x + o.nx * u, t + o.y + o.ny * u]);
|
|
@@ -326,12 +342,12 @@ function P(e, t, n, r, i, a) {
|
|
|
326
342
|
}
|
|
327
343
|
return `${v} Z`;
|
|
328
344
|
}
|
|
329
|
-
function
|
|
330
|
-
return !a || a.amplitude <= 0 ?
|
|
345
|
+
function R(e, t, n, r, i, a) {
|
|
346
|
+
return !a || a.amplitude <= 0 ? M(e, t, n, r, i) : L(e, t, n, r, i, a);
|
|
331
347
|
}
|
|
332
348
|
//#endregion
|
|
333
349
|
//#region src/liquidGooeySpring.ts
|
|
334
|
-
var
|
|
350
|
+
var z = {
|
|
335
351
|
snappy: {
|
|
336
352
|
stiffness: 480,
|
|
337
353
|
damping: 34,
|
|
@@ -352,16 +368,16 @@ var I = {
|
|
|
352
368
|
damping: 9.6,
|
|
353
369
|
mass: 1
|
|
354
370
|
}
|
|
355
|
-
},
|
|
356
|
-
function
|
|
371
|
+
}, B = 1 / 240;
|
|
372
|
+
function V(e) {
|
|
357
373
|
let t = 0, n = 0, r = 0, i = -1, a = 0, o = [0];
|
|
358
374
|
for (; r < 10;) {
|
|
359
375
|
let s = (-e.stiffness * (t - 1) - e.damping * n) / e.mass;
|
|
360
|
-
if (n += s *
|
|
376
|
+
if (n += s * B, t += n * B, r += B, o.push(t), t > a && (a = t), Math.abs(t - 1) < .001 && Math.abs(n) < .02) {
|
|
361
377
|
if (i < 0 && (i = r), r - i >= .064) break;
|
|
362
378
|
} else i = -1;
|
|
363
379
|
}
|
|
364
|
-
let s = i > 0 ? i : r, c = Math.round(Math.min(120, Math.max(24, s * 90))), l = Math.min(o.length - 1, s /
|
|
380
|
+
let s = i > 0 ? i : r, c = Math.round(Math.min(120, Math.max(24, s * 90))), l = Math.min(o.length - 1, s / B), u = [];
|
|
365
381
|
for (let e = 0; e <= c; e += 1) {
|
|
366
382
|
let t = Math.min(o.length - 1, Math.round(e / c * l));
|
|
367
383
|
u.push(Math.round((o[t] ?? 1) * 1e4) / 1e4);
|
|
@@ -372,13 +388,13 @@ function R(e) {
|
|
|
372
388
|
overshoots: a > 1.001
|
|
373
389
|
};
|
|
374
390
|
}
|
|
375
|
-
var
|
|
376
|
-
function
|
|
377
|
-
return
|
|
391
|
+
var H = null;
|
|
392
|
+
function U() {
|
|
393
|
+
return H === null && (H = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("transition-timing-function", "linear(0, 1)")), H;
|
|
378
394
|
}
|
|
379
|
-
var
|
|
380
|
-
function
|
|
381
|
-
let t =
|
|
395
|
+
var W = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map();
|
|
396
|
+
function K(e) {
|
|
397
|
+
let t = G.get(e);
|
|
382
398
|
if (t) return t;
|
|
383
399
|
let n = /^linear\(([^)]+)\)$/.exec(e.trim()), r = /^cubic-bezier\(([^)]+)\)$/.exec(e.trim()), i;
|
|
384
400
|
if (n) {
|
|
@@ -402,10 +418,10 @@ function U(e) {
|
|
|
402
418
|
let s = (i + o) / 2;
|
|
403
419
|
return 3 * s * (1 - s) * (1 - s) * t + 3 * s * s * (1 - s) * a + s ** 3;
|
|
404
420
|
};
|
|
405
|
-
} else i = e === "ease" ?
|
|
406
|
-
return
|
|
421
|
+
} else i = e === "ease" ? K("cubic-bezier(0.25, 0.1, 0.25, 1)") : e === "ease-in" ? K("cubic-bezier(0.42, 0, 1, 1)") : e === "ease-out" ? K("cubic-bezier(0, 0, 0.58, 1)") : e === "ease-in-out" ? K("cubic-bezier(0.42, 0, 0.58, 1)") : (e) => Math.min(1, Math.max(0, e));
|
|
422
|
+
return G.set(e, i), i;
|
|
407
423
|
}
|
|
408
|
-
function
|
|
424
|
+
function q(e, t = !1) {
|
|
409
425
|
if (t) return {
|
|
410
426
|
duration: 0,
|
|
411
427
|
easing: "linear"
|
|
@@ -415,36 +431,20 @@ function W(e, t = !1) {
|
|
|
415
431
|
duration: Math.max(0, n.duration),
|
|
416
432
|
easing: n.ease ?? "cubic-bezier(0.22, 1, 0.36, 1)"
|
|
417
433
|
};
|
|
418
|
-
let r = typeof n == "string" ?
|
|
434
|
+
let r = typeof n == "string" ? z[n] : {
|
|
419
435
|
stiffness: 300,
|
|
420
436
|
damping: 24,
|
|
421
437
|
mass: 1,
|
|
422
438
|
...n
|
|
423
|
-
}, i = `${r.stiffness}/${r.damping}/${r.mass}/${
|
|
439
|
+
}, i = `${r.stiffness}/${r.damping}/${r.mass}/${U()}`, a = W.get(i);
|
|
424
440
|
if (!a) {
|
|
425
|
-
let e =
|
|
441
|
+
let e = V(r);
|
|
426
442
|
a = {
|
|
427
443
|
duration: Math.round(e.duration * 1e3),
|
|
428
|
-
easing:
|
|
429
|
-
},
|
|
444
|
+
easing: U() ? `linear(${e.values.join(", ")})` : e.overshoots ? "cubic-bezier(0.34, 1.56, 0.64, 1)" : "cubic-bezier(0.22, 1, 0.36, 1)"
|
|
445
|
+
}, W.set(i, a);
|
|
430
446
|
}
|
|
431
447
|
return a;
|
|
432
448
|
}
|
|
433
449
|
//#endregion
|
|
434
|
-
|
|
435
|
-
function G() {
|
|
436
|
-
return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
437
|
-
}
|
|
438
|
-
function K(e, t) {
|
|
439
|
-
let n = e;
|
|
440
|
-
return typeof e.addEventListener == "function" ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : typeof n.addListener == "function" ? (n.addListener(t), () => n.removeListener?.(t)) : () => {};
|
|
441
|
-
}
|
|
442
|
-
function q() {
|
|
443
|
-
let [n, r] = t(() => G()?.matches ?? !1);
|
|
444
|
-
return e(() => {
|
|
445
|
-
let e = G();
|
|
446
|
-
if (e) return r(e.matches), K(e, (e) => r(e.matches));
|
|
447
|
-
}, []), n;
|
|
448
|
-
}
|
|
449
|
-
//#endregion
|
|
450
|
-
export { p as _, D as a, k as c, T as d, a as f, f as g, m as h, P as i, F as l, d as m, U as n, O as o, o as p, W as r, E as s, q as t, y as u };
|
|
450
|
+
export { s as _, j as a, R as c, c as d, l as f, g, h, A as i, S as l, _ as m, q as n, k as o, m as p, L as r, M as s, K as t, O as u };
|