@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.
Files changed (102) hide show
  1. package/dist/index.umd.min.js +3 -3
  2. package/es/AbstractRenderer.js +5 -0
  3. package/es/camera/Camera.js +2 -2
  4. package/es/css/parser/color.js +1 -1
  5. package/es/css/parser/dimension.js +1 -2
  6. package/es/css/parser/numeric.js +1 -1
  7. package/es/css/parser/path.d.ts +2 -2
  8. package/es/css/parser/path.js +1 -1
  9. package/es/css/parser/points.js +1 -1
  10. package/es/css/parser/transform-origin.js +1 -1
  11. package/es/css/properties/CSSPropertyPath.d.ts +14 -2
  12. package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  13. package/es/css/properties/CSSPropertyTransform.js +1 -2
  14. package/es/display-objects/DisplayObject.js +4 -5
  15. package/es/display-objects/Path.d.ts +15 -15
  16. package/es/display-objects/Path.js +1 -1
  17. package/es/display-objects/Polygon.d.ts +8 -1
  18. package/es/display-objects/Polyline.d.ts +7 -5
  19. package/es/dom/Document.js +2 -2
  20. package/es/dom/Element.js +1 -2
  21. package/es/dom/EventTarget.js +1 -1
  22. package/es/dom/FederatedTouchEvent.d.ts +5 -3
  23. package/es/plugins/CullingPlugin.d.ts +0 -1
  24. package/es/plugins/CullingPlugin.js +3 -8
  25. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  26. package/es/plugins/DirtyCheckPlugin.js +9 -8
  27. package/es/plugins/EventPlugin.d.ts +1 -1
  28. package/es/plugins/EventPlugin.js +163 -148
  29. package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
  30. package/es/plugins/PrepareRendererPlugin.js +15 -16
  31. package/es/services/EventService.d.ts +8 -0
  32. package/es/services/EventService.js +274 -20
  33. package/es/services/RenderingService.d.ts +17 -16
  34. package/es/services/RenderingService.js +18 -17
  35. package/es/services/SceneGraphService.js +1 -1
  36. package/es/services/aabb/PathUpdater.d.ts +3 -3
  37. package/es/services/aabb/PolylineUpdater.d.ts +3 -3
  38. package/es/services/aabb/RectUpdater.js +1 -1
  39. package/es/types.d.ts +5 -3
  40. package/es/utils/assert.d.ts +6 -0
  41. package/es/utils/assert.js +18 -0
  42. package/es/utils/event.d.ts +18 -16
  43. package/es/utils/hooks.d.ts +280 -0
  44. package/es/utils/hooks.js +753 -0
  45. package/es/utils/index.d.ts +1 -0
  46. package/es/utils/index.js +2 -1
  47. package/es/utils/math.d.ts +1 -0
  48. package/es/utils/math.js +13 -2
  49. package/es/utils/string.d.ts +1 -0
  50. package/es/utils/string.js +8 -0
  51. package/es/utils/text.js +2 -1
  52. package/lib/AbstractRenderer.js +5 -0
  53. package/lib/camera/Camera.js +4 -4
  54. package/lib/css/parser/color.js +5 -5
  55. package/lib/css/parser/dimension.js +1 -3
  56. package/lib/css/parser/numeric.js +3 -3
  57. package/lib/css/parser/path.d.ts +2 -2
  58. package/lib/css/parser/path.js +4 -4
  59. package/lib/css/parser/points.js +2 -2
  60. package/lib/css/parser/transform-origin.js +2 -2
  61. package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
  62. package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  63. package/lib/css/properties/CSSPropertyTransform.js +0 -2
  64. package/lib/display-objects/DisplayObject.js +7 -9
  65. package/lib/display-objects/Path.d.ts +15 -15
  66. package/lib/display-objects/Path.js +3 -3
  67. package/lib/display-objects/Polygon.d.ts +8 -1
  68. package/lib/display-objects/Polyline.d.ts +7 -5
  69. package/lib/dom/Document.js +2 -2
  70. package/lib/dom/Element.js +1 -3
  71. package/lib/dom/EventTarget.js +9 -9
  72. package/lib/dom/FederatedTouchEvent.d.ts +5 -3
  73. package/lib/plugins/CullingPlugin.d.ts +0 -1
  74. package/lib/plugins/CullingPlugin.js +3 -7
  75. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  76. package/lib/plugins/DirtyCheckPlugin.js +10 -8
  77. package/lib/plugins/EventPlugin.d.ts +1 -1
  78. package/lib/plugins/EventPlugin.js +172 -156
  79. package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
  80. package/lib/plugins/PrepareRendererPlugin.js +14 -14
  81. package/lib/services/EventService.d.ts +8 -0
  82. package/lib/services/EventService.js +274 -19
  83. package/lib/services/RenderingService.d.ts +17 -16
  84. package/lib/services/RenderingService.js +19 -18
  85. package/lib/services/SceneGraphService.js +3 -3
  86. package/lib/services/aabb/PathUpdater.d.ts +3 -3
  87. package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
  88. package/lib/services/aabb/RectUpdater.js +3 -3
  89. package/lib/types.d.ts +5 -3
  90. package/lib/utils/assert.d.ts +6 -0
  91. package/lib/utils/assert.js +30 -0
  92. package/lib/utils/event.d.ts +18 -16
  93. package/lib/utils/hooks.d.ts +280 -0
  94. package/lib/utils/hooks.js +759 -0
  95. package/lib/utils/index.d.ts +1 -0
  96. package/lib/utils/index.js +13 -0
  97. package/lib/utils/math.d.ts +1 -0
  98. package/lib/utils/math.js +17 -4
  99. package/lib/utils/string.d.ts +1 -0
  100. package/lib/utils/string.js +11 -0
  101. package/lib/utils/text.js +5 -3
  102. package/package.json +4 -7
@@ -6,3 +6,4 @@ export * from './text';
6
6
  export * from './string';
7
7
  export * from './event';
8
8
  export * from './canvas';
9
+ export * from './hooks';
@@ -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
  });
@@ -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, _lodashEs.isNumber)(x)) {
59
+ if ((0, _assert.isNumber)(x)) {
47
60
  return _glMatrix.vec3.fromValues(x, y, z);
48
61
  }
49
62
 
50
- if ((0, _lodashEs.isArray)(x) && x.length === 3) {
63
+ if (Array.isArray(x) && x.length === 3) {
51
64
  return _glMatrix.vec3.clone(x);
52
65
  }
53
66
 
@@ -1 +1,2 @@
1
1
  export declare function camelCase(str?: string): string;
2
+ export declare function isString(str: any): str is string;
@@ -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 _lodashEs = require("lodash-es");
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, _lodashEs.isNumber)(fontSize) ? "".concat(fontSize, "px") : fontSize.toString(); // Clean-up fontFamily property by quoting each font name
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, _lodashEs.isString)(fontFamily) ? fontFamily.split(',') : [fontFamily.value];
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.22",
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.19",
43
- "@antv/path-util": "^3.0.1",
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": "a52a7c8d754925e5732baf3faea156332748365f"
55
+ "gitHead": "b382a7445d9fa350107dba29d20eb7e6d6da9e79"
59
56
  }