@voidable/ui 0.8.1 → 0.10.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 (118) hide show
  1. package/README.md +8 -0
  2. package/dist/base-entry.d.ts +1 -0
  3. package/dist/base.d.ts +2 -1
  4. package/dist/base.js +5 -1
  5. package/dist/chunks/base-BxmMM3B7.js +298 -0
  6. package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
  7. package/dist/chunks/{modal-D_YVy2vg.js → modal-CgGp_fCs.js} +3 -3
  8. package/dist/chunks/{overlay-BywGMcDW.js → overlay-hLJ7IQHx.js} +2 -2
  9. package/dist/chunks/{parts-D30c8OoG.js → parts-DI_3VpSy.js} +25 -18
  10. package/dist/chunks/{base-CMruMbxC.js → projection-SnR79EHI.js} +105 -389
  11. package/dist/chunks/secret-value-CmTtVkMg.js +14 -0
  12. package/dist/chunks/value-list-CH6GjYXM.js +28 -0
  13. package/dist/components/accordion.js +2 -2
  14. package/dist/components/action-input.d.ts +8 -4
  15. package/dist/components/action-input.js +61 -49
  16. package/dist/components/alert.js +2 -2
  17. package/dist/components/avatar.js +13 -11
  18. package/dist/components/badge.js +1 -1
  19. package/dist/components/banner.js +2 -2
  20. package/dist/components/bar-chart.js +31 -29
  21. package/dist/components/breadcrumbs.js +2 -2
  22. package/dist/components/button.js +1 -1
  23. package/dist/components/calendar.js +78 -76
  24. package/dist/components/card.js +1 -1
  25. package/dist/components/carousel.js +18 -17
  26. package/dist/components/checkbox-group.d.ts +10 -0
  27. package/dist/components/checkbox-group.js +36 -23
  28. package/dist/components/checkbox.d.ts +2 -2
  29. package/dist/components/checkbox.js +17 -16
  30. package/dist/components/collapsible.js +2 -2
  31. package/dist/components/color-picker.d.ts +2 -2
  32. package/dist/components/color-picker.js +26 -24
  33. package/dist/components/combobox.d.ts +4 -2
  34. package/dist/components/combobox.js +22 -18
  35. package/dist/components/compose-input.d.ts +1 -1
  36. package/dist/components/compose-input.js +15 -10
  37. package/dist/components/dialog.js +1 -1
  38. package/dist/components/divider.js +11 -9
  39. package/dist/components/donut-chart.js +51 -49
  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.d.ts +1 -1
  44. package/dist/components/editable.js +13 -12
  45. package/dist/components/error-fallback.js +2 -2
  46. package/dist/components/field.js +10 -9
  47. package/dist/components/file-upload.js +19 -17
  48. package/dist/components/gauge.js +90 -85
  49. package/dist/components/hamburger.js +11 -9
  50. package/dist/components/hover-card.js +3 -3
  51. package/dist/components/indicator.js +14 -12
  52. package/dist/components/input.d.ts +6 -2
  53. package/dist/components/input.js +46 -34
  54. package/dist/components/line-chart.js +41 -39
  55. package/dist/components/list.js +1 -1
  56. package/dist/components/menu.js +3 -3
  57. package/dist/components/multiselect.d.ts +9 -0
  58. package/dist/components/multiselect.js +64 -54
  59. package/dist/components/nav-bar.js +1 -1
  60. package/dist/components/nav-menu.js +20 -19
  61. package/dist/components/number-input.d.ts +2 -2
  62. package/dist/components/number-input.js +17 -15
  63. package/dist/components/pagination.js +22 -20
  64. package/dist/components/panel.js +2 -2
  65. package/dist/components/pin-input.d.ts +6 -2
  66. package/dist/components/pin-input.js +39 -27
  67. package/dist/components/popover.js +3 -3
  68. package/dist/components/progress.js +14 -12
  69. package/dist/components/radio-group.d.ts +2 -2
  70. package/dist/components/radio-group.js +15 -10
  71. package/dist/components/radio.d.ts +25 -0
  72. package/dist/components/radio.js +78 -29
  73. package/dist/components/scroll-area.js +8 -7
  74. package/dist/components/segmented-control.d.ts +1 -1
  75. package/dist/components/segmented-control.js +21 -21
  76. package/dist/components/select.d.ts +67 -16
  77. package/dist/components/select.js +183 -56
  78. package/dist/components/sidebar.d.ts +2 -2
  79. package/dist/components/sidebar.js +2 -2
  80. package/dist/components/skeleton.js +1 -1
  81. package/dist/components/slider.d.ts +2 -2
  82. package/dist/components/slider.js +18 -13
  83. package/dist/components/spinner.js +11 -9
  84. package/dist/components/stat.js +19 -17
  85. package/dist/components/status-dot.js +1 -1
  86. package/dist/components/stepper.js +15 -13
  87. package/dist/components/switch.d.ts +1 -1
  88. package/dist/components/switch.js +14 -12
  89. package/dist/components/table.js +1 -1
  90. package/dist/components/tabs.js +29 -29
  91. package/dist/components/tag.js +9 -8
  92. package/dist/components/tags-input.d.ts +1 -1
  93. package/dist/components/tags-input.js +25 -19
  94. package/dist/components/textarea.d.ts +2 -2
  95. package/dist/components/textarea.js +36 -31
  96. package/dist/components/toast.d.ts +19 -2
  97. package/dist/components/toast.js +43 -10
  98. package/dist/components/toggle-group.d.ts +2 -2
  99. package/dist/components/toggle-group.js +16 -15
  100. package/dist/components/toggle.js +5 -2
  101. package/dist/components/tooltip.js +3 -3
  102. package/dist/components.json +3 -3
  103. package/dist/custom-elements.json +133 -67
  104. package/dist/dev/types.d.ts +2 -3
  105. package/dist/dev.js +81 -55
  106. package/dist/index.js +1 -1
  107. package/dist/keyboard.d.ts +10 -0
  108. package/dist/llms.txt +125 -0
  109. package/dist/parts.d.ts +8 -1
  110. package/dist/projection-api.d.ts +23 -0
  111. package/dist/projection.d.ts +8 -2
  112. package/dist/reference.md +4575 -0
  113. package/dist/secret-value.d.ts +17 -0
  114. package/dist/types/elements.d.ts +2 -2
  115. package/dist/value-list.d.ts +14 -0
  116. package/dist/vscode.html-custom-data.json +46 -26
  117. package/dist/web-types.json +73 -53
  118. package/package.json +5 -3
