specra 0.1.13 → 0.2.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 +25 -4
- package/README.md +67 -58
- package/config/specra.config.schema.json +16 -0
- package/config/svelte-config.js +63 -0
- package/dist/api-parser.types.d.ts +59 -0
- package/dist/api-parser.types.js +5 -0
- package/dist/api.types.d.ts +137 -0
- package/dist/api.types.js +5 -0
- package/dist/category.d.ts +21 -0
- package/dist/category.js +48 -0
- package/dist/components/ConfigProvider.svelte +13 -0
- package/dist/components/ConfigProvider.svelte.d.ts +31 -0
- package/dist/components/docs/Accordion.svelte +18 -0
- package/dist/components/docs/Accordion.svelte.d.ts +10 -0
- package/dist/components/docs/AccordionItem.svelte +41 -0
- package/dist/components/docs/AccordionItem.svelte.d.ts +10 -0
- package/dist/components/docs/Badge.svelte +28 -0
- package/dist/components/docs/Badge.svelte.d.ts +9 -0
- package/dist/components/docs/Breadcrumb.svelte +80 -0
- package/dist/components/docs/Breadcrumb.svelte.d.ts +8 -0
- package/dist/components/docs/Callout.svelte +96 -0
- package/dist/components/docs/Callout.svelte.d.ts +10 -0
- package/dist/components/docs/Card.svelte +63 -0
- package/dist/components/docs/Card.svelte.d.ts +12 -0
- package/dist/components/docs/CardGrid.svelte +24 -0
- package/dist/components/docs/CardGrid.svelte.d.ts +8 -0
- package/dist/components/docs/CategoryIndex.svelte +110 -0
- package/dist/components/docs/CategoryIndex.svelte.d.ts +29 -0
- package/dist/components/docs/CodeBlock.svelte +172 -0
- package/dist/components/docs/CodeBlock.svelte.d.ts +8 -0
- package/dist/components/docs/Column.svelte +25 -0
- package/dist/components/docs/Column.svelte.d.ts +8 -0
- package/dist/components/docs/Columns.svelte +38 -0
- package/dist/components/docs/Columns.svelte.d.ts +13 -0
- package/dist/components/docs/DevModeBadge.svelte +15 -0
- package/dist/components/docs/DevModeBadge.svelte.d.ts +18 -0
- package/dist/components/docs/DocBadge.svelte +28 -0
- package/dist/components/docs/DocBadge.svelte.d.ts +9 -0
- package/dist/components/docs/DocLayout.svelte +107 -0
- package/dist/components/docs/DocLayout.svelte.d.ts +32 -0
- package/dist/components/docs/DocLoading.svelte +53 -0
- package/dist/components/docs/DocLoading.svelte.d.ts +18 -0
- package/dist/components/docs/DocMetadata.svelte +106 -0
- package/dist/components/docs/DocMetadata.svelte.d.ts +18 -0
- package/dist/components/docs/DocNavigation.svelte +56 -0
- package/dist/components/docs/DocNavigation.svelte.d.ts +12 -0
- package/dist/components/docs/DocTags.svelte +22 -0
- package/dist/components/docs/DocTags.svelte.d.ts +6 -0
- package/dist/components/docs/DraftBadge.svelte +10 -0
- package/dist/components/docs/DraftBadge.svelte.d.ts +18 -0
- package/dist/components/docs/Footer.svelte +72 -0
- package/dist/components/docs/Footer.svelte.d.ts +7 -0
- package/dist/components/docs/Frame.svelte +27 -0
- package/dist/components/docs/Frame.svelte.d.ts +9 -0
- package/dist/components/docs/Header.svelte +123 -0
- package/dist/components/docs/Header.svelte.d.ts +9 -0
- package/dist/components/docs/HeaderWithMenu.svelte +34 -0
- package/dist/components/docs/HeaderWithMenu.svelte.d.ts +17 -0
- package/dist/components/docs/HotReloadIndicator.svelte +44 -0
- package/dist/components/docs/HotReloadIndicator.svelte.d.ts +3 -0
- package/dist/components/docs/Icon.svelte +103 -0
- package/dist/components/docs/Icon.svelte.d.ts +11 -0
- package/dist/components/docs/Image.svelte +88 -0
- package/dist/components/docs/Image.svelte.d.ts +11 -0
- package/dist/components/docs/ImageCard.svelte +91 -0
- package/dist/components/docs/ImageCard.svelte.d.ts +12 -0
- package/dist/components/docs/ImageCardGrid.svelte +25 -0
- package/dist/components/docs/ImageCardGrid.svelte.d.ts +8 -0
- package/dist/components/docs/LayoutProviders.svelte +57 -0
- package/dist/components/docs/LayoutProviders.svelte.d.ts +9 -0
- package/dist/components/docs/Logo.svelte +25 -0
- package/dist/components/docs/Logo.svelte.d.ts +11 -0
- package/dist/components/docs/Math.svelte +54 -0
- package/dist/components/docs/Math.svelte.d.ts +7 -0
- package/dist/components/docs/MdxContent.svelte +41 -0
- package/dist/components/docs/MdxHotReload.svelte +78 -0
- package/dist/components/docs/MdxHotReload.svelte.d.ts +9 -0
- package/dist/components/docs/MdxLayout.svelte +16 -0
- package/dist/components/docs/MdxLayout.svelte.d.ts +6 -0
- package/dist/components/docs/Mermaid.svelte +88 -0
- package/dist/components/docs/Mermaid.svelte.d.ts +7 -0
- package/dist/components/docs/MobileDocLayout.svelte +211 -0
- package/dist/components/docs/MobileDocLayout.svelte.d.ts +35 -0
- package/dist/components/docs/MobileSidebar.svelte +122 -0
- package/dist/components/docs/MobileSidebar.svelte.d.ts +31 -0
- package/dist/components/docs/MobileSidebarWrapper.svelte +122 -0
- package/dist/components/docs/MobileSidebarWrapper.svelte.d.ts +32 -0
- package/dist/components/docs/NotFoundContent.svelte +40 -0
- package/dist/components/docs/NotFoundContent.svelte.d.ts +6 -0
- package/dist/components/docs/SearchHighlight.svelte +116 -0
- package/dist/components/docs/SearchHighlight.svelte.d.ts +3 -0
- package/dist/components/docs/SearchModal.svelte +239 -0
- package/dist/components/docs/SearchModal.svelte.d.ts +9 -0
- package/dist/components/docs/Sidebar.svelte +69 -0
- package/dist/components/docs/Sidebar.svelte.d.ts +31 -0
- package/dist/components/docs/SidebarMenuItems.svelte +344 -0
- package/dist/components/docs/SidebarMenuItems.svelte.d.ts +33 -0
- package/dist/components/docs/SidebarSkeleton.svelte +50 -0
- package/dist/components/docs/SidebarSkeleton.svelte.d.ts +18 -0
- package/dist/components/docs/SiteBanner.svelte +92 -0
- package/dist/components/docs/SiteBanner.svelte.d.ts +7 -0
- package/dist/components/docs/Step.svelte +44 -0
- package/dist/components/docs/Step.svelte.d.ts +8 -0
- package/dist/components/docs/Steps.svelte +15 -0
- package/dist/components/docs/Steps.svelte.d.ts +7 -0
- package/dist/components/docs/Tab.svelte +40 -0
- package/dist/components/docs/Tab.svelte.d.ts +8 -0
- package/dist/components/docs/TabGroups.svelte +183 -0
- package/dist/components/docs/TabGroups.svelte.d.ts +25 -0
- package/dist/components/docs/TableOfContents.svelte +100 -0
- package/dist/components/docs/TableOfContents.svelte.d.ts +9 -0
- package/dist/components/docs/Tabs.svelte +69 -0
- package/dist/components/docs/Tabs.svelte.d.ts +8 -0
- package/dist/components/docs/ThemeToggle.svelte +16 -0
- package/dist/components/docs/ThemeToggle.svelte.d.ts +18 -0
- package/dist/components/docs/Tooltip.svelte +44 -0
- package/dist/components/docs/Tooltip.svelte.d.ts +10 -0
- package/dist/components/docs/VersionSwitcher.svelte +95 -0
- package/dist/components/docs/VersionSwitcher.svelte.d.ts +7 -0
- package/dist/components/docs/Video.svelte +84 -0
- package/dist/components/docs/Video.svelte.d.ts +12 -0
- package/dist/components/docs/api/ApiEndpoint.svelte +61 -0
- package/dist/components/docs/api/ApiEndpoint.svelte.d.ts +11 -0
- package/dist/components/docs/api/ApiParams.svelte +80 -0
- package/dist/components/docs/api/ApiParams.svelte.d.ts +14 -0
- package/dist/components/docs/api/ApiPlayground.svelte +259 -0
- package/dist/components/docs/api/ApiPlayground.svelte.d.ts +16 -0
- package/dist/components/docs/api/ApiReference.svelte +278 -0
- package/dist/components/docs/api/ApiReference.svelte.d.ts +23 -0
- package/dist/components/docs/api/ApiResponse.svelte +66 -0
- package/dist/components/docs/api/ApiResponse.svelte.d.ts +9 -0
- package/dist/components/docs/api/index.d.ts +5 -0
- package/dist/components/docs/api/index.js +5 -0
- package/dist/components/docs/componentTextProps.d.ts +3 -0
- package/dist/components/docs/componentTextProps.js +61 -0
- package/dist/components/docs/index.d.ts +54 -0
- package/dist/components/docs/index.js +56 -0
- package/dist/components/global/VersionNotFound.svelte +48 -0
- package/dist/components/global/VersionNotFound.svelte.d.ts +7 -0
- package/dist/components/global/index.d.ts +1 -0
- package/dist/components/global/index.js +1 -0
- package/dist/components/index.d.ts +6 -822
- package/dist/components/index.js +11 -3854
- package/dist/components/ui/Badge.svelte +48 -0
- package/dist/components/ui/Badge.svelte.d.ts +15 -0
- package/dist/components/ui/Button.svelte +58 -0
- package/dist/components/ui/Button.svelte.d.ts +17 -0
- package/dist/components/ui/Dialog.svelte +16 -0
- package/dist/components/ui/Dialog.svelte.d.ts +9 -0
- package/dist/components/ui/DialogClose.svelte +16 -0
- package/dist/components/ui/DialogClose.svelte.d.ts +9 -0
- package/dist/components/ui/DialogContent.svelte +43 -0
- package/dist/components/ui/DialogContent.svelte.d.ts +10 -0
- package/dist/components/ui/DialogDescription.svelte +21 -0
- package/dist/components/ui/DialogDescription.svelte.d.ts +9 -0
- package/dist/components/ui/DialogFooter.svelte +20 -0
- package/dist/components/ui/DialogFooter.svelte.d.ts +9 -0
- package/dist/components/ui/DialogHeader.svelte +20 -0
- package/dist/components/ui/DialogHeader.svelte.d.ts +9 -0
- package/dist/components/ui/DialogTitle.svelte +21 -0
- package/dist/components/ui/DialogTitle.svelte.d.ts +9 -0
- package/dist/components/ui/Input.svelte +23 -0
- package/dist/components/ui/Input.svelte.d.ts +8 -0
- package/dist/components/ui/Textarea.svelte +19 -0
- package/dist/components/ui/Textarea.svelte.d.ts +7 -0
- package/dist/components/ui/index.d.ts +11 -0
- package/dist/components/ui/index.js +11 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +9 -0
- package/dist/config.schema.json +471 -0
- package/dist/config.server.d.ts +46 -0
- package/dist/config.server.js +149 -0
- package/dist/{mdx-ColN3Cyg.d.mts → config.types.d.ts} +22 -75
- package/dist/config.types.js +39 -0
- package/dist/dev-utils.d.ts +29 -0
- package/dist/dev-utils.js +63 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.js +25 -4861
- package/dist/mdx-cache.d.ts +41 -0
- package/dist/mdx-cache.js +160 -0
- package/dist/mdx-components.js +50 -1931
- package/dist/mdx-security.d.ts +76 -0
- package/dist/mdx-security.js +217 -0
- package/dist/mdx.d.ts +73 -0
- package/dist/mdx.js +1099 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/security.d.ts +22 -47
- package/dist/middleware/security.js +111 -137
- package/dist/parsers/base-parser.d.ts +14 -0
- package/dist/parsers/base-parser.js +1 -0
- package/dist/parsers/index.d.ts +16 -0
- package/dist/parsers/index.js +51 -0
- package/dist/parsers/openapi-parser.d.ts +18 -0
- package/dist/parsers/openapi-parser.js +209 -0
- package/dist/parsers/postman-parser.d.ts +20 -0
- package/dist/parsers/postman-parser.js +260 -0
- package/dist/parsers/specra-parser.d.ts +10 -0
- package/dist/parsers/specra-parser.js +18 -0
- package/dist/redirects.d.ts +12 -0
- package/dist/redirects.js +30 -0
- package/dist/remark-code-meta.d.ts +6 -0
- package/dist/remark-code-meta.js +21 -0
- package/dist/sidebar-utils.d.ts +59 -0
- package/dist/sidebar-utils.js +144 -0
- package/dist/stores/config.d.ts +20 -0
- package/dist/stores/config.js +45 -0
- package/dist/stores/index.d.ts +4 -0
- package/dist/stores/index.js +4 -0
- package/dist/stores/sidebar.d.ts +7 -0
- package/dist/stores/sidebar.js +12 -0
- package/dist/stores/tabs.d.ts +6 -0
- package/dist/stores/tabs.js +41 -0
- package/dist/stores/theme.d.ts +7 -0
- package/dist/stores/theme.js +75 -0
- package/dist/{styles.css → styles/globals.css} +136 -6
- package/dist/toc.d.ts +9 -0
- package/dist/toc.js +15 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.js +30 -0
- package/package.json +47 -90
- package/dist/app/api/mdx-watch/route.d.mts +0 -10
- package/dist/app/api/mdx-watch/route.d.ts +0 -10
- package/dist/app/api/mdx-watch/route.js +0 -118
- package/dist/app/api/mdx-watch/route.js.map +0 -1
- package/dist/app/api/mdx-watch/route.mjs +0 -91
- package/dist/app/api/mdx-watch/route.mjs.map +0 -1
- package/dist/chunk-6S3EJVEO.mjs +0 -259
- package/dist/chunk-6S3EJVEO.mjs.map +0 -1
- package/dist/chunk-BE7EROIW.mjs +0 -212
- package/dist/chunk-BE7EROIW.mjs.map +0 -1
- package/dist/chunk-CWHRZHZO.mjs +0 -168
- package/dist/chunk-CWHRZHZO.mjs.map +0 -1
- package/dist/chunk-D5VDVYFY.mjs +0 -1325
- package/dist/chunk-D5VDVYFY.mjs.map +0 -1
- package/dist/chunk-WMCO2UX5.mjs +0 -585
- package/dist/chunk-WMCO2UX5.mjs.map +0 -1
- package/dist/chunk-XEMGCPZZ.mjs +0 -475
- package/dist/chunk-XEMGCPZZ.mjs.map +0 -1
- package/dist/components/index.d.mts +0 -822
- package/dist/components/index.js.map +0 -1
- package/dist/components/index.mjs +0 -3741
- package/dist/components/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -4
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1897
- package/dist/index.mjs.map +0 -1
- package/dist/layouts/index.d.mts +0 -34
- package/dist/layouts/index.d.ts +0 -34
- package/dist/layouts/index.js +0 -453
- package/dist/layouts/index.js.map +0 -1
- package/dist/layouts/index.mjs +0 -173
- package/dist/layouts/index.mjs.map +0 -1
- package/dist/lib/index.d.mts +0 -583
- package/dist/lib/index.d.ts +0 -583
- package/dist/lib/index.js +0 -1595
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/index.mjs +0 -111
- package/dist/lib/index.mjs.map +0 -1
- package/dist/mdx-ColN3Cyg.d.ts +0 -352
- package/dist/mdx-components.d.mts +0 -86
- package/dist/mdx-components.d.ts +0 -86
- package/dist/mdx-components.js.map +0 -1
- package/dist/mdx-components.mjs +0 -206
- package/dist/mdx-components.mjs.map +0 -1
- package/dist/middleware/security.d.mts +0 -82
- package/dist/middleware/security.js.map +0 -1
- package/dist/middleware/security.mjs +0 -84
- package/dist/middleware/security.mjs.map +0 -1
- package/dist/styles.css.map +0 -1
- package/dist/styles.d.mts +0 -2
- package/dist/styles.d.ts +0 -2
- package/dist/styles.js +0 -2
- package/dist/styles.js.map +0 -1
- package/dist/styles.mjs +0 -1
- package/dist/styles.mjs.map +0 -1
package/dist/chunk-D5VDVYFY.mjs
DELETED
|
@@ -1,1325 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn,
|
|
3
|
-
parseApiSpec
|
|
4
|
-
} from "./chunk-XEMGCPZZ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/components/docs/accordion.tsx
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import { ChevronDown } from "lucide-react";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
function AccordionItem({ title, children, defaultOpen = false }) {
|
|
11
|
-
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
12
|
-
return /* @__PURE__ */ jsxs("div", { className: "border border-border rounded-xl overflow-hidden mb-2", children: [
|
|
13
|
-
/* @__PURE__ */ jsxs(
|
|
14
|
-
"button",
|
|
15
|
-
{
|
|
16
|
-
onClick: () => setIsOpen(!isOpen),
|
|
17
|
-
className: "w-full flex items-center justify-between p-4 text-left bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
18
|
-
children: [
|
|
19
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: title }),
|
|
20
|
-
/* @__PURE__ */ jsx(
|
|
21
|
-
ChevronDown,
|
|
22
|
-
{
|
|
23
|
-
className: `h-5 w-5 text-muted-foreground transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
),
|
|
29
|
-
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 }) })
|
|
30
|
-
] });
|
|
31
|
-
}
|
|
32
|
-
function Accordion({ children, type = "multiple", className }) {
|
|
33
|
-
return /* @__PURE__ */ jsx("div", { className: className || "my-6 space-y-2", children });
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// src/components/docs/badge.tsx
|
|
37
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
38
|
-
function Badge({ children, variant = "default" }) {
|
|
39
|
-
const variants = {
|
|
40
|
-
default: "bg-muted text-foreground border-border",
|
|
41
|
-
success: "bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20",
|
|
42
|
-
warning: "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20",
|
|
43
|
-
error: "bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20",
|
|
44
|
-
info: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20"
|
|
45
|
-
};
|
|
46
|
-
return /* @__PURE__ */ jsx2(
|
|
47
|
-
"span",
|
|
48
|
-
{
|
|
49
|
-
className: `inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium border ${variants[variant]}`,
|
|
50
|
-
children
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// src/components/docs/callout.tsx
|
|
56
|
-
import { cloneElement, isValidElement } from "react";
|
|
57
|
-
import { Info, AlertTriangle, CheckCircle2, XCircle, Lightbulb } from "lucide-react";
|
|
58
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
59
|
-
function Callout({ children, type = "info", title }) {
|
|
60
|
-
const configs = {
|
|
61
|
-
info: {
|
|
62
|
-
icon: Info,
|
|
63
|
-
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",
|
|
64
|
-
iconClassName: "text-blue-600 dark:text-blue-400",
|
|
65
|
-
titleClassName: "text-blue-700 dark:text-blue-300",
|
|
66
|
-
defaultTitle: "Info"
|
|
67
|
-
},
|
|
68
|
-
note: {
|
|
69
|
-
icon: Info,
|
|
70
|
-
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",
|
|
71
|
-
iconClassName: "text-blue-600 dark:text-blue-400",
|
|
72
|
-
titleClassName: "text-blue-700 dark:text-blue-300",
|
|
73
|
-
defaultTitle: "Note"
|
|
74
|
-
},
|
|
75
|
-
warning: {
|
|
76
|
-
icon: AlertTriangle,
|
|
77
|
-
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",
|
|
78
|
-
iconClassName: "text-yellow-600 dark:text-yellow-400",
|
|
79
|
-
titleClassName: "text-yellow-700 dark:text-yellow-300",
|
|
80
|
-
defaultTitle: "Warning"
|
|
81
|
-
},
|
|
82
|
-
success: {
|
|
83
|
-
icon: CheckCircle2,
|
|
84
|
-
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",
|
|
85
|
-
iconClassName: "text-green-600 dark:text-green-400",
|
|
86
|
-
titleClassName: "text-green-700 dark:text-green-300",
|
|
87
|
-
defaultTitle: "Success"
|
|
88
|
-
},
|
|
89
|
-
error: {
|
|
90
|
-
icon: XCircle,
|
|
91
|
-
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",
|
|
92
|
-
iconClassName: "text-red-600 dark:text-red-400",
|
|
93
|
-
titleClassName: "text-red-700 dark:text-red-300",
|
|
94
|
-
defaultTitle: "Error"
|
|
95
|
-
},
|
|
96
|
-
danger: {
|
|
97
|
-
icon: XCircle,
|
|
98
|
-
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",
|
|
99
|
-
iconClassName: "text-red-600 dark:text-red-400",
|
|
100
|
-
titleClassName: "text-red-700 dark:text-red-300",
|
|
101
|
-
defaultTitle: "Danger"
|
|
102
|
-
},
|
|
103
|
-
tip: {
|
|
104
|
-
icon: Lightbulb,
|
|
105
|
-
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",
|
|
106
|
-
iconClassName: "text-purple-600 dark:text-purple-400",
|
|
107
|
-
titleClassName: "text-purple-700 dark:text-purple-300",
|
|
108
|
-
defaultTitle: "Tip"
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
const config = configs[type];
|
|
112
|
-
const Icon2 = config.icon;
|
|
113
|
-
let _title = title || config.defaultTitle;
|
|
114
|
-
let content = children;
|
|
115
|
-
if (!title && children && typeof children === "object") {
|
|
116
|
-
const childArray = Array.isArray(children) ? children : [children];
|
|
117
|
-
const firstElement = childArray[0];
|
|
118
|
-
if (firstElement && typeof firstElement === "object" && "props" in firstElement) {
|
|
119
|
-
const props = firstElement.props;
|
|
120
|
-
if (props.children && Array.isArray(props.children)) {
|
|
121
|
-
const strongChild = props.children.find(
|
|
122
|
-
(child) => child && typeof child === "object" && child.type === "strong"
|
|
123
|
-
);
|
|
124
|
-
if (strongChild) {
|
|
125
|
-
_title = strongChild.props.children;
|
|
126
|
-
content = childArray.map((child, idx) => {
|
|
127
|
-
if (idx === 0 && isValidElement(child)) {
|
|
128
|
-
const newChildren = child.props.children.filter((c) => c !== strongChild);
|
|
129
|
-
const childProps = child.props;
|
|
130
|
-
return cloneElement(child, { ...childProps, children: newChildren });
|
|
131
|
-
}
|
|
132
|
-
return child;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return /* @__PURE__ */ jsxs2("div", { className: `flex gap-3 p-4 rounded-xl border my-2 ${config.className}`, children: [
|
|
139
|
-
/* @__PURE__ */ jsx3("div", { className: "flex-shrink-0 mt-0.5", children: /* @__PURE__ */ jsx3(Icon2, { className: `h-5 w-5 ${config.iconClassName}` }) }),
|
|
140
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex-1 space-y-0", children: [
|
|
141
|
-
/* @__PURE__ */ jsx3("div", { className: `font-semibold text-sm ${config.titleClassName}`, children: _title }),
|
|
142
|
-
/* @__PURE__ */ jsx3("div", { className: "text-sm leading-relaxed [&>p]:mb-0 [&>p]:text-current", children: content })
|
|
143
|
-
] })
|
|
144
|
-
] });
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// src/components/docs/icon.tsx
|
|
148
|
-
import * as LucideIcons from "lucide-react";
|
|
149
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
150
|
-
function Icon({ icon, iconType = "regular", color, size = 20, className = "" }) {
|
|
151
|
-
if (typeof icon !== "string") {
|
|
152
|
-
return /* @__PURE__ */ jsx4("span", { className: `inline-flex items-center ${className}`, style: { color }, children: icon });
|
|
153
|
-
}
|
|
154
|
-
if (icon.startsWith("http") || icon.startsWith("/")) {
|
|
155
|
-
return /* @__PURE__ */ jsx4(
|
|
156
|
-
"img",
|
|
157
|
-
{
|
|
158
|
-
src: icon,
|
|
159
|
-
alt: "",
|
|
160
|
-
width: size,
|
|
161
|
-
height: size,
|
|
162
|
-
className: `inline-block ${className}`,
|
|
163
|
-
style: { color }
|
|
164
|
-
}
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
if (icon.startsWith("fa-")) {
|
|
168
|
-
const faClass = `fa-${iconType} ${icon}`;
|
|
169
|
-
return /* @__PURE__ */ jsx4(
|
|
170
|
-
"i",
|
|
171
|
-
{
|
|
172
|
-
className: `${faClass} ${className}`,
|
|
173
|
-
style: { fontSize: size, color },
|
|
174
|
-
"aria-hidden": "true"
|
|
175
|
-
}
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
const iconName = icon.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
179
|
-
const LucideIcon = LucideIcons[iconName];
|
|
180
|
-
if (LucideIcon) {
|
|
181
|
-
return /* @__PURE__ */ jsx4(
|
|
182
|
-
LucideIcon,
|
|
183
|
-
{
|
|
184
|
-
size,
|
|
185
|
-
className: `inline-block ${className}`,
|
|
186
|
-
style: { color },
|
|
187
|
-
"aria-hidden": "true"
|
|
188
|
-
}
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
return /* @__PURE__ */ jsxs3("span", { className: `inline-flex items-center font-mono text-xs ${className}`, style: { color }, children: [
|
|
192
|
-
"[",
|
|
193
|
-
icon,
|
|
194
|
-
"]"
|
|
195
|
-
] });
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// src/components/docs/card.tsx
|
|
199
|
-
import { ArrowRight, ExternalLink } from "lucide-react";
|
|
200
|
-
import Link from "next/link";
|
|
201
|
-
import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
202
|
-
function Card({ title, description, href, icon, children, external = false }) {
|
|
203
|
-
const content = /* @__PURE__ */ jsx5(Fragment, { children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
|
|
204
|
-
icon && /* @__PURE__ */ jsx5("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__ */ jsx5(Icon, { icon, size: 20 }) : icon }),
|
|
205
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex-1 min-w-0", children: [
|
|
206
|
-
/* @__PURE__ */ jsx5("h3", { className: `font-semibold text-foreground mb-1 no-underline ${href ? "group-hover:text-primary transition-colors" : ""}`, children: title }),
|
|
207
|
-
description && /* @__PURE__ */ jsx5("p", { className: "text-sm text-muted-foreground line-clamp-2 no-underline", children: description }),
|
|
208
|
-
children && /* @__PURE__ */ jsx5("div", { className: "mt-2 text-sm text-muted-foreground no-underline", children })
|
|
209
|
-
] }),
|
|
210
|
-
href && /* @__PURE__ */ jsx5("div", { className: "shrink-0 self-start mt-1", children: external ? /* @__PURE__ */ jsx5(ExternalLink, { className: "h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" }) : /* @__PURE__ */ jsx5(ArrowRight, { className: "h-4 w-4 text-muted-foreground group-hover:text-primary group-hover:translate-x-1 transition-all" }) })
|
|
211
|
-
] }) });
|
|
212
|
-
if (href) {
|
|
213
|
-
const Component = external ? "a" : Link;
|
|
214
|
-
return /* @__PURE__ */ jsx5(
|
|
215
|
-
Component,
|
|
216
|
-
{
|
|
217
|
-
href,
|
|
218
|
-
className: "card-link group block p-4 rounded-xl border border-border hover:border-primary/50 hover:bg-muted/50 transition-all",
|
|
219
|
-
...external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
220
|
-
children: content
|
|
221
|
-
}
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
return /* @__PURE__ */ jsx5("div", { className: "p-4 rounded-xl border border-border bg-muted/30 no-underline", children: content });
|
|
225
|
-
}
|
|
226
|
-
function CardGrid({ children, cols = 2 }) {
|
|
227
|
-
const gridCols = {
|
|
228
|
-
1: "grid-cols-1",
|
|
229
|
-
2: "grid-cols-1 md:grid-cols-2",
|
|
230
|
-
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
231
|
-
};
|
|
232
|
-
return /* @__PURE__ */ jsx5("div", { className: `grid ${gridCols[cols]} gap-4 my-6`, children });
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// src/components/docs/code-block.tsx
|
|
236
|
-
import { useState as useState2 } from "react";
|
|
237
|
-
import { Check, Copy } from "lucide-react";
|
|
238
|
-
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
239
|
-
function CodeBlock({ code, language, filename }) {
|
|
240
|
-
const [copied, setCopied] = useState2(false);
|
|
241
|
-
const handleCopy = async () => {
|
|
242
|
-
await navigator.clipboard.writeText(code);
|
|
243
|
-
setCopied(true);
|
|
244
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
245
|
-
};
|
|
246
|
-
const highlightCode = (code2, lang) => {
|
|
247
|
-
const lines = code2.split("\n");
|
|
248
|
-
return lines.map((line, i) => {
|
|
249
|
-
const isDeletion = line.startsWith("-");
|
|
250
|
-
const isAddition = line.startsWith("+");
|
|
251
|
-
const isDiff = isDeletion || isAddition;
|
|
252
|
-
const diffBgClass = isDeletion ? "bg-red-500/5 dark:bg-red-500/10" : isAddition ? "bg-green-500/5 dark:bg-green-500/10" : "";
|
|
253
|
-
const diffMarkerClass = isDeletion ? "text-red-600 dark:text-red-400" : isAddition ? "text-green-600 dark:text-green-400" : "";
|
|
254
|
-
const tokens = [];
|
|
255
|
-
let currentPos = 0;
|
|
256
|
-
const patterns = [
|
|
257
|
-
{ type: "comment", regex: /(\/\/.*$|\/\*[\s\S]*?\*\/|#.*$)/ },
|
|
258
|
-
{ type: "string", regex: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`)/ },
|
|
259
|
-
{
|
|
260
|
-
type: "keyword",
|
|
261
|
-
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/
|
|
262
|
-
},
|
|
263
|
-
{ type: "operator", regex: /([+\-*/%=<>!&|^~?:]+)/ },
|
|
264
|
-
{ type: "number", regex: /\b(0x[a-fA-F0-9]+|0b[01]+|\d+\.?\d*(?:e[+-]?\d+)?)\b/ },
|
|
265
|
-
{ type: "function", regex: /\b([a-zA-Z_$][\w$]*)\s*(?=\()/ },
|
|
266
|
-
{ type: "property", regex: /\.([a-zA-Z_$][\w$]*)/ },
|
|
267
|
-
{ type: "punctuation", regex: /([{}[\]();,])/ }
|
|
268
|
-
];
|
|
269
|
-
while (currentPos < line.length) {
|
|
270
|
-
let matched = false;
|
|
271
|
-
for (const { type, regex } of patterns) {
|
|
272
|
-
const match = line.slice(currentPos).match(regex);
|
|
273
|
-
if (match && match.index === 0) {
|
|
274
|
-
tokens.push({ type, value: match[0] });
|
|
275
|
-
currentPos += match[0].length;
|
|
276
|
-
matched = true;
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
if (!matched) {
|
|
281
|
-
const nextSpecialChar = line.slice(currentPos).search(/["'`/\w.+\-*/%=<>!&|^~?:;,()[\]{}#]/);
|
|
282
|
-
if (nextSpecialChar === -1) {
|
|
283
|
-
tokens.push({ type: "text", value: line.slice(currentPos) });
|
|
284
|
-
break;
|
|
285
|
-
} else if (nextSpecialChar > 0) {
|
|
286
|
-
tokens.push({ type: "text", value: line.slice(currentPos, currentPos + nextSpecialChar) });
|
|
287
|
-
currentPos += nextSpecialChar;
|
|
288
|
-
} else {
|
|
289
|
-
tokens.push({ type: "text", value: line[currentPos] });
|
|
290
|
-
currentPos++;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return /* @__PURE__ */ jsxs5("div", { className: `table-row ${diffBgClass}`, children: [
|
|
295
|
-
/* @__PURE__ */ jsx6("span", { className: "table-cell pr-4 text-right select-none text-muted-foreground/40 w-8 align-top", children: i + 1 }),
|
|
296
|
-
/* @__PURE__ */ jsx6("span", { className: "table-cell align-top", children: tokens.length === 0 ? /* @__PURE__ */ jsx6("span", { children: "\xA0" }) : tokens.map((token, j) => {
|
|
297
|
-
if (j === 0 && isDiff && token.value.length > 0 && (token.value[0] === "+" || token.value[0] === "-")) {
|
|
298
|
-
const marker = token.value[0];
|
|
299
|
-
const rest = token.value.slice(1);
|
|
300
|
-
return /* @__PURE__ */ jsxs5("span", { children: [
|
|
301
|
-
/* @__PURE__ */ jsx6("span", { className: `${diffMarkerClass} font-bold`, children: marker }),
|
|
302
|
-
rest && /* @__PURE__ */ jsx6("span", { className: `token-${token.type}`, children: rest })
|
|
303
|
-
] }, j);
|
|
304
|
-
}
|
|
305
|
-
return /* @__PURE__ */ jsx6("span", { className: `token-${token.type}`, children: token.value }, j);
|
|
306
|
-
}) })
|
|
307
|
-
] }, i);
|
|
308
|
-
});
|
|
309
|
-
};
|
|
310
|
-
return /* @__PURE__ */ jsxs5("div", { className: "relative group my-2", children: [
|
|
311
|
-
/* @__PURE__ */ jsxs5("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: [
|
|
312
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
|
|
313
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1.5", children: [
|
|
314
|
-
/* @__PURE__ */ jsx6("div", { className: "w-3 h-3 rounded-full bg-red-500/80 dark:bg-red-500/60" }),
|
|
315
|
-
/* @__PURE__ */ jsx6("div", { className: "w-3 h-3 rounded-full bg-yellow-500/80 dark:bg-yellow-500/60" }),
|
|
316
|
-
/* @__PURE__ */ jsx6("div", { className: "w-3 h-3 rounded-full bg-green-500/80 dark:bg-green-500/60" })
|
|
317
|
-
] }),
|
|
318
|
-
/* @__PURE__ */ jsx6("span", { className: "text-xs font-mono text-foreground", children: filename || "Code" })
|
|
319
|
-
] }),
|
|
320
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
321
|
-
/* @__PURE__ */ jsx6("span", { className: "text-xs text-muted-foreground/60 font-mono uppercase tracking-wide", children: language }),
|
|
322
|
-
/* @__PURE__ */ jsx6(
|
|
323
|
-
"button",
|
|
324
|
-
{
|
|
325
|
-
onClick: handleCopy,
|
|
326
|
-
className: "p-1.5 rounded-md hover:bg-muted/50 transition-colors",
|
|
327
|
-
"aria-label": "Copy code",
|
|
328
|
-
children: copied ? /* @__PURE__ */ jsx6(Check, { className: "h-4 w-4 text-green-400" }) : /* @__PURE__ */ jsx6(Copy, { className: "h-4 w-4 text-muted-foreground" })
|
|
329
|
-
}
|
|
330
|
-
)
|
|
331
|
-
] })
|
|
332
|
-
] }),
|
|
333
|
-
/* @__PURE__ */ jsx6("div", { className: "bg-gray-200/50 dark:bg-[#0d1117] rounded-b-xl overflow-x-auto border border-border/50", children: /* @__PURE__ */ jsx6("pre", { className: "p-2 text-[13px] font-mono leading-relaxed text-gray-800 dark:text-gray-200", children: /* @__PURE__ */ jsx6("code", { className: "table w-full", children: highlightCode(code, language) }) }) })
|
|
334
|
-
] });
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// src/components/docs/columns.tsx
|
|
338
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
339
|
-
function Columns({ children, cols = { sm: 1, md: 2, lg: 3 } }) {
|
|
340
|
-
const colClasses = {
|
|
341
|
-
1: "grid-cols-1",
|
|
342
|
-
2: "grid-cols-2",
|
|
343
|
-
3: "grid-cols-3",
|
|
344
|
-
4: "grid-cols-4"
|
|
345
|
-
};
|
|
346
|
-
const smClass = cols.sm ? colClasses[cols.sm] : "grid-cols-1";
|
|
347
|
-
const mdClass = cols.md ? `md:${colClasses[cols.md]}` : "";
|
|
348
|
-
const lgClass = cols.lg ? `lg:${colClasses[cols.lg]}` : "";
|
|
349
|
-
const xlClass = cols.xl ? `xl:${colClasses[cols.xl]}` : "";
|
|
350
|
-
return /* @__PURE__ */ jsx7("div", { className: `grid ${smClass} ${mdClass} ${lgClass} ${xlClass} gap-4 my-6`, children });
|
|
351
|
-
}
|
|
352
|
-
function Column({ children, span = 1 }) {
|
|
353
|
-
const spanClass = {
|
|
354
|
-
1: "col-span-1",
|
|
355
|
-
2: "col-span-2",
|
|
356
|
-
3: "col-span-3",
|
|
357
|
-
4: "col-span-4"
|
|
358
|
-
};
|
|
359
|
-
return /* @__PURE__ */ jsx7("div", { className: spanClass[span], children });
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// src/components/docs/frame.tsx
|
|
363
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
364
|
-
function Frame({ src, title = "Embedded content", height = 500, width = "100%" }) {
|
|
365
|
-
return /* @__PURE__ */ jsx8("div", { className: "my-6 rounded-xl border border-border overflow-hidden bg-muted/30", children: /* @__PURE__ */ jsx8(
|
|
366
|
-
"iframe",
|
|
367
|
-
{
|
|
368
|
-
src,
|
|
369
|
-
title,
|
|
370
|
-
width,
|
|
371
|
-
height,
|
|
372
|
-
className: "w-full",
|
|
373
|
-
loading: "lazy",
|
|
374
|
-
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups"
|
|
375
|
-
}
|
|
376
|
-
) });
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// src/components/docs/image-card.tsx
|
|
380
|
-
import NextImage from "next/image";
|
|
381
|
-
import Link2 from "next/link";
|
|
382
|
-
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
383
|
-
function ImageCard({
|
|
384
|
-
src,
|
|
385
|
-
alt,
|
|
386
|
-
title,
|
|
387
|
-
description,
|
|
388
|
-
href,
|
|
389
|
-
external = false,
|
|
390
|
-
aspectRatio = "video"
|
|
391
|
-
}) {
|
|
392
|
-
const aspectRatios = {
|
|
393
|
-
square: "aspect-square",
|
|
394
|
-
video: "aspect-video",
|
|
395
|
-
portrait: "aspect-[3/4]"
|
|
396
|
-
};
|
|
397
|
-
const content = /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-0 p-0", children: [
|
|
398
|
-
/* @__PURE__ */ jsx9("div", { className: `w-full ${aspectRatios[aspectRatio]} overflow-hidden ${title || description ? "rounded-t-xl" : "rounded-xl"} bg-muted relative`, children: /* @__PURE__ */ jsx9(
|
|
399
|
-
NextImage,
|
|
400
|
-
{
|
|
401
|
-
src,
|
|
402
|
-
alt,
|
|
403
|
-
fill: true,
|
|
404
|
-
sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw",
|
|
405
|
-
className: "object-cover transition-transform duration-300 group-hover:scale-105"
|
|
406
|
-
}
|
|
407
|
-
) }),
|
|
408
|
-
(title || description) && /* @__PURE__ */ jsxs6("div", { className: "p-3 flex flex-col gap-1", children: [
|
|
409
|
-
title && /* @__PURE__ */ jsx9("h3", { className: `font-semibold text-foreground mb-0 no-underline ${href ? "group-hover:text-primary transition-colors" : ""}`, children: title }),
|
|
410
|
-
description && /* @__PURE__ */ jsx9("p", { className: "text-sm text-muted-foreground line-clamp-2 no-underline mb-0", children: description })
|
|
411
|
-
] })
|
|
412
|
-
] });
|
|
413
|
-
if (href) {
|
|
414
|
-
const Component = external ? "a" : Link2;
|
|
415
|
-
return /* @__PURE__ */ jsx9(
|
|
416
|
-
Component,
|
|
417
|
-
{
|
|
418
|
-
href,
|
|
419
|
-
className: "image-card-link group block rounded-xl border border-border hover:border-primary/50 hover:shadow-lg transition-all overflow-hidden p-0",
|
|
420
|
-
...external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
421
|
-
children: content
|
|
422
|
-
}
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
return /* @__PURE__ */ jsx9("div", { className: "block rounded-xl border border-border overflow-hidden bg-card p-0", children: content });
|
|
426
|
-
}
|
|
427
|
-
function ImageCardGrid({ children, cols = 3 }) {
|
|
428
|
-
const gridCols = {
|
|
429
|
-
1: "grid-cols-1",
|
|
430
|
-
2: "grid-cols-1 md:grid-cols-2",
|
|
431
|
-
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
432
|
-
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
|
|
433
|
-
};
|
|
434
|
-
return /* @__PURE__ */ jsx9("div", { className: `grid ${gridCols[cols]} gap-4 my-6`, children });
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// src/components/docs/image.tsx
|
|
438
|
-
import NextImage2 from "next/image";
|
|
439
|
-
import { useState as useState3 } from "react";
|
|
440
|
-
import { ZoomIn, X } from "lucide-react";
|
|
441
|
-
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
442
|
-
function Image({ src, alt, caption, width, height, zoom = true }) {
|
|
443
|
-
const [isZoomed, setIsZoomed] = useState3(false);
|
|
444
|
-
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
445
|
-
/* @__PURE__ */ jsxs7("figure", { className: "my-6", children: [
|
|
446
|
-
/* @__PURE__ */ jsxs7("div", { className: "relative group rounded-xl border border-border overflow-hidden bg-muted/30", children: [
|
|
447
|
-
/* @__PURE__ */ jsx10(
|
|
448
|
-
NextImage2,
|
|
449
|
-
{
|
|
450
|
-
src,
|
|
451
|
-
alt,
|
|
452
|
-
width: width || 1200,
|
|
453
|
-
height: height || 675,
|
|
454
|
-
className: "w-full h-auto"
|
|
455
|
-
}
|
|
456
|
-
),
|
|
457
|
-
zoom && /* @__PURE__ */ jsx10(
|
|
458
|
-
"button",
|
|
459
|
-
{
|
|
460
|
-
onClick: () => setIsZoomed(true),
|
|
461
|
-
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",
|
|
462
|
-
"aria-label": "Zoom image",
|
|
463
|
-
children: /* @__PURE__ */ jsx10(ZoomIn, { className: "h-4 w-4 text-foreground" })
|
|
464
|
-
}
|
|
465
|
-
)
|
|
466
|
-
] }),
|
|
467
|
-
caption && /* @__PURE__ */ jsx10("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
468
|
-
] }),
|
|
469
|
-
isZoomed && /* @__PURE__ */ jsxs7(
|
|
470
|
-
"div",
|
|
471
|
-
{
|
|
472
|
-
className: "fixed inset-0 z-50 bg-background/95 backdrop-blur-sm flex items-center justify-center p-4",
|
|
473
|
-
onClick: () => setIsZoomed(false),
|
|
474
|
-
children: [
|
|
475
|
-
/* @__PURE__ */ jsx10(
|
|
476
|
-
"button",
|
|
477
|
-
{
|
|
478
|
-
onClick: () => setIsZoomed(false),
|
|
479
|
-
className: "absolute top-4 right-4 p-2 rounded-md bg-muted hover:bg-muted/80 transition-colors",
|
|
480
|
-
"aria-label": "Close",
|
|
481
|
-
children: /* @__PURE__ */ jsx10(X, { className: "h-5 w-5 text-foreground" })
|
|
482
|
-
}
|
|
483
|
-
),
|
|
484
|
-
/* @__PURE__ */ jsx10("div", { className: "max-w-7xl max-h-[90vh] overflow-auto", children: /* @__PURE__ */ jsx10(
|
|
485
|
-
NextImage2,
|
|
486
|
-
{
|
|
487
|
-
src,
|
|
488
|
-
alt,
|
|
489
|
-
width: width || 1920,
|
|
490
|
-
height: height || 1080,
|
|
491
|
-
className: "w-full h-auto"
|
|
492
|
-
}
|
|
493
|
-
) })
|
|
494
|
-
]
|
|
495
|
-
}
|
|
496
|
-
)
|
|
497
|
-
] });
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// src/components/docs/math.tsx
|
|
501
|
-
import { useEffect, useRef } from "react";
|
|
502
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
503
|
-
function Math2({ children, block = false }) {
|
|
504
|
-
const containerRef = useRef(null);
|
|
505
|
-
useEffect(() => {
|
|
506
|
-
const renderMath = async () => {
|
|
507
|
-
try {
|
|
508
|
-
const katex = (await import("katex")).default;
|
|
509
|
-
if (containerRef.current) {
|
|
510
|
-
katex.render(children, containerRef.current, {
|
|
511
|
-
throwOnError: false,
|
|
512
|
-
displayMode: block
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
} catch (err) {
|
|
516
|
-
console.error("KaTeX rendering error:", err);
|
|
517
|
-
if (containerRef.current) {
|
|
518
|
-
containerRef.current.textContent = children;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
renderMath();
|
|
523
|
-
}, [children, block]);
|
|
524
|
-
if (block) {
|
|
525
|
-
return /* @__PURE__ */ jsx11(
|
|
526
|
-
"div",
|
|
527
|
-
{
|
|
528
|
-
ref: containerRef,
|
|
529
|
-
className: "my-6 overflow-x-auto text-center"
|
|
530
|
-
}
|
|
531
|
-
);
|
|
532
|
-
}
|
|
533
|
-
return /* @__PURE__ */ jsx11("span", { ref: containerRef, className: "inline-block" });
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
// src/components/docs/mermaid.tsx
|
|
537
|
-
import { useEffect as useEffect2, useRef as useRef2, useState as useState4 } from "react";
|
|
538
|
-
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
539
|
-
function Mermaid({ chart, caption }) {
|
|
540
|
-
const containerRef = useRef2(null);
|
|
541
|
-
const [error, setError] = useState4(null);
|
|
542
|
-
useEffect2(() => {
|
|
543
|
-
const renderChart = async () => {
|
|
544
|
-
try {
|
|
545
|
-
const mermaid = (await import("mermaid")).default;
|
|
546
|
-
mermaid.initialize({
|
|
547
|
-
startOnLoad: false,
|
|
548
|
-
theme: document.documentElement.classList.contains("dark") ? "dark" : "default",
|
|
549
|
-
securityLevel: "loose",
|
|
550
|
-
fontFamily: "inherit"
|
|
551
|
-
});
|
|
552
|
-
if (containerRef.current) {
|
|
553
|
-
const id = `mermaid-${Math.random().toString(36).substr(2, 9)}`;
|
|
554
|
-
const { svg } = await mermaid.render(id, chart);
|
|
555
|
-
containerRef.current.innerHTML = svg;
|
|
556
|
-
}
|
|
557
|
-
} catch (err) {
|
|
558
|
-
console.error("Mermaid rendering error:", err);
|
|
559
|
-
setError(err instanceof Error ? err.message : "Failed to render diagram");
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
renderChart();
|
|
563
|
-
const observer = new MutationObserver((mutations) => {
|
|
564
|
-
mutations.forEach((mutation) => {
|
|
565
|
-
if (mutation.attributeName === "class") {
|
|
566
|
-
renderChart();
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
});
|
|
570
|
-
observer.observe(document.documentElement, { attributes: true });
|
|
571
|
-
return () => observer.disconnect();
|
|
572
|
-
}, [chart]);
|
|
573
|
-
if (error) {
|
|
574
|
-
return /* @__PURE__ */ jsx12("div", { className: "my-6 p-4 rounded-xl border border-red-500/50 bg-red-500/10", children: /* @__PURE__ */ jsxs8("p", { className: "text-sm text-red-600 dark:text-red-400 font-mono", children: [
|
|
575
|
-
"Mermaid Error: ",
|
|
576
|
-
error
|
|
577
|
-
] }) });
|
|
578
|
-
}
|
|
579
|
-
return /* @__PURE__ */ jsxs8("figure", { className: "my-6", children: [
|
|
580
|
-
/* @__PURE__ */ jsx12(
|
|
581
|
-
"div",
|
|
582
|
-
{
|
|
583
|
-
ref: containerRef,
|
|
584
|
-
className: "flex justify-center items-center p-6 rounded-xl border border-border bg-muted/30 overflow-x-auto"
|
|
585
|
-
}
|
|
586
|
-
),
|
|
587
|
-
caption && /* @__PURE__ */ jsx12("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
588
|
-
] });
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// src/components/docs/steps.tsx
|
|
592
|
-
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
593
|
-
function Steps({ children }) {
|
|
594
|
-
return /* @__PURE__ */ jsx13("div", { className: "my-6 ml-4 space-y-6 [counter-reset:step]", children });
|
|
595
|
-
}
|
|
596
|
-
function Step({ title, children }) {
|
|
597
|
-
return /* @__PURE__ */ jsxs9("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: [
|
|
598
|
-
/* @__PURE__ */ jsx13("div", { className: "mb-2", children: /* @__PURE__ */ jsx13("h3", { className: "text-lg font-semibold text-foreground", children: title }) }),
|
|
599
|
-
/* @__PURE__ */ jsx13("div", { className: "prose prose-sm dark:prose-invert max-w-none [&>*:last-child]:mb-0", children })
|
|
600
|
-
] });
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
// src/components/docs/tabs.tsx
|
|
604
|
-
import { useState as useState5, Children, isValidElement as isValidElement2 } from "react";
|
|
605
|
-
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
606
|
-
function Tab({ children }) {
|
|
607
|
-
return /* @__PURE__ */ jsx14(Fragment3, { children });
|
|
608
|
-
}
|
|
609
|
-
function Tabs({ children, defaultValue }) {
|
|
610
|
-
const tabs = Children.toArray(children).filter(isValidElement2);
|
|
611
|
-
const firstTabLabel = tabs[0]?.props.label || "";
|
|
612
|
-
const [activeTab, setActiveTab] = useState5(defaultValue || firstTabLabel);
|
|
613
|
-
return /* @__PURE__ */ jsxs10("div", { className: "my-6", children: [
|
|
614
|
-
/* @__PURE__ */ jsx14("div", { className: "flex items-center gap-1 border-b border-border mb-4", children: tabs.map((tab) => {
|
|
615
|
-
const label = tab.props.label;
|
|
616
|
-
const isActive = activeTab === label;
|
|
617
|
-
return /* @__PURE__ */ jsx14(
|
|
618
|
-
"button",
|
|
619
|
-
{
|
|
620
|
-
onClick: () => setActiveTab(label),
|
|
621
|
-
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"}`,
|
|
622
|
-
children: label
|
|
623
|
-
},
|
|
624
|
-
label
|
|
625
|
-
);
|
|
626
|
-
}) }),
|
|
627
|
-
tabs.map((tab) => {
|
|
628
|
-
const label = tab.props.label;
|
|
629
|
-
if (activeTab !== label) return null;
|
|
630
|
-
return /* @__PURE__ */ jsx14("div", { className: "prose prose-slate dark:prose-invert max-w-none [&>*:first-child]:mt-0", children: tab.props.children }, label);
|
|
631
|
-
})
|
|
632
|
-
] });
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// src/components/docs/tooltip.tsx
|
|
636
|
-
import { useState as useState6 } from "react";
|
|
637
|
-
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
638
|
-
function Tooltip({ children, content, position = "top" }) {
|
|
639
|
-
const [isVisible, setIsVisible] = useState6(false);
|
|
640
|
-
const positions = {
|
|
641
|
-
top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
642
|
-
bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
|
|
643
|
-
left: "right-full top-1/2 -translate-y-1/2 mr-2",
|
|
644
|
-
right: "left-full top-1/2 -translate-y-1/2 ml-2"
|
|
645
|
-
};
|
|
646
|
-
return /* @__PURE__ */ jsxs11(
|
|
647
|
-
"span",
|
|
648
|
-
{
|
|
649
|
-
className: "relative inline-flex underline decoration-dotted cursor-help",
|
|
650
|
-
onMouseEnter: () => setIsVisible(true),
|
|
651
|
-
onMouseLeave: () => setIsVisible(false),
|
|
652
|
-
children: [
|
|
653
|
-
children,
|
|
654
|
-
isVisible && /* @__PURE__ */ jsx15(
|
|
655
|
-
"span",
|
|
656
|
-
{
|
|
657
|
-
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`,
|
|
658
|
-
children: content
|
|
659
|
-
}
|
|
660
|
-
)
|
|
661
|
-
]
|
|
662
|
-
}
|
|
663
|
-
);
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
// src/components/docs/video.tsx
|
|
667
|
-
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
668
|
-
function Video({
|
|
669
|
-
src,
|
|
670
|
-
caption,
|
|
671
|
-
autoplay = false,
|
|
672
|
-
loop = false,
|
|
673
|
-
muted = false,
|
|
674
|
-
controls = true,
|
|
675
|
-
poster
|
|
676
|
-
}) {
|
|
677
|
-
const isYouTube = src.includes("youtube.com") || src.includes("youtu.be");
|
|
678
|
-
const isVimeo = src.includes("vimeo.com");
|
|
679
|
-
const getYouTubeId = (url) => {
|
|
680
|
-
const match = url.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/);
|
|
681
|
-
return match ? match[1] : null;
|
|
682
|
-
};
|
|
683
|
-
const getVimeoId = (url) => {
|
|
684
|
-
const match = url.match(/vimeo\.com\/(\d+)/);
|
|
685
|
-
return match ? match[1] : null;
|
|
686
|
-
};
|
|
687
|
-
return /* @__PURE__ */ jsxs12("figure", { className: "my-6", children: [
|
|
688
|
-
/* @__PURE__ */ jsx16("div", { className: "relative rounded-xl border border-border overflow-hidden bg-muted/30", children: isYouTube ? /* @__PURE__ */ jsx16("div", { className: "relative w-full", style: { paddingBottom: "56.25%" }, children: /* @__PURE__ */ jsx16(
|
|
689
|
-
"iframe",
|
|
690
|
-
{
|
|
691
|
-
className: "absolute top-0 left-0 w-full h-full",
|
|
692
|
-
src: `https://www.youtube.com/embed/${getYouTubeId(src)}${autoplay ? "?autoplay=1" : ""}`,
|
|
693
|
-
title: "YouTube video",
|
|
694
|
-
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
695
|
-
allowFullScreen: true
|
|
696
|
-
}
|
|
697
|
-
) }) : isVimeo ? /* @__PURE__ */ jsx16("div", { className: "relative w-full", style: { paddingBottom: "56.25%" }, children: /* @__PURE__ */ jsx16(
|
|
698
|
-
"iframe",
|
|
699
|
-
{
|
|
700
|
-
className: "absolute top-0 left-0 w-full h-full",
|
|
701
|
-
src: `https://player.vimeo.com/video/${getVimeoId(src)}${autoplay ? "?autoplay=1" : ""}`,
|
|
702
|
-
title: "Vimeo video",
|
|
703
|
-
allow: "autoplay; fullscreen; picture-in-picture",
|
|
704
|
-
allowFullScreen: true
|
|
705
|
-
}
|
|
706
|
-
) }) : /* @__PURE__ */ jsx16(
|
|
707
|
-
"video",
|
|
708
|
-
{
|
|
709
|
-
src,
|
|
710
|
-
controls,
|
|
711
|
-
autoPlay: autoplay,
|
|
712
|
-
loop,
|
|
713
|
-
muted,
|
|
714
|
-
poster,
|
|
715
|
-
className: "w-full h-auto",
|
|
716
|
-
children: "Your browser does not support the video tag."
|
|
717
|
-
}
|
|
718
|
-
) }),
|
|
719
|
-
caption && /* @__PURE__ */ jsx16("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
720
|
-
] });
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
// src/components/docs/api/api-endpoint.tsx
|
|
724
|
-
import { useState as useState7 } from "react";
|
|
725
|
-
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
726
|
-
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
727
|
-
var methodColors = {
|
|
728
|
-
GET: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
729
|
-
POST: "bg-green-500/10 text-green-600 dark:text-green-400",
|
|
730
|
-
PUT: "bg-orange-500/10 text-orange-600 dark:text-orange-400",
|
|
731
|
-
PATCH: "bg-purple-500/10 text-purple-600 dark:text-purple-400",
|
|
732
|
-
DELETE: "bg-red-500/10 text-red-600 dark:text-red-400"
|
|
733
|
-
};
|
|
734
|
-
function ApiEndpoint({ method, path, summary, children, defaultOpen = false }) {
|
|
735
|
-
const [isOpen, setIsOpen] = useState7(defaultOpen);
|
|
736
|
-
return /* @__PURE__ */ jsxs13("div", { className: "not-prose mb-4 rounded-xl border border-border overflow-hidden", children: [
|
|
737
|
-
/* @__PURE__ */ jsxs13(
|
|
738
|
-
"button",
|
|
739
|
-
{
|
|
740
|
-
onClick: () => setIsOpen(!isOpen),
|
|
741
|
-
className: "w-full flex items-center gap-3 px-4 py-3 text-left bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
742
|
-
children: [
|
|
743
|
-
/* @__PURE__ */ jsx17(
|
|
744
|
-
"span",
|
|
745
|
-
{
|
|
746
|
-
className: cn(
|
|
747
|
-
"text-xs font-semibold px-2 py-0.5 rounded",
|
|
748
|
-
methodColors[method]
|
|
749
|
-
),
|
|
750
|
-
children: method
|
|
751
|
-
}
|
|
752
|
-
),
|
|
753
|
-
/* @__PURE__ */ jsx17("code", { className: "text-sm font-mono", children: path }),
|
|
754
|
-
summary && /* @__PURE__ */ jsx17("span", { className: "text-sm text-muted-foreground ml-auto mr-2", children: summary }),
|
|
755
|
-
/* @__PURE__ */ jsx17(
|
|
756
|
-
ChevronDown2,
|
|
757
|
-
{
|
|
758
|
-
className: cn(
|
|
759
|
-
"h-5 w-5 text-muted-foreground transition-transform flex-shrink-0",
|
|
760
|
-
isOpen ? "rotate-180" : ""
|
|
761
|
-
)
|
|
762
|
-
}
|
|
763
|
-
)
|
|
764
|
-
]
|
|
765
|
-
}
|
|
766
|
-
),
|
|
767
|
-
isOpen && children && /* @__PURE__ */ jsx17("div", { className: "border-t border-border bg-background", children: /* @__PURE__ */ jsx17("div", { className: "px-4 py-4 space-y-6", children }) })
|
|
768
|
-
] });
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
// src/components/docs/api/api-params.tsx
|
|
772
|
-
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
773
|
-
function ApiParams({ title = "Parameters", params }) {
|
|
774
|
-
if (!params || params.length === 0) return null;
|
|
775
|
-
return /* @__PURE__ */ jsxs14("div", { className: "mb-6", children: [
|
|
776
|
-
/* @__PURE__ */ jsx18("h4", { className: "text-sm font-semibold text-foreground mb-3", children: title }),
|
|
777
|
-
/* @__PURE__ */ jsx18("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs14("table", { className: "w-full border-collapse", children: [
|
|
778
|
-
/* @__PURE__ */ jsx18("thead", { children: /* @__PURE__ */ jsxs14("tr", { className: "border-b border-border", children: [
|
|
779
|
-
/* @__PURE__ */ jsx18("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Property" }),
|
|
780
|
-
/* @__PURE__ */ jsx18("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Type" }),
|
|
781
|
-
/* @__PURE__ */ jsx18("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Required" }),
|
|
782
|
-
/* @__PURE__ */ jsx18("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Default" }),
|
|
783
|
-
/* @__PURE__ */ jsx18("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Description" })
|
|
784
|
-
] }) }),
|
|
785
|
-
/* @__PURE__ */ jsx18("tbody", { children: params.map((param, index) => /* @__PURE__ */ jsxs14(
|
|
786
|
-
"tr",
|
|
787
|
-
{
|
|
788
|
-
className: index !== params.length - 1 ? "border-b border-border/50" : "",
|
|
789
|
-
children: [
|
|
790
|
-
/* @__PURE__ */ jsx18("td", { className: "py-2.5 px-3", children: /* @__PURE__ */ jsx18("code", { className: "text-sm font-mono text-foreground", children: param.name }) }),
|
|
791
|
-
/* @__PURE__ */ jsx18("td", { className: "py-2.5 px-3", children: /* @__PURE__ */ jsx18("span", { className: "text-sm text-muted-foreground font-mono", children: param.type }) }),
|
|
792
|
-
/* @__PURE__ */ jsx18("td", { className: "py-2.5 px-3", children: param.required ? /* @__PURE__ */ jsx18("span", { className: "text-sm text-red-600 dark:text-red-400", children: "Yes" }) : /* @__PURE__ */ jsx18("span", { className: "text-sm text-muted-foreground", children: "No" }) }),
|
|
793
|
-
/* @__PURE__ */ jsx18("td", { className: "py-2.5 px-3", children: param.default ? /* @__PURE__ */ jsx18("code", { className: "text-sm font-mono text-muted-foreground", children: param.default }) : /* @__PURE__ */ jsx18("span", { className: "text-sm text-muted-foreground", children: "-" }) }),
|
|
794
|
-
/* @__PURE__ */ jsx18("td", { className: "py-2.5 px-3", children: param.description ? /* @__PURE__ */ jsx18("span", { className: "text-sm text-muted-foreground", children: param.description }) : /* @__PURE__ */ jsx18("span", { className: "text-sm text-muted-foreground", children: "-" }) })
|
|
795
|
-
]
|
|
796
|
-
},
|
|
797
|
-
param.name
|
|
798
|
-
)) })
|
|
799
|
-
] }) })
|
|
800
|
-
] });
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
// src/components/docs/api/api-response.tsx
|
|
804
|
-
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
805
|
-
var statusColors = {
|
|
806
|
-
"2": "text-green-600 dark:text-green-400",
|
|
807
|
-
"3": "text-blue-600 dark:text-blue-400",
|
|
808
|
-
"4": "text-orange-600 dark:text-orange-400",
|
|
809
|
-
"5": "text-red-600 dark:text-red-400"
|
|
810
|
-
};
|
|
811
|
-
function ApiResponse({ status, description, example, schema }) {
|
|
812
|
-
const statusClass = statusColors[String(status)[0]] || "text-muted-foreground";
|
|
813
|
-
return /* @__PURE__ */ jsxs15("div", { className: "mb-4", children: [
|
|
814
|
-
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
815
|
-
/* @__PURE__ */ jsx19("span", { className: `text-sm font-semibold ${statusClass}`, children: status }),
|
|
816
|
-
description && /* @__PURE__ */ jsx19("span", { className: "text-sm text-muted-foreground", children: description })
|
|
817
|
-
] }),
|
|
818
|
-
example && /* @__PURE__ */ jsxs15("div", { className: "mb-3", children: [
|
|
819
|
-
/* @__PURE__ */ jsx19("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: "Example Response" }),
|
|
820
|
-
/* @__PURE__ */ jsx19(
|
|
821
|
-
CodeBlock,
|
|
822
|
-
{
|
|
823
|
-
code: typeof example === "string" ? example : JSON.stringify(example, null, 2),
|
|
824
|
-
language: "json"
|
|
825
|
-
}
|
|
826
|
-
)
|
|
827
|
-
] }),
|
|
828
|
-
schema && /* @__PURE__ */ jsxs15("div", { children: [
|
|
829
|
-
/* @__PURE__ */ jsx19("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: "Schema" }),
|
|
830
|
-
/* @__PURE__ */ jsx19(
|
|
831
|
-
CodeBlock,
|
|
832
|
-
{
|
|
833
|
-
code: typeof schema === "string" ? schema : JSON.stringify(schema, null, 2),
|
|
834
|
-
language: "json"
|
|
835
|
-
}
|
|
836
|
-
)
|
|
837
|
-
] })
|
|
838
|
-
] });
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
// src/components/ui/button.tsx
|
|
842
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
843
|
-
import { cva } from "class-variance-authority";
|
|
844
|
-
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
845
|
-
var buttonVariants = cva(
|
|
846
|
-
"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",
|
|
847
|
-
{
|
|
848
|
-
variants: {
|
|
849
|
-
variant: {
|
|
850
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
851
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
852
|
-
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",
|
|
853
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
854
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
855
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
856
|
-
},
|
|
857
|
-
size: {
|
|
858
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
859
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
860
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
861
|
-
icon: "size-9",
|
|
862
|
-
"icon-sm": "size-8",
|
|
863
|
-
"icon-lg": "size-10"
|
|
864
|
-
}
|
|
865
|
-
},
|
|
866
|
-
defaultVariants: {
|
|
867
|
-
variant: "default",
|
|
868
|
-
size: "default"
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
);
|
|
872
|
-
function Button({
|
|
873
|
-
className,
|
|
874
|
-
variant,
|
|
875
|
-
size,
|
|
876
|
-
asChild = false,
|
|
877
|
-
...props
|
|
878
|
-
}) {
|
|
879
|
-
const Comp = asChild ? Slot : "button";
|
|
880
|
-
return /* @__PURE__ */ jsx20(
|
|
881
|
-
Comp,
|
|
882
|
-
{
|
|
883
|
-
"data-slot": "button",
|
|
884
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
885
|
-
...props
|
|
886
|
-
}
|
|
887
|
-
);
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
// src/components/ui/input.tsx
|
|
891
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
892
|
-
function Input({ className, type, ...props }) {
|
|
893
|
-
return /* @__PURE__ */ jsx21(
|
|
894
|
-
"input",
|
|
895
|
-
{
|
|
896
|
-
type,
|
|
897
|
-
"data-slot": "input",
|
|
898
|
-
className: cn(
|
|
899
|
-
"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",
|
|
900
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
901
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
902
|
-
className
|
|
903
|
-
),
|
|
904
|
-
...props
|
|
905
|
-
}
|
|
906
|
-
);
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
// src/components/ui/textarea.tsx
|
|
910
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
911
|
-
function Textarea({ className, ...props }) {
|
|
912
|
-
return /* @__PURE__ */ jsx22(
|
|
913
|
-
"textarea",
|
|
914
|
-
{
|
|
915
|
-
"data-slot": "textarea",
|
|
916
|
-
className: cn(
|
|
917
|
-
"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",
|
|
918
|
-
className
|
|
919
|
-
),
|
|
920
|
-
...props
|
|
921
|
-
}
|
|
922
|
-
);
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
// src/components/ui/badge.tsx
|
|
926
|
-
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
927
|
-
import { cva as cva2 } from "class-variance-authority";
|
|
928
|
-
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
929
|
-
var badgeVariants = cva2(
|
|
930
|
-
"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",
|
|
931
|
-
{
|
|
932
|
-
variants: {
|
|
933
|
-
variant: {
|
|
934
|
-
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
935
|
-
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
936
|
-
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",
|
|
937
|
-
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
938
|
-
}
|
|
939
|
-
},
|
|
940
|
-
defaultVariants: {
|
|
941
|
-
variant: "default"
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
);
|
|
945
|
-
function Badge2({
|
|
946
|
-
className,
|
|
947
|
-
variant,
|
|
948
|
-
asChild = false,
|
|
949
|
-
...props
|
|
950
|
-
}) {
|
|
951
|
-
const Comp = asChild ? Slot2 : "span";
|
|
952
|
-
return /* @__PURE__ */ jsx23(
|
|
953
|
-
Comp,
|
|
954
|
-
{
|
|
955
|
-
"data-slot": "badge",
|
|
956
|
-
className: cn(badgeVariants({ variant }), className),
|
|
957
|
-
...props
|
|
958
|
-
}
|
|
959
|
-
);
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
// src/components/docs/api/api-playground.tsx
|
|
963
|
-
import { useState as useState8, useMemo } from "react";
|
|
964
|
-
import { Play, Loader2 } from "lucide-react";
|
|
965
|
-
import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
966
|
-
function ApiPlayground({
|
|
967
|
-
method,
|
|
968
|
-
path,
|
|
969
|
-
baseUrl = "",
|
|
970
|
-
headers = {},
|
|
971
|
-
defaultBody,
|
|
972
|
-
pathParams = []
|
|
973
|
-
}) {
|
|
974
|
-
const [loading, setLoading] = useState8(false);
|
|
975
|
-
const [response, setResponse] = useState8(null);
|
|
976
|
-
const [error, setError] = useState8(null);
|
|
977
|
-
const [requestBody, setRequestBody] = useState8(defaultBody || "");
|
|
978
|
-
const initialHeaders = useMemo(() => {
|
|
979
|
-
const cleanHeaders = {};
|
|
980
|
-
Object.entries(headers).forEach(([key, value]) => {
|
|
981
|
-
cleanHeaders[key] = value || "";
|
|
982
|
-
});
|
|
983
|
-
return cleanHeaders;
|
|
984
|
-
}, [headers]);
|
|
985
|
-
const [requestHeaders, setRequestHeaders] = useState8(JSON.stringify(initialHeaders, null, 2));
|
|
986
|
-
const extractedParams = useMemo(() => {
|
|
987
|
-
const params = {};
|
|
988
|
-
const pathParamPattern = /:(\w+)/g;
|
|
989
|
-
let match;
|
|
990
|
-
while ((match = pathParamPattern.exec(path)) !== null) {
|
|
991
|
-
const paramName = match[1];
|
|
992
|
-
const paramConfig = pathParams.find((p) => p.name === paramName);
|
|
993
|
-
if (paramConfig?.example !== void 0) {
|
|
994
|
-
params[paramName] = String(paramConfig.example);
|
|
995
|
-
} else if (paramConfig?.type === "number") {
|
|
996
|
-
params[paramName] = "1";
|
|
997
|
-
} else {
|
|
998
|
-
params[paramName] = "";
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
return params;
|
|
1002
|
-
}, [path, pathParams]);
|
|
1003
|
-
const [pathParamValues, setPathParamValues] = useState8(extractedParams);
|
|
1004
|
-
const buildUrl = () => {
|
|
1005
|
-
let finalPath = path;
|
|
1006
|
-
Object.entries(pathParamValues).forEach(([key, value]) => {
|
|
1007
|
-
finalPath = finalPath.replace(`:${key}`, value);
|
|
1008
|
-
});
|
|
1009
|
-
return `${baseUrl}${finalPath}`;
|
|
1010
|
-
};
|
|
1011
|
-
const handleSend = async () => {
|
|
1012
|
-
setLoading(true);
|
|
1013
|
-
setError(null);
|
|
1014
|
-
setResponse(null);
|
|
1015
|
-
try {
|
|
1016
|
-
const url = buildUrl();
|
|
1017
|
-
const parsedHeaders = JSON.parse(requestHeaders);
|
|
1018
|
-
const options = {
|
|
1019
|
-
method,
|
|
1020
|
-
headers: {
|
|
1021
|
-
"Content-Type": "application/json",
|
|
1022
|
-
...parsedHeaders
|
|
1023
|
-
}
|
|
1024
|
-
};
|
|
1025
|
-
if (method !== "GET" && method !== "DELETE" && requestBody) {
|
|
1026
|
-
options.body = requestBody;
|
|
1027
|
-
}
|
|
1028
|
-
const res = await fetch(url, options);
|
|
1029
|
-
const data = await res.json();
|
|
1030
|
-
setResponse({
|
|
1031
|
-
status: res.status,
|
|
1032
|
-
statusText: res.statusText,
|
|
1033
|
-
headers: Object.fromEntries(res.headers.entries()),
|
|
1034
|
-
body: data
|
|
1035
|
-
});
|
|
1036
|
-
} catch (err) {
|
|
1037
|
-
setError(err instanceof Error ? err.message : "An error occurred");
|
|
1038
|
-
} finally {
|
|
1039
|
-
setLoading(false);
|
|
1040
|
-
}
|
|
1041
|
-
};
|
|
1042
|
-
return /* @__PURE__ */ jsxs16("div", { className: "not-prose border border-border rounded-lg overflow-hidden bg-card/30", children: [
|
|
1043
|
-
/* @__PURE__ */ jsx24("div", { className: "bg-muted/50 px-4 py-2 border-b border-border", children: /* @__PURE__ */ jsx24("h4", { className: "text-sm font-semibold text-foreground", children: "API Playground" }) }),
|
|
1044
|
-
/* @__PURE__ */ jsxs16("div", { className: "p-4 space-y-4", children: [
|
|
1045
|
-
Object.keys(pathParamValues).length > 0 && /* @__PURE__ */ jsxs16("div", { children: [
|
|
1046
|
-
/* @__PURE__ */ jsx24("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Path Parameters" }),
|
|
1047
|
-
/* @__PURE__ */ jsx24("div", { className: "space-y-2", children: Object.entries(pathParamValues).map(([paramName, paramValue]) => {
|
|
1048
|
-
const paramConfig = pathParams.find((p) => p.name === paramName);
|
|
1049
|
-
return /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
1050
|
-
/* @__PURE__ */ jsxs16("span", { className: "text-xs text-muted-foreground min-w-[80px]", children: [
|
|
1051
|
-
":",
|
|
1052
|
-
paramName
|
|
1053
|
-
] }),
|
|
1054
|
-
/* @__PURE__ */ jsx24(
|
|
1055
|
-
Input,
|
|
1056
|
-
{
|
|
1057
|
-
value: paramValue,
|
|
1058
|
-
onChange: (e) => setPathParamValues((prev) => ({ ...prev, [paramName]: e.target.value })),
|
|
1059
|
-
placeholder: paramConfig?.example || paramConfig?.type || "value",
|
|
1060
|
-
className: "font-mono text-sm"
|
|
1061
|
-
}
|
|
1062
|
-
)
|
|
1063
|
-
] }, paramName);
|
|
1064
|
-
}) })
|
|
1065
|
-
] }),
|
|
1066
|
-
/* @__PURE__ */ jsxs16("div", { children: [
|
|
1067
|
-
/* @__PURE__ */ jsx24("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Request URL" }),
|
|
1068
|
-
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
1069
|
-
/* @__PURE__ */ jsx24(Badge2, { variant: "outline", className: "font-mono", children: method }),
|
|
1070
|
-
/* @__PURE__ */ jsx24(Input, { value: buildUrl(), readOnly: true, className: "font-mono text-sm" })
|
|
1071
|
-
] })
|
|
1072
|
-
] }),
|
|
1073
|
-
/* @__PURE__ */ jsxs16("div", { children: [
|
|
1074
|
-
/* @__PURE__ */ jsx24("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Headers (JSON)" }),
|
|
1075
|
-
/* @__PURE__ */ jsx24(
|
|
1076
|
-
Textarea,
|
|
1077
|
-
{
|
|
1078
|
-
value: requestHeaders,
|
|
1079
|
-
onChange: (e) => setRequestHeaders(e.target.value),
|
|
1080
|
-
className: "font-mono text-sm",
|
|
1081
|
-
rows: 4
|
|
1082
|
-
}
|
|
1083
|
-
)
|
|
1084
|
-
] }),
|
|
1085
|
-
method !== "GET" && method !== "DELETE" && /* @__PURE__ */ jsxs16("div", { children: [
|
|
1086
|
-
/* @__PURE__ */ jsx24("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Request Body (JSON)" }),
|
|
1087
|
-
/* @__PURE__ */ jsx24(
|
|
1088
|
-
Textarea,
|
|
1089
|
-
{
|
|
1090
|
-
value: requestBody,
|
|
1091
|
-
onChange: (e) => setRequestBody(e.target.value),
|
|
1092
|
-
className: "font-mono text-sm",
|
|
1093
|
-
rows: 6,
|
|
1094
|
-
placeholder: '{\\n "key": "value"\\n}'
|
|
1095
|
-
}
|
|
1096
|
-
)
|
|
1097
|
-
] }),
|
|
1098
|
-
/* @__PURE__ */ jsx24(Button, { onClick: handleSend, disabled: loading, className: "w-full", children: loading ? /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
1099
|
-
/* @__PURE__ */ jsx24(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1100
|
-
"Sending..."
|
|
1101
|
-
] }) : /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
1102
|
-
/* @__PURE__ */ jsx24(Play, { className: "mr-2 h-4 w-4" }),
|
|
1103
|
-
"Send Request"
|
|
1104
|
-
] }) }),
|
|
1105
|
-
response && /* @__PURE__ */ jsxs16("div", { className: "mt-4", children: [
|
|
1106
|
-
/* @__PURE__ */ jsxs16("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: [
|
|
1107
|
-
"Response (",
|
|
1108
|
-
response.status,
|
|
1109
|
-
" ",
|
|
1110
|
-
response.statusText,
|
|
1111
|
-
")"
|
|
1112
|
-
] }),
|
|
1113
|
-
/* @__PURE__ */ jsx24(CodeBlock, { code: JSON.stringify(response.body, null, 2), language: "json" })
|
|
1114
|
-
] }),
|
|
1115
|
-
error && /* @__PURE__ */ jsx24("div", { className: "mt-4 p-3 bg-red-500/10 border border-red-500/20 rounded-md", children: /* @__PURE__ */ jsx24("p", { className: "text-sm text-red-600 dark:text-red-400", children: error }) })
|
|
1116
|
-
] })
|
|
1117
|
-
] });
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
// src/components/docs/api/api-reference.tsx
|
|
1121
|
-
import { useState as useState9, useEffect as useEffect3 } from "react";
|
|
1122
|
-
import { Loader2 as Loader22 } from "lucide-react";
|
|
1123
|
-
import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1124
|
-
function ApiReference({ spec, parser = "auto", showPlayground = true }) {
|
|
1125
|
-
const [apiSpec, setApiSpec] = useState9(null);
|
|
1126
|
-
const [loading, setLoading] = useState9(true);
|
|
1127
|
-
const [error, setError] = useState9(null);
|
|
1128
|
-
useEffect3(() => {
|
|
1129
|
-
async function loadSpec() {
|
|
1130
|
-
try {
|
|
1131
|
-
const response = await fetch(spec);
|
|
1132
|
-
if (!response.ok) {
|
|
1133
|
-
throw new Error(`Failed to load API spec: ${response.statusText}`);
|
|
1134
|
-
}
|
|
1135
|
-
const data = await response.json();
|
|
1136
|
-
const parsedSpec = parseApiSpec(data, parser);
|
|
1137
|
-
setApiSpec(parsedSpec);
|
|
1138
|
-
} catch (err) {
|
|
1139
|
-
setError(err instanceof Error ? err.message : "Failed to load API spec");
|
|
1140
|
-
} finally {
|
|
1141
|
-
setLoading(false);
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
loadSpec();
|
|
1145
|
-
}, [spec, parser]);
|
|
1146
|
-
const interpolateEnv = (text, env) => {
|
|
1147
|
-
if (!env) return text;
|
|
1148
|
-
return text.replace(/\{(\w+)\}/g, (match, key) => {
|
|
1149
|
-
return env[key] || match;
|
|
1150
|
-
});
|
|
1151
|
-
};
|
|
1152
|
-
if (loading) {
|
|
1153
|
-
return /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-center py-12", children: [
|
|
1154
|
-
/* @__PURE__ */ jsx25(Loader22, { className: "h-6 w-6 animate-spin text-muted-foreground" }),
|
|
1155
|
-
/* @__PURE__ */ jsx25("span", { className: "ml-2 text-muted-foreground", children: "Loading API specification..." })
|
|
1156
|
-
] });
|
|
1157
|
-
}
|
|
1158
|
-
if (error) {
|
|
1159
|
-
return /* @__PURE__ */ jsx25("div", { className: "rounded-lg border border-red-500/20 bg-red-500/10 p-4", children: /* @__PURE__ */ jsxs17("p", { className: "text-sm text-red-600 dark:text-red-400", children: [
|
|
1160
|
-
"Error: ",
|
|
1161
|
-
error
|
|
1162
|
-
] }) });
|
|
1163
|
-
}
|
|
1164
|
-
if (!apiSpec) {
|
|
1165
|
-
return null;
|
|
1166
|
-
}
|
|
1167
|
-
return /* @__PURE__ */ jsxs17("div", { className: "space-y-6", children: [
|
|
1168
|
-
(apiSpec.title || apiSpec.description) && /* @__PURE__ */ jsxs17("div", { className: "mb-8", children: [
|
|
1169
|
-
apiSpec.title && /* @__PURE__ */ jsx25("h2", { className: "text-2xl font-semibold mb-2 text-foreground", children: apiSpec.title }),
|
|
1170
|
-
apiSpec.description && /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: apiSpec.description }),
|
|
1171
|
-
apiSpec.baseUrl && /* @__PURE__ */ jsxs17("div", { className: "mt-4", children: [
|
|
1172
|
-
/* @__PURE__ */ jsx25("p", { className: "text-sm font-semibold text-muted-foreground mb-1", children: "Base URL" }),
|
|
1173
|
-
/* @__PURE__ */ jsx25("code", { className: "text-sm px-2 py-1 bg-muted rounded", children: apiSpec.baseUrl })
|
|
1174
|
-
] })
|
|
1175
|
-
] }),
|
|
1176
|
-
apiSpec.auth && /* @__PURE__ */ jsxs17("div", { className: "rounded-lg border border-border bg-card/30 p-4 mb-6", children: [
|
|
1177
|
-
/* @__PURE__ */ jsx25("h3", { className: "text-lg font-semibold mb-2 text-foreground", children: "Authentication" }),
|
|
1178
|
-
/* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground mb-2", children: apiSpec.auth.description || `This API uses ${apiSpec.auth.type} authentication.` }),
|
|
1179
|
-
apiSpec.auth.type === "bearer" && /* @__PURE__ */ jsx25(
|
|
1180
|
-
CodeBlock,
|
|
1181
|
-
{
|
|
1182
|
-
code: `Authorization: ${apiSpec.auth.tokenPrefix || "Bearer"} {YOUR_TOKEN}`,
|
|
1183
|
-
language: "bash"
|
|
1184
|
-
}
|
|
1185
|
-
),
|
|
1186
|
-
apiSpec.auth.type === "apiKey" && /* @__PURE__ */ jsx25(
|
|
1187
|
-
CodeBlock,
|
|
1188
|
-
{
|
|
1189
|
-
code: `${apiSpec.auth.headerName || "X-API-Key"}: {YOUR_API_KEY}`,
|
|
1190
|
-
language: "bash"
|
|
1191
|
-
}
|
|
1192
|
-
)
|
|
1193
|
-
] }),
|
|
1194
|
-
/* @__PURE__ */ jsx25(Accordion, { type: "single", collapsible: true, className: "space-y-4", children: apiSpec.endpoints.map((endpoint, index) => {
|
|
1195
|
-
const allHeaders = [
|
|
1196
|
-
...apiSpec.globalHeaders || [],
|
|
1197
|
-
...endpoint.headers || []
|
|
1198
|
-
].map((header) => ({
|
|
1199
|
-
...header,
|
|
1200
|
-
value: interpolateEnv(header.value, apiSpec.env)
|
|
1201
|
-
}));
|
|
1202
|
-
return /* @__PURE__ */ jsx25(
|
|
1203
|
-
AccordionItem,
|
|
1204
|
-
{
|
|
1205
|
-
value: `endpoint-${index}`,
|
|
1206
|
-
title: /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-3", children: [
|
|
1207
|
-
/* @__PURE__ */ jsx25(
|
|
1208
|
-
"span",
|
|
1209
|
-
{
|
|
1210
|
-
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"}`,
|
|
1211
|
-
children: endpoint.method
|
|
1212
|
-
}
|
|
1213
|
-
),
|
|
1214
|
-
/* @__PURE__ */ jsx25("code", { className: "text-sm font-mono", children: endpoint.path }),
|
|
1215
|
-
/* @__PURE__ */ jsx25("span", { className: "text-sm text-muted-foreground ml-auto", children: endpoint.title })
|
|
1216
|
-
] }),
|
|
1217
|
-
children: /* @__PURE__ */ jsxs17("div", { className: "space-y-6 pt-4", children: [
|
|
1218
|
-
endpoint.description && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground", children: endpoint.description }),
|
|
1219
|
-
endpoint.pathParams && endpoint.pathParams.length > 0 && /* @__PURE__ */ jsx25(ApiParams, { title: "Path Parameters", params: endpoint.pathParams }),
|
|
1220
|
-
endpoint.queryParams && endpoint.queryParams.length > 0 && /* @__PURE__ */ jsx25(ApiParams, { title: "Query Parameters", params: endpoint.queryParams }),
|
|
1221
|
-
allHeaders.length > 0 && /* @__PURE__ */ jsxs17("div", { children: [
|
|
1222
|
-
/* @__PURE__ */ jsx25("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Headers" }),
|
|
1223
|
-
/* @__PURE__ */ jsx25("div", { className: "space-y-2", children: allHeaders.map((header, idx) => /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
|
|
1224
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
1225
|
-
/* @__PURE__ */ jsx25("code", { className: "text-sm font-mono text-foreground", children: header.name }),
|
|
1226
|
-
/* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: header.value })
|
|
1227
|
-
] }),
|
|
1228
|
-
header.description && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground", children: header.description })
|
|
1229
|
-
] }, idx)) })
|
|
1230
|
-
] }),
|
|
1231
|
-
endpoint.body && /* @__PURE__ */ jsxs17("div", { children: [
|
|
1232
|
-
/* @__PURE__ */ jsx25("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Request Body" }),
|
|
1233
|
-
endpoint.body.description && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground mb-2", children: endpoint.body.description }),
|
|
1234
|
-
endpoint.body.example && /* @__PURE__ */ jsx25(
|
|
1235
|
-
CodeBlock,
|
|
1236
|
-
{
|
|
1237
|
-
code: typeof endpoint.body.example === "string" ? endpoint.body.example : JSON.stringify(endpoint.body.example, null, 2),
|
|
1238
|
-
language: "json"
|
|
1239
|
-
}
|
|
1240
|
-
)
|
|
1241
|
-
] }),
|
|
1242
|
-
/* @__PURE__ */ jsxs17("div", { children: [
|
|
1243
|
-
/* @__PURE__ */ jsx25("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Responses" }),
|
|
1244
|
-
endpoint.successResponse && /* @__PURE__ */ jsx25(
|
|
1245
|
-
ApiResponse,
|
|
1246
|
-
{
|
|
1247
|
-
status: endpoint.successResponse.status,
|
|
1248
|
-
description: endpoint.successResponse.description,
|
|
1249
|
-
example: endpoint.successResponse.example,
|
|
1250
|
-
schema: endpoint.successResponse.schema
|
|
1251
|
-
}
|
|
1252
|
-
),
|
|
1253
|
-
endpoint.errorResponses?.map((response, idx) => /* @__PURE__ */ jsx25(
|
|
1254
|
-
ApiResponse,
|
|
1255
|
-
{
|
|
1256
|
-
status: response.status,
|
|
1257
|
-
description: response.description,
|
|
1258
|
-
example: response.example,
|
|
1259
|
-
schema: response.schema
|
|
1260
|
-
},
|
|
1261
|
-
idx
|
|
1262
|
-
))
|
|
1263
|
-
] }),
|
|
1264
|
-
endpoint.examples && endpoint.examples.length > 0 && /* @__PURE__ */ jsxs17("div", { children: [
|
|
1265
|
-
/* @__PURE__ */ jsx25("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Examples" }),
|
|
1266
|
-
endpoint.examples.map((example, idx) => /* @__PURE__ */ jsxs17("div", { className: "mb-3", children: [
|
|
1267
|
-
/* @__PURE__ */ jsx25("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: example.title }),
|
|
1268
|
-
/* @__PURE__ */ jsx25(CodeBlock, { code: example.code, language: example.language })
|
|
1269
|
-
] }, idx))
|
|
1270
|
-
] }),
|
|
1271
|
-
showPlayground && /* @__PURE__ */ jsx25(
|
|
1272
|
-
ApiPlayground,
|
|
1273
|
-
{
|
|
1274
|
-
method: endpoint.method,
|
|
1275
|
-
path: endpoint.path,
|
|
1276
|
-
baseUrl: apiSpec.baseUrl,
|
|
1277
|
-
headers: Object.fromEntries(allHeaders.map((h) => [h.name, h.value])),
|
|
1278
|
-
pathParams: endpoint.pathParams,
|
|
1279
|
-
defaultBody: endpoint.body?.example ? typeof endpoint.body.example === "string" ? endpoint.body.example : JSON.stringify(endpoint.body.example, null, 2) : void 0
|
|
1280
|
-
}
|
|
1281
|
-
)
|
|
1282
|
-
] })
|
|
1283
|
-
},
|
|
1284
|
-
index
|
|
1285
|
-
);
|
|
1286
|
-
}) })
|
|
1287
|
-
] });
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
export {
|
|
1291
|
-
AccordionItem,
|
|
1292
|
-
Accordion,
|
|
1293
|
-
Badge,
|
|
1294
|
-
Callout,
|
|
1295
|
-
Icon,
|
|
1296
|
-
Card,
|
|
1297
|
-
CardGrid,
|
|
1298
|
-
CodeBlock,
|
|
1299
|
-
Columns,
|
|
1300
|
-
Column,
|
|
1301
|
-
Frame,
|
|
1302
|
-
ImageCard,
|
|
1303
|
-
ImageCardGrid,
|
|
1304
|
-
Image,
|
|
1305
|
-
Math2 as Math,
|
|
1306
|
-
Mermaid,
|
|
1307
|
-
Steps,
|
|
1308
|
-
Step,
|
|
1309
|
-
Tab,
|
|
1310
|
-
Tabs,
|
|
1311
|
-
Tooltip,
|
|
1312
|
-
Video,
|
|
1313
|
-
ApiEndpoint,
|
|
1314
|
-
ApiParams,
|
|
1315
|
-
ApiResponse,
|
|
1316
|
-
buttonVariants,
|
|
1317
|
-
Button,
|
|
1318
|
-
Input,
|
|
1319
|
-
Textarea,
|
|
1320
|
-
badgeVariants,
|
|
1321
|
-
Badge2,
|
|
1322
|
-
ApiPlayground,
|
|
1323
|
-
ApiReference
|
|
1324
|
-
};
|
|
1325
|
-
//# sourceMappingURL=chunk-D5VDVYFY.mjs.map
|