/** * Cross-package helpers for per-column value formatting. Used by both * `viewer-datagrid` (cell formatting) and `viewer-charts` (axis ticks, * tooltips, legends) so a column's `number_format` / `date_format` * configuration produces identical output across plugins. * * The format configs mirror the `Intl.NumberFormatOptions` / * `Intl.DateTimeFormatOptions` shapes one-for-one — they're written * straight into the respective constructors. The `date_format.format` * discriminator ("simple" | "custom") selects between two derivation * paths: simple uses `dateStyle` / `timeStyle`, custom uses the * per-field overrides (year / month / day / ...). */ import type { CustomNumberFormatConfig } from "./ts-rs/CustomNumberFormatConfig.d.ts"; import type { NumberFormatStyle } from "./ts-rs/NumberFormatStyle.d.ts"; import type { Notation } from "./ts-rs/Notation.d.ts"; import type { DatetimeFormatType } from "./ts-rs/DatetimeFormatType.d.ts"; /** * A numeric column's `number_format` (`columns_config` value), exactly as * the Style tab's editor WRITES it — the ts-rs projection of the Rust * `CustomNumberFormatConfig`, re-composed with its serde-flattened * `style` and `notation` families (ts-rs cannot flatten `Option`, * so the Rust type `#[ts(skip)]`s them and they export separately). */ export type NumberFormatConfig = CustomNumberFormatConfig & Partial & Partial; /** * A datetime column's `date_format` (`columns_config` value) — the Rust * `DatetimeFormatType` union: a `Simple` preset (`dateStyle` / * `timeStyle`), or per-part custom fields discriminated by * `format: "custom"`. */ export type DateFormatConfig = DatetimeFormatType; /** * `defaults` is the calling plugin's declared default format, filling in * the fields `cfg` leaves unset. */ export declare function createNumberFormatter(type: string, cfg?: NumberFormatConfig, defaults?: NumberFormatConfig): Intl.NumberFormat; /** * `defaults` is the calling plugin's declared default `date_format`, * applied only when `cfg` is wholly absent. */ export declare function createDatetimeFormatter(cfg?: DateFormatConfig, defaults?: DateFormatConfig): Intl.DateTimeFormat; /** * `defaults` follows the same contract as * [`createDatetimeFormatter`]: the plugin's declared default * `date_format`, applied only when `cfg` is wholly absent. */ export declare function createDateFormatter(cfg?: DateFormatConfig, defaults?: DateFormatConfig): Intl.DateTimeFormat; /** * Recover the source column name from a synthetic split-by path. Split * pivoting produces paths of the form `|...|`; * per-column config (formatters, aggregate styling, …) is always keyed * on the trailing source column. */ export declare function sourceColumn(path: string): string;