@gradient-ui/core 0.5.0-rc.0 → 0.6.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 (83) hide show
  1. package/README.md +4 -4
  2. package/dist/{GLoading.vue_vue_type_style_index_0_lang-CBB_GocW.js → GLoading.vue_vue_type_style_index_0_lang-COggAM7a.js} +90 -88
  3. package/dist/GLoading.vue_vue_type_style_index_0_lang-CoPHejAL.cjs +1 -0
  4. package/dist/{GSwitch.vue_vue_type_script_setup_true_lang-UTBNFP5X.js → GSwitch.vue_vue_type_script_setup_true_lang-CRlkCyW_.js} +2371 -2355
  5. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-DZXv1j__.cjs +1 -0
  6. package/dist/{camelToKebabCase-6qY6WHvl.js → camelToKebabCase-BWbQb81D.js} +4 -4
  7. package/dist/components.cjs +1 -1
  8. package/dist/components.mjs +4 -4
  9. package/dist/default--73FwpwZ.cjs +4 -0
  10. package/dist/default-DlsS6GI_.js +58 -0
  11. package/dist/directives.cjs +1 -1
  12. package/dist/directives.mjs +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.mjs +112 -108
  15. package/dist/{mask-CZX-I_iy.js → mask-BqOamrcF.js} +2 -2
  16. package/dist/{mask-BbofdFd4.cjs → mask-ObMqNEfF.cjs} +1 -1
  17. package/dist/materialSurface-CbOpfFGO.js +634 -0
  18. package/dist/materialSurface-CjhWd_yD.cjs +1 -0
  19. package/dist/scheme-CZ0a0X5e.cjs +299 -0
  20. package/dist/scheme-Dqwdqg6N.js +1405 -0
  21. package/dist/services.cjs +1 -1
  22. package/dist/services.mjs +1 -1
  23. package/dist/style.css +1 -1
  24. package/dist/{surface-BKu4KfkY.js → surface-DImNM7I1.js} +49 -46
  25. package/dist/surface-_J0t7c3m.cjs +1 -0
  26. package/dist/theme.cjs +1 -1
  27. package/dist/theme.mjs +52 -48
  28. package/dist/types/components/ui/GAlert/GAlert.vue.d.ts +2 -2
  29. package/dist/types/components/ui/GBadge/GBadge.vue.d.ts +4 -4
  30. package/dist/types/components/ui/GButton/GButton.vue.d.ts +2 -2
  31. package/dist/types/components/ui/GChip/GChip.vue.d.ts +1 -1
  32. package/dist/types/components/ui/GExpansion/GExpansion.vue.d.ts +5 -5
  33. package/dist/types/components/ui/GFAB/GFAB.vue.d.ts +3 -3
  34. package/dist/types/components/ui/GGradientMaterial/GGradientMaterial.vue.d.ts +2 -2
  35. package/dist/types/components/ui/GSnackbar/GSnackbar.vue.d.ts +2 -2
  36. package/dist/types/components/ui/GTable/GTable.vue.d.ts +7 -7
  37. package/dist/types/components/ui/GToggleButton/GToggleButton.vue.d.ts +3 -3
  38. package/dist/types/theme/default.d.ts +2 -1
  39. package/dist/types/theme/gradient.d.ts +1 -1
  40. package/dist/types/theme/index.d.ts +6 -6
  41. package/dist/types/use/actionSurface.d.ts +5 -1650
  42. package/dist/types/use/gradient.d.ts +4 -1653
  43. package/dist/types/use/gradientMaterial.d.ts +1 -1
  44. package/dist/types/use/material.d.ts +3 -2
  45. package/dist/types/use/materialSurface.d.ts +10 -4
  46. package/dist/types/use/surfaceColor.d.ts +2 -1
  47. package/dist/types/use/surfaceMaterial.d.ts +45 -0
  48. package/dist/use.cjs +1 -1
  49. package/dist/use.mjs +2 -2
  50. package/dist/useSnackbar-D60dFSV1.cjs +1 -0
  51. package/dist/useSnackbar-us11nXny.js +922 -0
  52. package/package.json +4 -2
  53. package/dist/GLoading.vue_vue_type_style_index_0_lang-Bv3dWEq8.cjs +0 -1
  54. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BS6bb1XY.cjs +0 -1
  55. package/dist/default-BhuY-A3o.cjs +0 -4
  56. package/dist/default-OTmCd0Aq.js +0 -131
  57. package/dist/material-Ca7ZZAiO.cjs +0 -194
  58. package/dist/material-okvXHenb.js +0 -1162
  59. package/dist/materialSurface-BBrP9ltj.js +0 -591
  60. package/dist/materialSurface-CK8LN_dU.cjs +0 -1
  61. package/dist/surface-8z3gR7vF.cjs +0 -1
  62. package/dist/types/theme/gradient/animation/css.d.ts +0 -12
  63. package/dist/types/theme/gradient/animation/index.d.ts +0 -1
  64. package/dist/types/theme/gradient/colorMath.d.ts +0 -3
  65. package/dist/types/theme/gradient/constants.d.ts +0 -3
  66. package/dist/types/theme/gradient/core.d.ts +0 -1
  67. package/dist/types/theme/gradient/effects/index.d.ts +0 -1
  68. package/dist/types/theme/gradient/effects/morph.d.ts +0 -5
  69. package/dist/types/theme/gradient/effects/shadow.d.ts +0 -3
  70. package/dist/types/theme/gradient/formatters/canvas.d.ts +0 -2
  71. package/dist/types/theme/gradient/formatters/css.d.ts +0 -3
  72. package/dist/types/theme/gradient/formatters/index.d.ts +0 -1
  73. package/dist/types/theme/gradient/formatters/svg.d.ts +0 -5
  74. package/dist/types/theme/gradient/index.d.ts +0 -1
  75. package/dist/types/theme/gradient/material.d.ts +0 -1
  76. package/dist/types/theme/gradient/model.d.ts +0 -5
  77. package/dist/types/theme/gradient/presets.d.ts +0 -158
  78. package/dist/types/theme/gradient/recipes.d.ts +0 -14
  79. package/dist/types/theme/gradient/tokens.d.ts +0 -72
  80. package/dist/types/theme/gradient/types.d.ts +0 -117
  81. package/dist/types/theme/gradient/utils.d.ts +0 -10
  82. package/dist/useSnackbar-BHQshEZ8.cjs +0 -1
  83. package/dist/useSnackbar-DeNHZH8v.js +0 -908
