/** * Deterministic, locale-free value formatting. * * Every data-bound block formats numbers, dates and units through this one * function, so a value reads the same in a table cell, a chart label and a * metric. Nothing here consults `Intl`, the host locale, or the clock: grouping * uses a fixed comma, months use fixed English names, and rounding uses * `toFixed`, which is specified exactly by ECMAScript. */ import type { PropSchema } from '../registry/prop-schema.js'; import type { DataScalar } from './dataset-types.js'; export declare const VALUE_FORMATS: readonly ["text", "number", "integer", "compact", "percent", "currency", "duration", "bytes", "date"]; export type ValueFormat = (typeof VALUE_FORMATS)[number]; export declare const CURRENCIES: readonly ["USD", "EUR", "GBP", "JPY", "CNY", "INR", "VND", "AUD", "CAD", "CHF", "SGD", "KRW"]; export type Currency = (typeof CURRENCIES)[number]; export interface FormatSpec { format?: ValueFormat; /** Short unit appended after number, integer and compact values (`ms`, `req/s`). */ unit?: string; currency?: string; /** Fixed number of decimals (0–4). Omitted: a sensible maximum, trailing zeros trimmed. */ decimals?: number; } /** Prop-schema fields to spread into a column or axis schema. */ export declare const FORMAT_FIELDS: Record; /** Shown for a null value or a missing field. */ export declare const EMPTY_VALUE = "\u2014"; /** * A number with grouped digits. With `fixed`, exactly that many decimals; * otherwise rounded to `maxDecimals` with trailing zeros trimmed. */ export declare function groupedNumber(value: number, maxDecimals: number, fixed?: number): string; /** * Format one value for display. Null reads as an em dash; booleans read as * Yes/No; a numeric string is formatted like the number it spells; any other * string is returned unchanged (dates excepted, which must be `YYYY-MM-DD`). */ export declare function formatValue(value: DataScalar, spec?: FormatSpec): string; //# sourceMappingURL=format-value.d.ts.map