x-essential-lib 0.1.0 → 0.1.2

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.
@@ -0,0 +1,89 @@
1
+ import { DefineComponent } from 'vue'
2
+
3
+ export declare const XConfirmDlg: DefineComponent<
4
+ {
5
+ modelValue: {
6
+ type: Boolean
7
+ required: true
8
+ }
9
+ },
10
+ {
11
+ 'update:modelValue'(value: boolean): void
12
+ },
13
+ unknown
14
+ >
15
+
16
+ export declare const XLoading: DefineComponent<
17
+ {
18
+ zIndex: {
19
+ type: Number
20
+ default: 1
21
+ }
22
+ },
23
+ {},
24
+ unknown
25
+ >
26
+
27
+ export declare const XMessage: DefineComponent<{}, {}, unknown>
28
+
29
+ export declare const XPromptDlg: DefineComponent<
30
+ {
31
+ modelValue: {
32
+ type: Boolean
33
+ required: true
34
+ }
35
+ },
36
+ {
37
+ 'update:modelValue'(value: boolean): void
38
+ },
39
+ unknown
40
+ >
41
+
42
+ export declare const XMessage: DefineComponent<{}, {}, unknown>
43
+
44
+ export declare function waitMs(ms: number): Promise<void>
45
+
46
+ export declare function waitUtil(
47
+ conditionFunc: () => boolean,
48
+ timeout?: number,
49
+ interval?: number
50
+ ): Promise<boolean>
51
+
52
+ interface ButtonOptions {
53
+ color?: string
54
+ text?: string
55
+ }
56
+
57
+ interface ConfirmParams {
58
+ title: string
59
+ text: string
60
+ cancel?: ButtonOptions
61
+ confirm?: ButtonOptions
62
+ }
63
+
64
+ export declare function openConfirmDlg(
65
+ params: ConfirmParams
66
+ ): Promise<boolean | undefined>
67
+
68
+ interface PromptParams {
69
+ title: string
70
+ text?: string
71
+ label?: string
72
+ placeholder?: string
73
+ rules?: ((val: string) => string | boolean)[]
74
+ value?: string
75
+ cancel?: ButtonOptions
76
+ confirm?: ButtonOptions
77
+ }
78
+
79
+ export declare function openPromptDlg(params: PromptParams): Promise<any>
80
+
81
+ export declare function openWaitDlg()
82
+ export declare function closeWaitDlg()
83
+
84
+ export declare function messageError(text: string, timeout?: number)
85
+ export declare function messageInfo(text: string, timeout?: number)
86
+ export declare function messageSuccess(text: string, timeout?: number)
87
+ export declare function messageWarning(text: string, timeout?: number)
88
+
89
+ export declare function appAppear(name: string)
package/dist/index.js ADDED
@@ -0,0 +1,513 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode('.x-cont[data-v-a8f3d91f]{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;align-items:center;justify-content:center}.lds-spinner[data-v-a8f3d91f]{color:official;display:inline-block;position:relative;width:40px;height:40px}.lds-spinner div[data-v-a8f3d91f]{transform-origin:20px 20px;animation:lds-spinner-a8f3d91f 1.2s linear infinite}.lds-spinner div[data-v-a8f3d91f]:after{content:" ";display:block;position:absolute;top:3px;left:18px;width:2px;height:6px;border-radius:5%;background:#9e9e9e}.lds-spinner div[data-v-a8f3d91f]:nth-child(1){transform:rotate(0);animation-delay:-1.1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(2){transform:rotate(30deg);animation-delay:-1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(3){transform:rotate(60deg);animation-delay:-.9s}.lds-spinner div[data-v-a8f3d91f]:nth-child(4){transform:rotate(90deg);animation-delay:-.8s}.lds-spinner div[data-v-a8f3d91f]:nth-child(5){transform:rotate(120deg);animation-delay:-.7s}.lds-spinner div[data-v-a8f3d91f]:nth-child(6){transform:rotate(150deg);animation-delay:-.6s}.lds-spinner div[data-v-a8f3d91f]:nth-child(7){transform:rotate(180deg);animation-delay:-.5s}.lds-spinner div[data-v-a8f3d91f]:nth-child(8){transform:rotate(210deg);animation-delay:-.4s}.lds-spinner div[data-v-a8f3d91f]:nth-child(9){transform:rotate(240deg);animation-delay:-.3s}.lds-spinner div[data-v-a8f3d91f]:nth-child(10){transform:rotate(270deg);animation-delay:-.2s}.lds-spinner div[data-v-a8f3d91f]:nth-child(11){transform:rotate(300deg);animation-delay:-.1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(12){transform:rotate(330deg);animation-delay:0s}@keyframes lds-spinner-a8f3d91f{0%{opacity:1}to{opacity:0}}.x-cont[data-v-70ed4b89]{position:absolute;left:50%;bottom:20px;transform:translate(-50%);z-index:9999}')),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ import { getCurrentInstance as oe, inject as F, defineComponent as I, useModel as G, ref as _, computed as w, onMounted as W, onBeforeUnmount as L, watch as O, resolveComponent as m, openBlock as V, createBlock as M, withKeys as j, withModifiers as R, withCtx as p, createVNode as g, createTextVNode as h, toDisplayString as D, createElementBlock as K, normalizeStyle as le, pushScopeId as ae, popScopeId as se, createElementVNode as v, reactive as re, Fragment as ce, renderList as ie, unref as ue } from "vue";
3
+ function de(t) {
4
+ return { all: t = t || /* @__PURE__ */ new Map(), on: function(n, e) {
5
+ var o = t.get(n);
6
+ o ? o.push(e) : t.set(n, [e]);
7
+ }, off: function(n, e) {
8
+ var o = t.get(n);
9
+ o && (e ? o.splice(o.indexOf(e) >>> 0, 1) : t.set(n, []));
10
+ }, emit: function(n, e) {
11
+ var o = t.get(n);
12
+ o && o.slice().map(function(l) {
13
+ l(e);
14
+ }), (o = t.get("*")) && o.slice().map(function(l) {
15
+ l(n, e);
16
+ });
17
+ } };
18
+ }
19
+ const s = de();
20
+ async function ke(t) {
21
+ return new Promise((n) => {
22
+ setTimeout(n, t);
23
+ });
24
+ }
25
+ async function X(t, n, e) {
26
+ const o = Date.now();
27
+ return new Promise((l) => {
28
+ const u = async () => {
29
+ t() ? l(!0) : n && Date.now() - o > n ? l(!1) : setTimeout(u, e ?? 30);
30
+ };
31
+ u();
32
+ });
33
+ }
34
+ function fe(t, n) {
35
+ const e = oe();
36
+ if (!e)
37
+ throw new Error(`[Vuetify] ${t} must be called from inside a setup function`);
38
+ return e;
39
+ }
40
+ const me = Symbol.for("vuetify:locale");
41
+ function z() {
42
+ const t = F(me);
43
+ if (!t)
44
+ throw new Error("[Vuetify] Could not find injected locale instance");
45
+ return t;
46
+ }
47
+ const pe = Symbol.for("vuetify:theme");
48
+ function ve() {
49
+ fe("useTheme");
50
+ const t = F(pe, null);
51
+ if (!t)
52
+ throw new Error("Could not find Vuetify theme injection");
53
+ return t;
54
+ }
55
+ const Ie = /* @__PURE__ */ I({
56
+ __name: "index",
57
+ props: {
58
+ modelValue: { type: Boolean, required: !0 },
59
+ modelModifiers: {}
60
+ },
61
+ emits: ["update:modelValue"],
62
+ setup(t) {
63
+ const n = z(), e = G(t, "modelValue"), o = _(""), l = _(""), u = _(), c = _(), i = w(() => {
64
+ var r;
65
+ return ((r = u.value) == null ? void 0 : r.color) ?? "primary";
66
+ }), f = w(() => {
67
+ var r;
68
+ return ((r = u.value) == null ? void 0 : r.text) ?? n.t("cancel");
69
+ }), d = w(() => {
70
+ var r;
71
+ return ((r = c.value) == null ? void 0 : r.color) ?? "primary";
72
+ }), b = w(() => {
73
+ var r;
74
+ return ((r = c.value) == null ? void 0 : r.text) ?? n.t("confirm");
75
+ });
76
+ let T = 0, C = !1;
77
+ const B = (r) => {
78
+ o.value = r.title, l.value = r.text, u.value = r.cancel, c.value = r.confirm, T = r.seq, C = !1, e.value = !0;
79
+ };
80
+ W(() => {
81
+ s.on("confirmDlg", B);
82
+ }), L(() => {
83
+ s.off("confirmDlg", B);
84
+ });
85
+ const E = () => {
86
+ e.value = !1, C || (s.emit("confirmDlgResult" + T, !0), C = !0);
87
+ };
88
+ return O(e, (r) => {
89
+ !r && !C && (s.emit("confirmDlgResult" + T, !1), C = !0);
90
+ }), (r, y) => {
91
+ const k = m("v-card-title"), U = m("v-card-text"), $ = m("v-btn"), a = m("v-card-actions"), x = m("v-card"), N = m("v-dialog");
92
+ return V(), M(N, {
93
+ modelValue: e.value,
94
+ "onUpdate:modelValue": y[1] || (y[1] = (q) => e.value = q),
95
+ onKeydown: [
96
+ y[2] || (y[2] = j(R((q) => e.value = !1, ["stop", "prevent"]), ["esc"])),
97
+ j(R(E, ["stop", "prevent"]), ["enter"])
98
+ ],
99
+ transition: "dialog-top-transition",
100
+ "max-width": "600px"
101
+ }, {
102
+ default: p(() => [
103
+ g(x, null, {
104
+ default: p(() => [
105
+ g(k, null, {
106
+ default: p(() => [
107
+ h(D(o.value), 1)
108
+ ]),
109
+ _: 1
110
+ }),
111
+ g(U, null, {
112
+ default: p(() => [
113
+ h(D(l.value), 1)
114
+ ]),
115
+ _: 1
116
+ }),
117
+ g(a, { class: "d-flex justify-end" }, {
118
+ default: p(() => [
119
+ g($, {
120
+ onClick: y[0] || (y[0] = (q) => e.value = !1),
121
+ color: i.value,
122
+ variant: "text"
123
+ }, {
124
+ default: p(() => [
125
+ h(D(f.value), 1)
126
+ ]),
127
+ _: 1
128
+ }, 8, ["color"]),
129
+ g($, {
130
+ onClick: E,
131
+ color: d.value,
132
+ variant: "text"
133
+ }, {
134
+ default: p(() => [
135
+ h(D(b.value), 1)
136
+ ]),
137
+ _: 1
138
+ }, 8, ["color"])
139
+ ]),
140
+ _: 1
141
+ })
142
+ ]),
143
+ _: 1
144
+ })
145
+ ]),
146
+ _: 1
147
+ }, 8, ["modelValue", "onKeydown"]);
148
+ };
149
+ }
150
+ }), _e = (t) => (ae("data-v-a8f3d91f"), t = t(), se(), t), ge = /* @__PURE__ */ _e(() => /* @__PURE__ */ v("div", { class: "lds-spinner" }, [
151
+ /* @__PURE__ */ v("div"),
152
+ /* @__PURE__ */ v("div"),
153
+ /* @__PURE__ */ v("div"),
154
+ /* @__PURE__ */ v("div"),
155
+ /* @__PURE__ */ v("div"),
156
+ /* @__PURE__ */ v("div"),
157
+ /* @__PURE__ */ v("div"),
158
+ /* @__PURE__ */ v("div"),
159
+ /* @__PURE__ */ v("div"),
160
+ /* @__PURE__ */ v("div"),
161
+ /* @__PURE__ */ v("div"),
162
+ /* @__PURE__ */ v("div")
163
+ ], -1)), xe = [
164
+ ge
165
+ ], ye = /* @__PURE__ */ I({
166
+ __name: "index",
167
+ props: {
168
+ zIndex: {
169
+ type: Number,
170
+ default: 1
171
+ }
172
+ },
173
+ setup(t) {
174
+ const n = ve(), e = t, o = w(() => ({
175
+ background: n.current.value.dark ? "#1e1e1e" : "#ffffff",
176
+ zIndex: e.zIndex
177
+ }));
178
+ return (l, u) => (V(), K("div", {
179
+ class: "x-cont",
180
+ style: le(o.value)
181
+ }, xe, 4));
182
+ }
183
+ }), H = (t, n) => {
184
+ const e = t.__vccOpts || t;
185
+ for (const [o, l] of n)
186
+ e[o] = l;
187
+ return e;
188
+ }, Te = /* @__PURE__ */ H(ye, [["__scopeId", "data-v-a8f3d91f"]]), we = /* @__PURE__ */ I({
189
+ __name: "item",
190
+ props: {
191
+ id: {
192
+ type: Number,
193
+ required: !0
194
+ },
195
+ type: {
196
+ type: String,
197
+ required: !0
198
+ },
199
+ text: {
200
+ type: String,
201
+ required: !0
202
+ },
203
+ timeout: {
204
+ type: Number,
205
+ default: 5e3
206
+ }
207
+ },
208
+ emits: ["timeout"],
209
+ setup(t, { emit: n }) {
210
+ const e = t, o = _(!0), l = n, u = w(() => {
211
+ let c = "";
212
+ switch (e.type) {
213
+ case "error":
214
+ c = "cancel";
215
+ break;
216
+ case "info":
217
+ c = "info";
218
+ break;
219
+ case "success":
220
+ c = "check-circle";
221
+ break;
222
+ case "warning":
223
+ c = "error";
224
+ break;
225
+ }
226
+ return c;
227
+ });
228
+ return W(() => {
229
+ setTimeout(() => {
230
+ l("timeout", e.id);
231
+ }, e.timeout);
232
+ }), O(o, (c) => {
233
+ c || l("timeout", e.id);
234
+ }), (c, i) => {
235
+ const f = m("v-alert");
236
+ return V(), M(f, {
237
+ modelValue: o.value,
238
+ "onUpdate:modelValue": i[0] || (i[0] = (d) => o.value = d),
239
+ class: "mt-2",
240
+ type: t.type,
241
+ icon: u.value,
242
+ text: t.text,
243
+ "max-width": "90%",
244
+ width: "500px",
245
+ elevation: "1",
246
+ density: "compact",
247
+ closable: ""
248
+ }, null, 8, ["modelValue", "type", "icon", "text"]);
249
+ };
250
+ }
251
+ }), De = /* @__PURE__ */ I({
252
+ __name: "index",
253
+ setup(t) {
254
+ const n = re({ items: [] });
255
+ W(() => {
256
+ s.on("message", e);
257
+ }), L(() => {
258
+ s.off("message", e);
259
+ });
260
+ const e = (i) => {
261
+ u(i.type, i.text, i.timeout);
262
+ }, o = (i) => {
263
+ c(i);
264
+ };
265
+ let l = 0;
266
+ const u = (i, f, d) => {
267
+ const b = l++;
268
+ n.items.push({ id: b, type: i, text: f, timeout: d });
269
+ }, c = (i) => {
270
+ const f = n.items.findIndex((d) => d.id === i);
271
+ f >= 0 && n.items.splice(f, 1);
272
+ };
273
+ return (i, f) => (V(), K("div", {
274
+ onClick: f[0] || (f[0] = R(() => {
275
+ }, ["stop"])),
276
+ class: "x-cont d-flex flex-column-reverse align-center"
277
+ }, [
278
+ (V(!0), K(ce, null, ie(n.items, (d) => (V(), M(we, {
279
+ onTimeout: o,
280
+ id: d.id,
281
+ type: d.type,
282
+ text: d.text,
283
+ timeout: d.timeout,
284
+ key: d.id
285
+ }, null, 8, ["id", "type", "text", "timeout"]))), 128))
286
+ ]));
287
+ }
288
+ }), $e = /* @__PURE__ */ H(De, [["__scopeId", "data-v-70ed4b89"]]), qe = /* @__PURE__ */ I({
289
+ __name: "index",
290
+ props: {
291
+ modelValue: { type: Boolean, required: !0 },
292
+ modelModifiers: {}
293
+ },
294
+ emits: ["update:modelValue"],
295
+ setup(t) {
296
+ const n = z(), e = G(t, "modelValue"), o = _(""), l = _(""), u = _(), c = _(), i = _(), f = _(""), d = _(), b = _(), T = w(() => {
297
+ var a;
298
+ return ((a = d.value) == null ? void 0 : a.color) ?? "primary";
299
+ }), C = w(() => {
300
+ var a;
301
+ return ((a = d.value) == null ? void 0 : a.text) ?? n.t("cancel");
302
+ }), B = w(() => {
303
+ var a;
304
+ return ((a = b.value) == null ? void 0 : a.color) ?? "primary";
305
+ }), E = w(() => {
306
+ var a;
307
+ return ((a = b.value) == null ? void 0 : a.text) ?? n.t("confirm");
308
+ }), r = _();
309
+ let y = 0, k = !1;
310
+ const U = async (a) => {
311
+ var x;
312
+ o.value = a.title, l.value = a.text, u.value = a.label, c.value = a.placeholder, i.value = a.rules, f.value = a.value, d.value = a.cancel, b.value = a.confirm, y = a.seq, k = !1, e.value = !0, await X(() => r.value !== void 0, 1e3), (x = r.value) == null || x.focus();
313
+ };
314
+ W(() => {
315
+ s.on("promptDlg", U);
316
+ }), L(() => {
317
+ s.off("promptDlg", U);
318
+ });
319
+ const $ = () => {
320
+ e.value = !1, k || (s.emit("promptDlgResult" + y, f.value ?? ""), k = !0);
321
+ };
322
+ return O(e, (a) => {
323
+ !a && !k && (s.emit("promptDlgResult" + y, void 0), k = !0);
324
+ }), (a, x) => {
325
+ const N = m("v-card-title"), q = m("v-card-text"), Y = m("v-text-field"), Z = m("v-form"), P = m("v-btn"), ee = m("v-card-actions"), te = m("v-card"), ne = m("v-dialog");
326
+ return V(), M(ne, {
327
+ modelValue: e.value,
328
+ "onUpdate:modelValue": x[2] || (x[2] = (S) => e.value = S),
329
+ onKeydown: [
330
+ x[3] || (x[3] = j(R((S) => e.value = !1, ["stop", "prevent"]), ["esc"])),
331
+ j(R($, ["stop", "prevent"]), ["enter"])
332
+ ],
333
+ transition: "dialog-top-transition",
334
+ "max-width": "600px"
335
+ }, {
336
+ default: p(() => [
337
+ g(te, null, {
338
+ default: p(() => [
339
+ g(N, null, {
340
+ default: p(() => [
341
+ h(D(o.value), 1)
342
+ ]),
343
+ _: 1
344
+ }),
345
+ g(q, null, {
346
+ default: p(() => [
347
+ h(D(l.value), 1)
348
+ ]),
349
+ _: 1
350
+ }),
351
+ g(Z, { class: "mx-3" }, {
352
+ default: p(() => [
353
+ g(Y, {
354
+ modelValue: f.value,
355
+ "onUpdate:modelValue": x[0] || (x[0] = (S) => f.value = S),
356
+ label: u.value,
357
+ placeholder: c.value,
358
+ rules: i.value,
359
+ ref_key: "target",
360
+ ref: r
361
+ }, null, 8, ["modelValue", "label", "placeholder", "rules"])
362
+ ]),
363
+ _: 1
364
+ }),
365
+ g(ee, { class: "d-flex justify-end" }, {
366
+ default: p(() => [
367
+ g(P, {
368
+ onClick: x[1] || (x[1] = (S) => e.value = !1),
369
+ color: T.value,
370
+ variant: "text"
371
+ }, {
372
+ default: p(() => [
373
+ h(D(C.value), 1)
374
+ ]),
375
+ _: 1
376
+ }, 8, ["color"]),
377
+ g(P, {
378
+ onClick: $,
379
+ color: B.value,
380
+ variant: "text"
381
+ }, {
382
+ default: p(() => [
383
+ h(D(E.value), 1)
384
+ ]),
385
+ _: 1
386
+ }, 8, ["color"])
387
+ ]),
388
+ _: 1
389
+ })
390
+ ]),
391
+ _: 1
392
+ })
393
+ ]),
394
+ _: 1
395
+ }, 8, ["modelValue", "onKeydown"]);
396
+ };
397
+ }
398
+ }), he = { class: "mx-auto my-auto" }, Ve = { class: "d-flex align-center justify-center w-100 h-100" }, Se = /* @__PURE__ */ I({
399
+ __name: "index",
400
+ setup(t) {
401
+ const n = z(), e = _(!1), o = () => {
402
+ e.value = !0;
403
+ }, l = () => {
404
+ e.value = !1;
405
+ };
406
+ return W(() => {
407
+ s.on("openWaitDlg", o), s.on("closeWaitDlg", l);
408
+ }), L(() => {
409
+ s.off("openWaitDlg", o), s.off("closeWaitDlg", l);
410
+ }), (u, c) => {
411
+ const i = m("v-card"), f = m("v-dialog");
412
+ return V(), M(f, {
413
+ "model-value": e.value,
414
+ "onUpdate:modelValue": c[0] || (c[0] = (d) => e.value = d),
415
+ persistent: "",
416
+ "no-click-animation": "",
417
+ fullscreen: ""
418
+ }, {
419
+ default: p(() => [
420
+ v("div", he, [
421
+ g(i, {
422
+ width: "300px",
423
+ height: "80px",
424
+ loading: ""
425
+ }, {
426
+ default: p(() => [
427
+ v("div", Ve, [
428
+ v("span", null, D(ue(n).t("waitingResponse")), 1)
429
+ ])
430
+ ]),
431
+ _: 1
432
+ })
433
+ ])
434
+ ]),
435
+ _: 1
436
+ }, 8, ["model-value"]);
437
+ };
438
+ }
439
+ });
440
+ let A = Date.now();
441
+ function J() {
442
+ const t = Date.now();
443
+ return t - A > 500 ? (A = t, !0) : !1;
444
+ }
445
+ let be = 0;
446
+ function Q() {
447
+ return ++be;
448
+ }
449
+ async function Re(t) {
450
+ if (!J())
451
+ return;
452
+ let n = !1, e;
453
+ const o = (u) => {
454
+ e = u, n = !0;
455
+ }, l = Q();
456
+ return s.on("confirmDlgResult" + l, o), s.emit("confirmDlg", { ...t, seq: l }), await X(() => n), s.off("confirmDlgResult" + l, o), e;
457
+ }
458
+ async function We(t) {
459
+ if (!J())
460
+ return;
461
+ let n = !1, e;
462
+ const o = (u) => {
463
+ e = u, n = !0;
464
+ }, l = Q();
465
+ return s.on("promptDlgResult" + l, o), s.emit("promptDlg", { ...t, seq: l }), await X(() => n), s.off("promptDlgResult" + l, o), e;
466
+ }
467
+ function Me() {
468
+ s.emit("openWaitDlg");
469
+ }
470
+ function Be() {
471
+ s.emit("closeWaitDlg");
472
+ }
473
+ function Ee(t, n) {
474
+ s.emit("message", { type: "error", text: t, timeout: n });
475
+ }
476
+ function Ue(t, n) {
477
+ s.emit("message", { type: "info", text: t, timeout: n });
478
+ }
479
+ function je(t, n) {
480
+ s.emit("message", { type: "success", text: t, timeout: n });
481
+ }
482
+ function Le(t, n) {
483
+ s.emit("message", { type: "warning", text: t, timeout: n });
484
+ }
485
+ function Ne(t) {
486
+ var o, l;
487
+ if (!window.appAppear) {
488
+ window.appAppear = !0;
489
+ return;
490
+ }
491
+ const n = "single-spa-application:" + t, e = (o = document.getElementById(n)) == null ? void 0 : o.classList;
492
+ e && (e.remove("app-left", "app-right", "app-reset"), (l = window.routeExtras) != null && l.forward ? e.add("app-left") : e.add("app-right"), setTimeout(() => {
493
+ e.add("app-reset");
494
+ }, 0));
495
+ }
496
+ export {
497
+ Ie as XConfirmDlg,
498
+ Te as XLoading,
499
+ $e as XMessage,
500
+ qe as XPromptDlg,
501
+ Se as XWaitDlg,
502
+ Ne as appAppear,
503
+ Be as closeWaitDlg,
504
+ Ee as messageError,
505
+ Ue as messageInfo,
506
+ je as messageSuccess,
507
+ Le as messageWarning,
508
+ Re as openConfirmDlg,
509
+ We as openPromptDlg,
510
+ Me as openWaitDlg,
511
+ ke as waitMs,
512
+ X as waitUtil
513
+ };
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "type": "module",
6
- "module": "dist/index.es.js",
7
- "types": "types/index.d.ts",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
8
  "files": [
9
- "dist",
10
- "types/**/*.d.ts"
9
+ "dist"
11
10
  ],
