litos-ui 0.19.0 → 0.20.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 (128) hide show
  1. package/lib/{base-LvfO4mmL.js → base-Dyj1rzaK.js} +11 -12
  2. package/lib/base.d.ts +2 -2
  3. package/lib/base.js +14 -10
  4. package/lib/button/index.js +1 -1
  5. package/lib/{button-CC5NBWtI.js → button-CDYYpQu6.js} +3 -4
  6. package/lib/calendar/index.js +1 -1
  7. package/lib/{calendar-Clbg3qot.js → calendar-CvlUsN6w.js} +20 -23
  8. package/lib/carousel/index.js +1 -1
  9. package/lib/carousel/item.js +1 -1
  10. package/lib/{carousel-Dgirxwzb.js → carousel-DvkZ1YXq.js} +23 -19
  11. package/lib/check/checkbox.js +1 -1
  12. package/lib/check/checkbox_group.js +1 -1
  13. package/lib/check/radio.js +1 -1
  14. package/lib/check/radio_group.js +1 -1
  15. package/lib/{check-BDOpD_0-.js → check-DFlwStH9.js} +10 -13
  16. package/lib/{check-CrlZ7zVL.js → check-doQ2ZpQj.js} +10 -10
  17. package/lib/{checkbox-D_bZGoUD.js → checkbox-DhGHJXwI.js} +1 -1
  18. package/lib/collapse/index.js +1 -1
  19. package/lib/collapse/item.js +1 -1
  20. package/lib/{collapse-BRxYoeJx.js → collapse-B6-Rn05A.js} +8 -10
  21. package/lib/color_picker/index.js +1 -1
  22. package/lib/{color_picker-AaFcIczZ.js → color_picker-0a-IGZY9.js} +3 -3
  23. package/lib/date_picker/index.js +1 -1
  24. package/lib/{date_picker-HjkRma9j.js → date_picker-BDN2PAz5.js} +3 -7
  25. package/lib/date_picker_ori/index.js +1 -1
  26. package/lib/{date_picker_ori-1IOHZsan.js → date_picker_ori-BXFs1eET.js} +4 -6
  27. package/lib/description_panel/index.js +1 -1
  28. package/lib/{description_panel-DaqVcA6-.js → description_panel--AKXBzLL.js} +2 -6
  29. package/lib/dialog/dialog_container.js +1 -1
  30. package/lib/dialog/index.js +9 -7
  31. package/lib/{dialog_container-CcTyfoaD.js → dialog_container-Bq6HsKey.js} +7 -6
  32. package/lib/{esm-Cir9D6cn.js → esm-DAha108i.js} +67 -67
  33. package/lib/form/form_item.d.ts +1 -1
  34. package/lib/form/form_item.js +1 -1
  35. package/lib/form/index.d.ts +3 -3
  36. package/lib/form/index.js +1 -1
  37. package/lib/{form-BvZHaqAt.js → form-DJxvBiLy.js} +30 -32
  38. package/lib/{form_inner-52DR1IPu.js → form_inner-Cnwb6f_Q.js} +3 -5
  39. package/lib/{form_item-DtqChzc3.js → form_item-CFIkfH29.js} +3 -5
  40. package/lib/icon/arrow_down.js +1 -1
  41. package/lib/icon/arrow_left.js +1 -1
  42. package/lib/icon/arrow_right.js +1 -1
  43. package/lib/icon/arrow_up.js +1 -1
  44. package/lib/icon/base.js +1 -1
  45. package/lib/icon/calendar.js +1 -1
  46. package/lib/icon/caret_bottom.js +1 -1
  47. package/lib/icon/caret_top.js +1 -1
  48. package/lib/icon/close.js +1 -1
  49. package/lib/icon/close_filled.js +1 -1
  50. package/lib/icon/d_arrow_left.js +1 -1
  51. package/lib/icon/d_arrow_right.js +1 -1
  52. package/lib/icon/font_icon.js +1 -1
  53. package/lib/icon/info.js +1 -1
  54. package/lib/icon/loading.js +1 -1
  55. package/lib/icon/moon.js +1 -1
  56. package/lib/icon/more.js +1 -1
  57. package/lib/icon/reduction.js +1 -1
  58. package/lib/icon/refresh.js +1 -1
  59. package/lib/icon/refresh_left.js +1 -1
  60. package/lib/icon/refresh_right.js +1 -1
  61. package/lib/icon/search.js +1 -1
  62. package/lib/icon/select.js +1 -1
  63. package/lib/icon/sort.js +1 -1
  64. package/lib/icon/success.js +1 -1
  65. package/lib/icon/sun.js +1 -1
  66. package/lib/icon/theme_default.js +1 -1
  67. package/lib/icon/warn.js +1 -1
  68. package/lib/icon/zoom_in.js +1 -1
  69. package/lib/icon/zoom_out.js +1 -1
  70. package/lib/image/image_preview.js +1 -1
  71. package/lib/image/index.js +1 -1
  72. package/lib/{image-BCUhVAFo.js → image-CVQai6NX.js} +19 -19
  73. package/lib/{image_preview-BeJzfEoF.js → image_preview-DfQAKSJH.js} +3 -5
  74. package/lib/index.js +36 -36
  75. package/lib/input/index.js +3 -5
  76. package/lib/{item-42bYhAkZ.js → item-CQ2Sknbz.js} +1 -1
  77. package/lib/{item-Dq6M7lxw.js → item-DI6mQXtB.js} +5 -7
  78. package/lib/{item-CX8C9X57.js → item-D_ZOPXuE.js} +1 -1
  79. package/lib/list/index.js +1 -1
  80. package/lib/{list-Dz1Ya118.js → list-Dg5u5dgr.js} +1 -1
  81. package/lib/loading/index.js +6 -4
  82. package/lib/mask/index.js +1 -1
  83. package/lib/{mask-BlDl9u8F.js → mask-Bx-yNIJv.js} +2 -6
  84. package/lib/md_input/index.js +1 -1
  85. package/lib/{md_input-DN3ceqsw.js → md_input-BX3bujz8.js} +2 -2
  86. package/lib/menu/index.d.ts +10 -2
  87. package/lib/menu/index.js +1 -1
  88. package/lib/menu-DKscK5mw.js +274 -0
  89. package/lib/message/index.js +1 -1
  90. package/lib/modal/index.js +1 -1
  91. package/lib/modal/modal_box.js +4 -4
  92. package/lib/{modal-cjj3Nw1B.js → modal-iwxqmAqW.js} +11 -9
  93. package/lib/page_header/index.js +1 -1
  94. package/lib/{page_header-BfuWJIdd.js → page_header-ujV3pncE.js} +2 -4
  95. package/lib/pagination/index.d.ts +25 -18
  96. package/lib/pagination/index.js +1 -1
  97. package/lib/{pagination-DpOSOFwl.js → pagination-aRbGd3Rf.js} +86 -83
  98. package/lib/polygon/index.js +1 -1
  99. package/lib/{polygon-BY1FAACc.js → polygon-DhhovlrG.js} +1 -1
  100. package/lib/qrcode/index.js +1 -1
  101. package/lib/{qrcode-Bgr8gJzA.js → qrcode-Dip8uLSA.js} +1 -1
  102. package/lib/{radio-C7dkhgwc.js → radio-C9NPQWGI.js} +1 -1
  103. package/lib/select/index.js +1 -1
  104. package/lib/{select-Cis6kRjQ.js → select-BZMDj5VE.js} +33 -30
  105. package/lib/select_ori/index.js +1 -1
  106. package/lib/{select_ori-DcJbNYYr.js → select_ori-C7sUZxen.js} +3 -3
  107. package/lib/space/index.js +1 -1
  108. package/lib/{space-BT_dVhhv.js → space-CKuTk0YB.js} +6 -5
  109. package/lib/switch/index.js +1 -1
  110. package/lib/{switch-UyhlgW7F.js → switch-wh2-ivty.js} +11 -9
  111. package/lib/tabbar/index.js +1 -1
  112. package/lib/tabbar/item.js +1 -1
  113. package/lib/{tabbar-DO0kB58Y.js → tabbar-CBXK-_AV.js} +1 -1
  114. package/lib/table/index.d.ts +7 -3
  115. package/lib/table/index.js +1 -1
  116. package/lib/{table-saZMryiV.js → table-BQxMD2Ae.js} +32 -33
  117. package/lib/tabs/index.js +4 -2
  118. package/lib/tag/index.js +1 -1
  119. package/lib/{tag-BtDcKdxo.js → tag-Di1z9PoZ.js} +3 -5
  120. package/lib/theme/index.js +1 -1
  121. package/lib/theme/theme_color.js +4 -5
  122. package/lib/{theme-Barcq234.js → theme-CLbBS-in.js} +9 -10
  123. package/lib/utils/context_provide.js +1 -1
  124. package/lib/utils/index.d.ts +1 -1
  125. package/lib/utils/popover.js +1 -1
  126. package/lib/utils/transition.js +1 -1
  127. package/package.json +11 -11
  128. package/lib/menu-BOmVa4xN.js +0 -224
