@greypan/web-ui 11.0.0 → 11.2.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.CN.md +105 -41
- package/README.md +69 -0
- package/dist/assets/overlay-motion.js +1 -1
- package/dist/assets/overlay-motion.js.map +1 -1
- package/dist/assets/selection-control.js +1 -1
- package/dist/assets/selection-control.js.map +1 -1
- package/dist/classes/glass.js +6 -0
- package/dist/classes/glass.js.map +1 -0
- package/dist/classes/glow.js +6 -0
- package/dist/classes/glow.js.map +1 -0
- package/dist/classes/style.css +1 -0
- package/dist/components/autocomplete/index.d.ts +7 -0
- package/dist/components/autocomplete/index.js +33 -13
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/autocomplete/style.js +1 -1
- package/dist/components/autocomplete/style.js.map +1 -1
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/avatar/style.js +1 -1
- package/dist/components/avatar/style.js.map +1 -1
- package/dist/components/back-top/index.d.ts +4 -0
- package/dist/components/back-top/index.js +60 -22
- package/dist/components/back-top/index.js.map +1 -1
- package/dist/components/back-top/style.js +1 -1
- package/dist/components/back-top/style.js.map +1 -1
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/badge/index.js +29 -14
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/badge/style.js +1 -1
- package/dist/components/badge/style.js.map +1 -1
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/index.js +27 -18
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/style.js +1 -1
- package/dist/components/button/style.js.map +1 -1
- package/dist/components/button-group/index.d.ts +3 -0
- package/dist/components/button-group/index.js +15 -2
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/button-group/style.js +1 -1
- package/dist/components/button-group/style.js.map +1 -1
- package/dist/components/checkbox/index.js +6 -6
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox/style.js +1 -1
- package/dist/components/checkbox/style.js.map +1 -1
- package/dist/components/collapse/index.d.ts +15 -7
- package/dist/components/collapse/index.js +44 -26
- package/dist/components/collapse/index.js.map +1 -1
- package/dist/components/collapse/style.js +1 -1
- package/dist/components/collapse/style.js.map +1 -1
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/index.js +5 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/style.js +1 -1
- package/dist/components/dialog/style.js.map +1 -1
- package/dist/components/drawer/index.js +1 -1
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/dropdown/index.d.ts +16 -0
- package/dist/components/dropdown/index.js +147 -18
- package/dist/components/dropdown/index.js.map +1 -1
- package/dist/components/dropdown-item/style.js +1 -1
- package/dist/components/dropdown-item/style.js.map +1 -1
- package/dist/components/editable-text/index.js +7 -3
- package/dist/components/editable-text/index.js.map +1 -1
- package/dist/components/editable-text/style.js +1 -1
- package/dist/components/editable-text/style.js.map +1 -1
- package/dist/components/empty/index.d.ts +10 -22
- package/dist/components/empty/index.js +19 -35
- package/dist/components/empty/index.js.map +1 -1
- package/dist/components/empty/style.js +1 -1
- package/dist/components/empty/style.js.map +1 -1
- package/dist/components/image-preview/index.js +2 -2
- package/dist/components/image-preview/index.js.map +1 -1
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/index.js +5 -2
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/style.js +1 -1
- package/dist/components/input/style.js.map +1 -1
- package/dist/components/input-number/index.d.ts +31 -1
- package/dist/components/input-number/index.js +281 -22
- package/dist/components/input-number/index.js.map +1 -1
- package/dist/components/input-number/style.js +1 -1
- package/dist/components/input-number/style.js.map +1 -1
- package/dist/components/layout/index.js +44 -39
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/style.js +1 -1
- package/dist/components/layout/style.js.map +1 -1
- package/dist/components/middle-ellipsis/index.d.ts +8 -1
- package/dist/components/middle-ellipsis/index.js +68 -10
- package/dist/components/middle-ellipsis/index.js.map +1 -1
- package/dist/components/option/style.js +1 -1
- package/dist/components/option/style.js.map +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/style.js +1 -1
- package/dist/components/popover/style.js.map +1 -1
- package/dist/components/radio/index.d.ts +5 -0
- package/dist/components/radio/index.js +33 -23
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/interaction.d.ts +4 -0
- package/dist/components/radio/interaction.js +17 -0
- package/dist/components/radio/interaction.js.map +1 -0
- package/dist/components/radio/style.js +1 -1
- package/dist/components/radio/style.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +22 -0
- package/dist/components/radio-group/index.js +219 -28
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/segmented/index.d.ts +2 -0
- package/dist/components/segmented/index.js +74 -18
- package/dist/components/segmented/index.js.map +1 -1
- package/dist/components/segmented/style.js +1 -1
- package/dist/components/segmented/style.js.map +1 -1
- package/dist/components/segmented-trigger/index.js +3 -2
- package/dist/components/segmented-trigger/index.js.map +1 -1
- package/dist/components/segmented-trigger/style.js +1 -1
- package/dist/components/segmented-trigger/style.js.map +1 -1
- package/dist/components/select/index.d.ts +8 -0
- package/dist/components/select/index.js +76 -25
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/select/style.js +1 -1
- package/dist/components/select/style.js.map +1 -1
- package/dist/components/slider/index.d.ts +15 -0
- package/dist/components/slider/index.js +175 -39
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/style.js +1 -1
- package/dist/components/slider/style.js.map +1 -1
- package/dist/components/spinner/index.d.ts +15 -0
- package/dist/components/spinner/index.js +79 -22
- package/dist/components/spinner/index.js.map +1 -1
- package/dist/components/spinner/style.js +1 -1
- package/dist/components/spinner/style.js.map +1 -1
- package/dist/components/svg-draw-lines/index.js +48 -12
- package/dist/components/svg-draw-lines/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +11 -3
- package/dist/components/switch/index.js +57 -53
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/style.js +1 -1
- package/dist/components/switch/style.js.map +1 -1
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/style.js +1 -1
- package/dist/components/textarea/style.js.map +1 -1
- package/dist/components/theme/index.d.ts +1 -0
- package/dist/components/theme/index.js +26 -15
- package/dist/components/theme/index.js.map +1 -1
- package/dist/components/theme/style.js +1 -1
- package/dist/components/theme/style.js.map +1 -1
- package/dist/components/toast/style.js +1 -1
- package/dist/components/toast/style.js.map +1 -1
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +10 -5
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/icons/generated/andrsrxn-inbox.d.ts +6 -0
- package/dist/icons/generated/andrsrxn-inbox.js +10 -0
- package/dist/icons/generated/andrsrxn-inbox.js.map +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +75 -74
- package/dist/shared/focus/pointer-focus.js +12 -10
- package/dist/shared/focus/pointer-focus.js.map +1 -1
- package/dist/shared/gesture/drag-gesture.js +4 -4
- package/dist/shared/gesture/drag-gesture.js.map +1 -1
- package/dist/shared/group-management/index.js +43 -18
- package/dist/shared/group-management/index.js.map +1 -1
- package/dist/shared/menu-portal/menu-portal.js +1 -1
- package/dist/shared/menu-portal/menu-portal.js.map +1 -1
- package/dist/shared/overlay/overlay-root.js +1 -1
- package/dist/shared/overlay/overlay-root.js.map +1 -1
- package/dist/shared/overlay/overlay.js +7 -1
- package/dist/shared/overlay/overlay.js.map +1 -1
- package/package.json +5 -1
- package/dist/assets/glass.js +0 -6
- package/dist/assets/glass.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
|
|
2
2
|
import "../icon/index.js";
|
|
3
|
-
import t from "../../
|
|
3
|
+
import t from "../../classes/glass.js";
|
|
4
4
|
import n from "../../icons/generated/lucide-plus.js";
|
|
5
5
|
import r from "../../icons/generated/lucide-minus.js";
|
|
6
6
|
import { FormAssociated as i, FormAssociationController as a, defineFormAssociation as o, forwardInputValidity as s } from "../../shared/form-association/index.js";
|
|
@@ -9,10 +9,86 @@ import { createFieldId as l } from "../../shared/form-association/field-id.js";
|
|
|
9
9
|
import u from "./style.js";
|
|
10
10
|
import { LitElement as d, html as f, unsafeCSS as p } from "lit";
|
|
11
11
|
import { customElement as m, property as h, state as g } from "lit/decorators.js";
|
|
12
|
+
import { ifDefined as _ } from "lit/directives/if-defined.js";
|
|
12
13
|
//#region src/components/input-number/index.ts
|
|
13
|
-
var
|
|
14
|
+
var v = (e) => {
|
|
15
|
+
let [t, n = "0"] = e.toString().toLowerCase().split("e");
|
|
16
|
+
return Math.max(0, (t.split(".")[1]?.length ?? 0) - Number(n));
|
|
17
|
+
}, y = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
function b(e) {
|
|
19
|
+
return e instanceof Element ? [e, ...e.querySelectorAll("[id], label[for]")].flatMap((e) => e instanceof HTMLLabelElement ? [e.id, e.htmlFor] : [e.id]).filter(Boolean) : [];
|
|
20
|
+
}
|
|
21
|
+
function x(e) {
|
|
22
|
+
return e instanceof HTMLStyleElement || e instanceof HTMLLinkElement && e.relList.contains("stylesheet");
|
|
23
|
+
}
|
|
24
|
+
function S(e) {
|
|
25
|
+
return e instanceof Element && x(e) || e instanceof Element && e.querySelector("style, link[rel~=\"stylesheet\"]") !== null;
|
|
26
|
+
}
|
|
27
|
+
function C(e, t, n, r) {
|
|
28
|
+
let i = y.get(e);
|
|
29
|
+
if (!i) {
|
|
30
|
+
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), r = () => t.forEach((e) => e.onStylesheetChange()), a = (e) => {
|
|
31
|
+
e.target instanceof HTMLLinkElement && e.target.relList.contains("stylesheet") && r();
|
|
32
|
+
}, o = new MutationObserver((e) => {
|
|
33
|
+
let t = /* @__PURE__ */ new Set(), i = !1, a = (e) => {
|
|
34
|
+
e && n.get(e)?.forEach((e) => t.add(e));
|
|
35
|
+
};
|
|
36
|
+
for (let t of e) if (t.type === "attributes") {
|
|
37
|
+
let e = t.target;
|
|
38
|
+
t.attributeName === "id" ? (a(t.oldValue), a(e.id)) : t.attributeName === "for" && e instanceof HTMLLabelElement ? (a(t.oldValue), a(e.htmlFor)) : ["disabled", "media"].includes(t.attributeName ?? "") && x(e) && (i = !0);
|
|
39
|
+
} else if (t.type === "childList") {
|
|
40
|
+
(t.target instanceof HTMLStyleElement || t.target instanceof HTMLLinkElement) && (i = !0);
|
|
41
|
+
for (let e of [...t.addedNodes, ...t.removedNodes]) {
|
|
42
|
+
S(e) && (i = !0);
|
|
43
|
+
for (let t of b(e)) a(t);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
i && r(), t.forEach((e) => e.onReferenceChange());
|
|
47
|
+
});
|
|
48
|
+
i = {
|
|
49
|
+
observer: o,
|
|
50
|
+
registrations: t,
|
|
51
|
+
registrationsById: n,
|
|
52
|
+
onStylesheetLoad: a,
|
|
53
|
+
notifyStylesheetChange: r
|
|
54
|
+
}, y.set(e, i), o.observe(e, {
|
|
55
|
+
subtree: !0,
|
|
56
|
+
childList: !0,
|
|
57
|
+
attributes: !0,
|
|
58
|
+
attributeFilter: [
|
|
59
|
+
"id",
|
|
60
|
+
"for",
|
|
61
|
+
"disabled",
|
|
62
|
+
"media"
|
|
63
|
+
],
|
|
64
|
+
attributeOldValue: !0
|
|
65
|
+
}), e.addEventListener("load", a, !0);
|
|
66
|
+
}
|
|
67
|
+
let a = {
|
|
68
|
+
ids: new Set(t),
|
|
69
|
+
onReferenceChange: n,
|
|
70
|
+
onStylesheetChange: r
|
|
71
|
+
};
|
|
72
|
+
i.registrations.add(a);
|
|
73
|
+
for (let e of a.ids) {
|
|
74
|
+
let t = i.registrationsById.get(e) ?? /* @__PURE__ */ new Set();
|
|
75
|
+
t.add(a), i.registrationsById.set(e, t);
|
|
76
|
+
}
|
|
77
|
+
return () => {
|
|
78
|
+
if (i?.registrations.delete(a)) {
|
|
79
|
+
for (let e of a.ids) {
|
|
80
|
+
let t = i.registrationsById.get(e);
|
|
81
|
+
t?.delete(a), t?.size === 0 && i.registrationsById.delete(e);
|
|
82
|
+
}
|
|
83
|
+
i.registrations.size === 0 && (i.observer.disconnect(), e.removeEventListener("load", i.onStylesheetLoad, !0), y.delete(e));
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
var w = class extends i(d) {
|
|
14
88
|
constructor(...e) {
|
|
15
|
-
super(...e), this.placeholder = "", this.name = "", this.disabled = !1, this.readonly = !1, this.required = !1, this._value = 0, this._draft = null, this._min = 0, this._max = Infinity, this._step = 1, this._focused = !1, this._precision = 0, this._fieldId = l("web-ui-input-number"), this.
|
|
89
|
+
super(...e), this.placeholder = "", this.name = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.ariaLabel = null, this._value = 0, this._draft = null, this._min = 0, this._max = Infinity, this._step = 1, this._focused = !1, this._precision = 0, this._precisionWasSet = !1, this._fieldId = l("web-ui-input-number"), this._labelledbyObserver = null, this._releaseLabelledbyReferences = null, this._labelledbyAncestorObserver = null, this._observedLabelledbyRoot = null, this._observedLabelledbyReferenceIds = "", this._observedLabelledbyTargets = [], this._observedLabelledbyMutationTargets = [], this._observedLabelledbyValueControls = [], this._observedLabelledbyAncestors = [], this._observedLabelledbyText = "", this._observedLabelledbyWindow = null, this._onLabelledbyViewportChange = () => this.requestUpdate(), this._onLabelledbyValueChange = () => {
|
|
90
|
+
this._getLabelledbyText() !== this._observedLabelledbyText && this.requestUpdate();
|
|
91
|
+
}, this._formAssociation = o({
|
|
16
92
|
host: this,
|
|
17
93
|
getState: () => this.value,
|
|
18
94
|
setState: (e) => {
|
|
@@ -35,8 +111,166 @@ var _ = class extends i(d) {
|
|
|
35
111
|
return this._precision;
|
|
36
112
|
}
|
|
37
113
|
set precision(e) {
|
|
38
|
-
let t = this._precision;
|
|
39
|
-
this._precision = e, this.
|
|
114
|
+
let t = this._precision, n = this._precisionWasSet;
|
|
115
|
+
this._precision = e ?? 0, this._precisionWasSet = e !== null, e === null ? this.hasAttribute("precision") && this.removeAttribute("precision") : this.getAttribute("precision") !== String(e) && this.setAttribute("precision", String(e)), (t !== this._precision || n !== this._precisionWasSet) && this.requestUpdate();
|
|
116
|
+
}
|
|
117
|
+
get _supportsLabelledbyElements() {
|
|
118
|
+
return typeof Element < "u" && "ariaLabelledByElements" in Element.prototype;
|
|
119
|
+
}
|
|
120
|
+
_getLabelledbyIds(e = this.ariaLabelledby) {
|
|
121
|
+
let t = e?.trim();
|
|
122
|
+
return t ? t.split(/\s+/).filter(Boolean) : [];
|
|
123
|
+
}
|
|
124
|
+
_getLabelledbyTargets(e = null, t = this.ariaLabelledby) {
|
|
125
|
+
let n = e ?? this.getRootNode();
|
|
126
|
+
return n instanceof Document || n instanceof ShadowRoot ? this._getLabelledbyIds(t).map((e) => {
|
|
127
|
+
let t = typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e;
|
|
128
|
+
return n.querySelector(`#${t}`);
|
|
129
|
+
}).filter((e) => e !== null) : [];
|
|
130
|
+
}
|
|
131
|
+
_getLabelledbyValueControls(e) {
|
|
132
|
+
let t = /* @__PURE__ */ new Set();
|
|
133
|
+
for (let n of e) n.matches("input, textarea, select") && t.add(n), n.querySelectorAll("input, textarea, select").forEach((e) => t.add(e));
|
|
134
|
+
return [...t];
|
|
135
|
+
}
|
|
136
|
+
_getObservedLabelledbyReferences(e) {
|
|
137
|
+
return {
|
|
138
|
+
ids: new Set(this._getLabelledbyIds()),
|
|
139
|
+
targets: e ? this._getLabelledbyTargets(e) : []
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
_isLabelledbyElementHidden(e) {
|
|
143
|
+
let t = getComputedStyle(e).visibility;
|
|
144
|
+
if (t === "hidden" || t === "collapse") return !0;
|
|
145
|
+
let n = e;
|
|
146
|
+
for (; n;) {
|
|
147
|
+
let e = getComputedStyle(n);
|
|
148
|
+
if (n.getAttribute("aria-hidden") === "true" || n.hasAttribute("hidden") || e.display === "none") return !0;
|
|
149
|
+
if (n.parentElement) n = n.parentElement;
|
|
150
|
+
else {
|
|
151
|
+
let e = n.getRootNode();
|
|
152
|
+
n = e instanceof ShadowRoot ? e.host : null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return !1;
|
|
156
|
+
}
|
|
157
|
+
_getLabelledbyElementText(e, t = !1, n = !1, r = /* @__PURE__ */ new Set()) {
|
|
158
|
+
if (r.has(e) || !t && this._isLabelledbyElementHidden(e)) return "";
|
|
159
|
+
let i = new Set(r);
|
|
160
|
+
i.add(e);
|
|
161
|
+
let a = e.getAttribute("aria-label")?.trim();
|
|
162
|
+
if (a) return a;
|
|
163
|
+
if (e instanceof HTMLImageElement || e instanceof HTMLAreaElement || e instanceof HTMLInputElement && e.type === "image") {
|
|
164
|
+
let t = e.getAttribute("alt");
|
|
165
|
+
if (t !== null) return t.trim();
|
|
166
|
+
}
|
|
167
|
+
if (e instanceof HTMLInputElement && [
|
|
168
|
+
"button",
|
|
169
|
+
"submit",
|
|
170
|
+
"reset"
|
|
171
|
+
].includes(e.type)) {
|
|
172
|
+
let t = e.value.trim();
|
|
173
|
+
if (t) return t;
|
|
174
|
+
}
|
|
175
|
+
if (e instanceof HTMLInputElement && ["checkbox", "radio"].includes(e.type)) {
|
|
176
|
+
if (n) return e.checked ? "on" : "off";
|
|
177
|
+
let r = Array.from(e.labels ?? []);
|
|
178
|
+
return r.length > 0 ? r.map((e) => this._getLabelledbyElementText(e, t, !1, i)).filter(Boolean).join(" ") : e.getAttribute("title")?.trim() ?? "";
|
|
179
|
+
}
|
|
180
|
+
if (e instanceof HTMLInputElement && e.type !== "hidden") {
|
|
181
|
+
if (n) {
|
|
182
|
+
let t = e.value.trim();
|
|
183
|
+
if (t) return t;
|
|
184
|
+
}
|
|
185
|
+
let r = Array.from(e.labels ?? []);
|
|
186
|
+
if (r.length > 0) return r.map((e) => this._getLabelledbyElementText(e, t, !1, i)).filter(Boolean).join(" ");
|
|
187
|
+
}
|
|
188
|
+
if (e instanceof HTMLTextAreaElement) {
|
|
189
|
+
if (n) {
|
|
190
|
+
let t = e.value.trim();
|
|
191
|
+
if (t) return t;
|
|
192
|
+
}
|
|
193
|
+
let r = Array.from(e.labels ?? []);
|
|
194
|
+
if (r.length > 0) return r.map((e) => this._getLabelledbyElementText(e, t, !1, i)).filter(Boolean).join(" ");
|
|
195
|
+
}
|
|
196
|
+
if (e instanceof HTMLSelectElement) {
|
|
197
|
+
if (!n) {
|
|
198
|
+
let n = Array.from(e.labels ?? []);
|
|
199
|
+
return n.length > 0 ? n.map((e) => this._getLabelledbyElementText(e, t, !1, i)).filter(Boolean).join(" ") : e.getAttribute("title")?.trim() ?? "";
|
|
200
|
+
}
|
|
201
|
+
let r = Array.from(e.selectedOptions).map((e) => e.label.trim() || e.textContent?.trim() || "").filter(Boolean).join(" ");
|
|
202
|
+
if (r) return r;
|
|
203
|
+
}
|
|
204
|
+
return Array.from(e.childNodes).map((e) => {
|
|
205
|
+
if (e.nodeType === Node.TEXT_NODE) return e.textContent ?? "";
|
|
206
|
+
if (!(e instanceof Element)) return "";
|
|
207
|
+
let n = e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
|
|
208
|
+
return this._getLabelledbyElementText(e, t, n, i);
|
|
209
|
+
}).join("").replace(/\s+/g, " ").trim() || e.getAttribute("title")?.trim() || "";
|
|
210
|
+
}
|
|
211
|
+
_getLabelledbyText() {
|
|
212
|
+
return this._getLabelledbyTargets().map((e) => this._getLabelledbyElementText(e, this._isLabelledbyElementHidden(e))).filter(Boolean).join(" ");
|
|
213
|
+
}
|
|
214
|
+
_getLabelledbyAncestors(e) {
|
|
215
|
+
let t = /* @__PURE__ */ new Set();
|
|
216
|
+
for (let n of e) {
|
|
217
|
+
let e = n;
|
|
218
|
+
for (; e;) if (t.add(e), e.parentElement) e = e.parentElement;
|
|
219
|
+
else {
|
|
220
|
+
let t = e.getRootNode();
|
|
221
|
+
e = t instanceof ShadowRoot ? t.host : null;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return [...t];
|
|
225
|
+
}
|
|
226
|
+
_syncLabelledbyObserver() {
|
|
227
|
+
let e = this.getRootNode(), t = e instanceof Document || e instanceof ShadowRoot ? e : null, n = this._getObservedLabelledbyReferences(t), r = [...n.ids].join("\0"), i = n.targets, a = this._getLabelledbyValueControls(i), o = new Set(i);
|
|
228
|
+
for (let e of a) (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) && Array.from(e.labels ?? []).forEach((e) => o.add(e));
|
|
229
|
+
let s = [...o], c = this._getLabelledbyAncestors(s), l = s.length === this._observedLabelledbyMutationTargets.length && s.every((e, t) => e === this._observedLabelledbyMutationTargets[t]), u = a.length === this._observedLabelledbyValueControls.length && a.every((e, t) => e === this._observedLabelledbyValueControls[t]), d = c.length === this._observedLabelledbyAncestors.length && c.every((e, t) => e === this._observedLabelledbyAncestors[t]), f = e !== this._observedLabelledbyRoot, p = this.ariaLabelledby && this.isConnected ? this.ownerDocument.defaultView : null;
|
|
230
|
+
if (p !== this._observedLabelledbyWindow && (this._observedLabelledbyWindow?.removeEventListener("resize", this._onLabelledbyViewportChange), this._observedLabelledbyWindow = p, this._observedLabelledbyWindow?.addEventListener("resize", this._onLabelledbyViewportChange)), (f || r !== this._observedLabelledbyReferenceIds) && (this._releaseLabelledbyReferences?.(), this._releaseLabelledbyReferences = null, this._observedLabelledbyRoot = e, this._observedLabelledbyReferenceIds = r, this.isConnected && t && n.ids.size > 0 && (this._releaseLabelledbyReferences = C(t, n.ids, () => this.requestUpdate(), () => {
|
|
231
|
+
this._getLabelledbyText() !== this._observedLabelledbyText && this.requestUpdate();
|
|
232
|
+
}))), (f || !l) && (this._labelledbyObserver?.disconnect(), this._observedLabelledbyTargets = i, this._observedLabelledbyMutationTargets = s, this.isConnected && s.length > 0)) {
|
|
233
|
+
this._labelledbyObserver = new MutationObserver(() => {
|
|
234
|
+
let e = this._getLabelledbyValueControls(this._observedLabelledbyTargets);
|
|
235
|
+
(e.length !== this._observedLabelledbyValueControls.length || e.some((e, t) => e !== this._observedLabelledbyValueControls[t]) || this._getLabelledbyText() !== this._observedLabelledbyText) && this.requestUpdate();
|
|
236
|
+
});
|
|
237
|
+
for (let e of s) this._labelledbyObserver.observe(e, {
|
|
238
|
+
subtree: !0,
|
|
239
|
+
childList: !0,
|
|
240
|
+
characterData: !0,
|
|
241
|
+
attributes: !0,
|
|
242
|
+
attributeFilter: [
|
|
243
|
+
"aria-label",
|
|
244
|
+
"alt",
|
|
245
|
+
"value",
|
|
246
|
+
"title",
|
|
247
|
+
"type",
|
|
248
|
+
"aria-hidden",
|
|
249
|
+
"hidden",
|
|
250
|
+
"class",
|
|
251
|
+
"style"
|
|
252
|
+
]
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
if ((f || !u) && (this._observedLabelledbyValueControls.forEach((e) => {
|
|
256
|
+
e.removeEventListener("input", this._onLabelledbyValueChange), e.removeEventListener("change", this._onLabelledbyValueChange);
|
|
257
|
+
}), this._observedLabelledbyValueControls = a, this.isConnected && a.forEach((e) => {
|
|
258
|
+
e.addEventListener("input", this._onLabelledbyValueChange), e.addEventListener("change", this._onLabelledbyValueChange);
|
|
259
|
+
})), (f || !d) && (this._labelledbyAncestorObserver?.disconnect(), this._observedLabelledbyAncestors = c, this.isConnected && c.length > 0)) {
|
|
260
|
+
this._labelledbyAncestorObserver = new MutationObserver(() => {
|
|
261
|
+
this._getLabelledbyText() !== this._observedLabelledbyText && this.requestUpdate();
|
|
262
|
+
});
|
|
263
|
+
for (let e of c) this._labelledbyAncestorObserver.observe(e, {
|
|
264
|
+
attributes: !0,
|
|
265
|
+
attributeFilter: [
|
|
266
|
+
"aria-hidden",
|
|
267
|
+
"hidden",
|
|
268
|
+
"class",
|
|
269
|
+
"style"
|
|
270
|
+
]
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
this._observedLabelledbyText = this._getLabelledbyText();
|
|
40
274
|
}
|
|
41
275
|
get value() {
|
|
42
276
|
return this.clamp(this.round(this._value));
|
|
@@ -69,30 +303,49 @@ var _ = class extends i(d) {
|
|
|
69
303
|
get _effectiveStep() {
|
|
70
304
|
return this._step;
|
|
71
305
|
}
|
|
306
|
+
get _effectivePrecision() {
|
|
307
|
+
return this._precisionWasSet ? this._precision : Math.max(this._precision, v(this._step));
|
|
308
|
+
}
|
|
72
309
|
get atMin() {
|
|
73
310
|
return this.value <= this._min;
|
|
74
311
|
}
|
|
75
312
|
get atMax() {
|
|
76
313
|
return this.value >= this._max;
|
|
77
314
|
}
|
|
315
|
+
connectedCallback() {
|
|
316
|
+
super.connectedCallback(), this.requestUpdate();
|
|
317
|
+
}
|
|
318
|
+
formDisabledCallback(e) {
|
|
319
|
+
super.formDisabledCallback(e), this.toggleAttribute("data-form-disabled", e);
|
|
320
|
+
}
|
|
78
321
|
updated() {
|
|
322
|
+
if (this._syncLabelledbyObserver(), this._supportsLabelledbyElements) {
|
|
323
|
+
let e = this.shadowRoot?.querySelector("input");
|
|
324
|
+
e && (e.ariaLabelledByElements = this._getLabelledbyTargets());
|
|
325
|
+
}
|
|
79
326
|
this._syncValidity(), this.toggleAttribute("focused", this._focused);
|
|
80
327
|
}
|
|
328
|
+
disconnectedCallback() {
|
|
329
|
+
this._labelledbyObserver?.disconnect(), this._releaseLabelledbyReferences?.(), this._labelledbyAncestorObserver?.disconnect(), this._labelledbyObserver = null, this._releaseLabelledbyReferences = null, this._labelledbyAncestorObserver = null, this._observedLabelledbyWindow?.removeEventListener("resize", this._onLabelledbyViewportChange), this._observedLabelledbyWindow = null, this._observedLabelledbyRoot = null, this._observedLabelledbyReferenceIds = "", this._observedLabelledbyTargets = [], this._observedLabelledbyMutationTargets = [], this._observedLabelledbyValueControls.forEach((e) => {
|
|
330
|
+
e.removeEventListener("input", this._onLabelledbyValueChange), e.removeEventListener("change", this._onLabelledbyValueChange);
|
|
331
|
+
}), this._observedLabelledbyValueControls = [], this._observedLabelledbyAncestors = [], this._observedLabelledbyText = "", super.disconnectedCallback();
|
|
332
|
+
}
|
|
81
333
|
_syncValidity() {
|
|
82
334
|
let e = this.shadowRoot?.querySelector("input"), t = this._formAssociation.getInternals();
|
|
83
335
|
t && e && typeof t.setValidity == "function" && s(t, e, [
|
|
84
336
|
"valueMissing",
|
|
85
337
|
"rangeUnderflow",
|
|
86
|
-
"rangeOverflow"
|
|
87
|
-
"stepMismatch"
|
|
338
|
+
"rangeOverflow"
|
|
88
339
|
], this._isDisabled);
|
|
89
340
|
}
|
|
90
341
|
clamp(e) {
|
|
91
342
|
return Math.min(this._max, Math.max(this._min, e));
|
|
92
343
|
}
|
|
93
344
|
round(e) {
|
|
94
|
-
let t = 10 ** this.
|
|
95
|
-
|
|
345
|
+
let t = 10 ** this._effectivePrecision;
|
|
346
|
+
if (!Number.isFinite(t) || t === 0 || Math.abs(e) > (2 ** 53 - 1) / t) return e;
|
|
347
|
+
let n = e * t;
|
|
348
|
+
return Number.isFinite(n) ? Math.round(n) / t : e;
|
|
96
349
|
}
|
|
97
350
|
setValueAndNotify(e) {
|
|
98
351
|
this._draft = null, this.value = this.clamp(this.round(e)), this.dispatchEvent(new Event("input", {
|
|
@@ -153,8 +406,11 @@ var _ = class extends i(d) {
|
|
|
153
406
|
<input
|
|
154
407
|
id=${this._fieldId}
|
|
155
408
|
type="number"
|
|
409
|
+
step="any"
|
|
156
410
|
placeholder=${this.placeholder}
|
|
157
411
|
name=${this.name}
|
|
412
|
+
aria-label=${_(this._getLabelledbyText() || this.ariaLabel)}
|
|
413
|
+
aria-labelledby=${_(this.ariaLabelledby)}
|
|
158
414
|
.value=${this._draft ?? String(this.value)}
|
|
159
415
|
?disabled=${this._isDisabled}
|
|
160
416
|
?readonly=${this.readonly}
|
|
@@ -180,35 +436,38 @@ var _ = class extends i(d) {
|
|
|
180
436
|
e([h({
|
|
181
437
|
type: String,
|
|
182
438
|
reflect: !0
|
|
183
|
-
})],
|
|
439
|
+
})], w.prototype, "placeholder", void 0), e([h({
|
|
184
440
|
type: String,
|
|
185
441
|
reflect: !0
|
|
186
|
-
})],
|
|
442
|
+
})], w.prototype, "name", void 0), e([h({
|
|
187
443
|
type: Boolean,
|
|
188
444
|
reflect: !0
|
|
189
|
-
})],
|
|
445
|
+
})], w.prototype, "disabled", void 0), e([h({
|
|
190
446
|
type: Boolean,
|
|
191
447
|
reflect: !0
|
|
192
|
-
})],
|
|
448
|
+
})], w.prototype, "readonly", void 0), e([h({
|
|
193
449
|
type: Boolean,
|
|
194
450
|
reflect: !0
|
|
195
|
-
})],
|
|
196
|
-
type:
|
|
197
|
-
|
|
198
|
-
})],
|
|
451
|
+
})], w.prototype, "required", void 0), e([h({
|
|
452
|
+
type: String,
|
|
453
|
+
attribute: "aria-label"
|
|
454
|
+
})], w.prototype, "ariaLabel", void 0), e([h({
|
|
455
|
+
type: String,
|
|
456
|
+
attribute: "aria-labelledby"
|
|
457
|
+
})], w.prototype, "ariaLabelledby", void 0), e([h({ type: Number })], w.prototype, "precision", null), e([g()], w.prototype, "_value", void 0), e([g()], w.prototype, "_draft", void 0), e([g()], w.prototype, "_min", void 0), e([g()], w.prototype, "_max", void 0), e([g()], w.prototype, "_step", void 0), e([g()], w.prototype, "_focused", void 0), e([h({
|
|
199
458
|
type: Number,
|
|
200
459
|
reflect: !0
|
|
201
|
-
})],
|
|
460
|
+
})], w.prototype, "value", null), e([h({
|
|
202
461
|
type: Number,
|
|
203
462
|
reflect: !0
|
|
204
|
-
})],
|
|
463
|
+
})], w.prototype, "min", null), e([h({
|
|
205
464
|
type: Number,
|
|
206
465
|
reflect: !0
|
|
207
|
-
})],
|
|
466
|
+
})], w.prototype, "max", null), e([h({
|
|
208
467
|
type: Number,
|
|
209
468
|
reflect: !0
|
|
210
|
-
})],
|
|
469
|
+
})], w.prototype, "step", null), w = e([m("web-ui-input-number")], w);
|
|
211
470
|
//#endregion
|
|
212
|
-
export {
|
|
471
|
+
export { w as WebUiInputNumber };
|
|
213
472
|
|
|
214
473
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/input-number/index.ts"],"sourcesContent":["import '@/components/icon'\n\nimport { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport glass from '@/assets/glass.css?inline'\nimport { lucideMinus, lucidePlus } from '@/icons'\nimport {\n FormAssociated,\n defineFormAssociation,\n forwardInputValidity,\n FormAssociationController\n} from '@/shared/form-association'\nimport { createFieldId } from '@/shared/form-association/field-id'\nimport { normalizeNumber } from '@/shared/normalize'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-input-number')\nexport class WebUiInputNumber extends FormAssociated(LitElement) {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) readonly = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Number, reflect: true })\n get precision(): number {\n return this._precision\n }\n // 精度只影响读取(get value)/提交时的规整,不在赋值时抹掉原始小数:\n // `<web-ui-input-number value=\"1.5\" precision=\"2\">` 先跑 value setter、\n // 后跑 precision setter,若赋值时就按当时的默认精度 0 取整,1.5 会先变 2,\n // 之后再声明 precision=2 也恢复不了。\n set precision(v: number) {\n const old = this._precision\n this._precision = v\n this.requestUpdate('precision', old)\n }\n\n /** 原始值:只做 min/max 收敛,不按精度取整(取整发生在 get value)。 */\n @state() private _value = 0\n\n /**\n * 编辑中的原始文本。null 表示非编辑态,显示由 `value` 派生;\n * 非 null 时显示原文,避免把用户正在输入的 \"1.\" / \"0.10\" 立刻改写。\n */\n @state() private _draft: string | null = null\n @state() private _min = 0\n @state() private _max = Infinity\n @state() private _step = 1\n @state() private _focused = false\n private _precision = 0\n private readonly _fieldId = createFieldId('web-ui-input-number')\n\n @property({ type: Number, reflect: true })\n get value(): number {\n return this.clamp(this.round(this._value))\n }\n\n set value(v: number) {\n const next = this.clamp(v)\n const old = this._value\n this._value = next\n this._formAssociation.sync()\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formAssociation.isFormDisabled()\n }\n\n @property({ type: Number, reflect: true })\n get min(): number {\n return this._min\n }\n\n set min(v: unknown) {\n this._min = normalizeNumber(v, -Infinity, Infinity, 0)\n }\n\n @property({ type: Number, reflect: true })\n get max(): number {\n return this._max\n }\n\n set max(v: unknown) {\n this._max = normalizeNumber(v, -Infinity, Infinity, Infinity)\n }\n\n @property({ type: Number, reflect: true })\n get step(): number {\n return this._step\n }\n\n // 步进值,默认 1;若声明了 precision 则以 precision 退化步进\n set step(v: unknown) {\n this._step = normalizeNumber(v, 0, Infinity, 1)\n }\n\n private get _effectiveStep(): number {\n return this._step\n }\n\n private get atMin(): boolean {\n return this.value <= this._min\n }\n\n private get atMax(): boolean {\n return this.value >= this._max\n }\n\n private readonly _formAssociation = defineFormAssociation<number>({\n host: this,\n getState: () => this.value,\n setState: value => {\n this.value = value\n },\n getFormValue: () => String(this.value),\n getFormState: () => String(this.value),\n restoreState: state => {\n if (typeof state !== 'string') return\n const value = Number(state)\n if (Number.isFinite(value)) this.value = value\n },\n syncValidity: () => this._syncValidity()\n }).make()\n\n private readonly _formAssociationController = new FormAssociationController(this, this._formAssociation)\n\n override updated() {\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n private _syncValidity() {\n const input = this.shadowRoot?.querySelector('input')\n const internals = this._formAssociation.getInternals()\n if (!internals || !input || typeof internals.setValidity !== 'function') return\n forwardInputValidity(\n internals,\n input,\n ['valueMissing', 'rangeUnderflow', 'rangeOverflow', 'stepMismatch'],\n this._isDisabled\n )\n }\n\n private clamp(v: number): number {\n return Math.min(this._max, Math.max(this._min, v))\n }\n\n private round(v: number): number {\n const f = 10 ** this.precision\n return Math.round(v * f) / f\n }\n\n private setValueAndNotify(v: number) {\n this._draft = null\n this.value = this.clamp(this.round(v))\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private handleStep(direction: 1 | -1) {\n if (this._isDisabled || this.readonly) return\n this.setValueAndNotify(this.value + direction * this._effectiveStep)\n }\n\n // 输入过程只更新草稿与可解析的原始值,显示保持在草稿上:\n // 逐字把 \"1.\" 规整成 \"1\" 会打断输入(与原生 number input 的编辑体验一致)。\n private handleInput(e: Event) {\n if (this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n const raw = e.target.value\n this._draft = raw\n const parsed = raw === '' || raw === '-' ? Number.NaN : Number(raw)\n if (Number.isFinite(parsed)) {\n this._value = this.clamp(parsed)\n this._formAssociation.sync()\n }\n this._syncValidity()\n }\n\n // 原生 change 不 composed,被 shadow root 挡住;文本失焦提交时补发 composed 事件,\n // 与 ArrowUp/ArrowDown 的 change 行为对齐。\n // 提交点上做规整:非法/空草稿回填已提交值(value 不变、不派发 change),\n // 合法草稿写入 value 后由 get value 按精度规整。\n private handleNativeChange(e: Event) {\n if (this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n const raw = e.target.value\n this._draft = null\n const parsed = raw === '' || raw === '-' ? Number.NaN : Number(raw)\n if (!Number.isFinite(parsed)) {\n // 回填:草稿清空后显示重新由 value 派生\n this.requestUpdate()\n this._syncValidity()\n return\n }\n this._value = this.clamp(parsed)\n this._formAssociation.sync()\n this._syncValidity()\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private handleKeydown(e: KeyboardEvent) {\n if (this._isDisabled || this.readonly) return\n if (e.key === 'ArrowUp') {\n e.preventDefault()\n this.setValueAndNotify(this.value + this._effectiveStep)\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n } else if (e.key === 'ArrowDown') {\n e.preventDefault()\n this.setValueAndNotify(this.value - this._effectiveStep)\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n // change 的时序在部分平台晚于 blur;草稿仍存在说明还没提交,直接回填,\n // 避免「显示空、value 仍是旧值」的持久脱同步。\n if (this._draft !== null) {\n this._draft = null\n this.requestUpdate()\n }\n }\n\n override render() {\n return html`\n <div class=\"wui-glass wui-input-inner\">\n <button\n class=\"num-btn\"\n aria-label=\"Decrease\"\n ?disabled=${this._isDisabled || this.readonly || this.atMin}\n @click=${() => this.handleStep(-1)}\n >\n <web-ui-icon .icon=${lucideMinus}></web-ui-icon>\n </button>\n <input\n id=${this._fieldId}\n type=\"number\"\n placeholder=${this.placeholder}\n name=${this.name}\n .value=${this._draft ?? String(this.value)}\n ?disabled=${this._isDisabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n @input=${this.handleInput}\n @change=${this.handleNativeChange}\n @keydown=${this.handleKeydown}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n <button\n class=\"num-btn\"\n aria-label=\"Increase\"\n ?disabled=${this._isDisabled || this.readonly || this.atMax}\n @click=${() => this.handleStep(1)}\n >\n <web-ui-icon .icon=${lucidePlus}></web-ui-icon>\n </button>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-input-number': WebUiInputNumber\n }\n}\n"],"mappings":";;;;;;;;;;;;AAmBO,IAAM,IAAN,cAA+B,EAAe,CAAU,CAAC,CAAC;;EA8GjB,aA3GW,KAAA,cAAA,IACP,KAAA,OAAA,IACK,KAAA,WAAA,IACA,KAAA,WAAA,IACA,KAAA,WAAA,IAgB7B,KAAA,SAAA,GAMe,KAAA,SAAA,MACjB,KAAA,OAAA,GACA,KAAA,OAAA,UACC,KAAA,QAAA,GACG,KAAA,WAAA,IACP,KA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WAAA,QAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAIN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAiBxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,IAAA,GASxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,IAAA,GASxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,IAAA,GAzE1C,IAAA,EAAA,CAAA,EAAc,qBAAqB,CAAA,GAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/input-number/index.ts"],"sourcesContent":["import '@/components/icon'\n\nimport { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport glass from '@/classes/glass.css?inline'\nimport { lucideMinus, lucidePlus } from '@/icons'\nimport {\n FormAssociated,\n defineFormAssociation,\n forwardInputValidity,\n FormAssociationController\n} from '@/shared/form-association'\nimport { createFieldId } from '@/shared/form-association/field-id'\nimport { normalizeNumber } from '@/shared/normalize'\n\nimport style from './style.css?inline'\n\nconst decimalPlaces = (value: number): number => {\n const [numberText, exponent = '0'] = value.toString().toLowerCase().split('e')\n return Math.max(0, (numberText.split('.')[1]?.length ?? 0) - Number(exponent))\n}\n\ntype LabelledbyRoot = Document | ShadowRoot\n\ninterface LabelledbyReferenceRegistration {\n ids: Set<string>\n onReferenceChange: () => void\n onStylesheetChange: () => void\n}\n\ninterface LabelledbyRootObserver {\n observer: MutationObserver\n registrations: Set<LabelledbyReferenceRegistration>\n registrationsById: Map<string, Set<LabelledbyReferenceRegistration>>\n onStylesheetLoad: (event: Event) => void\n notifyStylesheetChange: () => void\n}\n\nconst labelledbyRootObservers = new WeakMap<LabelledbyRoot, LabelledbyRootObserver>()\n\nfunction nodeReferenceIds(node: Node): string[] {\n if (!(node instanceof Element)) return []\n const elements = [node, ...node.querySelectorAll('[id], label[for]')]\n return elements\n .flatMap(element => (element instanceof HTMLLabelElement ? [element.id, element.htmlFor] : [element.id]))\n .filter(Boolean)\n}\n\nfunction isStylesheetElement(element: Element): boolean {\n return (\n element instanceof HTMLStyleElement ||\n (element instanceof HTMLLinkElement && element.relList.contains('stylesheet'))\n )\n}\n\nfunction nodeContainsStylesheet(node: Node): boolean {\n return (\n (node instanceof Element && isStylesheetElement(node)) ||\n (node instanceof Element && node.querySelector('style, link[rel~=\"stylesheet\"]') !== null)\n )\n}\n\nfunction observeLabelledbyReferences(\n root: LabelledbyRoot,\n ids: Set<string>,\n onReferenceChange: () => void,\n onStylesheetChange: () => void\n): () => void {\n let shared = labelledbyRootObservers.get(root)\n\n if (!shared) {\n const registrations = new Set<LabelledbyReferenceRegistration>()\n const registrationsById = new Map<string, Set<LabelledbyReferenceRegistration>>()\n const notifyStylesheetChange = () => registrations.forEach(registration => registration.onStylesheetChange())\n const onStylesheetLoad = (event: Event) => {\n if (event.target instanceof HTMLLinkElement && event.target.relList.contains('stylesheet')) {\n notifyStylesheetChange()\n }\n }\n\n const observer = new MutationObserver(records => {\n const changedRegistrations = new Set<LabelledbyReferenceRegistration>()\n let stylesheetChanged = false\n const addRegistrationsForId = (id: string | null) => {\n if (!id) return\n registrationsById.get(id)?.forEach(registration => changedRegistrations.add(registration))\n }\n\n for (const record of records) {\n if (record.type === 'attributes') {\n const element = record.target as Element\n if (record.attributeName === 'id') {\n addRegistrationsForId(record.oldValue)\n addRegistrationsForId(element.id)\n } else if (record.attributeName === 'for' && element instanceof HTMLLabelElement) {\n addRegistrationsForId(record.oldValue)\n addRegistrationsForId(element.htmlFor)\n } else if (['disabled', 'media'].includes(record.attributeName ?? '') && isStylesheetElement(element)) {\n stylesheetChanged = true\n }\n } else if (record.type === 'childList') {\n if (record.target instanceof HTMLStyleElement || record.target instanceof HTMLLinkElement) {\n stylesheetChanged = true\n }\n for (const node of [...record.addedNodes, ...record.removedNodes]) {\n if (nodeContainsStylesheet(node)) stylesheetChanged = true\n for (const id of nodeReferenceIds(node)) addRegistrationsForId(id)\n }\n }\n }\n\n if (stylesheetChanged) notifyStylesheetChange()\n changedRegistrations.forEach(registration => registration.onReferenceChange())\n })\n\n shared = {\n observer,\n registrations,\n registrationsById,\n onStylesheetLoad,\n notifyStylesheetChange\n }\n labelledbyRootObservers.set(root, shared)\n observer.observe(root, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['id', 'for', 'disabled', 'media'],\n attributeOldValue: true\n })\n root.addEventListener('load', onStylesheetLoad, true)\n }\n\n const registration: LabelledbyReferenceRegistration = {\n ids: new Set(ids),\n onReferenceChange,\n onStylesheetChange\n }\n shared.registrations.add(registration)\n for (const id of registration.ids) {\n const registrations = shared.registrationsById.get(id) ?? new Set()\n registrations.add(registration)\n shared.registrationsById.set(id, registrations)\n }\n\n return () => {\n if (!shared?.registrations.delete(registration)) return\n for (const id of registration.ids) {\n const registrations = shared.registrationsById.get(id)\n registrations?.delete(registration)\n if (registrations?.size === 0) shared.registrationsById.delete(id)\n }\n if (shared.registrations.size === 0) {\n shared.observer.disconnect()\n root.removeEventListener('load', shared.onStylesheetLoad, true)\n labelledbyRootObservers.delete(root)\n }\n }\n}\n\n@customElement('web-ui-input-number')\nexport class WebUiInputNumber extends FormAssociated(LitElement) {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) readonly = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null\n @property({ type: String, attribute: 'aria-labelledby' }) ariaLabelledby: string | undefined\n @property({ type: Number })\n get precision(): number {\n return this._precision\n }\n // 精度只影响读取(get value)/提交时的规整,不在赋值时抹掉原始小数:\n // `<web-ui-input-number value=\"1.5\" precision=\"2\">` 先跑 value setter、\n // 后跑 precision setter,若赋值时就按当时的默认精度 0 取整,1.5 会先变 2,\n // 之后再声明 precision=2 也恢复不了。\n set precision(v: number | null) {\n const old = this._precision\n const wasExplicitlySet = this._precisionWasSet\n this._precision = v ?? 0\n this._precisionWasSet = v !== null\n\n if (v === null) {\n if (this.hasAttribute('precision')) this.removeAttribute('precision')\n } else if (this.getAttribute('precision') !== String(v)) {\n this.setAttribute('precision', String(v))\n }\n\n if (old !== this._precision || wasExplicitlySet !== this._precisionWasSet) this.requestUpdate()\n }\n\n /** 原始值:只做 min/max 收敛,不按精度取整(取整发生在 get value)。 */\n @state() private _value = 0\n\n /**\n * 编辑中的原始文本。null 表示非编辑态,显示由 `value` 派生;\n * 非 null 时显示原文,避免把用户正在输入的 \"1.\" / \"0.10\" 立刻改写。\n */\n @state() private _draft: string | null = null\n @state() private _min = 0\n @state() private _max = Infinity\n @state() private _step = 1\n @state() private _focused = false\n private _precision = 0\n private _precisionWasSet = false\n private readonly _fieldId = createFieldId('web-ui-input-number')\n private _labelledbyObserver: MutationObserver | null = null\n private _releaseLabelledbyReferences: (() => void) | null = null\n private _labelledbyAncestorObserver: MutationObserver | null = null\n private _observedLabelledbyRoot: Node | null = null\n private _observedLabelledbyReferenceIds = ''\n private _observedLabelledbyTargets: Element[] = []\n private _observedLabelledbyMutationTargets: Element[] = []\n private _observedLabelledbyValueControls: Element[] = []\n private _observedLabelledbyAncestors: Element[] = []\n private _observedLabelledbyText = ''\n private _observedLabelledbyWindow: Window | null = null\n private readonly _onLabelledbyViewportChange = () => this.requestUpdate()\n private readonly _onLabelledbyValueChange = () => {\n if (this._getLabelledbyText() !== this._observedLabelledbyText) this.requestUpdate()\n }\n\n private get _supportsLabelledbyElements(): boolean {\n return typeof Element !== 'undefined' && 'ariaLabelledByElements' in Element.prototype\n }\n\n private _getLabelledbyIds(idRefs: string | null | undefined = this.ariaLabelledby): string[] {\n const normalizedIdRefs = idRefs?.trim()\n return normalizedIdRefs ? normalizedIdRefs.split(/\\s+/).filter(Boolean) : []\n }\n\n private _getLabelledbyTargets(\n root: Document | ShadowRoot | null = null,\n idRefs: string | null | undefined = this.ariaLabelledby\n ): Element[] {\n const scope = root ?? this.getRootNode()\n if (!(scope instanceof Document || scope instanceof ShadowRoot)) return []\n\n return this._getLabelledbyIds(idRefs)\n .map(id => {\n const escapedId = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(id) : id\n return scope.querySelector(`#${escapedId}`)\n })\n .filter((element): element is Element => element !== null)\n }\n\n private _getLabelledbyValueControls(targets: Element[]): Element[] {\n const controls = new Set<Element>()\n for (const target of targets) {\n if (target.matches('input, textarea, select')) controls.add(target)\n target.querySelectorAll('input, textarea, select').forEach(control => controls.add(control))\n }\n return [...controls]\n }\n\n private _getObservedLabelledbyReferences(root: Document | ShadowRoot | null): {\n ids: Set<string>\n targets: Element[]\n } {\n return {\n ids: new Set(this._getLabelledbyIds()),\n targets: root ? this._getLabelledbyTargets(root) : []\n }\n }\n\n private _isLabelledbyElementHidden(element: Element): boolean {\n const visibility = getComputedStyle(element).visibility\n if (visibility === 'hidden' || visibility === 'collapse') return true\n\n let current: Element | null = element\n while (current) {\n const style = getComputedStyle(current)\n if (\n current.getAttribute('aria-hidden') === 'true' ||\n current.hasAttribute('hidden') ||\n style.display === 'none'\n ) {\n return true\n }\n\n if (current.parentElement) {\n current = current.parentElement\n } else {\n const root = current.getRootNode()\n current = root instanceof ShadowRoot ? root.host : null\n }\n }\n return false\n }\n\n private _getLabelledbyElementText(\n element: Element,\n includeHidden = false,\n embeddedControlValue = false,\n visited = new Set<Element>()\n ): string {\n if (visited.has(element)) return ''\n if (!includeHidden && this._isLabelledbyElementHidden(element)) return ''\n const nextVisited = new Set(visited)\n nextVisited.add(element)\n\n const ariaLabel = element.getAttribute('aria-label')?.trim()\n if (ariaLabel) return ariaLabel\n\n if (\n element instanceof HTMLImageElement ||\n element instanceof HTMLAreaElement ||\n (element instanceof HTMLInputElement && element.type === 'image')\n ) {\n const alt = element.getAttribute('alt')\n if (alt !== null) return alt.trim()\n }\n\n if (element instanceof HTMLInputElement && ['button', 'submit', 'reset'].includes(element.type)) {\n const value = element.value.trim()\n if (value) return value\n }\n\n if (element instanceof HTMLInputElement && ['checkbox', 'radio'].includes(element.type)) {\n if (embeddedControlValue) return element.checked ? 'on' : 'off'\n const labels = Array.from(element.labels ?? [])\n if (labels.length > 0) {\n return labels\n .map(label => this._getLabelledbyElementText(label, includeHidden, false, nextVisited))\n .filter(Boolean)\n .join(' ')\n }\n return element.getAttribute('title')?.trim() ?? ''\n }\n\n if (element instanceof HTMLInputElement && element.type !== 'hidden') {\n if (embeddedControlValue) {\n const value = element.value.trim()\n if (value) return value\n }\n const labels = Array.from(element.labels ?? [])\n if (labels.length > 0) {\n return labels\n .map(label => this._getLabelledbyElementText(label, includeHidden, false, nextVisited))\n .filter(Boolean)\n .join(' ')\n }\n }\n\n if (element instanceof HTMLTextAreaElement) {\n if (embeddedControlValue) {\n const value = element.value.trim()\n if (value) return value\n }\n const labels = Array.from(element.labels ?? [])\n if (labels.length > 0) {\n return labels\n .map(label => this._getLabelledbyElementText(label, includeHidden, false, nextVisited))\n .filter(Boolean)\n .join(' ')\n }\n }\n\n if (element instanceof HTMLSelectElement) {\n if (!embeddedControlValue) {\n const labels = Array.from(element.labels ?? [])\n if (labels.length > 0) {\n return labels\n .map(label => this._getLabelledbyElementText(label, includeHidden, false, nextVisited))\n .filter(Boolean)\n .join(' ')\n }\n return element.getAttribute('title')?.trim() ?? ''\n }\n\n const selectedOptions = Array.from(element.selectedOptions)\n .map(option => option.label.trim() || option.textContent?.trim() || '')\n .filter(Boolean)\n .join(' ')\n if (selectedOptions) return selectedOptions\n }\n\n const text = Array.from(element.childNodes)\n .map(node => {\n if (node.nodeType === Node.TEXT_NODE) return node.textContent ?? ''\n if (!(node instanceof Element)) return ''\n const isControl =\n node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement || node instanceof HTMLSelectElement\n return this._getLabelledbyElementText(node, includeHidden, isControl, nextVisited)\n })\n .join('')\n .replace(/\\s+/g, ' ')\n .trim()\n return text || element.getAttribute('title')?.trim() || ''\n }\n\n private _getLabelledbyText(): string {\n return this._getLabelledbyTargets()\n .map(element => this._getLabelledbyElementText(element, this._isLabelledbyElementHidden(element)))\n .filter(Boolean)\n .join(' ')\n }\n\n private _getLabelledbyAncestors(targets: Element[]): Element[] {\n const ancestors = new Set<Element>()\n for (const target of targets) {\n let current: Element | null = target\n while (current) {\n ancestors.add(current)\n if (current.parentElement) {\n current = current.parentElement\n } else {\n const root = current.getRootNode()\n current = root instanceof ShadowRoot ? root.host : null\n }\n }\n }\n return [...ancestors]\n }\n\n private _syncLabelledbyObserver() {\n const root = this.getRootNode()\n const scope = root instanceof Document || root instanceof ShadowRoot ? root : null\n const references = this._getObservedLabelledbyReferences(scope)\n const referenceIds = [...references.ids].join('\\u0000')\n const targets = references.targets\n const valueControls = this._getLabelledbyValueControls(targets)\n const mutationTargets = new Set(targets)\n for (const control of valueControls) {\n if (\n control instanceof HTMLInputElement ||\n control instanceof HTMLTextAreaElement ||\n control instanceof HTMLSelectElement\n ) {\n Array.from(control.labels ?? []).forEach(label => mutationTargets.add(label))\n }\n }\n const observedTargets = [...mutationTargets]\n const ancestors = this._getLabelledbyAncestors(observedTargets)\n const sameMutationTargets =\n observedTargets.length === this._observedLabelledbyMutationTargets.length &&\n observedTargets.every((target, index) => target === this._observedLabelledbyMutationTargets[index])\n const sameValueControls =\n valueControls.length === this._observedLabelledbyValueControls.length &&\n valueControls.every((control, index) => control === this._observedLabelledbyValueControls[index])\n const sameAncestors =\n ancestors.length === this._observedLabelledbyAncestors.length &&\n ancestors.every((ancestor, index) => ancestor === this._observedLabelledbyAncestors[index])\n const rootChanged = root !== this._observedLabelledbyRoot\n const nextWindow = this.ariaLabelledby && this.isConnected ? this.ownerDocument.defaultView : null\n\n if (nextWindow !== this._observedLabelledbyWindow) {\n this._observedLabelledbyWindow?.removeEventListener('resize', this._onLabelledbyViewportChange)\n this._observedLabelledbyWindow = nextWindow\n this._observedLabelledbyWindow?.addEventListener('resize', this._onLabelledbyViewportChange)\n }\n\n if (rootChanged || referenceIds !== this._observedLabelledbyReferenceIds) {\n this._releaseLabelledbyReferences?.()\n this._releaseLabelledbyReferences = null\n this._observedLabelledbyRoot = root\n this._observedLabelledbyReferenceIds = referenceIds\n\n if (this.isConnected && scope && references.ids.size > 0) {\n this._releaseLabelledbyReferences = observeLabelledbyReferences(\n scope,\n references.ids,\n () => this.requestUpdate(),\n () => {\n if (this._getLabelledbyText() !== this._observedLabelledbyText) this.requestUpdate()\n }\n )\n }\n }\n\n if (rootChanged || !sameMutationTargets) {\n this._labelledbyObserver?.disconnect()\n this._observedLabelledbyTargets = targets\n this._observedLabelledbyMutationTargets = observedTargets\n\n if (this.isConnected && observedTargets.length > 0) {\n this._labelledbyObserver = new MutationObserver(() => {\n const currentValueControls = this._getLabelledbyValueControls(this._observedLabelledbyTargets)\n const controlsChanged =\n currentValueControls.length !== this._observedLabelledbyValueControls.length ||\n currentValueControls.some((control, index) => control !== this._observedLabelledbyValueControls[index])\n if (controlsChanged || this._getLabelledbyText() !== this._observedLabelledbyText) this.requestUpdate()\n })\n\n for (const target of observedTargets) {\n // button/submit/reset 的 value IDL 在 default mode,property 赋值会反射到 value attribute。\n this._labelledbyObserver.observe(target, {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['aria-label', 'alt', 'value', 'title', 'type', 'aria-hidden', 'hidden', 'class', 'style']\n })\n }\n }\n }\n\n if (rootChanged || !sameValueControls) {\n this._observedLabelledbyValueControls.forEach(control => {\n control.removeEventListener('input', this._onLabelledbyValueChange)\n control.removeEventListener('change', this._onLabelledbyValueChange)\n })\n this._observedLabelledbyValueControls = valueControls\n if (this.isConnected) {\n valueControls.forEach(control => {\n control.addEventListener('input', this._onLabelledbyValueChange)\n control.addEventListener('change', this._onLabelledbyValueChange)\n })\n }\n }\n\n if (rootChanged || !sameAncestors) {\n this._labelledbyAncestorObserver?.disconnect()\n this._observedLabelledbyAncestors = ancestors\n\n if (this.isConnected && ancestors.length > 0) {\n this._labelledbyAncestorObserver = new MutationObserver(() => {\n if (this._getLabelledbyText() !== this._observedLabelledbyText) this.requestUpdate()\n })\n for (const ancestor of ancestors) {\n this._labelledbyAncestorObserver.observe(ancestor, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'hidden', 'class', 'style']\n })\n }\n }\n }\n\n this._observedLabelledbyText = this._getLabelledbyText()\n }\n\n @property({ type: Number, reflect: true })\n get value(): number {\n return this.clamp(this.round(this._value))\n }\n\n set value(v: number) {\n const next = this.clamp(v)\n const old = this._value\n this._value = next\n this._formAssociation.sync()\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formAssociation.isFormDisabled()\n }\n\n @property({ type: Number, reflect: true })\n get min(): number {\n return this._min\n }\n\n set min(v: unknown) {\n this._min = normalizeNumber(v, -Infinity, Infinity, 0)\n }\n\n @property({ type: Number, reflect: true })\n get max(): number {\n return this._max\n }\n\n set max(v: unknown) {\n this._max = normalizeNumber(v, -Infinity, Infinity, Infinity)\n }\n\n @property({ type: Number, reflect: true })\n get step(): number {\n return this._step\n }\n\n // 默认 precision 未显式设置时,读取精度会跟随 step 的小数位数。\n set step(v: unknown) {\n this._step = normalizeNumber(v, 0, Infinity, 1)\n }\n\n private get _effectiveStep(): number {\n return this._step\n }\n\n private get _effectivePrecision(): number {\n return this._precisionWasSet ? this._precision : Math.max(this._precision, decimalPlaces(this._step))\n }\n\n private get atMin(): boolean {\n return this.value <= this._min\n }\n\n private get atMax(): boolean {\n return this.value >= this._max\n }\n\n private readonly _formAssociation = defineFormAssociation<number>({\n host: this,\n getState: () => this.value,\n setState: value => {\n this.value = value\n },\n getFormValue: () => String(this.value),\n getFormState: () => String(this.value),\n restoreState: state => {\n if (typeof state !== 'string') return\n const value = Number(state)\n if (Number.isFinite(value)) this.value = value\n },\n syncValidity: () => this._syncValidity()\n }).make()\n\n private readonly _formAssociationController = new FormAssociationController(this, this._formAssociation)\n\n override connectedCallback() {\n super.connectedCallback()\n this.requestUpdate()\n }\n\n override formDisabledCallback(disabled: boolean) {\n super.formDisabledCallback(disabled)\n this.toggleAttribute('data-form-disabled', disabled)\n }\n\n override updated() {\n this._syncLabelledbyObserver()\n if (this._supportsLabelledbyElements) {\n const input = this.shadowRoot?.querySelector('input')\n // 用元素引用跨过 ShadowRoot,让浏览器按当前文本与样式计算名称;字符串回退兼容旧浏览器。\n if (input) input.ariaLabelledByElements = this._getLabelledbyTargets()\n }\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n override disconnectedCallback() {\n this._labelledbyObserver?.disconnect()\n this._releaseLabelledbyReferences?.()\n this._labelledbyAncestorObserver?.disconnect()\n this._labelledbyObserver = null\n this._releaseLabelledbyReferences = null\n this._labelledbyAncestorObserver = null\n this._observedLabelledbyWindow?.removeEventListener('resize', this._onLabelledbyViewportChange)\n this._observedLabelledbyWindow = null\n this._observedLabelledbyRoot = null\n this._observedLabelledbyReferenceIds = ''\n this._observedLabelledbyTargets = []\n this._observedLabelledbyMutationTargets = []\n this._observedLabelledbyValueControls.forEach(control => {\n control.removeEventListener('input', this._onLabelledbyValueChange)\n control.removeEventListener('change', this._onLabelledbyValueChange)\n })\n this._observedLabelledbyValueControls = []\n this._observedLabelledbyAncestors = []\n this._observedLabelledbyText = ''\n super.disconnectedCallback()\n }\n\n private _syncValidity() {\n const input = this.shadowRoot?.querySelector('input')\n const internals = this._formAssociation.getInternals()\n if (!internals || !input || typeof internals.setValidity !== 'function') return\n forwardInputValidity(internals, input, ['valueMissing', 'rangeUnderflow', 'rangeOverflow'], this._isDisabled)\n }\n\n private clamp(v: number): number {\n return Math.min(this._max, Math.max(this._min, v))\n }\n\n private round(v: number): number {\n const f = 10 ** this._effectivePrecision\n if (!Number.isFinite(f) || f === 0) return v\n if (Math.abs(v) > Number.MAX_SAFE_INTEGER / f) return v\n const scaled = v * f\n if (!Number.isFinite(scaled)) return v\n return Math.round(scaled) / f\n }\n\n private setValueAndNotify(v: number) {\n this._draft = null\n this.value = this.clamp(this.round(v))\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private handleStep(direction: 1 | -1) {\n if (this._isDisabled || this.readonly) return\n this.setValueAndNotify(this.value + direction * this._effectiveStep)\n }\n\n // 输入过程只更新草稿与可解析的原始值,显示保持在草稿上:\n // 逐字把 \"1.\" 规整成 \"1\" 会打断输入(与原生 number input 的编辑体验一致)。\n private handleInput(e: Event) {\n if (this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n const raw = e.target.value\n this._draft = raw\n const parsed = raw === '' || raw === '-' ? Number.NaN : Number(raw)\n if (Number.isFinite(parsed)) {\n this._value = this.clamp(parsed)\n this._formAssociation.sync()\n }\n this._syncValidity()\n }\n\n // 原生 change 不 composed,被 shadow root 挡住;文本失焦提交时补发 composed 事件,\n // 与 ArrowUp/ArrowDown 的 change 行为对齐。\n // 提交点上做规整:非法/空草稿回填已提交值(value 不变、不派发 change),\n // 合法草稿写入 value 后由 get value 按精度规整。\n private handleNativeChange(e: Event) {\n if (this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n const raw = e.target.value\n this._draft = null\n const parsed = raw === '' || raw === '-' ? Number.NaN : Number(raw)\n if (!Number.isFinite(parsed)) {\n // 回填:草稿清空后显示重新由 value 派生\n this.requestUpdate()\n this._syncValidity()\n return\n }\n this._value = this.clamp(parsed)\n this._formAssociation.sync()\n this._syncValidity()\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private handleKeydown(e: KeyboardEvent) {\n if (this._isDisabled || this.readonly) return\n if (e.key === 'ArrowUp') {\n e.preventDefault()\n this.setValueAndNotify(this.value + this._effectiveStep)\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n } else if (e.key === 'ArrowDown') {\n e.preventDefault()\n this.setValueAndNotify(this.value - this._effectiveStep)\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n // change 的时序在部分平台晚于 blur;草稿仍存在说明还没提交,直接回填,\n // 避免「显示空、value 仍是旧值」的持久脱同步。\n if (this._draft !== null) {\n this._draft = null\n this.requestUpdate()\n }\n }\n\n override render() {\n // step 是相对当前值的增减幅度,不要求值落在原生 input 以 min 为基准的 step 网格上。\n return html`\n <div class=\"wui-glass wui-input-inner\">\n <button\n class=\"num-btn\"\n aria-label=\"Decrease\"\n ?disabled=${this._isDisabled || this.readonly || this.atMin}\n @click=${() => this.handleStep(-1)}\n >\n <web-ui-icon .icon=${lucideMinus}></web-ui-icon>\n </button>\n <input\n id=${this._fieldId}\n type=\"number\"\n step=\"any\"\n placeholder=${this.placeholder}\n name=${this.name}\n aria-label=${ifDefined(this._getLabelledbyText() || this.ariaLabel)}\n aria-labelledby=${ifDefined(this.ariaLabelledby)}\n .value=${this._draft ?? String(this.value)}\n ?disabled=${this._isDisabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n @input=${this.handleInput}\n @change=${this.handleNativeChange}\n @keydown=${this.handleKeydown}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n <button\n class=\"num-btn\"\n aria-label=\"Increase\"\n ?disabled=${this._isDisabled || this.readonly || this.atMax}\n @click=${() => this.handleStep(1)}\n >\n <web-ui-icon .icon=${lucidePlus}></web-ui-icon>\n </button>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\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AyUN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAiBxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,IAAA,GASxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,IAAA,GASxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,IAAA,GAzZ1C,IAAA,EAAA,CAAA,EAAc,qBAAqB,CAAA,GAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/input-number/style.css?inline
|
|
2
|
-
var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-input-inner{--wui-glass-corner-radius:calc(var(--wui-control-size,36px) / 2);gap:var(--wui-space-1,4px);box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-control-size,36px);height:var(--wui-control-size,36px);padding:0 var(--wui-space-1,4px);border-radius:var(--wui-radius-control,calc(infinity * 1px));align-items:center;display:flex;position:relative}input{min-width:48px;height:100%;font:inherit;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-align:center;background:0 0;border:none;outline:none;flex:1;margin:0;padding:0}input::-webkit-inner-spin-button{appearance:none;margin:0}input::-webkit-outer-spin-button{appearance:none;margin:0}input::placeholder{font:inherit;color:var(--wui-color-text-secondary,#6a6a6a)}input[type=number]{appearance:textfield}input:disabled{cursor:not-allowed
|
|
2
|
+
var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]),:host([data-form-disabled]){cursor:not-allowed;opacity:.4}.wui-input-inner{--wui-glass-corner-radius:calc(var(--wui-control-size,36px) / 2);gap:var(--wui-space-1,4px);box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-control-size,36px);height:var(--wui-control-size,36px);padding:0 var(--wui-space-1,4px);border-radius:var(--wui-radius-control,calc(infinity * 1px));align-items:center;display:flex;position:relative}input{min-width:48px;height:100%;font:inherit;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-align:center;background:0 0;border:none;outline:none;flex:1;margin:0;padding:0}input::-webkit-inner-spin-button{appearance:none;margin:0}input::-webkit-outer-spin-button{appearance:none;margin:0}input::placeholder{font:inherit;color:var(--wui-color-text-secondary,#6a6a6a)}input[type=number]{appearance:textfield}input:disabled{cursor:not-allowed}@media (pointer:coarse){input{font-size:max(16px, var(--wui-font-size,14px))}}.wui-input-inner:after{pointer-events:none;content:\"\";border-radius:inherit;box-shadow:inset 0 0 0 1px transparent, 0 0 0 var(--wui-focus-ring-width,3px) transparent;transition:box-shadow var(--wui-duration-focus,.2s);position:absolute;inset:0}:host([focused]) .wui-input-inner:after{box-shadow:inset 0 0 0 1px var(--wui-color-accent,#0071e3), 0 0 0 var(--wui-focus-ring-width,3px) var(--wui-color-focus-ring,color-mix(in srgb, var(--wui-color-accent,#0071e3) 40%, transparent))}.num-btn{cursor:default;border-radius:var(--wui-radius-control,calc(infinity * 1px));width:30px;height:30px;color:var(--wui-color-text-secondary,#6a6a6a);background:0 0;border:none;flex-shrink:0;justify-content:center;align-items:center;padding:0;display:flex}.num-btn:disabled{cursor:not-allowed;opacity:.4}.num-btn:focus-visible{outline:var(--wui-focus-ring-width,3px) solid var(--wui-color-focus-ring,color-mix(in srgb, var(--wui-color-accent,#0071e3) 40%, transparent));outline-offset:2px}@media (hover:hover) and (pointer:fine){.num-btn:hover:not(:disabled){background:var(--wui-color-state-layer-hover,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 6%, transparent))}}.num-btn:active:not(:disabled){background:var(--wui-color-state-layer-active,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 15%, transparent))}:host([disabled]) .num-btn:disabled,:host([data-form-disabled]) .num-btn:disabled{opacity:1}";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as default };
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","names":[],"sources":["../../../src/components/input-number/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.wui-input-inner {\n --wui-glass-corner-radius: calc(var(--wui-control-size, 36px) / 2);\n position: relative;\n\n display: flex;\n gap: var(--wui-space-1, 4px);\n align-items: center;\n\n box-sizing: border-box;\n width: var(--wui-input-width, 200px);\n min-width: var(--wui-control-size, 36px);\n height: var(--wui-control-size, 36px);\n padding: 0 var(--wui-space-1, 4px);\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n}\n\ninput {\n flex: 1;\n\n min-width: 48px;\n height: 100%;\n margin: 0;\n padding: 0;\n border: none;\n\n /* 表单控件不继承字体;显式继承以对齐宿主排版,避免 UA 默认字体差异 */\n font: inherit;\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-align: center;\n\n background: transparent;\n outline: none;\n\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n margin: 0;\n appearance: none;\n }\n\n /* 同 input:占位文本的排版属于控件,不在这里另写一份。\n 颜色此前没声明,占位文本落在 UA 默认色上(浅/深两档都是 #757575),\n 与同系列其它控件的 secondary text token 不一致。 */\n &::placeholder {\n font: inherit;\n color: var(--wui-color-text-secondary, #6a6a6a);\n }\n\n &[type='number'] {\n appearance: textfield;\n }\n\n &:disabled {\n cursor: not-allowed;\n
|
|
1
|
+
{"version":3,"file":"style.js","names":[],"sources":["../../../src/components/input-number/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-block;\n}\n\n:host([disabled]),\n:host([data-form-disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.wui-input-inner {\n --wui-glass-corner-radius: calc(var(--wui-control-size, 36px) / 2);\n position: relative;\n\n display: flex;\n gap: var(--wui-space-1, 4px);\n align-items: center;\n\n box-sizing: border-box;\n width: var(--wui-input-width, 200px);\n min-width: var(--wui-control-size, 36px);\n height: var(--wui-control-size, 36px);\n padding: 0 var(--wui-space-1, 4px);\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n}\n\ninput {\n flex: 1;\n\n min-width: 48px;\n height: 100%;\n margin: 0;\n padding: 0;\n border: none;\n\n /* 表单控件不继承字体;显式继承以对齐宿主排版,避免 UA 默认字体差异 */\n font: inherit;\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-align: center;\n\n background: transparent;\n outline: none;\n\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n margin: 0;\n appearance: none;\n }\n\n /* 同 input:占位文本的排版属于控件,不在这里另写一份。\n 颜色此前没声明,占位文本落在 UA 默认色上(浅/深两档都是 #757575),\n 与同系列其它控件的 secondary text token 不一致。 */\n &::placeholder {\n font: inherit;\n color: var(--wui-color-text-secondary, #6a6a6a);\n }\n\n &[type='number'] {\n appearance: textfield;\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n}\n\n/* Coarse pointers include iOS Safari, where a sub-16px font triggers focus zoom. */\n@media (pointer: coarse) {\n input {\n font-size: max(16px, var(--wui-font-size, 14px));\n }\n}\n\n/* Focus ring 独立成 ::after 层:base/focused 都是显式 box-shadow,保证所有变体都能过渡 */\n.wui-input-inner::after {\n pointer-events: none;\n content: '';\n\n position: absolute;\n inset: 0;\n\n border-radius: inherit;\n\n box-shadow:\n inset 0 0 0 1px transparent,\n 0 0 0 var(--wui-focus-ring-width, 3px) transparent;\n\n transition: box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([focused]) .wui-input-inner::after {\n box-shadow:\n inset 0 0 0 1px var(--wui-color-accent, #0071e3),\n 0 0 0 var(--wui-focus-ring-width, 3px)\n var(--wui-color-focus-ring, color-mix(in srgb, var(--wui-color-accent, #0071e3) 40%, transparent));\n}\n\n.num-btn {\n cursor: default;\n\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 30px;\n height: 30px;\n padding: 0;\n border: none;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n color: var(--wui-color-text-secondary, #6a6a6a);\n\n background: transparent;\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n\n &:focus-visible {\n outline: var(--wui-focus-ring-width, 3px) solid\n var(--wui-color-focus-ring, color-mix(in srgb, var(--wui-color-accent, #0071e3) 40%, transparent));\n outline-offset: 2px;\n }\n}\n\n@media (hover: hover) and (pointer: fine) {\n .num-btn:hover:not(:disabled) {\n background: var(--wui-color-state-layer-hover, color-mix(in srgb, var(--wui-color-text, #1b1b1b) 6%, transparent));\n }\n}\n\n.num-btn:active:not(:disabled) {\n background: var(--wui-color-state-layer-active, color-mix(in srgb, var(--wui-color-text, #1b1b1b) 15%, transparent));\n}\n\n:host([disabled]) .num-btn:disabled,\n:host([data-form-disabled]) .num-btn:disabled {\n opacity: 1;\n}\n"],"mappings":""}
|