@iyulab/u-widgets 0.6.0 → 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-charts.js +119 -113
- package/dist/u-widgets-charts.js.map +1 -1
- package/dist/u-widgets-tools.js +11 -10
- package/dist/u-widgets-tools.js.map +1 -1
- package/dist/u-widgets.js +118 -103
- 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) {
|
|
@@ -473,7 +473,8 @@ B.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"]
|
|
476
|
+
.metric[data-variant="info"] .metric-value { color: var(--u-widget-primary, #3b82f6); }
|
|
477
|
+
.metric[data-variant="neutral"] .metric-value { color: var(--u-widget-text-secondary, #64748b); }
|
|
477
478
|
|
|
478
479
|
/* ── stat-group ── */
|
|
479
480
|
.stat-group {
|
|
@@ -513,7 +514,7 @@ B.styles = [b, w`
|
|
|
513
514
|
}
|
|
514
515
|
`];
|
|
515
516
|
ge([
|
|
516
|
-
|
|
517
|
+
m({ type: Object })
|
|
517
518
|
], B.prototype, "spec", 2);
|
|
518
519
|
B = ge([
|
|
519
520
|
x("u-metric")
|
|
@@ -540,8 +541,8 @@ function oe(e) {
|
|
|
540
541
|
return Re[e] ?? e;
|
|
541
542
|
}
|
|
542
543
|
function le(e, t, a, r, i) {
|
|
543
|
-
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),
|
|
544
|
-
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}`;
|
|
545
546
|
}
|
|
546
547
|
let W = class extends y {
|
|
547
548
|
constructor() {
|
|
@@ -559,14 +560,14 @@ let W = class extends y {
|
|
|
559
560
|
return Number(e.value ?? 0);
|
|
560
561
|
}
|
|
561
562
|
renderGauge() {
|
|
562
|
-
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}`;
|
|
563
564
|
return o`
|
|
564
565
|
<div class="gauge-container" part="gauge"
|
|
565
566
|
role="meter"
|
|
566
567
|
aria-valuenow=${t}
|
|
567
568
|
aria-valuemin=${e.min}
|
|
568
569
|
aria-valuemax=${e.max}
|
|
569
|
-
aria-label=${
|
|
570
|
+
aria-label=${f}
|
|
570
571
|
aria-valuetext=${v}
|
|
571
572
|
>
|
|
572
573
|
<div class="gauge-wrapper">
|
|
@@ -575,7 +576,7 @@ let W = class extends y {
|
|
|
575
576
|
${e.unit ? o`<div class="gauge-unit" part="unit">${e.unit}</div>` : l}
|
|
576
577
|
</div>
|
|
577
578
|
<svg class="gauge-svg" viewBox="0 0 200 195" role="presentation" aria-hidden="true">
|
|
578
|
-
<path class="gauge-track" d="${
|
|
579
|
+
<path class="gauge-track" d="${h}" fill="none" stroke-width="12" stroke-linecap="round"></path>
|
|
579
580
|
<path class="gauge-fill" d="${u ?? "M0 0"}" fill="none" stroke="${u ? i : "none"}" stroke-width="12" stroke-linecap="round"></path>
|
|
580
581
|
</svg>
|
|
581
582
|
</div>
|
|
@@ -641,6 +642,7 @@ W.styles = [b, w`
|
|
|
641
642
|
.gauge-svg {
|
|
642
643
|
display: block;
|
|
643
644
|
width: 100%;
|
|
645
|
+
aspect-ratio: 200 / 195;
|
|
644
646
|
}
|
|
645
647
|
|
|
646
648
|
.gauge-track {
|
|
@@ -715,7 +717,7 @@ W.styles = [b, w`
|
|
|
715
717
|
}
|
|
716
718
|
`];
|
|
717
719
|
fe([
|
|
718
|
-
|
|
720
|
+
m({ type: Object })
|
|
719
721
|
], W.prototype, "spec", 2);
|
|
720
722
|
W = fe([
|
|
721
723
|
x("u-gauge")
|
|
@@ -794,7 +796,7 @@ let z = class extends y {
|
|
|
794
796
|
return ue(typeof e == "string" ? e : void 0);
|
|
795
797
|
}
|
|
796
798
|
renderTable() {
|
|
797
|
-
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`
|
|
798
800
|
<div class="search-box" part="search">
|
|
799
801
|
<input
|
|
800
802
|
class="search-input"
|
|
@@ -805,7 +807,7 @@ let z = class extends y {
|
|
|
805
807
|
@input=${this._onSearch}
|
|
806
808
|
/>
|
|
807
809
|
</div>
|
|
808
|
-
` : l,
|
|
810
|
+
` : l, f = n > 0 && p > 1 ? o`
|
|
809
811
|
<nav class="pagination" part="pagination" aria-label=${a.tablePagination}>
|
|
810
812
|
<button aria-label=${a.previousPage} ?disabled=${g === 0} @click=${() => this._onPageChange(g - 1)}>${a.prev}</button>
|
|
811
813
|
<span aria-live="polite">${g + 1} / ${p}</span>
|
|
@@ -835,7 +837,7 @@ let z = class extends y {
|
|
|
835
837
|
</tr>
|
|
836
838
|
</thead>
|
|
837
839
|
<tbody @keydown=${this._onTableKeydown}>
|
|
838
|
-
${
|
|
840
|
+
${h.map(
|
|
839
841
|
(v, $) => o`
|
|
840
842
|
<tr part="tr"
|
|
841
843
|
tabindex=${$ === this._focusedIdx ? "0" : "-1"}
|
|
@@ -855,7 +857,7 @@ let z = class extends y {
|
|
|
855
857
|
</tbody>
|
|
856
858
|
</table>
|
|
857
859
|
</div>
|
|
858
|
-
${
|
|
860
|
+
${f}
|
|
859
861
|
</div>`;
|
|
860
862
|
}
|
|
861
863
|
_onPageChange(e) {
|
|
@@ -898,8 +900,8 @@ let z = class extends y {
|
|
|
898
900
|
<div class="list-item" part="list-item"
|
|
899
901
|
tabindex=${g === this._focusedIdx ? "0" : "-1"}
|
|
900
902
|
@click=${() => this._onRowClick(p, g)}
|
|
901
|
-
@keydown=${(
|
|
902
|
-
(
|
|
903
|
+
@keydown=${(h) => {
|
|
904
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), this._onRowClick(p, g));
|
|
903
905
|
}}
|
|
904
906
|
>
|
|
905
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}
|
|
@@ -1256,7 +1258,7 @@ z.styles = [b, w`
|
|
|
1256
1258
|
}
|
|
1257
1259
|
`];
|
|
1258
1260
|
C([
|
|
1259
|
-
|
|
1261
|
+
m({ type: Object })
|
|
1260
1262
|
], z.prototype, "spec", 2);
|
|
1261
1263
|
C([
|
|
1262
1264
|
S()
|
|
@@ -1276,8 +1278,8 @@ C([
|
|
|
1276
1278
|
z = C([
|
|
1277
1279
|
x("u-table")
|
|
1278
1280
|
], z);
|
|
1279
|
-
var We = Object.defineProperty,
|
|
1280
|
-
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--)
|
|
1281
1283
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
1282
1284
|
return r && i && We(t, a, i), i;
|
|
1283
1285
|
};
|
|
@@ -1792,7 +1794,7 @@ j.styles = [b, w`
|
|
|
1792
1794
|
}
|
|
1793
1795
|
`];
|
|
1794
1796
|
V([
|
|
1795
|
-
|
|
1797
|
+
m({ type: Object })
|
|
1796
1798
|
], j.prototype, "spec", 2);
|
|
1797
1799
|
V([
|
|
1798
1800
|
S()
|
|
@@ -1803,10 +1805,10 @@ V([
|
|
|
1803
1805
|
j = V([
|
|
1804
1806
|
x("u-form")
|
|
1805
1807
|
], j);
|
|
1806
|
-
var
|
|
1808
|
+
var Ke = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, Z = (e, t, a, r) => {
|
|
1807
1809
|
for (var i = r > 1 ? void 0 : r ? Ve(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1808
1810
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
1809
|
-
return r && i &&
|
|
1811
|
+
return r && i && Ke(t, a, i), i;
|
|
1810
1812
|
};
|
|
1811
1813
|
let I = class extends y {
|
|
1812
1814
|
constructor() {
|
|
@@ -1888,6 +1890,10 @@ I.styles = [b, w`
|
|
|
1888
1890
|
gap: var(--u-widget-gap, 16px);
|
|
1889
1891
|
}
|
|
1890
1892
|
|
|
1893
|
+
.layout-grid > * {
|
|
1894
|
+
min-height: 60px;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1891
1897
|
.child-card {
|
|
1892
1898
|
padding: 16px 20px;
|
|
1893
1899
|
border-radius: var(--u-widget-radius, 6px);
|
|
@@ -1946,10 +1952,10 @@ I.styles = [b, w`
|
|
|
1946
1952
|
}
|
|
1947
1953
|
`];
|
|
1948
1954
|
Z([
|
|
1949
|
-
|
|
1955
|
+
m({ type: Object })
|
|
1950
1956
|
], I.prototype, "spec", 2);
|
|
1951
1957
|
Z([
|
|
1952
|
-
|
|
1958
|
+
m({ type: String, reflect: !0 })
|
|
1953
1959
|
], I.prototype, "theme", 2);
|
|
1954
1960
|
I = Z([
|
|
1955
1961
|
x("u-compose")
|
|
@@ -1959,7 +1965,7 @@ var Ge = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, he = (e, t
|
|
|
1959
1965
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
1960
1966
|
return r && i && Ge(t, a, i), i;
|
|
1961
1967
|
};
|
|
1962
|
-
let
|
|
1968
|
+
let H = class extends y {
|
|
1963
1969
|
constructor() {
|
|
1964
1970
|
super(...arguments), this.spec = null;
|
|
1965
1971
|
}
|
|
@@ -2009,9 +2015,9 @@ let K = class extends y {
|
|
|
2009
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(
|
|
2010
2016
|
/^(\|.+\|)\n(\|[\s:|-]+\|)\n((?:\|.+\|\n?)+)/gm,
|
|
2011
2017
|
(a, r, i, s) => {
|
|
2012
|
-
const n = (u) => u.split("|").slice(1, -1).map((
|
|
2013
|
-
`).map(n), g = d.map((u,
|
|
2014
|
-
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>`;
|
|
2015
2021
|
}
|
|
2016
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(
|
|
2017
2023
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
@@ -2027,7 +2033,7 @@ let K = class extends y {
|
|
|
2027
2033
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2028
2034
|
}
|
|
2029
2035
|
};
|
|
2030
|
-
|
|
2036
|
+
H.styles = [b, w`
|
|
2031
2037
|
:host {
|
|
2032
2038
|
display: block;
|
|
2033
2039
|
font-family: system-ui, -apple-system, sans-serif;
|
|
@@ -2205,17 +2211,17 @@ K.styles = [b, w`
|
|
|
2205
2211
|
}
|
|
2206
2212
|
`];
|
|
2207
2213
|
he([
|
|
2208
|
-
|
|
2209
|
-
],
|
|
2210
|
-
|
|
2214
|
+
m({ type: Object })
|
|
2215
|
+
], H.prototype, "spec", 2);
|
|
2216
|
+
H = he([
|
|
2211
2217
|
x("u-content")
|
|
2212
|
-
],
|
|
2218
|
+
], H);
|
|
2213
2219
|
var Je = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, me = (e, t, a, r) => {
|
|
2214
2220
|
for (var i = r > 1 ? void 0 : r ? Ye(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2215
2221
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
2216
2222
|
return r && i && Je(t, a, i), i;
|
|
2217
2223
|
};
|
|
2218
|
-
let
|
|
2224
|
+
let K = class extends y {
|
|
2219
2225
|
constructor() {
|
|
2220
2226
|
super(...arguments), this.spec = null;
|
|
2221
2227
|
}
|
|
@@ -2246,7 +2252,7 @@ let H = class extends y {
|
|
|
2246
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) : [] : [];
|
|
2247
2253
|
}
|
|
2248
2254
|
};
|
|
2249
|
-
|
|
2255
|
+
K.styles = [b, w`
|
|
2250
2256
|
:host {
|
|
2251
2257
|
display: block;
|
|
2252
2258
|
font-family: system-ui, -apple-system, sans-serif;
|
|
@@ -2341,11 +2347,11 @@ H.styles = [b, w`
|
|
|
2341
2347
|
}
|
|
2342
2348
|
`];
|
|
2343
2349
|
me([
|
|
2344
|
-
|
|
2345
|
-
],
|
|
2346
|
-
|
|
2350
|
+
m({ type: Object })
|
|
2351
|
+
], K.prototype, "spec", 2);
|
|
2352
|
+
K = me([
|
|
2347
2353
|
x("u-kv")
|
|
2348
|
-
],
|
|
2354
|
+
], K);
|
|
2349
2355
|
var Ze = Object.defineProperty, Qe = Object.getOwnPropertyDescriptor, G = (e, t, a, r) => {
|
|
2350
2356
|
for (var i = r > 1 ? void 0 : r ? Qe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
2351
2357
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
@@ -2434,50 +2440,50 @@ function it(e, t) {
|
|
|
2434
2440
|
const g = e.length;
|
|
2435
2441
|
for (; p < g; ) {
|
|
2436
2442
|
if (n && e.startsWith(n[0], p)) {
|
|
2437
|
-
const u = e.indexOf(n[1], p + n[0].length),
|
|
2438
|
-
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;
|
|
2439
2445
|
continue;
|
|
2440
2446
|
}
|
|
2441
2447
|
if (s && e.startsWith(s, p)) {
|
|
2442
2448
|
const u = e.indexOf(`
|
|
2443
|
-
`, p),
|
|
2444
|
-
c += D(
|
|
2449
|
+
`, p), f = u === -1 ? e.slice(p) : e.slice(p, u);
|
|
2450
|
+
c += D(f, "c"), p += f.length;
|
|
2445
2451
|
continue;
|
|
2446
2452
|
}
|
|
2447
|
-
const
|
|
2448
|
-
if (
|
|
2449
|
-
const u = ve(e, p,
|
|
2453
|
+
const h = e[p];
|
|
2454
|
+
if (h === '"' || h === "'" || h === "`" && d) {
|
|
2455
|
+
const u = ve(e, p, h);
|
|
2450
2456
|
c += D(e.slice(p, u), "s"), p = u;
|
|
2451
2457
|
continue;
|
|
2452
2458
|
}
|
|
2453
|
-
if (/\d/.test(
|
|
2459
|
+
if (/\d/.test(h) && (p === 0 || !/[a-zA-Z_$]/.test(e[p - 1]))) {
|
|
2454
2460
|
let u = p + 1;
|
|
2455
2461
|
for (; u < g && /[0-9a-fA-FxXoObBeE._]/.test(e[u]); ) u++;
|
|
2456
2462
|
c += D(e.slice(p, u), "n"), p = u;
|
|
2457
2463
|
continue;
|
|
2458
2464
|
}
|
|
2459
|
-
if (/[a-zA-Z_$]/.test(
|
|
2465
|
+
if (/[a-zA-Z_$]/.test(h)) {
|
|
2460
2466
|
let u = p + 1;
|
|
2461
2467
|
for (; u < g && /[a-zA-Z0-9_$]/.test(e[u]); ) u++;
|
|
2462
|
-
const
|
|
2463
|
-
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;
|
|
2464
2470
|
continue;
|
|
2465
2471
|
}
|
|
2466
|
-
if (a === "html" &&
|
|
2472
|
+
if (a === "html" && h === "<" && p + 1 < g && /[a-zA-Z/!]/.test(e[p + 1])) {
|
|
2467
2473
|
const u = e.indexOf(">", p);
|
|
2468
2474
|
if (u !== -1) {
|
|
2469
2475
|
c += `<span class="hl-k">${k(e.slice(p, u + 1))}</span>`, p = u + 1;
|
|
2470
2476
|
continue;
|
|
2471
2477
|
}
|
|
2472
2478
|
}
|
|
2473
|
-
if (a === "css" && /[a-z-]/.test(
|
|
2479
|
+
if (a === "css" && /[a-z-]/.test(h)) {
|
|
2474
2480
|
let u = p + 1;
|
|
2475
2481
|
for (; u < g && /[a-z-]/.test(e[u]); ) u++;
|
|
2476
|
-
const
|
|
2477
|
-
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;
|
|
2478
2484
|
continue;
|
|
2479
2485
|
}
|
|
2480
|
-
c += k(
|
|
2486
|
+
c += k(h), p++;
|
|
2481
2487
|
}
|
|
2482
2488
|
return c;
|
|
2483
2489
|
}
|
|
@@ -2520,10 +2526,10 @@ let O = class extends y {
|
|
|
2520
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(
|
|
2521
2527
|
Array.isArray(r.highlight) ? r.highlight : []
|
|
2522
2528
|
), g = it(t, a).split(`
|
|
2523
|
-
`).map((u,
|
|
2524
|
-
const v =
|
|
2529
|
+
`).map((u, f) => {
|
|
2530
|
+
const v = f + 1, $ = d.has(v) ? " line-hl" : "", _ = i ? `<span class="line-no">${v}</span>` : "";
|
|
2525
2531
|
return `<span class="line${$}">${_}${u || " "}</span>`;
|
|
2526
|
-
}).join(""),
|
|
2532
|
+
}).join(""), h = n ? `max-height: ${n}` : "";
|
|
2527
2533
|
return o`
|
|
2528
2534
|
<div class="code-block" part="code">
|
|
2529
2535
|
<div class="code-header" part="code-header">
|
|
@@ -2535,7 +2541,7 @@ let O = class extends y {
|
|
|
2535
2541
|
@click=${this._copyCode}
|
|
2536
2542
|
>${this._copied ? "Copied!" : "Copy"}</button>
|
|
2537
2543
|
</div>
|
|
2538
|
-
<div class="code-body" part="code-body" style=${
|
|
2544
|
+
<div class="code-body" part="code-body" style=${h}>
|
|
2539
2545
|
<pre data-wrap=${String(s)}><code .innerHTML=${g}></code></pre>
|
|
2540
2546
|
</div>
|
|
2541
2547
|
</div>
|
|
@@ -2658,10 +2664,10 @@ O.styles = [b, w`
|
|
|
2658
2664
|
}
|
|
2659
2665
|
`];
|
|
2660
2666
|
G([
|
|
2661
|
-
|
|
2667
|
+
m({ type: Object })
|
|
2662
2668
|
], O.prototype, "spec", 2);
|
|
2663
2669
|
G([
|
|
2664
|
-
|
|
2670
|
+
m({ type: String, reflect: !0 })
|
|
2665
2671
|
], O.prototype, "theme", 2);
|
|
2666
2672
|
G([
|
|
2667
2673
|
S()
|
|
@@ -2859,10 +2865,10 @@ N.styles = [b, w`
|
|
|
2859
2865
|
}
|
|
2860
2866
|
`];
|
|
2861
2867
|
Q([
|
|
2862
|
-
|
|
2868
|
+
m({ type: Object })
|
|
2863
2869
|
], N.prototype, "spec", 2);
|
|
2864
2870
|
Q([
|
|
2865
|
-
|
|
2871
|
+
m({ type: String, reflect: !0 })
|
|
2866
2872
|
], N.prototype, "theme", 2);
|
|
2867
2873
|
N = Q([
|
|
2868
2874
|
x("u-citation")
|
|
@@ -2995,10 +3001,10 @@ F.styles = [b, w`
|
|
|
2995
3001
|
}
|
|
2996
3002
|
`];
|
|
2997
3003
|
ee([
|
|
2998
|
-
|
|
3004
|
+
m({ type: Object })
|
|
2999
3005
|
], F.prototype, "spec", 2);
|
|
3000
3006
|
ee([
|
|
3001
|
-
|
|
3007
|
+
m({ type: String, reflect: !0 })
|
|
3002
3008
|
], F.prototype, "theme", 2);
|
|
3003
3009
|
F = ee([
|
|
3004
3010
|
x("u-status")
|
|
@@ -3321,10 +3327,10 @@ M.styles = [b, w`
|
|
|
3321
3327
|
}
|
|
3322
3328
|
`];
|
|
3323
3329
|
te([
|
|
3324
|
-
|
|
3330
|
+
m({ type: Object })
|
|
3325
3331
|
], M.prototype, "spec", 2);
|
|
3326
3332
|
te([
|
|
3327
|
-
|
|
3333
|
+
m({ type: String, reflect: !0 })
|
|
3328
3334
|
], M.prototype, "theme", 2);
|
|
3329
3335
|
M = te([
|
|
3330
3336
|
x("u-steps")
|
|
@@ -3342,7 +3348,7 @@ const vt = {
|
|
|
3342
3348
|
thumb: ["👍", "👍", "👍"]
|
|
3343
3349
|
// 👍
|
|
3344
3350
|
};
|
|
3345
|
-
let
|
|
3351
|
+
let E = class extends y {
|
|
3346
3352
|
constructor() {
|
|
3347
3353
|
super(...arguments), this.spec = null, this.theme = null, this._hoverIdx = -1;
|
|
3348
3354
|
}
|
|
@@ -3357,7 +3363,7 @@ let P = class extends y {
|
|
|
3357
3363
|
@mouseleave=${i ? () => {
|
|
3358
3364
|
this._hoverIdx = -1;
|
|
3359
3365
|
} : void 0}>
|
|
3360
|
-
${Array.from({ length: r }, (g,
|
|
3366
|
+
${Array.from({ length: r }, (g, h) => this._renderIcon(h, p, c, s, i))}
|
|
3361
3367
|
</div>
|
|
3362
3368
|
${!i && a > 0 ? o`<span class="rating-value" part="rating-value">${a}</span>` : l}
|
|
3363
3369
|
${d != null ? o`<span class="rating-count" part="rating-count">(${d})</span>` : l}
|
|
@@ -3420,7 +3426,7 @@ let P = class extends y {
|
|
|
3420
3426
|
return t === "heart" || t === "thumb" ? t : "star";
|
|
3421
3427
|
}
|
|
3422
3428
|
};
|
|
3423
|
-
|
|
3429
|
+
E.styles = [b, w`
|
|
3424
3430
|
:host {
|
|
3425
3431
|
display: block;
|
|
3426
3432
|
font-family: system-ui, -apple-system, sans-serif;
|
|
@@ -3527,17 +3533,17 @@ P.styles = [b, w`
|
|
|
3527
3533
|
}
|
|
3528
3534
|
`];
|
|
3529
3535
|
X([
|
|
3530
|
-
|
|
3531
|
-
],
|
|
3536
|
+
m({ type: Object })
|
|
3537
|
+
], E.prototype, "spec", 2);
|
|
3532
3538
|
X([
|
|
3533
|
-
|
|
3534
|
-
],
|
|
3539
|
+
m({ type: String, reflect: !0 })
|
|
3540
|
+
], E.prototype, "theme", 2);
|
|
3535
3541
|
X([
|
|
3536
3542
|
S()
|
|
3537
|
-
],
|
|
3538
|
-
|
|
3543
|
+
], E.prototype, "_hoverIdx", 2);
|
|
3544
|
+
E = X([
|
|
3539
3545
|
x("u-rating")
|
|
3540
|
-
],
|
|
3546
|
+
], E);
|
|
3541
3547
|
var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, re = (e, t, a, r) => {
|
|
3542
3548
|
for (var i = r > 1 ? void 0 : r ? wt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
|
|
3543
3549
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
@@ -3612,10 +3618,10 @@ T.styles = [b, w`
|
|
|
3612
3618
|
}
|
|
3613
3619
|
`];
|
|
3614
3620
|
re([
|
|
3615
|
-
|
|
3621
|
+
m({ type: Object })
|
|
3616
3622
|
], T.prototype, "spec", 2);
|
|
3617
3623
|
re([
|
|
3618
|
-
|
|
3624
|
+
m({ type: String, reflect: !0 })
|
|
3619
3625
|
], T.prototype, "theme", 2);
|
|
3620
3626
|
T = re([
|
|
3621
3627
|
x("u-video")
|
|
@@ -3705,10 +3711,10 @@ U.styles = [b, w`
|
|
|
3705
3711
|
}
|
|
3706
3712
|
`];
|
|
3707
3713
|
ae([
|
|
3708
|
-
|
|
3714
|
+
m({ type: Object })
|
|
3709
3715
|
], U.prototype, "spec", 2);
|
|
3710
3716
|
ae([
|
|
3711
|
-
|
|
3717
|
+
m({ type: String, reflect: !0 })
|
|
3712
3718
|
], U.prototype, "theme", 2);
|
|
3713
3719
|
U = ae([
|
|
3714
3720
|
x("u-gallery")
|
|
@@ -3718,7 +3724,7 @@ var $t = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, J = (e, t,
|
|
|
3718
3724
|
(n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
|
|
3719
3725
|
return r && i && $t(t, a, i), i;
|
|
3720
3726
|
};
|
|
3721
|
-
let
|
|
3727
|
+
let P = class extends y {
|
|
3722
3728
|
constructor() {
|
|
3723
3729
|
super(...arguments), this.spec = null, this.theme = null, this.locale = null, this._handleInternalEvent = (e) => {
|
|
3724
3730
|
e.stopPropagation(), this.dispatchEvent(
|
|
@@ -3820,8 +3826,9 @@ let E = class extends y {
|
|
|
3820
3826
|
}
|
|
3821
3827
|
return this.renderFallback(r);
|
|
3822
3828
|
}
|
|
3823
|
-
|
|
3824
|
-
|
|
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`
|
|
3825
3832
|
<button
|
|
3826
3833
|
data-style=${f.style ?? "default"}
|
|
3827
3834
|
?disabled=${f.disabled}
|
|
@@ -3829,7 +3836,7 @@ let E = class extends y {
|
|
|
3829
3836
|
part="action-btn"
|
|
3830
3837
|
>${f.label}</button>
|
|
3831
3838
|
`);
|
|
3832
|
-
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>`;
|
|
3833
3840
|
}
|
|
3834
3841
|
return c;
|
|
3835
3842
|
}
|
|
@@ -3890,7 +3897,7 @@ let E = class extends y {
|
|
|
3890
3897
|
);
|
|
3891
3898
|
}
|
|
3892
3899
|
renderFallback(e) {
|
|
3893
|
-
const t =
|
|
3900
|
+
const t = Pe(e.widget);
|
|
3894
3901
|
return o`
|
|
3895
3902
|
<div class="fallback-card" part="fallback">
|
|
3896
3903
|
<div class="fallback-label">${e.title ?? `Unknown widget: ${e.widget}`}</div>
|
|
@@ -3913,7 +3920,7 @@ let E = class extends y {
|
|
|
3913
3920
|
`;
|
|
3914
3921
|
}
|
|
3915
3922
|
};
|
|
3916
|
-
|
|
3923
|
+
P.styles = [
|
|
3917
3924
|
b,
|
|
3918
3925
|
w`
|
|
3919
3926
|
:host {
|
|
@@ -3994,6 +4001,14 @@ E.styles = [
|
|
|
3994
4001
|
cursor: default;
|
|
3995
4002
|
}
|
|
3996
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
|
+
|
|
3997
4012
|
/* ── global action bar ── */
|
|
3998
4013
|
.global-actions {
|
|
3999
4014
|
display: flex;
|
|
@@ -4085,7 +4100,7 @@ E.styles = [
|
|
|
4085
4100
|
`
|
|
4086
4101
|
];
|
|
4087
4102
|
J([
|
|
4088
|
-
|
|
4103
|
+
m({
|
|
4089
4104
|
type: Object,
|
|
4090
4105
|
converter: {
|
|
4091
4106
|
fromAttribute(e) {
|
|
@@ -4098,22 +4113,22 @@ J([
|
|
|
4098
4113
|
}
|
|
4099
4114
|
}
|
|
4100
4115
|
})
|
|
4101
|
-
],
|
|
4116
|
+
], P.prototype, "spec", 2);
|
|
4102
4117
|
J([
|
|
4103
|
-
|
|
4104
|
-
],
|
|
4118
|
+
m({ type: String, reflect: !0 })
|
|
4119
|
+
], P.prototype, "theme", 2);
|
|
4105
4120
|
J([
|
|
4106
|
-
|
|
4107
|
-
],
|
|
4108
|
-
|
|
4121
|
+
m({ type: String, reflect: !0 })
|
|
4122
|
+
], P.prototype, "locale", 2);
|
|
4123
|
+
P = J([
|
|
4109
4124
|
x("u-widget")
|
|
4110
|
-
],
|
|
4125
|
+
], P);
|
|
4111
4126
|
export {
|
|
4112
|
-
|
|
4127
|
+
P as UWidget,
|
|
4113
4128
|
A as formatTemplate,
|
|
4114
4129
|
pe as formatValue,
|
|
4115
4130
|
Ot as getDefaultLocale,
|
|
4116
|
-
|
|
4131
|
+
Pt as getEffectiveLocale,
|
|
4117
4132
|
be as getFormdownParser,
|
|
4118
4133
|
ue as getLocaleStrings,
|
|
4119
4134
|
we as infer,
|
|
@@ -4123,8 +4138,8 @@ export {
|
|
|
4123
4138
|
Ft as registerFormdownParser,
|
|
4124
4139
|
jt as registerLocale,
|
|
4125
4140
|
Ie as resolveLocale,
|
|
4126
|
-
|
|
4127
|
-
|
|
4141
|
+
Et as setDefaultLocale,
|
|
4142
|
+
Pe as suggestWidget,
|
|
4128
4143
|
Y as validate
|
|
4129
4144
|
};
|
|
4130
4145
|
//# sourceMappingURL=u-widgets.js.map
|