litos-ui 0.19.0 → 0.20.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.
Files changed (155) hide show
  1. package/lib/{animation-DStAHzod.js → animation-Bo4jbSGK.js} +4 -3
  2. package/lib/{base-LvfO4mmL.js → base-Dyj1rzaK.js} +11 -12
  3. package/lib/base.d.ts +5 -4
  4. package/lib/base.js +19 -15
  5. package/lib/button/index.d.ts +2 -2
  6. package/lib/button/index.js +152 -2
  7. package/lib/button/style.d.ts +2 -0
  8. package/lib/button/style.js +2 -0
  9. package/lib/calendar/index.d.ts +2 -2
  10. package/lib/calendar/index.js +1 -1
  11. package/lib/{calendar-Clbg3qot.js → calendar-CvlUsN6w.js} +20 -23
  12. package/lib/card/index.d.ts +23 -0
  13. package/lib/card/index.js +2 -0
  14. package/lib/card-3DM-lJQV.js +63 -0
  15. package/lib/carousel/index.js +1 -1
  16. package/lib/carousel/item.js +1 -1
  17. package/lib/{carousel-Dgirxwzb.js → carousel-DvkZ1YXq.js} +23 -19
  18. package/lib/check/checkbox.js +1 -1
  19. package/lib/check/checkbox_group.js +1 -1
  20. package/lib/check/radio.js +1 -1
  21. package/lib/check/radio_group.js +1 -1
  22. package/lib/{check-BDOpD_0-.js → check-DFlwStH9.js} +10 -13
  23. package/lib/{check-CrlZ7zVL.js → check-doQ2ZpQj.js} +10 -10
  24. package/lib/{checkbox-D_bZGoUD.js → checkbox-DhGHJXwI.js} +1 -1
  25. package/lib/collapse/index.js +1 -1
  26. package/lib/collapse/item.js +1 -1
  27. package/lib/{collapse-BRxYoeJx.js → collapse-B6-Rn05A.js} +8 -10
  28. package/lib/color_picker/index.js +1 -1
  29. package/lib/{color_picker-AaFcIczZ.js → color_picker-0a-IGZY9.js} +3 -3
  30. package/lib/date_picker/index.d.ts +2 -2
  31. package/lib/date_picker/index.js +1 -1
  32. package/lib/{date_picker-HjkRma9j.js → date_picker-BDN2PAz5.js} +3 -7
  33. package/lib/date_picker_ori/index.js +1 -1
  34. package/lib/{date_picker_ori-1IOHZsan.js → date_picker_ori-BXFs1eET.js} +4 -6
  35. package/lib/description_panel/index.js +1 -1
  36. package/lib/{description_panel-DaqVcA6-.js → description_panel--AKXBzLL.js} +2 -6
  37. package/lib/dialog/dialog_box.d.ts +22 -0
  38. package/lib/dialog/dialog_box.js +98 -0
  39. package/lib/dialog/dialog_container.d.ts +7 -3
  40. package/lib/dialog/dialog_container.js +1 -1
  41. package/lib/dialog/index.d.ts +33 -11
  42. package/lib/dialog/index.js +48 -48
  43. package/lib/{dialog_container-CcTyfoaD.js → dialog_container-BNPQ9n0V.js} +34 -15
  44. package/lib/{esm-Cir9D6cn.js → esm-DAha108i.js} +67 -67
  45. package/lib/form/form_item.d.ts +3 -3
  46. package/lib/form/form_item.js +1 -1
  47. package/lib/form/index.d.ts +3 -3
  48. package/lib/form/index.js +1 -1
  49. package/lib/{form-BvZHaqAt.js → form-DJxvBiLy.js} +30 -32
  50. package/lib/{form_inner-52DR1IPu.js → form_inner-Cnwb6f_Q.js} +3 -5
  51. package/lib/{form_item-DtqChzc3.js → form_item-BqPMRABd.js} +7 -9
  52. package/lib/icon/arrow_down.js +1 -1
  53. package/lib/icon/arrow_left.js +1 -1
  54. package/lib/icon/arrow_right.js +1 -1
  55. package/lib/icon/arrow_up.js +1 -1
  56. package/lib/icon/base.d.ts +2 -2
  57. package/lib/icon/base.js +1 -1
  58. package/lib/icon/calendar.js +1 -1
  59. package/lib/icon/caret_bottom.js +1 -1
  60. package/lib/icon/caret_top.js +1 -1
  61. package/lib/icon/close.js +1 -1
  62. package/lib/icon/close_filled.js +1 -1
  63. package/lib/icon/d_arrow_left.js +1 -1
  64. package/lib/icon/d_arrow_right.js +1 -1
  65. package/lib/icon/font_icon.js +1 -1
  66. package/lib/icon/info.js +1 -1
  67. package/lib/icon/loading.js +1 -1
  68. package/lib/icon/moon.js +1 -1
  69. package/lib/icon/more.js +1 -1
  70. package/lib/icon/reduction.js +1 -1
  71. package/lib/icon/refresh.js +1 -1
  72. package/lib/icon/refresh_left.js +1 -1
  73. package/lib/icon/refresh_right.js +1 -1
  74. package/lib/icon/search.js +1 -1
  75. package/lib/icon/select.js +1 -1
  76. package/lib/icon/sort.js +1 -1
  77. package/lib/icon/success.js +1 -1
  78. package/lib/icon/sun.js +1 -1
  79. package/lib/icon/theme_default.js +1 -1
  80. package/lib/icon/warn.js +1 -1
  81. package/lib/icon/zoom_in.js +1 -1
  82. package/lib/icon/zoom_out.js +1 -1
  83. package/lib/image/image_preview.js +1 -1
  84. package/lib/image/index.js +1 -1
  85. package/lib/{image-BCUhVAFo.js → image-CVQai6NX.js} +19 -19
  86. package/lib/{image_preview-BeJzfEoF.js → image_preview-DfQAKSJH.js} +3 -5
  87. package/lib/index.d.ts +2 -0
  88. package/lib/index.js +71 -69
  89. package/lib/input/index.d.ts +2 -2
  90. package/lib/input/index.js +3 -5
  91. package/lib/{item-42bYhAkZ.js → item-CQ2Sknbz.js} +1 -1
  92. package/lib/{item-Dq6M7lxw.js → item-DI6mQXtB.js} +5 -7
  93. package/lib/{item-CX8C9X57.js → item-D_ZOPXuE.js} +1 -1
  94. package/lib/list/index.js +1 -1
  95. package/lib/{list-Dz1Ya118.js → list-MG8PRzos.js} +3 -3
  96. package/lib/loading/index.js +6 -4
  97. package/lib/mask/index.js +1 -1
  98. package/lib/{mask-BlDl9u8F.js → mask-Bx-yNIJv.js} +2 -6
  99. package/lib/mask-Ox6CoyFB.js +5 -0
  100. package/lib/md_input/index.js +1 -1
  101. package/lib/{md_input-DN3ceqsw.js → md_input-BX3bujz8.js} +2 -2
  102. package/lib/menu/index.d.ts +12 -4
  103. package/lib/menu/index.js +1 -1
  104. package/lib/menu-DKscK5mw.js +274 -0
  105. package/lib/message/index.js +1 -1
  106. package/lib/modal/index.d.ts +2 -2
  107. package/lib/modal/index.js +1 -1
  108. package/lib/modal/modal_box.js +13 -13
  109. package/lib/{modal-cjj3Nw1B.js → modal-Cwi3qlEf.js} +39 -33
  110. package/lib/page_header/index.js +1 -1
  111. package/lib/{page_header-BfuWJIdd.js → page_header-ujV3pncE.js} +2 -4
  112. package/lib/pagination/index.d.ts +25 -18
  113. package/lib/pagination/index.js +1 -1
  114. package/lib/{pagination-DpOSOFwl.js → pagination-aRbGd3Rf.js} +86 -83
  115. package/lib/polygon/index.js +1 -1
  116. package/lib/{polygon-BY1FAACc.js → polygon-DhhovlrG.js} +1 -1
  117. package/lib/qrcode/index.d.ts +2 -2
  118. package/lib/qrcode/index.js +1 -1
  119. package/lib/{qrcode-Bgr8gJzA.js → qrcode-Dip8uLSA.js} +1 -1
  120. package/lib/{radio-C7dkhgwc.js → radio-C9NPQWGI.js} +1 -1
  121. package/lib/select/index.d.ts +2 -2
  122. package/lib/select/index.js +1 -1
  123. package/lib/{select-Cis6kRjQ.js → select-BZMDj5VE.js} +33 -30
  124. package/lib/select_ori/index.d.ts +2 -2
  125. package/lib/select_ori/index.js +1 -1
  126. package/lib/{select_ori-DcJbNYYr.js → select_ori-C7sUZxen.js} +3 -3
  127. package/lib/space/index.js +1 -1
  128. package/lib/{space-BT_dVhhv.js → space-CKuTk0YB.js} +6 -5
  129. package/lib/style-gKR_qwzm.js +5 -0
  130. package/lib/styles/animation/index.d.ts +2 -0
  131. package/lib/styles/animation/index.js +2 -0
  132. package/lib/styles/mask/index.d.ts +2 -0
  133. package/lib/styles/mask/index.js +2 -0
  134. package/lib/switch/index.js +1 -1
  135. package/lib/{switch-UyhlgW7F.js → switch-wh2-ivty.js} +11 -9
  136. package/lib/tabbar/index.js +1 -1
  137. package/lib/tabbar/item.js +1 -1
  138. package/lib/{tabbar-DO0kB58Y.js → tabbar-CBXK-_AV.js} +1 -1
  139. package/lib/table/index.d.ts +7 -3
  140. package/lib/table/index.js +1 -1
  141. package/lib/{table-saZMryiV.js → table-BQxMD2Ae.js} +32 -33
  142. package/lib/tabs/index.js +4 -2
  143. package/lib/tag/index.js +1 -1
  144. package/lib/{tag-BtDcKdxo.js → tag-Di1z9PoZ.js} +3 -5
  145. package/lib/theme/index.js +1 -1
  146. package/lib/theme/theme_color.d.ts +1 -2
  147. package/lib/theme/theme_color.js +4 -5
  148. package/lib/{theme-Barcq234.js → theme-CLbBS-in.js} +9 -10
  149. package/lib/utils/context_provide.js +1 -1
  150. package/lib/utils/index.d.ts +1 -1
  151. package/lib/utils/popover.js +1 -1
  152. package/lib/utils/transition.js +1 -1
  153. package/package.json +11 -11
  154. package/lib/button-CC5NBWtI.js +0 -152
  155. package/lib/menu-BOmVa4xN.js +0 -224
