@vercel/geistdocs 2.15.4-canary.2a54b38 → 2.16.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.
Files changed (71) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/config.d.ts +3 -3
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
  5. package/dist/internal/mdx-to-markdown.js +0 -9
  6. package/dist/internal/navbar/mobile-menu.d.ts +3 -3
  7. package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
  8. package/dist/internal/navbar/mobile-menu.js +3 -3
  9. package/dist/internal/navbar/navbar-logo.d.ts +5 -3
  10. package/dist/internal/navbar/navbar-logo.d.ts.map +1 -1
  11. package/dist/internal/navbar/navbar-logo.js +71 -14
  12. package/dist/internal/page-actions.d.ts +4 -4
  13. package/dist/internal/page-actions.d.ts.map +1 -1
  14. package/dist/internal/page-actions.js +1 -6
  15. package/dist/mdx.d.ts +25 -3
  16. package/dist/mdx.d.ts.map +1 -1
  17. package/dist/mdx.js +61 -8
  18. package/dist/navbar.js +4 -3
  19. package/dist/next.d.ts +1 -11
  20. package/dist/next.d.ts.map +1 -1
  21. package/dist/next.js +2 -82
  22. package/dist/pages/docs.d.ts +98 -5
  23. package/dist/pages/docs.d.ts.map +1 -1
  24. package/dist/pages/docs.js +250 -13
  25. package/dist/source-config.d.ts +1 -10
  26. package/dist/source-config.d.ts.map +1 -1
  27. package/dist/source-config.js +10 -21
  28. package/dist/source.d.ts +17 -6
  29. package/dist/source.d.ts.map +1 -1
  30. package/dist/source.js +75 -2
  31. package/docs/agents.md +1 -1
  32. package/docs/llms.txt +8 -22
  33. package/docs/manifest.json +1 -1
  34. package/docs/pages/configuration.md +7 -21
  35. package/package.json +19 -40
  36. package/rehype-code-highlights.d.ts +1 -1
  37. package/rehype-code-highlights.js +49 -1
  38. package/source-config-public.d.ts +15 -0
  39. package/source-config-public.js +47 -0
  40. package/source-config.js +10 -27
  41. package/template/content/docs/configuration.mdx +7 -21
  42. package/template/package.json +4 -7
  43. package/dist/internal/source-loader.d.ts +0 -28
  44. package/dist/internal/source-loader.d.ts.map +0 -1
  45. package/dist/internal/source-loader.js +0 -77
  46. package/dist/mdx-basic.d.ts +0 -27
  47. package/dist/mdx-basic.d.ts.map +0 -1
  48. package/dist/mdx-basic.js +0 -61
  49. package/dist/navigation.d.ts +0 -11
  50. package/dist/navigation.d.ts.map +0 -1
  51. package/dist/navigation.js +0 -8
  52. package/dist/pages/docs-custom.d.ts +0 -111
  53. package/dist/pages/docs-custom.d.ts.map +0 -1
  54. package/dist/pages/docs-custom.js +0 -250
  55. package/native-mdx/LICENSE-mdxjs-rs +0 -22
  56. package/native-mdx/UPSTREAM.md +0 -16
  57. package/native-mdx/binaries/darwin-arm64.node +0 -0
  58. package/native-mdx/binaries/linux-x64-gnu.node +0 -0
  59. package/native-mdx/data-entry.d.mts +0 -15
  60. package/native-mdx/data-entry.mjs +0 -97
  61. package/native-mdx/data-projection.mjs +0 -205
  62. package/native-mdx/fumadocs-adapter.mjs +0 -36
  63. package/native-mdx/index-emitter.mjs +0 -34
  64. package/native-mdx/loader-data.cjs +0 -36
  65. package/native-mdx/loader-mdx.cjs +0 -9
  66. package/native-mdx/loader-mdx.mjs +0 -419
  67. package/native-mdx/native-binding.cjs +0 -27
  68. package/native-mdx/navigation-entry.d.mts +0 -11
  69. package/native-mdx/navigation-entry.mjs +0 -136
  70. package/native-mdx/navigation-title.mjs +0 -53
  71. package/template/pnpm-workspace.yaml +0 -3
@@ -17,7 +17,7 @@
17
17
  "@streamdown/code": "^1.0.1",
18
18
  "@vercel/agent-readability": "^0.7.0",
19
19
  "@vercel/analytics": "^1.6.1",
20
- "@vercel/geistdocs": "2.15.4-canary.2a54b38",
20
+ "@vercel/geistdocs": "2.16.0",
21
21
  "@vercel/speed-insights": "^1.3.1",
22
22
  "ai": "^6.0.132",
23
23
  "clsx": "^2.1.1",
