@visactor/vchart-types 1.9.1 → 1.10.0-alpha.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.
Files changed (47) hide show
  1. package/package.json +3 -3
  2. package/tsconfig.tsbuildinfo +1 -1
  3. package/types/chart/base/base-chart.d.ts +1 -1
  4. package/types/component/axis/base-axis.d.ts +3 -2
  5. package/types/component/axis/interface/spec.d.ts +5 -6
  6. package/types/component/axis/mixin/band-axis-mixin.d.ts +1 -0
  7. package/types/component/data-zoom/data-filter-base-component.d.ts +1 -0
  8. package/types/component/data-zoom/util.d.ts +1 -1
  9. package/types/component/indicator/interface.d.ts +5 -5
  10. package/types/component/label/base-label.d.ts +4 -4
  11. package/types/component/label/interface.d.ts +6 -8
  12. package/types/component/label/label.d.ts +2 -2
  13. package/types/component/label/util.d.ts +1 -1
  14. package/types/component/legend/discrete/interface.d.ts +2 -2
  15. package/types/component/legend/util.d.ts +7 -1
  16. package/types/component/marker/interface.d.ts +6 -6
  17. package/types/component/marker/mark-area/interface/theme.d.ts +1 -1
  18. package/types/component/marker/mark-line/interface/theme.d.ts +1 -1
  19. package/types/component/marker/mark-point/interface/theme.d.ts +1 -1
  20. package/types/component/title/interface/spec.d.ts +18 -7
  21. package/types/mark/group.d.ts +1 -1
  22. package/types/mark/label.d.ts +2 -2
  23. package/types/mark/text.d.ts +16 -7
  24. package/types/plugin/components/tooltip-handler/dom/model/content-model.d.ts +1 -1
  25. package/types/series/base/base-series.d.ts +2 -1
  26. package/types/series/cartesian/cartesian.d.ts +1 -0
  27. package/types/series/dot/interface.d.ts +2 -2
  28. package/types/series/funnel/interface.d.ts +6 -4
  29. package/types/series/heatmap/heatmap.d.ts +1 -1
  30. package/types/series/line/constant.d.ts +1 -1
  31. package/types/series/line/interface.d.ts +1 -1
  32. package/types/series/map/interface.d.ts +2 -5
  33. package/types/series/mixin/line-mixin.d.ts +1 -1
  34. package/types/series/pie/interface.d.ts +3 -2
  35. package/types/series/range-area/constant.d.ts +1 -1
  36. package/types/series/range-column/interface.d.ts +5 -5
  37. package/types/series/range-column/range-column-transformer.d.ts +1 -1
  38. package/types/series/range-column/range-column.d.ts +1 -1
  39. package/types/series/treemap/interface.d.ts +3 -2
  40. package/types/series/word-cloud/interface.d.ts +2 -6
  41. package/types/theme/builtin/common/series/rangeColumn.d.ts +1 -1
  42. package/types/typings/spec/common.d.ts +16 -7
  43. package/types/typings/visual.d.ts +10 -5
  44. package/types/util/scale.d.ts +2 -1
  45. package/types/util/space.d.ts +1 -1
  46. package/types/util/spec/common.d.ts +1 -1
  47. package/types/util/spec/merge-theme.d.ts +1 -1
@@ -1,4 +1,4 @@
1
- import type { ITextMarkSpec, IMarkSpec, ISeriesSpec } from '../../typings';
1
+ import type { ITextMarkSpec, IMarkSpec, ISeriesSpec, ITextFormatMethod } from '../../typings';
2
2
  import type { IAnimationSpec, IMarkAnimateSpec, IStateAnimateSpec } from '../../animation/spec';
3
3
  import type { SeriesMarkNameEnum } from '../interface/type';
4
4
  import type { WordcloudAppearPreset } from './animation';
@@ -71,7 +71,7 @@ export interface IWordCloudSeriesBaseSpec extends ISeriesSpec, IAnimationSpec<st
71
71
  wordCloudShapeConfig?: WordCloudShapeConfigType;
