morya-ui 0.2.7 → 0.2.8

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 (40) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/Renderable-DHU4Jcfw.js +20 -0
  3. package/dist/component-registry.d.ts.map +1 -1
  4. package/dist/components/Carousel/Carousel.vue.d.ts +1 -1
  5. package/dist/components/ConfirmPopup/ConfirmPopup.vue.d.ts +1 -1
  6. package/dist/components/Loading/Loading.vue.d.ts +25 -0
  7. package/dist/components/Loading/Loading.vue.d.ts.map +1 -0
  8. package/dist/components/Loading/LoadingIndicator.vue.d.ts +13 -0
  9. package/dist/components/Loading/LoadingIndicator.vue.d.ts.map +1 -0
  10. package/dist/components/Loading/directive.d.ts +12 -0
  11. package/dist/components/Loading/directive.d.ts.map +1 -0
  12. package/dist/components/Loading/index.d.ts +8 -0
  13. package/dist/components/Loading/index.d.ts.map +1 -0
  14. package/dist/components/Loading/loading.d.ts +35 -0
  15. package/dist/components/Loading/loading.d.ts.map +1 -0
  16. package/dist/components/Loading/styles.css +386 -0
  17. package/dist/components/Loading/types.d.ts +74 -0
  18. package/dist/components/Loading/types.d.ts.map +1 -0
  19. package/dist/components/Loading/useLoading.d.ts +11 -0
  20. package/dist/components/Loading/useLoading.d.ts.map +1 -0
  21. package/dist/components/Page/PageContent.vue.d.ts +2 -2
  22. package/dist/components/ProgressSpinner/ProgressSpinner.vue.d.ts +1 -1
  23. package/dist/components/Rating/Rating.vue.d.ts +1 -1
  24. package/dist/components/Table/Table.vue.d.ts +1 -1
  25. package/dist/confirm-dialog/index.js +9 -9
  26. package/dist/content-h8POj44-.js +28 -0
  27. package/dist/index.d.ts +8 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +4152 -3697
  30. package/dist/loading/index.js +467 -0
  31. package/dist/loading/style.css +1377 -0
  32. package/dist/loading/style.js +3 -0
  33. package/dist/message/index.js +7 -6
  34. package/dist/resolver-map.d.ts.map +1 -1
  35. package/dist/resolver.js +1 -0
  36. package/dist/shared/config.d.ts.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/dist/toast/index.js +12 -11
  39. package/package.json +9 -2
  40. package/dist/Renderable-BaaCI4tS.js +0 -45
