@parallelworks/tandem-web 0.191.1 → 0.192.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/_virtual/_virtual_i18n/en/common.js +18 -4
- package/_virtual/_virtual_i18n/es/common.js +18 -4
- package/_virtual/_virtual_i18n/ja/common.js +18 -4
- package/_virtual/_virtual_i18n/ko/common.js +18 -4
- package/_virtual/_virtual_i18n/zh/common.js +18 -4
- package/api/queries.js +13 -5
- package/components/DocProperties.js +1 -1
- package/components/Editor.js +101 -99
- package/components/HoverCards.js +121 -121
- package/components/NewPageModal.js +374 -0
- package/components/SubpageViews.js +273 -277
- package/components/docLink.js +18 -0
- package/lib/base.js +10 -1
- package/lib/calendarMonth.js +6 -0
- package/lib/listSearch.js +13 -10
- package/package.json +2 -1
- package/pages/issues.js +466 -414
- package/routes/_workspace/docs/_doc2.js +2 -2
- package/routes/_workspace2.js +357 -383
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { docTemplatesQuery as e, docsQuery as t } from "../api/queries.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
2
|
+
import { calendarMonth as n } from "../lib/calendarMonth.js";
|
|
3
|
+
import { fromIsoDate as r, isoDate as i } from "../lib/datePhrases.js";
|
|
4
|
+
import { docPropertiesQuery as a, useDocPropertyActions as o } from "../lib/docProperties.js";
|
|
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";
|
|
17
19
|
import { useErrorMessage as R } from "@parallelworks/problem/react";
|
|
18
|
-
import { useFormatter as z, useLocale as
|
|
20
|
+
import { useFormatter as z, useLocale as oe, useTranslations as B } from "use-intl";
|
|
19
21
|
import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
20
|
-
import { keepPreviousData as
|
|
21
|
-
import { useVirtualizer as
|
|
22
|
+
import { keepPreviousData as se, useQuery as W } from "@tanstack/react-query";
|
|
23
|
+
import { useVirtualizer as ce } from "@tanstack/react-virtual";
|
|
22
24
|
// src/components/SubpageViews.tsx
|
|
23
25
|
var G = [
|
|
24
26
|
{
|
|
@@ -63,19 +65,19 @@ var G = [
|
|
|
63
65
|
message: "feed",
|
|
64
66
|
database: !1
|
|
65
67
|
}
|
|
66
|
-
],
|
|
67
|
-
function
|
|
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);
|
|
69
|
+
function ue(e) {
|
|
68
70
|
let t = new Intl.Locale(e);
|
|
69
71
|
return (t.getWeekInfo?.().firstDay ?? t.weekInfo?.firstDay ?? 7) % 7;
|
|
70
72
|
}
|
|
71
73
|
function J({ workspace: e, doc: t, space: n }) {
|
|
72
|
-
let r = B("subpages"), { data: i = [] } = W(
|
|
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
75
|
if (i.length === 0) return null;
|
|
74
|
-
let
|
|
76
|
+
let l = i.find((e) => e.id === a) ?? i[0], m = (e) => c.addView.mutate({
|
|
75
77
|
doc: t.key,
|
|
76
|
-
name: r(
|
|
78
|
+
name: r(le(e).message),
|
|
77
79
|
layout: e,
|
|
78
|
-
config: { ...
|
|
80
|
+
config: { ...d(l.config) }
|
|
79
81
|
}, { onSuccess: (e) => o(e.id) });
|
|
80
82
|
return /* @__PURE__ */ U("section", {
|
|
81
83
|
className: "not-prose my-4",
|
|
@@ -83,26 +85,26 @@ function J({ workspace: e, doc: t, space: n }) {
|
|
|
83
85
|
children: [/* @__PURE__ */ U("div", {
|
|
84
86
|
className: "flex items-center gap-1 border-b border-border",
|
|
85
87
|
children: [i.map((e) => {
|
|
86
|
-
let t =
|
|
88
|
+
let t = le(e.layout).icon;
|
|
87
89
|
return /* @__PURE__ */ U("button", {
|
|
88
90
|
type: "button",
|
|
89
91
|
onClick: () => o(e.id),
|
|
90
|
-
"aria-pressed": e.id ===
|
|
91
|
-
className: P("-mb-px flex items-center gap-1.5 border-b-2 px-2 py-1.5 text-sm", e.id ===
|
|
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"),
|
|
92
94
|
children: [/* @__PURE__ */ H(t, { className: "size-4" }), e.name]
|
|
93
95
|
}, e.id);
|
|
94
96
|
}), s && /* @__PURE__ */ H(M, {
|
|
95
|
-
trigger: /* @__PURE__ */ H(
|
|
97
|
+
trigger: /* @__PURE__ */ H(A, {
|
|
96
98
|
size: "xs",
|
|
97
99
|
variant: "ghost",
|
|
98
100
|
"aria-label": r("addView"),
|
|
99
|
-
children: /* @__PURE__ */ H(
|
|
101
|
+
children: /* @__PURE__ */ H(ee, {})
|
|
100
102
|
}),
|
|
101
103
|
align: "start",
|
|
102
104
|
"aria-label": r("addView"),
|
|
103
105
|
children: /* @__PURE__ */ H("div", {
|
|
104
106
|
className: "flex flex-col gap-1",
|
|
105
|
-
children: G.map(({ layout: e, icon: t, message: n }) => /* @__PURE__ */ U(
|
|
107
|
+
children: G.map(({ layout: e, icon: t, message: n }) => /* @__PURE__ */ U(A, {
|
|
106
108
|
size: "sm",
|
|
107
109
|
variant: "ghost",
|
|
108
110
|
className: "justify-start",
|
|
@@ -111,171 +113,172 @@ function J({ workspace: e, doc: t, space: n }) {
|
|
|
111
113
|
}, e))
|
|
112
114
|
})
|
|
113
115
|
})]
|
|
114
|
-
}), /* @__PURE__ */ H(
|
|
116
|
+
}), /* @__PURE__ */ H(de, {
|
|
115
117
|
workspace: e,
|
|
116
118
|
doc: t,
|
|
117
119
|
space: n,
|
|
118
|
-
view:
|
|
120
|
+
view: l,
|
|
119
121
|
canWrite: s
|
|
120
|
-
},
|
|
122
|
+
}, l.id)]
|
|
121
123
|
});
|
|
122
124
|
}
|
|
123
|
-
function
|
|
124
|
-
let
|
|
125
|
-
let t =
|
|
126
|
-
return typeof t == "string" &&
|
|
127
|
-
},
|
|
128
|
-
parent:
|
|
129
|
-
title: t ?
|
|
130
|
-
title:
|
|
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) => {
|
|
127
|
+
let t = S && e.properties?.[S.id];
|
|
128
|
+
return typeof t == "string" && r(t) ? t : void 0;
|
|
129
|
+
}, k = D.filter((e) => !O(e)), N = (t, r) => T.newSubpage.mutate({
|
|
130
|
+
parent: n,
|
|
131
|
+
title: t ? u("titleOn", {
|
|
132
|
+
title: n.title,
|
|
131
133
|
date: t
|
|
132
|
-
}) :
|
|
133
|
-
template:
|
|
134
|
-
dateProperty:
|
|
134
|
+
}) : u("untitled"),
|
|
135
|
+
template: r === void 0 ? y.template : r ?? void 0,
|
|
136
|
+
dateProperty: S?.id,
|
|
135
137
|
date: t
|
|
136
|
-
}, { onSuccess: (t) =>
|
|
138
|
+
}, { onSuccess: (t) => h({
|
|
137
139
|
to: "/$workspace/docs/$doc",
|
|
138
140
|
params: {
|
|
139
141
|
workspace: e,
|
|
140
|
-
doc:
|
|
142
|
+
doc: l(t)
|
|
141
143
|
}
|
|
142
|
-
}) }),
|
|
143
|
-
|
|
144
|
-
trigger: /* @__PURE__ */ H(
|
|
144
|
+
}) }), P = /* @__PURE__ */ U(V, { children: [
|
|
145
|
+
S && K(s.layout) && /* @__PURE__ */ H(M, {
|
|
146
|
+
trigger: /* @__PURE__ */ H(A, {
|
|
145
147
|
size: "xs",
|
|
146
148
|
variant: "ghost",
|
|
147
|
-
children:
|
|
149
|
+
children: u("noDate", { count: k.length })
|
|
148
150
|
}),
|
|
149
151
|
align: "start",
|
|
150
152
|
className: "max-h-80 w-72 overflow-y-auto",
|
|
151
|
-
"aria-label":
|
|
152
|
-
children:
|
|
153
|
+
"aria-label": u("noDateTitle"),
|
|
154
|
+
children: k.length === 0 ? /* @__PURE__ */ H("p", {
|
|
153
155
|
className: "text-sm text-muted-foreground",
|
|
154
|
-
children:
|
|
156
|
+
children: u("allDated")
|
|
155
157
|
}) : /* @__PURE__ */ H("ul", {
|
|
156
158
|
className: "space-y-1",
|
|
157
|
-
children:
|
|
159
|
+
children: k.map((t) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
|
|
158
160
|
to: "/$workspace/docs/$doc",
|
|
159
161
|
params: {
|
|
160
162
|
workspace: e,
|
|
161
|
-
doc:
|
|
163
|
+
doc: l(t)
|
|
162
164
|
},
|
|
163
165
|
className: "flex items-center gap-1.5 truncate text-sm hover:underline",
|
|
164
|
-
children: [/* @__PURE__ */ H(
|
|
166
|
+
children: [/* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
|
|
165
167
|
className: "truncate",
|
|
166
168
|
children: t.title
|
|
167
169
|
})]
|
|
168
170
|
}) }, t.id))
|
|
169
171
|
})
|
|
170
172
|
}),
|
|
171
|
-
/* @__PURE__ */ H(
|
|
173
|
+
/* @__PURE__ */ H(ne, {
|
|
172
174
|
type: "search",
|
|
173
175
|
size: "sm",
|
|
174
|
-
value:
|
|
175
|
-
onChange: (e) =>
|
|
176
|
-
placeholder:
|
|
177
|
-
"aria-label":
|
|
176
|
+
value: te,
|
|
177
|
+
onChange: (e) => w(e.target.value),
|
|
178
|
+
placeholder: u("search"),
|
|
179
|
+
"aria-label": u("search"),
|
|
178
180
|
className: "w-40"
|
|
179
181
|
}),
|
|
180
|
-
|
|
181
|
-
/* @__PURE__ */ H(
|
|
182
|
+
c && /* @__PURE__ */ U(V, { children: [
|
|
183
|
+
/* @__PURE__ */ H(Y, {
|
|
182
184
|
workspace: e,
|
|
183
185
|
space: o,
|
|
184
186
|
view: s,
|
|
185
|
-
config:
|
|
187
|
+
config: y
|
|
186
188
|
}),
|
|
187
|
-
|
|
189
|
+
S && /* @__PURE__ */ H(g, {
|
|
188
190
|
workspace: e,
|
|
189
191
|
space: o,
|
|
190
|
-
dateProperty:
|
|
192
|
+
dateProperty: S.id,
|
|
191
193
|
parent: {
|
|
192
|
-
id:
|
|
193
|
-
key:
|
|
194
|
+
id: n.id,
|
|
195
|
+
key: n.key
|
|
194
196
|
}
|
|
195
197
|
}),
|
|
196
|
-
/* @__PURE__ */ U(
|
|
198
|
+
/* @__PURE__ */ U(A, {
|
|
197
199
|
size: "xs",
|
|
198
200
|
variant: "primary",
|
|
199
|
-
loading:
|
|
200
|
-
onClick: () =>
|
|
201
|
-
children: [/* @__PURE__ */ H(
|
|
201
|
+
loading: T.newSubpage.isPending,
|
|
202
|
+
onClick: () => N(S ? i(/* @__PURE__ */ new Date()) : void 0),
|
|
203
|
+
children: [/* @__PURE__ */ H(ee, {}), u("new")]
|
|
202
204
|
})
|
|
203
205
|
] })
|
|
204
206
|
] });
|
|
205
207
|
return /* @__PURE__ */ U("div", {
|
|
206
208
|
className: "pt-2",
|
|
207
|
-
children: [
|
|
209
|
+
children: [T.newSubpage.error && /* @__PURE__ */ H(j, { children: f(T.newSubpage.error) }), s.layout === "feed" ? /* @__PURE__ */ H(ge, {
|
|
208
210
|
workspace: e,
|
|
209
|
-
docs:
|
|
210
|
-
dateOf:
|
|
211
|
-
toolbar:
|
|
212
|
-
}) : s.layout === "table" ? /* @__PURE__ */ H(
|
|
211
|
+
docs: D,
|
|
212
|
+
dateOf: O,
|
|
213
|
+
toolbar: P
|
|
214
|
+
}) : s.layout === "table" ? /* @__PURE__ */ H(ve, {
|
|
213
215
|
workspace: e,
|
|
214
|
-
docs:
|
|
215
|
-
props:
|
|
216
|
-
toolbar:
|
|
217
|
-
}) : s.layout === "list" ? /* @__PURE__ */ H(
|
|
216
|
+
docs: D,
|
|
217
|
+
props: x,
|
|
218
|
+
toolbar: P
|
|
219
|
+
}) : s.layout === "list" ? /* @__PURE__ */ H(ye, {
|
|
218
220
|
workspace: e,
|
|
219
|
-
docs:
|
|
220
|
-
toolbar:
|
|
221
|
-
}) : s.layout === "gallery" ? /* @__PURE__ */ H(
|
|
221
|
+
docs: D,
|
|
222
|
+
toolbar: P
|
|
223
|
+
}) : s.layout === "gallery" ? /* @__PURE__ */ H(be, {
|
|
222
224
|
workspace: e,
|
|
223
|
-
docs:
|
|
224
|
-
toolbar:
|
|
225
|
-
}) : s.layout === "board" ?
|
|
225
|
+
docs: D,
|
|
226
|
+
toolbar: P
|
|
227
|
+
}) : s.layout === "board" ? C ? /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
|
|
226
228
|
className: "flex flex-wrap items-center gap-1 py-2",
|
|
227
|
-
children:
|
|
228
|
-
}), /* @__PURE__ */ H(
|
|
229
|
+
children: P
|
|
230
|
+
}), /* @__PURE__ */ H(_, {
|
|
229
231
|
workspace: e,
|
|
230
232
|
space: o,
|
|
231
|
-
docs:
|
|
232
|
-
props:
|
|
233
|
-
by:
|
|
233
|
+
docs: D,
|
|
234
|
+
props: x,
|
|
235
|
+
by: C
|
|
234
236
|
})] }) : /* @__PURE__ */ U("div", {
|
|
235
237
|
className: "flex flex-wrap items-center gap-2 py-3 text-sm text-muted-foreground",
|
|
236
|
-
children: [
|
|
238
|
+
children: [u("pickGroup"), c && /* @__PURE__ */ H(Y, {
|
|
237
239
|
workspace: e,
|
|
238
240
|
space: o,
|
|
239
241
|
view: s,
|
|
240
|
-
config:
|
|
242
|
+
config: y,
|
|
241
243
|
open: !0
|
|
242
244
|
})]
|
|
243
|
-
}) :
|
|
245
|
+
}) : S ? s.layout === "timeline" ? /* @__PURE__ */ H(xe, {
|
|
244
246
|
workspace: e,
|
|
245
|
-
docs:
|
|
246
|
-
dateOf:
|
|
247
|
-
toolbar:
|
|
248
|
-
}) : /* @__PURE__ */ H(
|
|
247
|
+
docs: D,
|
|
248
|
+
dateOf: O,
|
|
249
|
+
toolbar: P
|
|
250
|
+
}) : /* @__PURE__ */ H(he, {
|
|
249
251
|
workspace: e,
|
|
250
|
-
docs:
|
|
251
|
-
dateOf:
|
|
252
|
-
toolbar:
|
|
253
|
-
parent:
|
|
252
|
+
docs: D,
|
|
253
|
+
dateOf: O,
|
|
254
|
+
toolbar: P,
|
|
255
|
+
parent: n,
|
|
254
256
|
space: o,
|
|
255
|
-
viewTemplate:
|
|
256
|
-
|
|
257
|
+
viewTemplate: y.template,
|
|
258
|
+
dateProperty: S?.id,
|
|
259
|
+
canWrite: c
|
|
257
260
|
}) : /* @__PURE__ */ U("div", {
|
|
258
261
|
className: "flex flex-wrap items-center gap-2 py-3 text-sm text-muted-foreground",
|
|
259
|
-
children: [s.layout === "timeline" ?
|
|
262
|
+
children: [s.layout === "timeline" ? u("pickTimelineDate") : u("pickDate"), c && /* @__PURE__ */ H(Y, {
|
|
260
263
|
workspace: e,
|
|
261
264
|
space: o,
|
|
262
265
|
view: s,
|
|
263
|
-
config:
|
|
266
|
+
config: y,
|
|
264
267
|
open: !0
|
|
265
268
|
})]
|
|
266
269
|
})]
|
|
267
270
|
});
|
|
268
271
|
}
|
|
269
|
-
function
|
|
270
|
-
let c = B("subpages"), l = R(), u =
|
|
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({
|
|
271
274
|
view: r,
|
|
272
275
|
config: { ...e }
|
|
273
276
|
}), y = "block text-xs font-medium text-muted-foreground";
|
|
274
277
|
return /* @__PURE__ */ H(M, {
|
|
275
|
-
trigger: s ? /* @__PURE__ */ H(
|
|
278
|
+
trigger: s ? /* @__PURE__ */ H(A, {
|
|
276
279
|
size: "xs",
|
|
277
280
|
children: c("settings")
|
|
278
|
-
}) : /* @__PURE__ */ H(
|
|
281
|
+
}) : /* @__PURE__ */ H(A, {
|
|
279
282
|
size: "xs",
|
|
280
283
|
variant: "ghost",
|
|
281
284
|
"aria-label": c("settings"),
|
|
@@ -292,7 +295,7 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
292
295
|
children: [c("groupBy"), /* @__PURE__ */ U("div", {
|
|
293
296
|
className: "mt-1 flex items-center gap-2",
|
|
294
297
|
children: [g.length > 0 && /* @__PURE__ */ H(N, {
|
|
295
|
-
value:
|
|
298
|
+
value: i.groupBy ?? "",
|
|
296
299
|
items: [{
|
|
297
300
|
value: "",
|
|
298
301
|
label: c("noGroup")
|
|
@@ -300,13 +303,13 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
300
303
|
value: e.id,
|
|
301
304
|
label: e.name
|
|
302
305
|
}))],
|
|
303
|
-
onValueChange: (e) =>
|
|
304
|
-
...
|
|
306
|
+
onValueChange: (e) => _({
|
|
307
|
+
...i,
|
|
305
308
|
groupBy: e || void 0
|
|
306
309
|
}),
|
|
307
310
|
"aria-label": c("groupBy"),
|
|
308
311
|
size: "sm"
|
|
309
|
-
}), /* @__PURE__ */ H(
|
|
312
|
+
}), /* @__PURE__ */ H(A, {
|
|
310
313
|
size: "xs",
|
|
311
314
|
loading: d.create.isPending,
|
|
312
315
|
onClick: async () => {
|
|
@@ -320,8 +323,8 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
320
323
|
{ name: c("statusDone") }
|
|
321
324
|
]
|
|
322
325
|
});
|
|
323
|
-
|
|
324
|
-
...
|
|
326
|
+
_({
|
|
327
|
+
...i,
|
|
325
328
|
groupBy: e.id
|
|
326
329
|
});
|
|
327
330
|
},
|
|
@@ -329,12 +332,12 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
329
332
|
})]
|
|
330
333
|
})]
|
|
331
334
|
}),
|
|
332
|
-
(
|
|
335
|
+
(K(r.layout) || r.layout === "feed") && /* @__PURE__ */ U("div", {
|
|
333
336
|
className: y,
|
|
334
337
|
children: [c("dateProperty"), /* @__PURE__ */ U("div", {
|
|
335
338
|
className: "mt-1 flex items-center gap-2",
|
|
336
339
|
children: [h.length > 0 && /* @__PURE__ */ H(N, {
|
|
337
|
-
value:
|
|
340
|
+
value: i.dateProperty ?? "",
|
|
338
341
|
items: [{
|
|
339
342
|
value: "",
|
|
340
343
|
label: c("noDateProperty")
|
|
@@ -342,13 +345,13 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
342
345
|
value: e.id,
|
|
343
346
|
label: e.name
|
|
344
347
|
}))],
|
|
345
|
-
onValueChange: (e) =>
|
|
346
|
-
...
|
|
348
|
+
onValueChange: (e) => _({
|
|
349
|
+
...i,
|
|
347
350
|
dateProperty: e || void 0
|
|
348
351
|
}),
|
|
349
352
|
"aria-label": c("dateProperty"),
|
|
350
353
|
size: "sm"
|
|
351
|
-
}), /* @__PURE__ */ H(
|
|
354
|
+
}), /* @__PURE__ */ H(A, {
|
|
352
355
|
size: "xs",
|
|
353
356
|
loading: d.create.isPending,
|
|
354
357
|
onClick: async () => {
|
|
@@ -357,8 +360,8 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
357
360
|
name: c("dateName"),
|
|
358
361
|
kind: "date"
|
|
359
362
|
});
|
|
360
|
-
|
|
361
|
-
...
|
|
363
|
+
_({
|
|
364
|
+
...i,
|
|
362
365
|
dateProperty: e.id
|
|
363
366
|
});
|
|
364
367
|
},
|
|
@@ -371,7 +374,7 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
371
374
|
children: [c("template"), /* @__PURE__ */ H("div", {
|
|
372
375
|
className: "mt-1",
|
|
373
376
|
children: /* @__PURE__ */ H(N, {
|
|
374
|
-
value:
|
|
377
|
+
value: i.template ?? "",
|
|
375
378
|
items: [{
|
|
376
379
|
value: "",
|
|
377
380
|
label: c("noTemplate")
|
|
@@ -379,8 +382,8 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
379
382
|
value: e.id,
|
|
380
383
|
label: e.title
|
|
381
384
|
}))],
|
|
382
|
-
onValueChange: (e) =>
|
|
383
|
-
...
|
|
385
|
+
onValueChange: (e) => _({
|
|
386
|
+
...i,
|
|
384
387
|
template: e || void 0
|
|
385
388
|
}),
|
|
386
389
|
"aria-label": c("template"),
|
|
@@ -388,8 +391,8 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
388
391
|
})
|
|
389
392
|
})]
|
|
390
393
|
}),
|
|
391
|
-
(u.updateView.error ?? d.create.error) && /* @__PURE__ */ H(
|
|
392
|
-
/* @__PURE__ */ H(
|
|
394
|
+
(u.updateView.error ?? d.create.error) && /* @__PURE__ */ H(j, { children: l(u.updateView.error ?? d.create.error) }),
|
|
395
|
+
/* @__PURE__ */ H(A, {
|
|
393
396
|
size: "xs",
|
|
394
397
|
variant: "danger",
|
|
395
398
|
onClick: () => u.removeView.mutate(r),
|
|
@@ -399,137 +402,130 @@ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
|
|
|
399
402
|
})
|
|
400
403
|
});
|
|
401
404
|
}
|
|
402
|
-
var X = 128,
|
|
403
|
-
function
|
|
404
|
-
let
|
|
405
|
-
let e =
|
|
406
|
-
for (let
|
|
407
|
-
let
|
|
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;
|
|
409
|
+
for (let n of t) {
|
|
410
|
+
let t = a(n), i = t && r(t);
|
|
408
411
|
i && i < e && (e = i);
|
|
409
412
|
}
|
|
410
|
-
return Math.floor(me(
|
|
413
|
+
return Math.floor(me(S, new Date(e.getFullYear(), e.getMonth(), 1)) / 7);
|
|
411
414
|
}, [
|
|
412
|
-
|
|
415
|
+
t,
|
|
413
416
|
a,
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
]), [
|
|
417
|
-
from: Math.max(
|
|
418
|
-
to:
|
|
419
|
-
})),
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}, J = se({
|
|
423
|
-
count: D.to - A + 1,
|
|
424
|
-
getScrollElement: () => R.current,
|
|
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
425
|
estimateSize: () => X,
|
|
426
|
-
getItemKey: (e) =>
|
|
426
|
+
getItemKey: (e) => O + e,
|
|
427
427
|
overscan: 3,
|
|
428
428
|
scrollMargin: Z,
|
|
429
|
-
initialOffset: (-
|
|
429
|
+
initialOffset: (-O - +(n(q(S, -7)).getMonth() === b.getMonth())) * X,
|
|
430
430
|
onChange: (e) => {
|
|
431
|
-
if (
|
|
432
|
-
let t =
|
|
433
|
-
|
|
431
|
+
if (R.current) return;
|
|
432
|
+
let t = le(e.scrollOffset ?? 0);
|
|
433
|
+
G((e) => e.getTime() === t.getTime() ? e : t);
|
|
434
434
|
let n = e.range;
|
|
435
435
|
if (n) {
|
|
436
|
-
if (n.startIndex < pe &&
|
|
437
|
-
let e = Math.max(
|
|
438
|
-
|
|
436
|
+
if (n.startIndex < pe && O > T) {
|
|
437
|
+
let e = Math.max(T, O - Q);
|
|
438
|
+
R.current = { above: O - e }, D((t) => ({
|
|
439
439
|
...t,
|
|
440
440
|
from: e
|
|
441
441
|
}));
|
|
442
|
-
} else n.endIndex >
|
|
442
|
+
} else n.endIndex > E.to - O - pe && D((e) => ({
|
|
443
443
|
...e,
|
|
444
|
-
to: e.to +
|
|
444
|
+
to: e.to + Q
|
|
445
445
|
}));
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
});
|
|
449
|
-
|
|
450
|
-
let e =
|
|
451
|
-
e && (
|
|
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" }));
|
|
452
452
|
});
|
|
453
|
-
let
|
|
454
|
-
let t = Math.max(
|
|
455
|
-
|
|
456
|
-
from: Math.min(e.from, Math.max(
|
|
457
|
-
to: Math.max(e.to, t +
|
|
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)
|
|
458
458
|
})));
|
|
459
|
-
},
|
|
460
|
-
...
|
|
461
|
-
placeholderData:
|
|
462
|
-
}),
|
|
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)),
|
|
461
|
+
placeholderData: se
|
|
462
|
+
}), be = c(e), [$, xe] = L(), Se = I(() => {
|
|
463
463
|
let e = /* @__PURE__ */ new Map();
|
|
464
|
-
for (let
|
|
465
|
-
let
|
|
466
|
-
|
|
464
|
+
for (let n of t) {
|
|
465
|
+
let t = a(n);
|
|
466
|
+
t && e.set(t, [...e.get(t) ?? [], n]);
|
|
467
467
|
}
|
|
468
468
|
return e;
|
|
469
|
-
}, [
|
|
469
|
+
}, [t, a]), Ce = I(() => {
|
|
470
470
|
let e = /* @__PURE__ */ new Map();
|
|
471
|
-
for (let t of
|
|
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]);
|
|
472
472
|
return e;
|
|
473
|
-
}, [
|
|
473
|
+
}, [ye, u.id]), we = i(b), Te = (t) => /* @__PURE__ */ U(F, {
|
|
474
474
|
to: "/$workspace/docs/$doc",
|
|
475
475
|
params: {
|
|
476
|
-
workspace:
|
|
477
|
-
doc:
|
|
476
|
+
workspace: e,
|
|
477
|
+
doc: l(t)
|
|
478
478
|
},
|
|
479
479
|
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(
|
|
480
|
+
children: [/* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
|
|
481
481
|
className: "truncate",
|
|
482
|
-
children:
|
|
482
|
+
children: t.title
|
|
483
483
|
})]
|
|
484
|
-
},
|
|
484
|
+
}, t.id), Ee = (t, n) => /* @__PURE__ */ U("button", {
|
|
485
485
|
type: "button",
|
|
486
|
-
disabled: !
|
|
487
|
-
onClick: () =>
|
|
488
|
-
id:
|
|
486
|
+
disabled: !h || be.makeDoc.isPending,
|
|
487
|
+
onClick: () => be.makeDoc.mutate({
|
|
488
|
+
id: t.id,
|
|
489
489
|
day: n
|
|
490
|
-
}, { onSuccess: (
|
|
490
|
+
}, { onSuccess: (t) => y({
|
|
491
491
|
to: "/$workspace/docs/$doc",
|
|
492
492
|
params: {
|
|
493
|
-
workspace:
|
|
494
|
-
doc:
|
|
493
|
+
workspace: e,
|
|
494
|
+
doc: l(t)
|
|
495
495
|
}
|
|
496
496
|
}) }),
|
|
497
|
-
"aria-label":
|
|
497
|
+
"aria-label": g("makeSeriesDoc", { series: t.title }),
|
|
498
498
|
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(
|
|
499
|
+
children: [/* @__PURE__ */ H(te, { className: "size-3 shrink-0" }), /* @__PURE__ */ H("span", {
|
|
500
500
|
className: "truncate",
|
|
501
|
-
children:
|
|
501
|
+
children: t.title
|
|
502
502
|
})]
|
|
503
|
-
}, `${
|
|
503
|
+
}, `${t.id}-${n}`), De = (e, t = !1) => h && /* @__PURE__ */ H("button", {
|
|
504
504
|
type: "button",
|
|
505
|
-
onClick: (
|
|
506
|
-
|
|
507
|
-
label: h("fromTemplateDefault", { template: t.title }),
|
|
508
|
-
onClick: () => m(e, t.id)
|
|
509
|
-
})),
|
|
510
|
-
{
|
|
511
|
-
label: h("emptyPage"),
|
|
512
|
-
onClick: () => m(e, null)
|
|
513
|
-
},
|
|
514
|
-
...we.filter((e) => e.id !== f).map((t) => ({
|
|
515
|
-
label: t.title,
|
|
516
|
-
onClick: () => m(e, t.id)
|
|
517
|
-
}))
|
|
518
|
-
]),
|
|
519
|
-
"aria-label": h("newOn", { date: g.dateTime(n(e), { dateStyle: "medium" }) }),
|
|
505
|
+
onClick: () => xe(e),
|
|
506
|
+
"aria-label": g("newOn", { date: _.dateTime(r(e), { dateStyle: "medium" }) }),
|
|
520
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"),
|
|
521
|
-
children: /* @__PURE__ */ H(
|
|
522
|
-
}),
|
|
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);
|
|
523
510
|
return /* @__PURE__ */ U("div", {
|
|
524
511
|
className: "flex flex-col",
|
|
525
512
|
children: [
|
|
513
|
+
$ && /* @__PURE__ */ H(k, {
|
|
514
|
+
workspace: e,
|
|
515
|
+
parent: u,
|
|
516
|
+
space: d,
|
|
517
|
+
day: $,
|
|
518
|
+
dateProperty: p,
|
|
519
|
+
viewTemplate: f,
|
|
520
|
+
onClose: () => xe(void 0)
|
|
521
|
+
}),
|
|
526
522
|
/* @__PURE__ */ U("div", {
|
|
527
523
|
className: "flex flex-wrap items-center gap-2 py-2",
|
|
528
524
|
children: [
|
|
529
525
|
/* @__PURE__ */ U("h3", {
|
|
530
526
|
className: "grid text-base font-semibold tabular-nums",
|
|
531
527
|
"aria-live": "polite",
|
|
532
|
-
children: [Array.from({ length: 12 }, (e, t) =>
|
|
528
|
+
children: [Array.from({ length: 12 }, (e, t) => _.dateTime(new Date(V.getFullYear(), t, 1), {
|
|
533
529
|
month: "long",
|
|
534
530
|
year: "numeric"
|
|
535
531
|
})).map((e) => /* @__PURE__ */ H("span", {
|
|
@@ -538,7 +534,7 @@ function Q({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
|
|
|
538
534
|
children: e
|
|
539
535
|
}, e)), /* @__PURE__ */ H("span", {
|
|
540
536
|
className: "col-start-1 row-start-1",
|
|
541
|
-
children:
|
|
537
|
+
children: _.dateTime(V, {
|
|
542
538
|
month: "long",
|
|
543
539
|
year: "numeric"
|
|
544
540
|
})
|
|
@@ -546,30 +542,30 @@ function Q({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
|
|
|
546
542
|
}),
|
|
547
543
|
/* @__PURE__ */ H("span", {
|
|
548
544
|
className: "flex flex-wrap items-center gap-1",
|
|
549
|
-
children:
|
|
545
|
+
children: o
|
|
550
546
|
}),
|
|
551
547
|
/* @__PURE__ */ U("span", {
|
|
552
548
|
className: "ml-auto flex items-center gap-1",
|
|
553
549
|
children: [
|
|
554
|
-
/* @__PURE__ */ H(
|
|
550
|
+
/* @__PURE__ */ H(A, {
|
|
555
551
|
size: "xs",
|
|
556
552
|
variant: "ghost",
|
|
557
|
-
onClick: () =>
|
|
558
|
-
disabled:
|
|
559
|
-
"aria-label":
|
|
553
|
+
onClick: () => J(new Date(V.getFullYear(), V.getMonth() - 1, 1)),
|
|
554
|
+
disabled: de,
|
|
555
|
+
"aria-label": g("previousMonth"),
|
|
560
556
|
children: /* @__PURE__ */ H(C, { className: "rotate-180" })
|
|
561
557
|
}),
|
|
562
|
-
/* @__PURE__ */ H(
|
|
558
|
+
/* @__PURE__ */ H(A, {
|
|
563
559
|
size: "xs",
|
|
564
560
|
variant: "ghost",
|
|
565
|
-
onClick: () =>
|
|
566
|
-
children:
|
|
561
|
+
onClick: () => J(new Date(b.getFullYear(), b.getMonth(), 1)),
|
|
562
|
+
children: g("today")
|
|
567
563
|
}),
|
|
568
|
-
/* @__PURE__ */ H(
|
|
564
|
+
/* @__PURE__ */ H(A, {
|
|
569
565
|
size: "xs",
|
|
570
566
|
variant: "ghost",
|
|
571
|
-
onClick: () =>
|
|
572
|
-
"aria-label":
|
|
567
|
+
onClick: () => J(new Date(V.getFullYear(), V.getMonth() + 1, 1)),
|
|
568
|
+
"aria-label": g("nextMonth"),
|
|
573
569
|
children: /* @__PURE__ */ H(C, {})
|
|
574
570
|
})
|
|
575
571
|
]
|
|
@@ -577,20 +573,20 @@ function Q({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
|
|
|
577
573
|
]
|
|
578
574
|
}),
|
|
579
575
|
/* @__PURE__ */ U("div", {
|
|
580
|
-
ref:
|
|
576
|
+
ref: N,
|
|
581
577
|
className: "h-[min(72vh,760px)] overflow-y-auto rounded-md border border-border max-sm:hidden",
|
|
582
578
|
children: [/* @__PURE__ */ H("div", {
|
|
583
579
|
className: "sticky top-0 z-10 grid grid-cols-7 border-b border-border bg-card text-xs text-muted-foreground",
|
|
584
580
|
style: { height: Z },
|
|
585
|
-
children: Array.from({ length: 7 }, (e, t) => q(
|
|
586
|
-
className: P("flex items-center px-2",
|
|
587
|
-
children:
|
|
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" })
|
|
588
584
|
}, e.getDay()))
|
|
589
585
|
}), /* @__PURE__ */ H("ol", {
|
|
590
586
|
className: "relative",
|
|
591
|
-
style: { height:
|
|
592
|
-
"aria-label":
|
|
593
|
-
children:
|
|
587
|
+
style: { height: K.getTotalSize() - Z },
|
|
588
|
+
"aria-label": g("calendarView"),
|
|
589
|
+
children: Y.map((e) => /* @__PURE__ */ H("li", {
|
|
594
590
|
className: "absolute inset-x-0",
|
|
595
591
|
style: {
|
|
596
592
|
height: X,
|
|
@@ -599,31 +595,31 @@ function Q({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
|
|
|
599
595
|
children: /* @__PURE__ */ H("ol", {
|
|
600
596
|
className: "grid h-full grid-cols-7",
|
|
601
597
|
children: Array.from({ length: 7 }, (t, n) => q(j(e.index), n)).map((e) => {
|
|
602
|
-
let t =
|
|
598
|
+
let t = i(e), n = Ae(t), r = n.length - fe;
|
|
603
599
|
return /* @__PURE__ */ U("li", {
|
|
604
|
-
"aria-label":
|
|
605
|
-
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",
|
|
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"),
|
|
606
602
|
children: [
|
|
607
603
|
/* @__PURE__ */ U("span", {
|
|
608
604
|
className: "flex items-center justify-between",
|
|
609
|
-
children: [
|
|
610
|
-
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 ===
|
|
611
|
-
children: e.getDate() === 1 ?
|
|
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, {
|
|
612
608
|
month: "short",
|
|
613
609
|
day: "numeric"
|
|
614
610
|
}) : e.getDate()
|
|
615
611
|
})]
|
|
616
612
|
}),
|
|
617
|
-
n.slice(0,
|
|
618
|
-
|
|
613
|
+
n.slice(0, r > 0 ? 2 : fe),
|
|
614
|
+
r > 0 && /* @__PURE__ */ H(M, {
|
|
619
615
|
trigger: /* @__PURE__ */ H("button", {
|
|
620
616
|
type: "button",
|
|
621
617
|
className: "self-start rounded px-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
622
|
-
children:
|
|
618
|
+
children: g("moreOnDay", { count: r + 1 })
|
|
623
619
|
}),
|
|
624
620
|
align: "start",
|
|
625
621
|
className: "max-h-80 w-64 space-y-1 overflow-y-auto",
|
|
626
|
-
"aria-label":
|
|
622
|
+
"aria-label": _.dateTime(e, { dateStyle: "full" }),
|
|
627
623
|
children: n
|
|
628
624
|
})
|
|
629
625
|
]
|
|
@@ -635,31 +631,31 @@ function Q({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
|
|
|
635
631
|
}),
|
|
636
632
|
/* @__PURE__ */ H("ol", {
|
|
637
633
|
className: "divide-y divide-border rounded-md border border-border sm:hidden",
|
|
638
|
-
children:
|
|
639
|
-
let t =
|
|
634
|
+
children: je.map((e) => {
|
|
635
|
+
let t = i(e);
|
|
640
636
|
return /* @__PURE__ */ U("li", {
|
|
641
637
|
className: "flex flex-col gap-1 px-3 py-2",
|
|
642
638
|
children: [/* @__PURE__ */ U("span", {
|
|
643
639
|
className: "flex items-center justify-between text-xs",
|
|
644
640
|
children: [/* @__PURE__ */ H("span", {
|
|
645
|
-
className: t ===
|
|
646
|
-
children:
|
|
641
|
+
className: t === we ? "font-medium text-primary" : "text-muted-foreground",
|
|
642
|
+
children: _.dateTime(e, {
|
|
647
643
|
weekday: "long",
|
|
648
644
|
month: "short",
|
|
649
645
|
day: "numeric"
|
|
650
646
|
})
|
|
651
|
-
}),
|
|
652
|
-
}),
|
|
647
|
+
}), De(t, !0)]
|
|
648
|
+
}), Ae(t)]
|
|
653
649
|
}, t);
|
|
654
650
|
})
|
|
655
651
|
})
|
|
656
652
|
]
|
|
657
653
|
});
|
|
658
654
|
}
|
|
659
|
-
function
|
|
655
|
+
function ge({ workspace: e, docs: t, dateOf: n, toolbar: i }) {
|
|
660
656
|
let a = B("subpages"), o = z(), s = [...t].sort((e, t) => {
|
|
661
|
-
let
|
|
662
|
-
return
|
|
657
|
+
let r = n(e) ?? "", i = n(t) ?? "";
|
|
658
|
+
return r === i ? t.updatedAt < e.updatedAt ? -1 : 1 : r < i ? 1 : -1;
|
|
663
659
|
});
|
|
664
660
|
return /* @__PURE__ */ U("div", {
|
|
665
661
|
className: "flex flex-col",
|
|
@@ -672,20 +668,20 @@ function he({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
|
|
|
672
668
|
}) : /* @__PURE__ */ H("ul", {
|
|
673
669
|
className: "divide-y divide-border",
|
|
674
670
|
children: s.map((t) => {
|
|
675
|
-
let i =
|
|
671
|
+
let i = n(t);
|
|
676
672
|
return /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
|
|
677
673
|
to: "/$workspace/docs/$doc",
|
|
678
674
|
params: {
|
|
679
675
|
workspace: e,
|
|
680
|
-
doc:
|
|
676
|
+
doc: l(t)
|
|
681
677
|
},
|
|
682
678
|
className: "flex items-center gap-3 py-2 text-sm hover:bg-accent/40",
|
|
683
679
|
children: [
|
|
684
680
|
/* @__PURE__ */ H("span", {
|
|
685
681
|
className: "w-28 shrink-0 text-xs text-muted-foreground tabular-nums",
|
|
686
|
-
children: i ? o.dateTime(
|
|
682
|
+
children: i ? o.dateTime(r(i), { dateStyle: "medium" }) : a("undated")
|
|
687
683
|
}),
|
|
688
|
-
/* @__PURE__ */ H(
|
|
684
|
+
/* @__PURE__ */ H(m, { icon: t.icon }),
|
|
689
685
|
/* @__PURE__ */ H("span", {
|
|
690
686
|
className: "min-w-0 flex-1 truncate font-medium",
|
|
691
687
|
children: t.title
|
|
@@ -700,9 +696,9 @@ function he({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
|
|
|
700
696
|
})]
|
|
701
697
|
});
|
|
702
698
|
}
|
|
703
|
-
var
|
|
704
|
-
function
|
|
705
|
-
let i = B("subpages"), a = B("docViews"), o = z(), s =
|
|
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);
|
|
706
702
|
return /* @__PURE__ */ U("div", {
|
|
707
703
|
className: "flex flex-col",
|
|
708
704
|
children: [/* @__PURE__ */ H("div", {
|
|
@@ -733,10 +729,10 @@ function _e({ workspace: e, docs: t, props: n, toolbar: r }) {
|
|
|
733
729
|
to: "/$workspace/docs/$doc",
|
|
734
730
|
params: {
|
|
735
731
|
workspace: e,
|
|
736
|
-
doc:
|
|
732
|
+
doc: l(t)
|
|
737
733
|
},
|
|
738
|
-
className:
|
|
739
|
-
children: [/* @__PURE__ */ H(
|
|
734
|
+
className: _e,
|
|
735
|
+
children: [/* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
|
|
740
736
|
className: "truncate",
|
|
741
737
|
children: t.title
|
|
742
738
|
})]
|
|
@@ -751,7 +747,7 @@ function _e({ workspace: e, docs: t, props: n, toolbar: r }) {
|
|
|
751
747
|
})]
|
|
752
748
|
});
|
|
753
749
|
}
|
|
754
|
-
function
|
|
750
|
+
function ye({ workspace: e, docs: t, toolbar: n }) {
|
|
755
751
|
let r = B("subpages"), i = z();
|
|
756
752
|
return /* @__PURE__ */ U("div", {
|
|
757
753
|
className: "flex flex-col",
|
|
@@ -767,11 +763,11 @@ function ve({ workspace: e, docs: t, toolbar: n }) {
|
|
|
767
763
|
to: "/$workspace/docs/$doc",
|
|
768
764
|
params: {
|
|
769
765
|
workspace: e,
|
|
770
|
-
doc:
|
|
766
|
+
doc: l(t)
|
|
771
767
|
},
|
|
772
768
|
className: "flex items-center gap-2 py-2 text-sm hover:bg-accent/40",
|
|
773
769
|
children: [
|
|
774
|
-
/* @__PURE__ */ H(
|
|
770
|
+
/* @__PURE__ */ H(m, { icon: t.icon }),
|
|
775
771
|
/* @__PURE__ */ H("span", {
|
|
776
772
|
className: "min-w-0 flex-1 truncate font-medium",
|
|
777
773
|
children: t.title
|
|
@@ -785,7 +781,7 @@ function ve({ workspace: e, docs: t, toolbar: n }) {
|
|
|
785
781
|
})]
|
|
786
782
|
});
|
|
787
783
|
}
|
|
788
|
-
function
|
|
784
|
+
function be({ workspace: e, docs: t, toolbar: n }) {
|
|
789
785
|
let r = B("subpages");
|
|
790
786
|
return /* @__PURE__ */ U("div", {
|
|
791
787
|
className: "flex flex-col",
|
|
@@ -799,12 +795,12 @@ function ye({ workspace: e, docs: t, toolbar: n }) {
|
|
|
799
795
|
className: "grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-3",
|
|
800
796
|
"aria-label": r("galleryView"),
|
|
801
797
|
children: t.map((t) => {
|
|
802
|
-
let n =
|
|
798
|
+
let n = y(t.cover ?? "");
|
|
803
799
|
return /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
|
|
804
800
|
to: "/$workspace/docs/$doc",
|
|
805
801
|
params: {
|
|
806
802
|
workspace: e,
|
|
807
|
-
doc:
|
|
803
|
+
doc: l(t)
|
|
808
804
|
},
|
|
809
805
|
className: "flex h-full flex-col overflow-hidden rounded-lg border border-border bg-card text-sm hover:border-primary",
|
|
810
806
|
children: [/* @__PURE__ */ H("span", {
|
|
@@ -814,14 +810,14 @@ function ye({ workspace: e, docs: t, toolbar: n }) {
|
|
|
814
810
|
alt: "",
|
|
815
811
|
className: "size-full object-cover",
|
|
816
812
|
style: { objectPosition: `50% ${t.coverPosition ?? 50}%` }
|
|
817
|
-
}) : /* @__PURE__ */ H(
|
|
813
|
+
}) : /* @__PURE__ */ H(m, {
|
|
818
814
|
icon: t.icon,
|
|
819
815
|
className: "size-8",
|
|
820
816
|
emojiClassName: "text-3xl"
|
|
821
817
|
})
|
|
822
818
|
}), /* @__PURE__ */ U("span", {
|
|
823
819
|
className: "flex items-center gap-2 px-3 py-2 font-medium",
|
|
824
|
-
children: [n && /* @__PURE__ */ H(
|
|
820
|
+
children: [n && /* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
|
|
825
821
|
className: "truncate",
|
|
826
822
|
children: t.title
|
|
827
823
|
})]
|
|
@@ -832,14 +828,14 @@ function ye({ workspace: e, docs: t, toolbar: n }) {
|
|
|
832
828
|
});
|
|
833
829
|
}
|
|
834
830
|
var $ = 32;
|
|
835
|
-
function
|
|
836
|
-
let o = B("subpages"), s = z(),
|
|
837
|
-
let t =
|
|
838
|
-
return
|
|
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) => {
|
|
833
|
+
let t = n(e), i = t ? r(t) : void 0;
|
|
834
|
+
return i ? [{
|
|
839
835
|
doc: e,
|
|
840
|
-
date:
|
|
836
|
+
date: i
|
|
841
837
|
}] : [];
|
|
842
|
-
}).sort((e, t) => e.date.getTime() - t.date.getTime()), d = u[0]?.date ??
|
|
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);
|
|
843
839
|
return /* @__PURE__ */ U("div", {
|
|
844
840
|
className: "flex flex-col",
|
|
845
841
|
children: [/* @__PURE__ */ H("div", {
|
|
@@ -854,13 +850,13 @@ function be({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
|
|
|
854
850
|
className: "flex border-b border-border text-xs text-muted-foreground",
|
|
855
851
|
children: _.map((e) => /* @__PURE__ */ H("span", {
|
|
856
852
|
style: { width: $ },
|
|
857
|
-
className: P("shrink-0 py-1.5 text-center tabular-nums", (e.getDay() === 0 || e.getDay() === 6) && "bg-muted/40",
|
|
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"),
|
|
858
854
|
title: s.dateTime(e, { dateStyle: "full" }),
|
|
859
|
-
children: e.getDate() === 1 ||
|
|
855
|
+
children: e.getDate() === 1 || i(e) === i(f) ? s.dateTime(e, {
|
|
860
856
|
month: "short",
|
|
861
857
|
day: "numeric"
|
|
862
858
|
}) : e.getDate()
|
|
863
|
-
},
|
|
859
|
+
}, i(e)))
|
|
864
860
|
}), u.length === 0 ? /* @__PURE__ */ H("p", {
|
|
865
861
|
className: "sticky left-0 px-3 py-4 text-sm text-muted-foreground",
|
|
866
862
|
children: o("none")
|
|
@@ -870,19 +866,19 @@ function be({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
|
|
|
870
866
|
children: [/* @__PURE__ */ H("span", {
|
|
871
867
|
"aria-hidden": !0,
|
|
872
868
|
className: "absolute inset-y-0 w-px bg-primary/50",
|
|
873
|
-
style: { left: v(
|
|
869
|
+
style: { left: v(c) * $ + $ / 2 }
|
|
874
870
|
}), u.map(({ doc: t, date: n }) => /* @__PURE__ */ H("li", {
|
|
875
871
|
className: "relative h-9",
|
|
876
872
|
children: /* @__PURE__ */ U(F, {
|
|
877
873
|
to: "/$workspace/docs/$doc",
|
|
878
874
|
params: {
|
|
879
875
|
workspace: e,
|
|
880
|
-
doc:
|
|
876
|
+
doc: l(t)
|
|
881
877
|
},
|
|
882
878
|
"aria-label": `${t.title}, ${s.dateTime(n, { dateStyle: "medium" })}`,
|
|
883
879
|
style: { left: v(n) * $ + 2 },
|
|
884
880
|
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",
|
|
885
|
-
children: [/* @__PURE__ */ H(
|
|
881
|
+
children: [/* @__PURE__ */ H(m, { icon: t.icon }), /* @__PURE__ */ H("span", {
|
|
886
882
|
className: "truncate",
|
|
887
883
|
children: t.title
|
|
888
884
|
})]
|