@parallelworks/tandem-web 0.184.0 → 0.186.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.
package/pages/areas.js CHANGED
@@ -4,33 +4,35 @@ import { AreaTile as c, AreaTiles as l, PlaceTile as u } from "../components/Are
4
4
  import { AreaGroup as d, FoldedAnswer as f } from "../components/AreaWork.js";
5
5
  import { DocIcon as p } from "../components/DocIcon.js";
6
6
  import { EntityIcon as m } from "../components/EntityIcon.js";
7
- import { AddIcon as h, AreaIcon as g, ChevronRightIcon as _, FileTextIcon as v, GridIcon as y, ListViewIcon as b } from "../components/icons.js";
8
- import { WorkCounts as x } from "../components/WorkCounts.js";
9
- import { useAreaActions as S } from "../lib/areas.js";
10
- import { actorAvatar as C } from "../lib/avatar.js";
11
- import { docRef as w } from "../lib/docs.js";
12
- import { usePageTitle as T } from "../lib/pageTitle.js";
13
- import { usePeople as E } from "../lib/people.js";
14
- import { Link as D } from "../lib/router.js";
15
- import { Avatar as O, Breadcrumbs as k, Button as A, Combobox as ee, EmptyState as j, ErrorText as M, IconButton as N, Input as P, Modal as F, ModalTitle as te, SegmentedControl as I, Select as L, Tooltip as R, buttonClasses as z, menuDivider as B, useOpenMenu as V } from "@parallelworks/ui";
16
- import { useParams as H, useSearch as U } from "@tanstack/react-router";
17
- import { Fragment as W, useMemo as G, useState as K } from "react";
7
+ import { ListFavoriteStar as h } from "../components/FavoriteStar.js";
8
+ import { AddIcon as g, AreaIcon as _, ChevronRightIcon as v, FileTextIcon as y, GridIcon as b, ListViewIcon as x } from "../components/icons.js";
9
+ import { WorkCounts as S } from "../components/WorkCounts.js";
10
+ import { useAreaActions as C } from "../lib/areas.js";
11
+ import { actorAvatar as w } from "../lib/avatar.js";
12
+ import { docRef as T } from "../lib/docs.js";
13
+ import { usePageTitle as E } from "../lib/pageTitle.js";
14
+ import { usePeople as D } from "../lib/people.js";
15
+ import { Link as O } from "../lib/router.js";
16
+ import { teamPath as k } from "../lib/teamPaths.js";
17
+ import { Avatar as A, Breadcrumbs as j, Button as M, Combobox as N, EmptyState as P, ErrorText as F, IconButton as I, Input as L, Modal as R, ModalTitle as ee, SegmentedControl as z, Select as B, Tooltip as V, buttonClasses as H, menuDivider as te, useOpenMenu as U } from "@parallelworks/ui";
18
+ import { useParams as ne, useSearch as W } from "@tanstack/react-router";
19
+ import { Fragment as re, useMemo as G, useState as K } from "react";
18
20
  import { useErrorMessage as q } from "@parallelworks/problem/react";
19
21
  import { useTranslations as J } from "use-intl";
20
22
  import { Fragment as Y, jsx as X, jsxs as Z } from "react/jsx-runtime";
21
23
  import { useQuery as Q, useSuspenseQuery as $ } from "@tanstack/react-query";
22
- import { MoreButton as ne } from "@parallelworks/ui/list";
24
+ import { MoreButton as ie } from "@parallelworks/ui/list";
23
25
  // src/pages/areas.tsx
