litos-ui 0.12.2 → 0.14.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.
Files changed (86) hide show
  1. package/lib/base.d.ts +23 -2
  2. package/lib/base.js +37 -8
  3. package/lib/button/index.d.ts +3 -1
  4. package/lib/button/index.js +18 -19
  5. package/lib/carousel/index.d.ts +20 -0
  6. package/lib/carousel/index.js +280 -0
  7. package/lib/carousel/item.d.ts +6 -0
  8. package/lib/carousel/item.js +15 -0
  9. package/lib/carousel/timer.d.ts +5 -0
  10. package/lib/carousel/timer.js +19 -0
  11. package/lib/check/check.d.ts +22 -0
  12. package/lib/check/check.js +81 -0
  13. package/lib/check/checkbox.d.ts +7 -0
  14. package/lib/check/checkbox.js +25 -0
  15. package/lib/check/checkbox_group.d.ts +9 -0
  16. package/lib/check/checkbox_group.js +33 -0
  17. package/lib/check/index.d.ts +12 -0
  18. package/lib/check/index.js +35 -0
  19. package/lib/check/radio.d.ts +6 -0
  20. package/lib/check/radio.js +19 -0
  21. package/lib/check/radio_group.d.ts +6 -0
  22. package/lib/check/radio_group.js +24 -0
  23. package/lib/check-BlDsQQo0.js +4 -0
  24. package/lib/color_picker/index.d.ts +1 -1
  25. package/lib/color_picker/index.js +6 -6
  26. package/lib/date_picker/index.d.ts +22 -0
  27. package/lib/date_picker/index.js +99 -0
  28. package/lib/dialog/dialog_container.d.ts +28 -0
  29. package/lib/dialog/dialog_container.js +100 -0
  30. package/lib/dialog/index.d.ts +30 -0
  31. package/lib/dialog/index.js +86 -0
  32. package/lib/form/form_inner.d.ts +3 -5
  33. package/lib/form/form_inner.js +29 -31
  34. package/lib/form/form_item.d.ts +1 -3
  35. package/lib/form/form_item.js +30 -41
  36. package/lib/form/index.d.ts +0 -2
  37. package/lib/form/index.js +23 -25
  38. package/lib/icon/base.d.ts +0 -1
  39. package/lib/icon/base.js +15 -17
  40. package/lib/icon/close.d.ts +5 -0
  41. package/lib/icon/close.js +10 -0
  42. package/lib/icon/{mask_close.d.ts → close_filled.d.ts} +1 -1
  43. package/lib/icon/{mask_close.js → close_filled.js} +1 -1
  44. package/lib/index-dwS1N2uN.js +4 -0
  45. package/lib/index.d.ts +40 -6
  46. package/lib/index.js +120 -87
  47. package/lib/input/index.d.ts +6 -5
  48. package/lib/input/index.js +105 -57
  49. package/lib/list/index.d.ts +2 -3
  50. package/lib/list/index.js +17 -17
  51. package/lib/litos-ui.css +1 -1
  52. package/lib/loading/index.d.ts +45 -0
  53. package/lib/loading/index.js +141 -0
  54. package/lib/md_input/index.js +9 -9
  55. package/lib/menu/base.js +1 -0
  56. package/lib/menu/index.d.ts +31 -0
  57. package/lib/menu/index.js +95 -0
  58. package/lib/menu/menu_item.d.ts +6 -0
  59. package/lib/menu/menu_item.js +21 -0
  60. package/lib/menu/sub_menu.d.ts +15 -0
  61. package/lib/menu/sub_menu.js +82 -0
  62. package/lib/message/index.js +1 -1
  63. package/lib/modal/index.d.ts +40 -0
  64. package/lib/modal/index.js +153 -0
  65. package/lib/modal/modal_box.js +95 -0
  66. package/lib/popover/index.d.ts +1 -4
  67. package/lib/popover/index.js +6 -12
  68. package/lib/select_ori/index.d.ts +1 -3
  69. package/lib/select_ori/index.js +12 -16
  70. package/lib/switch/index.d.ts +0 -1
  71. package/lib/switch/index.js +8 -13
  72. package/lib/tabbar/index.d.ts +0 -1
  73. package/lib/tabbar/index.js +55 -63
  74. package/lib/theme/index.d.ts +1 -2
  75. package/lib/theme/index.js +9 -12
  76. package/lib/utils/index.d.ts +1 -6
  77. package/lib/utils/index.js +47 -54
  78. package/lib/utils/transition.js +4 -2
  79. package/package.json +8 -8
  80. package/styles/vars.css +1 -1
  81. package/lib/checkbox/index.d.ts +0 -17
  82. package/lib/checkbox/index.js +0 -135
  83. package/lib/index-391POYEJ.js +0 -4
  84. package/lib/litos-ui.min.js +0 -1
  85. package/lib/radio/index.d.ts +0 -28
  86. package/lib/radio/index.js +0 -122
