/** One word to place, before layout. */ export interface WordCloudWord{readonly text:string;readonly weight:number;readonly color?:string;readonly group?:string;} /** A word after layout — its normalized finite, nonnegative weight plus computed geometry. */ export interface PlacedWord extends WordCloudWord{ /** Index of this word in the original (pre-sort) `words` array — stable * across layout re-runs, so callers can key a color/group map off it * instead of off placement order (which is sorted by weight). */ readonly originalIndex:number; /** Center x, in an unbounded coordinate space centered on the origin. */ readonly x:number; /** Center y, in the same space as `x`. */ readonly y:number;readonly fontSize:number; /** `true` if rotated 90°. */ readonly rotated:boolean; /** Unrotated rendered width, in px. */ readonly width:number; /** Unrotated rendered height, in px (== fontSize; layout doesn't model ascent/descent). */ readonly height:number;} /** Weight-to-font-size mapping curve. `sqrt` compresses it so one heavy word * doesn't dwarf the rest. */ export type WordCloudScale='linear'|'sqrt'; /** Rotation mode for placed words. `mixed` lets some render rotated 90° for denser packing. */ export type WordCloudRotation='none'|'mixed';export interface WordCloudLayoutOptions{readonly minFontSize:number;readonly maxFontSize:number; /** Optional weight-domain endpoints. A valid pair pins the input scale instead of deriving it * from this cloud's own lightest/heaviest eligible words. Opposite-sign finite endpoints * retain bounded fractions even when their subtraction would overflow. */ readonly domain?:readonly[number,number];readonly scale:WordCloudScale;readonly wordRotation:WordCloudRotation; /** Measures the rendered width of `text` set at `fontSize`, e.g. via a canvas 2D * context — the font string passed to the context must match the actual * rendered `[part="word"]` font (weight included), or collision boxes end * up narrower than what's actually painted. */ readonly measureText:(text:string,fontSize:number)=>number; /** `[0, 1)` — defaults to `Math.random`; inject a stub for deterministic tests. */ readonly random?:()=>number;}export interface WordCloudLayoutResult{readonly placed:readonly PlacedWord[]; /** Words left out of `placed`, for any of three reasons: blank/whitespace-only * `text`; capacity overflow (input has more than `MAX_WORDS` entries, so the * lowest-weight excess is dropped, regardless of where it fell in the input * array); or the spiral search exhausted its radius bound (pathological * inputs only, e.g. one huge word repeated many times). */ readonly skipped:readonly WordCloudWord[]; /** Complete omitted count; `skipped` itself is a bounded diagnostic sample. */ readonly skippedCount:number; /** Gap-padded bounding box of `placed` — 0 if nothing was placed. */ readonly width:number;readonly height:number;} /** DOM-node/compute-time safety cap — mirrors lr-sparkline's `MAX_BARS`. */ export declare const MAX_WORDS=150; /** Maximum retained omitted records; diagnostics must never become a second unbounded collection. */ export declare const MAX_SKIPPED_DIAGNOSTICS=32; /** Largest accepted font size in CSS pixels. This keeps measurement and * placement geometry finite enough for an interactive render even when a * caller supplies an otherwise-valid but impractically large number. */ export declare const MAX_FONT_SIZE_PX=512; /** Maximum number of candidate positions tested for any one word. Together * with `MAX_WORDS`, this puts a hard upper bound on spiral-search work. */ export declare const MAX_SPIRAL_ITERATIONS=4096; /** Minimum gap enforced both between placed words and around the returned bounding box. */ export declare const GAP=3; /** Fallback used by `resolveFontSizeBounds()` for any non-finite/non-positive * `minFontSize`/`maxFontSize` input -- also reused by `` itself as the lower * clamp bound for its own guard on those two properties. */ export declare const MIN_SANE_FONT_SIZE=1; /** * Places `words` via an Archimedean-spiral search (the standard word-cloud * layout heuristic — heaviest words placed first, each one walking an * outward spiral from the center until it finds a gap that doesn't overlap * any word already placed). Deterministic given a deterministic `random`. */ export declare function layoutWordCloud(words:readonly WordCloudWord[],options:WordCloudLayoutOptions):WordCloudLayoutResult;