@antv/g-lite 1.2.20 → 1.2.22

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/Canvas.d.ts CHANGED
@@ -6,7 +6,7 @@ import { CustomElementRegistry } from './dom/CustomElementRegistry';
6
6
  import type { ICanvas } from './dom/interfaces';
7
7
  import { EventService, RenderingService } from './services';
8
8
  import type { PointLike } from './shapes';
9
- import type { CanvasConfig, Cursor, InteractivePointerEvent } from './types';
9
+ import { type CanvasConfig, type Cursor, type InteractivePointerEvent } from './types';
10
10
  export declare function isCanvas(value: any): value is Canvas;
11
11
  export declare enum CanvasEvent {
12
12
  READY = "ready",
@@ -81,6 +81,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
81
81
  constructor(config: CanvasConfig);
82
82
  private initRenderingContext;
83
83
  private initDefaultCamera;
84
+ private updateSizeAttenuation;
84
85
  getConfig(): Partial<CanvasConfig>;
85
86
  /**
86
87
  * get the root displayObject in scenegraph
@@ -22,6 +22,13 @@ export interface CSSProperty<Parsed, Used> {
22
22
  * '180deg' -> CSS.deg(180)
23
23
  */
24
24
  parser: CSSPropertyParser<Parsed>;
25
+ /**
26
+ * Don't use memoize, eg. during animation.
27
+ */
28
+ parserUnmemoize: CSSPropertyParser<Parsed>;
29
+ /**
30
+ * Ignore CSS syntax.
31
+ */
25
32
  parserWithCSSDisabled: CSSPropertyParser<Parsed>;
26
33
  /**
27
34
  * convert parsed value to used value.
@@ -31,11 +31,11 @@ export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
31
31
  /**
32
32
  * string -> parsed value
33
33
  */
34
- parseProperty(name: string, value: any, object: DisplayObject): CSSStyleValue;
34
+ parseProperty(name: string, value: any, object: DisplayObject, memoized: boolean): CSSStyleValue;
35
35
  /**
36
36
  * computed value -> used value
37
37
  */
38
- computeProperty(name: string, computed: CSSStyleValue, object: DisplayObject): any;
38
+ computeProperty(name: string, computed: CSSStyleValue, object: DisplayObject, memoized: boolean): any;
39
39
  postProcessProperty(name: string, object: DisplayObject, attributes: string[]): void;
40
40
  /**
41
41
  * resolve later
@@ -50,5 +50,6 @@ export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
50
50
  * eg. r of Circle, width/height of Rect
51
51
  */
52
52
  private updateGeometry;
53
+ updateSizeAttenuation(node: DisplayObject, zoom: number): void;
53
54
  private isPropertyInheritable;
54
55
  }
@@ -118,16 +118,18 @@ export interface PropertyParseOptions {
118
118
  skipParse: boolean;
119
119
  forceUpdateGeometry: boolean;
120
120
  usedAttributes: string[];
121
+ memoize: boolean;
121
122
  }
122
123
  export interface StyleValueRegistry {
123
124
  recalc: (displayObject: DisplayObject) => void;
125
+ updateSizeAttenuation: (displayObject: DisplayObject, zoom: number) => void;
124
126
  registerMetadata: (metadata: PropertyMetadata) => void;
125
127
  unregisterMetadata: (name: string) => void;
126
128
  getPropertySyntax: (syntax: string) => CSSProperty<any, any>;
127
129
  addUnresolveProperty: (object: DisplayObject, name: string) => void;
128
130
  processProperties: (object: DisplayObject, attributes: BaseStyleProps, options?: Partial<PropertyParseOptions>) => void;
129
- parseProperty: (name: string, value: any, object: DisplayObject) => CSSStyleValue;
130
- computeProperty: (name: string, computed: CSSStyleValue, object: DisplayObject) => any;
131
+ parseProperty: (name: string, value: any, object: DisplayObject, memoized: boolean) => CSSStyleValue;
132
+ computeProperty: (name: string, computed: CSSStyleValue, object: DisplayObject, memoized: boolean) => any;
131
133
  }
