x-essential-lib 0.1.2 → 0.1.4

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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DefineComponent } from 'vue'
1
+ import { DefineComponent, ComputedRef, Ref } from 'vue'
2
2
 
3
3
  export declare const XConfirmDlg: DefineComponent<
4
4
  {
@@ -7,7 +7,7 @@ export declare const XConfirmDlg: DefineComponent<
7
7
  required: true
8
8
  }
9
9
  },
10
- {
10
+ {
11
11
  'update:modelValue'(value: boolean): void
12
12
  },
13
13
  unknown
@@ -41,6 +41,23 @@ export declare const XPromptDlg: DefineComponent<
41
41
 
42
42
  export declare const XMessage: DefineComponent<{}, {}, unknown>
43
43
 
44
+ export declare function useColor(): {
45
+ primaryColor: ComputedRef<string>
46
+ secondaryColor: ComputedRef<string>
47
+ backgroundColor0: ComputedRef<string>
48
+ backgroundColor1: ComputedRef<string>
49
+ backgroundColor2: ComputedRef<string>
50
+ highlightColor: ComputedRef<string>
51
+ borderColor: ComputedRef<string>
52
+ }
53
+
54
+ export declare function useSystem(): {
55
+ dark: ComputedRef<boolean>
56
+ routeTransName: Ref<string>
57
+ sysBarAvail: ComputedRef<boolean>
58
+ compactWidth: ComputedRef<string>
59
+ }
60
+
44
61
  export declare function waitMs(ms: number): Promise<void>
45
62
 
46
63
  export declare function waitUtil(
package/dist/index.js CHANGED
@@ -1,138 +1,171 @@
1
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);
2
+ import { getCurrentInstance as ae, inject as A, computed as d, defineComponent as I, useModel as H, ref as g, onMounted as W, onBeforeUnmount as U, watch as O, resolveComponent as p, openBlock as k, createBlock as M, withKeys as L, withModifiers as R, withCtx as v, createVNode as y, createTextVNode as h, toDisplayString as b, createElementBlock as z, normalizeStyle as se, pushScopeId as ue, popScopeId as ce, createElementVNode as _, reactive as ie, Fragment as de, renderList as fe, unref as me } from "vue";
3
+ function pe(e) {
4
+ return { all: e = e || /* @__PURE__ */ new Map(), on: function(n, t) {
5
+ var o = e.get(n);
6
+ o ? o.push(t) : e.set(n, [t]);
7
+ }, off: function(n, t) {
8
+ var o = e.get(n);
9
+ o && (t ? o.splice(o.indexOf(t) >>> 0, 1) : e.set(n, []));
10
+ }, emit: function(n, t) {
11
+ var o = e.get(n);
12
12
  o && o.slice().map(function(l) {
13
- l(e);
14
- }), (o = t.get("*")) && o.slice().map(function(l) {
15
- l(n, e);
13
+ l(t);
14
+ }), (o = e.get("*")) && o.slice().map(function(l) {
15
+ l(n, t);
16
16
  });
17
17
  } };
18
18
  }
19
- const s = de();
20
- async function ke(t) {
19
+ const a = pe();
20
+ async function Te(e) {
21
21
  return new Promise((n) => {
22
- setTimeout(n, t);
22
+ setTimeout(n, e);
23
23
  });
24
24
  }
25
- async function X(t, n, e) {
25
+ async function X(e, n, t) {
26
26
  const o = Date.now();
27
27
  return new Promise((l) => {
28
- const u = async () => {
29
- t() ? l(!0) : n && Date.now() - o > n ? l(!1) : setTimeout(u, e ?? 30);
28
+ const s = async () => {
29
+ e() ? l(!0) : n && Date.now() - o > n ? l(!1) : setTimeout(s, t ?? 30);
30
30
  };
31
- u();
31
+ s();
32
32
  });
33
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;
34
+ function B() {
35
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
36
+ if (B.cache.has(e))
37
+ return B.cache.get(e);
38
+ const n = e.replace(/[^a-z]/gi, "-").replace(/\B([A-Z])/g, "-$1").toLowerCase();
39
+ return B.cache.set(e, n), n;
39
40
  }
40
- const me = Symbol.for("vuetify:locale");
41
- function z() {
42
- const t = F(me);
41
+ B.cache = /* @__PURE__ */ new Map();
42
+ function J(e, n) {
43
+ const t = ae();
43
44
  if (!t)
44
- throw new Error("[Vuetify] Could not find injected locale instance");
45
+ throw new Error(`[Vuetify] ${e} must be called from inside a setup function`);
45
46
  return t;
46
47
  }
47
- const pe = Symbol.for("vuetify:theme");
48
48
  function ve() {
49
- fe("useTheme");
50
- const t = F(pe, null);
49
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "composables";
50
+ const n = J(e).type;
51
+ return B((n == null ? void 0 : n.aliasName) || (n == null ? void 0 : n.name));
52
+ }
53
+ const _e = Symbol.for("vuetify:locale");
54
+ function P() {
55
+ const e = A(_e);
56
+ if (!e)
57
+ throw new Error("[Vuetify] Could not find injected locale instance");
58
+ return e;
59
+ }
60
+ const ge = Symbol.for("vuetify:display");
61
+ function ye() {
62
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ve();
63
+ const t = A(ge);
51
64
  if (!t)
65
+ throw new Error("Could not find Vuetify display injection");
66
+ const o = d(() => {
67
+ if (!e.mobileBreakpoint)
68
+ return t.mobile.value;
69
+ const s = typeof e.mobileBreakpoint == "number" ? e.mobileBreakpoint : t.thresholds.value[e.mobileBreakpoint];
70
+ return t.width.value < s;
71
+ }), l = d(() => n ? {
72
+ [`${n}--mobile`]: o.value
73
+ } : {});
74
+ return {
75
+ ...t,
76
+ displayClasses: l,
77
+ mobile: o
78
+ };
79
+ }
80
+ const xe = Symbol.for("vuetify:theme");
81
+ function F() {
82
+ J("useTheme");
83
+ const e = A(xe, null);
84
+ if (!e)
52
85
  throw new Error("Could not find Vuetify theme injection");
53
- return t;
86
+ return e;
54
87
  }
55
- const Ie = /* @__PURE__ */ I({
88
+ const qe = /* @__PURE__ */ I({
56
89
  __name: "index",
57
90
  props: {
58
91
  modelValue: { type: Boolean, required: !0 },
59
92
  modelModifiers: {}
60
93
  },
61
94
  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");
95
+ setup(e) {
96
+ const n = P(), t = H(e, "modelValue"), o = g(""), l = g(""), s = g(), c = g(), i = d(() => {
97
+ var u;
98
+ return ((u = s.value) == null ? void 0 : u.color) ?? "primary";
99
+ }), m = d(() => {
100
+ var u;
101
+ return ((u = s.value) == null ? void 0 : u.text) ?? n.t("cancel");
102
+ }), f = d(() => {
103
+ var u;
104
+ return ((u = c.value) == null ? void 0 : u.color) ?? "primary";
105
+ }), C = d(() => {
106
+ var u;
107
+ return ((u = c.value) == null ? void 0 : u.text) ?? n.t("confirm");
75
108
  });
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;
109
+ let $ = 0, D = !1;
110
+ const E = (u) => {
111
+ o.value = u.title, l.value = u.text, s.value = u.cancel, c.value = u.confirm, $ = u.seq, D = !1, t.value = !0;
79
112
  };
80
113
  W(() => {
81
- s.on("confirmDlg", B);
82
- }), L(() => {
83
- s.off("confirmDlg", B);
114
+ a.on("confirmDlg", E);
115
+ }), U(() => {
116
+ a.off("confirmDlg", E);
84
117
  });
85
- const E = () => {
86
- e.value = !1, C || (s.emit("confirmDlgResult" + T, !0), C = !0);
118
+ const N = () => {
119
+ t.value = !1, D || (a.emit("confirmDlgResult" + $, !0), D = !0);
87
120
  };
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),
121
+ return O(t, (u) => {
122
+ !u && !D && (a.emit("confirmDlgResult" + $, !1), D = !0);
123
+ }), (u, w) => {
124
+ const V = p("v-card-title"), j = p("v-card-text"), S = p("v-btn"), r = p("v-card-actions"), x = p("v-card"), K = p("v-dialog");
125
+ return k(), M(K, {
126
+ modelValue: t.value,
127
+ "onUpdate:modelValue": w[1] || (w[1] = (T) => t.value = T),
95
128
  onKeydown: [
96
- y[2] || (y[2] = j(R((q) => e.value = !1, ["stop", "prevent"]), ["esc"])),
97
- j(R(E, ["stop", "prevent"]), ["enter"])
129
+ w[2] || (w[2] = L(R((T) => t.value = !1, ["stop", "prevent"]), ["esc"])),
130
+ L(R(N, ["stop", "prevent"]), ["enter"])
98
131
  ],
99
132
  transition: "dialog-top-transition",
100
133
  "max-width": "600px"
101
134
  }, {
102
- default: p(() => [
103
- g(x, null, {
104
- default: p(() => [
105
- g(k, null, {
106
- default: p(() => [
107
- h(D(o.value), 1)
135
+ default: v(() => [
136
+ y(x, null, {
137
+ default: v(() => [
138
+ y(V, null, {
139
+ default: v(() => [
140
+ h(b(o.value), 1)
108
141
  ]),
109
142
  _: 1
110
143
  }),
111
- g(U, null, {
112
- default: p(() => [
113
- h(D(l.value), 1)
144
+ y(j, null, {
145
+ default: v(() => [
146
+ h(b(l.value), 1)
114
147
  ]),
115
148
  _: 1
116
149
  }),
117
- g(a, { class: "d-flex justify-end" }, {
118
- default: p(() => [
119
- g($, {
120
- onClick: y[0] || (y[0] = (q) => e.value = !1),
150
+ y(r, { class: "d-flex justify-end" }, {
151
+ default: v(() => [
152
+ y(S, {
153
+ onClick: w[0] || (w[0] = (T) => t.value = !1),
121
154
  color: i.value,
122
155
  variant: "text"
123
156
  }, {
124
- default: p(() => [
125
- h(D(f.value), 1)
157
+ default: v(() => [
158
+ h(b(m.value), 1)
126
159
  ]),
127
160
  _: 1
128
161
  }, 8, ["color"]),
129
- g($, {
130
- onClick: E,
131
- color: d.value,
162
+ y(S, {
163
+ onClick: N,
164
+ color: f.value,
132
165
  variant: "text"
133
166
  }, {
134
- default: p(() => [
135
- h(D(b.value), 1)
167
+ default: v(() => [
168
+ h(b(C.value), 1)
136
169
  ]),
137
170
  _: 1
138
171
  }, 8, ["color"])
@@ -147,22 +180,22 @@ const Ie = /* @__PURE__ */ I({
147
180
  }, 8, ["modelValue", "onKeydown"]);
148
181
  };
149
182
  }
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({
183
+ }), we = (e) => (ue("data-v-a8f3d91f"), e = e(), ce(), e), be = /* @__PURE__ */ we(() => /* @__PURE__ */ _("div", { class: "lds-spinner" }, [
184
+ /* @__PURE__ */ _("div"),
185
+ /* @__PURE__ */ _("div"),
186
+ /* @__PURE__ */ _("div"),
187
+ /* @__PURE__ */ _("div"),
188
+ /* @__PURE__ */ _("div"),
189
+ /* @__PURE__ */ _("div"),
190
+ /* @__PURE__ */ _("div"),
191
+ /* @__PURE__ */ _("div"),
192
+ /* @__PURE__ */ _("div"),
193
+ /* @__PURE__ */ _("div"),
194
+ /* @__PURE__ */ _("div"),
195
+ /* @__PURE__ */ _("div")
196
+ ], -1)), he = [
197
+ be
198
+ ], ke = /* @__PURE__ */ I({
166
199
  __name: "index",
167
200
  props: {
168
201
  zIndex: {
@@ -170,22 +203,22 @@ const Ie = /* @__PURE__ */ I({
170
203
  default: 1
171
204
  }
172
205
  },
173
- setup(t) {
174
- const n = ve(), e = t, o = w(() => ({
206
+ setup(e) {
207
+ const n = F(), t = e, o = d(() => ({
175
208
  background: n.current.value.dark ? "#1e1e1e" : "#ffffff",
176
- zIndex: e.zIndex
209
+ zIndex: t.zIndex
177
210
  }));
178
- return (l, u) => (V(), K("div", {
211
+ return (l, s) => (k(), z("div", {
179
212
  class: "x-cont",
180
- style: le(o.value)
181
- }, xe, 4));
213
+ style: se(o.value)
214
+ }, he, 4));
182
215
  }
183
- }), H = (t, n) => {
184
- const e = t.__vccOpts || t;
216
+ }), Q = (e, n) => {
217
+ const t = e.__vccOpts || e;
185
218
  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({
219
+ t[o] = l;
220
+ return t;
221
+ }, Be = /* @__PURE__ */ Q(ke, [["__scopeId", "data-v-a8f3d91f"]]), Ce = /* @__PURE__ */ I({
189
222
  __name: "item",
190
223
  props: {
191
224
  id: {
@@ -206,10 +239,10 @@ const Ie = /* @__PURE__ */ I({
206
239
  }
207
240
  },
208
241
  emits: ["timeout"],
209
- setup(t, { emit: n }) {
210
- const e = t, o = _(!0), l = n, u = w(() => {
242
+ setup(e, { emit: n }) {
243
+ const t = e, o = g(!0), l = n, s = d(() => {
211
244
  let c = "";
212
- switch (e.type) {
245
+ switch (t.type) {
213
246
  case "error":
214
247
  c = "cancel";
215
248
  break;
@@ -227,19 +260,19 @@ const Ie = /* @__PURE__ */ I({
227
260
  });
228
261
  return W(() => {
229
262
  setTimeout(() => {
230
- l("timeout", e.id);
231
- }, e.timeout);
263
+ l("timeout", t.id);
264
+ }, t.timeout);
232
265
  }), O(o, (c) => {
233
- c || l("timeout", e.id);
266
+ c || l("timeout", t.id);
234
267
  }), (c, i) => {
235
- const f = m("v-alert");
236
- return V(), M(f, {
268
+ const m = p("v-alert");
269
+ return k(), M(m, {
237
270
  modelValue: o.value,
238
- "onUpdate:modelValue": i[0] || (i[0] = (d) => o.value = d),
271
+ "onUpdate:modelValue": i[0] || (i[0] = (f) => o.value = f),
239
272
  class: "mt-2",
240
- type: t.type,
241
- icon: u.value,
242
- text: t.text,
273
+ type: e.type,
274
+ icon: s.value,
275
+ text: e.text,
243
276
  "max-width": "90%",
244
277
  width: "500px",
245
278
  elevation: "1",
@@ -250,137 +283,137 @@ const Ie = /* @__PURE__ */ I({
250
283
  }
251
284
  }), De = /* @__PURE__ */ I({
252
285
  __name: "index",
253
- setup(t) {
254
- const n = re({ items: [] });
286
+ setup(e) {
287
+ const n = ie({ items: [] });
255
288
  W(() => {
256
- s.on("message", e);
257
- }), L(() => {
258
- s.off("message", e);
289
+ a.on("message", t);
290
+ }), U(() => {
291
+ a.off("message", t);
259
292
  });
260
- const e = (i) => {
261
- u(i.type, i.text, i.timeout);
293
+ const t = (i) => {
294
+ s(i.type, i.text, i.timeout);
262
295
  }, o = (i) => {
263
296
  c(i);
264
297
  };
265
298
  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 });
299
+ const s = (i, m, f) => {
300
+ const C = l++;
301
+ n.items.push({ id: C, type: i, text: m, timeout: f });
269
302
  }, c = (i) => {
270
- const f = n.items.findIndex((d) => d.id === i);
271
- f >= 0 && n.items.splice(f, 1);
303
+ const m = n.items.findIndex((f) => f.id === i);
304
+ m >= 0 && n.items.splice(m, 1);
272
305
  };
273
- return (i, f) => (V(), K("div", {
274
- onClick: f[0] || (f[0] = R(() => {
306
+ return (i, m) => (k(), z("div", {
307
+ onClick: m[0] || (m[0] = R(() => {
275
308
  }, ["stop"])),
276
309
  class: "x-cont d-flex flex-column-reverse align-center"
277
310
  }, [
278
- (V(!0), K(ce, null, ie(n.items, (d) => (V(), M(we, {
311
+ (k(!0), z(de, null, fe(n.items, (f) => (k(), M(Ce, {
279
312
  onTimeout: o,
280
- id: d.id,
281
- type: d.type,
282
- text: d.text,
283
- timeout: d.timeout,
284
- key: d.id
313
+ id: f.id,
314
+ type: f.type,
315
+ text: f.text,
316
+ timeout: f.timeout,
317
+ key: f.id
285
318
  }, null, 8, ["id", "type", "text", "timeout"]))), 128))
286
319
  ]));
287
320
  }
288
- }), $e = /* @__PURE__ */ H(De, [["__scopeId", "data-v-70ed4b89"]]), qe = /* @__PURE__ */ I({
321
+ }), Re = /* @__PURE__ */ Q(De, [["__scopeId", "data-v-70ed4b89"]]), We = /* @__PURE__ */ I({
289
322
  __name: "index",
290
323
  props: {
291
324
  modelValue: { type: Boolean, required: !0 },
292
325
  modelModifiers: {}
293
326
  },
294
327
  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) => {
328
+ setup(e) {
329
+ const n = P(), t = H(e, "modelValue"), o = g(""), l = g(""), s = g(), c = g(), i = g(), m = g(""), f = g(), C = g(), $ = d(() => {
330
+ var r;
331
+ return ((r = f.value) == null ? void 0 : r.color) ?? "primary";
332
+ }), D = d(() => {
333
+ var r;
334
+ return ((r = f.value) == null ? void 0 : r.text) ?? n.t("cancel");
335
+ }), E = d(() => {
336
+ var r;
337
+ return ((r = C.value) == null ? void 0 : r.color) ?? "primary";
338
+ }), N = d(() => {
339
+ var r;
340
+ return ((r = C.value) == null ? void 0 : r.text) ?? n.t("confirm");
341
+ }), u = g();
342
+ let w = 0, V = !1;
343
+ const j = async (r) => {
311
344
  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();
345
+ o.value = r.title, l.value = r.text, s.value = r.label, c.value = r.placeholder, i.value = r.rules, m.value = r.value, f.value = r.cancel, C.value = r.confirm, w = r.seq, V = !1, t.value = !0, await X(() => u.value !== void 0, 1e3), (x = u.value) == null || x.focus();
313
346
  };
314
347
  W(() => {
315
- s.on("promptDlg", U);
316
- }), L(() => {
317
- s.off("promptDlg", U);
348
+ a.on("promptDlg", j);
349
+ }), U(() => {
350
+ a.off("promptDlg", j);
318
351
  });
319
- const $ = () => {
320
- e.value = !1, k || (s.emit("promptDlgResult" + y, f.value ?? ""), k = !0);
352
+ const S = () => {
353
+ t.value = !1, V || (a.emit("promptDlgResult" + w, m.value ?? ""), V = !0);
321
354
  };
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),
355
+ return O(t, (r) => {
356
+ !r && !V && (a.emit("promptDlgResult" + w, void 0), V = !0);
357
+ }), (r, x) => {
358
+ const K = p("v-card-title"), T = p("v-card-text"), te = p("v-text-field"), ne = p("v-form"), Z = p("v-btn"), oe = p("v-card-actions"), le = p("v-card"), re = p("v-dialog");
359
+ return k(), M(re, {
360
+ modelValue: t.value,
361
+ "onUpdate:modelValue": x[2] || (x[2] = (q) => t.value = q),
329
362
  onKeydown: [
330
- x[3] || (x[3] = j(R((S) => e.value = !1, ["stop", "prevent"]), ["esc"])),
331
- j(R($, ["stop", "prevent"]), ["enter"])
363
+ x[3] || (x[3] = L(R((q) => t.value = !1, ["stop", "prevent"]), ["esc"])),
364
+ L(R(S, ["stop", "prevent"]), ["enter"])
332
365
  ],
333
366
  transition: "dialog-top-transition",
334
367
  "max-width": "600px"
335
368
  }, {
336
- default: p(() => [
337
- g(te, null, {
338
- default: p(() => [
339
- g(N, null, {
340
- default: p(() => [
341
- h(D(o.value), 1)
369
+ default: v(() => [
370
+ y(le, null, {
371
+ default: v(() => [
372
+ y(K, null, {
373
+ default: v(() => [
374
+ h(b(o.value), 1)
342
375
  ]),
343
376
  _: 1
344
377
  }),
345
- g(q, null, {
346
- default: p(() => [
347
- h(D(l.value), 1)
378
+ y(T, null, {
379
+ default: v(() => [
380
+ h(b(l.value), 1)
348
381
  ]),
349
382
  _: 1
350
383
  }),
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,
384
+ y(ne, { class: "mx-3" }, {
385
+ default: v(() => [
386
+ y(te, {
387
+ modelValue: m.value,
388
+ "onUpdate:modelValue": x[0] || (x[0] = (q) => m.value = q),
389
+ label: s.value,
357
390
  placeholder: c.value,
358
391
  rules: i.value,
359
392
  ref_key: "target",
360
- ref: r
393
+ ref: u
361
394
  }, null, 8, ["modelValue", "label", "placeholder", "rules"])
362
395
  ]),
363
396
  _: 1
364
397
  }),
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,
398
+ y(oe, { class: "d-flex justify-end" }, {
399
+ default: v(() => [
400
+ y(Z, {
401
+ onClick: x[1] || (x[1] = (q) => t.value = !1),
402
+ color: $.value,
370
403
  variant: "text"
371
404
  }, {
372
- default: p(() => [
373
- h(D(C.value), 1)
405
+ default: v(() => [
406
+ h(b(D.value), 1)
374
407
  ]),
375
408
  _: 1
376
409
  }, 8, ["color"]),
377
- g(P, {
378
- onClick: $,
379
- color: B.value,
410
+ y(Z, {
411
+ onClick: S,
412
+ color: E.value,
380
413
  variant: "text"
381
414
  }, {
382
- default: p(() => [
383
- h(D(E.value), 1)
415
+ default: v(() => [
416
+ h(b(N.value), 1)
384
417
  ]),
385
418
  _: 1
386
419
  }, 8, ["color"])
@@ -395,37 +428,37 @@ const Ie = /* @__PURE__ */ I({
395
428
  }, 8, ["modelValue", "onKeydown"]);
396
429
  };
397
430
  }
398
- }), he = { class: "mx-auto my-auto" }, Ve = { class: "d-flex align-center justify-center w-100 h-100" }, Se = /* @__PURE__ */ I({
431
+ }), Ve = { class: "mx-auto my-auto" }, Ie = { class: "d-flex align-center justify-center w-100 h-100" }, Me = /* @__PURE__ */ I({
399
432
  __name: "index",
400
- setup(t) {
401
- const n = z(), e = _(!1), o = () => {
402
- e.value = !0;
433
+ setup(e) {
434
+ const n = P(), t = g(!1), o = () => {
435
+ t.value = !0;
403
436
  }, l = () => {
404
- e.value = !1;
437
+ t.value = !1;
405
438
  };
406
439
  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),
440
+ a.on("openWaitDlg", o), a.on("closeWaitDlg", l);
441
+ }), U(() => {
442
+ a.off("openWaitDlg", o), a.off("closeWaitDlg", l);
443
+ }), (s, c) => {
444
+ const i = p("v-card"), m = p("v-dialog");
445
+ return k(), M(m, {
446
+ "model-value": t.value,
447
+ "onUpdate:modelValue": c[0] || (c[0] = (f) => t.value = f),
415
448
  persistent: "",
416
449
  "no-click-animation": "",
417
450
  fullscreen: ""
418
451
  }, {
419
- default: p(() => [
420
- v("div", he, [
421
- g(i, {
452
+ default: v(() => [
453
+ _("div", Ve, [
454
+ y(i, {
422
455
  width: "300px",
423
456
  height: "80px",
424
457
  loading: ""
425
458
  }, {
426
- default: p(() => [
427
- v("div", Ve, [
428
- v("span", null, D(ue(n).t("waitingResponse")), 1)
459
+ default: v(() => [
460
+ _("div", Ie, [
461
+ _("span", null, b(me(n).t("waitingResponse")), 1)
429
462
  ])
430
463
  ]),
431
464
  _: 1
@@ -437,77 +470,95 @@ const Ie = /* @__PURE__ */ I({
437
470
  };
438
471
  }
439
472
  });
440
- let A = Date.now();
441
- function J() {
442
- const t = Date.now();
443
- return t - A > 500 ? (A = t, !0) : !1;
473
+ function Ee() {
474
+ const e = F(), n = d(() => e.global.current.value.colors.primary), t = d(() => e.global.current.value.colors.secondary), o = d(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), l = d(() => e.current.value.dark ? "#272727" : "#eeeeee"), s = d(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), c = d(() => e.current.value.dark ? "#303030" : "#f6f6f6"), i = d(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
475
+ return {
476
+ primaryColor: n,
477
+ secondaryColor: t,
478
+ backgroundColor0: o,
479
+ backgroundColor1: l,
480
+ backgroundColor2: s,
481
+ highlightColor: c,
482
+ borderColor: i
483
+ };
484
+ }
485
+ function Ne() {
486
+ const e = F(), { width: n } = ye(), t = d(() => e.current.value.dark), o = g(""), l = d(() => !!window.cordova), s = d(() => n.value <= 1280 ? n.value + "px" : n.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
487
+ return { dark: t, routeTransName: o, sysBarAvail: l, compactWidth: s };
488
+ }
489
+ let G = Date.now();
490
+ function Y() {
491
+ const e = Date.now();
492
+ return e - G > 500 ? (G = e, !0) : !1;
444
493
  }
445
- let be = 0;
446
- function Q() {
447
- return ++be;
494
+ let $e = 0;
495
+ function ee() {
496
+ return ++$e;
448
497
  }
449
- async function Re(t) {
450
- if (!J())
498
+ async function je(e) {
499
+ if (!Y())
451
500
  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;
501
+ let n = !1, t;
502
+ const o = (s) => {
503
+ t = s, n = !0;
504
+ }, l = ee();
505
+ return a.on("confirmDlgResult" + l, o), a.emit("confirmDlg", { ...e, seq: l }), await X(() => n), a.off("confirmDlgResult" + l, o), t;
457
506
  }
458
- async function We(t) {
459
- if (!J())
507
+ async function Le(e) {
508
+ if (!Y())
460
509
  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;
510
+ let n = !1, t;
511
+ const o = (s) => {
512
+ t = s, n = !0;
513
+ }, l = ee();
514
+ return a.on("promptDlgResult" + l, o), a.emit("promptDlg", { ...e, seq: l }), await X(() => n), a.off("promptDlgResult" + l, o), t;
466
515
  }
467
- function Me() {
468
- s.emit("openWaitDlg");
516
+ function Ue() {
517
+ a.emit("openWaitDlg");
469
518
  }
470
- function Be() {
471
- s.emit("closeWaitDlg");
519
+ function Ke() {
520
+ a.emit("closeWaitDlg");
472
521
  }
473
- function Ee(t, n) {
474
- s.emit("message", { type: "error", text: t, timeout: n });
522
+ function ze(e, n) {
523
+ a.emit("message", { type: "error", text: e, timeout: n });
475
524
  }
476
- function Ue(t, n) {
477
- s.emit("message", { type: "info", text: t, timeout: n });
525
+ function Ae(e, n) {
526
+ a.emit("message", { type: "info", text: e, timeout: n });
478
527
  }
479
- function je(t, n) {
480
- s.emit("message", { type: "success", text: t, timeout: n });
528
+ function Oe(e, n) {
529
+ a.emit("message", { type: "success", text: e, timeout: n });
481
530
  }
482
- function Le(t, n) {
483
- s.emit("message", { type: "warning", text: t, timeout: n });
531
+ function Xe(e, n) {
532
+ a.emit("message", { type: "warning", text: e, timeout: n });
484
533
  }
485
- function Ne(t) {
534
+ function Pe(e) {
486
535
  var o, l;
487
536
  if (!window.appAppear) {
488
537
  window.appAppear = !0;
489
538
  return;
490
539
  }
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");
540
+ const n = "single-spa-application:" + e, t = (o = document.getElementById(n)) == null ? void 0 : o.classList;
541
+ t && (t.remove("app-left", "app-right", "app-reset"), (l = window.routeExtras) != null && l.forward ? t.add("app-left") : t.add("app-right"), setTimeout(() => {
542
+ t.add("app-reset");
494
543
  }, 0));
495
544
  }
496
545
  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,
546
+ qe as XConfirmDlg,
547
+ Be as XLoading,
548
+ Re as XMessage,
549
+ We as XPromptDlg,
550
+ Me as XWaitDlg,
551
+ Pe as appAppear,
552
+ Ke as closeWaitDlg,
553
+ ze as messageError,
554
+ Ae as messageInfo,
555
+ Oe as messageSuccess,
556
+ Xe as messageWarning,
557
+ je as openConfirmDlg,
558
+ Le as openPromptDlg,
559
+ Ue as openWaitDlg,
560
+ Ee as useColor,
561
+ Ne as useSystem,
562
+ Te as waitMs,
512
563
  X as waitUtil
513
564
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",