litos-ui 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,17 @@
1
1
  import BaseComponent from "../base";
2
2
  export default class Button extends BaseComponent {
3
3
  static baseName: string;
4
- htmlType: "submit" | "reset" | "button";
5
- /** 加载中文本 */
6
- loadingText: string;
7
- _height?: string | number;
8
4
  _disabled: boolean;
9
- _loading: boolean;
10
- get height(): string | number | undefined;
11
- set height(height: string | number | undefined);
12
5
  get disabled(): boolean;
13
6
  set disabled(value: boolean);
14
- get loading(): boolean;
15
- set loading(value: boolean);
16
- setLoading(value: boolean): void;
7
+ setLoading(loading: boolean): void;
17
8
  setDisabled(value: boolean): void;
18
9
  static get observedAttributes(): string[];
19
10
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
20
11
  connectedCallback(): void;
21
12
  disconnectedCallback(): void;
13
+ isFormButton(): boolean;
14
+ getHtmlType(): "submit" | "reset" | "button";
22
15
  render(): void;
23
16
  loadingBody(): string;
24
17
  applyColor(color: string, text?: boolean, ghost?: boolean): string;
@@ -1,4 +1,4 @@
1
- import { parseAttrValue as i, initAttr as c } from "../utils/index.js";
1
+ import { initAttr as c, parseAttrValue as s } from "../utils/index.js";
2
2
  import h from "../base.js";
3
3
  import { $one as b, addClass as g, removeClass as f, on as p, off as v, formatClass as u, formatStyle as m, getAttr as k } from "ph-utils/dom";
4
4
  import { adjust as d } from "ph-utils/color";
@@ -6,32 +6,15 @@ import { a as x } from "../animation-DttknHkX.js";
6
6
  const y = ":host{--l-btn-padding: 0 15px;--l-btn-text-color: #ffffff;--l-btn-hover-text-color: var(--l-btn-text-color);--l-btn-active-text-color: var(--l-btn-text-color);--l-btn-border-color: var(--l-primary-color, #722ed1);--l-btn-background: var(--l-btn-border-color);--l-btn-hover-border-color: var(--l-primary-color-light1, #9254de);--l-btn-hover-background: var(--l-btn-hover-border-color);--l-btn-active-border-color: var(--l-primary-color-dark1, #531dab);--l-btn-active-background: var(--l-btn-active-border-color);--l-btn-disabled-color: #c9c9c9;--l-btn-disabled-background: #fbfbfb;--l-btn-disabled-border-color: #e6e6e6;--l-btn-height: var(--l-form-control-height, 32px);display:inline-flex;width:auto;height:var(--l-btn-height);text-indent:0;box-sizing:border-box;border-radius:var(--l-border-radius, 3px)}:host([block]){width:100%}.l-btn{width:100%;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:none;box-sizing:border-box;vertical-align:middle;padding:var(--l-btn-padding);line-height:1;height:100%;border-radius:inherit;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);position:relative;gap:var(--l-btn-gap, 5px);font-size:inherit;transition:border-color .3s,background-color .3s,color .3s}.l-btn:hover{border-color:var(--l-btn-hover-border-color, var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn:active{border-color:var(--l-btn-active-border-color, var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal{--l-btn-text-color: auto;--l-btn-background: transparent;--l-btn-border-color: #d9d9d9;--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab);--l-btn-hover-background: #fff;--l-btn-active-background: #fff;--l-btn-hover-border-color: var(--l-btn-hover-text-color);--l-btn-active-border-color: var(--l-btn-active-text-color)}.l-btn-primary{--l-btn-background: var(--l-primary-color, #722ed1);--l-btn-hover-background: var(--l-primary-color-light1, #9254de);--l-btn-active-background: var(--l-primary-color-dark1, #531dab);--l-btn-disabled-border-color: var(--l-primary-color-light2, #b37feb);--l-btn-disabled-background: var(--l-primary-color-light2, #b37feb);--l-btn-disabled-color: #ffffff}.l-btn:disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn.l-btn-loading{cursor:default}.l-btn-text{--l-btn-background: transparent;--l-btn-border-color: transparent;--l-btn-hover-border-color: transparent;--l-btn-active-border-color: transparent;--l-btn-disabled-background: transparent;--l-btn-disabled-border-color: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;--l-btn-padding: 5px}.l-btn-primary.l-btn-text{--l-btn-text-color: var(--l-primary-color, #722ed1);--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab)}.l-btn-ghost{--l-btn-text-color: var(--l-btn-border-color);--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;--l-btn-hover-text-color: var(--l-btn-hover-border-color);--l-btn-active-text-color: var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-control-height, 32px) / 2)}.l-btn-circle{border-radius:50%;width:var(--l-form-control-height, 32px);padding:0}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background: rgba(255, 255, 255, .08);--l-btn-disabled-color: rgba(255, 255, 255, .3);--l-btn-disabled-border-color: rgba(255, 255, 255, .3)}";
7
7
  class H extends h {
8
8
  static baseName = "button";
9
- htmlType = "button";
10
- /** 加载中文本 */
11
- loadingText = "";
12
- _height;
9
+ // public htmlType: "submit" | "reset" | "button" = "button";
13
10
  _disabled = !1;
14
- _loading = !1;
15
- get height() {
16
- return this._height;
17
- }
18
- set height(t) {
19
- this._height = t, this.rendered && this._updateHeight();
20
- }
21
11
  get disabled() {
22
12
  return this._disabled;
23
13
  }
24
14
  set disabled(t) {
25
15
  this.setDisabled(t);
26
16
  }
27
- get loading() {
28
- return this._loading;
29
- }
30
- set loading(t) {
31
- this.setLoading(t);
32
- }
33
17
  setLoading(t) {
34
- this._loading = t;
35
18
  const r = b(".l-btn", this.root);
36
19
  r && (t ? (g(r, "l-btn-loading"), r.disabled = !0, r.innerHTML = this.loadingBody()) : (f(r, "l-btn-loading"), r.disabled = this.disabled, r.innerHTML = "<slot></slot>"));
37
20
  }
@@ -49,70 +32,72 @@ class H extends h {
49
32
  const e = b(".l-btn", this.root);
50
33
  if (e) {
51
34
  if (t === "loading") {
52
- const n = i(o, !1, t);
53
- this.setLoading(n);
35
+ const l = s(o, !1, t);
36
+ this.setLoading(l);
54
37
  return;
55
38
  } else if (t === "color") {
56
- const n = this.getAttr("text", !1), a = this.getAttr("ghost", !1);
57
- e.style.cssText = this.applyColor(o, n, a);
39
+ const l = this.getAttr("text", !1), a = this.getAttr("ghost", !1);
40
+ e.style.cssText = this.applyColor(o, l, a);
58
41
  return;
59
42
  } else if (t === "disabled") {
60
- const n = i(o, !1, "disabled");
61
- this.setDisabled(n);
43
+ const l = s(o, !1, "disabled");
44
+ this.setDisabled(l);
62
45
  return;
63
46
  }
64
47
  }
65
- const l = i(
66
- o,
67
- this[t],
68
- t
69
- );
70
- l !== this[t] && (this[t] = l, t === "height" && this.rendered && this._updateHeight());
48
+ if (!this.rendered) return;
49
+ const n = o.trim();
50
+ t === "height" && this._updateHeight(n);
71
51
  }
72
52
  connectedCallback() {
73
- c(this), this.loadStyleText([x, y]), this.render(), (this.htmlType === "reset" || this.htmlType === "submit") && p(this, "click", this._handleClick), this._updateHeight();
53
+ c(this), this.loadStyleText([x, y]), this.render(), this.isFormButton() && p(this, "click", this._handleClick), this._updateHeight(this.getAttr("height"));
74
54
  }
75
55
  disconnectedCallback() {
76
- super.disconnectedCallback(), (this.htmlType === "reset" || this.htmlType === "submit") && v(this, "click", this._handleClick);
56
+ super.disconnectedCallback(), this.isFormButton() && v(this, "click", this._handleClick);
57
+ }
58
+ isFormButton() {
59
+ const t = this.getHtmlType();
60
+ return t === "submit" || t === "reset";
61
+ }
62
+ getHtmlType() {
63
+ return this.getAttr("html-type", "button");
77
64
  }
78
65
  render() {
79
- const t = this.getAttr("type", "normal"), r = document.createElement("button"), o = this.getAttr("loading", !1), e = this.getAttr("shape", "default"), l = this.getAttr("text", !1), n = this.getAttr("ghost", !1), a = [
66
+ const t = this.getAttr("type", "normal"), r = document.createElement("button"), o = this.getAttr("loading", !1), e = this.getAttr("shape", "default"), n = this.getAttr("text", !1), l = this.getAttr("ghost", !1), a = [
80
67
  "l-btn",
81
68
  `l-btn-${t}`,
82
69
  e === "round" ? "l-btn-round" : "",
83
70
  e === "circle" ? "l-btn-circle" : "",
84
- n ? "l-btn-ghost" : "",
85
- l ? "l-btn-text" : "",
71
+ l ? "l-btn-ghost" : "",
72
+ n ? "l-btn-text" : "",
86
73
  o ? "l-btn-loading" : ""
87
74
  ];
88
75
  r.className = u(a), (this.disabled || o) && (r.disabled = !0), r.type = this.getAttr("html-type", "button");
89
- const s = this.applyColor(this.getAttr("color"), l, n);
90
- s && (r.style.cssText = s), o ? r.innerHTML = this.loadingBody() : r.innerHTML = "<slot></slot>", r.setAttribute("part", "default"), this.root.appendChild(r);
76
+ const i = this.applyColor(this.getAttr("color"), n, l);
77
+ i && (r.style.cssText = i), o ? r.innerHTML = this.loadingBody() : r.innerHTML = "<slot></slot>", r.setAttribute("part", "default"), this.root.appendChild(r);
91
78
  }
92
79
  loadingBody() {
93
- const t = this.getAttr("loading-text", ""), r = ['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];
80
+ const t = this.getAttr("loading-text", "加载中……"), r = ['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];
81
+ console.log(t);
94
82
  return t ? r.push(`<span>${t}</span>`) : r.push("<slot></slot>"), r.join("");
95
83
  }
96
84
  applyColor(t, r = !1, o = !1) {
97
85
  if (!t) return "";
98
- const e = d(t, 1, !0), l = d(t, 3, !1);
86
+ const e = d(t, 1, !0), n = d(t, 3, !1);
99
87
  return m({
100
88
  "--l-btn-border-color": r ? "transparent" : t,
101
89
  "--l-btn-text-color": o || r ? t : "#ffffff",
102
90
  "--l-btn-hover-text-color": o || r ? e : "#ffffff",
103
91
  "--l-btn-background": o || r ? "transparent" : t,
104
- "--l-btn-active-text-color": o || r ? l : "#ffffff",
92
+ "--l-btn-active-text-color": o || r ? n : "#ffffff",
105
93
  "--l-btn-hover-border-color": r ? "transparent" : e,
106
94
  "--l-btn-hover-background": o || r ? "transparent" : e,
107
- "--l-btn-active-background": o || r ? "transparent" : l,
108
- "--l-btn-active-border-color": r ? "transparent" : l
95
+ "--l-btn-active-background": o || r ? "transparent" : n,
96
+ "--l-btn-active-border-color": r ? "transparent" : n
109
97
  });
110
98
  }
111
- _updateHeight() {
112
- if (this.height) {
113
- let t = this.height;
114
- typeof t == "number" && (t = `${t}px`), this.style.setProperty("--l-btn-height", t);
115
- }
99
+ _updateHeight(t) {
100
+ t && (typeof t == "number" && (t = `${t}px`), this.style.setProperty("--l-btn-height", t));
116
101
  }
117
102
  _handleClick = (t) => {
118
103
  const r = t.target, o = k(r, "html-type");
@@ -1,6 +1,6 @@
1
1
  import r from "../form/form_inner.js";
2
2
  import { on as o, off as l, $$ as c } from "ph-utils/dom";
3
- import { parseAttrValue as i, initAttr as h } from "../utils/index.js";
3
+ import { initAttr as i, parseAttrValue as h } from "../utils/index.js";
4
4
  import { isNumeric as n } from "ph-utils";
5
5
  const p = ":host{display:flex;align-items:center;gap:var(--l-check-gap, 0px)}";
6
6
  class v extends r {
@@ -13,7 +13,7 @@ class v extends r {
13
13
  }
14
14
  attributeChange(e, g, a) {
15
15
  if (console.log(e), e === "gap") {
16
- const t = i(a, void 0);
16
+ const t = h(a, void 0);
17
17
  if (t) {
18
18
  const s = n(t) ? `${t}px` : t;
19
19
  this.style.setProperty("--l-check-gap", s);
@@ -23,7 +23,7 @@ class v extends r {
23
23
  }
24
24
  }
25
25
  connectedCallback() {
26
- h(this), this.loadStyleText([p]), super.connectedCallback();
26
+ i(this), this.loadStyleText([p]), super.connectedCallback();
27
27
  }
28
28
  afterInit() {
29
29
  o(this.root, "change", this.#e);
@@ -1,5 +1,5 @@
1
1
  import { $$ as i, $one as o, addClass as n, removeClass as d } from "ph-utils/dom";
2
- import { parseAttrValue as h, initAttr as m } from "../utils/index.js";
2
+ import { initAttr as h, parseAttrValue as m } from "../utils/index.js";
3
3
  import f from "../base.js";
4
4
  import { emit as s, add as c, clear as p, remove as b } from "../utils/event.js";
5
5
  import { random as a } from "ph-utils";
@@ -38,12 +38,12 @@ class I extends f {
38
38
  else if (e === "label")
39
39
  this.label = r, this._updateLabel();
40
40
  else if (e === "disabled") {
41
- const l = h(r, !1, e);
41
+ const l = m(r, !1, e);
42
42
  l !== this.disabled && (s(this.id, "attributeChanged", e, l, this.id), this.disabled = l);
43
43
  }
44
44
  }
45
45
  connectedCallback() {
46
- if (m(this), this.id == null && (this.id = `l-fi${a(3)}-${a(6)}`), this.loadStyleText([u]), super.connectedCallback(), this.formId = this._getFormId(), this.name && this.formId) {
46
+ if (h(this), this.id == null && (this.id = `l-fi${a(3)}-${a(6)}`), this.loadStyleText([u]), super.connectedCallback(), this.formId = this._getFormId(), this.name && this.formId) {
47
47
  let e = this.verify?.split("|") || [];
48
48
  this.pattern && e.push(new RegExp(this.pattern));
49
49
  const t = {
package/lib/form/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $one as n, formatClass as o, formatStyle as f } from "ph-utils/dom";
2
2
  import m from "../base.js";
3
- import { parseAttrValue as c, initAttr as u } from "../utils/index.js";
3
+ import { initAttr as c, parseAttrValue as u } from "../utils/index.js";
4
4
  import { random as d } from "ph-utils";
5
5
  import { emit as l, add as h, clear as v } from "../utils/event.js";
6
6
  import p from "ph-utils/validator";
@@ -25,7 +25,7 @@ class $ extends m {
25
25
  }
26
26
  attributeChangedCallback(t, e, i) {
27
27
  if (t === "disabled") {
28
- const a = c(i, !1, t);
28
+ const a = u(i, !1, t);
29
29
  a !== this.disabled && (l(this.id, "attributeChanged", t, a, this.id), this.disabled = a);
30
30
  } else if (t === "label-position") {
31
31
  const a = n("form", this.root);
@@ -37,7 +37,7 @@ class $ extends m {
37
37
  }
38
38
  }
39
39
  connectedCallback() {
40
- u(this), this.id || (this.id = `l-f${d(3)}-${d(6)}`), this.loadStyleText([b]), super.connectedCallback(), h(this.id, "ruleChange", this.ruleChange), h(this.id, "valueChange", this._valueChange);
40
+ c(this), this.id || (this.id = `l-f${d(3)}-${d(6)}`), this.loadStyleText([b]), super.connectedCallback(), h(this.id, "ruleChange", this.ruleChange), h(this.id, "valueChange", this._valueChange);
41
41
  }
42
42
  disconnectedCallback() {
43
43
  v(this.id), this.validator = void 0;
@@ -2,15 +2,12 @@ import BaseComponent from "../base";
2
2
  export default class Tag extends BaseComponent {
3
3
  #private;
4
4
  static baseName: string;
5
- type: string;
6
- color?: string;
7
- closeable?: boolean;
8
5
  connectedCallback(): void;
9
6
  static get observedAttributes(): string[];
10
7
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
11
8
  render(): DocumentFragment;
12
9
  afterInit(): void;
13
- _toggleTypeClass(): void;
14
- _toggleColorStyle(): void;
10
+ _toggleTypeClass(type: string): void;
11
+ _toggleColorStyle(color?: string | null): void;
15
12
  beforeDestroy(): void;
16
13
  }
package/lib/tag/index.js CHANGED
@@ -1,80 +1,72 @@
1
- import s from "../base.js";
2
- import { parseAttrValue as i } from "../utils/index.js";
3
- import { isBlank as c } from "ph-utils";
4
- import { adjust as n } from "ph-utils/color";
5
- import { $one as g, $$ as l, shouldEventNext as d, on as f, off as h } from "ph-utils/dom";
6
- const p = ":host{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;height:var(--l-tag-height, 22px);padding:0 8px;font-size:12px;line-height:1;border:1px solid var(--l-tag-border-color, var(--l-border-color, #dedede));border-radius:4px;background:var(--l-tag-background, #fff);white-space:nowrap;color:var(--l-tag-color, #333)}:host(.l-tag--primary){--l-tag-border-color: var(--l-primary-color-light3, #d3adf7);--l-tag-background: var(--l-primary-color-light5, #f9f0ff);--l-tag-color: var(--l-primary-color-light3, #d3adf7)}:host(.l-tag--error){--l-tag-color: var(--l-error-color, #ed3f13);--l-tag-background: var(--l-error-color-light5, #fff1f0);--l-tag-border-color: var(--l-error-color, #ed3f13)}:host(.l-tag--success){--l-tag-color: var(--l-success-color, #a0d911);--l-tag-background: var(--l-success-color-light5, #fcffe6);--l-tag-border-color: var(--l-success-color, #a0d911)}:host(.l-tag--info){--l-tag-color: var(--l-info-color, #999999);--l-tag-background: var(--l-info-color-light9, #f5f5f5);--l-tag-border-color: var(--l-border-color, #dedede)}:host(.l-tag--warning){--l-tag-color: var(--l-warning-color, #ff9900);--l-tag-background: var(--l-warning-color-light5, #fff5e6);--l-tag-border-color: var(--l-warning-color, #ff9900)}.l-tag-close{margin-left:3px;font-size:12px;width:14px;height:14px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;transition:color .3s,background-color .3s;cursor:pointer}.l-tag-close:hover{background-color:var(--l-tag-color, #1890ff);color:#fff}";
7
- class x extends s {
1
+ import i from "../base.js";
2
+ import { parseAttrValue as c } from "../utils/index.js";
3
+ import { isBlank as n } from "ph-utils";
4
+ import { adjust as g } from "ph-utils/color";
5
+ import { $one as d, $$ as l, shouldEventNext as f, on as h, off as p } from "ph-utils/dom";
6
+ const b = ":host{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;height:var(--l-tag-height, 22px);padding:0 5px;font-size:12px;line-height:1;border:1px solid var(--l-tag-border-color, var(--l-border-color, #dedede));border-radius:4px;background:var(--l-tag-background, #fff);white-space:nowrap;color:var(--l-tag-color, #333)}:host(.l-tag--primary){--l-tag-border-color: var(--l-primary-color-light3, #d3adf7);--l-tag-background: var(--l-primary-color-light5, #f9f0ff);--l-tag-color: var(--l-primary-color-light3, #d3adf7)}:host(.l-tag--error){--l-tag-color: var(--l-error-color, #ed3f13);--l-tag-background: var(--l-error-color-light5, #fff1f0);--l-tag-border-color: var(--l-error-color, #ed3f13)}:host(.l-tag--success){--l-tag-color: var(--l-success-color, #a0d911);--l-tag-background: var(--l-success-color-light5, #fcffe6);--l-tag-border-color: var(--l-success-color, #a0d911)}:host(.l-tag--info){--l-tag-color: var(--l-info-color, #999999);--l-tag-background: var(--l-info-color-light9, #f5f5f5);--l-tag-border-color: var(--l-border-color, #dedede)}:host(.l-tag--warning){--l-tag-color: var(--l-warning-color, #ff9900);--l-tag-background: var(--l-warning-color-light5, #fff5e6);--l-tag-border-color: var(--l-warning-color, #ff9900)}.l-tag-close{margin-left:3px;font-size:12px;width:14px;height:14px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;transition:color .3s,background-color .3s;cursor:pointer}.l-tag-close:hover{background-color:var(--l-tag-color, #1890ff);color:#fff}";
7
+ class C extends i {
8
8
  static baseName = "tag";
9
- type = "primary";
10
- color;
11
- closeable = !1;
12
9
  connectedCallback() {
13
- this.loadStyleText(p), super.connectedCallback();
10
+ this.loadStyleText(b), super.connectedCallback();
14
11
  }
15
12
  static get observedAttributes() {
16
13
  return ["type", "color", "closeable"];
17
14
  }
18
- attributeChangedCallback(o, t, e) {
19
- const r = i(
20
- e,
21
- this[o],
22
- o
23
- );
24
- switch (r !== this[o] && (this[o] = r), o) {
15
+ attributeChangedCallback(t, o, r) {
16
+ const e = r.trim();
17
+ switch (t) {
25
18
  case "type":
26
- this._toggleTypeClass();
19
+ this._toggleTypeClass(e);
27
20
  break;
28
21
  case "color":
29
- this._toggleColorStyle();
22
+ this._toggleColorStyle(e);
30
23
  break;
31
24
  case "closable":
32
25
  if (!this.rendered) return;
33
- const a = g(".l-tag-close", this.root);
34
- a ? a.remove() : this.root.appendChild(this.#o());
26
+ const a = c(e, !1, "closeable"), s = d(".l-tag-close", this.root);
27
+ if (s) {
28
+ if (a) return;
29
+ s.remove();
30
+ } else
31
+ a && this.root.appendChild(this.#t());
35
32
  break;
36
33
  }
37
34
  }
38
35
  render() {
39
- const o = document.createDocumentFragment();
40
- return o.appendChild(
41
- l("div", { class: "l-tag-content", innerHTML: "<slot></slot>" })
42
- ), this.closeable && o.appendChild(this.#o()), o.appendChild(l("slot", { name: "suffix" })), o;
36
+ const t = document.createDocumentFragment();
37
+ return t.appendChild(l("div", { class: "l-tag-content", innerHTML: "<slot></slot>" })), this.getAttr("closeable", !1) && t.appendChild(this.#t()), t.appendChild(l("slot", { name: "suffix" })), t;
43
38
  }
44
- #o() {
39
+ #t() {
45
40
  return l("div", {
46
41
  class: "l-tag-close",
47
42
  innerHTML: "<l-close-icon></l-close-icon>",
48
43
  "data-action": "close"
49
44
  });
50
45
  }
51
- #t = (o) => {
52
- const [t, e, r] = d(o, "data-action", this);
53
- t && e === "close" && this.emit("close", { detail: { ...r.dataset } });
46
+ #r = (t) => {
47
+ const [o, r, e] = f(t, "data-action", this);
48
+ o && r === "close" && this.emit("close", { detail: { ...e.dataset } });
54
49
  };
55
50
  afterInit() {
56
- this._toggleTypeClass(), this._toggleColorStyle(), f(this.root, "click", this.#t);
51
+ this.classList.add(`l-tag--${this.getAttr("type", "info")}`), this._toggleColorStyle(), h(this.root, "click", this.#r);
57
52
  }
58
- _toggleTypeClass() {
53
+ _toggleTypeClass(t) {
59
54
  if (!this.rendered) return;
60
55
  let o = !1;
61
- for (const t of this.classList)
62
- if (t.startsWith("l-tag--")) {
63
- this.classList.replace(t, `l-tag--${this.type}`), o = !0;
56
+ for (const r of this.classList)
57
+ if (r.startsWith("l-tag--")) {
58
+ this.classList.replace(r, `l-tag--${t}`), o = !0;
64
59
  break;
65
60
  }
66
- o || this.classList.add(`l-tag--${this.type}`);
61
+ o || this.classList.add(`l-tag--${t}`);
67
62
  }
68
- _toggleColorStyle() {
69
- this.rendered && (c(this.color) ? (this.style.removeProperty("--l-tag-color"), this.style.removeProperty("--l-tag-border-color"), this.style.removeProperty("--l-tag-background")) : (this.style.setProperty("--l-tag-color", this.color), this.style.setProperty("--l-tag-border-color", this.color), this.style.setProperty(
70
- "--l-tag-background",
71
- n(this.color, 5, !0)
72
- )));
63
+ _toggleColorStyle(t) {
64
+ this.rendered && (n(t) ? (this.style.removeProperty("--l-tag-color"), this.style.removeProperty("--l-tag-border-color"), this.style.removeProperty("--l-tag-background")) : (this.style.setProperty("--l-tag-color", t), this.style.setProperty("--l-tag-border-color", t), this.style.setProperty("--l-tag-background", g(t, 5, !0))));
73
65
  }
74
66
  beforeDestroy() {
75
- h(this.root, "click", this.#t);
67
+ p(this.root, "click", this.#r);
76
68
  }
77
69
  }
78
70
  export {
79
- x as default
71
+ C as default
80
72
  };
package/package.json CHANGED
@@ -1,72 +1,67 @@
1
- {
2
- "name": "litos-ui",
3
- "version": "0.16.0",
4
- "description": "基于 Web Component 的 UI 组件库",
5
- "keywords": [
6
- "component library",
7
- "litos-ui",
8
- "ui framework",
9
- "web component"
10
- ],
11
- "homepage": "https://dvshu.github.io/litos-ui/",
12
- "bugs": {
13
- "url": "https://github.com/DvShu/litos-ui/issues"
14
- },
15
- "license": "MIT",
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/DvShu/litos-ui.git"
19
- },
20
- "files": [
21
- "lib",
22
- "styles"
23
- ],
24
- "type": "module",
25
- "main": "./lib/index.js",
26
- "module": "./lib/index.js",
27
- "types": "./lib/index.d.ts",
28
- "unpkg": "./lib/litos-ui.min.js",
29
- "jsdelivr": "./lib/litos-ui.min.js",
30
- "exports": {
31
- "./styles/*": "./styles/*",
32
- "./lib/*": "./lib/*",
33
- ".": {
34
- "types": "./lib/index.d.ts",
35
- "import": "./lib/index.js",
36
- "require": "./lib/index.js"
37
- }
38
- },
39
- "scripts": {
40
- "dev": "vite dev",
41
- "build": "vite build",
42
- "docs:dev": "vitepress dev docs --force --host 0.0.0.0",
43
- "docs:build": "vitepress build docs",
44
- "docs:preview": "vitepress preview docs",
45
- "inspect:eslint": "eslint --inspect-config",
46
- "create": "node scripts/index.js create",
47
- "dts:build": "tsc -p tsconfig.build.json && node scripts/dts.js",
48
- "lib:build": "pnpm build && pnpm dts:build"
49
- },
50
- "dependencies": {
51
- "iconify-icon": "^3.0.2",
52
- "ph-utils": "^0.16.5",
53
- "qrcode-generator-es": "^2.1.2",
54
- "shiki": "^3.21.0"
55
- },
56
- "devDependencies": {
57
- "@eslint/js": "^9.39.2",
58
- "@eslint/markdown": "^7.5.1",
59
- "@types/node": "^25.0.8",
60
- "eslint": "^9.39.2",
61
- "globals": "^17.0.0",
62
- "less": "^4.5.1",
63
- "lightningcss": "^1.30.2",
64
- "oxfmt": "^0.24.0",
65
- "oxlint": "^1.39.0",
66
- "typescript": "^5.9.3",
67
- "typescript-eslint": "^8.53.0",
68
- "vite": "^7.3.1",
69
- "vite-plugin-dts": "^4.5.4",
70
- "vitepress": "^1.6.4"
71
- }
72
- }
1
+ {
2
+ "name": "litos-ui",
3
+ "version": "0.16.1",
4
+ "description": "基于 Web Component 的 UI 组件库",
5
+ "keywords": [
6
+ "component library",
7
+ "litos-ui",
8
+ "ui framework",
9
+ "web component"
10
+ ],
11
+ "homepage": "https://dvshu.github.io/litos-ui/",
12
+ "bugs": {
13
+ "url": "https://github.com/DvShu/litos-ui/issues"
14
+ },
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/DvShu/litos-ui.git"
19
+ },
20
+ "files": [
21
+ "lib",
22
+ "styles"
23
+ ],
24
+ "type": "module",
25
+ "main": "./lib/index.js",
26
+ "module": "./lib/index.js",
27
+ "types": "./lib/index.d.ts",
28
+ "unpkg": "./lib/litos-ui.min.js",
29
+ "jsdelivr": "./lib/litos-ui.min.js",
30
+ "exports": {
31
+ "./styles/*": "./styles/*",
32
+ "./lib/*": "./lib/*",
33
+ ".": {
34
+ "types": "./lib/index.d.ts",
35
+ "import": "./lib/index.js",
36
+ "require": "./lib/index.js"
37
+ }
38
+ },
39
+ "scripts": {
40
+ "dev": "vite dev",
41
+ "build": "vite build",
42
+ "docs:dev": "vitepress dev docs --force --host 0.0.0.0",
43
+ "docs:build": "vitepress build docs",
44
+ "docs:preview": "vitepress preview docs",
45
+ "inspect:eslint": "eslint --inspect-config",
46
+ "create": "node scripts/index.js create",
47
+ "dts:build": "tsc -p tsconfig.build.json && node scripts/dts.js",
48
+ "lib:build": "pnpm build && pnpm dts:build"
49
+ },
50
+ "dependencies": {
51
+ "iconify-icon": "^3.0.2",
52
+ "ph-utils": "^0.16.5",
53
+ "qrcode-generator-es": "^2.1.2",
54
+ "shiki": "^3.21.0"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^25.0.10",
58
+ "less": "^4.5.1",
59
+ "lightningcss": "^1.31.1",
60
+ "oxfmt": "^0.26.0",
61
+ "oxlint": "^1.41.0",
62
+ "typescript": "^5.9.3",
63
+ "vite": "^7.3.1",
64
+ "vite-plugin-dts": "^4.5.4",
65
+ "vitepress": "^1.6.4"
66
+ }
67
+ }