@pieai/swimmer-ui-kit 2.12.0 → 2.14.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 +37 -0
- package/README.md +10 -2
- package/dist/index.d.ts +105 -34
- package/dist/index.js +1142 -957
- package/dist/liquid-presence.css +1 -1
- package/dist/liquid-presence.js +224 -206
- package/dist/{liquidGooeySpring-WwyGKGPL.js → liquidGooeySpring-r7c1S2ZB.js} +12 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -1
package/dist/liquid-presence.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
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-
|
|
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-r7c1S2ZB.js";
|
|
2
2
|
import { useEffect as c, useId as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as g } from "react-dom";
|
|
5
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
|
-
|
|
6
|
+
//#region src/liquidMaterialLight.ts
|
|
7
|
+
var T = "var(--liquid-presence-from, var(--game-ui-secondary))", E = "var(--liquid-presence-to, var(--game-ui-secondary))", D = [
|
|
8
|
+
[0, `color-mix(in srgb, ${T}, white 18%)`],
|
|
9
|
+
[.16, `color-mix(in srgb, ${T}, white 9%)`],
|
|
10
|
+
[.55, `color-mix(in srgb, ${T}, ${E})`],
|
|
11
|
+
[1, `color-mix(in srgb, ${E}, black 5%)`]
|
|
12
|
+
];
|
|
13
|
+
function O(e, t, n) {
|
|
7
14
|
return Number.isFinite(e) ? Math.max(t, Math.min(n, e)) : t;
|
|
8
15
|
}
|
|
9
|
-
function
|
|
16
|
+
function k(e) {
|
|
10
17
|
return !!(e && [
|
|
11
18
|
e.x,
|
|
12
19
|
e.y,
|
|
@@ -14,23 +21,23 @@ function E(e) {
|
|
|
14
21
|
e.height
|
|
15
22
|
].every(Number.isFinite) && e.width > 0 && e.height > 0);
|
|
16
23
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
24
|
+
function A(e, t) {
|
|
25
|
+
return k(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
26
|
}
|
|
20
|
-
function
|
|
27
|
+
function j(e) {
|
|
21
28
|
return {
|
|
22
29
|
x: e.x + e.width / 2,
|
|
23
30
|
y: e.y + e.height / 2
|
|
24
31
|
};
|
|
25
32
|
}
|
|
26
|
-
function
|
|
33
|
+
function M(e, t) {
|
|
27
34
|
let n = Math.hypot(t.x - e.x, t.y - e.y) || 1;
|
|
28
35
|
return {
|
|
29
36
|
x: (t.x - e.x) / n,
|
|
30
37
|
y: (t.y - e.y) / n
|
|
31
38
|
};
|
|
32
39
|
}
|
|
33
|
-
function
|
|
40
|
+
function ee(e, t) {
|
|
34
41
|
let n = Math.max(e.x, t.x), r = Math.max(e.y, t.y);
|
|
35
42
|
return {
|
|
36
43
|
x: n,
|
|
@@ -39,19 +46,19 @@ function A(e, t) {
|
|
|
39
46
|
height: Math.max(0, Math.min(e.y + e.height, t.y + t.height) - r)
|
|
40
47
|
};
|
|
41
48
|
}
|
|
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 =
|
|
49
|
+
function N(e, t) {
|
|
50
|
+
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 = O(Math.max(0, a - i) * .58, 36, 84);
|
|
44
51
|
return {
|
|
45
|
-
x:
|
|
46
|
-
y:
|
|
52
|
+
x: O((i + a) / 2, t.x + o / 2 + 8, t.x + t.width - o / 2 - 8),
|
|
53
|
+
y: O(n ? e.y + e.height + 10 : e.y - 10, t.y + 18, t.y + t.height - 18),
|
|
47
54
|
side: r,
|
|
48
55
|
width: o
|
|
49
56
|
};
|
|
50
57
|
}
|
|
51
|
-
function
|
|
52
|
-
let i =
|
|
53
|
-
x:
|
|
54
|
-
y:
|
|
58
|
+
function P(e, t, n, r) {
|
|
59
|
+
let i = O(n, 0, 1), a = M(e, t), o = Math.min(86, Math.hypot(t.x - e.x, t.y - e.y) * .2), s = {
|
|
60
|
+
x: O((e.x + t.x) / 2 + a.y * o, r.x + 16, r.x + r.width - 16),
|
|
61
|
+
y: O((e.y + t.y) / 2 - a.x * o, r.y + 16, r.y + r.height - 16)
|
|
55
62
|
}, 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
63
|
return {
|
|
57
64
|
x: (1 - i) ** 2 * e.x + 2 * (1 - i) * i * s.x + i ** 2 * t.x,
|
|
@@ -59,22 +66,22 @@ function j(e, t, n, r) {
|
|
|
59
66
|
angle: Math.atan2(l, c) * 180 / Math.PI
|
|
60
67
|
};
|
|
61
68
|
}
|
|
62
|
-
function
|
|
63
|
-
let o =
|
|
69
|
+
function F(e = 0, t = 0, n = 0, r = 1, a = 0) {
|
|
70
|
+
let o = O(a, 0, 1), s = 66 * Math.sqrt(1 - .075 * O(n, 0, 1)) - o * 2.4;
|
|
64
71
|
return i(80 - s, 80 - s, s * 2, s * 2, [
|
|
65
72
|
s,
|
|
66
73
|
s,
|
|
67
74
|
s,
|
|
68
75
|
s
|
|
69
76
|
], {
|
|
70
|
-
amplitude: (3.5 + o * 9 +
|
|
77
|
+
amplitude: (3.5 + o * 9 + O(t, 0, 1) * 9) * O(r, .15, 1.25),
|
|
71
78
|
lobes: 3,
|
|
72
79
|
seed: 17,
|
|
73
80
|
phase: e
|
|
74
81
|
});
|
|
75
82
|
}
|
|
76
|
-
function
|
|
77
|
-
let r =
|
|
83
|
+
function I(e, t, n = 20) {
|
|
84
|
+
let r = O(t, 0, 1), a = O(n, 6, 48), o = a + (e - a) * r, s = a + (8 - a) * r;
|
|
78
85
|
return i(-o / 2, -s / 2, o, s, [
|
|
79
86
|
s / 2,
|
|
80
87
|
s / 2,
|
|
@@ -89,41 +96,41 @@ function N(e, t, n = 20) {
|
|
|
89
96
|
}
|
|
90
97
|
//#endregion
|
|
91
98
|
//#region src/liquidAmbientClock.ts
|
|
92
|
-
var
|
|
93
|
-
function
|
|
94
|
-
if (
|
|
95
|
-
let e = Math.min(...[...
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
var L = /* @__PURE__ */ new Map(), R, z, B = !1;
|
|
100
|
+
function V() {
|
|
101
|
+
if (B || z !== void 0 || (clearTimeout(R), R = void 0, !L.size)) return;
|
|
102
|
+
let e = Math.min(...[...L.values()].map((e) => e.at));
|
|
103
|
+
R = setTimeout(() => {
|
|
104
|
+
R = void 0, z = requestAnimationFrame((e) => {
|
|
105
|
+
z = void 0, B = !0;
|
|
99
106
|
try {
|
|
100
|
-
for (let [t, n] of [...
|
|
107
|
+
for (let [t, n] of [...L]) n.at > e + 1 || !L.has(t) || (L.delete(t), n.paint(e));
|
|
101
108
|
} finally {
|
|
102
|
-
|
|
109
|
+
B = !1, V();
|
|
103
110
|
}
|
|
104
111
|
});
|
|
105
112
|
}, Math.max(0, e - performance.now()));
|
|
106
113
|
}
|
|
107
114
|
function te(e, t = 1e3 / 12) {
|
|
108
115
|
let n = Symbol();
|
|
109
|
-
return
|
|
116
|
+
return L.set(n, {
|
|
110
117
|
at: performance.now() + t,
|
|
111
118
|
paint: e
|
|
112
|
-
}),
|
|
113
|
-
|
|
119
|
+
}), V(), () => {
|
|
120
|
+
L.delete(n), !L.size && z !== void 0 && (cancelAnimationFrame(z), z = void 0), V();
|
|
114
121
|
};
|
|
115
122
|
}
|
|
116
123
|
//#endregion
|
|
117
124
|
//#region src/liquidPresenceMotion.ts
|
|
118
|
-
var
|
|
125
|
+
var H = o("cubic-bezier(0.45, 0, 0.2, 1)");
|
|
119
126
|
function ne(e) {
|
|
120
127
|
let { source: t, destination: n, viewport: r, returning: i = !1, from: a, origin: o } = e, s = o?.seat == null ? 0 : 180;
|
|
121
128
|
if (s && e.elapsed < s) return {
|
|
122
129
|
...o,
|
|
123
130
|
phase: "gather",
|
|
124
|
-
seat: o.seat * (1 -
|
|
131
|
+
seat: o.seat * (1 - H(O(e.elapsed / s, 0, 1)))
|
|
125
132
|
};
|
|
126
|
-
let c = Math.max(0, e.elapsed - s), l =
|
|
133
|
+
let c = Math.max(0, e.elapsed - s), l = j(t), u = M(l, n), d = Math.atan2(u.y, u.x) * 180 / Math.PI, f = t.width / 160, p = {
|
|
127
134
|
x: l.x + u.x * 112 * f,
|
|
128
135
|
y: l.y + u.y * 112 * f
|
|
129
136
|
}, m = {
|
|
@@ -138,7 +145,7 @@ function ne(e) {
|
|
|
138
145
|
};
|
|
139
146
|
if (i) {
|
|
140
147
|
if (o?.bud) {
|
|
141
|
-
let e =
|
|
148
|
+
let e = H(O(c / 320, 0, 1)), t = o.bud.x + (80 - o.bud.x) * e, n = o.bud.y + (80 - o.bud.y) * e;
|
|
142
149
|
return {
|
|
143
150
|
...m,
|
|
144
151
|
phase: e < 1 ? "merge" : "still",
|
|
@@ -154,9 +161,9 @@ function ne(e) {
|
|
|
154
161
|
} : null
|
|
155
162
|
};
|
|
156
163
|
}
|
|
157
|
-
let e =
|
|
164
|
+
let e = O(c / 620, 0, 1);
|
|
158
165
|
if (e < 1) {
|
|
159
|
-
let t =
|
|
166
|
+
let t = P(a ?? n, p, H(e), r);
|
|
160
167
|
return {
|
|
161
168
|
...m,
|
|
162
169
|
phase: "return",
|
|
@@ -166,11 +173,11 @@ function ne(e) {
|
|
|
166
173
|
stretch: 1 + .3 * Math.sin(e * Math.PI)
|
|
167
174
|
};
|
|
168
175
|
}
|
|
169
|
-
let t =
|
|
176
|
+
let t = O((c - 620) / 420, 0, 1), i = 112 - 78 * H(t);
|
|
170
177
|
return {
|
|
171
178
|
...m,
|
|
172
179
|
phase: t < 1 ? "merge" : "still",
|
|
173
|
-
separation: 1 -
|
|
180
|
+
separation: 1 - H(t),
|
|
174
181
|
point: {
|
|
175
182
|
x: l.x + u.x * i * f,
|
|
176
183
|
y: l.y + u.y * i * f
|
|
@@ -178,13 +185,13 @@ function ne(e) {
|
|
|
178
185
|
bud: t < 1 ? {
|
|
179
186
|
x: 80 + u.x * i,
|
|
180
187
|
y: 80 + u.y * i,
|
|
181
|
-
radius: 16 * (1 - .65 *
|
|
188
|
+
radius: 16 * (1 - .65 * H(t))
|
|
182
189
|
} : null
|
|
183
190
|
};
|
|
184
191
|
}
|
|
185
192
|
let h = o?.phase === "split" ? o.bud : null, g = h ? o.separation : 0, _ = h ? Math.max(180, 460 * (1 - g)) : a ? 0 : 460;
|
|
186
193
|
if (c < _) {
|
|
187
|
-
let e =
|
|
194
|
+
let e = H(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;
|
|
188
195
|
return {
|
|
189
196
|
...m,
|
|
190
197
|
phase: "split",
|
|
@@ -200,9 +207,9 @@ function ne(e) {
|
|
|
200
207
|
}
|
|
201
208
|
};
|
|
202
209
|
}
|
|
203
|
-
let v = a ?? p, y = 560 + Math.min(260, Math.hypot(n.x - v.x, n.y - v.y) * .26), b =
|
|
210
|
+
let v = a ?? p, y = 560 + Math.min(260, Math.hypot(n.x - v.x, n.y - v.y) * .26), b = O((c - _) / y, 0, 1);
|
|
204
211
|
if (b < 1) {
|
|
205
|
-
let e =
|
|
212
|
+
let e = P(v, n, H(b), r);
|
|
206
213
|
return {
|
|
207
214
|
...m,
|
|
208
215
|
phase: "flight",
|
|
@@ -212,23 +219,23 @@ function ne(e) {
|
|
|
212
219
|
stretch: 1 + .35 * Math.sin(b * Math.PI)
|
|
213
220
|
};
|
|
214
221
|
}
|
|
215
|
-
let x =
|
|
222
|
+
let x = O((c - _ - y) / 380, 0, 1);
|
|
216
223
|
return {
|
|
217
224
|
...m,
|
|
218
225
|
phase: x < 1 ? "land" : "dock",
|
|
219
226
|
separation: 1,
|
|
220
227
|
point: n,
|
|
221
|
-
seat:
|
|
228
|
+
seat: H(x)
|
|
222
229
|
};
|
|
223
230
|
}
|
|
224
231
|
//#endregion
|
|
225
232
|
//#region src/liquidPresencePaint.ts
|
|
226
|
-
function
|
|
233
|
+
function U(e, t) {
|
|
227
234
|
e.toggleAttribute("hidden", !t);
|
|
228
235
|
let n = e.style, r = t ? "" : "none";
|
|
229
236
|
n.display !== r && (n.display = r);
|
|
230
237
|
}
|
|
231
|
-
var
|
|
238
|
+
var W = (e, t, n) => {
|
|
232
239
|
let r = String(n);
|
|
233
240
|
e.getAttribute(t) !== r && e.setAttribute(t, r);
|
|
234
241
|
};
|
|
@@ -240,26 +247,26 @@ function re(e, t, n) {
|
|
|
240
247
|
};
|
|
241
248
|
}
|
|
242
249
|
function ie(e, t, n, r, i = 0, a = 1, o = !1, s = 0) {
|
|
243
|
-
|
|
250
|
+
W(e.source, "data-liquid-phase", t.phase), W(e.overlay, "data-liquid-phase", t.phase), W(e.body, "d", F(r, i, t.separation, a, s));
|
|
244
251
|
let c = t.bud ? Math.sin(t.separation * Math.PI) * .045 : 0;
|
|
245
|
-
|
|
252
|
+
W(e.body, "transform", `translate(${((t.bud?.x ?? 80) - 80) * c} ${((t.bud?.y ?? 80) - 80) * c})`), U(e.bud, !!t.bud), t.bud && (W(e.bud, "cx", t.bud.x), W(e.bud, "cy", t.bud.y), W(e.bud, "r", t.bud.radius));
|
|
246
253
|
let l = t.phase === "flight" || t.phase === "return";
|
|
247
|
-
|
|
254
|
+
U(e.flight, l);
|
|
248
255
|
let u = re(e, t.point.x, t.point.y);
|
|
249
256
|
if (l) {
|
|
250
257
|
let n = t.diameter / 32;
|
|
251
|
-
e.flight.style.transform = `translate(${u.x - 48}px, ${u.y - 36}px)`,
|
|
258
|
+
e.flight.style.transform = `translate(${u.x - 48}px, ${u.y - 36}px)`, W(e.flightBody, "transform", `rotate(${t.angle}) scale(${n * t.stretch} ${n / Math.sqrt(t.stretch)})`), W(e.trail, "opacity", Math.min(.8, (t.stretch - 1) * 3));
|
|
252
259
|
}
|
|
253
|
-
|
|
260
|
+
U(e.seat, t.seat !== null), t.seat !== null && (e.seat.style.transform = `translate(${u.x - 56}px, ${u.y - 28}px)`, W(e.seatBody, "d", I(t.seatWidth ?? n, t.seat, t.diameter))), U(e.label, o || t.phase !== "gather" && t.seat !== null && t.seat > .45);
|
|
254
261
|
}
|
|
255
262
|
function ae(e, t, n, r) {
|
|
256
263
|
e.satellites.forEach((e, i) => {
|
|
257
|
-
if (
|
|
264
|
+
if (U(e, n), !n) return;
|
|
258
265
|
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
|
-
|
|
266
|
+
W(e, "cx", 80 + Math.cos(a) * o), W(e, "cy", 80 + Math.sin(a) * o), W(e, "r", 7 + i * 1.5);
|
|
260
267
|
});
|
|
261
268
|
}
|
|
262
|
-
function
|
|
269
|
+
function G() {
|
|
263
270
|
let e = window.visualViewport;
|
|
264
271
|
return {
|
|
265
272
|
x: e?.offsetLeft ?? 0,
|
|
@@ -277,7 +284,7 @@ function oe(e) {
|
|
|
277
284
|
let n = document.querySelector("dialog:modal");
|
|
278
285
|
if (n && (!t || !n.contains(t))) return null;
|
|
279
286
|
let r = e.getRect();
|
|
280
|
-
return
|
|
287
|
+
return k(r) && A(r, G()) ? r : null;
|
|
281
288
|
} catch {
|
|
282
289
|
return null;
|
|
283
290
|
}
|
|
@@ -344,27 +351,27 @@ function se(e, t, n, r) {
|
|
|
344
351
|
}
|
|
345
352
|
//#endregion
|
|
346
353
|
//#region src/liquidPanelObstacles.ts
|
|
347
|
-
var
|
|
348
|
-
function
|
|
349
|
-
let n =
|
|
354
|
+
var K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Set();
|
|
355
|
+
function J(e, t) {
|
|
356
|
+
let n = K.get(e), r = t && k(t) ? {
|
|
350
357
|
x: t.x,
|
|
351
358
|
y: t.y,
|
|
352
359
|
width: t.width,
|
|
353
360
|
height: t.height
|
|
354
361
|
} : null;
|
|
355
362
|
if (!(!n && !r || n && r && n.x === r.x && n.y === r.y && n.width === r.width && n.height === r.height)) {
|
|
356
|
-
r ?
|
|
357
|
-
for (let e of [...
|
|
363
|
+
r ? K.set(e, r) : K.delete(e);
|
|
364
|
+
for (let e of [...q]) try {
|
|
358
365
|
e();
|
|
359
366
|
} catch {}
|
|
360
367
|
}
|
|
361
368
|
}
|
|
362
369
|
function ce(e) {
|
|
363
|
-
return [...
|
|
370
|
+
return [...K].filter(([t]) => t.isConnected && !t.contains(e) && !e.contains(t)).map(([, e]) => e);
|
|
364
371
|
}
|
|
365
372
|
function le(e) {
|
|
366
|
-
return
|
|
367
|
-
|
|
373
|
+
return q.add(e), () => {
|
|
374
|
+
q.delete(e);
|
|
368
375
|
};
|
|
369
376
|
}
|
|
370
377
|
function ue(e, t, n, r) {
|
|
@@ -372,7 +379,7 @@ function ue(e, t, n, r) {
|
|
|
372
379
|
if (!Number.isFinite(i + a) || i <= 0 || a <= 0) return null;
|
|
373
380
|
let o = n.x + 12, s = n.y + 12, c = n.x + n.width - i - 12, l = n.y + n.height - a - 12;
|
|
374
381
|
if (c < o || l < s) return null;
|
|
375
|
-
let u = r.filter(
|
|
382
|
+
let u = r.filter(k), d = [
|
|
376
383
|
e.x,
|
|
377
384
|
o,
|
|
378
385
|
c
|
|
@@ -396,7 +403,7 @@ function ue(e, t, n, r) {
|
|
|
396
403
|
}
|
|
397
404
|
//#endregion
|
|
398
405
|
//#region src/useLiquidPresenceMotion.ts
|
|
399
|
-
function
|
|
406
|
+
function Y(e, i, a, o) {
|
|
400
407
|
let s = d(a);
|
|
401
408
|
s.current = a;
|
|
402
409
|
let l = !!a.guideContent, u = d(null), f = d(null), p = d(null), m = d(0), h = d(+(a.idleMotion === "breathe")), g = d(() => {});
|
|
@@ -423,17 +430,17 @@ function K(e, i, a, o) {
|
|
|
423
430
|
"land",
|
|
424
431
|
"gather",
|
|
425
432
|
"return"
|
|
426
|
-
].includes(d.phase) ? d.point : void 0, x = d?.point ??
|
|
433
|
+
].includes(d.phase) ? d.point : void 0, x = d?.point ?? j(a.getBoundingClientRect()), T = d?.seatWidth ?? 48, E = d ?? void 0, D = a.getBoundingClientRect(), k = performance.now(), M = null, P = () => {}, F = !0, I = !1, L = !1, R = !0, z = 0, B = m.current, V = performance.now(), H = 0, W = 0, re = null, K = () => {}, q, J = () => {
|
|
427
434
|
I && n(), I = !1;
|
|
428
435
|
}, Y = (e) => {
|
|
429
436
|
if (l) {
|
|
430
|
-
f.current = l.key, l = null, _ = !!(u.current && u.current.phase !== "still"),
|
|
437
|
+
f.current = l.key, l = null, _ = !!(u.current && u.current.phase !== "still"), E = u.current ?? void 0, v = u.current?.point, x = v ?? x, k = performance.now(), K(), clearTimeout(q), W++, U(c.label, !1);
|
|
431
438
|
try {
|
|
432
439
|
s.current.onDismiss?.(e);
|
|
433
440
|
} catch {}
|
|
434
441
|
$();
|
|
435
442
|
}
|
|
436
|
-
},
|
|
443
|
+
}, de = () => {
|
|
437
444
|
if (!l) return null;
|
|
438
445
|
let e = c.label.style.pointerEvents;
|
|
439
446
|
s.current.guideContent && (c.label.style.pointerEvents = "none");
|
|
@@ -442,18 +449,18 @@ function K(e, i, a, o) {
|
|
|
442
449
|
} finally {
|
|
443
450
|
c.label.style.pointerEvents = e;
|
|
444
451
|
}
|
|
445
|
-
},
|
|
452
|
+
}, X = () => {
|
|
446
453
|
if (!l) return;
|
|
447
|
-
let e =
|
|
454
|
+
let e = de();
|
|
448
455
|
if (!e) {
|
|
449
456
|
Y("unavailable");
|
|
450
457
|
return;
|
|
451
458
|
}
|
|
452
|
-
let t =
|
|
459
|
+
let t = N(e, G()), n = ee(e, G()), r = (e) => O(e === "top" ? n.y - 10 : n.y + n.height + 10, G().y + 18, G().y + G().height - 18);
|
|
453
460
|
x = {
|
|
454
461
|
x: t.x,
|
|
455
|
-
y: r(
|
|
456
|
-
},
|
|
462
|
+
y: r(re ?? t.side)
|
|
463
|
+
}, T = t.width;
|
|
457
464
|
let i = {
|
|
458
465
|
...l.contextElement ? { contextElement: l.contextElement } : {},
|
|
459
466
|
getBoundingClientRect: () => ({
|
|
@@ -464,14 +471,14 @@ function K(e, i, a, o) {
|
|
|
464
471
|
right: n.x + n.width
|
|
465
472
|
})
|
|
466
473
|
}, 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",
|
|
474
|
+
o || (c.label.style.maxHeight = ""), s.current.guideContent && !c.label.style.transform && (c.label.style.visibility = "hidden", U(c.label, !0)), y(i, c.label, {
|
|
468
475
|
strategy: "absolute",
|
|
469
|
-
placement: o &&
|
|
476
|
+
placement: o && G().width >= 900 ? "right" : t.side,
|
|
470
477
|
middleware: [
|
|
471
478
|
S(26),
|
|
472
479
|
b({
|
|
473
480
|
padding: 16,
|
|
474
|
-
...o &&
|
|
481
|
+
...o && G().width >= 900 ? { fallbackPlacements: [
|
|
475
482
|
"left",
|
|
476
483
|
"bottom",
|
|
477
484
|
"top"
|
|
@@ -484,7 +491,7 @@ function K(e, i, a, o) {
|
|
|
484
491
|
...o ? [w({
|
|
485
492
|
padding: 16,
|
|
486
493
|
apply({ availableHeight: e, elements: t }) {
|
|
487
|
-
let n = `${Math.max(0, Math.min(560,
|
|
494
|
+
let n = `${Math.max(0, Math.min(560, G().height * .65, e))}px`;
|
|
488
495
|
t.floating.style.maxHeight !== n && (t.floating.style.maxHeight = n);
|
|
489
496
|
}
|
|
490
497
|
})] : []
|
|
@@ -499,55 +506,55 @@ function K(e, i, a, o) {
|
|
|
499
506
|
}, {
|
|
500
507
|
width: c.label.offsetWidth,
|
|
501
508
|
height: c.label.offsetHeight
|
|
502
|
-
},
|
|
509
|
+
}, G(), [...a, n]);
|
|
503
510
|
if (!t) {
|
|
504
511
|
c.label.style.visibility = "hidden";
|
|
505
512
|
return;
|
|
506
513
|
}
|
|
507
514
|
e = t.x, i = t.y;
|
|
508
515
|
}
|
|
509
|
-
c.label.style.transform = `translate(${e}px, ${i}px)`, c.label.style.visibility = "",
|
|
510
|
-
let s = r(
|
|
516
|
+
c.label.style.transform = `translate(${e}px, ${i}px)`, c.label.style.visibility = "", re = o.startsWith("top") ? "top" : o.startsWith("bottom") ? "bottom" : t.side;
|
|
517
|
+
let s = r(re);
|
|
511
518
|
x.y !== s && (x = {
|
|
512
519
|
x: t.x,
|
|
513
520
|
y: s
|
|
514
521
|
}, $());
|
|
515
522
|
}
|
|
516
523
|
}).catch(() => {});
|
|
517
|
-
},
|
|
524
|
+
}, Z = () => [
|
|
518
525
|
"connecting",
|
|
519
526
|
"listening",
|
|
520
527
|
"thinking",
|
|
521
528
|
"speaking",
|
|
522
529
|
"working"
|
|
523
|
-
].includes(s.current.activity ?? "idle"),
|
|
524
|
-
if (L = !1, s.current.reducedMotion || s.current.activity === "disabled" || document.hidden || !R || !
|
|
530
|
+
].includes(s.current.activity ?? "idle"), Q = () => s.current.idleMotion === "breathe" && (s.current.activity ?? "idle") === "idle", fe = () => {
|
|
531
|
+
if (L = !1, s.current.reducedMotion || s.current.activity === "disabled" || document.hidden || !R || !A(a.getBoundingClientRect(), G())) return !1;
|
|
525
532
|
let e = document.querySelector("dialog:modal");
|
|
526
533
|
if (e && !e.contains(a)) return !1;
|
|
527
534
|
let n = l?.contextElement?.closest("dialog") ?? null;
|
|
528
535
|
if (l && a.closest("dialog") !== n) return !1;
|
|
529
536
|
let i = 13184 + (a.getBoundingClientRect().width * 2) ** 2, o = r();
|
|
530
|
-
return o.maxAnimatedGroups === 0 || i > o.maxFilterArea ? (J(), !1) : !(l || _ ||
|
|
537
|
+
return o.maxAnimatedGroups === 0 || i > o.maxFilterArea ? (J(), !1) : !(l || _ || Z()) && Q() && !I && o.activeGroups > 0 ? (L = !0, !1) : (I ||= t(i), I);
|
|
531
538
|
};
|
|
532
539
|
function pe(e) {
|
|
533
540
|
if (!F || document.hidden) return;
|
|
534
541
|
let t = c.source.getBoundingClientRect();
|
|
535
542
|
if (!c.source.isConnected || c.source.closest("[hidden], [inert]") || t.width <= 0 || t.height <= 0) {
|
|
536
|
-
_ = !1, u.current = null, Y("unavailable"),
|
|
543
|
+
_ = !1, u.current = null, Y("unavailable"), U(c.label, !1), U(c.flight, !1), U(c.seat, !1), J();
|
|
537
544
|
return;
|
|
538
545
|
}
|
|
539
|
-
if (l && !
|
|
546
|
+
if (l && !de()) {
|
|
540
547
|
Y("unavailable");
|
|
541
548
|
return;
|
|
542
549
|
}
|
|
543
550
|
let n = fe(), r = ne({
|
|
544
|
-
elapsed: e -
|
|
545
|
-
source: _ ? t :
|
|
551
|
+
elapsed: e - k,
|
|
552
|
+
source: _ ? t : D,
|
|
546
553
|
destination: x,
|
|
547
|
-
viewport:
|
|
554
|
+
viewport: G(),
|
|
548
555
|
returning: _,
|
|
549
556
|
...v ? { from: v } : {},
|
|
550
|
-
...
|
|
557
|
+
...E ? { origin: E } : {}
|
|
551
558
|
});
|
|
552
559
|
!l && !_ && (r = {
|
|
553
560
|
...r,
|
|
@@ -563,45 +570,45 @@ function K(e, i, a, o) {
|
|
|
563
570
|
seat: l ? 1 : null,
|
|
564
571
|
separation: +!!l
|
|
565
572
|
}), _ && 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 &&
|
|
567
|
-
|
|
568
|
-
let f = typeof a == "number" ?
|
|
569
|
-
|
|
570
|
-
let g =
|
|
571
|
-
n && (i ||
|
|
572
|
-
let b = n &&
|
|
573
|
-
ie(c, r,
|
|
574
|
-
let C = n && (i ||
|
|
573
|
+
let i = !["still", "dock"].includes(r.phase), a = s.current.levelRef?.current, o = !i && Q(), d = Math.max(0, Math.min(160, e - V));
|
|
574
|
+
V = e;
|
|
575
|
+
let f = typeof a == "number" ? O(a, 0, 1) : 0;
|
|
576
|
+
H += (f - H) * (1 - Math.exp(-d / (f > H ? 65 : 140)));
|
|
577
|
+
let g = O(s.current.motionSpeed ?? 1, .5, 1.5), y = O(s.current.motionIntensity ?? 1, .25, 1.25);
|
|
578
|
+
n && (i || Z() || o) && (B += d * (o ? 84e-5 : .00105) * g), m.current = B, n && (i || Z() || o) && (h.current += (+!!o - h.current) * (1 - Math.exp(-d / 500)));
|
|
579
|
+
let b = n && Z() && !i ? .14 + H * .75 : i ? .2 : 0, S = c.label.hasAttribute("hidden");
|
|
580
|
+
ie(c, r, T, B, b, y, !!(s.current.guideContent && l), h.current), ae(c, B, n && s.current.splashes !== !1 && s.current.activity === "speaking" && r.phase === "still", H);
|
|
581
|
+
let C = n && (i || Z()) ? "animated" : n && o ? "ambient" : "static";
|
|
575
582
|
c.source.dataset.liquidMotion !== C && (c.source.dataset.liquidMotion = C), u.current = {
|
|
576
583
|
...r,
|
|
577
|
-
seatWidth: r.phase === "gather" ?
|
|
578
|
-
}, l && S && !c.label.hasAttribute("hidden") &&
|
|
584
|
+
seatWidth: r.phase === "gather" ? E?.seatWidth ?? T : T
|
|
585
|
+
}, l && S && !c.label.hasAttribute("hidden") && X(), n && (i || Z()) ? M = requestAnimationFrame(me) : (J(), o && (n || L) && (P = te(() => {
|
|
579
586
|
P = () => {}, F && !document.hidden && R && me(performance.now());
|
|
580
587
|
}, L ? 250 : 1e3 / 12)));
|
|
581
588
|
}
|
|
582
589
|
function me(e) {
|
|
583
|
-
if (
|
|
590
|
+
if (M = null, !F || document.hidden) {
|
|
584
591
|
J();
|
|
585
592
|
return;
|
|
586
593
|
}
|
|
587
594
|
if ((u.current?.phase === "still" || u.current?.phase === "dock") && e - z < 32) {
|
|
588
|
-
|
|
595
|
+
M = requestAnimationFrame(me);
|
|
589
596
|
return;
|
|
590
597
|
}
|
|
591
598
|
z = e, pe(e);
|
|
592
599
|
}
|
|
593
600
|
function $() {
|
|
594
|
-
!F ||
|
|
601
|
+
!F || M !== null || document.hidden || (P(), P = () => {}, pe(performance.now()));
|
|
595
602
|
}
|
|
596
603
|
g.current = $;
|
|
597
604
|
let he = () => {
|
|
598
605
|
if (K(), K = () => {}, !l || document.hidden) return;
|
|
599
606
|
let e = se(c.source, l, c.label, () => {
|
|
600
|
-
|
|
607
|
+
X(), $();
|
|
601
608
|
});
|
|
602
609
|
K = e, l || e();
|
|
603
610
|
};
|
|
604
|
-
l && (
|
|
611
|
+
l && (X(), l && (he(), l && !s.current.guideContent && (q = setTimeout(() => Y("expired"), 12e3))));
|
|
605
612
|
let ge = (e) => {
|
|
606
613
|
if (e.key === "Escape" && !e.isComposing && l) {
|
|
607
614
|
if (s.current.guideContent && e.target instanceof Node && c.label.contains(e.target)) return;
|
|
@@ -612,16 +619,16 @@ function K(e, i, a, o) {
|
|
|
612
619
|
}, _e = (e) => {
|
|
613
620
|
s.current.dismissOnTargetClick !== !1 && l?.contextElement && e.target instanceof Node && l.contextElement.contains(e.target) && Y("dismissed");
|
|
614
621
|
}, ve = () => {
|
|
615
|
-
document.hidden ? (P(), P = () => {},
|
|
622
|
+
document.hidden ? (P(), P = () => {}, M !== null && cancelAnimationFrame(M), M = null, K(), W++, J()) : (V = performance.now(), he(), $());
|
|
616
623
|
}, ye = typeof IntersectionObserver > "u" ? null : new IntersectionObserver((e) => {
|
|
617
|
-
R = e[0]?.isIntersecting ?? !0, R || (P(), P = () => {},
|
|
624
|
+
R = e[0]?.isIntersecting ?? !0, R || (P(), P = () => {}, M !== null && cancelAnimationFrame(M), M = null, J()), $();
|
|
618
625
|
});
|
|
619
626
|
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
627
|
let be = le(() => {
|
|
621
|
-
|
|
628
|
+
X(), $();
|
|
622
629
|
});
|
|
623
630
|
return $(), () => {
|
|
624
|
-
F = !1, g.current = () => {}, W++,
|
|
631
|
+
F = !1, g.current = () => {}, W++, M !== null && cancelAnimationFrame(M), 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);
|
|
625
632
|
};
|
|
626
633
|
}, [
|
|
627
634
|
e,
|
|
@@ -642,8 +649,8 @@ function K(e, i, a, o) {
|
|
|
642
649
|
}
|
|
643
650
|
//#endregion
|
|
644
651
|
//#region src/LiquidPresence.tsx
|
|
645
|
-
function
|
|
646
|
-
let n = e() || t.reducedMotion === !0, r =
|
|
652
|
+
function de(t) {
|
|
653
|
+
let n = e() || t.reducedMotion === !0, r = O(t.size ?? 64, 32, 224), i = `presence-${l().replace(/[^a-zA-Z0-9_-]/g, "")}`, a = d(null), o = d(null), [u, _] = f(null);
|
|
647
654
|
c(() => {
|
|
648
655
|
let e = t.target?.contextElement?.closest("dialog");
|
|
649
656
|
_(e ?? a.current?.closest("dialog") ?? document.body);
|
|
@@ -688,7 +695,7 @@ function q(t) {
|
|
|
688
695
|
return r(), window.addEventListener("resize", r, { passive: !0 }), () => {
|
|
689
696
|
i.disconnect(), window.removeEventListener("resize", r);
|
|
690
697
|
};
|
|
691
|
-
}, [u]),
|
|
698
|
+
}, [u]), Y(a, o, {
|
|
692
699
|
...t,
|
|
693
700
|
size: r,
|
|
694
701
|
reducedMotion: n
|
|
@@ -702,26 +709,23 @@ function q(t) {
|
|
|
702
709
|
"--liquid-presence-from": "var(--game-ui-warning)",
|
|
703
710
|
"--liquid-presence-to": "var(--game-ui-warning)"
|
|
704
711
|
} : {}
|
|
705
|
-
}, y = (e, t) => /* @__PURE__ */
|
|
712
|
+
}, y = (e, t) => /* @__PURE__ */ h("defs", { children: [/* @__PURE__ */ m("linearGradient", {
|
|
706
713
|
id: `${i}-${e}-fill`,
|
|
707
714
|
gradientUnits: "userSpaceOnUse",
|
|
708
|
-
x1:
|
|
715
|
+
x1: 0,
|
|
709
716
|
y1: e === "core" ? 16 : -18,
|
|
710
|
-
x2:
|
|
717
|
+
x2: 0,
|
|
711
718
|
y2: e === "core" ? 146 : 18,
|
|
712
|
-
children: [/* @__PURE__ */
|
|
713
|
-
offset:
|
|
714
|
-
stopColor:
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
stopColor: "var(--liquid-presence-to, var(--game-ui-secondary))"
|
|
718
|
-
})]
|
|
719
|
-
}), /* @__PURE__ */ h("filter", {
|
|
719
|
+
children: D.map(([e, t]) => /* @__PURE__ */ m("stop", {
|
|
720
|
+
offset: e,
|
|
721
|
+
style: { stopColor: t }
|
|
722
|
+
}, e))
|
|
723
|
+
}), /* @__PURE__ */ m("filter", {
|
|
720
724
|
id: `${i}-${e}-goo`,
|
|
721
725
|
filterUnits: "userSpaceOnUse",
|
|
722
726
|
...t,
|
|
723
727
|
colorInterpolationFilters: "sRGB",
|
|
724
|
-
children: /* @__PURE__ */
|
|
728
|
+
children: /* @__PURE__ */ m(s, {
|
|
725
729
|
blur: e === "core" ? 5 : 2,
|
|
726
730
|
contrast: 18,
|
|
727
731
|
gloss: 3.5,
|
|
@@ -730,13 +734,13 @@ function q(t) {
|
|
|
730
734
|
waviness: 0
|
|
731
735
|
})
|
|
732
736
|
})] });
|
|
733
|
-
return /* @__PURE__ */
|
|
737
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("span", {
|
|
734
738
|
ref: a,
|
|
735
739
|
className: `game-ui-liquid-presence ${t.className ?? ""}`,
|
|
736
740
|
style: v,
|
|
737
741
|
"data-activity": t.activity ?? "idle",
|
|
738
742
|
"aria-hidden": "true",
|
|
739
|
-
children: /* @__PURE__ */
|
|
743
|
+
children: /* @__PURE__ */ h("svg", {
|
|
740
744
|
viewBox: "0 0 160 160",
|
|
741
745
|
focusable: "false",
|
|
742
746
|
children: [y("core", {
|
|
@@ -744,15 +748,15 @@ function q(t) {
|
|
|
744
748
|
y: -80,
|
|
745
749
|
width: 320,
|
|
746
750
|
height: 320
|
|
747
|
-
}), /* @__PURE__ */
|
|
751
|
+
}), /* @__PURE__ */ h("g", {
|
|
748
752
|
fill: `url(#${i}-core-fill)`,
|
|
749
753
|
filter: `url(#${i}-core-goo)`,
|
|
750
754
|
children: [
|
|
751
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ m("path", {
|
|
752
756
|
"data-presence-body": "",
|
|
753
|
-
d:
|
|
757
|
+
d: F()
|
|
754
758
|
}),
|
|
755
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ m("circle", {
|
|
756
760
|
"data-presence-bud": "",
|
|
757
761
|
cx: "80",
|
|
758
762
|
cy: "80",
|
|
@@ -763,7 +767,7 @@ function q(t) {
|
|
|
763
767
|
0,
|
|
764
768
|
1,
|
|
765
769
|
2
|
|
766
|
-
].map((e) => /* @__PURE__ */
|
|
770
|
+
].map((e) => /* @__PURE__ */ m("circle", {
|
|
767
771
|
"data-presence-satellite": "",
|
|
768
772
|
cx: "80",
|
|
769
773
|
cy: "80",
|
|
@@ -773,7 +777,7 @@ function q(t) {
|
|
|
773
777
|
]
|
|
774
778
|
})]
|
|
775
779
|
})
|
|
776
|
-
}), u &&
|
|
780
|
+
}), u && g(/* @__PURE__ */ h("div", {
|
|
777
781
|
ref: o,
|
|
778
782
|
className: "game-ui-liquid-presence-overlay",
|
|
779
783
|
style: {
|
|
@@ -783,7 +787,7 @@ function q(t) {
|
|
|
783
787
|
},
|
|
784
788
|
"data-presence-overlay": "",
|
|
785
789
|
children: [
|
|
786
|
-
/* @__PURE__ */
|
|
790
|
+
/* @__PURE__ */ h("svg", {
|
|
787
791
|
className: "game-ui-liquid-presence-flight",
|
|
788
792
|
viewBox: "-48 -36 96 72",
|
|
789
793
|
"aria-hidden": "true",
|
|
@@ -794,18 +798,18 @@ function q(t) {
|
|
|
794
798
|
y: -36,
|
|
795
799
|
width: 96,
|
|
796
800
|
height: 72
|
|
797
|
-
}), /* @__PURE__ */
|
|
801
|
+
}), /* @__PURE__ */ m("g", {
|
|
798
802
|
fill: `url(#${i}-flight-fill)`,
|
|
799
803
|
filter: `url(#${i}-flight-goo)`,
|
|
800
|
-
children: /* @__PURE__ */
|
|
804
|
+
children: /* @__PURE__ */ h("g", {
|
|
801
805
|
"data-presence-flight-body": "",
|
|
802
|
-
children: [/* @__PURE__ */
|
|
806
|
+
children: [/* @__PURE__ */ m("circle", { r: "16" }), /* @__PURE__ */ h("g", {
|
|
803
807
|
"data-presence-trail": "",
|
|
804
|
-
children: [/* @__PURE__ */
|
|
808
|
+
children: [/* @__PURE__ */ m("circle", {
|
|
805
809
|
cx: "-27",
|
|
806
810
|
cy: "5",
|
|
807
811
|
r: "4.5"
|
|
808
|
-
}), /* @__PURE__ */
|
|
812
|
+
}), /* @__PURE__ */ m("circle", {
|
|
809
813
|
cx: "-36",
|
|
810
814
|
cy: "8",
|
|
811
815
|
r: "2.5"
|
|
@@ -814,7 +818,7 @@ function q(t) {
|
|
|
814
818
|
})
|
|
815
819
|
})]
|
|
816
820
|
}),
|
|
817
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ h("svg", {
|
|
818
822
|
className: "game-ui-liquid-presence-seat",
|
|
819
823
|
viewBox: "-56 -28 112 56",
|
|
820
824
|
"aria-hidden": "true",
|
|
@@ -825,14 +829,14 @@ function q(t) {
|
|
|
825
829
|
y: -28,
|
|
826
830
|
width: 112,
|
|
827
831
|
height: 56
|
|
828
|
-
}), /* @__PURE__ */
|
|
832
|
+
}), /* @__PURE__ */ m("path", {
|
|
829
833
|
"data-presence-seat-body": "",
|
|
830
|
-
d:
|
|
834
|
+
d: I(48, 1),
|
|
831
835
|
fill: `url(#${i}-seat-fill)`,
|
|
832
836
|
filter: `url(#${i}-seat-goo)`
|
|
833
837
|
})]
|
|
834
838
|
}),
|
|
835
|
-
/* @__PURE__ */
|
|
839
|
+
/* @__PURE__ */ m("div", {
|
|
836
840
|
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
841
|
role: t.guideContent ? void 0 : "status",
|
|
838
842
|
"aria-atomic": !t.guideContent || void 0,
|
|
@@ -849,7 +853,7 @@ function q(t) {
|
|
|
849
853
|
}
|
|
850
854
|
//#endregion
|
|
851
855
|
//#region src/liquidRevealGeometry.ts
|
|
852
|
-
function
|
|
856
|
+
function X(e, t, n, r = 0, o = 1) {
|
|
853
857
|
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, [
|
|
854
858
|
l,
|
|
855
859
|
l,
|
|
@@ -873,7 +877,7 @@ function J(e, t, n, r = 0, o = 1) {
|
|
|
873
877
|
}
|
|
874
878
|
//#endregion
|
|
875
879
|
//#region src/useLiquidRevealAmbient.ts
|
|
876
|
-
function
|
|
880
|
+
function Z(e, i, a, o, s, l = 1, u = 1) {
|
|
877
881
|
let f = d(0);
|
|
878
882
|
return c(() => {
|
|
879
883
|
let c = e.current;
|
|
@@ -892,7 +896,7 @@ function Y(e, i, a, o, s, l = 1, u = 1) {
|
|
|
892
896
|
}
|
|
893
897
|
try {
|
|
894
898
|
f.current += i * Math.PI * 2 * u / 1e4;
|
|
895
|
-
let e =
|
|
899
|
+
let e = X(a, o, s, f.current, l);
|
|
896
900
|
g?.setAttribute("d", e.outline), _?.setAttribute("d", e.outline), v?.setAttribute("d", e.ribbon), c.dataset.revealAmbient = "flowing";
|
|
897
901
|
} finally {
|
|
898
902
|
n();
|
|
@@ -918,14 +922,14 @@ function Y(e, i, a, o, s, l = 1, u = 1) {
|
|
|
918
922
|
}
|
|
919
923
|
//#endregion
|
|
920
924
|
//#region src/liquidRevealEntranceGeometry.ts
|
|
921
|
-
var
|
|
925
|
+
var Q = (e) => {
|
|
922
926
|
let t = Math.min(1, Math.max(0, e));
|
|
923
927
|
return t * t * t * (10 + t * (-15 + 6 * t));
|
|
924
928
|
};
|
|
925
|
-
function
|
|
926
|
-
let c =
|
|
929
|
+
function fe(e, t, n, r, a, o, s = 1) {
|
|
930
|
+
let c = X(e, t, n, 0, s).outline;
|
|
927
931
|
return Array.from({ length: 49 }, (l, u) => {
|
|
928
|
-
let d = u / 48, f =
|
|
932
|
+
let d = u / 48, f = Q((d - .08) / .34), p = P(r, a, f, o), m = Q((d - .39) / .46), h = Q((d - .47) / .46), g = Q((d - .3) / .14) * (1 - m), _ = 8 + 20 * Q(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
933
|
return {
|
|
930
934
|
d: `path("${d >= .95 ? c : i(E, D, w, T, [
|
|
931
935
|
O,
|
|
@@ -944,7 +948,7 @@ function Z(e, t, n, r, a, o, s = 1) {
|
|
|
944
948
|
}
|
|
945
949
|
//#endregion
|
|
946
950
|
//#region src/useLiquidRevealEntrance.ts
|
|
947
|
-
function
|
|
951
|
+
function pe(e, r, i, a, o, s, c, l, f = 1) {
|
|
948
952
|
let p = d(null);
|
|
949
953
|
u(() => {
|
|
950
954
|
let u = e.current;
|
|
@@ -967,7 +971,7 @@ function Q(e, r, i, a, o, s, c, l, f = 1) {
|
|
|
967
971
|
return;
|
|
968
972
|
}
|
|
969
973
|
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 || !
|
|
974
|
+
if (p.current = i, u.contains(document.activeElement) || !e || !k(e) || document.hidden || typeof u.animate != "function" || !t((a + 24) * (o + 24))) {
|
|
971
975
|
y();
|
|
972
976
|
return;
|
|
973
977
|
}
|
|
@@ -975,17 +979,17 @@ function Q(e, r, i, a, o, s, c, l, f = 1) {
|
|
|
975
979
|
let C = n.width / a || 1, w = n.height / o || 1, T = {
|
|
976
980
|
x: (e.x + e.width / 2 - n.x) / C,
|
|
977
981
|
y: (e.y + e.height / 2 - n.y) / w
|
|
978
|
-
},
|
|
982
|
+
}, E = {
|
|
979
983
|
x: Math.min(a - 28, Math.max(28, T.x)),
|
|
980
984
|
y: T.y > o / 2 ? o - 28 : 28
|
|
981
|
-
},
|
|
985
|
+
}, D = {
|
|
982
986
|
x: -n.x / C,
|
|
983
987
|
y: -n.y / w,
|
|
984
988
|
width: innerWidth / C,
|
|
985
989
|
height: innerHeight / w
|
|
986
990
|
};
|
|
987
991
|
if (c && s && CSS.supports("d", "path(\"M0 0L1 1Z\")")) {
|
|
988
|
-
let e =
|
|
992
|
+
let e = fe(a, o, l, T, E, D, f);
|
|
989
993
|
v.push(s.animate(e, {
|
|
990
994
|
duration: 720,
|
|
991
995
|
fill: "both",
|
|
@@ -1016,8 +1020,8 @@ function Q(e, r, i, a, o, s, c, l, f = 1) {
|
|
|
1016
1020
|
fill: "both"
|
|
1017
1021
|
}));
|
|
1018
1022
|
} else x && v.push(x.animate([{ opacity: .2 }, { opacity: 1 }], { duration: 180 }));
|
|
1019
|
-
let
|
|
1020
|
-
|
|
1023
|
+
let O = r.current?.querySelector(".game-ui-liquid-presence > svg");
|
|
1024
|
+
O && v.push(O.animate([
|
|
1021
1025
|
{ transform: "scale(1)" },
|
|
1022
1026
|
{
|
|
1023
1027
|
transform: "scale(1.05, .9)",
|
|
@@ -1056,17 +1060,17 @@ function Q(e, r, i, a, o, s, c, l, f = 1) {
|
|
|
1056
1060
|
}
|
|
1057
1061
|
//#endregion
|
|
1058
1062
|
//#region src/LiquidReveal.tsx
|
|
1059
|
-
function
|
|
1060
|
-
let
|
|
1063
|
+
function me({ children: t, source: n, revealKey: i = "initial", variant: a = "content", surface: o = "dark", reducedMotion: c, idleMotion: g = "still", colorFrom: _, colorTo: v, motionIntensity: y = 1, motionSpeed: b = 1, className: x = "" }) {
|
|
1064
|
+
let S = e() || c === !0, C = O(y, .25, 1.25), w = O(b, .5, 1.5), T = d(null), [E, k] = f({
|
|
1061
1065
|
width: 0,
|
|
1062
1066
|
height: 0
|
|
1063
|
-
}),
|
|
1067
|
+
}), A = `liquid-reveal-${l().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
1064
1068
|
u(() => {
|
|
1065
|
-
let e =
|
|
1069
|
+
let e = T.current;
|
|
1066
1070
|
if (!e) return;
|
|
1067
1071
|
let t = () => {
|
|
1068
1072
|
let t = e.clientWidth, n = e.clientHeight;
|
|
1069
|
-
|
|
1073
|
+
k((e) => e.width === t && e.height === n ? e : {
|
|
1070
1074
|
width: t,
|
|
1071
1075
|
height: n
|
|
1072
1076
|
});
|
|
@@ -1074,51 +1078,61 @@ function de({ children: t, source: n, revealKey: i = "initial", variant: a = "co
|
|
|
1074
1078
|
t();
|
|
1075
1079
|
let n = new ResizeObserver(t);
|
|
1076
1080
|
return n.observe(e), () => n.disconnect();
|
|
1077
|
-
}, []),
|
|
1078
|
-
let
|
|
1079
|
-
return /* @__PURE__ */
|
|
1080
|
-
ref:
|
|
1081
|
-
className: `game-ui-liquid-reveal ${
|
|
1081
|
+
}, []), pe(T, n, i, E.width, E.height, S, o === "material", a === "input", C);
|
|
1082
|
+
let j = Math.max(44, E.width), M = Math.max(44, E.height), ee = Z(T, !S && g === "breathe", E.width, E.height, a === "input", C, w), N = X(j, M, a === "input", ee.current, C), P = (j + 24) * (M + 24) <= r().maxFilterArea;
|
|
1083
|
+
return /* @__PURE__ */ h("div", {
|
|
1084
|
+
ref: T,
|
|
1085
|
+
className: `game-ui-liquid-reveal ${x}`,
|
|
1082
1086
|
style: {
|
|
1083
|
-
...
|
|
1084
|
-
...
|
|
1087
|
+
..._ ? { "--liquid-presence-from": _ } : {},
|
|
1088
|
+
...v ? { "--liquid-presence-to": v } : {}
|
|
1085
1089
|
},
|
|
1086
1090
|
"data-reveal-variant": a,
|
|
1087
1091
|
"data-reveal-surface": o,
|
|
1088
|
-
"data-reveal-filter":
|
|
1089
|
-
children: [/* @__PURE__ */
|
|
1092
|
+
"data-reveal-filter": P ? "volume" : "flat",
|
|
1093
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1090
1094
|
className: "game-ui-liquid-reveal-content",
|
|
1091
1095
|
children: t
|
|
1092
|
-
}), E.width > 0 && /* @__PURE__ */
|
|
1096
|
+
}), E.width > 0 && /* @__PURE__ */ h("svg", {
|
|
1093
1097
|
className: "game-ui-liquid-reveal-ink",
|
|
1094
|
-
width:
|
|
1095
|
-
height:
|
|
1096
|
-
viewBox: `0 0 ${
|
|
1098
|
+
width: j,
|
|
1099
|
+
height: M,
|
|
1100
|
+
viewBox: `0 0 ${j} ${M}`,
|
|
1097
1101
|
"aria-hidden": "true",
|
|
1098
1102
|
focusable: "false",
|
|
1099
1103
|
children: [
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
id: `${
|
|
1104
|
+
/* @__PURE__ */ h("defs", { children: [o === "material" ? /* @__PURE__ */ m("linearGradient", {
|
|
1105
|
+
id: `${A}-fill`,
|
|
1106
|
+
x1: "0",
|
|
1107
|
+
y1: "0",
|
|
1108
|
+
x2: "0",
|
|
1109
|
+
y2: "1",
|
|
1110
|
+
children: D.map(([e, t]) => /* @__PURE__ */ m("stop", {
|
|
1111
|
+
offset: e,
|
|
1112
|
+
style: { stopColor: t }
|
|
1113
|
+
}, e))
|
|
1114
|
+
}) : /* @__PURE__ */ h("linearGradient", {
|
|
1115
|
+
id: `${A}-fill`,
|
|
1102
1116
|
x1: "0",
|
|
1103
1117
|
y1: "0",
|
|
1104
1118
|
x2: "1",
|
|
1105
1119
|
y2: "1",
|
|
1106
|
-
children: [/* @__PURE__ */
|
|
1120
|
+
children: [/* @__PURE__ */ m("stop", {
|
|
1107
1121
|
offset: "0",
|
|
1108
1122
|
stopColor: "var(--liquid-presence-from, var(--game-ui-secondary))"
|
|
1109
|
-
}), /* @__PURE__ */
|
|
1123
|
+
}), /* @__PURE__ */ m("stop", {
|
|
1110
1124
|
offset: "1",
|
|
1111
1125
|
stopColor: "var(--liquid-presence-to, var(--game-ui-secondary))"
|
|
1112
1126
|
})]
|
|
1113
|
-
}), /* @__PURE__ */
|
|
1114
|
-
id: `${
|
|
1127
|
+
}), /* @__PURE__ */ m("filter", {
|
|
1128
|
+
id: `${A}-finish`,
|
|
1115
1129
|
x: "-12",
|
|
1116
1130
|
y: "-12",
|
|
1117
|
-
width:
|
|
1118
|
-
height:
|
|
1131
|
+
width: j + 24,
|
|
1132
|
+
height: M + 24,
|
|
1119
1133
|
filterUnits: "userSpaceOnUse",
|
|
1120
1134
|
colorInterpolationFilters: "sRGB",
|
|
1121
|
-
children: /* @__PURE__ */
|
|
1135
|
+
children: /* @__PURE__ */ m(s, {
|
|
1122
1136
|
blur: 1.2,
|
|
1123
1137
|
contrast: 18,
|
|
1124
1138
|
gloss: 3.5,
|
|
@@ -1127,28 +1141,32 @@ function de({ children: t, source: n, revealKey: i = "initial", variant: a = "co
|
|
|
1127
1141
|
waviness: 0
|
|
1128
1142
|
})
|
|
1129
1143
|
})] }),
|
|
1130
|
-
o === "material" && /* @__PURE__ */
|
|
1144
|
+
o === "material" && /* @__PURE__ */ m("path", {
|
|
1131
1145
|
"data-reveal-body": "",
|
|
1132
|
-
d:
|
|
1133
|
-
fill: `url(#${
|
|
1146
|
+
d: N.outline,
|
|
1147
|
+
fill: `url(#${A}-fill)`
|
|
1134
1148
|
}),
|
|
1135
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ m("g", {
|
|
1136
1150
|
"data-reveal-material": "",
|
|
1137
|
-
filter:
|
|
1138
|
-
children:
|
|
1151
|
+
filter: P ? `url(#${A}-finish)` : void 0,
|
|
1152
|
+
children: o === "material" ? /* @__PURE__ */ m("path", {
|
|
1153
|
+
"data-reveal-outline": "",
|
|
1154
|
+
d: N.outline,
|
|
1155
|
+
fill: `url(#${A}-fill)`
|
|
1156
|
+
}) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("path", {
|
|
1139
1157
|
"data-reveal-ribbon": "",
|
|
1140
|
-
d:
|
|
1158
|
+
d: N.ribbon,
|
|
1141
1159
|
fillRule: "evenodd",
|
|
1142
|
-
fill: `url(#${
|
|
1143
|
-
}), /* @__PURE__ */
|
|
1160
|
+
fill: `url(#${A}-fill)`
|
|
1161
|
+
}), /* @__PURE__ */ m("path", {
|
|
1144
1162
|
"data-reveal-outline": "",
|
|
1145
|
-
d:
|
|
1163
|
+
d: N.outline,
|
|
1146
1164
|
pathLength: "1",
|
|
1147
1165
|
fill: "none",
|
|
1148
|
-
stroke: `url(#${
|
|
1166
|
+
stroke: `url(#${A}-fill)`,
|
|
1149
1167
|
strokeWidth: "1.2",
|
|
1150
1168
|
strokeLinecap: "round"
|
|
1151
|
-
})]
|
|
1169
|
+
})] })
|
|
1152
1170
|
})
|
|
1153
1171
|
]
|
|
1154
1172
|
})]
|
|
@@ -1156,7 +1174,7 @@ function de({ children: t, source: n, revealKey: i = "initial", variant: a = "co
|
|
|
1156
1174
|
}
|
|
1157
1175
|
//#endregion
|
|
1158
1176
|
//#region src/LiquidAnchor.tsx
|
|
1159
|
-
function
|
|
1177
|
+
function $({ source: e, children: t, placement: n = "top-end", onBoundsChange: r }) {
|
|
1160
1178
|
let [i, a] = f(null), o = d(r);
|
|
1161
1179
|
o.current = r;
|
|
1162
1180
|
let [s, c] = f(null);
|
|
@@ -1166,7 +1184,7 @@ function fe({ source: e, children: t, placement: n = "top-end", onBoundsChange:
|
|
|
1166
1184
|
let t = e.current, r = i;
|
|
1167
1185
|
if (!t || !r) return;
|
|
1168
1186
|
let a = (e) => {
|
|
1169
|
-
|
|
1187
|
+
J(r, e), o.current?.(e);
|
|
1170
1188
|
}, s = !0, c = 0, l = null, u = null, d = () => {
|
|
1171
1189
|
let e = getComputedStyle(t);
|
|
1172
1190
|
for (let t of Array.from(e)) if (t.startsWith("--game-ui-") || t.startsWith("--liquid-presence-")) {
|
|
@@ -1258,10 +1276,10 @@ function fe({ source: e, children: t, placement: n = "top-end", onBoundsChange:
|
|
|
1258
1276
|
i,
|
|
1259
1277
|
n,
|
|
1260
1278
|
e
|
|
1261
|
-
]), s ? /* @__PURE__ */
|
|
1279
|
+
]), s ? /* @__PURE__ */ m(_, {
|
|
1262
1280
|
root: s,
|
|
1263
1281
|
preserveTabOrder: !1,
|
|
1264
|
-
children: /* @__PURE__ */
|
|
1282
|
+
children: /* @__PURE__ */ m("div", {
|
|
1265
1283
|
ref: a,
|
|
1266
1284
|
className: "game-ui-liquid-anchor",
|
|
1267
1285
|
style: {
|
|
@@ -1275,4 +1293,4 @@ function fe({ source: e, children: t, placement: n = "top-end", onBoundsChange:
|
|
|
1275
1293
|
}) : null;
|
|
1276
1294
|
}
|
|
1277
1295
|
//#endregion
|
|
1278
|
-
export {
|
|
1296
|
+
export { $ as LiquidAnchor, de as LiquidPresence, me as LiquidReveal };
|