@pieai/swimmer-ui-kit 2.9.0 → 2.11.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 +49 -0
- package/dist/index.d.ts +124 -0
- package/dist/index.js +1717 -1438
- package/dist/liquid-presence.css +1 -1
- package/dist/liquid-presence.d.ts +57 -0
- package/dist/liquid-presence.js +803 -214
- 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,12 +1,12 @@
|
|
|
1
|
-
import { _ as e,
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { autoUpdate as
|
|
6
|
-
function
|
|
1
|
+
import { _ as e, c as t, d as n, h as r, i, m as a, n as o, t as s } from "./reducedMotion-C7O9ls34.js";
|
|
2
|
+
import { useEffect as c, useId as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
|
|
3
|
+
import { createPortal as p } from "react-dom";
|
|
4
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
|
+
import { FloatingPortal as _, autoUpdate as v, computePosition as y, flip as b, hide as x, offset as S, shift as C, size as w } from "@floating-ui/react";
|
|
6
|
+
function T(e, t, n) {
|
|
7
7
|
return Number.isFinite(e) ? Math.max(t, Math.min(n, e)) : t;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function E(e) {
|
|
10
10
|
return !!(e && [
|
|
11
11
|
e.x,
|
|
12
12
|
e.y,
|
|
@@ -14,23 +14,23 @@ function x(e) {
|
|
|
14
14
|
e.height
|
|
15
15
|
].every(Number.isFinite) && e.width > 0 && e.height > 0);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function D(e, t) {
|
|
18
|
+
return E(e) && e.x + e.width > t.x && e.y + e.height > t.y && e.x < t.x + t.width && e.y < t.y + t.height;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function O(e) {
|
|
21
21
|
return {
|
|
22
22
|
x: e.x + e.width / 2,
|
|
23
23
|
y: e.y + e.height / 2
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function k(e, t) {
|
|
27
27
|
let n = Math.hypot(t.x - e.x, t.y - e.y) || 1;
|
|
28
28
|
return {
|
|
29
29
|
x: (t.x - e.x) / n,
|
|
30
30
|
y: (t.y - e.y) / n
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function A(e, t) {
|
|
34
34
|
let n = Math.max(e.x, t.x), r = Math.max(e.y, t.y);
|
|
35
35
|
return {
|
|
36
36
|
x: n,
|
|
@@ -39,19 +39,19 @@ function ee(e, t) {
|
|
|
39
39
|
height: Math.max(0, Math.min(e.y + e.height, t.y + t.height) - r)
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
let n = e.y + e.height + 88 < t.y + t.height, r = n ? "bottom" : "top", i = Math.max(t.x + 18, e.x), a = Math.min(t.x + t.width - 18, e.x + e.width), o =
|
|
42
|
+
function ee(e, t) {
|
|
43
|
+
let n = e.y + e.height + 88 < t.y + t.height, r = n ? "bottom" : "top", i = Math.max(t.x + 18, e.x), a = Math.min(t.x + t.width - 18, e.x + e.width), o = T(Math.max(0, a - i) * .58, 36, 84);
|
|
44
44
|
return {
|
|
45
|
-
x:
|
|
46
|
-
y:
|
|
45
|
+
x: T((i + a) / 2, t.x + o / 2 + 8, t.x + t.width - o / 2 - 8),
|
|
46
|
+
y: T(n ? e.y + e.height + 10 : e.y - 10, t.y + 18, t.y + t.height - 18),
|
|
47
47
|
side: r,
|
|
48
48
|
width: o
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
let i =
|
|
53
|
-
x:
|
|
54
|
-
y:
|
|
51
|
+
function j(e, t, n, r) {
|
|
52
|
+
let i = T(n, 0, 1), a = k(e, t), o = Math.min(86, Math.hypot(t.x - e.x, t.y - e.y) * .2), s = {
|
|
53
|
+
x: T((e.x + t.x) / 2 + a.y * o, r.x + 16, r.x + r.width - 16),
|
|
54
|
+
y: T((e.y + t.y) / 2 - a.x * o, r.y + 16, r.y + r.height - 16)
|
|
55
55
|
}, c = 2 * (1 - i) * (s.x - e.x) + 2 * i * (t.x - s.x), l = 2 * (1 - i) * (s.y - e.y) + 2 * i * (t.y - s.y);
|
|
56
56
|
return {
|
|
57
57
|
x: (1 - i) ** 2 * e.x + 2 * (1 - i) * i * s.x + i ** 2 * t.x,
|
|
@@ -59,45 +59,71 @@ function T(e, t, n, r) {
|
|
|
59
59
|
angle: Math.atan2(l, c) * 180 / Math.PI
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
let
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
function M(e = 0, t = 0, n = 0, r = 1, a = 0) {
|
|
63
|
+
let o = T(a, 0, 1), s = 66 * Math.sqrt(1 - .075 * T(n, 0, 1)) - o * 2.4;
|
|
64
|
+
return i(80 - s, 80 - s, s * 2, s * 2, [
|
|
65
|
+
s,
|
|
66
|
+
s,
|
|
67
|
+
s,
|
|
68
|
+
s
|
|
69
69
|
], {
|
|
70
|
-
amplitude: 3.5 +
|
|
70
|
+
amplitude: (3.5 + o * 9 + T(t, 0, 1) * 9) * T(r, .15, 1.25),
|
|
71
71
|
lobes: 3,
|
|
72
72
|
seed: 17,
|
|
73
73
|
phase: e
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let
|
|
78
|
-
return
|
|
76
|
+
function N(e, t, n = 20) {
|
|
77
|
+
let r = T(t, 0, 1), a = T(n, 6, 48), o = a + (e - a) * r, s = a + (8 - a) * r;
|
|
78
|
+
return i(-o / 2, -s / 2, o, s, [
|
|
79
79
|
s / 2,
|
|
80
80
|
s / 2,
|
|
81
81
|
s / 2,
|
|
82
82
|
s / 2
|
|
83
83
|
], {
|
|
84
84
|
amplitude: 2.2,
|
|
85
|
-
phase:
|
|
85
|
+
phase: r * Math.PI,
|
|
86
86
|
seed: 17,
|
|
87
87
|
lobes: 3
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
//#endregion
|
|
91
|
+
//#region src/liquidAmbientClock.ts
|
|
92
|
+
var P = /* @__PURE__ */ new Map(), F, I, L = !1;
|
|
93
|
+
function R() {
|
|
94
|
+
if (L || I !== void 0 || (clearTimeout(F), F = void 0, !P.size)) return;
|
|
95
|
+
let e = Math.min(...[...P.values()].map((e) => e.at));
|
|
96
|
+
F = setTimeout(() => {
|
|
97
|
+
F = void 0, I = requestAnimationFrame((e) => {
|
|
98
|
+
I = void 0, L = !0;
|
|
99
|
+
try {
|
|
100
|
+
for (let [t, n] of [...P]) n.at > e + 1 || !P.has(t) || (P.delete(t), n.paint(e));
|
|
101
|
+
} finally {
|
|
102
|
+
L = !1, R();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}, Math.max(0, e - performance.now()));
|
|
106
|
+
}
|
|
107
|
+
function te(e, t = 1e3 / 12) {
|
|
108
|
+
let n = Symbol();
|
|
109
|
+
return P.set(n, {
|
|
110
|
+
at: performance.now() + t,
|
|
111
|
+
paint: e
|
|
112
|
+
}), R(), () => {
|
|
113
|
+
P.delete(n), !P.size && I !== void 0 && (cancelAnimationFrame(I), I = void 0), R();
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
91
117
|
//#region src/liquidPresenceMotion.ts
|
|
92
|
-
var
|
|
118
|
+
var z = o("cubic-bezier(0.45, 0, 0.2, 1)");
|
|
93
119
|
function ne(e) {
|
|
94
120
|
let { source: t, destination: n, viewport: r, returning: i = !1, from: a, origin: o } = e, s = o?.seat == null ? 0 : 180;
|
|
95
121
|
if (s && e.elapsed < s) return {
|
|
96
122
|
...o,
|
|
97
123
|
phase: "gather",
|
|
98
|
-
seat: o.seat * (1 -
|
|
124
|
+
seat: o.seat * (1 - z(T(e.elapsed / s, 0, 1)))
|
|
99
125
|
};
|
|
100
|
-
let c = Math.max(0, e.elapsed - s), l =
|
|
126
|
+
let c = Math.max(0, e.elapsed - s), l = O(t), u = k(l, n), d = Math.atan2(u.y, u.x) * 180 / Math.PI, f = t.width / 160, p = {
|
|
101
127
|
x: l.x + u.x * 112 * f,
|
|
102
128
|
y: l.y + u.y * 112 * f
|
|
103
129
|
}, m = {
|
|
@@ -112,7 +138,7 @@ function ne(e) {
|
|
|
112
138
|
};
|
|
113
139
|
if (i) {
|
|
114
140
|
if (o?.bud) {
|
|
115
|
-
let e =
|
|
141
|
+
let e = z(T(c / 320, 0, 1)), t = o.bud.x + (80 - o.bud.x) * e, n = o.bud.y + (80 - o.bud.y) * e;
|
|
116
142
|
return {
|
|
117
143
|
...m,
|
|
118
144
|
phase: e < 1 ? "merge" : "still",
|
|
@@ -128,9 +154,9 @@ function ne(e) {
|
|
|
128
154
|
} : null
|
|
129
155
|
};
|
|
130
156
|
}
|
|
131
|
-
let e =
|
|
157
|
+
let e = T(c / 620, 0, 1);
|
|
132
158
|
if (e < 1) {
|
|
133
|
-
let t =
|
|
159
|
+
let t = j(a ?? n, p, z(e), r);
|
|
134
160
|
return {
|
|
135
161
|
...m,
|
|
136
162
|
phase: "return",
|
|
@@ -140,11 +166,11 @@ function ne(e) {
|
|
|
140
166
|
stretch: 1 + .3 * Math.sin(e * Math.PI)
|
|
141
167
|
};
|
|
142
168
|
}
|
|
143
|
-
let t =
|
|
169
|
+
let t = T((c - 620) / 420, 0, 1), i = 112 - 78 * z(t);
|
|
144
170
|
return {
|
|
145
171
|
...m,
|
|
146
172
|
phase: t < 1 ? "merge" : "still",
|
|
147
|
-
separation: 1 -
|
|
173
|
+
separation: 1 - z(t),
|
|
148
174
|
point: {
|
|
149
175
|
x: l.x + u.x * i * f,
|
|
150
176
|
y: l.y + u.y * i * f
|
|
@@ -152,13 +178,13 @@ function ne(e) {
|
|
|
152
178
|
bud: t < 1 ? {
|
|
153
179
|
x: 80 + u.x * i,
|
|
154
180
|
y: 80 + u.y * i,
|
|
155
|
-
radius: 16 * (1 - .65 *
|
|
181
|
+
radius: 16 * (1 - .65 * z(t))
|
|
156
182
|
} : null
|
|
157
183
|
};
|
|
158
184
|
}
|
|
159
185
|
let h = o?.phase === "split" ? o.bud : null, g = h ? o.separation : 0, _ = h ? Math.max(180, 460 * (1 - g)) : a ? 0 : 460;
|
|
160
186
|
if (c < _) {
|
|
161
|
-
let e =
|
|
187
|
+
let e = z(c / _), t = 42 + 70 * e, n = h ? h.x + (80 + u.x * 112 - h.x) * e : 80 + u.x * t, r = h ? h.y + (80 + u.y * 112 - h.y) * e : 80 + u.y * t, i = h?.radius ?? 16 * .55;
|
|
162
188
|
return {
|
|
163
189
|
...m,
|
|
164
190
|
phase: "split",
|
|
@@ -174,66 +200,66 @@ function ne(e) {
|
|
|
174
200
|
}
|
|
175
201
|
};
|
|
176
202
|
}
|
|
177
|
-
let v = a ?? p, y = 560 + Math.min(260, Math.hypot(n.x - v.x, n.y - v.y) * .26),
|
|
178
|
-
if (
|
|
179
|
-
let e =
|
|
203
|
+
let v = a ?? p, y = 560 + Math.min(260, Math.hypot(n.x - v.x, n.y - v.y) * .26), b = T((c - _) / y, 0, 1);
|
|
204
|
+
if (b < 1) {
|
|
205
|
+
let e = j(v, n, z(b), r);
|
|
180
206
|
return {
|
|
181
207
|
...m,
|
|
182
208
|
phase: "flight",
|
|
183
209
|
separation: 1,
|
|
184
210
|
point: e,
|
|
185
211
|
angle: e.angle,
|
|
186
|
-
stretch: 1 + .35 * Math.sin(
|
|
212
|
+
stretch: 1 + .35 * Math.sin(b * Math.PI)
|
|
187
213
|
};
|
|
188
214
|
}
|
|
189
|
-
let
|
|
215
|
+
let x = T((c - _ - y) / 380, 0, 1);
|
|
190
216
|
return {
|
|
191
217
|
...m,
|
|
192
|
-
phase:
|
|
218
|
+
phase: x < 1 ? "land" : "dock",
|
|
193
219
|
separation: 1,
|
|
194
220
|
point: n,
|
|
195
|
-
seat:
|
|
221
|
+
seat: z(x)
|
|
196
222
|
};
|
|
197
223
|
}
|
|
198
224
|
//#endregion
|
|
199
225
|
//#region src/liquidPresencePaint.ts
|
|
200
|
-
function
|
|
226
|
+
function B(e, t) {
|
|
201
227
|
e.toggleAttribute("hidden", !t);
|
|
202
228
|
let n = e.style, r = t ? "" : "none";
|
|
203
229
|
n.display !== r && (n.display = r);
|
|
204
230
|
}
|
|
205
|
-
var
|
|
231
|
+
var V = (e, t, n) => {
|
|
206
232
|
let r = String(n);
|
|
207
233
|
e.getAttribute(t) !== r && e.setAttribute(t, r);
|
|
208
234
|
};
|
|
209
|
-
function
|
|
235
|
+
function re(e, t, n) {
|
|
210
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;
|
|
211
237
|
return {
|
|
212
238
|
x: (t - r.x) / i,
|
|
213
239
|
y: (n - r.y) / a
|
|
214
240
|
};
|
|
215
241
|
}
|
|
216
|
-
function
|
|
217
|
-
|
|
218
|
-
let
|
|
219
|
-
|
|
220
|
-
let
|
|
221
|
-
|
|
222
|
-
let
|
|
223
|
-
if (
|
|
242
|
+
function ie(e, t, n, r, i = 0, a = 1, o = !1, s = 0) {
|
|
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
|
+
let c = t.bud ? Math.sin(t.separation * Math.PI) * .045 : 0;
|
|
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
|
+
let l = t.phase === "flight" || t.phase === "return";
|
|
247
|
+
B(e.flight, l);
|
|
248
|
+
let u = re(e, t.point.x, t.point.y);
|
|
249
|
+
if (l) {
|
|
224
250
|
let n = t.diameter / 32;
|
|
225
|
-
e.flight.style.transform = `translate(${
|
|
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));
|
|
226
252
|
}
|
|
227
|
-
|
|
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);
|
|
228
254
|
}
|
|
229
|
-
function
|
|
255
|
+
function ae(e, t, n, r) {
|
|
230
256
|
e.satellites.forEach((e, i) => {
|
|
231
|
-
if (
|
|
257
|
+
if (B(e, n), !n) return;
|
|
232
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);
|
|
233
|
-
|
|
259
|
+
V(e, "cx", 80 + Math.cos(a) * o), V(e, "cy", 80 + Math.sin(a) * o), V(e, "r", 7 + i * 1.5);
|
|
234
260
|
});
|
|
235
261
|
}
|
|
236
|
-
function
|
|
262
|
+
function H() {
|
|
237
263
|
let e = window.visualViewport;
|
|
238
264
|
return {
|
|
239
265
|
x: e?.offsetLeft ?? 0,
|
|
@@ -244,23 +270,23 @@ function M() {
|
|
|
244
270
|
}
|
|
245
271
|
//#endregion
|
|
246
272
|
//#region src/liquidPresenceTracking.ts
|
|
247
|
-
function
|
|
273
|
+
function oe(e) {
|
|
248
274
|
try {
|
|
249
275
|
let t = e.contextElement;
|
|
250
276
|
if (t && t.ownerDocument !== document || t && (!t.isConnected || t.closest("[hidden], [inert]")) || t && getComputedStyle(t).visibility === "hidden") return null;
|
|
251
277
|
let n = document.querySelector("dialog:modal");
|
|
252
278
|
if (n && (!t || !n.contains(t))) return null;
|
|
253
279
|
let r = e.getRect();
|
|
254
|
-
return
|
|
280
|
+
return E(r) && D(r, H()) ? r : null;
|
|
255
281
|
} catch {
|
|
256
282
|
return null;
|
|
257
283
|
}
|
|
258
284
|
}
|
|
259
|
-
function
|
|
285
|
+
function se(e, t, n, r) {
|
|
260
286
|
let i = t.contextElement, a = {
|
|
261
287
|
...i ? { contextElement: i } : {},
|
|
262
288
|
getBoundingClientRect: () => {
|
|
263
|
-
let e =
|
|
289
|
+
let e = oe(t) ?? {
|
|
264
290
|
x: 0,
|
|
265
291
|
y: 0,
|
|
266
292
|
width: 0,
|
|
@@ -297,7 +323,7 @@ function ae(e, t, n, r) {
|
|
|
297
323
|
attributeFilter: ["open", "inert"]
|
|
298
324
|
});
|
|
299
325
|
let l = () => {}, u = !1, d = /* @__PURE__ */ new Map(), f = (e) => {
|
|
300
|
-
l(), u = e, l =
|
|
326
|
+
l(), u = e, l = v(i ?? a, n, r, { animationFrame: !i || e });
|
|
301
327
|
}, p = (e) => {
|
|
302
328
|
if (!(e.target instanceof Element) || !o.has(e.target)) return;
|
|
303
329
|
let t = "propertyName" in e ? String(e.propertyName) : "animationName" in e ? String(e.animationName) : e.type, n = d.get(e.target) ?? /* @__PURE__ */ new Set();
|
|
@@ -317,54 +343,118 @@ function ae(e, t, n, r) {
|
|
|
317
343
|
};
|
|
318
344
|
}
|
|
319
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
|
|
320
398
|
//#region src/useLiquidPresenceMotion.ts
|
|
321
|
-
function
|
|
322
|
-
let
|
|
323
|
-
|
|
324
|
-
let u =
|
|
325
|
-
|
|
326
|
-
let
|
|
327
|
-
if (!
|
|
328
|
-
let
|
|
329
|
-
source:
|
|
399
|
+
function K(t, n, i, o) {
|
|
400
|
+
let s = d(i);
|
|
401
|
+
s.current = i;
|
|
402
|
+
let l = !!i.guideContent, u = d(null), f = d(null), p = d(null), m = d(0), h = d(+(i.idleMotion === "breathe")), g = d(() => {});
|
|
403
|
+
c(() => {
|
|
404
|
+
let i = t.current, o = n.current;
|
|
405
|
+
if (!i || !o) return;
|
|
406
|
+
let c = {
|
|
407
|
+
source: i,
|
|
330
408
|
overlay: o,
|
|
331
|
-
body:
|
|
332
|
-
bud:
|
|
333
|
-
satellites: [...
|
|
409
|
+
body: i.querySelector("[data-presence-body]"),
|
|
410
|
+
bud: i.querySelector("[data-presence-bud]"),
|
|
411
|
+
satellites: [...i.querySelectorAll("[data-presence-satellite]")],
|
|
334
412
|
flight: o.querySelector(".game-ui-liquid-presence-flight"),
|
|
335
413
|
flightBody: o.querySelector("[data-presence-flight-body]"),
|
|
336
414
|
trail: o.querySelector("[data-presence-trail]"),
|
|
337
415
|
seat: o.querySelector(".game-ui-liquid-presence-seat"),
|
|
338
416
|
seatBody: o.querySelector("[data-presence-seat-body]"),
|
|
339
417
|
label: o.querySelector(".game-ui-liquid-presence-label")
|
|
340
|
-
}, l =
|
|
341
|
-
l || (
|
|
342
|
-
let
|
|
418
|
+
}, l = s.current.target ?? null;
|
|
419
|
+
l || (f.current = null), l?.key === f.current && (l = null);
|
|
420
|
+
let d = u.current, _ = !l && !!(d && d.phase !== "still"), v = d && [
|
|
343
421
|
"flight",
|
|
344
422
|
"dock",
|
|
345
423
|
"land",
|
|
346
424
|
"gather",
|
|
347
425
|
"return"
|
|
348
|
-
].includes(
|
|
349
|
-
|
|
350
|
-
},
|
|
426
|
+
].includes(d.phase) ? d.point : void 0, x = d?.point ?? O(i.getBoundingClientRect()), E = d?.seatWidth ?? 48, k = d ?? void 0, j = i.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 && r(), I = !1;
|
|
428
|
+
}, Y = (e) => {
|
|
351
429
|
if (l) {
|
|
352
|
-
|
|
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);
|
|
353
431
|
try {
|
|
354
|
-
|
|
432
|
+
s.current.onDismiss?.(e);
|
|
355
433
|
} catch {}
|
|
356
|
-
|
|
434
|
+
$();
|
|
435
|
+
}
|
|
436
|
+
}, X = () => {
|
|
437
|
+
if (!l) return null;
|
|
438
|
+
let e = c.label.style.pointerEvents;
|
|
439
|
+
s.current.guideContent && (c.label.style.pointerEvents = "none");
|
|
440
|
+
try {
|
|
441
|
+
return oe(s.current.target?.key === l.key ? s.current.target : l);
|
|
442
|
+
} finally {
|
|
443
|
+
c.label.style.pointerEvents = e;
|
|
357
444
|
}
|
|
358
|
-
},
|
|
445
|
+
}, Z = () => {
|
|
359
446
|
if (!l) return;
|
|
360
|
-
let e =
|
|
447
|
+
let e = X();
|
|
361
448
|
if (!e) {
|
|
362
|
-
|
|
449
|
+
Y("unavailable");
|
|
363
450
|
return;
|
|
364
451
|
}
|
|
365
|
-
let t =
|
|
366
|
-
|
|
367
|
-
|
|
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);
|
|
453
|
+
x = {
|
|
454
|
+
x: t.x,
|
|
455
|
+
y: r(G ?? t.side)
|
|
456
|
+
}, E = t.width;
|
|
457
|
+
let i = {
|
|
368
458
|
...l.contextElement ? { contextElement: l.contextElement } : {},
|
|
369
459
|
getBoundingClientRect: () => ({
|
|
370
460
|
...n,
|
|
@@ -373,135 +463,192 @@ function P(t, r, a, o) {
|
|
|
373
463
|
bottom: n.y + n.height,
|
|
374
464
|
right: n.x + n.width
|
|
375
465
|
})
|
|
376
|
-
},
|
|
377
|
-
|
|
466
|
+
}, a = ++W, o = s.current.guideSize === "expanded";
|
|
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, {
|
|
378
468
|
strategy: "absolute",
|
|
379
|
-
placement: t.side,
|
|
469
|
+
placement: o && H().width >= 900 ? "right" : t.side,
|
|
380
470
|
middleware: [
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
y({
|
|
471
|
+
S(26),
|
|
472
|
+
b({
|
|
384
473
|
padding: 16,
|
|
385
|
-
|
|
386
|
-
|
|
474
|
+
...o && H().width >= 900 ? { fallbackPlacements: [
|
|
475
|
+
"left",
|
|
476
|
+
"bottom",
|
|
477
|
+
"top"
|
|
478
|
+
] } : {}
|
|
479
|
+
}),
|
|
480
|
+
C({
|
|
481
|
+
padding: 16,
|
|
482
|
+
crossAxis: !o
|
|
483
|
+
}),
|
|
484
|
+
...o ? [w({
|
|
485
|
+
padding: 16,
|
|
486
|
+
apply({ availableHeight: e, elements: t }) {
|
|
487
|
+
let n = `${Math.max(0, Math.min(560, H().height * .65, e))}px`;
|
|
488
|
+
t.floating.style.maxHeight !== n && (t.floating.style.maxHeight = n);
|
|
489
|
+
}
|
|
490
|
+
})] : []
|
|
387
491
|
]
|
|
388
|
-
}).then(({ x: e, y:
|
|
389
|
-
|
|
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 = {
|
|
512
|
+
x: t.x,
|
|
513
|
+
y: s
|
|
514
|
+
}, $());
|
|
515
|
+
}
|
|
390
516
|
}).catch(() => {});
|
|
391
|
-
},
|
|
517
|
+
}, Q = () => [
|
|
392
518
|
"connecting",
|
|
393
519
|
"listening",
|
|
394
520
|
"thinking",
|
|
395
521
|
"speaking",
|
|
396
522
|
"working"
|
|
397
|
-
].includes(
|
|
398
|
-
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(i.getBoundingClientRect(), H())) return !1;
|
|
399
525
|
let t = document.querySelector("dialog:modal");
|
|
400
|
-
if (t && !t.contains(
|
|
526
|
+
if (t && !t.contains(i)) return !1;
|
|
401
527
|
let n = l?.contextElement?.closest("dialog") ?? null;
|
|
402
|
-
if (l &&
|
|
403
|
-
let r = 13184 + (
|
|
404
|
-
return o.maxAnimatedGroups === 0 || r > o.maxFilterArea ? (
|
|
528
|
+
if (l && i.closest("dialog") !== n) return !1;
|
|
529
|
+
let r = 13184 + (i.getBoundingClientRect().width * 2) ** 2, o = a();
|
|
530
|
+
return o.maxAnimatedGroups === 0 || r > o.maxFilterArea ? (J(), !1) : !(l || _ || Q()) && de() && !I && o.activeGroups > 0 ? (L = !0, !1) : (I ||= e(r), I);
|
|
405
531
|
};
|
|
406
|
-
function
|
|
407
|
-
if (!
|
|
408
|
-
let t =
|
|
409
|
-
if (!
|
|
410
|
-
|
|
532
|
+
function pe(e) {
|
|
533
|
+
if (!F || document.hidden) return;
|
|
534
|
+
let t = c.source.getBoundingClientRect();
|
|
535
|
+
if (!c.source.isConnected || c.source.closest("[hidden], [inert]") || t.width <= 0 || t.height <= 0) {
|
|
536
|
+
_ = !1, u.current = null, Y("unavailable"), B(c.label, !1), B(c.flight, !1), B(c.seat, !1), J();
|
|
411
537
|
return;
|
|
412
538
|
}
|
|
413
|
-
if (l && !
|
|
414
|
-
|
|
539
|
+
if (l && !X()) {
|
|
540
|
+
Y("unavailable");
|
|
415
541
|
return;
|
|
416
542
|
}
|
|
417
|
-
let n =
|
|
418
|
-
elapsed: e -
|
|
419
|
-
source:
|
|
420
|
-
destination:
|
|
421
|
-
viewport:
|
|
422
|
-
returning:
|
|
423
|
-
...
|
|
424
|
-
...
|
|
543
|
+
let n = fe(), r = ne({
|
|
544
|
+
elapsed: e - M,
|
|
545
|
+
source: _ ? t : j,
|
|
546
|
+
destination: x,
|
|
547
|
+
viewport: H(),
|
|
548
|
+
returning: _,
|
|
549
|
+
...v ? { from: v } : {},
|
|
550
|
+
...k ? { origin: k } : {}
|
|
425
551
|
});
|
|
426
|
-
!l && !
|
|
552
|
+
!l && !_ && (r = {
|
|
427
553
|
...r,
|
|
428
554
|
phase: "still",
|
|
429
555
|
separation: 0,
|
|
430
556
|
bud: null,
|
|
431
557
|
seat: null
|
|
432
|
-
}), (!n || l &&
|
|
558
|
+
}), (!n || l && p.current === l.key) && (r = {
|
|
433
559
|
...r,
|
|
434
560
|
phase: l ? "dock" : "still",
|
|
435
|
-
point:
|
|
561
|
+
point: x,
|
|
436
562
|
bud: null,
|
|
437
563
|
seat: l ? 1 : null,
|
|
438
564
|
separation: +!!l
|
|
439
|
-
}),
|
|
440
|
-
let i = !["still", "dock"].includes(r.phase), a =
|
|
441
|
-
|
|
442
|
-
let
|
|
443
|
-
|
|
444
|
-
let
|
|
445
|
-
|
|
446
|
-
let
|
|
447
|
-
s.
|
|
565
|
+
}), _ && r.phase === "still" && (_ = !1), l && r.phase === "dock" && (p.current = l.key);
|
|
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;
|
|
568
|
+
let f = typeof a == "number" ? T(a, 0, 1) : 0;
|
|
569
|
+
U += (f - U) * (1 - Math.exp(-d / (f > U ? 65 : 140)));
|
|
570
|
+
let g = T(s.current.motionSpeed ?? 1, .5, 1.5), y = T(s.current.motionIntensity ?? 1, .25, 1.25);
|
|
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)));
|
|
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);
|
|
574
|
+
let C = n && (i || Q()) ? "animated" : n && o ? "ambient" : "static";
|
|
575
|
+
c.source.dataset.liquidMotion !== C && (c.source.dataset.liquidMotion = C), u.current = {
|
|
448
576
|
...r,
|
|
449
|
-
seatWidth: r.phase === "gather" ?
|
|
450
|
-
}, l &&
|
|
577
|
+
seatWidth: r.phase === "gather" ? k?.seatWidth ?? E : E
|
|
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());
|
|
580
|
+
}, L ? 250 : 1e3 / 12)));
|
|
451
581
|
}
|
|
452
|
-
function
|
|
453
|
-
if (
|
|
454
|
-
|
|
582
|
+
function me(e) {
|
|
583
|
+
if (N = null, !F || document.hidden) {
|
|
584
|
+
J();
|
|
455
585
|
return;
|
|
456
586
|
}
|
|
457
|
-
if ((u.current?.phase === "still" || u.current?.phase === "dock") && e -
|
|
458
|
-
|
|
587
|
+
if ((u.current?.phase === "still" || u.current?.phase === "dock") && e - z < 32) {
|
|
588
|
+
N = requestAnimationFrame(me);
|
|
459
589
|
return;
|
|
460
590
|
}
|
|
461
|
-
|
|
591
|
+
z = e, pe(e);
|
|
462
592
|
}
|
|
463
|
-
function
|
|
464
|
-
!
|
|
593
|
+
function $() {
|
|
594
|
+
!F || N !== null || document.hidden || (P(), P = () => {}, pe(performance.now()));
|
|
465
595
|
}
|
|
466
|
-
|
|
467
|
-
let
|
|
468
|
-
if (
|
|
469
|
-
let e =
|
|
470
|
-
|
|
596
|
+
g.current = $;
|
|
597
|
+
let he = () => {
|
|
598
|
+
if (K(), K = () => {}, !l || document.hidden) return;
|
|
599
|
+
let e = se(c.source, l, c.label, () => {
|
|
600
|
+
Z(), $();
|
|
471
601
|
});
|
|
472
|
-
|
|
602
|
+
K = e, l || e();
|
|
473
603
|
};
|
|
474
|
-
l && (
|
|
475
|
-
let
|
|
476
|
-
e.key === "Escape" &&
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
604
|
+
l && (Z(), l && (he(), l && !s.current.guideContent && (q = setTimeout(() => Y("expired"), 12e3))));
|
|
605
|
+
let ge = (e) => {
|
|
606
|
+
if (e.key === "Escape" && !e.isComposing && l) {
|
|
607
|
+
if (s.current.guideContent && e.target instanceof Node && c.label.contains(e.target)) return;
|
|
608
|
+
let t = document.querySelector("dialog:modal");
|
|
609
|
+
if (t && !t.contains(c.label)) return;
|
|
610
|
+
s.current.guideContent && e.preventDefault(), Y("dismissed");
|
|
611
|
+
}
|
|
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()), $();
|
|
483
618
|
});
|
|
484
|
-
|
|
485
|
-
|
|
619
|
+
ye?.observe(i), 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);
|
|
486
625
|
};
|
|
487
626
|
}, [
|
|
488
627
|
t,
|
|
489
|
-
|
|
628
|
+
n,
|
|
490
629
|
o,
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
630
|
+
i.target?.key,
|
|
631
|
+
i.reducedMotion,
|
|
632
|
+
i.size,
|
|
633
|
+
i.guideSize,
|
|
634
|
+
l
|
|
635
|
+
]), c(() => g.current(), [
|
|
636
|
+
i.activity,
|
|
637
|
+
i.idleMotion,
|
|
638
|
+
i.motionSpeed,
|
|
639
|
+
i.motionIntensity,
|
|
640
|
+
i.splashes
|
|
641
|
+
]);
|
|
495
642
|
}
|
|
496
643
|
//#endregion
|
|
497
644
|
//#region src/LiquidPresence.tsx
|
|
498
|
-
function
|
|
499
|
-
let
|
|
500
|
-
|
|
645
|
+
function q(e) {
|
|
646
|
+
let t = s() || e.reducedMotion === !0, r = T(e.size ?? 64, 32, 224), i = `presence-${l().replace(/[^a-zA-Z0-9_-]/g, "")}`, a = d(null), o = d(null), [u, _] = f(null);
|
|
647
|
+
c(() => {
|
|
501
648
|
let t = e.target?.contextElement?.closest("dialog");
|
|
502
649
|
_(t ?? a.current?.closest("dialog") ?? document.body);
|
|
503
|
-
}, [e.target?.contextElement]),
|
|
504
|
-
let e = a.current, t =
|
|
650
|
+
}, [e.target?.contextElement]), c(() => {
|
|
651
|
+
let e = a.current, t = o.current;
|
|
505
652
|
if (!e || !t) return;
|
|
506
653
|
let n = [
|
|
507
654
|
"--liquid-presence-from",
|
|
@@ -512,7 +659,16 @@ function F(e) {
|
|
|
512
659
|
"--game-ui-text",
|
|
513
660
|
"--game-ui-font-body",
|
|
514
661
|
"--game-ui-radius-control",
|
|
515
|
-
"--game-ui-shadow-button"
|
|
662
|
+
"--game-ui-shadow-button",
|
|
663
|
+
"--game-ui-surface-raised",
|
|
664
|
+
"--game-ui-text-muted",
|
|
665
|
+
"--game-ui-border-subtle",
|
|
666
|
+
"--game-ui-border-ink",
|
|
667
|
+
"--game-ui-disabled",
|
|
668
|
+
"--game-ui-button-lip-ink",
|
|
669
|
+
"--game-ui-accent",
|
|
670
|
+
"--game-ui-accent-bright",
|
|
671
|
+
"--game-ui-accent-contrast"
|
|
516
672
|
], r = () => {
|
|
517
673
|
let r = getComputedStyle(e);
|
|
518
674
|
for (let e of n) {
|
|
@@ -532,11 +688,11 @@ function F(e) {
|
|
|
532
688
|
return r(), window.addEventListener("resize", r, { passive: !0 }), () => {
|
|
533
689
|
i.disconnect(), window.removeEventListener("resize", r);
|
|
534
690
|
};
|
|
535
|
-
}, [
|
|
691
|
+
}, [u]), K(a, o, {
|
|
536
692
|
...e,
|
|
537
693
|
size: r,
|
|
538
|
-
reducedMotion:
|
|
539
|
-
},
|
|
694
|
+
reducedMotion: t
|
|
695
|
+
}, u);
|
|
540
696
|
let v = {
|
|
541
697
|
width: r,
|
|
542
698
|
height: r,
|
|
@@ -546,26 +702,26 @@ function F(e) {
|
|
|
546
702
|
"--liquid-presence-from": "var(--game-ui-warning)",
|
|
547
703
|
"--liquid-presence-to": "var(--game-ui-warning)"
|
|
548
704
|
} : {}
|
|
549
|
-
}, y = (e,
|
|
705
|
+
}, y = (e, t) => /* @__PURE__ */ g("defs", { children: [/* @__PURE__ */ g("linearGradient", {
|
|
550
706
|
id: `${i}-${e}-fill`,
|
|
551
707
|
gradientUnits: "userSpaceOnUse",
|
|
552
708
|
x1: e === "core" ? 24 : -24,
|
|
553
709
|
y1: e === "core" ? 16 : -18,
|
|
554
710
|
x2: e === "core" ? 136 : 24,
|
|
555
711
|
y2: e === "core" ? 146 : 18,
|
|
556
|
-
children: [/* @__PURE__ */
|
|
712
|
+
children: [/* @__PURE__ */ h("stop", {
|
|
557
713
|
offset: "0",
|
|
558
714
|
stopColor: "var(--liquid-presence-from, var(--game-ui-secondary))"
|
|
559
|
-
}), /* @__PURE__ */
|
|
715
|
+
}), /* @__PURE__ */ h("stop", {
|
|
560
716
|
offset: "1",
|
|
561
717
|
stopColor: "var(--liquid-presence-to, var(--game-ui-secondary))"
|
|
562
718
|
})]
|
|
563
|
-
}), /* @__PURE__ */
|
|
719
|
+
}), /* @__PURE__ */ h("filter", {
|
|
564
720
|
id: `${i}-${e}-goo`,
|
|
565
721
|
filterUnits: "userSpaceOnUse",
|
|
566
|
-
...
|
|
722
|
+
...t,
|
|
567
723
|
colorInterpolationFilters: "sRGB",
|
|
568
|
-
children: /* @__PURE__ */
|
|
724
|
+
children: /* @__PURE__ */ h(n, {
|
|
569
725
|
blur: e === "core" ? 5 : 2,
|
|
570
726
|
contrast: 18,
|
|
571
727
|
gloss: 3.5,
|
|
@@ -574,13 +730,13 @@ function F(e) {
|
|
|
574
730
|
waviness: 0
|
|
575
731
|
})
|
|
576
732
|
})] });
|
|
577
|
-
return /* @__PURE__ */ m
|
|
733
|
+
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
578
734
|
ref: a,
|
|
579
735
|
className: `game-ui-liquid-presence ${e.className ?? ""}`,
|
|
580
736
|
style: v,
|
|
581
737
|
"data-activity": e.activity ?? "idle",
|
|
582
738
|
"aria-hidden": "true",
|
|
583
|
-
children: /* @__PURE__ */
|
|
739
|
+
children: /* @__PURE__ */ g("svg", {
|
|
584
740
|
viewBox: "0 0 160 160",
|
|
585
741
|
focusable: "false",
|
|
586
742
|
children: [y("core", {
|
|
@@ -588,15 +744,15 @@ function F(e) {
|
|
|
588
744
|
y: -80,
|
|
589
745
|
width: 320,
|
|
590
746
|
height: 320
|
|
591
|
-
}), /* @__PURE__ */
|
|
747
|
+
}), /* @__PURE__ */ g("g", {
|
|
592
748
|
fill: `url(#${i}-core-fill)`,
|
|
593
749
|
filter: `url(#${i}-core-goo)`,
|
|
594
750
|
children: [
|
|
595
|
-
/* @__PURE__ */
|
|
751
|
+
/* @__PURE__ */ h("path", {
|
|
596
752
|
"data-presence-body": "",
|
|
597
|
-
d:
|
|
753
|
+
d: M()
|
|
598
754
|
}),
|
|
599
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ h("circle", {
|
|
600
756
|
"data-presence-bud": "",
|
|
601
757
|
cx: "80",
|
|
602
758
|
cy: "80",
|
|
@@ -607,7 +763,7 @@ function F(e) {
|
|
|
607
763
|
0,
|
|
608
764
|
1,
|
|
609
765
|
2
|
|
610
|
-
].map((e) => /* @__PURE__ */
|
|
766
|
+
].map((e) => /* @__PURE__ */ h("circle", {
|
|
611
767
|
"data-presence-satellite": "",
|
|
612
768
|
cx: "80",
|
|
613
769
|
cy: "80",
|
|
@@ -617,8 +773,8 @@ function F(e) {
|
|
|
617
773
|
]
|
|
618
774
|
})]
|
|
619
775
|
})
|
|
620
|
-
}),
|
|
621
|
-
ref:
|
|
776
|
+
}), u && p(/* @__PURE__ */ g("div", {
|
|
777
|
+
ref: o,
|
|
622
778
|
className: "game-ui-liquid-presence-overlay",
|
|
623
779
|
style: {
|
|
624
780
|
...v,
|
|
@@ -627,7 +783,7 @@ function F(e) {
|
|
|
627
783
|
},
|
|
628
784
|
"data-presence-overlay": "",
|
|
629
785
|
children: [
|
|
630
|
-
/* @__PURE__ */
|
|
786
|
+
/* @__PURE__ */ g("svg", {
|
|
631
787
|
className: "game-ui-liquid-presence-flight",
|
|
632
788
|
viewBox: "-48 -36 96 72",
|
|
633
789
|
"aria-hidden": "true",
|
|
@@ -638,18 +794,18 @@ function F(e) {
|
|
|
638
794
|
y: -36,
|
|
639
795
|
width: 96,
|
|
640
796
|
height: 72
|
|
641
|
-
}), /* @__PURE__ */
|
|
797
|
+
}), /* @__PURE__ */ h("g", {
|
|
642
798
|
fill: `url(#${i}-flight-fill)`,
|
|
643
799
|
filter: `url(#${i}-flight-goo)`,
|
|
644
|
-
children: /* @__PURE__ */
|
|
800
|
+
children: /* @__PURE__ */ g("g", {
|
|
645
801
|
"data-presence-flight-body": "",
|
|
646
|
-
children: [/* @__PURE__ */
|
|
802
|
+
children: [/* @__PURE__ */ h("circle", { r: "16" }), /* @__PURE__ */ g("g", {
|
|
647
803
|
"data-presence-trail": "",
|
|
648
|
-
children: [/* @__PURE__ */
|
|
804
|
+
children: [/* @__PURE__ */ h("circle", {
|
|
649
805
|
cx: "-27",
|
|
650
806
|
cy: "5",
|
|
651
807
|
r: "4.5"
|
|
652
|
-
}), /* @__PURE__ */
|
|
808
|
+
}), /* @__PURE__ */ h("circle", {
|
|
653
809
|
cx: "-36",
|
|
654
810
|
cy: "8",
|
|
655
811
|
r: "2.5"
|
|
@@ -658,7 +814,7 @@ function F(e) {
|
|
|
658
814
|
})
|
|
659
815
|
})]
|
|
660
816
|
}),
|
|
661
|
-
/* @__PURE__ */
|
|
817
|
+
/* @__PURE__ */ g("svg", {
|
|
662
818
|
className: "game-ui-liquid-presence-seat",
|
|
663
819
|
viewBox: "-56 -28 112 56",
|
|
664
820
|
"aria-hidden": "true",
|
|
@@ -669,21 +825,454 @@ function F(e) {
|
|
|
669
825
|
y: -28,
|
|
670
826
|
width: 112,
|
|
671
827
|
height: 56
|
|
672
|
-
}), /* @__PURE__ */
|
|
828
|
+
}), /* @__PURE__ */ h("path", {
|
|
673
829
|
"data-presence-seat-body": "",
|
|
674
|
-
d:
|
|
830
|
+
d: N(48, 1),
|
|
675
831
|
fill: `url(#${i}-seat-fill)`,
|
|
676
832
|
filter: `url(#${i}-seat-goo)`
|
|
677
833
|
})]
|
|
678
834
|
}),
|
|
679
|
-
/* @__PURE__ */
|
|
680
|
-
className: "game-ui-liquid-presence-label"
|
|
681
|
-
role: "status",
|
|
682
|
-
"aria-atomic":
|
|
683
|
-
|
|
835
|
+
/* @__PURE__ */ h("div", {
|
|
836
|
+
className: `game-ui-liquid-presence-label${e.guideContent ? " game-ui-liquid-presence-label--guide" : ""}${e.guideContent && e.guideSize === "expanded" ? " game-ui-liquid-presence-label--expanded" : ""}`,
|
|
837
|
+
role: e.guideContent ? void 0 : "status",
|
|
838
|
+
"aria-atomic": !e.guideContent || void 0,
|
|
839
|
+
onClick: e.guideContent ? (e) => e.stopPropagation() : void 0,
|
|
840
|
+
onPointerDown: e.guideContent ? (e) => e.stopPropagation() : void 0,
|
|
841
|
+
onKeyDown: e.guideContent ? (e) => {
|
|
842
|
+
e.stopPropagation(), e.key === "Escape" && e.preventDefault();
|
|
843
|
+
} : void 0,
|
|
844
|
+
hidden: !0,
|
|
845
|
+
children: e.guideContent ?? e.target?.label.slice(0, 240)
|
|
684
846
|
})
|
|
685
847
|
]
|
|
686
|
-
}),
|
|
848
|
+
}), u)] });
|
|
849
|
+
}
|
|
850
|
+
//#endregion
|
|
851
|
+
//#region src/liquidRevealGeometry.ts
|
|
852
|
+
function J(e, n, r, a = 0, o = 1) {
|
|
853
|
+
let s = Math.max(44, e), c = Math.max(44, n), l = Math.min(28, (s - 12) / 2, (c - 12) / 2), u = i(6, 6, s - 12, c - 12, [
|
|
854
|
+
l,
|
|
855
|
+
l,
|
|
856
|
+
l,
|
|
857
|
+
l
|
|
858
|
+
], {
|
|
859
|
+
amplitude: (r ? 8 : 11) * Math.min(1.25, Math.max(.25, Number.isFinite(o) ? o : 1)),
|
|
860
|
+
lobes: 3,
|
|
861
|
+
seed: 17,
|
|
862
|
+
phase: a
|
|
863
|
+
}), d = Math.max(0, l - 2.5);
|
|
864
|
+
return {
|
|
865
|
+
outline: u,
|
|
866
|
+
ribbon: `${u} ${t(8.5, 8.5, s - 17, c - 17, [
|
|
867
|
+
d,
|
|
868
|
+
d,
|
|
869
|
+
d,
|
|
870
|
+
d
|
|
871
|
+
])}`
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
//#endregion
|
|
875
|
+
//#region src/useLiquidRevealAmbient.ts
|
|
876
|
+
function Y(t, n, i, o, s, l = 1, u = 1) {
|
|
877
|
+
let f = d(0);
|
|
878
|
+
return c(() => {
|
|
879
|
+
let c = t.current;
|
|
880
|
+
if (!c || !n || !i || !o) {
|
|
881
|
+
c && (c.dataset.revealAmbient = "static");
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
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 = (i + 24) * (o + 24), b = (t) => {
|
|
885
|
+
if (!d || !p || document.hidden) return;
|
|
886
|
+
let n = Math.min(160, Math.max(0, t - m));
|
|
887
|
+
m = t;
|
|
888
|
+
let x = document.querySelector("dialog:modal"), S = x && !x.contains(c) || ["drawing", "preparing"].includes(c.dataset.revealMotion ?? ""), C = a();
|
|
889
|
+
if (S || C.activeGroups > 0 || !e(y)) {
|
|
890
|
+
c.dataset.revealAmbient = "paused", h = te(b, 250);
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
try {
|
|
894
|
+
f.current += n * Math.PI * 2 * u / 1e4;
|
|
895
|
+
let e = J(i, o, s, f.current, l);
|
|
896
|
+
g?.setAttribute("d", e.outline), _?.setAttribute("d", e.outline), v?.setAttribute("d", e.ribbon), c.dataset.revealAmbient = "flowing";
|
|
897
|
+
} finally {
|
|
898
|
+
r();
|
|
899
|
+
}
|
|
900
|
+
h = te(b);
|
|
901
|
+
}, x = () => {
|
|
902
|
+
h(), m = performance.now(), c.dataset.revealAmbient = "paused", p && !document.hidden && (h = te(b));
|
|
903
|
+
}, S = typeof IntersectionObserver > "u" ? null : new IntersectionObserver((e) => {
|
|
904
|
+
p = e[0]?.isIntersecting ?? !1, x();
|
|
905
|
+
});
|
|
906
|
+
return S?.observe(c), document.addEventListener("visibilitychange", x), x(), () => {
|
|
907
|
+
d = !1, h(), S?.disconnect(), document.removeEventListener("visibilitychange", x), c.dataset.revealAmbient = "static";
|
|
908
|
+
};
|
|
909
|
+
}, [
|
|
910
|
+
t,
|
|
911
|
+
n,
|
|
912
|
+
i,
|
|
913
|
+
o,
|
|
914
|
+
s,
|
|
915
|
+
l,
|
|
916
|
+
u
|
|
917
|
+
]), f;
|
|
918
|
+
}
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/liquidRevealEntranceGeometry.ts
|
|
921
|
+
var X = (e) => {
|
|
922
|
+
let t = Math.min(1, Math.max(0, e));
|
|
923
|
+
return t * t * t * (10 + t * (-15 + 6 * t));
|
|
924
|
+
};
|
|
925
|
+
function Z(e, t, n, r, a, o, s = 1) {
|
|
926
|
+
let c = J(e, t, n, 0, s).outline;
|
|
927
|
+
return Array.from({ length: 49 }, (l, u) => {
|
|
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));
|
|
929
|
+
return {
|
|
930
|
+
d: `path("${d >= .95 ? c : i(E, D, w, T, [
|
|
931
|
+
O,
|
|
932
|
+
O,
|
|
933
|
+
O,
|
|
934
|
+
O
|
|
935
|
+
], {
|
|
936
|
+
amplitude: 1.2 + ((n ? 8 : 11) * s - 1.2) * h,
|
|
937
|
+
seed: 17,
|
|
938
|
+
lobes: 3,
|
|
939
|
+
phase: 0
|
|
940
|
+
})}")`,
|
|
941
|
+
offset: d
|
|
942
|
+
};
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
//#endregion
|
|
946
|
+
//#region src/useLiquidRevealEntrance.ts
|
|
947
|
+
function Q(t, n, i, a, o, s, c, l, f = 1) {
|
|
948
|
+
let p = d(null);
|
|
949
|
+
u(() => {
|
|
950
|
+
let u = t.current;
|
|
951
|
+
if (!u) return;
|
|
952
|
+
if (!n || s || u.contains(document.activeElement) || window.matchMedia("(forced-colors: active)").matches) {
|
|
953
|
+
p.current = i, u.dataset.revealMotion = "static";
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
if (p.current === i || (u.dataset.revealMotion = "preparing", !a || !o)) return;
|
|
957
|
+
let d = !0, m = !1, h = !1, g = 0, _ = 0, v = [], y = () => {
|
|
958
|
+
v.forEach((e) => e.cancel()), v.length = 0, m && r(), m = !1, u.dataset.revealMotion = h ? "settled" : "static";
|
|
959
|
+
}, b = () => {
|
|
960
|
+
if (!d) return;
|
|
961
|
+
if (getComputedStyle(u).visibility === "hidden") {
|
|
962
|
+
if (++_ < 12) {
|
|
963
|
+
g = requestAnimationFrame(b);
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
y();
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
let t = n.current?.getBoundingClientRect(), r = 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) || !t || !E(t) || document.hidden || typeof u.animate != "function" || !e((a + 24) * (o + 24))) {
|
|
971
|
+
y();
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
m = !0, h = !0, u.dataset.revealMotion = "drawing";
|
|
975
|
+
let C = r.width / a || 1, w = r.height / o || 1, T = {
|
|
976
|
+
x: (t.x + t.width / 2 - r.x) / C,
|
|
977
|
+
y: (t.y + t.height / 2 - r.y) / w
|
|
978
|
+
}, D = {
|
|
979
|
+
x: Math.min(a - 28, Math.max(28, T.x)),
|
|
980
|
+
y: T.y > o / 2 ? o - 28 : 28
|
|
981
|
+
}, O = {
|
|
982
|
+
x: -r.x / C,
|
|
983
|
+
y: -r.y / w,
|
|
984
|
+
width: innerWidth / C,
|
|
985
|
+
height: innerHeight / w
|
|
986
|
+
};
|
|
987
|
+
if (c && s && CSS.supports("d", "path(\"M0 0L1 1Z\")")) {
|
|
988
|
+
let e = Z(a, o, l, T, D, O, f);
|
|
989
|
+
v.push(s.animate(e, {
|
|
990
|
+
duration: 720,
|
|
991
|
+
fill: "both",
|
|
992
|
+
easing: "linear"
|
|
993
|
+
})), x && v.push(x.animate([
|
|
994
|
+
{ opacity: 0 },
|
|
995
|
+
{
|
|
996
|
+
opacity: 0,
|
|
997
|
+
offset: .93
|
|
998
|
+
},
|
|
999
|
+
{ opacity: 1 }
|
|
1000
|
+
], {
|
|
1001
|
+
duration: 720,
|
|
1002
|
+
fill: "both"
|
|
1003
|
+
})), S && v.push(S.animate([
|
|
1004
|
+
{ opacity: 0 },
|
|
1005
|
+
{
|
|
1006
|
+
opacity: 0,
|
|
1007
|
+
offset: .78
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
opacity: 1,
|
|
1011
|
+
offset: .98
|
|
1012
|
+
},
|
|
1013
|
+
{ opacity: 1 }
|
|
1014
|
+
], {
|
|
1015
|
+
duration: 720,
|
|
1016
|
+
fill: "both"
|
|
1017
|
+
}));
|
|
1018
|
+
} else x && v.push(x.animate([{ opacity: .2 }, { opacity: 1 }], { duration: 180 }));
|
|
1019
|
+
let k = n.current?.querySelector(".game-ui-liquid-presence > svg");
|
|
1020
|
+
k && v.push(k.animate([
|
|
1021
|
+
{ transform: "scale(1)" },
|
|
1022
|
+
{
|
|
1023
|
+
transform: "scale(1.05, .9)",
|
|
1024
|
+
offset: .22
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
transform: "scale(.96, 1.04)",
|
|
1028
|
+
offset: .5
|
|
1029
|
+
},
|
|
1030
|
+
{ transform: "scale(1)" }
|
|
1031
|
+
], {
|
|
1032
|
+
duration: 440,
|
|
1033
|
+
easing: "ease-in-out"
|
|
1034
|
+
})), Promise.all(v.map((e) => e.finished)).then(y, y);
|
|
1035
|
+
};
|
|
1036
|
+
g = requestAnimationFrame(b);
|
|
1037
|
+
let x = () => {
|
|
1038
|
+
cancelAnimationFrame(g), y();
|
|
1039
|
+
}, S = () => {
|
|
1040
|
+
document.hidden && x();
|
|
1041
|
+
};
|
|
1042
|
+
return u.addEventListener("focusin", x), u.addEventListener("pointerdown", x, !0), document.addEventListener("visibilitychange", S), window.addEventListener("resize", x), window.addEventListener("scroll", x, !0), () => {
|
|
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);
|
|
1044
|
+
};
|
|
1045
|
+
}, [
|
|
1046
|
+
t,
|
|
1047
|
+
n,
|
|
1048
|
+
i,
|
|
1049
|
+
a,
|
|
1050
|
+
o,
|
|
1051
|
+
s,
|
|
1052
|
+
c,
|
|
1053
|
+
l,
|
|
1054
|
+
f
|
|
1055
|
+
]);
|
|
1056
|
+
}
|
|
1057
|
+
//#endregion
|
|
1058
|
+
//#region src/LiquidReveal.tsx
|
|
1059
|
+
function de({ children: e, source: t, revealKey: r = "initial", variant: i = "content", surface: o = "dark", reducedMotion: c, idleMotion: p = "still", colorFrom: m, colorTo: _, motionIntensity: v = 1, motionSpeed: y = 1, className: b = "" }) {
|
|
1060
|
+
let x = s() || c === !0, S = T(v, .25, 1.25), C = T(y, .5, 1.5), w = d(null), [E, D] = f({
|
|
1061
|
+
width: 0,
|
|
1062
|
+
height: 0
|
|
1063
|
+
}), O = `liquid-reveal-${l().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
1064
|
+
u(() => {
|
|
1065
|
+
let e = w.current;
|
|
1066
|
+
if (!e) return;
|
|
1067
|
+
let t = () => {
|
|
1068
|
+
let t = e.clientWidth, n = e.clientHeight;
|
|
1069
|
+
D((e) => e.width === t && e.height === n ? e : {
|
|
1070
|
+
width: t,
|
|
1071
|
+
height: n
|
|
1072
|
+
});
|
|
1073
|
+
};
|
|
1074
|
+
t();
|
|
1075
|
+
let n = new ResizeObserver(t);
|
|
1076
|
+
return n.observe(e), () => n.disconnect();
|
|
1077
|
+
}, []), Q(w, t, r, E.width, E.height, x, o === "material", i === "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, i === "input", S, C), j = J(k, A, i === "input", ee.current, S), M = (k + 24) * (A + 24) <= a().maxFilterArea;
|
|
1079
|
+
return /* @__PURE__ */ g("div", {
|
|
1080
|
+
ref: w,
|
|
1081
|
+
className: `game-ui-liquid-reveal ${b}`,
|
|
1082
|
+
style: {
|
|
1083
|
+
...m ? { "--liquid-presence-from": m } : {},
|
|
1084
|
+
..._ ? { "--liquid-presence-to": _ } : {}
|
|
1085
|
+
},
|
|
1086
|
+
"data-reveal-variant": i,
|
|
1087
|
+
"data-reveal-surface": o,
|
|
1088
|
+
"data-reveal-filter": M ? "volume" : "flat",
|
|
1089
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1090
|
+
className: "game-ui-liquid-reveal-content",
|
|
1091
|
+
children: e
|
|
1092
|
+
}), E.width > 0 && /* @__PURE__ */ g("svg", {
|
|
1093
|
+
className: "game-ui-liquid-reveal-ink",
|
|
1094
|
+
width: k,
|
|
1095
|
+
height: A,
|
|
1096
|
+
viewBox: `0 0 ${k} ${A}`,
|
|
1097
|
+
"aria-hidden": "true",
|
|
1098
|
+
focusable: "false",
|
|
1099
|
+
children: [
|
|
1100
|
+
/* @__PURE__ */ g("defs", { children: [/* @__PURE__ */ g("linearGradient", {
|
|
1101
|
+
id: `${O}-fill`,
|
|
1102
|
+
x1: "0",
|
|
1103
|
+
y1: "0",
|
|
1104
|
+
x2: "1",
|
|
1105
|
+
y2: "1",
|
|
1106
|
+
children: [/* @__PURE__ */ h("stop", {
|
|
1107
|
+
offset: "0",
|
|
1108
|
+
stopColor: "var(--liquid-presence-from, var(--game-ui-secondary))"
|
|
1109
|
+
}), /* @__PURE__ */ h("stop", {
|
|
1110
|
+
offset: "1",
|
|
1111
|
+
stopColor: "var(--liquid-presence-to, var(--game-ui-secondary))"
|
|
1112
|
+
})]
|
|
1113
|
+
}), /* @__PURE__ */ h("filter", {
|
|
1114
|
+
id: `${O}-finish`,
|
|
1115
|
+
x: "-12",
|
|
1116
|
+
y: "-12",
|
|
1117
|
+
width: k + 24,
|
|
1118
|
+
height: A + 24,
|
|
1119
|
+
filterUnits: "userSpaceOnUse",
|
|
1120
|
+
colorInterpolationFilters: "sRGB",
|
|
1121
|
+
children: /* @__PURE__ */ h(n, {
|
|
1122
|
+
blur: 1.2,
|
|
1123
|
+
contrast: 18,
|
|
1124
|
+
gloss: 3.5,
|
|
1125
|
+
shadows: [],
|
|
1126
|
+
stroke: null,
|
|
1127
|
+
waviness: 0
|
|
1128
|
+
})
|
|
1129
|
+
})] }),
|
|
1130
|
+
o === "material" && /* @__PURE__ */ h("path", {
|
|
1131
|
+
"data-reveal-body": "",
|
|
1132
|
+
d: j.outline,
|
|
1133
|
+
fill: `url(#${O}-fill)`
|
|
1134
|
+
}),
|
|
1135
|
+
/* @__PURE__ */ g("g", {
|
|
1136
|
+
"data-reveal-material": "",
|
|
1137
|
+
filter: M ? `url(#${O}-finish)` : void 0,
|
|
1138
|
+
children: [/* @__PURE__ */ h("path", {
|
|
1139
|
+
"data-reveal-ribbon": "",
|
|
1140
|
+
d: j.ribbon,
|
|
1141
|
+
fillRule: "evenodd",
|
|
1142
|
+
fill: `url(#${O}-fill)`
|
|
1143
|
+
}), /* @__PURE__ */ h("path", {
|
|
1144
|
+
"data-reveal-outline": "",
|
|
1145
|
+
d: j.outline,
|
|
1146
|
+
pathLength: "1",
|
|
1147
|
+
fill: "none",
|
|
1148
|
+
stroke: `url(#${O}-fill)`,
|
|
1149
|
+
strokeWidth: "1.2",
|
|
1150
|
+
strokeLinecap: "round"
|
|
1151
|
+
})]
|
|
1152
|
+
})
|
|
1153
|
+
]
|
|
1154
|
+
})]
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
//#endregion
|
|
1158
|
+
//#region src/LiquidAnchor.tsx
|
|
1159
|
+
function fe({ source: e, children: t, placement: n = "top-end", onBoundsChange: r }) {
|
|
1160
|
+
let [i, a] = f(null), o = d(r);
|
|
1161
|
+
o.current = r;
|
|
1162
|
+
let [s, c] = f(null);
|
|
1163
|
+
return u(() => {
|
|
1164
|
+
c(e.current?.closest("dialog") ?? document.body);
|
|
1165
|
+
}, [e]), u(() => {
|
|
1166
|
+
let t = e.current, r = i;
|
|
1167
|
+
if (!t || !r) return;
|
|
1168
|
+
let a = (e) => {
|
|
1169
|
+
G(r, e), o.current?.(e);
|
|
1170
|
+
}, s = !0, c = 0, l = null, u = null, d = () => {
|
|
1171
|
+
let e = getComputedStyle(t);
|
|
1172
|
+
for (let t of Array.from(e)) if (t.startsWith("--game-ui-") || t.startsWith("--liquid-presence-")) {
|
|
1173
|
+
let n = e.getPropertyValue(t);
|
|
1174
|
+
r.style.getPropertyValue(t) !== n && r.style.setProperty(t, n);
|
|
1175
|
+
}
|
|
1176
|
+
let n = t.querySelector(".game-ui-liquid-presence");
|
|
1177
|
+
if (n) {
|
|
1178
|
+
let e = getComputedStyle(n);
|
|
1179
|
+
for (let t of ["--liquid-presence-from", "--liquid-presence-to"]) r.style.setProperty(t, e.getPropertyValue(t));
|
|
1180
|
+
}
|
|
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, {
|
|
1186
|
+
attributes: !0,
|
|
1187
|
+
attributeFilter: ["open"]
|
|
1188
|
+
}), o.parentNode && u.observe(o.parentNode, { childList: !0 }))), !t.isConnected || t.closest("[hidden], [inert], [aria-hidden=\"true\"]") || typeof t.checkVisibility == "function" && !t.checkVisibility({
|
|
1189
|
+
opacityProperty: !0,
|
|
1190
|
+
visibilityProperty: !0
|
|
1191
|
+
}) || i.width <= 0 || i.height <= 0 || o && !o.contains(t) && !r.contains(o)) {
|
|
1192
|
+
r.style.visibility = "hidden", a(null);
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
y(t, r, {
|
|
1196
|
+
strategy: "fixed",
|
|
1197
|
+
placement: n,
|
|
1198
|
+
middleware: [
|
|
1199
|
+
S(14),
|
|
1200
|
+
b({ padding: 12 }),
|
|
1201
|
+
C({
|
|
1202
|
+
padding: 12,
|
|
1203
|
+
crossAxis: !0
|
|
1204
|
+
}),
|
|
1205
|
+
w({
|
|
1206
|
+
padding: 12,
|
|
1207
|
+
apply({ availableHeight: e, availableWidth: t }) {
|
|
1208
|
+
r.dataset.liquidCompact = e < 500 ? "true" : "false", r.style.setProperty("--liquid-outlet-height", `${Math.max(0, e)}px`), r.style.maxWidth = `${Math.max(0, t)}px`;
|
|
1209
|
+
}
|
|
1210
|
+
}),
|
|
1211
|
+
x({ strategy: "referenceHidden" })
|
|
1212
|
+
]
|
|
1213
|
+
}).then(({ x: t, y: n, middlewareData: i }) => {
|
|
1214
|
+
if (!s || e !== c) return;
|
|
1215
|
+
if (i.hide?.referenceHidden) {
|
|
1216
|
+
r.style.visibility = "hidden", a(null);
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
r.style.left = `${t}px`, r.style.top = `${n}px`, r.style.visibility = "visible";
|
|
1220
|
+
let o = r.getBoundingClientRect();
|
|
1221
|
+
a({
|
|
1222
|
+
x: o.x,
|
|
1223
|
+
y: o.y,
|
|
1224
|
+
width: o.width,
|
|
1225
|
+
height: o.height
|
|
1226
|
+
});
|
|
1227
|
+
}).catch(() => {
|
|
1228
|
+
!s || e !== c || (r.style.visibility = "hidden", a(null));
|
|
1229
|
+
});
|
|
1230
|
+
};
|
|
1231
|
+
d();
|
|
1232
|
+
let p = v(t, r, f), m = new MutationObserver(() => {
|
|
1233
|
+
d(), f();
|
|
1234
|
+
});
|
|
1235
|
+
for (let e = t; e; e = e.parentElement) m.observe(e, {
|
|
1236
|
+
attributes: !0,
|
|
1237
|
+
attributeFilter: [
|
|
1238
|
+
"class",
|
|
1239
|
+
"style",
|
|
1240
|
+
"data-game-ui-theme",
|
|
1241
|
+
"hidden",
|
|
1242
|
+
"inert",
|
|
1243
|
+
"aria-hidden"
|
|
1244
|
+
]
|
|
1245
|
+
});
|
|
1246
|
+
let h = t.querySelector(".game-ui-liquid-presence");
|
|
1247
|
+
return h && m.observe(h, {
|
|
1248
|
+
attributes: !0,
|
|
1249
|
+
attributeFilter: [
|
|
1250
|
+
"class",
|
|
1251
|
+
"style",
|
|
1252
|
+
"data-activity"
|
|
1253
|
+
]
|
|
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);
|
|
1256
|
+
};
|
|
1257
|
+
}, [
|
|
1258
|
+
i,
|
|
1259
|
+
n,
|
|
1260
|
+
e
|
|
1261
|
+
]), s ? /* @__PURE__ */ h(_, {
|
|
1262
|
+
root: s,
|
|
1263
|
+
preserveTabOrder: !1,
|
|
1264
|
+
children: /* @__PURE__ */ h("div", {
|
|
1265
|
+
ref: a,
|
|
1266
|
+
className: "game-ui-liquid-anchor",
|
|
1267
|
+
style: {
|
|
1268
|
+
position: "fixed",
|
|
1269
|
+
top: 0,
|
|
1270
|
+
left: 0,
|
|
1271
|
+
visibility: "hidden"
|
|
1272
|
+
},
|
|
1273
|
+
children: t
|
|
1274
|
+
})
|
|
1275
|
+
}) : null;
|
|
687
1276
|
}
|
|
688
1277
|
//#endregion
|
|
689
|
-
export {
|
|
1278
|
+
export { fe as LiquidAnchor, q as LiquidPresence, de as LiquidReveal };
|