@parallelworks/tandem-web 0.171.2 → 0.171.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.
@@ -9,112 +9,112 @@ import { docRef as _ } from "../../../lib/docs.js";
9
9
  import { headingAnchor as v } from "../../../lib/glossary.js";
10
10
  import { EntryDialog as y, useKnowledgeActions as ee, useKnowledgeMenu as b } from "../../../lib/knowledge.js";
11
11
  import { termRef as x } from "../../../lib/knowledgeKinds.js";
12
- import { usePageTitle as S } from "../../../lib/pageTitle.js";
13
- import { usePeople as C } from "../../../lib/people.js";
14
- import { useCan as w } from "../../../lib/roles.js";
15
- import { Link as T, useNavigate as te } from "../../../lib/router.js";
12
+ import { usePageTitle as te } from "../../../lib/pageTitle.js";
13
+ import { usePeople as S } from "../../../lib/people.js";
14
+ import { useCan as C } from "../../../lib/roles.js";
15
+ import { Link as w, useNavigate as T } from "../../../lib/router.js";
16
16
  import { useTime as E } from "../../../lib/time.js";
17
17
  import { Route as D } from "./_term.js";
18
- import { Button as O, ErrorText as k, PageHeader as ne, Section as A, TitleInput as j, useOpenMenu as M } from "@parallelworks/ui";
19
- import { Suspense as N, useCallback as P, useMemo as F, useRef as I, useState as L } from "react";
20
- import { useErrorMessage as R } from "@parallelworks/problem/react";
21
- import { useTranslations as z } from "use-intl";
22
- import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
23
- import { useQuery as U, useSuspenseQuery as W } from "@tanstack/react-query";
24
- import { MoreButton as G } from "@parallelworks/ui/list";
18
+ import { Button as O, ErrorText as k, PageHeader as ne, Section as A, TitleInput as j, Tooltip as M, useOpenMenu as N } from "@parallelworks/ui";
19
+ import { Suspense as P, useCallback as F, useMemo as I, useRef as L, useState as R } from "react";
20
+ import { useErrorMessage as z } from "@parallelworks/problem/react";
21
+ import { useTranslations as B } from "use-intl";
22
+ import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
23
+ import { useQuery as W, useSuspenseQuery as G } from "@tanstack/react-query";
24
+ import { MoreButton as K } from "@parallelworks/ui/list";
25
25
  // src/routes/$workspace/knowledge/$term.tsx?tsr-split=component