@@ -1,4 +1,4 @@
1
- import { nothing } from 'lit';
1
+ import { nothing, PropertyValues } from 'lit';
2
2
  import { VoidElement } from '../base.js';
3
3
  import { PartsController } from '../parts.js';
4
4
  /**
@@ -25,43 +25,94 @@ export declare class VoidSelect extends VoidElement {
25
25
  * `void-field`, set `error` on the field instead, which shows the message.
26
26
  */
27
27
  error: string;
28
- /** The value the host's `value` attribute or a property set asked for, kept until an option has it. */
29
- private _wanted;
30
- /** The server's selection at its last render (`selected` options, in order), for the morph rule. */
28
+ /** The chosen values (one for a single select), or null before anything decided them. */
29
+ private _choice;
30
+ /** The choice came from `value` and waits for an option that has it. */
31
+ private _pending;
32
+ /** The options the server's markup marks `selected` at its last render (JSON), for the morph rule. */
31
33
  private _serverSelection;
32
- private _serverValue;
33
- /** The user's selection, captured before a morph the server did not change it in, put back after. */
34
- private _keep;
35
- /** The server changed the host's `value` attribute in this morph: it wins over the options' `selected`. */
36
- private _serverValueChanged;
37
- private _form;
34
+ /** The `value` attribute the markup or the server last wrote: what a form reset returns to. */
35
+ private _initial;
38
36
  protected readonly _parts: PartsController;
39
37
  /** The native select this component enhances. */
40
38
  get select(): HTMLSelectElement | null;
41
39
  /**
42
- * `value` of the chosen option (the native select's value). As an attribute it is the initial choice, applied
43
- * once an option with that value exists; without it the options' own `selected` decide, as in plain HTML.
40
+ * `value` of the chosen option (the native select's value), reflected to the attribute as the choice
41
+ * changes. Written in markup it is the initial choice, applied once an option with that value exists (and
42
+ * what a form reset returns to); without it the options' own `selected` decide, as in plain HTML.
44
43
  * @default ''
45
44
  */
46
45
  get value(): string;
47
46
  set value(next: string);
47
+ /** Lit writes the reflected attribute during update; any other write of `value` is the markup's or the server's. */
48
+ private _reflecting;
49
+ protected update(changed: PropertyValues): void;
50
+ /** Asks Lit to reflect the choice when it moved, or when the attribute does not show it yet. */
51
+ private _changed;
52
+ attributeChangedCallback(name: string, old: string | null, value: string | null): void;
48
53
  connectedCallback(): void;
49
54
  disconnectedCallback(): void;
50
- /** Writes the invalid state on the select, applies a wanted value once its option exists, follows its form. */
55
+ /** The select was added, replaced or moved (PartsController): follow it, mark it, write the choice into it. */
51
56
  private _wire;
