@visactor/vchart-types 1.13.3 → 1.13.4

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.
@@ -1,20 +1,22 @@
1
1
  import type { IAnimationConfig, IStateAnimationConfig } from '@visactor/vgrammar-core';
2
2
  import type { EasingType } from '@visactor/vrender-core';
3
3
  export type { IRunningConfig as IMorphConfig, IMorphAnimationConfig } from '@visactor/vgrammar-core';
4
- export type IStateAnimateSpec<Preset extends string> = {
5
- preset?: Preset | false;
4
+ export interface ICommonStateAnimateSpec {
6
5
  duration?: number;
7
6
  delay?: number;
8
7
  easing?: EasingType;
9
8
  oneByOne?: boolean;
10
- };
9
+ }
10
+ export interface IStateAnimateSpec<Preset extends string> extends ICommonStateAnimateSpec {
11
+ preset?: Preset | false;
12
+ }
11
13
  export type IMarkAnimateSpec<MarkName extends string> = Partial<Record<MarkName, false | IAnimationConfig | IAnimationConfig[]>>;
12
14
  export interface IAnimationSpec<MarkName extends string, Preset extends string> {
13
15
  animationAppear?: boolean | IStateAnimateSpec<Preset> | IMarkAnimateSpec<MarkName>;
14
- animationEnter?: boolean | Omit<IStateAnimateSpec<Preset>, 'preset'> | IMarkAnimateSpec<MarkName>;
15
- animationUpdate?: boolean | Omit<IStateAnimateSpec<Preset>, 'preset'> | IMarkAnimateSpec<MarkName>;
16
- animationExit?: boolean | Omit<IStateAnimateSpec<Preset>, 'preset'> | IMarkAnimateSpec<MarkName>;
17
- animationDisappear?: boolean | Omit<IStateAnimateSpec<Preset>, 'preset'> | IMarkAnimateSpec<MarkName>;
16
+ animationEnter?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec<MarkName>;
17
+ animationUpdate?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec<MarkName>;
18
+ animationExit?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec<MarkName>;
19
+ animationDisappear?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec<MarkName>;
18
20
  animationState?: boolean | IStateAnimationConfig;
19
21
  animationNormal?: IMarkAnimateSpec<MarkName>;
20
22
  }
