@parallelworks/tandem-web 0.139.2 → 0.139.3
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/index.js +32 -26
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import { ErrorMessage as r, Pending as i } from "./components/status.js";
|
|
|
3
3
|
import { issueAddresses as a } from "./lib/branch.js";
|
|
4
4
|
import { ErrorPage as o } from "@parallelworks/ui";
|
|
5
5
|
import { notFound as s, redirect as c } from "@tanstack/react-router";
|
|
6
|
-
import {
|
|
7
|
-
import { jsx as
|
|
6
|
+
import { use as l } from "react";
|
|
7
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
8
8
|
// src/integration.tsx
|
|
9
|
-
var
|
|
9
|
+
var d = /* @__PURE__ */ new Set([
|
|
10
10
|
"api",
|
|
11
11
|
"auth",
|
|
12
12
|
".well-known",
|
|
@@ -17,14 +17,17 @@ var f = l(() => import("./hostedApp.js")), p = /* @__PURE__ */ new Set([
|
|
|
17
17
|
"readyz",
|
|
18
18
|
"problems"
|
|
19
19
|
]);
|
|
20
|
-
function
|
|
21
|
-
t(
|
|
22
|
-
let m, g = () => (
|
|
20
|
+
function f({ mountPath: f }) {
|
|
21
|
+
t(f);
|
|
22
|
+
let m, g, _ = () => (g ??= Promise.all([import("./hostedApp.js"), import("./lib/queryClient.js").then((e) => e.createQueryClient())]).then(([e, t]) => (m = {
|
|
23
|
+
HostedApp: e.default,
|
|
24
|
+
client: t
|
|
25
|
+
}, m)), g), v, y, b, x = !1, S = async (e) => {
|
|
23
26
|
let t = v, r = y;
|
|
24
27
|
throw !t || !r ? Error("Tandem: call mount and connect before opening a page") : (b ??= import("./pages.js").then(({ splitPages: e }) => {
|
|
25
28
|
let i = e();
|
|
26
29
|
for (let e of i.frameless) Object.assign(e.options, { path: n + e.options.path });
|
|
27
|
-
|
|
30
|
+
p(r.framed, i.framed), p(r.frameless, i.frameless), t.setRoutes(t.buildRouteTree()), x = !0;
|
|
28
31
|
}), await b, c({
|
|
29
32
|
href: e,
|
|
30
33
|
replace: !0
|
|
@@ -32,21 +35,24 @@ function m({ mountPath: l }) {
|
|
|
32
35
|
};
|
|
33
36
|
return {
|
|
34
37
|
mountPath: n,
|
|
35
|
-
contains:
|
|
36
|
-
hosts: (t) =>
|
|
38
|
+
contains: h,
|
|
39
|
+
hosts: (t) => h(t) && !d.has(e(t).split("/")[1] ?? ""),
|
|
37
40
|
route: {
|
|
38
|
-
beforeLoad: async ({ location: e }) =>
|
|
41
|
+
beforeLoad: async ({ location: e }) => {
|
|
42
|
+
let t = _();
|
|
43
|
+
return x || await S(e.href), { queryClient: (await t).client };
|
|
44
|
+
},
|
|
39
45
|
pendingComponent: i,
|
|
40
|
-
errorComponent: ({ error: e }) => /* @__PURE__ */
|
|
41
|
-
notFoundComponent: (e) => /* @__PURE__ */
|
|
46
|
+
errorComponent: ({ error: e }) => /* @__PURE__ */ u(r, { error: e }),
|
|
47
|
+
notFoundComponent: (e) => /* @__PURE__ */ u("div", {
|
|
42
48
|
className: "flex h-full",
|
|
43
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ u(o, { status: 404 })
|
|
44
50
|
})
|
|
45
51
|
},
|
|
46
52
|
placeholder: {
|
|
47
53
|
beforeLoad: async ({ location: e }) => {
|
|
48
54
|
if (x) throw s();
|
|
49
|
-
await S(e.href);
|
|
55
|
+
_(), await S(e.href);
|
|
50
56
|
},
|
|
51
57
|
pendingComponent: i
|
|
52
58
|
},
|
|
@@ -60,27 +66,27 @@ function m({ mountPath: l }) {
|
|
|
60
66
|
v = e;
|
|
61
67
|
},
|
|
62
68
|
rewrite: {
|
|
63
|
-
input: (e) =>
|
|
64
|
-
output: (e) =>
|
|
69
|
+
input: (e) => h(e.url.pathname) ? a.input?.(e) : void 0,
|
|
70
|
+
output: (e) => h(e.url.pathname) ? a.output?.(e) : void 0
|
|
65
71
|
},
|
|
66
72
|
Provider({ host: e, children: t }) {
|
|
67
|
-
let n =
|
|
68
|
-
return /* @__PURE__ */
|
|
73
|
+
let { HostedApp: n, client: r } = m ?? l(_());
|
|
74
|
+
return /* @__PURE__ */ u(n, {
|
|
69
75
|
host: e,
|
|
70
|
-
queryClient:
|
|
76
|
+
queryClient: r,
|
|
71
77
|
children: t
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
80
|
};
|
|
75
81
|
}
|
|
76
|
-
function
|
|
82
|
+
function p(e, t) {
|
|
77
83
|
for (let n of t) Object.assign(n.options, { getParentRoute: () => e });
|
|
78
|
-
e.addChildren([...
|
|
79
|
-
e.options.preloadStaleTime ??= 0, e.options.pendingComponent ??= i, e.options.errorComponent ??= ({ error: e }) => /* @__PURE__ */
|
|
84
|
+
e.addChildren([...m(e), ...t]), g(t, (e) => {
|
|
85
|
+
e.options.preloadStaleTime ??= 0, e.options.pendingComponent ??= i, e.options.errorComponent ??= ({ error: e }) => /* @__PURE__ */ u(r, { error: e });
|
|
80
86
|
});
|
|
81
87
|
}
|
|
82
|
-
var
|
|
83
|
-
function
|
|
84
|
-
for (let n of e) t(n), n.children &&
|
|
88
|
+
var m = (e) => Array.isArray(e.children) ? e.children : Object.values(e.children ?? {}), h = (e) => e === n || e.startsWith(`${n}/`);
|
|
89
|
+
function g(e, t) {
|
|
90
|
+
for (let n of e) t(n), n.children && g(m(n), t);
|
|
85
91
|
}
|
|
86
|
-
export {
|
|
92
|
+
export { f as createTandem };
|