@antv/g-lite 1.2.19 → 1.2.21

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.
@@ -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
@@ -118,6 +118,7 @@ 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;
@@ -126,8 +127,8 @@ export interface StyleValueRegistry {
126
127
  getPropertySyntax: (syntax: string) => CSSProperty<any, any>;
127
128
  addUnresolveProperty: (object: DisplayObject, name: string) => void;
128
129
  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;
130
+ parseProperty: (name: string, value: any, object: DisplayObject, memoized: boolean) => CSSStyleValue;
131
+ computeProperty: (name: string, computed: CSSStyleValue, object: DisplayObject, memoized: boolean) => any;
131
132
  }
132
133
  export interface LayoutRegistry {
133
134
  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
  */
@@ -3,7 +3,6 @@ import type { LayoutRegistry } from './css';
3
3
  import type { CSSProperty } from './css/CSSProperty';
4
4
  import { DefaultStyleValueRegistry } from './css/StyleValueRegistry';
5
5
  import { PropertySyntax } from './css/interfaces';
6
- import type { HTML } from './display-objects';
7
6
  import type { GeometryAABBUpdater, SceneGraphSelector, SceneGraphService } from './services';
8
7
  import { OffscreenCanvasCreator, TextService } from './services';
9
8
  import { CanvasLike, Shape } from './types';
@@ -23,7 +22,6 @@ export interface GlobalRuntime {
23
22
  CSSPropertySyntaxFactory: Record<PropertySyntax, Partial<CSSProperty<any, any>>>;
24
23
  globalThis: any;
25
24
  enableCSSParsing: boolean;
26
- nativeHTMLMap: WeakMap<HTMLElement, HTML>;
27
25
  /**
28
26
  * Enable using dataset property.
29
27
  * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset