import { ComputedRef, Ref } from '../../node_modules/vue'; /** * Reactive inputs driving {@link useChartFormat}: the chart's loaded data (used * to detect highlights) and the height-ratio props feeding {@link baseHeightRatio}. */ export interface UseChartFormatOptions { loadedData: Ref; rawData: Ref; chartHeightRatio: Ref; socialMode: Ref; socialModeRatio: Ref; } /** * Reactive API returned by {@link useChartFormat}. */ export interface UseChartFormat { /** * Whether at least one datum is flagged `highlight`. */ dataHasHighlights: ComputedRef; /** * The chart's base height-to-width ratio, honouring an explicit ratio first, * then social mode, then the default 16:9. */ baseHeightRatio: ComputedRef; /** * Formats a value with a d3 format string or a custom function, returning the * value untouched when no usable formatter is given. */ d3Formatter: (value: number | string, formatter?: ((v: number | string) => string) | string) => string | number; } /** * Owns a chart's pure formatting and derivation concern: it exposes the value * formatter, the base height ratio, and highlight detection. It holds no DOM * state and reads only from the reactive inputs it is given. * * @param options - The reactive data and height-ratio inputs (see {@link UseChartFormatOptions}). * @returns The {@link UseChartFormat} API of formatting and derived-config helpers. * @remarks Internal building block consumed by {@link useChart}; not exported from the package root. * @example * // Inside useChart, fed the loaded data and the height-ratio props: * import { useChartFormat } from '@/composables/useChartFormat' * * const { d3Formatter, baseHeightRatio, dataHasHighlights } = useChartFormat({ * loadedData, * rawData: props.data, * chartHeightRatio: props.chartHeightRatio, * socialMode: props.socialMode, * socialModeRatio: props.socialModeRatio * }) */ export declare function useChartFormat(options: UseChartFormatOptions): UseChartFormat; export default useChartFormat;