@opendata-ai/openchart-vue 8.0.0-rc.9 → 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;
@@ -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,46 @@ 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
+ /** 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[];
349
425
  }
350
426
  /**
351
427
  * Composable for imperative graph control.
@@ -549,16 +625,16 @@ declare const DataTable: vue.DefineComponent<vue.ExtractPropTypes<{
549
625
  page: number;
550
626
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
551
627
 
552
- interface GraphProps {
553
- spec: GraphSpec;
628
+ interface GeoMapProps {
629
+ spec: GeoMapSpec;
554
630
  theme?: ThemeConfig;
555
631
  darkMode?: DarkMode;
556
632
  class?: string;
557
633
  style?: string | CSSProperties;
558
634
  }
559
- declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
635
+ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
560
636
  spec: {
561
- type: PropType<GraphSpec>;
637
+ type: PropType<GeoMapSpec>;
562
638
  required: true;
563
639
  };
564
640
  theme: {
@@ -580,12 +656,11 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
580
656
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
581
657
  [key: string]: any;
582
658
  }>, {}, {}, {}, 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;
659
+ 'mark-click': (_event: GeoMapMarkEvent) => true;
660
+ 'mark-hover': (_event: GeoMapMarkEvent | null) => true;
586
661
  }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
587
662
  spec: {
588
- type: PropType<GraphSpec>;
663
+ type: PropType<GeoMapSpec>;
589
664
  required: true;
590
665
  };
591
666
  theme: {
@@ -605,9 +680,8 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
605
680
  default: undefined;
606
681
  };
607
682
  }>> & 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;
683
+ "onMark-click"?: ((_event: GeoMapMarkEvent) => any) | undefined;
684
+ "onMark-hover"?: ((_event: GeoMapMarkEvent | null) => any) | undefined;
611
685
  }>, {
612
686
  theme: ThemeConfig;
613
687
  darkMode: DarkMode;
@@ -615,16 +689,28 @@ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
615
689
  style: string | CSSProperties;
616
690
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
617
691
 
618
- interface MapProps {
619
- 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;
620
703
  theme?: ThemeConfig;
621
704
  darkMode?: DarkMode;
705
+ tooltip?: GraphTooltipProp;
706
+ legend?: GraphLegendProp;
707
+ fitOnLoad?: boolean;
622
708
  class?: string;
623
709
  style?: string | CSSProperties;
624
710
  }
625
- declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
711
+ declare const Graph: vue.DefineComponent<vue.ExtractPropTypes<{
626
712
  spec: {
627
- type: PropType<MapSpec>;
713
+ type: PropType<GraphSpec>;
628
714
  required: true;
629
715
  };
630
716
  theme: {
@@ -635,6 +721,18 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
635
721
  type: PropType<DarkMode>;
636
722
  default: undefined;
637
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
+ };
638
736
  class: {
639
737
  type: StringConstructor;
640
738
  default: undefined;
@@ -646,11 +744,25 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
646
744
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
647
745
  [key: string]: any;
648
746
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
649
- 'mark-click': (_event: MapMarkEvent) => true;
650
- '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;
651
763
  }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
652
764
  spec: {
653
- type: PropType<MapSpec>;
765
+ type: PropType<GraphSpec>;
654
766
  required: true;
655
767
  };
656
768
  theme: {
@@ -661,6 +773,18 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
661
773
  type: PropType<DarkMode>;
662
774
  default: undefined;
663
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
+ };
664
788
  class: {
665
789
  type: StringConstructor;
666
790
  default: undefined;
@@ -670,13 +794,30 @@ declare const GeoMap: vue.DefineComponent<vue.ExtractPropTypes<{
670
794
  default: undefined;
671
795
  };
672
796
  }>> & Readonly<{
673
- "onMark-click"?: ((_event: MapMarkEvent) => any) | undefined;
674
- "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;
675
813
  }>, {
676
814
  theme: ThemeConfig;
677
815
  darkMode: DarkMode;
678
816
  class: string;
679
817
  style: string | CSSProperties;
818
+ legend: GraphLegendProp;
819
+ tooltip: GraphTooltipProp;
820
+ fitOnLoad: boolean;
680
821
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
681
822
 
682
823
  interface SankeyProps {
@@ -737,8 +878,8 @@ declare const Sankey: vue.DefineComponent<vue.ExtractPropTypes<{
737
878
  };
738
879
  }>> & Readonly<{
739
880
  "onNode-click"?: ((_node: Record<string, unknown>) => any) | undefined;
740
- "onLink-click"?: ((_link: Record<string, unknown>) => any) | undefined;
741
881
  "onNode-hover"?: ((_node: Record<string, unknown> | null) => any) | undefined;
882
+ "onLink-click"?: ((_link: Record<string, unknown>) => any) | undefined;
742
883
  "onLink-hover"?: ((_link: Record<string, unknown> | null) => any) | undefined;
743
884
  }>, {
744
885
  theme: ThemeConfig;
@@ -904,4 +1045,4 @@ declare const Visualization: vue.DefineComponent<vue.ExtractPropTypes<{
904
1045
  style: string | CSSProperties;
905
1046
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
906
1047
 
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 };
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 };