@cghbcf/xp-ui 1.0.0 → 1.1.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.
@@ -0,0 +1,2133 @@
1
+ import { ref as z, openBlock as a, createBlock as R, Transition as D, withCtx as E, createElementBlock as r, normalizeClass as B, createElementVNode as o, toDisplayString as k, renderSlot as b, createTextVNode as W, createCommentVNode as g, computed as M, normalizeStyle as T, onUnmounted as ie, Teleport as H, createVNode as A, withModifiers as j, Fragment as _, renderList as V, watch as re, onMounted as de, onBeforeUnmount as Q, nextTick as ue, inject as _e, provide as ke, reactive as $e, unref as ce, TransitionGroup as we } from "vue";
2
+ const C = (e, n) => {
3
+ const t = e.__vccOpts || e;
4
+ for (const [s, l] of n)
5
+ t[s] = l;
6
+ return t;
7
+ }, Ce = { class: "xp-alert__icon" }, Se = { class: "xp-alert__content" }, ze = { class: "xp-alert__title" }, Be = {
8
+ key: 0,
9
+ class: "xp-alert__description"
10
+ }, Me = {
11
+ __name: "Alert",
12
+ props: {
13
+ title: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ type: {
18
+ type: String,
19
+ default: "info",
20
+ validator: (e) => ["success", "warning", "danger", "info"].includes(e)
21
+ },
22
+ effect: {
23
+ type: String,
24
+ default: "light",
25
+ validator: (e) => ["light", "dark", "plain"].includes(e)
26
+ },
27
+ closable: {
28
+ type: Boolean,
29
+ default: !0
30
+ },
31
+ showIcon: {
32
+ type: Boolean,
33
+ default: !0
34
+ }
35
+ },
36
+ emits: ["close"],
37
+ setup(e, { emit: n }) {
38
+ const t = n, s = z(!0), l = {
39
+ success: "✓",
40
+ warning: "!",
41
+ danger: "×",
42
+ info: "i"
43
+ }, u = () => {
44
+ s.value = !1, t("close");
45
+ };
46
+ return (d, x) => (a(), R(D, { name: "xp-alert-fade" }, {
47
+ default: E(() => [
48
+ s.value ? (a(), r("div", {
49
+ key: 0,
50
+ class: B(["xp-alert", [
51
+ `xp-alert--${e.type}`,
52
+ `xp-alert--${e.effect}`,
53
+ { "xp-alert--plain": e.effect === "plain" }
54
+ ]]),
55
+ role: "alert"
56
+ }, [
57
+ o("span", Ce, k(l[e.type]), 1),
58
+ o("div", Se, [
59
+ o("span", ze, [
60
+ b(d.$slots, "default", {}, () => [
61
+ W(k(e.title), 1)
62
+ ], !0)
63
+ ]),
64
+ d.$slots.default ? (a(), r("p", Be, [
65
+ b(d.$slots, "default", {}, void 0, !0)
66
+ ])) : g("", !0)
67
+ ]),
68
+ e.closable ? (a(), r("i", {
69
+ key: 0,
70
+ class: "xp-alert__close-btn",
71
+ onClick: u
72
+ }, "×")) : g("", !0)
73
+ ], 2)) : g("", !0)
74
+ ]),
75
+ _: 3
76
+ }));
77
+ }
78
+ }, Ie = /* @__PURE__ */ C(Me, [["__scopeId", "data-v-91d792bd"]]), Te = ["src", "alt"], Ve = {
79
+ key: 1,
80
+ class: "xp-avatar__slot"
81
+ }, Ee = {
82
+ key: 2,
83
+ class: "xp-avatar__text"
84
+ }, Ae = {
85
+ __name: "Avatar",
86
+ props: {
87
+ src: {
88
+ type: String,
89
+ default: ""
90
+ },
91
+ alt: {
92
+ type: String,
93
+ default: ""
94
+ },
95
+ shape: {
96
+ type: String,
97
+ default: "circle",
98
+ validator: (e) => ["circle", "square"].includes(e)
99
+ },
100
+ size: {
101
+ type: String,
102
+ default: "medium",
103
+ validator: (e) => ["small", "medium", "large"].includes(e)
104
+ },
105
+ icon: {
106
+ type: String,
107
+ default: ""
108
+ }
109
+ },
110
+ emits: ["error"],
111
+ setup(e, { emit: n }) {
112
+ const t = e, s = n, l = z(!1), u = M(() => ({
113
+ backgroundColor: t.src ? "transparent" : "var(--xp-color-primary-bg)",
114
+ color: t.src ? void 0 : "var(--xp-color-primary)"
115
+ })), d = () => {
116
+ l.value = !0, s("error");
117
+ };
118
+ return (x, m) => (a(), r("span", {
119
+ class: B(["xp-avatar", [
120
+ `xp-avatar--${e.shape}`,
121
+ `xp-avatar--${e.size}`,
122
+ { "xp-avatar--fit": e.src }
123
+ ]]),
124
+ style: T(u.value)
125
+ }, [
126
+ e.src && !l.value ? (a(), r("img", {
127
+ key: 0,
128
+ src: e.src,
129
+ alt: e.alt,
130
+ onError: d
131
+ }, null, 40, Te)) : x.$slots.default ? (a(), r("span", Ve, [
132
+ b(x.$slots, "default", {}, void 0, !0)
133
+ ])) : (a(), r("span", Ee, k(e.alt || "A"), 1))
134
+ ], 6));
135
+ }
136
+ }, De = /* @__PURE__ */ C(Ae, [["__scopeId", "data-v-a9a54bc5"]]), je = { key: 0 }, Ne = {
137
+ __name: "Badge",
138
+ props: {
139
+ value: {
140
+ type: [String, Number],
141
+ default: 0
142
+ },
143
+ max: {
144
+ type: Number,
145
+ default: 99
146
+ },
147
+ type: {
148
+ type: String,
149
+ default: "danger",
150
+ validator: (e) => ["primary", "success", "warning", "danger", "info"].includes(e)
151
+ },
152
+ isDot: {
153
+ type: Boolean,
154
+ default: !1
155
+ },
156
+ hidden: {
157
+ type: Boolean,
158
+ default: !1
159
+ }
160
+ },
161
+ setup(e) {
162
+ const n = e, t = M(() => typeof n.value == "number" && n.value > n.max ? `${n.max}+` : n.value), s = M(() => n.value !== 0 && n.value !== "" && n.value !== null && n.value !== void 0);
163
+ return (l, u) => (a(), r("div", {
164
+ class: B(["xp-badge", { "xp-badge--dot": e.isDot, "xp-badge--hidden": e.hidden }])
165
+ }, [
166
+ b(l.$slots, "default", {}, void 0, !0),
167
+ !e.hidden && (e.isDot || s.value) ? (a(), r("sup", {
168
+ key: 0,
169
+ class: B(["xp-badge__content", [
170
+ `xp-badge__content--${e.type}`,
171
+ { "xp-badge__content--dot": e.isDot }
172
+ ]])
173
+ }, [
174
+ e.isDot ? g("", !0) : (a(), r("span", je, k(t.value), 1))
175
+ ], 2)) : g("", !0)
176
+ ], 2));
177
+ }
178
+ }, Fe = /* @__PURE__ */ C(Ne, [["__scopeId", "data-v-207db6dd"]]), Re = ["disabled"], Oe = {
179
+ key: 0,
180
+ class: "xp-button__loading"
181
+ }, Xe = { class: "xp-button__text" }, Le = {
182
+ __name: "Button",
183
+ props: {
184
+ type: {
185
+ type: String,
186
+ default: "default",
187
+ validator: (e) => ["primary", "default", "success", "warning", "danger", "info", "ghost"].includes(e)
188
+ },
189
+ size: {
190
+ type: String,
191
+ default: "medium",
192
+ validator: (e) => ["small", "medium", "large"].includes(e)
193
+ },
194
+ disabled: {
195
+ type: Boolean,
196
+ default: !1
197
+ },
198
+ loading: {
199
+ type: Boolean,
200
+ default: !1
201
+ },
202
+ plain: {
203
+ type: Boolean,
204
+ default: !1
205
+ },
206
+ text: {
207
+ type: Boolean,
208
+ default: !1
209
+ }
210
+ },
211
+ emits: ["click"],
212
+ setup(e, { emit: n }) {
213
+ const t = e, s = n, l = (u) => {
214
+ !t.disabled && !t.loading && s("click", u);
215
+ };
216
+ return (u, d) => (a(), r("button", {
217
+ class: B(["xp-button", [
218
+ `xp-button--${e.type}`,
219
+ `xp-button--${e.size}`,
220
+ {
221
+ "xp-button--disabled": e.disabled,
222
+ "xp-button--loading": e.loading,
223
+ "xp-button--plain": e.plain,
224
+ "xp-button--text": e.text
225
+ }
226
+ ]]),
227
+ disabled: e.disabled || e.loading,
228
+ onClick: l
229
+ }, [
230
+ e.loading ? (a(), r("span", Oe)) : g("", !0),
231
+ o("span", Xe, [
232
+ b(u.$slots, "default", {}, void 0, !0)
233
+ ])
234
+ ], 10, Re));
235
+ }
236
+ }, K = /* @__PURE__ */ C(Le, [["__scopeId", "data-v-9c6bc634"]]), Pe = {
237
+ key: 0,
238
+ class: "xp-card__header"
239
+ }, We = { class: "xp-card__title" }, Je = {
240
+ key: 0,
241
+ class: "xp-card__extra"
242
+ }, He = { class: "xp-card__body" }, Ue = {
243
+ key: 1,
244
+ class: "xp-card__footer"
245
+ }, Ge = {
246
+ __name: "Card",
247
+ props: {
248
+ title: {
249
+ type: String,
250
+ default: ""
251
+ },
252
+ shadow: {
253
+ type: String,
254
+ default: "always",
255
+ validator: (e) => ["always", "hover", "never"].includes(e)
256
+ },
257
+ bordered: {
258
+ type: Boolean,
259
+ default: !0
260
+ },
261
+ hover: {
262
+ type: Boolean,
263
+ default: !1
264
+ }
265
+ },
266
+ setup(e) {
267
+ return (n, t) => (a(), r("div", {
268
+ class: B(["xp-card", [
269
+ `xp-card--${e.shadow}`,
270
+ {
271
+ "xp-card--bordered": e.bordered,
272
+ "xp-card--hover": e.hover
273
+ }
274
+ ]])
275
+ }, [
276
+ e.title || n.$slots.header ? (a(), r("div", Pe, [
277
+ b(n.$slots, "header", {}, () => [
278
+ o("h3", We, k(e.title), 1)
279
+ ], !0),
280
+ n.$slots.extra ? (a(), r("div", Je, [
281
+ b(n.$slots, "extra", {}, void 0, !0)
282
+ ])) : g("", !0)
283
+ ])) : g("", !0),
284
+ o("div", He, [
285
+ b(n.$slots, "default", {}, void 0, !0)
286
+ ]),
287
+ n.$slots.footer ? (a(), r("div", Ue, [
288
+ b(n.$slots, "footer", {}, void 0, !0)
289
+ ])) : g("", !0)
290
+ ], 2));
291
+ }
292
+ }, qe = /* @__PURE__ */ C(Ge, [["__scopeId", "data-v-e65cbe05"]]), Ye = { class: "xp-checkbox__input" }, Ke = ["checked", "disabled", ".indeterminate"], Ze = { class: "xp-checkbox__label" }, Qe = {
293
+ __name: "Checkbox",
294
+ props: {
295
+ modelValue: {
296
+ type: Boolean,
297
+ default: !1
298
+ },
299
+ disabled: {
300
+ type: Boolean,
301
+ default: !1
302
+ },
303
+ indeterminate: {
304
+ type: Boolean,
305
+ default: !1
306
+ }
307
+ },
308
+ emits: ["update:modelValue", "change"],
309
+ setup(e, { emit: n }) {
310
+ const t = e, s = n, l = (u) => {
311
+ if (t.disabled) return;
312
+ const d = u.target.checked;
313
+ s("update:modelValue", d), s("change", d);
314
+ };
315
+ return (u, d) => (a(), r("label", {
316
+ class: B(["xp-checkbox", [
317
+ {
318
+ "xp-checkbox--checked": e.modelValue,
319
+ "xp-checkbox--disabled": e.disabled,
320
+ "xp-checkbox--indeterminate": e.indeterminate
321
+ }
322
+ ]])
323
+ }, [
324
+ o("span", Ye, [
325
+ d[0] || (d[0] = o("span", { class: "xp-checkbox__inner" }, null, -1)),
326
+ o("input", {
327
+ type: "checkbox",
328
+ class: "xp-checkbox__original",
329
+ checked: e.modelValue,
330
+ disabled: e.disabled,
331
+ onChange: l,
332
+ ".indeterminate": e.indeterminate
333
+ }, null, 40, Ke)
334
+ ]),
335
+ o("span", Ze, [
336
+ b(u.$slots, "default", {}, void 0, !0)
337
+ ])
338
+ ], 2));
339
+ }
340
+ }, et = /* @__PURE__ */ C(Qe, [["__scopeId", "data-v-7c078f46"]]), tt = {
341
+ key: 0,
342
+ class: "xp-menu__divider"
343
+ }, nt = ["disabled", "onClick"], ot = {
344
+ key: 0,
345
+ class: "xp-menu__icon",
346
+ "aria-hidden": "true"
347
+ }, st = { class: "xp-menu__label" }, lt = {
348
+ __name: "ContextMenu",
349
+ props: {
350
+ visible: { type: Boolean, default: !1 },
351
+ x: { type: Number, default: 0 },
352
+ y: { type: Number, default: 0 },
353
+ /**
354
+ * 菜单项:{ label, icon?, command?, danger?, disabled?, divider?, onClick? }
355
+ * divider 为 true 时渲染分隔线;select / command 事件与 onClick 三者按需使用
356
+ */
357
+ items: { type: Array, default: () => [] }
358
+ },
359
+ emits: ["close", "select", "command"],
360
+ setup(e, { emit: n }) {
361
+ const t = e, s = n;
362
+ z(null);
363
+ const l = M(() => {
364
+ const f = Math.min(t.items.filter((h) => !h.divider).length, 12) * 32 + 12;
365
+ let i = t.x, c = t.y;
366
+ return i + 220 > window.innerWidth - 8 && (i = Math.max(8, window.innerWidth - 220 - 8)), c + f > window.innerHeight - 8 && (c = Math.max(8, window.innerHeight - f - 8)), { left: `${i}px`, top: `${c}px` };
367
+ });
368
+ function u() {
369
+ s("close");
370
+ }
371
+ function d(m) {
372
+ m.disabled || (s("close"), s("select", m), s("command", m.command), m.onClick && m.onClick());
373
+ }
374
+ function x(m) {
375
+ m.key === "Escape" && t.visible && s("close");
376
+ }
377
+ return ie(() => window.removeEventListener("keydown", x)), (m, f) => (a(), R(H, { to: "body" }, [
378
+ A(D, { name: "xp-menu" }, {
379
+ default: E(() => [
380
+ e.visible ? (a(), r("div", {
381
+ key: 0,
382
+ class: "xp-menu-mask",
383
+ onMousedown: u,
384
+ onContextmenu: f[2] || (f[2] = j(() => {
385
+ }, ["prevent"]))
386
+ }, [
387
+ o("div", {
388
+ class: "xp-menu",
389
+ style: T(l.value),
390
+ role: "menu",
391
+ onMousedown: f[0] || (f[0] = j(() => {
392
+ }, ["stop"])),
393
+ onMouseup: f[1] || (f[1] = j(() => {
394
+ }, ["stop"]))
395
+ }, [
396
+ (a(!0), r(_, null, V(e.items, (i, c) => (a(), r(_, { key: c }, [
397
+ i.divider ? (a(), r("div", tt)) : (a(), r("button", {
398
+ key: 1,
399
+ class: B(["xp-menu__item", { "xp-menu__item--danger": i.danger, "xp-menu__item--disabled": i.disabled }]),
400
+ role: "menuitem",
401
+ disabled: i.disabled,
402
+ onClick: (h) => d(i)
403
+ }, [
404
+ i.icon ? (a(), r("span", ot, k(i.icon), 1)) : g("", !0),
405
+ o("span", st, k(i.label), 1)
406
+ ], 10, nt))
407
+ ], 64))), 128))
408
+ ], 36)
409
+ ], 32)) : g("", !0)
410
+ ]),
411
+ _: 1
412
+ })
413
+ ]));
414
+ }
415
+ }, at = /* @__PURE__ */ C(lt, [["__scopeId", "data-v-7477a575"]]), it = { class: "xp-dialog__header" }, rt = { class: "xp-dialog__title" }, dt = { class: "xp-dialog__body" }, ut = {
416
+ key: 0,
417
+ class: "xp-dialog__footer"
418
+ }, ct = {
419
+ __name: "Dialog",
420
+ props: {
421
+ visible: {
422
+ type: Boolean,
423
+ default: !1
424
+ },
425
+ title: {
426
+ type: String,
427
+ default: ""
428
+ },
429
+ width: {
430
+ type: String,
431
+ default: "500px"
432
+ },
433
+ confirmButtonText: {
434
+ type: String,
435
+ default: "确定"
436
+ },
437
+ cancelButtonText: {
438
+ type: String,
439
+ default: "取消"
440
+ },
441
+ closeOnClickModal: {
442
+ type: Boolean,
443
+ default: !0
444
+ },
445
+ showDefaultFooter: {
446
+ type: Boolean,
447
+ default: !0
448
+ }
449
+ },
450
+ emits: ["confirm", "cancel", "update:visible", "close"],
451
+ setup(e, { emit: n }) {
452
+ const t = e, s = n, l = () => {
453
+ s("update:visible", !1), s("close");
454
+ }, u = () => {
455
+ t.closeOnClickModal && l();
456
+ }, d = () => {
457
+ s("confirm"), l();
458
+ }, x = () => {
459
+ s("cancel"), l();
460
+ };
461
+ function m(f) {
462
+ f.key === "Escape" && t.visible && l();
463
+ }
464
+ return re(
465
+ () => t.visible,
466
+ (f) => {
467
+ f ? window.addEventListener("keydown", m) : window.removeEventListener("keydown", m);
468
+ }
469
+ ), ie(() => window.removeEventListener("keydown", m)), (f, i) => (a(), R(H, { to: "body" }, [
470
+ A(D, { name: "xp-dialog-fade" }, {
471
+ default: E(() => [
472
+ e.visible ? (a(), r("div", {
473
+ key: 0,
474
+ class: "xp-dialog__wrapper",
475
+ onClick: j(u, ["self"])
476
+ }, [
477
+ i[0] || (i[0] = o("div", { class: "xp-dialog__mask" }, null, -1)),
478
+ A(D, {
479
+ name: "xp-dialog-slide",
480
+ appear: ""
481
+ }, {
482
+ default: E(() => [
483
+ e.visible ? (a(), r("div", {
484
+ key: 0,
485
+ class: "xp-dialog",
486
+ style: T({ width: e.width })
487
+ }, [
488
+ o("div", it, [
489
+ o("h3", rt, k(e.title), 1),
490
+ o("button", {
491
+ class: "xp-dialog__close",
492
+ onClick: l
493
+ }, "×")
494
+ ]),
495
+ o("div", dt, [
496
+ b(f.$slots, "default", {}, void 0, !0)
497
+ ]),
498
+ f.$slots.footer || e.showDefaultFooter ? (a(), r("div", ut, [
499
+ b(f.$slots, "footer", {}, () => [
500
+ A(K, { onClick: x }, {
501
+ default: E(() => [
502
+ W(k(e.cancelButtonText), 1)
503
+ ]),
504
+ _: 1
505
+ }),
506
+ A(K, {
507
+ type: "primary",
508
+ onClick: d
509
+ }, {
510
+ default: E(() => [
511
+ W(k(e.confirmButtonText), 1)
512
+ ]),
513
+ _: 1
514
+ })
515
+ ], !0)
516
+ ])) : g("", !0)
517
+ ], 4)) : g("", !0)
518
+ ]),
519
+ _: 3
520
+ })
521
+ ])) : g("", !0)
522
+ ]),
523
+ _: 3
524
+ })
525
+ ]));
526
+ }
527
+ }, pt = /* @__PURE__ */ C(ct, [["__scopeId", "data-v-f85c5a46"]]), ft = ["onClick"], mt = { key: 0 }, ht = {
528
+ key: 1,
529
+ class: "xp-dropdown__divider"
530
+ }, xt = {
531
+ __name: "Dropdown",
532
+ props: {
533
+ items: {
534
+ type: Array,
535
+ default: () => []
536
+ },
537
+ disabled: {
538
+ type: Boolean,
539
+ default: !1
540
+ }
541
+ },
542
+ emits: ["select", "command", "open", "close"],
543
+ setup(e, { emit: n }) {
544
+ const t = e, s = n, l = z(!1), u = z({}), d = z(null), x = z(null), m = () => {
545
+ ue(() => {
546
+ if (!d.value || !x.value) return;
547
+ const h = d.value.getBoundingClientRect(), $ = x.value.getBoundingClientRect();
548
+ let w = h.bottom + 6, I = h.left;
549
+ I + $.width > window.innerWidth - 10 && (I = window.innerWidth - $.width - 10), w + $.height > window.innerHeight - 10 && (w = h.top - $.height - 6), u.value = {
550
+ top: `${w + window.scrollY}px`,
551
+ left: `${I + window.scrollX}px`
552
+ };
553
+ });
554
+ }, f = () => {
555
+ t.disabled || (l.value = !l.value, l.value ? (m(), s("open")) : s("close"));
556
+ }, i = (h) => {
557
+ h.disabled || h.divider || (s("select", h), h.command !== void 0 && s("command", h.command, h), l.value = !1, s("close"));
558
+ }, c = (h) => {
559
+ var $;
560
+ l.value && d.value && !d.value.contains(h.target) && !(($ = x.value) != null && $.contains(h.target)) && (l.value = !1, s("close"));
561
+ };
562
+ return de(() => {
563
+ document.addEventListener("click", c);
564
+ }), Q(() => {
565
+ document.removeEventListener("click", c);
566
+ }), (h, $) => (a(), r("div", {
567
+ class: "xp-dropdown",
568
+ ref_key: "dropdownRef",
569
+ ref: d
570
+ }, [
571
+ o("div", {
572
+ class: "xp-dropdown__trigger",
573
+ onClick: f
574
+ }, [
575
+ b(h.$slots, "default", {}, void 0, !0)
576
+ ]),
577
+ (a(), R(H, { to: "body" }, [
578
+ A(D, { name: "xp-dropdown-fade" }, {
579
+ default: E(() => [
580
+ l.value ? (a(), r("div", {
581
+ key: 0,
582
+ class: "xp-dropdown__menu",
583
+ style: T(u.value),
584
+ ref_key: "menuRef",
585
+ ref: x
586
+ }, [
587
+ (a(!0), r(_, null, V(e.items, (w, I) => (a(), r("div", {
588
+ key: I,
589
+ class: B(["xp-dropdown__item", { "xp-dropdown__item--disabled": w.disabled, "xp-dropdown__item--divider": w.divider }]),
590
+ onClick: (te) => i(w)
591
+ }, [
592
+ w.divider ? g("", !0) : (a(), r("span", mt, k(w.label), 1)),
593
+ w.divider ? (a(), r("span", ht)) : g("", !0)
594
+ ], 10, ft))), 128))
595
+ ], 4)) : g("", !0)
596
+ ]),
597
+ _: 1
598
+ })
599
+ ]))
600
+ ], 512));
601
+ }
602
+ }, vt = /* @__PURE__ */ C(xt, [["__scopeId", "data-v-ad741cd8"]]), gt = { class: "xp-empty" }, yt = { class: "xp-empty__title" }, bt = {
603
+ key: 0,
604
+ class: "xp-empty__hint"
605
+ }, _t = {
606
+ key: 1,
607
+ class: "xp-empty__action"
608
+ }, kt = {
609
+ __name: "Empty",
610
+ props: {
611
+ title: { type: String, default: "暂无内容" },
612
+ hint: { type: String, default: "" }
613
+ },
614
+ setup(e) {
615
+ return (n, t) => (a(), r("div", gt, [
616
+ b(n.$slots, "icon", {}, () => [
617
+ t[0] || (t[0] = o("div", {
618
+ class: "xp-empty__icon",
619
+ "aria-hidden": "true"
620
+ }, [
621
+ o("svg", {
622
+ width: "46",
623
+ height: "46",
624
+ viewBox: "0 0 24 24",
625
+ fill: "none"
626
+ }, [
627
+ o("path", {
628
+ d: "M4 7a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z",
629
+ stroke: "var(--xp-border-color)",
630
+ "stroke-width": "1.5",
631
+ "stroke-linejoin": "round"
632
+ })
633
+ ])
634
+ ], -1))
635
+ ], !0),
636
+ o("p", yt, k(e.title), 1),
637
+ e.hint ? (a(), r("p", bt, k(e.hint), 1)) : g("", !0),
638
+ n.$slots.default ? (a(), r("div", _t, [
639
+ b(n.$slots, "default", {}, void 0, !0)
640
+ ])) : g("", !0)
641
+ ]));
642
+ }
643
+ }, $t = /* @__PURE__ */ C(kt, [["__scopeId", "data-v-93d5e1e9"]]), wt = ["width", "height"], Ct = {
644
+ __name: "FileIcon",
645
+ props: {
646
+ type: { type: String, default: "file" },
647
+ size: { type: Number, default: 20 }
648
+ },
649
+ setup(e) {
650
+ return (n, t) => (a(), r("span", {
651
+ class: "xp-file-icon",
652
+ style: T({ width: e.size + "px", height: e.size + "px" }),
653
+ "aria-hidden": "true"
654
+ }, [
655
+ (a(), r("svg", {
656
+ width: e.size,
657
+ height: e.size,
658
+ viewBox: "0 0 24 24",
659
+ fill: "none"
660
+ }, [
661
+ e.type === "folder" ? (a(), r(_, { key: 0 }, [
662
+ t[0] || (t[0] = o("path", {
663
+ d: "M3 6.5A2.5 2.5 0 0 1 5.5 4h4l2 2h7A2.5 2.5 0 0 1 21 8.5v9A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z",
664
+ fill: "#E8B64E",
665
+ "fill-opacity": "0.9"
666
+ }, null, -1)),
667
+ t[1] || (t[1] = o("path", {
668
+ d: "M3 8.5h18v9A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z",
669
+ fill: "#F3CE78"
670
+ }, null, -1))
671
+ ], 64)) : e.type === "image" ? (a(), r(_, { key: 1 }, [
672
+ t[2] || (t[2] = o("rect", {
673
+ x: "3",
674
+ y: "4",
675
+ width: "18",
676
+ height: "16",
677
+ rx: "2.4",
678
+ fill: "#4FA8C9",
679
+ "fill-opacity": "0.16",
680
+ stroke: "#3D8EAD",
681
+ "stroke-width": "1.4"
682
+ }, null, -1)),
683
+ t[3] || (t[3] = o("circle", {
684
+ cx: "9",
685
+ cy: "10",
686
+ r: "1.8",
687
+ fill: "#3D8EAD"
688
+ }, null, -1)),
689
+ t[4] || (t[4] = o("path", {
690
+ d: "M4.4 17.4l4.6-4.4 3 2.8 3.2-3.2 4.4 4.2",
691
+ stroke: "#3D8EAD",
692
+ "stroke-width": "1.4",
693
+ "stroke-linecap": "round",
694
+ "stroke-linejoin": "round",
695
+ fill: "none"
696
+ }, null, -1))
697
+ ], 64)) : e.type === "video" ? (a(), r(_, { key: 2 }, [
698
+ t[5] || (t[5] = o("rect", {
699
+ x: "3",
700
+ y: "5",
701
+ width: "13",
702
+ height: "14",
703
+ rx: "2.4",
704
+ fill: "#9B5FD1",
705
+ "fill-opacity": "0.14",
706
+ stroke: "#8A48C4",
707
+ "stroke-width": "1.4"
708
+ }, null, -1)),
709
+ t[6] || (t[6] = o("path", {
710
+ d: "M16 10.5l5-3v9l-5-3z",
711
+ fill: "#8A48C4"
712
+ }, null, -1))
713
+ ], 64)) : e.type === "audio" ? (a(), r(_, { key: 3 }, [
714
+ t[7] || (t[7] = o("path", {
715
+ d: "M9 18V6l10-2v11",
716
+ stroke: "#C2569B",
717
+ "stroke-width": "1.6",
718
+ "stroke-linecap": "round",
719
+ "stroke-linejoin": "round",
720
+ fill: "none"
721
+ }, null, -1)),
722
+ t[8] || (t[8] = o("circle", {
723
+ cx: "6.6",
724
+ cy: "18",
725
+ r: "2.4",
726
+ fill: "#C2569B"
727
+ }, null, -1)),
728
+ t[9] || (t[9] = o("circle", {
729
+ cx: "16.6",
730
+ cy: "15",
731
+ r: "2.4",
732
+ fill: "#C2569B"
733
+ }, null, -1))
734
+ ], 64)) : e.type === "pdf" ? (a(), r(_, { key: 4 }, [
735
+ t[10] || (t[10] = o("rect", {
736
+ x: "4",
737
+ y: "3",
738
+ width: "16",
739
+ height: "18",
740
+ rx: "2.4",
741
+ fill: "#D9504A",
742
+ "fill-opacity": "0.14",
743
+ stroke: "#C24842",
744
+ "stroke-width": "1.4"
745
+ }, null, -1)),
746
+ t[11] || (t[11] = o("text", {
747
+ x: "12",
748
+ y: "16.2",
749
+ "text-anchor": "middle",
750
+ "font-size": "9.5",
751
+ "font-weight": "700",
752
+ fill: "#C24842",
753
+ "font-family": "Arial, sans-serif"
754
+ }, "PDF", -1))
755
+ ], 64)) : e.type === "doc" ? (a(), r(_, { key: 5 }, [
756
+ t[12] || (t[12] = o("path", {
757
+ d: "M5 3.5h9l5 5v12h-14z",
758
+ fill: "#3B7FD6",
759
+ "fill-opacity": "0.14",
760
+ stroke: "#2F6DC0",
761
+ "stroke-width": "1.4",
762
+ "stroke-linejoin": "round"
763
+ }, null, -1)),
764
+ t[13] || (t[13] = o("path", {
765
+ d: "M14 3.5v5h5",
766
+ fill: "none",
767
+ stroke: "#2F6DC0",
768
+ "stroke-width": "1.4",
769
+ "stroke-linejoin": "round"
770
+ }, null, -1)),
771
+ t[14] || (t[14] = o("path", {
772
+ d: "M7.5 12v5M7.5 14.5h3",
773
+ stroke: "#2F6DC0",
774
+ "stroke-width": "1.4",
775
+ "stroke-linecap": "round"
776
+ }, null, -1)),
777
+ t[15] || (t[15] = o("path", {
778
+ d: "M13.5 12h3M13.5 14.5h3M13.5 17h2",
779
+ stroke: "#2F6DC0",
780
+ "stroke-width": "1.4",
781
+ "stroke-linecap": "round"
782
+ }, null, -1))
783
+ ], 64)) : e.type === "sheet" ? (a(), r(_, { key: 6 }, [
784
+ t[16] || (t[16] = o("rect", {
785
+ x: "4",
786
+ y: "3.5",
787
+ width: "16",
788
+ height: "17",
789
+ rx: "2.4",
790
+ fill: "#3E9C5E",
791
+ "fill-opacity": "0.14",
792
+ stroke: "#33854F",
793
+ "stroke-width": "1.4"
794
+ }, null, -1)),
795
+ t[17] || (t[17] = o("path", {
796
+ d: "M4 9h16M4 14h16M10 9v11.5M14.5 9v11.5",
797
+ stroke: "#33854F",
798
+ "stroke-width": "1.2",
799
+ "stroke-linecap": "round"
800
+ }, null, -1))
801
+ ], 64)) : e.type === "slide" ? (a(), r(_, { key: 7 }, [
802
+ t[18] || (t[18] = o("rect", {
803
+ x: "3",
804
+ y: "5",
805
+ width: "18",
806
+ height: "12",
807
+ rx: "2.4",
808
+ fill: "#E09A2F",
809
+ "fill-opacity": "0.16",
810
+ stroke: "#CC8420",
811
+ "stroke-width": "1.4"
812
+ }, null, -1)),
813
+ t[19] || (t[19] = o("path", {
814
+ d: "M12 17v3M9.5 20h5",
815
+ stroke: "#CC8420",
816
+ "stroke-width": "1.4",
817
+ "stroke-linecap": "round"
818
+ }, null, -1)),
819
+ t[20] || (t[20] = o("circle", {
820
+ cx: "9",
821
+ cy: "10.4",
822
+ r: "1.3",
823
+ fill: "#CC8420"
824
+ }, null, -1)),
825
+ t[21] || (t[21] = o("path", {
826
+ d: "M6 14.4l2.8-2.8 2 1.8L14 9.6l4 4.4",
827
+ stroke: "#CC8420",
828
+ "stroke-width": "1.4",
829
+ "stroke-linecap": "round",
830
+ "stroke-linejoin": "round",
831
+ fill: "none"
832
+ }, null, -1))
833
+ ], 64)) : e.type === "archive" ? (a(), r(_, { key: 8 }, [
834
+ t[22] || (t[22] = o("rect", {
835
+ x: "4",
836
+ y: "3.5",
837
+ width: "16",
838
+ height: "17",
839
+ rx: "2.4",
840
+ fill: "#A97D4E",
841
+ "fill-opacity": "0.16",
842
+ stroke: "#8F6539",
843
+ "stroke-width": "1.4"
844
+ }, null, -1)),
845
+ t[23] || (t[23] = o("path", {
846
+ d: "M9.5 4v16M14.5 4v16M4 12h16",
847
+ stroke: "#8F6539",
848
+ "stroke-width": "1.3"
849
+ }, null, -1))
850
+ ], 64)) : e.type === "code" ? (a(), r(_, { key: 9 }, [
851
+ t[24] || (t[24] = o("path", {
852
+ d: "M8.5 8l-4.5 4 4.5 4M15.5 8l4.5 4-4.5 4",
853
+ stroke: "#6B62E0",
854
+ "stroke-width": "1.7",
855
+ "stroke-linecap": "round",
856
+ "stroke-linejoin": "round",
857
+ fill: "none"
858
+ }, null, -1)),
859
+ t[25] || (t[25] = o("path", {
860
+ d: "M13.6 5.8l-3.2 12.4",
861
+ stroke: "#6B62E0",
862
+ "stroke-width": "1.5",
863
+ "stroke-linecap": "round"
864
+ }, null, -1))
865
+ ], 64)) : e.type === "text" ? (a(), r(_, { key: 10 }, [
866
+ t[26] || (t[26] = o("path", {
867
+ d: "M4 6.2C4 5 4.9 4 6.5 4h11C19 4 20 5 20 6.2v11.6C20 19 19 20 17.5 20h-11C4.9 20 4 19 4 17.8z",
868
+ fill: "#7D8894",
869
+ "fill-opacity": "0.12",
870
+ stroke: "#5F6B78",
871
+ "stroke-width": "1.4"
872
+ }, null, -1)),
873
+ t[27] || (t[27] = o("path", {
874
+ d: "M7.5 8.5h9M7.5 12h6.5",
875
+ stroke: "#5F6B78",
876
+ "stroke-width": "1.5",
877
+ "stroke-linecap": "round"
878
+ }, null, -1))
879
+ ], 64)) : (a(), r(_, { key: 11 }, [
880
+ t[28] || (t[28] = o("path", {
881
+ d: "M6 3.5h8l5 5v12h-13z",
882
+ fill: "#A2AAB4",
883
+ "fill-opacity": "0.16",
884
+ stroke: "#7C8590",
885
+ "stroke-width": "1.4",
886
+ "stroke-linejoin": "round"
887
+ }, null, -1)),
888
+ t[29] || (t[29] = o("path", {
889
+ d: "M14 3.5v5h5",
890
+ fill: "none",
891
+ stroke: "#7C8590",
892
+ "stroke-width": "1.4",
893
+ "stroke-linejoin": "round"
894
+ }, null, -1)),
895
+ t[30] || (t[30] = o("path", {
896
+ d: "M8 12.5h8M8 15.5h8M8 18.5h5",
897
+ stroke: "#7C8590",
898
+ "stroke-width": "1.3",
899
+ "stroke-linecap": "round"
900
+ }, null, -1))
901
+ ], 64))
902
+ ], 8, wt))
903
+ ], 4));
904
+ }
905
+ }, St = /* @__PURE__ */ C(Ct, [["__scopeId", "data-v-c598c294"]]), zt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M330.666667 512c0-14.933333 4.266667-29.866667 14.933333-40.533333l234.666667-277.33333399c23.466667-27.733333 64-29.866667 89.6-8.53333301 27.733333 23.466667 29.866667 64 8.53333299 89.6L477.866667 512l200.53333299 236.8c23.466667 27.733333 19.19999999 68.266667-8.53333299 89.6-27.733333 23.466667-68.266667 19.19999999-89.6-8.53333301l-234.666667-277.33333399c-10.666667-10.666667-14.933333-25.6-14.933333-40.533333z" /></svg>', Bt = ["viewBox", "innerHTML"], Mt = {
906
+ key: 2,
907
+ class: "xp-icon__fallback"
908
+ }, It = {
909
+ __name: "Icon",
910
+ props: {
911
+ name: {
912
+ type: String,
913
+ default: ""
914
+ },
915
+ size: {
916
+ type: [String, Number],
917
+ default: "medium"
918
+ },
919
+ color: {
920
+ type: String,
921
+ default: ""
922
+ },
923
+ spin: {
924
+ type: Boolean,
925
+ default: !1
926
+ },
927
+ rotate: {
928
+ type: Number,
929
+ default: 0
930
+ }
931
+ },
932
+ setup(e) {
933
+ const n = ["small", "medium", "large"], t = e, s = /* @__PURE__ */ Object.assign({ "./icons/jiantou.svg": zt }), l = (i) => i && i.replace(/\bfill\s*=\s*["'](?!none["'])[^"']+["']/gi, 'fill="currentColor"').replace(/\bstroke\s*=\s*["'](?!none["'])[^"']+["']/gi, 'stroke="currentColor"'), u = M(() => {
934
+ if (!t.name) return null;
935
+ const i = `./icons/${t.name}.svg`, c = s[i];
936
+ if (!c) return null;
937
+ const h = c.match(/<svg[^>]*>([\s\S]*)<\/svg>/i), $ = l(h ? h[1] : c), w = c.match(/viewBox\s*=\s*["']([^"']+)["']/i);
938
+ return {
939
+ inner: $,
940
+ viewBox: w ? w[1] : "0 0 24 24"
941
+ };
942
+ }), d = M(() => n.includes(String(t.size))), x = M(() => {
943
+ if (d.value) return null;
944
+ const i = t.size;
945
+ return typeof i == "number" ? `${i}px` : typeof i == "string" && i.trim() ? /^\d+(\.\d+)?$/.test(i.trim()) ? `${i}px` : i.trim() : null;
946
+ }), m = M(() => {
947
+ const i = [];
948
+ return d.value && i.push(`xp-icon--${t.size}`), t.spin && i.push("xp-icon--spin"), i;
949
+ }), f = M(() => {
950
+ const i = {};
951
+ return t.color && (i.color = t.color), t.rotate && (i.transform = `rotate(${t.rotate}deg)`), x.value && (i.width = x.value, i.height = x.value, i.fontSize = x.value), i;
952
+ });
953
+ return (i, c) => (a(), r("i", {
954
+ class: B(["xp-icon", m.value]),
955
+ style: T(f.value)
956
+ }, [
957
+ i.$slots.default ? b(i.$slots, "default", { key: 0 }, void 0, !0) : u.value ? (a(), r("svg", {
958
+ key: 1,
959
+ viewBox: u.value.viewBox,
960
+ innerHTML: u.value.inner
961
+ }, null, 8, Bt)) : (a(), r("span", Mt, "?"))
962
+ ], 6));
963
+ }
964
+ }, Tt = /* @__PURE__ */ C(It, [["__scopeId", "data-v-14319319"]]), Vt = {
965
+ key: 0,
966
+ class: "xp-input__prefix"
967
+ }, Et = ["id", "type", "value", "placeholder", "disabled", "maxlength"], At = {
968
+ key: 2,
969
+ class: "xp-input__suffix"
970
+ }, Dt = {
971
+ __name: "Input",
972
+ props: {
973
+ modelValue: {
974
+ type: [String, Number],
975
+ default: ""
976
+ },
977
+ /** 原生 input 的 id,用于配合 label[for] 聚焦 */
978
+ id: {
979
+ type: String,
980
+ default: ""
981
+ },
982
+ type: {
983
+ type: String,
984
+ default: "text",
985
+ validator: (e) => ["text", "password", "number", "email", "tel", "url"].includes(e)
986
+ },
987
+ placeholder: {
988
+ type: String,
989
+ default: ""
990
+ },
991
+ disabled: {
992
+ type: Boolean,
993
+ default: !1
994
+ },
995
+ size: {
996
+ type: String,
997
+ default: "medium",
998
+ validator: (e) => ["small", "medium", "large"].includes(e)
999
+ },
1000
+ maxlength: {
1001
+ type: [String, Number],
1002
+ default: null
1003
+ },
1004
+ showClear: {
1005
+ type: Boolean,
1006
+ default: !1
1007
+ }
1008
+ },
1009
+ emits: ["update:modelValue", "focus", "blur", "clear"],
1010
+ setup(e, { expose: n, emit: t }) {
1011
+ const s = t, l = z(null), u = z(!1), d = (i) => {
1012
+ s("update:modelValue", i.target.value);
1013
+ }, x = (i) => {
1014
+ u.value = !0, s("focus", i);
1015
+ }, m = (i) => {
1016
+ u.value = !1, s("blur", i);
1017
+ }, f = () => {
1018
+ s("update:modelValue", ""), s("clear"), l.value && l.value.focus();
1019
+ };
1020
+ return n({
1021
+ focus: () => l.value && l.value.focus(),
1022
+ select: () => l.value && l.value.select(),
1023
+ blur: () => l.value && l.value.blur()
1024
+ }), (i, c) => (a(), r("div", {
1025
+ class: B(["xp-input", [
1026
+ `xp-input--${e.size}`,
1027
+ {
1028
+ "xp-input--disabled": e.disabled,
1029
+ "xp-input--prefix": i.$slots.prefix,
1030
+ "xp-input--suffix": i.$slots.suffix || e.showClear,
1031
+ "xp-input--focus": u.value
1032
+ }
1033
+ ]])
1034
+ }, [
1035
+ i.$slots.prefix ? (a(), r("span", Vt, [
1036
+ b(i.$slots, "prefix", {}, void 0, !0)
1037
+ ])) : g("", !0),
1038
+ o("input", {
1039
+ ref_key: "inputRef",
1040
+ ref: l,
1041
+ class: "xp-input__inner",
1042
+ id: e.id || void 0,
1043
+ type: e.type,
1044
+ value: e.modelValue,
1045
+ placeholder: e.placeholder,
1046
+ disabled: e.disabled,
1047
+ maxlength: e.maxlength,
1048
+ onInput: d,
1049
+ onFocus: x,
1050
+ onBlur: m
1051
+ }, null, 40, Et),
1052
+ e.showClear && e.modelValue && !e.disabled ? (a(), r("span", {
1053
+ key: 1,
1054
+ class: "xp-input__clear",
1055
+ onClick: f
1056
+ }, "×")) : g("", !0),
1057
+ i.$slots.suffix && !e.showClear ? (a(), r("span", At, [
1058
+ b(i.$slots, "suffix", {}, void 0, !0)
1059
+ ])) : g("", !0)
1060
+ ], 2));
1061
+ }
1062
+ }, jt = /* @__PURE__ */ C(Dt, [["__scopeId", "data-v-46247483"]]), Nt = {
1063
+ key: 0,
1064
+ class: "xp-progress__text"
1065
+ }, Ft = {
1066
+ __name: "Progress",
1067
+ props: {
1068
+ percentage: {
1069
+ type: Number,
1070
+ default: 0,
1071
+ validator: (e) => e >= 0 && e <= 100
1072
+ },
1073
+ color: {
1074
+ type: String,
1075
+ default: ""
1076
+ },
1077
+ showText: {
1078
+ type: Boolean,
1079
+ default: !0
1080
+ },
1081
+ type: {
1082
+ type: String,
1083
+ default: "line",
1084
+ validator: (e) => ["line", "circle"].includes(e)
1085
+ },
1086
+ status: {
1087
+ type: String,
1088
+ default: "",
1089
+ validator: (e) => ["", "success", "warning", "exception"].includes(e)
1090
+ },
1091
+ /** line 模式下进度条轨道/内条高度(px),用于紧凑场景 */
1092
+ strokeWidth: {
1093
+ type: Number,
1094
+ default: 8
1095
+ }
1096
+ },
1097
+ setup(e) {
1098
+ const n = e, t = M(
1099
+ () => n.type === "line" ? { height: `${n.strokeWidth}px` } : {}
1100
+ ), s = M(() => n.color ? n.color : n.status === "success" ? "var(--xp-color-success)" : n.status === "warning" ? "var(--xp-color-warning)" : n.status === "exception" ? "var(--xp-color-danger)" : "var(--xp-color-primary)");
1101
+ return (l, u) => (a(), r("div", {
1102
+ class: B(["xp-progress", [`xp-progress--${e.type}`]])
1103
+ }, [
1104
+ o("div", {
1105
+ class: "xp-progress__bar",
1106
+ style: T(t.value)
1107
+ }, [
1108
+ o("div", {
1109
+ class: "xp-progress__inner",
1110
+ style: T({ width: `${e.percentage}%`, backgroundColor: s.value })
1111
+ }, null, 4)
1112
+ ], 4),
1113
+ e.showText ? (a(), r("span", Nt, [
1114
+ b(l.$slots, "default", {}, () => [
1115
+ W(k(e.percentage) + "%", 1)
1116
+ ], !0)
1117
+ ])) : g("", !0)
1118
+ ], 2));
1119
+ }
1120
+ }, Rt = /* @__PURE__ */ C(Ft, [["__scopeId", "data-v-244dca2c"]]), Ot = { class: "xp-radio__input" }, Xt = ["checked", "disabled"], Lt = { class: "xp-radio__label" }, Pt = {
1121
+ __name: "Radio",
1122
+ props: {
1123
+ modelValue: {
1124
+ type: [String, Number, Boolean],
1125
+ default: ""
1126
+ },
1127
+ value: {
1128
+ type: [String, Number, Boolean],
1129
+ default: ""
1130
+ },
1131
+ disabled: {
1132
+ type: Boolean,
1133
+ default: !1
1134
+ }
1135
+ },
1136
+ emits: ["update:modelValue", "change"],
1137
+ setup(e, { emit: n }) {
1138
+ const t = e, s = n, l = () => {
1139
+ t.disabled || (s("update:modelValue", t.value), s("change", t.value));
1140
+ };
1141
+ return (u, d) => (a(), r("label", {
1142
+ class: B(["xp-radio", [
1143
+ {
1144
+ "xp-radio--checked": e.modelValue === e.value,
1145
+ "xp-radio--disabled": e.disabled
1146
+ }
1147
+ ]])
1148
+ }, [
1149
+ o("span", Ot, [
1150
+ d[0] || (d[0] = o("span", { class: "xp-radio__inner" }, null, -1)),
1151
+ o("input", {
1152
+ type: "radio",
1153
+ class: "xp-radio__original",
1154
+ checked: e.modelValue === e.value,
1155
+ disabled: e.disabled,
1156
+ onChange: l
1157
+ }, null, 40, Xt)
1158
+ ]),
1159
+ o("span", Lt, [
1160
+ b(u.$slots, "default", {}, void 0, !0)
1161
+ ])
1162
+ ], 2));
1163
+ }
1164
+ }, Wt = /* @__PURE__ */ C(Pt, [["__scopeId", "data-v-02a0d80d"]]), Jt = { class: "xp-rate" }, Ht = ["onClick", "onMouseenter"], Ut = { class: "xp-rate__star" }, Gt = {
1165
+ key: 0,
1166
+ class: "xp-rate__text"
1167
+ }, qt = {
1168
+ __name: "Rate",
1169
+ props: {
1170
+ modelValue: {
1171
+ type: Number,
1172
+ default: 0
1173
+ },
1174
+ max: {
1175
+ type: Number,
1176
+ default: 5
1177
+ },
1178
+ color: {
1179
+ type: String,
1180
+ default: "#f7ba2a"
1181
+ },
1182
+ disabled: {
1183
+ type: Boolean,
1184
+ default: !1
1185
+ },
1186
+ showText: {
1187
+ type: Boolean,
1188
+ default: !1
1189
+ }
1190
+ },
1191
+ emits: ["update:modelValue", "change"],
1192
+ setup(e, { emit: n }) {
1193
+ const t = e, s = n, l = z(0), u = M(() => l.value || t.modelValue), d = (m) => {
1194
+ const f = u.value - m + 1;
1195
+ return f >= 1 ? 100 : f > 0 ? f * 100 : 0;
1196
+ }, x = (m) => {
1197
+ t.disabled || (s("update:modelValue", m), s("change", m));
1198
+ };
1199
+ return (m, f) => (a(), r("div", Jt, [
1200
+ (a(!0), r(_, null, V(e.max, (i) => (a(), r("span", {
1201
+ key: i,
1202
+ class: B(["xp-rate__item", {
1203
+ "xp-rate__item--disabled": e.disabled
1204
+ }]),
1205
+ style: T({ cursor: e.disabled ? "default" : "pointer" }),
1206
+ onClick: (c) => x(i),
1207
+ onMouseenter: (c) => l.value = i,
1208
+ onMouseleave: f[0] || (f[0] = (c) => l.value = 0)
1209
+ }, [
1210
+ o("span", Ut, [
1211
+ f[1] || (f[1] = o("span", { class: "xp-rate__star-outer" }, "★", -1)),
1212
+ o("span", {
1213
+ class: "xp-rate__star-inner",
1214
+ style: T({ width: d(i) + "%", color: e.color })
1215
+ }, " ★ ", 4)
1216
+ ])
1217
+ ], 46, Ht))), 128)),
1218
+ e.showText && !e.disabled ? (a(), r("span", Gt, k(e.modelValue) + " / " + k(e.max), 1)) : g("", !0)
1219
+ ]));
1220
+ }
1221
+ }, Yt = /* @__PURE__ */ C(qt, [["__scopeId", "data-v-214323a3"]]), Kt = ["aria-checked"], Zt = {
1222
+ key: 0,
1223
+ class: "xp-switch__label"
1224
+ }, Qt = {
1225
+ __name: "Switch",
1226
+ props: {
1227
+ modelValue: {
1228
+ type: Boolean,
1229
+ default: !1
1230
+ },
1231
+ size: {
1232
+ type: String,
1233
+ default: "medium",
1234
+ validator: (e) => ["small", "medium", "large"].includes(e)
1235
+ },
1236
+ disabled: {
1237
+ type: Boolean,
1238
+ default: !1
1239
+ }
1240
+ },
1241
+ emits: ["update:modelValue", "change"],
1242
+ setup(e, { emit: n }) {
1243
+ const t = e, s = n, l = () => {
1244
+ if (t.disabled) return;
1245
+ const u = !t.modelValue;
1246
+ s("update:modelValue", u), s("change", u);
1247
+ };
1248
+ return (u, d) => (a(), r("div", {
1249
+ class: B(["xp-switch", [
1250
+ `xp-switch--${e.size}`,
1251
+ {
1252
+ "xp-switch--checked": e.modelValue,
1253
+ "xp-switch--disabled": e.disabled
1254
+ }
1255
+ ]]),
1256
+ role: "switch",
1257
+ "aria-checked": e.modelValue,
1258
+ onClick: l
1259
+ }, [
1260
+ d[0] || (d[0] = o("span", { class: "xp-switch__core" }, [
1261
+ o("span", { class: "xp-switch__action" })
1262
+ ], -1)),
1263
+ u.$slots.default ? (a(), r("span", Zt, [
1264
+ b(u.$slots, "default", {}, void 0, !0)
1265
+ ])) : g("", !0)
1266
+ ], 10, Kt));
1267
+ }
1268
+ }, en = /* @__PURE__ */ C(Qt, [["__scopeId", "data-v-5a5e33c5"]]), tn = {
1269
+ key: 0,
1270
+ class: "xp-tab-pane"
1271
+ }, nn = {
1272
+ __name: "TabPane",
1273
+ props: {
1274
+ name: {
1275
+ type: [String, Number],
1276
+ required: !0
1277
+ },
1278
+ title: {
1279
+ type: String,
1280
+ default: ""
1281
+ },
1282
+ disabled: {
1283
+ type: Boolean,
1284
+ default: !1
1285
+ }
1286
+ },
1287
+ setup(e) {
1288
+ const n = e, t = _e("xpTabs", null), s = M(() => t ? t.currentValue.value === n.name : !0);
1289
+ return de(() => {
1290
+ t && t.addTab && t.addTab({ name: n.name, title: n.title, disabled: n.disabled });
1291
+ }), Q(() => {
1292
+ t && t.removeTab && t.removeTab(n.name);
1293
+ }), (l, u) => s.value ? (a(), r("div", tn, [
1294
+ b(l.$slots, "default", {}, void 0, !0)
1295
+ ])) : g("", !0);
1296
+ }
1297
+ }, on = /* @__PURE__ */ C(nn, [["__scopeId", "data-v-6fe7943a"]]), sn = { class: "xp-tabs" }, ln = {
1298
+ class: "xp-tabs__nav",
1299
+ role: "tablist"
1300
+ }, an = ["onClick"], rn = { class: "xp-tabs__content" }, dn = {
1301
+ __name: "Tabs",
1302
+ props: {
1303
+ modelValue: {
1304
+ type: [String, Number],
1305
+ default: null
1306
+ }
1307
+ },
1308
+ emits: ["update:modelValue", "change"],
1309
+ setup(e, { emit: n }) {
1310
+ const t = e, s = n, l = z([]), u = M(() => {
1311
+ var i;
1312
+ return t.modelValue !== null && t.modelValue !== void 0 && t.modelValue !== "" ? t.modelValue : ((i = l.value[0]) == null ? void 0 : i.name) ?? null;
1313
+ }), d = M(() => {
1314
+ const i = l.value.findIndex((h) => h.name === u.value);
1315
+ return {
1316
+ transform: `translateX(${(i >= 0 ? i : 0) * 100}%)`,
1317
+ width: `${l.value.length ? 100 / l.value.length : 0}%`
1318
+ };
1319
+ }), x = (i) => {
1320
+ i.disabled || (s("update:modelValue", i.name), s("change", i.name));
1321
+ };
1322
+ return ke("xpTabs", { addTab: (i) => {
1323
+ l.value.find((c) => c.name === i.name) || l.value.push(i);
1324
+ }, removeTab: (i) => {
1325
+ const c = l.value.findIndex((h) => h.name === i);
1326
+ c >= 0 && l.value.splice(c, 1);
1327
+ }, currentValue: u }), (i, c) => (a(), r("div", sn, [
1328
+ o("div", ln, [
1329
+ (a(!0), r(_, null, V(l.value, (h, $) => (a(), r("div", {
1330
+ key: h.name || $,
1331
+ class: B(["xp-tabs__item", [
1332
+ {
1333
+ "xp-tabs__item--active": u.value === h.name,
1334
+ "xp-tabs__item--disabled": h.disabled
1335
+ }
1336
+ ]]),
1337
+ role: "tab",
1338
+ onClick: (w) => x(h)
1339
+ }, k(h.title), 11, an))), 128)),
1340
+ o("div", {
1341
+ class: "xp-tabs__active-bar",
1342
+ style: T(d.value)
1343
+ }, null, 4)
1344
+ ]),
1345
+ o("div", rn, [
1346
+ b(i.$slots, "default", {}, void 0, !0)
1347
+ ])
1348
+ ]));
1349
+ }
1350
+ }, un = /* @__PURE__ */ C(dn, [["__scopeId", "data-v-3e658dba"]]), cn = {
1351
+ __name: "Tag",
1352
+ props: {
1353
+ type: {
1354
+ type: String,
1355
+ default: "default",
1356
+ validator: (e) => ["primary", "default", "success", "warning", "danger", "info"].includes(e)
1357
+ },
1358
+ size: {
1359
+ type: String,
1360
+ default: "medium",
1361
+ validator: (e) => ["small", "medium", "large"].includes(e)
1362
+ },
1363
+ color: {
1364
+ type: String,
1365
+ default: ""
1366
+ },
1367
+ plain: {
1368
+ type: Boolean,
1369
+ default: !1
1370
+ },
1371
+ round: {
1372
+ type: Boolean,
1373
+ default: !1
1374
+ },
1375
+ closable: {
1376
+ type: Boolean,
1377
+ default: !1
1378
+ }
1379
+ },
1380
+ emits: ["click", "close"],
1381
+ setup(e, { emit: n }) {
1382
+ const t = e, s = n, l = M(() => t.color ? t.color.startsWith("#") || t.color.startsWith("rgb") ? {
1383
+ backgroundColor: t.color,
1384
+ borderColor: t.color,
1385
+ color: "#fff"
1386
+ } : {} : {}), u = (x) => {
1387
+ s("click", x);
1388
+ }, d = (x) => {
1389
+ s("close", x);
1390
+ };
1391
+ return (x, m) => (a(), r("span", {
1392
+ class: B(["xp-tag", [
1393
+ `xp-tag--${e.type}`,
1394
+ `xp-tag--${e.size}`,
1395
+ {
1396
+ "xp-tag--plain": e.plain,
1397
+ "xp-tag--round": e.round,
1398
+ "xp-tag--closable": e.closable
1399
+ }
1400
+ ]]),
1401
+ style: T(l.value),
1402
+ onClick: u
1403
+ }, [
1404
+ b(x.$slots, "default", {}, void 0, !0),
1405
+ e.closable ? (a(), r("span", {
1406
+ key: 0,
1407
+ class: "xp-tag__close",
1408
+ onClick: j(d, ["stop"])
1409
+ }, "×")) : g("", !0)
1410
+ ], 6));
1411
+ }
1412
+ }, pn = /* @__PURE__ */ C(cn, [["__scopeId", "data-v-903813de"]]), fn = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, mn = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*([\d.]+))?\s*\)$/;
1413
+ function Y(e) {
1414
+ if (typeof e != "string") return null;
1415
+ const n = e.trim(), t = n.match(fn);
1416
+ if (t) {
1417
+ let l = t[1];
1418
+ l.length === 3 && (l = l.split("").map((m) => m + m).join(""));
1419
+ const u = parseInt(l.slice(0, 2), 16), d = parseInt(l.slice(2, 4), 16), x = parseInt(l.slice(4, 6), 16);
1420
+ return { r: u, g: d, b: x, a: 1 };
1421
+ }
1422
+ const s = n.match(mn);
1423
+ return s ? {
1424
+ r: parseInt(s[1], 10),
1425
+ g: parseInt(s[2], 10),
1426
+ b: parseInt(s[3], 10),
1427
+ a: s[4] ? parseFloat(s[4]) : 1
1428
+ } : null;
1429
+ }
1430
+ function hn(e) {
1431
+ return Math.max(0, Math.min(255, Math.round(e)));
1432
+ }
1433
+ function xn(e, n, t) {
1434
+ const s = (l) => hn(l).toString(16).padStart(2, "0");
1435
+ return "#" + s(e) + s(n) + s(t);
1436
+ }
1437
+ function pe(e, n, t = 0.5) {
1438
+ const s = Y(e), l = Y(n);
1439
+ if (!s || !l) return "#000000";
1440
+ const u = Math.max(0, Math.min(1, t)), d = s.r * (1 - u) + l.r * u, x = s.g * (1 - u) + l.g * u, m = s.b * (1 - u) + l.b * u;
1441
+ return xn(d, x, m);
1442
+ }
1443
+ function G(e, n) {
1444
+ return pe(e, "#ffffff", n);
1445
+ }
1446
+ function q(e, n) {
1447
+ return pe(e, "#000000", n);
1448
+ }
1449
+ function xo(e) {
1450
+ return G(e, 0.3);
1451
+ }
1452
+ function vo(e) {
1453
+ return q(e, 0.2);
1454
+ }
1455
+ function go(e, n) {
1456
+ const t = Y(e);
1457
+ if (!t) return e;
1458
+ const s = Math.max(0, Math.min(1, n));
1459
+ return `rgba(${t.r}, ${t.g}, ${t.b}, ${s})`;
1460
+ }
1461
+ function yo(e) {
1462
+ const n = Y(e);
1463
+ return n ? (n.r * 299 + n.g * 587 + n.b * 114) / 1e3 < 128 : !1;
1464
+ }
1465
+ function fe(e, n) {
1466
+ const t = G(e, 0.3), s = q(e, 0.2), l = n === "dark" ? q(e, 0.85) : G(e, 0.9), u = n === "dark" ? q(e, 0.7) : G(e, 0.7);
1467
+ return { base: e, light: t, dark: s, bg: l, border: u };
1468
+ }
1469
+ const N = {
1470
+ primary: "#409eff",
1471
+ success: "#67c23a",
1472
+ warning: "#e6a23c",
1473
+ danger: "#f56c6c",
1474
+ info: "#909399"
1475
+ }, J = {
1476
+ light: {
1477
+ text: { primary: "#303133", regular: "#606266", secondary: "#909399", placeholder: "#c0c4cc" },
1478
+ border: { base: "#dcdfe6", light: "#ebeef5", lighter: "#f2f6fc" },
1479
+ bg: { base: "#ffffff", page: "#f2f3f5", soft: "#f5f7fa", overlay: "rgba(0, 0, 0, 0.5)" },
1480
+ fill: { base: "#f0f2f5", light: "#f5f7fa", lighter: "#fafafa" },
1481
+ shadow: {
1482
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
1483
+ md: "0 2px 12px 0 rgba(0, 0, 0, 0.1)",
1484
+ lg: "0 4px 20px 0 rgba(0, 0, 0, 0.15)",
1485
+ overlay: "0 8px 24px 0 rgba(0, 0, 0, 0.2)"
1486
+ }
1487
+ },
1488
+ dark: {
1489
+ text: { primary: "#e5eaf3", regular: "#cfd3dc", secondary: "#a3a6ad", placeholder: "#8d9095" },
1490
+ border: { base: "#4c4d4f", light: "#414243", lighter: "#363637" },
1491
+ bg: { base: "#1d1e1f", page: "#141414", soft: "#2a2b2c", overlay: "rgba(0, 0, 0, 0.7)" },
1492
+ fill: { base: "#303030", light: "#262727", lighter: "#1d1d1d" },
1493
+ shadow: {
1494
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.4)",
1495
+ md: "0 2px 12px 0 rgba(0, 0, 0, 0.45)",
1496
+ lg: "0 4px 20px 0 rgba(0, 0, 0, 0.5)",
1497
+ overlay: "0 8px 24px 0 rgba(0, 0, 0, 0.6)"
1498
+ }
1499
+ }
1500
+ };
1501
+ function F() {
1502
+ return {
1503
+ primary: { ...N },
1504
+ light: se(J.light),
1505
+ dark: se(J.dark)
1506
+ };
1507
+ }
1508
+ function se(e) {
1509
+ return JSON.parse(JSON.stringify(e));
1510
+ }
1511
+ function le(e, n) {
1512
+ const t = ["primary", "success", "warning", "danger", "info"], s = [];
1513
+ for (const l of t) {
1514
+ const u = e[l] || N[l], d = fe(u, n);
1515
+ s.push(` --xp-color-${l}: ${u};`), s.push(` --xp-color-${l}-light: ${d.light};`), s.push(` --xp-color-${l}-dark: ${d.dark};`), s.push(` --xp-color-${l}-bg: ${d.bg};`), s.push(` --xp-color-${l}-border: ${d.border};`);
1516
+ }
1517
+ return s.join(`
1518
+ `);
1519
+ }
1520
+ function ae(e) {
1521
+ const n = [];
1522
+ for (const t of Object.keys(e.text)) n.push(` --xp-text-color-${t}: ${e.text[t]};`);
1523
+ n.push(` --xp-border-color: ${e.border.base};`), n.push(` --xp-border-color-light: ${e.border.light};`), n.push(` --xp-border-color-lighter: ${e.border.lighter};`);
1524
+ for (const t of Object.keys(e.bg)) {
1525
+ const s = t === "base" ? "" : `-${t}`;
1526
+ n.push(` --xp-bg-color${s}: ${e.bg[t]};`);
1527
+ }
1528
+ for (const t of Object.keys(e.fill)) {
1529
+ const s = t === "base" ? "" : `-${t}`;
1530
+ n.push(` --xp-fill-color${s}: ${e.fill[t]};`);
1531
+ }
1532
+ for (const t of Object.keys(e.shadow)) n.push(` --xp-shadow-${t}: ${e.shadow[t]};`);
1533
+ return n.join(`
1534
+ `);
1535
+ }
1536
+ function vn(e, n) {
1537
+ const t = {}, s = e.primary || N, l = ["primary", "success", "warning", "danger", "info"];
1538
+ for (const d of l) {
1539
+ const x = s[d] || N[d], m = fe(x, n);
1540
+ t[`--xp-color-${d}`] = x, t[`--xp-color-${d}-light`] = m.light, t[`--xp-color-${d}-dark`] = m.dark, t[`--xp-color-${d}-bg`] = m.bg, t[`--xp-color-${d}-border`] = m.border;
1541
+ }
1542
+ const u = e[n] || J[n];
1543
+ for (const d of Object.keys(u.text)) t[`--xp-text-color-${d}`] = u.text[d];
1544
+ t["--xp-border-color"] = u.border.base, t["--xp-border-color-light"] = u.border.light, t["--xp-border-color-lighter"] = u.border.lighter;
1545
+ for (const d of Object.keys(u.bg)) t[`--xp-bg-color${d === "base" ? "" : "-" + d}`] = u.bg[d];
1546
+ for (const d of Object.keys(u.fill)) t[`--xp-fill-color${d === "base" ? "" : "-" + d}`] = u.fill[d];
1547
+ for (const d of Object.keys(u.shadow)) t[`--xp-shadow-${d}`] = u.shadow[d];
1548
+ return t;
1549
+ }
1550
+ function me(e) {
1551
+ return [
1552
+ ':root, [data-theme="light"] {',
1553
+ le(e.primary || N, "light"),
1554
+ ae(e.light || J.light),
1555
+ "}",
1556
+ "",
1557
+ '[data-theme="dark"] {',
1558
+ le(e.primary || N, "dark"),
1559
+ ae(e.dark || J.dark),
1560
+ "}"
1561
+ ].join(`
1562
+ `);
1563
+ }
1564
+ let U = null;
1565
+ function gn() {
1566
+ if (typeof document > "u") return null;
1567
+ if (U && document.contains(U)) return U;
1568
+ let e = document.querySelector("style[data-xp-ui-theme]");
1569
+ return e || (e = document.createElement("style"), e.setAttribute("data-xp-ui-theme", "true"), document.head.appendChild(e)), U = e, e;
1570
+ }
1571
+ function yn(e) {
1572
+ const n = gn();
1573
+ n && (n.textContent = me(e));
1574
+ }
1575
+ const ee = z("light"), he = z(F());
1576
+ function L(e) {
1577
+ if (["light", "dark"].includes(e) && (ee.value = e, typeof document < "u")) {
1578
+ document.documentElement.setAttribute("data-theme", e);
1579
+ try {
1580
+ localStorage.setItem("xp-ui-theme", e);
1581
+ } catch {
1582
+ }
1583
+ }
1584
+ }
1585
+ function bn() {
1586
+ L(ee.value === "light" ? "dark" : "light");
1587
+ }
1588
+ function P(e) {
1589
+ if (!e) return;
1590
+ const n = F();
1591
+ e.primary && (n.primary = { ...n.primary, ...e.primary }), e.light && (n.light = Z(n.light, e.light)), e.dark && (n.dark = Z(n.dark, e.dark)), he.value = n, yn(n);
1592
+ try {
1593
+ localStorage.setItem("xp-ui-theme-config", JSON.stringify(n));
1594
+ } catch {
1595
+ }
1596
+ }
1597
+ function _n() {
1598
+ P(F());
1599
+ }
1600
+ function kn() {
1601
+ if (typeof document > "u") return;
1602
+ let e = null;
1603
+ try {
1604
+ e = localStorage.getItem("xp-ui-theme");
1605
+ } catch {
1606
+ }
1607
+ e === "light" || e === "dark" ? L(e) : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? L("dark") : L("light");
1608
+ let n = null;
1609
+ try {
1610
+ n = localStorage.getItem("xp-ui-theme-config");
1611
+ } catch {
1612
+ }
1613
+ if (n)
1614
+ try {
1615
+ P(JSON.parse(n));
1616
+ } catch {
1617
+ P(F());
1618
+ }
1619
+ else
1620
+ P(F());
1621
+ }
1622
+ function Z(e, n) {
1623
+ if (!n || typeof n != "object") return e;
1624
+ const t = Array.isArray(e) ? [...e] : { ...e };
1625
+ for (const s of Object.keys(n))
1626
+ n[s] && typeof n[s] == "object" && !Array.isArray(n[s]) ? t[s] = Z(e[s] || {}, n[s]) : t[s] = n[s];
1627
+ return t;
1628
+ }
1629
+ function $n() {
1630
+ return {
1631
+ theme: ee,
1632
+ themeConfig: he,
1633
+ setTheme: L,
1634
+ toggleTheme: bn,
1635
+ initTheme: kn,
1636
+ applyThemeConfig: P,
1637
+ resetThemeConfig: _n,
1638
+ getDefaultThemeConfig: F,
1639
+ buildCssString: me,
1640
+ buildCssVars: vn
1641
+ };
1642
+ }
1643
+ const wn = ["data-theme"], Cn = { class: "xp-theme-customizer__header" }, Sn = { class: "xp-theme-customizer__body" }, zn = { class: "xp-theme-customizer__section" }, Bn = { class: "xp-theme-customizer__modes" }, Mn = ["onClick"], In = { class: "xp-theme-customizer__section" }, Tn = { class: "xp-theme-customizer__grid" }, Vn = { class: "xp-theme-customizer__label" }, En = { class: "xp-theme-customizer__input" }, An = ["value", "onInput"], Dn = ["value", "onChange"], jn = { class: "xp-theme-customizer__section" }, Nn = { class: "xp-theme-customizer__grid" }, Fn = { class: "xp-theme-customizer__label" }, Rn = { class: "xp-theme-customizer__input" }, On = ["value", "onInput"], Xn = ["value", "onChange"], Ln = { class: "xp-theme-customizer__section" }, Pn = { class: "xp-theme-customizer__grid" }, Wn = { class: "xp-theme-customizer__label" }, Jn = { class: "xp-theme-customizer__input" }, Hn = ["value", "onInput"], Un = ["value", "onChange"], Gn = { class: "xp-theme-customizer__section" }, qn = { class: "xp-theme-customizer__grid" }, Yn = { class: "xp-theme-customizer__label" }, Kn = { class: "xp-theme-customizer__input" }, Zn = ["value", "onInput"], Qn = ["value", "onChange"], eo = { class: "xp-theme-customizer__label" }, to = { class: "xp-theme-customizer__input" }, no = ["value", "onInput"], oo = ["value", "onChange"], so = {
1644
+ __name: "ThemeCustomizer",
1645
+ props: {
1646
+ modelValue: {
1647
+ type: Boolean,
1648
+ default: !1
1649
+ }
1650
+ },
1651
+ emits: ["update:modelValue"],
1652
+ setup(e, { emit: n }) {
1653
+ const { theme: t, applyThemeConfig: s, resetThemeConfig: l, getDefaultThemeConfig: u, buildCssString: d, themeConfig: x } = $n(), m = {
1654
+ primary: "主色",
1655
+ success: "成功",
1656
+ warning: "警告",
1657
+ danger: "危险",
1658
+ info: "信息",
1659
+ regular: "常规",
1660
+ secondary: "次要",
1661
+ placeholder: "占位",
1662
+ base: "基础",
1663
+ page: "页面",
1664
+ soft: "柔和",
1665
+ light: "亮",
1666
+ lighter: "更亮"
1667
+ }, f = z("light"), i = z(null), c = $e(h(x.value));
1668
+ re(x, (S) => Object.assign(c, h(S)), { deep: !0 });
1669
+ function h(S) {
1670
+ return JSON.parse(JSON.stringify(S));
1671
+ }
1672
+ function $(S) {
1673
+ if (!S) return "#ffffff";
1674
+ if (/^#([0-9a-f]{6})$/i.test(S)) return S.toLowerCase();
1675
+ const v = S.match(/rgba?\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})/);
1676
+ return v ? "#" + [v[1], v[2], v[3]].map((p) => Number(p).toString(16).padStart(2, "0")).join("") : "#ffffff";
1677
+ }
1678
+ function w(S, v) {
1679
+ c.primary[S] = v, s(c);
1680
+ }
1681
+ function I(S, v, p) {
1682
+ c[f.value][S][v] = p, s(c);
1683
+ }
1684
+ function te() {
1685
+ l();
1686
+ }
1687
+ function ve() {
1688
+ ne("xp-ui-theme.json", JSON.stringify(c, null, 2), "application/json");
1689
+ }
1690
+ function ge() {
1691
+ ne("xp-ui-theme.css", d(c), "text/css");
1692
+ }
1693
+ function ye() {
1694
+ i.value && i.value.click();
1695
+ }
1696
+ function be(S) {
1697
+ const v = S.target.files && S.target.files[0];
1698
+ if (!v) return;
1699
+ const p = new FileReader();
1700
+ p.onload = () => {
1701
+ try {
1702
+ const y = JSON.parse(p.result);
1703
+ s(y);
1704
+ } catch (y) {
1705
+ alert(`主题配置解析失败:
1706
+ ` + y.message);
1707
+ } finally {
1708
+ S.target.value = "";
1709
+ }
1710
+ }, p.readAsText(v);
1711
+ }
1712
+ function ne(S, v, p) {
1713
+ const y = new Blob([v], { type: p + ";charset=utf-8" }), oe = URL.createObjectURL(y), O = document.createElement("a");
1714
+ O.href = oe, O.download = S, document.body.appendChild(O), O.click(), O.remove(), setTimeout(() => URL.revokeObjectURL(oe), 0);
1715
+ }
1716
+ return (S, v) => (a(), r(_, null, [
1717
+ A(D, { name: "xp-fade" }, {
1718
+ default: E(() => [
1719
+ e.modelValue ? (a(), r("div", {
1720
+ key: 0,
1721
+ class: "xp-theme-customizer-backdrop",
1722
+ onClick: v[0] || (v[0] = j((p) => S.$emit("update:modelValue", !1), ["self"]))
1723
+ })) : g("", !0)
1724
+ ]),
1725
+ _: 1
1726
+ }),
1727
+ A(D, { name: "xp-slide" }, {
1728
+ default: E(() => [
1729
+ e.modelValue ? (a(), r("aside", {
1730
+ key: 0,
1731
+ class: "xp-theme-customizer",
1732
+ "data-theme": ce(t)
1733
+ }, [
1734
+ o("header", Cn, [
1735
+ v[2] || (v[2] = o("div", { class: "xp-theme-customizer__title" }, "🎨 主题定制", -1)),
1736
+ o("button", {
1737
+ class: "xp-theme-customizer__close",
1738
+ onClick: v[1] || (v[1] = (p) => S.$emit("update:modelValue", !1)),
1739
+ "aria-label": "关闭"
1740
+ }, "✕")
1741
+ ]),
1742
+ o("div", Sn, [
1743
+ o("section", zn, [
1744
+ v[3] || (v[3] = o("p", { class: "xp-theme-customizer__desc" }, " 修改下方颜色即可改变整个示例/库的外观。导出后可直接放进你自己的项目中应用。 ", -1)),
1745
+ o("div", Bn, [
1746
+ (a(), r(_, null, V(["light", "dark"], (p) => o("button", {
1747
+ key: p,
1748
+ class: B(["xp-theme-customizer__mode-btn", { "is-active": f.value === p }]),
1749
+ onClick: (y) => f.value = p
1750
+ }, k(p === "light" ? "浅色" : "暗黑"), 11, Mn)), 64))
1751
+ ])
1752
+ ]),
1753
+ o("section", In, [
1754
+ v[4] || (v[4] = o("h3", { class: "xp-theme-customizer__h" }, "主色", -1)),
1755
+ o("div", Tn, [
1756
+ (a(), r(_, null, V(["primary", "success", "warning", "danger", "info"], (p) => o("div", {
1757
+ key: p,
1758
+ class: "xp-theme-customizer__item"
1759
+ }, [
1760
+ o("div", Vn, k(m[p]), 1),
1761
+ o("div", En, [
1762
+ o("input", {
1763
+ type: "color",
1764
+ value: c.primary[p],
1765
+ onInput: (y) => w(p, y.target.value)
1766
+ }, null, 40, An),
1767
+ o("input", {
1768
+ type: "text",
1769
+ value: c.primary[p],
1770
+ onChange: (y) => w(p, y.target.value)
1771
+ }, null, 40, Dn)
1772
+ ])
1773
+ ])), 64))
1774
+ ])
1775
+ ]),
1776
+ o("section", jn, [
1777
+ v[5] || (v[5] = o("h3", { class: "xp-theme-customizer__h" }, "文本", -1)),
1778
+ o("div", Nn, [
1779
+ (a(), r(_, null, V(["primary", "regular", "secondary", "placeholder"], (p) => o("div", {
1780
+ key: "t-" + p,
1781
+ class: "xp-theme-customizer__item"
1782
+ }, [
1783
+ o("div", Fn, k(m[p]), 1),
1784
+ o("div", Rn, [
1785
+ o("input", {
1786
+ type: "color",
1787
+ value: $(c[f.value].text[p]),
1788
+ onInput: (y) => I("text", p, y.target.value)
1789
+ }, null, 40, On),
1790
+ o("input", {
1791
+ type: "text",
1792
+ value: c[f.value].text[p],
1793
+ onChange: (y) => I("text", p, y.target.value)
1794
+ }, null, 40, Xn)
1795
+ ])
1796
+ ])), 64))
1797
+ ])
1798
+ ]),
1799
+ o("section", Ln, [
1800
+ v[6] || (v[6] = o("h3", { class: "xp-theme-customizer__h" }, "背景", -1)),
1801
+ o("div", Pn, [
1802
+ (a(), r(_, null, V(["base", "page", "soft"], (p) => o("div", {
1803
+ key: "bg-" + p,
1804
+ class: "xp-theme-customizer__item"
1805
+ }, [
1806
+ o("div", Wn, k(m[p]), 1),
1807
+ o("div", Jn, [
1808
+ o("input", {
1809
+ type: "color",
1810
+ value: $(c[f.value].bg[p]),
1811
+ onInput: (y) => I("bg", p, y.target.value)
1812
+ }, null, 40, Hn),
1813
+ o("input", {
1814
+ type: "text",
1815
+ value: c[f.value].bg[p],
1816
+ onChange: (y) => I("bg", p, y.target.value)
1817
+ }, null, 40, Un)
1818
+ ])
1819
+ ])), 64))
1820
+ ])
1821
+ ]),
1822
+ o("section", Gn, [
1823
+ v[7] || (v[7] = o("h3", { class: "xp-theme-customizer__h" }, "边框 / 填充", -1)),
1824
+ o("div", qn, [
1825
+ (a(), r(_, null, V(["base", "light", "lighter"], (p) => o("div", {
1826
+ key: "bd-" + p,
1827
+ class: "xp-theme-customizer__item"
1828
+ }, [
1829
+ o("div", Yn, "边框 - " + k(m[p]), 1),
1830
+ o("div", Kn, [
1831
+ o("input", {
1832
+ type: "color",
1833
+ value: $(c[f.value].border[p]),
1834
+ onInput: (y) => I("border", p, y.target.value)
1835
+ }, null, 40, Zn),
1836
+ o("input", {
1837
+ type: "text",
1838
+ value: c[f.value].border[p],
1839
+ onChange: (y) => I("border", p, y.target.value)
1840
+ }, null, 40, Qn)
1841
+ ])
1842
+ ])), 64)),
1843
+ (a(), r(_, null, V(["base", "light", "lighter"], (p) => o("div", {
1844
+ key: "fl-" + p,
1845
+ class: "xp-theme-customizer__item"
1846
+ }, [
1847
+ o("div", eo, "填充 - " + k(m[p]), 1),
1848
+ o("div", to, [
1849
+ o("input", {
1850
+ type: "color",
1851
+ value: $(c[f.value].fill[p]),
1852
+ onInput: (y) => I("fill", p, y.target.value)
1853
+ }, null, 40, no),
1854
+ o("input", {
1855
+ type: "text",
1856
+ value: c[f.value].fill[p],
1857
+ onChange: (y) => I("fill", p, y.target.value)
1858
+ }, null, 40, oo)
1859
+ ])
1860
+ ])), 64))
1861
+ ])
1862
+ ]),
1863
+ v[8] || (v[8] = o("section", { class: "xp-theme-customizer__section" }, [
1864
+ o("h3", { class: "xp-theme-customizer__h" }, "实时预览"),
1865
+ o("div", { class: "xp-theme-customizer__preview" }, [
1866
+ o("div", { class: "xp-preview-row" }, [
1867
+ o("button", { class: "xp-preview-btn xp-preview-btn--primary" }, "Primary"),
1868
+ o("button", { class: "xp-preview-btn xp-preview-btn--success" }, "Success"),
1869
+ o("button", { class: "xp-preview-btn xp-preview-btn--warning" }, "Warning"),
1870
+ o("button", { class: "xp-preview-btn xp-preview-btn--danger" }, "Danger")
1871
+ ]),
1872
+ o("div", { class: "xp-preview-text xp-preview-text--primary" }, "主标题文本"),
1873
+ o("div", { class: "xp-preview-text" }, "正文内容样例 Regular text"),
1874
+ o("div", { class: "xp-preview-text xp-preview-text--secondary" }, "次要提示")
1875
+ ])
1876
+ ], -1))
1877
+ ]),
1878
+ o("footer", { class: "xp-theme-customizer__footer" }, [
1879
+ o("button", {
1880
+ class: "xp-theme-customizer__action",
1881
+ onClick: te
1882
+ }, "恢复默认"),
1883
+ o("button", {
1884
+ class: "xp-theme-customizer__action xp-theme-customizer__action--secondary",
1885
+ onClick: ye
1886
+ }, "导入 JSON"),
1887
+ o("button", {
1888
+ class: "xp-theme-customizer__action xp-theme-customizer__action--primary",
1889
+ onClick: ve
1890
+ }, "导出 JSON"),
1891
+ o("button", {
1892
+ class: "xp-theme-customizer__action xp-theme-customizer__action--primary",
1893
+ onClick: ge
1894
+ }, "导出 CSS")
1895
+ ]),
1896
+ o("input", {
1897
+ ref_key: "importFileInput",
1898
+ ref: i,
1899
+ type: "file",
1900
+ accept: "application/json,.json,.txt",
1901
+ class: "xp-theme-customizer__hidden",
1902
+ onChange: be
1903
+ }, null, 544)
1904
+ ], 8, wn)) : g("", !0)
1905
+ ]),
1906
+ _: 1
1907
+ })
1908
+ ], 64));
1909
+ }
1910
+ }, X = z([]);
1911
+ let lo = 0;
1912
+ function bo() {
1913
+ function e(n, t = "info", s = 2600) {
1914
+ const l = ++lo;
1915
+ X.value.push({ id: l, message: n, type: t }), setTimeout(() => {
1916
+ const u = X.value.findIndex((d) => d.id === l);
1917
+ u >= 0 && X.value.splice(u, 1);
1918
+ }, s);
1919
+ }
1920
+ return {
1921
+ toasts: X,
1922
+ toast: e,
1923
+ success: (n) => e(n, "success", 2200),
1924
+ error: (n) => e(n, "error", 3600),
1925
+ info: (n) => e(n, "info"),
1926
+ warn: (n) => e(n, "warn", 2800)
1927
+ };
1928
+ }
1929
+ const ao = {
1930
+ class: "xp-toast-wrap",
1931
+ "aria-live": "polite"
1932
+ }, io = { class: "xp-toast__msg" }, ro = {
1933
+ __name: "Toast",
1934
+ setup(e) {
1935
+ return (n, t) => (a(), R(H, { to: "body" }, [
1936
+ o("div", ao, [
1937
+ A(we, { name: "xp-toast" }, {
1938
+ default: E(() => [
1939
+ (a(!0), r(_, null, V(ce(X), (s) => (a(), r("div", {
1940
+ key: s.id,
1941
+ class: B(["xp-toast", `xp-toast--${s.type}`])
1942
+ }, [
1943
+ t[0] || (t[0] = o("span", {
1944
+ class: "xp-toast__dot",
1945
+ "aria-hidden": "true"
1946
+ }, null, -1)),
1947
+ o("span", io, k(s.message), 1)
1948
+ ], 2))), 128))
1949
+ ]),
1950
+ _: 1
1951
+ })
1952
+ ])
1953
+ ]));
1954
+ }
1955
+ }, uo = /* @__PURE__ */ C(ro, [["__scopeId", "data-v-b564201c"]]), co = { class: "xp-tooltip__content" }, po = {
1956
+ __name: "Tooltip",
1957
+ props: {
1958
+ content: {
1959
+ type: String,
1960
+ default: ""
1961
+ },
1962
+ placement: {
1963
+ type: String,
1964
+ default: "top",
1965
+ validator: (e) => ["top", "bottom", "left", "right"].includes(e)
1966
+ },
1967
+ trigger: {
1968
+ type: String,
1969
+ default: "hover",
1970
+ validator: (e) => ["hover", "click", "manual"].includes(e)
1971
+ },
1972
+ disabled: {
1973
+ type: Boolean,
1974
+ default: !1
1975
+ }
1976
+ },
1977
+ setup(e) {
1978
+ const n = e, t = z(!1), s = z({}), l = z(null), u = z(null);
1979
+ let d = null;
1980
+ const x = () => {
1981
+ ue(() => {
1982
+ if (!l.value || !u.value) return;
1983
+ const c = l.value.getBoundingClientRect(), h = u.value.getBoundingClientRect();
1984
+ let $ = 0, w = 0;
1985
+ switch (n.placement) {
1986
+ case "top":
1987
+ $ = c.top - h.height - 8, w = c.left + c.width / 2 - h.width / 2;
1988
+ break;
1989
+ case "bottom":
1990
+ $ = c.bottom + 8, w = c.left + c.width / 2 - h.width / 2;
1991
+ break;
1992
+ case "left":
1993
+ $ = c.top + c.height / 2 - h.height / 2, w = c.left - h.width - 8;
1994
+ break;
1995
+ case "right":
1996
+ $ = c.top + c.height / 2 - h.height / 2, w = c.right + 8;
1997
+ break;
1998
+ }
1999
+ s.value = {
2000
+ top: `${$ + window.scrollY}px`,
2001
+ left: `${w + window.scrollX}px`
2002
+ };
2003
+ });
2004
+ }, m = () => {
2005
+ n.disabled || (clearTimeout(d), d = setTimeout(() => {
2006
+ t.value = !0, x();
2007
+ }, 100));
2008
+ }, f = () => {
2009
+ clearTimeout(d), d = setTimeout(() => {
2010
+ t.value = !1;
2011
+ }, 150);
2012
+ }, i = () => {
2013
+ n.trigger !== "click" || n.disabled || (t.value = !t.value, t.value && x());
2014
+ };
2015
+ return Q(() => {
2016
+ clearTimeout(d);
2017
+ }), (c, h) => (a(), r("div", {
2018
+ class: "xp-tooltip",
2019
+ ref_key: "tooltipRef",
2020
+ ref: l
2021
+ }, [
2022
+ o("div", {
2023
+ class: "xp-tooltip__trigger",
2024
+ onMouseenter: m,
2025
+ onMouseleave: f,
2026
+ onClick: i
2027
+ }, [
2028
+ b(c.$slots, "default", {}, void 0, !0)
2029
+ ], 32),
2030
+ (a(), R(H, { to: "body" }, [
2031
+ A(D, { name: "xp-tooltip-fade" }, {
2032
+ default: E(() => [
2033
+ t.value ? (a(), r("div", {
2034
+ key: 0,
2035
+ class: B(["xp-tooltip__popper", [`xp-tooltip__popper--${e.placement}`]]),
2036
+ style: T(s.value),
2037
+ ref_key: "popperRef",
2038
+ ref: u
2039
+ }, [
2040
+ o("div", co, [
2041
+ b(c.$slots, "content", {}, () => [
2042
+ W(k(e.content), 1)
2043
+ ], !0)
2044
+ ]),
2045
+ h[0] || (h[0] = o("div", { class: "xp-tooltip__arrow" }, null, -1))
2046
+ ], 6)) : g("", !0)
2047
+ ]),
2048
+ _: 3
2049
+ })
2050
+ ]))
2051
+ ], 512));
2052
+ }
2053
+ }, fo = /* @__PURE__ */ C(po, [["__scopeId", "data-v-6d9af40b"]]), xe = {
2054
+ XpAlert: Ie,
2055
+ XpAvatar: De,
2056
+ XpBadge: Fe,
2057
+ XpButton: K,
2058
+ XpCard: qe,
2059
+ XpCheckbox: et,
2060
+ XpContextMenu: at,
2061
+ XpDialog: pt,
2062
+ XpDropdown: vt,
2063
+ XpEmpty: $t,
2064
+ XpFileIcon: St,
2065
+ XpIcon: Tt,
2066
+ XpInput: jt,
2067
+ XpProgress: Rt,
2068
+ XpRadio: Wt,
2069
+ XpRate: Yt,
2070
+ XpSwitch: en,
2071
+ XpTabPane: on,
2072
+ XpTabs: un,
2073
+ XpTag: pn,
2074
+ XpThemeCustomizer: so,
2075
+ XpToast: uo,
2076
+ XpTooltip: fo
2077
+ }, mo = (e) => {
2078
+ Object.entries(xe).forEach(([n, t]) => {
2079
+ e.component(n, t);
2080
+ });
2081
+ }, _o = {
2082
+ install: mo,
2083
+ ...xe
2084
+ };
2085
+ export {
2086
+ N as DEFAULT_PRIMARY,
2087
+ J as DEFAULT_TOKENS,
2088
+ Ie as XpAlert,
2089
+ De as XpAvatar,
2090
+ Fe as XpBadge,
2091
+ K as XpButton,
2092
+ qe as XpCard,
2093
+ et as XpCheckbox,
2094
+ at as XpContextMenu,
2095
+ pt as XpDialog,
2096
+ vt as XpDropdown,
2097
+ $t as XpEmpty,
2098
+ St as XpFileIcon,
2099
+ Tt as XpIcon,
2100
+ jt as XpInput,
2101
+ Rt as XpProgress,
2102
+ Wt as XpRadio,
2103
+ Yt as XpRate,
2104
+ en as XpSwitch,
2105
+ on as XpTabPane,
2106
+ un as XpTabs,
2107
+ pn as XpTag,
2108
+ so as XpThemeCustomizer,
2109
+ uo as XpToast,
2110
+ fo as XpTooltip,
2111
+ P as applyThemeConfig,
2112
+ me as buildCssString,
2113
+ vn as buildCssVars,
2114
+ q as darken,
2115
+ _o as default,
2116
+ vo as deriveDark,
2117
+ xo as deriveLight,
2118
+ F as getDefaultThemeConfig,
2119
+ kn as initTheme,
2120
+ mo as install,
2121
+ yo as isDark,
2122
+ G as lighten,
2123
+ pe as mix,
2124
+ Y as parseColor,
2125
+ _n as resetThemeConfig,
2126
+ L as setTheme,
2127
+ xn as toHex,
2128
+ X as toasts,
2129
+ bn as toggleTheme,
2130
+ $n as useTheme,
2131
+ bo as useToast,
2132
+ go as withAlpha
2133
+ };