litos-ui 0.8.0 → 0.10.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 (52) hide show
  1. package/lib/base.js +26 -30
  2. package/lib/button/index.js +55 -59
  3. package/lib/checkbox/index.d.ts +17 -0
  4. package/lib/checkbox/index.js +135 -0
  5. package/lib/color_picker/index.js +17 -21
  6. package/lib/form/form_inner.js +46 -49
  7. package/lib/form/form_item.js +49 -54
  8. package/lib/form/index.js +62 -66
  9. package/lib/icon/arrow_down.js +4 -7
  10. package/lib/icon/arrow_left.js +4 -7
  11. package/lib/icon/arrow_right.js +4 -7
  12. package/lib/icon/arrow_up.js +4 -7
  13. package/lib/icon/base.js +21 -25
  14. package/lib/icon/caret_bottom.js +4 -7
  15. package/lib/icon/caret_top.js +4 -7
  16. package/lib/icon/font_icon.js +13 -17
  17. package/lib/icon/info.js +4 -7
  18. package/lib/icon/loading.js +4 -7
  19. package/lib/icon/mask_close.js +4 -7
  20. package/lib/icon/moon.js +4 -7
  21. package/lib/icon/reduction.js +4 -7
  22. package/lib/icon/refresh_left.js +4 -7
  23. package/lib/icon/refresh_right.js +4 -7
  24. package/lib/icon/search.js +4 -7
  25. package/lib/icon/sort.js +4 -7
  26. package/lib/icon/success.js +4 -7
  27. package/lib/icon/sun.js +4 -7
  28. package/lib/icon/theme_default.js +4 -7
  29. package/lib/icon/warn.js +4 -7
  30. package/lib/index.d.ts +4 -0
  31. package/lib/index.js +30 -26
  32. package/lib/input/index.js +66 -71
  33. package/lib/list/index.js +23 -27
  34. package/lib/litos-ui.css +1 -1
  35. package/lib/litos-ui.min.js +1 -1
  36. package/lib/md_input/index.d.ts +15 -0
  37. package/lib/md_input/index.js +60 -0
  38. package/lib/polygon/index.js +14 -18
  39. package/lib/popconfirm/index.js +11 -14
  40. package/lib/popover/index.js +107 -113
  41. package/lib/radio/index.js +53 -57
  42. package/lib/select_ori/index.js +23 -27
  43. package/lib/switch/index.js +34 -44
  44. package/lib/tabbar/index.js +117 -126
  45. package/lib/theme/index.js +71 -74
  46. package/lib/theme/theme_color.js +17 -27
  47. package/lib/{form/form_events.d.ts → utils/event.d.ts} +5 -7
  48. package/lib/utils/event.js +16 -18
  49. package/lib/utils/index.js +21 -21
  50. package/lib/utils/transition.js +23 -27
  51. package/package.json +1 -1
  52. package/lib/form/form_events.js +0 -24
