react-docs-module 0.1.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/README.md +279 -0
- package/ai-chat.tsx +222 -0
- package/chat-api.ts +90 -0
- package/cn.ts +15 -0
- package/config.ts +29 -0
- package/dist/ai-chat.d.ts +12 -0
- package/dist/ai-chat.js +72 -0
- package/dist/ai-chat.js.map +1 -0
- package/dist/chat-api.d.ts +16 -0
- package/dist/chat-api.js +62 -0
- package/dist/chat-api.js.map +1 -0
- package/dist/cn.d.ts +4 -0
- package/dist/cn.js +14 -0
- package/dist/cn.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -0
- package/dist/doc-pagination.d.ts +13 -0
- package/dist/doc-pagination.js +8 -0
- package/dist/doc-pagination.js.map +1 -0
- package/dist/docs-index.d.ts +7 -0
- package/dist/docs-index.js +11 -0
- package/dist/docs-index.js.map +1 -0
- package/dist/docs-page.d.ts +15 -0
- package/dist/docs-page.js +38 -0
- package/dist/docs-page.js.map +1 -0
- package/dist/docs-sidebar.d.ts +18 -0
- package/dist/docs-sidebar.d.ts.map +1 -0
- package/dist/docs-sidebar.js +27 -0
- package/dist/docs-sidebar.js.map +1 -0
- package/dist/documentation-layout.d.ts +15 -0
- package/dist/documentation-layout.js +20 -0
- package/dist/documentation-layout.js.map +1 -0
- package/dist/heading.d.ts +10 -0
- package/dist/heading.js +16 -0
- package/dist/heading.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/mdx/callouts.d.ts +8 -0
- package/dist/mdx/callouts.js +8 -0
- package/dist/mdx/callouts.js.map +1 -0
- package/dist/mdx/code-block.d.ts +8 -0
- package/dist/mdx/code-block.js +29 -0
- package/dist/mdx/code-block.js.map +1 -0
- package/dist/mdx/components.d.ts +13 -0
- package/dist/mdx/components.js +21 -0
- package/dist/mdx/components.js.map +1 -0
- package/dist/mdx.d.ts +20 -0
- package/dist/mdx.js +109 -0
- package/dist/mdx.js.map +1 -0
- package/dist/search-index.d.ts +10 -0
- package/dist/search-index.js +38 -0
- package/dist/search-index.js.map +1 -0
- package/dist/search.d.ts +6 -0
- package/dist/search.js +142 -0
- package/dist/search.js.map +1 -0
- package/dist/table-of-contents-provider.d.ts +4 -0
- package/dist/table-of-contents-provider.js +30 -0
- package/dist/table-of-contents-provider.js.map +1 -0
- package/dist/table-of-contents.d.ts +11 -0
- package/dist/table-of-contents.js +9 -0
- package/dist/table-of-contents.js.map +1 -0
- package/dist/theme-context.d.ts +20 -0
- package/dist/theme-context.js +28 -0
- package/dist/theme-context.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/ui/button.d.ts +12 -0
- package/dist/ui/button.js +34 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/dialog.d.ts +17 -0
- package/dist/ui/dialog.js +22 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/input.d.ts +4 -0
- package/dist/ui/input.js +9 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/util.d.ts +59 -0
- package/dist/util.js +96 -0
- package/dist/util.js.map +1 -0
- package/doc-pagination.tsx +67 -0
- package/docs-index.tsx +17 -0
- package/docs-page.tsx +68 -0
- package/docs-sidebar.tsx +165 -0
- package/documentation-layout.tsx +99 -0
- package/heading.tsx +63 -0
- package/index.ts +28 -0
- package/mdx/callouts.tsx +29 -0
- package/mdx/code-block.tsx +89 -0
- package/mdx/components.tsx +55 -0
- package/mdx.ts +138 -0
- package/package.json +99 -0
- package/search-index.ts +52 -0
- package/search.tsx +273 -0
- package/table-of-contents-provider.tsx +43 -0
- package/table-of-contents.tsx +44 -0
- package/theme-context.tsx +57 -0
- package/ui/button.tsx +56 -0
- package/ui/dialog.tsx +108 -0
- package/ui/input.tsx +22 -0
- package/util.ts +169 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
3
|
+
declare const buttonVariants: (props?: ({
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
5
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
8
|
+
asChild?: boolean;
|
9
|
+
}
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
11
|
+
export { Button, buttonVariants };
|
12
|
+
//# sourceMappingURL=button.d.ts.map
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
4
|
+
import { cva } from "class-variance-authority";
|
5
|
+
import { cn } from "../cn";
|
6
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
7
|
+
variants: {
|
8
|
+
variant: {
|
9
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
10
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
11
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
12
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
13
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
14
|
+
link: "text-primary underline-offset-4 hover:underline",
|
15
|
+
},
|
16
|
+
size: {
|
17
|
+
default: "h-10 px-4 py-2",
|
18
|
+
sm: "h-9 rounded-md px-3",
|
19
|
+
lg: "h-11 rounded-md px-8",
|
20
|
+
icon: "h-10 w-10",
|
21
|
+
},
|
22
|
+
},
|
23
|
+
defaultVariants: {
|
24
|
+
variant: "default",
|
25
|
+
size: "default",
|
26
|
+
},
|
27
|
+
});
|
28
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
29
|
+
const Comp = asChild ? Slot : "button";
|
30
|
+
return (_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
31
|
+
});
|
32
|
+
Button.displayName = "Button";
|
33
|
+
export { Button, buttonVariants };
|
34
|
+
//# sourceMappingURL=button.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../ui/button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAE1B,MAAM,cAAc,GAAG,GAAG,CACxB,0VAA0V,EAC1V;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,wDAAwD;YACjE,WAAW,EACT,oEAAoE;YACtE,OAAO,EACL,gFAAgF;YAClF,SAAS,EACP,8DAA8D;YAChE,KAAK,EAAE,8CAA8C;YACrD,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,gBAAgB;YACzB,EAAE,EAAE,qBAAqB;YACzB,EAAE,EAAE,sBAAsB;YAC1B,IAAI,EAAE,WAAW;SAClB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAA;AAQD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAC7B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;IACtC,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAC3D,GAAG,EAAE,GAAG,KACJ,KAAK,GACT,CACH,CAAA;AACH,CAAC,CACF,CAAA;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
3
|
+
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
4
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
5
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
6
|
+
declare const DialogHeader: {
|
7
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
8
|
+
displayName: string;
|
9
|
+
};
|
10
|
+
declare const DialogFooter: {
|
11
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
12
|
+
displayName: string;
|
13
|
+
};
|
14
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
15
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
16
|
+
export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
|
17
|
+
//# sourceMappingURL=dialog.d.ts.map
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use client";
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
3
|
+
import * as React from "react";
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
5
|
+
import { cn } from "../cn";
|
6
|
+
const Dialog = DialogPrimitive.Root;
|
7
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
8
|
+
const DialogPortal = DialogPrimitive.Portal;
|
9
|
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn("fixed inset-0 z-50 bg-black/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className), ...props })));
|
10
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
11
|
+
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsx(DialogPrimitive.Content, { ref: ref, className: cn("fixed left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] gap-4 border border-gray-700 bg-gray-900 p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-lg", className), ...props, children: children })] })));
|
12
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
13
|
+
const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props }));
|
14
|
+
DialogHeader.displayName = "DialogHeader";
|
15
|
+
const DialogFooter = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props }));
|
16
|
+
DialogFooter.displayName = "DialogFooter";
|
17
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn("text-lg font-semibold leading-none", className), ...props })));
|
18
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
19
|
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ref: ref, className: cn("text-sm text-gray-400", className), ...props })));
|
20
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
21
|
+
export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
|
22
|
+
//# sourceMappingURL=dialog.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../ui/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC;AAEpC,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC;AAE9C,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC;AAE5C,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAGpC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,OAAO,IACtB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,yKAAyK,EACzK,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC;AAEhE,MAAM,aA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,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,WAAW,IAC1B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,CAAC,KAC7C,KAAK,GACT,CACH,CAAC,CAAC;AACH,iBAAiB,CAAC,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,WAAW,CAAC;AAExE,OAAO,EACL,MAAM,EACN,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAC"}
|
package/dist/ui/input.js
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import { cn } from "../cn";
|
4
|
+
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
5
|
+
return (_jsx("input", { type: type, className: cn("flex h-10 w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-gray-100 ring-offset-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-700 focus:ring-offset-2", className), ref: ref, ...props }));
|
6
|
+
});
|
7
|
+
Input.displayName = "Input";
|
8
|
+
export { Input };
|
9
|
+
//# sourceMappingURL=input.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../ui/input.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAG5B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACvC,OAAO,CACL,gBACE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,uNAAuN,EACvN,SAAS,CACV,EACD,GAAG,EAAE,GAAG,KACJ,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/util.d.ts
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
import { ReactDocsConfig } from "./config";
|
2
|
+
interface DocPage {
|
3
|
+
slug: string;
|
4
|
+
title: string;
|
5
|
+
icon?: string;
|
6
|
+
isExternal?: boolean;
|
7
|
+
}
|
8
|
+
interface DocSection {
|
9
|
+
group: string;
|
10
|
+
pages: DocPage[];
|
11
|
+
}
|
12
|
+
export interface DocsJsonConfig {
|
13
|
+
theme: string;
|
14
|
+
name: string;
|
15
|
+
description?: string;
|
16
|
+
navigation: {
|
17
|
+
groups?: {
|
18
|
+
group: string;
|
19
|
+
pages: string[];
|
20
|
+
}[];
|
21
|
+
anchors?: {
|
22
|
+
name: string;
|
23
|
+
icon: string;
|
24
|
+
url: string;
|
25
|
+
}[];
|
26
|
+
pages?: string[];
|
27
|
+
};
|
28
|
+
colors: {
|
29
|
+
primary: string;
|
30
|
+
light?: string;
|
31
|
+
dark?: string;
|
32
|
+
};
|
33
|
+
logo?: {
|
34
|
+
dark?: string;
|
35
|
+
light?: string;
|
36
|
+
};
|
37
|
+
favicon?: string;
|
38
|
+
navbar?: {
|
39
|
+
cta?: {
|
40
|
+
type: string;
|
41
|
+
url: string;
|
42
|
+
};
|
43
|
+
};
|
44
|
+
footer?: {
|
45
|
+
socials?: Record<string, string>;
|
46
|
+
};
|
47
|
+
feedback?: {
|
48
|
+
thumbsRating?: boolean;
|
49
|
+
};
|
50
|
+
}
|
51
|
+
export declare function getDocsSidebar(config: ReactDocsConfig): {
|
52
|
+
navigation: DocSection[];
|
53
|
+
config: DocsJsonConfig;
|
54
|
+
};
|
55
|
+
export declare function getAllDocSlugs(config: ReactDocsConfig): {
|
56
|
+
slug: string;
|
57
|
+
}[];
|
58
|
+
export {};
|
59
|
+
//# sourceMappingURL=util.d.ts.map
|
package/dist/util.js
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
import fs from "node:fs";
|
2
|
+
import path from "node:path";
|
3
|
+
import matter from "gray-matter";
|
4
|
+
export function getDocsSidebar(config) {
|
5
|
+
const docsDirectory = path.join(process.cwd(), config.contentPath);
|
6
|
+
const docsJsonPath = path.join(process.cwd(), config.contentPath, "docs.json");
|
7
|
+
if (!fs.existsSync(docsJsonPath)) {
|
8
|
+
throw new Error(`docs.json configuration file not found at ${config.contentPath}/docs.json`);
|
9
|
+
}
|
10
|
+
const docsConfig = JSON.parse(fs.readFileSync(docsJsonPath, 'utf8'));
|
11
|
+
const navigation = [];
|
12
|
+
// Add anchors as the first section if they exist
|
13
|
+
if (docsConfig.navigation.anchors && docsConfig.navigation.anchors.length > 0) {
|
14
|
+
navigation.push({
|
15
|
+
group: "Links",
|
16
|
+
pages: docsConfig.navigation.anchors.map(anchor => ({
|
17
|
+
slug: anchor.url,
|
18
|
+
title: anchor.name,
|
19
|
+
icon: anchor.icon,
|
20
|
+
isExternal: true
|
21
|
+
}))
|
22
|
+
});
|
23
|
+
}
|
24
|
+
// Handle groups navigation
|
25
|
+
if (docsConfig.navigation.groups) {
|
26
|
+
docsConfig.navigation.groups.forEach(section => {
|
27
|
+
const pages = [];
|
28
|
+
section.pages.forEach(pagePath => {
|
29
|
+
const fullPath = path.join(docsDirectory, `${pagePath}.mdx`);
|
30
|
+
if (fs.existsSync(fullPath)) {
|
31
|
+
const fileContents = fs.readFileSync(fullPath, 'utf8');
|
32
|
+
const { data: frontmatter } = matter(fileContents);
|
33
|
+
pages.push({
|
34
|
+
slug: pagePath,
|
35
|
+
title: frontmatter.title || pagePath.split('/').pop()?.replace(/-/g, ' ') || '',
|
36
|
+
});
|
37
|
+
}
|
38
|
+
});
|
39
|
+
if (pages.length > 0) {
|
40
|
+
navigation.push({
|
41
|
+
group: section.group,
|
42
|
+
pages,
|
43
|
+
});
|
44
|
+
}
|
45
|
+
});
|
46
|
+
}
|
47
|
+
// Handle direct pages navigation (if no groups)
|
48
|
+
if (docsConfig.navigation.pages && !docsConfig.navigation.groups) {
|
49
|
+
const pages = [];
|
50
|
+
docsConfig.navigation.pages.forEach(pagePath => {
|
51
|
+
const fullPath = path.join(docsDirectory, `${pagePath}.mdx`);
|
52
|
+
if (fs.existsSync(fullPath)) {
|
53
|
+
const fileContents = fs.readFileSync(fullPath, 'utf8');
|
54
|
+
const { data: frontmatter } = matter(fileContents);
|
55
|
+
pages.push({
|
56
|
+
slug: pagePath,
|
57
|
+
title: frontmatter.title || pagePath.split('/').pop()?.replace(/-/g, ' ') || '',
|
58
|
+
});
|
59
|
+
}
|
60
|
+
});
|
61
|
+
if (pages.length > 0) {
|
62
|
+
navigation.push({
|
63
|
+
group: "Documentation",
|
64
|
+
pages,
|
65
|
+
});
|
66
|
+
}
|
67
|
+
}
|
68
|
+
return { navigation, config: docsConfig };
|
69
|
+
}
|
70
|
+
export function getAllDocSlugs(config) {
|
71
|
+
const docsDirectory = path.join(process.cwd(), config.contentPath);
|
72
|
+
const fileNames = fs.readdirSync(docsDirectory);
|
73
|
+
return fileNames
|
74
|
+
.filter((fileName) => fileName.endsWith(".mdx"))
|
75
|
+
.map((fileName) => ({
|
76
|
+
slug: fileName.replace(/\.mdx$/, ""),
|
77
|
+
}));
|
78
|
+
}
|
79
|
+
// Helper function to recursively read all MDX files from a directory
|
80
|
+
function getAllDocs(dir) {
|
81
|
+
const files = fs.readdirSync(dir);
|
82
|
+
return files.flatMap(file => {
|
83
|
+
const filePath = path.join(dir, file);
|
84
|
+
const stats = fs.statSync(filePath);
|
85
|
+
if (stats.isDirectory()) {
|
86
|
+
return getAllDocs(filePath);
|
87
|
+
}
|
88
|
+
if (file.endsWith('.mdx')) {
|
89
|
+
const fileContents = fs.readFileSync(filePath, 'utf8');
|
90
|
+
const { content } = matter(fileContents);
|
91
|
+
return content;
|
92
|
+
}
|
93
|
+
return [];
|
94
|
+
});
|
95
|
+
}
|
96
|
+
//# sour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AClB,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;KACrC,CAAC,CAAC,CAAC;AACR,CAAC;AAED,qEAAqE;AACrE,SAAS,UAAU,CAAC,GAAW;IAC7B,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAElC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEpC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACvD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;YACzC,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import Link from "next/link";
|
2
|
+
import { ReactDocsConfig } from "./config";
|
3
|
+
|
4
|
+
interface Page {
|
5
|
+
title: string;
|
6
|
+
slug: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
interface Props {
|
10
|
+
config: ReactDocsConfig;
|
11
|
+
prev?: Page;
|
12
|
+
next?: Page;
|
13
|
+
}
|
14
|
+
|
15
|
+
export function DocPagination({ config, prev, next }: Props) {
|
16
|
+
if (!prev && !next) return null;
|
17
|
+
|
18
|
+
return (
|
19
|
+
<div className="mt-16 flex items-center justify-between border-t border-gray-800 pt-8">
|
20
|
+
{prev ? (
|
21
|
+
<Link
|
22
|
+
href={`${config.basePath}/${prev.slug}`}
|
23
|
+
className="group flex items-center gap-3 text-gray-400 hover:text-white transition-colors"
|
24
|
+
>
|
25
|
+
<svg
|
26
|
+
width="16"
|
27
|
+
height="16"
|
28
|
+
viewBox="0 0 16 16"
|
29
|
+
fill="none"
|
30
|
+
stroke="currentColor"
|
31
|
+
strokeWidth="2"
|
32
|
+
className="transition-transform group-hover:-translate-x-1"
|
33
|
+
>
|
34
|
+
<path d="M10.5 3.5L5.5 8l5 4.5" />
|
35
|
+
</svg>
|
36
|
+
<div>
|
37
|
+
<div className="text-sm text-gray-500">Previous</div>
|
38
|
+
<div className="text-sm font-medium">{prev.title}</div>
|
39
|
+
</div>
|
40
|
+
</Link>
|
41
|
+
) : <div />}
|
42
|
+
|
43
|
+
{next ? (
|
44
|
+
<Link
|
45
|
+
href={`${config.basePath}/${next.slug}`}
|
46
|
+
className="group flex items-center gap-3 text-right text-gray-400 hover:text-white transition-colors"
|
47
|
+
>
|
48
|
+
<div>
|
49
|
+
<div className="text-sm text-gray-500">Next</div>
|
50
|
+
<div className="text-sm font-medium">{next.title}</div>
|
51
|
+
</div>
|
52
|
+
<svg
|
53
|
+
width="16"
|
54
|
+
height="16"
|
55
|
+
viewBox="0 0 16 16"
|
56
|
+
fill="none"
|
57
|
+
stroke="currentColor"
|
58
|
+
strokeWidth="2"
|
59
|
+
className="transition-transform group-hover:translate-x-1"
|
60
|
+
>
|
61
|
+
<path d="M5.5 3.5l5 4.5-5 4.5" />
|
62
|
+
</svg>
|
63
|
+
</Link>
|
64
|
+
) : <div />}
|
65
|
+
</div>
|
66
|
+
);
|
67
|
+
}
|
package/docs-index.tsx
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
import { redirect } from 'next/navigation';
|
2
|
+
import { getDocsSidebar } from './util';
|
3
|
+
import { ReactDocsConfig } from './config';
|
4
|
+
|
5
|
+
interface DocsIndexProps {
|
6
|
+
config: ReactDocsConfig;
|
7
|
+
}
|
8
|
+
|
9
|
+
export function DocsIndex({ config }: DocsIndexProps) {
|
10
|
+
const { navigation } = getDocsSidebar(config);
|
11
|
+
|
12
|
+
// Redirect to the first page in navigation
|
13
|
+
if (navigation[0]?.pages[0]?.slug) {
|
14
|
+
redirect(`${config.basePath}/${navigation[0].pages[0].slug}`);
|
15
|
+
}
|
16
|
+
return null;
|
17
|
+
}
|
package/docs-page.tsx
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
import { getDocsSidebar } from './util';
|
2
|
+
import { ReactDocsConfig } from './config';
|
3
|
+
import { getAllDocs, getDocBySlug } from './mdx';
|
4
|
+
import { DocumentationLayout } from './documentation-layout';
|
5
|
+
|
6
|
+
interface DocsPageProps {
|
7
|
+
config: ReactDocsConfig;
|
8
|
+
slug: string[];
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface DocsMetadata {
|
12
|
+
title: string;
|
13
|
+
}
|
14
|
+
|
15
|
+
export async function generateDocsMetadata(docsConfig: ReactDocsConfig, slug: string[]): Promise<DocsMetadata> {
|
16
|
+
const { navigation } = getDocsSidebar(docsConfig);
|
17
|
+
const currentPath = slug.join("/");
|
18
|
+
|
19
|
+
// Find the current page in navigation
|
20
|
+
let pageTitle = "Documentation";
|
21
|
+
for (const section of navigation) {
|
22
|
+
const page = section.pages.find(p => p.slug === currentPath);
|
23
|
+
if (page) {
|
24
|
+
pageTitle = page.title;
|
25
|
+
break;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
return {
|
30
|
+
title: pageTitle,
|
31
|
+
};
|
32
|
+
}
|
33
|
+
|
34
|
+
export async function generateDocsStaticParams(docsConfig: ReactDocsConfig) {
|
35
|
+
const docs = getAllDocs(docsConfig);
|
36
|
+
|
37
|
+
return docs.map((doc: any) => ({
|
38
|
+
slug: doc.slug.split('/')
|
39
|
+
}));
|
40
|
+
}
|
41
|
+
|
42
|
+
export async function DocsPage({ config, slug }: DocsPageProps) {
|
43
|
+
const { navigation } = getDocsSidebar(config);
|
44
|
+
const curSlug = slug.join("/");
|
45
|
+
const { content, frontmatter, headings } = await getDocBySlug(config, curSlug);
|
46
|
+
const currentPath = config.basePath + `/${curSlug}`;
|
47
|
+
console.log(currentPath);
|
48
|
+
|
49
|
+
if (!content) {
|
50
|
+
return null;
|
51
|
+
}
|
52
|
+
|
53
|
+
return (
|
54
|
+
<DocumentationLayout
|
55
|
+
config={config}
|
56
|
+
navigation={navigation}
|
57
|
+
currentPath={currentPath}
|
58
|
+
headings={headings}
|
59
|
+
>
|
60
|
+
<div className="prose prose-invert max-w-none">
|
61
|
+
<h1 id="title" className="text-3xl font-medium mb-8 mt-2">
|
62
|
+
{frontmatter.title}
|
63
|
+
</h1>
|
64
|
+
{content}
|
65
|
+
</div>
|
66
|
+
</DocumentationLayout>
|
67
|
+
);
|
68
|
+
}
|
package/docs-sidebar.tsx
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
"use client";
|
2
|
+
import Link from "next/link";
|
3
|
+
import { cn } from "./cn";
|
4
|
+
import { useState } from "react";
|
5
|
+
import { Menu, X } from "lucide-react";
|
6
|
+
import { Button } from "./ui/button";
|
7
|
+
import { SiDiscord, SiGithub } from "@icons-pack/react-simple-icons";
|
8
|
+
import { ReactDocsConfig } from "./config";
|
9
|
+
|
10
|
+
interface DocPage {
|
11
|
+
slug: string;
|
12
|
+
title: string;
|
13
|
+
icon?: string;
|
14
|
+
isExternal?: boolean;
|
15
|
+
}
|
16
|
+
|
17
|
+
interface Props {
|
18
|
+
config: ReactDocsConfig;
|
19
|
+
navigation: {
|
20
|
+
group: string;
|
21
|
+
pages: DocPage[];
|
22
|
+
}[];
|
23
|
+
currentPath: string;
|
24
|
+
}
|
25
|
+
|
26
|
+
const iconMap: Record<string, React.ComponentType<{ className?: string }>> = {
|
27
|
+
github: SiGithub,
|
28
|
+
discord: SiDiscord,
|
29
|
+
};
|
30
|
+
|
31
|
+
export function DocsSidebar({ config, navigation, currentPath }: Props) {
|
32
|
+
const [isOpen, setIsOpen] = useState(false);
|
33
|
+
|
34
|
+
return (
|
35
|
+
<>
|
36
|
+
{/* Mobile Menu Button */}
|
37
|
+
<Button
|
38
|
+
variant="ghost"
|
39
|
+
size="icon"
|
40
|
+
className="md:hidden h-8 w-8 p-0"
|
41
|
+
onClick={() => setIsOpen(!isOpen)}
|
42
|
+
>
|
43
|
+
{isOpen ? <X className="h-4 w-4" /> : <Menu className="h-4 w-4" />}
|
44
|
+
</Button>
|
45
|
+
|
46
|
+
{/* Mobile Navigation Portal */}
|
47
|
+
{isOpen && (
|
48
|
+
<>
|
49
|
+
{/* Overlay */}
|
50
|
+
<div
|
51
|
+
className="fixed inset-0 bg-black/50 z-50"
|
52
|
+
onClick={() => setIsOpen(false)}
|
53
|
+
/>
|
54
|
+
|
55
|
+
{/* Sidebar */}
|
56
|
+
<div
|
57
|
+
className="
|
58
|
+
fixed inset-y-0 left-0 z-50
|
59
|
+
w-64
|
60
|
+
bg-gray-900
|
61
|
+
overflow-y-auto
|
62
|
+
p-4
|
63
|
+
"
|
64
|
+
>
|
65
|
+
<nav>
|
66
|
+
{navigation.map((section) => (
|
67
|
+
<div key={section.group} className="mb-8">
|
68
|
+
<h5 className="mb-2 text-sm font-semibold text-gray-400">
|
69
|
+
{section.group}
|
70
|
+
</h5>
|
71
|
+
<ul className="space-y-1.5">
|
72
|
+
{section.pages.map((page) => {
|
73
|
+
const IconComponent = page.icon
|
74
|
+
? iconMap[page.icon]
|
75
|
+
: null;
|
76
|
+
return (
|
77
|
+
<li key={page.slug}>
|
78
|
+
{page.isExternal ? (
|
79
|
+
<a
|
80
|
+
href={page.slug}
|
81
|
+
target="_blank"
|
82
|
+
rel="noopener noreferrer"
|
83
|
+
className="flex items-center gap-2 text-sm text-gray-400 hover:text-white hover:bg-gray-800 rounded-md p-1.5 transition-all"
|
84
|
+
>
|
85
|
+
{IconComponent && (
|
86
|
+
<div className="p-1 border border-gray-700 rounded-md">
|
87
|
+
<IconComponent className="w-4 h-4" />
|
88
|
+
</div>
|
89
|
+
)}
|
90
|
+
{page.title}
|
91
|
+
</a>
|
92
|
+
) : (
|
93
|
+
<Link
|
94
|
+
href={config.basePath + `/${page.slug}`}
|
95
|
+
className={cn(
|
96
|
+
"block text-sm text-gray-400 hover:text-white hover:bg-gray-800 rounded-md p-1.5 transition-all",
|
97
|
+
currentPath === config.basePath + `/${page.slug}` &&
|
98
|
+
"text-white bg-gray-800"
|
99
|
+
)}
|
100
|
+
onClick={() => setIsOpen(false)}
|
101
|
+
>
|
102
|
+
{page.title}
|
103
|
+
</Link>
|
104
|
+
)}
|
105
|
+
</li>
|
106
|
+
);
|
107
|
+
})}
|
108
|
+
</ul>
|
109
|
+
</div>
|
110
|
+
))}
|
111
|
+
</nav>
|
112
|
+
</div>
|
113
|
+
</>
|
114
|
+
)}
|
115
|
+
|
116
|
+
{/* Desktop Navigation */}
|
117
|
+
<div className="hidden md:block">
|
118
|
+
<nav>
|
119
|
+
{navigation.map((section) => (
|
120
|
+
<div key={section.group} className="mb-8">
|
121
|
+
<h5 className="mb-2 text-sm font-semibold text-gray-400">
|
122
|
+
{section.group}
|
123
|
+
</h5>
|
124
|
+
<ul className="space-y-1.5">
|
125
|
+
{section.pages.map((page) => {
|
126
|
+
const IconComponent = page.icon ? iconMap[page.icon] : null;
|
127
|
+
return (
|
128
|
+
<li key={page.slug}>
|
129
|
+
{page.isExternal ? (
|
130
|
+
<a
|
131
|
+
href={page.slug}
|
132
|
+
target="_blank"
|
133
|
+
rel="noopener noreferrer"
|
134
|
+
className="flex items-center gap-2 text-sm text-gray-400 hover:text-white hover:bg-gray-800 rounded-md p-1.5 transition-all"
|
135
|
+
>
|
136
|
+
{IconComponent && (
|
137
|
+
<div className="p-1 border border-gray-700 rounded-md">
|
138
|
+
<IconComponent className="w-4 h-4" />
|
139
|
+
</div>
|
140
|
+
)}
|
141
|
+
{page.title}
|
142
|
+
</a>
|
143
|
+
) : (
|
144
|
+
<Link
|
145
|
+
href={`${config.basePath}/${page.slug}`}
|
146
|
+
className={cn(
|
147
|
+
"block text-sm text-gray-400 hover:text-white hover:bg-gray-800 rounded-md p-1.5 transition-all",
|
148
|
+
currentPath === `${config.basePath}/${page.slug}` &&
|
149
|
+
"text-white bg-gray-800"
|
150
|
+
)}
|
151
|
+
>
|
152
|
+
{page.title}
|
153
|
+
</Link>
|
154
|
+
)}
|
155
|
+
</li>
|
156
|
+
);
|
157
|
+
})}
|
158
|
+
</ul>
|
159
|
+
</div>
|
160
|
+
))}
|
161
|
+
</nav>
|
162
|
+
</div>
|
163
|
+
</>
|
164
|
+
);
|
165
|
+
}
|