@visactor/vchart-types 1.8.3 → 1.8.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.
@@ -10,7 +10,7 @@ export declare function animationConfig<Preset extends string>(defaultConfig?: M
10
10
  dataIndex: (datum: any) => number;
11
11
  dataCount: () => number;
12
12
  }): MarkAnimationSpec;
13
- export declare function userAnimationConfig<M extends string, Preset extends string>(markName: SeriesMarkNameEnum | string, spec: IAnimationSpec<M, Preset>, ctx: ISeriesMarkAttributeContext): Partial<Record<"none" | "normal" | "state" | "exit" | "update" | "appear" | "enter" | "disappear", boolean | IAnimationConfig | IStateAnimateSpec<string> | IAnimationConfig[]>>;
13
+ export declare function userAnimationConfig<M extends string, Preset extends string>(markName: SeriesMarkNameEnum | string, spec: IAnimationSpec<M, Preset>, ctx: ISeriesMarkAttributeContext): Partial<Record<"none" | "normal" | "state" | "exit" | "update" | "appear" | "enter" | "disappear", boolean | IAnimationConfig | IAnimationConfig[] | IStateAnimateSpec<Preset>>>;
14
14
  export declare function shouldMarkDoMorph(spec: ISeriesSpec & IAnimationSpec<string, string>, markName: string): boolean;
15
15
  export declare function isTimeLineAnimation(animationConfig: IAnimationConfig): boolean;
16
16
  export declare function isChannelAnimation(animationConfig: IAnimationConfig): boolean;
@@ -3,10 +3,6 @@ import type { IVChart } from '../../../../core';
3
3
  import type { IModelSpecInfo } from '../../../../model/interface';
4
4
  import type { SeriesTypeEnum } from '../../../../series';
5
5
  import type { IChartSpec } from '../../../../typings';
6
- export interface IMediaInfo {
7
- width: number;
8
- height: number;
9
- }
10
6
  export interface IMediaQueryActionFilterResult<T extends Record<string, unknown> = any> {
11
7
  isChart?: boolean;
12
8
  modelType?: 'series' | 'region' | 'component';
@@ -1,2 +1,2 @@
1
- export * from './spec';
1
+ export * from '../../../../typings/spec/media-query';
2
2
  export * from './common';
@@ -123,7 +123,9 @@ export declare abstract class BaseSeries<T extends ISeriesSpec> extends BaseMode
123
123
  setValueFieldToStackOffsetSilhouette(): void;
124
124
  abstract getActiveMarks(): IMark[];
125
125
  initRootMark(): void;
126
- protected _initExtensionMark(): void;
126
+ protected _initExtensionMark(options: {
127
+ hasAnimation: boolean;
128
+ }): void;
127
129
  private _createExtensionMark;
128
130
  protected _updateExtensionMarkSpec(lastSpec?: any): void;
129
131
  getStackData(): ISeriesStackData;
@@ -25,6 +25,7 @@ import type { ILegendSpec } from '../../component/legend';
25
25
  import type { ILayoutOrientPadding, ILayoutPaddingSpec } from '../layout';
26
26
  import type { ICustomPath2D } from '@visactor/vrender-core';
27
27
  import type { ICommonAxisSpec } from '../../component/axis';
28
+ import type { IMediaQuerySpec } from '..';
28
29
  export type IChartPadding = ILayoutOrientPadding | number;
29
30
  export interface IInitOption extends Omit<IRenderOption, 'pluginList'> {
30
31
  dom?: string | HTMLElement;
@@ -80,6 +81,7 @@ export interface IChartSpec {
80
81
  theme?: Omit<ITheme, 'name'> | string;
81
82
  background?: IBackgroundSpec;
82
83
  stackInverse?: boolean;
84
+ media?: IMediaQuerySpec;
83
85
  }
84
86
  export type IBackgroundStyleSpec = ConvertToMarkStyleSpec<Omit<IFillMarkSpec, 'width' | 'height' | 'background'>> & {
85
87
  image?: IRectMarkSpec['background'];
@@ -2,3 +2,4 @@ export * from './common';
2
2
  export type { IStateSpec, StateValueType } from '../../compile/mark';
3
3
  export * from './chart';
4
4
  export type { IRegionSpec, IGeoRegionSpec } from '../../region/interface';
5
+ export * from './media-query';
@@ -0,0 +1,28 @@
1
+ import type { ComponentTypeEnum } from '../../component/interface';
2
+ import type { IChartSpec, IVChart } from '../../core';
3
+ import type { IModelSpecInfo } from '../../model/interface';
4
+ import type { SeriesTypeEnum } from '../../series';
5
+ export interface IMediaInfo {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ export type IMediaQuerySpec = IMediaQueryItem[];
10
+ export interface IMediaQueryItem {
11
+ query: IMediaQueryCondition;
12
+ action: IMediaQueryAction | IMediaQueryAction[];
13
+ }
14
+ export interface IMediaQueryCondition {
15
+ minWidth?: number;
16
+ maxWidth?: number;
17
+ minHeight?: number;
18
+ maxHeight?: number;
19
+ onResize?: (info: IMediaInfo, vchart: IVChart) => boolean;
20
+ }
21
+ export interface IMediaQueryAction<T extends Record<string, unknown> = any> {
22
+ spec: Partial<T> | ((filteredModelInfo: IModelSpecInfo<T>[], action: IMediaQueryAction<T>, query: IMediaQueryCondition) => Partial<T>);
23
+ filterType?: MediaQueryActionFilterType;
24
+ filter?: MediaQueryActionFilter<T> | Array<MediaQueryActionFilter<T>>;
25
+ forceAppend?: boolean;
26
+ }
27
+ export type MediaQueryActionFilterType = 'region' | 'series' | 'chart' | `${SeriesTypeEnum}` | `${ComponentTypeEnum}` | keyof IChartSpec;
28
+ export type MediaQueryActionFilter<T extends Record<string, unknown> = any> = Partial<T> | ((modelInfo: IModelSpecInfo<T>, action: IMediaQueryAction<T>, query: IMediaQueryCondition) => boolean);