@xto/feedback 0.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.
package/es/index.mjs ADDED
@@ -0,0 +1,1233 @@
1
+ import { defineComponent as N, ref as E, computed as I, watch as ne, openBlock as x, createBlock as X, Teleport as le, createVNode as ie, Transition as j, withCtx as F, createElementBlock as $, normalizeStyle as H, normalizeClass as m, unref as v, createElementVNode as z, withModifiers as pe, renderSlot as L, createTextVNode as W, toDisplayString as V, createCommentVNode as M, nextTick as Q, onUnmounted as ae, withDirectives as he, vShow as ge, onMounted as xe, reactive as be, createApp as me, h as b } from "vue";
2
+ import { useNamespace as U, useZIndex as we, useEscape as Ce, nextMessageZIndex as ke } from "@xto/core";
3
+ const Ze = /* @__PURE__ */ N({
4
+ name: "XModal",
5
+ __name: "index",
6
+ props: {
7
+ modelValue: { type: Boolean, default: !1 },
8
+ title: { default: "" },
9
+ width: { default: "50%" },
10
+ top: { default: "15vh" },
11
+ modal: { type: Boolean, default: !0 },
12
+ closeOnClickModal: { type: Boolean, default: !0 },
13
+ closeOnPressEscape: { type: Boolean, default: !0 },
14
+ showClose: { type: Boolean, default: !0 },
15
+ center: { type: Boolean, default: !1 },
16
+ destroyOnClose: { type: Boolean, default: !1 }
17
+ },
18
+ emits: ["update:modelValue", "close", "open"],
19
+ setup(e, { emit: l }) {
20
+ const t = e, a = l, o = U("modal"), { next: i } = we(), f = E(i()), d = I({
21
+ get: () => t.modelValue,
22
+ set: (g) => a("update:modelValue", g)
23
+ }), u = E(), n = () => {
24
+ d.value = !1, a("close");
25
+ }, p = () => {
26
+ t.closeOnClickModal && t.modal && n();
27
+ };
28
+ Ce(() => {
29
+ t.closeOnPressEscape && d.value && n();
30
+ }), ne(() => t.modelValue, (g) => {
31
+ g && (f.value = i(), a("open"));
32
+ });
33
+ const r = I(() => ({
34
+ paddingTop: t.top
35
+ })), h = I(() => ({
36
+ width: typeof t.width == "number" ? `${t.width}px` : t.width,
37
+ zIndex: f.value
38
+ }));
39
+ return (g, B) => (x(), X(le, { to: "body" }, [
40
+ ie(j, { name: "x-modal-fade" }, {
41
+ default: F(() => [
42
+ e.modelValue ? (x(), $("div", {
43
+ key: 0,
44
+ class: m(v(o).e("wrapper")),
45
+ style: H(r.value),
46
+ onClick: p
47
+ }, [
48
+ z("div", {
49
+ ref_key: "modalRef",
50
+ ref: u,
51
+ class: m(v(o).b()),
52
+ style: H(h.value),
53
+ onClick: B[0] || (B[0] = pe(() => {
54
+ }, ["stop"]))
55
+ }, [
56
+ z("div", {
57
+ class: m(v(o).e("header"))
58
+ }, [
59
+ z("span", {
60
+ class: m(v(o).e("title"))
61
+ }, [
62
+ L(g.$slots, "title", {}, () => [
63
+ W(V(e.title), 1)
64
+ ])
65
+ ], 2),
66
+ e.showClose ? (x(), $("button", {
67
+ key: 0,
68
+ class: m(v(o).e("close")),
69
+ onClick: n
70
+ }, " ✕ ", 2)) : M("", !0)
71
+ ], 2),
72
+ z("div", {
73
+ class: m(v(o).e("body"))
74
+ }, [
75
+ L(g.$slots, "default")
76
+ ], 2),
77
+ g.$slots.footer ? (x(), $("div", {
78
+ key: 0,
79
+ class: m(v(o).e("footer"))
80
+ }, [
81
+ L(g.$slots, "footer")
82
+ ], 2)) : M("", !0)
83
+ ], 6)
84
+ ], 6)) : M("", !0)
85
+ ]),
86
+ _: 3
87
+ })
88
+ ]));
89
+ }
90
+ }), Ke = /* @__PURE__ */ N({
91
+ name: "XDrawer",
92
+ __name: "index",
93
+ props: {
94
+ modelValue: { type: Boolean, default: !1 },
95
+ title: { default: "" },
96
+ direction: { default: "rtl" },
97
+ size: { default: "30%" },
98
+ withHeader: { type: Boolean, default: !0 },
99
+ showClose: { type: Boolean, default: !0 },
100
+ closeOnClickModal: { type: Boolean, default: !0 },
101
+ destroyOnClose: { type: Boolean, default: !1 }
102
+ },
103
+ emits: ["update:modelValue", "close", "open"],
104
+ setup(e, { emit: l }) {
105
+ const t = e, a = l, o = U("drawer"), i = E(2e3), f = () => {
106
+ a("update:modelValue", !1), a("close");
107
+ }, d = () => {
108
+ t.closeOnClickModal && f();
109
+ }, u = (r) => {
110
+ r.key === "Escape" && t.modelValue && f();
111
+ };
112
+ ne(() => t.modelValue, (r) => {
113
+ r ? (i.value = 2e3 + Math.floor(Math.random() * 100), a("open"), document.addEventListener("keydown", u)) : document.removeEventListener("keydown", u);
114
+ });
115
+ const n = I(() => ({
116
+ zIndex: i.value
117
+ })), p = I(() => {
118
+ const r = typeof t.size == "number" ? `${t.size}px` : t.size;
119
+ return {
120
+ ltr: { width: r, height: "100%" },
121
+ rtl: { width: r, height: "100%" },
122
+ ttb: { width: "100%", height: r },
123
+ btt: { width: "100%", height: r }
124
+ }[t.direction];
125
+ });
126
+ return (r, h) => (x(), X(le, { to: "body" }, [
127
+ ie(j, { name: "x-drawer-fade" }, {
128
+ default: F(() => [
129
+ e.modelValue ? (x(), $("div", {
130
+ key: 0,
131
+ class: m(v(o).e("overlay")),
132
+ style: H(n.value),
133
+ onClick: d
134
+ }, [
135
+ z("div", {
136
+ class: m([v(o).b(), v(o).m(e.direction)]),
137
+ style: H(p.value),
138
+ onClick: h[0] || (h[0] = pe(() => {
139
+ }, ["stop"]))
140
+ }, [
141
+ e.withHeader ? (x(), $("div", {
142
+ key: 0,
143
+ class: m(v(o).e("header"))
144
+ }, [
145
+ z("span", {
146
+ class: m(v(o).e("title"))
147
+ }, [
148
+ L(r.$slots, "title", {}, () => [
149
+ W(V(e.title), 1)
150
+ ])
151
+ ], 2),
152
+ e.showClose ? (x(), $("button", {
153
+ key: 0,
154
+ class: m(v(o).e("close")),
155
+ onClick: f
156
+ }, " ✕ ", 2)) : M("", !0)
157
+ ], 2)) : M("", !0),
158
+ z("div", {
159
+ class: m(v(o).e("body"))
160
+ }, [
161
+ L(r.$slots, "default")
162
+ ], 2),
163
+ r.$slots.footer ? (x(), $("div", {
164
+ key: 1,
165
+ class: m(v(o).e("footer"))
166
+ }, [
167
+ L(r.$slots, "footer")
168
+ ], 2)) : M("", !0)
169
+ ], 6)
170
+ ], 6)) : M("", !0)
171
+ ]),
172
+ _: 3
173
+ })
174
+ ]));
175
+ }
176
+ }), Ue = /* @__PURE__ */ N({
177
+ name: "XAlert",
178
+ __name: "index",
179
+ props: {
180
+ type: { default: "info" },
181
+ title: { default: "" },
182
+ description: {},
183
+ closable: { type: Boolean, default: !0 },
184
+ showIcon: { type: Boolean, default: !1 },
185
+ center: { type: Boolean, default: !1 }
186
+ },
187
+ emits: ["close"],
188
+ setup(e, { emit: l }) {
189
+ const t = e, a = l, o = U("alert"), i = E(!0), f = {
190
+ success: "✓",
191
+ warning: "⚠",
192
+ error: "✕",
193
+ info: "ℹ"
194
+ }, d = I(() => [
195
+ o.b(),
196
+ o.m(t.type),
197
+ o.is("center", t.center),
198
+ o.is("with-description", t.description)
199
+ ]), u = (n) => {
200
+ i.value = !1, a("close", n);
201
+ };
202
+ return (n, p) => (x(), X(j, { name: "x-alert-fade" }, {
203
+ default: F(() => [
204
+ i.value ? (x(), $("div", {
205
+ key: 0,
206
+ class: m(d.value)
207
+ }, [
208
+ e.showIcon ? (x(), $("span", {
209
+ key: 0,
210
+ class: m(v(o).e("icon"))
211
+ }, V(f[e.type]), 3)) : M("", !0),
212
+ z("div", {
213
+ class: m(v(o).e("content"))
214
+ }, [
215
+ e.title || n.$slots.title ? (x(), $("span", {
216
+ key: 0,
217
+ class: m(v(o).e("title"))
218
+ }, [
219
+ L(n.$slots, "title", {}, () => [
220
+ W(V(e.title), 1)
221
+ ])
222
+ ], 2)) : M("", !0),
223
+ e.description || n.$slots.default ? (x(), $("span", {
224
+ key: 1,
225
+ class: m(v(o).e("description"))
226
+ }, [
227
+ L(n.$slots, "default", {}, () => [
228
+ W(V(e.description), 1)
229
+ ])
230
+ ], 2)) : M("", !0)
231
+ ], 2),
232
+ e.closable ? (x(), $("button", {
233
+ key: 1,
234
+ class: m(v(o).e("close")),
235
+ onClick: u
236
+ }, " ✕ ", 2)) : M("", !0)
237
+ ], 2)) : M("", !0)
238
+ ]),
239
+ _: 3
240
+ }));
241
+ }
242
+ }), Ye = /* @__PURE__ */ N({
243
+ name: "XTooltip",
244
+ __name: "index",
245
+ props: {
246
+ content: { default: "" },
247
+ placement: { default: "top" },
248
+ effect: { default: "dark" },
249
+ disabled: { type: Boolean, default: !1 },
250
+ offset: { default: 8 },
251
+ transition: { default: "fade" },
252
+ visibleArrow: { type: Boolean, default: !0 },
253
+ trigger: { default: "hover" },
254
+ openDelay: { default: 0 },
255
+ closeDelay: { default: 0 }
256
+ },
257
+ emits: ["update:visible", "show", "hide"],
258
+ setup(e, { emit: l }) {
259
+ const t = e, a = l, o = U("tooltip"), i = E(!1), f = E(), d = E();
260
+ let u, n;
261
+ const p = E({}), r = () => {
262
+ if (!f.value || !d.value) return;
263
+ const k = f.value.getBoundingClientRect(), O = d.value;
264
+ O.style.visibility = "hidden", O.style.display = "block";
265
+ const _ = O.offsetWidth, D = O.offsetHeight, A = t.offset, ce = window.innerWidth, de = window.innerHeight;
266
+ let P = 0, R = 0, Y = t.placement;
267
+ switch (t.placement) {
268
+ case "top":
269
+ P = k.top - D - A, R = k.left + (k.width - _) / 2;
270
+ break;
271
+ case "bottom":
272
+ P = k.bottom + A, R = k.left + (k.width - _) / 2;
273
+ break;
274
+ case "left":
275
+ P = k.top + (k.height - D) / 2, R = k.left - _ - A;
276
+ break;
277
+ case "right":
278
+ P = k.top + (k.height - D) / 2, R = k.right + A;
279
+ break;
280
+ }
281
+ t.placement === "top" && P < 0 ? (Y = "bottom", P = k.bottom + A) : t.placement === "bottom" && P + D > de ? (Y = "top", P = k.top - D - A) : t.placement === "left" && R < 0 ? (Y = "right", R = k.right + A) : t.placement === "right" && R + _ > ce && (Y = "left", R = k.left - _ - A), R < 8 && (R = 8), R + _ > ce - 8 && (R = ce - _ - 8), P < 8 && (P = 8), P + D > de - 8 && (P = de - D - 8), p.value = {
282
+ position: "fixed",
283
+ top: `${P}px`,
284
+ left: `${R}px`,
285
+ visibility: "visible",
286
+ zIndex: "2000"
287
+ }, h.value = Y;
288
+ }, h = E(t.placement), g = () => {
289
+ t.disabled || (clearTimeout(n), u = setTimeout(() => {
290
+ i.value = !0, a("update:visible", !0), a("show"), Q(() => {
291
+ r();
292
+ });
293
+ }, t.openDelay));
294
+ }, B = () => {
295
+ clearTimeout(u), n = setTimeout(() => {
296
+ i.value = !1, a("update:visible", !1), a("hide");
297
+ }, t.closeDelay);
298
+ }, w = () => {
299
+ i.value ? B() : g();
300
+ }, C = () => {
301
+ t.trigger === "hover" && g();
302
+ }, s = () => {
303
+ t.trigger === "hover" && B();
304
+ }, c = () => {
305
+ t.trigger === "click" && w();
306
+ }, Z = () => {
307
+ t.trigger === "focus" && g();
308
+ }, S = () => {
309
+ t.trigger === "focus" && B();
310
+ }, T = (k) => {
311
+ var O, _;
312
+ t.trigger === "click" && !((O = f.value) != null && O.contains(k.target)) && !((_ = d.value) != null && _.contains(k.target)) && B();
313
+ }, y = () => {
314
+ i.value && r();
315
+ };
316
+ ne(i, (k) => {
317
+ k ? Q(() => {
318
+ r(), t.trigger === "click" && document.addEventListener("click", T), window.addEventListener("scroll", y, !0), window.addEventListener("resize", y);
319
+ }) : (document.removeEventListener("click", T), window.removeEventListener("scroll", y, !0), window.removeEventListener("resize", y));
320
+ }), ae(() => {
321
+ clearTimeout(u), clearTimeout(n), document.removeEventListener("click", T), window.removeEventListener("scroll", y, !0), window.removeEventListener("resize", y);
322
+ });
323
+ const ee = I(() => [
324
+ o.b(),
325
+ o.m(t.effect)
326
+ ]), te = I(() => [
327
+ o.e("arrow"),
328
+ o.e(`arrow-${h.value}`)
329
+ ]);
330
+ return (k, O) => (x(), $("div", {
331
+ class: m(v(o).e("wrapper"))
332
+ }, [
333
+ z("div", {
334
+ ref_key: "triggerRef",
335
+ ref: f,
336
+ class: m(v(o).e("trigger")),
337
+ onMouseenter: C,
338
+ onMouseleave: s,
339
+ onClick: c,
340
+ onFocus: Z,
341
+ onBlur: S
342
+ }, [
343
+ L(k.$slots, "default")
344
+ ], 34),
345
+ (x(), X(le, { to: "body" }, [
346
+ ie(j, {
347
+ name: `x-tooltip-${e.transition}`
348
+ }, {
349
+ default: F(() => [
350
+ he(z("div", {
351
+ ref_key: "tooltipRef",
352
+ ref: d,
353
+ class: m(ee.value),
354
+ style: H(p.value),
355
+ onMouseenter: C,
356
+ onMouseleave: s
357
+ }, [
358
+ L(k.$slots, "content", {}, () => [
359
+ W(V(e.content), 1)
360
+ ]),
361
+ e.visibleArrow ? (x(), $("div", {
362
+ key: 0,
363
+ class: m(te.value)
364
+ }, null, 2)) : M("", !0)
365
+ ], 38), [
366
+ [ge, i.value]
367
+ ])
368
+ ]),
369
+ _: 3
370
+ }, 8, ["name"])
371
+ ]))
372
+ ], 2));
373
+ }
374
+ }), Be = { class: "x-popconfirm-wrapper" }, Te = { class: "x-popconfirm__main" }, $e = { class: "x-popconfirm__title" }, Ee = { class: "x-popconfirm__action" }, qe = /* @__PURE__ */ N({
375
+ name: "XPopconfirm",
376
+ __name: "index",
377
+ props: {
378
+ title: { default: "" },
379
+ confirmButtonText: { default: "确定" },
380
+ cancelButtonText: { default: "取消" },
381
+ confirmButtonType: { default: "primary" },
382
+ cancelButtonType: { default: "default" },
383
+ icon: { default: "" },
384
+ iconColor: { default: "#faad14" },
385
+ hideIcon: { type: Boolean, default: !1 },
386
+ hideCancelButton: { type: Boolean, default: !1 },
387
+ hideConfirmButton: { type: Boolean, default: !1 },
388
+ disabled: { type: Boolean, default: !1 },
389
+ width: { default: 200 },
390
+ placement: { default: "top" },
391
+ offset: { default: 12 },
392
+ showArrow: { type: Boolean, default: !0 }
393
+ },
394
+ emits: ["confirm", "cancel"],
395
+ setup(e, { emit: l }) {
396
+ const t = e, a = l, o = E(!1), i = E(null), f = E(null), d = E({}), u = () => {
397
+ if (!i.value || !f.value) return;
398
+ const s = i.value.getBoundingClientRect(), c = f.value.getBoundingClientRect(), Z = t.placement, S = t.offset;
399
+ let T = 0, y = 0;
400
+ switch (Z) {
401
+ case "top":
402
+ T = s.top - c.height - S, y = s.left + (s.width - c.width) / 2;
403
+ break;
404
+ case "top-start":
405
+ T = s.top - c.height - S, y = s.left;
406
+ break;
407
+ case "top-end":
408
+ T = s.top - c.height - S, y = s.right - c.width;
409
+ break;
410
+ case "bottom":
411
+ T = s.bottom + S, y = s.left + (s.width - c.width) / 2;
412
+ break;
413
+ case "bottom-start":
414
+ T = s.bottom + S, y = s.left;
415
+ break;
416
+ case "bottom-end":
417
+ T = s.bottom + S, y = s.right - c.width;
418
+ break;
419
+ case "left":
420
+ T = s.top + (s.height - c.height) / 2, y = s.left - c.width - S;
421
+ break;
422
+ case "left-start":
423
+ T = s.top, y = s.left - c.width - S;
424
+ break;
425
+ case "left-end":
426
+ T = s.bottom - c.height, y = s.left - c.width - S;
427
+ break;
428
+ case "right":
429
+ T = s.top + (s.height - c.height) / 2, y = s.right + S;
430
+ break;
431
+ case "right-start":
432
+ T = s.top, y = s.right + S;
433
+ break;
434
+ case "right-end":
435
+ T = s.bottom - c.height, y = s.right + S;
436
+ break;
437
+ default:
438
+ T = s.top - c.height - S, y = s.left + (s.width - c.width) / 2;
439
+ }
440
+ const ee = window.innerWidth, te = window.innerHeight;
441
+ y < 0 && (y = 10), y + c.width > ee && (y = ee - c.width - 10), T < 0 && (T = 10), T + c.height > te && (T = te - c.height - 10), d.value = {
442
+ position: "fixed",
443
+ top: `${T}px`,
444
+ left: `${y}px`,
445
+ zIndex: "2000"
446
+ };
447
+ }, n = (s) => {
448
+ var c, Z;
449
+ o.value && ((c = i.value) != null && c.contains(s.target) || (Z = f.value) != null && Z.contains(s.target) || (o.value = !1));
450
+ }, p = (s) => {
451
+ t.disabled || (s.stopPropagation(), o.value = !o.value, o.value && setTimeout(u, 0));
452
+ }, r = () => {
453
+ o.value = !1, a("confirm");
454
+ }, h = () => {
455
+ o.value = !1, a("cancel");
456
+ }, g = () => {
457
+ o.value && u();
458
+ }, B = () => {
459
+ o.value && u();
460
+ };
461
+ ne(o, (s) => {
462
+ s ? (setTimeout(u, 0), document.addEventListener("click", n), window.addEventListener("scroll", g, !0), window.addEventListener("resize", B)) : (document.removeEventListener("click", n), window.removeEventListener("scroll", g, !0), window.removeEventListener("resize", B));
463
+ }), ae(() => {
464
+ document.removeEventListener("click", n), window.removeEventListener("scroll", g, !0), window.removeEventListener("resize", B);
465
+ });
466
+ const w = I(() => ({
467
+ width: typeof t.width == "number" ? `${t.width}px` : t.width
468
+ })), C = I(() => {
469
+ const s = t.placement, c = {};
470
+ switch (s) {
471
+ case "top":
472
+ case "top-start":
473
+ case "top-end":
474
+ c.bottom = "-6px", c.transform = "rotate(45deg)";
475
+ break;
476
+ case "bottom":
477
+ case "bottom-start":
478
+ case "bottom-end":
479
+ c.top = "-6px", c.transform = "rotate(225deg)";
480
+ break;
481
+ case "left":
482
+ case "left-start":
483
+ case "left-end":
484
+ c.right = "-6px", c.transform = "rotate(315deg)";
485
+ break;
486
+ case "right":
487
+ case "right-start":
488
+ case "right-end":
489
+ c.left = "-6px", c.transform = "rotate(135deg)";
490
+ break;
491
+ }
492
+ return c;
493
+ });
494
+ return (s, c) => (x(), $("span", Be, [
495
+ z("span", {
496
+ ref_key: "triggerRef",
497
+ ref: i,
498
+ class: "x-popconfirm-trigger",
499
+ onClick: p
500
+ }, [
501
+ L(s.$slots, "default")
502
+ ], 512),
503
+ (x(), X(le, { to: "body" }, [
504
+ ie(j, { name: "x-popconfirm-fade" }, {
505
+ default: F(() => [
506
+ o.value ? (x(), $("div", {
507
+ key: 0,
508
+ ref_key: "popperRef",
509
+ ref: f,
510
+ class: "x-popconfirm",
511
+ style: H({ ...d.value, ...w.value }),
512
+ onClick: c[0] || (c[0] = pe(() => {
513
+ }, ["stop"]))
514
+ }, [
515
+ e.showArrow ? (x(), $("span", {
516
+ key: 0,
517
+ class: "x-popconfirm__arrow",
518
+ style: H(C.value)
519
+ }, null, 4)) : M("", !0),
520
+ z("div", Te, [
521
+ e.hideIcon ? M("", !0) : (x(), $("span", {
522
+ key: 0,
523
+ class: "x-popconfirm__icon",
524
+ style: H({ color: e.iconColor })
525
+ }, [
526
+ L(s.$slots, "icon", {}, () => [
527
+ W(V(e.icon || "⚠"), 1)
528
+ ])
529
+ ], 4)),
530
+ z("div", $e, [
531
+ L(s.$slots, "title", {}, () => [
532
+ W(V(e.title), 1)
533
+ ])
534
+ ])
535
+ ]),
536
+ z("div", Ee, [
537
+ e.hideCancelButton ? M("", !0) : (x(), $("button", {
538
+ key: 0,
539
+ class: "x-button p-button--default p-button--small",
540
+ onClick: h
541
+ }, V(e.cancelButtonText), 1)),
542
+ e.hideConfirmButton ? M("", !0) : (x(), $("button", {
543
+ key: 1,
544
+ class: m(["x-button x-button--small", `x-button--${e.confirmButtonType}`]),
545
+ onClick: r
546
+ }, V(e.confirmButtonText), 3))
547
+ ])
548
+ ], 4)) : M("", !0)
549
+ ]),
550
+ _: 3
551
+ })
552
+ ]))
553
+ ]));
554
+ }
555
+ }), Ge = /* @__PURE__ */ N({
556
+ name: "XBacktop",
557
+ __name: "index",
558
+ props: {
559
+ visibilityHeight: { default: 200 },
560
+ right: { default: 40 },
561
+ bottom: { default: 40 }
562
+ },
563
+ emits: ["click"],
564
+ setup(e, { emit: l }) {
565
+ const t = e, a = l, o = U("backtop"), i = E(!1), f = () => {
566
+ const n = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0;
567
+ i.value = n >= t.visibilityHeight;
568
+ }, d = (n) => {
569
+ window.scrollTo({
570
+ top: 0,
571
+ behavior: "smooth"
572
+ }), a("click", n);
573
+ }, u = I(() => ({
574
+ right: `${t.right}px`,
575
+ bottom: `${t.bottom}px`
576
+ }));
577
+ return xe(() => {
578
+ window.addEventListener("scroll", f, { passive: !0, capture: !0 }), setTimeout(f, 100);
579
+ }), ae(() => {
580
+ window.removeEventListener("scroll", f, !0);
581
+ }), (n, p) => (x(), X(j, { name: "x-fade" }, {
582
+ default: F(() => [
583
+ he(z("div", {
584
+ class: m(v(o).b()),
585
+ style: H(u.value),
586
+ onClick: d
587
+ }, [
588
+ L(n.$slots, "default", {}, () => [
589
+ z("span", {
590
+ class: m(v(o).e("icon"))
591
+ }, "↑", 2)
592
+ ])
593
+ ], 6), [
594
+ [ge, i.value]
595
+ ])
596
+ ]),
597
+ _: 3
598
+ }));
599
+ }
600
+ }), Me = /* @__PURE__ */ N({
601
+ name: "XMessage",
602
+ __name: "index",
603
+ props: {
604
+ message: { default: "" },
605
+ type: { default: "info" },
606
+ duration: { default: 3e3 },
607
+ showClose: { type: Boolean, default: !1 },
608
+ center: { type: Boolean, default: !1 },
609
+ offset: { default: 20 },
610
+ customClass: {},
611
+ onClose: {}
612
+ },
613
+ emits: ["close", "destroy"],
614
+ setup(e, { expose: l, emit: t }) {
615
+ const a = e, o = t, i = U("message"), f = E(!1), d = E(ke()), u = {
616
+ success: "✓",
617
+ warning: "⚠",
618
+ error: "✕",
619
+ info: "ℹ"
620
+ }, n = I(() => [
621
+ i.b(),
622
+ i.m(a.type),
623
+ i.is("center", a.center),
624
+ i.is("closable", a.showClose),
625
+ a.customClass
626
+ ]), p = I(() => ({
627
+ top: `${a.offset}px`,
628
+ zIndex: d.value
629
+ }));
630
+ let r = null;
631
+ const h = () => {
632
+ a.duration > 0 && (r = setTimeout(() => {
633
+ B();
634
+ }, a.duration));
635
+ }, g = () => {
636
+ r && (clearTimeout(r), r = null);
637
+ }, B = () => {
638
+ var C;
639
+ f.value = !1, (C = a.onClose) == null || C.call(a), o("close");
640
+ }, w = () => {
641
+ o("destroy");
642
+ };
643
+ return xe(() => {
644
+ h(), f.value = !0;
645
+ }), ae(() => {
646
+ g();
647
+ }), l({
648
+ close: B
649
+ }), (C, s) => (x(), X(j, {
650
+ name: "x-message-fade",
651
+ onAfterLeave: w
652
+ }, {
653
+ default: F(() => [
654
+ f.value ? (x(), $("div", {
655
+ key: 0,
656
+ class: m(n.value),
657
+ style: H(p.value),
658
+ onMouseenter: g,
659
+ onMouseleave: h
660
+ }, [
661
+ z("span", {
662
+ class: m(v(i).e("icon"))
663
+ }, V(u[e.type]), 3),
664
+ z("span", {
665
+ class: m(v(i).e("content"))
666
+ }, [
667
+ L(C.$slots, "default", {}, () => [
668
+ W(V(e.message), 1)
669
+ ])
670
+ ], 2),
671
+ e.showClose ? (x(), $("button", {
672
+ key: 0,
673
+ class: m(v(i).e("close")),
674
+ onClick: B
675
+ }, " ✕ ", 2)) : M("", !0)
676
+ ], 38)) : M("", !0)
677
+ ]),
678
+ _: 3
679
+ }));
680
+ }
681
+ }), q = [];
682
+ let ze = 1;
683
+ const Se = () => {
684
+ q.slice().forEach((e) => e.close());
685
+ };
686
+ function ve(e) {
687
+ const l = ze++, t = document.createElement("div");
688
+ document.body.appendChild(t);
689
+ const a = {
690
+ success: { bg: "#f0f9eb", border: "#67c23a", icon: "✓" },
691
+ warning: { bg: "#fdf6ec", border: "#e6a23c", icon: "⚠" },
692
+ error: { bg: "#fef0f0", border: "#f56c6c", icon: "✕" },
693
+ info: { bg: "#f4f4f5", border: "#909399", icon: "ℹ" }
694
+ }, o = e.type || "info", i = a[o] || a.info, f = be({
695
+ visible: !1,
696
+ offset: e.offset ?? 20
697
+ });
698
+ let d = e.offset ?? 20;
699
+ q.forEach((w) => {
700
+ const C = w.container.firstElementChild;
701
+ C && C.offsetHeight && (d += C.offsetHeight + 16);
702
+ }), f.offset = d;
703
+ let u = null, n = !1;
704
+ const p = () => {
705
+ n || (f.visible = !1, setTimeout(() => {
706
+ if (n) return;
707
+ n = !0;
708
+ const w = q.findIndex((C) => C.id === l);
709
+ w !== -1 && q.splice(w, 1);
710
+ try {
711
+ g.unmount();
712
+ } catch {
713
+ }
714
+ t.parentNode && t.parentNode.removeChild(t);
715
+ }, 300));
716
+ }, r = () => {
717
+ const w = e.duration ?? 3e3;
718
+ w > 0 && (u = setTimeout(p, w));
719
+ }, h = () => {
720
+ u && (clearTimeout(u), u = null);
721
+ }, g = me({
722
+ render() {
723
+ if (!f.visible) return null;
724
+ const w = [
725
+ // Icon
726
+ b("span", {
727
+ style: {
728
+ display: "inline-flex",
729
+ alignItems: "center",
730
+ justifyContent: "center",
731
+ width: "20px",
732
+ height: "20px",
733
+ marginRight: "10px",
734
+ fontSize: "16px",
735
+ color: i.border
736
+ }
737
+ }, i.icon),
738
+ // Content
739
+ b("span", {
740
+ style: {
741
+ flex: "1",
742
+ fontSize: "14px",
743
+ color: "#606266",
744
+ lineHeight: "1.4"
745
+ }
746
+ }, e.message || "")
747
+ ];
748
+ return e.showClose && w.push(
749
+ b("button", {
750
+ style: {
751
+ position: "absolute",
752
+ top: "50%",
753
+ right: "12px",
754
+ transform: "translateY(-50%)",
755
+ background: "none",
756
+ border: "none",
757
+ cursor: "pointer",
758
+ fontSize: "14px",
759
+ color: "#909399",
760
+ padding: "0"
761
+ },
762
+ onClick: (C) => {
763
+ C.stopPropagation(), p();
764
+ }
765
+ }, "✕")
766
+ ), b("div", {
767
+ class: ["x-message", `x-message--${o}`, e.center ? "is-center" : "", e.showClose ? "is-closable" : ""],
768
+ style: {
769
+ position: "fixed",
770
+ left: "50%",
771
+ top: `${f.offset}px`,
772
+ transform: "translateX(-50%)",
773
+ display: "flex",
774
+ alignItems: "center",
775
+ padding: e.showClose ? "12px 40px 12px 16px" : "12px 16px",
776
+ borderRadius: "4px",
777
+ boxShadow: "0 2px 12px rgba(0,0,0,0.1)",
778
+ minWidth: "280px",
779
+ maxWidth: "480px",
780
+ backgroundColor: i.bg,
781
+ border: `1px solid ${i.border}`,
782
+ zIndex: 2e3 + l,
783
+ transition: "opacity 0.3s, transform 0.3s"
784
+ },
785
+ onMouseenter: h,
786
+ onMouseleave: r
787
+ }, w);
788
+ }
789
+ });
790
+ g.mount(t), Q(() => {
791
+ f.visible = !0, r();
792
+ });
793
+ const B = { id: l, app: g, container: t, close: p };
794
+ return q.push(B), { close: p };
795
+ }
796
+ function Ie(e) {
797
+ return ve(typeof e == "string" ? { message: e } : e);
798
+ }
799
+ const oe = (e) => (l) => ve({ ...typeof l == "string" ? { message: l } : l, type: e }), ue = Object.assign(Ie, {
800
+ info: oe("info"),
801
+ success: oe("success"),
802
+ warning: oe("warning"),
803
+ error: oe("error"),
804
+ closeAll: Se
805
+ }), Je = ue, Qe = Me, et = {
806
+ install(e) {
807
+ e.config.globalProperties.$message = ue, e.provide("message", ue);
808
+ }
809
+ }, G = [], Le = () => {
810
+ G.slice().forEach((e) => e.close());
811
+ }, Pe = {
812
+ success: { icon: "✓", color: "#67c23a" },
813
+ warning: { icon: "⚠", color: "#e6a23c" },
814
+ error: { icon: "✕", color: "#f56c6c" },
815
+ info: { icon: "ℹ", color: "#909399" }
816
+ };
817
+ function re(e) {
818
+ return new Promise((l) => {
819
+ const t = document.createElement("div");
820
+ document.body.appendChild(t);
821
+ let a = !1;
822
+ const o = N({
823
+ name: "TMessageBox",
824
+ setup() {
825
+ const d = E(!1), u = E(e.inputValue ?? ""), n = E(""), p = 2e3 + G.length + 1, r = (C) => {
826
+ a || (a = !0, d.value = !1, setTimeout(() => {
827
+ const s = G.findIndex((c) => c.container === t);
828
+ s !== -1 && G.splice(s, 1);
829
+ try {
830
+ i.unmount();
831
+ } catch {
832
+ }
833
+ t.parentNode && t.parentNode.removeChild(t), l({
834
+ action: C,
835
+ value: C === "confirm" ? u.value : void 0
836
+ });
837
+ }, 300));
838
+ }, h = () => {
839
+ if (e.showInput && e.inputPattern && !e.inputPattern.test(u.value)) {
840
+ n.value = e.inputErrorMessage || "输入格式不正确";
841
+ return;
842
+ }
843
+ n.value = "", r("confirm");
844
+ }, g = () => {
845
+ r("cancel");
846
+ }, B = () => {
847
+ r("close");
848
+ }, w = () => {
849
+ e.closeOnClickModal !== !1 && B();
850
+ };
851
+ return Q(() => {
852
+ d.value = !0;
853
+ }), {
854
+ visible: d,
855
+ inputValue: u,
856
+ inputError: n,
857
+ zIndex: p,
858
+ handleConfirm: h,
859
+ handleCancel: g,
860
+ handleClose: B,
861
+ handleMaskClick: w
862
+ };
863
+ },
864
+ render() {
865
+ if (!this.visible) return null;
866
+ const d = e.type, u = d ? Pe[d] : null, n = [];
867
+ u && n.push(
868
+ b("span", {
869
+ class: "x-message-box__icon",
870
+ style: { color: u.color, marginRight: "10px", fontSize: "20px" }
871
+ }, u.icon)
872
+ ), n.push(
873
+ b("span", { class: "x-message-box__title" }, e.title || "提示")
874
+ ), e.showClose !== !1 && n.push(
875
+ b("button", {
876
+ class: "x-message-box__close",
877
+ onClick: this.handleClose
878
+ }, "✕")
879
+ );
880
+ const p = [];
881
+ p.push(
882
+ b("div", { class: "x-message-box__content" }, e.message || "")
883
+ ), e.showInput && p.push(
884
+ b("div", { class: "x-message-box__input", style: { marginTop: "12px" } }, [
885
+ b("input", {
886
+ class: ["x-message-box__input-inner", this.inputError ? "is-error" : ""].filter(Boolean),
887
+ type: e.inputType || "text",
888
+ placeholder: e.inputPlaceholder || "请输入",
889
+ value: this.inputValue,
890
+ onInput: (h) => {
891
+ this.inputValue = h.target.value, this.inputError = "";
892
+ },
893
+ onKeyup: (h) => {
894
+ h.key === "Enter" && this.handleConfirm();
895
+ }
896
+ }),
897
+ this.inputError ? b("div", { class: "x-message-box__error", style: { color: "#f56c6c", fontSize: "12px", marginTop: "4px" } }, this.inputError) : null
898
+ ])
899
+ );
900
+ const r = [];
901
+ return e.showCancelButton && r.push(
902
+ b("button", {
903
+ class: "x-button p-button--default",
904
+ onClick: this.handleCancel
905
+ }, e.cancelButtonText || "取消")
906
+ ), e.showConfirmButton !== !1 && r.push(
907
+ b("button", {
908
+ class: "x-button p-button--primary",
909
+ onClick: this.handleConfirm,
910
+ style: { marginLeft: "10px" }
911
+ }, e.confirmButtonText || "确定")
912
+ ), b("div", {
913
+ class: ["x-message-box-wrapper", e.center ? "is-center" : ""],
914
+ style: {
915
+ position: "fixed",
916
+ top: 0,
917
+ left: 0,
918
+ right: 0,
919
+ bottom: 0,
920
+ display: "flex",
921
+ alignItems: "center",
922
+ justifyContent: "center",
923
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
924
+ zIndex: this.zIndex
925
+ },
926
+ onClick: this.handleMaskClick
927
+ }, [
928
+ b("div", {
929
+ class: ["x-message-box", e.customClass],
930
+ style: {
931
+ backgroundColor: "#fff",
932
+ borderRadius: "4px",
933
+ boxShadow: "0 2px 12px rgba(0, 0, 0, 0.1)",
934
+ minWidth: "300px",
935
+ maxWidth: "500px"
936
+ },
937
+ onClick: (h) => h.stopPropagation()
938
+ }, [
939
+ // Header
940
+ b("div", {
941
+ class: "x-message-box__header",
942
+ style: {
943
+ display: "flex",
944
+ alignItems: "center",
945
+ justifyContent: "space-between",
946
+ padding: "16px 20px",
947
+ borderBottom: "1px solid #eee"
948
+ }
949
+ }, n),
950
+ // Body
951
+ b("div", {
952
+ class: "x-message-box__body",
953
+ style: {
954
+ padding: "20px",
955
+ fontSize: "14px",
956
+ color: "#606266"
957
+ }
958
+ }, p),
959
+ // Footer
960
+ b("div", {
961
+ class: "x-message-box__footer",
962
+ style: {
963
+ padding: "10px 20px 16px",
964
+ textAlign: "right"
965
+ }
966
+ }, r)
967
+ ])
968
+ ]);
969
+ }
970
+ }), i = me(o);
971
+ i.mount(t);
972
+ const f = {
973
+ app: i,
974
+ container: t,
975
+ close: () => {
976
+ var u;
977
+ const d = (u = i._instance) == null ? void 0 : u.proxy;
978
+ d != null && d.handleClose && d.handleClose();
979
+ }
980
+ };
981
+ G.push(f);
982
+ });
983
+ }
984
+ async function Re(e, l, t) {
985
+ return re({
986
+ message: e,
987
+ title: l,
988
+ ...t,
989
+ showConfirmButton: !0,
990
+ showCancelButton: !1
991
+ });
992
+ }
993
+ async function Ve(e, l, t) {
994
+ return re({
995
+ message: e,
996
+ title: l,
997
+ ...t,
998
+ showConfirmButton: !0,
999
+ showCancelButton: !0
1000
+ });
1001
+ }
1002
+ async function _e(e, l, t) {
1003
+ return re({
1004
+ message: e,
1005
+ title: l,
1006
+ ...t,
1007
+ showInput: !0,
1008
+ showConfirmButton: !0,
1009
+ showCancelButton: !0
1010
+ });
1011
+ }
1012
+ function He(e) {
1013
+ return re(e);
1014
+ }
1015
+ const K = Object.assign(He, {
1016
+ alert: Re,
1017
+ confirm: Ve,
1018
+ prompt: _e,
1019
+ closeAll: Le
1020
+ }), tt = K, ot = {
1021
+ install(e) {
1022
+ e.config.globalProperties.$msgbox = K, e.config.globalProperties.$alert = K.alert, e.config.globalProperties.$confirm = K.confirm, e.config.globalProperties.$prompt = K.prompt, e.provide("messageBox", K);
1023
+ }
1024
+ }, J = [];
1025
+ let Ne = 1;
1026
+ const Oe = () => {
1027
+ J.slice().forEach((e) => e.close());
1028
+ }, Ae = {
1029
+ success: { icon: "✓", color: "#67c23a" },
1030
+ warning: { icon: "⚠", color: "#e6a23c" },
1031
+ error: { icon: "✕", color: "#f56c6c" },
1032
+ info: { icon: "ℹ", color: "#909399" }
1033
+ }, We = (e, l) => {
1034
+ const t = J.filter((o) => o.position === e);
1035
+ let a = 16;
1036
+ for (const o of t)
1037
+ if (o.id < l) {
1038
+ const i = o.container.firstElementChild;
1039
+ i && (a += i.offsetHeight + 16);
1040
+ }
1041
+ return a;
1042
+ }, De = (e, l) => {
1043
+ const t = {
1044
+ position: "fixed",
1045
+ width: "330px",
1046
+ zIndex: "2010"
1047
+ };
1048
+ switch (e) {
1049
+ case "top-right":
1050
+ t.top = `${l}px`, t.right = "16px";
1051
+ break;
1052
+ case "top-left":
1053
+ t.top = `${l}px`, t.left = "16px";
1054
+ break;
1055
+ case "bottom-right":
1056
+ t.bottom = `${l}px`, t.right = "16px";
1057
+ break;
1058
+ case "bottom-left":
1059
+ t.bottom = `${l}px`, t.left = "16px";
1060
+ break;
1061
+ default:
1062
+ t.top = `${l}px`, t.right = "16px";
1063
+ }
1064
+ return t;
1065
+ };
1066
+ function ye(e) {
1067
+ const l = Ne++, t = e.position || "top-right", a = document.createElement("div");
1068
+ document.body.appendChild(a);
1069
+ let o = null, i = !1;
1070
+ const f = N({
1071
+ name: "TNotification",
1072
+ setup() {
1073
+ const n = E(!1), p = () => {
1074
+ i || (i = !0, n.value = !1, setTimeout(() => {
1075
+ var C;
1076
+ const w = J.findIndex((s) => s.id === l);
1077
+ w !== -1 && J.splice(w, 1), o && clearTimeout(o), (C = e.onClose) == null || C.call(e);
1078
+ try {
1079
+ d.unmount();
1080
+ } catch {
1081
+ }
1082
+ a.parentNode && a.parentNode.removeChild(a);
1083
+ }, 300));
1084
+ }, r = () => {
1085
+ const w = e.duration ?? 4500;
1086
+ w > 0 && (o = setTimeout(p, w));
1087
+ }, h = () => {
1088
+ o && (clearTimeout(o), o = null);
1089
+ }, g = I(() => (e.offset ?? 0) + We(t, l)), B = I(() => De(t, g.value));
1090
+ return Q(() => {
1091
+ n.value = !0, r();
1092
+ }), {
1093
+ visible: n,
1094
+ close: p,
1095
+ positionStyles: B,
1096
+ startTimer: r,
1097
+ clearTimer: h
1098
+ };
1099
+ },
1100
+ render() {
1101
+ if (!this.visible) return null;
1102
+ const n = e.type, p = n ? Ae[n] : null, r = [];
1103
+ e.title && r.push(
1104
+ b("div", {
1105
+ class: "x-notification__title",
1106
+ style: {
1107
+ fontWeight: "600",
1108
+ fontSize: "16px",
1109
+ color: "#303133",
1110
+ marginBottom: e.message ? "6px" : "0"
1111
+ }
1112
+ }, e.title)
1113
+ ), e.message && (e.dangerouslyUseHTMLString ? r.push(
1114
+ b("div", {
1115
+ class: "x-notification__content",
1116
+ style: {
1117
+ fontSize: "14px",
1118
+ color: "#606266",
1119
+ lineHeight: "1.5"
1120
+ },
1121
+ innerHTML: e.message
1122
+ })
1123
+ ) : r.push(
1124
+ b("div", {
1125
+ class: "x-notification__content",
1126
+ style: {
1127
+ fontSize: "14px",
1128
+ color: "#606266",
1129
+ lineHeight: "1.5"
1130
+ }
1131
+ }, e.message)
1132
+ ));
1133
+ const h = [];
1134
+ return p && h.push(
1135
+ b("div", {
1136
+ class: "x-notification__icon",
1137
+ style: {
1138
+ display: "flex",
1139
+ alignItems: "center",
1140
+ justifyContent: "center",
1141
+ width: "24px",
1142
+ height: "24px",
1143
+ marginRight: "12px",
1144
+ fontSize: "18px",
1145
+ color: p.color
1146
+ }
1147
+ }, p.icon)
1148
+ ), h.push(
1149
+ b("div", {
1150
+ class: "x-notification__main",
1151
+ style: {
1152
+ flex: "1"
1153
+ }
1154
+ }, r)
1155
+ ), e.showClose !== !1 && h.push(
1156
+ b("button", {
1157
+ class: "x-notification__close",
1158
+ style: {
1159
+ position: "absolute",
1160
+ top: "18px",
1161
+ right: "15px",
1162
+ background: "none",
1163
+ border: "none",
1164
+ cursor: "pointer",
1165
+ fontSize: "14px",
1166
+ color: "#909399",
1167
+ padding: "0"
1168
+ },
1169
+ onClick: (g) => {
1170
+ g.stopPropagation(), this.close();
1171
+ }
1172
+ }, "✕")
1173
+ ), b("div", {
1174
+ class: ["x-notification", e.customClass],
1175
+ style: {
1176
+ ...this.positionStyles,
1177
+ display: "flex",
1178
+ alignItems: "flex-start",
1179
+ padding: "14px 26px 14px 13px",
1180
+ borderRadius: "8px",
1181
+ backgroundColor: "#fff",
1182
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
1183
+ transition: "opacity 0.3s, transform 0.3s",
1184
+ boxSizing: "border-box"
1185
+ },
1186
+ onMouseenter: this.clearTimer,
1187
+ onMouseleave: this.startTimer
1188
+ }, h);
1189
+ }
1190
+ }), d = me(f);
1191
+ d.mount(a);
1192
+ const u = {
1193
+ id: l,
1194
+ app: d,
1195
+ container: a,
1196
+ position: t,
1197
+ close: () => {
1198
+ var p;
1199
+ const n = (p = d._instance) == null ? void 0 : p.proxy;
1200
+ n != null && n.close && n.close();
1201
+ }
1202
+ };
1203
+ return J.push(u), { close: u.close };
1204
+ }
1205
+ function Xe(e) {
1206
+ return ye(typeof e == "string" ? { message: e } : e);
1207
+ }
1208
+ const se = (e) => (l) => ye({ ...typeof l == "string" ? { message: l } : l, type: e }), fe = Object.assign(Xe, {
1209
+ info: se("info"),
1210
+ success: se("success"),
1211
+ warning: se("warning"),
1212
+ error: se("error"),
1213
+ closeAll: Oe
1214
+ }), st = fe, nt = {
1215
+ install(e) {
1216
+ e.config.globalProperties.$notify = fe, e.provide("notification", fe);
1217
+ }
1218
+ };
1219
+ export {
1220
+ Ue as Alert,
1221
+ Ge as Backtop,
1222
+ Ke as Drawer,
1223
+ Je as Message,
1224
+ tt as MessageBox,
1225
+ Qe as MessageComponent,
1226
+ Ze as Modal,
1227
+ st as Notification,
1228
+ qe as Popconfirm,
1229
+ et as TMessage,
1230
+ ot as TMessageBox,
1231
+ nt as TNotification,
1232
+ Ye as Tooltip
1233
+ };
package/es/style.css ADDED
@@ -0,0 +1 @@
1
+ .x-modal{position:relative;margin:0 auto 20px;background-color:#fff;border-radius:8px;box-shadow:0 2px 12px #00000026;max-height:43vh;display:flex;flex-direction:column}.x-modal__wrapper{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;z-index:2000;display:flex;justify-content:center}.x-modal__header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #e8e8e8;flex-shrink:0}.x-modal__title{font-size:15px;font-weight:500;color:#303133}.x-modal__close{background:none;border:none;font-size:16px;color:#909399;cursor:pointer}.x-modal__close:hover{color:#409eff}.x-modal__body{padding:16px;color:#606266;font-size:14px;overflow-y:auto;flex:1}.x-modal__footer{padding:10px 16px 14px;text-align:right;flex-shrink:0}.x-modal-fade-enter-active,.x-modal-fade-leave-active{transition:opacity .3s ease}.x-modal-fade-enter-from,.x-modal-fade-leave-to{opacity:0}.x-drawer__overlay{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080}.x-drawer{position:fixed;background-color:#fff;box-shadow:0 8px 10px -5px #0003;transition:transform .3s}.x-drawer--ltr{top:0;left:0}.x-drawer--rtl{top:0;right:0}.x-drawer--ttb{top:0;left:0}.x-drawer--btt{bottom:0;left:0}.x-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e8e8e8}.x-drawer__title{font-size:18px;font-weight:500;color:#303133}.x-drawer__close{background:none;border:none;font-size:20px;color:#909399;cursor:pointer}.x-drawer__close:hover{color:#409eff}.x-drawer__body{padding:20px;height:calc(100% - 60px);overflow-y:auto}.x-drawer__footer{padding:16px 20px;border-top:1px solid #e8e8e8;text-align:right}.x-drawer-fade-enter-active,.x-drawer-fade-leave-active{transition:opacity .3s}.x-drawer-fade-enter-active .x-drawer,.x-drawer-fade-leave-active .x-drawer{transition:transform .3s}.x-drawer-fade-enter-from,.x-drawer-fade-leave-to{opacity:0}.x-drawer-fade-enter-from .x-drawer--ltr,.x-drawer-fade-leave-to .x-drawer--ltr{transform:translate(-100%)}.x-drawer-fade-enter-from .x-drawer--rtl,.x-drawer-fade-leave-to .x-drawer--rtl{transform:translate(100%)}.x-drawer-fade-enter-from .x-drawer--ttb,.x-drawer-fade-leave-to .x-drawer--ttb{transform:translateY(-100%)}.x-drawer-fade-enter-from .x-drawer--btt,.x-drawer-fade-leave-to .x-drawer--btt{transform:translateY(100%)}.x-alert{position:relative;padding:12px 16px;margin-bottom:16px;border-radius:4px;display:flex;align-items:flex-start;transition:opacity .3s}.x-alert--success{background-color:#e1f3d8;color:#67c23a}.x-alert--success .x-alert__icon{color:#67c23a}.x-alert--warning{background-color:#fdf6ec;color:#e6a23c}.x-alert--warning .x-alert__icon{color:#e6a23c}.x-alert--error{background-color:#fef0f0;color:#f56c6c}.x-alert--error .x-alert__icon{color:#f56c6c}.x-alert--info{background-color:#f4f4f5;color:#909399}.x-alert--info .x-alert__icon{color:#909399}.x-alert.is-center{justify-content:center;text-align:center}.x-alert.is-with-description{padding:14px 16px}.x-alert.is-with-description .x-alert__title{font-weight:500;font-size:16px}.x-alert__icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:10px;font-size:16px}.x-alert__content{flex:1}.x-alert__title{display:block;font-size:14px;font-weight:500}.x-alert__description{display:block;font-size:14px;margin-top:6px;opacity:.8}.x-alert__close{position:absolute;top:12px;right:12px;background:none;border:none;cursor:pointer;font-size:14px;opacity:.6}.x-alert__close:hover{opacity:1}.x-alert-fade-enter-active,.x-alert-fade-leave-active{transition:opacity .2s ease}.x-alert-fade-enter-from,.x-alert-fade-leave-to{opacity:0}.x-tooltip{padding:8px 12px;font-size:13px;line-height:1.4;border-radius:4px;max-width:300px;word-wrap:break-word;position:fixed}.x-tooltip--dark{background-color:#303133;color:#fff;box-shadow:0 2px 8px #00000026}.x-tooltip--dark .x-tooltip__arrow--top{border-top-color:#303133}.x-tooltip--dark .x-tooltip__arrow--bottom{border-bottom-color:#303133}.x-tooltip--dark .x-tooltip__arrow--left{border-left-color:#303133}.x-tooltip--dark .x-tooltip__arrow--right{border-right-color:#303133}.x-tooltip--light{background-color:#fff;color:#303133;box-shadow:0 2px 12px #0000001f}.x-tooltip--light .x-tooltip__arrow--top{border-top-color:#fff}.x-tooltip--light .x-tooltip__arrow--bottom{border-bottom-color:#fff}.x-tooltip--light .x-tooltip__arrow--left{border-left-color:#fff}.x-tooltip--light .x-tooltip__arrow--right{border-right-color:#fff}.x-tooltip__wrapper,.x-tooltip__trigger{display:inline-block}.x-tooltip__arrow{position:absolute;width:0;height:0;border:6px solid transparent}.x-tooltip__arrow--top{bottom:-12px;left:50%;transform:translate(-50%);border-bottom:none}.x-tooltip__arrow--bottom{top:-12px;left:50%;transform:translate(-50%);border-top:none}.x-tooltip__arrow--left{right:-12px;top:50%;transform:translateY(-50%);border-right:none}.x-tooltip__arrow--right{left:-12px;top:50%;transform:translateY(-50%);border-left:none}.x-tooltip-fade-enter-active,.x-tooltip-fade-leave-active{transition:opacity .2s ease,transform .2s ease}.x-tooltip-fade-enter-from,.x-tooltip-fade-leave-to{opacity:0;transform:scale(.9)}.x-popconfirm-wrapper,.x-popconfirm-trigger{display:inline-block}.x-popconfirm{background:#fff;border-radius:4px;box-shadow:0 2px 12px #0000001a;padding:12px 16px;box-sizing:border-box}.x-popconfirm__arrow{position:absolute;width:12px;height:12px;background:#fff;box-shadow:-1px -1px 2px #0000000d}.x-popconfirm__main{display:flex;align-items:flex-start;margin-bottom:12px}.x-popconfirm__icon{display:flex;align-items:center;justify-content:center;font-size:16px;margin-right:8px;flex-shrink:0}.x-popconfirm__title{font-size:14px;color:#606266;line-height:1.4}.x-popconfirm__action{display:flex;justify-content:flex-end;gap:8px}.x-popconfirm-fade-enter-active,.x-popconfirm-fade-leave-active{transition:opacity .2s,transform .2s}.x-popconfirm-fade-enter-from,.x-popconfirm-fade-leave-to{opacity:0;transform:scale(.9)}.x-backtop{position:fixed;width:40px;height:40px;border-radius:4px;background-color:#fff;box-shadow:0 2px 8px #0000001f;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s;z-index:1000}.x-backtop:hover{background-color:#f5f5f5;box-shadow:0 4px 12px #00000026}.x-backtop:active{transform:scale(.95)}.x-backtop__icon{font-size:20px;color:#606266;font-weight:700}.x-fade-enter-active,.x-fade-leave-active{transition:opacity .3s,transform .3s}.x-fade-enter-from,.x-fade-leave-to{opacity:0;transform:translateY(20px)}.x-message{position:fixed;left:50%;top:20px;transform:translate(-50%);display:flex;align-items:center;padding:12px 16px;border-radius:4px;box-shadow:0 2px 12px #0000001a;transition:opacity .3s,transform .3s,top .3s;min-width:280px;max-width:480px}.x-message--success{background-color:#f0f9eb;border:1px solid #67c23a}.x-message--success .x-message__icon{color:#67c23a}.x-message--warning{background-color:#fdf6ec;border:1px solid #e6a23c}.x-message--warning .x-message__icon{color:#e6a23c}.x-message--error{background-color:#fef0f0;border:1px solid #f56c6c}.x-message--error .x-message__icon{color:#f56c6c}.x-message--info{background-color:#f4f4f5;border:1px solid #909399}.x-message--info .x-message__icon{color:#909399}.x-message.is-center{justify-content:center;text-align:center}.x-message.is-closable{padding-right:40px}.x-message__icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:10px;font-size:16px;flex-shrink:0}.x-message__content{flex:1;font-size:14px;color:#606266;line-height:1.4;word-break:break-word}.x-message__close{position:absolute;top:50%;right:12px;transform:translateY(-50%);background:none;border:none;cursor:pointer;font-size:14px;color:#909399;padding:0}.x-message__close:hover{color:#606266}.x-message-fade-enter-active,.x-message-fade-leave-active{transition:opacity .3s,transform .3s}.x-message-fade-enter-from,.x-message-fade-leave-to{opacity:0;transform:translate(-50%) translateY(-100%)}
package/lib/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),z=require("@xto/core"),q=e.defineComponent({name:"XModal",__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:""},width:{default:"50%"},top:{default:"15vh"},modal:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},center:{type:Boolean,default:!1},destroyOnClose:{type:Boolean,default:!1}},emits:["update:modelValue","close","open"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("modal"),{next:i}=z.useZIndex(),m=e.ref(i()),u=e.computed({get:()=>o.modelValue,set:g=>r("update:modelValue",g)}),f=e.ref(),l=()=>{u.value=!1,r("close")},p=()=>{o.closeOnClickModal&&o.modal&&l()};z.useEscape(()=>{o.closeOnPressEscape&&u.value&&l()}),e.watch(()=>o.modelValue,g=>{g&&(m.value=i(),r("open"))});const c=e.computed(()=>({paddingTop:o.top})),h=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width,zIndex:m.value}));return(g,C)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-modal-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("wrapper")),style:e.normalizeStyle(c.value),onClick:p},[e.createElementVNode("div",{ref_key:"modalRef",ref:f,class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle(h.value),onClick:C[0]||(C[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("header"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(g.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(n).e("close")),onClick:l}," ✕ ",2)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[e.renderSlot(g.$slots,"default")],2),g.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(g.$slots,"footer")],2)):e.createCommentVNode("",!0)],6)],6)):e.createCommentVNode("",!0)]),_:3})]))}}),K=e.defineComponent({name:"XDrawer",__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:""},direction:{default:"rtl"},size:{default:"30%"},withHeader:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1}},emits:["update:modelValue","close","open"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("drawer"),i=e.ref(2e3),m=()=>{r("update:modelValue",!1),r("close")},u=()=>{o.closeOnClickModal&&m()},f=c=>{c.key==="Escape"&&o.modelValue&&m()};e.watch(()=>o.modelValue,c=>{c?(i.value=2e3+Math.floor(Math.random()*100),r("open"),document.addEventListener("keydown",f)):document.removeEventListener("keydown",f)});const l=e.computed(()=>({zIndex:i.value})),p=e.computed(()=>{const c=typeof o.size=="number"?`${o.size}px`:o.size;return{ltr:{width:c,height:"100%"},rtl:{width:c,height:"100%"},ttb:{width:"100%",height:c},btt:{width:"100%",height:c}}[o.direction]});return(c,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-drawer-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("overlay")),style:e.normalizeStyle(l.value),onClick:u},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).b(),e.unref(n).m(t.direction)]),style:e.normalizeStyle(p.value),onClick:h[0]||(h[0]=e.withModifiers(()=>{},["stop"]))},[t.withHeader?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("header"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(c.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(n).e("close")),onClick:m}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[e.renderSlot(c.$slots,"default")],2),c.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(c.$slots,"footer")],2)):e.createCommentVNode("",!0)],6)],6)):e.createCommentVNode("",!0)]),_:3})]))}}),Y=e.defineComponent({name:"XAlert",__name:"index",props:{type:{default:"info"},title:{default:""},description:{},closable:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!1},center:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("alert"),i=e.ref(!0),m={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},u=e.computed(()=>[n.b(),n.m(o.type),n.is("center",o.center),n.is("with-description",o.description)]),f=l=>{i.value=!1,r("close",l)};return(l,p)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-alert-fade"},{default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(u.value)},[t.showIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("icon"))},e.toDisplayString(m[t.type]),3)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("content"))},[t.title||l.$slots.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(l.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2)):e.createCommentVNode("",!0),t.description||l.$slots.default?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("description"))},[e.renderSlot(l.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.description),1)])],2)):e.createCommentVNode("",!0)],2),t.closable?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(e.unref(n).e("close")),onClick:f}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3}))}}),G=e.defineComponent({name:"XTooltip",__name:"index",props:{content:{default:""},placement:{default:"top"},effect:{default:"dark"},disabled:{type:Boolean,default:!1},offset:{default:8},transition:{default:"fade"},visibleArrow:{type:Boolean,default:!0},trigger:{default:"hover"},openDelay:{default:0},closeDelay:{default:0}},emits:["update:visible","show","hide"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("tooltip"),i=e.ref(!1),m=e.ref(),u=e.ref();let f,l;const p=e.ref({}),c=()=>{if(!m.value||!u.value)return;const b=m.value.getBoundingClientRect(),S=u.value;S.style.visibility="hidden",S.style.display="block";const E=S.offsetWidth,V=S.offsetHeight,N=o.offset,W=window.innerWidth,j=window.innerHeight;let B=0,T=0,I=o.placement;switch(o.placement){case"top":B=b.top-V-N,T=b.left+(b.width-E)/2;break;case"bottom":B=b.bottom+N,T=b.left+(b.width-E)/2;break;case"left":B=b.top+(b.height-V)/2,T=b.left-E-N;break;case"right":B=b.top+(b.height-V)/2,T=b.right+N;break}o.placement==="top"&&B<0?(I="bottom",B=b.bottom+N):o.placement==="bottom"&&B+V>j?(I="top",B=b.top-V-N):o.placement==="left"&&T<0?(I="right",T=b.right+N):o.placement==="right"&&T+E>W&&(I="left",T=b.left-E-N),T<8&&(T=8),T+E>W-8&&(T=W-E-8),B<8&&(B=8),B+V>j-8&&(B=j-V-8),p.value={position:"fixed",top:`${B}px`,left:`${T}px`,visibility:"visible",zIndex:"2000"},h.value=I},h=e.ref(o.placement),g=()=>{o.disabled||(clearTimeout(l),f=setTimeout(()=>{i.value=!0,r("update:visible",!0),r("show"),e.nextTick(()=>{c()})},o.openDelay))},C=()=>{clearTimeout(f),l=setTimeout(()=>{i.value=!1,r("update:visible",!1),r("hide")},o.closeDelay)},y=()=>{i.value?C():g()},v=()=>{o.trigger==="hover"&&g()},s=()=>{o.trigger==="hover"&&C()},d=()=>{o.trigger==="click"&&y()},$=()=>{o.trigger==="focus"&&g()},w=()=>{o.trigger==="focus"&&C()},k=b=>{var S,E;o.trigger==="click"&&!((S=m.value)!=null&&S.contains(b.target))&&!((E=u.value)!=null&&E.contains(b.target))&&C()},x=()=>{i.value&&c()};e.watch(i,b=>{b?e.nextTick(()=>{c(),o.trigger==="click"&&document.addEventListener("click",k),window.addEventListener("scroll",x,!0),window.addEventListener("resize",x)}):(document.removeEventListener("click",k),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x))}),e.onUnmounted(()=>{clearTimeout(f),clearTimeout(l),document.removeEventListener("click",k),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)});const D=e.computed(()=>[n.b(),n.m(o.effect)]),_=e.computed(()=>[n.e("arrow"),n.e(`arrow-${h.value}`)]);return(b,S)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(n).e("wrapper"))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:m,class:e.normalizeClass(e.unref(n).e("trigger")),onMouseenter:v,onMouseleave:s,onClick:d,onFocus:$,onBlur:w},[e.renderSlot(b.$slots,"default")],34),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:`x-tooltip-${t.transition}`},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"tooltipRef",ref:u,class:e.normalizeClass(D.value),style:e.normalizeStyle(p.value),onMouseenter:v,onMouseleave:s},[e.renderSlot(b.$slots,"content",{},()=>[e.createTextVNode(e.toDisplayString(t.content),1)]),t.visibleArrow?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(_.value)},null,2)):e.createCommentVNode("",!0)],38),[[e.vShow,i.value]])]),_:3},8,["name"])]))],2))}}),J={class:"x-popconfirm-wrapper"},Q={class:"x-popconfirm__main"},ee={class:"x-popconfirm__title"},te={class:"x-popconfirm__action"},oe=e.defineComponent({name:"XPopconfirm",__name:"index",props:{title:{default:""},confirmButtonText:{default:"确定"},cancelButtonText:{default:"取消"},confirmButtonType:{default:"primary"},cancelButtonType:{default:"default"},icon:{default:""},iconColor:{default:"#faad14"},hideIcon:{type:Boolean,default:!1},hideCancelButton:{type:Boolean,default:!1},hideConfirmButton:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},width:{default:200},placement:{default:"top"},offset:{default:12},showArrow:{type:Boolean,default:!0}},emits:["confirm","cancel"],setup(t,{emit:a}){const o=t,r=a,n=e.ref(!1),i=e.ref(null),m=e.ref(null),u=e.ref({}),f=()=>{if(!i.value||!m.value)return;const s=i.value.getBoundingClientRect(),d=m.value.getBoundingClientRect(),$=o.placement,w=o.offset;let k=0,x=0;switch($){case"top":k=s.top-d.height-w,x=s.left+(s.width-d.width)/2;break;case"top-start":k=s.top-d.height-w,x=s.left;break;case"top-end":k=s.top-d.height-w,x=s.right-d.width;break;case"bottom":k=s.bottom+w,x=s.left+(s.width-d.width)/2;break;case"bottom-start":k=s.bottom+w,x=s.left;break;case"bottom-end":k=s.bottom+w,x=s.right-d.width;break;case"left":k=s.top+(s.height-d.height)/2,x=s.left-d.width-w;break;case"left-start":k=s.top,x=s.left-d.width-w;break;case"left-end":k=s.bottom-d.height,x=s.left-d.width-w;break;case"right":k=s.top+(s.height-d.height)/2,x=s.right+w;break;case"right-start":k=s.top,x=s.right+w;break;case"right-end":k=s.bottom-d.height,x=s.right+w;break;default:k=s.top-d.height-w,x=s.left+(s.width-d.width)/2}const D=window.innerWidth,_=window.innerHeight;x<0&&(x=10),x+d.width>D&&(x=D-d.width-10),k<0&&(k=10),k+d.height>_&&(k=_-d.height-10),u.value={position:"fixed",top:`${k}px`,left:`${x}px`,zIndex:"2000"}},l=s=>{var d,$;n.value&&((d=i.value)!=null&&d.contains(s.target)||($=m.value)!=null&&$.contains(s.target)||(n.value=!1))},p=s=>{o.disabled||(s.stopPropagation(),n.value=!n.value,n.value&&setTimeout(f,0))},c=()=>{n.value=!1,r("confirm")},h=()=>{n.value=!1,r("cancel")},g=()=>{n.value&&f()},C=()=>{n.value&&f()};e.watch(n,s=>{s?(setTimeout(f,0),document.addEventListener("click",l),window.addEventListener("scroll",g,!0),window.addEventListener("resize",C)):(document.removeEventListener("click",l),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",C))}),e.onUnmounted(()=>{document.removeEventListener("click",l),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",C)});const y=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width})),v=e.computed(()=>{const s=o.placement,d={};switch(s){case"top":case"top-start":case"top-end":d.bottom="-6px",d.transform="rotate(45deg)";break;case"bottom":case"bottom-start":case"bottom-end":d.top="-6px",d.transform="rotate(225deg)";break;case"left":case"left-start":case"left-end":d.right="-6px",d.transform="rotate(315deg)";break;case"right":case"right-start":case"right-end":d.left="-6px",d.transform="rotate(135deg)";break}return d});return(s,d)=>(e.openBlock(),e.createElementBlock("span",J,[e.createElementVNode("span",{ref_key:"triggerRef",ref:i,class:"x-popconfirm-trigger",onClick:p},[e.renderSlot(s.$slots,"default")],512),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-popconfirm-fade"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"popperRef",ref:m,class:"x-popconfirm",style:e.normalizeStyle({...u.value,...y.value}),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["stop"]))},[t.showArrow?(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__arrow",style:e.normalizeStyle(v.value)},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[t.hideIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__icon",style:e.normalizeStyle({color:t.iconColor})},[e.renderSlot(s.$slots,"icon",{},()=>[e.createTextVNode(e.toDisplayString(t.icon||"⚠"),1)])],4)),e.createElementVNode("div",ee,[e.renderSlot(s.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])])]),e.createElementVNode("div",te,[t.hideCancelButton?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"x-button p-button--default p-button--small",onClick:h},e.toDisplayString(t.cancelButtonText),1)),t.hideConfirmButton?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["x-button x-button--small",`x-button--${t.confirmButtonType}`]),onClick:c},e.toDisplayString(t.confirmButtonText),3))])],4)):e.createCommentVNode("",!0)]),_:3})]))]))}}),ne=e.defineComponent({name:"XBacktop",__name:"index",props:{visibilityHeight:{default:200},right:{default:40},bottom:{default:40}},emits:["click"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("backtop"),i=e.ref(!1),m=()=>{const l=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;i.value=l>=o.visibilityHeight},u=l=>{window.scrollTo({top:0,behavior:"smooth"}),r("click",l)},f=e.computed(()=>({right:`${o.right}px`,bottom:`${o.bottom}px`}));return e.onMounted(()=>{window.addEventListener("scroll",m,{passive:!0,capture:!0}),setTimeout(m,100)}),e.onUnmounted(()=>{window.removeEventListener("scroll",m,!0)}),(l,p)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle(f.value),onClick:u},[e.renderSlot(l.$slots,"default",{},()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("icon"))},"↑",2)])],6),[[e.vShow,i.value]])]),_:3}))}}),se=e.defineComponent({name:"XMessage",__name:"index",props:{message:{default:""},type:{default:"info"},duration:{default:3e3},showClose:{type:Boolean,default:!1},center:{type:Boolean,default:!1},offset:{default:20},customClass:{},onClose:{}},emits:["close","destroy"],setup(t,{expose:a,emit:o}){const r=t,n=o,i=z.useNamespace("message"),m=e.ref(!1),u=e.ref(z.nextMessageZIndex()),f={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},l=e.computed(()=>[i.b(),i.m(r.type),i.is("center",r.center),i.is("closable",r.showClose),r.customClass]),p=e.computed(()=>({top:`${r.offset}px`,zIndex:u.value}));let c=null;const h=()=>{r.duration>0&&(c=setTimeout(()=>{C()},r.duration))},g=()=>{c&&(clearTimeout(c),c=null)},C=()=>{var v;m.value=!1,(v=r.onClose)==null||v.call(r),n("close")},y=()=>{n("destroy")};return e.onMounted(()=>{h(),m.value=!0}),e.onUnmounted(()=>{g()}),a({close:C}),(v,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-message-fade",onAfterLeave:y},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.value),style:e.normalizeStyle(p.value),onMouseenter:g,onMouseleave:h},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(i).e("icon"))},e.toDisplayString(f[t.type]),3),e.createElementVNode("span",{class:e.normalizeClass(e.unref(i).e("content"))},[e.renderSlot(v.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.message),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(i).e("close")),onClick:C}," ✕ ",2)):e.createCommentVNode("",!0)],38)):e.createCommentVNode("",!0)]),_:3}))}}),L=[];let le=1;const ae=()=>{L.slice().forEach(t=>t.close())};function U(t){const a=le++,o=document.createElement("div");document.body.appendChild(o);const r={success:{bg:"#f0f9eb",border:"#67c23a",icon:"✓"},warning:{bg:"#fdf6ec",border:"#e6a23c",icon:"⚠"},error:{bg:"#fef0f0",border:"#f56c6c",icon:"✕"},info:{bg:"#f4f4f5",border:"#909399",icon:"ℹ"}},n=t.type||"info",i=r[n]||r.info,m=e.reactive({visible:!1,offset:t.offset??20});let u=t.offset??20;L.forEach(y=>{const v=y.container.firstElementChild;v&&v.offsetHeight&&(u+=v.offsetHeight+16)}),m.offset=u;let f=null,l=!1;const p=()=>{l||(m.visible=!1,setTimeout(()=>{if(l)return;l=!0;const y=L.findIndex(v=>v.id===a);y!==-1&&L.splice(y,1);try{g.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o)},300))},c=()=>{const y=t.duration??3e3;y>0&&(f=setTimeout(p,y))},h=()=>{f&&(clearTimeout(f),f=null)},g=e.createApp({render(){if(!m.visible)return null;const y=[e.h("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",marginRight:"10px",fontSize:"16px",color:i.border}},i.icon),e.h("span",{style:{flex:"1",fontSize:"14px",color:"#606266",lineHeight:"1.4"}},t.message||"")];return t.showClose&&y.push(e.h("button",{style:{position:"absolute",top:"50%",right:"12px",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"#909399",padding:"0"},onClick:v=>{v.stopPropagation(),p()}},"✕")),e.h("div",{class:["x-message",`x-message--${n}`,t.center?"is-center":"",t.showClose?"is-closable":""],style:{position:"fixed",left:"50%",top:`${m.offset}px`,transform:"translateX(-50%)",display:"flex",alignItems:"center",padding:t.showClose?"12px 40px 12px 16px":"12px 16px",borderRadius:"4px",boxShadow:"0 2px 12px rgba(0,0,0,0.1)",minWidth:"280px",maxWidth:"480px",backgroundColor:i.bg,border:`1px solid ${i.border}`,zIndex:2e3+a,transition:"opacity 0.3s, transform 0.3s"},onMouseenter:h,onMouseleave:c},y)}});g.mount(o),e.nextTick(()=>{m.visible=!0,c()});const C={id:a,app:g,container:o,close:p};return L.push(C),{close:p}}function ie(t){return U(typeof t=="string"?{message:t}:t)}const H=t=>a=>U({...typeof a=="string"?{message:a}:a,type:t}),X=Object.assign(ie,{info:H("info"),success:H("success"),warning:H("warning"),error:H("error"),closeAll:ae}),re=X,ce=se,de={install(t){t.config.globalProperties.$message=X,t.provide("message",X)}},P=[],ue=()=>{P.slice().forEach(t=>t.close())},fe={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}};function A(t){return new Promise(a=>{const o=document.createElement("div");document.body.appendChild(o);let r=!1;const n=e.defineComponent({name:"TMessageBox",setup(){const u=e.ref(!1),f=e.ref(t.inputValue??""),l=e.ref(""),p=2e3+P.length+1,c=v=>{r||(r=!0,u.value=!1,setTimeout(()=>{const s=P.findIndex(d=>d.container===o);s!==-1&&P.splice(s,1);try{i.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o),a({action:v,value:v==="confirm"?f.value:void 0})},300))},h=()=>{if(t.showInput&&t.inputPattern&&!t.inputPattern.test(f.value)){l.value=t.inputErrorMessage||"输入格式不正确";return}l.value="",c("confirm")},g=()=>{c("cancel")},C=()=>{c("close")},y=()=>{t.closeOnClickModal!==!1&&C()};return e.nextTick(()=>{u.value=!0}),{visible:u,inputValue:f,inputError:l,zIndex:p,handleConfirm:h,handleCancel:g,handleClose:C,handleMaskClick:y}},render(){if(!this.visible)return null;const u=t.type,f=u?fe[u]:null,l=[];f&&l.push(e.h("span",{class:"x-message-box__icon",style:{color:f.color,marginRight:"10px",fontSize:"20px"}},f.icon)),l.push(e.h("span",{class:"x-message-box__title"},t.title||"提示")),t.showClose!==!1&&l.push(e.h("button",{class:"x-message-box__close",onClick:this.handleClose},"✕"));const p=[];p.push(e.h("div",{class:"x-message-box__content"},t.message||"")),t.showInput&&p.push(e.h("div",{class:"x-message-box__input",style:{marginTop:"12px"}},[e.h("input",{class:["x-message-box__input-inner",this.inputError?"is-error":""].filter(Boolean),type:t.inputType||"text",placeholder:t.inputPlaceholder||"请输入",value:this.inputValue,onInput:h=>{this.inputValue=h.target.value,this.inputError=""},onKeyup:h=>{h.key==="Enter"&&this.handleConfirm()}}),this.inputError?e.h("div",{class:"x-message-box__error",style:{color:"#f56c6c",fontSize:"12px",marginTop:"4px"}},this.inputError):null]));const c=[];return t.showCancelButton&&c.push(e.h("button",{class:"x-button p-button--default",onClick:this.handleCancel},t.cancelButtonText||"取消")),t.showConfirmButton!==!1&&c.push(e.h("button",{class:"x-button p-button--primary",onClick:this.handleConfirm,style:{marginLeft:"10px"}},t.confirmButtonText||"确定")),e.h("div",{class:["x-message-box-wrapper",t.center?"is-center":""],style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:this.zIndex},onClick:this.handleMaskClick},[e.h("div",{class:["x-message-box",t.customClass],style:{backgroundColor:"#fff",borderRadius:"4px",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.1)",minWidth:"300px",maxWidth:"500px"},onClick:h=>h.stopPropagation()},[e.h("div",{class:"x-message-box__header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #eee"}},l),e.h("div",{class:"x-message-box__body",style:{padding:"20px",fontSize:"14px",color:"#606266"}},p),e.h("div",{class:"x-message-box__footer",style:{padding:"10px 20px 16px",textAlign:"right"}},c)])])}}),i=e.createApp(n);i.mount(o);const m={app:i,container:o,close:()=>{var f;const u=(f=i._instance)==null?void 0:f.proxy;u!=null&&u.handleClose&&u.handleClose()}};P.push(m)})}async function me(t,a,o){return A({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!1})}async function pe(t,a,o){return A({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!0})}async function he(t,a,o){return A({message:t,title:a,...o,showInput:!0,showConfirmButton:!0,showCancelButton:!0})}function ge(t){return A(t)}const M=Object.assign(ge,{alert:me,confirm:pe,prompt:he,closeAll:ue}),xe=M,ye={install(t){t.config.globalProperties.$msgbox=M,t.config.globalProperties.$alert=M.alert,t.config.globalProperties.$confirm=M.confirm,t.config.globalProperties.$prompt=M.prompt,t.provide("messageBox",M)}},R=[];let ve=1;const be=()=>{R.slice().forEach(t=>t.close())},Ce={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}},ke=(t,a)=>{const o=R.filter(n=>n.position===t);let r=16;for(const n of o)if(n.id<a){const i=n.container.firstElementChild;i&&(r+=i.offsetHeight+16)}return r},we=(t,a)=>{const o={position:"fixed",width:"330px",zIndex:"2010"};switch(t){case"top-right":o.top=`${a}px`,o.right="16px";break;case"top-left":o.top=`${a}px`,o.left="16px";break;case"bottom-right":o.bottom=`${a}px`,o.right="16px";break;case"bottom-left":o.bottom=`${a}px`,o.left="16px";break;default:o.top=`${a}px`,o.right="16px"}return o};function Z(t){const a=ve++,o=t.position||"top-right",r=document.createElement("div");document.body.appendChild(r);let n=null,i=!1;const m=e.defineComponent({name:"TNotification",setup(){const l=e.ref(!1),p=()=>{i||(i=!0,l.value=!1,setTimeout(()=>{var v;const y=R.findIndex(s=>s.id===a);y!==-1&&R.splice(y,1),n&&clearTimeout(n),(v=t.onClose)==null||v.call(t);try{u.unmount()}catch{}r.parentNode&&r.parentNode.removeChild(r)},300))},c=()=>{const y=t.duration??4500;y>0&&(n=setTimeout(p,y))},h=()=>{n&&(clearTimeout(n),n=null)},g=e.computed(()=>(t.offset??0)+ke(o,a)),C=e.computed(()=>we(o,g.value));return e.nextTick(()=>{l.value=!0,c()}),{visible:l,close:p,positionStyles:C,startTimer:c,clearTimer:h}},render(){if(!this.visible)return null;const l=t.type,p=l?Ce[l]:null,c=[];t.title&&c.push(e.h("div",{class:"x-notification__title",style:{fontWeight:"600",fontSize:"16px",color:"#303133",marginBottom:t.message?"6px":"0"}},t.title)),t.message&&(t.dangerouslyUseHTMLString?c.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"},innerHTML:t.message})):c.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"}},t.message)));const h=[];return p&&h.push(e.h("div",{class:"x-notification__icon",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",marginRight:"12px",fontSize:"18px",color:p.color}},p.icon)),h.push(e.h("div",{class:"x-notification__main",style:{flex:"1"}},c)),t.showClose!==!1&&h.push(e.h("button",{class:"x-notification__close",style:{position:"absolute",top:"18px",right:"15px",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"#909399",padding:"0"},onClick:g=>{g.stopPropagation(),this.close()}},"✕")),e.h("div",{class:["x-notification",t.customClass],style:{...this.positionStyles,display:"flex",alignItems:"flex-start",padding:"14px 26px 14px 13px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"opacity 0.3s, transform 0.3s",boxSizing:"border-box"},onMouseenter:this.clearTimer,onMouseleave:this.startTimer},h)}}),u=e.createApp(m);u.mount(r);const f={id:a,app:u,container:r,position:o,close:()=>{var p;const l=(p=u._instance)==null?void 0:p.proxy;l!=null&&l.close&&l.close()}};return R.push(f),{close:f.close}}function Be(t){return Z(typeof t=="string"?{message:t}:t)}const O=t=>a=>Z({...typeof a=="string"?{message:a}:a,type:t}),F=Object.assign(Be,{info:O("info"),success:O("success"),warning:O("warning"),error:O("error"),closeAll:be}),Te=F,Ee={install(t){t.config.globalProperties.$notify=F,t.provide("notification",F)}};exports.Alert=Y;exports.Backtop=ne;exports.Drawer=K;exports.Message=re;exports.MessageBox=xe;exports.MessageComponent=ce;exports.Modal=q;exports.Notification=Te;exports.Popconfirm=oe;exports.TMessage=de;exports.TMessageBox=ye;exports.TNotification=Ee;exports.Tooltip=G;
package/lib/style.css ADDED
@@ -0,0 +1 @@
1
+ .x-modal{position:relative;margin:0 auto 20px;background-color:#fff;border-radius:8px;box-shadow:0 2px 12px #00000026;max-height:43vh;display:flex;flex-direction:column}.x-modal__wrapper{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;z-index:2000;display:flex;justify-content:center}.x-modal__header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #e8e8e8;flex-shrink:0}.x-modal__title{font-size:15px;font-weight:500;color:#303133}.x-modal__close{background:none;border:none;font-size:16px;color:#909399;cursor:pointer}.x-modal__close:hover{color:#409eff}.x-modal__body{padding:16px;color:#606266;font-size:14px;overflow-y:auto;flex:1}.x-modal__footer{padding:10px 16px 14px;text-align:right;flex-shrink:0}.x-modal-fade-enter-active,.x-modal-fade-leave-active{transition:opacity .3s ease}.x-modal-fade-enter-from,.x-modal-fade-leave-to{opacity:0}.x-drawer__overlay{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080}.x-drawer{position:fixed;background-color:#fff;box-shadow:0 8px 10px -5px #0003;transition:transform .3s}.x-drawer--ltr{top:0;left:0}.x-drawer--rtl{top:0;right:0}.x-drawer--ttb{top:0;left:0}.x-drawer--btt{bottom:0;left:0}.x-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e8e8e8}.x-drawer__title{font-size:18px;font-weight:500;color:#303133}.x-drawer__close{background:none;border:none;font-size:20px;color:#909399;cursor:pointer}.x-drawer__close:hover{color:#409eff}.x-drawer__body{padding:20px;height:calc(100% - 60px);overflow-y:auto}.x-drawer__footer{padding:16px 20px;border-top:1px solid #e8e8e8;text-align:right}.x-drawer-fade-enter-active,.x-drawer-fade-leave-active{transition:opacity .3s}.x-drawer-fade-enter-active .x-drawer,.x-drawer-fade-leave-active .x-drawer{transition:transform .3s}.x-drawer-fade-enter-from,.x-drawer-fade-leave-to{opacity:0}.x-drawer-fade-enter-from .x-drawer--ltr,.x-drawer-fade-leave-to .x-drawer--ltr{transform:translate(-100%)}.x-drawer-fade-enter-from .x-drawer--rtl,.x-drawer-fade-leave-to .x-drawer--rtl{transform:translate(100%)}.x-drawer-fade-enter-from .x-drawer--ttb,.x-drawer-fade-leave-to .x-drawer--ttb{transform:translateY(-100%)}.x-drawer-fade-enter-from .x-drawer--btt,.x-drawer-fade-leave-to .x-drawer--btt{transform:translateY(100%)}.x-alert{position:relative;padding:12px 16px;margin-bottom:16px;border-radius:4px;display:flex;align-items:flex-start;transition:opacity .3s}.x-alert--success{background-color:#e1f3d8;color:#67c23a}.x-alert--success .x-alert__icon{color:#67c23a}.x-alert--warning{background-color:#fdf6ec;color:#e6a23c}.x-alert--warning .x-alert__icon{color:#e6a23c}.x-alert--error{background-color:#fef0f0;color:#f56c6c}.x-alert--error .x-alert__icon{color:#f56c6c}.x-alert--info{background-color:#f4f4f5;color:#909399}.x-alert--info .x-alert__icon{color:#909399}.x-alert.is-center{justify-content:center;text-align:center}.x-alert.is-with-description{padding:14px 16px}.x-alert.is-with-description .x-alert__title{font-weight:500;font-size:16px}.x-alert__icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:10px;font-size:16px}.x-alert__content{flex:1}.x-alert__title{display:block;font-size:14px;font-weight:500}.x-alert__description{display:block;font-size:14px;margin-top:6px;opacity:.8}.x-alert__close{position:absolute;top:12px;right:12px;background:none;border:none;cursor:pointer;font-size:14px;opacity:.6}.x-alert__close:hover{opacity:1}.x-alert-fade-enter-active,.x-alert-fade-leave-active{transition:opacity .2s ease}.x-alert-fade-enter-from,.x-alert-fade-leave-to{opacity:0}.x-tooltip{padding:8px 12px;font-size:13px;line-height:1.4;border-radius:4px;max-width:300px;word-wrap:break-word;position:fixed}.x-tooltip--dark{background-color:#303133;color:#fff;box-shadow:0 2px 8px #00000026}.x-tooltip--dark .x-tooltip__arrow--top{border-top-color:#303133}.x-tooltip--dark .x-tooltip__arrow--bottom{border-bottom-color:#303133}.x-tooltip--dark .x-tooltip__arrow--left{border-left-color:#303133}.x-tooltip--dark .x-tooltip__arrow--right{border-right-color:#303133}.x-tooltip--light{background-color:#fff;color:#303133;box-shadow:0 2px 12px #0000001f}.x-tooltip--light .x-tooltip__arrow--top{border-top-color:#fff}.x-tooltip--light .x-tooltip__arrow--bottom{border-bottom-color:#fff}.x-tooltip--light .x-tooltip__arrow--left{border-left-color:#fff}.x-tooltip--light .x-tooltip__arrow--right{border-right-color:#fff}.x-tooltip__wrapper,.x-tooltip__trigger{display:inline-block}.x-tooltip__arrow{position:absolute;width:0;height:0;border:6px solid transparent}.x-tooltip__arrow--top{bottom:-12px;left:50%;transform:translate(-50%);border-bottom:none}.x-tooltip__arrow--bottom{top:-12px;left:50%;transform:translate(-50%);border-top:none}.x-tooltip__arrow--left{right:-12px;top:50%;transform:translateY(-50%);border-right:none}.x-tooltip__arrow--right{left:-12px;top:50%;transform:translateY(-50%);border-left:none}.x-tooltip-fade-enter-active,.x-tooltip-fade-leave-active{transition:opacity .2s ease,transform .2s ease}.x-tooltip-fade-enter-from,.x-tooltip-fade-leave-to{opacity:0;transform:scale(.9)}.x-popconfirm-wrapper,.x-popconfirm-trigger{display:inline-block}.x-popconfirm{background:#fff;border-radius:4px;box-shadow:0 2px 12px #0000001a;padding:12px 16px;box-sizing:border-box}.x-popconfirm__arrow{position:absolute;width:12px;height:12px;background:#fff;box-shadow:-1px -1px 2px #0000000d}.x-popconfirm__main{display:flex;align-items:flex-start;margin-bottom:12px}.x-popconfirm__icon{display:flex;align-items:center;justify-content:center;font-size:16px;margin-right:8px;flex-shrink:0}.x-popconfirm__title{font-size:14px;color:#606266;line-height:1.4}.x-popconfirm__action{display:flex;justify-content:flex-end;gap:8px}.x-popconfirm-fade-enter-active,.x-popconfirm-fade-leave-active{transition:opacity .2s,transform .2s}.x-popconfirm-fade-enter-from,.x-popconfirm-fade-leave-to{opacity:0;transform:scale(.9)}.x-backtop{position:fixed;width:40px;height:40px;border-radius:4px;background-color:#fff;box-shadow:0 2px 8px #0000001f;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s;z-index:1000}.x-backtop:hover{background-color:#f5f5f5;box-shadow:0 4px 12px #00000026}.x-backtop:active{transform:scale(.95)}.x-backtop__icon{font-size:20px;color:#606266;font-weight:700}.x-fade-enter-active,.x-fade-leave-active{transition:opacity .3s,transform .3s}.x-fade-enter-from,.x-fade-leave-to{opacity:0;transform:translateY(20px)}.x-message{position:fixed;left:50%;top:20px;transform:translate(-50%);display:flex;align-items:center;padding:12px 16px;border-radius:4px;box-shadow:0 2px 12px #0000001a;transition:opacity .3s,transform .3s,top .3s;min-width:280px;max-width:480px}.x-message--success{background-color:#f0f9eb;border:1px solid #67c23a}.x-message--success .x-message__icon{color:#67c23a}.x-message--warning{background-color:#fdf6ec;border:1px solid #e6a23c}.x-message--warning .x-message__icon{color:#e6a23c}.x-message--error{background-color:#fef0f0;border:1px solid #f56c6c}.x-message--error .x-message__icon{color:#f56c6c}.x-message--info{background-color:#f4f4f5;border:1px solid #909399}.x-message--info .x-message__icon{color:#909399}.x-message.is-center{justify-content:center;text-align:center}.x-message.is-closable{padding-right:40px}.x-message__icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:10px;font-size:16px;flex-shrink:0}.x-message__content{flex:1;font-size:14px;color:#606266;line-height:1.4;word-break:break-word}.x-message__close{position:absolute;top:50%;right:12px;transform:translateY(-50%);background:none;border:none;cursor:pointer;font-size:14px;color:#909399;padding:0}.x-message__close:hover{color:#606266}.x-message-fade-enter-active,.x-message-fade-leave-active{transition:opacity .3s,transform .3s}.x-message-fade-enter-from,.x-message-fade-leave-to{opacity:0;transform:translate(-50%) translateY(-100%)}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@xto/feedback",
3
+ "version": "0.1.0",
4
+ "description": "Xto Feedback - Feedback components",
5
+ "main": "./lib/index.cjs",
6
+ "module": "./es/index.mjs",
7
+ "types": "./es/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./es/index.mjs",
11
+ "require": "./lib/index.cjs",
12
+ "types": "./es/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "es",
17
+ "lib"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "@xto/core": "0.1.0"
24
+ },
25
+ "peerDependencies": {
26
+ "vue": "^3.4.0"
27
+ },
28
+ "devDependencies": {
29
+ "typescript": "^5.4.2",
30
+ "vite": "^5.2.0",
31
+ "vitest": "^1.4.0",
32
+ "vue": "^3.4.21",
33
+ "@xto/build": "0.1.0"
34
+ },
35
+ "scripts": {
36
+ "build": "vite build"
37
+ }
38
+ }