@parallelworks/tandem-web 0.163.0 → 0.164.1

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