@@ -1,4 +1,5 @@
1
- //#region src/components/styles/animation.css?inline
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}";
1
+ //#region src/components/styles/animation/index.css?inline
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}", t = new CSSStyleSheet();
3
+ t.replaceSync(e);
3
4
  //#endregion
4
- export { e as t };
5
+ export { t };
@@ -16,9 +16,7 @@ var n = ":host{display:inline-flex}.l-icon{fill:currentColor;vertical-align:midd
16
16
  case "color":
17
17
  this._state.color = r;
18
18
  break;
19
- case "size":
20
- this._state.size = t(r);
21
- break;
19
+ case "size": this._state.size = t(r);
22
20
  }
23
21
  }
24
22
  connectedCallback() {
@@ -37,15 +35,16 @@ var n = ":host{display:inline-flex}.l-icon{fill:currentColor;vertical-align:midd
37
35
  let e = this.createEl("svg");
38
36
  e.classList.add("l-icon"), this.useLink || e.setAttribute("viewBox", this.viewBox);
39
37
  let t = this.renderChildren();
40
- if (typeof t == "string") if (t === "") {
41
- let t = this.children, n = [];
42
- for (let e = 0, r = t.length; e < r; e++) {
43
- let r = t[e];
44
- n.push(r.outerHTML);
45
- }
46
- e.innerHTML = n.join("");
47
- } else e.innerHTML = t;
48
- else e.append(t);
38
+ if (typeof t == "string") {
39
+ if (t === "") {
40
+ let t = this.children, n = [];
41
+ for (let e = 0, r = t.length; e < r; e++) {
42
+ let r = t[e];
43
+ n.push(r.outerHTML);
44
+ }
45
+ e.innerHTML = n.join("");
46
+ } else e.innerHTML = t;
47
+ } else e.append(t);
49
48
  return {
50
49
  template: e,
51
50
  style: n
package/lib/base.d.ts CHANGED
@@ -14,13 +14,13 @@ export default class BaseComponent<T = Record<string, any>> extends HTMLElement
14
14
  */
15
15
  static get observedAttributes(): string[] | undefined | null;
16
16
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
17
- protected attributeChanged(name: string, oldValue: string, newValue: string): void;
17
+ protected attributeChanged(_name: string, _oldValue: string, _newValue: string): void;
18
18
  cancelPending(): void;
19
19
  batchUpdate(): void;
20
- protected updateDOM(changedProps: Set<string>): void;
20
+ protected updateDOM(_changedProps: Set<string>): void;
21
21
  /** @deprecated */
22
22
  get shadow(): ShadowRoot;
23
- get root(): ShadowRoot | HTMLElement;
23
+ get root(): ShadowRoot;
24
24
  createStyle(text: string): void;
25
25
  createLink(href: string): void;
26
26
  loadStyleText(styleText: string | string[]): void;
@@ -40,7 +40,7 @@ export default class BaseComponent<T = Record<string, any>> extends HTMLElement
40
40
  getAttr(key: string, defaultValue: boolean): boolean;
41
41
  getAttr<T extends Record<string, string | number | boolean>>(filepath: string, defaultValue: T): T;
42
42
  appendToRoot(el?: HTMLElement | HTMLElement[] | string | DocumentFragment): void;
43
- appendToRootV2(template?: HTMLElement | string | DocumentFragment, style?: string | string[]): void;
43
+ appendToRootV2(template?: HTMLElement | string | DocumentFragment, style?: string | string[], styleSheets?: CSSStyleSheet[]): void;
44
44
  connectedCallback(): void;
45
45
  disconnectedCallback(): void;
46
46
  render(): void | string | HTMLElement | DocumentFragment;
@@ -51,6 +51,7 @@ export default class BaseComponent<T = Record<string, any>> extends HTMLElement
51
51
  render_v2(): {
52
52
  template?: string | HTMLElement | DocumentFragment;
53
53
  style?: string | string[];
54
+ styleSheets?: CSSStyleSheet[];
54
55
  };
55
56
  /**
56
57
  * 初始化事件
package/lib/base.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getAttr as e } from "ph-utils/dom";
1
+ import { getAttr as e } from "ph-utils/browser";
2
2
  //#region src/components/base.ts
3
3
  var t = class extends HTMLElement {
4
4
  static baseName = "base-component";
@@ -57,25 +57,29 @@ var t = class extends HTMLElement {
57
57
  return e(this, t, n);
58
58
  }
59
59
  appendToRoot(e) {
60
- if (e) if (typeof e == "string") {
61
- let t = document.createElement("div");
62
- t.innerHTML = e, this.root.append(...t.childNodes), t = void 0;
63
- } else e.length ? this.root.append(...e) : this.root.append(e);
64
- }
65
- appendToRootV2(e, t) {
66
- let n = [];
67
- if (t && n.push(this.styleHtml(t)), e) if (typeof e == "string") n.push(e);
68
- else {
69
- let t = document.createElement("div");
70
- t.appendChild(e), n.push(t.innerHTML), t = void 0;
60
+ if (e) {
61
+ if (typeof e == "string") {
62
+ let t = document.createElement("div");
63
+ t.innerHTML = e, this.root.append(...t.childNodes), t = void 0;
64
+ } else e.length ? this.root.append(...e) : this.root.append(e);
71
65
  }
72
- this.root.innerHTML = n.join("");
66
+ }
67
+ appendToRootV2(e, t, n) {
68
+ let r = [];
69
+ if (t && r.push(this.styleHtml(t)), e) {
70
+ if (typeof e == "string") r.push(e);
71
+ else {
72
+ let t = document.createElement("div");
73
+ t.appendChild(e), r.push(t.innerHTML), t = void 0;
74
+ }
75
+ }
76
+ n && (this.root.adoptedStyleSheets = n), this.root.innerHTML = r.join("");
73
77
  }
74
78
  connectedCallback() {
75
79
  if (this.version === 1) this.appendToRoot(this.render());
76
80
  else {
77
81
  let e = this.render_v2();
78
- this.appendToRootV2(e.template, e.style);
82
+ this.appendToRootV2(e.template, e.style, e.styleSheets);
79
83
  }
80
84
  this.rendered = !0, this.initEvents(), this.afterInit(), this._changedProperties.size > 0 && this.updateDOM(this._changedProperties);
81
85
  }
@@ -93,7 +97,7 @@ var t = class extends HTMLElement {
93
97
  emit(e, t) {
94
98
  return this.dispatchEvent(new CustomEvent(e, {
95
99
  bubbles: !0,
96
- composed: !1,
100
+ composed: !0,
97
101
  ...t
98
102
  }));
99
103
  }
@@ -29,8 +29,8 @@ export default class Button extends BaseComponent<ButtonState> {
29
29
  isFormButton(): boolean;
30
30
  getHtmlType(): "submit" | "reset" | "button";
31
31
  render_v2(): {
32
- template?: string | HTMLElement | DocumentFragment;
33
- style?: string | string[];
32
+ styleSheets: CSSStyleSheet[];
33
+ template: HTMLButtonElement;
34
34
  };
35
35
  afterInit(): void;
36
36
  render(): HTMLButtonElement;
@@ -1,2 +1,152 @@
1
- import { t as e } from "../button-CC5NBWtI.js";
2
- export { e as default };
1
+ import e from "../base.js";
2
+ import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "../utils/index.js";
3
+ import { t as i } from "../animation-Bo4jbSGK.js";
4
+ import { t as a } from "../style-gKR_qwzm.js";
5
+ import { $one as o, addClass as s, formatClass as c, formatStyle as l, off as u, on as d, removeClass as f } from "ph-utils/browser";
6
+ import { adjust as p } from "ph-utils";
7
+ //#region src/components/button/index.ts
8
+ var m = class extends e {
9
+ static baseName = "button";
10
+ $btn;
11
+ constructor() {
12
+ super(), this.version = 2, this._state = {
13
+ loading: !1,
14
+ htmlType: "button",
15
+ text: !1,
16
+ ghost: !1,
17
+ disabled: !1,
18
+ type: "normal",
19
+ shape: "default",
20
+ loadingText: "加载中……",
21
+ size: "default",
22
+ boxShadow: "box-shadow-none"
23
+ };
24
+ }
25
+ get disabled() {
26
+ return this._state.disabled;
27
+ }
28
+ set disabled(e) {
29
+ this.setDisabled(e);
30
+ }
31
+ setLoading(e) {
32
+ this.$btn && (e ? (s(this.$btn, "l-btn-loading"), this.$btn.disabled = !0, this.$btn.innerHTML = this.loadingBody()) : (f(this.$btn, "l-btn-loading"), this.$btn.disabled = this.disabled, this.$btn.innerHTML = "<slot></slot>"));
33
+ }
34
+ setDisabled(e) {
35
+ this._state.disabled = e, this.$btn && (this.$btn.disabled = e);
36
+ }
37
+ static get observedAttributes() {
38
+ return [
39
+ "loading",
40
+ "color",
41
+ "text",
42
+ "ghost",
43
+ "disabled",
44
+ "height",
45
+ "html-type",
46
+ "type",
47
+ "shape",
48
+ "loading-text",
49
+ "size",
50
+ "box-shadow"
51
+ ];
52
+ }
53
+ attributeChanged(e, i, a) {
54
+ switch (e) {
55
+ case "color":
56
+ case "shape":
57
+ case "type":
58
+ case "size":
59
+ this._state[e] = a;
60
+ break;
61
+ case "height":
62
+ this._state[e] = r(a);
63
+ break;
64
+ case "text":
65
+ case "ghost":
66
+ case "disabled":
67
+ case "loading":
68
+ this._state[e] = n(a, !1, e);
69
+ break;
70
+ case "html-type":
71
+ case "loading-text":
72
+ this._state[t(e)] = a;
73
+ break;
74
+ case "box-shadow":
75
+ let i = n(a, !1, "box-shadow");
76
+ this._state.boxShadow = `box-shadow${i ? "" : "-none"}`;
77
+ }
78
+ }
79
+ updateDOM(e) {
80
+ this.$btn && (e.has("loading") && this.setLoading(this._state.loading), e.has("disabled") && this.setDisabled(this.disabled), e.has("color") && this._state.color && (this.$btn.style.cssText = this.applyColor(this._state.color, this._state.text, this._state.ghost)), (e.has("type") || e.has("shape") || e.has("box-shadow")) && (this.$btn.className = this._resetBtnClass())), e.has("height") && this._updateHeight();
81
+ }
82
+ connectedCallback() {
83
+ this.className = `l-btn-${this._state.size || "default"} ${this.className}`, super.connectedCallback(), this.isFormButton() && d(this, "click", this._handleClick), this._updateHeight();
84
+ }
85
+ disconnectedCallback() {
86
+ super.disconnectedCallback(), this.isFormButton() && u(this, "click", this._handleClick), this.$btn = void 0;
87
+ }
88
+ isFormButton() {
89
+ let e = this.getHtmlType();
90
+ return e === "submit" || e === "reset";
91
+ }
92
+ getHtmlType() {
93
+ return this._state.htmlType;
94
+ }
95
+ render_v2() {
96
+ return this._changedProperties.clear(), {
97
+ styleSheets: [a, i],
98
+ template: this.render()
99
+ };
100
+ }
101
+ afterInit() {
102
+ this.$btn ||= o(".l-btn", this.root);
103
+ }
104
+ render() {
105
+ let e = document.createElement("button"), t = this._state.loading, n = this._state.text, r = this._state.ghost;
106
+ e.className = this._resetBtnClass(), (this.disabled || t) && (e.disabled = !0), e.type = this._state.htmlType;
107
+ let i = this.applyColor(this._state.color || "", n, r);
108
+ return i && (e.style.cssText = i), e.innerHTML = t ? this.loadingBody() : "<slot></slot>", e.setAttribute("part", "default"), e;
109
+ }
110
+ loadingBody() {
111
+ let e = this._state.loadingText, t = ["<l-loading-icon class=\"l-rotate-anim\"></l-loading-icon>"];
112
+ return e ? t.push(`<span>${e}</span>`) : t.push("<slot></slot>"), t.join("");
113
+ }
114
+ applyColor(e, t = !1, n = !1) {
115
+ if (!e) return "";
116
+ let r = p(e, 1, !0), i = p(e, 3, !1);
117
+ return l({
118
+ "--l-btn-border-color": t ? "transparent" : e,
119
+ "--l-btn-text-color": n || t ? e : "#ffffff",
120
+ "--l-btn-hover-text-color": n || t ? r : "#ffffff",
121
+ "--l-btn-background": n || t ? "transparent" : e,
122
+ "--l-btn-active-text-color": n || t ? i : "#ffffff",
123
+ "--l-btn-hover-border-color": t ? "transparent" : r,
124
+ "--l-btn-hover-background": n || t ? "transparent" : r,
125
+ "--l-btn-active-background": n || t ? "transparent" : i,
126
+ "--l-btn-active-border-color": t ? "transparent" : i
127
+ });
128
+ }
129
+ _updateHeight() {
130
+ this._state.height ? this.style.setProperty("--l-btn-height", this._state.height) : this.style.removeProperty("--l-btn-height");
131
+ }
132
+ _resetBtnClass() {
133
+ return c([
134
+ "l-btn",
135
+ `l-btn-${this._state.type}`,
136
+ `l-btn-${this._state.shape}`,
137
+ `l-btn-${this._state.boxShadow}`,
138
+ this._state.ghost ? "l-btn-ghost" : "",
139
+ this._state.text ? "l-btn-text" : "",
140
+ this._state.loading ? "l-btn-loading" : ""
141
+ ]);
142
+ }
143
+ _handleClick = () => {
144
+ (this._state.htmlType === "reset" || this._state.htmlType === "submit") && this.emit("form-action", {
145
+ bubbles: !0,
146
+ composed: !0,
147
+ detail: this._state.htmlType
148
+ });
149
+ };
150
+ };
151
+ //#endregion
152
+ export { m as default };
@@ -0,0 +1,2 @@
1
+ declare const buttonSheet: CSSStyleSheet;
2
+ export default buttonSheet;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../style-gKR_qwzm.js";
2
+ export { e as default };
@@ -34,8 +34,8 @@ export default class Calendar extends BaseComponent<CalendarState> {
34
34
  rerenderBody(): void;
35
35
  rerender(): string;
36
36
  render_v2(): {
37
- template?: string | HTMLElement | DocumentFragment;
38
- style?: string | string[];
37
+ template: string;
38
+ style: string[];
39
39
  };
40
40
  }
41
41
  export {};
@@ -1,2 +1,2 @@
1
- import { t as e } from "../calendar-Clbg3qot.js";
1
+ import { t as e } from "../calendar-CvlUsN6w.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 { $one as n, hasClass as r, off as i, on as a, shouldEventNext as o } from "ph-utils/dom";
4
- import { endOf as s, format as c, startOf as l, timestamp as u } from "ph-utils/date";
5
- import { get as d } from "ph-utils/storage";
3
+ import { $one as n, get as r, hasClass as i, off as a, on as o, shouldEventNext as s } from "ph-utils/browser";
4
+ import { endOf as c, format as l, startOf as u, timestamp as d } from "ph-utils";
6
5
  //#region src/components/calendar/index.less?inline
7
6
  var f = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calendar-table{border-collapse:collapse;table-layout:fixed;width:100%;height:100%}.calendar-table thead{height:var(--l-calendar-header-height,32px)}.calendar-table th{cursor:default;font-weight:400}.calendar-table .excluded{color:var(--l-calendar-off-text-color,#a8abb2)}.day{text-align:center;cursor:pointer;font-size:14px;transition:background-color .2s}:where(.day:hover){background-color:#0000000a}.day.disabled{color:var(--l-calendar-off-text-color,#a8abb2);cursor:not-allowed}.day.active:not(.disabled){background-color:var(--l-primary-color,#007bff);color:#fff;font-weight:700}.day.today{color:var(--l-primary-color,#007bff)}.day.range{background-color:var(--l-primary-color-light4,#cce6ff)}.day.range-start,.day.range-end{background-color:var(--l-primary-color,#007bff);color:#fff}", p = { "zh-CN": { weekdays: [
8
7
  "一",
@@ -21,7 +20,7 @@ var f = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calen
21
20
  _value;
22
21
  constructor() {
23
22
  super(), this.version = 2;
24
- let e = d("l_app_locale", "zh-CN", { storage: "session" }), t = /* @__PURE__ */ new Date();
23
+ let e = r("l_app_locale", "zh-CN", { storage: "session" }), t = /* @__PURE__ */ new Date();
25
24
  this._value = "", this._state = {
26
25
  locale: e,
27
26
  minDate: -Infinity,
@@ -41,13 +40,13 @@ var f = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calen
41
40
  e != this._value && (this._value = e, this._updateValue());
42
41
  }
43
42
  _updateValue() {
44
- this._state.type === "range" ? (this._value ? this._range = this._value.split(",").map((e) => /^\d+$/.test(e) ? e.length === 10 ? Number(e) * 1e3 : Number(e) : u(e, "ms")) : this._range = [0, 0], this._selectDates.clear()) : (this._selectDates = new Set(this._value.split("&")), this._range = [0, 0]), this.batchUpdate();
43
+ this._state.type === "range" ? (this._range = this._value ? this._value.split(",").map((e) => /^\d+$/.test(e) ? e.length === 10 ? Number(e) * 1e3 : Number(e) : d(e, "ms")) : [0, 0], this._selectDates.clear()) : (this._selectDates = new Set(this._value.split("&")), this._range = [0, 0]), this.batchUpdate();
45
44
  }
46
45
  afterInit() {
47
- this.$container = n(".calendar-table", this.root), a(this.root, "click", this.handleCellClick), a(this.$container, "mouseover", this.handleCellHover);
46
+ this.$container = n(".calendar-table", this.root), o(this.root, "click", this.handleCellClick), o(this.$container, "mouseover", this.handleCellHover);
48
47
  }
49
48
  beforeDestroy() {
50
- i(this.root, "click", this.handleCellClick), this.$container &&= (i(this.$container, "mouseover", this.handleCellHover), void 0);
49
+ a(this.root, "click", this.handleCellClick), this.$container &&= (a(this.$container, "mouseover", this.handleCellHover), void 0);
51
50
  }
52
51
  static get observedAttributes() {
53
52
  return [
@@ -61,11 +60,11 @@ var f = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calen
61
60
  ];
62
61
  }
63
62
  handleCellClick = (e) => {
64
- let [t, n, r] = o(e, "l-day", this.root);
63
+ let [t, n, r] = s(e, "l-day", this.root);
65
64
  t && this._emitDayAction(r, "click", n);
66
65
  };
67
66
  handleCellHover = (e) => {
68
- let [t, n, r] = o(e, "l-day", this.root);
67
+ let [t, n, r] = s(e, "l-day", this.root);
69
68
  t && this._emitDayAction(r, "hover", n);
70
69
  };
71
70
  _emitDayAction(e, t, n) {
@@ -74,7 +73,7 @@ var f = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calen
74
73
  maxTimestamp: this._state.maxDate,
75
74
  dayTimestamp: Number(n),
76
75
  day: e.title,
77
- isActiveMonth: !r(e, "excluded")
76
+ isActiveMonth: !i(e, "excluded")
78
77
  } });
