@parallelworks/tandem-web 0.139.2 → 0.140.0

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.
@@ -1,13 +1,13 @@
1
1
  import { Link as e } from "../lib/router.js";
2
2
  import { githubAccountQuery as t, meQuery as n } from "../api/queries.js";
3
- import { ChevronDownIcon as r, FolderIcon as i, HistoryIcon as a, KeyIcon as o, LinkIcon as s, NotificationIcon as c, RepositoryIcon as l, SettingsIcon as u, ShieldIcon as d, TagIcon as f, UserIcon as p, UsersIcon as m, WebhookIcon as h, WorkerIcon as g } from "./icons.js";
4
- import { useTranslations as _ } from "use-intl";
5
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
6
- import { useQuery as x, useSuspenseQuery as S } from "@tanstack/react-query";
3
+ import { ChevronDownIcon as r, CommentIcon as i, FolderIcon as a, HistoryIcon as o, KeyIcon as s, LinkIcon as c, NotificationIcon as l, RepositoryIcon as u, SettingsIcon as d, ShieldIcon as f, TagIcon as p, UserIcon as m, UsersIcon as h, WebhookIcon as g, WorkerIcon as _ } from "./icons.js";
4
+ import { useTranslations as v } from "use-intl";
5
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
6
+ import { useQuery as S, useSuspenseQuery as C } from "@tanstack/react-query";
7
7
  // src/components/SettingsNav.tsx
