@parallelworks/tandem-web 0.175.1 → 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.
- package/_virtual/_virtual_i18n/en/common.js +4 -1
- package/_virtual/_virtual_i18n/es/common.js +4 -1
- package/_virtual/_virtual_i18n/ja/common.js +4 -1
- package/_virtual/_virtual_i18n/ko/common.js +4 -1
- package/_virtual/_virtual_i18n/zh/common.js +4 -1
- package/components/DocTable.js +30 -19
- package/components/DocsTree.js +198 -224
- package/components/InlineCommand.js +13 -0
- package/package.json +1 -1
- package/routes/_workspace/docs/space2._space.js +134 -115
- package/routes/_workspace/settings/runners2.js +41 -43
- package/routes/_workspace/settings/tokens2.js +115 -117
- package/routes/_workspace2.js +310 -314
package/components/DocsTree.js
CHANGED
|
@@ -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
|
|
11
|
-
import { useMarkdownTransfer as
|
|
12
|
-
import { Combobox as
|
|
13
|
-
import { useEffect as
|
|
14
|
-
import { useTranslations as
|
|
15
|
-
import { Fragment as
|
|
16
|
-
import { keepPreviousData as
|
|
17
|
-
import { MoreButton as
|
|
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
|
|
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
|
|
58
|
-
let
|
|
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
|
-
}),
|
|
62
|
-
|
|
63
|
-
let e = setTimeout(() =>
|
|
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
|
-
}, [
|
|
66
|
-
|
|
67
|
-
}, [
|
|
68
|
-
let Q =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}, [
|
|
72
|
-
let $ = !m && Y.collapsed && !
|
|
73
|
-
over:
|
|
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
|
-
(
|
|
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")
|
|
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
|
-
|
|
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
|
-
|
|
99
|
+
xe.end();
|
|
101
100
|
}
|
|
102
101
|
},
|
|
103
102
|
dropInSpace: (e, t) => {
|
|
104
|
-
Z &&
|
|
103
|
+
Z && V.move.mutate({
|
|
105
104
|
doc: Z,
|
|
106
105
|
space: t?.key ?? e
|
|
107
|
-
}),
|
|
106
|
+
}), xe.end();
|
|
108
107
|
}
|
|
109
|
-
},
|
|
110
|
-
drag:
|
|
111
|
-
transfer:
|
|
108
|
+
}, Se = {
|
|
109
|
+
drag: xe,
|
|
110
|
+
transfer: H,
|
|
112
111
|
workspace: t,
|
|
113
112
|
open: new Set(Y.open),
|
|
114
|
-
current:
|
|
115
|
-
sidebar: !!y,
|
|
113
|
+
current: F,
|
|
116
114
|
toggle: (e) => X((t) => p(t, e)),
|
|
117
|
-
menu: (e) =>
|
|
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
|
-
},
|
|
123
|
+
}, Ce = /* @__PURE__ */ M(ce, { children: [/* @__PURE__ */ j(w, {
|
|
126
124
|
variant: "ghost",
|
|
127
125
|
size: "xs",
|
|
128
|
-
icon: /* @__PURE__ */
|
|
129
|
-
label:
|
|
130
|
-
pressed:
|
|
126
|
+
icon: /* @__PURE__ */ j(S, {}),
|
|
127
|
+
label: y("search"),
|
|
128
|
+
pressed: U,
|
|
131
129
|
onClick: () => {
|
|
132
|
-
|
|
130
|
+
G((e) => !e), de("");
|
|
133
131
|
},
|
|
134
132
|
className: m ? "" : B
|
|
135
|
-
}), Q.length === 0 ? /* @__PURE__ */
|
|
133
|
+
}), Q.length === 0 ? /* @__PURE__ */ j(w, {
|
|
136
134
|
variant: "ghost",
|
|
137
135
|
size: "xs",
|
|
138
|
-
icon: /* @__PURE__ */
|
|
139
|
-
label:
|
|
140
|
-
onClick: () =>
|
|
141
|
-
disabled:
|
|
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__ */
|
|
141
|
+
}) : /* @__PURE__ */ j(C, {
|
|
144
142
|
items: [{
|
|
145
143
|
value: "",
|
|
146
|
-
label:
|
|
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 &&
|
|
154
|
-
placeholder:
|
|
155
|
-
"aria-label":
|
|
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:
|
|
158
|
-
trigger: /* @__PURE__ */
|
|
155
|
+
triggerTooltip: y("new"),
|
|
156
|
+
trigger: /* @__PURE__ */ j("button", {
|
|
159
157
|
type: "button",
|
|
160
|
-
disabled:
|
|
161
|
-
"aria-label":
|
|
162
|
-
className:
|
|
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__ */
|
|
165
|
+
children: /* @__PURE__ */ j(ee, {})
|
|
168
166
|
})
|
|
169
167
|
})] });
|
|
170
|
-
return
|
|
171
|
-
"aria-label":
|
|
172
|
-
|
|
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__ */
|
|
172
|
+
m ? /* @__PURE__ */ M("div", {
|
|
188
173
|
className: "flex h-9 shrink-0 items-center gap-1 px-2",
|
|
189
|
-
children: [/* @__PURE__ */
|
|
174
|
+
children: [/* @__PURE__ */ j("h1", {
|
|
190
175
|
className: "flex-1 text-sm font-semibold",
|
|
191
|
-
children:
|
|
192
|
-
}),
|
|
193
|
-
}) : /* @__PURE__ */
|
|
194
|
-
className:
|
|
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__ */
|
|
181
|
+
/* @__PURE__ */ M(h, {
|
|
197
182
|
to: "/$workspace/docs",
|
|
198
183
|
params: { workspace: t },
|
|
199
|
-
onContextMenu: v ? (e) =>
|
|
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__ */
|
|
187
|
+
children: [/* @__PURE__ */ j(te, { className: "size-4" }), /* @__PURE__ */ j("span", {
|
|
203
188
|
className: "truncate",
|
|
204
|
-
children:
|
|
189
|
+
children: y("title")
|
|
205
190
|
})]
|
|
206
191
|
}),
|
|
207
|
-
|
|
208
|
-
/* @__PURE__ */
|
|
192
|
+
Ce,
|
|
193
|
+
/* @__PURE__ */ j(w, {
|
|
209
194
|
variant: "ghost",
|
|
210
195
|
size: "xs",
|
|
211
|
-
icon: /* @__PURE__ */
|
|
212
|
-
label:
|
|
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
|
-
|
|
206
|
+
U && /* @__PURE__ */ j("div", {
|
|
222
207
|
className: "px-1 py-1",
|
|
223
|
-
children: /* @__PURE__ */
|
|
224
|
-
ref:
|
|
225
|
-
value:
|
|
226
|
-
onValueChange:
|
|
227
|
-
onKeyDown: (e) => e.key === "Escape" && !
|
|
228
|
-
placeholder:
|
|
229
|
-
label:
|
|
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__ */
|
|
234
|
-
className:
|
|
235
|
-
children: q ? /* @__PURE__ */
|
|
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:
|
|
239
|
-
}, q) : /* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
ctx:
|
|
223
|
+
current: F
|
|
224
|
+
}, q) : /* @__PURE__ */ M(ce, { children: [
|
|
225
|
+
/* @__PURE__ */ j(fe, {
|
|
226
|
+
ctx: Se,
|
|
242
227
|
id: "workspace",
|
|
243
|
-
name:
|
|
244
|
-
icon: /* @__PURE__ */
|
|
245
|
-
icon:
|
|
246
|
-
color:
|
|
247
|
-
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:
|
|
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__ */
|
|
254
|
-
ctx:
|
|
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__ */
|
|
243
|
+
icon: /* @__PURE__ */ j(b, {
|
|
259
244
|
icon: e.icon,
|
|
260
245
|
color: e.color,
|
|
261
246
|
name: e.name
|
|
262
247
|
}),
|
|
263
|
-
docs:
|
|
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__ */
|
|
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__ */
|
|
257
|
+
children: [/* @__PURE__ */ j("span", {
|
|
273
258
|
className: "flex size-5 items-center justify-center",
|
|
274
|
-
children: /* @__PURE__ */
|
|
275
|
-
}),
|
|
259
|
+
children: /* @__PURE__ */ j(x, { className: L("size-3", J && "rotate-90") })
|
|
260
|
+
}), y("archived")]
|
|
276
261
|
}),
|
|
277
|
-
J && /* @__PURE__ */
|
|
262
|
+
J && /* @__PURE__ */ j(he, {
|
|
278
263
|
workspace: t,
|
|
279
|
-
current:
|
|
264
|
+
current: F
|
|
280
265
|
})
|
|
281
266
|
] })
|
|
282
267
|
}),
|
|
283
|
-
|
|
268
|
+
H.dialog
|
|
284
269
|
]
|
|
285
270
|
});
|
|
286
271
|
}
|
|
287
|
-
function
|
|
288
|
-
let
|
|
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:
|
|
291
|
-
onClick: () =>
|
|
275
|
+
label: u("newInSpace"),
|
|
276
|
+
onClick: () => p.create.mutate({ team: r?.key })
|
|
292
277
|
},
|
|
293
278
|
{
|
|
294
279
|
label: ne("openTable"),
|
|
295
|
-
onClick: () =>
|
|
280
|
+
onClick: () => y({
|
|
296
281
|
to: "/$workspace/docs/space/$space",
|
|
297
282
|
params: {
|
|
298
|
-
workspace:
|
|
283
|
+
workspace: b,
|
|
299
284
|
space: r?.key ?? "workspace"
|
|
300
285
|
}
|
|
301
286
|
})
|
|
302
287
|
},
|
|
303
288
|
{
|
|
304
|
-
label:
|
|
289
|
+
label: u("newFromTemplate"),
|
|
305
290
|
items: te.map((e) => ({
|
|
306
291
|
label: e.title,
|
|
307
|
-
onClick: () =>
|
|
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:
|
|
299
|
+
label: u("importFiles"),
|
|
315
300
|
onClick: () => e.transfer.pick({ space: r?.key ?? "workspace" })
|
|
316
301
|
},
|
|
317
302
|
{
|
|
318
|
-
label:
|
|
303
|
+
label: u("importFolder"),
|
|
319
304
|
onClick: () => e.transfer.pick({ space: r?.key ?? "workspace" }, !0)
|
|
320
305
|
},
|
|
321
306
|
{
|
|
322
|
-
label:
|
|
307
|
+
label: u("exportMarkdown"),
|
|
323
308
|
onClick: () => e.transfer.download({ space: r?.key ?? "workspace" })
|
|
324
309
|
},
|
|
325
310
|
{
|
|
326
|
-
label:
|
|
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:
|
|
335
|
-
onClick: () =>
|
|
319
|
+
label: u("teamIssues"),
|
|
320
|
+
onClick: () => y({
|
|
336
321
|
to: "/$workspace/teams/$key/issues",
|
|
337
322
|
params: {
|
|
338
|
-
workspace:
|
|
323
|
+
workspace: b,
|
|
339
324
|
key: r.key
|
|
340
325
|
}
|
|
341
326
|
})
|
|
342
327
|
},
|
|
343
|
-
|
|
344
|
-
...
|
|
328
|
+
E,
|
|
329
|
+
...h(v(b, r.key, "issues"))
|
|
345
330
|
] : []
|
|
346
331
|
], re = (t) => {
|
|
347
|
-
t.dataTransfer.types.includes(
|
|
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
|
-
},
|
|
335
|
+
}, ae = s.length > 0 ? /* @__PURE__ */ j(q, {
|
|
351
336
|
ctx: e,
|
|
352
|
-
id:
|
|
337
|
+
id: S,
|
|
353
338
|
docs: s,
|
|
354
339
|
depth: 0,
|
|
355
340
|
trail: i,
|
|
356
341
|
above: [],
|
|
357
342
|
label: i
|
|
358
|
-
}) : /* @__PURE__ */
|
|
359
|
-
id:
|
|
360
|
-
className:
|
|
361
|
-
children:
|
|
362
|
-
}),
|
|
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__ */
|
|
366
|
-
label:
|
|
367
|
-
onClick: () =>
|
|
368
|
-
className:
|
|
369
|
-
}),
|
|
370
|
-
items:
|
|
371
|
-
label:
|
|
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
|
|
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__ */
|
|
387
|
-
className:
|
|
388
|
-
onContextMenu: (e) =>
|
|
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__ */
|
|
393
|
-
content:
|
|
394
|
-
children: /* @__PURE__ */
|
|
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 :
|
|
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__ */
|
|
375
|
+
/* @__PURE__ */ j("span", {
|
|
402
376
|
className: "flex size-5 shrink-0 items-center justify-center",
|
|
403
|
-
children: /* @__PURE__ */
|
|
377
|
+
children: /* @__PURE__ */ j(x, { className: L("size-3", !c && "rotate-90") })
|
|
404
378
|
}),
|
|
405
379
|
a,
|
|
406
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ j("span", {
|
|
407
381
|
className: "truncate",
|
|
408
382
|
children: i
|
|
409
383
|
})
|
|
410
384
|
]
|
|
411
385
|
})
|
|
412
386
|
}),
|
|
413
|
-
|
|
414
|
-
|
|
387
|
+
oe,
|
|
388
|
+
O
|
|
415
389
|
]
|
|
416
|
-
}), !c &&
|
|
390
|
+
}), !c && ae]
|
|
417
391
|
});
|
|
418
392
|
}
|
|
419
|
-
function
|
|
420
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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
|
|
435
|
-
let l =
|
|
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 =
|
|
439
|
-
|
|
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__ */
|
|
447
|
-
className: R
|
|
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(
|
|
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__ */
|
|
434
|
+
t.children > 0 ? /* @__PURE__ */ j(T, {
|
|
461
435
|
content: l(f ? "collapse" : "expand"),
|
|
462
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
443
|
+
children: /* @__PURE__ */ j(x, { className: L("size-3", f && "rotate-90") })
|
|
470
444
|
})
|
|
471
|
-
}) : /* @__PURE__ */
|
|
472
|
-
/* @__PURE__ */
|
|
445
|
+
}) : /* @__PURE__ */ j("span", { className: "size-5 shrink-0" }),
|
|
446
|
+
/* @__PURE__ */ j(T, {
|
|
473
447
|
content: _,
|
|
474
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
516
|
-
let o =
|
|
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:
|
|
495
|
+
placeholderData: N
|
|
522
496
|
});
|
|
523
|
-
return m ? /* @__PURE__ */
|
|
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__ */
|
|
500
|
+
}) : p?.length ? /* @__PURE__ */ M("ul", {
|
|
527
501
|
className: "space-y-1",
|
|
528
502
|
"aria-label": o("results"),
|
|
529
|
-
children: [p.map((t) => /* @__PURE__ */
|
|
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:
|
|
538
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
515
|
+
/* @__PURE__ */ j(y, {
|
|
542
516
|
icon: t.icon,
|
|
543
517
|
className: "size-3.5",
|
|
544
518
|
emojiClassName: "text-xs"
|
|
545
519
|
}),
|
|
546
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ j("span", {
|
|
547
521
|
className: "truncate",
|
|
548
522
|
children: t.title
|
|
549
523
|
}),
|
|
550
|
-
/* @__PURE__ */
|
|
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__ */
|
|
556
|
-
}) }, t.id)), p.length === d && d < U && /* @__PURE__ */
|
|
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__ */
|
|
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
|
|
541
|
+
function J({ text: e }) {
|
|
568
542
|
let t = e.split("**");
|
|
569
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
548
|
+
}, t) : /* @__PURE__ */ j("span", { children: e }, t))
|
|
575
549
|
});
|
|
576
550
|
}
|
|
577
|
-
function
|
|
578
|
-
let r =
|
|
579
|
-
return l ? null : c?.length ? /* @__PURE__ */
|
|
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__ */
|
|
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
|
|
564
|
+
className: L(R, "items-center gap-1.5 py-1 pr-1 pl-2", t === n.key && z),
|
|
591
565
|
children: [
|
|
592
|
-
/* @__PURE__ */
|
|
566
|
+
/* @__PURE__ */ j(y, {
|
|
593
567
|
icon: n.icon,
|
|
594
568
|
className: "size-3.5",
|
|
595
569
|
emojiClassName: "text-xs"
|
|
596
570
|
}),
|
|
597
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ j("span", {
|
|
598
572
|
className: "min-w-0 flex-1 truncate",
|
|
599
573
|
children: n.title
|
|
600
574
|
}),
|
|
601
|
-
n.archivedAt && /* @__PURE__ */
|
|
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__ */
|
|
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 {
|
|
588
|
+
export { de as DocsTree };
|