@voidable/ui 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/base-entry.d.ts +1 -0
  2. package/dist/base.d.ts +8 -1
  3. package/dist/base.js +5 -1
  4. package/dist/chunks/base-BGrS4eIl.js +307 -0
  5. package/dist/chunks/data-BpiiNapL.js +95 -0
  6. package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
  7. package/dist/chunks/{modal-hivQ4YoU.js → modal-DWGkNdNG.js} +3 -3
  8. package/dist/chunks/{overlay-BywGMcDW.js → overlay-CH7L4N-h.js} +2 -2
  9. package/dist/chunks/{parts-CMQQop0D.js → parts-DI_3VpSy.js} +21 -17
  10. package/dist/chunks/{base-CMruMbxC.js → projection-oPe6ipjL.js} +105 -389
  11. package/dist/components/accordion.js +2 -2
  12. package/dist/components/action-input.d.ts +2 -2
  13. package/dist/components/action-input.js +56 -54
  14. package/dist/components/alert.d.ts +11 -0
  15. package/dist/components/alert.js +11 -4
  16. package/dist/components/avatar.js +13 -11
  17. package/dist/components/badge.d.ts +8 -2
  18. package/dist/components/badge.js +1 -4
  19. package/dist/components/banner.d.ts +9 -0
  20. package/dist/components/banner.js +11 -4
  21. package/dist/components/bar-chart.d.ts +21 -7
  22. package/dist/components/bar-chart.js +67 -43
  23. package/dist/components/breadcrumbs.js +2 -2
  24. package/dist/components/button.js +1 -1
  25. package/dist/components/calendar.d.ts +40 -2
  26. package/dist/components/calendar.js +170 -79
  27. package/dist/components/card.js +1 -1
  28. package/dist/components/carousel.js +20 -19
  29. package/dist/components/charts/data.d.ts +72 -0
  30. package/dist/components/checkbox-group.js +13 -12
  31. package/dist/components/checkbox.js +17 -16
  32. package/dist/components/collapsible.js +2 -2
  33. package/dist/components/color-picker.js +26 -24
  34. package/dist/components/combobox.js +17 -16
  35. package/dist/components/compose-input.js +13 -11
  36. package/dist/components/dialog.js +1 -1
  37. package/dist/components/divider.js +11 -9
  38. package/dist/components/donut-chart.d.ts +22 -6
  39. package/dist/components/donut-chart.js +96 -68
  40. package/dist/components/drawer.d.ts +2 -2
  41. package/dist/components/drawer.js +1 -1
  42. package/dist/components/dropdown-menu.js +4 -4
  43. package/dist/components/editable.js +13 -12
  44. package/dist/components/error-fallback.js +2 -2
  45. package/dist/components/field.js +10 -9
  46. package/dist/components/file-upload.d.ts +20 -5
  47. package/dist/components/file-upload.js +52 -20
  48. package/dist/components/gauge.d.ts +32 -8
  49. package/dist/components/gauge.js +209 -135
  50. package/dist/components/hamburger.d.ts +12 -1
  51. package/dist/components/hamburger.js +33 -20
  52. package/dist/components/hover-card.js +3 -3
  53. package/dist/components/indicator.js +14 -12
  54. package/dist/components/input.js +41 -39
  55. package/dist/components/line-chart.d.ts +22 -7
  56. package/dist/components/line-chart.js +80 -56
  57. package/dist/components/list.js +1 -1
  58. package/dist/components/menu.js +3 -3
  59. package/dist/components/multiselect.js +30 -29
  60. package/dist/components/nav-bar.d.ts +9 -0
  61. package/dist/components/nav-bar.js +16 -3
  62. package/dist/components/nav-menu.js +20 -19
  63. package/dist/components/number-input.js +17 -15
  64. package/dist/components/pagination.js +22 -20
  65. package/dist/components/panel.js +2 -2
  66. package/dist/components/pin-input.js +32 -30
  67. package/dist/components/popover.js +3 -3
  68. package/dist/components/progress.js +14 -12
  69. package/dist/components/radio-group.js +13 -11
  70. package/dist/components/radio.d.ts +25 -0
  71. package/dist/components/radio.js +78 -29
  72. package/dist/components/scroll-area.js +8 -7
  73. package/dist/components/segmented-control.js +21 -21
  74. package/dist/components/select.js +49 -47
  75. package/dist/components/sidebar.d.ts +2 -2
  76. package/dist/components/sidebar.js +2 -2
  77. package/dist/components/skeleton.js +1 -1
  78. package/dist/components/slider.js +16 -14
  79. package/dist/components/spinner.js +11 -9
  80. package/dist/components/stat.d.ts +13 -1
  81. package/dist/components/stat.js +29 -19
  82. package/dist/components/status-dot.js +1 -1
  83. package/dist/components/stepper.js +15 -13
  84. package/dist/components/switch.js +14 -12
  85. package/dist/components/table.d.ts +4 -0
  86. package/dist/components/table.js +42 -29
  87. package/dist/components/tabs.js +29 -29
  88. package/dist/components/tag.js +9 -8
  89. package/dist/components/tags-input.js +24 -22
  90. package/dist/components/textarea.js +34 -32
  91. package/dist/components/toast.d.ts +19 -2
  92. package/dist/components/toast.js +43 -10
  93. package/dist/components/toggle-group.js +16 -15
  94. package/dist/components/toggle.js +1 -1
  95. package/dist/components/tooltip.js +3 -3
  96. package/dist/components.json +15 -13
  97. package/dist/custom-elements.json +320 -88
  98. package/dist/dev/types.d.ts +3 -1
  99. package/dist/dev.js +85 -16
  100. package/dist/index.js +1 -1
  101. package/dist/keyboard.d.ts +10 -0
  102. package/dist/llms.txt +1 -1
  103. package/dist/parts.d.ts +5 -0
  104. package/dist/projection-api.d.ts +23 -0
  105. package/dist/projection.d.ts +8 -2
  106. package/dist/reference.md +84 -59
  107. package/dist/types/elements.d.ts +13 -13
  108. package/dist/types/react.d.ts +2 -2
  109. package/dist/types/solid.d.ts +2 -2
  110. package/dist/types/svelte.d.ts +2 -2
  111. package/dist/types/vue.d.ts +2 -2
  112. package/dist/vscode.html-custom-data.json +108 -28
  113. package/dist/web-types.json +189 -60
  114. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export { VoidElement } from './base.js';
