next-flow-design 1.3.0 → 1.5.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/dist/components/nf-checkbox/nf-checkbox.d.ts +1 -0
- package/dist/components/nf-input-number/nf-input-number.d.ts +29 -17
- package/dist/components/nf-switch/nf-switch.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +532 -477
- package/dist/react/components/nf-input-number/nf-input-number.d.ts +8 -4
- package/dist/react/components/nf-root/nf-root.d.ts +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +581 -524
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
import { css as E, LitElement as R, html as f } from "lit";
|
|
2
|
+
const T = (t) => (e, s) => {
|
|
3
|
+
s !== void 0 ? s.addInitializer(() => {
|
|
4
4
|
customElements.define(t, e);
|
|
5
5
|
}) : customElements.define(t, e);
|
|
6
6
|
};
|
|
7
|
-
const
|
|
7
|
+
const Y = globalThis, oe = Y.ShadowRoot && (Y.ShadyCSS === void 0 || Y.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, we = /* @__PURE__ */ Symbol(), ce = /* @__PURE__ */ new WeakMap();
|
|
8
8
|
let Se = class {
|
|
9
|
-
constructor(e,
|
|
10
|
-
if (this._$cssResult$ = !0,
|
|
11
|
-
this.cssText = e, this.t =
|
|
9
|
+
constructor(e, s, o) {
|
|
10
|
+
if (this._$cssResult$ = !0, o !== we) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
11
|
+
this.cssText = e, this.t = s;
|
|
12
12
|
}
|
|
13
13
|
get styleSheet() {
|
|
14
14
|
let e = this.o;
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
|
|
15
|
+
const s = this.t;
|
|
16
|
+
if (oe && e === void 0) {
|
|
17
|
+
const o = s !== void 0 && s.length === 1;
|
|
18
|
+
o && (e = ce.get(s)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), o && ce.set(s, e));
|
|
19
19
|
}
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
@@ -23,18 +23,18 @@ let Se = class {
|
|
|
23
23
|
return this.cssText;
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
const Ce = (t) => new Se(typeof t == "string" ? t : t + "", void 0,
|
|
27
|
-
if (
|
|
28
|
-
else for (const
|
|
29
|
-
const
|
|
30
|
-
r !== void 0 &&
|
|
31
|
-
}
|
|
32
|
-
}, de =
|
|
33
|
-
let
|
|
34
|
-
for (const
|
|
35
|
-
return Ce(
|
|
26
|
+
const Ce = (t) => new Se(typeof t == "string" ? t : t + "", void 0, we), Pe = (t, e) => {
|
|
27
|
+
if (oe) t.adoptedStyleSheets = e.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
|
|
28
|
+
else for (const s of e) {
|
|
29
|
+
const o = document.createElement("style"), r = Y.litNonce;
|
|
30
|
+
r !== void 0 && o.setAttribute("nonce", r), o.textContent = s.cssText, t.appendChild(o);
|
|
31
|
+
}
|
|
32
|
+
}, de = oe ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => {
|
|
33
|
+
let s = "";
|
|
34
|
+
for (const o of e.cssRules) s += o.cssText;
|
|
35
|
+
return Ce(s);
|
|
36
36
|
})(t) : t;
|
|
37
|
-
const { is: De, defineProperty: Me, getOwnPropertyDescriptor:
|
|
37
|
+
const { is: De, defineProperty: Me, getOwnPropertyDescriptor: Te, getOwnPropertyNames: Oe, getOwnPropertySymbols: Be, getPrototypeOf: Ve } = Object, Q = globalThis, ue = Q.trustedTypes, He = ue ? ue.emptyScript : "", Ne = Q.reactiveElementPolyfillSupport, U = (t, e) => t, X = { toAttribute(t, e) {
|
|
38
38
|
switch (e) {
|
|
39
39
|
case Boolean:
|
|
40
40
|
t = t ? He : null;
|
|
@@ -45,24 +45,24 @@ const { is: De, defineProperty: Me, getOwnPropertyDescriptor: Oe, getOwnProperty
|
|
|
45
45
|
}
|
|
46
46
|
return t;
|
|
47
47
|
}, fromAttribute(t, e) {
|
|
48
|
-
let
|
|
48
|
+
let s = t;
|
|
49
49
|
switch (e) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
|
|
51
|
+
s = t !== null;
|
|
52
52
|
break;
|
|
53
53
|
case Number:
|
|
54
|
-
|
|
54
|
+
s = t === null ? null : Number(t);
|
|
55
55
|
break;
|
|
56
56
|
case Object:
|
|
57
57
|
case Array:
|
|
58
58
|
try {
|
|
59
|
-
|
|
59
|
+
s = JSON.parse(t);
|
|
60
60
|
} catch {
|
|
61
|
-
|
|
61
|
+
s = null;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
return
|
|
65
|
-
} }, re = (t, e) => !De(t, e), pe = { attribute: !0, type: String, converter:
|
|
64
|
+
return s;
|
|
65
|
+
} }, re = (t, e) => !De(t, e), pe = { attribute: !0, type: String, converter: X, reflect: !1, useDefault: !1, hasChanged: re };
|
|
66
66
|
Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), Q.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
67
67
|
let B = class extends HTMLElement {
|
|
68
68
|
static addInitializer(e) {
|
|
@@ -71,60 +71,60 @@ let B = class extends HTMLElement {
|
|
|
71
71
|
static get observedAttributes() {
|
|
72
72
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
73
73
|
}
|
|
74
|
-
static createProperty(e,
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
74
|
+
static createProperty(e, s = pe) {
|
|
75
|
+
if (s.state && (s.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((s = Object.create(s)).wrapped = !0), this.elementProperties.set(e, s), !s.noAccessor) {
|
|
76
|
+
const o = /* @__PURE__ */ Symbol(), r = this.getPropertyDescriptor(e, o, s);
|
|
77
77
|
r !== void 0 && Me(this.prototype, e, r);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
static getPropertyDescriptor(e,
|
|
81
|
-
const { get: r, set: i } =
|
|
82
|
-
return this[
|
|
80
|
+
static getPropertyDescriptor(e, s, o) {
|
|
81
|
+
const { get: r, set: i } = Te(this.prototype, e) ?? { get() {
|
|
82
|
+
return this[s];
|
|
83
83
|
}, set(n) {
|
|
84
|
-
this[
|
|
84
|
+
this[s] = n;
|
|
85
85
|
} };
|
|
86
86
|
return { get: r, set(n) {
|
|
87
87
|
const l = r?.call(this);
|
|
88
|
-
i?.call(this, n), this.requestUpdate(e, l,
|
|
88
|
+
i?.call(this, n), this.requestUpdate(e, l, o);
|
|
89
89
|
}, configurable: !0, enumerable: !0 };
|
|
90
90
|
}
|
|
91
91
|
static getPropertyOptions(e) {
|
|
92
92
|
return this.elementProperties.get(e) ?? pe;
|
|
93
93
|
}
|
|
94
94
|
static _$Ei() {
|
|
95
|
-
if (this.hasOwnProperty(
|
|
96
|
-
const e =
|
|
95
|
+
if (this.hasOwnProperty(U("elementProperties"))) return;
|
|
96
|
+
const e = Ve(this);
|
|
97
97
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
98
98
|
}
|
|
99
99
|
static finalize() {
|
|
100
|
-
if (this.hasOwnProperty(
|
|
101
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
102
|
-
const
|
|
103
|
-
for (const r of
|
|
100
|
+
if (this.hasOwnProperty(U("finalized"))) return;
|
|
101
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(U("properties"))) {
|
|
102
|
+
const s = this.properties, o = [...Oe(s), ...Be(s)];
|
|
103
|
+
for (const r of o) this.createProperty(r, s[r]);
|
|
104
104
|
}
|
|
105
105
|
const e = this[Symbol.metadata];
|
|
106
106
|
if (e !== null) {
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
107
|
+
const s = litPropertyMetadata.get(e);
|
|
108
|
+
if (s !== void 0) for (const [o, r] of s) this.elementProperties.set(o, r);
|
|
109
109
|
}
|
|
110
110
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
111
|
-
for (const [
|
|
112
|
-
const r = this._$Eu(
|
|
113
|
-
r !== void 0 && this._$Eh.set(r,
|
|
111
|
+
for (const [s, o] of this.elementProperties) {
|
|
112
|
+
const r = this._$Eu(s, o);
|
|
113
|
+
r !== void 0 && this._$Eh.set(r, s);
|
|
114
114
|
}
|
|
115
115
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
116
116
|
}
|
|
117
117
|
static finalizeStyles(e) {
|
|
118
|
-
const
|
|
118
|
+
const s = [];
|
|
119
119
|
if (Array.isArray(e)) {
|
|
120
|
-
const
|
|
121
|
-
for (const r of
|
|
122
|
-
} else e !== void 0 &&
|
|
123
|
-
return
|
|
120
|
+
const o = new Set(e.flat(1 / 0).reverse());
|
|
121
|
+
for (const r of o) s.unshift(de(r));
|
|
122
|
+
} else e !== void 0 && s.push(de(e));
|
|
123
|
+
return s;
|
|
124
124
|
}
|
|
125
|
-
static _$Eu(e,
|
|
126
|
-
const
|
|
127
|
-
return
|
|
125
|
+
static _$Eu(e, s) {
|
|
126
|
+
const o = s.attribute;
|
|
127
|
+
return o === !1 ? void 0 : typeof o == "string" ? o : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
128
128
|
}
|
|
129
129
|
constructor() {
|
|
130
130
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
@@ -139,8 +139,8 @@ let B = class extends HTMLElement {
|
|
|
139
139
|
this._$EO?.delete(e);
|
|
140
140
|
}
|
|
141
141
|
_$E_() {
|
|
142
|
-
const e = /* @__PURE__ */ new Map(),
|
|
143
|
-
for (const
|
|
142
|
+
const e = /* @__PURE__ */ new Map(), s = this.constructor.elementProperties;
|
|
143
|
+
for (const o of s.keys()) this.hasOwnProperty(o) && (e.set(o, this[o]), delete this[o]);
|
|
144
144
|
e.size > 0 && (this._$Ep = e);
|
|
145
145
|
}
|
|
146
146
|
createRenderRoot() {
|
|
@@ -155,42 +155,42 @@ let B = class extends HTMLElement {
|
|
|
155
155
|
disconnectedCallback() {
|
|
156
156
|
this._$EO?.forEach((e) => e.hostDisconnected?.());
|
|
157
157
|
}
|
|
158
|
-
attributeChangedCallback(e,
|
|
159
|
-
this._$AK(e,
|
|
158
|
+
attributeChangedCallback(e, s, o) {
|
|
159
|
+
this._$AK(e, o);
|
|
160
160
|
}
|
|
161
|
-
_$ET(e,
|
|
162
|
-
const
|
|
163
|
-
if (r !== void 0 &&
|
|
164
|
-
const i = (
|
|
161
|
+
_$ET(e, s) {
|
|
162
|
+
const o = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, o);
|
|
163
|
+
if (r !== void 0 && o.reflect === !0) {
|
|
164
|
+
const i = (o.converter?.toAttribute !== void 0 ? o.converter : X).toAttribute(s, o.type);
|
|
165
165
|
this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
_$AK(e,
|
|
169
|
-
const
|
|
168
|
+
_$AK(e, s) {
|
|
169
|
+
const o = this.constructor, r = o._$Eh.get(e);
|
|
170
170
|
if (r !== void 0 && this._$Em !== r) {
|
|
171
|
-
const i =
|
|
171
|
+
const i = o.getPropertyOptions(r), n = typeof i.converter == "function" ? { fromAttribute: i.converter } : i.converter?.fromAttribute !== void 0 ? i.converter : X;
|
|
172
172
|
this._$Em = r;
|
|
173
|
-
const l = n.fromAttribute(
|
|
173
|
+
const l = n.fromAttribute(s, i.type);
|
|
174
174
|
this[r] = l ?? this._$Ej?.get(r) ?? l, this._$Em = null;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
requestUpdate(e,
|
|
177
|
+
requestUpdate(e, s, o, r = !1, i) {
|
|
178
178
|
if (e !== void 0) {
|
|
179
179
|
const n = this.constructor;
|
|
180
|
-
if (r === !1 && (i = this[e]),
|
|
181
|
-
this.C(e,
|
|
180
|
+
if (r === !1 && (i = this[e]), o ??= n.getPropertyOptions(e), !((o.hasChanged ?? re)(i, s) || o.useDefault && o.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(n._$Eu(e, o)))) return;
|
|
181
|
+
this.C(e, s, o);
|
|
182
182
|
}
|
|
183
183
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
184
184
|
}
|
|
185
|
-
C(e,
|
|
186
|
-
|
|
185
|
+
C(e, s, { useDefault: o, reflect: r, wrapped: i }, n) {
|
|
186
|
+
o && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, n ?? s ?? this[e]), i !== !0 || n !== void 0) || (this._$AL.has(e) || (this.hasUpdated || o || (s = void 0), this._$AL.set(e, s)), r === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
187
187
|
}
|
|
188
188
|
async _$EP() {
|
|
189
189
|
this.isUpdatePending = !0;
|
|
190
190
|
try {
|
|
191
191
|
await this._$ES;
|
|
192
|
-
} catch (
|
|
193
|
-
Promise.reject(
|
|
192
|
+
} catch (s) {
|
|
193
|
+
Promise.reject(s);
|
|
194
194
|
}
|
|
195
195
|
const e = this.scheduleUpdate();
|
|
196
196
|
return e != null && await e, !this.isUpdatePending;
|
|
@@ -205,25 +205,25 @@ let B = class extends HTMLElement {
|
|
|
205
205
|
for (const [r, i] of this._$Ep) this[r] = i;
|
|
206
206
|
this._$Ep = void 0;
|
|
207
207
|
}
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
208
|
+
const o = this.constructor.elementProperties;
|
|
209
|
+
if (o.size > 0) for (const [r, i] of o) {
|
|
210
210
|
const { wrapped: n } = i, l = this[r];
|
|
211
211
|
n !== !0 || this._$AL.has(r) || l === void 0 || this.C(r, void 0, i, l);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
let e = !1;
|
|
215
|
-
const
|
|
215
|
+
const s = this._$AL;
|
|
216
216
|
try {
|
|
217
|
-
e = this.shouldUpdate(
|
|
218
|
-
} catch (
|
|
219
|
-
throw e = !1, this._$EM(),
|
|
217
|
+
e = this.shouldUpdate(s), e ? (this.willUpdate(s), this._$EO?.forEach((o) => o.hostUpdate?.()), this.update(s)) : this._$EM();
|
|
218
|
+
} catch (o) {
|
|
219
|
+
throw e = !1, this._$EM(), o;
|
|
220
220
|
}
|
|
221
|
-
e && this._$AE(
|
|
221
|
+
e && this._$AE(s);
|
|
222
222
|
}
|
|
223
223
|
willUpdate(e) {
|
|
224
224
|
}
|
|
225
225
|
_$AE(e) {
|
|
226
|
-
this._$EO?.forEach((
|
|
226
|
+
this._$EO?.forEach((s) => s.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
227
227
|
}
|
|
228
228
|
_$EM() {
|
|
229
229
|
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
@@ -238,19 +238,19 @@ let B = class extends HTMLElement {
|
|
|
238
238
|
return !0;
|
|
239
239
|
}
|
|
240
240
|
update(e) {
|
|
241
|
-
this._$Eq &&= this._$Eq.forEach((
|
|
241
|
+
this._$Eq &&= this._$Eq.forEach((s) => this._$ET(s, this[s])), this._$EM();
|
|
242
242
|
}
|
|
243
243
|
updated(e) {
|
|
244
244
|
}
|
|
245
245
|
firstUpdated(e) {
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
B.elementStyles = [], B.shadowRootOptions = { mode: "open" }, B[
|
|
249
|
-
const
|
|
250
|
-
const { kind:
|
|
248
|
+
B.elementStyles = [], B.shadowRootOptions = { mode: "open" }, B[U("elementProperties")] = /* @__PURE__ */ new Map(), B[U("finalized")] = /* @__PURE__ */ new Map(), Ne?.({ ReactiveElement: B }), (Q.reactiveElementVersions ??= []).push("2.1.2");
|
|
249
|
+
const Ue = { attribute: !0, type: String, converter: X, reflect: !1, hasChanged: re }, Le = (t = Ue, e, s) => {
|
|
250
|
+
const { kind: o, metadata: r } = s;
|
|
251
251
|
let i = globalThis.litPropertyMetadata.get(r);
|
|
252
|
-
if (i === void 0 && globalThis.litPropertyMetadata.set(r, i = /* @__PURE__ */ new Map()),
|
|
253
|
-
const { name: n } =
|
|
252
|
+
if (i === void 0 && globalThis.litPropertyMetadata.set(r, i = /* @__PURE__ */ new Map()), o === "setter" && ((t = Object.create(t)).wrapped = !0), i.set(s.name, t), o === "accessor") {
|
|
253
|
+
const { name: n } = s;
|
|
254
254
|
return { set(l) {
|
|
255
255
|
const a = e.get.call(this);
|
|
256
256
|
e.set.call(this, l), this.requestUpdate(n, a, t, !0, l);
|
|
@@ -258,89 +258,89 @@ const Le = { attribute: !0, type: String, converter: Z, reflect: !1, hasChanged:
|
|
|
258
258
|
return l !== void 0 && this.C(n, void 0, t, l), l;
|
|
259
259
|
} };
|
|
260
260
|
}
|
|
261
|
-
if (
|
|
262
|
-
const { name: n } =
|
|
261
|
+
if (o === "setter") {
|
|
262
|
+
const { name: n } = s;
|
|
263
263
|
return function(l) {
|
|
264
264
|
const a = this[n];
|
|
265
265
|
e.call(this, l), this.requestUpdate(n, a, t, !0, l);
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
|
-
throw Error("Unsupported decorator location: " +
|
|
268
|
+
throw Error("Unsupported decorator location: " + o);
|
|
269
269
|
};
|
|
270
270
|
function h(t) {
|
|
271
|
-
return (e,
|
|
271
|
+
return (e, s) => typeof s == "object" ? Le(t, e, s) : ((o, r, i) => {
|
|
272
272
|
const n = r.hasOwnProperty(i);
|
|
273
|
-
return r.constructor.createProperty(i,
|
|
274
|
-
})(t, e,
|
|
273
|
+
return r.constructor.createProperty(i, o), n ? Object.getOwnPropertyDescriptor(r, i) : void 0;
|
|
274
|
+
})(t, e, s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function w(t) {
|
|
277
277
|
return h({ ...t, state: !0, attribute: !1 });
|
|
278
278
|
}
|
|
279
|
-
const ie = globalThis, fe = (t) => t, G = ie.trustedTypes, be = G ? G.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, $e = "$lit$",
|
|
280
|
-
\f\r]`,
|
|
281
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), ve = /'/g, _e = /"/g, ke = /^(?:script|style|textarea|title)$/i, ze = (t) => (e, ...
|
|
282
|
-
function
|
|
279
|
+
const ie = globalThis, fe = (t) => t, G = ie.trustedTypes, be = G ? G.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, $e = "$lit$", A = `lit$${Math.random().toFixed(9).slice(2)}$`, xe = "?" + A, Fe = `<${xe}>`, P = document, L = () => P.createComment(""), F = (t) => t === null || typeof t != "object" && typeof t != "function", ne = Array.isArray, je = (t) => ne(t) || typeof t?.[Symbol.iterator] == "function", te = `[
|
|
280
|
+
\f\r]`, N = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, me = /-->/g, ge = />/g, S = RegExp(`>|${te}(?:([^\\s"'>=/]+)(${te}*=${te}*(?:[^
|
|
281
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ve = /'/g, _e = /"/g, ke = /^(?:script|style|textarea|title)$/i, ze = (t) => (e, ...s) => ({ _$litType$: t, strings: e, values: s }), se = ze(1), D = /* @__PURE__ */ Symbol.for("lit-noChange"), b = /* @__PURE__ */ Symbol.for("lit-nothing"), ye = /* @__PURE__ */ new WeakMap(), C = P.createTreeWalker(P, 129);
|
|
282
|
+
function Ae(t, e) {
|
|
283
283
|
if (!ne(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
284
284
|
return be !== void 0 ? be.createHTML(e) : e;
|
|
285
285
|
}
|
|
286
|
-
const
|
|
287
|
-
const
|
|
288
|
-
let r, i = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n =
|
|
289
|
-
for (let l = 0; l <
|
|
286
|
+
const Ie = (t, e) => {
|
|
287
|
+
const s = t.length - 1, o = [];
|
|
288
|
+
let r, i = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = N;
|
|
289
|
+
for (let l = 0; l < s; l++) {
|
|
290
290
|
const a = t[l];
|
|
291
291
|
let c, u, d = -1, $ = 0;
|
|
292
|
-
for (; $ < a.length && (n.lastIndex = $, u = n.exec(a), u !== null); ) $ = n.lastIndex, n ===
|
|
292
|
+
for (; $ < a.length && (n.lastIndex = $, u = n.exec(a), u !== null); ) $ = n.lastIndex, n === N ? u[1] === "!--" ? n = me : u[1] !== void 0 ? n = ge : u[2] !== void 0 ? (ke.test(u[2]) && (r = RegExp("</" + u[2], "g")), n = S) : u[3] !== void 0 && (n = S) : n === S ? u[0] === ">" ? (n = r ?? N, d = -1) : u[1] === void 0 ? d = -2 : (d = n.lastIndex - u[2].length, c = u[1], n = u[3] === void 0 ? S : u[3] === '"' ? _e : ve) : n === _e || n === ve ? n = S : n === me || n === ge ? n = N : (n = S, r = void 0);
|
|
293
293
|
const k = n === S && t[l + 1].startsWith("/>") ? " " : "";
|
|
294
|
-
i += n ===
|
|
294
|
+
i += n === N ? a + Fe : d >= 0 ? (o.push(c), a.slice(0, d) + $e + a.slice(d) + A + k) : a + A + (d === -2 ? l : k);
|
|
295
295
|
}
|
|
296
|
-
return [
|
|
296
|
+
return [Ae(t, i + (t[s] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), o];
|
|
297
297
|
};
|
|
298
|
-
class
|
|
299
|
-
constructor({ strings: e, _$litType$:
|
|
298
|
+
class j {
|
|
299
|
+
constructor({ strings: e, _$litType$: s }, o) {
|
|
300
300
|
let r;
|
|
301
301
|
this.parts = [];
|
|
302
302
|
let i = 0, n = 0;
|
|
303
|
-
const l = e.length - 1, a = this.parts, [c, u] =
|
|
304
|
-
if (this.el =
|
|
303
|
+
const l = e.length - 1, a = this.parts, [c, u] = Ie(e, s);
|
|
304
|
+
if (this.el = j.createElement(c, o), C.currentNode = this.el.content, s === 2 || s === 3) {
|
|
305
305
|
const d = this.el.content.firstChild;
|
|
306
306
|
d.replaceWith(...d.childNodes);
|
|
307
307
|
}
|
|
308
308
|
for (; (r = C.nextNode()) !== null && a.length < l; ) {
|
|
309
309
|
if (r.nodeType === 1) {
|
|
310
310
|
if (r.hasAttributes()) for (const d of r.getAttributeNames()) if (d.endsWith($e)) {
|
|
311
|
-
const $ = u[n++], k = r.getAttribute(d).split(
|
|
312
|
-
a.push({ type: 1, index: i, name:
|
|
313
|
-
} else d.startsWith(
|
|
311
|
+
const $ = u[n++], k = r.getAttribute(d).split(A), Z = /([.?@])?(.*)/.exec($);
|
|
312
|
+
a.push({ type: 1, index: i, name: Z[2], strings: k, ctor: Z[1] === "." ? qe : Z[1] === "?" ? We : Z[1] === "@" ? Ke : ee }), r.removeAttribute(d);
|
|
313
|
+
} else d.startsWith(A) && (a.push({ type: 6, index: i }), r.removeAttribute(d));
|
|
314
314
|
if (ke.test(r.tagName)) {
|
|
315
|
-
const d = r.textContent.split(
|
|
315
|
+
const d = r.textContent.split(A), $ = d.length - 1;
|
|
316
316
|
if ($ > 0) {
|
|
317
317
|
r.textContent = G ? G.emptyScript : "";
|
|
318
|
-
for (let k = 0; k < $; k++) r.append(d[k],
|
|
319
|
-
r.append(d[$],
|
|
318
|
+
for (let k = 0; k < $; k++) r.append(d[k], L()), C.nextNode(), a.push({ type: 2, index: ++i });
|
|
319
|
+
r.append(d[$], L());
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
} else if (r.nodeType === 8) if (r.data === xe) a.push({ type: 2, index: i });
|
|
323
323
|
else {
|
|
324
324
|
let d = -1;
|
|
325
|
-
for (; (d = r.data.indexOf(
|
|
325
|
+
for (; (d = r.data.indexOf(A, d + 1)) !== -1; ) a.push({ type: 7, index: i }), d += A.length - 1;
|
|
326
326
|
}
|
|
327
327
|
i++;
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
static createElement(e,
|
|
331
|
-
const
|
|
332
|
-
return
|
|
330
|
+
static createElement(e, s) {
|
|
331
|
+
const o = P.createElement("template");
|
|
332
|
+
return o.innerHTML = e, o;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function H(t, e,
|
|
335
|
+
function H(t, e, s = t, o) {
|
|
336
336
|
if (e === D) return e;
|
|
337
|
-
let r =
|
|
338
|
-
const i =
|
|
339
|
-
return r?.constructor !== i && (r?._$AO?.(!1), i === void 0 ? r = void 0 : (r = new i(t), r._$AT(t,
|
|
337
|
+
let r = o !== void 0 ? s._$Co?.[o] : s._$Cl;
|
|
338
|
+
const i = F(e) ? void 0 : e._$litDirective$;
|
|
339
|
+
return r?.constructor !== i && (r?._$AO?.(!1), i === void 0 ? r = void 0 : (r = new i(t), r._$AT(t, s, o)), o !== void 0 ? (s._$Co ??= [])[o] = r : s._$Cl = r), r !== void 0 && (e = H(t, r._$AS(t, e.values), r, o)), e;
|
|
340
340
|
}
|
|
341
341
|
class Re {
|
|
342
|
-
constructor(e,
|
|
343
|
-
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM =
|
|
342
|
+
constructor(e, s) {
|
|
343
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = s;
|
|
344
344
|
}
|
|
345
345
|
get parentNode() {
|
|
346
346
|
return this._$AM.parentNode;
|
|
@@ -349,34 +349,34 @@ class Re {
|
|
|
349
349
|
return this._$AM._$AU;
|
|
350
350
|
}
|
|
351
351
|
u(e) {
|
|
352
|
-
const { el: { content:
|
|
352
|
+
const { el: { content: s }, parts: o } = this._$AD, r = (e?.creationScope ?? P).importNode(s, !0);
|
|
353
353
|
C.currentNode = r;
|
|
354
|
-
let i = C.nextNode(), n = 0, l = 0, a =
|
|
354
|
+
let i = C.nextNode(), n = 0, l = 0, a = o[0];
|
|
355
355
|
for (; a !== void 0; ) {
|
|
356
356
|
if (n === a.index) {
|
|
357
357
|
let c;
|
|
358
|
-
a.type === 2 ? c = new
|
|
358
|
+
a.type === 2 ? c = new q(i, i.nextSibling, this, e) : a.type === 1 ? c = new a.ctor(i, a.name, a.strings, this, e) : a.type === 6 && (c = new Ze(i, this, e)), this._$AV.push(c), a = o[++l];
|
|
359
359
|
}
|
|
360
360
|
n !== a?.index && (i = C.nextNode(), n++);
|
|
361
361
|
}
|
|
362
362
|
return C.currentNode = P, r;
|
|
363
363
|
}
|
|
364
364
|
p(e) {
|
|
365
|
-
let
|
|
366
|
-
for (const
|
|
365
|
+
let s = 0;
|
|
366
|
+
for (const o of this._$AV) o !== void 0 && (o.strings !== void 0 ? (o._$AI(e, o, s), s += o.strings.length - 2) : o._$AI(e[s])), s++;
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
class
|
|
369
|
+
class q {
|
|
370
370
|
get _$AU() {
|
|
371
371
|
return this._$AM?._$AU ?? this._$Cv;
|
|
372
372
|
}
|
|
373
|
-
constructor(e,
|
|
374
|
-
this.type = 2, this._$AH =
|
|
373
|
+
constructor(e, s, o, r) {
|
|
374
|
+
this.type = 2, this._$AH = b, this._$AN = void 0, this._$AA = e, this._$AB = s, this._$AM = o, this.options = r, this._$Cv = r?.isConnected ?? !0;
|
|
375
375
|
}
|
|
376
376
|
get parentNode() {
|
|
377
377
|
let e = this._$AA.parentNode;
|
|
378
|
-
const
|
|
379
|
-
return
|
|
378
|
+
const s = this._$AM;
|
|
379
|
+
return s !== void 0 && e?.nodeType === 11 && (e = s.parentNode), e;
|
|
380
380
|
}
|
|
381
381
|
get startNode() {
|
|
382
382
|
return this._$AA;
|
|
@@ -384,8 +384,8 @@ class W {
|
|
|
384
384
|
get endNode() {
|
|
385
385
|
return this._$AB;
|
|
386
386
|
}
|
|
387
|
-
_$AI(e,
|
|
388
|
-
e = H(this, e,
|
|
387
|
+
_$AI(e, s = this) {
|
|
388
|
+
e = H(this, e, s), F(e) ? e === b || e == null || e === "" ? (this._$AH !== b && this._$AR(), this._$AH = b) : e !== this._$AH && e !== D && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : je(e) ? this.k(e) : this._(e);
|
|
389
389
|
}
|
|
390
390
|
O(e) {
|
|
391
391
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -394,31 +394,31 @@ class W {
|
|
|
394
394
|
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
395
395
|
}
|
|
396
396
|
_(e) {
|
|
397
|
-
this._$AH !==
|
|
397
|
+
this._$AH !== b && F(this._$AH) ? this._$AA.nextSibling.data = e : this.T(P.createTextNode(e)), this._$AH = e;
|
|
398
398
|
}
|
|
399
399
|
$(e) {
|
|
400
|
-
const { values:
|
|
401
|
-
if (this._$AH?._$AD === r) this._$AH.p(
|
|
400
|
+
const { values: s, _$litType$: o } = e, r = typeof o == "number" ? this._$AC(e) : (o.el === void 0 && (o.el = j.createElement(Ae(o.h, o.h[0]), this.options)), o);
|
|
401
|
+
if (this._$AH?._$AD === r) this._$AH.p(s);
|
|
402
402
|
else {
|
|
403
403
|
const i = new Re(r, this), n = i.u(this.options);
|
|
404
|
-
i.p(
|
|
404
|
+
i.p(s), this.T(n), this._$AH = i;
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
_$AC(e) {
|
|
408
|
-
let
|
|
409
|
-
return
|
|
408
|
+
let s = ye.get(e.strings);
|
|
409
|
+
return s === void 0 && ye.set(e.strings, s = new j(e)), s;
|
|
410
410
|
}
|
|
411
411
|
k(e) {
|
|
412
412
|
ne(this._$AH) || (this._$AH = [], this._$AR());
|
|
413
|
-
const
|
|
414
|
-
let
|
|
415
|
-
for (const i of e) r ===
|
|
416
|
-
r <
|
|
417
|
-
}
|
|
418
|
-
_$AR(e = this._$AA.nextSibling,
|
|
419
|
-
for (this._$AP?.(!1, !0,
|
|
420
|
-
const
|
|
421
|
-
fe(e).remove(), e =
|
|
413
|
+
const s = this._$AH;
|
|
414
|
+
let o, r = 0;
|
|
415
|
+
for (const i of e) r === s.length ? s.push(o = new q(this.O(L()), this.O(L()), this, this.options)) : o = s[r], o._$AI(i), r++;
|
|
416
|
+
r < s.length && (this._$AR(o && o._$AB.nextSibling, r), s.length = r);
|
|
417
|
+
}
|
|
418
|
+
_$AR(e = this._$AA.nextSibling, s) {
|
|
419
|
+
for (this._$AP?.(!1, !0, s); e !== this._$AB; ) {
|
|
420
|
+
const o = fe(e).nextSibling;
|
|
421
|
+
fe(e).remove(), e = o;
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
setConnected(e) {
|
|
@@ -432,56 +432,56 @@ class ee {
|
|
|
432
432
|
get _$AU() {
|
|
433
433
|
return this._$AM._$AU;
|
|
434
434
|
}
|
|
435
|
-
constructor(e,
|
|
436
|
-
this.type = 1, this._$AH =
|
|
435
|
+
constructor(e, s, o, r, i) {
|
|
436
|
+
this.type = 1, this._$AH = b, this._$AN = void 0, this.element = e, this.name = s, this._$AM = r, this.options = i, o.length > 2 || o[0] !== "" || o[1] !== "" ? (this._$AH = Array(o.length - 1).fill(new String()), this.strings = o) : this._$AH = b;
|
|
437
437
|
}
|
|
438
|
-
_$AI(e,
|
|
438
|
+
_$AI(e, s = this, o, r) {
|
|
439
439
|
const i = this.strings;
|
|
440
440
|
let n = !1;
|
|
441
|
-
if (i === void 0) e = H(this, e,
|
|
441
|
+
if (i === void 0) e = H(this, e, s, 0), n = !F(e) || e !== this._$AH && e !== D, n && (this._$AH = e);
|
|
442
442
|
else {
|
|
443
443
|
const l = e;
|
|
444
444
|
let a, c;
|
|
445
|
-
for (e = i[0], a = 0; a < i.length - 1; a++) c = H(this, l[
|
|
445
|
+
for (e = i[0], a = 0; a < i.length - 1; a++) c = H(this, l[o + a], s, a), c === D && (c = this._$AH[a]), n ||= !F(c) || c !== this._$AH[a], c === b ? e = b : e !== b && (e += (c ?? "") + i[a + 1]), this._$AH[a] = c;
|
|
446
446
|
}
|
|
447
447
|
n && !r && this.j(e);
|
|
448
448
|
}
|
|
449
449
|
j(e) {
|
|
450
|
-
e ===
|
|
450
|
+
e === b ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
class
|
|
453
|
+
class qe extends ee {
|
|
454
454
|
constructor() {
|
|
455
455
|
super(...arguments), this.type = 3;
|
|
456
456
|
}
|
|
457
457
|
j(e) {
|
|
458
|
-
this.element[this.name] = e ===
|
|
458
|
+
this.element[this.name] = e === b ? void 0 : e;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
class
|
|
461
|
+
class We extends ee {
|
|
462
462
|
constructor() {
|
|
463
463
|
super(...arguments), this.type = 4;
|
|
464
464
|
}
|
|
465
465
|
j(e) {
|
|
466
|
-
this.element.toggleAttribute(this.name, !!e && e !==
|
|
466
|
+
this.element.toggleAttribute(this.name, !!e && e !== b);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
class Ke extends ee {
|
|
470
|
-
constructor(e,
|
|
471
|
-
super(e,
|
|
470
|
+
constructor(e, s, o, r, i) {
|
|
471
|
+
super(e, s, o, r, i), this.type = 5;
|
|
472
472
|
}
|
|
473
|
-
_$AI(e,
|
|
474
|
-
if ((e = H(this, e,
|
|
475
|
-
const
|
|
476
|
-
r && this.element.removeEventListener(this.name, this,
|
|
473
|
+
_$AI(e, s = this) {
|
|
474
|
+
if ((e = H(this, e, s, 0) ?? b) === D) return;
|
|
475
|
+
const o = this._$AH, r = e === b && o !== b || e.capture !== o.capture || e.once !== o.once || e.passive !== o.passive, i = e !== b && (o === b || r);
|
|
476
|
+
r && this.element.removeEventListener(this.name, this, o), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
477
477
|
}
|
|
478
478
|
handleEvent(e) {
|
|
479
479
|
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
class
|
|
483
|
-
constructor(e,
|
|
484
|
-
this.element = e, this.type = 6, this._$AN = void 0, this._$AM =
|
|
482
|
+
class Ze {
|
|
483
|
+
constructor(e, s, o) {
|
|
484
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = s, this.options = o;
|
|
485
485
|
}
|
|
486
486
|
get _$AU() {
|
|
487
487
|
return this._$AM._$AU;
|
|
@@ -490,19 +490,19 @@ class Ye {
|
|
|
490
490
|
H(this, e);
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
const
|
|
494
|
-
|
|
495
|
-
const
|
|
496
|
-
const
|
|
497
|
-
let r =
|
|
493
|
+
const Ye = ie.litHtmlPolyfillSupport;
|
|
494
|
+
Ye?.(j, q), (ie.litHtmlVersions ??= []).push("3.3.2");
|
|
495
|
+
const Xe = (t, e, s) => {
|
|
496
|
+
const o = s?.renderBefore ?? e;
|
|
497
|
+
let r = o._$litPart$;
|
|
498
498
|
if (r === void 0) {
|
|
499
|
-
const i =
|
|
500
|
-
|
|
499
|
+
const i = s?.renderBefore ?? null;
|
|
500
|
+
o._$litPart$ = r = new q(e.insertBefore(L(), i), i, void 0, s ?? {});
|
|
501
501
|
}
|
|
502
502
|
return r._$AI(t), r;
|
|
503
503
|
};
|
|
504
504
|
const ae = globalThis;
|
|
505
|
-
let
|
|
505
|
+
let V = class extends B {
|
|
506
506
|
constructor() {
|
|
507
507
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
508
508
|
}
|
|
@@ -511,8 +511,8 @@ let T = class extends B {
|
|
|
511
511
|
return this.renderOptions.renderBefore ??= e.firstChild, e;
|
|
512
512
|
}
|
|
513
513
|
update(e) {
|
|
514
|
-
const
|
|
515
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do =
|
|
514
|
+
const s = this.render();
|
|
515
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Xe(s, this.renderRoot, this.renderOptions);
|
|
516
516
|
}
|
|
517
517
|
connectedCallback() {
|
|
518
518
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -524,17 +524,17 @@ let T = class extends B {
|
|
|
524
524
|
return D;
|
|
525
525
|
}
|
|
526
526
|
};
|
|
527
|
-
|
|
527
|
+
V._$litElement$ = !0, V.finalized = !0, ae.litElementHydrateSupport?.({ LitElement: V });
|
|
528
528
|
const Ge = ae.litElementPolyfillSupport;
|
|
529
|
-
Ge?.({ LitElement:
|
|
529
|
+
Ge?.({ LitElement: V });
|
|
530
530
|
(ae.litElementVersions ??= []).push("4.2.2");
|
|
531
|
-
const Je =
|
|
532
|
-
var Qe = Object.defineProperty, et = Object.getOwnPropertyDescriptor, le = (t, e,
|
|
533
|
-
for (var r =
|
|
534
|
-
(n = t[i]) && (r = (
|
|
535
|
-
return
|
|
531
|
+
const Je = E`:host{cursor:pointer;-webkit-user-select:none;user-select:none;width:calc(1rem + 2px);height:calc(1rem + 2px)}:host([disabled]){cursor:not-allowed;opacity:.6}.checkbox-container{position:relative;transition:opacity .2s ease}.checkbox-box{width:1rem;height:1rem;border-radius:.25rem;background-color:var(--nf-background-color);border:1px solid var(--nf-border-color);display:flex;align-items:center;justify-content:center;transition:background-color .2s ease,border-color .2s ease}:host(:hover:not([checked]):not([disabled])) .checkbox-box{border-color:var(--nf-primary-color,var(--nf-primary-color))}:host([checked]) .checkbox-box{background-color:var(--nf-primary-color,var(--nf-primary-color));border-color:var(--nf-primary-color,var(--nf-primary-color))}:host([disabled]) .checkbox-box{border-color:#fffc;background:#fffc;cursor:not-allowed;pointer-events:none}:host([disabled][checked]) .checkbox-box{background-color:#fffc;border-color:#fffc}.checkbox-icon{color:#fff;font-size:.75rem;line-height:1;font-weight:700;transition:transform .2s ease;display:flex;align-items:center}:host([checked]) .checkbox-icon{transform:scale(1)}:host(:focus) .checkbox-container{outline:.125rem solid var(--nf-primary-color,var(--nf-primary-color));outline-offset:.125rem}`;
|
|
532
|
+
var Qe = Object.defineProperty, et = Object.getOwnPropertyDescriptor, le = (t, e, s, o) => {
|
|
533
|
+
for (var r = o > 1 ? void 0 : o ? et(e, s) : e, i = t.length - 1, n; i >= 0; i--)
|
|
534
|
+
(n = t[i]) && (r = (o ? n(e, s, r) : n(r)) || r);
|
|
535
|
+
return o && r && Qe(e, s, r), r;
|
|
536
536
|
};
|
|
537
|
-
let z = class extends
|
|
537
|
+
let z = class extends V {
|
|
538
538
|
constructor() {
|
|
539
539
|
super(...arguments), this.checked = !1, this.disabled = !1;
|
|
540
540
|
}
|
|
@@ -550,7 +550,12 @@ let z = class extends T {
|
|
|
550
550
|
}
|
|
551
551
|
// 渲染复选框组件
|
|
552
552
|
render() {
|
|
553
|
-
return
|
|
553
|
+
return se`<div class=checkbox-container @click=${this.toggleCheckbox} aria-checked=${this.checked} aria-disabled=${this.disabled} role=checkbox><div class=checkbox-box>${this.checked ? se`<div class=checkbox-icon><svg viewBox="64 64 896 896"focusable=false data-icon=check width=0.625rem height=0.625rem fill=currentColor aria-hidden=true><path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"></path></svg></div>` : ""}</div></div>`;
|
|
554
|
+
}
|
|
555
|
+
connectedCallback() {
|
|
556
|
+
this.style.transition = "none", super.connectedCallback(), requestAnimationFrame(() => {
|
|
557
|
+
this.style.transition = "";
|
|
558
|
+
});
|
|
554
559
|
}
|
|
555
560
|
};
|
|
556
561
|
z.styles = [Je];
|
|
@@ -561,56 +566,56 @@ le([
|
|
|
561
566
|
h({ type: Boolean, reflect: !0 })
|
|
562
567
|
], z.prototype, "disabled", 2);
|
|
563
568
|
z = le([
|
|
564
|
-
|
|
569
|
+
T("nf-checkbox")
|
|
565
570
|
], z);
|
|
566
|
-
const tt = { ATTRIBUTE: 1 },
|
|
567
|
-
let
|
|
571
|
+
const tt = { ATTRIBUTE: 1 }, st = (t) => (...e) => ({ _$litDirective$: t, values: e });
|
|
572
|
+
let ot = class {
|
|
568
573
|
constructor(e) {
|
|
569
574
|
}
|
|
570
575
|
get _$AU() {
|
|
571
576
|
return this._$AM._$AU;
|
|
572
577
|
}
|
|
573
|
-
_$AT(e,
|
|
574
|
-
this._$Ct = e, this._$AM =
|
|
578
|
+
_$AT(e, s, o) {
|
|
579
|
+
this._$Ct = e, this._$AM = s, this._$Ci = o;
|
|
575
580
|
}
|
|
576
|
-
_$AS(e,
|
|
577
|
-
return this.update(e,
|
|
581
|
+
_$AS(e, s) {
|
|
582
|
+
return this.update(e, s);
|
|
578
583
|
}
|
|
579
|
-
update(e,
|
|
580
|
-
return this.render(...
|
|
584
|
+
update(e, s) {
|
|
585
|
+
return this.render(...s);
|
|
581
586
|
}
|
|
582
587
|
};
|
|
583
|
-
const
|
|
588
|
+
const Ee = "important", rt = " !" + Ee, J = st(class extends ot {
|
|
584
589
|
constructor(t) {
|
|
585
590
|
if (super(t), t.type !== tt.ATTRIBUTE || t.name !== "style" || t.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
586
591
|
}
|
|
587
592
|
render(t) {
|
|
588
|
-
return Object.keys(t).reduce((e,
|
|
589
|
-
const
|
|
590
|
-
return
|
|
593
|
+
return Object.keys(t).reduce((e, s) => {
|
|
594
|
+
const o = t[s];
|
|
595
|
+
return o == null ? e : e + `${s = s.includes("-") ? s : s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${o};`;
|
|
591
596
|
}, "");
|
|
592
597
|
}
|
|
593
598
|
update(t, [e]) {
|
|
594
|
-
const { style:
|
|
599
|
+
const { style: s } = t.element;
|
|
595
600
|
if (this.ft === void 0) return this.ft = new Set(Object.keys(e)), this.render(e);
|
|
596
|
-
for (const
|
|
597
|
-
for (const
|
|
598
|
-
const r = e[
|
|
601
|
+
for (const o of this.ft) e[o] == null && (this.ft.delete(o), o.includes("-") ? s.removeProperty(o) : s[o] = null);
|
|
602
|
+
for (const o in e) {
|
|
603
|
+
const r = e[o];
|
|
599
604
|
if (r != null) {
|
|
600
|
-
this.ft.add(
|
|
605
|
+
this.ft.add(o);
|
|
601
606
|
const i = typeof r == "string" && r.endsWith(rt);
|
|
602
|
-
|
|
607
|
+
o.includes("-") || i ? s.setProperty(o, i ? r.slice(0, -11) : r, i ? Ee : "") : s[o] = r;
|
|
603
608
|
}
|
|
604
609
|
}
|
|
605
610
|
return D;
|
|
606
611
|
}
|
|
607
|
-
}),
|
|
608
|
-
var nt = Object.defineProperty, at = Object.getOwnPropertyDescriptor,
|
|
609
|
-
for (var r =
|
|
610
|
-
(n = t[i]) && (r = (
|
|
611
|
-
return
|
|
612
|
+
}), W = E`:host{display:inline-flex;align-items:center;position:relative;width:var(--nf-width);height:var(--nf-height);padding:var(--nf-padding);margin:var(--nf-margin);font-size:var(--nf-text-font-size);font-weight:var(--nf-font-weight);color:var(--nf-color);background:var(--nf-background-color);border-radius:var(--nf-border-radius);border:1px solid var(--nf-border-color);outline:0;background-clip:padding-box;box-shadow:0 0 0 .15rem var(--nf-box-shadow-color);transition:color var(--nf-transition) ease-in-out,background-color var(--nf-transition) ease-in-out,border-color var(--nf-transition) ease-in-out,box-shadow var(--nf-transition) ease-in-out}:host(:focus){border-color:var(--nf-border-color-hover);box-shadow:0 0 0 .15rem var(--nf-box-shadow-color-focus);background:var(--nf-background-color-hover)}:host(:hover:not([disabled])){border-color:var(--nf-border-color-hover);background:var(--nf-background-color-hover)}:host([disabled]){cursor:not-allowed;opacity:.6;pointer-events:auto}:host([disabled]:hover){border-color:var(--nf-border-color);background:var(--nf-background-color)}`, it = E`:host{display:inline-block;position:relative}:host([disabled]){cursor:not-allowed;opacity:.6}:host([disabled]:hover){border-color:var(--nf-border-color);background:var(--nf-background-color)}:host([open]){border-color:var(--nf-border-color-hover);box-shadow:0 0 0 .15rem var(--nf-box-shadow-color-focus)}.trigger{width:calc(100% + 1.5rem + 2px);height:calc(100% + 2px);margin:-1px -.75rem;padding:1px .75rem;box-sizing:border-box;display:flex;align-items:center;cursor:pointer;transition:all .2s;font-size:.875rem;position:relative}:host(:not([disabled])) .trigger:hover{border-color:var(--nf-color-primary)}.trigger[disabled]{cursor:not-allowed;opacity:.6}:host([disabled]) .trigger{cursor:not-allowed;color:var(--nf-color-disabled)}.color-block{width:1.25rem;height:1.25rem;border-radius:.125rem;margin-left:calc((var(--nf-height) - 1.25rem)/ 2 - .75rem);margin-right:.4rem}:host(.hide-text) .color-block{margin-right:calc((var(--nf-height) - 1.25rem)/ 2 - .75rem)}.color-text{flex:1}.panel{position:absolute;z-index:1000;background:var(--nf-color-picker-card-background,var(--nf-dropdown-background));-webkit-backdrop-filter:blur(64px);backdrop-filter:blur(64px);border-radius:var(--nf-border-radius);box-shadow:0 6px 16px 0 var(--nf-color-picker-card-shadow,var(--nf-dropdown-shadow)),0 3px 6px -4px var(--nf-color-picker-card-shadow,var(--nf-dropdown-shadow)),0 9px 28px 8px var(--nf-color-picker-card-shadow,var(--nf-dropdown-shadow));-webkit-user-select:none;user-select:none}.panel-content{padding:.75rem;width:15rem}.color-selector{height:9.375rem;position:relative;margin-bottom:.75rem;border-radius:var(--nf-border-radius);overflow:hidden}.color-sb{width:100%;height:100%;position:relative;cursor:pointer}.sb-white{position:absolute;inset:0;background:linear-gradient(to right,#fff,#fff0)}.sb-black{position:absolute;inset:0;background:linear-gradient(to top,#000,#0000)}.selector{position:absolute;width:.625rem;height:.625rem;border:.125rem solid #fff;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 .125rem #00000080;pointer-events:none}.slider-container{margin-bottom:.5rem}.slider-container:last-child{margin-bottom:0}.sliders-row{display:flex;align-items:center;gap:.75rem}.sliders{flex:1}.slider{position:relative;height:.75rem;border-radius:.375rem}.hue-slider{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.alpha-slider{position:relative;background-image:linear-gradient(45deg,var(--nf-color-picker-card-checker,#ccc) 25%,transparent 25%),linear-gradient(-45deg,var(--nf-color-picker-card-checker,#ccc) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--nf-color-picker-card-checker,#ccc) 75%),linear-gradient(-45deg,transparent 75%,var(--nf-color-picker-card-checker,#ccc) 75%);background-size:.375rem .375rem;background-position:0 0,0 .1875rem,.1875rem -.1875rem,-.1875rem 0;background-color:var(--nf-color-picker-card-checker-bg,#fff);border-radius:.375rem}.alpha-slider-input{position:relative;z-index:2}.alpha-gradient{position:absolute;inset:0;border-radius:.375rem}input[type=range]{-webkit-appearance:none;width:100%;height:100%;background:0 0;outline:0;position:absolute;top:0;left:0;margin:0;padding:0}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:1rem;height:1rem;border-radius:50%;background:#fff;border:.125rem solid var(--nf-color-border);cursor:pointer;box-shadow:0 0 .125rem #00000080;position:relative;z-index:1}input[type=range]::-moz-range-thumb{width:1rem;height:1rem;border-radius:50%;background:#fff;border:.125rem solid var(--nf-color-border);cursor:pointer;box-shadow:0 0 .125rem #00000080}.current-color-container{display:flex}.current-color{width:2rem;height:2rem;border-radius:var(--nf-border-radius);border:.0625rem solid var(--nf-color-border)}:host(:not([disabled-alpha])) .current-color{width:2.5rem;height:2.5rem}`;
|
|
613
|
+
var nt = Object.defineProperty, at = Object.getOwnPropertyDescriptor, _ = (t, e, s, o) => {
|
|
614
|
+
for (var r = o > 1 ? void 0 : o ? at(e, s) : e, i = t.length - 1, n; i >= 0; i--)
|
|
615
|
+
(n = t[i]) && (r = (o ? n(e, s, r) : n(r)) || r);
|
|
616
|
+
return o && r && nt(e, s, r), r;
|
|
612
617
|
};
|
|
613
|
-
let
|
|
618
|
+
let g = class extends R {
|
|
614
619
|
constructor() {
|
|
615
620
|
super(...arguments), this.value = "#FF0000", this.disabled = !1, this.disabledAlpha = !1, this.open = !1, this.showText = !0, this.placement = "bottom", this.align = "left", this.autoAdjust = !0, this._panelVisible = !1, this._internalValue = "#FF0000FF", this._hsb = { h: 0, s: 100, b: 100 }, this._panelPosition = { top: 0, left: 0 }, this._handleGlobalClick = (t) => {
|
|
616
621
|
this._panelVisible && !this.contains(t.target) && this._closePanel();
|
|
@@ -627,16 +632,18 @@ let b = class extends R {
|
|
|
627
632
|
};
|
|
628
633
|
}
|
|
629
634
|
connectedCallback() {
|
|
630
|
-
super.connectedCallback(), document.addEventListener("click", this._handleGlobalClick), document.addEventListener("keydown", this._handleKeyDown)
|
|
635
|
+
this.style.transition = "none", super.connectedCallback(), document.addEventListener("click", this._handleGlobalClick), document.addEventListener("keydown", this._handleKeyDown), requestAnimationFrame(() => {
|
|
636
|
+
this.style.transition = "";
|
|
637
|
+
});
|
|
631
638
|
}
|
|
632
639
|
disconnectedCallback() {
|
|
633
640
|
super.disconnectedCallback(), document.removeEventListener("click", this._handleGlobalClick), document.removeEventListener("keydown", this._handleKeyDown), document.removeEventListener("mousemove", this._handleSBMouseMove), document.removeEventListener("mouseup", this._handleSBMouseUp);
|
|
634
641
|
}
|
|
635
642
|
firstUpdated() {
|
|
636
|
-
this._updateInternalValue(this.value), this._updateHSBFromHex(this._internalValue);
|
|
643
|
+
this._updateInternalValue(this.value), this._updateHSBFromHex(this._internalValue), this.classList.toggle("hide-text", !this.showText);
|
|
637
644
|
}
|
|
638
645
|
updated(t) {
|
|
639
|
-
t.has("value") && (this._updateInternalValue(this.value), this._updateHSBFromHex(this._internalValue)), t.has("open") && (this._panelVisible = this.open, this.open && this._updatePanelPosition());
|
|
646
|
+
t.has("value") && (this._updateInternalValue(this.value), this._updateHSBFromHex(this._internalValue)), t.has("open") && (this._panelVisible = this.open, this.open && this._updatePanelPosition()), t.has("showText") && this.classList.toggle("hide-text", !this.showText);
|
|
640
647
|
}
|
|
641
648
|
// 更新内部颜色值
|
|
642
649
|
_updateInternalValue(t) {
|
|
@@ -648,34 +655,34 @@ let b = class extends R {
|
|
|
648
655
|
}
|
|
649
656
|
// 从HEX颜色值更新HSB值
|
|
650
657
|
_updateHSBFromHex(t) {
|
|
651
|
-
const e = parseInt(t.slice(1, 3), 16) / 255,
|
|
658
|
+
const e = parseInt(t.slice(1, 3), 16) / 255, s = parseInt(t.slice(3, 5), 16) / 255, o = parseInt(t.slice(5, 7), 16) / 255, r = Math.max(e, s, o), i = Math.min(e, s, o), n = r - i;
|
|
652
659
|
let l = 0, a = 0;
|
|
653
660
|
const c = r;
|
|
654
|
-
n !== 0 && (a = n / r, r === e ? l = (
|
|
661
|
+
n !== 0 && (a = n / r, r === e ? l = (s - o) / n % 6 : r === s ? l = (o - e) / n + 2 : l = (e - s) / n + 4, l *= 60, l < 0 && (l += 360)), this._hsb = {
|
|
655
662
|
h: Math.round(l),
|
|
656
663
|
s: Math.round(a * 100),
|
|
657
664
|
b: Math.round(c * 100)
|
|
658
665
|
};
|
|
659
666
|
}
|
|
660
667
|
// 从HSB值生成HEX颜色值
|
|
661
|
-
_generateHexFromHSB(t, e,
|
|
662
|
-
e /= 100,
|
|
663
|
-
const r =
|
|
668
|
+
_generateHexFromHSB(t, e, s, o = "FF") {
|
|
669
|
+
e /= 100, s /= 100;
|
|
670
|
+
const r = s * e, i = r * (1 - Math.abs(t / 60 % 2 - 1)), n = s - r;
|
|
664
671
|
let l = 0, a = 0, c = 0;
|
|
665
|
-
return 0 <= t && t < 60 ? (l = r, a = i, c = 0) : 60 <= t && t < 120 ? (l = i, a = r, c = 0) : 120 <= t && t < 180 ? (l = 0, a = r, c = i) : 180 <= t && t < 240 ? (l = 0, a = i, c = r) : 240 <= t && t < 300 ? (l = i, a = 0, c = r) : 300 <= t && t < 360 && (l = r, a = 0, c = i), l = Math.round((l + n) * 255), a = Math.round((a + n) * 255), c = Math.round((c + n) * 255), "#" + l.toString(16).padStart(2, "0") + a.toString(16).padStart(2, "0") + c.toString(16).padStart(2, "0") +
|
|
672
|
+
return 0 <= t && t < 60 ? (l = r, a = i, c = 0) : 60 <= t && t < 120 ? (l = i, a = r, c = 0) : 120 <= t && t < 180 ? (l = 0, a = r, c = i) : 180 <= t && t < 240 ? (l = 0, a = i, c = r) : 240 <= t && t < 300 ? (l = i, a = 0, c = r) : 300 <= t && t < 360 && (l = r, a = 0, c = i), l = Math.round((l + n) * 255), a = Math.round((a + n) * 255), c = Math.round((c + n) * 255), "#" + l.toString(16).padStart(2, "0") + a.toString(16).padStart(2, "0") + c.toString(16).padStart(2, "0") + o;
|
|
666
673
|
}
|
|
667
674
|
// 计算面板位置
|
|
668
675
|
_updatePanelPosition() {
|
|
669
676
|
requestAnimationFrame(() => {
|
|
670
677
|
const t = this.getBoundingClientRect(), e = this.shadowRoot?.querySelector(".panel");
|
|
671
678
|
if (!e) return;
|
|
672
|
-
const
|
|
679
|
+
const s = 0.15 * 16, o = 8, r = e.offsetWidth || 240, i = e.offsetHeight || 300;
|
|
673
680
|
let n = this.placement, l = this.align;
|
|
674
|
-
this.autoAdjust && (n === "bottom" ? window.innerHeight - t.bottom -
|
|
681
|
+
this.autoAdjust && (n === "bottom" ? window.innerHeight - t.bottom - o < i && t.top - o >= i && (n = "top") : t.top - o < i && window.innerHeight - t.bottom - o >= i && (n = "bottom"), l === "right" ? t.right - s < r && t.left + t.width + s + r <= window.innerWidth && (l = "left") : t.left - s + r > window.innerWidth && t.right - s >= r && (l = "right"));
|
|
675
682
|
let a;
|
|
676
|
-
n === "bottom" ? a = t.height +
|
|
683
|
+
n === "bottom" ? a = t.height + o : a = -i - o;
|
|
677
684
|
let c;
|
|
678
|
-
l === "right" ? c = t.width - r +
|
|
685
|
+
l === "right" ? c = t.width - r + s : c = -s, this._panelPosition = { top: a, left: c };
|
|
679
686
|
});
|
|
680
687
|
}
|
|
681
688
|
// 打开面板
|
|
@@ -701,15 +708,15 @@ let b = class extends R {
|
|
|
701
708
|
this._panelVisible ? this._closePanel() : this._openPanel();
|
|
702
709
|
}
|
|
703
710
|
// 处理HSB颜色变化
|
|
704
|
-
_handleHSBChange(t, e,
|
|
705
|
-
this._hsb = { h: t, s: e, b:
|
|
706
|
-
const
|
|
711
|
+
_handleHSBChange(t, e, s) {
|
|
712
|
+
this._hsb = { h: t, s: e, b: s };
|
|
713
|
+
const o = this._internalValue.slice(7), r = this._generateHexFromHSB(t, e, s, o);
|
|
707
714
|
this._handleColorChange(r);
|
|
708
715
|
}
|
|
709
716
|
// 处理Alpha值变化
|
|
710
717
|
_handleAlphaChange(t) {
|
|
711
|
-
const e = Math.round(t * 255 / 100).toString(16).padStart(2, "0").toUpperCase(),
|
|
712
|
-
this._handleColorChange(
|
|
718
|
+
const e = Math.round(t * 255 / 100).toString(16).padStart(2, "0").toUpperCase(), s = "#" + this._internalValue.slice(1, 7) + e;
|
|
719
|
+
this._handleColorChange(s);
|
|
713
720
|
}
|
|
714
721
|
// 处理颜色变化
|
|
715
722
|
_handleColorChange(t) {
|
|
@@ -723,25 +730,25 @@ let b = class extends R {
|
|
|
723
730
|
}
|
|
724
731
|
// 处理色相选择
|
|
725
732
|
_handleHueChange(t) {
|
|
726
|
-
const e = t.target,
|
|
727
|
-
this._handleHSBChange(
|
|
733
|
+
const e = t.target, s = parseInt(e.value);
|
|
734
|
+
this._handleHSBChange(s, this._hsb.s, this._hsb.b);
|
|
728
735
|
}
|
|
729
736
|
// 处理饱和度和亮度选择
|
|
730
737
|
_handleSBChange(t) {
|
|
731
738
|
const e = this.shadowRoot?.querySelector(".color-sb");
|
|
732
739
|
if (!e) return;
|
|
733
|
-
const
|
|
740
|
+
const s = e.getBoundingClientRect(), o = t instanceof MouseEvent ? t.clientX : t.touches[0].clientX, r = t instanceof MouseEvent ? t.clientY : t.touches[0].clientY, i = Math.max(0, Math.min(100, Math.round((o - s.left) / s.width * 100))), n = Math.max(0, Math.min(100, Math.round((1 - (r - s.top) / s.height) * 100)));
|
|
734
741
|
this._handleHSBChange(this._hsb.h, i, n);
|
|
735
742
|
}
|
|
736
743
|
// 处理透明度选择
|
|
737
744
|
_handleAlphaChangeInput(t) {
|
|
738
|
-
const e = t.target,
|
|
739
|
-
this._handleAlphaChange(
|
|
745
|
+
const e = t.target, s = parseInt(e.value);
|
|
746
|
+
this._handleAlphaChange(s);
|
|
740
747
|
}
|
|
741
748
|
// 渲染触发器
|
|
742
749
|
_renderTrigger() {
|
|
743
750
|
const t = "#" + this._internalValue.slice(1, 7), e = this._internalValue.slice(7);
|
|
744
|
-
return
|
|
751
|
+
return f`
|
|
745
752
|
<div
|
|
746
753
|
class="trigger"
|
|
747
754
|
@click="${this._togglePanel}"
|
|
@@ -751,14 +758,14 @@ let b = class extends R {
|
|
|
751
758
|
class="color-block"
|
|
752
759
|
style="background-color: ${this.disabledAlpha ? t : this._internalValue}"
|
|
753
760
|
></div>
|
|
754
|
-
${this.showText ?
|
|
761
|
+
${this.showText ? f`<div class="color-text">${this.disabledAlpha || e === "FF" ? t : this._internalValue}</div>` : ""}
|
|
755
762
|
</div>
|
|
756
763
|
`;
|
|
757
764
|
}
|
|
758
765
|
// 渲染颜色选择区域
|
|
759
766
|
_renderColorSelector() {
|
|
760
|
-
const t = this._generateHexFromHSB(this._hsb.h, 100, 100, "FF"), e = this._hsb.s / 100 * 100,
|
|
761
|
-
return
|
|
767
|
+
const t = this._generateHexFromHSB(this._hsb.h, 100, 100, "FF"), e = this._hsb.s / 100 * 100, s = (1 - this._hsb.b / 100) * 100;
|
|
768
|
+
return f`
|
|
762
769
|
<div class="color-selector">
|
|
763
770
|
<div
|
|
764
771
|
class="color-sb"
|
|
@@ -775,7 +782,7 @@ let b = class extends R {
|
|
|
775
782
|
class="selector"
|
|
776
783
|
style=${J({
|
|
777
784
|
left: `${e}%`,
|
|
778
|
-
top: `${
|
|
785
|
+
top: `${s}%`
|
|
779
786
|
})}
|
|
780
787
|
></div>
|
|
781
788
|
</div>
|
|
@@ -784,7 +791,7 @@ let b = class extends R {
|
|
|
784
791
|
}
|
|
785
792
|
// 渲染色相选择条
|
|
786
793
|
_renderHueSlider() {
|
|
787
|
-
return
|
|
794
|
+
return f`
|
|
788
795
|
<div class="slider-container">
|
|
789
796
|
<div class="slider hue-slider">
|
|
790
797
|
<input
|
|
@@ -803,7 +810,7 @@ let b = class extends R {
|
|
|
803
810
|
_renderAlphaSlider() {
|
|
804
811
|
if (this.disabledAlpha) return null;
|
|
805
812
|
const t = parseInt(this._internalValue.slice(7), 16) / 255 * 100, e = "#" + this._internalValue.slice(1, 7);
|
|
806
|
-
return
|
|
813
|
+
return f`
|
|
807
814
|
<div class="slider-container">
|
|
808
815
|
<div class="slider alpha-slider">
|
|
809
816
|
<div
|
|
@@ -824,7 +831,7 @@ let b = class extends R {
|
|
|
824
831
|
}
|
|
825
832
|
// 渲染当前颜色显示
|
|
826
833
|
_renderCurrentColor() {
|
|
827
|
-
return
|
|
834
|
+
return f`
|
|
828
835
|
<div class="current-color-container">
|
|
829
836
|
<div
|
|
830
837
|
class="current-color"
|
|
@@ -835,7 +842,7 @@ let b = class extends R {
|
|
|
835
842
|
}
|
|
836
843
|
// 渲染颜色面板
|
|
837
844
|
_renderPanel() {
|
|
838
|
-
return this._panelVisible ?
|
|
845
|
+
return this._panelVisible ? f`
|
|
839
846
|
<div
|
|
840
847
|
class="panel"
|
|
841
848
|
style="top: ${this._panelPosition.top}px; left: ${this._panelPosition.left}px;"
|
|
@@ -854,41 +861,42 @@ let b = class extends R {
|
|
|
854
861
|
` : null;
|
|
855
862
|
}
|
|
856
863
|
render() {
|
|
857
|
-
return
|
|
864
|
+
return f`
|
|
858
865
|
${this._renderTrigger()}
|
|
859
866
|
${this._renderPanel()}
|
|
860
867
|
`;
|
|
861
868
|
}
|
|
862
869
|
};
|
|
863
|
-
|
|
864
|
-
|
|
870
|
+
g.styles = [W, it];
|
|
871
|
+
_([
|
|
865
872
|
h({ type: String })
|
|
866
|
-
],
|
|
867
|
-
|
|
873
|
+
], g.prototype, "value", 2);
|
|
874
|
+
_([
|
|
868
875
|
h({ type: Boolean, reflect: !0 })
|
|
869
|
-
],
|
|
870
|
-
|
|
876
|
+
], g.prototype, "disabled", 2);
|
|
877
|
+
_([
|
|
871
878
|
h({ type: Boolean, reflect: !0, attribute: "disabled-alpha" })
|
|
872
|
-
],
|
|
873
|
-
|
|
879
|
+
], g.prototype, "disabledAlpha", 2);
|
|
880
|
+
_([
|
|
874
881
|
h({ type: Boolean, reflect: !0 })
|
|
875
|
-
],
|
|
876
|
-
|
|
882
|
+
], g.prototype, "open", 2);
|
|
883
|
+
_([
|
|
877
884
|
h({
|
|
878
885
|
attribute: "show-text",
|
|
886
|
+
reflect: !0,
|
|
879
887
|
converter: {
|
|
880
888
|
fromAttribute: (t) => t !== "false",
|
|
881
889
|
toAttribute: (t) => t ? null : "false"
|
|
882
890
|
}
|
|
883
891
|
})
|
|
884
|
-
],
|
|
885
|
-
|
|
892
|
+
], g.prototype, "showText", 2);
|
|
893
|
+
_([
|
|
886
894
|
h({ type: String })
|
|
887
|
-
],
|
|
888
|
-
|
|
895
|
+
], g.prototype, "placement", 2);
|
|
896
|
+
_([
|
|
889
897
|
h({ type: String })
|
|
890
|
-
],
|
|
891
|
-
|
|
898
|
+
], g.prototype, "align", 2);
|
|
899
|
+
_([
|
|
892
900
|
h({
|
|
893
901
|
attribute: "auto-adjust",
|
|
894
902
|
converter: {
|
|
@@ -896,27 +904,27 @@ v([
|
|
|
896
904
|
toAttribute: (t) => t ? null : "false"
|
|
897
905
|
}
|
|
898
906
|
})
|
|
899
|
-
],
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
],
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
],
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
],
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
],
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
],
|
|
915
|
-
const lt =
|
|
916
|
-
var ht = Object.defineProperty, ct = Object.getOwnPropertyDescriptor,
|
|
917
|
-
for (var r =
|
|
918
|
-
(n = t[i]) && (r = (
|
|
919
|
-
return
|
|
907
|
+
], g.prototype, "autoAdjust", 2);
|
|
908
|
+
_([
|
|
909
|
+
w()
|
|
910
|
+
], g.prototype, "_panelVisible", 2);
|
|
911
|
+
_([
|
|
912
|
+
w()
|
|
913
|
+
], g.prototype, "_internalValue", 2);
|
|
914
|
+
_([
|
|
915
|
+
w()
|
|
916
|
+
], g.prototype, "_hsb", 2);
|
|
917
|
+
_([
|
|
918
|
+
w()
|
|
919
|
+
], g.prototype, "_panelPosition", 2);
|
|
920
|
+
g = _([
|
|
921
|
+
T("nf-color-picker")
|
|
922
|
+
], g);
|
|
923
|
+
const lt = E`:host{width:var(--nf-width);position:relative;display:inline-block}:host([disabled]) .input{cursor:not-allowed;color:var(--nf-color-disabled)}:host([disabled]) .toggle-password{cursor:not-allowed;pointer-events:none;opacity:.5}::slotted(*){position:absolute;top:50%;left:.75rem;transform:translateY(-50%);color:var(--nf-color)}:host([disabled]) ::slotted(*){color:var(--nf-color-disabled)}.input{position:absolute;inset:0;padding:var(--nf-input-padding);outline:0;border:none;background:0 0;box-sizing:border-box;color:var(--nf-color);font-size:var(--nf-font-size);font-weight:var(--nf-font-weight);font-family:var(--nf-font-family),sans-serif}.input:has(.toggle-password){padding-right:2.5rem}.input .toggle-password{position:absolute;top:50%;right:.5rem;transform:translateY(-50%);background:0 0;border:none;cursor:pointer;padding:.25rem;display:flex;align-items:center;justify-content:center;color:var(--nf-select-icon-color);transition:color var(--nf-transition-fast) ease;outline:0}.input .toggle-password:hover{color:var(--nf-icon-color-hover)}.input .toggle-password:active{color:var(--nf-icon-color-active)}.input .toggle-password svg{display:block}`;
|
|
924
|
+
var ht = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, O = (t, e, s, o) => {
|
|
925
|
+
for (var r = o > 1 ? void 0 : o ? ct(e, s) : e, i = t.length - 1, n; i >= 0; i--)
|
|
926
|
+
(n = t[i]) && (r = (o ? n(e, s, r) : n(r)) || r);
|
|
927
|
+
return o && r && ht(e, s, r), r;
|
|
920
928
|
};
|
|
921
929
|
let x = class extends R {
|
|
922
930
|
constructor() {
|
|
@@ -964,13 +972,13 @@ let x = class extends R {
|
|
|
964
972
|
}
|
|
965
973
|
render() {
|
|
966
974
|
const t = this.type === "password" && !this.showPassword ? "password" : "text", e = this.type === "password";
|
|
967
|
-
return
|
|
975
|
+
return f`<slot></slot><input class=input type=${t} .value=${this.value} placeholder=${this.placeholder} maxlength=${this.maxLength ?? ""} ?disabled=${this.disabled} @input=${this.onInput} @change=${this.onChange} @keydown=${this.onKeyDown}> ${e ? f`<button class=toggle-password type=button tabindex=-1 @click=${this.togglePasswordVisibility} aria-label=${this.showPassword ? "Hide password" : "Show password"}>${this.showPassword ? this.renderEyeOffIcon() : this.renderEyeIcon()}</button>` : ""}`;
|
|
968
976
|
}
|
|
969
977
|
renderEyeIcon() {
|
|
970
|
-
return
|
|
978
|
+
return f`<svg width=16 height=16 viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx=12 cy=12 r=3 /></svg>`;
|
|
971
979
|
}
|
|
972
980
|
renderEyeOffIcon() {
|
|
973
|
-
return
|
|
981
|
+
return f`<svg width=16 height=16 viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1=1 y1=1 x2=23 y2=23 /></svg>`;
|
|
974
982
|
}
|
|
975
983
|
connectedCallback() {
|
|
976
984
|
this.style.transition = "none", super.connectedCallback(), requestAnimationFrame(() => {
|
|
@@ -978,160 +986,200 @@ let x = class extends R {
|
|
|
978
986
|
});
|
|
979
987
|
}
|
|
980
988
|
};
|
|
981
|
-
x.styles = [
|
|
982
|
-
|
|
989
|
+
x.styles = [W, lt];
|
|
990
|
+
O([
|
|
983
991
|
h({ type: String })
|
|
984
992
|
], x.prototype, "value", 2);
|
|
985
|
-
|
|
993
|
+
O([
|
|
986
994
|
h({ type: String })
|
|
987
995
|
], x.prototype, "placeholder", 2);
|
|
988
|
-
|
|
996
|
+
O([
|
|
989
997
|
h({ type: String })
|
|
990
998
|
], x.prototype, "type", 2);
|
|
991
|
-
|
|
999
|
+
O([
|
|
992
1000
|
h({ type: Number })
|
|
993
1001
|
], x.prototype, "maxLength", 2);
|
|
994
|
-
|
|
1002
|
+
O([
|
|
995
1003
|
h({ type: Boolean, reflect: !0 })
|
|
996
1004
|
], x.prototype, "disabled", 2);
|
|
997
|
-
|
|
998
|
-
|
|
1005
|
+
O([
|
|
1006
|
+
w()
|
|
999
1007
|
], x.prototype, "showPassword", 2);
|
|
1000
|
-
x =
|
|
1001
|
-
|
|
1008
|
+
x = O([
|
|
1009
|
+
T("nf-input")
|
|
1002
1010
|
], x);
|
|
1003
|
-
const dt =
|
|
1004
|
-
var ut = Object.defineProperty, pt = Object.getOwnPropertyDescriptor,
|
|
1005
|
-
for (var r =
|
|
1006
|
-
(n = t[i]) && (r = (
|
|
1007
|
-
return
|
|
1011
|
+
const dt = E`:host{width:var(--nf-width);position:relative;display:inline-flex;align-items:center;box-sizing:border-box;padding:0;overflow:hidden}.input-number{position:relative;padding-right:.6125rem;flex:1;height:100%;outline:0;border:none;background:0 0;box-sizing:border-box;color:var(--nf-color);font-weight:var(--nf-font-weight);text-align:left}.input-number .input-number-input-wrapper{height:100%}.input-number .input-number-input-wrapper .input-number-input{background:0 0;width:100%;height:100%;text-align:start;border:0;outline:0;padding:0;box-sizing:border-box;color:var(--nf-color);font-size:var(--nf-font-size);font-weight:var(--nf-font-weight);font-family:var(--nf-font-family),sans-serif}.input-number::-webkit-inner-spin-button,.input-number::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-number[type=number]{appearance:textfield}.input-number:hover .controls{width:1.5rem}.input-prefix{display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding-inline-start:.6125rem;color:var(--nf-color);font-size:var(--nf-font-size);pointer-events:none;-webkit-user-select:none;user-select:none}.input-prefix:not(:empty){padding-inline-end:.25rem}.input-suffix{display:flex;align-items:center;justify-content:center;color:var(--nf-color);font-size:var(--nf-font-size);pointer-events:none;-webkit-user-select:none;user-select:none}.input-suffix:not(:empty){padding-inline-end:.6125rem;padding-inline-start:.5rem}.controls{position:absolute;top:0;right:0;height:100%;width:0;overflow:hidden;display:flex;flex-direction:column;box-sizing:border-box;transition:width var(--nf-transition-fast) ease}.controls:before{content:\"\";position:absolute;left:0;top:0;bottom:0;width:.67px;background-color:var(--nf-control-divider-color)}:host([suffix]) .controls:after{content:\"\";position:absolute;right:0;top:0;bottom:0;width:.67px;background-color:var(--nf-control-divider-color)}.control-btn{flex:1;display:flex;align-items:center;justify-content:center;background:0 0;border:none;cursor:pointer;transition:background-color var(--nf-transition-fast) ease;outline:0;-webkit-user-select:none;user-select:none}.control-btn:hover{background-color:var(--nf-control-btn-background-hover)}.control-btn:active{background-color:var(--nf-control-btn-background-active)}.control-btn:focus-visible{background-color:var(--nf-control-btn-background-hover)}.control-btn svg{display:block;pointer-events:none;fill:none;stroke:var(--nf-select-icon-color);stroke-width:1;stroke-linecap:round}.control-btn-up{border-bottom:.67px solid var(--nf-control-divider-color)}:host(:not([suffix])) .control-btn-up{border-top-right-radius:var(--nf-border-radius)}:host(:not([suffix])) .control-btn-down{border-bottom-right-radius:var(--nf-border-radius)}:host([disabled]) .input-number-input{cursor:not-allowed;color:var(--nf-color-disabled)}:host([disabled]) .input-prefix,:host([disabled]) .input-suffix{color:var(--nf-color-disabled)}:host([disabled]) .controls{display:none}:host([disabled]) .control-btn{cursor:not-allowed;pointer-events:none;opacity:.5}`;
|
|
1012
|
+
var ut = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, m = (t, e, s, o) => {
|
|
1013
|
+
for (var r = o > 1 ? void 0 : o ? pt(e, s) : e, i = t.length - 1, n; i >= 0; i--)
|
|
1014
|
+
(n = t[i]) && (r = (o ? n(e, s, r) : n(r)) || r);
|
|
1015
|
+
return o && r && ut(e, s, r), r;
|
|
1008
1016
|
};
|
|
1009
|
-
let
|
|
1017
|
+
let p = class extends R {
|
|
1010
1018
|
constructor() {
|
|
1011
|
-
super(...arguments), this.value = 0, this.
|
|
1012
|
-
t.
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
this.isInputFocused = !1;
|
|
1051
|
-
};
|
|
1019
|
+
super(...arguments), this.value = 0, this.formatter = (t) => t === null ? "" : String(t), this.parser = (t) => {
|
|
1020
|
+
if (t.trim().length == 0 || t.endsWith("."))
|
|
1021
|
+
return null;
|
|
1022
|
+
const e = Number(t);
|
|
1023
|
+
return Number.isNaN(e) ? null : this.clampValue(e);
|
|
1024
|
+
}, this.prefix = "", this.suffix = "", this.controls = !0, this.step = 1, this.min = null, this.max = null, this.changeOnWheel = !0, this.disabled = !1, this.noDecimal = !1, this.noZero = !1, this.noNegative = !1, this.text = "", this.isTyping = !1, this.isFocused = !1;
|
|
1025
|
+
}
|
|
1026
|
+
// 对解析结果进行额外验证
|
|
1027
|
+
validateParsed(t) {
|
|
1028
|
+
return t === null || this.noDecimal && !Number.isInteger(t) || this.noZero && t === 0 || this.noNegative && t < 0 ? null : t;
|
|
1029
|
+
}
|
|
1030
|
+
/* ================== 文本设置 ================== */
|
|
1031
|
+
// 验证并设置 text,过滤不合规字符
|
|
1032
|
+
setText(t) {
|
|
1033
|
+
let e = t;
|
|
1034
|
+
if (e = e.replace(/[^0-9+.\-]/g, ""), this.noNegative && (e = e.replace(/[+\-]/g, "")), this.noDecimal && e.includes(".")) {
|
|
1035
|
+
const s = Number(e);
|
|
1036
|
+
Number.isNaN(s) ? e = e.replace(/\./g, "") : e = String(Math.round(s));
|
|
1037
|
+
}
|
|
1038
|
+
return this.text = e, e === t;
|
|
1039
|
+
}
|
|
1040
|
+
/* ================== 生命周期 ================== */
|
|
1041
|
+
willUpdate(t) {
|
|
1042
|
+
t.has("value") && !this.isTyping && this.setText(this.formatter(this.value));
|
|
1043
|
+
}
|
|
1044
|
+
/* ================== 事件处理 ================== */
|
|
1045
|
+
onInput(t) {
|
|
1046
|
+
this.isTyping = !0;
|
|
1047
|
+
const e = t.target.value;
|
|
1048
|
+
this.setText(e) || (t.target.value = this.text);
|
|
1049
|
+
}
|
|
1050
|
+
onBlur() {
|
|
1051
|
+
this.isTyping = !1, this.isFocused = !1;
|
|
1052
|
+
const t = this.validateParsed(this.parser(this.text));
|
|
1053
|
+
t !== null ? (this.value = t, this.setText(this.formatter(t)), this.dispatchEvent(
|
|
1054
|
+
new CustomEvent("change", {
|
|
1055
|
+
detail: t
|
|
1056
|
+
})
|
|
1057
|
+
)) : this.setText(this.formatter(this.value));
|
|
1052
1058
|
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
+
onFocus() {
|
|
1060
|
+
this.isFocused = !0;
|
|
1061
|
+
}
|
|
1062
|
+
onWheel(t) {
|
|
1063
|
+
if (this.disabled || !this.changeOnWheel || !this.isFocused) return;
|
|
1064
|
+
t.preventDefault();
|
|
1065
|
+
const e = t.deltaY < 0 ? 1 : -1;
|
|
1066
|
+
this.handleStepChange(e);
|
|
1059
1067
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1068
|
+
onKeyDown(t) {
|
|
1069
|
+
t.stopPropagation(), t.key === "Enter" && t.target.blur();
|
|
1062
1070
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
const e = t.replace(this.decimalSeparator, "."), o = parseFloat(e);
|
|
1066
|
-
return isNaN(o) ? null : o;
|
|
1071
|
+
onKeyUp(t) {
|
|
1072
|
+
t.stopPropagation();
|
|
1067
1073
|
}
|
|
1074
|
+
/* ================== 提交逻辑 ================== */
|
|
1075
|
+
// 修正浮点误差(保留 12 位有效精度)
|
|
1076
|
+
fixFloatingPoint(t) {
|
|
1077
|
+
return parseFloat(t.toPrecision(12));
|
|
1078
|
+
}
|
|
1079
|
+
// 限制值在 min/max 范围内
|
|
1068
1080
|
clampValue(t) {
|
|
1069
1081
|
let e = t;
|
|
1070
|
-
return this.min !==
|
|
1082
|
+
return this.min !== null && (e = Math.max(e, this.min)), this.max !== null && (e = Math.min(e, this.max)), e;
|
|
1071
1083
|
}
|
|
1084
|
+
// 步进按钮处理
|
|
1072
1085
|
handleStepChange(t) {
|
|
1073
1086
|
if (this.disabled) return;
|
|
1074
|
-
const e = this.
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
), this.dispatchEvent(
|
|
1087
|
+
const e = this.validateParsed(this.parser(this.text));
|
|
1088
|
+
if (e === null)
|
|
1089
|
+
return;
|
|
1090
|
+
this.value = e;
|
|
1091
|
+
let s = this.fixFloatingPoint(this.value + t * this.step);
|
|
1092
|
+
s = this.clampValue(s);
|
|
1093
|
+
const o = this.validateParsed(s);
|
|
1094
|
+
o !== null && (s = o, s !== this.value && (this.value = s, this.setText(this.formatter(s)), this.dispatchEvent(
|
|
1082
1095
|
new CustomEvent("change", {
|
|
1083
|
-
detail:
|
|
1084
|
-
bubbles: !0,
|
|
1085
|
-
composed: !0
|
|
1096
|
+
detail: s
|
|
1086
1097
|
})
|
|
1087
|
-
));
|
|
1098
|
+
)));
|
|
1099
|
+
}
|
|
1100
|
+
connectedCallback() {
|
|
1101
|
+
this.style.transition = "none", super.connectedCallback(), requestAnimationFrame(() => {
|
|
1102
|
+
this.style.transition = "";
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
/* ================== Render ================== */
|
|
1106
|
+
render() {
|
|
1107
|
+
return f`<div class=input-prefix>${this.prefix}</div><div class=input-number><div class=input-number-input-wrapper><input class=input-number-input .value=${this.text} ?disabled=${this.disabled} @blur=${this.onBlur} @focus=${this.onFocus} @input=${this.onInput} @keydown=${this.onKeyDown} @wheel=${this.onWheel} @keyup=${this.onKeyUp}></div>${this.controls ? f`<div class=controls><button class="control-btn control-btn-up"type=button ?disabled=${this.disabled} @click=${() => this.handleStepChange(1)} aria-label="Increase value"><svg width=12 height=12 viewBox="0 0 24 24"><path d="M6 14.6l6-6.6 6 6.6"/></svg></button><button class="control-btn control-btn-down"type=button ?disabled=${this.disabled} @click=${() => this.handleStepChange(-1)} aria-label="Decrease value"><svg width=12 height=12 viewBox="0 0 24 24"><path d="M18 9.4l-6 6.6-6-6.6"/></svg></button></div>` : ""}</div>${this.suffix ? f`<div class=input-suffix>${this.suffix}</div>` : ""}`;
|
|
1088
1108
|
}
|
|
1089
1109
|
};
|
|
1090
|
-
|
|
1091
|
-
|
|
1110
|
+
p.styles = [W, dt];
|
|
1111
|
+
m([
|
|
1092
1112
|
h({ type: Number })
|
|
1093
|
-
],
|
|
1094
|
-
|
|
1095
|
-
h({
|
|
1096
|
-
],
|
|
1097
|
-
|
|
1098
|
-
h({
|
|
1099
|
-
],
|
|
1100
|
-
|
|
1113
|
+
], p.prototype, "value", 2);
|
|
1114
|
+
m([
|
|
1115
|
+
h({ attribute: !1 })
|
|
1116
|
+
], p.prototype, "formatter", 2);
|
|
1117
|
+
m([
|
|
1118
|
+
h({ attribute: !1 })
|
|
1119
|
+
], p.prototype, "parser", 2);
|
|
1120
|
+
m([
|
|
1121
|
+
h({ type: String, reflect: !0 })
|
|
1122
|
+
], p.prototype, "prefix", 2);
|
|
1123
|
+
m([
|
|
1124
|
+
h({ type: String, reflect: !0 })
|
|
1125
|
+
], p.prototype, "suffix", 2);
|
|
1126
|
+
m([
|
|
1127
|
+
h({
|
|
1128
|
+
type: Boolean,
|
|
1129
|
+
converter: {
|
|
1130
|
+
fromAttribute: (t) => t !== "false" && t !== null,
|
|
1131
|
+
toAttribute: (t) => t ? "" : null
|
|
1132
|
+
}
|
|
1133
|
+
})
|
|
1134
|
+
], p.prototype, "controls", 2);
|
|
1135
|
+
m([
|
|
1101
1136
|
h({ type: Number })
|
|
1102
|
-
],
|
|
1103
|
-
|
|
1137
|
+
], p.prototype, "step", 2);
|
|
1138
|
+
m([
|
|
1104
1139
|
h({ type: Number })
|
|
1105
|
-
],
|
|
1106
|
-
|
|
1140
|
+
], p.prototype, "min", 2);
|
|
1141
|
+
m([
|
|
1107
1142
|
h({ type: Number })
|
|
1108
|
-
],
|
|
1109
|
-
|
|
1110
|
-
h({
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1143
|
+
], p.prototype, "max", 2);
|
|
1144
|
+
m([
|
|
1145
|
+
h({
|
|
1146
|
+
type: Boolean,
|
|
1147
|
+
attribute: "change-on-wheel",
|
|
1148
|
+
converter: {
|
|
1149
|
+
fromAttribute: (t) => t !== "false" && t !== null,
|
|
1150
|
+
toAttribute: (t) => t ? "" : null
|
|
1151
|
+
}
|
|
1152
|
+
})
|
|
1153
|
+
], p.prototype, "changeOnWheel", 2);
|
|
1154
|
+
m([
|
|
1119
1155
|
h({ type: Boolean, reflect: !0 })
|
|
1120
|
-
],
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
],
|
|
1124
|
-
m
|
|
1125
|
-
|
|
1126
|
-
],
|
|
1156
|
+
], p.prototype, "disabled", 2);
|
|
1157
|
+
m([
|
|
1158
|
+
h({ type: Boolean, attribute: "no-decimal" })
|
|
1159
|
+
], p.prototype, "noDecimal", 2);
|
|
1160
|
+
m([
|
|
1161
|
+
h({ type: Boolean, attribute: "no-zero" })
|
|
1162
|
+
], p.prototype, "noZero", 2);
|
|
1163
|
+
m([
|
|
1164
|
+
h({ type: Boolean, attribute: "no-negative" })
|
|
1165
|
+
], p.prototype, "noNegative", 2);
|
|
1166
|
+
m([
|
|
1167
|
+
w()
|
|
1168
|
+
], p.prototype, "text", 2);
|
|
1169
|
+
m([
|
|
1170
|
+
w()
|
|
1171
|
+
], p.prototype, "isFocused", 2);
|
|
1172
|
+
p = m([
|
|
1173
|
+
T("nf-input-number")
|
|
1174
|
+
], p);
|
|
1127
1175
|
async function ft(t) {
|
|
1128
1176
|
return new Promise((e) => setTimeout(e, t));
|
|
1129
1177
|
}
|
|
1130
|
-
const bt =
|
|
1131
|
-
var mt = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, K = (t, e,
|
|
1132
|
-
for (var r =
|
|
1133
|
-
(n = t[i]) && (r = (
|
|
1134
|
-
return
|
|
1178
|
+
const bt = E`:host{width:var(--nf-width);-webkit-user-select:none;user-select:none;cursor:pointer}:host .text{flex-grow:1;display:inline-block;outline:0;white-space:nowrap}:host .icon{width:1.5rem;height:1.5rem;display:inline-block;fill:none;stroke:var(--nf-select-icon-color);stroke-width:1;stroke-linecap:round;margin:0 -.3rem 0 .5rem}:host .dropdown{position:absolute;top:2rem;right:0;left:0;padding:.3rem;background:var(--nf-dropdown-background);-webkit-backdrop-filter:blur(32px);backdrop-filter:blur(32px);border-radius:.5rem;opacity:0;pointer-events:none;color:var(--nf-color);box-shadow:0 0 1rem 0 var(--nf-dropdown-shadow);z-index:1000;transition:opacity var(--nf-transition) ease-out,transform var(--nf-transition) ease-out}:host .dropdown .item{white-space:nowrap;padding:.4rem .7rem;overflow:hidden;text-overflow:ellipsis;border-radius:.3rem;cursor:pointer}:host .dropdown .item-unselected:hover{background:var(--nf-item-background-hover);transition:background-color var(--nf-transition) ease-in-out}:host .dropdown .item-unselected:active{background:var(--nf-item-background-active)}:host .dropdown .item-selected{background-color:color-mix(in srgb,var(--nf-primary-color) 30%,transparent)}:host([disabled]){cursor:not-allowed}:host([disabled]) .text{color:var(--nf-color-disabled)}:host([disabled]) .icon{stroke:var(--nf-color-disabled)}:host([disabled]) .dropdown{display:none}:host(:focus:not([disabled])){color:var(--nf-focus-text-color)}:host(:focus:not([disabled])) .dropdown{transform:translateY(.5rem);opacity:1;pointer-events:auto}:host(:focus:not([disabled])) .cover{pointer-events:auto}`;
|
|
1179
|
+
var mt = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, K = (t, e, s, o) => {
|
|
1180
|
+
for (var r = o > 1 ? void 0 : o ? gt(e, s) : e, i = t.length - 1, n; i >= 0; i--)
|
|
1181
|
+
(n = t[i]) && (r = (o ? n(e, s, r) : n(r)) || r);
|
|
1182
|
+
return o && r && mt(e, s, r), r;
|
|
1135
1183
|
};
|
|
1136
1184
|
let M = class extends R {
|
|
1137
1185
|
constructor() {
|
|
@@ -1155,10 +1203,10 @@ let M = class extends R {
|
|
|
1155
1203
|
this.dispatchEvent(new CustomEvent("input", { detail: t, bubbles: !0, composed: !0 })), this.value !== t && this.dispatchEvent(new CustomEvent("change", { detail: t, bubbles: !0, composed: !0 })), await ft(34), this.blur();
|
|
1156
1204
|
}
|
|
1157
1205
|
render() {
|
|
1158
|
-
const t = this.options.findIndex((
|
|
1159
|
-
return
|
|
1160
|
-
(
|
|
1161
|
-
)}</div><slot></slot><div class=text>${e}</div><svg class=icon height=24 viewBox="0 0 24 24"
|
|
1206
|
+
const t = this.options.findIndex((s) => s.value == this.value), e = t > -1 ? this.options[t]?.label : this.value;
|
|
1207
|
+
return f`<div class=dropdown>${(this.showDropdown ? this.options : []).map(
|
|
1208
|
+
(s) => f`<div @click=${() => this.set(s.value)} class="item ${this.value == s.value ? "item-selected" : "item-unselected"}">${s.label}</div>`
|
|
1209
|
+
)}</div><slot></slot><div class=text>${e}</div><svg class=icon width=24 height=24 viewBox="0 0 24 24"><path d="M17 10l-5 5.5-5-5.5"/></svg>`;
|
|
1162
1210
|
}
|
|
1163
1211
|
connectedCallback() {
|
|
1164
1212
|
this.style.transition = "none", super.connectedCallback(), this.disabled || (this.tabIndex = 0), this.addEventListener("focus", this.onFocus), this.addEventListener("blur", this.onBlur), this.addEventListener("click", this.onClick), requestAnimationFrame(() => {
|
|
@@ -1169,7 +1217,7 @@ let M = class extends R {
|
|
|
1169
1217
|
super.disconnectedCallback(), this.removeEventListener("focus", this.onFocus), this.removeEventListener("blur", this.onBlur), this.removeEventListener("click", this.onClick);
|
|
1170
1218
|
}
|
|
1171
1219
|
};
|
|
1172
|
-
M.styles = [
|
|
1220
|
+
M.styles = [W, bt];
|
|
1173
1221
|
K([
|
|
1174
1222
|
h({ type: String })
|
|
1175
1223
|
], M.prototype, "value", 2);
|
|
@@ -1193,18 +1241,18 @@ K([
|
|
|
1193
1241
|
h({ type: Boolean, reflect: !0 })
|
|
1194
1242
|
], M.prototype, "disabled", 2);
|
|
1195
1243
|
K([
|
|
1196
|
-
|
|
1244
|
+
w()
|
|
1197
1245
|
], M.prototype, "showDropdown", 2);
|
|
1198
1246
|
M = K([
|
|
1199
|
-
|
|
1247
|
+
T("nf-select")
|
|
1200
1248
|
], M);
|
|
1201
|
-
const vt =
|
|
1202
|
-
var _t = Object.defineProperty,
|
|
1203
|
-
for (var r =
|
|
1204
|
-
(n = t[i]) && (r = (
|
|
1205
|
-
return
|
|
1249
|
+
const vt = E`:host{display:inline-flex;align-items:center;cursor:pointer;-webkit-user-select:none;user-select:none;outline:0}:host[disabled]{cursor:not-allowed;opacity:.6}.switch-wrapper{position:relative;display:inline-block}.switch-container{position:relative;z-index:1;width:3.1rem;height:1.5rem;background-color:var(--nf-background-color);border-radius:.75rem;transition:background-color .2s ease;overflow:hidden}:host(:not([disabled]):not([checked])) .switch-container:hover{background:var(--nf-background-color-hover)}:host([checked]) .switch-container{background-color:var(--nf-primary-color,var(--nf-primary-color))}:host([disabled]) .switch-container{opacity:.5}.ripple{position:absolute;border-radius:.875rem;inset:-.2rem;background-color:#6464641a;animation:ripple-animation 1s ease-out forwards;pointer-events:none;opacity:1}@keyframes ripple-animation{0%{opacity:0}20%{opacity:1}to{opacity:0}}.switch-thumb{position:absolute;top:.125rem;left:0;width:1.25rem;height:1.25rem;transition:transform .2s ease-in-out}.switch-thumb:before{content:\"\";position:absolute;top:0;left:0;width:1.25rem;height:1.25rem;background-color:#fff;border-radius:.625rem;box-shadow:0 .125rem .25rem #0003;transition:width .2s ease-in-out,transform .2s ease-in-out}:host(:not([checked])) .switch-thumb{transform:translate(.125rem)}:host(:not([checked])) .switch-container:active .switch-thumb:before{width:1.625rem;border-radius:.625rem}:host([checked]) .switch-thumb{transform:translate(1.725rem)}:host([checked]) .switch-container:active .switch-thumb:before{width:1.625rem;border-radius:.625rem;transform:translate(-.375rem)}:host(:focus) .switch-container{outline:.125rem solid var(--nf-primary-color,var(--nf-primary-color));outline-offset:.125rem}`;
|
|
1250
|
+
var _t = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, he = (t, e, s, o) => {
|
|
1251
|
+
for (var r = o > 1 ? void 0 : o ? yt(e, s) : e, i = t.length - 1, n; i >= 0; i--)
|
|
1252
|
+
(n = t[i]) && (r = (o ? n(e, s, r) : n(r)) || r);
|
|
1253
|
+
return o && r && _t(e, s, r), r;
|
|
1206
1254
|
};
|
|
1207
|
-
let
|
|
1255
|
+
let I = class extends V {
|
|
1208
1256
|
constructor() {
|
|
1209
1257
|
super(...arguments), this.checked = !1, this.disabled = !1, this.rippleElement = null;
|
|
1210
1258
|
}
|
|
@@ -1221,35 +1269,40 @@ let j = class extends T {
|
|
|
1221
1269
|
createRipple(t) {
|
|
1222
1270
|
const e = this.shadowRoot?.querySelector(".switch-wrapper");
|
|
1223
1271
|
if (!e) return;
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1228
|
-
e.contains(
|
|
1272
|
+
const s = e.querySelector(".ripple");
|
|
1273
|
+
s && e.removeChild(s);
|
|
1274
|
+
const o = document.createElement("div");
|
|
1275
|
+
o.classList.add("ripple"), e.appendChild(o), o.addEventListener("animationend", () => {
|
|
1276
|
+
e.contains(o) && e.removeChild(o);
|
|
1229
1277
|
});
|
|
1230
1278
|
}
|
|
1231
1279
|
// 渲染开关组件
|
|
1232
1280
|
render() {
|
|
1233
|
-
return
|
|
1281
|
+
return se`<div class=switch-wrapper><div class=switch-container @click=${this.toggleSwitch} aria-checked=${this.checked} aria-disabled=${this.disabled} role=switch><div class=switch-thumb></div></div></div>`;
|
|
1282
|
+
}
|
|
1283
|
+
connectedCallback() {
|
|
1284
|
+
this.style.transition = "none", super.connectedCallback(), requestAnimationFrame(() => {
|
|
1285
|
+
this.style.transition = "";
|
|
1286
|
+
});
|
|
1234
1287
|
}
|
|
1235
1288
|
};
|
|
1236
|
-
|
|
1289
|
+
I.styles = [vt];
|
|
1237
1290
|
he([
|
|
1238
1291
|
h({ type: Boolean, reflect: !0 })
|
|
1239
|
-
],
|
|
1292
|
+
], I.prototype, "checked", 2);
|
|
1240
1293
|
he([
|
|
1241
1294
|
h({ type: Boolean, reflect: !0 })
|
|
1242
|
-
],
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
],
|
|
1246
|
-
const
|
|
1247
|
-
var $t = Object.defineProperty, xt = Object.getOwnPropertyDescriptor,
|
|
1248
|
-
for (var r =
|
|
1249
|
-
(n = t[i]) && (r = (
|
|
1250
|
-
return
|
|
1295
|
+
], I.prototype, "disabled", 2);
|
|
1296
|
+
I = he([
|
|
1297
|
+
T("nf-switch")
|
|
1298
|
+
], I);
|
|
1299
|
+
const wt = E`:host{display:inline-flex;align-items:center;position:relative;width:100%;height:1.25rem;background-color:var(--nf-border-color,#e0e0e0);border-radius:.625rem;cursor:pointer;-webkit-user-select:none;user-select:none;border:none;box-shadow:none;padding:0}:host:hover{background-color:var(--nf-border-color,#e0e0e0);border:none}:host:focus{box-shadow:none;outline:0}:host([disabled]){cursor:not-allowed;opacity:.6}.slider-fill{position:absolute;left:0;top:0;height:100%;background-color:var(--nf-primary-color,#5e72f9);border-radius:.625rem 0 0 .625rem;pointer-events:none}.slider-handle{position:absolute;width:1.25rem;height:1.25rem;background-color:#fff;border-radius:50%;top:50%;transform:translate(-50%,-50%);cursor:grab;outline:0;box-shadow:0 1px 3px #0000004d;transition:transform .15s ease,box-shadow .15s ease;z-index:1}:host([disabled]) .slider-handle{cursor:not-allowed}:host(:not([disabled])) .slider-handle:hover{transform:translate(-50%,-50%) scale(1.05)}:host(:not([disabled])) .slider-handle:active{cursor:grabbing;transform:translate(-50%,-50%) scale(1.15);box-shadow:0 3px 8px #0006}.slider-handle:focus{box-shadow:0 0 0 3px #5e72f94d}.slider-tooltip{position:absolute;bottom:calc(100% + .5rem);left:50%;transform:translate(-50%);background-color:var(--nf-slider-tooltip-background);color:var(--nf-color);padding:.25rem .5rem;border-radius:.25rem;font-size:.75rem;white-space:nowrap;opacity:0;transition:opacity .2s ease;pointer-events:none;box-shadow:0 0 .4rem .1rem #0000001a}.slider-tooltip.visible{opacity:1}`;
|
|
1300
|
+
var $t = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, y = (t, e, s, o) => {
|
|
1301
|
+
for (var r = o > 1 ? void 0 : o ? xt(e, s) : e, i = t.length - 1, n; i >= 0; i--)
|
|
1302
|
+
(n = t[i]) && (r = (o ? n(e, s, r) : n(r)) || r);
|
|
1303
|
+
return o && r && $t(e, s, r), r;
|
|
1251
1304
|
};
|
|
1252
|
-
let
|
|
1305
|
+
let v = class extends R {
|
|
1253
1306
|
constructor() {
|
|
1254
1307
|
super(...arguments), this.value = 0, this.defaultValue = 0, this.min = 0, this.max = 100, this.step = 1, this.disabled = !1, this.range = !1, this.tooltip = !1, this._currentValue = 0, this._isDragging = !1, this._showTooltip = !1, this._handleHostMouseDown = (t) => {
|
|
1255
1308
|
this.disabled || (t.preventDefault(), this._startDrag(t));
|
|
@@ -1268,7 +1321,9 @@ let g = class extends R {
|
|
|
1268
1321
|
};
|
|
1269
1322
|
}
|
|
1270
1323
|
connectedCallback() {
|
|
1271
|
-
super.connectedCallback(), this._currentValue = this.value || this.defaultValue, this.addEventListener("mousedown", this._handleHostMouseDown), this.addEventListener("touchstart", this._handleHostTouchStart)
|
|
1324
|
+
this.style.transition = "none", super.connectedCallback(), this._currentValue = this.value || this.defaultValue, this.addEventListener("mousedown", this._handleHostMouseDown), this.addEventListener("touchstart", this._handleHostTouchStart), requestAnimationFrame(() => {
|
|
1325
|
+
this.style.transition = "";
|
|
1326
|
+
});
|
|
1272
1327
|
}
|
|
1273
1328
|
disconnectedCallback() {
|
|
1274
1329
|
super.disconnectedCallback(), this.removeEventListener("mousedown", this._handleHostMouseDown), this.removeEventListener("touchstart", this._handleHostTouchStart), document.removeEventListener("mousemove", this._handleDrag), document.removeEventListener("touchmove", this._handleDrag), document.removeEventListener("mouseup", this._stopDrag), document.removeEventListener("touchend", this._stopDrag);
|
|
@@ -1318,7 +1373,7 @@ let g = class extends R {
|
|
|
1318
1373
|
this._isDragging = !0, this._showTooltip = !0, this._updateValue(t), document.addEventListener("mousemove", this._handleDrag), document.addEventListener("touchmove", this._handleDrag, { passive: !1 }), document.addEventListener("mouseup", this._stopDrag), document.addEventListener("touchend", this._stopDrag);
|
|
1319
1374
|
}
|
|
1320
1375
|
_updateValue(t) {
|
|
1321
|
-
const e = this.getBoundingClientRect(),
|
|
1376
|
+
const e = this.getBoundingClientRect(), s = t instanceof MouseEvent ? t.clientX : t.touches[0].clientX, o = Math.max(0, Math.min(1, (s - e.left) / e.width)), r = this.max - this.min, i = this.min + o * r, n = Math.round((i - this.min) / this.step), l = this.min + n * this.step;
|
|
1322
1377
|
this._currentValue = Math.min(this.max, Math.max(this.min, l)), this.requestUpdate();
|
|
1323
1378
|
}
|
|
1324
1379
|
_getValuePercentage() {
|
|
@@ -1326,53 +1381,53 @@ let g = class extends R {
|
|
|
1326
1381
|
return t === 0 ? 0 : (this._currentValue - this.min) / t * 100;
|
|
1327
1382
|
}
|
|
1328
1383
|
render() {
|
|
1329
|
-
const t = this._getValuePercentage(), e = `${t}%`,
|
|
1330
|
-
return
|
|
1384
|
+
const t = this._getValuePercentage(), e = `${t}%`, s = `${t}%`, o = `slider-tooltip ${this._showTooltip || this.tooltip ? "visible" : ""}`;
|
|
1385
|
+
return f`<div class=slider-fill style=${J({ width: s })}></div><div class=slider-handle style=${J({ left: e })} tabindex=${this.disabled ? -1 : 0} @mousedown=${this._handleMouseDown} @touchstart=${this._handleTouchStart} @keydown=${this._handleKeyDown}><div class=${o}>${this._currentValue}</div></div>`;
|
|
1331
1386
|
}
|
|
1332
1387
|
};
|
|
1333
|
-
|
|
1334
|
-
|
|
1388
|
+
v.styles = [W, wt];
|
|
1389
|
+
y([
|
|
1335
1390
|
h({ type: Number })
|
|
1336
|
-
],
|
|
1337
|
-
|
|
1391
|
+
], v.prototype, "value", 2);
|
|
1392
|
+
y([
|
|
1338
1393
|
h({ type: Number })
|
|
1339
|
-
],
|
|
1340
|
-
|
|
1394
|
+
], v.prototype, "defaultValue", 2);
|
|
1395
|
+
y([
|
|
1341
1396
|
h({ type: Number })
|
|
1342
|
-
],
|
|
1343
|
-
|
|
1397
|
+
], v.prototype, "min", 2);
|
|
1398
|
+
y([
|
|
1344
1399
|
h({ type: Number })
|
|
1345
|
-
],
|
|
1346
|
-
|
|
1400
|
+
], v.prototype, "max", 2);
|
|
1401
|
+
y([
|
|
1347
1402
|
h({ type: Number })
|
|
1348
|
-
],
|
|
1349
|
-
|
|
1403
|
+
], v.prototype, "step", 2);
|
|
1404
|
+
y([
|
|
1350
1405
|
h({ type: Boolean, reflect: !0 })
|
|
1351
|
-
],
|
|
1352
|
-
|
|
1406
|
+
], v.prototype, "disabled", 2);
|
|
1407
|
+
y([
|
|
1353
1408
|
h({ type: Boolean })
|
|
1354
|
-
],
|
|
1355
|
-
|
|
1409
|
+
], v.prototype, "range", 2);
|
|
1410
|
+
y([
|
|
1356
1411
|
h({ type: Boolean })
|
|
1357
|
-
],
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
],
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
],
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
],
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
],
|
|
1412
|
+
], v.prototype, "tooltip", 2);
|
|
1413
|
+
y([
|
|
1414
|
+
w()
|
|
1415
|
+
], v.prototype, "_currentValue", 2);
|
|
1416
|
+
y([
|
|
1417
|
+
w()
|
|
1418
|
+
], v.prototype, "_isDragging", 2);
|
|
1419
|
+
y([
|
|
1420
|
+
w()
|
|
1421
|
+
], v.prototype, "_showTooltip", 2);
|
|
1422
|
+
v = y([
|
|
1423
|
+
T("nf-slider")
|
|
1424
|
+
], v);
|
|
1370
1425
|
export {
|
|
1371
1426
|
z as NfCheckboxElement,
|
|
1372
|
-
|
|
1427
|
+
g as NfColorPickerElement,
|
|
1373
1428
|
x as NfInputElement,
|
|
1374
|
-
|
|
1429
|
+
p as NfInputNumberElement,
|
|
1375
1430
|
M as NfSelectElement,
|
|
1376
|
-
|
|
1377
|
-
|
|
1431
|
+
v as NfSliderElement,
|
|
1432
|
+
I as NfSwitchElement
|
|
1378
1433
|
};
|