12
11
  "scripts": {
13
12
  "dev": "vite",
@@ -22,6 +21,13 @@
22
21
  "*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix",
23
22
  "*": "prettier --write ."
24
23
  },
24
+ "dependencies": {
25
+ "mitt": "^3.0.1"
26
+ },
27
+ "peerDependencies": {
28
+ "vue": "^3.4.23",
29
+ "vuetify": "^3.5.16"
30
+ },
25
31
  "devDependencies": {
26
32
  "@rushstack/eslint-patch": "^1.8.0",
27
33
  "@types/node": "^20.12.2",
@@ -32,14 +38,12 @@
32
38
  "eslint-plugin-vue": "^9.24.1",
33
39
  "husky": "^9.0.11",
34
40
  "lint-staged": "^15.2.2",
35
- "mitt": "^3.0.1",
36
41
  "prettier": "3.2.5",
42
+ "rollup-plugin-copy": "^3.5.0",
37
43
  "sass": "^1.74.1",
38
44
  "typescript": "^5.2.2",
39
45
  "vite": "^5.2.0",
40
46
  "vite-plugin-css-injected-by-js": "^3.5.0",
41
- "vite-plugin-vuetify": "^2.0.3",
42
- "vue": "^3.4.23",
43
47
  "vue-tsc": "^2.0.6"
44
48
  }
