@parallelworks/tandem-web 0.194.0 → 0.194.2

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.
@@ -10,45 +10,45 @@ import { Route as p } from "./index.js";
10
10
  import { Button as m, EmptyState as h, SearchInput as g, SegmentedControl as _, Tooltip as v, buttonClasses as y, useOpenMenu as b } from "@parallelworks/ui";
11
11
  import { Suspense as x, useCallback as S, useEffect as C, useMemo as w, useState as T } from "react";
12
12
  import { useLocale as E, useTranslations as D } from "use-intl";
13
- import { Fragment as ee, jsx as O, jsxs as k } from "react/jsx-runtime";
14
- import { useQuery as A, useSuspenseQuery as j } from "@tanstack/react-query";
13
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
14
+ import { useQuery as j, useSuspenseQuery as M } from "@tanstack/react-query";
15
15
  // src/routes/$workspace/knowledge/index.tsx?tsr-split=component
16
- var M = 5, N = 8;
17
- function P() {
18
- let { workspace: o } = p.useParams(), { archived: f, kind: v = "all" } = p.useSearch(), b = D("knowledge"), P = E();
16
+ var N = 5, P = 8;
17
+ function F() {
18
+ let { workspace: o } = p.useParams(), { archived: f, kind: v = "all" } = p.useSearch(), b = D("knowledge"), F = E();
19
19
  l(b("title"));
20
- let I = d(), [L, R] = T(""), [z, B] = T(""), [V, H] = T(null);
20
+ let L = d(), [R, z] = T(""), [B, V] = T(""), [H, U] = T(null);
21
21
  C(() => {
22
- let e = setTimeout(() => B(L.trim()), 200);
22
+ let e = setTimeout(() => V(R.trim()), 200);
23
23
  return () => clearTimeout(e);
24
- }, [L]);
25
- let { data: U } = j(t(o)), { data: W = [] } = A(e(o)), G = {
26
- ...z && { q: z },
24
+ }, [R]);
25
+ let { data: W } = M(t(o)), { data: G = [] } = j(e(o)), K = {
26
+ ...B && { q: B },
27
27
  ...f && { archived: !0 }
28
- }, { data: K } = A({
29
- ...t(o, G),
30
- enabled: !!z || !!f
31
- }), q = !!z || !!f, J = q ? K ?? [] : U, Y = v === "all" ? J : J.filter((e) => e.kind === v), X = S((e) => H(e), []), Z = w(() => {
28
+ }, { data: q } = j({
29
+ ...t(o, K),
30
+ enabled: !!B || !!f
31
+ }), J = !!B || !!f, Y = J ? q ?? [] : W, X = v === "all" ? Y : Y.filter((e) => e.kind === v), Z = S((e) => U(e), []), Q = w(() => {
32
32
  let e = /* @__PURE__ */ new Map();
33
- for (let t of J) e.set(t.kind, (e.get(t.kind) ?? 0) + 1);
33
+ for (let t of Y) e.set(t.kind, (e.get(t.kind) ?? 0) + 1);
34
34
  return e;
35
- }, [J]), Q = w(() => [...Y].sort((e, t) => t.updatedAt.localeCompare(e.updatedAt)).slice(0, M), [Y]), te = w(() => {
36
- let e = new Intl.Collator(P, { sensitivity: "base" }), t = /* @__PURE__ */ new Map();
37
- for (let e of Y) {
38
- let n = W.some((t) => t.id === e.areaId) ? e.areaId : "";
35
+ }, [Y]), ee = w(() => [...X].sort((e, t) => t.updatedAt.localeCompare(e.updatedAt)).slice(0, N), [X]), te = w(() => {
36
+ let e = new Intl.Collator(F, { sensitivity: "base" }), t = /* @__PURE__ */ new Map();
37
+ for (let e of X) {
38
+ let n = G.some((t) => t.id === e.areaId) ? e.areaId : "";
39
39
  t.set(n, [...t.get(n) ?? [], e]);
40
40
  }
41
41
  return [...t].map(([t, n]) => ({
42
42
  id: t,
43
- title: W.find((e) => e.id === t)?.title ?? b("general"),
43
+ title: G.find((e) => e.id === t)?.title ?? b("general"),
44
44
  entries: n.sort((t, n) => e.compare(t.name, n.name))
45
45
  })).sort((t, n) => t.id ? n.id ? e.compare(t.title, n.title) : -1 : 1);
46
46
  }, [
47
- Y,
48
- W,
49
- P,
47
+ X,
48
+ G,
49
+ F,
50
50
  b
51
- ]), ne = (e) => I({
51
+ ]), ne = (e) => L({
52
52
  to: "/$workspace/knowledge",
53
53
  params: { workspace: o },
54
54
  search: {
@@ -56,59 +56,59 @@ function P() {
56
56
  ...e !== "all" && { kind: e }
57
57
  },
58
58
  replace: !0
59
- }), $ = s.filter((e) => Z.has(e) || e === v);
60
- return /* @__PURE__ */ k("div", {
59
+ }), $ = s.filter((e) => Q.has(e) || e === v);
60
+ return /* @__PURE__ */ A("div", {
61
61
  className: "flex h-full flex-col",
62
62
  children: [
63
- /* @__PURE__ */ k("header", {
63
+ /* @__PURE__ */ A("header", {
64
64
  className: "flex h-12 shrink-0 items-center gap-3 border-b border-border px-4 md:px-5",
65
65
  children: [
66
- /* @__PURE__ */ O("h1", {
66
+ /* @__PURE__ */ k("h1", {
67
67
  className: "min-w-0 truncate text-sm font-semibold",
68
68
  children: b("title")
69
69
  }),
70
- /* @__PURE__ */ O(n, {
70
+ /* @__PURE__ */ k(n, {
71
71
  workspace: o,
72
72
  kind: "page",
73
73
  target: "knowledge"
74
74
  }),
75
- /* @__PURE__ */ O("span", {
75
+ /* @__PURE__ */ k("span", {
76
76
  className: "whitespace-nowrap text-xs text-muted-foreground tabular-nums",
77
- children: b("count", { count: U.length })
77
+ children: b("count", { count: W.length })
78
78
  }),
79
- /* @__PURE__ */ O(u, {
79
+ /* @__PURE__ */ k(u, {
80
80
  to: "/$workspace/graph",
81
81
  params: { workspace: o },
82
82
  className: `${y({ size: "sm" })} ml-auto`,
83
83
  children: b("graph")
84
84
  }),
85
- /* @__PURE__ */ k(m, {
85
+ /* @__PURE__ */ A(m, {
86
86
  type: "button",
87
87
  variant: "primary",
88
88
  size: "sm",
89
- onClick: () => X({ kind: "create" }),
90
- children: [/* @__PURE__ */ O(r, { className: "size-3.5" }), /* @__PURE__ */ O("span", {
89
+ onClick: () => Z({ kind: "create" }),
90
+ children: [/* @__PURE__ */ k(r, { className: "size-3.5" }), /* @__PURE__ */ k("span", {
91
91
  className: "max-md:sr-only",
92
92
  children: b("new")
93
93
  })]
94
94
  })
95
95
  ]
96
96
  }),
97
- /* @__PURE__ */ O("div", {
97
+ /* @__PURE__ */ k("div", {
98
98
  className: "min-h-0 flex-1 overflow-y-auto",
99
- children: /* @__PURE__ */ k("div", {
99
+ children: /* @__PURE__ */ A("div", {
100
100
  className: "mx-auto w-full max-w-3xl px-4 pt-8 pb-16 md:px-8",
101
101
  children: [
102
- /* @__PURE__ */ O(g, {
103
- value: L,
104
- onValueChange: R,
102
+ /* @__PURE__ */ k(g, {
103
+ value: R,
104
+ onValueChange: z,
105
105
  label: b("search"),
106
106
  size: "lg",
107
107
  className: "w-full"
108
108
  }),
109
- /* @__PURE__ */ k("div", {
109
+ /* @__PURE__ */ A("div", {
110
110
  className: "mt-4 flex flex-wrap items-center gap-2",
111
- children: [$.length > 1 && /* @__PURE__ */ O(_, {
111
+ children: [$.length > 1 && /* @__PURE__ */ k(_, {
112
112
  label: b("kindLabel"),
113
113
  size: "sm",
114
114
  value: v,
@@ -116,13 +116,13 @@ function P() {
116
116
  options: [{
117
117
  value: "all",
118
118
  label: b("allKinds"),
119
- count: J.length
119
+ count: Y.length
120
120
  }, ...$.map((e) => ({
121
121
  value: e,
122
122
  label: b(`kinds.${e}`),
123
- count: Z.get(e) ?? 0
123
+ count: Q.get(e) ?? 0
124
124
  }))]
125
- }), /* @__PURE__ */ O(u, {
125
+ }), /* @__PURE__ */ k(u, {
126
126
  to: "/$workspace/knowledge",
127
127
  params: { workspace: o },
128
128
  search: {
@@ -137,42 +137,42 @@ function P() {
137
137
  children: b("archived")
138
138
  })]
139
139
  }),
140
- Y.length === 0 ? /* @__PURE__ */ O(h, {
141
- icon: /* @__PURE__ */ O(i, {}),
142
- title: b(q || v !== "all" ? "noMatches" : "emptyTitle"),
143
- description: q || v !== "all" ? void 0 : b("empty"),
144
- action: !q && v === "all" ? /* @__PURE__ */ O(m, {
140
+ X.length === 0 ? /* @__PURE__ */ k(h, {
141
+ icon: /* @__PURE__ */ k(i, {}),
142
+ title: b(J || v !== "all" ? "noMatches" : "emptyTitle"),
143
+ description: J || v !== "all" ? void 0 : b("empty"),
144
+ action: !J && v === "all" ? /* @__PURE__ */ k(m, {
145
145
  type: "button",
146
146
  variant: "primary",
147
- onClick: () => X({ kind: "create" }),
147
+ onClick: () => Z({ kind: "create" }),
148
148
  children: b("new")
149
149
  }) : void 0,
150
150
  className: "mt-16"
151
- }) : q ? /* @__PURE__ */ O(F, {
151
+ }) : J ? /* @__PURE__ */ k(I, {
152
152
  workspace: o,
153
153
  title: b("results"),
154
- entries: Y,
155
- onOpen: X
156
- }) : /* @__PURE__ */ k(ee, { children: [Y.length >= N && /* @__PURE__ */ O(F, {
154
+ entries: X,
155
+ onOpen: Z
156
+ }) : /* @__PURE__ */ A(O, { children: [X.length >= P && /* @__PURE__ */ k(I, {
157
157
  workspace: o,
158
158
  title: b("recent"),
159
- entries: Q,
160
- onOpen: X,
159
+ entries: ee,
160
+ onOpen: Z,
161
161
  showTime: !0
162
- }), te.map((e) => /* @__PURE__ */ O(F, {
162
+ }), te.map((e) => /* @__PURE__ */ k(I, {
163
163
  workspace: o,
164
164
  title: e.title,
165
165
  entries: e.entries,
166
- onOpen: X
166
+ onOpen: Z
167
167
  }, e.id || "general"))] })
168
168
  ]
169
169
  })
170
170
  }),
171
- V && /* @__PURE__ */ O(x, { children: /* @__PURE__ */ O(a, {
171
+ H && /* @__PURE__ */ k(x, { children: /* @__PURE__ */ k(a, {
172
172
  workspace: o,
173
- mode: V,
174
- onClose: () => H(null),
175
- onSaved: (e) => I({
173
+ mode: H,
174
+ onClose: () => U(null),
175
+ onSaved: (e) => L({
176
176
  to: "/$workspace/knowledge/$term",
177
177
  params: {
178
178
  workspace: o,
@@ -183,20 +183,20 @@ function P() {
183
183
  ]
184
184
  });
185
185
  }
186
- function F({ workspace: e, title: t, entries: n, onOpen: r, showTime: i = !1 }) {
186
+ function I({ workspace: e, title: t, entries: n, onOpen: r, showTime: i = !1 }) {
187
187
  let a = D("knowledge"), s = b(), l = o(e, r), d = f();
188
- return /* @__PURE__ */ k("section", {
188
+ return /* @__PURE__ */ A("section", {
189
189
  "aria-label": t,
190
190
  className: "mt-10",
191
- children: [/* @__PURE__ */ k("h2", {
191
+ children: [/* @__PURE__ */ A("h2", {
192
192
  className: "flex items-baseline gap-2 text-base font-semibold",
193
- children: [t, /* @__PURE__ */ O("span", {
193
+ children: [t, /* @__PURE__ */ k("span", {
194
194
  className: "text-xs font-normal text-muted-foreground tabular-nums",
195
195
  children: n.length
196
196
  })]
197
- }), /* @__PURE__ */ O("ul", {
197
+ }), /* @__PURE__ */ k("ul", {
198
198
  className: "mt-3 divide-y divide-border overflow-hidden rounded-xl border border-border bg-card",
199
- children: n.map((t) => /* @__PURE__ */ O("li", { children: /* @__PURE__ */ k(u, {
199
+ children: n.map((t) => /* @__PURE__ */ k("li", { children: /* @__PURE__ */ A(u, {
200
200
  to: "/$workspace/knowledge/$term",
201
201
  params: {
202
202
  workspace: e,
@@ -204,20 +204,27 @@ function F({ workspace: e, title: t, entries: n, onOpen: r, showTime: i = !1 })
204
204
  },
205
205
  onContextMenu: (e) => s(e, l(t)),
206
206
  className: "group flex flex-col gap-1 px-4 py-3 sm:flex-row sm:items-start sm:gap-3 transition-colors duration-150 hover:bg-muted focus-visible:outline-offset-[-2px]",
207
- children: [/* @__PURE__ */ k("span", {
207
+ children: [/* @__PURE__ */ A("span", {
208
208
  className: "min-w-0 flex-1",
209
- children: [/* @__PURE__ */ O("span", {
210
- className: `block truncate text-sm font-medium ${t.status === "superseded" ? "text-muted-foreground line-through" : ""}`,
211
- children: t.name
212
- }), /* @__PURE__ */ O("span", {
213
- className: "mt-0.5 line-clamp-2 text-xs leading-5 text-muted-foreground",
214
- children: t.definition
215
- })]
216
- }), (t.kind !== "term" || i) && /* @__PURE__ */ k("span", {
209
+ children: [
210
+ /* @__PURE__ */ k("span", {
211
+ className: `block truncate text-sm font-medium ${t.status === "superseded" ? "text-muted-foreground line-through" : ""}`,
212
+ children: t.name
213
+ }),
214
+ t.status === "added" && t.replacesName && /* @__PURE__ */ k("span", {
215
+ className: "block truncate text-xs text-primary",
216
+ children: a("suggestsChange", { name: t.replacesName })
217
+ }),
218
+ /* @__PURE__ */ k("span", {
219
+ className: "mt-0.5 line-clamp-2 text-xs leading-5 text-muted-foreground",
220
+ children: t.definition
221
+ })
222
+ ]
223
+ }), (t.kind !== "term" || i) && /* @__PURE__ */ A("span", {
217
224
  className: "flex items-center gap-2 text-xs text-muted-foreground sm:shrink-0 sm:pt-0.5",
218
- children: [t.kind !== "term" && /* @__PURE__ */ O("span", { children: a(`kind.${t.kind}`) }), i && /* @__PURE__ */ O(v, {
225
+ children: [t.kind !== "term" && /* @__PURE__ */ k("span", { children: a(`kind.${t.kind}`) }), i && /* @__PURE__ */ k(v, {
219
226
  content: d.full(t.updatedAt),
220
- children: /* @__PURE__ */ O("time", {
227
+ children: /* @__PURE__ */ k("time", {
221
228
  dateTime: t.updatedAt,
222
229
  className: "tabular-nums",
223
230
  children: d.relative(t.updatedAt)
@@ -228,4 +235,4 @@ function F({ workspace: e, title: t, entries: n, onOpen: r, showTime: i = !1 })
228
235
  })]
229
236
  });
230
237
  }
231
- export { P as component };
238
+ export { F as component };