@@ -1,95 +1,92 @@
1
- var C = Object.defineProperty;
2
- var b = (e) => {
3
- throw TypeError(e);
4
- };
5
- var E = (e, n, t) => n in e ? C(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
6
- var a = (e, n, t) => E(e, typeof n != "symbol" ? n + "" : n, t), m = (e, n, t) => n.has(e) || b("Cannot " + t);
7
- var s = (e, n, t) => (m(e, n, "read from private field"), t ? t.call(e) : n.get(e)), u = (e, n, t) => n.has(e) ? b("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(e) : n.set(e, t), p = (e, n, t, o) => (m(e, n, "write to private field"), o ? o.call(e, t) : n.set(e, t), t), c = (e, n, t) => (m(e, n, "access private method"), t);
8
- import M from "../base.js";
9
- import { initAttr as R } from "../utils/index.js";
10
- import { create as d, $one as H, on as v, off as k } from "ph-utils/dom";
11
- import { getTheme as L, applyTheme as j } from "ph-utils/theme";
12
- const A = ":host{display:inline-flex}.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}", B = [
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";
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 = [
13
6
  { value: "auto", text: "跟随系统", icon: "l-theme-default-icon" },
14
7
  { value: "light", text: "浅色模式", icon: "l-sun-icon" },
15
8
  { value: "dark", text: "深色模式", icon: "l-moon-icon" }
16
9
  ];
17
- var l, i, g, f, w, x, $, h, y, T;
18
- class I extends M {
10
+ class k extends l {
11
+ static baseName = "theme";
12
+ type = "button";
13
+ label = "text";
14
+ theme;
15
+ #t;
19
16
  constructor() {
20
- super();
21
- u(this, i);
22
- a(this, "type", "button");
23
- a(this, "label", "text");
24
- a(this, "theme");
25
- u(this, l);
26
- u(this, h, async (t) => {
27
- let o;
28
- if (this.type === "button")
29
- o = this.theme === "dark" ? "auto" : "dark";
30
- else {
31
- const r = t.target.value;
32
- this.type !== "switch" ? o = r : o = r ? "dark" : "light";
33
- }
34
- await j(o), this.theme = o, this.type === "button" && c(this, i, f).call(this, s(this, l)), this.dispatchEvent(new CustomEvent("change", { detail: o }));
35
- });
36
- R(this), this.theme = L();
17
+ super(), c(this), this.theme = h();
37
18
  }
38
19
  connectedCallback() {
39
- this.loadStyleText(A), super.connectedCallback(), c(this, i, y).call(this);
20
+ this.loadStyleText(u), super.connectedCallback(), this.#c();
40
21
  }
41
22
  disconnectedCallback() {
42
- super.disconnectedCallback(), c(this, i, T).call(this);
23
+ super.disconnectedCallback(), this.#r();
43
24
  }
44
25
  render() {
45
26
  switch (this.type) {
46
27
  case "select":
47
- return c(this, i, w).call(this);
28
+ return this.#o();
48
29
  case "radio":
49
- return c(this, i, $).call(this);
30
+ return this.#l();
50
31
  case "switch":
51
- return c(this, i, x).call(this);
32
+ return this.#s();
52
33
  default:
53
- return c(this, i, g).call(this);
34
+ return this.#i();
35
+ }
36
+ }
37
+ #i() {
38
+ const t = i("l-button", {
39
+ class: "l-theme-btn l-theme-inner"
40
+ });
41
+ return this.#n(t), t;
42
+ }
43
+ #n(t) {
44
+ const e = this.theme === "auto" ? "sun" : "moon";
45
+ t.innerHTML = `<l-${e}-icon></l-${e}-icon>`;
46
+ }
47
+ #o() {
48
+ const t = i("l-select-ori", {
49
+ class: "l-theme-inner"
50
+ });
51
+ t.value = this.theme;
52
+ const e = [
53
+ '<option value="auto">跟随系统</option>',
54
+ '<option value="light">浅色模式</option>',
55
+ '<option value="dark">深色模式</option>'
56
+ ];
57
+ return t.innerHTML = e.join(""), t;
58
+ }
59
+ #s() {
60
+ const t = i("l-switch", {
61
+ class: "l-theme-switch l-theme-inner"
62
+ });
63
+ return t.value = this.theme === "dark", t.innerHTML = '<l-sun-icon slot="unchecked-action"></l-sun-icon><l-moon-icon slot="checked-action"></l-moon-icon>', t;
64
+ }
65
+ #l() {
66
+ const t = i("l-radio", {
67
+ class: "l-theme-inner"
68
+ });
69
+ t.value = this.theme, t.type = "button";
70
+ const e = d.map((n) => this.label === "icon" ? `<${n.icon} radio-value="${n.value}"></${n.icon}>` : `<span radio-value="${n.value}">${n.text}</span>`);
71
+ return t.innerHTML = e.join(""), t;
72
+ }
73
+ #e = async (t) => {
74
+ let e;
75
+ if (this.type === "button")
76
+ e = this.theme === "dark" ? "auto" : "dark";
77
+ else {
78
+ const n = t.target.value;
79
+ this.type !== "switch" ? e = n : e = n ? "dark" : "light";
54
80
  }