@@ -1,16 +1,18 @@
1
1
  import e from "./base.js";
2
2
  import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
3
- import { $$ as r, $one as i, formatStyle as a, iterate as o, off as s, on as c, shouldEventNext as l } from "ph-utils/dom";
3
+ import { $$ as r, $one as i, formatStyle as a, iterate as o, off as s, on as c, shouldEventNext as l } from "ph-utils/browser";
4
4
  import { random as u } from "ph-utils";
5
5
  //#region src/components/table/index.less?inline
6
- var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:var(--l-table-font-size,14px);display:inline-block;overflow:auto}.l-table{border-collapse:collapse;border-spacing:0;table-layout:var(--l-table-layout,auto);width:100%}.l-table th,.l-table td{border-bottom:1px solid var(--l-table-border-color,#e6e6e6)}.l-table th{padding:var(--l-table-th-padding,10px);text-align:left;background-color:var(--l-table-th-bg,#f2f2f2);color:var(--l-table-th-color,#000)}.l-table td{background-color:var(--l-table-td-bg,#fff);color:var(--l-table-td-color,#000);padding:var(--l-table-td-padding,10px);transition:background-color .3s}.l-table tr:hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table .l-table__empty-col{color:var(--l-table-empty-color,#999);text-align:center}.l-table-stripe tr:nth-child(2n) td{background-color:var(--l-table-stripe-bg,#fafafa)}.l-table-stripe tr:nth-child(2n):hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table-border th,.l-table-border td{border:1px solid var(--l-table-border-color,#e6e6e6)}.l-table-fixed{--l-table-layout:fixed}.l-table-fixed .l-fixed{z-index:1;box-sizing:border-box;position:sticky}.l-table-fixed thead.l-fixed,.l-table-fixed tfoot.l-fixed{z-index:2}.l-table .caret-wrapper{vertical-align:middle;justify-content:center;align-items:center;width:20px;height:14px;display:inline-flex;position:relative}.l-table .caret-wrapper .ascending{border-bottom-color:var(--l-table-sort-inactive-color,#c0c4cc);top:-5px}.l-table .caret-wrapper .descending{border-top-color:var(--l-table-sort-inactive-color,#c0c4cc);bottom:-3px}.l-table .sort-caret{border:5px solid #0000;border-radius:3px;width:0;height:0;display:inline-block;position:absolute}.l-table .sort-column{cursor:pointer}.l-table .sort-asc .ascending{border-bottom-color:var(--l-primary-color,#52c41a)}.l-table .sort-desc .descending{border-top-color:var(--l-primary-color,#52c41a)}", f = class extends e {
6
+ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:var(--l-table-font-size,14px);display:inline-block;overflow:auto}.l-table{border-collapse:collapse;border-spacing:0;table-layout:var(--l-table-layout,auto);width:100%}.l-table th,.l-table td{border-bottom:1px solid var(--l-table-border-color,#e6e6e6)}.l-table th{padding:var(--l-table-th-padding,10px);text-align:left;background-color:var(--l-table-th-bg,#f2f2f2);color:var(--l-table-th-color,#000)}.l-table td{background-color:var(--l-table-td-bg,#fff);color:var(--l-table-td-color,#000);padding:var(--l-table-td-padding,10px);transition:background-color .3s}.l-table tr:hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table .l-table__empty-col{color:var(--l-table-empty-color,#999);text-align:center}.l-table-stripe tr:nth-child(2n) td{background-color:var(--l-table-stripe-bg,#fafafa)}.l-table-stripe tr:nth-child(2n):hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table-border th,.l-table-border td{border:1px solid var(--l-table-border-color,#e6e6e6)}.l-table-fixed{--l-table-layout:fixed}.l-table-fixed .l-fixed{z-index:1;box-sizing:border-box;position:-webkit-sticky;position:sticky}.l-table-fixed thead.l-fixed,.l-table-fixed tfoot.l-fixed{z-index:2}.l-table .caret-wrapper{vertical-align:middle;justify-content:center;align-items:center;width:20px;height:14px;display:inline-flex;position:relative}.l-table .caret-wrapper .ascending{border-bottom-color:var(--l-table-sort-inactive-color,#c0c4cc);top:-5px}.l-table .caret-wrapper .descending{border-top-color:var(--l-table-sort-inactive-color,#c0c4cc);bottom:-3px}.l-table .sort-caret{border:5px solid #0000;border-radius:3px;width:0;height:0;display:inline-block;position:absolute}.l-table .sort-column{cursor:pointer}.l-table .sort-asc .ascending{border-bottom-color:var(--l-primary-color,#52c41a)}.l-table .sort-desc .descending{border-top-color:var(--l-primary-color,#52c41a)}", f = class extends e {
7
7
  static baseName = "table";
8
- stripe = !0;
9
- border = !1;
10
- fixedHead = !1;
11
- fixedColumn = !1;
12
- maxHeight;
13
- tableLayout;
8
+ constructor() {
9
+ super(), this._state = {
10
+ stripe: !0,
11
+ border: !1,
12
+ fixedHead: !1,
13
+ fixedColumn: !1
14
+ };
15
+ }
14
16
  columns = [];
15
17
  data = [];
16
18
  sortInfo;
@@ -26,13 +28,13 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
26
28
  }
27
29
  changeFixed(e) {
28
30
  let t = {
29
- fixedHead: this.fixedHead,
30
- fixedColumn: this.fixedColumn,
31
+ fixedHead: this._state.fixedHead,
32
+ fixedColumn: this._state.fixedColumn,
31
33
  ...e
32
34
  };
33
- if (this.fixedHead = t.fixedHead, this.fixedColumn = t.fixedColumn, this.rendered) {
35
+ if (this._state.fixedHead = t.fixedHead, this._state.fixedColumn = t.fixedColumn, this.rendered) {
34
36
  let e = i(".l-table", this.root);
35
- e && (this.fixedHead || this.fixedColumn ? e.classList.add("l-table-fixed") : e.classList.remove("l-table-fixed"));
37
+ e && (this._state.fixedHead || this._state.fixedColumn ? e.classList.add("l-table-fixed") : e.classList.remove("l-table-fixed"));
36
38
  }
37
39
  }
38
40
  static get observedAttributes() {
@@ -44,33 +46,30 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
44
46
  "table-layout"
45
47
  ];
46
48
  }
47
- attributeChangedCallback(e, r, i) {
48
- e = t(e);
49
- let a = n(i, this[e], e);
50
- if (a !== this[e]) switch (this[e] = a, e) {
49
+ attributeChanged(e, r, i) {
50
+ let a = t(e);
51
+ switch (a) {
51
52
  case "stripe":
52
- this._classAttrChannge("stripe", a);
53
- break;
54
53
  case "border":
55
- this._classAttrChannge("border", a);
56
- break;
57
54
  case "fixedHead":
58
- this._updateFixedHead(), this.changeFixed();
55
+ case "fixedColumn":
56
+ this._state[a] = n(i, !1, e);
59
57
  break;
60
58
  case "maxHeight":
61
- this._changeMaxHeight();
62
- break;
63
- case "tableLayout":
64
- this._changeCssVar("table-layout", a);
59
+ this._state.maxHeight = i || void 0;
65
60
  break;
61
+ case "tableLayout": this._state.tableLayout = i || void 0;
66
62
  }
67
63
  }
64
+ updateDOM(e) {
65
+ e.has("stripe") && this._classAttrChannge("stripe", this._state.stripe), e.has("border") && this._classAttrChannge("border", this._state.border), e.has("fixedHead") && (this._updateFixedHead(), this.changeFixed()), e.has("maxHeight") && this._changeMaxHeight(), e.has("tableLayout") && this._changeCssVar("layout", this._state.tableLayout);
66
+ }
68
67
  render() {
69
68
  let e = r("table", { class: [
70
69
  "l-table",
71
- this.stripe ? "l-table-stripe" : "",
72
- this.border ? "l-table-border" : "",
73
- this.fixedHead || this.fixedColumn ? "l-table-fixed" : ""
70
+ this._state.stripe ? "l-table-stripe" : "",
71
+ this._state.border ? "l-table-border" : "",
72
+ this._state.fixedHead || this._state.fixedColumn ? "l-table-fixed" : ""
74
73
  ] });
75
74
  return e.appendChild(this._headRender()), e.appendChild(this._bodyRender()), e;
76
75
  }
@@ -92,7 +91,7 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
92
91
  t ? this.style.setProperty(n, t) : this.style.removeProperty(n);
93
92
  }
94
93
  _changeMaxHeight() {
95
- let e = this.maxHeight;
94
+ let e = this._state.maxHeight;
96
95
  e && typeof e == "number" && (e = `${e}px`), this._changeCssVar("max-height", e);
97
96
  }
98
97
  _classAttrChannge(e, t) {
@@ -104,13 +103,13 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
104
103
  _updateFixedHead() {
105
104
  if (this.rendered) {
106
105
  let e = i("thead", this.root);
107
- e && (e.classList.toggle("l-fixed", this.fixedHead), e.style.top = this.fixedHead ? "0" : "");
106
+ e && (e.classList.toggle("l-fixed", this._state.fixedHead), e.style.top = this._state.fixedHead ? "0" : "");
108
107
  }
109
108
  }
110
109
  _headRender() {
111
110
  let e = r("thead", {
112
- class: { "l-fixed": this.fixedHead },
113
- style: { top: this.fixedHead ? "0" : void 0 }
111
+ class: { "l-fixed": this._state.fixedHead },
112
+ style: { top: this._state.fixedHead ? "0" : void 0 }
114
113
  });
115
114
  return this.columns && this._rendHeadRow(e, this.columns), e;
116
115
  }
@@ -191,7 +190,7 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
191
190
  let n = e.id;
192
191
  if (this._globalColStyles && n in this._globalColStyles) return this._globalColStyles[n][t];
193
192
  let r = {};
194
- e.width && (typeof e.width == "number" ? r.width = `${e.width}px` : r.width = e.width), e.fixed && (e.fixed === "left" ? (r.left = `${e.left}px`, r["box-shadow"] = "-4px 0 4px -4px #d9d9d9 inset") : e.fixed === "right" && (r.right = `${e.right}px`, r["box-shadow"] = "4px 0 4px -4px #d9d9d9 inset")), this._globalColStyles ||= {};
193
+ e.width && (r.width = typeof e.width == "number" ? `${e.width}px` : e.width), e.fixed && (e.fixed === "left" ? (r.left = `${e.left}px`, r["box-shadow"] = "-4px 0 4px -4px #d9d9d9 inset") : e.fixed === "right" && (r.right = `${e.right}px`, r["box-shadow"] = "4px 0 4px -4px #d9d9d9 inset")), this._globalColStyles ||= {};
195
194
  let i = a(r), o = {
196
195
  th: i,
197
196
  td: i + a(e.style || "")
package/lib/tabs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as e, $one as t, iterate as n, off as r, on as i } from "ph-utils/dom";
1
+ import { $ as e, $one as t, iterate as n, off as r, on as i } from "ph-utils/browser";
2
2
  //#region src/components/tabs/index.ts
3
3
  function a() {
4
4
  let a = e(".l-tabs");
@@ -21,7 +21,9 @@ function a() {
21
21
  if (a) {
22
22
  i(a, "change", o);
23
23
  let t = a.getAttribute("name");
24
- t && r.setAttribute("l-current-tab", t), n(e(".l-tabs__content[l-tab]", r), (e) => {
24
+ t && r.setAttribute("l-current-tab", t);
25
+ let s = e(".l-tabs__content[l-tab]", r);
26
+ n(s, (e) => {
25
27
  e.getAttribute("l-tab") === t ? e.classList.remove("l-tabs__content--hide") : e.classList.add("l-tabs__content--hide");
26
28
  });
27
29
  }
package/lib/tag/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "../tag-BtDcKdxo.js";
1
+ import { t as e } from "../tag-Di1z9PoZ.js";
2
2
  export { e as default };
@@ -1,8 +1,7 @@
1
1
  import e from "./base.js";
2
2
  import { parseAttrValue as t } from "./utils/index.js";
3
- import { $$ as n, $one as r, off as i, on as a, shouldEventNext as o } from "ph-utils/dom";
4
- import { isBlank as s } from "ph-utils";
5
- import { adjust as c } from "ph-utils/color";
3
+ import { $$ as n, $one as r, off as i, on as a, shouldEventNext as o } from "ph-utils/browser";
4
+ import { adjust as s, isBlank as c } from "ph-utils";
6
5
  //#region src/components/tag/index.less?inline
7
6
  var l = ":host{box-sizing:border-box;vertical-align:middle;height:var(--l-tag-height,22px);border:1px solid var(--l-tag-border-color,var(--l-border-color,#dedede));background:var(--l-tag-background,#fff);white-space:nowrap;color:var(--l-tag-color,#333);border-radius:4px;justify-content:center;align-items:center;padding:0 5px;font-size:12px;line-height:1;display:inline-flex}: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,#999);--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,#f90);--l-tag-background:var(--l-warning-color-light5,#fff5e6);--l-tag-border-color:var(--l-warning-color,#f90)}.l-tag-close{cursor:pointer;border-radius:50%;justify-content:center;align-items:center;width:14px;height:14px;margin-left:3px;font-size:12px;transition:color .3s,background-color .3s;display:inline-flex}.l-tag-close:hover{background-color:var(--l-tag-color,#1890ff);color:#fff}", u = class extends e {
8
7
  static baseName = "tag";
@@ -32,7 +31,6 @@ var l = ":host{box-sizing:border-box;vertical-align:middle;height:var(--l-tag-he
32
31
  if (e) return;
33
32
  n.remove();
34
33
  } else e && this.root.appendChild(this.#e());
35
- break;
36
34
  }
37
35
  }
38
36
  render() {
@@ -66,7 +64,7 @@ var l = ":host{box-sizing:border-box;vertical-align:middle;height:var(--l-tag-he
66
64
  t || this.classList.add(`l-tag--${e}`);
67
65
  }
68
66
  _toggleColorStyle(e) {
69
- this.rendered && (s(e) ? (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", e), this.style.setProperty("--l-tag-border-color", e), this.style.setProperty("--l-tag-background", c(e, 5, !0))));
67
+ this.rendered && (c(e) ? (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", e), this.style.setProperty("--l-tag-border-color", e), this.style.setProperty("--l-tag-background", s(e, 5, !0))));
70
68
  }
71
69
  beforeDestroy() {
72
70
  i(this.root, "click", this.#t);
@@ -1,2 +1,2 @@
1
- import { t as e } from "../theme-Barcq234.js";
1
+ import { t as e } from "../theme-CLbBS-in.js";
2
2
  export { e as default };
@@ -1,22 +1,21 @@
1
1
  import e from "../base.js";
2
- import { $one as t, on as n } from "ph-utils/dom";
3
- import { applyColorTheme as r, getColorTheme as i } from "ph-utils/theme";
2
+ import { $one as t, applyColorTheme as n, getColorTheme as r, on as i } from "ph-utils/browser";
4
3
  //#region src/components/theme/theme_color.ts
5
4
  var a = class extends e {
6
5
  static baseName = "theme-color";
7
6
  constructor() {
8
- super(), this.version = 2, this._state = { color: i() || "#722ed1" };
7
+ super(), this.version = 2, this._state = { color: r() || "#722ed1" };
9
8
  }
10
9
  render_v2() {
11
10
  return { template: `<l-color-picker value="${this._state.color}"></l-color-picker>` };
12
11
  }
13
12
  afterInit() {
14
13
  let e = t("l-color-picker", this.root);
15
- e && n(e, "change", this.#e);
14
+ e && i(e, "change", this.#e);
16
15
  }
17
16
  #e = async (e) => {
18
17
  let t = e.detail;
19
- this._state.color = t, await r(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
18
+ this._state.color = t, await n(t), this.emit("change", { detail: t });
20
19
  };
21
20
  };
22
21
  //#endregion
@@ -1,7 +1,6 @@
1
1
  import e from "./base.js";
2
2
  import { initAttr as t } from "./utils/index.js";
3
- import { $one as n, create as r, off as i, on as a } from "ph-utils/dom";
4
- import { applyTheme as o, getTheme as s } from "ph-utils/theme";
3
+ import { $one as n, applyTheme as r, create as i, getTheme as a, off as o, on as s } from "ph-utils/browser";
5
4
  //#region src/components/theme/index.less?inline
6
5
  var c = ":host{box-sizing:border-box;width:auto;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:#666;width:var(--l-form-control-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){color:#fff;background-color:#000}html.dark .l-theme-btn{--l-btn-hover-text-color:#fff}", l = [
7
6
  {
@@ -26,7 +25,7 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
26
25
  theme;
27
26
  #e;
28
27
  connectedCallback() {
29
- t(this), this.theme = s(), this.loadStyleText(c), super.connectedCallback(), this.#s();
28
+ t(this), this.theme = a(), this.loadStyleText(c), super.connectedCallback(), this.#s();
30
29
  }
31
30
  disconnectedCallback() {
32
31
  super.disconnectedCallback(), this.#c();
@@ -40,7 +39,7 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
40
39
  }
41
40
  }
42
41
  #t() {
43
- let e = r("l-button", { class: "l-theme-btn l-theme-inner" });
42
+ let e = i("l-button", { class: "l-theme-btn l-theme-inner" });
44
43
  return this.#n(e), e;
45
44
  }
46
45
  #n(e) {
@@ -48,7 +47,7 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
48
47
  e.innerHTML = `<l-${t}-icon></l-${t}-icon>`;
49
48
  }
50
49
  #r() {
51
- let e = r("l-select-ori", { class: "l-theme-inner" });
50
+ let e = i("l-select-ori", { class: "l-theme-inner" });
52
51
  return e.value = this.theme, e.innerHTML = [
53
52
  "<option value=\"auto\">跟随系统</option>",
54
53
  "<option value=\"light\">浅色模式</option>",
@@ -56,11 +55,11 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
56
55
  ].join(""), e;
57
56
  }
58
57
  #i() {
59
- let e = r("l-switch", { class: "l-theme-switch l-theme-inner" });
58
+ let e = i("l-switch", { class: "l-theme-switch l-theme-inner" });
60
59
  return e.value = this.theme === "dark", e.innerHTML = "<l-sun-icon slot=\"unchecked-action\"></l-sun-icon><l-moon-icon slot=\"checked-action\"></l-moon-icon>", e;
61
60
  }
62
61
  #a() {
63
- let e = r("l-radio-group", { class: "l-theme-inner" });
62
+ let e = i("l-radio-group", { class: "l-theme-inner" });
64
63
  return e.value = this.theme, e.innerHTML = l.map((e) => {
65
64
  let t = "";
66
65
  return t = this.label === "icon" ? `<${e.icon}></${e.icon}>` : e.text, `<l-radio value="${e.value}" button>${t}</l-radio>`;
@@ -73,13 +72,13 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
73
72
  let n = e.target.value;
74
73
  t = this.type === "switch" ? n ? "dark" : "light" : n;
75
74
  }
76
- await o(t), this.theme = t, this.type === "button" && this.#n(this.#e), this.dispatchEvent(new CustomEvent("change", { detail: t }));
75
+ await r(t), this.theme = t, this.type === "button" && this.#n(this.#e), this.emit("change", { detail: t });
77
76
  };
78
77
  #s() {
79
- this.#e = n(".l-theme-inner", this.root), this.type === "button" ? a(this.#e, "click", this.#o) : a(this.#e, "change", this.#o);
78
+ this.#e = n(".l-theme-inner", this.root), this.type === "button" ? s(this.#e, "click", this.#o) : s(this.#e, "change", this.#o);
80
79
  }
81
80
  #c() {
82
- this.#e &&= (this.type === "button" ? i(this.#e, "click", this.#o) : i(this.#e, "change", this.#o), void 0);
81
+ this.#e &&= (this.type === "button" ? o(this.#e, "click", this.#o) : o(this.#e, "change", this.#o), void 0);
83
82
  }
84
83
  };
85
84
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import e from "../base.js";
2
- import { off as t, on as n } from "ph-utils/dom";
2
+ import { off as t, on as n } from "ph-utils/browser";
3
3
  //#region src/components/utils/context_provide.ts
4
4
  var r = class extends e {
5
5
  context;
@@ -35,4 +35,4 @@ export declare function setAttrs(el: HTMLElement, attrs: [string, string | undef
35
35
  */
36
36
  export declare function kebabToCamel(attr: string): string;
37
37
  export declare function stopSignal(fn?: SignalStop): undefined;
38
- export declare function unitNumberStr(value?: string, unit?: string): string | undefined;
38
+ export declare function unitNumberStr(value?: string | null | undefined, unit?: string): string | null | undefined;
@@ -1,4 +1,4 @@
1
- import { $ as e, $$ as t, $one as n, iterate as r, off as i, on as a, shouldEventNext as o } from "ph-utils/dom";
1
+ import { $ as e, $$ as t, $one as n, iterate as r, off as i, on as a, shouldEventNext as o } from "ph-utils/browser";
2
2
  //#region src/components/utils/popover.ts
3
3
  function s(e, t, n, r, i = 10, a = "x") {
4
4
  let o = a === "x" ? "width" : "height", s = [
@@ -1,4 +1,4 @@
1
- import { $ as e, iterate as t, transition as n } from "ph-utils/dom";
1
+ import { $ as e, iterate as t, transition as n } from "ph-utils/browser";
2
2
  //#region src/components/utils/transition.ts
3
3
  function r() {
4
4
  let r, i = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litos-ui",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "基于 Web Component 的 UI 组件库",
5
5
  "keywords": [
6
6
  "component library",
@@ -51,19 +51,19 @@
51
51
  "dependencies": {
52
52
  "alien-signals": "^3.2.1",
53
53
  "iconify-icon": "^3.0.2",
54
- "ph-utils": "^0.20.1",
54
+ "ph-utils": "^1.1.0",
55
55
  "qrcode-generator-es": "^2.1.3",
56
- "shiki": "^4.3.0"
56
+ "shiki": "^4.4.3"
57
57
  },
58
58
  "devDependencies": {
59
- "@types/node": "^26.0.1",
60
- "less": "^4.6.7",
61
- "lightningcss": "^1.32.0",
62
- "oxfmt": "^0.56.0",
63
- "oxlint": "^1.71.0",
64
- "preact": "^10.29.2",
65
- "typescript": "^6.0.3",
66
- "vite": "^8.1.0",
59
+ "@types/node": "^26.2.0",
60
+ "less": "^4.9.0",
61
+ "lightningcss": "^1.33.0",
62
+ "oxfmt": "^0.64.0",
63
+ "oxlint": "^1.79.0",
64
+ "preact": "^10.29.8",
65
+ "typescript": "^7.0.2",
66
+ "vite": "^8.2.2",
67
67
  "vitepress": "^1.6.4"
68
68
  }
69
69
  }
@@ -1,224 +0,0 @@
1
- import e from "./base.js";
2
- import { parseAttrValue as t } from "./utils/index.js";
3
- import { $ as n, $$ as r, $one as i, iterate as a, off as o, on as s } from "ph-utils/dom";
4
- //#region src/components/menu/index.less?inline
5
- var c = ":host{--l-menu-width:240px;--l-menu-height:auto;--l-menu-level:0;--l-menu-item-height:40px;--l-menu-item-padding-x:10px;--l-menu-item-indent:15px;--l-menu-item-radius:0;--l-menu-item-hover-background:var(--l-primary-color-light5,#f9f0ff);--l-menu-item-active-color:var(--l-primary-color,#722ed1);--l-menu-item-active-background:var(--l-primary-color-light5,#f9f0ff);--l-menu-border-color:var(--l-border-color,#dedede);--l-menu-border-width:1px;--l-menu-arrow-color:var(--l-info-color,#8c8c8c);width:var(--l-menu-width);height:var(--l-menu-height);box-sizing:border-box;display:block}.l-menu{min-width:0;color:inherit;box-sizing:border-box;border-right:var(--l-menu-border-width) solid var(--l-menu-border-color);font-size:14px;transition:height .3s,width .3s;display:block;position:relative;overflow:hidden}.l-menu .l-menu{--l-menu-border-color:transparent}.l-menu-item,.l-submenu-title{padding:0 var(--l-menu-item-padding-x) 0 calc(var(--l-menu-item-padding-x) + var(--l-menu-level) * var(--l-menu-item-indent));height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;text-overflow:ellipsis;border-radius:var(--l-menu-item-radius);border-right:2px solid #0000;align-items:center;gap:6px;transition:color .3s,background-color .3s,border-color .3s,transform .2s;display:flex;position:relative;overflow:hidden}.l-menu-item:hover,.l-submenu-title:hover{background-color:var(--l-menu-item-hover-background)}.l-menu-item.active{background-color:var(--l-menu-item-active-background);color:var(--l-menu-item-active-color);font-weight:500}.l-menu-icon-wrap{flex:none;align-items:center;font-size:14px;line-height:1;display:inline-flex}.l-menu-submenu{width:100%;display:block;overflow:hidden}.l-submenu-arrow-icon{color:var(--l-menu-arrow-color);transition:transform .3s;position:absolute;top:50%;right:10px;transform:translateY(-50%)rotate(90deg)}.l-menu-submenu.collapsed .l-submenu-arrow-icon{transform:translateY(-50%)rotate(0)}.l-menu--collapsed{display:none}.l-menu--hide{visibility:hidden;pointer-events:none;position:absolute}.l-menu-submenu.active .l-submenu-title{color:var(--l-menu-item-active-color)}@media (prefers-reduced-motion:reduce){.l-menu,.l-menu-item,.l-submenu-title,.l-submenu-arrow-icon{transition:none!important}}", l = 350, u = class extends e {
6
- static baseName = "menu";
7
- accordion = !1;
8
- _items;
9
- _menuEl;
10
- _activeKeys;
11
- #e;
12
- #t;
13
- #n;
14
- constructor() {
15
- super(), this._items = [], this._activeKeys = /* @__PURE__ */ new Set(), this.#n = /* @__PURE__ */ new Map(), this.#e = /* @__PURE__ */ new Map(), this.#t = /* @__PURE__ */ new Map(), this.version = 2, this._state = { selectedIndex: "" };
16
- }
17
- static get observedAttributes() {
18
- return ["selected-index", "accordion"];
19
- }
20
- attributeChanged(e, n, r) {
21
- switch (e) {
22
- case "selected-index":
23
- this._state.selectedIndex = r || "", this.rendered && this.updateSelectedKeys(this._state.selectedIndex);
24
- break;
25
- case "accordion":
26
- this.accordion = t(r, !1, "accordion"), this._state.accordion = this.accordion;
27
- break;
28
- }
29
- }
30
- afterInit() {
31
- this.classList.add("l-menu", "l-menu--vertical"), s(this.root, "click", this._handleClick), s(this.root, "transitionend", this._onTransitionEnd), this._menuEl = i(".l-menu", this.root);
32
- }
33
- beforeDestroy() {
34
- o(this.root, "click", this._handleClick), o(this.root, "transitionend", this._onTransitionEnd), this.#n.forEach((e) => clearTimeout(e)), this.#n.clear(), this.#e.forEach((e) => cancelAnimationFrame(e)), this.#e.clear(), this.#t.clear(), this._menuEl = void 0;
35
- }
36
- render_v2() {
37
- return {
38
- style: c,
39
- template: r("div", { class: "l-menu" })
40
- };
41
- }
42
- _handleClick = (e) => {
43
- let { type: t, key: n, keyPaths: r, target: i } = this.#r(e.target);
44
- if (i) if (t === 2) {
45
- let e = i.hasAttribute("expanded");
46
- this._toggleSubMenu(i, !e), !e && this.accordion && this.#o(i);
47
- } else t === 1 && (this.#i(r), this.updateSelectedKeys(n), this.emit("select", { detail: {
48
- key: n,
49
- keyPaths: r
50
- } }));
51
- };
52
- #r(e, t) {
53
- let n = 0, r = "", i, a = [];
54
- do {
55
- if (!e) break;
56
- let o = e.getAttribute("index");
57
- if (o && (r ||= o, a.unshift(o), t && t(e, o)), n === 0) {
58
- let t = e.getAttribute("menu-role");
59
- t && (n = Number(t), i = e);
60
- }
61
- e = e.parentElement;
62
- } while (n >= 0);
63
- return {
64
- type: n,
65
- key: r,
66
- keyPaths: a,
67
- target: i
68
- };
69
- }
70
- expandSubmenus(e, t = !1) {
71
- let r = n(".l-menu-submenu[index]", this.root), i = new Set(e);
72
- a(r, (e) => {
73
- let n = e.getAttribute("index") || "";
74
- i.has(n) ? this._toggleSubMenu(e, !0) : t && this._toggleSubMenu(e, !1);
75
- });
76
- }
77
- updateSelectedKeys(e) {
78
- this._state.selectedIndex = e;
79
- let t = e ? i(`.l-menu-item[index="${e}"]`, this.root) : null;
80
- if (t) {
81
- let e = this.#r(t, (e) => {
82
- e.classList.add("active"), e.getAttribute("menu-role") === "2" && this._toggleSubMenu(e, !0);
83
- });
84
- this.#i(e.keyPaths);
85
- } else this.#i([]);
86
- }
87
- #i(e) {
88
- let t = n(".l-menu [index].active", this.root), r = new Set(e);
89
- a(t, (e) => {
90
- let t = e.getAttribute("index") || "";
91
- r.has(t) || this.#r(e, (e, t) => {
92
- r.has(t) || e.classList.remove("active");
93
- });
94
- });
95
- }
96
- _toggleSubMenu(e, t) {
97
- let n = e.getAttribute("index") || "", r = i(".l-menu", e);
98
- if (r && t !== e.hasAttribute("expanded")) {
99
- if (this.#a(n), this.#t.set(n, { expand: t }), t) {
100
- e.setAttribute("expanded", ""), e.classList.remove("collapsed"), r.classList.add("l-menu--hide"), r.classList.remove("l-menu--collapsed"), r.style.removeProperty("height");
101
- let t = requestAnimationFrame(() => {
102
- this.#e.delete(n);
103
- let t = r.getBoundingClientRect();
104
- r.style.height = "0", r.classList.remove("l-menu--hide"), requestAnimationFrame(() => {
105
- e.hasAttribute("expanded") && (r.style.height = `${t.height}px`);
106
- });
107
- });
108
- this.#e.set(n, t);
109
- } else {
110
- e.removeAttribute("expanded");
111
- let t = r.getBoundingClientRect();
112
- r.style.height = `${t.height}px`, e.classList.add("collapsed");
113
- let i = requestAnimationFrame(() => {
114
- this.#e.delete(n), e.hasAttribute("expanded") || (r.style.height = "0");
115
- });
116
- this.#e.set(n, i);
117
- }
118
- this.#n.set(n, window.setTimeout(() => {
119
- this.#n.delete(n), this._onTransitionEnd({
120
- target: r,
121
- propertyName: "height"
122
- });
123
- }, l));
124
- }
125
- }
126
- #a(e) {
127
- let t = this.#n.get(e);
128
- t && (clearTimeout(t), this.#n.delete(e));
129
- let n = this.#e.get(e);
130
- n && (cancelAnimationFrame(n), this.#e.delete(e));
131
- }
132
- #o(e) {
133
- let t = e.parentElement;
134
- t && a(n(".l-menu-submenu[expanded]", t), (t) => {
135
- t !== e && this._toggleSubMenu(t, !1);
136
- });
137
- }
138
- _onTransitionEnd = (e) => {
139
- if (e.propertyName !== "height") return;
140
- let t = e.target;
141
- if (!t.classList.contains("l-menu")) return;
142
- let n = t.closest(".l-menu-submenu");
143
- if (!n) return;
144
- let r = n.getAttribute("index") || "", i = this.#n.get(r);
145
- i && (clearTimeout(i), this.#n.delete(r));
146
- let a = this.#t.get(r);
147
- if (a && a.expand !== n.hasAttribute("expanded")) {
148
- this.#t.delete(r);
149
- return;
150
- }
151
- this.#t.delete(r), t.style.removeProperty("height"), n.hasAttribute("expanded") || t.classList.add("l-menu--collapsed");
152
- };
153
- set items(e) {
154
- this._items = e, this._menuEl && this._menuEl.replaceChildren(this._renderItems());
155
- }
156
- get items() {
157
- return this._items;
158
- }
159
- _renderItems() {
160
- this._state.selectedIndex ? this._activeKeys = new Set(this.#s(this._items, this._state.selectedIndex)) : this._activeKeys = /* @__PURE__ */ new Set();
161
- let e = document.createDocumentFragment();
162
- for (let t = 0, n = this._items.length; t < n; t++) e.appendChild(this._renderItem(this._items[t], 0));
163
- return e;
164
- }
165
- _renderItem(e, t = 0) {
166
- return e.children && e.children.length > 0 ? this._renderSubMenu(e, t) : this._renderMenuItem(e);
167
- }
168
- _renderMenuItem(e) {
169
- let t = r("div", {
170
- class: ["l-menu-item", this._activeKeys.has(e.key) ? "active" : ""],
171
- index: e.key,
172
- "menu-role": "1"
173
- });
174
- if (e.icon) {
175
- let n = e.icon(e);
176
- n.setAttribute("slot", "icon");
177
- let i = r("span", { class: "l-menu-icon-wrap" });
178
- i.appendChild(n), t.appendChild(i);
179
- }
180
- return t.appendChild(this._renderTitle(e)), t;
181
- }
182
- _renderSubMenu(e, t) {
183
- let n = this._activeKeys.has(e.key), i = r("div", {
184
- index: e.key,
185
- class: ["l-menu-submenu", n ? "active" : void 0],
186
- "menu-role": "2"
187
- });
188
- n && i.setAttribute("expanded", ""), i.setAttribute("data-level", String(t));
189
- let a = r("div", { class: "l-submenu-title" });
190
- if (e.icon) {
191
- let t = e.icon(e), n = r("span", { class: "l-menu-icon-wrap" });
192
- n.appendChild(t), a.appendChild(n);
193
- }
194
- a.appendChild(this._renderTitle(e));
195
- let o = r("l-arrow-right-icon", { class: "l-submenu-arrow-icon" });
196
- if (a.appendChild(o), i.appendChild(a), e.children) {
197
- let a = r("div", { class: ["l-menu", n ? void 0 : "l-menu--collapsed"] });
198
- a.style.setProperty("--l-menu-level", String(t + 1));
199
- for (let n = 0, r = e.children.length; n < r; n++) a.appendChild(this._renderItem(e.children[n], t + 1));
200
- i.appendChild(a);
201
- }
202
- return i;
203
- }
204
- _renderTitle(e) {
205
- let t;
206
- return t = typeof e.label == "string" ? r("span", { textContent: e.label }) : e.label(e), t;
207
- }
208
- #s(e, t) {
209
- let n = (e, r) => {
210
- for (let i of e) {
211
- let e = [...r, i.key];
212
- if (t === i.key) return e;
213
- if (i.children) {
214
- let t = n(i.children, e);
215
- if (t.length > 0) return t;
216
- }
217
- }
218
- return [];
219
- };
220
- return n(e, []);
221
- }
222
- };
223
- //#endregion
224
- export { u as t };