litos-ui 0.7.0 → 0.8.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 (57) hide show
  1. package/lib/{animation-QfX4RtqD.js → animation-DttknHkX.js} +2 -2
  2. package/lib/base.d.ts +1 -3
  3. package/lib/base.js +12 -40
  4. package/lib/button/index.js +49 -49
  5. package/lib/color_picker/index.js +6 -4
  6. package/lib/form/form_item.d.ts +1 -1
  7. package/lib/form/form_item.js +26 -25
  8. package/lib/form/index.d.ts +1 -1
  9. package/lib/form/index.js +42 -41
  10. package/lib/icon/base.js +19 -18
  11. package/lib/{index-B_9rPBWp.js → index-391POYEJ.js} +1 -1
  12. package/lib/index.d.ts +2 -10
  13. package/lib/index.js +62 -70
  14. package/lib/input/index.d.ts +1 -1
  15. package/lib/input/index.js +16 -15
  16. package/lib/list/index.d.ts +1 -1
  17. package/lib/list/index.js +13 -13
  18. package/lib/litos-ui.css +1 -1
  19. package/lib/litos-ui.min.js +1 -1
  20. package/lib/message/index.js +35 -33
  21. package/lib/polygon/index.d.ts +1 -1
  22. package/lib/polygon/index.js +17 -16
  23. package/lib/popconfirm/index.js +11 -14
  24. package/lib/popover/index.js +98 -97
  25. package/lib/radio/index.d.ts +2 -2
  26. package/lib/radio/index.js +69 -68
  27. package/lib/select_ori/index.d.ts +1 -1
  28. package/lib/select_ori/index.js +8 -8
  29. package/lib/switch/index.js +42 -41
  30. package/lib/tabbar/index.js +93 -92
  31. package/lib/theme/index.js +39 -39
  32. package/lib/utils/index.js +48 -51
  33. package/lib/utils/transition.js +9 -15
  34. package/package.json +4 -1
  35. package/lib/browser.d.ts +0 -17
  36. package/lib/button/regist.d.ts +0 -2
  37. package/lib/button/regist.js +0 -7
  38. package/lib/form/types.js +0 -1
  39. package/lib/index-116dRdDj.js +0 -4
  40. package/lib/index-BUyxD_nH.js +0 -4
  41. package/lib/index-BeOxuMd4.js +0 -4
  42. package/lib/index-Bl8lRTJd.js +0 -4
  43. package/lib/index-BxlGVrX3.js +0 -4
  44. package/lib/index-C2D4YsFw.js +0 -4
  45. package/lib/index-C98Kx857.js +0 -4
  46. package/lib/index-CCcVpk6U.js +0 -4
  47. package/lib/index-CMz7GCCH.js +0 -4
  48. package/lib/index-D-Ikkdx0.js +0 -4
  49. package/lib/index-DJ70Xyma.js +0 -4
  50. package/lib/index-DKvzJmsR.js +0 -4
  51. package/lib/index-oNjb_IVt.js +0 -4
  52. package/lib/popconfirm/regist.d.ts +0 -2
  53. package/lib/popconfirm/regist.js +0 -7
  54. package/lib/popover/regist.d.ts +0 -2
  55. package/lib/popover/regist.js +0 -7
  56. package/lib/tabbar/regist.d.ts +0 -2
  57. package/lib/tabbar/regist.js +0 -7
