@parallelworks/tandem-web 0.179.2 → 0.181.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.
- package/_virtual/_virtual_i18n/en/common.js +66 -19
- package/_virtual/_virtual_i18n/es/common.js +66 -19
- package/_virtual/_virtual_i18n/ja/common.js +66 -19
- package/_virtual/_virtual_i18n/ko/common.js +66 -19
- package/_virtual/_virtual_i18n/zh/common.js +66 -19
- package/components/AgentWork.js +419 -382
- package/components/DocOutline.js +38 -35
- package/components/DocSeries.js +92 -88
- package/components/DocStart.js +288 -0
- package/components/DocTable.js +100 -93
- package/components/HoverCards.js +139 -124
- package/components/SharedViewer.js +1 -0
- package/components/SubpageViews.js +475 -0
- package/lib/docs.js +76 -65
- package/lib/glossary.js +11 -7
- package/lib/subpageViews.js +85 -0
- package/package.json +1 -1
- package/pages/decisions.js +90 -168
- package/routes/_workspace/docs/_doc2.js +236 -179
- package/routes/_workspace/docs/space2._space.js +113 -172
- package/routes/_workspace/teams/_key/settings2.js +94 -22
- package/routes/_workspace2.js +9 -9
- package/components/DocCalendar.js +0 -245
package/components/HoverCards.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
2
|
import { docQuery as n, docsQuery as r, knowledgeQuery as i, membersQuery as a, teamsQuery as o } from "../api/queries.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
3
|
+
import { appPath as s } from "../lib/base.js";
|
|
4
|
+
import { docLooks as c } from "../lib/docLooks.js";
|
|
5
|
+
import { docKey as l, docRef as u } from "../lib/docs.js";
|
|
6
|
+
import { glossary as d, headingAnchor as f } from "../lib/glossary.js";
|
|
7
|
+
import { issueRefs as p } from "../lib/issueRefs.js";
|
|
8
|
+
import { useTermRefs as m } from "../lib/knowledge.js";
|
|
9
|
+
import { termRef as h } from "../lib/knowledgeKinds.js";
|
|
10
|
+
import { mentionable as g } from "../lib/mentions.js";
|
|
11
|
+
import { Link as _, useNavigate as v } from "../lib/router.js";
|
|
12
|
+
import { teamNames as y } from "../lib/teamNames.js";
|
|
13
|
+
import { DocIcon as b } from "./DocIcon.js";
|
|
14
|
+
import { termCaretEvent as x } from "./editorPlugins.js";
|
|
15
|
+
import { FileTextIcon as S } from "./icons.js";
|
|
16
|
+
import { PersonCard as C } from "./PersonHoverCard.js";
|
|
17
|
+
import { HoverCard as w, Loader as T } from "@parallelworks/ui";
|
|
18
|
+
import { useEffect as E, useRef as D, useState as O } from "react";
|
|
19
|
+
import { useTranslations as k } from "use-intl";
|
|
20
|
+
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
21
|
+
import { useQuery as N, useQueryClient as P } from "@tanstack/react-query";
|
|
21
22
|
// src/components/HoverCards.tsx
|
|
22
|
-
var
|
|
23
|
-
function
|
|
24
|
-
let t = e?.closest(
|
|
23
|
+
var F = ".kb-term, .person-mention, .prose-issue a[href*=\"/docs/\"]", I = 300, L = 200;
|
|
24
|
+
function R(e) {
|
|
25
|
+
let t = e?.closest(F);
|
|
25
26
|
if (!t) return null;
|
|
26
27
|
if (t.classList.contains("kb-term")) {
|
|
27
28
|
let e = t.dataset.term;
|
|
@@ -43,79 +44,88 @@ function L(e) {
|
|
|
43
44
|
return r?.[1] ? {
|
|
44
45
|
kind: "doc",
|
|
45
46
|
el: t,
|
|
46
|
-
key:
|
|
47
|
+
key: l(r[1])
|
|
47
48
|
} : null;
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
function z(e) {
|
|
51
|
+
if (!e.closest(".ProseMirror")) return null;
|
|
52
|
+
let t = new URL(e.getAttribute("href") ?? "", location.href);
|
|
53
|
+
if (t.origin !== location.origin) return null;
|
|
54
|
+
let n = s(t.pathname);
|
|
55
|
+
return /^\/[^/]+\/docs\/(?!space\/)[^/]+\/?$/.test(n) ? n + t.hash : null;
|
|
56
|
+
}
|
|
57
|
+
function B({ workspace: n }) {
|
|
58
|
+
let [s, l] = O(null), u = D(null), f = D(void 0), { data: m } = N(i(n)), _ = v(), b = D((e) => {});
|
|
59
|
+
b.current = (e) => {
|
|
60
|
+
let t = m?.find((t) => t.id === e);
|
|
61
|
+
_({
|
|
54
62
|
to: "/$workspace/knowledge/$term",
|
|
55
63
|
params: {
|
|
56
64
|
workspace: n,
|
|
57
|
-
term: t ?
|
|
65
|
+
term: t ? h(t) : e
|
|
58
66
|
}
|
|
59
67
|
});
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
}, [
|
|
63
|
-
let { data:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}, [
|
|
67
|
-
let { data:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
let { data: k } =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, [k]),
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
}, E(() => {
|
|
69
|
+
d.set(m ?? []);
|
|
70
|
+
}, [m]), E(() => () => d.set([]), []);
|
|
71
|
+
let { data: S } = N(r(n));
|
|
72
|
+
E(() => {
|
|
73
|
+
c.set(S ?? []);
|
|
74
|
+
}, [S]), E(() => () => c.set([]), []);
|
|
75
|
+
let { data: T } = N(a(n));
|
|
76
|
+
E(() => {
|
|
77
|
+
g.set((T ?? []).map((e) => e.user.username));
|
|
78
|
+
}, [T]), E(() => () => g.set([]), []);
|
|
79
|
+
let { data: k } = N(o(n));
|
|
80
|
+
E(() => {
|
|
81
|
+
y.set(k ?? []);
|
|
82
|
+
}, [k]), E(() => () => y.set([]), []);
|
|
83
|
+
let A = P();
|
|
84
|
+
E(() => {
|
|
85
|
+
p.set(n, async (r) => {
|
|
78
86
|
let { issues: i } = t(await e.POST("/api/v1/workspaces/{workspace}/issue-refs", {
|
|
79
87
|
params: { path: { workspace: n } },
|
|
80
88
|
body: { identifiers: r }
|
|
81
89
|
}));
|
|
82
90
|
return new Map(i.map((e) => [e.identifier, e.issue]));
|
|
83
91
|
});
|
|
84
|
-
let r, i =
|
|
85
|
-
e.type === "updated" && e.query.queryKey[2] === "issues" && (clearTimeout(r), r = setTimeout(() =>
|
|
92
|
+
let r, i = A.getQueryCache().subscribe((e) => {
|
|
93
|
+
e.type === "updated" && e.query.queryKey[2] === "issues" && (clearTimeout(r), r = setTimeout(() => p.refresh(), 1e3));
|
|
86
94
|
});
|
|
87
95
|
return () => {
|
|
88
|
-
clearTimeout(r), i(),
|
|
96
|
+
clearTimeout(r), i(), p.set("", void 0);
|
|
89
97
|
};
|
|
90
|
-
}, [n,
|
|
91
|
-
let
|
|
92
|
-
|
|
98
|
+
}, [n, A]);
|
|
99
|
+
let M = D((e) => {});
|
|
100
|
+
M.current = (e) => _({
|
|
93
101
|
to: "/$workspace/issues/$identifier",
|
|
94
102
|
params: {
|
|
95
103
|
workspace: n,
|
|
96
104
|
identifier: e
|
|
97
105
|
}
|
|
98
106
|
});
|
|
99
|
-
let
|
|
100
|
-
|
|
107
|
+
let F = D((e) => {});
|
|
108
|
+
F.current = (e) => _({ href: e });
|
|
109
|
+
let B = D((e) => {});
|
|
110
|
+
B.current = (e) => _({
|
|
101
111
|
to: "/$workspace/teams/$key/issues",
|
|
102
112
|
params: {
|
|
103
113
|
workspace: n,
|
|
104
114
|
key: e
|
|
105
115
|
}
|
|
106
|
-
}),
|
|
116
|
+
}), E(() => {
|
|
107
117
|
let e = (e, t) => {
|
|
108
|
-
clearTimeout(
|
|
118
|
+
clearTimeout(f.current), f.current = setTimeout(e, t);
|
|
109
119
|
}, t = (t) => {
|
|
110
120
|
if (t.pointerType === "touch") return;
|
|
111
|
-
let n =
|
|
112
|
-
n && e(() => l(n),
|
|
121
|
+
let n = R(t.target);
|
|
122
|
+
n && e(() => l(n), I);
|
|
113
123
|
}, n = (t) => {
|
|
114
124
|
let n = t.relatedTarget;
|
|
115
|
-
n &&
|
|
125
|
+
n && u.current?.contains(n) || R(t.target) && e(() => l(null), L);
|
|
116
126
|
}, r = (e) => {
|
|
117
|
-
let t =
|
|
118
|
-
t && (clearTimeout(
|
|
127
|
+
let t = R(e.target);
|
|
128
|
+
t && (clearTimeout(f.current), l(t));
|
|
119
129
|
}, i = (e) => {
|
|
120
130
|
e.target.matches?.(".kb-term[tabindex], .prose-issue a[href*=\"/docs/\"]") && r(e);
|
|
121
131
|
}, a = (e) => {
|
|
@@ -126,96 +136,101 @@ function R({ workspace: n }) {
|
|
|
126
136
|
return;
|
|
127
137
|
}
|
|
128
138
|
if (!t.closest("[contenteditable=\"true\"]")) {
|
|
129
|
-
e.preventDefault(),
|
|
139
|
+
e.preventDefault(), M.current(n);
|
|
130
140
|
return;
|
|
131
141
|
}
|
|
132
142
|
}
|
|
133
|
-
let a = e.target.closest?.("
|
|
134
|
-
if (a && o
|
|
135
|
-
e.preventDefault(),
|
|
143
|
+
let a = e.target.closest?.("a[href]"), o = a && e.button === 0 ? z(a) : null;
|
|
144
|
+
if (a && o) {
|
|
145
|
+
e.preventDefault(), l(null), e.metaKey || e.ctrlKey || e.shiftKey ? window.open(a.href, "_blank", "noopener") : F.current(o);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
let s = e.target.closest?.(".team-mention"), c = s?.dataset.team;
|
|
149
|
+
if (s && c && (!s.closest("[contenteditable=\"true\"]") || e.metaKey || e.ctrlKey)) {
|
|
150
|
+
e.preventDefault(), B.current(c);
|
|
136
151
|
return;
|
|
137
152
|
}
|
|
138
|
-
let
|
|
139
|
-
if (!
|
|
140
|
-
let
|
|
141
|
-
|
|
153
|
+
let u = e.target.closest?.(".kb-term");
|
|
154
|
+
if (!u) return;
|
|
155
|
+
let d = u.dataset.term;
|
|
156
|
+
d && (!u.closest("[contenteditable=\"true\"]") || e.metaKey || e.ctrlKey) ? (e.preventDefault(), l(null), b.current(d)) : r(e);
|
|
142
157
|
}, o = (e) => {
|
|
143
158
|
if (e.button !== 1) return;
|
|
144
|
-
let t = e.target.closest?.("a
|
|
145
|
-
t?.closest("[contenteditable=\"true\"]") && (e.preventDefault(), window.open(t.href, "_blank", "noopener"));
|
|
159
|
+
let t = e.target.closest?.("a[href]");
|
|
160
|
+
t?.closest("[contenteditable=\"true\"]") && (t.classList.contains("issue-mention") || z(t)) && (e.preventDefault(), window.open(t.href, "_blank", "noopener"));
|
|
146
161
|
}, s = (e) => {
|
|
147
|
-
e.key === "Escape" &&
|
|
162
|
+
e.key === "Escape" && u.current?.isConnected && (e.stopPropagation(), e.preventDefault(), l((e) => (e?.el.tabIndex === 0 && e.el.focus(), null)));
|
|
148
163
|
};
|
|
149
|
-
return document.addEventListener("pointerover", t), document.addEventListener("pointerout", n), document.addEventListener("focusin", i), document.addEventListener("click", a), document.addEventListener("auxclick", o), document.addEventListener(
|
|
150
|
-
clearTimeout(
|
|
164
|
+
return document.addEventListener("pointerover", t), document.addEventListener("pointerout", n), document.addEventListener("focusin", i), document.addEventListener("click", a), document.addEventListener("auxclick", o), document.addEventListener(x, r), document.addEventListener("keydown", s, !0), () => {
|
|
165
|
+
clearTimeout(f.current), document.removeEventListener("pointerover", t), document.removeEventListener("pointerout", n), document.removeEventListener("focusin", i), document.removeEventListener("click", a), document.removeEventListener("auxclick", o), document.removeEventListener(x, r), document.removeEventListener("keydown", s, !0);
|
|
151
166
|
};
|
|
152
|
-
}, []),
|
|
153
|
-
if (!
|
|
167
|
+
}, []), E(() => {
|
|
168
|
+
if (!s) return;
|
|
154
169
|
let e = (e) => {
|
|
155
170
|
let t = e.target;
|
|
156
|
-
!
|
|
171
|
+
!u.current?.contains(t) && !s.el.contains(t) && l(null);
|
|
157
172
|
};
|
|
158
173
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
159
|
-
}, [
|
|
160
|
-
let
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
at:
|
|
163
|
-
open: !!
|
|
174
|
+
}, [s]);
|
|
175
|
+
let H = s?.el.isConnected ? s : null;
|
|
176
|
+
return /* @__PURE__ */ j(w, {
|
|
177
|
+
at: H?.el ?? null,
|
|
178
|
+
open: !!H,
|
|
164
179
|
onOpenChange: (e) => {
|
|
165
180
|
e || l(null);
|
|
166
181
|
},
|
|
167
|
-
onPointerEnter: () => clearTimeout(
|
|
182
|
+
onPointerEnter: () => clearTimeout(f.current),
|
|
168
183
|
onPointerLeave: () => {
|
|
169
|
-
clearTimeout(
|
|
184
|
+
clearTimeout(f.current), f.current = setTimeout(() => l(null), L);
|
|
170
185
|
},
|
|
171
|
-
card:
|
|
172
|
-
ref:
|
|
186
|
+
card: H && /* @__PURE__ */ j("div", {
|
|
187
|
+
ref: u,
|
|
173
188
|
role: "dialog",
|
|
174
|
-
"aria-label":
|
|
175
|
-
className:
|
|
176
|
-
children:
|
|
189
|
+
"aria-label": H.kind === "doc" ? H.key : H.kind === "person" ? H.username : void 0,
|
|
190
|
+
className: H.kind === "person" ? "" : "w-80 max-w-[calc(100vw-16px)] p-3 text-sm",
|
|
191
|
+
children: H.kind === "term" ? /* @__PURE__ */ j(V, {
|
|
177
192
|
workspace: n,
|
|
178
|
-
entry:
|
|
179
|
-
}) :
|
|
193
|
+
entry: m?.find((e) => e.id === H.id)
|
|
194
|
+
}) : H.kind === "person" ? /* @__PURE__ */ j(C, {
|
|
180
195
|
workspace: n,
|
|
181
|
-
handle:
|
|
182
|
-
}) : /* @__PURE__ */
|
|
196
|
+
handle: H.username
|
|
197
|
+
}) : /* @__PURE__ */ j(U, {
|
|
183
198
|
workspace: n,
|
|
184
|
-
docKey:
|
|
199
|
+
docKey: H.key
|
|
185
200
|
})
|
|
186
201
|
})
|
|
187
202
|
});
|
|
188
203
|
}
|
|
189
|
-
function
|
|
190
|
-
let n =
|
|
191
|
-
if (!t) return /* @__PURE__ */
|
|
204
|
+
function V({ workspace: e, entry: t }) {
|
|
205
|
+
let n = k("knowledge"), r = m(e);
|
|
206
|
+
if (!t) return /* @__PURE__ */ j("p", {
|
|
192
207
|
className: "text-muted-foreground",
|
|
193
208
|
children: n("gone")
|
|
194
209
|
});
|
|
195
210
|
let i = t.source.doc;
|
|
196
|
-
return /* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ M(A, { children: [
|
|
212
|
+
/* @__PURE__ */ M("p", {
|
|
198
213
|
className: "flex items-center gap-2",
|
|
199
|
-
children: [/* @__PURE__ */
|
|
214
|
+
children: [/* @__PURE__ */ j(_, {
|
|
200
215
|
to: "/$workspace/knowledge/$term",
|
|
201
216
|
params: {
|
|
202
217
|
workspace: e,
|
|
203
|
-
term:
|
|
218
|
+
term: h(t)
|
|
204
219
|
},
|
|
205
220
|
className: "font-semibold hover:underline",
|
|
206
221
|
children: t.name
|
|
207
|
-
}), /* @__PURE__ */
|
|
222
|
+
}), /* @__PURE__ */ j("span", {
|
|
208
223
|
className: "text-xs text-muted-foreground",
|
|
209
224
|
children: n(`kind.${t.kind}`)
|
|
210
225
|
})]
|
|
211
226
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ j("p", {
|
|
213
228
|
className: "mt-1.5 text-foreground",
|
|
214
229
|
children: t.definition
|
|
215
230
|
}),
|
|
216
|
-
t.supersededBy && /* @__PURE__ */
|
|
231
|
+
t.supersededBy && /* @__PURE__ */ j("p", {
|
|
217
232
|
className: "mt-1.5 text-xs",
|
|
218
|
-
children: /* @__PURE__ */
|
|
233
|
+
children: /* @__PURE__ */ j(_, {
|
|
219
234
|
to: "/$workspace/knowledge/$term",
|
|
220
235
|
params: {
|
|
221
236
|
workspace: e,
|
|
@@ -225,21 +240,21 @@ function z({ workspace: e, entry: t }) {
|
|
|
225
240
|
children: n("supersededBy", { name: t.supersededByName ?? "" })
|
|
226
241
|
})
|
|
227
242
|
}),
|
|
228
|
-
(i || t.source.identifier) && /* @__PURE__ */
|
|
243
|
+
(i || t.source.identifier) && /* @__PURE__ */ M("p", {
|
|
229
244
|
className: "mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",
|
|
230
|
-
children: [i && /* @__PURE__ */
|
|
245
|
+
children: [i && /* @__PURE__ */ M(_, {
|
|
231
246
|
to: "/$workspace/docs/$doc",
|
|
232
247
|
params: {
|
|
233
248
|
workspace: e,
|
|
234
|
-
doc:
|
|
249
|
+
doc: u(i)
|
|
235
250
|
},
|
|
236
|
-
...t.source.section && { hash:
|
|
251
|
+
...t.source.section && { hash: f(t.source.section) },
|
|
237
252
|
className: "inline-flex items-center gap-1 hover:text-foreground",
|
|
238
|
-
children: [/* @__PURE__ */
|
|
253
|
+
children: [/* @__PURE__ */ j(S, { className: "size-3" }), t.source.section ? n("sourceSection", {
|
|
239
254
|
doc: i.title,
|
|
240
255
|
section: t.source.section
|
|
241
256
|
}) : i.title]
|
|
242
|
-
}), t.source.identifier && /* @__PURE__ */
|
|
257
|
+
}), t.source.identifier && /* @__PURE__ */ j(_, {
|
|
243
258
|
to: "/$workspace/issues/$identifier",
|
|
244
259
|
params: {
|
|
245
260
|
workspace: e,
|
|
@@ -249,41 +264,41 @@ function z({ workspace: e, entry: t }) {
|
|
|
249
264
|
children: t.source.identifier
|
|
250
265
|
})]
|
|
251
266
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ j(_, {
|
|
253
268
|
to: "/$workspace/knowledge/$term",
|
|
254
269
|
params: {
|
|
255
270
|
workspace: e,
|
|
256
|
-
term:
|
|
271
|
+
term: h(t)
|
|
257
272
|
},
|
|
258
273
|
className: "mt-2 block text-xs text-primary hover:underline",
|
|
259
274
|
children: n("openEntry")
|
|
260
275
|
})
|
|
261
276
|
] });
|
|
262
277
|
}
|
|
263
|
-
function
|
|
278
|
+
function H(e) {
|
|
264
279
|
return e.split("\n").map((e) => e.replace(/^#{1,6}\s+|^[-*>]\s+|^\d+\.\s+|\[[ x]\]\s*/g, "").replace(/[*_`]/g, "")).filter((e) => e.trim()).slice(0, 4).join(" ").slice(0, 280);
|
|
265
280
|
}
|
|
266
|
-
function
|
|
267
|
-
let r =
|
|
281
|
+
function U({ workspace: e, docKey: t }) {
|
|
282
|
+
let r = k("docLinks"), { data: i, isError: a } = N({
|
|
268
283
|
...n(e, t),
|
|
269
284
|
retry: !1
|
|
270
285
|
});
|
|
271
|
-
return a ? /* @__PURE__ */
|
|
286
|
+
return a ? /* @__PURE__ */ j("p", {
|
|
272
287
|
className: "text-muted-foreground",
|
|
273
288
|
children: r("unavailable")
|
|
274
|
-
}) : i ? /* @__PURE__ */
|
|
289
|
+
}) : i ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ M("p", {
|
|
275
290
|
className: "flex items-center gap-2 font-semibold",
|
|
276
|
-
children: [/* @__PURE__ */
|
|
291
|
+
children: [/* @__PURE__ */ j(b, {
|
|
277
292
|
icon: i.icon,
|
|
278
293
|
className: "size-3.5",
|
|
279
294
|
emojiClassName: "text-xs"
|
|
280
|
-
}), /* @__PURE__ */
|
|
295
|
+
}), /* @__PURE__ */ j("span", {
|
|
281
296
|
className: "truncate",
|
|
282
297
|
children: i.title
|
|
283
298
|
})]
|
|
284
|
-
}), /* @__PURE__ */
|
|
299
|
+
}), /* @__PURE__ */ j("p", {
|
|
285
300
|
className: "mt-1.5 line-clamp-4 text-muted-foreground",
|
|
286
|
-
children:
|
|
287
|
-
})] }) : /* @__PURE__ */
|
|
301
|
+
children: H(i.body ?? "") || r("empty")
|
|
302
|
+
})] }) : /* @__PURE__ */ j(T, { size: 16 });
|
|
288
303
|
}
|
|
289
|
-
export {
|
|
304
|
+
export { B as HoverCards };
|