import { vi } from 'vitest'; import { ECharts, EChartsOption } from 'echarts'; import { WidgetState, WidgetStoreApi } from './stores'; export interface MockChartHandlers { finished?: () => void; rendered?: () => void; click?: (params: unknown) => void; globalcursortaken?: (params: unknown) => void; datazoom?: (params: unknown) => void; brushselected?: (params: unknown) => void; brushend?: (params: unknown) => void; [key: string]: ((params?: unknown) => void) | undefined; } export interface MockChart { dispatchAction: ReturnType; setOption: ReturnType; getOption: ReturnType; resize: ReturnType; clear: ReturnType; dispose: ReturnType; isDisposed: ReturnType; getWidth: ReturnType; getHeight: ReturnType; getDom: ReturnType; on: (event: string, callback: (params?: unknown) => void) => void; off: (event: string, callback?: (params?: unknown) => void) => void; __handlers: MockChartHandlers; __emit: (event: keyof MockChartHandlers, params?: unknown) => void; } /** * Returns a duck-typed `ECharts` instance suitable for tests. The instance * captures `on()` handlers in `__handlers` so tests can `__emit('finished')` * directly, and all imperative methods (`dispatchAction`, `setOption`, * `resize`, …) are `vi.fn()` spies. */ export declare function createMockChart(): MockChart; /** Convenience cast for tests that need an `ECharts`-typed reference. */ export declare const asEcharts: (chart: MockChart) => ECharts; /** * Returns a `vi.fn()` option factory. The factory takes the standard * `(option, data, ctx)` signature and returns the supplied `output` unchanged. * Useful when the test only cares about how the bridge wires the factory in. */ export declare function createMockOptionFactory(output?: EChartsOption): import('vitest').Mock<() => EChartsOption>; /** * Typed re-export of `getWidgetStore(id).getState()` — the verbose form * shows up dozens of times across the suite. Tests that need the store * api itself (`setState`, `subscribe`) still call `getWidgetStore(id)`. */ export declare function getState(id: string): WidgetState; /** Typed re-export of `getWidgetStore(id)` for tests that need the api. */ export declare function getStore(id: string): WidgetStoreApi;