@opendata-ai/openchart-vue 8.9.0 → 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, 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,17 +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;
90
+ autoResize?: boolean;
91
+ revision?: string | number;
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;
85
97
  class?: string;
86
98
  style?: string | CSSProperties;
87
99
  }
88
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
+ };
89
109
  spec: {
90
- type: PropType<ChartSpec | LayerSpec | GraphSpec>;
110
+ type: PropType<ChartSpec | LayerSpec>;
91
111
  required: true;
92
112
  };
93
113
  theme: {
@@ -102,6 +122,30 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
102
122
  type: PropType<"auto" | "svg" | "canvas">;
103
123
  default: undefined;
104
124
  };
125
+ onEdit: {
126
+ type: PropType<(tx: EditTransaction) => void>;
127
+ default: undefined;
128
+ };
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: {
138
+ type: BooleanConstructor;
139
+ default: undefined;
140
+ };
141
+ autoResize: {
142
+ type: BooleanConstructor;
143
+ default: undefined;
144
+ };
145
+ revision: {
146
+ type: PropType<string | number>;
147
+ default: undefined;
148
+ };
105
149
  class: {
106
150
  type: StringConstructor;
107
151
  default: undefined;
@@ -118,27 +162,35 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
118
162
  type: PropType<string[] | null>;
119
163
  default: undefined;
120
164
  };
121
- editable: {
122
- type: PropType<boolean>;
165
+ interaction: {
166
+ type: PropType<InteractionMode>;
123
167
  default: undefined;
124
168
  };
125
169
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
126
170
  [key: string]: any;
127
171
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
172
+ 'reader-change': (_selection: ChartReaderSelection, _meta: ReaderChangeMeta) => true;
128
173
  'mark-click': (_event: MarkEvent) => true;
129
174
  'mark-hover': (_event: MarkEvent) => true;
130
175
  'mark-leave': () => true;
131
176
  'legend-toggle': (_series: string, _visible: boolean) => true;
132
- 'annotation-click': (_annotation: Annotation, _event: MouseEvent) => true;
133
- 'annotation-edit': (_annotation: TextAnnotation, _updatedOffset: AnnotationOffset) => true;
134
- edit: (_edit: ElementEdit) => true;
135
- select: (_element: ElementRef) => true;
136
- deselect: (_element: ElementRef) => true;
137
- 'text-edit': (_element: ElementRef, _oldText: string, _newText: string) => true;
138
- 'data-point-click': (_data: Record<string, unknown>) => true;
177
+ 'annotation-click': (_annotation: Annotation, _event: MouseEvent, _element: ElementRef) => true;
178
+ 'highlight-change': (_values: string[]) => true;
179
+ reveal: (_guess: Array<{
180
+ x: string | number;
181
+ y: number;
182
+ }>) => true;
139
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
+ };
140
192
  spec: {
141
- type: PropType<ChartSpec | LayerSpec | GraphSpec>;
193
+ type: PropType<ChartSpec | LayerSpec>;
142
194
  required: true;
143
195
  };
144
196
  theme: {
@@ -153,6 +205,30 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
153
205
  type: PropType<"auto" | "svg" | "canvas">;
154
206
  default: undefined;
155
207
  };
208
+ onEdit: {
209
+ type: PropType<(tx: EditTransaction) => void>;
210
+ default: undefined;
211
+ };
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: {
221
+ type: BooleanConstructor;
222
+ default: undefined;
223
+ };
224
+ autoResize: {
225
+ type: BooleanConstructor;
226
+ default: undefined;
227
+ };
228
+ revision: {
229
+ type: PropType<string | number>;
230
+ default: undefined;
231
+ };
156
232
  class: {
157
233
  type: StringConstructor;
158
234
  default: undefined;
@@ -169,35 +245,43 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
169
245
  type: PropType<string[] | null>;
170
246
  default: undefined;
171
247
  };
