x-essential-lib 0.2.14 → 0.3.1

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 @@
1
+ export declare function useHotkey(): {};
@@ -1,3 +1,4 @@
1
1
  export * from './color';
2
+ export * from './hotkey';
2
3
  export * from './system';
3
4
  export * from './viewStack';
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.inner-left-enter-active,.inner-right-enter-active{transition:transform .35s ease}.inner-left-enter-from{transform:translate(-100%)}.inner-right-enter-from{transform:translate(100%)}.inner-left-enter-to,.inner-right-enter-to{transform:translate(0)}.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(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- import { VAlert as ge, VBtn as _e, VCard as he, VCardActions as xe, VCardText as we, VCardTitle as ye, VDialog as be, VForm as ke, VTextField as Ce } from "vuetify/lib/components/index.mjs";
3
- import { ref as f, computed as d, onMounted as D, onBeforeUnmount as A, defineComponent as R, watch as P, resolveComponent as v, openBlock as C, createBlock as E, unref as z, isRef as X, withKeys as K, withModifiers as $, withCtx as g, createVNode as h, createTextVNode as k, toDisplayString as b, createElementBlock as H, normalizeStyle as Ve, pushScopeId as qe, popScopeId as Se, createElementVNode as _, reactive as De, Fragment as Re, renderList as Oe, inject as Ie } from "vue";
4
- import { useLocale as F, useTheme as L, useDisplay as Te } from "vuetify/lib/framework.mjs";
5
- import { defineStore as le } from "pinia";
6
- import { useI18n as je } from "vue-i18n";
7
- import Pe from "axios";
8
- const $e = le("viewMgr", () => {
2
+ import { VAlert as we, VBtn as ye, VCard as ke, VCardActions as be, VCardText as Ce, VCardTitle as Ve, VDialog as De, VForm as Se, VTextField as qe } from "vuetify/lib/components/index.mjs";
3
+ import { ref as f, computed as d, onMounted as q, onBeforeUnmount as R, defineComponent as O, watch as P, resolveComponent as v, openBlock as C, createBlock as $, unref as K, isRef as X, withKeys as L, withModifiers as M, withCtx as g, createVNode as h, createTextVNode as b, toDisplayString as k, createElementBlock as H, normalizeStyle as Re, pushScopeId as Oe, popScopeId as Ee, createElementVNode as _, reactive as Ie, Fragment as Te, renderList as je, inject as le } from "vue";
4
+ import { useLocale as F, useTheme as N, useDisplay as Pe } from "vuetify/lib/framework.mjs";
5
+ import { defineStore as ae } from "pinia";
6
+ import { useI18n as Me } from "vue-i18n";
7
+ import $e from "axios";
8
+ const se = ae("viewMgr", () => {
9
9
  const e = f([]);
10
10
  function n() {
11
11
  return e.value.length <= 0;
@@ -42,7 +42,7 @@ function Ae(e) {
42
42
  } };
43
43
  }
44
44
  const c = Ae();
45
- async function gt(e) {
45
+ async function xt(e) {
46
46
  return new Promise((n) => {
47
47
  setTimeout(n, e);
48
48
  });
@@ -57,7 +57,7 @@ async function G(e, n, t) {
57
57
  });
58
58
  }
59
59
  function J(e, n) {
60
- const t = $e(), o = d({
60
+ const t = se(), o = d({
61
61
  get() {
62
62
  return t.hasView(e);
63
63
  },
@@ -67,13 +67,13 @@ function J(e, n) {
67
67
  }), r = (a) => {
68
68
  n == null || n(a), o.value = !0;
69
69
  };
70
- return D(() => {
70
+ return q(() => {
71
71
  c.on(e, r);
72
- }), A(() => {
72
+ }), R(() => {
73
73
  c.off(e, r);
74
74
  }), { open: o };
75
75
  }
76
- const Ee = /* @__PURE__ */ R({
76
+ const Be = /* @__PURE__ */ O({
77
77
  __name: "index",
78
78
  setup(e) {
79
79
  const n = F(), { open: t } = J("confirmDlg"), o = f(""), r = f(""), a = f(), l = f(), s = d(() => {
@@ -89,28 +89,28 @@ const Ee = /* @__PURE__ */ R({
89
89
  var u;
90
90
  return ((u = l.value) == null ? void 0 : u.text) ?? n.t("confirm");
91
91
  });
92
- let O = 0, q = !1;
93
- const M = (u) => {
94
- o.value = u.title, r.value = u.text, a.value = u.cancel, l.value = u.confirm, O = u.seq, q = !1, t.value = !0;
92
+ let E = 0, D = !1;
93
+ const A = (u) => {
94
+ o.value = u.title, r.value = u.text, a.value = u.cancel, l.value = u.confirm, E = u.seq, D = !1, t.value = !0;
95
95
  };
96
- D(() => {
97
- c.on("confirmDlg", M);
98
- }), A(() => {
99
- c.off("confirmDlg", M);
96
+ q(() => {
97
+ c.on("confirmDlg", A);
98
+ }), R(() => {
99
+ c.off("confirmDlg", A);
100
100
  });
101
101
  const B = () => {
102
- t.value = !1, q || (c.emit("confirmDlgResult" + O, !0), q = !0);
102
+ t.value = !1, D || (c.emit("confirmDlgResult" + E, !0), D = !0);
103
103
  };
104
104
  return P(t, (u) => {
105
- !u && !q && (c.emit("confirmDlgResult" + O, !1), q = !0);
105
+ !u && !D && (c.emit("confirmDlgResult" + E, !1), D = !0);
106
106
  }), (u, w) => {
107
- const S = v("v-card-title"), U = v("v-card-text"), I = v("v-btn"), i = v("v-card-actions"), x = v("v-card"), N = v("v-dialog");
108
- return C(), E(N, {
109
- modelValue: z(t),
107
+ const S = v("v-card-title"), U = v("v-card-text"), I = v("v-btn"), i = v("v-card-actions"), x = v("v-card"), z = v("v-dialog");
108
+ return C(), $(z, {
109
+ modelValue: K(t),
110
110
  "onUpdate:modelValue": w[1] || (w[1] = (T) => X(t) ? t.value = T : null),
111
111
  onKeydown: [
112
- w[2] || (w[2] = K($((T) => t.value = !1, ["stop", "prevent"]), ["esc"])),
113
- K($(B, ["stop", "prevent"]), ["enter"])
112
+ w[2] || (w[2] = L(M((T) => t.value = !1, ["stop", "prevent"]), ["esc"])),
113
+ L(M(B, ["stop", "prevent"]), ["enter"])
114
114
  ],
115
115
  transition: "dialog-top-transition",
116
116
  "max-width": "600px"
@@ -120,13 +120,13 @@ const Ee = /* @__PURE__ */ R({
120
120
  default: g(() => [
121
121
  h(S, null, {
122
122
  default: g(() => [
123
- k(b(o.value), 1)
123
+ b(k(o.value), 1)
124
124
  ]),
125
125
  _: 1
126
126
  }),
127
127
  h(U, null, {
128
128
  default: g(() => [
129
- k(b(r.value), 1)
129
+ b(k(r.value), 1)
130
130
  ]),
131
131
  _: 1
132
132
  }),
@@ -138,7 +138,7 @@ const Ee = /* @__PURE__ */ R({
138
138
  variant: "text"
139
139
  }, {
140
140
  default: g(() => [
141
- k(b(p.value), 1)
141
+ b(k(p.value), 1)
142
142
  ]),
143
143
  _: 1
144
144
  }, 8, ["color"]),
@@ -148,7 +148,7 @@ const Ee = /* @__PURE__ */ R({
148
148
  variant: "text"
149
149
  }, {
150
150
  default: g(() => [
151
- k(b(V.value), 1)
151
+ b(k(V.value), 1)
152
152
  ]),
153
153
  _: 1
154
154
  }, 8, ["color"])
@@ -163,7 +163,7 @@ const Ee = /* @__PURE__ */ R({
163
163
  }, 8, ["modelValue", "onKeydown"]);
164
164
  };
165
165
  }
166
- }), Me = (e) => (qe("data-v-a8f3d91f"), e = e(), Se(), e), Be = /* @__PURE__ */ Me(() => /* @__PURE__ */ _("div", { class: "lds-spinner" }, [
166
+ }), Ue = (e) => (Oe("data-v-a8f3d91f"), e = e(), Ee(), e), We = /* @__PURE__ */ Ue(() => /* @__PURE__ */ _("div", { class: "lds-spinner" }, [
167
167
  /* @__PURE__ */ _("div"),
168
168
  /* @__PURE__ */ _("div"),
169
169
  /* @__PURE__ */ _("div"),
@@ -176,9 +176,9 @@ const Ee = /* @__PURE__ */ R({
176
176
  /* @__PURE__ */ _("div"),
177
177
  /* @__PURE__ */ _("div"),
178
178
  /* @__PURE__ */ _("div")
179
- ], -1)), Ue = [
180
- Be
181
- ], We = /* @__PURE__ */ R({
179
+ ], -1)), Ke = [
180
+ We
181
+ ], Le = /* @__PURE__ */ O({
182
182
  __name: "index",
183
183
  props: {
184
184
  zIndex: {
@@ -187,21 +187,21 @@ const Ee = /* @__PURE__ */ R({
187
187
  }
188
188
  },
189
189
  setup(e) {
190
- const n = L(), t = e, o = d(() => ({
190
+ const n = N(), t = e, o = d(() => ({
191
191
  background: n.current.value.dark ? "#1e1e1e" : "#ffffff",
192
192
  zIndex: t.zIndex
193
193
  }));
194
194
  return (r, a) => (C(), H("div", {
195
195
  class: "x-cont",
196
- style: Ve(o.value)
197
- }, Ue, 4));
196
+ style: Re(o.value)
197
+ }, Ke, 4));
198
198
  }
199
- }), ae = (e, n) => {
199
+ }), ce = (e, n) => {
200
200
  const t = e.__vccOpts || e;
201
201
  for (const [o, r] of n)
202
202
  t[o] = r;
203
203
  return t;
204
- }, ze = /* @__PURE__ */ ae(We, [["__scopeId", "data-v-a8f3d91f"]]), Ke = /* @__PURE__ */ R({
204
+ }, Ne = /* @__PURE__ */ ce(Le, [["__scopeId", "data-v-a8f3d91f"]]), ze = /* @__PURE__ */ O({
205
205
  __name: "item",
206
206
  props: {
207
207
  id: {
@@ -241,7 +241,7 @@ const Ee = /* @__PURE__ */ R({
241
241
  }
242
242
  return l;
243
243
  });
244
- return D(() => {
244
+ return q(() => {
245
245
  setTimeout(() => {
246
246
  r("timeout", t.id);
247
247
  }, t.timeout);
@@ -249,7 +249,7 @@ const Ee = /* @__PURE__ */ R({
249
249
  l || r("timeout", t.id);
250
250
  }), (l, s) => {
251
251
  const p = v("v-alert");
252
- return C(), E(p, {
252
+ return C(), $(p, {
253
253
  modelValue: o.value,
254
254
  "onUpdate:modelValue": s[0] || (s[0] = (m) => o.value = m),
255
255
  class: "mt-2",
@@ -264,13 +264,13 @@ const Ee = /* @__PURE__ */ R({
264
264
  }, null, 8, ["modelValue", "type", "icon", "text"]);
265
265
  };
266
266
  }
267
- }), Le = /* @__PURE__ */ R({
267
+ }), He = /* @__PURE__ */ O({
268
268
  __name: "index",
269
269
  setup(e) {
270
- const n = De({ items: [] });
271
- D(() => {
270
+ const n = Ie({ items: [] });
271
+ q(() => {
272
272
  c.on("message", t);
273
- }), A(() => {
273
+ }), R(() => {
274
274
  c.off("message", t);
275
275
  });
276
276
  const t = (s) => {
@@ -287,11 +287,11 @@ const Ee = /* @__PURE__ */ R({
287
287
  p >= 0 && n.items.splice(p, 1);
288
288
  };
289
289
  return (s, p) => (C(), H("div", {
290
- onClick: p[0] || (p[0] = $(() => {
290
+ onClick: p[0] || (p[0] = M(() => {
291
291
  }, ["stop"])),
292
292
  class: "x-cont d-flex flex-column-reverse align-center"
293
293
  }, [
294
- (C(!0), H(Re, null, Oe(n.items, (m) => (C(), E(Ke, {
294
+ (C(!0), H(Te, null, je(n.items, (m) => (C(), $(ze, {
295
295
  onTimeout: o,
296
296
  id: m.id,
297
297
  type: m.type,
@@ -301,16 +301,16 @@ const Ee = /* @__PURE__ */ R({
301
301
  }, null, 8, ["id", "type", "text", "timeout"]))), 128))
302
302
  ]));
303
303
  }
304
- }), Ne = /* @__PURE__ */ ae(Le, [["__scopeId", "data-v-70ed4b89"]]), He = /* @__PURE__ */ R({
304
+ }), Xe = /* @__PURE__ */ ce(He, [["__scopeId", "data-v-70ed4b89"]]), Fe = /* @__PURE__ */ O({
305
305
  __name: "index",
306
306
  setup(e) {
307
- const n = F(), { open: t } = J("promptDlg"), o = f(""), r = f(""), a = f(), l = f(), s = f(), p = f(""), m = f(), V = f(), O = d(() => {
307
+ const n = F(), { open: t } = J("promptDlg"), o = f(""), r = f(""), a = f(), l = f(), s = f(), p = f(""), m = f(), V = f(), E = d(() => {
308
308
  var i;
309
309
  return ((i = m.value) == null ? void 0 : i.color) ?? "primary";
310
- }), q = d(() => {
310
+ }), D = d(() => {
311
311
  var i;
312
312
  return ((i = m.value) == null ? void 0 : i.text) ?? n.t("cancel");
313
- }), M = d(() => {
313
+ }), A = d(() => {
314
314
  var i;
315
315
  return ((i = V.value) == null ? void 0 : i.color) ?? "primary";
316
316
  }), B = d(() => {
@@ -322,9 +322,9 @@ const Ee = /* @__PURE__ */ R({
322
322
  var x;
323
323
  o.value = i.title, r.value = i.text, a.value = i.label, l.value = i.placeholder, s.value = i.rules, p.value = i.value, m.value = i.cancel, V.value = i.confirm, w = i.seq, S = !1, t.value = !0, await G(() => u.value !== void 0, 1e3), (x = u.value) == null || x.focus();
324
324
  };
325
- D(() => {
325
+ q(() => {
326
326
  c.on("promptDlg", U);
327
- }), A(() => {
327
+ }), R(() => {
328
328
  c.off("promptDlg", U);
329
329
  });
330
330
  const I = () => {
@@ -333,35 +333,35 @@ const Ee = /* @__PURE__ */ R({
333
333
  return P(t, (i) => {
334
334
  !i && !S && (c.emit("promptDlgResult" + w, void 0), S = !0);
335
335
  }), (i, x) => {
336
- const N = v("v-card-title"), T = v("v-card-text"), de = v("v-text-field"), pe = v("v-form"), Q = v("v-btn"), fe = v("v-card-actions"), me = v("v-card"), ve = v("v-dialog");
337
- return C(), E(ve, {
338
- modelValue: z(t),
336
+ const z = v("v-card-title"), T = v("v-card-text"), ve = v("v-text-field"), ge = v("v-form"), Q = v("v-btn"), _e = v("v-card-actions"), he = v("v-card"), xe = v("v-dialog");
337
+ return C(), $(xe, {
338
+ modelValue: K(t),
339
339
  "onUpdate:modelValue": x[2] || (x[2] = (j) => X(t) ? t.value = j : null),
340
340
  onKeydown: [
341
- x[3] || (x[3] = K($((j) => t.value = !1, ["stop", "prevent"]), ["esc"])),
342
- K($(I, ["stop", "prevent"]), ["enter"])
341
+ x[3] || (x[3] = L(M((j) => t.value = !1, ["stop", "prevent"]), ["esc"])),
342
+ L(M(I, ["stop", "prevent"]), ["enter"])
343
343
  ],
344
344
  transition: "dialog-top-transition",
345
345
  "max-width": "600px"
346
346
  }, {
347
347
  default: g(() => [
348
- h(me, null, {
348
+ h(he, null, {
349
349
  default: g(() => [
350
- h(N, null, {
350
+ h(z, null, {
351
351
  default: g(() => [
352
- k(b(o.value), 1)
352
+ b(k(o.value), 1)
353
353
  ]),
354
354
  _: 1
355
355
  }),
356
356
  h(T, null, {
357
357
  default: g(() => [
358
- k(b(r.value), 1)
358
+ b(k(r.value), 1)
359
359
  ]),
360
360
  _: 1
361
361
  }),
362
- h(pe, { class: "mx-3" }, {
362
+ h(ge, { class: "mx-3" }, {
363
363
  default: g(() => [
364
- h(de, {
364
+ h(ve, {
365
365
  modelValue: p.value,
366
366
  "onUpdate:modelValue": x[0] || (x[0] = (j) => p.value = j),
367
367
  label: a.value,
@@ -373,25 +373,25 @@ const Ee = /* @__PURE__ */ R({
373
373
  ]),
374
374
  _: 1
375
375
  }),
376
- h(fe, { class: "d-flex justify-end" }, {
376
+ h(_e, { class: "d-flex justify-end" }, {
377
377
  default: g(() => [
378
378
  h(Q, {
379
379
  onClick: x[1] || (x[1] = (j) => t.value = !1),
380
- color: O.value,
380
+ color: E.value,
381
381
  variant: "text"
382
382
  }, {
383
383
  default: g(() => [
384
- k(b(q.value), 1)
384
+ b(k(D.value), 1)
385
385
  ]),
386
386
  _: 1
387
387
  }, 8, ["color"]),
388
388
  h(Q, {
389
389
  onClick: I,
390
- color: M.value,
390
+ color: A.value,
391
391
  variant: "text"
392
392
  }, {
393
393
  default: g(() => [
394
- k(b(B.value), 1)
394
+ b(k(B.value), 1)
395
395
  ]),
396
396
  _: 1
397
397
  }, 8, ["color"])
@@ -406,7 +406,7 @@ const Ee = /* @__PURE__ */ R({
406
406
  }, 8, ["modelValue", "onKeydown"]);
407
407
  };
408
408
  }
409
- }), Xe = { class: "mx-auto my-auto" }, Fe = { class: "d-flex align-center justify-center w-100 h-100" }, Ge = /* @__PURE__ */ R({
409
+ }), Ge = { class: "mx-auto my-auto" }, Je = { class: "d-flex align-center justify-center w-100 h-100" }, Qe = /* @__PURE__ */ O({
410
410
  __name: "index",
411
411
  setup(e) {
412
412
  const n = F(), { open: t } = J("waitDlg"), o = () => {
@@ -414,29 +414,29 @@ const Ee = /* @__PURE__ */ R({
414
414
  }, r = () => {
415
415
  t.value = !1;
416
416
  };
417
- return D(() => {
417
+ return q(() => {
418
418
  c.on("openWaitDlg", o), c.on("closeWaitDlg", r);
419
- }), A(() => {
419
+ }), R(() => {
420
420
  c.off("openWaitDlg", o), c.off("closeWaitDlg", r);
421
421
  }), (a, l) => {
422
422
  const s = v("v-card"), p = v("v-dialog");
423
- return C(), E(p, {
424
- modelValue: z(t),
423
+ return C(), $(p, {
424
+ modelValue: K(t),
425
425
  "onUpdate:modelValue": l[0] || (l[0] = (m) => X(t) ? t.value = m : null),
426
426
  persistent: "",
427
427
  "no-click-animation": "",
428
428
  fullscreen: ""
429
429
  }, {
430
430
  default: g(() => [
431
- _("div", Xe, [
431
+ _("div", Ge, [
432
432
  h(s, {
433
433
  width: "300px",
434
434
  height: "80px",
435
435
  loading: ""
436
436
  }, {
437
437
  default: g(() => [
438
- _("div", Fe, [
439
- _("span", null, b(z(n).t("waitingResponse")), 1)
438
+ _("div", Je, [
439
+ _("span", null, k(K(n).t("waitingResponse")), 1)
440
440
  ])
441
441
  ]),
442
442
  _: 1
@@ -447,11 +447,11 @@ const Ee = /* @__PURE__ */ R({
447
447
  }, 8, ["modelValue"]);
448
448
  };
449
449
  }
450
- }), Je = (e) => {
451
- e.component("v-alert", ge), e.component("v-btn", _e), e.component("v-card", he), e.component("v-card-actions", xe), e.component("v-card-text", we), e.component("v-card-title", ye), e.component("v-dialog", be), e.component("v-form", ke), e.component("v-text-field", Ce), e.component("x-confirm-dlg", Ee), e.component("x-loading", ze), e.component("x-message", Ne), e.component("x-prompt-dlg", He), e.component("x-wait-dlg", Ge);
450
+ }), Ye = (e) => {
451
+ e.component("v-alert", we), e.component("v-btn", ye), e.component("v-card", ke), e.component("v-card-actions", be), e.component("v-card-text", Ce), e.component("v-card-title", Ve), e.component("v-dialog", De), e.component("v-form", Se), e.component("v-text-field", qe), e.component("x-confirm-dlg", Be), e.component("x-loading", Ne), e.component("x-message", Xe), e.component("x-prompt-dlg", Fe), e.component("x-wait-dlg", Qe);
452
452
  };
453
- function _t() {
454
- const e = L(), n = d(() => e.global.current.value.colors.primary), t = d(() => e.global.current.value.colors.secondary), o = d(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), r = d(() => e.current.value.dark ? "#272727" : "#eeeeee"), a = d(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), l = d(() => e.current.value.dark ? "#303030" : "#f6f6f6"), s = d(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
453
+ function wt() {
454
+ const e = N(), n = d(() => e.global.current.value.colors.primary), t = d(() => e.global.current.value.colors.secondary), o = d(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), r = d(() => e.current.value.dark ? "#272727" : "#eeeeee"), a = d(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), l = d(() => e.current.value.dark ? "#303030" : "#f6f6f6"), s = d(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
455
455
  return {
456
456
  primaryColor: n,
457
457
  secondaryColor: t,
@@ -462,14 +462,29 @@ function _t() {
462
462
  borderColor: s
463
463
  };
464
464
  }
465
- function ht() {
466
- const e = L(), { width: n } = Te(), t = d(() => e.global.name.value), o = d(() => !!window.cordova), r = d(() => n.value <= 1280 ? n.value + "px" : n.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
467
- return { dark: t, sysBarAvail: o, compactWidth: r };
465
+ var ie = {}, Y;
466
+ (function(e) {
467
+ e.pop = "pop", e.push = "push";
468
+ })(Y || (Y = {}));
469
+ var Z;
470
+ (function(e) {
471
+ e.back = "back", e.forward = "forward", e.unknown = "";
472
+ })(Z || (Z = {}));
473
+ var ee;
474
+ (function(e) {
475
+ e[e.aborted = 4] = "aborted", e[e.cancelled = 8] = "cancelled", e[e.duplicated = 16] = "duplicated";
476
+ })(ee || (ee = {}));
477
+ const Ze = Symbol(ie.NODE_ENV !== "production" ? "router" : ""), et = Symbol(ie.NODE_ENV !== "production" ? "route location" : "");
478
+ function ue() {
479
+ return le(Ze);
480
+ }
481
+ function tt() {
482
+ return le(et);
468
483
  }
469
- const xt = le(
484
+ const nt = ae(
470
485
  "global",
471
486
  () => {
472
- const e = L(), n = je(), t = f(!1);
487
+ const e = N(), n = Me(), t = f(!1);
473
488
  P(
474
489
  t,
475
490
  (l) => {
@@ -501,108 +516,123 @@ const xt = le(
501
516
  ]
502
517
  }
503
518
  );
504
- var Qe = {}, Y;
505
- (function(e) {
506
- e.pop = "pop", e.push = "push";
507
- })(Y || (Y = {}));
508
- var Z;
509
- (function(e) {
510
- e.back = "back", e.forward = "forward", e.unknown = "";
511
- })(Z || (Z = {}));
512
- var ee;
513
- (function(e) {
514
- e[e.aborted = 4] = "aborted", e[e.cancelled = 8] = "cancelled", e[e.duplicated = 16] = "duplicated";
515
- })(ee || (ee = {}));
516
- const Ye = Symbol(Qe.NODE_ENV !== "production" ? "router" : "");
517
- function Ze() {
518
- return Ie(Ye);
519
+ function yt() {
520
+ const e = tt(), n = ue();
521
+ nt();
522
+ const t = se(), o = (a) => {
523
+ if (console.log("onKeydown", a), a.key === "Escape") {
524
+ r();
525
+ return;
526
+ }
527
+ }, r = () => {
528
+ var a;
529
+ if (!t.isEmpty()) {
530
+ t.hasView("waitDlg") || t.popView();
531
+ return;
532
+ }
533
+ e.meta.level === 0 ? (a = navigator == null ? void 0 : navigator.Backbutton) == null || a.goHome(
534
+ () => {
535
+ },
536
+ () => {
537
+ }
538
+ ) : n.back();
539
+ };
540
+ return q(() => {
541
+ window.addEventListener("keydown", o, !1), console.log("onMounted");
542
+ }), R(() => {
543
+ window.removeEventListener("keydown", o, !1), console.log("onBeforeUnmount");
544
+ }), {};
545
+ }
546
+ function kt() {
547
+ const e = N(), { width: n } = Pe(), t = d(() => e.global.name.value), o = d(() => !!window.cordova), r = d(() => n.value <= 1280 ? n.value + "px" : n.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
548
+ return { dark: t, sysBarAvail: o, compactWidth: r };
519
549
  }
520
550
  const W = require("js-cookie");
521
- function wt(e) {
522
- const n = Pe.create({
551
+ function bt(e) {
552
+ const n = $e.create({
523
553
  timeout: 6e3
524
554
  });
525
555
  return n.defaults.baseURL = e.baseUrl, n.interceptors.request.use(
526
- (t) => et(t),
556
+ (t) => ot(t),
527
557
  (t) => {
528
- tt(t, e.onError);
558
+ rt(t, e.onError);
529
559
  }
530
560
  ), n.interceptors.response.use(
531
- (t) => nt(t),
532
- (t) => ot(t, e.onError)
561
+ (t) => lt(t),
562
+ (t) => at(t, e.onError)
533
563
  ), n;
534
564
  }
535
- function et(e) {
565
+ function ot(e) {
536
566
  const n = W.get("accessToken") ?? "";
537
567
  return e.headers.Authorization = "Basic " + n, e.headers["Content-Type"] = "application/json", e.data = JSON.stringify(e.data), e;
538
568
  }
539
- function tt(e, n) {
569
+ function rt(e, n) {
540
570
  console.error(e), n("request timeout");
541
571
  }
542
- function nt(e) {
572
+ function lt(e) {
543
573
  return e.data;
544
574
  }
545
- function ot(e, n) {
575
+ function at(e, n) {
546
576
  var r;
547
577
  const t = e.response;
548
578
  if (!t)
549
579
  return Promise.reject(e);
550
- t.status === 401 && rt();
580
+ t.status === 401 && st();
551
581
  let o = (r = t.data) == null ? void 0 : r.message;
552
582
  return o || (o = {
553
583
  code: t.status,
554
584
  message: t.statusText
555
585
  }), n(o), Promise.reject(e);
556
586
  }
557
- function rt() {
558
- W.remove("accessToken"), W.remove("refreshToken"), W.remove("activeOrg"), Ze().replace({ path: "/passport/login" });
587
+ function st() {
588
+ W.remove("accessToken"), W.remove("refreshToken"), W.remove("activeOrg"), ue().replace({ path: "/passport/login" });
559
589
  }
560
590
  let te = Date.now();
561
- function se() {
591
+ function de() {
562
592
  const e = Date.now();
563
593
  return e - te > 500 ? (te = e, !0) : !1;
564
594
  }
565
- let lt = 0;
566
- function ce() {
567
- return ++lt;
595
+ let ct = 0;
596
+ function pe() {
597
+ return ++ct;
568
598
  }
569
- async function yt(e) {
570
- if (!se())
599
+ async function Ct(e) {
600
+ if (!de())
571
601
  return;
572
602
  let n = !1, t;
573
603
  const o = (a) => {
574
604
  t = a, n = !0;
575
- }, r = ce();
605
+ }, r = pe();
576
606
  return c.on("confirmDlgResult" + r, o), c.emit("confirmDlg", { ...e, seq: r }), await G(() => n), c.off("confirmDlgResult" + r, o), t;
577
607
  }
578
- async function bt(e) {
579
- if (!se())
608
+ async function Vt(e) {
609
+ if (!de())
580
610
  return;
581
611
  let n = !1, t;
582
612
  const o = (a) => {
583
613
  t = a, n = !0;
584
- }, r = ce();
614
+ }, r = pe();
585
615
  return c.on("promptDlgResult" + r, o), c.emit("promptDlg", { ...e, seq: r }), await G(() => n), c.off("promptDlgResult" + r, o), t;
586
616
  }
587
- function kt() {
617
+ function Dt() {
588
618
  c.emit("openWaitDlg");
589
619
  }
590
- function Ct() {
620
+ function St() {
591
621
  c.emit("closeWaitDlg");
592
622
  }
593
- function Vt(e, n) {
623
+ function qt(e, n) {
594
624
  c.emit("message", { type: "error", text: e, timeout: n });
595
625
  }
596
- function qt(e, n) {
626
+ function Rt(e, n) {
597
627
  c.emit("message", { type: "info", text: e, timeout: n });
598
628
  }
599
- function St(e, n) {
629
+ function Ot(e, n) {
600
630
  c.emit("message", { type: "success", text: e, timeout: n });
601
631
  }
602
- function Dt(e, n) {
632
+ function Et(e, n) {
603
633
  c.emit("message", { type: "warning", text: e, timeout: n });
604
634
  }
605
- function Rt(e) {
635
+ function It(e) {
606
636
  var o, r;
607
637
  if (!window.appAppear) {
608
638
  window.appAppear = !0;
@@ -613,7 +643,7 @@ function Rt(e) {
613
643
  t.add("app-reset");
614
644
  }, 0));
615
645
  }
616
- let at = {};
646
+ let it = {};
617
647
  function ne(e, n) {
618
648
  if (!e)
619
649
  return !1;
@@ -627,11 +657,11 @@ function ne(e, n) {
627
657
  return !1;
628
658
  }), Object.keys(t).length <= 0);
629
659
  }
630
- function Ot(e, n) {
631
- const t = at[e];
660
+ function Tt(e, n) {
661
+ const t = it[e];
632
662
  return t ? n ? (!ne(t.includes, n) || ne(t.excludes, n), !1) : !0 : !1;
633
663
  }
634
- const ie = require("js-cookie"), st = [
664
+ const fe = require("js-cookie"), ut = [
635
665
  { path: "/passport/login", level: 0 },
636
666
  { path: "/passport/loginAccount", level: 1 },
637
667
  { path: "/passport/register", level: 1 },
@@ -651,10 +681,10 @@ const ie = require("js-cookie"), st = [
651
681
  { path: "/calc", level: 1, requiredState: "org" },
652
682
  { path: "/data", level: 1, requiredState: "org" }
653
683
  ];
654
- function ue(e) {
684
+ function me(e) {
655
685
  let n, t = 0;
656
686
  const o = e.split("/");
657
- return st.forEach((r) => {
687
+ return ut.forEach((r) => {
658
688
  const a = r.path.split("/");
659
689
  let l = 0;
660
690
  for (let s = 0; s < o.length && !(s >= a.length || o[s] !== a[s]); s++)
@@ -665,7 +695,7 @@ function ue(e) {
665
695
  function oe(e) {
666
696
  if (e === "/")
667
697
  return { app: "", path: "/", level: -1 };
668
- const n = ue(e);
698
+ const n = me(e);
669
699
  if (!n)
670
700
  return { app: "invalidApp", path: "/invalidApp/invalidRoute", level: -1 };
671
701
  const t = e.split("/");
@@ -678,14 +708,14 @@ function y(e, n) {
678
708
  `~~~~before route change~~~~ ${o.path} -> ${t.path} inner=${r} forward=${l}`
679
709
  ), r ? a ? re.value = "" : re.value = l ? "inner-left" : "inner-right" : window.routeExtras = { forward: l };
680
710
  }
681
- function ct() {
682
- return !!ie.get("accessToken");
711
+ function dt() {
712
+ return !!fe.get("accessToken");
683
713
  }
684
- function it() {
685
- return !!ie.get("activeOrg");
714
+ function pt() {
715
+ return !!fe.get("activeOrg");
686
716
  }
687
- function It(e, n, t) {
688
- const o = ct(), r = it(), a = ue(e.path);
717
+ function jt(e, n, t) {
718
+ const o = dt(), r = pt(), a = me(e.path);
689
719
  if (!a) {
690
720
  t();
691
721
  return;
@@ -724,28 +754,29 @@ function It(e, n, t) {
724
754
  else
725
755
  y(e.path, n.path), t();
726
756
  }
727
- const Tt = { install: Je };
757
+ const Pt = { install: Ye };
728
758
  export {
729
- Rt as appAppear,
730
- Ct as closeWaitDlg,
731
- wt as createAxios,
732
- Tt as default,
759
+ It as appAppear,
760
+ St as closeWaitDlg,
761
+ bt as createAxios,
762
+ Pt as default,
733
763
  c as eventBus,
734
- Vt as messageError,
735
- qt as messageInfo,
736
- St as messageSuccess,
737
- Dt as messageWarning,
738
- It as onBeforeEach,
739
- yt as openConfirmDlg,
740
- bt as openPromptDlg,
741
- kt as openWaitDlg,
764
+ qt as messageError,
765
+ Rt as messageInfo,
766
+ Ot as messageSuccess,
767
+ Et as messageWarning,
768
+ jt as onBeforeEach,
769
+ Ct as openConfirmDlg,
770
+ Vt as openPromptDlg,
771
+ Dt as openWaitDlg,
742
772
  re as routeTransName,
743
- _t as useColor,
744
- xt as useGlobalStore,
745
- ht as useSystem,
746
- $e as useViewMgrStore,
773
+ wt as useColor,
774
+ nt as useGlobalStore,
775
+ yt as useHotkey,
776
+ kt as useSystem,
777
+ se as useViewMgrStore,
747
778
  J as useViewStack,
748
- Ot as verifyPermission,
749
- gt as waitMs,
779
+ Tt as verifyPermission,
780
+ xt as waitMs,
750
781
  G as waitUtil
751
782
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.2.14",
4
+ "version": "0.3.1",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",