@@ -29,9 +29,9 @@
29
29
  "fumadocs-ui": "16.2.2",
30
30
  "geist": "1.7.1",
31
31
  "jotai": "^2.15.2",
32
- "mermaid": "^11.16.1",
32
+ "mermaid": "^11.12.2",
33
33
  "nanoid": "^5.1.6",
34
- "next": "16.4.5",
34
+ "next": "16.3.3",
35
35
  "next-themes": "^0.4.6",
36
36
  "react": "^19.2.3",
37
37
  "react-dom": "^19.2.3",
@@ -40,7 +40,7 @@
40
40
  "streamdown": "^2.1.0",
41
41
  "tailwind-merge": "^3.4.0",
42
42
  "use-stick-to-bottom": "^1.1.1",
43
- "zod": "^4.6.6"
43
+ "zod": "^4.1.13"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@tailwindcss/postcss": "^4.1.17",
@@ -52,8 +52,5 @@
52
52
  "tailwindcss": "^4.1.17",
53
53
  "tw-animate-css": "^1.4.0",
54
54
  "typescript": "^5.9.3"
55
- },
56
- "overrides": {
57
- "katex": "0.18.2"
58
55
  }
59
56
  }
@@ -1,28 +0,0 @@
1
- import { loader } from "fumadocs-core/source";
2
- import type { GeistdocsConfig } from "../config.js";
3
- type LoaderOptions = Parameters<typeof loader>[0];
4
- export interface FumadocsCollection {
5
- toFumadocsSource(): LoaderOptions["source"];
6
- }
7
- export interface GeistdocsSlugsContext {
8
- /** Content file path relative to the content directory, including any language suffix, such as `errors/NOT_FOUND.mdx` or `guide.cn.mdx`. */
9
- path: string;
10
- /** Default slugs derived from the path, without folder groups or a trailing `index`. */
11
- slugs: string[];
12
- }
13
- export interface CreateNavigationOptions {
14
- baseUrl?: string;
15
- config: Pick<GeistdocsConfig, "agent" | "basePath" | "defaultLanguage" | "singleLanguage" | "siteUrl" | "translations"> & Partial<Pick<GeistdocsConfig, "title">>;
16
- docs: FumadocsCollection;
17
- /**
18
- * Transform each page's URL slugs. Use the same transform for navigation
19
- * and createSource so tree links match page routes.
20
- */
21
- slugs?: (context: GeistdocsSlugsContext) => string[];
22
- }
23
- export declare const createSourceLoader: ({ docs, config, baseUrl, slugs, }: CreateNavigationOptions) => import("fumadocs-core/source").LoaderOutput<{
24
- source: import("fumadocs-core/source").SourceConfig;
25
- i18n: import("fumadocs-core/i18n").I18nConfig<string>;
26
- }>;
27
- export {};
28
- //# sourceMappingURL=source-loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-loader.d.ts","sourceRoot":"","sources":["../../src/internal/source-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,MAAM,EAEP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,qBAAqB;IACpC,4IAA4I;IAC5I,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,IAAI,CACV,eAAe,EACb,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,gBAAgB,GAChB,SAAS,GACT,cAAc,CACjB,GACC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,IAAI,EAAE,kBAAkB,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,MAAM,EAAE,CAAC;CACtD;AA6ED,eAAO,MAAM,kBAAkB,GAAI,mCAKhC,uBAAuB;;;EAiBzB,CAAC"}
@@ -1,77 +0,0 @@
1
- import { defineI18n } from "fumadocs-core/i18n";
2
- import { loader, } from "fumadocs-core/source";
3
- const createSlugsPlugin = (transform) => {
4
- // Each locale's storage inherits fallback pages from the default locale by
5
- // reference, so transform every page object once.
6
- const transformed = new WeakSet();
7
- return {
8
- name: "geistdocs:slugs",
9
- // Runs after Fumadocs assigns the default slugs, so `index` pages and
10
- // folder groups resolve before the transform sees them.
11
- enforce: "post",
12
- transformStorage({ storage }) {
13
- const pathsByUrl = new Map();
14
- for (const key of storage.getFiles()) {
15
- const file = storage.read(key);
16
- if (file?.format !== "page") {
17
- continue;
18
- }
19
- if (!transformed.has(file)) {
20
- // Storage keys drop the locale; `file.path` is the content file path.
21
- file.slugs = transform({ path: file.path, slugs: [...file.slugs] });
22
- transformed.add(file);
23
- }
24
- const url = file.slugs.join("/");
25
- const existing = pathsByUrl.get(url);
26
- if (existing) {
27
- throw new Error(`Geistdocs slugs: ${existing} and ${file.path} both resolve to "/${url}".`);
28
- }
29
- pathsByUrl.set(url, file.path);
30
- }
31
- },
32
- };
33
- };
34
- const getLanguages = (config) => {
35
- const defaultLanguage = config.defaultLanguage ?? "en";
36
- const languages = Object.keys(config.translations ?? {});
37
- return {
38
- defaultLanguage,
39
- languages: Array.from(new Set([defaultLanguage, ...languages])),
40
- };
41
- };
42
- const pageTreeTransformer = {
43
- file(node, filePath) {
44
- if (!filePath) {
45
- return node;
46
- }
47
- const file = this.storage.read(filePath);
48
- if (file?.format !== "page") {
49
- return node;
50
- }
51
- const { badge, navTitle } = file.data;
52
- return {
53
- ...node,
54
- ...(typeof badge === "string" && badge.length > 0 ? { badge } : {}),
55
- ...(typeof navTitle === "string" && navTitle.length > 0
56
- ? { name: navTitle }
57
- : {}),
58
- };
59
- },
60
- };
61
- export const createSourceLoader = ({ docs, config, baseUrl = "/docs", slugs, }) => {
62
- const { defaultLanguage, languages } = getLanguages(config);
63
- const i18n = defineI18n({
64
- defaultLanguage,
65
- languages,
66
- hideLocale: "default-locale",
67
- });
68
- return loader({
69
- i18n,
70
- baseUrl,
71
- pageTree: {
72
- transformers: [pageTreeTransformer],
73
- },
74
- plugins: slugs ? [createSlugsPlugin(slugs)] : undefined,
75
- source: docs.toFumadocsSource(),
76
- });
77
- };
@@ -1,27 +0,0 @@
1
- import type { MDXComponents } from "mdx/types";
2
- import type { GeistdocsSourceConfigOptions as SourceConfigOptions } from "./source-config";
3
- export declare const geistShikiTheme: {
4
- name: string;
5
- type: "dark";
6
- colors: {
7
- "editor.foreground": string;
8
- "editor.background": string;
9
- };
10
- tokenColors: ({
11
- scope: string[];
12
- settings: {
13
- foreground: string;
14
- };
15
- } | {
16
- scope: string;
17
- settings: {
18
- foreground: string;
19
- };
20
- })[];
21
- };
22
- export type GeistdocsSourceConfigOptions = SourceConfigOptions;
23
- export type GeistdocsMDXComponents = MDXComponents;
24
- export declare const getGeistdocsMDXComponents: (components?: GeistdocsMDXComponents) => GeistdocsMDXComponents;
25
- export declare const createMdxComponents: (components?: GeistdocsMDXComponents) => GeistdocsMDXComponents;
26
- export declare const mergeGeistdocsMDXComponents: (...componentSets: Array<GeistdocsMDXComponents | undefined>) => GeistdocsMDXComponents;
27
- //# sourceMappingURL=mdx-basic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mdx-basic.d.ts","sourceRoot":"","sources":["../src/mdx-basic.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAoB/C,OAAO,KAAK,EAAE,4BAA4B,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAK3F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAC1C,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,eAAO,MAAM,yBAAyB,GACpC,aAAa,sBAAsB,KAClC,sBA2DD,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,sBAAsB,KAClC,sBAA+D,CAAC;AAEnE,eAAO,MAAM,2BAA2B,GACtC,GAAG,eAAe,KAAK,CAAC,sBAAsB,GAAG,SAAS,CAAC,KAC1D,sBACkD,CAAC"}
package/dist/mdx-basic.js DELETED
@@ -1,61 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Image as FrameworkImage } from "fumadocs-core/framework";
3
- import { Card, Cards } from "fumadocs-ui/components/card";
4
- import Link from "next/link";
5
- import { cn } from "#geistdocs-ui/utils";
6
- import { Blockquote } from "./components/blockquote";
7
- import { Button } from "./components/button";
8
- import { Callout, CalloutContainer, CalloutDescription, CalloutTitle, } from "./components/callout";
9
- import { CodeBlock } from "./components/code-block";
10
- import { Details, Summary } from "./components/details";
11
- import { Heading } from "./components/heading";
12
- import { Image } from "./components/image";
13
- import { Step, Steps } from "./components/steps";
14
- import { Table } from "./components/table";
15
- import { TypeTable } from "./components/type-table";
16
- import { LocalizedLink } from "./internal/localized-link";
17
- import { geistShikiTheme as shikiTheme } from "./shiki-theme";
18
- // The source-config exports live on @vercel/geistdocs/source-config. Importing
19
- // them here would pull fumadocs-mdx/config, and through it Shiki with every
20
- // language grammar, into every server function that renders MDX.
21
- export const geistShikiTheme = shikiTheme;
22
- export const getGeistdocsMDXComponents = (components) => ({
23
- Card,
24
- Cards,
25
- img: (props) => (_jsx(FrameworkImage, { sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px", ...props, className: cn("rounded-lg", props.className), src: props.src })),
26
- h1: (props) => _jsx(Heading, { as: "h1", ...props }),
27
- h2: (props) => _jsx(Heading, { as: "h2", ...props }),
28
- h3: (props) => _jsx(Heading, { as: "h3", ...props }),
29
- h4: (props) => _jsx(Heading, { as: "h4", ...props }),
30
- h5: (props) => _jsx(Heading, { as: "h5", ...props }),
31
- h6: (props) => _jsx(Heading, { as: "h6", ...props }),
32
- pre: CodeBlock,
33
- blockquote: Blockquote,
34
- table: Table,
35
- Table,
36
- a: ({ children, className, href, ...props }) => {
37
- const linkClassName = cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className);
38
- if (typeof href === "string" && href.startsWith("/")) {
39
- return (_jsx(LocalizedLink, { className: linkClassName, href: href, ...props, children: children }));
40
- }
41
- // next/link keeps same-page fragment entries restorable by the App Router.
42
- if (typeof href === "string" && href.startsWith("#")) {
43
- return (_jsx(Link, { className: linkClassName, href: href, prefetch: false, ...props, children: children }));
44
- }
45
- return (_jsx("a", { className: linkClassName, href: href, ...props, children: children }));
46
- },
47
- Button,
48
- TypeTable,
49
- Callout,
50
- CalloutContainer,
51
- CalloutTitle,
52
- CalloutDescription,
53
- Details,
54
- Summary,
55
- Image,
56
- Steps,
57
- Step,
58
- ...components,
59
- });
60
- export const createMdxComponents = (components) => getGeistdocsMDXComponents(components);
61
- export const mergeGeistdocsMDXComponents = (...componentSets) => Object.assign({}, ...componentSets.filter(Boolean));
@@ -1,11 +0,0 @@
1
- import { type CreateNavigationOptions } from "./internal/source-loader.js";
2
- export type { CreateNavigationOptions, FumadocsCollection, GeistdocsSlugsContext, } from "./internal/source-loader.js";
3
- /**
4
- * Create navigation from a Fumadocs collection without Markdown conversion.
5
- * Pass a metadata-only collection to keep MDX bodies out of the import graph.
6
- */
7
- export declare const createNavigation: (options: CreateNavigationOptions) => {
8
- pageTree: Record<string, import("fumadocs-core/page-tree").Root>;
9
- };
10
- export type GeistdocsNavigationBundle = ReturnType<typeof createNavigation>;
11
- //# sourceMappingURL=navigation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,6BAA6B,CAAC;AAErC,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AAErC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,uBAAuB;;CAE/D,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { createSourceLoader, } from "./internal/source-loader.js";
2
- /**
3
- * Create navigation from a Fumadocs collection without Markdown conversion.
4
- * Pass a metadata-only collection to keep MDX bodies out of the import graph.
5
- */
6
- export const createNavigation = (options) => ({
7
- pageTree: createSourceLoader(options).pageTree,
8
- });
@@ -1,111 +0,0 @@
1
- import { DocsPage as FumadocsDocsPage } from "fumadocs-ui/layouts/docs/page";
2
- import type { MDXComponents } from "mdx/types";
3
- import type { Metadata } from "next";
4
- import { type ComponentProps, type ComponentType, type ReactNode } from "react";
5
- import { NativeDocsLink } from "../components/link";
6
- import { type GeistdocsConfig } from "../config";
7
- import { type GeistdocsPageVisibilityData } from "../page-visibility";
8
- import type { GeistdocsSourceBundle } from "../source";
9
- type SourceBundle = GeistdocsSourceBundle;
10
- type GeistdocsPage = NonNullable<ReturnType<SourceBundle["source"]["getPage"]>>;
11
- type PageActionsBundle = ReturnType<typeof createPageActions>;
12
- type DocsPageLink = MDXComponents["a"];
13
- type TableOfContentOptions = NonNullable<ComponentProps<typeof FumadocsDocsPage>["tableOfContent"]>;
14
- export interface DocsPageParams extends Record<string, string | string[] | undefined> {
15
- lang: string;
16
- slug?: string[];
17
- }
18
- export interface DocsPageAccessContext<Params extends DocsPageParams = DocsPageParams> {
19
- params: Params;
20
- source: SourceBundle;
21
- }
22
- export type DocsPageAccessFilter<Params extends DocsPageParams = DocsPageParams> = (page: GeistdocsPage, context: DocsPageAccessContext<Params>) => boolean | Promise<boolean>;
23
- type DocsPageMdx = MDXComponents | ((context: {
24
- link: DocsPageLink;
25
- page: GeistdocsPage;
26
- source: SourceBundle;
27
- }) => MDXComponents);
28
- type OpenGraphImages = NonNullable<Metadata["openGraph"]>["images"];
29
- interface DocsPageOpenGraphOptions {
30
- images?: boolean | OpenGraphImages;
31
- }
32
- interface PageUrlContext<Params extends DocsPageParams = DocsPageParams> {
33
- page: GeistdocsPage;
34
- params: Params;
35
- }
36
- interface PublicPageUrlContext<Params extends DocsPageParams = DocsPageParams> extends PageUrlContext<Params> {
37
- pageUrl: string;
38
- }
39
- interface MarkdownUrlContext<Params extends DocsPageParams = DocsPageParams> extends PublicPageUrlContext<Params> {
40
- publicPageUrl: string;
41
- }
42
- export interface ResolvePageMarkdownUrlOptions {
43
- basePath?: string;
44
- isRootMountedPage?: boolean;
45
- pageUrl: string;
46
- publicPageUrl?: string;
47
- }
48
- export declare const resolvePageMarkdownUrl: (options: ResolvePageMarkdownUrlOptions) => string;
49
- interface DocsPageData extends GeistdocsPageVisibilityData {
50
- body: ComponentType<{
51
- components?: MDXComponents;
52
- }>;
53
- description?: string;
54
- full?: boolean;
55
- title: string;
56
- toc: ComponentProps<typeof FumadocsDocsPage>["toc"];
57
- }
58
- export interface CreateDocsPageOptions<Params extends DocsPageParams = DocsPageParams> {
59
- /** Return false to make a page unavailable for the current route params. */
60
- canViewPage?: DocsPageAccessFilter<Params>;
61
- config: Pick<GeistdocsConfig, "ai" | "basePath" | "defaultLanguage" | "feedback" | "github" | "pageActions" | "siteId" | "singleLanguage" | "siteUrl">;
62
- filterStaticParams?: (params: DocsPageParams) => boolean;
63
- getMarkdownUrl?: (context: MarkdownUrlContext<Params>) => string;
64
- getPageUrl?: (context: PageUrlContext<Params>) => string;
65
- getPublicPageUrl?: (context: PublicPageUrlContext<Params>) => string;
66
- mdx?: DocsPageMdx;
67
- metadata?: (context: {
68
- metadata: Metadata;
69
- page: GeistdocsPage;
70
- params: Params;
71
- }) => Metadata | Promise<Metadata>;
72
- openGraph?: DocsPageOpenGraphOptions;
73
- pageActions?: PageActionsBundle;
74
- /** Static content skips Markdown conversion; callbacks receive full context. */
75
- renderTop?: ReactNode | ((context: {
76
- data: DocsPageData;
77
- markdown: string;
78
- markdownUrl: string;
79
- page: GeistdocsPage;
80
- pageUrl: string;
81
- publicPageUrl: string;
82
- }) => ReactNode);
83
- resolveLink?: (context: {
84
- link: DocsPageLink;
85
- nativeLink: typeof NativeDocsLink;
86
- page: GeistdocsPage;
87
- source: SourceBundle;
88
- }) => DocsPageLink;
89
- source: SourceBundle;
90
- tableOfContent?: TableOfContentOptions;
91
- tableOfContentPopover?: ComponentProps<typeof FumadocsDocsPage>["tableOfContentPopover"];
92
- }
93
- /** A page factory with no implicit MDX registry; provide every named component. */
94
- export type CreateCustomDocsPageOptions<Params extends DocsPageParams = DocsPageParams> = Omit<CreateDocsPageOptions<Params>, "mdx"> & {
95
- mdx: DocsPageMdx;
96
- };
97
- export declare const createDocsPage: <Params extends DocsPageParams = DocsPageParams>({ canViewPage, config, source, mdx, pageActions, filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }: CreateCustomDocsPageOptions<Params>) => {
98
- Page: ({ params }: {
99
- params: Promise<Params>;
100
- }) => import("react/jsx-runtime").JSX.Element;
101
- getPageTree: (params: Params) => Promise<import("fumadocs-core/page-tree").Root>;
102
- generateStaticParams: () => (Omit<DocsPageParams, "lang"> & {
103
- lang?: string;
104
- })[];
105
- generateMetadata: ({ params, }: {
106
- params: Promise<Params>;
107
- }) => Promise<Metadata>;
108
- };
109
- export declare const createPageActions: ({ config, extraActions, getExtraActions, }: import("../internal/page-actions").CreatePageActionsOptions) => import("../internal/page-actions").CreatePageActionsOptions;
110
- export {};
111
- //# sourceMappingURL=docs-custom.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docs-custom.d.ts","sourceRoot":"","sources":["../../src/pages/docs-custom.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,oBA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,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,qBAAqB,CAAC,EAAE,cAAc,CACpC,OAAO,gBAAgB,CACxB,CAAC,uBAAuB,CAAC,CAAC;CAC5B;AAmDD,mFAAmF;AACnF,MAAM,MAAM,2BAA2B,CACrC,MAAM,SAAS,cAAc,GAAG,cAAc,IAC5C,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG;IAAE,GAAG,EAAE,WAAW,CAAA;CAAE,CAAC;AAEtE,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,cAAc,GAAG,cAAc,EAAE,0MAgB5E,2BAA2B,CAAC,MAAM,CAAC;uBAgPV;QAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE;0BAvKlB,MAAM;;;;oCAwLtC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,KAAG,OAAO,CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,0KAA4B,CAAC"}
@@ -1,250 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Link from "fumadocs-core/link";
3
- import { DocsBody as FumadocsDocsBody, DocsPage as FumadocsDocsPage, DocsTitle as FumadocsDocsTitle, } from "fumadocs-ui/layouts/docs/page";
4
- import { notFound } from "next/navigation";
5
- import { cache, } from "react";
6
- import { cn } from "#geistdocs-ui/utils";
7
- import { NativeDocsLink } from "../components/link";
8
- import { getPublicPath, withBasePath } from "../config";
9
- import { getDocsLinkClassName } from "../internal/docs-link-class-name";
10
- import { DocsPageErrorBoundary } from "../internal/docs-page-error-boundary";
11
- import { resolveDocumentTitle } from "../internal/document-title";
12
- import { omitLanguageParam, resolveRouteLanguage } from "../internal/languages";
13
- import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
14
- import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
15
- import { createPageActions as createInternalPageActions, resolveExtraPageActions, } from "../internal/page-actions";
16
- import { GeistdocsPageActions } from "../internal/page-actions-gate";
17
- import { PageBreadcrumb } from "../internal/page-breadcrumb";
18
- import { getPageFooterItems, PageFooter } from "../internal/page-footer";
19
- import { filterPageTree } from "../internal/page-tree-visibility";
20
- import { createRelativeDocsLink } from "../internal/relative-docs-link";
21
- import { GeistdocsTableOfContents } from "../internal/table-of-contents";
22
- import { GeistdocsTableOfContentsActions } from "../internal/toc-actions-client";
23
- import { getPageRobots, } from "../page-visibility";
24
- const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href, rel, target, ...props }) => {
25
- const originalHref = String(href ?? "");
26
- const resolved = resolveLinkHref(originalHref, siteUrl);
27
- const linkHref = resolved.href === originalHref
28
- ? resolved.href
29
- : stripBasePathFromHref(resolved.href, basePath);
30
- return (_jsx(Link, { ...props, className: getDocsLinkClassName(className), href: linkHref, prefetch: !resolved.external, rel: resolved.external ? rel : undefined, target: resolved.external ? target : undefined, children: children }));
31
- };
32
- export const resolvePageMarkdownUrl = (options) => resolveInternalPageMarkdownUrl(options);
33
- /**
34
- * The page's visible article parts carry `data-geistdocs-article` (`title`,
35
- * `body`) so tools that read the rendered HTML (docs
36
- * crawlers, parity checks against the Markdown route) can select the
37
- * article without depending on Fumadocs' element ids or on class names.
38
- * The marked elements hold content only: page actions, breadcrumbs, the
39
- * table of contents, and the previous/next footer sit outside them.
40
- */
41
- const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { className: cn("mb-4 text-balance", className), "data-geistdocs-article": "title", ...props }));
42
- const DocsBody = ({ className, ...props }) => (_jsx(FumadocsDocsBody, { className: cn("mx-auto w-full", className), "data-geistdocs-article": "body", ...props }));
43
- /** App-provided footer content below the table-of-contents actions. */
44
- const TocFooterSlot = ({ children }) => children ? _jsx("div", { className: "mt-4", children: children }) : null;
45
- const hasTableOfContentsActions = (config, extraActions) => config.pageActions?.scrollTop !== false ||
46
- config.feedback?.enabled !== false ||
47
- extraActions.length > 0;
48
- const serializeParams = (params) => JSON.stringify(Object.entries(params)
49
- .filter(([, value]) => value !== undefined)
50
- .sort(([left], [right]) => left.localeCompare(right)));
51
- export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions = createInternalPageActions({ config }), filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }) => {
52
- const DocsLink = renderPrefetchedDocsLink.bind(null, config.siteUrl, config.basePath);
53
- const resolvePageUrls = (page, params) => {
54
- const pageUrl = getPageUrl?.({ page, params }) ?? page.url;
55
- const publicPageUrl = getPublicPageUrl?.({ page, params, pageUrl }) ??
56
- getPublicPath(pageUrl, config.basePath);
57
- const markdownUrl = getMarkdownUrl?.({ page, params, pageUrl, publicPageUrl }) ??
58
- resolveInternalPageMarkdownUrl({
59
- basePath: config.basePath,
60
- isRootMountedPage: source.baseUrl === "/" && page.slugs.length === 0,
61
- pageUrl,
62
- publicPageUrl,
63
- });
64
- return { markdownUrl, pageUrl, publicPageUrl };
65
- };
66
- const getAccessState = cache(async (paramsKey) => {
67
- const params = Object.fromEntries(JSON.parse(paramsKey));
68
- const tree = source.source.getPageTree(params.lang);
69
- if (!canViewPage) {
70
- return { tree, visibleUrls: undefined };
71
- }
72
- const access = await Promise.all(source.source.getPages(params.lang).map(async (page) => ({
73
- page,
74
- visible: await canViewPage(page, { params, source }),
75
- })));
76
- const visibleUrls = new Set(access.filter(({ visible }) => visible).map(({ page }) => page.url));
77
- const hiddenUrls = new Set(access.filter(({ visible }) => !visible).map(({ page }) => page.url));
78
- return { tree: filterPageTree(tree, hiddenUrls), visibleUrls };
79
- });
80
- // Single-language apps have no [lang] segment, so params arrive without it.
81
- const resolveParams = async (params) => {
82
- const resolved = await params;
83
- return {
84
- ...resolved,
85
- lang: resolveRouteLanguage(config, resolved.lang),
86
- };
87
- };
88
- const getPage = async (params) => {
89
- const page = source.source.getPage(params.slug, params.lang);
90
- if (!page) {
91
- notFound();
92
- }
93
- if (canViewPage) {
94
- const { visibleUrls } = await getAccessState(serializeParams(params));
95
- if (!visibleUrls?.has(page.url)) {
96
- notFound();
97
- }
98
- }
99
- return page;
100
- };
101
- const getPageTree = async (params) => (await getAccessState(serializeParams(params))).tree;
102
- const PageContent = async ({ params }) => {
103
- const resolvedParams = await resolveParams(params);
104
- const { lang } = resolvedParams;
105
- const page = await getPage(resolvedParams);
106
- const pageTree = await getPageTree(resolvedParams);
107
- const data = page.data;
108
- const MDX = data.body;
109
- const defaultLink = createRelativeDocsLink(source.source, page, DocsLink);
110
- const link = resolveLink
111
- ? resolveLink({
112
- link: defaultLink,
113
- nativeLink: NativeDocsLink,
114
- page,
115
- source,
116
- })
117
- : defaultLink;
118
- const resolvedMdx = typeof mdx === "function" ? mdx({ link, page, source }) : mdx;
119
- const { markdownUrl, pageUrl, publicPageUrl } = resolvePageUrls(page, resolvedParams);
120
- const footerItems = getPageFooterItems(pageTree, page.url);
121
- const pagesByUrl = getPageUrl
122
- ? new Map(source.source.getPages(lang).map((entry) => [entry.url, entry]))
123
- : undefined;
124
- const resolveFooterItem = (item) => {
125
- if (!(item && getPageUrl && pagesByUrl)) {
126
- return item;
127
- }
128
- const itemPage = pagesByUrl.get(item.url);
129
- if (!itemPage) {
130
- return item;
131
- }
132
- return {
133
- ...item,
134
- url: getPageUrl({
135
- page: itemPage,
136
- params: { ...resolvedParams, slug: itemPage.slugs },
137
- }),
138
- };
139
- };
140
- const resolvedFooterItems = {
141
- previous: resolveFooterItem(footerItems.previous),
142
- next: resolveFooterItem(footerItems.next),
143
- };
144
- const markdown = pageActions.getExtraActions || typeof renderTop === "function"
145
- ? await source.getPageMarkdown(page)
146
- : undefined;
147
- const footerActions = resolveExtraPageActions(pageActions, {
148
- markdown: markdown ?? "",
149
- page: {
150
- path: page.path,
151
- url: publicPageUrl,
152
- },
153
- });
154
- const hasTocActions = hasTableOfContentsActions(pageActions.config, footerActions);
155
- const hasTocLinks = Boolean(data.toc?.length);
156
- // Actions stay adjacent to the table of contents; the app-provided
157
- // footer (promos and other custom content) renders below them.
158
- const tocFooter = (_jsxs(_Fragment, { children: [hasTocLinks && hasTocActions ? (_jsx("div", { className: "mt-4 border-gray-alpha-400 border-t pt-4", children: _jsx("nav", { "aria-label": "Page actions", className: "flex min-w-0 flex-col gap-1", children: _jsx(GeistdocsTableOfContentsActions, { config: pageActions.config, extraActions: footerActions }) }) })) : null, _jsx(TocFooterSlot, { children: tableOfContent?.footer })] }));
159
- const tocComponent = tableOfContent?.component ?? (_jsx(GeistdocsTableOfContents, { footer: tocFooter, header: tableOfContent?.header, toc: data.toc ?? [] }));
160
- return (_jsxs(FumadocsDocsPage, { breadcrumb: {
161
- component: _jsx(PageBreadcrumb, { tree: pageTree, url: page.url }),
162
- }, footer: { component: _jsx(PageFooter, { ...resolvedFooterItems }) }, full: data.full, tableOfContent: {
163
- enabled: true,
164
- single: true,
165
- ...tableOfContent,
166
- component: tocComponent,
167
- }, tableOfContentPopover: {
168
- enabled: false,
169
- ...tableOfContentPopover,
170
- }, toc: data.toc, children: [typeof renderTop === "function"
171
- ? renderTop({
172
- data,
173
- markdown: markdown ?? "",
174
- markdownUrl,
175
- page,
176
- pageUrl,
177
- publicPageUrl,
178
- })
179
- : renderTop, _jsxs("div", { className: "mb-8 flex flex-col-reverse gap-4 md:flex-row md:items-end md:justify-between", children: [_jsx(DocsTitle, { className: "mb-0 min-w-0", children: data.title }), _jsx(GeistdocsPageActions, { config: pageActions.config, only: "desktop", page: {
180
- markdownUrl,
181
- path: page.path,
182
- title: data.title,
183
- url: publicPageUrl,
184
- } })] }), _jsx("div", { className: "-mt-6 mb-4 @min-[961px]:hidden", children: _jsx(GeistdocsPageActions, { config: pageActions.config, only: "mobile", page: {
185
- markdownUrl,
186
- path: page.path,
187
- title: data.title,
188
- url: publicPageUrl,
189
- } }) }), _jsx(DocsBody, { children: _jsx(MDX, { components: {
190
- a: link,
191
- ...resolvedMdx,
192
- } }) })] }));
193
- };
194
- const Page = ({ params }) => (_jsx(DocsPageErrorBoundary, { children: _jsx(PageContent, { params: params }) }));
195
- const generateStaticParams = () => {
196
- const params = source.source.generateParams();
197
- const filtered = filterStaticParams
198
- ? params.filter(filterStaticParams)
199
- : params;
200
- return omitLanguageParam(config, filtered);
201
- };
202
- const generateMetadata = async ({ params, }) => {
203
- const resolvedParams = await resolveParams(params);
204
- const page = await getPage(resolvedParams);
205
- const pageTree = await getPageTree(resolvedParams);
206
- const data = page.data;
207
- const { markdownUrl, publicPageUrl } = resolvePageUrls(page, resolvedParams);
208
- const openGraphImages = openGraph?.images === true
209
- ? source.getPageImage(page).url
210
- : openGraph?.images;
211
- let canonicalUrl;
212
- if (data.canonical) {
213
- canonicalUrl = withBasePath(data.canonical, config.basePath);
214
- }
215
- else if (config.siteUrl) {
216
- canonicalUrl = new URL(publicPageUrl, config.siteUrl).toString();
217
- }
218
- const defaultMetadata = {
219
- title: resolveDocumentTitle({
220
- pageTitle: data.title,
221
- pageUrl: page.url,
222
- tree: pageTree,
223
- }),
224
- description: data.description,
225
- keywords: data.keywords,
226
- robots: getPageRobots(page),
227
- ...(openGraphImages ? { openGraph: { images: openGraphImages } } : {}),
228
- alternates: {
229
- canonical: canonicalUrl,
230
- types: {
231
- "text/markdown": markdownUrl,
232
- },
233
- },
234
- };
235
- return metadata
236
- ? await metadata({
237
- metadata: defaultMetadata,
238
- page,
239
- params: resolvedParams,
240
- })
241
- : defaultMetadata;
242
- };
243
- return {
244
- Page,
245
- getPageTree,
246
- generateStaticParams,
247
- generateMetadata,
248
- };
249
- };
250
- export const createPageActions = createInternalPageActions;