@antv/g6 5.0.0-beta.3 → 5.0.0-beta.5

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 (201) hide show
  1. package/dist/g6.min.js +2 -2
  2. package/esm/constant/shape.d.ts +2 -0
  3. package/esm/index.d.ts +4 -1
  4. package/esm/index.js +1 -1
  5. package/esm/item/edge.d.ts +1 -0
  6. package/esm/item/edge.js +3 -1
  7. package/esm/item/edge.js.map +1 -1
  8. package/esm/item/item.d.ts +3 -2
  9. package/esm/item/item.js +12 -6
  10. package/esm/item/item.js.map +1 -1
  11. package/esm/item/node.d.ts +1 -0
  12. package/esm/item/node.js +11 -4
  13. package/esm/item/node.js.map +1 -1
  14. package/esm/runtime/controller/item.js +252 -148
  15. package/esm/runtime/controller/item.js.map +1 -1
  16. package/esm/runtime/graph.d.ts +16 -14
  17. package/esm/runtime/graph.js +66 -28
  18. package/esm/runtime/graph.js.map +1 -1
  19. package/esm/stdlib/behavior/activate-relations.js +2 -2
  20. package/esm/stdlib/behavior/activate-relations.js.map +1 -1
  21. package/esm/stdlib/behavior/click-select.js +1 -1
  22. package/esm/stdlib/behavior/click-select.js.map +1 -1
  23. package/esm/stdlib/behavior/drag-canvas.js +50 -27
  24. package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
  25. package/esm/stdlib/behavior/drag-combo.js +8 -8
  26. package/esm/stdlib/behavior/drag-combo.js.map +1 -1
  27. package/esm/stdlib/behavior/drag-node.js +10 -10
  28. package/esm/stdlib/behavior/drag-node.js.map +1 -1
  29. package/esm/stdlib/behavior/zoom-canvas.js +47 -24
  30. package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
  31. package/esm/stdlib/index.d.ts +3 -0
  32. package/esm/stdlib/index.js +12 -9
  33. package/esm/stdlib/index.js.map +1 -1
  34. package/esm/stdlib/item/edge/base.d.ts +1 -1
  35. package/esm/stdlib/item/edge/base.js +13 -4
  36. package/esm/stdlib/item/edge/base.js.map +1 -1
  37. package/esm/stdlib/item/node/base.d.ts +1 -1
  38. package/esm/stdlib/item/node/base.js +18 -26
  39. package/esm/stdlib/item/node/base.js.map +1 -1
  40. package/esm/stdlib/item/node/diamond.js +1 -1
  41. package/esm/stdlib/item/node/ellipse.js +2 -2
  42. package/esm/stdlib/item/node/hexagon.js +6 -2
  43. package/esm/stdlib/item/node/hexagon.js.map +1 -1
  44. package/esm/stdlib/item/node/image.d.ts +40 -0
  45. package/esm/stdlib/item/node/image.js +110 -0
  46. package/esm/stdlib/item/node/image.js.map +1 -0
  47. package/esm/stdlib/item/node/index.d.ts +1 -0
  48. package/esm/stdlib/item/node/index.js +1 -0
  49. package/esm/stdlib/item/node/index.js.map +1 -1
  50. package/esm/stdlib/plugin/history/combo-command.js +2 -2
  51. package/esm/stdlib/plugin/history/combo-command.js.map +1 -1
  52. package/esm/stdlib/plugin/history/index.d.ts +10 -10
  53. package/esm/stdlib/plugin/history/index.js +14 -14
  54. package/esm/stdlib/plugin/history/index.js.map +1 -1
  55. package/esm/stdlib/plugin/history/item-data-command.js +4 -4
  56. package/esm/stdlib/plugin/history/item-data-command.js.map +1 -1
  57. package/esm/stdlib/plugin/history/layer-updated-command.js +2 -2
  58. package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -1
  59. package/esm/stdlib/plugin/history/state-updated-command.js +1 -1
  60. package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -1
  61. package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
  62. package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
  63. package/esm/stdlib/plugin/index.d.ts +1 -0
  64. package/esm/stdlib/plugin/index.js +1 -0
  65. package/esm/stdlib/plugin/index.js.map +1 -1
  66. package/esm/stdlib/plugin/snapline/index.d.ts +163 -0
  67. package/esm/stdlib/plugin/snapline/index.js +1052 -0
  68. package/esm/stdlib/plugin/snapline/index.js.map +1 -0
  69. package/esm/stdlib/plugin/types.d.ts +1 -0
  70. package/esm/stdlib/theme/dark.js +42 -2
  71. package/esm/stdlib/theme/dark.js.map +1 -1
  72. package/esm/stdlib/theme/light.js +4 -4
  73. package/esm/types/graph.d.ts +14 -14
  74. package/esm/types/hook.d.ts +6 -0
  75. package/esm/types/item.d.ts +6 -0
  76. package/esm/types/item.js.map +1 -1
  77. package/esm/types/spec.d.ts +13 -0
  78. package/esm/util/bbox.d.ts +16 -1
  79. package/esm/util/bbox.js +29 -0
  80. package/esm/util/bbox.js.map +1 -1
  81. package/esm/util/shape.js +2 -2
  82. package/esm/util/shape.js.map +1 -1
  83. package/lib/constant/shape.d.ts +2 -0
  84. package/lib/index.d.ts +4 -1
  85. package/lib/index.js +1 -1
  86. package/lib/item/edge.d.ts +1 -0
  87. package/lib/item/edge.js +3 -1
  88. package/lib/item/edge.js.map +1 -1
  89. package/lib/item/item.d.ts +3 -2
  90. package/lib/item/item.js +12 -6
  91. package/lib/item/item.js.map +1 -1
  92. package/lib/item/node.d.ts +1 -0
  93. package/lib/item/node.js +11 -4
  94. package/lib/item/node.js.map +1 -1
  95. package/lib/runtime/controller/item.js +251 -147
  96. package/lib/runtime/controller/item.js.map +1 -1
  97. package/lib/runtime/graph.d.ts +16 -14
  98. package/lib/runtime/graph.js +66 -28
  99. package/lib/runtime/graph.js.map +1 -1
  100. package/lib/stdlib/behavior/activate-relations.js +2 -2
  101. package/lib/stdlib/behavior/activate-relations.js.map +1 -1
  102. package/lib/stdlib/behavior/click-select.js +1 -1
  103. package/lib/stdlib/behavior/click-select.js.map +1 -1
  104. package/lib/stdlib/behavior/drag-canvas.js +50 -27
  105. package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
  106. package/lib/stdlib/behavior/drag-combo.js +8 -8
  107. package/lib/stdlib/behavior/drag-combo.js.map +1 -1
  108. package/lib/stdlib/behavior/drag-node.js +10 -10
  109. package/lib/stdlib/behavior/drag-node.js.map +1 -1
  110. package/lib/stdlib/behavior/zoom-canvas.js +47 -24
  111. package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
  112. package/lib/stdlib/index.d.ts +3 -0
  113. package/lib/stdlib/index.js +12 -9
  114. package/lib/stdlib/index.js.map +1 -1
  115. package/lib/stdlib/item/edge/base.d.ts +1 -1
  116. package/lib/stdlib/item/edge/base.js +13 -4
  117. package/lib/stdlib/item/edge/base.js.map +1 -1
  118. package/lib/stdlib/item/node/base.d.ts +1 -1
  119. package/lib/stdlib/item/node/base.js +18 -26
  120. package/lib/stdlib/item/node/base.js.map +1 -1
  121. package/lib/stdlib/item/node/diamond.js +1 -1
  122. package/lib/stdlib/item/node/ellipse.js +2 -2
  123. package/lib/stdlib/item/node/hexagon.js +6 -2
  124. package/lib/stdlib/item/node/hexagon.js.map +1 -1
  125. package/lib/stdlib/item/node/image.d.ts +40 -0
  126. package/lib/stdlib/item/node/image.js +114 -0
  127. package/lib/stdlib/item/node/image.js.map +1 -0
  128. package/lib/stdlib/item/node/index.d.ts +1 -0
  129. package/lib/stdlib/item/node/index.js +1 -0
  130. package/lib/stdlib/item/node/index.js.map +1 -1
  131. package/lib/stdlib/plugin/history/combo-command.js +2 -2
  132. package/lib/stdlib/plugin/history/combo-command.js.map +1 -1
  133. package/lib/stdlib/plugin/history/index.d.ts +10 -10
  134. package/lib/stdlib/plugin/history/index.js +14 -14
  135. package/lib/stdlib/plugin/history/index.js.map +1 -1
  136. package/lib/stdlib/plugin/history/item-data-command.js +4 -4
  137. package/lib/stdlib/plugin/history/item-data-command.js.map +1 -1
  138. package/lib/stdlib/plugin/history/layer-updated-command.js +2 -2
  139. package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -1
  140. package/lib/stdlib/plugin/history/state-updated-command.js +1 -1
  141. package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -1
  142. package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
  143. package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
  144. package/lib/stdlib/plugin/index.d.ts +1 -0
  145. package/lib/stdlib/plugin/index.js +1 -0
  146. package/lib/stdlib/plugin/index.js.map +1 -1
  147. package/lib/stdlib/plugin/snapline/index.d.ts +163 -0
  148. package/lib/stdlib/plugin/snapline/index.js +1056 -0
  149. package/lib/stdlib/plugin/snapline/index.js.map +1 -0
  150. package/lib/stdlib/plugin/types.d.ts +1 -0
  151. package/lib/stdlib/theme/dark.js +42 -2
  152. package/lib/stdlib/theme/dark.js.map +1 -1
  153. package/lib/stdlib/theme/light.js +4 -4
  154. package/lib/types/graph.d.ts +14 -14
  155. package/lib/types/hook.d.ts +6 -0
  156. package/lib/types/item.d.ts +6 -0
  157. package/lib/types/item.js.map +1 -1
  158. package/lib/types/spec.d.ts +13 -0
  159. package/lib/util/bbox.d.ts +16 -1
  160. package/lib/util/bbox.js +32 -1
  161. package/lib/util/bbox.js.map +1 -1
  162. package/lib/util/shape.js +2 -2
  163. package/lib/util/shape.js.map +1 -1
  164. package/package.json +2 -2
  165. package/src/index.ts +1 -1
  166. package/src/item/edge.ts +4 -1
  167. package/src/item/item.ts +11 -6
  168. package/src/item/node.ts +18 -10
  169. package/src/runtime/controller/item.ts +212 -66
  170. package/src/runtime/graph.ts +91 -29
  171. package/src/stdlib/behavior/activate-relations.ts +2 -2
  172. package/src/stdlib/behavior/click-select.ts +1 -1
  173. package/src/stdlib/behavior/drag-canvas.ts +65 -27
  174. package/src/stdlib/behavior/drag-combo.ts +8 -8
  175. package/src/stdlib/behavior/drag-node.ts +10 -10
  176. package/src/stdlib/behavior/zoom-canvas.ts +60 -24
  177. package/src/stdlib/index.ts +12 -7
  178. package/src/stdlib/item/edge/base.ts +13 -5
  179. package/src/stdlib/item/node/base.ts +24 -29
  180. package/src/stdlib/item/node/diamond.ts +1 -1
  181. package/src/stdlib/item/node/ellipse.ts +2 -2
  182. package/src/stdlib/item/node/hexagon.ts +6 -2
  183. package/src/stdlib/item/node/image.ts +190 -0
  184. package/src/stdlib/item/node/index.ts +1 -0
  185. package/src/stdlib/plugin/history/combo-command.ts +2 -2
  186. package/src/stdlib/plugin/history/index.ts +14 -14
  187. package/src/stdlib/plugin/history/item-data-command.ts +4 -4
  188. package/src/stdlib/plugin/history/layer-updated-command.ts +2 -2
  189. package/src/stdlib/plugin/history/state-updated-command.ts +1 -1
  190. package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
  191. package/src/stdlib/plugin/index.ts +1 -0
  192. package/src/stdlib/plugin/snapline/index.ts +1277 -0
  193. package/src/stdlib/plugin/types.ts +1 -0
  194. package/src/stdlib/theme/dark.ts +66 -2
  195. package/src/stdlib/theme/light.ts +4 -4
  196. package/src/types/graph.ts +22 -17
  197. package/src/types/hook.ts +6 -0
  198. package/src/types/item.ts +10 -0
  199. package/src/types/spec.ts +13 -0
  200. package/src/util/bbox.ts +38 -1
  201. package/src/util/shape.ts +2 -2