72
72
  [SeriesMarkNameEnum.word]?: IMarkSpec<ITextMarkSpec> & {
73
73
  padding?: number;
74
- formatMethod?: (datum?: any) => string;
74
+ formatMethod?: ITextFormatMethod<[datum?: any]>;
75
75
  };
76
76
  [SeriesMarkNameEnum.fillingWord]?: IMarkSpec<ITextMarkSpec> & {
77
77
  padding?: number;
@@ -87,11 +87,9 @@ export interface IWordCloudSeriesSpec extends IWordCloudSeriesBaseSpec {
87
87
  export interface IWordCloudSeriesTheme {
88
88
  [SeriesMarkNameEnum.word]?: IMarkSpec<ITextMarkSpec> & {
89
89
  padding?: number;
90
- formatMethod?: (datum?: any) => string;
91
90
  };
92
91
  [SeriesMarkNameEnum.fillingWord]?: IMarkSpec<ITextMarkSpec> & {
93
92
  padding?: number;
94
- formatMethod?: (datum?: any) => string;
95
93
  };
96
94
  }
97
95
  export interface IWordCloud3dSeriesSpec extends IWordCloudSeriesBaseSpec {
@@ -102,10 +100,8 @@ export interface IWordCloud3dSeriesSpec extends IWordCloudSeriesBaseSpec {
102
100
  export interface IWordCloud3dSeriesTheme {
103
101
  [SeriesMarkNameEnum.word]?: IMarkSpec<ITextMarkSpec> & {
104
102
  padding?: number;
105
- formatMethod?: (text: string | string[], datum?: any) => string | string[];
106
103
  };
107
104
  [SeriesMarkNameEnum.fillingWord]?: IMarkSpec<ITextMarkSpec> & {
108
105
  padding?: number;
109
- formatMethod?: (text: string | string[], datum?: any) => string | string[];
110
106
  };
111
107
  }
@@ -1,2 +1,2 @@
1
- import { type IRangeColumnSeriesTheme } from '../../../../series/range-column/interface';
1
+ import type { IRangeColumnSeriesTheme } from '../../../../series/range-column/interface';
2
2
  export declare const rangeColumn: IRangeColumnSeriesTheme;
@@ -14,7 +14,7 @@ import type { Datum, StringOrNumber } from '../common';
14
14
  import type { IInvalidType } from '../data';
15
15
  import type { IMorphSeriesSpec } from '../../animation/spec';
16
16
  import type { IPlayer } from '../../component/player';
17
- import type { IMarkProgressiveConfig, MarkTypeEnum } from '../../mark/interface';
17
+ import { IMarkProgressiveConfig, MarkTypeEnum } from '../../mark/interface';
18
18
  import type { IDataZoomSpec, IScrollBarSpec } from '../../component/data-zoom';
19
19
  import type { ICrosshairSpec } from '../../component/crosshair/interface';
20
20
  import type { ITheme } from '../../theme';
@@ -23,9 +23,9 @@ import type { IBrushSpec } from '../../component/brush';
23
23
  import type { ITotalLabelSpec } from '../../component/label';
24
24
  import type { ILegendSpec } from '../../component/legend';
25
25
  import type { ILayoutOrientPadding, ILayoutPaddingSpec } from '../layout';
26
- import type { ICustomPath2D } from '@visactor/vrender-core';
26
+ import type { ICustomPath2D, IRichTextCharacter } from '@visactor/vrender-core';
27
27
  import type { ICommonAxisSpec } from '../../component/axis';
28
- import type { IMediaQuerySpec } from '..';
28
+ import type { IComposedTextMarkSpec, IMediaQuerySpec } from '..';
29
29
  export type IChartPadding = ILayoutOrientPadding | number;
30
30
  export interface IInitOption extends Omit<IRenderOption, 'pluginList'> {
31
31
  dom?: string | HTMLElement;
@@ -235,12 +235,12 @@ export interface IPerformanceHook {
235
235
  beforeVRenderDraw?: () => void;
236
236
  afterVRenderDraw?: () => void;
237
237
  }
238
- export type IBuildinMarkSpec = {
238
+ export type IBuiltInMarkSpec = {
239
239
  [MarkTypeEnum.group]: IGroupMarkSpec;
240
240
  [MarkTypeEnum.symbol]: ISymbolMarkSpec;
241
241
  [MarkTypeEnum.rule]: IRuleMarkSpec;
242
242
  [MarkTypeEnum.line]: ILineMarkSpec;
243
- [MarkTypeEnum.text]: ITextMarkSpec;
243
+ [MarkTypeEnum.text]: IComposedTextMarkSpec;
244
244
  [MarkTypeEnum.rect]: IRectMarkSpec;
245
245
  [MarkTypeEnum.rect3d]: IRect3dMarkSpec;
246
246
  [MarkTypeEnum.image]: IImageMarkSpec;
@@ -255,8 +255,8 @@ export type IBuildinMarkSpec = {
255
255
  [MarkTypeEnum.progressArc]: IProgressArcMarkSpec;
256
256
  [MarkTypeEnum.ripple]: IRippleMarkSpec;
257
257
  };
258
- export type EnableMarkType = keyof IBuildinMarkSpec;
259
- export interface ICustomMarkSpec<T extends EnableMarkType> extends IMarkSpec<IBuildinMarkSpec[T]> {
258
+ export type EnableMarkType = keyof IBuiltInMarkSpec;
259
+ export interface ICustomMarkSpec<T extends EnableMarkType> extends IMarkSpec<IBuiltInMarkSpec[T]> {
260
260
  type: T;
261
261
  dataIndex?: number;
262
262
  dataId?: StringOrNumber;
@@ -273,3 +273,12 @@ export interface IExtensionMarkSpec<T extends Exclude<EnableMarkType, MarkTypeEn
273
273
  export interface IExtensionGroupMarkSpec extends ICustomMarkSpec<MarkTypeEnum.group> {
274
274
  children?: ICustomMarkSpec<EnableMarkType>[];
275
275
  }
276
+ export type ITextFormatMethod<T extends any[]> = (...args: T) => ITextMarkSpec['text'] | {
277
+ type: 'text';
278
+ text: ITextMarkSpec['text'];
279
+ };
280
+ export type IRichTextFormatMethod<T extends any[]> = (...args: T) => {
281
+ type: 'rich';
282
+ text: IRichTextCharacter[];
283
+ } | IRichTextCharacter[];
284
+ export type IFormatMethod<T extends any[]> = (...args: T) => ReturnType<ITextFormatMethod<T>> | ReturnType<IRichTextFormatMethod<T>>;
@@ -6,10 +6,10 @@ import type { ScaleType } from './scale';
6
6
  import type { ShapeType } from './shape';
7
7
  import type { IPoint } from './coordinate';
8
8
  import type { IAttributeOpt, IModelMarkAttributeContext } from '../compile/mark';
9
- import type { Datum, StringOrNumber } from './common';
9
+ import type { Datum } from './common';
10
10
  import type { IPadding } from '@visactor/vutils';
11
11
  import type { IColorKey } from '../theme/color-scheme/interface';
12
- import type { IRepeatType, TextAlignType, TextBaselineType, IRichTextCharacter } from '@visactor/vrender-core';
12
+ import type { IRepeatType, TextAlignType, TextBaselineType, IRichTextAttribute, IGraphicStyle } from '@visactor/vrender-core';
13
13
  export interface IVisualSpecBase<D, T> {
14
14
  type: ScaleType;
15
15
  domain: D[];
@@ -80,6 +80,7 @@ export interface ICommonSpec {
80
80
  texturePadding?: number;
81
81
  outerBorder?: IBorder;
82
82
  innerBorder?: IBorder;
83
+ html?: IMarkHtmlSpec;
83
84
  [key: string]: any;
84
85
  }
85
86
  export interface IFillMarkSpec extends ICommonSpec {
@@ -87,6 +88,7 @@ export interface IFillMarkSpec extends ICommonSpec {
87
88
  fillOpacity?: number;
88
89
  background?: string | HTMLImageElement | HTMLCanvasElement | null;
89
90
  }
91
+ export type IMarkHtmlSpec = Partial<IGraphicStyle['html']>;
90
92
  export interface ISymbolMarkSpec extends IFillMarkSpec {
91
93
  dx?: number;
92
94
  dy?: number;
@@ -116,8 +118,7 @@ export interface IRuleMarkSpec extends ILineMarkSpec {
116
118
  y1?: number;
117
119
  }
118
120
  export interface ITextMarkSpec extends IFillMarkSpec {
119
- type?: 'html' | 'rich' | 'text';
120
- text?: StringOrNumber | string[] | IRichTextCharacter[] | Function;
121
+ text?: string | number | string[] | number[];
121
122
  dx?: number;
122
123
  dy?: number;
123
124
  fontSize?: number;
@@ -129,13 +130,17 @@ export interface ITextMarkSpec extends IFillMarkSpec {
129
130
  maxLineWidth?: number;
130
131
  ellipsis?: string;
131
132
  suffixPosition?: 'start' | 'end' | 'middle';
132
- lineBreak?: string;
133
133
  underline?: boolean;
134
134
  lineThrough?: boolean;
135
135
  lineHeight?: number | string;
136
136
  poptip?: PopTipAttributes;
137
137
  direction?: 'horizontal' | 'vertical';
138
138
  }
139
+ export type IRichTextMarkSpec = IRichTextAttribute & IFillMarkSpec & {
140
+ type: 'rich';
141
+ text: IRichTextAttribute['textConfig'];
142
+ };
143
+ export type IComposedTextMarkSpec = ITextMarkSpec | IRichTextMarkSpec;
139
144
  export type IPositionedTextMarkSpec = Omit<ITextMarkSpec, 'align' | 'textAlign' | 'baseline' | 'textBaseline'>;
140
145
  export interface IRectMarkSpec extends IFillMarkSpec {
141
146
  cornerRadius?: number | number[];
@@ -1,5 +1,6 @@
1
1
  import type { IGlobalScale } from '../scale/interface';
2
- import { type IBaseScale, BandScale, LinearScale, OrdinalScale, PointScale, ThresholdScale } from '@visactor/vscale';
2
+ import type { IBaseScale } from '@visactor/vscale';
3
+ import { BandScale, LinearScale, OrdinalScale, PointScale, ThresholdScale } from '@visactor/vscale';
3
4
  import type { IVisual } from '../typings/visual';
4
5
  import { ColorOrdinalScale } from '../scale/color-ordinal-scale';
5
6
  declare const defaultScaleMap: {
@@ -1,4 +1,4 @@
1
- import { type IBoundsLike } from '@visactor/vutils';
1
+ import type { IBoundsLike } from '@visactor/vutils';
2
2
  import type { IPadding } from '../typings/space';
3
3
  import type { IPoint } from '../typings/coordinate';
4
4
  import type { ILayoutNumber, ILayoutRect, IPercent, IPercentOffset, ILayoutPaddingSpec, ILayoutOrientPadding } from '../typings/layout';
@@ -1,5 +1,5 @@
1
1
  import { DataView } from '@visactor/vdataset';
2
- import { type ITheme } from '../../theme';
2
+ import type { ITheme } from '../../theme';
3
3
  export declare function isDataView(obj: any): obj is DataView;
4
4
  export declare function isHTMLElement(obj: any): obj is Element;
5
5
  export declare function getThemeObject(theme?: string | ITheme, transformed?: boolean): ITheme;
@@ -1,4 +1,4 @@
1
- import { type Maybe } from '@visactor/vutils';
1
+ import type { Maybe } from '@visactor/vutils';
2
2
  import type { IGlobalMarkThemeByName, IGlobalMarkThemeByType, ITheme } from '../../theme';
3
3
  import type { IThemeColorScheme } from '../../theme/color-scheme/interface';
4
4
  export declare function mergeTheme(target: Maybe<ITheme>, ...sources: Maybe<ITheme>[]): Maybe<ITheme>;