@parallelworks/tandem-web 0.183.0 → 0.184.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,20 +1,20 @@
1
1
  import { areasQuery as e, knowledgeEntryQuery as t, knowledgeEventsQuery as n, knowledgeMentionsQuery as r, knowledgeQuery as i } from "../../../api/queries.js";
2
2
  import { Timeline as a, TimelineItem as o, activityIcon as s } from "../../../components/ActivityTimeline.js";
3
3
  import { AttachButton as c, UploadStatus as l, useFileUpload as u } from "../../../components/Attachments.js";
4
- import { Editor as d } from "../../../components/Editor.js";
5
- import { FileTextIcon as f, LibraryIcon as p, StatusIcon as m } from "../../../components/icons.js";
6
- import { uploadKnowledgeAttachment as h } from "../../../lib/attachments.js";
7
- import { docRef as g } from "../../../lib/docs.js";
8
- import { headingAnchor as _ } from "../../../lib/glossary.js";
9
- import { EntryDialog as v, useKnowledgeActions as y, useKnowledgeMenu as b } from "../../../lib/knowledge.js";
10
- import { termRef as x } from "../../../lib/knowledgeKinds.js";
11
- import { usePageTitle as S } from "../../../lib/pageTitle.js";
12
- import { usePeople as C } from "../../../lib/people.js";
13
- import { useCan as ee } from "../../../lib/roles.js";
14
- import { Link as w, useNavigate as te } from "../../../lib/router.js";
15
- import { useTime as T } from "../../../lib/time.js";
16
- import { Route as E } from "./_term.js";
17
- import { Button as D, ErrorText as O, PageHeader as ne, Section as k, TitleInput as A, Tooltip as j, useOpenMenu as M } from "@parallelworks/ui";
4
+ import { Editor as ee } from "../../../components/Editor.js";
5
+ import { FileTextIcon as d, LibraryIcon as f, StatusIcon as p } from "../../../components/icons.js";
6
+ import { uploadKnowledgeAttachment as m } from "../../../lib/attachments.js";
7
+ import { docRef as h } from "../../../lib/docs.js";
8
+ import { headingAnchor as g } from "../../../lib/glossary.js";
9
+ import { EntryDialog as _, useKnowledgeActions as te, useKnowledgeMenu as ne } from "../../../lib/knowledge.js";
10
+ import { termRef as v } from "../../../lib/knowledgeKinds.js";
11
+ import { usePageTitle as y } from "../../../lib/pageTitle.js";
12
+ import { usePeople as b } from "../../../lib/people.js";
13
+ import { useCan as x } from "../../../lib/roles.js";
14
+ import { Link as S, useNavigate as C } from "../../../lib/router.js";
15
+ import { useTime as w } from "../../../lib/time.js";
16
+ import { Route as T } from "./_term.js";
17
+ import { Button as E, ErrorText as D, Loader as O, PageHeader as re, Section as k, TitleInput as A, Tooltip as j, useOpenMenu as M } from "@parallelworks/ui";
18
18
  import { Suspense as N, useCallback as P, useMemo as F, useRef as I, useState as L } from "react";
19
19
  import { useErrorMessage as R } from "@parallelworks/problem/react";
20
20
  import { useTranslations as z } from "use-intl";
@@ -23,40 +23,40 @@ import { useQuery as U, useSuspenseQuery as W } from "@tanstack/react-query";
23
23
  import { MoreButton as G } from "@parallelworks/ui/list";
24
24
  // src/routes/$workspace/knowledge/$term.tsx?tsr-split=component
