@gradient-ui/core 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +2 -0
  2. package/dist/{GLoading.vue_vue_type_style_index_0_lang-DDqJEYGf.js → GLoading.vue_vue_type_style_index_0_lang-CPzo3WD3.js} +195 -206
  3. package/dist/GLoading.vue_vue_type_style_index_0_lang-cokm-HBh.cjs +1 -0
  4. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BmbKqNgm.js +6421 -0
  5. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-By_7hZOW.cjs +4 -0
  6. package/dist/components.cjs +1 -1
  7. package/dist/components.mjs +39 -38
  8. package/dist/directives.cjs +1 -1
  9. package/dist/directives.mjs +1 -1
  10. package/dist/index.cjs +1 -1
  11. package/dist/index.mjs +92 -88
  12. package/dist/{mask-BgaDaVWU.js → mask-Bu8cjwwH.js} +22 -21
  13. package/dist/mask-D1vJj5Hl.cjs +1 -0
  14. package/dist/propsFactory-DyyboUaC.cjs +1 -0
  15. package/dist/propsFactory-UhcvubZJ.js +13 -0
  16. package/dist/services.cjs +1 -1
  17. package/dist/services.mjs +1 -1
  18. package/dist/style.css +1 -1
  19. package/dist/tagName-CYG1CUfd.js +103 -0
  20. package/dist/tagName-CbsvFHGg.cjs +1 -0
  21. package/dist/types/components/index.d.ts +2 -0
  22. package/dist/types/components/ui/GButton/GButton.vue.d.ts +62 -2
  23. package/dist/types/components/ui/GButton/types.d.ts +76 -40
  24. package/dist/types/components/ui/GNavbar/GNavbarItem.vue.d.ts +3 -3
  25. package/dist/types/components/ui/GNavbar/GNavbarMenu.vue.d.ts +3 -3
  26. package/dist/types/components/ui/GTable/GTable.vue.d.ts +143 -0
  27. package/dist/types/components/ui/GTable/GTableBody.vue.d.ts +69 -0
  28. package/dist/types/components/ui/GTable/GTableCell.vue.d.ts +35 -0
  29. package/dist/types/components/ui/GTable/GTableExpandedRow.vue.d.ts +25 -0
  30. package/dist/types/components/ui/GTable/GTableHead.vue.d.ts +30 -0
  31. package/dist/types/components/ui/GTable/GTableRow.vue.d.ts +40 -0
  32. package/dist/types/components/ui/GTable/context.d.ts +25 -0
  33. package/dist/types/components/ui/GTable/index.d.ts +3 -0
  34. package/dist/types/components/ui/GTable/types.d.ts +318 -0
  35. package/dist/types/components/ui/GTable/useTable.d.ts +22 -0
  36. package/dist/types/components/ui/GTable/useTableExpansion.d.ts +17 -0
  37. package/dist/types/components/ui/GTable/useTableSpans.d.ts +12 -0
  38. package/dist/types/use/index.d.ts +1 -0
  39. package/dist/types/use/tagName.d.ts +47 -0
  40. package/dist/use.cjs +1 -1
  41. package/dist/use.mjs +15 -12
  42. package/dist/useSnackbar-2iJU4bdd.js +769 -0
  43. package/dist/useSnackbar-3QuH25xm.cjs +1 -0
  44. package/package.json +2 -2
  45. package/dist/GLoading.vue_vue_type_style_index_0_lang-CqbeZChH.cjs +0 -1
  46. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-Bufs8uqY.js +0 -5633
  47. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-CH9jX5W1.cjs +0 -4
  48. package/dist/icon-0-mbYGMr.cjs +0 -1
  49. package/dist/icon-BrFRYYf3.js +0 -66
  50. package/dist/mask-pzGv8apS.cjs +0 -1
  51. package/dist/useSnackbar-CFrWSpt4.cjs +0 -1
  52. package/dist/useSnackbar-lGrTDbl-.js +0 -763