8
- var C = "flex h-8 items-center gap-2.5 rounded-md px-2 text-sm text-muted-foreground hover:bg-muted hover:text-foreground", w = "bg-[var(--theme-sidebar-active-bg,var(--theme-hover))] hover:bg-[var(--theme-sidebar-active-bg,var(--theme-hover))] !text-[var(--theme-sidebar-active-text,var(--theme-app))] font-medium", T = { className: w };
9
- function E() {
10
- let { data: e } = S(n), r = _("settingsNav"), v = e?.mode === "platform", { data: y } = x(t);
8
+ var w = "flex h-8 items-center gap-2.5 rounded-md px-2 text-sm text-muted-foreground hover:bg-muted hover:text-foreground", T = "bg-[var(--theme-sidebar-active-bg,var(--theme-hover))] hover:bg-[var(--theme-sidebar-active-bg,var(--theme-hover))] !text-[var(--theme-sidebar-active-text,var(--theme-app))] font-medium", E = { className: T };
9
+ function D() {
10
+ let { data: e } = C(n), r = v("settingsNav"), y = e?.mode === "platform", { data: b } = S(t);
11
11
  return [
12
12
  {
13
13
  label: r("account"),
@@ -15,31 +15,31 @@ function E() {
15
15
  {
16
16
  to: "/$workspace/settings/account",
17
17
  label: r("profile"),
18
- Icon: p
18
+ Icon: m
19
19
  },
20
20
  {
21
21
  to: "/$workspace/settings/notifications",
22
22
  label: r("notifications"),
23
- Icon: c
23
+ Icon: l
24
24
  },
25
25
  {
26
26
  to: "/$workspace/settings/runners",
27
27
  label: r("runners"),
28
- Icon: g
28
+ Icon: _
29
29
  },
30
- ...y?.enabled ? [{
30
+ ...b?.enabled ? [{
31
31
  to: "/$workspace/settings/connections",
32
32
  label: r("connections"),
33
- Icon: s
33
+ Icon: c
34
34
  }] : [],
35
- ...v ? [] : [{
35
+ ...y ? [] : [{
36
36
  to: "/$workspace/settings/tokens",
37
37
  label: r("tokens"),
38
- Icon: o
38
+ Icon: s
39
39
  }, {
40
40
  to: "/$workspace/settings/sessions",
41
41
  label: r("sessions"),
42
- Icon: d
42
+ Icon: f
43
43
  }]
44
44
  ]
45
45
  },
@@ -49,84 +49,92 @@ function E() {
49
49
  {
50
50
  to: "/$workspace/settings",
51
51
  label: r("general"),
52
- Icon: u
52
+ Icon: d
53
53
  },
54
54
  {
55
55
  to: "/$workspace/settings/members",
56
- label: r(v ? "access" : "members"),
57
- Icon: m
56
+ label: r(y ? "access" : "members"),
57
+ Icon: h
58
58
  },
59
59
  {
60
60
  to: "/$workspace/settings/roles",
61
61
  label: r("roles"),
62
- Icon: d
62
+ Icon: f
63
63
  },
64
64
  {
65
65
  to: "/$workspace/settings/groups",
66
66
  label: r("groups"),
67
- Icon: d
67
+ Icon: f
68
68
  },
69
69
  {
70
70
  to: "/$workspace/settings/teams",
71
71
  label: r("teams"),
72
- Icon: i
72
+ Icon: a
73
73
  },
74
74
  {
75
75
  to: "/$workspace/settings/labels",
76
76
  label: r("labels"),
77
- Icon: f
77
+ Icon: p
78
78
  },
79
79
  {
80
80
  to: "/$workspace/settings/audit-log",
81
81
  label: r("auditLog"),
82
- Icon: a
82
+ Icon: o
83
83
  },
84
- ...v ? [] : [{
84
+ ...y ? [] : [{
85
85
  to: "/$workspace/settings/sso",
86
86
  label: r("sso"),
87
- Icon: o
87
+ Icon: s
88
88
  }]
89
89
  ]
90
90
  },
91
91
  {
92
92
  label: r("integrations"),
93
- items: [{
94
- to: "/$workspace/settings/github",
95
- label: r("github"),
96
- Icon: l
97
- }, {
98
- to: "/$workspace/settings/webhooks",
99
- label: r("webhooks"),
100
- Icon: h
101
- }]
93
+ items: [
94
+ {
95
+ to: "/$workspace/settings/github",
96
+ label: r("github"),
97
+ Icon: u
98
+ },
99
+ {
100
+ to: "/$workspace/settings/slack",
101
+ label: r("slack"),
102
+ Icon: i
103
+ },
104
+ {
105
+ to: "/$workspace/settings/webhooks",
106
+ label: r("webhooks"),
107
+ Icon: g
108
+ }
109
+ ]
102
110
  }
103
111
  ];
104
112
  }
105
- function D({ workspace: t }) {
106
- let n = _("settingsNav"), i = E();
107
- return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b(e, {
113
+ function O({ workspace: t }) {
114
+ let n = v("settingsNav"), i = D();
115
+ return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ x(e, {
108
116
  to: "/$workspace/issues",
109
117
  params: { workspace: t },
110
118
  className: "flex h-9 items-center gap-2 rounded-md px-2 text-sm font-semibold hover:bg-muted",
111
- children: [/* @__PURE__ */ y(r, { className: "size-4 rotate-90 text-muted-foreground" }), n("label")]
112
- }), /* @__PURE__ */ y("nav", {
119
+ children: [/* @__PURE__ */ b(r, { className: "size-4 rotate-90 text-muted-foreground" }), n("label")]
120
+ }), /* @__PURE__ */ b("nav", {
113
121
  "aria-label": n("label"),
114
122
  className: "-mx-3 mt-2 min-h-0 flex-1 overflow-y-auto px-3",
115
- children: i.map((n) => /* @__PURE__ */ b("div", {
123
+ children: i.map((n) => /* @__PURE__ */ x("div", {
116
124
  className: "mt-4 first:mt-0",
117
- children: [/* @__PURE__ */ y("p", {
125
+ children: [/* @__PURE__ */ b("p", {
118
126
  className: "flex h-6 items-center px-2 text-xs font-medium text-muted-foreground",
119
127
  children: n.label
120
- }), /* @__PURE__ */ y("div", {
128
+ }), /* @__PURE__ */ b("div", {
121
129
  className: "mt-1 space-y-0.5",
122
- children: n.items.map(({ to: n, label: r, Icon: i }) => /* @__PURE__ */ b(e, {
130
+ children: n.items.map(({ to: n, label: r, Icon: i }) => /* @__PURE__ */ x(e, {
123
131
  to: n,
124
132
  params: { workspace: t },
125
- className: C,
126
- activeProps: T,
133
+ className: w,
134
+ activeProps: E,
127
135
  activeOptions: { exact: !0 },
128
136
  children: [
129
- /* @__PURE__ */ y(i, { className: "size-4" }),
137
+ /* @__PURE__ */ b(i, { className: "size-4" }),
130
138
  " ",
131
139
  r
132
140
  ]
@@ -135,4 +143,4 @@ function D({ workspace: t }) {
135
143
  }, n.label))
136
144
  })] });
137
145
  }
138
- export { D as SettingsNav, C as navItem, w as navOn, E as useSettingsPages };
146
+ export { O as SettingsNav, w as navItem, T as navOn, D as useSettingsPages };
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.140.0",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",