@iyulab/u-widgets 0.6.1 → 0.6.2
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 +112 -102
- package/dist/u-widgets.js.map +1 -1
- package/package.json +1 -1
package/dist/u-widgets.js
CHANGED
|
@@ -3,7 +3,7 @@ import { p as Nt, r as Ft } from "./formdown-BWJ6QGJs.js";
|
|
|
3
3
|
import { i as we } from "./infer-CNOiD2dS.js";
|
|
4
4
|
import { t as b, n as ye } from "./tokens-x1kDxgG8.js";
|
|
5
5
|
import { css as w, LitElement as y, nothing as l, html as o } from "lit";
|
|
6
|
-
import { property as
|
|
6
|
+
import { property as m, customElement as x, state as S } from "lit/decorators.js";
|
|
7
7
|
const xe = /* @__PURE__ */ new Set([
|
|
8
8
|
"text",
|
|
9
9
|
"email",
|
|
@@ -227,7 +227,7 @@ function Oe(e) {
|
|
|
227
227
|
r /= 1024, i++;
|
|
228
228
|
return a + (i === 0 ? r : r.toFixed(1)) + " " + se[i];
|
|
229
229
|
}
|
|
230
|
-
const
|
|
230
|
+
const Ee = [
|
|
231
231
|
"chart.bar",
|
|
232
232
|
"chart.line",
|
|
233
233
|
"chart.area",
|
|
@@ -263,11 +263,11 @@ const Pe = [
|
|
|
263
263
|
"divider",
|
|
264
264
|
"header"
|
|
265
265
|
];
|
|
266
|
-
function
|
|
266
|
+
function Pe(e) {
|
|
267
267
|
if (!e) return;
|
|
268
268
|
const t = e.toLowerCase();
|
|
269
269
|
let a, r = 1 / 0;
|
|
270
|
-
for (const s of
|
|
270
|
+
for (const s of Ee) {
|
|
271
271
|
const n = Le(t, s);
|
|
272
272
|
n < r && (r = n, a = s);
|
|
273
273
|
}
|
|
@@ -339,10 +339,10 @@ function Ot() {
|
|
|
339
339
|
return { ...R };
|
|
340
340
|
}
|
|
341
341
|
let q;
|
|
342
|
-
function
|
|
342
|
+
function Et(e) {
|
|
343
343
|
q = e;
|
|
344
344
|
}
|
|
345
|
-
function
|
|
345
|
+
function Pt() {
|
|
346
346
|
return q;
|
|
347
347
|
}
|
|
348
348
|
function Ie(e) {
|
|
@@ -514,7 +514,7 @@ B.styles = [b, w`
|
|
|
514
514
|
}
|
|
515
515
|
`];
|
|
516
516
|
ge([
|
|
517
|
-
|
|
517
|
+
m({ type: Object })
|
|
518
518
|
], B.prototype, "spec", 2);
|
|
519
519
|
B = ge([
|
|
520
520
|
x("u-metric")
|
|
@@ -541,8 +541,8 @@ function oe(e) {
|
|
|
541
541
|
return Re[e] ?? e;
|
|
542
542
|
}
|
|
543
543
|
function le(e, t, a, r, i) {
|
|
544
|
-
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),
|
|
545
|
-
return `M ${d} ${c} A ${a} ${a} 0 ${
|
|
544
|
+
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), h = i - r > 180 ? 1 : 0;
|
|
545
|
+
return `M ${d} ${c} A ${a} ${a} 0 ${h} 1 ${p} ${g}`;
|
|
546
546
|
}
|
|
547
547
|
let W = class extends y {
|
|
548
548
|
constructor() {
|
|
@@ -560,14 +560,14 @@ let W = class extends y {
|
|
|
560
560
|
return Number(e.value ?? 0);
|
|
561
561
|
}
|
|
562
562
|
renderGauge() {
|
|
563
|
-
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 = 100, n = 100, d = 80, c = 150, p = 240, g = c + p * r,
|
|
563
|
+
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 = 100, n = 100, d = 80, c = 150, p = 240, g = c + p * r, h = le(s, n, d, c, c + p), u = r > 0 ? le(s, n, d, c, g) : null, f = typeof this.spec.title == "string" ? this.spec.title : "Gauge", v = `${t}${e.unit}`;
|
|
564
564
|
return o`
|
|
565
565
|
<div class="gauge-container" part="gauge"
|
|
566
566
|
role="meter"
|
|
567
567
|
aria-valuenow=${t}
|
|
568
568
|
aria-valuemin=${e.min}
|
|
569
569
|
aria-valuemax=${e.max}
|
|
570
|
-
aria-label=${
|
|
570
|
+
aria-label=${f}
|
|
571
571
|
aria-valuetext=${v}
|
|
572
572
|
>
|
|
573
573
|
<div class="gauge-wrapper">
|
|
@@ -576,7 +576,7 @@ let W = class extends y {
|
|
|
576
576
|
${e.unit ? o`<div class="gauge-unit" part="unit">${e.unit}</div>` : l}
|
|
577
577
|
</div>
|
|
578
578
|
<svg class="gauge-svg" viewBox="0 0 200 195" role="presentation" aria-hidden="true">
|
|
579
|
-
<path class="gauge-track" d="${
|
|
579
|
+
<path class="gauge-track" d="${h}" fill="none" stroke-width="12" stroke-linecap="round"></path>
|
|
580
580
|
<path class="gauge-fill" d="${u ?? "M0 0"}" fill="none" stroke="${u ? i : "none"}" stroke-width="12" stroke-linecap="round"></path>
|
|
581
581
|
</svg>
|
|
582
582
|
</div>
|
|
@@ -642,6 +642,7 @@ W.styles = [b, w`
|
|
|
642
642
|
.gauge-svg {
|
|
643
643
|
display: block;
|
|
644
644
|
width: 100%;
|
|
645
|
+
aspect-ratio: 200 / 195;
|
|
645
646
|
}
|
|
646
647
|
|
|
647
648
|
.gauge-track {
|
|
@@ -716,7 +717,7 @@ W.styles = [b, w`
|
|
|
716
717
|
}
|
|
717
718
|
`];
|
|
718
719
|
fe([
|
|
719
|
-
|
|
720
|
+
m({ type: Object })
|
|
720
721
|
], W.prototype, "spec", 2);
|
|
721
722
|
W = fe([
|
|
722
723
|
x("u-gauge")
|
|
@@ -795,7 +796,7 @@ let z = class extends y {
|
|
|
795
796
|
return ue(typeof e == "string" ? e : void 0);
|
|
796
797
|
}
|
|
797
798
|
renderTable() {
|
|
798
|
-
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),
|
|
799
|
+
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), h = n > 0 ? c.slice(g * n, (g + 1) * n) : c, u = i ? o`
|
|
799
800
|
<div class="search-box" part="search">
|
|
800
801
|
<input
|
|
801
802
|
class="search-input"
|
|
@@ -806,7 +807,7 @@ let z = class extends y {
|
|
|
806
807
|
@input=${this._onSearch}
|
|
807
808
|
/>
|
|
808
809
|
</div>
|
|
809
|
-
` : l,
|
|
810
|
+
` : l, f = n > 0 && p > 1 ? o`
|
|
810
811
|
<nav class="pagination" part="pagination" aria-label=${a.tablePagination}>
|
|
811
812
|
<button aria-label=${a.previousPage} ?disabled=${g === 0} @click=${() => this._onPageChange(g - 1)}>${a.prev}</button>
|
|
812
813
|
<span aria-live="polite">${g + 1} / ${p}</span>
|
|
@@ -836,7 +837,7 @@ let z = class extends y {
|
|
|
836
837
|
</tr>
|
|
837
838
|
</thead>
|
|
838
839
|
<tbody @keydown=${this._onTableKeydown}>
|
|
839
|
-
${
|
|
840
|
+
${h.map(
|
|
840
841
|
(v, $) => o`
|
|
841
842
|
<tr part="tr"
|
|
842
843
|
tabindex=${$ === this._focusedIdx ? "0" : "-1"}
|
|
@@ -856,7 +857,7 @@ let z = class extends y {
|
|
|
856
857
|
</tbody>
|
|
857
858
|
</table>
|
|
858
859
|
</div>
|
|
859
|
-
${
|
|
860
|
+
${f}
|
|
860
861
|
</div>`;
|
|
861
862
|
}
|
|
862
863
|
_onPageChange(e) {
|
|
@@ -899,8 +900,8 @@ let z = class extends y {
|
|
|
899
900
|
<div class="list-item" part="list-item"
|
|
900
901
|
tabindex=${g === this._focusedIdx ? "0" : "-1"}
|
|
901
902
|
@click=${() => this._onRowClick(p, g)}
|
|
902
|
-
@keydown=${(
|
|
903
|
-
(
|
|
903
|
+
@keydown=${(h) => {
|
|
904
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), this._onRowClick(p, g));
|
|
904
905
|
}}
|
|
905
906
|
>
|
|
906
907
|
${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}
|
|
@@ -1257,7 +1258,7 @@ z.styles = [b, w`
|
|
|
1257
1258
|
}
|
|
1258
1259
|
`];
|
|
1259
1260
|
C([
|
|
1260
|
-
|
|
1261
|
+
m({ type: Object })
|
|
1261
1262
|
], z.prototype, "spec", 2);
|
|
1262
1263
|
C([
|
|
1263
1264
|
S()
|
|
@@ -1277,8 +1278,8 @@ C([
|
|
|
1277
1278
|
z = C([
|
|
1278
1279
|
x("u-table")
|
|
1279
1280
|
], z);
|
|
1280
|
-
var We = Object.defineProperty,
|
|
1281
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
1281
|
+
var We = Object.defineProperty, He = Object.getOwnPropertyDescriptor, V = (e, t, a, r) => {
|
|
1282
|
+
for (var i = r > 1 ? void 0 : r ? He(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1282
1283
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
1283
1284
|
return r && i && We(t, a, i), i;
|
|
1284
1285
|
};
|
|
@@ -1793,7 +1794,7 @@ j.styles = [b, w`
|
|
|
1793
1794
|
}
|
|
1794
1795
|
`];
|
|
1795
1796
|
V([
|
|
1796
|
-
|
|
1797
|
+
m({ type: Object })
|
|
1797
1798
|
], j.prototype, "spec", 2);
|
|
1798
1799
|
V([
|
|
1799
1800
|
S()
|
|
@@ -1804,10 +1805,10 @@ V([
|
|
|
1804
1805
|
j = V([
|
|
1805
1806
|
x("u-form")
|
|
1806
1807
|
], j);
|
|
1807
|
-
var
|
|
1808
|
+
var Ke = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, Z = (e, t, a, r) => {
|
|
1808
1809
|
for (var i = r > 1 ? void 0 : r ? Ve(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1809
1810
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
1810
|
-
return r && i &&
|
|
1811
|
+
return r && i && Ke(t, a, i), i;
|
|
1811
1812
|
};
|
|
1812
1813
|
let I = class extends y {
|
|
1813
1814
|
constructor() {
|
|
@@ -1951,10 +1952,10 @@ I.styles = [b, w`
|
|
|
1951
1952
|
}
|
|
1952
1953
|
`];
|
|
1953
1954
|
Z([
|
|
1954
|
-
|
|
1955
|
+
m({ type: Object })
|
|
1955
1956
|
], I.prototype, "spec", 2);
|
|
1956
1957
|
Z([
|
|
1957
|
-
|
|
1958
|
+
m({ type: String, reflect: !0 })
|
|
1958
1959
|
], I.prototype, "theme", 2);
|
|
1959
1960
|
I = Z([
|
|
1960
1961
|
x("u-compose")
|
|
@@ -1964,7 +1965,7 @@ var Ge = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, he = (e, t
|
|
|
1964
1965
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
1965
1966
|
return r && i && Ge(t, a, i), i;
|
|
1966
1967
|
};
|
|
1967
|
-
let
|
|
1968
|
+
let H = class extends y {
|
|
1968
1969
|
constructor() {
|
|
1969
1970
|
super(...arguments), this.spec = null;
|
|
1970
1971
|
}
|
|
@@ -2014,9 +2015,9 @@ let K = class extends y {
|
|
|
2014
2015
|
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(
|
|
2015
2016
|
/^(\|.+\|)\n(\|[\s:|-]+\|)\n((?:\|.+\|\n?)+)/gm,
|
|
2016
2017
|
(a, r, i, s) => {
|
|
2017
|
-
const n = (u) => u.split("|").slice(1, -1).map((
|
|
2018
|
-
`).map(n), g = d.map((u,
|
|
2019
|
-
return `<table><thead><tr>${g}</tr></thead><tbody>${
|
|
2018
|
+
const n = (u) => u.split("|").slice(1, -1).map((f) => f.trim()), d = n(r), c = n(i).map((u) => u.startsWith(":") && u.endsWith(":") ? "center" : u.endsWith(":") ? "right" : "left"), p = s.trim().split(`
|
|
2019
|
+
`).map(n), g = d.map((u, f) => `<th scope="col" style="text-align:${c[f] ?? "left"}">${u}</th>`).join(""), h = p.map((u) => "<tr>" + u.map((f, v) => `<td style="text-align:${c[v] ?? "left"}">${f}</td>`).join("") + "</tr>").join("");
|
|
2020
|
+
return `<table><thead><tr>${g}</tr></thead><tbody>${h}</tbody></table>`;
|
|
2020
2021
|
}
|
|
2021
2022
|
), 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(
|
|
2022
2023
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
@@ -2032,7 +2033,7 @@ let K = class extends y {
|
|
|
2032
2033
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2033
2034
|
}
|
|
2034
2035
|
};
|
|
2035
|
-
|
|
2036
|
+
H.styles = [b, w`
|
|
2036
2037
|
:host {
|
|
2037
2038
|
display: block;
|
|
2038
2039
|
font-family: system-ui, -apple-system, sans-serif;
|
|
@@ -2210,17 +2211,17 @@ K.styles = [b, w`
|
|
|
2210
2211
|
}
|
|
2211
2212
|
`];
|
|
2212
2213
|
he([
|
|
2213
|
-
|
|
2214
|
-
],
|
|
2215
|
-
|
|
2214
|
+
m({ type: Object })
|
|
2215
|
+
], H.prototype, "spec", 2);
|
|
2216
|
+
H = he([
|
|
2216
2217
|
x("u-content")
|
|
2217
|
-
],
|
|
2218
|
+
], H);
|
|
2218
2219
|
var Je = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, me = (e, t, a, r) => {
|
|
2219
2220
|
for (var i = r > 1 ? void 0 : r ? Ye(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2220
2221
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
2221
2222
|
return r && i && Je(t, a, i), i;
|
|
2222
2223
|
};
|
|
2223
|
-
let
|
|
2224
|
+
let K = class extends y {
|
|
2224
2225
|
constructor() {
|
|
2225
2226
|
super(...arguments), this.spec = null;
|
|
2226
2227
|
}
|
|
@@ -2251,7 +2252,7 @@ let H = class extends y {
|
|
|
2251
2252
|
return e ? Array.isArray(e) ? e.filter((t) => t != null && typeof t == "object" && "key" in t && "value" in t).map((t) => [String(t.key), t.value]) : typeof e == "object" ? Object.entries(e) : [] : [];
|
|
2252
2253
|
}
|
|
2253
2254
|
};
|
|
2254
|
-
|
|
2255
|
+
K.styles = [b, w`
|
|
2255
2256
|
:host {
|
|
2256
2257
|
display: block;
|
|
2257
2258
|
font-family: system-ui, -apple-system, sans-serif;
|
|
@@ -2346,11 +2347,11 @@ H.styles = [b, w`
|
|
|
2346
2347
|
}
|
|
2347
2348
|
`];
|
|
2348
2349
|
me([
|
|
2349
|
-
|
|
2350
|
-
],
|
|
2351
|
-
|
|
2350
|
+
m({ type: Object })
|
|
2351
|
+
], K.prototype, "spec", 2);
|
|
2352
|
+
K = me([
|
|
2352
2353
|
x("u-kv")
|
|
2353
|
-
],
|
|
2354
|
+
], K);
|
|
2354
2355
|
var Ze = Object.defineProperty, Qe = Object.getOwnPropertyDescriptor, G = (e, t, a, r) => {
|
|
2355
2356
|
for (var i = r > 1 ? void 0 : r ? Qe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2356
2357
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
@@ -2439,50 +2440,50 @@ function it(e, t) {
|
|
|
2439
2440
|
const g = e.length;
|
|
2440
2441
|
for (; p < g; ) {
|
|
2441
2442
|
if (n && e.startsWith(n[0], p)) {
|
|
2442
|
-
const u = e.indexOf(n[1], p + n[0].length),
|
|
2443
|
-
c += D(
|
|
2443
|
+
const u = e.indexOf(n[1], p + n[0].length), f = u === -1 ? e.slice(p) : e.slice(p, u + n[1].length);
|
|
2444
|
+
c += D(f, "c"), p += f.length;
|
|
2444
2445
|
continue;
|
|
2445
2446
|
}
|
|
2446
2447
|
if (s && e.startsWith(s, p)) {
|
|
2447
2448
|
const u = e.indexOf(`
|
|
2448
|
-
`, p),
|
|
2449
|
-
c += D(
|
|
2449
|
+
`, p), f = u === -1 ? e.slice(p) : e.slice(p, u);
|
|
2450
|
+
c += D(f, "c"), p += f.length;
|
|
2450
2451
|
continue;
|
|
2451
2452
|
}
|
|
2452
|
-
const
|
|
2453
|
-
if (
|
|
2454
|
-
const u = ve(e, p,
|
|
2453
|
+
const h = e[p];
|
|
2454
|
+
if (h === '"' || h === "'" || h === "`" && d) {
|
|
2455
|
+
const u = ve(e, p, h);
|
|
2455
2456
|
c += D(e.slice(p, u), "s"), p = u;
|
|
2456
2457
|
continue;
|
|
2457
2458
|
}
|
|
2458
|
-
if (/\d/.test(
|
|
2459
|
+
if (/\d/.test(h) && (p === 0 || !/[a-zA-Z_$]/.test(e[p - 1]))) {
|
|
2459
2460
|
let u = p + 1;
|
|
2460
2461
|
for (; u < g && /[0-9a-fA-FxXoObBeE._]/.test(e[u]); ) u++;
|
|
2461
2462
|
c += D(e.slice(p, u), "n"), p = u;
|
|
2462
2463
|
continue;
|
|
2463
2464
|
}
|
|
2464
|
-
if (/[a-zA-Z_$]/.test(
|
|
2465
|
+
if (/[a-zA-Z_$]/.test(h)) {
|
|
2465
2466
|
let u = p + 1;
|
|
2466
2467
|
for (; u < g && /[a-zA-Z0-9_$]/.test(e[u]); ) u++;
|
|
2467
|
-
const
|
|
2468
|
-
c += r.has(
|
|
2468
|
+
const f = e.slice(p, u);
|
|
2469
|
+
c += r.has(f) ? `<span class="hl-k">${k(f)}</span>` : k(f), p = u;
|
|
2469
2470
|
continue;
|
|
2470
2471
|
}
|
|
2471
|
-
if (a === "html" &&
|
|
2472
|
+
if (a === "html" && h === "<" && p + 1 < g && /[a-zA-Z/!]/.test(e[p + 1])) {
|
|
2472
2473
|
const u = e.indexOf(">", p);
|
|
2473
2474
|
if (u !== -1) {
|
|
2474
2475
|
c += `<span class="hl-k">${k(e.slice(p, u + 1))}</span>`, p = u + 1;
|
|
2475
2476
|
continue;
|
|
2476
2477
|
}
|
|
2477
2478
|
}
|
|
2478
|
-
if (a === "css" && /[a-z-]/.test(
|
|
2479
|
+
if (a === "css" && /[a-z-]/.test(h)) {
|
|
2479
2480
|
let u = p + 1;
|
|
2480
2481
|
for (; u < g && /[a-z-]/.test(e[u]); ) u++;
|
|
2481
|
-
const
|
|
2482
|
-
e.slice(u).trimStart()[0] === ":" ? c += `<span class="hl-k">${k(
|
|
2482
|
+
const f = e.slice(p, u);
|
|
2483
|
+
e.slice(u).trimStart()[0] === ":" ? c += `<span class="hl-k">${k(f)}</span>` : c += k(f), p = u;
|
|
2483
2484
|
continue;
|
|
2484
2485
|
}
|
|
2485
|
-
c += k(
|
|
2486
|
+
c += k(h), p++;
|
|
2486
2487
|
}
|
|
2487
2488
|
return c;
|
|
2488
2489
|
}
|
|
@@ -2525,10 +2526,10 @@ let O = class extends y {
|
|
|
2525
2526
|
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(
|
|
2526
2527
|
Array.isArray(r.highlight) ? r.highlight : []
|
|
2527
2528
|
), g = it(t, a).split(`
|
|
2528
|
-
`).map((u,
|
|
2529
|
-
const v =
|
|
2529
|
+
`).map((u, f) => {
|
|
2530
|
+
const v = f + 1, $ = d.has(v) ? " line-hl" : "", _ = i ? `<span class="line-no">${v}</span>` : "";
|
|
2530
2531
|
return `<span class="line${$}">${_}${u || " "}</span>`;
|
|
2531
|
-
}).join(""),
|
|
2532
|
+
}).join(""), h = n ? `max-height: ${n}` : "";
|
|
2532
2533
|
return o`
|
|
2533
2534
|
<div class="code-block" part="code">
|
|
2534
2535
|
<div class="code-header" part="code-header">
|
|
@@ -2540,7 +2541,7 @@ let O = class extends y {
|
|
|
2540
2541
|
@click=${this._copyCode}
|
|
2541
2542
|
>${this._copied ? "Copied!" : "Copy"}</button>
|
|
2542
2543
|
</div>
|
|
2543
|
-
<div class="code-body" part="code-body" style=${
|
|
2544
|
+
<div class="code-body" part="code-body" style=${h}>
|
|
2544
2545
|
<pre data-wrap=${String(s)}><code .innerHTML=${g}></code></pre>
|
|
2545
2546
|
</div>
|
|
2546
2547
|
</div>
|
|
@@ -2663,10 +2664,10 @@ O.styles = [b, w`
|
|
|
2663
2664
|
}
|
|
2664
2665
|
`];
|
|
2665
2666
|
G([
|
|
2666
|
-
|
|
2667
|
+
m({ type: Object })
|
|
2667
2668
|
], O.prototype, "spec", 2);
|
|
2668
2669
|
G([
|
|
2669
|
-
|
|
2670
|
+
m({ type: String, reflect: !0 })
|
|
2670
2671
|
], O.prototype, "theme", 2);
|
|
2671
2672
|
G([
|
|
2672
2673
|
S()
|
|
@@ -2864,10 +2865,10 @@ N.styles = [b, w`
|
|
|
2864
2865
|
}
|
|
2865
2866
|
`];
|
|
2866
2867
|
Q([
|
|
2867
|
-
|
|
2868
|
+
m({ type: Object })
|
|
2868
2869
|
], N.prototype, "spec", 2);
|
|
2869
2870
|
Q([
|
|
2870
|
-
|
|
2871
|
+
m({ type: String, reflect: !0 })
|
|
2871
2872
|
], N.prototype, "theme", 2);
|
|
2872
2873
|
N = Q([
|
|
2873
2874
|
x("u-citation")
|
|
@@ -3000,10 +3001,10 @@ F.styles = [b, w`
|
|
|
3000
3001
|
}
|
|
3001
3002
|
`];
|
|
3002
3003
|
ee([
|
|
3003
|
-
|
|
3004
|
+
m({ type: Object })
|
|
3004
3005
|
], F.prototype, "spec", 2);
|
|
3005
3006
|
ee([
|
|
3006
|
-
|
|
3007
|
+
m({ type: String, reflect: !0 })
|
|
3007
3008
|
], F.prototype, "theme", 2);
|
|
3008
3009
|
F = ee([
|
|
3009
3010
|
x("u-status")
|
|
@@ -3326,10 +3327,10 @@ M.styles = [b, w`
|
|
|
3326
3327
|
}
|
|
3327
3328
|
`];
|
|
3328
3329
|
te([
|
|
3329
|
-
|
|
3330
|
+
m({ type: Object })
|
|
3330
3331
|
], M.prototype, "spec", 2);
|
|
3331
3332
|
te([
|
|
3332
|
-
|
|
3333
|
+
m({ type: String, reflect: !0 })
|
|
3333
3334
|
], M.prototype, "theme", 2);
|
|
3334
3335
|
M = te([
|
|
3335
3336
|
x("u-steps")
|
|
@@ -3347,7 +3348,7 @@ const vt = {
|
|
|
3347
3348
|
thumb: ["👍", "👍", "👍"]
|
|
3348
3349
|
// 👍
|
|
3349
3350
|
};
|
|
3350
|
-
let
|
|
3351
|
+
let E = class extends y {
|
|
3351
3352
|
constructor() {
|
|
3352
3353
|
super(...arguments), this.spec = null, this.theme = null, this._hoverIdx = -1;
|
|
3353
3354
|
}
|
|
@@ -3362,7 +3363,7 @@ let P = class extends y {
|
|
|
3362
3363
|
@mouseleave=${i ? () => {
|
|
3363
3364
|
this._hoverIdx = -1;
|
|
3364
3365
|
} : void 0}>
|
|
3365
|
-
${Array.from({ length: r }, (g,
|
|
3366
|
+
${Array.from({ length: r }, (g, h) => this._renderIcon(h, p, c, s, i))}
|
|
3366
3367
|
</div>
|
|
3367
3368
|
${!i && a > 0 ? o`<span class="rating-value" part="rating-value">${a}</span>` : l}
|
|
3368
3369
|
${d != null ? o`<span class="rating-count" part="rating-count">(${d})</span>` : l}
|
|
@@ -3425,7 +3426,7 @@ let P = class extends y {
|
|
|
3425
3426
|
return t === "heart" || t === "thumb" ? t : "star";
|
|
3426
3427
|
}
|
|
3427
3428
|
};
|
|
3428
|
-
|
|
3429
|
+
E.styles = [b, w`
|
|
3429
3430
|
:host {
|
|
3430
3431
|
display: block;
|
|
3431
3432
|
font-family: system-ui, -apple-system, sans-serif;
|
|
@@ -3532,17 +3533,17 @@ P.styles = [b, w`
|
|
|
3532
3533
|
}
|
|
3533
3534
|
`];
|
|
3534
3535
|
X([
|
|
3535
|
-
|
|
3536
|
-
],
|
|
3536
|
+
m({ type: Object })
|
|
3537
|
+
], E.prototype, "spec", 2);
|
|
3537
3538
|
X([
|
|
3538
|
-
|
|
3539
|
-
],
|
|
3539
|
+
m({ type: String, reflect: !0 })
|
|
3540
|
+
], E.prototype, "theme", 2);
|
|
3540
3541
|
X([
|
|
3541
3542
|
S()
|
|
3542
|
-
],
|
|
3543
|
-
|
|
3543
|
+
], E.prototype, "_hoverIdx", 2);
|
|
3544
|
+
E = X([
|
|
3544
3545
|
x("u-rating")
|
|
3545
|
-
],
|
|
3546
|
+
], E);
|
|
3546
3547
|
var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, re = (e, t, a, r) => {
|
|
3547
3548
|
for (var i = r > 1 ? void 0 : r ? wt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
3548
3549
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
@@ -3617,10 +3618,10 @@ T.styles = [b, w`
|
|
|
3617
3618
|
}
|
|
3618
3619
|
`];
|
|
3619
3620
|
re([
|
|
3620
|
-
|
|
3621
|
+
m({ type: Object })
|
|
3621
3622
|
], T.prototype, "spec", 2);
|
|
3622
3623
|
re([
|
|
3623
|
-
|
|
3624
|
+
m({ type: String, reflect: !0 })
|
|
3624
3625
|
], T.prototype, "theme", 2);
|
|
3625
3626
|
T = re([
|
|
3626
3627
|
x("u-video")
|
|
@@ -3710,10 +3711,10 @@ U.styles = [b, w`
|
|
|
3710
3711
|
}
|
|
3711
3712
|
`];
|
|
3712
3713
|
ae([
|
|
3713
|
-
|
|
3714
|
+
m({ type: Object })
|
|
3714
3715
|
], U.prototype, "spec", 2);
|
|
3715
3716
|
ae([
|
|
3716
|
-
|
|
3717
|
+
m({ type: String, reflect: !0 })
|
|
3717
3718
|
], U.prototype, "theme", 2);
|
|
3718
3719
|
U = ae([
|
|
3719
3720
|
x("u-gallery")
|
|
@@ -3723,7 +3724,7 @@ var $t = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, J = (e, t,
|
|
|
3723
3724
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
3724
3725
|
return r && i && $t(t, a, i), i;
|
|
3725
3726
|
};
|
|
3726
|
-
let
|
|
3727
|
+
let P = class extends y {
|
|
3727
3728
|
constructor() {
|
|
3728
3729
|
super(...arguments), this.spec = null, this.theme = null, this.locale = null, this._handleInternalEvent = (e) => {
|
|
3729
3730
|
e.stopPropagation(), this.dispatchEvent(
|
|
@@ -3825,8 +3826,9 @@ let E = class extends y {
|
|
|
3825
3826
|
}
|
|
3826
3827
|
return this.renderFallback(r);
|
|
3827
3828
|
}
|
|
3828
|
-
|
|
3829
|
-
|
|
3829
|
+
const g = !(t === "header" || t === "actions" || t === "divider" || t === "compose") && r.title ? o`<div class="widget-title" part="title">${r.title}</div>` : l;
|
|
3830
|
+
if (!!r.options?.card ? c = o`<div class="card-container" part="card">${g}${c}</div>` : g !== l && (c = o`${g}${c}`), d.length > 0) {
|
|
3831
|
+
const u = d.map((f) => o`
|
|
3830
3832
|
<button
|
|
3831
3833
|
data-style=${f.style ?? "default"}
|
|
3832
3834
|
?disabled=${f.disabled}
|
|
@@ -3834,7 +3836,7 @@ let E = class extends y {
|
|
|
3834
3836
|
part="action-btn"
|
|
3835
3837
|
>${f.label}</button>
|
|
3836
3838
|
`);
|
|
3837
|
-
return o`<div part="widget-container">${c}<div class="global-actions" part="actions">${
|
|
3839
|
+
return o`<div part="widget-container">${c}<div class="global-actions" part="actions">${u}</div></div>`;
|
|
3838
3840
|
}
|
|
3839
3841
|
return c;
|
|
3840
3842
|
}
|
|
@@ -3895,7 +3897,7 @@ let E = class extends y {
|
|
|
3895
3897
|
);
|
|
3896
3898
|
}
|
|
3897
3899
|
renderFallback(e) {
|
|
3898
|
-
const t =
|
|
3900
|
+
const t = Pe(e.widget);
|
|
3899
3901
|
return o`
|
|
3900
3902
|
<div class="fallback-card" part="fallback">
|
|
3901
3903
|
<div class="fallback-label">${e.title ?? `Unknown widget: ${e.widget}`}</div>
|
|
@@ -3918,7 +3920,7 @@ let E = class extends y {
|
|
|
3918
3920
|
`;
|
|
3919
3921
|
}
|
|
3920
3922
|
};
|
|
3921
|
-
|
|
3923
|
+
P.styles = [
|
|
3922
3924
|
b,
|
|
3923
3925
|
w`
|
|
3924
3926
|
:host {
|
|
@@ -3999,6 +4001,14 @@ E.styles = [
|
|
|
3999
4001
|
cursor: default;
|
|
4000
4002
|
}
|
|
4001
4003
|
|
|
4004
|
+
/* ── widget title ── */
|
|
4005
|
+
.widget-title {
|
|
4006
|
+
font-size: 0.875rem;
|
|
4007
|
+
font-weight: 600;
|
|
4008
|
+
color: var(--u-widget-text, #1a1a2e);
|
|
4009
|
+
margin: 0 0 8px 0;
|
|
4010
|
+
}
|
|
4011
|
+
|
|
4002
4012
|
/* ── global action bar ── */
|
|
4003
4013
|
.global-actions {
|
|
4004
4014
|
display: flex;
|
|
@@ -4090,7 +4100,7 @@ E.styles = [
|
|
|
4090
4100
|
`
|
|
4091
4101
|
];
|
|
4092
4102
|
J([
|
|
4093
|
-
|
|
4103
|
+
m({
|
|
4094
4104
|
type: Object,
|
|
4095
4105
|
converter: {
|
|
4096
4106
|
fromAttribute(e) {
|
|
@@ -4103,22 +4113,22 @@ J([
|
|
|
4103
4113
|
}
|
|
4104
4114
|
}
|
|
4105
4115
|
})
|
|
4106
|
-
],
|
|
4116
|
+
], P.prototype, "spec", 2);
|
|
4107
4117
|
J([
|
|
4108
|
-
|
|
4109
|
-
],
|
|
4118
|
+
m({ type: String, reflect: !0 })
|
|
4119
|
+
], P.prototype, "theme", 2);
|
|
4110
4120
|
J([
|
|
4111
|
-
|
|
4112
|
-
],
|
|
4113
|
-
|
|
4121
|
+
m({ type: String, reflect: !0 })
|
|
4122
|
+
], P.prototype, "locale", 2);
|
|
4123
|
+
P = J([
|
|
4114
4124
|
x("u-widget")
|
|
4115
|
-
],
|
|
4125
|
+
], P);
|
|
4116
4126
|
export {
|
|
4117
|
-
|
|
4127
|
+
P as UWidget,
|
|
4118
4128
|
A as formatTemplate,
|
|
4119
4129
|
pe as formatValue,
|
|
4120
4130
|
Ot as getDefaultLocale,
|
|
4121
|
-
|
|
4131
|
+
Pt as getEffectiveLocale,
|
|
4122
4132
|
be as getFormdownParser,
|
|
4123
4133
|
ue as getLocaleStrings,
|
|
4124
4134
|
we as infer,
|
|
@@ -4128,8 +4138,8 @@ export {
|
|
|
4128
4138
|
Ft as registerFormdownParser,
|
|
4129
4139
|
jt as registerLocale,
|
|
4130
4140
|
Ie as resolveLocale,
|
|
4131
|
-
|
|
4132
|
-
|
|
4141
|
+
Et as setDefaultLocale,
|
|
4142
|
+
Pe as suggestWidget,
|
|
4133
4143
|
Y as validate
|
|
4134
4144
|
};
|
|
4135
4145
|
//# sourceMappingURL=u-widgets.js.map
|