@@ -0,0 +1,467 @@
1
+ import { r as e } from "../useComponentAttrs-BTYEe61P.js";
2
+ import { i as t } from "../types-DGuu4Eg4.js";
3
+ import { n } from "../overlay-oR-5MDuE.js";
4
+ import { i as r } from "../content-h8POj44-.js";
5
+ import { t as i } from "../overlayHost-78CGtMgR.js";
6
+ import { c as a, i as o } from "../config-BdK5ccNT.js";
7
+ import { n as s } from "../locale-B36KH7c3.js";
8
+ import "./style.js";
9
+ import { Fragment as c, Teleport as l, Transition as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createStaticVNode as g, createVNode as _, defineComponent as v, h as y, mergeProps as b, normalizeClass as x, normalizeStyle as S, onBeforeUnmount as C, openBlock as w, reactive as T, ref as ee, render as E, renderList as D, renderSlot as O, toDisplayString as k, unref as A, useAttrs as te, useSlots as ne, watch as j, withCtx as M } from "vue";
10
+ //#region src/components/Loading/types.ts
11
+ var N = [
12
+ "circular",
13
+ "aurora",
14
+ "bounce",
15
+ "wave",
16
+ "pulse",
17
+ "stardust"
18
+ ], P = new Set(N);
19
+ function F(e) {
20
+ return typeof e == "string" && P.has(e);
21
+ }
22
+ function I(e) {
23
+ return F(e) ? e : "circular";
24
+ }
25
+ //#endregion
26
+ //#region src/components/Loading/LoadingIndicator.vue?vue&type=script&setup=true&lang.ts
27
+ var L = ["aria-label"], R = {
28
+ class: "m-loading-indicator__graphic",
29
+ "aria-hidden": "true"
30
+ }, z = {
31
+ key: 0,
32
+ class: "m-loading-aurora"
33
+ }, B = {
34
+ key: 1,
35
+ class: "m-loading-bounce"
36
+ }, V = {
37
+ key: 2,
38
+ class: "m-loading-wave"
39
+ }, re = {
40
+ key: 3,
41
+ class: "m-loading-pulse"
42
+ }, ie = {
43
+ key: 4,
44
+ class: "m-loading-stardust"
45
+ }, ae = {
46
+ key: 5,
47
+ class: "m-loading-circular"
48
+ }, oe = {
49
+ key: 0,
50
+ class: "m-loading-indicator__tip"
51
+ }, H = /* @__PURE__ */ v({
52
+ name: "MLoadingIndicator",
53
+ __name: "LoadingIndicator",
54
+ props: {
55
+ effect: {},
56
+ text: {},
57
+ ariaLabel: {},
58
+ size: {}
59
+ },
60
+ setup(e) {
61
+ let n = e, r = s(), i = o("Loading"), a = d(() => I(n.effect ?? i.value.effect)), l = d(() => n.size ?? i.value.size), u = d(() => {
62
+ let e = t(l.value);
63
+ return {
64
+ "m-loading-indicator--small": e === "small",
65
+ "m-loading-indicator--large": e === "large"
66
+ };
67
+ }), f = d(() => n.ariaLabel ?? (n.text ? void 0 : r.value.loading));
68
+ return (t, n) => (w(), m("div", {
69
+ class: x(["m-loading-indicator", u.value]),
70
+ role: "status",
71
+ "aria-live": "polite",
72
+ "aria-label": f.value
73
+ }, [h("div", R, [a.value === "aurora" ? (w(), m("div", z, [...n[0] ||= [h("div", { class: "m-loading-aurora__ring" }, null, -1), h("div", { class: "m-loading-aurora__glow" }, null, -1)]])) : a.value === "bounce" ? (w(), m("div", B, [...n[1] ||= [
74
+ h("span", { class: "m-loading-bounce__ball" }, null, -1),
75
+ h("span", { class: "m-loading-bounce__ball" }, null, -1),
76
+ h("span", { class: "m-loading-bounce__ball" }, null, -1)
77
+ ]])) : a.value === "wave" ? (w(), m("div", V, [...n[2] ||= [g("<span class=\"m-loading-wave__bar\"></span><span class=\"m-loading-wave__bar\"></span><span class=\"m-loading-wave__bar\"></span><span class=\"m-loading-wave__bar\"></span><span class=\"m-loading-wave__bar\"></span>", 5)]])) : a.value === "pulse" ? (w(), m("div", re, [...n[3] ||= [
78
+ h("span", { class: "m-loading-pulse__ring" }, null, -1),
79
+ h("span", { class: "m-loading-pulse__ring" }, null, -1),
80
+ h("span", { class: "m-loading-pulse__ring" }, null, -1),
81
+ h("span", { class: "m-loading-pulse__ring" }, null, -1)
82
+ ]])) : a.value === "stardust" ? (w(), m("div", ie, [(w(), m(c, null, D(8, (e) => h("span", {
83
+ key: e,
84
+ class: "m-loading-stardust__dot",
85
+ style: S({ "--i": String(e - 1) })
86
+ }, null, 4)), 64))])) : (w(), m("div", ae, [...n[4] ||= [h("svg", {
87
+ class: "m-loading-circular__svg",
88
+ viewBox: "0 0 50 50"
89
+ }, [h("circle", {
90
+ class: "m-loading-circular__path",
91
+ cx: "25",
92
+ cy: "25",
93
+ r: "20",
94
+ fill: "none"
95
+ })], -1)]]))]), e.text ? (w(), m("p", oe, k(e.text), 1)) : p("", !0)], 10, L));
96
+ }
97
+ }), U = /* @__PURE__ */ new Set(), W = null, G = 0, K = "";
98
+ function q() {
99
+ typeof document > "u" || (G === 0 && (K = document.body.style.overflow), G += 1, document.body.style.overflow = "hidden");
100
+ }
101
+ function J() {
102
+ typeof document > "u" || (G = Math.max(0, G - 1), G === 0 && (document.body.style.overflow = K));
103
+ }
104
+ function se(e) {
105
+ if (typeof document > "u") throw Error("[MLoading] service is only available in the browser");
106
+ if (!e || e === document.body) return document.body;
107
+ if (typeof e == "string") {
108
+ let t = document.querySelector(e);
109
+ if (!(t instanceof HTMLElement)) throw TypeError(`[MLoading] target not found: ${e}`);
110
+ return t;
111
+ }
112
+ return e;
113
+ }
114
+ function ce(e) {
115
+ let t = 0;
116
+ return () => {
117
+ t ||= requestAnimationFrame(() => {
118
+ t = 0, e();
119
+ });
120
+ };
121
+ }
122
+ function Y(e) {
123
+ let t = T({
124
+ visible: !e.delay,
125
+ text: e.text ?? "",
126
+ effect: e.effect,
127
+ background: e.background,
128
+ customClass: e.customClass,
129
+ size: e.size,
130
+ fullscreen: !!e.fullscreen,
131
+ body: !!e.body && !e.fullscreen,
132
+ spinner: e.spinner,
133
+ top: 0,
134
+ left: 0,
135
+ width: 0,
136
+ height: 0
137
+ });
138
+ t.fullscreen && W && W.destroy();
139
+ let n = document.createElement("div");
140
+ (t.fullscreen || t.body ? document.body : e.target).appendChild(n);
141
+ let a = !1;
142
+ if (!t.fullscreen && !t.body) {
143
+ let t = getComputedStyle(e.target).position;
144
+ (!t || t === "static") && (e.target.classList.add("m-loading-parent--relative"), a = !0);
145
+ }
146
+ e.target.setAttribute("aria-busy", "true");
147
+ let o = !1;
148
+ function s(e) {
149
+ if (e && !o) {
150
+ q(), o = !0;
151
+ return;
152
+ }
153
+ !e && o && (J(), o = !1);
154
+ }
155
+ t.visible && s(!!e.lock);
156
+ function c() {
157
+ if (!t.body) return;
158
+ let n = e.target.getBoundingClientRect();
159
+ t.top = n.top, t.left = n.left, t.width = n.width, t.height = n.height;
160
+ }
161
+ let l = ce(c), d = null;
162
+ t.body && (c(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), typeof ResizeObserver < "u" && (d = new ResizeObserver(l), d.observe(e.target)));
163
+ let f = null;
164
+ e.delay && e.delay > 0 && (f = setTimeout(() => {
165
+ f = null, t.visible = !0, s(!!e.lock);
166
+ }, e.delay));
167
+ let p = null, m = !1, h = !1, g = null;
168
+ function _() {
169
+ h || (h = !0, m = !0, f !== null && (clearTimeout(f), f = null), p !== null && (clearTimeout(p), p = null), s(!1), t.body && (window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l), d?.disconnect(), d = null), a && e.target.classList.remove("m-loading-parent--relative"), e.target.getAttribute("aria-busy") === "true" && e.target.removeAttribute("aria-busy"), E(null, n), n.remove(), g && (U.delete(g), W === g && (W = null)));
170
+ }
171
+ let b = v({
172
+ name: "MLoadingMask",
173
+ setup() {
174
+ return () => y(u, {
175
+ name: "m-loading",
176
+ appear: !0,
177
+ duration: {
178
+ enter: 180,
179
+ leave: 130
180
+ },
181
+ onAfterLeave: () => _()
182
+ }, { default: () => {
183
+ if (!t.visible) return null;
184
+ let e = [
185
+ "m-loading-mask",
186
+ t.fullscreen ? "m-loading-mask--fullscreen" : void 0,
187
+ t.body ? "m-loading-mask--body" : void 0,
188
+ t.customClass || void 0
189
+ ].filter((e) => !!e), n = {};
190
+ t.background && (n.background = t.background), t.body && (n.top = `${t.top}px`, n.left = `${t.left}px`, n.width = `${t.width}px`, n.height = `${t.height}px`);
191
+ let i = t.spinner ? r(t.spinner) : y(H, {
192
+ effect: t.effect,
193
+ size: t.size,
194
+ text: t.text || void 0
195
+ });
196
+ return y("div", {
197
+ class: e,
198
+ style: n
199
+ }, [i]);
200
+ } });
201
+ }
202
+ });
203
+ g = {
204
+ fullscreen: t.fullscreen,
205
+ destroy: _,
206
+ close() {
207
+ if (!m) {
208
+ if (m = !0, f !== null) {
209
+ clearTimeout(f), f = null, _();
210
+ return;
211
+ }
212
+ if (!t.visible) {
213
+ _();
214
+ return;
215
+ }
216
+ t.visible = !1, p = setTimeout(_, 200);
217
+ }
218
+ }
219
+ }, U.add(g), t.fullscreen && (W = g);
220
+ let x = y(b);
221
+ return x.appContext = e.appContext ?? i(), E(x, n), {
222
+ close: () => g.close(),
223
+ destroy: () => _(),
224
+ setText(e) {
225
+ h || (t.text = e);
226
+ },
227
+ update(e) {
228
+ h || (e.text !== void 0 && (t.text = e.text), e.effect !== void 0 && (t.effect = e.effect), e.background !== void 0 && (t.background = e.background), e.customClass !== void 0 && (t.customClass = e.customClass), e.size !== void 0 && (t.size = e.size), e.spinner !== void 0 && (t.spinner = e.spinner), e.lock !== void 0 && t.visible && s(e.lock));
229
+ }
230
+ };
231
+ }
232
+ function le() {
233
+ return {
234
+ close() {},
235
+ setText() {},
236
+ destroy() {}
237
+ };
238
+ }
239
+ function ue(e = {}) {
240
+ if (typeof document > "u") return le();
241
+ let t = e.fullscreen ?? (e.target == null && !e.body), n = Y({
242
+ target: t ? document.body : se(e.target ?? document.body),
243
+ fullscreen: t,
244
+ body: !!e.body && !t,
245
+ lock: e.lock,
246
+ text: e.text,
247
+ effect: e.effect,
248
+ background: e.background,
249
+ customClass: e.customClass,
250
+ size: e.size,
251
+ delay: e.delay,
252
+ spinner: e.spinner
253
+ });
254
+ return {
255
+ close: () => n.close(),
256
+ setText: (e) => n.setText(e),
257
+ destroy: () => n.destroy()
258
+ };
259
+ }
260
+ var X = { service: ue }, de = ["aria-busy"], fe = ["inert"], pe = /* @__PURE__ */ v({
261
+ name: "MLoading",
262
+ inheritAttrs: !1,
263
+ __name: "Loading",
264
+ props: {
265
+ pt: {},
266
+ loading: {
267
+ type: Boolean,
268
+ default: !0
269
+ },
270
+ effect: {},
271
+ text: {},
272
+ ariaLabel: {},
273
+ size: {},
274
+ background: {},
275
+ customClass: {},
276
+ fullscreen: {
277
+ type: Boolean,
278
+ default: !1
279
+ },
280
+ lock: {
281
+ type: Boolean,
282
+ default: !1
283
+ },
284
+ delay: { default: 0 }
285
+ },
286
+ setup(t) {
287
+ let r = t, i = te(), s = ne(), { rootAttrs: g } = e(i, () => r.pt), v = o("Loading"), y = a(), T = d(() => !!s.default), E = d(() => T.value || r.fullscreen), D = d(() => I(r.effect ?? v.value.effect)), k = d(() => r.size ?? v.value.size), N = d(() => r.delay ?? v.value.delay ?? 0), P = d(() => r.background ? { background: r.background } : void 0), F = d(() => n(r.fullscreen ? {
288
+ teleport: !0,
289
+ appendTo: "body"
290
+ } : { teleport: !1 }, y.value.appendTo)), L = ee(r.loading && N.value <= 0), R = null;
291
+ function z() {
292
+ R !== null && (clearTimeout(R), R = null);
293
+ }
294
+ j(() => [
295
+ r.loading,
296
+ N.value,
297
+ E.value
298
+ ], ([e, t]) => {
299
+ if (z(), !e || !E.value) {
300
+ L.value = !1;
301
+ return;
302
+ }
303
+ if (!t) {
304
+ L.value = !0;
305
+ return;
306
+ }
307
+ L.value = !1, R = setTimeout(() => {
308
+ L.value = !0, R = null;
309
+ }, t);
310
+ }, { immediate: !0 });
311
+ let B = d(() => r.lock && L.value && E.value), V = !1;
312
+ return j(B, (e) => {
313
+ if (e && !V) {
314
+ q(), V = !0;
315
+ return;
316
+ }
317
+ !e && V && (J(), V = !1);
318
+ }, { immediate: !0 }), C(() => {
319
+ z(), V &&= (J(), !1);
320
+ }), (e, n) => E.value ? (w(), m(c, { key: 0 }, [T.value ? (w(), m("div", b({ key: 0 }, A(g), {
321
+ class: ["m-loading", { "m-loading--active": L.value }],
322
+ "aria-busy": L.value || void 0
323
+ }), [h("div", {
324
+ class: "m-loading__content",
325
+ inert: L.value || void 0
326
+ }, [O(e.$slots, "default")], 8, fe), (w(), f(l, {
327
+ to: F.value.to,
328
+ disabled: F.value.disabled
329
+ }, [_(u, { name: "m-loading" }, {
330
+ default: M(() => [L.value ? (w(), m("div", {
331
+ key: 0,
332
+ class: x(["m-loading-mask", [{ "m-loading-mask--fullscreen": t.fullscreen }, t.customClass]]),
333
+ style: S(P.value)
334
+ }, [O(e.$slots, "indicator", {}, () => [_(H, {
335
+ effect: D.value,
336
+ size: k.value,
337
+ text: t.text,
338
+ "aria-label": t.ariaLabel
339
+ }, null, 8, [
340
+ "effect",
341
+ "size",
342
+ "text",
343
+ "aria-label"
344
+ ])])], 6)) : p("", !0)]),
345
+ _: 3
346
+ })], 8, ["to", "disabled"]))], 16, de)) : (w(), f(l, {
347
+ key: 1,
348
+ to: F.value.to,
349
+ disabled: F.value.disabled
350
+ }, [_(u, { name: "m-loading" }, {
351
+ default: M(() => [L.value ? (w(), m("div", b({ key: 0 }, A(g), {
352
+ class: ["m-loading-mask m-loading-mask--fullscreen", t.customClass],
353
+ style: P.value,
354
+ role: "presentation",
355
+ "aria-busy": "true"
356
+ }), [O(e.$slots, "indicator", {}, () => [_(H, {
357
+ effect: D.value,
358
+ size: k.value,
359
+ text: t.text,
360
+ "aria-label": t.ariaLabel
361
+ }, null, 8, [
362
+ "effect",
363
+ "size",
364
+ "text",
365
+ "aria-label"
366
+ ])])], 16)) : p("", !0)]),
367
+ _: 3
368
+ })], 8, ["to", "disabled"]))], 64)) : (w(), f(H, b({ key: 1 }, A(g), {
369
+ effect: D.value,
370
+ size: k.value,
371
+ text: t.text,
372
+ "aria-label": t.ariaLabel
373
+ }), null, 16, [
374
+ "effect",
375
+ "size",
376
+ "text",
377
+ "aria-label"
378
+ ]));
379
+ }
380
+ }), Z = /* @__PURE__ */ new WeakMap();
381
+ function Q(e, ...t) {
382
+ for (let n of t) {
383
+ let t = e.getAttribute(n);
384
+ if (t != null) return t;
385
+ }
386
+ }
387
+ function me(e) {
388
+ return F(e) ? e : void 0;
389
+ }
390
+ function he(e, t) {
391
+ let n = t.value, r = n && typeof n == "object" ? n : void 0, i = typeof n == "boolean" ? n : r ? r.loading !== !1 : !!n, a = !!(t.modifiers.fullscreen || r?.fullscreen), o = !!(t.modifiers.body || r?.body) && !a, s = me(r?.effect ?? Q(e, "m-loading-effect")), c = r?.size, l = Q(e, "m-loading-delay"), u = r?.delay ?? (l == null ? void 0 : Number(l));
392
+ return {
393
+ visible: i,
394
+ text: r?.text ?? Q(e, "m-loading-text"),
395
+ effect: s,
396
+ background: r?.background ?? Q(e, "m-loading-background"),
397
+ customClass: r?.customClass ?? Q(e, "m-loading-custom-class"),
398
+ size: typeof c == "string" ? c : void 0,
399
+ fullscreen: a,
400
+ lock: !!(t.modifiers.lock || r?.lock),
401
+ body: o,
402
+ delay: Number.isFinite(u) ? u : void 0,
403
+ spinner: r?.spinner,
404
+ mode: `${a}:${o}`
405
+ };
406
+ }
407
+ function $(e, t) {
408
+ let n = he(e, t), r = Z.get(e);
409
+ if (!n.visible) {
410
+ if (!r) return;
411
+ Z.delete(e), r.instance.close();
412
+ return;
413
+ }
414
+ if (r && r.mode === n.mode) {
415
+ r.instance.update(n);
416
+ return;
417
+ }
418
+ r?.instance.destroy(), Z.set(e, {
419
+ mode: n.mode,
420
+ instance: Y({
421
+ target: e,
422
+ text: n.text,
423
+ effect: n.effect,
424
+ background: n.background,
425
+ customClass: n.customClass,
426
+ size: n.size,
427
+ fullscreen: n.fullscreen,
428
+ lock: n.lock,
429
+ body: n.body,
430
+ delay: n.delay,
431
+ spinner: n.spinner,
432
+ appContext: t.instance?.$.appContext
433
+ })
434
+ });
435
+ }
436
+ var ge = {
437
+ mounted: $,
438
+ updated: $,
439
+ unmounted(e) {
440
+ let t = Z.get(e);
441
+ t && (Z.delete(e), t.instance.destroy());
442
+ }
443
+ };
444
+ //#endregion
445
+ //#region src/components/Loading/useLoading.ts
446
+ function _e(e = {}) {
447
+ let t = null;
448
+ function n() {
449
+ t?.close(), t = null;
450
+ }
451
+ return C(() => {
452
+ t?.destroy(), t = null;
453
+ }), {
454
+ open(r = {}) {
455
+ return n(), t = X.service({
456
+ ...e,
457
+ ...r
458
+ }), t;
459
+ },
460
+ close: n,
461
+ setText(e) {
462
+ t?.setText(e);
463
+ }
464
+ };
465
+ }
466
+ //#endregion
467
+ export { N as LOADING_EFFECTS, pe as MLoading, F as isLoadingEffect, X as loading, I as normalizeLoadingEffect, _e as useLoading, ge as vLoading };