@@ -200,7 +200,7 @@ export class History extends Base {
200
200
  /**
201
201
  * Pause stacking operations.
202
202
  */
203
- pauseStacking(): void {
203
+ pauseStack(): void {
204
204
  this.withoutStackingCounter++;
205
205
 
206
206
  if (this.withoutStackingCounter === 1) {
@@ -212,7 +212,7 @@ export class History extends Base {
212
212
  /**
213
213
  * Resume stacking operations.
214
214
  */
215
- resumeStacking(): void {
215
+ resumeStack(): void {
216
216
  if (this.withoutStackingCounter > 0) {
217
217
  this.withoutStackingCounter--;
218
218
  }
@@ -260,14 +260,14 @@ export class History extends Base {
260
260
  }
261
261
 
262
262
  /**
263
- * Begin a batch operation.
264
- * Any operations performed between `startBatch` and `stopBatch` are grouped together.
263
+ * Begin a historyBatch operation.
264
+ * Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
265
265
  * treated as a single operation when undoing or redoing.
266
266
  */
267
- public startBatch() {
267
+ public startHistoryBatch() {
268
268
  if (this.isBatching) {
269
269
  throw new Error(
270
- 'Ensure that batch processing is stopped before starting.',
270
+ 'Ensure that historyBatch processing is stopped before starting.',
271
271
  );
272
272
  }
273
273
  this.initBatchCommands();
@@ -275,14 +275,14 @@ export class History extends Base {
275
275
  }
276
276
 
277
277
  /**
278
- * End a batch operation.
279
- * Any operations performed between `startBatch` and `stopBatch` are grouped together.
278
+ * End a historyBatch operation.
279
+ * Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
280
280
  * treated as a single operation when undoing or redoing.
281
281
  */
282
- public stopBatch() {
282
+ public stopHistoryBatch() {
283
283
  if (!this.isBatching) {
284
284
  throw new Error(
285
- 'Ensure that batch processing is started before stopping.',
285
+ 'Ensure that historyBatch processing is started before stopping.',
286
286
  );
287
287
  }
288
288
  this.push(this.batchCommands);
@@ -290,13 +290,13 @@ export class History extends Base {
290
290
  }
291
291
 
292
292
  /**
293
- * Execute the provided function in a batch mode
293
+ * Execute the provided function in a historyBatch mode
294
294
  * @param callback
295
295
  */
296
- public batch(callback) {
297
- this.startBatch();
296
+ public historyBatch(callback) {
297
+ this.startHistoryBatch();
298
298
  callback();
299
- this.stopBatch();
299
+ this.stopHistoryBatch();
300
300
  }
301
301
 
302
302
  public getEvents() {
@@ -26,14 +26,14 @@ export class ItemDataCommand implements Command {
26
26
 
27
27
  private removeChangedData(graph) {
28
28
  const ids = this.changes.map((data) => data.value?.id).filter(Boolean);
29
- graph.executeWithoutStacking(() => {
29
+ graph.executeWithNoStack(() => {
30
30
  graph.removeData(this.type, ids);
31
31
  });
32
32
  }
33
33
 
34
34
  private addChangedData(graph) {
35
35
  const models = this.changes.map((data) => data.value).filter(Boolean);
36
- graph.executeWithoutStacking(() => {
36
+ graph.executeWithNoStack(() => {
37
37
  graph.addData(this.type, models);
38
38
  });
39
39
  }
@@ -61,13 +61,13 @@ export class ItemDataCommand implements Command {
61
61
  });
62
62
  }
63
63
 
64
- graph.pauseStacking();
64
+ graph.pauseStack();
65
65
  if (onlyMove) {
66
66
  graph.updatePosition(this.type, models, this.upsertAncestors);
67
67
  } else {
68
68
  graph.updateData(this.type, models);
69
69
  }
70
- graph.resumeStacking();
70
+ graph.resumeStack();
71
71
  }
72
72
 
73
73
  undo(graph: IGraph) {
@@ -11,7 +11,7 @@ export class LayerUpdatedCommand implements Command {
11
11
  }
12
12
 
13
13
  undo(graph: IGraph) {
14
- graph.executeWithoutStacking(() => {
14
+ graph.executeWithNoStack(() => {
15
15
  this.action === 'front'
16
16
  ? graph.backItem(this.ids)
17
17
  : graph.frontItem(this.ids);
@@ -19,7 +19,7 @@ export class LayerUpdatedCommand implements Command {
19
19
  }
20
20
 
21
21
  redo(graph: IGraph) {
22
- graph.executeWithoutStacking(() => {
22
+ graph.executeWithNoStack(() => {
23
23
  this.action === 'front'
24
24
  ? graph.frontItem(this.ids)
25
25
  : graph.backItem(this.ids);
@@ -20,7 +20,7 @@ export class StateUpdatedCommand implements Command {
20
20
  private updateItemsStates(graph, stateOptions) {
21
21
  stateOptions?.map((option) => {
22
22
  const { ids, states, value } = option;
23
- graph.executeWithoutStacking(() => {
23
+ graph.executeWithNoStack(() => {
24
24
  graph.setItemState(ids, states, value);
25
25
  });
26
26
  });
@@ -20,13 +20,13 @@ export class VisibilityUpdatedCommand implements Command {
20
20
  }
21
21
 
22
22
  private toggleItemsVisible(graph: IGraph, values) {
23
- graph.pauseStacking();
23
+ graph.pauseStack();
24
24
  each(values, (value) =>
25
25
  value.visible
26
26
  ? graph.showItem(value.ids, this.disableAnimate)
27
27
  : graph.hideItem(value.ids, this.disableAnimate),
28
28
  );
29
- graph.resumeStacking();
29
+ graph.resumeStack();
30
30
  }
31
31
 
32
32
  undo(graph: IGraph) {
@@ -7,3 +7,4 @@ export * from './minimap';
7
7
  export * from './toolbar';
8
8
  export * from './tooltip';
9
9
  export * from './timebar';
10
+ export * from './snapline';