@cloudlet/toast 1.4.0 → 1.5.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 +165 -0
- package/README.md +3 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +19 -15
- package/dist/agent.js.map +1 -1
- package/dist/center-react.d.ts +286 -0
- package/dist/center-react.d.ts.map +1 -0
- package/dist/center-react.js +2 -0
- package/dist/center.d.ts +3 -0
- package/dist/center.d.ts.map +1 -0
- package/dist/center.js +1 -0
- package/dist/core/agent-port.d.ts +2 -0
- package/dist/core/agent-port.d.ts.map +1 -1
- package/dist/core/agent-port.js +3 -0
- package/dist/core/agent-port.js.map +1 -1
- package/dist/react/card.d.ts +4 -0
- package/dist/react/card.d.ts.map +1 -1
- package/dist/react/card.js +3 -8
- package/dist/react/card.js.map +1 -1
- package/dist/react/center-backdrop.d.ts +69 -0
- package/dist/react/center-backdrop.d.ts.map +1 -0
- package/dist/react/center-backdrop.js +81 -0
- package/dist/react/center-backdrop.js.map +1 -0
- package/dist/react/center-clear.d.ts +16 -0
- package/dist/react/center-clear.d.ts.map +1 -0
- package/dist/react/center-clear.js +24 -0
- package/dist/react/center-clear.js.map +1 -0
- package/dist/react/center-gestures.d.ts +47 -0
- package/dist/react/center-gestures.d.ts.map +1 -0
- package/dist/react/center-gestures.js +74 -0
- package/dist/react/center-gestures.js.map +1 -0
- package/dist/react/center-motion.d.ts +174 -0
- package/dist/react/center-motion.d.ts.map +1 -0
- package/dist/react/center-motion.js +344 -0
- package/dist/react/center-motion.js.map +1 -0
- package/dist/react/center.d.ts +15 -0
- package/dist/react/center.d.ts.map +1 -0
- package/dist/react/center.js +1287 -0
- package/dist/react/center.js.map +1 -0
- package/dist/react/focus.d.ts +7 -0
- package/dist/react/focus.d.ts.map +1 -0
- package/dist/react/focus.js +14 -0
- package/dist/react/focus.js.map +1 -0
- package/dist/react/gestures.d.ts +33 -2
- package/dist/react/gestures.d.ts.map +1 -1
- package/dist/react/gestures.js +181 -149
- package/dist/react/gestures.js.map +1 -1
- package/dist/react/host.d.ts.map +1 -1
- package/dist/react/host.js +287 -283
- package/dist/react/host.js.map +1 -1
- package/dist/react/motion.d.ts +18 -11
- package/dist/react/motion.d.ts.map +1 -1
- package/dist/react/motion.js +6 -3
- package/dist/react/motion.js.map +1 -1
- package/dist/react/reduced.d.ts +24 -0
- package/dist/react/reduced.d.ts.map +1 -0
- package/dist/react/reduced.js +35 -0
- package/dist/react/reduced.js.map +1 -0
- package/dist/react/zoom.d.ts +12 -0
- package/dist/react/zoom.d.ts.map +1 -0
- package/dist/react/zoom.js +21 -0
- package/dist/react/zoom.js.map +1 -0
- package/dist/react.d.ts +4 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -1
- package/src/agent.ts +11 -6
- package/src/center-react.ts +300 -0
- package/src/center.ts +27 -0
- package/src/core/agent-port.ts +3 -0
- package/src/react/card.tsx +5 -6
- package/src/react/center-backdrop.tsx +151 -0
- package/src/react/center-clear.ts +56 -0
- package/src/react/center-gestures.ts +143 -0
- package/src/react/center-motion.ts +504 -0
- package/src/react/center.tsx +1557 -0
- package/src/react/focus.ts +18 -0
- package/src/react/gestures.ts +127 -37
- package/src/react/host.tsx +17 -5
- package/src/react/motion.ts +16 -9
- package/src/react/reduced.ts +52 -0
- package/src/react/zoom.ts +26 -0
- package/src/react.ts +4 -0
|
@@ -0,0 +1,1287 @@
|
|
|
1
|
+
import { glyph as e, glyphs as t } from "./card.js";
|
|
2
|
+
import { watchReducedMotion as n } from "./reduced.js";
|
|
3
|
+
import { BACKDROP_BLURS as r, BACKDROP_LAYERS as i, BACKDROP_SCROLL as a, CenterBackdropLayers as o, appleEngine as s, resolveBackdrop as c, resolveCenterBackdrop as l, useReducedTransparency as u, useScrollTint as d } from "./center-backdrop.js";
|
|
4
|
+
import { attachCenterGestures as f } from "./center-gestures.js";
|
|
5
|
+
import { useTwoStepClear as p } from "./center-clear.js";
|
|
6
|
+
import { cascadeDelay as m, createCenterMotion as h, resolveCenterMotion as g, restClip as _, stackLook as v, stackVisual as y } from "./center-motion.js";
|
|
7
|
+
import { focusIfVisible as b } from "./focus.js";
|
|
8
|
+
import { useCallback as x, useEffect as S, useId as C, useLayoutEffect as w, useMemo as T, useRef as E, useState as D, useSyncExternalStore as O, version as k } from "react";
|
|
9
|
+
import { Fragment as ee, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
10
|
+
import { createPortal as M } from "react-dom";
|
|
11
|
+
//#region src/react/center.tsx
|
|
12
|
+
var N = {
|
|
13
|
+
success: "Success",
|
|
14
|
+
error: "Error",
|
|
15
|
+
info: "Info",
|
|
16
|
+
warning: "Warning",
|
|
17
|
+
loading: "In progress"
|
|
18
|
+
}, P = 6e4, F = 60 * P, I = 24 * F, te = 3e4, L = 300, R = 600, ne = /* @__PURE__ */ new Map();
|
|
19
|
+
function re(e, t) {
|
|
20
|
+
let n = ne.get(t);
|
|
21
|
+
if (!n) {
|
|
22
|
+
try {
|
|
23
|
+
n = new Intl.DateTimeFormat(t || void 0, {
|
|
24
|
+
month: "short",
|
|
25
|
+
day: "numeric"
|
|
26
|
+
});
|
|
27
|
+
} catch {
|
|
28
|
+
n = new Intl.DateTimeFormat(void 0, {
|
|
29
|
+
month: "short",
|
|
30
|
+
day: "numeric"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
ne.set(t, n);
|
|
34
|
+
}
|
|
35
|
+
return n.format(e);
|
|
36
|
+
}
|
|
37
|
+
var ie = (e) => (t, n) => {
|
|
38
|
+
if (!Number.isFinite(t)) return "";
|
|
39
|
+
let r = Math.max(0, n - t);
|
|
40
|
+
return r < P ? "now" : r < F ? `${Math.floor(r / P)}m` : r < I ? `${Math.floor(r / F)}h` : r < 7 * I ? `${Math.floor(r / I)}d` : re(t, e);
|
|
41
|
+
}, z = {
|
|
42
|
+
title: "Notifications",
|
|
43
|
+
close: "Close notifications",
|
|
44
|
+
clear: "Clear notification",
|
|
45
|
+
empty: "No notifications",
|
|
46
|
+
kind: (e) => N[e] ?? "",
|
|
47
|
+
unread: "Unread",
|
|
48
|
+
time: ie(""),
|
|
49
|
+
group: (e) => e,
|
|
50
|
+
more: (e, t) => `${e} · ${t} more`,
|
|
51
|
+
stack: (e, t) => `${e}, ${t} notifications`,
|
|
52
|
+
showLess: "Show less",
|
|
53
|
+
clearGroup: "Clear",
|
|
54
|
+
clearGroupConfirm: (e) => `Clear ${e}`,
|
|
55
|
+
clearStack: (e) => `Clear ${e}`,
|
|
56
|
+
clearAll: "Clear all",
|
|
57
|
+
clearAllConfirm: (e) => `Clear ${e}`
|
|
58
|
+
}, B = /* @__PURE__ */ new WeakMap();
|
|
59
|
+
function V(e) {
|
|
60
|
+
return [...e.buttons].filter((e) => e.isConnected);
|
|
61
|
+
}
|
|
62
|
+
function H(e) {
|
|
63
|
+
return V(e).sort((e, t) => e.compareDocumentPosition(t) & e.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
64
|
+
}
|
|
65
|
+
function ae(e) {
|
|
66
|
+
let t = e.buttons, n = 0, r = /* @__PURE__ */ new Set(), i = !1, a = () => {
|
|
67
|
+
i = !1;
|
|
68
|
+
for (let e of [...t]) e.isConnected || (t.delete(e), --n);
|
|
69
|
+
if (n > 0 && n >= t.size) t.clear();
|
|
70
|
+
else if (n > 0 && r.size) {
|
|
71
|
+
let e = [...t].filter((e) => !r.has(e));
|
|
72
|
+
if (e.length === n) for (let n of e) t.delete(n);
|
|
73
|
+
}
|
|
74
|
+
n = 0, r.clear();
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
ref: (e) => {
|
|
78
|
+
if (!e) n += 1, i || queueMicrotask(a), i = !0;
|
|
79
|
+
else {
|
|
80
|
+
if (e.isConnected) for (let e of [...t]) e.isConnected || (t.delete(e), n = Math.max(0, n - 1));
|
|
81
|
+
return t.has(e) && (n = Math.max(0, n - 1)), i && r.add(e), t.add(e), oe ? () => {
|
|
82
|
+
t.delete(e);
|
|
83
|
+
} : void 0;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
onClick: (n) => {
|
|
87
|
+
if (e.isOpen()) {
|
|
88
|
+
e.request(!1);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
let r = n?.currentTarget;
|
|
92
|
+
e.opener = r ? t.has(r) ? r : null : t.size === 1 ? [...t][0] : null, e.request(!0);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var oe = Number.parseInt(k, 10) >= 19;
|
|
97
|
+
function se() {
|
|
98
|
+
return `cloudlet-center-${C().replace(/[^\w-]/gu, "")}`;
|
|
99
|
+
}
|
|
100
|
+
function ce(e) {
|
|
101
|
+
let [t, n] = D(() => e?.defaultOpen === !0), r = typeof e?.open == "boolean", i = r ? e.open : t, a = E({
|
|
102
|
+
open: i,
|
|
103
|
+
controlled: r,
|
|
104
|
+
onOpenChange: e?.onOpenChange
|
|
105
|
+
});
|
|
106
|
+
a.current = {
|
|
107
|
+
open: i,
|
|
108
|
+
controlled: r,
|
|
109
|
+
onOpenChange: e?.onOpenChange
|
|
110
|
+
};
|
|
111
|
+
let o = se(), [s] = D(() => {
|
|
112
|
+
let e = null, t = () => e ? e.open : a.current.open;
|
|
113
|
+
return {
|
|
114
|
+
id: o,
|
|
115
|
+
buttons: /* @__PURE__ */ new Set(),
|
|
116
|
+
opener: null,
|
|
117
|
+
isOpen: t,
|
|
118
|
+
request: (r) => {
|
|
119
|
+
if (r === t()) return;
|
|
120
|
+
let i = a.current, o = { open: r };
|
|
121
|
+
e = o, i.controlled || n(r), i.onOpenChange?.(r), queueMicrotask(() => {
|
|
122
|
+
e === o && (e = null);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}), { ref: c, onClick: l } = T(() => ae(s), [s]);
|
|
127
|
+
return B.set(s.request, s), T(() => ({
|
|
128
|
+
open: i,
|
|
129
|
+
setOpen: s.request,
|
|
130
|
+
triggerProps: {
|
|
131
|
+
ref: c,
|
|
132
|
+
"aria-expanded": i,
|
|
133
|
+
"aria-controls": i ? s.id : void 0,
|
|
134
|
+
"aria-haspopup": "dialog",
|
|
135
|
+
onClick: l
|
|
136
|
+
}
|
|
137
|
+
}), [
|
|
138
|
+
i,
|
|
139
|
+
s,
|
|
140
|
+
c,
|
|
141
|
+
l
|
|
142
|
+
]);
|
|
143
|
+
}
|
|
144
|
+
var le = () => () => {}, ue = () => !0, de = () => !1;
|
|
145
|
+
function fe(e) {
|
|
146
|
+
let t = ce({
|
|
147
|
+
open: e.open,
|
|
148
|
+
defaultOpen: e.defaultOpen,
|
|
149
|
+
onOpenChange: e.onOpenChange
|
|
150
|
+
}), n = e.center ?? t, r = B.get(n.setOpen) ?? B.get(t.setOpen), i = n.open === !0, a = O(le, ue, de), [o, s] = D(!1);
|
|
151
|
+
i && !o && s(!0);
|
|
152
|
+
let c = x(() => s(!1), []), l = E(!0);
|
|
153
|
+
return w(() => {
|
|
154
|
+
a && (l.current = !1);
|
|
155
|
+
}), !a || !(o || i) ? null : M(/* @__PURE__ */ A(U, {
|
|
156
|
+
...e,
|
|
157
|
+
link: r,
|
|
158
|
+
setOpen: n.setOpen,
|
|
159
|
+
open: i,
|
|
160
|
+
instant: l.current,
|
|
161
|
+
onClosed: c
|
|
162
|
+
}), document.body);
|
|
163
|
+
}
|
|
164
|
+
var pe = (e) => typeof e == "number" ? e : e instanceof Date ? e.getTime() : NaN;
|
|
165
|
+
function me(e) {
|
|
166
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
167
|
+
(Array.isArray(e) ? e : []).forEach((e, r) => {
|
|
168
|
+
if (!e || typeof e != "object" || typeof e.id != "string" || t.has(e.id)) return;
|
|
169
|
+
t.add(e.id);
|
|
170
|
+
let i = typeof e.group == "string" && e.group ? e.group : null;
|
|
171
|
+
n.push({
|
|
172
|
+
entry: {
|
|
173
|
+
id: e.id,
|
|
174
|
+
item: e,
|
|
175
|
+
time: pe(e.time),
|
|
176
|
+
group: i
|
|
177
|
+
},
|
|
178
|
+
index: r
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
let r = (e) => Number.isNaN(e) ? -Infinity : e;
|
|
182
|
+
return n.sort((e, t) => r(t.entry.time) - r(e.entry.time) || e.index - t.index), n.map(({ entry: e }) => e);
|
|
183
|
+
}
|
|
184
|
+
function he(e, t) {
|
|
185
|
+
let n = [], r = /* @__PURE__ */ new Map();
|
|
186
|
+
for (let t of e) {
|
|
187
|
+
if (t.group === null) {
|
|
188
|
+
n.push({
|
|
189
|
+
key: null,
|
|
190
|
+
entries: [t]
|
|
191
|
+
});
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
let e = r.get(t.group);
|
|
195
|
+
if (e) {
|
|
196
|
+
e.push(t);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
let i = [t];
|
|
200
|
+
r.set(t.group, i), n.push({
|
|
201
|
+
key: t.group,
|
|
202
|
+
entries: i
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return n.map((e) => ({
|
|
206
|
+
...e,
|
|
207
|
+
expanded: e.key !== null && e.entries.length >= 2 && t.has(e.key)
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
var ge = "[data-cloudlet-control=\"action\"], [data-cloudlet-control=\"clear\"], [data-cloudlet-control=\"clear-all\"], [data-cloudlet-control=\"group-clear\"], [data-cloudlet-control=\"stack-clear\"]";
|
|
211
|
+
function _e(e) {
|
|
212
|
+
let t = globalThis.matchMedia?.("(prefers-color-scheme: dark)");
|
|
213
|
+
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
214
|
+
}
|
|
215
|
+
var ve = () => globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ?? !1;
|
|
216
|
+
function ye(e) {
|
|
217
|
+
return (t, n) => {
|
|
218
|
+
let r = e?.[t];
|
|
219
|
+
return typeof r == "string" && r.trim() ? `${n} ${r.trim()}` : n;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function U(t) {
|
|
223
|
+
let { link: n, side: r, theme: i, dir: a, labels: f, classNames: m, nonce: h, open: g, notifications: _ } = t, v = E(null), y = c(t.backdrop, u(v)), [b] = D(s), { layers: x, scrollTint: C } = l(t.motion?.overrides?.backdrop, b), w = O(_e, ve, () => !1), k = E(null), [ee, M] = D(Date.now);
|
|
224
|
+
S(() => {
|
|
225
|
+
if (!g) return;
|
|
226
|
+
M(Date.now());
|
|
227
|
+
let e = setInterval(() => M(Date.now()), te);
|
|
228
|
+
return () => clearInterval(e);
|
|
229
|
+
}, [g]);
|
|
230
|
+
let N = E(t);
|
|
231
|
+
N.current = t;
|
|
232
|
+
let P = T(() => ({
|
|
233
|
+
dismiss: (e) => {
|
|
234
|
+
let { onDismiss: t, onClear: n } = N.current;
|
|
235
|
+
t ? t(e) : n?.([e]);
|
|
236
|
+
},
|
|
237
|
+
clear: (e) => {
|
|
238
|
+
let { onDismiss: t, onClear: n } = N.current;
|
|
239
|
+
if (n) n(e);
|
|
240
|
+
else if (t) for (let n of e) t(n);
|
|
241
|
+
},
|
|
242
|
+
action: (e, t) => N.current.onAction?.(e, t)
|
|
243
|
+
}), []), F = {
|
|
244
|
+
dismiss: t.onDismiss || t.onClear ? P.dismiss : null,
|
|
245
|
+
clear: t.onClear || t.onDismiss ? P.clear : null,
|
|
246
|
+
action: P.action
|
|
247
|
+
}, I = T(() => me(_), [_]), [L, R] = D(() => /* @__PURE__ */ new Set()), [ne, re] = D(g);
|
|
248
|
+
ne !== g && (re(g), g && L.size && R(/* @__PURE__ */ new Set()));
|
|
249
|
+
let B = [...L].filter((e) => I.filter((t) => t.group === e).length < 2);
|
|
250
|
+
B.length && R(new Set([...L].filter((e) => !B.includes(e))));
|
|
251
|
+
let V = T(() => he(I, L), [I, L]), H = be(I), ae = document, { styleRef: oe, stackRef: se, listRef: ce, exitsRef: le, leave: ue, texts: de, folding: fe, setBlur: pe } = Ne(t, v, H, F.dismiss !== null);
|
|
252
|
+
d(g, y === "blur" && C, v, pe), Ie(g, t.instant, n, t.setOpen, v, k);
|
|
253
|
+
let U = De(V), Se = Oe(V, R, v, U), G = Le(V, U, H, v, k), K = F.clear !== null && I.length >= 2, we = F.clear === null ? [] : V.flatMap((e) => e.key === null || e.entries.length < 2 ? [] : [`${e.expanded ? "group" : "stack"}:${e.key}`]);
|
|
254
|
+
K && we.push(W);
|
|
255
|
+
let q = p(we, g);
|
|
256
|
+
Be(g, I, H, v), Ve(g, I, N);
|
|
257
|
+
let Ee = ae.documentElement.lang, J = {
|
|
258
|
+
...z,
|
|
259
|
+
time: ie(Ee),
|
|
260
|
+
...f
|
|
261
|
+
};
|
|
262
|
+
function Y(e, t, ...n) {
|
|
263
|
+
try {
|
|
264
|
+
let t = e(...n);
|
|
265
|
+
if (typeof t != "string") throw TypeError("Label formatter must return a string");
|
|
266
|
+
return t;
|
|
267
|
+
} catch {
|
|
268
|
+
return t(...n);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
let ke = r === "left" ? "left" : "right", je = i === "light" || i === "dark" ? i : "system", X = a ?? (ae.documentElement.dir === "rtl" ? "rtl" : "ltr"), Z = ye(m), Q = n.id, Me = (e) => {
|
|
272
|
+
e.target.closest("button")?.matches(ge) && e.detail > 1 && (e.preventDefault(), e.stopPropagation());
|
|
273
|
+
}, Pe = Y(J.clearAllConfirm, z.clearAllConfirm, I.length), $ = q.armed?.replace(/^(?:group|stack):/u, ""), Fe = q.armed === null || q.armed === W ? 0 : V.find((e) => e.key === $)?.entries.length ?? 0, Re = q.armed === null ? "" : q.armed === W ? Pe : Y(J.clearGroupConfirm, z.clearGroupConfirm, Fe), ze = (e, n) => /* @__PURE__ */ A(Ae, {
|
|
274
|
+
entry: e,
|
|
275
|
+
motionKey: H.of(e.id),
|
|
276
|
+
requests: F,
|
|
277
|
+
render: t.renderNotification,
|
|
278
|
+
part: Z,
|
|
279
|
+
lostFocus: G,
|
|
280
|
+
leave: ue,
|
|
281
|
+
kind: typeof e.item.kind == "string" ? Y(J.kind, z.kind, e.item.kind) : "",
|
|
282
|
+
time: Y(J.time, ie(Ee), e.time, ee),
|
|
283
|
+
labels: J,
|
|
284
|
+
...n
|
|
285
|
+
}, `h:${e.id}`);
|
|
286
|
+
return /* @__PURE__ */ j("div", {
|
|
287
|
+
ref: v,
|
|
288
|
+
id: Q,
|
|
289
|
+
className: Z("center", "cloudlet-host cloudlet-center"),
|
|
290
|
+
role: "dialog",
|
|
291
|
+
"aria-labelledby": `${Q}-title`,
|
|
292
|
+
"aria-hidden": !g || void 0,
|
|
293
|
+
"data-cloudlet-center": "",
|
|
294
|
+
"data-side": ke,
|
|
295
|
+
"data-theme": je,
|
|
296
|
+
"data-resolved-theme": je === "system" ? w ? "dark" : "light" : je,
|
|
297
|
+
"data-backdrop": y,
|
|
298
|
+
"data-backdrop-layers": y === "blur" ? x : void 0,
|
|
299
|
+
dir: X,
|
|
300
|
+
onClickCapture: Me,
|
|
301
|
+
children: [
|
|
302
|
+
/* @__PURE__ */ A("style", {
|
|
303
|
+
ref: oe,
|
|
304
|
+
nonce: h,
|
|
305
|
+
"data-cloudlet-center-motion": ""
|
|
306
|
+
}),
|
|
307
|
+
/* @__PURE__ */ A(o, {
|
|
308
|
+
backdrop: y,
|
|
309
|
+
layers: x
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ j("div", {
|
|
312
|
+
className: "cloudlet-center-column",
|
|
313
|
+
children: [/* @__PURE__ */ j("div", {
|
|
314
|
+
className: Z("header", "cloudlet-center-header"),
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ A("h2", {
|
|
317
|
+
ref: k,
|
|
318
|
+
id: `${Q}-title`,
|
|
319
|
+
tabIndex: -1,
|
|
320
|
+
className: Z("heading", "cloudlet-center-heading"),
|
|
321
|
+
children: J.title
|
|
322
|
+
}),
|
|
323
|
+
K && /* @__PURE__ */ A(xe, {
|
|
324
|
+
control: "clear-all",
|
|
325
|
+
id: W,
|
|
326
|
+
twoStep: q,
|
|
327
|
+
className: Z("clear-all", "cloudlet-clear cloudlet-center-clear-all"),
|
|
328
|
+
label: J.clearAll,
|
|
329
|
+
confirm: Pe,
|
|
330
|
+
onClear: () => {
|
|
331
|
+
k.current?.focus({ preventScroll: !0 }), F.clear?.(I.map((e) => e.id));
|
|
332
|
+
}
|
|
333
|
+
}),
|
|
334
|
+
/* @__PURE__ */ A("span", {
|
|
335
|
+
role: "status",
|
|
336
|
+
className: "cloudlet-live",
|
|
337
|
+
children: Re
|
|
338
|
+
}),
|
|
339
|
+
/* @__PURE__ */ A("button", {
|
|
340
|
+
type: "button",
|
|
341
|
+
"data-cloudlet-control": "dismiss",
|
|
342
|
+
className: Z("dismiss", "cloudlet-close cloudlet-center-dismiss"),
|
|
343
|
+
"aria-label": J.close,
|
|
344
|
+
onClick: () => t.setOpen(!1),
|
|
345
|
+
children: e("m4.5 4.5 7 7m0-7-7 7")
|
|
346
|
+
})
|
|
347
|
+
]
|
|
348
|
+
}), /* @__PURE__ */ A("div", {
|
|
349
|
+
className: "cloudlet-center-scroll",
|
|
350
|
+
tabIndex: -1,
|
|
351
|
+
children: /* @__PURE__ */ j("div", {
|
|
352
|
+
ref: se,
|
|
353
|
+
className: "cloudlet-center-stack",
|
|
354
|
+
children: [V.length ? /* @__PURE__ */ A("ul", {
|
|
355
|
+
ref: ce,
|
|
356
|
+
className: Z("list", "cloudlet-center-list"),
|
|
357
|
+
children: V.map((e, t) => {
|
|
358
|
+
let n = Math.min(t, 8);
|
|
359
|
+
if (e.key === null || e.entries.length < 2) return ze(e.entries[0], {
|
|
360
|
+
lag: n,
|
|
361
|
+
level: "h3"
|
|
362
|
+
});
|
|
363
|
+
let r = Y(J.group, z.group, e.key), i = e.entries.length, a = F.clear;
|
|
364
|
+
return /* @__PURE__ */ A(Te, {
|
|
365
|
+
group: e,
|
|
366
|
+
motionKey: U(e.key),
|
|
367
|
+
lag: n,
|
|
368
|
+
part: Z,
|
|
369
|
+
card: ze,
|
|
370
|
+
name: Y(J.stack, z.stack, r, i),
|
|
371
|
+
label: r,
|
|
372
|
+
more: Y(J.more, z.more, r, i - 1),
|
|
373
|
+
showLess: J.showLess,
|
|
374
|
+
toggle: Se,
|
|
375
|
+
clear: J.clearGroup,
|
|
376
|
+
clearStack: Y(J.clearStack, z.clearStack, r),
|
|
377
|
+
confirm: Y(J.clearGroupConfirm, z.clearGroupConfirm, i),
|
|
378
|
+
twoStep: q,
|
|
379
|
+
lostFocus: G,
|
|
380
|
+
texts: de,
|
|
381
|
+
folding: fe,
|
|
382
|
+
onClear: a && (() => a(e.entries.map((e) => e.id)))
|
|
383
|
+
}, `g:${e.key}`);
|
|
384
|
+
})
|
|
385
|
+
}) : /* @__PURE__ */ A(Ce, {
|
|
386
|
+
className: Z("empty", "cloudlet-center-empty"),
|
|
387
|
+
texts: de,
|
|
388
|
+
children: J.empty
|
|
389
|
+
}), /* @__PURE__ */ A("div", {
|
|
390
|
+
ref: le,
|
|
391
|
+
className: "cloudlet-center-exits",
|
|
392
|
+
"aria-hidden": "true"
|
|
393
|
+
})]
|
|
394
|
+
})
|
|
395
|
+
})]
|
|
396
|
+
})
|
|
397
|
+
]
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
function be(e) {
|
|
401
|
+
let [t] = D(() => /* @__PURE__ */ new Map()), [n] = D(() => /* @__PURE__ */ new Map());
|
|
402
|
+
return w(() => {
|
|
403
|
+
let r = new Set(e.map((e) => e.id));
|
|
404
|
+
for (let [e, i] of t) r.has(e) || (t.delete(e), n.delete(i));
|
|
405
|
+
}, [
|
|
406
|
+
e,
|
|
407
|
+
t,
|
|
408
|
+
n
|
|
409
|
+
]), T(() => ({
|
|
410
|
+
of(e) {
|
|
411
|
+
let r = t.get(e);
|
|
412
|
+
return r === void 0 && (t.set(e, r = String(++Y)), n.set(r, e)), r;
|
|
413
|
+
},
|
|
414
|
+
idOf: (e) => n.get(e) ?? null
|
|
415
|
+
}), [t, n]);
|
|
416
|
+
}
|
|
417
|
+
var W = "all";
|
|
418
|
+
function xe({ control: e, id: t, twoStep: n, className: r, label: i, confirm: a, onClear: o }) {
|
|
419
|
+
let s = n.armed === t;
|
|
420
|
+
return /* @__PURE__ */ j("button", {
|
|
421
|
+
type: "button",
|
|
422
|
+
"data-cloudlet-control": e,
|
|
423
|
+
className: r,
|
|
424
|
+
"data-armed": s,
|
|
425
|
+
onClick: () => n.press(t, o),
|
|
426
|
+
onBlur: () => n.disarm(t),
|
|
427
|
+
children: [/* @__PURE__ */ A("span", {
|
|
428
|
+
"aria-hidden": s || void 0,
|
|
429
|
+
children: i
|
|
430
|
+
}), /* @__PURE__ */ A("span", {
|
|
431
|
+
"aria-hidden": !s || void 0,
|
|
432
|
+
children: a
|
|
433
|
+
})]
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
var Se = 2;
|
|
437
|
+
function G(e) {
|
|
438
|
+
let t = E(null);
|
|
439
|
+
return w(() => {
|
|
440
|
+
let n = t.current;
|
|
441
|
+
if (n) return e.reveal(n), () => e.leave(n);
|
|
442
|
+
}, [e]), t;
|
|
443
|
+
}
|
|
444
|
+
var K = (e) => {
|
|
445
|
+
e.target === e.currentTarget && e.currentTarget.removeAttribute("data-cloudlet-reveal");
|
|
446
|
+
};
|
|
447
|
+
function Ce({ className: e, texts: t, children: n }) {
|
|
448
|
+
let r = G(t);
|
|
449
|
+
return /* @__PURE__ */ A("p", {
|
|
450
|
+
ref: r,
|
|
451
|
+
className: e,
|
|
452
|
+
"data-cloudlet-lag": "0",
|
|
453
|
+
onAnimationEnd: K,
|
|
454
|
+
children: n
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
var we = "button, a[href], input, textarea, select, label, summary, [contenteditable], [tabindex]";
|
|
458
|
+
function Te({ group: t, motionKey: n, lag: r, part: i, card: a, name: o, label: s, more: c, showLess: l, toggle: u, clear: d, clearStack: f, confirm: p, twoStep: m, lostFocus: h, texts: g, folding: _, onClear: v }) {
|
|
459
|
+
let { expanded: y, entries: b } = t, x = t.key, S = (e) => (t) => u(x, e, t.currentTarget), C = E(null), T = E(b);
|
|
460
|
+
T.current = b, w(() => () => {
|
|
461
|
+
let e = C.current;
|
|
462
|
+
h.current === null && e?.contains(e.ownerDocument.activeElement) && (h.current = T.current[T.current.length - 1].id);
|
|
463
|
+
}, [h]);
|
|
464
|
+
let D = `stack:${x}`, O = m.armed === D, k = v && /* @__PURE__ */ j("button", {
|
|
465
|
+
type: "button",
|
|
466
|
+
"data-cloudlet-control": "stack-clear",
|
|
467
|
+
"data-armed": O,
|
|
468
|
+
className: i("stack-clear", "cloudlet-close cloudlet-card-clear cloudlet-center-stack-clear"),
|
|
469
|
+
"aria-label": O ? p : f,
|
|
470
|
+
onClick: (e) => {
|
|
471
|
+
e.stopPropagation(), m.press(D, v);
|
|
472
|
+
},
|
|
473
|
+
onBlur: () => m.disarm(D),
|
|
474
|
+
children: [e("m4.5 4.5 7 7m0-7-7 7"), /* @__PURE__ */ A("span", {
|
|
475
|
+
className: "cloudlet-center-stack-clear-label",
|
|
476
|
+
"aria-hidden": "true",
|
|
477
|
+
children: /* @__PURE__ */ A("span", { children: p })
|
|
478
|
+
})]
|
|
479
|
+
});
|
|
480
|
+
return /* @__PURE__ */ A("li", {
|
|
481
|
+
ref: C,
|
|
482
|
+
className: i("group", "cloudlet-center-group"),
|
|
483
|
+
"data-expanded": String(y),
|
|
484
|
+
"data-peeks": y ? void 0 : Math.min(b.length - 1, Se),
|
|
485
|
+
"data-cloudlet-motion-key": n,
|
|
486
|
+
"data-cloudlet-lag": r,
|
|
487
|
+
children: /* @__PURE__ */ j("div", {
|
|
488
|
+
role: "group",
|
|
489
|
+
"aria-label": o,
|
|
490
|
+
className: "cloudlet-center-group-box",
|
|
491
|
+
children: [
|
|
492
|
+
y && /* @__PURE__ */ j(q, {
|
|
493
|
+
className: i("group-header", "cloudlet-center-group-header"),
|
|
494
|
+
texts: g,
|
|
495
|
+
children: [
|
|
496
|
+
/* @__PURE__ */ A("h3", {
|
|
497
|
+
className: "cloudlet-center-group-heading",
|
|
498
|
+
children: /* @__PURE__ */ j("button", {
|
|
499
|
+
type: "button",
|
|
500
|
+
"data-cloudlet-control": "group-title",
|
|
501
|
+
className: i("group-title", "cloudlet-center-group-title"),
|
|
502
|
+
"aria-expanded": "true",
|
|
503
|
+
onClick: S(!1),
|
|
504
|
+
children: [
|
|
505
|
+
/* @__PURE__ */ A("span", {
|
|
506
|
+
className: "cloudlet-center-group-label",
|
|
507
|
+
children: s
|
|
508
|
+
}),
|
|
509
|
+
" ",
|
|
510
|
+
/* @__PURE__ */ A("span", {
|
|
511
|
+
className: "cloudlet-center-group-count",
|
|
512
|
+
children: b.length
|
|
513
|
+
})
|
|
514
|
+
]
|
|
515
|
+
})
|
|
516
|
+
}),
|
|
517
|
+
/* @__PURE__ */ A("button", {
|
|
518
|
+
type: "button",
|
|
519
|
+
"data-cloudlet-control": "show-less",
|
|
520
|
+
className: i("show-less", "cloudlet-action cloudlet-center-show-less"),
|
|
521
|
+
onClick: S(!1),
|
|
522
|
+
children: l
|
|
523
|
+
}),
|
|
524
|
+
v && /* @__PURE__ */ A(xe, {
|
|
525
|
+
control: "group-clear",
|
|
526
|
+
id: `group:${x}`,
|
|
527
|
+
twoStep: m,
|
|
528
|
+
className: i("group-clear", "cloudlet-clear cloudlet-center-group-clear"),
|
|
529
|
+
label: d,
|
|
530
|
+
confirm: p,
|
|
531
|
+
onClear: v
|
|
532
|
+
})
|
|
533
|
+
]
|
|
534
|
+
}),
|
|
535
|
+
/* @__PURE__ */ A("ul", {
|
|
536
|
+
className: i("group-list", "cloudlet-center-group-list"),
|
|
537
|
+
onClick: (e) => {
|
|
538
|
+
e.detail > 1 || (y ? _(n) && !e.currentTarget.contains(e.target.closest(we)) && S(!1)(e) : S(!0)(e));
|
|
539
|
+
},
|
|
540
|
+
children: b.map((e, t) => a(e, y ? { level: "h4" } : t > Se ? {
|
|
541
|
+
place: "hidden",
|
|
542
|
+
level: "h4"
|
|
543
|
+
} : t ? {
|
|
544
|
+
place: "edge",
|
|
545
|
+
level: "h4"
|
|
546
|
+
} : {
|
|
547
|
+
place: "top",
|
|
548
|
+
level: "h3",
|
|
549
|
+
...k ? { when: k } : {}
|
|
550
|
+
}))
|
|
551
|
+
}),
|
|
552
|
+
!y && /* @__PURE__ */ A(Ee, {
|
|
553
|
+
className: i("more", "cloudlet-center-more"),
|
|
554
|
+
texts: g,
|
|
555
|
+
onClick: S(!0),
|
|
556
|
+
children: c
|
|
557
|
+
})
|
|
558
|
+
]
|
|
559
|
+
})
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
function q({ className: e, texts: t, children: n }) {
|
|
563
|
+
let r = G(t);
|
|
564
|
+
return /* @__PURE__ */ A("div", {
|
|
565
|
+
ref: r,
|
|
566
|
+
className: e,
|
|
567
|
+
onAnimationEnd: K,
|
|
568
|
+
children: n
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function Ee({ className: e, texts: t, onClick: n, children: r }) {
|
|
572
|
+
let i = G(t);
|
|
573
|
+
return /* @__PURE__ */ A("button", {
|
|
574
|
+
ref: i,
|
|
575
|
+
type: "button",
|
|
576
|
+
"data-cloudlet-control": "more",
|
|
577
|
+
className: e,
|
|
578
|
+
"aria-expanded": "false",
|
|
579
|
+
onClick: n,
|
|
580
|
+
onAnimationEnd: K,
|
|
581
|
+
children: r
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
function De(e) {
|
|
585
|
+
let t = E(/* @__PURE__ */ new Map());
|
|
586
|
+
return w(() => {
|
|
587
|
+
let n = new Set(e.map((e) => e.key));
|
|
588
|
+
for (let e of t.current.keys()) n.has(e) || t.current.delete(e);
|
|
589
|
+
}, [e]), x((e) => {
|
|
590
|
+
let n = t.current.get(e);
|
|
591
|
+
return n === void 0 && t.current.set(e, n = `g${++Y}`), n;
|
|
592
|
+
}, []);
|
|
593
|
+
}
|
|
594
|
+
function Oe(e, t, n, r) {
|
|
595
|
+
let i = E(null), a = E(e);
|
|
596
|
+
return a.current = e, w(() => {
|
|
597
|
+
let e = i.current;
|
|
598
|
+
i.current = null;
|
|
599
|
+
let t = n.current;
|
|
600
|
+
if (!e || !t) return;
|
|
601
|
+
let r = t.ownerDocument.activeElement;
|
|
602
|
+
if (r && r !== t.ownerDocument.body && r.isConnected) return;
|
|
603
|
+
let a = t.querySelector(`.cloudlet-center-list > [data-cloudlet-motion-key="${e.key}"]`);
|
|
604
|
+
b(a?.querySelector(e.expanded ? ".cloudlet-center-group-title" : ".cloudlet-center-more"));
|
|
605
|
+
}), x((e, n, o) => {
|
|
606
|
+
let s = a.current.find((t) => t.key === e);
|
|
607
|
+
if (!s || s.entries.length < 2 || s.expanded === n) return;
|
|
608
|
+
let c = o.ownerDocument, l = !!o.closest(".cloudlet-center-group")?.contains(c.activeElement);
|
|
609
|
+
t((t) => {
|
|
610
|
+
let r = new Set(t);
|
|
611
|
+
return n ? r.add(e) : r.delete(e), r;
|
|
612
|
+
}), l && (i.current = {
|
|
613
|
+
key: r(e),
|
|
614
|
+
expanded: n
|
|
615
|
+
});
|
|
616
|
+
}, [t, r]);
|
|
617
|
+
}
|
|
618
|
+
function J(e) {
|
|
619
|
+
let t = new Date(e);
|
|
620
|
+
return Number.isNaN(t.getTime()) ? void 0 : t.toISOString();
|
|
621
|
+
}
|
|
622
|
+
var Y = 0;
|
|
623
|
+
function ke({ item: e, part: n }) {
|
|
624
|
+
let { kind: r, icon: i } = e, a = r === "loading" || typeof r == "string" && Object.hasOwn(t, r);
|
|
625
|
+
return (i == null || i === !1) && !a ? null : /* @__PURE__ */ A("div", {
|
|
626
|
+
className: n("icon", "cloudlet-icon"),
|
|
627
|
+
"data-kind": r,
|
|
628
|
+
"aria-hidden": "true",
|
|
629
|
+
children: i != null && i !== !1 ? /* @__PURE__ */ A("span", {
|
|
630
|
+
className: "cloudlet-glyph",
|
|
631
|
+
children: i
|
|
632
|
+
}) : r === "loading" ? /* @__PURE__ */ A("svg", {
|
|
633
|
+
viewBox: "0 0 16 16",
|
|
634
|
+
className: "cloudlet-glyph cloudlet-spinner",
|
|
635
|
+
children: /* @__PURE__ */ A("circle", {
|
|
636
|
+
cx: "8",
|
|
637
|
+
cy: "8",
|
|
638
|
+
r: "5.5",
|
|
639
|
+
strokeDasharray: "22 13"
|
|
640
|
+
})
|
|
641
|
+
}) : /* @__PURE__ */ A("svg", {
|
|
642
|
+
viewBox: "0 0 16 16",
|
|
643
|
+
className: "cloudlet-glyph",
|
|
644
|
+
children: /* @__PURE__ */ A("path", { d: t[r] })
|
|
645
|
+
})
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
function Ae({ entry: n, motionKey: r, requests: i, render: a, part: o, lostFocus: s, leave: c, lag: l, place: u, level: d, when: f, kind: p, time: m, labels: h }) {
|
|
649
|
+
let g = `${C()}-title`, _ = E(null), { id: v, item: y } = n;
|
|
650
|
+
w(() => () => {
|
|
651
|
+
let e = _.current;
|
|
652
|
+
e?.contains(e.ownerDocument.activeElement) && (s.current = v), e && c(r, e);
|
|
653
|
+
}, [
|
|
654
|
+
v,
|
|
655
|
+
r,
|
|
656
|
+
s,
|
|
657
|
+
c
|
|
658
|
+
]), w(() => {
|
|
659
|
+
let e = _.current;
|
|
660
|
+
if (e) {
|
|
661
|
+
e.toggleAttribute("inert", u === "edge" || u === "hidden");
|
|
662
|
+
for (let t of e.querySelectorAll(".cloudlet-actions")) t.toggleAttribute("inert", u === "top");
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
let b = y.read === !1, x = d, S = () => i.dismiss?.(v), T = (e) => i.action(v, e), D = /* @__PURE__ */ A(ke, {
|
|
666
|
+
item: y,
|
|
667
|
+
part: o
|
|
668
|
+
}), O = /* @__PURE__ */ A(x, {
|
|
669
|
+
id: g,
|
|
670
|
+
tabIndex: -1,
|
|
671
|
+
className: o("title", "cloudlet-title"),
|
|
672
|
+
children: y.title
|
|
673
|
+
}), k = y.description !== void 0 && y.description !== null && y.description !== !1 && y.description !== "" ? /* @__PURE__ */ A("div", {
|
|
674
|
+
className: o("description", "cloudlet-description"),
|
|
675
|
+
children: typeof y.description == "string" || typeof y.description == "number" ? /* @__PURE__ */ A("p", { children: y.description }) : y.description
|
|
676
|
+
}) : null, M = Array.isArray(y.actions) ? y.actions.filter((e) => e && typeof e.id == "string") : [], N = M.length ? /* @__PURE__ */ A("div", {
|
|
677
|
+
className: o("actions", "cloudlet-actions"),
|
|
678
|
+
children: M.map((e, t) => /* @__PURE__ */ A("button", {
|
|
679
|
+
type: "button",
|
|
680
|
+
"data-cloudlet-control": "action",
|
|
681
|
+
className: t ? o("action", "cloudlet-action") : `${o("action", "cloudlet-action")} cloudlet-primary`,
|
|
682
|
+
onClick: () => T(e.id),
|
|
683
|
+
children: e.label
|
|
684
|
+
}, e.id))
|
|
685
|
+
}) : null, P = /* @__PURE__ */ j("span", {
|
|
686
|
+
className: "cloudlet-when",
|
|
687
|
+
children: [
|
|
688
|
+
/* @__PURE__ */ A("time", {
|
|
689
|
+
className: o("time", "cloudlet-time"),
|
|
690
|
+
dateTime: J(n.time),
|
|
691
|
+
children: m
|
|
692
|
+
}),
|
|
693
|
+
!u && i.dismiss && /* @__PURE__ */ A("button", {
|
|
694
|
+
type: "button",
|
|
695
|
+
"data-cloudlet-control": "clear",
|
|
696
|
+
className: o("clear", "cloudlet-close cloudlet-card-clear"),
|
|
697
|
+
"aria-label": h.clear,
|
|
698
|
+
"aria-describedby": g,
|
|
699
|
+
onClick: S,
|
|
700
|
+
children: e("m4.5 4.5 7 7m0-7-7 7")
|
|
701
|
+
}),
|
|
702
|
+
u === "top" && f
|
|
703
|
+
]
|
|
704
|
+
}), F = y.icon !== void 0 && y.icon !== null && y.icon !== !1 || y.kind === "loading" || typeof y.kind == "string" && Object.hasOwn(t, y.kind), I = /* @__PURE__ */ j(ee, { children: [/* @__PURE__ */ j("div", {
|
|
705
|
+
className: "cloudlet-card-head",
|
|
706
|
+
children: [/* @__PURE__ */ j("div", {
|
|
707
|
+
className: "cloudlet-heading",
|
|
708
|
+
children: [D, O]
|
|
709
|
+
}), P]
|
|
710
|
+
}), (k || N) && /* @__PURE__ */ j("div", {
|
|
711
|
+
className: o("body", "cloudlet-body"),
|
|
712
|
+
"data-kind": y.kind,
|
|
713
|
+
children: [k, N]
|
|
714
|
+
})] }), te = {
|
|
715
|
+
icon: F ? D : null,
|
|
716
|
+
title: O,
|
|
717
|
+
description: k,
|
|
718
|
+
actions: N,
|
|
719
|
+
time: P,
|
|
720
|
+
titleId: g,
|
|
721
|
+
dismiss: S,
|
|
722
|
+
action: T,
|
|
723
|
+
content: I
|
|
724
|
+
};
|
|
725
|
+
return /* @__PURE__ */ j("li", {
|
|
726
|
+
ref: _,
|
|
727
|
+
className: o("card", u === "edge" ? `cloudlet-card ${o("edge", "cloudlet-center-edge")}` : "cloudlet-card"),
|
|
728
|
+
"data-kind": y.kind,
|
|
729
|
+
"data-read": b ? "false" : void 0,
|
|
730
|
+
"data-icon": F ? void 0 : "none",
|
|
731
|
+
"data-cloudlet-motion-key": r,
|
|
732
|
+
"data-cloudlet-lag": l,
|
|
733
|
+
"data-cloudlet-place": u,
|
|
734
|
+
"aria-hidden": u === "edge" || u === "hidden" || void 0,
|
|
735
|
+
children: [
|
|
736
|
+
p && /* @__PURE__ */ A("span", {
|
|
737
|
+
className: "cloudlet-live",
|
|
738
|
+
children: p
|
|
739
|
+
}),
|
|
740
|
+
b && /* @__PURE__ */ j(ee, { children: [/* @__PURE__ */ A("span", {
|
|
741
|
+
className: "cloudlet-live",
|
|
742
|
+
children: h.unread
|
|
743
|
+
}), /* @__PURE__ */ A("span", {
|
|
744
|
+
className: o("unread", "cloudlet-center-unread"),
|
|
745
|
+
"aria-hidden": "true"
|
|
746
|
+
})] }),
|
|
747
|
+
a ? a(y, te) : I
|
|
748
|
+
]
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
function je(e, t) {
|
|
752
|
+
let n = /* @__PURE__ */ new Map();
|
|
753
|
+
return {
|
|
754
|
+
get(r, i) {
|
|
755
|
+
let a = n.get(r);
|
|
756
|
+
if (!a && e) {
|
|
757
|
+
let o = e.insertRule(`${t}${i} {}`, e.cssRules.length);
|
|
758
|
+
n.set(r, a = e.cssRules[o].style);
|
|
759
|
+
}
|
|
760
|
+
return a ?? null;
|
|
761
|
+
},
|
|
762
|
+
drop(t) {
|
|
763
|
+
let r = n.get(t);
|
|
764
|
+
if (r && e) {
|
|
765
|
+
n.delete(t);
|
|
766
|
+
for (let t = 0; t < e.cssRules.length; t++) if (e.cssRules[t].style === r) {
|
|
767
|
+
e.deleteRule(t);
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
clear() {
|
|
773
|
+
if (n.clear(), e) for (; e.cssRules.length;) e.deleteRule(0);
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
function X(e, t, n) {
|
|
778
|
+
e && (n ? e.setProperty(t, n) : e.removeProperty(t));
|
|
779
|
+
}
|
|
780
|
+
var Z = (e) => Math.min(1, Math.max(0, e)), Q = (e) => Math.round(e * 100) / 100, Me = {
|
|
781
|
+
y: 0,
|
|
782
|
+
s: 1,
|
|
783
|
+
c: 0,
|
|
784
|
+
vy: 0,
|
|
785
|
+
vs: 0,
|
|
786
|
+
clipping: !1
|
|
787
|
+
};
|
|
788
|
+
function Ne(e, t, o, s) {
|
|
789
|
+
let c = E(null), l = E(null), u = E(null), d = E(null), p = E({
|
|
790
|
+
props: e,
|
|
791
|
+
keys: o,
|
|
792
|
+
swipeable: s
|
|
793
|
+
}), b = E(null), S = E(null);
|
|
794
|
+
w(() => {
|
|
795
|
+
p.current = {
|
|
796
|
+
props: e,
|
|
797
|
+
keys: o,
|
|
798
|
+
swipeable: s
|
|
799
|
+
};
|
|
800
|
+
}), w(() => {
|
|
801
|
+
let e = t.current, a = e.ownerDocument.defaultView, o = je(c.current?.sheet, `#${e.id}`), s = e.offsetWidth || e.getBoundingClientRect().width, m = p.current.props.motion?.overrides, _ = g(m), v = () => {
|
|
802
|
+
let e = o.get("root", "");
|
|
803
|
+
X(e, "--cloudlet-center-swap", `${_.swap}ms`), X(e, "--cloudlet-center-swap-blur", `${_.swapBlur}px`), X(e, "--cloudlet-center-reduced", `${_.reduced}ms`), X(e, "--cloudlet-center-stack-step", `${_.stack.step}px`), X(e, "--cloudlet-center-stack-shrink", String(_.stack.shrink)), X(e, "--cloudlet-center-stack-reveal", `${_.stack.reveal}ms`), X(e, "--cloudlet-center-stack-blur", `${_.stack.blur}px`);
|
|
804
|
+
}, y = {
|
|
805
|
+
grouped: /* @__PURE__ */ new Set(),
|
|
806
|
+
edges: /* @__PURE__ */ new Set(),
|
|
807
|
+
hidden: /* @__PURE__ */ new Set()
|
|
808
|
+
}, x = "", C = "", w = "", T = (e) => e >= 1 ? "" : String(Q(Z(e) * 1e3) / 1e3), E = () => {
|
|
809
|
+
let e = Z(M.value("p")) * Z(M.value("fade")), t = T(e);
|
|
810
|
+
if (t !== x) {
|
|
811
|
+
x = t;
|
|
812
|
+
let e = o.get("backdrop", i);
|
|
813
|
+
X(e, "opacity", t), X(e, "visibility", t === "0" ? "hidden" : "");
|
|
814
|
+
}
|
|
815
|
+
let n = Z(M.value("blur")), a = n >= 1 ? "" : String(Q(e * n * 1e3) / 1e3);
|
|
816
|
+
if (a !== C) {
|
|
817
|
+
C = a;
|
|
818
|
+
let e = o.get("blur", r);
|
|
819
|
+
X(e, "opacity", a), X(e, "visibility", a === "0" ? "hidden" : "");
|
|
820
|
+
}
|
|
821
|
+
}, D = () => {
|
|
822
|
+
let e = T(M.value("fade"));
|
|
823
|
+
e !== w && (w = e, X(o.get("column", " > .cloudlet-center-column"), "opacity", e)), E();
|
|
824
|
+
}, O = () => {
|
|
825
|
+
let e = M.value("p"), t = p.current.props.side === "left" ? -1 : 1, n = (1 - e) * (s + _.travel) * t;
|
|
826
|
+
for (let e = 0; e <= 8; e++) {
|
|
827
|
+
let t = n * (1 + e * _.lag);
|
|
828
|
+
X(o.get(`lag${e}`, ` [data-cloudlet-lag="${e}"]`), "translate", Math.abs(t) < .01 ? "" : `${Q(t)}px 0`);
|
|
829
|
+
}
|
|
830
|
+
E();
|
|
831
|
+
let r = Z(e * 1.6 - .5);
|
|
832
|
+
X(o.get("header", " .cloudlet-center-header"), "opacity", r >= 1 ? "" : String(Q(r * 1e3) / 1e3));
|
|
833
|
+
}, k = (e) => {
|
|
834
|
+
let t = M.value(`x:${e}`), n = M.value(`y:${e}`), r = M.value(`s:${e}`), i = M.value(`o:${e}`) * (1 - Math.min(.7, Math.abs(t) / Math.max(1, s))), a = o.get(`card${e}`, ` [data-cloudlet-motion-key="${e}"]`);
|
|
835
|
+
X(a, "transform", Math.abs(t) < .01 && Math.abs(n) < .01 && r === 1 ? "" : Math.abs(t) < .01 ? `translateY(${Q(n)}px) scale(${Math.round(r * 1e4) / 1e4})` : `translate(${Q(t)}px, ${Q(n)}px) scale(${Math.round(r * 1e4) / 1e4})`), X(a, "opacity", i >= 1 ? "" : String(Math.round(i * 1e3) / 1e3)), X(a, "z-index", r !== 1 && !e.startsWith("x") && !y.grouped.has(e) ? "1" : "");
|
|
836
|
+
let c = M.value(`c:${e}`), l = e.startsWith("x");
|
|
837
|
+
X(a, "clip-path", (l || M.moving(`c:${e}`)) && (c > .01 || !l && y.edges.has(e)) ? `inset(${Q(c)}px -48px -48px)` : ""), X(a, "visibility", y.hidden.has(e) && i < 1 ? "visible" : "");
|
|
838
|
+
}, ee = (e) => {
|
|
839
|
+
let t = /* @__PURE__ */ new Set();
|
|
840
|
+
for (let n of e) n === "p" ? O() : n === "fade" ? D() : n === "blur" ? E() : t.add(n.slice(2));
|
|
841
|
+
for (let e of t) k(e);
|
|
842
|
+
}, A = null, j = n(e, () => p.current.props.reducedMotion === !0, (t) => {
|
|
843
|
+
e.dataset.reducedMotion = String(t), t && A?.cancel(), M.setReducedMotion(t);
|
|
844
|
+
});
|
|
845
|
+
e.dataset.reducedMotion = String(j.reduced);
|
|
846
|
+
let M = h({
|
|
847
|
+
now: () => a.performance.now(),
|
|
848
|
+
requestFrame: (e) => a.requestAnimationFrame ? a.requestAnimationFrame(e) : a.setTimeout(() => e(a.performance.now()), 16),
|
|
849
|
+
cancelFrame: (e) => a.cancelAnimationFrame ? a.cancelAnimationFrame(e) : a.clearTimeout(e),
|
|
850
|
+
write: ee,
|
|
851
|
+
reducedMotion: j.reduced,
|
|
852
|
+
timeScale: p.current.props.motion?.timeScale,
|
|
853
|
+
constants: _
|
|
854
|
+
});
|
|
855
|
+
b.current = M, v(), p.current.props.instant && M.place(!0), j.reduced || O();
|
|
856
|
+
let N = /* @__PURE__ */ new Map();
|
|
857
|
+
A = f(e, {
|
|
858
|
+
motion: M,
|
|
859
|
+
width: () => s,
|
|
860
|
+
travel: () => _.travel,
|
|
861
|
+
edge: () => p.current.props.side === "left" ? -1 : 1,
|
|
862
|
+
open: () => p.current.props.open,
|
|
863
|
+
close: () => p.current.props.setOpen(!1),
|
|
864
|
+
idOf: (e) => p.current.swipeable ? p.current.keys.idOf(e) : null,
|
|
865
|
+
dismiss: (e) => {
|
|
866
|
+
let { onDismiss: t, onClear: n } = p.current.props;
|
|
867
|
+
t ? t(e) : n?.([e]);
|
|
868
|
+
},
|
|
869
|
+
fling: (e, t, n) => {
|
|
870
|
+
let r = a.performance.now();
|
|
871
|
+
for (let [e, t] of N) r - t.at >= R && N.delete(e);
|
|
872
|
+
N.set(e, {
|
|
873
|
+
velocity: t,
|
|
874
|
+
direction: n,
|
|
875
|
+
at: r
|
|
876
|
+
});
|
|
877
|
+
},
|
|
878
|
+
now: () => a.performance.now()
|
|
879
|
+
});
|
|
880
|
+
let P = {
|
|
881
|
+
now: () => a.performance.now(),
|
|
882
|
+
flings: N,
|
|
883
|
+
width: () => s,
|
|
884
|
+
travel: () => _.travel,
|
|
885
|
+
cancelSwipe: () => A?.cancel(),
|
|
886
|
+
rules: o,
|
|
887
|
+
positions: /* @__PURE__ */ new Map(),
|
|
888
|
+
measured: !1,
|
|
889
|
+
leaving: [],
|
|
890
|
+
texts: [],
|
|
891
|
+
listed: /* @__PURE__ */ new Set(),
|
|
892
|
+
kinds: y,
|
|
893
|
+
folds: /* @__PURE__ */ new Map(),
|
|
894
|
+
refresh: () => {
|
|
895
|
+
let e = Pe(u.current, l.current);
|
|
896
|
+
y.grouped.clear(), y.edges.clear(), y.hidden.clear();
|
|
897
|
+
for (let [t, n] of e) n.box && y.grouped.add(t), (n.box?.kind === "edge" || n.box?.kind === "hidden") && y.edges.add(t), n.box?.kind === "hidden" && y.hidden.add(t), n.first !== void 0 && X(o.get(`card${t}`, ` [data-cloudlet-motion-key="${t}"]`), "--cloudlet-center-stack-top", n.expanded ? "" : `${Q(n.first)}px`);
|
|
898
|
+
return e;
|
|
899
|
+
},
|
|
900
|
+
sync: () => {
|
|
901
|
+
let e = p.current.props.motion?.overrides;
|
|
902
|
+
e !== m && (m = e, _ = g(e), M.setConstants(_), v()), M.setTimeScale(p.current.props.motion?.timeScale), j.sync();
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
S.current = P;
|
|
906
|
+
let F = a.ResizeObserver ? new a.ResizeObserver(() => {
|
|
907
|
+
let t = e.offsetWidth;
|
|
908
|
+
t && t !== s && (s = t, O()), P.positions = P.refresh();
|
|
909
|
+
}) : null;
|
|
910
|
+
return F?.observe(e), l.current && F?.observe(l.current), () => {
|
|
911
|
+
F?.disconnect(), A?.dispose(), A = null, j.dispose(), M.dispose(), b.current = null, S.current = null, o.clear(), d.current?.replaceChildren(), delete e.dataset.reducedMotion;
|
|
912
|
+
};
|
|
913
|
+
}, [t]);
|
|
914
|
+
let { open: C, onClosed: D } = e;
|
|
915
|
+
return w(() => {
|
|
916
|
+
t.current?.toggleAttribute("inert", !C), C || S.current?.cancelSwipe(), b.current?.setOpen(C, C ? void 0 : D);
|
|
917
|
+
}, [
|
|
918
|
+
C,
|
|
919
|
+
D,
|
|
920
|
+
t
|
|
921
|
+
]), w(() => {
|
|
922
|
+
let e = S.current, t = b.current;
|
|
923
|
+
if (!e || !t) return;
|
|
924
|
+
e.sync();
|
|
925
|
+
let n = d.current, { notifications: r } = p.current.props, i = new Set((Array.isArray(r) ? r : []).flatMap((e) => {
|
|
926
|
+
let t = e && typeof e.id == "string" ? p.current.keys.of(e.id) : null;
|
|
927
|
+
return t === null ? [] : [t];
|
|
928
|
+
}));
|
|
929
|
+
for (let r of e.leaving.splice(0)) {
|
|
930
|
+
if (r.item.isConnected || !n || i.has(r.key)) continue;
|
|
931
|
+
let { copy: a } = r;
|
|
932
|
+
if (!a) {
|
|
933
|
+
t.forget(r.key), e.rules.drop(`card${r.key}`);
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
936
|
+
let o = `x${r.key}`, s = {
|
|
937
|
+
x: t.value(`x:${r.key}`),
|
|
938
|
+
y: t.value(`y:${r.key}`),
|
|
939
|
+
scale: t.value(`s:${r.key}`),
|
|
940
|
+
opacity: t.value(`o:${r.key}`)
|
|
941
|
+
}, c, l = e.positions.get(r.key);
|
|
942
|
+
if (l?.box && l.origin !== void 0) {
|
|
943
|
+
let e = t.constants.stack, n = {
|
|
944
|
+
kind: "plain",
|
|
945
|
+
top: r.top,
|
|
946
|
+
height: l.box.height,
|
|
947
|
+
list: 0,
|
|
948
|
+
first: 0,
|
|
949
|
+
level: 0
|
|
950
|
+
}, i = (e) => ({
|
|
951
|
+
...e,
|
|
952
|
+
top: e.top + l.origin,
|
|
953
|
+
bottom: e.bottom + l.origin
|
|
954
|
+
}), a = v(n, i(y(l.box, {
|
|
955
|
+
...Me,
|
|
956
|
+
y: s.y,
|
|
957
|
+
s: s.scale,
|
|
958
|
+
c: t.value(`c:${r.key}`),
|
|
959
|
+
clipping: t.moving(`c:${r.key}`)
|
|
960
|
+
}, e)), e);
|
|
961
|
+
c = v(n, i(y(l.box, Me, e)), e), s = {
|
|
962
|
+
...s,
|
|
963
|
+
y: a.y,
|
|
964
|
+
scale: a.s,
|
|
965
|
+
clip: a.c
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
let u = e.flings.get(r.key);
|
|
969
|
+
e.flings.delete(r.key);
|
|
970
|
+
let d = u && e.now() - u.at < R ? {
|
|
971
|
+
to: u.direction * (e.width() + e.travel()),
|
|
972
|
+
velocity: u.velocity
|
|
973
|
+
} : void 0;
|
|
974
|
+
t.forget(r.key), e.rules.drop(`card${r.key}`), a.setAttribute("data-cloudlet-motion-key", o);
|
|
975
|
+
let f = e.rules.get(`card${o}`, ` [data-cloudlet-motion-key="${o}"]`);
|
|
976
|
+
X(f, "top", `${r.top}px`), X(f, "left", `${r.left}px`), X(f, "width", `${r.width}px`), n.append(a), t.exit(o, s, () => {
|
|
977
|
+
a.remove(), t.forget(o), e.rules.drop(`card${o}`);
|
|
978
|
+
}, d, c);
|
|
979
|
+
}
|
|
980
|
+
for (let r of e.texts.splice(0)) {
|
|
981
|
+
if (r.element.isConnected || !n) continue;
|
|
982
|
+
let i = `t${++Y}`, { copy: a } = r;
|
|
983
|
+
a.setAttribute("data-cloudlet-motion-key", i);
|
|
984
|
+
let o = e.rules.get(`card${i}`, ` [data-cloudlet-motion-key="${i}"]`);
|
|
985
|
+
X(o, "top", `${r.top}px`), X(o, "left", `${r.left}px`), X(o, "width", `${r.width}px`), X(o, "opacity", r.opacity >= 1 ? "" : String(Q(r.opacity))), a.setAttribute("data-cloudlet-unreveal", ""), n.append(a);
|
|
986
|
+
let s = n.ownerDocument.defaultView, c = 0, l = () => {
|
|
987
|
+
s.clearTimeout(c), a.remove(), e.rules.drop(`card${i}`);
|
|
988
|
+
};
|
|
989
|
+
a.addEventListener("animationend", l, { once: !0 }), c = s.setTimeout(l, (t.reduced ? t.constants.reduced : t.constants.stack.reveal) + 100);
|
|
990
|
+
}
|
|
991
|
+
let a = e.refresh();
|
|
992
|
+
if (e.measured) {
|
|
993
|
+
let n = t.constants.stack, r = /* @__PURE__ */ new Map();
|
|
994
|
+
for (let [i, o] of a) {
|
|
995
|
+
let s = e.positions.get(i);
|
|
996
|
+
if (s === void 0) {
|
|
997
|
+
p.current.props.open && !e.listed.has(i) && o.box?.kind !== "hidden" && t.enter(i);
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
if (s.parent !== o.parent) continue;
|
|
1001
|
+
if (!o.box || !s.box) {
|
|
1002
|
+
s.top !== o.top && t.shift(i, s.top - o.top);
|
|
1003
|
+
continue;
|
|
1004
|
+
}
|
|
1005
|
+
let c = s.box, l = o.box;
|
|
1006
|
+
if (c.kind === "hidden" && l.kind === "hidden") continue;
|
|
1007
|
+
let u = a.get(o.parent), d = e.positions.get(o.parent), f = u?.expanded !== d?.expanded, h = c.kind === l.kind && c.level === l.level;
|
|
1008
|
+
if (!f && h && c.top === l.top && c.height === l.height && c.list === l.list && (l.kind === "plain" || c.first === l.first)) continue;
|
|
1009
|
+
let g = f ? u?.expanded ? n.expand : n.collapse : h && l.kind === "plain" ? t.constants.reflow : n.collapse, b = l.kind === "hidden" ? "out" : c.kind === "hidden" ? "in" : void 0;
|
|
1010
|
+
t.fold(i, (e) => v(l, y(c, e, n), n), {
|
|
1011
|
+
spring: g,
|
|
1012
|
+
clip: _(l),
|
|
1013
|
+
fade: b,
|
|
1014
|
+
delay: m(g, Math.min(o.index ?? 0, 8) * n.cascade)
|
|
1015
|
+
});
|
|
1016
|
+
let x = r.get(o.parent);
|
|
1017
|
+
x || r.set(o.parent, x = []), x.push(i);
|
|
1018
|
+
}
|
|
1019
|
+
for (let [t, n] of r) e.folds.set(t, n);
|
|
1020
|
+
}
|
|
1021
|
+
for (let n of e.positions.keys()) n.startsWith("g") && !a.has(n) && (t.forget(n), e.rules.drop(`card${n}`), e.folds.delete(n));
|
|
1022
|
+
e.positions = a, e.listed = i, e.measured = !0;
|
|
1023
|
+
}), {
|
|
1024
|
+
styleRef: c,
|
|
1025
|
+
stackRef: l,
|
|
1026
|
+
listRef: u,
|
|
1027
|
+
exitsRef: d,
|
|
1028
|
+
leave: x((e, t) => {
|
|
1029
|
+
let n = S.current;
|
|
1030
|
+
if (!n || !b.current) return;
|
|
1031
|
+
let r = l.current, i = null, a = t.dataset.cloudletPlace;
|
|
1032
|
+
a !== "hidden" && (i = t.cloneNode(!0), t.matches(":hover, :focus-within") && i.setAttribute("data-cloudlet-swapped", ""), i.removeAttribute("data-cloudlet-place"), a === "edge" && i.setAttribute("data-cloudlet-edge", ""), Fe(i));
|
|
1033
|
+
let { top: o, left: s } = $(t, r);
|
|
1034
|
+
n.leaving = n.leaving.filter((t) => t.key !== e), n.leaving.push({
|
|
1035
|
+
key: e,
|
|
1036
|
+
item: t,
|
|
1037
|
+
copy: i,
|
|
1038
|
+
top: o,
|
|
1039
|
+
left: s,
|
|
1040
|
+
width: t.offsetWidth
|
|
1041
|
+
});
|
|
1042
|
+
}, []),
|
|
1043
|
+
texts: T(() => ({
|
|
1044
|
+
reveal(e) {
|
|
1045
|
+
S.current?.measured && e.setAttribute("data-cloudlet-reveal", "");
|
|
1046
|
+
},
|
|
1047
|
+
leave(e) {
|
|
1048
|
+
let t = S.current, n = e.ownerDocument.defaultView;
|
|
1049
|
+
if (!t || !n) return;
|
|
1050
|
+
let r = e.cloneNode(!0);
|
|
1051
|
+
r.removeAttribute("data-cloudlet-reveal"), Fe(r);
|
|
1052
|
+
let i = Number(n.getComputedStyle(e).opacity), { top: a, left: o } = $(e, l.current);
|
|
1053
|
+
t.texts = t.texts.filter((t) => t.element !== e), t.texts.push({
|
|
1054
|
+
element: e,
|
|
1055
|
+
copy: r,
|
|
1056
|
+
top: a,
|
|
1057
|
+
left: o,
|
|
1058
|
+
width: e.offsetWidth,
|
|
1059
|
+
opacity: Number.isFinite(i) ? i : 1
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
}), []),
|
|
1063
|
+
folding: x((e) => {
|
|
1064
|
+
let t = b.current, n = S.current?.folds.get(e);
|
|
1065
|
+
return !!t && !!n && n.some((e) => t.moving(`y:${e}`) || t.moving(`s:${e}`));
|
|
1066
|
+
}, []),
|
|
1067
|
+
motionRef: b,
|
|
1068
|
+
setBlur: x((e) => {
|
|
1069
|
+
b.current?.setBlur(e, a.fade);
|
|
1070
|
+
}, [])
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
function Pe(e, t) {
|
|
1074
|
+
let n = /* @__PURE__ */ new Map();
|
|
1075
|
+
if (!e) return n;
|
|
1076
|
+
for (let r of e.children) {
|
|
1077
|
+
let e = r.dataset.cloudletMotionKey;
|
|
1078
|
+
if (!e) continue;
|
|
1079
|
+
let i = r.querySelector(":scope > .cloudlet-center-group-box > .cloudlet-center-group-list");
|
|
1080
|
+
if (!i) {
|
|
1081
|
+
n.set(e, {
|
|
1082
|
+
top: r.offsetTop,
|
|
1083
|
+
parent: ""
|
|
1084
|
+
});
|
|
1085
|
+
continue;
|
|
1086
|
+
}
|
|
1087
|
+
let a = [...i.children], o = a[0]?.offsetHeight ?? 0;
|
|
1088
|
+
n.set(e, {
|
|
1089
|
+
top: r.offsetTop,
|
|
1090
|
+
parent: "",
|
|
1091
|
+
expanded: r.dataset.expanded === "true",
|
|
1092
|
+
first: o
|
|
1093
|
+
});
|
|
1094
|
+
let s = $(r, t).top, c = $(i, t).top - s;
|
|
1095
|
+
a.forEach((t, r) => {
|
|
1096
|
+
let i = t.dataset.cloudletMotionKey;
|
|
1097
|
+
if (!i) return;
|
|
1098
|
+
let a = t.dataset.cloudletPlace, l = a === "edge" ? "edge" : a === "hidden" ? "hidden" : "plain", u = {
|
|
1099
|
+
kind: l,
|
|
1100
|
+
top: c + t.offsetTop,
|
|
1101
|
+
height: t.offsetHeight,
|
|
1102
|
+
list: c,
|
|
1103
|
+
first: o,
|
|
1104
|
+
level: l === "plain" ? 0 : l === "edge" ? r : Se
|
|
1105
|
+
};
|
|
1106
|
+
n.set(i, {
|
|
1107
|
+
top: t.offsetTop,
|
|
1108
|
+
parent: e,
|
|
1109
|
+
box: u,
|
|
1110
|
+
index: r,
|
|
1111
|
+
origin: s
|
|
1112
|
+
});
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
return n;
|
|
1116
|
+
}
|
|
1117
|
+
function $(e, t) {
|
|
1118
|
+
let n = 0, r = 0;
|
|
1119
|
+
for (let i = e; i && i !== t; i = i.offsetParent) n += i.offsetTop, r += i.offsetLeft;
|
|
1120
|
+
return {
|
|
1121
|
+
top: n,
|
|
1122
|
+
left: r
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
function Fe(e) {
|
|
1126
|
+
for (let t of [e, ...e.querySelectorAll("*")]) for (let e of [...t.getAttributeNames()]) (e === "id" || e === "role" || e === "tabindex" || e === "for" || e === "name" || e.startsWith("aria-")) && t.removeAttribute(e);
|
|
1127
|
+
e.setAttribute("inert", "");
|
|
1128
|
+
}
|
|
1129
|
+
function Ie(e, t, n, r, i, a) {
|
|
1130
|
+
let o = E(null), s = E(t), c = E(r);
|
|
1131
|
+
c.current = r;
|
|
1132
|
+
let l = E(e);
|
|
1133
|
+
l.current = e;
|
|
1134
|
+
let u = E(null), d = E(null);
|
|
1135
|
+
w(() => {
|
|
1136
|
+
if (!e) return;
|
|
1137
|
+
d.current = null;
|
|
1138
|
+
let t = i.current, r = t.ownerDocument, f = r.defaultView, p = u.current;
|
|
1139
|
+
if (!p) {
|
|
1140
|
+
let e = r.activeElement;
|
|
1141
|
+
p = u.current = {
|
|
1142
|
+
previous: e instanceof f.HTMLElement && e !== r.body && !t.contains(e) ? e : null,
|
|
1143
|
+
opener: n.opener
|
|
1144
|
+
}, s.current || a.current?.focus({ preventScroll: !0 });
|
|
1145
|
+
}
|
|
1146
|
+
s.current = !1;
|
|
1147
|
+
let { previous: m, opener: h } = p, g = (e) => e instanceof f.Node && (t.contains(e) || V(n).some((t) => t.contains(e))), _ = (e) => {
|
|
1148
|
+
if (e.key !== "Escape" || e.isComposing || e.keyCode === 229) return;
|
|
1149
|
+
let t = e.target;
|
|
1150
|
+
(t === r.body || t === r.documentElement || g(t)) && (e.stopPropagation(), c.current(!1));
|
|
1151
|
+
}, v = (e) => {
|
|
1152
|
+
if (e.button !== 0 || e.ctrlKey) return;
|
|
1153
|
+
let r = e.composedPath();
|
|
1154
|
+
r.includes(t) || V(n).some((e) => r.includes(e)) || c.current(!1);
|
|
1155
|
+
};
|
|
1156
|
+
return r.addEventListener("keydown", _, !0), r.addEventListener("pointerdown", v, !0), () => {
|
|
1157
|
+
r.removeEventListener("keydown", _, !0), r.removeEventListener("pointerdown", v, !0);
|
|
1158
|
+
let e = () => {
|
|
1159
|
+
let e = r.activeElement;
|
|
1160
|
+
return !e || e === r.body || t.contains(e);
|
|
1161
|
+
}, i = () => [
|
|
1162
|
+
h,
|
|
1163
|
+
m,
|
|
1164
|
+
...H(n)
|
|
1165
|
+
].find((e) => b(e)) ?? null;
|
|
1166
|
+
if (!l.current) {
|
|
1167
|
+
u.current = null, e() && (o.current = i());
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
if (!e()) return;
|
|
1171
|
+
let a = () => {
|
|
1172
|
+
d.current === a && (d.current = null, u.current = null, e() && i());
|
|
1173
|
+
};
|
|
1174
|
+
d.current = a, queueMicrotask(a);
|
|
1175
|
+
};
|
|
1176
|
+
}, [
|
|
1177
|
+
e,
|
|
1178
|
+
n,
|
|
1179
|
+
i,
|
|
1180
|
+
a
|
|
1181
|
+
]), w(() => {
|
|
1182
|
+
let t = o.current;
|
|
1183
|
+
o.current = null, e || (n.opener = null), !e && t && i.current?.contains(t.ownerDocument.activeElement) && b(t);
|
|
1184
|
+
}, [
|
|
1185
|
+
e,
|
|
1186
|
+
n,
|
|
1187
|
+
i
|
|
1188
|
+
]);
|
|
1189
|
+
}
|
|
1190
|
+
function Le(e, t, n, r, i) {
|
|
1191
|
+
let a = E(null), o = E(e);
|
|
1192
|
+
return w(() => {
|
|
1193
|
+
let s = a.current, c = o.current, l = c.flatMap((e) => e.entries);
|
|
1194
|
+
a.current = null, o.current = e;
|
|
1195
|
+
let u = r.current;
|
|
1196
|
+
if (s === null || !u) return;
|
|
1197
|
+
let d = u.ownerDocument;
|
|
1198
|
+
if (d.activeElement && d.activeElement !== d.body) return;
|
|
1199
|
+
let f = new Map(e.flatMap((e) => e.entries.map((t) => [t.id, e]))), p = f.has(s), m = p ? s : l.slice(l.findIndex((e) => e.id === s) + 1).find((e) => f.has(e.id))?.id, h = m === void 0 ? void 0 : f.get(m), g = null;
|
|
1200
|
+
if (m !== void 0 && h) {
|
|
1201
|
+
let e = c.find((e) => e.entries.some((e) => e.id === s))?.key ?? null, r = p || h.key === null || h.entries.length < 2 || h.key === e ? u.querySelector(`.cloudlet-center-list [data-cloudlet-motion-key="${n.of(m)}"]:not([data-cloudlet-place])`) : null, i = h.key === null ? null : u.querySelector(`.cloudlet-center-list > [data-cloudlet-motion-key="${t(h.key)}"]`);
|
|
1202
|
+
g = r ? r.querySelector("[data-cloudlet-control=\"clear\"]") ?? r.querySelector(".cloudlet-title") : i?.querySelector(p ? ".cloudlet-center-more, .cloudlet-center-group-title" : ".cloudlet-center-stack-clear, .cloudlet-center-group-title, .cloudlet-center-more");
|
|
1203
|
+
}
|
|
1204
|
+
b(g) || i.current?.focus({ preventScroll: !0 });
|
|
1205
|
+
}, [
|
|
1206
|
+
e,
|
|
1207
|
+
t,
|
|
1208
|
+
n,
|
|
1209
|
+
r,
|
|
1210
|
+
i
|
|
1211
|
+
]), a;
|
|
1212
|
+
}
|
|
1213
|
+
function Re(e, t) {
|
|
1214
|
+
let n = e.createElement("div");
|
|
1215
|
+
return n.className = "cloudlet-announcer", n.setAttribute("aria-live", t), n.setAttribute("aria-atomic", "true"), n;
|
|
1216
|
+
}
|
|
1217
|
+
function ze(e) {
|
|
1218
|
+
if (!e) return "";
|
|
1219
|
+
let t = [e.querySelector(".cloudlet-title"), e.querySelector(".cloudlet-description")].map((e) => e?.textContent?.trim() ?? "").filter(Boolean);
|
|
1220
|
+
return (t.length ? t : [e.textContent?.trim() ?? ""]).join(". ").replace(/\s+/gu, " ");
|
|
1221
|
+
}
|
|
1222
|
+
function Be(e, t, n, r) {
|
|
1223
|
+
let i = E(/* @__PURE__ */ new Set()), a = E(t), o = E([]), s = E(() => {});
|
|
1224
|
+
w(() => {
|
|
1225
|
+
a.current = t;
|
|
1226
|
+
}), S(() => {
|
|
1227
|
+
if (!e) return;
|
|
1228
|
+
i.current = new Set(a.current.map((e) => e.id));
|
|
1229
|
+
let t = r.current, c = t.ownerDocument, l = c.defaultView, u = Re(c, "polite");
|
|
1230
|
+
u.dataset.cloudletCenterAnnouncer = "", t.after(u);
|
|
1231
|
+
let d = l.requestAnimationFrame?.(() => {
|
|
1232
|
+
u.isConnected && t.after(u);
|
|
1233
|
+
}), f;
|
|
1234
|
+
return s.current = () => {
|
|
1235
|
+
f === void 0 && (f = l.setTimeout(() => {
|
|
1236
|
+
f = void 0;
|
|
1237
|
+
let e = o.current.splice(0);
|
|
1238
|
+
if (c.visibilityState === "hidden") return;
|
|
1239
|
+
let r = new Set(a.current.map((e) => e.id)), i = e.filter((e) => r.has(e)).map((e) => ze(t.querySelector(`.cloudlet-center-list [data-cloudlet-motion-key="${n.of(e)}"]`))).filter(Boolean);
|
|
1240
|
+
if (!i.length) return;
|
|
1241
|
+
let s = i.join(". ");
|
|
1242
|
+
u.textContent === s && (s += "\xA0"), u.replaceChildren(c.createTextNode(s));
|
|
1243
|
+
}, L));
|
|
1244
|
+
}, () => {
|
|
1245
|
+
s.current = () => {}, o.current = [], l.clearTimeout(f), d !== void 0 && l.cancelAnimationFrame(d), u.remove();
|
|
1246
|
+
};
|
|
1247
|
+
}, [
|
|
1248
|
+
e,
|
|
1249
|
+
n,
|
|
1250
|
+
r
|
|
1251
|
+
]), S(() => {
|
|
1252
|
+
if (!e) return;
|
|
1253
|
+
let n = !1;
|
|
1254
|
+
for (let e of t) i.current.has(e.id) || (i.current.add(e.id), o.current.push(e.id), n = !0);
|
|
1255
|
+
n && s.current();
|
|
1256
|
+
}, [e, t]);
|
|
1257
|
+
}
|
|
1258
|
+
function Ve(e, t, n) {
|
|
1259
|
+
let r = E(/* @__PURE__ */ new Set()), i = E(!1), [a, o] = D(0);
|
|
1260
|
+
S(() => {
|
|
1261
|
+
if (!e) {
|
|
1262
|
+
i.current = !1;
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
i.current || (r.current = /* @__PURE__ */ new Set()), i.current = !0;
|
|
1266
|
+
let t = () => {
|
|
1267
|
+
document.visibilityState !== "hidden" && o((e) => e + 1);
|
|
1268
|
+
};
|
|
1269
|
+
return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
|
|
1270
|
+
}, [e]), S(() => {
|
|
1271
|
+
if (!e || document.visibilityState === "hidden") return;
|
|
1272
|
+
let i = t.filter((e) => e.item.read === !1 && !r.current.has(e.id)).map((e) => e.id);
|
|
1273
|
+
if (i.length) {
|
|
1274
|
+
for (let e of i) r.current.add(e);
|
|
1275
|
+
n.current?.onRead?.(i);
|
|
1276
|
+
}
|
|
1277
|
+
}, [
|
|
1278
|
+
e,
|
|
1279
|
+
t,
|
|
1280
|
+
a,
|
|
1281
|
+
n
|
|
1282
|
+
]);
|
|
1283
|
+
}
|
|
1284
|
+
//#endregion
|
|
1285
|
+
export { fe as NotificationCenter, z as defaultCenterLabels, ce as useNotificationCenter };
|
|
1286
|
+
|
|
1287
|
+
//# sourceMappingURL=center.js.map
|