litos-ui 0.23.0 → 0.24.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 (312) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +2 -2
  3. package/lib/base.d.ts +3 -2
  4. package/lib/base.js +11 -8
  5. package/lib/button/index.d.ts +21 -5
  6. package/lib/button/index.js +115 -62
  7. package/lib/button/index.less_inline.js +2 -3
  8. package/lib/button/style.js +1 -2
  9. package/lib/calendar/index.d.ts +1 -0
  10. package/lib/calendar/index.js +19 -17
  11. package/lib/calendar/index.less_inline.js +1 -2
  12. package/lib/calendar/langs.js +21 -11
  13. package/lib/card/index.js +8 -9
  14. package/lib/card/index.less_inline.js +1 -2
  15. package/lib/carousel/index.js +10 -11
  16. package/lib/carousel/index.less_inline.js +1 -2
  17. package/lib/carousel/item.js +1 -2
  18. package/lib/carousel/item.less_inline.js +1 -2
  19. package/lib/carousel/timer.js +1 -2
  20. package/lib/check/check.d.ts +40 -8
  21. package/lib/check/check.js +200 -65
  22. package/lib/check/check.less_inline.js +2 -3
  23. package/lib/check/checkbox.js +2 -3
  24. package/lib/check/checkbox.less_inline.js +2 -3
  25. package/lib/check/checkbox_group.js +1 -2
  26. package/lib/check/index.d.ts +28 -8
  27. package/lib/check/index.js +151 -46
  28. package/lib/check/index.less_inline.js +1 -2
  29. package/lib/check/radio.js +2 -3
  30. package/lib/check/radio.less_inline.js +1 -2
  31. package/lib/check/radio_group.js +2 -3
  32. package/lib/collapse/index.d.ts +12 -4
  33. package/lib/collapse/index.js +80 -46
  34. package/lib/collapse/index.less_inline.js +2 -3
  35. package/lib/collapse/item.d.ts +35 -9
  36. package/lib/collapse/item.js +219 -57
  37. package/lib/collapse/item.less_inline.js +2 -3
  38. package/lib/collapse/types.d.ts +17 -3
  39. package/lib/color_picker/index.d.ts +4 -2
  40. package/lib/color_picker/index.js +26 -17
  41. package/lib/color_picker/index.less_inline.js +1 -2
  42. package/lib/date_picker/index.d.ts +5 -1
  43. package/lib/date_picker/index.js +39 -23
  44. package/lib/date_picker/index.less_inline.js +1 -2
  45. package/lib/date_picker_ori/index.d.ts +7 -2
  46. package/lib/date_picker_ori/index.js +123 -47
  47. package/lib/date_picker_ori/index.less_inline.js +1 -2
  48. package/lib/description_panel/index.js +2 -10
  49. package/lib/description_panel/index.less_inline.js +1 -2
  50. package/lib/dialog/dialog_box.js +28 -29
  51. package/lib/dialog/dialog_container.css_inline.js +1 -2
  52. package/lib/dialog/dialog_container.js +13 -14
  53. package/lib/dialog/dialog_container_style.js +1 -2
  54. package/lib/dialog/index.d.ts +2 -0
  55. package/lib/dialog/index.js +11 -9
  56. package/lib/dropdown/index.d.ts +39 -0
  57. package/lib/dropdown/index.js +98 -0
  58. package/lib/entries/base.js +1 -2
  59. package/lib/entries/button.js +5 -6
  60. package/lib/entries/calendar.js +5 -6
  61. package/lib/entries/card.js +5 -6
  62. package/lib/entries/carousel-item.js +5 -6
  63. package/lib/entries/carousel.js +5 -6
  64. package/lib/entries/checkbox-group.js +5 -6
  65. package/lib/entries/checkbox.js +5 -6
  66. package/lib/entries/collapse-item.d.ts +0 -1
  67. package/lib/entries/collapse-item.js +6 -6
  68. package/lib/entries/collapse.d.ts +0 -1
  69. package/lib/entries/collapse.js +11 -6
  70. package/lib/entries/color-picker.js +5 -6
  71. package/lib/entries/date-picker-ori.js +5 -6
  72. package/lib/entries/date-picker.js +5 -6
  73. package/lib/entries/description-panel.js +5 -6
  74. package/lib/entries/dialog-box.js +1 -2
  75. package/lib/entries/dialog-container.js +5 -6
  76. package/lib/entries/dialog.js +1 -2
  77. package/lib/entries/dropdown.d.ts +2 -0
  78. package/lib/entries/dropdown.js +1 -0
  79. package/lib/entries/form-item.js +5 -6
  80. package/lib/entries/form.js +5 -6
  81. package/lib/entries/icon-arrow-down.js +5 -6
  82. package/lib/entries/icon-arrow-left.js +5 -6
  83. package/lib/entries/icon-arrow-right.js +5 -6
  84. package/lib/entries/icon-arrow-up.js +5 -6
  85. package/lib/entries/icon-base.js +5 -6
  86. package/lib/entries/icon-calendar.js +5 -6
  87. package/lib/entries/icon-caret-bottom.js +5 -6
  88. package/lib/entries/icon-caret-top.js +5 -6
  89. package/lib/entries/icon-close-filled.js +5 -6
  90. package/lib/entries/icon-close.js +5 -6
  91. package/lib/entries/icon-copy.js +5 -6
  92. package/lib/entries/icon-d-arrow-left.js +5 -6
  93. package/lib/entries/icon-d-arrow-right.js +5 -6
  94. package/lib/entries/icon-delete.js +5 -6
  95. package/lib/entries/icon-eye-outline.js +5 -6
  96. package/lib/entries/icon-font-icon.js +5 -6
  97. package/lib/entries/icon-info.js +5 -6
  98. package/lib/entries/icon-loading.js +5 -6
  99. package/lib/entries/icon-minus.js +5 -6
  100. package/lib/entries/icon-moon.js +5 -6
  101. package/lib/entries/icon-more.js +5 -6
  102. package/lib/entries/icon-picture.js +5 -6
  103. package/lib/entries/icon-plus.js +5 -6
  104. package/lib/entries/icon-reduction.js +5 -6
  105. package/lib/entries/icon-refresh-left.js +5 -6
  106. package/lib/entries/icon-refresh-right.js +5 -6
  107. package/lib/entries/icon-refresh.js +5 -6
  108. package/lib/entries/icon-search.js +5 -6
  109. package/lib/entries/icon-select.js +5 -6
  110. package/lib/entries/icon-sort.js +5 -6
  111. package/lib/entries/icon-success.js +5 -6
  112. package/lib/entries/icon-sun.js +5 -6
  113. package/lib/entries/icon-theme-default.js +5 -6
  114. package/lib/entries/icon-warn.js +5 -6
  115. package/lib/entries/icon-zoom-in.js +5 -6
  116. package/lib/entries/icon-zoom-out.js +5 -6
  117. package/lib/entries/image-preview.js +5 -6
  118. package/lib/entries/image.js +5 -6
  119. package/lib/entries/input-number.js +5 -6
  120. package/lib/entries/input.js +5 -6
  121. package/lib/entries/list.js +5 -6
  122. package/lib/entries/loading.js +1 -2
  123. package/lib/entries/mask.js +5 -6
  124. package/lib/entries/md-input.js +5 -6
  125. package/lib/entries/menu.js +5 -6
  126. package/lib/entries/message.js +1 -2
  127. package/lib/entries/modal-box.js +1 -2
  128. package/lib/entries/modal.js +5 -6
  129. package/lib/entries/notification-box.js +1 -2
  130. package/lib/entries/notification.js +1 -2
  131. package/lib/entries/page-header.js +5 -6
  132. package/lib/entries/pagination.js +5 -6
  133. package/lib/entries/polygon.js +5 -6
  134. package/lib/entries/popconfirm.js +1 -2
  135. package/lib/entries/popover.js +1 -2
  136. package/lib/entries/qrcode.js +5 -6
  137. package/lib/entries/radio-group.js +5 -6
  138. package/lib/entries/radio.js +5 -6
  139. package/lib/entries/select-ori.js +5 -6
  140. package/lib/entries/select.js +5 -6
  141. package/lib/entries/space.js +5 -6
  142. package/lib/entries/switch.js +5 -6
  143. package/lib/entries/tabbar-item.js +5 -6
  144. package/lib/entries/tabbar.js +5 -6
  145. package/lib/entries/table.js +5 -6
  146. package/lib/entries/tabs.js +1 -2
  147. package/lib/entries/tag.js +5 -6
  148. package/lib/entries/theme-color.js +5 -6
  149. package/lib/entries/theme.js +5 -6
  150. package/lib/entries/transition.js +1 -2
  151. package/lib/entries/upload.js +5 -6
  152. package/lib/entries/utils.js +1 -2
  153. package/lib/form/accessibility.d.ts +15 -0
  154. package/lib/form/accessibility.js +56 -0
  155. package/lib/form/autocomplete.d.ts +21 -0
  156. package/lib/form/autocomplete.js +59 -0
  157. package/lib/form/context.d.ts +157 -0
  158. package/lib/form/context.js +88 -0
  159. package/lib/form/form_inner.d.ts +99 -24
  160. package/lib/form/form_inner.js +424 -72
  161. package/lib/form/form_item.d.ts +35 -11
  162. package/lib/form/form_item.js +210 -78
  163. package/lib/form/form_item.less_inline.js +2 -3
  164. package/lib/form/form_item_style.d.ts +3 -0
  165. package/lib/form/form_item_style.js +7 -0
  166. package/lib/form/index.d.ts +69 -15
  167. package/lib/form/index.js +501 -101
  168. package/lib/form/index.less_inline.js +1 -2
  169. package/lib/form/owner.d.ts +78 -0
  170. package/lib/form/owner.js +138 -0
  171. package/lib/form/style.d.ts +3 -0
  172. package/lib/form/style.js +7 -0
  173. package/lib/icon/arrow_down.js +1 -2
  174. package/lib/icon/arrow_left.js +1 -2
  175. package/lib/icon/arrow_right.js +1 -2
  176. package/lib/icon/arrow_up.js +1 -2
  177. package/lib/icon/base.js +1 -2
  178. package/lib/icon/calendar.js +1 -2
  179. package/lib/icon/caret_bottom.js +1 -2
  180. package/lib/icon/caret_top.js +1 -2
  181. package/lib/icon/close.js +1 -2
  182. package/lib/icon/close_filled.js +1 -2
  183. package/lib/icon/copy.js +1 -2
  184. package/lib/icon/d_arrow_left.js +1 -2
  185. package/lib/icon/d_arrow_right.js +1 -2
  186. package/lib/icon/delete.js +1 -2
  187. package/lib/icon/eye_outline.js +1 -2
  188. package/lib/icon/font_icon.js +1 -2
  189. package/lib/icon/icon_style.js +1 -2
  190. package/lib/icon/index.less_inline.js +1 -2
  191. package/lib/icon/info.js +1 -2
  192. package/lib/icon/loading.js +1 -2
  193. package/lib/icon/minus.js +1 -2
  194. package/lib/icon/moon.js +1 -2
  195. package/lib/icon/more.js +1 -2
  196. package/lib/icon/picture.js +1 -2
  197. package/lib/icon/plus.js +1 -2
  198. package/lib/icon/reduction.js +1 -2
  199. package/lib/icon/refresh.js +1 -2
  200. package/lib/icon/refresh_left.js +1 -2
  201. package/lib/icon/refresh_right.js +1 -2
  202. package/lib/icon/search.js +1 -2
  203. package/lib/icon/select.js +1 -2
  204. package/lib/icon/sort.js +1 -2
  205. package/lib/icon/success.js +1 -2
  206. package/lib/icon/sun.js +1 -2
  207. package/lib/icon/theme_default.js +1 -2
  208. package/lib/icon/warn.js +1 -2
  209. package/lib/icon/zoom_in.js +1 -2
  210. package/lib/icon/zoom_out.js +1 -2
  211. package/lib/image/image_preview.js +1 -2
  212. package/lib/image/image_preview.less_inline.js +1 -2
  213. package/lib/image/index.js +1 -2
  214. package/lib/image/index.less_inline.js +1 -2
  215. package/lib/index.d.ts +2 -1
  216. package/lib/index.js +88 -87
  217. package/lib/input/index.d.ts +18 -1
  218. package/lib/input/index.js +151 -48
  219. package/lib/input/index.less_inline.js +2 -3
  220. package/lib/input/input_inner.less_inline.js +1 -2
  221. package/lib/input/style.d.ts +3 -0
  222. package/lib/input/style.js +7 -0
  223. package/lib/input_number/index.d.ts +7 -0
  224. package/lib/input_number/index.js +70 -48
  225. package/lib/input_number/index.less_inline.js +1 -2
  226. package/lib/input_number/style.js +1 -2
  227. package/lib/list/index.js +4 -5
  228. package/lib/list/index.less_inline.js +1 -2
  229. package/lib/loading/index.js +1 -2
  230. package/lib/mask/index.js +2 -7
  231. package/lib/mask/index.less_inline.js +1 -2
  232. package/lib/md_input/index.d.ts +11 -2
  233. package/lib/md_input/index.js +63 -27
  234. package/lib/md_input/index.less_inline.js +2 -3
  235. package/lib/menu/index.js +2 -7
  236. package/lib/menu/index.less_inline.js +1 -2
  237. package/lib/message/index.js +1 -2
  238. package/lib/modal/index.js +15 -16
  239. package/lib/modal/index.less_inline.js +1 -2
  240. package/lib/modal/modal_box.js +24 -25
  241. package/lib/notification/index.js +15 -29
  242. package/lib/notification/index.less_inline.js +1 -2
  243. package/lib/notification/notification_box.js +2 -3
  244. package/lib/notification/placement.js +1 -2
  245. package/lib/notification/style.js +1 -2
  246. package/lib/page_header/index.js +1 -2
  247. package/lib/page_header/index.less_inline.js +1 -2
  248. package/lib/pagination/index.js +26 -25
  249. package/lib/pagination/index.less_inline.js +2 -3
  250. package/lib/polygon/index.js +1 -2
  251. package/lib/polygon/index.less_inline.js +1 -2
  252. package/lib/qrcode/index.js +1 -2
  253. package/lib/qrcode/index.less_inline.js +1 -2
  254. package/lib/select/index.d.ts +21 -2
  255. package/lib/select/index.js +138 -77
  256. package/lib/select/index.less_inline.js +1 -2
  257. package/lib/select_ori/index.d.ts +9 -1
  258. package/lib/select_ori/index.js +36 -24
  259. package/lib/select_ori/index.less_inline.js +1 -2
  260. package/lib/space/index.js +1 -2
  261. package/lib/space/index.less_inline.js +1 -2
  262. package/lib/styles/animation/index.css_inline.js +1 -2
  263. package/lib/styles/animation/index.js +1 -2
  264. package/lib/styles/mask/index.css_inline.js +1 -2
  265. package/lib/styles/mask/index.js +1 -2
  266. package/lib/switch/index.d.ts +6 -0
  267. package/lib/switch/index.js +31 -16
  268. package/lib/switch/index.less_inline.js +1 -2
  269. package/lib/tabbar/index.js +1 -2
  270. package/lib/tabbar/index.less_inline.js +1 -2
  271. package/lib/tabbar/item.js +1 -2
  272. package/lib/tabbar/item.less_inline.js +1 -2
  273. package/lib/table/index.d.ts +2 -0
  274. package/lib/table/index.js +12 -4
  275. package/lib/table/index.less_inline.js +1 -2
  276. package/lib/tabs/index.js +1 -2
  277. package/lib/tag/index.d.ts +11 -3
  278. package/lib/tag/index.js +25 -24
  279. package/lib/tag/index.less_inline.js +2 -3
  280. package/lib/theme/appearance.d.ts +5 -0
  281. package/lib/theme/appearance.js +34 -0
  282. package/lib/theme/index.js +83 -39
  283. package/lib/theme/index.less_inline.js +1 -2
  284. package/lib/theme/theme_color.js +1 -2
  285. package/lib/upload/index.js +28 -41
  286. package/lib/upload/index.less_inline.js +2 -3
  287. package/lib/upload/style.js +1 -2
  288. package/lib/utils/clickoutside.js +1 -2
  289. package/lib/utils/event.js +1 -2
  290. package/lib/utils/index.d.ts +27 -5
  291. package/lib/utils/index.js +43 -22
  292. package/lib/utils/popover.js +7 -16
  293. package/lib/utils/transition.js +1 -2
  294. package/package.json +16 -13
  295. package/styles/dark.css +10 -2
  296. package/styles/dropdown.css +46 -0
  297. package/styles/reset.css +0 -1
  298. package/styles/select.css +5 -0
  299. package/styles/themes/apple.css +47 -0
  300. package/styles/{theme-coral.css → themes/coral.css} +5 -3
  301. package/styles/themes/deep-sea-blue.css +12 -0
  302. package/styles/themes/gamboge.css +15 -0
  303. package/styles/{theme-jade.css → themes/jade.css} +5 -3
  304. package/styles/themes/lotus-seed.css +12 -0
  305. package/styles/{theme-tangerine.css → themes/tangerine.css} +5 -3
  306. package/styles/themes.css +8 -0
  307. package/styles/vars.css +8 -2
  308. package/types/preact.d.ts +43 -0
  309. package/lib/form/types.d.ts +0 -7
  310. package/lib/utils/context_provide.d.ts +0 -10
  311. package/lib/utils/context_provide.js +0 -22
  312. package/lib/utils/signal_types.d.ts +0 -5
