@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.
@@ -3,117 +3,117 @@ import { calendarMonth as n } from "../lib/calendarMonth.js";
3
3
  import { fromIsoDate as r, isoDate as i } from "../lib/datePhrases.js";
4
4
  import { docPropertiesQuery as a, useDocPropertyActions as o } from "../lib/docProperties.js";
5
5
  import { docSeriesQuery as s, useDocSeriesActions as c } from "../lib/docSeries.js";
6
- import { docRef as l } from "../lib/docs.js";
7
- import { useCan as u } from "../lib/roles.js";
8
- import { readSubpageConfig as d, subpageViewsQuery as f, useSubpageActions as p } from "../lib/subpageViews.js";
9
- import { DocIcon as m } from "./DocIcon.js";
10
- import { usePropertyText as h } from "./DocProperties.js";
11
- import { SeriesMenu as g } from "./DocSeries.js";
12
- import { Board as _, groupable as v } from "./DocTable.js";
13
- import { iconImageURL as y } from "./EntityIcon.js";
14
- import { AddIcon as ee, ArticleIcon as b, BoardIcon as x, CalendarIcon as S, ChevronRightIcon as C, CycleIcon as te, GridIcon as w, ListViewIcon as T, SettingsIcon as E, SpreadsheetIcon as D, TimelineIcon as O } from "./icons.js";
15
- import { NewPageModal as k } from "./NewPageModal.js";
16
- import { Button as A, ErrorText as j, Input as ne, Popover as M, Select as N, cx as P } from "@parallelworks/ui";
17
- import { Link as F, useNavigate as re } from "@tanstack/react-router";
18
- import { useLayoutEffect as ie, useMemo as I, useRef as ae, useState as L } from "react";
19
- import { useErrorMessage as R } from "@parallelworks/problem/react";
20
- import { useFormatter as z, useLocale as oe, useTranslations as B } from "use-intl";
21
- import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
22
- import { keepPreviousData as se, useQuery as W } from "@tanstack/react-query";
6
+ import { docRef as l, useDocContextMenu as u } from "../lib/docs.js";
7
+ import { useCan as d } from "../lib/roles.js";
8
+ import { readSubpageConfig as f, subpageViewsQuery as p, useSubpageActions as m } from "../lib/subpageViews.js";
9
+ import { DocIcon as h } from "./DocIcon.js";
10
+ import { usePropertyText as g } from "./DocProperties.js";
11
+ import { SeriesMenu as _ } from "./DocSeries.js";
12
+ import { Board as v, groupable as y } from "./DocTable.js";
13
+ import { iconImageURL as b } from "./EntityIcon.js";
14
+ import { AddIcon as ee, ArticleIcon as x, BoardIcon as S, CalendarIcon as C, ChevronRightIcon as w, CycleIcon as te, GridIcon as T, ListViewIcon as E, SettingsIcon as D, SpreadsheetIcon as O, TimelineIcon as k } from "./icons.js";
15
+ import { NewPageModal as ne } from "./NewPageModal.js";
16
+ import { Button as A, ErrorText as j, Input as M, Popover as N, Select as P, cx as F } from "@parallelworks/ui";
17
+ import { Link as I, useNavigate as re } from "@tanstack/react-router";
18
+ import { useLayoutEffect as ie, useMemo as L, useRef as ae, useState as R } from "react";
19
+ import { useErrorMessage as z } from "@parallelworks/problem/react";
20
+ import { useFormatter as B, useLocale as oe, useTranslations as V } from "use-intl";
21
+ import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
22
+ import { keepPreviousData as se, useQuery as G } from "@tanstack/react-query";
23
23
  import { useVirtualizer as ce } from "@tanstack/react-virtual";
24
24
  // src/components/SubpageViews.tsx
25
- var G = [
25
+ var K = [
26
26
  {
27
27
  layout: "table",
28
- icon: D,
28
+ icon: O,
29
29
  message: "tableView",
30
30
  database: !0
31
31
  },
32
32
  {
33
33
  layout: "board",
34
- icon: x,
34
+ icon: S,
35
35
  message: "boardView",
36
36
  database: !0
37
37
  },
38
38
  {
39
39
  layout: "list",
40
- icon: T,
40
+ icon: E,
41
41
  message: "listView",
42
42
  database: !0
43
43
  },
44
44
  {
45
45
  layout: "timeline",
46
- icon: O,
46
+ icon: k,
47
47
  message: "timelineView",
48
48
  database: !0
49
49
  },
50
50
  {
51
51
  layout: "calendar",
52
- icon: S,
52
+ icon: C,
53
53
  message: "calendarView",
54
54
  database: !0
55
55
  },
56
56
  {
57
57
  layout: "gallery",
58
- icon: w,
58
+ icon: T,
59
59
  message: "galleryView",
60
60
  database: !0
61
61
  },
62
62
  {
63
63
  layout: "feed",
64
- icon: b,
64
+ icon: x,
65
65
  message: "feed",
66
66
  database: !1
67
67
  }
68
- ], le = (e) => G.find((t) => t.layout === e) ?? G[4], K = (e) => e === "calendar" || e === "timeline", q = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
68
+ ], q = (e) => K.find((t) => t.layout === e) ?? K[4], le = (e) => e === "calendar" || e === "timeline", J = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
69
69
  function ue(e) {
70
70
  let t = new Intl.Locale(e);
71
71
  return (t.getWeekInfo?.().firstDay ?? t.weekInfo?.firstDay ?? 7) % 7;
72
72
  }
