@opendata-ai/openchart-react 9.7.0 → 9.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +4 -4
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/BarList.tsx","../src/ThemeContext.tsx","../src/Chart.tsx","../src/ChartStory.tsx","../src/DataTable.tsx","../src/GeoMap.tsx","../src/Graph.tsx","../src/hooks.ts","../src/hooks/useGraph.ts","../src/hooks/useTable.ts","../src/hooks/useTableState.ts","../src/Race.tsx","../src/Sankey.tsx","../src/TileMap.tsx","../src/Visualization.tsx"],"sourcesContent":["/**\n * @opendata-ai/openchart-react\n *\n * React adapter for openchart. Provides <Chart /> and <DataTable />\n * components that wrap the vanilla adapter with React lifecycle management.\n *\n * Re-exports the full core type system and utilities so React consumers\n * only need a single @opendata-ai/openchart-react dependency.\n */\n\n// ---------------------------------------------------------------------------\n// Core: full type system, theme, colors, locale, accessibility, helpers\n// ---------------------------------------------------------------------------\n\nexport * from '@opendata-ai/openchart-core';\n\n// ---------------------------------------------------------------------------\n// Vanilla: export utilities (SVG/PNG/JPG/CSV)\n// ---------------------------------------------------------------------------\n\nexport type {\n GeoMapCameraChangeMeta,\n InteractionMode,\n JPGExportOptions,\n PlaybackController,\n PlaybackPeriod,\n PlaybackState,\n PNGExportOptions,\n SpecSequenceOptions,\n SVGExportOptions,\n} from '@opendata-ai/openchart-vanilla';\nexport {\n exportCSV,\n exportJPG,\n exportPNG,\n exportSpecSequence,\n exportSVG,\n exportSVGWithFonts,\n} from '@opendata-ai/openchart-vanilla';\n\n// ---------------------------------------------------------------------------\n// Engine: compile API and types not covered by core\n// ---------------------------------------------------------------------------\n\nexport type {\n ChartRenderer,\n CompiledGraphEdge,\n CompiledGraphNode,\n CompileResult,\n GraphCompilation,\n NormalizedBarListSpec,\n NormalizedChartSpec,\n NormalizedChrome,\n NormalizedGeoMapSpec,\n NormalizedGraphSpec,\n NormalizedSankeySpec,\n NormalizedSpec,\n NormalizedTableSpec,\n NormalizedTileMapSpec,\n SimulationConfig,\n ValidationError,\n ValidationErrorCode,\n ValidationResult,\n} from '@opendata-ai/openchart-engine';\nexport {\n clearRenderers,\n compile,\n compileBarList,\n compileChart,\n compileGeoMap,\n compileGraph,\n compileSankey,\n compileTable,\n compileTileMap,\n getChartRenderer,\n normalizeSpec,\n registerChartRenderer,\n validateSpec,\n} from '@opendata-ai/openchart-engine';\nexport type { BarListHandle, BarListProps } from './BarList';\nexport { BarList } from './BarList';\nexport type { ChartHandle, ChartProps, ObservationChartProps, SliceChartProps } from './Chart';\n// Components\nexport { Chart } from './Chart';\nexport type { ChartStoryHandle, ChartStoryProps } from './ChartStory';\n// Scrollytelling\nexport { ChartStory } from './ChartStory';\nexport type { DataTableProps } from './DataTable';\nexport { DataTable } from './DataTable';\nexport type { GeoMapHandle, GeoMapProps } from './GeoMap';\nexport { GeoMap } from './GeoMap';\nexport type { GraphProps } from './Graph';\nexport { Graph } from './Graph';\nexport type { UseChartOptions, UseChartReturn } from './hooks';\n// Hooks\nexport { useChart, useDarkMode } from './hooks';\nexport type { GraphHandle, UseGraphReturn } from './hooks/useGraph';\nexport { useGraph } from './hooks/useGraph';\nexport type { UseTableReturn } from './hooks/useTable';\nexport { useTable } from './hooks/useTable';\nexport type { UseTableStateOptions, UseTableStateReturn } from './hooks/useTableState';\nexport { useTableState } from './hooks/useTableState';\nexport type { RaceHandle, RaceProps } from './Race';\nexport { Race } from './Race';\nexport type { SankeyHandle, SankeyProps } from './Sankey';\nexport { Sankey } from './Sankey';\nexport type { VizThemeProviderProps } from './ThemeContext';\n// Theme context\nexport { useVizDarkMode, useVizTheme, VizThemeProvider } from './ThemeContext';\nexport type { TileMapHandle, TileMapProps } from './TileMap';\nexport { TileMap } from './TileMap';\nexport type { VisualizationProps } from './Visualization';\nexport { Visualization } from './Visualization';\n","/**\n * React BarList component: thin wrapper around the vanilla adapter.\n *\n * Mounts a barlist instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createBarList() function.\n */\n\nimport type { BarListSpec, DarkMode, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n type BarListInstance,\n type BarListMountOptions,\n createBarList,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface BarListProps {\n spec: BarListSpec;\n theme?: ThemeConfig;\n darkMode?: DarkMode;\n onRowClick?: (row: { label: string; value: number; data: Record<string, unknown> }) => void;\n onRowHover?: (\n row: {\n label: string;\n value: number;\n data: Record<string, unknown>;\n } | null,\n ) => void;\n className?: string;\n style?: CSSProperties;\n}\n\nexport interface BarListHandle {\n readonly instance: BarListInstance | null;\n}\n\nexport const BarList = /* @__PURE__ */ forwardRef<BarListHandle, BarListProps>(function BarList(\n { spec, theme: themeProp, darkMode, onRowClick, onRowHover, className, style },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<BarListInstance | null>(null);\n const specRef = useRef<string>('');\n\n const handlersRef = useRef<{\n onRowClick?: BarListProps['onRowClick'];\n onRowHover?: BarListProps['onRowHover'];\n }>({});\n handlersRef.current = { onRowClick, onRowHover };\n\n const stableOnRowClick = useCallback(\n (row: { label: string; value: number; data: Record<string, unknown> }) =>\n handlersRef.current.onRowClick?.(row),\n [],\n );\n const stableOnRowHover = useCallback(\n (row: { label: string; value: number; data: Record<string, unknown> } | null) =>\n handlersRef.current.onRowHover?.(row),\n [],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return instanceRef.current;\n },\n }),\n [],\n );\n\n // Mount barlist and recreate when theme/darkMode change.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: BarListMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onRowClick: stableOnRowClick,\n onRowHover: stableOnRowHover,\n autoResize: true,\n };\n\n instanceRef.current = createBarList(container, spec, options);\n specRef.current = JSON.stringify(spec);\n\n return () => {\n instanceRef.current?.destroy();\n instanceRef.current = null;\n };\n }, [theme, resolvedDarkMode, stableOnRowClick, stableOnRowHover]);\n\n // Update barlist when spec changes.\n useEffect(() => {\n const instance = instanceRef.current;\n if (!instance) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n\n specRef.current = specString;\n instance.update(spec);\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-barlist-root ${className}` : 'oc-barlist-root'}\n style={style}\n />\n );\n});\n","/**\n * Theme context: provides a theme and dark mode preference to all\n * descendant Chart, DataTable, and Graph components without prop drilling.\n *\n * Components deep-merge the provider theme with their theme prop.\n * An explicit `darkMode` prop wins over the provider preference.\n */\n\nimport type { DarkMode, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { createContext, type ReactNode, useContext } from 'react';\n\nconst VizThemeContext = /* @__PURE__ */ createContext<ThemeConfig | undefined>(undefined);\nconst VizDarkModeContext = /* @__PURE__ */ createContext<DarkMode | undefined>(undefined);\n\n/** Read the current theme from the nearest VizThemeProvider. */\nexport function useVizTheme(): ThemeConfig | undefined {\n return useContext(VizThemeContext);\n}\n\n/** Read the current dark mode preference from the nearest VizThemeProvider. */\nexport function useVizDarkMode(): DarkMode | undefined {\n return useContext(VizDarkModeContext);\n}\n\nexport interface VizThemeProviderProps {\n /** Theme config to provide to descendant viz components. */\n theme: ThemeConfig | undefined;\n /** Dark mode preference to provide to descendant viz components. */\n darkMode?: DarkMode;\n children: ReactNode;\n}\n\n/** Provides a theme and dark mode preference to all nested Chart, DataTable, and Graph components. */\nexport function VizThemeProvider({ theme, darkMode, children }: VizThemeProviderProps) {\n return (\n <VizThemeContext.Provider value={theme}>\n <VizDarkModeContext.Provider value={darkMode}>{children}</VizDarkModeContext.Provider>\n </VizThemeContext.Provider>\n );\n}\n","/**\n * React Chart component: thin wrapper around the vanilla adapter.\n *\n * Mounts a chart instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createChart() function.\n */\n// biome-ignore-all lint/correctness/useHookAtTopLevel: Biome doesn't recognize overloaded function declarations as React components; hooks are correctly at the top level of ChartInner\n\nimport type {\n AnnotationPlacementTool,\n ChartEventHandlers,\n ChartSpec,\n DarkMode,\n DataRow,\n ElementRef,\n LayerSpec,\n ReaderChangeMeta,\n ThemeConfig,\n} from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n type ChartInstance,\n type ChartReaderProps,\n type ChartReaderSelection,\n createChart,\n createChartReaderBinding,\n type InteractionMode,\n type MountOptions,\n resolveInteractionMode,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface ChartHandle {\n /** Get the currently selected element, or null if none. */\n getSelectedElement(): ElementRef | null;\n /** Programmatically select an element. */\n select(ref: ElementRef): void;\n /** Deselect the current element. */\n deselect(): void;\n /** The underlying chart instance (null until mounted). */\n readonly instance: ChartInstance | null;\n}\n\nexport interface ChartBaseProps<TData extends DataRow = DataRow> extends ChartEventHandlers {\n /** The chart spec to render. Graph specs render through `<Graph />` or `<Visualization />`. */\n spec: ChartSpec<TData> | LayerSpec<TData>;\n /**\n * Interaction mode: `'read'`, `'select'`, or `'edit'`. When omitted it is\n * inferred from the callbacks (`onEdit` -> edit, `onSelect`/`onDeselect` ->\n * select, otherwise read). Changes switch modes in place.\n */\n interaction?: InteractionMode;\n /** Selection outline color. Changing it recreates the chart. */\n selectionColor?: string;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /**\n * Rendering backend for point marks (mirrors vega-embed's `renderer`\n * option). `'auto'` (default) promotes dense scatters to canvas.\n */\n renderer?: 'auto' | 'svg' | 'canvas';\n /** Quiet row inspection for simple horizontal bars. */\n rowHover?: boolean;\n /** Observe container resizes. */\n autoResize?: boolean;\n /** The currently selected element (controlled). */\n selectedElement?: ElementRef;\n /** Highlight specific color-encoding values. Pass null to clear. */\n highlight?: string[] | null;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\nexport type ChartProps<TData extends DataRow = DataRow> = ChartBaseProps<TData> & ChartReaderProps;\nexport type SliceChartProps<TData extends DataRow = DataRow> = ChartBaseProps<TData> &\n Extract<ChartReaderProps, { reader: { mode: 'slices' } }>;\nexport type ObservationChartProps<TData extends DataRow = DataRow> = ChartBaseProps<TData> &\n Exclude<ChartReaderProps, { reader: { mode: 'slices' } }>;\n\n/**\n * React component that renders a visualization from a spec.\n *\n * Uses the vanilla adapter internally. The spec is compiled and rendered\n * as SVG inside a wrapper div. Spec changes trigger re-renders via the\n * vanilla adapter's update() method.\n *\n * Pass a typed data row as the generic to get field autocomplete:\n * ```tsx\n * type SalesRow = { date: string; revenue: number };\n * <Chart<SalesRow> spec={{ mark: 'line', data: rows, encoding: { x: { field: 'date', ... } } }} />\n * ```\n */\n// forwardRef doesn't support generics natively in TypeScript, so we use the\n// inner function + cast pattern to preserve the generic on the public API.\nfunction ChartInner<TData extends DataRow = DataRow>(\n props: ChartProps<TData> & React.RefAttributes<ChartHandle>,\n ref: React.Ref<ChartHandle>,\n): React.ReactElement | null;\nfunction ChartInner(\n props: ChartProps & { ref?: React.Ref<ChartHandle> },\n ref: React.Ref<ChartHandle>,\n): React.ReactElement | null;\nfunction ChartInner(\n {\n spec,\n reader,\n readerSelection,\n onReaderChange,\n theme: themeProp,\n darkMode,\n renderer,\n rowHover,\n autoResize,\n revision,\n onEdit,\n onMarkClick,\n onMarkHover,\n onMarkFocus,\n onMarkLeave,\n onLegendToggle,\n onHighlightChange,\n onAnnotationClick,\n onSelect,\n onDeselect,\n onReveal,\n onPlacementToolChange,\n interaction,\n selectionColor,\n selectedElement: selectedElementProp,\n highlight,\n className,\n style,\n }: ChartProps,\n ref: React.Ref<ChartHandle>,\n) {\n const mode = resolveInteractionMode({ interaction, onEdit, onSelect, onDeselect });\n const hasEditListener = Boolean(onEdit);\n const previousSelectedElement = useRef(selectedElementProp);\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const chartRef = useRef<ChartInstance | null>(null);\n const mountedAppearance = useRef({ theme, darkMode: resolvedDarkMode });\n const specRef = useRef<string>('');\n const readerBinding = useRef<ReturnType<typeof createChartReaderBinding> | null>(null);\n readerBinding.current ??= createChartReaderBinding();\n const readerConfig = useRef({ reader, readerSelection, onReaderChange });\n readerConfig.current = { reader, readerSelection, onReaderChange };\n const syncReader = () => {\n if (containerRef.current && chartRef.current) {\n const config = readerConfig.current;\n readerBinding.current!.sync(\n containerRef.current,\n chartRef.current,\n spec,\n config.reader,\n config.readerSelection,\n config.onReaderChange as\n | ((selection: ChartReaderSelection, meta: ReaderChangeMeta) => void)\n | undefined,\n );\n }\n };\n const revisionRef = useRef(revision);\n\n // Store event handlers in refs so they don't trigger chart recreation.\n // Inline arrow functions create new references every render, which would\n // destroy and recreate the entire chart instance without this pattern.\n const handlersRef = useRef<{\n onMarkClick?: ChartProps['onMarkClick'];\n onMarkHover?: ChartProps['onMarkHover'];\n onMarkFocus?: ChartProps['onMarkFocus'];\n onMarkLeave?: ChartProps['onMarkLeave'];\n onLegendToggle?: ChartProps['onLegendToggle'];\n onHighlightChange?: ChartProps['onHighlightChange'];\n onAnnotationClick?: ChartProps['onAnnotationClick'];\n onEdit?: ChartProps['onEdit'];\n onSelect?: ChartProps['onSelect'];\n onDeselect?: ChartProps['onDeselect'];\n onReveal?: ChartProps['onReveal'];\n onPlacementToolChange?: ChartProps['onPlacementToolChange'];\n }>({});\n handlersRef.current = {\n onEdit,\n onMarkClick,\n onMarkHover,\n onMarkFocus,\n onMarkLeave,\n onLegendToggle,\n onHighlightChange,\n onAnnotationClick,\n onSelect,\n onDeselect,\n onReveal,\n onPlacementToolChange,\n };\n\n // Stable callback wrappers that read from refs\n const stableOnMarkClick = useCallback(\n (event: import('@opendata-ai/openchart-core').MarkEvent) =>\n handlersRef.current.onMarkClick?.(event),\n [],\n );\n const stableOnMarkHover = useCallback(\n (event: import('@opendata-ai/openchart-core').MarkEvent) =>\n handlersRef.current.onMarkHover?.(event),\n [],\n );\n const stableOnMarkFocus = useCallback(\n (event: import('@opendata-ai/openchart-core').MarkFocusEvent) =>\n handlersRef.current.onMarkFocus?.(event),\n [],\n );\n const stableOnMarkLeave = useCallback(() => handlersRef.current.onMarkLeave?.(), []);\n const stableOnLegendToggle = useCallback(\n (series: string, visible: boolean) => handlersRef.current.onLegendToggle?.(series, visible),\n [],\n );\n const stableOnHighlightChange = useCallback(\n (values: string[]) => handlersRef.current.onHighlightChange?.(values),\n [],\n );\n const stableOnAnnotationClick = useCallback(\n (\n annotation: import('@opendata-ai/openchart-core').Annotation,\n event: MouseEvent,\n element: ElementRef,\n ) => handlersRef.current.onAnnotationClick?.(annotation, event, element),\n [],\n );\n const stableOnEdit = useCallback(\n (tx: import('@opendata-ai/openchart-core').EditTransaction) => handlersRef.current.onEdit?.(tx),\n [],\n );\n const stableOnSelect = useCallback(\n (element: ElementRef) => handlersRef.current.onSelect?.(element),\n [],\n );\n const stableOnDeselect = useCallback(\n (element: ElementRef) => handlersRef.current.onDeselect?.(element),\n [],\n );\n const stableOnReveal = useCallback(\n (guess: Array<{ x: string | number; y: number }>) => handlersRef.current.onReveal?.(guess),\n [],\n );\n const stableOnPlacementToolChange = useCallback(\n (tool: AnnotationPlacementTool | null) => handlersRef.current.onPlacementToolChange?.(tool),\n [],\n );\n\n // Expose imperative handle for ref-based control\n useImperativeHandle(\n ref,\n () => ({\n getSelectedElement() {\n return chartRef.current?.getSelectedElement() ?? null;\n },\n select(elementRef: ElementRef) {\n chartRef.current?.select(elementRef);\n },\n deselect() {\n chartRef.current?.deselect();\n },\n get instance() {\n return chartRef.current;\n },\n }),\n [],\n );\n\n // Mount chart and recreate when structural options change.\n // Event handlers use stable refs so they don't trigger recreation.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: MountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n renderer,\n selectionColor,\n onMarkClick: stableOnMarkClick,\n onMarkHover: stableOnMarkHover,\n onMarkFocus: stableOnMarkFocus,\n onMarkLeave: stableOnMarkLeave,\n onLegendToggle: stableOnLegendToggle,\n onHighlightChange: stableOnHighlightChange,\n onAnnotationClick: stableOnAnnotationClick,\n onSelect: stableOnSelect,\n onDeselect: stableOnDeselect,\n onPlacementToolChange: stableOnPlacementToolChange,\n ...(handlersRef.current.onReveal ? { onReveal: stableOnReveal } : {}),\n interaction: mode,\n ...(selectedElementProp ? { selectedElement: selectedElementProp } : {}),\n rowHover,\n autoResize,\n revision,\n onEdit: stableOnEdit,\n };\n\n chartRef.current = createChart(container, spec, options);\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n specRef.current = JSON.stringify(spec);\n syncReader();\n\n return () => {\n readerBinding.current?.detach();\n chartRef.current?.destroy();\n chartRef.current = null;\n };\n // Event handlers use stable refs.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n renderer,\n selectionColor,\n stableOnAnnotationClick,\n stableOnEdit,\n stableOnPlacementToolChange,\n rowHover,\n autoResize,\n stableOnLegendToggle,\n stableOnHighlightChange,\n stableOnMarkClick,\n stableOnMarkHover,\n stableOnMarkFocus,\n stableOnMarkLeave,\n stableOnSelect,\n stableOnDeselect,\n stableOnReveal,\n ]);\n\n useEffect(() => {\n const previous = mountedAppearance.current;\n if (previous.theme !== theme || previous.darkMode !== resolvedDarkMode) {\n chartRef.current?.setTheme({ theme, darkMode: resolvedDarkMode });\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n }\n }, [theme, resolvedDarkMode]);\n\n useEffect(() => {\n const chart = chartRef.current;\n if (chart && chart.getInteraction() !== mode) chart.setInteraction(mode);\n }, [mode]);\n\n useEffect(() => {\n if (mode === 'edit' && !hasEditListener) {\n console.warn(\n \"[openchart] interaction: 'edit' was set without an onEdit handler; edit gestures will run but their transactions have no sink.\",\n );\n }\n }, [mode, hasEditListener]);\n\n // Stable callbacks and host changes update only the reader controller.\n // biome-ignore lint/correctness/useExhaustiveDependencies: sync reads the current stable instance and callback ref\n useEffect(() => {\n syncReader();\n }, [reader, readerSelection, onReaderChange]);\n\n // Update chart when spec changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: sync reads current reader refs after the committed spec update\n useEffect(() => {\n const chart = chartRef.current;\n if (!chart) return;\n\n const specString = JSON.stringify(spec);\n if (specString !== specRef.current || revisionRef.current !== revision) {\n specRef.current = specString;\n const revisionChanged = revisionRef.current !== revision;\n revisionRef.current = revision;\n if (revision !== undefined || revisionChanged) chart.update(spec, { revision });\n else chart.update(spec);\n syncReader();\n }\n }, [spec, revision]);\n\n // Handle selectedElement prop changes separately (like Vue/Svelte adapters)\n useEffect(() => {\n const chart = chartRef.current;\n if (!chart || !chart.select) return;\n\n if (selectedElementProp) {\n if (mode !== 'read') chart.select(selectedElementProp);\n } else if (previousSelectedElement.current && chart.getSelectedElement?.()) {\n chart.deselect();\n }\n previousSelectedElement.current = selectedElementProp;\n }, [selectedElementProp, mode]);\n\n // Handle highlight prop changes\n useEffect(() => {\n if (chartRef.current && highlight !== undefined) {\n chartRef.current.setHighlight(highlight);\n }\n }, [highlight]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-chart-root ${className}` : 'oc-chart-root'}\n style={style}\n />\n );\n}\n\n/**\n * Generic Chart component with field autocomplete support.\n *\n * Pass your data row type to get compile-time field validation:\n * ```tsx\n * type SalesRow = { date: string; revenue: number; region: string };\n * <Chart<SalesRow> spec={{ mark: 'line', data: rows, encoding: { x: { field: 'date', type: 'temporal' } } }} />\n * ```\n *\n * Without a type parameter, behaves identically to before — no migration needed.\n */\nexport const Chart = /* @__PURE__ */ (() => {\n const component = forwardRef(ChartInner);\n component.displayName = 'Chart';\n return component;\n})() as {\n <TData extends DataRow = DataRow>(\n props: SliceChartProps<TData> & { ref?: React.Ref<ChartHandle> },\n ): React.ReactElement | null;\n <TData extends DataRow = DataRow>(\n props: ObservationChartProps<TData> & { ref?: React.Ref<ChartHandle> },\n ): React.ReactElement | null;\n};\n","/**\n * React scrollytelling shell around the vanilla `createChartStory`.\n *\n * The chart panel is sticky-pinned; the narrative column scrolls past it and\n * each step block advances the story. The heavy lifting (cumulative patch\n * application, mark morphing, crossfade fallback, camera) lives in the vanilla\n * story driver: this component owns only React lifecycle and the sticky layout.\n *\n * Self-driving by default (the vanilla `ScrollDriver` reads step positions),\n * or controlled by passing `step={n}` to drive it externally.\n */\n\nimport type { ChartSpec, DataRow, GeoMapSpec, LayerSpec } from '@opendata-ai/openchart-core';\nimport type { MountOptions } from '@opendata-ai/openchart-vanilla';\nimport {\n type ChartStoryInstance,\n type ChartStoryOptions,\n createChartStory,\n} from '@opendata-ai/openchart-vanilla/story';\nimport type { Ref } from 'react';\nimport { type CSSProperties, type ReactNode, useEffect, useImperativeHandle, useRef } from 'react';\n\nexport interface ChartStoryHandle {\n /** Jump the story to a step index (applies patches 0..n, animates the diff). */\n goTo(index: number): void;\n /** The underlying vanilla story instance, or null before mount. */\n readonly instance: ChartStoryInstance | null;\n}\n\nexport interface ChartStoryProps<TData extends DataRow = DataRow> {\n /** Base spec the story drives. */\n spec: ChartSpec<TData> | LayerSpec<TData> | GeoMapSpec;\n /** Ordered step patches. `steps[i]` is applied cumulatively onto the base. */\n steps: ChartStoryOptions<TData>['steps'];\n /**\n * Narrative content per step: `narrative[i]` renders in the scrolling column\n * beside the sticky chart and triggers step `i` when it crosses the trigger\n * line. Length should match `steps`.\n */\n narrative: ReactNode[];\n /**\n * Controlled step index. When provided, the built-in scroll driver is left\n * in place but `goTo` is called on change so an external scroller can drive.\n * Omit for self-driving scroll.\n */\n step?: number;\n /** Fraction of viewport height where the scroll trigger sits. Default 0.4. */\n triggerPosition?: number;\n /** Camera driving mode. Default 'step'. */\n cameraMode?: 'step' | 'scrub';\n /** Options forwarded to the underlying chart mount (theme, dark mode, etc.). */\n mountOptions?: MountOptions;\n /** Class on the outer section. */\n className?: string;\n /** Inline styles merged onto the outer section. */\n style?: CSSProperties;\n ref?: Ref<ChartStoryHandle>;\n}\n\nconst sectionStyle: CSSProperties = {\n position: 'relative',\n display: 'grid',\n gridTemplateColumns: 'minmax(0, 26rem) minmax(0, 1fr)',\n gap: '3rem',\n alignItems: 'start',\n};\n\nconst narrativeColumnStyle: CSSProperties = {\n position: 'relative',\n};\n\nconst stepStyle: CSSProperties = {\n minHeight: '80vh',\n display: 'flex',\n alignItems: 'center',\n};\n\nconst panelStyle: CSSProperties = {\n position: 'sticky',\n top: '2rem',\n height: 'calc(100vh - 4rem)',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst chartMountStyle: CSSProperties = {\n width: '100%',\n};\n\nexport function ChartStory<TData extends DataRow = DataRow>({\n spec,\n steps,\n narrative,\n step,\n triggerPosition,\n cameraMode,\n mountOptions,\n className,\n style,\n ref,\n}: ChartStoryProps<TData>) {\n const sectionRef = useRef<HTMLElement | null>(null);\n const chartMountRef = useRef<HTMLDivElement | null>(null);\n const stepRefs = useRef<Array<HTMLDivElement | null>>([]);\n const storyRef = useRef<ChartStoryInstance | null>(null);\n\n if (narrative.length !== steps.length) {\n console.warn(\n `[openchart] ChartStory: narrative length (${narrative.length}) does not match steps length (${steps.length}). Each step should have a corresponding narrative element.`,\n );\n }\n\n // Mount once; the vanilla driver owns updates so React never re-mounts on\n // spec/step churn (matching the <Chart /> imperative-update pattern).\n const optionsRef = useRef<{\n spec: typeof spec;\n steps: typeof steps;\n triggerPosition?: number;\n cameraMode?: 'step' | 'scrub';\n mountOptions?: MountOptions;\n }>({ spec, steps, triggerPosition, cameraMode, mountOptions });\n optionsRef.current = { spec, steps, triggerPosition, cameraMode, mountOptions };\n\n useEffect(() => {\n const mount = chartMountRef.current;\n const section = sectionRef.current;\n if (!mount) return;\n\n const opts = optionsRef.current;\n const story = createChartStory(\n mount,\n {\n spec: opts.spec,\n steps: opts.steps,\n triggerPosition: opts.triggerPosition,\n cameraMode: opts.cameraMode,\n },\n opts.mountOptions,\n );\n storyRef.current = story;\n\n if (section) story.setContainer(section);\n stepRefs.current.forEach((el, i) => {\n if (el) story.registerStep(i, el);\n });\n\n return () => {\n story.destroy();\n storyRef.current = null;\n };\n // Mount-once: options are read from the ref so changing them doesn't\n // remount. Spec/step diffing at runtime is out of scope for v1.\n }, []);\n\n // Controlled mode: drive the story when `step` changes.\n useEffect(() => {\n if (step === undefined) return;\n storyRef.current?.goTo(step);\n }, [step]);\n\n useImperativeHandle(\n ref,\n () => ({\n goTo(index: number) {\n storyRef.current?.goTo(index);\n },\n get instance() {\n return storyRef.current;\n },\n }),\n [],\n );\n\n return (\n <section ref={sectionRef} className={className} style={{ ...sectionStyle, ...style }}>\n <div style={narrativeColumnStyle}>\n {narrative.map((content, i) => (\n <div\n // biome-ignore lint/suspicious/noArrayIndexKey: steps are a fixed ordered list; index is the stable identity\n key={i}\n ref={(el) => {\n stepRefs.current[i] = el;\n }}\n data-oc-story-step={i}\n style={stepStyle}\n >\n <div style={{ maxWidth: '36rem' }}>{content}</div>\n </div>\n ))}\n </div>\n <div style={panelStyle}>\n <div ref={chartMountRef} style={chartMountStyle} />\n </div>\n </section>\n );\n}\n","/**\n * DataTable component: React wrapper around the vanilla table adapter.\n *\n * Mounts a table instance on render, updates when spec changes,\n * and cleans up on unmount. Supports both controlled and uncontrolled modes\n * for sort, search, and pagination state.\n */\n\nimport type { DarkMode, SortState, TableSpec, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createTable,\n type TableInstance,\n type TableMountOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport { type CSSProperties, useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface DataTableProps {\n /** The table spec to render. */\n spec: TableSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Row click handler. */\n onRowClick?: (row: Record<string, unknown>) => void;\n /** Callback when sort changes. */\n onSortChange?: (sort: SortState | null) => void;\n /** Callback when search changes. */\n onSearchChange?: (query: string) => void;\n /** Callback when page changes. */\n onPageChange?: (page: number) => void;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n /** Controlled sort state. */\n sort?: SortState | null;\n /** Controlled search query. */\n search?: string;\n /** Controlled page number. */\n page?: number;\n}\n\n/**\n * React component that renders a data table from a TableSpec.\n *\n * Uses the vanilla adapter internally. Supports controlled and uncontrolled\n * modes for sort, search, and pagination state.\n */\nexport function DataTable({\n spec,\n theme: themeProp,\n darkMode,\n onRowClick,\n onSortChange,\n onSearchChange,\n onPageChange,\n className,\n style,\n sort,\n search,\n page,\n}: DataTableProps) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const tableRef = useRef<TableInstance | null>(null);\n const mountedAppearance = useRef({ theme, darkMode: resolvedDarkMode });\n\n // Store event handlers in refs so they don't trigger table recreation.\n const handlersRef = useRef<{\n onRowClick?: DataTableProps['onRowClick'];\n onSortChange?: DataTableProps['onSortChange'];\n onSearchChange?: DataTableProps['onSearchChange'];\n onPageChange?: DataTableProps['onPageChange'];\n }>({});\n handlersRef.current = { onRowClick, onSortChange, onSearchChange, onPageChange };\n\n // Stable callback wrappers that read from refs\n const stableOnRowClick = useCallback(\n (row: Record<string, unknown>) => handlersRef.current.onRowClick?.(row),\n [],\n );\n const stableOnStateChange = useCallback(\n (state: { sort?: SortState | null; search?: string; page?: number }) => {\n if (state.sort !== undefined) handlersRef.current.onSortChange?.(state.sort);\n if (state.search !== undefined) handlersRef.current.onSearchChange?.(state.search);\n if (state.page !== undefined) handlersRef.current.onPageChange?.(state.page);\n },\n [],\n );\n\n const prevSpecRef = useRef<string>('');\n\n // Determine if we're in controlled mode\n const isControlled = sort !== undefined || search !== undefined || page !== undefined;\n\n // Effect 1: Mount/unmount. Only recreate when structural options change.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec, sort, search, page intentionally excluded - handled via update()/setState() in Effects 2-3\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const mountOptions: TableMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onRowClick: stableOnRowClick,\n autoResize: true,\n onStateChange: stableOnStateChange,\n };\n\n if (isControlled) {\n mountOptions.externalState = {\n sort: sort ?? null,\n search: search ?? '',\n page: page ?? 0,\n };\n }\n\n tableRef.current = createTable(container, spec, mountOptions);\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n prevSpecRef.current = JSON.stringify(spec);\n\n return () => {\n tableRef.current?.destroy();\n tableRef.current = null;\n };\n // Only recreate on structural option changes.\n // Controlled state updates are handled in Effect 2.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isControlled, stableOnRowClick, stableOnStateChange]);\n\n // Apply appearance changes to the mounted table.\n useEffect(() => {\n const previous = mountedAppearance.current;\n if (previous.theme !== theme || previous.darkMode !== resolvedDarkMode) {\n tableRef.current?.setTheme({ theme, darkMode: resolvedDarkMode });\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n }\n }, [theme, resolvedDarkMode]);\n\n // Effect 2: Sync controlled state without remounting.\n useEffect(() => {\n const table = tableRef.current;\n if (!table || !isControlled) return;\n\n table.setState({\n sort: sort ?? null,\n search: search ?? '',\n page: page ?? 0,\n });\n }, [sort, search, page, isControlled]);\n\n // Effect 3: Sync spec changes via update().\n useEffect(() => {\n const table = tableRef.current;\n if (!table) return;\n\n const specString = JSON.stringify(spec);\n if (specString !== prevSpecRef.current) {\n prevSpecRef.current = specString;\n table.update(spec);\n }\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-table-root ${className}` : 'oc-table-root'}\n style={style}\n />\n );\n}\n","/**\n * React Map component: thin wrapper around the vanilla adapter.\n *\n * Mounts a map instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createGeoMap() function.\n *\n * Supports forwardRef for imperative control via the instance getter.\n */\n\nimport type {\n DarkMode,\n GeoMapSpec,\n GeoReaderSelection,\n ReaderChangeMeta,\n ThemeConfig,\n} from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n type Camera,\n createGeoMap,\n createGeoReaderBinding,\n type GeoMapCameraChangeMeta,\n type GeoMapInstance,\n type GeoMapMarkEvent,\n type GeoMapMountOptions,\n type GeoReaderOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface GeoMapProps {\n reader?: false | GeoReaderOptions;\n readerSelection?: GeoReaderSelection;\n onReaderChange?: (selection: GeoReaderSelection, meta: ReaderChangeMeta) => void;\n labelInventory?: GeoMapMountOptions['labelInventory'];\n /** The map spec to render. */\n spec: GeoMapSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Callback when a map feature is clicked. */\n onMarkClick?: (feature: GeoMapMarkEvent) => void;\n /** Callback when a map feature is hovered (null when hover ends). */\n onMarkHover?: (feature: GeoMapMarkEvent | null) => void;\n /** Called whenever the camera moves (reader zoom/pan, zoomTo, focus). */\n onCameraChange?: (camera: Camera, meta?: GeoMapCameraChangeMeta) => void;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\nexport interface GeoMapHandle {\n /** The underlying map instance (null until mounted). */\n readonly instance: GeoMapInstance | null;\n}\n\nexport const GeoMap = /* @__PURE__ */ forwardRef<GeoMapHandle, GeoMapProps>(function GeoMap(\n {\n spec,\n reader,\n readerSelection,\n onReaderChange,\n theme: themeProp,\n darkMode,\n labelInventory,\n onMarkClick,\n onMarkHover,\n onCameraChange,\n className,\n style,\n },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<GeoMapInstance | null>(null);\n const mountedAppearance = useRef({ theme, darkMode: resolvedDarkMode });\n const specRef = useRef<string>('');\n const readerBinding = useRef<ReturnType<typeof createGeoReaderBinding> | null>(null);\n readerBinding.current ??= createGeoReaderBinding();\n const readerConfig = useRef({ reader, readerSelection, onReaderChange });\n readerConfig.current = { reader, readerSelection, onReaderChange };\n const syncReader = () => {\n if (containerRef.current && instanceRef.current) {\n const config = readerConfig.current;\n readerBinding.current!.sync(\n containerRef.current,\n instanceRef.current,\n spec,\n config.reader,\n config.readerSelection,\n config.onReaderChange,\n );\n }\n };\n\n const handlersRef = useRef<{\n onMarkClick?: GeoMapProps['onMarkClick'];\n onMarkHover?: GeoMapProps['onMarkHover'];\n onCameraChange?: GeoMapProps['onCameraChange'];\n }>({});\n handlersRef.current = {\n onMarkClick,\n onMarkHover,\n onCameraChange,\n };\n\n const stableOnMarkClick = useCallback(\n (feature: GeoMapMarkEvent) => handlersRef.current.onMarkClick?.(feature),\n [],\n );\n const stableOnMarkHover = useCallback(\n (feature: GeoMapMarkEvent | null) => handlersRef.current.onMarkHover?.(feature),\n [],\n );\n const stableOnCameraChange = useCallback(\n (camera: Camera, meta?: GeoMapCameraChangeMeta) =>\n meta\n ? handlersRef.current.onCameraChange?.(camera, meta)\n : handlersRef.current.onCameraChange?.(camera),\n [],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return instanceRef.current;\n },\n }),\n [],\n );\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: GeoMapMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onMarkClick: stableOnMarkClick,\n onMarkHover: stableOnMarkHover,\n onCameraChange: stableOnCameraChange,\n autoResize: true,\n };\n\n instanceRef.current = createGeoMap(container, spec, options);\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n specRef.current = JSON.stringify(spec);\n syncReader();\n\n return () => {\n readerBinding.current?.detach();\n instanceRef.current?.destroy();\n instanceRef.current = null;\n };\n }, [stableOnMarkClick, stableOnMarkHover, stableOnCameraChange]);\n\n useEffect(() => {\n const previous = mountedAppearance.current;\n if (previous.theme !== theme || previous.darkMode !== resolvedDarkMode) {\n instanceRef.current?.setTheme({ theme, darkMode: resolvedDarkMode });\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n }\n }, [theme, resolvedDarkMode]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: sync reads current reader refs after the committed spec update\n useEffect(() => {\n const instance = instanceRef.current;\n if (!instance) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n\n specRef.current = specString;\n instance.update(spec);\n syncReader();\n }, [spec]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: reapply the host after theme-driven instance recreation\n useEffect(() => {\n instanceRef.current?.setLabelInventory(labelInventory);\n }, [labelInventory, theme, resolvedDarkMode]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: sync uses stable instance and callback refs\n useEffect(() => {\n syncReader();\n }, [reader, readerSelection, onReaderChange]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-map-root ${className}` : 'oc-map-root'}\n style={style}\n />\n );\n});\n","/**\n * React Graph component: thin wrapper around the vanilla adapter.\n *\n * Mounts a graph instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createGraph() function.\n *\n * Supports forwardRef for imperative control via useGraph() hook.\n */\n\nimport type { DarkMode, GraphSpec, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createGraph,\n type GraphCamera,\n type GraphInstance,\n type GraphMountOptions,\n type GraphTooltipFormatter,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport type { GraphHandle } from './hooks/useGraph';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\n/** Tooltip prop: `false` off, `true` default, or an object with a formatter. */\nexport type GraphTooltipProp = boolean | { formatter?: GraphTooltipFormatter };\n/** Legend prop: `false` off, `true` default, or an object toggling interactivity/counts. */\nexport type GraphLegendProp = boolean | { interactive?: boolean; counts?: boolean };\n\nexport interface GraphProps {\n /** The graph spec to render. */\n spec: GraphSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Callback when a node is clicked. */\n onNodeClick?: (node: Record<string, unknown>) => void;\n /** Callback when a node is double-clicked. */\n onNodeDoubleClick?: (node: Record<string, unknown>) => void;\n /** Callback when a node is hovered (null when hover ends). */\n onNodeHover?: (node: Record<string, unknown> | null) => void;\n /** Callback when an edge is hovered (null when hover ends). */\n onEdgeHover?: (edge: Record<string, unknown> | null) => void;\n /** Callback when selection changes. */\n onSelectionChange?: (nodeIds: string[]) => void;\n /** Fired when the user hovers a legend entry (null on leave). */\n onLegendHover?: (entry: { field: string; value: string } | null) => void;\n /** Fired when legend toggle state changes; `activeValues` is the active set (empty = all). */\n onLegendToggle?: (activeValues: string[]) => void;\n /** Fired whenever the highlight set changes (programmatic or legend), null when cleared. */\n onHighlightChange?: (nodeIds: string[] | null) => void;\n /** Camera change callback, rAF-coalesced (fires at most once per rendered frame). */\n onCameraChange?: (camera: GraphCamera) => void;\n /**\n * Show built-in tooltip on node/edge hover. Defaults to true. Pass an object\n * with a `formatter` to customize content.\n */\n tooltip?: GraphTooltipProp;\n /**\n * Show built-in legend. Defaults to true. Pass `false` if you render your own,\n * or an object to toggle interactivity/counts.\n */\n legend?: GraphLegendProp;\n /** Fit the graph to the viewport on the first tick. Default true. */\n fitOnLoad?: boolean;\n /** How much closer than the fit the opening camera sits: a multiplier on the fit (2 = twice as close), not an absolute zoom level. Default 1. Read once at mount; `zoomToFit()` still frames the whole graph. */\n initialZoom?: number;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\n/** Structural (serializable) tooltip shape that participates in the mount dep key. */\nfunction tooltipStructural(tooltip: GraphTooltipProp | undefined): boolean {\n // Only the on/off decision is structural; the formatter is a function carried\n // by the ref-trampoline, never pinned in the dep array (avoids stale closures).\n if (tooltip === false) return false;\n return true;\n}\n\n/** Structural (serializable) legend shape that participates in the mount dep key. */\nfunction legendStructural(legend: GraphLegendProp | undefined): string {\n if (legend === false) return 'false';\n if (legend === true || legend === undefined) return 'true';\n return JSON.stringify({ interactive: legend.interactive, counts: legend.counts });\n}\n\n/**\n * React component that renders a force-directed graph from a GraphSpec.\n *\n * Uses the vanilla adapter internally. The spec is compiled and rendered\n * on a canvas inside a wrapper div. Spec changes trigger re-renders via the\n * vanilla adapter's update() method.\n *\n * Supports ref for imperative control via useGraph() hook:\n * ```tsx\n * const { ref, search, zoomToFit } = useGraph();\n * return <Graph ref={ref} spec={spec} />;\n * ```\n */\nexport const Graph = /* @__PURE__ */ forwardRef<GraphHandle, GraphProps>(function Graph(\n {\n spec,\n theme: themeProp,\n darkMode,\n onNodeClick,\n onNodeDoubleClick,\n onNodeHover,\n onEdgeHover,\n onSelectionChange,\n onLegendHover,\n onLegendToggle,\n onHighlightChange,\n onCameraChange,\n tooltip,\n legend,\n fitOnLoad,\n initialZoom,\n className,\n style,\n },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const graphRef = useRef<GraphInstance | null>(null);\n const specRef = useRef<string>('');\n // Deps of the previous mount-effect run. A recreation with CHANGED deps\n // (theme/darkMode/structural-tooltip/legend — all spec-unchanged) suppresses\n // the entrance; identical deps mean a StrictMode dev replay of the same\n // mount, which must still play the entrance. A survives-cleanup boolean ref\n // can't tell those apart — it would suppress the entrance in every\n // StrictMode app.\n const prevMountDepsRef = useRef<unknown[] | null>(null);\n // Whether the last destroyed instance's entrance played. A recreation only\n // suppresses the entrance when it did: one still waiting to be seen replays.\n const prevEntrancePlayedRef = useRef(false);\n\n // Store event handlers AND function-valued options in refs so they don't\n // trigger graph recreation. Inline functions create new references every\n // render, which would either destroy+recreate the graph (if pinned in the dep\n // array) or go stale (if read once at mount). The trampoline gives us stable\n // wrappers whose bodies read the LATEST handler on every call.\n const handlersRef = useRef<{\n onNodeClick?: GraphProps['onNodeClick'];\n onNodeDoubleClick?: GraphProps['onNodeDoubleClick'];\n onNodeHover?: GraphProps['onNodeHover'];\n onEdgeHover?: GraphProps['onEdgeHover'];\n onSelectionChange?: GraphProps['onSelectionChange'];\n onLegendHover?: GraphProps['onLegendHover'];\n onLegendToggle?: GraphProps['onLegendToggle'];\n onHighlightChange?: GraphProps['onHighlightChange'];\n onCameraChange?: GraphProps['onCameraChange'];\n tooltipFormatter?: GraphTooltipFormatter;\n }>({});\n handlersRef.current = {\n onNodeClick,\n onNodeDoubleClick,\n onNodeHover,\n onEdgeHover,\n onSelectionChange,\n onLegendHover,\n onLegendToggle,\n onHighlightChange,\n onCameraChange,\n tooltipFormatter: typeof tooltip === 'object' ? tooltip.formatter : undefined,\n };\n\n // Stable callback wrappers that read from refs\n const stableOnNodeClick = useCallback(\n (node: Record<string, unknown>) => handlersRef.current.onNodeClick?.(node),\n [],\n );\n const stableOnNodeDoubleClick = useCallback(\n (node: Record<string, unknown>) => handlersRef.current.onNodeDoubleClick?.(node),\n [],\n );\n const stableOnNodeHover = useCallback(\n (node: Record<string, unknown> | null) => handlersRef.current.onNodeHover?.(node),\n [],\n );\n const stableOnEdgeHover = useCallback(\n (edge: Record<string, unknown> | null) => handlersRef.current.onEdgeHover?.(edge),\n [],\n );\n const stableOnSelectionChange = useCallback(\n (nodeIds: string[]) => handlersRef.current.onSelectionChange?.(nodeIds),\n [],\n );\n const stableOnLegendHover = useCallback(\n (entry: { field: string; value: string } | null) => handlersRef.current.onLegendHover?.(entry),\n [],\n );\n const stableOnLegendToggle = useCallback(\n (activeValues: string[]) => handlersRef.current.onLegendToggle?.(activeValues),\n [],\n );\n const stableOnHighlightChange = useCallback(\n (nodeIds: string[] | null) => handlersRef.current.onHighlightChange?.(nodeIds),\n [],\n );\n const stableOnCameraChange = useCallback(\n (camera: GraphCamera) => handlersRef.current.onCameraChange?.(camera),\n [],\n );\n // A stable formatter wrapper: it always calls the LATEST formatter off the ref.\n // The tooltip mount option carries this wrapper, never the raw prop function, so\n // the formatter can't go stale and can't force graph recreation.\n const stableTooltipFormatter = useCallback<GraphTooltipFormatter>(\n (item, defaults) => handlersRef.current.tooltipFormatter?.(item, defaults) ?? defaults,\n [],\n );\n\n // Expose imperative handle for useGraph() hook. Every method forwards opts to\n // the underlying instance so consumers get the full vanilla API surface.\n useImperativeHandle(\n ref,\n () => ({\n search(query) {\n graphRef.current?.search(query);\n },\n clearSearch() {\n graphRef.current?.clearSearch();\n },\n getSearchMatches() {\n return graphRef.current?.getSearchMatches() ?? [];\n },\n zoomToFit(opts) {\n graphRef.current?.zoomToFit(opts);\n },\n zoomToNode(nodeId, opts) {\n graphRef.current?.zoomToNode(nodeId, opts);\n },\n flyTo(target, opts) {\n graphRef.current?.flyTo(target, opts);\n },\n centerAt(x, y, opts) {\n graphRef.current?.centerAt(x, y, opts);\n },\n getCamera() {\n return graphRef.current?.getCamera() ?? { x: 0, y: 0, k: 1 };\n },\n selectNode(nodeId, opts) {\n graphRef.current?.selectNode(nodeId, opts);\n },\n getSelectedNodes() {\n return graphRef.current?.getSelectedNodes() ?? [];\n },\n highlight(target, opts) {\n graphRef.current?.highlight(target, opts);\n },\n clearHighlight() {\n graphRef.current?.clearHighlight();\n },\n getHighlight() {\n return graphRef.current?.getHighlight() ?? null;\n },\n getLegend() {\n return graphRef.current?.getLegend() ?? null;\n },\n setActiveCategories(values: string[]) {\n graphRef.current?.setActiveCategories(values);\n },\n getActiveCategories() {\n return graphRef.current?.getActiveCategories() ?? [];\n },\n update(spec: GraphSpec) {\n graphRef.current?.update(spec);\n },\n get instance() {\n return graphRef.current;\n },\n }),\n [],\n );\n\n // Structural-only parts of tooltip/legend that gate recreation. The tooltip\n // formatter (a function) is deliberately excluded — it rides the trampoline.\n const tooltipOn = tooltipStructural(tooltip);\n const legendKey = legendStructural(legend);\n // 2D and 3D are different renderers chosen once, at mount, so a dimension\n // change is a remount. It is deliberately NOT in `mountDeps`: the new\n // renderer should play its entrance rather than suppress it.\n const dimensions = spec.dimensions ?? 2;\n\n // Mount graph and recreate when theme/darkMode/structural options change.\n // Event handlers and the tooltip formatter use stable refs so they don't\n // trigger recreation.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n // Rebuild the tooltip option: keep the boolean/off decision, but always pass\n // the stable formatter wrapper when tooltips are on (so a formatter can be\n // added/changed per-render without recreating the graph).\n const tooltipOption: GraphMountOptions['tooltip'] = tooltipOn\n ? { formatter: stableTooltipFormatter }\n : false;\n\n // Suppress the entrance only when a PREVIOUS mount existed, played its\n // entrance, and a dep actually changed (theme/darkMode/structural option —\n // spec unchanged). Identical deps = StrictMode's dev remount of the same\n // graph: play it.\n const mountDeps: unknown[] = [theme, resolvedDarkMode, tooltipOn, legendKey, fitOnLoad];\n const prevDeps = prevMountDepsRef.current;\n const suppressEntrance =\n prevDeps !== null &&\n prevEntrancePlayedRef.current &&\n mountDeps.some((d, i) => !Object.is(d, prevDeps[i]));\n\n const options: GraphMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n tooltip: tooltipOption,\n legend,\n fitOnLoad,\n // Only the opening camera reads it, so it is not a mount dep.\n initialZoom,\n onNodeClick: stableOnNodeClick,\n onNodeDoubleClick: stableOnNodeDoubleClick,\n onNodeHover: stableOnNodeHover,\n onEdgeHover: stableOnEdgeHover,\n onSelectionChange: stableOnSelectionChange,\n onLegendHover: stableOnLegendHover,\n onLegendToggle: stableOnLegendToggle,\n onHighlightChange: stableOnHighlightChange,\n onCameraChange: stableOnCameraChange,\n autoResize: true,\n suppressEntrance,\n };\n\n graphRef.current = createGraph(container, spec, options);\n specRef.current = JSON.stringify(spec);\n prevMountDepsRef.current = mountDeps;\n\n return () => {\n prevEntrancePlayedRef.current = graphRef.current?.entrancePlayed ?? false;\n graphRef.current?.destroy();\n graphRef.current = null;\n };\n // Only recreate when theme/darkMode/structural options change. Event handlers\n // and the tooltip formatter use stable refs.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n theme,\n resolvedDarkMode,\n tooltipOn,\n legendKey,\n fitOnLoad,\n stableOnNodeClick,\n stableOnNodeDoubleClick,\n stableOnNodeHover,\n stableOnEdgeHover,\n stableOnSelectionChange,\n stableOnLegendHover,\n stableOnLegendToggle,\n stableOnHighlightChange,\n stableOnCameraChange,\n stableTooltipFormatter,\n dimensions,\n ]);\n\n // Update the graph when the spec changes. `update()` diffs prev↔next itself:\n // a visual-only change (same node/edge ids + same physics) preserves positions\n // without restarting the sim; anything structural reheats with a local impulse.\n useEffect(() => {\n const graph = graphRef.current;\n if (!graph) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n specRef.current = specString;\n\n // `update` diffs internally: same node/edge ids + same physics take the\n // position-preserving path, anything structural reheats. No wrapper-side\n // heuristic needed (the old JSON-diff silently ignored physics changes).\n graph.update(spec);\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-graph-root ${className}` : 'oc-graph-root'}\n style={style}\n />\n );\n});\n","/**\n * React hooks for chart lifecycle and dark mode resolution.\n *\n * useChart: manual control over a chart instance (for advanced usage).\n * useDarkMode: resolves the DarkMode preference to a boolean.\n */\n\nimport type { ChartLayout, ChartSpec, DarkMode, LayerSpec } from '@opendata-ai/openchart-core';\nimport { type ChartInstance, createChart, type MountOptions } from '@opendata-ai/openchart-vanilla';\nimport { useEffect, useRef, useState } from 'react';\n\n// ---------------------------------------------------------------------------\n// useChart\n// ---------------------------------------------------------------------------\n\nexport interface UseChartOptions {\n /** Theme overrides. */\n theme?: MountOptions['theme'];\n /** Dark mode setting. */\n darkMode?: MountOptions['darkMode'];\n /** Observe container resizes. Defaults to true. */\n autoResize?: boolean;\n /** Rendering backend for point marks; see the vanilla `MountOptions.renderer`. */\n renderer?: MountOptions['renderer'];\n}\n\nexport interface UseChartReturn {\n /** Ref to attach to the container div. */\n ref: React.RefObject<HTMLDivElement | null>;\n /** The chart instance (null until mounted). */\n chart: ChartInstance | null;\n /** The current compiled layout (null until mounted). */\n layout: ChartLayout | null;\n}\n\n/**\n * Hook for manual chart lifecycle control.\n *\n * Attach the returned ref to a container div. The chart mounts\n * automatically and updates when the spec changes.\n *\n * @param spec - The visualization spec.\n * @param options - Mount options.\n * @returns { ref, chart, layout }\n */\nexport function useChart(spec: ChartSpec | LayerSpec, options?: UseChartOptions): UseChartReturn {\n const ref = useRef<HTMLDivElement | null>(null);\n const chartRef = useRef<ChartInstance | null>(null);\n const [layout, setLayout] = useState<ChartLayout | null>(null);\n const specRef = useRef<string>('');\n\n // Mount / unmount\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in the update effect\n useEffect(() => {\n const container = ref.current;\n if (!container) return;\n\n const mountOpts: MountOptions = {\n theme: options?.theme,\n darkMode: options?.darkMode,\n autoResize: options?.autoResize,\n renderer: options?.renderer,\n };\n\n const chart = createChart(container, spec, mountOpts);\n chartRef.current = chart;\n setLayout(chart.layout);\n specRef.current = JSON.stringify(spec);\n\n return () => {\n chart.destroy();\n chartRef.current = null;\n setLayout(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options?.theme, options?.darkMode, options?.autoResize, options?.renderer]);\n\n // Update on spec change\n useEffect(() => {\n const chart = chartRef.current;\n if (!chart) return;\n\n const specString = JSON.stringify(spec);\n if (specString !== specRef.current) {\n specRef.current = specString;\n chart.update(spec);\n setLayout(chart.layout);\n }\n }, [spec]);\n\n return {\n ref,\n chart: chartRef.current,\n layout,\n };\n}\n\n// ---------------------------------------------------------------------------\n// useDarkMode\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve a DarkMode preference to a boolean.\n *\n * - \"force\" -> true\n * - \"off\" -> false\n * - \"auto\" -> matches system preference (reactive to changes)\n *\n * @param mode - The dark mode preference.\n * @returns Whether dark mode is active.\n */\nexport function useDarkMode(mode?: DarkMode): boolean {\n const [isDark, setIsDark] = useState(() => resolveInitial(mode));\n\n useEffect(() => {\n if (mode !== 'auto') {\n setIsDark(mode === 'force');\n return;\n }\n\n if (typeof window === 'undefined' || !window.matchMedia) {\n setIsDark(false);\n return;\n }\n\n const mq = window.matchMedia('(prefers-color-scheme: dark)');\n setIsDark(mq.matches);\n\n const handler = (e: MediaQueryListEvent) => setIsDark(e.matches);\n mq.addEventListener('change', handler);\n return () => mq.removeEventListener('change', handler);\n }, [mode]);\n\n return isDark;\n}\n\nfunction resolveInitial(mode?: DarkMode): boolean {\n if (mode === 'force') return true;\n if (mode === 'off' || mode === undefined) return false;\n // \"auto\"\n if (typeof window !== 'undefined' && window.matchMedia) {\n return window.matchMedia('(prefers-color-scheme: dark)').matches;\n }\n return false;\n}\n","/**\n * useGraph: hook for imperative graph control.\n *\n * Provides a ref to pass to <Graph /> and exposes graph methods\n * (search, zoom, select, fly, highlight) for programmatic control of the\n * graph instance. The full vanilla GraphInstance API is threaded through.\n */\n\nimport type { GraphSpec } from '@opendata-ai/openchart-core';\nimport type {\n CameraFlightOptions,\n GraphCamera,\n GraphFlyTarget,\n GraphHighlightTarget,\n GraphInstance,\n GraphLegendData,\n} from '@opendata-ai/openchart-vanilla';\nimport { useCallback, useRef } from 'react';\n\n// Re-exported rather than redeclared so the 3D pose fields (`position`,\n// `target`) stay visible to typed consumers of the React wrapper.\nexport type { GraphCamera, GraphFlyTarget } from '@opendata-ai/openchart-vanilla';\n\nexport interface UseGraphReturn {\n /** Ref to pass to <Graph ref={ref} />. */\n ref: React.RefObject<GraphHandle | null>;\n /** Search for nodes matching a query string. */\n search: (query: string) => void;\n /** Clear the current search. */\n clearSearch: () => void;\n /** Node ids currently matching the active search query. */\n getSearchMatches: () => string[];\n /** Zoom to fit all nodes in view. Animated by default; `{ duration: 0 }` snaps. */\n zoomToFit: (opts?: CameraFlightOptions & { padding?: number }) => void;\n /** Fly to a node and zoom in (default scale 2). */\n zoomToNode: (nodeId: string, opts?: CameraFlightOptions & { scale?: number }) => void;\n /** Fly the camera to a graph-space target. */\n flyTo: (target: GraphFlyTarget, opts?: CameraFlightOptions) => void;\n /** Center the camera on a graph-space point (keeps current zoom). */\n centerAt: (x: number, y: number, opts?: CameraFlightOptions) => void;\n /** Current camera transform. */\n getCamera: () => GraphCamera;\n /** Select a node by id; `{ fly: true }` also flies to it. */\n selectNode: (nodeId: string, opts?: { fly?: boolean } & CameraFlightOptions) => void;\n /** Get the currently selected node ids. */\n getSelectedNodes: () => string[];\n /**\n * Emphasize a set of nodes; eased via the focus model. Layers over the\n * standing category filter rather than replacing it.\n */\n highlight: (target: GraphHighlightTarget, opts?: { dimOpacity?: number }) => void;\n /**\n * Clear the transient highlight, returning to the standing category filter.\n * Does NOT clear that filter — use `setActiveCategories([])`.\n */\n clearHighlight: () => void;\n /** The effective highlighted node ids, or null when nothing is highlighted. */\n getHighlight: () => string[] | null;\n /** Headless snapshot of the legend. */\n getLegend: () => GraphLegendData | null;\n /** Set the active category filter declaratively (replaces legend toggle state). */\n setActiveCategories: (values: string[]) => void;\n /** Current active category values (empty = all active, no filter). */\n getActiveCategories: () => string[];\n}\n\n/** Handle exposed by Graph component via forwardRef. */\nexport interface GraphHandle {\n search: (query: string) => void;\n clearSearch: () => void;\n getSearchMatches: () => string[];\n zoomToFit: (opts?: CameraFlightOptions & { padding?: number }) => void;\n zoomToNode: (nodeId: string, opts?: CameraFlightOptions & { scale?: number }) => void;\n flyTo: (target: GraphFlyTarget, opts?: CameraFlightOptions) => void;\n centerAt: (x: number, y: number, opts?: CameraFlightOptions) => void;\n getCamera: () => GraphCamera;\n selectNode: (nodeId: string, opts?: { fly?: boolean } & CameraFlightOptions) => void;\n getSelectedNodes: () => string[];\n highlight: (target: GraphHighlightTarget, opts?: { dimOpacity?: number }) => void;\n clearHighlight: () => void;\n getHighlight: () => string[] | null;\n getLegend: () => GraphLegendData | null;\n setActiveCategories: (values: string[]) => void;\n getActiveCategories: () => string[];\n /** Update graph data, encoding, or presentation through the unified update path. */\n update: (spec: GraphSpec) => void;\n /** The underlying GraphInstance from the vanilla adapter. */\n instance: GraphInstance | null;\n}\n\n/**\n * Hook for imperative graph control.\n *\n * Usage:\n * ```tsx\n * const { ref, search, zoomToFit } = useGraph();\n * return <Graph ref={ref} spec={spec} />;\n * ```\n */\nexport function useGraph(): UseGraphReturn {\n const ref = useRef<GraphHandle | null>(null);\n\n const search = useCallback((query: string) => {\n ref.current?.search(query);\n }, []);\n\n const clearSearch = useCallback(() => {\n ref.current?.clearSearch();\n }, []);\n\n const getSearchMatches = useCallback((): string[] => {\n return ref.current?.getSearchMatches() ?? [];\n }, []);\n\n const zoomToFit = useCallback((opts?: CameraFlightOptions & { padding?: number }) => {\n ref.current?.zoomToFit(opts);\n }, []);\n\n const zoomToNode = useCallback(\n (nodeId: string, opts?: CameraFlightOptions & { scale?: number }) => {\n ref.current?.zoomToNode(nodeId, opts);\n },\n [],\n );\n\n const flyTo = useCallback((target: GraphFlyTarget, opts?: CameraFlightOptions) => {\n ref.current?.flyTo(target, opts);\n }, []);\n\n const centerAt = useCallback((x: number, y: number, opts?: CameraFlightOptions) => {\n ref.current?.centerAt(x, y, opts);\n }, []);\n\n const getCamera = useCallback((): GraphCamera => {\n return ref.current?.getCamera() ?? { x: 0, y: 0, k: 1 };\n }, []);\n\n const selectNode = useCallback(\n (nodeId: string, opts?: { fly?: boolean } & CameraFlightOptions) => {\n ref.current?.selectNode(nodeId, opts);\n },\n [],\n );\n\n const getSelectedNodes = useCallback((): string[] => {\n return ref.current?.getSelectedNodes() ?? [];\n }, []);\n\n const highlight = useCallback((target: GraphHighlightTarget, opts?: { dimOpacity?: number }) => {\n ref.current?.highlight(target, opts);\n }, []);\n\n const clearHighlight = useCallback(() => {\n ref.current?.clearHighlight();\n }, []);\n\n const getHighlight = useCallback((): string[] | null => {\n return ref.current?.getHighlight() ?? null;\n }, []);\n\n const getLegend = useCallback((): GraphLegendData | null => {\n return ref.current?.getLegend() ?? null;\n }, []);\n\n const setActiveCategories = useCallback((values: string[]) => {\n ref.current?.setActiveCategories(values);\n }, []);\n\n const getActiveCategories = useCallback((): string[] => {\n return ref.current?.getActiveCategories() ?? [];\n }, []);\n\n return {\n ref,\n search,\n clearSearch,\n getSearchMatches,\n zoomToFit,\n zoomToNode,\n flyTo,\n centerAt,\n getCamera,\n selectNode,\n getSelectedNodes,\n highlight,\n clearHighlight,\n getHighlight,\n getLegend,\n setActiveCategories,\n getActiveCategories,\n };\n}\n","/**\n * useTable: hook for manual table lifecycle control.\n *\n * Attaches to a container ref, mounts a vanilla table instance,\n * and exposes the instance and current state.\n */\n\nimport type { TableSpec } from '@opendata-ai/openchart-core';\nimport {\n createTable,\n type TableInstance,\n type TableMountOptions,\n type TableState,\n} from '@opendata-ai/openchart-vanilla';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nexport interface UseTableReturn {\n /** Ref to attach to the container div. */\n ref: React.RefObject<HTMLDivElement | null>;\n /** The table instance (null until mounted). */\n table: TableInstance | null;\n /** The current table state (sort, search, page). */\n state: TableState;\n}\n\n/**\n * Hook for manual table lifecycle control.\n *\n * Attach the returned ref to a container div. The table mounts\n * automatically and updates when the spec changes.\n *\n * @param spec - The table spec.\n * @param options - Mount options.\n * @returns { ref, table, state }\n */\nexport function useTable(spec: TableSpec, options?: TableMountOptions): UseTableReturn {\n const ref = useRef<HTMLDivElement | null>(null);\n const tableRef = useRef<TableInstance | null>(null);\n const [state, setState] = useState<TableState>({\n sort: null,\n search: '',\n page: 0,\n });\n\n const originalOnStateChange = options?.onStateChange;\n\n const handleStateChange = useCallback(\n (newState: TableState) => {\n setState(newState);\n originalOnStateChange?.(newState);\n },\n [originalOnStateChange],\n );\n\n // Mount / unmount\n useEffect(() => {\n const container = ref.current;\n if (!container) return;\n\n const mountOpts: TableMountOptions = {\n ...options,\n onStateChange: handleStateChange,\n };\n\n const table = createTable(container, spec, mountOpts);\n tableRef.current = table;\n setState(table.getState());\n\n return () => {\n table.destroy();\n tableRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n options?.theme,\n options?.darkMode,\n options?.onRowClick,\n options?.autoResize,\n handleStateChange,\n options,\n spec,\n ]);\n\n // Update on spec change\n useEffect(() => {\n const table = tableRef.current;\n if (!table) return;\n\n table.update(spec);\n setState(table.getState());\n }, [spec]);\n\n return {\n ref,\n table: tableRef.current,\n state,\n };\n}\n","/**\n * useTableState: managed state hook for controlled table usage.\n *\n * Provides individual sort/search/page state with setters and a\n * resetState function to return to initial values.\n */\n\nimport type { SortState } from '@opendata-ai/openchart-core';\nimport { useCallback, useState } from 'react';\n\nexport interface UseTableStateReturn {\n sort: SortState | null;\n setSort: (sort: SortState | null) => void;\n search: string;\n setSearch: (query: string) => void;\n page: number;\n setPage: (page: number) => void;\n resetState: () => void;\n}\n\nexport interface UseTableStateOptions {\n sort?: SortState | null;\n search?: string;\n page?: number;\n}\n\n/**\n * Hook for managing table state (sort, search, page).\n *\n * Use with the DataTable component's controlled props:\n * ```tsx\n * const { sort, search, page, setSort, setSearch, setPage } = useTableState();\n * <DataTable\n * spec={spec}\n * sort={sort}\n * search={search}\n * page={page}\n * onSortChange={setSort}\n * onSearchChange={setSearch}\n * onPageChange={setPage}\n * />\n * ```\n */\nexport function useTableState(initialState?: UseTableStateOptions): UseTableStateReturn {\n const [sort, setSortInternal] = useState<SortState | null>(initialState?.sort ?? null);\n const [search, setSearchInternal] = useState(initialState?.search ?? '');\n const [page, setPageInternal] = useState(initialState?.page ?? 0);\n\n const setSort = useCallback((newSort: SortState | null) => {\n setSortInternal(newSort);\n }, []);\n\n const setSearch = useCallback((query: string) => {\n setSearchInternal(query);\n }, []);\n\n const setPage = useCallback((newPage: number) => {\n setPageInternal(newPage);\n }, []);\n\n const resetState = useCallback(() => {\n setSortInternal(initialState?.sort ?? null);\n setSearchInternal(initialState?.search ?? '');\n setPageInternal(initialState?.page ?? 0);\n }, [initialState?.sort, initialState?.search, initialState?.page]);\n\n return {\n sort,\n setSort,\n search,\n setSearch,\n page,\n setPage,\n resetState,\n };\n}\n","import type { DarkMode, RaceFrame, RaceSpec, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createRace,\n type RaceInstance,\n type RaceMountOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\n/** Options and callbacks for a mounted race chart. */\nexport interface RaceProps {\n spec: RaceSpec;\n theme?: ThemeConfig;\n darkMode?: DarkMode;\n className?: string;\n style?: CSSProperties;\n autoResize?: boolean;\n watermark?: boolean;\n onWarn?: RaceMountOptions['onWarn'];\n onPeriod?: (period: RaceFrame['period']) => void;\n}\n\n/** Ref handle for imperative race playback. */\nexport interface RaceHandle {\n readonly instance: RaceInstance | null;\n}\n\n/** Render an interactive race chart. */\nexport const Race = /* @__PURE__ */ forwardRef<RaceHandle, RaceProps>(function Race(\n { spec, theme, darkMode, className, style, autoResize, watermark, onWarn, onPeriod },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const mounted = useRef<{\n instance: RaceInstance;\n optionsKey: string;\n themeKey: string;\n specKey: string;\n } | null>(null);\n const warnRef = useRef(onWarn);\n useEffect(() => {\n warnRef.current = onWarn;\n }, [onWarn]);\n\n const options = useMemo<RaceMountOptions>(\n () => ({\n theme: mergeThemeConfig(contextTheme, theme),\n darkMode: resolvedDarkMode,\n autoResize,\n watermark,\n onWarn: (message) => (warnRef.current ?? console.warn)(message),\n }),\n [contextTheme, theme, resolvedDarkMode, autoResize, watermark],\n );\n const optionsKey = JSON.stringify({ autoResize, watermark });\n const themeKey = JSON.stringify({ theme: options.theme, darkMode: options.darkMode });\n\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return mounted.current?.instance ?? null;\n },\n }),\n [],\n );\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const current = mounted.current;\n const specKey = JSON.stringify(spec);\n if (current?.optionsKey === optionsKey) {\n if (specKey !== current.specKey) {\n current.instance.update(spec);\n current.specKey = specKey;\n }\n if (themeKey !== current.themeKey) {\n current.instance.setTheme(options);\n current.themeKey = themeKey;\n }\n return;\n }\n\n const state = current?.instance.getState();\n const instance = createRace(container, spec, { ...options, initialState: state });\n current?.instance.destroy();\n if (state) instance.resize();\n mounted.current = { instance, optionsKey, themeKey, specKey };\n }, [spec, options, optionsKey, themeKey]);\n\n useEffect(() => {\n const current = mounted.current;\n if (current?.optionsKey === optionsKey && onPeriod)\n return current.instance.on('period', onPeriod);\n }, [optionsKey, onPeriod]);\n\n useEffect(\n () => () => {\n mounted.current?.instance.destroy();\n mounted.current = null;\n },\n [],\n );\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-root ${className}` : 'oc-root'}\n style={style}\n />\n );\n});\n","/**\n * React Sankey component: thin wrapper around the vanilla adapter.\n *\n * Mounts a sankey instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createSankey() function.\n *\n * Supports forwardRef for imperative control via the instance getter.\n */\n\nimport type { DarkMode, SankeySpec, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createSankey,\n type SankeyInstance,\n type SankeyMountOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface SankeyProps {\n /** The sankey spec to render. */\n spec: SankeySpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Callback when a node is clicked. */\n onNodeClick?: (node: Record<string, unknown>) => void;\n /** Callback when a link is clicked. */\n onLinkClick?: (link: Record<string, unknown>) => void;\n /** Callback when a node is hovered (null when hover ends). */\n onNodeHover?: (node: Record<string, unknown> | null) => void;\n /** Callback when a link is hovered (null when hover ends). */\n onLinkHover?: (link: Record<string, unknown> | null) => void;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\nexport interface SankeyHandle {\n /** The underlying sankey instance (null until mounted). */\n readonly instance: SankeyInstance | null;\n}\n\n/**\n * React component that renders a sankey diagram from a SankeySpec.\n *\n * Uses the vanilla adapter internally. The spec is compiled and rendered\n * as SVG inside a wrapper div. Spec changes trigger re-renders via the\n * vanilla adapter's update() method.\n */\nexport const Sankey = /* @__PURE__ */ forwardRef<SankeyHandle, SankeyProps>(function Sankey(\n {\n spec,\n theme: themeProp,\n darkMode,\n onNodeClick,\n onLinkClick,\n onNodeHover,\n onLinkHover,\n className,\n style,\n },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<SankeyInstance | null>(null);\n const specRef = useRef<string>('');\n\n // Store event handlers in refs so they don't trigger recreation.\n const handlersRef = useRef<{\n onNodeClick?: SankeyProps['onNodeClick'];\n onLinkClick?: SankeyProps['onLinkClick'];\n onNodeHover?: SankeyProps['onNodeHover'];\n onLinkHover?: SankeyProps['onLinkHover'];\n }>({});\n handlersRef.current = {\n onNodeClick,\n onLinkClick,\n onNodeHover,\n onLinkHover,\n };\n\n // Stable callback wrappers that read from refs\n const stableOnNodeClick = useCallback(\n (node: Record<string, unknown>) => handlersRef.current.onNodeClick?.(node),\n [],\n );\n const stableOnLinkClick = useCallback(\n (link: Record<string, unknown>) => handlersRef.current.onLinkClick?.(link),\n [],\n );\n const stableOnNodeHover = useCallback(\n (node: Record<string, unknown> | null) => handlersRef.current.onNodeHover?.(node),\n [],\n );\n const stableOnLinkHover = useCallback(\n (link: Record<string, unknown> | null) => handlersRef.current.onLinkHover?.(link),\n [],\n );\n\n // Expose imperative handle\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return instanceRef.current;\n },\n }),\n [],\n );\n\n // Mount sankey and recreate when theme/darkMode change.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: SankeyMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onNodeClick: stableOnNodeClick,\n onLinkClick: stableOnLinkClick,\n onNodeHover: stableOnNodeHover,\n onLinkHover: stableOnLinkHover,\n autoResize: true,\n };\n\n instanceRef.current = createSankey(container, spec, options);\n specRef.current = JSON.stringify(spec);\n\n return () => {\n instanceRef.current?.destroy();\n instanceRef.current = null;\n };\n }, [\n theme,\n resolvedDarkMode,\n stableOnNodeClick,\n stableOnLinkClick,\n stableOnNodeHover,\n stableOnLinkHover,\n ]);\n\n // Update sankey when spec changes.\n useEffect(() => {\n const instance = instanceRef.current;\n if (!instance) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n\n specRef.current = specString;\n instance.update(spec);\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-sankey-root ${className}` : 'oc-sankey-root'}\n style={style}\n />\n );\n});\n","/**\n * React TileMap component: thin wrapper around the vanilla adapter.\n *\n * Mounts a tilemap instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createTileMap() function.\n *\n * Supports forwardRef for imperative control via the instance getter.\n */\n\nimport type { DarkMode, ThemeConfig, TileMapSpec } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createTileMap,\n type TileMapInstance,\n type TileMapMountOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface TileMapProps {\n /** The tilemap spec to render. */\n spec: TileMapSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Callback when a tile is clicked. */\n onTileClick?: (tile: {\n stateCode: string;\n stateName: string;\n value: number | null;\n data: Record<string, unknown>;\n }) => void;\n /** Callback when a tile is hovered (null when hover ends). */\n onTileHover?: (\n tile: {\n stateCode: string;\n stateName: string;\n value: number | null;\n data: Record<string, unknown>;\n } | null,\n ) => void;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\nexport interface TileMapHandle {\n /** The underlying tilemap instance (null until mounted). */\n readonly instance: TileMapInstance | null;\n}\n\n/**\n * React component that renders a tilemap from a TileMapSpec.\n *\n * Uses the vanilla adapter internally. The spec is compiled and rendered\n * as SVG inside a wrapper div. Spec changes trigger re-renders via the\n * vanilla adapter's update() method.\n */\nexport const TileMap = /* @__PURE__ */ forwardRef<TileMapHandle, TileMapProps>(function TileMap(\n { spec, theme: themeProp, darkMode, onTileClick, onTileHover, className, style },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<TileMapInstance | null>(null);\n const specRef = useRef<string>('');\n\n // Store event handlers in refs so they don't trigger recreation.\n const handlersRef = useRef<{\n onTileClick?: TileMapProps['onTileClick'];\n onTileHover?: TileMapProps['onTileHover'];\n }>({});\n handlersRef.current = {\n onTileClick,\n onTileHover,\n };\n\n // Stable callback wrappers that read from refs\n const stableOnTileClick = useCallback(\n (tile: {\n stateCode: string;\n stateName: string;\n value: number | null;\n data: Record<string, unknown>;\n }) => handlersRef.current.onTileClick?.(tile),\n [],\n );\n const stableOnTileHover = useCallback(\n (\n tile: {\n stateCode: string;\n stateName: string;\n value: number | null;\n data: Record<string, unknown>;\n } | null,\n ) => handlersRef.current.onTileHover?.(tile),\n [],\n );\n\n // Expose imperative handle\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return instanceRef.current;\n },\n }),\n [],\n );\n\n // Mount tilemap and recreate when theme/darkMode change.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: TileMapMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onTileClick: stableOnTileClick,\n onTileHover: stableOnTileHover,\n autoResize: true,\n };\n\n instanceRef.current = createTileMap(container, spec, options);\n specRef.current = JSON.stringify(spec);\n\n return () => {\n instanceRef.current?.destroy();\n instanceRef.current = null;\n };\n }, [theme, resolvedDarkMode, stableOnTileClick, stableOnTileHover]);\n\n // Update tilemap when spec changes.\n useEffect(() => {\n const instance = instanceRef.current;\n if (!instance) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n\n specRef.current = specString;\n instance.update(spec);\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-tilemap-root ${className}` : 'oc-tilemap-root'}\n style={style}\n />\n );\n});\n","/**\n * Visualization routing component: renders Chart, DataTable, or Graph\n * based on the spec type. Use this when rendering arbitrary VizSpec values.\n *\n * For event handlers, use the specific component (Chart, DataTable, Graph) directly.\n */\n\nimport type { DarkMode, ThemeConfig, VizSpec } from '@opendata-ai/openchart-core';\nimport {\n isBarListSpec,\n isGeoMapSpec,\n isGraphSpec,\n isRaceSpec,\n isSankeySpec,\n isTableSpec,\n isTileMapSpec,\n} from '@opendata-ai/openchart-core';\nimport type { CSSProperties } from 'react';\nimport { BarList } from './BarList';\nimport { Chart } from './Chart';\nimport { DataTable } from './DataTable';\nimport { GeoMap } from './GeoMap';\nimport { Graph } from './Graph';\nimport { Race } from './Race';\nimport { Sankey } from './Sankey';\nimport { TileMap } from './TileMap';\n\nexport interface VisualizationProps {\n /** The visualization spec to render. */\n spec: VizSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\n/**\n * Routes a VizSpec to the appropriate rendering component.\n *\n * Accepts any VizSpec and renders it with the correct component based on the\n * spec's type field. For event handlers, use Chart, DataTable, or Graph directly.\n */\nexport function Visualization({ spec, theme, darkMode, className, style }: VisualizationProps) {\n if (isTableSpec(spec)) {\n return (\n <DataTable\n spec={spec}\n theme={theme}\n darkMode={darkMode}\n className={className}\n style={style}\n />\n );\n }\n if (isGraphSpec(spec)) {\n return (\n <Graph spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isSankeySpec(spec)) {\n return (\n <Sankey spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isTileMapSpec(spec)) {\n return (\n <TileMap spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isBarListSpec(spec)) {\n return (\n <BarList spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isGeoMapSpec(spec)) {\n return (\n <GeoMap spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isRaceSpec(spec)) {\n return (\n <Race spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n return (\n <Chart spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n}\n"],"mappings":";AAcA,cAAc;AAiBd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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BarList","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","useRef","useMemo","mergeThemeConfig","useCallback","useImperativeHandle","useEffect","forwardRef","useEffect","useImperativeHandle","useRef","jsx","mergeThemeConfig","useCallback","useEffect","useMemo","useRef","jsx","useMemo","mergeThemeConfig","useRef","useCallback","useEffect","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","GeoMap","useMemo","mergeThemeConfig","useRef","useCallback","useImperativeHandle","useEffect","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","Graph","useMemo","mergeThemeConfig","useRef","useCallback","useImperativeHandle","spec","useEffect","createChart","useEffect","useRef","useCallback","useRef","createTable","useCallback","useEffect","useRef","useState","useCallback","useState","mergeThemeConfig","forwardRef","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","Race","useRef","useEffect","useMemo","mergeThemeConfig","useImperativeHandle","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","Sankey","useMemo","mergeThemeConfig","useRef","useCallback","useImperativeHandle","useEffect","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","TileMap","useMemo","mergeThemeConfig","useRef","useCallback","useImperativeHandle","useEffect","jsx"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/BarList.tsx","../src/ThemeContext.tsx","../src/Chart.tsx","../src/ChartStory.tsx","../src/DataTable.tsx","../src/GeoMap.tsx","../src/Graph.tsx","../src/hooks.ts","../src/hooks/useGraph.ts","../src/hooks/useTable.ts","../src/hooks/useTableState.ts","../src/Race.tsx","../src/Sankey.tsx","../src/TileMap.tsx","../src/Visualization.tsx"],"sourcesContent":["/**\n * @opendata-ai/openchart-react\n *\n * React adapter for openchart. Provides <Chart /> and <DataTable />\n * components that wrap the vanilla adapter with React lifecycle management.\n *\n * Re-exports the full core type system and utilities so React consumers\n * only need a single @opendata-ai/openchart-react dependency.\n */\n\n// ---------------------------------------------------------------------------\n// Core: full type system, theme, colors, locale, accessibility, helpers\n// ---------------------------------------------------------------------------\n\nexport * from '@opendata-ai/openchart-core';\n\n// ---------------------------------------------------------------------------\n// Vanilla: export utilities (SVG/PNG/JPG/CSV)\n// ---------------------------------------------------------------------------\n\nexport type {\n GeoMapCameraChangeMeta,\n InteractionMode,\n JPGExportOptions,\n PlaybackController,\n PlaybackPeriod,\n PlaybackState,\n PNGExportOptions,\n SpecSequenceOptions,\n SVGExportOptions,\n} from '@opendata-ai/openchart-vanilla';\nexport {\n exportCSV,\n exportJPG,\n exportPNG,\n exportSpecSequence,\n exportSVG,\n exportSVGWithFonts,\n} from '@opendata-ai/openchart-vanilla';\n\n// ---------------------------------------------------------------------------\n// Engine: compile API and types not covered by core\n// ---------------------------------------------------------------------------\n\nexport type {\n ChartRenderer,\n CompiledGraphEdge,\n CompiledGraphNode,\n CompileResult,\n GraphCompilation,\n NormalizedBarListSpec,\n NormalizedChartSpec,\n NormalizedChrome,\n NormalizedGeoMapSpec,\n NormalizedGraphSpec,\n NormalizedSankeySpec,\n NormalizedSpec,\n NormalizedTableSpec,\n NormalizedTileMapSpec,\n SimulationConfig,\n ValidationError,\n ValidationErrorCode,\n ValidationResult,\n} from '@opendata-ai/openchart-engine';\nexport {\n clearRenderers,\n compile,\n compileBarList,\n compileChart,\n compileGeoMap,\n compileGraph,\n compileSankey,\n compileTable,\n compileTileMap,\n getChartRenderer,\n normalizeSpec,\n registerChartRenderer,\n validateSpec,\n} from '@opendata-ai/openchart-engine';\nexport type { BarListHandle, BarListProps } from './BarList';\nexport { BarList } from './BarList';\nexport type { ChartHandle, ChartProps, ObservationChartProps, SliceChartProps } from './Chart';\n// Components\nexport { Chart } from './Chart';\nexport type { ChartStoryHandle, ChartStoryProps } from './ChartStory';\n// Scrollytelling\nexport { ChartStory } from './ChartStory';\nexport type { DataTableProps } from './DataTable';\nexport { DataTable } from './DataTable';\nexport type { GeoMapHandle, GeoMapProps } from './GeoMap';\nexport { GeoMap } from './GeoMap';\nexport type { GraphProps } from './Graph';\nexport { Graph } from './Graph';\nexport type { UseChartOptions, UseChartReturn } from './hooks';\n// Hooks\nexport { useChart, useDarkMode } from './hooks';\nexport type { GraphHandle, UseGraphReturn } from './hooks/useGraph';\nexport { useGraph } from './hooks/useGraph';\nexport type { UseTableReturn } from './hooks/useTable';\nexport { useTable } from './hooks/useTable';\nexport type { UseTableStateOptions, UseTableStateReturn } from './hooks/useTableState';\nexport { useTableState } from './hooks/useTableState';\nexport type { RaceHandle, RaceProps } from './Race';\nexport { Race } from './Race';\nexport type { SankeyHandle, SankeyProps } from './Sankey';\nexport { Sankey } from './Sankey';\nexport type { VizThemeProviderProps } from './ThemeContext';\n// Theme context\nexport { useVizDarkMode, useVizTheme, VizThemeProvider } from './ThemeContext';\nexport type { TileMapHandle, TileMapProps } from './TileMap';\nexport { TileMap } from './TileMap';\nexport type { VisualizationProps } from './Visualization';\nexport { Visualization } from './Visualization';\n","/**\n * React BarList component: thin wrapper around the vanilla adapter.\n *\n * Mounts a barlist instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createBarList() function.\n */\n\nimport type { BarListSpec, DarkMode, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n type BarListInstance,\n type BarListMountOptions,\n createBarList,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface BarListProps {\n spec: BarListSpec;\n theme?: ThemeConfig;\n darkMode?: DarkMode;\n onRowClick?: (row: { label: string; value: number; data: Record<string, unknown> }) => void;\n onRowHover?: (\n row: {\n label: string;\n value: number;\n data: Record<string, unknown>;\n } | null,\n ) => void;\n className?: string;\n style?: CSSProperties;\n}\n\nexport interface BarListHandle {\n readonly instance: BarListInstance | null;\n}\n\nexport const BarList = /* @__PURE__ */ forwardRef<BarListHandle, BarListProps>(function BarList(\n { spec, theme: themeProp, darkMode, onRowClick, onRowHover, className, style },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<BarListInstance | null>(null);\n const specRef = useRef<string>('');\n\n const handlersRef = useRef<{\n onRowClick?: BarListProps['onRowClick'];\n onRowHover?: BarListProps['onRowHover'];\n }>({});\n handlersRef.current = { onRowClick, onRowHover };\n\n const stableOnRowClick = useCallback(\n (row: { label: string; value: number; data: Record<string, unknown> }) =>\n handlersRef.current.onRowClick?.(row),\n [],\n );\n const stableOnRowHover = useCallback(\n (row: { label: string; value: number; data: Record<string, unknown> } | null) =>\n handlersRef.current.onRowHover?.(row),\n [],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return instanceRef.current;\n },\n }),\n [],\n );\n\n // Mount barlist and recreate when theme/darkMode change.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: BarListMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onRowClick: stableOnRowClick,\n onRowHover: stableOnRowHover,\n autoResize: true,\n };\n\n instanceRef.current = createBarList(container, spec, options);\n specRef.current = JSON.stringify(spec);\n\n return () => {\n instanceRef.current?.destroy();\n instanceRef.current = null;\n };\n }, [theme, resolvedDarkMode, stableOnRowClick, stableOnRowHover]);\n\n // Update barlist when spec changes.\n useEffect(() => {\n const instance = instanceRef.current;\n if (!instance) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n\n specRef.current = specString;\n instance.update(spec);\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-barlist-root ${className}` : 'oc-barlist-root'}\n style={style}\n />\n );\n});\n","/**\n * Theme context: provides a theme and dark mode preference to all\n * descendant Chart, DataTable, and Graph components without prop drilling.\n *\n * Components deep-merge the provider theme with their theme prop.\n * An explicit `darkMode` prop wins over the provider preference.\n */\n\nimport type { DarkMode, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { createContext, type ReactNode, useContext } from 'react';\n\nconst VizThemeContext = /* @__PURE__ */ createContext<ThemeConfig | undefined>(undefined);\nconst VizDarkModeContext = /* @__PURE__ */ createContext<DarkMode | undefined>(undefined);\n\n/** Read the current theme from the nearest VizThemeProvider. */\nexport function useVizTheme(): ThemeConfig | undefined {\n return useContext(VizThemeContext);\n}\n\n/** Read the current dark mode preference from the nearest VizThemeProvider. */\nexport function useVizDarkMode(): DarkMode | undefined {\n return useContext(VizDarkModeContext);\n}\n\nexport interface VizThemeProviderProps {\n /** Theme config to provide to descendant viz components. */\n theme: ThemeConfig | undefined;\n /** Dark mode preference to provide to descendant viz components. */\n darkMode?: DarkMode;\n children: ReactNode;\n}\n\n/** Provides a theme and dark mode preference to all nested Chart, DataTable, and Graph components. */\nexport function VizThemeProvider({ theme, darkMode, children }: VizThemeProviderProps) {\n return (\n <VizThemeContext.Provider value={theme}>\n <VizDarkModeContext.Provider value={darkMode}>{children}</VizDarkModeContext.Provider>\n </VizThemeContext.Provider>\n );\n}\n","/**\n * React Chart component: thin wrapper around the vanilla adapter.\n *\n * Mounts a chart instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createChart() function.\n */\n// biome-ignore-all lint/correctness/useHookAtTopLevel: Biome doesn't recognize overloaded function declarations as React components; hooks are correctly at the top level of ChartInner\n\nimport type {\n AnnotationPlacementTool,\n ChartEventHandlers,\n ChartSpec,\n DarkMode,\n DataRow,\n ElementRef,\n LayerSpec,\n ReaderChangeMeta,\n ThemeConfig,\n} from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n type ChartInstance,\n type ChartReaderProps,\n type ChartReaderSelection,\n createChart,\n createChartReaderBinding,\n type InteractionMode,\n type MountOptions,\n resolveInteractionMode,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface ChartHandle {\n /** Get the currently selected element, or null if none. */\n getSelectedElement(): ElementRef | null;\n /** Programmatically select an element. */\n select(ref: ElementRef): void;\n /** Deselect the current element. */\n deselect(): void;\n /** The underlying chart instance (null until mounted). */\n readonly instance: ChartInstance | null;\n}\n\nexport interface ChartBaseProps<TData extends DataRow = DataRow> extends ChartEventHandlers {\n /** The chart spec to render. Graph specs render through `<Graph />` or `<Visualization />`. */\n spec: ChartSpec<TData> | LayerSpec<TData>;\n /**\n * Interaction mode: `'read'`, `'select'`, or `'edit'`. When omitted it is\n * inferred from the callbacks (`onEdit` -> edit, `onSelect`/`onDeselect` ->\n * select, otherwise read). Changes switch modes in place.\n */\n interaction?: InteractionMode;\n /** Selection outline color. Changing it recreates the chart. */\n selectionColor?: string;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /**\n * Rendering backend for point marks (mirrors vega-embed's `renderer`\n * option). `'auto'` (default) promotes dense scatters to canvas.\n */\n renderer?: 'auto' | 'svg' | 'canvas';\n /** Quiet row inspection for simple horizontal bars. */\n rowHover?: boolean;\n /** Observe container resizes. */\n autoResize?: boolean;\n /** The currently selected element (controlled). */\n selectedElement?: ElementRef;\n /** Highlight specific color-encoding values. Pass null to clear. */\n highlight?: string[] | null;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\nexport type ChartProps<TData extends DataRow = DataRow> = ChartBaseProps<TData> & ChartReaderProps;\nexport type SliceChartProps<TData extends DataRow = DataRow> = ChartBaseProps<TData> &\n Extract<ChartReaderProps, { reader: { mode: 'slices' } }>;\nexport type ObservationChartProps<TData extends DataRow = DataRow> = ChartBaseProps<TData> &\n Exclude<ChartReaderProps, { reader: { mode: 'slices' } }>;\n\n/**\n * React component that renders a visualization from a spec.\n *\n * Uses the vanilla adapter internally. The spec is compiled and rendered\n * as SVG inside a wrapper div. Spec changes trigger re-renders via the\n * vanilla adapter's update() method.\n *\n * Pass a typed data row as the generic to get field autocomplete:\n * ```tsx\n * type SalesRow = { date: string; revenue: number };\n * <Chart<SalesRow> spec={{ mark: 'line', data: rows, encoding: { x: { field: 'date', ... } } }} />\n * ```\n */\n// forwardRef doesn't support generics natively in TypeScript, so we use the\n// inner function + cast pattern to preserve the generic on the public API.\nfunction ChartInner<TData extends DataRow = DataRow>(\n props: ChartProps<TData> & React.RefAttributes<ChartHandle>,\n ref: React.Ref<ChartHandle>,\n): React.ReactElement | null;\nfunction ChartInner(\n props: ChartProps & { ref?: React.Ref<ChartHandle> },\n ref: React.Ref<ChartHandle>,\n): React.ReactElement | null;\nfunction ChartInner(\n {\n spec,\n reader,\n readerSelection,\n onReaderChange,\n theme: themeProp,\n darkMode,\n renderer,\n rowHover,\n autoResize,\n revision,\n onEdit,\n onMarkClick,\n onMarkHover,\n onMarkFocus,\n onMarkLeave,\n onLegendToggle,\n onHighlightChange,\n onAnnotationClick,\n onSelect,\n onDeselect,\n onReveal,\n onPlacementToolChange,\n interaction,\n selectionColor,\n selectedElement: selectedElementProp,\n highlight,\n className,\n style,\n }: ChartProps,\n ref: React.Ref<ChartHandle>,\n) {\n const mode = resolveInteractionMode({ interaction, onEdit, onSelect, onDeselect });\n const hasEditListener = Boolean(onEdit);\n const previousSelectedElement = useRef(selectedElementProp);\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const chartRef = useRef<ChartInstance | null>(null);\n const mountedAppearance = useRef({ theme, darkMode: resolvedDarkMode });\n const specRef = useRef<string>('');\n const readerBinding = useRef<ReturnType<typeof createChartReaderBinding> | null>(null);\n readerBinding.current ??= createChartReaderBinding();\n const readerConfig = useRef({ reader, readerSelection, onReaderChange });\n readerConfig.current = { reader, readerSelection, onReaderChange };\n const syncReader = () => {\n if (containerRef.current && chartRef.current) {\n const config = readerConfig.current;\n readerBinding.current!.sync(\n containerRef.current,\n chartRef.current,\n spec,\n config.reader,\n config.readerSelection,\n config.onReaderChange as\n | ((selection: ChartReaderSelection, meta: ReaderChangeMeta) => void)\n | undefined,\n );\n }\n };\n const revisionRef = useRef(revision);\n\n // Store event handlers in refs so they don't trigger chart recreation.\n // Inline arrow functions create new references every render, which would\n // destroy and recreate the entire chart instance without this pattern.\n const handlersRef = useRef<{\n onMarkClick?: ChartProps['onMarkClick'];\n onMarkHover?: ChartProps['onMarkHover'];\n onMarkFocus?: ChartProps['onMarkFocus'];\n onMarkLeave?: ChartProps['onMarkLeave'];\n onLegendToggle?: ChartProps['onLegendToggle'];\n onHighlightChange?: ChartProps['onHighlightChange'];\n onAnnotationClick?: ChartProps['onAnnotationClick'];\n onEdit?: ChartProps['onEdit'];\n onSelect?: ChartProps['onSelect'];\n onDeselect?: ChartProps['onDeselect'];\n onReveal?: ChartProps['onReveal'];\n onPlacementToolChange?: ChartProps['onPlacementToolChange'];\n }>({});\n handlersRef.current = {\n onEdit,\n onMarkClick,\n onMarkHover,\n onMarkFocus,\n onMarkLeave,\n onLegendToggle,\n onHighlightChange,\n onAnnotationClick,\n onSelect,\n onDeselect,\n onReveal,\n onPlacementToolChange,\n };\n\n // Stable callback wrappers that read from refs\n const stableOnMarkClick = useCallback(\n (event: import('@opendata-ai/openchart-core').MarkEvent) =>\n handlersRef.current.onMarkClick?.(event),\n [],\n );\n const stableOnMarkHover = useCallback(\n (event: import('@opendata-ai/openchart-core').MarkEvent) =>\n handlersRef.current.onMarkHover?.(event),\n [],\n );\n const stableOnMarkFocus = useCallback(\n (event: import('@opendata-ai/openchart-core').MarkFocusEvent) =>\n handlersRef.current.onMarkFocus?.(event),\n [],\n );\n const stableOnMarkLeave = useCallback(() => handlersRef.current.onMarkLeave?.(), []);\n const stableOnLegendToggle = useCallback(\n (series: string, visible: boolean) => handlersRef.current.onLegendToggle?.(series, visible),\n [],\n );\n const stableOnHighlightChange = useCallback(\n (values: string[]) => handlersRef.current.onHighlightChange?.(values),\n [],\n );\n const stableOnAnnotationClick = useCallback(\n (\n annotation: import('@opendata-ai/openchart-core').Annotation,\n event: MouseEvent,\n element: ElementRef,\n ) => handlersRef.current.onAnnotationClick?.(annotation, event, element),\n [],\n );\n const stableOnEdit = useCallback(\n (tx: import('@opendata-ai/openchart-core').EditTransaction) => handlersRef.current.onEdit?.(tx),\n [],\n );\n const stableOnSelect = useCallback(\n (element: ElementRef) => handlersRef.current.onSelect?.(element),\n [],\n );\n const stableOnDeselect = useCallback(\n (element: ElementRef) => handlersRef.current.onDeselect?.(element),\n [],\n );\n const stableOnReveal = useCallback(\n (guess: Array<{ x: string | number; y: number }>) => handlersRef.current.onReveal?.(guess),\n [],\n );\n const stableOnPlacementToolChange = useCallback(\n (tool: AnnotationPlacementTool | null) => handlersRef.current.onPlacementToolChange?.(tool),\n [],\n );\n\n // Expose imperative handle for ref-based control\n useImperativeHandle(\n ref,\n () => ({\n getSelectedElement() {\n return chartRef.current?.getSelectedElement() ?? null;\n },\n select(elementRef: ElementRef) {\n chartRef.current?.select(elementRef);\n },\n deselect() {\n chartRef.current?.deselect();\n },\n get instance() {\n return chartRef.current;\n },\n }),\n [],\n );\n\n // Mount chart and recreate when structural options change.\n // Event handlers use stable refs so they don't trigger recreation.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: MountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n renderer,\n selectionColor,\n onMarkClick: stableOnMarkClick,\n onMarkHover: stableOnMarkHover,\n onMarkFocus: stableOnMarkFocus,\n onMarkLeave: stableOnMarkLeave,\n onLegendToggle: stableOnLegendToggle,\n onHighlightChange: stableOnHighlightChange,\n onAnnotationClick: stableOnAnnotationClick,\n onSelect: stableOnSelect,\n onDeselect: stableOnDeselect,\n onPlacementToolChange: stableOnPlacementToolChange,\n ...(handlersRef.current.onReveal ? { onReveal: stableOnReveal } : {}),\n interaction: mode,\n ...(selectedElementProp ? { selectedElement: selectedElementProp } : {}),\n rowHover,\n autoResize,\n revision,\n onEdit: stableOnEdit,\n };\n\n chartRef.current = createChart(container, spec, options);\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n specRef.current = JSON.stringify(spec);\n syncReader();\n\n return () => {\n readerBinding.current?.detach();\n chartRef.current?.destroy();\n chartRef.current = null;\n };\n // Event handlers use stable refs.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n renderer,\n selectionColor,\n stableOnAnnotationClick,\n stableOnEdit,\n stableOnPlacementToolChange,\n rowHover,\n autoResize,\n stableOnLegendToggle,\n stableOnHighlightChange,\n stableOnMarkClick,\n stableOnMarkHover,\n stableOnMarkFocus,\n stableOnMarkLeave,\n stableOnSelect,\n stableOnDeselect,\n stableOnReveal,\n ]);\n\n useEffect(() => {\n const previous = mountedAppearance.current;\n if (\n JSON.stringify(previous.theme) !== JSON.stringify(theme) ||\n previous.darkMode !== resolvedDarkMode\n ) {\n chartRef.current?.setTheme({ theme, darkMode: resolvedDarkMode });\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n }\n }, [theme, resolvedDarkMode]);\n\n useEffect(() => {\n const chart = chartRef.current;\n if (chart && chart.getInteraction() !== mode) chart.setInteraction(mode);\n }, [mode]);\n\n useEffect(() => {\n if (mode === 'edit' && !hasEditListener) {\n console.warn(\n \"[openchart] interaction: 'edit' was set without an onEdit handler; edit gestures will run but their transactions have no sink.\",\n );\n }\n }, [mode, hasEditListener]);\n\n // Stable callbacks and host changes update only the reader controller.\n // biome-ignore lint/correctness/useExhaustiveDependencies: sync reads the current stable instance and callback ref\n useEffect(() => {\n syncReader();\n }, [reader, readerSelection, onReaderChange]);\n\n // Update chart when spec changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: sync reads current reader refs after the committed spec update\n useEffect(() => {\n const chart = chartRef.current;\n if (!chart) return;\n\n const specString = JSON.stringify(spec);\n if (specString !== specRef.current || revisionRef.current !== revision) {\n specRef.current = specString;\n const revisionChanged = revisionRef.current !== revision;\n revisionRef.current = revision;\n if (revision !== undefined || revisionChanged) chart.update(spec, { revision });\n else chart.update(spec);\n syncReader();\n }\n }, [spec, revision]);\n\n // Handle selectedElement prop changes separately (like Vue/Svelte adapters)\n useEffect(() => {\n const chart = chartRef.current;\n if (!chart || !chart.select) return;\n\n if (selectedElementProp) {\n if (mode !== 'read') chart.select(selectedElementProp);\n } else if (previousSelectedElement.current && chart.getSelectedElement?.()) {\n chart.deselect();\n }\n previousSelectedElement.current = selectedElementProp;\n }, [selectedElementProp, mode]);\n\n // Handle highlight prop changes\n useEffect(() => {\n if (chartRef.current && highlight !== undefined) {\n chartRef.current.setHighlight(highlight);\n }\n }, [highlight]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-chart-root ${className}` : 'oc-chart-root'}\n style={style}\n />\n );\n}\n\n/**\n * Generic Chart component with field autocomplete support.\n *\n * Pass your data row type to get compile-time field validation:\n * ```tsx\n * type SalesRow = { date: string; revenue: number; region: string };\n * <Chart<SalesRow> spec={{ mark: 'line', data: rows, encoding: { x: { field: 'date', type: 'temporal' } } }} />\n * ```\n *\n * Without a type parameter, behaves identically to before — no migration needed.\n */\nexport const Chart = /* @__PURE__ */ (() => {\n const component = forwardRef(ChartInner);\n component.displayName = 'Chart';\n return component;\n})() as {\n <TData extends DataRow = DataRow>(\n props: SliceChartProps<TData> & { ref?: React.Ref<ChartHandle> },\n ): React.ReactElement | null;\n <TData extends DataRow = DataRow>(\n props: ObservationChartProps<TData> & { ref?: React.Ref<ChartHandle> },\n ): React.ReactElement | null;\n};\n","/**\n * React scrollytelling shell around the vanilla `createChartStory`.\n *\n * The chart panel is sticky-pinned; the narrative column scrolls past it and\n * each step block advances the story. The heavy lifting (cumulative patch\n * application, mark morphing, crossfade fallback, camera) lives in the vanilla\n * story driver: this component owns only React lifecycle and the sticky layout.\n *\n * Self-driving by default (the vanilla `ScrollDriver` reads step positions),\n * or controlled by passing `step={n}` to drive it externally.\n */\n\nimport type { ChartSpec, DataRow, GeoMapSpec, LayerSpec } from '@opendata-ai/openchart-core';\nimport type { MountOptions } from '@opendata-ai/openchart-vanilla';\nimport {\n type ChartStoryInstance,\n type ChartStoryOptions,\n createChartStory,\n} from '@opendata-ai/openchart-vanilla/story';\nimport type { Ref } from 'react';\nimport { type CSSProperties, type ReactNode, useEffect, useImperativeHandle, useRef } from 'react';\n\nexport interface ChartStoryHandle {\n /** Jump the story to a step index (applies patches 0..n, animates the diff). */\n goTo(index: number): void;\n /** The underlying vanilla story instance, or null before mount. */\n readonly instance: ChartStoryInstance | null;\n}\n\nexport interface ChartStoryProps<TData extends DataRow = DataRow> {\n /** Base spec the story drives. */\n spec: ChartSpec<TData> | LayerSpec<TData> | GeoMapSpec;\n /** Ordered step patches. `steps[i]` is applied cumulatively onto the base. */\n steps: ChartStoryOptions<TData>['steps'];\n /**\n * Narrative content per step: `narrative[i]` renders in the scrolling column\n * beside the sticky chart and triggers step `i` when it crosses the trigger\n * line. Length should match `steps`.\n */\n narrative: ReactNode[];\n /**\n * Controlled step index. When provided, the built-in scroll driver is left\n * in place but `goTo` is called on change so an external scroller can drive.\n * Omit for self-driving scroll.\n */\n step?: number;\n /** Fraction of viewport height where the scroll trigger sits. Default 0.4. */\n triggerPosition?: number;\n /** Camera driving mode. Default 'step'. */\n cameraMode?: 'step' | 'scrub';\n /** Options forwarded to the underlying chart mount (theme, dark mode, etc.). */\n mountOptions?: MountOptions;\n /** Class on the outer section. */\n className?: string;\n /** Inline styles merged onto the outer section. */\n style?: CSSProperties;\n ref?: Ref<ChartStoryHandle>;\n}\n\nconst sectionStyle: CSSProperties = {\n position: 'relative',\n display: 'grid',\n gridTemplateColumns: 'minmax(0, 26rem) minmax(0, 1fr)',\n gap: '3rem',\n alignItems: 'start',\n};\n\nconst narrativeColumnStyle: CSSProperties = {\n position: 'relative',\n};\n\nconst stepStyle: CSSProperties = {\n minHeight: '80vh',\n display: 'flex',\n alignItems: 'center',\n};\n\nconst panelStyle: CSSProperties = {\n position: 'sticky',\n top: '2rem',\n height: 'calc(100vh - 4rem)',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst chartMountStyle: CSSProperties = {\n width: '100%',\n};\n\nexport function ChartStory<TData extends DataRow = DataRow>({\n spec,\n steps,\n narrative,\n step,\n triggerPosition,\n cameraMode,\n mountOptions,\n className,\n style,\n ref,\n}: ChartStoryProps<TData>) {\n const sectionRef = useRef<HTMLElement | null>(null);\n const chartMountRef = useRef<HTMLDivElement | null>(null);\n const stepRefs = useRef<Array<HTMLDivElement | null>>([]);\n const storyRef = useRef<ChartStoryInstance | null>(null);\n\n if (narrative.length !== steps.length) {\n console.warn(\n `[openchart] ChartStory: narrative length (${narrative.length}) does not match steps length (${steps.length}). Each step should have a corresponding narrative element.`,\n );\n }\n\n // Mount once; the vanilla driver owns updates so React never re-mounts on\n // spec/step churn (matching the <Chart /> imperative-update pattern).\n const optionsRef = useRef<{\n spec: typeof spec;\n steps: typeof steps;\n triggerPosition?: number;\n cameraMode?: 'step' | 'scrub';\n mountOptions?: MountOptions;\n }>({ spec, steps, triggerPosition, cameraMode, mountOptions });\n optionsRef.current = { spec, steps, triggerPosition, cameraMode, mountOptions };\n\n useEffect(() => {\n const mount = chartMountRef.current;\n const section = sectionRef.current;\n if (!mount) return;\n\n const opts = optionsRef.current;\n const story = createChartStory(\n mount,\n {\n spec: opts.spec,\n steps: opts.steps,\n triggerPosition: opts.triggerPosition,\n cameraMode: opts.cameraMode,\n },\n opts.mountOptions,\n );\n storyRef.current = story;\n\n if (section) story.setContainer(section);\n stepRefs.current.forEach((el, i) => {\n if (el) story.registerStep(i, el);\n });\n\n return () => {\n story.destroy();\n storyRef.current = null;\n };\n // Mount-once: options are read from the ref so changing them doesn't\n // remount. Spec/step diffing at runtime is out of scope for v1.\n }, []);\n\n // Controlled mode: drive the story when `step` changes.\n useEffect(() => {\n if (step === undefined) return;\n storyRef.current?.goTo(step);\n }, [step]);\n\n useImperativeHandle(\n ref,\n () => ({\n goTo(index: number) {\n storyRef.current?.goTo(index);\n },\n get instance() {\n return storyRef.current;\n },\n }),\n [],\n );\n\n return (\n <section ref={sectionRef} className={className} style={{ ...sectionStyle, ...style }}>\n <div style={narrativeColumnStyle}>\n {narrative.map((content, i) => (\n <div\n // biome-ignore lint/suspicious/noArrayIndexKey: steps are a fixed ordered list; index is the stable identity\n key={i}\n ref={(el) => {\n stepRefs.current[i] = el;\n }}\n data-oc-story-step={i}\n style={stepStyle}\n >\n <div style={{ maxWidth: '36rem' }}>{content}</div>\n </div>\n ))}\n </div>\n <div style={panelStyle}>\n <div ref={chartMountRef} style={chartMountStyle} />\n </div>\n </section>\n );\n}\n","/**\n * DataTable component: React wrapper around the vanilla table adapter.\n *\n * Mounts a table instance on render, updates when spec changes,\n * and cleans up on unmount. Supports both controlled and uncontrolled modes\n * for sort, search, and pagination state.\n */\n\nimport type { DarkMode, SortState, TableSpec, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createTable,\n type TableInstance,\n type TableMountOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport { type CSSProperties, useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface DataTableProps {\n /** The table spec to render. */\n spec: TableSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Row click handler. */\n onRowClick?: (row: Record<string, unknown>) => void;\n /** Callback when sort changes. */\n onSortChange?: (sort: SortState | null) => void;\n /** Callback when search changes. */\n onSearchChange?: (query: string) => void;\n /** Callback when page changes. */\n onPageChange?: (page: number) => void;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n /** Controlled sort state. */\n sort?: SortState | null;\n /** Controlled search query. */\n search?: string;\n /** Controlled page number. */\n page?: number;\n}\n\n/**\n * React component that renders a data table from a TableSpec.\n *\n * Uses the vanilla adapter internally. Supports controlled and uncontrolled\n * modes for sort, search, and pagination state.\n */\nexport function DataTable({\n spec,\n theme: themeProp,\n darkMode,\n onRowClick,\n onSortChange,\n onSearchChange,\n onPageChange,\n className,\n style,\n sort,\n search,\n page,\n}: DataTableProps) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const tableRef = useRef<TableInstance | null>(null);\n const mountedAppearance = useRef({ theme, darkMode: resolvedDarkMode });\n\n // Store event handlers in refs so they don't trigger table recreation.\n const handlersRef = useRef<{\n onRowClick?: DataTableProps['onRowClick'];\n onSortChange?: DataTableProps['onSortChange'];\n onSearchChange?: DataTableProps['onSearchChange'];\n onPageChange?: DataTableProps['onPageChange'];\n }>({});\n handlersRef.current = { onRowClick, onSortChange, onSearchChange, onPageChange };\n\n // Stable callback wrappers that read from refs\n const stableOnRowClick = useCallback(\n (row: Record<string, unknown>) => handlersRef.current.onRowClick?.(row),\n [],\n );\n const stableOnStateChange = useCallback(\n (state: { sort?: SortState | null; search?: string; page?: number }) => {\n if (state.sort !== undefined) handlersRef.current.onSortChange?.(state.sort);\n if (state.search !== undefined) handlersRef.current.onSearchChange?.(state.search);\n if (state.page !== undefined) handlersRef.current.onPageChange?.(state.page);\n },\n [],\n );\n\n const prevSpecRef = useRef<string>('');\n\n // Determine if we're in controlled mode\n const isControlled = sort !== undefined || search !== undefined || page !== undefined;\n\n // Effect 1: Mount/unmount. Only recreate when structural options change.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec, sort, search, page intentionally excluded - handled via update()/setState() in Effects 2-3\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const mountOptions: TableMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onRowClick: stableOnRowClick,\n autoResize: true,\n onStateChange: stableOnStateChange,\n };\n\n if (isControlled) {\n mountOptions.externalState = {\n sort: sort ?? null,\n search: search ?? '',\n page: page ?? 0,\n };\n }\n\n tableRef.current = createTable(container, spec, mountOptions);\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n prevSpecRef.current = JSON.stringify(spec);\n\n return () => {\n tableRef.current?.destroy();\n tableRef.current = null;\n };\n // Only recreate on structural option changes.\n // Controlled state updates are handled in Effect 2.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isControlled, stableOnRowClick, stableOnStateChange]);\n\n // Apply appearance changes to the mounted table.\n useEffect(() => {\n const previous = mountedAppearance.current;\n if (\n JSON.stringify(previous.theme) !== JSON.stringify(theme) ||\n previous.darkMode !== resolvedDarkMode\n ) {\n tableRef.current?.setTheme({ theme, darkMode: resolvedDarkMode });\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n }\n }, [theme, resolvedDarkMode]);\n\n // Effect 2: Sync controlled state without remounting.\n useEffect(() => {\n const table = tableRef.current;\n if (!table || !isControlled) return;\n\n table.setState({\n sort: sort ?? null,\n search: search ?? '',\n page: page ?? 0,\n });\n }, [sort, search, page, isControlled]);\n\n // Effect 3: Sync spec changes via update().\n useEffect(() => {\n const table = tableRef.current;\n if (!table) return;\n\n const specString = JSON.stringify(spec);\n if (specString !== prevSpecRef.current) {\n prevSpecRef.current = specString;\n table.update(spec);\n }\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-table-root ${className}` : 'oc-table-root'}\n style={style}\n />\n );\n}\n","/**\n * React Map component: thin wrapper around the vanilla adapter.\n *\n * Mounts a map instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createGeoMap() function.\n *\n * Supports forwardRef for imperative control via the instance getter.\n */\n\nimport type {\n DarkMode,\n GeoMapSpec,\n GeoReaderSelection,\n ReaderChangeMeta,\n ThemeConfig,\n} from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n type Camera,\n createGeoMap,\n createGeoReaderBinding,\n type GeoMapCameraChangeMeta,\n type GeoMapInstance,\n type GeoMapMarkEvent,\n type GeoMapMountOptions,\n type GeoReaderOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface GeoMapProps {\n reader?: false | GeoReaderOptions;\n readerSelection?: GeoReaderSelection;\n onReaderChange?: (selection: GeoReaderSelection, meta: ReaderChangeMeta) => void;\n labelInventory?: GeoMapMountOptions['labelInventory'];\n /** The map spec to render. */\n spec: GeoMapSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Callback when a map feature is clicked. */\n onMarkClick?: (feature: GeoMapMarkEvent) => void;\n /** Callback when a map feature is hovered (null when hover ends). */\n onMarkHover?: (feature: GeoMapMarkEvent | null) => void;\n /** Called whenever the camera moves (reader zoom/pan, zoomTo, focus). */\n onCameraChange?: (camera: Camera, meta?: GeoMapCameraChangeMeta) => void;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\nexport interface GeoMapHandle {\n /** The underlying map instance (null until mounted). */\n readonly instance: GeoMapInstance | null;\n}\n\nexport const GeoMap = /* @__PURE__ */ forwardRef<GeoMapHandle, GeoMapProps>(function GeoMap(\n {\n spec,\n reader,\n readerSelection,\n onReaderChange,\n theme: themeProp,\n darkMode,\n labelInventory,\n onMarkClick,\n onMarkHover,\n onCameraChange,\n className,\n style,\n },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<GeoMapInstance | null>(null);\n const mountedAppearance = useRef({ theme, darkMode: resolvedDarkMode });\n const specRef = useRef<string>('');\n const readerBinding = useRef<ReturnType<typeof createGeoReaderBinding> | null>(null);\n readerBinding.current ??= createGeoReaderBinding();\n const readerConfig = useRef({ reader, readerSelection, onReaderChange });\n readerConfig.current = { reader, readerSelection, onReaderChange };\n const syncReader = () => {\n if (containerRef.current && instanceRef.current) {\n const config = readerConfig.current;\n readerBinding.current!.sync(\n containerRef.current,\n instanceRef.current,\n spec,\n config.reader,\n config.readerSelection,\n config.onReaderChange,\n );\n }\n };\n\n const handlersRef = useRef<{\n onMarkClick?: GeoMapProps['onMarkClick'];\n onMarkHover?: GeoMapProps['onMarkHover'];\n onCameraChange?: GeoMapProps['onCameraChange'];\n }>({});\n handlersRef.current = {\n onMarkClick,\n onMarkHover,\n onCameraChange,\n };\n\n const stableOnMarkClick = useCallback(\n (feature: GeoMapMarkEvent) => handlersRef.current.onMarkClick?.(feature),\n [],\n );\n const stableOnMarkHover = useCallback(\n (feature: GeoMapMarkEvent | null) => handlersRef.current.onMarkHover?.(feature),\n [],\n );\n const stableOnCameraChange = useCallback(\n (camera: Camera, meta?: GeoMapCameraChangeMeta) =>\n meta\n ? handlersRef.current.onCameraChange?.(camera, meta)\n : handlersRef.current.onCameraChange?.(camera),\n [],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return instanceRef.current;\n },\n }),\n [],\n );\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: GeoMapMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onMarkClick: stableOnMarkClick,\n onMarkHover: stableOnMarkHover,\n onCameraChange: stableOnCameraChange,\n autoResize: true,\n };\n\n instanceRef.current = createGeoMap(container, spec, options);\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n specRef.current = JSON.stringify(spec);\n syncReader();\n\n return () => {\n readerBinding.current?.detach();\n instanceRef.current?.destroy();\n instanceRef.current = null;\n };\n }, [stableOnMarkClick, stableOnMarkHover, stableOnCameraChange]);\n\n useEffect(() => {\n const previous = mountedAppearance.current;\n if (\n JSON.stringify(previous.theme) !== JSON.stringify(theme) ||\n previous.darkMode !== resolvedDarkMode\n ) {\n instanceRef.current?.setTheme({ theme, darkMode: resolvedDarkMode });\n mountedAppearance.current = { theme, darkMode: resolvedDarkMode };\n }\n }, [theme, resolvedDarkMode]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: sync reads current reader refs after the committed spec update\n useEffect(() => {\n const instance = instanceRef.current;\n if (!instance) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n\n specRef.current = specString;\n instance.update(spec);\n syncReader();\n }, [spec]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: reapply the host after theme-driven instance recreation\n useEffect(() => {\n instanceRef.current?.setLabelInventory(labelInventory);\n }, [labelInventory, theme, resolvedDarkMode]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: sync uses stable instance and callback refs\n useEffect(() => {\n syncReader();\n }, [reader, readerSelection, onReaderChange]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-map-root ${className}` : 'oc-map-root'}\n style={style}\n />\n );\n});\n","/**\n * React Graph component: thin wrapper around the vanilla adapter.\n *\n * Mounts a graph instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createGraph() function.\n *\n * Supports forwardRef for imperative control via useGraph() hook.\n */\n\nimport type { DarkMode, GraphSpec, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createGraph,\n type GraphCamera,\n type GraphInstance,\n type GraphMountOptions,\n type GraphTooltipFormatter,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport type { GraphHandle } from './hooks/useGraph';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\n/** Tooltip prop: `false` off, `true` default, or an object with a formatter. */\nexport type GraphTooltipProp = boolean | { formatter?: GraphTooltipFormatter };\n/** Legend prop: `false` off, `true` default, or an object toggling interactivity/counts. */\nexport type GraphLegendProp = boolean | { interactive?: boolean; counts?: boolean };\n\nexport interface GraphProps {\n /** The graph spec to render. */\n spec: GraphSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Callback when a node is clicked. */\n onNodeClick?: (node: Record<string, unknown>) => void;\n /** Callback when a node is double-clicked. */\n onNodeDoubleClick?: (node: Record<string, unknown>) => void;\n /** Callback when a node is hovered (null when hover ends). */\n onNodeHover?: (node: Record<string, unknown> | null) => void;\n /** Callback when an edge is hovered (null when hover ends). */\n onEdgeHover?: (edge: Record<string, unknown> | null) => void;\n /** Callback when selection changes. */\n onSelectionChange?: (nodeIds: string[]) => void;\n /** Fired when the user hovers a legend entry (null on leave). */\n onLegendHover?: (entry: { field: string; value: string } | null) => void;\n /** Fired when legend toggle state changes; `activeValues` is the active set (empty = all). */\n onLegendToggle?: (activeValues: string[]) => void;\n /** Fired whenever the highlight set changes (programmatic or legend), null when cleared. */\n onHighlightChange?: (nodeIds: string[] | null) => void;\n /** Camera change callback, rAF-coalesced (fires at most once per rendered frame). */\n onCameraChange?: (camera: GraphCamera) => void;\n /**\n * Show built-in tooltip on node/edge hover. Defaults to true. Pass an object\n * with a `formatter` to customize content.\n */\n tooltip?: GraphTooltipProp;\n /**\n * Show built-in legend. Defaults to true. Pass `false` if you render your own,\n * or an object to toggle interactivity/counts.\n */\n legend?: GraphLegendProp;\n /** Fit the graph to the viewport on the first tick. Default true. */\n fitOnLoad?: boolean;\n /** How much closer than the fit the opening camera sits: a multiplier on the fit (2 = twice as close), not an absolute zoom level. Default 1. Read once at mount; `zoomToFit()` still frames the whole graph. */\n initialZoom?: number;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\n/** Structural (serializable) tooltip shape that participates in the mount dep key. */\nfunction tooltipStructural(tooltip: GraphTooltipProp | undefined): boolean {\n // Only the on/off decision is structural; the formatter is a function carried\n // by the ref-trampoline, never pinned in the dep array (avoids stale closures).\n if (tooltip === false) return false;\n return true;\n}\n\n/** Structural (serializable) legend shape that participates in the mount dep key. */\nfunction legendStructural(legend: GraphLegendProp | undefined): string {\n if (legend === false) return 'false';\n if (legend === true || legend === undefined) return 'true';\n return JSON.stringify({ interactive: legend.interactive, counts: legend.counts });\n}\n\n/**\n * React component that renders a force-directed graph from a GraphSpec.\n *\n * Uses the vanilla adapter internally. The spec is compiled and rendered\n * on a canvas inside a wrapper div. Spec changes trigger re-renders via the\n * vanilla adapter's update() method.\n *\n * Supports ref for imperative control via useGraph() hook:\n * ```tsx\n * const { ref, search, zoomToFit } = useGraph();\n * return <Graph ref={ref} spec={spec} />;\n * ```\n */\nexport const Graph = /* @__PURE__ */ forwardRef<GraphHandle, GraphProps>(function Graph(\n {\n spec,\n theme: themeProp,\n darkMode,\n onNodeClick,\n onNodeDoubleClick,\n onNodeHover,\n onEdgeHover,\n onSelectionChange,\n onLegendHover,\n onLegendToggle,\n onHighlightChange,\n onCameraChange,\n tooltip,\n legend,\n fitOnLoad,\n initialZoom,\n className,\n style,\n },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const graphRef = useRef<GraphInstance | null>(null);\n const specRef = useRef<string>('');\n // Deps of the previous mount-effect run. A recreation with CHANGED deps\n // (theme/darkMode/structural-tooltip/legend — all spec-unchanged) suppresses\n // the entrance; identical deps mean a StrictMode dev replay of the same\n // mount, which must still play the entrance. A survives-cleanup boolean ref\n // can't tell those apart — it would suppress the entrance in every\n // StrictMode app.\n const prevMountDepsRef = useRef<unknown[] | null>(null);\n // Whether the last destroyed instance's entrance played. A recreation only\n // suppresses the entrance when it did: one still waiting to be seen replays.\n const prevEntrancePlayedRef = useRef(false);\n\n // Store event handlers AND function-valued options in refs so they don't\n // trigger graph recreation. Inline functions create new references every\n // render, which would either destroy+recreate the graph (if pinned in the dep\n // array) or go stale (if read once at mount). The trampoline gives us stable\n // wrappers whose bodies read the LATEST handler on every call.\n const handlersRef = useRef<{\n onNodeClick?: GraphProps['onNodeClick'];\n onNodeDoubleClick?: GraphProps['onNodeDoubleClick'];\n onNodeHover?: GraphProps['onNodeHover'];\n onEdgeHover?: GraphProps['onEdgeHover'];\n onSelectionChange?: GraphProps['onSelectionChange'];\n onLegendHover?: GraphProps['onLegendHover'];\n onLegendToggle?: GraphProps['onLegendToggle'];\n onHighlightChange?: GraphProps['onHighlightChange'];\n onCameraChange?: GraphProps['onCameraChange'];\n tooltipFormatter?: GraphTooltipFormatter;\n }>({});\n handlersRef.current = {\n onNodeClick,\n onNodeDoubleClick,\n onNodeHover,\n onEdgeHover,\n onSelectionChange,\n onLegendHover,\n onLegendToggle,\n onHighlightChange,\n onCameraChange,\n tooltipFormatter: typeof tooltip === 'object' ? tooltip.formatter : undefined,\n };\n\n // Stable callback wrappers that read from refs\n const stableOnNodeClick = useCallback(\n (node: Record<string, unknown>) => handlersRef.current.onNodeClick?.(node),\n [],\n );\n const stableOnNodeDoubleClick = useCallback(\n (node: Record<string, unknown>) => handlersRef.current.onNodeDoubleClick?.(node),\n [],\n );\n const stableOnNodeHover = useCallback(\n (node: Record<string, unknown> | null) => handlersRef.current.onNodeHover?.(node),\n [],\n );\n const stableOnEdgeHover = useCallback(\n (edge: Record<string, unknown> | null) => handlersRef.current.onEdgeHover?.(edge),\n [],\n );\n const stableOnSelectionChange = useCallback(\n (nodeIds: string[]) => handlersRef.current.onSelectionChange?.(nodeIds),\n [],\n );\n const stableOnLegendHover = useCallback(\n (entry: { field: string; value: string } | null) => handlersRef.current.onLegendHover?.(entry),\n [],\n );\n const stableOnLegendToggle = useCallback(\n (activeValues: string[]) => handlersRef.current.onLegendToggle?.(activeValues),\n [],\n );\n const stableOnHighlightChange = useCallback(\n (nodeIds: string[] | null) => handlersRef.current.onHighlightChange?.(nodeIds),\n [],\n );\n const stableOnCameraChange = useCallback(\n (camera: GraphCamera) => handlersRef.current.onCameraChange?.(camera),\n [],\n );\n // A stable formatter wrapper: it always calls the LATEST formatter off the ref.\n // The tooltip mount option carries this wrapper, never the raw prop function, so\n // the formatter can't go stale and can't force graph recreation.\n const stableTooltipFormatter = useCallback<GraphTooltipFormatter>(\n (item, defaults) => handlersRef.current.tooltipFormatter?.(item, defaults) ?? defaults,\n [],\n );\n\n // Expose imperative handle for useGraph() hook. Every method forwards opts to\n // the underlying instance so consumers get the full vanilla API surface.\n useImperativeHandle(\n ref,\n () => ({\n search(query) {\n graphRef.current?.search(query);\n },\n clearSearch() {\n graphRef.current?.clearSearch();\n },\n getSearchMatches() {\n return graphRef.current?.getSearchMatches() ?? [];\n },\n zoomToFit(opts) {\n graphRef.current?.zoomToFit(opts);\n },\n zoomToNode(nodeId, opts) {\n graphRef.current?.zoomToNode(nodeId, opts);\n },\n flyTo(target, opts) {\n graphRef.current?.flyTo(target, opts);\n },\n centerAt(x, y, opts) {\n graphRef.current?.centerAt(x, y, opts);\n },\n getCamera() {\n return graphRef.current?.getCamera() ?? { x: 0, y: 0, k: 1 };\n },\n selectNode(nodeId, opts) {\n graphRef.current?.selectNode(nodeId, opts);\n },\n getSelectedNodes() {\n return graphRef.current?.getSelectedNodes() ?? [];\n },\n highlight(target, opts) {\n graphRef.current?.highlight(target, opts);\n },\n clearHighlight() {\n graphRef.current?.clearHighlight();\n },\n getHighlight() {\n return graphRef.current?.getHighlight() ?? null;\n },\n getLegend() {\n return graphRef.current?.getLegend() ?? null;\n },\n setActiveCategories(values: string[]) {\n graphRef.current?.setActiveCategories(values);\n },\n getActiveCategories() {\n return graphRef.current?.getActiveCategories() ?? [];\n },\n update(spec: GraphSpec) {\n graphRef.current?.update(spec);\n },\n get instance() {\n return graphRef.current;\n },\n }),\n [],\n );\n\n // Structural-only parts of tooltip/legend that gate recreation. The tooltip\n // formatter (a function) is deliberately excluded — it rides the trampoline.\n const tooltipOn = tooltipStructural(tooltip);\n const legendKey = legendStructural(legend);\n // 2D and 3D are different renderers chosen once, at mount, so a dimension\n // change is a remount. It is deliberately NOT in `mountDeps`: the new\n // renderer should play its entrance rather than suppress it.\n const dimensions = spec.dimensions ?? 2;\n\n // Mount graph and recreate when theme/darkMode/structural options change.\n // Event handlers and the tooltip formatter use stable refs so they don't\n // trigger recreation.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n // Rebuild the tooltip option: keep the boolean/off decision, but always pass\n // the stable formatter wrapper when tooltips are on (so a formatter can be\n // added/changed per-render without recreating the graph).\n const tooltipOption: GraphMountOptions['tooltip'] = tooltipOn\n ? { formatter: stableTooltipFormatter }\n : false;\n\n // Suppress the entrance only when a PREVIOUS mount existed, played its\n // entrance, and a dep actually changed (theme/darkMode/structural option —\n // spec unchanged). Identical deps = StrictMode's dev remount of the same\n // graph: play it.\n const mountDeps: unknown[] = [theme, resolvedDarkMode, tooltipOn, legendKey, fitOnLoad];\n const prevDeps = prevMountDepsRef.current;\n const suppressEntrance =\n prevDeps !== null &&\n prevEntrancePlayedRef.current &&\n mountDeps.some((d, i) => !Object.is(d, prevDeps[i]));\n\n const options: GraphMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n tooltip: tooltipOption,\n legend,\n fitOnLoad,\n // Only the opening camera reads it, so it is not a mount dep.\n initialZoom,\n onNodeClick: stableOnNodeClick,\n onNodeDoubleClick: stableOnNodeDoubleClick,\n onNodeHover: stableOnNodeHover,\n onEdgeHover: stableOnEdgeHover,\n onSelectionChange: stableOnSelectionChange,\n onLegendHover: stableOnLegendHover,\n onLegendToggle: stableOnLegendToggle,\n onHighlightChange: stableOnHighlightChange,\n onCameraChange: stableOnCameraChange,\n autoResize: true,\n suppressEntrance,\n };\n\n graphRef.current = createGraph(container, spec, options);\n specRef.current = JSON.stringify(spec);\n prevMountDepsRef.current = mountDeps;\n\n return () => {\n prevEntrancePlayedRef.current = graphRef.current?.entrancePlayed ?? false;\n graphRef.current?.destroy();\n graphRef.current = null;\n };\n // Only recreate when theme/darkMode/structural options change. Event handlers\n // and the tooltip formatter use stable refs.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n theme,\n resolvedDarkMode,\n tooltipOn,\n legendKey,\n fitOnLoad,\n stableOnNodeClick,\n stableOnNodeDoubleClick,\n stableOnNodeHover,\n stableOnEdgeHover,\n stableOnSelectionChange,\n stableOnLegendHover,\n stableOnLegendToggle,\n stableOnHighlightChange,\n stableOnCameraChange,\n stableTooltipFormatter,\n dimensions,\n ]);\n\n // Update the graph when the spec changes. `update()` diffs prev↔next itself:\n // a visual-only change (same node/edge ids + same physics) preserves positions\n // without restarting the sim; anything structural reheats with a local impulse.\n useEffect(() => {\n const graph = graphRef.current;\n if (!graph) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n specRef.current = specString;\n\n // `update` diffs internally: same node/edge ids + same physics take the\n // position-preserving path, anything structural reheats. No wrapper-side\n // heuristic needed (the old JSON-diff silently ignored physics changes).\n graph.update(spec);\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-graph-root ${className}` : 'oc-graph-root'}\n style={style}\n />\n );\n});\n","/**\n * React hooks for chart lifecycle and dark mode resolution.\n *\n * useChart: manual control over a chart instance (for advanced usage).\n * useDarkMode: resolves the DarkMode preference to a boolean.\n */\n\nimport type { ChartLayout, ChartSpec, DarkMode, LayerSpec } from '@opendata-ai/openchart-core';\nimport { type ChartInstance, createChart, type MountOptions } from '@opendata-ai/openchart-vanilla';\nimport { useEffect, useRef, useState } from 'react';\n\n// ---------------------------------------------------------------------------\n// useChart\n// ---------------------------------------------------------------------------\n\nexport interface UseChartOptions {\n /** Theme overrides. */\n theme?: MountOptions['theme'];\n /** Dark mode setting. */\n darkMode?: MountOptions['darkMode'];\n /** Observe container resizes. Defaults to true. */\n autoResize?: boolean;\n /** Rendering backend for point marks; see the vanilla `MountOptions.renderer`. */\n renderer?: MountOptions['renderer'];\n}\n\nexport interface UseChartReturn {\n /** Ref to attach to the container div. */\n ref: React.RefObject<HTMLDivElement | null>;\n /** The chart instance (null until mounted). */\n chart: ChartInstance | null;\n /** The current compiled layout (null until mounted). */\n layout: ChartLayout | null;\n}\n\n/**\n * Hook for manual chart lifecycle control.\n *\n * Attach the returned ref to a container div. The chart mounts\n * automatically and updates when the spec changes.\n *\n * @param spec - The visualization spec.\n * @param options - Mount options.\n * @returns { ref, chart, layout }\n */\nexport function useChart(spec: ChartSpec | LayerSpec, options?: UseChartOptions): UseChartReturn {\n const ref = useRef<HTMLDivElement | null>(null);\n const chartRef = useRef<ChartInstance | null>(null);\n const [layout, setLayout] = useState<ChartLayout | null>(null);\n const specRef = useRef<string>('');\n\n // Mount / unmount\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in the update effect\n useEffect(() => {\n const container = ref.current;\n if (!container) return;\n\n const mountOpts: MountOptions = {\n theme: options?.theme,\n darkMode: options?.darkMode,\n autoResize: options?.autoResize,\n renderer: options?.renderer,\n };\n\n const chart = createChart(container, spec, mountOpts);\n chartRef.current = chart;\n setLayout(chart.layout);\n specRef.current = JSON.stringify(spec);\n\n return () => {\n chart.destroy();\n chartRef.current = null;\n setLayout(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options?.theme, options?.darkMode, options?.autoResize, options?.renderer]);\n\n // Update on spec change\n useEffect(() => {\n const chart = chartRef.current;\n if (!chart) return;\n\n const specString = JSON.stringify(spec);\n if (specString !== specRef.current) {\n specRef.current = specString;\n chart.update(spec);\n setLayout(chart.layout);\n }\n }, [spec]);\n\n return {\n ref,\n chart: chartRef.current,\n layout,\n };\n}\n\n// ---------------------------------------------------------------------------\n// useDarkMode\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve a DarkMode preference to a boolean.\n *\n * - \"force\" -> true\n * - \"off\" -> false\n * - \"auto\" -> matches system preference (reactive to changes)\n *\n * @param mode - The dark mode preference.\n * @returns Whether dark mode is active.\n */\nexport function useDarkMode(mode?: DarkMode): boolean {\n const [isDark, setIsDark] = useState(() => resolveInitial(mode));\n\n useEffect(() => {\n if (mode !== 'auto') {\n setIsDark(mode === 'force');\n return;\n }\n\n if (typeof window === 'undefined' || !window.matchMedia) {\n setIsDark(false);\n return;\n }\n\n const mq = window.matchMedia('(prefers-color-scheme: dark)');\n setIsDark(mq.matches);\n\n const handler = (e: MediaQueryListEvent) => setIsDark(e.matches);\n mq.addEventListener('change', handler);\n return () => mq.removeEventListener('change', handler);\n }, [mode]);\n\n return isDark;\n}\n\nfunction resolveInitial(mode?: DarkMode): boolean {\n if (mode === 'force') return true;\n if (mode === 'off' || mode === undefined) return false;\n // \"auto\"\n if (typeof window !== 'undefined' && window.matchMedia) {\n return window.matchMedia('(prefers-color-scheme: dark)').matches;\n }\n return false;\n}\n","/**\n * useGraph: hook for imperative graph control.\n *\n * Provides a ref to pass to <Graph /> and exposes graph methods\n * (search, zoom, select, fly, highlight) for programmatic control of the\n * graph instance. The full vanilla GraphInstance API is threaded through.\n */\n\nimport type { GraphSpec } from '@opendata-ai/openchart-core';\nimport type {\n CameraFlightOptions,\n GraphCamera,\n GraphFlyTarget,\n GraphHighlightTarget,\n GraphInstance,\n GraphLegendData,\n} from '@opendata-ai/openchart-vanilla';\nimport { useCallback, useRef } from 'react';\n\n// Re-exported rather than redeclared so the 3D pose fields (`position`,\n// `target`) stay visible to typed consumers of the React wrapper.\nexport type { GraphCamera, GraphFlyTarget } from '@opendata-ai/openchart-vanilla';\n\nexport interface UseGraphReturn {\n /** Ref to pass to <Graph ref={ref} />. */\n ref: React.RefObject<GraphHandle | null>;\n /** Search for nodes matching a query string. */\n search: (query: string) => void;\n /** Clear the current search. */\n clearSearch: () => void;\n /** Node ids currently matching the active search query. */\n getSearchMatches: () => string[];\n /** Zoom to fit all nodes in view. Animated by default; `{ duration: 0 }` snaps. */\n zoomToFit: (opts?: CameraFlightOptions & { padding?: number }) => void;\n /** Fly to a node and zoom in (default scale 2). */\n zoomToNode: (nodeId: string, opts?: CameraFlightOptions & { scale?: number }) => void;\n /** Fly the camera to a graph-space target. */\n flyTo: (target: GraphFlyTarget, opts?: CameraFlightOptions) => void;\n /** Center the camera on a graph-space point (keeps current zoom). */\n centerAt: (x: number, y: number, opts?: CameraFlightOptions) => void;\n /** Current camera transform. */\n getCamera: () => GraphCamera;\n /** Select a node by id; `{ fly: true }` also flies to it. */\n selectNode: (nodeId: string, opts?: { fly?: boolean } & CameraFlightOptions) => void;\n /** Get the currently selected node ids. */\n getSelectedNodes: () => string[];\n /**\n * Emphasize a set of nodes; eased via the focus model. Layers over the\n * standing category filter rather than replacing it.\n */\n highlight: (target: GraphHighlightTarget, opts?: { dimOpacity?: number }) => void;\n /**\n * Clear the transient highlight, returning to the standing category filter.\n * Does NOT clear that filter — use `setActiveCategories([])`.\n */\n clearHighlight: () => void;\n /** The effective highlighted node ids, or null when nothing is highlighted. */\n getHighlight: () => string[] | null;\n /** Headless snapshot of the legend. */\n getLegend: () => GraphLegendData | null;\n /** Set the active category filter declaratively (replaces legend toggle state). */\n setActiveCategories: (values: string[]) => void;\n /** Current active category values (empty = all active, no filter). */\n getActiveCategories: () => string[];\n}\n\n/** Handle exposed by Graph component via forwardRef. */\nexport interface GraphHandle {\n search: (query: string) => void;\n clearSearch: () => void;\n getSearchMatches: () => string[];\n zoomToFit: (opts?: CameraFlightOptions & { padding?: number }) => void;\n zoomToNode: (nodeId: string, opts?: CameraFlightOptions & { scale?: number }) => void;\n flyTo: (target: GraphFlyTarget, opts?: CameraFlightOptions) => void;\n centerAt: (x: number, y: number, opts?: CameraFlightOptions) => void;\n getCamera: () => GraphCamera;\n selectNode: (nodeId: string, opts?: { fly?: boolean } & CameraFlightOptions) => void;\n getSelectedNodes: () => string[];\n highlight: (target: GraphHighlightTarget, opts?: { dimOpacity?: number }) => void;\n clearHighlight: () => void;\n getHighlight: () => string[] | null;\n getLegend: () => GraphLegendData | null;\n setActiveCategories: (values: string[]) => void;\n getActiveCategories: () => string[];\n /** Update graph data, encoding, or presentation through the unified update path. */\n update: (spec: GraphSpec) => void;\n /** The underlying GraphInstance from the vanilla adapter. */\n instance: GraphInstance | null;\n}\n\n/**\n * Hook for imperative graph control.\n *\n * Usage:\n * ```tsx\n * const { ref, search, zoomToFit } = useGraph();\n * return <Graph ref={ref} spec={spec} />;\n * ```\n */\nexport function useGraph(): UseGraphReturn {\n const ref = useRef<GraphHandle | null>(null);\n\n const search = useCallback((query: string) => {\n ref.current?.search(query);\n }, []);\n\n const clearSearch = useCallback(() => {\n ref.current?.clearSearch();\n }, []);\n\n const getSearchMatches = useCallback((): string[] => {\n return ref.current?.getSearchMatches() ?? [];\n }, []);\n\n const zoomToFit = useCallback((opts?: CameraFlightOptions & { padding?: number }) => {\n ref.current?.zoomToFit(opts);\n }, []);\n\n const zoomToNode = useCallback(\n (nodeId: string, opts?: CameraFlightOptions & { scale?: number }) => {\n ref.current?.zoomToNode(nodeId, opts);\n },\n [],\n );\n\n const flyTo = useCallback((target: GraphFlyTarget, opts?: CameraFlightOptions) => {\n ref.current?.flyTo(target, opts);\n }, []);\n\n const centerAt = useCallback((x: number, y: number, opts?: CameraFlightOptions) => {\n ref.current?.centerAt(x, y, opts);\n }, []);\n\n const getCamera = useCallback((): GraphCamera => {\n return ref.current?.getCamera() ?? { x: 0, y: 0, k: 1 };\n }, []);\n\n const selectNode = useCallback(\n (nodeId: string, opts?: { fly?: boolean } & CameraFlightOptions) => {\n ref.current?.selectNode(nodeId, opts);\n },\n [],\n );\n\n const getSelectedNodes = useCallback((): string[] => {\n return ref.current?.getSelectedNodes() ?? [];\n }, []);\n\n const highlight = useCallback((target: GraphHighlightTarget, opts?: { dimOpacity?: number }) => {\n ref.current?.highlight(target, opts);\n }, []);\n\n const clearHighlight = useCallback(() => {\n ref.current?.clearHighlight();\n }, []);\n\n const getHighlight = useCallback((): string[] | null => {\n return ref.current?.getHighlight() ?? null;\n }, []);\n\n const getLegend = useCallback((): GraphLegendData | null => {\n return ref.current?.getLegend() ?? null;\n }, []);\n\n const setActiveCategories = useCallback((values: string[]) => {\n ref.current?.setActiveCategories(values);\n }, []);\n\n const getActiveCategories = useCallback((): string[] => {\n return ref.current?.getActiveCategories() ?? [];\n }, []);\n\n return {\n ref,\n search,\n clearSearch,\n getSearchMatches,\n zoomToFit,\n zoomToNode,\n flyTo,\n centerAt,\n getCamera,\n selectNode,\n getSelectedNodes,\n highlight,\n clearHighlight,\n getHighlight,\n getLegend,\n setActiveCategories,\n getActiveCategories,\n };\n}\n","/**\n * useTable: hook for manual table lifecycle control.\n *\n * Attaches to a container ref, mounts a vanilla table instance,\n * and exposes the instance and current state.\n */\n\nimport type { TableSpec } from '@opendata-ai/openchart-core';\nimport {\n createTable,\n type TableInstance,\n type TableMountOptions,\n type TableState,\n} from '@opendata-ai/openchart-vanilla';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nexport interface UseTableReturn {\n /** Ref to attach to the container div. */\n ref: React.RefObject<HTMLDivElement | null>;\n /** The table instance (null until mounted). */\n table: TableInstance | null;\n /** The current table state (sort, search, page). */\n state: TableState;\n}\n\n/**\n * Hook for manual table lifecycle control.\n *\n * Attach the returned ref to a container div. The table mounts\n * automatically and updates when the spec changes.\n *\n * @param spec - The table spec.\n * @param options - Mount options.\n * @returns { ref, table, state }\n */\nexport function useTable(spec: TableSpec, options?: TableMountOptions): UseTableReturn {\n const ref = useRef<HTMLDivElement | null>(null);\n const tableRef = useRef<TableInstance | null>(null);\n const [state, setState] = useState<TableState>({\n sort: null,\n search: '',\n page: 0,\n });\n\n const originalOnStateChange = options?.onStateChange;\n\n const handleStateChange = useCallback(\n (newState: TableState) => {\n setState(newState);\n originalOnStateChange?.(newState);\n },\n [originalOnStateChange],\n );\n\n // Mount / unmount\n useEffect(() => {\n const container = ref.current;\n if (!container) return;\n\n const mountOpts: TableMountOptions = {\n ...options,\n onStateChange: handleStateChange,\n };\n\n const table = createTable(container, spec, mountOpts);\n tableRef.current = table;\n setState(table.getState());\n\n return () => {\n table.destroy();\n tableRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n options?.theme,\n options?.darkMode,\n options?.onRowClick,\n options?.autoResize,\n handleStateChange,\n options,\n spec,\n ]);\n\n // Update on spec change\n useEffect(() => {\n const table = tableRef.current;\n if (!table) return;\n\n table.update(spec);\n setState(table.getState());\n }, [spec]);\n\n return {\n ref,\n table: tableRef.current,\n state,\n };\n}\n","/**\n * useTableState: managed state hook for controlled table usage.\n *\n * Provides individual sort/search/page state with setters and a\n * resetState function to return to initial values.\n */\n\nimport type { SortState } from '@opendata-ai/openchart-core';\nimport { useCallback, useState } from 'react';\n\nexport interface UseTableStateReturn {\n sort: SortState | null;\n setSort: (sort: SortState | null) => void;\n search: string;\n setSearch: (query: string) => void;\n page: number;\n setPage: (page: number) => void;\n resetState: () => void;\n}\n\nexport interface UseTableStateOptions {\n sort?: SortState | null;\n search?: string;\n page?: number;\n}\n\n/**\n * Hook for managing table state (sort, search, page).\n *\n * Use with the DataTable component's controlled props:\n * ```tsx\n * const { sort, search, page, setSort, setSearch, setPage } = useTableState();\n * <DataTable\n * spec={spec}\n * sort={sort}\n * search={search}\n * page={page}\n * onSortChange={setSort}\n * onSearchChange={setSearch}\n * onPageChange={setPage}\n * />\n * ```\n */\nexport function useTableState(initialState?: UseTableStateOptions): UseTableStateReturn {\n const [sort, setSortInternal] = useState<SortState | null>(initialState?.sort ?? null);\n const [search, setSearchInternal] = useState(initialState?.search ?? '');\n const [page, setPageInternal] = useState(initialState?.page ?? 0);\n\n const setSort = useCallback((newSort: SortState | null) => {\n setSortInternal(newSort);\n }, []);\n\n const setSearch = useCallback((query: string) => {\n setSearchInternal(query);\n }, []);\n\n const setPage = useCallback((newPage: number) => {\n setPageInternal(newPage);\n }, []);\n\n const resetState = useCallback(() => {\n setSortInternal(initialState?.sort ?? null);\n setSearchInternal(initialState?.search ?? '');\n setPageInternal(initialState?.page ?? 0);\n }, [initialState?.sort, initialState?.search, initialState?.page]);\n\n return {\n sort,\n setSort,\n search,\n setSearch,\n page,\n setPage,\n resetState,\n };\n}\n","import type { DarkMode, RaceFrame, RaceSpec, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createRace,\n type RaceInstance,\n type RaceMountOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\n/** Options and callbacks for a mounted race chart. */\nexport interface RaceProps {\n spec: RaceSpec;\n theme?: ThemeConfig;\n darkMode?: DarkMode;\n className?: string;\n style?: CSSProperties;\n autoResize?: boolean;\n watermark?: boolean;\n onWarn?: RaceMountOptions['onWarn'];\n onPeriod?: (period: RaceFrame['period']) => void;\n}\n\n/** Ref handle for imperative race playback. */\nexport interface RaceHandle {\n readonly instance: RaceInstance | null;\n}\n\n/** Render an interactive race chart. */\nexport const Race = /* @__PURE__ */ forwardRef<RaceHandle, RaceProps>(function Race(\n { spec, theme, darkMode, className, style, autoResize, watermark, onWarn, onPeriod },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const mounted = useRef<{\n instance: RaceInstance;\n optionsKey: string;\n themeKey: string;\n specKey: string;\n } | null>(null);\n const warnRef = useRef(onWarn);\n useEffect(() => {\n warnRef.current = onWarn;\n }, [onWarn]);\n\n const options = useMemo<RaceMountOptions>(\n () => ({\n theme: mergeThemeConfig(contextTheme, theme),\n darkMode: resolvedDarkMode,\n autoResize,\n watermark,\n onWarn: (message) => (warnRef.current ?? console.warn)(message),\n }),\n [contextTheme, theme, resolvedDarkMode, autoResize, watermark],\n );\n const optionsKey = JSON.stringify({ autoResize, watermark });\n const themeKey = JSON.stringify({ theme: options.theme, darkMode: options.darkMode });\n\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return mounted.current?.instance ?? null;\n },\n }),\n [],\n );\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const current = mounted.current;\n const specKey = JSON.stringify(spec);\n if (current?.optionsKey === optionsKey) {\n if (specKey !== current.specKey) {\n current.instance.update(spec);\n current.specKey = specKey;\n }\n if (themeKey !== current.themeKey) {\n current.instance.setTheme(options);\n current.themeKey = themeKey;\n }\n return;\n }\n\n const state = current?.instance.getState();\n const instance = createRace(container, spec, { ...options, initialState: state });\n current?.instance.destroy();\n if (state) instance.resize();\n mounted.current = { instance, optionsKey, themeKey, specKey };\n }, [spec, options, optionsKey, themeKey]);\n\n useEffect(() => {\n const current = mounted.current;\n if (current?.optionsKey === optionsKey && onPeriod)\n return current.instance.on('period', onPeriod);\n }, [optionsKey, onPeriod]);\n\n useEffect(\n () => () => {\n mounted.current?.instance.destroy();\n mounted.current = null;\n },\n [],\n );\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-root ${className}` : 'oc-root'}\n style={style}\n />\n );\n});\n","/**\n * React Sankey component: thin wrapper around the vanilla adapter.\n *\n * Mounts a sankey instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createSankey() function.\n *\n * Supports forwardRef for imperative control via the instance getter.\n */\n\nimport type { DarkMode, SankeySpec, ThemeConfig } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createSankey,\n type SankeyInstance,\n type SankeyMountOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface SankeyProps {\n /** The sankey spec to render. */\n spec: SankeySpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Callback when a node is clicked. */\n onNodeClick?: (node: Record<string, unknown>) => void;\n /** Callback when a link is clicked. */\n onLinkClick?: (link: Record<string, unknown>) => void;\n /** Callback when a node is hovered (null when hover ends). */\n onNodeHover?: (node: Record<string, unknown> | null) => void;\n /** Callback when a link is hovered (null when hover ends). */\n onLinkHover?: (link: Record<string, unknown> | null) => void;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\nexport interface SankeyHandle {\n /** The underlying sankey instance (null until mounted). */\n readonly instance: SankeyInstance | null;\n}\n\n/**\n * React component that renders a sankey diagram from a SankeySpec.\n *\n * Uses the vanilla adapter internally. The spec is compiled and rendered\n * as SVG inside a wrapper div. Spec changes trigger re-renders via the\n * vanilla adapter's update() method.\n */\nexport const Sankey = /* @__PURE__ */ forwardRef<SankeyHandle, SankeyProps>(function Sankey(\n {\n spec,\n theme: themeProp,\n darkMode,\n onNodeClick,\n onLinkClick,\n onNodeHover,\n onLinkHover,\n className,\n style,\n },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<SankeyInstance | null>(null);\n const specRef = useRef<string>('');\n\n // Store event handlers in refs so they don't trigger recreation.\n const handlersRef = useRef<{\n onNodeClick?: SankeyProps['onNodeClick'];\n onLinkClick?: SankeyProps['onLinkClick'];\n onNodeHover?: SankeyProps['onNodeHover'];\n onLinkHover?: SankeyProps['onLinkHover'];\n }>({});\n handlersRef.current = {\n onNodeClick,\n onLinkClick,\n onNodeHover,\n onLinkHover,\n };\n\n // Stable callback wrappers that read from refs\n const stableOnNodeClick = useCallback(\n (node: Record<string, unknown>) => handlersRef.current.onNodeClick?.(node),\n [],\n );\n const stableOnLinkClick = useCallback(\n (link: Record<string, unknown>) => handlersRef.current.onLinkClick?.(link),\n [],\n );\n const stableOnNodeHover = useCallback(\n (node: Record<string, unknown> | null) => handlersRef.current.onNodeHover?.(node),\n [],\n );\n const stableOnLinkHover = useCallback(\n (link: Record<string, unknown> | null) => handlersRef.current.onLinkHover?.(link),\n [],\n );\n\n // Expose imperative handle\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return instanceRef.current;\n },\n }),\n [],\n );\n\n // Mount sankey and recreate when theme/darkMode change.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: SankeyMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onNodeClick: stableOnNodeClick,\n onLinkClick: stableOnLinkClick,\n onNodeHover: stableOnNodeHover,\n onLinkHover: stableOnLinkHover,\n autoResize: true,\n };\n\n instanceRef.current = createSankey(container, spec, options);\n specRef.current = JSON.stringify(spec);\n\n return () => {\n instanceRef.current?.destroy();\n instanceRef.current = null;\n };\n }, [\n theme,\n resolvedDarkMode,\n stableOnNodeClick,\n stableOnLinkClick,\n stableOnNodeHover,\n stableOnLinkHover,\n ]);\n\n // Update sankey when spec changes.\n useEffect(() => {\n const instance = instanceRef.current;\n if (!instance) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n\n specRef.current = specString;\n instance.update(spec);\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-sankey-root ${className}` : 'oc-sankey-root'}\n style={style}\n />\n );\n});\n","/**\n * React TileMap component: thin wrapper around the vanilla adapter.\n *\n * Mounts a tilemap instance on render, updates when spec changes,\n * and cleans up on unmount. All heavy lifting is done by the vanilla\n * createTileMap() function.\n *\n * Supports forwardRef for imperative control via the instance getter.\n */\n\nimport type { DarkMode, ThemeConfig, TileMapSpec } from '@opendata-ai/openchart-core';\nimport { mergeThemeConfig } from '@opendata-ai/openchart-core';\nimport {\n createTileMap,\n type TileMapInstance,\n type TileMapMountOptions,\n} from '@opendata-ai/openchart-vanilla';\nimport {\n type CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { useVizDarkMode, useVizTheme } from './ThemeContext';\n\nexport interface TileMapProps {\n /** The tilemap spec to render. */\n spec: TileMapSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** Callback when a tile is clicked. */\n onTileClick?: (tile: {\n stateCode: string;\n stateName: string;\n value: number | null;\n data: Record<string, unknown>;\n }) => void;\n /** Callback when a tile is hovered (null when hover ends). */\n onTileHover?: (\n tile: {\n stateCode: string;\n stateName: string;\n value: number | null;\n data: Record<string, unknown>;\n } | null,\n ) => void;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\nexport interface TileMapHandle {\n /** The underlying tilemap instance (null until mounted). */\n readonly instance: TileMapInstance | null;\n}\n\n/**\n * React component that renders a tilemap from a TileMapSpec.\n *\n * Uses the vanilla adapter internally. The spec is compiled and rendered\n * as SVG inside a wrapper div. Spec changes trigger re-renders via the\n * vanilla adapter's update() method.\n */\nexport const TileMap = /* @__PURE__ */ forwardRef<TileMapHandle, TileMapProps>(function TileMap(\n { spec, theme: themeProp, darkMode, onTileClick, onTileHover, className, style },\n ref,\n) {\n const contextTheme = useVizTheme();\n const contextDarkMode = useVizDarkMode();\n const theme = useMemo(() => mergeThemeConfig(contextTheme, themeProp), [contextTheme, themeProp]);\n const resolvedDarkMode = darkMode ?? contextDarkMode;\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<TileMapInstance | null>(null);\n const specRef = useRef<string>('');\n\n // Store event handlers in refs so they don't trigger recreation.\n const handlersRef = useRef<{\n onTileClick?: TileMapProps['onTileClick'];\n onTileHover?: TileMapProps['onTileHover'];\n }>({});\n handlersRef.current = {\n onTileClick,\n onTileHover,\n };\n\n // Stable callback wrappers that read from refs\n const stableOnTileClick = useCallback(\n (tile: {\n stateCode: string;\n stateName: string;\n value: number | null;\n data: Record<string, unknown>;\n }) => handlersRef.current.onTileClick?.(tile),\n [],\n );\n const stableOnTileHover = useCallback(\n (\n tile: {\n stateCode: string;\n stateName: string;\n value: number | null;\n data: Record<string, unknown>;\n } | null,\n ) => handlersRef.current.onTileHover?.(tile),\n [],\n );\n\n // Expose imperative handle\n useImperativeHandle(\n ref,\n () => ({\n get instance() {\n return instanceRef.current;\n },\n }),\n [],\n );\n\n // Mount tilemap and recreate when theme/darkMode change.\n // biome-ignore lint/correctness/useExhaustiveDependencies: spec intentionally excluded - spec changes handled via update() in Effect 2\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const options: TileMapMountOptions = {\n theme,\n darkMode: resolvedDarkMode,\n onTileClick: stableOnTileClick,\n onTileHover: stableOnTileHover,\n autoResize: true,\n };\n\n instanceRef.current = createTileMap(container, spec, options);\n specRef.current = JSON.stringify(spec);\n\n return () => {\n instanceRef.current?.destroy();\n instanceRef.current = null;\n };\n }, [theme, resolvedDarkMode, stableOnTileClick, stableOnTileHover]);\n\n // Update tilemap when spec changes.\n useEffect(() => {\n const instance = instanceRef.current;\n if (!instance) return;\n\n const specString = JSON.stringify(spec);\n if (specString === specRef.current) return;\n\n specRef.current = specString;\n instance.update(spec);\n }, [spec]);\n\n return (\n <div\n ref={containerRef}\n className={className ? `oc-tilemap-root ${className}` : 'oc-tilemap-root'}\n style={style}\n />\n );\n});\n","/**\n * Visualization routing component: renders Chart, DataTable, or Graph\n * based on the spec type. Use this when rendering arbitrary VizSpec values.\n *\n * For event handlers, use the specific component (Chart, DataTable, Graph) directly.\n */\n\nimport type { DarkMode, ThemeConfig, VizSpec } from '@opendata-ai/openchart-core';\nimport {\n isBarListSpec,\n isGeoMapSpec,\n isGraphSpec,\n isRaceSpec,\n isSankeySpec,\n isTableSpec,\n isTileMapSpec,\n} from '@opendata-ai/openchart-core';\nimport type { CSSProperties } from 'react';\nimport { BarList } from './BarList';\nimport { Chart } from './Chart';\nimport { DataTable } from './DataTable';\nimport { GeoMap } from './GeoMap';\nimport { Graph } from './Graph';\nimport { Race } from './Race';\nimport { Sankey } from './Sankey';\nimport { TileMap } from './TileMap';\n\nexport interface VisualizationProps {\n /** The visualization spec to render. */\n spec: VizSpec;\n /** Theme overrides. */\n theme?: ThemeConfig;\n /** Dark mode: \"auto\", \"force\", or \"off\". */\n darkMode?: DarkMode;\n /** CSS class name for the wrapper div. */\n className?: string;\n /** Inline styles for the wrapper div. */\n style?: CSSProperties;\n}\n\n/**\n * Routes a VizSpec to the appropriate rendering component.\n *\n * Accepts any VizSpec and renders it with the correct component based on the\n * spec's type field. For event handlers, use Chart, DataTable, or Graph directly.\n */\nexport function Visualization({ spec, theme, darkMode, className, style }: VisualizationProps) {\n if (isTableSpec(spec)) {\n return (\n <DataTable\n spec={spec}\n theme={theme}\n darkMode={darkMode}\n className={className}\n style={style}\n />\n );\n }\n if (isGraphSpec(spec)) {\n return (\n <Graph spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isSankeySpec(spec)) {\n return (\n <Sankey spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isTileMapSpec(spec)) {\n return (\n <TileMap spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isBarListSpec(spec)) {\n return (\n <BarList spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isGeoMapSpec(spec)) {\n return (\n <GeoMap spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n if (isRaceSpec(spec)) {\n return (\n <Race spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n }\n return (\n <Chart spec={spec} theme={theme} darkMode={darkMode} className={className} style={style} />\n );\n}\n"],"mappings":";AAcA,cAAc;AAiBd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA0BP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACrEP,SAAS,wBAAwB;AACjC;AAAA,EAGE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACdP,SAAS,eAA+B,kBAAkB;AA2BpD;AAzBN,IAAM,kBAAkC,8BAAuC,MAAS;AACxF,IAAM,qBAAqC,8BAAoC,MAAS;AAGjF,SAAS,cAAuC;AACrD,SAAO,WAAW,eAAe;AACnC;AAGO,SAAS,iBAAuC;AACrD,SAAO,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AAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,MAAI,YAAY,IAAI,GAAG;AACrB,WACE,gBAAAA,MAAC,SAAM,MAAY,OAAc,UAAoB,WAAsB,OAAc;AAAA,EAE7F;AACA,MAAI,aAAa,IAAI,GAAG;AACtB,WACE,gBAAAA,MAAC,UAAO,MAAY,OAAc,UAAoB,WAAsB,OAAc;AAAA,EAE9F;AACA,MAAI,cAAc,IAAI,GAAG;AACvB,WACE,gBAAAA,MAAC,WAAQ,MAAY,OAAc,UAAoB,WAAsB,OAAc;AAAA,EAE/F;AACA,MAAI,cAAc,IAAI,GAAG;AACvB,WACE,gBAAAA,MAAC,WAAQ,MAAY,OAAc,UAAoB,WAAsB,OAAc;AAAA,EAE/F;AACA,MAAI,aAAa,IAAI,GAAG;AACtB,WACE,gBAAAA,MAAC,UAAO,MAAY,OAAc,UAAoB,WAAsB,OAAc;AAAA,EAE9F;AACA,MAAI,WAAW,IAAI,GAAG;AACpB,WACE,gBAAAA,MAAC,QAAK,MAAY,OAAc,UAAoB,WAAsB,OAAc;AAAA,EAE5F;AACA,SACE,gBAAAA,MAAC,SAAM,MAAY,OAAc,UAAoB,WAAsB,OAAc;AAE7F;","names":["jsx","BarList","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","useRef","useMemo","mergeThemeConfig","useCallback","useImperativeHandle","useEffect","forwardRef","useEffect","useImperativeHandle","useRef","jsx","mergeThemeConfig","useCallback","useEffect","useMemo","useRef","jsx","useMemo","mergeThemeConfig","useRef","useCallback","useEffect","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","GeoMap","useMemo","mergeThemeConfig","useRef","useCallback","useImperativeHandle","useEffect","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","Graph","useMemo","mergeThemeConfig","useRef","useCallback","useImperativeHandle","spec","useEffect","createChart","useEffect","useRef","useCallback","useRef","createTable","useCallback","useEffect","useRef","useState","useCallback","useState","mergeThemeConfig","forwardRef","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","Race","useRef","useEffect","useMemo","mergeThemeConfig","useImperativeHandle","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","Sankey","useMemo","mergeThemeConfig","useRef","useCallback","useImperativeHandle","useEffect","mergeThemeConfig","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","jsx","forwardRef","TileMap","useMemo","mergeThemeConfig","useRef","useCallback","useImperativeHandle","useEffect","jsx"]}
|