172
- editable: {
173
- type: PropType<boolean>;
248
+ interaction: {
249
+ type: PropType<InteractionMode>;
174
250
  default: undefined;
175
251
  };
176
252
  }>> & Readonly<{
177
- onSelect?: ((_element: ElementRef) => any) | undefined;
253
+ "onReader-change"?: ((_selection: ChartReaderSelection, _meta: ReaderChangeMeta) => any) | undefined;
178
254
  "onMark-click"?: ((_event: MarkEvent) => any) | undefined;
179
255
  "onMark-hover"?: ((_event: MarkEvent) => any) | undefined;
180
256
  "onMark-leave"?: (() => any) | undefined;
181
257
  "onLegend-toggle"?: ((_series: string, _visible: boolean) => any) | undefined;
182
- "onAnnotation-click"?: ((_annotation: Annotation, _event: MouseEvent) => any) | undefined;
183
- "onAnnotation-edit"?: ((_annotation: TextAnnotation, _updatedOffset: AnnotationOffset) => any) | undefined;
184
- onEdit?: ((_edit: ElementEdit) => any) | undefined;
185
- onDeselect?: ((_element: ElementRef) => any) | undefined;
186
- "onText-edit"?: ((_element: ElementRef, _oldText: string, _newText: string) => any) | undefined;
187
- "onData-point-click"?: ((_data: Record<string, unknown>) => any) | undefined;
258
+ "onAnnotation-click"?: ((_annotation: Annotation, _event: MouseEvent, _element: ElementRef) => any) | undefined;
259
+ "onHighlight-change"?: ((_values: string[]) => any) | undefined;
260
+ onReveal?: ((_guess: {
261
+ x: string | number;
262
+ y: number;
263
+ }[]) => any) | undefined;
188
264
  }>, {
189
265
  theme: ThemeConfig;
190
266
  darkMode: DarkMode;
191
267
  class: string;
192
268
  style: string | CSSProperties;
269
+ onSelect: (element: ElementRef) => void;
270
+ reader: false | ReaderPresentationOptions;
271
+ readerSelection: ChartReaderSelection;
193
272
  renderer: "auto" | "canvas" | "svg";
273
+ onEdit: (tx: EditTransaction) => void;
274
+ onDeselect: (element: ElementRef) => void;
275
+ rowHover: boolean;
276
+ autoResize: boolean;
277
+ revision: string | number;
194
278
  selectedElement: ElementRef;
195
279
  highlight: string[] | null;
196
- editable: boolean;
280
+ interaction: InteractionMode;
197
281
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
198
282
 
199
283
  interface ChartStoryProps {
200
- spec: ChartSpec | LayerSpec | GraphSpec | GeoMapSpec;
284
+ spec: ChartSpec | LayerSpec | GeoMapSpec;
201
285
  steps: ChartStoryOptions['steps'];
202
286
  narrative?: VNode[];
203
287
  step?: number;
@@ -207,7 +291,7 @@ interface ChartStoryProps {
207
291
  }
208
292
  declare const ChartStory: vue.DefineComponent<vue.ExtractPropTypes<{
209
293
  spec: {
210
- type: PropType<ChartSpec | LayerSpec | GraphSpec | GeoMapSpec>;
294
+ type: PropType<ChartSpec | LayerSpec | GeoMapSpec>;
211
295
  required: true;
212
296
  };
213
297
  steps: {
@@ -238,7 +322,7 @@ declare const ChartStory: vue.DefineComponent<vue.ExtractPropTypes<{
238
322
  [key: string]: any;
239
323
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
240
324
  spec: {
241
- type: PropType<ChartSpec | LayerSpec | GraphSpec | GeoMapSpec>;
325
+ type: PropType<ChartSpec | LayerSpec | GeoMapSpec>;
242
326
  required: true;
243
327
  };
244
328
  steps: {
@@ -287,10 +371,8 @@ interface UseChartOptions {
287
371
  theme?: ThemeConfig;
288
372
  /** Dark mode setting. */
289
373
  darkMode?: DarkMode;
290
- /** Data point click handler. */
291
- onDataPointClick?: MountOptions['onDataPointClick'];
292
- /** Enable responsive resizing. Defaults to true. */
293
- responsive?: boolean;
374
+ /** Observe container resizes. Defaults to true. */
375
+ autoResize?: boolean;
294
376
  /** Rendering backend for point marks; see the vanilla `MountOptions.renderer`. */
295
377
  renderer?: MountOptions['renderer'];
296
378
  }
@@ -308,7 +390,7 @@ interface UseChartReturn {
308
390
  * Attach the returned containerRef to a container div via `ref="containerRef"`.
309
391
  * The chart mounts automatically and updates when the spec changes.
310
392
  */
311
- declare function useChart(spec: Ref<ChartSpec | LayerSpec | GraphSpec>, options?: UseChartOptions): UseChartReturn;
393
+ declare function useChart(spec: Ref<ChartSpec | LayerSpec>, options?: UseChartOptions): UseChartReturn;
312
394
 
313
395
  /**
314
396
  * useDarkMode: composable that resolves a DarkMode preference to a boolean.
@@ -360,8 +442,8 @@ interface GraphHandle {
360
442
  getLegend: () => GraphLegendData | null;
361
443
  setActiveCategories: (values: string[]) => void;
362
444
  getActiveCategories: () => string[];
363
- /** Re-compile encoding/legend/chrome without restarting the simulation. */
364
- updateVisuals: (spec: GraphSpec) => void;
445
+ /** Update graph data, encoding, or presentation through the unified update path. */
446
+ update: (spec: GraphSpec) => void;
365
447
  /** The underlying GraphInstance from the vanilla adapter. */
366
448
  instance: GraphInstance | null;
367
449
  }
@@ -618,6 +700,9 @@ declare const DataTable: vue.DefineComponent<vue.ExtractPropTypes<{
618
700
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
619
701
 
620
702
  interface GeoMapProps {
703
+ reader?: false | GeoReaderOptions;
704
+ readerSelection?: GeoReaderSelection;
705
+ labelInventory?: GeoMapMountOptions['labelInventory'];
621
706
  spec: GeoMapSpec;
622
707
  theme?: ThemeConfig;
623
708
  darkMode?: DarkMode;
@@ -625,6 +710,18 @@ interface GeoMapProps {
625
710
  style?: string | CSSProperties;
626
711
  }
627
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
+ };
628
725
  spec: {
629
726
  type: PropType<GeoMapSpec>;
630
727
  required: true;
@@ -648,10 +745,23 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
648
745
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
649
746
  [key: string]: any;
650
747
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
748
+ 'reader-change': (_selection: GeoReaderSelection, _meta: ReaderChangeMeta) => true;
651
749
  'mark-click': (_event: GeoMapMarkEvent) => true;
652
750
  'mark-hover': (_event: GeoMapMarkEvent | null) => true;
653
- 'camera-change': (_camera: Camera) => true;
751
+ 'camera-change': (_camera: Camera, _meta?: GeoMapCameraChangeMeta) => true;
654
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
+ };
655
765
  spec: {
656
766
  type: PropType<GeoMapSpec>;
657
767
  required: true;
@@ -673,14 +783,20 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
673
783
  default: undefined;
674
784
  };
675
785
  }>> & Readonly<{
786
+ "onReader-change"?: ((_selection: GeoReaderSelection, _meta: ReaderChangeMeta) => any) | undefined;
676
787
  "onMark-click"?: ((_event: GeoMapMarkEvent) => any) | undefined;
677
788
  "onMark-hover"?: ((_event: GeoMapMarkEvent | null) => any) | undefined;
678
- "onCamera-change"?: ((_camera: Camera) => any) | undefined;
789
+ "onCamera-change"?: ((_camera: Camera, _meta?: GeoMapCameraChangeMeta | undefined) => any) | undefined;
679
790
  }>, {
680
791
  theme: ThemeConfig;
681
792
  darkMode: DarkMode;
682
793
  class: string;
683
794
  style: string | CSSProperties;
795
+ reader: false | GeoReaderOptions;
796
+ readerSelection: GeoReaderSelection;
797
+ labelInventory: (false | {
798
+ container: HTMLElement;
799
+ }) | undefined;
684
800
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
685
801
 
686
802
  /** Tooltip prop: `false` off, `true` default, or an object with a formatter. */
@@ -795,6 +911,7 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
795
911
  };
796
912
  }>> & Readonly<{
797
913
  "onLegend-toggle"?: ((_activeValues: string[]) => any) | undefined;
914
+ "onHighlight-change"?: ((_nodeIds: string[] | null) => any) | undefined;
798
915
  "onCamera-change"?: ((_camera: GraphCamera) => any) | undefined;
799
916
  "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
800
917
  "onNode-double-click"?: ((_node: Record<string, unknown>) => any) | undefined;
@@ -805,7 +922,6 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
805
922
  field: string;
806
923
  value: string;
807
924
  } | null) => any) | undefined;
808
- "onHighlight-change"?: ((_nodeIds: string[] | null) => any) | undefined;
809
925
  }>, {
810
926
  theme: ThemeConfig;
811
927
  darkMode: DarkMode;