@antv/g 5.0.24 → 5.1.2
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/index.umd.min.js +2 -2
- package/es/Canvas.js +2 -0
- package/es/css/CSS.d.ts +4 -2
- package/es/css/CSS.js +6 -2
- package/es/css/CSSProperty.d.ts +2 -1
- package/es/css/StyleValueRegistry.d.ts +24 -55
- package/es/css/StyleValueRegistry.js +120 -138
- package/es/css/interfaces.d.ts +110 -0
- package/es/css/interfaces.js +75 -0
- package/es/css/parser/color.d.ts +1 -1
- package/es/css/parser/color.js +2 -2
- package/es/css/parser/dimension.js +5 -1
- package/es/css/parser/path.d.ts +2 -2
- package/es/css/parser/path.js +9 -2
- package/es/css/parser/points.d.ts +8 -1
- package/es/css/parser/points.js +33 -3
- package/es/css/parser/transform.js +1 -1
- package/es/css/properties/CSSPropertyClipPath.js +7 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -2
- package/es/css/properties/CSSPropertyLengthOrPercentage.js +34 -14
- package/es/css/properties/CSSPropertyLengthOrPercentage12.d.ts +15 -0
- package/es/css/properties/CSSPropertyLengthOrPercentage12.js +38 -0
- package/es/css/properties/CSSPropertyLengthOrPercentage14.d.ts +25 -0
- package/es/css/properties/CSSPropertyLengthOrPercentage14.js +42 -0
- package/es/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
- package/es/css/properties/CSSPropertyLocalPosition.js +59 -20
- package/es/css/properties/CSSPropertyPath.d.ts +3 -3
- package/es/css/properties/CSSPropertyPath.js +11 -6
- package/es/css/properties/CSSPropertyPoints.js +7 -5
- package/es/css/properties/CSSPropertyTransform.d.ts +1 -1
- package/es/css/properties/CSSPropertyTransform.js +76 -104
- package/es/css/properties/index.d.ts +2 -2
- package/es/css/properties/index.js +2 -2
- package/es/display-objects/Circle.d.ts +4 -0
- package/es/display-objects/Circle.js +2 -0
- package/es/display-objects/CustomElement.d.ts +6 -2
- package/es/display-objects/CustomElement.js +15 -5
- package/es/display-objects/DisplayObject.d.ts +1 -7
- package/es/display-objects/DisplayObject.js +6 -26
- package/es/display-objects/Ellipse.d.ts +4 -0
- package/es/display-objects/Ellipse.js +2 -0
- package/es/display-objects/Group.d.ts +4 -0
- package/es/display-objects/Group.js +2 -0
- package/es/display-objects/HTML.d.ts +4 -4
- package/es/display-objects/HTML.js +5 -3
- package/es/display-objects/Image.d.ts +4 -0
- package/es/display-objects/Image.js +2 -0
- package/es/display-objects/Line.js +2 -0
- package/es/display-objects/Polygon.js +1 -1
- package/es/display-objects/Polyline.js +1 -1
- package/es/display-objects/Rect.d.ts +11 -4
- package/es/display-objects/Rect.js +2 -0
- package/es/display-objects/Text.d.ts +4 -0
- package/es/display-objects/Text.js +4 -2
- package/es/dom/Element.js +1 -0
- package/es/global-module.js +4 -4
- package/es/services/EventService.js +10 -2
- package/es/services/SceneGraphService.d.ts +2 -0
- package/es/services/SceneGraphService.js +9 -0
- package/es/services/aabb/CircleUpdater.d.ts +0 -2
- package/es/services/aabb/CircleUpdater.js +2 -6
- package/es/services/aabb/EllipseUpdater.d.ts +0 -2
- package/es/services/aabb/EllipseUpdater.js +2 -6
- package/es/services/aabb/LineUpdater.d.ts +0 -2
- package/es/services/aabb/LineUpdater.js +1 -3
- package/es/services/aabb/PathUpdater.d.ts +0 -2
- package/es/services/aabb/PathUpdater.js +1 -5
- package/es/services/aabb/PolylineUpdater.d.ts +0 -2
- package/es/services/aabb/PolylineUpdater.js +1 -3
- package/es/services/aabb/RectUpdater.d.ts +0 -2
- package/es/services/aabb/RectUpdater.js +1 -5
- package/es/services/aabb/TextUpdater.d.ts +7 -0
- package/es/services/aabb/TextUpdater.js +0 -4
- package/es/services/aabb/interfaces.d.ts +0 -3
- package/es/types.d.ts +6 -19
- package/es/types.js +1 -0
- package/es/utils/interpolation.js +5 -10
- package/es/utils/math.js +4 -3
- package/es/utils/path.d.ts +2 -2
- package/es/utils/path.js +76 -26
- package/lib/Canvas.js +2 -0
- package/lib/css/CSS.d.ts +4 -2
- package/lib/css/CSS.js +6 -2
- package/lib/css/CSSProperty.d.ts +2 -1
- package/lib/css/StyleValueRegistry.d.ts +24 -55
- package/lib/css/StyleValueRegistry.js +120 -137
- package/lib/css/interfaces.d.ts +110 -0
- package/lib/css/interfaces.js +76 -1
- package/lib/css/parser/color.d.ts +1 -1
- package/lib/css/parser/color.js +1 -1
- package/lib/css/parser/dimension.js +4 -0
- package/lib/css/parser/path.d.ts +2 -2
- package/lib/css/parser/path.js +9 -2
- package/lib/css/parser/points.d.ts +8 -1
- package/lib/css/parser/points.js +33 -3
- package/lib/css/parser/transform.js +1 -1
- package/lib/css/properties/CSSPropertyClipPath.js +8 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -2
- package/lib/css/properties/CSSPropertyLengthOrPercentage.js +34 -14
- package/lib/css/properties/CSSPropertyLengthOrPercentage12.d.ts +15 -0
- package/lib/css/properties/CSSPropertyLengthOrPercentage12.js +48 -0
- package/lib/css/properties/CSSPropertyLengthOrPercentage14.d.ts +25 -0
- package/lib/css/properties/CSSPropertyLengthOrPercentage14.js +52 -0
- package/lib/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
- package/lib/css/properties/CSSPropertyLocalPosition.js +60 -20
- package/lib/css/properties/CSSPropertyPath.d.ts +3 -3
- package/lib/css/properties/CSSPropertyPath.js +12 -6
- package/lib/css/properties/CSSPropertyPoints.js +8 -5
- package/lib/css/properties/CSSPropertyTransform.d.ts +1 -1
- package/lib/css/properties/CSSPropertyTransform.js +75 -103
- package/lib/css/properties/index.d.ts +2 -2
- package/lib/css/properties/index.js +17 -17
- package/lib/display-objects/Circle.d.ts +4 -0
- package/lib/display-objects/Circle.js +2 -0
- package/lib/display-objects/CustomElement.d.ts +6 -2
- package/lib/display-objects/CustomElement.js +13 -4
- package/lib/display-objects/DisplayObject.d.ts +1 -7
- package/lib/display-objects/DisplayObject.js +6 -27
- package/lib/display-objects/Ellipse.d.ts +4 -0
- package/lib/display-objects/Ellipse.js +2 -0
- package/lib/display-objects/Group.d.ts +4 -0
- package/lib/display-objects/Group.js +2 -0
- package/lib/display-objects/HTML.d.ts +4 -4
- package/lib/display-objects/HTML.js +5 -3
- package/lib/display-objects/Image.d.ts +4 -0
- package/lib/display-objects/Image.js +2 -0
- package/lib/display-objects/Line.js +2 -0
- package/lib/display-objects/Polygon.js +1 -1
- package/lib/display-objects/Polyline.js +1 -1
- package/lib/display-objects/Rect.d.ts +11 -4
- package/lib/display-objects/Rect.js +2 -0
- package/lib/display-objects/Text.d.ts +4 -0
- package/lib/display-objects/Text.js +4 -2
- package/lib/dom/Element.js +1 -0
- package/lib/global-module.js +3 -3
- package/lib/services/EventService.js +10 -2
- package/lib/services/SceneGraphService.d.ts +2 -0
- package/lib/services/SceneGraphService.js +12 -0
- package/lib/services/aabb/CircleUpdater.d.ts +0 -2
- package/lib/services/aabb/CircleUpdater.js +2 -6
- package/lib/services/aabb/EllipseUpdater.d.ts +0 -2
- package/lib/services/aabb/EllipseUpdater.js +2 -6
- package/lib/services/aabb/LineUpdater.d.ts +0 -2
- package/lib/services/aabb/LineUpdater.js +1 -3
- package/lib/services/aabb/PathUpdater.d.ts +0 -2
- package/lib/services/aabb/PathUpdater.js +1 -5
- package/lib/services/aabb/PolylineUpdater.d.ts +0 -2
- package/lib/services/aabb/PolylineUpdater.js +1 -3
- package/lib/services/aabb/RectUpdater.d.ts +0 -2
- package/lib/services/aabb/RectUpdater.js +1 -5
- package/lib/services/aabb/TextUpdater.d.ts +7 -0
- package/lib/services/aabb/TextUpdater.js +0 -4
- package/lib/services/aabb/interfaces.d.ts +0 -3
- package/lib/types.d.ts +6 -19
- package/lib/types.js +1 -0
- package/lib/utils/interpolation.js +6 -10
- package/lib/utils/math.js +4 -3
- package/lib/utils/path.d.ts +2 -2
- package/lib/utils/path.js +70 -26
- package/package.json +3 -3
- package/es/css/properties/CSSPropertyAnchor.d.ts +0 -8
- package/es/css/properties/CSSPropertyAnchor.js +0 -25
- package/es/css/properties/CSSPropertyLineDash.d.ts +0 -9
- package/es/css/properties/CSSPropertyLineDash.js +0 -25
- package/lib/css/properties/CSSPropertyAnchor.d.ts +0 -8
- package/lib/css/properties/CSSPropertyAnchor.js +0 -35
- package/lib/css/properties/CSSPropertyLineDash.d.ts +0 -9
- package/lib/css/properties/CSSPropertyLineDash.js +0 -34
package/lib/css/CSS.js
CHANGED
|
@@ -104,14 +104,18 @@ var CSS = {
|
|
|
104
104
|
registerProperty: function registerProperty(definition) {
|
|
105
105
|
var name = definition.name,
|
|
106
106
|
inherits = definition.inherits,
|
|
107
|
-
|
|
107
|
+
interpolable = definition.interpolable,
|
|
108
|
+
initialValue = definition.initialValue,
|
|
109
|
+
syntax = definition.syntax;
|
|
108
110
|
|
|
109
111
|
var registry = _manaSyringe.GlobalContainer.get(_interfaces.StyleValueRegistry);
|
|
110
112
|
|
|
111
113
|
registry.registerMetadata({
|
|
112
114
|
name: name,
|
|
113
115
|
inherited: inherits,
|
|
114
|
-
|
|
116
|
+
interpolable: interpolable,
|
|
117
|
+
defaultValue: initialValue,
|
|
118
|
+
syntax: syntax
|
|
115
119
|
});
|
|
116
120
|
},
|
|
117
121
|
|
package/lib/css/CSSProperty.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { DisplayObject } from '../display-objects';
|
|
1
2
|
import type { IElement } from '../dom';
|
|
2
3
|
import type { StyleValueRegistry } from './interfaces';
|
|
3
4
|
export declare type Interpolatable = number | boolean | number[] | boolean[];
|
|
4
5
|
declare type CSSPropertyMixer<Parsed = any, T extends Interpolatable = any> = (left: Parsed, right: Parsed, displayObject: IElement | null) => [T, T, (i: T) => string | any] | undefined;
|
|
5
|
-
declare type CSSPropertyParser<Parsed> = (value: string | any) => Parsed;
|
|
6
|
+
declare type CSSPropertyParser<Parsed> = (value: string | any, object: DisplayObject) => Parsed;
|
|
6
7
|
declare type CSSPropertyCalculator<Parsed, Used> = (name: string, oldParsed: Parsed, parsed: Parsed, object: IElement, registry: StyleValueRegistry) => Used;
|
|
7
8
|
/**
|
|
8
9
|
* 1. parser: raw CSS string -> Computed Value
|
|
@@ -1,67 +1,35 @@
|
|
|
1
1
|
import type { DisplayObject } from '../display-objects';
|
|
2
2
|
import type { BaseStyleProps } from '../types';
|
|
3
3
|
import { CSSStyleValue } from './cssom';
|
|
4
|
+
import { CSSPropertyLocalPosition, CSSPropertyOpacity, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyShadowBlur, CSSPropertyOffsetPath, CSSPropertyOffsetDistance, CSSPropertyZIndex, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyPath, CSSPropertyClipPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform } from './properties';
|
|
5
|
+
import type { PropertyMetadata } from './interfaces';
|
|
4
6
|
import { StyleValueRegistry } from './interfaces';
|
|
5
7
|
export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
|
|
6
8
|
export interface PropertyParseOptions {
|
|
7
9
|
skipUpdateAttribute: boolean;
|
|
8
10
|
skipParse: boolean;
|
|
9
11
|
}
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
export declare const PROPERTY_HANDLERS: {
|
|
13
|
+
"<coordinate>": typeof CSSPropertyLocalPosition;
|
|
14
|
+
"<color>": typeof CSSPropertyColor;
|
|
15
|
+
"<paint>": typeof CSSPropertyColor;
|
|
16
|
+
"<opacity-value>": typeof CSSPropertyOpacity;
|
|
17
|
+
"<length> | <percentage>": typeof CSSPropertyLengthOrPercentage;
|
|
18
|
+
"[<length> | <percentage>]{1,2}": typeof CSSPropertyLengthOrPercentage12;
|
|
19
|
+
"[<length> | <percentage>]{1,4}": typeof CSSPropertyLengthOrPercentage14;
|
|
20
|
+
"<shadow-blur>": typeof CSSPropertyShadowBlur;
|
|
21
|
+
"<list-of-points>": typeof CSSPropertyPoints;
|
|
22
|
+
"<path>": typeof CSSPropertyPath;
|
|
23
|
+
"<filter>": typeof CSSPropertyFilter;
|
|
24
|
+
"<z-index>": typeof CSSPropertyZIndex;
|
|
25
|
+
"<offset-path>": typeof CSSPropertyOffsetPath;
|
|
26
|
+
"<offset-distance>": typeof CSSPropertyOffsetDistance;
|
|
27
|
+
"<clip-path>": typeof CSSPropertyClipPath;
|
|
28
|
+
"<transform>": typeof CSSPropertyTransform;
|
|
29
|
+
"<transform-origin>": typeof CSSPropertyTransformOrigin;
|
|
30
|
+
"<text>": typeof CSSPropertyText;
|
|
31
|
+
"<text-transform>": typeof CSSPropertyTextTransform;
|
|
17
32
|
};
|
|
18
|
-
export interface PropertyMetadata {
|
|
19
|
-
name: string;
|
|
20
|
-
/**
|
|
21
|
-
* The interpolable flag indicates whether a property can be animated smoothly.
|
|
22
|
-
* Default to `false`.
|
|
23
|
-
*/
|
|
24
|
-
interpolable?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* The property will inherit by default if no value is specified.
|
|
27
|
-
* Default to `false`.
|
|
28
|
-
*/
|
|
29
|
-
inherited?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* This property affects only one field on ComputedStyle, and can be set
|
|
32
|
-
* directly during inheritance instead of forcing a recalc.
|
|
33
|
-
*/
|
|
34
|
-
independent?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* This specifies the default value for this field.
|
|
37
|
-
* - for keyword fields, this is the initial keyword
|
|
38
|
-
* - for other fields, this is a string containg the C++ expression that is used to initialise the field.
|
|
39
|
-
*/
|
|
40
|
-
defaultValue?: string;
|
|
41
|
-
/**
|
|
42
|
-
* The resolved value used for getComputedStyle() depends on layout for this
|
|
43
|
-
* property, which means we may need to update layout to return the correct
|
|
44
|
-
* value from getComputedStyle().
|
|
45
|
-
*/
|
|
46
|
-
layoutDependent?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* This specifies all valid keyword values for the property.
|
|
49
|
-
*/
|
|
50
|
-
keywords?: string[];
|
|
51
|
-
/**
|
|
52
|
-
* eg. strokeWidth is an alias of lineWidth
|
|
53
|
-
*/
|
|
54
|
-
alias?: string[];
|
|
55
|
-
/**
|
|
56
|
-
* sort before init attributes according to this priority
|
|
57
|
-
*/
|
|
58
|
-
parsePriority?: number;
|
|
59
|
-
/**
|
|
60
|
-
* eg. <color> <paint> <number>
|
|
61
|
-
*/
|
|
62
|
-
syntax?: string;
|
|
63
|
-
handler?: any;
|
|
64
|
-
}
|
|
65
33
|
/**
|
|
66
34
|
* Blink used them in code generation(css_properties.json5)
|
|
67
35
|
*/
|
|
@@ -85,6 +53,7 @@ export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
|
85
53
|
private cascadeProperties;
|
|
86
54
|
init(): void;
|
|
87
55
|
registerMetadata(metadata: PropertyMetadata): void;
|
|
56
|
+
unregisterMetadata(name: string): void;
|
|
88
57
|
getMetadata(name: string): PropertyMetadata;
|
|
89
58
|
/**
|
|
90
59
|
* * parse value, eg.
|
|
@@ -99,7 +68,7 @@ export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
|
99
68
|
/**
|
|
100
69
|
* string -> parsed value
|
|
101
70
|
*/
|
|
102
|
-
parseProperty(name: string, value: any): CSSStyleValue;
|
|
71
|
+
parseProperty(name: string, value: any, object: DisplayObject): CSSStyleValue;
|
|
103
72
|
/**
|
|
104
73
|
* computed value -> used value
|
|
105
74
|
*/
|