52
- /** Pushes the wanted value into the select (once an option has it); then the select is the truth. */
57
+ /**
58
+ * Brings the choice and the native select into agreement. `patch` says what happened to the select since
59
+ * the choice was last written into it:
60
+ * - `morph`: a morph through the adapters (between the pre-morph hook and its microtask, which the
61
+ * adapters' contract makes the morph's own synchronous run): any difference is the morph's, and the
62
+ * choice goes back in;
63
+ * - `mutation`: the select's options, their text or their `selected` were changed: a select left at its
64
+ * markup's default selection (or none) is that patch, and the choice goes back in;
65
+ * - `none`: nothing.
66
+ * Any other difference is a choice a script made in the select (`select.value = …`), and the choice follows it.
67
+ */
68
+ private _reconcile;
69
+ /** Reconciles now, taking the mutations of the select not delivered yet (unless a morph's microtask will). */
70
+ private _flush;
71
+ /** Puts the choice into the native select (properties only: no attribute, so no mutation of its own). */
53
72
  private _apply;
54
73
  protected updated(changed: Map<string, unknown>): void;
55
74
  /** The select we last marked `aria-invalid` (a `void-field` with an error marks it too; that stays theirs). */
56
75
  private _invalid;
57
76
  private _markInvalid;
58
77
  render(): typeof nothing | import('lit').TemplateResult<1>;
78
+ /** The user picked in the native select. */
79
+ private _onPick;
59
80
  private _onChange;
81
+ private _observer;
82
+ private _observed;
83
+ private _observe;
84
+ /**
85
+ * Something changed in the select: a morph without the pre-morph hook, options written with innerHTML,
86
+ * LiveView patching a locked select, a framework re-rendering the options.
87
+ */
88
+ private _onMutations;
89
+ /**
90
+ * Options the server rendered afresh: when they mark other options `selected` than its last render did,
91
+ * that is the server's new selection, and it wins (unless a value set in code still waits for its option).
92
+ */
93
+ private _serverMarked;
94
+ private _form;
60
95
  private _watchForm;
61
- /** After a reset the options' `selected` decide; an initial `value` attribute is applied again. */
96
+ /**
97
+ * The form is building its data (a submit, `new FormData(form)`, a LiveView event) from the native select.
98
+ * A patch may have reset it a moment ago, before its mutations were delivered or the morph's microtask
99
+ * ran: bring the choice up to date and into the select now, and correct the entries it already gave.
100
+ */
101
+ private _onFormData;
102
+ /** A reset in progress: the form resets the native select after its reset event, and the choice follows it. */
103
+ private _pendingReset;
62
104
  private _onReset;
105
+ /** After a reset the options' `selected` decide; a `value` attribute (the markup's or the server's) is applied again. */
106
+ private _finishReset;
107
+ /** A morph through the adapters is under way; the choice is written back in the microtask after it. */
108
+ private _morphQueued;
109
+ /**
110
+ * The decision is taken here, from the server's markup, before the morph touches anything: the options
111
+ * it marks `selected`, compared with its last render. A `value` attribute the server changed arrives
112
+ * during the morph itself (the morph writes it, which sets `value`) and so wins over them.
113
+ */
63
114
  voidBeforeMorph(incoming?: Element | null): boolean;
64
- protected morphedCallback(): void;
115
+ private _afterMorph;
65
116
  }
