@parallelworks/tandem-web 0.175.2 → 0.175.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.
@@ -7,17 +7,16 @@ import { openShare as _ } from "../lib/share.js";
7
7
  import { teamPath as v } from "../lib/teamPaths.js";
8
8
  import { DocIcon as y } from "./DocIcon.js";
9
9
  import { EntityIcon as b } from "./EntityIcon.js";
10
- import { AddIcon as ee, ChevronRightIcon as x, FileTextIcon as S, SearchIcon as te } from "./icons.js";
11
- import { useMarkdownTransfer as C } from "./MarkdownTransfer.js";
12
- import { Combobox as ne, IconButton as w, RelativeTime as T, SearchInput as re, Tooltip as E, buttonClasses as ie, menuDivider as D, useOpenMenu as O } from "@parallelworks/ui";
13
- import { useEffect as k, useRef as ae, useState as A, useSyncExternalStore as oe } from "react";
14
- import { useTranslations as j } from "use-intl";
15
- import { Fragment as se, jsx as M, jsxs as N } from "react/jsx-runtime";
16
- import { keepPreviousData as P, useQuery as F, useSuspenseQuery as ce } from "@tanstack/react-query";
17
- import { MoreButton as I } from "@parallelworks/ui/list";
18
- import { AppFrameNavGroup as L } from "@parallelworks/ui/app-frame";
10
+ import { AddIcon as ee, ChevronRightIcon as x, FileTextIcon as te, SearchIcon as S } from "./icons.js";
11
+ import { useMarkdownTransfer as ne } from "./MarkdownTransfer.js";
12
+ import { Combobox as C, IconButton as w, RelativeTime as re, SearchInput as ie, Tooltip as T, buttonClasses as ae, menuDivider as E, useOpenMenu as D } from "@parallelworks/ui";
13
+ import { useEffect as O, useRef as oe, useState as k, useSyncExternalStore as se } from "react";
14
+ import { useTranslations as A } from "use-intl";
15
+ import { Fragment as ce, jsx as j, jsxs as M } from "react/jsx-runtime";
16
+ import { keepPreviousData as N, useQuery as P, useSuspenseQuery as le } from "@tanstack/react-query";
17
+ import { MoreButton as F } from "@parallelworks/ui/list";
19
18
  // src/components/DocsTree.tsx
