fumadocs-core
Version:
The library for building a documentation website in any React.js framework
33 lines (30 loc) • 1.14 kB
TypeScript
import { N as Node, I as Item, R as Root, F as Folder } from '../definitions-Q95-psoo.js';
export { S as Separator } from '../definitions-Q95-psoo.js';
import 'react';
/**
* Flatten tree to an array of page nodes
*/
declare function flattenTree(nodes: Node[]): Item[];
/**
* Get neighbours of a page, useful for implementing "previous & next" buttons
*/
declare function findNeighbour(tree: Root, url: string, options?: {
separateRoot?: boolean;
}): {
previous?: Item;
next?: Item;
};
declare function getPageTreeRoots(pageTree: Root | Folder): (Root | Folder)[];
/**
* Get other page tree nodes that lives under the same parent
*/
declare function getPageTreePeers(tree: Root, url: string): Item[];
/**
* Search the path of a node in the tree matched by the matcher.
*
* @returns The path to the target node (from starting root), or null if the page doesn't exist
*/
declare function findPath(nodes: Node[], matcher: (node: Node) => boolean, options?: {
includeSeparator?: boolean;
}): Node[] | null;
export { Folder, Item, Node, Root, findNeighbour, findPath, flattenTree, getPageTreePeers, getPageTreeRoots };