@docubook/create 1.13.6 → 1.13.9
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/README.md +1 -1
- package/package.json +8 -4
- package/src/dist/.eslintrc.json +19 -0
- package/src/dist/app/docs/[[...slug]]/page.tsx +1 -1
- package/src/dist/app/page.tsx +1 -1
- package/src/dist/components/Sponsor.tsx +65 -5
- package/src/dist/components/markdown/ButtonMdx.tsx +0 -2
- package/src/dist/components/markdown/mdx-provider.tsx +1 -1
- package/src/dist/components/mob-toc.tsx +1 -1
- package/src/dist/components/sublink.tsx +0 -3
- package/src/dist/components/toc-observer.tsx +3 -13
- package/src/dist/components/ui/icon-cloud.tsx +1 -1
- package/src/dist/components/ui/input.tsx +1 -2
- package/src/dist/components/ui/interactive-hover-button.tsx +1 -2
- package/src/dist/lib/markdown.ts +38 -12
- package/src/dist/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# DocuBook
|
|
1
|
+
# DocuBook CLI
|
|
2
2
|
|
|
3
3
|
**DocuBook** is a documentation web project designed to provide a simple and user-friendly interface for accessing various types of documentation. This site is crafted for developers and teams who need quick access to references, guides, and essential documents.
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docubook/create",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.9",
|
|
4
|
+
"description": "CLI to create DocuBook projects",
|
|
4
5
|
"main": "src/index.js",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"bin": {
|
|
7
8
|
"create": "./src/index.js"
|
|
8
9
|
},
|
|
9
10
|
"keywords": [
|
|
10
|
-
"
|
|
11
|
-
"
|
|
11
|
+
"docs",
|
|
12
|
+
"markdown",
|
|
13
|
+
"react-template",
|
|
14
|
+
"nextjs-template",
|
|
12
15
|
"documentation"
|
|
13
16
|
],
|
|
17
|
+
"homepage": "https://docubook.pro/",
|
|
18
|
+
"repository": "github:DocuBook/docubook",
|
|
14
19
|
"author": "wildan.nrs",
|
|
15
20
|
"license": "MIT",
|
|
16
|
-
"description": "CLI to create DocuBook projects",
|
|
17
21
|
"dependencies": {
|
|
18
22
|
"boxen": "^8.0.1",
|
|
19
23
|
"chalk": "^5.3.0",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"next/core-web-vitals",
|
|
4
|
+
"next/typescript",
|
|
5
|
+
"plugin:@typescript-eslint/recommended"
|
|
6
|
+
],
|
|
7
|
+
"rules": {
|
|
8
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
9
|
+
"@typescript-eslint/no-unused-vars": [
|
|
10
|
+
"warn",
|
|
11
|
+
{
|
|
12
|
+
"argsIgnorePattern": "^_",
|
|
13
|
+
"varsIgnorePattern": "^_",
|
|
14
|
+
"caughtErrorsIgnorePattern": "^_"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"@typescript-eslint/no-empty-object-type": "off"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -68,7 +68,7 @@ export default async function DocsPage({ params: { slug = [] } }: PageProps) {
|
|
|
68
68
|
|
|
69
69
|
if (!res) notFound();
|
|
70
70
|
|
|
71
|
-
const { title, description, image, date } = res.frontmatter;
|
|
71
|
+
const { title, description, image: _image, date } = res.frontmatter;
|
|
72
72
|
|
|
73
73
|
// File path for edit link
|
|
74
74
|
const filePath = `contents/docs/${slug.join("/") || ""}/index.mdx`;
|
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>🚀 New Version - Release v1.13.
|
|
28
|
+
<span>🚀 New Version - Release v1.13.9</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>
|
|
@@ -10,16 +10,76 @@ interface SponsorItem {
|
|
|
10
10
|
description?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
interface NavbarConfig {
|
|
14
|
+
title?: string;
|
|
15
|
+
logo?: {
|
|
16
|
+
light?: string;
|
|
17
|
+
dark?: string;
|
|
18
|
+
};
|
|
19
|
+
links?: Array<{
|
|
20
|
+
title: string;
|
|
21
|
+
href: string;
|
|
22
|
+
external?: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface FooterConfig {
|
|
27
|
+
text?: string;
|
|
28
|
+
links?: Array<{
|
|
29
|
+
title: string;
|
|
30
|
+
href: string;
|
|
31
|
+
external?: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface MetaConfig {
|
|
36
|
+
title?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
favicon?: string;
|
|
39
|
+
socialBanner?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface RepositoryConfig {
|
|
43
|
+
url: string;
|
|
44
|
+
editUrl?: string;
|
|
45
|
+
branch?: string;
|
|
46
|
+
directory?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface RouteItem {
|
|
50
|
+
title: string;
|
|
51
|
+
href: string;
|
|
52
|
+
noLink?: boolean;
|
|
53
|
+
context?: {
|
|
54
|
+
icon: string;
|
|
55
|
+
description: string;
|
|
56
|
+
title: string;
|
|
57
|
+
};
|
|
58
|
+
items?: RouteItem[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface RouteConfig {
|
|
62
|
+
title: string;
|
|
63
|
+
href: string;
|
|
64
|
+
noLink?: boolean;
|
|
65
|
+
context?: {
|
|
66
|
+
icon: string;
|
|
67
|
+
description: string;
|
|
68
|
+
title: string;
|
|
69
|
+
};
|
|
70
|
+
items?: RouteItem[];
|
|
71
|
+
}
|
|
72
|
+
|
|
13
73
|
interface DocuConfig {
|
|
14
74
|
sponsor?: {
|
|
15
75
|
title?: string;
|
|
16
76
|
item?: SponsorItem;
|
|
17
77
|
};
|
|
18
|
-
navbar:
|
|
19
|
-
footer:
|
|
20
|
-
meta:
|
|
21
|
-
repository:
|
|
22
|
-
routes:
|
|
78
|
+
navbar: NavbarConfig;
|
|
79
|
+
footer: FooterConfig;
|
|
80
|
+
meta: MetaConfig;
|
|
81
|
+
repository: RepositoryConfig;
|
|
82
|
+
routes: RouteConfig[];
|
|
23
83
|
}
|
|
24
84
|
|
|
25
85
|
// Type assertion for docu.json
|
|
@@ -7,7 +7,7 @@ import { useRef, useMemo } from "react";
|
|
|
7
7
|
import { usePathname } from "next/navigation";
|
|
8
8
|
import { Button } from "./ui/button";
|
|
9
9
|
import { motion, AnimatePresence } from "framer-motion";
|
|
10
|
-
import {
|
|
10
|
+
import { useActiveSection } from "@/hooks";
|
|
11
11
|
import { TocItem } from "@/lib/toc";
|
|
12
12
|
|
|
13
13
|
interface MobTocProps {
|
|
@@ -32,9 +32,6 @@ export default function SubLink({
|
|
|
32
32
|
// Full path including parent's href
|
|
33
33
|
const fullHref = `${parentHref}${href}`;
|
|
34
34
|
|
|
35
|
-
// Check if current path exactly matches this link's href
|
|
36
|
-
const isExactActive = useMemo(() => path === fullHref, [path, fullHref]);
|
|
37
|
-
|
|
38
35
|
// Check if any child is active (for parent items)
|
|
39
36
|
const hasActiveChild = useMemo(() => {
|
|
40
37
|
if (!items) return false;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { getDocsTocs } from "@/lib/markdown";
|
|
4
3
|
import clsx from "clsx";
|
|
5
4
|
import Link from "next/link";
|
|
6
5
|
import { useState, useRef, useEffect, useCallback } from "react";
|
|
@@ -110,7 +109,6 @@ export default function TocObserver({
|
|
|
110
109
|
|
|
111
110
|
// Calculate scroll progress for the active section
|
|
112
111
|
const [scrollProgress, setScrollProgress] = useState(0);
|
|
113
|
-
const [activeSectionIndex, setActiveSectionIndex] = useState(0);
|
|
114
112
|
|
|
115
113
|
useEffect(() => {
|
|
116
114
|
const handleScroll = () => {
|
|
@@ -137,15 +135,6 @@ export default function TocObserver({
|
|
|
137
135
|
return () => window.removeEventListener('scroll', handleScroll);
|
|
138
136
|
}, [activeId]);
|
|
139
137
|
|
|
140
|
-
// Update active section index when activeId changes
|
|
141
|
-
useEffect(() => {
|
|
142
|
-
if (activeId) {
|
|
143
|
-
const index = data.findIndex(item => item.href.slice(1) === activeId);
|
|
144
|
-
if (index !== -1) {
|
|
145
|
-
setActiveSectionIndex(index);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}, [activeId, data]);
|
|
149
138
|
|
|
150
139
|
return (
|
|
151
140
|
<div className="relative">
|
|
@@ -155,8 +144,9 @@ export default function TocObserver({
|
|
|
155
144
|
const id = href.slice(1);
|
|
156
145
|
const isActive = activeId === id;
|
|
157
146
|
const indent = level > 1 ? (level - 1) * 20 : 0;
|
|
158
|
-
|
|
159
|
-
const
|
|
147
|
+
// Prefix with underscore to indicate intentionally unused
|
|
148
|
+
const _isParent = hasChildren(id, level);
|
|
149
|
+
const _isLastInLevel = index === data.length - 1 || data[index + 1].level <= level;
|
|
160
150
|
|
|
161
151
|
return (
|
|
162
152
|
<div key={href} className="relative">
|
|
@@ -24,7 +24,7 @@ function easeOutCubic(t: number): number {
|
|
|
24
24
|
export function IconCloud({ icons, images }: IconCloudProps) {
|
|
25
25
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
26
26
|
const [iconPositions, setIconPositions] = useState<Icon[]>([]);
|
|
27
|
-
const [rotation
|
|
27
|
+
const [rotation] = useState({ x: 0, y: 0 });
|
|
28
28
|
const [isDragging, setIsDragging] = useState(false);
|
|
29
29
|
const [lastMousePos, setLastMousePos] = useState({ x: 0, y: 0 });
|
|
30
30
|
const [mousePos, setMousePos] = useState({ x: 0, y: 0 });
|
|
@@ -2,8 +2,7 @@ import * as React from "react"
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@/lib/utils"
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
5
|
+
export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
7
6
|
|
|
8
7
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
9
8
|
({ className, type, ...props }, ref) => {
|
|
@@ -2,8 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ArrowRight } from "lucide-react";
|
|
3
3
|
import { cn } from "@/lib/utils";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
5
|
+
type InteractiveHoverButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
7
6
|
|
|
8
7
|
export const InteractiveHoverButton = React.forwardRef<
|
|
9
8
|
HTMLButtonElement,
|
package/src/dist/lib/markdown.ts
CHANGED
|
@@ -8,8 +8,26 @@ import rehypeSlug from "rehype-slug";
|
|
|
8
8
|
import rehypeCodeTitles from "rehype-code-titles";
|
|
9
9
|
import { page_routes, ROUTES } from "./routes-config";
|
|
10
10
|
import { visit } from "unist-util-visit";
|
|
11
|
+
import type { Node } from "unist";
|
|
11
12
|
import matter from "gray-matter";
|
|
12
13
|
|
|
14
|
+
// Type definitions for unist-util-visit
|
|
15
|
+
interface Element extends Node {
|
|
16
|
+
type: string;
|
|
17
|
+
tagName?: string;
|
|
18
|
+
properties?: Record<string, unknown> & {
|
|
19
|
+
raw?: string;
|
|
20
|
+
};
|
|
21
|
+
children?: Node[];
|
|
22
|
+
value?: string;
|
|
23
|
+
raw?: string; // For internal use in processing
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface TextNode extends Node {
|
|
27
|
+
type: 'text';
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
13
31
|
// custom components imports
|
|
14
32
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
15
33
|
import Pre from "@/components/markdown/PreMdx";
|
|
@@ -139,11 +157,11 @@ function justGetFrontmatterFromMD<Frontmatter>(rawMd: string): Frontmatter {
|
|
|
139
157
|
}
|
|
140
158
|
|
|
141
159
|
export async function getAllChilds(pathString: string) {
|
|
142
|
-
const items = pathString.split("/").filter((it) => it
|
|
160
|
+
const items = pathString.split("/").filter((it) => it !== "");
|
|
143
161
|
let page_routes_copy = ROUTES;
|
|
144
162
|
|
|
145
163
|
let prevHref = "";
|
|
146
|
-
for (
|
|
164
|
+
for (const it of items) {
|
|
147
165
|
const found = page_routes_copy.find((innerIt) => innerIt.href == `/${it}`);
|
|
148
166
|
if (!found) break;
|
|
149
167
|
prevHref += found.href;
|
|
@@ -170,20 +188,28 @@ export async function getAllChilds(pathString: string) {
|
|
|
170
188
|
}
|
|
171
189
|
|
|
172
190
|
// for copying the code in pre
|
|
173
|
-
const preProcess = () => (tree:
|
|
174
|
-
visit(tree, (node) => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
191
|
+
const preProcess = () => (tree: Node) => {
|
|
192
|
+
visit(tree, (node: Node) => {
|
|
193
|
+
const element = node as Element;
|
|
194
|
+
if (element?.type === "element" && element?.tagName === "pre" && element.children) {
|
|
195
|
+
const [codeEl] = element.children as Element[];
|
|
196
|
+
if (codeEl.tagName !== "code" || !codeEl.children?.[0]) return;
|
|
197
|
+
|
|
198
|
+
const textNode = codeEl.children[0] as TextNode;
|
|
199
|
+
if (textNode.type === 'text' && textNode.value) {
|
|
200
|
+
element.raw = textNode.value;
|
|
201
|
+
}
|
|
179
202
|
}
|
|
180
203
|
});
|
|
181
204
|
};
|
|
182
205
|
|
|
183
|
-
const postProcess = () => (tree:
|
|
184
|
-
visit(tree, "element", (node) => {
|
|
185
|
-
|
|
186
|
-
|
|
206
|
+
const postProcess = () => (tree: Node) => {
|
|
207
|
+
visit(tree, "element", (node: Node) => {
|
|
208
|
+
const element = node as Element;
|
|
209
|
+
if (element?.type === "element" && element?.tagName === "pre") {
|
|
210
|
+
if (element.properties && element.raw) {
|
|
211
|
+
element.properties.raw = element.raw;
|
|
212
|
+
}
|
|
187
213
|
}
|
|
188
214
|
});
|
|
189
215
|
};
|