/** * Time ranges on the Timeline: the arithmetic of drawing one, and the * summary of what happened inside it. * * A range answers "what was going on between here and here" without reading * the list row by row. Pure and framework-free like the rest of * `lib/timeline`, so the panel only draws it and a devframe agent tool can * summarise a window the same way. */ import type { ComponentRollup, TimelineSpan } from './derive.js'; /** A window of recording time, in the same milliseconds as span starts. */ export interface TimeRange { start: number; end: number; } /** * The range between two drag ends in either order, or null when they are the * same instant (or not numbers), so a plain click never leaves a hairline. */ export declare const normalizeRange: (a: number, b: number) => TimeRange | null; /** One end of a {@link TimeRange}. */ export type RangeEdge = 'start' | 'end'; /** * `range` with one edge moved to `ms`: kept inside `bounds` and at least * `minWidth` from the other edge, so dragging or nudging an edge never * flips the range or collapses it into a click (which would clear it). */ export declare const moveEdge: (range: TimeRange, edge: RangeEdge, ms: number, bounds: { min: number; max: number; }, minWidth: number) => TimeRange; /** * A range as a link carries it, `1.25-3.5` in milliseconds on the buffer's * clock. Rounded outward to microseconds so the linked range still covers * every span the drawn one did. */ export declare const formatRangeParam: (range: TimeRange) => string; /** The range a link names, or null for anything but `start-end` numbers. */ export declare const parseRangeParam: (value: string) => TimeRange | null; export declare const sameRange: (a: TimeRange | null, b: TimeRange | null) => boolean; /** * Whether `span` belongs to `range`. A span counts when it *starts* inside * (both ends inclusive), however long it runs on: that keeps every span in * exactly one of two adjacent ranges and makes the counts add up. */ export declare const inRange: (span: TimelineSpan, range: TimeRange) => boolean; export declare const spansInRange: (spans: readonly TimelineSpan[], range: TimeRange) => TimelineSpan[]; /** What happened inside a {@link TimeRange}. */ export interface RangeSummary { range: TimeRange; durationMs: number; /** Spans (a start/end pair counts once) that started in the range. */ spanCount: number; /** Per layer, most events first; layers with none in the range are left out. */ layers: Array<{ layerId: string; count: number; }>; /** Per component tag, busiest first. */ components: ComponentRollup[]; } /** Summarises the spans that start inside `range`. */ export declare const summarizeRange: (spans: readonly TimelineSpan[], range: TimeRange) => RangeSummary; /** * The zoom and pan (see `tracks.ts`) that fit `range` to the plot, with a * margin so its edges stay visible. The caller clamps them. */ export declare const fitRange: (originMs: number, extentMs: number, range: TimeRange) => { zoom: number; pan: number; }; /** Milliseconds as a short label: `850µs`, `12.3ms`, `1.25s`. */ export declare const formatMs: (ms: number) => string; /** `1.2s–3.4s (2.20s)`: the bounds and the duration of a range. */ export declare const describeRange: (range: TimeRange) => string; //# sourceMappingURL=range.d.ts.map