litos-ui 0.7.0 → 0.9.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 (81) 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 +26 -58
  4. package/lib/button/index.js +58 -62
  5. package/lib/color_picker/index.js +18 -20
  6. package/lib/form/form_events.js +15 -17
  7. package/lib/form/form_inner.js +43 -47
  8. package/lib/form/form_item.d.ts +1 -1
  9. package/lib/form/form_item.js +49 -53
  10. package/lib/form/index.d.ts +1 -1
  11. package/lib/form/index.js +58 -61
  12. package/lib/icon/arrow_down.js +4 -7
  13. package/lib/icon/arrow_left.js +4 -7
  14. package/lib/icon/arrow_right.js +4 -7
  15. package/lib/icon/arrow_up.js +4 -7
  16. package/lib/icon/base.js +21 -24
  17. package/lib/icon/caret_bottom.js +4 -7
  18. package/lib/icon/caret_top.js +4 -7
  19. package/lib/icon/font_icon.js +13 -17
  20. package/lib/icon/info.js +4 -7
  21. package/lib/icon/loading.js +4 -7
  22. package/lib/icon/mask_close.js +4 -7
  23. package/lib/icon/moon.js +4 -7
  24. package/lib/icon/reduction.js +4 -7
  25. package/lib/icon/refresh_left.js +4 -7
  26. package/lib/icon/refresh_right.js +4 -7
  27. package/lib/icon/search.js +4 -7
  28. package/lib/icon/sort.js +4 -7
  29. package/lib/icon/success.js +4 -7
  30. package/lib/icon/sun.js +4 -7
  31. package/lib/icon/theme_default.js +4 -7
  32. package/lib/icon/warn.js +4 -7
  33. package/lib/{index-B_9rPBWp.js → index-391POYEJ.js} +1 -1
  34. package/lib/index.d.ts +2 -10
  35. package/lib/index.js +62 -70
  36. package/lib/input/index.d.ts +1 -1
  37. package/lib/input/index.js +66 -70
  38. package/lib/list/index.d.ts +1 -1
  39. package/lib/list/index.js +26 -30
  40. package/lib/litos-ui.css +1 -1
  41. package/lib/litos-ui.min.js +1 -1
  42. package/lib/message/index.js +35 -33
  43. package/lib/polygon/index.d.ts +1 -1
  44. package/lib/polygon/index.js +14 -17
  45. package/lib/popconfirm/index.js +11 -17
  46. package/lib/popover/index.js +115 -120
  47. package/lib/radio/index.d.ts +2 -2
  48. package/lib/radio/index.js +65 -68
  49. package/lib/select_ori/index.d.ts +1 -1
  50. package/lib/select_ori/index.js +25 -29
  51. package/lib/switch/index.js +39 -48
  52. package/lib/tabbar/index.js +115 -123
  53. package/lib/theme/index.js +71 -74
  54. package/lib/theme/theme_color.js +17 -27
  55. package/lib/utils/event.js +16 -18
  56. package/lib/utils/index.js +48 -51
  57. package/lib/utils/transition.js +24 -34
  58. package/package.json +4 -1
  59. package/lib/browser.d.ts +0 -17
  60. package/lib/button/regist.d.ts +0 -2
  61. package/lib/button/regist.js +0 -7
  62. package/lib/form/types.js +0 -1
  63. package/lib/index-116dRdDj.js +0 -4
  64. package/lib/index-BUyxD_nH.js +0 -4
  65. package/lib/index-BeOxuMd4.js +0 -4
  66. package/lib/index-Bl8lRTJd.js +0 -4
  67. package/lib/index-BxlGVrX3.js +0 -4
  68. package/lib/index-C2D4YsFw.js +0 -4
  69. package/lib/index-C98Kx857.js +0 -4
  70. package/lib/index-CCcVpk6U.js +0 -4
  71. package/lib/index-CMz7GCCH.js +0 -4
  72. package/lib/index-D-Ikkdx0.js +0 -4
  73. package/lib/index-DJ70Xyma.js +0 -4
  74. package/lib/index-DKvzJmsR.js +0 -4
  75. package/lib/index-oNjb_IVt.js +0 -4
  76. package/lib/popconfirm/regist.d.ts +0 -2
  77. package/lib/popconfirm/regist.js +0 -7
  78. package/lib/popover/regist.d.ts +0 -2
  79. package/lib/popover/regist.js +0 -7
  80. package/lib/tabbar/regist.d.ts +0 -2
  81. package/lib/tabbar/regist.js +0 -7
