@voidable/ui 0.11.0 → 0.12.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/README.md +1 -1
- package/dist/angular/index.d.ts +2 -2
- package/dist/angular/index.js +2 -1
- package/dist/chunks/activation-B8aBarKd.js +4 -0
- package/dist/chunks/carousel-C9u0bg5l.js +10 -0
- package/dist/chunks/choice-BTrsi7OW.js +16 -0
- package/dist/chunks/data-Baycjoo4.js +96 -0
- package/dist/chunks/fields-MEqz-olE.js +21 -0
- package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
- package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
- package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
- package/dist/chunks/menu-CxRRgkJI.js +21 -0
- package/dist/chunks/{modal-DWGkNdNG.js → modal-Cz2-Ov76.js} +23 -15
- package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
- package/dist/chunks/{overlay-CH7L4N-h.js → overlay-BuV-4Yvt.js} +75 -68
- package/dist/chunks/overlay-K1ilWC1p.js +4 -0
- package/dist/chunks/pickers-CjlFgNke.js +36 -0
- package/dist/chunks/table-BBpqwWEi.js +4 -0
- package/dist/chunks/tabs-Buf3EBWq.js +10 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.js +22 -14
- package/dist/components/action-input.d.ts +2 -1
- package/dist/components/action-input.js +59 -55
- package/dist/components/bar-chart.js +41 -40
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +15 -11
- package/dist/components/button.d.ts +7 -0
- package/dist/components/button.js +23 -16
- package/dist/components/calendar.d.ts +45 -10
- package/dist/components/calendar.js +183 -129
- package/dist/components/carousel.d.ts +22 -0
- package/dist/components/carousel.js +64 -35
- package/dist/components/charts/data.d.ts +2 -2
- package/dist/components/checkbox-group.js +22 -21
- package/dist/components/checkbox.d.ts +7 -0
- package/dist/components/checkbox.js +29 -24
- package/dist/components/collapsible.d.ts +7 -0
- package/dist/components/collapsible.js +19 -11
- package/dist/components/color-picker.js +28 -27
- package/dist/components/combobox.d.ts +13 -1
- package/dist/components/combobox.js +54 -41
- package/dist/components/compose-input.d.ts +9 -1
- package/dist/components/compose-input.js +28 -16
- package/dist/components/dialog.js +1 -1
- package/dist/components/donut-chart.js +57 -56
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.d.ts +22 -0
- package/dist/components/dropdown-menu.js +54 -39
- package/dist/components/editable.d.ts +11 -1
- package/dist/components/editable.js +35 -22
- package/dist/components/error-fallback.d.ts +4 -2
- package/dist/components/error-fallback.js +34 -28
- package/dist/components/file-upload.d.ts +9 -0
- package/dist/components/file-upload.js +54 -28
- package/dist/components/gauge.js +108 -107
- package/dist/components/hamburger.d.ts +7 -0
- package/dist/components/hamburger.js +28 -19
- package/dist/components/hover-card.d.ts +7 -0
- package/dist/components/hover-card.js +22 -14
- package/dist/components/indicator.js +15 -14
- package/dist/components/input.js +1 -1
- package/dist/components/line-chart.js +43 -42
- package/dist/components/menu.d.ts +25 -0
- package/dist/components/menu.js +55 -33
- package/dist/components/multiselect.d.ts +17 -1
- package/dist/components/multiselect.js +96 -74
- package/dist/components/nav-menu.d.ts +9 -0
- package/dist/components/nav-menu.js +30 -23
- package/dist/components/number-input.d.ts +15 -1
- package/dist/components/number-input.js +71 -37
- package/dist/components/pagination.js +25 -24
- package/dist/components/pin-input.d.ts +11 -0
- package/dist/components/pin-input.js +46 -32
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +21 -13
- package/dist/components/radio-group.js +1 -1
- package/dist/components/radio.d.ts +10 -1
- package/dist/components/radio.js +37 -32
- package/dist/components/segmented-control.d.ts +14 -0
- package/dist/components/segmented-control.js +40 -28
- package/dist/components/sidebar.d.ts +1 -0
- package/dist/components/sidebar.js +14 -10
- package/dist/components/slider.js +1 -1
- package/dist/components/spinner.d.ts +5 -3
- package/dist/components/spinner.js +21 -14
- package/dist/components/stat.js +1 -1
- package/dist/components/status-dot.d.ts +2 -2
- package/dist/components/status-dot.js +12 -14
- package/dist/components/stepper.d.ts +2 -0
- package/dist/components/stepper.js +20 -13
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.js +24 -16
- package/dist/components/table.d.ts +77 -1
- package/dist/components/table.js +562 -73
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +42 -33
- package/dist/components/tag.js +12 -11
- package/dist/components/tags-input.d.ts +10 -1
- package/dist/components/tags-input.js +42 -30
- package/dist/components/textarea.js +1 -1
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +35 -28
- package/dist/components/toggle-group.d.ts +8 -0
- package/dist/components/toggle-group.js +24 -17
- package/dist/components/toggle.d.ts +7 -0
- package/dist/components/toggle.js +23 -15
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +20 -12
- package/dist/components.json +96 -74
- package/dist/custom-elements.json +4213 -131
- package/dist/dev/rules.d.ts +0 -1
- package/dist/dev/types.d.ts +3 -1
- package/dist/dev.js +244 -113
- package/dist/index.d.ts +4 -0
- package/dist/index.js +68 -66
- package/dist/keyboard-activation.d.ts +9 -9
- package/dist/keyboard.d.ts +2 -10
- package/dist/keymaps/activation.d.ts +8 -0
- package/dist/keymaps/carousel.d.ts +9 -0
- package/dist/keymaps/choice.d.ts +21 -0
- package/dist/keymaps/fields.d.ts +31 -0
- package/dist/keymaps/index.d.ts +2 -0
- package/dist/keymaps/menu.d.ts +36 -0
- package/dist/keymaps/nav-menu.d.ts +11 -0
- package/dist/keymaps/overlay.d.ts +4 -0
- package/dist/keymaps/pickers.d.ts +36 -0
- package/dist/keymaps/table.d.ts +8 -0
- package/dist/keymaps/tabs.d.ts +7 -0
- package/dist/keymaps.js +51 -0
- package/dist/keys.d.ts +46 -0
- package/dist/keys.js +57 -0
- package/dist/llms.txt +11 -3
- package/dist/messages/ar.d.ts +1 -0
- package/dist/messages/ar.js +130 -0
- package/dist/messages/fr.d.ts +1 -0
- package/dist/messages/fr.js +109 -0
- package/dist/messages.d.ts +213 -0
- package/dist/messages.js +190 -0
- package/dist/modal.d.ts +7 -0
- package/dist/reference.md +817 -17
- package/dist/testing/index.d.ts +46 -0
- package/dist/testing.js +79 -0
- package/dist/types/elements.d.ts +89 -73
- package/dist/types/react.d.ts +5 -1
- package/dist/types/solid.d.ts +5 -1
- package/dist/types/solid2.d.ts +4 -0
- package/dist/types/svelte.d.ts +5 -1
- package/dist/types/vue.d.ts +5 -1
- package/dist/vscode.html-custom-data.json +384 -18
- package/dist/web-types.json +830 -69
- package/package.json +22 -2
- package/dist/chunks/data-BpiiNapL.js +0 -95
package/dist/components/gauge.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { msg as n } from "../messages.js";
|
|
4
|
+
import { r } from "../chunks/projection-oPe6ipjL.js";
|
|
5
|
+
import { i, l as a, n as o, o as s, r as c, s as l, t as u } from "../chunks/data-Baycjoo4.js";
|
|
6
|
+
import { html as d, nothing as f, svg as p } from "lit";
|
|
7
|
+
import { property as m, state as h } from "lit/decorators.js";
|
|
8
|
+
import { guard as g } from "lit/directives/guard.js";
|
|
8
9
|
//#region src/components/gauge.ts
|
|
9
|
-
|
|
10
|
-
function
|
|
10
|
+
r();
|
|
11
|
+
function _(e) {
|
|
11
12
|
return 1 - (1 - e) ** 3;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function v(e) {
|
|
14
15
|
return Math.abs(e) >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function y(e, t, n, r, i) {
|
|
17
18
|
let a = i - r, o = Math.abs(a) >= 2 * Math.PI ? r + Math.sign(a) * (2 * Math.PI - 1e-4) : i, s = e + n * Math.cos(r), c = t + n * Math.sin(r), l = e + n * Math.cos(o), u = t + n * Math.sin(o), d = +(Math.abs(o - r) > Math.PI), f = +(o - r >= 0);
|
|
18
19
|
return `M ${s.toFixed(2)} ${c.toFixed(2)} A ${n} ${n} 0 ${d} ${f} ${l.toFixed(2)} ${u.toFixed(2)}`;
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function b(e, t, n, r, i, a) {
|
|
21
22
|
let o = n + r / 2, s = Math.max(0, n - r / 2), c = r / 2, l = a - i, u = Math.abs(l) >= 2 * Math.PI ? i + Math.sign(l) * (2 * Math.PI - 1e-4) : a, d = e + o * Math.cos(i), f = t + o * Math.sin(i), p = e + o * Math.cos(u), m = t + o * Math.sin(u), h = e + s * Math.cos(i), g = t + s * Math.sin(i), _ = e + s * Math.cos(u), v = t + s * Math.sin(u), y = +(Math.abs(u - i) > Math.PI);
|
|
22
23
|
return `M ${d.toFixed(2)} ${f.toFixed(2)} A ${o} ${o} 0 ${y} 1 ${p.toFixed(2)} ${m.toFixed(2)} A ${c} ${c} 0 0 1 ${_.toFixed(2)} ${v.toFixed(2)} A ${s} ${s} 0 ${y} 0 ${h.toFixed(2)} ${g.toFixed(2)} A ${c} ${c} 0 0 1 ${d.toFixed(2)} ${f.toFixed(2)} Z`;
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function x(e, t, n, r, i, a, o, s) {
|
|
25
26
|
let c = n + r / 2, l = Math.max(0, n - r / 2), u = r / 2, d = a - i, f = Math.abs(d) >= 2 * Math.PI ? i + Math.sign(d) * (2 * Math.PI - 1e-4) : a, p = e + c * Math.cos(i), m = t + c * Math.sin(i), h = e + c * Math.cos(f), g = t + c * Math.sin(f), _ = e + l * Math.cos(i), v = t + l * Math.sin(i), y = e + l * Math.cos(f), b = t + l * Math.sin(f), x = +(Math.abs(f - i) > Math.PI), S = `M ${p.toFixed(2)} ${m.toFixed(2)} `;
|
|
26
27
|
return S += `A ${c} ${c} 0 ${x} 1 ${h.toFixed(2)} ${g.toFixed(2)} `, s === "round" ? S += `A ${u} ${u} 0 0 1 ${y.toFixed(2)} ${b.toFixed(2)} ` : S += `L ${y.toFixed(2)} ${b.toFixed(2)} `, S += `A ${l} ${l} 0 ${x} 0 ${_.toFixed(2)} ${v.toFixed(2)} `, o === "round" ? S += `A ${u} ${u} 0 0 1 ${p.toFixed(2)} ${m.toFixed(2)} ` : o === "cup" ? S += `A ${u} ${u} 0 0 0 ${p.toFixed(2)} ${m.toFixed(2)} ` : S += `L ${p.toFixed(2)} ${m.toFixed(2)} `, S += "Z", S;
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
-
function
|
|
29
|
+
var S = 1.5 * 5;
|
|
30
|
+
function C(e) {
|
|
30
31
|
let t = Math.PI;
|
|
31
32
|
return e === "full" ? {
|
|
32
33
|
startAngle: -t / 2,
|
|
@@ -42,7 +43,7 @@ function S(e) {
|
|
|
42
43
|
totalSweep: 3 * t / 2
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
|
-
var
|
|
46
|
+
var w = class extends e {
|
|
46
47
|
constructor(...e) {
|
|
47
48
|
super(...e), this.unit = "", this.value = 0, this.min = 0, this.max = 100, this.size = 220, this.thickness = 14, this.circular = "triple", this.variant = "filled", this.hideValue = !1, this.unitInline = !1, this.tickMajor = 0, this.tickMinor = 0, this.hideTickMin = !1, this.hideTickMax = !1, this.segmentsSort = "value", this.gaps = !1, this.ariaLabel = "", this.showTable = !1, this._zones = [], this._zonesSource = { text: null }, this._data = {}, this._source = { text: null }, this._phase = "pre", this._hoverSegment = null, this._hoverX = 0, this._hoverY = 0, this._displayValue = 0, this._displayValueFrom = 0, this._targetValue = 0, this._displaySegments = /* @__PURE__ */ new Map(), this._segmentsFrom = /* @__PURE__ */ new Map(), this._targetSegments = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._hasAnimated = !1, this._onMouseMove = (e) => {
|
|
48
49
|
let t = this.querySelector("svg");
|
|
@@ -59,7 +60,7 @@ var C = class extends e {
|
|
|
59
60
|
this._hoverSegment !== null && (this._hoverSegment = null);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
let { startAngle: m, totalSweep: h } =
|
|
63
|
+
let { startAngle: m, totalSweep: h } = C(this.circular), g = m + h, _ = Math.atan2(u, l);
|
|
63
64
|
for (; _ < m;) _ += 2 * Math.PI;
|
|
64
65
|
for (; _ > m + 2 * Math.PI;) _ -= 2 * Math.PI;
|
|
65
66
|
if (_ > g) {
|
|
@@ -71,9 +72,9 @@ var C = class extends e {
|
|
|
71
72
|
this._hoverSegment !== null && (this._hoverSegment = null);
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
let b = this.segmentsSort === "value" ? [...n].sort((e, t) => t.value - e.value) : n, x = [...this._displaySegments.values()].reduce((e, t) => e + t, 0) || this._displayValue || 1,
|
|
75
|
+
let b = this.segmentsSort === "value" ? [...n].sort((e, t) => t.value - e.value) : n, x = [...this._displaySegments.values()].reduce((e, t) => e + t, 0) || this._displayValue || 1, S = y - m, w = m;
|
|
75
76
|
for (let e = 0; e < b.length; e++) {
|
|
76
|
-
let t = b[e], r = n.indexOf(t), i = (this._displaySegments.get(r) ?? 0) / x *
|
|
77
|
+
let t = b[e], r = n.indexOf(t), i = (this._displaySegments.get(r) ?? 0) / x * S;
|
|
77
78
|
if (_ >= w && _ < w + i) {
|
|
78
79
|
this._hoverSegment !== r && (this._hoverSegment = r), this._hoverX = a, this._hoverY = o;
|
|
79
80
|
return;
|
|
@@ -84,7 +85,7 @@ var C = class extends e {
|
|
|
84
85
|
}, this._onMouseLeave = () => {
|
|
85
86
|
this._hoverSegment = null;
|
|
86
87
|
}, this._tick = (e) => {
|
|
87
|
-
let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r =
|
|
88
|
+
let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = _(n);
|
|
88
89
|
this._displayValue = this._displayValueFrom + (this._targetValue - this._displayValueFrom) * r;
|
|
89
90
|
for (let [e, t] of this._targetSegments) {
|
|
90
91
|
let n = this._segmentsFrom.get(e) ?? 0;
|
|
@@ -97,11 +98,11 @@ var C = class extends e {
|
|
|
97
98
|
return this._zones;
|
|
98
99
|
}
|
|
99
100
|
set zones(e) {
|
|
100
|
-
let t =
|
|
101
|
+
let t = s(e, this._zonesSource, {
|
|
101
102
|
attr: "zones",
|
|
102
103
|
shape: "[{\"from\":0,\"to\":60,\"color\":\"green\"},{\"from\":60,\"to\":100,\"color\":\"red\"}]",
|
|
103
104
|
empty: () => [],
|
|
104
|
-
normalize: (e) => Array.isArray(e) ? e.filter(
|
|
105
|
+
normalize: (e) => Array.isArray(e) ? e.filter(c).map((e) => ({
|
|
105
106
|
from: Number(e.from),
|
|
106
107
|
to: Number(e.to),
|
|
107
108
|
color: String(e.color ?? "")
|
|
@@ -114,13 +115,13 @@ var C = class extends e {
|
|
|
114
115
|
return this._data;
|
|
115
116
|
}
|
|
116
117
|
set data(e) {
|
|
117
|
-
let t =
|
|
118
|
+
let t = s(e, this._source, {
|
|
118
119
|
attr: "data",
|
|
119
120
|
shape: "{\"segments\":[{\"name\":\"Used\",\"value\":40},{\"name\":\"Cache\",\"value\":15}]}",
|
|
120
121
|
empty: () => ({}),
|
|
121
122
|
normalize: (e) => {
|
|
122
|
-
if (!
|
|
123
|
-
let t = e.segments === void 0 ? void 0 :
|
|
123
|
+
if (!c(e)) return null;
|
|
124
|
+
let t = e.segments === void 0 ? void 0 : i(e.segments);
|
|
124
125
|
if (t === null) return null;
|
|
125
126
|
let n = {};
|
|
126
127
|
return e.value !== void 0 && (n.value = Number(e.value)), t && (n.segments = t), n;
|
|
@@ -128,12 +129,12 @@ var C = class extends e {
|
|
|
128
129
|
warn: (e, t) => this.reportDev("invalid-data", e, t)
|
|
129
130
|
});
|
|
130
131
|
if (!t) return;
|
|
131
|
-
let n = t.value,
|
|
132
|
+
let n = t.value, r = this._data, a = this._displayValue, o = new Map(this._displaySegments);
|
|
132
133
|
this._data = n, this._refreshTargets(), this.requestUpdate(), this._hasAnimated && this.updateComplete.then(() => {
|
|
133
|
-
let e =
|
|
134
|
-
for (let n = 0; n < e.length; n++) t.set(n,
|
|
135
|
-
let
|
|
136
|
-
for (let e = 0; e <
|
|
134
|
+
let e = r.segments ?? [], t = /* @__PURE__ */ new Map();
|
|
135
|
+
for (let n = 0; n < e.length; n++) t.set(n, o.get(n) ?? 0);
|
|
136
|
+
let i = n.segments ?? [];
|
|
137
|
+
for (let e = 0; e < i.length; e++) t.has(e) || t.set(e, 0);
|
|
137
138
|
this._startAnimation(t, a, !0);
|
|
138
139
|
});
|
|
139
140
|
}
|
|
@@ -174,7 +175,7 @@ var C = class extends e {
|
|
|
174
175
|
return this.circular === "semi" ? this.size * .6 : this.circular === "triple" ? this.size * .85 : this.size;
|
|
175
176
|
}
|
|
176
177
|
_angleAt(e) {
|
|
177
|
-
let { startAngle: t, totalSweep: n } =
|
|
178
|
+
let { startAngle: t, totalSweep: n } = C(this.circular), r = Math.max(this.min, Math.min(this.max, e));
|
|
178
179
|
return t + (this.max - this.min === 0 ? 0 : (r - this.min) / (this.max - this.min)) * n;
|
|
179
180
|
}
|
|
180
181
|
_resolveFillColor() {
|
|
@@ -188,79 +189,79 @@ var C = class extends e {
|
|
|
188
189
|
return (this._data.segments?.length ?? 0) > 0;
|
|
189
190
|
}
|
|
190
191
|
_renderZones(e, t, n, r) {
|
|
191
|
-
if (this.zones.length === 0 || this._hasSegments()) return
|
|
192
|
+
if (this.zones.length === 0 || this._hasSegments()) return f;
|
|
192
193
|
if (this.variant === "outline") {
|
|
193
194
|
let i = r > this._angleAt(this.min) + 1e-6, a = [];
|
|
194
195
|
for (let o = 0; o < this.zones.length; o++) {
|
|
195
196
|
let s = this.zones[o], c = this._angleAt(s.from), l = this._angleAt(s.to);
|
|
196
197
|
if (l <= r + 1e-6) continue;
|
|
197
|
-
let u = c <= r + 1e-6, d = u ? r : c,
|
|
198
|
-
u && i ?
|
|
198
|
+
let u = c <= r + 1e-6, d = u ? r : c, f = "butt";
|
|
199
|
+
u && i ? f = "cup" : Math.abs(s.from - this.min) < 1e-6 && (f = "round");
|
|
199
200
|
let m = o === this.zones.length - 1 && Math.abs(s.to - this.max) < 1e-6 ? "round" : "butt";
|
|
200
|
-
a.push(
|
|
201
|
+
a.push(p`
|
|
201
202
|
<path
|
|
202
203
|
class="void-gauge-zone"
|
|
203
204
|
style="--zone-color: ${s.color};"
|
|
204
|
-
d=${
|
|
205
|
+
d=${x(e, t, n, this.thickness, d, l, f, m)}
|
|
205
206
|
></path>
|
|
206
207
|
`);
|
|
207
208
|
}
|
|
208
|
-
return
|
|
209
|
+
return p`<g class="void-gauge-zones">${a}</g>`;
|
|
209
210
|
}
|
|
210
|
-
let i = this.variant === "wireframe" ?
|
|
211
|
-
for (let r of this.zones) a.push(
|
|
211
|
+
let i = this.variant === "wireframe" ? S : this.thickness, a = [];
|
|
212
|
+
for (let r of this.zones) a.push(p`
|
|
212
213
|
<path
|
|
213
214
|
class="void-gauge-zone"
|
|
214
215
|
style="--zone-color: ${r.color}; --gauge-stroke-width: ${i};"
|
|
215
|
-
d=${
|
|
216
|
+
d=${y(e, t, n, this._angleAt(r.from), this._angleAt(r.to))}
|
|
216
217
|
></path>
|
|
217
218
|
`);
|
|
218
219
|
let o = i / 2, s = (r, i) => {
|
|
219
220
|
let a = Math.cos(r), s = Math.sin(r);
|
|
220
221
|
return `M ${(e + (n - o) * a).toFixed(2)} ${(t + (n - o) * s).toFixed(2)} A ${o} ${o} 0 0 ${i} ${(e + (n + o) * a).toFixed(2)} ${(t + (n + o) * s).toFixed(2)} Z`;
|
|
221
222
|
}, c = [], l = this.zones[0];
|
|
222
|
-
l && Math.abs(l.from - this.min) < 1e-6 && c.push(
|
|
223
|
+
l && Math.abs(l.from - this.min) < 1e-6 && c.push(p`<path class="void-gauge-zone-cap" d=${s(this._angleAt(l.from), 1)} style="--zone-color: ${l.color};"></path>`);
|
|
223
224
|
let u = this.zones[this.zones.length - 1];
|
|
224
|
-
return u && Math.abs(u.to - this.max) < 1e-6 && c.push(
|
|
225
|
+
return u && Math.abs(u.to - this.max) < 1e-6 && c.push(p`<path class="void-gauge-zone-cap" d=${s(this._angleAt(u.to), 0)} style="--zone-color: ${u.color};"></path>`), p`<g class="void-gauge-zones">${a}${c}</g>`;
|
|
225
226
|
}
|
|
226
227
|
_renderSegments(e, t, n, r, i, a) {
|
|
227
|
-
if (!this._hasSegments()) return
|
|
228
|
-
let o = this._data.segments, s = this.segmentsSort === "value" ? [...o].sort((e, t) => t.value - e.value) : o, c = a - r, l = (this.gaps === !0 ? 1 : this.gaps === !1 ? 0 : this.gaps) / 100 * c, u = s.length,
|
|
228
|
+
if (!this._hasSegments()) return f;
|
|
229
|
+
let o = this._data.segments, s = this.segmentsSort === "value" ? [...o].sort((e, t) => t.value - e.value) : o, c = a - r, l = (this.gaps === !0 ? 1 : this.gaps === !1 ? 0 : this.gaps) / 100 * c, u = s.length, d = (u > 1 ? l / (u - 1) : 0) / 2, m = [], h = r, g = null, _ = null, v = null, x = null;
|
|
229
230
|
for (let r = 0; r < s.length; r++) {
|
|
230
|
-
let l = s[r],
|
|
231
|
+
let l = s[r], f = o.indexOf(l), S = this._displaySegments.get(f) ?? 0;
|
|
231
232
|
if (S <= 0 || i <= 0) {
|
|
232
233
|
h += 0;
|
|
233
234
|
continue;
|
|
234
235
|
}
|
|
235
|
-
let C = S / i * c, w = Math.min(h + C, a), T = r > 0 ? h +
|
|
236
|
+
let C = S / i * c, w = Math.min(h + C, a), T = r > 0 ? h + d : h, E = r < u - 1 ? w - d : w;
|
|
236
237
|
if (E > T + .001) {
|
|
237
|
-
let r = l.color ?? "var(--void-color-accent)", i = this.variant === "outline" ?
|
|
238
|
-
m.push(
|
|
238
|
+
let r = l.color ?? "var(--void-color-accent)", i = this.variant === "outline" ? b(e, t, n, this.thickness, T, E) : y(e, t, n, T, E);
|
|
239
|
+
m.push(p`
|
|
239
240
|
<path
|
|
240
241
|
class="void-gauge-segment"
|
|
241
242
|
d=${i}
|
|
242
243
|
style="--segment-color: ${r}; --gauge-stroke-width: ${this.thickness};"
|
|
243
|
-
data-segment-index=${
|
|
244
|
+
data-segment-index=${f}
|
|
244
245
|
></path>
|
|
245
|
-
`), g === null && (g = r, _ = T),
|
|
246
|
+
`), g === null && (g = r, _ = T), v = r, x = E;
|
|
246
247
|
}
|
|
247
248
|
h += C;
|
|
248
249
|
}
|
|
249
|
-
if (m.length === 0) return
|
|
250
|
+
if (m.length === 0) return f;
|
|
250
251
|
let S = this.thickness / 2, C = [];
|
|
251
252
|
if (_ !== null && g !== null) {
|
|
252
253
|
let r = e + n * Math.cos(_), i = t + n * Math.sin(_);
|
|
253
|
-
C.push(
|
|
254
|
+
C.push(p`<circle class="void-gauge-segment-cap" cx=${r} cy=${i} r=${S} style="--segment-color: ${g};"></circle>`);
|
|
254
255
|
}
|
|
255
|
-
if (x !== null &&
|
|
256
|
+
if (x !== null && v !== null) {
|
|
256
257
|
let r = e + n * Math.cos(x), i = t + n * Math.sin(x);
|
|
257
|
-
C.push(
|
|
258
|
+
C.push(p`<circle class="void-gauge-segment-cap" cx=${r} cy=${i} r=${S} style="--segment-color: ${v};"></circle>`);
|
|
258
259
|
}
|
|
259
|
-
return
|
|
260
|
+
return p`<g class="void-gauge-segments">${C}${m}</g>`;
|
|
260
261
|
}
|
|
261
262
|
_renderCenter(e, t) {
|
|
262
|
-
let n = this._displayValue, r =
|
|
263
|
-
return this.unitInline && this.unit ?
|
|
263
|
+
let n = this._displayValue, r = v(n), i = this.circular === "semi" ? t * .7 : t, a = i + 20;
|
|
264
|
+
return this.unitInline && this.unit ? p`
|
|
264
265
|
<text
|
|
265
266
|
class="void-gauge-center-value"
|
|
266
267
|
x=${e}
|
|
@@ -268,7 +269,7 @@ var C = class extends e {
|
|
|
268
269
|
text-anchor="middle"
|
|
269
270
|
dy="0.32em"
|
|
270
271
|
>${r}<tspan class="void-gauge-center-unit-inline" dx="6">${this.unit}</tspan></text>
|
|
271
|
-
` :
|
|
272
|
+
` : p`
|
|
272
273
|
<text
|
|
273
274
|
class="void-gauge-center-value"
|
|
274
275
|
x=${e}
|
|
@@ -276,7 +277,7 @@ var C = class extends e {
|
|
|
276
277
|
text-anchor="middle"
|
|
277
278
|
dy="0.32em"
|
|
278
279
|
>${r}</text>
|
|
279
|
-
${this.unit ?
|
|
280
|
+
${this.unit ? p`
|
|
280
281
|
<text
|
|
281
282
|
class="void-gauge-center-unit"
|
|
282
283
|
x=${e}
|
|
@@ -284,16 +285,16 @@ var C = class extends e {
|
|
|
284
285
|
text-anchor="middle"
|
|
285
286
|
dy="0.32em"
|
|
286
287
|
>${this.unit}</text>
|
|
287
|
-
` :
|
|
288
|
+
` : f}
|
|
288
289
|
`;
|
|
289
290
|
}
|
|
290
291
|
_hasTicks() {
|
|
291
292
|
return this.tickMajor > 0 || this.tickMinor > 0;
|
|
292
293
|
}
|
|
293
294
|
_renderTicks(e, t, n) {
|
|
294
|
-
if (!this._hasTicks() || this.max - this.min <= 0) return
|
|
295
|
+
if (!this._hasTicks() || this.max - this.min <= 0) return f;
|
|
295
296
|
let r = Math.max(0, n - this.thickness / 2), i = Math.max(0, r - 3), a = Math.max(0, i - 5), o = Math.max(0, i - 10), s = [], c = this.tickMinor > 0 ? this.tickMinor : this.tickMajor;
|
|
296
|
-
if (c <= 0) return
|
|
297
|
+
if (c <= 0) return f;
|
|
297
298
|
this.hideTickMin || s.push({
|
|
298
299
|
v: this.min,
|
|
299
300
|
major: !0
|
|
@@ -306,22 +307,22 @@ var C = class extends e {
|
|
|
306
307
|
major: t
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
|
-
let u = (this.max - this.min) / c,
|
|
310
|
-
if (!this.hideTickMax ||
|
|
310
|
+
let u = (this.max - this.min) / c, d = Math.abs(u - Math.round(u)) < l;
|
|
311
|
+
if (!this.hideTickMax || d) {
|
|
311
312
|
let e = this.tickMajor > 0 && Math.abs((this.max - this.min) / this.tickMajor - Math.round((this.max - this.min) / this.tickMajor)) < 1e-6;
|
|
312
313
|
s.push({
|
|
313
314
|
v: this.max,
|
|
314
315
|
major: !this.hideTickMax || e
|
|
315
316
|
});
|
|
316
317
|
}
|
|
317
|
-
return s.length === 0 ?
|
|
318
|
-
let s = this._angleAt(n), c = r ? o : a, l = (e + i * Math.cos(s)).toFixed(2), u = (t + i * Math.sin(s)).toFixed(2), d = (e + c * Math.cos(s)).toFixed(2),
|
|
319
|
-
return
|
|
318
|
+
return s.length === 0 ? f : p`<g class="void-gauge-ticks">${s.map(({ v: n, major: r }) => {
|
|
319
|
+
let s = this._angleAt(n), c = r ? o : a, l = (e + i * Math.cos(s)).toFixed(2), u = (t + i * Math.sin(s)).toFixed(2), d = (e + c * Math.cos(s)).toFixed(2), f = (t + c * Math.sin(s)).toFixed(2);
|
|
320
|
+
return p`<line class="void-gauge-tick ${r ? "void-gauge-tick-major" : "void-gauge-tick-minor"}" x1=${l} y1=${u} x2=${d} y2=${f}></line>`;
|
|
320
321
|
})}</g>`;
|
|
321
322
|
}
|
|
322
323
|
render() {
|
|
323
|
-
let { startAngle: e, endAngle: t, totalSweep: n } =
|
|
324
|
-
return
|
|
324
|
+
let { startAngle: e, endAngle: t, totalSweep: n } = C(this.circular), r = this.size / 2, i = this.size / 2, a = Math.max(8, this.thickness / 2), o = this.size / 2 - a, s = this._viewBoxHeight(), c = [...this._displaySegments.values()].reduce((e, t) => e + t, 0), l = Math.max(this.min, Math.min(this.max, this._displayValue)), u = this.max - this.min === 0 ? 0 : (l - this.min) / (this.max - this.min), m = e + Math.max(0, Math.min(1, u)) * n, h = this._resolveFillColor(), g = m > e + .001;
|
|
325
|
+
return d`
|
|
325
326
|
<svg
|
|
326
327
|
viewBox="0 0 ${this.size} ${s}"
|
|
327
328
|
aria-hidden="true"
|
|
@@ -334,7 +335,7 @@ var C = class extends e {
|
|
|
334
335
|
<path
|
|
335
336
|
class="void-gauge-track"
|
|
336
337
|
style="--gauge-stroke-width: ${this.thickness};"
|
|
337
|
-
d=${
|
|
338
|
+
d=${y(r, i, o, e, t)}
|
|
338
339
|
></path>
|
|
339
340
|
|
|
340
341
|
<!-- Zone bands. Filled variant: zones render full-width and are
|
|
@@ -348,13 +349,13 @@ var C = class extends e {
|
|
|
348
349
|
closed band shape so SVG fill renders the faint tint AND
|
|
349
350
|
stroke renders a hairline border. Other variants use a
|
|
350
351
|
stroked centerline arc. -->
|
|
351
|
-
${g && !this._hasSegments() ?
|
|
352
|
+
${g && !this._hasSegments() ? p`
|
|
352
353
|
<path
|
|
353
354
|
class="void-gauge-value"
|
|
354
355
|
style="--value-color: ${h}; --gauge-stroke-width: ${this.thickness};"
|
|
355
|
-
d=${this.variant === "outline" ?
|
|
356
|
+
d=${this.variant === "outline" ? b(r, i, o, this.thickness, e, m) : y(r, i, o, e, m)}
|
|
356
357
|
></path>
|
|
357
|
-
` :
|
|
358
|
+
` : f}
|
|
358
359
|
|
|
359
360
|
<!-- Segment overlays -->
|
|
360
361
|
${this._renderSegments(r, i, o, e, c, m)}
|
|
@@ -363,52 +364,52 @@ var C = class extends e {
|
|
|
363
364
|
${this._renderTicks(r, i, o)}
|
|
364
365
|
|
|
365
366
|
<!-- Center label -->
|
|
366
|
-
${this.hideValue ?
|
|
367
|
+
${this.hideValue ? f : this._renderCenter(r, i)}
|
|
367
368
|
|
|
368
369
|
<!-- Hover tooltip -->
|
|
369
|
-
${this._hoverSegment !== null && this._data.segments && this._hoverSegment < this._data.segments.length ? this._renderHoverTooltip(this._data.segments, this._hoverSegment) :
|
|
370
|
+
${this._hoverSegment !== null && this._data.segments && this._hoverSegment < this._data.segments.length ? this._renderHoverTooltip(this._data.segments, this._hoverSegment) : f}
|
|
370
371
|
</svg>
|
|
371
372
|
${this._table()}
|
|
372
373
|
`;
|
|
373
374
|
}
|
|
374
375
|
_table() {
|
|
375
|
-
let { value: e, min: t, max:
|
|
376
|
-
return
|
|
376
|
+
let { value: e, min: t, max: r, unit: i, segmentsSort: s, _data: c } = this, d = this.ariaLabel || n(this, "chart.gauge");
|
|
377
|
+
return g([
|
|
377
378
|
e,
|
|
378
379
|
t,
|
|
379
|
-
n,
|
|
380
380
|
r,
|
|
381
|
-
|
|
381
|
+
i,
|
|
382
382
|
s,
|
|
383
|
-
|
|
384
|
-
|
|
383
|
+
c,
|
|
384
|
+
d,
|
|
385
|
+
u(this)
|
|
385
386
|
], () => {
|
|
386
|
-
let
|
|
387
|
-
if (
|
|
388
|
-
let e =
|
|
389
|
-
|
|
387
|
+
let u, f = c.segments ?? [];
|
|
388
|
+
if (f.length > 0) {
|
|
389
|
+
let e = s === "value" ? [...f].sort((e, t) => t.value - e.value) : f;
|
|
390
|
+
u = l(this, d, e);
|
|
390
391
|
} else {
|
|
391
|
-
let
|
|
392
|
-
|
|
393
|
-
caption:
|
|
392
|
+
let o = a(this), s = c.value ?? e, l = (e) => o.number(e) + (i ? /^[\p{L}]/u.test(i) ? ` ${i}` : i : "");
|
|
393
|
+
u = {
|
|
394
|
+
caption: d,
|
|
394
395
|
head: [
|
|
395
|
-
"
|
|
396
|
-
"
|
|
397
|
-
"
|
|
396
|
+
n(this, "chart.value"),
|
|
397
|
+
n(this, "chart.minimum"),
|
|
398
|
+
n(this, "chart.maximum")
|
|
398
399
|
],
|
|
399
400
|
rows: [{ cells: [
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
l(s),
|
|
402
|
+
l(t),
|
|
403
|
+
l(r)
|
|
403
404
|
] }]
|
|
404
405
|
};
|
|
405
406
|
}
|
|
406
|
-
return
|
|
407
|
+
return o("void-gauge-table", u);
|
|
407
408
|
});
|
|
408
409
|
}
|
|
409
410
|
_renderHoverTooltip(e, t) {
|
|
410
411
|
let n = e[t], r = this._displaySegments.get(t) ?? n.value, i = [...this._displaySegments.values()].reduce((e, t) => e + t, 0) || this._displayValue || 1, a = Math.round(r / i * 100), o = this._viewBoxHeight(), s = this._hoverX + 12, c = this._hoverY + 12;
|
|
411
|
-
return s + 140 > this.size && (s = this._hoverX - 12 - 140), c + 44 > o && (c = this._hoverY - 12 - 44), s < 0 && (s = 0), c < 0 && (c = 0),
|
|
412
|
+
return s + 140 > this.size && (s = this._hoverX - 12 - 140), c + 44 > o && (c = this._hoverY - 12 - 44), s < 0 && (s = 0), c < 0 && (c = 0), p`
|
|
412
413
|
<g class="void-gauge-hover" pointer-events="none">
|
|
413
414
|
<rect
|
|
414
415
|
class="void-gauge-tooltip-bg"
|
|
@@ -425,40 +426,40 @@ var C = class extends e {
|
|
|
425
426
|
class="void-gauge-tooltip-value"
|
|
426
427
|
x=${s + 8}
|
|
427
428
|
y=${c + 8 + 14 + 10}
|
|
428
|
-
>${
|
|
429
|
+
>${v(r)} <tspan class="void-gauge-tooltip-pct">(${a}%)</tspan></text>
|
|
429
430
|
</g>
|
|
430
431
|
`;
|
|
431
432
|
}
|
|
432
433
|
};
|
|
433
|
-
t([
|
|
434
|
+
t([m()], w.prototype, "unit", void 0), t([m({
|
|
434
435
|
type: Number,
|
|
435
436
|
reflect: !0
|
|
436
|
-
})],
|
|
437
|
+
})], w.prototype, "value", void 0), t([m({ type: Number })], w.prototype, "min", void 0), t([m({ type: Number })], w.prototype, "max", void 0), t([m({
|
|
437
438
|
type: Number,
|
|
438
439
|
reflect: !0
|
|
439
|
-
})],
|
|
440
|
+
})], w.prototype, "size", void 0), t([m({ type: Number })], w.prototype, "thickness", void 0), t([m({ reflect: !0 })], w.prototype, "circular", void 0), t([m({ reflect: !0 })], w.prototype, "variant", void 0), t([m({
|
|
440
441
|
type: Boolean,
|
|
441
442
|
attribute: "hide-value",
|
|
442
443
|
reflect: !0
|
|
443
|
-
})],
|
|
444
|
+
})], w.prototype, "hideValue", void 0), t([m({
|
|
444
445
|
type: Boolean,
|
|
445
446
|
attribute: "unit-inline",
|
|
446
447
|
reflect: !0
|
|
447
|
-
})],
|
|
448
|
+
})], w.prototype, "unitInline", void 0), t([m({
|
|
448
449
|
type: Number,
|
|
449
450
|
attribute: "tick-major"
|
|
450
|
-
})],
|
|
451
|
+
})], w.prototype, "tickMajor", void 0), t([m({
|
|
451
452
|
type: Number,
|
|
452
453
|
attribute: "tick-minor"
|
|
453
|
-
})],
|
|
454
|
+
})], w.prototype, "tickMinor", void 0), t([m({
|
|
454
455
|
type: Boolean,
|
|
455
456
|
attribute: "hide-tick-min",
|
|
456
457
|
reflect: !0
|
|
457
|
-
})],
|
|
458
|
+
})], w.prototype, "hideTickMin", void 0), t([m({
|
|
458
459
|
type: Boolean,
|
|
459
460
|
attribute: "hide-tick-max",
|
|
460
461
|
reflect: !0
|
|
461
|
-
})],
|
|
462
|
+
})], w.prototype, "hideTickMax", void 0), t([m({ attribute: "segments-sort" })], w.prototype, "segmentsSort", void 0), t([m({ converter: {
|
|
462
463
|
fromAttribute(e) {
|
|
463
464
|
if (e === null || e === "" || e === "true") return !0;
|
|
464
465
|
if (e === "false") return !1;
|
|
@@ -468,10 +469,10 @@ t([p()], C.prototype, "unit", void 0), t([p({
|
|
|
468
469
|
toAttribute(e) {
|
|
469
470
|
return e === !0 ? "" : e === !1 ? "false" : String(e);
|
|
470
471
|
}
|
|
471
|
-
} })],
|
|
472
|
+
} })], w.prototype, "gaps", void 0), t([m({ attribute: "aria-label" })], w.prototype, "ariaLabel", void 0), t([m({
|
|
472
473
|
type: Boolean,
|
|
473
474
|
attribute: "show-table",
|
|
474
475
|
reflect: !0
|
|
475
|
-
})],
|
|
476
|
+
})], w.prototype, "showTable", void 0), t([m({ attribute: "zones" })], w.prototype, "zones", null), t([m({ attribute: "data" })], w.prototype, "data", null), t([h()], w.prototype, "_phase", void 0), t([h()], w.prototype, "_hoverSegment", void 0), t([h()], w.prototype, "_hoverX", void 0), t([h()], w.prototype, "_hoverY", void 0), customElements.get("void-gauge") || customElements.define("void-gauge", w);
|
|
476
477
|
//#endregion
|
|
477
|
-
export {
|
|
478
|
+
export { w as VoidGauge };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
import { KeyboardActivation } from '../keyboard-activation.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
/**
|
|
4
5
|
* Animated open/close toggle for mobile navigation menus and collapsible sidebars.
|
|
5
6
|
*
|
|
@@ -9,6 +10,12 @@ import { KeyboardActivation } from '../keyboard-activation.js';
|
|
|
9
10
|
* @fires {CustomEvent<{ reason: 'trigger' }>} void-close - The user closed it. Does not bubble.
|
|
10
11
|
*/
|
|
11
12
|
export declare class VoidHamburger extends VoidElement {
|
|
13
|
+
/** Key bindings for this element's actions, as JSON (`{"activate":["Enter"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
14
|
+
keys: KeyOverrides | null;
|
|
15
|
+
/** @internal The actions of this element and their default keys. */
|
|
16
|
+
static readonly keyMap: {
|
|
17
|
+
activate: string[];
|
|
18
|
+
};
|
|
12
19
|
/** Enter and Space fire a real `click`, as on a native button. */
|
|
13
20
|
protected readonly _activation: KeyboardActivation;
|
|
14
21
|
/** A key (Enter, Space) is activating it, so the click it fires reports reason `keyboard`. */
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { keysConverter as n } from "../keys.js";
|
|
4
|
+
import { t as r } from "../chunks/keyboard-activation-BfEyoaMT.js";
|
|
5
|
+
import { t as i } from "../chunks/activation-B8aBarKd.js";
|
|
6
|
+
import { msg as a } from "../messages.js";
|
|
7
|
+
import { i as o, r as s } from "../chunks/form-control-fL-Hhy91.js";
|
|
8
|
+
import { r as c } from "../chunks/projection-oPe6ipjL.js";
|
|
9
|
+
import { html as l } from "lit";
|
|
10
|
+
import { property as u } from "lit/decorators.js";
|
|
8
11
|
//#region src/components/hamburger.ts
|
|
9
|
-
|
|
10
|
-
var
|
|
12
|
+
c();
|
|
13
|
+
var d = class extends e {
|
|
11
14
|
constructor(...e) {
|
|
12
|
-
super(...e), this._activation = new
|
|
13
|
-
disabled: () =>
|
|
15
|
+
super(...e), this.keys = null, this._activation = new r(this, {
|
|
16
|
+
disabled: () => s(this),
|
|
14
17
|
activate: () => {
|
|
15
18
|
this._byKey = !0;
|
|
16
19
|
try {
|
|
@@ -20,7 +23,7 @@ var c = class extends e {
|
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
}), this._byKey = !1, this.open = !1, this.size = "md", this._unwatch = null, this._handleClick = () => {
|
|
23
|
-
|
|
26
|
+
s(this) || (this.open = !this.open, this.open ? this.dispatchEvent(new CustomEvent("void-open", {
|
|
24
27
|
bubbles: !1,
|
|
25
28
|
detail: { reason: this._byKey ? "keyboard" : "trigger" }
|
|
26
29
|
})) : this.dispatchEvent(new CustomEvent("void-close", {
|
|
@@ -29,25 +32,28 @@ var c = class extends e {
|
|
|
29
32
|
})));
|
|
30
33
|
}, this._writtenLabel = null;
|
|
31
34
|
}
|
|
35
|
+
static {
|
|
36
|
+
this.keyMap = i;
|
|
37
|
+
}
|
|
32
38
|
_syncDisabled() {
|
|
33
|
-
let e =
|
|
39
|
+
let e = s(this);
|
|
34
40
|
this.setHostAttribute("aria-disabled", e ? "true" : null), this.setHostAttribute("tabindex", e ? "-1" : "0");
|
|
35
41
|
}
|
|
36
42
|
connectedCallback() {
|
|
37
|
-
super.connectedCallback(), this.setHostAttribute("role", "button"), this._syncDisabled(), this._unwatch =
|
|
43
|
+
super.connectedCallback(), this.setHostAttribute("role", "button"), this._syncDisabled(), this._unwatch = o(this, () => this._syncDisabled()), this.setHostAttribute("aria-expanded", String(this.open)), this._syncLabel(), this.addEventListener("click", this._handleClick);
|
|
38
44
|
}
|
|
39
45
|
disconnectedCallback() {
|
|
40
46
|
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this._unwatch?.(), this._unwatch = null;
|
|
41
47
|
}
|
|
42
48
|
updated(e) {
|
|
43
|
-
e.has("open") &&
|
|
49
|
+
e.has("open") && this.setHostAttribute("aria-expanded", String(this.open)), this._syncLabel();
|
|
44
50
|
}
|
|
45
51
|
_syncLabel() {
|
|
46
52
|
let e = this.getAttribute("aria-label");
|
|
47
|
-
this.hasAttribute("aria-labelledby") || e !== null && e !== this._writtenLabel || (this._writtenLabel = this.open ? "
|
|
53
|
+
this.hasAttribute("aria-labelledby") || e !== null && e !== this._writtenLabel || (this._writtenLabel = a(this, this.open ? "hamburger.close" : "hamburger.open"), this.setHostAttribute("aria-label", this._writtenLabel));
|
|
48
54
|
}
|
|
49
55
|
render() {
|
|
50
|
-
return
|
|
56
|
+
return l`
|
|
51
57
|
<span class="void-hamburger-lines">
|
|
52
58
|
<span class="void-hamburger-line"></span>
|
|
53
59
|
<span class="void-hamburger-line"></span>
|
|
@@ -56,12 +62,15 @@ var c = class extends e {
|
|
|
56
62
|
`;
|
|
57
63
|
}
|
|
58
64
|
};
|
|
59
|
-
t([
|
|
65
|
+
t([u({
|
|
66
|
+
attribute: "keys",
|
|
67
|
+
converter: n
|
|
68
|
+
})], d.prototype, "keys", void 0), t([u({
|
|
60
69
|
type: Boolean,
|
|
61
70
|
reflect: !0
|
|
62
|
-
})],
|
|
71
|
+
})], d.prototype, "open", void 0), t([u({
|
|
63
72
|
type: String,
|
|
64
73
|
reflect: !0
|
|
65
|
-
})],
|
|
74
|
+
})], d.prototype, "size", void 0), customElements.get("void-hamburger") || customElements.define("void-hamburger", d);
|
|
66
75
|
//#endregion
|
|
67
|
-
export {
|
|
76
|
+
export { d as VoidHamburger };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
import { OverlayController } from '../overlay.js';
|
|
3
3
|
import { PartsController } from '../parts.js';
|
|
4
|
+
import { KeyOverrides } from '../keys.js';
|
|
4
5
|
/**
|
|
5
6
|
* Rich content preview card that appears on hover for user profiles, link previews, and contextual information panels.
|
|
6
7
|
*
|
|
@@ -16,6 +17,12 @@ import { PartsController } from '../parts.js';
|
|
|
16
17
|
* Cancelable when the user caused it.
|
|
17
18
|
*/
|
|
18
19
|
export declare class VoidHoverCard extends VoidElement {
|
|
20
|
+
/** Key bindings for this element's actions, as JSON (`{"close":["Escape"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
21
|
+
keys: KeyOverrides | null;
|
|
22
|
+
/** @internal The actions of this element and their default keys. */
|
|
23
|
+
static readonly keyMap: {
|
|
24
|
+
close: string[];
|
|
25
|
+
};
|
|
19
26
|
/** Whether the card is shown. It opens and closes itself from hover, focus and Escape; set it to drive it from script. */
|
|
20
27
|
open: boolean;
|
|
21
28
|
/** Side of the trigger the card opens on; it flips to the opposite side when there is no room. */
|