@vercel/geistdocs 1.2.1 → 1.2.3-canary.48fea3c
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/dist/cli/index.js +3 -0
- package/dist/components/callout.d.ts +12 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +7 -0
- package/dist/components/code-block-tabs.d.ts +7 -0
- package/dist/components/code-block-tabs.d.ts.map +1 -0
- package/dist/components/code-block-tabs.js +7 -0
- package/dist/components/code-block.d.ts +14 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.js +45 -0
- package/dist/components/copy-prompt.d.ts +11 -0
- package/dist/components/copy-prompt.d.ts.map +1 -0
- package/dist/components/copy-prompt.js +58 -0
- package/dist/components/mermaid.d.ts +4 -0
- package/dist/components/mermaid.d.ts.map +1 -0
- package/dist/components/mermaid.js +44 -0
- package/dist/components/theme-aware-image.d.ts +12 -0
- package/dist/components/theme-aware-image.d.ts.map +1 -0
- package/dist/components/theme-aware-image.js +8 -0
- package/dist/components/video.d.ts +6 -0
- package/dist/components/video.d.ts.map +1 -0
- package/dist/components/video.js +3 -0
- package/dist/config.d.ts +71 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1 -0
- package/dist/controls.d.ts +15 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +52 -0
- package/dist/internal/chat/context.d.ts +19 -0
- package/dist/internal/chat/context.d.ts.map +1 -0
- package/dist/internal/chat/context.js +36 -0
- package/dist/internal/chat/conversation.d.ts +10 -0
- package/dist/internal/chat/conversation.d.ts.map +1 -0
- package/dist/internal/chat/conversation.js +16 -0
- package/dist/internal/chat/copy-chat.d.ts +5 -0
- package/dist/internal/chat/copy-chat.d.ts.map +1 -0
- package/dist/internal/chat/copy-chat.js +35 -0
- package/dist/internal/chat/db.d.ts +13 -0
- package/dist/internal/chat/db.d.ts.map +1 -0
- package/dist/internal/chat/db.js +19 -0
- package/dist/internal/chat/message-metadata.d.ts +8 -0
- package/dist/internal/chat/message-metadata.d.ts.map +1 -0
- package/dist/internal/chat/message-metadata.js +29 -0
- package/dist/internal/chat/message.d.ts +11 -0
- package/dist/internal/chat/message.d.ts.map +1 -0
- package/dist/internal/chat/message.js +11 -0
- package/dist/internal/chat/prompt-input.d.ts +13 -0
- package/dist/internal/chat/prompt-input.d.ts.map +1 -0
- package/dist/internal/chat/prompt-input.js +39 -0
- package/dist/internal/chat/shell.d.ts +2 -0
- package/dist/internal/chat/shell.d.ts.map +1 -0
- package/dist/internal/chat/shell.js +194 -0
- package/dist/internal/chat/shimmer.d.ts +11 -0
- package/dist/internal/chat/shimmer.d.ts.map +1 -0
- package/dist/internal/chat/shimmer.js +18 -0
- package/dist/internal/chat/sources.d.ts +13 -0
- package/dist/internal/chat/sources.d.ts.map +1 -0
- package/dist/internal/chat/sources.js +9 -0
- package/dist/internal/chat/suggestion.d.ts +11 -0
- package/dist/internal/chat/suggestion.d.ts.map +1 -0
- package/dist/internal/chat/suggestion.js +12 -0
- package/dist/internal/cn.d.ts +3 -0
- package/dist/internal/cn.d.ts.map +1 -0
- package/dist/internal/cn.js +3 -0
- package/dist/internal/feedback-action.d.ts +14 -0
- package/dist/internal/feedback-action.d.ts.map +1 -0
- package/dist/internal/feedback-action.js +34 -0
- package/dist/internal/i18n.d.ts +6 -0
- package/dist/internal/i18n.d.ts.map +1 -0
- package/dist/internal/i18n.js +18 -0
- package/dist/internal/languages.d.ts +7 -0
- package/dist/internal/languages.d.ts.map +1 -0
- package/dist/internal/languages.js +18 -0
- package/dist/internal/not-implemented.d.ts +2 -0
- package/dist/internal/not-implemented.d.ts.map +1 -0
- package/dist/internal/not-implemented.js +4 -0
- package/dist/internal/page-actions-client.d.ts +13 -0
- package/dist/internal/page-actions-client.d.ts.map +1 -0
- package/dist/internal/page-actions-client.js +160 -0
- package/dist/internal/page-actions.d.ts +18 -0
- package/dist/internal/page-actions.d.ts.map +1 -0
- package/dist/internal/page-actions.js +4 -0
- package/dist/internal/provider-client.d.ts +9 -0
- package/dist/internal/provider-client.d.ts.map +1 -0
- package/dist/internal/provider-client.js +23 -0
- package/dist/internal/search.d.ts +5 -0
- package/dist/internal/search.d.ts.map +1 -0
- package/dist/internal/search.js +14 -0
- package/dist/internal/sidebar.d.ts +9 -0
- package/dist/internal/sidebar.d.ts.map +1 -0
- package/dist/internal/sidebar.js +38 -0
- package/dist/internal/table-of-contents.d.ts +9 -0
- package/dist/internal/table-of-contents.d.ts.map +1 -0
- package/dist/internal/table-of-contents.js +5 -0
- package/dist/internal/ui/button-group.d.ts +13 -0
- package/dist/internal/ui/button-group.d.ts.map +1 -0
- package/dist/internal/ui/button-group.js +26 -0
- package/dist/internal/ui/button.d.ts +12 -0
- package/dist/internal/ui/button.d.ts.map +1 -0
- package/dist/internal/ui/button.js +33 -0
- package/dist/internal/ui/card.d.ts +6 -0
- package/dist/internal/ui/card.d.ts.map +1 -0
- package/dist/internal/ui/card.js +14 -0
- package/dist/internal/ui/collapsible.d.ts +6 -0
- package/dist/internal/ui/collapsible.d.ts.map +1 -0
- package/dist/internal/ui/collapsible.js +12 -0
- package/dist/internal/ui/drawer.d.ts +6 -0
- package/dist/internal/ui/drawer.d.ts.map +1 -0
- package/dist/internal/ui/drawer.js +13 -0
- package/dist/internal/ui/dropdown-menu.d.ts +22 -0
- package/dist/internal/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/internal/ui/dropdown-menu.js +41 -0
- package/dist/internal/ui/input-group.d.ts +15 -0
- package/dist/internal/ui/input-group.d.ts.map +1 -0
- package/dist/internal/ui/input-group.js +44 -0
- package/dist/internal/ui/input.d.ts +3 -0
- package/dist/internal/ui/input.d.ts.map +1 -0
- package/dist/internal/ui/input.js +5 -0
- package/dist/internal/ui/kbd.d.ts +4 -0
- package/dist/internal/ui/kbd.d.ts.map +1 -0
- package/dist/internal/ui/kbd.js +8 -0
- package/dist/internal/ui/popover.d.ts +6 -0
- package/dist/internal/ui/popover.d.ts.map +1 -0
- package/dist/internal/ui/popover.js +13 -0
- package/dist/internal/ui/scroll-area.d.ts +5 -0
- package/dist/internal/ui/scroll-area.d.ts.map +1 -0
- package/dist/internal/ui/scroll-area.js +12 -0
- package/dist/internal/ui/separator.d.ts +4 -0
- package/dist/internal/ui/separator.d.ts.map +1 -0
- package/dist/internal/ui/separator.js +7 -0
- package/dist/internal/ui/sheet.d.ts +10 -0
- package/dist/internal/ui/sheet.d.ts.map +1 -0
- package/dist/internal/ui/sheet.js +24 -0
- package/dist/internal/ui/sonner.d.ts +3 -0
- package/dist/internal/ui/sonner.d.ts.map +1 -0
- package/dist/internal/ui/sonner.js +20 -0
- package/dist/internal/ui/spinner.d.ts +3 -0
- package/dist/internal/ui/spinner.d.ts.map +1 -0
- package/dist/internal/ui/spinner.js +6 -0
- package/dist/internal/ui/textarea.d.ts +3 -0
- package/dist/internal/ui/textarea.d.ts.map +1 -0
- package/dist/internal/ui/textarea.js +5 -0
- package/dist/internal/ui/tooltip.d.ts +7 -0
- package/dist/internal/ui/tooltip.d.ts.map +1 -0
- package/dist/internal/ui/tooltip.js +16 -0
- package/dist/internal/use-mobile.d.ts +2 -0
- package/dist/internal/use-mobile.d.ts.map +1 -0
- package/dist/internal/use-mobile.js +16 -0
- package/dist/layout.d.ts +14 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +31 -0
- package/dist/mdx.d.ts +36 -0
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +74 -0
- package/dist/pages/docs.d.ts +77 -0
- package/dist/pages/docs.d.ts.map +1 -0
- package/dist/pages/docs.js +92 -0
- package/dist/proxy.d.ts +37 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +162 -0
- package/dist/routes/chat.d.ts +14 -0
- package/dist/routes/chat.d.ts.map +1 -0
- package/dist/routes/chat.js +242 -0
- package/dist/routes/llms.d.ts +51 -0
- package/dist/routes/llms.d.ts.map +1 -0
- package/dist/routes/llms.js +59 -0
- package/dist/routes/search.d.ts +11 -0
- package/dist/routes/search.d.ts.map +1 -0
- package/dist/routes/search.js +74 -0
- package/dist/routes/sitemap.d.ts +44 -0
- package/dist/routes/sitemap.d.ts.map +1 -0
- package/dist/routes/sitemap.js +168 -0
- package/dist/sidebar.d.ts +11 -0
- package/dist/sidebar.d.ts.map +1 -0
- package/dist/sidebar.js +16 -0
- package/dist/source.d.ts +174 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +129 -0
- package/dist/versions.d.ts +15 -0
- package/dist/versions.d.ts.map +1 -0
- package/dist/versions.js +52 -0
- package/package.json +141 -9
- package/styles.css +193 -0
- package/template/_gitignore +29 -0
- package/template/app/[lang]/(home)/components/centered-section.tsx +26 -0
- package/template/app/[lang]/(home)/components/cta.tsx +19 -0
- package/template/app/[lang]/(home)/components/hero.tsx +27 -0
- package/template/app/[lang]/(home)/components/one-two-section.tsx +25 -0
- package/template/app/[lang]/(home)/components/templates.tsx +50 -0
- package/template/app/[lang]/(home)/components/text-grid-section.tsx +20 -0
- package/template/app/[lang]/(home)/layout.tsx +14 -0
- package/template/app/[lang]/(home)/page.tsx +126 -0
- package/template/app/[lang]/docs/[[...slug]]/page.tsx +19 -0
- package/template/app/[lang]/docs/layout.tsx +14 -0
- package/template/app/[lang]/layout.tsx +29 -0
- package/template/app/[lang]/llms.mdx/[[...slug]]/route.ts +7 -0
- package/template/app/[lang]/llms.txt/route.ts +6 -0
- package/template/app/[lang]/og/[...slug]/background.png +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-regular.ttf +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-semibold.ttf +0 -0
- package/template/app/[lang]/og/[...slug]/route.tsx +95 -0
- package/template/app/[lang]/rss.xml/route.ts +52 -0
- package/template/app/[lang]/sitemap.md/route.ts +9 -0
- package/template/app/actions/feedback/emotions.ts +18 -0
- package/template/app/actions/feedback/index.ts +45 -0
- package/template/app/api/chat/route.ts +8 -0
- package/template/app/api/search/route.ts +5 -0
- package/template/app/favicon.ico +0 -0
- package/template/app/global.css +2 -0
- package/template/app/robots.ts +14 -0
- package/template/app/sitemap.ts +36 -0
- package/template/app/styles/geistdocs.css +554 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-arrow-up-right-small.tsx +35 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-arrow-up-right.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-check.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-chevron-down-small.tsx +30 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-chevron-right.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-copy.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-file-text.tsx +25 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-menu-alt.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-slash-forward.tsx +36 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/index.tsx +11 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/index.tsx +14 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-ai-elements.tsx +29 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-ai-sdk.tsx +38 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-chat-sdk.tsx +42 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-flags-sdk.tsx +42 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-icon-vercel.tsx +31 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-streamdown.tsx +29 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-vercel-oss.tsx +24 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-workflow-sdk.tsx +73 -0
- package/template/components/geistdocs/callout.tsx +40 -0
- package/template/components/geistdocs/chat.tsx +24 -0
- package/template/components/geistdocs/code-block-tabs.tsx +61 -0
- package/template/components/geistdocs/code-block.tsx +134 -0
- package/template/components/geistdocs/copy-page.tsx +27 -0
- package/template/components/geistdocs/desktop-menu.tsx +52 -0
- package/template/components/geistdocs/docs-layout.tsx +20 -0
- package/template/components/geistdocs/docs-page.tsx +35 -0
- package/template/components/geistdocs/edit-source.tsx +30 -0
- package/template/components/geistdocs/feedback.tsx +139 -0
- package/template/components/geistdocs/footer.tsx +30 -0
- package/template/components/geistdocs/github-button.tsx +19 -0
- package/template/components/geistdocs/home-layout.tsx +46 -0
- package/template/components/geistdocs/icons.tsx +13 -0
- package/template/components/geistdocs/installer.tsx +58 -0
- package/template/components/geistdocs/language-selector.tsx +3 -0
- package/template/components/geistdocs/mdx-components.tsx +5 -0
- package/template/components/geistdocs/mermaid.tsx +68 -0
- package/template/components/geistdocs/mobile-docs-bar.tsx +77 -0
- package/template/components/geistdocs/mobile-menu.tsx +150 -0
- package/template/components/geistdocs/navbar-logo.tsx +124 -0
- package/template/components/geistdocs/navbar.tsx +22 -0
- package/template/components/geistdocs/provider.tsx +31 -0
- package/template/components/geistdocs/rss-button.tsx +10 -0
- package/template/components/geistdocs/scroll-top.tsx +21 -0
- package/template/components/geistdocs/search.tsx +17 -0
- package/template/components/geistdocs/sidebar.tsx +128 -0
- package/template/components/geistdocs/theme-aware-image.tsx +22 -0
- package/template/components/geistdocs/theme-toggle.tsx +3 -0
- package/template/components/geistdocs/video.tsx +16 -0
- package/template/components/ui/badge.tsx +46 -0
- package/template/components/ui/button-group.tsx +83 -0
- package/template/components/ui/button.tsx +60 -0
- package/template/components/ui/card.tsx +92 -0
- package/template/components/ui/collapsible.tsx +33 -0
- package/template/components/ui/command-prompt.tsx +488 -0
- package/template/components/ui/command.tsx +184 -0
- package/template/components/ui/dialog.tsx +143 -0
- package/template/components/ui/drawer.tsx +135 -0
- package/template/components/ui/dropdown-menu.tsx +257 -0
- package/template/components/ui/hover-card.tsx +44 -0
- package/template/components/ui/input-group.tsx +170 -0
- package/template/components/ui/input.tsx +21 -0
- package/template/components/ui/kbd.tsx +28 -0
- package/template/components/ui/navigation-menu.tsx +192 -0
- package/template/components/ui/popover.tsx +48 -0
- package/template/components/ui/scroll-area.tsx +58 -0
- package/template/components/ui/select.tsx +187 -0
- package/template/components/ui/separator.tsx +28 -0
- package/template/components/ui/sheet.tsx +139 -0
- package/template/components/ui/sonner.tsx +40 -0
- package/template/components/ui/spinner.tsx +16 -0
- package/template/components/ui/textarea.tsx +18 -0
- package/template/components/ui/tooltip.tsx +61 -0
- package/template/components.json +22 -0
- package/template/content/docs/ask-ai.cn.mdx +85 -0
- package/template/content/docs/ask-ai.mdx +89 -0
- package/template/content/docs/configuration.cn.mdx +155 -0
- package/template/content/docs/configuration.mdx +200 -0
- package/template/content/docs/deployment.cn.mdx +34 -0
- package/template/content/docs/deployment.mdx +40 -0
- package/template/content/docs/edit-on-github.cn.mdx +47 -0
- package/template/content/docs/edit-on-github.mdx +51 -0
- package/template/content/docs/env.cn.mdx +25 -0
- package/template/content/docs/env.mdx +29 -0
- package/template/content/docs/feedback.cn.mdx +85 -0
- package/template/content/docs/feedback.mdx +89 -0
- package/template/content/docs/getting-started.cn.mdx +86 -0
- package/template/content/docs/getting-started.mdx +107 -0
- package/template/content/docs/index.cn.mdx +57 -0
- package/template/content/docs/index.mdx +92 -0
- package/template/content/docs/internationalization.cn.mdx +111 -0
- package/template/content/docs/internationalization.mdx +122 -0
- package/template/content/docs/llms-txt.cn.mdx +72 -0
- package/template/content/docs/llms-txt.mdx +85 -0
- package/template/content/docs/md.cn.mdx +65 -0
- package/template/content/docs/md.mdx +81 -0
- package/template/content/docs/meta.json +23 -0
- package/template/content/docs/open-in-chat.cn.mdx +78 -0
- package/template/content/docs/open-in-chat.mdx +80 -0
- package/template/content/docs/provider.cn.mdx +70 -0
- package/template/content/docs/provider.mdx +74 -0
- package/template/content/docs/proxy.cn.mdx +96 -0
- package/template/content/docs/proxy.mdx +124 -0
- package/template/content/docs/rss.cn.mdx +104 -0
- package/template/content/docs/rss.mdx +108 -0
- package/template/content/docs/syntax.cn.mdx +416 -0
- package/template/content/docs/syntax.mdx +411 -0
- package/template/content/docs/theme-aware-image.mdx +57 -0
- package/template/content/docs/versioned-docs.cn.mdx +117 -0
- package/template/content/docs/versioned-docs.mdx +181 -0
- package/template/geistdocs.tsx +51 -0
- package/template/hooks/geistdocs/use-sidebar.ts +13 -0
- package/template/hooks/use-mobile.ts +19 -0
- package/template/lib/geistdocs/config.tsx +27 -0
- package/template/lib/geistdocs/fonts.ts +18 -0
- package/template/lib/geistdocs/i18n.ts +13 -0
- package/template/lib/geistdocs/md-tracking.ts +56 -0
- package/template/lib/geistdocs/source.ts +12 -0
- package/template/lib/utils.ts +6 -0
- package/template/next.config.ts +22 -0
- package/template/package.json +63 -0
- package/template/postcss.config.mjs +5 -0
- package/template/proxy.ts +18 -0
- package/template/source.config.ts +62 -0
- package/template/tsconfig.json +37 -0
- package/dist/index.js +0 -2
- /package/dist/{index.d.ts → cli/index.d.ts} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { NextRequest } from "next/server";
|
|
2
|
+
import type { GeistdocsSourceBundle } from "../source";
|
|
3
|
+
type SourceBundle = GeistdocsSourceBundle;
|
|
4
|
+
type GeistdocsPage = NonNullable<ReturnType<SourceBundle["source"]["getPage"]>>;
|
|
5
|
+
interface DocsMarkdownParams {
|
|
6
|
+
lang: string;
|
|
7
|
+
slug?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface MarkdownTransformContext {
|
|
10
|
+
lang: string;
|
|
11
|
+
page: GeistdocsPage;
|
|
12
|
+
source: SourceBundle;
|
|
13
|
+
}
|
|
14
|
+
type MarkdownTransform = (markdown: string, context: MarkdownTransformContext) => Promise<string> | string;
|
|
15
|
+
interface CreateLlmsRouteOptions {
|
|
16
|
+
filterPage?: (page: GeistdocsPage, context: {
|
|
17
|
+
lang: string;
|
|
18
|
+
}) => boolean;
|
|
19
|
+
source?: SourceBundle;
|
|
20
|
+
sources?: SourceBundle[];
|
|
21
|
+
transform?: MarkdownTransform;
|
|
22
|
+
}
|
|
23
|
+
export declare const createLlmsRoute: ({ filterPage, source, sources, transform, }: CreateLlmsRouteOptions) => {
|
|
24
|
+
GET: (_req: NextRequest, { params }: {
|
|
25
|
+
params: Promise<{
|
|
26
|
+
lang: string;
|
|
27
|
+
}>;
|
|
28
|
+
}) => Promise<Response>;
|
|
29
|
+
revalidate: false;
|
|
30
|
+
};
|
|
31
|
+
interface CreateDocsMarkdownRouteOptions {
|
|
32
|
+
filterStaticParams?: (params: DocsMarkdownParams) => boolean;
|
|
33
|
+
source: SourceBundle;
|
|
34
|
+
transform?: MarkdownTransform;
|
|
35
|
+
}
|
|
36
|
+
export declare const createDocsMarkdownRoute: ({ filterStaticParams, source, transform, }: CreateDocsMarkdownRouteOptions) => {
|
|
37
|
+
GET: (_req: Request, { params }: {
|
|
38
|
+
params: Promise<{
|
|
39
|
+
lang: string;
|
|
40
|
+
slug?: string[];
|
|
41
|
+
}>;
|
|
42
|
+
}) => Promise<Response>;
|
|
43
|
+
generateStaticParams: ({ params, }: {
|
|
44
|
+
params: Promise<{
|
|
45
|
+
lang: string;
|
|
46
|
+
}>;
|
|
47
|
+
}) => Promise<DocsMarkdownParams[]>;
|
|
48
|
+
revalidate: false;
|
|
49
|
+
};
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=llms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms.d.ts","sourceRoot":"","sources":["../../src/routes/llms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAChF,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,KAAK,iBAAiB,GAAG,CACvB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAE9B,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;IACzE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAeD,eAAO,MAAM,eAAe,GAAI,6CAK7B,sBAAsB;gBAIf,WAAW,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;;CA4BpD,CAAC;AAEF,UAAU,8BAA8B;IACtC,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC;IAC7D,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,eAAO,MAAM,uBAAuB,GAAI,4CAIrC,8BAA8B;gBAEvB,OAAO,cACD;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAA;KAAE;wCAuBjE;QACD,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACnC;;CAeF,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { notFound } from "next/navigation";
|
|
2
|
+
const resolveSources = (source, sources) => {
|
|
3
|
+
const resolvedSources = sources ?? (source ? [source] : []);
|
|
4
|
+
if (resolvedSources.length === 0) {
|
|
5
|
+
throw new Error("createLlmsRoute requires source or sources.");
|
|
6
|
+
}
|
|
7
|
+
return resolvedSources;
|
|
8
|
+
};
|
|
9
|
+
export const createLlmsRoute = ({ filterPage, source, sources, transform, }) => {
|
|
10
|
+
const routeSources = resolveSources(source, sources);
|
|
11
|
+
const GET = async (_req, { params }) => {
|
|
12
|
+
const { lang } = await params;
|
|
13
|
+
const scanned = await Promise.all(routeSources.flatMap((entry) => entry.source
|
|
14
|
+
.getPages(lang)
|
|
15
|
+
.filter((page) => filterPage?.(page, { lang }) ?? true)
|
|
16
|
+
.map(async (page) => {
|
|
17
|
+
const rendered = await entry.getPageMarkdown(page);
|
|
18
|
+
return transform
|
|
19
|
+
? await transform(rendered, { lang, page, source: entry })
|
|
20
|
+
: rendered;
|
|
21
|
+
})));
|
|
22
|
+
return new Response(scanned.join("\n\n"), {
|
|
23
|
+
headers: {
|
|
24
|
+
"Content-Type": "text/markdown; charset=utf-8",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
GET,
|
|
30
|
+
revalidate: false,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export const createDocsMarkdownRoute = ({ filterStaticParams, source, transform, }) => {
|
|
34
|
+
const GET = async (_req, { params }) => {
|
|
35
|
+
const { slug, lang } = await params;
|
|
36
|
+
const page = source.source.getPage(slug, lang);
|
|
37
|
+
if (!page) {
|
|
38
|
+
notFound();
|
|
39
|
+
}
|
|
40
|
+
const rendered = await source.getPageMarkdown(page);
|
|
41
|
+
return new Response(transform ? await transform(rendered, { lang, page, source }) : rendered, {
|
|
42
|
+
headers: {
|
|
43
|
+
"Content-Type": "text/markdown",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const generateStaticParams = async ({ params, }) => {
|
|
48
|
+
const { lang } = await params;
|
|
49
|
+
const staticParams = source.source.generateParams(lang);
|
|
50
|
+
return filterStaticParams
|
|
51
|
+
? staticParams.filter(filterStaticParams)
|
|
52
|
+
: staticParams;
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
GET,
|
|
56
|
+
generateStaticParams,
|
|
57
|
+
revalidate: false,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GeistdocsConfig } from "../config";
|
|
2
|
+
import type { GeistdocsSourceBundle } from "../source";
|
|
3
|
+
type SearchSource = GeistdocsSourceBundle["source"];
|
|
4
|
+
interface CreateSearchRouteOptions {
|
|
5
|
+
config: Pick<GeistdocsConfig, "defaultLanguage" | "translations">;
|
|
6
|
+
source?: SearchSource;
|
|
7
|
+
sources?: SearchSource[];
|
|
8
|
+
}
|
|
9
|
+
export declare const createSearchRoute: ({ config, source, sources, }: CreateSearchRouteOptions) => (request: Request) => Promise<Response>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/routes/search.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAIpD,UAAU,wBAAwB;IAChC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AAiCD,eAAO,MAAM,iBAAiB,GAAI,8BAI/B,wBAAwB,4CAmE1B,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createTokenizer as createTokenizerJapanese } from "@orama/tokenizers/japanese";
|
|
2
|
+
import { createTokenizer as createTokenizerMandarin } from "@orama/tokenizers/mandarin";
|
|
3
|
+
import { defineI18n } from "fumadocs-core/i18n";
|
|
4
|
+
import { createI18nSearchAPI, } from "fumadocs-core/search/server";
|
|
5
|
+
const getLanguages = (config) => {
|
|
6
|
+
const defaultLanguage = config.defaultLanguage ?? "en";
|
|
7
|
+
const languages = Object.keys(config.translations ?? {});
|
|
8
|
+
return {
|
|
9
|
+
defaultLanguage,
|
|
10
|
+
languages: Array.from(new Set([defaultLanguage, ...languages])),
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const resolveSources = (source, sources) => {
|
|
14
|
+
const resolvedSources = sources ?? (source ? [source] : []);
|
|
15
|
+
if (resolvedSources.length === 0) {
|
|
16
|
+
throw new Error("createSearchRoute requires source or sources.");
|
|
17
|
+
}
|
|
18
|
+
return resolvedSources;
|
|
19
|
+
};
|
|
20
|
+
export const createSearchRoute = ({ config, source, sources, }) => {
|
|
21
|
+
const translations = config.translations ?? {};
|
|
22
|
+
const routeSources = resolveSources(source, sources);
|
|
23
|
+
const { defaultLanguage, languages } = getLanguages(config);
|
|
24
|
+
const i18n = defineI18n({
|
|
25
|
+
defaultLanguage,
|
|
26
|
+
languages,
|
|
27
|
+
hideLocale: "default-locale",
|
|
28
|
+
});
|
|
29
|
+
const localeMap = Object.fromEntries(Object.entries(translations).map(([locale, translation]) => [
|
|
30
|
+
locale,
|
|
31
|
+
translation.displayName.toLowerCase(),
|
|
32
|
+
]));
|
|
33
|
+
if ("cn" in translations) {
|
|
34
|
+
localeMap.cn = {
|
|
35
|
+
components: {
|
|
36
|
+
tokenizer: createTokenizerMandarin(),
|
|
37
|
+
},
|
|
38
|
+
search: {
|
|
39
|
+
threshold: 0,
|
|
40
|
+
tolerance: 0,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if ("jp" in translations) {
|
|
45
|
+
localeMap.jp = {
|
|
46
|
+
components: {
|
|
47
|
+
tokenizer: createTokenizerJapanese(),
|
|
48
|
+
},
|
|
49
|
+
search: {
|
|
50
|
+
threshold: 0,
|
|
51
|
+
tolerance: 0,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const getIndexes = () => languages.flatMap((locale) => routeSources.flatMap((source) => source.getPages(locale).map((page) => {
|
|
56
|
+
const data = page.data;
|
|
57
|
+
return {
|
|
58
|
+
id: page.url,
|
|
59
|
+
title: data.title ?? page.url,
|
|
60
|
+
description: data.description ?? "",
|
|
61
|
+
locale,
|
|
62
|
+
structuredData: data.structuredData ?? {
|
|
63
|
+
contents: [],
|
|
64
|
+
headings: [],
|
|
65
|
+
},
|
|
66
|
+
url: page.url,
|
|
67
|
+
};
|
|
68
|
+
})));
|
|
69
|
+
return createI18nSearchAPI("advanced", {
|
|
70
|
+
i18n,
|
|
71
|
+
indexes: getIndexes,
|
|
72
|
+
localeMap,
|
|
73
|
+
}).GET;
|
|
74
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { NextRequest } from "next/server";
|
|
2
|
+
import type { GeistdocsConfig } from "../config";
|
|
3
|
+
interface SitemapPage {
|
|
4
|
+
data: {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
summary?: string;
|
|
9
|
+
prerequisites?: string[];
|
|
10
|
+
product?: string;
|
|
11
|
+
lastModified?: Date;
|
|
12
|
+
};
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
|
15
|
+
interface SitemapSource {
|
|
16
|
+
getPages(lang: string): SitemapPage[];
|
|
17
|
+
}
|
|
18
|
+
interface SitemapSection {
|
|
19
|
+
source: SitemapSource;
|
|
20
|
+
title?: string;
|
|
21
|
+
}
|
|
22
|
+
interface CreateSitemapMarkdownRouteOptions {
|
|
23
|
+
config: Pick<GeistdocsConfig, "defaultLanguage" | "translations">;
|
|
24
|
+
source?: SitemapSource;
|
|
25
|
+
sources?: SitemapSection[];
|
|
26
|
+
title?: string;
|
|
27
|
+
transform?: (markdown: string, context: {
|
|
28
|
+
lang: string;
|
|
29
|
+
}) => Promise<string> | string;
|
|
30
|
+
}
|
|
31
|
+
export declare const createSitemapMarkdownRoute: ({ config, source, sources, title, transform, }: CreateSitemapMarkdownRouteOptions) => {
|
|
32
|
+
GET: (_req: NextRequest, { params }: {
|
|
33
|
+
params: Promise<{
|
|
34
|
+
lang: string;
|
|
35
|
+
}>;
|
|
36
|
+
}) => Promise<Response>;
|
|
37
|
+
generateStaticParams: () => {
|
|
38
|
+
lang: string;
|
|
39
|
+
}[];
|
|
40
|
+
revalidate: false;
|
|
41
|
+
dynamic: "error";
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=sitemap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../src/routes/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,UAAU,WAAW;IACnB,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,IAAI,CAAC;KACrB,CAAC;IACF,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;CACvC;AAED,UAAU,cAAc;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,iCAAiC;IACzC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,CACV,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KACtB,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CAC/B;AAsKD,eAAO,MAAM,0BAA0B,GAAI,gDAMxC,iCAAiC;gBAK1B,WAAW,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;;;;;;CAsDpD,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
const DOCS_PREFIX_PATTERN = /^\/docs\/?/;
|
|
2
|
+
const WHITESPACE_PATTERN = /\s+/;
|
|
3
|
+
const getLanguages = (config) => {
|
|
4
|
+
const defaultLanguage = config.defaultLanguage ?? "en";
|
|
5
|
+
const languages = Object.keys(config.translations ?? {});
|
|
6
|
+
return Array.from(new Set([defaultLanguage, ...languages]));
|
|
7
|
+
};
|
|
8
|
+
function buildTree(pages) {
|
|
9
|
+
const root = [];
|
|
10
|
+
const map = new Map();
|
|
11
|
+
const sorted = [...pages].sort((a, b) => a.url.localeCompare(b.url));
|
|
12
|
+
for (const page of sorted) {
|
|
13
|
+
const node = {
|
|
14
|
+
title: page.data.title ?? page.url,
|
|
15
|
+
description: page.data.description ?? "",
|
|
16
|
+
url: page.url,
|
|
17
|
+
type: page.data.type,
|
|
18
|
+
summary: page.data.summary,
|
|
19
|
+
prerequisites: page.data.prerequisites,
|
|
20
|
+
product: page.data.product,
|
|
21
|
+
lastmod: page.data.lastModified
|
|
22
|
+
? page.data.lastModified.toISOString().split("T")[0]
|
|
23
|
+
: undefined,
|
|
24
|
+
children: [],
|
|
25
|
+
};
|
|
26
|
+
map.set(page.url, node);
|
|
27
|
+
const segments = page.url.split("/").filter(Boolean);
|
|
28
|
+
if (segments.length <= 1) {
|
|
29
|
+
root.push(node);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const parentUrl = `/${segments.slice(0, -1).join("/")}`;
|
|
33
|
+
const parent = map.get(parentUrl);
|
|
34
|
+
if (parent) {
|
|
35
|
+
parent.children.push(node);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
root.push(node);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return root;
|
|
43
|
+
}
|
|
44
|
+
function inferDocType(url, explicitType) {
|
|
45
|
+
if (explicitType) {
|
|
46
|
+
return explicitType.charAt(0).toUpperCase() + explicitType.slice(1);
|
|
47
|
+
}
|
|
48
|
+
if (url.includes("/getting-started")) {
|
|
49
|
+
return "Guide";
|
|
50
|
+
}
|
|
51
|
+
if (url.includes("/reference")) {
|
|
52
|
+
return "Reference";
|
|
53
|
+
}
|
|
54
|
+
if (url.includes("/guides/")) {
|
|
55
|
+
return "Guide";
|
|
56
|
+
}
|
|
57
|
+
return "Conceptual";
|
|
58
|
+
}
|
|
59
|
+
function extractTopics(url, product) {
|
|
60
|
+
const topics = [];
|
|
61
|
+
if (product) {
|
|
62
|
+
topics.push(product);
|
|
63
|
+
}
|
|
64
|
+
const segments = url
|
|
65
|
+
.replace(DOCS_PREFIX_PATTERN, "")
|
|
66
|
+
.split("/")
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
for (const segment of segments) {
|
|
69
|
+
if (!topics.includes(segment)) {
|
|
70
|
+
topics.push(segment);
|
|
71
|
+
}
|
|
72
|
+
if (topics.length >= 3) {
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return topics.slice(0, 3);
|
|
77
|
+
}
|
|
78
|
+
function truncateToWords(text, maxWords) {
|
|
79
|
+
const words = text.split(WHITESPACE_PATTERN);
|
|
80
|
+
if (words.length <= maxWords) {
|
|
81
|
+
return text;
|
|
82
|
+
}
|
|
83
|
+
return `${words.slice(0, maxWords).join(" ")}...`;
|
|
84
|
+
}
|
|
85
|
+
function renderNode(node, indent, parentTitle) {
|
|
86
|
+
const prefix = " ".repeat(indent);
|
|
87
|
+
const lines = [];
|
|
88
|
+
const segments = [];
|
|
89
|
+
segments.push(`Type: ${inferDocType(node.url, node.type)}`);
|
|
90
|
+
if (node.lastmod) {
|
|
91
|
+
segments.push(`Lastmod: ${node.lastmod}`);
|
|
92
|
+
}
|
|
93
|
+
const summary = node.summary || node.description;
|
|
94
|
+
if (summary) {
|
|
95
|
+
segments.push(`Summary: ${truncateToWords(summary, 100)}`);
|
|
96
|
+
}
|
|
97
|
+
const prereqs = node.prerequisites && node.prerequisites.length > 0
|
|
98
|
+
? node.prerequisites.join(", ")
|
|
99
|
+
: parentTitle;
|
|
100
|
+
if (prereqs) {
|
|
101
|
+
segments.push(`Prerequisites: ${prereqs}`);
|
|
102
|
+
}
|
|
103
|
+
const topics = extractTopics(node.url, node.product);
|
|
104
|
+
if (topics.length > 0) {
|
|
105
|
+
segments.push(`Topics: ${topics.join(", ")}`);
|
|
106
|
+
}
|
|
107
|
+
lines.push(`${prefix}- [${node.title}](${node.url}) | ${segments.join(" | ")}`);
|
|
108
|
+
for (const child of node.children) {
|
|
109
|
+
lines.push("");
|
|
110
|
+
lines.push(renderNode(child, indent + 1, node.title));
|
|
111
|
+
}
|
|
112
|
+
return lines.join("\n");
|
|
113
|
+
}
|
|
114
|
+
const resolveSitemapSections = (source, sources) => {
|
|
115
|
+
const sections = sources ?? (source ? [{ source }] : []);
|
|
116
|
+
if (sections.length === 0) {
|
|
117
|
+
throw new Error("createSitemapMarkdownRoute requires source or sources.");
|
|
118
|
+
}
|
|
119
|
+
return sections;
|
|
120
|
+
};
|
|
121
|
+
export const createSitemapMarkdownRoute = ({ config, source, sources, title = "Documentation Sitemap", transform, }) => {
|
|
122
|
+
const languages = getLanguages(config);
|
|
123
|
+
const sections = resolveSitemapSections(source, sources);
|
|
124
|
+
const GET = async (_req, { params }) => {
|
|
125
|
+
const { lang } = await params;
|
|
126
|
+
const header = `# ${title}
|
|
127
|
+
|
|
128
|
+
## Purpose
|
|
129
|
+
|
|
130
|
+
This file is a high-level semantic index of the documentation.
|
|
131
|
+
It is intended for:
|
|
132
|
+
|
|
133
|
+
- LLM-assisted navigation (ChatGPT, Claude, etc.)
|
|
134
|
+
- Quick orientation for contributors
|
|
135
|
+
- Identifying relevant documentation areas during development
|
|
136
|
+
|
|
137
|
+
It is not intended to replace individual docs.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
`;
|
|
142
|
+
const body = sections
|
|
143
|
+
.map((section) => {
|
|
144
|
+
const pages = section.source.getPages(lang);
|
|
145
|
+
const tree = buildTree(pages);
|
|
146
|
+
const renderedTree = tree
|
|
147
|
+
.map((node) => renderNode(node, 0))
|
|
148
|
+
.join("\n\n");
|
|
149
|
+
return [section.title && `## ${section.title}\n`, renderedTree]
|
|
150
|
+
.filter(Boolean)
|
|
151
|
+
.join("\n");
|
|
152
|
+
})
|
|
153
|
+
.join("\n\n");
|
|
154
|
+
const markdown = header + body;
|
|
155
|
+
return new Response(transform ? await transform(markdown, { lang }) : markdown, {
|
|
156
|
+
headers: {
|
|
157
|
+
"Content-Type": "text/markdown",
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
const generateStaticParams = () => languages.map((lang) => ({ lang }));
|
|
162
|
+
return {
|
|
163
|
+
GET,
|
|
164
|
+
generateStaticParams,
|
|
165
|
+
revalidate: false,
|
|
166
|
+
dynamic: "error",
|
|
167
|
+
};
|
|
168
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Dispatch, type ReactNode, type SetStateAction } from "react";
|
|
2
|
+
interface GeistdocsSidebarContextValue {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
}
|
|
6
|
+
export declare const GeistdocsSidebarProvider: ({ children, }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const useGeistdocsSidebar: () => GeistdocsSidebarContextValue;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../src/sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAEf,UAAU,4BAA4B;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAC9C;AAKD,eAAO,MAAM,wBAAwB,GAAI,eAEtC;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,4CASA,CAAC;AAEF,eAAO,MAAM,mBAAmB,oCAU/B,CAAC"}
|
package/dist/sidebar.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useMemo, useState, } from "react";
|
|
4
|
+
const GeistdocsSidebarContext = createContext(null);
|
|
5
|
+
export const GeistdocsSidebarProvider = ({ children, }) => {
|
|
6
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
7
|
+
const value = useMemo(() => ({ isOpen, setIsOpen }), [isOpen]);
|
|
8
|
+
return (_jsx(GeistdocsSidebarContext.Provider, { value: value, children: children }));
|
|
9
|
+
};
|
|
10
|
+
export const useGeistdocsSidebar = () => {
|
|
11
|
+
const context = useContext(GeistdocsSidebarContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error("useGeistdocsSidebar must be used within GeistdocsDocsLayout.");
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
};
|
package/dist/source.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { type InferPageType, loader } from "fumadocs-core/source";
|
|
2
|
+
import type { GeistdocsConfig } from "./config";
|
|
3
|
+
type LoaderOptions = Parameters<typeof loader>[0];
|
|
4
|
+
export interface FumadocsCollection {
|
|
5
|
+
toFumadocsSource(): LoaderOptions["source"];
|
|
6
|
+
}
|
|
7
|
+
export interface GeistdocsSourcePageData {
|
|
8
|
+
description?: string;
|
|
9
|
+
getText(kind: "processed"): Promise<string>;
|
|
10
|
+
lastModified?: Date;
|
|
11
|
+
prerequisites?: string[];
|
|
12
|
+
product?: string;
|
|
13
|
+
related?: string[];
|
|
14
|
+
summary?: string;
|
|
15
|
+
title: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GeistdocsMarkdownContext {
|
|
19
|
+
page: {
|
|
20
|
+
data: GeistdocsSourcePageData;
|
|
21
|
+
path: string;
|
|
22
|
+
slugs: string[];
|
|
23
|
+
url: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface GeistdocsMarkdownOptions {
|
|
27
|
+
transform?: (markdown: string, context: GeistdocsMarkdownContext) => Promise<string> | string;
|
|
28
|
+
}
|
|
29
|
+
export interface CreateSourceOptions {
|
|
30
|
+
baseUrl?: string;
|
|
31
|
+
config: Pick<GeistdocsConfig, "basePath" | "defaultLanguage" | "translations">;
|
|
32
|
+
docs: FumadocsCollection;
|
|
33
|
+
id?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
markdown?: GeistdocsMarkdownOptions;
|
|
36
|
+
}
|
|
37
|
+
export interface GeistdocsSourceDefinition extends Omit<CreateSourceOptions, "config"> {
|
|
38
|
+
id: string;
|
|
39
|
+
label?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface GeistdocsVersionedSourceDefinition extends GeistdocsSourceDefinition {
|
|
42
|
+
description?: string;
|
|
43
|
+
href?: string;
|
|
44
|
+
routePrefix?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CreateSourcesOptions {
|
|
47
|
+
config: CreateSourceOptions["config"];
|
|
48
|
+
sources: GeistdocsSourceDefinition[];
|
|
49
|
+
}
|
|
50
|
+
export interface CreateVersionedSourcesOptions {
|
|
51
|
+
config: CreateSourceOptions["config"];
|
|
52
|
+
current: string;
|
|
53
|
+
versions: GeistdocsVersionedSourceDefinition[];
|
|
54
|
+
}
|
|
55
|
+
export declare const createSource: ({ docs, config, baseUrl, id, label, markdown, }: CreateSourceOptions) => {
|
|
56
|
+
baseUrl: string;
|
|
57
|
+
source: import("fumadocs-core/source").LoaderOutput<{
|
|
58
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
59
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
60
|
+
}>;
|
|
61
|
+
id: string | undefined;
|
|
62
|
+
label: string | undefined;
|
|
63
|
+
getPageImage: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
64
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
65
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
66
|
+
}>>) => {
|
|
67
|
+
segments: string[];
|
|
68
|
+
url: string;
|
|
69
|
+
};
|
|
70
|
+
getPageMarkdown: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
71
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
72
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
73
|
+
}>>) => Promise<string>;
|
|
74
|
+
};
|
|
75
|
+
export type GeistdocsSourceBundle = ReturnType<typeof createSource>;
|
|
76
|
+
export declare const createSources: ({ config, sources }: CreateSourcesOptions) => {
|
|
77
|
+
all: {
|
|
78
|
+
id: string;
|
|
79
|
+
label: string | undefined;
|
|
80
|
+
source: {
|
|
81
|
+
baseUrl: string;
|
|
82
|
+
source: import("fumadocs-core/source").LoaderOutput<{
|
|
83
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
84
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
85
|
+
}>;
|
|
86
|
+
id: string | undefined;
|
|
87
|
+
label: string | undefined;
|
|
88
|
+
getPageImage: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
89
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
90
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
91
|
+
}>>) => {
|
|
92
|
+
segments: string[];
|
|
93
|
+
url: string;
|
|
94
|
+
};
|
|
95
|
+
getPageMarkdown: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
96
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
97
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
98
|
+
}>>) => Promise<string>;
|
|
99
|
+
};
|
|
100
|
+
}[];
|
|
101
|
+
byId: Record<string, GeistdocsSourceBundle>;
|
|
102
|
+
};
|
|
103
|
+
export declare const createVersionedSources: ({ config, current, versions, }: CreateVersionedSourcesOptions) => {
|
|
104
|
+
all: {
|
|
105
|
+
description: string | undefined;
|
|
106
|
+
href: string | undefined;
|
|
107
|
+
id: string;
|
|
108
|
+
label: string | undefined;
|
|
109
|
+
routePrefix: string | undefined;
|
|
110
|
+
source: {
|
|
111
|
+
baseUrl: string;
|
|
112
|
+
source: import("fumadocs-core/source").LoaderOutput<{
|
|
113
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
114
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
115
|
+
}>;
|
|
116
|
+
id: string | undefined;
|
|
117
|
+
label: string | undefined;
|
|
118
|
+
getPageImage: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
119
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
120
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
121
|
+
}>>) => {
|
|
122
|
+
segments: string[];
|
|
123
|
+
url: string;
|
|
124
|
+
};
|
|
125
|
+
getPageMarkdown: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
126
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
127
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
128
|
+
}>>) => Promise<string>;
|
|
129
|
+
};
|
|
130
|
+
}[];
|
|
131
|
+
byId: Record<string, {
|
|
132
|
+
baseUrl: string;
|
|
133
|
+
source: import("fumadocs-core/source").LoaderOutput<{
|
|
134
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
135
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
136
|
+
}>;
|
|
137
|
+
id: string | undefined;
|
|
138
|
+
label: string | undefined;
|
|
139
|
+
getPageImage: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
140
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
141
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
142
|
+
}>>) => {
|
|
143
|
+
segments: string[];
|
|
144
|
+
url: string;
|
|
145
|
+
};
|
|
146
|
+
getPageMarkdown: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
147
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
148
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
149
|
+
}>>) => Promise<string>;
|
|
150
|
+
}>;
|
|
151
|
+
current: {
|
|
152
|
+
baseUrl: string;
|
|
153
|
+
source: import("fumadocs-core/source").LoaderOutput<{
|
|
154
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
155
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
156
|
+
}>;
|
|
157
|
+
id: string | undefined;
|
|
158
|
+
label: string | undefined;
|
|
159
|
+
getPageImage: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
160
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
161
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
162
|
+
}>>) => {
|
|
163
|
+
segments: string[];
|
|
164
|
+
url: string;
|
|
165
|
+
};
|
|
166
|
+
getPageMarkdown: (page: InferPageType<import("fumadocs-core/source").LoaderOutput<{
|
|
167
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
168
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
169
|
+
}>>) => Promise<string>;
|
|
170
|
+
};
|
|
171
|
+
currentVersion: string;
|
|
172
|
+
};
|
|
173
|
+
export {};
|
|
174
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"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"}
|