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