@@ -4,7 +4,7 @@ import { MobileTrigger } from './mobile';
4
4
  export declare function getDefaultTriggerEventByMode(mode: RenderMode): {
5
5
  start: string;
6
6
  move: string;
7
- end: string;
7
+ end: string[];
8
8
  zoom: string;
9
9
  zoomEnd: string;
10
10
  scroll: string;
@@ -13,7 +13,7 @@ export declare function getDefaultTriggerEventByMode(mode: RenderMode): {
13
13
  } | {
14
14
  start: string;
15
15
  move: string;
16
- end: string;
16
+ end: string[];
17
17
  zoom: string;
18
18
  zoomEnd: string;
19
19
  scroll: string;
@@ -1,6 +1,7 @@
1
1
  import type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';
2
2
  export declare const getPixelPropertyStr: (num?: number | number[], defaultStr?: string) => string;
3
- export declare const getTextStyle: (style?: ITooltipTextTheme) => Partial<CSSStyleDeclaration>;
3
+ export declare const getTextStyle: (style?: ITooltipTextTheme, textStyle?: Partial<CSSStyleDeclaration>) => Partial<CSSStyleDeclaration>;
4
+ export declare const getLineHeight: (style?: ITooltipTextTheme) => number;
4
5
  export declare const getDomStyle: (spec?: ITooltipSpec) => {
5
6
  panelPadding: number[];
6
7
  row: Partial<CSSStyleDeclaration>;
@@ -7,11 +7,12 @@ import type { IAnimationSpec } from '../../animation/spec';
7
7
  import type { IDataSamping, IMarkOverlap, IMarkProgressiveConfig } from '../../mark/interface';
8
8
  import type { IMultiLabelSpec, ILabelSpec } from '../../component/label/interface';
9
9
  import type { DirectionType } from '../../typings/space';
10
+ type AreaMarks = 'point' | 'line' | 'area';
10
11
  export interface IAreaAnimationParams {
11
12
  direction: DirectionType;
12
13
  }
13
14
  export type AreaAppearPreset = 'clipIn' | 'fadeIn' | 'grow';
14
- export interface IAreaSeriesSpec extends ICartesianSeriesSpec, IAnimationSpec<string, AreaAppearPreset>, IMarkProgressiveConfig, IDataSamping, IMarkOverlap {
15
+ export interface IAreaSeriesSpec extends ICartesianSeriesSpec, IAnimationSpec<AreaMarks, AreaAppearPreset>, IMarkProgressiveConfig, IDataSamping, IMarkOverlap {
15
16
  type: 'area';
16
17
  xField?: string | string[];
17
18
  yField?: string | string[];
@@ -35,3 +36,4 @@ export interface IAreaSeriesTheme extends ILineLikeSeriesTheme {
35
36
  seriesMark?: 'point' | 'line' | 'area';
36
37
  activePoint?: boolean;
37
38
  }
39
+ export {};
@@ -3,7 +3,7 @@ import type { IMarkProgressiveConfig } from '../../mark/interface';
3
3
  import type { DirectionType, IBoxPlotMarkSpec, IOutlierMarkSpec, IMarkSpec, IMarkTheme } from '../../typings';
4
4
  import type { ICartesianSeriesSpec, ICartesianSeriesTheme } from '../cartesian/interface';
5
5
  import type { SeriesMarkNameEnum } from '../interface/type';
6
- export interface IBoxPlotSeriesSpec extends Omit<ICartesianSeriesSpec, 'xField' | 'yField' | 'direction'>, IAnimationSpec<string, string>, IMarkProgressiveConfig {
6
+ export interface IBoxPlotSeriesSpec extends Omit<ICartesianSeriesSpec, 'xField' | 'yField' | 'direction'>, IAnimationSpec<SeriesMarkNameEnum.boxPlot, string>, IMarkProgressiveConfig {
7
7
  type: 'boxPlot';
8
8
  direction?: DirectionType;
9
9
  xField?: string | string[];
@@ -8,7 +8,7 @@ export interface ILinearProgressAnimationParams {
8
8
  direction: DirectionType;
9
9
  }
10
10
  export type LinearProgressAppearPreset = 'grow' | 'fadeIn';
11
- export interface ILinearProgressSeriesSpec extends IProgressSeriesSpec, IAnimationSpec<string, LinearProgressAppearPreset> {
11
+ export interface ILinearProgressSeriesSpec extends IProgressSeriesSpec, IAnimationSpec<SeriesMarkNameEnum.progress | SeriesMarkNameEnum.track, LinearProgressAppearPreset> {
12
12
  type: 'linearProgress';
13
13
  xField: string | string[];
14
14
  yField: string | string[];
@@ -62,7 +62,7 @@ export type WordCloudShapeConfigType = {
62
62
  fillingDeltaFontSizeFactor?: number;
63
63
  fillingRatio?: number;
64
64
  };
65
- export interface IWordCloudSeriesBaseSpec extends ISeriesSpec, IAnimationSpec<string, WordcloudAppearPreset> {
65
+ export interface IWordCloudSeriesBaseSpec extends ISeriesSpec, IAnimationSpec<SeriesMarkNameEnum.word, WordcloudAppearPreset> {
66
66
  nameField: string;
67
67
  valueField?: string;
68
68
  fontFamilyField?: string;
@@ -1,5 +1,5 @@
1
1
  import type { IVChart } from './../../core/interface';
2
- import type { IFillMarkSpec, IImageMarkSpec } from '../visual';
2
+ import type { IImageMarkSpec } from '../visual';
3
3
  import type { LayoutCallBack } from '../../layout/interface';
4
4
  import type { IElement, srIOption3DType } from '@visactor/vgrammar-core';
5
5
  import type { DataSet, DataView, ISimplifyOptions, IFieldsOptions, IFilterOptions, IFoldOptions, IDsvParserOptions } from '@visactor/vdataset';
@@ -9,7 +9,6 @@ import type { IRenderOption } from '../../compile/interface';
9
9
  import type { ISeriesTooltipSpec, ITooltipSpec } from '../../component/tooltip/interface';
10
10
  import type { ILayoutSpec } from '../../layout/interface';
11
11
  import type { ConvertToMarkStyleSpec, IArc3dMarkSpec, IArcMarkSpec, IAreaMarkSpec, IBoxPlotMarkSpec, ICommonSpec, IGroupMarkSpec, ILineMarkSpec, ILinkPathMarkSpec, IPathMarkSpec, IPolygonMarkSpec, IPyramid3dMarkSpec, IRect3dMarkSpec, IRectMarkSpec, IRuleMarkSpec, ISymbolMarkSpec, IRippleMarkSpec, ITextMarkSpec, IVisualSpecScale } from '../visual';
12
- import type { StateValue } from '../../compile/mark/interface';
13
12
  import type { ISeriesStyle, SeriesType } from '../../series/interface';
14
13
  import type { Datum, StringOrNumber } from '../common';
15
14
  import type { IInvalidType } from '../data';
@@ -90,11 +89,7 @@ export interface IChartSpec {
90
89
  stackSort?: boolean;
91
90
  media?: IMediaQuerySpec;
92
91
  }
93
- export type IBackgroundStyleSpec = ConvertToMarkStyleSpec<Omit<IFillMarkSpec, 'width' | 'height' | 'background'>> & {
94
- image?: IRectMarkSpec['background'];
95
- cornerRadius?: IRectMarkSpec['cornerRadius'];
96
- };
97
- export type IBackgroundSpec = IColor | IBackgroundStyleSpec;
92
+ export type IBackgroundSpec = IColor | ConvertToMarkStyleSpec<IGroupMarkSpec>;
98
93
  export type IDataType = IDataValues | DataView;
99
94
  export type IData = IDataType | IDataType[];
100
95
  export type DataKeyType = string | string[] | ((data: Datum, index: number) => string);
@@ -175,13 +170,20 @@ export type AdaptiveSpec<T, K extends keyof any> = {
175
170
  } & {
176
171
  [key in K]: any;
177
172
  };
173
+ export interface IMarkStateFullSpec<T> extends Record<string, IMarkStateSpec<T> | IMarkStateStyleSpec<T>> {
174
+ normal?: IMarkStateSpec<T> | IMarkStateStyleSpec<T>;
175
+ hover?: IMarkStateSpec<T> | IMarkStateStyleSpec<T>;
176
+ hover_reverse?: IMarkStateSpec<T> | IMarkStateStyleSpec<T>;
177
+ selected?: IMarkStateSpec<T> | IMarkStateStyleSpec<T>;
178
+ selected_reverse?: IMarkStateSpec<T> | IMarkStateStyleSpec<T>;
179
+ }
178
180
  export type IMarkSpec<T extends ICommonSpec = ICommonSpec> = {
179
181
  id?: StringOrNumber;
180
182
  interactive?: boolean;
181
183
  zIndex?: number;
182
184
  visible?: boolean;
183
185
  style?: ConvertToMarkStyleSpec<T>;
184
- state?: Record<StateValue, IMarkStateSpec<T> | IMarkStateStyleSpec<T>>;
186
+ state?: IMarkStateFullSpec<T>;
185
187
  stateSort?: (stateA: string, stateB: string) => number;
186
188
  support3d?: boolean;
187
189
  customShape?: (datum: any[], attrs: any, path: ICustomPath2D) => ICustomPath2D;
@@ -205,10 +207,17 @@ export interface IMarkStateSpec<T> {
205
207
  style: ConvertToMarkStyleSpec<T>;
206
208
  }
207
209
  export type IMarkStateStyleSpec<T> = ConvertToMarkStyleSpec<T>;
210
+ export interface IMarkStateTheme<T> extends Record<string, T> {
211
+ normal?: T;
212
+ hover?: T;
213
+ hover_reverse?: T;
214
+ selected?: T;
215
+ selected_reverse?: T;
216
+ }
208
217
  export type IMarkTheme<T> = {
209
218
  visible?: boolean;
210
219
  style?: T;
211
- state?: Record<StateValue, T>;
220
+ state?: IMarkStateTheme<T>;
212
221
  interactive?: boolean;
213
222
  };
214
223
  export interface IPerformanceHook {