import { ReactNode } from 'react'; import { z } from 'zod'; import { itemSchema, menuSchema } from '../server/schemas.js'; import { MdxFile, Folder, FrontMatter, PageMapItem } from '../types.js'; import './lib/index.js'; import 'rehype-katex/lib/index.js'; import 'better-react-mathjax'; import 'rehype-pretty-code'; import 'mdast'; import 'next'; import '../types.generated.js'; import '@mdx-js/mdx'; import 'rehype-katex'; type PageTheme = NonNullable['theme']>; type Display = z.infer['display']; type IMenuItem = z.infer; type FolderWithoutChildren = Omit; type Item = (MdxFile | FolderWithoutChildren) & { title: ReactNode; type: string; children: Item[]; display?: Display; theme?: PageTheme; frontMatter: FrontMatter; isUnderCurrentDocsTree?: boolean; }; type PageItem = (MdxFile | FolderWithoutChildren) & { title: ReactNode; type: string; href?: string; children?: PageItem[]; firstChildRoute?: string; display?: Display; isUnderCurrentDocsTree?: boolean; }; type MenuItem = (MdxFile | FolderWithoutChildren) & IMenuItem & { children?: PageItem[]; }; type DocsItem = (MdxFile | FolderWithoutChildren) & { title: ReactNode; type: string; children: DocsItem[]; firstChildRoute?: string; isUnderCurrentDocsTree?: boolean; }; type NormalizedResult = { /** Active type for current page, used to determine layout in theme. */ activeType?: 'doc' | 'page' | 'menu'; /** * Active index for current page, used for pagination in combination with `flatDocsDirectories` * items. */ activeIndex: number; activeThemeContext: PageTheme; /** * Parsed [front matter](https://jekyllrb.com/docs/front-matter) or exported * [Metadata](https://nextjs.org/docs/app/building-your-application/optimizing/metadata) from page. */ activeMetadata?: FrontMatter; /** Active path for current page, used for breadcrumb navigation. */ activePath: Item[]; /** All directories in the tree structure. */ directories: Item[]; /** Directories with `type: 'doc'` in `_meta` file. */ docsDirectories: DocsItem[]; /** Flattened directories with `type: 'doc'` in `_meta` file. */ flatDocsDirectories: DocsItem[]; /** Navbar items, items which have `type: 'page'` in `_meta` file. */ topLevelNavbarItems: (PageItem | MenuItem)[]; }; declare function normalizePages({ list, route, /** @default '' */ docsRoot, /** @default DEFAULT_PAGE_THEME */ pageThemeContext }: { list: PageMapItem[]; route: string; docsRoot?: string; underCurrentDocsRoot?: boolean; pageThemeContext?: PageTheme; }): NormalizedResult; export { type Item, type MenuItem, type PageItem, normalizePages };