81
+ await a(e), this.theme = e, this.type === "button" && this.#n(this.#t), this.dispatchEvent(new CustomEvent("change", { detail: e }));
82
+ };
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);
85
+ }
86
+ #r() {
87
+ this.#t && (this.type === "button" ? s(this.#t, "click", this.#e) : s(this.#t, "change", this.#e), this.#t = void 0);
55
88
  }
56
89
  }
57
- l = new WeakMap(), i = new WeakSet(), g = function() {
58
- const t = d("l-button", {
59
- class: "l-theme-btn l-theme-inner"
60
- });
61
- return c(this, i, f).call(this, t), t;
62
- }, f = function(t) {
63
- const o = this.theme === "auto" ? "sun" : "moon";
64
- t.innerHTML = `<l-${o}-icon></l-${o}-icon>`;
65
- }, w = function() {
66
- const t = d("l-select-ori", {
67
- class: "l-theme-inner"
68
- });
69
- t.value = this.theme;
70
- const o = [
71
- '<option value="auto">跟随系统</option>',
72
- '<option value="light">浅色模式</option>',
73
- '<option value="dark">深色模式</option>'
74
- ];
75
- return t.innerHTML = o.join(""), t;
76
- }, x = function() {
77
- const t = d("l-switch", {
78
- class: "l-theme-switch l-theme-inner"
79
- });
80
- return t.value = this.theme === "dark", t.innerHTML = '<l-sun-icon slot="unchecked-action"></l-sun-icon><l-moon-icon slot="checked-action"></l-moon-icon>', t;
81
- }, $ = function() {
82
- const t = d("l-radio", {
83
- class: "l-theme-inner"
84
- });
85
- t.value = this.theme, t.type = "button";
86
- const o = B.map((r) => this.label === "icon" ? `<${r.icon} radio-value="${r.value}"></${r.icon}>` : `<span radio-value="${r.value}">${r.text}</span>`);
87
- return t.innerHTML = o.join(""), t;
88
- }, h = new WeakMap(), y = function() {
89
- p(this, l, H(".l-theme-inner", this.root)), this.type === "button" ? v(s(this, l), "click", s(this, h)) : v(s(this, l), "change", s(this, h));
90
- }, T = function() {
91
- s(this, l) && (this.type === "button" ? k(s(this, l), "click", s(this, h)) : k(s(this, l), "change", s(this, h)), p(this, l, void 0));
92
- }, a(I, "baseName", "theme");
93
90
  export {
94
- I as default
91
+ k as default
95
92
  };