132
134
  export interface LayoutRegistry {
133
135
  registerLayout: (name: string, ctor: any) => void;
@@ -8,6 +8,7 @@ export declare function parseDimension(unitRegExp: RegExp, string: string): CSSS
8
8
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
9
9
  * length with only absolute unit, eg. 1px
10
10
  */
11
+ export declare const parseLengthUnmemoize: (css: string) => CSSStyleValue;
11
12
  export declare const parseLength: {
12
13
  (...args: any[]): any;
13
14
  cache: Map<any, any>;
@@ -16,6 +17,7 @@ export declare const parseLength: {
16
17
  * <percentage>
17
18
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
18
19
  */
20
+ export declare const parserPercentageUnmemoize: (css: string) => CSSStyleValue;
19
21
  export declare const parserPercentage: {
20
22
  (...args: any[]): any;
21
23
  cache: Map<any, any>;
@@ -26,7 +28,12 @@ export declare const parserPercentage: {
26
28
  *
27
29
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
28
30
  */
29
- export declare const parseLengthOrPercentage: (css: string) => CSSUnitValue;
31
+ export declare const parseLengthOrPercentageUnmemoize: (css: string) => CSSUnitValue;
32
+ export declare const parseLengthOrPercentage: {
33
+ (...args: any[]): any;
34
+ cache: Map<any, any>;
35
+ };
36
+ export declare const parseAngleUnmemoize: (css: string) => CSSUnitValue;
30
37
  export declare const parseAngle: {
31
38
  (...args: any[]): any;
32
39
  cache: Map<any, any>;
@@ -43,4 +50,5 @@ export declare function mergeDimensions(left: CSSUnitValue, right: CSSUnitValue,
43
50
  export declare function convertAngleUnit(value: CSSUnitValue): number;
44
51
  export declare function parseDimensionArrayFormat(string: string | number | (string | number)[], size: number): number[];
45
52
  export declare function parseDimensionArray(string: string | (string | number)[]): CSSUnitValue[];
53
+ export declare function parseDimensionArrayUnmemoize(string: string | (string | number)[]): CSSUnitValue[];
46
54
  export declare function convertPercentUnit(valueWithUnit: CSSUnitValue, vec3Index: number, target: DisplayObject): number;
@@ -1,3 +1,4 @@
1
+ import type { CSSUnitValue } from '../cssom';
1
2
  export declare function numberToString(x: number): string;
2
3
  /**
3
4
  * parse string or number to CSSUnitValue(numeric)
@@ -6,6 +7,7 @@ export declare function numberToString(x: number): string;
6
7
  * * 0 -> CSSUnitValue(0)
7
8
  * * '2' -> CSSUnitValue(2)
8
9
  */
10
+ export declare const parseNumberUnmemoize: (string: string | number) => CSSUnitValue;
9
11
  export declare const parseNumber: {
10
12
  (...args: any[]): any;
11
13
  cache: Map<any, any>;
@@ -15,6 +17,7 @@ export declare const parseNumber: {
15
17
  * eg.
16
18
  * * [0.5, 0.5] -> [CSSUnitValue, CSSUnitValue]
17
19
  */
20
+ export declare const parseNumberListUnmemoize: (string: string | number[]) => CSSUnitValue[];
18
21
  export declare const parseNumberList: {
19
22
  (...args: any[]): any;
20
23
  cache: Map<any, any>;
@@ -1,3 +1,4 @@
1
+ import type { CSSUnitValue } from '../cssom';
1
2
  /**
2
3
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
3
4
  * eg. 'center' 'top left' '50px 50px'
@@ -6,3 +7,4 @@ export declare const parseTransformOrigin: {
6
7
  (...args: any[]): any;
7
8
  cache: Map<any, any>;
8
9
  };
10
+ export declare const parseTransformOriginUnmemoize: (value: string | number[]) => [CSSUnitValue, CSSUnitValue];
@@ -10,6 +10,7 @@ export interface ParsedTransform {
10
10
  * scaleX(1)
11
11
  */
12
12
  export declare function parseTransform(string: string): ParsedTransform[];
13
+ export declare function parseTransformUnmemoize(string: string): ParsedTransform[];
13
14
  export declare function convertItemToMatrix(item: ParsedTransform): number[];
14
15
  export declare const composeMatrix: (translate: any, scale: any, skew: any, quat: any, perspective: any) => number[];
15
16
  export declare function mergeTransforms(left: ParsedTransform[], right: ParsedTransform[], target: DisplayObject | null): [number[][], number[][], (d: number[][]) => string];
@@ -7,6 +7,7 @@ export declare class CSSPropertyAngle implements Partial<CSSProperty<CSSUnitValu
7
7
  (...args: any[]): any;
8
8
  cache: Map<any, any>;
9
9
  };
10
+ parserUnmemoize: (css: string) => CSSUnitValue;
10
11
  parserWithCSSDisabled: any;
11
12
  mixer: typeof mergeNumbers;
12
13
  calculator(name: string, oldParsed: CSSUnitValue, parsed: CSSUnitValue, object: DisplayObject): number;
@@ -7,7 +7,11 @@ import { mergeNumbers } from '../parser';
7
7
  * <length> & <percentage>
8
8
  */
9
9
  export declare class CSSPropertyLengthOrPercentage implements Partial<CSSProperty<CSSUnitValue, number>> {
10
- parser: (css: string) => CSSUnitValue;
10
+ parser: {
11
+ (...args: any[]): any;
12
+ cache: Map<any, any>;
13
+ };
14
+ parserUnmemoize: (css: string) => CSSUnitValue;
11
15
  parserWithCSSDisabled: any;
12
16
  mixer: typeof mergeNumbers;
13
17
  /**
@@ -7,6 +7,7 @@ export declare class CSSPropertyNumber implements Partial<CSSProperty<CSSUnitVal
7
7
  (...args: any[]): any;
8
8
  cache: Map<any, any>;
9
9
  };
10
+ parserUnmemoize: (string: string | number) => CSSUnitValue;
10
11
  parserWithCSSDisabled: any;
11
12
  calculator(name: string, oldParsed: CSSUnitValue, computed: CSSUnitValue): number;
12
13
  }
@@ -6,6 +6,7 @@ export declare class CSSPropertyOffsetDistance implements Partial<CSSProperty<CS
6
6
  (...args: any[]): any;
7
7
  cache: Map<any, any>;
8
8
  };
9
+ parserUnmemoize: (string: string | number) => CSSUnitValue;
9
10
  parserWithCSSDisabled: any;
10
11
  calculator(name: string, oldParsed: CSSUnitValue, computed: CSSUnitValue): number;
11
12
  mixer: (left: number, right: number) => [number, number, (i: number) => string];
@@ -8,6 +8,7 @@ export declare class CSSPropertyOpacity implements Partial<CSSProperty<CSSUnitVa
8
8
  (...args: any[]): any;
9
9
  cache: Map<any, any>;
10
10
  };
11
+ parserUnmemoize: (string: string | number) => CSSUnitValue;
11
12
  parserWithCSSDisabled: any;
12
13
  calculator(name: string, oldParsed: CSSUnitValue, computed: CSSUnitValue): number;
13
14
  mixer: (left: number, right: number) => [number, number, (i: number) => string];
@@ -2,7 +2,7 @@ import type { DisplayObject } from '../../display-objects';
2
2
  import { CSSKeywordValue } from '../cssom';
3
3
  import type { CSSProperty } from '../CSSProperty';
4
4
  import type { ParsedTransform } from '../parser/transform';
5
- import { mergeTransforms, parseTransform } from '../parser/transform';
5
+ import { mergeTransforms, parseTransform, parseTransformUnmemoize } from '../parser/transform';
6
6
  /**
7
7
  * @see /zh/docs/api/animation#支持变换的属性
8
8
  *
@@ -35,7 +35,8 @@ import { mergeTransforms, parseTransform } from '../parser/transform';
35
35
  */
36
36
  export declare class CSSPropertyTransform implements Partial<CSSProperty<CSSKeywordValue | ParsedTransform[], ParsedTransform[]>> {
37
37
  parser: typeof parseTransform;
38
- parserWithCSSDisabled: typeof parseTransform;
38
+ parserUnmemoize: typeof parseTransformUnmemoize;
39
+ parserWithCSSDisabled: typeof parseTransformUnmemoize;
39
40
  calculator(name: string, oldParsed: CSSKeywordValue | ParsedTransform[], parsed: CSSKeywordValue | ParsedTransform[], object: DisplayObject): ParsedTransform[];
40
41
  mixer: typeof mergeTransforms;
41
42
  postProcessor(object: DisplayObject): void;
@@ -10,4 +10,5 @@ export declare class CSSPropertyTransformOrigin implements Partial<CSSProperty<[
10
10
  (...args: any[]): any;
11
11
  cache: Map<any, any>;
12
12
  };
13
+ parserUnmemoize: (value: string | number[]) => [CSSUnitValue, CSSUnitValue];
13
14
  }
@@ -6,6 +6,7 @@ export declare class CSSPropertyZIndex implements Partial<CSSProperty<CSSUnitVal
6
6
  (...args: any[]): any;
7
7
  cache: Map<any, any>;
8
8
  };
9
+ parserUnmemoize: (string: string | number) => CSSUnitValue;
9
10
  calculator(name: string, oldParsed: CSSUnitValue, computed: CSSUnitValue, object: DisplayObject): number;
10
11
  postProcessor(object: DisplayObject): void;
11
12
  }
@@ -46,7 +46,7 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
46
46
  destroy(): void;
47
47
  cloneNode(deep?: boolean, customCloneFunc?: (name: string, attribute: any) => any): this;
48
48
  private initAttributes;
49
- setAttribute<Key extends keyof StyleProps>(name: Key, value: StyleProps[Key], force?: boolean): void;
49
+ setAttribute<Key extends keyof StyleProps>(name: Key, value: StyleProps[Key], force?: boolean, memoize?: boolean): void;
50
50
  /**
51
51
  * called when attributes get changed or initialized
52
52
  */
@@ -8,6 +8,7 @@ export interface EllipseStyleProps extends BaseStyleProps {
8
8
  rx: number | string;
9
9
  ry: number | string;
10
10
  isBillboard?: boolean;
11
+ isSizeAttenuation?: boolean;
11
12
  }
12
13
  export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
13
14
  cx: number;
@@ -16,6 +17,7 @@ export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
16
17
  rx: number;
17
18
  ry: number;
18
19
  isBillboard?: boolean;
20
+ isSizeAttenuation?: boolean;
19
21
  }
20
22
  export declare class Ellipse extends DisplayObject<EllipseStyleProps, ParsedEllipseStyleProps> {
21
23
  constructor({ style, ...rest }?: DisplayObjectConfig<EllipseStyleProps>);
@@ -22,6 +22,7 @@ export interface PolygonStyleProps extends BaseStyleProps {
22
22
  markerEndOffset?: number;
23
23
  isClosed?: boolean;
24
24
  isBillboard?: boolean;
25
+ isSizeAttenuation?: boolean;
25
26
  }
26
27
  export interface ParsedPolygonStyleProps extends ParsedBaseStyleProps {
27
28
  points: {
@@ -36,6 +37,7 @@ export interface ParsedPolygonStyleProps extends ParsedBaseStyleProps {
36
37
  markerEndOffset?: number;
37
38
  isClosed?: boolean;
38
39
  isBillboard?: boolean;
40
+ isSizeAttenuation?: boolean;
39
41
  }
40
42
  export declare class Polygon extends DisplayObject<PolygonStyleProps, ParsedPolygonStyleProps> {
41
43
  private markerStartAngle;
@@ -8,6 +8,7 @@ export interface RectStyleProps extends BaseStyleProps {
8
8
  width: number | string;
9
9
  height: number | string;
10
10
  isBillboard?: boolean;
11
+ isSizeAttenuation?: boolean;
11
12
  /**
12
13
  * top-left, top-right, bottom-right, bottom-left
13
14
  */
@@ -20,6 +21,7 @@ export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
20
21
  width: number;
21
22
  height: number;
22
23
  isBillboard?: boolean;
24
+ isSizeAttenuation?: boolean;
23
25
  radius?: [number, number, number, number];
24
26
  }
25
27
  export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
@@ -31,4 +31,5 @@ export interface GlobalRuntime {
31
31
  * circle.style.r = 100;
32
32
  */
33
33
  enableStyleSyntax: boolean;
34
+ enableSizeAttenuation: boolean;
34
35
  }