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