@pieai/swimmer-ui-kit 3.0.0 → 3.1.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.
@@ -1,473 +0,0 @@
1
- "use client";
2
- import { useEffect as e, useState as t } from "react";
3
- import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
- var a = 48e4, o = 2, s = a, c = 0;
5
- function l(e, t) {
6
- return Number.isFinite(e) ? Math.max(0, Math.floor(e)) : t;
7
- }
8
- function u() {
9
- return {
10
- maxAnimatedGroups: o,
11
- maxFilterArea: s,
12
- activeGroups: c
13
- };
14
- }
15
- function d(e) {
16
- if (typeof e == "number") {
17
- o = l(e, 0);
18
- return;
19
- }
20
- e.maxAnimatedGroups !== void 0 && (o = l(e.maxAnimatedGroups, 0)), e.maxFilterArea !== void 0 && (s = l(e.maxFilterArea, 0));
21
- }
22
- function f(e) {
23
- return c >= o || (Number.isFinite(e) ? Math.max(0, e) : Infinity) > s ? !1 : (c += 1, !0);
24
- }
25
- function p() {
26
- c > 0 && --c;
27
- }
28
- //#endregion
29
- //#region src/liquid/material/weight.ts
30
- var m = {
31
- blur: 5,
32
- contrast: 18,
33
- gloss: 1.5,
34
- blob: 3.5,
35
- lobes: 3,
36
- filterPadding: 20,
37
- shadow: "var(--game-ui-liquid-material-shadow)"
38
- }, h = {
39
- top: "var(--game-ui-cta-from)",
40
- bottom: "var(--game-ui-cta-to)",
41
- sheen: .3
42
- }, g = "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 60 -29.5", _ = 1.3, v = 1 / .3902;
43
- function y(e, t) {
44
- return e <= 0 ? t : Math.min(t, v * e / _);
45
- }
46
- var b = {
47
- waviness: 0,
48
- wavinessFreq: .018
49
- };
50
- function x(e) {
51
- return e.spread === 0 ? "shape" : "bin";
52
- }
53
- function S(e, t) {
54
- return t !== null || e.some((e) => e.spread !== 0);
55
- }
56
- function C({ index: e, shadow: t }) {
57
- let i = [], a = x(t), o = a;
58
- return t.spread !== 0 && (i.push(/* @__PURE__ */ r("feMorphology", {
59
- in: o,
60
- operator: t.spread > 0 ? "erode" : "dilate",
61
- radius: Math.abs(t.spread),
62
- result: `shadow-${e}-erode`
63
- }, "erode")), o = `shadow-${e}-erode`), (t.x !== 0 || t.y !== 0) && (i.push(/* @__PURE__ */ r("feOffset", {
64
- in: o,
65
- dx: t.x,
66
- dy: t.y,
67
- result: `shadow-${e}-offset`
68
- }, "offset")), o = `shadow-${e}-offset`), t.blur > 0 && (i.push(/* @__PURE__ */ r("feGaussianBlur", {
69
- in: o,
70
- stdDeviation: t.blur / 2,
71
- result: `shadow-${e}-blur`
72
- }, "blur")), o = `shadow-${e}-blur`), i.push(/* @__PURE__ */ r("feComposite", {
73
- in: a,
74
- in2: o,
75
- operator: "out",
76
- result: `shadow-${e}-band`
77
- }, "band"), /* @__PURE__ */ r("feFlood", {
78
- floodColor: t.color,
79
- result: `shadow-${e}-color`
80
- }, "color"), /* @__PURE__ */ r("feComposite", {
81
- in: `shadow-${e}-color`,
82
- in2: `shadow-${e}-band`,
83
- operator: "in",
84
- result: `shadow-${e}`
85
- }, "fill")), /* @__PURE__ */ r(n, { children: i });
86
- }
87
- function w({ index: e, shadow: t }) {
88
- let i = [], a = "shape";
89
- return t.spread !== 0 && (i.push(/* @__PURE__ */ r("feMorphology", {
90
- in: "bin",
91
- operator: t.spread > 0 ? "dilate" : "erode",
92
- radius: Math.abs(t.spread),
93
- result: `shadow-${e}-spread`
94
- }, "spread")), a = `shadow-${e}-spread`), t.blur > 0 && (i.push(/* @__PURE__ */ r("feGaussianBlur", {
95
- in: a,
96
- stdDeviation: t.blur / 2,
97
- result: `shadow-${e}-blur`
98
- }, "blur")), a = `shadow-${e}-blur`), (t.x !== 0 || t.y !== 0) && (i.push(/* @__PURE__ */ r("feOffset", {
99
- in: a,
100
- dx: t.x,
101
- dy: t.y,
102
- result: `shadow-${e}-offset`
103
- }, "offset")), a = `shadow-${e}-offset`), i.push(/* @__PURE__ */ r("feFlood", {
104
- floodColor: t.color,
105
- result: `shadow-${e}-color`
106
- }, "color"), /* @__PURE__ */ r("feComposite", {
107
- in: `shadow-${e}-color`,
108
- in2: a,
109
- operator: "in",
110
- result: `shadow-${e}`
111
- }, "fill")), /* @__PURE__ */ r(n, { children: i });
112
- }
113
- function T({ stroke: e }) {
114
- let t = [];
115
- return t.push(/* @__PURE__ */ r("feMorphology", {
116
- in: "bin",
117
- operator: "erode",
118
- radius: e.width,
119
- result: "stroke-erode"
120
- }, "erode"), /* @__PURE__ */ r("feComposite", {
121
- in: "bin",
122
- in2: "stroke-erode",
123
- operator: "out",
124
- result: "stroke-band"
125
- }, "band"), /* @__PURE__ */ r("feFlood", {
126
- floodColor: e.color,
127
- result: "stroke-color"
128
- }, "color"), /* @__PURE__ */ r("feComposite", {
129
- in: "stroke-color",
130
- in2: "stroke-band",
131
- operator: "in",
132
- result: "stroke-out"
133
- }, "fill")), /* @__PURE__ */ r(n, { children: t });
134
- }
135
- function E({ blur: e, contrast: t, shadows: a, stroke: o, gloss: s = 0, waviness: c = b.waviness, wavinessFreq: l = b.wavinessFreq }) {
136
- let u = y(e, t), d = Math.round((.5 - 5 / 12 * u) * 100) / 100, f = c > 0;
137
- return /* @__PURE__ */ i(n, { children: [
138
- /* @__PURE__ */ r("feGaussianBlur", {
139
- in: "SourceGraphic",
140
- stdDeviation: e,
141
- result: "blur"
142
- }),
143
- /* @__PURE__ */ r("feColorMatrix", {
144
- in: "blur",
145
- type: "matrix",
146
- values: `1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${u} ${d}`,
147
- result: "goo"
148
- }),
149
- /* @__PURE__ */ r("feComposite", {
150
- in: "SourceGraphic",
151
- in2: "goo",
152
- operator: "atop",
153
- result: f ? "shape-raw" : "shape"
154
- }),
155
- f ? /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("feTurbulence", {
156
- type: "fractalNoise",
157
- baseFrequency: l,
158
- numOctaves: 1,
159
- seed: "7",
160
- result: "wave-noise"
161
- }), /* @__PURE__ */ r("feDisplacementMap", {
162
- in: "shape-raw",
163
- in2: "wave-noise",
164
- scale: c * 2,
165
- xChannelSelector: "R",
166
- yChannelSelector: "G",
167
- result: "shape"
168
- })] }) : null,
169
- s > 0 ? /* @__PURE__ */ i(n, { children: [
170
- /* @__PURE__ */ r("feGaussianBlur", {
171
- in: "shape",
172
- stdDeviation: 2.5,
173
- result: "gloss-bump"
174
- }),
175
- /* @__PURE__ */ r("feSpecularLighting", {
176
- in: "gloss-bump",
177
- surfaceScale: s,
178
- specularConstant: .78,
179
- specularExponent: 20,
180
- lightingColor: "#ffffff",
181
- result: "gloss-light",
182
- children: /* @__PURE__ */ r("feDistantLight", {
183
- azimuth: 235,
184
- elevation: 22
185
- })
186
- }),
187
- /* @__PURE__ */ r("feMorphology", {
188
- in: "shape",
189
- operator: "erode",
190
- radius: 1.2,
191
- result: "gloss-inset"
192
- }),
193
- /* @__PURE__ */ r("feGaussianBlur", {
194
- in: "gloss-inset",
195
- stdDeviation: .8,
196
- result: "gloss-mask"
197
- }),
198
- /* @__PURE__ */ r("feComposite", {
199
- in: "gloss-light",
200
- in2: "gloss-mask",
201
- operator: "in",
202
- result: "gloss-clip"
203
- }),
204
- /* @__PURE__ */ r("feComposite", {
205
- in: "shape",
206
- in2: "gloss-clip",
207
- operator: "arithmetic",
208
- k1: "0",
209
- k2: "1",
210
- k3: "1",
211
- k4: "0",
212
- result: "shape"
213
- })
214
- ] }) : null,
215
- S(a, o) ? /* @__PURE__ */ r("feColorMatrix", {
216
- in: "shape",
217
- type: "matrix",
218
- values: g,
219
- result: "bin"
220
- }) : null,
221
- a.map((e, t) => e.inset ? /* @__PURE__ */ r(C, {
222
- index: t,
223
- shadow: e
224
- }, t) : /* @__PURE__ */ r(w, {
225
- index: t,
226
- shadow: e
227
- }, t)),
228
- o ? /* @__PURE__ */ r(T, { stroke: o }) : null,
229
- a.length > 0 || o ? /* @__PURE__ */ i("feMerge", { children: [
230
- a.map((e, t) => e.inset ? -1 : t).filter((e) => e >= 0).reverse().map((e) => /* @__PURE__ */ r("feMergeNode", { in: `shadow-${e}` }, e)),
231
- /* @__PURE__ */ r("feMergeNode", { in: "shape" }),
232
- o ? /* @__PURE__ */ r("feMergeNode", { in: "stroke-out" }) : null,
233
- a.map((e, t) => e.inset ? /* @__PURE__ */ r("feMergeNode", { in: `shadow-${t}` }, t) : null)
234
- ] }) : null
235
- ] });
236
- }
237
- //#endregion
238
- //#region src/liquid/geometry.ts
239
- function D(e, t) {
240
- let n = 0, r = 0, i = e;
241
- for (; i && i !== t && t.contains(i);) n += i.offsetLeft, r += i.offsetTop, i = i.offsetParent;
242
- return {
243
- x: n,
244
- y: r
245
- };
246
- }
247
- function O(e, t, n) {
248
- let r = getComputedStyle(e), i = (e) => {
249
- let r = e.split(" ")[0] ?? "";
250
- return r.endsWith("%") ? (parseFloat(r) || 0) / 100 * Math.min(t, n) : parseFloat(r) || 0;
251
- };
252
- return [
253
- i(r.borderTopLeftRadius),
254
- i(r.borderTopRightRadius),
255
- i(r.borderBottomRightRadius),
256
- i(r.borderBottomLeftRadius)
257
- ];
258
- }
259
- function k(e) {
260
- return typeof e == "number" ? [
261
- e,
262
- e,
263
- e,
264
- e
265
- ] : e;
266
- }
267
- function A(e, t, n, r, i) {
268
- 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));
269
- 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`;
270
- }
271
- var j = 44;
272
- function M(e) {
273
- let t = e + 1831565813 >>> 0;
274
- return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
275
- }
276
- function N(e, t, n, r) {
277
- let i = Math.max(0, e - 2 * n), a = Math.max(0, t - 2 * n), o = Math.PI / 2 * n, s = [
278
- i,
279
- o,
280
- a,
281
- o,
282
- i,
283
- o,
284
- a,
285
- o
286
- ], c = r * (s.reduce((e, t) => e + t, 0) || 1), l = 0;
287
- for (; l < s.length - 1 && c > s[l];) c -= s[l], l += 1;
288
- let u = s[l], d = u === 0 ? 0 : c / u, f = (e, t, r) => {
289
- let i = e + Math.PI / 2 * d;
290
- return {
291
- x: t + n * Math.cos(i),
292
- y: r + n * Math.sin(i),
293
- nx: Math.cos(i),
294
- ny: Math.sin(i)
295
- };
296
- };
297
- switch (l) {
298
- case 0: return {
299
- x: n + d * i,
300
- y: 0,
301
- nx: 0,
302
- ny: -1
303
- };
304
- case 1: return f(-Math.PI / 2, e - n, n);
305
- case 2: return {
306
- x: e,
307
- y: n + d * a,
308
- nx: 1,
309
- ny: 0
310
- };
311
- case 3: return f(0, e - n, t - n);
312
- case 4: return {
313
- x: e - n - d * i,
314
- y: t,
315
- nx: 0,
316
- ny: 1
317
- };
318
- case 5: return f(Math.PI / 2, n, t - n);
319
- case 6: return {
320
- x: 0,
321
- y: t - n - d * a,
322
- nx: -1,
323
- ny: 0
324
- };
325
- default: return f(Math.PI, n, n);
326
- }
327
- }
328
- var P = .18;
329
- function F(e, t, n, r, i, a) {
330
- let o = Math.min(n, r), s = Math.min(Math.max(0, a.amplitude), o * P);
331
- if (s < .15 || o <= 0) return A(e, t, n, r, i);
332
- 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 = [];
333
- for (let e = 0; e < u; e += 1) f.push({
334
- k: e + 2,
335
- a: M(l * 31 + e) * .6 + .4,
336
- p: M(l * 57 + e) * Math.PI * 2
337
- });
338
- let p = f.reduce((e, t) => e + t.a, 0) || 1, m = [];
339
- for (let i = 0; i < j; i += 1) {
340
- let a = i / j, o = N(n, r, c, a), l = 0;
341
- for (let { k: e, a: t, p: n } of f) l += t * Math.sin(2 * Math.PI * e * a + n + d);
342
- let u = (l / p + 1) / 2 * s;
343
- m.push([e + o.x + o.nx * u, t + o.y + o.ny * u]);
344
- }
345
- let h = m.length, g = (e) => m[(e % h + h) % h], _ = (e) => (Math.round(e * 100) / 100).toString(), v = `M ${_(g(0)[0])} ${_(g(0)[1])}`;
346
- for (let e = 0; e < h; e += 1) {
347
- let t = g(e - 1), n = g(e), r = g(e + 1), i = g(e + 2), a = n[0] + (r[0] - t[0]) / 6, o = n[1] + (r[1] - t[1]) / 6, s = r[0] - (i[0] - n[0]) / 6, c = r[1] - (i[1] - n[1]) / 6;
348
- v += ` C ${_(a)} ${_(o)} ${_(s)} ${_(c)} ${_(r[0])} ${_(r[1])}`;
349
- }
350
- return `${v} Z`;
351
- }
352
- function I(e, t, n, r, i, a) {
353
- return !a || a.amplitude <= 0 ? A(e, t, n, r, i) : F(e, t, n, r, i, a);
354
- }
355
- //#endregion
356
- //#region src/liquid/spring.ts
357
- var L = {
358
- snappy: {
359
- stiffness: 480,
360
- damping: 34,
361
- mass: 1
362
- },
363
- smooth: {
364
- stiffness: 190,
365
- damping: 26,
366
- mass: 1
367
- },
368
- bouncy: {
369
- stiffness: 320,
370
- damping: 17,
371
- mass: 1
372
- },
373
- wobbly: {
374
- stiffness: 400,
375
- damping: 9.6,
376
- mass: 1
377
- }
378
- }, R = 1 / 240;
379
- function z(e) {
380
- let t = 0, n = 0, r = 0, i = -1, a = 0, o = [0];
381
- for (; r < 10;) {
382
- let s = (-e.stiffness * (t - 1) - e.damping * n) / e.mass;
383
- if (n += s * R, t += n * R, r += R, o.push(t), t > a && (a = t), Math.abs(t - 1) < .001 && Math.abs(n) < .02) {
384
- if (i < 0 && (i = r), r - i >= .064) break;
385
- } else i = -1;
386
- }
387
- let s = i > 0 ? i : r, c = Math.round(Math.min(120, Math.max(24, s * 90))), l = Math.min(o.length - 1, s / R), u = [];
388
- for (let e = 0; e <= c; e += 1) {
389
- let t = Math.min(o.length - 1, Math.round(e / c * l));
390
- u.push(Math.round((o[t] ?? 1) * 1e4) / 1e4);
391
- }
392
- return u[u.length - 1] = 1, {
393
- duration: s,
394
- values: u,
395
- overshoots: a > 1.001
396
- };
397
- }
398
- var B = null;
399
- function V() {
400
- return B === null && (B = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("transition-timing-function", "linear(0, 1)")), B;
401
- }
402
- var H = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map();
403
- function W(e) {
404
- let t = U.get(e);
405
- if (t) return t;
406
- let n = /^linear\(([^)]+)\)$/.exec(e.trim()), r = /^cubic-bezier\(([^)]+)\)$/.exec(e.trim()), i;
407
- if (n) {
408
- let e = (n[1] ?? "").split(",").map(Number);
409
- i = (t) => {
410
- if (t <= 0) return e[0] ?? 0;
411
- if (t >= 1) return e[e.length - 1] ?? 1;
412
- let n = t * (e.length - 1), r = Math.floor(n), i = e[r] ?? 0;
413
- return i + ((e[r + 1] ?? i) - i) * (n - r);
414
- };
415
- } else if (r) {
416
- let [e = 0, t = 0, n = 1, a = 1] = (r[1] ?? "").split(",").map(Number);
417
- i = (r) => {
418
- if (r <= 0) return 0;
419
- if (r >= 1) return 1;
420
- let i = 0, o = 1;
421
- for (let t = 0; t < 24; t += 1) {
422
- let t = (i + o) / 2;
423
- 3 * t * (1 - t) * (1 - t) * e + 3 * t * t * (1 - t) * n + t ** 3 < r ? i = t : o = t;
424
- }
425
- let s = (i + o) / 2;
426
- return 3 * s * (1 - s) * (1 - s) * t + 3 * s * s * (1 - s) * a + s ** 3;
427
- };
428
- } else i = e === "ease" ? W("cubic-bezier(0.25, 0.1, 0.25, 1)") : e === "ease-in" ? W("cubic-bezier(0.42, 0, 1, 1)") : e === "ease-out" ? W("cubic-bezier(0, 0, 0.58, 1)") : e === "ease-in-out" ? W("cubic-bezier(0.42, 0, 0.58, 1)") : (e) => Math.min(1, Math.max(0, e));
429
- return U.set(e, i), i;
430
- }
431
- function G(e, t = !1) {
432
- if (t) return {
433
- duration: 0,
434
- easing: "linear"
435
- };
436
- let n = e ?? "smooth";
437
- if (typeof n == "object" && "duration" in n) return {
438
- duration: Math.max(0, n.duration),
439
- easing: n.ease ?? "cubic-bezier(0.22, 1, 0.36, 1)"
440
- };
441
- let r = typeof n == "string" ? L[n] : {
442
- stiffness: 300,
443
- damping: 24,
444
- mass: 1,
445
- ...n
446
- }, i = `${r.stiffness}/${r.damping}/${r.mass}/${V()}`, a = H.get(i);
447
- if (!a) {
448
- let e = z(r);
449
- a = {
450
- duration: Math.round(e.duration * 1e3),
451
- easing: V() ? `linear(${e.values.join(", ")})` : e.overshoots ? "cubic-bezier(0.34, 1.56, 0.64, 1)" : "cubic-bezier(0.22, 1, 0.36, 1)"
452
- }, H.set(i, a);
453
- }
454
- return a;
455
- }
456
- //#endregion
457
- //#region src/tokens/reducedMotion.ts
458
- function K() {
459
- return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia("(prefers-reduced-motion: reduce)");
460
- }
461
- function q(e, t) {
462
- let n = e;
463
- return typeof e.addEventListener == "function" ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : typeof n.addListener == "function" ? (n.addListener(t), () => n.removeListener?.(t)) : () => {};
464
- }
465
- function J() {
466
- let [n, r] = t(() => K()?.matches ?? !1);
467
- return e(() => {
468
- let e = K();
469
- if (e) return r(e.matches), q(e, (e) => r(e.matches));
470
- }, []), n;
471
- }
472
- //#endregion
473
- export { a as _, F as a, d as b, D as c, b as d, _ as f, h as g, m as h, P as i, A as l, y as m, W as n, O as o, E as p, G as r, k as s, J as t, I as u, u as v, f as x, p as y };