litos-ui 0.17.5 → 0.18.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 (161) hide show
  1. package/README.md +49 -49
  2. package/lib/animation-CTt9qgA7.js +4 -0
  3. package/lib/base-Dm0WS1pK.js +62 -0
  4. package/lib/base.js +111 -147
  5. package/lib/button/index.d.ts +8 -3
  6. package/lib/button/index.js +2 -137
  7. package/lib/button-CC5PmAb1.js +146 -0
  8. package/lib/calendar/index.d.ts +10 -5
  9. package/lib/calendar/index.js +2 -123
  10. package/lib/calendar-DeP6yZB0.js +149 -0
  11. package/lib/carousel/index.js +2 -280
  12. package/lib/carousel/item.js +2 -15
  13. package/lib/carousel-D4Fe3LEx.js +272 -0
  14. package/lib/check/checkbox.js +2 -18
  15. package/lib/check/checkbox_group.js +6 -6
  16. package/lib/check/radio.js +2 -15
  17. package/lib/check/radio_group.js +9 -9
  18. package/lib/check-B0XraJvb.js +73 -0
  19. package/lib/check-CvGaONEx.js +117 -0
  20. package/lib/checkbox-DbWsmAaL.js +16 -0
  21. package/lib/collapse/index.d.ts +18 -11
  22. package/lib/collapse/index.js +2 -88
  23. package/lib/collapse/item.d.ts +28 -9
  24. package/lib/collapse/item.js +2 -115
  25. package/lib/collapse/types.d.ts +7 -0
  26. package/lib/collapse-CeKRZ-43.js +104 -0
  27. package/lib/color_picker/index.js +2 -42
  28. package/lib/color_picker-D0brKFm-.js +41 -0
  29. package/lib/date_picker/index.d.ts +23 -0
  30. package/lib/date_picker/index.js +3 -0
  31. package/lib/date_picker-DQGoiN8v.js +103 -0
  32. package/lib/date_picker_ori/index.js +2 -129
  33. package/lib/date_picker_ori-aRuSSi9D.js +122 -0
  34. package/lib/description_panel/index.js +2 -66
  35. package/lib/description_panel-Df_8rVbX.js +57 -0
  36. package/lib/dialog/dialog_container.js +2 -131
  37. package/lib/dialog/index.js +67 -85
  38. package/lib/dialog_container-DcN87wj0.js +126 -0
  39. package/lib/esm-sVEoAVPu.js +244 -0
  40. package/lib/form/form_item.d.ts +1 -0
  41. package/lib/form/form_item.js +2 -136
  42. package/lib/form/index.js +2 -147
  43. package/lib/form-DdU0yK0k.js +154 -0
  44. package/lib/form_inner-DR9tyB_r.js +117 -0
  45. package/lib/form_item-Bv-YafZK.js +137 -0
  46. package/lib/icon/arrow_down.js +12 -12
  47. package/lib/icon/arrow_left.js +9 -9
  48. package/lib/icon/arrow_right.js +9 -9
  49. package/lib/icon/arrow_up.js +12 -12
  50. package/lib/icon/base.d.ts +16 -2
  51. package/lib/icon/base.js +2 -38
  52. package/lib/icon/calendar.d.ts +5 -0
  53. package/lib/icon/calendar.js +10 -0
  54. package/lib/icon/caret_bottom.js +9 -9
  55. package/lib/icon/caret_top.js +9 -9
  56. package/lib/icon/close.js +9 -9
  57. package/lib/icon/close_filled.js +12 -12
  58. package/lib/icon/d_arrow_left.js +12 -12
  59. package/lib/icon/d_arrow_right.js +12 -12
  60. package/lib/icon/font_icon.d.ts +2 -3
  61. package/lib/icon/font_icon.js +35 -39
  62. package/lib/icon/info.js +12 -12
  63. package/lib/icon/loading.js +9 -9
  64. package/lib/icon/moon.js +12 -12
  65. package/lib/icon/more.js +12 -12
  66. package/lib/icon/reduction.js +12 -12
  67. package/lib/icon/refresh.d.ts +5 -0
  68. package/lib/icon/refresh.js +10 -0
  69. package/lib/icon/refresh_left.js +12 -12
  70. package/lib/icon/refresh_right.js +9 -9
  71. package/lib/icon/search.js +9 -9
  72. package/lib/icon/select.js +12 -12
  73. package/lib/icon/sort.js +9 -9
  74. package/lib/icon/success.js +12 -12
  75. package/lib/icon/sun.js +12 -12
  76. package/lib/icon/theme_default.js +12 -12
  77. package/lib/icon/warn.js +12 -12
  78. package/lib/icon/zoom_in.js +12 -12
  79. package/lib/icon/zoom_out.js +12 -12
  80. package/lib/image/image_preview.js +2 -104
  81. package/lib/image/index.js +2 -176
  82. package/lib/image-CeQVfS-v.js +162 -0
  83. package/lib/image_preview-PzZzwo6m.js +92 -0
  84. package/lib/index.d.ts +10 -4
  85. package/lib/index.js +80 -169
  86. package/lib/input/index.d.ts +6 -2
  87. package/lib/input/index.js +188 -203
  88. package/lib/input-DjKxcxry.js +4 -0
  89. package/lib/input_inner-BKJg9n9A.js +4 -0
  90. package/lib/item-Cuw_ZPyn.js +14 -0
  91. package/lib/item-DV842Aux.js +57 -0
  92. package/lib/item-ZXLWFzSm.js +119 -0
  93. package/lib/list/index.js +2 -58
  94. package/lib/list-CU7vHS6s.js +51 -0
  95. package/lib/loading/index.d.ts +3 -2
  96. package/lib/loading/index.js +109 -127
  97. package/lib/mask/index.js +2 -105
  98. package/lib/mask-BlV5QfTj.js +112 -0
  99. package/lib/md_input/index.js +2 -60
  100. package/lib/md_input-DSQx5TMW.js +58 -0
  101. package/lib/menu/index.js +2 -105
  102. package/lib/menu/menu_item.js +2 -21
  103. package/lib/menu/sub_menu.js +2 -83
  104. package/lib/menu-DAtplYAH.js +91 -0
  105. package/lib/menu_item-BW1Tu11Q.js +20 -0
  106. package/lib/message/index.js +67 -60
  107. package/lib/modal/index.js +2 -196
  108. package/lib/modal/modal_box.js +87 -86
  109. package/lib/modal-DWyWrN-D.js +192 -0
  110. package/lib/page_header/index.js +2 -109
  111. package/lib/page_header-DdeRDN4U.js +101 -0
  112. package/lib/pagination/index.js +2 -248
  113. package/lib/pagination-BoPzSPjT.js +210 -0
  114. package/lib/polygon/index.js +2 -27
  115. package/lib/polygon-C4Ow2lxi.js +20 -0
  116. package/lib/qrcode/index.d.ts +13 -4
  117. package/lib/qrcode/index.js +2 -57
  118. package/lib/qrcode-BFxsD_OP.js +64 -0
  119. package/lib/radio-2mNSYujz.js +13 -0
  120. package/lib/select/index.js +3 -401
  121. package/lib/select-CAgggYh7.js +326 -0
  122. package/lib/select_ori/index.js +47 -50
  123. package/lib/space/index.js +2 -35
  124. package/lib/space-CpTmBfHP.js +38 -0
  125. package/lib/sub_menu-D1s8ABNu.js +75 -0
  126. package/lib/switch/index.js +2 -50
  127. package/lib/switch-BaVBi5Ip.js +48 -0
  128. package/lib/tabbar/index.js +2 -109
  129. package/lib/tabbar/item.js +2 -58
  130. package/lib/tabbar-4_d2Fj1n.js +91 -0
  131. package/lib/table/index.js +2 -269
  132. package/lib/table-Hifj8jAX.js +234 -0
  133. package/lib/tabs/index.js +38 -42
  134. package/lib/tag/index.js +2 -72
  135. package/lib/tag-DPENZf_V.js +76 -0
  136. package/lib/theme/index.js +2 -89
  137. package/lib/theme/theme_color.js +22 -26
  138. package/lib/theme-BRTI2-Yk.js +83 -0
  139. package/lib/utils/clickoutside.js +18 -18
  140. package/lib/utils/context_provide.js +21 -21
  141. package/lib/utils/event.js +13 -18
  142. package/lib/utils/index.js +55 -58
  143. package/lib/utils/popover.d.ts +4 -1
  144. package/lib/utils/popover.js +276 -352
  145. package/lib/utils/transition.js +33 -31
  146. package/package.json +10 -11
  147. package/styles/container.css +4 -0
  148. package/styles/datepicker.css +55 -0
  149. package/styles/popover.css +14 -1
  150. package/lib/animation-DttknHkX.js +0 -4
  151. package/lib/calendar/langs.js +0 -8
  152. package/lib/carousel/timer.js +0 -19
  153. package/lib/check/check.js +0 -118
  154. package/lib/check/index.js +0 -68
  155. package/lib/check-CksURvTv.js +0 -4
  156. package/lib/form/form_inner.js +0 -125
  157. package/lib/form/types.js +0 -1
  158. package/lib/index-CrMiSe0x.js +0 -249
  159. package/lib/index-DY6m9Wbe.js +0 -4
  160. package/lib/litos-ui.css +0 -1
  161. package/lib/table/types.js +0 -1
