@parallelworks/tandem-web 0.188.1 → 0.189.1

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.
@@ -4108,6 +4108,9 @@ var e = {
4108
4108
  removeView: "Remove view",
4109
4109
  makeSeriesDoc: "Make the {series} notes for this day",
4110
4110
  newOn: "New sub-page on {date}",
4111
+ emptyPage: "Empty page",
4112
+ fromTemplateDefault: "{template} (default)",
4113
+ moreOnDay: "{count} more",
4111
4114
  previousMonth: "Previous month",
4112
4115
  today: "Today",
4113
4116
  nextMonth: "Next month",
@@ -4108,6 +4108,9 @@ var e = {
4108
4108
  removeView: "Quitar vista",
4109
4109
  makeSeriesDoc: "Crear las notas de {series} de este día",
4110
4110
  newOn: "Nueva subpágina el {date}",
4111
+ emptyPage: "Página vacía",
4112
+ fromTemplateDefault: "{template} (predeterminada)",
4113
+ moreOnDay: "{count} más",
4111
4114
  previousMonth: "Mes anterior",
4112
4115
  today: "Hoy",
4113
4116
  nextMonth: "Mes siguiente",
@@ -4108,6 +4108,9 @@ var e = {
4108
4108
  removeView: "ビューを削除",
4109
4109
  makeSeriesDoc: "この日の {series} のノートを作成",
4110
4110
  newOn: "{date} の新しいサブページ",
4111
+ emptyPage: "空のページ",
4112
+ fromTemplateDefault: "{template}(既定)",
4113
+ moreOnDay: "他 {count} 件",
4111
4114
  previousMonth: "前の月",
4112
4115
  today: "今日",
4113
4116
  nextMonth: "次の月",
@@ -4108,6 +4108,9 @@ var e = {
4108
4108
  removeView: "보기 삭제",
4109
4109
  makeSeriesDoc: "이 날의 {series} 노트 만들기",
4110
4110
  newOn: "{date}에 새 하위 페이지",
4111
+ emptyPage: "빈 페이지",
4112
+ fromTemplateDefault: "{template} (기본)",
4113
+ moreOnDay: "{count}개 더",
4111
4114
  previousMonth: "이전 달",
4112
4115
  today: "오늘",
4113
4116
  nextMonth: "다음 달",
@@ -4108,6 +4108,9 @@ var e = {
4108
4108
  removeView: "删除视图",
4109
4109
  makeSeriesDoc: "创建这一天的 {series} 记录",
4110
4110
  newOn: "在 {date} 新建子页面",
4111
+ emptyPage: "空白页面",
4112
+ fromTemplateDefault: "{template}(默认)",
4113
+ moreOnDay: "还有 {count} 篇",
4111
4114
  previousMonth: "上个月",
4112
4115
  today: "今天",
4113
4116
  nextMonth: "下个月",
@@ -1,28 +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 { 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";
3
+ import { appPath as s, basePath as c } from "../lib/base.js";
4
+ import { docLooks as l } from "../lib/docLooks.js";
5
+ import { docKey as u, docRef as d } from "../lib/docs.js";
6
+ import { glossary as f, headingAnchor as p } from "../lib/glossary.js";
7
+ import { issueRefs as m } from "../lib/issueRefs.js";
8
+ import { useTermRefs as h } from "../lib/knowledge.js";
9
+ import { termRef as g } from "../lib/knowledgeKinds.js";
10
+ import { mentionable as _ } from "../lib/mentions.js";
11
+ import { Link as v, useNavigate as y } from "../lib/router.js";
12
+ import { teamNames as b } from "../lib/teamNames.js";
13
+ import { DocIcon as x } from "./DocIcon.js";
14
+ import { termCaretEvent as S } from "./editorPlugins.js";
15
+ import { FileTextIcon as C } from "./icons.js";
16
+ import { PersonCard as w } from "./PersonHoverCard.js";
17
+ import { HoverCard as T, Loader as E } from "@parallelworks/ui";
18
+ import { useEffect as D, useRef as O, useState as k } from "react";
19
+ import { useTranslations as A } from "use-intl";
20
+ import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
21
+ import { useQuery as P, useQueryClient as F } from "@tanstack/react-query";
22
22
  // src/components/HoverCards.tsx
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);
23
+ var I = ".kb-term, .person-mention, .prose-issue a[href*=\"/docs/\"]", L = 300, R = 200;
24
+ function z(e) {
25
+ let t = e?.closest(I);
26
26
  if (!t) return null;
27
27
  if (t.classList.contains("kb-term")) {
28
28
  let e = t.dataset.term;
@@ -44,45 +44,46 @@ function R(e) {
44
44
  return r?.[1] ? {
45
45
  kind: "doc",
46
46
  el: t,
47
- key: l(r[1])
47
+ key: u(r[1])
48
48
  } : null;
49
49
  }
50
- function z(e) {
50
+ function B(e) {
51
51
  if (!e.closest(".ProseMirror")) return null;
52
52
  let t = new URL(e.getAttribute("href") ?? "", location.href);
53
53
  if (t.origin !== location.origin) return null;
54
54
  let n = s(t.pathname);
55
55
  return /^\/[^/]+\/docs\/(?!space\/)[^/]+\/?$/.test(n) ? n + t.hash : null;
56
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
- _({
57
+ var V = (e) => location.origin + c + e;
58
+ function H({ workspace: n }) {
59
+ let [s, c] = k(null), u = O(null), d = O(void 0), { data: p } = P(i(n)), h = y(), v = O((e) => {});
60
+ v.current = (e) => {
61
+ let t = p?.find((t) => t.id === e);
62
+ h({
62
63
  to: "/$workspace/knowledge/$term",
63
64
  params: {
64
65
  workspace: n,
65
- term: t ? h(t) : e
66
+ term: t ? g(t) : e
66
67
  }
67
68
  });
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) => {
69
+ }, D(() => {
70
+ f.set(p ?? []);
71
+ }, [p]), D(() => () => f.set([]), []);
72
+ let { data: x } = P(r(n));
73
+ D(() => {
74
+ l.set(x ?? []);
75
+ }, [x]), D(() => () => l.set([]), []);
76
+ let { data: C } = P(a(n));
77
+ D(() => {
78
+ _.set((C ?? []).map((e) => e.user.username));
79
+ }, [C]), D(() => () => _.set([]), []);
80
+ let { data: E } = P(o(n));
81
+ D(() => {
82
+ b.set(E ?? []);
83
+ }, [E]), D(() => () => b.set([]), []);
84
+ let A = F();
85
+ D(() => {
86
+ m.set(n, async (r) => {
86
87
  let { issues: i } = t(await e.POST("/api/v1/workspaces/{workspace}/issue-refs", {
87
88
  params: { path: { workspace: n } },
88
89
  body: { identifiers: r }
@@ -90,42 +91,42 @@ function B({ workspace: n }) {
90
91
  return new Map(i.map((e) => [e.identifier, e.issue]));
91
92
  });
92
93
  let r, i = A.getQueryCache().subscribe((e) => {
93
- e.type === "updated" && e.query.queryKey[2] === "issues" && (clearTimeout(r), r = setTimeout(() => p.refresh(), 1e3));
94
+ e.type === "updated" && e.query.queryKey[2] === "issues" && (clearTimeout(r), r = setTimeout(() => m.refresh(), 1e3));
94
95
  });
95
96
  return () => {
96
- clearTimeout(r), i(), p.set("", void 0);
97
+ clearTimeout(r), i(), m.set("", void 0);
97
98
  };
98
99
  }, [n, A]);
99
- let M = D((e) => {});
100
- M.current = (e) => _({
100
+ let j = O((e) => {});
101
+ j.current = (e) => h({
101
102
  to: "/$workspace/issues/$identifier",
102
103
  params: {
103
104
  workspace: n,
104
105
  identifier: e
105
106
  }
106
107
  });
107
- let F = D((e) => {});
108
- F.current = (e) => _({ href: e });
109
- let B = D((e) => {});
110
- B.current = (e) => _({
108
+ let N = O((e) => {});
109
+ N.current = (e) => h({ href: e });
110
+ let I = O((e) => {});
111
+ I.current = (e) => h({
111
112
  to: "/$workspace/teams/$key/issues",
112
113
  params: {
113
114
  workspace: n,
114
115
  key: e
115
116
  }
116
- }), E(() => {
117
+ }), D(() => {
117
118
  let e = (e, t) => {
118
- clearTimeout(f.current), f.current = setTimeout(e, t);
119
+ clearTimeout(d.current), d.current = setTimeout(e, t);
119
120
  }, t = (t) => {
120
121
  if (t.pointerType === "touch") return;
121
- let n = R(t.target);
122
- n && e(() => l(n), I);
122
+ let n = z(t.target);
123
+ n && e(() => c(n), L);
123
124
  }, n = (t) => {
124
125
  let n = t.relatedTarget;
125
- n && u.current?.contains(n) || R(t.target) && e(() => l(null), L);
126
+ n && u.current?.contains(n) || z(t.target) && e(() => c(null), R);
126
127
  }, r = (e) => {
127
- let t = R(e.target);
128
- t && (clearTimeout(f.current), l(t));
128
+ let t = z(e.target);
129
+ t && (clearTimeout(d.current), c(t));
129
130
  }, i = (e) => {
130
131
  e.target.matches?.(".kb-term[tabindex], .prose-issue a[href*=\"/docs/\"]") && r(e);
131
132
  }, a = (e) => {
@@ -136,101 +137,103 @@ function B({ workspace: n }) {
136
137
  return;
137
138
  }
138
139
  if (!t.closest("[contenteditable=\"true\"]")) {
139
- e.preventDefault(), M.current(n);
140
+ e.preventDefault(), j.current(n);
140
141
  return;
141
142
  }
142
143
  }
143
- let a = e.target.closest?.("a[href]"), o = a && e.button === 0 ? z(a) : null;
144
+ let a = e.target.closest?.("a[href]"), o = a && e.button === 0 ? B(a) : null;
144
145
  if (a && o) {
145
- e.preventDefault(), l(null), e.metaKey || e.ctrlKey || e.shiftKey ? window.open(a.href, "_blank", "noopener") : F.current(o);
146
+ e.preventDefault(), c(null), e.metaKey || e.ctrlKey || e.shiftKey ? window.open(V(o), "_blank", "noopener") : N.current(o);
146
147
  return;
147
148
  }
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);
149
+ let s = e.target.closest?.(".team-mention"), l = s?.dataset.team;
150
+ if (s && l && (!s.closest("[contenteditable=\"true\"]") || e.metaKey || e.ctrlKey)) {
151
+ e.preventDefault(), I.current(l);
151
152
  return;
152
153
  }
153
154
  let u = e.target.closest?.(".kb-term");
154
155
  if (!u) return;
155
156
  let d = u.dataset.term;
156
- d && (!u.closest("[contenteditable=\"true\"]") || e.metaKey || e.ctrlKey) ? (e.preventDefault(), l(null), b.current(d)) : r(e);
157
+ d && (!u.closest("[contenteditable=\"true\"]") || e.metaKey || e.ctrlKey) ? (e.preventDefault(), c(null), v.current(d)) : r(e);
157
158
  }, o = (e) => {
158
159
  if (e.button !== 1) return;
159
160
  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"));
161
+ if (!t?.closest("[contenteditable=\"true\"]")) return;
162
+ let n = B(t);
163
+ (t.classList.contains("issue-mention") || n) && (e.preventDefault(), window.open(n ? V(n) : t.href, "_blank", "noopener"));
161
164
  }, s = (e) => {
162
- e.key === "Escape" && u.current?.isConnected && (e.stopPropagation(), e.preventDefault(), l((e) => (e?.el.tabIndex === 0 && e.el.focus(), null)));
165
+ e.key === "Escape" && u.current?.isConnected && (e.stopPropagation(), e.preventDefault(), c((e) => (e?.el.tabIndex === 0 && e.el.focus(), null)));
163
166
  };
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);
167
+ return document.addEventListener("pointerover", t), document.addEventListener("pointerout", n), document.addEventListener("focusin", i), document.addEventListener("click", a), document.addEventListener("auxclick", o), document.addEventListener(S, r), document.addEventListener("keydown", s, !0), () => {
168
+ clearTimeout(d.current), document.removeEventListener("pointerover", t), document.removeEventListener("pointerout", n), document.removeEventListener("focusin", i), document.removeEventListener("click", a), document.removeEventListener("auxclick", o), document.removeEventListener(S, r), document.removeEventListener("keydown", s, !0);
166
169
  };
167
- }, []), E(() => {
170
+ }, []), D(() => {
168
171
  if (!s) return;
169
172
  let e = (e) => {
170
173
  let t = e.target;
171
- !u.current?.contains(t) && !s.el.contains(t) && l(null);
174
+ !u.current?.contains(t) && !s.el.contains(t) && c(null);
172
175
  };
173
176
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
174
177
  }, [s]);
175
178
  let H = s?.el.isConnected ? s : null;
176
- return /* @__PURE__ */ j(w, {
179
+ return /* @__PURE__ */ M(T, {
177
180
  at: H?.el ?? null,
178
181
  open: !!H,
179
182
  onOpenChange: (e) => {
180
- e || l(null);
183
+ e || c(null);
181
184
  },
182
- onPointerEnter: () => clearTimeout(f.current),
185
+ onPointerEnter: () => clearTimeout(d.current),
183
186
  onPointerLeave: () => {
184
- clearTimeout(f.current), f.current = setTimeout(() => l(null), L);
187
+ clearTimeout(d.current), d.current = setTimeout(() => c(null), R);
185
188
  },
186
- card: H && /* @__PURE__ */ j("div", {
189
+ card: H && /* @__PURE__ */ M("div", {
187
190
  ref: u,
188
191
  role: "dialog",
189
192
  "aria-label": H.kind === "doc" ? H.key : H.kind === "person" ? H.username : void 0,
190
193
  className: H.kind === "person" ? "" : "w-80 max-w-[calc(100vw-16px)] p-3 text-sm",
191
- children: H.kind === "term" ? /* @__PURE__ */ j(V, {
194
+ children: H.kind === "term" ? /* @__PURE__ */ M(U, {
192
195
  workspace: n,
193
- entry: m?.find((e) => e.id === H.id)
194
- }) : H.kind === "person" ? /* @__PURE__ */ j(C, {
196
+ entry: p?.find((e) => e.id === H.id)
197
+ }) : H.kind === "person" ? /* @__PURE__ */ M(w, {
195
198
  workspace: n,
196
199
  handle: H.username
197
- }) : /* @__PURE__ */ j(U, {
200
+ }) : /* @__PURE__ */ M(G, {
198
201
  workspace: n,
199
202
  docKey: H.key
200
203
  })
201
204
  })
202
205
  });
203
206
  }
204
- function V({ workspace: e, entry: t }) {
205
- let n = k("knowledge"), r = m(e);
206
- if (!t) return /* @__PURE__ */ j("p", {
207
+ function U({ workspace: e, entry: t }) {
208
+ let n = A("knowledge"), r = h(e);
209
+ if (!t) return /* @__PURE__ */ M("p", {
207
210
  className: "text-muted-foreground",
208
211
  children: n("gone")
209
212
  });
210
213
  let i = t.source.doc;
211
- return /* @__PURE__ */ M(A, { children: [
212
- /* @__PURE__ */ M("p", {
214
+ return /* @__PURE__ */ N(j, { children: [
215
+ /* @__PURE__ */ N("p", {
213
216
  className: "flex items-center gap-2",
214
- children: [/* @__PURE__ */ j(_, {
217
+ children: [/* @__PURE__ */ M(v, {
215
218
  to: "/$workspace/knowledge/$term",
216
219
  params: {
217
220
  workspace: e,
218
- term: h(t)
221
+ term: g(t)
219
222
  },
220
223
  className: "font-semibold hover:underline",
221
224
  children: t.name
222
- }), /* @__PURE__ */ j("span", {
225
+ }), /* @__PURE__ */ M("span", {
223
226
  className: "text-xs text-muted-foreground",
224
227
  children: n(`kind.${t.kind}`)
225
228
  })]
226
229
  }),
227
- /* @__PURE__ */ j("p", {
230
+ /* @__PURE__ */ M("p", {
228
231
  className: "mt-1.5 text-foreground",
229
232
  children: t.definition
230
233
  }),
231
- t.supersededBy && /* @__PURE__ */ j("p", {
234
+ t.supersededBy && /* @__PURE__ */ M("p", {
232
235
  className: "mt-1.5 text-xs",
233
- children: /* @__PURE__ */ j(_, {
236
+ children: /* @__PURE__ */ M(v, {
234
237
  to: "/$workspace/knowledge/$term",
235
238
  params: {
236
239
  workspace: e,
@@ -240,21 +243,21 @@ function V({ workspace: e, entry: t }) {
240
243
  children: n("supersededBy", { name: t.supersededByName ?? "" })
241
244
  })
242
245
  }),
243
- (i || t.source.identifier) && /* @__PURE__ */ M("p", {
246
+ (i || t.source.identifier) && /* @__PURE__ */ N("p", {
244
247
  className: "mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",
245
- children: [i && /* @__PURE__ */ M(_, {
248
+ children: [i && /* @__PURE__ */ N(v, {
246
249
  to: "/$workspace/docs/$doc",
247
250
  params: {
248
251
  workspace: e,
249
- doc: u(i)
252
+ doc: d(i)
250
253
  },
251
- ...t.source.section && { hash: f(t.source.section) },
254
+ ...t.source.section && { hash: p(t.source.section) },
252
255
  className: "inline-flex items-center gap-1 hover:text-foreground",
253
- children: [/* @__PURE__ */ j(S, { className: "size-3" }), t.source.section ? n("sourceSection", {
256
+ children: [/* @__PURE__ */ M(C, { className: "size-3" }), t.source.section ? n("sourceSection", {
254
257
  doc: i.title,
255
258
  section: t.source.section
256
259
  }) : i.title]
257
- }), t.source.identifier && /* @__PURE__ */ j(_, {
260
+ }), t.source.identifier && /* @__PURE__ */ M(v, {
258
261
  to: "/$workspace/issues/$identifier",
259
262
  params: {
260
263
  workspace: e,
@@ -264,41 +267,41 @@ function V({ workspace: e, entry: t }) {
264
267
  children: t.source.identifier
265
268
  })]
266
269
  }),
267
- /* @__PURE__ */ j(_, {
270
+ /* @__PURE__ */ M(v, {
268
271
  to: "/$workspace/knowledge/$term",
269
272
  params: {
270
273
  workspace: e,
271
- term: h(t)
274
+ term: g(t)
272
275
  },
273
276
  className: "mt-2 block text-xs text-primary hover:underline",
274
277
  children: n("openEntry")
275
278
  })
276
279
  ] });
277
280
  }
278
- function H(e) {
281
+ function W(e) {
279
282
  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);
280
283
  }
281
- function U({ workspace: e, docKey: t }) {
282
- let r = k("docLinks"), { data: i, isError: a } = N({
284
+ function G({ workspace: e, docKey: t }) {
285
+ let r = A("docLinks"), { data: i, isError: a } = P({
283
286
  ...n(e, t),
284
287
  retry: !1
285
288
  });
286
- return a ? /* @__PURE__ */ j("p", {
289
+ return a ? /* @__PURE__ */ M("p", {
287
290
  className: "text-muted-foreground",
288
291
  children: r("unavailable")
289
- }) : i ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ M("p", {
292
+ }) : i ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N("p", {
290
293
  className: "flex items-center gap-2 font-semibold",
291
- children: [/* @__PURE__ */ j(b, {
294
+ children: [/* @__PURE__ */ M(x, {
292
295
  icon: i.icon,
293
296
  className: "size-3.5",
294
297
  emojiClassName: "text-xs"
295
- }), /* @__PURE__ */ j("span", {
298
+ }), /* @__PURE__ */ M("span", {
296
299
  className: "truncate",
297
300
  children: i.title
298
301
  })]
299
- }), /* @__PURE__ */ j("p", {
302
+ }), /* @__PURE__ */ M("p", {
300
303
  className: "mt-1.5 line-clamp-4 text-muted-foreground",
301
- children: H(i.body ?? "") || r("empty")
302
- })] }) : /* @__PURE__ */ j(T, { size: 16 });
304
+ children: W(i.body ?? "") || r("empty")
305
+ })] }) : /* @__PURE__ */ M(E, { size: 16 });
303
306
  }
304
- export { B as HoverCards };
307
+ export { H as HoverCards };