79
78
  }
80
79
  attributeChanged(e, n, r) {
@@ -83,10 +82,10 @@ var f = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calen
83
82
  p.hasOwnProperty(r) && (this._state.locale = r, this._langData = p[r]);
84
83
  break;
85
84
  case "min-date":
86
- this._state.minDate = l(r).getTime();
85
+ this._state.minDate = u(r).getTime();
87
86
  break;
88
87
  case "max-date":
89
- this._state.maxDate = s(r).getTime();
88
+ this._state.maxDate = c(r).getTime();
90
89
  break;
91
90
  case "year":
92
91
  this._state.year = t(r, this._state.year);
@@ -97,9 +96,7 @@ var f = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calen
97
96
  case "type":
98
97
  this._state.type = r, this._updateValue();
99
98
  break;
100
- case "value":
101
- this.setValue(r);
102
- break;
99
+ case "value": this.setValue(r);
103
100
  }
104
101
  }
105
102
  updateDOM(e) {
@@ -109,19 +106,19 @@ var f = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calen
109
106
  return `<tr>${this._langData.weekdays.map((e) => `<th>${e}</th>`).join("")}</tr>`;
110
107
  }
111
108
  _renderBody() {
112
- let e = this._state.year, t = this._state.month, n = c(null, "yyyy-mm-dd"), r = new Date(e, t, 1), i = r.getDay() - 1;
109
+ let e = this._state.year, t = this._state.month, n = l(null, "yyyy-mm-dd"), r = new Date(e, t, 1), i = r.getDay() - 1;
113
110
  i < 0 && (i = 6);
114
- let a = new Date(e, t + 1, 0), o = a.getDate(), s = c(a, "yyyy-mm"), l = new Date(e, t, 0), u = l.getDate(), d = c(l, "yyyy-mm"), f = c(new Date(e, t + 1, 1), "yyyy-mm"), p = new Date(r);
115
- p.setDate(p.getDate() - i);
116
- let m = p.setHours(0, 0, 0, 0), h = "", [g, _] = this._range || [];
111
+ let a = new Date(e, t + 1, 0), o = a.getDate(), s = l(a, "yyyy-mm"), c = new Date(e, t, 0), u = c.getDate(), d = l(c, "yyyy-mm"), f = new Date(e, t + 1, 1), p = l(f, "yyyy-mm"), m = new Date(r);
112
+ m.setDate(m.getDate() - i);
113
+ let h = m.setHours(0, 0, 0, 0), g = "", [_, v] = this._range || [];
117
114
  for (let e = 0; e < 42; e++) {
118
- e % 7 == 0 && (h += "<tr>");
115
+ e % 7 == 0 && (g += "<tr>");
119
116
  let t, r = "day", a = "";
120
- e < i ? (t = `${u - i + e + 1}`, r += " excluded", a = d) : e < i + o ? (t = `${e - i + 1}`, a = s) : (t = `${e - i - o + 1}`, r += " excluded", a = f), (m < this._state.minDate || m > this._state.maxDate) && (r += " disabled");
117
+ e < i ? (t = `${u - i + e + 1}`, r += " excluded", a = d) : e < i + o ? (t = `${e - i + 1}`, a = s) : (t = `${e - i - o + 1}`, r += " excluded", a = p), (h < this._state.minDate || h > this._state.maxDate) && (r += " disabled");
121
118
  let c = `${a}-${t.padStart(2, "0")}`;
122
- c === n && (r += " today"), this._selectDates.has(c) && (r += " active"), g && _ && (g === m ? r += " range-start" : _ === m ? r += " range-end" : g < m && m < _ && (r += " range")), h += `<td class="${r}" title="${c}" l-day="${m}">${t}</td>`, m += 864e5, e % 7 == 6 && (h += "</tr>");
119
+ c === n && (r += " today"), this._selectDates.has(c) && (r += " active"), _ && v && (_ === h ? r += " range-start" : v === h ? r += " range-end" : _ < h && h < v && (r += " range")), g += `<td class="${r}" title="${c}" l-day="${h}">${t}</td>`, h += 864e5, e % 7 == 6 && (g += "</tr>");
123
120
  }
124
- return h;
121
+ return g;
125
122
  }
