@atomist/sdm-pack-aspect
Version:
an Atomist SDM Extension Pack for visualizing drift across an organization
78 lines • 3.14 kB
TypeScript
import { PlantedTree, SunburstLeaf, SunburstLevel, SunburstTree } from "./sunburst";
/**
* Visit all nodes of a tree. May mutate them.
*/
export declare function visit(t: SunburstLevel, visitor: (sl: SunburstLevel, depth: number) => boolean, depth?: number): void;
export declare function visitAsync(t: SunburstLevel, visitor: (sl: SunburstLevel, depth: number) => Promise<boolean>, depth?: number): Promise<void>;
/**
* Suppress branches that meet a condition
* @param tr Tree to transform
* @param shouldEliminate whether this child should be deleted
*/
export declare function killChildren(tr: SunburstTree, shouldEliminate: (child: SunburstLevel, depth: number) => boolean): SunburstTree;
export interface GroupSiblingsOptions {
/**
* Selector for parents to merge
*/
parentSelector: (l: SunburstTree) => boolean;
/**
* Group siblings to merge under selected parents
*/
childClassifier: (l: SunburstLevel) => string;
/**
* Decorator the new levels
* @param {SunburstLevel} l
*/
groupLayerDecorator?: (l: SunburstLevel) => void;
/**
* If provided, identifies new grouped node names to collapse under
*/
collapseUnderName?: (name: string) => boolean;
}
/**
* Merge siblings into groups by the grouper
*/
export declare function groupSiblings(tr: SunburstTree, params: GroupSiblingsOptions): SunburstTree;
/**
* Trim the outer rim, replacing the next one with sized leaves
* @param tr tree to work on
* @param test test for which eligible nodes (nodes with only leaves under them) to kill
*/
export declare function trimOuterRim(tr: SunburstTree, test?: (t: SunburstTree) => boolean): SunburstTree;
export interface ClassificationLayerOptions<T> {
/**
* Classify a descendant. Undefined means this descendant is irrelevant.
*/
descendantClassifier: (t: SunburstLevel & T) => string | undefined;
/**
* Depth at which to activate split and put in an extra layer
*/
newLayerDepth: number;
/**
* What does this new layer mean?
*/
newLayerMeaning: string;
/**
* Source all descendants we may be interested in classifying on.
* Default is leaves
* @param {SunburstTree} l
* @return {SunburstLevel[]}
*/
descendantFinder?: (l: SunburstTree) => SunburstLevel[];
}
/**
* Introduce a new level splitting by by the given classifier for descendants
*/
export declare function introduceClassificationLayer<T = {}>(pt: PlantedTree, how: ClassificationLayerOptions<T>): PlantedTree;
export declare function pruneLeaves(tr: SunburstTree, toPrune: (l: SunburstLeaf) => boolean): SunburstTree;
/**
* Return all terminals under this level
* @param {SunburstLevel} t
* @return {SunburstLeaf[]}
*/
export declare function leavesUnder(t: SunburstLevel): SunburstLeaf[];
export declare function descendants(t: SunburstLevel): SunburstLevel[];
export declare function childCount(l: SunburstLevel): number;
export declare function childrenOf(l: SunburstLevel): SunburstLevel[];
export declare function validatePlantedTree(pt: PlantedTree): void;
//# sourceMappingURL=treeUtils.d.ts.map