@pieai/swimmer-ui-kit 3.0.0 → 3.2.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 +25 -2
- package/README.md +3 -3
- package/dist/GameAvatar-Cs5KVYFf.js +923 -0
- package/dist/GameStageTile-BtBb8NEw.js +687 -0
- package/dist/{LiquidGroup-BXw1tv9H.js → LiquidGroup-RTK_Uvgw.js} +845 -376
- package/dist/index.d.ts +66 -1
- package/dist/index.js +520 -313
- package/dist/liquid-effects.js +36 -37
- package/dist/liquid-presence.d.ts +48 -0
- package/dist/liquid-presence.js +584 -413
- package/dist/preview.js +132 -132
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/GameStageTile-DwU_Vvi8.js +0 -1597
- package/dist/reducedMotion-B8kv-v64.js +0 -473
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createPortal as O } from "react-dom";
|
|
2
|
+
import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useEffect as i, useId as a, useLayoutEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
3
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as p } from "react-dom";
|
|
6
5
|
//#region src/tokens/references.ts
|
|
7
|
-
var
|
|
6
|
+
var m = {
|
|
8
7
|
morphShape: "var(--game-ui-liquid-gooey-morph-shape)",
|
|
9
8
|
morphSpeed: "var(--game-ui-liquid-gooey-morph-speed)",
|
|
10
9
|
morphBounce: "var(--game-ui-liquid-gooey-morph-bounce)",
|
|
@@ -88,7 +87,7 @@ var k = {
|
|
|
88
87
|
dissolveStrength: "var(--game-ui-liquid-gooey-dissolve-strength)",
|
|
89
88
|
dissolveSink: "var(--game-ui-liquid-gooey-dissolve-sink)",
|
|
90
89
|
dissolveSeamBlur: "var(--game-ui-liquid-gooey-dissolve-seam-blur)"
|
|
91
|
-
},
|
|
90
|
+
}, h = {
|
|
92
91
|
bg: "var(--game-ui-overlay-glass-bg)",
|
|
93
92
|
bgHover: "var(--game-ui-overlay-glass-bg-hover)",
|
|
94
93
|
bgStrong: "var(--game-ui-overlay-glass-bg-strong)",
|
|
@@ -100,7 +99,7 @@ var k = {
|
|
|
100
99
|
blur: "var(--game-ui-overlay-glass-blur)",
|
|
101
100
|
focusRing: "var(--game-ui-overlay-glass-focus-ring)",
|
|
102
101
|
primaryFill: "var(--game-ui-overlay-glass-primary-fill)"
|
|
103
|
-
},
|
|
102
|
+
}, g = {
|
|
104
103
|
background: "var(--game-ui-bg)",
|
|
105
104
|
playfieldScrim: "var(--game-ui-playfield-scrim)",
|
|
106
105
|
surface: "var(--game-ui-surface)",
|
|
@@ -118,7 +117,7 @@ var k = {
|
|
|
118
117
|
borderSubtle: "var(--game-ui-border-subtle)",
|
|
119
118
|
borderStrong: "var(--game-ui-border-strong)",
|
|
120
119
|
disabled: "var(--game-ui-disabled)"
|
|
121
|
-
},
|
|
120
|
+
}, _ = {
|
|
122
121
|
familyDisplay: "var(--game-ui-font-display)",
|
|
123
122
|
familyBody: "var(--game-ui-font-body)",
|
|
124
123
|
familyMono: "var(--game-ui-font-mono)",
|
|
@@ -136,7 +135,7 @@ var k = {
|
|
|
136
135
|
weightBody: "var(--game-ui-weight-body)",
|
|
137
136
|
weightStrong: "var(--game-ui-weight-strong)",
|
|
138
137
|
weightTitle: "var(--game-ui-weight-title)"
|
|
139
|
-
},
|
|
138
|
+
}, v = {
|
|
140
139
|
px2: "var(--game-ui-space-2)",
|
|
141
140
|
px4: "var(--game-ui-space-4)",
|
|
142
141
|
px6: "var(--game-ui-space-6)",
|
|
@@ -151,35 +150,35 @@ var k = {
|
|
|
151
150
|
safeRight: "var(--game-ui-safe-right)",
|
|
152
151
|
safeBottom: "var(--game-ui-safe-bottom)",
|
|
153
152
|
safeLeft: "var(--game-ui-safe-left)"
|
|
154
|
-
},
|
|
153
|
+
}, y = {
|
|
155
154
|
bead: "var(--game-ui-radius-bead)",
|
|
156
155
|
control: "var(--game-ui-radius-control)",
|
|
157
156
|
card: "var(--game-ui-radius-card)",
|
|
158
157
|
radiusPanel: "var(--game-ui-radius-panel)",
|
|
159
158
|
radiusModal: "var(--game-ui-radius-modal)"
|
|
160
|
-
},
|
|
159
|
+
}, b = {
|
|
161
160
|
size: "var(--game-ui-scrollbar-size)",
|
|
162
161
|
track: "var(--game-ui-scrollbar-track)",
|
|
163
162
|
thumb: "var(--game-ui-scrollbar-thumb)",
|
|
164
163
|
thumbHover: "var(--game-ui-scrollbar-thumb-hover)"
|
|
165
|
-
},
|
|
164
|
+
}, x = {
|
|
166
165
|
shadowRaised: "var(--game-ui-shadow-raised)",
|
|
167
166
|
stroke: "var(--game-ui-stroke)"
|
|
168
|
-
},
|
|
167
|
+
}, S = {
|
|
169
168
|
fast: "var(--game-ui-motion-fast)",
|
|
170
169
|
base: "var(--game-ui-motion-base)",
|
|
171
170
|
slow: "var(--game-ui-motion-slow)",
|
|
172
171
|
easingPop: "var(--game-ui-ease-pop)",
|
|
173
172
|
easingSoft: "var(--game-ui-ease-soft)",
|
|
174
173
|
reducedMotion: "var(--game-ui-reduced-motion-policy)"
|
|
175
|
-
},
|
|
174
|
+
}, C = {
|
|
176
175
|
playfield: "var(--game-ui-z-playfield)",
|
|
177
176
|
hud: "var(--game-ui-z-hud)",
|
|
178
177
|
sidebar: "var(--game-ui-z-sidebar)",
|
|
179
178
|
overlay: "var(--game-ui-z-overlay)",
|
|
180
179
|
zModal: "var(--game-ui-z-modal)",
|
|
181
180
|
toast: "var(--game-ui-z-toast)"
|
|
182
|
-
},
|
|
181
|
+
}, w = {
|
|
183
182
|
touchMinimumPx: 44,
|
|
184
183
|
touchPrimaryPx: 52,
|
|
185
184
|
touchIconPx: 48,
|
|
@@ -190,7 +189,7 @@ var k = {
|
|
|
190
189
|
desktopProofHeightPx: 900,
|
|
191
190
|
mobileLandscapeProofWidthPx: 844,
|
|
192
191
|
mobileLandscapeProofHeightPx: 390
|
|
193
|
-
},
|
|
192
|
+
}, T = {
|
|
194
193
|
iconSm: "var(--game-ui-icon-sm)",
|
|
195
194
|
iconMd: "var(--game-ui-icon-md)",
|
|
196
195
|
iconLg: "var(--game-ui-icon-lg)",
|
|
@@ -200,45 +199,398 @@ var k = {
|
|
|
200
199
|
terrainToolHitSize: "var(--game-ui-terrain-tool-hit-size)",
|
|
201
200
|
buildRailCardSize: "var(--game-ui-build-rail-card-size)",
|
|
202
201
|
brushNumberWidth: "var(--game-ui-brush-number-width)"
|
|
203
|
-
},
|
|
204
|
-
function
|
|
202
|
+
}, E = 48e4, D = 2, O = E, k = 0;
|
|
203
|
+
function A(e, t) {
|
|
204
|
+
return Number.isFinite(e) ? Math.max(0, Math.floor(e)) : t;
|
|
205
|
+
}
|
|
206
|
+
function j() {
|
|
207
|
+
return {
|
|
208
|
+
maxAnimatedGroups: D,
|
|
209
|
+
maxFilterArea: O,
|
|
210
|
+
activeGroups: k
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function M(e) {
|
|
214
|
+
if (typeof e == "number") {
|
|
215
|
+
D = A(e, 0);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
e.maxAnimatedGroups !== void 0 && (D = A(e.maxAnimatedGroups, 0)), e.maxFilterArea !== void 0 && (O = A(e.maxFilterArea, 0));
|
|
219
|
+
}
|
|
220
|
+
function N(e) {
|
|
221
|
+
return k >= D || (Number.isFinite(e) ? Math.max(0, e) : Infinity) > O ? !1 : (k += 1, !0);
|
|
222
|
+
}
|
|
223
|
+
function P() {
|
|
224
|
+
k > 0 && --k;
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/liquid/material/weight.ts
|
|
228
|
+
var ee = {
|
|
229
|
+
blur: 5,
|
|
230
|
+
contrast: 18,
|
|
231
|
+
gloss: 1.5,
|
|
232
|
+
blob: 3.5,
|
|
233
|
+
lobes: 3,
|
|
234
|
+
filterPadding: 20,
|
|
235
|
+
shadow: "var(--game-ui-liquid-material-shadow)"
|
|
236
|
+
}, te = {
|
|
237
|
+
top: "var(--game-ui-cta-from)",
|
|
238
|
+
bottom: "var(--game-ui-cta-to)",
|
|
239
|
+
sheen: .3
|
|
240
|
+
}, ne = "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 60 -29.5", F = 1.3, re = 1 / .3902;
|
|
241
|
+
function I(e, t) {
|
|
242
|
+
return e <= 0 ? t : Math.min(t, re * e / F);
|
|
243
|
+
}
|
|
244
|
+
var L = {
|
|
245
|
+
waviness: 0,
|
|
246
|
+
wavinessFreq: .018
|
|
247
|
+
};
|
|
248
|
+
function ie(e) {
|
|
249
|
+
return e.spread === 0 ? "shape" : "bin";
|
|
250
|
+
}
|
|
251
|
+
function ae(e, t) {
|
|
252
|
+
return t !== null || e.some((e) => e.spread !== 0);
|
|
253
|
+
}
|
|
254
|
+
function oe({ index: e, shadow: t }) {
|
|
255
|
+
let n = [], r = ie(t), i = r;
|
|
256
|
+
return t.spread !== 0 && (n.push(/* @__PURE__ */ d("feMorphology", {
|
|
257
|
+
in: i,
|
|
258
|
+
operator: t.spread > 0 ? "erode" : "dilate",
|
|
259
|
+
radius: Math.abs(t.spread),
|
|
260
|
+
result: `shadow-${e}-erode`
|
|
261
|
+
}, "erode")), i = `shadow-${e}-erode`), (t.x !== 0 || t.y !== 0) && (n.push(/* @__PURE__ */ d("feOffset", {
|
|
262
|
+
in: i,
|
|
263
|
+
dx: t.x,
|
|
264
|
+
dy: t.y,
|
|
265
|
+
result: `shadow-${e}-offset`
|
|
266
|
+
}, "offset")), i = `shadow-${e}-offset`), t.blur > 0 && (n.push(/* @__PURE__ */ d("feGaussianBlur", {
|
|
267
|
+
in: i,
|
|
268
|
+
stdDeviation: t.blur / 2,
|
|
269
|
+
result: `shadow-${e}-blur`
|
|
270
|
+
}, "blur")), i = `shadow-${e}-blur`), n.push(/* @__PURE__ */ d("feComposite", {
|
|
271
|
+
in: r,
|
|
272
|
+
in2: i,
|
|
273
|
+
operator: "out",
|
|
274
|
+
result: `shadow-${e}-band`
|
|
275
|
+
}, "band"), /* @__PURE__ */ d("feFlood", {
|
|
276
|
+
floodColor: t.color,
|
|
277
|
+
result: `shadow-${e}-color`
|
|
278
|
+
}, "color"), /* @__PURE__ */ d("feComposite", {
|
|
279
|
+
in: `shadow-${e}-color`,
|
|
280
|
+
in2: `shadow-${e}-band`,
|
|
281
|
+
operator: "in",
|
|
282
|
+
result: `shadow-${e}`
|
|
283
|
+
}, "fill")), /* @__PURE__ */ d(u, { children: n });
|
|
284
|
+
}
|
|
285
|
+
function se({ index: e, shadow: t }) {
|
|
286
|
+
let n = [], r = "shape";
|
|
287
|
+
return t.spread !== 0 && (n.push(/* @__PURE__ */ d("feMorphology", {
|
|
288
|
+
in: "bin",
|
|
289
|
+
operator: t.spread > 0 ? "dilate" : "erode",
|
|
290
|
+
radius: Math.abs(t.spread),
|
|
291
|
+
result: `shadow-${e}-spread`
|
|
292
|
+
}, "spread")), r = `shadow-${e}-spread`), t.blur > 0 && (n.push(/* @__PURE__ */ d("feGaussianBlur", {
|
|
293
|
+
in: r,
|
|
294
|
+
stdDeviation: t.blur / 2,
|
|
295
|
+
result: `shadow-${e}-blur`
|
|
296
|
+
}, "blur")), r = `shadow-${e}-blur`), (t.x !== 0 || t.y !== 0) && (n.push(/* @__PURE__ */ d("feOffset", {
|
|
297
|
+
in: r,
|
|
298
|
+
dx: t.x,
|
|
299
|
+
dy: t.y,
|
|
300
|
+
result: `shadow-${e}-offset`
|
|
301
|
+
}, "offset")), r = `shadow-${e}-offset`), n.push(/* @__PURE__ */ d("feFlood", {
|
|
302
|
+
floodColor: t.color,
|
|
303
|
+
result: `shadow-${e}-color`
|
|
304
|
+
}, "color"), /* @__PURE__ */ d("feComposite", {
|
|
305
|
+
in: `shadow-${e}-color`,
|
|
306
|
+
in2: r,
|
|
307
|
+
operator: "in",
|
|
308
|
+
result: `shadow-${e}`
|
|
309
|
+
}, "fill")), /* @__PURE__ */ d(u, { children: n });
|
|
310
|
+
}
|
|
311
|
+
function ce({ stroke: e }) {
|
|
312
|
+
let t = [];
|
|
313
|
+
return t.push(/* @__PURE__ */ d("feMorphology", {
|
|
314
|
+
in: "bin",
|
|
315
|
+
operator: "erode",
|
|
316
|
+
radius: e.width,
|
|
317
|
+
result: "stroke-erode"
|
|
318
|
+
}, "erode"), /* @__PURE__ */ d("feComposite", {
|
|
319
|
+
in: "bin",
|
|
320
|
+
in2: "stroke-erode",
|
|
321
|
+
operator: "out",
|
|
322
|
+
result: "stroke-band"
|
|
323
|
+
}, "band"), /* @__PURE__ */ d("feFlood", {
|
|
324
|
+
floodColor: e.color,
|
|
325
|
+
result: "stroke-color"
|
|
326
|
+
}, "color"), /* @__PURE__ */ d("feComposite", {
|
|
327
|
+
in: "stroke-color",
|
|
328
|
+
in2: "stroke-band",
|
|
329
|
+
operator: "in",
|
|
330
|
+
result: "stroke-out"
|
|
331
|
+
}, "fill")), /* @__PURE__ */ d(u, { children: t });
|
|
332
|
+
}
|
|
333
|
+
function le({ blur: e, contrast: t, shadows: n, stroke: r, gloss: i = 0, waviness: a = L.waviness, wavinessFreq: o = L.wavinessFreq }) {
|
|
334
|
+
let s = I(e, t), c = Math.round((.5 - 5 / 12 * s) * 100) / 100, l = a > 0;
|
|
335
|
+
return /* @__PURE__ */ f(u, { children: [
|
|
336
|
+
/* @__PURE__ */ d("feGaussianBlur", {
|
|
337
|
+
in: "SourceGraphic",
|
|
338
|
+
stdDeviation: e,
|
|
339
|
+
result: "blur"
|
|
340
|
+
}),
|
|
341
|
+
/* @__PURE__ */ d("feColorMatrix", {
|
|
342
|
+
in: "blur",
|
|
343
|
+
type: "matrix",
|
|
344
|
+
values: `1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${s} ${c}`,
|
|
345
|
+
result: "goo"
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ d("feComposite", {
|
|
348
|
+
in: "SourceGraphic",
|
|
349
|
+
in2: "goo",
|
|
350
|
+
operator: "atop",
|
|
351
|
+
result: l ? "shape-raw" : "shape"
|
|
352
|
+
}),
|
|
353
|
+
l ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("feTurbulence", {
|
|
354
|
+
type: "fractalNoise",
|
|
355
|
+
baseFrequency: o,
|
|
356
|
+
numOctaves: 1,
|
|
357
|
+
seed: "7",
|
|
358
|
+
result: "wave-noise"
|
|
359
|
+
}), /* @__PURE__ */ d("feDisplacementMap", {
|
|
360
|
+
in: "shape-raw",
|
|
361
|
+
in2: "wave-noise",
|
|
362
|
+
scale: a * 2,
|
|
363
|
+
xChannelSelector: "R",
|
|
364
|
+
yChannelSelector: "G",
|
|
365
|
+
result: "shape"
|
|
366
|
+
})] }) : null,
|
|
367
|
+
i > 0 ? /* @__PURE__ */ f(u, { children: [
|
|
368
|
+
/* @__PURE__ */ d("feGaussianBlur", {
|
|
369
|
+
in: "shape",
|
|
370
|
+
stdDeviation: 2.5,
|
|
371
|
+
result: "gloss-bump"
|
|
372
|
+
}),
|
|
373
|
+
/* @__PURE__ */ d("feSpecularLighting", {
|
|
374
|
+
in: "gloss-bump",
|
|
375
|
+
surfaceScale: i,
|
|
376
|
+
specularConstant: .78,
|
|
377
|
+
specularExponent: 20,
|
|
378
|
+
lightingColor: "#ffffff",
|
|
379
|
+
result: "gloss-light",
|
|
380
|
+
children: /* @__PURE__ */ d("feDistantLight", {
|
|
381
|
+
azimuth: 235,
|
|
382
|
+
elevation: 22
|
|
383
|
+
})
|
|
384
|
+
}),
|
|
385
|
+
/* @__PURE__ */ d("feMorphology", {
|
|
386
|
+
in: "shape",
|
|
387
|
+
operator: "erode",
|
|
388
|
+
radius: 1.2,
|
|
389
|
+
result: "gloss-inset"
|
|
390
|
+
}),
|
|
391
|
+
/* @__PURE__ */ d("feGaussianBlur", {
|
|
392
|
+
in: "gloss-inset",
|
|
393
|
+
stdDeviation: .8,
|
|
394
|
+
result: "gloss-mask"
|
|
395
|
+
}),
|
|
396
|
+
/* @__PURE__ */ d("feComposite", {
|
|
397
|
+
in: "gloss-light",
|
|
398
|
+
in2: "gloss-mask",
|
|
399
|
+
operator: "in",
|
|
400
|
+
result: "gloss-clip"
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ d("feComposite", {
|
|
403
|
+
in: "shape",
|
|
404
|
+
in2: "gloss-clip",
|
|
405
|
+
operator: "arithmetic",
|
|
406
|
+
k1: "0",
|
|
407
|
+
k2: "1",
|
|
408
|
+
k3: "1",
|
|
409
|
+
k4: "0",
|
|
410
|
+
result: "shape"
|
|
411
|
+
})
|
|
412
|
+
] }) : null,
|
|
413
|
+
ae(n, r) ? /* @__PURE__ */ d("feColorMatrix", {
|
|
414
|
+
in: "shape",
|
|
415
|
+
type: "matrix",
|
|
416
|
+
values: ne,
|
|
417
|
+
result: "bin"
|
|
418
|
+
}) : null,
|
|
419
|
+
n.map((e, t) => e.inset ? /* @__PURE__ */ d(oe, {
|
|
420
|
+
index: t,
|
|
421
|
+
shadow: e
|
|
422
|
+
}, t) : /* @__PURE__ */ d(se, {
|
|
423
|
+
index: t,
|
|
424
|
+
shadow: e
|
|
425
|
+
}, t)),
|
|
426
|
+
r ? /* @__PURE__ */ d(ce, { stroke: r }) : null,
|
|
427
|
+
n.length > 0 || r ? /* @__PURE__ */ f("feMerge", { children: [
|
|
428
|
+
n.map((e, t) => e.inset ? -1 : t).filter((e) => e >= 0).reverse().map((e) => /* @__PURE__ */ d("feMergeNode", { in: `shadow-${e}` }, e)),
|
|
429
|
+
/* @__PURE__ */ d("feMergeNode", { in: "shape" }),
|
|
430
|
+
r ? /* @__PURE__ */ d("feMergeNode", { in: "stroke-out" }) : null,
|
|
431
|
+
n.map((e, t) => e.inset ? /* @__PURE__ */ d("feMergeNode", { in: `shadow-${t}` }, t) : null)
|
|
432
|
+
] }) : null
|
|
433
|
+
] });
|
|
434
|
+
}
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region src/liquid/waviness.ts
|
|
437
|
+
var ue = .3;
|
|
438
|
+
function de(e, t, n = ue) {
|
|
205
439
|
let r = Math.max(0, Number.isFinite(e) ? e : 0);
|
|
206
440
|
if (n === !1) return r;
|
|
207
|
-
let i = Math.max(0, Number.isFinite(n) ? n :
|
|
441
|
+
let i = Math.max(0, Number.isFinite(n) ? n : ue), a = Math.max(0, Number.isFinite(t) ? t : 0);
|
|
208
442
|
return a > 0 ? Math.min(r, a * i) : r;
|
|
209
443
|
}
|
|
210
444
|
//#endregion
|
|
445
|
+
//#region src/liquid/geometry.ts
|
|
446
|
+
function fe(e, t) {
|
|
447
|
+
let n = 0, r = 0, i = e;
|
|
448
|
+
for (; i && i !== t && t.contains(i);) n += i.offsetLeft, r += i.offsetTop, i = i.offsetParent;
|
|
449
|
+
return {
|
|
450
|
+
x: n,
|
|
451
|
+
y: r
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
function pe(e, t, n) {
|
|
455
|
+
let r = getComputedStyle(e), i = (e) => {
|
|
456
|
+
let r = e.split(" ")[0] ?? "";
|
|
457
|
+
return r.endsWith("%") ? (parseFloat(r) || 0) / 100 * Math.min(t, n) : parseFloat(r) || 0;
|
|
458
|
+
};
|
|
459
|
+
return [
|
|
460
|
+
i(r.borderTopLeftRadius),
|
|
461
|
+
i(r.borderTopRightRadius),
|
|
462
|
+
i(r.borderBottomRightRadius),
|
|
463
|
+
i(r.borderBottomLeftRadius)
|
|
464
|
+
];
|
|
465
|
+
}
|
|
466
|
+
function me(e) {
|
|
467
|
+
return typeof e == "number" ? [
|
|
468
|
+
e,
|
|
469
|
+
e,
|
|
470
|
+
e,
|
|
471
|
+
e
|
|
472
|
+
] : e;
|
|
473
|
+
}
|
|
474
|
+
function R(e, t, n, r, i) {
|
|
475
|
+
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));
|
|
476
|
+
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`;
|
|
477
|
+
}
|
|
478
|
+
var he = 44;
|
|
479
|
+
function ge(e) {
|
|
480
|
+
let t = e + 1831565813 >>> 0;
|
|
481
|
+
return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
482
|
+
}
|
|
483
|
+
function _e(e, t, n, r) {
|
|
484
|
+
let i = Math.max(0, e - 2 * n), a = Math.max(0, t - 2 * n), o = Math.PI / 2 * n, s = [
|
|
485
|
+
i,
|
|
486
|
+
o,
|
|
487
|
+
a,
|
|
488
|
+
o,
|
|
489
|
+
i,
|
|
490
|
+
o,
|
|
491
|
+
a,
|
|
492
|
+
o
|
|
493
|
+
], c = r * (s.reduce((e, t) => e + t, 0) || 1), l = 0;
|
|
494
|
+
for (; l < s.length - 1 && c > s[l];) c -= s[l], l += 1;
|
|
495
|
+
let u = s[l], d = u === 0 ? 0 : c / u, f = (e, t, r) => {
|
|
496
|
+
let i = e + Math.PI / 2 * d;
|
|
497
|
+
return {
|
|
498
|
+
x: t + n * Math.cos(i),
|
|
499
|
+
y: r + n * Math.sin(i),
|
|
500
|
+
nx: Math.cos(i),
|
|
501
|
+
ny: Math.sin(i)
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
switch (l) {
|
|
505
|
+
case 0: return {
|
|
506
|
+
x: n + d * i,
|
|
507
|
+
y: 0,
|
|
508
|
+
nx: 0,
|
|
509
|
+
ny: -1
|
|
510
|
+
};
|
|
511
|
+
case 1: return f(-Math.PI / 2, e - n, n);
|
|
512
|
+
case 2: return {
|
|
513
|
+
x: e,
|
|
514
|
+
y: n + d * a,
|
|
515
|
+
nx: 1,
|
|
516
|
+
ny: 0
|
|
517
|
+
};
|
|
518
|
+
case 3: return f(0, e - n, t - n);
|
|
519
|
+
case 4: return {
|
|
520
|
+
x: e - n - d * i,
|
|
521
|
+
y: t,
|
|
522
|
+
nx: 0,
|
|
523
|
+
ny: 1
|
|
524
|
+
};
|
|
525
|
+
case 5: return f(Math.PI / 2, n, t - n);
|
|
526
|
+
case 6: return {
|
|
527
|
+
x: 0,
|
|
528
|
+
y: t - n - d * a,
|
|
529
|
+
nx: -1,
|
|
530
|
+
ny: 0
|
|
531
|
+
};
|
|
532
|
+
default: return f(Math.PI, n, n);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
var ve = .18;
|
|
536
|
+
function ye(e, t, n, r, i, a) {
|
|
537
|
+
let o = Math.min(n, r), s = Math.min(Math.max(0, a.amplitude), o * ve);
|
|
538
|
+
if (s < .15 || o <= 0) return R(e, t, n, r, i);
|
|
539
|
+
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 = [];
|
|
540
|
+
for (let e = 0; e < u; e += 1) f.push({
|
|
541
|
+
k: e + 2,
|
|
542
|
+
a: ge(l * 31 + e) * .6 + .4,
|
|
543
|
+
p: ge(l * 57 + e) * Math.PI * 2
|
|
544
|
+
});
|
|
545
|
+
let p = f.reduce((e, t) => e + t.a, 0) || 1, m = [];
|
|
546
|
+
for (let i = 0; i < he; i += 1) {
|
|
547
|
+
let a = i / he, o = _e(n, r, c, a), l = 0;
|
|
548
|
+
for (let { k: e, a: t, p: n } of f) l += t * Math.sin(2 * Math.PI * e * a + n + d);
|
|
549
|
+
let u = (l / p + 1) / 2 * s;
|
|
550
|
+
m.push([e + o.x + o.nx * u, t + o.y + o.ny * u]);
|
|
551
|
+
}
|
|
552
|
+
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])}`;
|
|
553
|
+
for (let e = 0; e < h; e += 1) {
|
|
554
|
+
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;
|
|
555
|
+
v += ` C ${_(a)} ${_(o)} ${_(s)} ${_(c)} ${_(r[0])} ${_(r[1])}`;
|
|
556
|
+
}
|
|
557
|
+
return `${v} Z`;
|
|
558
|
+
}
|
|
559
|
+
function be(e, t, n, r, i, a) {
|
|
560
|
+
return !a || a.amplitude <= 0 ? R(e, t, n, r, i) : ye(e, t, n, r, i, a);
|
|
561
|
+
}
|
|
562
|
+
//#endregion
|
|
211
563
|
//#region src/liquid/motionTokens.ts
|
|
212
|
-
function
|
|
564
|
+
function z(e, t = 0, n = 1) {
|
|
213
565
|
return Math.min(n, Math.max(t, e));
|
|
214
566
|
}
|
|
215
|
-
function
|
|
567
|
+
function B(e, t) {
|
|
216
568
|
return e !== void 0 && Number.isFinite(e) ? e : t;
|
|
217
569
|
}
|
|
218
|
-
function
|
|
570
|
+
function V(e) {
|
|
219
571
|
return /^var\((--[\w-]+)\)$/.exec(e.trim())?.[1] ?? null;
|
|
220
572
|
}
|
|
221
|
-
function
|
|
222
|
-
let r = e?.ownerDocument.defaultView, i =
|
|
573
|
+
function H(e, t, n) {
|
|
574
|
+
let r = e?.ownerDocument.defaultView, i = V(m[t]);
|
|
223
575
|
if (!r || !i) return n;
|
|
224
576
|
let a = r.getComputedStyle(e).getPropertyValue(i), o = Number.parseFloat(a);
|
|
225
577
|
return Number.isFinite(o) ? o : n;
|
|
226
578
|
}
|
|
227
|
-
function
|
|
579
|
+
function U(e) {
|
|
228
580
|
return Math.round(e * 10) / 10;
|
|
229
581
|
}
|
|
230
|
-
function
|
|
582
|
+
function W(e) {
|
|
231
583
|
return String(Math.round(e * 1e3) / 1e3);
|
|
232
584
|
}
|
|
233
585
|
//#endregion
|
|
234
586
|
//#region src/liquid/move.ts
|
|
235
|
-
var
|
|
587
|
+
var G = {
|
|
236
588
|
stiffness: 380,
|
|
237
589
|
damping: 18,
|
|
238
590
|
stretch: .18,
|
|
239
591
|
tail: .46,
|
|
240
592
|
force: .5
|
|
241
|
-
},
|
|
593
|
+
}, K = {
|
|
242
594
|
tailSpringStiffness: 170,
|
|
243
595
|
tailSpringDamping: 22,
|
|
244
596
|
stretchSpeed: 6e-4,
|
|
@@ -262,48 +614,48 @@ var z = {
|
|
|
262
614
|
settleSpeed: 1,
|
|
263
615
|
integrationRate: 60
|
|
264
616
|
};
|
|
265
|
-
function
|
|
266
|
-
let t = (t, n) =>
|
|
617
|
+
function xe(e) {
|
|
618
|
+
let t = (t, n) => H(e, t, n);
|
|
267
619
|
return {
|
|
268
|
-
stiffness: Math.max(.001, t("moveStiffness",
|
|
269
|
-
damping: Math.max(0, t("moveDamping",
|
|
270
|
-
stretch:
|
|
271
|
-
tail:
|
|
272
|
-
force:
|
|
273
|
-
tailSpringStiffness: Math.max(.001, t("moveTailSpringStiffness",
|
|
274
|
-
tailSpringDamping: Math.max(0, t("moveTailSpringDamping",
|
|
275
|
-
stretchSpeed: Math.max(0, t("moveStretchSpeed",
|
|
276
|
-
stretchSquash: Math.max(0, t("moveStretchSquash",
|
|
277
|
-
speedThreshold: Math.max(0, t("moveSpeedThreshold",
|
|
278
|
-
tailOnsetSpeed: Math.max(0, t("moveTailOnsetSpeed",
|
|
279
|
-
tailOnsetRange: Math.max(.001, t("moveTailOnsetRange",
|
|
280
|
-
tailRamp: Math.max(0, t("moveTailRamp",
|
|
281
|
-
tailMinRadius: Math.max(0, t("moveTailMinRadius",
|
|
282
|
-
tailWobble: Math.max(0, t("moveTailWobble",
|
|
283
|
-
tailPhaseSpeed: Math.max(0, t("moveTailPhaseSpeed",
|
|
284
|
-
tailMidpointA:
|
|
285
|
-
tailMidpointB:
|
|
286
|
-
tailMidRadiusA:
|
|
287
|
-
tailMidRadiusB:
|
|
288
|
-
tailWobblePhase: t("moveTailWobblePhase",
|
|
289
|
-
minPerpendicular: Math.max(0, t("moveMinPerpendicular",
|
|
290
|
-
lagBase: Math.max(0, t("moveLagBase",
|
|
291
|
-
lagForce: Math.max(0, t("moveLagForce",
|
|
292
|
-
settleDistance: Math.max(0, t("moveSettleDistance",
|
|
293
|
-
settleSpeed: Math.max(0, t("moveSettleSpeed",
|
|
294
|
-
integrationRate: Math.max(1, t("moveIntegrationRate",
|
|
620
|
+
stiffness: Math.max(.001, t("moveStiffness", G.stiffness)),
|
|
621
|
+
damping: Math.max(0, t("moveDamping", G.damping)),
|
|
622
|
+
stretch: z(t("moveStretch", G.stretch)),
|
|
623
|
+
tail: z(t("moveTail", G.tail)),
|
|
624
|
+
force: z(t("moveForce", G.force)),
|
|
625
|
+
tailSpringStiffness: Math.max(.001, t("moveTailSpringStiffness", K.tailSpringStiffness)),
|
|
626
|
+
tailSpringDamping: Math.max(0, t("moveTailSpringDamping", K.tailSpringDamping)),
|
|
627
|
+
stretchSpeed: Math.max(0, t("moveStretchSpeed", K.stretchSpeed)),
|
|
628
|
+
stretchSquash: Math.max(0, t("moveStretchSquash", K.stretchSquash)),
|
|
629
|
+
speedThreshold: Math.max(0, t("moveSpeedThreshold", K.speedThreshold)),
|
|
630
|
+
tailOnsetSpeed: Math.max(0, t("moveTailOnsetSpeed", K.tailOnsetSpeed)),
|
|
631
|
+
tailOnsetRange: Math.max(.001, t("moveTailOnsetRange", K.tailOnsetRange)),
|
|
632
|
+
tailRamp: Math.max(0, t("moveTailRamp", K.tailRamp)),
|
|
633
|
+
tailMinRadius: Math.max(0, t("moveTailMinRadius", K.tailMinRadius)),
|
|
634
|
+
tailWobble: Math.max(0, t("moveTailWobble", K.tailWobble)),
|
|
635
|
+
tailPhaseSpeed: Math.max(0, t("moveTailPhaseSpeed", K.tailPhaseSpeed)),
|
|
636
|
+
tailMidpointA: z(t("moveTailMidpointA", K.tailMidpointA)),
|
|
637
|
+
tailMidpointB: z(t("moveTailMidpointB", K.tailMidpointB)),
|
|
638
|
+
tailMidRadiusA: z(t("moveTailMidRadiusA", K.tailMidRadiusA)),
|
|
639
|
+
tailMidRadiusB: z(t("moveTailMidRadiusB", K.tailMidRadiusB)),
|
|
640
|
+
tailWobblePhase: t("moveTailWobblePhase", K.tailWobblePhase),
|
|
641
|
+
minPerpendicular: Math.max(0, t("moveMinPerpendicular", K.minPerpendicular)),
|
|
642
|
+
lagBase: Math.max(0, t("moveLagBase", K.lagBase)),
|
|
643
|
+
lagForce: Math.max(0, t("moveLagForce", K.lagForce)),
|
|
644
|
+
settleDistance: Math.max(0, t("moveSettleDistance", K.settleDistance)),
|
|
645
|
+
settleSpeed: Math.max(0, t("moveSettleSpeed", K.settleSpeed)),
|
|
646
|
+
integrationRate: Math.max(1, t("moveIntegrationRate", K.integrationRate))
|
|
295
647
|
};
|
|
296
648
|
}
|
|
297
|
-
function
|
|
649
|
+
function Se(e, t, n, r, i, a) {
|
|
298
650
|
let o = t + (r * (n - e) - i * t) * a;
|
|
299
651
|
return [e + o * a, o];
|
|
300
652
|
}
|
|
301
|
-
function
|
|
302
|
-
let s = Math.max(0,
|
|
303
|
-
for (; c-- > 0;) [u, d] =
|
|
653
|
+
function q(e, t, n, r, i, a, o) {
|
|
654
|
+
let s = Math.max(0, B(a, 0)), c = Math.max(1, Math.ceil(s * o)), l = s / c, u = e, d = t;
|
|
655
|
+
for (; c-- > 0;) [u, d] = Se(u, d, n, r, i, l);
|
|
304
656
|
return [u, d];
|
|
305
657
|
}
|
|
306
|
-
function
|
|
658
|
+
function Ce(e) {
|
|
307
659
|
return {
|
|
308
660
|
cx: e.cx,
|
|
309
661
|
cy: e.cy,
|
|
@@ -318,59 +670,59 @@ function fe(e) {
|
|
|
318
670
|
tailInitialized: !0
|
|
319
671
|
};
|
|
320
672
|
}
|
|
321
|
-
function
|
|
673
|
+
function we(e, t) {
|
|
322
674
|
e.cx = t.cx, e.cy = t.cy, e.vcx = 0, e.vcy = 0, e.tailX = t.cx, e.tailY = t.cy, e.tailVx = 0, e.tailVy = 0, e.tailR = 0, e.tailPhase = 0, e.tailInitialized = !0;
|
|
323
675
|
}
|
|
324
|
-
function
|
|
325
|
-
let
|
|
326
|
-
[e.cx, e.vcx] =
|
|
327
|
-
let
|
|
328
|
-
if (
|
|
329
|
-
let t = Math.min(
|
|
330
|
-
|
|
676
|
+
function Te(e, t, n, r, i) {
|
|
677
|
+
let a = Math.max(.01, B(t.scale, 1));
|
|
678
|
+
[e.cx, e.vcx] = q(e.cx, e.vcx, t.cx, i.stiffness, i.damping, r, i.integrationRate), [e.cy, e.vcy] = q(e.cy, e.vcy, t.cy, i.stiffness, i.damping, r, i.integrationRate);
|
|
679
|
+
let o = Math.hypot(e.vcx, e.vcy), s = 0, c = 1, l = 1;
|
|
680
|
+
if (o > i.speedThreshold) {
|
|
681
|
+
let t = Math.min(i.stretch, o * i.stretchSpeed);
|
|
682
|
+
s = Math.round(Math.atan2(e.vcy, e.vcx) * 100) / 100, c = 1 + t, l = 1 / (1 + t * i.stretchSquash);
|
|
331
683
|
}
|
|
332
|
-
e.tailInitialized ||= (e.tailX = e.cx, e.tailY = e.cy, !0), [e.tailX, e.tailVx] =
|
|
333
|
-
let
|
|
334
|
-
|
|
335
|
-
let
|
|
336
|
-
e.tailR += (
|
|
337
|
-
let
|
|
338
|
-
if (
|
|
339
|
-
e.tailPhase +=
|
|
340
|
-
let t = e.tailR *
|
|
341
|
-
|
|
684
|
+
e.tailInitialized ||= (e.tailX = e.cx, e.tailY = e.cy, !0), [e.tailX, e.tailVx] = q(e.tailX, e.tailVx, e.cx, i.tailSpringStiffness, i.tailSpringDamping, r, i.integrationRate), [e.tailY, e.tailVy] = q(e.tailY, e.tailVy, e.cy, i.tailSpringStiffness, i.tailSpringDamping, r, i.integrationRate);
|
|
685
|
+
let u = Math.max(0, n.w * a), d = Math.max(0, n.h * a), f = o > .001 ? e.vcx / o : 1, p = o > .001 ? e.vcy / o : 0, m = Math.max(i.minPerpendicular, Math.abs(f) * d + Math.abs(p) * u), h = (Math.abs(f) * u + Math.abs(p) * d) / 2, g = m / 2, _ = e.tailX - e.cx, v = e.tailY - e.cy, y = Math.hypot(_, v), b = h + g * (i.lagBase + i.force * i.lagForce);
|
|
686
|
+
y > b && y > 0 && (e.tailX = e.cx + _ / y * b, e.tailY = e.cy + v / y * b);
|
|
687
|
+
let x = z((o - i.tailOnsetSpeed) / i.tailOnsetRange), S = g * i.tail * x;
|
|
688
|
+
e.tailR += (S - e.tailR) * Math.min(1, Math.max(0, r) * i.tailRamp);
|
|
689
|
+
let C = e.tailR >= i.tailMinRadius, w = e.cx, T = e.cy, E = e.cx, D = e.cy, O = 0, k = 0;
|
|
690
|
+
if (C) {
|
|
691
|
+
e.tailPhase += o * Math.max(0, B(r, 0)) * i.tailPhaseSpeed;
|
|
692
|
+
let t = e.tailR * i.tailWobble, n = -p, a = f, s = Math.sin(e.tailPhase) * t, c = Math.sin(e.tailPhase + i.tailWobblePhase) * -t;
|
|
693
|
+
w = e.cx + _ * i.tailMidpointA + n * s, T = e.cy + v * i.tailMidpointA + a * s, E = e.cx + _ * i.tailMidpointB + n * c, D = e.cy + v * i.tailMidpointB + a * c, O = e.tailR * i.tailMidRadiusA, k = e.tailR * i.tailMidRadiusB;
|
|
342
694
|
}
|
|
343
|
-
let
|
|
344
|
-
cx:
|
|
345
|
-
cy:
|
|
346
|
-
radius:
|
|
347
|
-
midACx:
|
|
348
|
-
midACy:
|
|
349
|
-
midARadius:
|
|
350
|
-
midBCx:
|
|
351
|
-
midBCy:
|
|
352
|
-
midBRadius:
|
|
353
|
-
visible:
|
|
354
|
-
fingerprint:
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
695
|
+
let A = {
|
|
696
|
+
cx: U(e.tailX),
|
|
697
|
+
cy: U(e.tailY),
|
|
698
|
+
radius: C ? U(e.tailR) : 0,
|
|
699
|
+
midACx: U(w),
|
|
700
|
+
midACy: U(T),
|
|
701
|
+
midARadius: C ? U(O) : 0,
|
|
702
|
+
midBCx: U(E),
|
|
703
|
+
midBCy: U(D),
|
|
704
|
+
midBRadius: C ? U(k) : 0,
|
|
705
|
+
visible: C,
|
|
706
|
+
fingerprint: C ? [
|
|
707
|
+
U(e.tailX),
|
|
708
|
+
U(e.tailY),
|
|
709
|
+
U(e.tailR),
|
|
710
|
+
U(w),
|
|
711
|
+
U(T),
|
|
712
|
+
U(E),
|
|
713
|
+
U(D)
|
|
362
714
|
].join(",") : "hidden"
|
|
363
715
|
};
|
|
364
716
|
return {
|
|
365
|
-
path:
|
|
366
|
-
transform: `translate(${
|
|
367
|
-
tail:
|
|
368
|
-
moving: Math.hypot(e.cx - t.cx, e.cy - t.cy) >
|
|
717
|
+
path: R(-n.w / 2, -n.h / 2, n.w, n.h, n.r),
|
|
718
|
+
transform: `translate(${W(e.cx)} ${W(e.cy)}) ` + (o > i.speedThreshold ? `rotate(${W(s * 180 / Math.PI)}) scale(${W(c)} ${W(l)}) ` : "") + `scale(${W(a)})`,
|
|
719
|
+
tail: A,
|
|
720
|
+
moving: Math.hypot(e.cx - t.cx, e.cy - t.cy) > i.settleDistance || o > i.settleSpeed || e.tailR >= i.tailMinRadius
|
|
369
721
|
};
|
|
370
722
|
}
|
|
371
723
|
//#endregion
|
|
372
724
|
//#region src/liquid/evolve.ts
|
|
373
|
-
var
|
|
725
|
+
var J = {
|
|
374
726
|
massStiffness: 320,
|
|
375
727
|
massDamping: 17,
|
|
376
728
|
sizeStiffness: 170,
|
|
@@ -385,41 +737,41 @@ var H = {
|
|
|
385
737
|
anticipation: 90,
|
|
386
738
|
travel: 32
|
|
387
739
|
};
|
|
388
|
-
function
|
|
740
|
+
function Ee(e) {
|
|
389
741
|
return /^var\((--[\w-]+)\)$/.exec(e.trim())?.[1] ?? null;
|
|
390
742
|
}
|
|
391
|
-
function
|
|
743
|
+
function Y(e, t) {
|
|
392
744
|
return e !== void 0 && Number.isFinite(e) ? e : t;
|
|
393
745
|
}
|
|
394
|
-
function
|
|
746
|
+
function X(e, t = 0, n = 1) {
|
|
395
747
|
return Math.min(n, Math.max(t, e));
|
|
396
748
|
}
|
|
397
|
-
function
|
|
398
|
-
let r = e?.ownerDocument.defaultView, i =
|
|
749
|
+
function De(e, t, n) {
|
|
750
|
+
let r = e?.ownerDocument.defaultView, i = Ee(m[t]);
|
|
399
751
|
if (!r || !i) return n;
|
|
400
752
|
let a = Number.parseFloat(r.getComputedStyle(e).getPropertyValue(i));
|
|
401
753
|
return Number.isFinite(a) ? a : n;
|
|
402
754
|
}
|
|
403
|
-
function
|
|
404
|
-
let r = e?.ownerDocument.defaultView, i =
|
|
755
|
+
function Oe(e, t, n) {
|
|
756
|
+
let r = e?.ownerDocument.defaultView, i = Ee(m[t]);
|
|
405
757
|
return !r || !i ? n : r.getComputedStyle(e).getPropertyValue(i).trim() || n;
|
|
406
758
|
}
|
|
407
|
-
function
|
|
408
|
-
let n = (t, n) =>
|
|
409
|
-
massStiffness: Math.max(.001, n("evolveMassStiffness",
|
|
410
|
-
massDamping: Math.max(0, n("evolveMassDamping",
|
|
411
|
-
sizeStiffness: Math.max(.001, n("evolveSizeStiffness",
|
|
412
|
-
sizeDamping: Math.max(0, n("evolveSizeDamping",
|
|
413
|
-
radiusStiffness: Math.max(.001, n("evolveRadiusStiffness",
|
|
414
|
-
radiusDamping: Math.max(0, n("evolveRadiusDamping",
|
|
415
|
-
contentBlur: Math.max(0, n("evolveContentBlur",
|
|
416
|
-
roundness:
|
|
417
|
-
cornerDuration: Math.max(0, n("evolveCornerDuration",
|
|
418
|
-
cornerDelay: Math.max(0, n("evolveCornerDelay",
|
|
419
|
-
cornerEase:
|
|
420
|
-
anticipation: Math.max(0, n("evolveAnticipation",
|
|
421
|
-
travel: Math.max(0, n("evolveTravel",
|
|
422
|
-
}, i = Math.max(.25,
|
|
759
|
+
function ke(e, t) {
|
|
760
|
+
let n = (t, n) => De(e, t, n), r = {
|
|
761
|
+
massStiffness: Math.max(.001, n("evolveMassStiffness", J.massStiffness)),
|
|
762
|
+
massDamping: Math.max(0, n("evolveMassDamping", J.massDamping)),
|
|
763
|
+
sizeStiffness: Math.max(.001, n("evolveSizeStiffness", J.sizeStiffness)),
|
|
764
|
+
sizeDamping: Math.max(0, n("evolveSizeDamping", J.sizeDamping)),
|
|
765
|
+
radiusStiffness: Math.max(.001, n("evolveRadiusStiffness", J.radiusStiffness)),
|
|
766
|
+
radiusDamping: Math.max(0, n("evolveRadiusDamping", J.radiusDamping)),
|
|
767
|
+
contentBlur: Math.max(0, n("evolveContentBlur", J.contentBlur)),
|
|
768
|
+
roundness: X(n("evolveRoundness", J.roundness)),
|
|
769
|
+
cornerDuration: Math.max(0, n("evolveCornerDuration", J.cornerDuration)),
|
|
770
|
+
cornerDelay: Math.max(0, n("evolveCornerDelay", J.cornerDelay)),
|
|
771
|
+
cornerEase: Oe(e, "evolveCornerEase", J.cornerEase),
|
|
772
|
+
anticipation: Math.max(0, n("evolveAnticipation", J.anticipation)),
|
|
773
|
+
travel: Math.max(0, n("evolveTravel", J.travel))
|
|
774
|
+
}, i = Math.max(.25, Y(t?.speed, n("morphSpeed", 1))), a = X(Y(t?.bounce, n("morphBounce", .5))), o = (e) => Math.max(.12, 1 - 1.1 * X(e)), s = o(a) / o(.5);
|
|
423
775
|
return {
|
|
424
776
|
massStiffness: r.massStiffness * i * i,
|
|
425
777
|
massDamping: r.massDamping * i * s,
|
|
@@ -427,7 +779,7 @@ function q(e, t) {
|
|
|
427
779
|
sizeDamping: r.sizeDamping * i * s,
|
|
428
780
|
radiusStiffness: r.radiusStiffness * i * i,
|
|
429
781
|
radiusDamping: r.radiusDamping * i,
|
|
430
|
-
contentBlur: Math.max(0,
|
|
782
|
+
contentBlur: Math.max(0, Y(t?.contentBlur, r.contentBlur)),
|
|
431
783
|
roundness: r.roundness,
|
|
432
784
|
cornerDuration: r.cornerDuration / i,
|
|
433
785
|
cornerDelay: r.cornerDelay,
|
|
@@ -437,14 +789,14 @@ function q(e, t) {
|
|
|
437
789
|
...t?.advanced ?? {}
|
|
438
790
|
};
|
|
439
791
|
}
|
|
440
|
-
function
|
|
441
|
-
return t?.shape === void 0 ?
|
|
792
|
+
function Ae(e, t) {
|
|
793
|
+
return t?.shape === void 0 ? De(e, "morphShape", 1) >= .5 : t.shape;
|
|
442
794
|
}
|
|
443
|
-
function
|
|
444
|
-
let n =
|
|
795
|
+
function je(e, t) {
|
|
796
|
+
let n = ke(e, t), r = Math.max(0, De(e, "contentBlurAreaMultiplier", 3));
|
|
445
797
|
return n.contentBlur * r;
|
|
446
798
|
}
|
|
447
|
-
function
|
|
799
|
+
function Me(e) {
|
|
448
800
|
return {
|
|
449
801
|
cx: e.cx,
|
|
450
802
|
cy: e.cy,
|
|
@@ -469,7 +821,7 @@ function _e(e) {
|
|
|
469
821
|
round01: 0
|
|
470
822
|
};
|
|
471
823
|
}
|
|
472
|
-
function
|
|
824
|
+
function Ne(e, t) {
|
|
473
825
|
e.cx = t.cx, e.cy = t.cy, e.w = t.w, e.h = t.h, e.r = t.r, e.vcx = 0, e.vcy = 0, e.vw = 0, e.vh = 0, e.vr = 0, e.motionEnv = 0, e.tPrev = {
|
|
474
826
|
cx: t.cx,
|
|
475
827
|
cy: t.cy
|
|
@@ -478,18 +830,18 @@ function ve(e, t) {
|
|
|
478
830
|
h: t.h
|
|
479
831
|
}, e.morphActive = !1, e.round01 = 0;
|
|
480
832
|
}
|
|
481
|
-
function
|
|
833
|
+
function Pe(e, t, n, r, i, a) {
|
|
482
834
|
let o = t + (r * (n - e) - i * t) * a;
|
|
483
835
|
return [e + o * a, o];
|
|
484
836
|
}
|
|
485
|
-
function
|
|
486
|
-
let o = Math.max(0,
|
|
487
|
-
for (; s-- > 0;) [l, u] =
|
|
837
|
+
function Fe(e, t, n, r, i, a) {
|
|
838
|
+
let o = Math.max(0, Y(a, 0)), s = Math.max(1, Math.ceil(o * 60)), c = o / s, l = e, u = t;
|
|
839
|
+
for (; s-- > 0;) [l, u] = Pe(l, u, n, r, i, c);
|
|
488
840
|
return [l, u];
|
|
489
841
|
}
|
|
490
|
-
var
|
|
491
|
-
function
|
|
492
|
-
let t =
|
|
842
|
+
var Ie = /* @__PURE__ */ new Map();
|
|
843
|
+
function Le(e) {
|
|
844
|
+
let t = Ie.get(e);
|
|
493
845
|
if (t) return t;
|
|
494
846
|
let n = /cubic-bezier\(([^)]+)\)/.exec(e);
|
|
495
847
|
if (n) {
|
|
@@ -505,14 +857,14 @@ function be(e) {
|
|
|
505
857
|
let s = (n + o) / 2;
|
|
506
858
|
return 3 * s * (1 - s) * (1 - s) * r + 3 * s * s * (1 - s) * a + s ** 3;
|
|
507
859
|
};
|
|
508
|
-
} else t = e === "ease-in-out" ?
|
|
509
|
-
return
|
|
860
|
+
} else t = e === "ease-in-out" ? Le("cubic-bezier(0.42, 0, 0.58, 1)") : (e) => X(e);
|
|
861
|
+
return Ie.set(e, t), t;
|
|
510
862
|
}
|
|
511
|
-
function
|
|
863
|
+
function Re(e) {
|
|
512
864
|
return String(Math.round(e * 1e3) / 1e3);
|
|
513
865
|
}
|
|
514
|
-
function
|
|
515
|
-
let o = Math.max(0,
|
|
866
|
+
function ze(e, t, n, r, i, a) {
|
|
867
|
+
let o = Math.max(0, Y(n, 0)), s = t.cx, c = t.cy;
|
|
516
868
|
e.tPrev ||= {
|
|
517
869
|
cx: s,
|
|
518
870
|
cy: c
|
|
@@ -522,60 +874,161 @@ function Se(e, t, n, r, i, a) {
|
|
|
522
874
|
cx: s,
|
|
523
875
|
cy: c
|
|
524
876
|
};
|
|
525
|
-
let
|
|
526
|
-
|
|
527
|
-
let
|
|
528
|
-
e.lead01 += (+(
|
|
529
|
-
let
|
|
530
|
-
[e.cx, e.vcx] =
|
|
531
|
-
let
|
|
532
|
-
(
|
|
877
|
+
let d = s - e.cx, f = c - e.cy, p = Math.hypot(d, f), m = Math.hypot(e.tvx, e.tvy), h = 0, g = 0;
|
|
878
|
+
m > .001 ? (h = e.tvx / m, g = e.tvy / m) : p > .001 && (h = d / p, g = f / p);
|
|
879
|
+
let _ = Math.max(0, i.anticipation) / 1e3, v = _ > 0 ? 1 - Math.exp(-o / _) : 1;
|
|
880
|
+
e.lead01 += (+(p > .5) - e.lead01) * v;
|
|
881
|
+
let y = Math.min(Math.max(0, i.travel) * e.lead01, p);
|
|
882
|
+
[e.cx, e.vcx] = Fe(e.cx, e.vcx, s + h * y, i.massStiffness, i.massDamping, o), [e.cy, e.vcy] = Fe(e.cy, e.vcy, c + g * y, i.massStiffness, i.massDamping, o), [e.w, e.vw] = Fe(e.w, e.vw, t.w, i.sizeStiffness, i.sizeDamping, o), [e.h, e.vh] = Fe(e.h, e.vh, t.h, i.sizeStiffness, i.sizeDamping, o), [e.r, e.vr] = Fe(e.r, e.vr, t.r, i.radiusStiffness, i.radiusDamping, o);
|
|
883
|
+
let b = e.lastTargetSize;
|
|
884
|
+
(b ? Math.abs(t.w - b.w) + Math.abs(t.h - b.h) : 0) > .5 ? (e.morphActive ||= (e.cornerT0 = r, e.cornerStarted = !0, !0), e.lastTargetMoveT = r) : e.morphActive && r - e.lastTargetMoveT > 150 && r - e.cornerT0 > Math.max(0, i.cornerDelay) + Math.max(1, i.cornerDuration) && (e.morphActive = !1), e.lastTargetSize = {
|
|
533
885
|
w: t.w,
|
|
534
886
|
h: t.h
|
|
535
887
|
};
|
|
536
|
-
let
|
|
537
|
-
if (e.cornerStarted && i.roundness > 0 && r - e.cornerT0 <
|
|
538
|
-
let t =
|
|
539
|
-
|
|
888
|
+
let x = Math.max(0, i.cornerDelay) + Math.max(1, i.cornerDuration), S = 0;
|
|
889
|
+
if (e.cornerStarted && i.roundness > 0 && r - e.cornerT0 < x) {
|
|
890
|
+
let t = X((r - e.cornerT0 - Math.max(0, i.cornerDelay)) / Math.max(1, i.cornerDuration));
|
|
891
|
+
S = X((1 - Le(i.cornerEase)(t)) * i.roundness);
|
|
540
892
|
}
|
|
541
|
-
let
|
|
542
|
-
e.round01 += Math.max(-
|
|
543
|
-
let
|
|
893
|
+
let C = o * 8;
|
|
894
|
+
e.round01 += Math.max(-C, Math.min(C, S - e.round01));
|
|
895
|
+
let w = Math.max(0, e.r);
|
|
544
896
|
if (e.round01 > .001) {
|
|
545
|
-
let n = Math.max(Math.min(e.w, e.h) / 2,
|
|
546
|
-
|
|
897
|
+
let n = Math.max(Math.min(e.w, e.h) / 2, w);
|
|
898
|
+
w += (n - w) * e.round01, w = Math.max(w, t.r);
|
|
547
899
|
}
|
|
548
|
-
let
|
|
549
|
-
e.motionEnv = Math.max(
|
|
550
|
-
let
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
900
|
+
let T = Math.min(1, (Math.hypot(e.vcx, e.vcy) + Math.abs(e.vw) + Math.abs(e.vh)) / 420);
|
|
901
|
+
e.motionEnv = Math.max(T, e.motionEnv - o * 1.9);
|
|
902
|
+
let E = e.motionEnv * e.motionEnv * Math.max(0, i.contentBlur), D = e.cornerStarted && r - e.cornerT0 < x + 80 || Math.abs(S - e.round01) > .004 || e.round01 > .004, O = Math.hypot(e.vcx, e.vcy), k = Math.abs(e.cx - s) < .05 && Math.abs(e.cy - c) < .05 && Math.abs(e.w - t.w) < .05 && Math.abs(e.h - t.h) < .05 && Math.abs(e.r - t.r) < .05 && O < 1 && Math.abs(e.vw) + Math.abs(e.vh) + Math.abs(e.vr) < 1 && e.motionEnv < .01 && !D, A = [
|
|
903
|
+
w,
|
|
904
|
+
w,
|
|
905
|
+
w,
|
|
906
|
+
w
|
|
555
907
|
];
|
|
556
908
|
return {
|
|
557
|
-
path:
|
|
558
|
-
transform: `translate(${
|
|
559
|
-
contentBlur:
|
|
560
|
-
moving: !
|
|
909
|
+
path: be(-e.w / 2, -e.h / 2, e.w, e.h, A, a),
|
|
910
|
+
transform: `translate(${Re(e.cx)} ${Re(e.cy)}) scale(${Re(t.scale)} ${Re(t.scaleY ?? t.scale)})`,
|
|
911
|
+
contentBlur: E,
|
|
912
|
+
moving: !k
|
|
561
913
|
};
|
|
562
914
|
}
|
|
563
915
|
//#endregion
|
|
916
|
+
//#region src/liquid/spring.ts
|
|
917
|
+
var Be = {
|
|
918
|
+
snappy: {
|
|
919
|
+
stiffness: 480,
|
|
920
|
+
damping: 34,
|
|
921
|
+
mass: 1
|
|
922
|
+
},
|
|
923
|
+
smooth: {
|
|
924
|
+
stiffness: 190,
|
|
925
|
+
damping: 26,
|
|
926
|
+
mass: 1
|
|
927
|
+
},
|
|
928
|
+
bouncy: {
|
|
929
|
+
stiffness: 320,
|
|
930
|
+
damping: 17,
|
|
931
|
+
mass: 1
|
|
932
|
+
},
|
|
933
|
+
wobbly: {
|
|
934
|
+
stiffness: 400,
|
|
935
|
+
damping: 9.6,
|
|
936
|
+
mass: 1
|
|
937
|
+
}
|
|
938
|
+
}, Ve = 1 / 240;
|
|
939
|
+
function He(e) {
|
|
940
|
+
let t = 0, n = 0, r = 0, i = -1, a = 0, o = [0];
|
|
941
|
+
for (; r < 10;) {
|
|
942
|
+
let s = (-e.stiffness * (t - 1) - e.damping * n) / e.mass;
|
|
943
|
+
if (n += s * Ve, t += n * Ve, r += Ve, o.push(t), t > a && (a = t), Math.abs(t - 1) < .001 && Math.abs(n) < .02) {
|
|
944
|
+
if (i < 0 && (i = r), r - i >= .064) break;
|
|
945
|
+
} else i = -1;
|
|
946
|
+
}
|
|
947
|
+
let s = i > 0 ? i : r, c = Math.round(Math.min(120, Math.max(24, s * 90))), l = Math.min(o.length - 1, s / Ve), u = [];
|
|
948
|
+
for (let e = 0; e <= c; e += 1) {
|
|
949
|
+
let t = Math.min(o.length - 1, Math.round(e / c * l));
|
|
950
|
+
u.push(Math.round((o[t] ?? 1) * 1e4) / 1e4);
|
|
951
|
+
}
|
|
952
|
+
return u[u.length - 1] = 1, {
|
|
953
|
+
duration: s,
|
|
954
|
+
values: u,
|
|
955
|
+
overshoots: a > 1.001
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
var Ue = null;
|
|
959
|
+
function We() {
|
|
960
|
+
return Ue === null && (Ue = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("transition-timing-function", "linear(0, 1)")), Ue;
|
|
961
|
+
}
|
|
962
|
+
var Ge = /* @__PURE__ */ new Map(), Ke = /* @__PURE__ */ new Map();
|
|
963
|
+
function Z(e) {
|
|
964
|
+
let t = Ke.get(e);
|
|
965
|
+
if (t) return t;
|
|
966
|
+
let n = /^linear\(([^)]+)\)$/.exec(e.trim()), r = /^cubic-bezier\(([^)]+)\)$/.exec(e.trim()), i;
|
|
967
|
+
if (n) {
|
|
968
|
+
let e = (n[1] ?? "").split(",").map(Number);
|
|
969
|
+
i = (t) => {
|
|
970
|
+
if (t <= 0) return e[0] ?? 0;
|
|
971
|
+
if (t >= 1) return e[e.length - 1] ?? 1;
|
|
972
|
+
let n = t * (e.length - 1), r = Math.floor(n), i = e[r] ?? 0;
|
|
973
|
+
return i + ((e[r + 1] ?? i) - i) * (n - r);
|
|
974
|
+
};
|
|
975
|
+
} else if (r) {
|
|
976
|
+
let [e = 0, t = 0, n = 1, a = 1] = (r[1] ?? "").split(",").map(Number);
|
|
977
|
+
i = (r) => {
|
|
978
|
+
if (r <= 0) return 0;
|
|
979
|
+
if (r >= 1) return 1;
|
|
980
|
+
let i = 0, o = 1;
|
|
981
|
+
for (let t = 0; t < 24; t += 1) {
|
|
982
|
+
let t = (i + o) / 2;
|
|
983
|
+
3 * t * (1 - t) * (1 - t) * e + 3 * t * t * (1 - t) * n + t ** 3 < r ? i = t : o = t;
|
|
984
|
+
}
|
|
985
|
+
let s = (i + o) / 2;
|
|
986
|
+
return 3 * s * (1 - s) * (1 - s) * t + 3 * s * s * (1 - s) * a + s ** 3;
|
|
987
|
+
};
|
|
988
|
+
} else i = e === "ease" ? Z("cubic-bezier(0.25, 0.1, 0.25, 1)") : e === "ease-in" ? Z("cubic-bezier(0.42, 0, 1, 1)") : e === "ease-out" ? Z("cubic-bezier(0, 0, 0.58, 1)") : e === "ease-in-out" ? Z("cubic-bezier(0.42, 0, 0.58, 1)") : (e) => Math.min(1, Math.max(0, e));
|
|
989
|
+
return Ke.set(e, i), i;
|
|
990
|
+
}
|
|
991
|
+
function qe(e, t = !1) {
|
|
992
|
+
if (t) return {
|
|
993
|
+
duration: 0,
|
|
994
|
+
easing: "linear"
|
|
995
|
+
};
|
|
996
|
+
let n = e ?? "smooth";
|
|
997
|
+
if (typeof n == "object" && "duration" in n) return {
|
|
998
|
+
duration: Math.max(0, n.duration),
|
|
999
|
+
easing: n.ease ?? "cubic-bezier(0.22, 1, 0.36, 1)"
|
|
1000
|
+
};
|
|
1001
|
+
let r = typeof n == "string" ? Be[n] : {
|
|
1002
|
+
stiffness: 300,
|
|
1003
|
+
damping: 24,
|
|
1004
|
+
mass: 1,
|
|
1005
|
+
...n
|
|
1006
|
+
}, i = `${r.stiffness}/${r.damping}/${r.mass}/${We()}`, a = Ge.get(i);
|
|
1007
|
+
if (!a) {
|
|
1008
|
+
let e = He(r);
|
|
1009
|
+
a = {
|
|
1010
|
+
duration: Math.round(e.duration * 1e3),
|
|
1011
|
+
easing: We() ? `linear(${e.values.join(", ")})` : e.overshoots ? "cubic-bezier(0.34, 1.56, 0.64, 1)" : "cubic-bezier(0.22, 1, 0.36, 1)"
|
|
1012
|
+
}, Ge.set(i, a);
|
|
1013
|
+
}
|
|
1014
|
+
return a;
|
|
1015
|
+
}
|
|
1016
|
+
//#endregion
|
|
564
1017
|
//#region src/liquid/engine.ts
|
|
565
|
-
function
|
|
1018
|
+
function Je(e, t) {
|
|
566
1019
|
return e !== void 0 && Number.isFinite(e) ? e : t;
|
|
567
1020
|
}
|
|
568
|
-
function
|
|
1021
|
+
function Ye(e) {
|
|
569
1022
|
let t = {
|
|
570
1023
|
observe: e.observe ?? !1,
|
|
571
|
-
x:
|
|
572
|
-
y:
|
|
573
|
-
scale: Math.max(.01,
|
|
574
|
-
scaleY: Math.max(.01,
|
|
1024
|
+
x: Je(e.x, 0),
|
|
1025
|
+
y: Je(e.y, 0),
|
|
1026
|
+
scale: Math.max(.01, Je(e.scale, 1)),
|
|
1027
|
+
scaleY: Math.max(.01, Je(e.scaleY ?? e.scale, 1))
|
|
575
1028
|
};
|
|
576
|
-
return e.effect !== void 0 && (t.effect = e.effect), e.morph !== void 0 && (t.morph = e.morph), e.deformation !== void 0 && (t.deformation = e.deformation), e.transition !== void 0 && (t.transition = e.transition), e.delay !== void 0 && (t.delay = Math.max(0,
|
|
1029
|
+
return e.effect !== void 0 && (t.effect = e.effect), e.morph !== void 0 && (t.morph = e.morph), e.deformation !== void 0 && (t.deformation = e.deformation), e.transition !== void 0 && (t.transition = e.transition), e.delay !== void 0 && (t.delay = Math.max(0, Je(e.delay, 0))), e.radius !== void 0 && (t.radius = e.radius), e.blob !== void 0 && (t.blob = e.blob), t;
|
|
577
1030
|
}
|
|
578
|
-
function
|
|
1031
|
+
function Xe(e) {
|
|
579
1032
|
return {
|
|
580
1033
|
x: e.x,
|
|
581
1034
|
y: e.y,
|
|
@@ -583,22 +1036,22 @@ function we(e) {
|
|
|
583
1036
|
scaleY: e.scaleY
|
|
584
1037
|
};
|
|
585
1038
|
}
|
|
586
|
-
function
|
|
1039
|
+
function Ze(e, t) {
|
|
587
1040
|
return e.x === t.x && e.y === t.y && e.scale === t.scale && e.scaleY === t.scaleY;
|
|
588
1041
|
}
|
|
589
|
-
function
|
|
590
|
-
return e.effect === t.effect && e.observe === t.observe && JSON.stringify(e.morph) === JSON.stringify(t.morph) && e.deformation === t.deformation && JSON.stringify(e.transition) === JSON.stringify(t.transition) && e.delay === t.delay &&
|
|
1042
|
+
function Qe(e, t) {
|
|
1043
|
+
return e.effect === t.effect && e.observe === t.observe && JSON.stringify(e.morph) === JSON.stringify(t.morph) && e.deformation === t.deformation && JSON.stringify(e.transition) === JSON.stringify(t.transition) && e.delay === t.delay && $e(e.radius) === $e(t.radius);
|
|
591
1044
|
}
|
|
592
|
-
function
|
|
1045
|
+
function $e(e) {
|
|
593
1046
|
return e === void 0 ? "" : JSON.stringify(e);
|
|
594
1047
|
}
|
|
595
|
-
function
|
|
1048
|
+
function et(e, t) {
|
|
596
1049
|
return !!(e && Math.abs(e.x - t.x) < .01 && Math.abs(e.y - t.y) < .01 && Math.abs(e.w - t.w) < .01 && Math.abs(e.h - t.h) < .01 && e.r.every((e, n) => Math.abs(e - (t.r[n] ?? 0)) < .01));
|
|
597
1050
|
}
|
|
598
1051
|
function Q(e) {
|
|
599
1052
|
return String(Math.round(e * 1e3) / 1e3);
|
|
600
1053
|
}
|
|
601
|
-
var
|
|
1054
|
+
var tt = class {
|
|
602
1055
|
getGroup;
|
|
603
1056
|
getFilterArea;
|
|
604
1057
|
onModeChange;
|
|
@@ -628,11 +1081,11 @@ var ke = class {
|
|
|
628
1081
|
}
|
|
629
1082
|
register(e) {
|
|
630
1083
|
this.revive(), this.unregister(e.id);
|
|
631
|
-
let t =
|
|
1084
|
+
let t = Ye(e.config), n = {
|
|
632
1085
|
...e,
|
|
633
1086
|
config: t,
|
|
634
|
-
target:
|
|
635
|
-
current:
|
|
1087
|
+
target: Xe(t),
|
|
1088
|
+
current: Xe(t),
|
|
636
1089
|
motion: null,
|
|
637
1090
|
lastBox: null,
|
|
638
1091
|
lastPaint: null,
|
|
@@ -652,24 +1105,24 @@ var ke = class {
|
|
|
652
1105
|
update(e, t) {
|
|
653
1106
|
let n = this.items.get(e);
|
|
654
1107
|
if (!n) return;
|
|
655
|
-
let r =
|
|
656
|
-
if (n.config.deformation !== r.deformation && n.config.deformation?.reset(n.host), n.config = r, this.updateFeaturePadding(), !
|
|
657
|
-
|
|
1108
|
+
let r = Ye(t), i = Xe(r), a = !Ze(n.target, i), o = !Qe(n.config, r);
|
|
1109
|
+
if (n.config.deformation !== r.deformation && n.config.deformation?.reset(n.host), n.config = r, this.updateFeaturePadding(), !a) {
|
|
1110
|
+
o && (n.lastPaint = null, this.isDynamic(n) || this.resetDynamicEntry(n), this.isDynamic(n) && !this.reducedMotion && (this.ensureClaim() ? this.setMode("animated") : (this.snapEntry(n), this.resetDynamicEntry(n), this.setMode("static"))), this.touch(), this.wake());
|
|
658
1111
|
return;
|
|
659
1112
|
}
|
|
660
|
-
let
|
|
661
|
-
if (this.advanceEntry(n,
|
|
1113
|
+
let s = this.now();
|
|
1114
|
+
if (this.advanceEntry(n, s), n.target = i, this.reducedMotion) this.snapEntry(n), this.resetMoveEntry(n), this.resetDynamicEntry(n), this.setMode("reduced");
|
|
662
1115
|
else {
|
|
663
|
-
let e =
|
|
1116
|
+
let e = qe(r.transition), t = e.duration > 0;
|
|
664
1117
|
!(t || this.follow || this.isDynamic(n)) || !this.ensureClaim() ? (this.snapEntry(n), this.resetMoveEntry(n), this.resetDynamicEntry(n), this.setMode("static")) : !t || r.observe ? (n.current = { ...i }, n.motion = null, n.host.style.willChange = "", n.lastPaint = null, this.applyHost(n), this.setMode("animated")) : (n.motion = {
|
|
665
1118
|
from: { ...n.current },
|
|
666
1119
|
to: { ...i },
|
|
667
|
-
start:
|
|
1120
|
+
start: s + (r.delay ?? 0),
|
|
668
1121
|
duration: e.duration,
|
|
669
|
-
ease:
|
|
1122
|
+
ease: Z(e.easing)
|
|
670
1123
|
}, n.host.style.willChange = r.observe ? "" : "transform", this.setMode("animated"));
|
|
671
1124
|
}
|
|
672
|
-
this.touch(
|
|
1125
|
+
this.touch(s), this.needsPaint = !0, this.wake();
|
|
673
1126
|
}
|
|
674
1127
|
setReducedMotion(e) {
|
|
675
1128
|
if (this.reducedMotion !== e) {
|
|
@@ -684,7 +1137,7 @@ var ke = class {
|
|
|
684
1137
|
setFilterArea(e) {
|
|
685
1138
|
let t = Number.isFinite(e) ? Math.max(0, e) : Infinity;
|
|
686
1139
|
if (!(Math.abs(t - this.filterArea) < .5)) {
|
|
687
|
-
if (this.filterArea = t, this.claimed && t >
|
|
1140
|
+
if (this.filterArea = t, this.claimed && t > j().maxFilterArea) {
|
|
688
1141
|
for (let e of this.items.values()) this.snapEntry(e), this.resetMoveEntry(e), this.resetDynamicEntry(e);
|
|
689
1142
|
this.releaseClaim(), this.setMode(this.reducedMotion ? "reduced" : "static");
|
|
690
1143
|
}
|
|
@@ -723,25 +1176,25 @@ var ke = class {
|
|
|
723
1176
|
ensureClaim() {
|
|
724
1177
|
if (this.claimed) return !0;
|
|
725
1178
|
let e = this.getFilterArea();
|
|
726
|
-
return Number.isFinite(e) && (this.filterArea = Math.max(0, e)),
|
|
1179
|
+
return Number.isFinite(e) && (this.filterArea = Math.max(0, e)), N(this.filterArea) ? (this.claimed = !0, this.moveOptions = xe(this.getGroup()), !0) : (this.warnBudgetFallback(), !1);
|
|
727
1180
|
}
|
|
728
1181
|
warnBudgetFallback() {
|
|
729
1182
|
if (this.budgetWarningEmitted) return;
|
|
730
1183
|
this.budgetWarningEmitted = !0;
|
|
731
|
-
let e =
|
|
1184
|
+
let e = j(), t = e.activeGroups >= e.maxAnimatedGroups ? "the active-group limit is reached" : "the filter-area limit is exceeded";
|
|
732
1185
|
console.warn(`LiquidGroup: the liquid animation budget is insufficient (${t}); degrading to static rendering for this group.`);
|
|
733
1186
|
}
|
|
734
1187
|
revive() {
|
|
735
1188
|
this.disposed && (this.disposed = !1, this.mutationObserver = null, this.removeListeners.length = 0, this.lastFrameTime = null, this.budgetWarningEmitted = !1);
|
|
736
1189
|
}
|
|
737
1190
|
releaseClaim() {
|
|
738
|
-
this.claimed &&= (
|
|
1191
|
+
this.claimed &&= (P(), !1);
|
|
739
1192
|
}
|
|
740
1193
|
isDeformed(e) {
|
|
741
1194
|
return e.config.deformation !== void 0;
|
|
742
1195
|
}
|
|
743
1196
|
isShape(e) {
|
|
744
|
-
return !this.isDeformed(e) && e.config.morph !== void 0 &&
|
|
1197
|
+
return !this.isDeformed(e) && e.config.morph !== void 0 && Ae(this.getGroup(), e.config.morph);
|
|
745
1198
|
}
|
|
746
1199
|
isDynamic(e) {
|
|
747
1200
|
return this.isDeformed(e) || this.isShape(e);
|
|
@@ -764,7 +1217,7 @@ var ke = class {
|
|
|
764
1217
|
let e = 0;
|
|
765
1218
|
for (let t of this.items.values()) {
|
|
766
1219
|
let n = this.featureBox(t);
|
|
767
|
-
this.isDeformed(t) ? e = Math.max(e, t.config.deformation.padding(this.getGroup(), n)) : this.isShape(t) && (e = Math.max(e,
|
|
1220
|
+
this.isDeformed(t) ? e = Math.max(e, t.config.deformation.padding(this.getGroup(), n)) : this.isShape(t) && (e = Math.max(e, je(this.getGroup(), t.config.morph)));
|
|
768
1221
|
}
|
|
769
1222
|
Math.abs(e - this.featurePadding) < .5 || (this.featurePadding = e, this.onFeaturePaddingChange?.(e));
|
|
770
1223
|
}
|
|
@@ -842,22 +1295,22 @@ var ke = class {
|
|
|
842
1295
|
scaleY: e.current.scaleY
|
|
843
1296
|
};
|
|
844
1297
|
}
|
|
845
|
-
readBox(e,
|
|
846
|
-
let
|
|
1298
|
+
readBox(e, t) {
|
|
1299
|
+
let n = e.host.firstElementChild ?? e.host, r = fe(e.host, t), i = e.host.offsetWidth, a = e.host.offsetHeight;
|
|
847
1300
|
if (e.config.observe) {
|
|
848
|
-
let o =
|
|
849
|
-
o.width > 0 || o.height > 0 ? (
|
|
850
|
-
x: o.left -
|
|
851
|
-
y: o.top -
|
|
852
|
-
},
|
|
1301
|
+
let o = n.getBoundingClientRect(), s = t.getBoundingClientRect();
|
|
1302
|
+
o.width > 0 || o.height > 0 ? (r = {
|
|
1303
|
+
x: o.left - s.left,
|
|
1304
|
+
y: o.top - s.top
|
|
1305
|
+
}, i = o.width || n.offsetWidth, a = o.height || n.offsetHeight) : (r = fe(n, t), i = n.offsetWidth || e.host.offsetWidth, a = n.offsetHeight || e.host.offsetHeight);
|
|
853
1306
|
}
|
|
854
|
-
let
|
|
1307
|
+
let o = e.config.radius === void 0 ? pe(n, i, a) : me(e.config.radius);
|
|
855
1308
|
return {
|
|
856
|
-
x:
|
|
857
|
-
y:
|
|
858
|
-
w:
|
|
859
|
-
h:
|
|
860
|
-
r:
|
|
1309
|
+
x: r.x,
|
|
1310
|
+
y: r.y,
|
|
1311
|
+
w: i,
|
|
1312
|
+
h: a,
|
|
1313
|
+
r: o
|
|
861
1314
|
};
|
|
862
1315
|
}
|
|
863
1316
|
dynamicTarget(e, t) {
|
|
@@ -874,8 +1327,8 @@ var ke = class {
|
|
|
874
1327
|
}
|
|
875
1328
|
paintEvolveEntry(e, t, n, r) {
|
|
876
1329
|
let i = this.dynamicTarget(e, t);
|
|
877
|
-
e.evolve ||=
|
|
878
|
-
let a =
|
|
1330
|
+
e.evolve ||= Me(i), (this.reducedMotion || !this.claimed && !r) && Ne(e.evolve, i);
|
|
1331
|
+
let a = ke(this.getGroup(), e.config.morph), o = ze(e.evolve, i, this.reducedMotion || !this.claimed && !r ? 0 : n, this.now(), a, e.config.blob), s = `${o.path}|${o.transform}`, c = !1;
|
|
879
1332
|
return e.lastPaint !== s && (e.lastPaint = s, e.blob.setAttribute("d", o.path), e.blob.setAttribute("transform", o.transform), c = !0), this.hideTail(e), this.writeContentBlur(e, o.contentBlur), {
|
|
880
1333
|
changed: c,
|
|
881
1334
|
moving: !this.reducedMotion && this.claimed && o.moving
|
|
@@ -897,15 +1350,15 @@ var ke = class {
|
|
|
897
1350
|
}
|
|
898
1351
|
paintFollowEntry(e, t, n, r, i) {
|
|
899
1352
|
let a = this.moveTarget(e, t);
|
|
900
|
-
!i && r && !this.reducedMotion && !this.claimed && (this.ensureClaim() ? this.setMode("animated") : (this.resetMoveEntry(e), e.move =
|
|
901
|
-
let o = this.moveOptions ??=
|
|
1353
|
+
!i && r && !this.reducedMotion && !this.claimed && (this.ensureClaim() ? this.setMode("animated") : (this.resetMoveEntry(e), e.move = Ce(a))), e.move ||= Ce(a), this.reducedMotion && we(e.move, a);
|
|
1354
|
+
let o = this.moveOptions ??= xe(this.getGroup()), s = Te(e.move, a, t, this.reducedMotion ? 0 : n, o), c = `${s.path}|${s.transform}`, l = !1;
|
|
902
1355
|
return e.lastPaint !== c && (e.lastPaint = c, e.blob.setAttribute("d", s.path), e.blob.setAttribute("transform", s.transform), l = !0), this.paintTail(e, s.tail) && (l = !0), {
|
|
903
1356
|
changed: l,
|
|
904
1357
|
moving: !this.reducedMotion && s.moving && this.claimed
|
|
905
1358
|
};
|
|
906
1359
|
}
|
|
907
1360
|
paintEntry(e, t) {
|
|
908
|
-
let n = t.x + e.current.x + t.w * (1 - e.current.scale) / 2, r = t.y + e.current.y + t.h * (1 - e.current.scaleY) / 2, i = `translate(${Q(n)} ${Q(r)}) scale(${Q(e.current.scale)} ${Q(e.current.scaleY)})`, a =
|
|
1361
|
+
let n = t.x + e.current.x + t.w * (1 - e.current.scale) / 2, r = t.y + e.current.y + t.h * (1 - e.current.scaleY) / 2, i = `translate(${Q(n)} ${Q(r)}) scale(${Q(e.current.scale)} ${Q(e.current.scaleY)})`, a = be(0, 0, t.w, t.h, t.r, e.config.blob), o = `${a}|${i}`;
|
|
909
1362
|
return e.lastPaint === o ? !1 : (e.lastPaint = o, e.blob.setAttribute("d", a), e.blob.setAttribute("transform", i), !0);
|
|
910
1363
|
}
|
|
911
1364
|
loop = (e) => {
|
|
@@ -924,7 +1377,7 @@ var ke = class {
|
|
|
924
1377
|
for (let t of this.items.values()) {
|
|
925
1378
|
let n = e.get(t.id);
|
|
926
1379
|
if (!n) continue;
|
|
927
|
-
let r = t.lastBox === null, s = !
|
|
1380
|
+
let r = t.lastBox === null, s = !et(t.lastBox, n);
|
|
928
1381
|
r && a.add(t.id), s && o.add(t.id), s && (t.lastBox = n, t.lastPaint = null, i = !0);
|
|
929
1382
|
}
|
|
930
1383
|
this.updateFeaturePadding();
|
|
@@ -991,19 +1444,35 @@ var ke = class {
|
|
|
991
1444
|
}
|
|
992
1445
|
};
|
|
993
1446
|
//#endregion
|
|
1447
|
+
//#region src/tokens/reducedMotion.ts
|
|
1448
|
+
function nt() {
|
|
1449
|
+
return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
1450
|
+
}
|
|
1451
|
+
function rt(e, t) {
|
|
1452
|
+
let n = e;
|
|
1453
|
+
return typeof e.addEventListener == "function" ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : typeof n.addListener == "function" ? (n.addListener(t), () => n.removeListener?.(t)) : () => {};
|
|
1454
|
+
}
|
|
1455
|
+
function it() {
|
|
1456
|
+
let [e, t] = l(() => nt()?.matches ?? !1);
|
|
1457
|
+
return i(() => {
|
|
1458
|
+
let e = nt();
|
|
1459
|
+
if (e) return t(e.matches), rt(e, (e) => t(e.matches));
|
|
1460
|
+
}, []), e;
|
|
1461
|
+
}
|
|
1462
|
+
//#endregion
|
|
994
1463
|
//#region src/liquid/shadow.ts
|
|
995
|
-
function
|
|
1464
|
+
function at(e, t) {
|
|
996
1465
|
let n = [], r = 0, i = "";
|
|
997
1466
|
for (let a of e) a === "(" ? r += 1 : a === ")" && --r, r === 0 && (t === "," ? a === "," : /\s/.test(a)) ? (i.trim() && n.push(i.trim()), i = "") : i += a;
|
|
998
1467
|
return i.trim() && n.push(i.trim()), n;
|
|
999
1468
|
}
|
|
1000
|
-
var
|
|
1001
|
-
function
|
|
1469
|
+
var ot = /^[+-]?(\d+\.?\d*|\.\d+)(px)?$/;
|
|
1470
|
+
function st(e) {
|
|
1002
1471
|
if (!e || e.trim() === "" || e.trim() === "none") return [];
|
|
1003
1472
|
let t = [];
|
|
1004
|
-
for (let n of
|
|
1005
|
-
let e =
|
|
1006
|
-
for (let t of e) t !== "inset" && (i.length < 4 &&
|
|
1473
|
+
for (let n of at(e, ",")) {
|
|
1474
|
+
let e = at(n, " "), r = e.includes("inset"), i = [], a = [];
|
|
1475
|
+
for (let t of e) t !== "inset" && (i.length < 4 && ot.test(t) ? i.push(parseFloat(t)) : a.push(t));
|
|
1007
1476
|
let [o = 0, s = 0, c = 0, l = 0] = i;
|
|
1008
1477
|
t.push({
|
|
1009
1478
|
x: o,
|
|
@@ -1016,55 +1485,55 @@ function Me(e) {
|
|
|
1016
1485
|
}
|
|
1017
1486
|
return t;
|
|
1018
1487
|
}
|
|
1019
|
-
function
|
|
1488
|
+
function ct(e) {
|
|
1020
1489
|
if (!e || e.trim() === "" || e.trim() === "none") return null;
|
|
1021
|
-
let t =
|
|
1022
|
-
for (let e of t) e !== "solid" && (n === 0 &&
|
|
1490
|
+
let t = at(e, " "), n = 0, r = [];
|
|
1491
|
+
for (let e of t) e !== "solid" && (n === 0 && ot.test(e) ? n = parseFloat(e) : r.push(e));
|
|
1023
1492
|
return {
|
|
1024
1493
|
width: n,
|
|
1025
1494
|
color: r.join(" ") || "var(--game-ui-stroke, transparent)"
|
|
1026
1495
|
};
|
|
1027
1496
|
}
|
|
1028
|
-
function
|
|
1497
|
+
function lt(e) {
|
|
1029
1498
|
return !e.inset && e.spread === 0 && (e.blur > 0 || e.x !== 0 || e.y !== 0);
|
|
1030
1499
|
}
|
|
1031
|
-
function
|
|
1032
|
-
let t = e.filter(
|
|
1500
|
+
function ut(e) {
|
|
1501
|
+
let t = e.filter(lt).map((e) => `drop-shadow(${e.x}px ${e.y}px ${e.blur}px ${e.color})`);
|
|
1033
1502
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1034
1503
|
}
|
|
1035
|
-
function
|
|
1036
|
-
return e.filter((e) => !
|
|
1504
|
+
function dt(e) {
|
|
1505
|
+
return e.filter((e) => !lt(e));
|
|
1037
1506
|
}
|
|
1038
|
-
function
|
|
1507
|
+
function ft(e) {
|
|
1039
1508
|
return e.reduce((e, t) => Math.max(e, Math.max(Math.abs(t.x), Math.abs(t.y)) + t.blur * 1.5 + Math.max(0, t.spread)), 0);
|
|
1040
1509
|
}
|
|
1041
1510
|
//#endregion
|
|
1042
1511
|
//#region src/liquid/LiquidGroup/resolve.ts
|
|
1043
|
-
function
|
|
1512
|
+
function pt(e) {
|
|
1044
1513
|
return e.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
1045
1514
|
}
|
|
1046
1515
|
function $(e, t) {
|
|
1047
1516
|
return Number.isFinite(e) ? e : t;
|
|
1048
1517
|
}
|
|
1049
|
-
function
|
|
1518
|
+
function mt(e, t) {
|
|
1050
1519
|
if (!e) return e;
|
|
1051
1520
|
let n = /^var\((--[\w-]+)\)$/.exec(e.trim());
|
|
1052
1521
|
if (!n || !t) return e;
|
|
1053
1522
|
let r = t.ownerDocument.defaultView;
|
|
1054
1523
|
return r && r.getComputedStyle(t).getPropertyValue(n[1] ?? "").trim() || e;
|
|
1055
1524
|
}
|
|
1056
|
-
function
|
|
1057
|
-
let r =
|
|
1525
|
+
function ht(e, t, n) {
|
|
1526
|
+
let r = mt(e, t), i = Number.parseFloat(r ?? "");
|
|
1058
1527
|
return Number.isFinite(i) ? i : n;
|
|
1059
1528
|
}
|
|
1060
|
-
function
|
|
1529
|
+
function gt(...e) {
|
|
1061
1530
|
return e.filter(Boolean).join(" ") || void 0;
|
|
1062
1531
|
}
|
|
1063
1532
|
//#endregion
|
|
1064
1533
|
//#region src/liquid/LiquidGroup/fill.tsx
|
|
1065
|
-
function
|
|
1534
|
+
function _t({ id: e, fill: t }) {
|
|
1066
1535
|
let n = t.bottom ?? t.top, r = Math.round(Math.min(1, Math.max(0, t.sheen ?? .3)) * 100);
|
|
1067
|
-
return /* @__PURE__ */
|
|
1536
|
+
return /* @__PURE__ */ d("defs", { children: /* @__PURE__ */ d("linearGradient", {
|
|
1068
1537
|
id: e,
|
|
1069
1538
|
x1: "0",
|
|
1070
1539
|
y1: "0",
|
|
@@ -1075,7 +1544,7 @@ function He({ id: e, fill: t }) {
|
|
|
1075
1544
|
[.16, `color-mix(in srgb, ${t.top}, white ${Math.round(r / 2)}%)`],
|
|
1076
1545
|
[.5, `color-mix(in srgb, ${t.top}, ${n})`],
|
|
1077
1546
|
[1, `color-mix(in srgb, ${n}, black 5%)`]
|
|
1078
|
-
].map(([e, t]) => /* @__PURE__ */
|
|
1547
|
+
].map(([e, t]) => /* @__PURE__ */ d("stop", {
|
|
1079
1548
|
offset: e,
|
|
1080
1549
|
style: { stopColor: t }
|
|
1081
1550
|
}, e))
|
|
@@ -1083,209 +1552,209 @@ function He({ id: e, fill: t }) {
|
|
|
1083
1552
|
}
|
|
1084
1553
|
//#endregion
|
|
1085
1554
|
//#region src/liquid/LiquidGroup/context.ts
|
|
1086
|
-
var
|
|
1087
|
-
function
|
|
1088
|
-
let e =
|
|
1555
|
+
var vt = e(null);
|
|
1556
|
+
function yt() {
|
|
1557
|
+
let e = r(vt);
|
|
1089
1558
|
if (!e) throw Error("<LiquidGroup.Item> must be rendered inside <LiquidGroup>.");
|
|
1090
1559
|
return e;
|
|
1091
1560
|
}
|
|
1092
1561
|
//#endregion
|
|
1093
1562
|
//#region src/liquid/LiquidGroup/LiquidItem.tsx
|
|
1094
|
-
var
|
|
1095
|
-
let { portal:
|
|
1096
|
-
let
|
|
1097
|
-
...
|
|
1098
|
-
...
|
|
1099
|
-
...
|
|
1100
|
-
...
|
|
1101
|
-
x: $(
|
|
1102
|
-
y: $(
|
|
1103
|
-
scale: $(
|
|
1104
|
-
...
|
|
1563
|
+
var bt = t(function({ effect: e, suppressMorph: t = !1, x: r = 0, y: l = 0, scale: m = 1, scaleY: h, transition: g, delay: _, radius: v, blob: y, morph: b, deformation: x, observe: S, className: C, style: w, children: T, ...E }, D) {
|
|
1564
|
+
let { portal: O, engine: k, follow: A } = yt(), j = `liquid-item-${pt(a())}`, M = c(null), N = c(null), P = c(null), ee = s(() => {
|
|
1565
|
+
let n = e === "morph" ? e : void 0, i = x !== void 0, a = x !== void 0 || A && b === void 0 && e !== "morph" || t && b === void 0 && e !== "morph" ? void 0 : b ?? {}, o = {
|
|
1566
|
+
...n === void 0 ? {} : { effect: n },
|
|
1567
|
+
...a === void 0 ? {} : { morph: a },
|
|
1568
|
+
...x === void 0 ? {} : { deformation: x },
|
|
1569
|
+
...S === void 0 && !i ? {} : { observe: i || S },
|
|
1570
|
+
x: $(r, 0),
|
|
1571
|
+
y: $(l, 0),
|
|
1572
|
+
scale: $(m, 1),
|
|
1573
|
+
...h === void 0 ? {} : { scaleY: $(h, 1) }
|
|
1105
1574
|
};
|
|
1106
|
-
return
|
|
1575
|
+
return g !== void 0 && (o.transition = g), _ !== void 0 && (o.delay = _), v !== void 0 && (o.radius = v), y !== void 0 && (o.blob = y), o;
|
|
1107
1576
|
}, [
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1577
|
+
x,
|
|
1578
|
+
y,
|
|
1579
|
+
_,
|
|
1111
1580
|
e,
|
|
1112
1581
|
A,
|
|
1113
1582
|
t,
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1583
|
+
b,
|
|
1584
|
+
S,
|
|
1585
|
+
v,
|
|
1586
|
+
m,
|
|
1587
|
+
h,
|
|
1588
|
+
g,
|
|
1589
|
+
r,
|
|
1590
|
+
l
|
|
1122
1591
|
]);
|
|
1123
|
-
|
|
1124
|
-
let te =
|
|
1125
|
-
M.current = e, typeof
|
|
1126
|
-
}, [
|
|
1127
|
-
return
|
|
1128
|
-
let e = M.current, t =
|
|
1129
|
-
if (!(!
|
|
1592
|
+
P.current === null && (P.current = ee);
|
|
1593
|
+
let te = n((e) => {
|
|
1594
|
+
M.current = e, typeof D == "function" ? D(e) : D && (D.current = e);
|
|
1595
|
+
}, [D]);
|
|
1596
|
+
return o(() => {
|
|
1597
|
+
let e = M.current, t = N.current;
|
|
1598
|
+
if (!(!O || !e || !t || !P.current)) return k.register({
|
|
1130
1599
|
id: j,
|
|
1131
1600
|
host: e,
|
|
1132
1601
|
blob: t,
|
|
1133
|
-
config:
|
|
1602
|
+
config: P.current
|
|
1134
1603
|
});
|
|
1135
1604
|
}, [
|
|
1136
1605
|
k,
|
|
1137
1606
|
j,
|
|
1138
|
-
|
|
1139
|
-
]),
|
|
1140
|
-
k.update(j,
|
|
1607
|
+
O
|
|
1608
|
+
]), o(() => {
|
|
1609
|
+
k.update(j, ee);
|
|
1141
1610
|
}, [
|
|
1142
|
-
|
|
1611
|
+
ee,
|
|
1143
1612
|
k,
|
|
1144
1613
|
j
|
|
1145
|
-
]),
|
|
1614
|
+
]), i(() => {
|
|
1146
1615
|
e === "move" && console.warn("[swimmer-ui] effect=\"move\" is not an item effect. Use <LiquidGroup motion=\"follow\"> for selection and progress.");
|
|
1147
|
-
}, [e]),
|
|
1616
|
+
}, [e]), o(() => {
|
|
1148
1617
|
let e = M.current;
|
|
1149
1618
|
if (!e) return;
|
|
1150
1619
|
let t = e.firstElementChild;
|
|
1151
1620
|
if (!t) return;
|
|
1152
1621
|
let n = window.getComputedStyle(t), r = n.borderStyle !== "none" && n.borderWidth !== "0px" && n.borderWidth !== "", i = n.outlineStyle !== "none" && n.outlineWidth !== "0px" && n.outlineWidth !== "", a = n.boxShadow && n.boxShadow !== "none";
|
|
1153
1622
|
(r || i || a) && console.warn("LiquidGroup.Item children should not have their own border, outline, or box-shadow. They exist on the content layer and will not merge with the liquid silhouette. Use the `stroke` and `shadow` props on <LiquidGroup> instead.");
|
|
1154
|
-
}, []), /* @__PURE__ */
|
|
1155
|
-
...
|
|
1623
|
+
}, []), /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
|
|
1624
|
+
...E,
|
|
1156
1625
|
ref: te,
|
|
1157
|
-
className:
|
|
1158
|
-
style:
|
|
1159
|
-
children:
|
|
1160
|
-
}),
|
|
1161
|
-
ref:
|
|
1626
|
+
className: gt("game-ui-liquid-item", C),
|
|
1627
|
+
style: w,
|
|
1628
|
+
children: T
|
|
1629
|
+
}), O ? p(/* @__PURE__ */ d("path", {
|
|
1630
|
+
ref: N,
|
|
1162
1631
|
d: "",
|
|
1163
1632
|
"data-liquid-gooey-blob": ""
|
|
1164
|
-
}),
|
|
1165
|
-
}),
|
|
1166
|
-
return /* @__PURE__ */
|
|
1633
|
+
}), O) : null] });
|
|
1634
|
+
}), xt = t(function(e, t) {
|
|
1635
|
+
return /* @__PURE__ */ d(bt, {
|
|
1167
1636
|
...e,
|
|
1168
1637
|
ref: t
|
|
1169
1638
|
});
|
|
1170
|
-
}),
|
|
1171
|
-
let
|
|
1639
|
+
}), St = t(function({ blur: e = 6, contrast: t = 18, gloss: r, fill: u = "var(--game-ui-surface, var(--game-ui-surface))", filterPadding: p = 24, shadow: h, stroke: g, waviness: _, wavinessFreq: v, wavinessClamp: y, motion: b = "auto", className: x, style: S, children: C, auxiliary: w, ...T }, D) {
|
|
1640
|
+
let O = c(null), [k, A] = l(null), [j, M] = l({
|
|
1172
1641
|
w: 0,
|
|
1173
1642
|
h: 0
|
|
1174
|
-
}), [
|
|
1175
|
-
waviness:
|
|
1176
|
-
wavinessFreq:
|
|
1177
|
-
}), [
|
|
1178
|
-
|
|
1179
|
-
let
|
|
1180
|
-
|
|
1181
|
-
let
|
|
1182
|
-
|
|
1183
|
-
}, [
|
|
1184
|
-
|
|
1185
|
-
let e =
|
|
1643
|
+
}), [N, P] = l({
|
|
1644
|
+
waviness: L.waviness,
|
|
1645
|
+
wavinessFreq: L.wavinessFreq
|
|
1646
|
+
}), [te, ne] = l(0), F = c(0), re = it(), I = b === "reduced" || re, [ie, ae] = l(I ? "reduced" : "static"), oe = Math.max(0, $(e, 6)), se = Math.max(1, $(t, 18)), ce = Math.max(0, $(p, 24)), fe = Math.max(0, $(_ ?? N.waviness, L.waviness)), pe = y !== !1 && Math.max(0, $(y ?? .3, ue)), me = de(fe, j.w > 0 && j.h > 0 ? Math.min(j.w, j.h) : 0, pe), R = Math.max(0, $(v ?? N.wavinessFreq, L.wavinessFreq)), he = mt(h, O.current), ge = mt(g, O.current), _e = s(() => st(he), [he]), ve = s(() => dt(_e), [_e]), ye = s(() => ut(_e), [_e]), be = s(() => ct(ge), [ge]), z = Math.ceil(oe * 3 + ce + ft(ve) + (be ? be.width : 0) + me), B = c(z);
|
|
1647
|
+
B.current = z;
|
|
1648
|
+
let V = Math.ceil(z + te), H = c(V);
|
|
1649
|
+
H.current = V;
|
|
1650
|
+
let U = `liquid-gooey-${pt(a())}`, W = n((e) => {
|
|
1651
|
+
O.current = e, typeof D == "function" ? D(e) : D && (D.current = e);
|
|
1652
|
+
}, [D]), G = n((e) => A(e), []);
|
|
1653
|
+
o(() => {
|
|
1654
|
+
let e = O.current;
|
|
1186
1655
|
if (!e) return;
|
|
1187
1656
|
let t = {
|
|
1188
|
-
waviness: Math.max(0,
|
|
1189
|
-
wavinessFreq: Math.max(0,
|
|
1657
|
+
waviness: Math.max(0, _ === void 0 ? ht(m.waviness, e, L.waviness) : $(_, L.waviness)),
|
|
1658
|
+
wavinessFreq: Math.max(0, v === void 0 ? ht(m.wavinessFreq, e, L.wavinessFreq) : $(v, L.wavinessFreq))
|
|
1190
1659
|
};
|
|
1191
|
-
|
|
1192
|
-
}, [
|
|
1193
|
-
let
|
|
1194
|
-
getGroup: () =>
|
|
1660
|
+
P((e) => e.waviness === t.waviness && e.wavinessFreq === t.wavinessFreq ? e : t);
|
|
1661
|
+
}, [_, v]);
|
|
1662
|
+
let K = s(() => new tt({
|
|
1663
|
+
getGroup: () => O.current,
|
|
1195
1664
|
getFilterArea: () => {
|
|
1196
|
-
let e =
|
|
1197
|
-
return e ? (e.offsetWidth + (
|
|
1665
|
+
let e = O.current;
|
|
1666
|
+
return e ? (e.offsetWidth + (B.current + F.current) * 2) * (e.offsetHeight + (B.current + F.current) * 2) : 0;
|
|
1198
1667
|
},
|
|
1199
|
-
onModeChange:
|
|
1668
|
+
onModeChange: ae,
|
|
1200
1669
|
onFeaturePaddingChange: (e) => {
|
|
1201
|
-
F.current = e,
|
|
1670
|
+
F.current = e, ne((t) => Math.abs(t - e) < .5 ? t : e);
|
|
1202
1671
|
},
|
|
1203
|
-
follow:
|
|
1204
|
-
}), [
|
|
1205
|
-
|
|
1206
|
-
let e =
|
|
1672
|
+
follow: b === "follow"
|
|
1673
|
+
}), [b]);
|
|
1674
|
+
o(() => {
|
|
1675
|
+
let e = O.current;
|
|
1207
1676
|
if (!e) return;
|
|
1208
1677
|
let t = () => {
|
|
1209
1678
|
let t = {
|
|
1210
1679
|
w: e.offsetWidth,
|
|
1211
1680
|
h: e.offsetHeight
|
|
1212
1681
|
};
|
|
1213
|
-
|
|
1682
|
+
M((e) => e.w === t.w && e.h === t.h ? e : t), K.setFilterArea((t.w + H.current * 2) * (t.h + H.current * 2));
|
|
1214
1683
|
};
|
|
1215
1684
|
if (t(), typeof ResizeObserver > "u") return;
|
|
1216
1685
|
let n = new ResizeObserver(t);
|
|
1217
1686
|
return n.observe(e), () => n.disconnect();
|
|
1218
|
-
}, [
|
|
1219
|
-
|
|
1220
|
-
}, [
|
|
1221
|
-
let
|
|
1222
|
-
return /* @__PURE__ */
|
|
1223
|
-
...
|
|
1224
|
-
ref:
|
|
1225
|
-
className:
|
|
1226
|
-
"data-liquid-filter-area": Math.round((
|
|
1227
|
-
"data-liquid-filter-budget":
|
|
1228
|
-
"data-liquid-feature-padding": Math.round(
|
|
1229
|
-
"data-liquid-motion":
|
|
1230
|
-
"data-liquid-waviness": Math.round(
|
|
1231
|
-
style:
|
|
1687
|
+
}, [K, V]), i(() => {
|
|
1688
|
+
K.setReducedMotion(I);
|
|
1689
|
+
}, [K, I]), i(() => () => K.dispose(), [K]);
|
|
1690
|
+
let xe = Math.max(1, j.w), Se = Math.max(1, j.h), q = gt("game-ui-liquid-group", x);
|
|
1691
|
+
return /* @__PURE__ */ f("div", {
|
|
1692
|
+
...T,
|
|
1693
|
+
ref: W,
|
|
1694
|
+
className: q,
|
|
1695
|
+
"data-liquid-filter-area": Math.round((j.w + V * 2) * (j.h + V * 2)),
|
|
1696
|
+
"data-liquid-filter-budget": E,
|
|
1697
|
+
"data-liquid-feature-padding": Math.round(te * 10) / 10,
|
|
1698
|
+
"data-liquid-motion": ie,
|
|
1699
|
+
"data-liquid-waviness": Math.round(me * 100) / 100,
|
|
1700
|
+
style: S,
|
|
1232
1701
|
children: [
|
|
1233
|
-
/* @__PURE__ */
|
|
1702
|
+
/* @__PURE__ */ f("svg", {
|
|
1234
1703
|
"aria-hidden": "true",
|
|
1235
1704
|
className: "game-ui-liquid-silhouette",
|
|
1236
1705
|
"data-liquid-gooey-silhouette": "",
|
|
1237
1706
|
focusable: "false",
|
|
1238
|
-
style:
|
|
1239
|
-
viewBox: `0 0 ${
|
|
1707
|
+
style: ye ? { filter: ye } : void 0,
|
|
1708
|
+
viewBox: `0 0 ${xe} ${Se}`,
|
|
1240
1709
|
children: [
|
|
1241
|
-
/* @__PURE__ */
|
|
1710
|
+
/* @__PURE__ */ d("defs", { children: /* @__PURE__ */ d("filter", {
|
|
1242
1711
|
colorInterpolationFilters: "sRGB",
|
|
1243
1712
|
filterUnits: "userSpaceOnUse",
|
|
1244
|
-
height:
|
|
1245
|
-
id:
|
|
1246
|
-
width:
|
|
1247
|
-
x: -
|
|
1248
|
-
y: -
|
|
1249
|
-
children: /* @__PURE__ */
|
|
1250
|
-
blur:
|
|
1251
|
-
contrast:
|
|
1252
|
-
gloss:
|
|
1253
|
-
shadows:
|
|
1254
|
-
stroke:
|
|
1255
|
-
waviness:
|
|
1256
|
-
wavinessFreq:
|
|
1713
|
+
height: Se + V * 2,
|
|
1714
|
+
id: U,
|
|
1715
|
+
width: xe + V * 2,
|
|
1716
|
+
x: -V,
|
|
1717
|
+
y: -V,
|
|
1718
|
+
children: /* @__PURE__ */ d(le, {
|
|
1719
|
+
blur: oe,
|
|
1720
|
+
contrast: se,
|
|
1721
|
+
gloss: r ?? ee.gloss,
|
|
1722
|
+
shadows: ve,
|
|
1723
|
+
stroke: be,
|
|
1724
|
+
waviness: me,
|
|
1725
|
+
wavinessFreq: R
|
|
1257
1726
|
})
|
|
1258
1727
|
}) }),
|
|
1259
|
-
typeof
|
|
1260
|
-
id: `${
|
|
1261
|
-
fill:
|
|
1728
|
+
typeof u == "string" ? null : /* @__PURE__ */ d(_t, {
|
|
1729
|
+
id: `${U}-fill`,
|
|
1730
|
+
fill: u
|
|
1262
1731
|
}),
|
|
1263
|
-
/* @__PURE__ */
|
|
1264
|
-
ref:
|
|
1265
|
-
fill: typeof
|
|
1266
|
-
filter: `url(#${
|
|
1732
|
+
/* @__PURE__ */ d("g", {
|
|
1733
|
+
ref: G,
|
|
1734
|
+
fill: typeof u == "string" ? u : `url(#${U}-fill)`,
|
|
1735
|
+
filter: `url(#${U})`
|
|
1267
1736
|
})
|
|
1268
1737
|
]
|
|
1269
1738
|
}),
|
|
1270
|
-
|
|
1271
|
-
/* @__PURE__ */
|
|
1739
|
+
w?.(() => O.current),
|
|
1740
|
+
/* @__PURE__ */ d(vt.Provider, {
|
|
1272
1741
|
value: {
|
|
1273
|
-
portal:
|
|
1274
|
-
engine:
|
|
1275
|
-
follow:
|
|
1742
|
+
portal: k,
|
|
1743
|
+
engine: K,
|
|
1744
|
+
follow: b === "follow"
|
|
1276
1745
|
},
|
|
1277
|
-
children: /* @__PURE__ */
|
|
1746
|
+
children: /* @__PURE__ */ d("div", {
|
|
1278
1747
|
className: "game-ui-liquid-content",
|
|
1279
|
-
children:
|
|
1748
|
+
children: C
|
|
1280
1749
|
})
|
|
1281
1750
|
})
|
|
1282
1751
|
]
|
|
1283
1752
|
});
|
|
1284
|
-
}),
|
|
1285
|
-
return /* @__PURE__ */
|
|
1753
|
+
}), Ct = Object.assign(t(function(e, t) {
|
|
1754
|
+
return /* @__PURE__ */ d(St, {
|
|
1286
1755
|
...e,
|
|
1287
1756
|
ref: t
|
|
1288
1757
|
});
|
|
1289
|
-
}), { Item:
|
|
1758
|
+
}), { Item: xt });
|
|
1290
1759
|
//#endregion
|
|
1291
|
-
export {
|
|
1760
|
+
export { y as A, N as C, m as D, C as E, _ as F, g as M, v as N, S as O, w as P, M as S, x as T, I as _, it as a, j as b, z as c, H as d, ve as f, le as g, F as h, st as i, b as j, h as k, B as l, R as m, St as n, Z as o, ye as p, bt as r, qe as s, Ct as t, W as u, ee as v, T as w, P as x, te as y };
|