@cloudlet/toast 1.3.0 → 1.4.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 +128 -0
- package/README.md +27 -1
- package/dist/agent.d.ts +334 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +494 -0
- package/dist/agent.js.map +1 -0
- package/dist/contracts/events.d.ts +14 -0
- package/dist/contracts/events.d.ts.map +1 -1
- package/dist/contracts/internal.d.ts +16 -2
- package/dist/contracts/internal.d.ts.map +1 -1
- package/dist/contracts/notifications.d.ts +16 -0
- package/dist/contracts/notifications.d.ts.map +1 -1
- package/dist/contracts/snapshots.d.ts +8 -0
- package/dist/contracts/snapshots.d.ts.map +1 -1
- package/dist/core/actions.d.ts +69 -0
- package/dist/core/actions.d.ts.map +1 -0
- package/dist/core/actions.js +160 -0
- package/dist/core/actions.js.map +1 -0
- package/dist/core/agent-port.d.ts +116 -0
- package/dist/core/agent-port.d.ts.map +1 -0
- package/dist/core/agent-port.js +138 -0
- package/dist/core/agent-port.js.map +1 -0
- package/dist/core/bridge.d.ts.map +1 -1
- package/dist/core/bridge.js +120 -231
- package/dist/core/bridge.js.map +1 -1
- package/dist/core/controller.d.ts +44 -9
- package/dist/core/controller.d.ts.map +1 -1
- package/dist/core/controller.js +367 -292
- package/dist/core/controller.js.map +1 -1
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +103 -94
- package/dist/core/validation.js.map +1 -1
- package/dist/react/card.d.ts.map +1 -1
- package/dist/react/card.js +3 -3
- package/dist/react/card.js.map +1 -1
- package/dist/react/host.d.ts.map +1 -1
- package/dist/react/host.js +257 -246
- package/dist/react/host.js.map +1 -1
- package/dist/react.d.ts +7 -0
- package/dist/react.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/agent.ts +879 -0
- package/src/contracts/events.ts +15 -0
- package/src/contracts/internal.ts +14 -1
- package/src/contracts/notifications.ts +16 -0
- package/src/contracts/snapshots.ts +8 -0
- package/src/core/actions.ts +149 -0
- package/src/core/agent-port.ts +237 -0
- package/src/core/bridge.ts +19 -105
- package/src/core/controller.ts +183 -56
- package/src/core/validation.ts +6 -3
- package/src/react/card.tsx +4 -3
- package/src/react/host.tsx +26 -3
- package/src/react.ts +7 -0
package/dist/core/validation.js
CHANGED
|
@@ -44,70 +44,74 @@ var e = [
|
|
|
44
44
|
"tel",
|
|
45
45
|
"url",
|
|
46
46
|
"search"
|
|
47
|
-
], o =
|
|
48
|
-
|
|
47
|
+
], o = [
|
|
48
|
+
"allow",
|
|
49
|
+
"confirm",
|
|
50
|
+
"deny"
|
|
51
|
+
], s = Object.freeze([]), c = Object.hasOwn, l = (e, t) => e ? `${e}.${String(t)}` : String(t);
|
|
52
|
+
function u(e, t, n) {
|
|
49
53
|
e.push(Object.freeze({
|
|
50
54
|
path: t,
|
|
51
55
|
message: n
|
|
52
56
|
}));
|
|
53
57
|
}
|
|
54
|
-
function
|
|
58
|
+
function d(e, t, n, r, i = []) {
|
|
55
59
|
if (typeof e != "object" || !e || Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null) {
|
|
56
|
-
|
|
60
|
+
u(r, t, "Expected a plain object");
|
|
57
61
|
return;
|
|
58
62
|
}
|
|
59
63
|
let a = !1;
|
|
60
64
|
for (let o of Reflect.ownKeys(e)) {
|
|
61
65
|
let s = Object.getOwnPropertyDescriptor(e, o);
|
|
62
|
-
(typeof o != "string" || !n.includes(o)) &&
|
|
66
|
+
(typeof o != "string" || !n.includes(o)) && u(r, l(t, o), "Unknown field"), s && !("value" in s) ? (u(r, l(t, o), "Expected a data property"), a = !0) : s?.value === void 0 && (typeof o != "string" || !i.includes(o)) && u(r, l(t, o), "Omit optional fields instead of passing undefined");
|
|
63
67
|
}
|
|
64
68
|
return a ? void 0 : e;
|
|
65
69
|
}
|
|
66
|
-
function
|
|
70
|
+
function f(e, t, n, r) {
|
|
67
71
|
for (let [i, a, o] of r) {
|
|
68
|
-
let r =
|
|
72
|
+
let r = c(e, i);
|
|
69
73
|
if (!o && (!r || e[i] === void 0)) continue;
|
|
70
|
-
let
|
|
71
|
-
(typeof a == "string" ? a === "nonempty string" ? typeof
|
|
74
|
+
let s = o === "own" && !r ? void 0 : e[i];
|
|
75
|
+
(typeof a == "string" ? a === "nonempty string" ? typeof s == "string" && s.trim().length > 0 : typeof s === a : typeof s == "string" && a.includes(s)) || u(t, l(n, i), typeof a == "string" ? `Expected a ${a}` : `Expected one of: ${a.join(", ")}`);
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
|
-
function
|
|
75
|
-
for (let a of r)
|
|
78
|
+
function p(e, t, n, r, i) {
|
|
79
|
+
for (let a of r) c(e, a) && u(t, l(n, a), `Field is not allowed for ${i}`);
|
|
76
80
|
}
|
|
77
|
-
function
|
|
78
|
-
let n =
|
|
81
|
+
function m(e, t) {
|
|
82
|
+
let n = d(e, "description", [
|
|
79
83
|
"kind",
|
|
80
84
|
"text",
|
|
81
85
|
"content",
|
|
82
86
|
"announcement"
|
|
83
87
|
], t, ["content"]);
|
|
84
|
-
n && (n.kind === "text" ? (
|
|
88
|
+
n && (n.kind === "text" ? (p(n, t, "description", ["content", "announcement"], "a text description"), f(n, t, "description", [[
|
|
85
89
|
"text",
|
|
86
90
|
"string",
|
|
87
91
|
"own"
|
|
88
|
-
]])) : n.kind === "rich" ? (
|
|
92
|
+
]])) : n.kind === "rich" ? (p(n, t, "description", ["text"], "a rich description"), c(n, "content") || u(t, "description.content", "Required field"), f(n, t, "description", [[
|
|
89
93
|
"announcement",
|
|
90
94
|
"nonempty string",
|
|
91
95
|
"own"
|
|
92
|
-
]])) :
|
|
96
|
+
]])) : f(n, t, "description", [[
|
|
93
97
|
"kind",
|
|
94
98
|
["text", "rich"],
|
|
95
99
|
!0
|
|
96
100
|
]]));
|
|
97
101
|
}
|
|
98
|
-
function
|
|
99
|
-
let n =
|
|
102
|
+
function h(e, t) {
|
|
103
|
+
let n = d(e, "progress", [
|
|
100
104
|
"kind",
|
|
101
105
|
"value",
|
|
102
106
|
"label"
|
|
103
107
|
], t);
|
|
104
|
-
n && (n.kind === "determinate" ? (typeof n.value != "number" || !Number.isFinite(n.value) || n.value < 0 || n.value > 1) &&
|
|
108
|
+
n && (n.kind === "determinate" ? (typeof n.value != "number" || !Number.isFinite(n.value) || n.value < 0 || n.value > 1) && u(t, "progress.value", "Expected a finite number between 0 and 1") : n.kind === "indeterminate" ? p(n, t, "progress", ["value"], "indeterminate progress") : f(n, t, "progress", [[
|
|
105
109
|
"kind",
|
|
106
110
|
["indeterminate", "determinate"],
|
|
107
111
|
!0
|
|
108
|
-
]]),
|
|
112
|
+
]]), f(n, t, "progress", [["label", "string"]]));
|
|
109
113
|
}
|
|
110
|
-
function
|
|
114
|
+
function g(e) {
|
|
111
115
|
if (/[\u0000-\u001f\u007f]/u.test(e)) return !1;
|
|
112
116
|
let t = e.trim(), n = t.indexOf(":"), r = t.search(/[/?#]/u);
|
|
113
117
|
if (n === -1 || r !== -1 && r < n) return !0;
|
|
@@ -119,15 +123,15 @@ function h(e) {
|
|
|
119
123
|
"tel"
|
|
120
124
|
].includes(i);
|
|
121
125
|
}
|
|
122
|
-
function
|
|
126
|
+
function _(e, t) {
|
|
123
127
|
if (!Array.isArray(e) || e.length < 1 || e.length > 3) {
|
|
124
|
-
|
|
128
|
+
u(t, "action.fields", "Expected an array of one to three fields");
|
|
125
129
|
return;
|
|
126
130
|
}
|
|
127
131
|
let n = /* @__PURE__ */ new Set();
|
|
128
132
|
e.forEach((e, r) => {
|
|
129
|
-
let o = `action.fields.${r}`,
|
|
130
|
-
|
|
133
|
+
let o = `action.fields.${r}`, s = d(e, o, i, t);
|
|
134
|
+
s && (f(s, t, o, [
|
|
131
135
|
[
|
|
132
136
|
"name",
|
|
133
137
|
"nonempty string",
|
|
@@ -148,11 +152,11 @@ function g(e, t) {
|
|
|
148
152
|
["required", "boolean"],
|
|
149
153
|
["autoComplete", "string"],
|
|
150
154
|
["inputMode", a]
|
|
151
|
-
]), n.has(
|
|
155
|
+
]), n.has(s.name) && u(t, `${o}.name`, "Field names must be unique"), n.add(s.name), c(s, "maxLength") && s.maxLength !== void 0 && (typeof s.maxLength != "number" || !Number.isInteger(s.maxLength) || s.maxLength < 1) ? u(t, `${o}.maxLength`, "Expected a positive integer") : typeof s.maxLength == "number" && typeof s.defaultValue == "string" && s.defaultValue.length > s.maxLength && u(t, `${o}.defaultValue`, "Longer than maxLength"));
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
|
-
function
|
|
155
|
-
let n =
|
|
158
|
+
function v(e, t) {
|
|
159
|
+
let n = d(e, "action", [
|
|
156
160
|
"kind",
|
|
157
161
|
"label",
|
|
158
162
|
"run",
|
|
@@ -161,17 +165,18 @@ function _(e, t) {
|
|
|
161
165
|
"target",
|
|
162
166
|
"rel",
|
|
163
167
|
"fields",
|
|
164
|
-
"validate"
|
|
168
|
+
"validate",
|
|
169
|
+
"agent"
|
|
165
170
|
], t);
|
|
166
|
-
n && (
|
|
171
|
+
n && (f(n, t, "action", [[
|
|
167
172
|
"label",
|
|
168
173
|
"nonempty string",
|
|
169
174
|
!0
|
|
170
|
-
]]), n.kind === "
|
|
175
|
+
]]), n.kind === "link" ? p(n, t, "action", ["agent"], "a link action") : (n.kind === "command" || n.kind === "form") && f(n, t, "action", [["agent", o]]), n.kind === "form" ? (p(n, t, "action", [
|
|
171
176
|
"href",
|
|
172
177
|
"target",
|
|
173
178
|
"rel"
|
|
174
|
-
], "a form action"),
|
|
179
|
+
], "a form action"), f(n, t, "action", [
|
|
175
180
|
[
|
|
176
181
|
"run",
|
|
177
182
|
"function",
|
|
@@ -179,24 +184,24 @@ function _(e, t) {
|
|
|
179
184
|
],
|
|
180
185
|
["errorMessage", "function"],
|
|
181
186
|
["validate", "function"]
|
|
182
|
-
]),
|
|
187
|
+
]), _(n.fields, t)) : (p(n, t, "action", ["fields", "validate"], `a ${n.kind === "link" ? "link" : "command"} action`), n.kind === "command" ? (p(n, t, "action", [
|
|
183
188
|
"href",
|
|
184
189
|
"target",
|
|
185
190
|
"rel"
|
|
186
|
-
], "a command action"),
|
|
191
|
+
], "a command action"), f(n, t, "action", [[
|
|
187
192
|
"run",
|
|
188
193
|
"function",
|
|
189
194
|
!0
|
|
190
|
-
], ["errorMessage", "function"]])) : n.kind === "link" ? (
|
|
195
|
+
], ["errorMessage", "function"]])) : n.kind === "link" ? (p(n, t, "action", ["run", "errorMessage"], "a link action"), f(n, t, "action", [[
|
|
191
196
|
"href",
|
|
192
197
|
"nonempty string",
|
|
193
198
|
!0
|
|
194
|
-
]]), typeof n.href == "string" && !
|
|
199
|
+
]]), typeof n.href == "string" && !g(n.href) && u(t, "action.href", "Unsupported or unsafe URL"), f(n, t, "action", [["target", [
|
|
195
200
|
"_self",
|
|
196
201
|
"_blank",
|
|
197
202
|
"_parent",
|
|
198
203
|
"_top"
|
|
199
|
-
]], ["rel", "string"]])) :
|
|
204
|
+
]], ["rel", "string"]])) : f(n, t, "action", [[
|
|
200
205
|
"kind",
|
|
201
206
|
[
|
|
202
207
|
"command",
|
|
@@ -206,12 +211,12 @@ function _(e, t) {
|
|
|
206
211
|
!0
|
|
207
212
|
]])));
|
|
208
213
|
}
|
|
209
|
-
function
|
|
210
|
-
|
|
214
|
+
function y(e, t, n) {
|
|
215
|
+
f(e, t, "", [
|
|
211
216
|
[
|
|
212
217
|
"title",
|
|
213
218
|
"nonempty string",
|
|
214
|
-
!n ||
|
|
219
|
+
!n || c(e, "title")
|
|
215
220
|
],
|
|
216
221
|
["kind", [
|
|
217
222
|
"info",
|
|
@@ -233,33 +238,33 @@ function v(e, t, n) {
|
|
|
233
238
|
]]
|
|
234
239
|
]);
|
|
235
240
|
for (let [r, i] of [
|
|
236
|
-
["description",
|
|
237
|
-
["progress",
|
|
238
|
-
["action",
|
|
239
|
-
])
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
function y(e) {
|
|
243
|
-
return e.length === 0 ? o : Object.freeze(e);
|
|
241
|
+
["description", m],
|
|
242
|
+
["progress", h],
|
|
243
|
+
["action", v]
|
|
244
|
+
]) c(e, r) && e[r] !== void 0 && !(n && e[r] === null) && i(e[r], t);
|
|
245
|
+
c(e, "duration") && e.duration !== void 0 && e.duration !== null && (typeof e.duration != "number" || !Number.isFinite(e.duration) || e.duration < 0) && u(t, "duration", "Expected null or a finite nonnegative duration");
|
|
244
246
|
}
|
|
245
247
|
function b(e) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
+
return e.length === 0 ? s : Object.freeze(e);
|
|
249
|
+
}
|
|
250
|
+
function x(e) {
|
|
251
|
+
let t = [], r = d(e, "", n, t);
|
|
252
|
+
return r && (y(r, t, !1), f(r, t, "", [
|
|
248
253
|
["id", "nonempty string"],
|
|
249
254
|
["dedupeKey", "nonempty string"],
|
|
250
255
|
["onClose", "function"]
|
|
251
|
-
])),
|
|
256
|
+
])), b(t);
|
|
252
257
|
}
|
|
253
|
-
function
|
|
254
|
-
let n = [], r =
|
|
255
|
-
return r &&
|
|
258
|
+
function S(e) {
|
|
259
|
+
let n = [], r = d(e, "", t, n);
|
|
260
|
+
return r && y(r, n, !0), b(n);
|
|
256
261
|
}
|
|
257
|
-
function
|
|
258
|
-
let r = [], i =
|
|
259
|
-
return i && (
|
|
262
|
+
function C(t, n = !1) {
|
|
263
|
+
let r = [], i = d(t, "", e, r);
|
|
264
|
+
return i && (y(i, r, !1), n && c(i, "duration") && u(r, "duration", "Pending content cannot define a duration")), b(r);
|
|
260
265
|
}
|
|
261
|
-
function
|
|
262
|
-
let n = [], r =
|
|
266
|
+
function w(e, t) {
|
|
267
|
+
let n = [], r = d(e, "", [
|
|
263
268
|
"id",
|
|
264
269
|
"priority",
|
|
265
270
|
"pending",
|
|
@@ -270,44 +275,44 @@ function C(e, t) {
|
|
|
270
275
|
"isCancellation",
|
|
271
276
|
"onClose"
|
|
272
277
|
], n);
|
|
273
|
-
if (!r) return
|
|
274
|
-
|
|
278
|
+
if (!r) return b(n);
|
|
279
|
+
f(r, n, "", [["id", "nonempty string"], ["priority", ["normal", "high"]]]);
|
|
275
280
|
for (let e of [
|
|
276
281
|
"pending",
|
|
277
282
|
"success",
|
|
278
283
|
"error",
|
|
279
284
|
"cancelled"
|
|
280
|
-
]) if ((e !== "cancelled" ||
|
|
281
|
-
return
|
|
285
|
+
]) if ((e !== "cancelled" || c(r, e)) && (e === "pending" || typeof r[e] != "function")) for (let t of C(r[e], e === "pending")) u(n, t.path ? `${e}.${t.path}` : e, t.message);
|
|
286
|
+
return f(r, n, "", [
|
|
282
287
|
["cancel", "function"],
|
|
283
288
|
["isCancellation", "function"],
|
|
284
289
|
["onClose", "function"]
|
|
285
|
-
]), t &&
|
|
290
|
+
]), t && c(r, "cancel") && u(n, "cancel", "Factory cancellation uses its attempt signal"), b(n);
|
|
286
291
|
}
|
|
287
|
-
var
|
|
288
|
-
function
|
|
292
|
+
var T = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0;
|
|
293
|
+
function E(e) {
|
|
289
294
|
if (e === void 0) return Object.freeze({ autoDismiss: !0 });
|
|
290
|
-
let t = [], n =
|
|
295
|
+
let t = [], n = d(e, "", [
|
|
291
296
|
"autoDismiss",
|
|
292
297
|
"attentionDelay",
|
|
293
298
|
"messages",
|
|
294
299
|
"onOverflow",
|
|
295
300
|
"onDiagnostic"
|
|
296
301
|
], t);
|
|
297
|
-
if (n && (
|
|
302
|
+
if (n && (f(n, t, "", [
|
|
298
303
|
["autoDismiss", "boolean"],
|
|
299
304
|
["onOverflow", "function"],
|
|
300
305
|
["onDiagnostic", "function"]
|
|
301
|
-
]),
|
|
302
|
-
let e =
|
|
303
|
-
e &&
|
|
306
|
+
]), c(n, "attentionDelay") && n.attentionDelay !== void 0 && typeof n.attentionDelay != "number" && u(t, "attentionDelay", "Expected a number"), c(n, "messages") && n.messages !== void 0)) {
|
|
307
|
+
let e = d(n.messages, "messages", r, t);
|
|
308
|
+
e && f(e, t, "messages", r.map((e) => [e, "string"]));
|
|
304
309
|
}
|
|
305
310
|
if (t.length) throw TypeError(t.map(({ path: e, message: t }) => `${e || "options"}: ${t}`).join("; "));
|
|
306
|
-
if (e.attentionDelay !== void 0 && !
|
|
311
|
+
if (e.attentionDelay !== void 0 && !T(e.attentionDelay)) throw RangeError("attentionDelay: Expected a finite nonnegative number of milliseconds");
|
|
307
312
|
let i = { autoDismiss: e.autoDismiss ?? !0 };
|
|
308
|
-
return e.attentionDelay !== void 0 && (i.attentionDelay = e.attentionDelay), e.messages !== void 0 && (i.messages =
|
|
313
|
+
return e.attentionDelay !== void 0 && (i.attentionDelay = e.attentionDelay), e.messages !== void 0 && (i.messages = D(e.messages, [], r)), e.onOverflow !== void 0 && (i.onOverflow = e.onOverflow), e.onDiagnostic !== void 0 && (i.onDiagnostic = e.onDiagnostic), Object.freeze(i);
|
|
309
314
|
}
|
|
310
|
-
function
|
|
315
|
+
function D(e, t, n = []) {
|
|
311
316
|
let r = {};
|
|
312
317
|
for (let i of [...t, ...n]) {
|
|
313
318
|
let n = e[i];
|
|
@@ -315,30 +320,30 @@ function E(e, t, n = []) {
|
|
|
315
320
|
}
|
|
316
321
|
return Object.freeze(r);
|
|
317
322
|
}
|
|
318
|
-
function
|
|
319
|
-
return e.kind === "text" ?
|
|
323
|
+
function O(e) {
|
|
324
|
+
return e.kind === "text" ? D(e, ["kind", "text"]) : D(e, [
|
|
320
325
|
"kind",
|
|
321
326
|
"content",
|
|
322
327
|
"announcement"
|
|
323
328
|
]);
|
|
324
329
|
}
|
|
325
|
-
function
|
|
326
|
-
return e.kind === "indeterminate" ?
|
|
330
|
+
function k(e) {
|
|
331
|
+
return e.kind === "indeterminate" ? D(e, ["kind"], ["label"]) : D(e, ["kind", "value"], ["label"]);
|
|
327
332
|
}
|
|
328
|
-
var
|
|
329
|
-
function
|
|
330
|
-
if (
|
|
331
|
-
let t = e.kind === "command" ?
|
|
333
|
+
var A = /* @__PURE__ */ new WeakSet();
|
|
334
|
+
function j(e) {
|
|
335
|
+
if (A.has(e)) return e;
|
|
336
|
+
let t = e.kind === "command" ? D(e, [
|
|
332
337
|
"kind",
|
|
333
338
|
"label",
|
|
334
339
|
"run"
|
|
335
|
-
], ["errorMessage"]) : e.kind === "link" ?
|
|
340
|
+
], ["errorMessage", "agent"]) : e.kind === "link" ? D(e, [
|
|
336
341
|
"kind",
|
|
337
342
|
"label",
|
|
338
343
|
"href"
|
|
339
|
-
], ["target", "rel"]) :
|
|
344
|
+
], ["target", "rel"]) : D({
|
|
340
345
|
...e,
|
|
341
|
-
fields: Object.freeze(e.fields.map((e) =>
|
|
346
|
+
fields: Object.freeze(e.fields.map((e) => D(e, [
|
|
342
347
|
"name",
|
|
343
348
|
"kind",
|
|
344
349
|
"label"
|
|
@@ -355,23 +360,27 @@ function A(e) {
|
|
|
355
360
|
"fields",
|
|
356
361
|
"label",
|
|
357
362
|
"run"
|
|
358
|
-
], [
|
|
359
|
-
|
|
363
|
+
], [
|
|
364
|
+
"errorMessage",
|
|
365
|
+
"validate",
|
|
366
|
+
"agent"
|
|
367
|
+
]);
|
|
368
|
+
return A.add(t), t;
|
|
360
369
|
}
|
|
361
|
-
function
|
|
370
|
+
function M(e) {
|
|
362
371
|
let t = {
|
|
363
372
|
title: e.title,
|
|
364
373
|
announcementPriority: e.announcementPriority ?? "polite"
|
|
365
374
|
};
|
|
366
|
-
return e.description !== void 0 && (t.description =
|
|
375
|
+
return e.description !== void 0 && (t.description = O(e.description)), c(e, "icon") && (t.icon = e.icon), e.progress !== void 0 && (t.progress = k(e.progress)), e.action !== void 0 && (t.action = j(e.action)), e.duration !== void 0 && (t.duration = e.duration), e.attention !== void 0 && (t.attention = e.attention), Object.freeze(t);
|
|
367
376
|
}
|
|
368
|
-
function
|
|
377
|
+
function N(e, t) {
|
|
369
378
|
if (e === t) return !0;
|
|
370
379
|
if (!e || !t) return !1;
|
|
371
380
|
let n = Object.keys(e);
|
|
372
|
-
return n.length === Object.keys(t).length && n.every((n) =>
|
|
381
|
+
return n.length === Object.keys(t).length && n.every((n) => c(t, n) && Object.is(e[n], t[n]));
|
|
373
382
|
}
|
|
374
|
-
function
|
|
383
|
+
function P(t, n) {
|
|
375
384
|
let r = { ...t };
|
|
376
385
|
for (let t of e) {
|
|
377
386
|
let e = n[t];
|
|
@@ -382,9 +391,9 @@ function N(t, n) {
|
|
|
382
391
|
"action"
|
|
383
392
|
].includes(t) ? delete r[t] : e !== void 0 && (r[t] = e);
|
|
384
393
|
}
|
|
385
|
-
return r.title === t.title && r.announcementPriority === t.announcementPriority && r.duration === t.duration &&
|
|
394
|
+
return r.title === t.title && r.announcementPriority === t.announcementPriority && r.duration === t.duration && c(r, "duration") === c(t, "duration") && r.attention === t.attention && Object.is(r.icon, t.icon) && c(r, "icon") === c(t, "icon") && N(r.description, t.description) && N(r.progress, t.progress) && N(r.action, t.action) ? t : M(r);
|
|
386
395
|
}
|
|
387
396
|
//#endregion
|
|
388
|
-
export {
|
|
397
|
+
export { M as copyContent, P as patchContent, T as validDelay, C as validateContent, E as validateOptions, S as validatePatch, x as validateSpec, w as validateTrackOptions };
|
|
389
398
|
|
|
390
399
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","names":["contentKeys","patchKeys","specKeys","messageKeys","fieldKeys","inputModes","noIssues","owns","at","path","key","issue","record","value","issues","hasAccessor","descriptor","keys","undefinedKeys","fields","rule","required","rules","own","data","forbidden","variant","description","progress","safeHref","href","colon","boundary","scheme","formFields","names","index","item","action","common","patch","validate","finish","validateSpec","validatePatch","validateContent","pending","validateTrackOptions","problem","isFactory","validDelay","validateOptions","options","messages","message","result","copyFields","copy","optional","copyDescription","copyProgress","copiedActions","copyAction","field","copyContent","content","equalData","left","right","patchContent","merged"],"sources":["../../src/core/validation.ts"],"sourcesContent":["import type { ControllerOptions } from '../contracts/controller.js';\nimport type { InputIssue } from '../contracts/identity.js';\nimport type {\n Description,\n NotificationContent,\n NotificationPatch,\n PrimaryAction,\n Progress,\n} from '../contracts/notifications.js';\n\nconst contentKeys = ['title', 'description', 'icon', 'progress', 'action', 'announcementPriority', 'duration', 'attention'];\nconst patchKeys = [...contentKeys, 'kind', 'priority'];\nconst specKeys = [...patchKeys, 'id', 'dedupeKey', 'onClose'];\nconst messageKeys = [\n 'operationSuccess', 'operationError', 'operationCancelled', 'cancellationRequested', 'actionError', 'renderError',\n 'fieldRequired', 'fieldTooLong',\n] as const;\nconst fieldKeys = ['name', 'kind', 'label', 'placeholder', 'defaultValue', 'required', 'maxLength', 'autoComplete', 'inputMode'];\nconst inputModes = ['text', 'email', 'numeric', 'decimal', 'tel', 'url', 'search'];\nconst noIssues: readonly InputIssue[] = Object.freeze([]);\nconst owns = Object.hasOwn;\nconst at = (path: string, key: PropertyKey): string => path ? `${path}.${String(key)}` : String(key);\n\nfunction issue(issues: InputIssue[], path: string, message: string): void {\n issues.push(Object.freeze({ path, message }));\n}\n\n/** Only Cloudlet-owned data records are inspected. Opaque slots are never passed here. */\nfunction record(\n value: unknown,\n path: string,\n keys: readonly string[],\n issues: InputIssue[],\n undefinedKeys: readonly string[] = [],\n): Record<string, unknown> | undefined {\n if (value === null || typeof value !== 'object' ||\n (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)) {\n issue(issues, path, 'Expected a plain object');\n return undefined;\n }\n let hasAccessor = false;\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== 'string' || !keys.includes(key)) {\n issue(issues, at(path, key), 'Unknown field');\n }\n if (descriptor && !('value' in descriptor)) {\n issue(issues, at(path, key), 'Expected a data property');\n hasAccessor = true;\n } else if (descriptor?.value === undefined &&\n (typeof key !== 'string' || !undefinedKeys.includes(key))) {\n issue(issues, at(path, key), 'Omit optional fields instead of passing undefined');\n }\n }\n return hasAccessor ? undefined : value as Record<string, unknown>;\n}\n\ntype Rule = 'string' | 'nonempty string' | 'function' | 'boolean' | readonly string[];\ntype Fields = readonly (readonly [key: string, rule: Rule, required?: boolean | 'own'])[];\n\n/** Optional undefined is already diagnosed by record; required fields still validate. */\nfunction fields(data: Record<string, unknown>, issues: InputIssue[], path: string, rules: Fields): void {\n for (const [key, rule, required] of rules) {\n const own = owns(data, key);\n if (!required && (!own || data[key] === undefined)) continue;\n const value = required === 'own' && !own ? undefined : data[key];\n const valid = typeof rule === 'string'\n ? rule === 'nonempty string' ? typeof value === 'string' && value.trim().length > 0 : typeof value === rule\n : typeof value === 'string' && rule.includes(value);\n if (!valid) issue(issues, at(path, key), typeof rule === 'string' ? `Expected a ${rule}` : `Expected one of: ${rule.join(', ')}`);\n }\n}\n\nfunction forbidden(data: Record<string, unknown>, issues: InputIssue[], path: string, keys: readonly string[], variant: string): void {\n for (const key of keys) if (owns(data, key)) issue(issues, at(path, key), `Field is not allowed for ${variant}`);\n}\n\nfunction description(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'description', ['kind', 'text', 'content', 'announcement'], issues, ['content']);\n if (!data) return;\n if (data.kind === 'text') {\n forbidden(data, issues, 'description', ['content', 'announcement'], 'a text description');\n fields(data, issues, 'description', [['text', 'string', 'own']]);\n } else if (data.kind === 'rich') {\n forbidden(data, issues, 'description', ['text'], 'a rich description');\n if (!owns(data, 'content')) issue(issues, 'description.content', 'Required field');\n fields(data, issues, 'description', [['announcement', 'nonempty string', 'own']]);\n } else fields(data, issues, 'description', [['kind', ['text', 'rich'], true]]);\n}\n\nfunction progress(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'progress', ['kind', 'value', 'label'], issues);\n if (!data) return;\n if (data.kind === 'determinate') {\n if (typeof data.value !== 'number' || !Number.isFinite(data.value) || data.value < 0 || data.value > 1) {\n issue(issues, 'progress.value', 'Expected a finite number between 0 and 1');\n }\n } else if (data.kind === 'indeterminate') forbidden(data, issues, 'progress', ['value'], 'indeterminate progress');\n else fields(data, issues, 'progress', [['kind', ['indeterminate', 'determinate'], true]]);\n fields(data, issues, 'progress', [['label', 'string']]);\n}\n\nfunction safeHref(value: string): boolean {\n // URL parsers strip controls before interpreting schemes; rejecting them prevents scheme obfuscation.\n if (/[\\u0000-\\u001f\\u007f]/u.test(value)) return false;\n const href = value.trim();\n const colon = href.indexOf(':');\n const boundary = href.search(/[/?#]/u);\n if (colon === -1 || (boundary !== -1 && boundary < colon)) return true;\n const scheme = href.slice(0, colon).toLowerCase();\n return ['http', 'https', 'mailto', 'tel'].includes(scheme);\n}\n\nfunction formFields(value: unknown, issues: InputIssue[]): void {\n if (!Array.isArray(value) || value.length < 1 || value.length > 3) {\n issue(issues, 'action.fields', 'Expected an array of one to three fields');\n return;\n }\n const names = new Set<unknown>();\n value.forEach((item: unknown, index) => {\n const path = `action.fields.${index}`;\n const data = record(item, path, fieldKeys, issues);\n if (!data) return;\n fields(data, issues, path, [\n ['name', 'nonempty string', true], ['kind', ['text', 'textarea'], true], ['label', 'nonempty string', true],\n ['placeholder', 'string'], ['defaultValue', 'string'], ['required', 'boolean'], ['autoComplete', 'string'],\n ['inputMode', inputModes],\n ]);\n if (names.has(data.name)) issue(issues, `${path}.name`, 'Field names must be unique');\n names.add(data.name);\n if (owns(data, 'maxLength') && data.maxLength !== undefined &&\n (typeof data.maxLength !== 'number' || !Number.isInteger(data.maxLength) || data.maxLength < 1)) {\n issue(issues, `${path}.maxLength`, 'Expected a positive integer');\n } else if (typeof data.maxLength === 'number' && typeof data.defaultValue === 'string' && data.defaultValue.length > data.maxLength) {\n issue(issues, `${path}.defaultValue`, 'Longer than maxLength');\n }\n });\n}\n\nfunction action(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'action', ['kind', 'label', 'run', 'errorMessage', 'href', 'target', 'rel', 'fields', 'validate'], issues);\n if (!data) return;\n fields(data, issues, 'action', [['label', 'nonempty string', true]]);\n if (data.kind === 'form') {\n forbidden(data, issues, 'action', ['href', 'target', 'rel'], 'a form action');\n fields(data, issues, 'action', [['run', 'function', true], ['errorMessage', 'function'], ['validate', 'function']]);\n formFields(data.fields, issues);\n return;\n }\n forbidden(data, issues, 'action', ['fields', 'validate'], `a ${data.kind === 'link' ? 'link' : 'command'} action`);\n if (data.kind === 'command') {\n forbidden(data, issues, 'action', ['href', 'target', 'rel'], 'a command action');\n fields(data, issues, 'action', [['run', 'function', true], ['errorMessage', 'function']]);\n } else if (data.kind === 'link') {\n forbidden(data, issues, 'action', ['run', 'errorMessage'], 'a link action');\n fields(data, issues, 'action', [['href', 'nonempty string', true]]);\n if (typeof data.href === 'string' && !safeHref(data.href)) issue(issues, 'action.href', 'Unsupported or unsafe URL');\n fields(data, issues, 'action', [['target', ['_self', '_blank', '_parent', '_top']], ['rel', 'string']]);\n } else fields(data, issues, 'action', [['kind', ['command', 'link', 'form'], true]]);\n}\n\nfunction common(data: Record<string, unknown>, issues: InputIssue[], patch: boolean): void {\n fields(data, issues, '', [\n ['title', 'nonempty string', !patch || owns(data, 'title')],\n ['kind', ['info', 'success', 'loading', 'warning', 'error']],\n ['priority', ['normal', 'high']], ['announcementPriority', ['polite', 'assertive', 'off']],\n ['attention', ['auto', 'open', 'stack']],\n ]);\n for (const [key, validate] of [['description', description], ['progress', progress], ['action', action]] as const) {\n if (owns(data, key) && data[key] !== undefined && !(patch && data[key] === null)) validate(data[key], issues);\n }\n if (owns(data, 'duration') && data.duration !== undefined && data.duration !== null &&\n (typeof data.duration !== 'number' || !Number.isFinite(data.duration) || data.duration < 0)) {\n issue(issues, 'duration', 'Expected null or a finite nonnegative duration');\n }\n}\n\nfunction finish(issues: InputIssue[]): readonly InputIssue[] {\n return issues.length === 0 ? noIssues : Object.freeze(issues);\n}\n\nexport function validateSpec(value: unknown): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', specKeys, issues);\n if (data) {\n common(data, issues, false);\n fields(data, issues, '', [['id', 'nonempty string'], ['dedupeKey', 'nonempty string'], ['onClose', 'function']]);\n }\n return finish(issues);\n}\n\nexport function validatePatch(value: unknown): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', patchKeys, issues);\n if (data) common(data, issues, true);\n return finish(issues);\n}\n\n/** Operation content cannot set identity, scheduling priority or notification kind. */\nexport function validateContent(value: unknown, pending = false): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', contentKeys, issues);\n if (data) {\n common(data, issues, false);\n if (pending && owns(data, 'duration')) issue(issues, 'duration', 'Pending content cannot define a duration');\n }\n return finish(issues);\n}\n\n/** Validate before copying or invoking user code; mapper output is validated separately. */\nexport function validateTrackOptions(value: unknown, isFactory: boolean): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', [\n 'id', 'priority', 'pending', 'success', 'error', 'cancelled', 'cancel', 'isCancellation', 'onClose',\n ], issues);\n if (!data) return finish(issues);\n fields(data, issues, '', [['id', 'nonempty string'], ['priority', ['normal', 'high']]]);\n for (const key of ['pending', 'success', 'error', 'cancelled'] as const) {\n if (key === 'cancelled' && !owns(data, key)) continue;\n if (key !== 'pending' && typeof data[key] === 'function') continue;\n for (const problem of validateContent(data[key], key === 'pending')) {\n issue(issues, problem.path ? `${key}.${problem.path}` : key, problem.message);\n }\n }\n fields(data, issues, '', [['cancel', 'function'], ['isCancellation', 'function'], ['onClose', 'function']]);\n if (isFactory && owns(data, 'cancel')) issue(issues, 'cancel', 'Factory cancellation uses its attempt signal');\n return finish(issues);\n}\n\n/** Attention delays are finite nonnegative milliseconds. */\nexport const validDelay = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value >= 0;\n\nexport function validateOptions(options: ControllerOptions | undefined): ControllerOptions {\n if (options === undefined) return Object.freeze({ autoDismiss: true });\n const issues: InputIssue[] = [];\n const data = record(options, '', ['autoDismiss', 'attentionDelay', 'messages', 'onOverflow', 'onDiagnostic'], issues);\n if (data) {\n fields(data, issues, '', [['autoDismiss', 'boolean'], ['onOverflow', 'function'], ['onDiagnostic', 'function']]);\n if (owns(data, 'attentionDelay') && data.attentionDelay !== undefined && typeof data.attentionDelay !== 'number') {\n issue(issues, 'attentionDelay', 'Expected a number');\n }\n if (owns(data, 'messages') && data.messages !== undefined) {\n const messages = record(data.messages, 'messages', messageKeys, issues);\n if (messages) fields(messages, issues, 'messages', messageKeys.map((key) => [key, 'string']));\n }\n }\n if (issues.length) throw new TypeError(issues.map(({ path, message }) => `${path || 'options'}: ${message}`).join('; '));\n if (options.attentionDelay !== undefined && !validDelay(options.attentionDelay)) {\n throw new RangeError('attentionDelay: Expected a finite nonnegative number of milliseconds');\n }\n const result: { -readonly [Key in keyof ControllerOptions]: ControllerOptions[Key] } = { autoDismiss: options.autoDismiss ?? true };\n if (options.attentionDelay !== undefined) result.attentionDelay = options.attentionDelay;\n if (options.messages !== undefined) {\n result.messages = copyFields(options.messages, [], messageKeys);\n }\n if (options.onOverflow !== undefined) result.onOverflow = options.onOverflow;\n if (options.onDiagnostic !== undefined) result.onDiagnostic = options.onDiagnostic;\n return Object.freeze(result);\n}\n\n/** Required fields retain undefined opaque slots; each variant has an explicit whitelist. */\nfunction copyFields<Value extends object>(value: Value, required: readonly (keyof Value)[], optional: readonly (keyof Value)[] = []): Value {\n const copy = {} as Value;\n for (const key of [...required, ...optional]) {\n const item = value[key];\n if (required.includes(key) || item !== undefined) copy[key] = item;\n }\n return Object.freeze(copy);\n}\n\nfunction copyDescription<Slot>(value: Description<Slot>): Description<Slot> {\n return value.kind === 'text' ? copyFields(value, ['kind', 'text']) : copyFields(value, ['kind', 'content', 'announcement']);\n}\n\nfunction copyProgress(value: Progress): Progress {\n return value.kind === 'indeterminate' ? copyFields(value, ['kind'], ['label']) : copyFields(value, ['kind', 'value'], ['label']);\n}\n\n// A patch that keeps the action passes its existing copy back; keeping that identity keeps a form's draft.\nconst copiedActions = new WeakSet<PrimaryAction>();\n\nfunction copyAction(value: PrimaryAction): PrimaryAction {\n if (copiedActions.has(value)) return value;\n const copy = value.kind === 'command' ? copyFields(value, ['kind', 'label', 'run'], ['errorMessage'])\n : value.kind === 'link' ? copyFields(value, ['kind', 'label', 'href'], ['target', 'rel'])\n : copyFields({ ...value, fields: Object.freeze(value.fields.map((field) => copyFields(field, ['name', 'kind', 'label'],\n ['placeholder', 'defaultValue', 'required', 'maxLength', 'autoComplete', 'inputMode']))) },\n ['kind', 'fields', 'label', 'run'], ['errorMessage', 'validate']);\n copiedActions.add(copy);\n return copy;\n}\n\ntype MutableContent<Slot> = { -readonly [Key in keyof NotificationContent<Slot>]: NotificationContent<Slot>[Key] };\n\n/** Call after validation. Copy only the library's structures, never the caller's opaque payloads. */\nexport function copyContent<Slot>(content: NotificationContent<Slot>): Readonly<NotificationContent<Slot>> {\n const copy: MutableContent<Slot> = { title: content.title, announcementPriority: content.announcementPriority ?? 'polite' };\n if (content.description !== undefined) copy.description = copyDescription(content.description);\n if (owns(content, 'icon')) copy.icon = content.icon as Slot;\n if (content.progress !== undefined) copy.progress = copyProgress(content.progress);\n if (content.action !== undefined) copy.action = copyAction(content.action);\n if (content.duration !== undefined) copy.duration = content.duration;\n if (content.attention !== undefined) copy.attention = content.attention;\n return Object.freeze(copy);\n}\n\nfunction equalData(left: object | undefined, right: object | undefined): boolean {\n if (left === right) return true;\n if (!left || !right) return false;\n const keys = Object.keys(left);\n return keys.length === Object.keys(right).length && keys.every((key) =>\n owns(right, key) && Object.is((left as Record<string, unknown>)[key], (right as Record<string, unknown>)[key]));\n}\n\n/** Kind and priority belong to the record; this helper changes only presentation content. */\nexport function patchContent<Slot>(\n content: Readonly<NotificationContent<Slot>>,\n patch: NotificationPatch<Slot>,\n): Readonly<NotificationContent<Slot>> {\n const merged: MutableContent<Slot> = { ...content };\n for (const key of contentKeys as readonly (keyof NotificationContent<Slot>)[]) {\n const value = patch[key];\n if (value === null && ['description', 'icon', 'progress', 'action'].includes(key)) delete merged[key];\n // Fields are copied between the matching keys of these validated shapes.\n else if (value !== undefined) (merged as Record<string, unknown>)[key] = value;\n }\n if (merged.title === content.title && merged.announcementPriority === content.announcementPriority &&\n merged.duration === content.duration && owns(merged, 'duration') === owns(content, 'duration') &&\n merged.attention === content.attention &&\n Object.is(merged.icon, content.icon) && owns(merged, 'icon') === owns(content, 'icon') &&\n equalData(merged.description, content.description) && equalData(merged.progress, content.progress) &&\n equalData(merged.action, content.action)) return content;\n return copyContent(merged);\n}\n"],"mappings":";AAUA,IAAMA,IAAc;CAAC;CAAS;CAAe;CAAQ;CAAY;CAAU;CAAwB;CAAY;AAAW,GACpHC,IAAY;CAAC,GAAGD;CAAa;CAAQ;AAAU,GAC/CE,IAAW;CAAC,GAAGD;CAAW;CAAM;CAAa;AAAS,GACtDE,IAAc;CAClB;CAAoB;CAAkB;CAAsB;CAAyB;CAAe;CACpG;CAAiB;AACnB,GACMC,IAAY;CAAC;CAAQ;CAAQ;CAAS;CAAe;CAAgB;CAAY;CAAa;CAAgB;AAAW,GACzHC,IAAa;CAAC;CAAQ;CAAS;CAAW;CAAW;CAAO;CAAO;AAAQ,GAC3EC,IAAkC,OAAO,OAAO,CAAC,CAAC,GAClDC,IAAO,OAAO,QACdC,KAAM,GAAc,MAA6BC,IAAO,GAAGA,EAAK,GAAG,OAAOC,CAAG,MAAM,OAAOA,CAAG;AAEnG,SAASC,EAAM,GAAsB,GAAc,GAAuB;CACxE,EAAO,KAAK,OAAO,OAAO;EAAE;EAAM;CAAQ,CAAC,CAAC;AAC9C;AAGA,SAASC,EACP,GACA,GACA,GACA,GACA,IAAmC,CAAC,GACC;CACrC,IAAsB,OAAOC,KAAU,aAAnCA,KACC,OAAO,eAAeA,CAAK,MAAM,OAAO,aAAa,OAAO,eAAeA,CAAK,MAAM,MAAO;EAChG,EAAMC,GAAQL,GAAM,yBAAyB;EAC7C;CACF;CACA,IAAIM,IAAc;CAClB,KAAK,IAAML,KAAO,QAAQ,QAAQG,CAAK,GAAG;EACxC,IAAMG,IAAa,OAAO,yBAAyBH,GAAOH,CAAG;EAI7D,CAHI,OAAOA,KAAQ,YAAY,CAACO,EAAK,SAASP,CAAG,MAC/CC,EAAMG,GAAQN,EAAGC,GAAMC,CAAG,GAAG,eAAe,GAE1C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CAClD,KAAK,IAAMvD,KAAOV,GAA6D;EAC7E,IAAMa,IAAQ2B,EAAM9B;EACpB,AAAIG,MAAU,QAAQ;GAAC;GAAe;GAAQ;GAAY;EAAQ,CAAC,CAAC,SAASH,CAAG,IAAG,OAAO4D,EAAO5D,KAExFG,MAAU,KAAA,MAAW,EAAoCH,KAAOG;CAC3E;CAOA,OANIyD,EAAO,UAAUL,EAAQ,SAASK,EAAO,yBAAyBL,EAAQ,wBAC1EK,EAAO,aAAaL,EAAQ,YAAY1D,EAAK+D,GAAQ,UAAU,MAAM/D,EAAK0D,GAAS,UAAU,KAC7FK,EAAO,cAAcL,EAAQ,aAC7B,OAAO,GAAGK,EAAO,MAAML,EAAQ,IAAI,KAAK1D,EAAK+D,GAAQ,MAAM,MAAM/D,EAAK0D,GAAS,MAAM,KACrFC,EAAUI,EAAO,aAAaL,EAAQ,WAAW,KAAKC,EAAUI,EAAO,UAAUL,EAAQ,QAAQ,KACjGC,EAAUI,EAAO,QAAQL,EAAQ,MAAM,IAAUA,IAC9CD,EAAYM,CAAM;AAC3B"}
|
|
1
|
+
{"version":3,"file":"validation.js","names":["contentKeys","patchKeys","specKeys","messageKeys","fieldKeys","inputModes","agentPermissions","noIssues","owns","at","path","key","issue","record","value","issues","hasAccessor","descriptor","keys","undefinedKeys","fields","rule","required","rules","own","data","forbidden","variant","description","progress","safeHref","href","colon","boundary","scheme","formFields","names","index","item","action","common","patch","validate","finish","validateSpec","validatePatch","validateContent","pending","validateTrackOptions","problem","isFactory","validDelay","validateOptions","options","messages","message","result","copyFields","copy","optional","copyDescription","copyProgress","copiedActions","copyAction","field","copyContent","content","equalData","left","right","patchContent","merged"],"sources":["../../src/core/validation.ts"],"sourcesContent":["import type { ControllerOptions } from '../contracts/controller.js';\nimport type { InputIssue } from '../contracts/identity.js';\nimport type {\n Description,\n NotificationContent,\n NotificationPatch,\n PrimaryAction,\n Progress,\n} from '../contracts/notifications.js';\n\nconst contentKeys = ['title', 'description', 'icon', 'progress', 'action', 'announcementPriority', 'duration', 'attention'];\nconst patchKeys = [...contentKeys, 'kind', 'priority'];\nconst specKeys = [...patchKeys, 'id', 'dedupeKey', 'onClose'];\nconst messageKeys = [\n 'operationSuccess', 'operationError', 'operationCancelled', 'cancellationRequested', 'actionError', 'renderError',\n 'fieldRequired', 'fieldTooLong',\n] as const;\nconst fieldKeys = ['name', 'kind', 'label', 'placeholder', 'defaultValue', 'required', 'maxLength', 'autoComplete', 'inputMode'];\nconst inputModes = ['text', 'email', 'numeric', 'decimal', 'tel', 'url', 'search'];\nconst agentPermissions = ['allow', 'confirm', 'deny'] as const;\nconst noIssues: readonly InputIssue[] = Object.freeze([]);\nconst owns = Object.hasOwn;\nconst at = (path: string, key: PropertyKey): string => path ? `${path}.${String(key)}` : String(key);\n\nfunction issue(issues: InputIssue[], path: string, message: string): void {\n issues.push(Object.freeze({ path, message }));\n}\n\n/** Only Cloudlet-owned data records are inspected. Opaque slots are never passed here. */\nfunction record(\n value: unknown,\n path: string,\n keys: readonly string[],\n issues: InputIssue[],\n undefinedKeys: readonly string[] = [],\n): Record<string, unknown> | undefined {\n if (value === null || typeof value !== 'object' ||\n (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)) {\n issue(issues, path, 'Expected a plain object');\n return undefined;\n }\n let hasAccessor = false;\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== 'string' || !keys.includes(key)) {\n issue(issues, at(path, key), 'Unknown field');\n }\n if (descriptor && !('value' in descriptor)) {\n issue(issues, at(path, key), 'Expected a data property');\n hasAccessor = true;\n } else if (descriptor?.value === undefined &&\n (typeof key !== 'string' || !undefinedKeys.includes(key))) {\n issue(issues, at(path, key), 'Omit optional fields instead of passing undefined');\n }\n }\n return hasAccessor ? undefined : value as Record<string, unknown>;\n}\n\ntype Rule = 'string' | 'nonempty string' | 'function' | 'boolean' | readonly string[];\ntype Fields = readonly (readonly [key: string, rule: Rule, required?: boolean | 'own'])[];\n\n/** Optional undefined is already diagnosed by record; required fields still validate. */\nfunction fields(data: Record<string, unknown>, issues: InputIssue[], path: string, rules: Fields): void {\n for (const [key, rule, required] of rules) {\n const own = owns(data, key);\n if (!required && (!own || data[key] === undefined)) continue;\n const value = required === 'own' && !own ? undefined : data[key];\n const valid = typeof rule === 'string'\n ? rule === 'nonempty string' ? typeof value === 'string' && value.trim().length > 0 : typeof value === rule\n : typeof value === 'string' && rule.includes(value);\n if (!valid) issue(issues, at(path, key), typeof rule === 'string' ? `Expected a ${rule}` : `Expected one of: ${rule.join(', ')}`);\n }\n}\n\nfunction forbidden(data: Record<string, unknown>, issues: InputIssue[], path: string, keys: readonly string[], variant: string): void {\n for (const key of keys) if (owns(data, key)) issue(issues, at(path, key), `Field is not allowed for ${variant}`);\n}\n\nfunction description(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'description', ['kind', 'text', 'content', 'announcement'], issues, ['content']);\n if (!data) return;\n if (data.kind === 'text') {\n forbidden(data, issues, 'description', ['content', 'announcement'], 'a text description');\n fields(data, issues, 'description', [['text', 'string', 'own']]);\n } else if (data.kind === 'rich') {\n forbidden(data, issues, 'description', ['text'], 'a rich description');\n if (!owns(data, 'content')) issue(issues, 'description.content', 'Required field');\n fields(data, issues, 'description', [['announcement', 'nonempty string', 'own']]);\n } else fields(data, issues, 'description', [['kind', ['text', 'rich'], true]]);\n}\n\nfunction progress(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'progress', ['kind', 'value', 'label'], issues);\n if (!data) return;\n if (data.kind === 'determinate') {\n if (typeof data.value !== 'number' || !Number.isFinite(data.value) || data.value < 0 || data.value > 1) {\n issue(issues, 'progress.value', 'Expected a finite number between 0 and 1');\n }\n } else if (data.kind === 'indeterminate') forbidden(data, issues, 'progress', ['value'], 'indeterminate progress');\n else fields(data, issues, 'progress', [['kind', ['indeterminate', 'determinate'], true]]);\n fields(data, issues, 'progress', [['label', 'string']]);\n}\n\nfunction safeHref(value: string): boolean {\n // URL parsers strip controls before interpreting schemes; rejecting them prevents scheme obfuscation.\n if (/[\\u0000-\\u001f\\u007f]/u.test(value)) return false;\n const href = value.trim();\n const colon = href.indexOf(':');\n const boundary = href.search(/[/?#]/u);\n if (colon === -1 || (boundary !== -1 && boundary < colon)) return true;\n const scheme = href.slice(0, colon).toLowerCase();\n return ['http', 'https', 'mailto', 'tel'].includes(scheme);\n}\n\nfunction formFields(value: unknown, issues: InputIssue[]): void {\n if (!Array.isArray(value) || value.length < 1 || value.length > 3) {\n issue(issues, 'action.fields', 'Expected an array of one to three fields');\n return;\n }\n const names = new Set<unknown>();\n value.forEach((item: unknown, index) => {\n const path = `action.fields.${index}`;\n const data = record(item, path, fieldKeys, issues);\n if (!data) return;\n fields(data, issues, path, [\n ['name', 'nonempty string', true], ['kind', ['text', 'textarea'], true], ['label', 'nonempty string', true],\n ['placeholder', 'string'], ['defaultValue', 'string'], ['required', 'boolean'], ['autoComplete', 'string'],\n ['inputMode', inputModes],\n ]);\n if (names.has(data.name)) issue(issues, `${path}.name`, 'Field names must be unique');\n names.add(data.name);\n if (owns(data, 'maxLength') && data.maxLength !== undefined &&\n (typeof data.maxLength !== 'number' || !Number.isInteger(data.maxLength) || data.maxLength < 1)) {\n issue(issues, `${path}.maxLength`, 'Expected a positive integer');\n } else if (typeof data.maxLength === 'number' && typeof data.defaultValue === 'string' && data.defaultValue.length > data.maxLength) {\n issue(issues, `${path}.defaultValue`, 'Longer than maxLength');\n }\n });\n}\n\nfunction action(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'action', ['kind', 'label', 'run', 'errorMessage', 'href', 'target', 'rel', 'fields', 'validate', 'agent'], issues);\n if (!data) return;\n fields(data, issues, 'action', [['label', 'nonempty string', true]]);\n if (data.kind === 'link') forbidden(data, issues, 'action', ['agent'], 'a link action');\n else if (data.kind === 'command' || data.kind === 'form') fields(data, issues, 'action', [['agent', agentPermissions]]);\n if (data.kind === 'form') {\n forbidden(data, issues, 'action', ['href', 'target', 'rel'], 'a form action');\n fields(data, issues, 'action', [['run', 'function', true], ['errorMessage', 'function'], ['validate', 'function']]);\n formFields(data.fields, issues);\n return;\n }\n forbidden(data, issues, 'action', ['fields', 'validate'], `a ${data.kind === 'link' ? 'link' : 'command'} action`);\n if (data.kind === 'command') {\n forbidden(data, issues, 'action', ['href', 'target', 'rel'], 'a command action');\n fields(data, issues, 'action', [['run', 'function', true], ['errorMessage', 'function']]);\n } else if (data.kind === 'link') {\n forbidden(data, issues, 'action', ['run', 'errorMessage'], 'a link action');\n fields(data, issues, 'action', [['href', 'nonempty string', true]]);\n if (typeof data.href === 'string' && !safeHref(data.href)) issue(issues, 'action.href', 'Unsupported or unsafe URL');\n fields(data, issues, 'action', [['target', ['_self', '_blank', '_parent', '_top']], ['rel', 'string']]);\n } else fields(data, issues, 'action', [['kind', ['command', 'link', 'form'], true]]);\n}\n\nfunction common(data: Record<string, unknown>, issues: InputIssue[], patch: boolean): void {\n fields(data, issues, '', [\n ['title', 'nonempty string', !patch || owns(data, 'title')],\n ['kind', ['info', 'success', 'loading', 'warning', 'error']],\n ['priority', ['normal', 'high']], ['announcementPriority', ['polite', 'assertive', 'off']],\n ['attention', ['auto', 'open', 'stack']],\n ]);\n for (const [key, validate] of [['description', description], ['progress', progress], ['action', action]] as const) {\n if (owns(data, key) && data[key] !== undefined && !(patch && data[key] === null)) validate(data[key], issues);\n }\n if (owns(data, 'duration') && data.duration !== undefined && data.duration !== null &&\n (typeof data.duration !== 'number' || !Number.isFinite(data.duration) || data.duration < 0)) {\n issue(issues, 'duration', 'Expected null or a finite nonnegative duration');\n }\n}\n\nfunction finish(issues: InputIssue[]): readonly InputIssue[] {\n return issues.length === 0 ? noIssues : Object.freeze(issues);\n}\n\nexport function validateSpec(value: unknown): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', specKeys, issues);\n if (data) {\n common(data, issues, false);\n fields(data, issues, '', [['id', 'nonempty string'], ['dedupeKey', 'nonempty string'], ['onClose', 'function']]);\n }\n return finish(issues);\n}\n\nexport function validatePatch(value: unknown): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', patchKeys, issues);\n if (data) common(data, issues, true);\n return finish(issues);\n}\n\n/** Operation content cannot set identity, scheduling priority or notification kind. */\nexport function validateContent(value: unknown, pending = false): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', contentKeys, issues);\n if (data) {\n common(data, issues, false);\n if (pending && owns(data, 'duration')) issue(issues, 'duration', 'Pending content cannot define a duration');\n }\n return finish(issues);\n}\n\n/** Validate before copying or invoking user code; mapper output is validated separately. */\nexport function validateTrackOptions(value: unknown, isFactory: boolean): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', [\n 'id', 'priority', 'pending', 'success', 'error', 'cancelled', 'cancel', 'isCancellation', 'onClose',\n ], issues);\n if (!data) return finish(issues);\n fields(data, issues, '', [['id', 'nonempty string'], ['priority', ['normal', 'high']]]);\n for (const key of ['pending', 'success', 'error', 'cancelled'] as const) {\n if (key === 'cancelled' && !owns(data, key)) continue;\n if (key !== 'pending' && typeof data[key] === 'function') continue;\n for (const problem of validateContent(data[key], key === 'pending')) {\n issue(issues, problem.path ? `${key}.${problem.path}` : key, problem.message);\n }\n }\n fields(data, issues, '', [['cancel', 'function'], ['isCancellation', 'function'], ['onClose', 'function']]);\n if (isFactory && owns(data, 'cancel')) issue(issues, 'cancel', 'Factory cancellation uses its attempt signal');\n return finish(issues);\n}\n\n/** Attention delays are finite nonnegative milliseconds. */\nexport const validDelay = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value >= 0;\n\nexport function validateOptions(options: ControllerOptions | undefined): ControllerOptions {\n if (options === undefined) return Object.freeze({ autoDismiss: true });\n const issues: InputIssue[] = [];\n const data = record(options, '', ['autoDismiss', 'attentionDelay', 'messages', 'onOverflow', 'onDiagnostic'], issues);\n if (data) {\n fields(data, issues, '', [['autoDismiss', 'boolean'], ['onOverflow', 'function'], ['onDiagnostic', 'function']]);\n if (owns(data, 'attentionDelay') && data.attentionDelay !== undefined && typeof data.attentionDelay !== 'number') {\n issue(issues, 'attentionDelay', 'Expected a number');\n }\n if (owns(data, 'messages') && data.messages !== undefined) {\n const messages = record(data.messages, 'messages', messageKeys, issues);\n if (messages) fields(messages, issues, 'messages', messageKeys.map((key) => [key, 'string']));\n }\n }\n if (issues.length) throw new TypeError(issues.map(({ path, message }) => `${path || 'options'}: ${message}`).join('; '));\n if (options.attentionDelay !== undefined && !validDelay(options.attentionDelay)) {\n throw new RangeError('attentionDelay: Expected a finite nonnegative number of milliseconds');\n }\n const result: { -readonly [Key in keyof ControllerOptions]: ControllerOptions[Key] } = { autoDismiss: options.autoDismiss ?? true };\n if (options.attentionDelay !== undefined) result.attentionDelay = options.attentionDelay;\n if (options.messages !== undefined) {\n result.messages = copyFields(options.messages, [], messageKeys);\n }\n if (options.onOverflow !== undefined) result.onOverflow = options.onOverflow;\n if (options.onDiagnostic !== undefined) result.onDiagnostic = options.onDiagnostic;\n return Object.freeze(result);\n}\n\n/** Required fields retain undefined opaque slots; each variant has an explicit whitelist. */\nfunction copyFields<Value extends object>(value: Value, required: readonly (keyof Value)[], optional: readonly (keyof Value)[] = []): Value {\n const copy = {} as Value;\n for (const key of [...required, ...optional]) {\n const item = value[key];\n if (required.includes(key) || item !== undefined) copy[key] = item;\n }\n return Object.freeze(copy);\n}\n\nfunction copyDescription<Slot>(value: Description<Slot>): Description<Slot> {\n return value.kind === 'text' ? copyFields(value, ['kind', 'text']) : copyFields(value, ['kind', 'content', 'announcement']);\n}\n\nfunction copyProgress(value: Progress): Progress {\n return value.kind === 'indeterminate' ? copyFields(value, ['kind'], ['label']) : copyFields(value, ['kind', 'value'], ['label']);\n}\n\n// A patch that keeps the action passes its existing copy back; keeping that identity keeps a form's draft.\nconst copiedActions = new WeakSet<PrimaryAction>();\n\nfunction copyAction(value: PrimaryAction): PrimaryAction {\n if (copiedActions.has(value)) return value;\n const copy = value.kind === 'command' ? copyFields(value, ['kind', 'label', 'run'], ['errorMessage', 'agent'])\n : value.kind === 'link' ? copyFields(value, ['kind', 'label', 'href'], ['target', 'rel'])\n : copyFields({ ...value, fields: Object.freeze(value.fields.map((field) => copyFields(field, ['name', 'kind', 'label'],\n ['placeholder', 'defaultValue', 'required', 'maxLength', 'autoComplete', 'inputMode']))) },\n ['kind', 'fields', 'label', 'run'], ['errorMessage', 'validate', 'agent']);\n copiedActions.add(copy);\n return copy;\n}\n\ntype MutableContent<Slot> = { -readonly [Key in keyof NotificationContent<Slot>]: NotificationContent<Slot>[Key] };\n\n/** Call after validation. Copy only the library's structures, never the caller's opaque payloads. */\nexport function copyContent<Slot>(content: NotificationContent<Slot>): Readonly<NotificationContent<Slot>> {\n const copy: MutableContent<Slot> = { title: content.title, announcementPriority: content.announcementPriority ?? 'polite' };\n if (content.description !== undefined) copy.description = copyDescription(content.description);\n if (owns(content, 'icon')) copy.icon = content.icon as Slot;\n if (content.progress !== undefined) copy.progress = copyProgress(content.progress);\n if (content.action !== undefined) copy.action = copyAction(content.action);\n if (content.duration !== undefined) copy.duration = content.duration;\n if (content.attention !== undefined) copy.attention = content.attention;\n return Object.freeze(copy);\n}\n\nfunction equalData(left: object | undefined, right: object | undefined): boolean {\n if (left === right) return true;\n if (!left || !right) return false;\n const keys = Object.keys(left);\n return keys.length === Object.keys(right).length && keys.every((key) =>\n owns(right, key) && Object.is((left as Record<string, unknown>)[key], (right as Record<string, unknown>)[key]));\n}\n\n/** Kind and priority belong to the record; this helper changes only presentation content. */\nexport function patchContent<Slot>(\n content: Readonly<NotificationContent<Slot>>,\n patch: NotificationPatch<Slot>,\n): Readonly<NotificationContent<Slot>> {\n const merged: MutableContent<Slot> = { ...content };\n for (const key of contentKeys as readonly (keyof NotificationContent<Slot>)[]) {\n const value = patch[key];\n if (value === null && ['description', 'icon', 'progress', 'action'].includes(key)) delete merged[key];\n // Fields are copied between the matching keys of these validated shapes.\n else if (value !== undefined) (merged as Record<string, unknown>)[key] = value;\n }\n if (merged.title === content.title && merged.announcementPriority === content.announcementPriority &&\n merged.duration === content.duration && owns(merged, 'duration') === owns(content, 'duration') &&\n merged.attention === content.attention &&\n Object.is(merged.icon, content.icon) && owns(merged, 'icon') === owns(content, 'icon') &&\n equalData(merged.description, content.description) && equalData(merged.progress, content.progress) &&\n equalData(merged.action, content.action)) return content;\n return copyContent(merged);\n}\n"],"mappings":";AAUA,IAAMA,IAAc;CAAC;CAAS;CAAe;CAAQ;CAAY;CAAU;CAAwB;CAAY;AAAW,GACpHC,IAAY;CAAC,GAAGD;CAAa;CAAQ;AAAU,GAC/CE,IAAW;CAAC,GAAGD;CAAW;CAAM;CAAa;AAAS,GACtDE,IAAc;CAClB;CAAoB;CAAkB;CAAsB;CAAyB;CAAe;CACpG;CAAiB;AACnB,GACMC,IAAY;CAAC;CAAQ;CAAQ;CAAS;CAAe;CAAgB;CAAY;CAAa;CAAgB;AAAW,GACzHC,IAAa;CAAC;CAAQ;CAAS;CAAW;CAAW;CAAO;CAAO;AAAQ,GAC3EC,IAAmB;CAAC;CAAS;CAAW;AAAM,GAC9CC,IAAkC,OAAO,OAAO,CAAC,CAAC,GAClDC,IAAO,OAAO,QACdC,KAAM,GAAc,MAA6BC,IAAO,GAAGA,EAAK,GAAG,OAAOC,CAAG,MAAM,OAAOA,CAAG;AAEnG,SAASC,EAAM,GAAsB,GAAc,GAAuB;CACxE,EAAO,KAAK,OAAO,OAAO;EAAE;EAAM;CAAQ,CAAC,CAAC;AAC9C;AAGA,SAASC,EACP,GACA,GACA,GACA,GACA,IAAmC,CAAC,GACC;CACrC,IAAsB,OAAOC,KAAU,aAAnCA,KACC,OAAO,eAAeA,CAAK,MAAM,OAAO,aAAa,OAAO,eAAeA,CAAK,MAAM,MAAO;EAChG,EAAMC,GAAQL,GAAM,yBAAyB;EAC7C;CACF;CACA,IAAIM,IAAc;CAClB,KAAK,IAAML,KAAO,QAAQ,QAAQG,CAAK,GAAG;EACxC,IAAMG,IA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,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,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACjG,YAAY,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAChI,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;IAAC,OAAO,EAAE,MAAM,CAAC;CACjJ,+BAkCA;AAmFD,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,IAAI,+BAEvF"}
|
package/dist/react/card.js
CHANGED
|
@@ -315,14 +315,14 @@ function D({ action: e, draft: t, notification: n, bridge: a, lease: c, part: l,
|
|
|
315
315
|
if (h) return;
|
|
316
316
|
let t = a.invokeAction(c, n.handle);
|
|
317
317
|
if (t.status !== "invalid") return;
|
|
318
|
-
let r = e.fields.find((e) => t.errors.fields
|
|
318
|
+
let r = e.fields.find((e) => Object.hasOwn(t.errors.fields, e.name));
|
|
319
319
|
r && m.current.get(r.name)?.focus();
|
|
320
320
|
}, y = (r, i, u) => {
|
|
321
|
-
let y = `${p}-${i}`, b = t.errors.fields[r.name], x = {
|
|
321
|
+
let y = `${p}-${i}`, b = Object.hasOwn(t.errors.fields, r.name) ? t.errors.fields[r.name] : void 0, x = {
|
|
322
322
|
id: y,
|
|
323
323
|
name: r.name,
|
|
324
324
|
className: l("field", "cloudlet-field"),
|
|
325
|
-
defaultValue: t.values[r.name]
|
|
325
|
+
defaultValue: Object.hasOwn(t.values, r.name) ? t.values[r.name] : "",
|
|
326
326
|
placeholder: r.placeholder ?? r.label,
|
|
327
327
|
required: r.required,
|
|
328
328
|
maxLength: r.maxLength,
|