@docubook/create 2.3.0 → 2.5.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/package.json +1 -1
- package/src/dist/app/docs/[[...slug]]/page.tsx +56 -63
- package/src/dist/app/docs/layout.tsx +11 -4
- package/src/dist/app/layout.tsx +10 -9
- package/src/dist/app/page.tsx +3 -22
- package/src/dist/components/{context-popover.tsx → ContextPopover.tsx} +4 -3
- package/src/dist/components/{docs-breadcrumb.tsx → DocsBreadcrumb.tsx} +1 -1
- package/src/dist/components/{docs-menu.tsx → DocsMenu.tsx} +2 -2
- package/src/dist/components/DocsNavbar.tsx +46 -0
- package/src/dist/components/DocsSidebar.tsx +196 -0
- package/src/dist/components/Github.tsx +26 -0
- package/src/dist/components/{scroll-to-top.tsx → ScrollToTop.tsx} +16 -9
- package/src/dist/components/SearchBox.tsx +37 -0
- package/src/dist/components/SearchContext.tsx +47 -0
- package/src/dist/components/SearchModal.tsx +2 -2
- package/src/dist/components/SearchTrigger.tsx +5 -5
- package/src/dist/components/Sponsor.tsx +2 -2
- package/src/dist/components/{theme-toggle.tsx → ThemeToggle.tsx} +10 -10
- package/src/dist/components/TocObserver.tsx +197 -0
- package/src/dist/components/footer.tsx +16 -12
- package/src/dist/components/leftbar.tsx +45 -73
- package/src/dist/components/markdown/AccordionGroupMdx.tsx +1 -1
- package/src/dist/components/markdown/AccordionMdx.tsx +4 -4
- package/src/dist/components/markdown/CardMdx.tsx +4 -4
- package/src/dist/components/markdown/FileTreeMdx.tsx +4 -4
- package/src/dist/components/markdown/ImageMdx.tsx +1 -1
- package/src/dist/components/markdown/ReleaseMdx.tsx +1 -1
- package/src/dist/components/markdown/TooltipsMdx.tsx +1 -1
- package/src/dist/components/navbar.tsx +130 -53
- package/src/dist/components/sublink.tsx +1 -1
- package/src/dist/components/toc.tsx +16 -14
- package/src/dist/components/typography.tsx +1 -1
- package/src/dist/components/ui/icon-cloud.tsx +353 -0
- package/src/dist/components/ui/scroll-area.tsx +2 -2
- package/src/dist/components/ui/sheet.tsx +4 -4
- package/src/dist/components/ui/toggle.tsx +3 -3
- package/src/dist/docs/components/accordion-group.mdx +68 -0
- package/src/dist/docs/components/accordion.mdx +59 -0
- package/src/dist/docs/components/button.mdx +40 -0
- package/src/dist/docs/components/card-group.mdx +47 -0
- package/src/dist/docs/components/card.mdx +68 -0
- package/src/dist/docs/components/code-block.mdx +67 -0
- package/src/dist/docs/components/custom.mdx +38 -0
- package/src/dist/docs/components/file-tree.mdx +109 -0
- package/src/dist/docs/components/image.mdx +37 -0
- package/src/dist/docs/components/index.mdx +9 -0
- package/src/dist/docs/components/keyboard.mdx +117 -0
- package/src/dist/docs/components/link.mdx +34 -0
- package/src/dist/docs/components/note.mdx +44 -0
- package/src/dist/docs/components/release-note.mdx +114 -0
- package/src/dist/docs/components/stepper.mdx +45 -0
- package/src/dist/docs/components/tables.mdx +35 -0
- package/src/dist/docs/components/tabs.mdx +72 -0
- package/src/dist/docs/components/tooltips.mdx +22 -0
- package/src/dist/docs/components/youtube.mdx +23 -0
- package/src/dist/docs/getting-started/introduction.mdx +18 -0
- package/src/dist/docs/getting-started/quick-start-guide.mdx +60 -0
- package/src/dist/docu.json +36 -33
- package/src/dist/eslint.config.mjs +17 -30
- package/src/dist/hooks/useActiveSection.ts +34 -32
- package/src/dist/hooks/useScrollPosition.ts +16 -14
- package/src/dist/lib/markdown.ts +32 -17
- package/src/dist/lib/utils.ts +1 -1
- package/src/dist/next.config.mjs +10 -11
- package/src/dist/package.json +1 -1
- package/src/dist/styles/algolia.css +11 -9
- package/src/dist/styles/{syntax.css → override.css} +82 -39
- package/src/dist/tailwind.config.ts +11 -110
- package/src/dist/components/GithubStart.tsx +0 -44
- package/src/dist/components/mob-toc.tsx +0 -134
- package/src/dist/components/search.tsx +0 -55
- package/src/dist/components/toc-observer.tsx +0 -254
- package/src/dist/docs/api-reference/delete/index.mdx +0 -63
- package/src/dist/docs/api-reference/fetch/index.mdx +0 -63
- package/src/dist/docs/api-reference/get/index.mdx +0 -63
- package/src/dist/docs/api-reference/post/index.mdx +0 -63
- package/src/dist/docs/changelog/index.mdx +0 -49
- package/src/dist/docs/getting-started/development/index.mdx +0 -92
- package/src/dist/docs/getting-started/introduction/index.mdx +0 -92
- package/src/dist/docs/getting-started/quick-start-guide/index.mdx +0 -92
- /package/src/dist/components/{edit-on-github.tsx → EditWithGithub.tsx} +0 -0
- /package/src/dist/components/{contexts/theme-provider.tsx → ThemeProvider.tsx} +0 -0
- /package/src/dist/{components/contexts/AccordionContext.ts → lib/accordion-context.ts} +0 -0
- /package/src/dist/lib/{routes-config.ts → routes.ts} +0 -0
|
@@ -24,7 +24,7 @@ const FileComponent = ({ name }: FileProps) => {
|
|
|
24
24
|
tabIndex={-1}
|
|
25
25
|
>
|
|
26
26
|
<FileIcon className={`
|
|
27
|
-
h-3.5 w-3.5
|
|
27
|
+
h-3.5 w-3.5 shrink-0 transition-colors
|
|
28
28
|
${isHovered ? 'text-accent' : 'text-muted-foreground'}
|
|
29
29
|
`} />
|
|
30
30
|
<span className="font-mono text-sm text-foreground truncate">{name}</span>
|
|
@@ -61,7 +61,7 @@ const FolderComponent = ({ name, children }: FileProps) => {
|
|
|
61
61
|
{hasChildren ? (
|
|
62
62
|
<ChevronRight
|
|
63
63
|
className={`
|
|
64
|
-
h-3.5 w-3.5
|
|
64
|
+
h-3.5 w-3.5 shrink-0 transition-transform duration-200
|
|
65
65
|
${isOpen ? 'rotate-90' : ''}
|
|
66
66
|
${isHovered ? 'text-foreground/70' : 'text-muted-foreground'}
|
|
67
67
|
`}
|
|
@@ -71,12 +71,12 @@ const FolderComponent = ({ name, children }: FileProps) => {
|
|
|
71
71
|
)}
|
|
72
72
|
{isOpen ? (
|
|
73
73
|
<FolderOpen className={`
|
|
74
|
-
h-4 w-4
|
|
74
|
+
h-4 w-4 shrink-0 transition-colors
|
|
75
75
|
${isHovered ? 'text-accent' : 'text-muted-foreground'}
|
|
76
76
|
`} />
|
|
77
77
|
) : (
|
|
78
78
|
<FolderIcon className={`
|
|
79
|
-
h-4 w-4
|
|
79
|
+
h-4 w-4 shrink-0 transition-colors
|
|
80
80
|
${isHovered ? 'text-accent/80' : 'text-muted-foreground/80'}
|
|
81
81
|
`} />
|
|
82
82
|
)}
|
|
@@ -69,7 +69,7 @@ export default function Image({
|
|
|
69
69
|
initial={{ opacity: 0 }}
|
|
70
70
|
animate={{ opacity: 1 }}
|
|
71
71
|
exit={{ opacity: 0 }}
|
|
72
|
-
className="fixed inset-0 z-
|
|
72
|
+
className="fixed inset-0 z-99999 flex items-center justify-center bg-black/90 backdrop-blur-md p-4 md:p-10 cursor-zoom-out"
|
|
73
73
|
onClick={() => setIsOpen(false)}
|
|
74
74
|
>
|
|
75
75
|
{/* Close Button */}
|
|
@@ -32,7 +32,7 @@ function Release({ version, title, date, children }: ReleaseProps) {
|
|
|
32
32
|
</div>
|
|
33
33
|
)}
|
|
34
34
|
</div>
|
|
35
|
-
<h3 className="text-2xl font-bold text-foreground/90 mb-6
|
|
35
|
+
<h3 className="text-2xl font-bold text-foreground/90 mb-6 mt-0!">
|
|
36
36
|
{title}
|
|
37
37
|
</h3>
|
|
38
38
|
<div className="space-y-8">
|
|
@@ -19,7 +19,7 @@ const Tooltip: React.FC<TooltipProps> = ({ text, tip }) => {
|
|
|
19
19
|
{text}
|
|
20
20
|
</span>
|
|
21
21
|
{visible && (
|
|
22
|
-
<span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-3 w-64 bg-popover text-popover-foreground text-sm p-3 rounded-md shadow-lg border border-border/50 break-
|
|
22
|
+
<span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-3 w-64 bg-popover text-popover-foreground text-sm p-3 rounded-md shadow-lg border border-border/50 wrap-break-word text-left z-50">
|
|
23
23
|
{tip}
|
|
24
24
|
<span className="absolute -bottom-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-popover rotate-45 border-b border-r border-border/50 -z-10" />
|
|
25
25
|
</span>
|
|
@@ -1,87 +1,164 @@
|
|
|
1
|
-
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import Image from "next/image";
|
|
4
|
-
import Search from "@/components/search";
|
|
5
|
-
import Anchor from "@/components/anchor";
|
|
6
|
-
import { SheetLeftbar } from "@/components/leftbar";
|
|
7
|
-
import { SheetClose } from "@/components/ui/sheet";
|
|
8
|
-
import { Separator } from "@/components/ui/separator";
|
|
9
|
-
import docuConfig from "@/docu.json"; // Import JSON
|
|
1
|
+
"use client"
|
|
10
2
|
|
|
11
|
-
|
|
3
|
+
import { ArrowUpRight, ChevronDown, ChevronUp } from "lucide-react"
|
|
4
|
+
import Link from "next/link"
|
|
5
|
+
import Image from "next/image"
|
|
6
|
+
import Search from "@/components/SearchBox"
|
|
7
|
+
import Anchor from "@/components/anchor"
|
|
8
|
+
import { Separator } from "@/components/ui/separator"
|
|
9
|
+
import docuConfig from "@/docu.json"
|
|
10
|
+
import GitHubButton from "@/components/Github"
|
|
11
|
+
import { Button } from "@/components/ui/button"
|
|
12
|
+
import { useState, useCallback } from "react"
|
|
13
|
+
import { motion, AnimatePresence } from "framer-motion"
|
|
14
|
+
import { ModeToggle } from "@/components/ThemeToggle"
|
|
15
|
+
|
|
16
|
+
interface NavbarProps {
|
|
17
|
+
id?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function Navbar({ id }: NavbarProps) {
|
|
21
|
+
const [isMenuOpen, setIsMenuOpen] = useState(false)
|
|
22
|
+
|
|
23
|
+
const toggleMenu = useCallback(() => {
|
|
24
|
+
setIsMenuOpen((prev) => !prev)
|
|
25
|
+
}, [])
|
|
12
26
|
|
|
13
27
|
return (
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
<div className="flex items-center gap-
|
|
17
|
-
<SheetLeftbar />
|
|
28
|
+
<div className="sticky top-0 z-50 w-full">
|
|
29
|
+
<nav id={id} className="bg-background h-16 w-full border-b">
|
|
30
|
+
<div className="mx-auto flex h-full w-[95vw] items-center justify-between sm:container md:gap-2">
|
|
18
31
|
<div className="flex items-center gap-6">
|
|
19
|
-
<div className="
|
|
32
|
+
<div className="flex">
|
|
20
33
|
<Logo />
|
|
21
34
|
</div>
|
|
22
35
|
</div>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<div className="items-center hidden gap-4 text-sm font-medium lg:flex text-muted-foreground">
|
|
36
|
+
<div className="flex items-center md:gap-2 gap-0 max-md:flex-row-reverse">
|
|
37
|
+
<div className="text-muted-foreground hidden items-center gap-4 text-sm font-medium md:flex">
|
|
26
38
|
<NavMenu />
|
|
27
39
|
</div>
|
|
28
|
-
<
|
|
40
|
+
<Button
|
|
41
|
+
variant="ghost"
|
|
42
|
+
size="sm"
|
|
43
|
+
onClick={toggleMenu}
|
|
44
|
+
aria-label={isMenuOpen ? "Close navigation menu" : "Open navigation menu"}
|
|
45
|
+
aria-expanded={isMenuOpen}
|
|
46
|
+
className="flex items-center gap-1 px-2 text-sm font-medium md:hidden"
|
|
47
|
+
>
|
|
48
|
+
{isMenuOpen ? (
|
|
49
|
+
<ChevronUp className="h-6 w-6 text-muted-foreground" />
|
|
50
|
+
) : (
|
|
51
|
+
<ChevronDown className="h-6 w-6 text-muted-foreground" />
|
|
52
|
+
)}
|
|
53
|
+
</Button>
|
|
54
|
+
|
|
55
|
+
<Separator className="my-4 hidden h-9 md:flex" orientation="vertical" />
|
|
29
56
|
<Search />
|
|
57
|
+
<div className="hidden md:flex">
|
|
58
|
+
<GitHubButton />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
30
61
|
</div>
|
|
31
|
-
</
|
|
32
|
-
|
|
33
|
-
|
|
62
|
+
</nav>
|
|
63
|
+
|
|
64
|
+
<AnimatePresence>
|
|
65
|
+
{isMenuOpen && (
|
|
66
|
+
<motion.div
|
|
67
|
+
initial={{ opacity: 0, height: 0 }}
|
|
68
|
+
animate={{ opacity: 1, height: "auto" }}
|
|
69
|
+
exit={{ opacity: 0, height: 0 }}
|
|
70
|
+
transition={{ duration: 0.2, ease: "easeInOut" }}
|
|
71
|
+
className="bg-background/95 w-full border-b shadow-sm backdrop-blur-sm md:hidden"
|
|
72
|
+
>
|
|
73
|
+
<div className="mx-auto w-[95vw] sm:container">
|
|
74
|
+
<ul className="flex flex-col py-2">
|
|
75
|
+
<NavMenuCollapsible onItemClick={() => setIsMenuOpen(false)} />
|
|
76
|
+
</ul>
|
|
77
|
+
<div className="flex items-center justify-between border-t px-1 py-3">
|
|
78
|
+
<GitHubButton />
|
|
79
|
+
<ModeToggle />
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</motion.div>
|
|
83
|
+
)}
|
|
84
|
+
</AnimatePresence>
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
34
87
|
}
|
|
35
88
|
|
|
36
89
|
export function Logo() {
|
|
37
|
-
|
|
90
|
+
const { navbar } = docuConfig
|
|
38
91
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
92
|
+
return (
|
|
93
|
+
<Link href="/" className="flex items-center gap-1.5">
|
|
94
|
+
<div className="relative h-8 w-8">
|
|
95
|
+
<Image
|
|
96
|
+
src={navbar.logo.src}
|
|
97
|
+
alt={navbar.logo.alt}
|
|
98
|
+
fill
|
|
99
|
+
sizes="32px"
|
|
100
|
+
className="object-contain"
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
<h2 className="font-code dark:text-accent text-primary text-lg font-bold">
|
|
104
|
+
{navbar.logoText}
|
|
105
|
+
</h2>
|
|
106
|
+
</Link>
|
|
107
|
+
)
|
|
53
108
|
}
|
|
54
109
|
|
|
55
|
-
|
|
56
|
-
|
|
110
|
+
// Desktop NavMenu — horizontal list
|
|
111
|
+
export function NavMenu() {
|
|
112
|
+
const { navbar } = docuConfig
|
|
57
113
|
|
|
58
114
|
return (
|
|
59
115
|
<>
|
|
60
116
|
{navbar?.menu?.map((item) => {
|
|
61
|
-
const isExternal = item.href.startsWith("http")
|
|
62
|
-
|
|
63
|
-
const Comp = (
|
|
117
|
+
const isExternal = item.href.startsWith("http")
|
|
118
|
+
return (
|
|
64
119
|
<Anchor
|
|
65
120
|
key={`${item.title}-${item.href}`}
|
|
66
121
|
activeClassName="text-primary dark:text-accent md:font-semibold font-medium"
|
|
67
122
|
absolute
|
|
68
|
-
className="
|
|
123
|
+
className="text-foreground/80 hover:text-foreground flex items-center gap-1 transition-colors"
|
|
69
124
|
href={item.href}
|
|
70
125
|
target={isExternal ? "_blank" : undefined}
|
|
71
126
|
rel={isExternal ? "noopener noreferrer" : undefined}
|
|
72
127
|
>
|
|
73
128
|
{item.title}
|
|
74
|
-
{isExternal && <ArrowUpRight className="
|
|
129
|
+
{isExternal && <ArrowUpRight className="text-foreground/80 h-4 w-4" />}
|
|
75
130
|
</Anchor>
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
131
|
+
)
|
|
132
|
+
})}
|
|
133
|
+
</>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Mobile Collapsible NavMenu — vertical list items
|
|
138
|
+
function NavMenuCollapsible({ onItemClick }: { onItemClick: () => void }) {
|
|
139
|
+
const { navbar } = docuConfig
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<>
|
|
143
|
+
{navbar?.menu?.map((item) => {
|
|
144
|
+
const isExternal = item.href.startsWith("http")
|
|
145
|
+
return (
|
|
146
|
+
<li key={item.title + item.href}>
|
|
147
|
+
<Anchor
|
|
148
|
+
activeClassName="text-primary dark:text-accent font-semibold"
|
|
149
|
+
absolute
|
|
150
|
+
className="text-foreground/80 hover:text-foreground hover:bg-muted flex w-full items-center justify-between gap-2 rounded-md px-3 py-2.5 text-sm font-medium transition-colors"
|
|
151
|
+
href={item.href}
|
|
152
|
+
target={isExternal ? "_blank" : undefined}
|
|
153
|
+
rel={isExternal ? "noopener noreferrer" : undefined}
|
|
154
|
+
onClick={onItemClick}
|
|
155
|
+
>
|
|
156
|
+
{item.title}
|
|
157
|
+
{isExternal && <ArrowUpRight className="text-foreground/60 h-4 w-4 shrink-0" />}
|
|
158
|
+
</Anchor>
|
|
159
|
+
</li>
|
|
160
|
+
)
|
|
84
161
|
})}
|
|
85
162
|
</>
|
|
86
|
-
)
|
|
163
|
+
)
|
|
87
164
|
}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import TocObserver from "./toc-observer";
|
|
3
|
-
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
4
|
-
import { ListIcon } from "lucide-react";
|
|
5
|
-
import Sponsor from "./Sponsor";
|
|
1
|
+
"use client"
|
|
6
2
|
|
|
3
|
+
import TocObserver from "./TocObserver"
|
|
4
|
+
import { ScrollArea } from "@/components/ui/scroll-area"
|
|
5
|
+
import { ListIcon } from "lucide-react"
|
|
6
|
+
import Sponsor from "./Sponsor"
|
|
7
|
+
import { useActiveSection } from "@/hooks"
|
|
8
|
+
import { TocItem } from "@/lib/toc"
|
|
7
9
|
|
|
8
|
-
export default
|
|
9
|
-
const
|
|
10
|
+
export default function Toc({ tocs }: { tocs: TocItem[] }) {
|
|
11
|
+
const { activeId, setActiveId } = useActiveSection(tocs)
|
|
10
12
|
|
|
11
13
|
return (
|
|
12
|
-
<div className="
|
|
13
|
-
<div className="
|
|
14
|
+
<div className="toc flex-3 sticky top-4 hidden h-[calc(100vh-8rem)] min-w-[238px] self-start lg:flex lg:p-8">
|
|
15
|
+
<div className="mb-auto flex h-full w-full flex-col gap-2 px-2">
|
|
14
16
|
<div className="flex items-center gap-2">
|
|
15
|
-
<ListIcon className="
|
|
16
|
-
<h3 className="font-medium
|
|
17
|
+
<ListIcon className="h-4 w-4" />
|
|
18
|
+
<h3 className="text-sm font-medium">On this page</h3>
|
|
17
19
|
</div>
|
|
18
|
-
<div className="
|
|
20
|
+
<div className="max-h-[calc(70vh-2rem)] min-h-0 shrink-0">
|
|
19
21
|
<ScrollArea className="h-full">
|
|
20
|
-
<TocObserver data={tocs} />
|
|
22
|
+
<TocObserver data={tocs} activeId={activeId} onActiveIdChange={setActiveId} />
|
|
21
23
|
</ScrollArea>
|
|
22
24
|
</div>
|
|
23
25
|
<Sponsor />
|
|
24
26
|
</div>
|
|
25
27
|
</div>
|
|
26
|
-
)
|
|
28
|
+
)
|
|
27
29
|
}
|
|
@@ -2,7 +2,7 @@ import { PropsWithChildren } from "react";
|
|
|
2
2
|
|
|
3
3
|
export function Typography({ children }: PropsWithChildren) {
|
|
4
4
|
return (
|
|
5
|
-
<div className="prose prose-zinc dark:prose-invert prose-code:font-code dark:prose-code:bg-stone-900/25 prose-code:bg-stone-50 prose-pre:bg-background prose-headings:scroll-m-
|
|
5
|
+
<div className="prose prose-zinc dark:prose-invert prose-code:font-code dark:prose-code:bg-stone-900/25 prose-code:bg-stone-50 prose-pre:bg-background prose-headings:scroll-m-4 w-[85vw] sm:w-full sm:mx-auto prose-code:text-sm prose-code:leading-6 dark:prose-code:text-white prose-code:text-stone-800 prose-code:p-1 prose-code:rounded-md prose-code:border pt-2 min-w-full! prose-img:rounded-md prose-img:border prose-code:before:content-none prose-code:after:content-none prose-code:px-1.5 prose-code:overflow-x-auto max-w-[500px]! prose-img:my-3 prose-h2:my-4 prose-h2:mt-8">
|
|
6
6
|
{children}
|
|
7
7
|
</div>
|
|
8
8
|
);
|