@pieai/swimmer-ui-kit 2.10.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 +45 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +2328 -1938
- package/dist/liquid-presence.css +1 -1
- package/dist/liquid-presence.js +257 -184
- package/dist/{reducedMotion-C7O9ls34.js → liquidGooeySpring-WwyGKGPL.js} +83 -83
- package/dist/styles.css +1 -1
- package/donors-individual-lock.json +1 -1
- package/donors-individual.md +2 -2
- package/package.json +3 -3
package/dist/liquid-presence.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e,
|
|
1
|
+
import { _ as e, g as t, m as n, p as r, r as i, s as a, t as o, u as s } from "./liquidGooeySpring-WwyGKGPL.js";
|
|
2
2
|
import { useEffect as c, useId as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
|
|
3
3
|
import { createPortal as p } from "react-dom";
|
|
4
4
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
@@ -232,34 +232,34 @@ var V = (e, t, n) => {
|
|
|
232
232
|
let r = String(n);
|
|
233
233
|
e.getAttribute(t) !== r && e.setAttribute(t, r);
|
|
234
234
|
};
|
|
235
|
-
function
|
|
235
|
+
function re(e, t, n) {
|
|
236
236
|
let r = e.overlay.getBoundingClientRect(), i = r.width / (e.overlay.clientWidth || r.width || 1) || 1, a = r.height / (e.overlay.clientHeight || r.height || 1) || 1;
|
|
237
237
|
return {
|
|
238
238
|
x: (t - r.x) / i,
|
|
239
239
|
y: (n - r.y) / a
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function ie(e, t, n, r, i = 0, a = 1, o = !1, s = 0) {
|
|
243
243
|
V(e.source, "data-liquid-phase", t.phase), V(e.overlay, "data-liquid-phase", t.phase), V(e.body, "d", M(r, i, t.separation, a, s));
|
|
244
244
|
let c = t.bud ? Math.sin(t.separation * Math.PI) * .045 : 0;
|
|
245
245
|
V(e.body, "transform", `translate(${((t.bud?.x ?? 80) - 80) * c} ${((t.bud?.y ?? 80) - 80) * c})`), B(e.bud, !!t.bud), t.bud && (V(e.bud, "cx", t.bud.x), V(e.bud, "cy", t.bud.y), V(e.bud, "r", t.bud.radius));
|
|
246
246
|
let l = t.phase === "flight" || t.phase === "return";
|
|
247
247
|
B(e.flight, l);
|
|
248
|
-
let u =
|
|
248
|
+
let u = re(e, t.point.x, t.point.y);
|
|
249
249
|
if (l) {
|
|
250
250
|
let n = t.diameter / 32;
|
|
251
251
|
e.flight.style.transform = `translate(${u.x - 48}px, ${u.y - 36}px)`, V(e.flightBody, "transform", `rotate(${t.angle}) scale(${n * t.stretch} ${n / Math.sqrt(t.stretch)})`), V(e.trail, "opacity", Math.min(.8, (t.stretch - 1) * 3));
|
|
252
252
|
}
|
|
253
253
|
B(e.seat, t.seat !== null), t.seat !== null && (e.seat.style.transform = `translate(${u.x - 56}px, ${u.y - 28}px)`, V(e.seatBody, "d", N(t.seatWidth ?? n, t.seat, t.diameter))), B(e.label, o || t.phase !== "gather" && t.seat !== null && t.seat > .45);
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function ae(e, t, n, r) {
|
|
256
256
|
e.satellites.forEach((e, i) => {
|
|
257
257
|
if (B(e, n), !n) return;
|
|
258
258
|
let a = t * .7 + i * Math.PI * 2 / 3, o = 63 + Math.max(0, Math.sin(t * 1.6 + i * 2)) * (16 + r * 12);
|
|
259
259
|
V(e, "cx", 80 + Math.cos(a) * o), V(e, "cy", 80 + Math.sin(a) * o), V(e, "r", 7 + i * 1.5);
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function H() {
|
|
263
263
|
let e = window.visualViewport;
|
|
264
264
|
return {
|
|
265
265
|
x: e?.offsetLeft ?? 0,
|
|
@@ -270,23 +270,23 @@ function U() {
|
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/liquidPresenceTracking.ts
|
|
273
|
-
function
|
|
273
|
+
function oe(e) {
|
|
274
274
|
try {
|
|
275
275
|
let t = e.contextElement;
|
|
276
276
|
if (t && t.ownerDocument !== document || t && (!t.isConnected || t.closest("[hidden], [inert]")) || t && getComputedStyle(t).visibility === "hidden") return null;
|
|
277
277
|
let n = document.querySelector("dialog:modal");
|
|
278
278
|
if (n && (!t || !n.contains(t))) return null;
|
|
279
279
|
let r = e.getRect();
|
|
280
|
-
return E(r) && D(r,
|
|
280
|
+
return E(r) && D(r, H()) ? r : null;
|
|
281
281
|
} catch {
|
|
282
282
|
return null;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function se(e, t, n, r) {
|
|
286
286
|
let i = t.contextElement, a = {
|
|
287
287
|
...i ? { contextElement: i } : {},
|
|
288
288
|
getBoundingClientRect: () => {
|
|
289
|
-
let e =
|
|
289
|
+
let e = oe(t) ?? {
|
|
290
290
|
x: 0,
|
|
291
291
|
y: 0,
|
|
292
292
|
width: 0,
|
|
@@ -343,20 +343,72 @@ function oe(e, t, n, r) {
|
|
|
343
343
|
};
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
|
+
//#region src/liquidPanelObstacles.ts
|
|
347
|
+
var U = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new Set();
|
|
348
|
+
function G(e, t) {
|
|
349
|
+
let n = U.get(e), r = t && E(t) ? {
|
|
350
|
+
x: t.x,
|
|
351
|
+
y: t.y,
|
|
352
|
+
width: t.width,
|
|
353
|
+
height: t.height
|
|
354
|
+
} : null;
|
|
355
|
+
if (!(!n && !r || n && r && n.x === r.x && n.y === r.y && n.width === r.width && n.height === r.height)) {
|
|
356
|
+
r ? U.set(e, r) : U.delete(e);
|
|
357
|
+
for (let e of [...W]) try {
|
|
358
|
+
e();
|
|
359
|
+
} catch {}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function ce(e) {
|
|
363
|
+
return [...U].filter(([t]) => t.isConnected && !t.contains(e) && !e.contains(t)).map(([, e]) => e);
|
|
364
|
+
}
|
|
365
|
+
function le(e) {
|
|
366
|
+
return W.add(e), () => {
|
|
367
|
+
W.delete(e);
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function ue(e, t, n, r) {
|
|
371
|
+
let { width: i, height: a } = t;
|
|
372
|
+
if (!Number.isFinite(i + a) || i <= 0 || a <= 0) return null;
|
|
373
|
+
let o = n.x + 12, s = n.y + 12, c = n.x + n.width - i - 12, l = n.y + n.height - a - 12;
|
|
374
|
+
if (c < o || l < s) return null;
|
|
375
|
+
let u = r.filter(E), d = [
|
|
376
|
+
e.x,
|
|
377
|
+
o,
|
|
378
|
+
c
|
|
379
|
+
], f = [
|
|
380
|
+
e.y,
|
|
381
|
+
s,
|
|
382
|
+
l
|
|
383
|
+
];
|
|
384
|
+
for (let e of u) d.push(e.x - i - 8, e.x + e.width + 8), f.push(e.y - a - 8, e.y + e.height + 8);
|
|
385
|
+
let p = null, m = Infinity;
|
|
386
|
+
for (let t of d) for (let n of f) {
|
|
387
|
+
let r = Math.min(c, Math.max(o, t)), d = Math.min(l, Math.max(s, n));
|
|
388
|
+
if (u.some((e) => r < e.x + e.width + 8 && r + i > e.x - 8 && d < e.y + e.height + 8 && d + a > e.y - 8)) continue;
|
|
389
|
+
let f = (r - e.x) ** 2 + (d - e.y) ** 2;
|
|
390
|
+
f < m && (p = {
|
|
391
|
+
x: r,
|
|
392
|
+
y: d
|
|
393
|
+
}, m = f);
|
|
394
|
+
}
|
|
395
|
+
return p;
|
|
396
|
+
}
|
|
397
|
+
//#endregion
|
|
346
398
|
//#region src/useLiquidPresenceMotion.ts
|
|
347
|
-
function
|
|
348
|
-
let s = d(
|
|
349
|
-
s.current =
|
|
350
|
-
let l = !!
|
|
399
|
+
function K(e, i, a, o) {
|
|
400
|
+
let s = d(a);
|
|
401
|
+
s.current = a;
|
|
402
|
+
let l = !!a.guideContent, u = d(null), f = d(null), p = d(null), m = d(0), h = d(+(a.idleMotion === "breathe")), g = d(() => {});
|
|
351
403
|
c(() => {
|
|
352
|
-
let
|
|
353
|
-
if (!
|
|
404
|
+
let a = e.current, o = i.current;
|
|
405
|
+
if (!a || !o) return;
|
|
354
406
|
let c = {
|
|
355
|
-
source:
|
|
407
|
+
source: a,
|
|
356
408
|
overlay: o,
|
|
357
|
-
body:
|
|
358
|
-
bud:
|
|
359
|
-
satellites: [...
|
|
409
|
+
body: a.querySelector("[data-presence-body]"),
|
|
410
|
+
bud: a.querySelector("[data-presence-bud]"),
|
|
411
|
+
satellites: [...a.querySelectorAll("[data-presence-satellite]")],
|
|
360
412
|
flight: o.querySelector(".game-ui-liquid-presence-flight"),
|
|
361
413
|
flightBody: o.querySelector("[data-presence-flight-body]"),
|
|
362
414
|
trail: o.querySelector("[data-presence-trail]"),
|
|
@@ -371,36 +423,36 @@ function W(t, n, i, o) {
|
|
|
371
423
|
"land",
|
|
372
424
|
"gather",
|
|
373
425
|
"return"
|
|
374
|
-
].includes(d.phase) ? d.point : void 0, x = d?.point ?? O(
|
|
375
|
-
I &&
|
|
376
|
-
},
|
|
426
|
+
].includes(d.phase) ? d.point : void 0, x = d?.point ?? O(a.getBoundingClientRect()), E = d?.seatWidth ?? 48, k = d ?? void 0, j = a.getBoundingClientRect(), M = performance.now(), N = null, P = () => {}, F = !0, I = !1, L = !1, R = !0, z = 0, V = m.current, re = performance.now(), U = 0, W = 0, G = null, K = () => {}, q, J = () => {
|
|
427
|
+
I && n(), I = !1;
|
|
428
|
+
}, Y = (e) => {
|
|
377
429
|
if (l) {
|
|
378
|
-
f.current = l.key, l = null, _ = !!(u.current && u.current.phase !== "still"), k = u.current ?? void 0, v = u.current?.point, x = v ?? x, M = performance.now(),
|
|
430
|
+
f.current = l.key, l = null, _ = !!(u.current && u.current.phase !== "still"), k = u.current ?? void 0, v = u.current?.point, x = v ?? x, M = performance.now(), K(), clearTimeout(q), W++, B(c.label, !1);
|
|
379
431
|
try {
|
|
380
432
|
s.current.onDismiss?.(e);
|
|
381
433
|
} catch {}
|
|
382
434
|
$();
|
|
383
435
|
}
|
|
384
|
-
},
|
|
436
|
+
}, X = () => {
|
|
385
437
|
if (!l) return null;
|
|
386
438
|
let e = c.label.style.pointerEvents;
|
|
387
439
|
s.current.guideContent && (c.label.style.pointerEvents = "none");
|
|
388
440
|
try {
|
|
389
|
-
return
|
|
441
|
+
return oe(s.current.target?.key === l.key ? s.current.target : l);
|
|
390
442
|
} finally {
|
|
391
443
|
c.label.style.pointerEvents = e;
|
|
392
444
|
}
|
|
393
445
|
}, Z = () => {
|
|
394
446
|
if (!l) return;
|
|
395
|
-
let e =
|
|
447
|
+
let e = X();
|
|
396
448
|
if (!e) {
|
|
397
|
-
|
|
449
|
+
Y("unavailable");
|
|
398
450
|
return;
|
|
399
451
|
}
|
|
400
|
-
let t = ee(e,
|
|
452
|
+
let t = ee(e, H()), n = A(e, H()), r = (e) => T(e === "top" ? n.y - 10 : n.y + n.height + 10, H().y + 18, H().y + H().height - 18);
|
|
401
453
|
x = {
|
|
402
454
|
x: t.x,
|
|
403
|
-
y: r(
|
|
455
|
+
y: r(G ?? t.side)
|
|
404
456
|
}, E = t.width;
|
|
405
457
|
let i = {
|
|
406
458
|
...l.contextElement ? { contextElement: l.contextElement } : {},
|
|
@@ -411,15 +463,15 @@ function W(t, n, i, o) {
|
|
|
411
463
|
bottom: n.y + n.height,
|
|
412
464
|
right: n.x + n.width
|
|
413
465
|
})
|
|
414
|
-
}, a = ++
|
|
466
|
+
}, a = ++W, o = s.current.guideSize === "expanded";
|
|
415
467
|
o || (c.label.style.maxHeight = ""), s.current.guideContent && !c.label.style.transform && (c.label.style.visibility = "hidden", B(c.label, !0)), y(i, c.label, {
|
|
416
468
|
strategy: "absolute",
|
|
417
|
-
placement: o &&
|
|
469
|
+
placement: o && H().width >= 900 ? "right" : t.side,
|
|
418
470
|
middleware: [
|
|
419
471
|
S(26),
|
|
420
472
|
b({
|
|
421
473
|
padding: 16,
|
|
422
|
-
...o &&
|
|
474
|
+
...o && H().width >= 900 ? { fallbackPlacements: [
|
|
423
475
|
"left",
|
|
424
476
|
"bottom",
|
|
425
477
|
"top"
|
|
@@ -432,18 +484,33 @@ function W(t, n, i, o) {
|
|
|
432
484
|
...o ? [w({
|
|
433
485
|
padding: 16,
|
|
434
486
|
apply({ availableHeight: e, elements: t }) {
|
|
435
|
-
let n = `${Math.max(0, Math.min(560,
|
|
487
|
+
let n = `${Math.max(0, Math.min(560, H().height * .65, e))}px`;
|
|
436
488
|
t.floating.style.maxHeight !== n && (t.floating.style.maxHeight = n);
|
|
437
489
|
}
|
|
438
490
|
})] : []
|
|
439
491
|
]
|
|
440
|
-
}).then(({ x: e, y:
|
|
441
|
-
if (F && a ===
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
492
|
+
}).then(({ x: e, y: i, placement: o }) => {
|
|
493
|
+
if (F && a === W) {
|
|
494
|
+
let a = ce(c.label);
|
|
495
|
+
if (a.length && c.label.offsetWidth && c.label.offsetHeight) {
|
|
496
|
+
let t = ue({
|
|
497
|
+
x: e,
|
|
498
|
+
y: i
|
|
499
|
+
}, {
|
|
500
|
+
width: c.label.offsetWidth,
|
|
501
|
+
height: c.label.offsetHeight
|
|
502
|
+
}, H(), [...a, n]);
|
|
503
|
+
if (!t) {
|
|
504
|
+
c.label.style.visibility = "hidden";
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
e = t.x, i = t.y;
|
|
508
|
+
}
|
|
509
|
+
c.label.style.transform = `translate(${e}px, ${i}px)`, c.label.style.visibility = "", G = o.startsWith("top") ? "top" : o.startsWith("bottom") ? "bottom" : t.side;
|
|
510
|
+
let s = r(G);
|
|
511
|
+
x.y !== s && (x = {
|
|
445
512
|
x: t.x,
|
|
446
|
-
y:
|
|
513
|
+
y: s
|
|
447
514
|
}, $());
|
|
448
515
|
}
|
|
449
516
|
}).catch(() => {});
|
|
@@ -453,31 +520,31 @@ function W(t, n, i, o) {
|
|
|
453
520
|
"thinking",
|
|
454
521
|
"speaking",
|
|
455
522
|
"working"
|
|
456
|
-
].includes(s.current.activity ?? "idle"),
|
|
457
|
-
if (L = !1, s.current.reducedMotion || s.current.activity === "disabled" || document.hidden || !R || !D(
|
|
458
|
-
let
|
|
459
|
-
if (
|
|
523
|
+
].includes(s.current.activity ?? "idle"), de = () => s.current.idleMotion === "breathe" && (s.current.activity ?? "idle") === "idle", fe = () => {
|
|
524
|
+
if (L = !1, s.current.reducedMotion || s.current.activity === "disabled" || document.hidden || !R || !D(a.getBoundingClientRect(), H())) return !1;
|
|
525
|
+
let e = document.querySelector("dialog:modal");
|
|
526
|
+
if (e && !e.contains(a)) return !1;
|
|
460
527
|
let n = l?.contextElement?.closest("dialog") ?? null;
|
|
461
|
-
if (l &&
|
|
462
|
-
let
|
|
463
|
-
return o.maxAnimatedGroups === 0 ||
|
|
528
|
+
if (l && a.closest("dialog") !== n) return !1;
|
|
529
|
+
let i = 13184 + (a.getBoundingClientRect().width * 2) ** 2, o = r();
|
|
530
|
+
return o.maxAnimatedGroups === 0 || i > o.maxFilterArea ? (J(), !1) : !(l || _ || Q()) && de() && !I && o.activeGroups > 0 ? (L = !0, !1) : (I ||= t(i), I);
|
|
464
531
|
};
|
|
465
|
-
function
|
|
532
|
+
function pe(e) {
|
|
466
533
|
if (!F || document.hidden) return;
|
|
467
534
|
let t = c.source.getBoundingClientRect();
|
|
468
535
|
if (!c.source.isConnected || c.source.closest("[hidden], [inert]") || t.width <= 0 || t.height <= 0) {
|
|
469
|
-
_ = !1, u.current = null,
|
|
536
|
+
_ = !1, u.current = null, Y("unavailable"), B(c.label, !1), B(c.flight, !1), B(c.seat, !1), J();
|
|
470
537
|
return;
|
|
471
538
|
}
|
|
472
|
-
if (l && !
|
|
473
|
-
|
|
539
|
+
if (l && !X()) {
|
|
540
|
+
Y("unavailable");
|
|
474
541
|
return;
|
|
475
542
|
}
|
|
476
|
-
let n =
|
|
543
|
+
let n = fe(), r = ne({
|
|
477
544
|
elapsed: e - M,
|
|
478
545
|
source: _ ? t : j,
|
|
479
546
|
destination: x,
|
|
480
|
-
viewport:
|
|
547
|
+
viewport: H(),
|
|
481
548
|
returning: _,
|
|
482
549
|
...v ? { from: v } : {},
|
|
483
550
|
...k ? { origin: k } : {}
|
|
@@ -496,87 +563,91 @@ function W(t, n, i, o) {
|
|
|
496
563
|
seat: l ? 1 : null,
|
|
497
564
|
separation: +!!l
|
|
498
565
|
}), _ && r.phase === "still" && (_ = !1), l && r.phase === "dock" && (p.current = l.key);
|
|
499
|
-
let i = !["still", "dock"].includes(r.phase), a = s.current.levelRef?.current, o = !i &&
|
|
500
|
-
|
|
566
|
+
let i = !["still", "dock"].includes(r.phase), a = s.current.levelRef?.current, o = !i && de(), d = Math.max(0, Math.min(160, e - re));
|
|
567
|
+
re = e;
|
|
501
568
|
let f = typeof a == "number" ? T(a, 0, 1) : 0;
|
|
502
|
-
|
|
569
|
+
U += (f - U) * (1 - Math.exp(-d / (f > U ? 65 : 140)));
|
|
503
570
|
let g = T(s.current.motionSpeed ?? 1, .5, 1.5), y = T(s.current.motionIntensity ?? 1, .25, 1.25);
|
|
504
571
|
n && (i || Q() || o) && (V += d * (o ? 84e-5 : .00105) * g), m.current = V, n && (i || Q() || o) && (h.current += (+!!o - h.current) * (1 - Math.exp(-d / 500)));
|
|
505
|
-
let b = n && Q() && !i ? .14 +
|
|
506
|
-
|
|
572
|
+
let b = n && Q() && !i ? .14 + U * .75 : i ? .2 : 0, S = c.label.hasAttribute("hidden");
|
|
573
|
+
ie(c, r, E, V, b, y, !!(s.current.guideContent && l), h.current), ae(c, V, n && s.current.splashes !== !1 && s.current.activity === "speaking" && r.phase === "still", U);
|
|
507
574
|
let C = n && (i || Q()) ? "animated" : n && o ? "ambient" : "static";
|
|
508
575
|
c.source.dataset.liquidMotion !== C && (c.source.dataset.liquidMotion = C), u.current = {
|
|
509
576
|
...r,
|
|
510
577
|
seatWidth: r.phase === "gather" ? k?.seatWidth ?? E : E
|
|
511
|
-
}, l && S && !c.label.hasAttribute("hidden") && Z(), n && (i || Q()) ? N = requestAnimationFrame(
|
|
512
|
-
P = () => {}, F && !document.hidden && R &&
|
|
578
|
+
}, l && S && !c.label.hasAttribute("hidden") && Z(), n && (i || Q()) ? N = requestAnimationFrame(me) : (J(), o && (n || L) && (P = te(() => {
|
|
579
|
+
P = () => {}, F && !document.hidden && R && me(performance.now());
|
|
513
580
|
}, L ? 250 : 1e3 / 12)));
|
|
514
581
|
}
|
|
515
|
-
function
|
|
582
|
+
function me(e) {
|
|
516
583
|
if (N = null, !F || document.hidden) {
|
|
517
|
-
|
|
584
|
+
J();
|
|
518
585
|
return;
|
|
519
586
|
}
|
|
520
587
|
if ((u.current?.phase === "still" || u.current?.phase === "dock") && e - z < 32) {
|
|
521
|
-
N = requestAnimationFrame(
|
|
588
|
+
N = requestAnimationFrame(me);
|
|
522
589
|
return;
|
|
523
590
|
}
|
|
524
|
-
z = e,
|
|
591
|
+
z = e, pe(e);
|
|
525
592
|
}
|
|
526
593
|
function $() {
|
|
527
|
-
!F || N !== null || document.hidden || (P(), P = () => {},
|
|
594
|
+
!F || N !== null || document.hidden || (P(), P = () => {}, pe(performance.now()));
|
|
528
595
|
}
|
|
529
596
|
g.current = $;
|
|
530
|
-
let
|
|
531
|
-
if (
|
|
532
|
-
let e =
|
|
597
|
+
let he = () => {
|
|
598
|
+
if (K(), K = () => {}, !l || document.hidden) return;
|
|
599
|
+
let e = se(c.source, l, c.label, () => {
|
|
533
600
|
Z(), $();
|
|
534
601
|
});
|
|
535
|
-
|
|
602
|
+
K = e, l || e();
|
|
536
603
|
};
|
|
537
|
-
l && (Z(), l && (
|
|
538
|
-
let
|
|
604
|
+
l && (Z(), l && (he(), l && !s.current.guideContent && (q = setTimeout(() => Y("expired"), 12e3))));
|
|
605
|
+
let ge = (e) => {
|
|
539
606
|
if (e.key === "Escape" && !e.isComposing && l) {
|
|
540
607
|
if (s.current.guideContent && e.target instanceof Node && c.label.contains(e.target)) return;
|
|
541
608
|
let t = document.querySelector("dialog:modal");
|
|
542
609
|
if (t && !t.contains(c.label)) return;
|
|
543
|
-
s.current.guideContent && e.preventDefault(),
|
|
610
|
+
s.current.guideContent && e.preventDefault(), Y("dismissed");
|
|
544
611
|
}
|
|
545
|
-
},
|
|
546
|
-
s.current.dismissOnTargetClick !== !1 && l?.contextElement && e.target instanceof Node && l.contextElement.contains(e.target) &&
|
|
547
|
-
},
|
|
548
|
-
document.hidden ? (P(), P = () => {}, N !== null && cancelAnimationFrame(N), N = null,
|
|
549
|
-
},
|
|
550
|
-
R = e[0]?.isIntersecting ?? !0, R || (P(), P = () => {}, N !== null && cancelAnimationFrame(N), N = null,
|
|
612
|
+
}, _e = (e) => {
|
|
613
|
+
s.current.dismissOnTargetClick !== !1 && l?.contextElement && e.target instanceof Node && l.contextElement.contains(e.target) && Y("dismissed");
|
|
614
|
+
}, ve = () => {
|
|
615
|
+
document.hidden ? (P(), P = () => {}, N !== null && cancelAnimationFrame(N), N = null, K(), W++, J()) : (re = performance.now(), he(), $());
|
|
616
|
+
}, ye = typeof IntersectionObserver > "u" ? null : new IntersectionObserver((e) => {
|
|
617
|
+
R = e[0]?.isIntersecting ?? !0, R || (P(), P = () => {}, N !== null && cancelAnimationFrame(N), N = null, J()), $();
|
|
551
618
|
});
|
|
552
|
-
|
|
553
|
-
|
|
619
|
+
ye?.observe(a), document.addEventListener("keydown", ge, !0), document.addEventListener("click", _e), document.addEventListener("visibilitychange", ve), document.addEventListener("close", $, !0), document.addEventListener("toggle", $, !0);
|
|
620
|
+
let be = le(() => {
|
|
621
|
+
Z(), $();
|
|
622
|
+
});
|
|
623
|
+
return $(), () => {
|
|
624
|
+
F = !1, g.current = () => {}, W++, N !== null && cancelAnimationFrame(N), clearTimeout(q), P(), K(), be(), ye?.disconnect(), J(), document.removeEventListener("keydown", ge, !0), document.removeEventListener("click", _e), document.removeEventListener("visibilitychange", ve), document.removeEventListener("close", $, !0), document.removeEventListener("toggle", $, !0);
|
|
554
625
|
};
|
|
555
626
|
}, [
|
|
556
|
-
|
|
557
|
-
|
|
627
|
+
e,
|
|
628
|
+
i,
|
|
558
629
|
o,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
630
|
+
a.target?.key,
|
|
631
|
+
a.reducedMotion,
|
|
632
|
+
a.size,
|
|
633
|
+
a.guideSize,
|
|
563
634
|
l
|
|
564
635
|
]), c(() => g.current(), [
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
636
|
+
a.activity,
|
|
637
|
+
a.idleMotion,
|
|
638
|
+
a.motionSpeed,
|
|
639
|
+
a.motionIntensity,
|
|
640
|
+
a.splashes
|
|
570
641
|
]);
|
|
571
642
|
}
|
|
572
643
|
//#endregion
|
|
573
644
|
//#region src/LiquidPresence.tsx
|
|
574
|
-
function
|
|
575
|
-
let
|
|
645
|
+
function q(t) {
|
|
646
|
+
let n = e() || t.reducedMotion === !0, r = T(t.size ?? 64, 32, 224), i = `presence-${l().replace(/[^a-zA-Z0-9_-]/g, "")}`, a = d(null), o = d(null), [u, _] = f(null);
|
|
576
647
|
c(() => {
|
|
577
|
-
let
|
|
578
|
-
_(
|
|
579
|
-
}, [
|
|
648
|
+
let e = t.target?.contextElement?.closest("dialog");
|
|
649
|
+
_(e ?? a.current?.closest("dialog") ?? document.body);
|
|
650
|
+
}, [t.target?.contextElement]), c(() => {
|
|
580
651
|
let e = a.current, t = o.current;
|
|
581
652
|
if (!e || !t) return;
|
|
582
653
|
let n = [
|
|
@@ -617,17 +688,17 @@ function G(e) {
|
|
|
617
688
|
return r(), window.addEventListener("resize", r, { passive: !0 }), () => {
|
|
618
689
|
i.disconnect(), window.removeEventListener("resize", r);
|
|
619
690
|
};
|
|
620
|
-
}, [u]),
|
|
621
|
-
...
|
|
691
|
+
}, [u]), K(a, o, {
|
|
692
|
+
...t,
|
|
622
693
|
size: r,
|
|
623
|
-
reducedMotion:
|
|
694
|
+
reducedMotion: n
|
|
624
695
|
}, u);
|
|
625
696
|
let v = {
|
|
626
697
|
width: r,
|
|
627
698
|
height: r,
|
|
628
|
-
...
|
|
629
|
-
...
|
|
630
|
-
...["error", "unknown"].includes(
|
|
699
|
+
...t.colorFrom ? { "--liquid-presence-from": t.colorFrom } : {},
|
|
700
|
+
...t.colorTo ? { "--liquid-presence-to": t.colorTo } : {},
|
|
701
|
+
...["error", "unknown"].includes(t.activity ?? "") ? {
|
|
631
702
|
"--liquid-presence-from": "var(--game-ui-warning)",
|
|
632
703
|
"--liquid-presence-to": "var(--game-ui-warning)"
|
|
633
704
|
} : {}
|
|
@@ -650,7 +721,7 @@ function G(e) {
|
|
|
650
721
|
filterUnits: "userSpaceOnUse",
|
|
651
722
|
...t,
|
|
652
723
|
colorInterpolationFilters: "sRGB",
|
|
653
|
-
children: /* @__PURE__ */ h(
|
|
724
|
+
children: /* @__PURE__ */ h(s, {
|
|
654
725
|
blur: e === "core" ? 5 : 2,
|
|
655
726
|
contrast: 18,
|
|
656
727
|
gloss: 3.5,
|
|
@@ -661,9 +732,9 @@ function G(e) {
|
|
|
661
732
|
})] });
|
|
662
733
|
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
663
734
|
ref: a,
|
|
664
|
-
className: `game-ui-liquid-presence ${
|
|
735
|
+
className: `game-ui-liquid-presence ${t.className ?? ""}`,
|
|
665
736
|
style: v,
|
|
666
|
-
"data-activity":
|
|
737
|
+
"data-activity": t.activity ?? "idle",
|
|
667
738
|
"aria-hidden": "true",
|
|
668
739
|
children: /* @__PURE__ */ g("svg", {
|
|
669
740
|
viewBox: "0 0 160 160",
|
|
@@ -762,37 +833,37 @@ function G(e) {
|
|
|
762
833
|
})]
|
|
763
834
|
}),
|
|
764
835
|
/* @__PURE__ */ h("div", {
|
|
765
|
-
className: `game-ui-liquid-presence-label${
|
|
766
|
-
role:
|
|
767
|
-
"aria-atomic": !
|
|
768
|
-
onClick:
|
|
769
|
-
onPointerDown:
|
|
770
|
-
onKeyDown:
|
|
836
|
+
className: `game-ui-liquid-presence-label${t.guideContent ? " game-ui-liquid-presence-label--guide" : ""}${t.guideContent && t.guideSize === "expanded" ? " game-ui-liquid-presence-label--expanded" : ""}`,
|
|
837
|
+
role: t.guideContent ? void 0 : "status",
|
|
838
|
+
"aria-atomic": !t.guideContent || void 0,
|
|
839
|
+
onClick: t.guideContent ? (e) => e.stopPropagation() : void 0,
|
|
840
|
+
onPointerDown: t.guideContent ? (e) => e.stopPropagation() : void 0,
|
|
841
|
+
onKeyDown: t.guideContent ? (e) => {
|
|
771
842
|
e.stopPropagation(), e.key === "Escape" && e.preventDefault();
|
|
772
843
|
} : void 0,
|
|
773
844
|
hidden: !0,
|
|
774
|
-
children:
|
|
845
|
+
children: t.guideContent ?? t.target?.label.slice(0, 240)
|
|
775
846
|
})
|
|
776
847
|
]
|
|
777
848
|
}), u)] });
|
|
778
849
|
}
|
|
779
850
|
//#endregion
|
|
780
851
|
//#region src/liquidRevealGeometry.ts
|
|
781
|
-
function
|
|
782
|
-
let s = Math.max(44, e), c = Math.max(44,
|
|
852
|
+
function J(e, t, n, r = 0, o = 1) {
|
|
853
|
+
let s = Math.max(44, e), c = Math.max(44, t), l = Math.min(28, (s - 12) / 2, (c - 12) / 2), u = i(6, 6, s - 12, c - 12, [
|
|
783
854
|
l,
|
|
784
855
|
l,
|
|
785
856
|
l,
|
|
786
857
|
l
|
|
787
858
|
], {
|
|
788
|
-
amplitude: (
|
|
859
|
+
amplitude: (n ? 8 : 11) * Math.min(1.25, Math.max(.25, Number.isFinite(o) ? o : 1)),
|
|
789
860
|
lobes: 3,
|
|
790
861
|
seed: 17,
|
|
791
|
-
phase:
|
|
862
|
+
phase: r
|
|
792
863
|
}), d = Math.max(0, l - 2.5);
|
|
793
864
|
return {
|
|
794
865
|
outline: u,
|
|
795
|
-
ribbon: `${u} ${
|
|
866
|
+
ribbon: `${u} ${a(8.5, 8.5, s - 17, c - 17, [
|
|
796
867
|
d,
|
|
797
868
|
d,
|
|
798
869
|
d,
|
|
@@ -802,29 +873,29 @@ function K(e, n, r, a = 0, o = 1) {
|
|
|
802
873
|
}
|
|
803
874
|
//#endregion
|
|
804
875
|
//#region src/useLiquidRevealAmbient.ts
|
|
805
|
-
function
|
|
876
|
+
function Y(e, i, a, o, s, l = 1, u = 1) {
|
|
806
877
|
let f = d(0);
|
|
807
878
|
return c(() => {
|
|
808
|
-
let c =
|
|
809
|
-
if (!c || !
|
|
879
|
+
let c = e.current;
|
|
880
|
+
if (!c || !i || !a || !o) {
|
|
810
881
|
c && (c.dataset.revealAmbient = "static");
|
|
811
882
|
return;
|
|
812
883
|
}
|
|
813
|
-
let d = !0, p = !0, m = performance.now(), h = () => {}, g = c.querySelector("[data-reveal-outline]"), _ = c.querySelector("[data-reveal-body]"), v = c.querySelector("[data-reveal-ribbon]"), y = (
|
|
884
|
+
let d = !0, p = !0, m = performance.now(), h = () => {}, g = c.querySelector("[data-reveal-outline]"), _ = c.querySelector("[data-reveal-body]"), v = c.querySelector("[data-reveal-ribbon]"), y = (a + 24) * (o + 24), b = (e) => {
|
|
814
885
|
if (!d || !p || document.hidden) return;
|
|
815
|
-
let
|
|
816
|
-
m =
|
|
817
|
-
let x = document.querySelector("dialog:modal"), S = x && !x.contains(c) || ["drawing", "preparing"].includes(c.dataset.revealMotion ?? ""), C =
|
|
818
|
-
if (S || C.activeGroups > 0 || !
|
|
886
|
+
let i = Math.min(160, Math.max(0, e - m));
|
|
887
|
+
m = e;
|
|
888
|
+
let x = document.querySelector("dialog:modal"), S = x && !x.contains(c) || ["drawing", "preparing"].includes(c.dataset.revealMotion ?? ""), C = r();
|
|
889
|
+
if (S || C.activeGroups > 0 || !t(y)) {
|
|
819
890
|
c.dataset.revealAmbient = "paused", h = te(b, 250);
|
|
820
891
|
return;
|
|
821
892
|
}
|
|
822
893
|
try {
|
|
823
|
-
f.current +=
|
|
824
|
-
let e =
|
|
894
|
+
f.current += i * Math.PI * 2 * u / 1e4;
|
|
895
|
+
let e = J(a, o, s, f.current, l);
|
|
825
896
|
g?.setAttribute("d", e.outline), _?.setAttribute("d", e.outline), v?.setAttribute("d", e.ribbon), c.dataset.revealAmbient = "flowing";
|
|
826
897
|
} finally {
|
|
827
|
-
|
|
898
|
+
n();
|
|
828
899
|
}
|
|
829
900
|
h = te(b);
|
|
830
901
|
}, x = () => {
|
|
@@ -836,9 +907,9 @@ function q(t, n, i, o, s, l = 1, u = 1) {
|
|
|
836
907
|
d = !1, h(), S?.disconnect(), document.removeEventListener("visibilitychange", x), c.dataset.revealAmbient = "static";
|
|
837
908
|
};
|
|
838
909
|
}, [
|
|
839
|
-
|
|
840
|
-
n,
|
|
910
|
+
e,
|
|
841
911
|
i,
|
|
912
|
+
a,
|
|
842
913
|
o,
|
|
843
914
|
s,
|
|
844
915
|
l,
|
|
@@ -847,14 +918,14 @@ function q(t, n, i, o, s, l = 1, u = 1) {
|
|
|
847
918
|
}
|
|
848
919
|
//#endregion
|
|
849
920
|
//#region src/liquidRevealEntranceGeometry.ts
|
|
850
|
-
var
|
|
921
|
+
var X = (e) => {
|
|
851
922
|
let t = Math.min(1, Math.max(0, e));
|
|
852
923
|
return t * t * t * (10 + t * (-15 + 6 * t));
|
|
853
924
|
};
|
|
854
|
-
function
|
|
855
|
-
let c =
|
|
925
|
+
function Z(e, t, n, r, a, o, s = 1) {
|
|
926
|
+
let c = J(e, t, n, 0, s).outline;
|
|
856
927
|
return Array.from({ length: 49 }, (l, u) => {
|
|
857
|
-
let d = u / 48, f =
|
|
928
|
+
let d = u / 48, f = X((d - .08) / .34), p = j(r, a, f, o), m = X((d - .39) / .46), h = X((d - .47) / .46), g = X((d - .3) / .14) * (1 - m), _ = 8 + 20 * X(d / .15) + 10 * g, v = 1 + Math.sin(f * Math.PI) * .35, y = a.x - r.x, b = a.y - r.y, x = Math.abs(y) > Math.abs(b), S = _ * (x ? v : 1 / Math.sqrt(v)), C = _ * (x ? 1 / Math.sqrt(v) : v), w = S + (e - 12 - S) * m, T = C + (t - 12 - C) * h, E = (p.x - S / 2) * (1 - m) + 6 * m, D = (p.y - C / 2) * (1 - h) + 6 * h, O = Math.min(w / 2, T / 2, 28 + 12 * (1 - h));
|
|
858
929
|
return {
|
|
859
930
|
d: `path("${d >= .95 ? c : i(E, D, w, T, [
|
|
860
931
|
O,
|
|
@@ -873,18 +944,18 @@ function Y(e, t, n, r, a, o, s = 1) {
|
|
|
873
944
|
}
|
|
874
945
|
//#endregion
|
|
875
946
|
//#region src/useLiquidRevealEntrance.ts
|
|
876
|
-
function
|
|
947
|
+
function Q(e, r, i, a, o, s, c, l, f = 1) {
|
|
877
948
|
let p = d(null);
|
|
878
949
|
u(() => {
|
|
879
|
-
let u =
|
|
950
|
+
let u = e.current;
|
|
880
951
|
if (!u) return;
|
|
881
|
-
if (!
|
|
952
|
+
if (!r || s || u.contains(document.activeElement) || window.matchMedia("(forced-colors: active)").matches) {
|
|
882
953
|
p.current = i, u.dataset.revealMotion = "static";
|
|
883
954
|
return;
|
|
884
955
|
}
|
|
885
956
|
if (p.current === i || (u.dataset.revealMotion = "preparing", !a || !o)) return;
|
|
886
957
|
let d = !0, m = !1, h = !1, g = 0, _ = 0, v = [], y = () => {
|
|
887
|
-
v.forEach((e) => e.cancel()), v.length = 0, m &&
|
|
958
|
+
v.forEach((e) => e.cancel()), v.length = 0, m && n(), m = !1, u.dataset.revealMotion = h ? "settled" : "static";
|
|
888
959
|
}, b = () => {
|
|
889
960
|
if (!d) return;
|
|
890
961
|
if (getComputedStyle(u).visibility === "hidden") {
|
|
@@ -895,26 +966,26 @@ function X(t, n, i, a, o, s, c, l, f = 1) {
|
|
|
895
966
|
y();
|
|
896
967
|
return;
|
|
897
968
|
}
|
|
898
|
-
let
|
|
899
|
-
if (p.current = i, u.contains(document.activeElement) || !
|
|
969
|
+
let e = r.current?.getBoundingClientRect(), n = u.getBoundingClientRect(), s = u.querySelector("[data-reveal-body]"), x = u.querySelector("[data-reveal-material]"), S = u.querySelector(".game-ui-liquid-reveal-content");
|
|
970
|
+
if (p.current = i, u.contains(document.activeElement) || !e || !E(e) || document.hidden || typeof u.animate != "function" || !t((a + 24) * (o + 24))) {
|
|
900
971
|
y();
|
|
901
972
|
return;
|
|
902
973
|
}
|
|
903
974
|
m = !0, h = !0, u.dataset.revealMotion = "drawing";
|
|
904
|
-
let C =
|
|
905
|
-
x: (
|
|
906
|
-
y: (
|
|
975
|
+
let C = n.width / a || 1, w = n.height / o || 1, T = {
|
|
976
|
+
x: (e.x + e.width / 2 - n.x) / C,
|
|
977
|
+
y: (e.y + e.height / 2 - n.y) / w
|
|
907
978
|
}, D = {
|
|
908
979
|
x: Math.min(a - 28, Math.max(28, T.x)),
|
|
909
980
|
y: T.y > o / 2 ? o - 28 : 28
|
|
910
981
|
}, O = {
|
|
911
|
-
x: -
|
|
912
|
-
y: -
|
|
982
|
+
x: -n.x / C,
|
|
983
|
+
y: -n.y / w,
|
|
913
984
|
width: innerWidth / C,
|
|
914
985
|
height: innerHeight / w
|
|
915
986
|
};
|
|
916
987
|
if (c && s && CSS.supports("d", "path(\"M0 0L1 1Z\")")) {
|
|
917
|
-
let e =
|
|
988
|
+
let e = Z(a, o, l, T, D, O, f);
|
|
918
989
|
v.push(s.animate(e, {
|
|
919
990
|
duration: 720,
|
|
920
991
|
fill: "both",
|
|
@@ -945,7 +1016,7 @@ function X(t, n, i, a, o, s, c, l, f = 1) {
|
|
|
945
1016
|
fill: "both"
|
|
946
1017
|
}));
|
|
947
1018
|
} else x && v.push(x.animate([{ opacity: .2 }, { opacity: 1 }], { duration: 180 }));
|
|
948
|
-
let k =
|
|
1019
|
+
let k = r.current?.querySelector(".game-ui-liquid-presence > svg");
|
|
949
1020
|
k && v.push(k.animate([
|
|
950
1021
|
{ transform: "scale(1)" },
|
|
951
1022
|
{
|
|
@@ -972,8 +1043,8 @@ function X(t, n, i, a, o, s, c, l, f = 1) {
|
|
|
972
1043
|
d = !1, x(), u.removeEventListener("focusin", x), u.removeEventListener("pointerdown", x, !0), document.removeEventListener("visibilitychange", S), window.removeEventListener("resize", x), window.removeEventListener("scroll", x, !0);
|
|
973
1044
|
};
|
|
974
1045
|
}, [
|
|
975
|
-
|
|
976
|
-
|
|
1046
|
+
e,
|
|
1047
|
+
r,
|
|
977
1048
|
i,
|
|
978
1049
|
a,
|
|
979
1050
|
o,
|
|
@@ -985,8 +1056,8 @@ function X(t, n, i, a, o, s, c, l, f = 1) {
|
|
|
985
1056
|
}
|
|
986
1057
|
//#endregion
|
|
987
1058
|
//#region src/LiquidReveal.tsx
|
|
988
|
-
function
|
|
989
|
-
let x =
|
|
1059
|
+
function de({ children: t, source: n, revealKey: i = "initial", variant: a = "content", surface: o = "dark", reducedMotion: c, idleMotion: p = "still", colorFrom: m, colorTo: _, motionIntensity: v = 1, motionSpeed: y = 1, className: b = "" }) {
|
|
1060
|
+
let x = e() || c === !0, S = T(v, .25, 1.25), C = T(y, .5, 1.5), w = d(null), [E, D] = f({
|
|
990
1061
|
width: 0,
|
|
991
1062
|
height: 0
|
|
992
1063
|
}), O = `liquid-reveal-${l().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
@@ -1003,8 +1074,8 @@ function se({ children: e, source: t, revealKey: r = "initial", variant: i = "co
|
|
|
1003
1074
|
t();
|
|
1004
1075
|
let n = new ResizeObserver(t);
|
|
1005
1076
|
return n.observe(e), () => n.disconnect();
|
|
1006
|
-
}, []),
|
|
1007
|
-
let k = Math.max(44, E.width), A = Math.max(44, E.height), ee =
|
|
1077
|
+
}, []), Q(w, n, i, E.width, E.height, x, o === "material", a === "input", S);
|
|
1078
|
+
let k = Math.max(44, E.width), A = Math.max(44, E.height), ee = Y(w, !x && p === "breathe", E.width, E.height, a === "input", S, C), j = J(k, A, a === "input", ee.current, S), M = (k + 24) * (A + 24) <= r().maxFilterArea;
|
|
1008
1079
|
return /* @__PURE__ */ g("div", {
|
|
1009
1080
|
ref: w,
|
|
1010
1081
|
className: `game-ui-liquid-reveal ${b}`,
|
|
@@ -1012,12 +1083,12 @@ function se({ children: e, source: t, revealKey: r = "initial", variant: i = "co
|
|
|
1012
1083
|
...m ? { "--liquid-presence-from": m } : {},
|
|
1013
1084
|
..._ ? { "--liquid-presence-to": _ } : {}
|
|
1014
1085
|
},
|
|
1015
|
-
"data-reveal-variant":
|
|
1086
|
+
"data-reveal-variant": a,
|
|
1016
1087
|
"data-reveal-surface": o,
|
|
1017
1088
|
"data-reveal-filter": M ? "volume" : "flat",
|
|
1018
1089
|
children: [/* @__PURE__ */ h("div", {
|
|
1019
1090
|
className: "game-ui-liquid-reveal-content",
|
|
1020
|
-
children:
|
|
1091
|
+
children: t
|
|
1021
1092
|
}), E.width > 0 && /* @__PURE__ */ g("svg", {
|
|
1022
1093
|
className: "game-ui-liquid-reveal-ink",
|
|
1023
1094
|
width: k,
|
|
@@ -1047,7 +1118,7 @@ function se({ children: e, source: t, revealKey: r = "initial", variant: i = "co
|
|
|
1047
1118
|
height: A + 24,
|
|
1048
1119
|
filterUnits: "userSpaceOnUse",
|
|
1049
1120
|
colorInterpolationFilters: "sRGB",
|
|
1050
|
-
children: /* @__PURE__ */ h(
|
|
1121
|
+
children: /* @__PURE__ */ h(s, {
|
|
1051
1122
|
blur: 1.2,
|
|
1052
1123
|
contrast: 18,
|
|
1053
1124
|
gloss: 3.5,
|
|
@@ -1085,7 +1156,7 @@ function se({ children: e, source: t, revealKey: r = "initial", variant: i = "co
|
|
|
1085
1156
|
}
|
|
1086
1157
|
//#endregion
|
|
1087
1158
|
//#region src/LiquidAnchor.tsx
|
|
1088
|
-
function
|
|
1159
|
+
function fe({ source: e, children: t, placement: n = "top-end", onBoundsChange: r }) {
|
|
1089
1160
|
let [i, a] = f(null), o = d(r);
|
|
1090
1161
|
o.current = r;
|
|
1091
1162
|
let [s, c] = f(null);
|
|
@@ -1094,7 +1165,9 @@ function Z({ source: e, children: t, placement: n = "top-end", onBoundsChange: r
|
|
|
1094
1165
|
}, [e]), u(() => {
|
|
1095
1166
|
let t = e.current, r = i;
|
|
1096
1167
|
if (!t || !r) return;
|
|
1097
|
-
let a =
|
|
1168
|
+
let a = (e) => {
|
|
1169
|
+
G(r, e), o.current?.(e);
|
|
1170
|
+
}, s = !0, c = 0, l = null, u = null, d = () => {
|
|
1098
1171
|
let e = getComputedStyle(t);
|
|
1099
1172
|
for (let t of Array.from(e)) if (t.startsWith("--game-ui-") || t.startsWith("--liquid-presence-")) {
|
|
1100
1173
|
let n = e.getPropertyValue(t);
|
|
@@ -1105,18 +1178,18 @@ function Z({ source: e, children: t, placement: n = "top-end", onBoundsChange: r
|
|
|
1105
1178
|
let e = getComputedStyle(n);
|
|
1106
1179
|
for (let t of ["--liquid-presence-from", "--liquid-presence-to"]) r.style.setProperty(t, e.getPropertyValue(t));
|
|
1107
1180
|
}
|
|
1108
|
-
},
|
|
1109
|
-
let e = ++
|
|
1110
|
-
if (
|
|
1111
|
-
(!
|
|
1112
|
-
}),
|
|
1181
|
+
}, f = () => {
|
|
1182
|
+
let e = ++c, i = t.getBoundingClientRect(), o = document.querySelector("dialog:modal");
|
|
1183
|
+
if (l !== o && (u?.disconnect(), u = null, l = o, o && !o.contains(t) && !r.contains(o) && (u = new MutationObserver(() => {
|
|
1184
|
+
(!o.isConnected || !o.matches(":modal")) && f();
|
|
1185
|
+
}), u.observe(o, {
|
|
1113
1186
|
attributes: !0,
|
|
1114
1187
|
attributeFilter: ["open"]
|
|
1115
|
-
}),
|
|
1188
|
+
}), o.parentNode && u.observe(o.parentNode, { childList: !0 }))), !t.isConnected || t.closest("[hidden], [inert], [aria-hidden=\"true\"]") || typeof t.checkVisibility == "function" && !t.checkVisibility({
|
|
1116
1189
|
opacityProperty: !0,
|
|
1117
1190
|
visibilityProperty: !0
|
|
1118
|
-
}) || i.width <= 0 || i.height <= 0 ||
|
|
1119
|
-
r.style.visibility = "hidden",
|
|
1191
|
+
}) || i.width <= 0 || i.height <= 0 || o && !o.contains(t) && !r.contains(o)) {
|
|
1192
|
+
r.style.visibility = "hidden", a(null);
|
|
1120
1193
|
return;
|
|
1121
1194
|
}
|
|
1122
1195
|
y(t, r, {
|
|
@@ -1138,28 +1211,28 @@ function Z({ source: e, children: t, placement: n = "top-end", onBoundsChange: r
|
|
|
1138
1211
|
x({ strategy: "referenceHidden" })
|
|
1139
1212
|
]
|
|
1140
1213
|
}).then(({ x: t, y: n, middlewareData: i }) => {
|
|
1141
|
-
if (!
|
|
1214
|
+
if (!s || e !== c) return;
|
|
1142
1215
|
if (i.hide?.referenceHidden) {
|
|
1143
|
-
r.style.visibility = "hidden",
|
|
1216
|
+
r.style.visibility = "hidden", a(null);
|
|
1144
1217
|
return;
|
|
1145
1218
|
}
|
|
1146
1219
|
r.style.left = `${t}px`, r.style.top = `${n}px`, r.style.visibility = "visible";
|
|
1147
|
-
let
|
|
1148
|
-
|
|
1149
|
-
x:
|
|
1150
|
-
y:
|
|
1151
|
-
width:
|
|
1152
|
-
height:
|
|
1220
|
+
let o = r.getBoundingClientRect();
|
|
1221
|
+
a({
|
|
1222
|
+
x: o.x,
|
|
1223
|
+
y: o.y,
|
|
1224
|
+
width: o.width,
|
|
1225
|
+
height: o.height
|
|
1153
1226
|
});
|
|
1154
1227
|
}).catch(() => {
|
|
1155
|
-
!
|
|
1228
|
+
!s || e !== c || (r.style.visibility = "hidden", a(null));
|
|
1156
1229
|
});
|
|
1157
1230
|
};
|
|
1158
|
-
|
|
1159
|
-
let
|
|
1160
|
-
|
|
1231
|
+
d();
|
|
1232
|
+
let p = v(t, r, f), m = new MutationObserver(() => {
|
|
1233
|
+
d(), f();
|
|
1161
1234
|
});
|
|
1162
|
-
for (let e = t; e; e = e.parentElement)
|
|
1235
|
+
for (let e = t; e; e = e.parentElement) m.observe(e, {
|
|
1163
1236
|
attributes: !0,
|
|
1164
1237
|
attributeFilter: [
|
|
1165
1238
|
"class",
|
|
@@ -1170,16 +1243,16 @@ function Z({ source: e, children: t, placement: n = "top-end", onBoundsChange: r
|
|
|
1170
1243
|
"aria-hidden"
|
|
1171
1244
|
]
|
|
1172
1245
|
});
|
|
1173
|
-
let
|
|
1174
|
-
return
|
|
1246
|
+
let h = t.querySelector(".game-ui-liquid-presence");
|
|
1247
|
+
return h && m.observe(h, {
|
|
1175
1248
|
attributes: !0,
|
|
1176
1249
|
attributeFilter: [
|
|
1177
1250
|
"class",
|
|
1178
1251
|
"style",
|
|
1179
1252
|
"data-activity"
|
|
1180
1253
|
]
|
|
1181
|
-
}), document.addEventListener("toggle",
|
|
1182
|
-
|
|
1254
|
+
}), document.addEventListener("toggle", f, !0), document.addEventListener("close", f, !0), () => {
|
|
1255
|
+
s = !1, c++, p(), m.disconnect(), u?.disconnect(), document.removeEventListener("toggle", f, !0), document.removeEventListener("close", f, !0), a(null);
|
|
1183
1256
|
};
|
|
1184
1257
|
}, [
|
|
1185
1258
|
i,
|
|
@@ -1202,4 +1275,4 @@ function Z({ source: e, children: t, placement: n = "top-end", onBoundsChange: r
|
|
|
1202
1275
|
}) : null;
|
|
1203
1276
|
}
|
|
1204
1277
|
//#endregion
|
|
1205
|
-
export {
|
|
1278
|
+
export { fe as LiquidAnchor, q as LiquidPresence, de as LiquidReveal };
|