66
117
  declare global {
67
118
  interface HTMLElementTagNameMap {
@@ -1,29 +1,56 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { n } from "../chunks/parts-D30c8OoG.js";
4
- import { html as r, nothing as i } from "lit";
5
- import { property as a } from "lit/decorators.js";
3
+ import { r as n } from "../chunks/projection-SnR79EHI.js";
4
+ import { n as r } from "../chunks/parts-DI_3VpSy.js";
5
+ import { html as i, nothing as a } from "lit";
6
+ import { property as o } from "lit/decorators.js";
6
7
  //#region src/components/select.ts
7
- var o = class extends e {
8
+ n();
9
+ var s = class t extends e {
8
10
  constructor(...e) {
9
- super(...e), this.size = "md", this.error = "", this._wanted = null, this._serverSelection = null, this._serverValue = null, this._keep = null, this._serverValueChanged = !1, this._form = null, this._parts = new n(this, {
11
+ super(...e), this.size = "md", this.error = "", this._choice = null, this._pending = !1, this._serverSelection = null, this._initial = null, this._parts = new r(this, {
10
12
  tags: [
11
13
  "select",
12
14
  "option",
13
15
  "optgroup"
14
16
  ],
15
17
  onChange: () => this._wire()
16
- }), this._invalid = null, this._onChange = (e) => {
17
- e.target === this.select && (this._wanted = null, this.dispatchEvent(new CustomEvent("void-change", {
18
+ }), this._reflecting = !1, this._invalid = null, this._onPick = (e) => {
19
+ let t = this.select;
20
+ if (!t || e.target !== t) return;
21
+ this._pendingReset = null;
22
+ let n = this.value;
23
+ this._choice = _(t), this._pending = !1, this._changed(n);
24
+ }, this._onChange = (e) => {
25
+ e.target === this.select && (this._onPick(e), this.dispatchEvent(new CustomEvent("void-change", {
18
26
  bubbles: !0,
19
27
  composed: !0,
20
28
  detail: { value: this.value }
21
29
  })));
22
- }, this._onReset = () => {
23
- setTimeout(() => {
24
- let e = this.getAttribute("value");
25
- e !== null && this.isConnected && (this.value = e);
30
+ }, this._observer = null, this._observed = null, this._onMutations = (e) => {
31
+ this._morphQueued || !this.isConnected || this._reconcile(d(e) ? "mutation" : "none", e);
32
+ }, this._form = null, this._onFormData = (e) => {
33
+ let t = this.select;
34
+ if (!t || t.form !== e.target) return;
35
+ let n = v(t);
36
+ if (this._flush(), this._apply(), !t.name) return;
37
+ let r = v(t);
38
+ if (l(n, r)) return;
39
+ let i = e.formData.getAll(t.name);
40
+ for (let e of n) {
41
+ let t = i.indexOf(e);
42
+ t >= 0 && i.splice(t, 1);
43
+ }
44
+ e.formData.delete(t.name);
45
+ for (let n of [...i, ...r]) e.formData.append(t.name, n);
46
+ }, this._pendingReset = null, this._onReset = (e) => {
47
+ this._pendingReset = e, setTimeout(() => {
48
+ this._finishReset(), this._apply();
26
49
  });
50
+ }, this._morphQueued = !1, this._afterMorph = () => {
51
+ this._morphQueued = !1, this._observer?.takeRecords();
52
+ let e = this.select;
53
+ !this.isConnected || !e || (this._observe(e), this._watchForm(e.form), this._markInvalid(e), this._reconcile("morph"));
27
54
  };
28
55
  }
29
56
  static {
@@ -33,82 +60,182 @@ var o = class extends e {
33
60
  return this._parts.one("select");
34
61
  }
35
62
  get value() {
36
- let e = this.select;
37
- return this._wanted !== null && !(e && s(e, this._wanted)) ? this._wanted : e?.value ?? this._wanted ?? "";
63
+ return this._choice ? this._choice[0] ?? "" : this.select?.value ?? "";
38
64
  }
39
65
  set value(e) {
40
66
  let t = this.value;
41
- this._wanted = e == null ? null : String(e), this._apply(), this.requestUpdate("value", t);
67
+ if (e == null) {
68
+ let e = this.select;
69
+ this._choice = e ? h(e) : null, this._pending = !1;
70
+ } else this._choice = [String(e)], this._pending = !0;
71
+ this._apply(), this.requestUpdate("value", t);
72
+ }
73
+ update(e) {
74
+ this._reflecting = !0;
75
+ try {
76
+ super.update(e);
77
+ } finally {
78
+ this._reflecting = !1;
79
+ }
80
+ }
81
+ _changed(e) {
82
+ let t = this.value;
83
+ t === e ? this.getAttribute("value") !== t && this.requestUpdate("value", null) : this.requestUpdate("value", e);
84
+ }
85
+ attributeChangedCallback(e, t, n) {
86
+ e === "value" && !this._reflecting && (this._initial = n), super.attributeChangedCallback(e, t, n);
42
87
  }
43
88
  connectedCallback() {
44
- super.connectedCallback(), this.addEventListener("change", this._onChange, !0);
89
+ super.connectedCallback(), this.addEventListener("input", this._onPick, !0), this.addEventListener("change", this._onChange, !0);
45
90
  }
46
91
  disconnectedCallback() {
47
- super.disconnectedCallback(), this.removeEventListener("change", this._onChange, !0), this._watchForm(null);
92
+ super.disconnectedCallback(), this.removeEventListener("input", this._onPick, !0), this.removeEventListener("change", this._onChange, !0), this._observe(null), this._watchForm(null);
48
93
  }
49
94
  _wire() {
50
- let e = this.select;
51
- e && (this._markInvalid(e), this._serverSelection === null && (this._serverSelection = c(e)), this._serverValue === null && (this._serverValue = this.getAttribute("value") ?? ""), this._apply(), this._watchForm(e.form));
95
+ let e = this.select, t = !!e && !!this._observed && e !== this._observed, n = this._observer?.takeRecords() ?? [];
96
+ this._observe(e), e && (this._markInvalid(e), this._watchForm(e.form), !this._morphQueued && (this._serverSelection === null ? this._serverSelection = p(e) : t && this._serverMarked(e), this._reconcile(t || d(n) ? "mutation" : "none", n)));
97
+ }
98
+ _reconcile(e, t = []) {
99
+ let n = this.select;
100
+ if (!n) return;
101
+ this._finishReset(), e === "mutation" && f(t) && this._serverMarked(n);
102
+ let r = this.value, i = this._choice;
103
+ if (i === null || !this._pending && !n.multiple && i.length === 0) n.options.length && (this._choice = _(n));
104
+ else if (e !== "morph" && !this._pending && i.every((e) => c(n, e))) {
105
+ let t = _(n), r = e === "mutation" && l(t, h(n));
106
+ t.length && !r && !l(t, i) && (this._choice = t);
107
+ }
108
+ this._apply(), this._changed(r);
109
+ }
110
+ _flush() {
111
+ if (this._morphQueued || !this.select) return;
112
+ let e = this._observer?.takeRecords() ?? [];
113
+ this._reconcile(d(e) ? "mutation" : "none", e);
52
114
  }
53
115
  _apply() {
54
- let e = this.select;
55
- !e || this._wanted === null || !s(e, this._wanted) || (e.value !== this._wanted && (e.value = this._wanted), this._wanted = null);
116
+ let e = this.select, t = this._choice;
117
+ if (!e || !t) return;
118
+ if (!t.every((t) => c(e, t))) {
119
+ if (this._pending) return;
120
+ let t = this.value;
121
+ this._choice = _(e), this._changed(t);
122
+ return;
123
+ }
124
+ if (this._pending = !1, !e.multiple) {
125
+ t.length && e.value !== t[0] && (e.value = t[0]);
126
+ return;
127
+ }
128
+ let n = new Set(t);
129
+ for (let t of Array.from(e.options)) t.selected !== n.has(t.value) && (t.selected = n.has(t.value));
56
130
  }
57
131
  updated(e) {
58
- if (super.updated(e), e.has("error")) {
59
- let e = this.select;
60
- e && this._markInvalid(e);
61
- }
132
+ super.updated(e);
133
+ let t = this.select;
134
+ e.has("error") && t && this._markInvalid(t), this._flush();
62
135
  }
63
136
  _markInvalid(e) {
64
137
  this.error ? (e.getAttribute("aria-invalid") !== "true" && e.setAttribute("aria-invalid", "true"), this._invalid = e) : this._invalid &&= (this._invalid.getAttribute("aria-invalid") === "true" && !this._invalid.hasAttribute("data-void-field-invalid") && this._invalid.removeAttribute("aria-invalid"), null);
65
138
  }
66
139
  render() {
67
- return this.error ? r`<span class="void-select-error">${this.error}</span>` : i;
140
+ return this.error ? i`<span class="void-select-error">${this.error}</span>` : a;
141
+ }
142
+ _observe(e) {
143
+ e !== this._observed && (this._observer?.disconnect(), this._observed = e, e && (this._observer ??= new MutationObserver(this._onMutations), this._observer.observe(e, {
144
+ childList: !0,
145
+ subtree: !0,
146
+ attributes: !0,
147
+ characterData: !0
148
+ })));
149
+ }
150
+ _serverMarked(e) {
151
+ let t = p(e);
152
+ if (t === this._serverSelection || (this._serverSelection = t, this._pending)) return;
153
+ let n = JSON.parse(t);
154
+ if (!n.length) return;
155
+ let r = this.value;
156
+ this._choice = e.multiple ? n : [n[n.length - 1]], this._changed(r);
68
157
  }
69
158
  _watchForm(e) {
70
- e !== this._form && (this._form?.removeEventListener("reset", this._onReset), this._form = e, e?.addEventListener("reset", this._onReset));
159
+ e !== this._form && (this._form?.removeEventListener("reset", this._onReset), this._form?.removeEventListener("formdata", this._onFormData), this._form = e, e?.addEventListener("reset", this._onReset), e?.addEventListener("formdata", this._onFormData));
71
160
  }
72
- voidBeforeMorph(e) {
161
+ _finishReset() {
162
+ let e = this._pendingReset;
163
+ if (!e) return;
164
+ this._pendingReset = null;
73
165
  let t = this.select;
74
- if (e && e !== this && t) {
75
- let n = e.querySelector("select"), r = n ? c(n) : "", i = e.getAttribute("value") ?? "";
76
- this._serverValueChanged = i !== this._serverValue;
77
- let a = r !== this._serverSelection || this._serverValueChanged;
78
- this._serverSelection = r, this._serverValue = i, this._keep = a ? null : Array.from(t.selectedOptions, (e) => e.value);
79
- }
80
- return super.voidBeforeMorph(e);
166
+ if (e.defaultPrevented || !t || !this.isConnected) return;
167
+ let n = this.value;
168
+ this._initial === null ? (this._choice = h(t), this._pending = !1) : (this._choice = [this._initial], this._pending = !0), this._apply(), this._changed(n);
81
169
  }
82
- morphedCallback() {
83
- let e = this._keep, t = this._serverValueChanged;
84
- this._keep = null, this._serverValueChanged = !1;
85
- let n = this.select;
86
- if (!n) return;
87
- this.error && this._markInvalid(n);
88
- let r = this.getAttribute("value");
89
- if (t && r !== null) {
90
- this.value = r;
91
- return;
170
+ voidBeforeMorph(e) {
171
+ if (e && e !== this) {
172
+ this._flush();
173
+ let n = e instanceof t ? e._serverSelection : null, r = n ?? m(e), i = n === null && e instanceof t && !!this.select && r === p(this.select);
174
+ if (r !== null && !i) {
175
+ let e = this._serverSelection !== null && r !== this._serverSelection;
176
+ this._serverSelection = r;
177
+ let t = JSON.parse(r);
178
+ if (e && t.length && !this._pending) {
179
+ let e = this.value;
180
+ this._choice = this.select?.multiple ? t : [t[t.length - 1]], this._changed(e);
181
+ }
182
+ }
183
+ this._morphQueued || (this._morphQueued = !0, queueMicrotask(this._afterMorph));
92
184
  }
93
- if (!e) return;
94
- let i = new Set(e);
95
- for (let e of Array.from(n.options)) e.selected !== i.has(e.value) && (e.selected = i.has(e.value));
185
+ return super.voidBeforeMorph(e);
96
186
  }
97
187
  };
98
- t([a({
188
+ t([o({
99
189
  type: String,
100
190
  reflect: !0
101
- })], o.prototype, "size", void 0), t([a({
191
+ })], s.prototype, "size", void 0), t([o({
102
192
  type: String,
103
193
  reflect: !0
104
- })], o.prototype, "error", void 0), t([a({ type: String })], o.prototype, "value", null);
105
- function s(e, t) {
194
+ })], s.prototype, "error", void 0), t([o({
195
+ type: String,
196
+ reflect: !0
197
+ })], s.prototype, "value", null);
198
+ function c(e, t) {
106
199
  for (let n of Array.from(e.options)) if (n.value === t) return !0;
107
200
  return !1;
108
201
  }
109
- function c(e) {
110
- return Array.from(e.querySelectorAll("option[selected]"), (e) => e.value).join("\0");
202
+ function l(e, t) {
203
+ return e.length === t.length && e.every((e, n) => e === t[n]);
204
+ }
205
+ function u(e) {
206
+ return e.nodeName === "OPTION" || e.nodeName === "OPTGROUP";
207
+ }
208
+ function d(e) {
209
+ return e.some((e) => e.type === "attributes" ? e.attributeName === "selected" || e.attributeName === "multiple" : !0);
210
+ }
211
+ function f(e) {
212
+ let t = !1, n = !1;
213
+ for (let r of e) r.type === "childList" && (t ||= Array.from(r.removedNodes).some(u), n ||= Array.from(r.addedNodes).some(u));
214
+ return t && n;
215
+ }
216
+ function p(e) {
217
+ return JSON.stringify(Array.from(e.querySelectorAll("option[selected]"), (e) => e.value));
218
+ }
219
+ function m(e) {
220
+ let t = e.querySelector("select");
221
+ return t ? p(t) : null;
222
+ }
223
+ function h(e) {
224
+ let t = JSON.parse(p(e));
225
+ if (e.multiple) return t;
226
+ if (t.length) return [t[t.length - 1]];
227
+ let n = Array.from(e.options).find((e) => !e.disabled);
228
+ return n ? [n.value] : [];
229
+ }
230
+ function g(e) {
231
+ return Array.from(e.options).filter((e) => e.selected);
232
+ }
233
+ function _(e) {
234
+ return g(e).map((e) => e.value);
235
+ }
236
+ function v(e) {
237
+ return !e.name || e.matches(":disabled") ? [] : g(e).filter((e) => !e.matches(":disabled")).map((e) => e.value);
111
238
  }
112
- customElements.get("void-select") || customElements.define("void-select", o);
239
+ customElements.get("void-select") || customElements.define("void-select", s);
113
240
  //#endregion
114
- export { o as VoidSelect };
241
+ export { s as VoidSelect };
@@ -16,8 +16,8 @@ export declare class VoidSidebar extends VoidElement {
16
16
  width: string;
17
17
  /** CSS width when collapsed. Defaults to the theme's `--void-sidebar-collapsed-width`. */
18
18
  collapsedWidth: string;
19
- /** Which edge of the page the sidebar sits on: `left` (default) or `right`. */
20
- side: 'left' | 'right';
19
+ /** Which side of the content the sidebar sits on, in the reading direction: `start` (default) or `end`. */
20
+ side: 'start' | 'end';
21
21
  /**
22
22
  * Collapses or expands the sidebar on behalf of the user (call it from the
23
23
  * control that toggles it, such as a `void-hamburger`) and dispatches
@@ -1,10 +1,10 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { property as n } from "lit/decorators.js";
4
4
  //#region src/components/sidebar.ts
5
5
  var r = class extends e {
6
6
  constructor(...e) {
7
- super(...e), this.collapsed = !1, this.width = "var(--void-sidebar-width)", this.collapsedWidth = "var(--void-sidebar-collapsed-width)", this.side = "left";
7
+ super(...e), this.collapsed = !1, this.width = "var(--void-sidebar-width)", this.collapsedWidth = "var(--void-sidebar-collapsed-width)", this.side = "start";
8
8
  }
9
9
  toggle(e) {
10
10
  let t = e ?? !this.collapsed;
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { property as n } from "lit/decorators.js";
4
4
  //#region src/components/skeleton.ts
@@ -9,8 +9,8 @@ export declare class VoidSlider extends VoidSlider_base {
9
9
  /** The host's `aria-label` / `aria-labelledby` name the inner control. */
10
10
  static labelTarget: string;
11
11
  /**
12
- * Current position, between `min` and `max`. Defaults to 50. As an attribute it is the initial value;
13
- * read the `value` property for the current one.
12
+ * Current position, between `min` and `max`. Defaults to 50. Reflected to the `value` attribute as it
13
+ * moves; the form's reset target stays the value the slider started with.
14
14
  */
15
15
  value: number;
16
16
  /** Lowest value. Defaults to 0. */
@@ -1,10 +1,12 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { n } from "../chunks/form-control-C0vH6gii.js";
4
- import { html as r, nothing as i } from "lit";
5
- import { property as a } from "lit/decorators.js";
4
+ import { r } from "../chunks/projection-SnR79EHI.js";
5
+ import { html as i, nothing as a } from "lit";
6
+ import { property as o } from "lit/decorators.js";
6
7
  //#region src/components/slider.ts
7
- var o = class extends n(e) {
8
+ r();
9
+ var s = class extends n(e) {
8
10
  constructor(...e) {
9
11
  super(...e), this.value = 50, this.min = 0, this.max = 100, this.step = 1, this.disabled = !1, this.name = "", this.showValue = !1, this.size = "md";
10
12
  }
@@ -44,7 +46,7 @@ var o = class extends n(e) {
44
46
  }
45
47
  render() {
46
48
  let e = this._fill();
47
- return r`
49
+ return i`
48
50
  <input
49
51
  type="range"
50
52
  .value=${String(this.value)}
@@ -53,28 +55,31 @@ var o = class extends n(e) {
53
55
  step=${this.step}
54
56
  ?disabled=${this.disabled}
55
57
  name=${this.name}
56
- form=${this.formAttr ?? i}
58
+ form=${this.formAttr ?? a}
57
59
  style="--void-slider-fill: ${e}%"
58
60
  @input=${this._onInput}
59
61
  @change=${this._onChange}
60
62
  />
61
- ${this.showValue ? r`<span class="void-slider-value">${this.value}</span>` : ""}
63
+ ${this.showValue ? i`<span class="void-slider-value">${this.value}</span>` : ""}
62
64
  `;
63
65
  }
64
66
  };
65
- t([a({ type: Number })], o.prototype, "value", void 0), t([a({ type: Number })], o.prototype, "min", void 0), t([a({ type: Number })], o.prototype, "max", void 0), t([a({ type: Number })], o.prototype, "step", void 0), t([a({
67
+ t([o({
68
+ type: Number,
69
+ reflect: !0
70
+ })], s.prototype, "value", void 0), t([o({ type: Number })], s.prototype, "min", void 0), t([o({ type: Number })], s.prototype, "max", void 0), t([o({ type: Number })], s.prototype, "step", void 0), t([o({
66
71
  type: Boolean,
67
72
  reflect: !0
68
- })], o.prototype, "disabled", void 0), t([a({
73
+ })], s.prototype, "disabled", void 0), t([o({
69
74
  type: String,
70
75
  reflect: !0
71
- })], o.prototype, "name", void 0), t([a({
76
+ })], s.prototype, "name", void 0), t([o({
72
77
  type: Boolean,
73
78
  attribute: "show-value",
74
79
  reflect: !0
75
- })], o.prototype, "showValue", void 0), t([a({
80
+ })], s.prototype, "showValue", void 0), t([o({
76
81
  type: String,
77
82
  reflect: !0
78
- })], o.prototype, "size", void 0), customElements.get("void-slider") || customElements.define("void-slider", o);
83
+ })], s.prototype, "size", void 0), customElements.get("void-slider") || customElements.define("void-slider", s);
79
84
  //#endregion
80
- export { o as VoidSlider };
85
+ export { s as VoidSlider };
@@ -1,9 +1,11 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { html as n } from "lit";
4
- import { property as r } from "lit/decorators.js";
3
+ import { r as n } from "../chunks/projection-SnR79EHI.js";
4
+ import { html as r } from "lit";
5
+ import { property as i } from "lit/decorators.js";
5
6
  //#region src/components/spinner.ts
6
- var i = class extends e {
7
+ n();
8
+ var a = class extends e {
7
9
  constructor(...e) {
8
10
  super(...e), this.size = "md", this.label = "Loading";
9
11
  }
@@ -14,15 +16,15 @@ var i = class extends e {
14
16
  e.has("label") && this.setHostAttribute("aria-label", this.label);
15
17
  }
16
18
  render() {
17
- return n`<span data-void-sr>${this.label}</span>`;
19
+ return r`<span data-void-sr>${this.label}</span>`;
18
20
  }
19
21
  };
20
- t([r({
22
+ t([i({
21
23
  type: String,
22
24
  reflect: !0
23
- })], i.prototype, "size", void 0), t([r({
25
+ })], a.prototype, "size", void 0), t([i({
24
26
  type: String,
25
27
  reflect: !0
26
- })], i.prototype, "label", void 0), customElements.get("void-spinner") || customElements.define("void-spinner", i);
28
+ })], a.prototype, "label", void 0), customElements.get("void-spinner") || customElements.define("void-spinner", a);
27
29
  //#endregion
28
- export { i as VoidSpinner };
30
+ export { a as VoidSpinner };
@@ -1,9 +1,11 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { html as n } from "lit";
4
- import { property as r } from "lit/decorators.js";
3
+ import { r as n } from "../chunks/projection-SnR79EHI.js";
4
+ import { html as r } from "lit";
5
+ import { property as i } from "lit/decorators.js";
5
6
  //#region src/components/stat.ts
6
- var i = class extends e {
7
+ n();
8
+ var a = class extends e {
7
9
  constructor(...e) {
8
10
  super(...e), this.label = "", this.value = "", this.delta = "", this.description = "", this.trend = null, this.color = "default", this.size = "md";
9
11
  }
@@ -11,35 +13,35 @@ var i = class extends e {
11
13
  super.connectedCallback(), this.setHostAttribute("role", "figure");
12
14
  }
13
15
  render() {
14
- return n`
15
- ${this.label ? n`<span class="void-stat-label">${this.label}</span>` : ""}
16
+ return r`
17
+ ${this.label ? r`<span class="void-stat-label">${this.label}</span>` : ""}
16
18
  <span class="void-stat-value">${this.value}</span>
17
- ${this.delta ? n`<span class="void-stat-delta">${this.delta}</span>` : ""}
18
- ${this.description ? n`<span class="void-stat-description">${this.description}</span>` : ""}
19
+ ${this.delta ? r`<span class="void-stat-delta">${this.delta}</span>` : ""}
20
+ ${this.description ? r`<span class="void-stat-description">${this.description}</span>` : ""}
19
21
  `;
20
22
  }
21
23
  };
22
- t([r({
24
+ t([i({
23
25
  type: String,
24
26
  reflect: !0
25
- })], i.prototype, "label", void 0), t([r({
27
+ })], a.prototype, "label", void 0), t([i({
26
28
  type: String,
27
29
  reflect: !0
28
- })], i.prototype, "value", void 0), t([r({
30
+ })], a.prototype, "value", void 0), t([i({
29
31
  type: String,
30
32
  reflect: !0
31
- })], i.prototype, "delta", void 0), t([r({
33
+ })], a.prototype, "delta", void 0), t([i({
32
34
  type: String,
33
35
  reflect: !0
34
- })], i.prototype, "description", void 0), t([r({
36
+ })], a.prototype, "description", void 0), t([i({
35
37
  type: String,
36
38
  reflect: !0
37
- })], i.prototype, "trend", void 0), t([r({
39
+ })], a.prototype, "trend", void 0), t([i({
38
40
  type: String,
39
41
  reflect: !0
40
- })], i.prototype, "color", void 0), t([r({
42
+ })], a.prototype, "color", void 0), t([i({
41
43
  type: String,
42
44
  reflect: !0
43
- })], i.prototype, "size", void 0), customElements.get("void-stat") || customElements.define("void-stat", i);
45
+ })], a.prototype, "size", void 0), customElements.get("void-stat") || customElements.define("void-stat", a);
44
46
  //#endregion
45
- export { i as VoidStat };
47
+ export { a as VoidStat };
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { property as n } from "lit/decorators.js";
4
4
  //#region src/components/status-dot.ts