@danxbot/ui 15.33.4 → 15.35.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/dist/index.js +7771 -7593
- package/dist/index.js.map +1 -1
- package/dist/pure.js +161 -103
- package/dist/pure.js.map +1 -1
- package/dist/types/components/ErrorBoundary.d.ts +7 -0
- package/dist/types/components/Popover.d.ts +10 -5
- package/dist/types/components/SandboxedFrame.d.ts +22 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/lib/design-frame/client.d.ts +24 -0
- package/dist/types/lib/design-frame/document.d.ts +26 -0
- package/dist/types/lib/design-frame/protocol.d.ts +58 -0
- package/dist/types/lib/preference-values.d.ts +62 -0
- package/dist/types/lib/preferences.d.ts +1 -60
- package/dist/types/pure.d.ts +2 -0
- package/package.json +1 -1
package/dist/pure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function it(t) {
|
|
2
2
|
if (!Number.isFinite(t) || t < 0) return "";
|
|
3
3
|
if (t < 1024) return `${t} B`;
|
|
4
4
|
const e = ["KB", "MB", "GB", "TB"];
|
|
@@ -7,10 +7,10 @@ function W(t) {
|
|
|
7
7
|
n /= 1024, r += 1;
|
|
8
8
|
return `${n < 10 ? n.toFixed(1) : Math.round(n)} ${e[r]}`;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function st(t) {
|
|
11
|
+
return R(t);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function R(t) {
|
|
14
14
|
if (t == null || !Number.isFinite(t)) return "—";
|
|
15
15
|
const e = t < 0 ? "-" : "", n = Math.abs(t), r = [
|
|
16
16
|
[1e12, "T"],
|
|
@@ -25,27 +25,27 @@ function O(t) {
|
|
|
25
25
|
function c(t, e = 2) {
|
|
26
26
|
return String(t).padStart(e, "0");
|
|
27
27
|
}
|
|
28
|
-
class
|
|
28
|
+
class b extends Error {
|
|
29
29
|
constructor(e, n, r) {
|
|
30
30
|
super(
|
|
31
|
-
r === "gap" ? `${
|
|
31
|
+
r === "gap" ? `${E(e)} does not exist in ${n} — the clock skipped it.` : `${E(e)} happens twice in ${n}.`
|
|
32
32
|
), this.wall = e, this.zone = n, this.kind = r, this.name = "AmbiguousTimeError";
|
|
33
33
|
}
|
|
34
34
|
wall;
|
|
35
35
|
zone;
|
|
36
36
|
kind;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function E(t) {
|
|
39
39
|
return `${c(t.year, 4)}-${c(t.month)}-${c(t.day)}T${c(t.hour)}:${c(t.minute)}:${c(t.second)}.${c(t.millisecond, 3)}`;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _(t) {
|
|
42
42
|
return `${c(t.year, 4)}-${c(t.month)}-${c(t.day)}`;
|
|
43
43
|
}
|
|
44
44
|
function l(t, e) {
|
|
45
45
|
const n = /* @__PURE__ */ new Date(0);
|
|
46
46
|
return n.setUTCFullYear(t, e, 0), n.getUTCDate();
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function w(t) {
|
|
49
49
|
const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t);
|
|
50
50
|
if (!e) throw new Error(`not an ISO date: ${JSON.stringify(t)} — expected YYYY-MM-DD`);
|
|
51
51
|
const n = Number(e[1]), r = Number(e[2]), o = Number(e[3]);
|
|
@@ -54,34 +54,34 @@ function C(t) {
|
|
|
54
54
|
throw new Error(`${t} is not a real date — ${n}-${r} has ${l(n, r)} days`);
|
|
55
55
|
return { year: n, month: r, day: o };
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
function
|
|
59
|
-
if (t == null || t === "") return
|
|
57
|
+
const N = "—";
|
|
58
|
+
function ut(t) {
|
|
59
|
+
if (t == null || t === "") return N;
|
|
60
60
|
let e;
|
|
61
61
|
try {
|
|
62
|
-
e =
|
|
62
|
+
e = w(t);
|
|
63
63
|
} catch {
|
|
64
64
|
return t;
|
|
65
65
|
}
|
|
66
66
|
return `${c(e.month)}/${c(e.day)}/${e.year}`;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
function
|
|
68
|
+
const C = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/, I = /^(\d{4})-(\d{1,2})-(\d{1,2})$/;
|
|
69
|
+
function ct(t) {
|
|
70
70
|
const e = t.trim();
|
|
71
71
|
if (e === "") return null;
|
|
72
72
|
let n, r, o;
|
|
73
|
-
const i =
|
|
73
|
+
const i = I.exec(e);
|
|
74
74
|
if (i)
|
|
75
75
|
n = Number(i[1]), r = Number(i[2]), o = Number(i[3]);
|
|
76
76
|
else {
|
|
77
|
-
const
|
|
78
|
-
if (!
|
|
79
|
-
r = Number(
|
|
77
|
+
const s = C.exec(e);
|
|
78
|
+
if (!s) return null;
|
|
79
|
+
r = Number(s[1]), o = Number(s[2]), n = Number(s[3]);
|
|
80
80
|
}
|
|
81
|
-
return r < 1 || r > 12 || o < 1 || o > l(n, r) ? null :
|
|
81
|
+
return r < 1 || r > 12 || o < 1 || o > l(n, r) ? null : _({ year: n, month: r, day: o });
|
|
82
82
|
}
|
|
83
83
|
const h = 36e5, S = /* @__PURE__ */ new Map();
|
|
84
|
-
function
|
|
84
|
+
function U(t) {
|
|
85
85
|
let e = S.get(t);
|
|
86
86
|
return e || (e = new Intl.DateTimeFormat("en-US", {
|
|
87
87
|
timeZone: t,
|
|
@@ -97,9 +97,9 @@ function w(t) {
|
|
|
97
97
|
hourCycle: "h23"
|
|
98
98
|
}), S.set(t, e)), e;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
const n =
|
|
102
|
-
let r = 0, o = 1, i = 1,
|
|
100
|
+
function g(t, e) {
|
|
101
|
+
const n = U(t).formatToParts(new Date(e));
|
|
102
|
+
let r = 0, o = 1, i = 1, s = 0, u = 0, a = 0;
|
|
103
103
|
for (const f of n)
|
|
104
104
|
switch (f.type) {
|
|
105
105
|
case "year":
|
|
@@ -112,108 +112,108 @@ function b(t, e) {
|
|
|
112
112
|
i = Number(f.value);
|
|
113
113
|
break;
|
|
114
114
|
case "hour":
|
|
115
|
-
|
|
115
|
+
s = Number(f.value);
|
|
116
116
|
break;
|
|
117
117
|
case "minute":
|
|
118
|
-
|
|
118
|
+
u = Number(f.value);
|
|
119
119
|
break;
|
|
120
120
|
case "second":
|
|
121
121
|
a = Number(f.value);
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
const m = (e % 1e3 + 1e3) % 1e3;
|
|
125
|
-
return { year: r, month: o, day: i, hour:
|
|
125
|
+
return { year: r, month: o, day: i, hour: s, minute: u, second: a, millisecond: m };
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function y(t) {
|
|
128
128
|
const e = /* @__PURE__ */ new Date(0);
|
|
129
129
|
return e.setUTCFullYear(t.year, t.month - 1, t.day), e.setUTCHours(t.hour, t.minute, t.second, t.millisecond), e.getTime();
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
return
|
|
131
|
+
function p(t, e) {
|
|
132
|
+
return y(g(t, e)) - e;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function x(t, e) {
|
|
135
135
|
return t.year === e.year && t.month === e.month && t.day === e.day && t.hour === e.hour && t.minute === e.minute && t.second === e.second && t.millisecond === e.millisecond;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
const n =
|
|
139
|
-
for (const
|
|
140
|
-
const
|
|
141
|
-
|
|
137
|
+
function k(t, e) {
|
|
138
|
+
const n = y(e), r = p(t, n - 24 * h), o = p(t, n + 24 * h), i = [];
|
|
139
|
+
for (const s of r === o ? [r] : [r, o]) {
|
|
140
|
+
const u = n - s;
|
|
141
|
+
x(g(t, u), e) && i.push(u);
|
|
142
142
|
}
|
|
143
|
-
return i.sort((
|
|
143
|
+
return i.sort((s, u) => s - u), i.filter((s, u) => u === 0 || s !== i[u - 1]);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
const r =
|
|
145
|
+
function L(t, e, n = "compatible") {
|
|
146
|
+
const r = k(t, e);
|
|
147
147
|
if (r.length === 1) return r[0];
|
|
148
148
|
if (r.length > 1) {
|
|
149
|
-
if (n === "reject") throw new
|
|
149
|
+
if (n === "reject") throw new b(e, t, "overlap");
|
|
150
150
|
return n === "later" ? r[r.length - 1] : r[0];
|
|
151
151
|
}
|
|
152
|
-
if (n === "reject") throw new
|
|
153
|
-
const o =
|
|
154
|
-
return n === "earlier" ? Math.min(a, m) :
|
|
152
|
+
if (n === "reject") throw new b(e, t, "gap");
|
|
153
|
+
const o = y(e), i = p(t, o - 24 * h), s = p(t, o + 24 * h), u = s - i, a = o - i, m = o - s;
|
|
154
|
+
return n === "earlier" ? Math.min(a, m) : u > 0 ? Math.max(a, m) : Math.min(a, m);
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function A() {
|
|
157
157
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function D(t) {
|
|
160
160
|
if (typeof t == "number") return Number.isFinite(t) ? t : null;
|
|
161
161
|
const e = t.replace(/(\.\d{3})\d+/, "$1"), n = Date.parse(e);
|
|
162
162
|
return Number.isNaN(n) ? null : n;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
if (t == null || t === "") return
|
|
166
|
-
const n =
|
|
164
|
+
function at(t, e = {}) {
|
|
165
|
+
if (t == null || t === "") return N;
|
|
166
|
+
const n = D(t);
|
|
167
167
|
if (n === null) return String(t);
|
|
168
|
-
const r = e.zone ??
|
|
169
|
-
return `${c(o.month)}/${c(o.day)}/${o.year}, ${i}:${c(o.minute)} ${
|
|
168
|
+
const r = e.zone ?? A(), o = g(r, n), i = (o.hour + 11) % 12 + 1, s = o.hour < 12 ? "AM" : "PM";
|
|
169
|
+
return `${c(o.month)}/${c(o.day)}/${o.year}, ${i}:${c(o.minute)} ${s}`;
|
|
170
170
|
}
|
|
171
|
-
const
|
|
172
|
-
function
|
|
171
|
+
const B = /^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:,?\s+(\d{1,2}):(\d{2})(?::(\d{2}))?\s*([AaPp][Mm]))?$/, H = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?\s*(Z|[+-]\d{2}:?\d{2})$/;
|
|
172
|
+
function mt(t, e = {}) {
|
|
173
173
|
const n = t.trim();
|
|
174
174
|
if (n === "") return null;
|
|
175
|
-
if (
|
|
176
|
-
const d =
|
|
175
|
+
if (H.test(n)) {
|
|
176
|
+
const d = D(n);
|
|
177
177
|
return d === null ? null : new Date(d).toISOString();
|
|
178
178
|
}
|
|
179
|
-
const r =
|
|
179
|
+
const r = B.exec(n);
|
|
180
180
|
if (!r) return null;
|
|
181
|
-
const o = Number(r[1]), i = Number(r[2]),
|
|
182
|
-
if (o < 1 || o > 12 || i < 1 || i > l(
|
|
183
|
-
let
|
|
181
|
+
const o = Number(r[1]), i = Number(r[2]), s = Number(r[3]);
|
|
182
|
+
if (o < 1 || o > 12 || i < 1 || i > l(s, o)) return null;
|
|
183
|
+
let u = 0, a = 0, m = 0;
|
|
184
184
|
if (r[4] !== void 0) {
|
|
185
185
|
const d = Number(r[4]);
|
|
186
186
|
a = Number(r[5]), m = r[6] !== void 0 ? Number(r[6]) : 0;
|
|
187
|
-
const
|
|
187
|
+
const O = r[7].toUpperCase();
|
|
188
188
|
if (d < 1 || d > 12 || a > 59 || m > 59) return null;
|
|
189
|
-
|
|
189
|
+
u = O === "AM" ? d === 12 ? 0 : d : d === 12 ? 12 : d + 12;
|
|
190
190
|
}
|
|
191
|
-
const f = { year:
|
|
192
|
-
return new Date(
|
|
191
|
+
const f = { year: s, month: o, day: i, hour: u, minute: a, second: m, millisecond: 0 }, M = e.zone ?? A();
|
|
192
|
+
return new Date(L(M, f)).toISOString();
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const P = new Intl.NumberFormat("en-US", {
|
|
195
195
|
style: "currency",
|
|
196
196
|
currency: "USD",
|
|
197
197
|
minimumFractionDigits: 2,
|
|
198
198
|
maximumFractionDigits: 2
|
|
199
199
|
});
|
|
200
|
-
function
|
|
201
|
-
return t == null || !Number.isFinite(t) ?
|
|
200
|
+
function ft(t) {
|
|
201
|
+
return t == null || !Number.isFinite(t) ? N : P.format(t);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function dt(t) {
|
|
204
204
|
const e = t.trim();
|
|
205
205
|
if (e === "") return null;
|
|
206
206
|
const n = /^\((.*)\)$/.exec(e), r = n !== null, i = (n ? n[1] : e).replace(/[$,\s]/g, "");
|
|
207
207
|
if (!/^-?\d+(\.\d+)?$/.test(i)) return null;
|
|
208
|
-
const
|
|
209
|
-
return Number.isFinite(
|
|
208
|
+
const s = Number(i);
|
|
209
|
+
return Number.isFinite(s) ? r ? -Math.abs(s) : s : null;
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
if (t == null || !Number.isFinite(t)) return
|
|
211
|
+
function lt(t, e = {}) {
|
|
212
|
+
if (t == null || !Number.isFinite(t)) return N;
|
|
213
213
|
const { decimals: n } = e, r = n === void 0 ? { maximumFractionDigits: 6 } : { minimumFractionDigits: n, maximumFractionDigits: n };
|
|
214
214
|
return new Intl.NumberFormat("en-US", r).format(t);
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function ht(t) {
|
|
217
217
|
const e = t.trim();
|
|
218
218
|
if (e === "") return null;
|
|
219
219
|
const n = e.replace(/,/g, "");
|
|
@@ -221,27 +221,27 @@ function X(t) {
|
|
|
221
221
|
const r = Number(n);
|
|
222
222
|
return Number.isFinite(r) ? r : null;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function pt(t, e = {}) {
|
|
225
225
|
const { trueLabel: n = "Yes", falseLabel: r = "No", unknownLabel: o = "Unknown" } = e;
|
|
226
226
|
return t === !0 ? n : t === !1 ? r : o;
|
|
227
227
|
}
|
|
228
|
-
const
|
|
229
|
-
function
|
|
228
|
+
const Y = /* @__PURE__ */ new Set(["yes", "y", "true", "t", "1"]), v = /* @__PURE__ */ new Set(["no", "n", "false", "f", "0"]);
|
|
229
|
+
function Nt(t) {
|
|
230
230
|
const e = t.trim().toLowerCase();
|
|
231
|
-
return
|
|
231
|
+
return Y.has(e) ? !0 : v.has(e) ? !1 : null;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function gt(t, e) {
|
|
234
234
|
if (!Number.isFinite(t) || !Number.isFinite(e) || e <= 0 || t <= 0) return null;
|
|
235
235
|
const n = Math.round(Math.min(t, e) / e * 5);
|
|
236
236
|
return Math.max(1, Math.min(5, n));
|
|
237
237
|
}
|
|
238
|
-
const
|
|
238
|
+
const yt = {
|
|
239
239
|
1: "Just a guess",
|
|
240
240
|
2: "Somewhat unsure",
|
|
241
241
|
3: "Fairly confident",
|
|
242
242
|
4: "Confident",
|
|
243
243
|
5: "Highly confident"
|
|
244
|
-
},
|
|
244
|
+
}, $ = 8, j = [
|
|
245
245
|
"--chart-1",
|
|
246
246
|
"--chart-2",
|
|
247
247
|
"--chart-3",
|
|
@@ -250,36 +250,94 @@ const nt = {
|
|
|
250
250
|
"--chart-6",
|
|
251
251
|
"--chart-7",
|
|
252
252
|
"--chart-8"
|
|
253
|
-
],
|
|
254
|
-
function
|
|
255
|
-
const e =
|
|
253
|
+
], G = "--chart-seq";
|
|
254
|
+
function bt(t) {
|
|
255
|
+
const e = j[t];
|
|
256
256
|
if (!Number.isInteger(t) || e === void 0)
|
|
257
257
|
throw new Error(
|
|
258
|
-
`chartSeriesColor: there are ${
|
|
258
|
+
`chartSeriesColor: there are ${$} categorical hues (index 0-${$ - 1}); got ${t}. Fold the rest into "Other".`
|
|
259
259
|
);
|
|
260
260
|
return `var(${e})`;
|
|
261
261
|
}
|
|
262
|
-
const
|
|
262
|
+
const Et = `var(${G})`;
|
|
263
|
+
function Z(t, e) {
|
|
264
|
+
const n = document.documentElement;
|
|
265
|
+
n.setAttribute("data-motion-suspend", ""), n.setAttribute(`data-${t}`, e), getComputedStyle(n).backgroundColor, n.removeAttribute("data-motion-suspend");
|
|
266
|
+
}
|
|
267
|
+
const W = ["light", "dark"], K = ["sm", "md", "lg"], J = ["design", "aa"], Q = ["system", "full", "reduced"], T = "danx-design:appearance", q = "danx-design:ready", V = "danx-design:error", St = 500, F = {
|
|
268
|
+
theme: "theme",
|
|
269
|
+
contrast: "contrast",
|
|
270
|
+
uiScale: "ui-scale",
|
|
271
|
+
motion: "motion"
|
|
272
|
+
}, X = {
|
|
273
|
+
theme: W,
|
|
274
|
+
contrast: J,
|
|
275
|
+
uiScale: K,
|
|
276
|
+
motion: Q
|
|
277
|
+
}, z = Object.keys(F);
|
|
278
|
+
function tt(t) {
|
|
279
|
+
return typeof t == "object" && t !== null;
|
|
280
|
+
}
|
|
281
|
+
function et(t) {
|
|
282
|
+
if (!tt(t) || t.type !== T) return null;
|
|
283
|
+
const e = { type: T };
|
|
284
|
+
for (const n of z) {
|
|
285
|
+
const r = t[n];
|
|
286
|
+
if (r !== void 0) {
|
|
287
|
+
if (typeof r != "string" || !X[n].includes(r)) return null;
|
|
288
|
+
e[n] = r;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return e;
|
|
292
|
+
}
|
|
293
|
+
function nt(t) {
|
|
294
|
+
const e = (n) => {
|
|
295
|
+
if (n.source !== window.parent) return;
|
|
296
|
+
const r = et(n.data);
|
|
297
|
+
if (!r) return;
|
|
298
|
+
const o = {};
|
|
299
|
+
for (const [i, s] of Object.entries(F)) {
|
|
300
|
+
const u = i, a = r[u];
|
|
301
|
+
a !== void 0 && (Z(s, a), Object.assign(o, { [u]: a }));
|
|
302
|
+
}
|
|
303
|
+
t?.(o);
|
|
304
|
+
};
|
|
305
|
+
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
306
|
+
}
|
|
307
|
+
function rt() {
|
|
308
|
+
const t = { type: q };
|
|
309
|
+
window.parent.postMessage(t, "*");
|
|
310
|
+
}
|
|
311
|
+
function ot(t) {
|
|
312
|
+
const e = { type: V, message: String(t) };
|
|
313
|
+
window.parent.postMessage(e, "*");
|
|
314
|
+
}
|
|
315
|
+
const $t = { onAppearance: nt, ready: rt, reportError: ot };
|
|
263
316
|
export {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
317
|
+
Et as CHART_SEQUENTIAL_COLOR,
|
|
318
|
+
G as CHART_SEQUENTIAL_TOKEN,
|
|
319
|
+
$ as CHART_SERIES_COUNT,
|
|
320
|
+
j as CHART_SERIES_TOKENS,
|
|
321
|
+
yt as CONFIDENCE_LEVEL_LABELS,
|
|
322
|
+
T as DESIGN_FRAME_APPEARANCE,
|
|
323
|
+
V as DESIGN_FRAME_ERROR,
|
|
324
|
+
St as DESIGN_FRAME_ERROR_MAX_LENGTH,
|
|
325
|
+
q as DESIGN_FRAME_READY,
|
|
326
|
+
bt as chartSeriesColor,
|
|
327
|
+
gt as confidenceLevel,
|
|
328
|
+
$t as designFrameClient,
|
|
329
|
+
pt as formatBoolean,
|
|
330
|
+
it as formatBytes,
|
|
331
|
+
R as formatCompactNumber,
|
|
332
|
+
ft as formatCurrency,
|
|
333
|
+
ut as formatDate,
|
|
334
|
+
at as formatDateTime,
|
|
335
|
+
lt as formatNumber,
|
|
336
|
+
st as formatTokens,
|
|
337
|
+
Nt as parseBoolean,
|
|
338
|
+
dt as parseCurrency,
|
|
339
|
+
ct as parseDate,
|
|
340
|
+
mt as parseDateTime,
|
|
341
|
+
ht as parseNumber
|
|
284
342
|
};
|
|
285
343
|
//# sourceMappingURL=pure.js.map
|