@opendata-ai/openchart-vue 8.0.0-rc.8 → 8.0.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.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { BarListSpec, ThemeConfig, DarkMode, ChartSpec, LayerSpec, GraphSpec, ElementRef, MarkEvent, Annotation, TextAnnotation, AnnotationOffset, ElementEdit, MapSpec, ChartLayout, TableSpec, SortState, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
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';
2
2
  export * from '@opendata-ai/openchart-core';
3
- import { MountOptions, ChartInstance, GraphInstance, TableInstance, TableState, TableMountOptions, MapMarkEvent } from '@opendata-ai/openchart-vanilla';
4
- export { JPGExportOptions, PNGExportOptions, exportCSV, exportJPG, exportPNG, exportSVG } from '@opendata-ai/openchart-vanilla';
5
- export { ChartRenderer, CompileResult, CompiledGraphEdge, CompiledGraphNode, GraphCompilation, NormalizedBarListSpec, NormalizedChartSpec, NormalizedChrome, NormalizedGraphSpec, NormalizedMapSpec, NormalizedSankeySpec, NormalizedSpec, NormalizedTableSpec, SimulationConfig, ValidationError, ValidationErrorCode, ValidationResult, clearRenderers, compile, compileBarList, compileChart, compileGraph, compileMap, compileSankey, compileTable, getChartRenderer, normalizeSpec, registerChartRenderer, validateSpec } from '@opendata-ai/openchart-engine';
3
+ import { MountOptions, ChartInstance, CameraFlightOptions, GraphHighlightTarget, GraphLegendData, GraphInstance, TableInstance, TableState, TableMountOptions, GeoMapMarkEvent, GraphTooltipFormatter } from '@opendata-ai/openchart-vanilla';
4
+ export { JPGExportOptions, PNGExportOptions, SVGExportOptions, SpecSequenceOptions, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts, exportSpecSequence } from '@opendata-ai/openchart-vanilla';
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';
8
8
  import { ChartStoryOptions } from '@opendata-ai/openchart-vanilla/story';
@@ -80,6 +80,8 @@ interface ChartProps {
80
80
  spec: ChartSpec | LayerSpec | GraphSpec;
81
81
  theme?: ThemeConfig;
82
82
  darkMode?: DarkMode;
83
+ /** Rendering backend for point marks; see the vanilla `MountOptions.renderer`. */
84
+ renderer?: 'auto' | 'svg' | 'canvas';
83
85
  class?: string;
84
86
  style?: string | CSSProperties;
85
87
  }
@@ -96,6 +98,10 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
96
98
  type: PropType<DarkMode>;
97
99
  default: undefined;
98
100
  };
101
+ renderer: {
102
+ type: PropType<"auto" | "svg" | "canvas">;
103
+ default: undefined;
104
+ };
99
105
  class: {
100
106
  type: StringConstructor;
101
107
  default: undefined;
@@ -112,6 +118,10 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
112
118
  type: PropType<string[] | null>;
113
119
  default: undefined;
114
120
  };
121
+ editable: {
122
+ type: PropType<boolean>;
123
+ default: undefined;
124
+ };
115
125
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
116
126
  [key: string]: any;
117
127
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
@@ -139,6 +149,10 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
139
149
  type: PropType<DarkMode>;
140
150
  default: undefined;
141
151
  };
152
+ renderer: {
153
+ type: PropType<"auto" | "svg" | "canvas">;
154
+ default: undefined;
155
+ };
142
156
  class: {
143
157
  type: StringConstructor;
144
158
  default: undefined;
@@ -155,6 +169,10 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
155
169
  type: PropType<string[] | null>;
156
170
  default: undefined;
157
171
  };
