@antv/g 5.0.23-alpha.9 → 5.1.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 (256) hide show
  1. package/dist/index.umd.min.js +4 -3
  2. package/es/AbstractRenderer.d.ts +11 -0
  3. package/es/AbstractRenderer.js +17 -2
  4. package/es/Canvas.d.ts +1 -1
  5. package/es/Canvas.js +2 -0
  6. package/es/css/CSS.d.ts +2 -1
  7. package/es/css/CSS.js +6 -2
  8. package/es/css/CSSProperty.d.ts +3 -2
  9. package/es/css/StyleValueRegistry.d.ts +4 -2
  10. package/es/css/StyleValueRegistry.js +100 -95
  11. package/es/css/cssom/CSSNumericValue.js +1 -1
  12. package/es/css/index.d.ts +2 -1
  13. package/es/css/index.js +2 -1
  14. package/es/css/interfaces.d.ts +6 -0
  15. package/es/css/interfaces.js +2 -0
  16. package/es/css/layout/FragmentResult.d.ts +32 -0
  17. package/es/css/layout/FragmentResult.js +32 -0
  18. package/es/css/layout/LayoutChildren.d.ts +23 -0
  19. package/es/css/layout/LayoutChildren.js +55 -0
  20. package/es/css/layout/LayoutContext.d.ts +35 -0
  21. package/es/css/layout/LayoutContext.js +35 -0
  22. package/es/css/layout/LayoutDefinition.d.ts +20 -0
  23. package/es/css/layout/LayoutDefinition.js +9 -0
  24. package/es/css/layout/LayoutEdges.d.ts +24 -0
  25. package/es/css/layout/LayoutEdges.js +41 -0
  26. package/es/css/layout/LayoutEngine.d.ts +41 -0
  27. package/es/css/layout/LayoutEngine.js +332 -0
  28. package/es/css/layout/LayoutFragment.d.ts +26 -0
  29. package/es/css/layout/LayoutFragment.js +28 -0
  30. package/es/css/layout/LayoutObject.d.ts +46 -0
  31. package/es/css/layout/LayoutObject.js +172 -0
  32. package/es/css/layout/LayoutRegistry.d.ts +16 -0
  33. package/es/css/layout/LayoutRegistry.js +78 -0
  34. package/es/css/layout/LayoutWorkTask.d.ts +14 -0
  35. package/es/css/layout/LayoutWorkTask.js +1 -0
  36. package/es/css/layout/index.d.ts +11 -0
  37. package/es/css/layout/index.js +11 -0
  38. package/es/css/layout/types.d.ts +104 -0
  39. package/es/css/layout/types.js +66 -0
  40. package/es/css/parser/color.d.ts +1 -1
  41. package/es/css/parser/color.js +2 -2
  42. package/es/css/parser/dimension.js +5 -1
  43. package/es/css/parser/path.d.ts +2 -2
  44. package/es/css/parser/path.js +9 -2
  45. package/es/css/parser/points.d.ts +8 -1
  46. package/es/css/parser/points.js +33 -3
  47. package/es/css/parser/transform.js +1 -1
  48. package/es/css/properties/CSSPropertyClipPath.js +7 -1
  49. package/es/css/properties/CSSPropertyColor.d.ts +1 -1
  50. package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
  51. package/es/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
  52. package/es/css/properties/CSSPropertyLocalPosition.js +64 -20
  53. package/es/css/properties/CSSPropertyPath.d.ts +2 -2
  54. package/es/css/properties/CSSPropertyPath.js +7 -5
  55. package/es/css/properties/CSSPropertyPoints.js +3 -4
  56. package/es/css/properties/CSSPropertyTransform.d.ts +1 -1
  57. package/es/css/properties/CSSPropertyTransform.js +76 -104
  58. package/es/display-objects/Circle.d.ts +4 -0
  59. package/es/display-objects/Circle.js +2 -0
  60. package/es/display-objects/DisplayObject.d.ts +2 -9
  61. package/es/display-objects/DisplayObject.js +8 -27
  62. package/es/display-objects/Ellipse.d.ts +4 -0
  63. package/es/display-objects/Ellipse.js +2 -0
  64. package/es/display-objects/Group.d.ts +4 -0
  65. package/es/display-objects/Group.js +2 -0
  66. package/es/display-objects/HTML.d.ts +4 -4
  67. package/es/display-objects/HTML.js +5 -3
  68. package/es/display-objects/Image.d.ts +4 -0
  69. package/es/display-objects/Image.js +2 -0
  70. package/es/display-objects/Line.js +2 -0
  71. package/es/display-objects/Path.d.ts +2 -2
  72. package/es/display-objects/Polygon.js +1 -1
  73. package/es/display-objects/Polyline.js +1 -1
  74. package/es/display-objects/Rect.d.ts +6 -2
  75. package/es/display-objects/Rect.js +2 -0
  76. package/es/display-objects/Text.d.ts +4 -0
  77. package/es/display-objects/Text.js +2 -0
  78. package/es/dom/Document.js +2 -2
  79. package/es/dom/Element.js +1 -0
  80. package/es/global-module.js +91 -8
  81. package/es/index.d.ts +3 -0
  82. package/es/index.js +3 -0
  83. package/es/plugins/CullingPlugin.d.ts +1 -0
  84. package/es/plugins/CullingPlugin.js +8 -3
  85. package/es/plugins/DirtyCheckPlugin.d.ts +1 -0
  86. package/es/plugins/DirtyCheckPlugin.js +7 -2
  87. package/es/plugins/EventPlugin.d.ts +1 -0
  88. package/es/plugins/EventPlugin.js +14 -9
  89. package/es/plugins/PrepareRendererPlugin.d.ts +1 -0
  90. package/es/plugins/PrepareRendererPlugin.js +10 -5
  91. package/es/services/EventService.js +14 -10
  92. package/es/services/OffscreenCanvasCreator.d.ts +1 -1
  93. package/es/services/OffscreenCanvasCreator.js +1 -1
  94. package/es/services/RenderingService.d.ts +18 -18
  95. package/es/services/RenderingService.js +26 -23
  96. package/es/services/SceneGraphService.d.ts +2 -0
  97. package/es/services/SceneGraphService.js +12 -1
  98. package/es/services/aabb/CircleUpdater.d.ts +0 -2
  99. package/es/services/aabb/CircleUpdater.js +2 -6
  100. package/es/services/aabb/EllipseUpdater.d.ts +0 -2
  101. package/es/services/aabb/EllipseUpdater.js +2 -6
  102. package/es/services/aabb/LineUpdater.d.ts +0 -2
  103. package/es/services/aabb/LineUpdater.js +1 -3
  104. package/es/services/aabb/PathUpdater.d.ts +0 -2
  105. package/es/services/aabb/PathUpdater.js +1 -5
  106. package/es/services/aabb/PolylineUpdater.d.ts +0 -2
  107. package/es/services/aabb/PolylineUpdater.js +1 -3
  108. package/es/services/aabb/RectUpdater.d.ts +0 -2
  109. package/es/services/aabb/RectUpdater.js +1 -5
  110. package/es/services/aabb/TextUpdater.d.ts +7 -0
  111. package/es/services/aabb/TextUpdater.js +0 -4
  112. package/es/services/aabb/interfaces.d.ts +0 -3
  113. package/es/types.d.ts +12 -23
  114. package/es/types.js +1 -0
  115. package/es/utils/deferred.d.ts +43 -0
  116. package/es/utils/deferred.js +117 -0
  117. package/es/utils/dom.d.ts +2 -0
  118. package/es/utils/dom.js +8 -0
  119. package/es/utils/index.d.ts +2 -1
  120. package/es/utils/index.js +2 -1
  121. package/es/utils/interpolation.js +3 -9
  122. package/es/utils/math.js +4 -3
  123. package/es/utils/path.d.ts +2 -2
  124. package/es/utils/path.js +61 -24
  125. package/lib/AbstractRenderer.d.ts +11 -0
  126. package/lib/AbstractRenderer.js +17 -2
  127. package/lib/Canvas.d.ts +1 -1
  128. package/lib/Canvas.js +2 -0
  129. package/lib/css/CSS.d.ts +2 -1
  130. package/lib/css/CSS.js +9 -3
  131. package/lib/css/CSSProperty.d.ts +3 -2
  132. package/lib/css/StyleValueRegistry.d.ts +4 -2
  133. package/lib/css/StyleValueRegistry.js +104 -96
  134. package/lib/css/cssom/CSSNumericValue.js +17 -17
  135. package/lib/css/index.d.ts +2 -1
  136. package/lib/css/index.js +25 -12
  137. package/lib/css/interfaces.d.ts +6 -0
  138. package/lib/css/interfaces.js +12 -0
  139. package/lib/css/layout/FragmentResult.d.ts +32 -0
  140. package/lib/css/layout/FragmentResult.js +51 -0
  141. package/lib/css/layout/LayoutChildren.d.ts +23 -0
  142. package/lib/css/layout/LayoutChildren.js +72 -0
  143. package/lib/css/layout/LayoutContext.d.ts +35 -0
  144. package/lib/css/layout/LayoutContext.js +49 -0
  145. package/lib/css/layout/LayoutDefinition.d.ts +20 -0
  146. package/lib/css/layout/LayoutDefinition.js +16 -0
  147. package/lib/css/layout/LayoutEdges.d.ts +24 -0
  148. package/lib/css/layout/LayoutEdges.js +56 -0
  149. package/lib/css/layout/LayoutEngine.d.ts +41 -0
  150. package/lib/css/layout/LayoutEngine.js +345 -0
  151. package/lib/css/layout/LayoutFragment.d.ts +26 -0
  152. package/lib/css/layout/LayoutFragment.js +44 -0
  153. package/lib/css/layout/LayoutObject.d.ts +46 -0
  154. package/lib/css/layout/LayoutObject.js +182 -0
  155. package/lib/css/layout/LayoutRegistry.d.ts +16 -0
  156. package/lib/css/layout/LayoutRegistry.js +87 -0
  157. package/lib/css/layout/LayoutWorkTask.d.ts +14 -0
  158. package/lib/css/layout/LayoutWorkTask.js +5 -0
  159. package/lib/css/layout/index.d.ts +11 -0
  160. package/lib/css/layout/index.js +148 -0
  161. package/lib/css/layout/types.d.ts +104 -0
  162. package/lib/css/layout/types.js +74 -0
  163. package/lib/css/parser/color.d.ts +1 -1
  164. package/lib/css/parser/color.js +1 -1
  165. package/lib/css/parser/dimension.js +4 -0
  166. package/lib/css/parser/path.d.ts +2 -2
  167. package/lib/css/parser/path.js +9 -2
  168. package/lib/css/parser/points.d.ts +8 -1
  169. package/lib/css/parser/points.js +33 -3
  170. package/lib/css/parser/transform.js +1 -1
  171. package/lib/css/properties/CSSPropertyClipPath.js +8 -1
  172. package/lib/css/properties/CSSPropertyColor.d.ts +1 -1
  173. package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
  174. package/lib/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
  175. package/lib/css/properties/CSSPropertyLocalPosition.js +65 -20
  176. package/lib/css/properties/CSSPropertyPath.d.ts +2 -2
  177. package/lib/css/properties/CSSPropertyPath.js +7 -5
  178. package/lib/css/properties/CSSPropertyPoints.js +3 -4
  179. package/lib/css/properties/CSSPropertyTransform.d.ts +1 -1
  180. package/lib/css/properties/CSSPropertyTransform.js +75 -103
  181. package/lib/display-objects/Circle.d.ts +4 -0
  182. package/lib/display-objects/Circle.js +2 -0
  183. package/lib/display-objects/DisplayObject.d.ts +2 -9
  184. package/lib/display-objects/DisplayObject.js +9 -29
  185. package/lib/display-objects/Ellipse.d.ts +4 -0
  186. package/lib/display-objects/Ellipse.js +2 -0
  187. package/lib/display-objects/Group.d.ts +4 -0
  188. package/lib/display-objects/Group.js +2 -0
  189. package/lib/display-objects/HTML.d.ts +4 -4
  190. package/lib/display-objects/HTML.js +5 -3
  191. package/lib/display-objects/Image.d.ts +4 -0
  192. package/lib/display-objects/Image.js +2 -0
  193. package/lib/display-objects/Line.js +2 -0
  194. package/lib/display-objects/Path.d.ts +2 -2
  195. package/lib/display-objects/Polygon.js +1 -1
  196. package/lib/display-objects/Polyline.js +1 -1
  197. package/lib/display-objects/Rect.d.ts +6 -2
  198. package/lib/display-objects/Rect.js +2 -0
  199. package/lib/display-objects/Text.d.ts +4 -0
  200. package/lib/display-objects/Text.js +2 -0
  201. package/lib/dom/Document.js +2 -2
  202. package/lib/dom/Element.js +1 -0
  203. package/lib/global-module.js +91 -6
  204. package/lib/index.d.ts +3 -0
  205. package/lib/index.js +7 -2
  206. package/lib/plugins/CullingPlugin.d.ts +1 -0
  207. package/lib/plugins/CullingPlugin.js +7 -3
  208. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -0
  209. package/lib/plugins/DirtyCheckPlugin.js +6 -2
  210. package/lib/plugins/EventPlugin.d.ts +1 -0
  211. package/lib/plugins/EventPlugin.js +13 -9
  212. package/lib/plugins/PrepareRendererPlugin.d.ts +1 -0
  213. package/lib/plugins/PrepareRendererPlugin.js +9 -5
  214. package/lib/services/EventService.js +14 -10
  215. package/lib/services/OffscreenCanvasCreator.d.ts +1 -1
  216. package/lib/services/OffscreenCanvasCreator.js +1 -1
  217. package/lib/services/RenderingService.d.ts +18 -18
  218. package/lib/services/RenderingService.js +26 -23
  219. package/lib/services/SceneGraphService.d.ts +2 -0
  220. package/lib/services/SceneGraphService.js +15 -1
  221. package/lib/services/aabb/CircleUpdater.d.ts +0 -2
  222. package/lib/services/aabb/CircleUpdater.js +2 -6
  223. package/lib/services/aabb/EllipseUpdater.d.ts +0 -2
  224. package/lib/services/aabb/EllipseUpdater.js +2 -6
  225. package/lib/services/aabb/LineUpdater.d.ts +0 -2
  226. package/lib/services/aabb/LineUpdater.js +1 -3
  227. package/lib/services/aabb/PathUpdater.d.ts +0 -2
  228. package/lib/services/aabb/PathUpdater.js +1 -5
  229. package/lib/services/aabb/PolylineUpdater.d.ts +0 -2
  230. package/lib/services/aabb/PolylineUpdater.js +1 -3
  231. package/lib/services/aabb/RectUpdater.d.ts +0 -2
  232. package/lib/services/aabb/RectUpdater.js +1 -5
  233. package/lib/services/aabb/TextUpdater.d.ts +7 -0
  234. package/lib/services/aabb/TextUpdater.js +0 -4
  235. package/lib/services/aabb/interfaces.d.ts +0 -3
  236. package/lib/types.d.ts +12 -23
  237. package/lib/types.js +1 -0
  238. package/lib/utils/deferred.d.ts +43 -0
  239. package/lib/utils/deferred.js +131 -0
  240. package/lib/utils/dom.d.ts +2 -0
  241. package/lib/utils/dom.js +17 -0
  242. package/lib/utils/index.d.ts +2 -1
  243. package/lib/utils/index.js +17 -4
  244. package/lib/utils/interpolation.js +4 -10
  245. package/lib/utils/math.js +4 -3
  246. package/lib/utils/path.d.ts +2 -2
  247. package/lib/utils/path.js +55 -24
  248. package/package.json +4 -3
  249. package/es/css/LayoutRegistry.d.ts +0 -11
  250. package/es/css/LayoutRegistry.js +0 -22
  251. package/es/utils/hooks.d.ts +0 -280
  252. package/es/utils/hooks.js +0 -753
  253. package/lib/css/LayoutRegistry.d.ts +0 -11
  254. package/lib/css/LayoutRegistry.js +0 -30
  255. package/lib/utils/hooks.d.ts +0 -280
  256. package/lib/utils/hooks.js +0 -759
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LayoutRegistry = void 0;
7
+
8
+ var _tslib = require("tslib");
9
+
10
+ var _manaSyringe = require("mana-syringe");
11
+
12
+ // export const LayoutContribution = Syringe.defineToken('LayoutContribution');
13
+ // // eslint-disable-next-line @typescript-eslint/no-redeclare
14
+ // export interface LayoutContribution {
15
+ // registerLayout: (layoutRegistry: LayoutRegistry) => void;
16
+ // }
17
+ var LayoutRegistry =
18
+ /** @class */
19
+ function () {
20
+ function LayoutRegistry() {
21
+ this.registry = new Map();
22
+ }
23
+
24
+ LayoutRegistry_1 = LayoutRegistry;
25
+ Object.defineProperty(LayoutRegistry.prototype, "size", {
26
+ get: function get() {
27
+ return this.registry.size;
28
+ },
29
+ enumerable: false,
30
+ configurable: true
31
+ });
32
+
33
+ LayoutRegistry.prototype.hasLayout = function (name) {
34
+ return this.registry.has(name);
35
+ };
36
+ /**
37
+ *
38
+ * @param name layout name, default to 'absolute'
39
+ * @returns layout object
40
+ */
41
+
42
+
43
+ LayoutRegistry.prototype.getLayout = function (name) {
44
+ if (name === void 0) {
45
+ name = 'absolute';
46
+ }
47
+
48
+ if (!this.hasLayout(name)) {
49
+ throw new Error("invalid layout property: ".concat(name));
50
+ }
51
+
52
+ return this.registry.get(name);
53
+ };
54
+
55
+ LayoutRegistry.prototype.updateLayout = function (name, layout) {
56
+ this.registry.set(name, layout);
57
+ };
58
+
59
+ LayoutRegistry.prototype.registerLayout = function (name, layout) {
60
+ if (name === '') {
61
+ throw new TypeError("layout name cant't be empty");
62
+ }
63
+
64
+ if (LayoutRegistry_1.reservedLayout.includes(name)) {
65
+ throw new Error("layout name '".concat(name, "' is a system reserved layout name, please use another name"));
66
+ }
67
+
68
+ if (this.hasLayout(name)) {
69
+ throw new Error("layout '".concat(name, "' already exist."));
70
+ }
71
+
72
+ this.registry.set(name, layout);
73
+ };
74
+
75
+ LayoutRegistry.prototype.deleteLayout = function (name) {
76
+ this.registry.delete(name);
77
+ };
78
+
79
+ var LayoutRegistry_1; // 系统保留的布局名称,外部用户不能使用
80
+ // private static reservedLayout = ['relative', 'absolute', 'fixed', 'flex', 'dagre', 'autolayout'];
81
+
82
+ LayoutRegistry.reservedLayout = [];
83
+ LayoutRegistry = LayoutRegistry_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], LayoutRegistry);
84
+ return LayoutRegistry;
85
+ }();
86
+
87
+ exports.LayoutRegistry = LayoutRegistry;
@@ -0,0 +1,14 @@
1
+ import type { Deferred } from '../../utils';
2
+ import type { LayoutChildren } from './LayoutChildren';
3
+ import type { LayoutFragment } from './LayoutFragment';
4
+ import type { IntrinsicSizes, LayoutConstraints, LayoutTaskType } from './types';
5
+ export declare type LayoutWorkTask = {
6
+ layoutConstraints: LayoutConstraints;
7
+ layoutChild: LayoutChildren;
8
+ taskType: LayoutTaskType.Layout;
9
+ deferred: Deferred<LayoutFragment>;
10
+ } | {
11
+ layoutChild: LayoutChildren;
12
+ taskType: LayoutTaskType.IntrinsicSizes;
13
+ deferred: Deferred<IntrinsicSizes>;
14
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,11 @@
1
+ export * from './FragmentResult';
2
+ export * from './LayoutChildren';
3
+ export * from './LayoutContext';
4
+ export * from './LayoutDefinition';
5
+ export * from './LayoutEdges';
6
+ export * from './LayoutEngine';
7
+ export * from './LayoutFragment';
8
+ export * from './LayoutRegistry';
9
+ export * from './LayoutWorkTask';
10
+ export * from './LayoutObject';
11
+ export * from './types';
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _FragmentResult = require("./FragmentResult");
8
+
9
+ Object.keys(_FragmentResult).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _FragmentResult[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _FragmentResult[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _LayoutChildren = require("./LayoutChildren");
21
+
22
+ Object.keys(_LayoutChildren).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _LayoutChildren[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _LayoutChildren[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _LayoutContext = require("./LayoutContext");
34
+
35
+ Object.keys(_LayoutContext).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _LayoutContext[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _LayoutContext[key];
42
+ }
43
+ });
44
+ });
45
+
46
+ var _LayoutDefinition = require("./LayoutDefinition");
47
+
48
+ Object.keys(_LayoutDefinition).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _LayoutDefinition[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function get() {
54
+ return _LayoutDefinition[key];
55
+ }
56
+ });
57
+ });
58
+
59
+ var _LayoutEdges = require("./LayoutEdges");
60
+
61
+ Object.keys(_LayoutEdges).forEach(function (key) {
62
+ if (key === "default" || key === "__esModule") return;
63
+ if (key in exports && exports[key] === _LayoutEdges[key]) return;
64
+ Object.defineProperty(exports, key, {
65
+ enumerable: true,
66
+ get: function get() {
67
+ return _LayoutEdges[key];
68
+ }
69
+ });
70
+ });
71
+
72
+ var _LayoutEngine = require("./LayoutEngine");
73
+
74
+ Object.keys(_LayoutEngine).forEach(function (key) {
75
+ if (key === "default" || key === "__esModule") return;
76
+ if (key in exports && exports[key] === _LayoutEngine[key]) return;
77
+ Object.defineProperty(exports, key, {
78
+ enumerable: true,
79
+ get: function get() {
80
+ return _LayoutEngine[key];
81
+ }
82
+ });
83
+ });
84
+
85
+ var _LayoutFragment = require("./LayoutFragment");
86
+
87
+ Object.keys(_LayoutFragment).forEach(function (key) {
88
+ if (key === "default" || key === "__esModule") return;
89
+ if (key in exports && exports[key] === _LayoutFragment[key]) return;
90
+ Object.defineProperty(exports, key, {
91
+ enumerable: true,
92
+ get: function get() {
93
+ return _LayoutFragment[key];
94
+ }
95
+ });
96
+ });
97
+
98
+ var _LayoutRegistry = require("./LayoutRegistry");
99
+
100
+ Object.keys(_LayoutRegistry).forEach(function (key) {
101
+ if (key === "default" || key === "__esModule") return;
102
+ if (key in exports && exports[key] === _LayoutRegistry[key]) return;
103
+ Object.defineProperty(exports, key, {
104
+ enumerable: true,
105
+ get: function get() {
106
+ return _LayoutRegistry[key];
107
+ }
108
+ });
109
+ });
110
+
111
+ var _LayoutWorkTask = require("./LayoutWorkTask");
112
+
113
+ Object.keys(_LayoutWorkTask).forEach(function (key) {
114
+ if (key === "default" || key === "__esModule") return;
115
+ if (key in exports && exports[key] === _LayoutWorkTask[key]) return;
116
+ Object.defineProperty(exports, key, {
117
+ enumerable: true,
118
+ get: function get() {
119
+ return _LayoutWorkTask[key];
120
+ }
121
+ });
122
+ });
123
+
124
+ var _LayoutObject = require("./LayoutObject");
125
+
126
+ Object.keys(_LayoutObject).forEach(function (key) {
127
+ if (key === "default" || key === "__esModule") return;
128
+ if (key in exports && exports[key] === _LayoutObject[key]) return;
129
+ Object.defineProperty(exports, key, {
130
+ enumerable: true,
131
+ get: function get() {
132
+ return _LayoutObject[key];
133
+ }
134
+ });
135
+ });
136
+
137
+ var _types = require("./types");
138
+
139
+ Object.keys(_types).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _types[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function get() {
145
+ return _types[key];
146
+ }
147
+ });
148
+ });
@@ -0,0 +1,104 @@
1
+ export declare type ContextId = string;
2
+ export declare enum LayoutTaskType {
3
+ Layout = "layout",
4
+ IntrinsicSizes = "intrinsic-sizes"
5
+ }
6
+ export interface LayoutOptions {
7
+ /**
8
+ * = "block"
9
+ */
10
+ childDisplay: ChildDisplayType;
11
+ /**
12
+ * = "block-like
13
+ */
14
+ sizing: LayoutSizingMode;
15
+ }
16
+ declare enum ChildDisplayType {
17
+ 'block' = 0,
18
+ 'normal' = 1
19
+ }
20
+ declare enum LayoutSizingMode {
21
+ 'block-like' = 0,
22
+ 'manual' = 1
23
+ }
24
+ export interface IntrinsicSizes {
25
+ readonly minContentInlineSize: number;
26
+ readonly minContentBlockSize: number;
27
+ readonly maxContentInlineSize: number;
28
+ readonly maxContentBlockSize: number;
29
+ }
30
+ export interface LayoutConstraints<T = void> {
31
+ /**
32
+ * the available space the current layout must respect
33
+ */
34
+ readonly availableInlineSize: number;
35
+ readonly availableBlockSize: number;
36
+ /**
37
+ * require current layout must to be exact size
38
+ */
39
+ readonly fixedInlineSize?: number;
40
+ readonly fixedBlockSize?: number;
41
+ /**
42
+ * used to resolve percentage value
43
+ * Web developers should resolve any percentages against the percentage sizes.
44
+ * eg. `const value = constraints.percentageInlineSize * 0.5;`
45
+ */
46
+ readonly percentageInlineSize: number;
47
+ readonly percentageBlockSize: number;
48
+ readonly data: T;
49
+ }
50
+ export declare enum PropertyName {
51
+ LAYOUT = "display",
52
+ LEFT = "left",
53
+ TOP = "top",
54
+ BOTTOM = "bottom",
55
+ RIGHT = "right",
56
+ WIDTH = "width",
57
+ HEIGHT = "height",
58
+ MIN_WIDTH = "minWidth",
59
+ MAX_WIDTH = "maxWidth",
60
+ MIN_HEIGHT = "minHeight",
61
+ MAX_HEIGHT = "maxHeight",
62
+ BOX_SIZING = "boxSizing",
63
+ PADDING = "padding",
64
+ PADDING_TOP = "paddingTop",
65
+ PADDING_BOTTOM = "paddingBottom",
66
+ PADDING_START = "paddingLeft",
67
+ PADDING_END = "paddingRight",
68
+ MARGIN = "margin",
69
+ MARGIN_TOP = "marginTop",
70
+ MARGIN_BOTTOM = "marginBottom",
71
+ MARGIN_START = "marginLeft",
72
+ MARGIN_END = "marginRight",
73
+ BORDER = "border",
74
+ BORDER_TOP = "borderTop",
75
+ BORDER_BOTTOM = "borderBottom",
76
+ BORDER_START = "borderLeft",
77
+ BORDER_END = "borderRight",
78
+ FLEX_DIRECTION = "flexDirection",
79
+ FLEX_WRAP = "flexWrap",
80
+ FLEX_FLOW = "flexFlow",
81
+ ALIGN_ITEMS = "alignItems",
82
+ ALIGN_CONTENT = "alignContent",
83
+ JUSTIFY_CONTENT = "justifyContent",
84
+ FLEX = "flex",
85
+ ALIGN_SELF = "alignSelf",
86
+ FLEX_SHRINK = "flexShrink",
87
+ FLEX_BASIS = "flexBasis",
88
+ FLEX_GROW = "flexGrow",
89
+ OFFSET_WIDTH = "offsetWidth",
90
+ OFFSET_HEIGHT = "offsetHeight",
91
+ ORDER = "order"
92
+ }
93
+ export declare type MeasureFn = (width?: number, height?: number) => {
94
+ width: number;
95
+ height: number;
96
+ };
97
+ export interface ComputedLayout {
98
+ readonly width: number;
99
+ readonly height: number;
100
+ readonly x: number;
101
+ readonly y: number;
102
+ readonly children: ComputedLayout[];
103
+ }
104
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PropertyName = exports.LayoutTaskType = void 0;
7
+ var LayoutTaskType;
8
+ exports.LayoutTaskType = LayoutTaskType;
9
+
10
+ (function (LayoutTaskType) {
11
+ LayoutTaskType["Layout"] = "layout";
12
+ LayoutTaskType["IntrinsicSizes"] = "intrinsic-sizes";
13
+ })(LayoutTaskType || (exports.LayoutTaskType = LayoutTaskType = {}));
14
+
15
+ var ChildDisplayType;
16
+
17
+ (function (ChildDisplayType) {
18
+ ChildDisplayType[ChildDisplayType["block"] = 0] = "block";
19
+ ChildDisplayType[ChildDisplayType["normal"] = 1] = "normal";
20
+ })(ChildDisplayType || (ChildDisplayType = {}));
21
+
22
+ var LayoutSizingMode;
23
+
24
+ (function (LayoutSizingMode) {
25
+ LayoutSizingMode[LayoutSizingMode["block-like"] = 0] = "block-like";
26
+ LayoutSizingMode[LayoutSizingMode["manual"] = 1] = "manual";
27
+ })(LayoutSizingMode || (LayoutSizingMode = {}));
28
+
29
+ var PropertyName;
30
+ exports.PropertyName = PropertyName;
31
+
32
+ (function (PropertyName) {
33
+ PropertyName["LAYOUT"] = "display";
34
+ PropertyName["LEFT"] = "left";
35
+ PropertyName["TOP"] = "top";
36
+ PropertyName["BOTTOM"] = "bottom";
37
+ PropertyName["RIGHT"] = "right";
38
+ PropertyName["WIDTH"] = "width";
39
+ PropertyName["HEIGHT"] = "height";
40
+ PropertyName["MIN_WIDTH"] = "minWidth";
41
+ PropertyName["MAX_WIDTH"] = "maxWidth";
42
+ PropertyName["MIN_HEIGHT"] = "minHeight";
43
+ PropertyName["MAX_HEIGHT"] = "maxHeight";
44
+ PropertyName["BOX_SIZING"] = "boxSizing";
45
+ PropertyName["PADDING"] = "padding";
46
+ PropertyName["PADDING_TOP"] = "paddingTop";
47
+ PropertyName["PADDING_BOTTOM"] = "paddingBottom";
48
+ PropertyName["PADDING_START"] = "paddingLeft";
49
+ PropertyName["PADDING_END"] = "paddingRight";
50
+ PropertyName["MARGIN"] = "margin";
51
+ PropertyName["MARGIN_TOP"] = "marginTop";
52
+ PropertyName["MARGIN_BOTTOM"] = "marginBottom";
53
+ PropertyName["MARGIN_START"] = "marginLeft";
54
+ PropertyName["MARGIN_END"] = "marginRight";
55
+ PropertyName["BORDER"] = "border";
56
+ PropertyName["BORDER_TOP"] = "borderTop";
57
+ PropertyName["BORDER_BOTTOM"] = "borderBottom";
58
+ PropertyName["BORDER_START"] = "borderLeft";
59
+ PropertyName["BORDER_END"] = "borderRight";
60
+ PropertyName["FLEX_DIRECTION"] = "flexDirection";
61
+ PropertyName["FLEX_WRAP"] = "flexWrap";
62
+ PropertyName["FLEX_FLOW"] = "flexFlow";
63
+ PropertyName["ALIGN_ITEMS"] = "alignItems";
64
+ PropertyName["ALIGN_CONTENT"] = "alignContent";
65
+ PropertyName["JUSTIFY_CONTENT"] = "justifyContent";
66
+ PropertyName["FLEX"] = "flex";
67
+ PropertyName["ALIGN_SELF"] = "alignSelf";
68
+ PropertyName["FLEX_SHRINK"] = "flexShrink";
69
+ PropertyName["FLEX_BASIS"] = "flexBasis";
70
+ PropertyName["FLEX_GROW"] = "flexGrow";
71
+ PropertyName["OFFSET_WIDTH"] = "offsetWidth";
72
+ PropertyName["OFFSET_HEIGHT"] = "offsetHeight";
73
+ PropertyName["ORDER"] = "order";
74
+ })(PropertyName || (exports.PropertyName = PropertyName = {}));
@@ -2,5 +2,5 @@ import { CSSRGB, CSSGradientValue } from '../cssom';
2
2
  /**
3
3
  * @see https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/parser/CSSParser.cpp#L97
4
4
  */
