@cloudlet/toast 1.0.0-rc.3 → 1.1.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 +84 -16
- package/README.md +7 -5
- package/dist/contracts/controller.d.ts +7 -2
- package/dist/contracts/controller.d.ts.map +1 -1
- package/dist/contracts/events.d.ts +1 -1
- package/dist/contracts/events.d.ts.map +1 -1
- package/dist/contracts/internal.d.ts +23 -0
- package/dist/contracts/internal.d.ts.map +1 -1
- package/dist/contracts/notifications.d.ts +38 -6
- package/dist/contracts/notifications.d.ts.map +1 -1
- package/dist/contracts/snapshots.d.ts +3 -1
- package/dist/contracts/snapshots.d.ts.map +1 -1
- package/dist/core/bridge.d.ts +5 -0
- package/dist/core/bridge.d.ts.map +1 -0
- package/dist/core/bridge.js +345 -0
- package/dist/core/bridge.js.map +1 -0
- package/dist/core/controller.d.ts +122 -3
- package/dist/core/controller.d.ts.map +1 -1
- package/dist/core/controller.js +400 -541
- package/dist/core/controller.js.map +1 -1
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +181 -89
- package/dist/core/validation.js.map +1 -1
- package/dist/react/announcer.d.ts.map +1 -1
- package/dist/react/announcer.js +29 -23
- package/dist/react/announcer.js.map +1 -1
- package/dist/react/bindings.d.ts +9 -0
- package/dist/react/bindings.d.ts.map +1 -1
- package/dist/react/bindings.js +32 -69
- package/dist/react/bindings.js.map +1 -1
- package/dist/react/card.d.ts +5 -3
- package/dist/react/card.d.ts.map +1 -1
- package/dist/react/card.js +146 -34
- package/dist/react/card.js.map +1 -1
- package/dist/react/generators.d.ts +2 -2
- package/dist/react/generators.js.map +1 -1
- package/dist/react/gestures.js.map +1 -1
- package/dist/react/host.d.ts.map +1 -1
- package/dist/react/host.js +9 -5
- package/dist/react/host.js.map +1 -1
- package/dist/react/motion.d.ts +3 -3
- package/dist/react/motion.js.map +1 -1
- package/dist/react/plan.d.ts +1 -1
- package/dist/react/plan.d.ts.map +1 -1
- package/dist/react/plan.js +1 -0
- package/dist/react/plan.js.map +1 -1
- 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.d.ts +7 -5
- package/dist/react.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -2
- package/src/contracts/controller.ts +7 -2
- package/src/contracts/events.ts +2 -1
- package/src/contracts/internal.ts +20 -0
- package/src/contracts/notifications.ts +45 -6
- package/src/contracts/snapshots.ts +3 -0
- package/src/core/bridge.ts +336 -0
- package/src/core/controller.ts +118 -271
- package/src/core/validation.ts +49 -4
- package/src/react/announcer.ts +9 -0
- package/src/react/bindings.tsx +28 -72
- package/src/react/card.tsx +92 -9
- package/src/react/generators.ts +2 -2
- package/src/react/gestures.ts +1 -1
- package/src/react/host.tsx +22 -7
- package/src/react/motion.ts +4 -4
- package/src/react/plan.ts +4 -3
- package/src/react/renderer.tsx +77 -0
- package/src/react.ts +7 -5
package/dist/core/validation.js
CHANGED
|
@@ -23,71 +23,91 @@ var e = [
|
|
|
23
23
|
"operationCancelled",
|
|
24
24
|
"cancellationRequested",
|
|
25
25
|
"actionError",
|
|
26
|
-
"renderError"
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
"renderError",
|
|
27
|
+
"fieldRequired",
|
|
28
|
+
"fieldTooLong"
|
|
29
|
+
], i = [
|
|
30
|
+
"name",
|
|
31
|
+
"kind",
|
|
32
|
+
"label",
|
|
33
|
+
"placeholder",
|
|
34
|
+
"defaultValue",
|
|
35
|
+
"required",
|
|
36
|
+
"maxLength",
|
|
37
|
+
"autoComplete",
|
|
38
|
+
"inputMode"
|
|
39
|
+
], a = [
|
|
40
|
+
"text",
|
|
41
|
+
"email",
|
|
42
|
+
"numeric",
|
|
43
|
+
"decimal",
|
|
44
|
+
"tel",
|
|
45
|
+
"url",
|
|
46
|
+
"search"
|
|
47
|
+
], o = Object.freeze([]), s = Object.hasOwn, c = (e, t) => e ? `${e}.${String(t)}` : String(t);
|
|
48
|
+
function l(e, t, n) {
|
|
29
49
|
e.push(Object.freeze({
|
|
30
50
|
path: t,
|
|
31
51
|
message: n
|
|
32
52
|
}));
|
|
33
53
|
}
|
|
34
|
-
function
|
|
54
|
+
function u(e, t, n, r, i = []) {
|
|
35
55
|
if (typeof e != "object" || !e || Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null) {
|
|
36
|
-
|
|
56
|
+
l(r, t, "Expected a plain object");
|
|
37
57
|
return;
|
|
38
58
|
}
|
|
39
59
|
let a = !1;
|
|
40
|
-
for (let
|
|
41
|
-
let
|
|
42
|
-
(typeof
|
|
60
|
+
for (let o of Reflect.ownKeys(e)) {
|
|
61
|
+
let s = Object.getOwnPropertyDescriptor(e, o);
|
|
62
|
+
(typeof o != "string" || !n.includes(o)) && l(r, c(t, o), "Unknown field"), s && !("value" in s) ? (l(r, c(t, o), "Expected a data property"), a = !0) : s?.value === void 0 && (typeof o != "string" || !i.includes(o)) && l(r, c(t, o), "Omit optional fields instead of passing undefined");
|
|
43
63
|
}
|
|
44
64
|
return a ? void 0 : e;
|
|
45
65
|
}
|
|
46
|
-
function
|
|
47
|
-
for (let [i,
|
|
48
|
-
let r =
|
|
49
|
-
if (!
|
|
50
|
-
let u =
|
|
51
|
-
(typeof
|
|
66
|
+
function d(e, t, n, r) {
|
|
67
|
+
for (let [i, a, o] of r) {
|
|
68
|
+
let r = s(e, i);
|
|
69
|
+
if (!o && (!r || e[i] === void 0)) continue;
|
|
70
|
+
let u = o === "own" && !r ? void 0 : e[i];
|
|
71
|
+
(typeof a == "string" ? a === "nonempty string" ? typeof u == "string" && u.trim().length > 0 : typeof u === a : typeof u == "string" && a.includes(u)) || l(t, c(n, i), typeof a == "string" ? `Expected a ${a}` : `Expected one of: ${a.join(", ")}`);
|
|
52
72
|
}
|
|
53
73
|
}
|
|
54
|
-
function
|
|
55
|
-
for (let
|
|
74
|
+
function f(e, t, n, r, i) {
|
|
75
|
+
for (let a of r) s(e, a) && l(t, c(n, a), `Field is not allowed for ${i}`);
|
|
56
76
|
}
|
|
57
|
-
function
|
|
58
|
-
let n =
|
|
77
|
+
function p(e, t) {
|
|
78
|
+
let n = u(e, "description", [
|
|
59
79
|
"kind",
|
|
60
80
|
"text",
|
|
61
81
|
"content",
|
|
62
82
|
"announcement"
|
|
63
83
|
], t, ["content"]);
|
|
64
|
-
n && (n.kind === "text" ? (
|
|
84
|
+
n && (n.kind === "text" ? (f(n, t, "description", ["content", "announcement"], "a text description"), d(n, t, "description", [[
|
|
65
85
|
"text",
|
|
66
86
|
"string",
|
|
67
87
|
"own"
|
|
68
|
-
]])) : n.kind === "rich" ? (
|
|
88
|
+
]])) : n.kind === "rich" ? (f(n, t, "description", ["text"], "a rich description"), s(n, "content") || l(t, "description.content", "Required field"), d(n, t, "description", [[
|
|
69
89
|
"announcement",
|
|
70
90
|
"nonempty string",
|
|
71
91
|
"own"
|
|
72
|
-
]])) :
|
|
92
|
+
]])) : d(n, t, "description", [[
|
|
73
93
|
"kind",
|
|
74
94
|
["text", "rich"],
|
|
75
95
|
!0
|
|
76
96
|
]]));
|
|
77
97
|
}
|
|
78
|
-
function
|
|
79
|
-
let n =
|
|
98
|
+
function m(e, t) {
|
|
99
|
+
let n = u(e, "progress", [
|
|
80
100
|
"kind",
|
|
81
101
|
"value",
|
|
82
102
|
"label"
|
|
83
103
|
], t);
|
|
84
|
-
n && (n.kind === "determinate" ? (typeof n.value != "number" || !Number.isFinite(n.value) || n.value < 0 || n.value > 1) &&
|
|
104
|
+
n && (n.kind === "determinate" ? (typeof n.value != "number" || !Number.isFinite(n.value) || n.value < 0 || n.value > 1) && l(t, "progress.value", "Expected a finite number between 0 and 1") : n.kind === "indeterminate" ? f(n, t, "progress", ["value"], "indeterminate progress") : d(n, t, "progress", [[
|
|
85
105
|
"kind",
|
|
86
106
|
["indeterminate", "determinate"],
|
|
87
107
|
!0
|
|
88
|
-
]]),
|
|
108
|
+
]]), d(n, t, "progress", [["label", "string"]]));
|
|
89
109
|
}
|
|
90
|
-
function
|
|
110
|
+
function h(e) {
|
|
91
111
|
if (/[\u0000-\u001f\u007f]/u.test(e)) return !1;
|
|
92
112
|
let t = e.trim(), n = t.indexOf(":"), r = t.search(/[/?#]/u);
|
|
93
113
|
if (n === -1 || r !== -1 && r < n) return !0;
|
|
@@ -99,49 +119,99 @@ function p(e) {
|
|
|
99
119
|
"tel"
|
|
100
120
|
].includes(i);
|
|
101
121
|
}
|
|
102
|
-
function
|
|
103
|
-
|
|
122
|
+
function g(e, t) {
|
|
123
|
+
if (!Array.isArray(e) || e.length < 1 || e.length > 3) {
|
|
124
|
+
l(t, "action.fields", "Expected an array of one to three fields");
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
let n = /* @__PURE__ */ new Set();
|
|
128
|
+
e.forEach((e, r) => {
|
|
129
|
+
let o = `action.fields.${r}`, c = u(e, o, i, t);
|
|
130
|
+
c && (d(c, t, o, [
|
|
131
|
+
[
|
|
132
|
+
"name",
|
|
133
|
+
"nonempty string",
|
|
134
|
+
!0
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"kind",
|
|
138
|
+
["text", "textarea"],
|
|
139
|
+
!0
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
"label",
|
|
143
|
+
"nonempty string",
|
|
144
|
+
!0
|
|
145
|
+
],
|
|
146
|
+
["placeholder", "string"],
|
|
147
|
+
["defaultValue", "string"],
|
|
148
|
+
["required", "boolean"],
|
|
149
|
+
["autoComplete", "string"],
|
|
150
|
+
["inputMode", a]
|
|
151
|
+
]), n.has(c.name) && l(t, `${o}.name`, "Field names must be unique"), n.add(c.name), s(c, "maxLength") && c.maxLength !== void 0 && (typeof c.maxLength != "number" || !Number.isInteger(c.maxLength) || c.maxLength < 1) ? l(t, `${o}.maxLength`, "Expected a positive integer") : typeof c.maxLength == "number" && typeof c.defaultValue == "string" && c.defaultValue.length > c.maxLength && l(t, `${o}.defaultValue`, "Longer than maxLength"));
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function _(e, t) {
|
|
155
|
+
let n = u(e, "action", [
|
|
104
156
|
"kind",
|
|
105
157
|
"label",
|
|
106
158
|
"run",
|
|
107
159
|
"errorMessage",
|
|
108
160
|
"href",
|
|
109
161
|
"target",
|
|
110
|
-
"rel"
|
|
162
|
+
"rel",
|
|
163
|
+
"fields",
|
|
164
|
+
"validate"
|
|
111
165
|
], t);
|
|
112
|
-
n && (
|
|
166
|
+
n && (d(n, t, "action", [[
|
|
113
167
|
"label",
|
|
114
168
|
"nonempty string",
|
|
115
169
|
!0
|
|
116
|
-
]]), n.kind === "
|
|
170
|
+
]]), n.kind === "form" ? (f(n, t, "action", [
|
|
171
|
+
"href",
|
|
172
|
+
"target",
|
|
173
|
+
"rel"
|
|
174
|
+
], "a form action"), d(n, t, "action", [
|
|
175
|
+
[
|
|
176
|
+
"run",
|
|
177
|
+
"function",
|
|
178
|
+
!0
|
|
179
|
+
],
|
|
180
|
+
["errorMessage", "function"],
|
|
181
|
+
["validate", "function"]
|
|
182
|
+
]), g(n.fields, t)) : (f(n, t, "action", ["fields", "validate"], `a ${n.kind === "link" ? "link" : "command"} action`), n.kind === "command" ? (f(n, t, "action", [
|
|
117
183
|
"href",
|
|
118
184
|
"target",
|
|
119
185
|
"rel"
|
|
120
|
-
], "a command action"),
|
|
186
|
+
], "a command action"), d(n, t, "action", [[
|
|
121
187
|
"run",
|
|
122
188
|
"function",
|
|
123
189
|
!0
|
|
124
|
-
], ["errorMessage", "function"]])) : n.kind === "link" ? (
|
|
190
|
+
], ["errorMessage", "function"]])) : n.kind === "link" ? (f(n, t, "action", ["run", "errorMessage"], "a link action"), d(n, t, "action", [[
|
|
125
191
|
"href",
|
|
126
192
|
"nonempty string",
|
|
127
193
|
!0
|
|
128
|
-
]]), typeof n.href == "string" && !
|
|
194
|
+
]]), typeof n.href == "string" && !h(n.href) && l(t, "action.href", "Unsupported or unsafe URL"), d(n, t, "action", [["target", [
|
|
129
195
|
"_self",
|
|
130
196
|
"_blank",
|
|
131
197
|
"_parent",
|
|
132
198
|
"_top"
|
|
133
|
-
]], ["rel", "string"]])) :
|
|
199
|
+
]], ["rel", "string"]])) : d(n, t, "action", [[
|
|
134
200
|
"kind",
|
|
135
|
-
[
|
|
201
|
+
[
|
|
202
|
+
"command",
|
|
203
|
+
"link",
|
|
204
|
+
"form"
|
|
205
|
+
],
|
|
136
206
|
!0
|
|
137
|
-
]]));
|
|
207
|
+
]])));
|
|
138
208
|
}
|
|
139
|
-
function
|
|
140
|
-
|
|
209
|
+
function v(e, t, n) {
|
|
210
|
+
d(e, t, "", [
|
|
141
211
|
[
|
|
142
212
|
"title",
|
|
143
213
|
"nonempty string",
|
|
144
|
-
!n ||
|
|
214
|
+
!n || s(e, "title")
|
|
145
215
|
],
|
|
146
216
|
["kind", [
|
|
147
217
|
"info",
|
|
@@ -163,33 +233,33 @@ function h(e, t, n) {
|
|
|
163
233
|
]]
|
|
164
234
|
]);
|
|
165
235
|
for (let [r, i] of [
|
|
166
|
-
["description",
|
|
167
|
-
["progress",
|
|
168
|
-
["action",
|
|
169
|
-
])
|
|
170
|
-
|
|
236
|
+
["description", p],
|
|
237
|
+
["progress", m],
|
|
238
|
+
["action", _]
|
|
239
|
+
]) s(e, r) && e[r] !== void 0 && !(n && e[r] === null) && i(e[r], t);
|
|
240
|
+
s(e, "duration") && e.duration !== void 0 && e.duration !== null && (typeof e.duration != "number" || !Number.isFinite(e.duration) || e.duration < 0) && l(t, "duration", "Expected null or a finite nonnegative duration");
|
|
171
241
|
}
|
|
172
|
-
function
|
|
173
|
-
return e.length === 0 ?
|
|
242
|
+
function y(e) {
|
|
243
|
+
return e.length === 0 ? o : Object.freeze(e);
|
|
174
244
|
}
|
|
175
|
-
function
|
|
176
|
-
let t = [], r =
|
|
177
|
-
return r && (
|
|
245
|
+
function b(e) {
|
|
246
|
+
let t = [], r = u(e, "", n, t);
|
|
247
|
+
return r && (v(r, t, !1), d(r, t, "", [
|
|
178
248
|
["id", "nonempty string"],
|
|
179
249
|
["dedupeKey", "nonempty string"],
|
|
180
250
|
["onClose", "function"]
|
|
181
|
-
])),
|
|
251
|
+
])), y(t);
|
|
182
252
|
}
|
|
183
|
-
function
|
|
184
|
-
let n = [], r =
|
|
185
|
-
return r &&
|
|
253
|
+
function x(e) {
|
|
254
|
+
let n = [], r = u(e, "", t, n);
|
|
255
|
+
return r && v(r, n, !0), y(n);
|
|
186
256
|
}
|
|
187
|
-
function
|
|
188
|
-
let r = [], i =
|
|
189
|
-
return i && (
|
|
257
|
+
function S(t, n = !1) {
|
|
258
|
+
let r = [], i = u(t, "", e, r);
|
|
259
|
+
return i && (v(i, r, !1), n && s(i, "duration") && l(r, "duration", "Pending content cannot define a duration")), y(r);
|
|
190
260
|
}
|
|
191
|
-
function
|
|
192
|
-
let n = [], r =
|
|
261
|
+
function C(e, t) {
|
|
262
|
+
let n = [], r = u(e, "", [
|
|
193
263
|
"id",
|
|
194
264
|
"priority",
|
|
195
265
|
"pending",
|
|
@@ -200,44 +270,44 @@ function b(e, t) {
|
|
|
200
270
|
"isCancellation",
|
|
201
271
|
"onClose"
|
|
202
272
|
], n);
|
|
203
|
-
if (!r) return
|
|
204
|
-
|
|
273
|
+
if (!r) return y(n);
|
|
274
|
+
d(r, n, "", [["id", "nonempty string"], ["priority", ["normal", "high"]]]);
|
|
205
275
|
for (let e of [
|
|
206
276
|
"pending",
|
|
207
277
|
"success",
|
|
208
278
|
"error",
|
|
209
279
|
"cancelled"
|
|
210
|
-
]) if ((e !== "cancelled" ||
|
|
211
|
-
return
|
|
280
|
+
]) if ((e !== "cancelled" || s(r, e)) && (e === "pending" || typeof r[e] != "function")) for (let t of S(r[e], e === "pending")) l(n, t.path ? `${e}.${t.path}` : e, t.message);
|
|
281
|
+
return d(r, n, "", [
|
|
212
282
|
["cancel", "function"],
|
|
213
283
|
["isCancellation", "function"],
|
|
214
284
|
["onClose", "function"]
|
|
215
|
-
]), t &&
|
|
285
|
+
]), t && s(r, "cancel") && l(n, "cancel", "Factory cancellation uses its attempt signal"), y(n);
|
|
216
286
|
}
|
|
217
|
-
var
|
|
218
|
-
function
|
|
287
|
+
var w = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0;
|
|
288
|
+
function T(e) {
|
|
219
289
|
if (e === void 0) return Object.freeze({ autoDismiss: !0 });
|
|
220
|
-
let t = [], n =
|
|
290
|
+
let t = [], n = u(e, "", [
|
|
221
291
|
"autoDismiss",
|
|
222
292
|
"attentionDelay",
|
|
223
293
|
"messages",
|
|
224
294
|
"onOverflow",
|
|
225
295
|
"onDiagnostic"
|
|
226
296
|
], t);
|
|
227
|
-
if (n && (
|
|
297
|
+
if (n && (d(n, t, "", [
|
|
228
298
|
["autoDismiss", "boolean"],
|
|
229
299
|
["onOverflow", "function"],
|
|
230
300
|
["onDiagnostic", "function"]
|
|
231
|
-
]),
|
|
232
|
-
let e =
|
|
233
|
-
e &&
|
|
301
|
+
]), s(n, "attentionDelay") && n.attentionDelay !== void 0 && typeof n.attentionDelay != "number" && l(t, "attentionDelay", "Expected a number"), s(n, "messages") && n.messages !== void 0)) {
|
|
302
|
+
let e = u(n.messages, "messages", r, t);
|
|
303
|
+
e && d(e, t, "messages", r.map((e) => [e, "string"]));
|
|
234
304
|
}
|
|
235
305
|
if (t.length) throw TypeError(t.map(({ path: e, message: t }) => `${e || "options"}: ${t}`).join("; "));
|
|
236
|
-
if (e.attentionDelay !== void 0 && !
|
|
306
|
+
if (e.attentionDelay !== void 0 && !w(e.attentionDelay)) throw RangeError("attentionDelay: Expected a finite nonnegative number of milliseconds");
|
|
237
307
|
let i = { autoDismiss: e.autoDismiss ?? !0 };
|
|
238
|
-
return e.attentionDelay !== void 0 && (i.attentionDelay = e.attentionDelay), e.messages !== void 0 && (i.messages =
|
|
308
|
+
return e.attentionDelay !== void 0 && (i.attentionDelay = e.attentionDelay), e.messages !== void 0 && (i.messages = E(e.messages, [], r)), e.onOverflow !== void 0 && (i.onOverflow = e.onOverflow), e.onDiagnostic !== void 0 && (i.onDiagnostic = e.onDiagnostic), Object.freeze(i);
|
|
239
309
|
}
|
|
240
|
-
function
|
|
310
|
+
function E(e, t, n = []) {
|
|
241
311
|
let r = {};
|
|
242
312
|
for (let i of [...t, ...n]) {
|
|
243
313
|
let n = e[i];
|
|
@@ -245,41 +315,63 @@ function C(e, t, n = []) {
|
|
|
245
315
|
}
|
|
246
316
|
return Object.freeze(r);
|
|
247
317
|
}
|
|
248
|
-
function
|
|
249
|
-
return e.kind === "text" ?
|
|
318
|
+
function D(e) {
|
|
319
|
+
return e.kind === "text" ? E(e, ["kind", "text"]) : E(e, [
|
|
250
320
|
"kind",
|
|
251
321
|
"content",
|
|
252
322
|
"announcement"
|
|
253
323
|
]);
|
|
254
324
|
}
|
|
255
|
-
function
|
|
256
|
-
return e.kind === "indeterminate" ?
|
|
325
|
+
function O(e) {
|
|
326
|
+
return e.kind === "indeterminate" ? E(e, ["kind"], ["label"]) : E(e, ["kind", "value"], ["label"]);
|
|
257
327
|
}
|
|
258
|
-
|
|
259
|
-
|
|
328
|
+
var k = /* @__PURE__ */ new WeakSet();
|
|
329
|
+
function A(e) {
|
|
330
|
+
if (k.has(e)) return e;
|
|
331
|
+
let t = e.kind === "command" ? E(e, [
|
|
260
332
|
"kind",
|
|
261
333
|
"label",
|
|
262
334
|
"run"
|
|
263
|
-
], ["errorMessage"]) :
|
|
335
|
+
], ["errorMessage"]) : e.kind === "link" ? E(e, [
|
|
264
336
|
"kind",
|
|
265
337
|
"label",
|
|
266
338
|
"href"
|
|
267
|
-
], ["target", "rel"])
|
|
339
|
+
], ["target", "rel"]) : E({
|
|
340
|
+
...e,
|
|
341
|
+
fields: Object.freeze(e.fields.map((e) => E(e, [
|
|
342
|
+
"name",
|
|
343
|
+
"kind",
|
|
344
|
+
"label"
|
|
345
|
+
], [
|
|
346
|
+
"placeholder",
|
|
347
|
+
"defaultValue",
|
|
348
|
+
"required",
|
|
349
|
+
"maxLength",
|
|
350
|
+
"autoComplete",
|
|
351
|
+
"inputMode"
|
|
352
|
+
])))
|
|
353
|
+
}, [
|
|
354
|
+
"kind",
|
|
355
|
+
"fields",
|
|
356
|
+
"label",
|
|
357
|
+
"run"
|
|
358
|
+
], ["errorMessage", "validate"]);
|
|
359
|
+
return k.add(t), t;
|
|
268
360
|
}
|
|
269
|
-
function
|
|
361
|
+
function j(e) {
|
|
270
362
|
let t = {
|
|
271
363
|
title: e.title,
|
|
272
364
|
announcementPriority: e.announcementPriority ?? "polite"
|
|
273
365
|
};
|
|
274
|
-
return e.description !== void 0 && (t.description =
|
|
366
|
+
return e.description !== void 0 && (t.description = D(e.description)), s(e, "icon") && (t.icon = e.icon), e.progress !== void 0 && (t.progress = O(e.progress)), e.action !== void 0 && (t.action = A(e.action)), e.duration !== void 0 && (t.duration = e.duration), e.attention !== void 0 && (t.attention = e.attention), Object.freeze(t);
|
|
275
367
|
}
|
|
276
|
-
function
|
|
368
|
+
function M(e, t) {
|
|
277
369
|
if (e === t) return !0;
|
|
278
370
|
if (!e || !t) return !1;
|
|
279
371
|
let n = Object.keys(e);
|
|
280
|
-
return n.length === Object.keys(t).length && n.every((n) =>
|
|
372
|
+
return n.length === Object.keys(t).length && n.every((n) => s(t, n) && Object.is(e[n], t[n]));
|
|
281
373
|
}
|
|
282
|
-
function
|
|
374
|
+
function N(t, n) {
|
|
283
375
|
let r = { ...t };
|
|
284
376
|
for (let t of e) {
|
|
285
377
|
let e = n[t];
|
|
@@ -290,9 +382,9 @@ function k(t, n) {
|
|
|
290
382
|
"action"
|
|
291
383
|
].includes(t) ? delete r[t] : e !== void 0 && (r[t] = e);
|
|
292
384
|
}
|
|
293
|
-
return r.title === t.title && r.announcementPriority === t.announcementPriority && r.duration === t.duration &&
|
|
385
|
+
return r.title === t.title && r.announcementPriority === t.announcementPriority && r.duration === t.duration && s(r, "duration") === s(t, "duration") && r.attention === t.attention && Object.is(r.icon, t.icon) && s(r, "icon") === s(t, "icon") && M(r.description, t.description) && M(r.progress, t.progress) && M(r.action, t.action) ? t : j(r);
|
|
294
386
|
}
|
|
295
387
|
//#endregion
|
|
296
|
-
export {
|
|
388
|
+
export { j as copyContent, N as patchContent, w as validDelay, S as validateContent, T as validateOptions, x as validatePatch, b as validateSpec, C as validateTrackOptions };
|
|
297
389
|
|
|
298
390
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","names":["contentKeys","patchKeys","specKeys","messageKeys","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","action","common","patch","validate","finish","validateSpec","validatePatch","validateContent","pending","validateTrackOptions","problem","isFactory","validDelay","validateOptions","options","messages","message","result","copyFields","copy","optional","item","copyDescription","copyProgress","copyAction","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] 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 action(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'action', ['kind', 'label', 'run', 'errorMessage', 'href', 'target', 'rel'], issues);\n if (!data) return;\n fields(data, issues, 'action', [['label', 'nonempty string', true]]);\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'], 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\nfunction copyAction(value: PrimaryAction): PrimaryAction {\n return value.kind === 'command' ? copyFields(value, ['kind', 'label', 'run'], ['errorMessage'])\n : copyFields(value, ['kind', 'label', 'href'], ['target', 'rel']);\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;AACtG,GACMC,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,O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AOuD,EAAOvD,KAExFG,MAAU,KAAA,MAAW,EAAoCH,KAAOG;CAC3E;CAOA,OANIoD,EAAO,UAAUL,EAAQ,SAASK,EAAO,yBAAyBL,EAAQ,wBAC1EK,EAAO,aAAaL,EAAQ,YAAYrD,EAAK0D,GAAQ,UAAU,MAAM1D,EAAKqD,GAAS,UAAU,KAC7FK,EAAO,cAAcL,EAAQ,aAC7B,OAAO,GAAGK,EAAO,MAAML,EAAQ,IAAI,KAAKrD,EAAK0D,GAAQ,MAAM,MAAM1D,EAAKqD,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","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;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3E;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 +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;
|
|
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"}
|