import type { MDXComponents } from 'mdx/types';
import { FrameworkLink, FwCode, FwVariant, Framework, StateIntroText, Word } from '@embedpdf/docs-kit';
import type { AnchorHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
import { CodeExample } from '@/components/site/code-example';
import {
ApiCredentials,
ApiGrants,
ApiInstall,
ApiOperationCount,
ApiResources,
} from './api-overview';
import { ApiClientSetup, ApiOperation, ApiSnippet } from './api-reference';
import { DeploymentTab, DeploymentTabs } from './deployment-tabs';
import { Fw } from './framework';
import { GrantPreview } from './grant-preview';
import { createHeading } from './heading';
import { Pre } from './pre';
import { RouteExample, type CompiledExampleProps } from './route-example';
import { Screenshot } from './screenshot';
import { Toc, type TocItem } from './toc';
type WrapperProps = {
children: ReactNode;
toc?: TocItem[];
metadata?: { title?: string; description?: string };
};
function Wrapper({ children, toc }: WrapperProps) {
return (
);
}
/** A page's title: its `# heading`, or the title a held-back page still shows. */
export function PageTitle(props: HTMLAttributes) {
return (
);
}
export function useMDXComponents(components?: MDXComponents): MDXComponents {
return {
wrapper: Wrapper,
h1: PageTitle,
h2: createHeading('h2'),
h3: createHeading('h3'),
h4: createHeading('h4'),
p: (props) => (
),
a: ({ href = '', ...props }: AnchorHTMLAttributes) => (
),
strong: (props) => ,
ul: (props) => (
),
ol: (props) => (
),
li: (props) => ,
blockquote: (props) => (
),
hr: (props) =>
,
table: (props) => (
),
th: (props) => (
|
),
td: (props) => (
|
),
pre: Pre,
ApiOperation,
Fw,
ApiSnippet,
ApiClientSetup,
ApiResources,
ApiCredentials,
ApiGrants,
ApiInstall,
ApiOperationCount,
DeploymentTabs,
DeploymentTab,
Screenshot,
GrantPreview,
CodeExample,
// A docs page passes its route's framework (app/…/[...mdxPath]/page.tsx); without one, the
// code of every framework goes to the browser, which picks by pathname.
Example: (props: CompiledExampleProps) => ,
// The headless docs, written for each framework (docs/conventions/docs-architecture.md).
Framework,
FwCode,
FwVariant,
Snippet: (props: CompiledExampleProps) => (
),
StateIntro: (props: { hook: string }) => (
),
Word,
...components,
};
}