/** * Pure helpers for breadcrumb derivation. * * Extracted so the path-walking logic can be unit-tested without rendering * a Svelte component. */ import type { BreadcrumbItem, NavItem } from './types.js'; /** * Walk a nav tree depth-first and return the label of the item whose * `href` matches exactly, or `null` if not found. */ export declare function findLabelInNav(items: NavItem[], href: string): string | null; /** * Default label fallback for unknown segments: capitalize the first letter * and turn dashes/underscores into spaces. */ export declare function capitalizeSegment(segment: string): string; export interface DeriveCrumbsOptions { /** Optional first crumb (e.g., site identity). */ rootCrumb?: BreadcrumbItem; /** * Skip pathname segments until (and including) the given path is matched. * Example: `startAfter: 'sites/foo'` ignores everything up through * `/sites/foo` in the pathname. */ startAfter?: string; /** Fall back to capitalized segments for unmatched paths (default: true). */ capitalize?: boolean; } /** * Derive a breadcrumb trail from a pathname + nav tree. * * Strategy: * 1. Optionally prepend `rootCrumb`. * 2. Split the pathname into segments. * 3. If `startAfter` is set, locate its trailing segment in the * pathname and skip everything before/including it. The * `startAfter` value may include a leading slash or none and * may be a multi-segment path (e.g. `sites/foo`). * 4. Walk the remaining segments, building cumulative paths; for * each, try to find a matching nav label, otherwise capitalize. */ export declare function deriveCrumbsFromNav(pathname: string, nav: NavItem[], options?: DeriveCrumbsOptions): BreadcrumbItem[]; //# sourceMappingURL=breadcrumbs-helpers.d.ts.map