@iyulab/u-widgets 0.8.0 → 0.8.1
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/u-widgets.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { g as be } from "./formdown-BWJ6QGJs.js";
|
|
2
2
|
import { p as Nt, r as Ft } from "./formdown-BWJ6QGJs.js";
|
|
3
3
|
import { i as we } from "./infer-CNOiD2dS.js";
|
|
4
|
-
import { t as b, n as ye } from "./tokens-
|
|
4
|
+
import { t as b, n as ye } from "./tokens-D5aWvczs.js";
|
|
5
5
|
import { css as w, LitElement as y, nothing as l, html as o } from "lit";
|
|
6
6
|
import { property as f, customElement as x, state as S } from "lit/decorators.js";
|
|
7
7
|
const xe = /* @__PURE__ */ new Set([
|
|
@@ -40,51 +40,51 @@ const xe = /* @__PURE__ */ new Set([
|
|
|
40
40
|
"chart.treemap"
|
|
41
41
|
]), _e = /* @__PURE__ */ new Set(["metric", "gauge", "progress", "header", "code", "rating", "video"]);
|
|
42
42
|
function Y(e, t = 0) {
|
|
43
|
-
const
|
|
43
|
+
const a = [], r = [];
|
|
44
44
|
if (t > le)
|
|
45
45
|
return { valid: !1, errors: ["compose children exceed maximum nesting depth (" + le + ")"], warnings: r };
|
|
46
46
|
if (e == null || typeof e != "object")
|
|
47
47
|
return { valid: !1, errors: ["Spec must be a non-null object"], warnings: r };
|
|
48
|
-
const
|
|
49
|
-
if (typeof
|
|
50
|
-
return
|
|
51
|
-
const s =
|
|
52
|
-
if (t === 0 &&
|
|
53
|
-
if (!Array.isArray(
|
|
54
|
-
|
|
48
|
+
const i = e;
|
|
49
|
+
if (typeof i.widget != "string" || i.widget.length === 0)
|
|
50
|
+
return a.push('Required field "widget" must be a non-empty string'), { valid: !1, errors: a, warnings: r };
|
|
51
|
+
const s = i.widget;
|
|
52
|
+
if (t === 0 && i.type !== void 0 && i.type !== "u-widget" && a.push('"type" must be "u-widget" if specified'), i.fields !== void 0 && i.formdown !== void 0 && a.push('"fields" and "formdown" are mutually exclusive'), i.data !== void 0 && ($e.has(s) && !Array.isArray(i.data) && a.push(`"${s}" expects "data" to be an array, got ${typeof i.data}`), _e.has(s) && (Array.isArray(i.data) || typeof i.data != "object") && a.push(`"${s}" expects "data" to be an object, got ${Array.isArray(i.data) ? "array" : typeof i.data}`)), s === "compose") {
|
|
53
|
+
if (!Array.isArray(i.children))
|
|
54
|
+
a.push('"compose" widget requires a "children" array');
|
|
55
55
|
else
|
|
56
|
-
for (let n = 0; n <
|
|
57
|
-
const d =
|
|
56
|
+
for (let n = 0; n < i.children.length; n++) {
|
|
57
|
+
const d = i.children[n];
|
|
58
58
|
if (d == null || typeof d != "object" || typeof d.widget != "string")
|
|
59
|
-
|
|
59
|
+
a.push(`children[${n}] must be an object with a "widget" field`);
|
|
60
60
|
else {
|
|
61
61
|
const c = Y(d, t + 1);
|
|
62
|
-
c.valid ||
|
|
62
|
+
c.valid || a.push(...c.errors.map((p) => `children[${n}]: ${p}`)), r.push(...c.warnings.map((p) => `children[${n}]: ${p}`));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
if (
|
|
65
|
+
if (i.layout !== void 0) {
|
|
66
66
|
const n = ["stack", "row", "grid"];
|
|
67
|
-
n.includes(
|
|
67
|
+
n.includes(i.layout) || a.push(`"layout" must be one of: ${n.join(", ")}`);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
if (Array.isArray(
|
|
71
|
-
for (let n = 0; n <
|
|
72
|
-
const d =
|
|
73
|
-
d == null || typeof d != "object" || typeof d.field != "string" ?
|
|
70
|
+
if (Array.isArray(i.fields))
|
|
71
|
+
for (let n = 0; n < i.fields.length; n++) {
|
|
72
|
+
const d = i.fields[n];
|
|
73
|
+
d == null || typeof d != "object" || typeof d.field != "string" ? a.push(`fields[${n}] must have a "field" string property`) : d.type != null && !xe.has(d.type) && r.push(`fields[${n}].type "${d.type}" is not a recognized field type`);
|
|
74
74
|
}
|
|
75
|
-
if (typeof
|
|
75
|
+
if (typeof i.formdown == "string" && i.formdown.length > 0 && !i.fields)
|
|
76
76
|
try {
|
|
77
|
-
be()(
|
|
77
|
+
be()(i.formdown);
|
|
78
78
|
} catch {
|
|
79
79
|
r.push("formdown string could not be parsed — check syntax");
|
|
80
80
|
}
|
|
81
|
-
if (Array.isArray(
|
|
82
|
-
for (let n = 0; n <
|
|
83
|
-
const d =
|
|
84
|
-
(d == null || typeof d != "object" || typeof d.label != "string" || typeof d.action != "string") &&
|
|
81
|
+
if (Array.isArray(i.actions))
|
|
82
|
+
for (let n = 0; n < i.actions.length; n++) {
|
|
83
|
+
const d = i.actions[n];
|
|
84
|
+
(d == null || typeof d != "object" || typeof d.label != "string" || typeof d.action != "string") && a.push(`actions[${n}] must have "label" and "action" string properties`);
|
|
85
85
|
}
|
|
86
|
-
if (
|
|
87
|
-
const n =
|
|
86
|
+
if (i.mapping && typeof i.mapping == "object" && i.data) {
|
|
87
|
+
const n = i.mapping, d = ke(i.data);
|
|
88
88
|
if (d)
|
|
89
89
|
for (const c of ["x", "y", "label", "value", "color", "size", "axis", "primary", "secondary", "icon", "avatar", "trailing"]) {
|
|
90
90
|
const p = n[c];
|
|
@@ -93,7 +93,7 @@ function Y(e, t = 0) {
|
|
|
93
93
|
typeof g == "string" && !d.has(g) && r.push(`mapping.${c} references "${g}" which is not found in data keys [${[...d].join(", ")}]`);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
return { valid:
|
|
96
|
+
return { valid: a.length === 0, errors: a, warnings: r };
|
|
97
97
|
}
|
|
98
98
|
function ke(e) {
|
|
99
99
|
if (Array.isArray(e) && e.length > 0 && e[0] && typeof e[0] == "object")
|
|
@@ -124,20 +124,20 @@ const ce = ["B", "KB", "MB", "GB", "TB"], ze = /* @__PURE__ */ new Set([
|
|
|
124
124
|
"XOF",
|
|
125
125
|
"XPF"
|
|
126
126
|
]);
|
|
127
|
-
function he(e, t,
|
|
127
|
+
function he(e, t, a) {
|
|
128
128
|
if (e == null) return "";
|
|
129
|
-
const [r,
|
|
129
|
+
const [r, i] = t?.split(":") ?? [];
|
|
130
130
|
switch (r) {
|
|
131
131
|
case "number":
|
|
132
|
-
return Se(e,
|
|
132
|
+
return Se(e, a);
|
|
133
133
|
case "currency":
|
|
134
|
-
return Ae(e,
|
|
134
|
+
return Ae(e, i, a);
|
|
135
135
|
case "percent":
|
|
136
|
-
return Ce(e,
|
|
136
|
+
return Ce(e, a);
|
|
137
137
|
case "date":
|
|
138
|
-
return De(e,
|
|
138
|
+
return De(e, a);
|
|
139
139
|
case "datetime":
|
|
140
|
-
return je(e,
|
|
140
|
+
return je(e, a);
|
|
141
141
|
case "bytes":
|
|
142
142
|
return Oe(e);
|
|
143
143
|
default:
|
|
@@ -145,54 +145,54 @@ function he(e, t, i) {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
function Se(e, t) {
|
|
148
|
-
const
|
|
149
|
-
return isNaN(
|
|
148
|
+
const a = Number(e);
|
|
149
|
+
return isNaN(a) ? String(e) : new Intl.NumberFormat(t).format(a);
|
|
150
150
|
}
|
|
151
|
-
function Ae(e, t,
|
|
151
|
+
function Ae(e, t, a) {
|
|
152
152
|
const r = Number(e);
|
|
153
153
|
if (isNaN(r)) return String(e);
|
|
154
|
-
const
|
|
154
|
+
const i = t || "USD";
|
|
155
155
|
try {
|
|
156
|
-
const s = ze.has(
|
|
157
|
-
return new Intl.NumberFormat(
|
|
156
|
+
const s = ze.has(i.toUpperCase());
|
|
157
|
+
return new Intl.NumberFormat(a, {
|
|
158
158
|
style: "currency",
|
|
159
|
-
currency:
|
|
159
|
+
currency: i,
|
|
160
160
|
...s && {
|
|
161
161
|
minimumFractionDigits: 0,
|
|
162
162
|
maximumFractionDigits: 0
|
|
163
163
|
}
|
|
164
164
|
}).format(r);
|
|
165
165
|
} catch {
|
|
166
|
-
return new Intl.NumberFormat(
|
|
166
|
+
return new Intl.NumberFormat(a, {
|
|
167
167
|
style: "currency",
|
|
168
168
|
currency: "USD"
|
|
169
169
|
}).format(r);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
function Ce(e, t) {
|
|
173
|
-
const
|
|
174
|
-
if (isNaN(
|
|
173
|
+
const a = Number(e);
|
|
174
|
+
if (isNaN(a)) return String(e);
|
|
175
175
|
if (t)
|
|
176
176
|
try {
|
|
177
177
|
return new Intl.NumberFormat(t, {
|
|
178
178
|
style: "percent",
|
|
179
179
|
maximumFractionDigits: 2
|
|
180
|
-
}).format(
|
|
180
|
+
}).format(a / 100);
|
|
181
181
|
} catch {
|
|
182
182
|
}
|
|
183
|
-
return
|
|
183
|
+
return a + "%";
|
|
184
184
|
}
|
|
185
185
|
function De(e, t) {
|
|
186
186
|
if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}/.test(e)) {
|
|
187
187
|
if (t)
|
|
188
188
|
try {
|
|
189
|
-
const
|
|
190
|
-
if (!isNaN(
|
|
189
|
+
const a = new Date(e);
|
|
190
|
+
if (!isNaN(a.getTime()))
|
|
191
191
|
return new Intl.DateTimeFormat(t, {
|
|
192
192
|
year: "numeric",
|
|
193
193
|
month: "2-digit",
|
|
194
194
|
day: "2-digit"
|
|
195
|
-
}).format(
|
|
195
|
+
}).format(a);
|
|
196
196
|
} catch {
|
|
197
197
|
}
|
|
198
198
|
return e.slice(0, 10);
|
|
@@ -203,15 +203,15 @@ function je(e, t) {
|
|
|
203
203
|
if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}/.test(e)) {
|
|
204
204
|
if (t)
|
|
205
205
|
try {
|
|
206
|
-
const
|
|
207
|
-
if (!isNaN(
|
|
206
|
+
const a = new Date(e);
|
|
207
|
+
if (!isNaN(a.getTime()))
|
|
208
208
|
return new Intl.DateTimeFormat(t, {
|
|
209
209
|
year: "numeric",
|
|
210
210
|
month: "2-digit",
|
|
211
211
|
day: "2-digit",
|
|
212
212
|
hour: "2-digit",
|
|
213
213
|
minute: "2-digit"
|
|
214
|
-
}).format(
|
|
214
|
+
}).format(a);
|
|
215
215
|
} catch {
|
|
216
216
|
}
|
|
217
217
|
return e.slice(0, 16).replace("T", " ");
|
|
@@ -221,11 +221,11 @@ function je(e, t) {
|
|
|
221
221
|
function Oe(e) {
|
|
222
222
|
const t = Number(e);
|
|
223
223
|
if (isNaN(t)) return String(e);
|
|
224
|
-
const
|
|
225
|
-
let r = Math.abs(t),
|
|
226
|
-
for (; r >= 1024 &&
|
|
227
|
-
r /= 1024,
|
|
228
|
-
return
|
|
224
|
+
const a = t < 0 ? "-" : "";
|
|
225
|
+
let r = Math.abs(t), i = 0;
|
|
226
|
+
for (; r >= 1024 && i < ce.length - 1; )
|
|
227
|
+
r /= 1024, i++;
|
|
228
|
+
return a + (i === 0 ? r : r.toFixed(1)) + " " + ce[i];
|
|
229
229
|
}
|
|
230
230
|
const Ee = [
|
|
231
231
|
"chart.bar",
|
|
@@ -266,37 +266,37 @@ const Ee = [
|
|
|
266
266
|
function Pe(e) {
|
|
267
267
|
if (!e) return;
|
|
268
268
|
const t = e.toLowerCase();
|
|
269
|
-
let
|
|
269
|
+
let a, r = 1 / 0;
|
|
270
270
|
for (const s of Ee) {
|
|
271
271
|
const n = Le(t, s);
|
|
272
|
-
n < r && (r = n,
|
|
272
|
+
n < r && (r = n, a = s);
|
|
273
273
|
}
|
|
274
|
-
const
|
|
275
|
-
if (r <=
|
|
276
|
-
return
|
|
274
|
+
const i = Math.min(3, Math.floor(t.length / 2));
|
|
275
|
+
if (r <= i && r > 0)
|
|
276
|
+
return a;
|
|
277
277
|
}
|
|
278
278
|
function Le(e, t) {
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
281
|
-
if (r === 0) return
|
|
282
|
-
const
|
|
283
|
-
for (let s = 0; s <= r; s++)
|
|
284
|
-
for (let s = 1; s <=
|
|
279
|
+
const a = e.length, r = t.length;
|
|
280
|
+
if (a === 0) return r;
|
|
281
|
+
if (r === 0) return a;
|
|
282
|
+
const i = new Array(r + 1);
|
|
283
|
+
for (let s = 0; s <= r; s++) i[s] = s;
|
|
284
|
+
for (let s = 1; s <= a; s++) {
|
|
285
285
|
let n = s - 1;
|
|
286
|
-
|
|
286
|
+
i[0] = s;
|
|
287
287
|
for (let d = 1; d <= r; d++) {
|
|
288
288
|
const c = e[s - 1] === t[d - 1] ? 0 : 1, p = Math.min(
|
|
289
|
-
|
|
289
|
+
i[d] + 1,
|
|
290
290
|
// deletion
|
|
291
|
-
|
|
291
|
+
i[d - 1] + 1,
|
|
292
292
|
// insertion
|
|
293
293
|
n + c
|
|
294
294
|
// substitution
|
|
295
295
|
);
|
|
296
|
-
n =
|
|
296
|
+
n = i[d], i[d] = p;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
return
|
|
299
|
+
return i[r];
|
|
300
300
|
}
|
|
301
301
|
const K = {
|
|
302
302
|
// UI chrome
|
|
@@ -326,13 +326,13 @@ function me(e) {
|
|
|
326
326
|
if (!e) return K;
|
|
327
327
|
const t = e.toLowerCase();
|
|
328
328
|
if (L.has(t)) return L.get(t);
|
|
329
|
-
const
|
|
330
|
-
return
|
|
329
|
+
const a = t.split("-")[0];
|
|
330
|
+
return a !== t && L.has(a) ? L.get(a) : K;
|
|
331
331
|
}
|
|
332
332
|
function A(e, t) {
|
|
333
333
|
return e.replace(
|
|
334
334
|
/\{(\w+)\}/g,
|
|
335
|
-
(
|
|
335
|
+
(a, r) => t[r] != null ? String(t[r]) : `{${r}}`
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
function Ot() {
|
|
@@ -351,15 +351,15 @@ function Ie(e) {
|
|
|
351
351
|
if (typeof document < "u" && document.documentElement?.lang)
|
|
352
352
|
return document.documentElement.lang;
|
|
353
353
|
}
|
|
354
|
-
var Ne = Object.defineProperty, Fe = Object.getOwnPropertyDescriptor, Z = (e, t,
|
|
355
|
-
for (var
|
|
356
|
-
(n = e[s]) && (
|
|
357
|
-
return r &&
|
|
354
|
+
var Ne = Object.defineProperty, Fe = Object.getOwnPropertyDescriptor, Z = (e, t, a, r) => {
|
|
355
|
+
for (var i = r > 1 ? void 0 : r ? Fe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
356
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
357
|
+
return r && i && Ne(t, a, i), i;
|
|
358
358
|
};
|
|
359
359
|
function de(e, t) {
|
|
360
|
-
const
|
|
360
|
+
const a = e.value, r = e.format;
|
|
361
361
|
return {
|
|
362
|
-
value: r ? he(
|
|
362
|
+
value: r ? he(a, r, t) : a ?? 0,
|
|
363
363
|
label: e.label,
|
|
364
364
|
unit: e.unit,
|
|
365
365
|
prefix: e.prefix,
|
|
@@ -385,14 +385,14 @@ let I = class extends y {
|
|
|
385
385
|
const t = this.spec.data;
|
|
386
386
|
return Array.isArray(t) ? o`
|
|
387
387
|
<div class="stat-group" part="stat-group">
|
|
388
|
-
${t.map((
|
|
388
|
+
${t.map((a) => this.renderMetric(de(a, e)))}
|
|
389
389
|
</div>
|
|
390
390
|
` : l;
|
|
391
391
|
}
|
|
392
392
|
renderMetric(e) {
|
|
393
|
-
const t = e.trend === "up" ? "↑" : e.trend === "down" ? "↓" : e.trend === "flat" ? "→" : "",
|
|
393
|
+
const t = e.trend === "up" ? "↑" : e.trend === "down" ? "↓" : e.trend === "flat" ? "→" : "", a = e.label ? `${e.label}: ${e.prefix ?? ""}${e.value}${e.unit ?? ""}${e.suffix ?? ""}` : void 0;
|
|
394
394
|
return o`
|
|
395
|
-
<div class="metric" part="metric" aria-label=${
|
|
395
|
+
<div class="metric" part="metric" aria-label=${a ?? l} data-variant=${e.variant ?? l}>
|
|
396
396
|
${e.icon ? o`<div class="metric-icon" part="icon">${e.icon}</div>` : l}
|
|
397
397
|
${e.label ? o`<div class="metric-label" part="label">${e.label}</div>` : l}
|
|
398
398
|
<div class="metric-value" part="value">
|
|
@@ -473,7 +473,7 @@ I.styles = [b, w`
|
|
|
473
473
|
.metric[data-variant="success"] .metric-value { color: var(--u-widget-positive, #16a34a); }
|
|
474
474
|
.metric[data-variant="danger"] .metric-value { color: var(--u-widget-negative, #dc2626); }
|
|
475
475
|
.metric[data-variant="warning"] .metric-value { color: var(--u-widget-warning, #d97706); }
|
|
476
|
-
.metric[data-variant="info"] .metric-value { color: var(--u-widget-primary, #
|
|
476
|
+
.metric[data-variant="info"] .metric-value { color: var(--u-widget-primary, #4f46e5); }
|
|
477
477
|
.metric[data-variant="neutral"] .metric-value { color: var(--u-widget-text-secondary, #64748b); }
|
|
478
478
|
|
|
479
479
|
/* ── stat-group ── */
|
|
@@ -522,10 +522,10 @@ Z([
|
|
|
522
522
|
I = Z([
|
|
523
523
|
x("uw-metric")
|
|
524
524
|
], I);
|
|
525
|
-
var Me = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, Q = (e, t,
|
|
526
|
-
for (var
|
|
527
|
-
(n = e[s]) && (
|
|
528
|
-
return r &&
|
|
525
|
+
var Me = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, Q = (e, t, a, r) => {
|
|
526
|
+
for (var i = r > 1 ? void 0 : r ? Te(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
527
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
528
|
+
return r && i && Me(t, a, i), i;
|
|
529
529
|
};
|
|
530
530
|
const Ue = {
|
|
531
531
|
min: 0,
|
|
@@ -544,9 +544,9 @@ const Ue = {
|
|
|
544
544
|
function pe(e) {
|
|
545
545
|
return Re[e] ?? e;
|
|
546
546
|
}
|
|
547
|
-
function ue(e, t,
|
|
548
|
-
const s = (r - 90) * Math.PI / 180, n = (
|
|
549
|
-
return `M ${d} ${c} A ${
|
|
547
|
+
function ue(e, t, a, r, i) {
|
|
548
|
+
const s = (r - 90) * Math.PI / 180, n = (i - 90) * Math.PI / 180, d = e + a * Math.cos(s), c = t + a * Math.sin(s), p = e + a * Math.cos(n), g = t + a * Math.sin(n), m = i - r > 180 ? 1 : 0;
|
|
549
|
+
return `M ${d} ${c} A ${a} ${a} 0 ${m} 1 ${p} ${g}`;
|
|
550
550
|
}
|
|
551
551
|
let N = class extends y {
|
|
552
552
|
constructor() {
|
|
@@ -566,13 +566,13 @@ let N = class extends y {
|
|
|
566
566
|
getActiveLabel(e, t) {
|
|
567
567
|
if (t.subtitle) return t.subtitle;
|
|
568
568
|
if (!t.thresholds?.length) return "";
|
|
569
|
-
const
|
|
570
|
-
for (const
|
|
571
|
-
if (e <=
|
|
572
|
-
return
|
|
569
|
+
const a = [...t.thresholds].sort((i, s) => i.to - s.to);
|
|
570
|
+
for (const i of a)
|
|
571
|
+
if (e <= i.to && i.label) return i.label;
|
|
572
|
+
return a[a.length - 1].label ?? "";
|
|
573
573
|
}
|
|
574
574
|
renderGauge() {
|
|
575
|
-
const e = this.getOptions(), t = this.getValue(),
|
|
575
|
+
const e = this.getOptions(), t = this.getValue(), a = e.max - e.min, r = a > 0 ? Math.max(0, Math.min(1, (t - e.min) / a)) : 0, i = this.getThresholdColor(t, e), s = this.getActiveLabel(t, e), n = 100, d = 100, c = 80, p = 150, g = 240, m = p + g * r, u = ue(n, d, c, p, p + g), h = r > 0 ? ue(n, d, c, p, m) : null, v = typeof this.spec.title == "string" ? this.spec.title : "Gauge", $ = s ? `${t}${e.unit} ${s}` : `${t}${e.unit}`;
|
|
576
576
|
return o`
|
|
577
577
|
<div class="gauge-container" part="gauge"
|
|
578
578
|
role="meter"
|
|
@@ -586,24 +586,24 @@ let N = class extends y {
|
|
|
586
586
|
<div class="gauge-center">
|
|
587
587
|
<div class="gauge-value" part="value">${t}</div>
|
|
588
588
|
${e.unit ? o`<div class="gauge-unit" part="unit">${e.unit}</div>` : l}
|
|
589
|
-
${s ? o`<div class="gauge-subtitle" part="subtitle" style="color:${
|
|
589
|
+
${s ? o`<div class="gauge-subtitle" part="subtitle" style="color:${i}">${s}</div>` : l}
|
|
590
590
|
</div>
|
|
591
591
|
<svg class="gauge-svg" viewBox="0 0 200 195" role="presentation" aria-hidden="true">
|
|
592
592
|
<path class="gauge-track" d="${u}" fill="none" stroke-width="12" stroke-linecap="round"></path>
|
|
593
|
-
<path class="gauge-fill" d="${h ?? "M0 0"}" fill="none" stroke="${h ?
|
|
593
|
+
<path class="gauge-fill" d="${h ?? "M0 0"}" fill="none" stroke="${h ? i : "none"}" stroke-width="12" stroke-linecap="round"></path>
|
|
594
594
|
</svg>
|
|
595
595
|
</div>
|
|
596
596
|
</div>
|
|
597
597
|
`;
|
|
598
598
|
}
|
|
599
599
|
renderProgress() {
|
|
600
|
-
const e = this.spec.data, t = Number(e.value ?? 0),
|
|
600
|
+
const e = this.spec.data, t = Number(e.value ?? 0), a = Number(e.max ?? this.spec.options?.max ?? 100), r = a > 0 ? Math.max(0, Math.min(100, t / a * 100)) : 0, i = this.getOptions(), s = this.getThresholdColor(t, i), n = this.formatLabel(t, r), d = typeof this.spec.title == "string" ? this.spec.title : "Progress";
|
|
601
601
|
return o`
|
|
602
602
|
<div class="progress-container" part="progress"
|
|
603
603
|
role="progressbar"
|
|
604
604
|
aria-valuenow=${t}
|
|
605
605
|
aria-valuemin=${0}
|
|
606
|
-
aria-valuemax=${
|
|
606
|
+
aria-valuemax=${a}
|
|
607
607
|
aria-label=${d}
|
|
608
608
|
>
|
|
609
609
|
<div class="progress-bar-track">
|
|
@@ -621,15 +621,15 @@ let N = class extends y {
|
|
|
621
621
|
`;
|
|
622
622
|
}
|
|
623
623
|
formatLabel(e, t) {
|
|
624
|
-
const
|
|
625
|
-
return
|
|
624
|
+
const a = this.spec.options;
|
|
625
|
+
return a?.label ? String(a.label).replace("{value}", String(e)).replace("{percent}", String(Math.round(t))) : String(e);
|
|
626
626
|
}
|
|
627
627
|
getThresholdColor(e, t) {
|
|
628
628
|
if (!t.thresholds?.length) return "var(--u-widget-primary, #4f46e5)";
|
|
629
|
-
const
|
|
630
|
-
for (const r of
|
|
629
|
+
const a = [...t.thresholds].sort((r, i) => r.to - i.to);
|
|
630
|
+
for (const r of a)
|
|
631
631
|
if (e <= r.to) return pe(r.color);
|
|
632
|
-
return pe(
|
|
632
|
+
return pe(a[a.length - 1].color);
|
|
633
633
|
}
|
|
634
634
|
};
|
|
635
635
|
N.styles = [b, w`
|
|
@@ -754,23 +754,23 @@ Q([
|
|
|
754
754
|
N = Q([
|
|
755
755
|
x("uw-gauge")
|
|
756
756
|
], N);
|
|
757
|
-
var qe = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, C = (e, t,
|
|
758
|
-
for (var
|
|
759
|
-
(n = e[s]) && (
|
|
760
|
-
return r &&
|
|
757
|
+
var qe = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, C = (e, t, a, r) => {
|
|
758
|
+
for (var i = r > 1 ? void 0 : r ? Be(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
759
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
760
|
+
return r && i && qe(t, a, i), i;
|
|
761
761
|
};
|
|
762
762
|
let _ = class extends y {
|
|
763
763
|
constructor() {
|
|
764
764
|
super(...arguments), this.spec = null, this.theme = null, this._sortField = null, this._sortDir = null, this._page = 0, this._searchQuery = "", this._focusedIdx = 0, this._onTableKeydown = (e) => {
|
|
765
|
-
const
|
|
766
|
-
if (!
|
|
767
|
-
const r =
|
|
765
|
+
const a = e.target.closest("tr");
|
|
766
|
+
if (!a) return;
|
|
767
|
+
const r = a.parentElement;
|
|
768
768
|
if (!r) return;
|
|
769
|
-
const
|
|
769
|
+
const i = Array.from(r.querySelectorAll("tr")), s = i.indexOf(a);
|
|
770
770
|
let n = -1;
|
|
771
771
|
switch (e.key) {
|
|
772
772
|
case "ArrowDown":
|
|
773
|
-
n = Math.min(s + 1,
|
|
773
|
+
n = Math.min(s + 1, i.length - 1);
|
|
774
774
|
break;
|
|
775
775
|
case "ArrowUp":
|
|
776
776
|
n = Math.max(s - 1, 0);
|
|
@@ -779,7 +779,7 @@ let _ = class extends y {
|
|
|
779
779
|
n = 0;
|
|
780
780
|
break;
|
|
781
781
|
case "End":
|
|
782
|
-
n =
|
|
782
|
+
n = i.length - 1;
|
|
783
783
|
break;
|
|
784
784
|
default:
|
|
785
785
|
return;
|
|
@@ -788,15 +788,15 @@ let _ = class extends y {
|
|
|
788
788
|
this.shadowRoot?.querySelectorAll("tbody tr")?.[n]?.focus();
|
|
789
789
|
}));
|
|
790
790
|
}, this._onListKeydown = (e) => {
|
|
791
|
-
const
|
|
792
|
-
if (!
|
|
793
|
-
const r =
|
|
791
|
+
const a = e.target.closest(".list-item");
|
|
792
|
+
if (!a) return;
|
|
793
|
+
const r = a.parentElement;
|
|
794
794
|
if (!r) return;
|
|
795
|
-
const
|
|
795
|
+
const i = Array.from(r.querySelectorAll(".list-item")), s = i.indexOf(a);
|
|
796
796
|
let n = -1;
|
|
797
797
|
switch (e.key) {
|
|
798
798
|
case "ArrowDown":
|
|
799
|
-
n = Math.min(s + 1,
|
|
799
|
+
n = Math.min(s + 1, i.length - 1);
|
|
800
800
|
break;
|
|
801
801
|
case "ArrowUp":
|
|
802
802
|
n = Math.max(s - 1, 0);
|
|
@@ -805,7 +805,7 @@ let _ = class extends y {
|
|
|
805
805
|
n = 0;
|
|
806
806
|
break;
|
|
807
807
|
case "End":
|
|
808
|
-
n =
|
|
808
|
+
n = i.length - 1;
|
|
809
809
|
break;
|
|
810
810
|
default:
|
|
811
811
|
return;
|
|
@@ -828,28 +828,28 @@ let _ = class extends y {
|
|
|
828
828
|
return me(typeof e == "string" ? e : void 0);
|
|
829
829
|
}
|
|
830
830
|
renderTable() {
|
|
831
|
-
const e = this.spec.data, t = this.getColumns(e),
|
|
831
|
+
const e = this.spec.data, t = this.getColumns(e), a = this._locale, r = this.spec.options?.sortable !== !1, i = !!this.spec.options?.searchable, s = !!this.spec.options?.compact, n = Number(this.spec.options?.pageSize) || 0, d = this._searchQuery ? this.filterData(e, t) : e, c = this._sortField && this._sortDir ? this.sortData(d) : d, p = n > 0 ? Math.max(1, Math.ceil(c.length / n)) : 1, g = Math.min(this._page, p - 1), m = n > 0 ? c.slice(g * n, (g + 1) * n) : c, u = i ? o`
|
|
832
832
|
<div class="search-box" part="search">
|
|
833
833
|
<input
|
|
834
834
|
class="search-input"
|
|
835
835
|
type="text"
|
|
836
|
-
placeholder=${
|
|
837
|
-
aria-label=${
|
|
836
|
+
placeholder=${a.searchPlaceholder}
|
|
837
|
+
aria-label=${a.searchTable}
|
|
838
838
|
.value=${this._searchQuery}
|
|
839
839
|
@input=${this._onSearch}
|
|
840
840
|
/>
|
|
841
841
|
</div>
|
|
842
842
|
` : l, h = n > 0 && p > 1 ? o`
|
|
843
|
-
<nav class="pagination" part="pagination" aria-label=${
|
|
844
|
-
<button aria-label=${
|
|
843
|
+
<nav class="pagination" part="pagination" aria-label=${a.tablePagination}>
|
|
844
|
+
<button aria-label=${a.previousPage} ?disabled=${g === 0} @click=${() => this._onPageChange(g - 1)}>${a.prev}</button>
|
|
845
845
|
<span aria-live="polite">${g + 1} / ${p}</span>
|
|
846
|
-
<button aria-label=${
|
|
846
|
+
<button aria-label=${a.nextPage} ?disabled=${g >= p - 1} @click=${() => this._onPageChange(g + 1)}>${a.next}</button>
|
|
847
847
|
</nav>
|
|
848
848
|
` : l;
|
|
849
849
|
return o`<div class="table-container${s ? " compact" : ""}">
|
|
850
850
|
${u}
|
|
851
851
|
<div class="table-wrapper" part="table">
|
|
852
|
-
<table aria-label=${this.spec.title ??
|
|
852
|
+
<table aria-label=${this.spec.title ?? a.dataTable}>
|
|
853
853
|
<thead>
|
|
854
854
|
<tr>
|
|
855
855
|
${t.map(
|
|
@@ -898,18 +898,18 @@ let _ = class extends y {
|
|
|
898
898
|
});
|
|
899
899
|
}
|
|
900
900
|
filterData(e, t) {
|
|
901
|
-
const
|
|
901
|
+
const a = this._searchQuery.toLowerCase(), r = t.map((i) => i.field);
|
|
902
902
|
return e.filter(
|
|
903
|
-
(
|
|
903
|
+
(i) => r.some((s) => String(i[s] ?? "").toLowerCase().includes(a))
|
|
904
904
|
);
|
|
905
905
|
}
|
|
906
906
|
_onSort(e) {
|
|
907
907
|
this._sortField === e ? this._sortDir === "asc" ? this._sortDir = "desc" : (this._sortField = null, this._sortDir = null) : (this._sortField = e, this._sortDir = "asc");
|
|
908
908
|
}
|
|
909
909
|
sortData(e) {
|
|
910
|
-
const t = this._sortField,
|
|
911
|
-
return [...e].sort((r,
|
|
912
|
-
const s = r[t], n =
|
|
910
|
+
const t = this._sortField, a = this._sortDir;
|
|
911
|
+
return [...e].sort((r, i) => {
|
|
912
|
+
const s = r[t], n = i[t];
|
|
913
913
|
if (s == null && n == null) return 0;
|
|
914
914
|
if (s == null) return 1;
|
|
915
915
|
if (n == null) return -1;
|
|
@@ -920,13 +920,13 @@ let _ = class extends y {
|
|
|
920
920
|
const c = Number(s), p = Number(n);
|
|
921
921
|
d = String(s) !== "" && String(n) !== "" && !isNaN(c) && !isNaN(p) ? c - p : String(s).localeCompare(String(n));
|
|
922
922
|
}
|
|
923
|
-
return
|
|
923
|
+
return a === "asc" ? d : -d;
|
|
924
924
|
});
|
|
925
925
|
}
|
|
926
926
|
renderList() {
|
|
927
|
-
const e = this.spec.data, t = this.spec.mapping,
|
|
927
|
+
const e = this.spec.data, t = this.spec.mapping, a = !!this.spec.options?.compact, r = t?.primary ?? this.inferPrimaryKey(e), i = t?.secondary, s = t?.icon, n = t?.avatar, d = t?.trailing, c = t?.badge;
|
|
928
928
|
return o`
|
|
929
|
-
<div class="list-container${
|
|
929
|
+
<div class="list-container${a ? " compact" : ""}" part="list" @keydown=${this._onListKeydown}>
|
|
930
930
|
${e.map(
|
|
931
931
|
(p, g) => o`
|
|
932
932
|
<div class="list-item" part="list-item"
|
|
@@ -939,7 +939,7 @@ let _ = class extends y {
|
|
|
939
939
|
${n && p[n] ? o`<img class="list-avatar" src=${String(p[n])} alt="" part="avatar" />` : s ? o`<div class="list-icon" part="icon">${this.getIconLetter(p[s])}</div>` : l}
|
|
940
940
|
<div class="list-content">
|
|
941
941
|
<div class="list-primary" part="primary">${p[r] ?? ""}</div>
|
|
942
|
-
${
|
|
942
|
+
${i ? o`<div class="list-secondary" part="secondary">${p[i] ?? ""}</div>` : l}
|
|
943
943
|
</div>
|
|
944
944
|
${c && p[c] != null ? o`<span class="list-badge" part="badge">${p[c]}</span>` : l}
|
|
945
945
|
${d && p[d] != null ? o`<div class="list-trailing" part="trailing">${p[d]}</div>` : l}
|
|
@@ -951,7 +951,7 @@ let _ = class extends y {
|
|
|
951
951
|
}
|
|
952
952
|
_onRowClick(e, t) {
|
|
953
953
|
if (!this.spec) return;
|
|
954
|
-
const
|
|
954
|
+
const a = {
|
|
955
955
|
type: "select",
|
|
956
956
|
widget: this.spec.widget,
|
|
957
957
|
id: this.spec.id,
|
|
@@ -959,7 +959,7 @@ let _ = class extends y {
|
|
|
959
959
|
};
|
|
960
960
|
this.dispatchEvent(
|
|
961
961
|
new CustomEvent("u-widget-internal", {
|
|
962
|
-
detail:
|
|
962
|
+
detail: a,
|
|
963
963
|
bubbles: !0,
|
|
964
964
|
composed: !0
|
|
965
965
|
})
|
|
@@ -970,8 +970,8 @@ let _ = class extends y {
|
|
|
970
970
|
}
|
|
971
971
|
inferPrimaryKey(e) {
|
|
972
972
|
if (e.length === 0) return "";
|
|
973
|
-
const t = Object.keys(e[0]),
|
|
974
|
-
for (const s of
|
|
973
|
+
const t = Object.keys(e[0]), a = ["name", "title", "label", "id", "key"];
|
|
974
|
+
for (const s of a)
|
|
975
975
|
if (t.includes(s)) return s;
|
|
976
976
|
const r = e[0];
|
|
977
977
|
return t.find((s) => typeof r[s] == "string") ?? t[0] ?? "";
|
|
@@ -1313,16 +1313,16 @@ C([
|
|
|
1313
1313
|
_ = C([
|
|
1314
1314
|
x("uw-table")
|
|
1315
1315
|
], _);
|
|
1316
|
-
var We = Object.defineProperty, He = Object.getOwnPropertyDescriptor, H = (e, t,
|
|
1317
|
-
for (var
|
|
1318
|
-
(n = e[s]) && (
|
|
1319
|
-
return r &&
|
|
1316
|
+
var We = Object.defineProperty, He = Object.getOwnPropertyDescriptor, H = (e, t, a, r) => {
|
|
1317
|
+
for (var i = r > 1 ? void 0 : r ? He(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1318
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
1319
|
+
return r && i && We(t, a, i), i;
|
|
1320
1320
|
};
|
|
1321
1321
|
let D = class extends y {
|
|
1322
1322
|
constructor() {
|
|
1323
1323
|
super(...arguments), this.spec = null, this.theme = null, this._formData = {}, this._errors = {}, this._onFormSubmit = (e) => {
|
|
1324
1324
|
e.preventDefault();
|
|
1325
|
-
const t = (this.spec?.actions ?? []).find((
|
|
1325
|
+
const t = (this.spec?.actions ?? []).find((a) => a.action === "submit");
|
|
1326
1326
|
t ? this._onAction(t) : this._validate() && this._emitEvent({
|
|
1327
1327
|
type: "submit",
|
|
1328
1328
|
widget: this.spec.widget,
|
|
@@ -1331,7 +1331,7 @@ let D = class extends y {
|
|
|
1331
1331
|
});
|
|
1332
1332
|
}, this._onConfirmKeydown = (e) => {
|
|
1333
1333
|
if (e.key === "Escape") {
|
|
1334
|
-
const t = (this.spec?.actions ?? []).find((
|
|
1334
|
+
const t = (this.spec?.actions ?? []).find((a) => a.action === "cancel");
|
|
1335
1335
|
t && this._onAction(t);
|
|
1336
1336
|
}
|
|
1337
1337
|
};
|
|
@@ -1346,7 +1346,7 @@ let D = class extends y {
|
|
|
1346
1346
|
const e = this.spec.fields ?? [], t = this.spec.actions ?? [];
|
|
1347
1347
|
return o`
|
|
1348
1348
|
<form class="form-container" part="form" @submit=${this._onFormSubmit}>
|
|
1349
|
-
${e.map((
|
|
1349
|
+
${e.map((a) => this.renderField(a))}
|
|
1350
1350
|
${t.length > 0 ? this.renderActions(t) : l}
|
|
1351
1351
|
</form>
|
|
1352
1352
|
`;
|
|
@@ -1361,31 +1361,31 @@ let D = class extends y {
|
|
|
1361
1361
|
`;
|
|
1362
1362
|
}
|
|
1363
1363
|
renderField(e) {
|
|
1364
|
-
const t = this._formData[e.field],
|
|
1364
|
+
const t = this._formData[e.field], a = e.type ?? "text", r = this._errors[e.field], i = `err-${e.field}`;
|
|
1365
1365
|
return o`
|
|
1366
1366
|
<div class="field" part="field">
|
|
1367
1367
|
${e.label ? o`<label class="field-label" for=${`input-${e.field}`} part="label"
|
|
1368
1368
|
>${e.label}${e.required ? o`<span class="required">*</span>` : l}</label
|
|
1369
1369
|
>` : l}
|
|
1370
|
-
${this.renderInput(e,
|
|
1371
|
-
${r ? o`<div class="field-error" id=${
|
|
1370
|
+
${this.renderInput(e, a, t, r ? i : void 0)}
|
|
1371
|
+
${r ? o`<div class="field-error" id=${i} role="alert" part="field-error">${r}</div>` : l}
|
|
1372
1372
|
</div>
|
|
1373
1373
|
`;
|
|
1374
1374
|
}
|
|
1375
|
-
renderInput(e, t,
|
|
1376
|
-
const
|
|
1375
|
+
renderInput(e, t, a, r) {
|
|
1376
|
+
const i = !!this._errors[e.field];
|
|
1377
1377
|
switch (t) {
|
|
1378
1378
|
case "textarea":
|
|
1379
1379
|
return o`<textarea
|
|
1380
1380
|
id=${`input-${e.field}`}
|
|
1381
|
-
class=${
|
|
1382
|
-
.value=${String(
|
|
1381
|
+
class=${i ? "invalid" : ""}
|
|
1382
|
+
.value=${String(a ?? "")}
|
|
1383
1383
|
placeholder=${e.placeholder ?? ""}
|
|
1384
1384
|
rows=${e.rows ?? 3}
|
|
1385
1385
|
?required=${e.required}
|
|
1386
1386
|
minlength=${e.minLength ?? ""}
|
|
1387
1387
|
maxlength=${e.maxLength ?? ""}
|
|
1388
|
-
aria-invalid=${
|
|
1388
|
+
aria-invalid=${i ? "true" : "false"}
|
|
1389
1389
|
aria-describedby=${r ?? l}
|
|
1390
1390
|
?aria-required=${e.required}
|
|
1391
1391
|
@input=${(s) => this._onChange(e.field, s.target.value)}
|
|
@@ -1394,10 +1394,10 @@ let D = class extends y {
|
|
|
1394
1394
|
case "select":
|
|
1395
1395
|
return o`<select
|
|
1396
1396
|
id=${`input-${e.field}`}
|
|
1397
|
-
class=${
|
|
1398
|
-
.value=${String(
|
|
1397
|
+
class=${i ? "invalid" : ""}
|
|
1398
|
+
.value=${String(a ?? "")}
|
|
1399
1399
|
?required=${e.required}
|
|
1400
|
-
aria-invalid=${
|
|
1400
|
+
aria-invalid=${i ? "true" : "false"}
|
|
1401
1401
|
aria-describedby=${r ?? l}
|
|
1402
1402
|
@change=${(s) => this._onChange(e.field, s.target.value)}
|
|
1403
1403
|
part="input"
|
|
@@ -1408,16 +1408,16 @@ let D = class extends y {
|
|
|
1408
1408
|
)}
|
|
1409
1409
|
</select>`;
|
|
1410
1410
|
case "multiselect":
|
|
1411
|
-
return o`<div class="multiselect-group" part="multiselect-group" role="group" aria-label=${e.label ?? e.field} aria-invalid=${
|
|
1411
|
+
return o`<div class="multiselect-group" part="multiselect-group" role="group" aria-label=${e.label ?? e.field} aria-invalid=${i ? "true" : "false"} aria-describedby=${r ?? l}>
|
|
1412
1412
|
${(e.options ?? []).map(
|
|
1413
1413
|
(s) => o`
|
|
1414
1414
|
<label>
|
|
1415
1415
|
<input
|
|
1416
1416
|
type="checkbox"
|
|
1417
1417
|
value=${s}
|
|
1418
|
-
?checked=${Array.isArray(
|
|
1418
|
+
?checked=${Array.isArray(a) && a.includes(s)}
|
|
1419
1419
|
@change=${(n) => {
|
|
1420
|
-
const d = n.target.checked, c = Array.isArray(
|
|
1420
|
+
const d = n.target.checked, c = Array.isArray(a) ? [...a] : [];
|
|
1421
1421
|
this._onChange(
|
|
1422
1422
|
e.field,
|
|
1423
1423
|
d ? [...c, s] : c.filter((p) => p !== s)
|
|
@@ -1433,14 +1433,14 @@ let D = class extends y {
|
|
|
1433
1433
|
return o`<div class="toggle-wrapper">
|
|
1434
1434
|
<div
|
|
1435
1435
|
class="toggle-track"
|
|
1436
|
-
data-on=${!!
|
|
1436
|
+
data-on=${!!a}
|
|
1437
1437
|
role="switch"
|
|
1438
|
-
aria-checked=${!!
|
|
1438
|
+
aria-checked=${!!a}
|
|
1439
1439
|
aria-label=${e.label ?? e.field}
|
|
1440
1440
|
tabindex="0"
|
|
1441
|
-
@click=${() => this._onChange(e.field, !
|
|
1441
|
+
@click=${() => this._onChange(e.field, !a)}
|
|
1442
1442
|
@keydown=${(s) => {
|
|
1443
|
-
(s.key === " " || s.key === "Enter") && (s.preventDefault(), this._onChange(e.field, !
|
|
1443
|
+
(s.key === " " || s.key === "Enter") && (s.preventDefault(), this._onChange(e.field, !a));
|
|
1444
1444
|
}}
|
|
1445
1445
|
part="toggle"
|
|
1446
1446
|
>
|
|
@@ -1448,7 +1448,7 @@ let D = class extends y {
|
|
|
1448
1448
|
</div>
|
|
1449
1449
|
</div>`;
|
|
1450
1450
|
case "radio":
|
|
1451
|
-
return o`<div class="radio-group" part="radio-group" role="radiogroup" aria-label=${e.label ?? e.field} aria-invalid=${
|
|
1451
|
+
return o`<div class="radio-group" part="radio-group" role="radiogroup" aria-label=${e.label ?? e.field} aria-invalid=${i ? "true" : "false"} aria-describedby=${r ?? l}>
|
|
1452
1452
|
${(e.options ?? []).map(
|
|
1453
1453
|
(s) => o`
|
|
1454
1454
|
<label>
|
|
@@ -1456,7 +1456,7 @@ let D = class extends y {
|
|
|
1456
1456
|
type="radio"
|
|
1457
1457
|
name=${e.field}
|
|
1458
1458
|
value=${s}
|
|
1459
|
-
?checked=${
|
|
1459
|
+
?checked=${a === s}
|
|
1460
1460
|
@change=${() => this._onChange(e.field, s)}
|
|
1461
1461
|
/>
|
|
1462
1462
|
${s}
|
|
@@ -1465,16 +1465,16 @@ let D = class extends y {
|
|
|
1465
1465
|
)}
|
|
1466
1466
|
</div>`;
|
|
1467
1467
|
case "checkbox":
|
|
1468
|
-
return o`<div class="checkbox-group" part="checkbox-group" role="group" aria-label=${e.label ?? e.field} aria-invalid=${
|
|
1468
|
+
return o`<div class="checkbox-group" part="checkbox-group" role="group" aria-label=${e.label ?? e.field} aria-invalid=${i ? "true" : "false"} aria-describedby=${r ?? l}>
|
|
1469
1469
|
${(e.options ?? []).map(
|
|
1470
1470
|
(s) => o`
|
|
1471
1471
|
<label>
|
|
1472
1472
|
<input
|
|
1473
1473
|
type="checkbox"
|
|
1474
1474
|
value=${s}
|
|
1475
|
-
?checked=${Array.isArray(
|
|
1475
|
+
?checked=${Array.isArray(a) && a.includes(s)}
|
|
1476
1476
|
@change=${(n) => {
|
|
1477
|
-
const d = n.target.checked, c = Array.isArray(
|
|
1477
|
+
const d = n.target.checked, c = Array.isArray(a) ? [...a] : [];
|
|
1478
1478
|
this._onChange(
|
|
1479
1479
|
e.field,
|
|
1480
1480
|
d ? [...c, s] : c.filter((p) => p !== s)
|
|
@@ -1490,11 +1490,11 @@ let D = class extends y {
|
|
|
1490
1490
|
return o`<input
|
|
1491
1491
|
type=${t === "datetime" ? "datetime-local" : t}
|
|
1492
1492
|
id=${`input-${e.field}`}
|
|
1493
|
-
class=${
|
|
1494
|
-
.value=${String(
|
|
1493
|
+
class=${i ? "invalid" : ""}
|
|
1494
|
+
.value=${String(a ?? "")}
|
|
1495
1495
|
placeholder=${e.placeholder ?? ""}
|
|
1496
1496
|
?required=${e.required}
|
|
1497
|
-
aria-invalid=${
|
|
1497
|
+
aria-invalid=${i ? "true" : "false"}
|
|
1498
1498
|
aria-describedby=${r ?? l}
|
|
1499
1499
|
?aria-required=${e.required}
|
|
1500
1500
|
min=${e.min ?? ""}
|
|
@@ -1520,8 +1520,8 @@ let D = class extends y {
|
|
|
1520
1520
|
type=${t.action === "submit" ? "submit" : "button"}
|
|
1521
1521
|
data-style=${t.style ?? "default"}
|
|
1522
1522
|
?disabled=${t.disabled}
|
|
1523
|
-
@click=${(
|
|
1524
|
-
t.action === "submit" &&
|
|
1523
|
+
@click=${(a) => {
|
|
1524
|
+
t.action === "submit" && a.preventDefault(), this._onAction(t);
|
|
1525
1525
|
}}
|
|
1526
1526
|
part="action-btn"
|
|
1527
1527
|
>
|
|
@@ -1534,8 +1534,8 @@ let D = class extends y {
|
|
|
1534
1534
|
}
|
|
1535
1535
|
_onChange(e, t) {
|
|
1536
1536
|
if (this._formData = { ...this._formData, [e]: t }, this._errors[e]) {
|
|
1537
|
-
const
|
|
1538
|
-
delete
|
|
1537
|
+
const a = { ...this._errors };
|
|
1538
|
+
delete a[e], this._errors = a;
|
|
1539
1539
|
}
|
|
1540
1540
|
this._emitEvent({
|
|
1541
1541
|
type: "change",
|
|
@@ -1549,29 +1549,29 @@ let D = class extends y {
|
|
|
1549
1549
|
return me(typeof e == "string" ? e : void 0);
|
|
1550
1550
|
}
|
|
1551
1551
|
_validate() {
|
|
1552
|
-
const e = this.spec?.fields ?? [], t = {},
|
|
1552
|
+
const e = this.spec?.fields ?? [], t = {}, a = this._locale;
|
|
1553
1553
|
for (const r of e) {
|
|
1554
|
-
const
|
|
1555
|
-
if (r.required && (
|
|
1556
|
-
t[r.field] = r.message ?? A(
|
|
1554
|
+
const i = this._formData[r.field], s = r.label ?? r.field;
|
|
1555
|
+
if (r.required && (i == null || i === "" || Array.isArray(i) && i.length === 0)) {
|
|
1556
|
+
t[r.field] = r.message ?? A(a.required, { label: s });
|
|
1557
1557
|
continue;
|
|
1558
1558
|
}
|
|
1559
|
-
if (!(
|
|
1560
|
-
if (r.maxLength != null && typeof
|
|
1561
|
-
t[r.field] = r.message ?? A(
|
|
1559
|
+
if (!(i == null || i === "")) {
|
|
1560
|
+
if (r.maxLength != null && typeof i == "string" && i.length > r.maxLength && (t[r.field] = r.message ?? A(a.maxLength, { label: s, max: r.maxLength })), r.min != null && typeof i == "number" && i < Number(r.min) && (t[r.field] = r.message ?? A(a.minValue, { label: s, min: r.min })), r.max != null && typeof i == "number" && i > Number(r.max) && (t[r.field] = r.message ?? A(a.maxValue, { label: s, max: r.max })), r.minLength != null && typeof i == "string" && i.length < r.minLength) {
|
|
1561
|
+
t[r.field] = r.message ?? A(a.minLength, { label: s, min: r.minLength });
|
|
1562
1562
|
continue;
|
|
1563
1563
|
}
|
|
1564
|
-
if (r.type === "email" && typeof
|
|
1565
|
-
t[r.field] = r.message ?? A(
|
|
1564
|
+
if (r.type === "email" && typeof i == "string" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)) {
|
|
1565
|
+
t[r.field] = r.message ?? A(a.invalidEmail, { label: s });
|
|
1566
1566
|
continue;
|
|
1567
1567
|
}
|
|
1568
|
-
if (r.type === "url" && typeof
|
|
1569
|
-
t[r.field] = r.message ?? A(
|
|
1568
|
+
if (r.type === "url" && typeof i == "string" && !/^https?:\/\/.+/.test(i)) {
|
|
1569
|
+
t[r.field] = r.message ?? A(a.invalidUrl, { label: s });
|
|
1570
1570
|
continue;
|
|
1571
1571
|
}
|
|
1572
|
-
if (r.pattern && typeof
|
|
1572
|
+
if (r.pattern && typeof i == "string")
|
|
1573
1573
|
try {
|
|
1574
|
-
new RegExp(r.pattern).test(
|
|
1574
|
+
new RegExp(r.pattern).test(i) || (t[r.field] = r.message ?? A(a.invalidPattern, { label: s }));
|
|
1575
1575
|
} catch {
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
@@ -1843,10 +1843,10 @@ H([
|
|
|
1843
1843
|
D = H([
|
|
1844
1844
|
x("uw-form")
|
|
1845
1845
|
], D);
|
|
1846
|
-
var Ke = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, ee = (e, t,
|
|
1847
|
-
for (var
|
|
1848
|
-
(n = e[s]) && (
|
|
1849
|
-
return r &&
|
|
1846
|
+
var Ke = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, ee = (e, t, a, r) => {
|
|
1847
|
+
for (var i = r > 1 ? void 0 : r ? Ve(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1848
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
1849
|
+
return r && i && Ke(t, a, i), i;
|
|
1850
1850
|
};
|
|
1851
1851
|
let F = class extends y {
|
|
1852
1852
|
constructor() {
|
|
@@ -1854,27 +1854,27 @@ let F = class extends y {
|
|
|
1854
1854
|
}
|
|
1855
1855
|
render() {
|
|
1856
1856
|
if (!this.spec) return l;
|
|
1857
|
-
const e = this.spec.layout ?? "stack", t = this.spec.columns ?? 2,
|
|
1857
|
+
const e = this.spec.layout ?? "stack", t = this.spec.columns ?? 2, a = this.spec.children ?? [], r = this.spec.title, i = a.map((n) => this._child(n)), s = r ? "region" : void 0;
|
|
1858
1858
|
if (e === "row")
|
|
1859
|
-
return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-row" part="layout">${
|
|
1859
|
+
return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-row" part="layout">${i}</div></div>`;
|
|
1860
1860
|
if (e === "grid") {
|
|
1861
1861
|
const n = this._gridColumns(t);
|
|
1862
|
-
return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-grid" part="layout" style="grid-template-columns: ${n}">${
|
|
1862
|
+
return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-grid" part="layout" style="grid-template-columns: ${n}">${i}</div></div>`;
|
|
1863
1863
|
}
|
|
1864
|
-
return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-stack" part="layout">${
|
|
1864
|
+
return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-stack" part="layout">${i}</div></div>`;
|
|
1865
1865
|
}
|
|
1866
1866
|
/** Compute grid-template-columns from options.widths or fallback to equal columns. */
|
|
1867
1867
|
_gridColumns(e) {
|
|
1868
|
-
const
|
|
1869
|
-
return !Array.isArray(
|
|
1868
|
+
const a = (this.spec?.options ?? {}).widths;
|
|
1869
|
+
return !Array.isArray(a) || a.length === 0 ? `repeat(${e}, 1fr)` : a.map((r) => {
|
|
1870
1870
|
if (r === "auto") return "auto";
|
|
1871
1871
|
if (r === "stretch") return "1fr";
|
|
1872
|
-
const
|
|
1873
|
-
return Number.isFinite(
|
|
1872
|
+
const i = Number(r);
|
|
1873
|
+
return Number.isFinite(i) && i > 0 ? `${i}fr` : "1fr";
|
|
1874
1874
|
}).join(" ");
|
|
1875
1875
|
}
|
|
1876
1876
|
_child(e) {
|
|
1877
|
-
const t = this.theme,
|
|
1877
|
+
const t = this.theme, a = e.span ? Math.max(1, Math.floor(Number(e.span) || 1)) : 0, r = a > 1 ? `grid-column: span ${a}` : "", s = !!(this.spec?.options ?? {}).card, n = o`<u-widget .spec=${e} theme=${t ?? l}></u-widget>`;
|
|
1878
1878
|
if (e.collapsed) {
|
|
1879
1879
|
const c = e.title || "Details";
|
|
1880
1880
|
return o`
|
|
@@ -1998,10 +1998,10 @@ ee([
|
|
|
1998
1998
|
F = ee([
|
|
1999
1999
|
x("uw-compose")
|
|
2000
2000
|
], F);
|
|
2001
|
-
var Ge = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, te = (e, t,
|
|
2002
|
-
for (var
|
|
2003
|
-
(n = e[s]) && (
|
|
2004
|
-
return r &&
|
|
2001
|
+
var Ge = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, te = (e, t, a, r) => {
|
|
2002
|
+
for (var i = r > 1 ? void 0 : r ? Xe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2003
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
2004
|
+
return r && i && Ge(t, a, i), i;
|
|
2005
2005
|
};
|
|
2006
2006
|
let M = class extends y {
|
|
2007
2007
|
constructor() {
|
|
@@ -2029,16 +2029,16 @@ let M = class extends y {
|
|
|
2029
2029
|
renderImage() {
|
|
2030
2030
|
const e = this.spec.data;
|
|
2031
2031
|
if (!e) return l;
|
|
2032
|
-
const t = String(e.src ?? ""),
|
|
2033
|
-
return
|
|
2034
|
-
<img src=${
|
|
2032
|
+
const t = String(e.src ?? ""), a = String(e.alt ?? ""), r = e.caption, i = this.sanitizeUrl(t);
|
|
2033
|
+
return i ? o`<div class="image-container" part="image">
|
|
2034
|
+
<img src=${i} alt=${a} loading="lazy" />
|
|
2035
2035
|
${r ? o`<div class="image-caption" part="caption">${r}</div>` : l}
|
|
2036
2036
|
</div>` : l;
|
|
2037
2037
|
}
|
|
2038
2038
|
renderCallout() {
|
|
2039
2039
|
const e = this.spec.data;
|
|
2040
2040
|
if (!e) return l;
|
|
2041
|
-
const t = String(e.message ?? ""),
|
|
2041
|
+
const t = String(e.message ?? ""), a = String(e.level ?? "info"), r = e.title, s = ["info", "warning", "error", "success"].includes(a) ? a : "info", n = s === "warning" || s === "error";
|
|
2042
2042
|
return o`<div class="callout callout-${s}" part="callout" role=${n ? "alert" : "note"} aria-live=${n ? "assertive" : "polite"}>
|
|
2043
2043
|
${r ? o`<div class="callout-title" part="callout-title">${r}</div>` : l}
|
|
2044
2044
|
<div part="callout-message">${t}</div>
|
|
@@ -2050,17 +2050,17 @@ let M = class extends y {
|
|
|
2050
2050
|
*/
|
|
2051
2051
|
parseMarkdown(e) {
|
|
2052
2052
|
let t = this.escapeHtml(e);
|
|
2053
|
-
return t = t.replace(/^#### (.+)$/gm, "<h4>$1</h4>"), t = t.replace(/^### (.+)$/gm, "<h3>$1</h3>"), t = t.replace(/^## (.+)$/gm, "<h2>$1</h2>"), t = t.replace(/^# (.+)$/gm, "<h1>$1</h1>"), t = t.replace(/^---$/gm, "<hr>"), t = t.replace(/```[\s\S]*?```/g, (
|
|
2053
|
+
return t = t.replace(/^#### (.+)$/gm, "<h4>$1</h4>"), t = t.replace(/^### (.+)$/gm, "<h3>$1</h3>"), t = t.replace(/^## (.+)$/gm, "<h2>$1</h2>"), t = t.replace(/^# (.+)$/gm, "<h1>$1</h1>"), t = t.replace(/^---$/gm, "<hr>"), t = t.replace(/```[\s\S]*?```/g, (a) => `<pre><code>${a.slice(3, -3).replace(/^\w*\n/, "")}</code></pre>`), t = t.replace(
|
|
2054
2054
|
/^(\|.+\|)\n(\|[\s:|-]+\|)\n((?:\|.+\|\n?)+)/gm,
|
|
2055
|
-
(
|
|
2056
|
-
const n = (u) => u.split("|").slice(1, -1).map((h) => h.trim()), d = n(r), c = n(
|
|
2055
|
+
(a, r, i, s) => {
|
|
2056
|
+
const n = (u) => u.split("|").slice(1, -1).map((h) => h.trim()), d = n(r), c = n(i).map((u) => u.startsWith(":") && u.endsWith(":") ? "center" : u.endsWith(":") ? "right" : "left"), p = s.trim().split(`
|
|
2057
2057
|
`).map(n), g = d.map((u, h) => `<th scope="col" style="text-align:${c[h] ?? "left"}">${u}</th>`).join(""), m = p.map((u) => "<tr>" + u.map((h, v) => `<td style="text-align:${c[v] ?? "left"}">${h}</td>`).join("") + "</tr>").join("");
|
|
2058
2058
|
return `<table><thead><tr>${g}</tr></thead><tbody>${m}</tbody></table>`;
|
|
2059
2059
|
}
|
|
2060
2060
|
), t = t.replace(/`([^`]+)`/g, "<code>$1</code>"), t = t.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>"), t = t.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), t = t.replace(/\*(.+?)\*/g, "<em>$1</em>"), t = t.replace(
|
|
2061
2061
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
2062
|
-
(
|
|
2063
|
-
), t = t.replace(/^> (.+)$/gm, "<blockquote>$1</blockquote>"), t = t.replace(/^\d+\. (.+)$/gm, "<li data-ol>$1</li>"), t = t.replace(/(<li data-ol>.*<\/li>\n?)+/g, (
|
|
2062
|
+
(a, r, i) => `<a href="${this.sanitizeUrl(i)}" target="_blank" rel="noopener">${r}</a>`
|
|
2063
|
+
), t = t.replace(/^> (.+)$/gm, "<blockquote>$1</blockquote>"), t = t.replace(/^\d+\. (.+)$/gm, "<li data-ol>$1</li>"), t = t.replace(/(<li data-ol>.*<\/li>\n?)+/g, (a) => `<ol>${a.replace(/ data-ol/g, "")}</ol>`), t = t.replace(/^- (.+)$/gm, "<li>$1</li>"), t = t.replace(/(<li>.*<\/li>\n?)+/g, "<ul>$&</ul>"), t = t.replace(/\n\n+/g, "</p><p>"), !t.startsWith("<h") && !t.startsWith("<ul") && !t.startsWith("<ol") && !t.startsWith("<pre") && !t.startsWith("<blockquote") && !t.startsWith("<hr") && (t = `<p>${t}</p>`), t = t.replace(/<pre>[\s\S]*?<\/pre>/g, (a) => a.replace(/\n/g, "\0NL\0")), t = t.replace(/\n/g, "<br>"), t = t.replace(/\x00NL\x00/g, `
|
|
2064
2064
|
`), t;
|
|
2065
2065
|
}
|
|
2066
2066
|
sanitizeUrl(e) {
|
|
@@ -2201,26 +2201,26 @@ M.styles = [b, w`
|
|
|
2201
2201
|
}
|
|
2202
2202
|
|
|
2203
2203
|
.callout-info {
|
|
2204
|
-
background: color-mix(in srgb, var(--u-widget-primary, #
|
|
2205
|
-
border-left-color: var(--u-widget-primary, #
|
|
2204
|
+
background: color-mix(in srgb, var(--u-widget-primary, #4f46e5) 12%, var(--u-widget-bg, #fff));
|
|
2205
|
+
border-left-color: var(--u-widget-primary, #4f46e5);
|
|
2206
2206
|
color: var(--u-widget-text, #1a1a2e);
|
|
2207
2207
|
}
|
|
2208
2208
|
|
|
2209
2209
|
.callout-warning {
|
|
2210
|
-
background: color-mix(in srgb, var(--u-widget-warning, #
|
|
2211
|
-
border-left-color: var(--u-widget-warning, #
|
|
2210
|
+
background: color-mix(in srgb, var(--u-widget-warning, #d97706) 12%, var(--u-widget-bg, #fff));
|
|
2211
|
+
border-left-color: var(--u-widget-warning, #d97706);
|
|
2212
2212
|
color: var(--u-widget-text, #1a1a2e);
|
|
2213
2213
|
}
|
|
2214
2214
|
|
|
2215
2215
|
.callout-error {
|
|
2216
|
-
background: color-mix(in srgb, var(--u-widget-negative, #
|
|
2217
|
-
border-left-color: var(--u-widget-negative, #
|
|
2216
|
+
background: color-mix(in srgb, var(--u-widget-negative, #dc2626) 12%, var(--u-widget-bg, #fff));
|
|
2217
|
+
border-left-color: var(--u-widget-negative, #dc2626);
|
|
2218
2218
|
color: var(--u-widget-text, #1a1a2e);
|
|
2219
2219
|
}
|
|
2220
2220
|
|
|
2221
2221
|
.callout-success {
|
|
2222
|
-
background: color-mix(in srgb, var(--u-widget-positive, #
|
|
2223
|
-
border-left-color: var(--u-widget-positive, #
|
|
2222
|
+
background: color-mix(in srgb, var(--u-widget-positive, #16a34a) 12%, var(--u-widget-bg, #fff));
|
|
2223
|
+
border-left-color: var(--u-widget-positive, #16a34a);
|
|
2224
2224
|
color: var(--u-widget-text, #1a1a2e);
|
|
2225
2225
|
}
|
|
2226
2226
|
|
|
@@ -2257,10 +2257,10 @@ te([
|
|
|
2257
2257
|
M = te([
|
|
2258
2258
|
x("uw-content")
|
|
2259
2259
|
], M);
|
|
2260
|
-
var Je = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, re = (e, t,
|
|
2261
|
-
for (var
|
|
2262
|
-
(n = e[s]) && (
|
|
2263
|
-
return r &&
|
|
2260
|
+
var Je = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, re = (e, t, a, r) => {
|
|
2261
|
+
for (var i = r > 1 ? void 0 : r ? Ye(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2262
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
2263
|
+
return r && i && Je(t, a, i), i;
|
|
2264
2264
|
};
|
|
2265
2265
|
let T = class extends y {
|
|
2266
2266
|
constructor() {
|
|
@@ -2270,11 +2270,11 @@ let T = class extends y {
|
|
|
2270
2270
|
if (!this.spec) return l;
|
|
2271
2271
|
const e = this._extractPairs();
|
|
2272
2272
|
if (e.length === 0) return l;
|
|
2273
|
-
const t = this.spec.options ?? {},
|
|
2273
|
+
const t = this.spec.options ?? {}, a = String(t.layout ?? "vertical"), r = Number(t.columns ?? 2), i = a === "grid" ? `grid-template-columns: repeat(${r}, 1fr)` : "";
|
|
2274
2274
|
return o`
|
|
2275
2275
|
<div
|
|
2276
|
-
class=${`kv-${
|
|
2277
|
-
style=${
|
|
2276
|
+
class=${`kv-${a === "grid" ? "grid" : a === "horizontal" ? "horizontal" : "vertical"}`}
|
|
2277
|
+
style=${i}
|
|
2278
2278
|
part="kv"
|
|
2279
2279
|
role="list"
|
|
2280
2280
|
aria-label=${this.spec.title ?? "Key-value pairs"}
|
|
@@ -2396,10 +2396,10 @@ re([
|
|
|
2396
2396
|
T = re([
|
|
2397
2397
|
x("uw-kv")
|
|
2398
2398
|
], T);
|
|
2399
|
-
var Ze = Object.defineProperty, Qe = Object.getOwnPropertyDescriptor, G = (e, t,
|
|
2400
|
-
for (var
|
|
2401
|
-
(n = e[s]) && (
|
|
2402
|
-
return r &&
|
|
2399
|
+
var Ze = Object.defineProperty, Qe = Object.getOwnPropertyDescriptor, G = (e, t, a, r) => {
|
|
2400
|
+
for (var i = r > 1 ? void 0 : r ? Qe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2401
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
2402
|
+
return r && i && Ze(t, a, i), i;
|
|
2403
2403
|
};
|
|
2404
2404
|
const et = {
|
|
2405
2405
|
javascript: ["//", ["/*", "*/"]],
|
|
@@ -2443,11 +2443,11 @@ const et = {
|
|
|
2443
2443
|
psql: "sql",
|
|
2444
2444
|
mysql: "sql"
|
|
2445
2445
|
}, ge = /* @__PURE__ */ new Map();
|
|
2446
|
-
function
|
|
2446
|
+
function at(e) {
|
|
2447
2447
|
let t = ge.get(e);
|
|
2448
2448
|
if (!t) {
|
|
2449
|
-
const
|
|
2450
|
-
t =
|
|
2449
|
+
const a = tt[e] || "";
|
|
2450
|
+
t = a ? new Set(a.split(" ")) : /* @__PURE__ */ new Set(), ge.set(e, t);
|
|
2451
2451
|
}
|
|
2452
2452
|
return t;
|
|
2453
2453
|
}
|
|
@@ -2455,31 +2455,31 @@ function z(e) {
|
|
|
2455
2455
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2456
2456
|
}
|
|
2457
2457
|
function j(e, t) {
|
|
2458
|
-
const
|
|
2459
|
-
return
|
|
2460
|
-
`) ?
|
|
2458
|
+
const a = z(e);
|
|
2459
|
+
return a.includes(`
|
|
2460
|
+
`) ? a.split(`
|
|
2461
2461
|
`).map((r) => `<span class="hl-${t}">${r}</span>`).join(`
|
|
2462
|
-
`) : `<span class="hl-${t}">${
|
|
2462
|
+
`) : `<span class="hl-${t}">${a}</span>`;
|
|
2463
2463
|
}
|
|
2464
|
-
function ve(e, t,
|
|
2464
|
+
function ve(e, t, a) {
|
|
2465
2465
|
let r = t + 1;
|
|
2466
2466
|
for (; r < e.length; ) {
|
|
2467
2467
|
if (e[r] === "\\") {
|
|
2468
2468
|
r += 2;
|
|
2469
2469
|
continue;
|
|
2470
2470
|
}
|
|
2471
|
-
if (e[r] ===
|
|
2472
|
-
if (
|
|
2471
|
+
if (e[r] === a) return r + 1;
|
|
2472
|
+
if (a !== "`" && e[r] === `
|
|
2473
2473
|
`) return r;
|
|
2474
2474
|
r++;
|
|
2475
2475
|
}
|
|
2476
2476
|
return e.length;
|
|
2477
2477
|
}
|
|
2478
|
-
function
|
|
2478
|
+
function it(e, t) {
|
|
2479
2479
|
if (!t) return z(e);
|
|
2480
|
-
const
|
|
2481
|
-
if (
|
|
2482
|
-
const r =
|
|
2480
|
+
const a = rt[t] || t;
|
|
2481
|
+
if (a === "json") return st(e);
|
|
2482
|
+
const r = at(a), i = et[a], s = i?.[0], n = i?.[1], d = a === "javascript" || a === "typescript";
|
|
2483
2483
|
let c = "", p = 0;
|
|
2484
2484
|
const g = e.length;
|
|
2485
2485
|
for (; p < g; ) {
|
|
@@ -2513,14 +2513,14 @@ function at(e, t) {
|
|
|
2513
2513
|
c += r.has(h) ? `<span class="hl-k">${z(h)}</span>` : z(h), p = u;
|
|
2514
2514
|
continue;
|
|
2515
2515
|
}
|
|
2516
|
-
if (
|
|
2516
|
+
if (a === "html" && m === "<" && p + 1 < g && /[a-zA-Z/!]/.test(e[p + 1])) {
|
|
2517
2517
|
const u = e.indexOf(">", p);
|
|
2518
2518
|
if (u !== -1) {
|
|
2519
2519
|
c += `<span class="hl-k">${z(e.slice(p, u + 1))}</span>`, p = u + 1;
|
|
2520
2520
|
continue;
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
|
-
if (
|
|
2523
|
+
if (a === "css" && /[a-z-]/.test(m)) {
|
|
2524
2524
|
let u = p + 1;
|
|
2525
2525
|
for (; u < g && /[a-z-]/.test(e[u]); ) u++;
|
|
2526
2526
|
const h = e.slice(p, u);
|
|
@@ -2532,28 +2532,28 @@ function at(e, t) {
|
|
|
2532
2532
|
return c;
|
|
2533
2533
|
}
|
|
2534
2534
|
function st(e) {
|
|
2535
|
-
let t = "",
|
|
2535
|
+
let t = "", a = 0;
|
|
2536
2536
|
const r = e.length;
|
|
2537
|
-
for (;
|
|
2538
|
-
const
|
|
2539
|
-
if (
|
|
2540
|
-
const n = ve(e,
|
|
2541
|
-
t += j(d, c[0] === ":" ? "k" : "s"),
|
|
2537
|
+
for (; a < r; ) {
|
|
2538
|
+
const i = e[a];
|
|
2539
|
+
if (i === '"') {
|
|
2540
|
+
const n = ve(e, a, '"'), d = e.slice(a, n), c = e.slice(n).trimStart();
|
|
2541
|
+
t += j(d, c[0] === ":" ? "k" : "s"), a = n;
|
|
2542
2542
|
continue;
|
|
2543
2543
|
}
|
|
2544
|
-
if (/[\d-]/.test(
|
|
2545
|
-
let n =
|
|
2544
|
+
if (/[\d-]/.test(i) && (a === 0 || /[\s,:\[{]/.test(e[a - 1]))) {
|
|
2545
|
+
let n = a + 1;
|
|
2546
2546
|
for (; n < r && /[0-9.eE+\-]/.test(e[n]); ) n++;
|
|
2547
|
-
t += j(e.slice(
|
|
2547
|
+
t += j(e.slice(a, n), "n"), a = n;
|
|
2548
2548
|
continue;
|
|
2549
2549
|
}
|
|
2550
2550
|
let s = !1;
|
|
2551
2551
|
for (const n of ["true", "false", "null"])
|
|
2552
|
-
if (e.startsWith(n,
|
|
2553
|
-
t += `<span class="hl-k">${n}</span>`,
|
|
2552
|
+
if (e.startsWith(n, a)) {
|
|
2553
|
+
t += `<span class="hl-k">${n}</span>`, a += n.length, s = !0;
|
|
2554
2554
|
break;
|
|
2555
2555
|
}
|
|
2556
|
-
s || (t += z(
|
|
2556
|
+
s || (t += z(i), a++);
|
|
2557
2557
|
}
|
|
2558
2558
|
return t;
|
|
2559
2559
|
}
|
|
@@ -2567,17 +2567,17 @@ let O = class extends y {
|
|
|
2567
2567
|
if (!e) return l;
|
|
2568
2568
|
const t = String(e.content ?? "");
|
|
2569
2569
|
if (!t) return l;
|
|
2570
|
-
const
|
|
2570
|
+
const a = String(e.language ?? "").toLowerCase(), r = this.spec.options ?? {}, i = r.lineNumbers !== !1, s = !!(r.wrap ?? !1), n = r.maxHeight ? String(r.maxHeight) : void 0, d = new Set(
|
|
2571
2571
|
Array.isArray(r.highlight) ? r.highlight : []
|
|
2572
|
-
), g =
|
|
2572
|
+
), g = it(t, a).split(`
|
|
2573
2573
|
`).map((u, h) => {
|
|
2574
|
-
const v = h + 1, $ = d.has(v) ? " line-hl" : "", k =
|
|
2574
|
+
const v = h + 1, $ = d.has(v) ? " line-hl" : "", k = i ? `<span class="line-no">${v}</span>` : "";
|
|
2575
2575
|
return `<span class="line${$}">${k}${u || " "}</span>`;
|
|
2576
2576
|
}).join(""), m = n ? `max-height: ${n}` : "";
|
|
2577
2577
|
return o`
|
|
2578
2578
|
<div class="code-block" part="code">
|
|
2579
2579
|
<div class="code-header" part="code-header">
|
|
2580
|
-
<span class="code-lang">${
|
|
2580
|
+
<span class="code-lang">${a || "code"}</span>
|
|
2581
2581
|
<button
|
|
2582
2582
|
class="code-copy"
|
|
2583
2583
|
part="code-copy"
|
|
@@ -2719,10 +2719,10 @@ G([
|
|
|
2719
2719
|
O = G([
|
|
2720
2720
|
x("uw-code")
|
|
2721
2721
|
], O);
|
|
2722
|
-
var nt = Object.defineProperty, ot = Object.getOwnPropertyDescriptor,
|
|
2723
|
-
for (var
|
|
2724
|
-
(n = e[s]) && (
|
|
2725
|
-
return r &&
|
|
2722
|
+
var nt = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, ae = (e, t, a, r) => {
|
|
2723
|
+
for (var i = r > 1 ? void 0 : r ? ot(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2724
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
2725
|
+
return r && i && nt(t, a, i), i;
|
|
2726
2726
|
};
|
|
2727
2727
|
let U = class extends y {
|
|
2728
2728
|
constructor() {
|
|
@@ -2732,15 +2732,15 @@ let U = class extends y {
|
|
|
2732
2732
|
if (!this.spec) return l;
|
|
2733
2733
|
const e = this._extractItems();
|
|
2734
2734
|
if (e.length === 0) return l;
|
|
2735
|
-
const t = this.spec.options ?? {},
|
|
2735
|
+
const t = this.spec.options ?? {}, a = !!(t.compact ?? !1), r = t.numbered !== !1;
|
|
2736
2736
|
return o`
|
|
2737
|
-
<div class="citations" part="citations" ?data-compact=${
|
|
2738
|
-
${e.map((
|
|
2737
|
+
<div class="citations" part="citations" ?data-compact=${a} role="list" aria-label=${this.spec.title ?? "Citations"}>
|
|
2738
|
+
${e.map((i, s) => this._renderItem(i, s, r))}
|
|
2739
2739
|
</div>
|
|
2740
2740
|
`;
|
|
2741
2741
|
}
|
|
2742
|
-
_renderItem(e, t,
|
|
2743
|
-
const r = !!e.url,
|
|
2742
|
+
_renderItem(e, t, a) {
|
|
2743
|
+
const r = !!e.url, i = e.url ? this._extractDomain(e.url) : void 0;
|
|
2744
2744
|
return o`
|
|
2745
2745
|
<div
|
|
2746
2746
|
class="cite-item"
|
|
@@ -2749,10 +2749,10 @@ let U = class extends y {
|
|
|
2749
2749
|
?data-link=${r}
|
|
2750
2750
|
@click=${r ? () => this._handleClick(e) : void 0}
|
|
2751
2751
|
>
|
|
2752
|
-
${
|
|
2752
|
+
${a ? o`<span class="cite-num" part="cite-num">${t + 1}</span>` : l}
|
|
2753
2753
|
<div class="cite-body">
|
|
2754
2754
|
<div class="cite-title" part="cite-title">${e.title}</div>
|
|
2755
|
-
${
|
|
2755
|
+
${i ? o`<div class="cite-url" part="cite-url">${i}</div>` : l}
|
|
2756
2756
|
${e.snippet ? o`<div class="cite-snippet" part="cite-snippet">${e.snippet}</div>` : l}
|
|
2757
2757
|
${e.source ? o`<div class="cite-source" part="cite-source">${e.source}</div>` : l}
|
|
2758
2758
|
</div>
|
|
@@ -2781,8 +2781,8 @@ let U = class extends y {
|
|
|
2781
2781
|
const t = new URL(e).hostname;
|
|
2782
2782
|
if (t === "localhost" || /^\d+\.\d+\.\d+\.\d+$/.test(t))
|
|
2783
2783
|
return t;
|
|
2784
|
-
const r = t.replace(/^www\./, "").split("."),
|
|
2785
|
-
return r.length >= 3 &&
|
|
2784
|
+
const r = t.replace(/^www\./, "").split("."), i = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]);
|
|
2785
|
+
return r.length >= 3 && i.has(r[r.length - 2]) ? r.slice(-3).join(".") : r.slice(-2).join(".");
|
|
2786
2786
|
} catch {
|
|
2787
2787
|
return e;
|
|
2788
2788
|
}
|
|
@@ -2908,19 +2908,19 @@ U.styles = [b, w`
|
|
|
2908
2908
|
.cite-snippet { font-size: 0.75rem; }
|
|
2909
2909
|
}
|
|
2910
2910
|
`];
|
|
2911
|
-
|
|
2911
|
+
ae([
|
|
2912
2912
|
f({ type: Object })
|
|
2913
2913
|
], U.prototype, "spec", 2);
|
|
2914
|
-
|
|
2914
|
+
ae([
|
|
2915
2915
|
f({ type: String, reflect: !0 })
|
|
2916
2916
|
], U.prototype, "theme", 2);
|
|
2917
|
-
U =
|
|
2917
|
+
U = ae([
|
|
2918
2918
|
x("uw-citation")
|
|
2919
2919
|
], U);
|
|
2920
|
-
var lt = Object.defineProperty, ct = Object.getOwnPropertyDescriptor,
|
|
2921
|
-
for (var
|
|
2922
|
-
(n = e[s]) && (
|
|
2923
|
-
return r &&
|
|
2920
|
+
var lt = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, ie = (e, t, a, r) => {
|
|
2921
|
+
for (var i = r > 1 ? void 0 : r ? ct(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2922
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
2923
|
+
return r && i && lt(t, a, i), i;
|
|
2924
2924
|
};
|
|
2925
2925
|
const dt = /* @__PURE__ */ new Set(["info", "success", "warning", "error", "neutral"]), pt = {
|
|
2926
2926
|
info: "●",
|
|
@@ -3020,7 +3020,7 @@ R.styles = [b, w`
|
|
|
3020
3020
|
/* Level colors */
|
|
3021
3021
|
[data-level="info"] .status-icon,
|
|
3022
3022
|
[data-level="info"] .status-value {
|
|
3023
|
-
color: var(--u-widget-primary, #
|
|
3023
|
+
color: var(--u-widget-primary, #4f46e5);
|
|
3024
3024
|
}
|
|
3025
3025
|
[data-level="success"] .status-icon,
|
|
3026
3026
|
[data-level="success"] .status-value {
|
|
@@ -3028,7 +3028,7 @@ R.styles = [b, w`
|
|
|
3028
3028
|
}
|
|
3029
3029
|
[data-level="warning"] .status-icon,
|
|
3030
3030
|
[data-level="warning"] .status-value {
|
|
3031
|
-
color: var(--u-widget-warning, #
|
|
3031
|
+
color: var(--u-widget-warning, #d97706);
|
|
3032
3032
|
}
|
|
3033
3033
|
[data-level="error"] .status-icon,
|
|
3034
3034
|
[data-level="error"] .status-value {
|
|
@@ -3044,19 +3044,19 @@ R.styles = [b, w`
|
|
|
3044
3044
|
.status-item { font-size: 0.8125rem; }
|
|
3045
3045
|
}
|
|
3046
3046
|
`];
|
|
3047
|
-
|
|
3047
|
+
ie([
|
|
3048
3048
|
f({ type: Object })
|
|
3049
3049
|
], R.prototype, "spec", 2);
|
|
3050
|
-
|
|
3050
|
+
ie([
|
|
3051
3051
|
f({ type: String, reflect: !0 })
|
|
3052
3052
|
], R.prototype, "theme", 2);
|
|
3053
|
-
R =
|
|
3053
|
+
R = ie([
|
|
3054
3054
|
x("uw-status")
|
|
3055
3055
|
], R);
|
|
3056
|
-
var ut = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, se = (e, t,
|
|
3057
|
-
for (var
|
|
3058
|
-
(n = e[s]) && (
|
|
3059
|
-
return r &&
|
|
3056
|
+
var ut = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, se = (e, t, a, r) => {
|
|
3057
|
+
for (var i = r > 1 ? void 0 : r ? gt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
3058
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
3059
|
+
return r && i && ut(t, a, i), i;
|
|
3060
3060
|
};
|
|
3061
3061
|
const ft = /* @__PURE__ */ new Set(["done", "active", "pending", "error"]);
|
|
3062
3062
|
function fe(e, t) {
|
|
@@ -3080,22 +3080,22 @@ let q = class extends y {
|
|
|
3080
3080
|
if (!this.spec) return l;
|
|
3081
3081
|
const e = this._extractItems();
|
|
3082
3082
|
if (e.length === 0) return l;
|
|
3083
|
-
const t = this.spec.options ?? {},
|
|
3084
|
-
return
|
|
3083
|
+
const t = this.spec.options ?? {}, a = String(t.layout ?? "vertical"), r = !!(t.compact ?? !1);
|
|
3084
|
+
return a === "horizontal" ? this._renderHorizontal(e, r) : this._renderVertical(e, r);
|
|
3085
3085
|
}
|
|
3086
3086
|
_renderVertical(e, t) {
|
|
3087
3087
|
return o`
|
|
3088
3088
|
<div class="steps-vertical" part="steps" ?data-compact=${t}
|
|
3089
3089
|
role="list" aria-label=${this.spec?.title ?? "Steps"}>
|
|
3090
|
-
${e.map((
|
|
3091
|
-
<div class="step-v" part="step" role="listitem" data-status=${
|
|
3090
|
+
${e.map((a) => o`
|
|
3091
|
+
<div class="step-v" part="step" role="listitem" data-status=${a.status}>
|
|
3092
3092
|
<div class="step-track">
|
|
3093
|
-
<span class="step-icon" part="step-icon" aria-hidden="true">${fe(
|
|
3093
|
+
<span class="step-icon" part="step-icon" aria-hidden="true">${fe(a.status, a.icon)}</span>
|
|
3094
3094
|
<div class="step-line"></div>
|
|
3095
3095
|
</div>
|
|
3096
3096
|
<div class="step-body">
|
|
3097
|
-
<div class="step-label" part="step-label">${
|
|
3098
|
-
${
|
|
3097
|
+
<div class="step-label" part="step-label">${a.label}</div>
|
|
3098
|
+
${a.description ? o`<div class="step-desc" part="step-desc">${a.description}</div>` : l}
|
|
3099
3099
|
</div>
|
|
3100
3100
|
</div>
|
|
3101
3101
|
`)}
|
|
@@ -3106,16 +3106,16 @@ let q = class extends y {
|
|
|
3106
3106
|
return o`
|
|
3107
3107
|
<div class="steps-horizontal" part="steps" ?data-compact=${t}
|
|
3108
3108
|
role="list" aria-label=${this.spec?.title ?? "Steps"}>
|
|
3109
|
-
${e.map((
|
|
3110
|
-
const
|
|
3109
|
+
${e.map((a, r) => {
|
|
3110
|
+
const i = r > 0 && e[r - 1].status === "done", s = a.status === "done";
|
|
3111
3111
|
return o`
|
|
3112
|
-
<div class="step-h" part="step" role="listitem" data-status=${
|
|
3112
|
+
<div class="step-h" part="step" role="listitem" data-status=${a.status}>
|
|
3113
3113
|
<div class="step-h-top">
|
|
3114
|
-
<div class="step-h-line" ?data-done=${
|
|
3115
|
-
<span class="step-icon" part="step-icon" aria-hidden="true">${fe(
|
|
3114
|
+
<div class="step-h-line" ?data-done=${i}></div>
|
|
3115
|
+
<span class="step-icon" part="step-icon" aria-hidden="true">${fe(a.status, a.icon)}</span>
|
|
3116
3116
|
<div class="step-h-line" ?data-done=${s}></div>
|
|
3117
3117
|
</div>
|
|
3118
|
-
<div class="step-label" part="step-label">${
|
|
3118
|
+
<div class="step-label" part="step-label">${a.label}</div>
|
|
3119
3119
|
</div>
|
|
3120
3120
|
`;
|
|
3121
3121
|
})}
|
|
@@ -3379,10 +3379,10 @@ se([
|
|
|
3379
3379
|
q = se([
|
|
3380
3380
|
x("uw-steps")
|
|
3381
3381
|
], q);
|
|
3382
|
-
var ht = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, X = (e, t,
|
|
3383
|
-
for (var
|
|
3384
|
-
(n = e[s]) && (
|
|
3385
|
-
return r &&
|
|
3382
|
+
var ht = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, X = (e, t, a, r) => {
|
|
3383
|
+
for (var i = r > 1 ? void 0 : r ? mt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
3384
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
3385
|
+
return r && i && ht(t, a, i), i;
|
|
3386
3386
|
};
|
|
3387
3387
|
const vt = {
|
|
3388
3388
|
star: ["☆", "★", "★"],
|
|
@@ -3398,55 +3398,55 @@ let E = class extends y {
|
|
|
3398
3398
|
}
|
|
3399
3399
|
render() {
|
|
3400
3400
|
if (!this.spec) return l;
|
|
3401
|
-
const e = this.spec.data ?? {}, t = this.spec.options ?? {},
|
|
3401
|
+
const e = this.spec.data ?? {}, t = this.spec.options ?? {}, a = typeof e.value == "number" ? e.value : 0, r = typeof t.max == "number" ? t.max : typeof e.max == "number" ? e.max : 5, i = !!(t.interactive ?? !1), s = this._resolveIcon(t.icon), n = typeof t.label == "string" ? t.label : void 0, d = typeof e.count == "number" ? e.count : void 0, c = vt[s], p = this._hoverIdx >= 0 ? this._hoverIdx + 1 : a;
|
|
3402
3402
|
return o`
|
|
3403
|
-
<div class="rating" part="rating" role=${
|
|
3404
|
-
aria-label=${this.spec.title ?? n ?? `Rating: ${
|
|
3403
|
+
<div class="rating" part="rating" role=${i ? "radiogroup" : "img"}
|
|
3404
|
+
aria-label=${this.spec.title ?? n ?? `Rating: ${a} out of ${r}`}>
|
|
3405
3405
|
${n ? o`<span class="rating-label" part="rating-label">${n}</span>` : l}
|
|
3406
3406
|
<div class="rating-icons" part="rating-icons"
|
|
3407
|
-
@mouseleave=${
|
|
3407
|
+
@mouseleave=${i ? () => {
|
|
3408
3408
|
this._hoverIdx = -1;
|
|
3409
3409
|
} : void 0}>
|
|
3410
|
-
${Array.from({ length: r }, (g, m) => this._renderIcon(m, p, c, s,
|
|
3410
|
+
${Array.from({ length: r }, (g, m) => this._renderIcon(m, p, c, s, i))}
|
|
3411
3411
|
</div>
|
|
3412
|
-
${!
|
|
3412
|
+
${!i && a > 0 ? o`<span class="rating-value" part="rating-value">${a}</span>` : l}
|
|
3413
3413
|
${d != null ? o`<span class="rating-count" part="rating-count">(${d})</span>` : l}
|
|
3414
3414
|
</div>
|
|
3415
3415
|
`;
|
|
3416
3416
|
}
|
|
3417
|
-
_renderIcon(e, t,
|
|
3418
|
-
const s = e + 1, n =
|
|
3417
|
+
_renderIcon(e, t, a, r, i) {
|
|
3418
|
+
const s = e + 1, n = i && this._hoverIdx >= 0 && s <= this._hoverIdx + 1;
|
|
3419
3419
|
let d;
|
|
3420
3420
|
n || s <= Math.floor(t) ? d = "full" : s === Math.ceil(t) && t % 1 >= 0.25 && t % 1 < 0.75 ? d = r === "thumb" ? t % 1 >= 0.5 ? "full" : "empty" : "half" : d = "empty";
|
|
3421
|
-
const c = d === "half" ?
|
|
3421
|
+
const c = d === "half" ? a[0] : d === "full" ? a[2] : a[0];
|
|
3422
3422
|
return d === "half" ? o`
|
|
3423
3423
|
<span class="rating-icon rating-icon-half"
|
|
3424
3424
|
data-state="half" data-icon=${r}
|
|
3425
|
-
?data-interactive=${
|
|
3425
|
+
?data-interactive=${i}
|
|
3426
3426
|
?data-preview=${n}
|
|
3427
|
-
role=${
|
|
3428
|
-
aria-label=${
|
|
3429
|
-
@mouseenter=${
|
|
3427
|
+
role=${i ? "radio" : "presentation"}
|
|
3428
|
+
aria-label=${i ? `${s}` : l}
|
|
3429
|
+
@mouseenter=${i ? () => {
|
|
3430
3430
|
this._hoverIdx = e;
|
|
3431
3431
|
} : void 0}
|
|
3432
|
-
@click=${
|
|
3433
|
-
<span aria-hidden="true">${
|
|
3432
|
+
@click=${i ? () => this._select(s) : void 0}>
|
|
3433
|
+
<span aria-hidden="true">${a[0]}</span>
|
|
3434
3434
|
<span class="half-overlay" aria-hidden="true">
|
|
3435
|
-
<span style="color: inherit">${
|
|
3435
|
+
<span style="color: inherit">${a[2]}</span>
|
|
3436
3436
|
</span>
|
|
3437
3437
|
</span>
|
|
3438
3438
|
` : o`
|
|
3439
3439
|
<span class="rating-icon"
|
|
3440
3440
|
data-state=${d} data-icon=${r}
|
|
3441
|
-
?data-interactive=${
|
|
3441
|
+
?data-interactive=${i}
|
|
3442
3442
|
?data-preview=${n}
|
|
3443
|
-
role=${
|
|
3444
|
-
aria-label=${
|
|
3445
|
-
aria-checked=${
|
|
3446
|
-
@mouseenter=${
|
|
3443
|
+
role=${i ? "radio" : "presentation"}
|
|
3444
|
+
aria-label=${i ? `${s}` : l}
|
|
3445
|
+
aria-checked=${i ? String(d === "full" && !n) : l}
|
|
3446
|
+
@mouseenter=${i ? () => {
|
|
3447
3447
|
this._hoverIdx = e;
|
|
3448
3448
|
} : void 0}
|
|
3449
|
-
@click=${
|
|
3449
|
+
@click=${i ? () => this._select(s) : void 0}>
|
|
3450
3450
|
<span aria-hidden="true">${c}</span>
|
|
3451
3451
|
</span>
|
|
3452
3452
|
`;
|
|
@@ -3588,10 +3588,10 @@ X([
|
|
|
3588
3588
|
E = X([
|
|
3589
3589
|
x("uw-rating")
|
|
3590
3590
|
], E);
|
|
3591
|
-
var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, ne = (e, t,
|
|
3592
|
-
for (var
|
|
3593
|
-
(n = e[s]) && (
|
|
3594
|
-
return r &&
|
|
3591
|
+
var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, ne = (e, t, a, r) => {
|
|
3592
|
+
for (var i = r > 1 ? void 0 : r ? wt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
3593
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
3594
|
+
return r && i && bt(t, a, i), i;
|
|
3595
3595
|
};
|
|
3596
3596
|
let B = class extends y {
|
|
3597
3597
|
constructor() {
|
|
@@ -3601,15 +3601,15 @@ let B = class extends y {
|
|
|
3601
3601
|
if (!this.spec) return l;
|
|
3602
3602
|
const e = this.spec.data;
|
|
3603
3603
|
if (!e) return l;
|
|
3604
|
-
const t = String(e.src ?? ""),
|
|
3605
|
-
if (!
|
|
3606
|
-
const r = e.poster ? this._sanitizeUrl(String(e.poster)) : void 0,
|
|
3604
|
+
const t = String(e.src ?? ""), a = this._sanitizeUrl(t);
|
|
3605
|
+
if (!a) return l;
|
|
3606
|
+
const r = e.poster ? this._sanitizeUrl(String(e.poster)) : void 0, i = String(e.alt ?? ""), s = e.caption, n = this.spec.options ?? {}, d = n.controls !== !1, c = n.autoplay === !0, p = n.loop === !0, g = n.muted === !0 || c;
|
|
3607
3607
|
return o`
|
|
3608
3608
|
<div class="video-container" part="video">
|
|
3609
3609
|
<video
|
|
3610
|
-
src=${
|
|
3610
|
+
src=${a}
|
|
3611
3611
|
poster=${r ?? l}
|
|
3612
|
-
aria-label=${
|
|
3612
|
+
aria-label=${i || l}
|
|
3613
3613
|
?controls=${d}
|
|
3614
3614
|
?autoplay=${c}
|
|
3615
3615
|
?loop=${p}
|
|
@@ -3670,10 +3670,10 @@ ne([
|
|
|
3670
3670
|
B = ne([
|
|
3671
3671
|
x("uw-video")
|
|
3672
3672
|
], B);
|
|
3673
|
-
var yt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, oe = (e, t,
|
|
3674
|
-
for (var
|
|
3675
|
-
(n = e[s]) && (
|
|
3676
|
-
return r &&
|
|
3673
|
+
var yt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, oe = (e, t, a, r) => {
|
|
3674
|
+
for (var i = r > 1 ? void 0 : r ? xt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
3675
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
3676
|
+
return r && i && yt(t, a, i), i;
|
|
3677
3677
|
};
|
|
3678
3678
|
let W = class extends y {
|
|
3679
3679
|
constructor() {
|
|
@@ -3689,7 +3689,7 @@ let W = class extends y {
|
|
|
3689
3689
|
caption: c.caption ? String(c.caption) : void 0
|
|
3690
3690
|
})).filter((c) => c.src);
|
|
3691
3691
|
if (t.length === 0) return l;
|
|
3692
|
-
const
|
|
3692
|
+
const a = this.spec.options ?? {}, r = Number(a.columns) || 0, i = String(a.aspectRatio ?? "auto"), s = r > 0 ? `repeat(${r}, 1fr)` : "repeat(auto-fill, minmax(150px, 1fr))", n = i !== "auto" ? `aspect-ratio: ${i.replace(":", "/")};` : "", d = this.spec.title;
|
|
3693
3693
|
return o`
|
|
3694
3694
|
<div class="gallery-grid" part="gallery" role="list"
|
|
3695
3695
|
aria-label=${d ?? "Gallery"}
|
|
@@ -3763,10 +3763,10 @@ oe([
|
|
|
3763
3763
|
W = oe([
|
|
3764
3764
|
x("uw-gallery")
|
|
3765
3765
|
], W);
|
|
3766
|
-
var $t = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, J = (e, t,
|
|
3767
|
-
for (var
|
|
3768
|
-
(n = e[s]) && (
|
|
3769
|
-
return r &&
|
|
3766
|
+
var $t = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, J = (e, t, a, r) => {
|
|
3767
|
+
for (var i = r > 1 ? void 0 : r ? _t(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
3768
|
+
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
3769
|
+
return r && i && $t(t, a, i), i;
|
|
3770
3770
|
};
|
|
3771
3771
|
let P = class extends y {
|
|
3772
3772
|
constructor() {
|
|
@@ -3796,12 +3796,12 @@ let P = class extends y {
|
|
|
3796
3796
|
return this.renderWidget(t);
|
|
3797
3797
|
}
|
|
3798
3798
|
renderWidget(e) {
|
|
3799
|
-
const t = e.widget,
|
|
3800
|
-
let r =
|
|
3801
|
-
const
|
|
3802
|
-
|
|
3799
|
+
const t = e.widget, a = e.mapping ?? we(t, e.data);
|
|
3800
|
+
let r = a ? { ...e, mapping: a } : e;
|
|
3801
|
+
const i = Ie(this.locale);
|
|
3802
|
+
i && !r.options?.locale && (r = {
|
|
3803
3803
|
...r,
|
|
3804
|
-
options: { ...r.options, locale:
|
|
3804
|
+
options: { ...r.options, locale: i }
|
|
3805
3805
|
});
|
|
3806
3806
|
const s = this.theme, d = t === "form" || t === "confirm" || t === "actions" ? [] : r.actions ?? [];
|
|
3807
3807
|
let c;
|
|
@@ -3888,35 +3888,35 @@ let P = class extends y {
|
|
|
3888
3888
|
renderActionsWidget(e) {
|
|
3889
3889
|
const t = e.actions ?? [];
|
|
3890
3890
|
if (t.length === 0) return l;
|
|
3891
|
-
const
|
|
3891
|
+
const a = e.options ?? {}, r = String(a.layout ?? "wrap");
|
|
3892
3892
|
return o`
|
|
3893
3893
|
<div class="actions-widget" data-layout=${r} part="actions" role="group" aria-label=${e.title ?? "Actions"}>
|
|
3894
|
-
${t.map((
|
|
3894
|
+
${t.map((i) => o`
|
|
3895
3895
|
<button
|
|
3896
|
-
data-style=${
|
|
3897
|
-
?disabled=${
|
|
3898
|
-
@click=${() => this._dispatchAction(e,
|
|
3896
|
+
data-style=${i.style ?? "default"}
|
|
3897
|
+
?disabled=${i.disabled}
|
|
3898
|
+
@click=${() => this._dispatchAction(e, i)}
|
|
3899
3899
|
part="action-btn"
|
|
3900
|
-
>${
|
|
3900
|
+
>${i.label}</button>
|
|
3901
3901
|
`)}
|
|
3902
3902
|
</div>
|
|
3903
3903
|
`;
|
|
3904
3904
|
}
|
|
3905
3905
|
/** Render inline divider widget. */
|
|
3906
3906
|
renderDivider(e) {
|
|
3907
|
-
const t = e.options ?? {},
|
|
3907
|
+
const t = e.options ?? {}, a = t.label, r = String(t.spacing ?? "default");
|
|
3908
3908
|
return o`
|
|
3909
3909
|
<div class="divider divider-spacing-${r}" part="divider" role="separator">
|
|
3910
|
-
${
|
|
3910
|
+
${a ?? l}
|
|
3911
3911
|
</div>
|
|
3912
3912
|
`;
|
|
3913
3913
|
}
|
|
3914
3914
|
/** Render inline header widget. */
|
|
3915
3915
|
renderHeader(e) {
|
|
3916
|
-
const t = e.data,
|
|
3917
|
-
return
|
|
3916
|
+
const t = e.data, a = String(t?.text ?? e.title ?? ""), r = String(t?.level ?? "2");
|
|
3917
|
+
return a ? o`
|
|
3918
3918
|
<div class="header-widget" data-level=${r} part="header" role="heading" aria-level=${r}>
|
|
3919
|
-
${
|
|
3919
|
+
${a}
|
|
3920
3920
|
</div>
|
|
3921
3921
|
` : l;
|
|
3922
3922
|
}
|
|
@@ -3975,12 +3975,12 @@ P.styles = [
|
|
|
3975
3975
|
.error-card {
|
|
3976
3976
|
padding: 10px 14px;
|
|
3977
3977
|
border-radius: 6px;
|
|
3978
|
-
border: 1px solid var(--u-widget-negative, #
|
|
3979
|
-
background: color-mix(in srgb, var(--u-widget-negative, #
|
|
3978
|
+
border: 1px solid var(--u-widget-negative, #dc2626);
|
|
3979
|
+
background: color-mix(in srgb, var(--u-widget-negative, #dc2626) 8%, var(--u-widget-bg, #fff));
|
|
3980
3980
|
font-size: 0.8125rem;
|
|
3981
3981
|
}
|
|
3982
3982
|
|
|
3983
|
-
.error-header { font-weight: 600; color: var(--u-widget-negative, #
|
|
3983
|
+
.error-header { font-weight: 600; color: var(--u-widget-negative, #dc2626); margin-bottom: 4px; }
|
|
3984
3984
|
.error-list { margin: 0; padding-left: 20px; color: var(--u-widget-text-secondary, #64748b); }
|
|
3985
3985
|
|
|
3986
3986
|
.fallback-card {
|