@opendata-ai/openchart-vue 8.0.0-rc.9 → 8.1.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;
@@ -143,6 +149,10 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
143
149
  type: PropType<DarkMode>;
144
150
  default: undefined;
145
151
  };
152
+ renderer: {
153
+ type: PropType<"auto" | "svg" | "canvas">;
154
+ default: undefined;
155
+ };
146
156
  class: {
147
157
  type: StringConstructor;
148
158
  default: undefined;
@@ -180,13 +190,14 @@ declare const Chart: vue.DefineComponent<vue.ExtractPropTypes<{
180
190
  darkMode: DarkMode;
181
191
  class: string;
182
192
  style: string | CSSProperties;
193
+ renderer: "auto" | "canvas" | "svg";
183
194
  selectedElement: ElementRef;
184
195
  highlight: string[] | null;
185
196
  editable: boolean;
186
197
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
187
198
 
188
199
  interface ChartStoryProps {
189
- spec: ChartSpec | LayerSpec | GraphSpec | MapSpec;
200
+ spec: ChartSpec | LayerSpec | GraphSpec | GeoMapSpec;
190
201
  steps: ChartStoryOptions['steps'];
191
202
  narrative?: VNode[];
192
203
  step?: number;
@@ -196,7 +207,7 @@ interface ChartStoryProps {
196
207
  }
197
208
  declare const ChartStory: vue.DefineComponent<vue.ExtractPropTypes<{
198
209
  spec: {
199
- type: PropType<ChartSpec | LayerSpec | GraphSpec | MapSpec>;
210
+ type: PropType<ChartSpec | LayerSpec | GraphSpec | GeoMapSpec>;
200
211
  required: true;
201
212
  };
202
213
  steps: {
@@ -227,7 +238,7 @@ declare const ChartStory: vue.DefineComponent<vue.ExtractPropTypes<{
227
238
  [key: string]: any;
228
239
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
229
240
  spec: {
230
- type: PropType<ChartSpec | LayerSpec | GraphSpec | MapSpec>;
241
+ type: PropType<ChartSpec | LayerSpec | GraphSpec | GeoMapSpec>;
231
242
  required: true;
232
243
  };
233
244
  steps: {
@@ -280,6 +291,8 @@ interface UseChartOptions {
280
291
  onDataPointClick?: MountOptions['onDataPointClick'];
281
292
  /** Enable responsive resizing. Defaults to true. */
282
293
  responsive?: boolean;
294
+ /** Rendering backend for point marks; see the vanilla `MountOptions.renderer`. */
295
+ renderer?: MountOptions['renderer'];
283
296
  }
284
297
  interface UseChartReturn {
285
298
  /** Template ref to attach to the container div. */
@@ -317,17 +330,48 @@ declare function useDarkMode(mode: Ref<DarkMode | undefined>): Ref<boolean>;
317
330
  * useGraph: composable for imperative graph control.
318
331
  *
319
332
  * Provides a template ref to pass to <Graph /> and exposes graph methods
320
- * (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.
321
335
  */
322
336
 
337
+ /** Camera transform components (graph-space). */
338
+ type GraphCamera = {
339
+ x: number;
340
+ y: number;
341
+ k: number;
342
+ };
323
343
  /** Handle exposed by Graph component via expose(). */
324
344
  interface GraphHandle {
325
345
  search: (query: string) => void;
326
346
  clearSearch: () => void;
327
- zoomToFit: () => void;
328
- zoomToNode: (nodeId: string) => void;
329
- 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;
330
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;
331
375
  /** The underlying GraphInstance from the vanilla adapter. */
332
376
  instance: GraphInstance | null;
333
377
  }
@@ -338,14 +382,52 @@ interface UseGraphReturn {
338
382
  search: (query: string) => void;
339
383
  /** Clear the current search. */
340
384
  clearSearch: () => void;
341
- /** Zoom to fit all nodes in view. */
342
- zoomToFit: () => void;
343
- /** Zoom and center on a specific node. */
344
- zoomToNode: (nodeId: string) => void;
345
- /** Select a node by id. */
346
- 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;
347
409
  /** Get the currently selected node ids. */
348
410
  getSelectedNodes: () => string[];
411
+ /**
412
+ * Emphasize a set of nodes; eased via the focus model. Layers over the
413
+ * standing category filter rather than replacing it.
414
+ */
415
+ highlight: (target: GraphHighlightTarget, opts?: {
416
+ dimOpacity?: number;
417
+ }) => void;
418
+ /**
419
+ * Clear the transient highlight, returning to the standing category filter.
420
+ * Does NOT clear that filter — use `setActiveCategories([])`.
421
+ */
422
+ clearHighlight: () => void;
423
+ /** The effective highlighted node ids, or null when nothing is highlighted. */
424
+ getHighlight: () => string[] | null;
425
+ /** Headless snapshot of the legend. */
426
+ getLegend: () => GraphLegendData | null;
427
+ /** Set the active category filter declaratively (replaces legend toggle state). */
428
+ setActiveCategories: (values: string[]) => void;
429
+ /** Current active category values (empty = all active, no filter). */
430
+ getActiveCategories: () => string[];
349
431
  }
350
432
  /**
351
433
  * Composable for imperative graph control.
@@ -549,16 +631,16 @@ declare const DataTable: vue.DefineComponent<vue.ExtractPropTypes<{
549
631
  page: number;
550
632
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
551
633
 
552
- interface GraphProps {
553
- spec: GraphSpec;
634
+ interface GeoMapProps {
635
+ spec: GeoMapSpec;
554
636
  theme?: ThemeConfig;
555
637
  darkMode?: DarkMode;
556
638
  class?: string;
557
639
  style?: string | CSSProperties;
558
640
  }
559
- declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
641
+ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
560
642
  spec: {
561
- type: PropType<GraphSpec>;
643
+ type: PropType<GeoMapSpec>;
562
644
  required: true;
563
645
  };
564
646
  theme: {
@@ -580,12 +662,11 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
580
662
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
581
663
  [key: string]: any;
582
664
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
583
- 'node-click': (_node: Record<string, unknown>) => true;
584
- 'node-double-click': (_node: Record<string, unknown>) => true;
585
- 'selection-change': (_nodeIds: string[]) => true;
665
+ 'mark-click': (_event: GeoMapMarkEvent) => true;
666
+ 'mark-hover': (_event: GeoMapMarkEvent | null) => true;
586
667
  }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
587
668
  spec: {
588
- type: PropType<GraphSpec>;
669
+ type: PropType<GeoMapSpec>;
589
670
  required: true;
590
671
  };
591
672
  theme: {
@@ -605,9 +686,8 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
605
686
  default: undefined;
606
687
  };
607
688
  }>> & Readonly<{
608
- "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
609
- "onNode-double-click"?: ((_node: Record<string, unknown>) => any) | undefined;
610
- "onSelection-change"?: ((_nodeIds: string[]) => any) | undefined;
689
+ "onMark-click"?: ((_event: GeoMapMarkEvent) => any) | undefined;
690
+ "onMark-hover"?: ((_event: GeoMapMarkEvent | null) => any) | undefined;
611
691
  }>, {
612
692
  theme: ThemeConfig;
613
693
  darkMode: DarkMode;
@@ -615,16 +695,28 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
615
695
  style: string | CSSProperties;
616
696
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
617
697
 
618
- interface MapProps {
619
- spec: MapSpec;
698
+ /** Tooltip prop: `false` off, `true` default, or an object with a formatter. */
699
+ type GraphTooltipProp = boolean | {
700
+ formatter?: GraphTooltipFormatter;
701
+ };
702
+ /** Legend prop: `false` off, `true` default, or an object toggling interactivity/counts. */
703
+ type GraphLegendProp = boolean | {
704
+ interactive?: boolean;
705
+ counts?: boolean;
706
+ };
707
+ interface GraphProps {
708
+ spec: GraphSpec;
620
709
  theme?: ThemeConfig;
621
710
  darkMode?: DarkMode;
711
+ tooltip?: GraphTooltipProp;
712
+ legend?: GraphLegendProp;
713
+ fitOnLoad?: boolean;
622
714
  class?: string;
623
715
  style?: string | CSSProperties;
624
716
  }
625
- declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
717
+ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
626
718
  spec: {
627
- type: PropType<MapSpec>;
719
+ type: PropType<GraphSpec>;
628
720
  required: true;
629
721
  };
630
722
  theme: {
@@ -635,6 +727,18 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
635
727
  type: PropType<DarkMode>;
636
728
  default: undefined;
637
729
  };
730
+ tooltip: {
731
+ type: PropType<GraphTooltipProp>;
732
+ default: undefined;
733
+ };
734
+ legend: {
735
+ type: PropType<GraphLegendProp>;
736
+ default: undefined;
737
+ };
738
+ fitOnLoad: {
739
+ type: BooleanConstructor;
740
+ default: undefined;
741
+ };
638
742
  class: {
639
743
  type: StringConstructor;
640
744
  default: undefined;
@@ -646,11 +750,25 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
646
750
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
647
751
  [key: string]: any;
648
752
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
649
- 'mark-click': (_event: MapMarkEvent) => true;
650
- 'mark-hover': (_event: MapMarkEvent | null) => true;
753
+ 'node-click': (_node: Record<string, unknown>) => true;
754
+ 'node-double-click': (_node: Record<string, unknown>) => true;
755
+ 'node-hover': (_node: Record<string, unknown> | null) => true;
756
+ 'edge-hover': (_edge: Record<string, unknown> | null) => true;
757
+ 'selection-change': (_nodeIds: string[]) => true;
758
+ 'legend-hover': (_entry: {
759
+ field: string;
760
+ value: string;
761
+ } | null) => true;
762
+ 'legend-toggle': (_activeValues: string[]) => true;
763
+ 'highlight-change': (_nodeIds: string[] | null) => true;
764
+ 'camera-change': (_camera: {
765
+ x: number;
766
+ y: number;
767
+ k: number;
768
+ }) => true;
651
769
  }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
652
770
  spec: {
653
- type: PropType<MapSpec>;
771
+ type: PropType<GraphSpec>;
654
772
  required: true;
655
773
  };
656
774
  theme: {
@@ -661,6 +779,18 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
661
779
  type: PropType<DarkMode>;
662
780
  default: undefined;
663
781
  };
782
+ tooltip: {
783
+ type: PropType<GraphTooltipProp>;
784
+ default: undefined;
785
+ };
786
+ legend: {
787
+ type: PropType<GraphLegendProp>;
788
+ default: undefined;
789
+ };
790
+ fitOnLoad: {
791
+ type: BooleanConstructor;
792
+ default: undefined;
793
+ };
664
794
  class: {
665
795
  type: StringConstructor;
666
796
  default: undefined;
@@ -670,13 +800,30 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
670
800
  default: undefined;
671
801
  };
672
802
  }>> & Readonly<{
673
- "onMark-click"?: ((_event: MapMarkEvent) => any) | undefined;
674
- "onMark-hover"?: ((_event: MapMarkEvent | null) => any) | undefined;
803
+ "onLegend-toggle"?: ((_activeValues: string[]) => any) | undefined;
804
+ "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
805
+ "onNode-double-click"?: ((_node: Record<string, unknown>) => any) | undefined;
806
+ "onNode-hover"?: ((_node: Record<string, unknown> | null) => any) | undefined;
807
+ "onEdge-hover"?: ((_edge: Record<string, unknown> | null) => any) | undefined;
808
+ "onSelection-change"?: ((_nodeIds: string[]) => any) | undefined;
809
+ "onLegend-hover"?: ((_entry: {
810
+ field: string;
811
+ value: string;
812
+ } | null) => any) | undefined;
813
+ "onHighlight-change"?: ((_nodeIds: string[] | null) => any) | undefined;
814
+ "onCamera-change"?: ((_camera: {
815
+ x: number;
816
+ y: number;
817
+ k: number;
818
+ }) => any) | undefined;
675
819
  }>, {
676
820
  theme: ThemeConfig;
677
821
  darkMode: DarkMode;
678
822
  class: string;
679
823
  style: string | CSSProperties;
824
+ legend: GraphLegendProp;
825
+ tooltip: GraphTooltipProp;
826
+ fitOnLoad: boolean;
680
827
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
681
828
 
682
829
  interface SankeyProps {
@@ -737,8 +884,8 @@ declare const Sankey: vue.DefineComponent<vue.ExtractPropTypes<{
737
884
  };
738
885
  }>> & Readonly<{
739
886
  "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
740
- "onLink-click"?: ((_link: Record<string, unknown>) => any) | undefined;
741
887
  "onNode-hover"?: ((_node: Record<string, unknown> | null) => any) | undefined;
888
+ "onLink-click"?: ((_link: Record<string, unknown>) => any) | undefined;
742
889
  "onLink-hover"?: ((_link: Record<string, unknown> | null) => any) | undefined;
743
890
  }>, {
744
891
  theme: ThemeConfig;
@@ -904,4 +1051,4 @@ declare const Visualization: vue.DefineComponent<vue.ExtractPropTypes<{
904
1051
  style: string | CSSProperties;
905
1052
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
906
1053
 
907
- 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 };
1054
+ 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 };