73
- function J({ workspace: e, doc: t, space: n }) {
74
- let r = B("subpages"), { data: i = [] } = W(f(e, t.key)), [a, o] = L(), s = u(e, "edit_docs", n === "workspace" ? void 0 : { team: n }), c = p(e);
73
+ function Y({ workspace: e, doc: t, space: n }) {
74
+ let r = V("subpages"), { data: i = [] } = G(p(e, t.key)), [a, o] = R(), s = d(e, "edit_docs", n === "workspace" ? void 0 : { team: n }), c = m(e);
75
75
  if (i.length === 0) return null;
76
- let l = i.find((e) => e.id === a) ?? i[0], m = (e) => c.addView.mutate({
76
+ let l = i.find((e) => e.id === a) ?? i[0], u = (e) => c.addView.mutate({
77
77
  doc: t.key,
78
- name: r(le(e).message),
78
+ name: r(q(e).message),
79
79
  layout: e,
80
- config: { ...d(l.config) }
80
+ config: { ...f(l.config) }
81
81
  }, { onSuccess: (e) => o(e.id) });
82
- return /* @__PURE__ */ U("section", {
82
+ return /* @__PURE__ */ W("section", {
83
83
  className: "not-prose my-4",
84
84
  "aria-label": r("views"),
85
- children: [/* @__PURE__ */ U("div", {
85
+ children: [/* @__PURE__ */ W("div", {
86
86
  className: "flex items-center gap-1 border-b border-border",
87
87
  children: [i.map((e) => {
88
- let t = le(e.layout).icon;
89
- return /* @__PURE__ */ U("button", {
88
+ let t = q(e.layout).icon;
89
+ return /* @__PURE__ */ W("button", {
90
90
  type: "button",
91
91
  onClick: () => o(e.id),
92
92
  "aria-pressed": e.id === l.id,
93
- className: P("-mb-px flex items-center gap-1.5 border-b-2 px-2 py-1.5 text-sm", e.id === l.id ? "border-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"),
94
- children: [/* @__PURE__ */ H(t, { className: "size-4" }), e.name]
93
+ className: F("-mb-px flex items-center gap-1.5 border-b-2 px-2 py-1.5 text-sm", e.id === l.id ? "border-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"),
94
+ children: [/* @__PURE__ */ U(t, { className: "size-4" }), e.name]
95
95
  }, e.id);
96
- }), s && /* @__PURE__ */ H(M, {
97
- trigger: /* @__PURE__ */ H(A, {
96
+ }), s && /* @__PURE__ */ U(N, {
97
+ trigger: /* @__PURE__ */ U(A, {
98
98
  size: "xs",
99
99
  variant: "ghost",
100
100
  "aria-label": r("addView"),
101
- children: /* @__PURE__ */ H(ee, {})
101
+ children: /* @__PURE__ */ U(ee, {})
102
102
  }),
103
103
  align: "start",
104
104
  "aria-label": r("addView"),
105
- children: /* @__PURE__ */ H("div", {
105
+ children: /* @__PURE__ */ U("div", {
106
106
  className: "flex flex-col gap-1",
107
- children: G.map(({ layout: e, icon: t, message: n }) => /* @__PURE__ */ U(A, {
107
+ children: K.map(({ layout: e, icon: t, message: n }) => /* @__PURE__ */ W(A, {
108
108
  size: "sm",
109
109
  variant: "ghost",
110
110
  className: "justify-start",
111
- onClick: () => m(e),
112
- children: [/* @__PURE__ */ H(t, {}), r(n)]
111
+ onClick: () => u(e),
112
+ children: [/* @__PURE__ */ U(t, {}), r(n)]
113
113
  }, e))
114
114
  })
115
115
  })]
116
- }), /* @__PURE__ */ H(de, {
116
+ }), /* @__PURE__ */ U(X, {
117
117
  workspace: e,
118
118
  doc: t,
119
119
  space: n,
@@ -122,28 +122,28 @@ function J({ workspace: e, doc: t, space: n }) {
122
122
  }, l.id)]
123
123
  });
124
124
  }
125
- function de({ workspace: e, doc: n, space: o, view: s, canWrite: c }) {
126
- let u = B("subpages"), f = R(), h = re(), y = d(s.config), { data: b = [] } = W(t(e, { parent: n.key })), { data: x = [] } = W(a(e, o)), S = x.find((e) => e.id === y.dateProperty && e.kind === "date"), C = x.find((e) => e.id === y.groupBy && v(e)), [te, w] = L(""), T = p(e), E = te.trim().toLowerCase(), D = E ? b.filter((e) => e.title.toLowerCase().includes(E)) : b, O = (e) => {
125
+ function X({ workspace: e, doc: n, space: o, view: s, canWrite: c }) {
126
+ let u = V("subpages"), d = z(), p = re(), g = f(s.config), { data: b = [] } = G(t(e, { parent: n.key })), { data: x = [] } = G(a(e, o)), S = x.find((e) => e.id === g.dateProperty && e.kind === "date"), C = x.find((e) => e.id === g.groupBy && y(e)), [w, te] = R(""), T = m(e), E = w.trim().toLowerCase(), D = E ? b.filter((e) => e.title.toLowerCase().includes(E)) : b, O = (e) => {
127
127
  let t = S && e.properties?.[S.id];
128
128
  return typeof t == "string" && r(t) ? t : void 0;
129
- }, k = D.filter((e) => !O(e)), N = (t, r) => T.newSubpage.mutate({
129
+ }, k = D.filter((e) => !O(e)), ne = (t, r) => T.newSubpage.mutate({
130
130
  parent: n,
131
131
  title: t ? u("titleOn", {
132
132
  title: n.title,
133
133
  date: t
134
134
  }) : u("untitled"),
135
- template: r === void 0 ? y.template : r ?? void 0,
135
+ template: r === void 0 ? g.template : r ?? void 0,
136
136
  dateProperty: S?.id,
137
137
  date: t
138
- }, { onSuccess: (t) => h({
138
+ }, { onSuccess: (t) => p({
139
139
  to: "/$workspace/docs/$doc",
140
140
  params: {
141
141
  workspace: e,
142
142
  doc: l(t)
143
143
  }
144
- }) }), P = /* @__PURE__ */ U(V, { children: [
145
- S && K(s.layout) && /* @__PURE__ */ H(M, {
146
- trigger: /* @__PURE__ */ H(A, {
144
+ }) }), P = /* @__PURE__ */ W(H, { children: [
145
+ S && le(s.layout) && /* @__PURE__ */ U(N, {
146
+ trigger: /* @__PURE__ */ U(A, {
147
147
  size: "xs",
148
148
  variant: "ghost",
149
149
  children: u("noDate", { count: k.length })
@@ -151,42 +151,42 @@ function de({ workspace: e, doc: n, space: o, view: s, canWrite: c }) {
151
151
  align: "start",
152
152
  className: "max-h-80 w-72 overflow-y-auto",
153
153
  "aria-label": u("noDateTitle"),
154
- children: k.length === 0 ? /* @__PURE__ */ H("p", {
154
+ children: k.length === 0 ? /* @__PURE__ */ U("p", {
155
155
  className: "text-sm text-muted-foreground",
156
156
  children: u("allDated")
157
- }) : /* @__PURE__ */ H("ul", {
157
+ }) : /* @__PURE__ */ U("ul", {
158
158
  className: "space-y-1",
159
- children: k.map((t) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
159
+ children: k.map((t) => /* @__PURE__ */ U("li", { children: /* @__PURE__ */ W(I, {
160
160
  to: "/$workspace/docs/$doc",
161
161
  params: {
162
162
  workspace: e,
163
163
  doc: l(t)
164
164
  },
165
165
  className: "flex items-center gap-1.5 truncate text-sm hover:underline",
166
- children: [/* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
166
+ children: [/* @__PURE__ */ U(h, { icon: t.icon }), /* @__PURE__ */ U("span", {
167
167
  className: "truncate",
168
168
  children: t.title
169
169
  })]
170
170
  }) }, t.id))
171
171
  })
172
172
  }),
173
- /* @__PURE__ */ H(ne, {
173
+ /* @__PURE__ */ U(M, {
174
174
  type: "search",
175
175
  size: "sm",
176
- value: te,
177
- onChange: (e) => w(e.target.value),
176
+ value: w,
177
+ onChange: (e) => te(e.target.value),
178
178
  placeholder: u("search"),
179
179
  "aria-label": u("search"),
180
180
  className: "w-40"
181
181
  }),
182
- c && /* @__PURE__ */ U(V, { children: [
183
- /* @__PURE__ */ H(Y, {
182
+ c && /* @__PURE__ */ W(H, { children: [
183
+ /* @__PURE__ */ U(de, {
184
184
  workspace: e,
185
185
  space: o,
186
186
  view: s,
187
- config: y
187
+ config: g
188
188
  }),
189
- S && /* @__PURE__ */ H(g, {
189
+ S && /* @__PURE__ */ U(_, {
190
190
  workspace: e,
191
191
  space: o,
192
192
  dateProperty: S.id,
@@ -195,106 +195,106 @@ function de({ workspace: e, doc: n, space: o, view: s, canWrite: c }) {
195
195
  key: n.key
196
196
  }
197
197
  }),
198
- /* @__PURE__ */ U(A, {
198
+ /* @__PURE__ */ W(A, {
199
199
  size: "xs",
200
200
  variant: "primary",
201
201
  loading: T.newSubpage.isPending,
202
- onClick: () => N(S ? i(/* @__PURE__ */ new Date()) : void 0),
203
- children: [/* @__PURE__ */ H(ee, {}), u("new")]
202
+ onClick: () => ne(S ? i(/* @__PURE__ */ new Date()) : void 0),
203
+ children: [/* @__PURE__ */ U(ee, {}), u("new")]
204
204
  })
205
205
  ] })
206
206
  ] });
207
- return /* @__PURE__ */ U("div", {
207
+ return /* @__PURE__ */ W("div", {
208
208
  className: "pt-2",
209
- children: [T.newSubpage.error && /* @__PURE__ */ H(j, { children: f(T.newSubpage.error) }), s.layout === "feed" ? /* @__PURE__ */ H(ge, {
209
+ children: [T.newSubpage.error && /* @__PURE__ */ U(j, { children: d(T.newSubpage.error) }), s.layout === "feed" ? /* @__PURE__ */ U(_e, {
210
210
  workspace: e,
211
211
  docs: D,
212
212
  dateOf: O,
213
213
  toolbar: P
214
- }) : s.layout === "table" ? /* @__PURE__ */ H(ve, {
214
+ }) : s.layout === "table" ? /* @__PURE__ */ U(ye, {
215
215
  workspace: e,
216
216
  docs: D,
217
217
  props: x,
218
218
  toolbar: P
219
- }) : s.layout === "list" ? /* @__PURE__ */ H(ye, {
219
+ }) : s.layout === "list" ? /* @__PURE__ */ U(be, {
220
220
  workspace: e,
221
221
  docs: D,
222
222
  toolbar: P
223
- }) : s.layout === "gallery" ? /* @__PURE__ */ H(be, {
223
+ }) : s.layout === "gallery" ? /* @__PURE__ */ U(xe, {
224
224
  workspace: e,
225
225
  docs: D,
226
226
  toolbar: P
227
- }) : s.layout === "board" ? C ? /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
227
+ }) : s.layout === "board" ? C ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
228
228
  className: "flex flex-wrap items-center gap-1 py-2",
229
229
  children: P
230
- }), /* @__PURE__ */ H(_, {
230
+ }), /* @__PURE__ */ U(v, {
231
231
  workspace: e,
232
232
  space: o,
233
233
  docs: D,
234
234
  props: x,
235
235
  by: C
236
- })] }) : /* @__PURE__ */ U("div", {
236
+ })] }) : /* @__PURE__ */ W("div", {
237
237
  className: "flex flex-wrap items-center gap-2 py-3 text-sm text-muted-foreground",
238
- children: [u("pickGroup"), c && /* @__PURE__ */ H(Y, {
238
+ children: [u("pickGroup"), c && /* @__PURE__ */ U(de, {
239
239
  workspace: e,
240
240
  space: o,
241
241
  view: s,
242
- config: y,
242
+ config: g,
243
243
  open: !0
244
244
  })]
245
- }) : S ? s.layout === "timeline" ? /* @__PURE__ */ H(xe, {
245
+ }) : S ? s.layout === "timeline" ? /* @__PURE__ */ U(Se, {
246
246
  workspace: e,
247
247
  docs: D,
248
248
  dateOf: O,
249
249
  toolbar: P
250
- }) : /* @__PURE__ */ H(he, {
250
+ }) : /* @__PURE__ */ U(Q, {
251
251
  workspace: e,
252
252
  docs: D,
253
253
  dateOf: O,
254
254
  toolbar: P,
255
255
  parent: n,
256
256
  space: o,
257
- viewTemplate: y.template,
257
+ viewTemplate: g.template,
258
258
  dateProperty: S?.id,
259
259
  canWrite: c
260
- }) : /* @__PURE__ */ U("div", {
260
+ }) : /* @__PURE__ */ W("div", {
261
261
  className: "flex flex-wrap items-center gap-2 py-3 text-sm text-muted-foreground",
262
- children: [s.layout === "timeline" ? u("pickTimelineDate") : u("pickDate"), c && /* @__PURE__ */ H(Y, {
262
+ children: [s.layout === "timeline" ? u("pickTimelineDate") : u("pickDate"), c && /* @__PURE__ */ U(de, {
263
263
  workspace: e,
264
264
  space: o,
265
265
  view: s,
266
- config: y,
266
+ config: g,
267
267
  open: !0
268
268
  })]
269
269
  })]
270
270
  });
271
271
  }
272
- function Y({ workspace: t, space: n, view: r, config: i, open: s }) {
273
- let c = B("subpages"), l = R(), u = p(t), d = o(t), { data: f = [] } = W(a(t, n)), { data: m = [] } = W(e(t)), h = f.filter((e) => e.kind === "date"), g = f.filter(v), _ = (e) => u.updateView.mutate({
272
+ function de({ workspace: t, space: n, view: r, config: i, open: s }) {
273
+ let c = V("subpages"), l = z(), u = m(t), d = o(t), { data: f = [] } = G(a(t, n)), { data: p = [] } = G(e(t)), h = f.filter((e) => e.kind === "date"), g = f.filter(y), _ = (e) => u.updateView.mutate({
274
274
  view: r,
275
275
  config: { ...e }
276
- }), y = "block text-xs font-medium text-muted-foreground";
277
- return /* @__PURE__ */ H(M, {
278
- trigger: s ? /* @__PURE__ */ H(A, {
276
+ }), v = "block text-xs font-medium text-muted-foreground";
277
+ return /* @__PURE__ */ U(N, {
278
+ trigger: s ? /* @__PURE__ */ U(A, {
279
279
  size: "xs",
280
280
  children: c("settings")
281
- }) : /* @__PURE__ */ H(A, {
281
+ }) : /* @__PURE__ */ U(A, {
282
282
  size: "xs",
283
283
  variant: "ghost",
284
284
  "aria-label": c("settings"),
285
- children: /* @__PURE__ */ H(E, {})
285
+ children: /* @__PURE__ */ U(D, {})
286
286
  }),
287
287
  align: "end",
288
288
  className: "w-72",
289
289
  "aria-label": c("settings"),
290
- children: /* @__PURE__ */ U("div", {
290
+ children: /* @__PURE__ */ W("div", {
291
291
  className: "space-y-3",
292
292
  children: [
293
- r.layout === "board" && /* @__PURE__ */ U("div", {
294
- className: y,
295
- children: [c("groupBy"), /* @__PURE__ */ U("div", {
293
+ r.layout === "board" && /* @__PURE__ */ W("div", {
294
+ className: v,
295
+ children: [c("groupBy"), /* @__PURE__ */ W("div", {
296
296
  className: "mt-1 flex items-center gap-2",
297
- children: [g.length > 0 && /* @__PURE__ */ H(N, {
297
+ children: [g.length > 0 && /* @__PURE__ */ U(P, {
298
298
  value: i.groupBy ?? "",
299
299
  items: [{
300
300
  value: "",
@@ -309,7 +309,7 @@ function Y({ workspace: t, space: n, view: r, config: i, open: s }) {
309
309
  }),
310
310
  "aria-label": c("groupBy"),
311
311
  size: "sm"
312
- }), /* @__PURE__ */ H(A, {
312
+ }), /* @__PURE__ */ U(A, {
313
313
  size: "xs",
314
314
  loading: d.create.isPending,
315
315
  onClick: async () => {
@@ -332,11 +332,11 @@ function Y({ workspace: t, space: n, view: r, config: i, open: s }) {
332
332
  })]
333
333
  })]
334
334
  }),
335
- (K(r.layout) || r.layout === "feed") && /* @__PURE__ */ U("div", {
336
- className: y,
337
- children: [c("dateProperty"), /* @__PURE__ */ U("div", {
335
+ (le(r.layout) || r.layout === "feed") && /* @__PURE__ */ W("div", {
336
+ className: v,
337
+ children: [c("dateProperty"), /* @__PURE__ */ W("div", {
338
338
  className: "mt-1 flex items-center gap-2",
339
- children: [h.length > 0 && /* @__PURE__ */ H(N, {
339
+ children: [h.length > 0 && /* @__PURE__ */ U(P, {
340
340
  value: i.dateProperty ?? "",
341
341
  items: [{
342
342
  value: "",
@@ -351,7 +351,7 @@ function Y({ workspace: t, space: n, view: r, config: i, open: s }) {
351
351
  }),
352
352
  "aria-label": c("dateProperty"),
353
353
  size: "sm"
354
- }), /* @__PURE__ */ H(A, {
354
+ }), /* @__PURE__ */ U(A, {
355
355
  size: "xs",
356
356
  loading: d.create.isPending,
357
357
  onClick: async () => {
@@ -369,16 +369,16 @@ function Y({ workspace: t, space: n, view: r, config: i, open: s }) {
369
369
  })]
370
370
  })]
371
371
  }),
372
- /* @__PURE__ */ U("div", {
373
- className: y,
374
- children: [c("template"), /* @__PURE__ */ H("div", {
372
+ /* @__PURE__ */ W("div", {
373
+ className: v,
374
+ children: [c("template"), /* @__PURE__ */ U("div", {
375
375
  className: "mt-1",
376
- children: /* @__PURE__ */ H(N, {
376
+ children: /* @__PURE__ */ U(P, {
377
377
  value: i.template ?? "",
378
378
  items: [{
379
379
  value: "",
380
380
  label: c("noTemplate")
381
- }, ...m.map((e) => ({
381
+ }, ...p.map((e) => ({
382
382
  value: e.id,
383
383
  label: e.title
384
384
  }))],
@@ -391,8 +391,8 @@ function Y({ workspace: t, space: n, view: r, config: i, open: s }) {
391
391
  })
392
392
  })]
393
393
  }),
394
- (u.updateView.error ?? d.create.error) && /* @__PURE__ */ H(j, { children: l(u.updateView.error ?? d.create.error) }),
395
- /* @__PURE__ */ H(A, {
394
+ (u.updateView.error ?? d.create.error) && /* @__PURE__ */ U(j, { children: l(u.updateView.error ?? d.create.error) }),
395
+ /* @__PURE__ */ U(A, {
396
396
  size: "xs",
397
397
  variant: "danger",
398
398
  onClick: () => u.removeView.mutate(r),
@@ -402,224 +402,225 @@ function Y({ workspace: t, space: n, view: r, config: i, open: s }) {
402
402
  })
403
403
  });
404
404
  }
405
- var X = 128, fe = 3, Z = 32, Q = 26, pe = 8, me = (e, t) => Math.round((Date.UTC(t.getFullYear(), t.getMonth(), t.getDate()) - Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())) / 864e5);
406
- function he({ workspace: e, docs: t, dateOf: a, toolbar: o, parent: u, space: d, viewTemplate: f, dateProperty: p, canWrite: h }) {
407
- let g = B("subpages"), _ = z(), v = oe(), y = re(), b = I(() => /* @__PURE__ */ new Date(), []), x = ue(v), S = I(() => q(b, -((b.getDay() - x + 7) % 7)), [b, x]), w = (e) => Math.floor(me(S, e) / 7), T = I(() => {
408
- let e = b;
405
+ var Z = 128, fe = 3, pe = 32, me = 26, he = 8, ge = (e, t) => Math.round((Date.UTC(t.getFullYear(), t.getMonth(), t.getDate()) - Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())) / 864e5);
406
+ function Q({ workspace: e, docs: t, dateOf: a, toolbar: o, parent: d, space: f, viewTemplate: p, dateProperty: m, canWrite: g }) {
407
+ let _ = V("subpages"), v = B(), y = oe(), b = re(), x = u(e), S = L(() => /* @__PURE__ */ new Date(), []), C = ue(y), T = L(() => J(S, -((S.getDay() - C + 7) % 7)), [S, C]), E = (e) => Math.floor(ge(T, e) / 7), D = L(() => {
408
+ let e = S;
409
409
  for (let n of t) {
410
410
  let t = a(n), i = t && r(t);
411
411
  i && i < e && (e = i);
412
412
  }
413
- return Math.floor(me(S, new Date(e.getFullYear(), e.getMonth(), 1)) / 7);
413
+ return Math.floor(ge(T, new Date(e.getFullYear(), e.getMonth(), 1)) / 7);
414
414
  }, [
415
415
  t,
416
416
  a,
417
- b,
418
- S
419
- ]), [E, D] = L(() => ({
420
- from: Math.max(T, -26),
421
- to: Q
422
- })), O = Math.max(T, Math.min(E.from, 0)), j = (e) => q(S, (O + e) * 7), ne = (e) => w(e) - O, N = ae(null), R = ae(null), [V, G] = L(() => new Date(b.getFullYear(), b.getMonth(), 1)), le = (e) => n(j(Math.max(0, Math.round(e / X)))), K = ce({
423
- count: E.to - O + 1,
424
- getScrollElement: () => N.current,
425
- estimateSize: () => X,
426
- getItemKey: (e) => O + e,
417
+ S,
418
+ T
419
+ ]), [O, k] = R(() => ({
420
+ from: Math.max(D, -26),
421
+ to: me
422
+ })), j = Math.max(D, Math.min(O.from, 0)), M = (e) => J(T, (j + e) * 7), P = (e) => E(e) - j, z = ae(null), H = ae(null), [K, q] = R(() => new Date(S.getFullYear(), S.getMonth(), 1)), le = (e) => n(M(Math.max(0, Math.round(e / Z)))), Y = ce({
423
+ count: O.to - j + 1,
424
+ getScrollElement: () => z.current,
425
+ estimateSize: () => Z,
426
+ getItemKey: (e) => j + e,
427
427
  overscan: 3,
428
- scrollMargin: Z,
429
- initialOffset: (-O - +(n(q(S, -7)).getMonth() === b.getMonth())) * X,
428
+ scrollMargin: pe,
429
+ initialOffset: (-j - +(n(J(T, -7)).getMonth() === S.getMonth())) * Z,
430
430
  onChange: (e) => {
431
- if (R.current) return;
431
+ if (H.current) return;
432
432
  let t = le(e.scrollOffset ?? 0);
433
- G((e) => e.getTime() === t.getTime() ? e : t);
433
+ q((e) => e.getTime() === t.getTime() ? e : t);
434
434
  let n = e.range;
435
435
  if (n) {
436
- if (n.startIndex < pe && O > T) {
437
- let e = Math.max(T, O - Q);
438
- R.current = { above: O - e }, D((t) => ({
436
+ if (n.startIndex < he && j > D) {
437
+ let e = Math.max(D, j - me);
438
+ H.current = { above: j - e }, k((t) => ({
439
439
  ...t,
440
440
  from: e
441
441
  }));
442
- } else n.endIndex > E.to - O - pe && D((e) => ({
442
+ } else n.endIndex > O.to - j - he && k((e) => ({
443
443
  ...e,
444
- to: e.to + Q
444
+ to: e.to + me
445
445
  }));
446
446
  }
447
447
  }
448
448
  });
449
449
  ie(() => {
450
- let e = R.current;
451
- e && (R.current = null, "above" in e ? N.current?.scrollBy({ top: e.above * X }) : K.scrollToIndex(ne(e.target), { align: "start" }));
450
+ let e = H.current;
451
+ e && (H.current = null, "above" in e ? z.current?.scrollBy({ top: e.above * Z }) : Y.scrollToIndex(P(e.target), { align: "start" }));
452
452
  });
453
- let J = (e) => {
454
- let t = Math.max(w(e), T);
455
- G(e), t >= O && t <= E.to ? K.scrollToIndex(t - O, { align: "start" }) : (R.current = { target: e }, D((e) => ({
456
- from: Math.min(e.from, Math.max(T, t - pe)),
457
- to: Math.max(e.to, t + Q)
453
+ let X = (e) => {
454
+ let t = Math.max(E(e), D);
455
+ q(e), t >= j && t <= O.to ? Y.scrollToIndex(t - j, { align: "start" }) : (H.current = { target: e }, k((e) => ({
456
+ from: Math.min(e.from, Math.max(D, t - he)),
457
+ to: Math.max(e.to, t + me)
458
458
  })));
459
- }, de = w(V) <= T, Y = K.getVirtualItems(), he = j(Y[0]?.index ?? -O), ge = q(j(Y[Y.length - 1]?.index ?? -O), 6), _e = new Date(he.getFullYear(), he.getMonth(), he.getDate()), ve = new Date(Math.min(new Date(ge.getFullYear(), ge.getMonth() + 1, 0).getTime(), q(_e, 61).getTime())), { data: ye = [] } = W({
460
- ...s(e, d, i(_e), i(ve)),
459
+ }, de = E(K) <= D, Q = Y.getVirtualItems(), _e = M(Q[0]?.index ?? -j), ve = J(M(Q[Q.length - 1]?.index ?? -j), 6), ye = new Date(_e.getFullYear(), _e.getMonth(), _e.getDate()), be = new Date(Math.min(new Date(ve.getFullYear(), ve.getMonth() + 1, 0).getTime(), J(ye, 61).getTime())), { data: xe = [] } = G({
460
+ ...s(e, f, i(ye), i(be)),
461
461
  placeholderData: se
462
- }), be = c(e), [$, xe] = L(), Se = I(() => {
462
+ }), $ = c(e), [Se, Ce] = R(), we = L(() => {
463
463
  let e = /* @__PURE__ */ new Map();
464
464
  for (let n of t) {
465
465
  let t = a(n);
466
466
  t && e.set(t, [...e.get(t) ?? [], n]);
467
467
  }
468
468
  return e;
469
- }, [t, a]), Ce = I(() => {
469
+ }, [t, a]), Te = L(() => {
470
470
  let e = /* @__PURE__ */ new Map();
471
- for (let t of ye) if (t.parentId === u.id && !t.stoppedAt) for (let n of t.upcoming ?? []) e.set(n, [...e.get(n) ?? [], t]);
471
+ for (let t of xe) if (t.parentId === d.id && !t.stoppedAt) for (let n of t.upcoming ?? []) e.set(n, [...e.get(n) ?? [], t]);
472
472
  return e;
473
- }, [ye, u.id]), we = i(b), Te = (t) => /* @__PURE__ */ U(F, {
473
+ }, [xe, d.id]), Ee = i(S), De = (t) => /* @__PURE__ */ W(I, {
474
474
  to: "/$workspace/docs/$doc",
475
475
  params: {
476
476
  workspace: e,
477
477
  doc: l(t)
478
478
  },
479
+ ...x(t),
479
480
  className: "flex min-w-0 items-center gap-1 rounded bg-card px-1.5 py-0.5 text-xs shadow-xs ring-1 ring-border hover:bg-accent",
480
- children: [/* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
481
+ children: [/* @__PURE__ */ U(h, { icon: t.icon }), /* @__PURE__ */ U("span", {
481
482
  className: "truncate",
482
483
  children: t.title
483
484
  })]
484
- }, t.id), Ee = (t, n) => /* @__PURE__ */ U("button", {
485
+ }, t.id), Oe = (t, n) => /* @__PURE__ */ W("button", {
485
486
  type: "button",
486
- disabled: !h || be.makeDoc.isPending,
487
- onClick: () => be.makeDoc.mutate({
487
+ disabled: !g || $.makeDoc.isPending,
488
+ onClick: () => $.makeDoc.mutate({
488
489
  id: t.id,
489
490
  day: n
490
- }, { onSuccess: (t) => y({
491
+ }, { onSuccess: (t) => b({
491
492
  to: "/$workspace/docs/$doc",
492
493
  params: {
493
494
  workspace: e,
494
495
  doc: l(t)
495
496
  }
496
497
  }) }),
497
- "aria-label": g("makeSeriesDoc", { series: t.title }),
498
+ "aria-label": _("makeSeriesDoc", { series: t.title }),
498
499
  className: "flex min-w-0 items-center gap-1 rounded border border-dashed border-border px-1.5 py-0.5 text-left text-xs text-muted-foreground enabled:hover:border-primary enabled:hover:text-foreground",
499
- children: [/* @__PURE__ */ H(te, { className: "size-3 shrink-0" }), /* @__PURE__ */ H("span", {
500
+ children: [/* @__PURE__ */ U(te, { className: "size-3 shrink-0" }), /* @__PURE__ */ U("span", {
500
501
  className: "truncate",
501
502
  children: t.title
502
503
  })]
503
- }, `${t.id}-${n}`), De = (e, t = !1) => h && /* @__PURE__ */ H("button", {
504
+ }, `${t.id}-${n}`), ke = (e, t = !1) => g && /* @__PURE__ */ U("button", {
504
505
  type: "button",
505
- onClick: () => xe(e),
506
- "aria-label": g("newOn", { date: _.dateTime(r(e), { dateStyle: "medium" }) }),
507
- className: P("rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100", !t && "opacity-0 group-hover:opacity-100"),
508
- children: /* @__PURE__ */ H(ee, { className: "size-3.5" })
509
- }), Oe = (e) => e.getDay() === 0 || e.getDay() === 6, ke = (e) => e.getMonth() === V.getMonth() && e.getFullYear() === V.getFullYear(), Ae = (e) => [...(Se.get(e) ?? []).map(Te), ...(Ce.get(e) ?? []).map((t) => Ee(t, e))], je = Array.from({ length: new Date(V.getFullYear(), V.getMonth() + 1, 0).getDate() }, (e, t) => new Date(V.getFullYear(), V.getMonth(), t + 1)).filter((e) => Se.has(i(e)) || Ce.has(i(e)) || i(e) === we);
510
- return /* @__PURE__ */ U("div", {
506
+ onClick: () => Ce(e),
507
+ "aria-label": _("newOn", { date: v.dateTime(r(e), { dateStyle: "medium" }) }),
508
+ className: F("rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100", !t && "opacity-0 group-hover:opacity-100"),
509
+ children: /* @__PURE__ */ U(ee, { className: "size-3.5" })
510
+ }), Ae = (e) => e.getDay() === 0 || e.getDay() === 6, je = (e) => e.getMonth() === K.getMonth() && e.getFullYear() === K.getFullYear(), Me = (e) => [...(we.get(e) ?? []).map(De), ...(Te.get(e) ?? []).map((t) => Oe(t, e))], Ne = Array.from({ length: new Date(K.getFullYear(), K.getMonth() + 1, 0).getDate() }, (e, t) => new Date(K.getFullYear(), K.getMonth(), t + 1)).filter((e) => we.has(i(e)) || Te.has(i(e)) || i(e) === Ee);
511
+ return /* @__PURE__ */ W("div", {
511
512
  className: "flex flex-col",
512
513
  children: [
513
- $ && /* @__PURE__ */ H(k, {
514
+ Se && /* @__PURE__ */ U(ne, {
514
515
  workspace: e,
515
- parent: u,
516
- space: d,
517
- day: $,
518
- dateProperty: p,
519
- viewTemplate: f,
520
- onClose: () => xe(void 0)
516
+ parent: d,
517
+ space: f,
518
+ day: Se,
519
+ dateProperty: m,
520
+ viewTemplate: p,
521
+ onClose: () => Ce(void 0)
521
522
  }),
522
- /* @__PURE__ */ U("div", {
523
+ /* @__PURE__ */ W("div", {
523
524
  className: "flex flex-wrap items-center gap-2 py-2",
524
525
  children: [
525
- /* @__PURE__ */ U("h3", {
526
+ /* @__PURE__ */ W("h3", {
526
527
  className: "grid text-base font-semibold tabular-nums",
527
528
  "aria-live": "polite",
528
- children: [Array.from({ length: 12 }, (e, t) => _.dateTime(new Date(V.getFullYear(), t, 1), {
529
+ children: [Array.from({ length: 12 }, (e, t) => v.dateTime(new Date(K.getFullYear(), t, 1), {
529
530
  month: "long",
530
531
  year: "numeric"
531
- })).map((e) => /* @__PURE__ */ H("span", {
532
+ })).map((e) => /* @__PURE__ */ U("span", {
532
533
  "aria-hidden": !0,
533
534
  className: "invisible col-start-1 row-start-1",
534
535
  children: e
535
- }, e)), /* @__PURE__ */ H("span", {
536
+ }, e)), /* @__PURE__ */ U("span", {
536
537
  className: "col-start-1 row-start-1",
537
- children: _.dateTime(V, {
538
+ children: v.dateTime(K, {
538
539
  month: "long",
539
540
  year: "numeric"
540
541
  })
541
542
  })]
542
543
  }),
543
- /* @__PURE__ */ H("span", {
544
+ /* @__PURE__ */ U("span", {
544
545
  className: "flex flex-wrap items-center gap-1",
545
546
  children: o
546
547
  }),
547
- /* @__PURE__ */ U("span", {
548
+ /* @__PURE__ */ W("span", {
548
549
  className: "ml-auto flex items-center gap-1",
549
550
  children: [
550
- /* @__PURE__ */ H(A, {
551
+ /* @__PURE__ */ U(A, {
551
552
  size: "xs",
552
553
  variant: "ghost",
553
- onClick: () => J(new Date(V.getFullYear(), V.getMonth() - 1, 1)),
554
+ onClick: () => X(new Date(K.getFullYear(), K.getMonth() - 1, 1)),
554
555
  disabled: de,
555
- "aria-label": g("previousMonth"),
556
- children: /* @__PURE__ */ H(C, { className: "rotate-180" })
556
+ "aria-label": _("previousMonth"),
557
+ children: /* @__PURE__ */ U(w, { className: "rotate-180" })
557
558
  }),
558
- /* @__PURE__ */ H(A, {
559
+ /* @__PURE__ */ U(A, {
559
560
  size: "xs",
560
561
  variant: "ghost",
561
- onClick: () => J(new Date(b.getFullYear(), b.getMonth(), 1)),
562
- children: g("today")
562
+ onClick: () => X(new Date(S.getFullYear(), S.getMonth(), 1)),
563
+ children: _("today")
563
564
  }),
564
- /* @__PURE__ */ H(A, {
565
+ /* @__PURE__ */ U(A, {
565
566
  size: "xs",
566
567
  variant: "ghost",
567
- onClick: () => J(new Date(V.getFullYear(), V.getMonth() + 1, 1)),
568
- "aria-label": g("nextMonth"),
569
- children: /* @__PURE__ */ H(C, {})
568
+ onClick: () => X(new Date(K.getFullYear(), K.getMonth() + 1, 1)),
569
+ "aria-label": _("nextMonth"),
570
+ children: /* @__PURE__ */ U(w, {})
570
571
  })
571
572
  ]
572
573
  })
573
574
  ]
574
575
  }),
575
- /* @__PURE__ */ U("div", {
576
- ref: N,
576
+ /* @__PURE__ */ W("div", {
577
+ ref: z,
577
578
  className: "h-[min(72vh,760px)] overflow-y-auto rounded-md border border-border max-sm:hidden",
578
- children: [/* @__PURE__ */ H("div", {
579
+ children: [/* @__PURE__ */ U("div", {
579
580
  className: "sticky top-0 z-10 grid grid-cols-7 border-b border-border bg-card text-xs text-muted-foreground",
580
- style: { height: Z },
581
- children: Array.from({ length: 7 }, (e, t) => q(S, t)).map((e) => /* @__PURE__ */ H("span", {
582
- className: P("flex items-center px-2", Oe(e) && "bg-muted/40"),
583
- children: _.dateTime(e, { weekday: "short" })
581
+ style: { height: pe },
582
+ children: Array.from({ length: 7 }, (e, t) => J(T, t)).map((e) => /* @__PURE__ */ U("span", {
583
+ className: F("flex items-center px-2", Ae(e) && "bg-muted/40"),
584
+ children: v.dateTime(e, { weekday: "short" })
584
585
  }, e.getDay()))
585
- }), /* @__PURE__ */ H("ol", {
586
+ }), /* @__PURE__ */ U("ol", {
586
587
  className: "relative",
587
- style: { height: K.getTotalSize() - Z },
588
- "aria-label": g("calendarView"),
589
- children: Y.map((e) => /* @__PURE__ */ H("li", {
588
+ style: { height: Y.getTotalSize() - pe },
589
+ "aria-label": _("calendarView"),
590
+ children: Q.map((e) => /* @__PURE__ */ U("li", {
590
591
  className: "absolute inset-x-0",
591
592
  style: {
592
- height: X,
593
- transform: `translateY(${e.start - Z}px)`
593
+ height: Z,
594
+ transform: `translateY(${e.start - pe}px)`
594
595
  },
595
- children: /* @__PURE__ */ H("ol", {
596
+ children: /* @__PURE__ */ U("ol", {
596
597
  className: "grid h-full grid-cols-7",
597
- children: Array.from({ length: 7 }, (t, n) => q(j(e.index), n)).map((e) => {
598
- let t = i(e), n = Ae(t), r = n.length - fe;
599
- return /* @__PURE__ */ U("li", {
600
- "aria-label": _.dateTime(e, { dateStyle: "full" }),
601
- className: P("group flex min-w-0 flex-col gap-1 overflow-hidden border-r border-b border-border p-1 last:border-r-0", Oe(e) && "bg-muted/40", !ke(e) && "text-muted-foreground"),
598
+ children: Array.from({ length: 7 }, (t, n) => J(M(e.index), n)).map((e) => {
599
+ let t = i(e), n = Me(t), r = n.length - fe;
600
+ return /* @__PURE__ */ W("li", {
601
+ "aria-label": v.dateTime(e, { dateStyle: "full" }),
602
+ className: F("group flex min-w-0 flex-col gap-1 overflow-hidden border-r border-b border-border p-1 last:border-r-0", Ae(e) && "bg-muted/40", !je(e) && "text-muted-foreground"),
602
603
  children: [
603
- /* @__PURE__ */ U("span", {
604
+ /* @__PURE__ */ W("span", {
604
605
  className: "flex items-center justify-between",
605
- children: [De(t), /* @__PURE__ */ H("span", {
606
- className: P("ml-auto flex h-6 min-w-6 items-center justify-center whitespace-nowrap rounded-full px-1 text-xs tabular-nums", t === we && "bg-primary font-medium text-primary-foreground", e.getDate() === 1 && t !== we && "font-medium"),
607
- children: e.getDate() === 1 ? _.dateTime(e, {
606
+ children: [ke(t), /* @__PURE__ */ U("span", {
607
+ className: F("ml-auto flex h-6 min-w-6 items-center justify-center whitespace-nowrap rounded-full px-1 text-xs tabular-nums", t === Ee && "bg-primary font-medium text-primary-foreground", e.getDate() === 1 && t !== Ee && "font-medium"),
608
+ children: e.getDate() === 1 ? v.dateTime(e, {
608
609
  month: "short",
609
610
  day: "numeric"
610
611
  }) : e.getDate()
611
612
  })]
612
613
  }),
613
614
  n.slice(0, r > 0 ? 2 : fe),
614
- r > 0 && /* @__PURE__ */ H(M, {
615
- trigger: /* @__PURE__ */ H("button", {
615
+ r > 0 && /* @__PURE__ */ U(N, {
616
+ trigger: /* @__PURE__ */ U("button", {
616
617
  type: "button",
617
618
  className: "self-start rounded px-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground",
618
- children: g("moreOnDay", { count: r + 1 })
619
+ children: _("moreOnDay", { count: r + 1 })
619
620
  }),
620
621
  align: "start",
621
622
  className: "max-h-80 w-64 space-y-1 overflow-y-auto",
622
- "aria-label": _.dateTime(e, { dateStyle: "full" }),
623
+ "aria-label": v.dateTime(e, { dateStyle: "full" }),
623
624
  children: n
624
625
  })
625
626
  ]
@@ -629,256 +630,269 @@ function he({ workspace: e, docs: t, dateOf: a, toolbar: o, parent: u, space: d,
629
630
  }, e.key))
630
631
  })]
631
632
  }),
632
- /* @__PURE__ */ H("ol", {
633
+ /* @__PURE__ */ U("ol", {
633
634
  className: "divide-y divide-border rounded-md border border-border sm:hidden",
634
- children: je.map((e) => {
635
+ children: Ne.map((e) => {
635
636
  let t = i(e);
636
- return /* @__PURE__ */ U("li", {
637
+ return /* @__PURE__ */ W("li", {
637
638
  className: "flex flex-col gap-1 px-3 py-2",
638
- children: [/* @__PURE__ */ U("span", {
639
+ children: [/* @__PURE__ */ W("span", {
639
640
  className: "flex items-center justify-between text-xs",
640
- children: [/* @__PURE__ */ H("span", {
641
- className: t === we ? "font-medium text-primary" : "text-muted-foreground",
642
- children: _.dateTime(e, {
641
+ children: [/* @__PURE__ */ U("span", {
642
+ className: t === Ee ? "font-medium text-primary" : "text-muted-foreground",
643
+ children: v.dateTime(e, {
643
644
  weekday: "long",
644
645
  month: "short",
645
646
  day: "numeric"
646
647
  })
647
- }), De(t, !0)]
648
- }), Ae(t)]
648
+ }), ke(t, !0)]
649
+ }), Me(t)]
649
650
  }, t);
650
651
  })
651
652
  })
652
653
  ]
653
654
  });
654
655
  }
655
- function ge({ workspace: e, docs: t, dateOf: n, toolbar: i }) {
656
- let a = B("subpages"), o = z(), s = [...t].sort((e, t) => {
656
+ function _e({ workspace: e, docs: t, dateOf: n, toolbar: i }) {
657
+ let a = V("subpages"), o = u(e), s = B(), c = [...t].sort((e, t) => {
657
658
  let r = n(e) ?? "", i = n(t) ?? "";
658
659
  return r === i ? t.updatedAt < e.updatedAt ? -1 : 1 : r < i ? 1 : -1;
659
660
  });
660
- return /* @__PURE__ */ U("div", {
661
+ return /* @__PURE__ */ W("div", {
661
662
  className: "flex flex-col",
662
- children: [/* @__PURE__ */ H("div", {
663
+ children: [/* @__PURE__ */ U("div", {
663
664
  className: "flex flex-wrap items-center gap-1 py-2",
664
665
  children: i
665
- }), s.length === 0 ? /* @__PURE__ */ H("p", {
666
+ }), c.length === 0 ? /* @__PURE__ */ U("p", {
666
667
  className: "py-3 text-sm text-muted-foreground",
667
668
  children: a("none")
668
- }) : /* @__PURE__ */ H("ul", {
669
+ }) : /* @__PURE__ */ U("ul", {
669
670
  className: "divide-y divide-border",
670
- children: s.map((t) => {
671
+ children: c.map((t) => {
671
672
  let i = n(t);
672
- return /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
673
- to: "/$workspace/docs/$doc",
674
- params: {
675
- workspace: e,
676
- doc: l(t)
677
- },
678
- className: "flex items-center gap-3 py-2 text-sm hover:bg-accent/40",
679
- children: [
680
- /* @__PURE__ */ H("span", {
681
- className: "w-28 shrink-0 text-xs text-muted-foreground tabular-nums",
682
- children: i ? o.dateTime(r(i), { dateStyle: "medium" }) : a("undated")
683
- }),
684
- /* @__PURE__ */ H(m, { icon: t.icon }),
685
- /* @__PURE__ */ H("span", {
686
- className: "min-w-0 flex-1 truncate font-medium",
687
- children: t.title
688
- }),
689
- /* @__PURE__ */ H("span", {
690
- className: "shrink-0 text-xs text-muted-foreground",
691
- children: o.relativeTime(new Date(t.updatedAt))
692
- })
693
- ]
694
- }) }, t.id);
673
+ return /* @__PURE__ */ U("li", {
674
+ ...o(t),
675
+ children: /* @__PURE__ */ W(I, {
676
+ to: "/$workspace/docs/$doc",
677
+ params: {
678
+ workspace: e,
679
+ doc: l(t)
680
+ },
681
+ className: "flex items-center gap-3 py-2 text-sm hover:bg-accent/40",
682
+ children: [
683
+ /* @__PURE__ */ U("span", {
684
+ className: "w-28 shrink-0 text-xs text-muted-foreground tabular-nums",
685
+ children: i ? s.dateTime(r(i), { dateStyle: "medium" }) : a("undated")
686
+ }),
687
+ /* @__PURE__ */ U(h, { icon: t.icon }),
688
+ /* @__PURE__ */ U("span", {
689
+ className: "min-w-0 flex-1 truncate font-medium",
690
+ children: t.title
691
+ }),
692
+ /* @__PURE__ */ U("span", {
693
+ className: "shrink-0 text-xs text-muted-foreground",
694
+ children: s.relativeTime(new Date(t.updatedAt))
695
+ })
696
+ ]
697
+ })
698
+ }, t.id);
695
699
  })
696
700
  })]
697
701
  });
698
702
  }
699
- var _e = "flex min-w-0 items-center gap-2 font-medium hover:underline";
700
- function ve({ workspace: e, docs: t, props: n, toolbar: r }) {
701
- let i = B("subpages"), a = B("docViews"), o = z(), s = h(e);
702
- return /* @__PURE__ */ U("div", {
703
+ var ve = "flex min-w-0 items-center gap-2 font-medium hover:underline";
704
+ function ye({ workspace: e, docs: t, props: n, toolbar: r }) {
705
+ let i = V("subpages"), a = u(e), o = V("docViews"), s = B(), c = g(e);
706
+ return /* @__PURE__ */ W("div", {
703
707
  className: "flex flex-col",
704
- children: [/* @__PURE__ */ H("div", {
708
+ children: [/* @__PURE__ */ U("div", {
705
709
  className: "flex flex-wrap items-center gap-1 py-2",
706
710
  children: r
707
- }), t.length === 0 ? /* @__PURE__ */ H("p", {
711
+ }), t.length === 0 ? /* @__PURE__ */ U("p", {
708
712
  className: "py-3 text-sm text-muted-foreground",
709
713
  children: i("none")
710
- }) : /* @__PURE__ */ H("div", {
714
+ }) : /* @__PURE__ */ U("div", {
711
715
  className: "overflow-x-auto",
712
- children: /* @__PURE__ */ U("table", {
716
+ children: /* @__PURE__ */ W("table", {
713
717
  className: "doc-table w-full min-w-max text-sm",
714
- children: [/* @__PURE__ */ H("thead", { children: /* @__PURE__ */ U("tr", { children: [
715
- /* @__PURE__ */ H("th", {
718
+ children: [/* @__PURE__ */ U("thead", { children: /* @__PURE__ */ W("tr", { children: [
719
+ /* @__PURE__ */ U("th", {
716
720
  scope: "col",
717
- children: a("docTitle")
721
+ children: o("docTitle")
718
722
  }),
719
- n.map((e) => /* @__PURE__ */ H("th", {
723
+ n.map((e) => /* @__PURE__ */ U("th", {
720
724
  scope: "col",
721
725
  children: e.name
722
726
  }, e.id)),
723
- /* @__PURE__ */ H("th", {
727
+ /* @__PURE__ */ U("th", {
724
728
  scope: "col",
725
- children: a("updated")
726
- })
727
- ] }) }), /* @__PURE__ */ H("tbody", { children: t.map((t) => /* @__PURE__ */ U("tr", { children: [
728
- /* @__PURE__ */ H("td", { children: /* @__PURE__ */ U(F, {
729
- to: "/$workspace/docs/$doc",
730
- params: {
731
- workspace: e,
732
- doc: l(t)
733
- },
734
- className: _e,
735
- children: [/* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
736
- className: "truncate",
737
- children: t.title
738
- })]
739
- }) }),
740
- n.map((e) => /* @__PURE__ */ H("td", { children: s(e, t.properties?.[e.id]) }, e.id)),
741
- /* @__PURE__ */ H("td", {
742
- className: "text-muted-foreground",
743
- children: o.dateTime(new Date(t.updatedAt), { dateStyle: "medium" })
729
+ children: o("updated")
744
730
  })
745
- ] }, t.id)) })]
731
+ ] }) }), /* @__PURE__ */ U("tbody", { children: t.map((t) => /* @__PURE__ */ W("tr", {
732
+ ...a(t),
733
+ children: [
734
+ /* @__PURE__ */ U("td", { children: /* @__PURE__ */ W(I, {
735
+ to: "/$workspace/docs/$doc",
736
+ params: {
737
+ workspace: e,
738
+ doc: l(t)
739
+ },
740
+ className: ve,
741
+ children: [/* @__PURE__ */ U(h, { icon: t.icon }), /* @__PURE__ */ U("span", {
742
+ className: "truncate",
743
+ children: t.title
744
+ })]
745
+ }) }),
746
+ n.map((e) => /* @__PURE__ */ U("td", { children: c(e, t.properties?.[e.id]) }, e.id)),
747
+ /* @__PURE__ */ U("td", {
748
+ className: "text-muted-foreground",
749
+ children: s.dateTime(new Date(t.updatedAt), { dateStyle: "medium" })
750
+ })
751
+ ]
752
+ }, t.id)) })]
746
753
  })
747
754
  })]
748
755
  });
749
756
  }
750
- function ye({ workspace: e, docs: t, toolbar: n }) {
751
- let r = B("subpages"), i = z();
752
- return /* @__PURE__ */ U("div", {
757
+ function be({ workspace: e, docs: t, toolbar: n }) {
758
+ let r = V("subpages"), i = u(e), a = B();
759
+ return /* @__PURE__ */ W("div", {
753
760
  className: "flex flex-col",
754
- children: [/* @__PURE__ */ H("div", {
761
+ children: [/* @__PURE__ */ U("div", {
755
762
  className: "flex flex-wrap items-center gap-1 py-2",
756
763
  children: n
757
- }), t.length === 0 ? /* @__PURE__ */ H("p", {
764
+ }), t.length === 0 ? /* @__PURE__ */ U("p", {
758
765
  className: "py-3 text-sm text-muted-foreground",
759
766
  children: r("none")
760
- }) : /* @__PURE__ */ H("ul", {
767
+ }) : /* @__PURE__ */ U("ul", {
761
768
  className: "divide-y divide-border",
762
- children: t.map((t) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
763
- to: "/$workspace/docs/$doc",
764
- params: {
765
- workspace: e,
766
- doc: l(t)
767
- },
768
- className: "flex items-center gap-2 py-2 text-sm hover:bg-accent/40",
769
- children: [
770
- /* @__PURE__ */ H(m, { icon: t.icon }),
771
- /* @__PURE__ */ H("span", {
772
- className: "min-w-0 flex-1 truncate font-medium",
773
- children: t.title
774
- }),
775
- /* @__PURE__ */ H("span", {
776
- className: "shrink-0 text-xs text-muted-foreground",
777
- children: i.relativeTime(new Date(t.updatedAt))
778
- })
779
- ]
780
- }) }, t.id))
769
+ children: t.map((t) => /* @__PURE__ */ U("li", {
770
+ ...i(t),
771
+ children: /* @__PURE__ */ W(I, {
772
+ to: "/$workspace/docs/$doc",
773
+ params: {
774
+ workspace: e,
775
+ doc: l(t)
776
+ },
777
+ className: "flex items-center gap-2 py-2 text-sm hover:bg-accent/40",
778
+ children: [
779
+ /* @__PURE__ */ U(h, { icon: t.icon }),
780
+ /* @__PURE__ */ U("span", {
781
+ className: "min-w-0 flex-1 truncate font-medium",
782
+ children: t.title
783
+ }),
784
+ /* @__PURE__ */ U("span", {
785
+ className: "shrink-0 text-xs text-muted-foreground",
786
+ children: a.relativeTime(new Date(t.updatedAt))
787
+ })
788
+ ]
789
+ })
790
+ }, t.id))
781
791
  })]
782
792
  });
783
793
  }
784
- function be({ workspace: e, docs: t, toolbar: n }) {
785
- let r = B("subpages");
786
- return /* @__PURE__ */ U("div", {
794
+ function xe({ workspace: e, docs: t, toolbar: n }) {
795
+ let r = V("subpages"), i = u(e);
796
+ return /* @__PURE__ */ W("div", {
787
797
  className: "flex flex-col",
788
- children: [/* @__PURE__ */ H("div", {
798
+ children: [/* @__PURE__ */ U("div", {
789
799
  className: "flex flex-wrap items-center gap-1 py-2",
790
800
  children: n
791
- }), t.length === 0 ? /* @__PURE__ */ H("p", {
801
+ }), t.length === 0 ? /* @__PURE__ */ U("p", {
792
802
  className: "py-3 text-sm text-muted-foreground",
793
803
  children: r("none")
794
- }) : /* @__PURE__ */ H("ul", {
804
+ }) : /* @__PURE__ */ U("ul", {
795
805
  className: "grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-3",
796
806
  "aria-label": r("galleryView"),
797
807
  children: t.map((t) => {
798
- let n = y(t.cover ?? "");
799
- return /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
800
- to: "/$workspace/docs/$doc",
801
- params: {
802
- workspace: e,
803
- doc: l(t)
804
- },
805
- className: "flex h-full flex-col overflow-hidden rounded-lg border border-border bg-card text-sm hover:border-primary",
806
- children: [/* @__PURE__ */ H("span", {
807
- className: "flex h-28 items-center justify-center bg-muted/50",
808
- children: n ? /* @__PURE__ */ H("img", {
809
- src: n,
810
- alt: "",
811
- className: "size-full object-cover",
812
- style: { objectPosition: `50% ${t.coverPosition ?? 50}%` }
813
- }) : /* @__PURE__ */ H(m, {
814
- icon: t.icon,
815
- className: "size-8",
816
- emojiClassName: "text-3xl"
817
- })
818
- }), /* @__PURE__ */ U("span", {
819
- className: "flex items-center gap-2 px-3 py-2 font-medium",
820
- children: [n && /* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
821
- className: "truncate",
822
- children: t.title
808
+ let n = b(t.cover ?? "");
809
+ return /* @__PURE__ */ U("li", {
810
+ ...i(t),
811
+ children: /* @__PURE__ */ W(I, {
812
+ to: "/$workspace/docs/$doc",
813
+ params: {
814
+ workspace: e,
815
+ doc: l(t)
816
+ },
817
+ className: "flex h-full flex-col overflow-hidden rounded-lg border border-border bg-card text-sm hover:border-primary",
818
+ children: [/* @__PURE__ */ U("span", {
819
+ className: "flex h-28 items-center justify-center bg-muted/50",
820
+ children: n ? /* @__PURE__ */ U("img", {
821
+ src: n,
822
+ alt: "",
823
+ className: "size-full object-cover",
824
+ style: { objectPosition: `50% ${t.coverPosition ?? 50}%` }
825
+ }) : /* @__PURE__ */ U(h, {
826
+ icon: t.icon,
827
+ className: "size-8",
828
+ emojiClassName: "text-3xl"
829
+ })
830
+ }), /* @__PURE__ */ W("span", {
831
+ className: "flex items-center gap-2 px-3 py-2 font-medium",
832
+ children: [n && /* @__PURE__ */ U(h, { icon: t.icon }), /* @__PURE__ */ U("span", {
833
+ className: "truncate",
834
+ children: t.title
835
+ })]
823
836
  })]
824
- })]
825
- }) }, t.id);
837
+ })
838
+ }, t.id);
826
839
  })
827
840
  })]
828
841
  });
829
842
  }
830
843
  var $ = 32;
831
- function xe({ workspace: e, docs: t, dateOf: n, toolbar: a }) {
832
- let o = B("subpages"), s = z(), c = I(() => /* @__PURE__ */ new Date(), []), u = t.flatMap((e) => {
844
+ function Se({ workspace: e, docs: t, dateOf: n, toolbar: a }) {
845
+ let o = V("subpages"), s = u(e), c = B(), d = L(() => /* @__PURE__ */ new Date(), []), f = t.flatMap((e) => {
833
846
  let t = n(e), i = t ? r(t) : void 0;
834
847
  return i ? [{
835
848
  doc: e,
836
849
  date: i
837
850
  }] : [];
838
- }).sort((e, t) => e.date.getTime() - t.date.getTime()), d = u[0]?.date ?? c, f = q(new Date(Math.min(d.getTime(), c.getTime())), -3), p = u[u.length - 1]?.date ?? c, h = q(new Date(Math.max(p.getTime(), c.getTime())), 4), g = Math.max(28, Math.round((h.getTime() - f.getTime()) / 864e5) + 1), _ = Array.from({ length: g }, (e, t) => q(f, t)), v = (e) => Math.round((e.getTime() - f.getTime()) / 864e5), y = i(c);
839
- return /* @__PURE__ */ U("div", {
851
+ }).sort((e, t) => e.date.getTime() - t.date.getTime()), p = f[0]?.date ?? d, m = J(new Date(Math.min(p.getTime(), d.getTime())), -3), g = f[f.length - 1]?.date ?? d, _ = J(new Date(Math.max(g.getTime(), d.getTime())), 4), v = Math.max(28, Math.round((_.getTime() - m.getTime()) / 864e5) + 1), y = Array.from({ length: v }, (e, t) => J(m, t)), b = (e) => Math.round((e.getTime() - m.getTime()) / 864e5), ee = i(d);
852
+ return /* @__PURE__ */ W("div", {
840
853
  className: "flex flex-col",
841
- children: [/* @__PURE__ */ H("div", {
854
+ children: [/* @__PURE__ */ U("div", {
842
855
  className: "flex flex-wrap items-center gap-1 py-2",
843
856
  children: a
844
- }), /* @__PURE__ */ H("div", {
857
+ }), /* @__PURE__ */ U("div", {
845
858
  className: "overflow-x-auto rounded-md border border-border",
846
- children: /* @__PURE__ */ U("div", {
847
- style: { width: g * $ },
859
+ children: /* @__PURE__ */ W("div", {
860
+ style: { width: v * $ },
848
861
  className: "relative",
849
- children: [/* @__PURE__ */ H("div", {
862
+ children: [/* @__PURE__ */ U("div", {
850
863
  className: "flex border-b border-border text-xs text-muted-foreground",
851
- children: _.map((e) => /* @__PURE__ */ H("span", {
864
+ children: y.map((e) => /* @__PURE__ */ U("span", {
852
865
  style: { width: $ },
853
- className: P("shrink-0 py-1.5 text-center tabular-nums", (e.getDay() === 0 || e.getDay() === 6) && "bg-muted/40", i(e) === y && "font-semibold text-primary"),
854
- title: s.dateTime(e, { dateStyle: "full" }),
855
- children: e.getDate() === 1 || i(e) === i(f) ? s.dateTime(e, {
866
+ className: F("shrink-0 py-1.5 text-center tabular-nums", (e.getDay() === 0 || e.getDay() === 6) && "bg-muted/40", i(e) === ee && "font-semibold text-primary"),
867
+ title: c.dateTime(e, { dateStyle: "full" }),
868
+ children: e.getDate() === 1 || i(e) === i(m) ? c.dateTime(e, {
856
869
  month: "short",
857
870
  day: "numeric"
858
871
  }) : e.getDate()
859
872
  }, i(e)))
860
- }), u.length === 0 ? /* @__PURE__ */ H("p", {
873
+ }), f.length === 0 ? /* @__PURE__ */ U("p", {
861
874
  className: "sticky left-0 px-3 py-4 text-sm text-muted-foreground",
862
875
  children: o("none")
863
- }) : /* @__PURE__ */ U("ol", {
876
+ }) : /* @__PURE__ */ W("ol", {
864
877
  className: "relative py-1",
865
878
  "aria-label": o("timelineView"),
866
- children: [/* @__PURE__ */ H("span", {
879
+ children: [/* @__PURE__ */ U("span", {
867
880
  "aria-hidden": !0,
868
881
  className: "absolute inset-y-0 w-px bg-primary/50",
869
- style: { left: v(c) * $ + $ / 2 }
870
- }), u.map(({ doc: t, date: n }) => /* @__PURE__ */ H("li", {
882
+ style: { left: b(d) * $ + $ / 2 }
883
+ }), f.map(({ doc: t, date: n }) => /* @__PURE__ */ U("li", {
871
884
  className: "relative h-9",
872
- children: /* @__PURE__ */ U(F, {
885
+ ...s(t),
886
+ children: /* @__PURE__ */ W(I, {
873
887
  to: "/$workspace/docs/$doc",
874
888
  params: {
875
889
  workspace: e,
876
890
  doc: l(t)
877
891
  },
878
- "aria-label": `${t.title}, ${s.dateTime(n, { dateStyle: "medium" })}`,
879
- style: { left: v(n) * $ + 2 },
892
+ "aria-label": `${t.title}, ${c.dateTime(n, { dateStyle: "medium" })}`,
893
+ style: { left: b(n) * $ + 2 },
880
894
  className: "absolute top-1.5 flex h-6 max-w-72 items-center gap-1 rounded bg-card px-1.5 text-xs shadow-xs ring-1 ring-border hover:bg-accent",
881
- children: [/* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
895
+ children: [/* @__PURE__ */ U(h, { icon: t.icon }), /* @__PURE__ */ U("span", {
882
896
  className: "truncate",
883
897
  children: t.title
884
898
  })]
@@ -889,4 +903,4 @@ function xe({ workspace: e, docs: t, dateOf: n, toolbar: a }) {
889
903
  })]
890
904
  });
891
905
  }
892
- export { J as SubpageViews, G as subpageLayouts };
906
+ export { Y as SubpageViews, K as subpageLayouts };