specra 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/LICENSE.MD +21 -0
- package/README.md +157 -0
- package/dist/app/api/mdx-watch/route.d.mts +12 -0
- package/dist/app/api/mdx-watch/route.d.ts +12 -0
- package/dist/app/api/mdx-watch/route.js +98 -0
- package/dist/app/api/mdx-watch/route.js.map +1 -0
- package/dist/app/api/mdx-watch/route.mjs +71 -0
- package/dist/app/api/mdx-watch/route.mjs.map +1 -0
- package/dist/app/docs-page.d.mts +32 -0
- package/dist/app/docs-page.d.ts +32 -0
- package/dist/app/docs-page.js +4072 -0
- package/dist/app/docs-page.js.map +1 -0
- package/dist/app/docs-page.mjs +14 -0
- package/dist/app/docs-page.mjs.map +1 -0
- package/dist/app/layout.css +297 -0
- package/dist/app/layout.css.map +1 -0
- package/dist/app/layout.d.mts +19 -0
- package/dist/app/layout.d.ts +19 -0
- package/dist/app/layout.js +112 -0
- package/dist/app/layout.js.map +1 -0
- package/dist/app/layout.mjs +13 -0
- package/dist/app/layout.mjs.map +1 -0
- package/dist/chunk-DR4EPLMT.mjs +1013 -0
- package/dist/chunk-DR4EPLMT.mjs.map +1 -0
- package/dist/chunk-INL2EC72.mjs +170 -0
- package/dist/chunk-INL2EC72.mjs.map +1 -0
- package/dist/chunk-IZFGEAD6.mjs +61 -0
- package/dist/chunk-IZFGEAD6.mjs.map +1 -0
- package/dist/chunk-KTRWWAGL.mjs +50 -0
- package/dist/chunk-KTRWWAGL.mjs.map +1 -0
- package/dist/chunk-MZJHJ6BV.mjs +21 -0
- package/dist/chunk-MZJHJ6BV.mjs.map +1 -0
- package/dist/chunk-NXRIAL7T.mjs +3119 -0
- package/dist/chunk-NXRIAL7T.mjs.map +1 -0
- package/dist/components/index.d.mts +822 -0
- package/dist/components/index.d.ts +822 -0
- package/dist/components/index.js +3738 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +3627 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/index.css +297 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +545 -0
- package/dist/index.d.ts +545 -0
- package/dist/index.js +4648 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +347 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/index.d.mts +798 -0
- package/dist/lib/index.d.ts +798 -0
- package/dist/lib/index.js +1301 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/index.mjs +89 -0
- package/dist/lib/index.mjs.map +1 -0
- package/package.json +119 -0
- package/src/app/api/mdx-watch/route.ts +86 -0
- package/src/app/docs-page.tsx +212 -0
- package/src/app/layout.tsx +74 -0
- package/src/components/docs/accordion.tsx +53 -0
- package/src/components/docs/api/api-endpoint.tsx +59 -0
- package/src/components/docs/api/api-params.tsx +43 -0
- package/src/components/docs/api/api-playground.tsx +233 -0
- package/src/components/docs/api/api-reference.tsx +291 -0
- package/src/components/docs/api/api-response.tsx +48 -0
- package/src/components/docs/api/index.ts +5 -0
- package/src/components/docs/badge.tsx +22 -0
- package/src/components/docs/breadcrumb.tsx +51 -0
- package/src/components/docs/callout.tsx +109 -0
- package/src/components/docs/card.tsx +84 -0
- package/src/components/docs/category-index.tsx +112 -0
- package/src/components/docs/code-block.tsx +129 -0
- package/src/components/docs/columns.tsx +45 -0
- package/src/components/docs/componentTextProps.ts +85 -0
- package/src/components/docs/dev-mode-badge.tsx +35 -0
- package/src/components/docs/doc-layout-wrapper.tsx +54 -0
- package/src/components/docs/doc-layout.tsx +111 -0
- package/src/components/docs/doc-loading.tsx +15 -0
- package/src/components/docs/doc-metadata.tsx +55 -0
- package/src/components/docs/doc-navigation.tsx +62 -0
- package/src/components/docs/doc-tags.tsx +25 -0
- package/src/components/docs/draft-badge.tsx +10 -0
- package/src/components/docs/footer.tsx +47 -0
- package/src/components/docs/frame.tsx +22 -0
- package/src/components/docs/header.tsx +122 -0
- package/src/components/docs/hot-reload-indicator.tsx +77 -0
- package/src/components/docs/icon.tsx +70 -0
- package/src/components/docs/image-card.tsx +95 -0
- package/src/components/docs/image.tsx +73 -0
- package/src/components/docs/index.ts +48 -0
- package/src/components/docs/math.tsx +46 -0
- package/src/components/docs/mdx-components.tsx +166 -0
- package/src/components/docs/mdx-hot-reload.tsx +37 -0
- package/src/components/docs/mermaid.tsx +77 -0
- package/src/components/docs/mobile-doc-layout.tsx +115 -0
- package/src/components/docs/not-found-content.tsx +55 -0
- package/src/components/docs/search-highlight.tsx +127 -0
- package/src/components/docs/search-modal.tsx +223 -0
- package/src/components/docs/sidebar-skeleton.tsx +39 -0
- package/src/components/docs/sidebar.tsx +323 -0
- package/src/components/docs/site-banner.tsx +92 -0
- package/src/components/docs/steps.tsx +29 -0
- package/src/components/docs/tab-context.tsx +28 -0
- package/src/components/docs/tab-groups.tsx +50 -0
- package/src/components/docs/table-of-contents.tsx +104 -0
- package/src/components/docs/tabs.tsx +63 -0
- package/src/components/docs/theme-toggle.tsx +39 -0
- package/src/components/docs/tooltip.tsx +37 -0
- package/src/components/docs/version-switcher.tsx +52 -0
- package/src/components/docs/video.tsx +80 -0
- package/src/components/global/index.ts +3 -0
- package/src/components/global/version-not-found.tsx +26 -0
- package/src/components/index.ts +8 -0
- package/src/components/theme-provider.tsx +11 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/button.tsx +60 -0
- package/src/components/ui/dialog.tsx +143 -0
- package/src/components/ui/index.ts +6 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/index.ts +41 -0
- package/src/lib/api-parser.types.ts +78 -0
- package/src/lib/api.types.ts +202 -0
- package/src/lib/category.ts +71 -0
- package/src/lib/config.server.ts +170 -0
- package/src/lib/config.ts +20 -0
- package/src/lib/config.types.ts +295 -0
- package/src/lib/dev-utils.ts +75 -0
- package/src/lib/index.ts +27 -0
- package/src/lib/mdx-cache.ts +200 -0
- package/src/lib/mdx.ts +402 -0
- package/src/lib/parsers/base-parser.ts +16 -0
- package/src/lib/parsers/index.ts +69 -0
- package/src/lib/parsers/openapi-parser.ts +251 -0
- package/src/lib/parsers/postman-parser.ts +301 -0
- package/src/lib/parsers/specra-parser.ts +24 -0
- package/src/lib/redirects.ts +40 -0
- package/src/lib/remark-code-meta.ts +23 -0
- package/src/lib/sidebar-utils.ts +188 -0
- package/src/lib/toc.ts +24 -0
- package/src/lib/utils.ts +36 -0
- package/src/specra.config.json +124 -0
- package/src/styles/globals.css +427 -0
|
@@ -0,0 +1,3627 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/docs/accordion.tsx
|
|
4
|
+
import { ChevronDown } from "lucide-react";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
function AccordionItem({ title, children, defaultOpen = false }) {
|
|
8
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { className: "border border-border rounded-xl overflow-hidden mb-2", children: [
|
|
10
|
+
/* @__PURE__ */ jsxs(
|
|
11
|
+
"button",
|
|
12
|
+
{
|
|
13
|
+
onClick: () => setIsOpen(!isOpen),
|
|
14
|
+
className: "w-full flex items-center justify-between p-4 text-left bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: title }),
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
ChevronDown,
|
|
19
|
+
{
|
|
20
|
+
className: `h-5 w-5 text-muted-foreground transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
isOpen && /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-border bg-background", children: /* @__PURE__ */ jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none [&>*:last-child]:mb-0", children }) })
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
function Accordion({ children, type = "multiple", className }) {
|
|
30
|
+
return /* @__PURE__ */ jsx("div", { className: className || "my-6 space-y-2", children });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/components/docs/badge.tsx
|
|
34
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
35
|
+
function Badge({ children, variant = "default" }) {
|
|
36
|
+
const variants = {
|
|
37
|
+
default: "bg-muted text-foreground border-border",
|
|
38
|
+
success: "bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20",
|
|
39
|
+
warning: "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20",
|
|
40
|
+
error: "bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20",
|
|
41
|
+
info: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20"
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ jsx2(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
className: `inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium border ${variants[variant]}`,
|
|
47
|
+
children
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/components/docs/breadcrumb.tsx
|
|
53
|
+
import Link from "next/link";
|
|
54
|
+
import { ChevronRight } from "lucide-react";
|
|
55
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
56
|
+
function Breadcrumb({ version, slug, title }) {
|
|
57
|
+
const parts = slug.split("/");
|
|
58
|
+
const breadcrumbs = [
|
|
59
|
+
{ label: "Docs", href: `/docs/${version}` }
|
|
60
|
+
];
|
|
61
|
+
let currentPath = "";
|
|
62
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
63
|
+
currentPath += (currentPath ? "/" : "") + parts[i];
|
|
64
|
+
breadcrumbs.push({
|
|
65
|
+
label: parts[i].replace(/-/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()),
|
|
66
|
+
href: `/docs/${version}/${currentPath}`
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
breadcrumbs.push({
|
|
70
|
+
label: title,
|
|
71
|
+
href: `/docs/${version}/${slug}`
|
|
72
|
+
});
|
|
73
|
+
return /* @__PURE__ */ jsx3("nav", { className: "flex items-center gap-2 text-sm text-muted-foreground mb-4", "aria-label": "Breadcrumb", children: breadcrumbs.map((crumb, index) => /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
74
|
+
index > 0 && /* @__PURE__ */ jsx3(ChevronRight, { className: "h-4 w-4" }),
|
|
75
|
+
index === breadcrumbs.length - 1 ? /* @__PURE__ */ jsx3("span", { className: "text-foreground font-medium", children: crumb.label }) : /* @__PURE__ */ jsx3(
|
|
76
|
+
Link,
|
|
77
|
+
{
|
|
78
|
+
href: crumb.href,
|
|
79
|
+
className: "hover:text-foreground transition-colors",
|
|
80
|
+
children: crumb.label
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] }, crumb.href)) });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/components/docs/callout.tsx
|
|
87
|
+
import { Info, AlertTriangle, CheckCircle2, XCircle, Lightbulb } from "lucide-react";
|
|
88
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
89
|
+
function Callout({ children, type = "info", title }) {
|
|
90
|
+
const configs = {
|
|
91
|
+
info: {
|
|
92
|
+
icon: Info,
|
|
93
|
+
className: "bg-blue-500/10 border-blue-500/30 text-blue-900 dark:bg-blue-400/5 dark:border-blue-500/20 dark:text-blue-400",
|
|
94
|
+
iconClassName: "text-blue-600 dark:text-blue-400",
|
|
95
|
+
titleClassName: "text-blue-700 dark:text-blue-300",
|
|
96
|
+
defaultTitle: "Info"
|
|
97
|
+
},
|
|
98
|
+
note: {
|
|
99
|
+
icon: Info,
|
|
100
|
+
className: "bg-blue-500/10 border-blue-500/30 text-blue-900 dark:bg-blue-400/5 dark:border-blue-500/20 dark:text-blue-400",
|
|
101
|
+
iconClassName: "text-blue-600 dark:text-blue-400",
|
|
102
|
+
titleClassName: "text-blue-700 dark:text-blue-300",
|
|
103
|
+
defaultTitle: "Note"
|
|
104
|
+
},
|
|
105
|
+
warning: {
|
|
106
|
+
icon: AlertTriangle,
|
|
107
|
+
className: "bg-yellow-500/10 border-yellow-500/30 text-yellow-900 dark:bg-yellow-400/5 dark:border-yellow-500/20 dark:text-yellow-400",
|
|
108
|
+
iconClassName: "text-yellow-600 dark:text-yellow-400",
|
|
109
|
+
titleClassName: "text-yellow-700 dark:text-yellow-300",
|
|
110
|
+
defaultTitle: "Warning"
|
|
111
|
+
},
|
|
112
|
+
success: {
|
|
113
|
+
icon: CheckCircle2,
|
|
114
|
+
className: "bg-green-500/10 border-green-500/30 text-green-900 dark:bg-green-400/5 dark:border-green-500/20 dark:text-green-400",
|
|
115
|
+
iconClassName: "text-green-600 dark:text-green-400",
|
|
116
|
+
titleClassName: "text-green-700 dark:text-green-300",
|
|
117
|
+
defaultTitle: "Success"
|
|
118
|
+
},
|
|
119
|
+
error: {
|
|
120
|
+
icon: XCircle,
|
|
121
|
+
className: "bg-red-500/10 border-red-500/30 text-red-900 dark:bg-red-400/5 dark:border-red-500/20 dark:text-red-400",
|
|
122
|
+
iconClassName: "text-red-600 dark:text-red-400",
|
|
123
|
+
titleClassName: "text-red-700 dark:text-red-300",
|
|
124
|
+
defaultTitle: "Error"
|
|
125
|
+
},
|
|
126
|
+
danger: {
|
|
127
|
+
icon: XCircle,
|
|
128
|
+
className: "bg-red-500/10 border-red-500/30 text-red-900 dark:bg-red-400/5 dark:border-red-500/20 dark:text-red-400",
|
|
129
|
+
iconClassName: "text-red-600 dark:text-red-400",
|
|
130
|
+
titleClassName: "text-red-700 dark:text-red-300",
|
|
131
|
+
defaultTitle: "Danger"
|
|
132
|
+
},
|
|
133
|
+
tip: {
|
|
134
|
+
icon: Lightbulb,
|
|
135
|
+
className: "bg-purple-500/10 border-purple-500/30 text-purple-900 dark:bg-purple-400/5 dark:border-purple-500/20 dark:text-purple-400",
|
|
136
|
+
iconClassName: "text-purple-600 dark:text-purple-400",
|
|
137
|
+
titleClassName: "text-purple-700 dark:text-purple-300",
|
|
138
|
+
defaultTitle: "Tip"
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const config = configs[type];
|
|
142
|
+
const Icon2 = config.icon;
|
|
143
|
+
let _title = title || config.defaultTitle;
|
|
144
|
+
let content = children;
|
|
145
|
+
if (!title && children && typeof children === "object") {
|
|
146
|
+
const childArray = Array.isArray(children) ? children : [children];
|
|
147
|
+
const firstElement = childArray[0];
|
|
148
|
+
if (firstElement && typeof firstElement === "object" && "props" in firstElement) {
|
|
149
|
+
const props = firstElement.props;
|
|
150
|
+
if (props.children && Array.isArray(props.children)) {
|
|
151
|
+
const strongChild = props.children.find(
|
|
152
|
+
(child) => child && typeof child === "object" && child.type === "strong"
|
|
153
|
+
);
|
|
154
|
+
if (strongChild) {
|
|
155
|
+
_title = strongChild.props.children;
|
|
156
|
+
content = childArray.map((child, idx) => {
|
|
157
|
+
if (idx === 0 && typeof child === "object" && "props" in child) {
|
|
158
|
+
const newChildren = child.props.children.filter((c) => c !== strongChild);
|
|
159
|
+
return { ...child, props: { ...child.props, children: newChildren } };
|
|
160
|
+
}
|
|
161
|
+
return child;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return /* @__PURE__ */ jsxs3("div", { className: `flex gap-3 p-4 rounded-xl border my-2 ${config.className}`, children: [
|
|
168
|
+
/* @__PURE__ */ jsx4("div", { className: "flex-shrink-0 mt-0.5", children: /* @__PURE__ */ jsx4(Icon2, { className: `h-5 w-5 ${config.iconClassName}` }) }),
|
|
169
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex-1 space-y-0", children: [
|
|
170
|
+
/* @__PURE__ */ jsx4("div", { className: `font-semibold text-sm ${config.titleClassName}`, children: _title }),
|
|
171
|
+
/* @__PURE__ */ jsx4("div", { className: "text-sm leading-relaxed [&>p]:mb-0 [&>p]:text-current", children: content })
|
|
172
|
+
] })
|
|
173
|
+
] });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/components/docs/card.tsx
|
|
177
|
+
import { ArrowRight, ExternalLink } from "lucide-react";
|
|
178
|
+
import Link2 from "next/link";
|
|
179
|
+
|
|
180
|
+
// src/components/docs/icon.tsx
|
|
181
|
+
import * as LucideIcons from "lucide-react";
|
|
182
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
183
|
+
function Icon({ icon, iconType = "regular", color, size = 20, className = "" }) {
|
|
184
|
+
if (typeof icon !== "string") {
|
|
185
|
+
return /* @__PURE__ */ jsx5("span", { className: `inline-flex items-center ${className}`, style: { color }, children: icon });
|
|
186
|
+
}
|
|
187
|
+
if (icon.startsWith("http") || icon.startsWith("/")) {
|
|
188
|
+
return /* @__PURE__ */ jsx5(
|
|
189
|
+
"img",
|
|
190
|
+
{
|
|
191
|
+
src: icon,
|
|
192
|
+
alt: "",
|
|
193
|
+
width: size,
|
|
194
|
+
height: size,
|
|
195
|
+
className: `inline-block ${className}`,
|
|
196
|
+
style: { color }
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
if (icon.startsWith("fa-")) {
|
|
201
|
+
const faClass = `fa-${iconType} ${icon}`;
|
|
202
|
+
return /* @__PURE__ */ jsx5(
|
|
203
|
+
"i",
|
|
204
|
+
{
|
|
205
|
+
className: `${faClass} ${className}`,
|
|
206
|
+
style: { fontSize: size, color },
|
|
207
|
+
"aria-hidden": "true"
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
const iconName = icon.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
212
|
+
const LucideIcon = LucideIcons[iconName];
|
|
213
|
+
if (LucideIcon) {
|
|
214
|
+
return /* @__PURE__ */ jsx5(
|
|
215
|
+
LucideIcon,
|
|
216
|
+
{
|
|
217
|
+
size,
|
|
218
|
+
className: `inline-block ${className}`,
|
|
219
|
+
style: { color },
|
|
220
|
+
"aria-hidden": "true"
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
return /* @__PURE__ */ jsxs4("span", { className: `inline-flex items-center font-mono text-xs ${className}`, style: { color }, children: [
|
|
225
|
+
"[",
|
|
226
|
+
icon,
|
|
227
|
+
"]"
|
|
228
|
+
] });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/components/docs/card.tsx
|
|
232
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
233
|
+
function Card({ title, description, href, icon, children, external = false }) {
|
|
234
|
+
const content = /* @__PURE__ */ jsx6(Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
|
|
235
|
+
icon && /* @__PURE__ */ jsx6("div", { className: "shrink-0 w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary", children: typeof icon === "string" ? /* @__PURE__ */ jsx6(Icon, { icon, size: 20 }) : icon }),
|
|
236
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex-1 min-w-0", children: [
|
|
237
|
+
/* @__PURE__ */ jsx6("h3", { className: `font-semibold text-foreground mb-1 no-underline ${href ? "group-hover:text-primary transition-colors" : ""}`, children: title }),
|
|
238
|
+
description && /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground line-clamp-2 no-underline", children: description }),
|
|
239
|
+
children && /* @__PURE__ */ jsx6("div", { className: "mt-2 text-sm text-muted-foreground no-underline", children })
|
|
240
|
+
] }),
|
|
241
|
+
href && /* @__PURE__ */ jsx6("div", { className: "shrink-0 self-start mt-1", children: external ? /* @__PURE__ */ jsx6(ExternalLink, { className: "h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" }) : /* @__PURE__ */ jsx6(ArrowRight, { className: "h-4 w-4 text-muted-foreground group-hover:text-primary group-hover:translate-x-1 transition-all" }) })
|
|
242
|
+
] }) });
|
|
243
|
+
if (href) {
|
|
244
|
+
const Component = external ? "a" : Link2;
|
|
245
|
+
return /* @__PURE__ */ jsx6(
|
|
246
|
+
Component,
|
|
247
|
+
{
|
|
248
|
+
href,
|
|
249
|
+
className: "card-link group block p-4 rounded-xl border border-border hover:border-primary/50 hover:bg-muted/50 transition-all",
|
|
250
|
+
...external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
251
|
+
children: content
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
return /* @__PURE__ */ jsx6("div", { className: "p-4 rounded-xl border border-border bg-muted/30 no-underline", children: content });
|
|
256
|
+
}
|
|
257
|
+
function CardGrid({ children, cols = 2 }) {
|
|
258
|
+
const gridCols = {
|
|
259
|
+
1: "grid-cols-1",
|
|
260
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
261
|
+
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
262
|
+
};
|
|
263
|
+
return /* @__PURE__ */ jsx6("div", { className: `grid ${gridCols[cols]} gap-4 my-6`, children });
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// src/components/docs/category-index.tsx
|
|
267
|
+
import Link4 from "next/link";
|
|
268
|
+
import { ChevronRight as ChevronRight2, FileText } from "lucide-react";
|
|
269
|
+
import { MDXRemote } from "next-mdx-remote/rsc";
|
|
270
|
+
import remarkGfm from "remark-gfm";
|
|
271
|
+
|
|
272
|
+
// src/lib/remark-code-meta.ts
|
|
273
|
+
function remarkCodeMeta() {
|
|
274
|
+
return (tree) => {
|
|
275
|
+
const visit = (node) => {
|
|
276
|
+
if (node.type === "code" && node.meta) {
|
|
277
|
+
node.data = node.data || {};
|
|
278
|
+
node.data.hProperties = node.data.hProperties || {};
|
|
279
|
+
node.data.hProperties.meta = node.meta;
|
|
280
|
+
}
|
|
281
|
+
if (node.children) {
|
|
282
|
+
node.children.forEach(visit);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
visit(tree);
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// src/components/docs/category-index.tsx
|
|
290
|
+
import rehypeSlug from "rehype-slug";
|
|
291
|
+
|
|
292
|
+
// src/components/docs/code-block.tsx
|
|
293
|
+
import { useState as useState2 } from "react";
|
|
294
|
+
import { Check, Copy } from "lucide-react";
|
|
295
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
296
|
+
function CodeBlock({ code, language, filename }) {
|
|
297
|
+
const [copied, setCopied] = useState2(false);
|
|
298
|
+
const handleCopy = async () => {
|
|
299
|
+
await navigator.clipboard.writeText(code);
|
|
300
|
+
setCopied(true);
|
|
301
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
302
|
+
};
|
|
303
|
+
const highlightCode = (code2, lang) => {
|
|
304
|
+
const lines = code2.split("\n");
|
|
305
|
+
return lines.map((line, i) => {
|
|
306
|
+
const tokens = [];
|
|
307
|
+
let currentPos = 0;
|
|
308
|
+
const patterns = [
|
|
309
|
+
{ type: "comment", regex: /(\/\/.*$|\/\*[\s\S]*?\*\/|#.*$)/ },
|
|
310
|
+
{ type: "string", regex: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`)/ },
|
|
311
|
+
{
|
|
312
|
+
type: "keyword",
|
|
313
|
+
regex: /\b(const|let|var|function|return|if|else|for|while|do|break|continue|switch|case|default|import|export|from|as|class|extends|implements|interface|type|enum|namespace|async|await|try|catch|finally|throw|new|this|super|static|public|private|protected|readonly|abstract|void|null|undefined|true|false|typeof|instanceof|delete|in|of)\b/
|
|
314
|
+
},
|
|
315
|
+
{ type: "operator", regex: /([+\-*/%=<>!&|^~?:]+)/ },
|
|
316
|
+
{ type: "number", regex: /\b(0x[a-fA-F0-9]+|0b[01]+|\d+\.?\d*(?:e[+-]?\d+)?)\b/ },
|
|
317
|
+
{ type: "function", regex: /\b([a-zA-Z_$][\w$]*)\s*(?=\()/ },
|
|
318
|
+
{ type: "property", regex: /\.([a-zA-Z_$][\w$]*)/ },
|
|
319
|
+
{ type: "punctuation", regex: /([{}[\]();,])/ }
|
|
320
|
+
];
|
|
321
|
+
while (currentPos < line.length) {
|
|
322
|
+
let matched = false;
|
|
323
|
+
for (const { type, regex } of patterns) {
|
|
324
|
+
const match = line.slice(currentPos).match(regex);
|
|
325
|
+
if (match && match.index === 0) {
|
|
326
|
+
tokens.push({ type, value: match[0] });
|
|
327
|
+
currentPos += match[0].length;
|
|
328
|
+
matched = true;
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (!matched) {
|
|
333
|
+
const nextSpecialChar = line.slice(currentPos).search(/["'`/\w.+\-*/%=<>!&|^~?:;,()[\]{}#]/);
|
|
334
|
+
if (nextSpecialChar === -1) {
|
|
335
|
+
tokens.push({ type: "text", value: line.slice(currentPos) });
|
|
336
|
+
break;
|
|
337
|
+
} else if (nextSpecialChar > 0) {
|
|
338
|
+
tokens.push({ type: "text", value: line.slice(currentPos, currentPos + nextSpecialChar) });
|
|
339
|
+
currentPos += nextSpecialChar;
|
|
340
|
+
} else {
|
|
341
|
+
tokens.push({ type: "text", value: line[currentPos] });
|
|
342
|
+
currentPos++;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return /* @__PURE__ */ jsxs6("div", { className: "table-row", children: [
|
|
347
|
+
/* @__PURE__ */ jsx7("span", { className: "table-cell pr-4 text-right select-none text-muted-foreground/40 w-8 align-top", children: i + 1 }),
|
|
348
|
+
/* @__PURE__ */ jsx7("span", { className: "table-cell align-top", children: tokens.length === 0 ? /* @__PURE__ */ jsx7("span", { children: "\xA0" }) : tokens.map((token, j) => /* @__PURE__ */ jsx7("span", { className: `token-${token.type}`, children: token.value }, j)) })
|
|
349
|
+
] }, i);
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
return /* @__PURE__ */ jsxs6("div", { className: "relative group my-2", children: [
|
|
353
|
+
/* @__PURE__ */ jsxs6("div", { className: "bg-muted/50 dark:bg-muted/30 px-4 py-2 rounded-t-xl border border-b-0 border-border/50 flex items-center justify-between", children: [
|
|
354
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
|
|
355
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
|
|
356
|
+
/* @__PURE__ */ jsx7("div", { className: "w-3 h-3 rounded-full bg-red-500/80 dark:bg-red-500/60" }),
|
|
357
|
+
/* @__PURE__ */ jsx7("div", { className: "w-3 h-3 rounded-full bg-yellow-500/80 dark:bg-yellow-500/60" }),
|
|
358
|
+
/* @__PURE__ */ jsx7("div", { className: "w-3 h-3 rounded-full bg-green-500/80 dark:bg-green-500/60" })
|
|
359
|
+
] }),
|
|
360
|
+
/* @__PURE__ */ jsx7("span", { className: "text-xs font-mono text-foreground", children: filename || "Code" })
|
|
361
|
+
] }),
|
|
362
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
363
|
+
/* @__PURE__ */ jsx7("span", { className: "text-xs text-muted-foreground/60 font-mono uppercase tracking-wide", children: language }),
|
|
364
|
+
/* @__PURE__ */ jsx7(
|
|
365
|
+
"button",
|
|
366
|
+
{
|
|
367
|
+
onClick: handleCopy,
|
|
368
|
+
className: "p-1.5 rounded-md hover:bg-muted/50 transition-colors",
|
|
369
|
+
"aria-label": "Copy code",
|
|
370
|
+
children: copied ? /* @__PURE__ */ jsx7(Check, { className: "h-4 w-4 text-green-400" }) : /* @__PURE__ */ jsx7(Copy, { className: "h-4 w-4 text-muted-foreground" })
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
] })
|
|
374
|
+
] }),
|
|
375
|
+
/* @__PURE__ */ jsx7("div", { className: "bg-gray-200/50 dark:bg-[#0d1117] rounded-b-xl overflow-x-auto border border-border/50", children: /* @__PURE__ */ jsx7("pre", { className: "p-2 text-[13px] font-mono leading-relaxed text-gray-800 dark:text-gray-200", children: /* @__PURE__ */ jsx7("code", { className: "table w-full", children: highlightCode(code, language) }) }) })
|
|
376
|
+
] });
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/components/docs/tabs.tsx
|
|
380
|
+
import { useState as useState3, Children, isValidElement } from "react";
|
|
381
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
382
|
+
function Tab({ children }) {
|
|
383
|
+
return /* @__PURE__ */ jsx8(Fragment2, { children });
|
|
384
|
+
}
|
|
385
|
+
function Tabs({ children, defaultValue }) {
|
|
386
|
+
const tabs = Children.toArray(children).filter(isValidElement);
|
|
387
|
+
const firstTabLabel = tabs[0]?.props.label || "";
|
|
388
|
+
const [activeTab, setActiveTab] = useState3(defaultValue || firstTabLabel);
|
|
389
|
+
return /* @__PURE__ */ jsxs7("div", { className: "my-6", children: [
|
|
390
|
+
/* @__PURE__ */ jsx8("div", { className: "flex items-center gap-1 border-b border-border mb-4", children: tabs.map((tab) => {
|
|
391
|
+
const label = tab.props.label;
|
|
392
|
+
const isActive = activeTab === label;
|
|
393
|
+
return /* @__PURE__ */ jsx8(
|
|
394
|
+
"button",
|
|
395
|
+
{
|
|
396
|
+
onClick: () => setActiveTab(label),
|
|
397
|
+
className: `px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${isActive ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
398
|
+
children: label
|
|
399
|
+
},
|
|
400
|
+
label
|
|
401
|
+
);
|
|
402
|
+
}) }),
|
|
403
|
+
tabs.map((tab) => {
|
|
404
|
+
const label = tab.props.label;
|
|
405
|
+
if (activeTab !== label) return null;
|
|
406
|
+
return /* @__PURE__ */ jsx8("div", { className: "prose prose-slate dark:prose-invert max-w-none [&>*:first-child]:mt-0", children: tab.props.children }, label);
|
|
407
|
+
})
|
|
408
|
+
] });
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// src/components/docs/image.tsx
|
|
412
|
+
import NextImage from "next/image";
|
|
413
|
+
import { useState as useState4 } from "react";
|
|
414
|
+
import { ZoomIn, X } from "lucide-react";
|
|
415
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
416
|
+
function Image({ src, alt, caption, width, height, zoom = true }) {
|
|
417
|
+
const [isZoomed, setIsZoomed] = useState4(false);
|
|
418
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
419
|
+
/* @__PURE__ */ jsxs8("figure", { className: "my-6", children: [
|
|
420
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative group rounded-xl border border-border overflow-hidden bg-muted/30", children: [
|
|
421
|
+
/* @__PURE__ */ jsx9(
|
|
422
|
+
NextImage,
|
|
423
|
+
{
|
|
424
|
+
src,
|
|
425
|
+
alt,
|
|
426
|
+
width: width || 1200,
|
|
427
|
+
height: height || 675,
|
|
428
|
+
className: "w-full h-auto"
|
|
429
|
+
}
|
|
430
|
+
),
|
|
431
|
+
zoom && /* @__PURE__ */ jsx9(
|
|
432
|
+
"button",
|
|
433
|
+
{
|
|
434
|
+
onClick: () => setIsZoomed(true),
|
|
435
|
+
className: "absolute top-3 right-3 p-2 rounded-md bg-background/80 backdrop-blur-sm border border-border opacity-0 group-hover:opacity-100 transition-opacity hover:bg-background",
|
|
436
|
+
"aria-label": "Zoom image",
|
|
437
|
+
children: /* @__PURE__ */ jsx9(ZoomIn, { className: "h-4 w-4 text-foreground" })
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
] }),
|
|
441
|
+
caption && /* @__PURE__ */ jsx9("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
442
|
+
] }),
|
|
443
|
+
isZoomed && /* @__PURE__ */ jsxs8(
|
|
444
|
+
"div",
|
|
445
|
+
{
|
|
446
|
+
className: "fixed inset-0 z-50 bg-background/95 backdrop-blur-sm flex items-center justify-center p-4",
|
|
447
|
+
onClick: () => setIsZoomed(false),
|
|
448
|
+
children: [
|
|
449
|
+
/* @__PURE__ */ jsx9(
|
|
450
|
+
"button",
|
|
451
|
+
{
|
|
452
|
+
onClick: () => setIsZoomed(false),
|
|
453
|
+
className: "absolute top-4 right-4 p-2 rounded-md bg-muted hover:bg-muted/80 transition-colors",
|
|
454
|
+
"aria-label": "Close",
|
|
455
|
+
children: /* @__PURE__ */ jsx9(X, { className: "h-5 w-5 text-foreground" })
|
|
456
|
+
}
|
|
457
|
+
),
|
|
458
|
+
/* @__PURE__ */ jsx9("div", { className: "max-w-7xl max-h-[90vh] overflow-auto", children: /* @__PURE__ */ jsx9(
|
|
459
|
+
NextImage,
|
|
460
|
+
{
|
|
461
|
+
src,
|
|
462
|
+
alt,
|
|
463
|
+
width: width || 1920,
|
|
464
|
+
height: height || 1080,
|
|
465
|
+
className: "w-full h-auto"
|
|
466
|
+
}
|
|
467
|
+
) })
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
)
|
|
471
|
+
] });
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// src/components/docs/video.tsx
|
|
475
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
476
|
+
function Video({
|
|
477
|
+
src,
|
|
478
|
+
caption,
|
|
479
|
+
autoplay = false,
|
|
480
|
+
loop = false,
|
|
481
|
+
muted = false,
|
|
482
|
+
controls = true,
|
|
483
|
+
poster
|
|
484
|
+
}) {
|
|
485
|
+
const isYouTube = src.includes("youtube.com") || src.includes("youtu.be");
|
|
486
|
+
const isVimeo = src.includes("vimeo.com");
|
|
487
|
+
const getYouTubeId = (url) => {
|
|
488
|
+
const match = url.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/);
|
|
489
|
+
return match ? match[1] : null;
|
|
490
|
+
};
|
|
491
|
+
const getVimeoId = (url) => {
|
|
492
|
+
const match = url.match(/vimeo\.com\/(\d+)/);
|
|
493
|
+
return match ? match[1] : null;
|
|
494
|
+
};
|
|
495
|
+
return /* @__PURE__ */ jsxs9("figure", { className: "my-6", children: [
|
|
496
|
+
/* @__PURE__ */ jsx10("div", { className: "relative rounded-xl border border-border overflow-hidden bg-muted/30", children: isYouTube ? /* @__PURE__ */ jsx10("div", { className: "relative w-full", style: { paddingBottom: "56.25%" }, children: /* @__PURE__ */ jsx10(
|
|
497
|
+
"iframe",
|
|
498
|
+
{
|
|
499
|
+
className: "absolute top-0 left-0 w-full h-full",
|
|
500
|
+
src: `https://www.youtube.com/embed/${getYouTubeId(src)}${autoplay ? "?autoplay=1" : ""}`,
|
|
501
|
+
title: "YouTube video",
|
|
502
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
503
|
+
allowFullScreen: true
|
|
504
|
+
}
|
|
505
|
+
) }) : isVimeo ? /* @__PURE__ */ jsx10("div", { className: "relative w-full", style: { paddingBottom: "56.25%" }, children: /* @__PURE__ */ jsx10(
|
|
506
|
+
"iframe",
|
|
507
|
+
{
|
|
508
|
+
className: "absolute top-0 left-0 w-full h-full",
|
|
509
|
+
src: `https://player.vimeo.com/video/${getVimeoId(src)}${autoplay ? "?autoplay=1" : ""}`,
|
|
510
|
+
title: "Vimeo video",
|
|
511
|
+
allow: "autoplay; fullscreen; picture-in-picture",
|
|
512
|
+
allowFullScreen: true
|
|
513
|
+
}
|
|
514
|
+
) }) : /* @__PURE__ */ jsx10(
|
|
515
|
+
"video",
|
|
516
|
+
{
|
|
517
|
+
src,
|
|
518
|
+
controls,
|
|
519
|
+
autoPlay: autoplay,
|
|
520
|
+
loop,
|
|
521
|
+
muted,
|
|
522
|
+
poster,
|
|
523
|
+
className: "w-full h-auto",
|
|
524
|
+
children: "Your browser does not support the video tag."
|
|
525
|
+
}
|
|
526
|
+
) }),
|
|
527
|
+
caption && /* @__PURE__ */ jsx10("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
528
|
+
] });
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// src/components/docs/image-card.tsx
|
|
532
|
+
import NextImage2 from "next/image";
|
|
533
|
+
import Link3 from "next/link";
|
|
534
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
535
|
+
function ImageCard({
|
|
536
|
+
src,
|
|
537
|
+
alt,
|
|
538
|
+
title,
|
|
539
|
+
description,
|
|
540
|
+
href,
|
|
541
|
+
external = false,
|
|
542
|
+
aspectRatio = "video"
|
|
543
|
+
}) {
|
|
544
|
+
const aspectRatios = {
|
|
545
|
+
square: "aspect-square",
|
|
546
|
+
video: "aspect-video",
|
|
547
|
+
portrait: "aspect-[3/4]"
|
|
548
|
+
};
|
|
549
|
+
const content = /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-0 p-0", children: [
|
|
550
|
+
/* @__PURE__ */ jsx11("div", { className: `w-full ${aspectRatios[aspectRatio]} overflow-hidden ${title || description ? "rounded-t-xl" : "rounded-xl"} bg-muted relative`, children: /* @__PURE__ */ jsx11(
|
|
551
|
+
NextImage2,
|
|
552
|
+
{
|
|
553
|
+
src,
|
|
554
|
+
alt,
|
|
555
|
+
fill: true,
|
|
556
|
+
sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw",
|
|
557
|
+
className: "object-cover transition-transform duration-300 group-hover:scale-105"
|
|
558
|
+
}
|
|
559
|
+
) }),
|
|
560
|
+
(title || description) && /* @__PURE__ */ jsxs10("div", { className: "p-3 flex flex-col gap-1", children: [
|
|
561
|
+
title && /* @__PURE__ */ jsx11("h3", { className: `font-semibold text-foreground mb-0 no-underline ${href ? "group-hover:text-primary transition-colors" : ""}`, children: title }),
|
|
562
|
+
description && /* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground line-clamp-2 no-underline mb-0", children: description })
|
|
563
|
+
] })
|
|
564
|
+
] });
|
|
565
|
+
if (href) {
|
|
566
|
+
const Component = external ? "a" : Link3;
|
|
567
|
+
return /* @__PURE__ */ jsx11(
|
|
568
|
+
Component,
|
|
569
|
+
{
|
|
570
|
+
href,
|
|
571
|
+
className: "image-card-link group block rounded-xl border border-border hover:border-primary/50 hover:shadow-lg transition-all overflow-hidden p-0",
|
|
572
|
+
...external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
573
|
+
children: content
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
return /* @__PURE__ */ jsx11("div", { className: "block rounded-xl border border-border overflow-hidden bg-card p-0", children: content });
|
|
578
|
+
}
|
|
579
|
+
function ImageCardGrid({ children, cols = 3 }) {
|
|
580
|
+
const gridCols = {
|
|
581
|
+
1: "grid-cols-1",
|
|
582
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
583
|
+
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
584
|
+
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
|
|
585
|
+
};
|
|
586
|
+
return /* @__PURE__ */ jsx11("div", { className: `grid ${gridCols[cols]} gap-4 my-6`, children });
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// src/components/docs/steps.tsx
|
|
590
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
591
|
+
function Steps({ children }) {
|
|
592
|
+
return /* @__PURE__ */ jsx12("div", { className: "my-6 ml-4 space-y-6 [counter-reset:step]", children });
|
|
593
|
+
}
|
|
594
|
+
function Step({ title, children }) {
|
|
595
|
+
return /* @__PURE__ */ jsxs11("div", { className: "relative pl-8 pb-6 border-l-2 border-border last:border-l-0 last:pb-0 [counter-increment:step] before:content-[counter(step)] before:absolute before:left-0 before:-translate-x-1/2 before:w-8 before:h-8 before:rounded-full before:bg-primary before:text-primary-foreground before:flex before:items-center before:justify-center before:text-sm before:font-semibold before:z-10", children: [
|
|
596
|
+
/* @__PURE__ */ jsx12("div", { className: "mb-2", children: /* @__PURE__ */ jsx12("h3", { className: "text-lg font-semibold text-foreground", children: title }) }),
|
|
597
|
+
/* @__PURE__ */ jsx12("div", { className: "prose prose-sm dark:prose-invert max-w-none [&>*:last-child]:mb-0", children })
|
|
598
|
+
] });
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// src/components/docs/mermaid.tsx
|
|
602
|
+
import { useEffect, useRef, useState as useState5 } from "react";
|
|
603
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
604
|
+
function Mermaid({ chart, caption }) {
|
|
605
|
+
const containerRef = useRef(null);
|
|
606
|
+
const [error, setError] = useState5(null);
|
|
607
|
+
useEffect(() => {
|
|
608
|
+
const renderChart = async () => {
|
|
609
|
+
try {
|
|
610
|
+
const mermaid = (await import("mermaid")).default;
|
|
611
|
+
mermaid.initialize({
|
|
612
|
+
startOnLoad: false,
|
|
613
|
+
theme: document.documentElement.classList.contains("dark") ? "dark" : "default",
|
|
614
|
+
securityLevel: "loose",
|
|
615
|
+
fontFamily: "inherit"
|
|
616
|
+
});
|
|
617
|
+
if (containerRef.current) {
|
|
618
|
+
const id = `mermaid-${Math.random().toString(36).substr(2, 9)}`;
|
|
619
|
+
const { svg } = await mermaid.render(id, chart);
|
|
620
|
+
containerRef.current.innerHTML = svg;
|
|
621
|
+
}
|
|
622
|
+
} catch (err) {
|
|
623
|
+
console.error("Mermaid rendering error:", err);
|
|
624
|
+
setError(err instanceof Error ? err.message : "Failed to render diagram");
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
renderChart();
|
|
628
|
+
const observer = new MutationObserver((mutations) => {
|
|
629
|
+
mutations.forEach((mutation) => {
|
|
630
|
+
if (mutation.attributeName === "class") {
|
|
631
|
+
renderChart();
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
});
|
|
635
|
+
observer.observe(document.documentElement, { attributes: true });
|
|
636
|
+
return () => observer.disconnect();
|
|
637
|
+
}, [chart]);
|
|
638
|
+
if (error) {
|
|
639
|
+
return /* @__PURE__ */ jsx13("div", { className: "my-6 p-4 rounded-xl border border-red-500/50 bg-red-500/10", children: /* @__PURE__ */ jsxs12("p", { className: "text-sm text-red-600 dark:text-red-400 font-mono", children: [
|
|
640
|
+
"Mermaid Error: ",
|
|
641
|
+
error
|
|
642
|
+
] }) });
|
|
643
|
+
}
|
|
644
|
+
return /* @__PURE__ */ jsxs12("figure", { className: "my-6", children: [
|
|
645
|
+
/* @__PURE__ */ jsx13(
|
|
646
|
+
"div",
|
|
647
|
+
{
|
|
648
|
+
ref: containerRef,
|
|
649
|
+
className: "flex justify-center items-center p-6 rounded-xl border border-border bg-muted/30 overflow-x-auto"
|
|
650
|
+
}
|
|
651
|
+
),
|
|
652
|
+
caption && /* @__PURE__ */ jsx13("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
653
|
+
] });
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// src/components/docs/math.tsx
|
|
657
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
658
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
659
|
+
function Math2({ children, block = false }) {
|
|
660
|
+
const containerRef = useRef2(null);
|
|
661
|
+
useEffect2(() => {
|
|
662
|
+
const renderMath = async () => {
|
|
663
|
+
try {
|
|
664
|
+
const katex = (await import("katex")).default;
|
|
665
|
+
if (containerRef.current) {
|
|
666
|
+
katex.render(children, containerRef.current, {
|
|
667
|
+
throwOnError: false,
|
|
668
|
+
displayMode: block
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
} catch (err) {
|
|
672
|
+
console.error("KaTeX rendering error:", err);
|
|
673
|
+
if (containerRef.current) {
|
|
674
|
+
containerRef.current.textContent = children;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
renderMath();
|
|
679
|
+
}, [children, block]);
|
|
680
|
+
if (block) {
|
|
681
|
+
return /* @__PURE__ */ jsx14(
|
|
682
|
+
"div",
|
|
683
|
+
{
|
|
684
|
+
ref: containerRef,
|
|
685
|
+
className: "my-6 overflow-x-auto text-center"
|
|
686
|
+
}
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
return /* @__PURE__ */ jsx14("span", { ref: containerRef, className: "inline-block" });
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// src/components/docs/columns.tsx
|
|
693
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
694
|
+
function Columns({ children, cols = { sm: 1, md: 2, lg: 3 } }) {
|
|
695
|
+
const colClasses = {
|
|
696
|
+
1: "grid-cols-1",
|
|
697
|
+
2: "grid-cols-2",
|
|
698
|
+
3: "grid-cols-3",
|
|
699
|
+
4: "grid-cols-4"
|
|
700
|
+
};
|
|
701
|
+
const smClass = cols.sm ? colClasses[cols.sm] : "grid-cols-1";
|
|
702
|
+
const mdClass = cols.md ? `md:${colClasses[cols.md]}` : "";
|
|
703
|
+
const lgClass = cols.lg ? `lg:${colClasses[cols.lg]}` : "";
|
|
704
|
+
const xlClass = cols.xl ? `xl:${colClasses[cols.xl]}` : "";
|
|
705
|
+
return /* @__PURE__ */ jsx15("div", { className: `grid ${smClass} ${mdClass} ${lgClass} ${xlClass} gap-4 my-6`, children });
|
|
706
|
+
}
|
|
707
|
+
function Column({ children, span = 1 }) {
|
|
708
|
+
const spanClass = {
|
|
709
|
+
1: "col-span-1",
|
|
710
|
+
2: "col-span-2",
|
|
711
|
+
3: "col-span-3",
|
|
712
|
+
4: "col-span-4"
|
|
713
|
+
};
|
|
714
|
+
return /* @__PURE__ */ jsx15("div", { className: spanClass[span], children });
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// src/components/docs/tooltip.tsx
|
|
718
|
+
import { useState as useState6 } from "react";
|
|
719
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
720
|
+
function Tooltip({ children, content, position = "top" }) {
|
|
721
|
+
const [isVisible, setIsVisible] = useState6(false);
|
|
722
|
+
const positions = {
|
|
723
|
+
top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
724
|
+
bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
|
|
725
|
+
left: "right-full top-1/2 -translate-y-1/2 mr-2",
|
|
726
|
+
right: "left-full top-1/2 -translate-y-1/2 ml-2"
|
|
727
|
+
};
|
|
728
|
+
return /* @__PURE__ */ jsxs13(
|
|
729
|
+
"span",
|
|
730
|
+
{
|
|
731
|
+
className: "relative inline-flex underline decoration-dotted cursor-help",
|
|
732
|
+
onMouseEnter: () => setIsVisible(true),
|
|
733
|
+
onMouseLeave: () => setIsVisible(false),
|
|
734
|
+
children: [
|
|
735
|
+
children,
|
|
736
|
+
isVisible && /* @__PURE__ */ jsx16(
|
|
737
|
+
"span",
|
|
738
|
+
{
|
|
739
|
+
className: `absolute ${positions[position]} z-50 px-2 py-1 text-xs text-white bg-gray-900 dark:bg-gray-700 rounded whitespace-nowrap pointer-events-none`,
|
|
740
|
+
children: content
|
|
741
|
+
}
|
|
742
|
+
)
|
|
743
|
+
]
|
|
744
|
+
}
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// src/components/docs/frame.tsx
|
|
749
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
750
|
+
function Frame({ src, title = "Embedded content", height = 500, width = "100%" }) {
|
|
751
|
+
return /* @__PURE__ */ jsx17("div", { className: "my-6 rounded-xl border border-border overflow-hidden bg-muted/30", children: /* @__PURE__ */ jsx17(
|
|
752
|
+
"iframe",
|
|
753
|
+
{
|
|
754
|
+
src,
|
|
755
|
+
title,
|
|
756
|
+
width,
|
|
757
|
+
height,
|
|
758
|
+
className: "w-full",
|
|
759
|
+
loading: "lazy",
|
|
760
|
+
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups"
|
|
761
|
+
}
|
|
762
|
+
) });
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// src/components/docs/api/api-endpoint.tsx
|
|
766
|
+
import { useState as useState7 } from "react";
|
|
767
|
+
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
768
|
+
|
|
769
|
+
// src/lib/utils.ts
|
|
770
|
+
import { clsx } from "clsx";
|
|
771
|
+
import { twMerge } from "tailwind-merge";
|
|
772
|
+
function cn(...inputs) {
|
|
773
|
+
return twMerge(clsx(inputs));
|
|
774
|
+
}
|
|
775
|
+
function getAssetPath(path) {
|
|
776
|
+
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || process.env.__NEXT_ROUTER_BASEPATH || "";
|
|
777
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
778
|
+
if (basePath) {
|
|
779
|
+
const normalizedBase = basePath.startsWith("/") ? basePath : `/${basePath}`;
|
|
780
|
+
const cleanBase = normalizedBase.replace(/\/$/, "");
|
|
781
|
+
return `${cleanBase}${normalizedPath}`;
|
|
782
|
+
}
|
|
783
|
+
return normalizedPath;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// src/components/docs/api/api-endpoint.tsx
|
|
787
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
788
|
+
var methodColors = {
|
|
789
|
+
GET: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
790
|
+
POST: "bg-green-500/10 text-green-600 dark:text-green-400",
|
|
791
|
+
PUT: "bg-orange-500/10 text-orange-600 dark:text-orange-400",
|
|
792
|
+
PATCH: "bg-purple-500/10 text-purple-600 dark:text-purple-400",
|
|
793
|
+
DELETE: "bg-red-500/10 text-red-600 dark:text-red-400"
|
|
794
|
+
};
|
|
795
|
+
function ApiEndpoint({ method, path, summary, children, defaultOpen = false }) {
|
|
796
|
+
const [isOpen, setIsOpen] = useState7(defaultOpen);
|
|
797
|
+
return /* @__PURE__ */ jsxs14("div", { className: "not-prose mb-4 rounded-xl border border-border overflow-hidden", children: [
|
|
798
|
+
/* @__PURE__ */ jsxs14(
|
|
799
|
+
"button",
|
|
800
|
+
{
|
|
801
|
+
onClick: () => setIsOpen(!isOpen),
|
|
802
|
+
className: "w-full flex items-center gap-3 px-4 py-3 text-left bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
803
|
+
children: [
|
|
804
|
+
/* @__PURE__ */ jsx18(
|
|
805
|
+
"span",
|
|
806
|
+
{
|
|
807
|
+
className: cn(
|
|
808
|
+
"text-xs font-semibold px-2 py-0.5 rounded",
|
|
809
|
+
methodColors[method]
|
|
810
|
+
),
|
|
811
|
+
children: method
|
|
812
|
+
}
|
|
813
|
+
),
|
|
814
|
+
/* @__PURE__ */ jsx18("code", { className: "text-sm font-mono", children: path }),
|
|
815
|
+
summary && /* @__PURE__ */ jsx18("span", { className: "text-sm text-muted-foreground ml-auto mr-2", children: summary }),
|
|
816
|
+
/* @__PURE__ */ jsx18(
|
|
817
|
+
ChevronDown2,
|
|
818
|
+
{
|
|
819
|
+
className: cn(
|
|
820
|
+
"h-5 w-5 text-muted-foreground transition-transform flex-shrink-0",
|
|
821
|
+
isOpen ? "rotate-180" : ""
|
|
822
|
+
)
|
|
823
|
+
}
|
|
824
|
+
)
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
),
|
|
828
|
+
isOpen && children && /* @__PURE__ */ jsx18("div", { className: "border-t border-border bg-background", children: /* @__PURE__ */ jsx18("div", { className: "px-4 py-4 space-y-6", children }) })
|
|
829
|
+
] });
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// src/components/docs/api/api-params.tsx
|
|
833
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
834
|
+
function ApiParams({ title = "Parameters", params }) {
|
|
835
|
+
if (!params || params.length === 0) return null;
|
|
836
|
+
return /* @__PURE__ */ jsxs15("div", { className: "mb-6", children: [
|
|
837
|
+
/* @__PURE__ */ jsx19("h4", { className: "text-sm font-semibold text-foreground mb-3", children: title }),
|
|
838
|
+
/* @__PURE__ */ jsx19("div", { className: "space-y-3", children: params.map((param) => /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
839
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
|
|
840
|
+
/* @__PURE__ */ jsx19("code", { className: "text-sm font-mono text-foreground", children: param.name }),
|
|
841
|
+
/* @__PURE__ */ jsx19("span", { className: "text-xs text-muted-foreground", children: param.type }),
|
|
842
|
+
param.required && /* @__PURE__ */ jsx19("span", { className: "text-xs text-red-600 dark:text-red-400", children: "required" }),
|
|
843
|
+
param.default && /* @__PURE__ */ jsxs15("span", { className: "text-xs text-muted-foreground", children: [
|
|
844
|
+
"default: ",
|
|
845
|
+
/* @__PURE__ */ jsx19("code", { className: "text-xs", children: param.default })
|
|
846
|
+
] })
|
|
847
|
+
] }),
|
|
848
|
+
param.description && /* @__PURE__ */ jsx19("p", { className: "text-sm text-muted-foreground", children: param.description })
|
|
849
|
+
] }, param.name)) })
|
|
850
|
+
] });
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// src/components/docs/api/api-response.tsx
|
|
854
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
855
|
+
var statusColors = {
|
|
856
|
+
"2": "text-green-600 dark:text-green-400",
|
|
857
|
+
"3": "text-blue-600 dark:text-blue-400",
|
|
858
|
+
"4": "text-orange-600 dark:text-orange-400",
|
|
859
|
+
"5": "text-red-600 dark:text-red-400"
|
|
860
|
+
};
|
|
861
|
+
function ApiResponse({ status, description, example, schema }) {
|
|
862
|
+
const statusClass = statusColors[String(status)[0]] || "text-muted-foreground";
|
|
863
|
+
return /* @__PURE__ */ jsxs16("div", { className: "mb-4", children: [
|
|
864
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
865
|
+
/* @__PURE__ */ jsx20("span", { className: `text-sm font-semibold ${statusClass}`, children: status }),
|
|
866
|
+
description && /* @__PURE__ */ jsx20("span", { className: "text-sm text-muted-foreground", children: description })
|
|
867
|
+
] }),
|
|
868
|
+
example && /* @__PURE__ */ jsxs16("div", { className: "mb-3", children: [
|
|
869
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: "Example Response" }),
|
|
870
|
+
/* @__PURE__ */ jsx20(
|
|
871
|
+
CodeBlock,
|
|
872
|
+
{
|
|
873
|
+
code: typeof example === "string" ? example : JSON.stringify(example, null, 2),
|
|
874
|
+
language: "json"
|
|
875
|
+
}
|
|
876
|
+
)
|
|
877
|
+
] }),
|
|
878
|
+
schema && /* @__PURE__ */ jsxs16("div", { children: [
|
|
879
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: "Schema" }),
|
|
880
|
+
/* @__PURE__ */ jsx20(
|
|
881
|
+
CodeBlock,
|
|
882
|
+
{
|
|
883
|
+
code: typeof schema === "string" ? schema : JSON.stringify(schema, null, 2),
|
|
884
|
+
language: "json"
|
|
885
|
+
}
|
|
886
|
+
)
|
|
887
|
+
] })
|
|
888
|
+
] });
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// src/components/docs/api/api-playground.tsx
|
|
892
|
+
import { useState as useState8, useMemo } from "react";
|
|
893
|
+
|
|
894
|
+
// src/components/ui/button.tsx
|
|
895
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
896
|
+
import { cva } from "class-variance-authority";
|
|
897
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
898
|
+
var buttonVariants = cva(
|
|
899
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
900
|
+
{
|
|
901
|
+
variants: {
|
|
902
|
+
variant: {
|
|
903
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
904
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
905
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
906
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
907
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
908
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
909
|
+
},
|
|
910
|
+
size: {
|
|
911
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
912
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
913
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
914
|
+
icon: "size-9",
|
|
915
|
+
"icon-sm": "size-8",
|
|
916
|
+
"icon-lg": "size-10"
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
defaultVariants: {
|
|
920
|
+
variant: "default",
|
|
921
|
+
size: "default"
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
function Button({
|
|
926
|
+
className,
|
|
927
|
+
variant,
|
|
928
|
+
size,
|
|
929
|
+
asChild = false,
|
|
930
|
+
...props
|
|
931
|
+
}) {
|
|
932
|
+
const Comp = asChild ? Slot : "button";
|
|
933
|
+
return /* @__PURE__ */ jsx21(
|
|
934
|
+
Comp,
|
|
935
|
+
{
|
|
936
|
+
"data-slot": "button",
|
|
937
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
938
|
+
...props
|
|
939
|
+
}
|
|
940
|
+
);
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// src/components/ui/input.tsx
|
|
944
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
945
|
+
function Input({ className, type, ...props }) {
|
|
946
|
+
return /* @__PURE__ */ jsx22(
|
|
947
|
+
"input",
|
|
948
|
+
{
|
|
949
|
+
type,
|
|
950
|
+
"data-slot": "input",
|
|
951
|
+
className: cn(
|
|
952
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
953
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
954
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
955
|
+
className
|
|
956
|
+
),
|
|
957
|
+
...props
|
|
958
|
+
}
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
// src/components/ui/textarea.tsx
|
|
963
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
964
|
+
function Textarea({ className, ...props }) {
|
|
965
|
+
return /* @__PURE__ */ jsx23(
|
|
966
|
+
"textarea",
|
|
967
|
+
{
|
|
968
|
+
"data-slot": "textarea",
|
|
969
|
+
className: cn(
|
|
970
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
971
|
+
className
|
|
972
|
+
),
|
|
973
|
+
...props
|
|
974
|
+
}
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// src/components/ui/badge.tsx
|
|
979
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
980
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
981
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
982
|
+
var badgeVariants = cva2(
|
|
983
|
+
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
984
|
+
{
|
|
985
|
+
variants: {
|
|
986
|
+
variant: {
|
|
987
|
+
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
988
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
989
|
+
destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
990
|
+
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
defaultVariants: {
|
|
994
|
+
variant: "default"
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
);
|
|
998
|
+
function Badge2({
|
|
999
|
+
className,
|
|
1000
|
+
variant,
|
|
1001
|
+
asChild = false,
|
|
1002
|
+
...props
|
|
1003
|
+
}) {
|
|
1004
|
+
const Comp = asChild ? Slot2 : "span";
|
|
1005
|
+
return /* @__PURE__ */ jsx24(
|
|
1006
|
+
Comp,
|
|
1007
|
+
{
|
|
1008
|
+
"data-slot": "badge",
|
|
1009
|
+
className: cn(badgeVariants({ variant }), className),
|
|
1010
|
+
...props
|
|
1011
|
+
}
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// src/components/docs/api/api-playground.tsx
|
|
1016
|
+
import { Play, Loader2 } from "lucide-react";
|
|
1017
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1018
|
+
function ApiPlayground({
|
|
1019
|
+
method,
|
|
1020
|
+
path,
|
|
1021
|
+
baseUrl = "",
|
|
1022
|
+
headers = {},
|
|
1023
|
+
defaultBody,
|
|
1024
|
+
pathParams = []
|
|
1025
|
+
}) {
|
|
1026
|
+
const [loading, setLoading] = useState8(false);
|
|
1027
|
+
const [response, setResponse] = useState8(null);
|
|
1028
|
+
const [error, setError] = useState8(null);
|
|
1029
|
+
const [requestBody, setRequestBody] = useState8(defaultBody || "");
|
|
1030
|
+
const initialHeaders = useMemo(() => {
|
|
1031
|
+
const cleanHeaders = {};
|
|
1032
|
+
Object.entries(headers).forEach(([key, value]) => {
|
|
1033
|
+
cleanHeaders[key] = value || "";
|
|
1034
|
+
});
|
|
1035
|
+
return cleanHeaders;
|
|
1036
|
+
}, [headers]);
|
|
1037
|
+
const [requestHeaders, setRequestHeaders] = useState8(JSON.stringify(initialHeaders, null, 2));
|
|
1038
|
+
const extractedParams = useMemo(() => {
|
|
1039
|
+
const params = {};
|
|
1040
|
+
const pathParamPattern = /:(\w+)/g;
|
|
1041
|
+
let match;
|
|
1042
|
+
while ((match = pathParamPattern.exec(path)) !== null) {
|
|
1043
|
+
const paramName = match[1];
|
|
1044
|
+
const paramConfig = pathParams.find((p) => p.name === paramName);
|
|
1045
|
+
if (paramConfig?.example !== void 0) {
|
|
1046
|
+
params[paramName] = String(paramConfig.example);
|
|
1047
|
+
} else if (paramConfig?.type === "number") {
|
|
1048
|
+
params[paramName] = "1";
|
|
1049
|
+
} else {
|
|
1050
|
+
params[paramName] = "";
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
return params;
|
|
1054
|
+
}, [path, pathParams]);
|
|
1055
|
+
const [pathParamValues, setPathParamValues] = useState8(extractedParams);
|
|
1056
|
+
const buildUrl = () => {
|
|
1057
|
+
let finalPath = path;
|
|
1058
|
+
Object.entries(pathParamValues).forEach(([key, value]) => {
|
|
1059
|
+
finalPath = finalPath.replace(`:${key}`, value);
|
|
1060
|
+
});
|
|
1061
|
+
return `${baseUrl}${finalPath}`;
|
|
1062
|
+
};
|
|
1063
|
+
const handleSend = async () => {
|
|
1064
|
+
setLoading(true);
|
|
1065
|
+
setError(null);
|
|
1066
|
+
setResponse(null);
|
|
1067
|
+
try {
|
|
1068
|
+
const url = buildUrl();
|
|
1069
|
+
const parsedHeaders = JSON.parse(requestHeaders);
|
|
1070
|
+
const options = {
|
|
1071
|
+
method,
|
|
1072
|
+
headers: {
|
|
1073
|
+
"Content-Type": "application/json",
|
|
1074
|
+
...parsedHeaders
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
if (method !== "GET" && method !== "DELETE" && requestBody) {
|
|
1078
|
+
options.body = requestBody;
|
|
1079
|
+
}
|
|
1080
|
+
const res = await fetch(url, options);
|
|
1081
|
+
const data = await res.json();
|
|
1082
|
+
setResponse({
|
|
1083
|
+
status: res.status,
|
|
1084
|
+
statusText: res.statusText,
|
|
1085
|
+
headers: Object.fromEntries(res.headers.entries()),
|
|
1086
|
+
body: data
|
|
1087
|
+
});
|
|
1088
|
+
} catch (err) {
|
|
1089
|
+
setError(err instanceof Error ? err.message : "An error occurred");
|
|
1090
|
+
} finally {
|
|
1091
|
+
setLoading(false);
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
return /* @__PURE__ */ jsxs17("div", { className: "not-prose border border-border rounded-lg overflow-hidden bg-card/30", children: [
|
|
1095
|
+
/* @__PURE__ */ jsx25("div", { className: "bg-muted/50 px-4 py-2 border-b border-border", children: /* @__PURE__ */ jsx25("h4", { className: "text-sm font-semibold text-foreground", children: "API Playground" }) }),
|
|
1096
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-4 space-y-4", children: [
|
|
1097
|
+
Object.keys(pathParamValues).length > 0 && /* @__PURE__ */ jsxs17("div", { children: [
|
|
1098
|
+
/* @__PURE__ */ jsx25("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Path Parameters" }),
|
|
1099
|
+
/* @__PURE__ */ jsx25("div", { className: "space-y-2", children: Object.entries(pathParamValues).map(([paramName, paramValue]) => {
|
|
1100
|
+
const paramConfig = pathParams.find((p) => p.name === paramName);
|
|
1101
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
1102
|
+
/* @__PURE__ */ jsxs17("span", { className: "text-xs text-muted-foreground min-w-[80px]", children: [
|
|
1103
|
+
":",
|
|
1104
|
+
paramName
|
|
1105
|
+
] }),
|
|
1106
|
+
/* @__PURE__ */ jsx25(
|
|
1107
|
+
Input,
|
|
1108
|
+
{
|
|
1109
|
+
value: paramValue,
|
|
1110
|
+
onChange: (e) => setPathParamValues((prev) => ({ ...prev, [paramName]: e.target.value })),
|
|
1111
|
+
placeholder: paramConfig?.example || paramConfig?.type || "value",
|
|
1112
|
+
className: "font-mono text-sm"
|
|
1113
|
+
}
|
|
1114
|
+
)
|
|
1115
|
+
] }, paramName);
|
|
1116
|
+
}) })
|
|
1117
|
+
] }),
|
|
1118
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
1119
|
+
/* @__PURE__ */ jsx25("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Request URL" }),
|
|
1120
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
1121
|
+
/* @__PURE__ */ jsx25(Badge2, { variant: "outline", className: "font-mono", children: method }),
|
|
1122
|
+
/* @__PURE__ */ jsx25(Input, { value: buildUrl(), readOnly: true, className: "font-mono text-sm" })
|
|
1123
|
+
] })
|
|
1124
|
+
] }),
|
|
1125
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
1126
|
+
/* @__PURE__ */ jsx25("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Headers (JSON)" }),
|
|
1127
|
+
/* @__PURE__ */ jsx25(
|
|
1128
|
+
Textarea,
|
|
1129
|
+
{
|
|
1130
|
+
value: requestHeaders,
|
|
1131
|
+
onChange: (e) => setRequestHeaders(e.target.value),
|
|
1132
|
+
className: "font-mono text-sm",
|
|
1133
|
+
rows: 4
|
|
1134
|
+
}
|
|
1135
|
+
)
|
|
1136
|
+
] }),
|
|
1137
|
+
method !== "GET" && method !== "DELETE" && /* @__PURE__ */ jsxs17("div", { children: [
|
|
1138
|
+
/* @__PURE__ */ jsx25("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Request Body (JSON)" }),
|
|
1139
|
+
/* @__PURE__ */ jsx25(
|
|
1140
|
+
Textarea,
|
|
1141
|
+
{
|
|
1142
|
+
value: requestBody,
|
|
1143
|
+
onChange: (e) => setRequestBody(e.target.value),
|
|
1144
|
+
className: "font-mono text-sm",
|
|
1145
|
+
rows: 6,
|
|
1146
|
+
placeholder: '{\\n "key": "value"\\n}'
|
|
1147
|
+
}
|
|
1148
|
+
)
|
|
1149
|
+
] }),
|
|
1150
|
+
/* @__PURE__ */ jsx25(Button, { onClick: handleSend, disabled: loading, className: "w-full", children: loading ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
1151
|
+
/* @__PURE__ */ jsx25(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1152
|
+
"Sending..."
|
|
1153
|
+
] }) : /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
1154
|
+
/* @__PURE__ */ jsx25(Play, { className: "mr-2 h-4 w-4" }),
|
|
1155
|
+
"Send Request"
|
|
1156
|
+
] }) }),
|
|
1157
|
+
response && /* @__PURE__ */ jsxs17("div", { className: "mt-4", children: [
|
|
1158
|
+
/* @__PURE__ */ jsxs17("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: [
|
|
1159
|
+
"Response (",
|
|
1160
|
+
response.status,
|
|
1161
|
+
" ",
|
|
1162
|
+
response.statusText,
|
|
1163
|
+
")"
|
|
1164
|
+
] }),
|
|
1165
|
+
/* @__PURE__ */ jsx25(CodeBlock, { code: JSON.stringify(response.body, null, 2), language: "json" })
|
|
1166
|
+
] }),
|
|
1167
|
+
error && /* @__PURE__ */ jsx25("div", { className: "mt-4 p-3 bg-red-500/10 border border-red-500/20 rounded-md", children: /* @__PURE__ */ jsx25("p", { className: "text-sm text-red-600 dark:text-red-400", children: error }) })
|
|
1168
|
+
] })
|
|
1169
|
+
] });
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// src/components/docs/api/api-reference.tsx
|
|
1173
|
+
import { useState as useState9, useEffect as useEffect3 } from "react";
|
|
1174
|
+
|
|
1175
|
+
// src/lib/parsers/specra-parser.ts
|
|
1176
|
+
var SpecraParser = class {
|
|
1177
|
+
validate(input) {
|
|
1178
|
+
return typeof input === "object" && input !== null && "endpoints" in input && Array.isArray(input.endpoints);
|
|
1179
|
+
}
|
|
1180
|
+
parse(input) {
|
|
1181
|
+
if (!this.validate(input)) {
|
|
1182
|
+
throw new Error("Invalid Specra API spec format");
|
|
1183
|
+
}
|
|
1184
|
+
return input;
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
// src/lib/parsers/openapi-parser.ts
|
|
1189
|
+
var OpenApiParser = class {
|
|
1190
|
+
validate(input) {
|
|
1191
|
+
return typeof input === "object" && input !== null && ("openapi" in input || "swagger" in input) && "paths" in input;
|
|
1192
|
+
}
|
|
1193
|
+
parse(input) {
|
|
1194
|
+
if (!this.validate(input)) {
|
|
1195
|
+
throw new Error("Invalid OpenAPI spec format");
|
|
1196
|
+
}
|
|
1197
|
+
const baseUrl = this.extractBaseUrl(input);
|
|
1198
|
+
const endpoints = [];
|
|
1199
|
+
for (const [path, pathItem] of Object.entries(input.paths || {})) {
|
|
1200
|
+
const methods = ["get", "post", "put", "patch", "delete"];
|
|
1201
|
+
for (const method of methods) {
|
|
1202
|
+
const operation = pathItem[method];
|
|
1203
|
+
if (!operation) continue;
|
|
1204
|
+
const endpoint = this.parseOperation(path, method.toUpperCase(), operation, input);
|
|
1205
|
+
endpoints.push(endpoint);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
return {
|
|
1209
|
+
version: input.info?.version,
|
|
1210
|
+
title: input.info?.title,
|
|
1211
|
+
description: input.info?.description,
|
|
1212
|
+
baseUrl,
|
|
1213
|
+
auth: this.extractAuth(input),
|
|
1214
|
+
endpoints
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
extractBaseUrl(spec) {
|
|
1218
|
+
if (spec.servers && spec.servers.length > 0) {
|
|
1219
|
+
return spec.servers[0].url;
|
|
1220
|
+
}
|
|
1221
|
+
if (spec.host) {
|
|
1222
|
+
const scheme = spec.schemes?.[0] || "https";
|
|
1223
|
+
const basePath = spec.basePath || "";
|
|
1224
|
+
return `${scheme}://${spec.host}${basePath}`;
|
|
1225
|
+
}
|
|
1226
|
+
return "";
|
|
1227
|
+
}
|
|
1228
|
+
extractAuth(spec) {
|
|
1229
|
+
const securitySchemes = spec.components?.securitySchemes || spec.securityDefinitions;
|
|
1230
|
+
if (!securitySchemes) return void 0;
|
|
1231
|
+
const firstScheme = Object.values(securitySchemes)[0];
|
|
1232
|
+
if (!firstScheme) return void 0;
|
|
1233
|
+
if (firstScheme.type === "http" && firstScheme.scheme === "bearer") {
|
|
1234
|
+
return {
|
|
1235
|
+
type: "bearer",
|
|
1236
|
+
description: firstScheme.description,
|
|
1237
|
+
tokenPrefix: "Bearer"
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
if (firstScheme.type === "apiKey") {
|
|
1241
|
+
return {
|
|
1242
|
+
type: "apiKey",
|
|
1243
|
+
description: firstScheme.description,
|
|
1244
|
+
headerName: firstScheme.name || "X-API-Key"
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
if (firstScheme.type === "http" && firstScheme.scheme === "basic") {
|
|
1248
|
+
return {
|
|
1249
|
+
type: "basic",
|
|
1250
|
+
description: firstScheme.description
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
return void 0;
|
|
1254
|
+
}
|
|
1255
|
+
parseOperation(path, method, operation, spec) {
|
|
1256
|
+
const endpoint = {
|
|
1257
|
+
title: operation.summary || operation.operationId || `${method} ${path}`,
|
|
1258
|
+
method,
|
|
1259
|
+
path: this.convertPathParams(path),
|
|
1260
|
+
description: operation.description
|
|
1261
|
+
};
|
|
1262
|
+
const params = this.parseParameters(operation.parameters || [], spec);
|
|
1263
|
+
if (params.path.length > 0) endpoint.pathParams = params.path;
|
|
1264
|
+
if (params.query.length > 0) endpoint.queryParams = params.query;
|
|
1265
|
+
if (params.header.length > 0) {
|
|
1266
|
+
endpoint.headers = params.header.map((p) => ({
|
|
1267
|
+
name: p.name,
|
|
1268
|
+
value: p.example || "",
|
|
1269
|
+
description: p.description
|
|
1270
|
+
}));
|
|
1271
|
+
}
|
|
1272
|
+
if (operation.requestBody) {
|
|
1273
|
+
endpoint.body = this.parseRequestBody(operation.requestBody, spec);
|
|
1274
|
+
}
|
|
1275
|
+
const responses = this.parseResponses(operation.responses || {}, spec);
|
|
1276
|
+
if (responses.success) endpoint.successResponse = responses.success;
|
|
1277
|
+
if (responses.errors.length > 0) endpoint.errorResponses = responses.errors;
|
|
1278
|
+
return endpoint;
|
|
1279
|
+
}
|
|
1280
|
+
convertPathParams(path) {
|
|
1281
|
+
return path.replace(/\{([^}]+)\}/g, ":$1");
|
|
1282
|
+
}
|
|
1283
|
+
parseParameters(parameters, spec) {
|
|
1284
|
+
const result = { path: [], query: [], header: [] };
|
|
1285
|
+
for (const param of parameters) {
|
|
1286
|
+
const resolved = param.$ref ? this.resolveRef(param.$ref, spec) : param;
|
|
1287
|
+
const apiParam = {
|
|
1288
|
+
name: resolved.name,
|
|
1289
|
+
type: resolved.schema?.type || resolved.type || "string",
|
|
1290
|
+
required: resolved.required,
|
|
1291
|
+
description: resolved.description,
|
|
1292
|
+
example: resolved.example || resolved.schema?.example
|
|
1293
|
+
};
|
|
1294
|
+
if (resolved.in === "path") result.path.push(apiParam);
|
|
1295
|
+
else if (resolved.in === "query") result.query.push(apiParam);
|
|
1296
|
+
else if (resolved.in === "header") result.header.push(apiParam);
|
|
1297
|
+
}
|
|
1298
|
+
return result;
|
|
1299
|
+
}
|
|
1300
|
+
parseRequestBody(requestBody, spec) {
|
|
1301
|
+
const content = requestBody.content?.["application/json"];
|
|
1302
|
+
if (!content) return void 0;
|
|
1303
|
+
return {
|
|
1304
|
+
description: requestBody.description,
|
|
1305
|
+
example: content.example || this.generateExample(content.schema, spec),
|
|
1306
|
+
schema: content.schema
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
parseResponses(responses, spec) {
|
|
1310
|
+
const result = { errors: [] };
|
|
1311
|
+
for (const [statusCode, response] of Object.entries(responses)) {
|
|
1312
|
+
const status = parseInt(statusCode);
|
|
1313
|
+
if (isNaN(status)) continue;
|
|
1314
|
+
const resolved = response.$ref ? this.resolveRef(response.$ref, spec) : response;
|
|
1315
|
+
const content = resolved.content?.["application/json"];
|
|
1316
|
+
const apiResponse = {
|
|
1317
|
+
status,
|
|
1318
|
+
description: resolved.description,
|
|
1319
|
+
example: content?.example || this.generateExample(content?.schema, spec),
|
|
1320
|
+
schema: content?.schema
|
|
1321
|
+
};
|
|
1322
|
+
if (status >= 200 && status < 300) {
|
|
1323
|
+
result.success = apiResponse;
|
|
1324
|
+
} else {
|
|
1325
|
+
result.errors.push(apiResponse);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
return result;
|
|
1329
|
+
}
|
|
1330
|
+
generateExample(schema, spec) {
|
|
1331
|
+
if (!schema) return void 0;
|
|
1332
|
+
if (schema.$ref) schema = this.resolveRef(schema.$ref, spec);
|
|
1333
|
+
if (schema.example) return schema.example;
|
|
1334
|
+
if (schema.type === "object" && schema.properties) {
|
|
1335
|
+
const example = {};
|
|
1336
|
+
for (const [key, prop] of Object.entries(schema.properties)) {
|
|
1337
|
+
example[key] = this.generateExample(prop, spec);
|
|
1338
|
+
}
|
|
1339
|
+
return example;
|
|
1340
|
+
}
|
|
1341
|
+
if (schema.type === "array" && schema.items) {
|
|
1342
|
+
return [this.generateExample(schema.items, spec)];
|
|
1343
|
+
}
|
|
1344
|
+
const defaults = {
|
|
1345
|
+
string: "string",
|
|
1346
|
+
number: 0,
|
|
1347
|
+
integer: 0,
|
|
1348
|
+
boolean: false,
|
|
1349
|
+
object: {},
|
|
1350
|
+
array: []
|
|
1351
|
+
};
|
|
1352
|
+
return defaults[schema.type] || null;
|
|
1353
|
+
}
|
|
1354
|
+
resolveRef(ref, spec) {
|
|
1355
|
+
const path = ref.replace(/^#\//, "").split("/");
|
|
1356
|
+
let current = spec;
|
|
1357
|
+
for (const segment of path) {
|
|
1358
|
+
current = current[segment];
|
|
1359
|
+
if (!current) return {};
|
|
1360
|
+
}
|
|
1361
|
+
return current;
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
// src/lib/parsers/postman-parser.ts
|
|
1366
|
+
var PostmanParser = class {
|
|
1367
|
+
validate(input) {
|
|
1368
|
+
return typeof input === "object" && input !== null && "info" in input && input.info?.schema?.includes("v2");
|
|
1369
|
+
}
|
|
1370
|
+
parse(input) {
|
|
1371
|
+
if (!this.validate(input)) {
|
|
1372
|
+
throw new Error("Invalid Postman Collection format (requires v2.0 or v2.1)");
|
|
1373
|
+
}
|
|
1374
|
+
const baseUrl = this.extractBaseUrl(input);
|
|
1375
|
+
const endpoints = [];
|
|
1376
|
+
this.parseItems(input.item || [], endpoints, baseUrl, input);
|
|
1377
|
+
return {
|
|
1378
|
+
version: input.info?.version,
|
|
1379
|
+
title: input.info?.name,
|
|
1380
|
+
description: input.info?.description,
|
|
1381
|
+
baseUrl,
|
|
1382
|
+
auth: this.extractAuth(input.auth),
|
|
1383
|
+
globalHeaders: this.extractGlobalHeaders(input),
|
|
1384
|
+
endpoints
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
extractBaseUrl(collection) {
|
|
1388
|
+
const baseUrlVar = collection.variable?.find(
|
|
1389
|
+
(v) => v.key === "baseUrl" || v.key === "base_url" || v.key === "url"
|
|
1390
|
+
);
|
|
1391
|
+
if (baseUrlVar) return baseUrlVar.value;
|
|
1392
|
+
if (collection.item && collection.item.length > 0) {
|
|
1393
|
+
const firstRequest = this.findFirstRequest(collection.item);
|
|
1394
|
+
if (firstRequest?.request?.url) {
|
|
1395
|
+
const url = this.parseUrl(firstRequest.request.url);
|
|
1396
|
+
if (url.host) {
|
|
1397
|
+
return `${url.protocol}://${url.host.join(".")}`;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
return "";
|
|
1402
|
+
}
|
|
1403
|
+
findFirstRequest(items) {
|
|
1404
|
+
for (const item of items) {
|
|
1405
|
+
if (item.request) return item;
|
|
1406
|
+
if (item.item) {
|
|
1407
|
+
const found = this.findFirstRequest(item.item);
|
|
1408
|
+
if (found) return found;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
return null;
|
|
1412
|
+
}
|
|
1413
|
+
extractAuth(auth) {
|
|
1414
|
+
if (!auth) return void 0;
|
|
1415
|
+
if (auth.type === "bearer") {
|
|
1416
|
+
return {
|
|
1417
|
+
type: "bearer",
|
|
1418
|
+
tokenPrefix: "Bearer"
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
if (auth.type === "apikey") {
|
|
1422
|
+
const keyData = auth.apikey?.find((a) => a.key === "key");
|
|
1423
|
+
const keyName = keyData?.value || "X-API-Key";
|
|
1424
|
+
return {
|
|
1425
|
+
type: "apiKey",
|
|
1426
|
+
headerName: keyName
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
if (auth.type === "basic") {
|
|
1430
|
+
return {
|
|
1431
|
+
type: "basic"
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
return void 0;
|
|
1435
|
+
}
|
|
1436
|
+
extractGlobalHeaders(collection) {
|
|
1437
|
+
return [];
|
|
1438
|
+
}
|
|
1439
|
+
parseItems(items, endpoints, baseUrl, collection) {
|
|
1440
|
+
for (const item of items) {
|
|
1441
|
+
if (item.item && Array.isArray(item.item)) {
|
|
1442
|
+
this.parseItems(item.item, endpoints, baseUrl, collection);
|
|
1443
|
+
} else if (item.request) {
|
|
1444
|
+
const endpoint = this.parseRequest(item, baseUrl, collection);
|
|
1445
|
+
endpoints.push(endpoint);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
parseRequest(item, baseUrl, collection) {
|
|
1450
|
+
const request = item.request;
|
|
1451
|
+
const url = this.parseUrl(request.url);
|
|
1452
|
+
const endpoint = {
|
|
1453
|
+
title: item.name,
|
|
1454
|
+
method: request.method.toUpperCase(),
|
|
1455
|
+
path: this.buildPath(url, baseUrl),
|
|
1456
|
+
description: item.request.description || item.description
|
|
1457
|
+
};
|
|
1458
|
+
const params = this.parseUrlParams(url);
|
|
1459
|
+
if (params.path.length > 0) endpoint.pathParams = params.path;
|
|
1460
|
+
if (params.query.length > 0) endpoint.queryParams = params.query;
|
|
1461
|
+
if (request.header && request.header.length > 0) {
|
|
1462
|
+
endpoint.headers = request.header.filter((h) => !h.disabled).map((h) => ({
|
|
1463
|
+
name: h.key,
|
|
1464
|
+
value: h.value || "",
|
|
1465
|
+
description: h.description
|
|
1466
|
+
}));
|
|
1467
|
+
}
|
|
1468
|
+
if (request.body) {
|
|
1469
|
+
endpoint.body = this.parseBody(request.body);
|
|
1470
|
+
}
|
|
1471
|
+
const responses = this.parseResponses(item.response || []);
|
|
1472
|
+
if (responses.success) endpoint.successResponse = responses.success;
|
|
1473
|
+
if (responses.errors.length > 0) endpoint.errorResponses = responses.errors;
|
|
1474
|
+
return endpoint;
|
|
1475
|
+
}
|
|
1476
|
+
parseUrl(url) {
|
|
1477
|
+
if (typeof url === "string") {
|
|
1478
|
+
const urlObj = new URL(url);
|
|
1479
|
+
return {
|
|
1480
|
+
protocol: urlObj.protocol.replace(":", ""),
|
|
1481
|
+
host: urlObj.hostname.split("."),
|
|
1482
|
+
path: urlObj.pathname.split("/").filter(Boolean),
|
|
1483
|
+
query: [],
|
|
1484
|
+
variable: []
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
return {
|
|
1488
|
+
protocol: url.protocol || "https",
|
|
1489
|
+
host: url.host || [],
|
|
1490
|
+
path: url.path || [],
|
|
1491
|
+
query: url.query || [],
|
|
1492
|
+
variable: url.variable || []
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
buildPath(url, baseUrl) {
|
|
1496
|
+
let path = "/";
|
|
1497
|
+
if (url.path && url.path.length > 0) {
|
|
1498
|
+
path += url.path.join("/");
|
|
1499
|
+
}
|
|
1500
|
+
path = path.replace(/\{\{([^}]+)\}\}/g, ":$1");
|
|
1501
|
+
return path;
|
|
1502
|
+
}
|
|
1503
|
+
parseUrlParams(url) {
|
|
1504
|
+
const result = { path: [], query: [] };
|
|
1505
|
+
if (url.variable && url.variable.length > 0) {
|
|
1506
|
+
for (const v of url.variable) {
|
|
1507
|
+
result.path.push({
|
|
1508
|
+
name: v.key,
|
|
1509
|
+
type: v.type || "string",
|
|
1510
|
+
description: v.description,
|
|
1511
|
+
example: v.value
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
if (url.path && url.path.length > 0) {
|
|
1516
|
+
for (const segment of url.path) {
|
|
1517
|
+
if (segment.startsWith(":")) {
|
|
1518
|
+
const paramName = segment.slice(1);
|
|
1519
|
+
if (!result.path.find((p) => p.name === paramName)) {
|
|
1520
|
+
result.path.push({
|
|
1521
|
+
name: paramName,
|
|
1522
|
+
type: "string"
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
if (url.query && url.query.length > 0) {
|
|
1529
|
+
for (const q of url.query) {
|
|
1530
|
+
if (q.disabled) continue;
|
|
1531
|
+
result.query.push({
|
|
1532
|
+
name: q.key,
|
|
1533
|
+
type: "string",
|
|
1534
|
+
description: q.description,
|
|
1535
|
+
example: q.value
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
return result;
|
|
1540
|
+
}
|
|
1541
|
+
parseBody(body) {
|
|
1542
|
+
if (!body) return void 0;
|
|
1543
|
+
let example;
|
|
1544
|
+
let description = body.description;
|
|
1545
|
+
if (body.mode === "raw") {
|
|
1546
|
+
try {
|
|
1547
|
+
example = JSON.parse(body.raw);
|
|
1548
|
+
} catch {
|
|
1549
|
+
example = body.raw;
|
|
1550
|
+
}
|
|
1551
|
+
} else if (body.mode === "formdata" || body.mode === "urlencoded") {
|
|
1552
|
+
example = {};
|
|
1553
|
+
for (const item of body[body.mode] || []) {
|
|
1554
|
+
if (!item.disabled) {
|
|
1555
|
+
example[item.key] = item.value;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return {
|
|
1560
|
+
description,
|
|
1561
|
+
example
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
parseResponses(responses) {
|
|
1565
|
+
const result = { errors: [] };
|
|
1566
|
+
for (const response of responses) {
|
|
1567
|
+
let example;
|
|
1568
|
+
try {
|
|
1569
|
+
example = JSON.parse(response.body);
|
|
1570
|
+
} catch {
|
|
1571
|
+
example = response.body;
|
|
1572
|
+
}
|
|
1573
|
+
const apiResponse = {
|
|
1574
|
+
status: response.code || 200,
|
|
1575
|
+
description: response.name,
|
|
1576
|
+
example
|
|
1577
|
+
};
|
|
1578
|
+
if (apiResponse.status >= 200 && apiResponse.status < 300) {
|
|
1579
|
+
if (!result.success) result.success = apiResponse;
|
|
1580
|
+
} else {
|
|
1581
|
+
result.errors.push(apiResponse);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
return result;
|
|
1585
|
+
}
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
// src/lib/parsers/index.ts
|
|
1589
|
+
var parsers = /* @__PURE__ */ new Map([
|
|
1590
|
+
["specra", new SpecraParser()],
|
|
1591
|
+
["openapi", new OpenApiParser()],
|
|
1592
|
+
["postman", new PostmanParser()]
|
|
1593
|
+
]);
|
|
1594
|
+
function detectParserType(input) {
|
|
1595
|
+
if (!input || typeof input !== "object") {
|
|
1596
|
+
throw new Error("Invalid API spec: input must be an object");
|
|
1597
|
+
}
|
|
1598
|
+
if (input.info?.schema?.includes("v2")) {
|
|
1599
|
+
return "postman";
|
|
1600
|
+
}
|
|
1601
|
+
if (input.openapi || input.swagger) {
|
|
1602
|
+
return "openapi";
|
|
1603
|
+
}
|
|
1604
|
+
if (input.endpoints && Array.isArray(input.endpoints)) {
|
|
1605
|
+
return "specra";
|
|
1606
|
+
}
|
|
1607
|
+
throw new Error(
|
|
1608
|
+
"Unable to auto-detect API spec format. Supported formats: Specra, OpenAPI 3.x, Postman Collection v2.x"
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
function parseApiSpec(input, parserType = "auto") {
|
|
1612
|
+
const actualType = parserType === "auto" ? detectParserType(input) : parserType;
|
|
1613
|
+
const parser = parsers.get(actualType);
|
|
1614
|
+
if (!parser) {
|
|
1615
|
+
throw new Error(`Unknown parser type: ${actualType}`);
|
|
1616
|
+
}
|
|
1617
|
+
if (!parser.validate(input)) {
|
|
1618
|
+
throw new Error(`Input does not match ${actualType} format`);
|
|
1619
|
+
}
|
|
1620
|
+
return parser.parse(input);
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
// src/components/docs/api/api-reference.tsx
|
|
1624
|
+
import { Loader2 as Loader22 } from "lucide-react";
|
|
1625
|
+
import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1626
|
+
function ApiReference({ spec, parser = "auto", showPlayground = true }) {
|
|
1627
|
+
const [apiSpec, setApiSpec] = useState9(null);
|
|
1628
|
+
const [loading, setLoading] = useState9(true);
|
|
1629
|
+
const [error, setError] = useState9(null);
|
|
1630
|
+
useEffect3(() => {
|
|
1631
|
+
async function loadSpec() {
|
|
1632
|
+
try {
|
|
1633
|
+
const response = await fetch(spec);
|
|
1634
|
+
if (!response.ok) {
|
|
1635
|
+
throw new Error(`Failed to load API spec: ${response.statusText}`);
|
|
1636
|
+
}
|
|
1637
|
+
const data = await response.json();
|
|
1638
|
+
const parsedSpec = parseApiSpec(data, parser);
|
|
1639
|
+
setApiSpec(parsedSpec);
|
|
1640
|
+
} catch (err) {
|
|
1641
|
+
setError(err instanceof Error ? err.message : "Failed to load API spec");
|
|
1642
|
+
} finally {
|
|
1643
|
+
setLoading(false);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
loadSpec();
|
|
1647
|
+
}, [spec, parser]);
|
|
1648
|
+
const interpolateEnv = (text, env) => {
|
|
1649
|
+
if (!env) return text;
|
|
1650
|
+
return text.replace(/\{(\w+)\}/g, (match, key) => {
|
|
1651
|
+
return env[key] || match;
|
|
1652
|
+
});
|
|
1653
|
+
};
|
|
1654
|
+
if (loading) {
|
|
1655
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-center py-12", children: [
|
|
1656
|
+
/* @__PURE__ */ jsx26(Loader22, { className: "h-6 w-6 animate-spin text-muted-foreground" }),
|
|
1657
|
+
/* @__PURE__ */ jsx26("span", { className: "ml-2 text-muted-foreground", children: "Loading API specification..." })
|
|
1658
|
+
] });
|
|
1659
|
+
}
|
|
1660
|
+
if (error) {
|
|
1661
|
+
return /* @__PURE__ */ jsx26("div", { className: "rounded-lg border border-red-500/20 bg-red-500/10 p-4", children: /* @__PURE__ */ jsxs18("p", { className: "text-sm text-red-600 dark:text-red-400", children: [
|
|
1662
|
+
"Error: ",
|
|
1663
|
+
error
|
|
1664
|
+
] }) });
|
|
1665
|
+
}
|
|
1666
|
+
if (!apiSpec) {
|
|
1667
|
+
return null;
|
|
1668
|
+
}
|
|
1669
|
+
return /* @__PURE__ */ jsxs18("div", { className: "space-y-6", children: [
|
|
1670
|
+
(apiSpec.title || apiSpec.description) && /* @__PURE__ */ jsxs18("div", { className: "mb-8", children: [
|
|
1671
|
+
apiSpec.title && /* @__PURE__ */ jsx26("h2", { className: "text-2xl font-semibold mb-2 text-foreground", children: apiSpec.title }),
|
|
1672
|
+
apiSpec.description && /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground", children: apiSpec.description }),
|
|
1673
|
+
apiSpec.baseUrl && /* @__PURE__ */ jsxs18("div", { className: "mt-4", children: [
|
|
1674
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm font-semibold text-muted-foreground mb-1", children: "Base URL" }),
|
|
1675
|
+
/* @__PURE__ */ jsx26("code", { className: "text-sm px-2 py-1 bg-muted rounded", children: apiSpec.baseUrl })
|
|
1676
|
+
] })
|
|
1677
|
+
] }),
|
|
1678
|
+
apiSpec.auth && /* @__PURE__ */ jsxs18("div", { className: "rounded-lg border border-border bg-card/30 p-4 mb-6", children: [
|
|
1679
|
+
/* @__PURE__ */ jsx26("h3", { className: "text-lg font-semibold mb-2 text-foreground", children: "Authentication" }),
|
|
1680
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground mb-2", children: apiSpec.auth.description || `This API uses ${apiSpec.auth.type} authentication.` }),
|
|
1681
|
+
apiSpec.auth.type === "bearer" && /* @__PURE__ */ jsx26(
|
|
1682
|
+
CodeBlock,
|
|
1683
|
+
{
|
|
1684
|
+
code: `Authorization: ${apiSpec.auth.tokenPrefix || "Bearer"} {YOUR_TOKEN}`,
|
|
1685
|
+
language: "bash"
|
|
1686
|
+
}
|
|
1687
|
+
),
|
|
1688
|
+
apiSpec.auth.type === "apiKey" && /* @__PURE__ */ jsx26(
|
|
1689
|
+
CodeBlock,
|
|
1690
|
+
{
|
|
1691
|
+
code: `${apiSpec.auth.headerName || "X-API-Key"}: {YOUR_API_KEY}`,
|
|
1692
|
+
language: "bash"
|
|
1693
|
+
}
|
|
1694
|
+
)
|
|
1695
|
+
] }),
|
|
1696
|
+
/* @__PURE__ */ jsx26(Accordion, { type: "single", collapsible: true, className: "space-y-4", children: apiSpec.endpoints.map((endpoint, index) => {
|
|
1697
|
+
const allHeaders = [
|
|
1698
|
+
...apiSpec.globalHeaders || [],
|
|
1699
|
+
...endpoint.headers || []
|
|
1700
|
+
].map((header) => ({
|
|
1701
|
+
...header,
|
|
1702
|
+
value: interpolateEnv(header.value, apiSpec.env)
|
|
1703
|
+
}));
|
|
1704
|
+
return /* @__PURE__ */ jsx26(
|
|
1705
|
+
AccordionItem,
|
|
1706
|
+
{
|
|
1707
|
+
value: `endpoint-${index}`,
|
|
1708
|
+
title: /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-3", children: [
|
|
1709
|
+
/* @__PURE__ */ jsx26(
|
|
1710
|
+
"span",
|
|
1711
|
+
{
|
|
1712
|
+
className: `text-xs font-semibold px-2 py-0.5 rounded ${endpoint.method === "GET" ? "bg-blue-500/10 text-blue-600 dark:text-blue-400" : endpoint.method === "POST" ? "bg-green-500/10 text-green-600 dark:text-green-400" : endpoint.method === "PUT" ? "bg-orange-500/10 text-orange-600 dark:text-orange-400" : endpoint.method === "PATCH" ? "bg-purple-500/10 text-purple-600 dark:text-purple-400" : "bg-red-500/10 text-red-600 dark:text-red-400"}`,
|
|
1713
|
+
children: endpoint.method
|
|
1714
|
+
}
|
|
1715
|
+
),
|
|
1716
|
+
/* @__PURE__ */ jsx26("code", { className: "text-sm font-mono", children: endpoint.path }),
|
|
1717
|
+
/* @__PURE__ */ jsx26("span", { className: "text-sm text-muted-foreground ml-auto", children: endpoint.title })
|
|
1718
|
+
] }),
|
|
1719
|
+
children: /* @__PURE__ */ jsxs18("div", { className: "space-y-6 pt-4", children: [
|
|
1720
|
+
endpoint.description && /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground", children: endpoint.description }),
|
|
1721
|
+
endpoint.pathParams && endpoint.pathParams.length > 0 && /* @__PURE__ */ jsx26(ApiParams, { title: "Path Parameters", params: endpoint.pathParams }),
|
|
1722
|
+
endpoint.queryParams && endpoint.queryParams.length > 0 && /* @__PURE__ */ jsx26(ApiParams, { title: "Query Parameters", params: endpoint.queryParams }),
|
|
1723
|
+
allHeaders.length > 0 && /* @__PURE__ */ jsxs18("div", { children: [
|
|
1724
|
+
/* @__PURE__ */ jsx26("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Headers" }),
|
|
1725
|
+
/* @__PURE__ */ jsx26("div", { className: "space-y-2", children: allHeaders.map((header, idx) => /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
|
|
1726
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
1727
|
+
/* @__PURE__ */ jsx26("code", { className: "text-sm font-mono text-foreground", children: header.name }),
|
|
1728
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: header.value })
|
|
1729
|
+
] }),
|
|
1730
|
+
header.description && /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground", children: header.description })
|
|
1731
|
+
] }, idx)) })
|
|
1732
|
+
] }),
|
|
1733
|
+
endpoint.body && /* @__PURE__ */ jsxs18("div", { children: [
|
|
1734
|
+
/* @__PURE__ */ jsx26("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Request Body" }),
|
|
1735
|
+
endpoint.body.description && /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground mb-2", children: endpoint.body.description }),
|
|
1736
|
+
endpoint.body.example && /* @__PURE__ */ jsx26(
|
|
1737
|
+
CodeBlock,
|
|
1738
|
+
{
|
|
1739
|
+
code: typeof endpoint.body.example === "string" ? endpoint.body.example : JSON.stringify(endpoint.body.example, null, 2),
|
|
1740
|
+
language: "json"
|
|
1741
|
+
}
|
|
1742
|
+
)
|
|
1743
|
+
] }),
|
|
1744
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
1745
|
+
/* @__PURE__ */ jsx26("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Responses" }),
|
|
1746
|
+
endpoint.successResponse && /* @__PURE__ */ jsx26(
|
|
1747
|
+
ApiResponse,
|
|
1748
|
+
{
|
|
1749
|
+
status: endpoint.successResponse.status,
|
|
1750
|
+
description: endpoint.successResponse.description,
|
|
1751
|
+
example: endpoint.successResponse.example,
|
|
1752
|
+
schema: endpoint.successResponse.schema
|
|
1753
|
+
}
|
|
1754
|
+
),
|
|
1755
|
+
endpoint.errorResponses?.map((response, idx) => /* @__PURE__ */ jsx26(
|
|
1756
|
+
ApiResponse,
|
|
1757
|
+
{
|
|
1758
|
+
status: response.status,
|
|
1759
|
+
description: response.description,
|
|
1760
|
+
example: response.example,
|
|
1761
|
+
schema: response.schema
|
|
1762
|
+
},
|
|
1763
|
+
idx
|
|
1764
|
+
))
|
|
1765
|
+
] }),
|
|
1766
|
+
endpoint.examples && endpoint.examples.length > 0 && /* @__PURE__ */ jsxs18("div", { children: [
|
|
1767
|
+
/* @__PURE__ */ jsx26("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Examples" }),
|
|
1768
|
+
endpoint.examples.map((example, idx) => /* @__PURE__ */ jsxs18("div", { className: "mb-3", children: [
|
|
1769
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: example.title }),
|
|
1770
|
+
/* @__PURE__ */ jsx26(CodeBlock, { code: example.code, language: example.language })
|
|
1771
|
+
] }, idx))
|
|
1772
|
+
] }),
|
|
1773
|
+
showPlayground && /* @__PURE__ */ jsx26(
|
|
1774
|
+
ApiPlayground,
|
|
1775
|
+
{
|
|
1776
|
+
method: endpoint.method,
|
|
1777
|
+
path: endpoint.path,
|
|
1778
|
+
baseUrl: apiSpec.baseUrl,
|
|
1779
|
+
headers: Object.fromEntries(allHeaders.map((h) => [h.name, h.value])),
|
|
1780
|
+
pathParams: endpoint.pathParams,
|
|
1781
|
+
defaultBody: endpoint.body?.example ? typeof endpoint.body.example === "string" ? endpoint.body.example : JSON.stringify(endpoint.body.example, null, 2) : void 0
|
|
1782
|
+
}
|
|
1783
|
+
)
|
|
1784
|
+
] })
|
|
1785
|
+
},
|
|
1786
|
+
index
|
|
1787
|
+
);
|
|
1788
|
+
}) })
|
|
1789
|
+
] });
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
// src/components/docs/mdx-components.tsx
|
|
1793
|
+
import { Fragment as Fragment5, jsx as jsx27 } from "react/jsx-runtime";
|
|
1794
|
+
var mdxComponents = {
|
|
1795
|
+
h1: ({ children }) => /* @__PURE__ */ jsx27("h1", { className: "text-3xl font-semibold tracking-tight mb-6 text-foreground", children }),
|
|
1796
|
+
h2: ({ children, id }) => /* @__PURE__ */ jsx27("h2", { id, className: "text-2xl font-semibold tracking-tight mt-10 mb-4 text-foreground scroll-mt-24", children }),
|
|
1797
|
+
h3: ({ children, id }) => /* @__PURE__ */ jsx27("h3", { id, className: "text-xl font-medium tracking-tight mt-8 mb-3 text-foreground scroll-mt-24", children }),
|
|
1798
|
+
p: ({ children }) => /* @__PURE__ */ jsx27("p", { className: "text-base leading-7 text-muted-foreground mb-4", children }),
|
|
1799
|
+
code: ({ children, className, meta, ...props }) => {
|
|
1800
|
+
const isInline = !className;
|
|
1801
|
+
if (isInline) {
|
|
1802
|
+
return /* @__PURE__ */ jsx27("code", { className: "px-1.5 py-0.5 rounded-md bg-muted/50 text-primary font-mono text-[13px] border border-border/50", children });
|
|
1803
|
+
}
|
|
1804
|
+
const language = className?.replace("language-", "") || "text";
|
|
1805
|
+
const filename = meta || void 0;
|
|
1806
|
+
const code = String(children).replace(/\n$/, "");
|
|
1807
|
+
return /* @__PURE__ */ jsx27(CodeBlock, { code, language, filename });
|
|
1808
|
+
},
|
|
1809
|
+
pre: ({ children }) => /* @__PURE__ */ jsx27(Fragment5, { children }),
|
|
1810
|
+
ul: ({ children }) => /* @__PURE__ */ jsx27("ul", { className: "list-disc list-outside pl-5 space-y-2 mb-4 text-muted-foreground [&_p]:mb-0 [&_p]:inline [&_ul]:ml-6 [&_ol]:ml-6", children }),
|
|
1811
|
+
ol: ({ children }) => /* @__PURE__ */ jsx27("ol", { className: "list-decimal list-outside pl-5 space-y-2 mb-4 text-muted-foreground [&_p]:mb-0 [&_p]:inline [&_ul]:ml-6 [&_ol]:ml-6", children }),
|
|
1812
|
+
li: ({ children }) => /* @__PURE__ */ jsx27("li", { className: "leading-7 [&>p]:mb-0 [&>p]:inline", children }),
|
|
1813
|
+
a: ({ children, href }) => /* @__PURE__ */ jsx27(
|
|
1814
|
+
"a",
|
|
1815
|
+
{
|
|
1816
|
+
href,
|
|
1817
|
+
className: "text-primary hover:underline font-medium",
|
|
1818
|
+
target: href?.startsWith("http") ? "_blank" : void 0,
|
|
1819
|
+
rel: href?.startsWith("http") ? "noopener noreferrer" : void 0,
|
|
1820
|
+
children
|
|
1821
|
+
}
|
|
1822
|
+
),
|
|
1823
|
+
blockquote: ({ children }) => {
|
|
1824
|
+
const childrenArray = Array.isArray(children) ? children : [children];
|
|
1825
|
+
const firstChild = childrenArray[0];
|
|
1826
|
+
let textContent = "";
|
|
1827
|
+
if (firstChild && typeof firstChild === "object" && "props" in firstChild) {
|
|
1828
|
+
const props = firstChild.props;
|
|
1829
|
+
if (props.children) {
|
|
1830
|
+
const text = Array.isArray(props.children) ? props.children.join("") : String(props.children);
|
|
1831
|
+
textContent = text;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
const alertMatch = textContent.match(/^\[!(INFO|TIP|WARNING|SUCCESS|ERROR)\]/);
|
|
1835
|
+
if (alertMatch) {
|
|
1836
|
+
const type = alertMatch[1].toLowerCase();
|
|
1837
|
+
const processChildren = (node) => {
|
|
1838
|
+
if (typeof node === "string") {
|
|
1839
|
+
return node.replace(/^\[!(INFO|TIP|WARNING|SUCCESS|ERROR)\]\s*\n?/, "");
|
|
1840
|
+
}
|
|
1841
|
+
if (node && typeof node === "object" && "props" in node) {
|
|
1842
|
+
return {
|
|
1843
|
+
...node,
|
|
1844
|
+
props: {
|
|
1845
|
+
...node.props,
|
|
1846
|
+
children: Array.isArray(node.props.children) ? node.props.children.map(processChildren) : processChildren(node.props.children)
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
return node;
|
|
1851
|
+
};
|
|
1852
|
+
const cleanedChildren = Array.isArray(children) ? children.map(processChildren) : processChildren(children);
|
|
1853
|
+
return /* @__PURE__ */ jsx27(Callout, { type, children: cleanedChildren });
|
|
1854
|
+
}
|
|
1855
|
+
return /* @__PURE__ */ jsx27("blockquote", { className: "border-l-4 border-primary/50 bg-muted/30 pl-4 pr-4 py-3 my-6 rounded-r-lg", children: /* @__PURE__ */ jsx27("div", { className: "text-muted-foreground italic [&>p]:mb-0", children }) });
|
|
1856
|
+
},
|
|
1857
|
+
table: ({ children }) => /* @__PURE__ */ jsx27("div", { className: "overflow-x-auto mb-6 rounded-xl border border-border", children: /* @__PURE__ */ jsx27("table", { className: "min-w-full border-collapse", children }) }),
|
|
1858
|
+
th: ({ children }) => /* @__PURE__ */ jsx27("th", { className: "border-b border-r border-border bg-muted px-4 py-2 text-left font-semibold text-foreground last:border-r-0", children }),
|
|
1859
|
+
td: ({ children }) => /* @__PURE__ */ jsx27("td", { className: "border-b border-r border-border px-4 py-2 text-muted-foreground last:border-r-0", children }),
|
|
1860
|
+
// Custom components
|
|
1861
|
+
Callout,
|
|
1862
|
+
Accordion,
|
|
1863
|
+
AccordionItem,
|
|
1864
|
+
Tabs,
|
|
1865
|
+
Tab,
|
|
1866
|
+
Image,
|
|
1867
|
+
Video,
|
|
1868
|
+
Card,
|
|
1869
|
+
CardGrid,
|
|
1870
|
+
ImageCard,
|
|
1871
|
+
ImageCardGrid,
|
|
1872
|
+
Steps,
|
|
1873
|
+
Step,
|
|
1874
|
+
Icon,
|
|
1875
|
+
Mermaid,
|
|
1876
|
+
Math: Math2,
|
|
1877
|
+
Columns,
|
|
1878
|
+
Column,
|
|
1879
|
+
Badge,
|
|
1880
|
+
Tooltip,
|
|
1881
|
+
Frame,
|
|
1882
|
+
// API Documentation components
|
|
1883
|
+
ApiEndpoint,
|
|
1884
|
+
ApiParams,
|
|
1885
|
+
ApiResponse,
|
|
1886
|
+
ApiPlayground,
|
|
1887
|
+
ApiReference
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
// src/lib/config.types.ts
|
|
1891
|
+
var defaultConfig = {
|
|
1892
|
+
site: {
|
|
1893
|
+
title: "Documentation",
|
|
1894
|
+
description: "Project documentation",
|
|
1895
|
+
baseUrl: "/",
|
|
1896
|
+
language: "en"
|
|
1897
|
+
},
|
|
1898
|
+
theme: {
|
|
1899
|
+
defaultMode: "system",
|
|
1900
|
+
respectPrefersColorScheme: true
|
|
1901
|
+
},
|
|
1902
|
+
navigation: {
|
|
1903
|
+
showSidebar: true,
|
|
1904
|
+
collapsibleSidebar: true,
|
|
1905
|
+
showBreadcrumbs: true,
|
|
1906
|
+
showTableOfContents: true,
|
|
1907
|
+
tocPosition: "right",
|
|
1908
|
+
tocMaxDepth: 3
|
|
1909
|
+
},
|
|
1910
|
+
search: {
|
|
1911
|
+
enabled: true,
|
|
1912
|
+
provider: "local",
|
|
1913
|
+
placeholder: "Search documentation..."
|
|
1914
|
+
},
|
|
1915
|
+
features: {
|
|
1916
|
+
showLastUpdated: true,
|
|
1917
|
+
showReadingTime: true,
|
|
1918
|
+
showAuthors: false,
|
|
1919
|
+
showTags: true,
|
|
1920
|
+
versioning: true,
|
|
1921
|
+
i18n: false
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
|
|
1925
|
+
// src/lib/config.server.ts
|
|
1926
|
+
function deepMerge(target, source) {
|
|
1927
|
+
const result = { ...target };
|
|
1928
|
+
for (const key in source) {
|
|
1929
|
+
const sourceValue = source[key];
|
|
1930
|
+
const targetValue = result[key];
|
|
1931
|
+
if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue)) {
|
|
1932
|
+
result[key] = deepMerge(
|
|
1933
|
+
targetValue && typeof targetValue === "object" ? targetValue : {},
|
|
1934
|
+
sourceValue
|
|
1935
|
+
);
|
|
1936
|
+
} else if (sourceValue !== void 0) {
|
|
1937
|
+
result[key] = sourceValue;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
return result;
|
|
1941
|
+
}
|
|
1942
|
+
function loadConfig(userConfig) {
|
|
1943
|
+
try {
|
|
1944
|
+
const config = deepMerge(defaultConfig, userConfig);
|
|
1945
|
+
return config;
|
|
1946
|
+
} catch (error) {
|
|
1947
|
+
console.error(`\u274C Error loading configuration:`, error);
|
|
1948
|
+
console.warn("Using default configuration.");
|
|
1949
|
+
return defaultConfig;
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
function replaceEnvVariables(text, config) {
|
|
1953
|
+
const cfg = config || loadConfig({});
|
|
1954
|
+
const envVars = cfg.env || {};
|
|
1955
|
+
let result = text;
|
|
1956
|
+
result = result.replace(/\$\{([^}]+)\}/g, (match, varName) => {
|
|
1957
|
+
return envVars[varName] || match;
|
|
1958
|
+
});
|
|
1959
|
+
result = result.replace(/\{\{([^}]+)\}\}/g, (match, varName) => {
|
|
1960
|
+
return envVars[varName] || match;
|
|
1961
|
+
});
|
|
1962
|
+
return result;
|
|
1963
|
+
}
|
|
1964
|
+
function processContentWithEnv(content, config) {
|
|
1965
|
+
return replaceEnvVariables(content, config);
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
// src/lib/sidebar-utils.ts
|
|
1969
|
+
function sortSidebarItems(items) {
|
|
1970
|
+
return [...items].sort((a, b) => {
|
|
1971
|
+
const posA = a.sidebar_position ?? a.meta?.sidebar_position ?? a.meta?.order ?? 999;
|
|
1972
|
+
const posB = b.sidebar_position ?? b.meta?.sidebar_position ?? b.meta?.order ?? 999;
|
|
1973
|
+
return posA - posB;
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
function sortSidebarGroups(groups) {
|
|
1977
|
+
return Object.entries(groups).sort(([, a], [, b]) => {
|
|
1978
|
+
const posA = a.position ?? 999;
|
|
1979
|
+
const posB = b.position ?? 999;
|
|
1980
|
+
return posA - posB;
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
// src/components/docs/category-index.tsx
|
|
1985
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1986
|
+
function CategoryIndex({ categoryPath, version, allDocs, title, description, content, config }) {
|
|
1987
|
+
const childDocs = allDocs.filter((doc) => {
|
|
1988
|
+
const parts = doc.slug.split("/");
|
|
1989
|
+
const docParent = parts.slice(0, -1).join("/");
|
|
1990
|
+
return docParent === categoryPath && doc.slug !== categoryPath;
|
|
1991
|
+
});
|
|
1992
|
+
const processedContent = () => {
|
|
1993
|
+
if (content) {
|
|
1994
|
+
return processContentWithEnv(content, config);
|
|
1995
|
+
}
|
|
1996
|
+
return "";
|
|
1997
|
+
};
|
|
1998
|
+
const sortedDocs = sortSidebarItems(childDocs);
|
|
1999
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex-1 min-w-0", children: [
|
|
2000
|
+
/* @__PURE__ */ jsxs19("div", { className: "mb-8", children: [
|
|
2001
|
+
/* @__PURE__ */ jsx28("h1", { className: "text-4xl font-bold tracking-tight mb-3 text-foreground", children: title }),
|
|
2002
|
+
description && /* @__PURE__ */ jsx28("p", { className: "text-lg text-muted-foreground leading-relaxed", children: description }),
|
|
2003
|
+
/* @__PURE__ */ jsx28("div", { className: "prose prose-slate dark:prose-invert max-w-none prose-headings:scroll-mt-24 prose-headings:font-semibold prose-h1:text-4xl prose-h2:text-3xl prose-h2:mt-12 prose-h2:mb-4 prose-h3:text-2xl prose-h3:mt-8 prose-h3:mb-3 prose-p:text-base prose-p:leading-7 prose-p:text-muted-foreground prose-p:mb-4 prose-a:font-normal prose-a:transition-all prose-code:text-primary prose-code:bg-muted/50 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:text-[13px] prose-code:font-mono prose-code:border prose-code:border-border/50 prose-code:before:content-none prose-code:after:content-none prose-pre:bg-transparent prose-pre:p-0 prose-ul:list-disc prose-ul:list-inside prose-ul:space-y-2 prose-ul:mb-4 prose-ol:list-decimal prose-ol:list-inside prose-ol:space-y-2 prose-ol:mb-4 prose-li:leading-7 prose-li:text-muted-foreground prose-strong:text-foreground prose-strong:font-semibold", children: /* @__PURE__ */ jsx28(
|
|
2004
|
+
MDXRemote,
|
|
2005
|
+
{
|
|
2006
|
+
source: processedContent(),
|
|
2007
|
+
options: {
|
|
2008
|
+
parseFrontmatter: false,
|
|
2009
|
+
mdxOptions: {
|
|
2010
|
+
remarkPlugins: [remarkGfm, remarkCodeMeta],
|
|
2011
|
+
rehypePlugins: [rehypeSlug],
|
|
2012
|
+
development: false
|
|
2013
|
+
}
|
|
2014
|
+
},
|
|
2015
|
+
components: mdxComponents
|
|
2016
|
+
}
|
|
2017
|
+
) })
|
|
2018
|
+
] }),
|
|
2019
|
+
/* @__PURE__ */ jsx28("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-4", children: sortedDocs.map((doc) => /* @__PURE__ */ jsx28(
|
|
2020
|
+
Link4,
|
|
2021
|
+
{
|
|
2022
|
+
href: `/docs/${version}/${doc.slug}`,
|
|
2023
|
+
className: "group block p-5 rounded-xl border border-border bg-card hover:bg-accent hover:border-primary/50 transition-all duration-200",
|
|
2024
|
+
style: {
|
|
2025
|
+
textDecoration: "none !important"
|
|
2026
|
+
},
|
|
2027
|
+
children: /* @__PURE__ */ jsxs19("div", { className: "flex items-start justify-between gap-4", children: [
|
|
2028
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex-1 min-w-0", children: [
|
|
2029
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
2030
|
+
/* @__PURE__ */ jsx28(FileText, { className: "h-6 w-6 text-primary shrink-0" }),
|
|
2031
|
+
/* @__PURE__ */ jsx28("h3", { className: "text-lg font-semibold text-foreground group-hover:text-primary transition-colors", children: doc.meta.title || doc.title })
|
|
2032
|
+
] }),
|
|
2033
|
+
doc.meta.description && /* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground line-clamp-2", children: doc.meta.description }),
|
|
2034
|
+
doc.meta.reading_time && /* @__PURE__ */ jsxs19("p", { className: "text-xs text-muted-foreground mt-2", children: [
|
|
2035
|
+
doc.meta.reading_time,
|
|
2036
|
+
" min read"
|
|
2037
|
+
] })
|
|
2038
|
+
] }),
|
|
2039
|
+
/* @__PURE__ */ jsx28(ChevronRight2, { className: "h-5 w-5 text-muted-foreground group-hover:text-primary group-hover:translate-x-1 transition-all flex-shrink-0 mt-1" })
|
|
2040
|
+
] })
|
|
2041
|
+
},
|
|
2042
|
+
doc.slug
|
|
2043
|
+
)) }),
|
|
2044
|
+
sortedDocs.length === 0 && /* @__PURE__ */ jsxs19("div", { className: "text-center py-12 text-muted-foreground", children: [
|
|
2045
|
+
/* @__PURE__ */ jsx28(FileText, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
|
|
2046
|
+
/* @__PURE__ */ jsx28("p", { children: "No documents found in this category." })
|
|
2047
|
+
] })
|
|
2048
|
+
] });
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
// src/components/docs/componentTextProps.ts
|
|
2052
|
+
var COMPONENT_TEXT_PROPS = {
|
|
2053
|
+
// Accordion components
|
|
2054
|
+
Accordion: ["title"],
|
|
2055
|
+
AccordionItem: ["title"],
|
|
2056
|
+
// Alert/Callout components
|
|
2057
|
+
Alert: ["title", "description"],
|
|
2058
|
+
Banner: ["title"],
|
|
2059
|
+
Callout: ["title", "content"],
|
|
2060
|
+
Note: ["title"],
|
|
2061
|
+
Warning: ["title", "text"],
|
|
2062
|
+
// Navigation components
|
|
2063
|
+
BreadCrumb: ["title", "slug", "version"],
|
|
2064
|
+
// Card components
|
|
2065
|
+
Card: ["title", "description"],
|
|
2066
|
+
ImageCard: ["title", "description", "alt"],
|
|
2067
|
+
// Media components
|
|
2068
|
+
Image: ["alt", "caption"],
|
|
2069
|
+
Video: ["caption"],
|
|
2070
|
+
Frame: ["title"],
|
|
2071
|
+
Mermaid: ["caption"],
|
|
2072
|
+
// Interactive components
|
|
2073
|
+
Tooltip: ["content"],
|
|
2074
|
+
// Code components
|
|
2075
|
+
CodeBlock: ["filename"],
|
|
2076
|
+
// Step components
|
|
2077
|
+
Step: ["title"]
|
|
2078
|
+
};
|
|
2079
|
+
function extractComponentPropsText(mdx) {
|
|
2080
|
+
return mdx.replace(
|
|
2081
|
+
/<([A-Z][\w]*)\b([^/>]*)\/>/g,
|
|
2082
|
+
(_, component, props) => {
|
|
2083
|
+
const searchableProps = COMPONENT_TEXT_PROPS[component];
|
|
2084
|
+
if (!searchableProps) return " ";
|
|
2085
|
+
let extracted = "";
|
|
2086
|
+
for (const prop of searchableProps) {
|
|
2087
|
+
const match = props.match(
|
|
2088
|
+
new RegExp(`${prop}="([^"]+)"`, "i")
|
|
2089
|
+
);
|
|
2090
|
+
if (match) {
|
|
2091
|
+
extracted += " " + match[1];
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
return extracted || " ";
|
|
2095
|
+
}
|
|
2096
|
+
);
|
|
2097
|
+
}
|
|
2098
|
+
function extractSearchText(mdx) {
|
|
2099
|
+
return extractComponentPropsText(mdx).replace(/```[\s\S]*?```/g, " ").replace(/<([A-Z][\w]*)\b[^>]*>[\s\S]*?<\/\1>/g, " ").replace(/<\/?[A-Za-z][^>]*>/g, " ").replace(/`[^`]+`/g, " ").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/[#>*_~=-]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 1e3);
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
// src/components/docs/dev-mode-badge.tsx
|
|
2103
|
+
import { useEffect as useEffect4, useState as useState10 } from "react";
|
|
2104
|
+
import { Code2 } from "lucide-react";
|
|
2105
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2106
|
+
function DevModeBadge() {
|
|
2107
|
+
const [isConnected, setIsConnected] = useState10(true);
|
|
2108
|
+
useEffect4(() => {
|
|
2109
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
2110
|
+
const checkConnection = () => {
|
|
2111
|
+
setIsConnected(navigator.onLine);
|
|
2112
|
+
};
|
|
2113
|
+
window.addEventListener("online", checkConnection);
|
|
2114
|
+
window.addEventListener("offline", checkConnection);
|
|
2115
|
+
return () => {
|
|
2116
|
+
window.removeEventListener("online", checkConnection);
|
|
2117
|
+
window.removeEventListener("offline", checkConnection);
|
|
2118
|
+
};
|
|
2119
|
+
}, []);
|
|
2120
|
+
if (process.env.NODE_ENV !== "development") return null;
|
|
2121
|
+
return /* @__PURE__ */ jsxs20("div", { className: "fixed top-20 left-4 z-40 flex items-center gap-2 px-3 py-1.5 bg-orange-500/10 text-orange-600 dark:text-orange-400 border border-orange-500/20 rounded-full text-xs font-medium", children: [
|
|
2122
|
+
/* @__PURE__ */ jsx29(Code2, { className: "h-3 w-3" }),
|
|
2123
|
+
/* @__PURE__ */ jsx29("span", { children: "Dev Mode" }),
|
|
2124
|
+
/* @__PURE__ */ jsx29("div", { className: `h-2 w-2 rounded-full ${isConnected ? "bg-green-500" : "bg-red-500"} animate-pulse` })
|
|
2125
|
+
] });
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
// src/components/docs/doc-layout.tsx
|
|
2129
|
+
import { ExternalLink as ExternalLink2, FileEdit } from "lucide-react";
|
|
2130
|
+
import { MDXRemote as MDXRemote2 } from "next-mdx-remote/rsc";
|
|
2131
|
+
import remarkGfm2 from "remark-gfm";
|
|
2132
|
+
import rehypeSlug2 from "rehype-slug";
|
|
2133
|
+
|
|
2134
|
+
// src/components/docs/doc-navigation.tsx
|
|
2135
|
+
import Link5 from "next/link";
|
|
2136
|
+
import { ChevronLeft, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
2137
|
+
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2138
|
+
function DocNavigation({ previousDoc, nextDoc, version }) {
|
|
2139
|
+
if (!previousDoc && !nextDoc) return null;
|
|
2140
|
+
return /* @__PURE__ */ jsxs21("div", { className: "mt-12 pt-8 border-t border-border grid grid-cols-2 gap-4", children: [
|
|
2141
|
+
previousDoc ? /* @__PURE__ */ jsxs21(
|
|
2142
|
+
Link5,
|
|
2143
|
+
{
|
|
2144
|
+
href: `/docs/${version}/${previousDoc.slug}`,
|
|
2145
|
+
className: "group flex flex-col gap-2 p-4 rounded-xl border border-border hover:border-primary/50 hover:bg-muted/50 transition-all",
|
|
2146
|
+
style: {
|
|
2147
|
+
textDecoration: "none !important"
|
|
2148
|
+
},
|
|
2149
|
+
children: [
|
|
2150
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
2151
|
+
/* @__PURE__ */ jsx30(ChevronLeft, { className: "h-4 w-4" }),
|
|
2152
|
+
/* @__PURE__ */ jsx30("span", { children: "Previous" })
|
|
2153
|
+
] }),
|
|
2154
|
+
/* @__PURE__ */ jsx30("div", { className: "text-base font-medium text-foreground group-hover:text-primary transition-colors", children: previousDoc.title })
|
|
2155
|
+
]
|
|
2156
|
+
}
|
|
2157
|
+
) : /* @__PURE__ */ jsx30("div", {}),
|
|
2158
|
+
nextDoc ? /* @__PURE__ */ jsxs21(
|
|
2159
|
+
Link5,
|
|
2160
|
+
{
|
|
2161
|
+
href: `/docs/${version}/${nextDoc.slug}`,
|
|
2162
|
+
className: "group flex flex-col gap-2 p-4 rounded-xl border border-border hover:border-primary/50 hover:bg-muted/50 transition-all text-right",
|
|
2163
|
+
style: {
|
|
2164
|
+
textDecoration: "none !important"
|
|
2165
|
+
},
|
|
2166
|
+
children: [
|
|
2167
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-end gap-2 text-sm text-muted-foreground", children: [
|
|
2168
|
+
/* @__PURE__ */ jsx30("span", { children: "Next" }),
|
|
2169
|
+
/* @__PURE__ */ jsx30(ChevronRight3, { className: "h-4 w-4" })
|
|
2170
|
+
] }),
|
|
2171
|
+
/* @__PURE__ */ jsx30("div", { className: "text-base font-medium text-foreground group-hover:text-primary transition-colors", children: nextDoc.title })
|
|
2172
|
+
]
|
|
2173
|
+
}
|
|
2174
|
+
) : /* @__PURE__ */ jsx30("div", {})
|
|
2175
|
+
] });
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
// src/components/docs/doc-metadata.tsx
|
|
2179
|
+
import { Clock, Calendar, User } from "lucide-react";
|
|
2180
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2181
|
+
function DocMetadata({ meta, config }) {
|
|
2182
|
+
const showReadingTime = config.features?.showReadingTime && meta.reading_time;
|
|
2183
|
+
const showLastUpdated = config.features?.showLastUpdated && meta.last_updated;
|
|
2184
|
+
const showAuthors = config.features?.showAuthors && meta.authors?.length;
|
|
2185
|
+
const hasMetadata = showReadingTime || showLastUpdated || showAuthors;
|
|
2186
|
+
if (!hasMetadata) {
|
|
2187
|
+
return null;
|
|
2188
|
+
}
|
|
2189
|
+
return /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-4 text-sm text-muted-foreground border-b border-border pb-4 mb-6", children: [
|
|
2190
|
+
showReadingTime && /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1.5", children: [
|
|
2191
|
+
/* @__PURE__ */ jsx31(Clock, { className: "h-4 w-4" }),
|
|
2192
|
+
/* @__PURE__ */ jsxs22("span", { children: [
|
|
2193
|
+
meta.reading_time,
|
|
2194
|
+
" min read"
|
|
2195
|
+
] })
|
|
2196
|
+
] }),
|
|
2197
|
+
showLastUpdated && meta.last_updated && /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1.5", children: [
|
|
2198
|
+
/* @__PURE__ */ jsx31(Calendar, { className: "h-4 w-4" }),
|
|
2199
|
+
/* @__PURE__ */ jsxs22("span", { children: [
|
|
2200
|
+
"Updated ",
|
|
2201
|
+
new Date(meta.last_updated).toLocaleDateString()
|
|
2202
|
+
] })
|
|
2203
|
+
] }),
|
|
2204
|
+
showAuthors && /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1.5", children: [
|
|
2205
|
+
/* @__PURE__ */ jsx31(User, { className: "h-4 w-4" }),
|
|
2206
|
+
/* @__PURE__ */ jsx31("span", { children: meta.authors.map((author, idx) => /* @__PURE__ */ jsxs22("span", { children: [
|
|
2207
|
+
author.name || author.id,
|
|
2208
|
+
idx < meta.authors.length - 1 && ", "
|
|
2209
|
+
] }, author.id)) })
|
|
2210
|
+
] })
|
|
2211
|
+
] });
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
// src/components/docs/draft-badge.tsx
|
|
2215
|
+
import { FileWarning } from "lucide-react";
|
|
2216
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2217
|
+
function DraftBadge() {
|
|
2218
|
+
return /* @__PURE__ */ jsxs23("div", { className: "inline-flex items-center gap-2 px-3 py-1.5 rounded-md bg-yellow-500/10 border border-yellow-500/20 text-yellow-600 dark:text-yellow-400 text-sm font-medium mb-4", children: [
|
|
2219
|
+
/* @__PURE__ */ jsx32(FileWarning, { className: "h-4 w-4" }),
|
|
2220
|
+
/* @__PURE__ */ jsx32("span", { children: "Draft - Not visible in production" })
|
|
2221
|
+
] });
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
// src/components/docs/doc-tags.tsx
|
|
2225
|
+
import { Tag } from "lucide-react";
|
|
2226
|
+
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2227
|
+
function DocTags({ tags }) {
|
|
2228
|
+
if (!tags || tags.length === 0) {
|
|
2229
|
+
return null;
|
|
2230
|
+
}
|
|
2231
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2 mt-6 pt-6 border-t border-border", children: [
|
|
2232
|
+
/* @__PURE__ */ jsx33(Tag, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2233
|
+
tags.map((tag) => /* @__PURE__ */ jsx33(
|
|
2234
|
+
"span",
|
|
2235
|
+
{
|
|
2236
|
+
className: "inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-primary/10 text-primary border border-primary/20",
|
|
2237
|
+
children: tag
|
|
2238
|
+
},
|
|
2239
|
+
tag
|
|
2240
|
+
))
|
|
2241
|
+
] });
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
// src/components/docs/search-highlight.tsx
|
|
2245
|
+
import { useEffect as useEffect5 } from "react";
|
|
2246
|
+
import { useSearchParams } from "next/navigation";
|
|
2247
|
+
function SearchHighlight() {
|
|
2248
|
+
const searchParams = useSearchParams();
|
|
2249
|
+
const query = searchParams.get("q");
|
|
2250
|
+
useEffect5(() => {
|
|
2251
|
+
if (!query) {
|
|
2252
|
+
document.querySelectorAll("mark.search-highlight").forEach((mark) => {
|
|
2253
|
+
const parent = mark.parentNode;
|
|
2254
|
+
if (parent) {
|
|
2255
|
+
parent.replaceChild(document.createTextNode(mark.textContent || ""), mark);
|
|
2256
|
+
parent.normalize();
|
|
2257
|
+
}
|
|
2258
|
+
});
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
const timeout = setTimeout(() => {
|
|
2262
|
+
highlightSearchTerm(query);
|
|
2263
|
+
}, 100);
|
|
2264
|
+
return () => {
|
|
2265
|
+
clearTimeout(timeout);
|
|
2266
|
+
document.querySelectorAll("mark.search-highlight").forEach((mark) => {
|
|
2267
|
+
const parent = mark.parentNode;
|
|
2268
|
+
if (parent) {
|
|
2269
|
+
parent.replaceChild(document.createTextNode(mark.textContent || ""), mark);
|
|
2270
|
+
parent.normalize();
|
|
2271
|
+
}
|
|
2272
|
+
});
|
|
2273
|
+
};
|
|
2274
|
+
}, [query]);
|
|
2275
|
+
return null;
|
|
2276
|
+
}
|
|
2277
|
+
function highlightSearchTerm(searchTerm) {
|
|
2278
|
+
document.querySelectorAll("mark.search-highlight").forEach((mark) => {
|
|
2279
|
+
const parent = mark.parentNode;
|
|
2280
|
+
if (parent) {
|
|
2281
|
+
parent.replaceChild(document.createTextNode(mark.textContent || ""), mark);
|
|
2282
|
+
parent.normalize();
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2285
|
+
const contentArea = document.querySelector("main") || document.body;
|
|
2286
|
+
const walker = document.createTreeWalker(
|
|
2287
|
+
contentArea,
|
|
2288
|
+
NodeFilter.SHOW_TEXT,
|
|
2289
|
+
{
|
|
2290
|
+
acceptNode: (node) => {
|
|
2291
|
+
const parent = node.parentElement;
|
|
2292
|
+
if (!parent) return NodeFilter.FILTER_REJECT;
|
|
2293
|
+
const tagName = parent.tagName.toLowerCase();
|
|
2294
|
+
if (["mark", "script", "style", "code", "pre"].includes(tagName)) {
|
|
2295
|
+
return NodeFilter.FILTER_REJECT;
|
|
2296
|
+
}
|
|
2297
|
+
if (node.textContent && node.textContent.toLowerCase().includes(searchTerm.toLowerCase())) {
|
|
2298
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
2299
|
+
}
|
|
2300
|
+
return NodeFilter.FILTER_REJECT;
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
);
|
|
2304
|
+
const nodesToHighlight = [];
|
|
2305
|
+
let currentNode;
|
|
2306
|
+
while (currentNode = walker.nextNode()) {
|
|
2307
|
+
if (currentNode.textContent) {
|
|
2308
|
+
nodesToHighlight.push({
|
|
2309
|
+
node: currentNode,
|
|
2310
|
+
text: currentNode.textContent
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
nodesToHighlight.forEach(({ node, text }) => {
|
|
2315
|
+
const regex = new RegExp(`(${escapeRegex(searchTerm)})`, "gi");
|
|
2316
|
+
const parts = text.split(regex);
|
|
2317
|
+
if (parts.length > 1) {
|
|
2318
|
+
const fragment = document.createDocumentFragment();
|
|
2319
|
+
parts.forEach((part) => {
|
|
2320
|
+
if (part.toLowerCase() === searchTerm.toLowerCase()) {
|
|
2321
|
+
const mark = document.createElement("mark");
|
|
2322
|
+
mark.className = "search-highlight bg-yellow-200 dark:bg-yellow-900/50 text-foreground px-1 rounded";
|
|
2323
|
+
mark.textContent = part;
|
|
2324
|
+
fragment.appendChild(mark);
|
|
2325
|
+
} else if (part) {
|
|
2326
|
+
fragment.appendChild(document.createTextNode(part));
|
|
2327
|
+
}
|
|
2328
|
+
});
|
|
2329
|
+
node.parentNode?.replaceChild(fragment, node);
|
|
2330
|
+
}
|
|
2331
|
+
});
|
|
2332
|
+
const firstHighlight = document.querySelector("mark.search-highlight");
|
|
2333
|
+
if (firstHighlight) {
|
|
2334
|
+
setTimeout(() => {
|
|
2335
|
+
firstHighlight.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
2336
|
+
}, 200);
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
function escapeRegex(string) {
|
|
2340
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
// src/components/docs/doc-layout.tsx
|
|
2344
|
+
import { jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2345
|
+
async function DocLayout({ content, meta, previousDoc, nextDoc, version, slug, config }) {
|
|
2346
|
+
const isDevelopment = process.env.NODE_ENV === "development";
|
|
2347
|
+
const processedContent = processContentWithEnv(content, config);
|
|
2348
|
+
const editUrl = config.features?.editUrl && typeof config.features.editUrl === "string" ? `${config.features.editUrl}/${version}/${slug}.mdx` : null;
|
|
2349
|
+
return /* @__PURE__ */ jsxs25("article", { className: "flex-1 min-w-0", children: [
|
|
2350
|
+
/* @__PURE__ */ jsx34(SearchHighlight, {}),
|
|
2351
|
+
config.navigation?.showBreadcrumbs && /* @__PURE__ */ jsx34(Breadcrumb, { version, slug, title: meta.title }),
|
|
2352
|
+
isDevelopment && meta.draft && /* @__PURE__ */ jsx34(DraftBadge, {}),
|
|
2353
|
+
/* @__PURE__ */ jsxs25("div", { className: "mb-8", children: [
|
|
2354
|
+
/* @__PURE__ */ jsx34("h1", { className: "text-4xl font-bold tracking-tight mb-3 text-foreground", children: meta.title }),
|
|
2355
|
+
meta.description && /* @__PURE__ */ jsx34("p", { className: "text-lg text-muted-foreground leading-relaxed", children: meta.description })
|
|
2356
|
+
] }),
|
|
2357
|
+
/* @__PURE__ */ jsx34(DocMetadata, { meta, config }),
|
|
2358
|
+
/* @__PURE__ */ jsx34("div", { className: "prose prose-slate dark:prose-invert max-w-none prose-headings:scroll-mt-24 prose-headings:font-semibold prose-h1:text-4xl prose-h2:text-3xl prose-h2:mt-12 prose-h2:mb-4 prose-h3:text-2xl prose-h3:mt-8 prose-h3:mb-3 prose-p:text-base prose-p:leading-7 prose-p:text-muted-foreground prose-p:mb-4 prose-a:font-normal prose-a:transition-all prose-code:text-primary prose-code:bg-muted/50 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:text-[13px] prose-code:font-mono prose-code:border prose-code:border-border/50 prose-code:before:content-none prose-code:after:content-none prose-pre:bg-transparent prose-pre:p-0 prose-ul:list-disc prose-ul:list-inside prose-ul:space-y-2 prose-ul:mb-4 prose-ol:list-decimal prose-ol:list-inside prose-ol:space-y-2 prose-ol:mb-4 prose-li:leading-7 prose-li:text-muted-foreground prose-strong:text-foreground prose-strong:font-semibold", children: /* @__PURE__ */ jsx34(
|
|
2359
|
+
MDXRemote2,
|
|
2360
|
+
{
|
|
2361
|
+
source: processedContent,
|
|
2362
|
+
options: {
|
|
2363
|
+
parseFrontmatter: false,
|
|
2364
|
+
mdxOptions: {
|
|
2365
|
+
remarkPlugins: [remarkGfm2, remarkCodeMeta],
|
|
2366
|
+
rehypePlugins: [rehypeSlug2],
|
|
2367
|
+
development: false
|
|
2368
|
+
}
|
|
2369
|
+
},
|
|
2370
|
+
components: mdxComponents
|
|
2371
|
+
}
|
|
2372
|
+
) }),
|
|
2373
|
+
config.features?.showTags && meta.tags && meta.tags.length > 0 && /* @__PURE__ */ jsx34(DocTags, { tags: meta.tags }),
|
|
2374
|
+
(editUrl || config.social?.github) && /* @__PURE__ */ jsxs25("div", { className: "mt-12 pt-6 border-t border-border flex items-center justify-between", children: [
|
|
2375
|
+
editUrl ? /* @__PURE__ */ jsxs25(
|
|
2376
|
+
"a",
|
|
2377
|
+
{
|
|
2378
|
+
href: editUrl,
|
|
2379
|
+
target: "_blank",
|
|
2380
|
+
rel: "noopener noreferrer",
|
|
2381
|
+
className: "flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",
|
|
2382
|
+
children: [
|
|
2383
|
+
/* @__PURE__ */ jsx34(FileEdit, { className: "h-4 w-4" }),
|
|
2384
|
+
"Edit this page"
|
|
2385
|
+
]
|
|
2386
|
+
}
|
|
2387
|
+
) : /* @__PURE__ */ jsx34("div", {}),
|
|
2388
|
+
config.social?.github && /* @__PURE__ */ jsxs25(
|
|
2389
|
+
"a",
|
|
2390
|
+
{
|
|
2391
|
+
href: `${config.social.github}/issues/new`,
|
|
2392
|
+
target: "_blank",
|
|
2393
|
+
rel: "noopener noreferrer",
|
|
2394
|
+
className: "flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",
|
|
2395
|
+
children: [
|
|
2396
|
+
/* @__PURE__ */ jsx34(ExternalLink2, { className: "h-4 w-4" }),
|
|
2397
|
+
"Report an issue"
|
|
2398
|
+
]
|
|
2399
|
+
}
|
|
2400
|
+
)
|
|
2401
|
+
] }),
|
|
2402
|
+
/* @__PURE__ */ jsx34(DocNavigation, { previousDoc, nextDoc, version })
|
|
2403
|
+
] });
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
// src/components/docs/doc-layout-wrapper.tsx
|
|
2407
|
+
import { useEffect as useEffect7, useRef as useRef3 } from "react";
|
|
2408
|
+
|
|
2409
|
+
// src/components/docs/mobile-doc-layout.tsx
|
|
2410
|
+
import { useState as useState13, cloneElement, isValidElement as isValidElement2 } from "react";
|
|
2411
|
+
|
|
2412
|
+
// src/components/docs/footer.tsx
|
|
2413
|
+
import Link6 from "next/link";
|
|
2414
|
+
import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2415
|
+
function Footer({ config }) {
|
|
2416
|
+
if (!config.footer) {
|
|
2417
|
+
return null;
|
|
2418
|
+
}
|
|
2419
|
+
return /* @__PURE__ */ jsx35("footer", { className: "bg-muted/30 dark:bg-muted/10 rounded-2xl mt-24", children: /* @__PURE__ */ jsxs26("div", { className: "px-6 py-12", children: [
|
|
2420
|
+
config.footer.links && config.footer.links.length > 0 && /* @__PURE__ */ jsx35("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-8 mb-8", children: config.footer.links.map((column, idx) => /* @__PURE__ */ jsxs26("div", { children: [
|
|
2421
|
+
/* @__PURE__ */ jsx35("h3", { className: "font-semibold text-foreground mb-4", children: column.title }),
|
|
2422
|
+
/* @__PURE__ */ jsx35("ul", { className: "space-y-2", children: column.items.map((item, itemIdx) => /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35(
|
|
2423
|
+
Link6,
|
|
2424
|
+
{
|
|
2425
|
+
href: item.href,
|
|
2426
|
+
className: "text-sm text-muted-foreground hover:text-foreground transition-colors",
|
|
2427
|
+
children: item.label
|
|
2428
|
+
}
|
|
2429
|
+
) }, itemIdx)) })
|
|
2430
|
+
] }, idx)) }),
|
|
2431
|
+
config.footer.copyright && /* @__PURE__ */ jsx35("div", { className: "pt-8", children: /* @__PURE__ */ jsx35("p", { className: "text-sm text-muted-foreground text-center", children: config.footer.copyright }) })
|
|
2432
|
+
] }) });
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
// src/components/docs/site-banner.tsx
|
|
2436
|
+
import { X as X2, AlertCircle, CheckCircle, Info as Info2, XCircle as XCircle2 } from "lucide-react";
|
|
2437
|
+
import { useState as useState11, useEffect as useEffect6 } from "react";
|
|
2438
|
+
import { jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2439
|
+
function SiteBanner({ config }) {
|
|
2440
|
+
const [dismissed, setDismissed] = useState11(false);
|
|
2441
|
+
const [mounted, setMounted] = useState11(false);
|
|
2442
|
+
const banner = config.banner;
|
|
2443
|
+
const storageKey = "site-banner-dismissed";
|
|
2444
|
+
useEffect6(() => {
|
|
2445
|
+
setMounted(true);
|
|
2446
|
+
const isDismissed = localStorage.getItem(storageKey) === "true";
|
|
2447
|
+
setDismissed(isDismissed);
|
|
2448
|
+
}, []);
|
|
2449
|
+
const handleDismiss = () => {
|
|
2450
|
+
setDismissed(true);
|
|
2451
|
+
localStorage.setItem(storageKey, "true");
|
|
2452
|
+
};
|
|
2453
|
+
if (!mounted || !banner || !banner.enabled || dismissed) {
|
|
2454
|
+
return null;
|
|
2455
|
+
}
|
|
2456
|
+
const typeConfig = {
|
|
2457
|
+
info: {
|
|
2458
|
+
icon: Info2,
|
|
2459
|
+
bg: "bg-blue-500/10 dark:bg-blue-400/5",
|
|
2460
|
+
border: "border-blue-500/30 dark:border-blue-500/20",
|
|
2461
|
+
iconColor: "text-blue-600 dark:text-blue-400",
|
|
2462
|
+
textColor: "text-blue-900 dark:text-blue-300"
|
|
2463
|
+
},
|
|
2464
|
+
success: {
|
|
2465
|
+
icon: CheckCircle,
|
|
2466
|
+
bg: "bg-green-500/10 dark:bg-green-400/5",
|
|
2467
|
+
border: "border-green-500/30 dark:border-green-500/20",
|
|
2468
|
+
iconColor: "text-green-600 dark:text-green-400",
|
|
2469
|
+
textColor: "text-green-900 dark:text-green-300"
|
|
2470
|
+
},
|
|
2471
|
+
warning: {
|
|
2472
|
+
icon: AlertCircle,
|
|
2473
|
+
bg: "bg-yellow-500/10 dark:bg-yellow-400/5",
|
|
2474
|
+
border: "border-yellow-500/30 dark:border-yellow-500/20",
|
|
2475
|
+
iconColor: "text-yellow-600 dark:text-yellow-400",
|
|
2476
|
+
textColor: "text-yellow-900 dark:text-yellow-300"
|
|
2477
|
+
},
|
|
2478
|
+
error: {
|
|
2479
|
+
icon: XCircle2,
|
|
2480
|
+
bg: "bg-red-500/10 dark:bg-red-400/5",
|
|
2481
|
+
border: "border-red-500/30 dark:border-red-500/20",
|
|
2482
|
+
iconColor: "text-red-600 dark:text-red-400",
|
|
2483
|
+
textColor: "text-red-900 dark:text-red-300"
|
|
2484
|
+
}
|
|
2485
|
+
};
|
|
2486
|
+
const type = banner.type || "info";
|
|
2487
|
+
const { icon: IconComponent, bg, border, iconColor, textColor } = typeConfig[type];
|
|
2488
|
+
return /* @__PURE__ */ jsx36("div", { className: `w-full border-b ${border} ${bg}`, children: /* @__PURE__ */ jsx36("div", { className: "container mx-auto px-6 py-3", children: /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-3", children: [
|
|
2489
|
+
/* @__PURE__ */ jsx36(IconComponent, { className: `h-5 w-5 shrink-0 ${iconColor}` }),
|
|
2490
|
+
/* @__PURE__ */ jsx36("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx36("p", { className: `text-sm font-medium ${textColor}`, children: banner.message }) }),
|
|
2491
|
+
banner.dismissible && /* @__PURE__ */ jsx36(
|
|
2492
|
+
"button",
|
|
2493
|
+
{
|
|
2494
|
+
onClick: handleDismiss,
|
|
2495
|
+
className: `shrink-0 p-1 rounded-md hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${iconColor}`,
|
|
2496
|
+
"aria-label": "Dismiss banner",
|
|
2497
|
+
children: /* @__PURE__ */ jsx36(X2, { className: "h-4 w-4" })
|
|
2498
|
+
}
|
|
2499
|
+
)
|
|
2500
|
+
] }) }) });
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
// src/components/docs/tab-groups.tsx
|
|
2504
|
+
import { jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2505
|
+
function TabGroups({ tabGroups, activeTabId, onTabChange }) {
|
|
2506
|
+
const activeTab = activeTabId || tabGroups[0]?.id || "";
|
|
2507
|
+
const handleTabChange = (tabId) => {
|
|
2508
|
+
onTabChange?.(tabId);
|
|
2509
|
+
};
|
|
2510
|
+
if (!tabGroups || tabGroups.length === 0) {
|
|
2511
|
+
return null;
|
|
2512
|
+
}
|
|
2513
|
+
return /* @__PURE__ */ jsx37("div", { className: "sticky top-16 z-30 border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: /* @__PURE__ */ jsx37("div", { className: "container mx-auto px-6", children: /* @__PURE__ */ jsx37("nav", { className: "flex gap-1 overflow-x-auto no-scrollbar", "aria-label": "Documentation tabs", children: tabGroups.map((tab) => {
|
|
2514
|
+
const isActive = tab.id === activeTab;
|
|
2515
|
+
return /* @__PURE__ */ jsxs28(
|
|
2516
|
+
"button",
|
|
2517
|
+
{
|
|
2518
|
+
onClick: () => handleTabChange(tab.id),
|
|
2519
|
+
className: `flex items-center gap-2 px-4 py-3 text-sm font-medium whitespace-nowrap transition-all border-b-2 ${isActive ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
2520
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2521
|
+
children: [
|
|
2522
|
+
tab.icon && /* @__PURE__ */ jsx37(Icon, { icon: tab.icon, size: 16, className: "shrink-0" }),
|
|
2523
|
+
tab.label
|
|
2524
|
+
]
|
|
2525
|
+
},
|
|
2526
|
+
tab.id
|
|
2527
|
+
);
|
|
2528
|
+
}) }) }) });
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
// src/components/docs/sidebar.tsx
|
|
2532
|
+
import Link7 from "next/link";
|
|
2533
|
+
import { usePathname } from "next/navigation";
|
|
2534
|
+
import { ChevronRight as ChevronRight4, ChevronDown as ChevronDown3, FolderOpen } from "lucide-react";
|
|
2535
|
+
import { useState as useState12 } from "react";
|
|
2536
|
+
import { jsx as jsx38, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2537
|
+
function Sidebar({ docs, version, onLinkClick, config, activeTabGroup }) {
|
|
2538
|
+
const pathname = usePathname();
|
|
2539
|
+
const [collapsed, setCollapsed] = useState12(() => {
|
|
2540
|
+
const initial = {};
|
|
2541
|
+
return initial;
|
|
2542
|
+
});
|
|
2543
|
+
if (!config.navigation?.showSidebar) {
|
|
2544
|
+
return null;
|
|
2545
|
+
}
|
|
2546
|
+
const hasTabGroups = config.navigation?.tabGroups && config.navigation.tabGroups.length > 0;
|
|
2547
|
+
const filteredDocs = hasTabGroups && activeTabGroup ? docs.filter((doc) => {
|
|
2548
|
+
const docTabGroup = doc.meta?.tab_group || doc.categoryTabGroup;
|
|
2549
|
+
if (!docTabGroup) {
|
|
2550
|
+
return activeTabGroup === config.navigation?.tabGroups?.[0]?.id;
|
|
2551
|
+
}
|
|
2552
|
+
return docTabGroup === activeTabGroup;
|
|
2553
|
+
}) : docs;
|
|
2554
|
+
const rootGroups = {};
|
|
2555
|
+
const standalone = [];
|
|
2556
|
+
filteredDocs.forEach((doc) => {
|
|
2557
|
+
const pathParts = doc.filePath.split("/");
|
|
2558
|
+
const isIndexFile = doc.filePath.endsWith("/index") || doc.filePath === "index" || pathParts.length > 1 && doc.slug === pathParts.slice(0, -1).join("/");
|
|
2559
|
+
const customGroup = doc.sidebar || doc.group;
|
|
2560
|
+
if (customGroup) {
|
|
2561
|
+
const groupName = customGroup.charAt(0).toUpperCase() + customGroup.slice(1);
|
|
2562
|
+
if (!rootGroups[groupName]) {
|
|
2563
|
+
rootGroups[groupName] = {
|
|
2564
|
+
label: groupName,
|
|
2565
|
+
path: customGroup,
|
|
2566
|
+
items: [],
|
|
2567
|
+
position: 999,
|
|
2568
|
+
collapsible: doc.categoryCollapsible ?? true,
|
|
2569
|
+
defaultCollapsed: doc.categoryCollapsed ?? false,
|
|
2570
|
+
children: {}
|
|
2571
|
+
};
|
|
2572
|
+
}
|
|
2573
|
+
if (isIndexFile) {
|
|
2574
|
+
rootGroups[groupName].position = doc.sidebar_position ?? 999;
|
|
2575
|
+
rootGroups[groupName].icon = doc.categoryIcon;
|
|
2576
|
+
} else {
|
|
2577
|
+
rootGroups[groupName].items.push(doc);
|
|
2578
|
+
}
|
|
2579
|
+
return;
|
|
2580
|
+
}
|
|
2581
|
+
if (pathParts.length > 1) {
|
|
2582
|
+
const folderParts = pathParts.slice(0, -1);
|
|
2583
|
+
let currentLevel = rootGroups;
|
|
2584
|
+
let currentPath = "";
|
|
2585
|
+
for (let i = 0; i < folderParts.length; i++) {
|
|
2586
|
+
const folder = folderParts[i];
|
|
2587
|
+
currentPath = currentPath ? `${currentPath}/${folder}` : folder;
|
|
2588
|
+
const folderLabel = folder.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
2589
|
+
if (!currentLevel[folder]) {
|
|
2590
|
+
currentLevel[folder] = {
|
|
2591
|
+
label: doc.categoryLabel && i === folderParts.length - 1 ? doc.categoryLabel : folderLabel,
|
|
2592
|
+
path: currentPath,
|
|
2593
|
+
icon: doc.categoryIcon,
|
|
2594
|
+
items: [],
|
|
2595
|
+
position: doc.categoryPosition ?? 999,
|
|
2596
|
+
collapsible: doc.categoryCollapsible ?? true,
|
|
2597
|
+
defaultCollapsed: doc.categoryCollapsed ?? false,
|
|
2598
|
+
children: {}
|
|
2599
|
+
};
|
|
2600
|
+
}
|
|
2601
|
+
if (i === folderParts.length - 1) {
|
|
2602
|
+
if (isIndexFile) {
|
|
2603
|
+
currentLevel[folder].position = doc.categoryPosition ?? doc.sidebar_position ?? 999;
|
|
2604
|
+
if (doc.categoryLabel) {
|
|
2605
|
+
currentLevel[folder].label = doc.categoryLabel;
|
|
2606
|
+
}
|
|
2607
|
+
if (doc.categoryIcon) {
|
|
2608
|
+
currentLevel[folder].icon = doc.categoryIcon;
|
|
2609
|
+
}
|
|
2610
|
+
} else {
|
|
2611
|
+
currentLevel[folder].items.push(doc);
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
currentLevel = currentLevel[folder].children;
|
|
2615
|
+
}
|
|
2616
|
+
} else {
|
|
2617
|
+
if (!isIndexFile) {
|
|
2618
|
+
standalone.push(doc);
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
});
|
|
2622
|
+
const toggleSection = (section) => {
|
|
2623
|
+
setCollapsed((prev) => ({ ...prev, [section]: !prev[section] }));
|
|
2624
|
+
};
|
|
2625
|
+
const renderGroup = (groupKey, group, depth = 0) => {
|
|
2626
|
+
const sortedItems = sortSidebarItems(group.items);
|
|
2627
|
+
const sortedChildren = sortSidebarGroups(group.children);
|
|
2628
|
+
const hasChildren = sortedChildren.length > 0;
|
|
2629
|
+
const hasItems = sortedItems.length > 0;
|
|
2630
|
+
const hasContent = hasChildren || hasItems;
|
|
2631
|
+
const isActiveInGroup = (g) => {
|
|
2632
|
+
const hasActiveItem2 = g.items.some((doc) => pathname === `/docs/${version}/${doc.slug}`);
|
|
2633
|
+
if (hasActiveItem2) return true;
|
|
2634
|
+
return Object.values(g.children).some((child) => isActiveInGroup(child));
|
|
2635
|
+
};
|
|
2636
|
+
const hasActiveItem = isActiveInGroup(group);
|
|
2637
|
+
const isGroupActive = pathname === `/docs/${version}/${group.path}`;
|
|
2638
|
+
const isCollapsed = hasActiveItem || isGroupActive ? false : collapsed[groupKey] ?? group.defaultCollapsed;
|
|
2639
|
+
const marginLeft = depth > 0 ? "ml-4" : "";
|
|
2640
|
+
const groupHref = `/docs/${version}/${group.path}`;
|
|
2641
|
+
return /* @__PURE__ */ jsxs29("div", { className: `space-y-1 ${marginLeft}`, children: [
|
|
2642
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center group", children: [
|
|
2643
|
+
/* @__PURE__ */ jsxs29(
|
|
2644
|
+
Link7,
|
|
2645
|
+
{
|
|
2646
|
+
href: groupHref,
|
|
2647
|
+
onClick: onLinkClick,
|
|
2648
|
+
className: `flex items-center gap-2 flex-1 px-3 py-2 text-sm font-semibold rounded-l-xl transition-all ${isGroupActive ? "bg-primary/10 text-primary" : "text-foreground hover:bg-accent/50"}`,
|
|
2649
|
+
children: [
|
|
2650
|
+
group.icon ? /* @__PURE__ */ jsx38(Icon, { icon: group.icon, size: 16, className: "shrink-0" }) : /* @__PURE__ */ jsx38(FolderOpen, { size: 16, className: "shrink-0" }),
|
|
2651
|
+
group.label
|
|
2652
|
+
]
|
|
2653
|
+
}
|
|
2654
|
+
),
|
|
2655
|
+
hasContent && group.collapsible && config.navigation?.collapsibleSidebar && /* @__PURE__ */ jsx38(
|
|
2656
|
+
"button",
|
|
2657
|
+
{
|
|
2658
|
+
onClick: (e) => {
|
|
2659
|
+
e.preventDefault();
|
|
2660
|
+
e.stopPropagation();
|
|
2661
|
+
toggleSection(groupKey);
|
|
2662
|
+
},
|
|
2663
|
+
className: `p-2 rounded-r-xl transition-all ${isGroupActive ? "hover:bg-primary/20" : "hover:bg-accent/50"}`,
|
|
2664
|
+
"aria-label": isCollapsed ? "Expand section" : "Collapse section",
|
|
2665
|
+
children: isCollapsed ? /* @__PURE__ */ jsx38(ChevronRight4, { className: `h-4 w-4 ${isGroupActive ? "text-primary" : "text-muted-foreground"}` }) : /* @__PURE__ */ jsx38(ChevronDown3, { className: `h-4 w-4 ${isGroupActive ? "text-primary" : "text-muted-foreground"}` })
|
|
2666
|
+
}
|
|
2667
|
+
)
|
|
2668
|
+
] }),
|
|
2669
|
+
!isCollapsed && hasContent && /* @__PURE__ */ jsx38("div", { className: "ml-4 space-y-1", children: (() => {
|
|
2670
|
+
const merged = [
|
|
2671
|
+
...sortedChildren.map(([childKey, childGroup]) => ({
|
|
2672
|
+
type: "group",
|
|
2673
|
+
key: childKey,
|
|
2674
|
+
group: childGroup,
|
|
2675
|
+
position: childGroup.position
|
|
2676
|
+
})),
|
|
2677
|
+
...sortedItems.map((doc) => ({
|
|
2678
|
+
type: "item",
|
|
2679
|
+
doc,
|
|
2680
|
+
position: doc.sidebar_position ?? doc.meta?.sidebar_position ?? doc.meta?.order ?? 999
|
|
2681
|
+
}))
|
|
2682
|
+
];
|
|
2683
|
+
merged.sort((a, b) => a.position - b.position);
|
|
2684
|
+
return merged.map((item) => {
|
|
2685
|
+
if (item.type === "group") {
|
|
2686
|
+
return renderGroup(`${groupKey}/${item.key}`, item.group, depth + 1);
|
|
2687
|
+
} else {
|
|
2688
|
+
const href = `/docs/${version}/${item.doc.slug}`;
|
|
2689
|
+
const isActive = pathname === href;
|
|
2690
|
+
return /* @__PURE__ */ jsxs29(
|
|
2691
|
+
Link7,
|
|
2692
|
+
{
|
|
2693
|
+
href,
|
|
2694
|
+
onClick: onLinkClick,
|
|
2695
|
+
className: `flex items-center gap-2 px-3 py-2 text-sm rounded-xl transition-all ${isActive ? "bg-primary/10 text-primary font-medium" : "text-foreground hover:text-foreground hover:bg-accent/50"}`,
|
|
2696
|
+
children: [
|
|
2697
|
+
item.doc.meta?.icon && /* @__PURE__ */ jsx38(Icon, { icon: item.doc.meta.icon, size: 16, className: "shrink-0" }),
|
|
2698
|
+
item.doc.title
|
|
2699
|
+
]
|
|
2700
|
+
},
|
|
2701
|
+
`grouped-${item.doc.slug}`
|
|
2702
|
+
);
|
|
2703
|
+
}
|
|
2704
|
+
});
|
|
2705
|
+
})() })
|
|
2706
|
+
] }, `group-${groupKey}`);
|
|
2707
|
+
};
|
|
2708
|
+
const sortedRootGroups = sortSidebarGroups(rootGroups);
|
|
2709
|
+
const sortedStandalone = sortSidebarItems(standalone);
|
|
2710
|
+
const stickyTop = hasTabGroups ? "top-[7.5rem]" : "top-24";
|
|
2711
|
+
const maxHeight = hasTabGroups ? "max-h-[calc(100vh-10rem)]" : "max-h-[calc(100vh-7rem)]";
|
|
2712
|
+
return /* @__PURE__ */ jsx38("aside", { className: `w-64 shrink-0 sticky ${stickyTop} self-start`, children: /* @__PURE__ */ jsxs29("div", { className: `${maxHeight} overflow-y-auto bg-muted/30 dark:bg-muted/10 rounded-2xl p-4 border border-border/50`, children: [
|
|
2713
|
+
/* @__PURE__ */ jsx38("h2", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-4 px-2", children: "Documentation" }),
|
|
2714
|
+
/* @__PURE__ */ jsxs29("nav", { className: "space-y-1", children: [
|
|
2715
|
+
sortedStandalone.length > 0 && sortedStandalone.map((doc) => {
|
|
2716
|
+
const href = `/docs/${version}/${doc.slug}`;
|
|
2717
|
+
const isActive = pathname === href;
|
|
2718
|
+
return /* @__PURE__ */ jsxs29(
|
|
2719
|
+
Link7,
|
|
2720
|
+
{
|
|
2721
|
+
href,
|
|
2722
|
+
onClick: onLinkClick,
|
|
2723
|
+
className: `flex items-center gap-2 px-3 py-2 text-sm rounded-xl transition-all ${isActive ? "bg-primary/10 text-primary font-medium" : "text-foreground hover:text-foreground hover:bg-accent/50"}`,
|
|
2724
|
+
children: [
|
|
2725
|
+
doc.meta?.icon && /* @__PURE__ */ jsx38(Icon, { icon: doc.meta.icon, size: 16, className: "shrink-0" }),
|
|
2726
|
+
doc.title
|
|
2727
|
+
]
|
|
2728
|
+
},
|
|
2729
|
+
`standalone-${doc.slug}`
|
|
2730
|
+
);
|
|
2731
|
+
}),
|
|
2732
|
+
sortedRootGroups.map(([groupKey, group]) => renderGroup(groupKey, group, 0))
|
|
2733
|
+
] })
|
|
2734
|
+
] }) });
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
// src/components/docs/mobile-doc-layout.tsx
|
|
2738
|
+
import { jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2739
|
+
function MobileDocLayout({ header, docs, version, content, toc, config, activeTabGroup, onTabChange }) {
|
|
2740
|
+
const [sidebarOpen, setSidebarOpen] = useState13(false);
|
|
2741
|
+
const handleTabChange = (tabId) => {
|
|
2742
|
+
onTabChange?.(tabId);
|
|
2743
|
+
};
|
|
2744
|
+
const closeSidebar = () => setSidebarOpen(false);
|
|
2745
|
+
const toggleSidebar = () => setSidebarOpen(!sidebarOpen);
|
|
2746
|
+
const headerWithProps = isValidElement2(header) ? cloneElement(header, {
|
|
2747
|
+
onMenuClick: toggleSidebar
|
|
2748
|
+
}) : header;
|
|
2749
|
+
return /* @__PURE__ */ jsxs30("div", { className: "min-h-screen bg-background", children: [
|
|
2750
|
+
headerWithProps,
|
|
2751
|
+
/* @__PURE__ */ jsx39(SiteBanner, { config }),
|
|
2752
|
+
config.navigation?.tabGroups && config.navigation.tabGroups.length > 0 && /* @__PURE__ */ jsx39(
|
|
2753
|
+
TabGroups,
|
|
2754
|
+
{
|
|
2755
|
+
tabGroups: config.navigation.tabGroups,
|
|
2756
|
+
activeTabId: activeTabGroup,
|
|
2757
|
+
onTabChange: handleTabChange
|
|
2758
|
+
}
|
|
2759
|
+
),
|
|
2760
|
+
sidebarOpen && /* @__PURE__ */ jsx39(
|
|
2761
|
+
"div",
|
|
2762
|
+
{
|
|
2763
|
+
className: "lg:hidden fixed inset-0 bg-background/80 backdrop-blur-sm z-40",
|
|
2764
|
+
onClick: () => setSidebarOpen(false)
|
|
2765
|
+
}
|
|
2766
|
+
),
|
|
2767
|
+
/* @__PURE__ */ jsx39(
|
|
2768
|
+
"div",
|
|
2769
|
+
{
|
|
2770
|
+
className: `lg:hidden fixed top-0 left-0 h-full w-64 bg-background border-r border-border z-40 transform transition-transform duration-300 ease-in-out overflow-y-auto ${sidebarOpen ? "translate-x-0" : "-translate-x-full"}`,
|
|
2771
|
+
children: /* @__PURE__ */ jsx39("div", { className: "pt-20 px-4", children: /* @__PURE__ */ jsx39(
|
|
2772
|
+
Sidebar,
|
|
2773
|
+
{
|
|
2774
|
+
docs,
|
|
2775
|
+
version,
|
|
2776
|
+
config,
|
|
2777
|
+
onLinkClick: closeSidebar,
|
|
2778
|
+
activeTabGroup
|
|
2779
|
+
}
|
|
2780
|
+
) })
|
|
2781
|
+
}
|
|
2782
|
+
),
|
|
2783
|
+
/* @__PURE__ */ jsx39("main", { className: "container mx-auto px-6 py-8", children: /* @__PURE__ */ jsxs30("div", { className: "flex", children: [
|
|
2784
|
+
/* @__PURE__ */ jsx39("div", { className: "hidden lg:block", children: /* @__PURE__ */ jsx39(
|
|
2785
|
+
Sidebar,
|
|
2786
|
+
{
|
|
2787
|
+
docs,
|
|
2788
|
+
version,
|
|
2789
|
+
config,
|
|
2790
|
+
activeTabGroup
|
|
2791
|
+
}
|
|
2792
|
+
) }),
|
|
2793
|
+
/* @__PURE__ */ jsx39("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-2 px-2 md:px-8", children: [
|
|
2794
|
+
content,
|
|
2795
|
+
/* @__PURE__ */ jsx39(Footer, { config })
|
|
2796
|
+
] }) }),
|
|
2797
|
+
toc
|
|
2798
|
+
] }) })
|
|
2799
|
+
] });
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
// src/components/docs/tab-context.tsx
|
|
2803
|
+
import { createContext, useContext, useState as useState14 } from "react";
|
|
2804
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2805
|
+
var TabContext = createContext(void 0);
|
|
2806
|
+
function TabProvider({ children, defaultTab }) {
|
|
2807
|
+
const [activeTabGroup, setActiveTabGroup] = useState14(defaultTab);
|
|
2808
|
+
return /* @__PURE__ */ jsx40(TabContext.Provider, { value: { activeTabGroup, setActiveTabGroup }, children });
|
|
2809
|
+
}
|
|
2810
|
+
function useTabContext() {
|
|
2811
|
+
const context = useContext(TabContext);
|
|
2812
|
+
if (!context) {
|
|
2813
|
+
throw new Error("useTabContext must be used within TabProvider");
|
|
2814
|
+
}
|
|
2815
|
+
return context;
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
// src/components/docs/doc-layout-wrapper.tsx
|
|
2819
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2820
|
+
function DocLayoutWrapper({ header, docs, version, content, toc, config, currentPageTabGroup }) {
|
|
2821
|
+
const { activeTabGroup, setActiveTabGroup } = useTabContext();
|
|
2822
|
+
const lastPageTabGroupRef = useRef3(void 0);
|
|
2823
|
+
const isInitialMount = useRef3(true);
|
|
2824
|
+
useEffect7(() => {
|
|
2825
|
+
if (isInitialMount.current && currentPageTabGroup) {
|
|
2826
|
+
setActiveTabGroup(currentPageTabGroup);
|
|
2827
|
+
lastPageTabGroupRef.current = currentPageTabGroup;
|
|
2828
|
+
isInitialMount.current = false;
|
|
2829
|
+
return;
|
|
2830
|
+
}
|
|
2831
|
+
if (currentPageTabGroup && lastPageTabGroupRef.current !== currentPageTabGroup) {
|
|
2832
|
+
setActiveTabGroup(currentPageTabGroup);
|
|
2833
|
+
lastPageTabGroupRef.current = currentPageTabGroup;
|
|
2834
|
+
}
|
|
2835
|
+
}, [currentPageTabGroup, setActiveTabGroup]);
|
|
2836
|
+
return /* @__PURE__ */ jsx41(
|
|
2837
|
+
MobileDocLayout,
|
|
2838
|
+
{
|
|
2839
|
+
header,
|
|
2840
|
+
docs,
|
|
2841
|
+
version,
|
|
2842
|
+
content,
|
|
2843
|
+
toc,
|
|
2844
|
+
config,
|
|
2845
|
+
activeTabGroup,
|
|
2846
|
+
onTabChange: setActiveTabGroup
|
|
2847
|
+
}
|
|
2848
|
+
);
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
// src/components/docs/doc-loading.tsx
|
|
2852
|
+
import { jsx as jsx42, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2853
|
+
function DocLoading() {
|
|
2854
|
+
return /* @__PURE__ */ jsx42("div", { className: "max-w-4xl mx-auto px-6 py-8", children: /* @__PURE__ */ jsxs31("div", { className: "animate-pulse space-y-4", children: [
|
|
2855
|
+
/* @__PURE__ */ jsx42("div", { className: "h-8 bg-gray-200 rounded w-3/4" }),
|
|
2856
|
+
/* @__PURE__ */ jsx42("div", { className: "h-4 bg-gray-200 rounded w-1/2" }),
|
|
2857
|
+
/* @__PURE__ */ jsxs31("div", { className: "space-y-3 mt-8", children: [
|
|
2858
|
+
/* @__PURE__ */ jsx42("div", { className: "h-4 bg-gray-200 rounded" }),
|
|
2859
|
+
/* @__PURE__ */ jsx42("div", { className: "h-4 bg-gray-200 rounded w-5/6" }),
|
|
2860
|
+
/* @__PURE__ */ jsx42("div", { className: "h-4 bg-gray-200 rounded w-4/6" })
|
|
2861
|
+
] })
|
|
2862
|
+
] }) });
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
// src/components/docs/header.tsx
|
|
2866
|
+
import Link8 from "next/link";
|
|
2867
|
+
import { Search as Search2, Menu, Github, Twitter, MessageCircle } from "lucide-react";
|
|
2868
|
+
|
|
2869
|
+
// src/components/docs/version-switcher.tsx
|
|
2870
|
+
import { useState as useState15 } from "react";
|
|
2871
|
+
import { Check as Check2, ChevronDown as ChevronDown4 } from "lucide-react";
|
|
2872
|
+
import { useRouter } from "next/navigation";
|
|
2873
|
+
import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2874
|
+
function VersionSwitcher({ currentVersion, versions }) {
|
|
2875
|
+
const [open, setOpen] = useState15(false);
|
|
2876
|
+
const router = useRouter();
|
|
2877
|
+
const handleVersionChange = (version) => {
|
|
2878
|
+
router.push(`/docs/${version}`);
|
|
2879
|
+
setOpen(false);
|
|
2880
|
+
};
|
|
2881
|
+
return /* @__PURE__ */ jsxs32("div", { className: "relative", children: [
|
|
2882
|
+
/* @__PURE__ */ jsxs32(
|
|
2883
|
+
"button",
|
|
2884
|
+
{
|
|
2885
|
+
onClick: () => setOpen(!open),
|
|
2886
|
+
className: "flex items-center gap-2 px-3 py-2 text-sm text-foreground bg-muted rounded-md hover:bg-muted/80 transition-colors",
|
|
2887
|
+
children: [
|
|
2888
|
+
/* @__PURE__ */ jsx43("span", { className: "font-medium", children: currentVersion }),
|
|
2889
|
+
/* @__PURE__ */ jsx43(ChevronDown4, { className: "h-4 w-4" })
|
|
2890
|
+
]
|
|
2891
|
+
}
|
|
2892
|
+
),
|
|
2893
|
+
open && /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
2894
|
+
/* @__PURE__ */ jsx43("div", { className: "fixed inset-0 z-40", onClick: () => setOpen(false) }),
|
|
2895
|
+
/* @__PURE__ */ jsx43("div", { className: "absolute right-0 mt-2 w-48 bg-background border border-border rounded-md shadow-lg z-50", children: /* @__PURE__ */ jsx43("div", { className: "p-2", children: versions.map((version) => /* @__PURE__ */ jsxs32(
|
|
2896
|
+
"button",
|
|
2897
|
+
{
|
|
2898
|
+
onClick: () => handleVersionChange(version),
|
|
2899
|
+
className: "flex items-center justify-between w-full px-3 py-2 text-sm text-foreground hover:bg-muted rounded-md transition-colors",
|
|
2900
|
+
children: [
|
|
2901
|
+
/* @__PURE__ */ jsx43("span", { children: version }),
|
|
2902
|
+
version === currentVersion && /* @__PURE__ */ jsx43(Check2, { className: "h-4 w-4 text-primary" })
|
|
2903
|
+
]
|
|
2904
|
+
},
|
|
2905
|
+
version
|
|
2906
|
+
)) }) })
|
|
2907
|
+
] })
|
|
2908
|
+
] });
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
// src/components/docs/theme-toggle.tsx
|
|
2912
|
+
import { Moon, Sun } from "lucide-react";
|
|
2913
|
+
import { useEffect as useEffect8, useState as useState16 } from "react";
|
|
2914
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
2915
|
+
function ThemeToggle() {
|
|
2916
|
+
const [theme, setTheme] = useState16("dark");
|
|
2917
|
+
useEffect8(() => {
|
|
2918
|
+
const savedTheme = localStorage.getItem("theme");
|
|
2919
|
+
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2920
|
+
const initialTheme = savedTheme || (prefersDark ? "dark" : "light");
|
|
2921
|
+
setTheme(initialTheme);
|
|
2922
|
+
document.documentElement.classList.toggle("dark", initialTheme === "dark");
|
|
2923
|
+
}, []);
|
|
2924
|
+
const toggleTheme = () => {
|
|
2925
|
+
const newTheme = theme === "dark" ? "light" : "dark";
|
|
2926
|
+
setTheme(newTheme);
|
|
2927
|
+
localStorage.setItem("theme", newTheme);
|
|
2928
|
+
document.documentElement.classList.toggle("dark", newTheme === "dark");
|
|
2929
|
+
};
|
|
2930
|
+
return /* @__PURE__ */ jsx44(
|
|
2931
|
+
"button",
|
|
2932
|
+
{
|
|
2933
|
+
onClick: toggleTheme,
|
|
2934
|
+
className: "flex items-center justify-center w-9 h-9 rounded-md border border-border bg-background hover:bg-accent transition-colors",
|
|
2935
|
+
"aria-label": "Toggle theme",
|
|
2936
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx44(Sun, { className: "h-4 w-4 text-foreground" }) : /* @__PURE__ */ jsx44(Moon, { className: "h-4 w-4 text-foreground" })
|
|
2937
|
+
}
|
|
2938
|
+
);
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
// src/components/docs/search-modal.tsx
|
|
2942
|
+
import { useState as useState17, useEffect as useEffect9, useCallback } from "react";
|
|
2943
|
+
import { Search, FileText as FileText2, Loader2 as Loader23 } from "lucide-react";
|
|
2944
|
+
import { useRouter as useRouter2 } from "next/navigation";
|
|
2945
|
+
|
|
2946
|
+
// src/components/ui/dialog.tsx
|
|
2947
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2948
|
+
import { XIcon } from "lucide-react";
|
|
2949
|
+
import { jsx as jsx45, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2950
|
+
function Dialog({
|
|
2951
|
+
...props
|
|
2952
|
+
}) {
|
|
2953
|
+
return /* @__PURE__ */ jsx45(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
2954
|
+
}
|
|
2955
|
+
function DialogTrigger({
|
|
2956
|
+
...props
|
|
2957
|
+
}) {
|
|
2958
|
+
return /* @__PURE__ */ jsx45(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
2959
|
+
}
|
|
2960
|
+
function DialogPortal({
|
|
2961
|
+
...props
|
|
2962
|
+
}) {
|
|
2963
|
+
return /* @__PURE__ */ jsx45(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
2964
|
+
}
|
|
2965
|
+
function DialogClose({
|
|
2966
|
+
...props
|
|
2967
|
+
}) {
|
|
2968
|
+
return /* @__PURE__ */ jsx45(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
2969
|
+
}
|
|
2970
|
+
function DialogOverlay({
|
|
2971
|
+
className,
|
|
2972
|
+
...props
|
|
2973
|
+
}) {
|
|
2974
|
+
return /* @__PURE__ */ jsx45(
|
|
2975
|
+
DialogPrimitive.Overlay,
|
|
2976
|
+
{
|
|
2977
|
+
"data-slot": "dialog-overlay",
|
|
2978
|
+
className: cn(
|
|
2979
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 dark:bg-black/70 backdrop-blur-md",
|
|
2980
|
+
className
|
|
2981
|
+
),
|
|
2982
|
+
...props
|
|
2983
|
+
}
|
|
2984
|
+
);
|
|
2985
|
+
}
|
|
2986
|
+
function DialogContent({
|
|
2987
|
+
className,
|
|
2988
|
+
children,
|
|
2989
|
+
showCloseButton = true,
|
|
2990
|
+
...props
|
|
2991
|
+
}) {
|
|
2992
|
+
return /* @__PURE__ */ jsxs33(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
2993
|
+
/* @__PURE__ */ jsx45(DialogOverlay, {}),
|
|
2994
|
+
/* @__PURE__ */ jsxs33(
|
|
2995
|
+
DialogPrimitive.Content,
|
|
2996
|
+
{
|
|
2997
|
+
"data-slot": "dialog-content",
|
|
2998
|
+
className: cn(
|
|
2999
|
+
"bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
|
|
3000
|
+
className
|
|
3001
|
+
),
|
|
3002
|
+
...props,
|
|
3003
|
+
children: [
|
|
3004
|
+
children,
|
|
3005
|
+
showCloseButton && /* @__PURE__ */ jsxs33(
|
|
3006
|
+
DialogPrimitive.Close,
|
|
3007
|
+
{
|
|
3008
|
+
"data-slot": "dialog-close",
|
|
3009
|
+
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
3010
|
+
children: [
|
|
3011
|
+
/* @__PURE__ */ jsx45(XIcon, {}),
|
|
3012
|
+
/* @__PURE__ */ jsx45("span", { className: "sr-only", children: "Close" })
|
|
3013
|
+
]
|
|
3014
|
+
}
|
|
3015
|
+
)
|
|
3016
|
+
]
|
|
3017
|
+
}
|
|
3018
|
+
)
|
|
3019
|
+
] });
|
|
3020
|
+
}
|
|
3021
|
+
function DialogHeader({ className, ...props }) {
|
|
3022
|
+
return /* @__PURE__ */ jsx45(
|
|
3023
|
+
"div",
|
|
3024
|
+
{
|
|
3025
|
+
"data-slot": "dialog-header",
|
|
3026
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
3027
|
+
...props
|
|
3028
|
+
}
|
|
3029
|
+
);
|
|
3030
|
+
}
|
|
3031
|
+
function DialogFooter({ className, ...props }) {
|
|
3032
|
+
return /* @__PURE__ */ jsx45(
|
|
3033
|
+
"div",
|
|
3034
|
+
{
|
|
3035
|
+
"data-slot": "dialog-footer",
|
|
3036
|
+
className: cn(
|
|
3037
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
3038
|
+
className
|
|
3039
|
+
),
|
|
3040
|
+
...props
|
|
3041
|
+
}
|
|
3042
|
+
);
|
|
3043
|
+
}
|
|
3044
|
+
function DialogTitle({
|
|
3045
|
+
className,
|
|
3046
|
+
...props
|
|
3047
|
+
}) {
|
|
3048
|
+
return /* @__PURE__ */ jsx45(
|
|
3049
|
+
DialogPrimitive.Title,
|
|
3050
|
+
{
|
|
3051
|
+
"data-slot": "dialog-title",
|
|
3052
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
3053
|
+
...props
|
|
3054
|
+
}
|
|
3055
|
+
);
|
|
3056
|
+
}
|
|
3057
|
+
function DialogDescription({
|
|
3058
|
+
className,
|
|
3059
|
+
...props
|
|
3060
|
+
}) {
|
|
3061
|
+
return /* @__PURE__ */ jsx45(
|
|
3062
|
+
DialogPrimitive.Description,
|
|
3063
|
+
{
|
|
3064
|
+
"data-slot": "dialog-description",
|
|
3065
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
3066
|
+
...props
|
|
3067
|
+
}
|
|
3068
|
+
);
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
// src/components/docs/search-modal.tsx
|
|
3072
|
+
import { Fragment as Fragment7, jsx as jsx46, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3073
|
+
function SearchModal({ isOpen, onClose, config }) {
|
|
3074
|
+
const [query, setQuery] = useState17("");
|
|
3075
|
+
const [results, setResults] = useState17([]);
|
|
3076
|
+
const [isLoading, setIsLoading] = useState17(false);
|
|
3077
|
+
const [selectedIndex, setSelectedIndex] = useState17(0);
|
|
3078
|
+
const router = useRouter2();
|
|
3079
|
+
const searchConfig = config.search;
|
|
3080
|
+
const performSearch = useCallback(async (searchQuery) => {
|
|
3081
|
+
if (!searchQuery.trim() || !searchConfig?.enabled) {
|
|
3082
|
+
setResults([]);
|
|
3083
|
+
return;
|
|
3084
|
+
}
|
|
3085
|
+
setIsLoading(true);
|
|
3086
|
+
try {
|
|
3087
|
+
const response = await fetch("/api/search", {
|
|
3088
|
+
method: "POST",
|
|
3089
|
+
headers: { "Content-Type": "application/json" },
|
|
3090
|
+
body: JSON.stringify({
|
|
3091
|
+
query: searchQuery,
|
|
3092
|
+
// filter: 'version = "v1.0.0"',
|
|
3093
|
+
distinct: "version",
|
|
3094
|
+
limit: 2
|
|
3095
|
+
})
|
|
3096
|
+
});
|
|
3097
|
+
if (response.ok) {
|
|
3098
|
+
const data = await response.json();
|
|
3099
|
+
console.log("Search response:", data);
|
|
3100
|
+
setResults(data.hits || []);
|
|
3101
|
+
} else {
|
|
3102
|
+
console.error("Search failed:", response.status, await response.text());
|
|
3103
|
+
}
|
|
3104
|
+
} catch (error) {
|
|
3105
|
+
console.error("Search error:", error);
|
|
3106
|
+
setResults([]);
|
|
3107
|
+
} finally {
|
|
3108
|
+
setIsLoading(false);
|
|
3109
|
+
}
|
|
3110
|
+
}, [searchConfig]);
|
|
3111
|
+
useEffect9(() => {
|
|
3112
|
+
const timer = setTimeout(() => {
|
|
3113
|
+
performSearch(query);
|
|
3114
|
+
}, 300);
|
|
3115
|
+
return () => clearTimeout(timer);
|
|
3116
|
+
}, [query, performSearch]);
|
|
3117
|
+
useEffect9(() => {
|
|
3118
|
+
const handleKeyDown = (e) => {
|
|
3119
|
+
if (!isOpen) return;
|
|
3120
|
+
switch (e.key) {
|
|
3121
|
+
case "Escape":
|
|
3122
|
+
onClose();
|
|
3123
|
+
break;
|
|
3124
|
+
case "ArrowDown":
|
|
3125
|
+
e.preventDefault();
|
|
3126
|
+
setSelectedIndex((prev) => Math.min(prev + 1, results.length - 1));
|
|
3127
|
+
break;
|
|
3128
|
+
case "ArrowUp":
|
|
3129
|
+
e.preventDefault();
|
|
3130
|
+
setSelectedIndex((prev) => Math.max(prev - 1, 0));
|
|
3131
|
+
break;
|
|
3132
|
+
case "Enter":
|
|
3133
|
+
e.preventDefault();
|
|
3134
|
+
if (results[selectedIndex]) {
|
|
3135
|
+
handleResultClick(results[selectedIndex]);
|
|
3136
|
+
}
|
|
3137
|
+
break;
|
|
3138
|
+
}
|
|
3139
|
+
};
|
|
3140
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
3141
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
3142
|
+
}, [isOpen, results, selectedIndex, onClose]);
|
|
3143
|
+
useEffect9(() => {
|
|
3144
|
+
if (isOpen) {
|
|
3145
|
+
setQuery("");
|
|
3146
|
+
setResults([]);
|
|
3147
|
+
setSelectedIndex(0);
|
|
3148
|
+
}
|
|
3149
|
+
}, [isOpen]);
|
|
3150
|
+
const handleResultClick = (result) => {
|
|
3151
|
+
const url = `/docs/${result.version}/${result.slug}?q=${encodeURIComponent(query)}`;
|
|
3152
|
+
router.push(url);
|
|
3153
|
+
onClose();
|
|
3154
|
+
};
|
|
3155
|
+
const highlightText = (text, query2) => {
|
|
3156
|
+
if (!query2.trim()) return text;
|
|
3157
|
+
const parts = text.split(new RegExp(`(${query2})`, "gi"));
|
|
3158
|
+
return parts.map(
|
|
3159
|
+
(part, i) => part.toLowerCase() === query2.toLowerCase() ? /* @__PURE__ */ jsx46("mark", { className: "bg-yellow-200 dark:bg-yellow-900/50 text-foreground", children: part }, i) : part
|
|
3160
|
+
);
|
|
3161
|
+
};
|
|
3162
|
+
return /* @__PURE__ */ jsx46(Dialog, { open: isOpen, onOpenChange: onClose, modal: true, children: /* @__PURE__ */ jsxs34(
|
|
3163
|
+
DialogContent,
|
|
3164
|
+
{
|
|
3165
|
+
className: "max-w-2xl p-0 gap-0 top-[10vh] translate-y-0",
|
|
3166
|
+
showCloseButton: false,
|
|
3167
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
3168
|
+
children: [
|
|
3169
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-3 px-4 py-3 border-b border-border", children: [
|
|
3170
|
+
/* @__PURE__ */ jsx46(Search, { className: "h-5 w-5 text-muted-foreground shrink-0" }),
|
|
3171
|
+
/* @__PURE__ */ jsx46(
|
|
3172
|
+
"input",
|
|
3173
|
+
{
|
|
3174
|
+
type: "text",
|
|
3175
|
+
value: query,
|
|
3176
|
+
onChange: (e) => setQuery(e.target.value),
|
|
3177
|
+
placeholder: searchConfig?.placeholder || "Search documentation...",
|
|
3178
|
+
className: "flex-1 bg-transparent border-none outline-none text-foreground placeholder:text-muted-foreground",
|
|
3179
|
+
autoFocus: true
|
|
3180
|
+
}
|
|
3181
|
+
),
|
|
3182
|
+
isLoading && /* @__PURE__ */ jsx46(Loader23, { className: "h-5 w-5 text-muted-foreground animate-spin" })
|
|
3183
|
+
] }),
|
|
3184
|
+
/* @__PURE__ */ jsxs34("div", { className: "max-h-[60vh] overflow-y-auto", children: [
|
|
3185
|
+
query.trim() && results.length === 0 && !isLoading && /* @__PURE__ */ jsxs34("div", { className: "px-4 py-8 text-center text-muted-foreground", children: [
|
|
3186
|
+
'No results found for "',
|
|
3187
|
+
query,
|
|
3188
|
+
'"'
|
|
3189
|
+
] }),
|
|
3190
|
+
results.length > 0 && /* @__PURE__ */ jsx46("div", { className: "py-2", children: results.map((result, index) => /* @__PURE__ */ jsx46(
|
|
3191
|
+
"button",
|
|
3192
|
+
{
|
|
3193
|
+
onClick: () => handleResultClick(result),
|
|
3194
|
+
className: `w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-l-2 ${index === selectedIndex ? "bg-muted/50 border-primary" : "border-transparent"}`,
|
|
3195
|
+
onMouseEnter: () => setSelectedIndex(index),
|
|
3196
|
+
children: /* @__PURE__ */ jsxs34("div", { className: "flex items-start gap-3", children: [
|
|
3197
|
+
/* @__PURE__ */ jsx46(FileText2, { className: "h-5 w-5 text-muted-foreground shrink-0 mt-0.5" }),
|
|
3198
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex-1 min-w-0", children: [
|
|
3199
|
+
/* @__PURE__ */ jsx46("div", { className: "font-medium text-foreground mb-1", children: highlightText(result.title, query) }),
|
|
3200
|
+
result.content && /* @__PURE__ */ jsx46("div", { className: "text-sm text-muted-foreground line-clamp-2", children: highlightText(result.content, query) }),
|
|
3201
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-2 mt-1 text-xs text-muted-foreground", children: [
|
|
3202
|
+
/* @__PURE__ */ jsx46("span", { children: result.version }),
|
|
3203
|
+
result.category && /* @__PURE__ */ jsxs34(Fragment7, { children: [
|
|
3204
|
+
/* @__PURE__ */ jsx46("span", { children: "\u2022" }),
|
|
3205
|
+
/* @__PURE__ */ jsx46("span", { children: result.category })
|
|
3206
|
+
] })
|
|
3207
|
+
] })
|
|
3208
|
+
] })
|
|
3209
|
+
] })
|
|
3210
|
+
},
|
|
3211
|
+
result.id
|
|
3212
|
+
)) }),
|
|
3213
|
+
!query.trim() && /* @__PURE__ */ jsxs34("div", { className: "px-4 py-8 text-center text-muted-foreground text-sm", children: [
|
|
3214
|
+
/* @__PURE__ */ jsx46("p", { children: "Start typing to search documentation..." }),
|
|
3215
|
+
/* @__PURE__ */ jsxs34("div", { className: "mt-4 flex items-center justify-center gap-4 text-xs", children: [
|
|
3216
|
+
/* @__PURE__ */ jsx46("kbd", { className: "px-2 py-1 bg-muted rounded border border-border", children: "\u2191\u2193" }),
|
|
3217
|
+
/* @__PURE__ */ jsx46("span", { children: "Navigate" }),
|
|
3218
|
+
/* @__PURE__ */ jsx46("kbd", { className: "px-2 py-1 bg-muted rounded border border-border", children: "Enter" }),
|
|
3219
|
+
/* @__PURE__ */ jsx46("span", { children: "Select" }),
|
|
3220
|
+
/* @__PURE__ */ jsx46("kbd", { className: "px-2 py-1 bg-muted rounded border border-border", children: "Esc" }),
|
|
3221
|
+
/* @__PURE__ */ jsx46("span", { children: "Close" })
|
|
3222
|
+
] })
|
|
3223
|
+
] })
|
|
3224
|
+
] })
|
|
3225
|
+
]
|
|
3226
|
+
}
|
|
3227
|
+
) });
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
// src/components/docs/header.tsx
|
|
3231
|
+
import { useState as useState18, useEffect as useEffect10 } from "react";
|
|
3232
|
+
import { jsx as jsx47, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3233
|
+
function Header({ currentVersion, versions, onMenuClick, config }) {
|
|
3234
|
+
const [searchOpen, setSearchOpen] = useState18(false);
|
|
3235
|
+
useEffect10(() => {
|
|
3236
|
+
const handleKeyDown = (e) => {
|
|
3237
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "k") {
|
|
3238
|
+
e.preventDefault();
|
|
3239
|
+
setSearchOpen(true);
|
|
3240
|
+
}
|
|
3241
|
+
};
|
|
3242
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
3243
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
3244
|
+
}, []);
|
|
3245
|
+
return /* @__PURE__ */ jsxs35("header", { className: "sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-backdrop-filter:bg-background/60", children: [
|
|
3246
|
+
/* @__PURE__ */ jsxs35("div", { className: "container flex h-16 items-center justify-between px-6 mx-auto", children: [
|
|
3247
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2", children: [
|
|
3248
|
+
/* @__PURE__ */ jsx47(
|
|
3249
|
+
"button",
|
|
3250
|
+
{
|
|
3251
|
+
onClick: onMenuClick,
|
|
3252
|
+
className: "lg:hidden hover:bg-muted p-2 rounded-md transition-colors",
|
|
3253
|
+
"aria-label": "Toggle menu",
|
|
3254
|
+
children: /* @__PURE__ */ jsx47(Menu, { className: "h-5 w-5" })
|
|
3255
|
+
}
|
|
3256
|
+
),
|
|
3257
|
+
/* @__PURE__ */ jsxs35(Link8, { href: "/", className: "flex items-center gap-2", children: [
|
|
3258
|
+
config.site.logo ? /* @__PURE__ */ jsx47("img", { src: getAssetPath(config.site.logo), alt: config.site.title, className: "h-8 w-auto" }) : /* @__PURE__ */ jsx47("div", { className: "h-8 w-8 rounded-xl bg-primary flex items-center justify-center", children: /* @__PURE__ */ jsx47("span", { className: "text-primary-foreground font-bold text-lg", children: config.site.title.charAt(0).toUpperCase() }) }),
|
|
3259
|
+
/* @__PURE__ */ jsx47("span", { className: "font-semibold text-lg text-foreground", children: "Specra" })
|
|
3260
|
+
] })
|
|
3261
|
+
] }),
|
|
3262
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2", children: [
|
|
3263
|
+
config.search?.enabled && /* @__PURE__ */ jsxs35(
|
|
3264
|
+
"button",
|
|
3265
|
+
{
|
|
3266
|
+
onClick: () => setSearchOpen(true),
|
|
3267
|
+
className: "flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground hover:text-foreground bg-muted rounded-md transition-colors",
|
|
3268
|
+
children: [
|
|
3269
|
+
/* @__PURE__ */ jsx47(Search2, { className: "h-4 w-4" }),
|
|
3270
|
+
/* @__PURE__ */ jsx47("span", { className: "hidden sm:inline", children: config.search.placeholder || "Search" }),
|
|
3271
|
+
/* @__PURE__ */ jsx47("kbd", { className: "hidden sm:inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-background px-1.5 font-mono text-xs font-medium", children: "\u2318K" })
|
|
3272
|
+
]
|
|
3273
|
+
}
|
|
3274
|
+
),
|
|
3275
|
+
config.features?.versioning && /* @__PURE__ */ jsx47(VersionSwitcher, { currentVersion, versions }),
|
|
3276
|
+
config.social?.github && /* @__PURE__ */ jsx47(
|
|
3277
|
+
"a",
|
|
3278
|
+
{
|
|
3279
|
+
href: config.social.github,
|
|
3280
|
+
target: "_blank",
|
|
3281
|
+
rel: "noopener noreferrer",
|
|
3282
|
+
className: "hidden md:flex items-center justify-center h-9 w-9 rounded-md hover:bg-muted transition-colors",
|
|
3283
|
+
"aria-label": "GitHub",
|
|
3284
|
+
children: /* @__PURE__ */ jsx47(Github, { className: "h-4 w-4" })
|
|
3285
|
+
}
|
|
3286
|
+
),
|
|
3287
|
+
config.social?.twitter && /* @__PURE__ */ jsx47(
|
|
3288
|
+
"a",
|
|
3289
|
+
{
|
|
3290
|
+
href: config.social.twitter,
|
|
3291
|
+
target: "_blank",
|
|
3292
|
+
rel: "noopener noreferrer",
|
|
3293
|
+
className: "hidden md:flex items-center justify-center h-9 w-9 rounded-md hover:bg-muted transition-colors",
|
|
3294
|
+
"aria-label": "Twitter",
|
|
3295
|
+
children: /* @__PURE__ */ jsx47(Twitter, { className: "h-4 w-4" })
|
|
3296
|
+
}
|
|
3297
|
+
),
|
|
3298
|
+
config.social?.discord && /* @__PURE__ */ jsx47(
|
|
3299
|
+
"a",
|
|
3300
|
+
{
|
|
3301
|
+
href: config.social.discord,
|
|
3302
|
+
target: "_blank",
|
|
3303
|
+
rel: "noopener noreferrer",
|
|
3304
|
+
className: "hidden md:flex items-center justify-center h-9 w-9 rounded-md hover:bg-muted transition-colors",
|
|
3305
|
+
"aria-label": "Discord",
|
|
3306
|
+
children: /* @__PURE__ */ jsx47(MessageCircle, { className: "h-4 w-4" })
|
|
3307
|
+
}
|
|
3308
|
+
),
|
|
3309
|
+
/* @__PURE__ */ jsx47(ThemeToggle, {})
|
|
3310
|
+
] })
|
|
3311
|
+
] }),
|
|
3312
|
+
/* @__PURE__ */ jsx47(SearchModal, { isOpen: searchOpen, onClose: () => setSearchOpen(false), config })
|
|
3313
|
+
] });
|
|
3314
|
+
}
|
|
3315
|
+
|
|
3316
|
+
// src/components/docs/hot-reload-indicator.tsx
|
|
3317
|
+
import { useEffect as useEffect11, useState as useState19 } from "react";
|
|
3318
|
+
import { usePathname as usePathname2 } from "next/navigation";
|
|
3319
|
+
import { RefreshCw } from "lucide-react";
|
|
3320
|
+
import { Fragment as Fragment8, jsx as jsx48, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3321
|
+
function HotReloadIndicator() {
|
|
3322
|
+
const [isReloading, setIsReloading] = useState19(false);
|
|
3323
|
+
const [lastReload, setLastReload] = useState19(null);
|
|
3324
|
+
const pathname = usePathname2();
|
|
3325
|
+
useEffect11(() => {
|
|
3326
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
3327
|
+
setIsReloading(true);
|
|
3328
|
+
const timer = setTimeout(() => {
|
|
3329
|
+
setIsReloading(false);
|
|
3330
|
+
setLastReload(/* @__PURE__ */ new Date());
|
|
3331
|
+
setTimeout(() => {
|
|
3332
|
+
setLastReload(null);
|
|
3333
|
+
}, 3e3);
|
|
3334
|
+
}, 500);
|
|
3335
|
+
return () => clearTimeout(timer);
|
|
3336
|
+
}, [pathname]);
|
|
3337
|
+
useEffect11(() => {
|
|
3338
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
3339
|
+
const handleBeforeRefresh = () => {
|
|
3340
|
+
setIsReloading(true);
|
|
3341
|
+
};
|
|
3342
|
+
const handleAfterRefresh = () => {
|
|
3343
|
+
setIsReloading(false);
|
|
3344
|
+
setLastReload(/* @__PURE__ */ new Date());
|
|
3345
|
+
setTimeout(() => setLastReload(null), 3e3);
|
|
3346
|
+
};
|
|
3347
|
+
if (typeof window !== "undefined" && window.__NEXT_DATA__) {
|
|
3348
|
+
window.addEventListener("beforeunload", handleBeforeRefresh);
|
|
3349
|
+
}
|
|
3350
|
+
return () => {
|
|
3351
|
+
window.removeEventListener("beforeunload", handleBeforeRefresh);
|
|
3352
|
+
};
|
|
3353
|
+
}, []);
|
|
3354
|
+
if (process.env.NODE_ENV !== "development") return null;
|
|
3355
|
+
return /* @__PURE__ */ jsxs36(Fragment8, { children: [
|
|
3356
|
+
isReloading && /* @__PURE__ */ jsxs36("div", { className: "fixed bottom-4 right-4 z-50 flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-xl shadow-lg animate-in slide-in-from-bottom-2", children: [
|
|
3357
|
+
/* @__PURE__ */ jsx48(RefreshCw, { className: "h-4 w-4 animate-spin" }),
|
|
3358
|
+
/* @__PURE__ */ jsx48("span", { className: "text-sm font-medium", children: "Reloading..." })
|
|
3359
|
+
] }),
|
|
3360
|
+
lastReload && !isReloading && /* @__PURE__ */ jsxs36("div", { className: "fixed bottom-4 right-4 z-50 flex items-center gap-2 px-4 py-2 bg-green-500 text-white rounded-xl shadow-lg animate-in slide-in-from-bottom-2", children: [
|
|
3361
|
+
/* @__PURE__ */ jsx48(RefreshCw, { className: "h-4 w-4" }),
|
|
3362
|
+
/* @__PURE__ */ jsxs36("span", { className: "text-sm font-medium", children: [
|
|
3363
|
+
"Updated at ",
|
|
3364
|
+
lastReload.toLocaleTimeString()
|
|
3365
|
+
] })
|
|
3366
|
+
] })
|
|
3367
|
+
] });
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
// src/components/docs/mdx-hot-reload.tsx
|
|
3371
|
+
import { useEffect as useEffect12 } from "react";
|
|
3372
|
+
import { useRouter as useRouter3 } from "next/navigation";
|
|
3373
|
+
function MdxHotReload() {
|
|
3374
|
+
const router = useRouter3();
|
|
3375
|
+
useEffect12(() => {
|
|
3376
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
3377
|
+
const eventSource = new EventSource("/api/mdx-watch");
|
|
3378
|
+
eventSource.onmessage = (event) => {
|
|
3379
|
+
const data = JSON.parse(event.data);
|
|
3380
|
+
if (data.type === "change") {
|
|
3381
|
+
console.log("[MDX Hot Reload] File changed:", data.file);
|
|
3382
|
+
router.refresh();
|
|
3383
|
+
} else if (data.type === "connected") {
|
|
3384
|
+
console.log("[MDX Hot Reload] Watching for changes...");
|
|
3385
|
+
}
|
|
3386
|
+
};
|
|
3387
|
+
eventSource.onerror = (error) => {
|
|
3388
|
+
console.error("[MDX Hot Reload] Connection error:", error);
|
|
3389
|
+
eventSource.close();
|
|
3390
|
+
};
|
|
3391
|
+
return () => {
|
|
3392
|
+
eventSource.close();
|
|
3393
|
+
};
|
|
3394
|
+
}, [router]);
|
|
3395
|
+
return null;
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
// src/components/docs/not-found-content.tsx
|
|
3399
|
+
import Link9 from "next/link";
|
|
3400
|
+
import { AlertTriangle as AlertTriangle2, Home, ArrowLeft } from "lucide-react";
|
|
3401
|
+
import { jsx as jsx49, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3402
|
+
function NotFoundContent({ version }) {
|
|
3403
|
+
return /* @__PURE__ */ jsx49("div", { className: "flex min-h-[calc(100vh-12rem)] items-center justify-center px-4 py-12", children: /* @__PURE__ */ jsxs37("div", { className: "w-full max-w-2xl text-center", children: [
|
|
3404
|
+
/* @__PURE__ */ jsx49("div", { className: "mb-6 flex justify-center", children: /* @__PURE__ */ jsx49("div", { className: "rounded-full bg-yellow-500/10 p-4", children: /* @__PURE__ */ jsx49(AlertTriangle2, { className: "h-16 w-16 text-yellow-500" }) }) }),
|
|
3405
|
+
/* @__PURE__ */ jsx49("h1", { className: "mb-3 text-5xl font-bold tracking-tight", children: "404" }),
|
|
3406
|
+
/* @__PURE__ */ jsx49("h2", { className: "mb-4 text-2xl font-semibold", children: "Page Not Found" }),
|
|
3407
|
+
/* @__PURE__ */ jsxs37("p", { className: "mb-8 text-base text-muted-foreground", children: [
|
|
3408
|
+
"The documentation page you're looking for doesn't exist or may have been moved.",
|
|
3409
|
+
/* @__PURE__ */ jsx49("br", {}),
|
|
3410
|
+
"Try using the sidebar to find what you're looking for, or return to the documentation home."
|
|
3411
|
+
] }),
|
|
3412
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex flex-col items-center justify-center gap-3 sm:flex-row", children: [
|
|
3413
|
+
/* @__PURE__ */ jsxs37(
|
|
3414
|
+
Link9,
|
|
3415
|
+
{
|
|
3416
|
+
href: `/docs/${version}`,
|
|
3417
|
+
className: "inline-flex items-center gap-2 rounded-lg bg-primary px-6 py-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",
|
|
3418
|
+
children: [
|
|
3419
|
+
/* @__PURE__ */ jsx49(ArrowLeft, { className: "h-4 w-4" }),
|
|
3420
|
+
"Back to Documentation"
|
|
3421
|
+
]
|
|
3422
|
+
}
|
|
3423
|
+
),
|
|
3424
|
+
/* @__PURE__ */ jsxs37(
|
|
3425
|
+
Link9,
|
|
3426
|
+
{
|
|
3427
|
+
href: "/",
|
|
3428
|
+
className: "inline-flex items-center gap-2 rounded-lg border border-border bg-background px-6 py-3 text-sm font-medium hover:bg-muted transition-colors",
|
|
3429
|
+
children: [
|
|
3430
|
+
/* @__PURE__ */ jsx49(Home, { className: "h-4 w-4" }),
|
|
3431
|
+
"Go to Homepage"
|
|
3432
|
+
]
|
|
3433
|
+
}
|
|
3434
|
+
)
|
|
3435
|
+
] }),
|
|
3436
|
+
/* @__PURE__ */ jsx49("div", { className: "mt-12 rounded-lg border border-border bg-muted/30 p-6", children: /* @__PURE__ */ jsxs37("p", { className: "text-sm text-muted-foreground", children: [
|
|
3437
|
+
/* @__PURE__ */ jsx49("strong", { className: "font-medium text-foreground", children: "Tip:" }),
|
|
3438
|
+
" Use the sidebar navigation on the left to browse all available documentation pages."
|
|
3439
|
+
] }) })
|
|
3440
|
+
] }) });
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
// src/components/docs/sidebar-skeleton.tsx
|
|
3444
|
+
import { jsx as jsx50, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3445
|
+
function SidebarSkeleton() {
|
|
3446
|
+
return /* @__PURE__ */ jsx50("aside", { className: "w-64 pr-8 py-6", children: /* @__PURE__ */ jsxs38("div", { className: "space-y-6", children: [
|
|
3447
|
+
/* @__PURE__ */ jsx50("div", { className: "px-2", children: /* @__PURE__ */ jsx50("div", { className: "h-5 w-32 bg-muted/50 rounded animate-pulse" }) }),
|
|
3448
|
+
/* @__PURE__ */ jsx50("div", { className: "space-y-1", children: [...Array(8)].map((_, i) => /* @__PURE__ */ jsx50("div", { className: "px-3 py-2", children: /* @__PURE__ */ jsx50(
|
|
3449
|
+
"div",
|
|
3450
|
+
{
|
|
3451
|
+
className: "h-4 bg-muted/50 rounded animate-pulse",
|
|
3452
|
+
style: { width: `${60 + Math.random() * 40}%` }
|
|
3453
|
+
}
|
|
3454
|
+
) }, i)) }),
|
|
3455
|
+
/* @__PURE__ */ jsxs38("div", { className: "space-y-1", children: [
|
|
3456
|
+
/* @__PURE__ */ jsx50("div", { className: "px-2 mb-2", children: /* @__PURE__ */ jsx50("div", { className: "h-4 w-24 bg-muted/50 rounded animate-pulse" }) }),
|
|
3457
|
+
[...Array(5)].map((_, i) => /* @__PURE__ */ jsx50("div", { className: "px-3 py-2", children: /* @__PURE__ */ jsx50(
|
|
3458
|
+
"div",
|
|
3459
|
+
{
|
|
3460
|
+
className: "h-4 bg-muted/50 rounded animate-pulse",
|
|
3461
|
+
style: { width: `${50 + Math.random() * 50}%` }
|
|
3462
|
+
}
|
|
3463
|
+
) }, i))
|
|
3464
|
+
] })
|
|
3465
|
+
] }) });
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
// src/components/docs/table-of-contents.tsx
|
|
3469
|
+
import { useEffect as useEffect13, useState as useState20 } from "react";
|
|
3470
|
+
import { jsx as jsx51, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3471
|
+
function TableOfContents({ items, config }) {
|
|
3472
|
+
const [activeId, setActiveId] = useState20("");
|
|
3473
|
+
if (!config.navigation?.showTableOfContents) {
|
|
3474
|
+
return null;
|
|
3475
|
+
}
|
|
3476
|
+
const maxDepth = config.navigation?.tocMaxDepth || 3;
|
|
3477
|
+
const filteredItems = items.filter((item) => item.level <= maxDepth);
|
|
3478
|
+
const hasTabGroups = config.navigation?.tabGroups && config.navigation.tabGroups.length > 0;
|
|
3479
|
+
useEffect13(() => {
|
|
3480
|
+
const observer = new IntersectionObserver(
|
|
3481
|
+
(entries) => {
|
|
3482
|
+
entries.forEach((entry) => {
|
|
3483
|
+
if (entry.isIntersecting) {
|
|
3484
|
+
setActiveId(entry.target.id);
|
|
3485
|
+
}
|
|
3486
|
+
});
|
|
3487
|
+
},
|
|
3488
|
+
{ rootMargin: "-80px 0px -80% 0px" }
|
|
3489
|
+
);
|
|
3490
|
+
filteredItems.forEach((item) => {
|
|
3491
|
+
const element = document.getElementById(item.id);
|
|
3492
|
+
if (element) {
|
|
3493
|
+
observer.observe(element);
|
|
3494
|
+
}
|
|
3495
|
+
});
|
|
3496
|
+
return () => observer.disconnect();
|
|
3497
|
+
}, [filteredItems]);
|
|
3498
|
+
const handleClick = (e, id) => {
|
|
3499
|
+
e.preventDefault();
|
|
3500
|
+
const element = document.getElementById(id);
|
|
3501
|
+
if (element) {
|
|
3502
|
+
const offset = 100;
|
|
3503
|
+
const elementPosition = element.getBoundingClientRect().top;
|
|
3504
|
+
const offsetPosition = elementPosition + window.scrollY - offset;
|
|
3505
|
+
window.scrollTo({
|
|
3506
|
+
top: offsetPosition,
|
|
3507
|
+
behavior: "smooth"
|
|
3508
|
+
});
|
|
3509
|
+
window.history.replaceState(null, "", `#${id}`);
|
|
3510
|
+
setActiveId(id);
|
|
3511
|
+
}
|
|
3512
|
+
};
|
|
3513
|
+
const stickyTop = hasTabGroups ? "top-[7.5rem]" : "top-24";
|
|
3514
|
+
const maxHeight = hasTabGroups ? "max-h-[calc(100vh-10rem)]" : "max-h-[calc(100vh-7rem)]";
|
|
3515
|
+
return /* @__PURE__ */ jsx51("aside", { className: `w-64 hidden xl:block shrink-0 sticky ${stickyTop} self-start`, children: filteredItems.length > 0 && /* @__PURE__ */ jsxs39("div", { className: `${maxHeight} overflow-y-auto bg-muted/30 dark:bg-muted/10 rounded-2xl p-4 border border-border/50`, children: [
|
|
3516
|
+
/* @__PURE__ */ jsx51("h3", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-4 px-2", children: "On this page" }),
|
|
3517
|
+
/* @__PURE__ */ jsx51("nav", { className: "space-y-1", children: filteredItems.map((item) => /* @__PURE__ */ jsx51(
|
|
3518
|
+
"a",
|
|
3519
|
+
{
|
|
3520
|
+
href: `#${item.id}`,
|
|
3521
|
+
onClick: (e) => handleClick(e, item.id),
|
|
3522
|
+
className: `block text-sm transition-all cursor-pointer rounded-xl px-3 py-2 ${item.level === 3 ? "ml-3" : ""} ${activeId === item.id ? "text-primary font-medium" : "text-foreground hover:bg-accent/50"}`,
|
|
3523
|
+
children: item.title
|
|
3524
|
+
},
|
|
3525
|
+
item.id
|
|
3526
|
+
)) })
|
|
3527
|
+
] }) });
|
|
3528
|
+
}
|
|
3529
|
+
|
|
3530
|
+
// src/components/global/version-not-found.tsx
|
|
3531
|
+
import { AlertTriangle as AlertTriangle3 } from "lucide-react";
|
|
3532
|
+
import Link10 from "next/link";
|
|
3533
|
+
import { Fragment as Fragment9, jsx as jsx52, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3534
|
+
function VersionNotFound() {
|
|
3535
|
+
return /* @__PURE__ */ jsx52(Fragment9, { children: /* @__PURE__ */ jsx52("div", { className: "flex min-h-screen items-center justify-center px-4", children: /* @__PURE__ */ jsxs40("div", { className: "text-center", children: [
|
|
3536
|
+
/* @__PURE__ */ jsx52("div", { className: "mb-4 flex justify-center", children: /* @__PURE__ */ jsx52(AlertTriangle3, { className: "h-16 w-16 text-yellow-500" }) }),
|
|
3537
|
+
/* @__PURE__ */ jsx52("h1", { className: "mb-2 text-4xl font-bold", children: "Version Not Found" }),
|
|
3538
|
+
/* @__PURE__ */ jsx52("p", { className: "mb-6 text-muted-foreground", children: "The documentation version you're looking for doesn't exist." }),
|
|
3539
|
+
/* @__PURE__ */ jsx52(
|
|
3540
|
+
Link10,
|
|
3541
|
+
{
|
|
3542
|
+
href: "/docs/v1.0.0",
|
|
3543
|
+
className: "inline-flex items-center rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90",
|
|
3544
|
+
children: "Go to Latest Version"
|
|
3545
|
+
}
|
|
3546
|
+
)
|
|
3547
|
+
] }) }) });
|
|
3548
|
+
}
|
|
3549
|
+
export {
|
|
3550
|
+
Accordion,
|
|
3551
|
+
AccordionItem,
|
|
3552
|
+
ApiEndpoint,
|
|
3553
|
+
ApiParams,
|
|
3554
|
+
ApiPlayground,
|
|
3555
|
+
ApiReference,
|
|
3556
|
+
ApiResponse,
|
|
3557
|
+
ApiResponse as ApiResponseDisplay,
|
|
3558
|
+
Badge2 as Badge,
|
|
3559
|
+
Breadcrumb,
|
|
3560
|
+
Button,
|
|
3561
|
+
COMPONENT_TEXT_PROPS,
|
|
3562
|
+
Callout,
|
|
3563
|
+
Card,
|
|
3564
|
+
CardGrid,
|
|
3565
|
+
CategoryIndex,
|
|
3566
|
+
CodeBlock,
|
|
3567
|
+
Column,
|
|
3568
|
+
Columns,
|
|
3569
|
+
DevModeBadge,
|
|
3570
|
+
Dialog,
|
|
3571
|
+
DialogClose,
|
|
3572
|
+
DialogContent,
|
|
3573
|
+
DialogDescription,
|
|
3574
|
+
DialogFooter,
|
|
3575
|
+
DialogHeader,
|
|
3576
|
+
DialogOverlay,
|
|
3577
|
+
DialogPortal,
|
|
3578
|
+
DialogTitle,
|
|
3579
|
+
DialogTrigger,
|
|
3580
|
+
Badge as DocBadge,
|
|
3581
|
+
DocLayout,
|
|
3582
|
+
DocLayoutWrapper,
|
|
3583
|
+
DocLoading,
|
|
3584
|
+
DocMetadata,
|
|
3585
|
+
DocNavigation,
|
|
3586
|
+
DocTags,
|
|
3587
|
+
DraftBadge,
|
|
3588
|
+
Footer,
|
|
3589
|
+
Frame,
|
|
3590
|
+
Header,
|
|
3591
|
+
HotReloadIndicator,
|
|
3592
|
+
Icon,
|
|
3593
|
+
Image,
|
|
3594
|
+
ImageCard,
|
|
3595
|
+
ImageCardGrid,
|
|
3596
|
+
Input,
|
|
3597
|
+
Math2 as Math,
|
|
3598
|
+
MdxHotReload,
|
|
3599
|
+
Mermaid,
|
|
3600
|
+
MobileDocLayout,
|
|
3601
|
+
NotFoundContent,
|
|
3602
|
+
SearchHighlight,
|
|
3603
|
+
SearchModal,
|
|
3604
|
+
Sidebar,
|
|
3605
|
+
SidebarSkeleton,
|
|
3606
|
+
SiteBanner,
|
|
3607
|
+
Step,
|
|
3608
|
+
Steps,
|
|
3609
|
+
Tab,
|
|
3610
|
+
TabGroups,
|
|
3611
|
+
TabProvider,
|
|
3612
|
+
TableOfContents,
|
|
3613
|
+
Tabs,
|
|
3614
|
+
Textarea,
|
|
3615
|
+
ThemeToggle,
|
|
3616
|
+
Tooltip,
|
|
3617
|
+
VersionNotFound,
|
|
3618
|
+
VersionSwitcher,
|
|
3619
|
+
Video,
|
|
3620
|
+
badgeVariants,
|
|
3621
|
+
buttonVariants,
|
|
3622
|
+
extractComponentPropsText,
|
|
3623
|
+
extractSearchText,
|
|
3624
|
+
mdxComponents,
|
|
3625
|
+
useTabContext
|
|
3626
|
+
};
|
|
3627
|
+
//# sourceMappingURL=index.mjs.map
|