172
+ editable: {
173
+ type: PropType<boolean>;
174
+ default: undefined;
175
+ };
158
176
  }>> & Readonly<{
159
177
  onSelect?: ((_element: ElementRef) => any) | undefined;
160
178
  "onMark-click"?: ((_event: MarkEvent) => any) | undefined;
@@ -172,12 +190,14 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
172
190
  darkMode: DarkMode;
173
191
  class: string;
174
192
  style: string | CSSProperties;
193
+ renderer: "auto" | "canvas" | "svg";
175
194
  selectedElement: ElementRef;
176
195
  highlight: string[] | null;
196
+ editable: boolean;
177
197
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
178
198
 
179
199
  interface ChartStoryProps {
180
- spec: ChartSpec | LayerSpec | GraphSpec | MapSpec;
200
+ spec: ChartSpec | LayerSpec | GraphSpec | GeoMapSpec;
181
201
  steps: ChartStoryOptions['steps'];
182
202
  narrative?: VNode[];
183
203
  step?: number;
@@ -187,7 +207,7 @@ interface ChartStoryProps {
187
207
  }
188
208
  declare const ChartStory: vue.DefineComponent<vue.ExtractPropTypes<{
189
209
  spec: {
190
- type: PropType<ChartSpec | LayerSpec | GraphSpec | MapSpec>;
210
+ type: PropType<ChartSpec | LayerSpec | GraphSpec | GeoMapSpec>;
191
211
  required: true;
192
212
  };
193
213
  steps: {
@@ -218,7 +238,7 @@ declare const ChartStory: vue.DefineComponent<vue.ExtractPropTypes<{
218
238
  [key: string]: any;
219
239
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
220
240
  spec: {
221
- type: PropType<ChartSpec | LayerSpec | GraphSpec | MapSpec>;
241
+ type: PropType<ChartSpec | LayerSpec | GraphSpec | GeoMapSpec>;
222
242
  required: true;
223
243
  };
224
244
  steps: {
@@ -271,6 +291,8 @@ interface UseChartOptions {
271
291
  onDataPointClick?: MountOptions['onDataPointClick'];
272
292
  /** Enable responsive resizing. Defaults to true. */
273
293
  responsive?: boolean;
294
+ /** Rendering backend for point marks; see the vanilla `MountOptions.renderer`. */
295
+ renderer?: MountOptions['renderer'];
274
296
  }
275
297
  interface UseChartReturn {
276
298
  /** Template ref to attach to the container div. */
@@ -308,17 +330,48 @@ declare function useDarkMode(mode: Ref<DarkMode | undefined>): Ref<boolean>;
308
330
  * useGraph: composable for imperative graph control.
309
331
  *
310
332
  * Provides a template ref to pass to <Graph /> and exposes graph methods
311
- * (search, zoom, select) for programmatic control of the graph instance.
333
+ * (search, zoom, select, fly, highlight) for programmatic control of the
334
+ * graph instance. The full vanilla GraphInstance API is threaded through.
312
335
  */
313
336
 
337
+ /** Camera transform components (graph-space). */
338
+ type GraphCamera = {
339
+ x: number;
340
+ y: number;
341
+ k: number;
342
+ };
314
343
  /** Handle exposed by Graph component via expose(). */
315
344
  interface GraphHandle {
316
345
  search: (query: string) => void;
317
346
  clearSearch: () => void;
318
- zoomToFit: () => void;
319
- zoomToNode: (nodeId: string) => void;
320
- selectNode: (nodeId: string) => void;
347
+ getSearchMatches: () => string[];
348
+ zoomToFit: (opts?: CameraFlightOptions & {
349
+ padding?: number;
350
+ }) => void;
351
+ zoomToNode: (nodeId: string, opts?: CameraFlightOptions & {
352
+ scale?: number;
353
+ }) => void;
354
+ flyTo: (target: {
355
+ x: number;
356
+ y: number;
357
+ k?: number;
358
+ }, opts?: CameraFlightOptions) => void;
359
+ centerAt: (x: number, y: number, opts?: CameraFlightOptions) => void;
360
+ getCamera: () => GraphCamera;
361
+ selectNode: (nodeId: string, opts?: {
362
+ fly?: boolean;
363
+ } & CameraFlightOptions) => void;
321
364
  getSelectedNodes: () => string[];
365
+ highlight: (target: GraphHighlightTarget, opts?: {
366
+ dimOpacity?: number;
367
+ }) => void;
368
+ clearHighlight: () => void;
369
+ getHighlight: () => string[] | null;
370
+ getLegend: () => GraphLegendData | null;
371
+ setActiveCategories: (values: string[]) => void;
372
+ getActiveCategories: () => string[];
373
+ /** Re-compile encoding/legend/chrome without restarting the simulation. */
374
+ updateVisuals: (spec: GraphSpec) => void;
322
375
  /** The underlying GraphInstance from the vanilla adapter. */
323
376
  instance: GraphInstance | null;
324
377
  }
@@ -329,14 +382,46 @@ interface UseGraphReturn {
329
382
  search: (query: string) => void;
330
383
  /** Clear the current search. */
331
384
  clearSearch: () => void;
332
- /** Zoom to fit all nodes in view. */
333
- zoomToFit: () => void;
334
- /** Zoom and center on a specific node. */
335
- zoomToNode: (nodeId: string) => void;
336
- /** Select a node by id. */
337
- selectNode: (nodeId: string) => void;
385
+ /** Node ids currently matching the active search query. */
386
+ getSearchMatches: () => string[];
387
+ /** Zoom to fit all nodes in view. Animated by default; `{ duration: 0 }` snaps. */
388
+ zoomToFit: (opts?: CameraFlightOptions & {
389
+ padding?: number;
390
+ }) => void;
391
+ /** Fly to a node and zoom in (default scale 2). */
392
+ zoomToNode: (nodeId: string, opts?: CameraFlightOptions & {
393
+ scale?: number;
394
+ }) => void;
395
+ /** Fly the camera to a graph-space target. */
396
+ flyTo: (target: {
397
+ x: number;
398
+ y: number;
399
+ k?: number;
400
+ }, opts?: CameraFlightOptions) => void;
401
+ /** Center the camera on a graph-space point (keeps current zoom). */
402
+ centerAt: (x: number, y: number, opts?: CameraFlightOptions) => void;
403
+ /** Current camera transform. */
404
+ getCamera: () => GraphCamera;
405
+ /** Select a node by id; `{ fly: true }` also flies to it. */
406
+ selectNode: (nodeId: string, opts?: {
407
+ fly?: boolean;
408
+ } & CameraFlightOptions) => void;
338
409
  /** Get the currently selected node ids. */
339
410
  getSelectedNodes: () => string[];
411
+ /** Emphasize a set of nodes; eased via the focus model. */
412
+ highlight: (target: GraphHighlightTarget, opts?: {
413
+ dimOpacity?: number;
414
+ }) => void;
415
+ /** Clear any programmatic highlight (and legend toggles). */
416
+ clearHighlight: () => void;
417
+ /** The currently highlighted node ids, or null when nothing is highlighted. */
418
+ getHighlight: () => string[] | null;
419
+ /** Headless snapshot of the legend. */
420
+ getLegend: () => GraphLegendData | null;
421
+ /** Set the active category filter declaratively (replaces legend toggle state). */
422
+ setActiveCategories: (values: string[]) => void;
423
+ /** Current active category values (empty = all active, no filter). */
424
+ getActiveCategories: () => string[];
340
425
  }
341
426
  /**
342
427
  * Composable for imperative graph control.
@@ -540,16 +625,16 @@ declare const DataTable: vue.DefineComponent<vue.ExtractPropTypes<{
540
625
  page: number;
541
626
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
542
627
 
543
- interface GraphProps {
544
- spec: GraphSpec;
628
+ interface GeoMapProps {
629
+ spec: GeoMapSpec;
545
630
  theme?: ThemeConfig;
546
631
  darkMode?: DarkMode;
547
632
  class?: string;
548
633
  style?: string | CSSProperties;
549
634
  }
550
- declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
635
+ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
551
636
  spec: {
552
- type: PropType<GraphSpec>;
637
+ type: PropType<GeoMapSpec>;
553
638
  required: true;
554
639
  };
555
640
  theme: {
@@ -571,12 +656,11 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
571
656
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
572
657
  [key: string]: any;
573
658
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
574
- 'node-click': (_node: Record<string, unknown>) => true;
575
- 'node-double-click': (_node: Record<string, unknown>) => true;
576
- 'selection-change': (_nodeIds: string[]) => true;
659
+ 'mark-click': (_event: GeoMapMarkEvent) => true;
660
+ 'mark-hover': (_event: GeoMapMarkEvent | null) => true;
577
661
  }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
578
662
  spec: {
579
- type: PropType<GraphSpec>;
663
+ type: PropType<GeoMapSpec>;
580
664
  required: true;
581
665
  };
582
666
  theme: {
@@ -596,9 +680,8 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
596
680
  default: undefined;
597
681
  };
598
682
  }>> & Readonly<{
599
- "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
600
- "onNode-double-click"?: ((_node: Record<string, unknown>) => any) | undefined;
601
- "onSelection-change"?: ((_nodeIds: string[]) => any) | undefined;
683
+ "onMark-click"?: ((_event: GeoMapMarkEvent) => any) | undefined;
684
+ "onMark-hover"?: ((_event: GeoMapMarkEvent | null) => any) | undefined;
602
685
  }>, {
603
686
  theme: ThemeConfig;
604
687
  darkMode: DarkMode;
@@ -606,16 +689,28 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
606
689
  style: string | CSSProperties;
607
690
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
608
691
 
609
- interface MapProps {
610
- spec: MapSpec;
692
+ /** Tooltip prop: `false` off, `true` default, or an object with a formatter. */
693
+ type GraphTooltipProp = boolean | {
694
+ formatter?: GraphTooltipFormatter;
695
+ };
696
+ /** Legend prop: `false` off, `true` default, or an object toggling interactivity/counts. */
697
+ type GraphLegendProp = boolean | {
698
+ interactive?: boolean;
699
+ counts?: boolean;
700
+ };
701
+ interface GraphProps {
702
+ spec: GraphSpec;
611
703
  theme?: ThemeConfig;
612
704
  darkMode?: DarkMode;
705
+ tooltip?: GraphTooltipProp;
706
+ legend?: GraphLegendProp;
707
+ fitOnLoad?: boolean;
613
708
  class?: string;
614
709
  style?: string | CSSProperties;
615
710
  }
616
- declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
711
+ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
617
712
  spec: {
618
- type: PropType<MapSpec>;
713
+ type: PropType<GraphSpec>;
619
714
  required: true;
620
715
  };
621
716
  theme: {
@@ -626,6 +721,18 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
626
721
  type: PropType<DarkMode>;
627
722
  default: undefined;
628
723
  };
724
+ tooltip: {
725
+ type: PropType<GraphTooltipProp>;
726
+ default: undefined;
727
+ };
728
+ legend: {
729
+ type: PropType<GraphLegendProp>;
730
+ default: undefined;
731
+ };
732
+ fitOnLoad: {
733
+ type: BooleanConstructor;
734
+ default: undefined;
735
+ };
629
736
  class: {
630
737
  type: StringConstructor;
631
738
  default: undefined;
@@ -637,11 +744,25 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
637
744
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
638
745
  [key: string]: any;
639
746
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
640
- 'mark-click': (_event: MapMarkEvent) => true;
641
- 'mark-hover': (_event: MapMarkEvent | null) => true;
747
+ 'node-click': (_node: Record<string, unknown>) => true;
748
+ 'node-double-click': (_node: Record<string, unknown>) => true;
749
+ 'node-hover': (_node: Record<string, unknown> | null) => true;
750
+ 'edge-hover': (_edge: Record<string, unknown> | null) => true;
751
+ 'selection-change': (_nodeIds: string[]) => true;
752
+ 'legend-hover': (_entry: {
753
+ field: string;
754
+ value: string;
755
+ } | null) => true;
756
+ 'legend-toggle': (_activeValues: string[]) => true;
757
+ 'highlight-change': (_nodeIds: string[] | null) => true;
758
+ 'camera-change': (_camera: {
759
+ x: number;
760
+ y: number;
761
+ k: number;
762
+ }) => true;
642
763
  }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
643
764
  spec: {
644
- type: PropType<MapSpec>;
765
+ type: PropType<GraphSpec>;
645
766
  required: true;
646
767
  };
647
768
  theme: {
@@ -652,6 +773,18 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
652
773
  type: PropType<DarkMode>;
653
774
  default: undefined;
654
775
  };
776
+ tooltip: {
777
+ type: PropType<GraphTooltipProp>;
778
+ default: undefined;
779
+ };
780
+ legend: {
781
+ type: PropType<GraphLegendProp>;
782
+ default: undefined;
783
+ };
784
+ fitOnLoad: {
785
+ type: BooleanConstructor;
786
+ default: undefined;
787
+ };
655
788
  class: {
656
789
  type: StringConstructor;
657
790
  default: undefined;
@@ -661,13 +794,30 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
661
794
  default: undefined;
662
795
  };
663
796
  }>> & Readonly<{
664
- "onMark-click"?: ((_event: MapMarkEvent) => any) | undefined;
665
- "onMark-hover"?: ((_event: MapMarkEvent | null) => any) | undefined;
797
+ "onLegend-toggle"?: ((_activeValues: string[]) => any) | undefined;
798
+ "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
799
+ "onNode-double-click"?: ((_node: Record<string, unknown>) => any) | undefined;
800
+ "onNode-hover"?: ((_node: Record<string, unknown> | null) => any) | undefined;
801
+ "onEdge-hover"?: ((_edge: Record<string, unknown> | null) => any) | undefined;
802
+ "onSelection-change"?: ((_nodeIds: string[]) => any) | undefined;
803
+ "onLegend-hover"?: ((_entry: {
804
+ field: string;
805
+ value: string;
806
+ } | null) => any) | undefined;
807
+ "onHighlight-change"?: ((_nodeIds: string[] | null) => any) | undefined;
808
+ "onCamera-change"?: ((_camera: {
809
+ x: number;
810
+ y: number;
811
+ k: number;
812
+ }) => any) | undefined;
666
813
  }>, {
667
814
  theme: ThemeConfig;
668
815
  darkMode: DarkMode;
669
816
  class: string;
670
817
  style: string | CSSProperties;
818
+ legend: GraphLegendProp;
819
+ tooltip: GraphTooltipProp;
820
+ fitOnLoad: boolean;
671
821
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
672
822
 
673
823
  interface SankeyProps {
@@ -728,8 +878,8 @@ declare const Sankey: vue.DefineComponent<vue.ExtractPropTypes<{
728
878
  };
729
879
  }>> & Readonly<{
730
880
  "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
731
- "onLink-click"?: ((_link: Record<string, unknown>) => any) | undefined;
732
881
  "onNode-hover"?: ((_node: Record<string, unknown> | null) => any) | undefined;
882
+ "onLink-click"?: ((_link: Record<string, unknown>) => any) | undefined;
733
883
  "onLink-hover"?: ((_link: Record<string, unknown> | null) => any) | undefined;
734
884
  }>, {
735
885
  theme: ThemeConfig;
@@ -895,4 +1045,4 @@ declare const Visualization: vue.DefineComponent<vue.ExtractPropTypes<{
895
1045
  style: string | CSSProperties;
896
1046
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
897
1047
 
898
- export { BarList, type BarListProps, type BarListRowEvent, Chart, type ChartProps, ChartStory, type ChartStoryProps, DataTable, type DataTableProps, GeoMap, Graph, type GraphHandle, type GraphProps, type MapProps, Sankey, type SankeyProps, TileMap, type TileMapProps, type UseChartOptions, type UseChartReturn, type UseGraphReturn, type UseTableReturn, type UseTableStateOptions, type UseTableStateReturn, Visualization, type VisualizationProps, VizDarkModeKey, VizThemeKey, VizThemeProvider, type VizThemeProviderProps, useChart, useDarkMode, useGraph, useTable, useTableState, useVizDarkMode, useVizTheme };
1048
+ export { BarList, type BarListProps, type BarListRowEvent, Chart, type ChartProps, ChartStory, type ChartStoryProps, DataTable, type DataTableProps, GeoMap, type GeoMapProps, Graph, type GraphHandle, type GraphProps, Sankey, type SankeyProps, TileMap, type TileMapProps, type UseChartOptions, type UseChartReturn, type UseGraphReturn, type UseTableReturn, type UseTableStateOptions, type UseTableStateReturn, Visualization, type VisualizationProps, VizDarkModeKey, VizThemeKey, VizThemeProvider, type VizThemeProviderProps, useChart, useDarkMode, useGraph, useTable, useTableState, useVizDarkMode, useVizTheme };