litos-ui 0.11.1 → 0.12.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/README.md +48 -0
- package/lib/base.d.ts +11 -2
- package/lib/base.js +18 -7
- package/lib/button/index.d.ts +3 -2
- package/lib/button/index.js +18 -19
- package/lib/date_picker/index.d.ts +22 -0
- package/lib/date_picker/index.js +99 -0
- package/lib/dialog/dialog_container.js +1 -1
- package/lib/form/form_inner.d.ts +7 -2
- package/lib/form/form_inner.js +26 -20
- package/lib/form/form_item.d.ts +0 -2
- package/lib/form/form_item.js +5 -9
- package/lib/form/index.d.ts +0 -2
- package/lib/form/index.js +23 -25
- package/lib/icon/base.d.ts +0 -1
- package/lib/icon/base.js +15 -17
- package/lib/index.d.ts +10 -0
- package/lib/index.js +92 -82
- package/lib/input/index.d.ts +1 -3
- package/lib/input/index.js +4 -8
- package/lib/loading/index.d.ts +9 -4
- package/lib/loading/index.js +70 -64
- package/lib/menu/base.js +1 -0
- package/lib/menu/index.d.ts +29 -0
- package/lib/menu/index.js +90 -0
- package/lib/menu/menu_item.d.ts +6 -0
- package/lib/menu/menu_item.js +21 -0
- package/lib/menu/sub_menu.d.ts +13 -0
- package/lib/menu/sub_menu.js +64 -0
- package/lib/modal/index.d.ts +40 -0
- package/lib/modal/index.js +153 -0
- package/lib/modal/modal_box.js +95 -0
- package/lib/popover/index.d.ts +1 -4
- package/lib/popover/index.js +6 -12
- package/lib/radio/index.js +2 -2
- package/lib/select_ori/index.d.ts +0 -2
- package/lib/select_ori/index.js +11 -15
- package/lib/switch/index.d.ts +0 -1
- package/lib/switch/index.js +8 -13
- package/lib/tabbar/index.d.ts +0 -1
- package/lib/tabbar/index.js +55 -63
- package/lib/theme/index.d.ts +1 -2
- package/lib/theme/index.js +9 -12
- package/lib/utils/index.js +29 -29
- package/lib/utils/transition.js +3 -2
- package/package.json +12 -13
- package/styles/loading.css +58 -14
- package/styles/message.css +1 -1
- package/styles/modal_box.css +7 -0
- package/styles/vars.css +1 -0
package/lib/utils/index.js
CHANGED
|
@@ -4,8 +4,8 @@ let E = -1;
|
|
|
4
4
|
function H(t, r) {
|
|
5
5
|
const e = Array.isArray(t) ? t : [t];
|
|
6
6
|
for (const i of e) {
|
|
7
|
-
const
|
|
8
|
-
customElements.get(
|
|
7
|
+
const n = r || `l-${i.baseName}`;
|
|
8
|
+
customElements.get(n) || customElements.define(n, i);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
function _() {
|
|
@@ -15,7 +15,7 @@ function I(t, r, e) {
|
|
|
15
15
|
if (t == null) return r;
|
|
16
16
|
switch (typeof r) {
|
|
17
17
|
case "boolean":
|
|
18
|
-
return
|
|
18
|
+
return ["", "true", "1", "on", e].includes(t);
|
|
19
19
|
case "number":
|
|
20
20
|
return Number(t);
|
|
21
21
|
default:
|
|
@@ -25,11 +25,11 @@ function I(t, r, e) {
|
|
|
25
25
|
function k(t) {
|
|
26
26
|
const r = t.attributes;
|
|
27
27
|
for (const e of r) {
|
|
28
|
-
const { name: i, value:
|
|
28
|
+
const { name: i, value: n } = e;
|
|
29
29
|
if (i.startsWith("data-") || i.startsWith("aria-") || i.startsWith("_") || i.startsWith("$") || ["id", "class", "style"].includes(i))
|
|
30
30
|
continue;
|
|
31
|
-
const
|
|
32
|
-
(t._ignoreInitAttrs || []).includes(
|
|
31
|
+
const s = i.split("-").map((d, h) => h === 0 ? d : d[0].toUpperCase() + d.slice(1)).join(""), u = I(n, t[s], i), f = Object.getOwnPropertyNames(t);
|
|
32
|
+
(t._ignoreInitAttrs || []).includes(s) || (i === "value" ? (t[s] = u, t._resetValue = u) : f.includes(s) && (t[s] = u));
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
function W(t, r) {
|
|
@@ -41,17 +41,17 @@ function C(t) {
|
|
|
41
41
|
}
|
|
42
42
|
function V(t, r) {
|
|
43
43
|
for (const e of r) {
|
|
44
|
-
const i = e[1],
|
|
45
|
-
i === !0 ? t.setAttribute(
|
|
44
|
+
const i = e[1], n = e[0];
|
|
45
|
+
i === !0 ? t.setAttribute(n, "") : typeof i == "string" && !N(i) && t.setAttribute(n, i);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function l() {
|
|
49
49
|
let t;
|
|
50
50
|
const r = {
|
|
51
51
|
attributes: !0,
|
|
52
52
|
attributeFilter: ["l-transition-emit"]
|
|
53
|
-
}, e = (
|
|
54
|
-
for (let u of
|
|
53
|
+
}, e = (s) => {
|
|
54
|
+
for (let u of s)
|
|
55
55
|
if (u.type === "attributes" && u.attributeName) {
|
|
56
56
|
const f = u.target, c = f.getAttribute(u.attributeName) || "show", d = f.getAttribute("l-transition") || "l", h = f.getAttribute("l-transition-method") || "hide";
|
|
57
57
|
c === "show" ? (f.style.removeProperty("display"), y(f, d, "enter")) : y(f, d, "leave", () => {
|
|
@@ -59,30 +59,30 @@ function B() {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
function i(
|
|
63
|
-
|
|
62
|
+
function i(s) {
|
|
63
|
+
s && s.length > 0 && (t == null && (t = new MutationObserver(e)), $(s, (u) => {
|
|
64
64
|
const f = u.getAttribute("l-transition");
|
|
65
65
|
f && (y(u, f, "enter"), t.observe(u, r));
|
|
66
66
|
}));
|
|
67
67
|
}
|
|
68
|
-
function s
|
|
69
|
-
|
|
68
|
+
function n(s) {
|
|
69
|
+
s == null && (s = x("[l-transition]"), i(s));
|
|
70
70
|
}
|
|
71
71
|
function o() {
|
|
72
72
|
t && (t.disconnect(), t = void 0);
|
|
73
73
|
}
|
|
74
|
-
return { destroy: o, add: i, init:
|
|
74
|
+
return { destroy: o, add: i, init: n };
|
|
75
75
|
}
|
|
76
|
-
function m(t, r, e, i,
|
|
76
|
+
function m(t, r, e, i, n = 10) {
|
|
77
77
|
let o = 0;
|
|
78
|
-
return e === "top" ? o = r.height +
|
|
78
|
+
return e === "top" ? o = r.height + n : e === "bottom" ? o = -(t.height + n) : (e === "left" || e === "right") && (i === "" ? o = r.height / 2 - t.height / 2 : i === "end" && (o = r.height - t.height)), o;
|
|
79
79
|
}
|
|
80
|
-
function w(t, r, e, i,
|
|
80
|
+
function w(t, r, e, i, n = 10) {
|
|
81
81
|
let o = 0;
|
|
82
|
-
return e === "left" ? o = r.width +
|
|
82
|
+
return e === "left" ? o = r.width + n : e === "right" ? o = -(t.width + n) : (e === "top" || e === "bottom") && (i === "" ? o = r.width / 2 - t.width / 2 : i === "end" && (o = r.width - t.width)), o;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
const d = window.innerHeight + o - 10, h = window.innerWidth +
|
|
84
|
+
function v(t, r, e, i, n, o, s, u, f = 10, c = "absolute") {
|
|
85
|
+
const d = window.innerHeight + o - 10, h = window.innerWidth + n - 10;
|
|
86
86
|
let a = t.top + o - u;
|
|
87
87
|
a + r.height > d && (e === "left" || e === "right" ? i = "end" : e = "top", u = m(
|
|
88
88
|
t,
|
|
@@ -91,26 +91,26 @@ function F(t, r, e, i, s, o, n, u, f = 10, c = "absolute") {
|
|
|
91
91
|
i,
|
|
92
92
|
f
|
|
93
93
|
), a = t.top + o - u), a < o && (e === "left" || e === "right" ? i = "start" : e = "bottom");
|
|
94
|
-
let b = t.left +
|
|
95
|
-
return b + r.width > h && (e === "top" || e === "bottom" ? i = "end" : e = "left",
|
|
94
|
+
let b = t.left + n - s;
|
|
95
|
+
return b + r.width > h && (e === "top" || e === "bottom" ? i = "end" : e = "left", s = w(
|
|
96
96
|
t,
|
|
97
97
|
r,
|
|
98
98
|
e,
|
|
99
99
|
i,
|
|
100
100
|
f
|
|
101
|
-
), b = t.left +
|
|
101
|
+
), b = t.left + n - s), b < n && (e === "top" || e === "bottom" ? i = "start" : e = "right"), c === "fixed" && (u = m(
|
|
102
102
|
t,
|
|
103
103
|
r,
|
|
104
104
|
e,
|
|
105
105
|
i,
|
|
106
106
|
f
|
|
107
|
-
),
|
|
107
|
+
), s = w(
|
|
108
108
|
t,
|
|
109
109
|
r,
|
|
110
110
|
e,
|
|
111
111
|
i,
|
|
112
112
|
f
|
|
113
|
-
), b = t.left +
|
|
113
|
+
), b = t.left + n - s, a = t.top + o - u), {
|
|
114
114
|
x: b,
|
|
115
115
|
y: a,
|
|
116
116
|
mainAlign: e,
|
|
@@ -118,10 +118,10 @@ function F(t, r, e, i, s, o, n, u, f = 10, c = "absolute") {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
export {
|
|
121
|
-
|
|
121
|
+
l as createTransition,
|
|
122
122
|
w as getPopoverOffsetX,
|
|
123
123
|
m as getPopoverOffsetY,
|
|
124
|
-
|
|
124
|
+
v as impactDetect,
|
|
125
125
|
k as initAttr,
|
|
126
126
|
I as parseAttrValue,
|
|
127
127
|
H as regist,
|
package/lib/utils/transition.js
CHANGED
|
@@ -6,7 +6,8 @@ import "ph-utils";
|
|
|
6
6
|
import "ph-utils/validator";
|
|
7
7
|
import "ph-utils/color";
|
|
8
8
|
import "ph-utils/theme";
|
|
9
|
-
|
|
9
|
+
import "ph-utils/date";
|
|
10
|
+
class S extends a {
|
|
10
11
|
static baseName = "transition";
|
|
11
12
|
/** 应用过滤动画的属性值, 例如: opacity: 0; transform: xx; */
|
|
12
13
|
sheetRec;
|
|
@@ -49,5 +50,5 @@ class C extends a {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
export {
|
|
52
|
-
|
|
53
|
+
S as Transition
|
|
53
54
|
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litos-ui",
|
|
3
3
|
"description": "基于 Web Component 的 UI 组件库",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@eslint/js": "^9.
|
|
7
|
+
"@eslint/js": "^9.24.0",
|
|
8
8
|
"@eslint/markdown": "^6.3.0",
|
|
9
|
-
"@types/node": "^22.
|
|
10
|
-
"eslint": "^9.
|
|
9
|
+
"@types/node": "^22.14.0",
|
|
10
|
+
"eslint": "^9.24.0",
|
|
11
11
|
"globals": "^16.0.0",
|
|
12
|
-
"less": "^4.
|
|
12
|
+
"less": "^4.3.0",
|
|
13
13
|
"lightningcss": "^1.29.3",
|
|
14
14
|
"prettier": "^3.5.3",
|
|
15
|
-
"typescript": "^5.8.
|
|
16
|
-
"typescript-eslint": "^8.
|
|
17
|
-
"vite": "^6.2.
|
|
15
|
+
"typescript": "^5.8.3",
|
|
16
|
+
"typescript-eslint": "^8.29.1",
|
|
17
|
+
"vite": "^6.2.5",
|
|
18
18
|
"vite-plugin-dts": "^4.5.3",
|
|
19
19
|
"vitepress": "^1.6.3"
|
|
20
20
|
},
|
|
@@ -52,20 +52,19 @@
|
|
|
52
52
|
},
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"
|
|
55
|
+
"iconify-icon": "^2.3.0",
|
|
56
|
+
"ph-utils": "^0.15.4",
|
|
56
57
|
"shiki": "^3.2.1"
|
|
57
58
|
},
|
|
58
59
|
"scripts": {
|
|
59
60
|
"dev": "vite dev",
|
|
60
61
|
"build": "vite build",
|
|
61
|
-
"docs:dev": "vitepress dev docs",
|
|
62
|
+
"docs:dev": "vitepress dev docs --force",
|
|
62
63
|
"docs:build": "vitepress build docs",
|
|
63
64
|
"docs:preview": "vitepress preview docs",
|
|
64
65
|
"inspect:eslint": "eslint --inspect-config",
|
|
65
|
-
"new_version": "node scripts/version.js",
|
|
66
66
|
"create": "node scripts/index.js create",
|
|
67
67
|
"dts:build": "tsc -p tsconfig.build.json && node scripts/dts.js",
|
|
68
|
-
"lib:build": "pnpm build && pnpm dts:build"
|
|
69
|
-
"vp": "scripts/publish.sh"
|
|
68
|
+
"lib:build": "pnpm build && pnpm dts:build"
|
|
70
69
|
}
|
|
71
70
|
}
|
package/styles/loading.css
CHANGED
|
@@ -7,18 +7,28 @@
|
|
|
7
7
|
right: 0;
|
|
8
8
|
bottom: 0;
|
|
9
9
|
left: 0;
|
|
10
|
-
|
|
10
|
+
z-index: var(--l-loading-zindex, 10);
|
|
11
|
+
background: rgba(0, 0, 0, 0.4);
|
|
11
12
|
border-radius: inherit;
|
|
12
|
-
|
|
13
|
-
justify-content: center;
|
|
14
|
-
align-items: center;
|
|
15
|
-
transition: opacity 0.3s ease-in-out;
|
|
13
|
+
transition: opacity 0.3s;
|
|
16
14
|
opacity: 0;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
.l-loading-spinner {
|
|
18
|
+
--l-loading-color: var(--l-primary-color, #722ed1);
|
|
20
19
|
text-align: center;
|
|
20
|
+
position: absolute;
|
|
21
|
+
z-index: calc(var(--l-loading-zindex, 10) + 1);
|
|
22
|
+
opacity: 0;
|
|
23
|
+
transition: opacity 0.3s;
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
.l-loading-spinner.l-loading--circle {
|
|
27
|
+
top: 50%;
|
|
28
|
+
left: 50%;
|
|
29
|
+
transform: translate3d(-50%, -50%, 0);
|
|
21
30
|
}
|
|
31
|
+
|
|
22
32
|
.l-loading-spinner .circle {
|
|
23
33
|
display: inline;
|
|
24
34
|
width: 40px;
|
|
@@ -27,7 +37,7 @@
|
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
.l-loading-spinner .path {
|
|
30
|
-
stroke: var(--l-
|
|
40
|
+
stroke: var(--l-loading-color);
|
|
31
41
|
stroke-width: 2px;
|
|
32
42
|
stroke-linecap: round;
|
|
33
43
|
stroke-linejoin: round;
|
|
@@ -36,7 +46,7 @@
|
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
.l-loading-spinner .l-loading-text {
|
|
39
|
-
color: var(--l-
|
|
49
|
+
color: var(--l-loading-color);
|
|
40
50
|
margin: 0;
|
|
41
51
|
font-size: 14px;
|
|
42
52
|
}
|
|
@@ -44,37 +54,55 @@
|
|
|
44
54
|
/* 全屏组件 */
|
|
45
55
|
.l-loading-fullscreen.l-loading-lock {
|
|
46
56
|
overflow: hidden;
|
|
57
|
+
--l-loading-zindex: 50;
|
|
47
58
|
}
|
|
48
59
|
.l-loading-fullscreen > .l-loading-mask {
|
|
49
60
|
position: fixed;
|
|
50
|
-
|
|
61
|
+
}
|
|
62
|
+
.l-loading-fullscreen > .l-loading-spinner {
|
|
63
|
+
position: fixed;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 边框风格 */
|
|
67
|
+
.l-loading-spinner.l-loading--border {
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
right: 0;
|
|
71
|
+
bottom: 0;
|
|
72
|
+
border: 2px solid var(--l-loading-color);
|
|
73
|
+
border-radius: inherit;
|
|
74
|
+
clip-path: inset(0 0 calc(100% - 2px) 0);
|
|
75
|
+
animation: borderLoadingAnim 5s linear infinite;
|
|
51
76
|
}
|
|
52
77
|
|
|
53
78
|
/* 进度条样式 */
|
|
54
|
-
.l-loading
|
|
55
|
-
|
|
79
|
+
.l-loading--bar.l-loading-spinner {
|
|
80
|
+
top: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
width: 100%;
|
|
56
83
|
height: 2px;
|
|
57
84
|
border-radius: inherit;
|
|
85
|
+
display: flex;
|
|
58
86
|
background-color: transparent;
|
|
59
87
|
justify-content: flex-start;
|
|
60
|
-
opacity: 1;
|
|
61
88
|
}
|
|
62
|
-
.l-loading
|
|
89
|
+
.l-loading--bar > .l-loading-progress {
|
|
63
90
|
width: 100%;
|
|
64
91
|
height: 100%;
|
|
65
92
|
max-width: 0;
|
|
66
93
|
opacity: 1;
|
|
94
|
+
border-radius: 1px;
|
|
67
95
|
transition:
|
|
68
96
|
max-width 4s linear,
|
|
69
97
|
background-color 0.2s linear,
|
|
70
98
|
opacity 0.2s linear;
|
|
71
99
|
background-color: var(--l-primary-color, #722ed1);
|
|
72
100
|
}
|
|
73
|
-
.l-loading-bar--start .l-loading-
|
|
101
|
+
.l-loading-bar--start .l-loading-progress {
|
|
74
102
|
max-width: 90%;
|
|
75
103
|
}
|
|
76
104
|
|
|
77
|
-
.l-loading-bar--finish .l-loading-
|
|
105
|
+
.l-loading-bar--finish .l-loading-progress {
|
|
78
106
|
transition:
|
|
79
107
|
max-width 0.2s linear,
|
|
80
108
|
background-color 0.2s linear,
|
|
@@ -98,3 +126,19 @@
|
|
|
98
126
|
transform: rotate3d(0, 0, 1, 360deg);
|
|
99
127
|
}
|
|
100
128
|
}
|
|
129
|
+
|
|
130
|
+
@keyframes borderLoadingAnim {
|
|
131
|
+
0%,
|
|
132
|
+
100% {
|
|
133
|
+
clip-path: inset(0 0 calc(100% - 2px) 0);
|
|
134
|
+
}
|
|
135
|
+
25% {
|
|
136
|
+
clip-path: inset(0 0 0 calc(100% - 2px));
|
|
137
|
+
}
|
|
138
|
+
50% {
|
|
139
|
+
clip-path: inset(calc(100% - 2px) 0 0 0);
|
|
140
|
+
}
|
|
141
|
+
75% {
|
|
142
|
+
clip-path: inset(0 calc(100% - 2px) 0 0);
|
|
143
|
+
}
|
|
144
|
+
}
|
package/styles/message.css
CHANGED
package/styles/vars.css
CHANGED