@cloudlet/toast 0.0.0-stage → 1.0.0-rc.3
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 +236 -0
- package/LICENSE +21 -0
- package/README.md +64 -2
- package/THIRD_PARTY_NOTICES.md +149 -0
- package/dist/contracts/controller.d.ts +71 -0
- package/dist/contracts/controller.d.ts.map +1 -0
- package/dist/contracts/events.d.ts +72 -0
- package/dist/contracts/events.d.ts.map +1 -0
- package/dist/contracts/identity.d.ts +32 -0
- package/dist/contracts/identity.d.ts.map +1 -0
- package/dist/contracts/internal.d.ts +188 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/notifications.d.ts +101 -0
- package/dist/contracts/notifications.d.ts.map +1 -0
- package/dist/contracts/operations.d.ts +76 -0
- package/dist/contracts/operations.d.ts.map +1 -0
- package/dist/contracts/snapshots.d.ts +48 -0
- package/dist/contracts/snapshots.d.ts.map +1 -0
- package/dist/core/controller.d.ts +7 -0
- package/dist/core/controller.d.ts.map +1 -0
- package/dist/core/controller.js +954 -0
- package/dist/core/controller.js.map +1 -0
- package/dist/core/validation.d.ts +17 -0
- package/dist/core/validation.d.ts.map +1 -0
- package/dist/core/validation.js +298 -0
- package/dist/core/validation.js.map +1 -0
- package/dist/create-cloudlet.d.ts +5 -0
- package/dist/create-cloudlet.d.ts.map +1 -0
- package/dist/create-cloudlet.js +34 -0
- package/dist/create-cloudlet.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/react/announcer.d.ts +15 -0
- package/dist/react/announcer.d.ts.map +1 -0
- package/dist/react/announcer.js +134 -0
- package/dist/react/announcer.js.map +1 -0
- package/dist/react/bindings.d.ts +8 -0
- package/dist/react/bindings.d.ts.map +1 -0
- package/dist/react/bindings.js +84 -0
- package/dist/react/bindings.js.map +1 -0
- package/dist/react/card.d.ts +58 -0
- package/dist/react/card.d.ts.map +1 -0
- package/dist/react/card.js +300 -0
- package/dist/react/card.js.map +1 -0
- package/dist/react/generators.d.ts +46 -0
- package/dist/react/generators.d.ts.map +1 -0
- package/dist/react/generators.js +115 -0
- package/dist/react/generators.js.map +1 -0
- package/dist/react/gestures.d.ts +50 -0
- package/dist/react/gestures.d.ts.map +1 -0
- package/dist/react/gestures.js +239 -0
- package/dist/react/gestures.js.map +1 -0
- package/dist/react/host.d.ts +37 -0
- package/dist/react/host.d.ts.map +1 -0
- package/dist/react/host.js +816 -0
- package/dist/react/host.js.map +1 -0
- package/dist/react/motion.d.ts +206 -0
- package/dist/react/motion.d.ts.map +1 -0
- package/dist/react/motion.js +414 -0
- package/dist/react/motion.js.map +1 -0
- package/dist/react/plan.d.ts +45 -0
- package/dist/react/plan.d.ts.map +1 -0
- package/dist/react/plan.js +58 -0
- package/dist/react/plan.js.map +1 -0
- package/dist/react/shape.d.ts +7 -0
- package/dist/react/shape.d.ts.map +1 -0
- package/dist/react/shape.js +21 -0
- package/dist/react/shape.js.map +1 -0
- package/dist/react/viewport.d.ts +15 -0
- package/dist/react/viewport.d.ts.map +1 -0
- package/dist/react/viewport.js +16 -0
- package/dist/react/viewport.js.map +1 -0
- package/dist/react.d.ts +176 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +2 -0
- package/dist/styles.css +1 -0
- package/package.json +17 -4
- package/src/contracts/controller.ts +61 -0
- package/src/contracts/events.ts +47 -0
- package/src/contracts/identity.ts +27 -0
- package/src/contracts/internal.ts +150 -0
- package/src/contracts/notifications.ts +104 -0
- package/src/contracts/operations.ts +71 -0
- package/src/contracts/snapshots.ts +59 -0
- package/src/core/controller.ts +1038 -0
- package/src/core/validation.ts +290 -0
- package/src/create-cloudlet.ts +43 -0
- package/src/index.ts +34 -0
- package/src/react/announcer.ts +189 -0
- package/src/react/bindings.tsx +100 -0
- package/src/react/card.tsx +222 -0
- package/src/react/generators.ts +274 -0
- package/src/react/gestures.ts +296 -0
- package/src/react/host.tsx +947 -0
- package/src/react/motion.ts +484 -0
- package/src/react/plan.ts +101 -0
- package/src/react/shape.ts +33 -0
- package/src/react/viewport.ts +10 -0
- package/src/react.ts +190 -0
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
import { Body as e, Heading as t, SlidePreview as n, closeButton as r, defaultLabels as i, partClasses as a, slotRenderer as o } from "./card.js";
|
|
2
|
+
import { createAnnouncer as s } from "./announcer.js";
|
|
3
|
+
import { MOTION as c, createShellMotion as l, resolveMotion as u } from "./motion.js";
|
|
4
|
+
import { createSwipe as d, decideRelease as f, rubberBand as p } from "./gestures.js";
|
|
5
|
+
import { createRoundedRectPath as m } from "./shape.js";
|
|
6
|
+
import { emptyView as h, planShell as g, shellView as _ } from "./plan.js";
|
|
7
|
+
import { visibleViewport as v } from "./viewport.js";
|
|
8
|
+
import { Component as y, createRef as b, useLayoutEffect as x, useRef as S } from "react";
|
|
9
|
+
import { Fragment as ee, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
10
|
+
//#region src/react/host.tsx
|
|
11
|
+
function T(e) {
|
|
12
|
+
let t = e.cloneNode(!0);
|
|
13
|
+
for (let e of [t, ...t.querySelectorAll("*")]) for (let { name: t } of [...e.attributes]) (t === "id" || t === "role" || t === "tabindex" || t === "href" || t.startsWith("aria-") || t.startsWith("data-cloudlet-")) && e.removeAttribute(t);
|
|
14
|
+
for (let e of t.querySelectorAll(E)) e.replaceChildren();
|
|
15
|
+
for (let e of t.querySelectorAll(".cloudlet-live,.cloudlet-pill")) e.remove();
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
var E = ".cloudlet-exit,.cloudlet-slide-out,.cloudlet-chrome-out,.cloudlet-heading-out,.cloudlet-body-out,.cloudlet-badge-out,.cloudlet-page-out", D = class extends y {
|
|
19
|
+
#e = j(this);
|
|
20
|
+
componentDidMount = this.#e.componentDidMount;
|
|
21
|
+
getSnapshotBeforeUpdate = this.#e.getSnapshotBeforeUpdate;
|
|
22
|
+
componentDidUpdate = this.#e.componentDidUpdate;
|
|
23
|
+
componentWillUnmount = this.#e.componentWillUnmount;
|
|
24
|
+
render = this.#e.render;
|
|
25
|
+
}, te = {
|
|
26
|
+
viewport: "",
|
|
27
|
+
shell: " .cloudlet-stack > .cloudlet-shell",
|
|
28
|
+
bg: " .cloudlet-stack > .cloudlet-shell > .cloudlet-bg",
|
|
29
|
+
clip: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip",
|
|
30
|
+
badge: " .cloudlet-stack > .cloudlet-shell > .cloudlet-badge",
|
|
31
|
+
badgeIn: " .cloudlet-stack > .cloudlet-shell > .cloudlet-badge > .cloudlet-badge-value",
|
|
32
|
+
badgeOut: " .cloudlet-stack > .cloudlet-shell > .cloudlet-badge > .cloudlet-badge-out",
|
|
33
|
+
slideOut: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-slide-out",
|
|
34
|
+
peek: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-peek",
|
|
35
|
+
chrome: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > :is(.cloudlet-close,.cloudlet-indicator)",
|
|
36
|
+
chromeOut: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-chrome-out",
|
|
37
|
+
headerIn: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-slide > .cloudlet-header > .cloudlet-heading",
|
|
38
|
+
headerOut: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-slide > .cloudlet-header > .cloudlet-heading-out",
|
|
39
|
+
body: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-slide > .cloudlet-body",
|
|
40
|
+
bodyOut: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-slide > .cloudlet-body-out",
|
|
41
|
+
pageIn: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-indicator > .cloudlet-page > .cloudlet-page-value",
|
|
42
|
+
pageOut: " .cloudlet-stack > .cloudlet-shell > .cloudlet-clip > .cloudlet-indicator > .cloudlet-page > .cloudlet-page-out",
|
|
43
|
+
tail1: " .cloudlet-stack > [data-cloudlet-tail=\"1\"]",
|
|
44
|
+
tail2: " .cloudlet-stack > [data-cloudlet-tail=\"2\"]",
|
|
45
|
+
exit: " .cloudlet-stack > .cloudlet-exit",
|
|
46
|
+
exitClip: " .cloudlet-stack > .cloudlet-exit > .cloudlet-shell > .cloudlet-clip",
|
|
47
|
+
exitBg: " .cloudlet-stack > .cloudlet-exit > .cloudlet-shell > .cloudlet-bg",
|
|
48
|
+
exitBadge: " .cloudlet-stack > .cloudlet-exit > .cloudlet-shell > .cloudlet-badge"
|
|
49
|
+
}, O = (e) => Math.max(0, Math.min(1, e)), ne = (e) => e?.setAttribute("inert", ""), k = (e) => `${Math.round(e * 100) / 100}px`, re = (e, t) => t || e <= .01 ? "none" : `blur(${k(e)})`;
|
|
50
|
+
function A(e, t, n) {
|
|
51
|
+
let r = parseFloat(e?.getPropertyValue(t) ?? "");
|
|
52
|
+
return Number.isFinite(r) ? r : n;
|
|
53
|
+
}
|
|
54
|
+
function j(y) {
|
|
55
|
+
let { bridge: x, lease: S, document: E } = y.props, D = E.defaultView, j = b(), oe = b(), se = b(), M = b(), N = b(), ce = b(), le = b(), P = b(), ue = b(), de = b(), F = s(x, S, E, () => y.props.options.announcements), fe = null, pe = null, me = null, he = !1, ge = null, I = {}, _e = !1, L = null, ve = !1, R = null, ye = y.props.options.motion?.overrides, z = u(ye), be = () => {
|
|
56
|
+
let e = y.props.options.motion?.overrides;
|
|
57
|
+
e !== ye && (ye = e, z = u(e), R?.setConstants(z));
|
|
58
|
+
}, B = !1, xe = !1, V = null, H = {
|
|
59
|
+
width: 0,
|
|
60
|
+
height: 0,
|
|
61
|
+
bodyTop: 0
|
|
62
|
+
}, Se = 0, Ce = -Infinity, U = {
|
|
63
|
+
tailOffset: 4,
|
|
64
|
+
tailScale: .9,
|
|
65
|
+
pillHeight: 44
|
|
66
|
+
}, W = !1, we = "instant", Te = /* @__PURE__ */ new Set(), G = 0, Ee = 2, K = null, De = null, Oe = !1, ke = null, q = null, Ae = !1, J = null, Y = null, X = null, je = /* @__PURE__ */ new WeakSet(), Me = [];
|
|
67
|
+
function Ne(e, t, ...n) {
|
|
68
|
+
try {
|
|
69
|
+
let t = e(...n);
|
|
70
|
+
if (typeof t != "string") throw TypeError("Label formatter must return a string");
|
|
71
|
+
return t;
|
|
72
|
+
} catch (r) {
|
|
73
|
+
return je.has(e) || (je.add(e), Me.push(r)), t(...n);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function Pe() {
|
|
77
|
+
for (let e of Me.splice(0)) x.reportDiagnostic(S, {
|
|
78
|
+
code: "formatter-error",
|
|
79
|
+
source: "Toaster.labels",
|
|
80
|
+
message: "A label formatter failed",
|
|
81
|
+
error: e
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
let Z = (e, t) => x.setPause(S, {
|
|
85
|
+
scope: "host",
|
|
86
|
+
reason: e,
|
|
87
|
+
active: t
|
|
88
|
+
}), Fe = (e) => {
|
|
89
|
+
xe !== e && (xe = e, Z("hover", e), R?.setHover(e));
|
|
90
|
+
}, Ie = (e) => {
|
|
91
|
+
if (Le(e), !(D && e instanceof D.HTMLElement && !e.closest(".cloudlet-slot") && Q(e)) && !Q(fe)) {
|
|
92
|
+
let e = E.activeElement;
|
|
93
|
+
D && e instanceof D.HTMLElement && e.blur(), j.current?.focus({ preventScroll: !0 });
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function Le(e) {
|
|
97
|
+
D && e instanceof D.HTMLElement && e !== E.body && !j.current?.contains(e) && (fe = e);
|
|
98
|
+
}
|
|
99
|
+
function Q(e) {
|
|
100
|
+
if (!e?.isConnected || e.closest("[hidden],[inert],[aria-hidden=\"true\"]") || e.matches(":disabled")) return !1;
|
|
101
|
+
for (let t = e; t; t = t.parentElement) {
|
|
102
|
+
let e = D?.getComputedStyle(t);
|
|
103
|
+
if (e?.display === "none" || e?.visibility === "hidden" || e?.visibility === "collapse" || e?.contentVisibility === "hidden") return !1;
|
|
104
|
+
}
|
|
105
|
+
return e.focus({ preventScroll: !0 }), E.activeElement === e;
|
|
106
|
+
}
|
|
107
|
+
function Re() {
|
|
108
|
+
if (Q(fe)) return !0;
|
|
109
|
+
for (let e of E.querySelectorAll("button,a[href],input,select,textarea,summary,[tabindex]")) if (e.tabIndex >= 0 && !e.closest(".cloudlet-host") && Q(e)) return !0;
|
|
110
|
+
let e = E.body.getAttribute("tabindex");
|
|
111
|
+
E.body.setAttribute("tabindex", "-1");
|
|
112
|
+
let t = Q(E.body);
|
|
113
|
+
return e === null ? E.body.removeAttribute("tabindex") : E.body.setAttribute("tabindex", e), t;
|
|
114
|
+
}
|
|
115
|
+
let ze = (e) => {
|
|
116
|
+
let t = !!e && !!j.current?.contains(e);
|
|
117
|
+
Z("focus", t), x.setFocused(S, t ? x.getSnapshot().presentation?.handle ?? null : null);
|
|
118
|
+
};
|
|
119
|
+
function Be() {
|
|
120
|
+
if (!_e || !D) return;
|
|
121
|
+
let e = E.documentElement.clientWidth || D.innerWidth, t = E.documentElement.clientHeight || D.innerHeight, n = v(e, t, D.visualViewport);
|
|
122
|
+
for (let e of [
|
|
123
|
+
"top",
|
|
124
|
+
"right",
|
|
125
|
+
"bottom",
|
|
126
|
+
"left",
|
|
127
|
+
"width",
|
|
128
|
+
"height"
|
|
129
|
+
]) I.viewport?.setProperty(`--cloudlet-viewport-${e}`, `${n[e]}px`);
|
|
130
|
+
}
|
|
131
|
+
let Ve = () => j.current?.dataset.edge === "bottom", He = () => Ve() ? 1 : -1;
|
|
132
|
+
function Ue(e) {
|
|
133
|
+
let t = I, { reduced: n } = e, r = Math.max(0, e.width), i = Math.max(0, e.height), a = Math.min(Math.max(0, e.radius), r / 2, i / 2), o = Ve(), s = o ? H.height - i : 0;
|
|
134
|
+
t.shell && (t.shell.opacity = String(O(e.opacity)), t.shell.transform = n ? "none" : `translate(${k(e.dragX)}, ${k(e.y + e.dragY)}) scale(${e.scale})`);
|
|
135
|
+
let c = ce.current;
|
|
136
|
+
if (c && (c.setAttribute("width", String(r)), c.setAttribute("height", String(i)), le.current?.setAttribute("d", m(r, i, a))), t.bg && (t.bg.borderRadius = k(a)), t.clip && (t.clip.clipPath = `path("${m(r, i, a, (H.width - r) / 2, s)}")`), t.badge) {
|
|
137
|
+
let i = n ? 1 : z.badge.scale + (1 - z.badge.scale) * e.badge, a = (r / 2 - 10) * (Ae ? -1 : 1);
|
|
138
|
+
t.badge.opacity = String(O(e.badge)), t.badge.transform = `translate(calc(${k(a)} - 50%), ${o ? "6px" : "-6px"}) scale(${i})`;
|
|
139
|
+
}
|
|
140
|
+
let l = o ? -1 : 1;
|
|
141
|
+
for (let n of [1, 2]) {
|
|
142
|
+
let a = t[`tail${n}`];
|
|
143
|
+
if (!a) continue;
|
|
144
|
+
let o = e[`tail${n}`];
|
|
145
|
+
a.width = k(r), a.height = k(Math.min(i, U.pillHeight)), a.opacity = String(O(e[`tail${n}Opacity`])), a.transform = `translateX(-50%) translateY(${k(l * o * (U.tailOffset + z.hoverLift * e.lift))}) scale(${U.tailScale ** +o})`;
|
|
146
|
+
}
|
|
147
|
+
t.slideOut && (t.slideOut.transform = n ? "none" : `translateX(${k(e.slide - e.slideDirection * e.slideWidth)})`, t.slideOut.opacity = String(O(e.slideOut))), t.peek && (t.peek.width = k(H.width), t.peek.top = k(H.bodyTop), t.peek.transform = `translateX(${k(e.slide + (J?.side ?? 0) * H.width)})`);
|
|
148
|
+
let u = n ? "none" : `translate(${k(e.headX)}, ${k(e.headY)})`;
|
|
149
|
+
t.headerIn && (t.headerIn.transform = u), t.headerOut && (t.headerOut.transform = u);
|
|
150
|
+
for (let [r, i] of [
|
|
151
|
+
[t.headerIn, e.headerIn],
|
|
152
|
+
[t.headerOut, e.headerOut],
|
|
153
|
+
[t.badgeIn, e.badgeIn],
|
|
154
|
+
[t.badgeOut, e.badgeOut],
|
|
155
|
+
[t.pageIn, e.pageIn],
|
|
156
|
+
[t.pageOut, e.pageOut]
|
|
157
|
+
]) r && (r.opacity = String(O(i)), r.filter = re((1 - O(i)) * z.blur, n));
|
|
158
|
+
t.chrome && (t.chrome.opacity = String(O(e.chrome)), t.chrome.transform = n ? "none" : `translateY(${k((1 - O(e.chrome)) * z.chromeOffset)})`), t.chromeOut && (t.chromeOut.opacity = String(O(e.chromeOut))), t.body && (t.body.opacity = String(O(e.chrome) * O(e.bodyIn) * O(e.slideIn)), t.body.transform = n ? "none" : `translateX(${k(e.slide)}) translateY(${k((1 - O(e.chrome)) * z.chromeOffset + (1 - O(e.bodyIn)) * z.bodyOffset)})`), t.bodyOut && (t.bodyOut.opacity = String(O(e.bodyOut))), t.exit && (t.exit.opacity = String(O(e.exitOpacity)), t.exit.transform = n ? "translateX(-50%)" : `translateX(-50%) translate(${k(e.exitX)}, ${k(e.exitY)}) scale(${e.exitScale})`), Oe && K?.isConnected && K.setAttribute("stroke-dasharray", `${Math.round(e.progress * 1e4) / 100} 100`);
|
|
159
|
+
}
|
|
160
|
+
function We() {
|
|
161
|
+
let e = se.current, t = N.current, n = _(y.props.snapshot).presented;
|
|
162
|
+
if (!e || !t || !D || !R || !n) {
|
|
163
|
+
W = !1;
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
let r = e.getBoundingClientRect();
|
|
167
|
+
if (W = r.width > 0 && r.height > 0, Ke(n), !W) return;
|
|
168
|
+
let i = D.getComputedStyle(j.current);
|
|
169
|
+
U = {
|
|
170
|
+
tailOffset: A(i, "--cloudlet-tail-offset", 4),
|
|
171
|
+
tailScale: A(i, "--cloudlet-tail-scale", .9),
|
|
172
|
+
pillHeight: A(i, "--cloudlet-pill-height", 44)
|
|
173
|
+
};
|
|
174
|
+
let a = y.props.snapshot.island.open, o = parseFloat(D.getComputedStyle(t).borderTopLeftRadius), s = Math.min(Number.isFinite(o) ? o : a ? 24 : r.height / 2, r.height / 2, r.width / 2);
|
|
175
|
+
H = {
|
|
176
|
+
width: r.width,
|
|
177
|
+
height: r.height,
|
|
178
|
+
bodyTop: $()?.offsetTop ?? 0
|
|
179
|
+
}, R.setShape({
|
|
180
|
+
width: r.width,
|
|
181
|
+
height: r.height,
|
|
182
|
+
radius: s
|
|
183
|
+
}, we), we = "close", Ge();
|
|
184
|
+
}
|
|
185
|
+
function Ge() {
|
|
186
|
+
let e = $();
|
|
187
|
+
if (!e) return;
|
|
188
|
+
let t = $e()?.querySelector("[data-cloudlet-title]")?.id;
|
|
189
|
+
if (e.scrollHeight - e.clientHeight > 1 && t) e.tabIndex = 0, e.setAttribute("role", "group"), e.setAttribute("aria-labelledby", t);
|
|
190
|
+
else for (let t of [
|
|
191
|
+
"tabindex",
|
|
192
|
+
"role",
|
|
193
|
+
"aria-labelledby"
|
|
194
|
+
]) e.removeAttribute(t);
|
|
195
|
+
}
|
|
196
|
+
function Ke(e) {
|
|
197
|
+
let t = e && !W && x.getSnapshot().presentation?.readable ? e.handle : null;
|
|
198
|
+
t !== ke && (ke && x.setPause(S, {
|
|
199
|
+
scope: "notification",
|
|
200
|
+
handle: ke,
|
|
201
|
+
reason: "content-transition",
|
|
202
|
+
active: !1
|
|
203
|
+
}), ke = t, t && x.setPause(S, {
|
|
204
|
+
scope: "notification",
|
|
205
|
+
handle: t,
|
|
206
|
+
reason: "content-transition",
|
|
207
|
+
active: !0
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
function qe() {
|
|
211
|
+
let e = x.getSnapshot().presentation;
|
|
212
|
+
if (!e?.token || e.readable || Te.size) return;
|
|
213
|
+
let t = M.current?.querySelector(`[data-cloudlet-presented="${e.handle.generation}"]`), n = t?.getBoundingClientRect();
|
|
214
|
+
t && W && n?.width && n.height && D?.getComputedStyle(t).visibility !== "hidden" && x.acknowledgePresentation(S, e.handle, e.token);
|
|
215
|
+
}
|
|
216
|
+
let Je = (e) => (Te.add(e), () => {
|
|
217
|
+
Te.delete(e), qe();
|
|
218
|
+
}), Ye = () => {
|
|
219
|
+
Be(), We(), qe();
|
|
220
|
+
};
|
|
221
|
+
function Xe() {
|
|
222
|
+
let e = j.current;
|
|
223
|
+
return (y.props.snapshot.island.open ? e?.querySelector(".cloudlet-slide [data-cloudlet-title]") : null) ?? e?.querySelector("[data-cloudlet-pill]") ?? null;
|
|
224
|
+
}
|
|
225
|
+
function Ze() {
|
|
226
|
+
let e = y.props.snapshot.focusRequest;
|
|
227
|
+
if (!e || x.getSnapshot().focusRequest?.token !== e.token) return;
|
|
228
|
+
let t = j.current, n = e.target, r = null;
|
|
229
|
+
n.kind === "anchor" ? r = t : n.kind === "overflow" ? r = t?.querySelector("[data-cloudlet-overflow]") ?? t?.querySelector("[data-cloudlet-pill]") ?? null : n.kind === "notification" && (r = M.current?.querySelector(`[data-cloudlet-presented="${n.handle.generation}"]`) ? n.control ? M.current.querySelector(`[data-cloudlet-control="${n.control}"]`) : Xe() : null), Le(E.activeElement);
|
|
230
|
+
let i = Q(r);
|
|
231
|
+
x.acknowledgeFocus(S, e.token, i ? "focused" : "unavailable");
|
|
232
|
+
}
|
|
233
|
+
function Qe(e) {
|
|
234
|
+
e?.replaceChildren();
|
|
235
|
+
}
|
|
236
|
+
function $e() {
|
|
237
|
+
return M.current?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-header > .cloudlet-heading") ?? null;
|
|
238
|
+
}
|
|
239
|
+
function $() {
|
|
240
|
+
return M.current?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-body") ?? null;
|
|
241
|
+
}
|
|
242
|
+
function et(e) {
|
|
243
|
+
let t = M.current, n = N.current;
|
|
244
|
+
if (!t || !n || !W) return {};
|
|
245
|
+
let r = {};
|
|
246
|
+
(e.presence === "exit" || e.presence === "rise" || e.presence === "replace") && (r.exit = T(t), I.exitClip && (I.exitClip.clipPath = I.clip?.clipPath ?? ""), I.exitBg && (I.exitBg.borderRadius = I.bg?.borderRadius ?? ""), I.exitBadge && (I.exitBadge.opacity = I.badge?.opacity ?? "", I.exitBadge.transform = I.badge?.transform ?? ""), I.exit && (I.exit.width = k(H.width)));
|
|
247
|
+
let i = $();
|
|
248
|
+
if (e.slide && i && (r.slide = T(i), Se = i.offsetTop, I.slideOut && (I.slideOut.width = k(H.width))), e.morph === "close") {
|
|
249
|
+
let e = T(n);
|
|
250
|
+
e.querySelector(".cloudlet-header")?.classList.add("cloudlet-ghost"), r.chrome = e, I.chromeOut && (I.chromeOut.width = k(H.width));
|
|
251
|
+
}
|
|
252
|
+
let a = $e();
|
|
253
|
+
e.header && a && (r.header = T(a));
|
|
254
|
+
let o = $(), s = R?.now() ?? 0, c = e.body && s - Ce < (R?.constants.bodyQuiet ?? 0);
|
|
255
|
+
e.body && (Ce = s), e.body && !e.slide && o && !c && !R?.swapping("body") && (r.body = T(o), I.bodyOut && (I.bodyOut.top = k(o.offsetTop)));
|
|
256
|
+
let l = t.querySelector(":scope > .cloudlet-badge > .cloudlet-badge-value");
|
|
257
|
+
e.badge && l && (r.badge = T(l));
|
|
258
|
+
let u = n.querySelector(":scope > .cloudlet-indicator > .cloudlet-page > .cloudlet-page-value");
|
|
259
|
+
return e.page && u && (r.page = T(u)), r;
|
|
260
|
+
}
|
|
261
|
+
function tt(e, t) {
|
|
262
|
+
let n = M.current, r = e === "exit" ? P.current : e === "slide" ? ue.current : e === "chrome" ? de.current : e === "header" ? n?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-header > .cloudlet-heading-out") : e === "body" ? n?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-body-out") : e === "badge" ? n?.querySelector(":scope > .cloudlet-badge > .cloudlet-badge-out") : n?.querySelector(":scope > .cloudlet-clip > .cloudlet-indicator > .cloudlet-page > .cloudlet-page-out");
|
|
263
|
+
return r ? (r.setAttribute("inert", ""), r.replaceChildren(t), r) : null;
|
|
264
|
+
}
|
|
265
|
+
function nt(e, t, n) {
|
|
266
|
+
if (!R) return;
|
|
267
|
+
let r = n?.plan ?? g(e, t);
|
|
268
|
+
rt(t);
|
|
269
|
+
let i = {};
|
|
270
|
+
for (let [e, t] of Object.entries(n?.clones ?? {})) i[e] = tt(e, t);
|
|
271
|
+
let a = (e) => () => Qe(i[e]), o = () => {
|
|
272
|
+
G && (G = 0, y.forceUpdate());
|
|
273
|
+
}, s = () => Qe(P.current);
|
|
274
|
+
r.presence === "enter" ? we = "instant" : r.morph === "open" && (we = "open"), We();
|
|
275
|
+
let c = n?.heading, l = c && r.morph !== "none" ? $e()?.getBoundingClientRect() : null;
|
|
276
|
+
c && l && R.shiftHeading(c.left - l.left, c.top - l.top, r.morph === "open" ? "open" : "close");
|
|
277
|
+
let u = He(), d = X && e.presented?.handle === X.handle && !t.stack.includes(X.handle) ? X : void 0;
|
|
278
|
+
X && !t.stack.includes(X.handle) && (X = null), (r.presence === "exit" || r.presence === "rise" || r.presence === "replace") && (i.exit ? R.exit(u, s, d) : d && R.release("dragX", 0), r.presence === "exit" && R.hide()), (r.presence === "enter" || r.presence === "replace") && (R.enter(u, Je("presence")), r.presence === "enter" && (R.setTails(t.depth, "settle", 0, o), t.open ? R.open() : R.setBadge(t.badge))), r.presence === "rise" && (R.rise(-u * U.tailOffset, U.tailScale, Je("presence")), R.swap("header", Je("header"), !0)), (r.tails === "arrival" || r.tails === "rise" || r.tails === "settle") && (t.depth < e.depth && (G = Math.max(G, e.depth)), R.setTails(t.depth, r.tails, e.depth, o)), r.morph === "open" ? (G = Math.max(G, e.depth), R.open(o)) : r.morph === "close" && R.collapse(t.depth, t.badge, {
|
|
279
|
+
chrome: a("chrome"),
|
|
280
|
+
tails: o
|
|
281
|
+
});
|
|
282
|
+
let f = Ve() && n ? H.height - n.height : 0;
|
|
283
|
+
if (I.slideOut && (I.slideOut.top = k(f + Se)), I.chromeOut && i.chrome && (I.chromeOut.top = k(f)), r.slide) {
|
|
284
|
+
let e = Je("slide");
|
|
285
|
+
R.slide(Ae ? -r.slide : r.slide, H.width, () => {
|
|
286
|
+
Qe(i.slide), e();
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
if (i.header) {
|
|
290
|
+
let e = Je("header");
|
|
291
|
+
R.swap("header", () => {
|
|
292
|
+
Qe(i.header), e();
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
i.body && R.swap("body", a("body")), i.badge && R.swap("badge", a("badge")), i.page && R.swap("page", a("page")), !t.open && e.presented && t.presented && r.morph === "none" && R.setBadge(t.badge);
|
|
296
|
+
let p = x.getSnapshot().presentation;
|
|
297
|
+
r.begin && r.header && t.presented && p?.token && p.readable && p.handle === t.presented.handle && x.beginPresentation(S, t.presented.handle, p.token);
|
|
298
|
+
}
|
|
299
|
+
function rt(e) {
|
|
300
|
+
let t = e.presented, n = t?.content.progress, r = $e()?.querySelector(":scope > .cloudlet-icon > .cloudlet-ring > .cloudlet-progress-fill") ?? null, i = n?.kind === "determinate", a = r !== K || t?.handle !== De || !Oe;
|
|
301
|
+
K = r, De = t?.handle ?? null, Oe = i && !!r, R?.setProgress(i ? n.value : null, a);
|
|
302
|
+
}
|
|
303
|
+
function it(e) {
|
|
304
|
+
(J?.handle !== e?.handle || J?.side !== e?.side) && (J = e, y.forceUpdate());
|
|
305
|
+
}
|
|
306
|
+
function at(e) {
|
|
307
|
+
return {
|
|
308
|
+
move: (e) => R?.drag("dragX", e),
|
|
309
|
+
end: (t, n) => {
|
|
310
|
+
let r = f(t, n, H.width, {
|
|
311
|
+
negative: !0,
|
|
312
|
+
positive: !0
|
|
313
|
+
});
|
|
314
|
+
if (r) {
|
|
315
|
+
if (X = {
|
|
316
|
+
handle: e,
|
|
317
|
+
direction: r,
|
|
318
|
+
distance: H.width,
|
|
319
|
+
velocity: n * 1e3
|
|
320
|
+
}, x.dismiss(S, e, "swipe").status === "applied") return;
|
|
321
|
+
X = null;
|
|
322
|
+
}
|
|
323
|
+
R?.release("dragX", n * 1e3);
|
|
324
|
+
},
|
|
325
|
+
cancel: () => R?.release("dragX", 0)
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function ot(e, t) {
|
|
329
|
+
let n = y.props.snapshot.stack, r = n.indexOf(e);
|
|
330
|
+
return r < 0 ? null : n[r + t * (Ae ? -1 : 1)] ?? null;
|
|
331
|
+
}
|
|
332
|
+
function st(e) {
|
|
333
|
+
let t = (t) => {
|
|
334
|
+
let n = t < 0 ? 1 : -1, r = t ? ot(e, n) : null;
|
|
335
|
+
return it(r ? {
|
|
336
|
+
handle: r,
|
|
337
|
+
side: n
|
|
338
|
+
} : null), r ? Math.max(-H.width, Math.min(H.width, t)) : p(t, H.width);
|
|
339
|
+
}, n = (e) => R?.release("slide", e, () => it(null));
|
|
340
|
+
return {
|
|
341
|
+
move: (e) => R?.drag("slide", t(e)),
|
|
342
|
+
end: (t, r) => {
|
|
343
|
+
let i = f(t, r, H.width, {
|
|
344
|
+
negative: !!ot(e, 1),
|
|
345
|
+
positive: !!ot(e, -1)
|
|
346
|
+
}), a = i ? ot(e, i < 0 ? 1 : -1) : null;
|
|
347
|
+
if (a) {
|
|
348
|
+
let e = J;
|
|
349
|
+
if (J = null, R?.fling("slide", r * 1e3), x.navigate(S, a).status === "applied") return;
|
|
350
|
+
J = e;
|
|
351
|
+
}
|
|
352
|
+
n(J ? r * 1e3 : 0);
|
|
353
|
+
},
|
|
354
|
+
cancel: () => n(0)
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function ct() {
|
|
358
|
+
let e = Ve() ? 1 : -1, t = (t) => p(t, t * e > 0 ? H.height : c.swipe.minDistance);
|
|
359
|
+
return {
|
|
360
|
+
move: (e) => R?.drag("dragY", t(e)),
|
|
361
|
+
end: (t, n) => {
|
|
362
|
+
R?.release("dragY", 0);
|
|
363
|
+
let r = Math.min(H.height, c.swipe.edge / c.swipe.distance);
|
|
364
|
+
f(t, n, r, {
|
|
365
|
+
negative: e < 0,
|
|
366
|
+
positive: e > 0
|
|
367
|
+
}) && x.collapseIsland(S);
|
|
368
|
+
},
|
|
369
|
+
cancel: () => R?.release("dragY", 0)
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function lt(e, t) {
|
|
373
|
+
let n = M.current, r = N.current, { presented: i, open: a } = _(y.props.snapshot);
|
|
374
|
+
if (B || !R || !W || !n || !r || !i || !n.contains(e)) return null;
|
|
375
|
+
let o, s = !1;
|
|
376
|
+
if (a ? (o = r.contains(e), s = o && t === "pointer" && !!e.closest(".cloudlet-clip > .cloudlet-slide > .cloudlet-header")) : o = t === "pointer" && !!e.closest("[data-cloudlet-pill]"), !o && !s) return null;
|
|
377
|
+
let { handle: c } = i;
|
|
378
|
+
if (x.setPause(S, {
|
|
379
|
+
scope: "notification",
|
|
380
|
+
handle: c,
|
|
381
|
+
reason: "gesture",
|
|
382
|
+
active: !0
|
|
383
|
+
}).status === "rejected") return null;
|
|
384
|
+
Y = {
|
|
385
|
+
handle: c,
|
|
386
|
+
open: a
|
|
387
|
+
};
|
|
388
|
+
let l = !1;
|
|
389
|
+
return {
|
|
390
|
+
x: o,
|
|
391
|
+
y: s,
|
|
392
|
+
start: (e) => a ? e === "x" ? st(c) : ct() : at(c),
|
|
393
|
+
release() {
|
|
394
|
+
l || (l = !0, Y = null, x.setPause(S, {
|
|
395
|
+
scope: "notification",
|
|
396
|
+
handle: c,
|
|
397
|
+
reason: "gesture",
|
|
398
|
+
active: !1
|
|
399
|
+
}));
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function ut() {
|
|
404
|
+
let e = j.current, t = M.current;
|
|
405
|
+
if (!e || !D || !t) return;
|
|
406
|
+
_e = !0;
|
|
407
|
+
let n = oe.current?.sheet, r = `[data-cloudlet-instance="${y.props.snapshot.controller}"]`;
|
|
408
|
+
if (n) for (let [e, t] of Object.entries(te)) {
|
|
409
|
+
let i = n.insertRule(`${r}${t} {}`, n.cssRules.length);
|
|
410
|
+
I[e] = n.cssRules[i].style;
|
|
411
|
+
}
|
|
412
|
+
for (let e of [
|
|
413
|
+
P.current,
|
|
414
|
+
ue.current,
|
|
415
|
+
de.current
|
|
416
|
+
]) e?.setAttribute("inert", "");
|
|
417
|
+
F.mount(e), q = d(e, {
|
|
418
|
+
begin: lt,
|
|
419
|
+
now: () => D.performance.now()
|
|
420
|
+
});
|
|
421
|
+
let i = D.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
422
|
+
B = i?.matches ?? !1, e.dataset.reducedMotion = String(B), R = l({
|
|
423
|
+
now: () => D.performance.now(),
|
|
424
|
+
requestFrame: (e) => D.requestAnimationFrame(e),
|
|
425
|
+
cancelFrame: (e) => D.cancelAnimationFrame(e),
|
|
426
|
+
write: Ue,
|
|
427
|
+
reducedMotion: B,
|
|
428
|
+
timeScale: y.props.options.motion?.timeScale,
|
|
429
|
+
constants: z
|
|
430
|
+
});
|
|
431
|
+
let a = () => {
|
|
432
|
+
B = i?.matches ?? !1, e.dataset.reducedMotion = String(B), B && q?.cancel(), R?.setReducedMotion(B);
|
|
433
|
+
}, o = D.matchMedia?.("(min-width: 48rem)"), s = D.matchMedia?.("(prefers-color-scheme: dark)"), c = () => {
|
|
434
|
+
(y.props.options.theme ?? "system") === "system" && y.forceUpdate();
|
|
435
|
+
}, u = () => {
|
|
436
|
+
(y.props.options.position ?? "auto") === "auto" && (q?.cancel(), y.forceUpdate());
|
|
437
|
+
}, f = () => Z("document-hidden", E.visibilityState === "hidden"), p = [
|
|
438
|
+
[
|
|
439
|
+
E,
|
|
440
|
+
"visibilitychange",
|
|
441
|
+
f
|
|
442
|
+
],
|
|
443
|
+
[
|
|
444
|
+
E,
|
|
445
|
+
"pointerdown",
|
|
446
|
+
(t) => {
|
|
447
|
+
x.getSnapshot().island.open && t.target instanceof D.Node && !e.contains(t.target) && x.collapseIsland(S);
|
|
448
|
+
},
|
|
449
|
+
!0
|
|
450
|
+
],
|
|
451
|
+
[
|
|
452
|
+
E,
|
|
453
|
+
"pointerover",
|
|
454
|
+
(t) => {
|
|
455
|
+
xe && !(t.target instanceof D.Node && e.contains(t.target)) && Fe(!1);
|
|
456
|
+
},
|
|
457
|
+
!0
|
|
458
|
+
],
|
|
459
|
+
[
|
|
460
|
+
D,
|
|
461
|
+
"focus",
|
|
462
|
+
() => Z("window-blur", !1)
|
|
463
|
+
],
|
|
464
|
+
[
|
|
465
|
+
D,
|
|
466
|
+
"blur",
|
|
467
|
+
() => Z("window-blur", !0)
|
|
468
|
+
],
|
|
469
|
+
[
|
|
470
|
+
D,
|
|
471
|
+
"resize",
|
|
472
|
+
Ye
|
|
473
|
+
]
|
|
474
|
+
];
|
|
475
|
+
i && p.push([
|
|
476
|
+
i,
|
|
477
|
+
"change",
|
|
478
|
+
a
|
|
479
|
+
]), o && p.push([
|
|
480
|
+
o,
|
|
481
|
+
"change",
|
|
482
|
+
u
|
|
483
|
+
]), s && p.push([
|
|
484
|
+
s,
|
|
485
|
+
"change",
|
|
486
|
+
c
|
|
487
|
+
]), D.visualViewport && p.push([
|
|
488
|
+
D.visualViewport,
|
|
489
|
+
"resize",
|
|
490
|
+
Ye
|
|
491
|
+
], [
|
|
492
|
+
D.visualViewport,
|
|
493
|
+
"scroll",
|
|
494
|
+
Be
|
|
495
|
+
]);
|
|
496
|
+
for (let [e, t, n, r] of p) e.addEventListener(t, n, r);
|
|
497
|
+
ge = () => {
|
|
498
|
+
for (let [e, t, n, r] of p) e.removeEventListener(t, n, r);
|
|
499
|
+
}, V = D.ResizeObserver ? new D.ResizeObserver(() => {
|
|
500
|
+
We(), qe();
|
|
501
|
+
}) : null, N.current && V?.observe(N.current), V?.observe(e), f(), Z("window-blur", !E.hasFocus()), ze(E.activeElement), Be(), Pe(), nt(h, _(y.props.snapshot), null), qe(), Ze();
|
|
502
|
+
}
|
|
503
|
+
function dt(e) {
|
|
504
|
+
let t = _(e.snapshot), n = _(y.props.snapshot), r = g(t, n), i = {
|
|
505
|
+
plan: r,
|
|
506
|
+
clones: et(r),
|
|
507
|
+
heading: r.morph !== "none" && W ? $e()?.getBoundingClientRect() ?? null : null,
|
|
508
|
+
height: H.height
|
|
509
|
+
}, a = pe;
|
|
510
|
+
if (pe = null, me = null, a && e.snapshot.notifications.some((e) => e.handle === a) && !y.props.snapshot.notifications.some((e) => e.handle === a)) return i;
|
|
511
|
+
let o = j.current, s = E.activeElement;
|
|
512
|
+
if (!o || !D || !(s instanceof D.HTMLElement) || s === o || !o.contains(s) || ie(e.snapshot) === ie(y.props.snapshot)) return i;
|
|
513
|
+
me = s;
|
|
514
|
+
let c = y.props.snapshot;
|
|
515
|
+
return he = !c.notifications.length && !c.overflow.pending, (!he || !Re()) && o.focus({ preventScroll: !0 }), i;
|
|
516
|
+
}
|
|
517
|
+
function ft(e, t, n) {
|
|
518
|
+
let r = me;
|
|
519
|
+
me = null, he ? (he = !1, Re()) : r && !Q(r) && (Q(Xe() ?? j.current?.querySelector("[data-cloudlet-overflow]") ?? null) || j.current?.focus({ preventScroll: !0 })), R?.setTimeScale(y.props.options.motion?.timeScale), be();
|
|
520
|
+
let i = _(y.props.snapshot);
|
|
521
|
+
Y && (Y.handle !== i.presented?.handle || Y.open !== i.open) && q?.cancel(), J && (!i.open || !i.stack.includes(J.handle)) && (q?.cancel(), it(null)), e.snapshot === y.props.snapshot ? We() : nt(_(e.snapshot), i, n), Pe(), qe(), Ze(), ze(E.activeElement);
|
|
522
|
+
}
|
|
523
|
+
function pt() {
|
|
524
|
+
q?.dispose(), q = null, J = null, X = null, F.dispose(), _e = !1, ge?.(), ge = null, V?.disconnect(), V = null, R?.dispose(), R = null, Te.clear();
|
|
525
|
+
let e = oe.current?.sheet;
|
|
526
|
+
if (e) for (; e.cssRules.length;) e.deleteRule(0);
|
|
527
|
+
I = {};
|
|
528
|
+
for (let e of [
|
|
529
|
+
P.current,
|
|
530
|
+
ue.current,
|
|
531
|
+
de.current
|
|
532
|
+
]) Qe(e);
|
|
533
|
+
K = null;
|
|
534
|
+
let t = E.activeElement;
|
|
535
|
+
j.current?.contains(t) && !Re() && t?.blur();
|
|
536
|
+
}
|
|
537
|
+
let mt = (e) => {
|
|
538
|
+
pe = e, x.dismiss(S, e, "navigation").status !== "applied" && (pe = null);
|
|
539
|
+
};
|
|
540
|
+
function ht(e, t, n, r) {
|
|
541
|
+
if (e.defaultPrevented) return;
|
|
542
|
+
let i = null;
|
|
543
|
+
if (e.key === "Escape") {
|
|
544
|
+
e.preventDefault(), x.collapseIsland(S);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if ((e.key === "Home" || e.key === "End") && e.target === $() && $()?.tabIndex === 0) return;
|
|
548
|
+
e.key === "Home" ? i = 0 : e.key === "End" ? i = t.length - 1 : e.key === "ArrowRight" ? i = n + (r ? -1 : 1) : e.key === "ArrowLeft" && (i = n + (r ? 1 : -1));
|
|
549
|
+
let a = i === null ? void 0 : t[i];
|
|
550
|
+
a && (e.preventDefault(), x.navigate(S, a));
|
|
551
|
+
}
|
|
552
|
+
function gt() {
|
|
553
|
+
let { snapshot: s, options: c } = y.props, l = {
|
|
554
|
+
...i,
|
|
555
|
+
...c.labels
|
|
556
|
+
}, u = s.controller ?? "cloudlet", d = c.dir ?? (E.documentElement.dir === "rtl" ? "rtl" : "ltr"), f = c.theme ?? "system";
|
|
557
|
+
Ae = d === "rtl";
|
|
558
|
+
let p = `${u}-island`, m = _(s), { presented: h, open: g, total: v, index: b, missed: T } = m;
|
|
559
|
+
m.badge && (Ee = m.count);
|
|
560
|
+
let te = g && J ? s.notifications.find((e) => e.handle === J.handle) : void 0, O = c.position ?? "auto", k = O === "bottom-center" || O === "auto" && D?.matchMedia?.("(min-width: 48rem)").matches === !1, re = Math.min(2, Math.max(m.depth, G)), A = h ? o(x, S, h.handle, Ie) : null, ie = Ne(l.page, i.page, b + 1, v), F = a(c.classNames);
|
|
561
|
+
return /* @__PURE__ */ w(ee, { children: [c.offsets && /* @__PURE__ */ C(ae, {
|
|
562
|
+
instance: u,
|
|
563
|
+
offsets: c.offsets,
|
|
564
|
+
nonce: c.nonce
|
|
565
|
+
}, c.nonce ?? ""), /* @__PURE__ */ w("div", {
|
|
566
|
+
ref: j,
|
|
567
|
+
className: F("host", "cloudlet-host"),
|
|
568
|
+
role: "region",
|
|
569
|
+
"aria-label": l.region,
|
|
570
|
+
tabIndex: -1,
|
|
571
|
+
"data-cloudlet-focus-anchor": "",
|
|
572
|
+
"data-cloudlet-instance": u,
|
|
573
|
+
"data-theme": f,
|
|
574
|
+
"data-resolved-theme": f === "system" ? D?.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light" : f,
|
|
575
|
+
"data-position": O,
|
|
576
|
+
"data-edge": k ? "bottom" : "top",
|
|
577
|
+
"data-state": g ? "island" : "stack",
|
|
578
|
+
"data-island-reason": s.island.reason ?? void 0,
|
|
579
|
+
"data-overflow": s.overflow.pending,
|
|
580
|
+
dir: d,
|
|
581
|
+
onPointerDownCapture: (e) => {
|
|
582
|
+
L = e.target.closest("button");
|
|
583
|
+
},
|
|
584
|
+
onPointerCancelCapture: () => {
|
|
585
|
+
L = null;
|
|
586
|
+
},
|
|
587
|
+
onKeyDownCapture: (e) => {
|
|
588
|
+
(e.key === "Enter" || e.key === " ") && e.target.closest("button") && (ve = e.repeat, e.repeat ? e.preventDefault() : L = e.target.closest("button"));
|
|
589
|
+
},
|
|
590
|
+
onKeyUpCapture: () => {
|
|
591
|
+
ve = !1;
|
|
592
|
+
},
|
|
593
|
+
onClickCapture: (e) => {
|
|
594
|
+
let t = e.target.closest("button"), n = !!t?.matches("[data-cloudlet-control=\"action\"], [data-cloudlet-control=\"retry\"], [data-cloudlet-control=\"cancel\"]");
|
|
595
|
+
t && (ve || n && e.detail > 1 || L && L !== t) && (e.preventDefault(), e.stopPropagation()), L = null;
|
|
596
|
+
},
|
|
597
|
+
onFocus: (e) => {
|
|
598
|
+
Le(e.relatedTarget), ze(E.activeElement);
|
|
599
|
+
},
|
|
600
|
+
onBlur: (e) => ze(D && e.relatedTarget instanceof D.Element ? e.relatedTarget : null),
|
|
601
|
+
onMouseEnter: () => Fe(!0),
|
|
602
|
+
onMouseLeave: () => Fe(!1),
|
|
603
|
+
children: [/* @__PURE__ */ C("style", {
|
|
604
|
+
ref: oe,
|
|
605
|
+
nonce: c.nonce,
|
|
606
|
+
"data-cloudlet-motion": ""
|
|
607
|
+
}), /* @__PURE__ */ w("div", {
|
|
608
|
+
ref: se,
|
|
609
|
+
className: F("stack", "cloudlet-stack"),
|
|
610
|
+
"data-empty": !h,
|
|
611
|
+
children: [
|
|
612
|
+
[1, 2].filter((e) => e <= re).map((e) => /* @__PURE__ */ C("div", {
|
|
613
|
+
className: F("tail", "cloudlet-tail"),
|
|
614
|
+
"data-cloudlet-tail": e,
|
|
615
|
+
"aria-hidden": "true"
|
|
616
|
+
}, e)),
|
|
617
|
+
/* @__PURE__ */ w("div", {
|
|
618
|
+
ref: M,
|
|
619
|
+
id: p,
|
|
620
|
+
className: F("island", "cloudlet-shell"),
|
|
621
|
+
hidden: !h,
|
|
622
|
+
"data-state": g ? "island" : "stack",
|
|
623
|
+
"data-kind": h?.kind,
|
|
624
|
+
...g ? {
|
|
625
|
+
role: "region",
|
|
626
|
+
"aria-roledescription": l.carousel,
|
|
627
|
+
"aria-label": l.island,
|
|
628
|
+
"aria-describedby": `${p}-hint`
|
|
629
|
+
} : {},
|
|
630
|
+
onKeyDown: g ? (e) => ht(e, s.stack, b, d === "rtl") : void 0,
|
|
631
|
+
children: [
|
|
632
|
+
/* @__PURE__ */ C("svg", {
|
|
633
|
+
ref: ce,
|
|
634
|
+
className: "cloudlet-bg",
|
|
635
|
+
"aria-hidden": "true",
|
|
636
|
+
focusable: "false",
|
|
637
|
+
children: /* @__PURE__ */ C("path", { ref: le })
|
|
638
|
+
}),
|
|
639
|
+
/* @__PURE__ */ w("div", {
|
|
640
|
+
ref: N,
|
|
641
|
+
className: "cloudlet-clip",
|
|
642
|
+
children: [
|
|
643
|
+
/* @__PURE__ */ C("div", {
|
|
644
|
+
ref: ue,
|
|
645
|
+
className: "cloudlet-slide-out",
|
|
646
|
+
"aria-hidden": "true"
|
|
647
|
+
}),
|
|
648
|
+
h && A && /* @__PURE__ */ w("div", {
|
|
649
|
+
className: "cloudlet-slide",
|
|
650
|
+
"data-cloudlet-presented": h.handle.generation,
|
|
651
|
+
"data-kind": h.kind,
|
|
652
|
+
"data-current": "true",
|
|
653
|
+
...g ? {
|
|
654
|
+
role: "group",
|
|
655
|
+
"aria-roledescription": l.slide,
|
|
656
|
+
"aria-label": ie
|
|
657
|
+
} : {},
|
|
658
|
+
children: [
|
|
659
|
+
/* @__PURE__ */ w("div", {
|
|
660
|
+
className: F("header", "cloudlet-header"),
|
|
661
|
+
"aria-hidden": g ? void 0 : "true",
|
|
662
|
+
children: [/* @__PURE__ */ C(t, {
|
|
663
|
+
notification: h,
|
|
664
|
+
slot: A,
|
|
665
|
+
part: F,
|
|
666
|
+
titleId: `${p}-title`
|
|
667
|
+
}), /* @__PURE__ */ C("div", {
|
|
668
|
+
className: "cloudlet-heading-out",
|
|
669
|
+
"aria-hidden": "true"
|
|
670
|
+
})]
|
|
671
|
+
}),
|
|
672
|
+
g && /* @__PURE__ */ C(e, {
|
|
673
|
+
notification: h,
|
|
674
|
+
bridge: x,
|
|
675
|
+
lease: S,
|
|
676
|
+
labels: l,
|
|
677
|
+
navigate: mt,
|
|
678
|
+
slot: A,
|
|
679
|
+
part: F
|
|
680
|
+
}),
|
|
681
|
+
/* @__PURE__ */ C("div", {
|
|
682
|
+
className: "cloudlet-body-out",
|
|
683
|
+
"aria-hidden": "true"
|
|
684
|
+
})
|
|
685
|
+
]
|
|
686
|
+
}),
|
|
687
|
+
te && /* @__PURE__ */ C("div", {
|
|
688
|
+
ref: ne,
|
|
689
|
+
className: "cloudlet-peek",
|
|
690
|
+
"aria-hidden": "true",
|
|
691
|
+
children: /* @__PURE__ */ C(n, {
|
|
692
|
+
notification: te,
|
|
693
|
+
labels: l,
|
|
694
|
+
part: F
|
|
695
|
+
})
|
|
696
|
+
}),
|
|
697
|
+
h && g && r(l, F, () => x.dismiss(S, h.handle, "close-button")),
|
|
698
|
+
g && (v > 1 || T > 0) && /* @__PURE__ */ w("div", {
|
|
699
|
+
className: F("indicator", "cloudlet-indicator"),
|
|
700
|
+
children: [v > 5 ? /* @__PURE__ */ w("p", {
|
|
701
|
+
className: "cloudlet-page",
|
|
702
|
+
"aria-hidden": "true",
|
|
703
|
+
children: [/* @__PURE__ */ C("span", {
|
|
704
|
+
className: "cloudlet-page-value",
|
|
705
|
+
children: ie
|
|
706
|
+
}), /* @__PURE__ */ C("span", { className: "cloudlet-page-out" })]
|
|
707
|
+
}) : v > 1 && s.stack.map((e, t) => /* @__PURE__ */ C("button", {
|
|
708
|
+
type: "button",
|
|
709
|
+
className: "cloudlet-dot-button",
|
|
710
|
+
"aria-current": t === b ? "true" : void 0,
|
|
711
|
+
"aria-label": Ne(l.page, i.page, t + 1, v),
|
|
712
|
+
onClick: () => x.navigate(S, e),
|
|
713
|
+
children: /* @__PURE__ */ C("span", {
|
|
714
|
+
className: "cloudlet-dot",
|
|
715
|
+
"aria-hidden": "true"
|
|
716
|
+
})
|
|
717
|
+
}, e.generation)), T > 0 && /* @__PURE__ */ w("div", {
|
|
718
|
+
className: F("overflow", "cloudlet-overflow"),
|
|
719
|
+
children: [/* @__PURE__ */ C("p", { children: Ne(l.overflowCount, i.overflowCount, T) }), /* @__PURE__ */ C("button", {
|
|
720
|
+
type: "button",
|
|
721
|
+
"data-cloudlet-overflow": "",
|
|
722
|
+
onClick: () => x.acknowledgeOverflow(S),
|
|
723
|
+
children: l.acknowledgeOverflow
|
|
724
|
+
})]
|
|
725
|
+
})]
|
|
726
|
+
}),
|
|
727
|
+
g && /* @__PURE__ */ C("span", {
|
|
728
|
+
id: `${p}-hint`,
|
|
729
|
+
className: "cloudlet-live",
|
|
730
|
+
children: l.collapse
|
|
731
|
+
}),
|
|
732
|
+
/* @__PURE__ */ C("div", {
|
|
733
|
+
ref: de,
|
|
734
|
+
className: "cloudlet-chrome-out",
|
|
735
|
+
"aria-hidden": "true"
|
|
736
|
+
})
|
|
737
|
+
]
|
|
738
|
+
}),
|
|
739
|
+
h && !g && /* @__PURE__ */ C("button", {
|
|
740
|
+
type: "button",
|
|
741
|
+
className: F("pill", "cloudlet-pill"),
|
|
742
|
+
"data-cloudlet-pill": "",
|
|
743
|
+
"aria-expanded": "false",
|
|
744
|
+
"aria-controls": p,
|
|
745
|
+
onClick: () => x.openIsland(S, "user"),
|
|
746
|
+
"aria-label": Ne(l.stackSummary, i.stackSummary, h.content.title, v, T)
|
|
747
|
+
}),
|
|
748
|
+
/* @__PURE__ */ w("span", {
|
|
749
|
+
className: F("badge", "cloudlet-badge"),
|
|
750
|
+
"aria-hidden": "true",
|
|
751
|
+
children: [/* @__PURE__ */ C("span", {
|
|
752
|
+
className: "cloudlet-badge-value",
|
|
753
|
+
children: Ee
|
|
754
|
+
}), /* @__PURE__ */ C("span", { className: "cloudlet-badge-out" })]
|
|
755
|
+
})
|
|
756
|
+
]
|
|
757
|
+
}),
|
|
758
|
+
/* @__PURE__ */ C("div", {
|
|
759
|
+
ref: P,
|
|
760
|
+
className: "cloudlet-exit",
|
|
761
|
+
"aria-hidden": "true"
|
|
762
|
+
})
|
|
763
|
+
]
|
|
764
|
+
})]
|
|
765
|
+
})] });
|
|
766
|
+
}
|
|
767
|
+
return {
|
|
768
|
+
componentDidMount: ut,
|
|
769
|
+
getSnapshotBeforeUpdate: dt,
|
|
770
|
+
componentDidUpdate: ft,
|
|
771
|
+
componentWillUnmount: pt,
|
|
772
|
+
render: gt
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
function ie(e) {
|
|
776
|
+
let t = e.notifications.find((e) => e.location === "current");
|
|
777
|
+
return [
|
|
778
|
+
e.island.open,
|
|
779
|
+
e.overflow.pending,
|
|
780
|
+
e.stack.map((e) => e.generation).join(","),
|
|
781
|
+
t?.handle.generation,
|
|
782
|
+
t?.content.action?.kind,
|
|
783
|
+
t?.action.status,
|
|
784
|
+
t?.operation?.status,
|
|
785
|
+
t?.operation?.canRetry,
|
|
786
|
+
t?.operation?.canCancel
|
|
787
|
+
].join("|");
|
|
788
|
+
}
|
|
789
|
+
function ae({ instance: e, offsets: t, nonce: n }) {
|
|
790
|
+
let r = S(null);
|
|
791
|
+
return x(() => {
|
|
792
|
+
let n = r.current?.sheet;
|
|
793
|
+
if (!n) return;
|
|
794
|
+
let i = n.insertRule(`[data-cloudlet-instance="${e}"] {}`), a = n.cssRules[i];
|
|
795
|
+
for (let e of ["gutter", "obstruction"]) for (let n of [
|
|
796
|
+
"top",
|
|
797
|
+
"right",
|
|
798
|
+
"bottom",
|
|
799
|
+
"left"
|
|
800
|
+
]) {
|
|
801
|
+
let r = t[e]?.[n];
|
|
802
|
+
typeof r == "number" && Number.isFinite(r) && r >= 0 && a.style.setProperty(`--cloudlet-${e}-${n}`, `${r}px`);
|
|
803
|
+
}
|
|
804
|
+
return () => {
|
|
805
|
+
n.deleteRule(i);
|
|
806
|
+
};
|
|
807
|
+
}, [e, t]), /* @__PURE__ */ C("style", {
|
|
808
|
+
ref: r,
|
|
809
|
+
nonce: n,
|
|
810
|
+
"data-cloudlet-offsets": e
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
//#endregion
|
|
814
|
+
export { D as Host };
|
|
815
|
+
|
|
816
|
+
//# sourceMappingURL=host.js.map
|