litos-ui 0.15.8 → 0.16.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.
@@ -1,107 +1,60 @@
1
- import { isBlank as $ } from "ph-utils";
2
- let x = -1;
3
- function O(t, r) {
4
- const e = Array.isArray(t) ? t : [t];
5
- for (const s of e) {
6
- const i = r || `l-${s.baseName}`;
7
- customElements.get(i) || customElements.define(i, s);
1
+ import { isBlank as u } from "ph-utils";
2
+ let m = -1;
3
+ function b(t, e) {
4
+ const s = Array.isArray(t) ? t : [t];
5
+ for (const n of s) {
6
+ const r = e || `l-${n.baseName}`;
7
+ customElements.get(r) || customElements.define(r, n);
8
8
  }
9
9
  }
10
- function _() {
11
- return `l-${++x}`;
10
+ function y() {
11
+ return `l-${++m}`;
12
12
  }
13
- function m(t, r, e) {
14
- if (t == null) return r;
15
- switch (typeof r) {
13
+ function l(t, e, s) {
14
+ if (t == null) return e;
15
+ switch (typeof e) {
16
16
  case "boolean":
17
- return ["", "true", "1", "on", e].includes(t);
17
+ return ["", "true", "1", "on", s].includes(t);
18
18
  case "number":
19
19
  return Number(t);
20
20
  default:
21
21
  return t;
22
22
  }
23
23
  }
24
- function j(t) {
25
- const r = t.attributes;
26
- for (const e of r) {
27
- const { name: s, value: i } = e;
28
- if (s.startsWith("data-") || s.startsWith("aria-") || s.startsWith("_") || s.startsWith("$") || ["id", "class", "style"].includes(s))
24
+ function $(t) {
25
+ const e = t.attributes;
26
+ for (const s of e) {
27
+ const { name: n, value: r } = s;
28
+ if (n.startsWith("data-") || n.startsWith("aria-") || n.startsWith("_") || n.startsWith("$") || ["id", "class", "style"].includes(n))
29
29
  continue;
30
- const u = s.split("-").map((o, w) => w === 0 ? o : o[0].toUpperCase() + o.slice(1)).join(""), h = m(i, t[u], s), f = Object.getOwnPropertyNames(t);
31
- (t._ignoreInitAttrs || []).includes(u) || (s === "value" ? (t[u] = h, t._resetValue = h) : (f.includes(u) || f.includes(`_${u}`)) && (t[u] = h));
30
+ const i = n.split("-").map((c, f) => f === 0 ? c : c[0].toUpperCase() + c.slice(1)).join(""), o = l(r, t[i], n), a = Object.getOwnPropertyNames(t);
31
+ (t._ignoreInitAttrs || []).includes(i) || (n === "value" ? (t[i] = o, t._resetValue = o) : (a.includes(i) || a.includes(`_${i}`)) && (t[i] = o));
32
32
  }
33
33
  }
34
- function E(t, r) {
35
- let e = "";
36
- return r === !0 ? e = ` ${t}` : typeof r == "string" && !$(r) && (e = ` ${t}="${r}"`), e;
34
+ function p(t, e) {
35
+ let s = "";
36
+ return e === !0 ? s = ` ${t}` : typeof e == "string" && !u(e) && (s = ` ${t}="${e}"`), s;
37
37
  }
38
- function k(t) {
39
- const r = t.map((e) => E(e[0], e[1]));
40
- return r.length > 0 ? ` ${r.join("")}` : "";
38
+ function h(t) {
39
+ const e = t.map((s) => p(s[0], s[1]));
40
+ return e.length > 0 ? ` ${e.join("")}` : "";
41
41
  }
42
- function C(t, r) {
43
- for (const e of r) {
44
- const s = e[1], i = e[0];
45
- s === !0 ? t.setAttribute(i, "") : typeof s == "string" && !$(s) && t.setAttribute(i, s);
42
+ function I(t, e) {
43
+ for (const s of e) {
44
+ const n = s[1], r = s[0];
45
+ n === !0 ? t.setAttribute(r, "") : typeof n == "string" && !u(n) && t.setAttribute(r, n);
46
46
  }
47
47
  }
48
- function c(t, r, e, s, i = 10) {
49
- let n = 0;
50
- return e === "top" ? n = r.height + i : e === "bottom" ? n = -(t.height + i) : (e === "left" || e === "right") && (s === "" ? n = r.height / 2 - t.height / 2 : s === "end" && (n = r.height - t.height)), n;
51
- }
52
- function a(t, r, e, s, i = 10) {
53
- let n = 0;
54
- return e === "left" ? n = r.width + i : e === "right" ? n = -(t.width + i) : (e === "top" || e === "bottom") && (s === "" ? n = r.width / 2 - t.width / 2 : s === "end" && (n = r.width - t.width)), n;
55
- }
56
- function P(t, r, e, s, i, n, u, h, f = 10, y = "absolute") {
57
- const o = window.innerHeight + n - 10, w = window.innerWidth + i - 10;
58
- let d = t.top + n - h;
59
- d + r.height > o && (e === "left" || e === "right" ? s = "end" : e = "top", h = c(
60
- t,
61
- r,
62
- e,
63
- s,
64
- f
65
- ), d = t.top + n - h), d < n && (e === "left" || e === "right" ? s = "start" : e = "bottom");
66
- let b = t.left + i - u;
67
- return b + r.width > w && (e === "top" || e === "bottom" ? s = "end" : e = "left", u = a(
68
- t,
69
- r,
70
- e,
71
- s,
72
- f
73
- ), b = t.left + i - u), b < i && (e === "top" || e === "bottom" ? s = "start" : e = "right"), y === "fixed" && (h = c(
74
- t,
75
- r,
76
- e,
77
- s,
78
- f
79
- ), u = a(
80
- t,
81
- r,
82
- e,
83
- s,
84
- f
85
- ), b = t.left + i - u, d = t.top + n - h), {
86
- x: b,
87
- y: d,
88
- mainAlign: e,
89
- crossAlign: s
90
- };
91
- }
92
- function p(t) {
93
- return t.replace(/-(\w)/g, (r, e) => e.toUpperCase());
48
+ function N(t) {
49
+ return t.replace(/-(\w)/g, (e, s) => s.toUpperCase());
94
50
  }
95
51
  export {
96
- a as getPopoverOffsetX,
97
- c as getPopoverOffsetY,
98
- P as impactDetect,
99
- j as initAttr,
100
- p as kebabToCamel,
101
- m as parseAttrValue,
102
- O as regist,
103
- C as setAttrs,
104
- E as tagAttr,
105
- k as tagAttrs,
106
- _ as useId
52
+ $ as initAttr,
53
+ N as kebabToCamel,
54
+ l as parseAttrValue,
55
+ b as regist,
56
+ I as setAttrs,
57
+ p as tagAttr,
58
+ h as tagAttrs,
59
+ y as useId
107
60
  };
@@ -1,4 +1,4 @@
1
- import { $one as T, $ as y, iterate as $, on as d, off as a, shouldEventNext as g, $$ as w } from "ph-utils/dom";
1
+ import { $one as T, $ as y, iterate as $, on as d, off as a, shouldEventNext as P, $$ as w } from "ph-utils/dom";
2
2
  function E(s, t, e, o, n = 10, r = "x") {
3
3
  const i = r === "x" ? "width" : "height";
4
4
  let p = ["left", "right", "top", "bottom"];
@@ -50,13 +50,13 @@ function O(s, t, e, o, n = 10) {
50
50
  n,
51
51
  "x"
52
52
  ), m = s.left + i - u, f = s.top + p - c;
53
- const P = `${e}${o === "" ? "" : "-" + o}`;
53
+ const g = `${e}${o === "" ? "" : "-" + o}`;
54
54
  return {
55
55
  x: m,
56
56
  y: f,
57
57
  mainAlign: e,
58
58
  crossAlign: o,
59
- placement: P
59
+ placement: g
60
60
  };
61
61
  }
62
62
  function M(s, t, e, o) {
@@ -202,9 +202,9 @@ class z {
202
202
  this._clearHideTimer(), this.$reference != e && this.show(e);
203
203
  };
204
204
  _onMouseLeave = () => {
205
- this._clearHideTimer(), this._hideTimer = setTimeout(() => {
205
+ this._clearHideTimer(), this.options.trigger === "hover" && (this._hideTimer = setTimeout(() => {
206
206
  this.hide();
207
- }, 50);
207
+ }, 50));
208
208
  };
209
209
  _onRefTap = (t) => {
210
210
  this._destroyUpdater();
@@ -224,17 +224,24 @@ class z {
224
224
  show(t) {
225
225
  const e = t.dataset;
226
226
  let o = e.disabled;
227
- if (o == null && (o = this.options.disabled), !o && !this.$reference && (this.$reference = t, this.popoverElement || (this._renderPopover(), this._bindPopoverEvents()), this.popoverElement)) {
228
- this.options.updateContent && this.options.updateContent(this.popoverElement, e), this._destroyUpdater();
229
- const n = e.placement || this.options.placement || "top", r = Number(e.offset || this.options.offset || 10), i = e.popoverWidth || this.options.popoverWidth;
230
- this.popoverElement.style.display = "block";
231
- let p;
232
- i && (i !== "trigger" ? p = Number(i) : p = i), this.updater = L(this.$reference, this.popoverElement, {
233
- placement: n,
234
- popoverWidth: p,
235
- offset: r,
236
- arrowSize: this.options.arrowSize
237
- }), this.options.onOpenChange && this.options.onOpenChange(!0);
227
+ if (o == null && (o = this.options.disabled), !o) {
228
+ if (this.$reference) {
229
+ if (this.$reference === t)
230
+ return;
231
+ this.hide();
232
+ }
233
+ if (this.$reference = t, this.popoverElement || (this._renderPopover(), this._bindPopoverEvents()), this.popoverElement) {
234
+ this.options.updateContent && this.options.updateContent(this.popoverElement, e), this._destroyUpdater();
235
+ const n = e.placement || this.options.placement || "top", r = Number(e.offset || this.options.offset || 10), i = e.popoverWidth || this.options.popoverWidth;
236
+ this.popoverElement.style.display = "block";
237
+ let p;
238
+ i && (i !== "trigger" ? p = Number(i) : p = i), this.updater = L(this.$reference, this.popoverElement, {
239
+ placement: n,
240
+ popoverWidth: p,
241
+ offset: r,
242
+ arrowSize: this.options.arrowSize
243
+ }), this.options.onOpenChange && this.options.onOpenChange(!0);
244
+ }
238
245
  }
239
246
  }
240
247
  isShow() {
@@ -261,7 +268,7 @@ class z {
261
268
  return;
262
269
  }
263
270
  if (this.popoverElement && (this.popoverElement.contains(e) || this.popoverElement == e)) {
264
- const [o, n, r] = g(
271
+ const [o, n, r] = P(
265
272
  t,
266
273
  "data-action",
267
274
  this.popoverElement
package/package.json CHANGED
@@ -1,71 +1,67 @@
1
1
  {
2
2
  "name": "litos-ui",
3
+ "version": "0.16.1",
3
4
  "description": "基于 Web Component 的 UI 组件库",
4
- "version": "0.15.8",
5
- "type": "module",
6
- "scripts": {
7
- "dev": "vite dev",
8
- "build": "vite build",
9
- "docs:dev": "vitepress dev docs --force --host 0.0.0.0",
10
- "docs:build": "vitepress build docs",
11
- "docs:preview": "vitepress preview docs",
12
- "inspect:eslint": "eslint --inspect-config",
13
- "create": "node scripts/index.js create",
14
- "dts:build": "tsc -p tsconfig.build.json && node scripts/dts.js",
15
- "lib:build": "pnpm build && pnpm dts:build"
5
+ "keywords": [
6
+ "component library",
7
+ "litos-ui",
8
+ "ui framework",
9
+ "web component"
10
+ ],
11
+ "homepage": "https://dvshu.github.io/litos-ui/",
12
+ "bugs": {
13
+ "url": "https://github.com/DvShu/litos-ui/issues"
16
14
  },
17
- "devDependencies": {
18
- "@eslint/js": "^9.34.0",
19
- "@eslint/markdown": "^7.2.0",
20
- "@types/node": "^24.3.0",
21
- "eslint": "^9.34.0",
22
- "globals": "^16.3.0",
23
- "less": "^4.4.1",
24
- "lightningcss": "^1.30.1",
25
- "prettier": "^3.6.2",
26
- "typescript": "^5.9.2",
27
- "typescript-eslint": "^8.41.0",
28
- "vite": "^7.1.3",
29
- "vite-plugin-dts": "^4.5.4",
30
- "vitepress": "^1.6.4"
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/DvShu/litos-ui.git"
31
19
  },
32
20
  "files": [
33
21
  "lib",
34
22
  "styles"
35
23
  ],
24
+ "type": "module",
36
25
  "main": "./lib/index.js",
37
26
  "module": "./lib/index.js",
38
27
  "types": "./lib/index.d.ts",
39
- "jsdelivr": "./lib/litos-ui.min.js",
40
28
  "unpkg": "./lib/litos-ui.min.js",
29
+ "jsdelivr": "./lib/litos-ui.min.js",
41
30
  "exports": {
42
31
  "./styles/*": "./styles/*",
43
32
  "./lib/*": "./lib/*",
44
33
  ".": {
45
- "import": "./lib/index.js",
46
34
  "types": "./lib/index.d.ts",
35
+ "import": "./lib/index.js",
47
36
  "require": "./lib/index.js"
48
37
  }
49
38
  },
50
- "repository": {
51
- "type": "git",
52
- "url": "git+https://github.com/DvShu/litos-ui.git"
53
- },
54
- "keywords": [
55
- "litos-ui",
56
- "web component",
57
- "ui framework",
58
- "component library"
59
- ],
60
- "homepage": "https://dvshu.github.io/litos-ui/",
61
- "bugs": {
62
- "url": "https://github.com/DvShu/litos-ui/issues"
39
+ "scripts": {
40
+ "dev": "vite dev",
41
+ "build": "vite build",
42
+ "docs:dev": "vitepress dev docs --force --host 0.0.0.0",
43
+ "docs:build": "vitepress build docs",
44
+ "docs:preview": "vitepress preview docs",
45
+ "inspect:eslint": "eslint --inspect-config",
46
+ "create": "node scripts/index.js create",
47
+ "dts:build": "tsc -p tsconfig.build.json && node scripts/dts.js",
48
+ "lib:build": "pnpm build && pnpm dts:build"
63
49
  },
64
- "license": "MIT",
65
50
  "dependencies": {
66
- "iconify-icon": "^3.0.0",
67
- "ph-utils": "^0.16.2",
68
- "qrcode-generator-es": "^1.1.4",
69
- "shiki": "^3.12.0"
51
+ "iconify-icon": "^3.0.2",
52
+ "ph-utils": "^0.16.5",
53
+ "qrcode-generator-es": "^2.1.2",
54
+ "shiki": "^3.21.0"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^25.0.10",
58
+ "less": "^4.5.1",
59
+ "lightningcss": "^1.31.1",
60
+ "oxfmt": "^0.26.0",
61
+ "oxlint": "^1.41.0",
62
+ "typescript": "^5.9.3",
63
+ "vite": "^7.3.1",
64
+ "vite-plugin-dts": "^4.5.4",
65
+ "vitepress": "^1.6.4"
70
66
  }
71
67
  }
@@ -32,6 +32,7 @@
32
32
  border-bottom: 1px solid #dedede;
33
33
  display: flex;
34
34
  align-items: center;
35
+ flex-shrink: 0;
35
36
  justify-content: space-between;
36
37
  height: var(--l-header-height);
37
38
  }
@@ -0,0 +1,13 @@
1
+ :root.dark {
2
+ --l-disabled-color: #6c6c6c;
3
+ /* 表格配置 */
4
+ --l-table-border-color: #444444;
5
+ --l-table-th-bg: #2d2d2d;
6
+ --l-table-th-color: #e0e0e0;
7
+ --l-table-td-bg: #1e1e1e;
8
+ --l-table-td-color: #e0e0e0;
9
+ --l-table-row-hover-bg: #333333;
10
+ --l-table-empty-color: #888888;
11
+ --l-table-stripe-bg: #252525;
12
+ --l-table-sort-inactive-color: #777777;
13
+ }
package/styles/reset.css CHANGED
@@ -1,4 +1,7 @@
1
1
  /* 一般开发网页的时候,都是按照100%来开发 */
2
+ html {
3
+ font-size: 62.5%;
4
+ }
2
5
  html,
3
6
  body {
4
7
  height: 100%;
@@ -57,8 +60,3 @@ p {
57
60
  line-height: 1.4;
58
61
  color: #333;
59
62
  }
60
-
61
- /* 按钮之间间隔 */
62
- .l-btn-group l-button + l-button {
63
- margin-left: 10px;
64
- }
package/styles/vars.css CHANGED
@@ -3,15 +3,15 @@
3
3
  --l-form-control-height: 32px;
4
4
  /** 禁用状态颜色 */
5
5
  --l-disabled-color: #e6e6e6;
6
- /* 主题(primary)颜色 */
7
- --l-primary-color: #722ed1;
8
- --l-primary-color-light1: #9254de;
9
- --l-primary-color-light2: #b37feb;
10
- --l-primary-color-light3: #d3adf7;
11
- --l-primary-color-light4: #efdbff;
12
- --l-primary-color-light5: #f9f0ff;
13
- --l-primary-color-dark1: #531dab;
14
- --l-primary-color-dark2: #391085;
6
+ /* 主题(primary)颜色 - 明亮蓝系列 */
7
+ --l-primary-color: #007bff; /* 主色调:明亮蓝 */
8
+ --l-primary-color-light1: #3399ff; /* 浅 1 */
9
+ --l-primary-color-light2: #66b3ff; /* 浅 2 */
10
+ --l-primary-color-light3: #99ccff; /* 浅 3 */
11
+ --l-primary-color-light4: #cce6ff; /* 浅 4 */
12
+ --l-primary-color-light5: #e6f2ff; /* 浅 5 (极浅) */
13
+ --l-primary-color-dark1: #0066cc; /* 深 1 */
14
+ --l-primary-color-dark2: #004c99; /* 深 2 */
15
15
  /* 表示错误(error)的颜色 */
16
16
  --l-error-color: #f5222d;
17
17
  --l-error-color-light3: #ffa39e;
@@ -33,6 +33,4 @@
33
33
  --l-border-color: #dedede;
34
34
  --l-border-radius: 3px;
35
35
  }
36
- html.dark {
37
- --l-disabled-color: #262727;
38
- }
36
+
@@ -1,4 +0,0 @@
1
- const r = ":host{--l-check-size: 16px;display:inline-flex;align-items:center;position:relative;cursor:pointer;width:auto;transition:color .3s,border-color .3s,background-color .3s}:host(:not(:first-child)){margin-left:15px}.l-check__input{margin:0;position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-check__inner{width:var(--l-check-size);height:var(--l-check-size);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}.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
- };
@@ -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}: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
- };