import type { TrackRow } from './types/config'; import type { GroupConfig } from '../dtypes/types'; /** * Tree utilities for path-based hierarchy. * * Tracks carry a `path` like `"robot/joint_angles"`; groups are synthesized * client-side from the `/`-separated prefixes. `TimelineConfig.groups` * supplies optional per-prefix styling (name override, icon, color, * initial expanded state). * * A row is visible iff: * - all ancestor prefixes are expanded (not in `collapsed`) * - either the filter is empty, or the row itself matches, or a * descendant matches (ancestors stay visible so the match can be * reached), or an ancestor matches (descendants stay visible under a * matching ancestor). */ /** * Track row in the tree (leaf node — tracks have no descendants in this * model; nested tracks go under their path-prefix group). */ export interface TreeTrackRow { kind: 'track'; /** Stable identifier — `TrackRow.id`. */ id: string; track: TrackRow; depth: number; /** Always false for tracks. Kept for rendering uniformity. */ hasChildren: false; isLast: boolean; ancestorIsLast: boolean[]; } /** * Synthesized group row — emitted whenever a path prefix has at least one * track under it. Never stored on the server; the prefix string IS the * identity. */ export interface TreeGroupRow { kind: 'group'; /** Path prefix — e.g. `"robot/arm"`. Also the `id` used for hide/collapse state. */ id: string; path: string; /** Resolved label — `groups[prefix].name` if supplied, else path leaf. */ name: string; config: GroupConfig; depth: number; hasChildren: boolean; isLast: boolean; ancestorIsLast: boolean[]; } export type TreeRow = TreeTrackRow | TreeGroupRow; /** * Depth-first flatten. Skips collapsed subtrees. Filter: if non-empty, any * row whose label matches keeps its ancestor prefixes and its descendants * visible. Search is case-insensitive and substring-based by default. * Invalid regex yields an empty match set (no crash). */ export declare function flattenTree(tracks: readonly TrackRow[], options?: { collapsed?: ReadonlySet; groups?: Record; filter?: string; caseSensitive?: boolean; regex?: boolean; }): TreeRow[]; /** * Compute hidden-inheritance for every track + group. A row is "inherited * hidden" when any ancestor prefix is in the `hidden` set. `hidden` holds * track ids AND group prefixes (the two don't overlap because group ids * always contain `/` unless they're top-level, and top-level prefixes are * group-only — a track at a top-level path is not a prefix of anything). */ export declare function hiddenInheritance(tracks: readonly TrackRow[], hidden: ReadonlySet): Map; /** * Initial collapsed set derived from `groups[prefix].expanded === false`. */ export declare function initialCollapsed(groups?: Record): Set; //# sourceMappingURL=tree.d.ts.map