@@ -1,763 +0,0 @@
1
- import { defineComponent as P, computed as p, unref as d, openBlock as v, createBlock as G, resolveDynamicComponent as X, mergeProps as H, createCommentVNode as _, toRef as A, useCssVars as Y, toRefs as be, createElementBlock as y, normalizeStyle as T, normalizeClass as b, createElementVNode as S, renderSlot as h, toValue as x, useSlots as Z, resolveDirective as J, withDirectives as K, withCtx as ee, createVNode as W, Fragment as Se, createTextVNode as L, toDisplayString as U, shallowRef as te, ref as N, onUnmounted as ne, createApp as ae, watch as ke, onBeforeUnmount as he, reactive as Ce, h as E } from "vue";
2
- import { c as D, p as k, d as $e, e as oe, u as se, f as Be, g as C, h as we, i as Ge, j as Pe, k as Ie, l as ze, n as Oe, o as Re, q as re, s as Ve, t as ie, _ as xe, a as Ne } from "./GLoading.vue_vue_type_style_index_0_lang-DDqJEYGf.js";
3
- import "@mdi/js";
4
- import { u as ce } from "./icon-BrFRYYf3.js";
5
- const Ae = () => ({
6
- icon: {
7
- type: String,
8
- required: !0
9
- },
10
- size: {
11
- type: [Number, String],
12
- default: void 0
13
- },
14
- tag: {
15
- type: String,
16
- default: "span"
17
- }
18
- }), Te = /* @__PURE__ */ P({
19
- __name: "GIcon",
20
- props: Ae(),
21
- setup(e) {
22
- const t = e, o = ce(() => t.icon), n = p(
23
- () => t.size == null ? "var(--g-token-icon-size-m)" : Number.isFinite(Number(t.size)) ? `${t.size}px` : String(t.size)
24
- );
25
- return (c, r) => d(o).icon ? (v(), G(X(d(o).component), H({
26
- key: 0,
27
- icon: d(o).icon,
28
- tag: t.tag,
29
- class: "g-icon",
30
- style: { fontSize: n.value }
31
- }, c.$attrs), null, 16, ["icon", "tag", "style"])) : _("", !0);
32
- }
33
- }), Q = /* @__PURE__ */ D(Te, [["__scopeId", "data-v-f1c09700"]]), We = k({
34
- placement: {
35
- type: String,
36
- default: "bottom"
37
- }
38
- });
39
- function De(e, t) {
40
- return p(() => `${t}_${e.placement}`);
41
- }
42
- const qe = k({
43
- active: Boolean,
44
- ...oe(),
45
- glow: [Boolean, Number, String],
46
- animateGlow: Boolean,
47
- shadow: Boolean,
48
- ...$e()
49
- });
50
- function Ee(e, t = "g-gradient") {
51
- const o = se(e, t), n = Be(e, t);
52
- return {
53
- glowClasses: p(() => ({
54
- [o.value]: !0,
55
- [n.value]: !0,
56
- [`${t}_active`]: e.active,
57
- [`${t}_glow`]: e.glow,
58
- [`${t}_animate-glow`]: e.animateGlow,
59
- [`${t}_shadow`]: e.shadow
60
- }))
61
- };
62
- }
63
- const Fe = k({
64
- borderRadius: {
65
- type: [Number, String],
66
- default: 4
67
- },
68
- inheritWidth: Boolean
69
- });
70
- function Le(e) {
71
- return {
72
- surfaceBorderRadius: C(A(e, "borderRadius"))
73
- };
74
- }
75
- const Ue = k({
76
- ...oe(),
77
- ...Ge(),
78
- ...we(),
79
- ...We({
80
- placement: "center"
81
- }),
82
- borderRadius: {
83
- type: [Number, String],
84
- default: 4
85
- },
86
- borderWidth: {
87
- type: [Number, String],
88
- default: 1
89
- },
90
- color: String,
91
- state: String
92
- }), le = k({
93
- ...Ue(),
94
- ...qe(),
95
- ...Fe()
96
- });
97
- function He(e) {
98
- const t = C(A(e, "borderWidth")), o = C(A(e, "borderRadius")), n = p(() => t.value ? `calc(${o.value} + ${t.value})` : o.value), c = se(e, "g-gradient"), r = De(e, "g-gradient"), i = Pe(e, "g-gradient"), a = Ie(
99
- () => e.color ?? e.state
100
- ), s = p(() => ({
101
- [c.value]: !0,
102
- [r.value]: !0,
103
- [i.value]: !0,
104
- "g-gradient_inherit-width": e.inheritWidth,
105
- [`g-gradient_${e.placement}`]: e.placement,
106
- [`g-gradient_${e.state}`]: e.state,
107
- [`g-gradient_border_${e.borderWidth}`]: !0
108
- })), u = p(() => ({
109
- "--g-border-radius": o.value,
110
- "--g-border-width": t.value,
111
- "--g-gradient-current": a.value
112
- }));
113
- return {
114
- borderWidthPx: t,
115
- borderRadiusPx: o,
116
- containerBorderRadius: n,
117
- resolvedGradient: a,
118
- gradientClasses: s,
119
- gradientStyles: u
120
- };
121
- }
122
- const je = { class: "g-gradient__slot" }, Me = /* @__PURE__ */ P({
123
- __name: "GGradient",
124
- props: le(),
125
- setup(e) {
126
- Y((u) => ({
127
- v3beb5b00: d(c),
128
- ea600628: d(s),
129
- v61d97152: d(n)
130
- }));
131
- const t = e, { borderWidth: o } = be(t), n = C(o), { containerBorderRadius: c, gradientClasses: r, gradientStyles: i } = He(t), { glowClasses: a } = Ee(t), { surfaceBorderRadius: s } = Le(t);
132
- return (u, f) => (v(), y("div", {
133
- class: b(["g-gradient", [d(r), d(a)]]),
134
- style: T(d(i))
135
- }, [
136
- S("div", je, [
137
- h(u.$slots, "default", {}, void 0, !0)
138
- ])
139
- ], 6));
140
- }
141
- }), Je = /* @__PURE__ */ D(Me, [["__scopeId", "data-v-f23c788d"]]), Ke = /* @__PURE__ */ P({
142
- __name: "GIcon",
143
- props: {
144
- icon: {},
145
- size: { default: 20 },
146
- tag: { default: "span" }
147
- },
148
- setup(e) {
149
- const t = e, o = C(A(t, "size")), n = ce(() => t.icon);
150
- return (c, r) => (v(), G(X(d(n).component), H({
151
- icon: d(n).icon,
152
- tag: t.tag,
153
- class: "g-icon",
154
- style: { fontSize: d(o) }
155
- }, c.$attrs), null, 16, ["icon", "tag", "style"]));
156
- }
157
- }), F = /* @__PURE__ */ D(Ke, [["__scopeId", "data-v-1e1fd36a"]]), Qe = k({
158
- ...Oe(),
159
- ...ze(),
160
- active: Boolean,
161
- activeColor: String,
162
- activeState: String,
163
- activeVariant: String
164
- });
165
- function Xe(e, t, o = {}) {
166
- const { disabledClass: n, roundedClass: c, stateClass: r } = Re(
167
- e,
168
- t
169
- ), {
170
- surfaceOverlayClasses: i,
171
- surfaceUnderlayClasses: a,
172
- surfaceContentClasses: s
173
- } = re(t), u = Ve(e, t), f = p(
174
- () => !!(x(o.active) ?? e.active)
175
- ), g = p(() => !!x(o.selected)), { resolvedColor: l, resolvedState: $, colorStyles: I } = ie({
176
- color: () => x(e.color),
177
- state: () => e.state,
178
- active: () => f.value || g.value,
179
- activeColor: () => x(e.activeColor),
180
- activeState: () => e.activeState
181
- }), w = p(
182
- () => (g.value || f.value) && e.activeVariant ? e.activeVariant : e.variant
183
- );
184
- return {
185
- actionSurfaceClasses: p(() => {
186
- const z = !!x(o.focused);
187
- return [
188
- `${t}_${w.value}`,
189
- n.value,
190
- c.value,
191
- r.value,
192
- u.value,
193
- z ? `${t}_focused` : "",
194
- g.value ? `${t}_selected` : "",
195
- f.value ? `${t}_active` : ""
196
- ].filter(Boolean);
197
- }),
198
- resolvedColor: l,
199
- resolvedState: $,
200
- resolvedVariant: w,
201
- surfaceStyles: I,
202
- surfaceOverlayClasses: i,
203
- surfaceUnderlayClasses: a,
204
- surfaceContentClasses: s
205
- };
206
- }
207
- const Ye = k({
208
- prepend: String,
209
- append: String,
210
- label: String
211
- }), Ze = k({
212
- ...Qe(),
213
- ...Ye(),
214
- ...le(),
215
- isIconButton: Boolean,
216
- iconButton: String,
217
- ripple: {
218
- type: [Boolean, String, Object],
219
- default: !0
220
- }
221
- }), et = {
222
- key: 0,
223
- class: "g-button__prepend"
224
- }, tt = { class: "g-button__label" }, nt = {
225
- key: 1,
226
- class: "g-button__append"
227
- }, at = /* @__PURE__ */ P({
228
- __name: "GButton",
229
- props: Ze({
230
- borderWidth: 0,
231
- borderRadius: 4,
232
- placement: "center"
233
- }),
234
- setup(e) {
235
- Y((l) => ({
236
- ff755c22: d(n)
237
- }));
238
- const t = Z(), o = e, n = C(o.borderRadius), c = p(() => o.disabled || o.ripple === !1 ? !1 : typeof o.ripple == "object" ? {
239
- ...o.ripple,
240
- disabled: o.ripple.disabled || o.disabled
241
- } : o.ripple), {
242
- actionSurfaceClasses: r,
243
- resolvedColor: i,
244
- resolvedState: a,
245
- surfaceStyles: s,
246
- surfaceOverlayClasses: u,
247
- surfaceUnderlayClasses: f,
248
- surfaceContentClasses: g
249
- } = Xe(o, "g-button");
250
- return (l, $) => {
251
- const I = J("ripple"), w = J("gradient-icon");
252
- return K((v(), G(Je, H({ class: "g-gradient" }, {
253
- ...o,
254
- color: d(i),
255
- state: d(a)
256
- }), {
257
- default: ee(() => [
258
- K((v(), y("div", {
259
- class: b(["g-button", [
260
- d(r),
261
- {
262
- "g-button_icon": l.iconButton || l.isIconButton
263
- }
264
- ]]),
265
- style: T(d(s))
266
- }, [
267
- S("span", {
268
- class: b(d(f))
269
- }, null, 2),
270
- S("span", {
271
- class: b(d(u))
272
- }, null, 2),
273
- S("span", {
274
- class: b(["g-button__content", d(g)])
275
- }, [
276
- (t.prepend || l.prepend) && !l.iconButton ? (v(), y("span", et, [
277
- h(l.$slots, "prepend", {}, () => [
278
- W(F, { icon: l.prepend }, null, 8, ["icon"])
279
- ])
280
- ])) : _("", !0),
281
- S("span", tt, [
282
- h(l.$slots, "default", {}, () => [
283
- l.iconButton ? l.iconButton ? (v(), G(F, {
284
- key: 1,
285
- icon: l.iconButton
286
- }, null, 8, ["icon"])) : _("", !0) : (v(), y(Se, { key: 0 }, [
287
- L(U(l.label), 1)
288
- ], 64))
289
- ])
290
- ]),
291
- (t.append || l.append) && !l.iconButton ? (v(), y("span", nt, [
292
- h(l.$slots, "append", {}, () => [
293
- W(F, { icon: l.append }, null, 8, ["icon"])
294
- ])
295
- ])) : _("", !0)
296
- ], 2)
297
- ], 6)), [
298
- [I, c.value]
299
- ])
300
- ]),
301
- _: 3
302
- }, 16)), [
303
- [w]
304
- ]);
305
- };
306
- }
307
- });
308
- function $t() {
309
- const e = te(null), t = N(!1), o = (a) => {
310
- c();
311
- const s = n(a.target), u = s.style.position;
312
- r(s) || (s.style.position = "relative");
313
- const f = document.createElement("div");
314
- f.className = "g-loading__container", s.appendChild(f);
315
- const g = {}, l = ae(xe, {
316
- text: a.text,
317
- noText: a.noText,
318
- color: a.color,
319
- dark: a.dark,
320
- opacity: a.opacity,
321
- blur: a.blur,
322
- progressView: a.progressView,
323
- onClose: () => {
324
- i(g);
325
- }
326
- }), $ = l.mount(f);
327
- Object.assign(g, {
328
- app: l,
329
- container: f,
330
- target: s,
331
- originalPosition: u,
332
- componentInstance: $
333
- }), e.value = g, $.show(), t.value = !0;
334
- }, n = (a) => {
335
- if (!a) return document.body;
336
- if (typeof a == "string") {
337
- const s = document.querySelector(a);
338
- if (!s) throw new Error(`Target element ${a} not found`);
339
- return s;
340
- }
341
- return a;
342
- }, c = async () => {
343
- if (!e.value) return;
344
- const { componentInstance: a } = e.value;
345
- a && a.hide();
346
- }, r = (a) => {
347
- const s = window.getComputedStyle(a).position;
348
- return ["relative", "absolute", "fixed", "sticky"].includes(s);
349
- }, i = (a = e.value) => {
350
- if (!a) return;
351
- const s = e.value === a, { app: u, container: f, target: g, originalPosition: l } = a;
352
- u.unmount(), f.parentElement === g && g.removeChild(f), s && (g.style.position = l, e.value = null, t.value = !1);
353
- };
354
- return ne(() => {
355
- c();
356
- }), {
357
- show: o,
358
- hide: c,
359
- visible: t
360
- };
361
- }
362
- const ot = k({
363
- modelValue: {
364
- type: Boolean,
365
- default: void 0
366
- },
367
- defaultOpen: {
368
- type: Boolean,
369
- default: !1
370
- },
371
- title: String,
372
- text: String,
373
- icon: String,
374
- color: {
375
- type: String,
376
- default: "primary"
377
- },
378
- state: String,
379
- variant: {
380
- type: String,
381
- default: "tonal"
382
- },
383
- location: {
384
- type: String,
385
- default: "bottom-center"
386
- },
387
- position: {
388
- type: String,
389
- default: "fixed"
390
- },
391
- transition: {
392
- type: [Boolean, String, Object],
393
- default: void 0
394
- },
395
- timeout: {
396
- type: Number,
397
- default: 5e3
398
- },
399
- persistent: {
400
- type: Boolean,
401
- default: !1
402
- },
403
- closeable: {
404
- type: Boolean,
405
- default: !0
406
- },
407
- action: Object,
408
- actionText: String,
409
- closeOnAction: {
410
- type: Boolean,
411
- default: !0
412
- },
413
- multiline: {
414
- type: Boolean,
415
- default: !1
416
- },
417
- offset: {
418
- type: [Number, String],
419
- default: 24
420
- },
421
- maxWidth: {
422
- type: [Number, String],
423
- default: 520
424
- },
425
- pauseOnHover: {
426
- type: Boolean,
427
- default: !0
428
- }
429
- }), st = {
430
- key: 0,
431
- class: "g-snackbar__prepend"
432
- }, rt = { class: "g-snackbar__main" }, it = {
433
- key: 0,
434
- class: "g-snackbar__title"
435
- }, ct = {
436
- key: 1,
437
- class: "g-snackbar__text"
438
- }, lt = {
439
- key: 1,
440
- class: "g-snackbar__actions"
441
- }, ut = /* @__PURE__ */ P({
442
- __name: "GSnackbar",
443
- props: ot(),
444
- emits: ["update:modelValue", "action", "close", "after-close"],
445
- setup(e, { expose: t, emit: o }) {
446
- const n = e, c = o, r = Z(), i = N(), a = N(n.defaultOpen), s = N("manual"), u = p(() => n.modelValue !== void 0), f = p(
447
- () => u.value ? n.modelValue === !0 : a.value
448
- ), g = C(n.offset), l = C(n.maxWidth), { colorStyles: $ } = ie(n), {
449
- surfaceOverlayClasses: I,
450
- surfaceUnderlayClasses: w,
451
- surfaceContentClasses: j
452
- } = re("g-snackbar"), z = p(
453
- () => {
454
- var m;
455
- return ((m = n.action) == null ? void 0 : m.label) ?? n.actionText;
456
- }
457
- ), ue = p(() => ({
458
- ...$.value,
459
- "--g-snackbar-max-width": l.value
460
- })), de = p(() => ({
461
- "--g-snackbar-offset": g.value
462
- })), fe = p(() => [
463
- `g-snackbar_${n.variant}`,
464
- {
465
- "g-snackbar_multiline": n.multiline
466
- }
467
- ]), pe = p(() => [
468
- `g-snackbar-layer_position-${n.position}`,
469
- `g-snackbar-layer_location-${n.location}`
470
- ]), me = p(
471
- () => n.transition ?? {
472
- name: n.location.startsWith("top") ? "slide-y" : "slide-y-reverse",
473
- appear: !0,
474
- duration: 240,
475
- leaveDuration: 180,
476
- distance: "16px"
477
- }
478
- );
479
- function M(m) {
480
- u.value || (a.value = m), c("update:modelValue", m);
481
- }
482
- function O() {
483
- i.value !== void 0 && (window.clearTimeout(i.value), i.value = void 0);
484
- }
485
- function q() {
486
- O(), !(!f.value || n.persistent || n.timeout <= 0) && (i.value = window.setTimeout(() => {
487
- R("timeout");
488
- }, n.timeout));
489
- }
490
- function R(m = "manual") {
491
- s.value = m, O(), M(!1), c("close", m);
492
- }
493
- function ve() {
494
- var m, V;
495
- c("action", (m = n.action) == null ? void 0 : m.value), (((V = n.action) == null ? void 0 : V.closeOnClick) ?? n.closeOnAction) && R("action");
496
- }
497
- function ge() {
498
- n.pauseOnHover && O();
499
- }
500
- function _e() {
501
- n.pauseOnHover && q();
502
- }
503
- ke(f, (m) => {
504
- if (!m) {
505
- O();
506
- return;
507
- }
508
- q();
509
- }), q(), he(() => {
510
- O();
511
- });
512
- function ye() {
513
- c("after-close", s.value);
514
- }
515
- return t({
516
- open: () => M(!0),
517
- close: R
518
- }), (m, V) => (v(), y("div", {
519
- class: b(["g-snackbar-layer", pe.value]),
520
- style: T(de.value)
521
- }, [
522
- W(d(Ne), {
523
- transition: me.value,
524
- onAfterLeave: ye
525
- }, {
526
- default: ee(() => [
527
- f.value ? (v(), y("section", {
528
- key: 0,
529
- class: b(["g-snackbar", fe.value]),
530
- style: T(ue.value),
531
- role: "status",
532
- "aria-live": "polite",
533
- onMouseenter: ge,
534
- onMouseleave: _e
535
- }, [
536
- S("span", {
537
- class: b(d(w))
538
- }, null, 2),
539
- S("span", {
540
- class: b(d(I))
541
- }, null, 2),
542
- S("div", {
543
- class: b(["g-snackbar__content", d(j)])
544
- }, [
545
- r.prepend || n.icon ? (v(), y("div", st, [
546
- h(m.$slots, "prepend", {}, () => [
547
- n.icon ? (v(), G(Q, {
548
- key: 0,
549
- icon: n.icon,
550
- size: "22"
551
- }, null, 8, ["icon"])) : _("", !0)
552
- ], !0)
553
- ])) : _("", !0),
554
- S("div", rt, [
555
- r.title || n.title ? (v(), y("div", it, [
556
- h(m.$slots, "title", {}, () => [
557
- L(U(n.title), 1)
558
- ], !0)
559
- ])) : _("", !0),
560
- r.default || n.text ? (v(), y("div", ct, [
561
- h(m.$slots, "default", {}, () => [
562
- L(U(n.text), 1)
563
- ], !0)
564
- ])) : _("", !0)
565
- ]),
566
- r.action || z.value || n.closeable ? (v(), y("div", lt, [
567
- h(m.$slots, "action", {
568
- close: () => R("action")
569
- }, () => [
570
- z.value ? (v(), G(at, {
571
- key: 0,
572
- variant: "text",
573
- size: "s",
574
- label: z.value,
575
- onClick: ve
576
- }, null, 8, ["label"])) : _("", !0)
577
- ], !0),
578
- n.closeable ? (v(), y("button", {
579
- key: 0,
580
- type: "button",
581
- class: "g-snackbar__close",
582
- "aria-label": "Close snackbar",
583
- onClick: V[0] || (V[0] = (bt) => R("dismiss"))
584
- }, [
585
- W(Q, {
586
- icon: "close",
587
- size: "18"
588
- })
589
- ])) : _("", !0)
590
- ])) : _("", !0)
591
- ], 2)
592
- ], 38)) : _("", !0)
593
- ]),
594
- _: 3
595
- }, 8, ["transition"])
596
- ], 6));
597
- }
598
- }), dt = /* @__PURE__ */ D(ut, [["__scopeId", "data-v-6d1d4bf9"]]), ft = "bottom-center", pt = "slide-y", B = /* @__PURE__ */ new Map();
599
- let mt = 0;
600
- function vt(e) {
601
- return typeof e == "string" ? {
602
- label: e
603
- } : e;
604
- }
605
- function gt(e, t) {
606
- return e === "fade" ? "fade" : e === "scale" ? "scale" : e === "slide-x" ? t.endsWith("right") ? "slide-x-reverse" : "slide-x" : t.startsWith("top") ? "slide-y" : "slide-y-reverse";
607
- }
608
- function _t() {
609
- return P({
610
- name: "GSnackbarHost",
611
- props: {
612
- items: {
613
- type: Array,
614
- required: !0
615
- },
616
- location: {
617
- type: String,
618
- required: !0
619
- },
620
- transition: {
621
- type: String,
622
- required: !0
623
- },
624
- close: {
625
- type: Function,
626
- required: !0
627
- },
628
- remove: {
629
- type: Function,
630
- required: !0
631
- }
632
- },
633
- setup(e) {
634
- return () => E(
635
- "div",
636
- {
637
- class: [
638
- "g-snackbar-stack",
639
- `g-snackbar-stack_location-${e.location}`
640
- ]
641
- },
642
- [
643
- E(
644
- "div",
645
- {
646
- class: "g-snackbar-stack__items"
647
- },
648
- e.items.map(
649
- (t) => E(dt, {
650
- key: t.id,
651
- ...t,
652
- modelValue: t.open,
653
- position: "static",
654
- transition: {
655
- name: gt(
656
- t.transition ?? e.transition,
657
- t.location
658
- ),
659
- appear: !0,
660
- duration: 240,
661
- leaveDuration: 180,
662
- distance: "18px",
663
- scale: 0.96
664
- },
665
- "onUpdate:modelValue": (o) => {
666
- t.open = o;
667
- },
668
- onClose: (o) => e.close(t.id, o),
669
- onAfterClose: () => e.remove(t.id)
670
- })
671
- )
672
- )
673
- ]
674
- );
675
- }
676
- });
677
- }
678
- function yt(e, t, o, n) {
679
- const c = B.get(e);
680
- if (c) return c;
681
- const r = document.createElement("div");
682
- r.className = "g-snackbar-stack__container", document.body.appendChild(r);
683
- const i = Ce([]), a = ae(_t(), {
684
- items: i,
685
- location: e,
686
- transition: t,
687
- close: o,
688
- remove: n
689
- });
690
- a.mount(r);
691
- const s = {
692
- app: a,
693
- container: r,
694
- items: i
695
- };
696
- return B.set(e, s), s;
697
- }
698
- function Bt() {
699
- const e = te([]);
700
- function t(r) {
701
- for (const [i, a] of B.entries()) {
702
- const s = a.items.findIndex((u) => u.id === r);
703
- if (s !== -1) {
704
- a.items.splice(s, 1), e.value = e.value.filter(
705
- (u) => u.id !== r
706
- ), a.items.length || window.setTimeout(() => {
707
- a.items.length || (a.app.unmount(), a.container.remove(), B.delete(i));
708
- }, 220);
709
- return;
710
- }
711
- }
712
- }
713
- function o(r, i = "manual") {
714
- for (const a of B.values()) {
715
- const s = a.items.find((u) => u.id === r);
716
- if (s) {
717
- s.open = !1;
718
- return;
719
- }
720
- }
721
- }
722
- function n(r) {
723
- const i = typeof r == "string" ? { text: r } : r, a = i.location ?? ft, s = i.transition ?? pt, u = ++mt, f = {
724
- ...i,
725
- id: u,
726
- open: !0,
727
- location: a,
728
- transition: s,
729
- action: vt(i.action)
730
- };
731
- return yt(a, s, o, t).items.push(f), e.value = [...e.value, f], {
732
- id: u,
733
- close: (l = "manual") => {
734
- o(u, l);
735
- }
736
- };
737
- }
738
- function c() {
739
- for (const [r, i] of B.entries())
740
- i.app.unmount(), i.container.remove(), B.delete(r);
741
- e.value = [];
742
- }
743
- return ne(() => {
744
- c();
745
- }), {
746
- show: n,
747
- closeAll: c,
748
- items: e
749
- };
750
- }
751
- export {
752
- Je as G,
753
- at as _,
754
- Q as a,
755
- dt as b,
756
- Bt as c,
757
- Qe as d,
758
- Xe as e,
759
- F as f,
760
- Ye as g,
761
- le as m,
762
- $t as u
763
- };