@@ -1,28 +1,14 @@
1
- var d = Object.defineProperty;
2
- var s = (o) => {
3
- throw TypeError(o);
4
- };
5
- var u = (o, t, e) => t in o ? d(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
6
- var a = (o, t, e) => u(o, typeof t != "symbol" ? t + "" : t, e), i = (o, t, e) => t.has(o) || s("Cannot " + e);
7
- var h = (o, t, e) => (i(o, t, "read from private field"), e ? e.call(o) : t.get(o)), l = (o, t, e) => t.has(o) ? s("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e);
8
- var m = (o, t, e) => (i(o, t, "access private method"), e);
9
- import { $one as C, on as k } from "ph-utils/dom";
10
- import f from "../base.js";
11
- import { getColorTheme as g, applyColorTheme as v } from "ph-utils/theme";
12
- var c, p, r;
13
- class E extends f {
1
+ import { $one as t, on as r } from "ph-utils/dom";
2
+ import c from "../base.js";
3
+ import { getColorTheme as n, applyColorTheme as l } from "ph-utils/theme";
4
+ class m extends c {
5
+ static baseName = "theme-color";
6
+ color;
14
7
  constructor() {
15
- super();
16
- l(this, c);
17
- a(this, "color");
18
- l(this, r, async (e) => {
19
- const n = e.detail;
20
- this.color = n, await v(n), this.dispatchEvent(new CustomEvent("change", { detail: n }));
21
- });
22
- this.color = g() || "#722ed1";
8
+ super(), this.color = n() || "#722ed1";
23
9
  }
24
10
  connectedCallback() {
25
- super.connectedCallback(), m(this, c, p).call(this);
11
+ super.connectedCallback(), this.#e();
26
12
  }
27
13
  render() {
28
14
  const e = document.createElement(
@@ -30,11 +16,15 @@ class E extends f {
30
16
  );
31
17
  return e.value = this.color, e;
32
18
  }
19
+ #e() {
20
+ const e = t("l-color-picker", this.root);
21
+ e && r(e, "change", this.#o);
22
+ }
23
+ #o = async (e) => {
24
+ const o = e.detail;
25
+ this.color = o, await l(o), this.dispatchEvent(new CustomEvent("change", { detail: o }));
26
+ };
33
27
  }
34
- c = new WeakSet(), p = function() {
35
- const e = C("l-color-picker", this.root);
36
- e && k(e, "change", h(this, r));
37
- }, r = new WeakMap(), a(E, "baseName", "theme-color");
38
28
  export {
39
- E as default
29
+ m as default
40
30
  };
@@ -1,12 +1,11 @@
1
- type EventName = "attributeChanged" | "formSubmitted" | "ruleChange" | "valueChange" | "validateChange" | "reset" | "submit";
2
1
  /**
3
2
  * 添加表单事件监听器。
4
3
  * @param formId - 表单的唯一标识符。
5
- * @param event - 要监听的事件类型,可以是 'attributeChanged' 或 'formSubmitted'。
4
+ * @param event - 要监听的事件类型
6
5
  * @param cb - 当事件触发时调用的回调函数,接收两个参数:属性名和属性值。
7
6
  * 该函数用于将回调函数添加到指定表单ID的事件监听器集合中。
8
7
  */
9
- export declare function add(id: string, event: EventName, cb: (...param: any) => void): void;
8
+ export declare function add(channel: string, event: string, cb: (...param: any) => void): void;
10
9
  /**
11
10
  * 移除指定表单的事件监听器。
12
11
  * @param formId - 表单的唯一标识符。
@@ -15,18 +14,17 @@ export declare function add(id: string, event: EventName, cb: (...param: any) =>
15
14
  * 该函数会从事件存储中移除指定的回调函数,如果某个事件类型下没有更多的回调函数,则删除该事件类型;
16
15
  * 如果表单下没有更多的事件类型,则删除该表单;如果事件存储为空,则重置事件存储。
17
16
  */
18
- export declare function remove(id: string, event: EventName, cb: (...params: any) => void): void;
17
+ export declare function remove(channel: string, event: string, cb: (...params: any) => void): void;
19
18
  /**
20
19
  * 清除事件存储。如果提供了ID,则删除特定ID的事件;如果没有提供ID,则清除所有事件。
21
20
  * 当事件存储为空时,将其设置为undefined。
22
21
  * @param id 可选参数,指定要删除的事件ID。
23
22
  */
24
- export declare function clear(id?: string): void;
23
+ export declare function clear(channel?: string): void;
25
24
  /**
26
25
  * 触发指定表单的事件,并执行所有注册的回调函数。
27
26
  * @param id - 表单的唯一标识符。
28
27
  * @param event - 要触发的事件名称。
29
28
  * @param params - 要传递给回调函数的参数列表。
30
29
  */
31
- export declare function emit(id: string, event: EventName, ...params: any): void;
32
- export {};
30
+ export declare function emit(channel: string, event: string, ...params: any): void;
@@ -1,24 +1,22 @@
1
- let i;
2
- function w(f, t, o) {
3
- i == null && (i = /* @__PURE__ */ new Map()), i.has(f) || i.set(f, /* @__PURE__ */ new Map([[t, /* @__PURE__ */ new Set()]])), i.get(f).has(t) || i.get(f).set(t, /* @__PURE__ */ new Set()), i.get(f).get(t).add(o);
1
+ let e;
2
+ function s(t, i, f) {
3
+ e == null && (e = /* @__PURE__ */ new Map()), e.has(t) || e.set(t, /* @__PURE__ */ new Map([[i, /* @__PURE__ */ new Set()]])), e.get(t).has(i) || e.get(t).set(i, /* @__PURE__ */ new Set()), e.get(t).get(i).add(f);
4
4
  }
5
- function z(f, t, o) {
6
- var g, d, e, l, u, r;
7
- (d = (g = i == null ? void 0 : i.get(f)) == null ? void 0 : g.get(t)) == null || d.delete(o), ((l = (e = i == null ? void 0 : i.get(f)) == null ? void 0 : e.get(t)) == null ? void 0 : l.size) == 0 && ((u = i.get(f)) == null || u.delete(t)), ((r = i == null ? void 0 : i.get(f)) == null ? void 0 : r.size) == 0 && i.delete(f), (i == null ? void 0 : i.size) == 0 && (i = void 0);
5
+ function d(t, i, f) {
6
+ e?.get(t)?.get(i)?.delete(f), e?.get(t)?.get(i)?.size == 0 && e.get(t)?.delete(i), e?.get(t)?.size == 0 && e.delete(t), e?.size == 0 && (e = void 0);
8
7
  }
9
- function p(f) {
10
- f == null ? i != null && (i.clear(), i = void 0) : i != null && (i.delete(f), i.size === 0 && (i = void 0));
8
+ function l(t) {
9
+ t == null ? e != null && (e.clear(), e = void 0) : e != null && (e.delete(t), e.size === 0 && (e = void 0));
11
10
  }
12
- function m(f, t, ...o) {
13
- var d;
14
- const g = (d = i == null ? void 0 : i.get(f)) == null ? void 0 : d.get(t);
15
- if (g != null)
16
- for (const e of g)
17
- e(...o);
11
+ function u(t, i, ...f) {
12
+ const o = e?.get(t)?.get(i);
13
+ if (o != null)
14
+ for (const g of o)
15
+ g(...f);
18
16
  }
19
17
  export {
20
- w as add,
21
- p as clear,
22
- m as emit,
23
- z as remove
18
+ s as add,
19
+ l as clear,
20
+ u as emit,
21
+ d as remove
24
22
  };
@@ -17,7 +17,7 @@ function _(t, r) {
17
17
  function k() {
18
18
  return `${y.prefix}-${++E}`;
19
19
  }
20
- function W(t, r, e) {
20
+ function I(t, r, e) {
21
21
  if (t == null) return r;
22
22
  switch (typeof r) {
23
23
  case "boolean":
@@ -34,16 +34,16 @@ function V(t) {
34
34
  const { name: i, value: n } = e;
35
35
  if (i.startsWith("data-") || i.startsWith("aria-") || i.startsWith("_") || i.startsWith("$") || ["id", "class", "style"].includes(i))
36
36
  continue;
37
- const s = i.split("-").map((d, a) => a === 0 ? d : d[0].toUpperCase() + d.slice(1)).join(""), f = W(n, t[s], i), u = Object.getOwnPropertyNames(t), h = t._ignoreInitAttrs || [];
38
- i === "value" ? (t[s] = f, t._resetValue = f) : u.includes(s) && !h.includes(s) && (t[s] = f);
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));
39
39
  }
40
40
  }
41
- function I(t, r) {
41
+ function W(t, r) {
42
42
  let e = " ";
43
43
  return r === !0 ? e = ` ${t}` : typeof r == "string" && !N(r) && (e = ` ${t}="${r}"`), e;
44
44
  }
45
45
  function B(t) {
46
- return t.map((e) => I(e[0], e[1])).join("");
46
+ return t.map((e) => W(e[0], e[1])).join("");
47
47
  }
48
48
  function F(t, r) {
49
49
  for (const e of r) {
@@ -59,9 +59,9 @@ function M() {
59
59
  }, e = (s) => {
60
60
  for (let f of s)
61
61
  if (f.type === "attributes" && f.attributeName) {
62
- const u = f.target, h = u.getAttribute(f.attributeName) || "show", d = u.getAttribute("l-transition") || "l", a = u.getAttribute("l-transition-method") || "hide";
63
- h === "show" ? (u.style.removeProperty("display"), m(u, d, "enter")) : m(u, d, "leave", () => {
64
- a === "remove" ? u.remove() : u.style.display = "none";
62
+ 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", () => {
64
+ h === "remove" ? u.remove() : u.style.display = "none";
65
65
  });
66
66
  }
67
67
  };
@@ -87,24 +87,24 @@ function x(t, r, e, i, n = 10) {
87
87
  let o = 0;
88
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;
89
89
  }
90
- function U(t, r, e, i, n, o, s, f, u = 10, h = "absolute") {
91
- const d = window.innerHeight + o - 10, a = window.innerWidth + n - 10;
92
- let b = t.top + o - f;
93
- b + r.height > d && (e === "left" || e === "right" ? i = "end" : e = "top", f = w(
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;
92
+ let a = t.top + o - f;
93
+ a + r.height > d && (e === "left" || e === "right" ? i = "end" : e = "top", f = w(
94
94
  t,
95
95
  r,
96
96
  e,
97
97
  i,
98
98
  u
99
- ), b = t.top + o - f), b < o && (e === "left" || e === "right" ? i = "start" : e = "bottom");
100
- let c = t.left + n - s;
101
- return c + r.width > a && (e === "top" || e === "bottom" ? i = "end" : e = "left", s = x(
99
+ ), 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(
102
102
  t,
103
103
  r,
104
104
  e,
105
105
  i,
106
106
  u
107
- ), c = t.left + n - s), c < n && (e === "top" || e === "bottom" ? i = "start" : e = "right"), h === "fixed" && (f = w(
107
+ ), b = t.left + n - s), b < n && (e === "top" || e === "bottom" ? i = "start" : e = "right"), c === "fixed" && (f = w(
108
108
  t,
109
109
  r,
110
110
  e,
@@ -116,9 +116,9 @@ function U(t, r, e, i, n, o, s, f, u = 10, h = "absolute") {
116
116
  e,
117
117
  i,
118
118
  u
119
- ), c = t.left + n - s, b = t.top + o - f), {
120
- x: c,
121
- y: b,
119
+ ), b = t.left + n - s, a = t.top + o - f), {
120
+ x: b,
121
+ y: a,
122
122
  mainAlign: e,
123
123
  crossAlign: i
124
124
  };
@@ -130,10 +130,10 @@ export {
130
130
  w as getPopoverOffsetY,
131
131
  U as impactDetect,
132
132
  V as initAttr,
133
- W as parseAttrValue,
133
+ I as parseAttrValue,
134
134
  _ as regist,
135
135
  F as setAttrs,
136
- I as tagAttr,
136
+ W as tagAttr,
137
137
  B as tagAttrs,
138
138
  k as useId
139
139
  };
@@ -1,57 +1,53 @@
1
- var c = Object.defineProperty;
2
- var d = (s, e, t) => e in s ? c(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var o = (s, e, t) => d(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { initAttr as p } from "./index.js";
5
- import u from "../base.js";
1
+ import { initAttr as h } from "./index.js";
2
+ import a from "../base.js";
6
3
  import "../message/index.js";
7
- import { transition as n } from "ph-utils/dom";
4
+ import { transition as i } from "ph-utils/dom";
8
5
  import "ph-utils";
9
6
  import "ph-utils/validator";
10
7
  import "ph-utils/color";
11
8
  import "ph-utils/theme";
12
- class m extends u {
13
- constructor() {
14
- super();
15
- /** 应用过滤动画的属性值, 例如: opacity: 0; transform: xx; */
16
- o(this, "sheetRec");
17
- o(this, "duration", "0.3s");
18
- p(this), this.sheetRec = this._parseSheets(this.getAttr("sheets", "opacity: 0"));
19
- }
9
+ class C extends a {
10
+ static baseName = "transition";
11
+ /** 应用过滤动画的属性值, 例如: opacity: 0; transform: xx; */
12
+ sheetRec;
13
+ duration = "0.3s";
20
14
  static get observedAttributes() {
21
15
  return ["sheets"];
22
16
  }
17
+ constructor() {
18
+ super(), h(this), this.sheetRec = this._parseSheets(this.getAttr("sheets", "opacity: 0"));
19
+ }
23
20
  connectedCallback() {
24
21
  super.connectedCallback(), this.show();
25
22
  }
26
23
  render() {
27
24
  this.shadow.innerHTML = "<slot></slot>";
28
25
  }
29
- attributeChangedCallback(t, r, i) {
30
- t === "sheets" && (this.sheetRec = this._parseSheets(i));
26
+ attributeChangedCallback(t, e, s) {
27
+ t === "sheets" && (this.sheetRec = this._parseSheets(s));
31
28
  }
32
29
  show() {
33
30
  const t = this._getSlotFirstChild();
34
- t && n(t, this.sheetRec, "enter");
31
+ t && i(t, this.sheetRec, "enter");
35
32
  }
36
33
  hide(t) {
37
- const r = this._getSlotFirstChild();
38
- r && n(r, this.sheetRec, "leave", t);
34
+ const e = this._getSlotFirstChild();
35
+ e && i(e, this.sheetRec, "leave", t);
39
36
  }
40
37
  _parseSheets(t) {
41
- const r = t.split(";"), i = [];
42
- return r.forEach((h) => {
43
- if (h) {
44
- const [a, l] = h.split(":");
45
- i.push([a.trim(), l.trim(), this.duration]);
38
+ const e = t.split(";"), s = [];
39
+ return e.forEach((r) => {
40
+ if (r) {
41
+ const [o, n] = r.split(":");
42
+ s.push([o.trim(), n.trim(), this.duration]);
46
43
  }
47
- }), i;
44
+ }), s;
48
45
  }
49
46
  _getSlotFirstChild() {
50
47
  const t = this.shadow.querySelector("slot");
51
48
  return t != null && t.assignedNodes().length > 0 ? t.assignedNodes()[0] : null;
52
49
  }
53
50
  }
54
- o(m, "baseName", "transition");
55
51
  export {
56
- m as Transition
52
+ C as Transition
57
53
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "litos-ui",
3
3
  "description": "基于 Web Component 的 UI 组件库",
4
- "version": "0.8.0",
4
+ "version": "0.10.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
@@ -1,24 +0,0 @@
1
- let e;
2
- function n(l, f, t) {
3
- e == null && (e = /* @__PURE__ */ new Map()), e.has(l) || e.set(l, /* @__PURE__ */ new Map([[f, /* @__PURE__ */ new Set()]])), e.get(l).has(f) || e.get(l).set(f, /* @__PURE__ */ new Set()), e.get(l).get(f).add(t);
4
- }
5
- function r(l, f, t) {
6
- var i, o, g, u, a, c;
7
- (o = (i = e == null ? void 0 : e.get(l)) == null ? void 0 : i.get(f)) == null || o.delete(t), ((u = (g = e == null ? void 0 : e.get(l)) == null ? void 0 : g.get(f)) == null ? void 0 : u.size) == 0 && ((a = e.get(l)) == null || a.delete(f)), ((c = e == null ? void 0 : e.get(l)) == null ? void 0 : c.size) == 0 && e.delete(l), (e == null ? void 0 : e.size) == 0 && (e = void 0);
8
- }
9
- function w(l) {
10
- l == null ? e != null && (e.clear(), e = void 0) : e != null && (e.delete(l), e.size === 0 && (e = void 0));
11
- }
12
- function z(l, f, ...t) {
13
- var o;
14
- const i = (o = e == null ? void 0 : e.get(l)) == null ? void 0 : o.get(f);
15
- if (i != null)
16
- for (const g of i)
17
- g(...t);
18
- }
19
- export {
20
- n as add,
21
- w as clear,
22
- z as emit,
23
- r as remove
24
- };