litos-ui 0.16.2 → 0.17.1
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/lib/base.d.ts +11 -2
- package/lib/base.js +59 -27
- package/lib/button/index.d.ts +18 -3
- package/lib/button/index.js +65 -67
- package/lib/check/check.d.ts +13 -5
- package/lib/check/check.js +61 -33
- package/lib/check/checkbox.js +3 -3
- package/lib/check/checkbox_group.d.ts +0 -1
- package/lib/check/checkbox_group.js +3 -7
- package/lib/check/index.d.ts +12 -8
- package/lib/check/index.js +40 -47
- package/lib/check/radio.js +6 -6
- package/lib/check/radio_group.d.ts +0 -2
- package/lib/check/radio_group.js +3 -10
- package/lib/check-CksURvTv.js +4 -0
- package/lib/color_picker/index.js +1 -1
- package/lib/form/form_inner.d.ts +17 -10
- package/lib/form/form_inner.js +82 -65
- package/lib/form/form_item.d.ts +23 -23
- package/lib/form/form_item.js +108 -89
- package/lib/form/index.d.ts +21 -14
- package/lib/form/index.js +97 -73
- package/lib/form/types.d.ts +7 -0
- package/lib/form/types.js +1 -0
- package/lib/index-CrMiSe0x.js +249 -0
- package/lib/index-DY6m9Wbe.js +4 -0
- package/lib/index.js +162 -160
- package/lib/input/index.d.ts +24 -25
- package/lib/input/index.js +115 -99
- package/lib/modal/index.js +1 -1
- package/lib/select_ori/index.js +1 -1
- package/lib/utils/context_provide.d.ts +9 -0
- package/lib/utils/context_provide.js +22 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +41 -33
- package/package.json +8 -8
- package/lib/check-D-KVLA1z.js +0 -4
- package/lib/index-DvcllHRh.js +0 -4
- package/lib/utils/event.d.ts +0 -30
package/lib/input/index.js
CHANGED
|
@@ -1,90 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
class j extends v {
|
|
1
|
+
import { $one as c, on as h, formatStyle as f, off as p, addClass as o, removeClass as u, $ as d, $$ as n } from "ph-utils/dom";
|
|
2
|
+
import { unitNumberStr as b, parseAttrValue as m } from "../utils/index.js";
|
|
3
|
+
import g from "../form/form_inner.js";
|
|
4
|
+
import { i as _ } from "../index-DY6m9Wbe.js";
|
|
5
|
+
class I extends g {
|
|
7
6
|
static baseName = "input";
|
|
8
|
-
/** 原生 input 的 type */
|
|
9
|
-
type = "text";
|
|
10
|
-
placeholder = void 0;
|
|
11
|
-
autosize = !1;
|
|
12
|
-
/** 限制输入类型, number, integer */
|
|
13
|
-
allowInput = void 0;
|
|
14
7
|
/** 自定义输入解析器 */
|
|
15
8
|
parser;
|
|
16
|
-
/** 宽度 */
|
|
17
|
-
width;
|
|
18
|
-
/** 宽度铺满 */
|
|
19
|
-
block = !1;
|
|
20
|
-
error = !1;
|
|
21
|
-
maxlength;
|
|
22
|
-
minlength;
|
|
23
|
-
inputmode = "text";
|
|
24
9
|
$inner;
|
|
25
|
-
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this._state = {
|
|
12
|
+
type: "text",
|
|
13
|
+
placeholder: "",
|
|
14
|
+
autosize: !1,
|
|
15
|
+
allowInput: void 0,
|
|
16
|
+
block: !1,
|
|
17
|
+
clearable: !1
|
|
18
|
+
};
|
|
19
|
+
}
|
|
26
20
|
set value(t) {
|
|
27
21
|
this.setValue(t), this.$inner && (this.$inner.value = t);
|
|
28
22
|
}
|
|
29
23
|
get value() {
|
|
30
24
|
return this.getValue();
|
|
31
25
|
}
|
|
32
|
-
get clearable() {
|
|
33
|
-
return this.#t;
|
|
34
|
-
}
|
|
35
|
-
set clearable(t) {
|
|
36
|
-
this.#t = t, t ? d(this, "l-input--clearable") : p(this, "l-input--clearable");
|
|
37
|
-
}
|
|
38
26
|
static get observedAttributes() {
|
|
39
|
-
return [
|
|
27
|
+
return [
|
|
28
|
+
"disabled",
|
|
29
|
+
"value",
|
|
30
|
+
"name",
|
|
31
|
+
"inner-block",
|
|
32
|
+
"error",
|
|
33
|
+
"clearable",
|
|
34
|
+
"maxlength",
|
|
35
|
+
"minlength",
|
|
36
|
+
"inputmode",
|
|
37
|
+
"type",
|
|
38
|
+
"placeholder",
|
|
39
|
+
"width",
|
|
40
|
+
"block"
|
|
41
|
+
];
|
|
40
42
|
}
|
|
41
43
|
connectedCallback() {
|
|
42
|
-
|
|
44
|
+
this.loadStyleText([_]), super.connectedCallback(), this.$inner = c(".l-input__inner", this.root), h(this.$inner, "input", this._input), h(this.$inner, "change", this.#s), this.style.cssText = f(this._getStyleObj()) + this.getAttr("style", ""), this._updateError(this._state.error != null);
|
|
43
45
|
}
|
|
44
46
|
disconnectedCallback() {
|
|
45
|
-
super.disconnectedCallback(),
|
|
46
|
-
}
|
|
47
|
-
attributeChange(t,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
super.disconnectedCallback(), p(this.$inner, "input", this._input);
|
|
48
|
+
}
|
|
49
|
+
attributeChange(t, s, e) {
|
|
50
|
+
switch (t) {
|
|
51
|
+
case "error":
|
|
52
|
+
case "maxlength":
|
|
53
|
+
case "minlength":
|
|
54
|
+
case "inputmode":
|
|
55
|
+
case "placeholder":
|
|
56
|
+
case "type":
|
|
57
|
+
this._state[t] = e;
|
|
58
|
+
break;
|
|
59
|
+
case "clearable":
|
|
60
|
+
case "block":
|
|
61
|
+
const a = m(e, !1, t);
|
|
62
|
+
this._state[t] = a;
|
|
63
|
+
break;
|
|
64
|
+
case "width":
|
|
65
|
+
this._state.width = b(e);
|
|
66
|
+
break;
|
|
58
67
|
}
|
|
59
68
|
}
|
|
69
|
+
updateDOM(t) {
|
|
70
|
+
t.has("clearable") && (this._state.clearable ? o(this, "l-input--clearable") : u(this, "l-input--clearable")), t.has("error") && this._updateError(this._state.error != null), t.has("maxlength") && this._updateAttr("maxlength", this._state.maxlength), t.has("minlength") && this._updateAttr("minlength", this._state.minlength), t.has("inputmode") && this._updateAttr("inputmode", this._state.inputmode), t.has("block") && this.innerBlockChange(this._state.block);
|
|
71
|
+
}
|
|
72
|
+
_updateAttr(t, s) {
|
|
73
|
+
this.$inner && (s ? this.$inner.setAttribute(t, s) : this.$inner.removeAttribute(t));
|
|
74
|
+
}
|
|
60
75
|
render() {
|
|
61
76
|
const t = document.createDocumentFragment();
|
|
62
|
-
if (
|
|
63
|
-
const i =
|
|
77
|
+
if (d('[slot="prefix"]', this).length > 0) {
|
|
78
|
+
const i = n("slot", {
|
|
64
79
|
name: "prefix"
|
|
65
|
-
}),
|
|
80
|
+
}), l = n("span", {
|
|
66
81
|
class: "l-input__prefix",
|
|
67
82
|
part: "prefix"
|
|
68
83
|
});
|
|
69
|
-
|
|
84
|
+
l.appendChild(i), t.appendChild(l);
|
|
70
85
|
}
|
|
71
|
-
const e =
|
|
86
|
+
const e = n("input", {
|
|
72
87
|
class: "l-input__inner",
|
|
73
88
|
value: this.value,
|
|
74
|
-
name: this.getName()
|
|
75
|
-
placeholder: this.placeholder
|
|
89
|
+
name: this.getName(),
|
|
90
|
+
placeholder: this._state.placeholder,
|
|
76
91
|
part: "default",
|
|
77
|
-
type: this.type,
|
|
78
|
-
inputmode: this.inputmode
|
|
92
|
+
type: this._state.type,
|
|
93
|
+
inputmode: this._state.inputmode,
|
|
94
|
+
maxlength: this._state.maxlength,
|
|
95
|
+
minlength: this._state.minlength,
|
|
96
|
+
disabled: this.isDisabled() ? !0 : void 0
|
|
79
97
|
});
|
|
80
|
-
if (
|
|
81
|
-
const i =
|
|
98
|
+
if (t.appendChild(e), d('[slot="suffix"]', this).length > 0) {
|
|
99
|
+
const i = n("slot", {
|
|
82
100
|
name: "suffix"
|
|
83
|
-
}),
|
|
101
|
+
}), l = n("span", {
|
|
84
102
|
class: "l-input__suffix",
|
|
85
103
|
part: "suffix"
|
|
86
104
|
});
|
|
87
|
-
|
|
105
|
+
l.appendChild(i), t.appendChild(l);
|
|
88
106
|
}
|
|
89
107
|
return t;
|
|
90
108
|
}
|
|
@@ -95,94 +113,92 @@ class j extends v {
|
|
|
95
113
|
setParser(t) {
|
|
96
114
|
this.parser = t;
|
|
97
115
|
}
|
|
116
|
+
_calcCurosorPosition(t, s) {
|
|
117
|
+
const e = t.selectionStart || 0, a = t.selectionEnd || 0, i = t.value;
|
|
118
|
+
let l = e, r = a;
|
|
119
|
+
s.length < i.length ? (l = Math.max(0, e - (i.length - s.length)), r = l) : s.length > i.length ? (l = Math.min(s.length, e + (s.length - i.length)), r = l) : (l = Math.min(s.length, e), r = l), t.value = s, t.setSelectionRange(l, r);
|
|
120
|
+
}
|
|
98
121
|
_input = (t) => {
|
|
99
|
-
const
|
|
100
|
-
let e =
|
|
101
|
-
if (this.allowInput != null) {
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
integer: this.allowInput.includes("integer"),
|
|
105
|
-
negative: this.allowInput.startsWith("-"),
|
|
106
|
-
precision:
|
|
107
|
-
}),
|
|
122
|
+
const s = t.target;
|
|
123
|
+
let e = s.value, a = e;
|
|
124
|
+
if (this._state.allowInput != null) {
|
|
125
|
+
let i = this._state.allowInput.indexOf("."), l = i === -1 ? i : parseInt(this._state.allowInput.substring(i + 1));
|
|
126
|
+
a = this._numberInputParse(e, {
|
|
127
|
+
integer: this._state.allowInput.includes("integer"),
|
|
128
|
+
negative: this._state.allowInput.startsWith("-"),
|
|
129
|
+
precision: l
|
|
130
|
+
}), a = String(a);
|
|
108
131
|
}
|
|
109
|
-
this.parser != null && (
|
|
110
|
-
const i = l.selectionStart || 0, r = l.selectionEnd;
|
|
111
|
-
let n = i, h = r;
|
|
112
|
-
s.length < e.length ? (n = Math.max(0, i - (e.length - s.length)), h = n) : s.length > e.length ? (n = Math.min(s.length, i + (s.length - e.length)), h = n) : (n = Math.min(s.length, i), h = n), l.value = s, l.setSelectionRange(n, h), this.setValue(s), this.#e();
|
|
132
|
+
this.parser != null && (a = this.parser(a)), this._calcCurosorPosition(s, a), this.setValue(a), this.#t();
|
|
113
133
|
};
|
|
114
|
-
#
|
|
115
|
-
if (this.clearable) {
|
|
116
|
-
let t =
|
|
134
|
+
#t() {
|
|
135
|
+
if (this._state.clearable) {
|
|
136
|
+
let t = c(".l-clearable", this.root);
|
|
117
137
|
if (this.value.length > 0) {
|
|
118
138
|
if (t == null) {
|
|
119
|
-
t =
|
|
139
|
+
t = n("span", {
|
|
120
140
|
class: "l-input__suffix l-clearable"
|
|
121
141
|
});
|
|
122
|
-
const
|
|
123
|
-
t.appendChild(
|
|
142
|
+
const s = n("l-close-filled-icon");
|
|
143
|
+
t.appendChild(s), this.root.appendChild(t), h(t, "click", this.#e);
|
|
124
144
|
}
|
|
125
145
|
} else
|
|
126
|
-
t && (
|
|
146
|
+
t && (p(t, "click", this.#e), t.remove());
|
|
127
147
|
}
|
|
128
148
|
}
|
|
129
|
-
#
|
|
149
|
+
#e = () => {
|
|
130
150
|
this.value = "", this.dispatchEvent(
|
|
131
151
|
new CustomEvent("input", {
|
|
132
152
|
bubbles: !0,
|
|
133
153
|
detail: { value: this.value }
|
|
134
154
|
})
|
|
135
|
-
), this.#
|
|
155
|
+
), this.#t();
|
|
136
156
|
};
|
|
137
157
|
disabledChange() {
|
|
138
158
|
this.isDisabled() ? this.classList.add("is-disabled") : this.classList.remove("is-disabled"), this.$inner && (this.$inner.disabled = this.isDisabled());
|
|
139
159
|
}
|
|
140
|
-
_numberInputParse(t,
|
|
160
|
+
_numberInputParse(t, s) {
|
|
141
161
|
let e = t.trim();
|
|
142
162
|
if (e === "") return "";
|
|
143
|
-
let
|
|
144
|
-
if (
|
|
163
|
+
let a = e.startsWith("-");
|
|
164
|
+
if (a && (s.negative || (e = e.slice(1), a = !1)), s.integer)
|
|
145
165
|
e = e.replace(/[^\d]/g, "");
|
|
146
166
|
else {
|
|
147
167
|
const i = e.split(".");
|
|
148
168
|
if (i.length > 2)
|
|
149
|
-
e = i[0] + "." + i.slice(1).join("").substring(0,
|
|
169
|
+
e = i[0] + "." + i.slice(1).join("").substring(0, s.precision);
|
|
150
170
|
else if (i.length === 2) {
|
|
151
|
-
const
|
|
152
|
-
e = `${
|
|
171
|
+
const l = i[0].replace(/[^\d]/g, ""), r = i[1].replace(/[^\d]/g, "").substring(0, s.precision);
|
|
172
|
+
e = `${l}.${r}`;
|
|
153
173
|
} else
|
|
154
174
|
e = e.replace(/[^\d]/g, "");
|
|
155
175
|
}
|
|
156
|
-
return e.length > 1 && (e = e.replace(/^0+(\d)/, "$1")),
|
|
176
|
+
return e.length > 1 && (e = e.replace(/^0+(\d)/, "$1")), a ? "-" + e : e;
|
|
177
|
+
}
|
|
178
|
+
innerBlockChange(t) {
|
|
179
|
+
t ? o(this, "is-block") : u(this, "is-block");
|
|
157
180
|
}
|
|
158
181
|
_getStyleObj() {
|
|
159
182
|
const t = {};
|
|
160
|
-
return this.
|
|
183
|
+
return this._state.width && (t["--l-input-width"] = this._state.width), t;
|
|
161
184
|
}
|
|
162
|
-
|
|
163
|
-
|
|
185
|
+
_updateError(t = !1) {
|
|
186
|
+
t ? o(this, "is-error") : u(this, "is-error");
|
|
164
187
|
}
|
|
165
|
-
|
|
166
|
-
this.
|
|
188
|
+
validResult(t) {
|
|
189
|
+
this._updateError(t != null);
|
|
167
190
|
}
|
|
168
|
-
_validateChange = (t, l) => {
|
|
169
|
-
const e = this.getName();
|
|
170
|
-
if (e) {
|
|
171
|
-
const s = t === !0 ? !1 : t[e] != null;
|
|
172
|
-
(l == null || l === e && this.error != s) && (this.error = s, this._updateError()), Object.keys(t)[0] === e && this.focus();
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
191
|
#s = (t) => {
|
|
176
|
-
const
|
|
192
|
+
const s = t.target;
|
|
177
193
|
this.dispatchEvent(
|
|
178
194
|
new CustomEvent("change", {
|
|
179
195
|
bubbles: !0,
|
|
180
196
|
composed: !0,
|
|
181
|
-
detail: { value:
|
|
197
|
+
detail: { value: s.value, name: this.getName() }
|
|
182
198
|
})
|
|
183
199
|
);
|
|
184
200
|
};
|
|
185
201
|
}
|
|
186
202
|
export {
|
|
187
|
-
|
|
203
|
+
I as default
|
|
188
204
|
};
|
package/lib/modal/index.js
CHANGED
|
@@ -89,7 +89,7 @@ class S extends x {
|
|
|
89
89
|
class: "l-modal-container",
|
|
90
90
|
part: "container"
|
|
91
91
|
}), b = a("slot");
|
|
92
|
-
if (f.appendChild(b), e.appendChild(f), this.getAttr("footer", !
|
|
92
|
+
if (f.appendChild(b), e.appendChild(f), this.getAttr("footer", !0)) {
|
|
93
93
|
const d = a("footer", {
|
|
94
94
|
class: "l-modal-footer",
|
|
95
95
|
part: "footer"
|
package/lib/select_ori/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import a from "../form/form_inner.js";
|
|
2
2
|
import { tagAttrs as c } from "../utils/index.js";
|
|
3
3
|
import { $one as r, on as h, off as o } from "ph-utils/dom";
|
|
4
|
-
import { i as d } from "../index-
|
|
4
|
+
import { i as d } from "../index-DY6m9Wbe.js";
|
|
5
5
|
class v extends a {
|
|
6
6
|
static baseName = "select-ori";
|
|
7
7
|
$select;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import BaseComponent from "../base";
|
|
2
|
+
export default class ContextProvide<T, V> extends BaseComponent<V> {
|
|
3
|
+
context: Signal<T>;
|
|
4
|
+
contextEventName: string;
|
|
5
|
+
constructor();
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
disconnectedCallback(): void;
|
|
8
|
+
private contextProvideHandler;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import o from "../base.js";
|
|
2
|
+
import { on as c, off as a } from "ph-utils/dom";
|
|
3
|
+
class d extends o {
|
|
4
|
+
context;
|
|
5
|
+
contextEventName;
|
|
6
|
+
constructor() {
|
|
7
|
+
super(), this.contextEventName = "context-request";
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
super.connectedCallback(), c(this, this.contextEventName, this.contextProvideHandler);
|
|
11
|
+
}
|
|
12
|
+
disconnectedCallback() {
|
|
13
|
+
super.disconnectedCallback(), a(this, this.contextEventName, this.contextProvideHandler);
|
|
14
|
+
}
|
|
15
|
+
contextProvideHandler(t) {
|
|
16
|
+
const { context: e, callback: n } = t.detail;
|
|
17
|
+
e === this.contextEventName && n(this.context);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
d as default
|
|
22
|
+
};
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -34,3 +34,5 @@ export declare function setAttrs(el: HTMLElement, attrs: [string, string | undef
|
|
|
34
34
|
* @returns
|
|
35
35
|
*/
|
|
36
36
|
export declare function kebabToCamel(attr: string): string;
|
|
37
|
+
export declare function stopSignal(fn?: SignalStop): undefined;
|
|
38
|
+
export declare function unitNumberStr(value?: string, unit?: string): string | undefined;
|
package/lib/utils/index.js
CHANGED
|
@@ -1,60 +1,68 @@
|
|
|
1
|
-
import { isBlank as
|
|
2
|
-
let
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
for (const
|
|
6
|
-
const
|
|
7
|
-
customElements.get(
|
|
1
|
+
import { isNumeric as m, isBlank as a } from "ph-utils";
|
|
2
|
+
let p = -1;
|
|
3
|
+
function y(t, e) {
|
|
4
|
+
const n = Array.isArray(t) ? t : [t];
|
|
5
|
+
for (const r of n) {
|
|
6
|
+
const s = e || `l-${r.baseName}`;
|
|
7
|
+
customElements.get(s) || customElements.define(s, r);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return `l-${++
|
|
10
|
+
function $() {
|
|
11
|
+
return `l-${++p}`;
|
|
12
12
|
}
|
|
13
|
-
function l(t, e,
|
|
13
|
+
function l(t, e, n) {
|
|
14
14
|
if (t == null) return e;
|
|
15
15
|
switch (typeof e) {
|
|
16
16
|
case "boolean":
|
|
17
|
-
return ["", "true", "1", "on",
|
|
17
|
+
return ["", "true", "1", "on", n].includes(t);
|
|
18
18
|
case "number":
|
|
19
19
|
return Number(t);
|
|
20
20
|
default:
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function h(t) {
|
|
25
25
|
const e = t.attributes;
|
|
26
|
-
for (const
|
|
27
|
-
const { name:
|
|
28
|
-
if (
|
|
26
|
+
for (const n of e) {
|
|
27
|
+
const { name: r, value: s } = n;
|
|
28
|
+
if (r.startsWith("data-") || r.startsWith("aria-") || r.startsWith("_") || r.startsWith("$") || ["id", "class", "style"].includes(r))
|
|
29
29
|
continue;
|
|
30
|
-
const i =
|
|
31
|
-
(t._ignoreInitAttrs || []).includes(i) || (
|
|
30
|
+
const i = r.split("-").map((c, f) => f === 0 ? c : c[0].toUpperCase() + c.slice(1)).join(""), o = l(s, t[i], r), u = Object.getOwnPropertyNames(t);
|
|
31
|
+
(t._ignoreInitAttrs || []).includes(i) || (r === "value" ? (t[i] = o, t._resetValue = o) : (u.includes(i) || u.includes(`_${i}`)) && (t[i] = o));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
let
|
|
36
|
-
return e === !0 ?
|
|
34
|
+
function g(t, e) {
|
|
35
|
+
let n = "";
|
|
36
|
+
return e === !0 ? n = ` ${t}` : typeof e == "string" && !a(e) && (n = ` ${t}="${e}"`), n;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const e = t.map((
|
|
38
|
+
function N(t) {
|
|
39
|
+
const e = t.map((n) => g(n[0], n[1]));
|
|
40
40
|
return e.length > 0 ? ` ${e.join("")}` : "";
|
|
41
41
|
}
|
|
42
42
|
function I(t, e) {
|
|
43
|
-
for (const
|
|
44
|
-
const
|
|
45
|
-
|
|
43
|
+
for (const n of e) {
|
|
44
|
+
const r = n[1], s = n[0];
|
|
45
|
+
r === !0 ? t.setAttribute(s, "") : typeof r == "string" && !a(r) && t.setAttribute(s, r);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return t.replace(/-(\w)/g, (e,
|
|
48
|
+
function W(t) {
|
|
49
|
+
return t.replace(/-(\w)/g, (e, n) => n.toUpperCase());
|
|
50
|
+
}
|
|
51
|
+
function _(t) {
|
|
52
|
+
t && t();
|
|
53
|
+
}
|
|
54
|
+
function j(t, e = "px") {
|
|
55
|
+
return t && (m(t) ? `${t}${e}` : t);
|
|
50
56
|
}
|
|
51
57
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
h as initAttr,
|
|
59
|
+
W as kebabToCamel,
|
|
54
60
|
l as parseAttrValue,
|
|
55
|
-
|
|
61
|
+
y as regist,
|
|
56
62
|
I as setAttrs,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
_ as stopSignal,
|
|
64
|
+
g as tagAttr,
|
|
65
|
+
N as tagAttrs,
|
|
66
|
+
j as unitNumberStr,
|
|
67
|
+
$ as useId
|
|
60
68
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litos-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "基于 Web Component 的 UI 组件库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component library",
|
|
@@ -42,26 +42,26 @@
|
|
|
42
42
|
"docs:dev": "vitepress dev docs --force --host 0.0.0.0",
|
|
43
43
|
"docs:build": "vitepress build docs",
|
|
44
44
|
"docs:preview": "vitepress preview docs",
|
|
45
|
-
"inspect:eslint": "eslint --inspect-config",
|
|
46
45
|
"create": "node scripts/index.js create",
|
|
47
46
|
"dts:build": "tsc -p tsconfig.build.json && node scripts/dts.js",
|
|
48
47
|
"lib:build": "pnpm build && pnpm dts:build"
|
|
49
48
|
},
|
|
50
49
|
"dependencies": {
|
|
50
|
+
"alien-signals": "^3.1.2",
|
|
51
51
|
"iconify-icon": "^3.0.2",
|
|
52
|
-
"ph-utils": "^0.
|
|
52
|
+
"ph-utils": "^0.17.2",
|
|
53
53
|
"qrcode-generator-es": "^2.1.2",
|
|
54
|
-
"shiki": "^3.
|
|
54
|
+
"shiki": "^3.23.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@types/node": "^25.
|
|
57
|
+
"@types/node": "^25.3.1",
|
|
58
58
|
"less": "^4.5.1",
|
|
59
59
|
"lightningcss": "^1.31.1",
|
|
60
|
-
"oxfmt": "^0.
|
|
61
|
-
"oxlint": "^1.
|
|
60
|
+
"oxfmt": "^0.35.0",
|
|
61
|
+
"oxlint": "^1.50.0",
|
|
62
62
|
"typescript": "^5.9.3",
|
|
63
63
|
"vite": "^7.3.1",
|
|
64
64
|
"vite-plugin-dts": "^4.5.4",
|
|
65
65
|
"vitepress": "^1.6.4"
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|
package/lib/check-D-KVLA1z.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const r = ":host{--l-check-size: 14px;display:inline-flex;align-items:center;position:relative;cursor:pointer;width:auto;transition:color .3s,border-color .3s,background-color .3s}.l-check__input{margin:0;position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-check__inner{width:var(--l-check-size, 14px);height:var(--l-check-size, 14px);display:flex;justify-content:center;align-items:center;border-radius:3px;border:1px solid #dcddd9;box-sizing:border-box;transition:border-color .3s ease-in-out;position:relative;margin-right:5px;flex-shrink:0}.l-check__label{transition:color .3s;cursor:inherit;line-height:1}:host(.is-checked){color:var(--l-primary-color, #722ed1)}:host(.is-checked) .l-check__inner{border-color:var(--l-primary-color, #722ed1)}:host(.is-disabled){cursor:not-allowed}:host(.is-disabled) .l-check__label{color:var(--l-disabled-color, #e6e6e6)}:host([button]){height:var(--l-form-control-height, 32px);justify-content:center;padding:0 15px;border:1px solid #c0c4cc;border-left-width:0;margin-left:0;border-radius:inherit}:host([button]:first-child){border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}:host([button]:last-child){border-top-right-radius:3px;border-bottom-right-radius:3px}:host([button].is-checked){background-color:var(--l-primary-color, #722ed1);color:#fff;border-color:var(--l-primary-color, #722ed1);border-right-color:#fff}:host([button].is-checked:last-child){border-right-color:var(--l-primary-color, #722ed1)}";
|
|
2
|
-
export {
|
|
3
|
-
r as c
|
|
4
|
-
};
|
package/lib/index-DvcllHRh.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const r = ":host{--l-input-border-color: var(--l-border-color, #dedede);display:inline-flex;width:var(--l-input-width, 170px);height:var(--l-form-control-height, 32px);align-items:center;padding:0 7px;border:1px solid var(--l-input-border-color, #dedede);transition:border-color .3s;border-radius:var(--l-border-radius, 3px);vertical-align:middle;box-sizing:border-box;background-color:transparent}:host(:focus){--l-input-border-color: var(--l-primary-color, #722ed1)}:host(.is-disabled){background-color:var(--l-disabled-color, #f5f7fa)}:host(.is-error){--l-input-border-color: #ed3f13}.l-input__prefix,.l-input__suffix{color:#a8abb2;font-size:14px;display:inline-flex;flex-shrink:0}.l-input__prefix{margin-right:5px}.l-input__suffix{margin-left:5px}.l-clearable{cursor:pointer}.l-clearable:hover{color:#999}.l-input__inner{outline:none;border:none;box-sizing:border-box;width:100%;max-width:100%;height:100%;flex-grow:1;text-align:inherit;font-size:inherit}.l-input__inner:disabled{background-color:transparent}";
|
|
2
|
-
export {
|
|
3
|
-
r as i
|
|
4
|
-
};
|
package/lib/utils/event.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 添加表单事件监听器。
|
|
3
|
-
* @param formId - 表单的唯一标识符。
|
|
4
|
-
* @param event - 要监听的事件类型
|
|
5
|
-
* @param cb - 当事件触发时调用的回调函数,接收两个参数:属性名和属性值。
|
|
6
|
-
* 该函数用于将回调函数添加到指定表单ID的事件监听器集合中。
|
|
7
|
-
*/
|
|
8
|
-
export declare function add(channel: string, event: string, cb: (...param: any) => void): void;
|
|
9
|
-
/**
|
|
10
|
-
* 移除指定表单的事件监听器。
|
|
11
|
-
* @param formId - 表单的唯一标识符。
|
|
12
|
-
* @param event - 要移除的事件类型,可以是 'attributeChanged' 或 'formSubmitted'。
|
|
13
|
-
* @param cb - 要移除的事件回调函数,该函数接收两个参数:属性名和属性值。
|
|
14
|
-
* 该函数会从事件存储中移除指定的回调函数,如果某个事件类型下没有更多的回调函数,则删除该事件类型;
|
|
15
|
-
* 如果表单下没有更多的事件类型,则删除该表单;如果事件存储为空,则重置事件存储。
|
|
16
|
-
*/
|
|
17
|
-
export declare function remove(channel: string, event: string, cb: (...params: any) => void): void;
|
|
18
|
-
/**
|
|
19
|
-
* 清除事件存储。如果提供了ID,则删除特定ID的事件;如果没有提供ID,则清除所有事件。
|
|
20
|
-
* 当事件存储为空时,将其设置为undefined。
|
|
21
|
-
* @param id 可选参数,指定要删除的事件ID。
|
|
22
|
-
*/
|
|
23
|
-
export declare function clear(channel?: string): void;
|
|
24
|
-
/**
|
|
25
|
-
* 触发指定表单的事件,并执行所有注册的回调函数。
|
|
26
|
-
* @param id - 表单的唯一标识符。
|
|
27
|
-
* @param event - 要触发的事件名称。
|
|
28
|
-
* @param params - 要传递给回调函数的参数列表。
|
|
29
|
-
*/
|
|
30
|
-
export declare function emit(channel: string, event: string, ...params: any): void;
|