@wssto2/vue-core 0.4.13 → 0.4.14

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/dist/{Activity-DhVVSf60.js → Activity-BdSvn0GP.js} +3 -3
  2. package/dist/{Changes-Czs32zlz.js → Changes-BQO--N9F.js} +3 -3
  3. package/dist/{DeadLetters-DBUALYXL.js → DeadLetters-OmeiADEi.js} +3 -3
  4. package/dist/{General-UWbJQLc8.js → General-CBwFLiKQ.js} +3 -3
  5. package/dist/{NewRolePage-Dm7urTx0.js → NewRolePage-CblUW2gA.js} +3 -3
  6. package/dist/{ProfilePage-Ep75xf-u.js → ProfilePage-BOoDDbmB.js} +3 -3
  7. package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-CDZjkiU5.js → RoleEditor.vue_vue_type_script_setup_true_lang-BCE5yrwy.js} +1 -1
  8. package/dist/{RolePage-CQc_wV3b.js → RolePage-xDsFL_eC.js} +4 -4
  9. package/dist/{RolesPage-CG7InZ_u.js → RolesPage-C39wsF6X.js} +2 -2
  10. package/dist/{Sessions-_w3Tnevz.js → Sessions-m_i4aTfw.js} +3 -3
  11. package/dist/{SettingsPage-BNdeH-_0.js → SettingsPage-ktKvQQnE.js} +3 -3
  12. package/dist/{SignIn-DIjshMpl.js → SignIn-CkoEixY4.js} +3 -3
  13. package/dist/{SignInPage-C3-LHjo2.js → SignInPage-DVcpFz3G.js} +1 -1
  14. package/dist/{SignIns-DNdLctGJ.js → SignIns-BnVAtncZ.js} +3 -3
  15. package/dist/{UserRecord-C0JZgK47.js → UserRecord-Cg69_mbU.js} +6 -6
  16. package/dist/{UsersList-Bc8dCuRB.js → UsersList-BFmBDGs7.js} +3 -3
  17. package/dist/access/index.js +1 -1
  18. package/dist/app/application.d.ts +7 -0
  19. package/dist/app/index.js +143 -142
  20. package/dist/{describeError-Ctga6GcS.js → describeError-CvGmajU0.js} +20 -13
  21. package/dist/{fieldMessages-C3Rpbktw.js → fieldMessages-D_dpSe19.js} +1 -1
  22. package/dist/i18n/describeError.d.ts +11 -1
  23. package/dist/i18n/index.d.ts +2 -2
  24. package/dist/i18n/index.js +7 -6
  25. package/dist/identity/index.js +1 -1
  26. package/dist/{index-Cz4LtYKa.js → index-B416VXmR.js} +2 -2
  27. package/dist/{index-BesWsiIg.js → index-KcCoCfr-.js} +5 -5
  28. package/dist/{index-BEDhdJQE.js → index-RNF5-9uf.js} +12 -12
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/notifications/index.js +1 -1
  32. package/dist/resource/index.js +1 -1
  33. package/dist/resource/resource.d.ts +1 -1
  34. package/dist/{routeResource-DstM0hvf.js → routeResource-BwEFXzIX.js} +36 -32
  35. package/dist/state/index.js +1 -1
  36. package/dist/state/useLoad.d.ts +7 -0
  37. package/dist/{status-DfAac6vw.js → status-OZUHZpWl.js} +1 -1
  38. package/dist/useLoad-DuEsLECT.js +43 -0
  39. package/package.json +1 -1
  40. package/dist/useLoad-CYRVx6HW.js +0 -39
@@ -1,23 +1,27 @@
1
- import { computed as f, toValue as x, shallowRef as R, watch as w, getCurrentScope as C, onScopeDispose as I, provide as j, hasInjectionContext as A, inject as F } from "vue";
1
+ import { computed as f, toValue as A, shallowRef as w, watch as R, getCurrentScope as C, onScopeDispose as I, provide as j, hasInjectionContext as E, inject as F } from "vue";
2
2
  import { useRoute as M } from "vue-router";
