import { DurationUnit } from './html/data_styles'; import { Cell, NestField, Field } from './data_tree'; export declare const NULL_SYMBOL = "\u2205"; type UnionToIntersection = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never; export declare function deepMerge[]>(...sources: [...T]): UnionToIntersection; export declare function getTextWidthCanvas(text: string, font: string, canvasToUse?: HTMLCanvasElement): number; export declare function getTextWidthDOM(text: string, styles: Record): number; export declare function clamp(s: number, e: number, v: number): number; export declare function getRangeSize(range: [number, number]): number; export declare function formatTimeUnit(value: number, unit: DurationUnit, options?: { numFormat?: string; terse?: boolean; }): string; export declare function getText(field: Field, value: number, options: { durationUnit?: string; terse?: boolean; }): string | null; export interface RenderTimeStringOptions { isDate?: boolean; timeframe?: string; extractFormat?: 'month-day' | 'quarter' | 'month' | 'week' | 'day'; timezone?: string; } export declare function renderTimeString(value: Date, options?: RenderTimeStringOptions): string; export declare function valueToMalloy(value: Cell): string; export declare function walkFields(e: NestField, cb: (f: Field) => void): void; export declare function notUndefined(x: T | undefined): x is T; export declare function formatBigNumber(value: number): string; export type ScaleKey = 'k' | 'm' | 'b' | 't' | 'q'; export type SuffixFormatKey = 'letter' | 'lower' | 'word' | 'short' | 'finance' | 'scientific' | 'none'; export interface FormatScaledNumberOptions { scale?: ScaleKey | 'auto'; decimals?: number; suffix?: SuffixFormatKey; } /** * Formats a number with scaling and suffix options. * * @example * formatScaledNumber(1234567, { scale: 'm', decimals: 1 }) // "1.2m" * formatScaledNumber(1234567, { scale: 'auto' }) // "1.2m" * formatScaledNumber(1234567, { scale: 'm', suffix: 'word' }) // "1.2 Million" */ export declare function formatScaledNumber(value: number, options?: FormatScaledNumberOptions): string; export interface ParsedNumberFormat { decimals?: number; scale?: ScaleKey | 'auto'; isId?: boolean; } export interface ParsedCurrencyFormat extends ParsedNumberFormat { currency: string; symbol: string; } /** * Parses a number shorthand format string. * Pattern: {decimals}{scale} or "auto" or "id" * * @example * parseNumberShorthand("1k") // { decimals: 1, scale: 'k' } * parseNumberShorthand("0m") // { decimals: 0, scale: 'm' } * parseNumberShorthand("2") // { decimals: 2 } * parseNumberShorthand("auto") // { scale: 'auto' } * parseNumberShorthand("id") // { isId: true } * * Note: "big" is NOT handled here - it's a legacy format handled separately * in renderNumberField to preserve backward compatibility with formatBigNumber. */ export declare function parseNumberShorthand(format: string): ParsedNumberFormat | null; /** * Parses a currency shorthand format string. * Pattern: {currency}{decimals}{scale} e.g., "usd2m", "eur0k", "gbp1b" * * @example * parseCurrencyShorthand("usd2m") // { currency: 'usd', symbol: '$', decimals: 2, scale: 'm' } * parseCurrencyShorthand("eur0k") // { currency: 'eur', symbol: '€', decimals: 0, scale: 'k' } * parseCurrencyShorthand("usd") // { currency: 'usd', symbol: '$' } */ export declare function parseCurrencyShorthand(format: string): ParsedCurrencyFormat | null; /** * Normalizes a scale value to a ScaleKey. * Supports single-letter scales: k, m, b, t, q, auto. */ export declare function normalizeScale(scale: string | undefined): ScaleKey | 'auto' | undefined; export {};