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