@@ -0,0 +1,922 @@
1
+ import { defineComponent as D, computed as f, unref as s, openBlock as c, createBlock as I, resolveDynamicComponent as ae, mergeProps as J, createCommentVNode as b, ref as q, onMounted as Oe, onBeforeUnmount as me, createElementBlock as y, createElementVNode as w, useCssVars as ve, useId as Ie, normalizeStyle as Y, normalizeClass as C, withCtx as K, renderSlot as P, toRef as Me, toValue as H, useSlots as ge, useAttrs as Re, resolveDirective as ue, withDirectives as de, Fragment as re, renderList as he, createVNode as ee, createTextVNode as ie, toDisplayString as le, shallowRef as ye, onUnmounted as be, createApp as _e, watch as Ge, reactive as Te, h as se } from "vue";
2
+ import { b as Q, c as ze, u as Ae, _ as Ne, a as Ve } from "./GLoading.vue_vue_type_style_index_0_lang-COggAM7a.js";
3
+ import { j as ke, r as Pe, s as We, t as Fe, v as Se, w as Ue, b as je, q as Ee, a as Le, o as De } from "./materialSurface-CbOpfFGO.js";
4
+ import { j as te, p as ne, t as He, v as qe, d as Xe, k as Ye, i as Je, f as Ke } from "./surface-DImNM7I1.js";
5
+ import "@mdi/js";
6
+ const Qe = () => ({
7
+ icon: {
8
+ type: String,
9
+ required: !0
10
+ },
11
+ size: {
12
+ type: [Number, String],
13
+ default: void 0
14
+ },
15
+ tag: {
16
+ type: String,
17
+ default: "span"
18
+ }
19
+ }), Ze = /* @__PURE__ */ D({
20
+ __name: "GIcon",
21
+ props: Qe(),
22
+ setup(a) {
23
+ const t = a, l = ke(() => t.icon), e = f(
24
+ () => t.size == null ? "var(--g-token-icon-size-m)" : Number.isFinite(Number(t.size)) ? `${t.size}px` : String(t.size)
25
+ );
26
+ return (u, r) => s(l).icon ? (c(), I(ae(s(l).component), J({
27
+ key: 0,
28
+ icon: s(l).icon,
29
+ tag: t.tag,
30
+ class: "g-icon",
31
+ style: { fontSize: e.value }
32
+ }, u.$attrs), null, 16, ["icon", "tag", "style"])) : b("", !0);
33
+ }
34
+ }), pe = /* @__PURE__ */ Q(Ze, [["__scopeId", "data-v-f1c09700"]]), et = ["viewBox"], tt = ["id", "width", "height"], at = ["width", "height", "rx", "ry"], nt = ["x", "y", "width", "height", "rx", "ry"], st = ["id", "x", "y", "width", "height"], ot = ["stdDeviation"], rt = ["filter"], it = ["width", "height", "mask"], lt = /* @__PURE__ */ D({
35
+ __name: "GGradientBorderLayer",
36
+ props: {
37
+ maskId: {},
38
+ borderRadius: {},
39
+ borderWidth: {},
40
+ placement: {},
41
+ rounded: { type: Boolean },
42
+ glowBlur: {}
43
+ },
44
+ setup(a) {
45
+ const t = a, l = q(), e = q({ width: 1, height: 1 });
46
+ let u;
47
+ const r = f(() => `url(#${t.maskId})`), d = f(() => `${t.maskId}-blur`), n = f(
48
+ () => t.glowBlur ? `url(#${d.value})` : void 0
49
+ ), o = f(() => (t.glowBlur ?? 0) * 4), m = f(
50
+ () => `0 0 ${e.value.width} ${e.value.height}`
51
+ ), g = (v) => Number.parseFloat(String(v)), i = f(() => {
52
+ const { width: v, height: p } = e.value, _ = Math.max(0, g(t.borderWidth)), O = Math.max(0, g(t.borderRadius)), x = Math.min(_, 0.5), $ = t.placement === "center", M = $ || t.placement === "top" ? _ : 0, B = $ || t.placement === "right" ? _ : 0, R = $ || t.placement === "bottom" ? _ : 0, G = $ || t.placement === "left" ? _ : 0, W = Math.max(0, v - G - B), T = Math.max(0, p - M - R), h = G + (G ? x : 0), F = M + (M ? x : 0), U = B + (B ? x : 0), j = R + (R ? x : 0), A = Math.max(0, v - h - U), z = Math.max(0, p - F - j), N = t.rounded ? Math.min(v, p) / 2 : O + _, E = t.rounded ? Math.min(
53
+ $ ? A : W,
54
+ $ ? z : T
55
+ ) / 2 : Math.max(0, O - ($ ? x : 0));
56
+ return {
57
+ width: v,
58
+ height: p,
59
+ outerRadius: N,
60
+ innerX: h,
61
+ innerY: F,
62
+ innerWidth: A,
63
+ innerHeight: z,
64
+ innerRadius: E
65
+ };
66
+ }), S = () => {
67
+ const v = l.value;
68
+ if (!v) return;
69
+ const { width: p, height: _ } = v.getBoundingClientRect();
70
+ p > 0 && _ > 0 && (e.value = { width: p, height: _ });
71
+ };
72
+ return Oe(() => {
73
+ const v = l.value;
74
+ v && (S(), u = new ResizeObserver(S), u.observe(v));
75
+ }), me(() => u == null ? void 0 : u.disconnect()), (v, p) => (c(), y("svg", {
76
+ ref_key: "layerRef",
77
+ ref: l,
78
+ class: "g-gradient-border-layer",
79
+ "aria-hidden": "true",
80
+ focusable: "false",
81
+ viewBox: m.value,
82
+ preserveAspectRatio: "none"
83
+ }, [
84
+ w("defs", null, [
85
+ w("mask", {
86
+ id: a.maskId,
87
+ "mask-type": "luminance",
88
+ maskUnits: "userSpaceOnUse",
89
+ maskContentUnits: "userSpaceOnUse",
90
+ x: "0",
91
+ y: "0",
92
+ width: i.value.width,
93
+ height: i.value.height
94
+ }, [
95
+ w("rect", {
96
+ class: "g-gradient-border-layer__mask-outer",
97
+ x: "0",
98
+ y: "0",
99
+ width: i.value.width,
100
+ height: i.value.height,
101
+ rx: i.value.outerRadius,
102
+ ry: i.value.outerRadius
103
+ }, null, 8, at),
104
+ w("rect", {
105
+ class: "g-gradient-border-layer__mask-inner",
106
+ x: i.value.innerX,
107
+ y: i.value.innerY,
108
+ width: i.value.innerWidth,
109
+ height: i.value.innerHeight,
110
+ rx: i.value.innerRadius,
111
+ ry: i.value.innerRadius
112
+ }, null, 8, nt)
113
+ ], 8, tt),
114
+ a.glowBlur ? (c(), y("filter", {
115
+ key: 0,
116
+ id: d.value,
117
+ "color-interpolation-filters": "sRGB",
118
+ filterUnits: "userSpaceOnUse",
119
+ x: -o.value,
120
+ y: -o.value,
121
+ width: i.value.width + o.value * 2,
122
+ height: i.value.height + o.value * 2
123
+ }, [
124
+ w("feGaussianBlur", {
125
+ in: "SourceGraphic",
126
+ stdDeviation: a.glowBlur
127
+ }, null, 8, ot)
128
+ ], 8, st)) : b("", !0)
129
+ ]),
130
+ w("g", { filter: n.value }, [
131
+ (c(), y("foreignObject", {
132
+ x: "0",
133
+ y: "0",
134
+ width: i.value.width,
135
+ height: i.value.height,
136
+ mask: r.value
137
+ }, [...p[0] || (p[0] = [
138
+ w("div", { class: "g-gradient-border-layer__paint" }, null, -1)
139
+ ])], 8, it))
140
+ ], 8, rt)
141
+ ], 8, et));
142
+ }
143
+ }), fe = /* @__PURE__ */ Q(lt, [["__scopeId", "data-v-6137c224"]]), ct = { class: "g-gradient__slot" }, ut = /* @__PURE__ */ D({
144
+ __name: "GGradient",
145
+ props: Se(),
146
+ setup(a) {
147
+ ve((p) => ({
148
+ v86ea171a: s(n),
149
+ de3300c2: s(S)
150
+ }));
151
+ const t = a, l = Ie().replaceAll(":", ""), e = `g-gradient-border-${l}`, u = `g-gradient-glow-${l}`, r = f(
152
+ () => Number.parseFloat(String(t.borderWidth)) > 0
153
+ ), d = f(
154
+ () => r.value && !!(t.glow || t.animateGlow)
155
+ ), { containerBorderRadius: n, gradientClasses: o, gradientStyles: m } = Pe(t), { glowClasses: g } = We(t), { interactionClass: i, surfaceBorderRadius: S, surfaceFillClass: v } = Fe(t);
156
+ return (p, _) => (c(), I(ae(p.rootTag), {
157
+ class: C(["g-gradient", [
158
+ s(o),
159
+ s(g),
160
+ s(i),
161
+ s(v)
162
+ ]]),
163
+ style: Y(s(m))
164
+ }, {
165
+ default: K(() => [
166
+ r.value ? (c(), I(fe, {
167
+ key: 0,
168
+ class: "g-gradient__border",
169
+ "mask-id": e,
170
+ "border-radius": p.borderRadius,
171
+ "border-width": p.borderWidth,
172
+ placement: p.placement,
173
+ rounded: p.rounded
174
+ }, null, 8, ["border-radius", "border-width", "placement", "rounded"])) : b("", !0),
175
+ d.value ? (c(), I(fe, {
176
+ key: 1,
177
+ class: "g-gradient__glow",
178
+ "mask-id": u,
179
+ "border-radius": p.borderRadius,
180
+ "border-width": p.borderWidth,
181
+ placement: p.placement,
182
+ rounded: p.rounded,
183
+ "glow-blur": 4
184
+ }, null, 8, ["border-radius", "border-width", "placement", "rounded"])) : b("", !0),
185
+ w("div", ct, [
186
+ P(p.$slots, "default", {}, void 0, !0)
187
+ ])
188
+ ]),
189
+ _: 3
190
+ }, 8, ["class", "style"]));
191
+ }
192
+ }), we = /* @__PURE__ */ Q(ut, [["__scopeId", "data-v-bf23455e"]]), dt = /* @__PURE__ */ D({
193
+ __name: "GIcon",
194
+ props: {
195
+ icon: {},
196
+ size: { default: 20 },
197
+ tag: { default: "span" }
198
+ },
199
+ setup(a) {
200
+ const t = a, l = te(Me(t, "size")), e = ke(() => t.icon);
201
+ return (u, r) => (c(), I(ae(s(e).component), J({
202
+ icon: s(e).icon,
203
+ tag: t.tag,
204
+ class: "g-icon",
205
+ style: { fontSize: s(l) }
206
+ }, u.$attrs), null, 16, ["icon", "tag", "style"]));
207
+ }
208
+ }), oe = /* @__PURE__ */ Q(dt, [["__scopeId", "data-v-1e1fd36a"]]), pt = ne({
209
+ ...He(),
210
+ ...ze(),
211
+ active: Boolean,
212
+ activeColor: String,
213
+ activeState: String,
214
+ activeVariant: String,
215
+ gradientRecipe: String,
216
+ morph: Boolean,
217
+ shadowOptions: Object,
218
+ dropShadowOptions: Object,
219
+ animationOptions: Object,
220
+ morphOptions: Object
221
+ });
222
+ function ft(a, t, l = {}) {
223
+ const { disabledClass: e, roundedClass: u, stateClass: r, textureClass: d } = qe(a, t), { glassStyles: n } = Xe(a), {
224
+ surfaceOverlayClasses: o,
225
+ surfaceMaterialMorphBlobClasses: m,
226
+ surfaceMaterialMorphClasses: g,
227
+ surfaceTextureClasses: i,
228
+ surfaceUnderlayClasses: S,
229
+ surfaceContentClasses: v
230
+ } = Ye(t), p = Ae(a, t), _ = f(
231
+ () => !!(H(l.active) ?? a.active)
232
+ ), O = f(() => !!H(l.selected)), { resolvedColor: x, resolvedState: $, colorStyles: M } = Je({
233
+ color: () => H(a.color),
234
+ state: () => a.state,
235
+ active: () => _.value || O.value,
236
+ activeColor: () => H(a.activeColor),
237
+ activeState: () => a.activeState
238
+ }), B = f(
239
+ () => (O.value || _.value) && a.activeVariant ? a.activeVariant : a.variant
240
+ ), R = f(
241
+ () => B.value === "gradient"
242
+ ), G = f(
243
+ () => !!(B.value === "default" || B.value === "tonal" || R.value)
244
+ ), W = f(
245
+ () => !!(!a.disabled || _.value || O.value || H(l.focused))
246
+ ), T = f(
247
+ () => a.texture !== void 0 && a.texture !== "none"
248
+ ), {
249
+ getMorphBlobStyle: h,
250
+ gradientMaterial: F,
251
+ materialStyles: U,
252
+ morphBlobs: j,
253
+ morphEnabled: A
254
+ } = Ue(a, {
255
+ color: x,
256
+ variant: B,
257
+ kind: "action",
258
+ morphScope: "always"
259
+ }), z = f(() => [
260
+ M.value,
261
+ U.value,
262
+ B.value === "glass" ? n.value : void 0
263
+ ]);
264
+ return {
265
+ actionSurfaceClasses: f(() => {
266
+ var Z;
267
+ const E = !!H(l.focused), V = (Z = a.animationOptions) == null ? void 0 : Z.preset;
268
+ return [
269
+ `${t}_${B.value}`,
270
+ e.value,
271
+ u.value,
272
+ r.value,
273
+ d.value,
274
+ p.value,
275
+ E ? `${t}_focused` : "",
276
+ O.value ? `${t}_selected` : "",
277
+ _.value ? `${t}_active` : "",
278
+ V ? `${t}_animation-${V}` : ""
279
+ ].filter(Boolean);
280
+ }),
281
+ getMorphBlobStyle: h,
282
+ gradientMaterial: F,
283
+ hasSurfaceOverlay: W,
284
+ hasSurfaceTexture: T,
285
+ hasSurfaceUnderlay: G,
286
+ morphBlobs: j,
287
+ morphEnabled: A,
288
+ resolvedColor: x,
289
+ resolvedState: $,
290
+ resolvedVariant: B,
291
+ surfaceStyles: z,
292
+ surfaceMaterialMorphBlobClasses: m,
293
+ surfaceMaterialMorphClasses: g,
294
+ surfaceOverlayClasses: o,
295
+ surfaceUnderlayClasses: S,
296
+ surfaceTextureClasses: i,
297
+ surfaceContentClasses: v
298
+ };
299
+ }
300
+ const mt = ne({
301
+ prepend: String,
302
+ append: String,
303
+ label: String
304
+ }), vt = ne({
305
+ ...pt(),
306
+ ...mt(),
307
+ ...Se(),
308
+ ...je(),
309
+ isIconButton: Boolean,
310
+ iconButton: String,
311
+ ripple: {
312
+ type: [Boolean, String, Object],
313
+ default: !0
314
+ }
315
+ }), gt = {
316
+ key: 0,
317
+ class: "g-button__prepend"
318
+ }, ht = { class: "g-button__label" }, yt = {
319
+ key: 1,
320
+ class: "g-button__append"
321
+ }, bt = /* @__PURE__ */ D({
322
+ inheritAttrs: !1,
323
+ __name: "GButton",
324
+ props: vt({
325
+ borderWidth: void 0,
326
+ borderRadius: 4,
327
+ placement: "center"
328
+ }),
329
+ setup(a) {
330
+ ve((h) => ({
331
+ v4de35eb3: s(u)
332
+ }));
333
+ const t = ge(), l = Re(), e = a, u = te(e.borderRadius), r = f(
334
+ () => e.borderWidth ?? (e.variant === "glass" || e.glow || e.animateGlow ? 1 : 0)
335
+ ), d = f(() => e.disabled || e.ripple === !1 ? !1 : typeof e.ripple == "object" ? {
336
+ ...e.ripple,
337
+ disabled: e.ripple.disabled || e.disabled
338
+ } : e.ripple), { tagName: n, tagAttrs: o } = Ee(e, "button"), {
339
+ actionSurfaceClasses: m,
340
+ resolvedColor: g,
341
+ resolvedState: i,
342
+ surfaceStyles: S,
343
+ surfaceMaterialMorphBlobClasses: v,
344
+ surfaceMaterialMorphClasses: p,
345
+ surfaceOverlayClasses: _,
346
+ surfaceUnderlayClasses: O,
347
+ surfaceTextureClasses: x,
348
+ surfaceContentClasses: $,
349
+ hasSurfaceOverlay: M,
350
+ hasSurfaceTexture: B,
351
+ hasSurfaceUnderlay: R,
352
+ morphBlobs: G,
353
+ morphEnabled: W,
354
+ getMorphBlobStyle: T
355
+ } = ft(e, "g-button");
356
+ return (h, F) => {
357
+ const U = ue("ripple"), j = ue("gradient-icon");
358
+ return de((c(), I(we, J({ class: "g-gradient" }, {
359
+ ...e,
360
+ color: s(g),
361
+ state: s(i)
362
+ }, { "border-width": r.value }), {
363
+ default: K(() => [
364
+ de((c(), I(ae(s(n)), J({
365
+ class: ["g-button", [
366
+ s(m),
367
+ {
368
+ "g-button_icon": h.iconButton || h.isIconButton
369
+ }
370
+ ]],
371
+ style: s(S)
372
+ }, { ...s(o), ...s(l) }), {
373
+ default: K(() => [
374
+ s(R) ? (c(), y("span", {
375
+ key: 0,
376
+ class: C(s(O))
377
+ }, null, 2)) : b("", !0),
378
+ s(W) ? (c(), y("span", {
379
+ key: 1,
380
+ class: C(s(p)),
381
+ "aria-hidden": "true"
382
+ }, [
383
+ (c(!0), y(re, null, he(s(G), (A, z) => (c(), y("span", {
384
+ key: z,
385
+ class: C(s(v)),
386
+ style: Y(s(T)(A))
387
+ }, null, 6))), 128))
388
+ ], 2)) : b("", !0),
389
+ s(M) ? (c(), y("span", {
390
+ key: 2,
391
+ class: C(s(_))
392
+ }, null, 2)) : b("", !0),
393
+ s(B) ? (c(), y("span", {
394
+ key: 3,
395
+ class: C(s(x))
396
+ }, null, 2)) : b("", !0),
397
+ w("span", {
398
+ class: C(["g-button__content", s($)])
399
+ }, [
400
+ (t.prepend || h.prepend) && !h.iconButton ? (c(), y("span", gt, [
401
+ P(h.$slots, "prepend", {}, () => [
402
+ ee(oe, { icon: h.prepend }, null, 8, ["icon"])
403
+ ])
404
+ ])) : b("", !0),
405
+ w("span", ht, [
406
+ P(h.$slots, "default", {}, () => [
407
+ h.iconButton ? h.iconButton ? (c(), I(oe, {
408
+ key: 1,
409
+ icon: h.iconButton
410
+ }, null, 8, ["icon"])) : b("", !0) : (c(), y(re, { key: 0 }, [
411
+ ie(le(h.label), 1)
412
+ ], 64))
413
+ ])
414
+ ]),
415
+ (t.append || h.append) && !h.iconButton ? (c(), y("span", yt, [
416
+ P(h.$slots, "append", {}, () => [
417
+ ee(oe, { icon: h.append }, null, 8, ["icon"])
418
+ ])
419
+ ])) : b("", !0)
420
+ ], 2)
421
+ ]),
422
+ _: 3
423
+ }, 16, ["class", "style"])), [
424
+ [U, d.value]
425
+ ])
426
+ ]),
427
+ _: 3
428
+ }, 16, ["border-width"])), [
429
+ [j]
430
+ ]);
431
+ };
432
+ }
433
+ });
434
+ function Ft() {
435
+ const a = ye(null), t = q(!1), l = (n) => {
436
+ u();
437
+ const o = e(n.target), m = o.style.position;
438
+ r(o) || (o.style.position = "relative");
439
+ const g = document.createElement("div");
440
+ g.className = "g-loading__container", o.appendChild(g);
441
+ const i = {}, S = _e(Ne, {
442
+ text: n.text,
443
+ noText: n.noText,
444
+ color: n.color,
445
+ dark: n.dark,
446
+ opacity: n.opacity,
447
+ blur: n.blur,
448
+ progressView: n.progressView,
449
+ onClose: () => {
450
+ d(i);
451
+ }
452
+ }), v = S.mount(g);
453
+ Object.assign(i, {
454
+ app: S,
455
+ container: g,
456
+ target: o,
457
+ originalPosition: m,
458
+ componentInstance: v
459
+ }), a.value = i, v.show(), t.value = !0;
460
+ }, e = (n) => {
461
+ if (!n) return document.body;
462
+ if (typeof n == "string") {
463
+ const o = document.querySelector(n);
464
+ if (!o) throw new Error(`Target element ${n} not found`);
465
+ return o;
466
+ }
467
+ return n;
468
+ }, u = async () => {
469
+ if (!a.value) return;
470
+ const { componentInstance: n } = a.value;
471
+ n && n.hide();
472
+ }, r = (n) => {
473
+ const o = window.getComputedStyle(n).position;
474
+ return ["relative", "absolute", "fixed", "sticky"].includes(o);
475
+ }, d = (n = a.value) => {
476
+ if (!n) return;
477
+ const o = a.value === n, { app: m, container: g, target: i, originalPosition: S } = n;
478
+ m.unmount(), g.parentElement === i && i.removeChild(g), o && (i.style.position = S, a.value = null, t.value = !1);
479
+ };
480
+ return be(() => {
481
+ u();
482
+ }), {
483
+ show: l,
484
+ hide: u,
485
+ visible: t
486
+ };
487
+ }
488
+ const _t = ne({
489
+ ...Le({ borderRadius: 12 }),
490
+ ...Ke(),
491
+ modelValue: {
492
+ type: Boolean,
493
+ default: void 0
494
+ },
495
+ defaultOpen: {
496
+ type: Boolean,
497
+ default: !1
498
+ },
499
+ title: String,
500
+ text: String,
501
+ icon: String,
502
+ color: {
503
+ type: String,
504
+ default: "primary"
505
+ },
506
+ state: String,
507
+ variant: {
508
+ type: String,
509
+ default: "tonal"
510
+ },
511
+ location: {
512
+ type: String,
513
+ default: "bottom-center"
514
+ },
515
+ position: {
516
+ type: String,
517
+ default: "fixed"
518
+ },
519
+ transition: {
520
+ type: [Boolean, String, Object],
521
+ default: void 0
522
+ },
523
+ timeout: {
524
+ type: Number,
525
+ default: 5e3
526
+ },
527
+ persistent: {
528
+ type: Boolean,
529
+ default: !1
530
+ },
531
+ closeable: {
532
+ type: Boolean,
533
+ default: !0
534
+ },
535
+ action: Object,
536
+ actionText: String,
537
+ closeOnAction: {
538
+ type: Boolean,
539
+ default: !0
540
+ },
541
+ multiline: {
542
+ type: Boolean,
543
+ default: !1
544
+ },
545
+ offset: {
546
+ type: [Number, String],
547
+ default: 24
548
+ },
549
+ maxWidth: {
550
+ type: [Number, String],
551
+ default: 520
552
+ },
553
+ pauseOnHover: {
554
+ type: Boolean,
555
+ default: !0
556
+ }
557
+ }), kt = {
558
+ key: 0,
559
+ class: "g-snackbar__prepend"
560
+ }, St = { class: "g-snackbar__main" }, wt = {
561
+ key: 0,
562
+ class: "g-snackbar__title"
563
+ }, Bt = {
564
+ key: 1,
565
+ class: "g-snackbar__text"
566
+ }, Ct = {
567
+ key: 1,
568
+ class: "g-snackbar__actions"
569
+ }, $t = /* @__PURE__ */ D({
570
+ __name: "GSnackbar",
571
+ props: _t(),
572
+ emits: ["update:modelValue", "action", "close", "after-close"],
573
+ setup(a, { expose: t, emit: l }) {
574
+ const e = a, u = l, r = ge(), d = q(), n = q(e.defaultOpen), o = q("manual"), m = f(() => e.modelValue !== void 0), g = f(
575
+ () => m.value ? e.modelValue === !0 : n.value
576
+ ), i = te(e.offset), S = te(e.maxWidth), {
577
+ getMorphBlobStyle: v,
578
+ morphBlobs: p,
579
+ morphEnabled: _,
580
+ materialFrameProps: O,
581
+ surfaceStyles: x,
582
+ surfaceMaterialMorphBlobClasses: $,
583
+ surfaceMaterialMorphClasses: M,
584
+ surfaceOverlayClasses: B,
585
+ surfaceUnderlayClasses: R,
586
+ surfaceTextureClasses: G,
587
+ surfaceContentClasses: W
588
+ } = De(e, "g-snackbar"), T = f(
589
+ () => {
590
+ var k;
591
+ return ((k = e.action) == null ? void 0 : k.label) ?? e.actionText;
592
+ }
593
+ ), h = f(() => ({
594
+ "--g-snackbar-max-width": S.value
595
+ })), F = f(() => ({
596
+ "--g-snackbar-offset": i.value
597
+ })), U = f(() => [
598
+ `g-snackbar_${e.variant}`,
599
+ {
600
+ "g-snackbar_multiline": e.multiline,
601
+ [`g-snackbar_texture-${e.texture}`]: e.texture !== "none"
602
+ }
603
+ ]), j = f(() => [
604
+ `g-snackbar-layer_position-${e.position}`,
605
+ `g-snackbar-layer_location-${e.location}`
606
+ ]), A = f(
607
+ () => e.transition ?? {
608
+ name: e.location.startsWith("top") ? "slide-y" : "slide-y-reverse",
609
+ appear: !0,
610
+ duration: 240,
611
+ leaveDuration: 180,
612
+ distance: "16px"
613
+ }
614
+ );
615
+ function z(k) {
616
+ m.value || (n.value = k), u("update:modelValue", k);
617
+ }
618
+ function N() {
619
+ d.value !== void 0 && (window.clearTimeout(d.value), d.value = void 0);
620
+ }
621
+ function E() {
622
+ N(), !(!g.value || e.persistent || e.timeout <= 0) && (d.value = window.setTimeout(() => {
623
+ V("timeout");
624
+ }, e.timeout));
625
+ }
626
+ function V(k = "manual") {
627
+ o.value = k, N(), z(!1), u("close", k);
628
+ }
629
+ function Z() {
630
+ var k, X;
631
+ u("action", (k = e.action) == null ? void 0 : k.value), (((X = e.action) == null ? void 0 : X.closeOnClick) ?? e.closeOnAction) && V("action");
632
+ }
633
+ function Be() {
634
+ e.pauseOnHover && N();
635
+ }
636
+ function Ce() {
637
+ e.pauseOnHover && E();
638
+ }
639
+ Ge(g, (k) => {
640
+ if (!k) {
641
+ N();
642
+ return;
643
+ }
644
+ E();
645
+ }), E(), me(() => {
646
+ N();
647
+ });
648
+ function $e() {
649
+ u("after-close", o.value);
650
+ }
651
+ return t({
652
+ open: () => z(!0),
653
+ close: V
654
+ }), (k, X) => (c(), y("div", {
655
+ class: C(["g-snackbar-layer", j.value]),
656
+ style: Y(F.value)
657
+ }, [
658
+ ee(s(Ve), {
659
+ transition: A.value,
660
+ onAfterLeave: $e
661
+ }, {
662
+ default: K(() => [
663
+ g.value ? (c(), I(we, J({
664
+ key: 0,
665
+ class: "g-snackbar__frame"
666
+ }, s(O), {
667
+ "inherit-width": !1,
668
+ style: h.value
669
+ }), {
670
+ default: K(() => [
671
+ w("section", {
672
+ class: C(["g-snackbar", U.value]),
673
+ style: Y(s(x)),
674
+ role: "status",
675
+ "aria-live": "polite",
676
+ onMouseenter: Be,
677
+ onMouseleave: Ce
678
+ }, [
679
+ w("span", {
680
+ class: C(s(R))
681
+ }, null, 2),
682
+ s(_) ? (c(), y("span", {
683
+ key: 0,
684
+ class: C(s(M)),
685
+ "aria-hidden": "true"
686
+ }, [
687
+ (c(!0), y(re, null, he(s(p), (ce, xe) => (c(), y("span", {
688
+ key: xe,
689
+ class: C(s($)),
690
+ style: Y(s(v)(ce))
691
+ }, null, 6))), 128))
692
+ ], 2)) : b("", !0),
693
+ w("span", {
694
+ class: C(s(B))
695
+ }, null, 2),
696
+ w("span", {
697
+ class: C(s(G))
698
+ }, null, 2),
699
+ w("div", {
700
+ class: C(["g-snackbar__content", s(W)])
701
+ }, [
702
+ r.prepend || e.icon ? (c(), y("div", kt, [
703
+ P(k.$slots, "prepend", {}, () => [
704
+ e.icon ? (c(), I(pe, {
705
+ key: 0,
706
+ icon: e.icon,
707
+ size: "22"
708
+ }, null, 8, ["icon"])) : b("", !0)
709
+ ], !0)
710
+ ])) : b("", !0),
711
+ w("div", St, [
712
+ r.title || e.title ? (c(), y("div", wt, [
713
+ P(k.$slots, "title", {}, () => [
714
+ ie(le(e.title), 1)
715
+ ], !0)
716
+ ])) : b("", !0),
717
+ r.default || e.text ? (c(), y("div", Bt, [
718
+ P(k.$slots, "default", {}, () => [
719
+ ie(le(e.text), 1)
720
+ ], !0)
721
+ ])) : b("", !0)
722
+ ]),
723
+ r.action || T.value || e.closeable ? (c(), y("div", Ct, [
724
+ P(k.$slots, "action", {
725
+ close: () => V("action")
726
+ }, () => [
727
+ T.value ? (c(), I(bt, {
728
+ key: 0,
729
+ variant: "text",
730
+ size: "s",
731
+ label: T.value,
732
+ onClick: Z
733
+ }, null, 8, ["label"])) : b("", !0)
734
+ ], !0),
735
+ e.closeable ? (c(), y("button", {
736
+ key: 0,
737
+ type: "button",
738
+ class: "g-snackbar__close",
739
+ "aria-label": "Close snackbar",
740
+ onClick: X[0] || (X[0] = (ce) => V("dismiss"))
741
+ }, [
742
+ ee(pe, {
743
+ icon: "close",
744
+ size: "18"
745
+ })
746
+ ])) : b("", !0)
747
+ ])) : b("", !0)
748
+ ], 2)
749
+ ], 38)
750
+ ]),
751
+ _: 3
752
+ }, 16, ["style"])) : b("", !0)
753
+ ]),
754
+ _: 3
755
+ }, 8, ["transition"])
756
+ ], 6));
757
+ }
758
+ }), xt = /* @__PURE__ */ Q($t, [["__scopeId", "data-v-ce4de976"]]), Ot = "bottom-center", It = "slide-y", L = /* @__PURE__ */ new Map();
759
+ let Mt = 0;
760
+ function Rt(a) {
761
+ return typeof a == "string" ? {
762
+ label: a
763
+ } : a;
764
+ }
765
+ function Gt(a, t) {
766
+ return a === "fade" ? "fade" : a === "scale" ? "scale" : a === "slide-x" ? t.endsWith("right") ? "slide-x-reverse" : "slide-x" : t.startsWith("top") ? "slide-y" : "slide-y-reverse";
767
+ }
768
+ function Tt() {
769
+ return D({
770
+ name: "GSnackbarHost",
771
+ props: {
772
+ items: {
773
+ type: Array,
774
+ required: !0
775
+ },
776
+ location: {
777
+ type: String,
778
+ required: !0
779
+ },
780
+ transition: {
781
+ type: String,
782
+ required: !0
783
+ },
784
+ close: {
785
+ type: Function,
786
+ required: !0
787
+ },
788
+ remove: {
789
+ type: Function,
790
+ required: !0
791
+ }
792
+ },
793
+ setup(a) {
794
+ return () => se(
795
+ "div",
796
+ {
797
+ class: [
798
+ "g-snackbar-stack",
799
+ `g-snackbar-stack_location-${a.location}`
800
+ ]
801
+ },
802
+ [
803
+ se(
804
+ "div",
805
+ {
806
+ class: "g-snackbar-stack__items"
807
+ },
808
+ a.items.map(
809
+ (t) => se(xt, {
810
+ key: t.id,
811
+ ...t,
812
+ modelValue: t.open,
813
+ position: "static",
814
+ transition: {
815
+ name: Gt(
816
+ t.transition ?? a.transition,
817
+ t.location
818
+ ),
819
+ appear: !0,
820
+ duration: 240,
821
+ leaveDuration: 180,
822
+ distance: "18px",
823
+ scale: 0.96
824
+ },
825
+ "onUpdate:modelValue": (l) => {
826
+ t.open = l;
827
+ },
828
+ onClose: (l) => a.close(t.id, l),
829
+ onAfterClose: () => a.remove(t.id)
830
+ })
831
+ )
832
+ )
833
+ ]
834
+ );
835
+ }
836
+ });
837
+ }
838
+ function zt(a, t, l, e) {
839
+ const u = L.get(a);
840
+ if (u) return u;
841
+ const r = document.createElement("div");
842
+ r.className = "g-snackbar-stack__container", document.body.appendChild(r);
843
+ const d = Te([]), n = _e(Tt(), {
844
+ items: d,
845
+ location: a,
846
+ transition: t,
847
+ close: l,
848
+ remove: e
849
+ });
850
+ n.mount(r);
851
+ const o = {
852
+ app: n,
853
+ container: r,
854
+ items: d
855
+ };
856
+ return L.set(a, o), o;
857
+ }
858
+ function Ut() {
859
+ const a = ye([]);
860
+ function t(r) {
861
+ for (const [d, n] of L.entries()) {
862
+ const o = n.items.findIndex((m) => m.id === r);
863
+ if (o !== -1) {
864
+ n.items.splice(o, 1), a.value = a.value.filter(
865
+ (m) => m.id !== r
866
+ ), n.items.length || window.setTimeout(() => {
867
+ n.items.length || (n.app.unmount(), n.container.remove(), L.delete(d));
868
+ }, 220);
869
+ return;
870
+ }
871
+ }
872
+ }
873
+ function l(r, d = "manual") {
874
+ for (const n of L.values()) {
875
+ const o = n.items.find((m) => m.id === r);
876
+ if (o) {
877
+ o.open = !1;
878
+ return;
879
+ }
880
+ }
881
+ }
882
+ function e(r) {
883
+ const d = typeof r == "string" ? { text: r } : r, n = d.location ?? Ot, o = d.transition ?? It, m = ++Mt, g = {
884
+ ...d,
885
+ id: m,
886
+ open: !0,
887
+ location: n,
888
+ transition: o,
889
+ action: Rt(d.action)
890
+ };
891
+ return zt(n, o, l, t).items.push(g), a.value = [...a.value, g], {
892
+ id: m,
893
+ close: (S = "manual") => {
894
+ l(m, S);
895
+ }
896
+ };
897
+ }
898
+ function u() {
899
+ for (const [r, d] of L.entries())
900
+ d.app.unmount(), d.container.remove(), L.delete(r);
901
+ a.value = [];
902
+ }
903
+ return be(() => {
904
+ u();
905
+ }), {
906
+ show: e,
907
+ closeAll: u,
908
+ items: a
909
+ };
910
+ }
911
+ export {
912
+ we as G,
913
+ bt as _,
914
+ pe as a,
915
+ xt as b,
916
+ Ut as c,
917
+ ft as d,
918
+ oe as e,
919
+ mt as f,
920
+ pt as m,
921
+ Ft as u
922
+ };