25
25
  function K() {
26
- let { workspace: e, term: n } = E.useParams(), r = z("knowledge"), a = z("common"), o = te(), s = M(), f = R(), { data: m } = W(t(e, n)), { data: g } = W(i(e)), _ = y(e), C = ee(e, "edit_docs"), T = C && !m.archivedAt, [k, j] = L(null), U = P((e) => j(e), []), K = b(e, U), X = I(null), Z = u((t) => h(e, m.id, t));
27
- S(m.name);
28
- let Q = F(() => g.filter((e) => e.supersededBy === m.id), [g, m.id]), $ = (e) => _.update.mutate({
29
- id: m.id,
26
+ let { workspace: e, term: n } = T.useParams(), r = z("knowledge"), a = z("common"), o = C(), s = M(), d = R(), { data: p } = W(t(e, n)), { data: h } = W(i(e)), g = te(e), b = x(e, "edit_docs"), w = b && !p.archivedAt, [k, j] = L(null), U = P((e) => j(e), []), K = ne(e, U), X = I(null), Z = u((t) => m(e, p.id, t));
27
+ y(p.name);
28
+ let Q = F(() => h.filter((e) => e.supersededBy === p.id), [h, p.id]), $ = (e) => g.update.mutate({
29
+ id: p.id,
30
30
  ...e,
31
- ifVersion: m.version
32
- }), re = m.status === "superseded";
31
+ ifVersion: p.version
32
+ }), ie = p.status === "superseded";
33
33
  return /* @__PURE__ */ H("div", {
34
34
  className: "flex h-full min-h-0 flex-col",
35
35
  children: [
36
- /* @__PURE__ */ V(ne, {
36
+ /* @__PURE__ */ V(re, {
37
37
  heading: !1,
38
38
  breadcrumbs: [{
39
39
  label: r("title"),
40
40
  href: `/${e}/knowledge`
41
41
  }, {
42
- label: m.name,
43
- icon: /* @__PURE__ */ V(p, { className: "size-4 text-muted-foreground" })
42
+ label: p.name,
43
+ icon: /* @__PURE__ */ V(f, { className: "size-4 text-muted-foreground" })
44
44
  }],
45
45
  titleActions: /* @__PURE__ */ V(G, {
46
- items: () => K(m),
47
- label: a("moreActionsFor", { name: m.name }),
46
+ items: () => K(p),
47
+ label: a("moreActionsFor", { name: p.name }),
48
48
  visible: !0
49
49
  }),
50
- actions: /* @__PURE__ */ H(B, { children: [_.update.isPending && /* @__PURE__ */ V("span", {
50
+ actions: /* @__PURE__ */ H(B, { children: [g.update.isPending && /* @__PURE__ */ V("span", {
51
51
  className: "text-xs text-muted-foreground",
52
52
  role: "status",
53
53
  children: a("saving")
54
- }), T && /* @__PURE__ */ V(D, {
54
+ }), w && /* @__PURE__ */ V(E, {
55
55
  type: "button",
56
56
  size: "sm",
57
57
  onClick: () => U({
58
58
  kind: "edit",
59
- entry: m
59
+ entry: p
60
60
  }),
61
61
  children: r("editDetails")
62
62
  })] })
@@ -66,66 +66,66 @@ function K() {
66
66
  children: /* @__PURE__ */ H("article", {
67
67
  className: "mx-auto w-full max-w-3xl px-4 pt-6 pb-20 md:px-8 md:pt-10",
68
68
  onContextMenu: (e) => {
69
- e.target instanceof Element && e.target.closest("textarea, .ProseMirror") || s(e, K(m));
69
+ e.target instanceof Element && e.target.closest("textarea, .ProseMirror") || s(e, K(p));
70
70
  },
71
71
  children: [
72
- m.archivedAt && /* @__PURE__ */ H("div", {
72
+ p.archivedAt && /* @__PURE__ */ H("div", {
73
73
  className: "mb-6 flex items-center gap-3 rounded-xl border border-border bg-muted px-3 py-2 text-sm",
74
74
  children: [/* @__PURE__ */ V("span", {
75
75
  className: "min-w-0 flex-1",
76
76
  children: r("archivedNotice")
77
- }), C && /* @__PURE__ */ V(D, {
77
+ }), b && /* @__PURE__ */ V(E, {
78
78
  type: "button",
79
79
  size: "sm",
80
- onClick: () => _.restore.mutate(m.id),
80
+ onClick: () => g.restore.mutate(p.id),
81
81
  children: r("restore")
82
82
  })]
83
83
  }),
84
84
  /* @__PURE__ */ V(q, {
85
85
  workspace: e,
86
- entry: m
86
+ entry: p
87
87
  }),
88
88
  /* @__PURE__ */ V("h1", {
89
89
  className: "sr-only",
90
- children: m.name
90
+ children: p.name
91
91
  }),
92
92
  /* @__PURE__ */ V(A, {
93
- value: m.name,
93
+ value: p.name,
94
94
  onCommit: (e) => $({ name: e }),
95
- readOnly: !T,
95
+ readOnly: !w,
96
96
  "aria-label": r("name"),
97
97
  maxLength: 100,
98
- className: re ? "mt-2 text-muted-foreground line-through" : "mt-2"
98
+ className: ie ? "mt-2 text-muted-foreground line-through" : "mt-2"
99
99
  }),
100
- m.aliases.length > 0 && /* @__PURE__ */ V("p", {
100
+ p.aliases.length > 0 && /* @__PURE__ */ V("p", {
101
101
  className: "mt-1 text-sm text-muted-foreground",
102
- children: r("alsoCalled", { names: m.aliases.join(", ") })
102
+ children: r("alsoCalled", { names: p.aliases.join(", ") })
103
103
  }),
104
104
  /* @__PURE__ */ V(A, {
105
- value: m.definition,
105
+ value: p.definition,
106
106
  onCommit: (e) => $({ definition: e }),
107
- readOnly: !T,
107
+ readOnly: !w,
108
108
  "aria-label": r("definition"),
109
109
  placeholder: r("definitionPlaceholder"),
110
110
  maxLength: 1e3,
111
111
  size: "lg",
112
112
  className: "mt-3 text-base leading-relaxed font-normal tracking-normal text-muted-foreground"
113
113
  }),
114
- (m.supersededBy || Q.length > 0) && /* @__PURE__ */ H("div", {
114
+ (p.supersededBy || Q.length > 0) && /* @__PURE__ */ H("div", {
115
115
  className: "mt-3 space-y-1 text-sm",
116
- children: [m.supersededBy && /* @__PURE__ */ V(w, {
116
+ children: [p.supersededBy && /* @__PURE__ */ V(S, {
117
117
  to: "/$workspace/knowledge/$term",
118
118
  params: {
119
119
  workspace: e,
120
- term: x(g.find((e) => e.id === m.supersededBy) ?? { id: m.supersededBy })
120
+ term: v(h.find((e) => e.id === p.supersededBy) ?? { id: p.supersededBy })
121
121
  },
122
122
  className: "block text-primary hover:underline",
123
- children: r("supersededBy", { name: m.supersededByName ?? "" })
124
- }), Q.map((t) => /* @__PURE__ */ V(w, {
123
+ children: r("supersededBy", { name: p.supersededByName ?? "" })
124
+ }), Q.map((t) => /* @__PURE__ */ V(S, {
125
125
  to: "/$workspace/knowledge/$term",
126
126
  params: {
127
127
  workspace: e,
128
- term: x(t)
128
+ term: v(t)
129
129
  },
130
130
  className: "block text-muted-foreground hover:text-foreground",
131
131
  children: r("replaces", { name: t.name })
@@ -135,12 +135,12 @@ function K() {
135
135
  "aria-label": r("page"),
136
136
  className: "mt-8 border-t border-border pt-6",
137
137
  children: [
138
- T || m.body ? /* @__PURE__ */ V(d, {
139
- value: m.body ?? "",
140
- editable: T,
138
+ w || p.body ? /* @__PURE__ */ V(ee, {
139
+ value: p.body ?? "",
140
+ editable: w,
141
141
  placeholder: r("pagePlaceholder"),
142
142
  label: r("page"),
143
- onBlur: (e) => e !== (m.body ?? "") && $({ body: e }),
143
+ onBlur: (e) => e !== (p.body ?? "") && $({ body: e }),
144
144
  onFiles: (e, t) => Z.upload(X.current, e, t),
145
145
  onEditor: (e) => {
146
146
  X.current = e;
@@ -150,7 +150,7 @@ function K() {
150
150
  className: "text-sm text-muted-foreground",
151
151
  children: r("noPage")
152
152
  }),
153
- T && /* @__PURE__ */ H("div", {
153
+ w && /* @__PURE__ */ H("div", {
154
154
  className: "mt-3 flex items-center gap-2",
155
155
  children: [
156
156
  /* @__PURE__ */ V(c, { onFiles: (e) => Z.upload(X.current, e) }),
@@ -167,24 +167,30 @@ function K() {
167
167
  })
168
168
  ]
169
169
  }),
170
- _.update.isError && /* @__PURE__ */ V(O, {
170
+ g.update.isError && /* @__PURE__ */ V(D, {
171
171
  className: "mt-2",
172
- children: f(_.update.error)
172
+ children: d(g.update.error)
173
173
  })
174
174
  ]
175
175
  }),
176
- /* @__PURE__ */ V(N, { children: /* @__PURE__ */ V(J, {
177
- workspace: e,
178
- entryId: m.id
179
- }) }),
180
- /* @__PURE__ */ V(N, { children: /* @__PURE__ */ V(Y, {
181
- workspace: e,
182
- entryId: m.id
183
- }) })
176
+ /* @__PURE__ */ V(N, {
177
+ fallback: /* @__PURE__ */ V(O, { fill: "section" }),
178
+ children: /* @__PURE__ */ V(J, {
179
+ workspace: e,
180
+ entryId: p.id
181
+ })
182
+ }),
183
+ /* @__PURE__ */ V(N, {
184
+ fallback: /* @__PURE__ */ V(O, { fill: "section" }),
185
+ children: /* @__PURE__ */ V(Y, {
186
+ workspace: e,
187
+ entryId: p.id
188
+ })
189
+ })
184
190
  ]
185
191
  })
186
192
  }),
187
- k && /* @__PURE__ */ V(N, { children: /* @__PURE__ */ V(v, {
193
+ k && /* @__PURE__ */ V(N, { children: /* @__PURE__ */ V(_, {
188
194
  workspace: e,
189
195
  mode: k,
190
196
  onClose: () => j(null),
@@ -192,16 +198,16 @@ function K() {
192
198
  to: "/$workspace/knowledge/$term",
193
199
  params: {
194
200
  workspace: e,
195
- term: x(t)
201
+ term: v(t)
196
202
  },
197
- replace: t.id === m.id
203
+ replace: t.id === p.id
198
204
  })
199
205
  }) })
200
206
  ]
201
207
  });
202
208
  }
203
209
  function q({ workspace: t, entry: n }) {
204
- let r = z("knowledge"), { actorName: i } = C(t), a = T(), { data: o = [] } = U(e(t)), s = o.find((e) => e.id === n.areaId), c = n.source.doc, l = [
210
+ let r = z("knowledge"), { actorName: i } = b(t), a = w(), { data: o = [] } = U(e(t)), s = o.find((e) => e.id === n.areaId), c = n.source.doc, l = [
205
211
  ...n.kind === "term" ? [] : [r(`kind.${n.kind}`)],
206
212
  ...s ? [s.title] : [],
207
213
  r("writtenBy", { name: i(n.creator) }),
@@ -227,15 +233,15 @@ function q({ workspace: t, entry: n }) {
227
233
  }), (c || n.source.identifier) && /* @__PURE__ */ H("p", {
228
234
  className: "flex flex-wrap items-center gap-x-3 gap-y-1",
229
235
  children: [
230
- c && /* @__PURE__ */ H(w, {
236
+ c && /* @__PURE__ */ H(S, {
231
237
  to: "/$workspace/docs/$doc",
232
238
  params: {
233
239
  workspace: t,
234
- doc: g(c)
240
+ doc: h(c)
235
241
  },
236
- ...n.source.section && { hash: _(n.source.section) },
242
+ ...n.source.section && { hash: g(n.source.section) },
237
243
  className: "inline-flex items-center gap-1 hover:text-foreground",
238
- children: [/* @__PURE__ */ V(f, { className: "size-3" }), n.source.section ? r("sourceSection", {
244
+ children: [/* @__PURE__ */ V(d, { className: "size-3" }), n.source.section ? r("sourceSection", {
239
245
  doc: c.title,
240
246
  section: n.source.section
241
247
  }) : c.title]
@@ -244,7 +250,7 @@ function q({ workspace: t, entry: n }) {
244
250
  className: "text-warning",
245
251
  children: r("sourceMissing", { section: n.source.section ?? "" })
246
252
  }),
247
- n.source.identifier && /* @__PURE__ */ H(w, {
253
+ n.source.identifier && /* @__PURE__ */ H(S, {
248
254
  to: "/$workspace/issues/$identifier",
249
255
  params: {
250
256
  workspace: t,
@@ -279,7 +285,7 @@ function J({ workspace: e, entryId: t }) {
279
285
  children: n("mentionedNone")
280
286
  }) : /* @__PURE__ */ H("ul", {
281
287
  className: "divide-y divide-border overflow-hidden rounded-xl border border-border bg-card",
282
- children: [i.issues.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(w, {
288
+ children: [i.issues.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(S, {
283
289
  to: "/$workspace/issues/$identifier",
284
290
  params: {
285
291
  workspace: e,
@@ -287,7 +293,7 @@ function J({ workspace: e, entryId: t }) {
287
293
  },
288
294
  className: o,
289
295
  children: [
290
- /* @__PURE__ */ V(m, {
296
+ /* @__PURE__ */ V(p, {
291
297
  category: t.statusCategory,
292
298
  className: "size-3.5 shrink-0"
293
299
  }),
@@ -300,15 +306,15 @@ function J({ workspace: e, entryId: t }) {
300
306
  children: t.title
301
307
  })
302
308
  ]
303
- }) }, t.identifier)), i.docs.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(w, {
309
+ }) }, t.identifier)), i.docs.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(S, {
304
310
  to: "/$workspace/docs/$doc",
305
311
  params: {
306
312
  workspace: e,
307
- doc: g(t)
313
+ doc: h(t)
308
314
  },
309
315
  className: o,
310
316
  children: [
311
- /* @__PURE__ */ V(f, { className: "size-3.5 shrink-0 text-muted-foreground" }),
317
+ /* @__PURE__ */ V(d, { className: "size-3.5 shrink-0 text-muted-foreground" }),
312
318
  /* @__PURE__ */ V("span", {
313
319
  className: "w-16 shrink-0 text-xs text-muted-foreground",
314
320
  children: n("doc")
@@ -323,7 +329,7 @@ function J({ workspace: e, entryId: t }) {
323
329
  });
324
330
  }
325
331
  function Y({ workspace: e, entryId: t }) {
326
- let r = z("knowledge.history"), { data: i = [] } = U(n(e, t)), { actorName: c } = C(e);
332
+ let r = z("knowledge.history"), { data: i = [] } = U(n(e, t)), { actorName: c } = b(e);
327
333
  return i.length === 0 ? null : /* @__PURE__ */ V(k, {
328
334
  title: r("title"),
329
335
  variant: "bare",
package/styles.css CHANGED
@@ -268,6 +268,7 @@ body[data-tandem] > :not(:has(.tandem)) {
268
268
  /* A link to a doc reads as a chip, so it is told apart from a web link. */
269
269
  .prose-issue a[href*="/docs/"] {
270
270
  border: 1px solid var(--color-border);
271
+ cursor: pointer;
271
272
  border-radius: 0.375rem;
272
273
  background: var(--color-muted);
273
274
  padding: 0.05em 0.4em;