3
3
  import { M as h } from "./context-Ch1r4fdN.js";
4
4
  import { useI18n as S } from "vue-i18n";
5
5
  import { a as p } from "./error-CD7x0Jrz.js";
6
- function _(e) {
6
+ import { a as _ } from "./describeError-CvGmajU0.js";
7
+ function D(e) {
7
8
  if (!/^\d+$/.test(e)) return null;
8
9
  const n = Number(e);
9
10
  return Number.isSafeInteger(n) && n > 0 ? n : null;
10
11
  }
11
- const E = (e) => typeof e == "object" && e !== null && "state" in e && "reload" in e && "id" in e, N = (e) => typeof e == "object" && e !== null && "id" in e;
12
- function D(e) {
13
- const { t: n } = S(), o = E(e.for) ? e.for : null, s = f(() => o ? o.id.value : x(e.for)), d = f(() => o !== null && o.data.value === null), t = R({ status: "loading" });
14
- let u = null, a = 0, v = null;
15
- const g = e.errorMessage ?? ((r) => p(r) && r.kind === "network" ? n("core.resource.offline") : p(r) && r.kind === "forbidden" ? n("core.no_access.body") : n("core.resource.unavailable"));
12
+ const N = (e) => typeof e == "object" && e !== null && "state" in e && "reload" in e && "id" in e, O = (e) => typeof e == "object" && e !== null && "id" in e;
13
+ function V(e) {
14
+ const { t: n } = S(), s = N(e.for) ? e.for : null, a = f(() => s ? s.id.value : A(e.for)), d = f(() => s !== null && s.data.value === null), t = w({ status: "loading" });
15
+ let u = null, l = 0, v = null;
16
+ const k = _(), g = e.errorMessage ?? ((r) => {
17
+ const o = k?.(r);
18
+ return o !== void 0 ? o : p(r) && r.kind === "network" ? n("core.resource.offline") : p(r) && r.kind === "forbidden" ? n("core.no_access.body") : n("core.resource.unavailable");
19
+ });
16
20
  function m() {
17
- return v?.abort(), v = null, ++a;
21
+ return v?.abort(), v = null, ++l;
18
22
  }
19
23
  async function y() {
20
- const r = s.value, l = m();
24
+ const r = a.value, o = m();
21
25
  if (d.value) {
22
26
  u = null, t.value = { status: "loading" };
23
27
  return;
@@ -32,51 +36,51 @@ function D(e) {
32
36
  v = b;
33
37
  try {
34
38
  const c = await e.load(r, { signal: b.signal });
35
- if (l !== a) return;
39
+ if (o !== l) return;
36
40
  u = r, t.value = { status: "loaded", value: c };
37
41
  } catch (c) {
38
- if (l !== a) return;
42
+ if (o !== l) return;
39
43
  p(c) && c.kind === "notFound" ? (u = null, t.value = { status: "failed", reason: "notFound", error: n("core.resource.not_found.body") }) : i ? t.value = { status: "stale", value: i.value, error: g(c) } : (u = null, t.value = { status: "failed", reason: "unavailable", error: g(c) });
40
44
  }
41
45
  }
42
- function k(r) {
43
- const l = s.value, i = e.identify ? e.identify(r) : N(r) ? r.id : l;
44
- return l === null || i !== l ? !1 : (m(), u = l, t.value = { status: "loaded", value: r }, !0);
46
+ function x(r) {
47
+ const o = a.value, i = e.identify ? e.identify(r) : O(r) ? r.id : o;
48
+ return o === null || i !== o ? !1 : (m(), u = o, t.value = { status: "loaded", value: r }, !0);
45
49
  }
46
- return w([s, d], () => void y(), { immediate: !0, flush: "sync" }), C() && I(m), {
47
- id: s,
50
+ return R([a, d], () => void y(), { immediate: !0, flush: "sync" }), C() && I(m), {
51
+ id: a,
48
52
  state: f(() => t.value),
49
53
  data: f(() => "value" in t.value ? t.value.value : null),
50
54
  reload: y,
51
- update: k
55
+ update: x
52
56
  };
53
57
  }
54
- function B(e) {
55
- const n = M(), o = e.parse ?? _, s = R(null);
58
+ function J(e) {
59
+ const n = M(), s = e.parse ?? D, a = w(null);
56
60
  let d = !1;
57
- w(
61
+ R(
58
62
  () => n.params[e.param],
59
63
  (u) => {
60
64
  if (u === void 0 && d) return;
61
65
  d = !0;
62
- const a = Array.isArray(u) ? u[0] : u;
63
- s.value = a === void 0 ? null : o(a);
66
+ const l = Array.isArray(u) ? u[0] : u;
67
+ a.value = l === void 0 ? null : s(l);
64
68
  },
65
69
  { immediate: !0, flush: "sync" }
66
70
  );
67
- const t = D({ ...e, for: s });
71
+ const t = V({ ...e, for: a });
68
72
  return e.key && j(e.key, t), t;
69
73
  }
70
- function G(e) {
74
+ function K(e) {
71
75
  const n = e.description ?? "route resource";
72
- if (!A()) throw new h(n, "outside-setup");
73
- const o = F(e, null);
74
- if (!o) throw new h(n, "not-provided");
75
- return o;
76
+ if (!E()) throw new h(n, "outside-setup");
77
+ const s = F(e, null);
78
+ if (!s) throw new h(n, "not-provided");
79
+ return s;
76
80
  }
77
81
  export {
78
- B as a,
79
- G as b,
80
- _ as p,
81
- D as u
82
+ J as a,
83
+ K as b,
84
+ D as p,
85
+ V as u
82
86
  };
@@ -7,7 +7,7 @@ import { _ as q } from "../EmptyState.vue_vue_type_script_setup_true_lang-50p-Mp
7
7
  import { defineComponent as m, computed as k, openBlock as e, createElementBlock as n, normalizeClass as p, createVNode as d, unref as i, createElementVNode as u, renderSlot as f, createBlock as S, toDisplayString as l, createCommentVNode as c } from "vue";
8
8
  import { _ as x } from "../Icon.vue_vue_type_script_lang-D7oC-d-S.js";
9
9
  import { useI18n as g } from "vue-i18n";
10
- import { u as J } from "../useLoad-CYRVx6HW.js";
10
+ import { u as J } from "../useLoad-DuEsLECT.js";
11
11
  import { D as Q, W as X, u as Y } from "../useWaitStatus-fsacMl4W.js";
12
12
  const b = ["amber", "lime", "teal", "cyan", "blue", "indigo", "violet", "fuchsia", "pink"], V = /* @__PURE__ */ m({
13
13
  __name: "FieldNote",
@@ -3,6 +3,13 @@ import type { AsyncState } from "./async";
3
3
  export interface LoadContext {
4
4
  /** Aborted when the load is no longer wanted: a newer load or an `update` superseded it, the watch source changed, the scope ended. */
5
5
  readonly signal: AbortSignal;
6
+ /**
7
+ * Ends this load with nothing to show and nothing to report, for a page that is leaving instead (a 403 that
8
+ * redirects): the state stays as it is (loading, or the value on screen) and no error flashes on the way out.
9
+ *
10
+ * if (isForbidden(error)) { void router.replace(elsewhere); return abandon(); }
11
+ */
12
+ readonly abandon: () => never;
6
13
  }
7
14
  export interface LoadOptions {
8
15
  /**
@@ -1,5 +1,5 @@
1
1
  import { a, r as o } from "./http-D_D9YbLH.js";
2
- import { i as r } from "./index-BEDhdJQE.js";
2
+ import { i as r } from "./index-RNF5-9uf.js";
3
3
  const n = ["active", "locked", "inactive", "all"];
4
4
  function l(i) {
5
5
  return a({
@@ -0,0 +1,43 @@
1
+ import { shallowRef as S, watch as k, getCurrentScope as C, onScopeDispose as D, computed as v } from "vue";
2
+ import { useI18n as E } from "vue-i18n";
3
+ import { u as x } from "./describeError-CvGmajU0.js";
4
+ const f = Symbol("vue-core.load.abandoned");
5
+ function M(m, t = {}) {
6
+ const { t: g } = E(), b = x(), p = t.errorMessage ?? ((a) => b(a, { fallback: g("core.resource.unavailable") })), e = S({ status: "loading" });
7
+ let u = 0, s = null;
8
+ function n() {
9
+ return s?.abort(), s = null, ++u;
10
+ }
11
+ async function l() {
12
+ const a = n(), i = e.value, r = "value" in i ? i : null;
13
+ e.value = r ? { status: "refreshing", value: r.value } : { status: "loading" };
14
+ const c = new AbortController();
15
+ s = c;
16
+ try {
17
+ const o = await m({ signal: c.signal, abandon: w });
18
+ a === u && (e.value = { status: "loaded", value: o });
19
+ } catch (o) {
20
+ if (a !== u || o === f) return;
21
+ const d = p(o);
22
+ e.value = r ? { status: "stale", value: r.value, error: d } : { status: "failed", error: d };
23
+ }
24
+ }
25
+ function w() {
26
+ throw f;
27
+ }
28
+ function h(a) {
29
+ n(), e.value = { status: "loaded", value: a };
30
+ }
31
+ function y() {
32
+ e.value = { status: "loading" }, l();
33
+ }
34
+ return t.watch !== void 0 ? k(t.watch, y, { immediate: t.immediate ?? !0 }) : (t.immediate ?? !0) && l(), C() && D(n), {
35
+ state: v(() => e.value),
36
+ data: v(() => "value" in e.value ? e.value.value : null),
37
+ reload: l,
38
+ update: h
39
+ };
40
+ }
41
+ export {
42
+ M as u
43
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wssto2/vue-core",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "goCore": "v1.7.0",
5
5
  "description": "Shared Vue 3 library for go-core applications: app shell, list / record / form pages and their controls.",
6
6
  "keywords": [
@@ -1,39 +0,0 @@
1
- import { shallowRef as h, watch as k, getCurrentScope as y, onScopeDispose as C, computed as v } from "vue";
2
- import { useI18n as D } from "vue-i18n";
3
- import { u as E } from "./describeError-Ctga6GcS.js";
4
- function I(f, t = {}) {
5
- const { t: m } = D(), g = E(), p = t.errorMessage ?? ((a) => g(a, { fallback: m("core.resource.unavailable") })), e = h({ status: "loading" });
6
- let s = 0, u = null;
7
- function l() {
8
- return u?.abort(), u = null, ++s;
9
- }
10
- async function o() {
11
- const a = l(), i = e.value, r = "value" in i ? i : null;
12
- e.value = r ? { status: "refreshing", value: r.value } : { status: "loading" };
13
- const c = new AbortController();
14
- u = c;
15
- try {
16
- const n = await f({ signal: c.signal });
17
- a === s && (e.value = { status: "loaded", value: n });
18
- } catch (n) {
19
- if (a !== s) return;
20
- const d = p(n);
21
- e.value = r ? { status: "stale", value: r.value, error: d } : { status: "failed", error: d };
22
- }
23
- }
24
- function w(a) {
25
- l(), e.value = { status: "loaded", value: a };
26
- }
27
- function b() {
28
- e.value = { status: "loading" }, o();
29
- }
30
- return t.watch !== void 0 ? k(t.watch, b, { immediate: t.immediate ?? !0 }) : (t.immediate ?? !0) && o(), y() && C(l), {
31
- state: v(() => e.value),
32
- data: v(() => "value" in e.value ? e.value.value : null),
33
- reload: o,
34
- update: w
35
- };
36
- }
37
- export {
38
- I as u
39
- };