@@ -1,280 +1,2 @@
1
- import u from "../base.js";
2
- import { getAttr as m, on as l, $one as h, off as r, $$ as c, $ as p, iterate as f, shouldEventNext as v } from "ph-utils/dom";
3
- import { debounce as x } from "ph-utils/web";
4
- import { parseAttrValue as d } from "../utils/index.js";
5
- import b from "./timer.js";
6
- const g = ":host{display:block;width:100%;height:180px;margin:0 auto;box-sizing:border-box;position:relative;overflow:hidden}.container{min-width:900%;height:100%;box-sizing:border-box;position:relative;display:flex}.nav-button{position:absolute;top:50%;transform:translateY(-50%);width:30px;height:30px;border:none;outline:none;border-radius:50%;cursor:pointer;display:flex;justify-content:center;align-items:center;z-index:20;font-size:16px;background-color:#292d3d4d;margin:0;padding:0;color:#fff;transition:background-color .3s}.nav-button:hover{background-color:#292d3d66}.nav-button:active{background-color:#292d3d80}.nav-prev{left:20px}.nav-next{right:20px}.pagination{position:absolute;bottom:10px;left:0;width:100%;z-index:2;display:flex;align-items:center;gap:8px;justify-content:center}.bullet{display:inline-block;width:8px;height:8px;border-radius:50%;background-color:#0000004d;cursor:pointer;transition:background-color .3s}.bullet.active{background-color:var(--l-primary-color, #722ed1)}";
7
- class A extends u {
8
- static baseName = "carousel";
9
- /** 是否显示箭头 */
10
- arrows = "hover";
11
- currentIndex = 0;
12
- allIndex = -1;
13
- #s = 0;
14
- // 当前偏移量
15
- loop = !0;
16
- observer;
17
- autoplay = !1;
18
- #e = void 0;
19
- /* 手势 */
20
- #o = 0;
21
- #i = !1;
22
- #d = 0;
23
- #r = 0;
24
- // 节点引用
25
- #t;
26
- static get observedAttributes() {
27
- return ["arrows", "loop", "current-index", "autoplay"];
28
- }
29
- attributeChangedCallback(t, e, i) {
30
- switch (t) {
31
- case "arrows":
32
- const s = d(i, "hover");
33
- if (s !== this.arrows) {
34
- this.arrows = s;
35
- const a = document.createDocumentFragment();
36
- this.renderArrows(a), this.root.appendChild(a);
37
- }
38
- break;
39
- case "loop":
40
- this.loop = d(i, !1, "loop");
41
- break;
42
- case "current-index":
43
- const n = d(i, 0);
44
- n !== this.currentIndex && this.#x(this.loop ? n + 1 : n);
45
- break;
46
- case "autoplay":
47
- const o = d(i, !1, "autoplay");
48
- o !== this.autoplay && (this.autoplay = o, this.#e && (o ? this.#e.start() : this.#e.stop()));
49
- break;
50
- }
51
- }
52
- connectedCallback() {
53
- this.loadStyleText(g), this.style.setProperty(
54
- "--carousel-width",
55
- `${Math.floor(this.clientWidth)}px`
56
- );
57
- const t = m(this, "height");
58
- t && this.style.setProperty("height", `${t}px`), this.#m(), super.connectedCallback();
59
- }
60
- afterInit() {
61
- this.setAttribute("data-page", "__stop__"), l(this.root, "click", this.#v), this.#f(), this.#e = b(() => {
62
- this.#a("next");
63
- }), this.autoplay && this.#e.start(), this.#t = h(".container", this.root), l(this.#t, "pointerdown", this.#y), l(this.#t, "pointerup", this.#I), l(this.#t, "pointermove", this.#$), l(this.#t, "pointercancel", this.#n), l(this.#t, "pointerleave", this.#n);
64
- }
65
- beforeDestroy() {
66
- r(this, "mouseenter", this.#l), r(this, "mouseleave", this.#h), r(this.root, "click", this.#v), r(this.#t, "pointerdown", this.#y), r(this.#t, "pointerup", this.#I), r(this.#t, "pointermove", this.#$), r(this.#t, "pointercancel", this.#n), r(this.#t, "pointerleave", this.#n), this.#t = void 0, this.#u(!0), this.#e.stop(), this.#e = void 0;
67
- }
68
- render() {
69
- const t = document.createDocumentFragment();
70
- let e = "";
71
- if (this.allIndex > 0) {
72
- const n = this.loop ? this.currentIndex + 1 : this.currentIndex, o = Math.floor(n * this.clientWidth * -1);
73
- e = `transform:translateX(${o}px);`;
74
- const a = Math.floor(this.clientWidth * (this.allIndex + 3));
75
- e += `min-width:${a}px;`, this.#s = o;
76
- }
77
- const i = c("div", {
78
- class: "container",
79
- style: e,
80
- "data-container": "1"
81
- });
82
- i.appendChild(c("slot")), t.appendChild(i), this.renderArrows(t);
83
- const s = c("div", { class: "pagination", part: "pagination" });
84
- return this.allIndex >= 0 && s.replaceChildren(this.#p()), t.appendChild(s), t;
85
- }
86
- renderArrows(t) {
87
- if (this.arrows !== "never")
88
- this.renderNavigationButton("prev", t), this.renderNavigationButton("next", t), this.arrows === "hover" && (l(this, "mouseenter", this.#l), l(this, "mouseleave", this.#h));
89
- else {
90
- r(this, "mouseenter", this.#l), r(this, "mouseleave", this.#h);
91
- const e = p(".nav-button", this.root);
92
- e.length && f(e, (i) => {
93
- i.remove();
94
- });
95
- }
96
- }
97
- #p() {
98
- const t = document.createDocumentFragment();
99
- for (let e = 0; e <= this.allIndex; e++)
100
- t.appendChild(
101
- c("div", {
102
- class: ["bullet", e === this.currentIndex ? "active" : ""],
103
- "aria-label": `第 ${e + 1} 页`,
104
- "data-page": `${e}`,
105
- id: `bullet-${e}`
106
- })
107
- );
108
- return t;
109
- }
110
- renderNavigationButton(t = "prev", e) {
111
- let i = h(`.nav-${t}`, this.root);
112
- if (i == null) {
113
- const s = t === "prev" ? "left" : "right";
114
- i = c("button", {
115
- class: `nav-button nav-${t}`,
116
- type: "button",
117
- innerHTML: `<l-arrow-${s}-icon></l-arrow-${s}-icon>`,
118
- "aria-label": t,
119
- "data-page": t
120
- }), e.appendChild(i);
121
- }
122
- this.arrows === "always" ? i.style.display = "flex" : i.style.display = "none";
123
- }
124
- #f() {
125
- this.observer == null && (this.observer = new MutationObserver(this.#C)), this.observer.observe(this, { childList: !0 });
126
- }
127
- #u(t = !1) {
128
- this.observer && (this.observer.disconnect(), t && (this.observer = void 0));
129
- }
130
- #w = x(() => {
131
- const t = h("#cloneFirst", this);
132
- t && t.remove();
133
- const e = h("#cloneLast", this);
134
- if (e && e.remove(), this.#m(), this.#t) {
135
- if (this.allIndex > 0) {
136
- const o = Math.floor(
137
- this.clientWidth * (this.allIndex + 3)
138
- );
139
- this.#t.style.minWidth = `${o}px`;
140
- } else
141
- this.#t.style.minWidth = "900%";
142
- const s = this.loop ? this.currentIndex + 1 : this.currentIndex, n = Math.floor(s * this.clientWidth * -1);
143
- this.#t.style.transform = `translateX(${n}px)`, this.#s = n;
144
- }
145
- const i = h(".pagination", this.root);
146
- i && i.replaceChildren(this.#p()), this.#f();
147
- }, 300);
148
- #m() {
149
- const t = this.children, e = t.length;
150
- if (e > 0 && this.loop) {
151
- const i = t[0].cloneNode(!0);
152
- i.id = "cloneFirst";
153
- const s = t[e - 1].cloneNode(!0);
154
- s.id = "cloneLast", this.children[e - 1].insertAdjacentElement("afterend", i), this.children[0].insertAdjacentElement("beforebegin", s);
155
- }
156
- this.allIndex = this.children.length - (this.loop ? 3 : 1);
157
- }
158
- #C = (t) => {
159
- for (const e of t)
160
- e.type === "childList" && (this.#u(), this.#w());
161
- };
162
- #v = (t) => {
163
- const [e, i] = v(t, "data-page", this.root);
164
- e && this.#a(i);
165
- };
166
- #a(t) {
167
- this.#e.stop();
168
- const e = this.loop ? this.currentIndex + 1 : this.currentIndex;
169
- let i = e;
170
- if (t === "prev")
171
- this.loop && this.currentIndex === 0 ? i = 0 : i = e - 1, i < 0 && (i = 0);
172
- else if (t === "next")
173
- this.loop && this.currentIndex === this.allIndex ? i = this.allIndex + 2 : i = e + 1, !this.loop && i > this.allIndex && (i = this.allIndex);
174
- else {
175
- const s = Number(t);
176
- s !== this.currentIndex && (i = this.loop ? s + 1 : s);
177
- }
178
- i !== e && this.#x(i), requestAnimationFrame(() => {
179
- this.#c();
180
- });
181
- }
182
- #x(t) {
183
- if (this.#t) {
184
- const s = Math.floor(t * this.clientWidth * -1), n = this.#t.style.transform;
185
- this.#t.animate(
186
- [{ transform: n }, { transform: `translateX(${s}px)` }],
187
- { duration: 300 }
188
- ).addEventListener(
189
- "finish",
190
- () => {
191
- let a = s;
192
- this.loop && t === this.allIndex + 2 ? a = Math.floor(this.clientWidth * -1) : this.loop && t === 0 && (a = Math.floor(this.clientWidth * (this.allIndex + 1) * -1)), this.#t.style.transform = `translateX(${a}px)`, this.#s = a;
193
- },
194
- { once: !0 }
195
- );
196
- }
197
- this.loop && this.allIndex > 0 && t === this.allIndex + 2 ? this.currentIndex = 0 : this.loop && this.allIndex > 0 && t === 0 ? this.currentIndex = this.allIndex : this.currentIndex = this.loop ? t - 1 : t;
198
- const e = h(".bullet.active", this.root);
199
- e && e.classList.remove("active");
200
- const i = h(`#bullet-${this.currentIndex}`, this.root);
201
- i && i.classList.add("active");
202
- }
203
- #l = () => {
204
- if (this.arrows === "hover") {
205
- const t = p(".nav-button", this.root);
206
- f(t, (e) => {
207
- e.style.display = "flex", this.#b(e, !0);
208
- });
209
- }
210
- };
211
- #h = () => {
212
- if (this.arrows === "hover") {
213
- const t = p(".nav-button", this.root);
214
- f(t, (e) => {
215
- this.#b(e, !1);
216
- });
217
- }
218
- };
219
- #b(t, e = !0) {
220
- const s = t.getAttribute("data-page") === "prev" ? -10 : 10, n = [];
221
- e ? n.push(
222
- { opacity: 0, transform: `translate3d(${s}px, -50%, 0)` },
223
- { opacity: 1, transform: "translate3d(0px, -50%, 0)" }
224
- ) : n.push(
225
- { opacity: 1, transform: "translate3d(0px, -50%, 0)" },
226
- { opacity: 0, transform: `translate3d(${s}px, -50%, 0)` }
227
- );
228
- const o = t.animate(n, {
229
- duration: 300,
230
- fill: "both"
231
- });
232
- e || o.addEventListener(
233
- "finish",
234
- () => {
235
- t.style.display = "none";
236
- },
237
- { once: !0 }
238
- );
239
- }
240
- #g = () => {
241
- const t = h(".container", this.root);
242
- t.style.transition = "transform 0.3s", requestAnimationFrame(() => {
243
- t.style.transform = `translateX(${this.#s}px)`;
244
- }), t.addEventListener(
245
- "transitionend",
246
- () => {
247
- t.style.transition = "";
248
- },
249
- { once: !0 }
250
- );
251
- };
252
- #y = (t) => {
253
- this.#o = t.clientX, this.#i = !0, this.#d = Date.now(), this.#e.stop();
254
- };
255
- #$ = (t) => {
256
- this.#i && (this.#r && cancelAnimationFrame(this.#r), this.#r = requestAnimationFrame(() => {
257
- const e = Math.floor(t.clientX - this.#o);
258
- if (!this.loop && (e < 0 && this.currentIndex === this.allIndex || e > 0 && this.currentIndex === 0))
259
- return;
260
- const i = this.#s + e;
261
- this.#t.style.transform = `translateX(${i}px)`;
262
- }), t.preventDefault());
263
- };
264
- #I = (t) => {
265
- if (!this.#i) return;
266
- const e = Date.now() - this.#d, i = t.clientX - this.#o;
267
- if (this.#i = !1, i === 0) return;
268
- let s = "cancel";
269
- e <= 200 ? i >= 20 ? s = "prev" : i <= -20 && (s = "next") : i >= this.clientWidth / 2 ? s = "prev" : i <= -this.clientWidth / 2 && (s = "next"), s === "cancel" ? this.#g() : this.#a(s), this.#c();
270
- };
271
- #c = () => {
272
- this.autoplay && this.#e.start();
273
- };
274
- #n = () => {
275
- this.#i && (this.#i = !1, this.#g(), this.#c());
276
- };
277
- }
278
- export {
279
- A as default
280
- };
1
+ import { t as e } from "../carousel-D4Fe3LEx.js";
2
+ export { e as default };
@@ -1,15 +1,2 @@
1
- import e from "../base.js";
2
- import { $$ as t } from "ph-utils/dom";
3
- const o = ":host{width:var(--carousel-width, 100%);height:100%;box-sizing:border-box;display:block}:host(.active){display:block}";
4
- class r extends e {
5
- static baseName = "carousel-item";
6
- connectedCallback() {
7
- this.loadStyleText(o), super.connectedCallback();
8
- }
9
- render() {
10
- return t("slot");
11
- }
12
- }
13
- export {
14
- r as default
15
- };
1
+ import { t as e } from "../item-Cuw_ZPyn.js";
2
+ export { e as default };
@@ -0,0 +1,272 @@
1
+ import e from "./base.js";
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";
5
+ //#region src/components/carousel/index.less?inline
6
+ 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
+ //#endregion
8
+ //#region src/components/carousel/timer.ts
9
+ function f(e, t = 3e3) {
10
+ let n = 0, r = !1, i = null;
11
+ function a() {
12
+ r || (r = !0, n = 0, i = requestAnimationFrame(s));
13
+ }
14
+ function o() {
15
+ r = !1, i &&= (cancelAnimationFrame(i), null);
16
+ }
17
+ function s(a) {
18
+ r && (n ||= a, a - n >= t && (e(), n = a), i = requestAnimationFrame(s));
19
+ }
20
+ return {
21
+ start: a,
22
+ stop: o
23
+ };
24
+ }
25
+ //#endregion
26
+ //#region src/components/carousel/index.ts
27
+ var p = class extends e {
28
+ static baseName = "carousel";
29
+ arrows = "hover";
30
+ currentIndex = 0;
31
+ allIndex = -1;
32
+ #e = 0;
33
+ loop = !0;
34
+ observer;
35
+ autoplay = !1;
36
+ #t = void 0;
37
+ #n = 0;
38
+ #r = !1;
39
+ #i = 0;
40
+ #a = 0;
41
+ #o;
42
+ static get observedAttributes() {
43
+ return [
44
+ "arrows",
45
+ "loop",
46
+ "current-index",
47
+ "autoplay"
48
+ ];
49
+ }
50
+ attributeChangedCallback(e, n, r) {
51
+ switch (e) {
52
+ case "arrows":
53
+ let e = t(r, "hover");
54
+ if (e !== this.arrows) {
55
+ this.arrows = e;
56
+ let t = document.createDocumentFragment();
57
+ this.renderArrows(t), this.root.appendChild(t);
58
+ }
59
+ break;
60
+ case "loop":
61
+ this.loop = t(r, !1, "loop");
62
+ break;
63
+ case "current-index":
64
+ let n = t(r, 0);
65
+ n !== this.currentIndex && this.#h(this.loop ? n + 1 : n);
66
+ break;
67
+ case "autoplay":
68
+ let i = t(r, !1, "autoplay");
69
+ i !== this.autoplay && (this.autoplay = i, this.#t && (i ? this.#t.start() : this.#t.stop()));
70
+ break;
71
+ }
72
+ }
73
+ connectedCallback() {
74
+ this.loadStyleText(d), this.style.setProperty("--carousel-width", `${Math.floor(this.clientWidth)}px`);
75
+ let e = a(this, "height");
76
+ e && this.style.setProperty("height", `${e}px`), this.#d(), super.connectedCallback();
77
+ }
78
+ afterInit() {
79
+ this.setAttribute("data-page", "__stop__"), c(this.root, "click", this.#p), this.#c(), this.#t = f(() => {
80
+ 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);
82
+ }
83
+ 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;
85
+ }
86
+ render() {
87
+ let e = document.createDocumentFragment(), t = "";
88
+ if (this.allIndex > 0) {
89
+ let e = this.loop ? this.currentIndex + 1 : this.currentIndex, n = Math.floor(e * this.clientWidth * -1);
90
+ t = `transform:translateX(${n}px);`;
91
+ let r = Math.floor(this.clientWidth * (this.allIndex + 3));
92
+ t += `min-width:${r}px;`, this.#e = n;
93
+ }
94
+ let n = r("div", {
95
+ class: "container",
96
+ style: t,
97
+ "data-container": "1"
98
+ });
99
+ n.appendChild(r("slot")), e.appendChild(n), this.renderArrows(e);
100
+ let i = r("div", {
101
+ class: "pagination",
102
+ part: "pagination"
103
+ });
104
+ return this.allIndex >= 0 && i.replaceChildren(this.#s()), e.appendChild(i), e;
105
+ }
106
+ 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.#_));
108
+ else {
109
+ s(this, "mouseenter", this.#g), s(this, "mouseleave", this.#_);
110
+ let e = n(".nav-button", this.root);
111
+ e.length && o(e, (e) => {
112
+ e.remove();
113
+ });
114
+ }
115
+ }
116
+ #s() {
117
+ let e = document.createDocumentFragment();
118
+ for (let t = 0; t <= this.allIndex; t++) e.appendChild(r("div", {
119
+ class: ["bullet", t === this.currentIndex ? "active" : ""],
120
+ "aria-label": `第 ${t + 1} 页`,
121
+ "data-page": `${t}`,
122
+ id: `bullet-${t}`
123
+ }));
124
+ return e;
125
+ }
126
+ renderNavigationButton(e = "prev", t) {
127
+ let n = i(`.nav-${e}`, this.root);
128
+ if (n == null) {
129
+ let i = e === "prev" ? "left" : "right";
130
+ n = r("button", {
131
+ class: `nav-button nav-${e}`,
132
+ type: "button",
133
+ innerHTML: `<l-arrow-${i}-icon></l-arrow-${i}-icon>`,
134
+ "aria-label": e,
135
+ "data-page": e
136
+ }), t.appendChild(n);
137
+ }
138
+ this.arrows === "always" ? n.style.display = "flex" : n.style.display = "none";
139
+ }
140
+ #c() {
141
+ this.observer ??= new MutationObserver(this.#f), this.observer.observe(this, { childList: !0 });
142
+ }
143
+ #l(e = !1) {
144
+ this.observer && (this.observer.disconnect(), e && (this.observer = void 0));
145
+ }
146
+ #u = u(() => {
147
+ let e = i("#cloneFirst", this);
148
+ e && e.remove();
149
+ let t = i("#cloneLast", this);
150
+ if (t && t.remove(), this.#d(), this.#o) {
151
+ if (this.allIndex > 0) {
152
+ let e = Math.floor(this.clientWidth * (this.allIndex + 3));
153
+ this.#o.style.minWidth = `${e}px`;
154
+ } else this.#o.style.minWidth = "900%";
155
+ let e = this.loop ? this.currentIndex + 1 : this.currentIndex, t = Math.floor(e * this.clientWidth * -1);
156
+ this.#o.style.transform = `translateX(${t}px)`, this.#e = t;
157
+ }
158
+ let n = i(".pagination", this.root);
159
+ n && n.replaceChildren(this.#s()), this.#c();
160
+ }, 300);
161
+ #d() {
162
+ let e = this.children, t = e.length;
163
+ if (t > 0 && this.loop) {
164
+ let n = e[0].cloneNode(!0);
165
+ n.id = "cloneFirst";
166
+ let r = e[t - 1].cloneNode(!0);
167
+ r.id = "cloneLast", this.children[t - 1].insertAdjacentElement("afterend", n), this.children[0].insertAdjacentElement("beforebegin", r);
168
+ }
169
+ this.allIndex = this.children.length - (this.loop ? 3 : 1);
170
+ }
171
+ #f = (e) => {
172
+ for (let t of e) t.type === "childList" && (this.#l(), this.#u());
173
+ };
174
+ #p = (e) => {
175
+ let [t, n] = l(e, "data-page", this.root);
176
+ t && this.#m(n);
177
+ };
178
+ #m(e) {
179
+ this.#t.stop();
180
+ let t = this.loop ? this.currentIndex + 1 : this.currentIndex, n = t;
181
+ if (e === "prev") n = this.loop && this.currentIndex === 0 ? 0 : t - 1, n < 0 && (n = 0);
182
+ else if (e === "next") n = this.loop && this.currentIndex === this.allIndex ? this.allIndex + 2 : t + 1, !this.loop && n > this.allIndex && (n = this.allIndex);
183
+ else {
184
+ let t = Number(e);
185
+ t !== this.currentIndex && (n = this.loop ? t + 1 : t);
186
+ }
187
+ n !== t && this.#h(n), requestAnimationFrame(() => {
188
+ this.#C();
189
+ });
190
+ }
191
+ #h(e) {
192
+ if (this.#o) {
193
+ let t = Math.floor(e * this.clientWidth * -1), n = this.#o.style.transform;
194
+ this.#o.animate([{ transform: n }, { transform: `translateX(${t}px)` }], { duration: 300 }).addEventListener("finish", () => {
195
+ let n = t;
196
+ 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
+ }, { once: !0 });
198
+ }
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;
200
+ let t = i(".bullet.active", this.root);
201
+ t && t.classList.remove("active");
202
+ let n = i(`#bullet-${this.currentIndex}`, this.root);
203
+ n && n.classList.add("active");
204
+ }
205
+ #g = () => {
206
+ this.arrows === "hover" && o(n(".nav-button", this.root), (e) => {
207
+ e.style.display = "flex", this.#v(e, !0);
208
+ });
209
+ };
210
+ #_ = () => {
211
+ this.arrows === "hover" && o(n(".nav-button", this.root), (e) => {
212
+ this.#v(e, !1);
213
+ });
214
+ };
215
+ #v(e, t = !0) {
216
+ let n = e.getAttribute("data-page") === "prev" ? -10 : 10, r = [];
217
+ t ? r.push({
218
+ opacity: 0,
219
+ transform: `translate3d(${n}px, -50%, 0)`
220
+ }, {
221
+ opacity: 1,
222
+ transform: "translate3d(0px, -50%, 0)"
223
+ }) : r.push({
224
+ opacity: 1,
225
+ transform: "translate3d(0px, -50%, 0)"
226
+ }, {
227
+ opacity: 0,
228
+ transform: `translate3d(${n}px, -50%, 0)`
229
+ });
230
+ let i = e.animate(r, {
231
+ duration: 300,
232
+ fill: "both"
233
+ });
234
+ t || i.addEventListener("finish", () => {
235
+ e.style.display = "none";
236
+ }, { once: !0 });
237
+ }
238
+ #y = () => {
239
+ let e = i(".container", this.root);
240
+ e.style.transition = "transform 0.3s", requestAnimationFrame(() => {
241
+ e.style.transform = `translateX(${this.#e}px)`;
242
+ }), e.addEventListener("transitionend", () => {
243
+ e.style.transition = "";
244
+ }, { once: !0 });
245
+ };
246
+ #b = (e) => {
247
+ this.#n = e.clientX, this.#r = !0, this.#i = Date.now(), this.#t.stop();
248
+ };
249
+ #x = (e) => {
250
+ this.#r && (this.#a && cancelAnimationFrame(this.#a), this.#a = requestAnimationFrame(() => {
251
+ let t = Math.floor(e.clientX - this.#n);
252
+ if (!this.loop && (t < 0 && this.currentIndex === this.allIndex || t > 0 && this.currentIndex === 0)) return;
253
+ let n = this.#e + t;
254
+ this.#o.style.transform = `translateX(${n}px)`;
255
+ }), e.preventDefault());
256
+ };
257
+ #S = (e) => {
258
+ if (!this.#r) return;
259
+ let t = Date.now() - this.#i, n = e.clientX - this.#n;
260
+ if (this.#r = !1, n === 0) return;
261
+ let r = "cancel";
262
+ t <= 200 ? n >= 20 ? r = "prev" : n <= -20 && (r = "next") : n >= this.clientWidth / 2 ? r = "prev" : n <= -this.clientWidth / 2 && (r = "next"), r === "cancel" ? this.#y() : this.#m(r), this.#C();
263
+ };
264
+ #C = () => {
265
+ this.autoplay && this.#t.start();
266
+ };
267
+ #w = () => {
268
+ this.#r && (this.#r = !1, this.#y(), this.#C());
269
+ };
270
+ };
271
+ //#endregion
272
+ export { p as t };
@@ -1,18 +1,2 @@
1
- import e from "./check.js";
2
- import { c as r } from "../check-CksURvTv.js";
3
- const o = ':host(.is-indeterminate) .l-check__inner{background-color:var(--l-primary-color, #722ed1)}:host(.is-indeterminate) .l-check__inner:after{content:"";width:calc(var(--l-check-size) * .4);height:1px;display:block;border:1px solid #fff;border-right:none;border-top:none;border-left:none;transform:rotate(0);margin-top:0}.l-check__inner:after,:host(.is-checked) .l-check__inner:after{content:"";width:calc(var(--l-check-size) * .6);height:calc(var(--l-check-size) * .3);display:block;border:solid 1px transparent;border-right:none;border-top:none;transform:rotate(-45deg);transition:border-color .2s ease-in-out;margin-top:-3px}:host(.is-checked) .l-check__inner{background-color:var(--l-primary-color, #722ed1)}:host(.is-checked) .l-check__inner:after{border-color:#fff}:host(.is-disabled) .l-check__inner{background-color:var(--l-disabled-color, #e6e6e6);border-color:var(--l-disabled-color, #e6e6e6)}';
4
- class i extends e {
5
- static baseName = "checkbox";
6
- constructor() {
7
- super(), this._inputType = "checkbox";
8
- }
9
- connectedCallback() {
10
- this.loadStyleText([r, o]), super.connectedCallback();
11
- }
12
- _doChangeAction() {
13
- this.getChecked() ? this.setChecked(!1) : this.setChecked(!0), this.emitChange();
14
- }
15
- }
16
- export {
17
- i as default
18
- };
1
+ import { t as e } from "../checkbox-DbWsmAaL.js";
2
+ export { e as default };
@@ -1,7 +1,7 @@
1
- import e from "./index.js";
2
- class c extends e {
3
- static baseName = "checkbox-group";
4
- }
5
- export {
6
- c as default
1
+ import { t as e } from "../check-B0XraJvb.js";
2
+ //#region src/components/check/checkbox_group.ts
3
+ var t = class extends e {
4
+ static baseName = "checkbox-group";
7
5
  };
6
+ //#endregion
7
+ export { t as default };
@@ -1,15 +1,2 @@
1
- import e from "./check.js";
2
- import { c as r } from "../check-CksURvTv.js";
3
- const o = '.l-check__inner{border-radius:50%}.l-check__inner:after{content:"";display:block;width:60%;height:60%;background-color:transparent;border-radius:50%;transition:background-color .3s ease-in-out}:host(.is-checked) .l-check__inner:after{background-color:var(--l-primary-color, #722ed1)}:host(.is-disabled) .l-check__inner{border-color:var(--l-disabled-color, #e6e6e6)}:host(.is-disabled) .l-check__inner:after{background-color:var(--l-disabled-color, #e6e6e6)}';
4
- class t extends e {
5
- static baseName = "radio";
6
- connectedCallback() {
7
- this.loadStyleText([r, o]), super.connectedCallback();
8
- }
9
- _doChangeAction() {
10
- this.setChecked(!0), this.emitChange();
11
- }
12
- }
13
- export {
14
- t as default
15
- };
1
+ import { t as e } from "../radio-2mNSYujz.js";
2
+ export { e as default };
@@ -1,10 +1,10 @@
1
- import e from "./index.js";
2
- class s extends e {
3
- static baseName = "radio-group";
4
- constructor() {
5
- super(), this.multiple = !1;
6
- }
7
- }
8
- export {
9
- s as default
1
+ import { t as e } from "../check-B0XraJvb.js";
2
+ //#region src/components/check/radio_group.ts
3
+ var t = class extends e {
4
+ static baseName = "radio-group";
5
+ constructor() {
6
+ super(), this.multiple = !1;
7
+ }
10
8
  };
9
+ //#endregion
10
+ export { t as default };