@das-fed/web 7.0.7-hot.74 → 7.0.7-hot.76

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.
Binary file
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { J as e, A as t, C as n, B as i, D as r, e as u, m as o, w as m, o as p, f as g, k as D, v as l, y as L, z as b, h as c, i as h, G as A, H as T, q as y, E as R, F as W, K as I, I as M, s as F, j as V, n as f, r as k, x as v, t as w } from "./index-DWQBmiPa.js";
1
+ import { J as e, A as t, C as n, B as i, D as r, e as u, m as o, w as m, o as p, f as g, k as D, v as l, y as L, z as b, h as c, i as h, G as A, H as T, q as y, E as R, F as W, K as I, I as M, s as F, j as V, n as f, r as k, x as v, t as w } from "./index-lNIT4x7Y.js";
2
2
  export {
3
3
  e as DasMainAppLayout,
4
4
  t as DasWebLayout,
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@das-fed/web",
3
- "version": "7.0.7-hot.74",
3
+ "version": "7.0.7-hot.76",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@das-fed/ui": "7.0.7-hot.74",
8
- "@das-fed/utils": "7.0.7-hot.74",
9
- "@das-fed/web": "7.0.7-hot.74",
10
- "@das-fed/web-components": "7.0.7-hot.74",
7
+ "@das-fed/ui": "7.0.7-hot.76",
8
+ "@das-fed/utils": "7.0.7-hot.76",
9
+ "@das-fed/web": "7.0.7-hot.76",
10
+ "@das-fed/web-components": "7.0.7-hot.76",
11
11
  "@microsoft/signalr": "^8.0.7",
12
12
  "@vueuse/core": "^9.13.0",
13
13
  "animate.css": "^4.1.1",
@@ -19,7 +19,7 @@
19
19
  "vue-router": "^4.4.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@das-fed/cli": "7.0.7-hot.74",
22
+ "@das-fed/cli": "7.0.7-hot.76",
23
23
  "@types/crypto-js": "^4.2.2",
24
24
  "@types/lodash": "^4.14.194",
25
25
  "@types/lodash-es": "^4.17.12",
@@ -1,58 +1,153 @@
1
- import { ref as x, createApp as O } from "vue";
2
- import { initTheme as P } from "@das-fed/web/packages/theme/index";
3
- import { initI18n as W } from "@das-fed/web/packages/i18n/index";
4
- import { DasWebLayout as $ } from "@das-fed/web/packages/layout/index";
5
- import { createPinia as j } from "pinia";
6
- import k from "pinia-plugin-persistedstate";
7
- import { createRouter as y, createWebHistory as D } from "vue-router";
8
- const N = {
9
- install: (e, a) => {
10
- var l;
11
- const c = (l = a == null ? void 0 : a.plugins) == null ? void 0 : l.glob;
12
- c && Object.values(c).sort((t, u) => (t.index ?? 0) - (u.index ?? 0)).filter((t) => t ? !!(t.default && t.default.install || t.install) : !1).forEach((t) => {
13
- t.default && t.default.install && e.use(t.default, a), t.install && e.use(t, a);
1
+ import { ref as L, createApp as D } from "vue";
2
+ import { initTheme as H } from "@das-fed/web/packages/theme/index";
3
+ import { initI18n as T } from "@das-fed/web/packages/i18n/index";
4
+ import { DasWebLayout as G } from "@das-fed/web/packages/layout/index";
5
+ import { createPinia as N } from "pinia";
6
+ import Q from "pinia-plugin-persistedstate";
7
+ import { createRouter as U, createWebHistory as _ } from "vue-router";
8
+ const C = {
9
+ install: (e, s) => {
10
+ var a;
11
+ const r = (a = s == null ? void 0 : s.plugins) == null ? void 0 : a.glob;
12
+ r && Object.values(r).sort((n, t) => (n.index ?? 0) - (t.index ?? 0)).filter((n) => n ? !!(n.default && n.default.install || n.install) : !1).forEach((n) => {
13
+ n.default && n.default.install && e.use(n.default, s), n.install && e.use(n, s);
14
14
  });
15
15
  }
16
- }, d = j();
17
- d.use(k);
18
- const B = (e) => {
19
- var i, h, b, A, g;
20
- const a = ((i = e == null ? void 0 : e.router) == null ? void 0 : i.routerBase) ?? "/", c = ((h = e == null ? void 0 : e.router) == null ? void 0 : h.options) || {};
21
- let l = Object.assign(((b = e == null ? void 0 : e.router) == null ? void 0 : b.glob) || {});
22
- const t = Object.values(l).filter((f) => !!f).flat().sort((f, m) => (f.index ?? 0) - (m.index ?? 0)), u = [];
23
- (A = e == null ? void 0 : e.microApps) == null || A.map((f) => {
24
- var p;
25
- const m = Object.values(((p = f.router) == null ? void 0 : p.glob) || {}).filter((r) => !!r).flat().sort((r, v) => (r.index ?? 0) - (v.index ?? 0));
26
- u.push(
27
- ...m.map((r) => ({ ...r, path: `/${f.microAppName}${r.path}` }))
28
- ), u.push(
29
- ...m.filter((r) => !!r.path).filter((r) => r.path !== "").filter((r) => r.path !== "/").filter((r) => !r.path.startsWith(`/${r.microAppName}`)).map((r) => ({
30
- path: r.path,
31
- redirect: `/${f.microAppName}${r.path}`,
32
- meta: { ...r.meta || {}, isMicroAppRouteRedirect: !0 }
33
- }))
34
- );
16
+ }, A = N();
17
+ A.use(Q);
18
+ const d = "::", f = (e) => {
19
+ if (!e) return "";
20
+ const r = (e.startsWith("/") ? e : `/${e}`).replace(/\/{2,}/g, "/");
21
+ return r.length > 1 && r.endsWith("/") ? r.slice(0, -1) : r;
22
+ }, O = (e) => `/${e.replace(/^\/+|\/+$/g, "")}`, $ = (e, s) => {
23
+ const r = O(s), a = f(e);
24
+ return a === r || a.startsWith(`${r}/`);
25
+ }, o = (e, s) => {
26
+ const r = O(e), a = f(s);
27
+ return !a || a === "/" ? r : $(a, e) ? a : `${r}${a}`;
28
+ }, B = (e, s) => {
29
+ const r = f(e).split("/").filter(Boolean), a = f(s).split("/").filter(Boolean);
30
+ let n = 0;
31
+ for (let t = 0; t < r.length; t++) {
32
+ const i = r[t];
33
+ if (i === "*" || i.startsWith("*") || i.includes("(.*")) return !0;
34
+ const c = i.endsWith("?");
35
+ if (n >= a.length)
36
+ return c && r.slice(t).every((h) => h.endsWith("?"));
37
+ if (i.startsWith(":")) {
38
+ n += 1;
39
+ continue;
40
+ }
41
+ if (i !== a[n]) return !1;
42
+ n += 1;
43
+ }
44
+ return n === a.length;
45
+ }, I = (e, s = "") => {
46
+ const r = [];
47
+ return e.forEach((a) => {
48
+ const n = typeof (a == null ? void 0 : a.path) == "string" ? a.path : "";
49
+ let t = s;
50
+ n.startsWith("/") ? t = f(n) : n && (t = f(`${s}/${n}`)), t && r.push(t), Array.isArray(a == null ? void 0 : a.children) && a.children.length && r.push(...I(a.children, t));
51
+ }), r;
52
+ }, F = (e) => {
53
+ const s = /* @__PURE__ */ new Set(), r = (a) => {
54
+ a.forEach((n) => {
55
+ typeof (n == null ? void 0 : n.name) == "string" && n.name && s.add(n.name), Array.isArray(n == null ? void 0 : n.children) && r(n.children);
56
+ });
57
+ };
58
+ return r(e), s;
59
+ }, b = (e, s, r, a) => {
60
+ if (typeof e == "string")
61
+ return !e.startsWith("/") || $(e, s) || !r.some((t) => B(t, e)) ? e : o(s, e);
62
+ if (!e || typeof e != "object") return e;
63
+ const n = { ...e };
64
+ return typeof n.name == "string" && a.has(n.name) && !n.name.includes(d) && (n.name = `${s}${d}${n.name}`), typeof n.path == "string" && (n.path = b(n.path, s, r, a)), n;
65
+ }, R = (e, s, r, a) => {
66
+ const n = { ...e }, t = typeof e.path == "string" ? e.path : "";
67
+ t.startsWith("/") && (n.path = o(s, t));
68
+ const i = typeof e.name == "string" ? e.name : void 0;
69
+ if (i && !i.includes(d) && (n.name = `${s}${d}${i}`), n.meta = {
70
+ ...e.meta || {},
71
+ microAppName: s,
72
+ rawPath: t,
73
+ ...i ? { rawName: i } : {}
74
+ }, e.redirect != null && typeof e.redirect != "function" && (n.redirect = b(e.redirect, s, r, a)), typeof e.alias == "string" || Array.isArray(e.alias)) {
75
+ const c = Array.isArray(e.alias) ? e.alias : [e.alias];
76
+ n.alias = c.map((h) => b(h, s, r, a));
77
+ }
78
+ return Array.isArray(e.children) && (n.children = e.children.map((c) => R(c, s, r, a))), n;
79
+ }, J = (e) => typeof e != "string" || e.trim() === "", K = (e, s) => {
80
+ const r = e.filter((t) => !J(t == null ? void 0 : t.path)), a = I(r), n = F(r);
81
+ return {
82
+ routes: r.map((t) => R(t, s, a, n)),
83
+ patterns: a,
84
+ names: n
85
+ };
86
+ }, V = (e) => {
87
+ const s = e.indexOf("#"), r = s >= 0 ? e.slice(s) : "", a = s >= 0 ? e.slice(0, s) : e, n = a.indexOf("?"), t = n >= 0 ? a.slice(0, n) : a, i = n >= 0 ? a.slice(n) : "";
88
+ return { path: t, search: i, hash: r };
89
+ }, k = (e) => (e == null ? void 0 : e.isMainApp) === !0 || (e == null ? void 0 : e.isMainApp) === "true", X = (e) => e ? new URLSearchParams(e.startsWith("?") ? e.slice(1) : e).get("isMainApp") === "true" : !1, z = (e, s) => {
90
+ const r = f(e);
91
+ return s.find((a) => $(r, a.name));
92
+ }, j = (e, s, r, a) => {
93
+ if (!e || !e.startsWith("/") || k(a) || z(e, s) || !r) return e;
94
+ const n = f(e);
95
+ return r.patterns.some((t) => B(t, n)) ? o(r.name, n) : e;
96
+ }, y = (e, s, r) => {
97
+ var t;
98
+ const a = (t = r == null ? void 0 : r.meta) == null ? void 0 : t.microAppName, n = s.find((i) => i.name === a) || z((r == null ? void 0 : r.path) || "", s);
99
+ if (typeof e == "string") {
100
+ const { path: i, search: c, hash: h } = V(e);
101
+ if (X(c)) return e;
102
+ const m = j(i, s, n);
103
+ return m === i ? e : `${m}${c}${h}`;
104
+ }
105
+ if (!e || typeof e != "object" || k(e.query)) return e;
106
+ if (typeof e.name == "string")
107
+ return e.name.includes(d) ? e : n != null && n.names.has(e.name) ? { ...e, name: `${n.name}${d}${e.name}` } : e;
108
+ if (typeof e.path == "string") {
109
+ const i = j(e.path, s, n, e.query);
110
+ return i === e.path ? e : { ...e, path: i };
111
+ }
112
+ return e;
113
+ }, Y = (e, s) => {
114
+ const r = e.push.bind(e), a = e.replace.bind(e), n = e.resolve.bind(e);
115
+ e.push = (t) => r(y(t, s, e.currentRoute.value)), e.replace = (t) => a(y(t, s, e.currentRoute.value)), e.resolve = (t, i) => n(y(t, s, i || e.currentRoute.value), i);
116
+ }, Z = (e) => {
117
+ var v, P, W, w, M;
118
+ const s = ((v = e == null ? void 0 : e.router) == null ? void 0 : v.routerBase) ?? "/", r = ((P = e == null ? void 0 : e.router) == null ? void 0 : P.options) || {};
119
+ let a = Object.assign(((W = e == null ? void 0 : e.router) == null ? void 0 : W.glob) || {});
120
+ const n = Object.values(a).filter((l) => !!l).flat().sort((l, u) => (l.index ?? 0) - (u.index ?? 0)), t = [], i = [];
121
+ (w = e == null ? void 0 : e.microApps) == null || w.map((l) => {
122
+ var S;
123
+ if (!(l != null && l.microAppName)) return;
124
+ const u = Object.values(((S = l.router) == null ? void 0 : S.glob) || {}).filter((g) => !!g).flat().sort((g, E) => (g.index ?? 0) - (E.index ?? 0)), p = K(u, l.microAppName);
125
+ t.push(...p.routes), i.push({
126
+ name: l.microAppName,
127
+ patterns: p.patterns,
128
+ names: p.names
129
+ });
35
130
  });
36
- const s = ((g = e == null ? void 0 : e.router) == null ? void 0 : g.routers) || [], R = [
37
- ...n(t, e),
38
- ...n(s, e),
39
- ...n(u, e)
40
- ];
41
- return { router: y({ history: D(a), routes: R, ...c }) };
42
- }, n = (e, a) => e.map((c) => {
43
- const l = c.meta || {};
44
- return l.keepAlive = l.keepAlive ?? (a == null ? void 0 : a.keepAlive) ?? !0, { ...c, meta: l };
45
- }), w = (e) => {
131
+ const c = ((M = e == null ? void 0 : e.router) == null ? void 0 : M.routers) || [], h = [
132
+ ...x(n, e),
133
+ ...x(c, e),
134
+ ...x(t, e)
135
+ ], m = U({ history: _(s), routes: h, ...r });
136
+ return i.length && Y(m, i), { router: m };
137
+ }, x = (e, s) => e.map((r) => {
138
+ const a = r.meta || {};
139
+ return a.keepAlive = a.keepAlive ?? (s == null ? void 0 : s.keepAlive) ?? !0, { ...r, meta: a };
140
+ }), ie = (e) => {
46
141
  e || (e = {});
47
- const a = x(!0);
48
- Promise.all([P(e), W(e)]).then(() => {
49
- a.value = !1;
142
+ const s = L(!0);
143
+ Promise.all([H(e), T(e)]).then(() => {
144
+ s.value = !1;
50
145
  });
51
- const { container: c, component: l, props: t } = (e == null ? void 0 : e.root) || {}, u = O(l || $, t);
52
- u.use(N, e), u.use(d);
53
- const { router: s } = B(e);
54
- return u.use(s), u.mount(c || "#app"), { app: u, router: s, loading: a, store: d };
146
+ const { container: r, component: a, props: n } = (e == null ? void 0 : e.root) || {}, t = D(a || G, n);
147
+ t.use(C, e), t.use(A);
148
+ const { router: i } = Z(e);
149
+ return t.use(i), t.mount(r || "#app"), { app: t, router: i, loading: s, store: A };
55
150
  };
56
151
  export {
57
- w as createDasWebApp
152
+ ie as createDasWebApp
58
153
  };
@@ -0,0 +1,19 @@
1
+ declare const NAME_SEP = "::";
2
+ declare const hasAppPrefix: (path: string, microAppName: string) => any;
3
+ declare const joinAppPath: (microAppName: string, path: string) => any;
4
+ declare const matchPattern: (pattern: string, path: string) => any;
5
+ declare const collectPatterns: (routes: any[], parentPattern?: string) => {};
6
+ declare const namespaceMicroAppRoutes: (routes: any[], microAppName: string) => {
7
+ routes: any;
8
+ patterns: {};
9
+ names: any;
10
+ };
11
+ type MicroAppRouteIndex = {
12
+ name: string;
13
+ patterns: string[];
14
+ names: Set<string>;
15
+ };
16
+ declare const rewriteNavigation: (to: any, apps: MicroAppRouteIndex[], currentRoute: any) => any;
17
+ declare const installMicroAppNavigation: (router: any, apps: MicroAppRouteIndex[]) => void;
18
+ export { NAME_SEP, collectPatterns, hasAppPrefix, installMicroAppNavigation, joinAppPath, matchPattern, namespaceMicroAppRoutes, rewriteNavigation, };
19
+ export type { MicroAppRouteIndex };
Binary file
Binary file