@docubook/create 2.0.0-beta.1 → 2.0.0-beta.2
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 +6 -7
- package/src/dist/app/page.tsx +1 -1
- package/src/dist/components/context-popover.tsx +1 -1
- package/src/dist/components/markdown/AccordionMdx.tsx +1 -1
- package/src/dist/components/markdown/CopyMdx.tsx +1 -1
- package/src/dist/components/markdown/ImageMdx.tsx +118 -18
- package/src/dist/components/markdown/NoteMdx.tsx +46 -29
- package/src/dist/components/sublink.tsx +1 -1
- package/src/dist/components/theme-toggle.tsx +2 -2
- package/src/dist/components/ui/tabs.tsx +1 -1
- package/src/dist/package.json +2 -2
package/package.json
CHANGED
|
@@ -97,17 +97,16 @@ export default async function DocsPage(props: PageProps) {
|
|
|
97
97
|
<p className="-mt-4 text-muted-foreground text-[16.5px]">{description}</p>
|
|
98
98
|
<div>{res.content}</div>
|
|
99
99
|
<div
|
|
100
|
-
className={`my-8 flex items-center border-b-2 border-dashed border-x-muted-foreground ${
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
>
|
|
100
|
+
className={`my-8 flex items-center border-b-2 border-dashed border-x-muted-foreground ${docuConfig.repository?.editLink ? "justify-between" : "justify-end"
|
|
101
|
+
}`}
|
|
102
|
+
>
|
|
104
103
|
{docuConfig.repository?.editLink && <EditThisPage filePath={filePath} />}
|
|
105
104
|
{date && (
|
|
106
|
-
|
|
105
|
+
<p className="text-[13px] text-muted-foreground">
|
|
107
106
|
Published on {formatDate2(date)}
|
|
108
|
-
|
|
107
|
+
</p>
|
|
109
108
|
)}
|
|
110
|
-
|
|
109
|
+
</div>
|
|
111
110
|
<Pagination pathname={pathName} />
|
|
112
111
|
</Typography>
|
|
113
112
|
</div>
|
package/src/dist/app/page.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export default function Home() {
|
|
|
25
25
|
)}
|
|
26
26
|
>
|
|
27
27
|
<AnimatedShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-100 hover:duration-300 hover:dark:text-neutral-200">
|
|
28
|
-
<span>🚀 Release v2.0.0-beta.
|
|
28
|
+
<span>🚀 Release v2.0.0-beta.2</span>
|
|
29
29
|
<ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" />
|
|
30
30
|
</AnimatedShinyText>
|
|
31
31
|
</div>
|
|
@@ -96,7 +96,7 @@ export default function ContextPopover({ className }: ContextPopoverProps) {
|
|
|
96
96
|
key={route.href}
|
|
97
97
|
onClick={() => router.push(contextPath)}
|
|
98
98
|
className={cn(
|
|
99
|
-
"relative flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm",
|
|
99
|
+
"relative flex w-full items-center gap-2 cursor-pointer rounded px-2 py-1.5 text-sm",
|
|
100
100
|
"text-left outline-none transition-colors",
|
|
101
101
|
isActive
|
|
102
102
|
? "bg-primary/20 text-primary dark:bg-accent/20 dark:text-accent"
|
|
@@ -38,7 +38,7 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
38
38
|
<button
|
|
39
39
|
type="button"
|
|
40
40
|
onClick={() => setIsOpen(!isOpen)}
|
|
41
|
-
className="flex items-center gap-2 w-full px-4 h-12 transition-colors bg-muted/40 dark:bg-muted/20 hover:bg-muted/70 dark:hover:bg-muted/70"
|
|
41
|
+
className="flex items-center gap-2 w-full px-4 h-12 transition-colors bg-muted/40 dark:bg-muted/20 hover:bg-muted/70 dark:hover:bg-muted/70 cursor-pointer"
|
|
42
42
|
>
|
|
43
43
|
<ChevronRight
|
|
44
44
|
className={cn(
|
|
@@ -1,29 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentProps, useState, useEffect } from "react";
|
|
2
4
|
import NextImage from "next/image";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { motion, AnimatePresence } from "framer-motion";
|
|
7
|
+
import { X, ZoomIn } from "lucide-react";
|
|
3
8
|
|
|
4
9
|
type Height = ComponentProps<typeof NextImage>["height"];
|
|
5
10
|
type Width = ComponentProps<typeof NextImage>["width"];
|
|
6
11
|
|
|
7
12
|
type ImageProps = Omit<ComponentProps<"img">, "src"> & {
|
|
8
|
-
|
|
13
|
+
src?: ComponentProps<typeof NextImage>["src"];
|
|
9
14
|
};
|
|
10
15
|
|
|
11
16
|
export default function Image({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
src,
|
|
18
|
+
alt = "alt",
|
|
19
|
+
width = 800,
|
|
20
|
+
height = 350,
|
|
21
|
+
...props
|
|
17
22
|
}: ImageProps) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
24
|
+
|
|
25
|
+
// Lock scroll when open
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (isOpen) {
|
|
28
|
+
document.body.style.overflow = "hidden";
|
|
29
|
+
// Check for Escape key
|
|
30
|
+
const handleEsc = (e: KeyboardEvent) => {
|
|
31
|
+
if (e.key === "Escape") setIsOpen(false);
|
|
32
|
+
};
|
|
33
|
+
window.addEventListener("keydown", handleEsc);
|
|
34
|
+
return () => {
|
|
35
|
+
document.body.style.overflow = "auto";
|
|
36
|
+
window.removeEventListener("keydown", handleEsc);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}, [isOpen]);
|
|
40
|
+
|
|
41
|
+
if (!src) return null;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<button
|
|
46
|
+
type="button"
|
|
47
|
+
className="relative group cursor-zoom-in my-6 w-full flex justify-center rounded-lg"
|
|
48
|
+
onClick={() => setIsOpen(true)}
|
|
49
|
+
aria-label="Zoom image"
|
|
50
|
+
>
|
|
51
|
+
<span className="absolute inset-0 bg-black/0 group-hover:bg-black/5 transition-colors z-10 flex items-center justify-center opacity-0 group-hover:opacity-100 rounded-lg">
|
|
52
|
+
<ZoomIn className="w-8 h-8 text-white drop-shadow-md" />
|
|
53
|
+
</span>
|
|
54
|
+
<NextImage
|
|
55
|
+
src={src}
|
|
56
|
+
alt={alt}
|
|
57
|
+
width={width as Width}
|
|
58
|
+
height={height as Height}
|
|
59
|
+
quality={85}
|
|
60
|
+
className="w-full h-auto rounded-lg transition-transform duration-300 group-hover:scale-[1.01]"
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
</button>
|
|
64
|
+
|
|
65
|
+
<AnimatePresence>
|
|
66
|
+
{isOpen && (
|
|
67
|
+
<Portal>
|
|
68
|
+
<motion.div
|
|
69
|
+
initial={{ opacity: 0 }}
|
|
70
|
+
animate={{ opacity: 1 }}
|
|
71
|
+
exit={{ opacity: 0 }}
|
|
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
|
+
onClick={() => setIsOpen(false)}
|
|
74
|
+
>
|
|
75
|
+
{/* Close Button */}
|
|
76
|
+
<button
|
|
77
|
+
className="absolute top-4 right-4 z-50 p-2 text-white/70 hover:text-white bg-black/20 hover:bg-white/10 rounded-full transition-colors"
|
|
78
|
+
onClick={(e) => {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
setIsOpen(false);
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<X className="w-6 h-6" />
|
|
84
|
+
</button>
|
|
85
|
+
|
|
86
|
+
{/* Image Container */}
|
|
87
|
+
<motion.div
|
|
88
|
+
initial={{ scale: 0.9, opacity: 0 }}
|
|
89
|
+
animate={{ scale: 1, opacity: 1 }}
|
|
90
|
+
exit={{ scale: 0.9, opacity: 0 }}
|
|
91
|
+
transition={{ type: "spring", damping: 25, stiffness: 300 }}
|
|
92
|
+
className="relative max-w-7xl w-full h-full flex items-center justify-center"
|
|
93
|
+
onClick={(e) => e.stopPropagation()}
|
|
94
|
+
>
|
|
95
|
+
<div className="relative w-full h-full flex items-center justify-center" onClick={() => setIsOpen(false)}>
|
|
96
|
+
<NextImage
|
|
97
|
+
src={src}
|
|
98
|
+
alt={alt}
|
|
99
|
+
width={1920}
|
|
100
|
+
height={1080}
|
|
101
|
+
className="object-contain max-h-[90vh] w-auto h-auto rounded-md shadow-2xl"
|
|
102
|
+
quality={95}
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
</motion.div>
|
|
106
|
+
|
|
107
|
+
{/* Caption */}
|
|
108
|
+
{alt && alt !== "alt" && (
|
|
109
|
+
<motion.div
|
|
110
|
+
initial={{ y: 20, opacity: 0 }}
|
|
111
|
+
animate={{ y: 0, opacity: 1 }}
|
|
112
|
+
className="absolute bottom-6 left-1/2 -translate-x-1/2 bg-black/60 text-white px-4 py-2 rounded-full text-sm font-medium backdrop-blur-md border border-white/10"
|
|
113
|
+
>
|
|
114
|
+
{alt}
|
|
115
|
+
</motion.div>
|
|
116
|
+
)}
|
|
117
|
+
|
|
118
|
+
</motion.div>
|
|
119
|
+
</Portal>
|
|
120
|
+
)}
|
|
121
|
+
</AnimatePresence>
|
|
122
|
+
</>
|
|
123
|
+
);
|
|
29
124
|
}
|
|
125
|
+
|
|
126
|
+
const Portal = ({ children }: { children: React.ReactNode }) => {
|
|
127
|
+
if (typeof window === "undefined") return null;
|
|
128
|
+
return createPortal(children, document.body);
|
|
129
|
+
};
|
|
@@ -1,52 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import { cn } from "@/lib/utils";
|
|
2
|
-
import
|
|
3
|
-
import { PropsWithChildren } from "react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
5
|
import {
|
|
5
6
|
Info,
|
|
6
7
|
AlertTriangle,
|
|
7
8
|
ShieldAlert,
|
|
8
|
-
|
|
9
|
+
CheckCircle2,
|
|
9
10
|
} from "lucide-react";
|
|
11
|
+
import React from "react";
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const noteVariants = cva(
|
|
14
|
+
"relative w-full rounded-lg border border-l-4 p-4 mb-4 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
variant: {
|
|
18
|
+
note: "bg-muted/30 border-border border-l-primary/50 text-foreground [&>svg]:text-primary",
|
|
19
|
+
danger: "border-destructive/20 border-l-destructive/60 bg-destructive/5 text-destructive [&>svg]:text-destructive dark:border-destructive/30",
|
|
20
|
+
warning: "border-orange-500/20 border-l-orange-500/60 bg-orange-500/5 text-orange-600 dark:text-orange-400 [&>svg]:text-orange-600 dark:[&>svg]:text-orange-400",
|
|
21
|
+
success: "border-emerald-500/20 border-l-emerald-500/60 bg-emerald-500/5 text-emerald-600 dark:text-emerald-400 [&>svg]:text-emerald-600 dark:[&>svg]:text-emerald-400",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
variant: "note",
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
);
|
|
15
29
|
|
|
16
30
|
const iconMap = {
|
|
17
|
-
note:
|
|
18
|
-
danger:
|
|
19
|
-
warning:
|
|
20
|
-
success:
|
|
31
|
+
note: Info,
|
|
32
|
+
danger: ShieldAlert,
|
|
33
|
+
warning: AlertTriangle,
|
|
34
|
+
success: CheckCircle2,
|
|
21
35
|
};
|
|
22
36
|
|
|
37
|
+
interface NoteProps
|
|
38
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
39
|
+
VariantProps<typeof noteVariants> {
|
|
40
|
+
title?: string;
|
|
41
|
+
type?: "note" | "danger" | "warning" | "success";
|
|
42
|
+
}
|
|
43
|
+
|
|
23
44
|
export default function Note({
|
|
24
|
-
|
|
45
|
+
className,
|
|
25
46
|
title = "Note",
|
|
26
47
|
type = "note",
|
|
48
|
+
children,
|
|
49
|
+
...props
|
|
27
50
|
}: NoteProps) {
|
|
28
|
-
const
|
|
29
|
-
"dark:bg-stone-950/25 bg-stone-50": type === "note",
|
|
30
|
-
"dark:bg-red-950 bg-red-100 border-red-200 dark:border-red-900":
|
|
31
|
-
type === "danger",
|
|
32
|
-
"bg-orange-50 border-orange-200 dark:border-orange-900 dark:bg-orange-900/50":
|
|
33
|
-
type === "warning",
|
|
34
|
-
"dark:bg-green-950 bg-green-100 border-green-200 dark:border-green-900":
|
|
35
|
-
type === "success",
|
|
36
|
-
});
|
|
51
|
+
const Icon = iconMap[type] || Info;
|
|
37
52
|
|
|
38
53
|
return (
|
|
39
54
|
<div
|
|
40
|
-
className={cn(
|
|
41
|
-
|
|
42
|
-
noteClassNames
|
|
43
|
-
)}
|
|
55
|
+
className={cn(noteVariants({ variant: type }), className)}
|
|
56
|
+
{...props}
|
|
44
57
|
>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
<
|
|
58
|
+
<Icon className="h-5 w-5" />
|
|
59
|
+
<div className="pl-8">
|
|
60
|
+
<h5 className="mb-1 font-medium leading-none tracking-tight">
|
|
61
|
+
{title}
|
|
62
|
+
</h5>
|
|
63
|
+
<div className="text-sm [&_p]:leading-relaxed opacity-90">
|
|
64
|
+
{children}
|
|
65
|
+
</div>
|
|
48
66
|
</div>
|
|
49
|
-
{children}
|
|
50
67
|
</div>
|
|
51
68
|
);
|
|
52
69
|
}
|
|
@@ -86,7 +86,7 @@ export default function SubLink({
|
|
|
86
86
|
<div className={cn("flex flex-col gap-1 w-full")}>
|
|
87
87
|
<Collapsible open={isOpen} onOpenChange={setIsOpen}>
|
|
88
88
|
<CollapsibleTrigger
|
|
89
|
-
className="w-full pr-5 text-left"
|
|
89
|
+
className="w-full pr-5 text-left cursor-pointer"
|
|
90
90
|
aria-expanded={isOpen}
|
|
91
91
|
aria-controls={`collapsible-${fullHref.replace(/[^a-zA-Z0-9]/g, '-')}`}
|
|
92
92
|
>
|
|
@@ -49,7 +49,7 @@ export function ModeToggle() {
|
|
|
49
49
|
value="light"
|
|
50
50
|
size="sm"
|
|
51
51
|
aria-label="Light Mode"
|
|
52
|
-
className={`rounded-full p-1 transition-all ${activeTheme === "light"
|
|
52
|
+
className={`rounded-full cursor-pointer p-1 transition-all ${activeTheme === "light"
|
|
53
53
|
? "bg-primary text-primary-foreground"
|
|
54
54
|
: "bg-transparent hover:bg-muted/50"
|
|
55
55
|
}`}
|
|
@@ -60,7 +60,7 @@ export function ModeToggle() {
|
|
|
60
60
|
value="dark"
|
|
61
61
|
size="sm"
|
|
62
62
|
aria-label="Dark Mode"
|
|
63
|
-
className={`rounded-full p-1 transition-all ${activeTheme === "dark"
|
|
63
|
+
className={`rounded-full cursor-pointer p-1 transition-all ${activeTheme === "dark"
|
|
64
64
|
? "bg-primary text-primary-foreground"
|
|
65
65
|
: "bg-transparent hover:bg-muted/50"
|
|
66
66
|
}`}
|
|
@@ -29,7 +29,7 @@ const TabsTrigger = React.forwardRef<
|
|
|
29
29
|
<TabsPrimitive.Trigger
|
|
30
30
|
ref={ref}
|
|
31
31
|
className={cn(
|
|
32
|
-
"inline-flex items-center justify-center whitespace-nowrap px-1.5 py-[0.58rem] text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-primary border-b-2 border-transparent data-[state=active]:text-foreground font-code",
|
|
32
|
+
"inline-flex items-center justify-center whitespace-nowrap px-1.5 py-[0.58rem] text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-primary border-b-2 border-transparent data-[state=active]:text-foreground font-code cursor-pointer",
|
|
33
33
|
className
|
|
34
34
|
)}
|
|
35
35
|
{...props}
|
package/src/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docubook",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "next dev",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"geist": "^1.5.1",
|
|
32
32
|
"gray-matter": "^4.0.3",
|
|
33
33
|
"lucide-react": "^0.511.0",
|
|
34
|
-
"next": "16.1.
|
|
34
|
+
"next": "^16.1.6",
|
|
35
35
|
"next-mdx-remote": "^5.0.0",
|
|
36
36
|
"next-themes": "^0.4.4",
|
|
37
37
|
"react": "19.2.3",
|