package/dist/base.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { LitElement, PropertyValues } from 'lit';
2
- import { PROJECTION_KEY, ProjectionController } from './projection.js';
2
+ import { PROJECTION_KEY } from './projection-api.js';
3
+ import { ProjectionController } from './projection.js';
3
4
  /** Same key as parts.ts's MORPH_PARTICIPANTS (a registered symbol, so base needs no import of parts.ts). */
4
5
  declare const MORPH_PARTICIPANTS: unique symbol;
5
6
  export declare class VoidElement extends LitElement {
@@ -65,6 +66,12 @@ export declare class VoidElement extends LitElement {
65
66
  * @internal
66
67
  */
67
68
  connectedMoveCallback(): void;
69
+ /**
70
+ * Reports a problem with this element through `@voidable/ui/dev` when it is loaded (a console warning,
71
+ * or a thrown `VoidDevError` in a test suite that asked for that); silent otherwise. Never throws on
72
+ * its own.
73
+ */
74
+ protected reportDev(kind: string, subject: string, message: string): void;
68
75
  protected shouldUpdate(changed: PropertyValues): boolean;
69
76
  protected update(changed: PropertyValues): void;
70
77
  /**
package/dist/base.js CHANGED
@@ -1,2 +1,6 @@
1
- import { t as e } from "./chunks/base-CMruMbxC.js";
1
+ import { t as e } from "./chunks/base-BGrS4eIl.js";
2
+ import { r as t } from "./chunks/projection-oPe6ipjL.js";
3
+ //#region src/base-entry.ts
4
+ t();
5
+ //#endregion
2
6
  export { e as VoidElement };
@@ -0,0 +1,307 @@
1
+ import { LitElement as e, ReactiveElement as t } from "lit";
2
+ //#region src/projection-api.ts
3
+ var n = "__voidProjection", r = {}, i = Symbol("voidReflectedDefaults"), a = Symbol("voidDefaultsProbe"), o = Symbol("voidReflectAgain");
4
+ function s(e) {
5
+ let t = e.constructor;
6
+ if (Object.prototype.hasOwnProperty.call(t, i)) return t[i];
7
+ let n = /* @__PURE__ */ new Map();
8
+ t[i] = n;
9
+ let r = null;
10
+ try {
11
+ customElements.get(e.localName) === t && (r = Object.assign(new t(), { [a]: !0 }));
12
+ } catch {
13
+ r = null;
14
+ }
15
+ if (!r) return n;
16
+ for (let [e, i] of t.elementProperties) {
17
+ if (!i.reflect || i.attribute === !1) continue;
18
+ let t = typeof i.attribute == "string" ? i.attribute : String(e).toLowerCase(), a = typeof i.converter == "function" || !!i.converter?.fromAttribute;
19
+ n.set(t, {
20
+ prop: e,
21
+ value: r[e],
22
+ custom: a,
23
+ options: i
24
+ });
25
+ }
26
+ return n;
27
+ }
28
+ var c = Symbol("voidMorphMeta");
29
+ function l(e) {
30
+ let t = e.constructor;
31
+ if (Object.prototype.hasOwnProperty.call(t, c)) return t[c];
32
+ let n = /* @__PURE__ */ new Map();
33
+ for (let [e, r] of t.elementProperties) {
34
+ if (r.attribute === !1) continue;
35
+ let t = typeof r.attribute == "string" ? r.attribute : String(e).toLowerCase();
36
+ n.set(t, !!r.reflect);
37
+ }
38
+ let r = {
39
+ attrs: n,
40
+ drafts: Object.entries(t.clientState ?? {}),
41
+ hook: e.morphedCallback !== h.prototype.morphedCallback,
42
+ edits: t.editState ?? []
43
+ };
44
+ return t[c] = r, r;
45
+ }
46
+ var u = 10, d = 1e3, f = Symbol.for("voidable.dev"), p = Symbol.for("@voidable/ui:morph-participants"), m = /* @__PURE__ */ new WeakMap(), h = class i extends e {
47
+ #e = null;
48
+ #t = null;
49
+ #n = !1;
50
+ #r = !1;
51
+ #i = null;
52
+ #a = void 0;
53
+ #o = void 0;
54
+ #s = !1;
55
+ #c = null;
56
+ static get observedAttributes() {
57
+ let e = super.observedAttributes;
58
+ return this.labelTarget ? [
59
+ ...e,
60
+ "aria-label",
61
+ "aria-labelledby"
62
+ ] : e;
63
+ }
64
+ #l = null;
65
+ #u(e, t) {
66
+ this.#l || (this.#l = {
67
+ "aria-label": null,
68
+ "aria-labelledby": null,
69
+ written: /* @__PURE__ */ new Map()
70
+ }, this.addController({ hostUpdated: () => this.#d() })), this.#l[e] = t || null, this.removeAttribute(e), this.#d();
71
+ }
72
+ #d() {
73
+ let e = this.#l, t = this.constructor.labelTarget;
74
+ if (!e || !t) return;
75
+ let n = Array.from(this.querySelectorAll(t));
76
+ for (let [t, r] of e.written) if (!n.includes(t)) {
77
+ e.written.delete(t);
78
+ for (let [e, n] of Object.entries(r)) n !== null && t.getAttribute(e) === n && t.removeAttribute(e);
79
+ }
80
+ for (let t of n) {
81
+ let n = e.written.get(t);
82
+ n || e.written.set(t, n = {
83
+ "aria-label": null,
84
+ "aria-labelledby": null
85
+ });
86
+ for (let r of ["aria-label", "aria-labelledby"]) {
87
+ let i = e[r], a = t.getAttribute(r);
88
+ r === "aria-labelledby" && a !== null && a !== n[r] || (i === null ? (n[r] !== null && a === n[r] && a !== null && t.removeAttribute(r), n[r] = null) : (a !== i && t.setAttribute(r, i), n[r] = i));
89
+ }
90
+ }
91
+ }
92
+ createRenderRoot() {
93
+ return this;
94
+ }
95
+ connectedCallback() {
96
+ this.#a === void 0 && (this.#a = this.#f(this), this.#o = this.outerHTML, !this.__voidProjection && this.render !== e.prototype.render && r.current?.create(this)), super.connectedCallback();
97
+ }
98
+ connectedMoveCallback() {}
99
+ reportDev(e, t, n) {
100
+ globalThis[f]?.report?.({
101
+ kind: e,
102
+ tag: this.localName,
103
+ subject: t,
104
+ message: n,
105
+ element: this
106
+ });
107
+ }
108
+ #f(e) {
109
+ if (!e.hasAttributes()) return null;
110
+ let { attrs: t } = l(this), n = e.attributes, r = null;
111
+ for (let e = 0; e < n.length; e++) {
112
+ let i = n[e];
113
+ t.has(i.name) && (r ??= /* @__PURE__ */ new Map()).set(i.name, i.value);
114
+ }
115
+ return r;
116
+ }
117
+ shouldUpdate(e) {
118
+ return !this[a] && super.shouldUpdate(e);
119
+ }
120
+ update(n) {
121
+ this.#r = !0;
122
+ try {
123
+ this.render === e.prototype.render ? t.prototype.update.call(this, n) : super.update(n);
124
+ } finally {
125
+ this.#r = !1;
126
+ }
127
+ }
128
+ setHostAttribute(e, t) {
129
+ let n = t === !0 ? "" : t === !1 || t == null ? null : String(t), r = this.#e ??= /* @__PURE__ */ new Map();
130
+ this.#i && r.get(e) !== n && this.#i.delete(e), r.set(e, n), n === null ? this.hasAttribute(e) && super.removeAttribute(e) : this.getAttribute(e) !== n && super.setAttribute(e, n);
131
+ }
132
+ setHostStyle(e, t) {
133
+ t == null || t === "" ? (this.#t?.delete(e), this.style.removeProperty(e)) : ((this.#t ??= /* @__PURE__ */ new Map()).set(e, t), this.style.getPropertyValue(e) !== t && this.style.setProperty(e, t));
134
+ }
135
+ removeAttribute(e) {
136
+ super.removeAttribute(e), this.#p(e);
137
+ }
138
+ removeAttributeNS(e, t) {
139
+ super.removeAttributeNS(e, t), e || this.#p(t);
140
+ }
141
+ toggleAttribute(e, t) {
142
+ let n = super.toggleAttribute(e, t);
143
+ return n || this.#p(e), n;
144
+ }
145
+ setAttribute(e, t) {
146
+ super.setAttribute(e, t), e === "style" && this.#t?.size && this.#m();
147
+ }
148
+ #p(e) {
149
+ (e === "style" ? this.#t?.size : this.#e?.get(e) != null) && this.#m();
150
+ }
151
+ #m() {
152
+ this.#n || (this.#n = !0, queueMicrotask(() => {
153
+ this.#n = !1, this.#h();
154
+ }));
155
+ }
156
+ #h() {
157
+ if (this.#e) for (let [e, t] of this.#e) t !== null && !this.hasAttribute(e) && this.#g(e) && super.setAttribute(e, t);
158
+ if (this.#t) {
159
+ let e;
160
+ for (let [t, n] of this.#t) if (this.style.getPropertyValue(t) !== n) {
161
+ if (!(e ??= this.#g("style"))) break;
162
+ this.style.setProperty(t, n);
163
+ }
164
+ }
165
+ }
166
+ #g(e) {
167
+ let t = Date.now(), n = this.#i ??= /* @__PURE__ */ new Map(), r = n.get(e);
168
+ return r && r[0] === Infinity ? !1 : ((!r || t - r[1] > d) && n.set(e, r = [0, t]), ++r[0] <= u ? !0 : (r[0] = Infinity, globalThis[f]?.report?.({
169
+ kind: "attribute-fight",
170
+ tag: this.localName,
171
+ subject: e,
172
+ message: `<${this.localName}> ${e}: something keeps removing this attribute, which the component manages; after ${u} restorations within ${d} ms it is no longer put back. Find the script that removes it (a MutationObserver, a sanitiser) and leave the attribute alone.`,
173
+ element: this
174
+ }), !1));
175
+ }
176
+ attributeChangedCallback(e, t, n) {
177
+ if ((e === "aria-label" || e === "aria-labelledby") && this.constructor.labelTarget) {
178
+ n !== null && this.#u(e, n);
179
+ return;
180
+ }
181
+ if (super.attributeChangedCallback(e, t, n), n !== null || t === null || this.#r) return;
182
+ let r = s(this).get(e);
183
+ if (!r) return;
184
+ let i = this;
185
+ if (!r.custom && r.value !== void 0 && i[r.prop] !== r.value) {
186
+ i[r.prop] = r.value;
187
+ return;
188
+ }
189
+ let { options: a } = r, c = i[r.prop], l = typeof a.converter == "object" ? a.converter : void 0;
190
+ (l?.toAttribute ? l.toAttribute(c, a.type) : a.type === Boolean ? c ? "" : null : c ?? null) != null && this.requestUpdate(r.prop, o);
191
+ }
192
+ insertBefore(e, t) {
193
+ let r = this[n];
194
+ return r && t && t.parentNode !== this && (r.isProjected(t) || r.isWrapEnd(t)) ? r.insertBefore(e, t) : r && !t && r.append(e) ? e : super.insertBefore(e, t);
195
+ }
196
+ removeChild(e) {
197
+ let t = this[n];
198
+ return t && e.parentNode !== this && t.isProjected(e) ? e.parentNode.removeChild(e) : super.removeChild(e);
199
+ }
200
+ replaceChild(e, t) {
201
+ let r = this[n];
202
+ return r && t.parentNode !== this && r.isProjected(t) ? (r.insertBefore(e, t), t.parentNode.removeChild(t)) : super.replaceChild(e, t);
203
+ }
204
+ get textContent() {
205
+ return super.textContent ?? "";
206
+ }
207
+ set textContent(e) {
208
+ let t = this[n], r = e == null ? "" : String(e), i = r ? [this.ownerDocument.createTextNode(r)] : [];
209
+ (!t || !t.replaceContent(i)) && (super.textContent = e);
210
+ }
211
+ replaceChildren(...e) {
212
+ let t = this[n];
213
+ if (t) {
214
+ let n = [];
215
+ for (let t of e) typeof t == "string" ? n.push(this.ownerDocument.createTextNode(t)) : t.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? n.push(...Array.from(t.childNodes)) : n.push(t);
216
+ for (let e of n) if (e.nodeType === Node.DOCUMENT_NODE || e.nodeType === Node.DOCUMENT_TYPE_NODE || e.contains(this)) throw new DOMException(`Failed to execute 'replaceChildren' on '${this.localName}': the new child cannot be inserted here.`, "HierarchyRequestError");
217
+ if (t.replaceContent(n)) return;
218
+ }
219
+ super.replaceChildren(...e);
220
+ }
221
+ voidBeforeMorph(e) {
222
+ if (e && e !== this) {
223
+ e instanceof i && e[n]?.unproject();
224
+ let t = !!r.current?.strip(e) || (this[p] ?? []).some((t) => t.isCopy?.(e)), a = this.#l;
225
+ if (a) {
226
+ for (let t of ["aria-label", "aria-labelledby"]) a[t] !== null && !e.hasAttribute(t) && (a[t] = null);
227
+ this.#d();
228
+ }
229
+ if (m.get(e) !== this) {
230
+ m.set(e, this);
231
+ for (let t of this[p] ?? []) t.voidBeforeMorph(e);
232
+ this.#_(e, t);
233
+ }
234
+ this.#y(e);
235
+ }
236
+ this.isConnected || r.current?.strip(this);
237
+ let t = this[n];
238
+ return t ? t.parked || t.unproject() : !1;
239
+ }
240
+ voidUnchanged(e) {
241
+ let t = e.outerHTML;
242
+ return t === this.#o && !this.__voidProjection?.parked ? !0 : (this.#o = t, !1);
243
+ }
244
+ voidAfterMorph() {
245
+ return this.__voidProjection?.reproject() ?? this.updateComplete;
246
+ }
247
+ #_(e, t = !1) {
248
+ let n = l(this), r = this.#a ?? null, a = e instanceof i && e.#a !== void 0 ? e.#a : t ? r : this.#f(e), o = null;
249
+ if (r) for (let [e, t] of r) a?.get(e) !== t && (o ??= /* @__PURE__ */ new Set()).add(e);
250
+ if (a) for (let [e, t] of a) r?.get(e) !== t && (o ??= /* @__PURE__ */ new Set()).add(e);
251
+ if (o && (this.#a = a), o && n.edits.length && this.#v()) {
252
+ for (let t of n.edits) {
253
+ if (!o.delete(t)) continue;
254
+ let n = this.getAttribute(t);
255
+ n === null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
256
+ }
257
+ o.size || (o = null);
258
+ }
259
+ let s = this.attributes;
260
+ for (let t = 0; t < s.length; t++) {
261
+ let r = s[t];
262
+ n.attrs.get(r.name) !== !0 || o?.has(r.name) || e.getAttribute(r.name) !== r.value && e.setAttribute(r.name, r.value);
263
+ }
264
+ if (e instanceof i) {
265
+ let t = e.attributes;
266
+ for (let r = t.length - 1; r >= 0; r--) {
267
+ let i = t[r].name;
268
+ n.attrs.get(i) === !0 && !a?.has(i) && !this.hasAttribute(i) && e.removeAttribute(i);
269
+ }
270
+ }
271
+ if (a) for (let t of a.keys()) n.attrs.get(t) === !0 && !o?.has(t) && !this.hasAttribute(t) && e.removeAttribute(t);
272
+ if (o && n.drafts.length) {
273
+ let e = this;
274
+ for (let [t, r] of n.drafts) r !== null && o.has(r) && e[t] != null && (e[t] = null, this.requestUpdate());
275
+ }
276
+ if (o) for (let e of o) (this.#c ??= /* @__PURE__ */ new Set()).add(e);
277
+ (n.hook || this.#c) && !this.#s && (this.#s = !0, queueMicrotask(() => {
278
+ this.updateComplete.then(() => {
279
+ this.#s = !1;
280
+ let e = this.#c;
281
+ this.#c = null, this.isConnected && (e && this.serverChangedCallback(e), n.hook && this.morphedCallback());
282
+ });
283
+ }));
284
+ }
285
+ #v() {
286
+ let e = this.ownerDocument.activeElement;
287
+ return !!e && e !== this && this.contains(e) || !!r.current?.isFocusParked(this);
288
+ }
289
+ serverChangedCallback(e) {}
290
+ morphedCallback() {}
291
+ #y(e) {
292
+ if (this.#e) {
293
+ let t = e instanceof i ? e.#e : null;
294
+ for (let [n, r] of this.#e) {
295
+ if (r === null) continue;
296
+ let i = e.getAttribute(n);
297
+ (i === null || t?.has(n) && t.get(n) === i) && i !== r && e.setAttribute(n, r);
298
+ }
299
+ }
300
+ if (this.#t?.size && "style" in e) {
301
+ let t = e.style;
302
+ for (let [e, n] of this.#t) t.getPropertyValue(e) || t.setProperty(e, n);
303
+ }
304
+ }
305
+ };
306
+ //#endregion
307
+ export { n, r, h as t };
@@ -0,0 +1,95 @@
1
+ import { html as e, nothing as t } from "lit";
2
+ //#region src/components/charts/data.ts
3
+ function n(e, t, n) {
4
+ if (typeof e != "string") return t.text = null, { value: e ?? n.empty() };
5
+ if (e === t.text) return null;
6
+ if (t.text = e, e.trim() === "") return { value: n.empty() };
7
+ let i;
8
+ try {
9
+ i = JSON.parse(e);
10
+ } catch (t) {
11
+ return n.warn(n.attr, `${n.attr}="${r(e)}" is not valid JSON (${t.message}), so nothing is drawn. Expected ${n.shape}.`), { value: n.empty() };
12
+ }
13
+ let a = n.normalize(i);
14
+ return a === null ? (n.warn(n.attr, `${n.attr}="${r(e)}" does not have the shape the chart takes, so nothing is drawn. Expected ${n.shape}.`), { value: n.empty() }) : { value: a };
15
+ }
16
+ function r(e) {
17
+ return e.length > 60 ? `${e.slice(0, 57)}...` : e;
18
+ }
19
+ var i = (e) => typeof e == "object" && !!e && !Array.isArray(e), a = (e) => Array.isArray(e) ? e : [];
20
+ function o(e) {
21
+ if (!i(e) || e.series !== void 0 && !Array.isArray(e.series)) return null;
22
+ let t = a(e.series).filter(i).map((e) => ({
23
+ ...e,
24
+ name: String(e.name ?? ""),
25
+ values: a(e.values)
26
+ }));
27
+ return e.labels === void 0 ? { series: t } : {
28
+ series: t,
29
+ labels: a(e.labels).map(String)
30
+ };
31
+ }
32
+ function s(e) {
33
+ return Array.isArray(e) ? e.filter(i).map((e) => ({
34
+ ...e,
35
+ name: String(e.name ?? ""),
36
+ value: e.value
37
+ })) : null;
38
+ }
39
+ function c(e) {
40
+ return e.closest("[lang]")?.getAttribute("lang") || void 0;
41
+ }
42
+ function l(e) {
43
+ let t = (t) => {
44
+ try {
45
+ return new Intl.NumberFormat(c(e), t);
46
+ } catch {
47
+ return new Intl.NumberFormat(void 0, t);
48
+ }
49
+ }, n = t({ maximumFractionDigits: 3 }), r = t({
50
+ style: "percent",
51
+ maximumFractionDigits: 1
52
+ });
53
+ return {
54
+ number: (e) => typeof e == "number" && Number.isFinite(e) ? n.format(e) : "–",
55
+ percent: (e) => Number.isFinite(e) ? r.format(e) : "–"
56
+ };
57
+ }
58
+ function u(n, r) {
59
+ return r ? e`<table class=${n}>
60
+ <caption>${r.caption}</caption>
61
+ <thead><tr>${r.head.map((t) => e`<th scope="col">${t}</th>`)}</tr></thead>
62
+ <tbody>${r.rows.map((n) => e`<tr>${n.header === void 0 ? t : e`<th scope="row">${n.header}</th>`}${n.cells.map((t) => e`<td>${t}</td>`)}</tr>`)}</tbody>
63
+ </table>` : t;
64
+ }
65
+ function d(e, t, n, r) {
66
+ if (n.length === 0) return null;
67
+ let i = l(e), a = Math.max(...n.map((e) => e.values.length)), o = [];
68
+ for (let e = 0; e < a; e++) o.push({
69
+ header: r[e] ?? String(e + 1),
70
+ cells: n.map((t) => i.number(t.values[e]))
71
+ });
72
+ return {
73
+ caption: t,
74
+ head: ["Label", ...n.map((e) => e.name)],
75
+ rows: o
76
+ };
77
+ }
78
+ function f(e, t, n) {
79
+ if (n.length === 0) return null;
80
+ let r = l(e), i = (e) => Number.isFinite(e) ? e : 0, a = n.reduce((e, t) => e + i(t.value), 0);
81
+ return {
82
+ caption: t,
83
+ head: [
84
+ "Segment",
85
+ "Value",
86
+ "Share"
87
+ ],
88
+ rows: n.map((e) => ({
89
+ header: e.name,
90
+ cells: [r.number(e.value), a > 0 ? r.percent(i(e.value) / a) : "–"]
91
+ }))
92
+ };
93
+ }
94
+ //#endregion
95
+ export { o as a, d as c, s as i, l, u as n, n as o, i as r, f as s, c as t };
@@ -38,9 +38,25 @@ var r = class {
38
38
  reset() {
39
39
  clearTimeout(this.#t), this.#e = "";
40
40
  }
41
- }, i = 0;
41
+ };
42
+ function i(e) {
43
+ try {
44
+ if (e.matches(":dir(rtl)")) return !0;
45
+ } catch {}
46
+ return getComputedStyle(e).direction === "rtl";
47
+ }
42
48
  function a(e) {
43
- return `${e}-${++i}`;
49
+ return i(e) ? {
50
+ next: "ArrowLeft",
51
+ prev: "ArrowRight"
52
+ } : {
53
+ next: "ArrowRight",
54
+ prev: "ArrowLeft"
55
+ };
56
+ }
57
+ var o = 0;
58
+ function s(e) {
59
+ return `${e}-${++o}`;
44
60
  }