20
- var le = "application/x-tandem-doc", R = (...e) => e.filter(Boolean).join(" "), ue = "flex items-start gap-0.5 rounded-md text-sm text-muted-foreground hover:bg-muted hover:text-foreground", de = "bg-muted font-medium !text-foreground", fe = "bg-[var(--theme-sidebar-active-bg,var(--theme-accent-subtle))] hover:bg-[var(--theme-sidebar-active-bg,var(--theme-accent-subtle))] !text-[var(--theme-sidebar-active-text,var(--theme-accent))]", z = [
19
+ var I = "application/x-tandem-doc", L = (...e) => e.filter(Boolean).join(" "), R = "flex items-start gap-0.5 rounded-md text-sm text-muted-foreground hover:bg-muted hover:text-foreground", z = "bg-muted font-medium !text-foreground", ue = [
21
20
  "pl-3.5",
22
21
  "pl-6",
23
22
  "pl-8.5",
@@ -54,23 +53,23 @@ var K = {
54
53
  after: "relative after:absolute after:inset-x-1 after:-bottom-px after:h-0.5 after:rounded after:bg-primary",
55
54
  inside: "ring-2 ring-primary ring-inset"
56
55
  };
57
- function q({ workspace: t, current: c, page: m = !1, onIndex: _ = !1, menu: v, team: y }) {
58
- let T = j("docs"), { data: E } = ce(r(t)), { data: D } = ce(i(t)), { data: P = [] } = F(n(t, { top: !0 })), { data: I } = F({
56
+ function de({ workspace: t, current: c, page: m = !1, onIndex: _ = !1, menu: v }) {
57
+ let y = A("docs"), { data: re } = le(r(t)), { data: T } = le(i(t)), { data: E = [] } = P(n(t, { top: !0 })), { data: N } = P({
59
58
  ...e(t, c ?? ""),
60
59
  enabled: !!c
61
- }), L = I?.key ?? c, le = O(), ue = s(t), fe = g(), z = o(t), V = C(t), [H, U] = A(!1), [G, K] = A(""), [q, me] = A(""), [J, ge] = A(!1), ve = y ? `${t}/${y.id}` : t, [Y, X] = A(() => d(ve)), { doc: Z, over: ye } = oe(W.subscribe, W.get), be = ae(null);
62
- k(() => {
63
- let e = setTimeout(() => me(G.trim()), 200);
60
+ }), F = N?.key ?? c, I = D(), R = s(t), ue = g(), V = o(t), H = ne(t), [U, G] = k(!1), [K, de] = k(""), [q, pe] = k(""), [J, ge] = k(!1), [Y, X] = k(() => d(t)), { doc: Z, over: _e } = se(W.subscribe, W.get), ve = oe(null);
61
+ O(() => {
62
+ let e = setTimeout(() => pe(K.trim()), 200);
64
63
  return () => clearTimeout(e);
65
- }, [G]), k(() => {
66
- H && be.current?.focus();
67
- }, [H]), k(() => u(ve, Y), [ve, Y]);
68
- let Q = E.filter((e) => !e.archivedAt), xe = I ? f(I) : "", Se = (I ? (I.ancestors ?? []).map((e) => e.id) : []).join(" ");
69
- k(() => {
70
- xe && X((e) => l(e, xe, Se ? Se.split(" ") : []));
71
- }, [xe, Se]);
72
- let $ = !m && Y.collapsed && !H, Ce = {
73
- over: ye,
64
+ }, [K]), O(() => {
65
+ U && ve.current?.focus();
66
+ }, [U]), O(() => u(t, Y), [t, Y]);
67
+ let Q = re.filter((e) => !e.archivedAt), ye = N ? f(N) : "", be = (N ? (N.ancestors ?? []).map((e) => e.id) : []).join(" ");
68
+ O(() => {
69
+ ye && X((e) => l(e, ye, be ? be.split(" ") : []));
70
+ }, [ye, be]);
71
+ let $ = !m && Y.collapsed && !U, xe = {
72
+ over: _e,
74
73
  start: (e) => W.set({ doc: e }),
75
74
  end: () => W.set({
76
75
  doc: void 0,
@@ -78,43 +77,42 @@ function q({ workspace: t, current: c, page: m = !1, onIndex: _ = !1, menu: v, t
78
77
  }),
79
78
  accepts: (e, t) => !!Z && e.id !== Z.id && !t.includes(Z.id),
80
79
  hover: (e, t) => {
81
- (ye?.id !== e || ye.spot !== t) && W.set({ over: {
80
+ (_e?.id !== e || _e.spot !== t) && W.set({ over: {
82
81
  id: e,
83
82
  spot: t
84
83
  } });
85
84
  },
86
85
  drop: (e, t, n) => {
87
86
  if (Z) {
88
- if (t === "inside") z.move.mutate({
87
+ if (t === "inside") V.move.mutate({
89
88
  doc: Z,
90
89
  parent: e
91
90
  }), X((t) => t.open.includes(e.id) ? t : p(t, e.id));
92
91
  else {
93
92
  let r = Q.find((t) => t.id === e.teamId);
94
- z.move.mutate({
93
+ V.move.mutate({
95
94
  doc: Z,
96
95
  ...n ? { parent: n } : { space: r?.key ?? "workspace" },
97
96
  ...t === "before" ? { before: e } : { after: e }
98
97
  });
99
98
  }
100
- Ce.end();
99
+ xe.end();
101
100
  }
102
101
  },
103
102
  dropInSpace: (e, t) => {
104
- Z && z.move.mutate({
103
+ Z && V.move.mutate({
105
104
  doc: Z,
106
105
  space: t?.key ?? e
107
- }), Ce.end();
106
+ }), xe.end();
108
107
  }
109
- }, we = {
110
- drag: Ce,
111
- transfer: V,
108
+ }, Se = {
109
+ drag: xe,
110
+ transfer: H,
112
111
  workspace: t,
113
112
  open: new Set(Y.open),
114
- current: L,
115
- sidebar: !!y,
113
+ current: F,
116
114
  toggle: (e) => X((t) => p(t, e)),
117
- menu: (e) => ue(e, { onRename: () => fe({
115
+ menu: (e) => R(e, { onRename: () => ue({
118
116
  to: "/$workspace/docs/$doc",
119
117
  params: {
120
118
  workspace: t,
@@ -122,94 +120,81 @@ function q({ workspace: t, current: c, page: m = !1, onIndex: _ = !1, menu: v, t
122
120
  },
123
121
  search: { rename: !0 }
124
122
  }) })
125
- }, Te = /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ M(w, {
123
+ }, Ce = /* @__PURE__ */ M(ce, { children: [/* @__PURE__ */ j(w, {
126
124
  variant: "ghost",
127
125
  size: "xs",
128
- icon: /* @__PURE__ */ M(te, {}),
129
- label: T("search"),
130
- pressed: H,
126
+ icon: /* @__PURE__ */ j(S, {}),
127
+ label: y("search"),
128
+ pressed: U,
131
129
  onClick: () => {
132
- U((e) => !e), K("");
130
+ G((e) => !e), de("");
133
131
  },
134
132
  className: m ? "" : B
135
- }), Q.length === 0 ? /* @__PURE__ */ M(w, {
133
+ }), Q.length === 0 ? /* @__PURE__ */ j(w, {
136
134
  variant: "ghost",
137
135
  size: "xs",
138
- icon: /* @__PURE__ */ M(ee, {}),
139
- label: T("new"),
140
- onClick: () => z.create.mutate({}),
141
- disabled: z.create.isPending,
136
+ icon: /* @__PURE__ */ j(ee, {}),
137
+ label: y("new"),
138
+ onClick: () => V.create.mutate({}),
139
+ disabled: V.create.isPending,
142
140
  className: m ? "" : B
143
- }) : /* @__PURE__ */ M(ne, {
141
+ }) : /* @__PURE__ */ j(C, {
144
142
  items: [{
145
143
  value: "",
146
- label: D.name
144
+ label: T.name
147
145
  }, ...Q.map((e) => ({
148
146
  value: e.key,
149
147
  label: e.name,
150
148
  hint: e.key
151
149
  }))],
152
150
  value: null,
153
- onValueChange: (e) => e !== null && z.create.mutate({ team: e || void 0 }),
154
- placeholder: T("chooseTeam"),
155
- "aria-label": T("new"),
151
+ onValueChange: (e) => e !== null && V.create.mutate({ team: e || void 0 }),
152
+ placeholder: y("chooseTeam"),
153
+ "aria-label": y("new"),
156
154
  align: "end",
157
- triggerTooltip: T("new"),
158
- trigger: /* @__PURE__ */ M("button", {
155
+ triggerTooltip: y("new"),
156
+ trigger: /* @__PURE__ */ j("button", {
159
157
  type: "button",
160
- disabled: z.create.isPending,
161
- "aria-label": T("new"),
162
- className: R(ie({
158
+ disabled: V.create.isPending,
159
+ "aria-label": y("new"),
160
+ className: L(ae({
163
161
  variant: "ghost",
164
162
  size: "xs",
165
163
  iconOnly: !0
166
164
  }), !m && B),
167
- children: /* @__PURE__ */ M(ee, {})
165
+ children: /* @__PURE__ */ j(ee, {})
168
166
  })
169
167
  })] });
170
- return y ? /* @__PURE__ */ N("section", {
171
- "aria-label": T("teamDocs", { team: y.name }),
172
- children: [/* @__PURE__ */ M(pe, {
173
- ctx: we,
174
- id: y.id,
175
- team: y,
176
- name: T("title"),
177
- row: !0,
178
- icon: /* @__PURE__ */ M(S, { className: "size-4" }),
179
- docs: P.filter((e) => e.teamId === y.id),
180
- closed: Y.closedSpaces.includes(y.id),
181
- onToggle: () => X((e) => p(e, y.id, !0))
182
- }), V.dialog]
183
- }) : /* @__PURE__ */ N("section", {
184
- "aria-label": T("title"),
185
- className: R(m && "flex min-h-0 flex-1 flex-col"),
168
+ return /* @__PURE__ */ M("section", {
169
+ "aria-label": y("title"),
170
+ className: L(m && "flex min-h-0 flex-1 flex-col"),
186
171
  children: [
187
- m ? /* @__PURE__ */ N("div", {
172
+ m ? /* @__PURE__ */ M("div", {
188
173
  className: "flex h-9 shrink-0 items-center gap-1 px-2",
189
- children: [/* @__PURE__ */ M("h1", {
174
+ children: [/* @__PURE__ */ j("h1", {
190
175
  className: "flex-1 text-sm font-semibold",
191
- children: T("title")
192
- }), Te]
193
- }) : /* @__PURE__ */ N("div", {
194
- className: R("group flex h-8 items-center gap-0.5 rounded-md pr-1 text-sm text-muted-foreground hover:bg-muted hover:text-foreground", _ && de),
176
+ children: y("title")
177
+ }), Ce]
178
+ }) : /* @__PURE__ */ M("div", {
179
+ className: L("group flex h-8 items-center gap-0.5 rounded-md pr-1 text-sm text-muted-foreground hover:bg-muted hover:text-foreground", _ && z),
195
180
  children: [
196
- /* @__PURE__ */ N(h, {
181
+ /* @__PURE__ */ M(h, {
197
182
  to: "/$workspace/docs",
198
183
  params: { workspace: t },
199
- onContextMenu: v ? (e) => le(e, v) : void 0,
184
+ onContextMenu: v ? (e) => I(e, v) : void 0,
200
185
  activeOptions: { exact: !0 },
201
186
  className: "flex h-full min-w-0 flex-1 items-center gap-2.5 pl-2",
202
- children: [/* @__PURE__ */ M(S, { className: "size-4" }), /* @__PURE__ */ M("span", {
187
+ children: [/* @__PURE__ */ j(te, { className: "size-4" }), /* @__PURE__ */ j("span", {
203
188
  className: "truncate",
204
- children: T("title")
189
+ children: y("title")
205
190
  })]
206
191
  }),
207
- Te,
208
- /* @__PURE__ */ M(w, {
192
+ Ce,
193
+ /* @__PURE__ */ j(w, {
209
194
  variant: "ghost",
210
195
  size: "xs",
211
- icon: /* @__PURE__ */ M(x, { className: R(!$ && "rotate-90") }),
212
- label: T($ ? "expand" : "collapse"),
196
+ icon: /* @__PURE__ */ j(x, { className: L(!$ && "rotate-90") }),
197
+ label: y($ ? "expand" : "collapse"),
213
198
  "aria-expanded": !$,
214
199
  onClick: () => X((e) => ({
215
200
  ...e,
@@ -218,112 +203,112 @@ function q({ workspace: t, current: c, page: m = !1, onIndex: _ = !1, menu: v, t
218
203
  })
219
204
  ]
220
205
  }),
221
- H && /* @__PURE__ */ M("div", {
206
+ U && /* @__PURE__ */ j("div", {
222
207
  className: "px-1 py-1",
223
- children: /* @__PURE__ */ M(re, {
224
- ref: be,
225
- value: G,
226
- onValueChange: K,
227
- onKeyDown: (e) => e.key === "Escape" && !G && U(!1),
228
- placeholder: T("search"),
229
- label: T("search"),
208
+ children: /* @__PURE__ */ j(ie, {
209
+ ref: ve,
210
+ value: K,
211
+ onValueChange: de,
212
+ onKeyDown: (e) => e.key === "Escape" && !K && G(!1),
213
+ placeholder: y("search"),
214
+ label: y("search"),
230
215
  size: "sm"
231
216
  })
232
217
  }),
233
- !$ && /* @__PURE__ */ M("div", {
234
- className: R("pt-1", m && "min-h-0 flex-1 overflow-y-auto pb-3"),
235
- children: q ? /* @__PURE__ */ M(he, {
218
+ !$ && /* @__PURE__ */ j("div", {
219
+ className: L("pt-1", m && "min-h-0 flex-1 overflow-y-auto pb-3"),
220
+ children: q ? /* @__PURE__ */ j(me, {
236
221
  workspace: t,
237
222
  query: q,
238
- current: L
239
- }, q) : /* @__PURE__ */ N(se, { children: [
240
- /* @__PURE__ */ M(pe, {
241
- ctx: we,
223
+ current: F
224
+ }, q) : /* @__PURE__ */ M(ce, { children: [
225
+ /* @__PURE__ */ j(fe, {
226
+ ctx: Se,
242
227
  id: "workspace",
243
- name: D.name,
244
- icon: /* @__PURE__ */ M(b, {
245
- icon: D.icon,
246
- color: D.color,
247
- name: D.name
228
+ name: T.name,
229
+ icon: /* @__PURE__ */ j(b, {
230
+ icon: T.icon,
231
+ color: T.color,
232
+ name: T.name
248
233
  }),
249
- docs: P.filter((e) => !e.teamId),
234
+ docs: E.filter((e) => !e.teamId),
250
235
  closed: Y.closedSpaces.includes("workspace"),
251
236
  onToggle: () => X((e) => p(e, "workspace", !0))
252
237
  }),
253
- Q.map((e) => /* @__PURE__ */ M(pe, {
254
- ctx: we,
238
+ Q.map((e) => /* @__PURE__ */ j(fe, {
239
+ ctx: Se,
255
240
  id: e.id,
256
241
  team: e,
257
242
  name: e.name,
258
- icon: /* @__PURE__ */ M(b, {
243
+ icon: /* @__PURE__ */ j(b, {
259
244
  icon: e.icon,
260
245
  color: e.color,
261
246
  name: e.name
262
247
  }),
263
- docs: P.filter((t) => t.teamId === e.id),
248
+ docs: E.filter((t) => t.teamId === e.id),
264
249
  closed: Y.closedSpaces.includes(e.id),
265
250
  onToggle: () => X((t) => p(t, e.id, !0))
266
251
  }, e.id)),
267
- /* @__PURE__ */ N("button", {
252
+ /* @__PURE__ */ M("button", {
268
253
  type: "button",
269
254
  onClick: () => ge((e) => !e),
270
255
  "aria-expanded": J,
271
256
  className: "mt-1 flex h-7 w-full items-center gap-0.5 rounded-md pl-1 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground",
272
- children: [/* @__PURE__ */ M("span", {
257
+ children: [/* @__PURE__ */ j("span", {
273
258
  className: "flex size-5 items-center justify-center",
274
- children: /* @__PURE__ */ M(x, { className: R("size-3", J && "rotate-90") })
275
- }), T("archived")]
259
+ children: /* @__PURE__ */ j(x, { className: L("size-3", J && "rotate-90") })
260
+ }), y("archived")]
276
261
  }),
277
- J && /* @__PURE__ */ M(_e, {
262
+ J && /* @__PURE__ */ j(he, {
278
263
  workspace: t,
279
- current: L
264
+ current: F
280
265
  })
281
266
  ] })
282
267
  }),
283
- V.dialog
268
+ H.dialog
284
269
  ]
285
270
  });
286
271
  }
287
- function pe({ ctx: e, id: n, team: r, name: i, icon: a, docs: s, closed: c, onToggle: l, row: u = !1 }) {
288
- let d = j("docs"), f = j("common"), p = O(), h = o(e.workspace), y = m(), b = g(), S = e.workspace, { data: te = [] } = F(t(S)), C = `docs-space-${n}`, ne = j("docViews"), T = () => [
272
+ function fe({ ctx: e, id: n, team: r, name: i, icon: a, docs: s, closed: c, onToggle: l }) {
273
+ let u = A("docs"), d = A("common"), f = D(), p = o(e.workspace), h = m(), y = g(), b = e.workspace, { data: te = [] } = P(t(b)), S = `docs-space-${n}`, ne = A("docViews"), C = () => [
289
274
  {
290
- label: d("newInSpace"),
291
- onClick: () => h.create.mutate({ team: r?.key })
275
+ label: u("newInSpace"),
276
+ onClick: () => p.create.mutate({ team: r?.key })
292
277
  },
293
278
  {
294
279
  label: ne("openTable"),
295
- onClick: () => b({
280
+ onClick: () => y({
296
281
  to: "/$workspace/docs/space/$space",
297
282
  params: {
298
- workspace: S,
283
+ workspace: b,
299
284
  space: r?.key ?? "workspace"
300
285
  }
301
286
  })
302
287
  },
303
288
  {
304
- label: d("newFromTemplate"),
289
+ label: u("newFromTemplate"),
305
290
  items: te.map((e) => ({
306
291
  label: e.title,
307
- onClick: () => h.create.mutate({
292
+ onClick: () => p.create.mutate({
308
293
  team: r?.key,
309
294
  template: e.id
310
295
  })
311
296
  }))
312
297
  },
313
298
  {
314
- label: d("importFiles"),
299
+ label: u("importFiles"),
315
300
  onClick: () => e.transfer.pick({ space: r?.key ?? "workspace" })
316
301
  },
317
302
  {
318
- label: d("importFolder"),
303
+ label: u("importFolder"),
319
304
  onClick: () => e.transfer.pick({ space: r?.key ?? "workspace" }, !0)
320
305
  },
321
306
  {
322
- label: d("exportMarkdown"),
307
+ label: u("exportMarkdown"),
323
308
  onClick: () => e.transfer.download({ space: r?.key ?? "workspace" })
324
309
  },
325
310
  {
326
- label: d("shareSpace"),
311
+ label: u("shareSpace"),
327
312
  onClick: () => _({
328
313
  space: r?.key ?? "workspace",
329
314
  title: i
@@ -331,97 +316,86 @@ function pe({ ctx: e, id: n, team: r, name: i, icon: a, docs: s, closed: c, onTo
331
316
  },
332
317
  ...r ? [
333
318
  {
334
- label: d("teamIssues"),
335
- onClick: () => b({
319
+ label: u("teamIssues"),
320
+ onClick: () => y({
336
321
  to: "/$workspace/teams/$key/issues",
337
322
  params: {
338
- workspace: S,
323
+ workspace: b,
339
324
  key: r.key
340
325
  }
341
326
  })
342
327
  },
343
- D,
344
- ...y(v(S, r.key, "issues"))
328
+ E,
329
+ ...h(v(b, r.key, "issues"))
345
330
  ] : []
346
331
  ], re = (t) => {
347
- t.dataTransfer.types.includes(le) && (t.preventDefault(), e.drag.hover(`space-${n}`, "inside"));
332
+ t.dataTransfer.types.includes(I) && (t.preventDefault(), e.drag.hover(`space-${n}`, "inside"));
348
333
  }, ie = (t) => {
349
334
  t.preventDefault(), e.drag.dropInSpace("workspace", r);
350
- }, k = s.length > 0 ? /* @__PURE__ */ M(me, {
335
+ }, ae = s.length > 0 ? /* @__PURE__ */ j(q, {
351
336
  ctx: e,
352
- id: C,
337
+ id: S,
353
338
  docs: s,
354
339
  depth: 0,
355
340
  trail: i,
356
341
  above: [],
357
342
  label: i
358
- }) : /* @__PURE__ */ M("p", {
359
- id: C,
360
- className: R("py-1 text-xs text-muted-foreground", u ? "pl-2" : "pl-9"),
361
- children: d("emptyTeam")
362
- }), ae = /* @__PURE__ */ M(w, {
343
+ }) : /* @__PURE__ */ j("p", {
344
+ id: S,
345
+ className: "py-1 pl-9 text-xs text-muted-foreground",
346
+ children: u("emptyTeam")
347
+ }), O = /* @__PURE__ */ j(w, {
363
348
  variant: "ghost",
364
349
  size: "xs",
365
- icon: /* @__PURE__ */ M(ee, {}),
366
- label: d("newInTeamNamed", { team: r?.name ?? i }),
367
- onClick: () => h.create.mutate({ team: r?.key }),
368
- className: u ? void 0 : B
369
- }), A = /* @__PURE__ */ M(I, {
370
- items: T,
371
- label: f("moreActionsFor", { name: r?.name ?? i })
350
+ icon: /* @__PURE__ */ j(ee, {}),
351
+ label: u("newInTeamNamed", { team: r?.name ?? i }),
352
+ onClick: () => p.create.mutate({ team: r?.key }),
353
+ className: B
354
+ }), oe = /* @__PURE__ */ j(F, {
355
+ items: C,
356
+ label: d("moreActionsFor", { name: r?.name ?? i })
372
357
  });
373
- return u ? /* @__PURE__ */ M(L, {
374
- label: i,
375
- icon: a,
376
- open: !c,
377
- onOpenChange: (e) => e === c && l(),
378
- onContextMenu: (e) => p(e, T()),
379
- onDragOver: re,
380
- onDrop: ie,
381
- className: R(e.drag.over?.id === `space-${n}` && K.inside),
382
- action: A,
383
- children: k
384
- }) : /* @__PURE__ */ N("div", {
358
+ return /* @__PURE__ */ M("div", {
385
359
  className: "mb-1",
386
- children: [/* @__PURE__ */ N("div", {
387
- className: R("group flex h-7 items-center gap-0.5 rounded-md pr-1 pl-1 hover:bg-muted", e.drag.over?.id === `space-${n}` && K.inside),
388
- onContextMenu: (e) => p(e, T()),
360
+ children: [/* @__PURE__ */ M("div", {
361
+ className: L("group flex h-7 items-center gap-0.5 rounded-md pr-1 pl-1 hover:bg-muted", e.drag.over?.id === `space-${n}` && K.inside),
362
+ onContextMenu: (e) => f(e, C()),
389
363
  onDragOver: re,
390
364
  onDrop: ie,
391
365
  children: [
392
- /* @__PURE__ */ M(E, {
393
- content: d(c ? "expand" : "collapse"),
394
- children: /* @__PURE__ */ N("button", {
366
+ /* @__PURE__ */ j(T, {
367
+ content: u(c ? "expand" : "collapse"),
368
+ children: /* @__PURE__ */ M("button", {
395
369
  type: "button",
396
370
  onClick: l,
397
371
  "aria-expanded": !c,
398
- "aria-controls": c ? void 0 : C,
372
+ "aria-controls": c ? void 0 : S,
399
373
  className: "flex h-full min-w-0 flex-1 items-center gap-1.5 text-left text-xs font-medium text-muted-foreground hover:text-foreground",
400
374
  children: [
401
- /* @__PURE__ */ M("span", {
375
+ /* @__PURE__ */ j("span", {
402
376
  className: "flex size-5 shrink-0 items-center justify-center",
403
- children: /* @__PURE__ */ M(x, { className: R("size-3", !c && "rotate-90") })
377
+ children: /* @__PURE__ */ j(x, { className: L("size-3", !c && "rotate-90") })
404
378
  }),
405
379
  a,
406
- /* @__PURE__ */ M("span", {
380
+ /* @__PURE__ */ j("span", {
407
381
  className: "truncate",
408
382
  children: i
409
383
  })
410
384
  ]
411
385
  })
412
386
  }),
413
- A,
414
- ae
387
+ oe,
388
+ O
415
389
  ]
416
- }), !c && k]
390
+ }), !c && ae]
417
391
  });
418
392
  }
419
- function me({ ctx: e, id: t, docs: n, depth: r, trail: i, parent: a, above: o, label: s }) {
420
- return /* @__PURE__ */ M("ul", {
393
+ function q({ ctx: e, id: t, docs: n, depth: r, trail: i, parent: a, above: o, label: s }) {
394
+ return /* @__PURE__ */ j("ul", {
421
395
  id: t,
422
396
  "aria-label": s,
423
397
  className: "space-y-px",
424
- children: n.map((t) => /* @__PURE__ */ M(J, {
398
+ children: n.map((t) => /* @__PURE__ */ j(pe, {
425
399
  ctx: e,
426
400
  doc: t,
427
401
  depth: r,
@@ -431,23 +405,23 @@ function me({ ctx: e, id: t, docs: n, depth: r, trail: i, parent: a, above: o, l
431
405
  }, t.id))
432
406
  });
433
407
  }
434
- function J({ ctx: e, doc: t, depth: r, trail: i, parent: o, above: s }) {
435
- let l = j("docs"), u = j("common"), d = O(), f = t.children > 0 && e.open.has(t.id), { data: p = [] } = F({
408
+ function pe({ ctx: e, doc: t, depth: r, trail: i, parent: o, above: s }) {
409
+ let l = A("docs"), u = A("common"), d = D(), f = t.children > 0 && e.open.has(t.id), { data: p = [] } = P({
436
410
  ...n(e.workspace, { parent: t.key }),
437
411
  enabled: f
438
- }), m = e.current === t.key, g = ae(null);
439
- k(() => {
412
+ }), m = e.current === t.key, g = oe(null);
413
+ O(() => {
440
414
  m && g.current?.scrollIntoView({ block: "nearest" });
441
415
  }, [m]);
442
416
  let _ = l("pathStep", {
443
417
  path: i,
444
418
  title: t.title
445
419
  }), v = `docs-tree-${t.id}`;
446
- return /* @__PURE__ */ N("li", { children: [/* @__PURE__ */ N("div", {
447
- className: R(ue, "group", z[c(r)], m && (e.sidebar ? fe : de), e.drag.over?.id === t.id && K[e.drag.over.spot]),
420
+ return /* @__PURE__ */ M("li", { children: [/* @__PURE__ */ M("div", {
421
+ className: L(R, "group", ue[c(r)], m && z, e.drag.over?.id === t.id && K[e.drag.over.spot]),
448
422
  draggable: !0,
449
423
  onDragStart: (n) => {
450
- n.dataTransfer.effectAllowed = "move", n.dataTransfer.setData(le, t.key), e.drag.start(t);
424
+ n.dataTransfer.effectAllowed = "move", n.dataTransfer.setData(I, t.key), e.drag.start(t);
451
425
  },
452
426
  onDragEnd: e.drag.end,
453
427
  onDragOver: (n) => {
@@ -457,21 +431,21 @@ function J({ ctx: e, doc: t, depth: r, trail: i, parent: o, above: s }) {
457
431
  n.preventDefault(), e.drag.drop(t, G(n), o);
458
432
  },
459
433
  children: [
460
- t.children > 0 ? /* @__PURE__ */ M(E, {
434
+ t.children > 0 ? /* @__PURE__ */ j(T, {
461
435
  content: l(f ? "collapse" : "expand"),
462
- children: /* @__PURE__ */ M("button", {
436
+ children: /* @__PURE__ */ j("button", {
463
437
  type: "button",
464
438
  onClick: () => e.toggle(t.id),
465
439
  "aria-expanded": f,
466
440
  "aria-controls": f ? v : void 0,
467
441
  "aria-label": l("inside", { title: t.title }),
468
442
  className: V,
469
- children: /* @__PURE__ */ M(x, { className: R("size-3", f && "rotate-90") })
443
+ children: /* @__PURE__ */ j(x, { className: L("size-3", f && "rotate-90") })
470
444
  })
471
- }) : /* @__PURE__ */ M("span", { className: "size-5 shrink-0" }),
472
- /* @__PURE__ */ M(E, {
445
+ }) : /* @__PURE__ */ j("span", { className: "size-5 shrink-0" }),
446
+ /* @__PURE__ */ j(T, {
473
447
  content: _,
474
- children: /* @__PURE__ */ N(h, {
448
+ children: /* @__PURE__ */ M(h, {
475
449
  to: "/$workspace/docs/$doc",
476
450
  params: {
477
451
  workspace: e.workspace,
@@ -482,26 +456,26 @@ function J({ ctx: e, doc: t, depth: r, trail: i, parent: o, above: s }) {
482
456
  onContextMenu: (n) => d(n, e.menu(t)),
483
457
  className: "line-clamp-2 min-w-0 flex-1 break-words py-1 pr-1",
484
458
  children: [
485
- /* @__PURE__ */ M(y, {
459
+ /* @__PURE__ */ j(y, {
486
460
  icon: t.icon,
487
461
  className: "mr-1.5 inline-flex size-3.5 align-[-2px]",
488
462
  emojiClassName: "text-xs"
489
463
  }),
490
464
  t.title,
491
- t.template && /* @__PURE__ */ M("span", {
465
+ t.template && /* @__PURE__ */ j("span", {
492
466
  className: "ml-1.5 rounded border border-border px-1 align-middle text-[10px] font-medium text-muted-foreground",
493
467
  children: l("templateTag")
494
468
  })
495
469
  ]
496
470
  })
497
471
  }),
498
- /* @__PURE__ */ M(I, {
472
+ /* @__PURE__ */ j(F, {
499
473
  items: () => e.menu(t),
500
474
  label: u("moreActionsFor", { name: t.title }),
501
475
  className: "mt-0.5 mr-0.5"
502
476
  })
503
477
  ]
504
- }), f && p.length > 0 && /* @__PURE__ */ M(me, {
478
+ }), f && p.length > 0 && /* @__PURE__ */ j(q, {
505
479
  ctx: e,
506
480
  id: v,
507
481
  docs: p,
@@ -512,21 +486,21 @@ function J({ ctx: e, doc: t, depth: r, trail: i, parent: o, above: s }) {
512
486
  label: l("inside", { title: t.title })
513
487
  })] });
514
488
  }
515
- function he({ workspace: e, query: t, current: i }) {
516
- let o = j("docs"), c = O(), l = s(e), { data: u = [] } = F(r(e)), [d, f] = A(H), { data: p, isPending: m } = F({
489
+ function me({ workspace: e, query: t, current: i }) {
490
+ let o = A("docs"), c = D(), l = s(e), { data: u = [] } = P(r(e)), [d, f] = k(H), { data: p, isPending: m } = P({
517
491
  ...n(e, {
518
492
  q: t,
519
493
  limit: d
520
494
  }),
521
- placeholderData: P
495
+ placeholderData: N
522
496
  });
523
- return m ? /* @__PURE__ */ M("p", {
497
+ return m ? /* @__PURE__ */ j("p", {
524
498
  className: "px-2 text-sm text-muted-foreground",
525
499
  children: o("searching")
526
- }) : p?.length ? /* @__PURE__ */ N("ul", {
500
+ }) : p?.length ? /* @__PURE__ */ M("ul", {
527
501
  className: "space-y-1",
528
502
  "aria-label": o("results"),
529
- children: [p.map((t) => /* @__PURE__ */ M("li", { children: /* @__PURE__ */ N(h, {
503
+ children: [p.map((t) => /* @__PURE__ */ j("li", { children: /* @__PURE__ */ M(h, {
530
504
  to: "/$workspace/docs/$doc",
531
505
  params: {
532
506
  workspace: e,
@@ -534,52 +508,52 @@ function he({ workspace: e, query: t, current: i }) {
534
508
  },
535
509
  onContextMenu: (e) => c(e, l(t)),
536
510
  "aria-current": i === t.key ? "page" : void 0,
537
- className: R("block rounded-md px-2 py-1.5 text-sm hover:bg-muted", i === t.key && "bg-muted"),
538
- children: [/* @__PURE__ */ N("span", {
511
+ className: L("block rounded-md px-2 py-1.5 text-sm hover:bg-muted", i === t.key && "bg-muted"),
512
+ children: [/* @__PURE__ */ M("span", {
539
513
  className: "flex items-center gap-2 font-medium",
540
514
  children: [
541
- /* @__PURE__ */ M(y, {
515
+ /* @__PURE__ */ j(y, {
542
516
  icon: t.icon,
543
517
  className: "size-3.5",
544
518
  emojiClassName: "text-xs"
545
519
  }),
546
- /* @__PURE__ */ M("span", {
520
+ /* @__PURE__ */ j("span", {
547
521
  className: "truncate",
548
522
  children: t.title
549
523
  }),
550
- /* @__PURE__ */ M("span", {
524
+ /* @__PURE__ */ j("span", {
551
525
  className: "ml-auto shrink-0 text-xs font-normal text-muted-foreground",
552
526
  children: u.find((e) => e.id === t.teamId)?.key ?? o("workspaceShort")
553
527
  })
554
528
  ]
555
- }), t.snippet && /* @__PURE__ */ M(ge, { text: t.snippet })]
556
- }) }, t.id)), p.length === d && d < U && /* @__PURE__ */ M("li", { children: /* @__PURE__ */ M("button", {
529
+ }), t.snippet && /* @__PURE__ */ j(J, { text: t.snippet })]
530
+ }) }, t.id)), p.length === d && d < U && /* @__PURE__ */ j("li", { children: /* @__PURE__ */ j("button", {
557
531
  type: "button",
558
532
  onClick: () => f((e) => Math.min(e + H, U)),
559
533
  className: "w-full rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground hover:bg-muted hover:text-foreground",
560
534
  children: o("moreResults")
561
535
  }) })]
562
- }) : /* @__PURE__ */ M("p", {
536
+ }) : /* @__PURE__ */ j("p", {
563
537
  className: "px-2 text-sm text-muted-foreground",
564
538
  children: o("noResults")
565
539
  });
566
540
  }
567
- function ge({ text: e }) {
541
+ function J({ text: e }) {
568
542
  let t = e.split("**");
569
- return /* @__PURE__ */ M("span", {
543
+ return /* @__PURE__ */ j("span", {
570
544
  className: "mt-0.5 line-clamp-2 text-xs text-muted-foreground",
571
- children: t.map((e, t) => t % 2 == 1 ? /* @__PURE__ */ M("mark", {
545
+ children: t.map((e, t) => t % 2 == 1 ? /* @__PURE__ */ j("mark", {
572
546
  className: "bg-transparent font-semibold text-foreground",
573
547
  children: e
574
- }, t) : /* @__PURE__ */ M("span", { children: e }, t))
548
+ }, t) : /* @__PURE__ */ j("span", { children: e }, t))
575
549
  });
576
550
  }
577
- function _e({ workspace: e, current: t }) {
578
- let r = j("docs"), i = O(), o = s(e), { data: c, isPending: l } = F(n(e, { archived: !0 }));
579
- return l ? null : c?.length ? /* @__PURE__ */ M("ul", {
551
+ function he({ workspace: e, current: t }) {
552
+ let r = A("docs"), i = D(), o = s(e), { data: c, isPending: l } = P(n(e, { archived: !0 }));
553
+ return l ? null : c?.length ? /* @__PURE__ */ j("ul", {
580
554
  className: "space-y-px",
581
555
  "aria-label": r("archived"),
582
- children: c.map((n) => /* @__PURE__ */ M("li", { children: /* @__PURE__ */ N(h, {
556
+ children: c.map((n) => /* @__PURE__ */ j("li", { children: /* @__PURE__ */ M(h, {
583
557
  to: "/$workspace/docs/$doc",
584
558
  params: {
585
559
  workspace: e,
@@ -587,18 +561,18 @@ function _e({ workspace: e, current: t }) {
587
561
  },
588
562
  onContextMenu: (e) => i(e, o(n)),
589
563
  "aria-current": t === n.key ? "page" : void 0,
590
- className: R(ue, "items-center gap-1.5 py-1 pr-1 pl-2", t === n.key && de),
564
+ className: L(R, "items-center gap-1.5 py-1 pr-1 pl-2", t === n.key && z),
591
565
  children: [
592
- /* @__PURE__ */ M(y, {
566
+ /* @__PURE__ */ j(y, {
593
567
  icon: n.icon,
594
568
  className: "size-3.5",
595
569
  emojiClassName: "text-xs"
596
570
  }),
597
- /* @__PURE__ */ M("span", {
571
+ /* @__PURE__ */ j("span", {
598
572
  className: "min-w-0 flex-1 truncate",
599
573
  children: n.title
600
574
  }),
601
- n.archivedAt && /* @__PURE__ */ M(T, {
575
+ n.archivedAt && /* @__PURE__ */ j(re, {
602
576
  value: n.archivedAt,
603
577
  format: "compact",
604
578
  exact: "medium",
@@ -606,9 +580,9 @@ function _e({ workspace: e, current: t }) {
606
580
  })
607
581
  ]
608
582
  }) }, n.id))
609
- }) : /* @__PURE__ */ M("p", {
583
+ }) : /* @__PURE__ */ j("p", {
610
584
  className: "py-1 pl-9 text-xs text-muted-foreground",
611
585
  children: r("noArchived")
612
586
  });
613
587
  }
614
- export { q as DocsTree };
588
+ export { de as DocsTree };