126
123
  rerenderHeader() {
127
124
  if (this.$container) {
@@ -0,0 +1,23 @@
1
+ import BaseComponent from "../base";
2
+ type CardState = {
3
+ /** 标题 */
4
+ headerText?: string;
5
+ /** 是否显示标题 */
6
+ showHeader: boolean;
7
+ /** 底部区域内容 */
8
+ footerText: string;
9
+ /** 是否显示底部区域 */
10
+ showFooter: boolean;
11
+ };
12
+ export default class Card extends BaseComponent<CardState> {
13
+ static baseName: string;
14
+ constructor();
15
+ static get observedAttributes(): string[];
16
+ protected attributeChanged(name: string, _oldValue: string, newValue: string): void;
17
+ render_v2(): {
18
+ style: string;
19
+ template: DocumentFragment;
20
+ };
21
+ render(): DocumentFragment;
22
+ }
23
+ export {};
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../card-3DM-lJQV.js";
2
+ export { e as default };
@@ -0,0 +1,63 @@
1
+ import e from "./base.js";
2
+ import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
3
+ import { $$ as r } from "ph-utils/browser";
4
+ //#region src/components/card/index.less?inline
5
+ var i = ":host{--l-card-bg:#fff;--l-card-text-color:#333;--l-card-border-color:var(--l-border-color,#e8e8e8);border:1px solid var(--l-card-border-color);background-color:var(--l-card-bg);color:var(--l-card-text-color);border-radius:4px;display:block;box-shadow:0 1px 3px #0000001a,0 1px 2px -1px #0000001a}.l-card__header{border-bottom:1px solid var(--l-card-border-color);box-sizing:border-box;justify-content:space-between;align-items:center;padding:15px;display:flex}.l-card__footer{border-top:1px solid var(--l-card-border-color);box-sizing:border-box;padding:15px}.l-card__body{padding:15px}.l-header-extra:empty{display:none}:host-context(html.dark){--l-card-bg:#232324;--l-card-text-color:#ffffffb3;--l-card-border-color:#484849}", a = class extends e {
6
+ static baseName = "card";
7
+ constructor() {
8
+ super(), this.version = 2, this._state = {
9
+ headerText: "",
10
+ showHeader: !0,
11
+ footerText: "",
12
+ showFooter: !1
13
+ };
14
+ }
15
+ static get observedAttributes() {
16
+ return [
17
+ "header-text",
18
+ "show-header",
19
+ "footer-text",
20
+ "show-footer"
21
+ ];
22
+ }
23
+ attributeChanged(e, r, i) {
24
+ switch (e) {
25
+ case "header-text":
26
+ case "footer-text":
27
+ this._state[t(e)] = i;
28
+ break;
29
+ case "show-header":
30
+ case "show-footer": this._state[t(e)] = n(i, !1, e);
31
+ }
32
+ }
33
+ render_v2() {
34
+ return {
35
+ style: i,
36
+ template: this.render()
37
+ };
38
+ }
39
+ render() {
40
+ let e = document.createDocumentFragment();
41
+ if (this._state.showHeader) {
42
+ let t = r("div", {
43
+ class: "l-card__header",
44
+ part: "header"
45
+ }, [this._state.headerText ? r("span", { textContent: this._state.headerText }) : r("slot", { name: "header" }), r("slot", { name: "header-extra" })]);
46
+ e.appendChild(t);
47
+ }
48
+ let t = r("div", {
49
+ class: "l-card__body",
50
+ part: "body"
51
+ }, [r("slot")]);
52
+ if (e.appendChild(t), this._state.showFooter) {
53
+ let t = r("div", {
54
+ class: "l-card__footer",
55
+ part: "footer"
56
+ }, [this._state.footerText ? r("span", { textContent: this._state.footerText }) : r("slot", { name: "footer" })]);
57
+ e.appendChild(t);
58
+ }
59
+ return e;
60
+ }
61
+ };
62
+ //#endregion
63
+ export { a as t };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../carousel-Dgirxwzb.js";
1
+ import { t as e } from "../carousel-DvkZ1YXq.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../item-42bYhAkZ.js";
1
+ import { t as e } from "../item-CQ2Sknbz.js";
2
2
  export { e as default };
@@ -1,7 +1,6 @@
1
1
  import e from "./base.js";
2
2
  import { parseAttrValue as t } from "./utils/index.js";
3
- import { $ as n, $$ as r, $one as i, getAttr as a, iterate as o, off as s, on as c, shouldEventNext as l } from "ph-utils/dom";
4
- import { debounce as u } from "ph-utils/web";
3
+ import { $ as n, $$ as r, $one as i, debounce as a, getAttr as o, iterate as s, off as c, on as l, shouldEventNext as u } from "ph-utils/browser";
5
4
  //#region src/components/carousel/index.less?inline
6
5
  var d = ":host{box-sizing:border-box;width:100%;height:180px;margin:0 auto;display:block;position:relative;overflow:hidden}.container{box-sizing:border-box;min-width:900%;height:100%;display:flex;position:relative}.nav-button{cursor:pointer;z-index:20;color:#fff;background-color:#292d3d4d;border:none;border-radius:50%;outline:none;justify-content:center;align-items:center;width:30px;height:30px;margin:0;padding:0;font-size:16px;transition:background-color .3s;display:flex;position:absolute;top:50%;transform:translateY(-50%)}.nav-button:hover{background-color:#292d3d66}.nav-button:active{background-color:#292d3d80}.nav-prev{left:20px}.nav-next{right:20px}.pagination{z-index:2;justify-content:center;align-items:center;gap:8px;width:100%;display:flex;position:absolute;bottom:10px;left:0}.bullet{cursor:pointer;background-color:#0000004d;border-radius:50%;width:8px;height:8px;transition:background-color .3s;display:inline-block}.bullet.active{background-color:var(--l-primary-color,#722ed1)}";
7
6
  //#endregion
@@ -67,21 +66,20 @@ var p = class extends e {
67
66
  case "autoplay":
68
67
  let i = t(r, !1, "autoplay");
69
68
  i !== this.autoplay && (this.autoplay = i, this.#t && (i ? this.#t.start() : this.#t.stop()));
70
- break;
71
69
  }
72
70
  }
73
71
  connectedCallback() {
74
72
  this.loadStyleText(d), this.style.setProperty("--carousel-width", `${Math.floor(this.clientWidth)}px`);
75
- let e = a(this, "height");
73
+ let e = o(this, "height");
76
74
  e && this.style.setProperty("height", `${e}px`), this.#d(), super.connectedCallback();
77
75
  }
78
76
  afterInit() {
79
- this.setAttribute("data-page", "__stop__"), c(this.root, "click", this.#p), this.#c(), this.#t = f(() => {
77
+ this.setAttribute("data-page", "__stop__"), l(this.root, "click", this.#p), this.#c(), this.#t = f(() => {
80
78
  this.#m("next");
81
- }), this.autoplay && this.#t.start(), this.#o = i(".container", this.root), c(this.#o, "pointerdown", this.#b), c(this.#o, "pointerup", this.#S), c(this.#o, "pointermove", this.#x), c(this.#o, "pointercancel", this.#w), c(this.#o, "pointerleave", this.#w);
79
+ }), this.autoplay && this.#t.start(), this.#o = i(".container", this.root), l(this.#o, "pointerdown", this.#b), l(this.#o, "pointerup", this.#S), l(this.#o, "pointermove", this.#x), l(this.#o, "pointercancel", this.#w), l(this.#o, "pointerleave", this.#w);
82
80
  }