@@ -2,11 +2,18 @@ import FormInner from "../form/form_inner";
2
2
  type Option = {
3
3
  label: string;
4
4
  value: string;
5
+ defaultSelected?: boolean;
6
+ disabled?: boolean;
5
7
  };
6
8
  export default class SelectOri extends FormInner {
7
9
  static baseName: string;
10
+ static get observedAttributes(): string[];
8
11
  private $select?;
12
+ private optionsMarkup?;
13
+ private requestedValue;
9
14
  constructor();
15
+ protected get intrinsicDefaultValue(): string;
16
+ protected serializeFormValue(): string | null;
10
17
  connectedCallback(): void;
11
18
  disconnectedCallback(): void;
12
19
  render_v2(): {
@@ -15,9 +22,10 @@ export default class SelectOri extends FormInner {
15
22
  };
16
23
  render(): string;
17
24
  protected disabledChange(): void;
25
+ private createOption;
26
+ private syncOptionsValue;
18
27
  setOptions(options: Option[]): void;
19
28
  appendOptions(options: Option[]): void;
20
- reset(): void;
21
29
  setValue(value: any): void;
22
30
  private _handleChange;
23
31
  }
@@ -1,20 +1,33 @@
1
- import { tagAttrs as e } from "../utils/index.js";
2
- import t from "../form/form_inner.js";
1
+ import e from "../form/form_inner.js";
2
+ import { tagAttrs as t } from "../utils/index.js";
3
3
  import n from "../input/input_inner.less_inline.js";
4
4
  import r from "./index.less_inline.js";
5
5
  import { $one as i, off as a, on as o } from "utilane/browser";
6
- //#region src/components/select_ori/index.ts
7
- var s = class extends t {
6
+ // src/components/select_ori/index.ts
7
+ var s = class extends e {
8
8
  static baseName = "select-ori";
9
+ static get observedAttributes() {
10
+ return [...new Set(e.observedAttributes)];
11
+ }
9
12
  $select;
13
+ optionsMarkup;
14
+ requestedValue = "";
10
15
  constructor() {
11
16
  super(), this.version = 2;
12
17
  }
18
+ get intrinsicDefaultValue() {
19
+ let e = document.createElement("select");
20
+ return e.innerHTML = this.$select?.innerHTML ?? this.optionsMarkup ?? this.innerHTML, e.value;
21
+ }
22
+ serializeFormValue() {
23
+ let e = this.$select?.selectedOptions[0];
24
+ return !e || e.disabled || e.closest("optgroup")?.disabled ? null : e.value;
25
+ }
13
26
  connectedCallback() {
14
- super.connectedCallback(), this.$select = i("select", this.root), this.value && (this.$select.value = this.value), o(this.$select, "change", this._handleChange);
27
+ super.connectedCallback(), this.$select = i("select", this.root), this.syncOptionsValue(), o(this.$select, "change", this._handleChange);
15
28
  }
16
29
  disconnectedCallback() {
17
- super.disconnectedCallback(), this.$select && a(this.$select, "change", this._handleChange), this.$select = void 0;
30
+ this.optionsMarkup = this.$select?.innerHTML ?? this.optionsMarkup, super.disconnectedCallback(), this.$select && a(this.$select, "change", this._handleChange), this.$select = void 0;
18
31
  }
19
32
  render_v2() {
20
33
  return {
@@ -23,36 +36,35 @@ var s = class extends t {
23
36
  };
24
37
  }
25
38
  render() {
26
- let t = this.innerHTML.trim();
27
- return `<select class="l-input__inner"${e([["name", this.getName()], ["disabled", this.isDisabled()]])}>${t}</select>`;
39
+ let e = this.optionsMarkup ?? this.innerHTML.trim();
40
+ return `<select class="l-input__inner"${t([["disabled", this.isDisabled()]])}>${e}</select>`;
28
41
  }
29
42
  disabledChange() {
30
43
  this.$select && (this.$select.disabled = this.isDisabled());
31
44
  }
45
+ createOption(e) {
46
+ let t = document.createElement("option");
47
+ return t.value = e.value, t.textContent = e.label, t.defaultSelected = e.defaultSelected ?? !1, t.disabled = e.disabled ?? !1, t;
48
+ }
49
+ syncOptionsValue() {
50
+ this.$select && (this.dirtyValue ? this.setValue(this.requestedValue) : this.applyDefaultValue());
51
+ }
32
52
  setOptions(e) {
33
- if (!this.$select) return;
34
- let t = e.map((e) => `<option value="${e.value}">${e.label}</option>`);
35
- this.$select.innerHTML = t.join("");
53
+ let t = this.$select ?? this.ownerDocument.createElement("select");
54
+ t.replaceChildren(...e.map((e) => this.createOption(e))), this.optionsMarkup = t.innerHTML, this.syncOptionsValue();
36
55
  }
37
56
  appendOptions(e) {
38
- if (!this.$select) return;
39
- let t = document.createDocumentFragment();
40
- for (let n = 0, r = e.length; n < r; n++) {
41
- let r = e[n], i = document.createElement("option");
42
- i.value = r.value, i.innerHTML = r.label, t.appendChild(i);
43
- }
44
- this.$select.appendChild(t);
45
- }
46
- reset() {
47
- super.reset(), this.$select && (this.$select.value = this.value);
57
+ let t = this.$select ?? this.ownerDocument.createElement("select");
58
+ this.$select || (t.innerHTML = this.optionsMarkup ?? this.innerHTML), t.append(...e.map((e) => this.createOption(e))), this.optionsMarkup = t.innerHTML, this.syncOptionsValue();
48
59
  }
49
60
  setValue(e) {
50
- super.setValue(e), this.$select && (this.$select.value = this.value);
61
+ let t = String(e ?? "");
62
+ this.requestedValue = t, this.$select && (this.$select.value = t), super.setValue(this.$select?.value ?? t);
51
63
  }
52
64
  _handleChange = (e) => {
65
+ e.stopPropagation();
53
66
  let t = e.target.value;
54
- super.setValue(t), this.emit("change", { detail: t });
67
+ this.requestedValue = t, super.setValue(t), this.validateInput(), this.emit("change", { detail: t });
55
68
  };
56
69
  };
57
- //#endregion
58
70
  export { s as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/select_ori/index.less?inline
1
+ // src/components/select_ori/index.less?inline
2
2
  var e = ":host{height:var(--l-form-control-height,32px);display:inline-flex}.l-input__inner{border:1px solid var(--l-border-color,#dedede);border-radius:var(--l-border-radius,3px);transition:border-color .3s}.l-input__inner:hover{border-color:var(--l-primary-color-light1,#c6c6c6)}.l-input__inner:focus{border-color:var(--l-primary-color,#1890ff);box-shadow:0 0 0 3px var(--l-primary-color-light5)}";
3
- //#endregion
4
3
  export { e as default };
@@ -2,7 +2,7 @@ import e from "../base.js";
2
2
  import { kebabToCamel as t, parseAttrValue as n } from "../utils/index.js";
3
3
  import r from "./index.less_inline.js";
4
4
  import { isNumeric as i } from "utilane";
5
- //#region src/components/space/index.ts
5
+ // src/components/space/index.ts
6
6
  var a = class extends e {
7
7
  static baseName = "space";
8
8
  connectedCallback() {
@@ -36,5 +36,4 @@ var a = class extends e {
36
36
  return "<slot></slot>";
37
37
  }
38
38
  };
39
- //#endregion
40
39
  export { a as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/space/index.less?inline
1
+ // src/components/space/index.less?inline
2
2
  var e = ":host{box-sizing:border-box;display:var(--l-space-display,flex);align-items:var(--l-space-align,center);justify-content:var(--l-space-justify,flex-start);gap:var(--l-space-gap,10px);flex-wrap:var(--l-space-wrap,nowrap);flex-direction:var(--l-space-direction,row)}";
3
- //#endregion
4
3
  export { e as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/styles/animation/index.css?inline
1
+ // src/components/styles/animation/index.css?inline
2
2
  var e = "@keyframes l-rotate-frame{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.l-rotate-anim{animation:1.5s linear infinite l-rotate-frame}";
3
- //#endregion
4
3
  export { e as default };
@@ -1,8 +1,7 @@
1
1
  import e from "./index.css_inline.js";
2
- //#region src/components/styles/animation/index.ts
2
+ // src/components/styles/animation/index.ts
3
3
  var t = /* @__PURE__ */ (() => {
4
4
  let t = new CSSStyleSheet();
5
5
  return t.replaceSync(e), t;
6
6
  })();
7
- //#endregion
8
7
  export { t as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/styles/mask/index.css?inline
1
+ // src/components/styles/mask/index.css?inline
2
2
  var e = ".l-mask{z-index:var(--l-mask-zindex,100);opacity:1;background-color:#0009;transition:opacity .3s;position:fixed;inset:0}";
3
- //#endregion
4
3
  export { e as default };
@@ -1,8 +1,7 @@
1
1
  import e from "./index.css_inline.js";
2
- //#region src/components/styles/mask/index.ts
2
+ // src/components/styles/mask/index.ts
3
3
  var t = /* @__PURE__ */ (() => {
4
4
  let t = new CSSStyleSheet();
5
5
  return t.replaceSync(e), t;
6
6
  })();
7
- //#endregion
8
7
  export { t as default };
@@ -5,6 +5,11 @@ type ActionRenderFn = (cfg: {
5
5
  export default class Switch extends FormInner {
6
6
  #private;
7
7
  static baseName: string;
8
+ static get observedAttributes(): string[];
9
+ protected _ignoreInitAttrs: string[];
10
+ protected get intrinsicDefaultValue(): boolean;
11
+ protected parseDefaultValue(value: string | null): boolean;
12
+ protected formatDefaultValue(value: any): string;
8
13
  actionRender?: ActionRenderFn;
9
14
  checkedText?: string;
10
15
  uncheckedText?: string;
@@ -12,6 +17,7 @@ export default class Switch extends FormInner {
12
17
  disconnectedCallback(): void;
13
18
  render(): string;
14
19
  setValue(value: boolean): void;
20
+ protected disabledChange(): void;
15
21
  setActionRender(render: ActionRenderFn): void;
16
22
  }
17
23
  export {};
@@ -1,18 +1,31 @@
1
- import { initAttr as e } from "../utils/index.js";
2
- import t from "../form/form_inner.js";
3
- import n from "./index.less_inline.js";
4
- import { $one as r, addClass as i, off as a, on as o, removeClass as s } from "utilane/browser";
5
- //#region src/components/switch/index.ts
6
- var c = class extends t {
1
+ import e from "../form/form_inner.js";
2
+ import { initAttr as t, parseAttrValue as n } from "../utils/index.js";
3
+ import r from "./index.less_inline.js";
4
+ import { $one as i, addClass as a, off as o, on as s, removeClass as c } from "utilane/browser";
5
+ // src/components/switch/index.ts
6
+ var l = class extends e {
7
7
  static baseName = "switch";
8
+ static get observedAttributes() {
9
+ return [...new Set(e.observedAttributes)];
10
+ }
11
+ _ignoreInitAttrs = ["value"];
12
+ get intrinsicDefaultValue() {
13
+ return !1;
14
+ }
15
+ parseDefaultValue(e) {
16
+ return e === null ? this.intrinsicDefaultValue : n(e, !1, "value");
17
+ }
18
+ formatDefaultValue(e) {
19
+ return String(typeof e == "string" ? n(e, !1, "value") : !!e);
20
+ }
8
21
  actionRender;
9
22
  checkedText;
10
23
  uncheckedText;
11
24
  connectedCallback() {
12
- e(this), this.loadStyleText(n), super.connectedCallback(), this.pushValueChange(), this.#t(), o(this, "click", this.#e);
25
+ t(this), this.loadStyleText(r), super.connectedCallback(), this.#t(), s(this, "click", this.#e);
13
26
  }
14
27
  disconnectedCallback() {
15
- super.disconnectedCallback(), a(this, "click", this.#e), this.actionRender = void 0;
28
+ super.disconnectedCallback(), o(this, "click", this.#e), this.actionRender = void 0;
16
29
  }
17
30
  render() {
18
31
  this.isDisabled() && this.classList.add("l-switch--disabled"), this.value && this.classList.add("l-switch--checked");
@@ -24,28 +37,30 @@ var c = class extends t {
24
37
  return e.join("");
25
38
  }
26
39
  #e = (e) => {
27
- this.isDisabled() || (this.setValue(!this.value), this.emit("change"));
40
+ this.isDisabled() || (this.setValue(!this.value), this.validateInput(), this.emit("change"));
28
41
  };
29
42
  setValue(e) {
30
- super.setValue(e), e ? i(this, "l-switch--checked") : s(this, "l-switch--checked");
31
- let t = r(".l-switch-text", this.root);
43
+ e = typeof e == "string" ? n(e, !1, "value") : !!e, super.setValue(e), e ? a(this, "l-switch--checked") : c(this, "l-switch--checked");
44
+ let t = i(".l-switch-text", this.root);
32
45
  t && (t.textContent = this.value ? this.checkedText || "" : this.uncheckedText || ""), this.#t();
33
46
  }
47
+ disabledChange() {
48
+ this.classList.toggle("l-switch--disabled", this.isDisabled()), this.setAttribute("aria-disabled", String(this.isDisabled()));
49
+ }
34
50
  setActionRender(e) {
35
51
  this.actionRender = e, this.#t();
36
52
  }
37
53
  #t() {
38
- let e = r(".l-switch-action", this.root);
54
+ let e = i(".l-switch-action", this.root);
39
55
  if (e) {
40
56
  if (this.actionRender) {
41
57
  let t = this.actionRender({ checked: this.value });
42
58
  e.innerHTML = typeof t == "string" ? t : t.outerHTML;
43
59
  } else {
44
- let t = r("[slot=\"checked-action\"]", this), n = r("[slot=\"unchecked-action\"]", this);
45
- this.value && t ? e.innerHTML = "<slot name=\"checked-action\"></slot>" : !this.value && n && (e.innerHTML = "<slot name=\"unchecked-action\"></slot>");
60
+ let t = i("[slot=\"checked-action\"]", this), n = i("[slot=\"unchecked-action\"]", this);
61
+ e.innerHTML = this.value && t ? "<slot name=\"checked-action\"></slot>" : !this.value && n ? "<slot name=\"unchecked-action\"></slot>" : "";
46
62
  }
47
63
  }
48
64
  }
49
65
  };
50
- //#endregion
51
- export { c as default };
66
+ export { l as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/switch/index.less?inline
1
+ // src/components/switch/index.less?inline
2
2
  var e = ":host{box-sizing:border-box;--l-switch-height:22px;--l-switch-width:40px;width:auto;width:var(--l-switch-width);height:var(--l-switch-height);border-radius:calc(var(--l-switch-height) / 2);cursor:pointer;vertical-align:middle;background-color:#dcdfe6;border:1px solid #c2c2c2;justify-content:flex-start;align-items:center;padding:2px;transition:all .3s ease-in-out;display:inline-flex;position:relative}: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{width:calc(var(--l-switch-height) - 6px);box-sizing:border-box;background-color:#fff;border-radius:50%;justify-content:center;align-items:center;padding:2px;font-size:12px;transition:all .3s ease-in-out;display:flex;position:absolute;top:2px;bottom:2px;left:2px}.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}";
3
- //#endregion
4
3
  export { e as default };
@@ -3,7 +3,7 @@ import { parseAttrValue as t } from "../utils/index.js";
3
3
  import n from "./index.less_inline.js";
4
4
  import { $$ as r, $one as i, addClass as a, create as o, isVisible as s, off as c, on as l, removeClass as u, shouldEventNext as d } from "utilane/browser";
5
5
  import { isBlank as f, isNumeric as p } from "utilane";
6
- //#region src/components/tabbar/index.ts
6
+ // src/components/tabbar/index.ts
7
7
  var m = class extends e {
8
8
  static baseName = "tabbar";
9
9
  type = "nav";
@@ -93,5 +93,4 @@ var m = class extends e {
93
93
  }
94
94
  }
95
95
  };
96
- //#endregion
97
96
  export { m as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/tabbar/index.less?inline
1
+ // src/components/tabbar/index.less?inline
2
2
  var e = ":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;height:var(--l-tabbar-height);align-items:stretch;gap:var(--l-tabbar-item-gap);box-sizing:border-box;background-color:#fff;flex-wrap:nowrap;display:flex;position:relative;overflow:hidden}:host(.l-tabbar--nav){--l-tabbar-height:50px;--l-tabbar-item-grow:1;width:100%}:host(.l-tabbar--bar){--l-tabbar-bar-vertical-padding:10px;--l-tabbar-item-gap:30px;--l-tabbar-line-color:var(--l-primary-color,#722ed1);white-space:nowrap;overflow:auto}.l-tabbar--bar-line{background-color:var(--l-tabbar-line-color);border-radius:1px;width:32px;height:2px;transition:all .3s ease-in-out;position:absolute;bottom:0;left:0}: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{background-color:var(--l-tabbar-card-border-color);height:1px;position:absolute;bottom:0;left:0;right:0}";
3
- //#endregion
4
3
  export { e as default };
@@ -2,7 +2,7 @@ import e from "../base.js";
2
2
  import { parseAttrValue as t } from "../utils/index.js";
3
3
  import n from "./item.less_inline.js";
4
4
  import { $$ as r, $one as i, addClass as a, removeClass as o } from "utilane/browser";
5
- //#region src/components/tabbar/item.ts
5
+ // src/components/tabbar/item.ts
6
6
  var s = class extends e {
7
7
  static baseName = "tabbar-item";
8
8
  name;
@@ -57,5 +57,4 @@ var s = class extends e {
57
57
  return e;
58
58
  }
59
59
  };
60
- //#endregion
61
60
  export { s as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/tabbar/item.less?inline
1
+ // src/components/tabbar/item.less?inline
2
2
  var e = ":host{color:#666;cursor:pointer;flex-direction:column;flex-grow:var(--l-tabbar-item-grow,0);box-sizing:border-box;justify-content:center;align-items:center;line-height:1;transition:all .3s ease-in-out;display:inline-flex}:host(:hover){color:var(--l-tabbar-hover-color)}:host(.active){color:var(--l-tabbar-active-color)}.icon-wrapper{justify-content:center;align-items:center;margin-bottom:3px;font-size:18px;display:flex}.icon-wrapper.only{margin-bottom:0;font-size:24px}:host(.l-item--card){background:#f5f7fa;border:1px solid #f0f0f0;padding:0 15px}:host(.l-item--card:first-child){border-top-left-radius:var(--l-tabbar-card-border-radius)}:host(.l-item--card:last-child){border-top-right-radius:var(--l-tabbar-card-border-radius)}:host(.l-item--card.active){background:#fff}:host(.l-item--gap){border-top-left-radius:var(--l-tabbar-card-border-radius);border-top-right-radius:var(--l-tabbar-card-border-radius)}";
3
- //#endregion
4
3
  export { e as default };
@@ -5,6 +5,8 @@ type ChangeFixedParams = {
5
5
  fixedHead?: boolean;
6
6
  };
7
7
  type TableState = {
8
+ /** 无数据时的提示文案 */
9
+ emptyText: string;
8
10
  /** 斑马纹 */
9
11
  stripe: boolean;
10
12
  /** 是否显示四周边框 */
@@ -3,11 +3,12 @@ import { kebabToCamel as t, parseAttrValue as n } from "../utils/index.js";
3
3
  import r from "./index.less_inline.js";
4
4
  import { $$ as i, $one as a, formatStyle as o, iterate as s, off as c, on as l, shouldEventNext as u } from "utilane/browser";
5
5
  import { random as d } from "utilane";
6
- //#region src/components/table/index.ts
6
+ // src/components/table/index.ts
7
7
  var f = class extends e {
8
8
  static baseName = "table";
9
9
  constructor() {
10
10
  super(), this._state = {
11
+ emptyText: "暂无数据",
11
12
  stripe: !0,
12
13
  border: !1,
13
14
  fixedHead: !1,
@@ -44,12 +45,16 @@ var f = class extends e {
44
45
  "border",
45
46
  "fixed-head",
46
47
  "max-height",
47
- "table-layout"
48
+ "table-layout",
49
+ "empty-text"
48
50
  ];
49
51
  }
50
52
  attributeChanged(e, r, i) {
51
53
  let a = t(e);
52
54
  switch (a) {
55
+ case "emptyText":
56
+ this._state.emptyText = i ?? "暂无数据";
57
+ break;
53
58
  case "stripe":
54
59
  case "border":
55
60
  case "fixedHead":
@@ -63,6 +68,10 @@ var f = class extends e {
63
68
  }
64
69
  }
65
70
  updateDOM(e) {
71
+ if (e.has("empty-text")) {
72
+ let e = a(".l-table__empty-col", this.root);
73
+ e && (e.textContent = this._state.emptyText);
74
+ }
66
75
  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);
67
76
  }
68
77
  render() {
@@ -142,7 +151,7 @@ var f = class extends e {
142
151
  else {
143
152
  let t = i("tr"), n = i("td", {
144
153
  class: "l-table__empty-col",
145
- textContent: "暂无数据"
154
+ textContent: this._state.emptyText
146
155
  });
147
156
  this.columns && (n.colSpan = this.columns.length), t.appendChild(n), e.appendChild(t);
148
157
  }
@@ -230,5 +239,4 @@ var f = class extends e {
230
239
  });
231
240
  }
232
241
  };
233
- //#endregion
234
242
  export { f as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/table/index.less?inline
1
+ // src/components/table/index.less?inline
2
2
  var e = ":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)}";
3
- //#endregion
4
3
  export { e as default };
package/lib/tabs/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as e, $one as t, iterate as n, off as r, on as i } from "utilane/browser";
2
- //#region src/components/tabs/index.ts
2
+ // src/components/tabs/index.ts
3
3
  function a() {
4
4
  let a = e(".l-tabs");
5
5
  function o(e) {
@@ -37,5 +37,4 @@ function a() {
37
37
  return { destroy: s };
38
38
  }
39
39
  var o = { init: a };
40
- //#endregion
41
40
  export { o as default };
@@ -1,13 +1,21 @@
1
1
  import BaseComponent from "../base";
2
- export default class Tag extends BaseComponent {
2
+ import type { TagColor } from "../utils";
3
+ type TagState = {
4
+ color?: TagColor;
5
+ };
6
+ export default class Tag extends BaseComponent<TagState> {
3
7
  #private;
4
8
  static baseName: string;
9
+ get color(): TagColor | undefined;
10
+ set color(value: TagColor | undefined);
11
+ /** 替换颜色变量,传入 undefined 或空对象恢复默认配色。 */
12
+ setColor(value?: TagColor): void;
5
13
  connectedCallback(): void;
6
14
  static get observedAttributes(): string[];
7
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
15
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
8
16
  render(): DocumentFragment;
9
17
  afterInit(): void;
10
18
  _toggleTypeClass(type: string): void;
11
- _toggleColorStyle(color?: string | null): void;
12
19
  beforeDestroy(): void;
13
20
  }
21
+ export {};
package/lib/tag/index.js CHANGED
@@ -1,33 +1,38 @@
1
1
  import e from "../base.js";
2
2
  import { parseAttrValue as t } from "../utils/index.js";
3
3
  import n from "./index.less_inline.js";
4
- import { $$ as r, $one as i, off as a, on as o, shouldEventNext as s } from "utilane/browser";
5
- import { adjust as c, isBlank as l } from "utilane";
6
- //#region src/components/tag/index.ts
7
- var u = class extends e {
4
+ import { $$ as r, $one as i, formatStyle as a, off as o, on as s, shouldEventNext as c } from "utilane/browser";
5
+ // src/components/tag/index.ts
6
+ var l = class extends e {
8
7
  static baseName = "tag";
8
+ get color() {
9
+ return this._state.color;
10
+ }
11
+ set color(e) {
12
+ this.setColor(e);
13
+ }
14
+ setColor(e) {
15
+ let t = this._state.color;
16
+ this._state.color = e;
17
+ for (let e of Object.keys(t || {})) this.style.removeProperty(e);
18
+ let n = a(e || {});
19
+ n && (this.style.cssText += n);
20
+ }
9
21
  connectedCallback() {
10
22
  this.loadStyleText(n), super.connectedCallback();
11
23
  }
12
24
  static get observedAttributes() {
13
- return [
14
- "type",
15
- "color",
16
- "closeable"
17
- ];
25
+ return ["type", "closeable"];
18
26
  }
19
27
  attributeChangedCallback(e, n, r) {
20
- let a = r.trim();
28
+ let a = r?.trim() ?? "";
21
29
  switch (e) {
22
30
  case "type":
23
- this._toggleTypeClass(a);
31
+ this._toggleTypeClass(a || "info");
24
32
  break;
25
- case "color":
26
- this._toggleColorStyle(a);
27
- break;
28
- case "closable":
33
+ case "closeable":
29
34
  if (!this.rendered) return;
30
- let e = t(a, !1, "closeable"), n = i(".l-tag-close", this.root);
35
+ let e = r !== null && t(a, !1, "closeable"), n = i(".l-tag-close", this.root);
31
36
  if (n) {
32
37
  if (e) return;
33
38
  n.remove();
@@ -49,11 +54,11 @@ var u = class extends e {
49
54
  });
50
55
  }
51
56
  #t = (e) => {
52
- let [t, n, r] = s(e, "data-action", this);
57
+ let [t, n, r] = c(e, "data-action", this);
53
58
  t && n === "close" && this.emit("close", { detail: { ...r.dataset } });
54
59
  };
55
60
  afterInit() {
56
- this.classList.add(`l-tag--${this.getAttr("type", "info")}`), this._toggleColorStyle(), o(this.root, "click", this.#t);
61
+ this._toggleTypeClass(this.getAttr("type", "info") || "info"), s(this.root, "click", this.#t);
57
62
  }
58
63
  _toggleTypeClass(e) {
59
64
  if (!this.rendered) return;
@@ -64,12 +69,8 @@ var u = class extends e {
64
69
  }
65
70
  t || this.classList.add(`l-tag--${e}`);
66
71
  }
67
- _toggleColorStyle(e) {
68
- this.rendered && (l(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))));
69
- }
70
72
  beforeDestroy() {
71
- a(this.root, "click", this.#t);
73
+ o(this.root, "click", this.#t);
72
74
  }
73
75
  };
74
- //#endregion
75
- export { u as default };
76
+ export { l as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/tag/index.less?inline
2
- var e = ":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-text-color,#999);--l-tag-background:var(--l-text-secondary-color,#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}";
3
- //#endregion
1
+ // src/components/tag/index.less?inline
2
+ var e = ":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-text-color,#595959);--l-tag-background:var(--l-fill-secondary-color,#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}";
4
3
  export { e as default };
@@ -0,0 +1,5 @@
1
+ export type ThemeMode = "auto" | "light" | "dark";
2
+ type ThemeListener = (mode: string) => void;
3
+ export declare function observeTheme(document: Document, listener: ThemeListener): () => void;
4
+ export declare function applyThemeMode(document: Document, mode: ThemeMode): Promise<void>;
5
+ export {};
@@ -0,0 +1,34 @@
1
+ import { applyTheme as e, getTheme as t } from "utilane/browser";
2
+ // src/components/theme/appearance.ts
3
+ var n = /* @__PURE__ */ new WeakMap();
4
+ function r(e) {
5
+ let r = n.get(e);
6
+ if (!r) return;
7
+ let i = t();
8
+ if (r.mode !== i) {
9
+ r.mode = i;
10
+ for (let e of r.listeners) e(i);
11
+ }
12
+ }
13
+ function i(e, i) {
14
+ let a = n.get(e);
15
+ if (!a) {
16
+ let i = new MutationObserver(() => r(e));
17
+ i.observe(e.documentElement, {
18
+ attributes: !0,
19
+ attributeFilter: ["class"]
20
+ }), a = {
21
+ mode: t(),
22
+ listeners: /* @__PURE__ */ new Set(),
23
+ observer: i
24
+ }, n.set(e, a);
25
+ }
26
+ let { listeners: o, observer: s } = a;
27
+ return o.add(i), () => {
28
+ o.delete(i), o.size || (s.disconnect(), n.delete(e));
29
+ };
30
+ }
31
+ async function a(t, n) {
32
+ await e(n, !0, !1), r(t);
33
+ }
34
+ export { a as applyThemeMode, i as observeTheme };