@antv/g 5.0.22 → 5.0.23-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.
- package/dist/index.umd.min.js +3 -3
- package/es/AbstractRenderer.js +5 -0
- package/es/camera/Camera.js +2 -2
- package/es/css/parser/color.js +1 -1
- package/es/css/parser/dimension.js +1 -2
- package/es/css/parser/numeric.js +1 -1
- package/es/css/parser/path.d.ts +2 -2
- package/es/css/parser/path.js +1 -1
- package/es/css/parser/points.js +1 -1
- package/es/css/parser/transform-origin.js +1 -1
- package/es/css/properties/CSSPropertyPath.d.ts +14 -2
- package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -2
- package/es/css/properties/CSSPropertyTransform.js +1 -2
- package/es/display-objects/DisplayObject.js +4 -5
- package/es/display-objects/Path.d.ts +15 -15
- package/es/display-objects/Path.js +1 -1
- package/es/display-objects/Polygon.d.ts +8 -1
- package/es/display-objects/Polyline.d.ts +7 -5
- package/es/dom/Document.js +2 -2
- package/es/dom/Element.js +1 -2
- package/es/dom/EventTarget.js +1 -1
- package/es/dom/FederatedTouchEvent.d.ts +5 -3
- package/es/plugins/CullingPlugin.d.ts +0 -1
- package/es/plugins/CullingPlugin.js +3 -8
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/DirtyCheckPlugin.js +9 -8
- package/es/plugins/EventPlugin.d.ts +1 -1
- package/es/plugins/EventPlugin.js +163 -148
- package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/es/plugins/PrepareRendererPlugin.js +15 -16
- package/es/services/EventService.d.ts +8 -0
- package/es/services/EventService.js +274 -20
- package/es/services/RenderingService.d.ts +17 -16
- package/es/services/RenderingService.js +18 -17
- package/es/services/SceneGraphService.js +1 -1
- package/es/services/aabb/PathUpdater.d.ts +3 -3
- package/es/services/aabb/PolylineUpdater.d.ts +3 -3
- package/es/services/aabb/RectUpdater.js +1 -1
- package/es/types.d.ts +5 -3
- package/es/utils/assert.d.ts +6 -0
- package/es/utils/assert.js +18 -0
- package/es/utils/event.d.ts +18 -16
- package/es/utils/hooks.d.ts +280 -0
- package/es/utils/hooks.js +753 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/math.d.ts +1 -0
- package/es/utils/math.js +13 -2
- package/es/utils/string.d.ts +1 -0
- package/es/utils/string.js +8 -0
- package/es/utils/text.js +2 -1
- package/lib/AbstractRenderer.js +5 -0
- package/lib/camera/Camera.js +4 -4
- package/lib/css/parser/color.js +5 -5
- package/lib/css/parser/dimension.js +1 -3
- package/lib/css/parser/numeric.js +3 -3
- package/lib/css/parser/path.d.ts +2 -2
- package/lib/css/parser/path.js +4 -4
- package/lib/css/parser/points.js +2 -2
- package/lib/css/parser/transform-origin.js +2 -2
- package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
- package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -2
- package/lib/css/properties/CSSPropertyTransform.js +0 -2
- package/lib/display-objects/DisplayObject.js +7 -9
- package/lib/display-objects/Path.d.ts +15 -15
- package/lib/display-objects/Path.js +3 -3
- package/lib/display-objects/Polygon.d.ts +8 -1
- package/lib/display-objects/Polyline.d.ts +7 -5
- package/lib/dom/Document.js +2 -2
- package/lib/dom/Element.js +1 -3
- package/lib/dom/EventTarget.js +9 -9
- package/lib/dom/FederatedTouchEvent.d.ts +5 -3
- package/lib/plugins/CullingPlugin.d.ts +0 -1
- package/lib/plugins/CullingPlugin.js +3 -7
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/DirtyCheckPlugin.js +10 -8
- package/lib/plugins/EventPlugin.d.ts +1 -1
- package/lib/plugins/EventPlugin.js +172 -156
- package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/lib/plugins/PrepareRendererPlugin.js +14 -14
- package/lib/services/EventService.d.ts +8 -0
- package/lib/services/EventService.js +274 -19
- package/lib/services/RenderingService.d.ts +17 -16
- package/lib/services/RenderingService.js +19 -18
- package/lib/services/SceneGraphService.js +3 -3
- package/lib/services/aabb/PathUpdater.d.ts +3 -3
- package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
- package/lib/services/aabb/RectUpdater.js +3 -3
- package/lib/types.d.ts +5 -3
- package/lib/utils/assert.d.ts +6 -0
- package/lib/utils/assert.js +30 -0
- package/lib/utils/event.d.ts +18 -16
- package/lib/utils/hooks.d.ts +280 -0
- package/lib/utils/hooks.js +759 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/math.d.ts +1 -0
- package/lib/utils/math.js +17 -4
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +11 -0
- package/lib/utils/text.js +5 -3
- package/package.json +4 -7
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -106,4 +106,17 @@ Object.keys(_canvas).forEach(function (key) {
|
|
|
106
106
|
return _canvas[key];
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
var _hooks = require("./hooks");
|
|
112
|
+
|
|
113
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
114
|
+
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
116
|
+
Object.defineProperty(exports, key, {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function get() {
|
|
119
|
+
return _hooks[key];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
109
122
|
});
|
package/lib/utils/math.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { quat, vec2, vec4 } from 'gl-matrix';
|
|
2
2
|
import { mat3, mat4, vec3 } from 'gl-matrix';
|
|
3
|
+
export declare function clamp(number: number, boundOne: number, boundTwo: number): number;
|
|
3
4
|
export declare function getAngle(angle?: number): number;
|
|
4
5
|
export declare function createVec3(x: number | vec2 | vec3 | vec4, y?: number, z?: number): vec3;
|
|
5
6
|
export declare function deg2rad(deg: number): number;
|
package/lib/utils/math.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.clamp = clamp;
|
|
6
7
|
exports.createVec3 = createVec3;
|
|
7
8
|
exports.decompose = decompose;
|
|
8
9
|
exports.deg2rad = deg2rad;
|
|
@@ -20,10 +21,22 @@ exports.turn2deg = turn2deg;
|
|
|
20
21
|
|
|
21
22
|
var _tslib = require("tslib");
|
|
22
23
|
|
|
23
|
-
var _lodashEs = require("lodash-es");
|
|
24
|
-
|
|
25
24
|
var _glMatrix = require("gl-matrix");
|
|
26
25
|
|
|
26
|
+
var _assert = require("./assert");
|
|
27
|
+
|
|
28
|
+
function clamp(number, boundOne, boundTwo) {
|
|
29
|
+
if (!boundTwo) {
|
|
30
|
+
return Math.max(number, boundOne) === boundOne ? number : boundOne;
|
|
31
|
+
} else if (Math.min(number, boundOne) === number) {
|
|
32
|
+
return boundOne;
|
|
33
|
+
} else if (Math.max(number, boundTwo) === number) {
|
|
34
|
+
return boundTwo;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return number;
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
function getAngle(angle) {
|
|
28
41
|
if (angle === undefined) {
|
|
29
42
|
return 0;
|
|
@@ -43,11 +56,11 @@ function createVec3(x, y, z) {
|
|
|
43
56
|
z = 0;
|
|
44
57
|
}
|
|
45
58
|
|
|
46
|
-
if ((0,
|
|
59
|
+
if ((0, _assert.isNumber)(x)) {
|
|
47
60
|
return _glMatrix.vec3.fromValues(x, y, z);
|
|
48
61
|
}
|
|
49
62
|
|
|
50
|
-
if (
|
|
63
|
+
if (Array.isArray(x) && x.length === 3) {
|
|
51
64
|
return _glMatrix.vec3.clone(x);
|
|
52
65
|
}
|
|
53
66
|
|
package/lib/utils/string.d.ts
CHANGED
package/lib/utils/string.js
CHANGED
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.camelCase = camelCase;
|
|
7
|
+
exports.isString = isString;
|
|
8
|
+
|
|
9
|
+
var _assert = require("./assert");
|
|
7
10
|
|
|
8
11
|
function camelCase(str) {
|
|
9
12
|
if (str === void 0) {
|
|
@@ -13,4 +16,12 @@ function camelCase(str) {
|
|
|
13
16
|
return str.replace(/-([a-z])/g, function (g) {
|
|
14
17
|
return g[1].toUpperCase();
|
|
15
18
|
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isString(str) {
|
|
22
|
+
if (!(0, _assert.isNil)(str) && typeof str === 'string') {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return false;
|
|
16
27
|
}
|
package/lib/utils/text.js
CHANGED
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.toFontString = toFontString;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _assert = require("./assert");
|
|
9
|
+
|
|
10
|
+
var _string = require("./string");
|
|
9
11
|
|
|
10
12
|
var genericFontFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui'];
|
|
11
13
|
|
|
@@ -16,11 +18,11 @@ function toFontString(attributes) {
|
|
|
16
18
|
fontVariant = attributes.fontVariant,
|
|
17
19
|
fontWeight = attributes.fontWeight; // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
|
|
18
20
|
|
|
19
|
-
var fontSizeString = (0,
|
|
21
|
+
var fontSizeString = (0, _assert.isNumber)(fontSize) ? "".concat(fontSize, "px") : fontSize.toString(); // Clean-up fontFamily property by quoting each font name
|
|
20
22
|
// this will support font names with spaces
|
|
21
23
|
// @ts-ignore
|
|
22
24
|
|
|
23
|
-
var fontFamilies = (0,
|
|
25
|
+
var fontFamilies = (0, _string.isString)(fontFamily) ? fontFamily.split(',') : [fontFamily.value];
|
|
24
26
|
|
|
25
27
|
for (var i = fontFamilies.length - 1; i >= 0; i--) {
|
|
26
28
|
// Trim any extra white-space
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.23-alpha.0",
|
|
4
4
|
"description": "A core module including ECS and DI container.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -34,26 +34,23 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/d3-color": "^3.0.2",
|
|
36
36
|
"@types/gl-matrix": "^2.4.5",
|
|
37
|
-
"@types/lodash-es": "^4.17.6",
|
|
38
37
|
"@types/offscreencanvas": "^2019.6.1"
|
|
39
38
|
},
|
|
40
39
|
"homepage": "https://github.com/antvis/g#readme",
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@antv/g-math": "^1.0.
|
|
43
|
-
"@antv/
|
|
41
|
+
"@antv/g-math": "^1.0.20-alpha.0",
|
|
42
|
+
"@antv/util": "^3.0.0",
|
|
44
43
|
"@types/offscreencanvas": "^2019.6.4",
|
|
45
44
|
"d3-color": "^1.4.0",
|
|
46
45
|
"eventemitter3": "^4.0.0",
|
|
47
46
|
"gl-matrix": "^3.1.0",
|
|
48
|
-
"lodash-es": "^4.17.21",
|
|
49
47
|
"mana-syringe": "^0.3.0",
|
|
50
48
|
"reflect-metadata": "^0.1.13",
|
|
51
49
|
"request-animation-frame-polyfill": "^1.1.2",
|
|
52
|
-
"tapable": "^2.2.1",
|
|
53
50
|
"tslib": "^2.3.1"
|
|
54
51
|
},
|
|
55
52
|
"scripts": {
|
|
56
53
|
"umd": "webpack"
|
|
57
54
|
},
|
|
58
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b382a7445d9fa350107dba29d20eb7e6d6da9e79"
|
|
59
56
|
}
|