@antv/g 5.1.1 → 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/css/CSS.d.ts +4 -2
- package/es/css/CSS.js +6 -2
- package/es/css/StyleValueRegistry.d.ts +23 -55
- package/es/css/StyleValueRegistry.js +65 -79
- package/es/css/interfaces.d.ts +110 -0
- package/es/css/interfaces.js +75 -0
- 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/CSSPropertyPath.d.ts +1 -1
- package/es/css/properties/CSSPropertyPath.js +9 -6
- package/es/css/properties/CSSPropertyPoints.js +7 -4
- package/es/css/properties/index.d.ts +2 -2
- package/es/css/properties/index.js +2 -2
- package/es/display-objects/Path.d.ts +2 -2
- package/es/display-objects/Rect.d.ts +5 -2
- package/es/display-objects/Text.js +2 -2
- package/es/global-module.js +4 -4
- package/es/utils/interpolation.js +3 -2
- package/es/utils/path.js +15 -2
- package/lib/css/CSS.d.ts +4 -2
- package/lib/css/CSS.js +6 -2
- package/lib/css/StyleValueRegistry.d.ts +23 -55
- package/lib/css/StyleValueRegistry.js +66 -79
- package/lib/css/interfaces.d.ts +110 -0
- package/lib/css/interfaces.js +76 -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/CSSPropertyPath.d.ts +1 -1
- package/lib/css/properties/CSSPropertyPath.js +10 -6
- package/lib/css/properties/CSSPropertyPoints.js +8 -4
- package/lib/css/properties/index.d.ts +2 -2
- package/lib/css/properties/index.js +17 -17
- package/lib/display-objects/Path.d.ts +2 -2
- package/lib/display-objects/Rect.d.ts +5 -2
- package/lib/display-objects/Text.js +2 -2
- package/lib/global-module.js +3 -3
- package/lib/utils/interpolation.js +4 -2
- package/lib/utils/path.js +15 -2
- 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
|
@@ -21,7 +21,22 @@ var CSSPropertyLengthOrPercentage =
|
|
|
21
21
|
function () {
|
|
22
22
|
function CSSPropertyLengthOrPercentage() {
|
|
23
23
|
this.parser = _parser.parseLengthOrPercentage;
|
|
24
|
-
this.mixer = _parser.mergeDimensions;
|
|
24
|
+
this.mixer = _parser.mergeDimensions; // private nameToBoundsIndex(name: string): number {
|
|
25
|
+
// if (name === 'x' || name === 'cx' || name === 'width') {
|
|
26
|
+
// return 0;
|
|
27
|
+
// } else if (name === 'y' || name === 'cy' || name === 'height') {
|
|
28
|
+
// return 1;
|
|
29
|
+
// }
|
|
30
|
+
// return 2;
|
|
31
|
+
// }
|
|
32
|
+
// private calculateUsedValueWithParentBounds(object: DisplayObject, name: string) {
|
|
33
|
+
// const bounds = (object.parentElement as DisplayObject).getGeometryBounds();
|
|
34
|
+
// const computedValue = object.computedStyle[name].value;
|
|
35
|
+
// return new CSSUnitValue(
|
|
36
|
+
// (bounds.halfExtents[this.nameToBoundsIndex(name)] * 2 * computedValue) / 100,
|
|
37
|
+
// 'px',
|
|
38
|
+
// );
|
|
39
|
+
// }
|
|
25
40
|
}
|
|
26
41
|
/**
|
|
27
42
|
* according to parent's bounds
|
|
@@ -32,6 +47,8 @@ function () {
|
|
|
32
47
|
|
|
33
48
|
|
|
34
49
|
CSSPropertyLengthOrPercentage.prototype.calculator = function (name, oldParsed, computed, object, registry) {
|
|
50
|
+
var _a;
|
|
51
|
+
|
|
35
52
|
if (_cssom.CSSUnitValue.isRelativeUnit(computed.unit)) {
|
|
36
53
|
if (computed.unit === _cssom.UnitType.kPercentage) {
|
|
37
54
|
// try to resolve according to parent's geometry bounds
|
|
@@ -51,7 +68,16 @@ function () {
|
|
|
51
68
|
// }
|
|
52
69
|
return new _cssom.CSSUnitValue(0, 'px');
|
|
53
70
|
} else if (computed.unit === _cssom.UnitType.kEms) {
|
|
54
|
-
|
|
71
|
+
if (object.parentNode) {
|
|
72
|
+
return this.getFontSize(object.parentNode);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return new _cssom.CSSUnitValue(0, 'px');
|
|
76
|
+
} else if (computed.unit === _cssom.UnitType.kRems) {
|
|
77
|
+
if ((_a = object === null || object === void 0 ? void 0 : object.ownerDocument) === null || _a === void 0 ? void 0 : _a.documentElement) {
|
|
78
|
+
return this.getFontSize(object.ownerDocument.documentElement);
|
|
79
|
+
}
|
|
80
|
+
|
|
55
81
|
return new _cssom.CSSUnitValue(0, 'px');
|
|
56
82
|
}
|
|
57
83
|
} else {
|
|
@@ -62,20 +88,14 @@ function () {
|
|
|
62
88
|
}
|
|
63
89
|
};
|
|
64
90
|
|
|
65
|
-
CSSPropertyLengthOrPercentage.prototype.
|
|
66
|
-
|
|
67
|
-
return 0;
|
|
68
|
-
} else if (name === 'y' || name === 'cy' || name === 'height') {
|
|
69
|
-
return 1;
|
|
70
|
-
}
|
|
91
|
+
CSSPropertyLengthOrPercentage.prototype.getFontSize = function (object) {
|
|
92
|
+
var fontSize = object.parsedStyle.fontSize;
|
|
71
93
|
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
if (fontSize && !_cssom.CSSUnitValue.isRelativeUnit(fontSize.unit)) {
|
|
95
|
+
return fontSize.clone();
|
|
96
|
+
}
|
|
74
97
|
|
|
75
|
-
|
|
76
|
-
var bounds = object.parentElement.getGeometryBounds();
|
|
77
|
-
var computedValue = object.computedStyle[name].value;
|
|
78
|
-
return new _cssom.CSSUnitValue(bounds.halfExtents[this.nameToBoundsIndex(name)] * 2 * computedValue / 100, 'px');
|
|
98
|
+
return new _cssom.CSSUnitValue(0, 'px');
|
|
79
99
|
};
|
|
80
100
|
|
|
81
101
|
CSSPropertyLengthOrPercentage = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyLengthOrPercentage);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CSSProperty } from '../CSSProperty';
|
|
2
|
+
import type { CSSUnitValue } from '../cssom';
|
|
3
|
+
import { mergeDimensionList } from '../parser';
|
|
4
|
+
/**
|
|
5
|
+
* format to Tuple2<CSSUnitValue>
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* rect.style.lineDash = 10;
|
|
9
|
+
* rect.style.lineDash = [10, 10];
|
|
10
|
+
* rect.style.lineDash = '10 10';
|
|
11
|
+
*/
|
|
12
|
+
export declare class CSSPropertyLengthOrPercentage12 implements Partial<CSSProperty<[CSSUnitValue, CSSUnitValue], [CSSUnitValue, CSSUnitValue]>> {
|
|
13
|
+
parser(radius: string | number | number[]): [CSSUnitValue, CSSUnitValue];
|
|
14
|
+
mixer: typeof mergeDimensionList;
|
|
15
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CSSPropertyLengthOrPercentage12 = void 0;
|
|
7
|
+
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
10
|
+
var _manaSyringe = require("mana-syringe");
|
|
11
|
+
|
|
12
|
+
var _parser = require("../parser");
|
|
13
|
+
|
|
14
|
+
var _utils = require("../../utils");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* format to Tuple2<CSSUnitValue>
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* rect.style.lineDash = 10;
|
|
21
|
+
* rect.style.lineDash = [10, 10];
|
|
22
|
+
* rect.style.lineDash = '10 10';
|
|
23
|
+
*/
|
|
24
|
+
var CSSPropertyLengthOrPercentage12 =
|
|
25
|
+
/** @class */
|
|
26
|
+
function () {
|
|
27
|
+
function CSSPropertyLengthOrPercentage12() {
|
|
28
|
+
this.mixer = _parser.mergeDimensionList;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
CSSPropertyLengthOrPercentage12.prototype.parser = function (radius) {
|
|
32
|
+
var parsed = (0, _parser.parseDimensionArray)((0, _utils.isNumber)(radius) ? [radius] : radius);
|
|
33
|
+
var formatted;
|
|
34
|
+
|
|
35
|
+
if (parsed.length === 1) {
|
|
36
|
+
formatted = [parsed[0], parsed[0]];
|
|
37
|
+
} else {
|
|
38
|
+
formatted = [parsed[0], parsed[1]];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return formatted;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
CSSPropertyLengthOrPercentage12 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyLengthOrPercentage12);
|
|
45
|
+
return CSSPropertyLengthOrPercentage12;
|
|
46
|
+
}();
|
|
47
|
+
|
|
48
|
+
exports.CSSPropertyLengthOrPercentage12 = CSSPropertyLengthOrPercentage12;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CSSProperty } from '../CSSProperty';
|
|
2
|
+
import type { CSSUnitValue } from '../cssom';
|
|
3
|
+
import { mergeDimensionList } from '../parser';
|
|
4
|
+
/**
|
|
5
|
+
* used in rounded rect
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* rect.style.radius = 10;
|
|
9
|
+
* rect.style.radius = '10 10';
|
|
10
|
+
* rect.style.radius = '10 10 10 10';
|
|
11
|
+
*/
|
|
12
|
+
export declare class CSSPropertyLengthOrPercentage14 implements Partial<CSSProperty<[
|
|
13
|
+
CSSUnitValue,
|
|
14
|
+
CSSUnitValue,
|
|
15
|
+
CSSUnitValue,
|
|
16
|
+
CSSUnitValue
|
|
17
|
+
], [
|
|
18
|
+
CSSUnitValue,
|
|
19
|
+
CSSUnitValue,
|
|
20
|
+
CSSUnitValue,
|
|
21
|
+
CSSUnitValue
|
|
22
|
+
]>> {
|
|
23
|
+
parser(radius: string | number | number[]): [CSSUnitValue, CSSUnitValue, CSSUnitValue, CSSUnitValue];
|
|
24
|
+
mixer: typeof mergeDimensionList;
|
|
25
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CSSPropertyLengthOrPercentage14 = void 0;
|
|
7
|
+
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
10
|
+
var _manaSyringe = require("mana-syringe");
|
|
11
|
+
|
|
12
|
+
var _parser = require("../parser");
|
|
13
|
+
|
|
14
|
+
var _utils = require("../../utils");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* used in rounded rect
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* rect.style.radius = 10;
|
|
21
|
+
* rect.style.radius = '10 10';
|
|
22
|
+
* rect.style.radius = '10 10 10 10';
|
|
23
|
+
*/
|
|
24
|
+
var CSSPropertyLengthOrPercentage14 =
|
|
25
|
+
/** @class */
|
|
26
|
+
function () {
|
|
27
|
+
function CSSPropertyLengthOrPercentage14() {
|
|
28
|
+
this.mixer = _parser.mergeDimensionList;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
CSSPropertyLengthOrPercentage14.prototype.parser = function (radius) {
|
|
32
|
+
var parsed = (0, _parser.parseDimensionArray)((0, _utils.isNumber)(radius) ? [radius] : radius);
|
|
33
|
+
var formatted; // format to Tuple<CSSUnitValue>
|
|
34
|
+
|
|
35
|
+
if (parsed.length === 1) {
|
|
36
|
+
formatted = [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
37
|
+
} else if (parsed.length === 2) {
|
|
38
|
+
formatted = [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
39
|
+
} else if (parsed.length === 3) {
|
|
40
|
+
formatted = [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
41
|
+
} else {
|
|
42
|
+
formatted = [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return formatted;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
CSSPropertyLengthOrPercentage14 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyLengthOrPercentage14);
|
|
49
|
+
return CSSPropertyLengthOrPercentage14;
|
|
50
|
+
}();
|
|
51
|
+
|
|
52
|
+
exports.CSSPropertyLengthOrPercentage14 = CSSPropertyLengthOrPercentage14;
|
|
@@ -10,7 +10,7 @@ export declare class CSSPropertyPath implements Partial<CSSProperty<ParsedPathSt
|
|
|
10
10
|
calculator(name: string, oldParsed: ParsedPathStyleProps['path'], parsed: ParsedPathStyleProps['path']): {
|
|
11
11
|
absolutePath: import("../..").PathCommand[];
|
|
12
12
|
hasArc: boolean;
|
|
13
|
-
segments: import("
|
|
13
|
+
segments: import("../..").PathSegment[];
|
|
14
14
|
polygons: [number, number][][];
|
|
15
15
|
polylines: [number, number][][];
|
|
16
16
|
curve: import("../..").PathCommand[];
|
|
@@ -9,6 +9,8 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _manaSyringe = require("mana-syringe");
|
|
11
11
|
|
|
12
|
+
var _ = require("../..");
|
|
13
|
+
|
|
12
14
|
var _shapes = require("../../shapes");
|
|
13
15
|
|
|
14
16
|
var _cssom = require("../cssom");
|
|
@@ -51,12 +53,14 @@ function () {
|
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
CSSPropertyPath.prototype.postProcessor = function (object) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
if (object.nodeName === _.Shape.PATH) {
|
|
57
|
+
var _a = object.parsedStyle,
|
|
58
|
+
_b = _a.defX,
|
|
59
|
+
defX = _b === void 0 ? 0 : _b,
|
|
60
|
+
_c = _a.defY,
|
|
61
|
+
defY = _c === void 0 ? 0 : _c;
|
|
62
|
+
object.setLocalPosition(defX, defY);
|
|
63
|
+
}
|
|
60
64
|
};
|
|
61
65
|
|
|
62
66
|
CSSPropertyPath = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyPath);
|
|
@@ -9,6 +9,8 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _manaSyringe = require("mana-syringe");
|
|
11
11
|
|
|
12
|
+
var _ = require("../..");
|
|
13
|
+
|
|
12
14
|
var _parser = require("../parser");
|
|
13
15
|
|
|
14
16
|
var CSSPropertyPoints =
|
|
@@ -23,10 +25,12 @@ function () {
|
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
CSSPropertyPoints.prototype.postProcessor = function (object) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
if (object.nodeName === _.Shape.POLYGON || object.nodeName === _.Shape.POLYLINE) {
|
|
29
|
+
var _a = object.parsedStyle,
|
|
30
|
+
defX = _a.defX,
|
|
31
|
+
defY = _a.defY;
|
|
32
|
+
object.setLocalPosition(defX, defY);
|
|
33
|
+
}
|
|
30
34
|
};
|
|
31
35
|
|
|
32
36
|
CSSPropertyPoints = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyPoints);
|
|
@@ -3,11 +3,11 @@ export * from './CSSPropertyLocalPosition';
|
|
|
3
3
|
export * from './CSSPropertyOpacity';
|
|
4
4
|
export * from './CSSPropertyColor';
|
|
5
5
|
export * from './CSSPropertyFilter';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './CSSPropertyLengthOrPercentage12';
|
|
7
|
+
export * from './CSSPropertyLengthOrPercentage14';
|
|
7
8
|
export * from './CSSPropertyShadowBlur';
|
|
8
9
|
export * from './CSSPropertyOffsetPath';
|
|
9
10
|
export * from './CSSPropertyOffsetDistance';
|
|
10
|
-
export * from './CSSPropertyAnchor';
|
|
11
11
|
export * from './CSSPropertyZIndex';
|
|
12
12
|
export * from './CSSPropertyTransform';
|
|
13
13
|
export * from './CSSPropertyTransformOrigin';
|
|
@@ -69,15 +69,28 @@ Object.keys(_CSSPropertyFilter).forEach(function (key) {
|
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
var
|
|
72
|
+
var _CSSPropertyLengthOrPercentage2 = require("./CSSPropertyLengthOrPercentage12");
|
|
73
73
|
|
|
74
|
-
Object.keys(
|
|
74
|
+
Object.keys(_CSSPropertyLengthOrPercentage2).forEach(function (key) {
|
|
75
75
|
if (key === "default" || key === "__esModule") return;
|
|
76
|
-
if (key in exports && exports[key] ===
|
|
76
|
+
if (key in exports && exports[key] === _CSSPropertyLengthOrPercentage2[key]) return;
|
|
77
77
|
Object.defineProperty(exports, key, {
|
|
78
78
|
enumerable: true,
|
|
79
79
|
get: function get() {
|
|
80
|
-
return
|
|
80
|
+
return _CSSPropertyLengthOrPercentage2[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
var _CSSPropertyLengthOrPercentage3 = require("./CSSPropertyLengthOrPercentage14");
|
|
86
|
+
|
|
87
|
+
Object.keys(_CSSPropertyLengthOrPercentage3).forEach(function (key) {
|
|
88
|
+
if (key === "default" || key === "__esModule") return;
|
|
89
|
+
if (key in exports && exports[key] === _CSSPropertyLengthOrPercentage3[key]) return;
|
|
90
|
+
Object.defineProperty(exports, key, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _CSSPropertyLengthOrPercentage3[key];
|
|
81
94
|
}
|
|
82
95
|
});
|
|
83
96
|
});
|
|
@@ -121,19 +134,6 @@ Object.keys(_CSSPropertyOffsetDistance).forEach(function (key) {
|
|
|
121
134
|
});
|
|
122
135
|
});
|
|
123
136
|
|
|
124
|
-
var _CSSPropertyAnchor = require("./CSSPropertyAnchor");
|
|
125
|
-
|
|
126
|
-
Object.keys(_CSSPropertyAnchor).forEach(function (key) {
|
|
127
|
-
if (key === "default" || key === "__esModule") return;
|
|
128
|
-
if (key in exports && exports[key] === _CSSPropertyAnchor[key]) return;
|
|
129
|
-
Object.defineProperty(exports, key, {
|
|
130
|
-
enumerable: true,
|
|
131
|
-
get: function get() {
|
|
132
|
-
return _CSSPropertyAnchor[key];
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
137
|
var _CSSPropertyZIndex = require("./CSSPropertyZIndex");
|
|
138
138
|
|
|
139
139
|
Object.keys(_CSSPropertyZIndex).forEach(function (key) {
|
|
@@ -4,8 +4,8 @@ import type { DisplayObjectConfig } from '../dom';
|
|
|
4
4
|
import { Point } from '../shapes';
|
|
5
5
|
import type { Rectangle } from '../shapes/Rectangle';
|
|
6
6
|
export interface PathStyleProps extends BaseStyleProps {
|
|
7
|
-
path?: string | PathCommand[]
|
|
8
|
-
d?: string | PathCommand[]
|
|
7
|
+
path?: string | PathCommand[];
|
|
8
|
+
d?: string | PathCommand[];
|
|
9
9
|
}
|
|
10
10
|
export interface PathSegment {
|
|
11
11
|
command: PathCommand[0];
|
|
@@ -7,14 +7,17 @@ export interface RectStyleProps extends BaseStyleProps {
|
|
|
7
7
|
y?: number | string;
|
|
8
8
|
width: number | string;
|
|
9
9
|
height: number | string;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* top-left, top-right, bottom-right, bottom-left
|
|
12
|
+
*/
|
|
13
|
+
radius?: number | string | number[];
|
|
11
14
|
}
|
|
12
15
|
export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
|
|
13
16
|
x: CSSUnitValue;
|
|
14
17
|
y: CSSUnitValue;
|
|
15
18
|
width: CSSUnitValue;
|
|
16
19
|
height: CSSUnitValue;
|
|
17
|
-
radius?: CSSUnitValue;
|
|
20
|
+
radius?: [CSSUnitValue, CSSUnitValue, CSSUnitValue, CSSUnitValue];
|
|
18
21
|
}
|
|
19
22
|
export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
|
|
20
23
|
constructor({ style, ...rest }?: DisplayObjectConfig<RectStyleProps>);
|
package/lib/global-module.js
CHANGED
|
@@ -69,11 +69,10 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
|
|
|
69
69
|
register(_css.CSSPropertyOpacity);
|
|
70
70
|
register(_css.CSSPropertyColor);
|
|
71
71
|
register(_css.CSSPropertyFilter);
|
|
72
|
-
register(_css.
|
|
72
|
+
register(_css.CSSPropertyLengthOrPercentage12);
|
|
73
73
|
register(_css.CSSPropertyShadowBlur);
|
|
74
74
|
register(_css.CSSPropertyOffsetPath);
|
|
75
75
|
register(_css.CSSPropertyOffsetDistance);
|
|
76
|
-
register(_css.CSSPropertyAnchor);
|
|
77
76
|
register(_css.CSSPropertyZIndex);
|
|
78
77
|
register(_css.CSSPropertyTransform);
|
|
79
78
|
register(_css.CSSPropertyTransformOrigin);
|
|
@@ -81,7 +80,8 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
|
|
|
81
80
|
register(_css.CSSPropertyPoints);
|
|
82
81
|
register(_css.CSSPropertyClipPath);
|
|
83
82
|
register(_css.CSSPropertyText);
|
|
84
|
-
register(_css.CSSPropertyTextTransform);
|
|
83
|
+
register(_css.CSSPropertyTextTransform);
|
|
84
|
+
register(_css.CSSPropertyLengthOrPercentage14); // bind layout engine
|
|
85
85
|
|
|
86
86
|
register(_layout.LayoutEngine);
|
|
87
87
|
register(_layout.LayoutEdges);
|
|
@@ -12,6 +12,8 @@ var _manaSyringe = require("mana-syringe");
|
|
|
12
12
|
|
|
13
13
|
var _interfaces = require("../css/interfaces");
|
|
14
14
|
|
|
15
|
+
var _StyleValueRegistry = require("../css/StyleValueRegistry");
|
|
16
|
+
|
|
15
17
|
var _animation = require("./animation");
|
|
16
18
|
|
|
17
19
|
var _string = require("./string");
|
|
@@ -131,8 +133,8 @@ function propertyInterpolation(property, left, right, target) {
|
|
|
131
133
|
|
|
132
134
|
var metadata = registry.getMetadata(property);
|
|
133
135
|
|
|
134
|
-
if (metadata && metadata.
|
|
135
|
-
var propertyHandler = _manaSyringe.GlobalContainer.get(metadata.
|
|
136
|
+
if (metadata && metadata.syntax && metadata.interpolable && _StyleValueRegistry.PROPERTY_HANDLERS[metadata.syntax]) {
|
|
137
|
+
var propertyHandler = _manaSyringe.GlobalContainer.get(_StyleValueRegistry.PROPERTY_HANDLERS[metadata.syntax]);
|
|
136
138
|
|
|
137
139
|
if (propertyHandler) {
|
|
138
140
|
if (propertyHandler.parser) {
|
package/lib/utils/path.js
CHANGED
|
@@ -312,7 +312,15 @@ function polygonToCommands(points, closed) {
|
|
|
312
312
|
function rectToCommands(width, height, x, y, radius) {
|
|
313
313
|
// @see https://gist.github.com/danielpquinn/dd966af424030d47e476
|
|
314
314
|
if (radius) {
|
|
315
|
-
|
|
315
|
+
var _a = (0, _tslib.__read)(radius, 4),
|
|
316
|
+
tlr = _a[0],
|
|
317
|
+
trr = _a[1],
|
|
318
|
+
brr = _a[2],
|
|
319
|
+
blr = _a[3];
|
|
320
|
+
|
|
321
|
+
return [['M', x, tlr + y], tlr ? ['A', tlr, tlr, 0, 0, 1, tlr + x, y] : null, ['L', width - trr + x, y], trr ? ['A', trr, trr, 0, 0, 1, width + x, trr + y] : null, ['L', width + x, height - brr + y], brr ? ['A', brr, brr, 0, 0, 1, width - brr + x, height + y] : null, ['L', blr + x, height + y], blr ? ['A', blr, blr, 0, 0, 1, x, height - blr + y] : null, ['Z']].filter(function (command) {
|
|
322
|
+
return command;
|
|
323
|
+
});
|
|
316
324
|
}
|
|
317
325
|
|
|
318
326
|
return [['M', x, y], ['L', x + width, y], ['L', x + width, y + height], ['L', x, y + height], ['Z']];
|
|
@@ -376,7 +384,12 @@ function convertToPath(object, applyLocalTransform) {
|
|
|
376
384
|
x = _d.x,
|
|
377
385
|
y = _d.y,
|
|
378
386
|
radius = _d.radius;
|
|
379
|
-
|
|
387
|
+
var hasRadius = radius && radius.some(function (r) {
|
|
388
|
+
return r.value !== 0;
|
|
389
|
+
});
|
|
390
|
+
commands = rectToCommands(width.value, height.value, x.value, y.value, hasRadius && radius.map(function (r) {
|
|
391
|
+
return r.value;
|
|
392
|
+
}));
|
|
380
393
|
break;
|
|
381
394
|
|
|
382
395
|
case _types.Shape.PATH:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "A core module including ECS and DI container.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/antvis/g#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@antv/g-math": "^1.1.
|
|
41
|
+
"@antv/g-math": "^1.1.2",
|
|
42
42
|
"@antv/util": "^3.0.0",
|
|
43
43
|
"@types/offscreencanvas": "^2019.6.4",
|
|
44
44
|
"d3-color": "^1.4.0",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"scripts": {
|
|
54
54
|
"umd": "webpack"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "633cec1df324421b0c0821cb18d3ee351c1a47f3"
|
|
57
57
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CSSProperty } from '../CSSProperty';
|
|
2
|
-
import type { DisplayObject } from '../../display-objects';
|
|
3
|
-
import { CSSUnitValue } from '../cssom';
|
|
4
|
-
import { parseNumberList } from '../parser';
|
|
5
|
-
export declare class CSSPropertyAnchor implements Partial<CSSProperty<CSSUnitValue[], CSSUnitValue[]>> {
|
|
6
|
-
parser: typeof parseNumberList;
|
|
7
|
-
calculator(name: string, oldParsed: CSSUnitValue[], parsed: CSSUnitValue[], object: DisplayObject): CSSUnitValue[];
|
|
8
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { singleton } from 'mana-syringe';
|
|
3
|
-
import { CSSUnitValue } from '../cssom';
|
|
4
|
-
import { parseNumberList } from '../parser';
|
|
5
|
-
|
|
6
|
-
var CSSPropertyAnchor =
|
|
7
|
-
/** @class */
|
|
8
|
-
function () {
|
|
9
|
-
function CSSPropertyAnchor() {
|
|
10
|
-
this.parser = parseNumberList;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
CSSPropertyAnchor.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
14
|
-
if (parsed.length === 2) {
|
|
15
|
-
return [parsed[0], parsed[1], new CSSUnitValue(0)];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return parsed;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
CSSPropertyAnchor = __decorate([singleton()], CSSPropertyAnchor);
|
|
22
|
-
return CSSPropertyAnchor;
|
|
23
|
-
}();
|
|
24
|
-
|
|
25
|
-
export { CSSPropertyAnchor };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { DisplayObject } from '../../display-objects';
|
|
2
|
-
import type { CSSProperty } from '../CSSProperty';
|
|
3
|
-
import type { CSSUnitValue } from '../cssom';
|
|
4
|
-
import { parseDimensionArray, mergeDimensionList } from '../parser';
|
|
5
|
-
export declare class CSSPropertyLineDash implements Partial<CSSProperty<CSSUnitValue[], CSSUnitValue[]>> {
|
|
6
|
-
parser: typeof parseDimensionArray;
|
|
7
|
-
mixer: typeof mergeDimensionList;
|
|
8
|
-
calculator(name: string, oldParsed: CSSUnitValue[], parsed: CSSUnitValue[], object: DisplayObject): CSSUnitValue[];
|
|
9
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { singleton } from 'mana-syringe';
|
|
3
|
-
import { parseDimensionArray, mergeDimensionList } from '../parser';
|
|
4
|
-
|
|
5
|
-
var CSSPropertyLineDash =
|
|
6
|
-
/** @class */
|
|
7
|
-
function () {
|
|
8
|
-
function CSSPropertyLineDash() {
|
|
9
|
-
this.parser = parseDimensionArray;
|
|
10
|
-
this.mixer = mergeDimensionList;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
CSSPropertyLineDash.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
14
|
-
if (parsed && parsed.length === 1) {
|
|
15
|
-
return [parsed[0], parsed[0]];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return [parsed[0], parsed[1]];
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
CSSPropertyLineDash = __decorate([singleton()], CSSPropertyLineDash);
|
|
22
|
-
return CSSPropertyLineDash;
|
|
23
|
-
}();
|
|
24
|
-
|
|
25
|
-
export { CSSPropertyLineDash };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CSSProperty } from '../CSSProperty';
|
|
2
|
-
import type { DisplayObject } from '../../display-objects';
|
|
3
|
-
import { CSSUnitValue } from '../cssom';
|
|
4
|
-
import { parseNumberList } from '../parser';
|
|
5
|
-
export declare class CSSPropertyAnchor implements Partial<CSSProperty<CSSUnitValue[], CSSUnitValue[]>> {
|
|
6
|
-
parser: typeof parseNumberList;
|
|
7
|
-
calculator(name: string, oldParsed: CSSUnitValue[], parsed: CSSUnitValue[], object: DisplayObject): CSSUnitValue[];
|
|
8
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CSSPropertyAnchor = void 0;
|
|
7
|
-
|
|
8
|
-
var _tslib = require("tslib");
|
|
9
|
-
|
|
10
|
-
var _manaSyringe = require("mana-syringe");
|
|
11
|
-
|
|
12
|
-
var _cssom = require("../cssom");
|
|
13
|
-
|
|
14
|
-
var _parser = require("../parser");
|
|
15
|
-
|
|
16
|
-
var CSSPropertyAnchor =
|
|
17
|
-
/** @class */
|
|
18
|
-
function () {
|
|
19
|
-
function CSSPropertyAnchor() {
|
|
20
|
-
this.parser = _parser.parseNumberList;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
CSSPropertyAnchor.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
24
|
-
if (parsed.length === 2) {
|
|
25
|
-
return [parsed[0], parsed[1], new _cssom.CSSUnitValue(0)];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return parsed;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
CSSPropertyAnchor = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyAnchor);
|
|
32
|
-
return CSSPropertyAnchor;
|
|
33
|
-
}();
|
|
34
|
-
|
|
35
|
-
exports.CSSPropertyAnchor = CSSPropertyAnchor;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { DisplayObject } from '../../display-objects';
|
|
2
|
-
import type { CSSProperty } from '../CSSProperty';
|
|
3
|
-
import type { CSSUnitValue } from '../cssom';
|
|
4
|
-
import { parseDimensionArray, mergeDimensionList } from '../parser';
|
|
5
|
-
export declare class CSSPropertyLineDash implements Partial<CSSProperty<CSSUnitValue[], CSSUnitValue[]>> {
|
|
6
|
-
parser: typeof parseDimensionArray;
|
|
7
|
-
mixer: typeof mergeDimensionList;
|
|
8
|
-
calculator(name: string, oldParsed: CSSUnitValue[], parsed: CSSUnitValue[], object: DisplayObject): CSSUnitValue[];
|
|
9
|
-
}
|