@cloudlet/toast 0.0.0-stage → 1.0.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 +271 -0
- package/LICENSE +21 -0
- package/README.md +65 -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/bridge.d.ts +5 -0
- package/dist/core/bridge.d.ts.map +1 -0
- package/dist/core/bridge.js +277 -0
- package/dist/core/bridge.js.map +1 -0
- package/dist/core/controller.d.ts +117 -0
- package/dist/core/controller.d.ts.map +1 -0
- package/dist/core/controller.js +787 -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 +140 -0
- package/dist/react/announcer.js.map +1 -0
- package/dist/react/bindings.d.ts +17 -0
- package/dist/react/bindings.d.ts.map +1 -0
- package/dist/react/bindings.js +47 -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/renderer.d.ts +7 -0
- package/dist/react/renderer.d.ts.map +1 -0
- package/dist/react/renderer.js +62 -0
- package/dist/react/renderer.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 +19 -4
- package/src/contracts/controller.ts +61 -0
- package/src/contracts/events.ts +48 -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/bridge.ts +280 -0
- package/src/core/controller.ts +853 -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 +198 -0
- package/src/react/bindings.tsx +56 -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 +953 -0
- package/src/react/motion.ts +484 -0
- package/src/react/plan.ts +101 -0
- package/src/react/renderer.tsx +77 -0
- package/src/react/shape.ts +33 -0
- package/src/react/viewport.ts +10 -0
- package/src/react.ts +190 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { HostLease, RendererBridge } from '../contracts/internal.js';
|
|
3
|
+
import type { AnnouncementFormatters } from '../react.js';
|
|
4
|
+
/** One attachment, two existing live hosts, one fixed batch window. No event history. */
|
|
5
|
+
export declare function createAnnouncer(bridge: RendererBridge<ReactNode>, lease: HostLease, doc: Document, options: () => Partial<AnnouncementFormatters> | undefined): {
|
|
6
|
+
/**
|
|
7
|
+
* The announcer owns its live regions: created here, next to the host (React owns the host's
|
|
8
|
+
* children), and inserted twice. VoiceOver in Safari ignored assertive changes made while focus
|
|
9
|
+
* was in the open Island in regions inserted only once (0 of 6 runs), and spoke them after one
|
|
10
|
+
* re-insertion on the next frame (6 of 6, rc.2 gate); a zero timeout was not enough (3 of 5).
|
|
11
|
+
*/
|
|
12
|
+
mount(host: HTMLElement): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=announcer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announcer.d.ts","sourceRoot":"","sources":["../../src/react/announcer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAA+B,SAAS,EAA8B,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGnI,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAkB1D,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAChG,OAAO,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,GAAG,SAAS;IAgIxD;;;;;OAKG;IACH,KAAK,OAAO,WAAW;IA8BvB,OAAO;EASV"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
//#region src/react/announcer.ts
|
|
2
|
+
var e = ({ content: e }) => [e.title, e.description?.kind === "rich" ? e.description.announcement : e.description?.text].filter(Boolean).join(". "), t = {
|
|
3
|
+
notification: e,
|
|
4
|
+
queued: (e) => `${e} notifications queued`,
|
|
5
|
+
occurrences: (e) => `${e.content.title}. ${e.occurrences} occurrences`,
|
|
6
|
+
overflow: (e) => `${e} missed notifications`,
|
|
7
|
+
operation: e,
|
|
8
|
+
actionError: (e, t) => `${e.content.title}. ${t}`,
|
|
9
|
+
actionPending: (e) => `${e.content.title}. ${e.content.action?.label}. In progress`,
|
|
10
|
+
resumed: (e) => `${e} current notifications`
|
|
11
|
+
};
|
|
12
|
+
function n(e, n, r, i) {
|
|
13
|
+
let a = null, o = null, s, c, l = !1, u = !1, d = null, f = null, p = !1, m, h = r.defaultView, g = () => {
|
|
14
|
+
h?.clearTimeout(s), s = void 0;
|
|
15
|
+
}, _ = () => {
|
|
16
|
+
if (!l) return;
|
|
17
|
+
let t = e.getSnapshot();
|
|
18
|
+
!t.notifications.length && !t.overflow.pending ? (g(), u = !1) : s === void 0 && r.visibilityState !== "hidden" && (s = h?.setTimeout(y, 300));
|
|
19
|
+
};
|
|
20
|
+
function v(r, ...a) {
|
|
21
|
+
try {
|
|
22
|
+
let e = (i()?.[r] ?? t[r])(...a);
|
|
23
|
+
if (typeof e != "string" || !e.trim()) throw TypeError("Announcement must be a nonempty string");
|
|
24
|
+
return e;
|
|
25
|
+
} catch (i) {
|
|
26
|
+
return e.reportDiagnostic(n, {
|
|
27
|
+
code: "formatter-error",
|
|
28
|
+
source: `Toaster.announcements.${r}`,
|
|
29
|
+
message: "Announcement formatter failed",
|
|
30
|
+
error: i
|
|
31
|
+
}), t[r](...a);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function y() {
|
|
35
|
+
if (s = void 0, !l || r.visibilityState === "hidden" || !a || !o) return;
|
|
36
|
+
let t = e.getSnapshot();
|
|
37
|
+
if (t.presentation && !t.presentation.readable && !u) {
|
|
38
|
+
p = !0;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
p = !1;
|
|
42
|
+
let i = [], c = {
|
|
43
|
+
polite: [],
|
|
44
|
+
assertive: []
|
|
45
|
+
}, d = {
|
|
46
|
+
polite: 0,
|
|
47
|
+
assertive: 0
|
|
48
|
+
};
|
|
49
|
+
for (let e of t.notifications) {
|
|
50
|
+
let n = t.announcements.notifications.find((t) => t.handle === e.handle), r = e.handle, a = e.content.announcementPriority ?? "polite", o = t.presentation?.handle === r && t.presentation.readable, s = (e) => {
|
|
51
|
+
a !== "off" && !u && c[a].push(e());
|
|
52
|
+
};
|
|
53
|
+
if (e.location === "stack") {
|
|
54
|
+
if (n.queued || (i.push({
|
|
55
|
+
kind: "queued",
|
|
56
|
+
handle: r
|
|
57
|
+
}), a !== "off" && !n.firstPresentation && !u && d[a]++), !u) continue;
|
|
58
|
+
} else if (!o && !u) continue;
|
|
59
|
+
let l = e.location === "current" && o && !n.firstPresentation;
|
|
60
|
+
l && i.push({
|
|
61
|
+
kind: "first-presentation",
|
|
62
|
+
handle: r
|
|
63
|
+
});
|
|
64
|
+
let p = e.operation, m = !1;
|
|
65
|
+
if (p) {
|
|
66
|
+
let t = p.status === "pending" ? p.cancelRequested ? "cancel-requested" : "started" : p.status, a = n.operation?.token === p.token ? n.operation.phases : [];
|
|
67
|
+
for (let e of /* @__PURE__ */ new Set([
|
|
68
|
+
"started",
|
|
69
|
+
...p.cancelRequested ? ["cancel-requested"] : [],
|
|
70
|
+
t
|
|
71
|
+
])) a.includes(e) || i.push({
|
|
72
|
+
kind: "operation",
|
|
73
|
+
handle: r,
|
|
74
|
+
token: p.token,
|
|
75
|
+
phase: e
|
|
76
|
+
});
|
|
77
|
+
a.includes(t) || (s(() => v("operation", e, t)), m = !0);
|
|
78
|
+
}
|
|
79
|
+
l && !m ? s(() => v("notification", e)) : f === r && e.location === "current" && !m && a !== "off" && !u && c.polite.push(v("notification", e)), e.occurrences > n.occurrences && (i.push({
|
|
80
|
+
kind: "occurrences",
|
|
81
|
+
handle: r,
|
|
82
|
+
count: e.occurrences
|
|
83
|
+
}), !l && e.occurrences > 1 && s(() => v("occurrences", e)));
|
|
84
|
+
let h = e.action;
|
|
85
|
+
h.status !== "idle" && (n.action?.token !== h.token || n.action.status !== h.status) && (i.push({
|
|
86
|
+
kind: "action",
|
|
87
|
+
handle: r,
|
|
88
|
+
token: h.token,
|
|
89
|
+
status: h.status
|
|
90
|
+
}), s(() => h.status === "failed" ? v("actionError", e, h.message) : v("actionPending", e)));
|
|
91
|
+
}
|
|
92
|
+
for (let e of ["polite", "assertive"]) d[e] && c[e].push(v("queued", d[e]));
|
|
93
|
+
if (t.overflow.count > t.announcements.overflowCount && (i.push({
|
|
94
|
+
kind: "overflow",
|
|
95
|
+
count: t.overflow.count
|
|
96
|
+
}), u || c.polite.push(v("overflow", t.overflow.count))), u) {
|
|
97
|
+
for (let e of ["polite", "assertive"]) {
|
|
98
|
+
let n = t.notifications.filter((t) => (t.content.announcementPriority ?? "polite") === e).length;
|
|
99
|
+
n && c[e].push(v("resumed", n));
|
|
100
|
+
}
|
|
101
|
+
t.overflow.pending && c.polite.push(v("overflow", t.overflow.count));
|
|
102
|
+
}
|
|
103
|
+
if (l) {
|
|
104
|
+
if (e.getSnapshot() !== t) _();
|
|
105
|
+
else {
|
|
106
|
+
u = !1, f = null;
|
|
107
|
+
for (let [e, t] of [[a, c.polite], [o, c.assertive]]) {
|
|
108
|
+
if (!t.length) continue;
|
|
109
|
+
let n = t.join(". ");
|
|
110
|
+
e.textContent === n && (n += "\xA0"), e.replaceChildren(r.createTextNode(n));
|
|
111
|
+
}
|
|
112
|
+
e.acknowledgeAnnouncements(n, i);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function b() {
|
|
117
|
+
g(), r.visibilityState === "hidden" ? (a?.replaceChildren(), o?.replaceChildren()) : (u = !0, _());
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
mount(t) {
|
|
121
|
+
l = !0;
|
|
122
|
+
let n = (e) => {
|
|
123
|
+
let t = r.createElement("div");
|
|
124
|
+
return t.className = "cloudlet-announcer", t.dataset.cloudletAnnouncer = e, t.setAttribute("aria-live", e), t.setAttribute("aria-atomic", "true"), t;
|
|
125
|
+
};
|
|
126
|
+
a = n("polite"), o = n("assertive"), t.after(a, o), m = h?.requestAnimationFrame?.(() => {
|
|
127
|
+
m = void 0, a && o && t.after(a, o);
|
|
128
|
+
}), c = e.onEvent((t) => {
|
|
129
|
+
t.type === "presented" && (!t.firstPresentation && d !== null && t.handle !== d && e.getSnapshot().island.open && (f = t.handle), d = t.handle, p) ? (p = !1, g(), s = h?.setTimeout(y, 0)) : t.type !== "updated" && t.type !== "diagnostic" && _();
|
|
130
|
+
}), r.addEventListener("visibilitychange", b), _();
|
|
131
|
+
},
|
|
132
|
+
dispose() {
|
|
133
|
+
l = !1, g(), c?.(), r.removeEventListener("visibilitychange", b), m !== void 0 && h?.cancelAnimationFrame(m), a?.remove(), o?.remove(), a = o = null;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { n as createAnnouncer };
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=announcer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announcer.js","names":["content","value","defaults","count","item","message","createAnnouncer","polite","assertive","timer","unsubscribe","mounted","resumed","shown","revisit","waiting","reinsert","view","doc","cancel","schedule","snapshot","bridge","flush","format","args","options","key","error","lease","acks","messages","queued","ledger","handle","priority","readable","say","text","first","operation","operationText","phase","phases","current","action","host","lines","visibility","region","element","event"],"sources":["../../src/react/announcer.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { AnnouncementAcknowledgement, HostLease, OperationAnnouncementPhase, RendererBridge } from '../contracts/internal.js';\nimport type { NotificationHandle } from '../contracts/identity.js';\nimport type { NotificationSnapshot } from '../contracts/snapshots.js';\nimport type { AnnouncementFormatters } from '../react.js';\n\ntype Notification = NotificationSnapshot<ReactNode>;\nconst content = ({ content: value }: Notification) => [value.title,\n value.description?.kind === 'rich' ? value.description.announcement : value.description?.text,\n].filter(Boolean).join('. ');\n\nconst defaults: Required<AnnouncementFormatters> = {\n notification: content,\n queued: count => `${count} notifications queued`,\n occurrences: item => `${item.content.title}. ${item.occurrences} occurrences`,\n overflow: count => `${count} missed notifications`,\n operation: content,\n actionError: (item, message) => `${item.content.title}. ${message}`,\n actionPending: item => `${item.content.title}. ${item.content.action?.label}. In progress`,\n resumed: count => `${count} current notifications`,\n};\n\n/** One attachment, two existing live hosts, one fixed batch window. No event history. */\nexport function createAnnouncer(bridge: RendererBridge<ReactNode>, lease: HostLease, doc: Document,\n options: () => Partial<AnnouncementFormatters> | undefined) {\n let polite: Element | null = null;\n let assertive: Element | null = null;\n let timer: number | undefined;\n let unsubscribe: (() => void) | undefined;\n let mounted = false;\n let resumed = false;\n /** The record last presented, and one shown again inside the open Island (a slide back, or the next after a close). */\n let shown: NotificationHandle | null = null;\n let revisit: NotificationHandle | null = null;\n /** A flush held back until the presented record is readable (see `flush`). */\n let waiting = false;\n let reinsert: number | undefined;\n const view = doc.defaultView;\n const cancel = () => { view?.clearTimeout(timer); timer = undefined; };\n const schedule = () => {\n if (!mounted) return;\n const snapshot = bridge.getSnapshot();\n if (!snapshot.notifications.length && !snapshot.overflow.pending) { cancel(); resumed = false; return; }\n if (timer === undefined && doc.visibilityState !== 'hidden') timer = view?.setTimeout(flush, 300);\n };\n function format<K extends keyof AnnouncementFormatters>(key: K,\n ...args: Parameters<Required<AnnouncementFormatters>[K]>): string {\n // The correlated tuple is preserved at all callers; the cast is local to dispatch.\n type Formatter = (...values: typeof args) => string;\n try {\n const text = (options()?.[key] ?? defaults[key]) as Formatter;\n const value = text(...args);\n if (typeof value !== 'string' || !value.trim()) throw new TypeError('Announcement must be a nonempty string');\n return value;\n } catch (error) {\n bridge.reportDiagnostic(lease, { code: 'formatter-error', source: `Toaster.announcements.${key}`,\n message: 'Announcement formatter failed', error });\n return (defaults[key] as Formatter)(...args);\n }\n }\n function flush() {\n timer = undefined;\n if (!mounted || doc.visibilityState === 'hidden' || !polite || !assertive) return;\n const snapshot = bridge.getSnapshot();\n // The presented record speaks first and the queue after it. While its pill or slide is still\n // arriving (a slow first frame), sending now would say the queue alone; its `presented` event\n // flushes instead.\n if (snapshot.presentation && !snapshot.presentation.readable && !resumed) { waiting = true; return; }\n waiting = false;\n const acks: AnnouncementAcknowledgement[] = [];\n const messages = { polite: [] as string[], assertive: [] as string[] };\n const queued = { polite: 0, assertive: 0 };\n for (const item of snapshot.notifications) {\n const ledger = snapshot.announcements.notifications.find(value => value.handle === item.handle)!;\n const handle = item.handle;\n const priority = item.content.announcementPriority ?? 'polite';\n const readable = snapshot.presentation?.handle === handle && snapshot.presentation.readable;\n const say = (text: () => string) => { if (priority !== 'off' && !resumed) messages[priority].push(text()); };\n // Stack records behind the presented one speak only as an aggregate, like a queue.\n if (item.location === 'stack') {\n if (!ledger.queued) {\n acks.push({ kind: 'queued', handle });\n if (priority !== 'off' && !ledger.firstPresentation && !resumed) queued[priority]++;\n }\n // Queued payloads/progress never speak; first presentation reads the latest state.\n if (!resumed) continue;\n } else if (!readable && !resumed) continue;\n\n const first = item.location === 'current' && readable && !ledger.firstPresentation;\n if (first) acks.push({ kind: 'first-presentation', handle });\n const operation = item.operation;\n let operationText = false;\n if (operation) {\n const phase = operation.status === 'pending' ? operation.cancelRequested ? 'cancel-requested' : 'started' : operation.status;\n const phases = ledger.operation?.token === operation.token ? ledger.operation.phases : [];\n for (const current of new Set<OperationAnnouncementPhase>(['started', ...(operation.cancelRequested ? ['cancel-requested' as const] : []), phase])) {\n if (!phases.includes(current)) acks.push({ kind: 'operation', handle, token: operation.token, phase: current });\n }\n if (!phases.includes(phase)) { say(() => format('operation', item, phase)); operationText = true; }\n }\n if (first && !operationText) say(() => format('notification', item));\n // The title node is shared by every slide, so focus never moves when a slide comes back:\n // speak the record once more so a screen reader hears where the user landed.\n else if (revisit === handle && item.location === 'current' && !operationText && priority !== 'off' && !resumed) {\n messages.polite.push(format('notification', item));\n }\n if (item.occurrences > ledger.occurrences) {\n acks.push({ kind: 'occurrences', handle, count: item.occurrences });\n if (!first && item.occurrences > 1) say(() => format('occurrences', item));\n }\n const action = item.action;\n if (action.status !== 'idle' && (ledger.action?.token !== action.token || ledger.action.status !== action.status)) {\n acks.push({ kind: 'action', handle, token: action.token, status: action.status });\n say(() => action.status === 'failed' ? format('actionError', item, action.message) : format('actionPending', item));\n }\n }\n for (const priority of ['polite', 'assertive'] as const) {\n if (queued[priority]) messages[priority].push(format('queued', queued[priority]));\n }\n if (snapshot.overflow.count > snapshot.announcements.overflowCount) {\n acks.push({ kind: 'overflow', count: snapshot.overflow.count });\n if (!resumed) messages.polite.push(format('overflow', snapshot.overflow.count));\n }\n if (resumed) {\n for (const priority of ['polite', 'assertive'] as const) {\n const count = snapshot.notifications.filter(item => (item.content.announcementPriority ?? 'polite') === priority).length;\n if (count) messages[priority].push(format('resumed', count));\n }\n if (snapshot.overflow.pending) messages.polite.push(format('overflow', snapshot.overflow.count));\n }\n // A user formatter/diagnostic can reenter the controller. Never deliver its stale batch.\n if (!mounted) return;\n if (bridge.getSnapshot() !== snapshot) { schedule(); return; }\n resumed = false;\n revisit = null;\n for (const [host, lines] of [[polite, messages.polite], [assertive, messages.assertive]] as const) {\n if (!lines.length) continue;\n let text = lines.join('. ');\n // The same message again (a second failed attempt) would leave the region unchanged and silent;\n // a trailing no-break space makes it a change without changing what is spoken.\n if (host.textContent === text) text += '\\u00a0';\n host.replaceChildren(doc.createTextNode(text));\n }\n bridge.acknowledgeAnnouncements(lease, acks);\n }\n function visibility() {\n cancel();\n if (doc.visibilityState === 'hidden') {\n polite?.replaceChildren(); assertive?.replaceChildren();\n } else { resumed = true; schedule(); }\n }\n return {\n /**\n * The announcer owns its live regions: created here, next to the host (React owns the host's\n * children), and inserted twice. VoiceOver in Safari ignored assertive changes made while focus\n * was in the open Island in regions inserted only once (0 of 6 runs), and spoke them after one\n * re-insertion on the next frame (6 of 6, rc.2 gate); a zero timeout was not enough (3 of 5).\n */\n mount(host: HTMLElement) {\n mounted = true;\n const region = (priority: 'polite' | 'assertive') => {\n const element = doc.createElement('div');\n element.className = 'cloudlet-announcer';\n element.dataset.cloudletAnnouncer = priority;\n element.setAttribute('aria-live', priority);\n element.setAttribute('aria-atomic', 'true');\n return element;\n };\n polite = region('polite');\n assertive = region('assertive');\n host.after(polite, assertive);\n reinsert = view?.requestAnimationFrame?.(() => {\n reinsert = undefined;\n if (polite && assertive) host.after(polite, assertive);\n });\n unsubscribe = bridge.onEvent(event => {\n if (event.type === 'presented') {\n if (!event.firstPresentation && shown !== null && event.handle !== shown && bridge.getSnapshot().island.open) revisit = event.handle;\n shown = event.handle;\n // The window already passed while the presentation was pending: deliver right away.\n if (waiting) { waiting = false; cancel(); timer = view?.setTimeout(flush, 0); return; }\n }\n // Updated includes progress, reflow and ordinary text edits, not a new semantic phase.\n if (event.type !== 'updated' && event.type !== 'diagnostic') schedule();\n });\n doc.addEventListener('visibilitychange', visibility);\n schedule();\n },\n dispose() {\n mounted = false;\n cancel(); unsubscribe?.();\n doc.removeEventListener('visibilitychange', visibility);\n if (reinsert !== undefined) view?.cancelAnimationFrame(reinsert);\n polite?.remove(); assertive?.remove();\n polite = assertive = null;\n },\n };\n}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AgB,MAC/C,IAAU,IAAMY,EAAS;CACpC;CACA,OAAO;EAOL,MAAM,GAAmB;GACvB,IAAU;GACV,IAAM6B,KAAU,MAAqC;IACnD,IAAMC,IAAUhC,EAAI,cAAc,KAAK;IAKvC,OAJA,EAAQ,YAAY,sBACpB,EAAQ,QAAQ,oBAAoBiB,GACpCe,EAAQ,aAAa,aAAaf,CAAQ,GAC1Ce,EAAQ,aAAa,eAAe,MAAM,GACnCA;GACT;GAmBA,AAlBA,IAASD,EAAO,QAAQ,GACxB,IAAYA,EAAO,WAAW,GAC9BH,EAAK,MAAMvC,GAAQC,CAAS,GAC5B,IAAWS,GAAM,8BAA8B;IAE7C,AADA,IAAW,KAAA,GACPV,KAAUC,KAAWsC,EAAK,MAAMvC,GAAQC,CAAS;GACvD,CAAC,GACD,IAAcc,EAAO,SAAQ,MAAS;IACpC,AAAI6B,EAAM,SAAS,gBACb,CAACA,EAAM,qBAAqBtC,MAAU,QAAQsC,EAAM,WAAWtC,KAASS,EAAO,YAAY,CAAC,CAAC,OAAO,SAAM,IAAU6B,EAAM,SAC9H,IAAQA,EAAM,QAEVpC,MAAW,IAAU,IAAOI,EAAO,GAAG,IAAQF,GAAM,WAAWM,GAAO,CAAC,KAGzE4B,EAAM,SAAS,aAAaA,EAAM,SAAS,gBAAc/B,EAAS;GACxE,CAAC,GACDF,EAAI,iBAAiB,oBAAoB8B,CAAU,GACnD5B,EAAS;EACX;EACA,UAAU;GAMR,AALA,IAAU,IACVD,EAAO,GAAGT,IAAc,GACxBQ,EAAI,oBAAoB,oBAAoB8B,CAAU,GAClDhC,MAAa,KAAA,KAAWC,GAAM,qBAAqBD,CAAQ,GAC/DT,GAAQ,OAAO,GAAGC,GAAW,OAAO,GACpC,IAAS,IAAY;EACvB;CACF;AACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { CloudletProviderProps, ReactCloudletController, ToasterProps } from '../react.js';
|
|
3
|
+
type Renderer = typeof import('./renderer.js');
|
|
4
|
+
export declare function CloudletProvider({ controller, children }: CloudletProviderProps): ReactElement;
|
|
5
|
+
export declare function useCloudlet(): ReactCloudletController;
|
|
6
|
+
/** The controller, or null outside a provider and while the provider's controller is null. */
|
|
7
|
+
export declare function useOptionalCloudlet(): ReactCloudletController | null;
|
|
8
|
+
/** Fetches the renderer chunk once for every Toaster; after a failure the next attempt fetches again. */
|
|
9
|
+
export declare function loadRenderer(): Promise<Renderer>;
|
|
10
|
+
/**
|
|
11
|
+
* The renderer stays out of the start bundle: the chunk loads after mount, and
|
|
12
|
+
* notifications shown meanwhile wait in the controller. On the server and during
|
|
13
|
+
* hydration this renders nothing, exactly like the attached renderer does.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Toaster(options: ToasterProps): ReactElement | null;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/react/bindings.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhG,KAAK,QAAQ,GAAG,cAAc,eAAe,CAAC,CAAC;AAO/C,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,qBAAqB,GAAG,YAAY,CAE9F;AAED,wBAAgB,WAAW,IAAI,uBAAuB,CAIrD;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,IAAI,uBAAuB,GAAG,IAAI,CAEpE;AAED,yGAAyG;AACzG,wBAAgB,YAAY,IAAI,OAAO,CAAC,QAAQ,CAAC,CAMhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,GAAG,IAAI,CAclE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getControllerKernel as e } from "../core/controller.js";
|
|
2
|
+
import { createContext as t, useContext as n, useEffect as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
//#region src/react/bindings.tsx
|
|
5
|
+
var o = t(void 0), s, c;
|
|
6
|
+
function l({ controller: e, children: t }) {
|
|
7
|
+
return /* @__PURE__ */ a(o.Provider, {
|
|
8
|
+
value: e,
|
|
9
|
+
children: t
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function u() {
|
|
13
|
+
let e = n(o);
|
|
14
|
+
if (!e) throw Error("useCloudlet must be used within a CloudletProvider that has a controller");
|
|
15
|
+
return e;
|
|
16
|
+
}
|
|
17
|
+
function d() {
|
|
18
|
+
return n(o) ?? null;
|
|
19
|
+
}
|
|
20
|
+
function f() {
|
|
21
|
+
return c ??= import("./renderer.js").then((e) => s = e, (e) => {
|
|
22
|
+
throw c = void 0, e;
|
|
23
|
+
}), c;
|
|
24
|
+
}
|
|
25
|
+
function p(t) {
|
|
26
|
+
let c = n(o);
|
|
27
|
+
if (c === void 0) throw Error("Toaster must be used within a CloudletProvider");
|
|
28
|
+
let [l, u] = i(s);
|
|
29
|
+
return r(() => {
|
|
30
|
+
if (l) return;
|
|
31
|
+
let t = !0;
|
|
32
|
+
return f().then((e) => {
|
|
33
|
+
t && u(e);
|
|
34
|
+
}, (n) => {
|
|
35
|
+
t && c && e(c).reportRendererLoadError(n);
|
|
36
|
+
}), () => {
|
|
37
|
+
t = !1;
|
|
38
|
+
};
|
|
39
|
+
}, [l, c]), c && l ? /* @__PURE__ */ a(l.AttachedToaster, {
|
|
40
|
+
controller: c,
|
|
41
|
+
options: t
|
|
42
|
+
}) : null;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { l as CloudletProvider, p as Toaster, f as loadRenderer, u as useCloudlet, d as useOptionalCloudlet };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.js","names":["CloudletContext","createContext","renderer","loading","CloudletProvider","controller","useCloudlet","useContext","useOptionalCloudlet","loadRenderer","module","error","Toaster","loaded","setLoaded","useState","useEffect","live","getControllerKernel"],"sources":["../../src/react/bindings.tsx"],"sourcesContent":["import { createContext, useContext, useEffect, useState } from 'react';\nimport type { ReactElement } from 'react';\nimport { getControllerKernel } from '../core/controller.js';\nimport type { CloudletProviderProps, ReactCloudletController, ToasterProps } from '../react.js';\n\ntype Renderer = typeof import('./renderer.js');\n\n/** Undefined outside a provider; null inside one whose controller does not exist yet. */\nconst CloudletContext = createContext<ReactCloudletController | null | undefined>(undefined);\nlet renderer: Renderer | undefined;\nlet loading: Promise<Renderer> | undefined;\n\nexport function CloudletProvider({ controller, children }: CloudletProviderProps): ReactElement {\n return <CloudletContext.Provider value={controller}>{children}</CloudletContext.Provider>;\n}\n\nexport function useCloudlet(): ReactCloudletController {\n const controller = useContext(CloudletContext);\n if (!controller) throw new Error('useCloudlet must be used within a CloudletProvider that has a controller');\n return controller;\n}\n\n/** The controller, or null outside a provider and while the provider's controller is null. */\nexport function useOptionalCloudlet(): ReactCloudletController | null {\n return useContext(CloudletContext) ?? null;\n}\n\n/** Fetches the renderer chunk once for every Toaster; after a failure the next attempt fetches again. */\nexport function loadRenderer(): Promise<Renderer> {\n loading ??= import('./renderer.js').then((module) => (renderer = module), (error: unknown) => {\n loading = undefined;\n throw error;\n });\n return loading;\n}\n\n/**\n * The renderer stays out of the start bundle: the chunk loads after mount, and\n * notifications shown meanwhile wait in the controller. On the server and during\n * hydration this renders nothing, exactly like the attached renderer does.\n */\nexport function Toaster(options: ToasterProps): ReactElement | null {\n const controller = useContext(CloudletContext);\n if (controller === undefined) throw new Error('Toaster must be used within a CloudletProvider');\n const [loaded, setLoaded] = useState(renderer);\n useEffect(() => {\n if (loaded) return;\n let live = true;\n loadRenderer().then((module) => { if (live) setLoaded(module); }, (error: unknown) => {\n if (live && controller) getControllerKernel(controller).reportRendererLoadError(error);\n });\n return () => { live = false; };\n }, [loaded, controller]);\n // A provider without a controller yet (server, first client render) renders nothing.\n return controller && loaded ? <loaded.AttachedToaster controller={controller} options={options} /> : null;\n}\n"],"mappings":";;;;AAQA,IAAMA,IAAkBC,EAA0D,KAAA,CAAS,GACvFC,GACAC;AAEJ,SAAgBC,EAAiB,EAAE,eAAY,eAAiD;CAC9F,OAAO,kBAACJ,EAAgB,UAAjB;EAA0B,OAAOK;EAAa;CAAmC,CAAA;AAC1F;AAEA,SAAgBC,IAAuC;CACrD,IAAMD,IAAaE,EAAWP,CAAe;CAC7C,IAAI,CAACK,GAAY,MAAU,MAAM,0EAA0E;CAC3G,OAAOA;AACT;AAGA,SAAgBG,IAAsD;CACpE,OAAOD,EAAWP,CAAe,KAAK;AACxC;AAGA,SAAgBS,IAAkC;CAKhD,OAJA,MAAY,OAAO,gBAAgB,CAAC,MAAM,MAAY,IAAWC,IAAU,MAAmB;EAE5F,MADA,IAAU,KAAA,GACJC;CACR,CAAC,GACMR;AACT;AAOA,SAAgBS,EAAQ,GAA4C;CAClE,IAAMP,IAAaE,EAAWP,CAAe;CAC7C,IAAIK,MAAe,KAAA,GAAW,MAAU,MAAM,gDAAgD;CAC9F,IAAM,CAACQ,GAAQC,KAAaC,EAASb,CAAQ;CAU7C,OATAc,QAAgB;EACd,IAAIH,GAAQ;EACZ,IAAII,IAAO;EAIX,OAHAR,EAAa,CAAC,CAAC,MAAM,MAAW;GAAE,AAAIQ,KAAMH,EAAUJ,CAAM;EAAG,IAAI,MAAmB;GACpF,AAAIO,KAAQZ,KAAYa,EAAoBb,CAAU,CAAC,CAAC,wBAAwBM,CAAK;EACvF,CAAC,SACY;GAAE,IAAO;EAAO;CAC/B,GAAG,CAACE,GAAQR,CAAU,CAAC,GAEhBA,KAAcQ,IAAS,kBAACA,EAAO,iBAAR;EAAoC;EAAqB;CAAU,CAAA,IAAI;AACvG"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { HostLease, RendererBridge } from '../contracts/internal.js';
|
|
3
|
+
import type { NotificationHandle } from '../contracts/identity.js';
|
|
4
|
+
import type { NotificationSnapshot } from '../contracts/snapshots.js';
|
|
5
|
+
import type { CloudletLabels, CloudletPart, ToasterProps } from '../react.js';
|
|
6
|
+
export declare const defaultLabels: CloudletLabels;
|
|
7
|
+
/** Adds the application's `classNames` part to an own `cloudlet-*` class, never replacing it. */
|
|
8
|
+
export type PartClass = (part: CloudletPart, own: string) => string;
|
|
9
|
+
export declare function partClasses(classNames: ToasterProps['classNames']): PartClass;
|
|
10
|
+
/**
|
|
11
|
+
* The status icon: a 24 px tinted circle with a glyph, the loading spinner or the
|
|
12
|
+
* notification's own icon, and the 2 px progress ring around it (pill and Island
|
|
13
|
+
* share these nodes). With progress the icon is the accessible progressbar. The
|
|
14
|
+
* determinate arc is owned by the host sampler (one RAF per host, 240 ms tween);
|
|
15
|
+
* `preview` draws the value statically for the inert swipe neighbour.
|
|
16
|
+
*/
|
|
17
|
+
export declare function StatusIcon({ notification, slot, part, preview }: {
|
|
18
|
+
notification: NotificationSnapshot<ReactNode>;
|
|
19
|
+
slot: (value: ReactNode) => ReactNode;
|
|
20
|
+
part: PartClass;
|
|
21
|
+
preview?: boolean;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
|
+
export declare function slotRenderer(bridge: RendererBridge<ReactNode>, lease: HostLease, handle: NotificationHandle, rejectSlotFocus: (previous: EventTarget | null) => void): (value: ReactNode) => import("react").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Status icon and title: the same DOM nodes in the pill and in the Island header,
|
|
26
|
+
* so opening never re-creates them and the title can receive focus in place.
|
|
27
|
+
*/
|
|
28
|
+
export declare function Heading({ notification, slot, part, titleId }: {
|
|
29
|
+
notification: NotificationSnapshot<ReactNode>;
|
|
30
|
+
slot: (value: ReactNode) => ReactNode;
|
|
31
|
+
part: PartClass;
|
|
32
|
+
/** Omitted for the inert neighbour preview: no id, focus target, data hook or live progress. */
|
|
33
|
+
titleId?: string;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
/** Rich content of the inert neighbour preview: rendered as is, never checked or reported twice. */
|
|
36
|
+
export declare const previewSlot: (value: ReactNode) => import("react").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* The neighbour shown only while a finger drags the Island content:
|
|
39
|
+
* the same layout as a live slide, but every control is a lookalike without
|
|
40
|
+
* handlers, ids, links or tab stops. The caller puts it in an `inert` container.
|
|
41
|
+
*/
|
|
42
|
+
export declare function SlidePreview({ notification, labels, part }: {
|
|
43
|
+
notification: NotificationSnapshot<ReactNode>;
|
|
44
|
+
labels: CloudletLabels;
|
|
45
|
+
part: PartClass;
|
|
46
|
+
}): import("react").JSX.Element;
|
|
47
|
+
/** Island slide body: description, progress, actions and the action error. */
|
|
48
|
+
export declare function Body({ notification, bridge, lease, labels, navigate, slot, part }: {
|
|
49
|
+
notification: NotificationSnapshot<ReactNode>;
|
|
50
|
+
bridge: RendererBridge<ReactNode>;
|
|
51
|
+
lease: HostLease;
|
|
52
|
+
labels: CloudletLabels;
|
|
53
|
+
navigate: (handle: NotificationHandle) => void;
|
|
54
|
+
slot: (value: ReactNode) => ReactNode;
|
|
55
|
+
part: PartClass;
|
|
56
|
+
}): import("react").JSX.Element;
|
|
57
|
+
export declare function closeButton(labels: CloudletLabels, part: PartClass, onClick: () => void): import("react").JSX.Element;
|
|
58
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/react/card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAA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AAW,UAAW,SAAS,gCAAiD,CAAC;AAM9F;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,YAAY,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,+BAoBtJ;AAED,8EAA8E;AAC9E,wBAAgB,IAAI,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAClF,YAAY,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IACnG,MAAM,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;CAChI,+BAgCA;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,IAAI,+BAEvF"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { Component as e, Suspense as t, useEffect as n, useId as r, useRef as i, useState as a } from "react";
|
|
2
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
//#region src/react/card.tsx
|
|
4
|
+
var c = {
|
|
5
|
+
region: "Notifications",
|
|
6
|
+
island: "Current notifications",
|
|
7
|
+
carousel: "carousel",
|
|
8
|
+
slide: "slide",
|
|
9
|
+
close: "Close notification",
|
|
10
|
+
retry: "Retry",
|
|
11
|
+
cancel: "Request cancellation",
|
|
12
|
+
cancellationRequested: "Cancellation requested",
|
|
13
|
+
acknowledgeOverflow: "Acknowledge missed notifications",
|
|
14
|
+
collapse: "Press Escape to collapse",
|
|
15
|
+
stackSummary: (e, t, n) => [
|
|
16
|
+
e,
|
|
17
|
+
...t > 1 ? [`${t} notifications`] : [],
|
|
18
|
+
...n > 0 ? [`${n} missed`] : []
|
|
19
|
+
].join(", "),
|
|
20
|
+
page: (e, t) => `${e} of ${t}`,
|
|
21
|
+
overflowCount: (e) => `${e} missed notifications`
|
|
22
|
+
}, l = class extends e {
|
|
23
|
+
state = {
|
|
24
|
+
failed: !1,
|
|
25
|
+
content: this.props.content
|
|
26
|
+
};
|
|
27
|
+
static getDerivedStateFromError() {
|
|
28
|
+
return { failed: !0 };
|
|
29
|
+
}
|
|
30
|
+
static getDerivedStateFromProps(e, t) {
|
|
31
|
+
return e.content === t.content ? null : {
|
|
32
|
+
failed: !1,
|
|
33
|
+
content: e.content
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
componentDidCatch(e) {
|
|
37
|
+
this.props.bridge.reportDiagnostic(this.props.lease, {
|
|
38
|
+
code: "slot-error",
|
|
39
|
+
source: "Toaster.slot",
|
|
40
|
+
message: "A rich slot could not be rendered",
|
|
41
|
+
handle: this.props.handle,
|
|
42
|
+
error: e
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return this.state.failed ? this.props.bridge.renderError : /* @__PURE__ */ o(t, {
|
|
47
|
+
fallback: this.props.bridge.renderError,
|
|
48
|
+
children: /* @__PURE__ */ o(u, { ...this.props })
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function u({ content: e, bridge: t, lease: r, handle: s, rejectFocus: c }) {
|
|
53
|
+
let l = i(null), [u, d] = a(null), f = u?.content === e;
|
|
54
|
+
return n(() => {
|
|
55
|
+
let n = l.current;
|
|
56
|
+
if (!n) return;
|
|
57
|
+
let i = !1, a = () => {
|
|
58
|
+
!i && n.querySelector("a[href],button,input,select,textarea,summary,iframe,[tabindex],[contenteditable]:not([contenteditable=\"false\"]),audio[controls],video[controls]") && (i = !0, d({ content: e }), t.reportDiagnostic(r, {
|
|
59
|
+
code: "slot-error",
|
|
60
|
+
source: "Toaster.slot",
|
|
61
|
+
message: "Rich slots must be non-interactive; use the notification action",
|
|
62
|
+
handle: s
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
a();
|
|
66
|
+
let o = n.ownerDocument.defaultView?.MutationObserver, c = o ? new o(a) : null;
|
|
67
|
+
return c?.observe(n, {
|
|
68
|
+
childList: !0,
|
|
69
|
+
subtree: !0,
|
|
70
|
+
attributes: !0
|
|
71
|
+
}), () => c?.disconnect();
|
|
72
|
+
}, [
|
|
73
|
+
e,
|
|
74
|
+
t,
|
|
75
|
+
r,
|
|
76
|
+
s
|
|
77
|
+
]), /* @__PURE__ */ o("div", {
|
|
78
|
+
ref: l,
|
|
79
|
+
className: "cloudlet-slot",
|
|
80
|
+
onFocusCapture: (e) => c(e.relatedTarget),
|
|
81
|
+
children: f ? t.renderError : e
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function d(e, t, n, r) {
|
|
85
|
+
return /* @__PURE__ */ o("button", {
|
|
86
|
+
type: "button",
|
|
87
|
+
"data-cloudlet-control": e,
|
|
88
|
+
...r,
|
|
89
|
+
onClick: n,
|
|
90
|
+
children: t
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function f(e) {
|
|
94
|
+
return /* @__PURE__ */ o("svg", {
|
|
95
|
+
"aria-hidden": "true",
|
|
96
|
+
viewBox: "0 0 16 16",
|
|
97
|
+
children: /* @__PURE__ */ o("path", { d: e })
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function p(e) {
|
|
101
|
+
return (t, n) => {
|
|
102
|
+
let r = e?.[t];
|
|
103
|
+
return typeof r == "string" && r.trim() ? `${n} ${r.trim()}` : n;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
var m = {
|
|
107
|
+
success: "M4.5 8.5 7 11l4.5-5.5",
|
|
108
|
+
error: "m5.5 5.5 5 5m0-5-5 5",
|
|
109
|
+
info: "M8 7.5V11M8 5h.01",
|
|
110
|
+
warning: "M8 4.75V8.5M8 11.25h.01"
|
|
111
|
+
};
|
|
112
|
+
function h({ notification: e, slot: t, part: n, preview: r = !1 }) {
|
|
113
|
+
let { content: i, kind: a } = e, { progress: c } = i, l = c?.kind === "determinate";
|
|
114
|
+
return /* @__PURE__ */ s("div", {
|
|
115
|
+
className: n("icon", "cloudlet-icon"),
|
|
116
|
+
"data-kind": a,
|
|
117
|
+
...c && !r ? {
|
|
118
|
+
role: "progressbar",
|
|
119
|
+
"aria-valuemin": 0,
|
|
120
|
+
"aria-valuemax": 100,
|
|
121
|
+
"aria-valuenow": l ? Math.round(c.value * 100) : void 0,
|
|
122
|
+
"aria-label": c.label ?? i.title
|
|
123
|
+
} : { "aria-hidden": "true" },
|
|
124
|
+
children: [i.icon === void 0 ? a === "loading" ? !c && /* @__PURE__ */ o("svg", {
|
|
125
|
+
"aria-hidden": "true",
|
|
126
|
+
viewBox: "0 0 16 16",
|
|
127
|
+
className: "cloudlet-glyph cloudlet-spinner",
|
|
128
|
+
children: /* @__PURE__ */ o("circle", {
|
|
129
|
+
cx: "8",
|
|
130
|
+
cy: "8",
|
|
131
|
+
r: "5.5",
|
|
132
|
+
strokeDasharray: "22 13"
|
|
133
|
+
})
|
|
134
|
+
}) : /* @__PURE__ */ o("svg", {
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
viewBox: "0 0 16 16",
|
|
137
|
+
className: "cloudlet-glyph",
|
|
138
|
+
children: /* @__PURE__ */ o("path", { d: m[a] })
|
|
139
|
+
}) : /* @__PURE__ */ o("span", {
|
|
140
|
+
className: "cloudlet-glyph",
|
|
141
|
+
"aria-hidden": "true",
|
|
142
|
+
children: t(i.icon)
|
|
143
|
+
}), c && /* @__PURE__ */ s("svg", {
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
viewBox: "0 0 32 32",
|
|
146
|
+
className: "cloudlet-ring",
|
|
147
|
+
"data-progress": c.kind,
|
|
148
|
+
children: [/* @__PURE__ */ o("circle", {
|
|
149
|
+
className: "cloudlet-ring-track",
|
|
150
|
+
cx: "16",
|
|
151
|
+
cy: "16",
|
|
152
|
+
r: "15"
|
|
153
|
+
}), /* @__PURE__ */ o("circle", {
|
|
154
|
+
className: "cloudlet-progress-fill",
|
|
155
|
+
cx: "16",
|
|
156
|
+
cy: "16",
|
|
157
|
+
r: "15",
|
|
158
|
+
pathLength: "100",
|
|
159
|
+
transform: "rotate(-90 16 16)",
|
|
160
|
+
strokeDasharray: l ? r ? `${Math.round(c.value * 1e4) / 100} 100` : "0 100" : "25 75"
|
|
161
|
+
})]
|
|
162
|
+
})]
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function g(e, t, n, r) {
|
|
166
|
+
return (i) => /* @__PURE__ */ o(l, {
|
|
167
|
+
content: i,
|
|
168
|
+
bridge: e,
|
|
169
|
+
lease: t,
|
|
170
|
+
handle: n,
|
|
171
|
+
rejectFocus: r
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function _({ notification: e, slot: t, part: n, titleId: r }) {
|
|
175
|
+
let i = n("title", "cloudlet-title");
|
|
176
|
+
return /* @__PURE__ */ s("div", {
|
|
177
|
+
className: "cloudlet-heading",
|
|
178
|
+
children: [/* @__PURE__ */ o(h, {
|
|
179
|
+
notification: e,
|
|
180
|
+
slot: t,
|
|
181
|
+
part: n,
|
|
182
|
+
preview: r === void 0
|
|
183
|
+
}), r === void 0 ? /* @__PURE__ */ o("h2", {
|
|
184
|
+
className: i,
|
|
185
|
+
children: e.content.title
|
|
186
|
+
}) : /* @__PURE__ */ o("h2", {
|
|
187
|
+
id: r,
|
|
188
|
+
tabIndex: -1,
|
|
189
|
+
"data-cloudlet-title": "",
|
|
190
|
+
className: i,
|
|
191
|
+
children: e.content.title
|
|
192
|
+
})]
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
var v = (e) => /* @__PURE__ */ o("div", {
|
|
196
|
+
className: "cloudlet-slot",
|
|
197
|
+
children: e
|
|
198
|
+
}), y = (e) => !!e?.canRetry && e.status !== "fulfilled";
|
|
199
|
+
function b({ notification: e, labels: t, part: n }) {
|
|
200
|
+
let { content: r, operation: i, kind: a } = e, c = n("action", "cloudlet-action"), l = (e, t = !1) => /* @__PURE__ */ o("button", {
|
|
201
|
+
type: "button",
|
|
202
|
+
tabIndex: -1,
|
|
203
|
+
className: t ? `${c} cloudlet-primary` : c,
|
|
204
|
+
children: e
|
|
205
|
+
});
|
|
206
|
+
return /* @__PURE__ */ o("div", {
|
|
207
|
+
className: "cloudlet-slide",
|
|
208
|
+
"data-kind": a,
|
|
209
|
+
children: /* @__PURE__ */ s("div", {
|
|
210
|
+
className: n("body", "cloudlet-body"),
|
|
211
|
+
"data-kind": a,
|
|
212
|
+
children: [
|
|
213
|
+
r.description && /* @__PURE__ */ o("div", {
|
|
214
|
+
className: n("description", "cloudlet-description"),
|
|
215
|
+
children: r.description.kind === "text" ? /* @__PURE__ */ o("p", { children: r.description.text }) : v(r.description.content)
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ s("div", {
|
|
218
|
+
className: n("actions", "cloudlet-actions"),
|
|
219
|
+
children: [
|
|
220
|
+
r.action?.kind === "command" && l(r.action.label, !0),
|
|
221
|
+
r.action?.kind === "link" && /* @__PURE__ */ o("a", {
|
|
222
|
+
className: `${c} cloudlet-primary`,
|
|
223
|
+
children: r.action.label
|
|
224
|
+
}),
|
|
225
|
+
y(i) && l(t.retry),
|
|
226
|
+
i?.canCancel && l(i.cancelRequested ? t.cancellationRequested : t.cancel)
|
|
227
|
+
]
|
|
228
|
+
}),
|
|
229
|
+
e.action.status === "failed" && /* @__PURE__ */ o("p", {
|
|
230
|
+
className: "cloudlet-action-error",
|
|
231
|
+
children: e.action.message
|
|
232
|
+
})
|
|
233
|
+
]
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function x({ notification: e, bridge: t, lease: n, labels: i, navigate: a, slot: c, part: l }) {
|
|
238
|
+
let { handle: u, content: f, operation: p, action: m, kind: h } = e, g = l("action", "cloudlet-action"), _ = `${g} cloudlet-primary`, v = r(), b = f.action, x = (e) => {
|
|
239
|
+
queueMicrotask(() => {
|
|
240
|
+
e.defaultPrevented || a(u);
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
return /* @__PURE__ */ s("div", {
|
|
244
|
+
className: l("body", "cloudlet-body"),
|
|
245
|
+
"data-kind": h,
|
|
246
|
+
children: [
|
|
247
|
+
f.description && /* @__PURE__ */ s("div", {
|
|
248
|
+
className: l("description", "cloudlet-description"),
|
|
249
|
+
children: [f.description.kind === "text" && /* @__PURE__ */ o("p", { children: f.description.text }), f.description.kind === "rich" && c(f.description.content)]
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ s("div", {
|
|
252
|
+
className: l("actions", "cloudlet-actions"),
|
|
253
|
+
children: [
|
|
254
|
+
b?.kind === "command" && d("action", b.label, () => {
|
|
255
|
+
m.status !== "pending" && t.invokeAction(n, u);
|
|
256
|
+
}, {
|
|
257
|
+
className: _,
|
|
258
|
+
"aria-disabled": m.status === "pending",
|
|
259
|
+
"aria-busy": m.status === "pending",
|
|
260
|
+
"aria-describedby": m.status === "failed" ? `${v}-action-error` : void 0
|
|
261
|
+
}),
|
|
262
|
+
b?.kind === "link" && /* @__PURE__ */ o("a", {
|
|
263
|
+
"data-cloudlet-control": "action",
|
|
264
|
+
className: _,
|
|
265
|
+
href: b.href,
|
|
266
|
+
target: b.target,
|
|
267
|
+
rel: b.target === "_blank" ? [...new Set(`${b.rel ?? ""} noopener`.trim().split(/\s+/u))].join(" ") : b.rel,
|
|
268
|
+
onClick: (e) => x(e.nativeEvent),
|
|
269
|
+
onAuxClick: (e) => {
|
|
270
|
+
e.button === 1 && x(e.nativeEvent);
|
|
271
|
+
},
|
|
272
|
+
children: b.label
|
|
273
|
+
}),
|
|
274
|
+
y(p) && d("retry", i.retry, () => t.retryOperation(n, u, p.token), { className: g }),
|
|
275
|
+
p?.canCancel && d("cancel", p.cancelRequested ? i.cancellationRequested : i.cancel, () => {
|
|
276
|
+
p.cancelRequested || t.cancelOperation(n, u, p.token);
|
|
277
|
+
}, {
|
|
278
|
+
className: g,
|
|
279
|
+
"aria-disabled": p.cancelRequested
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
}),
|
|
283
|
+
m.status === "failed" && /* @__PURE__ */ o("p", {
|
|
284
|
+
id: `${v}-action-error`,
|
|
285
|
+
className: "cloudlet-action-error",
|
|
286
|
+
children: m.message
|
|
287
|
+
})
|
|
288
|
+
]
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function S(e, t, n) {
|
|
292
|
+
return d("close", f("m4.5 4.5 7 7m0-7-7 7"), n, {
|
|
293
|
+
"aria-label": e.close,
|
|
294
|
+
className: t("close", "cloudlet-close")
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
//#endregion
|
|
298
|
+
export { x as Body, _ as Heading, b as SlidePreview, h as StatusIcon, S as closeButton, c as defaultLabels, p as partClasses, v as previewSlot, g as slotRenderer };
|
|
299
|
+
|
|
300
|
+
//# sourceMappingURL=card.js.map
|