@geenius/docs 0.8.10 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/package.json +32 -20
- package/packages/convex/dist/index.d.ts +4 -4
- package/packages/convex/dist/index.js.map +1 -1
- package/packages/react/dist/index.css +2 -0
- package/packages/react/dist/index.css.map +1 -0
- package/packages/react/dist/index.d.ts +67 -49
- package/packages/react/dist/index.js +267 -172
- package/packages/react/dist/index.js.map +1 -1
- package/packages/react-css/dist/index.css +30 -18
- package/packages/react-css/dist/index.css.map +1 -1
- package/packages/react-css/dist/index.d.ts +68 -33
- package/packages/react-css/dist/index.js +61 -38
- package/packages/react-css/dist/index.js.map +1 -1
- package/packages/shared/dist/{chunk-BR2XBF64.js → chunk-QKKVTCRJ.js} +2 -2
- package/packages/shared/dist/{chunk-BR2XBF64.js.map → chunk-QKKVTCRJ.js.map} +1 -1
- package/packages/shared/dist/index.d.ts +55 -10
- package/packages/shared/dist/index.js +52 -6
- package/packages/shared/dist/index.js.map +1 -1
- package/packages/shared/dist/providers.d.ts +4 -4
- package/packages/shared/dist/providers.js +1 -1
- package/packages/shared/dist/providers.js.map +1 -1
- package/packages/shared/dist/{types-n-Ryn258.d.ts → types-D8ITXVwj.d.ts} +1 -1
- package/packages/solidjs/dist/index.css +2 -0
- package/packages/solidjs/dist/index.css.map +1 -0
- package/packages/solidjs/dist/index.d.ts +57 -27
- package/packages/solidjs/dist/index.js +231 -154
- package/packages/solidjs/dist/index.js.map +1 -1
- package/packages/solidjs-css/dist/index.css +30 -18
- package/packages/solidjs-css/dist/index.css.map +1 -1
- package/packages/solidjs-css/dist/index.d.ts +55 -20
- package/packages/solidjs-css/dist/index.js +34 -25
- package/packages/solidjs-css/dist/index.js.map +1 -1
|
@@ -1,37 +1,43 @@
|
|
|
1
1
|
import React, { useState, useId, useRef, useEffect, useCallback, useMemo, Children } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
2
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
5
|
import ReactMarkdown from 'react-markdown';
|
|
4
6
|
import remarkGfm from 'remark-gfm';
|
|
5
7
|
import { AnimatePresence, motion } from '@geenius/motion/react';
|
|
6
8
|
|
|
7
9
|
// src/components/Breadcrumbs.tsx
|
|
10
|
+
function cn(...inputs) {
|
|
11
|
+
return twMerge(clsx(inputs));
|
|
12
|
+
}
|
|
8
13
|
function Breadcrumbs({
|
|
9
|
-
items
|
|
14
|
+
items,
|
|
15
|
+
className
|
|
10
16
|
}) {
|
|
11
17
|
if (items.length === 0) return null;
|
|
12
|
-
return /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-1.5 text-sm", "aria-label": "Breadcrumb", children: items.map((item, idx) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
18
|
+
return /* @__PURE__ */ jsx("nav", { className: cn("flex items-center gap-1.5 text-sm", className), "aria-label": "Breadcrumb", children: items.map((item, idx) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
13
19
|
idx > 0 && /* @__PURE__ */ jsx(
|
|
14
20
|
"svg",
|
|
15
21
|
{
|
|
16
22
|
"aria-hidden": "true",
|
|
17
|
-
className: "h-3.5 w-3.5 shrink-0 text-
|
|
23
|
+
className: "h-3.5 w-3.5 shrink-0 text-foreground/20",
|
|
18
24
|
viewBox: "0 0 16 16",
|
|
19
25
|
fill: "none",
|
|
20
26
|
children: /* @__PURE__ */ jsx("path", { d: "M6 4l4 4-4 4", stroke: "currentColor", strokeWidth: "1.5" })
|
|
21
27
|
}
|
|
22
28
|
),
|
|
23
|
-
idx === items.length - 1 ? /* @__PURE__ */ jsx("span", { className: "truncate text-
|
|
29
|
+
idx === items.length - 1 ? /* @__PURE__ */ jsx("span", { className: "truncate text-foreground/60", children: item.title }) : /* @__PURE__ */ jsx(
|
|
24
30
|
"a",
|
|
25
31
|
{
|
|
26
32
|
href: item.href,
|
|
27
|
-
className: "truncate text-
|
|
33
|
+
className: "truncate text-foreground/40 transition-colors hover:text-foreground/70",
|
|
28
34
|
children: item.title
|
|
29
35
|
}
|
|
30
36
|
)
|
|
31
37
|
] }, `${item.href}-${item.title}`)) });
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
// ../shared/dist/chunk-
|
|
40
|
+
// ../shared/dist/chunk-QKKVTCRJ.js
|
|
35
41
|
function toTocLevel(level) {
|
|
36
42
|
if (level === 2 || level === 3 || level === 4) {
|
|
37
43
|
return level;
|
|
@@ -188,11 +194,11 @@ function createHeading(Tag, className) {
|
|
|
188
194
|
return ({ children }) => {
|
|
189
195
|
const text = getNodeText(children);
|
|
190
196
|
const id = slugify(text);
|
|
191
|
-
return /* @__PURE__ */ jsx(Tag, { id, className:
|
|
197
|
+
return /* @__PURE__ */ jsx(Tag, { id, className: cn(className, "scroll-mt-20"), children: /* @__PURE__ */ jsx("a", { href: `#${id}`, className: "transition-colors hover:text-primary", children }) });
|
|
192
198
|
};
|
|
193
199
|
}
|
|
194
200
|
function DocPage(props) {
|
|
195
|
-
return /* @__PURE__ */ jsx("article", { className: "prose-custom max-w-none", children: /* @__PURE__ */ jsx(
|
|
201
|
+
return /* @__PURE__ */ jsx("article", { className: cn("prose-custom max-w-none", props.className), children: /* @__PURE__ */ jsx(
|
|
196
202
|
ReactMarkdown,
|
|
197
203
|
{
|
|
198
204
|
remarkPlugins: [remarkGfm],
|
|
@@ -200,11 +206,11 @@ function DocPage(props) {
|
|
|
200
206
|
h1: createHeading("h1", "mb-4 mt-8 text-3xl font-bold"),
|
|
201
207
|
h2: createHeading(
|
|
202
208
|
"h2",
|
|
203
|
-
"mb-3 mt-8 border-b border-
|
|
209
|
+
"mb-3 mt-8 border-b border-border/60 pb-2 text-2xl font-bold"
|
|
204
210
|
),
|
|
205
211
|
h3: createHeading("h3", "mb-2 mt-6 text-xl font-semibold"),
|
|
206
212
|
h4: createHeading("h4", "mb-2 mt-4 text-lg font-medium"),
|
|
207
|
-
p: ({ children }) => /* @__PURE__ */ jsx("p", { className: "my-3 leading-relaxed text-
|
|
213
|
+
p: ({ children }) => /* @__PURE__ */ jsx("p", { className: "my-3 leading-relaxed text-foreground/80", children }),
|
|
208
214
|
a: ({ href, children }) => /* @__PURE__ */ jsx(
|
|
209
215
|
"a",
|
|
210
216
|
{
|
|
@@ -215,12 +221,12 @@ function DocPage(props) {
|
|
|
215
221
|
children
|
|
216
222
|
}
|
|
217
223
|
),
|
|
218
|
-
code: ({ className, children }) => className ? /* @__PURE__ */ jsx("code", { className, children }) : /* @__PURE__ */ jsx("code", { className: "rounded bg-
|
|
219
|
-
pre: ({ children }) => /* @__PURE__ */ jsx("pre", { className: "my-4 overflow-x-auto rounded-lg bg-
|
|
220
|
-
blockquote: ({ children }) => /* @__PURE__ */ jsx("blockquote", { className: "my-4 rounded-r-lg border-l-4 border-primary/40 bg-
|
|
221
|
-
table: ({ children }) => /* @__PURE__ */ jsx("div", { className: "my-4 overflow-x-auto rounded-lg border border-
|
|
222
|
-
th: ({ children }) => /* @__PURE__ */ jsx("th", { className: "border-b border-
|
|
223
|
-
td: ({ children }) => /* @__PURE__ */ jsx("td", { className: "border-b border-
|
|
224
|
+
code: ({ className, children }) => className ? /* @__PURE__ */ jsx("code", { className, children }) : /* @__PURE__ */ jsx("code", { className: "rounded bg-foreground/10 px-1.5 py-0.5 text-sm text-primary", children }),
|
|
225
|
+
pre: ({ children }) => /* @__PURE__ */ jsx("pre", { className: "my-4 overflow-x-auto rounded-lg bg-background/80 p-4 text-sm leading-relaxed", children }),
|
|
226
|
+
blockquote: ({ children }) => /* @__PURE__ */ jsx("blockquote", { className: "my-4 rounded-r-lg border-l-4 border-primary/40 bg-foreground/5 py-3 pl-4 pr-4 italic text-foreground/70", children }),
|
|
227
|
+
table: ({ children }) => /* @__PURE__ */ jsx("div", { className: "my-4 overflow-x-auto rounded-lg border border-border/60", children: /* @__PURE__ */ jsx("table", { className: "w-full text-sm", children }) }),
|
|
228
|
+
th: ({ children }) => /* @__PURE__ */ jsx("th", { className: "border-b border-border/60 bg-foreground/5 px-4 py-2.5 text-left font-semibold", children }),
|
|
229
|
+
td: ({ children }) => /* @__PURE__ */ jsx("td", { className: "border-b border-border/40 px-4 py-2 text-foreground/70 last:border-none", children })
|
|
224
230
|
},
|
|
225
231
|
children: props.page.content
|
|
226
232
|
}
|
|
@@ -236,7 +242,8 @@ function DocSearch({
|
|
|
236
242
|
onQuery,
|
|
237
243
|
onSelect,
|
|
238
244
|
isOpen,
|
|
239
|
-
onClose
|
|
245
|
+
onClose,
|
|
246
|
+
className
|
|
240
247
|
}) {
|
|
241
248
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
242
249
|
const dialogId = useId();
|
|
@@ -297,7 +304,7 @@ function DocSearch({
|
|
|
297
304
|
},
|
|
298
305
|
[results, activeIndex, onSelect, onClose]
|
|
299
306
|
);
|
|
300
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex items-start justify-center pt-[15vh]", children: [
|
|
307
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxs("div", { className: cn("fixed inset-0 z-50 flex items-start justify-center pt-[15vh]", className), children: [
|
|
301
308
|
/* @__PURE__ */ jsx(
|
|
302
309
|
motion.button,
|
|
303
310
|
{
|
|
@@ -306,7 +313,7 @@ function DocSearch({
|
|
|
306
313
|
initial: { opacity: 0 },
|
|
307
314
|
animate: { opacity: 1 },
|
|
308
315
|
exit: { opacity: 0 },
|
|
309
|
-
className: "fixed inset-0 bg-
|
|
316
|
+
className: "fixed inset-0 bg-background/80 backdrop-blur-md",
|
|
310
317
|
onClick: onClose
|
|
311
318
|
}
|
|
312
319
|
),
|
|
@@ -318,16 +325,16 @@ function DocSearch({
|
|
|
318
325
|
animate: { opacity: 1, scale: 1, y: 0 },
|
|
319
326
|
exit: { opacity: 0, scale: 0.95, y: -20 },
|
|
320
327
|
transition: { type: "spring", damping: 25, stiffness: 250 },
|
|
321
|
-
className: "relative z-10 w-full max-w-xl overflow-hidden rounded-2xl border border-
|
|
328
|
+
className: "relative z-10 w-full max-w-xl overflow-hidden rounded-2xl border border-border/60 bg-card/40 backdrop-blur-3xl shadow-2xl ring-1 ring-border/40",
|
|
322
329
|
role: "dialog",
|
|
323
330
|
"aria-modal": "true",
|
|
324
331
|
"aria-labelledby": `${dialogId}-title`,
|
|
325
332
|
onKeyDown: handleKeyDown,
|
|
326
333
|
onClick: (e) => e.stopPropagation(),
|
|
327
334
|
children: [
|
|
328
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-b border-
|
|
335
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-b border-border/60 px-5 py-4 bg-foreground/5", children: [
|
|
329
336
|
/* @__PURE__ */ jsx("h2", { id: `${dialogId}-title`, className: "sr-only", children: "Search documentation" }),
|
|
330
|
-
/* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "h-5 w-5 shrink-0 text-
|
|
337
|
+
/* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "h-5 w-5 shrink-0 text-foreground/40", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z", clipRule: "evenodd" }) }),
|
|
331
338
|
/* @__PURE__ */ jsx(
|
|
332
339
|
"input",
|
|
333
340
|
{
|
|
@@ -339,10 +346,10 @@ function DocSearch({
|
|
|
339
346
|
"aria-label": "Search documentation",
|
|
340
347
|
"aria-controls": `${dialogId}-results`,
|
|
341
348
|
"aria-activedescendant": activeResultId,
|
|
342
|
-
className: "flex-1 bg-transparent text-sm text-
|
|
349
|
+
className: "flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-0"
|
|
343
350
|
}
|
|
344
351
|
),
|
|
345
|
-
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-
|
|
352
|
+
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-border/60 bg-foreground/5 px-1.5 py-0.5 text-[11px] text-foreground/30 font-medium", children: "ESC" })
|
|
346
353
|
] }),
|
|
347
354
|
/* @__PURE__ */ jsxs(
|
|
348
355
|
"div",
|
|
@@ -358,7 +365,7 @@ function DocSearch({
|
|
|
358
365
|
initial: { opacity: 0 },
|
|
359
366
|
animate: { opacity: 1 },
|
|
360
367
|
exit: { opacity: 0 },
|
|
361
|
-
className: "flex flex-col items-center py-10 text-center text-
|
|
368
|
+
className: "flex flex-col items-center py-10 text-center text-foreground/30",
|
|
362
369
|
children: [
|
|
363
370
|
/* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", className: "mb-3 h-10 w-10 opacity-50", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: [
|
|
364
371
|
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8", strokeWidth: "1.5" }),
|
|
@@ -379,7 +386,7 @@ function DocSearch({
|
|
|
379
386
|
initial: { opacity: 0 },
|
|
380
387
|
animate: { opacity: 1 },
|
|
381
388
|
exit: { opacity: 0 },
|
|
382
|
-
className: "py-8 text-center text-sm text-
|
|
389
|
+
className: "py-8 text-center text-sm text-foreground/30",
|
|
383
390
|
children: "Start typing to search\u2026"
|
|
384
391
|
}
|
|
385
392
|
)
|
|
@@ -396,7 +403,10 @@ function DocSearch({
|
|
|
396
403
|
"aria-selected": idx === activeIndex,
|
|
397
404
|
onMouseEnter: () => setActiveIndex(idx),
|
|
398
405
|
onClick: () => onSelect(result),
|
|
399
|
-
className:
|
|
406
|
+
className: cn(
|
|
407
|
+
"group relative my-0.5 flex w-full flex-col gap-1 rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
408
|
+
idx === activeIndex ? "bg-primary/15 text-foreground ring-1 ring-primary/30" : "text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
409
|
+
),
|
|
400
410
|
children: [
|
|
401
411
|
idx === activeIndex && /* @__PURE__ */ jsx(
|
|
402
412
|
motion.div,
|
|
@@ -410,8 +420,8 @@ function DocSearch({
|
|
|
410
420
|
/* @__PURE__ */ jsx("span", { className: "rounded bg-primary/20 px-1.5 py-0.5 text-[10px] font-medium text-primary", children: result.sectionTitle }),
|
|
411
421
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: result.pageTitle })
|
|
412
422
|
] }),
|
|
413
|
-
/* @__PURE__ */ jsx("p", { className: "relative z-10 truncate text-xs text-
|
|
414
|
-
result.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "relative z-10 flex gap-1 mt-1", children: result.tags.slice(0, 3).map((tag) => /* @__PURE__ */ jsx("span", { className: "rounded bg-
|
|
423
|
+
/* @__PURE__ */ jsx("p", { className: "relative z-10 truncate text-xs text-foreground/40", children: highlightMatch(result.highlight, query) }),
|
|
424
|
+
result.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "relative z-10 flex gap-1 mt-1", children: result.tags.slice(0, 3).map((tag) => /* @__PURE__ */ jsx("span", { className: "rounded bg-foreground/5 px-1.5 py-0.5 text-[10px] text-foreground/30 border border-border/40", children: tag }, tag)) })
|
|
415
425
|
]
|
|
416
426
|
},
|
|
417
427
|
result.pageId
|
|
@@ -419,19 +429,19 @@ function DocSearch({
|
|
|
419
429
|
]
|
|
420
430
|
}
|
|
421
431
|
),
|
|
422
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 border-t border-
|
|
432
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 border-t border-border/60 px-5 py-2.5 text-[11px] text-foreground/30 bg-background/70", children: [
|
|
423
433
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
|
|
424
|
-
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-
|
|
434
|
+
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-border/60 bg-foreground/5 px-1 pb-0.5 text-[10px]", children: "\u2191" }),
|
|
425
435
|
" ",
|
|
426
|
-
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-
|
|
436
|
+
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-border/60 bg-foreground/5 px-1 pb-0.5 text-[10px]", children: "\u2193" }),
|
|
427
437
|
" navigate"
|
|
428
438
|
] }),
|
|
429
439
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
|
|
430
|
-
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-
|
|
440
|
+
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-border/60 bg-foreground/5 px-1 pb-0.5 text-[10px]", children: "\u21B5" }),
|
|
431
441
|
" select"
|
|
432
442
|
] }),
|
|
433
443
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
|
|
434
|
-
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-
|
|
444
|
+
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-border/60 bg-foreground/5 px-1 pb-0.5 text-[10px]", children: "esc" }),
|
|
435
445
|
" close"
|
|
436
446
|
] })
|
|
437
447
|
] })
|
|
@@ -443,7 +453,8 @@ function DocSearch({
|
|
|
443
453
|
function DocSidebar({
|
|
444
454
|
sections,
|
|
445
455
|
currentPageId,
|
|
446
|
-
onNavigate
|
|
456
|
+
onNavigate,
|
|
457
|
+
className
|
|
447
458
|
}) {
|
|
448
459
|
const [expandedIds, setExpandedIds] = useState(/* @__PURE__ */ new Set());
|
|
449
460
|
const toggle = useCallback((id) => {
|
|
@@ -467,7 +478,11 @@ function DocSidebar({
|
|
|
467
478
|
{
|
|
468
479
|
type: "button",
|
|
469
480
|
onClick: () => toggle(section.id),
|
|
470
|
-
|
|
481
|
+
"aria-expanded": hasContent ? isExpanded : void 0,
|
|
482
|
+
className: cn(
|
|
483
|
+
"flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
484
|
+
isExpanded ? "bg-muted text-foreground" : "text-foreground hover:bg-muted/70"
|
|
485
|
+
),
|
|
471
486
|
whileHover: { x: 2 },
|
|
472
487
|
whileTap: { scale: 0.98 },
|
|
473
488
|
children: [
|
|
@@ -503,7 +518,10 @@ function DocSidebar({
|
|
|
503
518
|
onClick: () => onNavigate(page, section),
|
|
504
519
|
whileHover: { x: 2 },
|
|
505
520
|
whileTap: { scale: 0.98 },
|
|
506
|
-
className:
|
|
521
|
+
className: cn(
|
|
522
|
+
"my-0.5 flex w-full items-center gap-2 rounded-lg px-3 py-1.5 text-left text-sm transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
523
|
+
currentPageId === page.id ? "bg-primary/10 font-semibold text-primary ring-1 ring-primary/20" : "text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
524
|
+
),
|
|
507
525
|
children: /* @__PURE__ */ jsx("span", { className: "truncate", children: page.title })
|
|
508
526
|
},
|
|
509
527
|
page.id
|
|
@@ -514,7 +532,7 @@ function DocSidebar({
|
|
|
514
532
|
) })
|
|
515
533
|
] }, section.id);
|
|
516
534
|
};
|
|
517
|
-
return /* @__PURE__ */ jsxs("nav", { className: "flex flex-col gap-1 py-4", children: [
|
|
535
|
+
return /* @__PURE__ */ jsxs("nav", { className: cn("flex flex-col gap-1 py-4", className), children: [
|
|
518
536
|
/* @__PURE__ */ jsx("div", { className: "px-4 pb-3 text-xs font-bold uppercase tracking-widest text-muted-foreground", children: "Documentation" }),
|
|
519
537
|
topLevel.map((s) => renderSection(s, 0))
|
|
520
538
|
] });
|
|
@@ -526,7 +544,10 @@ function TocLink({ item, activeId, depth = 0 }) {
|
|
|
526
544
|
motion.a,
|
|
527
545
|
{
|
|
528
546
|
href: `#${item.id}`,
|
|
529
|
-
className:
|
|
547
|
+
className: cn(
|
|
548
|
+
"block truncate border-l-2 py-1 text-[13px] transition-all relative",
|
|
549
|
+
isActive ? "border-primary text-primary font-medium" : "border-transparent text-foreground/40 hover:text-foreground/80 hover:border-border/80"
|
|
550
|
+
),
|
|
530
551
|
style: { paddingLeft: 12 + depth * 12 },
|
|
531
552
|
whileHover: { x: 2 },
|
|
532
553
|
whileTap: { scale: 0.98 },
|
|
@@ -539,11 +560,12 @@ function TocLink({ item, activeId, depth = 0 }) {
|
|
|
539
560
|
}
|
|
540
561
|
function TableOfContents({
|
|
541
562
|
toc,
|
|
542
|
-
activeId
|
|
563
|
+
activeId,
|
|
564
|
+
className
|
|
543
565
|
}) {
|
|
544
566
|
if (toc.length === 0) return null;
|
|
545
|
-
return /* @__PURE__ */ jsxs("nav", { className: "sticky top-24", children: [
|
|
546
|
-
/* @__PURE__ */ jsx("h4", { className: "mb-3 text-xs font-semibold uppercase tracking-widest text-
|
|
567
|
+
return /* @__PURE__ */ jsxs("nav", { className: cn("sticky top-24", className), children: [
|
|
568
|
+
/* @__PURE__ */ jsx("h4", { className: "mb-3 text-xs font-semibold uppercase tracking-widest text-foreground/40", children: "On this page" }),
|
|
547
569
|
/* @__PURE__ */ jsx(motion.div, { className: "flex flex-col relative", layoutRoot: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: toc.map((item) => /* @__PURE__ */ jsx(motion.div, { initial: { opacity: 0, x: -10 }, animate: { opacity: 1, x: 0 }, children: /* @__PURE__ */ jsx(TocLink, { item, activeId }) }, item.id)) }) })
|
|
548
570
|
] });
|
|
549
571
|
}
|
|
@@ -554,10 +576,11 @@ function DocsLayout({
|
|
|
554
576
|
breadcrumbs,
|
|
555
577
|
currentPageId,
|
|
556
578
|
onNavigate,
|
|
557
|
-
children
|
|
579
|
+
children,
|
|
580
|
+
className
|
|
558
581
|
}) {
|
|
559
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-screen bg-
|
|
560
|
-
/* @__PURE__ */ jsx("aside", { className: "sticky top-0 hidden h-screen w-[260px] shrink-0 overflow-y-auto border-r border-
|
|
582
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-screen bg-background text-foreground", className), children: [
|
|
583
|
+
/* @__PURE__ */ jsx("aside", { className: "sticky top-0 hidden h-screen w-[260px] shrink-0 overflow-y-auto border-r border-border bg-card lg:block", children: /* @__PURE__ */ jsx(
|
|
561
584
|
DocSidebar,
|
|
562
585
|
{
|
|
563
586
|
sections,
|
|
@@ -604,7 +627,8 @@ function DocsLayout({
|
|
|
604
627
|
}
|
|
605
628
|
function EditButton({
|
|
606
629
|
pageSlug,
|
|
607
|
-
editUrl
|
|
630
|
+
editUrl,
|
|
631
|
+
className
|
|
608
632
|
}) {
|
|
609
633
|
if (!editUrl) return null;
|
|
610
634
|
const href = `${editUrl.replace(/\/$/, "")}/${pageSlug}.mdx`;
|
|
@@ -614,7 +638,10 @@ function EditButton({
|
|
|
614
638
|
href,
|
|
615
639
|
target: "_blank",
|
|
616
640
|
rel: "noopener noreferrer",
|
|
617
|
-
className:
|
|
641
|
+
className: cn(
|
|
642
|
+
"inline-flex items-center gap-1.5 rounded-lg border border-border/60 px-3 py-1.5 text-xs text-foreground/40 transition-colors hover:border-border/80 hover:text-foreground/60",
|
|
643
|
+
className
|
|
644
|
+
),
|
|
618
645
|
children: [
|
|
619
646
|
/* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "h-3.5 w-3.5", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M11.5 1.5l3 3-9 9H2.5v-3l9-9z", strokeWidth: "1.5", strokeLinejoin: "round" }) }),
|
|
620
647
|
"Edit this page"
|
|
@@ -624,18 +651,19 @@ function EditButton({
|
|
|
624
651
|
}
|
|
625
652
|
function PageNavigation({
|
|
626
653
|
prev,
|
|
627
|
-
next
|
|
654
|
+
next,
|
|
655
|
+
className
|
|
628
656
|
}) {
|
|
629
657
|
if (!prev && !next) return null;
|
|
630
|
-
return /* @__PURE__ */ jsxs("div", { className: "mt-12 flex items-stretch gap-4 border-t border-
|
|
658
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("mt-12 flex items-stretch gap-4 border-t border-border/60 pt-8", className), children: [
|
|
631
659
|
prev ? /* @__PURE__ */ jsxs(
|
|
632
660
|
"a",
|
|
633
661
|
{
|
|
634
662
|
href: prev.href,
|
|
635
|
-
className: "group flex flex-1 flex-col rounded-xl border border-
|
|
663
|
+
className: "group flex flex-1 flex-col rounded-xl border border-border/60 p-4 transition-all hover:border-primary/40 hover:bg-foreground/5",
|
|
636
664
|
children: [
|
|
637
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-
|
|
638
|
-
/* @__PURE__ */ jsx("span", { className: "mt-1 text-sm font-medium text-
|
|
665
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-foreground/40 group-hover:text-primary transition-colors", children: "\u2190 Previous" }),
|
|
666
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 text-sm font-medium text-foreground/80 group-hover:text-foreground transition-colors truncate", children: prev.title })
|
|
639
667
|
]
|
|
640
668
|
}
|
|
641
669
|
) : /* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
@@ -643,10 +671,10 @@ function PageNavigation({
|
|
|
643
671
|
"a",
|
|
644
672
|
{
|
|
645
673
|
href: next.href,
|
|
646
|
-
className: "group flex flex-1 flex-col items-end rounded-xl border border-
|
|
674
|
+
className: "group flex flex-1 flex-col items-end rounded-xl border border-border/60 p-4 text-right transition-all hover:border-primary/40 hover:bg-foreground/5",
|
|
647
675
|
children: [
|
|
648
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-
|
|
649
|
-
/* @__PURE__ */ jsx("span", { className: "mt-1 text-sm font-medium text-
|
|
676
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-foreground/40 group-hover:text-primary transition-colors", children: "Next \u2192" }),
|
|
677
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 text-sm font-medium text-foreground/80 group-hover:text-foreground transition-colors truncate", children: next.title })
|
|
650
678
|
]
|
|
651
679
|
}
|
|
652
680
|
) : /* @__PURE__ */ jsx("div", { className: "flex-1" })
|
|
@@ -655,10 +683,12 @@ function PageNavigation({
|
|
|
655
683
|
function VersionSelector({
|
|
656
684
|
versions,
|
|
657
685
|
current,
|
|
658
|
-
onSelect
|
|
686
|
+
onSelect,
|
|
687
|
+
className
|
|
659
688
|
}) {
|
|
660
689
|
const [isOpen, setIsOpen] = useState(false);
|
|
661
690
|
const ref = useRef(null);
|
|
691
|
+
const menuId = useId();
|
|
662
692
|
useEffect(() => {
|
|
663
693
|
const handleClickOutside = (e) => {
|
|
664
694
|
if (ref.current && e.target instanceof Node && !ref.current.contains(e.target)) {
|
|
@@ -669,39 +699,73 @@ function VersionSelector({
|
|
|
669
699
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
670
700
|
}, []);
|
|
671
701
|
if (versions.length <= 1) return null;
|
|
672
|
-
return /* @__PURE__ */ jsxs("div", { ref, className: "relative", children: [
|
|
702
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn("relative", className), children: [
|
|
673
703
|
/* @__PURE__ */ jsxs(
|
|
674
704
|
"button",
|
|
675
705
|
{
|
|
676
706
|
type: "button",
|
|
677
707
|
onClick: () => setIsOpen(!isOpen),
|
|
678
|
-
|
|
708
|
+
"aria-expanded": isOpen,
|
|
709
|
+
"aria-haspopup": "listbox",
|
|
710
|
+
"aria-controls": menuId,
|
|
711
|
+
className: cn(
|
|
712
|
+
"flex items-center gap-1.5 rounded-lg border border-border bg-card/60 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
713
|
+
isOpen && "border-primary/30 text-foreground"
|
|
714
|
+
),
|
|
679
715
|
children: [
|
|
680
716
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
681
717
|
"v",
|
|
682
718
|
current
|
|
683
719
|
] }),
|
|
684
|
-
/* @__PURE__ */ jsx(
|
|
720
|
+
/* @__PURE__ */ jsx(
|
|
721
|
+
"svg",
|
|
722
|
+
{
|
|
723
|
+
"aria-hidden": "true",
|
|
724
|
+
className: cn("h-3 w-3 transition-transform", isOpen && "rotate-180"),
|
|
725
|
+
viewBox: "0 0 16 16",
|
|
726
|
+
fill: "currentColor",
|
|
727
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeWidth: "2", fill: "none" })
|
|
728
|
+
}
|
|
729
|
+
)
|
|
685
730
|
]
|
|
686
731
|
}
|
|
687
732
|
),
|
|
688
|
-
isOpen && /* @__PURE__ */ jsx(
|
|
689
|
-
"
|
|
733
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
734
|
+
"div",
|
|
690
735
|
{
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
736
|
+
id: menuId,
|
|
737
|
+
role: "listbox",
|
|
738
|
+
className: "absolute right-0 top-full z-20 mt-1 min-w-[120px] overflow-hidden rounded-lg border border-border bg-popover shadow-xl",
|
|
739
|
+
onKeyDown: (event) => {
|
|
740
|
+
if (event.key === "Escape") {
|
|
741
|
+
event.preventDefault();
|
|
742
|
+
setIsOpen(false);
|
|
743
|
+
}
|
|
695
744
|
},
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
745
|
+
children: versions.map((v) => /* @__PURE__ */ jsxs(
|
|
746
|
+
"button",
|
|
747
|
+
{
|
|
748
|
+
type: "button",
|
|
749
|
+
role: "option",
|
|
750
|
+
"aria-selected": v === current,
|
|
751
|
+
onClick: () => {
|
|
752
|
+
onSelect(v);
|
|
753
|
+
setIsOpen(false);
|
|
754
|
+
},
|
|
755
|
+
className: cn(
|
|
756
|
+
"flex w-full items-center px-3 py-2 text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
|
|
757
|
+
v === current ? "bg-primary/15 font-medium text-primary" : "text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
758
|
+
),
|
|
759
|
+
children: [
|
|
760
|
+
"v",
|
|
761
|
+
v,
|
|
762
|
+
v === current && /* @__PURE__ */ jsx("span", { className: "ml-auto text-[10px]", children: "\u2713" })
|
|
763
|
+
]
|
|
764
|
+
},
|
|
765
|
+
v
|
|
766
|
+
))
|
|
767
|
+
}
|
|
768
|
+
)
|
|
705
769
|
] });
|
|
706
770
|
}
|
|
707
771
|
function useDocSearch(searchFn, debounceMs = 250) {
|
|
@@ -898,7 +962,8 @@ function useTableOfContents(mdxContent) {
|
|
|
898
962
|
}
|
|
899
963
|
function DocSearchPage({
|
|
900
964
|
tree,
|
|
901
|
-
onSelectPage
|
|
965
|
+
onSelectPage,
|
|
966
|
+
className
|
|
902
967
|
}) {
|
|
903
968
|
const sections = useMemo(() => tree ?? [], [tree]);
|
|
904
969
|
const flatPages = useMemo(() => sections.flatMap((s) => s.pages ?? []), [sections]);
|
|
@@ -911,15 +976,15 @@ function DocSearchPage({
|
|
|
911
976
|
);
|
|
912
977
|
const { results, isSearching, query, setQuery } = useDocSearch(searchFn);
|
|
913
978
|
if (tree === void 0) {
|
|
914
|
-
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-
|
|
915
|
-
/* @__PURE__ */ jsx("div", { className: "mb-8 h-12 animate-pulse rounded-xl bg-
|
|
916
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-3", children: Array.from({ length: 5 }, (_, index) => `doc-search-skeleton-${index}`).map((key) => /* @__PURE__ */ jsx("div", { className: "h-20 animate-pulse rounded-xl bg-
|
|
979
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-h-screen bg-background px-6 py-16", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-2xl", children: [
|
|
980
|
+
/* @__PURE__ */ jsx("div", { className: "mb-8 h-12 animate-pulse rounded-xl bg-foreground/5" }),
|
|
981
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-3", children: Array.from({ length: 5 }, (_, index) => `doc-search-skeleton-${index}`).map((key) => /* @__PURE__ */ jsx("div", { className: "h-20 animate-pulse rounded-xl bg-foreground/5" }, key)) })
|
|
917
982
|
] }) });
|
|
918
983
|
}
|
|
919
|
-
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-
|
|
984
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-h-screen bg-background text-foreground", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-2xl px-6 py-16", children: [
|
|
920
985
|
/* @__PURE__ */ jsx("h1", { className: "mb-8 text-2xl font-bold", children: "Search Documentation" }),
|
|
921
986
|
/* @__PURE__ */ jsxs("div", { className: "relative mb-8", children: [
|
|
922
|
-
/* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-
|
|
987
|
+
/* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-foreground/30", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z", clipRule: "evenodd" }) }),
|
|
923
988
|
/* @__PURE__ */ jsx(
|
|
924
989
|
"input",
|
|
925
990
|
{
|
|
@@ -927,10 +992,11 @@ function DocSearchPage({
|
|
|
927
992
|
value: query,
|
|
928
993
|
onChange: (e) => setQuery(e.target.value),
|
|
929
994
|
placeholder: "Type to search\u2026",
|
|
930
|
-
|
|
995
|
+
"aria-label": "Search documentation",
|
|
996
|
+
className: "w-full rounded-xl border border-border bg-card/60 py-3.5 pl-12 pr-4 text-sm text-foreground placeholder:text-muted-foreground outline-none transition-colors focus:border-primary/40 focus:ring-2 focus:ring-ring/20"
|
|
931
997
|
}
|
|
932
998
|
),
|
|
933
|
-
isSearching && /* @__PURE__ */ jsx("div", { className: "absolute right-4 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-
|
|
999
|
+
isSearching && /* @__PURE__ */ jsx("div", { className: "absolute right-4 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-border/60 border-t-primary" }) })
|
|
934
1000
|
] }),
|
|
935
1001
|
results.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: results.map((result) => {
|
|
936
1002
|
const section = sections.find((s) => s.slug === result.sectionSlug);
|
|
@@ -942,18 +1008,18 @@ function DocSearchPage({
|
|
|
942
1008
|
onClick: () => {
|
|
943
1009
|
if (page && section && onSelectPage) onSelectPage(page, section);
|
|
944
1010
|
},
|
|
945
|
-
className: "flex w-full flex-col gap-1.5 rounded-xl border border-
|
|
1011
|
+
className: "flex w-full flex-col gap-1.5 rounded-xl border border-border bg-card/40 p-4 text-left transition-all hover:border-primary/20 hover:bg-card",
|
|
946
1012
|
children: [
|
|
947
1013
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
948
1014
|
/* @__PURE__ */ jsx("span", { className: "rounded bg-primary/20 px-2 py-0.5 text-[10px] font-medium text-primary", children: result.sectionTitle }),
|
|
949
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-
|
|
950
|
-
/* @__PURE__ */ jsxs("span", { className: "ml-auto text-xs tabular-nums text-
|
|
1015
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground/90", children: result.pageTitle }),
|
|
1016
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-auto text-xs tabular-nums text-foreground/20", children: [
|
|
951
1017
|
page?.readingTime ?? 0,
|
|
952
1018
|
" min"
|
|
953
1019
|
] })
|
|
954
1020
|
] }),
|
|
955
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-
|
|
956
|
-
result.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex gap-1 mt-1", children: result.tags.slice(0, 4).map((tag) => /* @__PURE__ */ jsx("span", { className: "rounded bg-
|
|
1021
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-foreground/40", children: highlightMatch(result.highlight, query) }),
|
|
1022
|
+
result.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex gap-1 mt-1", children: result.tags.slice(0, 4).map((tag) => /* @__PURE__ */ jsx("span", { className: "rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground", children: tag }, tag)) })
|
|
957
1023
|
]
|
|
958
1024
|
},
|
|
959
1025
|
result.pageId
|
|
@@ -961,12 +1027,12 @@ function DocSearchPage({
|
|
|
961
1027
|
}) }),
|
|
962
1028
|
query.trim() && results.length === 0 && !isSearching && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center py-16 text-center", children: [
|
|
963
1029
|
/* @__PURE__ */ jsx("div", { className: "mb-4 text-5xl opacity-30", children: "\u{1F50D}" }),
|
|
964
|
-
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-lg font-medium text-
|
|
965
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-
|
|
1030
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-lg font-medium text-foreground/60", children: "No results found" }),
|
|
1031
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-foreground/30", children: "Try different keywords or check your spelling." })
|
|
966
1032
|
] }),
|
|
967
1033
|
!query.trim() && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center py-16 text-center", children: [
|
|
968
1034
|
/* @__PURE__ */ jsx("div", { className: "mb-4 text-5xl opacity-20", children: "\u{1F4D6}" }),
|
|
969
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-
|
|
1035
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-foreground/30", children: "Start typing to search across all documentation" })
|
|
970
1036
|
] })
|
|
971
1037
|
] }) });
|
|
972
1038
|
}
|
|
@@ -997,7 +1063,8 @@ function initialPageForm() {
|
|
|
997
1063
|
function DocsAdminPage({
|
|
998
1064
|
tree,
|
|
999
1065
|
allPages,
|
|
1000
|
-
admin
|
|
1066
|
+
admin,
|
|
1067
|
+
className
|
|
1001
1068
|
}) {
|
|
1002
1069
|
const sections = useMemo(() => tree ?? [], [tree]);
|
|
1003
1070
|
const [selectedSectionId, setSelectedSectionId] = useState(null);
|
|
@@ -1014,20 +1081,20 @@ function DocsAdminPage({
|
|
|
1014
1081
|
const canCreateSection = sectionForm.title.trim().length > 0 && sectionForm.slug.trim().length > 0;
|
|
1015
1082
|
const canCreatePage = pageForm.title.trim().length > 0 && pageForm.slug.trim().length > 0 && pageForm.content.trim().length > 0;
|
|
1016
1083
|
if (tree === void 0) {
|
|
1017
|
-
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-
|
|
1018
|
-
/* @__PURE__ */ jsx("div", { className: "mb-8 h-10 w-48 animate-pulse rounded bg-
|
|
1084
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-h-screen bg-background px-6 py-12", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-6xl", children: [
|
|
1085
|
+
/* @__PURE__ */ jsx("div", { className: "mb-8 h-10 w-48 animate-pulse rounded bg-muted/60" }),
|
|
1019
1086
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
1020
|
-
/* @__PURE__ */ jsx("div", { className: "h-96 animate-pulse rounded-xl bg-
|
|
1021
|
-
/* @__PURE__ */ jsx("div", { className: "h-96 animate-pulse rounded-xl bg-
|
|
1087
|
+
/* @__PURE__ */ jsx("div", { className: "h-96 animate-pulse rounded-xl bg-muted/60" }),
|
|
1088
|
+
/* @__PURE__ */ jsx("div", { className: "h-96 animate-pulse rounded-xl bg-muted/60" })
|
|
1022
1089
|
] })
|
|
1023
1090
|
] }) });
|
|
1024
1091
|
}
|
|
1025
|
-
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-
|
|
1092
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-h-screen bg-background text-foreground", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-6xl px-6 py-12", children: [
|
|
1026
1093
|
/* @__PURE__ */ jsx("h1", { className: "mb-8 text-2xl font-bold", children: "Docs Admin" }),
|
|
1027
1094
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
1028
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-
|
|
1095
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card/40 p-5", children: [
|
|
1029
1096
|
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center justify-between", children: [
|
|
1030
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-
|
|
1097
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Sections" }),
|
|
1031
1098
|
/* @__PURE__ */ jsx(
|
|
1032
1099
|
"button",
|
|
1033
1100
|
{
|
|
@@ -1038,9 +1105,9 @@ function DocsAdminPage({
|
|
|
1038
1105
|
}
|
|
1039
1106
|
)
|
|
1040
1107
|
] }),
|
|
1041
|
-
showSectionForm && /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-2 rounded-lg border border-
|
|
1108
|
+
showSectionForm && /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-2 rounded-lg border border-border bg-card/60 p-4", children: [
|
|
1042
1109
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-section-title", children: [
|
|
1043
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1110
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Title" }),
|
|
1044
1111
|
/* @__PURE__ */ jsx(
|
|
1045
1112
|
"input",
|
|
1046
1113
|
{
|
|
@@ -1049,12 +1116,12 @@ function DocsAdminPage({
|
|
|
1049
1116
|
placeholder: "Getting Started",
|
|
1050
1117
|
value: sectionForm.title,
|
|
1051
1118
|
onChange: (e) => setSectionForm({ ...sectionForm, title: e.target.value }),
|
|
1052
|
-
className: "w-full rounded-lg border border-
|
|
1119
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20"
|
|
1053
1120
|
}
|
|
1054
1121
|
)
|
|
1055
1122
|
] }),
|
|
1056
1123
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-section-slug", children: [
|
|
1057
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1124
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Slug" }),
|
|
1058
1125
|
/* @__PURE__ */ jsx(
|
|
1059
1126
|
"input",
|
|
1060
1127
|
{
|
|
@@ -1063,12 +1130,12 @@ function DocsAdminPage({
|
|
|
1063
1130
|
placeholder: "getting-started",
|
|
1064
1131
|
value: sectionForm.slug,
|
|
1065
1132
|
onChange: (e) => setSectionForm({ ...sectionForm, slug: e.target.value }),
|
|
1066
|
-
className: "w-full rounded-lg border border-
|
|
1133
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20"
|
|
1067
1134
|
}
|
|
1068
1135
|
)
|
|
1069
1136
|
] }),
|
|
1070
1137
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-section-icon", children: [
|
|
1071
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1138
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Icon" }),
|
|
1072
1139
|
/* @__PURE__ */ jsx(
|
|
1073
1140
|
"input",
|
|
1074
1141
|
{
|
|
@@ -1077,7 +1144,7 @@ function DocsAdminPage({
|
|
|
1077
1144
|
placeholder: "\u{1F4DA}",
|
|
1078
1145
|
value: sectionForm.icon,
|
|
1079
1146
|
onChange: (e) => setSectionForm({ ...sectionForm, icon: e.target.value }),
|
|
1080
|
-
className: "w-full rounded-lg border border-
|
|
1147
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20"
|
|
1081
1148
|
}
|
|
1082
1149
|
)
|
|
1083
1150
|
] }),
|
|
@@ -1087,7 +1154,7 @@ function DocsAdminPage({
|
|
|
1087
1154
|
className: "block space-y-1",
|
|
1088
1155
|
htmlFor: "docs-admin-section-description",
|
|
1089
1156
|
children: [
|
|
1090
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1157
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Description" }),
|
|
1091
1158
|
/* @__PURE__ */ jsx(
|
|
1092
1159
|
"input",
|
|
1093
1160
|
{
|
|
@@ -1099,14 +1166,14 @@ function DocsAdminPage({
|
|
|
1099
1166
|
...sectionForm,
|
|
1100
1167
|
description: e.target.value
|
|
1101
1168
|
}),
|
|
1102
|
-
className: "w-full rounded-lg border border-
|
|
1169
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20"
|
|
1103
1170
|
}
|
|
1104
1171
|
)
|
|
1105
1172
|
]
|
|
1106
1173
|
}
|
|
1107
1174
|
),
|
|
1108
1175
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-section-access", children: [
|
|
1109
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1176
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Access" }),
|
|
1110
1177
|
/* @__PURE__ */ jsxs(
|
|
1111
1178
|
"select",
|
|
1112
1179
|
{
|
|
@@ -1116,7 +1183,7 @@ function DocsAdminPage({
|
|
|
1116
1183
|
...sectionForm,
|
|
1117
1184
|
access: toDocAccess(e.target.value)
|
|
1118
1185
|
}),
|
|
1119
|
-
className: "w-full rounded-lg border border-
|
|
1186
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20",
|
|
1120
1187
|
children: [
|
|
1121
1188
|
/* @__PURE__ */ jsx("option", { value: "public", children: "Public" }),
|
|
1122
1189
|
/* @__PURE__ */ jsx("option", { value: "team", children: "Team" }),
|
|
@@ -1150,18 +1217,21 @@ function DocsAdminPage({
|
|
|
1150
1217
|
{
|
|
1151
1218
|
type: "button",
|
|
1152
1219
|
onClick: () => setShowSectionForm(false),
|
|
1153
|
-
className: "rounded-lg border border-
|
|
1220
|
+
className: "rounded-lg border border-border px-4 py-2 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
1154
1221
|
children: "Cancel"
|
|
1155
1222
|
}
|
|
1156
1223
|
)
|
|
1157
1224
|
] })
|
|
1158
1225
|
] }),
|
|
1159
1226
|
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
1160
|
-
sections.length === 0 && /* @__PURE__ */ jsx("p", { className: "py-8 text-center text-sm text-
|
|
1227
|
+
sections.length === 0 && /* @__PURE__ */ jsx("p", { className: "py-8 text-center text-sm text-muted-foreground", children: "No sections yet" }),
|
|
1161
1228
|
sections.map((section) => /* @__PURE__ */ jsxs(
|
|
1162
1229
|
"div",
|
|
1163
1230
|
{
|
|
1164
|
-
className:
|
|
1231
|
+
className: cn(
|
|
1232
|
+
"group flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2.5 transition-colors",
|
|
1233
|
+
selectedSectionId === section.id ? "bg-primary/15 text-primary" : "text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
1234
|
+
),
|
|
1165
1235
|
children: [
|
|
1166
1236
|
/* @__PURE__ */ jsxs(
|
|
1167
1237
|
"button",
|
|
@@ -1186,7 +1256,7 @@ function DocsAdminPage({
|
|
|
1186
1256
|
admin.deleteSection(section.id);
|
|
1187
1257
|
}
|
|
1188
1258
|
},
|
|
1189
|
-
className: "rounded p-1 text-
|
|
1259
|
+
className: "rounded p-1 text-muted-foreground/60 opacity-0 transition-opacity group-hover:opacity-100 hover:text-destructive",
|
|
1190
1260
|
"aria-label": `Delete section ${section.title}`,
|
|
1191
1261
|
title: "Delete section",
|
|
1192
1262
|
children: /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", className: "h-3.5 w-3.5", viewBox: "0 0 16 16", fill: "currentColor", children: [
|
|
@@ -1201,9 +1271,9 @@ function DocsAdminPage({
|
|
|
1201
1271
|
))
|
|
1202
1272
|
] })
|
|
1203
1273
|
] }),
|
|
1204
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-
|
|
1274
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card/40 p-5", children: [
|
|
1205
1275
|
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center justify-between", children: [
|
|
1206
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-
|
|
1276
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-foreground", children: selectedSection ? `Pages \u2014 ${selectedSection.title}` : "Pages" }),
|
|
1207
1277
|
selectedSection && /* @__PURE__ */ jsx(
|
|
1208
1278
|
"button",
|
|
1209
1279
|
{
|
|
@@ -1214,10 +1284,10 @@ function DocsAdminPage({
|
|
|
1214
1284
|
}
|
|
1215
1285
|
)
|
|
1216
1286
|
] }),
|
|
1217
|
-
!selectedSection && /* @__PURE__ */ jsx("p", { className: "py-16 text-center text-sm text-
|
|
1218
|
-
showPageForm && selectedSection && /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-2 rounded-lg border border-
|
|
1287
|
+
!selectedSection && /* @__PURE__ */ jsx("p", { className: "py-16 text-center text-sm text-muted-foreground", children: "Select a section to manage pages" }),
|
|
1288
|
+
showPageForm && selectedSection && /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-2 rounded-lg border border-border bg-card/60 p-4", children: [
|
|
1219
1289
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-page-title", children: [
|
|
1220
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1290
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Title" }),
|
|
1221
1291
|
/* @__PURE__ */ jsx(
|
|
1222
1292
|
"input",
|
|
1223
1293
|
{
|
|
@@ -1226,12 +1296,12 @@ function DocsAdminPage({
|
|
|
1226
1296
|
placeholder: "Install the package",
|
|
1227
1297
|
value: pageForm.title,
|
|
1228
1298
|
onChange: (e) => setPageForm({ ...pageForm, title: e.target.value }),
|
|
1229
|
-
className: "w-full rounded-lg border border-
|
|
1299
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20"
|
|
1230
1300
|
}
|
|
1231
1301
|
)
|
|
1232
1302
|
] }),
|
|
1233
1303
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-page-slug", children: [
|
|
1234
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1304
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Slug" }),
|
|
1235
1305
|
/* @__PURE__ */ jsx(
|
|
1236
1306
|
"input",
|
|
1237
1307
|
{
|
|
@@ -1240,12 +1310,12 @@ function DocsAdminPage({
|
|
|
1240
1310
|
placeholder: "install",
|
|
1241
1311
|
value: pageForm.slug,
|
|
1242
1312
|
onChange: (e) => setPageForm({ ...pageForm, slug: e.target.value }),
|
|
1243
|
-
className: "w-full rounded-lg border border-
|
|
1313
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20"
|
|
1244
1314
|
}
|
|
1245
1315
|
)
|
|
1246
1316
|
] }),
|
|
1247
1317
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-page-content", children: [
|
|
1248
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1318
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Content (MDX)" }),
|
|
1249
1319
|
/* @__PURE__ */ jsx(
|
|
1250
1320
|
"textarea",
|
|
1251
1321
|
{
|
|
@@ -1254,12 +1324,12 @@ function DocsAdminPage({
|
|
|
1254
1324
|
value: pageForm.content,
|
|
1255
1325
|
onChange: (e) => setPageForm({ ...pageForm, content: e.target.value }),
|
|
1256
1326
|
rows: 5,
|
|
1257
|
-
className: "w-full rounded-lg border border-
|
|
1327
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20 resize-y"
|
|
1258
1328
|
}
|
|
1259
1329
|
)
|
|
1260
1330
|
] }),
|
|
1261
1331
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-page-tags", children: [
|
|
1262
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1332
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Tags" }),
|
|
1263
1333
|
/* @__PURE__ */ jsx(
|
|
1264
1334
|
"input",
|
|
1265
1335
|
{
|
|
@@ -1268,12 +1338,12 @@ function DocsAdminPage({
|
|
|
1268
1338
|
placeholder: "setup, install",
|
|
1269
1339
|
value: pageForm.tags,
|
|
1270
1340
|
onChange: (e) => setPageForm({ ...pageForm, tags: e.target.value }),
|
|
1271
|
-
className: "w-full rounded-lg border border-
|
|
1341
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20"
|
|
1272
1342
|
}
|
|
1273
1343
|
)
|
|
1274
1344
|
] }),
|
|
1275
1345
|
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", htmlFor: "docs-admin-page-access", children: [
|
|
1276
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-
|
|
1346
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Access" }),
|
|
1277
1347
|
/* @__PURE__ */ jsxs(
|
|
1278
1348
|
"select",
|
|
1279
1349
|
{
|
|
@@ -1283,7 +1353,7 @@ function DocsAdminPage({
|
|
|
1283
1353
|
...pageForm,
|
|
1284
1354
|
access: toDocAccess(e.target.value)
|
|
1285
1355
|
}),
|
|
1286
|
-
className: "w-full rounded-lg border border-
|
|
1356
|
+
className: "w-full rounded-lg border border-border bg-card/70 px-3 py-2 text-sm outline-none focus:border-primary/40 focus:ring-2 focus:ring-ring/20",
|
|
1287
1357
|
children: [
|
|
1288
1358
|
/* @__PURE__ */ jsx("option", { value: "public", children: "Public" }),
|
|
1289
1359
|
/* @__PURE__ */ jsx("option", { value: "team", children: "Team" }),
|
|
@@ -1320,7 +1390,7 @@ function DocsAdminPage({
|
|
|
1320
1390
|
{
|
|
1321
1391
|
type: "button",
|
|
1322
1392
|
onClick: () => setShowPageForm(false),
|
|
1323
|
-
className: "rounded-lg border border-
|
|
1393
|
+
className: "rounded-lg border border-border px-4 py-2 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
1324
1394
|
children: "Cancel"
|
|
1325
1395
|
}
|
|
1326
1396
|
)
|
|
@@ -1329,11 +1399,11 @@ function DocsAdminPage({
|
|
|
1329
1399
|
selectedSection && sectionPages.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-1", children: sectionPages.map((page) => /* @__PURE__ */ jsxs(
|
|
1330
1400
|
"div",
|
|
1331
1401
|
{
|
|
1332
|
-
className: "group flex items-center gap-3 rounded-lg px-3 py-2.5 transition-colors hover:bg-
|
|
1402
|
+
className: "group flex items-center gap-3 rounded-lg px-3 py-2.5 transition-colors hover:bg-muted",
|
|
1333
1403
|
children: [
|
|
1334
1404
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1335
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-
|
|
1336
|
-
/* @__PURE__ */ jsxs("p", { className: "text-[11px] text-
|
|
1405
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground truncate", children: page.title }),
|
|
1406
|
+
/* @__PURE__ */ jsxs("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
1337
1407
|
"/",
|
|
1338
1408
|
page.slug
|
|
1339
1409
|
] })
|
|
@@ -1341,7 +1411,10 @@ function DocsAdminPage({
|
|
|
1341
1411
|
/* @__PURE__ */ jsx(
|
|
1342
1412
|
"span",
|
|
1343
1413
|
{
|
|
1344
|
-
className:
|
|
1414
|
+
className: cn(
|
|
1415
|
+
"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium",
|
|
1416
|
+
page.status === "published" ? "bg-success/15 text-success" : page.status === "archived" ? "bg-muted text-muted-foreground" : "bg-warning/15 text-warning"
|
|
1417
|
+
),
|
|
1345
1418
|
children: page.status
|
|
1346
1419
|
}
|
|
1347
1420
|
),
|
|
@@ -1373,7 +1446,7 @@ function DocsAdminPage({
|
|
|
1373
1446
|
onClick: () => {
|
|
1374
1447
|
if (confirm(`Delete page "${page.title}"?`)) admin.deletePage(page.id);
|
|
1375
1448
|
},
|
|
1376
|
-
className: "rounded p-1 text-
|
|
1449
|
+
className: "rounded p-1 text-muted-foreground/60 hover:text-destructive",
|
|
1377
1450
|
"aria-label": `Delete page ${page.title}`,
|
|
1378
1451
|
title: "Delete",
|
|
1379
1452
|
children: /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", className: "h-3.5 w-3.5", viewBox: "0 0 16 16", fill: "currentColor", children: [
|
|
@@ -1387,14 +1460,15 @@ function DocsAdminPage({
|
|
|
1387
1460
|
},
|
|
1388
1461
|
page.id
|
|
1389
1462
|
)) }),
|
|
1390
|
-
selectedSection && sectionPages.length === 0 && !showPageForm && /* @__PURE__ */ jsx("p", { className: "py-12 text-center text-sm text-
|
|
1463
|
+
selectedSection && sectionPages.length === 0 && !showPageForm && /* @__PURE__ */ jsx("p", { className: "py-12 text-center text-sm text-muted-foreground", children: "No pages in this section" })
|
|
1391
1464
|
] })
|
|
1392
1465
|
] })
|
|
1393
1466
|
] }) });
|
|
1394
1467
|
}
|
|
1395
1468
|
function DocsIndexPage({
|
|
1396
1469
|
tree,
|
|
1397
|
-
onSelectPage
|
|
1470
|
+
onSelectPage,
|
|
1471
|
+
className
|
|
1398
1472
|
}) {
|
|
1399
1473
|
const docs = useDocs(tree);
|
|
1400
1474
|
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
|
@@ -1417,33 +1491,43 @@ function DocsIndexPage({
|
|
|
1417
1491
|
return () => document.removeEventListener("keydown", handler);
|
|
1418
1492
|
}, []);
|
|
1419
1493
|
if (docs.isLoading) {
|
|
1420
|
-
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-
|
|
1421
|
-
/* @__PURE__ */ jsx("div", { className: "mb-10 h-10 w-64 animate-pulse rounded-lg bg-
|
|
1422
|
-
/* @__PURE__ */ jsx("div", { className: "mb-8 h-12 w-full max-w-xl animate-pulse rounded-xl bg-
|
|
1423
|
-
/* @__PURE__ */ jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: Array.from({ length: 6 }, (_, index) => `docs-index-skeleton-${index}`).map((key) => /* @__PURE__ */ jsx("div", { className: "h-36 animate-pulse rounded-xl bg-
|
|
1494
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-h-screen bg-background px-6 py-16", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl", children: [
|
|
1495
|
+
/* @__PURE__ */ jsx("div", { className: "mb-10 h-10 w-64 animate-pulse rounded-lg bg-foreground/5" }),
|
|
1496
|
+
/* @__PURE__ */ jsx("div", { className: "mb-8 h-12 w-full max-w-xl animate-pulse rounded-xl bg-foreground/5" }),
|
|
1497
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: Array.from({ length: 6 }, (_, index) => `docs-index-skeleton-${index}`).map((key) => /* @__PURE__ */ jsx("div", { className: "h-36 animate-pulse rounded-xl bg-foreground/5" }, key)) })
|
|
1424
1498
|
] }) });
|
|
1425
1499
|
}
|
|
1426
1500
|
if (docs.sections.length === 0) {
|
|
1427
|
-
return /* @__PURE__ */ jsxs(
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1501
|
+
return /* @__PURE__ */ jsxs(
|
|
1502
|
+
"div",
|
|
1503
|
+
{
|
|
1504
|
+
className: cn(
|
|
1505
|
+
"flex min-h-screen flex-col items-center justify-center bg-background text-center",
|
|
1506
|
+
className
|
|
1507
|
+
),
|
|
1508
|
+
children: [
|
|
1509
|
+
/* @__PURE__ */ jsx("div", { className: "mb-4 text-6xl opacity-30", children: "\u{1F4DA}" }),
|
|
1510
|
+
/* @__PURE__ */ jsx("h2", { className: "mb-2 text-xl font-semibold text-foreground/80", children: "No documentation yet" }),
|
|
1511
|
+
/* @__PURE__ */ jsx("p", { className: "max-w-sm text-sm text-foreground/40", children: "Create your first section and pages to get started with your documentation." })
|
|
1512
|
+
]
|
|
1513
|
+
}
|
|
1514
|
+
);
|
|
1432
1515
|
}
|
|
1433
|
-
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-
|
|
1516
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("min-h-screen bg-background text-foreground", className), children: [
|
|
1434
1517
|
/* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl px-6 py-16", children: [
|
|
1435
1518
|
/* @__PURE__ */ jsx("h1", { className: "mb-2 text-4xl font-bold tracking-tight", children: "Documentation" }),
|
|
1436
|
-
/* @__PURE__ */ jsx("p", { className: "mb-10 text-lg text-
|
|
1519
|
+
/* @__PURE__ */ jsx("p", { className: "mb-10 text-lg text-foreground/50", children: "Browse guides, API references, and tutorials." }),
|
|
1437
1520
|
/* @__PURE__ */ jsxs(
|
|
1438
1521
|
"button",
|
|
1439
1522
|
{
|
|
1440
1523
|
type: "button",
|
|
1441
1524
|
onClick: () => setIsSearchOpen(true),
|
|
1442
|
-
|
|
1525
|
+
"aria-haspopup": "dialog",
|
|
1526
|
+
className: "mb-12 flex w-full max-w-xl items-center gap-3 rounded-xl border border-border bg-card/60 px-5 py-3.5 text-left text-sm text-muted-foreground transition-colors hover:border-primary/20 hover:bg-card",
|
|
1443
1527
|
children: [
|
|
1444
1528
|
/* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "h-4.5 w-4.5 shrink-0", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z", clipRule: "evenodd" }) }),
|
|
1445
1529
|
/* @__PURE__ */ jsx("span", { className: "flex-1", children: "Search documentation\u2026" }),
|
|
1446
|
-
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-
|
|
1530
|
+
/* @__PURE__ */ jsx("kbd", { className: "rounded border border-border/60 bg-foreground/5 px-2 py-0.5 text-[11px]", children: "\u2318K" })
|
|
1447
1531
|
]
|
|
1448
1532
|
}
|
|
1449
1533
|
),
|
|
@@ -1455,12 +1539,12 @@ function DocsIndexPage({
|
|
|
1455
1539
|
const firstPage = section.pages?.[0];
|
|
1456
1540
|
if (firstPage && onSelectPage) onSelectPage(firstPage, section);
|
|
1457
1541
|
},
|
|
1458
|
-
className: "group flex flex-col rounded-xl border border-
|
|
1542
|
+
className: "group flex flex-col rounded-xl border border-border bg-card/40 p-5 text-left transition-all hover:border-primary/30 hover:bg-card hover:shadow-lg hover:shadow-primary/5",
|
|
1459
1543
|
children: [
|
|
1460
1544
|
section.icon && /* @__PURE__ */ jsx("span", { className: "mb-3 text-2xl", children: section.icon }),
|
|
1461
|
-
/* @__PURE__ */ jsx("h3", { className: "mb-1.5 text-base font-semibold text-
|
|
1462
|
-
section.description && /* @__PURE__ */ jsx("p", { className: "mb-3 flex-1 text-sm leading-relaxed text-
|
|
1463
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 text-xs text-
|
|
1545
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-1.5 text-base font-semibold text-foreground/90 group-hover:text-foreground transition-colors", children: section.title }),
|
|
1546
|
+
section.description && /* @__PURE__ */ jsx("p", { className: "mb-3 flex-1 text-sm leading-relaxed text-foreground/40", children: section.description }),
|
|
1547
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 text-xs text-foreground/25", children: /* @__PURE__ */ jsxs("span", { children: [
|
|
1464
1548
|
section.pageCount ?? 0,
|
|
1465
1549
|
" pages"
|
|
1466
1550
|
] }) })
|
|
@@ -1469,7 +1553,7 @@ function DocsIndexPage({
|
|
|
1469
1553
|
section.id
|
|
1470
1554
|
)) }),
|
|
1471
1555
|
docs.flatPages.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-16", children: [
|
|
1472
|
-
/* @__PURE__ */ jsx("h2", { className: "mb-6 text-lg font-semibold text-
|
|
1556
|
+
/* @__PURE__ */ jsx("h2", { className: "mb-6 text-lg font-semibold text-foreground/80", children: "Recently updated" }),
|
|
1473
1557
|
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: docs.flatPages.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()).slice(0, 8).map((page) => {
|
|
1474
1558
|
const section = docs.sections.find((s) => s.id === page.sectionId);
|
|
1475
1559
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1477,13 +1561,13 @@ function DocsIndexPage({
|
|
|
1477
1561
|
{
|
|
1478
1562
|
type: "button",
|
|
1479
1563
|
onClick: () => section && onSelectPage?.(page, section),
|
|
1480
|
-
className: "flex w-full items-center gap-4 rounded-lg px-4 py-3 text-left transition-colors hover:bg-
|
|
1564
|
+
className: "flex w-full items-center gap-4 rounded-lg px-4 py-3 text-left transition-colors hover:bg-muted",
|
|
1481
1565
|
children: [
|
|
1482
1566
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1483
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-
|
|
1484
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-
|
|
1567
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground/80 truncate", children: page.title }),
|
|
1568
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-foreground/30 truncate", children: section?.title })
|
|
1485
1569
|
] }),
|
|
1486
|
-
/* @__PURE__ */ jsxs("span", { className: "shrink-0 text-xs tabular-nums text-
|
|
1570
|
+
/* @__PURE__ */ jsxs("span", { className: "shrink-0 text-xs tabular-nums text-foreground/20", children: [
|
|
1487
1571
|
page.readingTime,
|
|
1488
1572
|
" min read"
|
|
1489
1573
|
] })
|
|
@@ -1518,7 +1602,8 @@ function DocViewPage({
|
|
|
1518
1602
|
page,
|
|
1519
1603
|
editPageUrl,
|
|
1520
1604
|
onNavigate,
|
|
1521
|
-
onIncrementView
|
|
1605
|
+
onIncrementView,
|
|
1606
|
+
className
|
|
1522
1607
|
}) {
|
|
1523
1608
|
const docs = useDocs(tree);
|
|
1524
1609
|
const { toc, activeId } = useTableOfContents(page?.content);
|
|
@@ -1542,21 +1627,30 @@ function DocViewPage({
|
|
|
1542
1627
|
};
|
|
1543
1628
|
}, [page, docs.flatPages, docs.sections]);
|
|
1544
1629
|
if (docs.isLoading || page === void 0) {
|
|
1545
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-screen bg-
|
|
1546
|
-
/* @__PURE__ */ jsx("div", { className: "hidden w-[260px] shrink-0 border-r border-
|
|
1630
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-screen bg-background", className), children: [
|
|
1631
|
+
/* @__PURE__ */ jsx("div", { className: "hidden w-[260px] shrink-0 border-r border-border bg-card lg:block", children: /* @__PURE__ */ jsx("div", { className: "space-y-3 p-4", children: Array.from({ length: 8 }, (_, index) => `doc-view-sidebar-skeleton-${index}`).map((key) => /* @__PURE__ */ jsx("div", { className: "h-8 animate-pulse rounded-lg bg-foreground/5" }, key)) }) }),
|
|
1547
1632
|
/* @__PURE__ */ jsx("div", { className: "flex-1 px-10 py-8", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-3xl space-y-4", children: [
|
|
1548
|
-
/* @__PURE__ */ jsx("div", { className: "h-5 w-48 animate-pulse rounded bg-
|
|
1549
|
-
/* @__PURE__ */ jsx("div", { className: "h-10 w-96 animate-pulse rounded bg-
|
|
1550
|
-
/* @__PURE__ */ jsx("div", { className: "mt-8 space-y-3", children: Array.from({ length: 12 }, (_, index) => `doc-view-body-skeleton-${index}`).map((key, index) => /* @__PURE__ */ jsx("div", { className: "h-4 animate-pulse rounded bg-
|
|
1633
|
+
/* @__PURE__ */ jsx("div", { className: "h-5 w-48 animate-pulse rounded bg-foreground/5" }),
|
|
1634
|
+
/* @__PURE__ */ jsx("div", { className: "h-10 w-96 animate-pulse rounded bg-foreground/5" }),
|
|
1635
|
+
/* @__PURE__ */ jsx("div", { className: "mt-8 space-y-3", children: Array.from({ length: 12 }, (_, index) => `doc-view-body-skeleton-${index}`).map((key, index) => /* @__PURE__ */ jsx("div", { className: "h-4 animate-pulse rounded bg-foreground/5", style: { width: `${60 + index * 3}%` } }, key)) })
|
|
1551
1636
|
] }) })
|
|
1552
1637
|
] });
|
|
1553
1638
|
}
|
|
1554
1639
|
if (!page) {
|
|
1555
|
-
return /* @__PURE__ */ jsxs(
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1640
|
+
return /* @__PURE__ */ jsxs(
|
|
1641
|
+
"div",
|
|
1642
|
+
{
|
|
1643
|
+
className: cn(
|
|
1644
|
+
"flex min-h-screen flex-col items-center justify-center bg-background text-center",
|
|
1645
|
+
className
|
|
1646
|
+
),
|
|
1647
|
+
children: [
|
|
1648
|
+
/* @__PURE__ */ jsx("div", { className: "mb-4 text-6xl opacity-30", children: "\u{1F50D}" }),
|
|
1649
|
+
/* @__PURE__ */ jsx("h2", { className: "mb-2 text-xl font-semibold text-foreground/80", children: "Page not found" }),
|
|
1650
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-foreground/40", children: "The documentation page you're looking for doesn't exist." })
|
|
1651
|
+
]
|
|
1652
|
+
}
|
|
1653
|
+
);
|
|
1560
1654
|
}
|
|
1561
1655
|
return /* @__PURE__ */ jsxs(
|
|
1562
1656
|
DocsLayout,
|
|
@@ -1568,10 +1662,11 @@ function DocViewPage({
|
|
|
1568
1662
|
breadcrumbs,
|
|
1569
1663
|
currentPageId: page.id,
|
|
1570
1664
|
onNavigate,
|
|
1665
|
+
className,
|
|
1571
1666
|
children: [
|
|
1572
1667
|
/* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
|
|
1573
1668
|
/* @__PURE__ */ jsx("h1", { className: "mb-3 text-3xl font-bold tracking-tight", children: page.title }),
|
|
1574
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4 text-sm text-
|
|
1669
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4 text-sm text-foreground/40", children: [
|
|
1575
1670
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
1576
1671
|
page.author.avatar ? /* @__PURE__ */ jsx("img", { src: page.author.avatar, alt: "", className: "h-5 w-5 rounded-full" }) : /* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-primary/20 text-[10px] text-primary", children: page.author.name[0] }),
|
|
1577
1672
|
page.author.name
|
|
@@ -1589,12 +1684,12 @@ function DocViewPage({
|
|
|
1589
1684
|
" views"
|
|
1590
1685
|
] })
|
|
1591
1686
|
] }),
|
|
1592
|
-
page.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap gap-1.5", children: page.tags.map((tag) => /* @__PURE__ */ jsx("span", { className: "rounded-full bg-
|
|
1687
|
+
page.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap gap-1.5", children: page.tags.map((tag) => /* @__PURE__ */ jsx("span", { className: "rounded-full bg-foreground/5 px-2.5 py-0.5 text-xs text-foreground/40", children: tag }, tag)) })
|
|
1593
1688
|
] }),
|
|
1594
1689
|
/* @__PURE__ */ jsx(DocPage, { page }),
|
|
1595
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-10 flex items-center justify-between border-t border-
|
|
1690
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-10 flex items-center justify-between border-t border-border/40 pt-6", children: [
|
|
1596
1691
|
/* @__PURE__ */ jsx(EditButton, { pageSlug: page.slug, editUrl: editPageUrl }),
|
|
1597
|
-
page.version && /* @__PURE__ */ jsxs("span", { className: "text-xs text-
|
|
1692
|
+
page.version && /* @__PURE__ */ jsxs("span", { className: "text-xs text-foreground/25", children: [
|
|
1598
1693
|
"v",
|
|
1599
1694
|
page.version
|
|
1600
1695
|
] })
|