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/mdx-components.js
CHANGED
|
@@ -1,1932 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MDX/mdsvex component map for Specra documentation.
|
|
3
|
+
*
|
|
4
|
+
* In mdsvex, custom components are imported directly in .svx files.
|
|
5
|
+
* This file exports the component map for programmatic use.
|
|
6
|
+
*
|
|
7
|
+
* Usage in .svx files:
|
|
8
|
+
* ```svelte
|
|
9
|
+
* <script>
|
|
10
|
+
* import { Callout, CodeBlock, Tabs, Tab } from 'specra/components'
|
|
11
|
+
* </script>
|
|
12
|
+
*
|
|
13
|
+
* <Callout type="info">This is a callout</Callout>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { Callout, Accordion, AccordionItem, Tabs, Tab, Image, Video, Card, CardGrid, ImageCard, ImageCardGrid, Steps, Step, Icon, Mermaid, Math, Columns, Column, DocBadge, Tooltip, Frame, CodeBlock, ApiEndpoint, ApiParams, ApiResponse, ApiPlayground, ApiReference, } from './components/docs';
|
|
17
|
+
// Re-export all MDX-usable components
|
|
18
|
+
export { Callout, Accordion, AccordionItem, Tabs, Tab, Image, Video, Card, CardGrid, ImageCard, ImageCardGrid, Steps, Step, Icon, Mermaid, Math, Columns, Column, DocBadge, Tooltip, Frame, CodeBlock, ApiEndpoint, ApiParams, ApiResponse, ApiPlayground, ApiReference, };
|
|
19
|
+
/**
|
|
20
|
+
* Component map for passing to layout components that render MDX content.
|
|
21
|
+
*/
|
|
22
|
+
export const mdxComponents = {
|
|
23
|
+
Callout,
|
|
24
|
+
Accordion,
|
|
25
|
+
AccordionItem,
|
|
26
|
+
Tabs,
|
|
27
|
+
Tab,
|
|
28
|
+
Image,
|
|
29
|
+
Video,
|
|
30
|
+
Card,
|
|
31
|
+
CardGrid,
|
|
32
|
+
ImageCard,
|
|
33
|
+
ImageCardGrid,
|
|
34
|
+
Steps,
|
|
35
|
+
Step,
|
|
36
|
+
Icon,
|
|
37
|
+
Mermaid,
|
|
38
|
+
Math,
|
|
39
|
+
Columns,
|
|
40
|
+
Column,
|
|
41
|
+
Badge: DocBadge,
|
|
42
|
+
DocBadge,
|
|
43
|
+
Tooltip,
|
|
44
|
+
Frame,
|
|
45
|
+
CodeBlock,
|
|
46
|
+
ApiEndpoint,
|
|
47
|
+
ApiParams,
|
|
48
|
+
ApiResponse,
|
|
49
|
+
ApiPlayground,
|
|
50
|
+
ApiReference,
|
|
11
51
|
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/mdx-components.tsx
|
|
31
|
-
var mdx_components_exports = {};
|
|
32
|
-
__export(mdx_components_exports, {
|
|
33
|
-
mdxComponents: () => mdxComponents2,
|
|
34
|
-
useMDXComponents: () => useMDXComponents
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(mdx_components_exports);
|
|
37
|
-
|
|
38
|
-
// src/components/docs/callout.tsx
|
|
39
|
-
var import_react = require("react");
|
|
40
|
-
var import_lucide_react = require("lucide-react");
|
|
41
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
-
function Callout({ children, type = "info", title }) {
|
|
43
|
-
const configs = {
|
|
44
|
-
info: {
|
|
45
|
-
icon: import_lucide_react.Info,
|
|
46
|
-
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",
|
|
47
|
-
iconClassName: "text-blue-600 dark:text-blue-400",
|
|
48
|
-
titleClassName: "text-blue-700 dark:text-blue-300",
|
|
49
|
-
defaultTitle: "Info"
|
|
50
|
-
},
|
|
51
|
-
note: {
|
|
52
|
-
icon: import_lucide_react.Info,
|
|
53
|
-
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",
|
|
54
|
-
iconClassName: "text-blue-600 dark:text-blue-400",
|
|
55
|
-
titleClassName: "text-blue-700 dark:text-blue-300",
|
|
56
|
-
defaultTitle: "Note"
|
|
57
|
-
},
|
|
58
|
-
warning: {
|
|
59
|
-
icon: import_lucide_react.AlertTriangle,
|
|
60
|
-
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",
|
|
61
|
-
iconClassName: "text-yellow-600 dark:text-yellow-400",
|
|
62
|
-
titleClassName: "text-yellow-700 dark:text-yellow-300",
|
|
63
|
-
defaultTitle: "Warning"
|
|
64
|
-
},
|
|
65
|
-
success: {
|
|
66
|
-
icon: import_lucide_react.CheckCircle2,
|
|
67
|
-
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",
|
|
68
|
-
iconClassName: "text-green-600 dark:text-green-400",
|
|
69
|
-
titleClassName: "text-green-700 dark:text-green-300",
|
|
70
|
-
defaultTitle: "Success"
|
|
71
|
-
},
|
|
72
|
-
error: {
|
|
73
|
-
icon: import_lucide_react.XCircle,
|
|
74
|
-
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",
|
|
75
|
-
iconClassName: "text-red-600 dark:text-red-400",
|
|
76
|
-
titleClassName: "text-red-700 dark:text-red-300",
|
|
77
|
-
defaultTitle: "Error"
|
|
78
|
-
},
|
|
79
|
-
danger: {
|
|
80
|
-
icon: import_lucide_react.XCircle,
|
|
81
|
-
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",
|
|
82
|
-
iconClassName: "text-red-600 dark:text-red-400",
|
|
83
|
-
titleClassName: "text-red-700 dark:text-red-300",
|
|
84
|
-
defaultTitle: "Danger"
|
|
85
|
-
},
|
|
86
|
-
tip: {
|
|
87
|
-
icon: import_lucide_react.Lightbulb,
|
|
88
|
-
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",
|
|
89
|
-
iconClassName: "text-purple-600 dark:text-purple-400",
|
|
90
|
-
titleClassName: "text-purple-700 dark:text-purple-300",
|
|
91
|
-
defaultTitle: "Tip"
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const config = configs[type];
|
|
95
|
-
const Icon3 = config.icon;
|
|
96
|
-
let _title = title || config.defaultTitle;
|
|
97
|
-
let content = children;
|
|
98
|
-
if (!title && children && typeof children === "object") {
|
|
99
|
-
const childArray = Array.isArray(children) ? children : [children];
|
|
100
|
-
const firstElement = childArray[0];
|
|
101
|
-
if (firstElement && typeof firstElement === "object" && "props" in firstElement) {
|
|
102
|
-
const props = firstElement.props;
|
|
103
|
-
if (props.children && Array.isArray(props.children)) {
|
|
104
|
-
const strongChild = props.children.find(
|
|
105
|
-
(child) => child && typeof child === "object" && child.type === "strong"
|
|
106
|
-
);
|
|
107
|
-
if (strongChild) {
|
|
108
|
-
_title = strongChild.props.children;
|
|
109
|
-
content = childArray.map((child, idx) => {
|
|
110
|
-
if (idx === 0 && (0, import_react.isValidElement)(child)) {
|
|
111
|
-
const newChildren = child.props.children.filter((c) => c !== strongChild);
|
|
112
|
-
const childProps = child.props;
|
|
113
|
-
return (0, import_react.cloneElement)(child, { ...childProps, children: newChildren });
|
|
114
|
-
}
|
|
115
|
-
return child;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `flex gap-3 p-4 rounded-xl border my-2 ${config.className}`, children: [
|
|
122
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-shrink-0 mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon3, { className: `h-5 w-5 ${config.iconClassName}` }) }),
|
|
123
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 space-y-0", children: [
|
|
124
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `font-semibold text-sm ${config.titleClassName}`, children: _title }),
|
|
125
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm leading-relaxed [&>p]:mb-0 [&>p]:text-current", children: content })
|
|
126
|
-
] })
|
|
127
|
-
] });
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// src/components/docs/mdx-primitives.tsx
|
|
131
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
132
|
-
var createMdxPrimitives = (components) => ({
|
|
133
|
-
h1: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { className: "text-3xl font-semibold tracking-tight mb-6 text-foreground", children }),
|
|
134
|
-
h2: ({ children, id }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { id, className: "text-2xl font-semibold tracking-tight mt-10 mb-4 text-foreground scroll-mt-24", children }),
|
|
135
|
-
h3: ({ children, id }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { id, className: "text-xl font-medium tracking-tight mt-8 mb-3 text-foreground scroll-mt-24", children }),
|
|
136
|
-
p: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-base leading-7 text-muted-foreground mb-4", children }),
|
|
137
|
-
code: ({ children, className, meta, ...props }) => {
|
|
138
|
-
const isInline = !className;
|
|
139
|
-
if (isInline) {
|
|
140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { className: "px-1.5 py-0.5 rounded-md bg-muted/50 text-primary font-mono text-[13px] border border-border/50", children });
|
|
141
|
-
}
|
|
142
|
-
const language = className?.replace("language-", "") || "text";
|
|
143
|
-
const filename = meta || void 0;
|
|
144
|
-
const code = String(children).replace(/\n$/, "");
|
|
145
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(components.CodeBlock, { code, language, filename });
|
|
146
|
-
},
|
|
147
|
-
pre: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children }),
|
|
148
|
-
ul: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("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 }),
|
|
149
|
-
ol: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("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 }),
|
|
150
|
-
li: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { className: "leading-7 [&>p]:mb-0 [&>p]:inline", children }),
|
|
151
|
-
a: ({ children, href }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
152
|
-
"a",
|
|
153
|
-
{
|
|
154
|
-
href,
|
|
155
|
-
className: "text-primary hover:underline font-medium",
|
|
156
|
-
target: href?.startsWith("http") ? "_blank" : void 0,
|
|
157
|
-
rel: href?.startsWith("http") ? "noopener noreferrer" : void 0,
|
|
158
|
-
children
|
|
159
|
-
}
|
|
160
|
-
),
|
|
161
|
-
blockquote: ({ children }) => {
|
|
162
|
-
const childrenArray = Array.isArray(children) ? children : [children];
|
|
163
|
-
const firstChild = childrenArray[0];
|
|
164
|
-
let textContent = "";
|
|
165
|
-
if (firstChild && typeof firstChild === "object" && "props" in firstChild) {
|
|
166
|
-
const props = firstChild.props;
|
|
167
|
-
if (props.children) {
|
|
168
|
-
const text = Array.isArray(props.children) ? props.children.join("") : String(props.children);
|
|
169
|
-
textContent = text;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
const alertMatch = textContent.match(/^\[!(INFO|TIP|WARNING|SUCCESS|ERROR)\]/);
|
|
173
|
-
if (alertMatch) {
|
|
174
|
-
const type = alertMatch[1].toLowerCase();
|
|
175
|
-
const processChildren = (node) => {
|
|
176
|
-
if (typeof node === "string") {
|
|
177
|
-
return node.replace(/^\[!(INFO|TIP|WARNING|SUCCESS|ERROR)\]\s*\n?/, "");
|
|
178
|
-
}
|
|
179
|
-
if (node && typeof node === "object" && "props" in node) {
|
|
180
|
-
return {
|
|
181
|
-
...node,
|
|
182
|
-
props: {
|
|
183
|
-
...node.props,
|
|
184
|
-
children: Array.isArray(node.props.children) ? node.props.children.map(processChildren) : processChildren(node.props.children)
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
return node;
|
|
189
|
-
};
|
|
190
|
-
const cleanedChildren = Array.isArray(children) ? children.map(processChildren) : processChildren(children);
|
|
191
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Callout, { type, children: cleanedChildren });
|
|
192
|
-
}
|
|
193
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("blockquote", { className: "border-l-4 border-primary/50 bg-muted/30 pl-4 pr-4 py-3 my-6 rounded-r-lg", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-muted-foreground italic [&>p]:mb-0", children }) });
|
|
194
|
-
},
|
|
195
|
-
table: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "overflow-x-auto mb-6 rounded-xl border border-border", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("table", { className: "min-w-full border-collapse", children }) }),
|
|
196
|
-
th: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("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 }),
|
|
197
|
-
td: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "border-b border-r border-border px-4 py-2 text-muted-foreground last:border-r-0", children })
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// src/components/docs/video.tsx
|
|
201
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
202
|
-
function Video({
|
|
203
|
-
src,
|
|
204
|
-
caption,
|
|
205
|
-
autoplay = false,
|
|
206
|
-
loop = false,
|
|
207
|
-
muted = false,
|
|
208
|
-
controls = true,
|
|
209
|
-
poster
|
|
210
|
-
}) {
|
|
211
|
-
const isYouTube = src.includes("youtube.com") || src.includes("youtu.be");
|
|
212
|
-
const isVimeo = src.includes("vimeo.com");
|
|
213
|
-
const getYouTubeId = (url) => {
|
|
214
|
-
const match = url.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/);
|
|
215
|
-
return match ? match[1] : null;
|
|
216
|
-
};
|
|
217
|
-
const getVimeoId = (url) => {
|
|
218
|
-
const match = url.match(/vimeo\.com\/(\d+)/);
|
|
219
|
-
return match ? match[1] : null;
|
|
220
|
-
};
|
|
221
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("figure", { className: "my-6", children: [
|
|
222
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "relative rounded-xl border border-border overflow-hidden bg-muted/30", children: isYouTube ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "relative w-full", style: { paddingBottom: "56.25%" }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
223
|
-
"iframe",
|
|
224
|
-
{
|
|
225
|
-
className: "absolute top-0 left-0 w-full h-full",
|
|
226
|
-
src: `https://www.youtube.com/embed/${getYouTubeId(src)}${autoplay ? "?autoplay=1" : ""}`,
|
|
227
|
-
title: "YouTube video",
|
|
228
|
-
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
229
|
-
allowFullScreen: true
|
|
230
|
-
}
|
|
231
|
-
) }) : isVimeo ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "relative w-full", style: { paddingBottom: "56.25%" }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
232
|
-
"iframe",
|
|
233
|
-
{
|
|
234
|
-
className: "absolute top-0 left-0 w-full h-full",
|
|
235
|
-
src: `https://player.vimeo.com/video/${getVimeoId(src)}${autoplay ? "?autoplay=1" : ""}`,
|
|
236
|
-
title: "Vimeo video",
|
|
237
|
-
allow: "autoplay; fullscreen; picture-in-picture",
|
|
238
|
-
allowFullScreen: true
|
|
239
|
-
}
|
|
240
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
241
|
-
"video",
|
|
242
|
-
{
|
|
243
|
-
src,
|
|
244
|
-
controls,
|
|
245
|
-
autoPlay: autoplay,
|
|
246
|
-
loop,
|
|
247
|
-
muted,
|
|
248
|
-
poster,
|
|
249
|
-
className: "w-full h-auto",
|
|
250
|
-
children: "Your browser does not support the video tag."
|
|
251
|
-
}
|
|
252
|
-
) }),
|
|
253
|
-
caption && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
254
|
-
] });
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// src/components/docs/card.tsx
|
|
258
|
-
var import_lucide_react2 = require("lucide-react");
|
|
259
|
-
var import_link = __toESM(require("next/link"));
|
|
260
|
-
|
|
261
|
-
// src/components/docs/icon.tsx
|
|
262
|
-
var LucideIcons = __toESM(require("lucide-react"));
|
|
263
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
264
|
-
function Icon({ icon, iconType = "regular", color, size = 20, className = "" }) {
|
|
265
|
-
if (typeof icon !== "string") {
|
|
266
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `inline-flex items-center ${className}`, style: { color }, children: icon });
|
|
267
|
-
}
|
|
268
|
-
if (icon.startsWith("http") || icon.startsWith("/")) {
|
|
269
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
270
|
-
"img",
|
|
271
|
-
{
|
|
272
|
-
src: icon,
|
|
273
|
-
alt: "",
|
|
274
|
-
width: size,
|
|
275
|
-
height: size,
|
|
276
|
-
className: `inline-block ${className}`,
|
|
277
|
-
style: { color }
|
|
278
|
-
}
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
if (icon.startsWith("fa-")) {
|
|
282
|
-
const faClass = `fa-${iconType} ${icon}`;
|
|
283
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
284
|
-
"i",
|
|
285
|
-
{
|
|
286
|
-
className: `${faClass} ${className}`,
|
|
287
|
-
style: { fontSize: size, color },
|
|
288
|
-
"aria-hidden": "true"
|
|
289
|
-
}
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
const iconName = icon.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
293
|
-
const LucideIcon = LucideIcons[iconName];
|
|
294
|
-
if (LucideIcon) {
|
|
295
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
296
|
-
LucideIcon,
|
|
297
|
-
{
|
|
298
|
-
size,
|
|
299
|
-
className: `inline-block ${className}`,
|
|
300
|
-
style: { color },
|
|
301
|
-
"aria-hidden": "true"
|
|
302
|
-
}
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: `inline-flex items-center font-mono text-xs ${className}`, style: { color }, children: [
|
|
306
|
-
"[",
|
|
307
|
-
icon,
|
|
308
|
-
"]"
|
|
309
|
-
] });
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// src/components/docs/card.tsx
|
|
313
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
314
|
-
function Card({ title, description, href, icon, children, external = false }) {
|
|
315
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
316
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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__ */ (0, import_jsx_runtime5.jsx)(Icon, { icon, size: 20 }) : icon }),
|
|
317
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
318
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: `font-semibold text-foreground mb-1 no-underline ${href ? "group-hover:text-primary transition-colors" : ""}`, children: title }),
|
|
319
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm text-muted-foreground line-clamp-2 no-underline", children: description }),
|
|
320
|
-
children && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mt-2 text-sm text-muted-foreground no-underline", children })
|
|
321
|
-
] }),
|
|
322
|
-
href && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "shrink-0 self-start mt-1", children: external ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ExternalLink, { className: "h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ArrowRight, { className: "h-4 w-4 text-muted-foreground group-hover:text-primary group-hover:translate-x-1 transition-all" }) })
|
|
323
|
-
] }) });
|
|
324
|
-
if (href) {
|
|
325
|
-
const Component = external ? "a" : import_link.default;
|
|
326
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
327
|
-
Component,
|
|
328
|
-
{
|
|
329
|
-
href,
|
|
330
|
-
className: "card-link group block p-4 rounded-xl border border-border hover:border-primary/50 hover:bg-muted/50 transition-all",
|
|
331
|
-
...external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
332
|
-
children: content
|
|
333
|
-
}
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "p-4 rounded-xl border border-border bg-muted/30 no-underline", children: content });
|
|
337
|
-
}
|
|
338
|
-
function CardGrid({ children, cols = 2 }) {
|
|
339
|
-
const gridCols = {
|
|
340
|
-
1: "grid-cols-1",
|
|
341
|
-
2: "grid-cols-1 md:grid-cols-2",
|
|
342
|
-
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
343
|
-
};
|
|
344
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `grid ${gridCols[cols]} gap-4 my-6`, children });
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// src/components/docs/image-card.tsx
|
|
348
|
-
var import_image = __toESM(require("next/image"));
|
|
349
|
-
var import_link2 = __toESM(require("next/link"));
|
|
350
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
351
|
-
function ImageCard({
|
|
352
|
-
src,
|
|
353
|
-
alt,
|
|
354
|
-
title,
|
|
355
|
-
description,
|
|
356
|
-
href,
|
|
357
|
-
external = false,
|
|
358
|
-
aspectRatio = "video"
|
|
359
|
-
}) {
|
|
360
|
-
const aspectRatios = {
|
|
361
|
-
square: "aspect-square",
|
|
362
|
-
video: "aspect-video",
|
|
363
|
-
portrait: "aspect-[3/4]"
|
|
364
|
-
};
|
|
365
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-0 p-0", children: [
|
|
366
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `w-full ${aspectRatios[aspectRatio]} overflow-hidden ${title || description ? "rounded-t-xl" : "rounded-xl"} bg-muted relative`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
367
|
-
import_image.default,
|
|
368
|
-
{
|
|
369
|
-
src,
|
|
370
|
-
alt,
|
|
371
|
-
fill: true,
|
|
372
|
-
sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw",
|
|
373
|
-
className: "object-cover transition-transform duration-300 group-hover:scale-105"
|
|
374
|
-
}
|
|
375
|
-
) }),
|
|
376
|
-
(title || description) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "p-3 flex flex-col gap-1", children: [
|
|
377
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: `font-semibold text-foreground mb-0 no-underline ${href ? "group-hover:text-primary transition-colors" : ""}`, children: title }),
|
|
378
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm text-muted-foreground line-clamp-2 no-underline mb-0", children: description })
|
|
379
|
-
] })
|
|
380
|
-
] });
|
|
381
|
-
if (href) {
|
|
382
|
-
const Component = external ? "a" : import_link2.default;
|
|
383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
384
|
-
Component,
|
|
385
|
-
{
|
|
386
|
-
href,
|
|
387
|
-
className: "image-card-link group block rounded-xl border border-border hover:border-primary/50 hover:shadow-lg transition-all overflow-hidden p-0",
|
|
388
|
-
...external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
389
|
-
children: content
|
|
390
|
-
}
|
|
391
|
-
);
|
|
392
|
-
}
|
|
393
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "block rounded-xl border border-border overflow-hidden bg-card p-0", children: content });
|
|
394
|
-
}
|
|
395
|
-
function ImageCardGrid({ children, cols = 3 }) {
|
|
396
|
-
const gridCols = {
|
|
397
|
-
1: "grid-cols-1",
|
|
398
|
-
2: "grid-cols-1 md:grid-cols-2",
|
|
399
|
-
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
400
|
-
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
|
|
401
|
-
};
|
|
402
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `grid ${gridCols[cols]} gap-4 my-6`, children });
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
// src/components/docs/steps.tsx
|
|
406
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
407
|
-
function Steps({ children }) {
|
|
408
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "my-6 ml-4 space-y-6 [counter-reset:step]", children });
|
|
409
|
-
}
|
|
410
|
-
function Step({ title, children }) {
|
|
411
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("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: [
|
|
412
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: title }) }),
|
|
413
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "prose prose-sm dark:prose-invert max-w-none [&>*:last-child]:mb-0", children })
|
|
414
|
-
] });
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// src/components/docs/columns.tsx
|
|
418
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
419
|
-
function Columns({ children, cols = { sm: 1, md: 2, lg: 3 } }) {
|
|
420
|
-
const colClasses = {
|
|
421
|
-
1: "grid-cols-1",
|
|
422
|
-
2: "grid-cols-2",
|
|
423
|
-
3: "grid-cols-3",
|
|
424
|
-
4: "grid-cols-4"
|
|
425
|
-
};
|
|
426
|
-
const smClass = cols.sm ? colClasses[cols.sm] : "grid-cols-1";
|
|
427
|
-
const mdClass = cols.md ? `md:${colClasses[cols.md]}` : "";
|
|
428
|
-
const lgClass = cols.lg ? `lg:${colClasses[cols.lg]}` : "";
|
|
429
|
-
const xlClass = cols.xl ? `xl:${colClasses[cols.xl]}` : "";
|
|
430
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `grid ${smClass} ${mdClass} ${lgClass} ${xlClass} gap-4 my-6`, children });
|
|
431
|
-
}
|
|
432
|
-
function Column({ children, span = 1 }) {
|
|
433
|
-
const spanClass = {
|
|
434
|
-
1: "col-span-1",
|
|
435
|
-
2: "col-span-2",
|
|
436
|
-
3: "col-span-3",
|
|
437
|
-
4: "col-span-4"
|
|
438
|
-
};
|
|
439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: spanClass[span], children });
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// src/components/docs/badge.tsx
|
|
443
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
444
|
-
function Badge({ children, variant = "default" }) {
|
|
445
|
-
const variants = {
|
|
446
|
-
default: "bg-muted text-foreground border-border",
|
|
447
|
-
success: "bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20",
|
|
448
|
-
warning: "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20",
|
|
449
|
-
error: "bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20",
|
|
450
|
-
info: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20"
|
|
451
|
-
};
|
|
452
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
453
|
-
"span",
|
|
454
|
-
{
|
|
455
|
-
className: `inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium border ${variants[variant]}`,
|
|
456
|
-
children
|
|
457
|
-
}
|
|
458
|
-
);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// src/components/docs/tooltip.tsx
|
|
462
|
-
var import_react2 = require("react");
|
|
463
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
464
|
-
function Tooltip({ children, content, position = "top" }) {
|
|
465
|
-
const [isVisible, setIsVisible] = (0, import_react2.useState)(false);
|
|
466
|
-
const positions = {
|
|
467
|
-
top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
468
|
-
bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
|
|
469
|
-
left: "right-full top-1/2 -translate-y-1/2 mr-2",
|
|
470
|
-
right: "left-full top-1/2 -translate-y-1/2 ml-2"
|
|
471
|
-
};
|
|
472
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
473
|
-
"span",
|
|
474
|
-
{
|
|
475
|
-
className: "relative inline-flex underline decoration-dotted cursor-help",
|
|
476
|
-
onMouseEnter: () => setIsVisible(true),
|
|
477
|
-
onMouseLeave: () => setIsVisible(false),
|
|
478
|
-
children: [
|
|
479
|
-
children,
|
|
480
|
-
isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
481
|
-
"span",
|
|
482
|
-
{
|
|
483
|
-
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`,
|
|
484
|
-
children: content
|
|
485
|
-
}
|
|
486
|
-
)
|
|
487
|
-
]
|
|
488
|
-
}
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// src/components/docs/frame.tsx
|
|
493
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
494
|
-
function Frame({ src, title = "Embedded content", height = 500, width = "100%" }) {
|
|
495
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "my-6 rounded-xl border border-border overflow-hidden bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
496
|
-
"iframe",
|
|
497
|
-
{
|
|
498
|
-
src,
|
|
499
|
-
title,
|
|
500
|
-
width,
|
|
501
|
-
height,
|
|
502
|
-
className: "w-full",
|
|
503
|
-
loading: "lazy",
|
|
504
|
-
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups"
|
|
505
|
-
}
|
|
506
|
-
) });
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
// src/components/docs/code-block.tsx
|
|
510
|
-
var import_react3 = require("react");
|
|
511
|
-
var import_lucide_react3 = require("lucide-react");
|
|
512
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
513
|
-
function CodeBlock({ code, language, filename }) {
|
|
514
|
-
const [copied, setCopied] = (0, import_react3.useState)(false);
|
|
515
|
-
const handleCopy = async () => {
|
|
516
|
-
await navigator.clipboard.writeText(code);
|
|
517
|
-
setCopied(true);
|
|
518
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
519
|
-
};
|
|
520
|
-
const highlightCode = (code2, lang) => {
|
|
521
|
-
const lines = code2.split("\n");
|
|
522
|
-
return lines.map((line, i) => {
|
|
523
|
-
const isDeletion = line.startsWith("-");
|
|
524
|
-
const isAddition = line.startsWith("+");
|
|
525
|
-
const isDiff = isDeletion || isAddition;
|
|
526
|
-
const diffBgClass = isDeletion ? "bg-red-500/5 dark:bg-red-500/10" : isAddition ? "bg-green-500/5 dark:bg-green-500/10" : "";
|
|
527
|
-
const diffMarkerClass = isDeletion ? "text-red-600 dark:text-red-400" : isAddition ? "text-green-600 dark:text-green-400" : "";
|
|
528
|
-
const tokens = [];
|
|
529
|
-
let currentPos = 0;
|
|
530
|
-
const patterns = [
|
|
531
|
-
{ type: "comment", regex: /(\/\/.*$|\/\*[\s\S]*?\*\/|#.*$)/ },
|
|
532
|
-
{ type: "string", regex: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`)/ },
|
|
533
|
-
{
|
|
534
|
-
type: "keyword",
|
|
535
|
-
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/
|
|
536
|
-
},
|
|
537
|
-
{ type: "operator", regex: /([+\-*/%=<>!&|^~?:]+)/ },
|
|
538
|
-
{ type: "number", regex: /\b(0x[a-fA-F0-9]+|0b[01]+|\d+\.?\d*(?:e[+-]?\d+)?)\b/ },
|
|
539
|
-
{ type: "function", regex: /\b([a-zA-Z_$][\w$]*)\s*(?=\()/ },
|
|
540
|
-
{ type: "property", regex: /\.([a-zA-Z_$][\w$]*)/ },
|
|
541
|
-
{ type: "punctuation", regex: /([{}[\]();,])/ }
|
|
542
|
-
];
|
|
543
|
-
while (currentPos < line.length) {
|
|
544
|
-
let matched = false;
|
|
545
|
-
for (const { type, regex } of patterns) {
|
|
546
|
-
const match = line.slice(currentPos).match(regex);
|
|
547
|
-
if (match && match.index === 0) {
|
|
548
|
-
tokens.push({ type, value: match[0] });
|
|
549
|
-
currentPos += match[0].length;
|
|
550
|
-
matched = true;
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
if (!matched) {
|
|
555
|
-
const nextSpecialChar = line.slice(currentPos).search(/["'`/\w.+\-*/%=<>!&|^~?:;,()[\]{}#]/);
|
|
556
|
-
if (nextSpecialChar === -1) {
|
|
557
|
-
tokens.push({ type: "text", value: line.slice(currentPos) });
|
|
558
|
-
break;
|
|
559
|
-
} else if (nextSpecialChar > 0) {
|
|
560
|
-
tokens.push({ type: "text", value: line.slice(currentPos, currentPos + nextSpecialChar) });
|
|
561
|
-
currentPos += nextSpecialChar;
|
|
562
|
-
} else {
|
|
563
|
-
tokens.push({ type: "text", value: line[currentPos] });
|
|
564
|
-
currentPos++;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `table-row ${diffBgClass}`, children: [
|
|
569
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "table-cell pr-4 text-right select-none text-muted-foreground/40 w-8 align-top", children: i + 1 }),
|
|
570
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "table-cell align-top", children: tokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\xA0" }) : tokens.map((token, j) => {
|
|
571
|
-
if (j === 0 && isDiff && token.value.length > 0 && (token.value[0] === "+" || token.value[0] === "-")) {
|
|
572
|
-
const marker = token.value[0];
|
|
573
|
-
const rest = token.value.slice(1);
|
|
574
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
575
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `${diffMarkerClass} font-bold`, children: marker }),
|
|
576
|
-
rest && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `token-${token.type}`, children: rest })
|
|
577
|
-
] }, j);
|
|
578
|
-
}
|
|
579
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `token-${token.type}`, children: token.value }, j);
|
|
580
|
-
}) })
|
|
581
|
-
] }, i);
|
|
582
|
-
});
|
|
583
|
-
};
|
|
584
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative group my-2", children: [
|
|
585
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
|
|
586
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
587
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
588
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-3 h-3 rounded-full bg-red-500/80 dark:bg-red-500/60" }),
|
|
589
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-3 h-3 rounded-full bg-yellow-500/80 dark:bg-yellow-500/60" }),
|
|
590
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-3 h-3 rounded-full bg-green-500/80 dark:bg-green-500/60" })
|
|
591
|
-
] }),
|
|
592
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-xs font-mono text-foreground", children: filename || "Code" })
|
|
593
|
-
] }),
|
|
594
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
595
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-xs text-muted-foreground/60 font-mono uppercase tracking-wide", children: language }),
|
|
596
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
597
|
-
"button",
|
|
598
|
-
{
|
|
599
|
-
onClick: handleCopy,
|
|
600
|
-
className: "p-1.5 rounded-md hover:bg-muted/50 transition-colors",
|
|
601
|
-
"aria-label": "Copy code",
|
|
602
|
-
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Check, { className: "h-4 w-4 text-green-400" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Copy, { className: "h-4 w-4 text-muted-foreground" })
|
|
603
|
-
}
|
|
604
|
-
)
|
|
605
|
-
] })
|
|
606
|
-
] }),
|
|
607
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "bg-gray-200/50 dark:bg-[#0d1117] rounded-b-xl overflow-x-auto border border-border/50", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("pre", { className: "p-2 text-[13px] font-mono leading-relaxed text-gray-800 dark:text-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { className: "table w-full", children: highlightCode(code, language) }) }) })
|
|
608
|
-
] });
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
// src/components/docs/accordion.tsx
|
|
612
|
-
var React = __toESM(require("react"));
|
|
613
|
-
var import_lucide_react4 = require("lucide-react");
|
|
614
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
615
|
-
function AccordionItem({ title, children, defaultOpen = false }) {
|
|
616
|
-
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
617
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "border border-border rounded-xl overflow-hidden mb-2", children: [
|
|
618
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
619
|
-
"button",
|
|
620
|
-
{
|
|
621
|
-
onClick: () => setIsOpen(!isOpen),
|
|
622
|
-
className: "w-full flex items-center justify-between p-4 text-left bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
623
|
-
children: [
|
|
624
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-foreground", children: title }),
|
|
625
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
626
|
-
import_lucide_react4.ChevronDown,
|
|
627
|
-
{
|
|
628
|
-
className: `h-5 w-5 text-muted-foreground transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
629
|
-
}
|
|
630
|
-
)
|
|
631
|
-
]
|
|
632
|
-
}
|
|
633
|
-
),
|
|
634
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "p-4 border-t border-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "prose prose-sm dark:prose-invert max-w-none [&>*:last-child]:mb-0", children }) })
|
|
635
|
-
] });
|
|
636
|
-
}
|
|
637
|
-
function Accordion({ children, type = "multiple", className }) {
|
|
638
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: className || "my-6 space-y-2", children });
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
// src/components/docs/tabs.tsx
|
|
642
|
-
var import_react4 = require("react");
|
|
643
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
644
|
-
function Tab({ children }) {
|
|
645
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
|
|
646
|
-
}
|
|
647
|
-
function Tabs({ children, defaultValue }) {
|
|
648
|
-
const tabs = import_react4.Children.toArray(children).filter(import_react4.isValidElement);
|
|
649
|
-
const firstTabLabel = tabs[0]?.props.label || "";
|
|
650
|
-
const [activeTab, setActiveTab] = (0, import_react4.useState)(defaultValue || firstTabLabel);
|
|
651
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "my-6", children: [
|
|
652
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center gap-1 border-b border-border mb-4", children: tabs.map((tab) => {
|
|
653
|
-
const label = tab.props.label;
|
|
654
|
-
const isActive = activeTab === label;
|
|
655
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
656
|
-
"button",
|
|
657
|
-
{
|
|
658
|
-
onClick: () => setActiveTab(label),
|
|
659
|
-
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"}`,
|
|
660
|
-
children: label
|
|
661
|
-
},
|
|
662
|
-
label
|
|
663
|
-
);
|
|
664
|
-
}) }),
|
|
665
|
-
tabs.map((tab) => {
|
|
666
|
-
const label = tab.props.label;
|
|
667
|
-
if (activeTab !== label) return null;
|
|
668
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "prose prose-slate dark:prose-invert max-w-none [&>*:first-child]:mt-0", children: tab.props.children }, label);
|
|
669
|
-
})
|
|
670
|
-
] });
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
// src/components/docs/image.tsx
|
|
674
|
-
var import_image2 = __toESM(require("next/image"));
|
|
675
|
-
var import_react5 = require("react");
|
|
676
|
-
var import_lucide_react5 = require("lucide-react");
|
|
677
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
678
|
-
function Image({ src, alt, caption, width, height, zoom = true }) {
|
|
679
|
-
const [isZoomed, setIsZoomed] = (0, import_react5.useState)(false);
|
|
680
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
681
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("figure", { className: "my-6", children: [
|
|
682
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative group rounded-xl border border-border overflow-hidden bg-muted/30", children: [
|
|
683
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
684
|
-
import_image2.default,
|
|
685
|
-
{
|
|
686
|
-
src,
|
|
687
|
-
alt,
|
|
688
|
-
width: width || 1200,
|
|
689
|
-
height: height || 675,
|
|
690
|
-
className: "w-full h-auto"
|
|
691
|
-
}
|
|
692
|
-
),
|
|
693
|
-
zoom && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
694
|
-
"button",
|
|
695
|
-
{
|
|
696
|
-
onClick: () => setIsZoomed(true),
|
|
697
|
-
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",
|
|
698
|
-
"aria-label": "Zoom image",
|
|
699
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.ZoomIn, { className: "h-4 w-4 text-foreground" })
|
|
700
|
-
}
|
|
701
|
-
)
|
|
702
|
-
] }),
|
|
703
|
-
caption && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
704
|
-
] }),
|
|
705
|
-
isZoomed && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
706
|
-
"div",
|
|
707
|
-
{
|
|
708
|
-
className: "fixed inset-0 z-50 bg-background/95 backdrop-blur-sm flex items-center justify-center p-4",
|
|
709
|
-
onClick: () => setIsZoomed(false),
|
|
710
|
-
children: [
|
|
711
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
712
|
-
"button",
|
|
713
|
-
{
|
|
714
|
-
onClick: () => setIsZoomed(false),
|
|
715
|
-
className: "absolute top-4 right-4 p-2 rounded-md bg-muted hover:bg-muted/80 transition-colors",
|
|
716
|
-
"aria-label": "Close",
|
|
717
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.X, { className: "h-5 w-5 text-foreground" })
|
|
718
|
-
}
|
|
719
|
-
),
|
|
720
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "max-w-7xl max-h-[90vh] overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
721
|
-
import_image2.default,
|
|
722
|
-
{
|
|
723
|
-
src,
|
|
724
|
-
alt,
|
|
725
|
-
width: width || 1920,
|
|
726
|
-
height: height || 1080,
|
|
727
|
-
className: "w-full h-auto"
|
|
728
|
-
}
|
|
729
|
-
) })
|
|
730
|
-
]
|
|
731
|
-
}
|
|
732
|
-
)
|
|
733
|
-
] });
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
// src/components/docs/mermaid.tsx
|
|
737
|
-
var import_react6 = require("react");
|
|
738
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
739
|
-
function Mermaid({ chart, caption }) {
|
|
740
|
-
const containerRef = (0, import_react6.useRef)(null);
|
|
741
|
-
const [error, setError] = (0, import_react6.useState)(null);
|
|
742
|
-
(0, import_react6.useEffect)(() => {
|
|
743
|
-
const renderChart = async () => {
|
|
744
|
-
try {
|
|
745
|
-
const mermaid = (await import("mermaid")).default;
|
|
746
|
-
mermaid.initialize({
|
|
747
|
-
startOnLoad: false,
|
|
748
|
-
theme: document.documentElement.classList.contains("dark") ? "dark" : "default",
|
|
749
|
-
securityLevel: "loose",
|
|
750
|
-
fontFamily: "inherit"
|
|
751
|
-
});
|
|
752
|
-
if (containerRef.current) {
|
|
753
|
-
const id = `mermaid-${Math.random().toString(36).substr(2, 9)}`;
|
|
754
|
-
const { svg } = await mermaid.render(id, chart);
|
|
755
|
-
containerRef.current.innerHTML = svg;
|
|
756
|
-
}
|
|
757
|
-
} catch (err) {
|
|
758
|
-
console.error("Mermaid rendering error:", err);
|
|
759
|
-
setError(err instanceof Error ? err.message : "Failed to render diagram");
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
renderChart();
|
|
763
|
-
const observer = new MutationObserver((mutations) => {
|
|
764
|
-
mutations.forEach((mutation) => {
|
|
765
|
-
if (mutation.attributeName === "class") {
|
|
766
|
-
renderChart();
|
|
767
|
-
}
|
|
768
|
-
});
|
|
769
|
-
});
|
|
770
|
-
observer.observe(document.documentElement, { attributes: true });
|
|
771
|
-
return () => observer.disconnect();
|
|
772
|
-
}, [chart]);
|
|
773
|
-
if (error) {
|
|
774
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "my-6 p-4 rounded-xl border border-red-500/50 bg-red-500/10", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "text-sm text-red-600 dark:text-red-400 font-mono", children: [
|
|
775
|
-
"Mermaid Error: ",
|
|
776
|
-
error
|
|
777
|
-
] }) });
|
|
778
|
-
}
|
|
779
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("figure", { className: "my-6", children: [
|
|
780
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
781
|
-
"div",
|
|
782
|
-
{
|
|
783
|
-
ref: containerRef,
|
|
784
|
-
className: "flex justify-center items-center p-6 rounded-xl border border-border bg-muted/30 overflow-x-auto"
|
|
785
|
-
}
|
|
786
|
-
),
|
|
787
|
-
caption && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("figcaption", { className: "mt-2 text-center text-sm text-muted-foreground italic", children: caption })
|
|
788
|
-
] });
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
// src/components/docs/math.tsx
|
|
792
|
-
var import_react7 = require("react");
|
|
793
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
794
|
-
function Math2({ children, block = false }) {
|
|
795
|
-
const containerRef = (0, import_react7.useRef)(null);
|
|
796
|
-
(0, import_react7.useEffect)(() => {
|
|
797
|
-
const renderMath = async () => {
|
|
798
|
-
try {
|
|
799
|
-
const katex = (await import("katex")).default;
|
|
800
|
-
if (containerRef.current) {
|
|
801
|
-
katex.render(children, containerRef.current, {
|
|
802
|
-
throwOnError: false,
|
|
803
|
-
displayMode: block
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
} catch (err) {
|
|
807
|
-
console.error("KaTeX rendering error:", err);
|
|
808
|
-
if (containerRef.current) {
|
|
809
|
-
containerRef.current.textContent = children;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
renderMath();
|
|
814
|
-
}, [children, block]);
|
|
815
|
-
if (block) {
|
|
816
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
817
|
-
"div",
|
|
818
|
-
{
|
|
819
|
-
ref: containerRef,
|
|
820
|
-
className: "my-6 overflow-x-auto text-center"
|
|
821
|
-
}
|
|
822
|
-
);
|
|
823
|
-
}
|
|
824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { ref: containerRef, className: "inline-block" });
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
// src/components/docs/api/api-endpoint.tsx
|
|
828
|
-
var import_react8 = require("react");
|
|
829
|
-
var import_lucide_react6 = require("lucide-react");
|
|
830
|
-
|
|
831
|
-
// src/lib/utils.ts
|
|
832
|
-
var import_clsx = require("clsx");
|
|
833
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
834
|
-
function cn(...inputs) {
|
|
835
|
-
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
// src/components/docs/api/api-endpoint.tsx
|
|
839
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
840
|
-
var methodColors = {
|
|
841
|
-
GET: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
842
|
-
POST: "bg-green-500/10 text-green-600 dark:text-green-400",
|
|
843
|
-
PUT: "bg-orange-500/10 text-orange-600 dark:text-orange-400",
|
|
844
|
-
PATCH: "bg-purple-500/10 text-purple-600 dark:text-purple-400",
|
|
845
|
-
DELETE: "bg-red-500/10 text-red-600 dark:text-red-400"
|
|
846
|
-
};
|
|
847
|
-
function ApiEndpoint({ method, path, summary, children, defaultOpen = false }) {
|
|
848
|
-
const [isOpen, setIsOpen] = (0, import_react8.useState)(defaultOpen);
|
|
849
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "not-prose mb-4 rounded-xl border border-border overflow-hidden", children: [
|
|
850
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
851
|
-
"button",
|
|
852
|
-
{
|
|
853
|
-
onClick: () => setIsOpen(!isOpen),
|
|
854
|
-
className: "w-full flex items-center gap-3 px-4 py-3 text-left bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
855
|
-
children: [
|
|
856
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
857
|
-
"span",
|
|
858
|
-
{
|
|
859
|
-
className: cn(
|
|
860
|
-
"text-xs font-semibold px-2 py-0.5 rounded",
|
|
861
|
-
methodColors[method]
|
|
862
|
-
),
|
|
863
|
-
children: method
|
|
864
|
-
}
|
|
865
|
-
),
|
|
866
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { className: "text-sm font-mono", children: path }),
|
|
867
|
-
summary && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground ml-auto mr-2", children: summary }),
|
|
868
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
869
|
-
import_lucide_react6.ChevronDown,
|
|
870
|
-
{
|
|
871
|
-
className: cn(
|
|
872
|
-
"h-5 w-5 text-muted-foreground transition-transform flex-shrink-0",
|
|
873
|
-
isOpen ? "rotate-180" : ""
|
|
874
|
-
)
|
|
875
|
-
}
|
|
876
|
-
)
|
|
877
|
-
]
|
|
878
|
-
}
|
|
879
|
-
),
|
|
880
|
-
isOpen && children && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "border-t border-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-4 py-4 space-y-6", children }) })
|
|
881
|
-
] });
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
// src/components/docs/api/api-params.tsx
|
|
885
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
886
|
-
function ApiParams({ title = "Parameters", params }) {
|
|
887
|
-
if (!params || params.length === 0) return null;
|
|
888
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mb-6", children: [
|
|
889
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h4", { className: "text-sm font-semibold text-foreground mb-3", children: title }),
|
|
890
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("table", { className: "w-full border-collapse", children: [
|
|
891
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("tr", { className: "border-b border-border", children: [
|
|
892
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Property" }),
|
|
893
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Type" }),
|
|
894
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Required" }),
|
|
895
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Default" }),
|
|
896
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("th", { className: "text-left py-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Description" })
|
|
897
|
-
] }) }),
|
|
898
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { children: params.map((param, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
899
|
-
"tr",
|
|
900
|
-
{
|
|
901
|
-
className: index !== params.length - 1 ? "border-b border-border/50" : "",
|
|
902
|
-
children: [
|
|
903
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { className: "py-2.5 px-3", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", { className: "text-sm font-mono text-foreground", children: param.name }) }),
|
|
904
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { className: "py-2.5 px-3", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm text-muted-foreground font-mono", children: param.type }) }),
|
|
905
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { className: "py-2.5 px-3", children: param.required ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm text-red-600 dark:text-red-400", children: "Yes" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm text-muted-foreground", children: "No" }) }),
|
|
906
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { className: "py-2.5 px-3", children: param.default ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", { className: "text-sm font-mono text-muted-foreground", children: param.default }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm text-muted-foreground", children: "-" }) }),
|
|
907
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { className: "py-2.5 px-3", children: param.description ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm text-muted-foreground", children: param.description }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm text-muted-foreground", children: "-" }) })
|
|
908
|
-
]
|
|
909
|
-
},
|
|
910
|
-
param.name
|
|
911
|
-
)) })
|
|
912
|
-
] }) })
|
|
913
|
-
] });
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
// src/components/docs/api/api-response.tsx
|
|
917
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
918
|
-
var statusColors = {
|
|
919
|
-
"2": "text-green-600 dark:text-green-400",
|
|
920
|
-
"3": "text-blue-600 dark:text-blue-400",
|
|
921
|
-
"4": "text-orange-600 dark:text-orange-400",
|
|
922
|
-
"5": "text-red-600 dark:text-red-400"
|
|
923
|
-
};
|
|
924
|
-
function ApiResponse({ status, description, example, schema }) {
|
|
925
|
-
const statusClass = statusColors[String(status)[0]] || "text-muted-foreground";
|
|
926
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mb-4", children: [
|
|
927
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
928
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: `text-sm font-semibold ${statusClass}`, children: status }),
|
|
929
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-sm text-muted-foreground", children: description })
|
|
930
|
-
] }),
|
|
931
|
-
example && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mb-3", children: [
|
|
932
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: "Example Response" }),
|
|
933
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
934
|
-
CodeBlock,
|
|
935
|
-
{
|
|
936
|
-
code: typeof example === "string" ? example : JSON.stringify(example, null, 2),
|
|
937
|
-
language: "json"
|
|
938
|
-
}
|
|
939
|
-
)
|
|
940
|
-
] }),
|
|
941
|
-
schema && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
942
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: "Schema" }),
|
|
943
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
944
|
-
CodeBlock,
|
|
945
|
-
{
|
|
946
|
-
code: typeof schema === "string" ? schema : JSON.stringify(schema, null, 2),
|
|
947
|
-
language: "json"
|
|
948
|
-
}
|
|
949
|
-
)
|
|
950
|
-
] })
|
|
951
|
-
] });
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
// src/components/docs/api/api-playground.tsx
|
|
955
|
-
var import_react9 = require("react");
|
|
956
|
-
|
|
957
|
-
// src/components/ui/button.tsx
|
|
958
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
959
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
960
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
961
|
-
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
962
|
-
"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",
|
|
963
|
-
{
|
|
964
|
-
variants: {
|
|
965
|
-
variant: {
|
|
966
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
967
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
968
|
-
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",
|
|
969
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
970
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
971
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
972
|
-
},
|
|
973
|
-
size: {
|
|
974
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
975
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
976
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
977
|
-
icon: "size-9",
|
|
978
|
-
"icon-sm": "size-8",
|
|
979
|
-
"icon-lg": "size-10"
|
|
980
|
-
}
|
|
981
|
-
},
|
|
982
|
-
defaultVariants: {
|
|
983
|
-
variant: "default",
|
|
984
|
-
size: "default"
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
);
|
|
988
|
-
function Button({
|
|
989
|
-
className,
|
|
990
|
-
variant,
|
|
991
|
-
size,
|
|
992
|
-
asChild = false,
|
|
993
|
-
...props
|
|
994
|
-
}) {
|
|
995
|
-
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
997
|
-
Comp,
|
|
998
|
-
{
|
|
999
|
-
"data-slot": "button",
|
|
1000
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
1001
|
-
...props
|
|
1002
|
-
}
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
// src/components/ui/input.tsx
|
|
1007
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1008
|
-
function Input({ className, type, ...props }) {
|
|
1009
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1010
|
-
"input",
|
|
1011
|
-
{
|
|
1012
|
-
type,
|
|
1013
|
-
"data-slot": "input",
|
|
1014
|
-
className: cn(
|
|
1015
|
-
"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",
|
|
1016
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
1017
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
1018
|
-
className
|
|
1019
|
-
),
|
|
1020
|
-
...props
|
|
1021
|
-
}
|
|
1022
|
-
);
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
// src/components/ui/textarea.tsx
|
|
1026
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1027
|
-
function Textarea({ className, ...props }) {
|
|
1028
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1029
|
-
"textarea",
|
|
1030
|
-
{
|
|
1031
|
-
"data-slot": "textarea",
|
|
1032
|
-
className: cn(
|
|
1033
|
-
"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",
|
|
1034
|
-
className
|
|
1035
|
-
),
|
|
1036
|
-
...props
|
|
1037
|
-
}
|
|
1038
|
-
);
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
// src/components/ui/badge.tsx
|
|
1042
|
-
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
1043
|
-
var import_class_variance_authority2 = require("class-variance-authority");
|
|
1044
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1045
|
-
var badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
1046
|
-
"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",
|
|
1047
|
-
{
|
|
1048
|
-
variants: {
|
|
1049
|
-
variant: {
|
|
1050
|
-
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
1051
|
-
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
1052
|
-
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",
|
|
1053
|
-
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
1054
|
-
}
|
|
1055
|
-
},
|
|
1056
|
-
defaultVariants: {
|
|
1057
|
-
variant: "default"
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
);
|
|
1061
|
-
function Badge2({
|
|
1062
|
-
className,
|
|
1063
|
-
variant,
|
|
1064
|
-
asChild = false,
|
|
1065
|
-
...props
|
|
1066
|
-
}) {
|
|
1067
|
-
const Comp = asChild ? import_react_slot2.Slot : "span";
|
|
1068
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1069
|
-
Comp,
|
|
1070
|
-
{
|
|
1071
|
-
"data-slot": "badge",
|
|
1072
|
-
className: cn(badgeVariants({ variant }), className),
|
|
1073
|
-
...props
|
|
1074
|
-
}
|
|
1075
|
-
);
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
// src/components/docs/api/api-playground.tsx
|
|
1079
|
-
var import_lucide_react7 = require("lucide-react");
|
|
1080
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1081
|
-
function ApiPlayground({
|
|
1082
|
-
method,
|
|
1083
|
-
path,
|
|
1084
|
-
baseUrl = "",
|
|
1085
|
-
headers = {},
|
|
1086
|
-
defaultBody,
|
|
1087
|
-
pathParams = []
|
|
1088
|
-
}) {
|
|
1089
|
-
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
1090
|
-
const [response, setResponse] = (0, import_react9.useState)(null);
|
|
1091
|
-
const [error, setError] = (0, import_react9.useState)(null);
|
|
1092
|
-
const [requestBody, setRequestBody] = (0, import_react9.useState)(defaultBody || "");
|
|
1093
|
-
const initialHeaders = (0, import_react9.useMemo)(() => {
|
|
1094
|
-
const cleanHeaders = {};
|
|
1095
|
-
Object.entries(headers).forEach(([key, value]) => {
|
|
1096
|
-
cleanHeaders[key] = value || "";
|
|
1097
|
-
});
|
|
1098
|
-
return cleanHeaders;
|
|
1099
|
-
}, [headers]);
|
|
1100
|
-
const [requestHeaders, setRequestHeaders] = (0, import_react9.useState)(JSON.stringify(initialHeaders, null, 2));
|
|
1101
|
-
const extractedParams = (0, import_react9.useMemo)(() => {
|
|
1102
|
-
const params = {};
|
|
1103
|
-
const pathParamPattern = /:(\w+)/g;
|
|
1104
|
-
let match;
|
|
1105
|
-
while ((match = pathParamPattern.exec(path)) !== null) {
|
|
1106
|
-
const paramName = match[1];
|
|
1107
|
-
const paramConfig = pathParams.find((p) => p.name === paramName);
|
|
1108
|
-
if (paramConfig?.example !== void 0) {
|
|
1109
|
-
params[paramName] = String(paramConfig.example);
|
|
1110
|
-
} else if (paramConfig?.type === "number") {
|
|
1111
|
-
params[paramName] = "1";
|
|
1112
|
-
} else {
|
|
1113
|
-
params[paramName] = "";
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
return params;
|
|
1117
|
-
}, [path, pathParams]);
|
|
1118
|
-
const [pathParamValues, setPathParamValues] = (0, import_react9.useState)(extractedParams);
|
|
1119
|
-
const buildUrl = () => {
|
|
1120
|
-
let finalPath = path;
|
|
1121
|
-
Object.entries(pathParamValues).forEach(([key, value]) => {
|
|
1122
|
-
finalPath = finalPath.replace(`:${key}`, value);
|
|
1123
|
-
});
|
|
1124
|
-
return `${baseUrl}${finalPath}`;
|
|
1125
|
-
};
|
|
1126
|
-
const handleSend = async () => {
|
|
1127
|
-
setLoading(true);
|
|
1128
|
-
setError(null);
|
|
1129
|
-
setResponse(null);
|
|
1130
|
-
try {
|
|
1131
|
-
const url = buildUrl();
|
|
1132
|
-
const parsedHeaders = JSON.parse(requestHeaders);
|
|
1133
|
-
const options = {
|
|
1134
|
-
method,
|
|
1135
|
-
headers: {
|
|
1136
|
-
"Content-Type": "application/json",
|
|
1137
|
-
...parsedHeaders
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
if (method !== "GET" && method !== "DELETE" && requestBody) {
|
|
1141
|
-
options.body = requestBody;
|
|
1142
|
-
}
|
|
1143
|
-
const res = await fetch(url, options);
|
|
1144
|
-
const data = await res.json();
|
|
1145
|
-
setResponse({
|
|
1146
|
-
status: res.status,
|
|
1147
|
-
statusText: res.statusText,
|
|
1148
|
-
headers: Object.fromEntries(res.headers.entries()),
|
|
1149
|
-
body: data
|
|
1150
|
-
});
|
|
1151
|
-
} catch (err) {
|
|
1152
|
-
setError(err instanceof Error ? err.message : "An error occurred");
|
|
1153
|
-
} finally {
|
|
1154
|
-
setLoading(false);
|
|
1155
|
-
}
|
|
1156
|
-
};
|
|
1157
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "not-prose border border-border rounded-lg overflow-hidden bg-card/30", children: [
|
|
1158
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "bg-muted/50 px-4 py-2 border-b border-border", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h4", { className: "text-sm font-semibold text-foreground", children: "API Playground" }) }),
|
|
1159
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "p-4 space-y-4", children: [
|
|
1160
|
-
Object.keys(pathParamValues).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
|
|
1161
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Path Parameters" }),
|
|
1162
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "space-y-2", children: Object.entries(pathParamValues).map(([paramName, paramValue]) => {
|
|
1163
|
-
const paramConfig = pathParams.find((p) => p.name === paramName);
|
|
1164
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1165
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-xs text-muted-foreground min-w-[80px]", children: [
|
|
1166
|
-
":",
|
|
1167
|
-
paramName
|
|
1168
|
-
] }),
|
|
1169
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1170
|
-
Input,
|
|
1171
|
-
{
|
|
1172
|
-
value: paramValue,
|
|
1173
|
-
onChange: (e) => setPathParamValues((prev) => ({ ...prev, [paramName]: e.target.value })),
|
|
1174
|
-
placeholder: paramConfig?.example || paramConfig?.type || "value",
|
|
1175
|
-
className: "font-mono text-sm"
|
|
1176
|
-
}
|
|
1177
|
-
)
|
|
1178
|
-
] }, paramName);
|
|
1179
|
-
}) })
|
|
1180
|
-
] }),
|
|
1181
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
|
|
1182
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Request URL" }),
|
|
1183
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1184
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Badge2, { variant: "outline", className: "font-mono", children: method }),
|
|
1185
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Input, { value: buildUrl(), readOnly: true, className: "font-mono text-sm" })
|
|
1186
|
-
] })
|
|
1187
|
-
] }),
|
|
1188
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
|
|
1189
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Headers (JSON)" }),
|
|
1190
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1191
|
-
Textarea,
|
|
1192
|
-
{
|
|
1193
|
-
value: requestHeaders,
|
|
1194
|
-
onChange: (e) => setRequestHeaders(e.target.value),
|
|
1195
|
-
className: "font-mono text-sm",
|
|
1196
|
-
rows: 4
|
|
1197
|
-
}
|
|
1198
|
-
)
|
|
1199
|
-
] }),
|
|
1200
|
-
method !== "GET" && method !== "DELETE" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
|
|
1201
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: "Request Body (JSON)" }),
|
|
1202
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1203
|
-
Textarea,
|
|
1204
|
-
{
|
|
1205
|
-
value: requestBody,
|
|
1206
|
-
onChange: (e) => setRequestBody(e.target.value),
|
|
1207
|
-
className: "font-mono text-sm",
|
|
1208
|
-
rows: 6,
|
|
1209
|
-
placeholder: '{\\n "key": "value"\\n}'
|
|
1210
|
-
}
|
|
1211
|
-
)
|
|
1212
|
-
] }),
|
|
1213
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { onClick: handleSend, disabled: loading, className: "w-full", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1214
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react7.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1215
|
-
"Sending..."
|
|
1216
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1217
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react7.Play, { className: "mr-2 h-4 w-4" }),
|
|
1218
|
-
"Send Request"
|
|
1219
|
-
] }) }),
|
|
1220
|
-
response && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mt-4", children: [
|
|
1221
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "text-xs font-semibold text-muted-foreground mb-2 block", children: [
|
|
1222
|
-
"Response (",
|
|
1223
|
-
response.status,
|
|
1224
|
-
" ",
|
|
1225
|
-
response.statusText,
|
|
1226
|
-
")"
|
|
1227
|
-
] }),
|
|
1228
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CodeBlock, { code: JSON.stringify(response.body, null, 2), language: "json" })
|
|
1229
|
-
] }),
|
|
1230
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mt-4 p-3 bg-red-500/10 border border-red-500/20 rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: error }) })
|
|
1231
|
-
] })
|
|
1232
|
-
] });
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
// src/components/docs/api/api-reference.tsx
|
|
1236
|
-
var import_react10 = require("react");
|
|
1237
|
-
|
|
1238
|
-
// src/lib/parsers/specra-parser.ts
|
|
1239
|
-
var SpecraParser = class {
|
|
1240
|
-
validate(input) {
|
|
1241
|
-
return typeof input === "object" && input !== null && "endpoints" in input && Array.isArray(input.endpoints);
|
|
1242
|
-
}
|
|
1243
|
-
parse(input) {
|
|
1244
|
-
if (!this.validate(input)) {
|
|
1245
|
-
throw new Error("Invalid Specra API spec format");
|
|
1246
|
-
}
|
|
1247
|
-
return input;
|
|
1248
|
-
}
|
|
1249
|
-
};
|
|
1250
|
-
|
|
1251
|
-
// src/lib/parsers/openapi-parser.ts
|
|
1252
|
-
var OpenApiParser = class {
|
|
1253
|
-
validate(input) {
|
|
1254
|
-
return typeof input === "object" && input !== null && ("openapi" in input || "swagger" in input) && "paths" in input;
|
|
1255
|
-
}
|
|
1256
|
-
parse(input) {
|
|
1257
|
-
if (!this.validate(input)) {
|
|
1258
|
-
throw new Error("Invalid OpenAPI spec format");
|
|
1259
|
-
}
|
|
1260
|
-
const baseUrl = this.extractBaseUrl(input);
|
|
1261
|
-
const endpoints = [];
|
|
1262
|
-
for (const [path, pathItem] of Object.entries(input.paths || {})) {
|
|
1263
|
-
const methods = ["get", "post", "put", "patch", "delete"];
|
|
1264
|
-
for (const method of methods) {
|
|
1265
|
-
const operation = pathItem[method];
|
|
1266
|
-
if (!operation) continue;
|
|
1267
|
-
const endpoint = this.parseOperation(path, method.toUpperCase(), operation, input);
|
|
1268
|
-
endpoints.push(endpoint);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
return {
|
|
1272
|
-
version: input.info?.version,
|
|
1273
|
-
title: input.info?.title,
|
|
1274
|
-
description: input.info?.description,
|
|
1275
|
-
baseUrl,
|
|
1276
|
-
auth: this.extractAuth(input),
|
|
1277
|
-
endpoints
|
|
1278
|
-
};
|
|
1279
|
-
}
|
|
1280
|
-
extractBaseUrl(spec) {
|
|
1281
|
-
if (spec.servers && spec.servers.length > 0) {
|
|
1282
|
-
return spec.servers[0].url;
|
|
1283
|
-
}
|
|
1284
|
-
if (spec.host) {
|
|
1285
|
-
const scheme = spec.schemes?.[0] || "https";
|
|
1286
|
-
const basePath = spec.basePath || "";
|
|
1287
|
-
return `${scheme}://${spec.host}${basePath}`;
|
|
1288
|
-
}
|
|
1289
|
-
return "";
|
|
1290
|
-
}
|
|
1291
|
-
extractAuth(spec) {
|
|
1292
|
-
const securitySchemes = spec.components?.securitySchemes || spec.securityDefinitions;
|
|
1293
|
-
if (!securitySchemes) return void 0;
|
|
1294
|
-
const firstScheme = Object.values(securitySchemes)[0];
|
|
1295
|
-
if (!firstScheme) return void 0;
|
|
1296
|
-
if (firstScheme.type === "http" && firstScheme.scheme === "bearer") {
|
|
1297
|
-
return {
|
|
1298
|
-
type: "bearer",
|
|
1299
|
-
description: firstScheme.description,
|
|
1300
|
-
tokenPrefix: "Bearer"
|
|
1301
|
-
};
|
|
1302
|
-
}
|
|
1303
|
-
if (firstScheme.type === "apiKey") {
|
|
1304
|
-
return {
|
|
1305
|
-
type: "apiKey",
|
|
1306
|
-
description: firstScheme.description,
|
|
1307
|
-
headerName: firstScheme.name || "X-API-Key"
|
|
1308
|
-
};
|
|
1309
|
-
}
|
|
1310
|
-
if (firstScheme.type === "http" && firstScheme.scheme === "basic") {
|
|
1311
|
-
return {
|
|
1312
|
-
type: "basic",
|
|
1313
|
-
description: firstScheme.description
|
|
1314
|
-
};
|
|
1315
|
-
}
|
|
1316
|
-
return void 0;
|
|
1317
|
-
}
|
|
1318
|
-
parseOperation(path, method, operation, spec) {
|
|
1319
|
-
const endpoint = {
|
|
1320
|
-
title: operation.summary || operation.operationId || `${method} ${path}`,
|
|
1321
|
-
method,
|
|
1322
|
-
path: this.convertPathParams(path),
|
|
1323
|
-
description: operation.description
|
|
1324
|
-
};
|
|
1325
|
-
const params = this.parseParameters(operation.parameters || [], spec);
|
|
1326
|
-
if (params.path.length > 0) endpoint.pathParams = params.path;
|
|
1327
|
-
if (params.query.length > 0) endpoint.queryParams = params.query;
|
|
1328
|
-
if (params.header.length > 0) {
|
|
1329
|
-
endpoint.headers = params.header.map((p) => ({
|
|
1330
|
-
name: p.name,
|
|
1331
|
-
value: p.example || "",
|
|
1332
|
-
description: p.description
|
|
1333
|
-
}));
|
|
1334
|
-
}
|
|
1335
|
-
if (operation.requestBody) {
|
|
1336
|
-
endpoint.body = this.parseRequestBody(operation.requestBody, spec);
|
|
1337
|
-
}
|
|
1338
|
-
const responses = this.parseResponses(operation.responses || {}, spec);
|
|
1339
|
-
if (responses.success) endpoint.successResponse = responses.success;
|
|
1340
|
-
if (responses.errors.length > 0) endpoint.errorResponses = responses.errors;
|
|
1341
|
-
return endpoint;
|
|
1342
|
-
}
|
|
1343
|
-
convertPathParams(path) {
|
|
1344
|
-
return path.replace(/\{([^}]+)\}/g, ":$1");
|
|
1345
|
-
}
|
|
1346
|
-
parseParameters(parameters, spec) {
|
|
1347
|
-
const result = { path: [], query: [], header: [] };
|
|
1348
|
-
for (const param of parameters) {
|
|
1349
|
-
const resolved = param.$ref ? this.resolveRef(param.$ref, spec) : param;
|
|
1350
|
-
const apiParam = {
|
|
1351
|
-
name: resolved.name,
|
|
1352
|
-
type: resolved.schema?.type || resolved.type || "string",
|
|
1353
|
-
required: resolved.required,
|
|
1354
|
-
description: resolved.description,
|
|
1355
|
-
example: resolved.example || resolved.schema?.example
|
|
1356
|
-
};
|
|
1357
|
-
if (resolved.in === "path") result.path.push(apiParam);
|
|
1358
|
-
else if (resolved.in === "query") result.query.push(apiParam);
|
|
1359
|
-
else if (resolved.in === "header") result.header.push(apiParam);
|
|
1360
|
-
}
|
|
1361
|
-
return result;
|
|
1362
|
-
}
|
|
1363
|
-
parseRequestBody(requestBody, spec) {
|
|
1364
|
-
const content = requestBody.content?.["application/json"];
|
|
1365
|
-
if (!content) return void 0;
|
|
1366
|
-
return {
|
|
1367
|
-
description: requestBody.description,
|
|
1368
|
-
example: content.example || this.generateExample(content.schema, spec),
|
|
1369
|
-
schema: content.schema
|
|
1370
|
-
};
|
|
1371
|
-
}
|
|
1372
|
-
parseResponses(responses, spec) {
|
|
1373
|
-
const result = { errors: [] };
|
|
1374
|
-
for (const [statusCode, response] of Object.entries(responses)) {
|
|
1375
|
-
const status = parseInt(statusCode);
|
|
1376
|
-
if (isNaN(status)) continue;
|
|
1377
|
-
const resolved = response.$ref ? this.resolveRef(response.$ref, spec) : response;
|
|
1378
|
-
const content = resolved.content?.["application/json"];
|
|
1379
|
-
const apiResponse = {
|
|
1380
|
-
status,
|
|
1381
|
-
description: resolved.description,
|
|
1382
|
-
example: content?.example || this.generateExample(content?.schema, spec),
|
|
1383
|
-
schema: content?.schema
|
|
1384
|
-
};
|
|
1385
|
-
if (status >= 200 && status < 300) {
|
|
1386
|
-
result.success = apiResponse;
|
|
1387
|
-
} else {
|
|
1388
|
-
result.errors.push(apiResponse);
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
return result;
|
|
1392
|
-
}
|
|
1393
|
-
generateExample(schema, spec) {
|
|
1394
|
-
if (!schema) return void 0;
|
|
1395
|
-
if (schema.$ref) schema = this.resolveRef(schema.$ref, spec);
|
|
1396
|
-
if (schema.example) return schema.example;
|
|
1397
|
-
if (schema.type === "object" && schema.properties) {
|
|
1398
|
-
const example = {};
|
|
1399
|
-
for (const [key, prop] of Object.entries(schema.properties)) {
|
|
1400
|
-
example[key] = this.generateExample(prop, spec);
|
|
1401
|
-
}
|
|
1402
|
-
return example;
|
|
1403
|
-
}
|
|
1404
|
-
if (schema.type === "array" && schema.items) {
|
|
1405
|
-
return [this.generateExample(schema.items, spec)];
|
|
1406
|
-
}
|
|
1407
|
-
const defaults = {
|
|
1408
|
-
string: "string",
|
|
1409
|
-
number: 0,
|
|
1410
|
-
integer: 0,
|
|
1411
|
-
boolean: false,
|
|
1412
|
-
object: {},
|
|
1413
|
-
array: []
|
|
1414
|
-
};
|
|
1415
|
-
return defaults[schema.type] || null;
|
|
1416
|
-
}
|
|
1417
|
-
resolveRef(ref, spec) {
|
|
1418
|
-
const path = ref.replace(/^#\//, "").split("/");
|
|
1419
|
-
let current = spec;
|
|
1420
|
-
for (const segment of path) {
|
|
1421
|
-
current = current[segment];
|
|
1422
|
-
if (!current) return {};
|
|
1423
|
-
}
|
|
1424
|
-
return current;
|
|
1425
|
-
}
|
|
1426
|
-
};
|
|
1427
|
-
|
|
1428
|
-
// src/lib/parsers/postman-parser.ts
|
|
1429
|
-
var PostmanParser = class {
|
|
1430
|
-
validate(input) {
|
|
1431
|
-
return typeof input === "object" && input !== null && "info" in input && input.info?.schema?.includes("v2");
|
|
1432
|
-
}
|
|
1433
|
-
parse(input) {
|
|
1434
|
-
if (!this.validate(input)) {
|
|
1435
|
-
throw new Error("Invalid Postman Collection format (requires v2.0 or v2.1)");
|
|
1436
|
-
}
|
|
1437
|
-
const baseUrl = this.extractBaseUrl(input);
|
|
1438
|
-
const endpoints = [];
|
|
1439
|
-
this.parseItems(input.item || [], endpoints, baseUrl, input);
|
|
1440
|
-
return {
|
|
1441
|
-
version: input.info?.version,
|
|
1442
|
-
title: input.info?.name,
|
|
1443
|
-
description: input.info?.description,
|
|
1444
|
-
baseUrl,
|
|
1445
|
-
auth: this.extractAuth(input.auth),
|
|
1446
|
-
globalHeaders: this.extractGlobalHeaders(input),
|
|
1447
|
-
endpoints
|
|
1448
|
-
};
|
|
1449
|
-
}
|
|
1450
|
-
extractBaseUrl(collection) {
|
|
1451
|
-
const baseUrlVar = collection.variable?.find(
|
|
1452
|
-
(v) => v.key === "baseUrl" || v.key === "base_url" || v.key === "url"
|
|
1453
|
-
);
|
|
1454
|
-
if (baseUrlVar) return baseUrlVar.value;
|
|
1455
|
-
if (collection.item && collection.item.length > 0) {
|
|
1456
|
-
const firstRequest = this.findFirstRequest(collection.item);
|
|
1457
|
-
if (firstRequest?.request?.url) {
|
|
1458
|
-
const url = this.parseUrl(firstRequest.request.url);
|
|
1459
|
-
if (url.host) {
|
|
1460
|
-
return `${url.protocol}://${url.host.join(".")}`;
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
return "";
|
|
1465
|
-
}
|
|
1466
|
-
findFirstRequest(items) {
|
|
1467
|
-
for (const item of items) {
|
|
1468
|
-
if (item.request) return item;
|
|
1469
|
-
if (item.item) {
|
|
1470
|
-
const found = this.findFirstRequest(item.item);
|
|
1471
|
-
if (found) return found;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
return null;
|
|
1475
|
-
}
|
|
1476
|
-
extractAuth(auth) {
|
|
1477
|
-
if (!auth) return void 0;
|
|
1478
|
-
if (auth.type === "bearer") {
|
|
1479
|
-
return {
|
|
1480
|
-
type: "bearer",
|
|
1481
|
-
tokenPrefix: "Bearer"
|
|
1482
|
-
};
|
|
1483
|
-
}
|
|
1484
|
-
if (auth.type === "apikey") {
|
|
1485
|
-
const keyData = auth.apikey?.find((a) => a.key === "key");
|
|
1486
|
-
const keyName = keyData?.value || "X-API-Key";
|
|
1487
|
-
return {
|
|
1488
|
-
type: "apiKey",
|
|
1489
|
-
headerName: keyName
|
|
1490
|
-
};
|
|
1491
|
-
}
|
|
1492
|
-
if (auth.type === "basic") {
|
|
1493
|
-
return {
|
|
1494
|
-
type: "basic"
|
|
1495
|
-
};
|
|
1496
|
-
}
|
|
1497
|
-
return void 0;
|
|
1498
|
-
}
|
|
1499
|
-
extractGlobalHeaders(collection) {
|
|
1500
|
-
return [];
|
|
1501
|
-
}
|
|
1502
|
-
parseItems(items, endpoints, baseUrl, collection) {
|
|
1503
|
-
for (const item of items) {
|
|
1504
|
-
if (item.item && Array.isArray(item.item)) {
|
|
1505
|
-
this.parseItems(item.item, endpoints, baseUrl, collection);
|
|
1506
|
-
} else if (item.request) {
|
|
1507
|
-
const endpoint = this.parseRequest(item, baseUrl, collection);
|
|
1508
|
-
endpoints.push(endpoint);
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
parseRequest(item, baseUrl, collection) {
|
|
1513
|
-
const request = item.request;
|
|
1514
|
-
const url = this.parseUrl(request.url);
|
|
1515
|
-
const endpoint = {
|
|
1516
|
-
title: item.name,
|
|
1517
|
-
method: request.method.toUpperCase(),
|
|
1518
|
-
path: this.buildPath(url, baseUrl),
|
|
1519
|
-
description: item.request.description || item.description
|
|
1520
|
-
};
|
|
1521
|
-
const params = this.parseUrlParams(url);
|
|
1522
|
-
if (params.path.length > 0) endpoint.pathParams = params.path;
|
|
1523
|
-
if (params.query.length > 0) endpoint.queryParams = params.query;
|
|
1524
|
-
if (request.header && request.header.length > 0) {
|
|
1525
|
-
endpoint.headers = request.header.filter((h) => !h.disabled).map((h) => ({
|
|
1526
|
-
name: h.key,
|
|
1527
|
-
value: h.value || "",
|
|
1528
|
-
description: h.description
|
|
1529
|
-
}));
|
|
1530
|
-
}
|
|
1531
|
-
if (request.body) {
|
|
1532
|
-
endpoint.body = this.parseBody(request.body);
|
|
1533
|
-
}
|
|
1534
|
-
const responses = this.parseResponses(item.response || []);
|
|
1535
|
-
if (responses.success) endpoint.successResponse = responses.success;
|
|
1536
|
-
if (responses.errors.length > 0) endpoint.errorResponses = responses.errors;
|
|
1537
|
-
return endpoint;
|
|
1538
|
-
}
|
|
1539
|
-
parseUrl(url) {
|
|
1540
|
-
if (typeof url === "string") {
|
|
1541
|
-
const urlObj = new URL(url);
|
|
1542
|
-
return {
|
|
1543
|
-
protocol: urlObj.protocol.replace(":", ""),
|
|
1544
|
-
host: urlObj.hostname.split("."),
|
|
1545
|
-
path: urlObj.pathname.split("/").filter(Boolean),
|
|
1546
|
-
query: [],
|
|
1547
|
-
variable: []
|
|
1548
|
-
};
|
|
1549
|
-
}
|
|
1550
|
-
return {
|
|
1551
|
-
protocol: url.protocol || "https",
|
|
1552
|
-
host: url.host || [],
|
|
1553
|
-
path: url.path || [],
|
|
1554
|
-
query: url.query || [],
|
|
1555
|
-
variable: url.variable || []
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
buildPath(url, baseUrl) {
|
|
1559
|
-
let path = "/";
|
|
1560
|
-
if (url.path && url.path.length > 0) {
|
|
1561
|
-
path += url.path.join("/");
|
|
1562
|
-
}
|
|
1563
|
-
path = path.replace(/\{\{([^}]+)\}\}/g, ":$1");
|
|
1564
|
-
return path;
|
|
1565
|
-
}
|
|
1566
|
-
parseUrlParams(url) {
|
|
1567
|
-
const result = { path: [], query: [] };
|
|
1568
|
-
if (url.variable && url.variable.length > 0) {
|
|
1569
|
-
for (const v of url.variable) {
|
|
1570
|
-
result.path.push({
|
|
1571
|
-
name: v.key,
|
|
1572
|
-
type: v.type || "string",
|
|
1573
|
-
description: v.description,
|
|
1574
|
-
example: v.value
|
|
1575
|
-
});
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
if (url.path && url.path.length > 0) {
|
|
1579
|
-
for (const segment of url.path) {
|
|
1580
|
-
if (segment.startsWith(":")) {
|
|
1581
|
-
const paramName = segment.slice(1);
|
|
1582
|
-
if (!result.path.find((p) => p.name === paramName)) {
|
|
1583
|
-
result.path.push({
|
|
1584
|
-
name: paramName,
|
|
1585
|
-
type: "string"
|
|
1586
|
-
});
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
if (url.query && url.query.length > 0) {
|
|
1592
|
-
for (const q of url.query) {
|
|
1593
|
-
if (q.disabled) continue;
|
|
1594
|
-
result.query.push({
|
|
1595
|
-
name: q.key,
|
|
1596
|
-
type: "string",
|
|
1597
|
-
description: q.description,
|
|
1598
|
-
example: q.value
|
|
1599
|
-
});
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
return result;
|
|
1603
|
-
}
|
|
1604
|
-
parseBody(body) {
|
|
1605
|
-
if (!body) return void 0;
|
|
1606
|
-
let example;
|
|
1607
|
-
let description = body.description;
|
|
1608
|
-
if (body.mode === "raw") {
|
|
1609
|
-
try {
|
|
1610
|
-
example = JSON.parse(body.raw);
|
|
1611
|
-
} catch {
|
|
1612
|
-
example = body.raw;
|
|
1613
|
-
}
|
|
1614
|
-
} else if (body.mode === "formdata" || body.mode === "urlencoded") {
|
|
1615
|
-
example = {};
|
|
1616
|
-
for (const item of body[body.mode] || []) {
|
|
1617
|
-
if (!item.disabled) {
|
|
1618
|
-
example[item.key] = item.value;
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
return {
|
|
1623
|
-
description,
|
|
1624
|
-
example
|
|
1625
|
-
};
|
|
1626
|
-
}
|
|
1627
|
-
parseResponses(responses) {
|
|
1628
|
-
const result = { errors: [] };
|
|
1629
|
-
for (const response of responses) {
|
|
1630
|
-
let example;
|
|
1631
|
-
try {
|
|
1632
|
-
example = JSON.parse(response.body);
|
|
1633
|
-
} catch {
|
|
1634
|
-
example = response.body;
|
|
1635
|
-
}
|
|
1636
|
-
const apiResponse = {
|
|
1637
|
-
status: response.code || 200,
|
|
1638
|
-
description: response.name,
|
|
1639
|
-
example
|
|
1640
|
-
};
|
|
1641
|
-
if (apiResponse.status >= 200 && apiResponse.status < 300) {
|
|
1642
|
-
if (!result.success) result.success = apiResponse;
|
|
1643
|
-
} else {
|
|
1644
|
-
result.errors.push(apiResponse);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
return result;
|
|
1648
|
-
}
|
|
1649
|
-
};
|
|
1650
|
-
|
|
1651
|
-
// src/lib/parsers/index.ts
|
|
1652
|
-
var parsers = /* @__PURE__ */ new Map([
|
|
1653
|
-
["specra", new SpecraParser()],
|
|
1654
|
-
["openapi", new OpenApiParser()],
|
|
1655
|
-
["postman", new PostmanParser()]
|
|
1656
|
-
]);
|
|
1657
|
-
function detectParserType(input) {
|
|
1658
|
-
if (!input || typeof input !== "object") {
|
|
1659
|
-
throw new Error("Invalid API spec: input must be an object");
|
|
1660
|
-
}
|
|
1661
|
-
if (input.info?.schema?.includes("v2")) {
|
|
1662
|
-
return "postman";
|
|
1663
|
-
}
|
|
1664
|
-
if (input.openapi || input.swagger) {
|
|
1665
|
-
return "openapi";
|
|
1666
|
-
}
|
|
1667
|
-
if (input.endpoints && Array.isArray(input.endpoints)) {
|
|
1668
|
-
return "specra";
|
|
1669
|
-
}
|
|
1670
|
-
throw new Error(
|
|
1671
|
-
"Unable to auto-detect API spec format. Supported formats: Specra, OpenAPI 3.x, Postman Collection v2.x"
|
|
1672
|
-
);
|
|
1673
|
-
}
|
|
1674
|
-
function parseApiSpec(input, parserType = "auto") {
|
|
1675
|
-
const actualType = parserType === "auto" ? detectParserType(input) : parserType;
|
|
1676
|
-
const parser = parsers.get(actualType);
|
|
1677
|
-
if (!parser) {
|
|
1678
|
-
throw new Error(`Unknown parser type: ${actualType}`);
|
|
1679
|
-
}
|
|
1680
|
-
if (!parser.validate(input)) {
|
|
1681
|
-
throw new Error(`Input does not match ${actualType} format`);
|
|
1682
|
-
}
|
|
1683
|
-
return parser.parse(input);
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
// src/components/docs/api/api-reference.tsx
|
|
1687
|
-
var import_lucide_react8 = require("lucide-react");
|
|
1688
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1689
|
-
function ApiReference({ spec, parser = "auto", showPlayground = true }) {
|
|
1690
|
-
const [apiSpec, setApiSpec] = (0, import_react10.useState)(null);
|
|
1691
|
-
const [loading, setLoading] = (0, import_react10.useState)(true);
|
|
1692
|
-
const [error, setError] = (0, import_react10.useState)(null);
|
|
1693
|
-
(0, import_react10.useEffect)(() => {
|
|
1694
|
-
async function loadSpec() {
|
|
1695
|
-
try {
|
|
1696
|
-
const response = await fetch(spec);
|
|
1697
|
-
if (!response.ok) {
|
|
1698
|
-
throw new Error(`Failed to load API spec: ${response.statusText}`);
|
|
1699
|
-
}
|
|
1700
|
-
const data = await response.json();
|
|
1701
|
-
const parsedSpec = parseApiSpec(data, parser);
|
|
1702
|
-
setApiSpec(parsedSpec);
|
|
1703
|
-
} catch (err) {
|
|
1704
|
-
setError(err instanceof Error ? err.message : "Failed to load API spec");
|
|
1705
|
-
} finally {
|
|
1706
|
-
setLoading(false);
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
loadSpec();
|
|
1710
|
-
}, [spec, parser]);
|
|
1711
|
-
const interpolateEnv = (text, env) => {
|
|
1712
|
-
if (!env) return text;
|
|
1713
|
-
return text.replace(/\{(\w+)\}/g, (match, key) => {
|
|
1714
|
-
return env[key] || match;
|
|
1715
|
-
});
|
|
1716
|
-
};
|
|
1717
|
-
if (loading) {
|
|
1718
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-center py-12", children: [
|
|
1719
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react8.Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }),
|
|
1720
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "ml-2 text-muted-foreground", children: "Loading API specification..." })
|
|
1721
|
-
] });
|
|
1722
|
-
}
|
|
1723
|
-
if (error) {
|
|
1724
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rounded-lg border border-red-500/20 bg-red-500/10 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-sm text-red-600 dark:text-red-400", children: [
|
|
1725
|
-
"Error: ",
|
|
1726
|
-
error
|
|
1727
|
-
] }) });
|
|
1728
|
-
}
|
|
1729
|
-
if (!apiSpec) {
|
|
1730
|
-
return null;
|
|
1731
|
-
}
|
|
1732
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-6", children: [
|
|
1733
|
-
(apiSpec.title || apiSpec.description) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "mb-8", children: [
|
|
1734
|
-
apiSpec.title && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "text-2xl font-semibold mb-2 text-foreground", children: apiSpec.title }),
|
|
1735
|
-
apiSpec.description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: apiSpec.description }),
|
|
1736
|
-
apiSpec.baseUrl && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "mt-4", children: [
|
|
1737
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm font-semibold text-muted-foreground mb-1", children: "Base URL" }),
|
|
1738
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("code", { className: "text-sm px-2 py-1 bg-muted rounded", children: apiSpec.baseUrl })
|
|
1739
|
-
] })
|
|
1740
|
-
] }),
|
|
1741
|
-
apiSpec.auth && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rounded-lg border border-border bg-card/30 p-4 mb-6", children: [
|
|
1742
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "text-lg font-semibold mb-2 text-foreground", children: "Authentication" }),
|
|
1743
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-muted-foreground mb-2", children: apiSpec.auth.description || `This API uses ${apiSpec.auth.type} authentication.` }),
|
|
1744
|
-
apiSpec.auth.type === "bearer" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1745
|
-
CodeBlock,
|
|
1746
|
-
{
|
|
1747
|
-
code: `Authorization: ${apiSpec.auth.tokenPrefix || "Bearer"} {YOUR_TOKEN}`,
|
|
1748
|
-
language: "bash"
|
|
1749
|
-
}
|
|
1750
|
-
),
|
|
1751
|
-
apiSpec.auth.type === "apiKey" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1752
|
-
CodeBlock,
|
|
1753
|
-
{
|
|
1754
|
-
code: `${apiSpec.auth.headerName || "X-API-Key"}: {YOUR_API_KEY}`,
|
|
1755
|
-
language: "bash"
|
|
1756
|
-
}
|
|
1757
|
-
)
|
|
1758
|
-
] }),
|
|
1759
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Accordion, { type: "single", collapsible: true, className: "space-y-4", children: apiSpec.endpoints.map((endpoint, index) => {
|
|
1760
|
-
const allHeaders = [
|
|
1761
|
-
...apiSpec.globalHeaders || [],
|
|
1762
|
-
...endpoint.headers || []
|
|
1763
|
-
].map((header) => ({
|
|
1764
|
-
...header,
|
|
1765
|
-
value: interpolateEnv(header.value, apiSpec.env)
|
|
1766
|
-
}));
|
|
1767
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1768
|
-
AccordionItem,
|
|
1769
|
-
{
|
|
1770
|
-
value: `endpoint-${index}`,
|
|
1771
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
1772
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1773
|
-
"span",
|
|
1774
|
-
{
|
|
1775
|
-
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"}`,
|
|
1776
|
-
children: endpoint.method
|
|
1777
|
-
}
|
|
1778
|
-
),
|
|
1779
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("code", { className: "text-sm font-mono", children: endpoint.path }),
|
|
1780
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-sm text-muted-foreground ml-auto", children: endpoint.title })
|
|
1781
|
-
] }),
|
|
1782
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-6 pt-4", children: [
|
|
1783
|
-
endpoint.description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-muted-foreground", children: endpoint.description }),
|
|
1784
|
-
endpoint.pathParams && endpoint.pathParams.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ApiParams, { title: "Path Parameters", params: endpoint.pathParams }),
|
|
1785
|
-
endpoint.queryParams && endpoint.queryParams.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ApiParams, { title: "Query Parameters", params: endpoint.queryParams }),
|
|
1786
|
-
allHeaders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
|
|
1787
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Headers" }),
|
|
1788
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "space-y-2", children: allHeaders.map((header, idx) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
1789
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1790
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("code", { className: "text-sm font-mono text-foreground", children: header.name }),
|
|
1791
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-xs text-muted-foreground", children: header.value })
|
|
1792
|
-
] }),
|
|
1793
|
-
header.description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-muted-foreground", children: header.description })
|
|
1794
|
-
] }, idx)) })
|
|
1795
|
-
] }),
|
|
1796
|
-
endpoint.body && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
|
|
1797
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Request Body" }),
|
|
1798
|
-
endpoint.body.description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-muted-foreground mb-2", children: endpoint.body.description }),
|
|
1799
|
-
endpoint.body.example && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1800
|
-
CodeBlock,
|
|
1801
|
-
{
|
|
1802
|
-
code: typeof endpoint.body.example === "string" ? endpoint.body.example : JSON.stringify(endpoint.body.example, null, 2),
|
|
1803
|
-
language: "json"
|
|
1804
|
-
}
|
|
1805
|
-
)
|
|
1806
|
-
] }),
|
|
1807
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
|
|
1808
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Responses" }),
|
|
1809
|
-
endpoint.successResponse && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1810
|
-
ApiResponse,
|
|
1811
|
-
{
|
|
1812
|
-
status: endpoint.successResponse.status,
|
|
1813
|
-
description: endpoint.successResponse.description,
|
|
1814
|
-
example: endpoint.successResponse.example,
|
|
1815
|
-
schema: endpoint.successResponse.schema
|
|
1816
|
-
}
|
|
1817
|
-
),
|
|
1818
|
-
endpoint.errorResponses?.map((response, idx) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1819
|
-
ApiResponse,
|
|
1820
|
-
{
|
|
1821
|
-
status: response.status,
|
|
1822
|
-
description: response.description,
|
|
1823
|
-
example: response.example,
|
|
1824
|
-
schema: response.schema
|
|
1825
|
-
},
|
|
1826
|
-
idx
|
|
1827
|
-
))
|
|
1828
|
-
] }),
|
|
1829
|
-
endpoint.examples && endpoint.examples.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
|
|
1830
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "text-sm font-semibold text-foreground mb-3", children: "Examples" }),
|
|
1831
|
-
endpoint.examples.map((example, idx) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "mb-3", children: [
|
|
1832
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-2", children: example.title }),
|
|
1833
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CodeBlock, { code: example.code, language: example.language })
|
|
1834
|
-
] }, idx))
|
|
1835
|
-
] }),
|
|
1836
|
-
showPlayground && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1837
|
-
ApiPlayground,
|
|
1838
|
-
{
|
|
1839
|
-
method: endpoint.method,
|
|
1840
|
-
path: endpoint.path,
|
|
1841
|
-
baseUrl: apiSpec.baseUrl,
|
|
1842
|
-
headers: Object.fromEntries(allHeaders.map((h) => [h.name, h.value])),
|
|
1843
|
-
pathParams: endpoint.pathParams,
|
|
1844
|
-
defaultBody: endpoint.body?.example ? typeof endpoint.body.example === "string" ? endpoint.body.example : JSON.stringify(endpoint.body.example, null, 2) : void 0
|
|
1845
|
-
}
|
|
1846
|
-
)
|
|
1847
|
-
] })
|
|
1848
|
-
},
|
|
1849
|
-
index
|
|
1850
|
-
);
|
|
1851
|
-
}) })
|
|
1852
|
-
] });
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
// src/components/docs/mdx-components.tsx
|
|
1856
|
-
var mdxComponents = {
|
|
1857
|
-
...createMdxPrimitives({ CodeBlock }),
|
|
1858
|
-
CodeBlock,
|
|
1859
|
-
Callout,
|
|
1860
|
-
Accordion,
|
|
1861
|
-
AccordionItem,
|
|
1862
|
-
Tabs,
|
|
1863
|
-
Tab,
|
|
1864
|
-
Image,
|
|
1865
|
-
Video,
|
|
1866
|
-
Card,
|
|
1867
|
-
CardGrid,
|
|
1868
|
-
ImageCard,
|
|
1869
|
-
ImageCardGrid,
|
|
1870
|
-
Steps,
|
|
1871
|
-
Step,
|
|
1872
|
-
Icon,
|
|
1873
|
-
Mermaid,
|
|
1874
|
-
Math: Math2,
|
|
1875
|
-
Columns,
|
|
1876
|
-
Column,
|
|
1877
|
-
Badge,
|
|
1878
|
-
Tooltip,
|
|
1879
|
-
Frame,
|
|
1880
|
-
ApiEndpoint,
|
|
1881
|
-
ApiParams,
|
|
1882
|
-
ApiResponse,
|
|
1883
|
-
ApiPlayground,
|
|
1884
|
-
ApiReference
|
|
1885
|
-
};
|
|
1886
|
-
|
|
1887
|
-
// src/mdx-components-server.tsx
|
|
1888
|
-
var import_components = require("./components/index");
|
|
1889
|
-
var mdxComponents2 = {
|
|
1890
|
-
...createMdxPrimitives({ CodeBlock: import_components.CodeBlock }),
|
|
1891
|
-
CodeBlock: import_components.CodeBlock,
|
|
1892
|
-
Callout: import_components.Callout,
|
|
1893
|
-
Accordion: import_components.Accordion,
|
|
1894
|
-
AccordionItem: import_components.AccordionItem,
|
|
1895
|
-
Tabs: import_components.Tabs,
|
|
1896
|
-
Tab: import_components.Tab,
|
|
1897
|
-
Image: import_components.Image,
|
|
1898
|
-
Video: import_components.Video,
|
|
1899
|
-
Card: import_components.Card,
|
|
1900
|
-
CardGrid: import_components.CardGrid,
|
|
1901
|
-
ImageCard: import_components.ImageCard,
|
|
1902
|
-
ImageCardGrid: import_components.ImageCardGrid,
|
|
1903
|
-
Steps: import_components.Steps,
|
|
1904
|
-
Step: import_components.Step,
|
|
1905
|
-
Icon: import_components.Icon,
|
|
1906
|
-
Mermaid: import_components.Mermaid,
|
|
1907
|
-
Math: import_components.Math,
|
|
1908
|
-
Columns: import_components.Columns,
|
|
1909
|
-
Column: import_components.Column,
|
|
1910
|
-
Badge: import_components.Badge,
|
|
1911
|
-
Tooltip: import_components.Tooltip,
|
|
1912
|
-
Frame: import_components.Frame,
|
|
1913
|
-
ApiEndpoint: import_components.ApiEndpoint,
|
|
1914
|
-
ApiParams: import_components.ApiParams,
|
|
1915
|
-
ApiResponse: import_components.ApiResponse,
|
|
1916
|
-
ApiPlayground: import_components.ApiPlayground,
|
|
1917
|
-
ApiReference: import_components.ApiReference
|
|
1918
|
-
};
|
|
1919
|
-
|
|
1920
|
-
// src/mdx-components.tsx
|
|
1921
|
-
function useMDXComponents(components) {
|
|
1922
|
-
return {
|
|
1923
|
-
...mdxComponents,
|
|
1924
|
-
...components
|
|
1925
|
-
};
|
|
1926
|
-
}
|
|
1927
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1928
|
-
0 && (module.exports = {
|
|
1929
|
-
mdxComponents,
|
|
1930
|
-
useMDXComponents
|
|
1931
|
-
});
|
|
1932
|
-
//# sourceMappingURL=mdx-components.js.map
|