@parallelworks/tandem-web 0.178.0 → 0.179.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 +45 -16
- package/_virtual/_virtual_i18n/es/common.js +45 -16
- package/_virtual/_virtual_i18n/ja/common.js +45 -16
- package/_virtual/_virtual_i18n/ko/common.js +45 -16
- package/_virtual/_virtual_i18n/zh/common.js +45 -16
- package/components/AgentWork.js +313 -308
- package/components/AreaWork.js +38 -43
- package/components/DocCalendar.js +115 -83
- package/components/DocSeries.js +277 -0
- package/components/Graph.js +1 -1
- package/components/HoverCards.js +88 -111
- package/lib/docSeries.js +80 -0
- package/lib/knowledge.js +0 -6
- package/lib/notifications.js +2 -0
- package/lib/permissionModes.js +7 -1
- package/package.json +1 -1
- package/routes/_workspace/agents/_slug2.js +202 -194
- package/routes/_workspace/docs/space2._space.js +162 -153
- package/routes/_workspace/graph.js +1 -5
- package/routes/_workspace/graph2.js +16 -17
- package/routes/_workspace/graph3.js +70 -82
- package/routes/_workspace/knowledge/_term2.js +126 -130
- package/routes/_workspace/knowledge/index2.js +125 -130
- package/routes/_workspace/notifications2.js +39 -37
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { docTemplatesQuery as e } from "../api/queries.js";
|
|
2
|
+
import { isoDate as t } from "../lib/datePhrases.js";
|
|
3
|
+
import { browserZone as n, docSeriesQuery as r, seriesRepeats as i, useDocSeriesActions as a } from "../lib/docSeries.js";
|
|
4
|
+
import { usePeople as o } from "../lib/people.js";
|
|
5
|
+
import { CycleIcon as s } from "./icons.js";
|
|
6
|
+
import { Button as c, Combobox as l, DatePicker as u, ErrorText as d, Input as f, Modal as p, Popover as m, Select as h, ToggleGroup as g, useClosePopover as _ } from "@parallelworks/ui";
|
|
7
|
+
import { useId as v, useState as y } from "react";
|
|
8
|
+
import { useErrorMessage as b } from "@parallelworks/problem/react";
|
|
9
|
+
import { useFormatter as x, useTranslations as S } from "use-intl";
|
|
10
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
11
|
+
import { useQuery as E } from "@tanstack/react-query";
|
|
12
|
+
// src/components/DocSeries.tsx
|
|
13
|
+
function D() {
|
|
14
|
+
let e = x();
|
|
15
|
+
return Array.from({ length: 7 }, (t, n) => e.dateTime(new Date(2026, 10, 1 + n), { weekday: "short" }));
|
|
16
|
+
}
|
|
17
|
+
function O() {
|
|
18
|
+
let e = S("docSeries"), t = D();
|
|
19
|
+
return (n) => n.repeat === "weekly" || n.repeat === "biweekly" ? e(`summary.${n.repeat}`, { days: n.weekdays.map((e) => t[e]).join(", ") }) : e(`summary.${n.repeat}`);
|
|
20
|
+
}
|
|
21
|
+
function k({ workspace: e, space: t, dateProperty: n }) {
|
|
22
|
+
let r = S("docSeries"), [i, a] = y(null);
|
|
23
|
+
return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(m, {
|
|
24
|
+
trigger: /* @__PURE__ */ T(c, {
|
|
25
|
+
size: "xs",
|
|
26
|
+
children: [/* @__PURE__ */ w(s, {}), r("series")]
|
|
27
|
+
}),
|
|
28
|
+
align: "start",
|
|
29
|
+
className: "w-80",
|
|
30
|
+
"aria-label": r("series"),
|
|
31
|
+
children: /* @__PURE__ */ w(A, {
|
|
32
|
+
workspace: e,
|
|
33
|
+
space: t,
|
|
34
|
+
onEdit: a
|
|
35
|
+
})
|
|
36
|
+
}), i && /* @__PURE__ */ w(j, {
|
|
37
|
+
workspace: e,
|
|
38
|
+
space: t,
|
|
39
|
+
series: i === "new" ? void 0 : i,
|
|
40
|
+
dateProperty: n,
|
|
41
|
+
onClose: () => a(null)
|
|
42
|
+
})] });
|
|
43
|
+
}
|
|
44
|
+
function A({ workspace: e, space: t, onEdit: n }) {
|
|
45
|
+
let i = S("docSeries"), a = _(), o = O(), { data: s = [] } = E(r(e, t));
|
|
46
|
+
return /* @__PURE__ */ T("div", {
|
|
47
|
+
className: "space-y-2",
|
|
48
|
+
children: [s.length === 0 ? /* @__PURE__ */ w("p", {
|
|
49
|
+
className: "text-sm text-muted-foreground",
|
|
50
|
+
children: i("none")
|
|
51
|
+
}) : /* @__PURE__ */ w("ul", {
|
|
52
|
+
className: "divide-y divide-border",
|
|
53
|
+
children: s.map((e) => /* @__PURE__ */ T("li", {
|
|
54
|
+
className: "flex items-center gap-2 py-1.5",
|
|
55
|
+
children: [/* @__PURE__ */ T("span", {
|
|
56
|
+
className: "min-w-0 flex-1",
|
|
57
|
+
children: [/* @__PURE__ */ w("span", {
|
|
58
|
+
className: "block truncate text-sm font-medium",
|
|
59
|
+
children: e.title
|
|
60
|
+
}), /* @__PURE__ */ w("span", {
|
|
61
|
+
className: "block truncate text-xs text-muted-foreground",
|
|
62
|
+
children: e.stoppedAt ? i("stopped") : o(e)
|
|
63
|
+
})]
|
|
64
|
+
}), !e.stoppedAt && /* @__PURE__ */ w(c, {
|
|
65
|
+
size: "xs",
|
|
66
|
+
variant: "ghost",
|
|
67
|
+
onClick: () => {
|
|
68
|
+
a(), n(e);
|
|
69
|
+
},
|
|
70
|
+
children: i("edit")
|
|
71
|
+
})]
|
|
72
|
+
}, e.id))
|
|
73
|
+
}), /* @__PURE__ */ w(c, {
|
|
74
|
+
size: "xs",
|
|
75
|
+
variant: "primary",
|
|
76
|
+
onClick: () => {
|
|
77
|
+
a(), n("new");
|
|
78
|
+
},
|
|
79
|
+
children: i("new")
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function j({ workspace: r, space: s, series: m, dateProperty: _, onClose: x }) {
|
|
84
|
+
let O = S("docSeries"), k = S("common"), A = b(), j = D(), M = v(), N = a(r), { members: P } = o(r), { data: F = [] } = E(e(r)), [I, L] = y(() => m ? {
|
|
85
|
+
title: m.title,
|
|
86
|
+
repeat: m.repeat,
|
|
87
|
+
weekdays: m.weekdays,
|
|
88
|
+
startsOn: m.startsOn,
|
|
89
|
+
template: m.template,
|
|
90
|
+
attendees: m.attendees,
|
|
91
|
+
leadDays: m.leadDays,
|
|
92
|
+
timeZone: m.timeZone,
|
|
93
|
+
...m.dateProperty && { dateProperty: m.dateProperty }
|
|
94
|
+
} : {
|
|
95
|
+
space: s,
|
|
96
|
+
title: "",
|
|
97
|
+
repeat: "weekly",
|
|
98
|
+
weekdays: [(/* @__PURE__ */ new Date()).getDay()],
|
|
99
|
+
startsOn: t(/* @__PURE__ */ new Date()),
|
|
100
|
+
template: "",
|
|
101
|
+
attendees: [],
|
|
102
|
+
leadDays: 1,
|
|
103
|
+
timeZone: n(),
|
|
104
|
+
..._ && { dateProperty: _ }
|
|
105
|
+
}), R = (e) => L((t) => ({
|
|
106
|
+
...t,
|
|
107
|
+
...e
|
|
108
|
+
})), [z, B] = y(!1), V = m ? () => N.update.mutateAsync({
|
|
109
|
+
id: m.id,
|
|
110
|
+
...I
|
|
111
|
+
}).then(x) : () => N.create.mutateAsync(I).then(x), H = N.create.isPending || N.update.isPending, U = N.create.error ?? N.update.error ?? N.stop.error, W = I.repeat === "weekly" || I.repeat === "biweekly", G = "block text-xs font-medium text-muted-foreground";
|
|
112
|
+
return /* @__PURE__ */ w(p, {
|
|
113
|
+
open: !0,
|
|
114
|
+
onClose: x,
|
|
115
|
+
size: "lg",
|
|
116
|
+
title: O(m ? "editTitle" : "newTitle"),
|
|
117
|
+
description: O("description"),
|
|
118
|
+
footer: /* @__PURE__ */ T(C, { children: [
|
|
119
|
+
m && /* @__PURE__ */ w(c, {
|
|
120
|
+
variant: "danger",
|
|
121
|
+
className: "mr-auto",
|
|
122
|
+
loading: N.stop.isPending,
|
|
123
|
+
onClick: () => N.stop.mutateAsync(m.id).then(x),
|
|
124
|
+
children: O("stop")
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ w(c, {
|
|
127
|
+
variant: "secondary",
|
|
128
|
+
onClick: x,
|
|
129
|
+
children: k("cancel")
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ w(c, {
|
|
132
|
+
variant: "primary",
|
|
133
|
+
loading: H,
|
|
134
|
+
disabled: !I.title.trim() || W && (I.weekdays ?? []).length === 0,
|
|
135
|
+
onClick: () => V().catch(() => {}),
|
|
136
|
+
children: m ? k("save") : O("create")
|
|
137
|
+
})
|
|
138
|
+
] }),
|
|
139
|
+
children: /* @__PURE__ */ T("form", {
|
|
140
|
+
className: "space-y-3",
|
|
141
|
+
onSubmit: (e) => {
|
|
142
|
+
e.preventDefault(), V().catch(() => {});
|
|
143
|
+
},
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ w("label", {
|
|
146
|
+
htmlFor: M,
|
|
147
|
+
className: G,
|
|
148
|
+
children: O("title")
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ w(f, {
|
|
151
|
+
id: M,
|
|
152
|
+
value: I.title,
|
|
153
|
+
onChange: (e) => R({ title: e.target.value }),
|
|
154
|
+
placeholder: O("titlePlaceholder"),
|
|
155
|
+
maxLength: 200,
|
|
156
|
+
className: "-mt-2",
|
|
157
|
+
autoFocus: !0
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ T("div", {
|
|
160
|
+
className: "flex flex-wrap items-end gap-3",
|
|
161
|
+
children: [/* @__PURE__ */ T("div", {
|
|
162
|
+
className: G,
|
|
163
|
+
children: [O("repeat"), /* @__PURE__ */ w("div", {
|
|
164
|
+
className: "mt-1",
|
|
165
|
+
children: /* @__PURE__ */ w(h, {
|
|
166
|
+
value: I.repeat,
|
|
167
|
+
items: i.map((e) => ({
|
|
168
|
+
value: e,
|
|
169
|
+
label: O(`repeats.${e}`)
|
|
170
|
+
})),
|
|
171
|
+
onValueChange: (e) => e && R({ repeat: e }),
|
|
172
|
+
"aria-label": O("repeat")
|
|
173
|
+
})
|
|
174
|
+
})]
|
|
175
|
+
}), /* @__PURE__ */ T("div", {
|
|
176
|
+
className: G,
|
|
177
|
+
children: [O("startsOn"), /* @__PURE__ */ w("div", {
|
|
178
|
+
className: "mt-1",
|
|
179
|
+
children: /* @__PURE__ */ w(u, {
|
|
180
|
+
value: I.startsOn,
|
|
181
|
+
onValueChange: (e) => e && R({ startsOn: e }),
|
|
182
|
+
required: !0,
|
|
183
|
+
"aria-label": O("startsOn")
|
|
184
|
+
})
|
|
185
|
+
})]
|
|
186
|
+
})]
|
|
187
|
+
}),
|
|
188
|
+
W && /* @__PURE__ */ T("div", {
|
|
189
|
+
className: G,
|
|
190
|
+
children: [O("weekdays"), /* @__PURE__ */ w("div", {
|
|
191
|
+
className: "mt-1",
|
|
192
|
+
children: /* @__PURE__ */ w(g, {
|
|
193
|
+
multiple: !0,
|
|
194
|
+
label: O("weekdays"),
|
|
195
|
+
value: (I.weekdays ?? []).map(String),
|
|
196
|
+
options: j.map((e, t) => ({
|
|
197
|
+
value: String(t),
|
|
198
|
+
label: e
|
|
199
|
+
})),
|
|
200
|
+
onValueChange: (e) => R({ weekdays: e.map(Number).sort() })
|
|
201
|
+
})
|
|
202
|
+
})]
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ T("div", {
|
|
205
|
+
className: "flex flex-wrap items-end gap-3",
|
|
206
|
+
children: [/* @__PURE__ */ T("div", {
|
|
207
|
+
className: G,
|
|
208
|
+
children: [O("template"), /* @__PURE__ */ w("div", {
|
|
209
|
+
className: "mt-1",
|
|
210
|
+
children: /* @__PURE__ */ w(h, {
|
|
211
|
+
value: I.template ?? "",
|
|
212
|
+
items: [{
|
|
213
|
+
value: "",
|
|
214
|
+
label: O("spaceDefault")
|
|
215
|
+
}, ...F.map((e) => ({
|
|
216
|
+
value: e.id,
|
|
217
|
+
label: e.title
|
|
218
|
+
}))],
|
|
219
|
+
onValueChange: (e) => R({ template: e ?? "" }),
|
|
220
|
+
"aria-label": O("template")
|
|
221
|
+
})
|
|
222
|
+
})]
|
|
223
|
+
}), /* @__PURE__ */ T("div", {
|
|
224
|
+
className: G,
|
|
225
|
+
children: [O("lead"), /* @__PURE__ */ w("div", {
|
|
226
|
+
className: "mt-1",
|
|
227
|
+
children: /* @__PURE__ */ w(h, {
|
|
228
|
+
value: String(I.leadDays ?? 0),
|
|
229
|
+
items: [
|
|
230
|
+
0,
|
|
231
|
+
1,
|
|
232
|
+
2,
|
|
233
|
+
3,
|
|
234
|
+
7
|
|
235
|
+
].map((e) => ({
|
|
236
|
+
value: String(e),
|
|
237
|
+
label: O("leadDays", { days: e })
|
|
238
|
+
})),
|
|
239
|
+
onValueChange: (e) => e !== null && R({ leadDays: Number(e) }),
|
|
240
|
+
"aria-label": O("lead")
|
|
241
|
+
})
|
|
242
|
+
})]
|
|
243
|
+
})]
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ T("div", {
|
|
246
|
+
className: G,
|
|
247
|
+
children: [O("attendees"), /* @__PURE__ */ w("div", {
|
|
248
|
+
className: "mt-1",
|
|
249
|
+
children: /* @__PURE__ */ w(l, {
|
|
250
|
+
open: z,
|
|
251
|
+
onOpenChange: B,
|
|
252
|
+
multiple: !0,
|
|
253
|
+
items: P.map((e) => ({
|
|
254
|
+
value: e.user.username,
|
|
255
|
+
label: e.user.name || e.user.username
|
|
256
|
+
})),
|
|
257
|
+
value: I.attendees ?? [],
|
|
258
|
+
onValueChange: (e) => R({ attendees: e }),
|
|
259
|
+
placeholder: O("attendees"),
|
|
260
|
+
trigger: /* @__PURE__ */ w(c, {
|
|
261
|
+
type: "button",
|
|
262
|
+
className: "font-normal",
|
|
263
|
+
children: (I.attendees ?? []).length ? (I.attendees ?? []).map((e) => P.find((t) => t.user.username === e)?.user.name || e).join(", ") : O("noAttendees")
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
})]
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ w("p", {
|
|
269
|
+
className: "text-xs text-muted-foreground",
|
|
270
|
+
children: O("zone", { zone: I.timeZone ?? "UTC" })
|
|
271
|
+
}),
|
|
272
|
+
U && /* @__PURE__ */ w(d, { children: A(U) })
|
|
273
|
+
]
|
|
274
|
+
})
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
export { k as SeriesMenu, O as useSeriesSummary };
|
package/components/Graph.js
CHANGED
|
@@ -13,7 +13,7 @@ import w from "@dagrejs/dagre";
|
|
|
13
13
|
import { Handle as T, MarkerType as E, Position as D, ReactFlow as O, ReactFlowProvider as k, useReactFlow as A } from "@xyflow/react";
|
|
14
14
|
import "@xyflow/react/dist/style.css";
|
|
15
15
|
// src/components/Graph.tsx
|
|
16
|
-
var j = 196, M = 48, N = 22, P = (e) => e.kind === "doc" ? "bg-primary" : e.kind === "issue" ? e.status === "completed" || e.status === "canceled" ? "bg-muted-foreground/50" : "bg-primary" : e.status === "
|
|
16
|
+
var j = 196, M = 48, N = 22, P = (e) => e.kind === "doc" ? "bg-primary" : e.kind === "issue" ? e.status === "completed" || e.status === "canceled" ? "bg-muted-foreground/50" : "bg-primary" : e.status === "superseded" ? "bg-muted-foreground/50" : "bg-success", F = {
|
|
17
17
|
doc: c,
|
|
18
18
|
issue: u,
|
|
19
19
|
entry: l
|
package/components/HoverCards.js
CHANGED
|
@@ -13,15 +13,15 @@ import { DocIcon as y } from "./DocIcon.js";
|
|
|
13
13
|
import { termCaretEvent as b } from "./editorPlugins.js";
|
|
14
14
|
import { FileTextIcon as x } from "./icons.js";
|
|
15
15
|
import { PersonCard as S } from "./PersonHoverCard.js";
|
|
16
|
-
import { HoverCard as C, Loader as w
|
|
17
|
-
import { useEffect as
|
|
18
|
-
import { useTranslations as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
import { useQuery as
|
|
16
|
+
import { HoverCard as C, Loader as w } from "@parallelworks/ui";
|
|
17
|
+
import { useEffect as T, useRef as E, useState as D } from "react";
|
|
18
|
+
import { useTranslations as O } from "use-intl";
|
|
19
|
+
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
20
|
+
import { useQuery as M, useQueryClient as N } from "@tanstack/react-query";
|
|
21
21
|
// src/components/HoverCards.tsx
|
|
22
|
-
var
|
|
23
|
-
function
|
|
24
|
-
let t = e?.closest(
|
|
22
|
+
var P = ".kb-term, .person-mention, .prose-issue a[href*=\"/docs/\"]", F = 300, I = 200;
|
|
23
|
+
function L(e) {
|
|
24
|
+
let t = e?.closest(P);
|
|
25
25
|
if (!t) return null;
|
|
26
26
|
if (t.classList.contains("kb-term")) {
|
|
27
27
|
let e = t.dataset.term;
|
|
@@ -46,8 +46,8 @@ function R(e) {
|
|
|
46
46
|
key: c(r[1])
|
|
47
47
|
} : null;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
let [c, l] =
|
|
49
|
+
function R({ workspace: n }) {
|
|
50
|
+
let [c, l] = D(null), d = E(null), p = E(void 0), { data: g } = M(i(n)), y = _(), x = E((e) => {});
|
|
51
51
|
x.current = (e) => {
|
|
52
52
|
let t = g?.find((t) => t.id === e);
|
|
53
53
|
y({
|
|
@@ -57,23 +57,23 @@ function z({ workspace: n }) {
|
|
|
57
57
|
term: t ? m(t) : e
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
},
|
|
60
|
+
}, T(() => {
|
|
61
61
|
u.set(g ?? []);
|
|
62
|
-
}, [g]),
|
|
63
|
-
let { data: w } =
|
|
64
|
-
|
|
62
|
+
}, [g]), T(() => () => u.set([]), []);
|
|
63
|
+
let { data: w } = M(r(n));
|
|
64
|
+
T(() => {
|
|
65
65
|
s.set(w ?? []);
|
|
66
|
-
}, [w]),
|
|
67
|
-
let { data:
|
|
68
|
-
|
|
69
|
-
h.set((
|
|
70
|
-
}, [
|
|
71
|
-
let { data: k } =
|
|
72
|
-
|
|
66
|
+
}, [w]), T(() => () => s.set([]), []);
|
|
67
|
+
let { data: O } = M(a(n));
|
|
68
|
+
T(() => {
|
|
69
|
+
h.set((O ?? []).map((e) => e.user.username));
|
|
70
|
+
}, [O]), T(() => () => h.set([]), []);
|
|
71
|
+
let { data: k } = M(o(n));
|
|
72
|
+
T(() => {
|
|
73
73
|
v.set(k ?? []);
|
|
74
|
-
}, [k]),
|
|
75
|
-
let
|
|
76
|
-
|
|
74
|
+
}, [k]), T(() => () => v.set([]), []);
|
|
75
|
+
let j = N();
|
|
76
|
+
T(() => {
|
|
77
77
|
f.set(n, async (r) => {
|
|
78
78
|
let { issues: i } = t(await e.POST("/api/v1/workspaces/{workspace}/issue-refs", {
|
|
79
79
|
params: { path: { workspace: n } },
|
|
@@ -81,52 +81,52 @@ function z({ workspace: n }) {
|
|
|
81
81
|
}));
|
|
82
82
|
return new Map(i.map((e) => [e.identifier, e.issue]));
|
|
83
83
|
});
|
|
84
|
-
let r, i =
|
|
84
|
+
let r, i = j.getQueryCache().subscribe((e) => {
|
|
85
85
|
e.type === "updated" && e.query.queryKey[2] === "issues" && (clearTimeout(r), r = setTimeout(() => f.refresh(), 1e3));
|
|
86
86
|
});
|
|
87
87
|
return () => {
|
|
88
88
|
clearTimeout(r), i(), f.set("", void 0);
|
|
89
89
|
};
|
|
90
|
-
}, [n,
|
|
91
|
-
let
|
|
92
|
-
|
|
90
|
+
}, [n, j]);
|
|
91
|
+
let P = E((e) => {});
|
|
92
|
+
P.current = (e) => y({
|
|
93
93
|
to: "/$workspace/issues/$identifier",
|
|
94
94
|
params: {
|
|
95
95
|
workspace: n,
|
|
96
96
|
identifier: e
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
|
-
let
|
|
100
|
-
|
|
99
|
+
let R = E((e) => {});
|
|
100
|
+
R.current = (e) => y({
|
|
101
101
|
to: "/$workspace/teams/$key/issues",
|
|
102
102
|
params: {
|
|
103
103
|
workspace: n,
|
|
104
104
|
key: e
|
|
105
105
|
}
|
|
106
|
-
}),
|
|
106
|
+
}), T(() => {
|
|
107
107
|
let e = (e, t) => {
|
|
108
108
|
clearTimeout(p.current), p.current = setTimeout(e, t);
|
|
109
109
|
}, t = (t) => {
|
|
110
110
|
if (t.pointerType === "touch") return;
|
|
111
|
-
let n =
|
|
112
|
-
n && e(() => l(n),
|
|
111
|
+
let n = L(t.target);
|
|
112
|
+
n && e(() => l(n), F);
|
|
113
113
|
}, n = (t) => {
|
|
114
114
|
let n = t.relatedTarget;
|
|
115
|
-
n && d.current?.contains(n) ||
|
|
115
|
+
n && d.current?.contains(n) || L(t.target) && e(() => l(null), I);
|
|
116
116
|
}, r = (e) => {
|
|
117
|
-
let t =
|
|
117
|
+
let t = L(e.target);
|
|
118
118
|
t && (clearTimeout(p.current), l(t));
|
|
119
119
|
}, i = (e) => {
|
|
120
120
|
e.target.matches?.(".kb-term[tabindex], .prose-issue a[href*=\"/docs/\"]") && r(e);
|
|
121
121
|
}, a = (e) => {
|
|
122
122
|
let t = e.target.closest?.(".issue-mention"), n = t?.dataset.issue;
|
|
123
123
|
if (t && n && !t.closest("a[href]") && (!t.closest("[contenteditable=\"true\"]") || e.metaKey || e.ctrlKey)) {
|
|
124
|
-
e.preventDefault(),
|
|
124
|
+
e.preventDefault(), P.current(n);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
let i = e.target.closest?.(".team-mention"), a = i?.dataset.team;
|
|
128
128
|
if (i && a && (!i.closest("[contenteditable=\"true\"]") || e.metaKey || e.ctrlKey)) {
|
|
129
|
-
e.preventDefault(),
|
|
129
|
+
e.preventDefault(), R.current(a);
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
let o = e.target.closest?.(".kb-term");
|
|
@@ -139,7 +139,7 @@ function z({ workspace: n }) {
|
|
|
139
139
|
return document.addEventListener("pointerover", t), document.addEventListener("pointerout", n), document.addEventListener("focusin", i), document.addEventListener("click", a), document.addEventListener(b, r), document.addEventListener("keydown", o, !0), () => {
|
|
140
140
|
clearTimeout(p.current), document.removeEventListener("pointerover", t), document.removeEventListener("pointerout", n), document.removeEventListener("focusin", i), document.removeEventListener("click", a), document.removeEventListener(b, r), document.removeEventListener("keydown", o, !0);
|
|
141
141
|
};
|
|
142
|
-
}, []),
|
|
142
|
+
}, []), T(() => {
|
|
143
143
|
if (!c) return;
|
|
144
144
|
let e = (e) => {
|
|
145
145
|
let t = e.target;
|
|
@@ -147,88 +147,65 @@ function z({ workspace: n }) {
|
|
|
147
147
|
};
|
|
148
148
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
149
149
|
}, [c]);
|
|
150
|
-
let
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
at:
|
|
153
|
-
open: !!
|
|
150
|
+
let B = c?.el.isConnected ? c : null;
|
|
151
|
+
return /* @__PURE__ */ A(C, {
|
|
152
|
+
at: B?.el ?? null,
|
|
153
|
+
open: !!B,
|
|
154
154
|
onOpenChange: (e) => {
|
|
155
155
|
e || l(null);
|
|
156
156
|
},
|
|
157
157
|
onPointerEnter: () => clearTimeout(p.current),
|
|
158
158
|
onPointerLeave: () => {
|
|
159
|
-
clearTimeout(p.current), p.current = setTimeout(() => l(null),
|
|
159
|
+
clearTimeout(p.current), p.current = setTimeout(() => l(null), I);
|
|
160
160
|
},
|
|
161
|
-
card:
|
|
161
|
+
card: B && /* @__PURE__ */ A("div", {
|
|
162
162
|
ref: d,
|
|
163
163
|
role: "dialog",
|
|
164
|
-
"aria-label":
|
|
165
|
-
className:
|
|
166
|
-
children:
|
|
164
|
+
"aria-label": B.kind === "doc" ? B.key : B.kind === "person" ? B.username : void 0,
|
|
165
|
+
className: B.kind === "person" ? "" : "w-80 max-w-[calc(100vw-16px)] p-3 text-sm",
|
|
166
|
+
children: B.kind === "term" ? /* @__PURE__ */ A(z, {
|
|
167
167
|
workspace: n,
|
|
168
|
-
entry: g?.find((e) => e.id ===
|
|
169
|
-
}) :
|
|
168
|
+
entry: g?.find((e) => e.id === B.id)
|
|
169
|
+
}) : B.kind === "person" ? /* @__PURE__ */ A(S, {
|
|
170
170
|
workspace: n,
|
|
171
|
-
handle:
|
|
172
|
-
}) : /* @__PURE__ */
|
|
171
|
+
handle: B.username
|
|
172
|
+
}) : /* @__PURE__ */ A(V, {
|
|
173
173
|
workspace: n,
|
|
174
|
-
docKey:
|
|
174
|
+
docKey: B.key
|
|
175
175
|
})
|
|
176
176
|
})
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
};
|
|
183
|
-
function V({ status: e }) {
|
|
184
|
-
let t = k("knowledge.status");
|
|
185
|
-
return e === "superseded" ? /* @__PURE__ */ j(T, {
|
|
186
|
-
off: !0,
|
|
187
|
-
className: "text-xs",
|
|
188
|
-
children: t(e)
|
|
189
|
-
}) : /* @__PURE__ */ j(T, {
|
|
190
|
-
variant: B[e],
|
|
191
|
-
className: "text-xs",
|
|
192
|
-
children: t(e)
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function H({ workspace: e, entry: t }) {
|
|
196
|
-
let n = k("knowledge"), r = p(e);
|
|
197
|
-
if (!t) return /* @__PURE__ */ j("p", {
|
|
179
|
+
function z({ workspace: e, entry: t }) {
|
|
180
|
+
let n = O("knowledge"), r = p(e);
|
|
181
|
+
if (!t) return /* @__PURE__ */ A("p", {
|
|
198
182
|
className: "text-muted-foreground",
|
|
199
183
|
children: n("gone")
|
|
200
184
|
});
|
|
201
185
|
let i = t.source.doc;
|
|
202
|
-
return /* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ j(k, { children: [
|
|
187
|
+
/* @__PURE__ */ j("p", {
|
|
204
188
|
className: "flex items-center gap-2",
|
|
205
|
-
children: [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
children: n(`kind.${t.kind}`)
|
|
218
|
-
}),
|
|
219
|
-
(t.kind !== "term" || t.status !== "decided") && /* @__PURE__ */ j("span", {
|
|
220
|
-
className: "ml-auto",
|
|
221
|
-
children: /* @__PURE__ */ j(V, { status: t.status })
|
|
222
|
-
})
|
|
223
|
-
]
|
|
189
|
+
children: [/* @__PURE__ */ A(g, {
|
|
190
|
+
to: "/$workspace/knowledge/$term",
|
|
191
|
+
params: {
|
|
192
|
+
workspace: e,
|
|
193
|
+
term: m(t)
|
|
194
|
+
},
|
|
195
|
+
className: "font-semibold hover:underline",
|
|
196
|
+
children: t.name
|
|
197
|
+
}), /* @__PURE__ */ A("span", {
|
|
198
|
+
className: "text-xs text-muted-foreground",
|
|
199
|
+
children: n(`kind.${t.kind}`)
|
|
200
|
+
})]
|
|
224
201
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ A("p", {
|
|
226
203
|
className: "mt-1.5 text-foreground",
|
|
227
204
|
children: t.definition
|
|
228
205
|
}),
|
|
229
|
-
t.supersededBy && /* @__PURE__ */
|
|
206
|
+
t.supersededBy && /* @__PURE__ */ A("p", {
|
|
230
207
|
className: "mt-1.5 text-xs",
|
|
231
|
-
children: /* @__PURE__ */
|
|
208
|
+
children: /* @__PURE__ */ A(g, {
|
|
232
209
|
to: "/$workspace/knowledge/$term",
|
|
233
210
|
params: {
|
|
234
211
|
workspace: e,
|
|
@@ -238,9 +215,9 @@ function H({ workspace: e, entry: t }) {
|
|
|
238
215
|
children: n("supersededBy", { name: t.supersededByName ?? "" })
|
|
239
216
|
})
|
|
240
217
|
}),
|
|
241
|
-
(i || t.source.identifier) && /* @__PURE__ */
|
|
218
|
+
(i || t.source.identifier) && /* @__PURE__ */ j("p", {
|
|
242
219
|
className: "mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",
|
|
243
|
-
children: [i && /* @__PURE__ */
|
|
220
|
+
children: [i && /* @__PURE__ */ j(g, {
|
|
244
221
|
to: "/$workspace/docs/$doc",
|
|
245
222
|
params: {
|
|
246
223
|
workspace: e,
|
|
@@ -248,11 +225,11 @@ function H({ workspace: e, entry: t }) {
|
|
|
248
225
|
},
|
|
249
226
|
...t.source.section && { hash: d(t.source.section) },
|
|
250
227
|
className: "inline-flex items-center gap-1 hover:text-foreground",
|
|
251
|
-
children: [/* @__PURE__ */
|
|
228
|
+
children: [/* @__PURE__ */ A(x, { className: "size-3" }), t.source.section ? n("sourceSection", {
|
|
252
229
|
doc: i.title,
|
|
253
230
|
section: t.source.section
|
|
254
231
|
}) : i.title]
|
|
255
|
-
}), t.source.identifier && /* @__PURE__ */
|
|
232
|
+
}), t.source.identifier && /* @__PURE__ */ A(g, {
|
|
256
233
|
to: "/$workspace/issues/$identifier",
|
|
257
234
|
params: {
|
|
258
235
|
workspace: e,
|
|
@@ -262,7 +239,7 @@ function H({ workspace: e, entry: t }) {
|
|
|
262
239
|
children: t.source.identifier
|
|
263
240
|
})]
|
|
264
241
|
}),
|
|
265
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ A(g, {
|
|
266
243
|
to: "/$workspace/knowledge/$term",
|
|
267
244
|
params: {
|
|
268
245
|
workspace: e,
|
|
@@ -273,30 +250,30 @@ function H({ workspace: e, entry: t }) {
|
|
|
273
250
|
})
|
|
274
251
|
] });
|
|
275
252
|
}
|
|
276
|
-
function
|
|
253
|
+
function B(e) {
|
|
277
254
|
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);
|
|
278
255
|
}
|
|
279
|
-
function
|
|
280
|
-
let r =
|
|
256
|
+
function V({ workspace: e, docKey: t }) {
|
|
257
|
+
let r = O("docLinks"), { data: i, isError: a } = M({
|
|
281
258
|
...n(e, t),
|
|
282
259
|
retry: !1
|
|
283
260
|
});
|
|
284
|
-
return a ? /* @__PURE__ */
|
|
261
|
+
return a ? /* @__PURE__ */ A("p", {
|
|
285
262
|
className: "text-muted-foreground",
|
|
286
263
|
children: r("unavailable")
|
|
287
|
-
}) : i ? /* @__PURE__ */
|
|
264
|
+
}) : i ? /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ j("p", {
|
|
288
265
|
className: "flex items-center gap-2 font-semibold",
|
|
289
|
-
children: [/* @__PURE__ */
|
|
266
|
+
children: [/* @__PURE__ */ A(y, {
|
|
290
267
|
icon: i.icon,
|
|
291
268
|
className: "size-3.5",
|
|
292
269
|
emojiClassName: "text-xs"
|
|
293
|
-
}), /* @__PURE__ */
|
|
270
|
+
}), /* @__PURE__ */ A("span", {
|
|
294
271
|
className: "truncate",
|
|
295
272
|
children: i.title
|
|
296
273
|
})]
|
|
297
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ A("p", {
|
|
298
275
|
className: "mt-1.5 line-clamp-4 text-muted-foreground",
|
|
299
|
-
children:
|
|
300
|
-
})] }) : /* @__PURE__ */
|
|
276
|
+
children: B(i.body ?? "") || r("empty")
|
|
277
|
+
})] }) : /* @__PURE__ */ A(w, { size: 16 });
|
|
301
278
|
}
|
|
302
|
-
export {
|
|
279
|
+
export { R as HoverCards };
|