@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
12 lines (11 loc) • 674 B
TypeScript
import type { ESLAnchorData } from './esl-anchornav';
/** {@link ESLAnchornav} hierarchy builder function */
export type ESLAnchornavHierarchyBuilder = (flatAnchors: ESLAnchorData[]) => ESLAnchorData[];
/**
* Builds hierarchy based on level property from anchor data.
* Anchors with smaller level values become parents of following anchors with larger values.
* Uses `data.level` property from the anchor's data object (set via `esl-anchor="level: X"` attribute).
* @param flatAnchors - flat list of anchors in DOM order
* @returns hierarchical anchors list (roots only)
*/
export declare function buildHierarchyByLevel(flatAnchors: ESLAnchorData[]): ESLAnchorData[];