26
- function K() {
27
- let { workspace: e, term: n } = D.useParams(), r = z("knowledge"), a = z("common"), o = te(), s = M(), f = R(), { data: p } = W(t(e, n)), { data: h } = W(i(e)), _ = ee(e), v = w(e, "edit_docs"), C = v && !p.archivedAt, [E, A] = L(null), U = P((e) => A(e), []), K = b(e, U), X = I(null), Z = u((t) => g(e, p.id, t));
28
- S(p.name);
29
- let Q = F(() => h.filter((e) => e.supersededBy === p.id), [h, p.id]), $ = (e) => _.update.mutate({
26
+ function q() {
27
+ let { workspace: e, term: n } = D.useParams(), r = B("knowledge"), a = B("common"), o = T(), s = N(), f = z(), { data: p } = G(t(e, n)), { data: h } = G(i(e)), _ = ee(e), v = C(e, "edit_docs"), S = v && !p.archivedAt, [E, A] = R(null), M = F((e) => A(e), []), W = b(e, M), q = L(null), Z = u((t) => g(e, p.id, t));
28
+ te(p.name);
29
+ let Q = I(() => h.filter((e) => e.supersededBy === p.id), [h, p.id]), $ = (e) => _.update.mutate({
30
30
  id: p.id,
31
31
  ...e,
32
32
  ifVersion: p.version
33
33
  }), re = p.status === "superseded";
34
- return /* @__PURE__ */ H("div", {
34
+ return /* @__PURE__ */ U("div", {
35
35
  className: "flex h-full min-h-0 flex-col",
36
36
  children: [
37
- /* @__PURE__ */ V(ne, {
37
+ /* @__PURE__ */ H(ne, {
38
38
  heading: !1,
39
39
  breadcrumbs: [{
40
40
  label: r("title"),
41
41
  href: `/${e}/knowledge`
42
42
  }, {
43
43
  label: p.name,
44
- icon: /* @__PURE__ */ V(m, { className: "size-4 text-muted-foreground" })
44
+ icon: /* @__PURE__ */ H(m, { className: "size-4 text-muted-foreground" })
45
45
  }],
46
- titleActions: /* @__PURE__ */ V(G, {
47
- items: () => K(p),
46
+ titleActions: /* @__PURE__ */ H(K, {
47
+ items: () => W(p),
48
48
  label: a("moreActionsFor", { name: p.name }),
49
49
  visible: !0
50
50
  }),
51
- actions: /* @__PURE__ */ H(B, { children: [_.update.isPending && /* @__PURE__ */ V("span", {
51
+ actions: /* @__PURE__ */ U(V, { children: [_.update.isPending && /* @__PURE__ */ H("span", {
52
52
  className: "text-xs text-muted-foreground",
53
53
  role: "status",
54
54
  children: a("saving")
55
- }), C && /* @__PURE__ */ V(O, {
55
+ }), S && /* @__PURE__ */ H(O, {
56
56
  type: "button",
57
57
  size: "sm",
58
- onClick: () => U({
58
+ onClick: () => M({
59
59
  kind: "edit",
60
60
  entry: p
61
61
  }),
62
62
  children: r("editDetails")
63
63
  })] })
64
64
  }),
65
- /* @__PURE__ */ V("div", {
65
+ /* @__PURE__ */ H("div", {
66
66
  className: "min-h-0 flex-1 overflow-y-auto",
67
- children: /* @__PURE__ */ H("article", {
67
+ children: /* @__PURE__ */ U("article", {
68
68
  className: "mx-auto w-full max-w-3xl px-4 pt-6 pb-20 md:px-8 md:pt-10",
69
69
  onContextMenu: (e) => {
70
- e.target instanceof Element && e.target.closest("textarea, .ProseMirror") || s(e, K(p));
70
+ e.target instanceof Element && e.target.closest("textarea, .ProseMirror") || s(e, W(p));
71
71
  },
72
72
  children: [
73
- p.archivedAt && /* @__PURE__ */ H("div", {
73
+ p.archivedAt && /* @__PURE__ */ U("div", {
74
74
  className: "mb-6 flex items-center gap-3 rounded-xl border border-border bg-muted px-3 py-2 text-sm",
75
- children: [/* @__PURE__ */ V("span", {
75
+ children: [/* @__PURE__ */ H("span", {
76
76
  className: "min-w-0 flex-1",
77
77
  children: r("archivedNotice")
78
- }), v && /* @__PURE__ */ V(O, {
78
+ }), v && /* @__PURE__ */ H(O, {
79
79
  type: "button",
80
80
  size: "sm",
81
81
  onClick: () => _.restore.mutate(p.id),
82
82
  children: r("restore")
83
83
  })]
84
84
  }),
85
- /* @__PURE__ */ V(q, {
85
+ /* @__PURE__ */ H(J, {
86
86
  workspace: e,
87
87
  entry: p
88
88
  }),
89
- /* @__PURE__ */ V("h1", {
89
+ /* @__PURE__ */ H("h1", {
90
90
  className: "sr-only",
91
91
  children: p.name
92
92
  }),
93
- /* @__PURE__ */ V(j, {
93
+ /* @__PURE__ */ H(j, {
94
94
  value: p.name,
95
95
  onCommit: (e) => $({ name: e }),
96
- readOnly: !C,
96
+ readOnly: !S,
97
97
  "aria-label": r("name"),
98
98
  maxLength: 100,
99
99
  className: re ? "mt-2 text-muted-foreground line-through" : "mt-2"
100
100
  }),
101
- p.aliases.length > 0 && /* @__PURE__ */ V("p", {
101
+ p.aliases.length > 0 && /* @__PURE__ */ H("p", {
102
102
  className: "mt-1 text-sm text-muted-foreground",
103
103
  children: r("alsoCalled", { names: p.aliases.join(", ") })
104
104
  }),
105
- /* @__PURE__ */ V(j, {
105
+ /* @__PURE__ */ H(j, {
106
106
  value: p.definition,
107
107
  onCommit: (e) => $({ definition: e }),
108
- readOnly: !C,
108
+ readOnly: !S,
109
109
  "aria-label": r("definition"),
110
110
  placeholder: r("definitionPlaceholder"),
111
111
  maxLength: 1e3,
112
112
  size: "lg",
113
113
  className: "mt-3 text-base leading-relaxed font-normal tracking-normal text-muted-foreground"
114
114
  }),
115
- (p.supersededBy || Q.length > 0) && /* @__PURE__ */ H("div", {
115
+ (p.supersededBy || Q.length > 0) && /* @__PURE__ */ U("div", {
116
116
  className: "mt-3 space-y-1 text-sm",
117
- children: [p.supersededBy && /* @__PURE__ */ V(T, {
117
+ children: [p.supersededBy && /* @__PURE__ */ H(w, {
118
118
  to: "/$workspace/knowledge/$term",
119
119
  params: {
120
120
  workspace: e,
@@ -122,7 +122,7 @@ function K() {
122
122
  },
123
123
  className: "block text-primary hover:underline",
124
124
  children: r("supersededBy", { name: p.supersededByName ?? "" })
125
- }), Q.map((t) => /* @__PURE__ */ V(T, {
125
+ }), Q.map((t) => /* @__PURE__ */ H(w, {
126
126
  to: "/$workspace/knowledge/$term",
127
127
  params: {
128
128
  workspace: e,
@@ -132,60 +132,60 @@ function K() {
132
132
  children: r("replaces", { name: t.name })
133
133
  }, t.id))]
134
134
  }),
135
- /* @__PURE__ */ H("section", {
135
+ /* @__PURE__ */ U("section", {
136
136
  "aria-label": r("page"),
137
137
  className: "mt-8 border-t border-border pt-6",
138
138
  children: [
139
- C || p.body ? /* @__PURE__ */ V(d, {
139
+ S || p.body ? /* @__PURE__ */ H(d, {
140
140
  value: p.body ?? "",
141
- editable: C,
141
+ editable: S,
142
142
  placeholder: r("pagePlaceholder"),
143
143
  label: r("page"),
144
144
  onBlur: (e) => e !== (p.body ?? "") && $({ body: e }),
145
- onFiles: (e, t) => Z.upload(X.current, e, t),
145
+ onFiles: (e, t) => Z.upload(q.current, e, t),
146
146
  onEditor: (e) => {
147
- X.current = e;
147
+ q.current = e;
148
148
  },
149
149
  className: "min-h-32 [&>:first-child]:mt-0"
150
- }) : /* @__PURE__ */ V("p", {
150
+ }) : /* @__PURE__ */ H("p", {
151
151
  className: "text-sm text-muted-foreground",
152
152
  children: r("noPage")
153
153
  }),
154
- C && /* @__PURE__ */ H("div", {
154
+ S && /* @__PURE__ */ U("div", {
155
155
  className: "mt-3 flex items-center gap-2",
156
156
  children: [
157
- /* @__PURE__ */ V(c, { onFiles: (e) => Z.upload(X.current, e) }),
158
- /* @__PURE__ */ V("span", {
157
+ /* @__PURE__ */ H(c, { onFiles: (e) => Z.upload(q.current, e) }),
158
+ /* @__PURE__ */ H("span", {
159
159
  className: "text-xs text-muted-foreground",
160
160
  children: r("attachHint")
161
161
  }),
162
- /* @__PURE__ */ V("span", {
162
+ /* @__PURE__ */ H("span", {
163
163
  className: "ml-auto",
164
- children: /* @__PURE__ */ V(l, {
164
+ children: /* @__PURE__ */ H(l, {
165
165
  pending: Z.pending,
166
166
  error: Z.error
167
167
  })
168
168
  })
169
169
  ]
170
170
  }),
171
- _.update.isError && /* @__PURE__ */ V(k, {
171
+ _.update.isError && /* @__PURE__ */ H(k, {
172
172
  className: "mt-2",
173
173
  children: f(_.update.error)
174
174
  })
175
175
  ]
176
176
  }),
177
- /* @__PURE__ */ V(N, { children: /* @__PURE__ */ V(J, {
177
+ /* @__PURE__ */ H(P, { children: /* @__PURE__ */ H(Y, {
178
178
  workspace: e,
179
179
  entryId: p.id
180
180
  }) }),
181
- /* @__PURE__ */ V(N, { children: /* @__PURE__ */ V(Y, {
181
+ /* @__PURE__ */ H(P, { children: /* @__PURE__ */ H(X, {
182
182
  workspace: e,
183
183
  entryId: p.id
184
184
  }) })
185
185
  ]
186
186
  })
187
187
  }),
188
- E && /* @__PURE__ */ V(N, { children: /* @__PURE__ */ V(y, {
188
+ E && /* @__PURE__ */ H(P, { children: /* @__PURE__ */ H(y, {
189
189
  workspace: e,
190
190
  mode: E,
191
191
  onClose: () => A(null),
@@ -201,32 +201,34 @@ function K() {
201
201
  ]
202
202
  });
203
203
  }
204
- function q({ workspace: t, entry: n }) {
205
- let r = z("knowledge"), { actorName: i } = C(t), a = E(), { data: o = [] } = U(e(t)), s = o.find((e) => e.id === n.areaId), c = n.source.doc, l = [
204
+ function J({ workspace: t, entry: n }) {
205
+ let r = B("knowledge"), { actorName: i } = S(t), a = E(), { data: o = [] } = W(e(t)), s = o.find((e) => e.id === n.areaId), c = n.source.doc, l = [
206
206
  ...n.kind === "term" ? [] : [r(`kind.${n.kind}`)],
207
207
  ...s ? [s.title] : [],
208
208
  r("writtenBy", { name: i(n.creator) }),
209
- /* @__PURE__ */ V("time", {
210
- dateTime: n.updatedAt,
211
- title: a.full(n.updatedAt),
212
- children: r("updated", { when: a.relative(n.updatedAt) })
209
+ /* @__PURE__ */ H(M, {
210
+ content: a.full(n.updatedAt),
211
+ children: /* @__PURE__ */ H("time", {
212
+ dateTime: n.updatedAt,
213
+ children: r("updated", { when: a.relative(n.updatedAt) })
214
+ })
213
215
  }, "updated")
214
216
  ];
215
- return /* @__PURE__ */ H("div", {
217
+ return /* @__PURE__ */ U("div", {
216
218
  className: "space-y-1 text-xs text-muted-foreground",
217
- children: [/* @__PURE__ */ H("p", {
219
+ children: [/* @__PURE__ */ U("p", {
218
220
  className: "flex flex-wrap items-center gap-x-1.5 gap-y-1",
219
- children: [(n.kind !== "term" || n.status !== "decided") && /* @__PURE__ */ V(f, { status: n.status }), l.map((e, t) => /* @__PURE__ */ H("span", {
221
+ children: [(n.kind !== "term" || n.status !== "decided") && /* @__PURE__ */ H(f, { status: n.status }), l.map((e, t) => /* @__PURE__ */ U("span", {
220
222
  className: "inline-flex items-center gap-1.5",
221
- children: [t > 0 && /* @__PURE__ */ V("span", {
223
+ children: [t > 0 && /* @__PURE__ */ H("span", {
222
224
  "aria-hidden": "true",
223
225
  children: "·"
224
226
  }), e]
225
227
  }, t))]
226
- }), (c || n.source.identifier) && /* @__PURE__ */ H("p", {
228
+ }), (c || n.source.identifier) && /* @__PURE__ */ U("p", {
227
229
  className: "flex flex-wrap items-center gap-x-3 gap-y-1",
228
230
  children: [
229
- c && /* @__PURE__ */ H(T, {
231
+ c && /* @__PURE__ */ U(w, {
230
232
  to: "/$workspace/docs/$doc",
231
233
  params: {
232
234
  workspace: t,
@@ -234,16 +236,16 @@ function q({ workspace: t, entry: n }) {
234
236
  },
235
237
  ...n.source.section && { hash: v(n.source.section) },
236
238
  className: "inline-flex items-center gap-1 hover:text-foreground",
237
- children: [/* @__PURE__ */ V(p, { className: "size-3" }), n.source.section ? r("sourceSection", {
239
+ children: [/* @__PURE__ */ H(p, { className: "size-3" }), n.source.section ? r("sourceSection", {
238
240
  doc: c.title,
239
241
  section: n.source.section
240
242
  }) : c.title]
241
243
  }),
242
- n.source.missing && /* @__PURE__ */ V("span", {
244
+ n.source.missing && /* @__PURE__ */ H("span", {
243
245
  className: "text-warning",
244
246
  children: r("sourceMissing", { section: n.source.section ?? "" })
245
247
  }),
246
- n.source.identifier && /* @__PURE__ */ H(T, {
248
+ n.source.identifier && /* @__PURE__ */ U(w, {
247
249
  to: "/$workspace/issues/$identifier",
248
250
  params: {
249
251
  workspace: t,
@@ -260,25 +262,25 @@ function q({ workspace: t, entry: n }) {
260
262
  })]
261
263
  });
262
264
  }
263
- function J({ workspace: e, entryId: t }) {
264
- let n = z("knowledge"), { data: i } = U(r(e, t));
265
+ function Y({ workspace: e, entryId: t }) {
266
+ let n = B("knowledge"), { data: i } = W(r(e, t));
265
267
  if (!i) return null;
266
268
  let a = i.issues.length + i.docs.length, o = "flex min-h-10 items-center gap-2.5 px-3 py-2 text-sm hover:bg-muted focus-visible:outline-offset-[-2px]";
267
- return /* @__PURE__ */ H("section", {
269
+ return /* @__PURE__ */ U("section", {
268
270
  "aria-label": n("mentionedIn"),
269
271
  className: "mt-12",
270
- children: [/* @__PURE__ */ H("h2", {
272
+ children: [/* @__PURE__ */ U("h2", {
271
273
  className: "mb-3 flex items-baseline gap-2 text-base font-semibold",
272
- children: [n("mentionedIn"), a > 0 && /* @__PURE__ */ V("span", {
274
+ children: [n("mentionedIn"), a > 0 && /* @__PURE__ */ H("span", {
273
275
  className: "text-xs font-normal text-muted-foreground tabular-nums",
274
276
  children: a
275
277
  })]
276
- }), a === 0 ? /* @__PURE__ */ V("p", {
278
+ }), a === 0 ? /* @__PURE__ */ H("p", {
277
279
  className: "text-sm text-muted-foreground",
278
280
  children: n("mentionedNone")
279
- }) : /* @__PURE__ */ H("ul", {
281
+ }) : /* @__PURE__ */ U("ul", {
280
282
  className: "divide-y divide-border overflow-hidden rounded-xl border border-border bg-card",
281
- children: [i.issues.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(T, {
283
+ children: [i.issues.map((t) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(w, {
282
284
  to: "/$workspace/issues/$identifier",
283
285
  params: {
284
286
  workspace: e,
@@ -286,20 +288,20 @@ function J({ workspace: e, entryId: t }) {
286
288
  },
287
289
  className: o,
288
290
  children: [
289
- /* @__PURE__ */ V(h, {
291
+ /* @__PURE__ */ H(h, {
290
292
  category: t.statusCategory,
291
293
  className: "size-3.5 shrink-0"
292
294
  }),
293
- /* @__PURE__ */ V("span", {
295
+ /* @__PURE__ */ H("span", {
294
296
  className: "min-w-24 shrink-0 text-xs whitespace-nowrap text-muted-foreground tabular-nums",
295
297
  children: t.identifier
296
298
  }),
297
- /* @__PURE__ */ V("span", {
299
+ /* @__PURE__ */ H("span", {
298
300
  className: "min-w-0 truncate",
299
301
  children: t.title
300
302
  })
301
303
  ]
302
- }) }, t.identifier)), i.docs.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(T, {
304
+ }) }, t.identifier)), i.docs.map((t) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(w, {
303
305
  to: "/$workspace/docs/$doc",
304
306
  params: {
305
307
  workspace: e,
@@ -307,12 +309,12 @@ function J({ workspace: e, entryId: t }) {
307
309
  },
308
310
  className: o,
309
311
  children: [
310
- /* @__PURE__ */ V(p, { className: "size-3.5 shrink-0 text-muted-foreground" }),
311
- /* @__PURE__ */ V("span", {
312
+ /* @__PURE__ */ H(p, { className: "size-3.5 shrink-0 text-muted-foreground" }),
313
+ /* @__PURE__ */ H("span", {
312
314
  className: "w-16 shrink-0 text-xs text-muted-foreground",
313
315
  children: n("doc")
314
316
  }),
315
- /* @__PURE__ */ V("span", {
317
+ /* @__PURE__ */ H("span", {
316
318
  className: "min-w-0 truncate",
317
319
  children: t.title
318
320
  })
@@ -321,27 +323,27 @@ function J({ workspace: e, entryId: t }) {
321
323
  })]
322
324
  });
323
325
  }
324
- function Y({ workspace: e, entryId: t }) {
325
- let r = z("knowledge.history"), { data: i = [] } = U(n(e, t)), { actorName: c } = C(e);
326
- return i.length === 0 ? null : /* @__PURE__ */ V(A, {
326
+ function X({ workspace: e, entryId: t }) {
327
+ let r = B("knowledge.history"), { data: i = [] } = W(n(e, t)), { actorName: c } = S(e);
328
+ return i.length === 0 ? null : /* @__PURE__ */ H(A, {
327
329
  title: r("title"),
328
330
  variant: "bare",
329
331
  defaultOpen: !1,
330
332
  headingLevel: 2,
331
333
  className: "mt-10",
332
- children: /* @__PURE__ */ V(a, { children: i.map((t) => /* @__PURE__ */ V(o, {
334
+ children: /* @__PURE__ */ H(a, { children: i.map((t) => /* @__PURE__ */ H(o, {
333
335
  workspace: e,
334
336
  icon: s(t.type, t.data),
335
337
  actor: t.actor,
336
338
  at: t.createdAt,
337
- children: X(r, t, c(t.actor))
339
+ children: Z(r, t, c(t.actor))
338
340
  }, t.id)) })
339
341
  });
340
342
  }
341
- function X(e, t, n) {
343
+ function Z(e, t, n) {
342
344
  let r = t.data ?? {}, i = {
343
345
  name: n,
344
- actor: (e) => /* @__PURE__ */ V("span", {
346
+ actor: (e) => /* @__PURE__ */ H("span", {
345
347
  className: "font-medium text-foreground",
346
348
  children: e
347
349
  })
@@ -363,4 +365,4 @@ function X(e, t, n) {
363
365
  }
364
366
  }
365
367
  }
366
- export { K as component };
368
+ export { q as component };