@@ -1,64 +1,65 @@
1
- var p = Object.defineProperty;
2
- var u = (t) => {
3
- throw TypeError(t);
1
+ var x = Object.defineProperty;
2
+ var u = (e) => {
3
+ throw TypeError(e);
4
4
  };
5
- var v = (t, s, e) => s in t ? p(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
- var n = (t, s, e) => v(t, typeof s != "symbol" ? s + "" : s, e), k = (t, s, e) => s.has(t) || u("Cannot " + e);
7
- var d = (t, s, e) => (k(t, s, "read from private field"), e ? e.call(t) : s.get(t)), r = (t, s, e) => s.has(t) ? u("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e);
8
- var a = (t, s, e) => (k(t, s, "access private method"), e);
9
- import { on as x, off as T, addClass as m, removeClass as w, $one as l } from "ph-utils/dom";
10
- import C from "../form/form_inner.js";
11
- import { initAttr as b, parseAttrValue as L } from "../utils/index.js";
12
- var h, c, o;
13
- class V extends C {
5
+ var w = (e, i, t) => i in e ? x(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
6
+ var o = (e, i, t) => w(e, typeof i != "symbol" ? i + "" : i, t), p = (e, i, t) => i.has(e) || u("Cannot " + t);
7
+ var r = (e, i, t) => (p(e, i, "read from private field"), t ? t.call(e) : i.get(e)), d = (e, i, t) => i.has(e) ? u("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t);
8
+ var l = (e, i, t) => (p(e, i, "access private method"), t);
9
+ import { on as k, off as v, addClass as b, removeClass as g, $one as n } from "ph-utils/dom";
10
+ import m from "../form/form_inner.js";
11
+ import { initAttr as T, parseAttrValue as y } from "../utils/index.js";
12
+ const C = ":host{display:inline-flex}:host{--l-switch-height: 22px;--l-switch-width: 40px;display:inline-flex;box-sizing:border-box;width:var(--l-switch-width);height:var(--l-switch-height);align-items:center;justify-content:flex-start;background-color:#dcdfe6;border-radius:calc(var(--l-switch-height) / 2);padding:2px;position:relative;cursor:pointer;transition:all .3s ease-in-out;vertical-align:middle;border:1px solid #c2c2c2}:host(:hover),:host(.l-switch--checked):hover{border-color:var(--l-primary-color, #722ed1)}:host(.l-switch--checked){background-color:var(--l-primary-color, #722ed1);border-color:var(--l-primary-color, #722ed1)}.l-switch-action{position:absolute;width:calc(var(--l-switch-height) - 6px);top:2px;left:2px;bottom:2px;background-color:#fff;border-radius:50%;transition:all .3s ease-in-out;display:flex;justify-content:center;align-items:center;padding:2px;font-size:12px;box-sizing:border-box}.l-switch-text{color:#fff;padding-left:calc(var(--l-switch-width) - 20px);transition:padding-left .3s ease-in-out}:host(.l-switch--checked) .l-switch-action{left:calc(var(--l-switch-width) - var(--l-switch-height) + 3px)}:host(.l-switch--checked) .l-switch-text{padding-left:5px}";
13
+ var h, c, a;
14
+ class L extends m {
14
15
  constructor() {
15
16
  super(!1);
16
- r(this, c);
17
- n(this, "actionRender");
18
- n(this, "checkedText");
19
- n(this, "uncheckedText");
20
- r(this, h, (e) => {
17
+ d(this, c);
18
+ o(this, "actionRender");
19
+ o(this, "checkedText");
20
+ o(this, "uncheckedText");
21
+ d(this, h, (t) => {
21
22
  this.isDisabled() || (this.setValue(!this.value), this.dispatchEvent(new CustomEvent("change")));
22
23
  });
23
- b(this);
24
- const e = this.value ? L(this.value, !1, "value") : !1;
25
- this._resetValue = e, this.value = e;
24
+ T(this);
25
+ const t = this.value ? y(this.value, !1, "value") : !1;
26
+ this._resetValue = t, this.value = t;
26
27
  }
27
28
  connectedCallback() {
28
- this.loadStyle(["switch"]), super.connectedCallback(), this.pushValueChange(), a(this, c, o).call(this), x(this, "click", d(this, h));
29
+ this.loadStyleText(C), super.connectedCallback(), this.pushValueChange(), l(this, c, a).call(this), k(this, "click", r(this, h));
29
30
  }
30
31
  disconnectedCallback() {
31
- super.disconnectedCallback(), T(this, "click", d(this, h)), this.actionRender = void 0;
32
+ super.disconnectedCallback(), v(this, "click", r(this, h)), this.actionRender = void 0;
32
33
  }
33
34
  render() {
34
35
  this.isDisabled() && this.classList.add("l-switch--disabled"), this.value && this.classList.add("l-switch--checked");
35
- const e = ['<div class="l-switch-action" part="action"></div>'];
36
+ const t = ['<div class="l-switch-action" part="action"></div>'];
36
37
  if (this.checkedText || this.uncheckedText) {
37
- const i = this.value ? this.checkedText || "" : this.uncheckedText || "";
38
- e.push(`<span class="l-switch-text">${i}</span>`);
38
+ const s = this.value ? this.checkedText || "" : this.uncheckedText || "";
39
+ t.push(`<span class="l-switch-text">${s}</span>`);
39
40
  }
40
- return e.join("");
41
+ return t.join("");
41
42
  }
42
- setValue(e) {
43
- super.setValue(e), e ? m(this, "l-switch--checked") : w(this, "l-switch--checked");
44
- const i = l(".l-switch-text", this.root);
45
- i && (i.textContent = this.value ? this.checkedText || "" : this.uncheckedText || ""), a(this, c, o).call(this);
43
+ setValue(t) {
44
+ super.setValue(t), t ? b(this, "l-switch--checked") : g(this, "l-switch--checked");
45
+ const s = n(".l-switch-text", this.root);
46
+ s && (s.textContent = this.value ? this.checkedText || "" : this.uncheckedText || ""), l(this, c, a).call(this);
46
47
  }
47
- setActionRender(e) {
48
- this.actionRender = e, a(this, c, o).call(this);
48
+ setActionRender(t) {
49
+ this.actionRender = t, l(this, c, a).call(this);
49
50
  }
50
51
  }
51
- h = new WeakMap(), c = new WeakSet(), o = function() {
52
- const e = l(".l-switch-action", this.root);
53
- if (e)
52
+ h = new WeakMap(), c = new WeakSet(), a = function() {
53
+ const t = n(".l-switch-action", this.root);
54
+ if (t)
54
55
  if (this.actionRender) {
55
- const i = this.actionRender({ checked: this.value });
56
- typeof i == "string" ? e.innerHTML = i : e.innerHTML = i.outerHTML;
56
+ const s = this.actionRender({ checked: this.value });
57
+ typeof s == "string" ? t.innerHTML = s : t.innerHTML = s.outerHTML;
57
58
  } else {
58
- const i = l('[slot="checked-action"]', this), f = l('[slot="unchecked-action"]', this);
59
- this.value && i ? e.innerHTML = '<slot name="checked-action"></slot>' : !this.value && f && (e.innerHTML = '<slot name="unchecked-action"></slot>');
59
+ const s = n('[slot="checked-action"]', this), f = n('[slot="unchecked-action"]', this);
60
+ this.value && s ? t.innerHTML = '<slot name="checked-action"></slot>' : !this.value && f && (t.innerHTML = '<slot name="unchecked-action"></slot>');
60
61
  }
61
- }, n(V, "baseName", "switch");
62
+ }, o(L, "baseName", "switch");
62
63
  export {
63
- V as default
64
+ L as default
64
65
  };
@@ -1,70 +1,71 @@
1
- var L = Object.defineProperty;
2
- var A = (n) => {
3
- throw TypeError(n);
1
+ var A = Object.defineProperty;
2
+ var k = (o) => {
3
+ throw TypeError(o);
4
4
  };
5
- var N = (n, a, e) => a in n ? L(n, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[a] = e;
6
- var f = (n, a, e) => N(n, typeof a != "symbol" ? a + "" : a, e), w = (n, a, e) => a.has(n) || A("Cannot " + e);
7
- var k = (n, a, e) => a.has(n) ? A("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(n) : a.set(n, e);
8
- var u = (n, a, e) => (w(n, a, "access private method"), e);
5
+ var L = (o, i, e) => i in o ? A(o, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[i] = e;
6
+ var h = (o, i, e) => L(o, typeof i != "symbol" ? i + "" : i, e), N = (o, i, e) => i.has(o) || k("Cannot " + e);
7
+ var w = (o, i, e) => i.has(o) ? k("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(o) : i.set(o, e);
8
+ var u = (o, i, e) => (N(o, i, "access private method"), e);
9
9
  import { isBlank as g, isNumeric as T } from "ph-utils";
10
- import W from "../base.js";
11
- import { initAttr as E, parseAttrValue as C } from "../utils/index.js";
12
- import { addClass as v, removeClass as $, $one as l, create as b, $ as x, iterate as j, on as S, off as B, isVisible as D, formatStyle as I, formatClass as M } from "ph-utils/dom";
13
- function R(n, a, e) {
14
- let t = n.target, i = "";
10
+ import j from "../base.js";
11
+ import { initAttr as W, parseAttrValue as x } from "../utils/index.js";
12
+ import { addClass as v, removeClass as y, $one as c, create as f, $ as _, iterate as E, on as S, off as z, isVisible as B, formatStyle as D, formatClass as I } from "ph-utils/dom";
13
+ const M = ":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}";
14
+ function R(o, i, e) {
15
+ let t = o.target, a = "";
15
16
  do
16
- if (e && e.isSameNode(t) || t.tagName === "BODY" || (t.getAttribute && (i = t.getAttribute(a) || ""), i === "" && (t = t.parentNode), !t)) break;
17
- while (i === "");
18
- return [i !== "__stop__" && i !== "", i, t];
17
+ if (e && e.isSameNode(t) || t.tagName === "BODY" || (t.getAttribute && (a = t.getAttribute(i) || ""), a === "" && (t = t.parentNode), !t)) break;
18
+ while (a === "");
19
+ return [a !== "__stop__" && a !== "", a, t];
19
20
  }
20
- var p, y, _;
21
- class F extends W {
21
+ var d, $, C;
22
+ class F extends j {
22
23
  constructor() {
23
24
  super();
24
- k(this, p);
25
+ w(this, d);
25
26
  /**
26
27
  * 标签类型:
27
28
  * 1. nav - 每一项等分排列, 类似于移动端底部的标签栏
28
29
  * 2. bar - 选项卡
29
30
  * 3. card - 卡片
30
31
  */
31
- f(this, "type", "nav");
32
- f(this, "name");
33
- f(this, "gap");
34
- f(this, "$line");
35
- f(this, "_handleClick", (e) => {
36
- const [t, i] = R(e, "l-name", this.root);
37
- t && i !== this.name && (this.name = i, this.dispatchEvent(
32
+ h(this, "type", "nav");
33
+ h(this, "name");
34
+ h(this, "gap");
35
+ h(this, "$line");
36
+ h(this, "_handleClick", (e) => {
37
+ const [t, a] = R(e, "l-name", this.root);
38
+ t && a !== this.name && (this.name = a, this.dispatchEvent(
38
39
  new CustomEvent("change", {
39
40
  detail: {
40
- name: i
41
+ name: a
41
42
  }
42
43
  })
43
44
  ), this._updateActive(), this._updateLine());
44
45
  });
45
- E(this);
46
+ W(this);
46
47
  }
47
48
  connectedCallback() {
48
- this.loadStyle(["tabbar"]), v(this, `l-tabbar--${this.type}`), !g(this.gap) && !this.gap.startsWith("0") && v(this, "l-tabbar-gap"), super.connectedCallback(), this._init();
49
+ this.loadStyleText(M), v(this, `l-tabbar--${this.type}`), !g(this.gap) && !this.gap.startsWith("0") && v(this, "l-tabbar-gap"), super.connectedCallback(), this._init();
49
50
  }
50
51
  static get observedAttributes() {
51
52
  return ["name", "type", "justify-content", "gap"];
52
53
  }
53
- attributeChangedCallback(e, t, i) {
54
+ attributeChangedCallback(e, t, a) {
54
55
  if (e === "name") {
55
- const s = C(i, void 0);
56
- this.name = s, this._updateActive(), this._updateLine();
56
+ const r = x(a, void 0);
57
+ this.name = r, this._updateActive(), this._updateLine();
57
58
  } else if (e === "type") {
58
- const s = C(i, "nav");
59
- if (s !== this.type && ($(this, `l-tabbar--${this.type}`), this.type = s, $(this, `l-tabbar--${s}`), s === "card")) {
60
- let r = l(".l-tabbar-card-border", this.root);
61
- r || (r = b("div", { class: "l-tabbar-card-border" }), this.root.appendChild(r));
59
+ const r = x(a, "nav");
60
+ if (r !== this.type && (y(this, `l-tabbar--${this.type}`), this.type = r, y(this, `l-tabbar--${r}`), r === "card")) {
61
+ let s = c(".l-tabbar-card-border", this.root);
62
+ s || (s = f("div", { class: "l-tabbar-card-border" }), this.root.appendChild(s));
62
63
  }
63
64
  } else {
64
- const s = C(i, void 0);
65
- this[e] = s;
66
- const r = l(".l-tabbar-wrapper", this.root);
67
- r && (r.style.cssText = u(this, p, y).call(this)), e === "gap" && (!g(this.gap) && !this.gap.startsWith("0") ? v(this, "l-tabbar-gap") : $(this, "l-tabbar-gap"));
65
+ const r = x(a, void 0);
66
+ this[e] = r;
67
+ const s = c(".l-tabbar-wrapper", this.root);
68
+ s && (s.style.cssText = u(this, d, $).call(this)), e === "gap" && (!g(this.gap) && !this.gap.startsWith("0") ? v(this, "l-tabbar-gap") : y(this, "l-tabbar-gap"));
68
69
  }
69
70
  }
70
71
  disconnectedCallback() {
@@ -72,33 +73,33 @@ class F extends W {
72
73
  }
73
74
  render() {
74
75
  const e = document.createDocumentFragment(), t = document.createElement("div");
75
- if (t.className = "l-tabbar-wrapper", t.style.cssText = u(this, p, y).call(this), t.setAttribute("part", "default"), this.getAttr("custom-content", !1)) {
76
- const s = document.createElement("slot");
77
- t.appendChild(s);
76
+ if (t.className = "l-tabbar-wrapper", t.style.cssText = u(this, d, $).call(this), t.setAttribute("part", "default"), this.getAttr("custom-content", !1)) {
77
+ const r = document.createElement("slot");
78
+ t.appendChild(r);
78
79
  } else {
79
- const s = x("[l-name]", this);
80
- s.length > 0 && j(s, (r) => {
81
- const h = r.getAttribute("l-name");
82
- if (h) {
83
- const o = r.cloneNode(!0);
84
- o.classList.add("l-tabbar-item"), o.setAttribute("part", "item"), h === this.name && o.classList.add("active");
85
- const d = l("[l-icon]", o), c = x(":not([l-icon])", o);
86
- if (d) {
87
- const m = b("div", {
80
+ const r = _("[l-name]", this);
81
+ r.length > 0 && E(r, (s) => {
82
+ const p = s.getAttribute("l-name");
83
+ if (p) {
84
+ const l = s.cloneNode(!0);
85
+ l.classList.add("l-tabbar-item"), l.setAttribute("part", "item"), p === this.name && l.classList.add("active");
86
+ const b = c("[l-icon]", l), n = _(":not([l-icon])", l);
87
+ if (b) {
88
+ const m = f("div", {
88
89
  class: [
89
90
  "l-tabbar-item-icon",
90
- c.length === 0 ? "only" : void 0
91
+ n.length === 0 ? "only" : void 0
91
92
  ]
92
93
  });
93
- m.appendChild(d.cloneNode(!0)), d.replaceWith(m);
94
+ m.appendChild(b.cloneNode(!0)), b.replaceWith(m);
94
95
  }
95
- t.appendChild(o);
96
+ t.appendChild(l);
96
97
  }
97
98
  });
98
99
  }
99
100
  if (e.appendChild(t), this.type === "card") {
100
- const s = b("div", { class: "l-tabbar-card-border" });
101
- e.appendChild(s);
101
+ const r = f("div", { class: "l-tabbar-card-border" });
102
+ e.appendChild(r);
102
103
  }
103
104
  return e;
104
105
  }
@@ -108,8 +109,8 @@ class F extends W {
108
109
  * 该方法首先清空选项卡栏的包装器元素,然后根据传入的项目数组创建并追加新的选项卡项目。
109
110
  */
110
111
  setItems(e) {
111
- const t = l(".l-tabbar-wrapper", this.root);
112
- t && (t.innerHTML = "", t.appendChild(u(this, p, _).call(this, e)));
112
+ const t = c(".l-tabbar-wrapper", this.root);
113
+ t && (t.innerHTML = "", t.appendChild(u(this, d, C).call(this, e)));
113
114
  }
114
115
  /**
115
116
  * 向标签栏添加项目。
@@ -117,8 +118,8 @@ class F extends W {
117
118
  * @returns 无返回值。
118
119
  */
119
120
  addItems(e) {
120
- const t = l(".l-tabbar-wrapper", this.root);
121
- t && t.appendChild(u(this, p, _).call(this, e));
121
+ const t = c(".l-tabbar-wrapper", this.root);
122
+ t && t.appendChild(u(this, d, C).call(this, e));
122
123
  }
123
124
  _init() {
124
125
  S(this.root, "click", this._handleClick), setTimeout(() => {
@@ -126,13 +127,13 @@ class F extends W {
126
127
  }, 300);
127
128
  }
128
129
  _destroy() {
129
- B(this.root, "click", this._handleClick), this.$line = void 0;
130
+ z(this.root, "click", this._handleClick), this.$line = void 0;
130
131
  }
131
132
  _updateActive() {
132
- const t = this.getAttr("custom-content", !1) ? this : this.root, i = l(".active", t);
133
- i && $(i, "active");
134
- const s = l(`[l-name="${this.name}"]`, t);
135
- s && v(s, "active");
133
+ const t = this.getAttr("custom-content", !1) ? this : this.root, a = c(".active", t);
134
+ a && y(a, "active");
135
+ const r = c(`[l-name="${this.name}"]`, t);
136
+ r && v(r, "active");
136
137
  }
137
138
  /**
138
139
  * 初始化线条的方法,在微任务队列中执行。
@@ -141,52 +142,52 @@ class F extends W {
141
142
  _updateLine() {
142
143
  queueMicrotask(() => {
143
144
  if (!this.name || this.type === "nav" || !this.rendered) return;
144
- const e = this.getAttr("custom-content", !1), t = l(".active", e ? this : this.root);
145
+ const e = this.getAttr("custom-content", !1), t = c(".active", e ? this : this.root);
145
146
  if (!t) return;
146
- const i = t.offsetLeft;
147
+ const a = t.offsetLeft;
147
148
  if (!this.$line) {
148
- const s = b("div", { class: "l-tabbar--bar-line" });
149
- s.part = "line", this.root.appendChild(s), this.$line = l(".l-tabbar--bar-line", this.root);
149
+ const r = f("div", { class: "l-tabbar--bar-line" });
150
+ r.part = "line", this.root.appendChild(r), this.$line = c(".l-tabbar--bar-line", this.root);
150
151
  }
151
- this.$line.style.cssText = `width:${t.offsetWidth}px;left:${i}px`, D(t, this) || this.scrollTo({
152
- left: i,
152
+ this.$line.style.cssText = `width:${t.offsetWidth}px;left:${a}px`, B(t, this) || this.scrollTo({
153
+ left: a,
153
154
  behavior: "smooth"
154
155
  });
155
156
  });
156
157
  }
157
158
  }
158
- p = new WeakSet(), y = function() {
159
+ d = new WeakSet(), $ = function() {
159
160
  const e = {}, t = this.getAttr("justify-content");
160
161
  if (g(t) || (e["justify-content"] = t), !g(this.gap)) {
161
- let i = this.gap;
162
- T(i, { isPositive: !0 }) && (i = `${i}px`), e["--l-tabbar-item-gap"] = i;
162
+ let a = this.gap;
163
+ T(a, { isPositive: !0 }) && (a = `${a}px`), e["--l-tabbar-item-gap"] = a;
163
164
  }
164
- return I(e);
165
- }, _ = function(e) {
165
+ return D(e);
166
+ }, C = function(e) {
166
167
  const t = document.createDocumentFragment();
167
- for (let i = 0, s = e.length; i < s; i++) {
168
- const r = e[i], h = b("div", {
169
- class: M([
168
+ for (let a = 0, r = e.length; a < r; a++) {
169
+ const s = e[a], p = f("div", {
170
+ class: I([
170
171
  "l-tabbar-item",
171
- this.name === r.name ? "active" : void 0
172
+ this.name === s.name ? "active" : void 0
172
173
  ]),
173
- "l-name": r.name,
174
+ "l-name": s.name,
174
175
  part: "item"
175
- }), o = r.icon;
176
- if (o) {
177
- const c = b("div", { class: "l-tabbar-item-icon" });
178
- let m = typeof o == "string" ? o : o();
179
- typeof m == "string" ? c.innerHTML = m : c.appendChild(m), h.appendChild(c);
176
+ }), l = s.icon;
177
+ if (l) {
178
+ const n = f("div", { class: "l-tabbar-item-icon" });
179
+ let m = typeof l == "string" ? l : l();
180
+ typeof m == "string" ? n.innerHTML = m : n.appendChild(m), p.appendChild(n);
180
181
  }
181
- const d = r.text;
182
- if (d) {
183
- let c = typeof d == "string" ? d : d();
184
- typeof c == "string" ? h.appendChild(b(c)) : h.appendChild(c);
182
+ const b = s.text;
183
+ if (b) {
184
+ let n = typeof b == "string" ? b : b();
185
+ typeof n == "string" ? p.appendChild(f(n)) : p.appendChild(n);
185
186
  }
186
- t.appendChild(h);
187
+ t.appendChild(p);
187
188
  }
188
189
  return t;
189
- }, f(F, "baseName", "tabbar");
190
+ }, h(F, "baseName", "tabbar");
190
191
  export {
191
192
  F as default,
192
193
  R as shouldEventNext
@@ -3,93 +3,93 @@ var b = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
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 r = (e, n, t) => E(e, typeof n != "symbol" ? n + "" : n, t), m = (e, n, t) => n.has(e) || b("Cannot " + t);
7
- var o = (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, s) => (m(e, n, "write to private field"), s ? s.call(e, t) : n.set(e, t), t), h = (e, n, t) => (m(e, n, "access private method"), 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
8
  import M from "../base.js";
9
9
  import { initAttr as R } from "../utils/index.js";
10
- import { create as d, $one as H, on as f, off as k } from "ph-utils/dom";
10
+ import { create as d, $one as H, on as v, off as k } from "ph-utils/dom";
11
11
  import { getTheme as L, applyTheme as j } from "ph-utils/theme";
12
- const A = [
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 = [
13
13
  { value: "auto", text: "跟随系统", icon: "l-theme-default-icon" },
14
14
  { value: "light", text: "浅色模式", icon: "l-sun-icon" },
15
15
  { value: "dark", text: "深色模式", icon: "l-moon-icon" }
16
16
  ];
17
- var l, i, $, v, y, g, w, c, T, x;
18
- class B extends M {
17
+ var l, i, g, f, w, x, $, h, y, T;
18
+ class I extends M {
19
19
  constructor() {
20
20
  super();
21
21
  u(this, i);
22
- r(this, "type", "button");
23
- r(this, "label", "text");
24
- r(this, "theme");
22
+ a(this, "type", "button");
23
+ a(this, "label", "text");
24
+ a(this, "theme");
25
25
  u(this, l);
26
- u(this, c, async (t) => {
27
- let s;
26
+ u(this, h, async (t) => {
27
+ let o;
28
28
  if (this.type === "button")
29
- s = this.theme === "dark" ? "auto" : "dark";
29
+ o = this.theme === "dark" ? "auto" : "dark";
30
30
  else {
31
- const a = t.target.value;
32
- this.type !== "switch" ? s = a : s = a ? "dark" : "light";
31
+ const r = t.target.value;
32
+ this.type !== "switch" ? o = r : o = r ? "dark" : "light";
33
33
  }
34
- await j(s), this.theme = s, this.type === "button" && h(this, i, v).call(this, o(this, l)), this.dispatchEvent(new CustomEvent("change", { detail: s }));
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
35
  });
36
36
  R(this), this.theme = L();
37
37
  }
38
38
  connectedCallback() {
39
- this.loadStyle(["theme"]), super.connectedCallback(), h(this, i, T).call(this);
39
+ this.loadStyleText(A), super.connectedCallback(), c(this, i, y).call(this);
40
40
  }
41
41
  disconnectedCallback() {
42
- super.disconnectedCallback(), h(this, i, x).call(this);
42
+ super.disconnectedCallback(), c(this, i, T).call(this);
43
43
  }
44
44
  render() {
45
45
  switch (this.type) {
46
46
  case "select":
47
- return h(this, i, y).call(this);
47
+ return c(this, i, w).call(this);
48
48
  case "radio":
49
- return h(this, i, w).call(this);
49
+ return c(this, i, $).call(this);
50
50
  case "switch":
51
- return h(this, i, g).call(this);
51
+ return c(this, i, x).call(this);
52
52
  default:
53
- return h(this, i, $).call(this);
53
+ return c(this, i, g).call(this);
54
54
  }
55
55
  }
56
56
  }
57
- l = new WeakMap(), i = new WeakSet(), $ = function() {
57
+ l = new WeakMap(), i = new WeakSet(), g = function() {
58
58
  const t = d("l-button", {
59
59
  class: "l-theme-btn l-theme-inner"
60
60
  });
61
- return h(this, i, v).call(this, t), t;
62
- }, v = function(t) {
63
- const s = this.theme === "auto" ? "sun" : "moon";
64
- t.innerHTML = `<l-${s}-icon></l-${s}-icon>`;
65
- }, y = function() {
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
66
  const t = d("l-select-ori", {
67
67
  class: "l-theme-inner"
68
68
  });
69
69
  t.value = this.theme;
70
- const s = [
70
+ const o = [
71
71
  '<option value="auto">跟随系统</option>',
72
72
  '<option value="light">浅色模式</option>',
73
73
  '<option value="dark">深色模式</option>'
74
74
  ];
75
- return t.innerHTML = s.join(""), t;
76
- }, g = function() {
75
+ return t.innerHTML = o.join(""), t;
76
+ }, x = function() {
77
77
  const t = d("l-switch", {
78
78
  class: "l-theme-switch l-theme-inner"
79
79
  });
80
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
- }, w = function() {
81
+ }, $ = function() {
82
82
  const t = d("l-radio", {
83
83
  class: "l-theme-inner"
84
84
  });
85
85
  t.value = this.theme, t.type = "button";
86
- const s = A.map((a) => this.label === "icon" ? `<${a.icon} radio-value="${a.value}"></${a.icon}>` : `<span radio-value="${a.value}">${a.text}</span>`);
87
- return t.innerHTML = s.join(""), t;
88
- }, c = new WeakMap(), T = function() {
89
- p(this, l, H(".l-theme-inner", this.root)), this.type === "button" ? f(o(this, l), "click", o(this, c)) : f(o(this, l), "change", o(this, c));
90
- }, x = function() {
91
- o(this, l) && (this.type === "button" ? k(o(this, l), "click", o(this, c)) : k(o(this, l), "change", o(this, c)), p(this, l, void 0));
92
- }, r(B, "baseName", "theme");
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
93
  export {
94
- B as default
94
+ I as default
95
95
  };