24
- var re = (...e) => e.filter(Boolean).join(" ");
25
- function ie() {
26
- let n = J("areas"), { workspace: r, key: s } = H({ strict: !1 }), { team: c = s } = U({ strict: !1 }), { data: l } = $(e(r)), { data: u } = $(i(r)), p = u.find((e) => e.key === c);
27
- T(n("title"), p?.name);
28
- let _ = p ? l.filter((e) => e.teamId === p.id) : l, { data: v } = $(o(r)), { data: S } = $(t(r)), [C, w] = K(null), { data: E } = Q(a(r, p?.key)), D = E?.notInDocs.length ?? 0, O = _.filter((e) => e.status === "proposed"), k = [...!p && l.some((e) => !e.teamId) ? [{
26
+ var ae = (...e) => e.filter(Boolean).join(" ");
27
+ function oe() {
28
+ let n = J("areas"), { workspace: r, key: s } = ne({ strict: !1 }), { team: c = s } = W({ strict: !1 }), { data: l } = $(e(r)), { data: u } = $(i(r)), p = u.find((e) => e.key === c);
29
+ E(n("title"), p?.name);
30
+ let v = p ? l.filter((e) => e.teamId === p.id) : l, { data: y } = $(o(r)), { data: C } = $(t(r)), [w, T] = K(null), { data: D } = Q(a(r, p?.key)), O = D?.notInDocs.length ?? 0, A = v.filter((e) => e.status === "proposed"), j = [...!p && l.some((e) => !e.teamId) ? [{
29
31
  id: "",
30
32
  key: "workspace",
31
- name: v.name,
32
- icon: v.icon,
33
- color: v.color
33
+ name: y.name,
34
+ icon: y.icon,
35
+ color: y.color
34
36
  }] : [], ...u.filter((e) => !e.archivedAt && (!p || e.id === p.id)).map((e) => ({
35
37
  id: e.id,
36
38
  key: e.key,
@@ -38,16 +40,16 @@ function ie() {
38
40
  icon: e.icon,
39
41
  color: e.color,
40
42
  team: e
41
- }))], ee = (e) => k.find((t) => t.id === (e.teamId ?? "")), M = () => w({
43
+ }))], N = (e) => j.find((t) => t.id === (e.teamId ?? "")), F = () => T({
42
44
  kind: "create",
43
45
  ...p && { space: p.key }
44
- }), P = de(r, (e) => w({
46
+ }), L = pe(r, (e) => T({
45
47
  kind: "edit",
46
48
  area: e
47
- }), (e) => w({
49
+ }), (e) => T({
48
50
  kind: "create",
49
51
  parent: e
50
- })), [F, te] = K(se), L = E && /* @__PURE__ */ X(Y, { children: E.notInDocs.map((e) => /* @__PURE__ */ X(f, {
52
+ })), [R, ee] = K(le), B = D && /* @__PURE__ */ X(Y, { children: D.notInDocs.map((e) => /* @__PURE__ */ X(f, {
51
53
  workspace: r,
52
54
  decision: e,
53
55
  isNew: !1,
@@ -63,40 +65,48 @@ function ie() {
63
65
  className: "text-sm font-semibold",
64
66
  children: p ? n("teamTitle", { team: p.name }) : n("title")
65
67
  }),
68
+ /* @__PURE__ */ X(h, {
69
+ workspace: r,
70
+ page: "areas",
71
+ team: p && {
72
+ href: k(r, p.key, "areas"),
73
+ label: n("teamTitle", { team: p.name })
74
+ }
75
+ }),
66
76
  /* @__PURE__ */ X("span", {
67
77
  className: "text-xs text-muted-foreground tabular-nums",
68
- children: n("count", { count: _.length })
78
+ children: n("count", { count: v.length })
69
79
  }),
70
- /* @__PURE__ */ X(x, {
71
- counts: p ? S.teams[p.id] : S.workspace,
80
+ /* @__PURE__ */ X(S, {
81
+ counts: p ? C.teams[p.id] : C.workspace,
72
82
  teamId: p?.id,
73
83
  className: "max-sm:hidden"
74
84
  }),
75
85
  /* @__PURE__ */ X("div", {
76
86
  className: "ml-auto",
77
- children: /* @__PURE__ */ X(I, {
87
+ children: /* @__PURE__ */ X(z, {
78
88
  label: n("view"),
79
89
  size: "sm",
80
- value: F,
90
+ value: R,
81
91
  onValueChange: (e) => {
82
- te(e), ce(e);
92
+ ee(e), ue(e);
83
93
  },
84
94
  options: [{
85
95
  value: "icons",
86
96
  label: n("icons"),
87
- icon: /* @__PURE__ */ X(y, {})
97
+ icon: /* @__PURE__ */ X(b, {})
88
98
  }, {
89
99
  value: "list",
90
100
  label: n("list"),
91
- icon: /* @__PURE__ */ X(b, {})
101
+ icon: /* @__PURE__ */ X(x, {})
92
102
  }]
93
103
  })
94
104
  }),
95
- /* @__PURE__ */ X(A, {
105
+ /* @__PURE__ */ X(M, {
96
106
  variant: "primary",
97
107
  size: "sm",
98
- icon: /* @__PURE__ */ X(h, { className: "size-3.5" }),
99
- onClick: M,
108
+ icon: /* @__PURE__ */ X(g, { className: "size-3.5" }),
109
+ onClick: F,
100
110
  children: n("new")
101
111
  })
102
112
  ]
@@ -104,42 +114,42 @@ function ie() {
104
114
  /* @__PURE__ */ Z("div", {
105
115
  className: "min-h-0 flex-1 overflow-y-auto",
106
116
  children: [
107
- _.length === 0 ? /* @__PURE__ */ X("div", {
117
+ v.length === 0 ? /* @__PURE__ */ X("div", {
108
118
  className: "p-6",
109
- children: /* @__PURE__ */ X(j, {
110
- icon: /* @__PURE__ */ X(g, {}),
119
+ children: /* @__PURE__ */ X(P, {
120
+ icon: /* @__PURE__ */ X(_, {}),
111
121
  title: n("none"),
112
122
  description: n("description"),
113
- action: /* @__PURE__ */ X(A, {
123
+ action: /* @__PURE__ */ X(M, {
114
124
  variant: "primary",
115
125
  size: "sm",
116
- onClick: M,
126
+ onClick: F,
117
127
  children: n("new")
118
128
  })
119
129
  })
120
- }) : /* @__PURE__ */ Z(Y, { children: [O.length > 0 && /* @__PURE__ */ X(d, {
130
+ }) : /* @__PURE__ */ Z(Y, { children: [A.length > 0 && /* @__PURE__ */ X(d, {
121
131
  title: n("toReview"),
122
- count: O.length,
123
- icon: /* @__PURE__ */ X(g, { className: "size-4 text-warning" }),
124
- children: O.map((e) => /* @__PURE__ */ X(pe, {
132
+ count: A.length,
133
+ icon: /* @__PURE__ */ X(_, { className: "size-4 text-warning" }),
134
+ children: A.map((e) => /* @__PURE__ */ X(he, {
125
135
  workspace: r,
126
136
  area: e,
127
- counts: S.areas[e.id],
128
- siblings: _.filter((t) => (t.teamId ?? "") === (e.teamId ?? "")),
137
+ counts: C.areas[e.id],
138
+ siblings: v.filter((t) => (t.teamId ?? "") === (e.teamId ?? "")),
129
139
  depth: 0,
130
- review: ee(e)?.name,
131
- areaMenu: P
140
+ review: N(e)?.name,
141
+ areaMenu: L
132
142
  }, e.id))
133
- }), F === "icons" ? /* @__PURE__ */ X(ue, {
143
+ }), R === "icons" ? /* @__PURE__ */ X(fe, {
134
144
  workspace: r,
135
- spaces: k,
136
- areas: _,
137
- unfiledCount: D,
138
- unfiledRows: L,
139
- areaMenu: P,
140
- onCreate: w
141
- }, p?.id ?? "") : k.map((e) => {
142
- let t = _.filter((t) => (t.teamId ?? "") === e.id);
145
+ spaces: j,
146
+ areas: v,
147
+ unfiledCount: O,
148
+ unfiledRows: B,
149
+ areaMenu: L,
150
+ onCreate: T
151
+ }, p?.id ?? "") : j.map((e) => {
152
+ let t = v.filter((t) => (t.teamId ?? "") === e.id);
143
153
  return /* @__PURE__ */ X(d, {
144
154
  title: e.name,
145
155
  count: t.length,
@@ -148,59 +158,59 @@ function ie() {
148
158
  color: e.color,
149
159
  name: e.name
150
160
  }),
151
- extra: e.team && /* @__PURE__ */ X(x, {
152
- counts: S.teams[e.team.id],
161
+ extra: e.team && /* @__PURE__ */ X(S, {
162
+ counts: C.teams[e.team.id],
153
163
  teamId: e.team.id,
154
164
  className: "max-sm:hidden"
155
165
  }),
156
- action: e.team && /* @__PURE__ */ X(N, {
166
+ action: e.team && /* @__PURE__ */ X(I, {
157
167
  variant: "ghost",
158
168
  size: "xs",
159
- icon: /* @__PURE__ */ X(h, { className: "size-3.5" }),
169
+ icon: /* @__PURE__ */ X(g, { className: "size-3.5" }),
160
170
  label: n("newIn", { space: e.name }),
161
- onClick: () => w({
171
+ onClick: () => T({
162
172
  kind: "create",
163
173
  space: e.key
164
174
  })
165
175
  }),
166
- children: /* @__PURE__ */ X(ae, {
176
+ children: /* @__PURE__ */ X(se, {
167
177
  workspace: r,
168
178
  areas: t,
169
- counts: S.areas,
179
+ counts: C.areas,
170
180
  parent: void 0,
171
181
  depth: 0,
172
- areaMenu: P
182
+ areaMenu: L
173
183
  })
174
184
  }, e.key);
175
185
  })] }),
176
- F === "list" && D > 0 && /* @__PURE__ */ X(d, {
186
+ R === "list" && O > 0 && /* @__PURE__ */ X(d, {
177
187
  title: n("unfiled"),
178
- count: D,
179
- icon: /* @__PURE__ */ X(g, { className: "size-4 text-muted-foreground" }),
180
- children: L
188
+ count: O,
189
+ icon: /* @__PURE__ */ X(_, { className: "size-4 text-muted-foreground" }),
190
+ children: B
181
191
  }),
182
- /* @__PURE__ */ X(me, { workspace: r })
192
+ /* @__PURE__ */ X(ge, { workspace: r })
183
193
  ]
184
194
  }),
185
- C && /* @__PURE__ */ X(ge, {
195
+ w && /* @__PURE__ */ X(ve, {
186
196
  workspace: r,
187
- editing: C,
188
- spaces: k.filter((e) => e.team),
197
+ editing: w,
198
+ spaces: j.filter((e) => e.team),
189
199
  areas: l,
190
- onClose: () => w(null)
200
+ onClose: () => T(null)
191
201
  })
192
202
  ]
193
203
  });
194
204
  }
195
- function ae({ workspace: e, areas: t, counts: n, parent: r, depth: i, areaMenu: a }) {
196
- return t.filter((e) => e.parentId === r).map((r) => /* @__PURE__ */ Z(W, { children: [/* @__PURE__ */ X(pe, {
205
+ function se({ workspace: e, areas: t, counts: n, parent: r, depth: i, areaMenu: a }) {
206
+ return t.filter((e) => e.parentId === r).map((r) => /* @__PURE__ */ Z(re, { children: [/* @__PURE__ */ X(he, {
197
207
  workspace: e,
198
208
  area: r,
199
209
  counts: n[r.id],
200
210
  siblings: t,
201
211
  depth: i,
202
212
  areaMenu: a
203
- }), /* @__PURE__ */ X(ae, {
213
+ }), /* @__PURE__ */ X(se, {
204
214
  workspace: e,
205
215
  areas: t,
206
216
  counts: n,
@@ -209,29 +219,29 @@ function ae({ workspace: e, areas: t, counts: n, parent: r, depth: i, areaMenu:
209
219
  areaMenu: a
210
220
  })] }, r.id));
211
221
  }
212
- var oe = "tandem.areas.view";
213
- function se() {
222
+ var ce = "tandem.areas.view";
223
+ function le() {
214
224
  try {
215
- return globalThis.localStorage?.getItem(oe) === "list" ? "list" : "icons";
225
+ return globalThis.localStorage?.getItem(ce) === "list" ? "list" : "icons";
216
226
  } catch {
217
227
  return "icons";
218
228
  }
219
229
  }
220
- function ce(e) {
230
+ function ue(e) {
221
231
  try {
222
- globalThis.localStorage?.setItem(oe, e);
232
+ globalThis.localStorage?.setItem(ce, e);
223
233
  } catch {}
224
234
  }
225
- var le = /* @__PURE__ */ new Map();
226
- function ue({ workspace: e, spaces: t, areas: n, unfiledCount: i, unfiledRows: a, areaMenu: o, onCreate: f }) {
227
- let p = J("areas"), { data: _ = [] } = Q(r(e)), v = `${e}/${t.map((e) => e.id).join(",")}`, [y, b] = K(() => le.get(v) ?? null), x = (e) => {
228
- le.set(v, e), b(e);
235
+ var de = /* @__PURE__ */ new Map();
236
+ function fe({ workspace: e, spaces: t, areas: n, unfiledCount: i, unfiledRows: a, areaMenu: o, onCreate: f }) {
237
+ let p = J("areas"), { data: h = [] } = Q(r(e)), v = `${e}/${t.map((e) => e.id).join(",")}`, [y, b] = K(() => de.get(v) ?? null), x = (e) => {
238
+ de.set(v, e), b(e);
229
239
  }, S = G(() => {
230
240
  let e = /* @__PURE__ */ new Map();
231
- for (let t of _) t.area && e.set(t.area.id, (e.get(t.area.id) ?? 0) + 1);
241
+ for (let t of h) t.area && e.set(t.area.id, (e.get(t.area.id) ?? 0) + 1);
232
242
  let t = (r) => (e.get(r) ?? 0) + n.filter((e) => e.parentId === r).reduce((e, n) => e + t(n.id), 0);
233
243
  return t;
234
- }, [_, n]), C = (e) => n.filter((t) => t.parentId === e), w = (t, n) => t.map((t) => /* @__PURE__ */ X(c, {
244
+ }, [h, n]), C = (e) => n.filter((t) => t.parentId === e), w = (t, n) => t.map((t) => /* @__PURE__ */ X(c, {
235
245
  workspace: e,
236
246
  area: t,
237
247
  inside: C(t.id).length,
@@ -243,7 +253,7 @@ function ue({ workspace: e, spaces: t, areas: n, unfiledCount: i, unfiledRows: a
243
253
  })
244
254
  }, t.id)), T = i > 0 && /* @__PURE__ */ X(u, {
245
255
  name: p("unfiled"),
246
- icon: /* @__PURE__ */ X(g, { className: "size-7 opacity-60" }),
256
+ icon: /* @__PURE__ */ X(_, { className: "size-7 opacity-60" }),
247
257
  hint: i,
248
258
  onOpen: () => x({ kind: "unfiled" })
249
259
  });
@@ -264,16 +274,16 @@ function ue({ workspace: e, spaces: t, areas: n, unfiledCount: i, unfiledRows: a
264
274
  })
265
275
  }, e.key);
266
276
  });
267
- let E = y.kind === "area" ? y.trail.at(-1) : void 0, D = E && n.find((e) => e.id === E.id), O = D ? C(D.id) : [], A = [{
277
+ let E = y.kind === "area" ? y.trail.at(-1) : void 0, D = E && n.find((e) => e.id === E.id), O = D ? C(D.id) : [], k = [{
268
278
  label: p("title"),
269
- icon: /* @__PURE__ */ X(g, { className: "size-4" })
279
+ icon: /* @__PURE__ */ X(_, { className: "size-4" })
270
280
  }, ...y.kind === "area" ? y.trail.map((e) => ({ label: n.find((t) => t.id === e.id)?.title ?? e.title })) : [{ label: p("unfiled") }]];
271
281
  return /* @__PURE__ */ Z("section", {
272
- "aria-label": A.at(-1)?.label,
282
+ "aria-label": k.at(-1)?.label,
273
283
  children: [/* @__PURE__ */ Z("div", {
274
284
  className: "sticky top-0 z-10 flex h-10 items-center gap-2 border-b border-border bg-background px-4 md:px-5",
275
- children: [/* @__PURE__ */ X(k, {
276
- crumbs: A,
285
+ children: [/* @__PURE__ */ X(j, {
286
+ crumbs: k,
277
287
  current: "location",
278
288
  onSelect: (e, t) => x(t === 0 || y.kind !== "area" ? null : {
279
289
  ...y,
@@ -283,15 +293,15 @@ function ue({ workspace: e, spaces: t, areas: n, unfiledCount: i, unfiledRows: a
283
293
  }), D && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(s, {
284
294
  workspace: e,
285
295
  area: D,
286
- className: z({
296
+ className: H({
287
297
  variant: "ghost",
288
298
  size: "xs"
289
299
  }),
290
300
  children: p("openArea")
291
- }), /* @__PURE__ */ X(N, {
301
+ }), /* @__PURE__ */ X(I, {
292
302
  variant: "ghost",
293
303
  size: "xs",
294
- icon: /* @__PURE__ */ X(h, { className: "size-3.5" }),
304
+ icon: /* @__PURE__ */ X(g, { className: "size-3.5" }),
295
305
  label: p("addInside"),
296
306
  onClick: () => f({
297
307
  kind: "create",
@@ -300,18 +310,18 @@ function ue({ workspace: e, spaces: t, areas: n, unfiledCount: i, unfiledRows: a
300
310
  })] })]
301
311
  }), y.kind === "unfiled" ? /* @__PURE__ */ X("ul", { children: a }) : O.length === 0 ? /* @__PURE__ */ X("div", {
302
312
  className: "p-6",
303
- children: /* @__PURE__ */ X(j, {
304
- icon: /* @__PURE__ */ X(g, {}),
313
+ children: /* @__PURE__ */ X(P, {
314
+ icon: /* @__PURE__ */ X(_, {}),
305
315
  title: p("emptyArea")
306
316
  })
307
317
  }) : /* @__PURE__ */ X(l, {
308
- label: A.at(-1)?.label ?? "",
318
+ label: k.at(-1)?.label ?? "",
309
319
  children: w(O, O)
310
320
  })]
311
321
  });
312
322
  }
313
- function de(e, t, n) {
314
- let r = J("areas"), i = S(e);
323
+ function pe(e, t, n) {
324
+ let r = J("areas"), i = C(e);
315
325
  return (e, a) => {
316
326
  let o = a.filter((t) => t.id !== e.id);
317
327
  return [
@@ -337,7 +347,7 @@ function de(e, t, n) {
337
347
  })
338
348
  }))
339
349
  }] : [],
340
- B,
350
+ te,
341
351
  {
342
352
  label: r("archive"),
343
353
  destructive: !0,
@@ -346,25 +356,25 @@ function de(e, t, n) {
346
356
  ];
347
357
  };
348
358
  }
349
- var fe = 20;
350
- function pe({ workspace: e, area: t, counts: n, siblings: r, depth: i, review: a, areaMenu: o }) {
351
- let c = J("areas"), l = J("common"), u = V(), d = S(e), f = q(), { nameOf: m, avatarOf: h } = E(e), _ = t.status === "proposed", y = () => o(t, r), b = d.accept.error ?? d.merge.error ?? d.archive.error, w = t.creator;
359
+ var me = 20;
360
+ function he({ workspace: e, area: t, counts: n, siblings: r, depth: i, review: a, areaMenu: o }) {
361
+ let c = J("areas"), l = J("common"), u = U(), d = C(e), f = q(), { nameOf: m, avatarOf: h } = D(e), g = t.status === "proposed", v = () => o(t, r), b = d.accept.error ?? d.merge.error ?? d.archive.error, x = t.creator;
352
362
  return /* @__PURE__ */ Z("li", {
353
363
  className: "group flex min-h-10 items-center gap-2 border-b border-border/60 pr-2 hover:bg-muted/60",
354
364
  children: [
355
365
  /* @__PURE__ */ Z(s, {
356
366
  workspace: e,
357
367
  area: t,
358
- onContextMenu: (e) => u(e, y()),
359
- style: { paddingLeft: `calc(var(--row-start) + ${i * fe}px)` },
368
+ onContextMenu: (e) => u(e, v()),
369
+ style: { paddingLeft: `calc(var(--row-start) + ${i * me}px)` },
360
370
  className: "flex min-w-0 flex-1 items-center gap-2 self-stretch py-2 [--row-start:1rem] md:[--row-start:1.25rem]",
361
371
  children: [
362
- t.icon ? /* @__PURE__ */ X(p, { icon: t.icon }) : /* @__PURE__ */ X(g, { className: "size-4 shrink-0 text-muted-foreground" }),
372
+ t.icon ? /* @__PURE__ */ X(p, { icon: t.icon }) : /* @__PURE__ */ X(_, { className: "size-4 shrink-0 text-muted-foreground" }),
363
373
  /* @__PURE__ */ X("span", {
364
374
  className: "min-w-0 truncate text-sm font-medium",
365
375
  children: t.title
366
376
  }),
367
- t.homeDocId && /* @__PURE__ */ X(v, {
377
+ t.homeDocId && /* @__PURE__ */ X(y, {
368
378
  className: "size-3.5 shrink-0 text-muted-foreground",
369
379
  "aria-label": c("hasHomeDoc")
370
380
  }),
@@ -378,54 +388,54 @@ function pe({ workspace: e, area: t, counts: n, siblings: r, depth: i, review: a
378
388
  })
379
389
  ]
380
390
  }),
381
- b && /* @__PURE__ */ X(M, {
391
+ b && /* @__PURE__ */ X(F, {
382
392
  inline: !0,
383
393
  className: "shrink-0 text-xs",
384
394
  children: f(b)
385
395
  }),
386
- /* @__PURE__ */ X(x, {
396
+ /* @__PURE__ */ X(S, {
387
397
  counts: n,
388
398
  teamId: t.teamId,
389
399
  className: "max-sm:hidden"
390
400
  }),
391
- _ && !a && /* @__PURE__ */ X("span", {
401
+ g && !a && /* @__PURE__ */ X("span", {
392
402
  className: "shrink-0 rounded border border-warning/60 px-1.5 py-0.5 text-[11px] leading-none text-warning",
393
403
  children: c("proposed")
394
404
  }),
395
- a && w && /* @__PURE__ */ X(R, {
396
- content: c("proposedBy", { name: m(w.kind, w.handle) }),
405
+ a && x && /* @__PURE__ */ X(V, {
406
+ content: c("proposedBy", { name: m(x.kind, x.handle) }),
397
407
  describesAnchor: !0,
398
408
  children: /* @__PURE__ */ Z("span", {
399
409
  className: "flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground max-sm:hidden",
400
- children: [/* @__PURE__ */ X(O, {
401
- ...C(w.kind),
402
- name: m(w.kind, w.handle),
403
- src: h(w.kind, w.handle),
410
+ children: [/* @__PURE__ */ X(A, {
411
+ ...w(x.kind),
412
+ name: m(x.kind, x.handle),
413
+ src: h(x.kind, x.handle),
404
414
  size: "xs",
405
415
  decorative: !0
406
- }), m(w.kind, w.handle)]
416
+ }), m(x.kind, x.handle)]
407
417
  })
408
418
  }),
409
419
  /* @__PURE__ */ X("span", {
410
420
  className: "w-28 shrink-0 truncate text-right font-mono text-xs text-muted-foreground max-md:hidden",
411
421
  children: t.key
412
422
  }),
413
- a && /* @__PURE__ */ X(A, {
423
+ a && /* @__PURE__ */ X(M, {
414
424
  variant: "outline",
415
425
  size: "xs",
416
426
  loading: d.accept.isPending,
417
427
  onClick: () => d.accept.mutate(t.key),
418
428
  children: c("accept")
419
429
  }),
420
- /* @__PURE__ */ X(ne, {
421
- items: y,
430
+ /* @__PURE__ */ X(ie, {
431
+ items: v,
422
432
  label: l("moreActionsFor", { name: t.title })
423
433
  })
424
434
  ]
425
435
  });
426
436
  }
427
- function me({ workspace: t }) {
428
- let n = J("areas"), r = S(t), [i, a] = K(!1), { data: o = [], isPending: s } = Q({
437
+ function ge({ workspace: t }) {
438
+ let n = J("areas"), r = C(t), [i, a] = K(!1), { data: o = [], isPending: s } = Q({
429
439
  ...e(t, !0),
430
440
  enabled: i
431
441
  });
@@ -439,7 +449,7 @@ function me({ workspace: t }) {
439
449
  "aria-expanded": i,
440
450
  className: "flex h-9 w-full items-center gap-2 px-4 text-xs font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground md:px-5",
441
451
  children: [
442
- /* @__PURE__ */ X(_, { className: re("size-3.5 transition-transform", i && "rotate-90") }),
452
+ /* @__PURE__ */ X(v, { className: ae("size-3.5 transition-transform", i && "rotate-90") }),
443
453
  n("archived"),
444
454
  i && !s && /* @__PURE__ */ X("span", {
445
455
  className: "tabular-nums",
@@ -453,7 +463,7 @@ function me({ workspace: t }) {
453
463
  }) : /* @__PURE__ */ X("ul", { children: o.map((e) => /* @__PURE__ */ Z("li", {
454
464
  className: "flex min-h-10 items-center gap-2 border-b border-border/60 py-1.5 pr-2 pl-4 text-muted-foreground md:pl-5",
455
465
  children: [
456
- /* @__PURE__ */ X(g, { className: "size-4 shrink-0" }),
466
+ /* @__PURE__ */ X(_, { className: "size-4 shrink-0" }),
457
467
  /* @__PURE__ */ X("span", {
458
468
  className: "min-w-0 truncate text-sm",
459
469
  children: e.title
@@ -462,7 +472,7 @@ function me({ workspace: t }) {
462
472
  className: "ml-auto w-28 shrink-0 truncate text-right font-mono text-xs max-md:hidden",
463
473
  children: e.key
464
474
  }),
465
- /* @__PURE__ */ X(A, {
475
+ /* @__PURE__ */ X(M, {
466
476
  variant: "outline",
467
477
  size: "xs",
468
478
  loading: r.restore.isPending && r.restore.variables === e.key,
@@ -477,17 +487,17 @@ function me({ workspace: t }) {
477
487
  }, e.id)) }))]
478
488
  });
479
489
  }
480
- var he = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
481
- function ge({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
482
- let o = J("areas"), s = J("common"), c = q(), l = S(e), u = t.kind === "edit" ? t.area : void 0, d = t.kind === "create" ? t.parent : void 0, [f, p] = K(u?.title ?? ""), [m, h] = K(u?.key ?? ""), [g, _] = K(!!u), [y, b] = K((u?.aliases ?? []).join(", ")), x = t.kind === "create" && t.space || r.find((e) => e.id === (u?.teamId ?? d?.teamId ?? ""))?.key || r[0]?.key || "", [C, T] = K(x), E = r.find((e) => e.key === C)?.id ?? "", [O, k] = K(d?.key ?? i.find((e) => e.id === u?.parentId)?.key ?? ""), [j, N] = K(""), [I, R] = K(!1), { data: z = [] } = Q({
490
+ var _e = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
491
+ function ve({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
492
+ let o = J("areas"), s = J("common"), c = q(), l = C(e), u = t.kind === "edit" ? t.area : void 0, d = t.kind === "create" ? t.parent : void 0, [f, p] = K(u?.title ?? ""), [m, h] = K(u?.key ?? ""), [g, _] = K(!!u), [v, b] = K((u?.aliases ?? []).join(", ")), x = t.kind === "create" && t.space || r.find((e) => e.id === (u?.teamId ?? d?.teamId ?? ""))?.key || r[0]?.key || "", [S, w] = K(x), E = r.find((e) => e.key === S)?.id ?? "", [D, k] = K(d?.key ?? i.find((e) => e.id === u?.parentId)?.key ?? ""), [A, j] = K(""), [P, I] = K(!1), { data: z = [] } = Q({
483
493
  ...n(e),
484
- enabled: I || !!u?.homeDocId
485
- }), B = j ? z.find((e) => e.key === j) : z.find((e) => e.id === u?.homeDocId), V = !u || u.status === "proposed", H = l.create.isPending || l.update.isPending, U = l.create.error ?? l.update.error, W = G(() => i.filter((e) => (e.teamId ?? "") === E && e.id !== u?.id), [
494
+ enabled: P || !!u?.homeDocId
495
+ }), V = A ? z.find((e) => e.key === A) : z.find((e) => e.id === u?.homeDocId), H = !u || u.status === "proposed", te = l.create.isPending || l.update.isPending, U = l.create.error ?? l.update.error, ne = G(() => i.filter((e) => (e.teamId ?? "") === E && e.id !== u?.id), [
486
496
  i,
487
497
  E,
488
498
  u?.id
489
- ]), Y = y.split(",").map((e) => e.trim()).filter(Boolean);
490
- return /* @__PURE__ */ X(F, {
499
+ ]), W = v.split(",").map((e) => e.trim()).filter(Boolean);
500
+ return /* @__PURE__ */ X(R, {
491
501
  open: !0,
492
502
  onClose: a,
493
503
  className: "max-h-[85vh] w-full max-w-md overflow-y-auto p-5",
@@ -497,31 +507,31 @@ function ge({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
497
507
  area: u.key,
498
508
  body: {
499
509
  title: f,
500
- aliases: Y,
501
- ...V && m !== u.key && { key: m },
502
- ...O !== (i.find((e) => e.id === u.parentId)?.key ?? "") && { parent: O },
503
- ...j && { homeDoc: j }
510
+ aliases: W,
511
+ ...H && m !== u.key && { key: m },
512
+ ...D !== (i.find((e) => e.id === u.parentId)?.key ?? "") && { parent: D },
513
+ ...A && { homeDoc: A }
504
514
  }
505
515
  }, { onSuccess: a }) : l.create.mutate({
506
516
  key: m,
507
517
  title: f,
508
- aliases: Y,
509
- space: C,
510
- ...O && { parent: O },
511
- ...j && { homeDoc: j }
518
+ aliases: W,
519
+ space: S,
520
+ ...D && { parent: D },
521
+ ...A && { homeDoc: A }
512
522
  }, { onSuccess: a });
513
523
  },
514
524
  children: [
515
- /* @__PURE__ */ X(te, {
525
+ /* @__PURE__ */ X(ee, {
516
526
  className: "text-sm font-semibold",
517
527
  children: o(u ? "editTitle" : "newTitle")
518
528
  }),
519
529
  /* @__PURE__ */ Z("label", {
520
530
  className: "mt-4 block text-xs font-medium text-muted-foreground",
521
- children: [o("fieldTitle"), /* @__PURE__ */ X(P, {
531
+ children: [o("fieldTitle"), /* @__PURE__ */ X(L, {
522
532
  value: f,
523
533
  onChange: (e) => {
524
- p(e.target.value), g || h(he(e.target.value));
534
+ p(e.target.value), g || h(_e(e.target.value));
525
535
  },
526
536
  required: !0,
527
537
  maxLength: 100,
@@ -533,12 +543,12 @@ function ge({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
533
543
  className: "mt-3 block text-xs font-medium text-muted-foreground",
534
544
  children: [
535
545
  o("fieldKey"),
536
- /* @__PURE__ */ X(P, {
546
+ /* @__PURE__ */ X(L, {
537
547
  value: m,
538
548
  onChange: (e) => {
539
549
  _(!0), h(e.target.value.toLowerCase());
540
550
  },
541
- disabled: !V,
551
+ disabled: !H,
542
552
  required: !0,
543
553
  pattern: "[a-z0-9][a-z0-9-]{0,62}",
544
554
  mono: !0,
@@ -546,14 +556,14 @@ function ge({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
546
556
  }),
547
557
  /* @__PURE__ */ X("span", {
548
558
  className: "mt-1 block font-normal",
549
- children: o(V ? "keyHint" : "keyFixed")
559
+ children: o(H ? "keyHint" : "keyFixed")
550
560
  })
551
561
  ]
552
562
  }),
553
563
  /* @__PURE__ */ Z("label", {
554
564
  className: "mt-3 block text-xs font-medium text-muted-foreground",
555
- children: [o("fieldAliases"), /* @__PURE__ */ X(P, {
556
- value: y,
565
+ children: [o("fieldAliases"), /* @__PURE__ */ X(L, {
566
+ value: v,
557
567
  onChange: (e) => b(e.target.value),
558
568
  placeholder: o("aliasesPlaceholder"),
559
569
  className: "mt-1"
@@ -565,14 +575,14 @@ function ge({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
565
575
  className: "text-xs font-medium text-muted-foreground",
566
576
  children: [o("fieldSpace"), /* @__PURE__ */ X("div", {
567
577
  className: "mt-1",
568
- children: /* @__PURE__ */ X(L, {
569
- value: C,
578
+ children: /* @__PURE__ */ X(B, {
579
+ value: S,
570
580
  items: r.map((e) => ({
571
581
  value: e.key,
572
582
  label: e.name
573
583
  })),
574
584
  onValueChange: (e) => {
575
- T(e), k("");
585
+ w(e), k("");
576
586
  },
577
587
  "aria-label": o("fieldSpace"),
578
588
  width: "content"
@@ -582,12 +592,12 @@ function ge({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
582
592
  className: "text-xs font-medium text-muted-foreground",
583
593
  children: [o("fieldParent"), /* @__PURE__ */ X("div", {
584
594
  className: "mt-1",
585
- children: /* @__PURE__ */ X(L, {
586
- value: O,
595
+ children: /* @__PURE__ */ X(B, {
596
+ value: D,
587
597
  items: [{
588
598
  value: "",
589
599
  label: o("top")
590
- }, ...W.map((e) => ({
600
+ }, ...ne.map((e) => ({
591
601
  value: e.key,
592
602
  label: e.title
593
603
  }))],
@@ -602,53 +612,53 @@ function ge({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
602
612
  className: "mt-3 text-xs font-medium text-muted-foreground",
603
613
  children: [o("fieldHomeDoc"), /* @__PURE__ */ Z("div", {
604
614
  className: "mt-1",
605
- children: [/* @__PURE__ */ X(ee, {
606
- open: I,
607
- onOpenChange: R,
615
+ children: [/* @__PURE__ */ X(N, {
616
+ open: P,
617
+ onOpenChange: I,
608
618
  items: z.map((e) => ({
609
619
  value: e.key,
610
620
  label: e.title,
611
- icon: /* @__PURE__ */ X(v, { className: "size-3.5" })
621
+ icon: /* @__PURE__ */ X(y, { className: "size-3.5" })
612
622
  })),
613
- value: B?.key ?? null,
614
- onValueChange: (e) => e !== null && N(e),
623
+ value: V?.key ?? null,
624
+ onValueChange: (e) => e !== null && j(e),
615
625
  placeholder: o("chooseDoc"),
616
626
  "aria-label": o("fieldHomeDoc"),
617
- trigger: /* @__PURE__ */ Z(A, {
627
+ trigger: /* @__PURE__ */ Z(M, {
618
628
  type: "button",
619
629
  className: "max-w-full font-normal",
620
- children: [/* @__PURE__ */ X(v, { className: "size-3.5 text-muted-foreground" }), /* @__PURE__ */ X("span", {
630
+ children: [/* @__PURE__ */ X(y, { className: "size-3.5 text-muted-foreground" }), /* @__PURE__ */ X("span", {
621
631
  className: "truncate",
622
- children: B?.title ?? o("noDoc")
632
+ children: V?.title ?? o("noDoc")
623
633
  })]
624
634
  })
625
- }), B && /* @__PURE__ */ X(D, {
635
+ }), V && /* @__PURE__ */ X(O, {
626
636
  to: "/$workspace/docs/$doc",
627
637
  params: {
628
638
  workspace: e,
629
- doc: w(B)
639
+ doc: T(V)
630
640
  },
631
641
  className: "ml-2 text-xs font-normal text-primary hover:underline",
632
642
  children: o("openDoc")
633
643
  })]
634
644
  })]
635
645
  }),
636
- U && /* @__PURE__ */ X(M, {
646
+ U && /* @__PURE__ */ X(F, {
637
647
  size: "md",
638
648
  className: "mt-3",
639
649
  children: c(U)
640
650
  }),
641
651
  /* @__PURE__ */ Z("div", {
642
652
  className: "mt-5 flex justify-end gap-2",
643
- children: [/* @__PURE__ */ X(A, {
653
+ children: [/* @__PURE__ */ X(M, {
644
654
  type: "button",
645
655
  onClick: a,
646
656
  children: s("cancel")
647
- }), /* @__PURE__ */ X(A, {
657
+ }), /* @__PURE__ */ X(M, {
648
658
  type: "submit",
649
659
  variant: "primary",
650
660
  disabled: !f.trim() || !m,
651
- loading: H,
661
+ loading: te,
652
662
  children: u ? s("save") : o("create")
653
663
  })]
654
664
  })
@@ -656,4 +666,4 @@ function ge({ workspace: e, editing: t, spaces: r, areas: i, onClose: a }) {
656
666
  })
657
667
  });
658
668
  }
659
- export { ie as AreasPage };
669
+ export { oe as AreasPage };