@@ -1,16 +1,9 @@
1
- import { isBlank as p, isNumeric as v } from "ph-utils";
2
- import y from "../base.js";
3
- import { initAttr as x, parseAttrValue as m } from "../utils/index.js";
4
- import { addClass as h, removeClass as f, $one as l, create as b, $ as g, iterate as $, on as C, off as k, isVisible as w, formatStyle as _, formatClass as A } from "ph-utils/dom";
1
+ import { isBlank as p, isNumeric as g } from "ph-utils";
2
+ import v from "../base.js";
3
+ import { initAttr as y, parseAttrValue as m } from "../utils/index.js";
4
+ import { addClass as h, removeClass as f, $one as l, create as b, $ as u, iterate as x, on as $, off as C, shouldEventNext as k, isVisible as w, formatStyle as _, formatClass as A } from "ph-utils/dom";
5
5
  const L = ":host{--l-tabbar-hover-color: var(--l-primary-color-light1, #9254de);--l-tabbar-active-color: var(--l-primary-color, #722ed1);--l-tabbar-item-gap: 0;--l-tabbar-height: 38px;position:relative;overflow:hidden;height:var(--l-tabbar-height);background-color:#fff;display:block}.l-tabbar-wrapper{display:flex;flex-wrap:nowrap;height:100%;align-items:stretch;gap:var(--l-tabbar-item-gap)}.l-tabbar-item{color:#666;transition:all .3s ease-in-out;cursor:pointer;display:inline-flex;justify-content:center;align-items:center}.l-tabbar-item:hover{color:var(--l-tabbar-hover-color)}.l-tabbar-item.active{color:var(--l-tabbar-active-color)}.l-tabbar-item-icon{font-size:18px;margin-bottom:5px;display:flex;justify-content:center;align-items:center}.l-tabbar-item-icon.only{font-size:24px;margin-bottom:0}:host(.l-tabbar--nav){--l-tabbar-height: 50px;width:100%}:host(.l-tabbar--nav) .l-tabbar-item{flex-grow:1;display:inline-flex;flex-direction:column;justify-content:center;align-items:center;font-size:12px;line-height:1}:host(.l-tabbar--bar){--l-tabbar-bar-vertical-padding: 10px;--l-tabbar-item-gap: 30px;--l-tabbar-line-color: var(--l-primary-color, #722ed1);overflow:auto;white-space:nowrap}.l-tabbar--bar-line{position:absolute;width:32px;left:0;bottom:0;border-radius:1px;height:2px;background-color:var(--l-tabbar-line-color);transition:all .3s ease-in-out}:host(.l-tabbar--card){--l-tabbar-card-border-color: #f5f7fa;--l-tabbar-line-color: #fff;--l-tabbar-item-gap: 0;--l-tabbar-card-border-radius: 5px}.l-tabbar-card-border{position:absolute;left:0;right:0;bottom:0;height:1px;background-color:var(--l-tabbar-card-border-color)}:host(.l-tabbar--card) .l-tabbar-item{padding:0 15px;background:#f5f7fa;border:1px solid #f0f0f0}:host(.l-tabbar--card) .l-tabbar-item:first-child{border-top-left-radius:var(--l-tabbar-card-border-radius)}:host(.l-tabbar--card) .l-tabbar-item:last-child{border-top-right-radius:var(--l-tabbar-card-border-radius)}:host(.l-tabbar-gap) .l-tabbar-item{border-top-left-radius:var(--l-tabbar-card-border-radius);border-top-right-radius:var(--l-tabbar-card-border-radius)}:host(.l-tabbar--card) .l-tabbar-item.active{background:#fff}";
