@opendata-ai/openchart-vue 8.9.1 → 9.0.0-rc.1

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/README.md CHANGED
@@ -123,7 +123,7 @@ import { VizThemeProvider, Chart } from '@opendata-ai/openchart-vue';
123
123
 
124
124
  `darkMode` accepts `"auto"` (follows system preference), `"force"` (always dark), or `"off"` (always light).
125
125
 
126
- For one-off overrides, pass `dark-mode` or `theme` directly on an individual component. Component-level props take priority over the provider.
126
+ For one-off overrides, pass `dark-mode` or `theme` directly on an individual component. Component-level props take priority over the provider: a component `theme` deep-merges over the provider theme (which itself merges over the spec `theme`), and a component dark mode replaces the provider's.
127
127
 
128
128
  ## Composables
129
129
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { BarListSpec, ThemeConfig, DarkMode, ChartSpec, LayerSpec, GraphSpec, EditTransaction, ElementRef, MarkEvent, Annotation, TextAnnotation, AnnotationOffset, ElementEdit, GeoMapSpec, ChartLayout, TableSpec, SortState, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
1
+ import { BarListSpec, ThemeConfig, DarkMode, ChartSpec, LayerSpec, EditTransaction, ElementRef, ReaderChangeMeta, MarkEvent, Annotation, GeoMapSpec, ChartLayout, GraphSpec, TableSpec, SortState, GeoReaderSelection, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
2
2
  export * from '@opendata-ai/openchart-core';
3
- import { MountOptions, ChartInstance, CameraFlightOptions, GraphFlyTarget, GraphCamera, GraphHighlightTarget, GraphLegendData, GraphInstance, TableInstance, TableState, TableMountOptions, GeoMapMarkEvent, Camera, GraphTooltipFormatter } from '@opendata-ai/openchart-vanilla';
4
- export { JPGExportOptions, PNGExportOptions, SVGExportOptions, SpecSequenceOptions, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts, exportSpecSequence } from '@opendata-ai/openchart-vanilla';
3
+ import { ReaderPresentationOptions, ChartReaderSelection, InteractionMode, MountOptions, ChartInstance, CameraFlightOptions, GraphFlyTarget, GraphCamera, GraphHighlightTarget, GraphLegendData, GraphInstance, TableInstance, TableState, TableMountOptions, GeoReaderOptions, GeoMapMountOptions, GeoMapMarkEvent, Camera, GeoMapCameraChangeMeta, GraphTooltipFormatter } from '@opendata-ai/openchart-vanilla';
4
+ export { GeoMapCameraChangeMeta, InteractionMode, JPGExportOptions, PNGExportOptions, SVGExportOptions, SpecSequenceOptions, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts, exportSpecSequence } from '@opendata-ai/openchart-vanilla';
5
5
  export { ChartRenderer, CompileResult, CompiledGraphEdge, CompiledGraphNode, GraphCompilation, NormalizedBarListSpec, NormalizedChartSpec, NormalizedChrome, NormalizedGeoMapSpec, NormalizedGraphSpec, NormalizedSankeySpec, NormalizedSpec, NormalizedTableSpec, NormalizedTileMapSpec, SimulationConfig, ValidationError, ValidationErrorCode, ValidationResult, clearRenderers, compile, compileBarList, compileChart, compileGeoMap, compileGraph, compileSankey, compileTable, compileTileMap, getChartRenderer, normalizeSpec, registerChartRenderer, validateSpec } from '@opendata-ai/openchart-engine';
6
6
  import * as vue from 'vue';
7
7
  import { PropType, CSSProperties, VNode, Ref, ShallowRef, InjectionKey, ComputedRef } from 'vue';
@@ -77,22 +77,37 @@ declare const BarList: vue.DefineComponent<vue.ExtractPropTypes<{
77
77
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
78
78
 
79
79
  interface ChartProps {
80
- spec: ChartSpec | LayerSpec | GraphSpec;
80
+ reader?: false | ReaderPresentationOptions;
81
+ readerSelection?: ChartReaderSelection;
82
+ /** The chart spec. Graph specs render through `<Graph />` or `<Visualization />`. */
83
+ spec: ChartSpec | LayerSpec;
81
84
  theme?: ThemeConfig;
82
85
  darkMode?: DarkMode;
83
86
  /** Rendering backend for point marks; see the vanilla `MountOptions.renderer`. */
84
87
  renderer?: 'auto' | 'svg' | 'canvas';
88
+ /** Quiet row inspection for simple horizontal bars. */
89
+ rowHover?: boolean;
85
90
  autoResize?: boolean;
86
- /** @deprecated Use autoResize. */
87
- responsive?: boolean;
88
91
  revision?: string | number;
89
- onEditTransaction?: (tx: EditTransaction) => void;
92
+ /** Interaction mode; inferred from the edit/select listeners when omitted. */
93
+ interaction?: InteractionMode;
94
+ onEdit?: (tx: EditTransaction) => void;
95
+ onSelect?: (element: ElementRef) => void;
96
+ onDeselect?: (element: ElementRef) => void;
90
97
  class?: string;
91
98
  style?: string | CSSProperties;
92
99
  }
93
100
  declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
101
+ reader: {
102
+ type: PropType<false | ReaderPresentationOptions>;
103
+ default: undefined;
104
+ };
105
+ readerSelection: {
106
+ type: PropType<ChartReaderSelection>;
107
+ default: undefined;
108
+ };
94
109
  spec: {
95
- type: PropType<ChartSpec | LayerSpec | GraphSpec>;
110
+ type: PropType<ChartSpec | LayerSpec>;
96
111
  required: true;
97
112
  };
98
113
  theme: {
@@ -107,15 +122,23 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
107
122
  type: PropType<"auto" | "svg" | "canvas">;
108
123
  default: undefined;
109
124
  };
110
- onEditTransaction: {
125
+ onEdit: {
111
126
  type: PropType<(tx: EditTransaction) => void>;
112
127
  default: undefined;
113
128
  };
114
- autoResize: {
129
+ onSelect: {
130
+ type: PropType<(element: ElementRef) => void>;
131
+ default: undefined;
132
+ };
133
+ onDeselect: {
134
+ type: PropType<(element: ElementRef) => void>;
135
+ default: undefined;
136
+ };
137
+ rowHover: {
115
138
  type: BooleanConstructor;
116
139
  default: undefined;
117
140
  };
118
- responsive: {
141
+ autoResize: {
119
142
  type: BooleanConstructor;
120
143
  default: undefined;
121
144
  };
@@ -139,30 +162,35 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
139
162
  type: PropType<string[] | null>;
140
163
  default: undefined;
141
164
  };
142
- editable: {
143
- type: PropType<boolean>;
165
+ interaction: {
166
+ type: PropType<InteractionMode>;
144
167
  default: undefined;
145
168
  };
146
169
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
147
170
  [key: string]: any;
148
171
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
172
+ 'reader-change': (_selection: ChartReaderSelection, _meta: ReaderChangeMeta) => true;
149
173
  'mark-click': (_event: MarkEvent) => true;
150
174
  'mark-hover': (_event: MarkEvent) => true;
151
175
  'mark-leave': () => true;
152
176
  'legend-toggle': (_series: string, _visible: boolean) => true;
153
177
  'annotation-click': (_annotation: Annotation, _event: MouseEvent, _element: ElementRef) => true;
154
- /** @deprecated Use edit-transaction. */
155
- 'annotation-edit': (_annotation: TextAnnotation, _updatedOffset: AnnotationOffset) => true;
156
- edit: (_edit: ElementEdit) => true;
157
- select: (_element: ElementRef) => true;
158
- deselect: (_element: ElementRef) => true;
159
- /** @deprecated Use edit-transaction. */
160
- 'text-edit': (_element: ElementRef, _oldText: string, _newText: string) => true;
161
- /** @deprecated Has no effect; use mark-click. */
162
- 'data-point-click': (_data: Record<string, unknown>) => true;
178
+ 'highlight-change': (_values: string[]) => true;
179
+ reveal: (_guess: Array<{
180
+ x: string | number;
181
+ y: number;
182
+ }>) => true;
163
183
  }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
184
+ reader: {
185
+ type: PropType<false | ReaderPresentationOptions>;
186
+ default: undefined;
187
+ };
188
+ readerSelection: {
189
+ type: PropType<ChartReaderSelection>;
190
+ default: undefined;
191
+ };
164
192
  spec: {
165
- type: PropType<ChartSpec | LayerSpec | GraphSpec>;
193
+ type: PropType<ChartSpec | LayerSpec>;
166
194
  required: true;
167
195
  };
168
196
  theme: {
@@ -177,15 +205,23 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
177
205
  type: PropType<"auto" | "svg" | "canvas">;
178
206
  default: undefined;
179
207
  };
180
- onEditTransaction: {
208
+ onEdit: {
181
209
  type: PropType<(tx: EditTransaction) => void>;
182
210
  default: undefined;
183
211
  };
184
- autoResize: {
212
+ onSelect: {
213
+ type: PropType<(element: ElementRef) => void>;
214
+ default: undefined;
215
+ };
216
+ onDeselect: {
217
+ type: PropType<(element: ElementRef) => void>;
218
+ default: undefined;
219
+ };
220
+ rowHover: {
185
221
  type: BooleanConstructor;
186
222
  default: undefined;
187
223
  };
188
- responsive: {
224
+ autoResize: {
189
225
  type: BooleanConstructor;
190
226
  default: undefined;
191
227
  };
@@ -209,39 +245,43 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
209
245
  type: PropType<string[] | null>;
210
246
  default: undefined;
211
247
  };
212
- editable: {
213
- type: PropType<boolean>;
248
+ interaction: {
249
+ type: PropType<InteractionMode>;
214
250
  default: undefined;
215
251
  };
216
252
  }>> & Readonly<{
217
- onSelect?: ((_element: ElementRef) => any) | undefined;
253
+ "onReader-change"?: ((_selection: ChartReaderSelection, _meta: ReaderChangeMeta) => any) | undefined;
218
254
  "onMark-click"?: ((_event: MarkEvent) => any) | undefined;
219
255
  "onMark-hover"?: ((_event: MarkEvent) => any) | undefined;
220
256
  "onMark-leave"?: (() => any) | undefined;
221
257
  "onLegend-toggle"?: ((_series: string, _visible: boolean) => any) | undefined;
222
258
  "onAnnotation-click"?: ((_annotation: Annotation, _event: MouseEvent, _element: ElementRef) => any) | undefined;
223
- "onAnnotation-edit"?: ((_annotation: TextAnnotation, _updatedOffset: AnnotationOffset) => any) | undefined;
224
- onEdit?: ((_edit: ElementEdit) => any) | undefined;
225
- onDeselect?: ((_element: ElementRef) => any) | undefined;
226
- "onText-edit"?: ((_element: ElementRef, _oldText: string, _newText: string) => any) | undefined;
227
- "onData-point-click"?: ((_data: Record<string, unknown>) => any) | undefined;
259
+ "onHighlight-change"?: ((_values: string[]) => any) | undefined;
260
+ onReveal?: ((_guess: {
261
+ x: string | number;
262
+ y: number;
263
+ }[]) => any) | undefined;
228
264
  }>, {
229
265
  theme: ThemeConfig;
230
266
  darkMode: DarkMode;
231
267
  class: string;
232
268
  style: string | CSSProperties;
269
+ onSelect: (element: ElementRef) => void;
270
+ reader: false | ReaderPresentationOptions;
271
+ readerSelection: ChartReaderSelection;
233
272
  renderer: "auto" | "canvas" | "svg";
234
- onEditTransaction: (tx: EditTransaction) => void;
273
+ onEdit: (tx: EditTransaction) => void;
274
+ onDeselect: (element: ElementRef) => void;
275
+ rowHover: boolean;
235
276
  autoResize: boolean;
236
- responsive: boolean;
237
277
  revision: string | number;
238
278
  selectedElement: ElementRef;
239
279
  highlight: string[] | null;
240
- editable: boolean;
280
+ interaction: InteractionMode;
241
281
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
242
282
 
243
283
  interface ChartStoryProps {
244
- spec: ChartSpec | LayerSpec | GraphSpec | GeoMapSpec;
284
+ spec: ChartSpec | LayerSpec | GeoMapSpec;
245
285
  steps: ChartStoryOptions['steps'];
246
286
  narrative?: VNode[];
247
287
  step?: number;
@@ -251,7 +291,7 @@ interface ChartStoryProps {
251
291
  }
252
292
  declare const ChartStory: vue.DefineComponent<vue.ExtractPropTypes<{
253
293
  spec: {
254
- type: PropType<ChartSpec | LayerSpec | GraphSpec | GeoMapSpec>;
294
+ type: PropType<ChartSpec | LayerSpec | GeoMapSpec>;
255
295
  required: true;
256
296
  };
257
297
  steps: {
@@ -282,7 +322,7 @@ declare const ChartStory: vue.DefineComponent<vue.ExtractPropTypes<{
282
322
  [key: string]: any;
283
323
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
284
324
  spec: {
285
- type: PropType<ChartSpec | LayerSpec | GraphSpec | GeoMapSpec>;
325
+ type: PropType<ChartSpec | LayerSpec | GeoMapSpec>;
286
326
  required: true;
287
327
  };
288
328
  steps: {
@@ -331,10 +371,8 @@ interface UseChartOptions {
331
371
  theme?: ThemeConfig;
332
372
  /** Dark mode setting. */
333
373
  darkMode?: DarkMode;
334
- /** Data point click handler. */
335
- onDataPointClick?: MountOptions['onDataPointClick'];
336
- /** Enable responsive resizing. Defaults to true. */
337
- responsive?: boolean;
374
+ /** Observe container resizes. Defaults to true. */
375
+ autoResize?: boolean;
338
376
  /** Rendering backend for point marks; see the vanilla `MountOptions.renderer`. */
339
377
  renderer?: MountOptions['renderer'];
340
378
  }
@@ -352,7 +390,7 @@ interface UseChartReturn {
352
390
  * Attach the returned containerRef to a container div via `ref="containerRef"`.
353
391
  * The chart mounts automatically and updates when the spec changes.
354
392
  */
355
- declare function useChart(spec: Ref<ChartSpec | LayerSpec | GraphSpec>, options?: UseChartOptions): UseChartReturn;
393
+ declare function useChart(spec: Ref<ChartSpec | LayerSpec>, options?: UseChartOptions): UseChartReturn;
356
394
 
357
395
  /**
358
396
  * useDarkMode: composable that resolves a DarkMode preference to a boolean.
@@ -404,8 +442,8 @@ interface GraphHandle {
404
442
  getLegend: () => GraphLegendData | null;
405
443
  setActiveCategories: (values: string[]) => void;
406
444
  getActiveCategories: () => string[];
407
- /** Re-compile encoding/legend/chrome without restarting the simulation. */
408
- updateVisuals: (spec: GraphSpec) => void;
445
+ /** Update graph data, encoding, or presentation through the unified update path. */
446
+ update: (spec: GraphSpec) => void;
409
447
  /** The underlying GraphInstance from the vanilla adapter. */
410
448
  instance: GraphInstance | null;
411
449
  }
@@ -662,6 +700,9 @@ declare const DataTable: vue.DefineComponent<vue.ExtractPropTypes<{
662
700
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
663
701
 
664
702
  interface GeoMapProps {
703
+ reader?: false | GeoReaderOptions;
704
+ readerSelection?: GeoReaderSelection;
705
+ labelInventory?: GeoMapMountOptions['labelInventory'];
665
706
  spec: GeoMapSpec;
666
707
  theme?: ThemeConfig;
667
708
  darkMode?: DarkMode;
@@ -669,6 +710,18 @@ interface GeoMapProps {
669
710
  style?: string | CSSProperties;
670
711
  }
671
712
  declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
713
+ reader: {
714
+ type: PropType<false | GeoReaderOptions>;
715
+ default: undefined;
716
+ };
717
+ readerSelection: {
718
+ type: PropType<GeoReaderSelection>;
719
+ default: undefined;
720
+ };
721
+ labelInventory: {
722
+ type: PropType<GeoMapMountOptions["labelInventory"]>;
723
+ default: undefined;
724
+ };
672
725
  spec: {
673
726
  type: PropType<GeoMapSpec>;
674
727
  required: true;
@@ -692,10 +745,23 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
692
745
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
693
746
  [key: string]: any;
694
747
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
748
+ 'reader-change': (_selection: GeoReaderSelection, _meta: ReaderChangeMeta) => true;
695
749
  'mark-click': (_event: GeoMapMarkEvent) => true;
696
750
  'mark-hover': (_event: GeoMapMarkEvent | null) => true;
697
- 'camera-change': (_camera: Camera) => true;
751
+ 'camera-change': (_camera: Camera, _meta?: GeoMapCameraChangeMeta) => true;
698
752
  }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
753
+ reader: {
754
+ type: PropType<false | GeoReaderOptions>;
755
+ default: undefined;
756
+ };
757
+ readerSelection: {
758
+ type: PropType<GeoReaderSelection>;
759
+ default: undefined;
760
+ };
761
+ labelInventory: {
762
+ type: PropType<GeoMapMountOptions["labelInventory"]>;
763
+ default: undefined;
764
+ };
699
765
  spec: {
700
766
  type: PropType<GeoMapSpec>;
701
767
  required: true;
@@ -717,14 +783,20 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
717
783
  default: undefined;
718
784
  };
719
785
  }>> & Readonly<{
786
+ "onReader-change"?: ((_selection: GeoReaderSelection, _meta: ReaderChangeMeta) => any) | undefined;
720
787
  "onMark-click"?: ((_event: GeoMapMarkEvent) => any) | undefined;
721
788
  "onMark-hover"?: ((_event: GeoMapMarkEvent | null) => any) | undefined;
722
- "onCamera-change"?: ((_camera: Camera) => any) | undefined;
789
+ "onCamera-change"?: ((_camera: Camera, _meta?: GeoMapCameraChangeMeta | undefined) => any) | undefined;
723
790
  }>, {
724
791
  theme: ThemeConfig;
725
792
  darkMode: DarkMode;
726
793
  class: string;
727
794
  style: string | CSSProperties;
795
+ reader: false | GeoReaderOptions;
796
+ readerSelection: GeoReaderSelection;
797
+ labelInventory: (false | {
798
+ container: HTMLElement;
799
+ }) | undefined;
728
800
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
729
801
 
730
802
  /** Tooltip prop: `false` off, `true` default, or an object with a formatter. */
@@ -839,6 +911,7 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
839
911
  };
840
912
  }>> & Readonly<{
841
913
  "onLegend-toggle"?: ((_activeValues: string[]) => any) | undefined;
914
+ "onHighlight-change"?: ((_nodeIds: string[] | null) => any) | undefined;
842
915
  "onCamera-change"?: ((_camera: GraphCamera) => any) | undefined;
843
916
  "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
844
917
  "onNode-double-click"?: ((_node: Record<string, unknown>) => any) | undefined;
@@ -849,7 +922,6 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
849
922
  field: string;
850
923
  value: string;
851
924
  } | null) => any) | undefined;
852
- "onHighlight-change"?: ((_nodeIds: string[] | null) => any) | undefined;
853
925
  }>, {
854
926
  theme: ThemeConfig;
855
927
  darkMode: DarkMode;