83
81
  beforeDestroy() {
84
- s(this, "mouseenter", this.#g), s(this, "mouseleave", this.#_), s(this.root, "click", this.#p), s(this.#o, "pointerdown", this.#b), s(this.#o, "pointerup", this.#S), s(this.#o, "pointermove", this.#x), s(this.#o, "pointercancel", this.#w), s(this.#o, "pointerleave", this.#w), this.#o = void 0, this.#l(!0), this.#t.stop(), this.#t = void 0;
82
+ c(this, "mouseenter", this.#g), c(this, "mouseleave", this.#_), c(this.root, "click", this.#p), c(this.#o, "pointerdown", this.#b), c(this.#o, "pointerup", this.#S), c(this.#o, "pointermove", this.#x), c(this.#o, "pointercancel", this.#w), c(this.#o, "pointerleave", this.#w), this.#o = void 0, this.#l(!0), this.#t.stop(), this.#t = void 0;
85
83
  }
86
84
  render() {
87
85
  let e = document.createDocumentFragment(), t = "";
@@ -104,11 +102,11 @@ var p = class extends e {
104
102
  return this.allIndex >= 0 && i.replaceChildren(this.#s()), e.appendChild(i), e;
105
103
  }
106
104
  renderArrows(e) {
107
- if (this.arrows !== "never") this.renderNavigationButton("prev", e), this.renderNavigationButton("next", e), this.arrows === "hover" && (c(this, "mouseenter", this.#g), c(this, "mouseleave", this.#_));
105
+ if (this.arrows !== "never") this.renderNavigationButton("prev", e), this.renderNavigationButton("next", e), this.arrows === "hover" && (l(this, "mouseenter", this.#g), l(this, "mouseleave", this.#_));
108
106
  else {
109
- s(this, "mouseenter", this.#g), s(this, "mouseleave", this.#_);
107
+ c(this, "mouseenter", this.#g), c(this, "mouseleave", this.#_);
110
108
  let e = n(".nav-button", this.root);
111
- e.length && o(e, (e) => {
109
+ e.length && s(e, (e) => {
112
110
  e.remove();
113
111
  });
114
112
  }
@@ -143,7 +141,7 @@ var p = class extends e {
143
141
  #l(e = !1) {
144
142
  this.observer && (this.observer.disconnect(), e && (this.observer = void 0));
145
143
  }
146
- #u = u(() => {
144
+ #u = a(() => {
147
145
  let e = i("#cloneFirst", this);
148
146
  e && e.remove();
149
147
  let t = i("#cloneLast", this);
@@ -172,7 +170,7 @@ var p = class extends e {
172
170
  for (let t of e) t.type === "childList" && (this.#l(), this.#u());
173
171
  };
174
172
  #p = (e) => {
175
- let [t, n] = l(e, "data-page", this.root);
173
+ let [t, n] = u(e, "data-page", this.root);
176
174
  t && this.#m(n);
177
175
  };
178
176
  #m(e) {
@@ -196,21 +194,27 @@ var p = class extends e {
196
194
  this.loop && e === this.allIndex + 2 ? n = Math.floor(this.clientWidth * -1) : this.loop && e === 0 && (n = Math.floor(this.clientWidth * (this.allIndex + 1) * -1)), this.#o.style.transform = `translateX(${n}px)`, this.#e = n;
197
195
  }, { once: !0 });
198
196
  }
199
- this.loop && this.allIndex > 0 && e === this.allIndex + 2 ? this.currentIndex = 0 : this.loop && this.allIndex > 0 && e === 0 ? this.currentIndex = this.allIndex : this.currentIndex = this.loop ? e - 1 : e;
197
+ this.currentIndex = this.loop && this.allIndex > 0 && e === this.allIndex + 2 ? 0 : this.loop && this.allIndex > 0 && e === 0 ? this.allIndex : this.loop ? e - 1 : e;
200
198
  let t = i(".bullet.active", this.root);
201
199
  t && t.classList.remove("active");
202
200
  let n = i(`#bullet-${this.currentIndex}`, this.root);
203
201
  n && n.classList.add("active");
204
202
  }
205
203
  #g = () => {
206
- this.arrows === "hover" && o(n(".nav-button", this.root), (e) => {
207
- e.style.display = "flex", this.#v(e, !0);
208
- });
204
+ if (this.arrows === "hover") {
205
+ let e = n(".nav-button", this.root);
206
+ s(e, (e) => {
207
+ e.style.display = "flex", this.#v(e, !0);
208
+ });
209
+ }
209
210
  };
210
211
  #_ = () => {
211
- this.arrows === "hover" && o(n(".nav-button", this.root), (e) => {
212
- this.#v(e, !1);
213
- });
212
+ if (this.arrows === "hover") {
213
+ let e = n(".nav-button", this.root);
214
+ s(e, (e) => {
215
+ this.#v(e, !1);
216
+ });
217
+ }
214
218
  };
215
219
  #v(e, t = !0) {
216
220
  let n = e.getAttribute("data-page") === "prev" ? -10 : 10, r = [];