/** Axis-aligned bounding box for a rect (x, y in pixels, w/h in pixels). */ export type BBox = { x: number; y: number; w: number; h: number; }; export declare function verticallyOverlaps(a: BBox, b: BBox): boolean; /** * Width of the leftmost horizontal segment of `bbox` that is not covered by * any of `blockers` at overlapping y. Returns `0` when the leading edge is * itself covered — the caller uses that as a signal to skip the label. * * `blockers` are treated as later-painted rects, i.e. drawn on top; the * caller must supply them in that order (see `FlameLabelOverlay`). */ export declare function usableLeftSegmentWidth(bbox: BBox, blockers: BBox[]): number; export type BlockerIndex = { add: (bbox: BBox) => void; /** * Blockers that may vertically overlap `bbox`. Can contain duplicates when * a rect spans several rows, which `usableLeftSegmentWidth` tolerates. */ near: (bbox: BBox) => BBox[]; }; /** * Buckets blockers by vertical position so a lookup only scans rects that can * share a y range with the query, instead of every rect placed so far, which * gets quadratic on large flame graphs. `rowHeight` only affects bucket size, * never the result. */ export declare function createBlockerIndex(rowHeight: number): BlockerIndex; /** * Count of characters in `text` that are not the ellipsis. Used to skip labels * where truncation would leave only visual noise (`…`, `…A`). */ export declare function countRealChars(text: string): number; /** * Returns the portion of `bbox` that lies within `[0, plotWidth]` on the x * axis, or `undefined` when the visible width is zero or negative. * * Used to clamp a bar's label to the visible plot area during zoom and pan, * so the label text never drifts off-screen with its bar. */ export declare function visibleXSegment(bbox: BBox, plotWidth: number): BBox | undefined; export type FlameLabelContent = { showIcon: boolean; text: string | undefined; }; type ResolveFlameLabelContentOptions = { text: string; hasIcon: boolean; /** Horizontal space available for icon and text together. */ availLength: number; truncate: (text: string, width: number) => string; }; /** * Decides what fits in a flame bar: icon and text, icon only, text only, or * nothing (`undefined`). The icon always has priority over the text, which is * the only part that gets truncated. The caller drops bars that are too narrow * to show anything, so `availLength` is expected to fit at least the icon. */ export declare function resolveFlameLabelContent({ text, hasIcon, availLength, truncate, }: ResolveFlameLabelContentOptions): FlameLabelContent | undefined; export {}; //# sourceMappingURL=flame-label-utils.d.ts.map