45
61
  //#endregion
46
- export { a, e as i, t as n, n as r, r as t };
62
+ export { e as a, n as i, t as n, s as o, a as r, r as t };
@@ -1,7 +1,7 @@
1
- import { t as e } from "./base-CMruMbxC.js";
1
+ import { t as e } from "./base-BGrS4eIl.js";
2
2
  import { t } from "./decorate-CaYbmmmm.js";
3
- import { n, r } from "./parts-CMQQop0D.js";
4
- import { t as i } from "./overlay-BywGMcDW.js";
3
+ import { n, r } from "./parts-DI_3VpSy.js";
4
+ import { t as i } from "./overlay-CH7L4N-h.js";
5
5
  import { property as a } from "lit/decorators.js";
6
6
  //#region src/modal.ts
7
7
  var o = class extends e {
@@ -1,4 +1,4 @@
1
- import { i as e } from "./base-CMruMbxC.js";
1
+ import { r as e } from "./base-BGrS4eIl.js";
2
2
  //#region src/overlay.ts
3
3
  var t = new Set([
4
4
  "escape",
@@ -318,7 +318,7 @@ var S = class {
318
318
  return;
319
319
  }
320
320
  if (l(t)) try {
321
- c(t, ":popover-open") || (t.showPopover(), this._watchFade(t), e(t.ownerDocument));
321
+ c(t, ":popover-open") || (t.showPopover(), this._watchFade(t), e.current?.restoreParkedFocus(t.ownerDocument));
322
322
  } catch {}
323
323
  else t.hidden = !1;
324
324
  }
@@ -5,7 +5,7 @@ function n(e) {
5
5
  }
6
6
  var r = (e) => (e ?? "").split(/\s+/).filter(Boolean), i = class {
7
7
  constructor(t, n) {
8
- this._observer = null, this._queued = !1, this._attrs = /* @__PURE__ */ new Map(), this._styles = /* @__PURE__ */ new Map(), this._names = /* @__PURE__ */ new Set(), this._syncing = !1, this._pass = 0, this._onMutations = (e) => {
8
+ this._observer = null, this._queued = !1, this._attrs = /* @__PURE__ */ new Map(), this._styles = /* @__PURE__ */ new Map(), this._names = /* @__PURE__ */ new Set(), this._syncing = !1, this._observing = !1, this._namesDirty = !1, this._pass = 0, this._onMutations = (e) => {
9
9
  for (let t of e) {
10
10
  if (t.type === "attributes") {
11
11
  if (this._lostOwned(t.target, t.attributeName)) return this.requestSync();
@@ -50,7 +50,7 @@ var r = (e) => (e ?? "").split(/\s+/).filter(Boolean), i = class {
50
50
  r || this._attrs.set(e, r = /* @__PURE__ */ new Map()), r.set(t, {
51
51
  ...n,
52
52
  pass: this._syncing ? this._pass : r.get(t)?.pass ?? 0
53
- }), this._names.has(t) || (this._names.add(t), this._observer && this._observe());
53
+ }), this._names.has(t) || (this._names.add(t), this._observing && (this._syncing ? this._namesDirty = !0 : this._observe()));
54
54
  }
55
55
  set(e, t, n) {
56
56
  let r = n === !0 ? "" : n === !1 || n == null ? null : String(n);
@@ -113,10 +113,10 @@ var r = (e) => (e ?? "").split(/\s+/).filter(Boolean), i = class {
113
113
  }
114
114
  }
115
115
  hostConnected() {
116
- this._observer ??= new MutationObserver(this._onMutations), this._observe(), this.sync();
116
+ this._observer ??= new MutationObserver(this._onMutations), this.sync(), this._observing || this._observe();
117
117
  }
118
118
  hostDisconnected() {
119
- this._observer?.disconnect();
119
+ this._observer?.disconnect(), this._observing = !1;
120
120
  }
121
121
  sync() {
122
122
  if (this._syncing) return;
@@ -129,25 +129,29 @@ var r = (e) => (e ?? "").split(/\s+/).filter(Boolean), i = class {
129
129
  } finally {
130
130
  this._syncing = !1;
131
131
  }
132
- this._observer?.takeRecords();
132
+ this._namesDirty && (this._namesDirty = !1, this._observe(!0)), this._observer?.takeRecords();
133
133
  }
134
134
  requestSync() {
135
135
  this._queued || (this._queued = !0, queueMicrotask(() => {
136
136
  this._queued = !1, this.host.isConnected && this.sync();
137
137
  }));
138
138
  }
139
- _observe() {
140
- let e = this._observer;
141
- if (!e || !this.host.isConnected) return;
142
- let t = e.takeRecords();
143
- e.disconnect(), t.length && !this._syncing && queueMicrotask(() => this._onMutations(t)), e.observe(this.host, {
144
- childList: !0,
145
- subtree: !0,
146
- ...this._names.size ? {
147
- attributes: !0,
148
- attributeFilter: [...this._names].filter((e) => !e.includes(" ")).concat(this._tokenNames())
149
- } : {}
150
- });
139
+ _observe(e = !1) {
140
+ let t = this._observer;
141
+ if (!(!t || !this.host.isConnected)) {
142
+ if (this._observing) {
143
+ let n = t.takeRecords();
144
+ t.disconnect(), n.length && !e && !this._syncing && queueMicrotask(() => this._onMutations(n));
145
+ }
146
+ this._observing = !0, t.observe(this.host, {
147
+ childList: !0,
148
+ subtree: !0,
149
+ ...this._names.size ? {
150
+ attributes: !0,
151
+ attributeFilter: [...this._names].filter((e) => !e.includes(" ")).concat(this._tokenNames())
152
+ } : {}
153
+ });
154
+ }
151
155
  }
152
156
  _tokenNames() {
153
157
  let e = /* @__PURE__ */ new Set();