UNPKG

fumadocs-mdx

Version:

The built-in source for Fumadocs

44 lines (43 loc) 2.6 kB
import { M as DocCollection, N as DocsCollection } from "../core-O3WLuY_I.js"; import { i as InternalTypeConfig } from "../types-B6myALSk.js"; import { t as CompiledMDXProperties } from "../build-mdx-10MrLupc.js"; import { FC, ReactNode } from "react"; import { StandardSchemaV1 } from "@standard-schema/spec"; //#region src/runtime/browser.d.ts type CompiledMDXFile<Name extends string, Frontmatter, TC extends InternalTypeConfig> = CompiledMDXProperties<Frontmatter> & TC['DocData'][Name] & Record<string, unknown>; interface ClientLoaderOptions<Doc, Props> { /** * Loader ID (usually your collection name) * * The code splitting strategy of frameworks like Tanstack Start may duplicate `createClientLoader()` into different chunks. * * We use loader ID to share cache between multiple instances of client loader. * * @defaultValue '' */ id?: string; component: (loaded: Doc, props: Props) => ReactNode; } interface ClientLoader<Doc, Props> { preload: (path: string) => Promise<Doc>; /** * Get a component that renders content with `use()`. */ getComponent: (path: string) => FC<Props>; /** * Get react nodes that renders content, wraps `<Suspense>` by default. */ useContent: undefined extends Props ? (path: string, props?: Props) => ReactNode : (path: string, props: Props) => ReactNode; } type BrowserCreate<Config, TC extends InternalTypeConfig> = ReturnType<typeof browser<Config, TC>>; interface DocCollectionEntry<Name extends string = string, Frontmatter = unknown, TC extends InternalTypeConfig = InternalTypeConfig> { raw: Record<string, () => Promise<CompiledMDXFile<Name, Frontmatter, TC>>>; createClientLoader: <Props extends object | undefined = undefined>(options: ClientLoaderOptions<CompiledMDXFile<Name, Frontmatter, TC>, Props>) => ClientLoader<CompiledMDXFile<Name, Frontmatter, TC>, Props>; } declare function browser<Config, TC extends InternalTypeConfig>(): { doc<Name extends keyof Config & string>(_name: Name, glob: Record<string, () => Promise<unknown>>): Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? DocCollectionEntry<Name, StandardSchemaV1.InferOutput<Schema>, TC> : never; }; declare function createClientLoader<Doc = CompiledMDXProperties, Props extends object | undefined = undefined>(globEntries: Record<string, () => Promise<Doc>>, options: ClientLoaderOptions<Doc, Props>): ClientLoader<Doc, Props>; //#endregion export { BrowserCreate, ClientLoader, ClientLoaderOptions, DocCollectionEntry, browser, createClientLoader }; //# sourceMappingURL=browser.d.ts.map