/** * Legend spec derivation (spec: "Built-in widgets / legend") — the legend * widget's default reflects each layer's ACTUAL color symbology, derived * statically from the authored `get-fill-color` expression: * * scale($f, sequential|diverging, [...], domain=[a,b]) → gradient ramp * scale($f, threshold, [...], domain=[b1..bN-1]) → class ranges * $f == 'x' ? c1 : $f == 'y' ? c2 : cDefault → categories * '#hex' literal / `color` shorthand → single swatch * * Anything else (arithmetic, js blocks, function accessors on the * programmatic front-end) falls back to the single `color` swatch — * best-effort static analysis, never a guess. Pure string/AST work over the * SOURCE attribute, deliberately separate from the expression compiler: the * legend needs structure, the compiler needs functions, and coupling them * would make every legend tweak a compiler change. */ export type LegendSpec = { kind: "ramp"; field: string; /** CSS color stops in order (hex/rgb strings as authored). */ colors: string[]; /** [min, max] displayed at the ramp ends. */ domain: [number, number]; } | { kind: "classes"; field: string; /** One entry per class: color + human-readable range label. */ entries: { color: string; label: string; }[]; } | { kind: "categories"; field: string; entries: { color: string; label: string; }[]; /** The ternary chain's fallback color, when authored. */ defaultColor?: string; }; /** * Representative gradient stops per bundled raster colormap — used to PAINT * THE LEGEND, not the map (the map samples the GPU sprite; a 1-D CSS * gradient bar only needs a few stops and the eye fills in the rest). * Matplotlib reference colors at 0/.25/.5/.75/1. The sprite ships ~107 * colormaps; this curated set covers the ones worth suggesting — an * authored name outside it still RENDERS (sprite lookup), it just gets the * single-swatch legend fallback. */ export declare const RASTER_COLORMAP_STOPS: Record; /** * Raster twin of deriveLegendSpec: a COGLayer with an authored rescale * window exposes its colormap as a ramp. Both `min` and `max` must be * authored — without a window the ramp ends would be a guess (the runtime * defaults to 0–255, but promising that in a legend for float data would * label it wrong). */ export declare function deriveRasterLegendSpec(colormap: string | null | undefined, min: number | null | undefined, max: number | null | undefined): LegendSpec | undefined; export declare function deriveLegendSpec(source: string | null | undefined): LegendSpec | undefined;