@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.
Files changed (2) hide show
  1. package/index.js +32 -26
  2. 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 { lazy as l, use as u } from "react";
7
- import { jsx as d } from "react/jsx-runtime";
6
+ import { use as l } from "react";
7
+ import { jsx as u } from "react/jsx-runtime";
8
8
  // src/integration.tsx
9
- var f = l(() => import("./hostedApp.js")), p = /* @__PURE__ */ new Set([
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 m({ mountPath: l }) {
21
- t(l);
22
- let m, g = () => (m ||= import("./lib/queryClient.js").then((e) => e.createQueryClient()), m), v, y, b, x = !1, S = async (e) => {
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
- h(r.framed, i.framed), h(r.frameless, i.frameless), t.setRoutes(t.buildRouteTree()), x = !0;
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) => _(t) && !p.has(e(t).split("/")[1] ?? ""),
38
+ contains: h,
39
+ hosts: (t) => h(t) && !d.has(e(t).split("/")[1] ?? ""),
37
40
  route: {
38
- beforeLoad: async ({ location: e }) => (x || await S(e.href), { queryClient: await g() }),
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__ */ d(r, { error: e }),
41
- notFoundComponent: (e) => /* @__PURE__ */ d("div", {
46
+ errorComponent: ({ error: e }) => /* @__PURE__ */ u(r, { error: e }),
47
+ notFoundComponent: (e) => /* @__PURE__ */ u("div", {
42
48
  className: "flex h-full",
43
- children: /* @__PURE__ */ d(o, { status: 404 })
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) => _(e.url.pathname) ? a.input?.(e) : void 0,
64
- output: (e) => _(e.url.pathname) ? a.output?.(e) : void 0
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 = u(g());
68
- return /* @__PURE__ */ d(f, {
73
+ let { HostedApp: n, client: r } = m ?? l(_());
74
+ return /* @__PURE__ */ u(n, {
69
75
  host: e,
70
- queryClient: n,
76
+ queryClient: r,
71
77
  children: t
72
78
  });
73
79
  }
74
80
  };
75
81
  }
76
- function h(e, t) {
82
+ function p(e, t) {
77
83
  for (let n of t) Object.assign(n.options, { getParentRoute: () => e });
78
- e.addChildren([...g(e), ...t]), v(t, (e) => {
79
- e.options.preloadStaleTime ??= 0, e.options.pendingComponent ??= i, e.options.errorComponent ??= ({ error: e }) => /* @__PURE__ */ d(r, { error: e });
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 g = (e) => Array.isArray(e.children) ? e.children : Object.values(e.children ?? {}), _ = (e) => e === n || e.startsWith(`${n}/`);
83
- function v(e, t) {
84
- for (let n of e) t(n), n.children && v(g(n), t);
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 { m as createTandem };
92
+ export { f as createTandem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.139.2",
3
+ "version": "0.139.3",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",