@@ -1,52 +1,42 @@
1
- var A = Object.defineProperty;
2
- var I = (c, n, e) => n in c ? A(c, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[n] = e;
3
- var o = (c, n, e) => I(c, typeof n != "symbol" ? n + "" : n, e);
4
- import { initAttr as y, tagAttr as h, parseAttrValue as N } from "../utils/index.js";
5
- import V from "../form/form_inner.js";
6
- import { $one as r, hasClass as f, addClass as u, $ as p, iterate as m, getAttr as S, removeClass as b, formatClass as j, on as D, off as H } from "ph-utils/dom";
7
- import { random as v } from "ph-utils";
8
- class L extends V {
9
- constructor() {
10
- super(!1);
11
- o(this, "type");
12
- o(this, "label");
13
- o(this, "checked", !1);
14
- o(this, "_changeEvent");
15
- o(this, "_radioChange", (e) => {
16
- const a = e.target;
17
- let t = a.parentElement;
18
- for (; t != null && !f(t, "l-radio"); )
19
- t = t.parentElement;
20
- const s = r(".is-checked", this.root);
21
- s && b(s, "is-checked"), this.value = a.value, t && u(t, "is-checked"), this.dispatchEvent(this._changeEvent);
22
- });
23
- y(this), this._changeEvent = new CustomEvent("change");
24
- }
1
+ import { initAttr as $, tagAttr as s, parseAttrValue as x } from "../utils/index.js";
2
+ import y from "../form/form_inner.js";
3
+ import { $one as a, hasClass as u, addClass as n, $ as c, iterate as h, getAttr as C, removeClass as b, formatClass as A, on as E, off as I } from "ph-utils/dom";
4
+ import { random as p } from "ph-utils";
5
+ const w = ':host{display:flex;align-items:center}.l-radio{--l-radio-size: 16px;--l-radio-label-color: #333;--l-radio-disabled-color: #e6e6e6;--l-radio-disabled-label-color: var(--l-disabled-color, #c0c4cc);--l-radio-checked-color: var(--l-primary-color, #722ed1);--l-radio-item-margin: 10px;display:inline-flex;align-items:center;position:relative;cursor:pointer}.l-radio__label{transition:color .3s ease-in-out;margin-left:5px}.l-radio__input{position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-radio__inner{display:flex;justify-content:center;align-items:center;width:var(--l-radio-size);height:var(--l-radio-size);border:1px solid #dcddd9;border-radius:50%;box-sizing:border-box;transition:border-color .3s ease-in-out}.l-radio__inner:before{content:"";display:block;width:60%;height:60%;background-color:transparent;border-radius:50%;transition:background-color .3s ease-in-out}.l-radio.is-checked .l-radio__inner{border-color:var(--l-primary-color, #722ed1)}.l-radio.is-checked .l-radio__inner:before{background-color:var(--l-primary-color, #722ed1)}.l-radio.is-checked .l-radio__label{color:var(--l-primary-color, #722ed1)}.l-radio--disabled{cursor:not-allowed}.l-radio--disabledd .l-radio__inner{border-color:var(--l-radio-disabled-color)}.l-radio--disabled .l-radio__label{color:var(--l-radio-disabled-label-color)}.l-radio:not(:first-child){margin-left:var(--l-radio-item-margin)}.l-radio--button .l-radio__label{display:inline-flex;height:var(--l-form-edit-height, 32px);justify-content:center;align-items:center;padding:0 15px;border:1px solid #c0c4cc;border-left-width:0;margin-left:0}.l-radio--button:not(:first-of-type){margin-left:0}.l-radio--button:first-of-type .l-radio__label{border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}.l-radio--button:last-of-type .l-radio__label{border-top-right-radius:3px;border-bottom-right-radius:3px}.is-checked.l-radio--button .l-radio__label{background-color:var(--l-radio-checked-color);color:#fff;border-color:var(--l-radio-checked-color)}';
6
+ class T extends y {
7
+ static baseName = "radio";
8
+ type;
9
+ label;
10
+ checked = !1;
11
+ _ignoreInitAttrs = [];
25
12
  setItems(e) {
26
13
  this._removeEvents(), this.root.innerHTML = this._renderItems(e), this._initEvents();
27
14
  }
15
+ constructor() {
16
+ super(!1), console.log(), $(this);
17
+ }
28
18
  connectedCallback() {
29
- super.connectedCallback(), this.loadStyle(["radio"]), this._initEvents();
19
+ super.connectedCallback(), this.loadStyleText(w), this._initEvents();
30
20
  }
31
21
  disconnectedCallback() {
32
22
  super.disconnectedCallback(), this._removeEvents();
33
23
  }
34
- attributeChange(e, a, t) {
24
+ attributeChange(e, o, t) {
35
25
  if (e === "checked") {
36
- const s = N(t, !1, e);
37
- this.checked = s, this.value = s;
38
- const i = r(".l-radio", this.root);
39
- if (i && !f(i, "is-checked")) {
40
- u(i, "is-checked");
41
- const l = r("input", i);
26
+ const i = x(t, !1, e);
27
+ this.checked = i, this.value = i;
28
+ const r = a(".l-radio", this.root);
29
+ if (r && !u(r, "is-checked")) {
30
+ n(r, "is-checked");
31
+ const l = a("input", r);
42
32
  l && (l.checked = !0);
43
33
  }
44
34
  }
45
35
  }
46
36
  render() {
47
- this.getName() || (this.name = `la${v(3)}_${v(6)}`);
48
- const e = [], a = r('[slot="label"]', this), t = p("[radio-value]", this);
49
- a != null || this.label ? (this.value = this._isChecked(), a ? e.push(
37
+ this.getName() || (this.name = `la${p(3)}_${p(6)}`);
38
+ const e = [], o = a('[slot="label"]', this), t = c("[radio-value]", this);
39
+ return o != null || this.label ? (this.value = this._isChecked(), o ? e.push(
50
40
  this._renderItem("slot", void 0, this._isChecked(), "label")
51
41
  ) : e.push(
52
42
  this._renderItem(
@@ -55,71 +45,78 @@ class L extends V {
55
45
  this._isChecked(),
56
46
  "label"
57
47
  )
58
- )) : t.length > 0 && (m(t, (s) => {
59
- const i = s.cloneNode(!0), l = S(s, "radio-value");
48
+ )) : t.length > 0 && (h(t, (i) => {
49
+ const r = i.cloneNode(!0), l = C(i, "radio-value");
60
50
  e.push(
61
- this._renderItem(i.outerHTML, l, this.value === l)
51
+ this._renderItem(r.outerHTML, l, this.value === l)
62
52
  );
63
- }), this.pushValueChange()), this.root.innerHTML = e.join("");
53
+ }), this.pushValueChange()), e.join("");
64
54
  }
65
55
  setValue(e) {
66
56
  super.setValue(e);
67
- let a = "";
68
- typeof e != "boolean" && (a = `[l-value="${e}"]`);
69
- const t = r(".is-checked", this.root);
57
+ let o = "";
58
+ typeof e != "boolean" && (o = `[l-value="${e}"]`);
59
+ const t = a(".is-checked", this.root);
70
60
  t && b(t, "is-checked");
71
- const s = r(`label${a}`, this.root);
72
- if (s) {
73
- const i = r("input", s);
74
- typeof e == "boolean" ? (e ? u(s, "is-checked") : b(s, "is-checked"), i.checked = e) : (u(s, "is-checked"), i.checked = !0);
61
+ const i = a(`label${o}`, this.root);
62
+ if (i) {
63
+ const r = a("input", i);
64
+ typeof e == "boolean" ? (e ? n(i, "is-checked") : b(i, "is-checked"), r.checked = e) : (n(i, "is-checked"), r.checked = !0);
75
65
  }
76
66
  }
77
67
  _renderItems(e) {
78
- const a = [];
79
- for (let t = 0, s = e.length; t < s; t++) {
80
- const i = e[t];
81
- a.push(
68
+ const o = [];
69
+ for (let t = 0, i = e.length; t < i; t++) {
70
+ const r = e[t];
71
+ o.push(
82
72
  this._renderItem(
83
- i.label,
84
- i.value,
85
- this.value === i.value,
86
- i.labelPart
73
+ r.label,
74
+ r.value,
75
+ this.value === r.value,
76
+ r.labelPart
87
77
  )
88
78
  );
89
79
  }
90
- return a.join("");
80
+ return o.join("");
91
81
  }
92
- _renderItem(e, a, t = !1, s = void 0) {
93
- const i = j({
82
+ _renderItem(e, o, t = !1, i = void 0) {
83
+ const r = A({
94
84
  "l-radio": !0,
95
85
  "l-radio--disabled": this.isDisabled(),
96
86
  "l-radio--button": this.type === "button",
97
87
  "is-checked": t
98
- }), l = h("disabled", this.isDisabled()), _ = h("checked", t), k = h("value", a), $ = `${h("name", this.getName())}${k}${l}${_}`, g = h("part", s), C = h("l-value", a), d = [
99
- `<label class="${i}"${C}>`,
100
- `<input type="radio" class="l-radio__input"${$} />`
88
+ }), l = s("disabled", this.isDisabled()), f = s("checked", t), m = s("value", o), _ = `${s("name", this.getName())}${m}${l}${f}`, v = s("part", i), g = s("l-value", o), d = [
89
+ `<label class="${r}"${g}>`,
90
+ `<input type="radio" class="l-radio__input"${_} />`
101
91
  ];
102
92
  this.type !== "button" && d.push('<span class="l-radio__inner"></span>');
103
- let E = e === "slot" ? '<slot name="label"></slot>' : e;
93
+ let k = e === "slot" ? '<slot name="label"></slot>' : e;
104
94
  return d.push(
105
- `<div class="l-radio__label"${g}>${E}</div>`
95
+ `<div class="l-radio__label"${v}>${k}</div>`
106
96
  ), d.push("</label>"), d.join("");
107
97
  }
108
98
  _isChecked() {
109
99
  return this.checked;
110
100
  }
111
101
  _initEvents() {
112
- m(p("input", this.root), (e) => {
113
- D(e, "change", this._radioChange);
102
+ h(c("input", this.root), (e) => {
103
+ E(e, "change", this._radioChange);
114
104
  });
115
105
  }
116
106
  _removeEvents() {
117
- m(p("input", this.root), (e) => {
118
- H(e, "change", this._radioChange);
107
+ h(c("input", this.root), (e) => {
108
+ I(e, "change", this._radioChange);
119
109
  });
120
110
  }
111
+ _radioChange = (e) => {
112
+ const o = e.target;
113
+ let t = o.parentElement;
114
+ for (; t != null && !u(t, "l-radio"); )
115
+ t = t.parentElement;
116
+ const i = a(".is-checked", this.root);
117
+ i && b(i, "is-checked"), this.value = o.value, t && n(t, "is-checked"), this.dispatchEvent(new CustomEvent("change"));
118
+ };
121
119
  }
122
- o(L, "baseName", "radio");
123
120
  export {
124
- L as default
121
+ T as default
125
122
  };
@@ -10,7 +10,7 @@ export default class SelectOri extends FormInner {
10
10
  constructor();
11
11
  connectedCallback(): void;
12
12
  disconnectedCallback(): void;
13
- render(): void;
13
+ render(): string;
14
14
  protected _changeDisabled(): void;
15
15
  setOptions(options: Option[]): void;
16
16
  appendOptions(options: Option[]): void;
@@ -1,50 +1,43 @@
1
- var r = Object.defineProperty;
2
- var o = (i, t, e) => t in i ? r(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var n = (i, t, e) => o(i, typeof t != "symbol" ? t + "" : t, e);
4
- import u from "../form/form_inner.js";
5
- import { initAttr as d, tagAttrs as p } from "../utils/index.js";
6
- import { $one as $, on as m, off as g } from "ph-utils/dom";
7
- class v extends u {
1
+ import a from "../form/form_inner.js";
2
+ import { initAttr as c, tagAttrs as h } from "../utils/index.js";
3
+ import { $one as r, on as o, off as u } from "ph-utils/dom";
4
+ import { i as d } from "../index-391POYEJ.js";
5
+ class f extends a {
6
+ static baseName = "select-ori";
7
+ $select;
8
+ changeEmit;
8
9
  constructor() {
9
- super();
10
- n(this, "$select");
11
- n(this, "changeEmit");
12
- n(this, "_handleChange", (e) => {
13
- const s = e.target.value;
14
- super.setValue(s), this.dispatchEvent(this.changeEmit);
15
- });
16
- d(this), this.changeEmit = new CustomEvent("change");
10
+ super(), c(this), this.changeEmit = new CustomEvent("change");
17
11
  }
18
12
  connectedCallback() {
19
- this.loadStyle(["input"]), super.connectedCallback(), this.$select = $("select", this.root), this.value && (this.$select.value = this.value), m(this.$select, "change", this._handleChange);
13
+ this.loadStyleText(d), super.connectedCallback(), this.$select = r("select", this.root), this.value && (this.$select.value = this.value), o(this.$select, "change", this._handleChange);
20
14
  }
21
15
  disconnectedCallback() {
22
- super.disconnectedCallback(), this.$select && g(this.$select, "change", this._handleChange), this.changeEmit = void 0, this.$select = void 0;
16
+ super.disconnectedCallback(), this.$select && u(this.$select, "change", this._handleChange), this.changeEmit = void 0, this.$select = void 0;
23
17
  }
24
18
  render() {
25
19
  let e = this.innerHTML.trim();
26
- const s = p([
20
+ return `<select class="l-input"${h([
27
21
  ["name", this.getName()],
28
22
  ["disabled", this.isDisabled()]
29
- ]);
30
- this.root.innerHTML = `<select class="l-input"${s}>${e}</select>`;
23
+ ])}>${e}</select>`;
31
24
  }
32
25
  _changeDisabled() {
33
26
  this.$select && (this.$select.disabled = this.isDisabled());
34
27
  }
35
28
  setOptions(e) {
36
29
  if (!this.$select) return;
37
- const s = e.map((l) => `<option value="${l.value}">${l.label}</option>`);
38
- this.$select.innerHTML = s.join("");
30
+ const t = e.map((s) => `<option value="${s.value}">${s.label}</option>`);
31
+ this.$select.innerHTML = t.join("");
39
32
  }
40
33
  appendOptions(e) {
41
34
  if (!this.$select) return;
42
- const s = document.createDocumentFragment();
43
- for (let l = 0, h = e.length; l < h; l++) {
44
- const c = e[l], a = document.createElement("option");
45
- a.value = c.value, a.innerHTML = c.label, s.appendChild(a);
35
+ const t = document.createDocumentFragment();
36
+ for (let s = 0, n = e.length; s < n; s++) {
37
+ const l = e[s], i = document.createElement("option");
38
+ i.value = l.value, i.innerHTML = l.label, t.appendChild(i);
46
39
  }
47
- this.$select.appendChild(s);
40
+ this.$select.appendChild(t);
48
41
  }
49
42
  reset() {
50
43
  super.reset(), this.$select && (this.$select.value = this.value);
@@ -52,8 +45,11 @@ class v extends u {
52
45
  setValue(e) {
53
46
  super.setValue(e), this.$select && (this.$select.value = this.value);
54
47
  }
48
+ _handleChange = (e) => {
49
+ const t = e.target.value;
50
+ super.setValue(t), this.dispatchEvent(this.changeEmit);
51
+ };
55
52
  }
56
- n(v, "baseName", "select-ori");
57
53
  export {
58
- v as default
54
+ f as default
59
55
  };
@@ -1,64 +1,55 @@
1
- var p = Object.defineProperty;
2
- var u = (t) => {
3
- throw TypeError(t);
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 {
1
+ import { on as c, off as h, addClass as o, removeClass as l, $one as i } from "ph-utils/dom";
2
+ import n from "../form/form_inner.js";
3
+ import { initAttr as a, parseAttrValue as r } from "../utils/index.js";
4
+ const d = ":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}";
5
+ class w extends n {
6
+ static baseName = "switch";
7
+ actionRender;
8
+ checkedText;
9
+ uncheckedText;
14
10
  constructor() {
15
- super(!1);
16
- r(this, c);
17
- n(this, "actionRender");
18
- n(this, "checkedText");
19
- n(this, "uncheckedText");
20
- r(this, h, (e) => {
21
- this.isDisabled() || (this.setValue(!this.value), this.dispatchEvent(new CustomEvent("change")));
22
- });
23
- b(this);
24
- const e = this.value ? L(this.value, !1, "value") : !1;
25
- this._resetValue = e, this.value = e;
11
+ super(!1), a(this);
12
+ const t = this.value ? r(this.value, !1, "value") : !1;
13
+ this._resetValue = t, this.value = t;
26
14
  }
27
15
  connectedCallback() {
28
- this.loadStyle(["switch"]), super.connectedCallback(), this.pushValueChange(), a(this, c, o).call(this), x(this, "click", d(this, h));
16
+ this.loadStyleText(d), super.connectedCallback(), this.pushValueChange(), this.#t(), c(this, "click", this.#e);
29
17
  }
30
18
  disconnectedCallback() {
31
- super.disconnectedCallback(), T(this, "click", d(this, h)), this.actionRender = void 0;
19
+ super.disconnectedCallback(), h(this, "click", this.#e), this.actionRender = void 0;
32
20
  }
33
21
  render() {
34
22
  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>'];
23
+ const t = ['<div class="l-switch-action" part="action"></div>'];
36
24
  if (this.checkedText || this.uncheckedText) {
37
- const i = this.value ? this.checkedText || "" : this.uncheckedText || "";
38
- e.push(`<span class="l-switch-text">${i}</span>`);
25
+ const e = this.value ? this.checkedText || "" : this.uncheckedText || "";
26
+ t.push(`<span class="l-switch-text">${e}</span>`);
39
27
  }
40
- return e.join("");
28
+ return t.join("");
29
+ }
30
+ #e = (t) => {
31
+ this.isDisabled() || (this.setValue(!this.value), this.dispatchEvent(new CustomEvent("change")));
32
+ };
33
+ setValue(t) {
34
+ super.setValue(t), t ? o(this, "l-switch--checked") : l(this, "l-switch--checked");
35
+ const e = i(".l-switch-text", this.root);
36
+ e && (e.textContent = this.value ? this.checkedText || "" : this.uncheckedText || ""), this.#t();
41
37
  }
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);
38
+ setActionRender(t) {
39
+ this.actionRender = t, this.#t();
46
40
  }
47
- setActionRender(e) {
48
- this.actionRender = e, a(this, c, o).call(this);
41
+ #t() {
42
+ const t = i(".l-switch-action", this.root);
43
+ if (t)
44
+ if (this.actionRender) {
45
+ const e = this.actionRender({ checked: this.value });
46
+ typeof e == "string" ? t.innerHTML = e : t.innerHTML = e.outerHTML;
47
+ } else {
48
+ const e = i('[slot="checked-action"]', this), s = i('[slot="unchecked-action"]', this);
49
+ this.value && e ? t.innerHTML = '<slot name="checked-action"></slot>' : !this.value && s && (t.innerHTML = '<slot name="unchecked-action"></slot>');
50
+ }
49
51
  }
50
52
  }
51
- h = new WeakMap(), c = new WeakSet(), o = function() {
52
- const e = l(".l-switch-action", this.root);
53
- if (e)
54
- if (this.actionRender) {
55
- const i = this.actionRender({ checked: this.value });
56
- typeof i == "string" ? e.innerHTML = i : e.innerHTML = i.outerHTML;
57
- } 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>');
60
- }
61
- }, n(V, "baseName", "switch");
62
53
  export {
63
- V as default
54
+ w as default
64
55
  };