@voidable/ui 0.8.1 → 0.9.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.
- package/README.md +8 -0
- package/dist/chunks/{modal-D_YVy2vg.js → modal-hivQ4YoU.js} +1 -1
- package/dist/chunks/{parts-D30c8OoG.js → parts-CMQQop0D.js} +4 -1
- package/dist/chunks/secret-value-CmTtVkMg.js +14 -0
- package/dist/chunks/value-list-CH6GjYXM.js +28 -0
- package/dist/components/accordion.js +1 -1
- package/dist/components/action-input.d.ts +6 -2
- package/dist/components/action-input.js +55 -45
- package/dist/components/alert.js +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/carousel.js +1 -1
- package/dist/components/checkbox-group.d.ts +10 -0
- package/dist/components/checkbox-group.js +30 -18
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/collapsible.js +1 -1
- package/dist/components/color-picker.d.ts +2 -2
- package/dist/components/combobox.d.ts +4 -2
- package/dist/components/combobox.js +8 -5
- package/dist/components/compose-input.d.ts +1 -1
- package/dist/components/compose-input.js +4 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/editable.d.ts +1 -1
- package/dist/components/error-fallback.js +1 -1
- package/dist/components/gauge.js +4 -1
- package/dist/components/hover-card.js +1 -1
- package/dist/components/input.d.ts +6 -2
- package/dist/components/input.js +43 -33
- package/dist/components/menu.js +1 -1
- package/dist/components/multiselect.d.ts +9 -0
- package/dist/components/multiselect.js +47 -38
- package/dist/components/nav-menu.js +1 -1
- package/dist/components/number-input.d.ts +2 -2
- package/dist/components/panel.js +1 -1
- package/dist/components/pin-input.d.ts +6 -2
- package/dist/components/pin-input.js +27 -17
- package/dist/components/popover.js +1 -1
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +4 -1
- package/dist/components/segmented-control.d.ts +1 -1
- package/dist/components/select.d.ts +67 -16
- package/dist/components/select.js +172 -47
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +4 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/tags-input.d.ts +1 -1
- package/dist/components/tags-input.js +22 -18
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +4 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle.js +4 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components.json +3 -3
- package/dist/custom-elements.json +85 -49
- package/dist/dev/types.d.ts +2 -3
- package/dist/dev.js +50 -48
- package/dist/llms.txt +125 -0
- package/dist/parts.d.ts +3 -1
- package/dist/reference.md +4575 -0
- package/dist/secret-value.d.ts +17 -0
- package/dist/types/elements.d.ts +2 -2
- package/dist/value-list.d.ts +14 -0
- package/dist/vscode.html-custom-data.json +33 -19
- package/dist/web-types.json +57 -37
- 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
|
|
29
|
-
private
|
|
30
|
-
/** The
|
|
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
|
-
|
|
33
|
-
|
|
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)
|
|
43
|
-
*
|
|
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
|
-
/**
|
|
55
|
+
/** The select was added, replaced or moved (PartsController): follow it, mark it, write the choice into it. */
|
|
51
56
|
private _wire;
|
|
52
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
|
|
115
|
+
private _afterMorph;
|
|
65
116
|
}
|
|
66
117
|
declare global {
|
|
67
118
|
interface HTMLElementTagNameMap {
|
|
@@ -1,29 +1,54 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { n } from "../chunks/parts-
|
|
3
|
+
import { n } from "../chunks/parts-CMQQop0D.js";
|
|
4
4
|
import { html as r, nothing as i } from "lit";
|
|
5
5
|
import { property as a } from "lit/decorators.js";
|
|
6
6
|
//#region src/components/select.ts
|
|
7
|
-
var o = class extends e {
|
|
7
|
+
var o = class t extends e {
|
|
8
8
|
constructor(...e) {
|
|
9
|
-
super(...e), this.size = "md", this.error = "", this.
|
|
9
|
+
super(...e), this.size = "md", this.error = "", this._choice = null, this._pending = !1, this._serverSelection = null, this._initial = null, this._parts = new n(this, {
|
|
10
10
|
tags: [
|
|
11
11
|
"select",
|
|
12
12
|
"option",
|
|
13
13
|
"optgroup"
|
|
14
14
|
],
|
|
15
15
|
onChange: () => this._wire()
|
|
16
|
-
}), this._invalid = null, this.
|
|
17
|
-
|
|
16
|
+
}), this._reflecting = !1, this._invalid = null, this._onPick = (e) => {
|
|
17
|
+
let t = this.select;
|
|
18
|
+
if (!t || e.target !== t) return;
|
|
19
|
+
this._pendingReset = null;
|
|
20
|
+
let n = this.value;
|
|
21
|
+
this._choice = g(t), this._pending = !1, this._changed(n);
|
|
22
|
+
}, this._onChange = (e) => {
|
|
23
|
+
e.target === this.select && (this._onPick(e), this.dispatchEvent(new CustomEvent("void-change", {
|
|
18
24
|
bubbles: !0,
|
|
19
25
|
composed: !0,
|
|
20
26
|
detail: { value: this.value }
|
|
21
27
|
})));
|
|
22
|
-
}, this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
}, this._observer = null, this._observed = null, this._onMutations = (e) => {
|
|
29
|
+
this._morphQueued || !this.isConnected || this._reconcile(u(e) ? "mutation" : "none", e);
|
|
30
|
+
}, this._form = null, this._onFormData = (e) => {
|
|
31
|
+
let t = this.select;
|
|
32
|
+
if (!t || t.form !== e.target) return;
|
|
33
|
+
let n = _(t);
|
|
34
|
+
if (this._flush(), this._apply(), !t.name) return;
|
|
35
|
+
let r = _(t);
|
|
36
|
+
if (c(n, r)) return;
|
|
37
|
+
let i = e.formData.getAll(t.name);
|
|
38
|
+
for (let e of n) {
|
|
39
|
+
let t = i.indexOf(e);
|
|
40
|
+
t >= 0 && i.splice(t, 1);
|
|
41
|
+
}
|
|
42
|
+
e.formData.delete(t.name);
|
|
43
|
+
for (let n of [...i, ...r]) e.formData.append(t.name, n);
|
|
44
|
+
}, this._pendingReset = null, this._onReset = (e) => {
|
|
45
|
+
this._pendingReset = e, setTimeout(() => {
|
|
46
|
+
this._finishReset(), this._apply();
|
|
26
47
|
});
|
|
48
|
+
}, this._morphQueued = !1, this._afterMorph = () => {
|
|
49
|
+
this._morphQueued = !1, this._observer?.takeRecords();
|
|
50
|
+
let e = this.select;
|
|
51
|
+
!this.isConnected || !e || (this._observe(e), this._watchForm(e.form), this._markInvalid(e), this._reconcile("morph"));
|
|
27
52
|
};
|
|
28
53
|
}
|
|
29
54
|
static {
|
|
@@ -33,32 +58,78 @@ var o = class extends e {
|
|
|
33
58
|
return this._parts.one("select");
|
|
34
59
|
}
|
|
35
60
|
get value() {
|
|
36
|
-
|
|
37
|
-
return this._wanted !== null && !(e && s(e, this._wanted)) ? this._wanted : e?.value ?? this._wanted ?? "";
|
|
61
|
+
return this._choice ? this._choice[0] ?? "" : this.select?.value ?? "";
|
|
38
62
|
}
|
|
39
63
|
set value(e) {
|
|
40
64
|
let t = this.value;
|
|
41
|
-
|
|
65
|
+
if (e == null) {
|
|
66
|
+
let e = this.select;
|
|
67
|
+
this._choice = e ? m(e) : null, this._pending = !1;
|
|
68
|
+
} else this._choice = [String(e)], this._pending = !0;
|
|
69
|
+
this._apply(), this.requestUpdate("value", t);
|
|
70
|
+
}
|
|
71
|
+
update(e) {
|
|
72
|
+
this._reflecting = !0;
|
|
73
|
+
try {
|
|
74
|
+
super.update(e);
|
|
75
|
+
} finally {
|
|
76
|
+
this._reflecting = !1;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
_changed(e) {
|
|
80
|
+
let t = this.value;
|
|
81
|
+
t === e ? this.getAttribute("value") !== t && this.requestUpdate("value", null) : this.requestUpdate("value", e);
|
|
82
|
+
}
|
|
83
|
+
attributeChangedCallback(e, t, n) {
|
|
84
|
+
e === "value" && !this._reflecting && (this._initial = n), super.attributeChangedCallback(e, t, n);
|
|
42
85
|
}
|
|
43
86
|
connectedCallback() {
|
|
44
|
-
super.connectedCallback(), this.addEventListener("change", this._onChange, !0);
|
|
87
|
+
super.connectedCallback(), this.addEventListener("input", this._onPick, !0), this.addEventListener("change", this._onChange, !0);
|
|
45
88
|
}
|
|
46
89
|
disconnectedCallback() {
|
|
47
|
-
super.disconnectedCallback(), this.removeEventListener("change", this._onChange, !0), this._watchForm(null);
|
|
90
|
+
super.disconnectedCallback(), this.removeEventListener("input", this._onPick, !0), this.removeEventListener("change", this._onChange, !0), this._observe(null), this._watchForm(null);
|
|
48
91
|
}
|
|
49
92
|
_wire() {
|
|
50
|
-
let e = this.select;
|
|
51
|
-
e && (this._markInvalid(e), this._serverSelection === null
|
|
93
|
+
let e = this.select, t = !!e && !!this._observed && e !== this._observed, n = this._observer?.takeRecords() ?? [];
|
|
94
|
+
this._observe(e), e && (this._markInvalid(e), this._watchForm(e.form), !this._morphQueued && (this._serverSelection === null ? this._serverSelection = f(e) : t && this._serverMarked(e), this._reconcile(t || u(n) ? "mutation" : "none", n)));
|
|
95
|
+
}
|
|
96
|
+
_reconcile(e, t = []) {
|
|
97
|
+
let n = this.select;
|
|
98
|
+
if (!n) return;
|
|
99
|
+
this._finishReset(), e === "mutation" && d(t) && this._serverMarked(n);
|
|
100
|
+
let r = this.value, i = this._choice;
|
|
101
|
+
if (i === null || !this._pending && !n.multiple && i.length === 0) n.options.length && (this._choice = g(n));
|
|
102
|
+
else if (e !== "morph" && !this._pending && i.every((e) => s(n, e))) {
|
|
103
|
+
let t = g(n), r = e === "mutation" && c(t, m(n));
|
|
104
|
+
t.length && !r && !c(t, i) && (this._choice = t);
|
|
105
|
+
}
|
|
106
|
+
this._apply(), this._changed(r);
|
|
107
|
+
}
|
|
108
|
+
_flush() {
|
|
109
|
+
if (this._morphQueued || !this.select) return;
|
|
110
|
+
let e = this._observer?.takeRecords() ?? [];
|
|
111
|
+
this._reconcile(u(e) ? "mutation" : "none", e);
|
|
52
112
|
}
|
|
53
113
|
_apply() {
|
|
54
|
-
let e = this.select;
|
|
55
|
-
!e ||
|
|
114
|
+
let e = this.select, t = this._choice;
|
|
115
|
+
if (!e || !t) return;
|
|
116
|
+
if (!t.every((t) => s(e, t))) {
|
|
117
|
+
if (this._pending) return;
|
|
118
|
+
let t = this.value;
|
|
119
|
+
this._choice = g(e), this._changed(t);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (this._pending = !1, !e.multiple) {
|
|
123
|
+
t.length && e.value !== t[0] && (e.value = t[0]);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
let n = new Set(t);
|
|
127
|
+
for (let t of Array.from(e.options)) t.selected !== n.has(t.value) && (t.selected = n.has(t.value));
|
|
56
128
|
}
|
|
57
129
|
updated(e) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
130
|
+
super.updated(e);
|
|
131
|
+
let t = this.select;
|
|
132
|
+
e.has("error") && t && this._markInvalid(t), this._flush();
|
|
62
133
|
}
|
|
63
134
|
_markInvalid(e) {
|
|
64
135
|
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);
|
|
@@ -66,33 +137,50 @@ var o = class extends e {
|
|
|
66
137
|
render() {
|
|
67
138
|
return this.error ? r`<span class="void-select-error">${this.error}</span>` : i;
|
|
68
139
|
}
|
|
140
|
+
_observe(e) {
|
|
141
|
+
e !== this._observed && (this._observer?.disconnect(), this._observed = e, e && (this._observer ??= new MutationObserver(this._onMutations), this._observer.observe(e, {
|
|
142
|
+
childList: !0,
|
|
143
|
+
subtree: !0,
|
|
144
|
+
attributes: !0,
|
|
145
|
+
characterData: !0
|
|
146
|
+
})));
|
|
147
|
+
}
|
|
148
|
+
_serverMarked(e) {
|
|
149
|
+
let t = f(e);
|
|
150
|
+
if (t === this._serverSelection || (this._serverSelection = t, this._pending)) return;
|
|
151
|
+
let n = JSON.parse(t);
|
|
152
|
+
if (!n.length) return;
|
|
153
|
+
let r = this.value;
|
|
154
|
+
this._choice = e.multiple ? n : [n[n.length - 1]], this._changed(r);
|
|
155
|
+
}
|
|
69
156
|
_watchForm(e) {
|
|
70
|
-
e !== this._form && (this._form?.removeEventListener("reset", this._onReset), this._form = e, e?.addEventListener("reset", this._onReset));
|
|
157
|
+
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
158
|
}
|
|
72
|
-
|
|
159
|
+
_finishReset() {
|
|
160
|
+
let e = this._pendingReset;
|
|
161
|
+
if (!e) return;
|
|
162
|
+
this._pendingReset = null;
|
|
73
163
|
let t = this.select;
|
|
74
|
-
if (e
|
|
75
|
-
|
|
76
|
-
|
|
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);
|
|
164
|
+
if (e.defaultPrevented || !t || !this.isConnected) return;
|
|
165
|
+
let n = this.value;
|
|
166
|
+
this._initial === null ? (this._choice = m(t), this._pending = !1) : (this._choice = [this._initial], this._pending = !0), this._apply(), this._changed(n);
|
|
81
167
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
168
|
+
voidBeforeMorph(e) {
|
|
169
|
+
if (e && e !== this) {
|
|
170
|
+
this._flush();
|
|
171
|
+
let n = e instanceof t ? e._serverSelection : null, r = n ?? p(e), i = n === null && e instanceof t && !!this.select && r === f(this.select);
|
|
172
|
+
if (r !== null && !i) {
|
|
173
|
+
let e = this._serverSelection !== null && r !== this._serverSelection;
|
|
174
|
+
this._serverSelection = r;
|
|
175
|
+
let t = JSON.parse(r);
|
|
176
|
+
if (e && t.length && !this._pending) {
|
|
177
|
+
let e = this.value;
|
|
178
|
+
this._choice = this.select?.multiple ? t : [t[t.length - 1]], this._changed(e);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
this._morphQueued || (this._morphQueued = !0, queueMicrotask(this._afterMorph));
|
|
92
182
|
}
|
|
93
|
-
|
|
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));
|
|
183
|
+
return super.voidBeforeMorph(e);
|
|
96
184
|
}
|
|
97
185
|
};
|
|
98
186
|
t([a({
|
|
@@ -101,13 +189,50 @@ t([a({
|
|
|
101
189
|
})], o.prototype, "size", void 0), t([a({
|
|
102
190
|
type: String,
|
|
103
191
|
reflect: !0
|
|
104
|
-
})], o.prototype, "error", void 0), t([a({
|
|
192
|
+
})], o.prototype, "error", void 0), t([a({
|
|
193
|
+
type: String,
|
|
194
|
+
reflect: !0
|
|
195
|
+
})], o.prototype, "value", null);
|
|
105
196
|
function s(e, t) {
|
|
106
197
|
for (let n of Array.from(e.options)) if (n.value === t) return !0;
|
|
107
198
|
return !1;
|
|
108
199
|
}
|
|
109
|
-
function c(e) {
|
|
110
|
-
return
|
|
200
|
+
function c(e, t) {
|
|
201
|
+
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
202
|
+
}
|
|
203
|
+
function l(e) {
|
|
204
|
+
return e.nodeName === "OPTION" || e.nodeName === "OPTGROUP";
|
|
205
|
+
}
|
|
206
|
+
function u(e) {
|
|
207
|
+
return e.some((e) => e.type === "attributes" ? e.attributeName === "selected" || e.attributeName === "multiple" : !0);
|
|
208
|
+
}
|
|
209
|
+
function d(e) {
|
|
210
|
+
let t = !1, n = !1;
|
|
211
|
+
for (let r of e) r.type === "childList" && (t ||= Array.from(r.removedNodes).some(l), n ||= Array.from(r.addedNodes).some(l));
|
|
212
|
+
return t && n;
|
|
213
|
+
}
|
|
214
|
+
function f(e) {
|
|
215
|
+
return JSON.stringify(Array.from(e.querySelectorAll("option[selected]"), (e) => e.value));
|
|
216
|
+
}
|
|
217
|
+
function p(e) {
|
|
218
|
+
let t = e.querySelector("select");
|
|
219
|
+
return t ? f(t) : null;
|
|
220
|
+
}
|
|
221
|
+
function m(e) {
|
|
222
|
+
let t = JSON.parse(f(e));
|
|
223
|
+
if (e.multiple) return t;
|
|
224
|
+
if (t.length) return [t[t.length - 1]];
|
|
225
|
+
let n = Array.from(e.options).find((e) => !e.disabled);
|
|
226
|
+
return n ? [n.value] : [];
|
|
227
|
+
}
|
|
228
|
+
function h(e) {
|
|
229
|
+
return Array.from(e.options).filter((e) => e.selected);
|
|
230
|
+
}
|
|
231
|
+
function g(e) {
|
|
232
|
+
return h(e).map((e) => e.value);
|
|
233
|
+
}
|
|
234
|
+
function _(e) {
|
|
235
|
+
return !e.name || e.matches(":disabled") ? [] : h(e).filter((e) => !e.matches(":disabled")).map((e) => e.value);
|
|
111
236
|
}
|
|
112
237
|
customElements.get("void-select") || customElements.define("void-select", o);
|
|
113
238
|
//#endregion
|
|
@@ -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.
|
|
13
|
-
*
|
|
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. */
|
|
@@ -62,7 +62,10 @@ var o = class extends n(e) {
|
|
|
62
62
|
`;
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
t([a({
|
|
65
|
+
t([a({
|
|
66
|
+
type: Number,
|
|
67
|
+
reflect: !0
|
|
68
|
+
})], 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({
|
|
66
69
|
type: Boolean,
|
|
67
70
|
reflect: !0
|
|
68
71
|
})], o.prototype, "disabled", void 0), t([a({
|
|
@@ -6,7 +6,7 @@ declare const VoidSwitch_base: (new (...args: any[]) => import('../form-control.
|
|
|
6
6
|
export declare class VoidSwitch extends VoidSwitch_base {
|
|
7
7
|
/** Enter and Space fire a real `click`, as on a native button. */
|
|
8
8
|
protected readonly _activation: KeyboardActivation;
|
|
9
|
-
/** Whether the switch is on.
|
|
9
|
+
/** Whether the switch is on. Reflected to the attribute as it changes; the form's reset target stays the state it started with. */
|
|
10
10
|
checked: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Stop the switch reacting and exclude it from the form submission. Also disabled by an enclosing
|
package/dist/components/tabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { n } from "../chunks/parts-
|
|
3
|
+
import { n } from "../chunks/parts-CMQQop0D.js";
|
|
4
4
|
import { i as r, n as i } from "../chunks/keyboard-MQpfTX5I.js";
|
|
5
5
|
import { property as a } from "lit/decorators.js";
|
|
6
6
|
//#region src/components/tabs.ts
|
|
@@ -12,7 +12,7 @@ export declare class VoidTagsInput extends VoidTagsInput_base {
|
|
|
12
12
|
static labelTarget: string;
|
|
13
13
|
/**
|
|
14
14
|
* The tags, as an array of strings or `{ text, color }` objects. Set it as a property from script, or
|
|
15
|
-
* as a JSON array in the attribute.
|
|
15
|
+
* as a JSON array in the attribute, which follows the tags as they change.
|
|
16
16
|
*/
|
|
17
17
|
value: TagValue[];
|
|
18
18
|
/** Stop the field accepting input and removing tags, and exclude the values from the form submission. */
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
3
|
import { t as n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { t as r } from "../chunks/value-list-CH6GjYXM.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/tags-input.ts
|
|
7
|
-
var
|
|
8
|
+
var s = class extends n(e) {
|
|
8
9
|
constructor(...e) {
|
|
9
10
|
super(...e), this.value = [], this.disabled = !1, this.readonly = !1, this.max = Infinity, this.placeholder = "Add tag...", this.size = "md", this.color = "default", this.variant = "outline", this.allowDuplicates = !1;
|
|
10
11
|
}
|
|
@@ -26,25 +27,25 @@ var o = class extends n(e) {
|
|
|
26
27
|
}
|
|
27
28
|
render() {
|
|
28
29
|
let e = this.value.length >= this.max;
|
|
29
|
-
return
|
|
30
|
+
return i`
|
|
30
31
|
<div class="void-tags-input" @click=${this._focusInput} @keydown=${this._onContainerKeydown}>
|
|
31
32
|
${this.value.map((e, t) => {
|
|
32
33
|
let n = this._tagText(e);
|
|
33
|
-
return
|
|
34
|
-
<span class="void-tags-input-tag" data-color=${this._tagColor(e) ||
|
|
34
|
+
return i`
|
|
35
|
+
<span class="void-tags-input-tag" data-color=${this._tagColor(e) || a}>
|
|
35
36
|
<span class="void-tags-input-tag-text">${n}</span>
|
|
36
|
-
${!this.disabled && !this.readonly ?
|
|
37
|
+
${!this.disabled && !this.readonly ? i`<button
|
|
37
38
|
type="button"
|
|
38
39
|
class="void-tags-input-tag-remove"
|
|
39
40
|
aria-label="Remove ${n}"
|
|
40
41
|
@click=${(e) => {
|
|
41
42
|
e.stopPropagation(), this._removeTag(t);
|
|
42
43
|
}}
|
|
43
|
-
>×</button>` :
|
|
44
|
+
>×</button>` : a}
|
|
44
45
|
</span>
|
|
45
46
|
`;
|
|
46
47
|
})}
|
|
47
|
-
${!e && !this.readonly ?
|
|
48
|
+
${!e && !this.readonly ? i`<input
|
|
48
49
|
class="void-tags-input-field"
|
|
49
50
|
type="text"
|
|
50
51
|
placeholder=${this.value.length === 0 ? this.placeholder : ""}
|
|
@@ -52,7 +53,7 @@ var o = class extends n(e) {
|
|
|
52
53
|
@keydown=${this._onKeydown}
|
|
53
54
|
@input=${this._onFieldInput}
|
|
54
55
|
@paste=${this._onPaste}
|
|
55
|
-
/>` :
|
|
56
|
+
/>` : a}
|
|
56
57
|
</div>
|
|
57
58
|
`;
|
|
58
59
|
}
|
|
@@ -96,24 +97,27 @@ var o = class extends n(e) {
|
|
|
96
97
|
}));
|
|
97
98
|
}
|
|
98
99
|
};
|
|
99
|
-
t([
|
|
100
|
+
t([o({
|
|
101
|
+
converter: r,
|
|
102
|
+
reflect: !0
|
|
103
|
+
})], s.prototype, "value", void 0), t([o({
|
|
100
104
|
type: Boolean,
|
|
101
105
|
reflect: !0
|
|
102
|
-
})],
|
|
106
|
+
})], s.prototype, "disabled", void 0), t([o({
|
|
103
107
|
type: Boolean,
|
|
104
108
|
reflect: !0
|
|
105
|
-
})],
|
|
109
|
+
})], s.prototype, "readonly", void 0), t([o({ type: Number })], s.prototype, "max", void 0), t([o({ type: String })], s.prototype, "placeholder", void 0), t([o({
|
|
106
110
|
type: String,
|
|
107
111
|
reflect: !0
|
|
108
|
-
})],
|
|
112
|
+
})], s.prototype, "size", void 0), t([o({
|
|
109
113
|
type: String,
|
|
110
114
|
reflect: !0
|
|
111
|
-
})],
|
|
115
|
+
})], s.prototype, "color", void 0), t([o({
|
|
112
116
|
type: String,
|
|
113
117
|
reflect: !0
|
|
114
|
-
})],
|
|
118
|
+
})], s.prototype, "variant", void 0), t([o({
|
|
115
119
|
type: Boolean,
|
|
116
120
|
attribute: "allow-duplicates"
|
|
117
|
-
})],
|
|
121
|
+
})], s.prototype, "allowDuplicates", void 0), customElements.get("void-tags-input") || customElements.define("void-tags-input", s);
|
|
118
122
|
//#endregion
|
|
119
|
-
export {
|
|
123
|
+
export { s as VoidTagsInput };
|
|
@@ -11,8 +11,8 @@ export declare class VoidTextarea extends VoidTextarea_base {
|
|
|
11
11
|
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
12
12
|
static editState: string[];
|
|
13
13
|
/**
|
|
14
|
-
* The text in the box.
|
|
15
|
-
*
|
|
14
|
+
* The text in the box. Reflected to the `value` attribute as it changes, and setting the attribute
|
|
15
|
+
* sets it; the form's reset target stays the value the box started with.
|
|
16
16
|
*/
|
|
17
17
|
value: string;
|
|
18
18
|
/**
|
|
@@ -70,7 +70,10 @@ var s = class extends n(e) {
|
|
|
70
70
|
}));
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
t([a({
|
|
73
|
+
t([a({
|
|
74
|
+
type: String,
|
|
75
|
+
reflect: !0
|
|
76
|
+
})], s.prototype, "value", void 0), t([a({
|
|
74
77
|
type: String,
|
|
75
78
|
reflect: !0
|
|
76
79
|
})], s.prototype, "placeholder", void 0), t([a({
|
package/dist/components/toast.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { n } from "../chunks/parts-
|
|
3
|
+
import { n } from "../chunks/parts-CMQQop0D.js";
|
|
4
4
|
import { n as r, t as i } from "../chunks/dismiss-Drsy_dE5.js";
|
|
5
5
|
import { property as a } from "lit/decorators.js";
|
|
6
6
|
//#region src/components/toast.ts
|
|
@@ -5,8 +5,8 @@ declare const VoidToggleGroup_base: (new (...args: any[]) => import('../form-con
|
|
|
5
5
|
/** Multi-button toggle set for text editor toolbars and filter chips where one or many options can be active. */
|
|
6
6
|
export declare class VoidToggleGroup extends VoidToggleGroup_base {
|
|
7
7
|
/**
|
|
8
|
-
* Comma-separated `value`s of the pressed toggles (`bold,italic`), or the single pressed value.
|
|
9
|
-
* attribute
|
|
8
|
+
* Comma-separated `value`s of the pressed toggles (`bold,italic`), or the single pressed value. Reflected to the
|
|
9
|
+
* attribute as the pressed toggles change; the form's reset target stays the state it started with. Without it (or with an empty one) the
|
|
10
10
|
* toggles that carry `pressed` in the markup set the initial value (the first of them unless
|
|
11
11
|
* `multiple`); a non-empty `value` wins over their `pressed`.
|
|
12
12
|
*/
|
|
@@ -37,7 +37,10 @@ var o = class extends e {
|
|
|
37
37
|
t([a({
|
|
38
38
|
type: Boolean,
|
|
39
39
|
reflect: !0
|
|
40
|
-
})], o.prototype, "pressed", void 0), t([a({
|
|
40
|
+
})], o.prototype, "pressed", void 0), t([a({
|
|
41
|
+
type: String,
|
|
42
|
+
reflect: !0
|
|
43
|
+
})], o.prototype, "value", void 0), t([a({
|
|
41
44
|
type: Boolean,
|
|
42
45
|
reflect: !0
|
|
43
46
|
})], o.prototype, "disabled", void 0), t([a({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { i as n, n as r } from "../chunks/parts-
|
|
3
|
+
import { i as n, n as r } from "../chunks/parts-CMQQop0D.js";
|
|
4
4
|
import { t as i } from "../chunks/overlay-BywGMcDW.js";
|
|
5
5
|
import { property as a } from "lit/decorators.js";
|
|
6
6
|
//#region src/components/tooltip.ts
|
package/dist/components.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Generated from custom-elements.json by packages/ui/cem/generate.js. Do not edit.",
|
|
3
3
|
"package": "@voidable/ui",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"componentCount": 66,
|
|
6
6
|
"tagCount": 78,
|
|
7
7
|
"eventNames": [
|
|
@@ -912,7 +912,7 @@
|
|
|
912
912
|
"tag": "void-checkbox-group",
|
|
913
913
|
"className": "VoidCheckboxGroup",
|
|
914
914
|
"module": "dist/components/checkbox-group.js",
|
|
915
|
-
"attributes":
|
|
915
|
+
"attributes": 7,
|
|
916
916
|
"properties": 6,
|
|
917
917
|
"events": [
|
|
918
918
|
"void-change"
|
|
@@ -1185,7 +1185,7 @@
|
|
|
1185
1185
|
"tag": "void-multiselect",
|
|
1186
1186
|
"className": "VoidMultiselect",
|
|
1187
1187
|
"module": "dist/components/multiselect.js",
|
|
1188
|
-
"attributes":
|
|
1188
|
+
"attributes": 8,
|
|
1189
1189
|
"properties": 8,
|
|
1190
1190
|
"events": [
|
|
1191
1191
|
"void-change",
|