6
- function N(u, r, t) {
7
- let e = u.target, a = "";
8
- do
9
- if (t && t.isSameNode(e) || e.tagName === "BODY" || (e.getAttribute && (a = e.getAttribute(r) || ""), a === "" && (e = e.parentNode), !e)) break;
10
- while (a === "");
11
- return [a !== "__stop__" && a !== "", a, e];
12
- }
13
- class S extends y {
6
+ class R extends v {
14
7
  static baseName = "tabbar";
15
8
  /**
16
9
  * 标签类型:
@@ -23,7 +16,7 @@ class S extends y {
23
16
  gap;
24
17
  $line;
25
18
  constructor() {
26
- super(), x(this);
19
+ super(), y(this);
27
20
  }
28
21
  connectedCallback() {
29
22
  this.loadStyleText(L), h(this, `l-tabbar--${this.type}`), !p(this.gap) && !this.gap.startsWith("0") && h(this, "l-tabbar-gap"), super.connectedCallback(), this._init();
@@ -31,39 +24,39 @@ class S extends y {
31
24
  static get observedAttributes() {
32
25
  return ["name", "type", "justify-content", "gap"];
33
26
  }
34
- attributeChangedCallback(r, t, e) {
35
- if (r === "name") {
36
- const a = m(e, void 0);
37
- this.name = a, this._updateActive(), this._updateLine();
38
- } else if (r === "type") {
39
- const a = m(e, "nav");
40
- if (a !== this.type && (f(this, `l-tabbar--${this.type}`), this.type = a, f(this, `l-tabbar--${a}`), a === "card")) {
27
+ attributeChangedCallback(e, t, a) {
28
+ if (e === "name") {
29
+ const r = m(a, void 0);
30
+ this.name = r, this._updateActive(), this._updateLine();
31
+ } else if (e === "type") {
32
+ const r = m(a, "nav");
33
+ if (r !== this.type && (f(this, `l-tabbar--${this.type}`), this.type = r, f(this, `l-tabbar--${r}`), r === "card")) {
41
34
  let i = l(".l-tabbar-card-border", this.root);
42
35
  i || (i = b("div", { class: "l-tabbar-card-border" }), this.root.appendChild(i));
43
36
  }
44
37
  } else {
45
- const a = m(e, void 0);
46
- this[r] = a;
38
+ const r = m(a, void 0);
39
+ this[e] = r;
47
40
  const i = l(".l-tabbar-wrapper", this.root);
48
- i && (i.style.cssText = this.#t()), r === "gap" && (!p(this.gap) && !this.gap.startsWith("0") ? h(this, "l-tabbar-gap") : f(this, "l-tabbar-gap"));
41
+ i && (i.style.cssText = this.#t()), e === "gap" && (!p(this.gap) && !this.gap.startsWith("0") ? h(this, "l-tabbar-gap") : f(this, "l-tabbar-gap"));
49
42
  }
50
43
  }
51
44
  disconnectedCallback() {
52
45
  super.disconnectedCallback(), this._destroy();
53
46
  }
54
47
  render() {
55
- const r = document.createDocumentFragment(), t = document.createElement("div");
48
+ const e = document.createDocumentFragment(), t = document.createElement("div");
56
49
  if (t.className = "l-tabbar-wrapper", t.style.cssText = this.#t(), t.setAttribute("part", "default"), this.getAttr("custom-content", !1)) {
57
- const a = document.createElement("slot");
58
- t.appendChild(a);
50
+ const r = document.createElement("slot");
51
+ t.appendChild(r);
59
52
  } else {
60
- const a = g("[l-name]", this);
61
- a.length > 0 && $(a, (i) => {
53
+ const r = u("[l-name]", this);
54
+ r.length > 0 && x(r, (i) => {
62
55
  const c = i.getAttribute("l-name");
63
56
  if (c) {
64
57
  const o = i.cloneNode(!0);
65
58
  o.classList.add("l-tabbar-item"), o.setAttribute("part", "item"), c === this.name && o.classList.add("active");
66
- const n = l("[l-icon]", o), s = g(":not([l-icon])", o);
59
+ const n = l("[l-icon]", o), s = u(":not([l-icon])", o);
67
60
  if (n) {
68
61
  const d = b("div", {
69
62
  class: [
@@ -77,53 +70,53 @@ class S extends y {
77
70
  }
78
71
  });
79
72
  }
80
- if (r.appendChild(t), this.type === "card") {
81
- const a = b("div", { class: "l-tabbar-card-border" });
82
- r.appendChild(a);
73
+ if (e.appendChild(t), this.type === "card") {
74
+ const r = b("div", { class: "l-tabbar-card-border" });
75
+ e.appendChild(r);
83
76
  }
84
- return r;
77
+ return e;
85
78
  }
86
79
  /**
87
80
  * 设置选项卡栏的项目列表。
88
81
  * @param items - 选项卡栏项目的数组。
89
82
  * 该方法首先清空选项卡栏的包装器元素,然后根据传入的项目数组创建并追加新的选项卡项目。
90
83
  */
91
- setItems(r) {
84
+ setItems(e) {
92
85
  const t = l(".l-tabbar-wrapper", this.root);
93
- t && (t.innerHTML = "", t.appendChild(this.#e(r)));
86
+ t && (t.innerHTML = "", t.appendChild(this.#e(e)));
94
87
  }
95
88
  /**
96
89
  * 向标签栏添加项目。
97
90
  * @param items 要添加的标签栏项目数组。
98
91
  * @returns 无返回值。
99
92
  */
100
- addItems(r) {
93
+ addItems(e) {
101
94
  const t = l(".l-tabbar-wrapper", this.root);
102
- t && t.appendChild(this.#e(r));
95
+ t && t.appendChild(this.#e(e));
103
96
  }
104
97
  _init() {
105
- C(this.root, "click", this._handleClick), setTimeout(() => {
98
+ $(this.root, "click", this._handleClick), setTimeout(() => {
106
99
  this._updateLine();
107
100
  }, 300);
108
101
  }
109
102
  _destroy() {
110
- k(this.root, "click", this._handleClick), this.$line = void 0;
103
+ C(this.root, "click", this._handleClick), this.$line = void 0;
111
104
  }
112
- _handleClick = (r) => {
113
- const [t, e] = N(r, "l-name", this.root);
114
- t && e !== this.name && (this.name = e, this.dispatchEvent(
105
+ _handleClick = (e) => {
106
+ const [t, a] = k(e, "l-name", this.root);
107
+ t && a !== this.name && (this.name = a, this.dispatchEvent(
115
108
  new CustomEvent("change", {
116
109
  detail: {
117
- name: e
110
+ name: a
118
111
  }
119
112
  })
120
113
  ), this._updateActive(), this._updateLine());
121
114
  };
122
115
  _updateActive() {
123
- const t = this.getAttr("custom-content", !1) ? this : this.root, e = l(".active", t);
124
- e && f(e, "active");
125
- const a = l(`[l-name="${this.name}"]`, t);
126
- a && h(a, "active");
116
+ const t = this.getAttr("custom-content", !1) ? this : this.root, a = l(".active", t);
117
+ a && f(a, "active");
118
+ const r = l(`[l-name="${this.name}"]`, t);
119
+ r && h(r, "active");
127
120
  }
128
121
  /**
129
122
  * 初始化线条的方法,在微任务队列中执行。
@@ -132,31 +125,31 @@ class S extends y {
132
125
  _updateLine() {
133
126
  queueMicrotask(() => {
134
127
  if (!this.name || this.type === "nav" || !this.rendered) return;
135
- const r = this.getAttr("custom-content", !1), t = l(".active", r ? this : this.root);
128
+ const e = this.getAttr("custom-content", !1), t = l(".active", e ? this : this.root);
136
129
  if (!t) return;
137
- const e = t.offsetLeft;
130
+ const a = t.offsetLeft;
138
131
  if (!this.$line) {
139
- const a = b("div", { class: "l-tabbar--bar-line" });
140
- a.part = "line", this.root.appendChild(a), this.$line = l(".l-tabbar--bar-line", this.root);
132
+ const r = b("div", { class: "l-tabbar--bar-line" });
133
+ r.part = "line", this.root.appendChild(r), this.$line = l(".l-tabbar--bar-line", this.root);
141
134
  }
142
- this.$line.style.cssText = `width:${t.offsetWidth}px;left:${e}px`, w(t, this) || this.scrollTo({
143
- left: e,
135
+ this.$line.style.cssText = `width:${t.offsetWidth}px;left:${a}px`, w(t, this) || this.scrollTo({
136
+ left: a,
144
137
  behavior: "smooth"
145
138
  });
146
139
  });
147
140
  }
148
141
  #t() {
149
- const r = {}, t = this.getAttr("justify-content");
150
- if (p(t) || (r["justify-content"] = t), !p(this.gap)) {
151
- let e = this.gap;
152
- v(e, { isPositive: !0 }) && (e = `${e}px`), r["--l-tabbar-item-gap"] = e;
142
+ const e = {}, t = this.getAttr("justify-content");
143
+ if (p(t) || (e["justify-content"] = t), !p(this.gap)) {
144
+ let a = this.gap;
145
+ g(a, { isPositive: !0 }) && (a = `${a}px`), e["--l-tabbar-item-gap"] = a;
153
146
  }
154
- return _(r);
147
+ return _(e);
155
148
  }
156
- #e(r) {
149
+ #e(e) {
157
150
  const t = document.createDocumentFragment();
158
- for (let e = 0, a = r.length; e < a; e++) {
159
- const i = r[e], c = b("div", {
151
+ for (let a = 0, r = e.length; a < r; a++) {
152
+ const i = e[a], c = b("div", {
160
153
  class: A([
161
154
  "l-tabbar-item",
162
155
  this.name === i.name ? "active" : void 0
@@ -180,6 +173,5 @@ class S extends y {
180
173
  }
181
174
  }
182
175
  export {
183
- S as default,
184
- N as shouldEventNext
176
+ R as default
185
177
  };
@@ -4,8 +4,7 @@ export default class Theme extends BaseComponent {
4
4
  static baseName: string;
5
5
  type: "button" | "select" | "switch" | "radio";
6
6
  label?: "text" | "icon";
7
- theme: string;
8
- constructor();
7
+ theme?: string;
9
8
  connectedCallback(): void;
10
9
  disconnectedCallback(): void;
11
10
  render(): any;
@@ -1,7 +1,7 @@
1
1
  import l from "../base.js";
2
- import { initAttr as c } from "../utils/index.js";
3
- import { create as i, $one as r, on as o, off as s } from "ph-utils/dom";
4
- import { getTheme as h, applyTheme as a } from "ph-utils/theme";
2
+ import { initAttr as h } from "../utils/index.js";
3
+ import { create as i, $one as c, on as o, off as s } from "ph-utils/dom";
4
+ import { getTheme as a, applyTheme as r } from "ph-utils/theme";
5
5
  const u = ":host{display:inline-flex;width:auto}.l-theme-btn::part(default){--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-text-color: #9ca3af;--l-btn-hover-text-color: #666666;width:var(--l-form-edit-height, 32px);padding:0;font-size:18px}.l-theme-switch.l-switch--checked{background-color:#65757129;border-color:#3c3f44}.l-theme-switch.l-switch--checked::part(action){background-color:#000;color:#fff}html.dark .l-theme-btn{--l-btn-hover-text-color: #ffffff}", d = [
6
6
  { value: "auto", text: "跟随系统", icon: "l-theme-default-icon" },
7
7
  { value: "light", text: "浅色模式", icon: "l-sun-icon" },
@@ -13,14 +13,11 @@ class k extends l {
13
13
  label = "text";
14
14
  theme;
15
15
  #t;
16
- constructor() {
17
- super(), c(this), this.theme = h();
18
- }
19
16
  connectedCallback() {
20
- this.loadStyleText(u), super.connectedCallback(), this.#c();
17
+ h(this), this.theme = a(), this.loadStyleText(u), super.connectedCallback(), this.#h();
21
18
  }
22
19
  disconnectedCallback() {
23
- super.disconnectedCallback(), this.#r();
20
+ super.disconnectedCallback(), this.#c();
24
21
  }
25
22
  render() {
26
23
  switch (this.type) {
@@ -78,12 +75,12 @@ class k extends l {
78
75
  const n = t.target.value;
79
76
  this.type !== "switch" ? e = n : e = n ? "dark" : "light";
80
77
  }
81
- await a(e), this.theme = e, this.type === "button" && this.#n(this.#t), this.dispatchEvent(new CustomEvent("change", { detail: e }));
78
+ await r(e), this.theme = e, this.type === "button" && this.#n(this.#t), this.dispatchEvent(new CustomEvent("change", { detail: e }));
82
79
  };
83
- #c() {
84
- this.#t = r(".l-theme-inner", this.root), this.type === "button" ? o(this.#t, "click", this.#e) : o(this.#t, "change", this.#e);
80
+ #h() {
81
+ this.#t = c(".l-theme-inner", this.root), this.type === "button" ? o(this.#t, "click", this.#e) : o(this.#t, "change", this.#e);
85
82
  }
86
- #r() {
83
+ #c() {
87
84
  this.#t && (this.type === "button" ? s(this.#t, "click", this.#e) : s(this.#t, "change", this.#e), this.#t = void 0);
88
85
  }
89
86
  }
@@ -1,8 +1,3 @@
1
- type UIConfig = {
2
- /** 注册应用的前缀, 默认: lt */
3
- prefix: string;
4
- };
5
- export declare function config(cfg: Partial<UIConfig>): void;
6
1
  /**
7
2
  * 注册 Web Components 组件
8
3
  * @param component Web Components 组件
@@ -17,7 +12,7 @@ export declare function regist(component: any | any[], name?: string): void;
17
12
  export declare function useId(): string;
18
13
  export declare function parseAttrValue(value: string, defaultValue?: string): string;
19
14
  export declare function parseAttrValue(value: string, defaultValue?: boolean, key?: string): boolean;
20
- export declare function parseAttrValue(value: string, defaultValue?: number, key?: string): number;
15
+ export declare function parseAttrValue(value: string, defaultValue?: number): number;
21
16
  /**
22
17
  * 初始化元素的属性值。
23
18
  * 遍历元素的所有属性,并对每个属性的值进行解析,然后将解析后的值赋给元素的相应属性。
@@ -1,122 +1,116 @@
1
1
  import { isBlank as N } from "ph-utils";
2
- import { iterate as $, transition as m, $ as p } from "ph-utils/dom";
3
- let E = -1, y = {
4
- /** 注册应用的前缀 */
5
- prefix: "l"
6
- };
7
- function H(t) {
8
- y = { ...y, ...t };
9
- }
10
- function _(t, r) {
2
+ import { $, iterate as x, transition as y } from "ph-utils/dom";
3
+ let E = -1;
4
+ function j(t, r) {
11
5
  const e = Array.isArray(t) ? t : [t];
12
6
  for (const i of e) {
13
- const n = r || `${y.prefix}-${i.baseName}`;
14
- customElements.get(n) || customElements.define(n, i);
7
+ const s = r || `l-${i.baseName}`;
8
+ customElements.get(s) || customElements.define(s, i);
15
9
  }
16
10
  }
17
- function k() {
18
- return `${y.prefix}-${++E}`;
11
+ function H() {
12
+ return `l-${++E}`;
19
13
  }
20
14
  function I(t, r, e) {
21
15
  if (t == null) return r;
22
16
  switch (typeof r) {
23
17
  case "boolean":
24
- return t === "" || t === "true" || t === "1" || t === e;
18
+ return ["", "true", "1", "on", e].includes(t);
25
19
  case "number":
26
20
  return Number(t);
27
21
  default:
28
22
  return t;
29
23
  }
30
24
  }
31
- function V(t) {
25
+ function k(t) {
32
26
  const r = t.attributes;
33
27
  for (const e of r) {
34
- const { name: i, value: n } = e;
28
+ const { name: i, value: s } = e;
35
29
  if (i.startsWith("data-") || i.startsWith("aria-") || i.startsWith("_") || i.startsWith("$") || ["id", "class", "style"].includes(i))
36
30
  continue;
37
- const s = i.split("-").map((d, h) => h === 0 ? d : d[0].toUpperCase() + d.slice(1)).join(""), f = I(n, t[s], i), u = Object.getOwnPropertyNames(t);
38
- (t._ignoreInitAttrs || []).includes(s) || (i === "value" ? (t[s] = f, t._resetValue = f) : u.includes(s) && (t[s] = f));
31
+ const n = i.split("-").map((d, h) => h === 0 ? d : d[0].toUpperCase() + d.slice(1)).join(""), f = I(s, t[n], i), u = Object.getOwnPropertyNames(t);
32
+ (t._ignoreInitAttrs || []).includes(n) || (i === "value" ? (t[n] = f, t._resetValue = f) : (u.includes(n) || u.includes(`_${n}`)) && (t[n] = f));
39
33
  }
40
34
  }
41
35
  function W(t, r) {
42
36
  let e = " ";
43
37
  return r === !0 ? e = ` ${t}` : typeof r == "string" && !N(r) && (e = ` ${t}="${r}"`), e;
44
38
  }
45
- function B(t) {
39
+ function l(t) {
46
40
  return t.map((e) => W(e[0], e[1])).join("");
47
41
  }
48
- function F(t, r) {
42
+ function C(t, r) {
49
43
  for (const e of r) {
50
- const i = e[1], n = e[0];
51
- i === !0 ? t.setAttribute(n, "") : typeof i == "string" && !N(i) && t.setAttribute(n, i);
44
+ const i = e[1], s = e[0];
45
+ i === !0 ? t.setAttribute(s, "") : typeof i == "string" && !N(i) && t.setAttribute(s, i);
52
46
  }
53
47
  }
54
- function M() {
48
+ function V() {
55
49
  let t;
56
50
  const r = {
57
51
  attributes: !0,
58
52
  attributeFilter: ["l-transition-emit"]
59
- }, e = (s) => {
60
- for (let f of s)
53
+ }, e = (n) => {
54
+ for (let f of n)
61
55
  if (f.type === "attributes" && f.attributeName) {
62
56
  const u = f.target, c = u.getAttribute(f.attributeName) || "show", d = u.getAttribute("l-transition") || "l", h = u.getAttribute("l-transition-method") || "hide";
63
- c === "show" ? (u.style.removeProperty("display"), m(u, d, "enter")) : m(u, d, "leave", () => {
57
+ c === "show" ? (u.style.removeProperty("display"), y(u, d, "enter")) : y(u, d, "leave", () => {
64
58
  h === "remove" ? u.remove() : u.style.display = "none";
65
59
  });
66
60
  }
67
61
  };
68
- function i(s) {
69
- s && s.length > 0 && (t == null && (t = new MutationObserver(e)), $(s, (f) => {
62
+ function i(n) {
63
+ n && n.length > 0 && (t == null && (t = new MutationObserver(e)), x(n, (f) => {
70
64
  const u = f.getAttribute("l-transition");
71
- u && (m(f, u, "enter"), t.observe(f, r));
65
+ u && (y(f, u, "enter"), t.observe(f, r));
72
66
  }));
73
67
  }
74
- function n(s) {
75
- s == null && (s = p("[l-transition]"), i(s));
68
+ function s(n) {
69
+ n == null && (n = $("[l-transition]"), i(n));
76
70
  }
77
71
  function o() {
78
72
  t && (t.disconnect(), t = void 0);
79
73
  }
80
- return { destroy: o, add: i, init: n };
74
+ return { destroy: o, add: i, init: s };
81
75
  }
82
- function w(t, r, e, i, n = 10) {
76
+ function m(t, r, e, i, s = 10) {
83
77
  let o = 0;
84
- 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;
78
+ return e === "top" ? o = r.height + s : e === "bottom" ? o = -(t.height + s) : (e === "left" || e === "right") && (i === "" ? o = r.height / 2 - t.height / 2 : i === "end" && (o = r.height - t.height)), o;
85
79
  }
86
- function x(t, r, e, i, n = 10) {
80
+ function w(t, r, e, i, s = 10) {
87
81
  let o = 0;
88
- 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;
82
+ return e === "left" ? o = r.width + s : e === "right" ? o = -(t.width + s) : (e === "top" || e === "bottom") && (i === "" ? o = r.width / 2 - t.width / 2 : i === "end" && (o = r.width - t.width)), o;
89
83
  }
90
- function U(t, r, e, i, n, o, s, f, u = 10, c = "absolute") {
91
- const d = window.innerHeight + o - 10, h = window.innerWidth + n - 10;
84
+ function v(t, r, e, i, s, o, n, f, u = 10, c = "absolute") {
85
+ const d = window.innerHeight + o - 10, h = window.innerWidth + s - 10;
92
86
  let a = t.top + o - f;
93
- a + r.height > d && (e === "left" || e === "right" ? i = "end" : e = "top", f = w(
87
+ a + r.height > d && (e === "left" || e === "right" ? i = "end" : e = "top", f = m(
94
88
  t,
95
89
  r,
96
90
  e,
97
91
  i,
98
92
  u
99
93
  ), a = t.top + o - f), a < o && (e === "left" || e === "right" ? i = "start" : e = "bottom");
100
- let b = t.left + n - s;
101
- return b + r.width > h && (e === "top" || e === "bottom" ? i = "end" : e = "left", s = x(
94
+ let b = t.left + s - n;
95
+ return b + r.width > h && (e === "top" || e === "bottom" ? i = "end" : e = "left", n = w(
102
96
  t,
103
97
  r,
104
98
  e,
105
99
  i,
106
100
  u
107
- ), b = t.left + n - s), b < n && (e === "top" || e === "bottom" ? i = "start" : e = "right"), c === "fixed" && (f = w(
101
+ ), b = t.left + s - n), b < s && (e === "top" || e === "bottom" ? i = "start" : e = "right"), c === "fixed" && (f = m(
108
102
  t,
109
103
  r,
110
104
  e,
111
105
  i,
112
106
  u
113
- ), s = x(
107
+ ), n = w(
114
108
  t,
115
109
  r,
116
110
  e,
117
111
  i,
118
112
  u
119
- ), b = t.left + n - s, a = t.top + o - f), {
113
+ ), b = t.left + s - n, a = t.top + o - f), {
120
114
  x: b,
121
115
  y: a,
122
116
  mainAlign: e,
@@ -124,16 +118,15 @@ function U(t, r, e, i, n, o, s, f, u = 10, c = "absolute") {
124
118
  };
125
119
  }
126
120
  export {
127
- H as config,
128
- M as createTransition,
129
- x as getPopoverOffsetX,
130
- w as getPopoverOffsetY,
131
- U as impactDetect,
132
- V as initAttr,
121
+ V as createTransition,
122
+ w as getPopoverOffsetX,
123
+ m as getPopoverOffsetY,
124
+ v as impactDetect,
125
+ k as initAttr,
133
126
  I as parseAttrValue,
134
- _ as regist,
135
- F as setAttrs,
127
+ j as regist,
128
+ C as setAttrs,
136
129
  W as tagAttr,
137
- B as tagAttrs,
138
- k as useId
130
+ l as tagAttrs,
131
+ H as useId
139
132
  };
@@ -6,7 +6,9 @@ import "ph-utils";
6
6
  import "ph-utils/validator";
7
7
  import "ph-utils/color";
8
8
  import "ph-utils/theme";
9
- class C extends a {
9
+ import "ph-utils/date";
10
+ import "ph-utils/web";
11
+ class _ extends a {
10
12
  static baseName = "transition";
11
13
  /** 应用过滤动画的属性值, 例如: opacity: 0; transform: xx; */
12
14
  sheetRec;
@@ -49,5 +51,5 @@ class C extends a {
49
51
  }
50
52
  }
51
53
  export {
52
- C as Transition
54
+ _ as Transition
53
55
  };
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "litos-ui",
3
3
  "description": "基于 Web Component 的 UI 组件库",
4
- "version": "0.12.2",
4
+ "version": "0.14.0",
5
5
  "type": "module",
6
6
  "devDependencies": {
7
- "@eslint/js": "^9.24.0",
8
- "@eslint/markdown": "^6.3.0",
9
- "@types/node": "^22.14.0",
10
- "eslint": "^9.24.0",
7
+ "@eslint/js": "^9.25.0",
8
+ "@eslint/markdown": "^6.4.0",
9
+ "@types/node": "^22.14.1",
10
+ "eslint": "^9.25.0",
11
11
  "globals": "^16.0.0",
12
12
  "less": "^4.3.0",
13
13
  "lightningcss": "^1.29.3",
14
14
  "prettier": "^3.5.3",
15
15
  "typescript": "^5.8.3",
16
- "typescript-eslint": "^8.29.1",
17
- "vite": "^6.2.5",
16
+ "typescript-eslint": "^8.30.1",
17
+ "vite": "^6.3.2",
18
18
  "vite-plugin-dts": "^4.5.3",
19
19
  "vitepress": "^1.6.3"
20
20
  },
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "iconify-icon": "^2.3.0",
56
56
  "ph-utils": "^0.15.4",
57
- "shiki": "^3.2.1"
57
+ "shiki": "^3.2.2"
58
58
  },
59
59
  "scripts": {
60
60
  "dev": "vite dev",
package/styles/vars.css CHANGED
@@ -2,7 +2,7 @@
2
2
  /* button、input 元素高度 */
3
3
  --l-form-edit-height: 32px;
4
4
  /** 禁用状态颜色 */
5
- --l-disabled-color: #f5f7fa;
5
+ --l-disabled-color: #e6e6e6;
6
6
  /* 主题(primary)颜色 */
7
7
  --l-primary-color: #722ed1;
8
8
  --l-primary-color-light1: #9254de;
@@ -1,17 +0,0 @@
1
- import FormInner from "../form/form_inner";
2
- export default class Checkbox extends FormInner {
3
- #private;
4
- static baseName: string;
5
- type?: "button";
6
- checked: boolean;
7
- label?: string;
8
- indeterminate: boolean;
9
- _ignoreInitAttrs: string[];
10
- constructor();
11
- connectedCallback(): void;
12
- disconnectedCallback(): void;
13
- static get observedAttributes(): string[];
14
- protected attributeChange(name: string, oldValue: string, newValue: string): void;
15
- render(): DocumentFragment;
16
- setValue(value: boolean | string[]): void;
17
- }