5
- export declare function parseColor(colorStr?: string): CSSRGB | CSSGradientValue;
5
+ export declare function parseColor(colorStr: string): CSSRGB | CSSGradientValue;
6
6
  export declare function mergeColors(left: CSSRGB | CSSGradientValue, right: CSSRGB | CSSGradientValue): [number[], number[], (color: number[]) => string] | undefined;
@@ -29,7 +29,7 @@ var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi;
29
29
  */
30
30
 
31
31
  function parseColor(colorStr) {
32
- if (colorStr === void 0) {
32
+ if ((0, _utils.isNil)(colorStr)) {
33
33
  colorStr = '';
34
34
  }
35
35
 
@@ -19,6 +19,10 @@ var _utils = require("../../utils");
19
19
  var _cssom = require("../cssom");
20
20
 
21
21
  function parseDimension(unitRegExp, string) {
22
+ if ((0, _utils.isNil)(string)) {
23
+ return new _cssom.CSSUnitValue(0, 'px');
24
+ }
25
+
22
26
  string = "".concat(string).trim().toLowerCase();
23
27
 
24
28
  if (isFinite(Number(string))) {
@@ -1,5 +1,5 @@
1
1
  import type { PathCommand } from '../../types';
2
- import type { ParsedPathStyleProps } from '../../display-objects';
2
+ import type { ParsedPathStyleProps, DisplayObject } from '../../display-objects';
3
3
  import type { IElement } from '../../dom';
4
- export declare function parsePath(path: string): ParsedPathStyleProps['path'];
4
+ export declare function parsePath(path: string, object: DisplayObject): ParsedPathStyleProps['path'];
5
5
  export declare function mergePaths(left: ParsedPathStyleProps['path'], right: ParsedPathStyleProps['path'], object: IElement): [PathCommand[], PathCommand[], (b: PathCommand[]) => PathCommand[]];
@@ -16,7 +16,7 @@ var _path = require("../../utils/path");
16
16
 
17
17
  var _Rectangle = require("../../shapes/Rectangle");
18
18
 
19
- function parsePath(path) {
19
+ function parsePath(path, object) {
20
20
  var absolutePath = (0, _util.path2Absolute)(path);
21
21
  var hasArc = hasArcOrBezier(absolutePath);
22
22
  var clonedAbsolutePath = absolutePath.slice();
@@ -37,6 +37,13 @@ function parsePath(path) {
37
37
  totalLength = _c.totalLength,
38
38
  curveSegments = _c.curveSegments;
39
39
 
40
+ var rect = getPathBBox(curve);
41
+
42
+ if (object) {
43
+ object.parsedStyle.defX = rect.x;
44
+ object.parsedStyle.defY = rect.y;
45
+ }
46
+
40
47
  return {
41
48
  absolutePath: absolutePath,
42
49
  hasArc: hasArc,
@@ -47,7 +54,7 @@ function parsePath(path) {
47
54
  totalLength: totalLength,
48
55
  curveSegments: curveSegments,
49
56
  zCommandIndexes: zCommandIndexes,
50
- rect: getPathBBox(curve)
57
+ rect: rect
51
58
  };
52
59
  }
53
60
 
@@ -1,4 +1,11 @@
1
- export declare function parsePoints(points: string | [number, number][]): {
1
+ import type { DisplayObject } from '../..';
2
+ /**
3
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/points
4
+ *
5
+ * @example
6
+ * points="100,10 250,150 200,110"
7
+ */
8
+ export declare function parsePoints(pointsOrStr: string | [number, number][], object: DisplayObject): {
2
9
  points: [number, number][];
3
10
  totalLength: number;
4
11
  segments: [number, number][];
@@ -5,13 +5,31 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.parsePoints = parsePoints;
7
7
 
8
+ var _tslib = require("tslib");
9
+
8
10
  var _gMath = require("@antv/g-math");
9
11
 
10
12
  var _utils = require("../../utils");
11
13
 
12
- function parsePoints(points) {
13
- if ((0, _utils.isString)(points)) {
14
- return null;
14
+ /**
15
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/points
16
+ *
17
+ * @example
18
+ * points="100,10 250,150 200,110"
19
+ */
20
+ function parsePoints(pointsOrStr, object) {
21
+ var points;
22
+
23
+ if ((0, _utils.isString)(pointsOrStr)) {
24
+ points = pointsOrStr.split(' ').map(function (pointStr) {
25
+ var _a = (0, _tslib.__read)(pointStr.split(','), 2),
26
+ x = _a[0],
27
+ y = _a[1];
28
+
29
+ return [Number(x), Number(y)];
30
+ });
31
+ } else {
32
+ points = pointsOrStr;
15
33
  }
16
34
 
17
35
  var segments = [];
@@ -31,6 +49,18 @@ function parsePoints(points) {
31
49
  segments.push(segmentT);
32
50
  }
33
51
  });
52
+ var minX = Math.min.apply(Math, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(points.map(function (point) {
53
+ return point[0];
54
+ })), false));
55
+ var minY = Math.min.apply(Math, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(points.map(function (point) {
56
+ return point[1];
57
+ })), false));
58
+
59
+ if (object) {
60
+ object.parsedStyle.defX = minX;
61
+ object.parsedStyle.defY = minY;
62
+ }
63
+
34
64
  return {
35
65
  points: points,
36
66
  totalLength: totalLength,
@@ -63,7 +63,7 @@ var transformFunctions = {
63
63
  */
64
64
 
65
65
  function parseTransform(string) {
66
- string = string.toLowerCase().trim();
66
+ string = (string || 'none').toLowerCase().trim();
67
67
 
68
68
  if (string === 'none') {
69
69
  return [];
@@ -11,6 +11,8 @@ var _manaSyringe = require("mana-syringe");
11
11
 
12
12
  var _services = require("../../services");
13
13
 
14
+ var _cssom = require("../cssom");
15
+
14
16
  /**
15
17
  * @see /zh/docs/api/basic/display-object#clippath
16
18
  * @example
@@ -34,7 +36,12 @@ function () {
34
36
  function CSSPropertyClipPath() {}
35
37
 
36
38
  CSSPropertyClipPath.prototype.calculator = function (name, oldClipPath, newClipPath, object) {
37
- // clear ref to old clip path
39
+ // unset
40
+ if (newClipPath instanceof _cssom.CSSKeywordValue) {
41
+ newClipPath = null;
42
+ } // clear ref to old clip path
43
+
44
+
38
45
  if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.style.clipPathTargets) {
39
46
  var index = oldClipPath.style.clipPathTargets.indexOf(object);
40
47
  oldClipPath.style.clipPathTargets.splice(index, 1);
@@ -3,7 +3,7 @@ import type { DisplayObject } from '../../display-objects';
3
3
  import { parseColor, mergeColors } from '../parser';
4
4
  import type { CSSGradientValue } from '../cssom';
5
5
  import { CSSKeywordValue, CSSRGB } from '../cssom';
6
- import type { StyleValueRegistry } from '../StyleValueRegistry';
6
+ import type { StyleValueRegistry } from '../interfaces';
7
7
  /**
8
8
  * opacity
9
9
  */
@@ -1,6 +1,6 @@
1
1
  import { CSSUnitValue } from '../cssom';
2
2
  import { mergeDimensions } from '../parser';
3
- import type { StyleValueRegistry } from '../StyleValueRegistry';
3
+ import type { StyleValueRegistry } from '../interfaces';
4
4
  import type { DisplayObject } from '../../display-objects';
5
5
  import type { CSSProperty } from '../CSSProperty';
6
6
  /**
@@ -1,20 +1,11 @@
1
1
  import type { DisplayObject } from '../../display-objects';
2
2
  import type { CSSProperty } from '../CSSProperty';
3
3
  import type { CSSUnitValue } from '../cssom';
4
- import { mergeDimensions } from '../parser';
5
4
  import { CSSPropertyLengthOrPercentage } from './CSSPropertyLengthOrPercentage';
6
5
  /**
7
6
  * local position
8
7
  */
9
8
  export declare class CSSPropertyLocalPosition extends CSSPropertyLengthOrPercentage implements Partial<CSSProperty<CSSUnitValue, CSSUnitValue>> {
10
- /**
11
- * <length> & <percentage>
12
- */
13
- parser: (css: string) => CSSUnitValue;
14
- /**
15
- * mix between CSS.px(x)
16
- */
17
- mixer: typeof mergeDimensions;
18
9
  /**
19
10
  * update local position
20
11
  */