45
49
  }
package/dist/index.es.js DELETED
@@ -1,36 +0,0 @@
1
- function o(i) {
2
- return { all: i = i || /* @__PURE__ */ new Map(), on: function(t, n) {
3
- var e = i.get(t);
4
- e ? e.push(n) : i.set(t, [n]);
5
- }, off: function(t, n) {
6
- var e = i.get(t);
7
- e && (n ? e.splice(e.indexOf(n) >>> 0, 1) : i.set(t, []));
8
- }, emit: function(t, n) {
9
- var e = i.get(t);
10
- e && e.slice().map(function(s) {
11
- s(n);
12
- }), (e = i.get("*")) && e.slice().map(function(s) {
13
- s(t, n);
14
- });
15
- } };
16
- }
17
- const a = o();
18
- async function u(i) {
19
- return new Promise((t) => {
20
- setTimeout(t, i);
21
- });
22
- }
23
- async function f(i, t, n) {
24
- const e = Date.now();
25
- return new Promise((s) => {
26
- const c = async () => {
27
- i() ? s(!0) : t && Date.now() - e > t ? s(!1) : setTimeout(c, n ?? 30);
28
- };
29
- c();
30
- });
31
- }
32
- export {
33
- a as eventBus,
34
- u as waitMs,
35
- f as waitUtil
36
- };
package/types/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { eventBus, waitMs, waitUtil } from './utils/core';
2
- export { eventBus, waitMs, waitUtil };
@@ -1,3 +0,0 @@
1
- export declare const eventBus: import("mitt").Emitter<Record<import("mitt").EventType, unknown>>;
2
- export declare function waitMs(ms: number): Promise<void>;
3
- export declare function waitUtil(conditionFunc: () => boolean, timeout?: number, interval?: number): Promise<boolean>;