@logicflow/core 2.2.0 → 2.2.1

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 (236) hide show
  1. package/dist/index.css +3 -2
  2. package/dist/index.min.js +1 -1
  3. package/dist/index.min.js.map +1 -1
  4. package/es/LogicFlow.d.ts +9 -0
  5. package/es/LogicFlow.js +0 -1
  6. package/es/constant/index.d.ts +1 -1
  7. package/es/constant/index.js +1 -1
  8. package/es/constant/theme.d.ts +136 -0
  9. package/es/constant/theme.js +680 -0
  10. package/es/index.css +3 -2
  11. package/es/model/GraphModel.d.ts +10 -2
  12. package/es/model/GraphModel.js +48 -14
  13. package/es/model/TransformModel.js +9 -9
  14. package/es/model/edge/BaseEdgeModel.js +7 -2
  15. package/es/model/edge/PolylineEdgeModel.d.ts +7 -0
  16. package/es/model/edge/PolylineEdgeModel.js +136 -7
  17. package/es/model/node/BaseNodeModel.d.ts +12 -1
  18. package/es/model/node/BaseNodeModel.js +9 -2
  19. package/es/model/node/HtmlNodeModel.d.ts +12 -0
  20. package/es/model/node/HtmlNodeModel.js +19 -0
  21. package/es/model/node/PolygonNodeModel.js +3 -3
  22. package/es/options.d.ts +4 -2
  23. package/es/style/index.css +3 -2
  24. package/es/style/index.less +3 -2
  25. package/es/style/raw.d.ts +1 -1
  26. package/es/style/raw.js +1 -1
  27. package/es/tool/MultipleSelectTool.js +10 -5
  28. package/es/util/drag.js +0 -1
  29. package/es/util/edge.d.ts +40 -1
  30. package/es/util/edge.js +43 -9
  31. package/es/util/geometry.d.ts +8 -0
  32. package/es/util/geometry.js +79 -0
  33. package/es/util/theme.d.ts +2 -65
  34. package/es/util/theme.js +4 -281
  35. package/es/view/Anchor.d.ts +1 -0
  36. package/es/view/Anchor.js +24 -21
  37. package/es/view/Control.d.ts +5 -0
  38. package/es/view/Control.js +44 -57
  39. package/es/view/edge/BaseEdge.js +9 -0
  40. package/es/view/edge/PolylineEdge.js +13 -2
  41. package/es/view/node/BaseNode.d.ts +1 -0
  42. package/es/view/node/BaseNode.js +23 -11
  43. package/es/view/node/HtmlNode.js +2 -4
  44. package/es/view/overlay/CanvasOverlay.js +5 -2
  45. package/es/view/overlay/Grid.d.ts +12 -1
  46. package/es/view/overlay/Grid.js +85 -23
  47. package/es/view/overlay/OutlineOverlay.d.ts +1 -0
  48. package/es/view/overlay/OutlineOverlay.js +18 -17
  49. package/es/view/overlay/gridConfig.d.ts +46 -0
  50. package/es/view/overlay/gridConfig.js +99 -0
  51. package/es/view/shape/Polygon.d.ts +0 -7
  52. package/es/view/shape/Polygon.js +12 -43
  53. package/lib/LogicFlow.d.ts +9 -0
  54. package/lib/LogicFlow.js +0 -1
  55. package/lib/constant/index.d.ts +1 -1
  56. package/lib/constant/index.js +16 -2
  57. package/lib/constant/theme.d.ts +136 -0
  58. package/lib/constant/theme.js +683 -0
  59. package/lib/index.css +3 -2
  60. package/lib/model/GraphModel.d.ts +10 -2
  61. package/lib/model/GraphModel.js +49 -15
  62. package/lib/model/TransformModel.js +9 -9
  63. package/lib/model/edge/BaseEdgeModel.js +7 -2
  64. package/lib/model/edge/PolylineEdgeModel.d.ts +7 -0
  65. package/lib/model/edge/PolylineEdgeModel.js +136 -7
  66. package/lib/model/node/BaseNodeModel.d.ts +12 -1
  67. package/lib/model/node/BaseNodeModel.js +9 -2
  68. package/lib/model/node/HtmlNodeModel.d.ts +12 -0
  69. package/lib/model/node/HtmlNodeModel.js +19 -0
  70. package/lib/model/node/PolygonNodeModel.js +3 -3
  71. package/lib/options.d.ts +4 -2
  72. package/lib/style/index.css +3 -2
  73. package/lib/style/index.less +3 -2
  74. package/lib/style/raw.d.ts +1 -1
  75. package/lib/style/raw.js +1 -1
  76. package/lib/tool/MultipleSelectTool.js +10 -5
  77. package/lib/util/drag.js +0 -1
  78. package/lib/util/edge.d.ts +40 -1
  79. package/lib/util/edge.js +43 -9
  80. package/lib/util/geometry.d.ts +8 -0
  81. package/lib/util/geometry.js +81 -1
  82. package/lib/util/theme.d.ts +2 -65
  83. package/lib/util/theme.js +15 -292
  84. package/lib/view/Anchor.d.ts +1 -0
  85. package/lib/view/Anchor.js +24 -21
  86. package/lib/view/Control.d.ts +5 -0
  87. package/lib/view/Control.js +44 -57
  88. package/lib/view/edge/BaseEdge.js +9 -0
  89. package/lib/view/edge/PolylineEdge.js +13 -2
  90. package/lib/view/node/BaseNode.d.ts +1 -0
  91. package/lib/view/node/BaseNode.js +22 -10
  92. package/lib/view/node/HtmlNode.js +1 -3
  93. package/lib/view/overlay/CanvasOverlay.js +5 -2
  94. package/lib/view/overlay/Grid.d.ts +12 -1
  95. package/lib/view/overlay/Grid.js +83 -21
  96. package/lib/view/overlay/OutlineOverlay.d.ts +1 -0
  97. package/lib/view/overlay/OutlineOverlay.js +18 -17
  98. package/lib/view/overlay/gridConfig.d.ts +46 -0
  99. package/lib/view/overlay/gridConfig.js +104 -0
  100. package/lib/view/shape/Polygon.d.ts +0 -7
  101. package/lib/view/shape/Polygon.js +13 -45
  102. package/package.json +6 -1
  103. package/.turbo/turbo-build$colon$dev.log +0 -10
  104. package/.turbo/turbo-build.log +0 -33
  105. package/CHANGELOG.md +0 -1849
  106. package/__tests__/algorithm/egde.test.ts +0 -131
  107. package/__tests__/algorithm/index.test.ts +0 -74
  108. package/__tests__/algorithm/outline.test.ts +0 -43
  109. package/__tests__/bugs/1545-spec.test.ts +0 -42
  110. package/__tests__/event/event.test.ts +0 -22
  111. package/__tests__/history/history.test.ts +0 -28
  112. package/__tests__/logicflow.test.ts +0 -575
  113. package/__tests__/model/graphmodel.test.ts +0 -87
  114. package/__tests__/util/compatible.test.ts +0 -48
  115. package/__tests__/util/edge.test.ts +0 -224
  116. package/__tests__/util/geometry.test.ts +0 -14
  117. package/__tests__/util/graph.test.ts +0 -16
  118. package/__tests__/util/matrix.test.ts +0 -41
  119. package/__tests__/util/node.test.ts +0 -68
  120. package/__tests__/util/sampling.test.ts +0 -12
  121. package/__tests__/util/vector.test.ts +0 -50
  122. package/__tests__/util/zIndex.test.ts +0 -10
  123. package/src/LogicFlow.tsx +0 -2008
  124. package/src/algorithm/edge.ts +0 -67
  125. package/src/algorithm/index.ts +0 -70
  126. package/src/algorithm/outline.ts +0 -77
  127. package/src/algorithm/rotate.ts +0 -55
  128. package/src/common/drag.ts +0 -219
  129. package/src/common/history.ts +0 -108
  130. package/src/common/index.ts +0 -6
  131. package/src/common/keyboard.ts +0 -108
  132. package/src/common/matrix.ts +0 -122
  133. package/src/common/vector.ts +0 -93
  134. package/src/constant/index.ts +0 -179
  135. package/src/event/event.md +0 -66
  136. package/src/event/eventArgs.ts +0 -643
  137. package/src/event/eventEmitter.ts +0 -156
  138. package/src/history/index.ts +0 -119
  139. package/src/index.less +0 -1
  140. package/src/index.ts +0 -26
  141. package/src/keyboard/index.ts +0 -112
  142. package/src/keyboard/shortcut.ts +0 -200
  143. package/src/model/BaseModel.ts +0 -250
  144. package/src/model/EditConfigModel.ts +0 -334
  145. package/src/model/GraphModel.ts +0 -1788
  146. package/src/model/NestedTransformModel.ts +0 -121
  147. package/src/model/SnaplineModel.ts +0 -256
  148. package/src/model/TransformModel.ts +0 -258
  149. package/src/model/edge/BaseEdgeModel.ts +0 -777
  150. package/src/model/edge/BezierEdgeModel.ts +0 -197
  151. package/src/model/edge/LineEdgeModel.ts +0 -36
  152. package/src/model/edge/PolylineEdgeModel.ts +0 -672
  153. package/src/model/edge/index.ts +0 -4
  154. package/src/model/index.ts +0 -9
  155. package/src/model/node/BaseNodeModel.ts +0 -949
  156. package/src/model/node/CircleNodeModel.ts +0 -91
  157. package/src/model/node/DiamondNodeModel.ts +0 -132
  158. package/src/model/node/EllipseNodeModel.ts +0 -98
  159. package/src/model/node/HtmlNodeModel.ts +0 -50
  160. package/src/model/node/PolygonNodeModel.ts +0 -150
  161. package/src/model/node/RectNodeModel.ts +0 -69
  162. package/src/model/node/TextNodeModel.ts +0 -54
  163. package/src/model/node/index.ts +0 -8
  164. package/src/options.ts +0 -145
  165. package/src/style/index.less +0 -261
  166. package/src/style/raw.ts +0 -220
  167. package/src/tool/MultipleSelectTool.tsx +0 -132
  168. package/src/tool/TextEditTool.tsx +0 -193
  169. package/src/tool/index.ts +0 -101
  170. package/src/typings.d.ts +0 -5
  171. package/src/util/animation.ts +0 -29
  172. package/src/util/browser.ts +0 -4
  173. package/src/util/compatible.ts +0 -15
  174. package/src/util/drag.ts +0 -220
  175. package/src/util/edge.ts +0 -1060
  176. package/src/util/geometry.ts +0 -55
  177. package/src/util/graph.ts +0 -46
  178. package/src/util/index.ts +0 -17
  179. package/src/util/matrix.ts +0 -129
  180. package/src/util/mobx.ts +0 -23
  181. package/src/util/node.ts +0 -543
  182. package/src/util/raf.ts +0 -28
  183. package/src/util/resize.ts +0 -606
  184. package/src/util/sampling.ts +0 -85
  185. package/src/util/theme.ts +0 -375
  186. package/src/util/uuid.ts +0 -26
  187. package/src/util/vector.ts +0 -93
  188. package/src/util/zIndex.ts +0 -6
  189. package/src/view/Anchor.tsx +0 -445
  190. package/src/view/Control.tsx +0 -512
  191. package/src/view/Graph.tsx +0 -141
  192. package/src/view/Rotate.tsx +0 -113
  193. package/src/view/behavior/dnd.ts +0 -162
  194. package/src/view/behavior/index.ts +0 -2
  195. package/src/view/behavior/snapline.ts +0 -16
  196. package/src/view/edge/AdjustPoint.tsx +0 -425
  197. package/src/view/edge/Arrow.tsx +0 -54
  198. package/src/view/edge/BaseEdge.tsx +0 -650
  199. package/src/view/edge/BezierEdge.tsx +0 -101
  200. package/src/view/edge/LineEdge.tsx +0 -81
  201. package/src/view/edge/PolylineEdge.tsx +0 -299
  202. package/src/view/edge/index.ts +0 -6
  203. package/src/view/index.ts +0 -8
  204. package/src/view/node/BaseNode.tsx +0 -571
  205. package/src/view/node/CircleNode.tsx +0 -21
  206. package/src/view/node/DiamondNode.tsx +0 -24
  207. package/src/view/node/EllipseNode.tsx +0 -22
  208. package/src/view/node/HtmlNode.tsx +0 -95
  209. package/src/view/node/PolygonNode.tsx +0 -28
  210. package/src/view/node/RectNode.tsx +0 -30
  211. package/src/view/node/TextNode.tsx +0 -39
  212. package/src/view/node/index.ts +0 -8
  213. package/src/view/overlay/BackgroundOverlay.tsx +0 -34
  214. package/src/view/overlay/BezierAdjustOverlay.tsx +0 -150
  215. package/src/view/overlay/CanvasOverlay.tsx +0 -288
  216. package/src/view/overlay/Grid.tsx +0 -162
  217. package/src/view/overlay/ModificationOverlay.tsx +0 -31
  218. package/src/view/overlay/OutlineOverlay.tsx +0 -170
  219. package/src/view/overlay/SnaplineOverlay.tsx +0 -44
  220. package/src/view/overlay/ToolOverlay.tsx +0 -65
  221. package/src/view/overlay/getTransformHoc.tsx +0 -50
  222. package/src/view/overlay/index.ts +0 -8
  223. package/src/view/shape/Circle.tsx +0 -41
  224. package/src/view/shape/Ellipse.tsx +0 -42
  225. package/src/view/shape/Line.tsx +0 -39
  226. package/src/view/shape/Path.tsx +0 -22
  227. package/src/view/shape/Polygon.tsx +0 -91
  228. package/src/view/shape/Polyline.tsx +0 -31
  229. package/src/view/shape/Rect.tsx +0 -44
  230. package/src/view/shape/Text.tsx +0 -169
  231. package/src/view/shape/index.ts +0 -8
  232. package/src/view/text/BaseText.tsx +0 -134
  233. package/src/view/text/LineText.tsx +0 -168
  234. package/src/view/text/index.ts +0 -2
  235. package/stats.html +0 -4842
  236. package/tsconfig.json +0 -18
@@ -17,7 +17,8 @@ export declare class GraphModel {
17
17
  width: number;
18
18
  height: number;
19
19
  theme: LogicFlow.Theme;
20
- customStyles: object;
20
+ themeMode: LogicFlow.ThemeMode | string;
21
+ customStyles: LogicFlow.Theme;
21
22
  grid: Grid.GridOptions;
22
23
  readonly eventCenter: EventEmitter;
23
24
  readonly modelMap: Map<string, LogicFlow.GraphElementCtor>;
@@ -30,6 +31,7 @@ export declare class GraphModel {
30
31
  animation?: boolean | LFOptions.AnimationConfig;
31
32
  idGenerator?: (type?: string) => string | undefined;
32
33
  edgeGenerator: LFOptions.Definition['edgeGenerator'];
34
+ customTargetAnchor?: LFOptions.Definition['customTargetAnchor'];
33
35
  nodeModelMap: Map<string, BaseNodeModel>;
34
36
  edgeModelMap: Map<string, BaseEdgeModel>;
35
37
  elementsModelMap: Map<string, BaseNodeModel | BaseEdgeModel>;
@@ -403,7 +405,7 @@ export declare class GraphModel {
403
405
  * 设置主题
404
406
  * todo docs link
405
407
  */
406
- setTheme(style: Partial<LogicFlow.Theme>, themeMode?: 'radius' | 'dark' | 'colorful' | 'default' | string): void;
408
+ setTheme(style: Partial<LogicFlow.Theme>, themeMode?: LogicFlow.ThemeMode | string): void;
407
409
  /**
408
410
  * 设置主题
409
411
  * todo docs link
@@ -418,6 +420,7 @@ export declare class GraphModel {
418
420
  diamond: LogicFlow.CommonTheme;
419
421
  ellipse: LogicFlow.CommonTheme;
420
422
  polygon: LogicFlow.CommonTheme;
423
+ html: LogicFlow.CommonTheme;
421
424
  line: LogicFlow.CommonTheme;
422
425
  polyline: LogicFlow.CommonTheme;
423
426
  bezier: LogicFlow.EdgeBezierTheme;
@@ -432,8 +435,13 @@ export declare class GraphModel {
432
435
  rotateControl: LogicFlow.CommonTheme;
433
436
  resizeControl: LogicFlow.CommonTheme;
434
437
  resizeOutline: LogicFlow.CommonTheme;
438
+ multiSelect?: {
439
+ xPadding?: number | undefined;
440
+ yPadding?: number | undefined;
441
+ } | undefined;
435
442
  edgeAdjust: LogicFlow.CommonTheme;
436
443
  outline: LogicFlow.OutlineTheme;
444
+ edgeOutline: LogicFlow.OutlineTheme;
437
445
  edgeAnimation: LogicFlow.EdgeAnimation;
438
446
  };
439
447
  /**
@@ -69,6 +69,7 @@ var GraphModel = /** @class */ (function () {
69
69
  function GraphModel(options) {
70
70
  var _this = this;
71
71
  var _a, _b;
72
+ this.themeMode = 'default';
72
73
  // 维护所有节点和边类型对应的 model
73
74
  this.modelMap = new Map();
74
75
  // Remind:用于记录当前画布上所有节点和边的 model 的 Map
@@ -102,7 +103,10 @@ var GraphModel = /** @class */ (function () {
102
103
  // 控制是否开启局部渲染
103
104
  this.partial = false;
104
105
  this.waitCleanEffects = [];
105
- var container = options.container, partial = options.partial, _c = options.background, background = _c === void 0 ? {} : _c, grid = options.grid, idGenerator = options.idGenerator, edgeGenerator = options.edgeGenerator, animation = options.animation, customTrajectory = options.customTrajectory;
106
+ var container = options.container, partial = options.partial, _c = options.background, background = _c === void 0 ? {} : _c, grid = options.grid, idGenerator = options.idGenerator, edgeGenerator = options.edgeGenerator, animation = options.animation, customTrajectory = options.customTrajectory, customTargetAnchor = options.customTargetAnchor;
107
+ this.themeMode = options.themeMode || 'default';
108
+ var initialGrid = constant_1.gridModeMap[this.themeMode] || constant_1.gridModeMap['default'];
109
+ var initialBackground = constant_1.backgroundModeMap[this.themeMode] || constant_1.backgroundModeMap['default'];
106
110
  this.rootEl = container;
107
111
  this.partial = !!partial;
108
112
  this.background = background;
@@ -111,11 +115,14 @@ var GraphModel = /** @class */ (function () {
111
115
  // TODO:需要让用户设置成 0 吗?后面可以讨论一下
112
116
  this.gridSize = grid.size || 1; // 默认 gridSize 设置为 1
113
117
  }
114
- this.customStyles = options.style || {};
115
- this.grid = overlay_1.Grid.getGridOptions(grid !== null && grid !== void 0 ? grid : false);
118
+ this.customStyles = (options.style || {});
116
119
  this.theme = (0, util_1.setupTheme)(options.style, options.themeMode);
120
+ this.grid = overlay_1.Grid.getGridOptions((0, lodash_es_1.assign)({}, initialGrid, grid));
117
121
  this.theme.grid = (0, lodash_es_1.cloneDeep)(this.grid);
118
- this.theme.background = (0, lodash_es_1.cloneDeep)(this.background);
122
+ if (background) {
123
+ this.background = (0, lodash_es_1.cloneDeep)((0, lodash_es_1.assign)({}, initialBackground, background));
124
+ this.theme.background = (0, lodash_es_1.cloneDeep)((0, lodash_es_1.assign)({}, initialBackground, background));
125
+ }
119
126
  this.edgeType = options.edgeType || 'polyline';
120
127
  this.animation = (0, util_1.setupAnimation)(animation);
121
128
  this.overlapMode = options.overlapMode || constant_1.OverlapMode.DEFAULT;
@@ -130,6 +137,10 @@ var GraphModel = /** @class */ (function () {
130
137
  for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
131
138
  var entry = entries_1_1.value;
132
139
  if (entry.target === _this.rootEl) {
140
+ // 检查元素是否仍在DOM中
141
+ var isElementInDOM = document.body.contains(_this.rootEl);
142
+ if (!isElementInDOM)
143
+ return;
133
144
  _this.resize();
134
145
  _this.eventCenter.emit('graph:resize', {
135
146
  target: _this.rootEl,
@@ -157,6 +168,7 @@ var GraphModel = /** @class */ (function () {
157
168
  this.idGenerator = idGenerator;
158
169
  this.edgeGenerator = (0, util_1.createEdgeGenerator)(this, edgeGenerator);
159
170
  this.customTrajectory = customTrajectory;
171
+ this.customTargetAnchor = customTargetAnchor;
160
172
  }
161
173
  Object.defineProperty(GraphModel.prototype, "nodesMap", {
162
174
  get: function () {
@@ -497,7 +509,7 @@ var GraphModel = /** @class */ (function () {
497
509
  edgeDragging = true;
498
510
  break;
499
511
  }
500
- else {
512
+ if (!edgeMode.virtual) {
501
513
  edges.push(edgeMode.getHistoryData());
502
514
  }
503
515
  }
@@ -1337,11 +1349,12 @@ var GraphModel = /** @class */ (function () {
1337
1349
  GraphModel.prototype.setTheme = function (style, themeMode) {
1338
1350
  var _a;
1339
1351
  if (themeMode) {
1352
+ this.themeMode = themeMode;
1340
1353
  // 修改背景颜色
1341
- util_1.backgroundModeMap[themeMode] &&
1342
- this.updateBackgroundOptions(__assign(__assign({}, (typeof this.background === 'object' ? this.background : {})), util_1.backgroundModeMap[themeMode]));
1343
- util_1.gridModeMap[themeMode] &&
1344
- this.updateGridOptions(overlay_1.Grid.getGridOptions(__assign(__assign({}, this.grid), util_1.gridModeMap[themeMode])));
1354
+ constant_1.backgroundModeMap[themeMode] &&
1355
+ this.updateBackgroundOptions(__assign(__assign({}, (typeof this.background === 'object' ? this.background : {})), constant_1.backgroundModeMap[themeMode]));
1356
+ constant_1.gridModeMap[themeMode] &&
1357
+ this.updateGridOptions(overlay_1.Grid.getGridOptions(__assign(__assign({}, this.grid), constant_1.gridModeMap[themeMode])));
1345
1358
  }
1346
1359
  if (style.background) {
1347
1360
  this.updateBackgroundOptions(style.background);
@@ -1389,12 +1402,30 @@ var GraphModel = /** @class */ (function () {
1389
1402
  * 重新设置画布的宽高
1390
1403
  */
1391
1404
  GraphModel.prototype.resize = function (width, height) {
1392
- this.width = width !== null && width !== void 0 ? width : this.rootEl.getBoundingClientRect().width;
1393
- this.isContainerWidth = (0, lodash_es_1.isNil)(width);
1394
- this.height = height !== null && height !== void 0 ? height : this.rootEl.getBoundingClientRect().height;
1395
- this.isContainerHeight = (0, lodash_es_1.isNil)(height);
1396
- if (!this.width || !this.height) {
1397
- console.warn('渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675');
1405
+ // 检查当前实例是否已被销毁或rootEl不存在
1406
+ if (!this.rootEl)
1407
+ return;
1408
+ // 检查元素是否仍在DOM中
1409
+ var isElementInDOM = document.body.contains(this.rootEl);
1410
+ if (!isElementInDOM)
1411
+ return;
1412
+ // 检查元素是否可见
1413
+ var isVisible = this.rootEl.offsetParent !== null;
1414
+ if (!isVisible)
1415
+ return;
1416
+ try {
1417
+ this.width = width !== null && width !== void 0 ? width : this.rootEl.getBoundingClientRect().width;
1418
+ this.isContainerWidth = (0, lodash_es_1.isNil)(width);
1419
+ this.height = height !== null && height !== void 0 ? height : this.rootEl.getBoundingClientRect().height;
1420
+ this.isContainerHeight = (0, lodash_es_1.isNil)(height);
1421
+ // 只有在元素可见且应该有宽高的情况下才显示警告
1422
+ if (isVisible && (!this.width || !this.height)) {
1423
+ console.warn('渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675');
1424
+ }
1425
+ }
1426
+ catch (error) {
1427
+ // 捕获可能的DOM操作错误
1428
+ console.warn('获取画布宽高时发生错误:', error);
1398
1429
  }
1399
1430
  };
1400
1431
  /**
@@ -1534,6 +1565,9 @@ var GraphModel = /** @class */ (function () {
1534
1565
  __decorate([
1535
1566
  mobx_1.observable
1536
1567
  ], GraphModel.prototype, "theme", void 0);
1568
+ __decorate([
1569
+ mobx_1.observable
1570
+ ], GraphModel.prototype, "themeMode", void 0);
1537
1571
  __decorate([
1538
1572
  mobx_1.observable
1539
1573
  ], GraphModel.prototype, "grid", void 0);
@@ -33,15 +33,15 @@ var translateLimitsMap = {
33
33
  };
34
34
  var TransformModel = /** @class */ (function () {
35
35
  function TransformModel(eventCenter, options) {
36
- this.MINI_SCALE_SIZE = 0.2;
37
- this.MAX_SCALE_SIZE = 16;
38
- this.SCALE_X = 1;
39
- this.SKEW_Y = 0;
40
- this.SKEW_X = 0;
41
- this.SCALE_Y = 1;
42
- this.TRANSLATE_X = 0;
43
- this.TRANSLATE_Y = 0;
44
- this.ZOOM_SIZE = 0.04;
36
+ this.MINI_SCALE_SIZE = 0.2; // 缩小的最小值
37
+ this.MAX_SCALE_SIZE = 16; // 放大的最大值
38
+ this.SCALE_X = 1; // x轴缩放比例
39
+ this.SKEW_Y = 0; // y轴倾斜角度
40
+ this.SKEW_X = 0; // x轴倾斜角度
41
+ this.SCALE_Y = 1; // y轴缩放比例
42
+ this.TRANSLATE_X = 0; // x轴平移距离
43
+ this.TRANSLATE_Y = 0; // y轴平移距离
44
+ this.ZOOM_SIZE = 0.04; // 缩放比例变化量
45
45
  // 限制画布可移动区域
46
46
  this.translateLimitMinX = -Infinity;
47
47
  this.translateLimitMinY = -Infinity;
@@ -195,8 +195,13 @@ var BaseEdgeModel = /** @class */ (function () {
195
195
  */
196
196
  BaseEdgeModel.prototype.getOutlineStyle = function () {
197
197
  var graphModel = this.graphModel;
198
- var outline = graphModel.theme.outline;
199
- return (0, lodash_es_1.cloneDeep)(outline);
198
+ var edgeOutline = graphModel.theme.edgeOutline;
199
+ var attributes = __assign({}, edgeOutline);
200
+ if (this.isHovered) {
201
+ var hoverStyle = edgeOutline.hover || {};
202
+ attributes = __assign(__assign({}, attributes), hoverStyle);
203
+ }
204
+ return (0, lodash_es_1.cloneDeep)(attributes);
200
205
  };
201
206
  /**
202
207
  * 重新自定义文本位置
@@ -12,6 +12,13 @@ export declare class PolylineEdgeModel extends BaseEdgeModel {
12
12
  offset?: number;
13
13
  dbClickPosition?: Point;
14
14
  initEdgeData(data: LogicFlow.EdgeConfig): void;
15
+ setAttributes(): void;
16
+ orthogonalizePath(points: Point[]): Point[];
17
+ /**
18
+ * 计算默认 offset:箭头与折线重叠长度 + 5
19
+ * 重叠长度采用箭头样式中的 offset(沿边方向的长度)
20
+ */
21
+ private getDefaultOffset;
15
22
  getEdgeStyle(): {
16
23
  [x: string]: unknown;
17
24
  fill?: string | undefined;
@@ -72,12 +72,139 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
72
72
  return _this;
73
73
  }
74
74
  PolylineEdgeModel.prototype.initEdgeData = function (data) {
75
- this.offset = (0, lodash_es_1.get)(data, 'properties.offset', 30);
75
+ var providedOffset = (0, lodash_es_1.get)(data, 'properties.offset');
76
+ // 当用户未传入 offset 时,按“箭头与折线重叠长度 + 5”作为默认值
77
+ // 其中“重叠长度”采用箭头样式中的 offset(沿边方向的长度)
78
+ this.offset =
79
+ typeof providedOffset === 'number'
80
+ ? providedOffset
81
+ : this.getDefaultOffset();
76
82
  if (data.pointsList) {
77
- this.pointsList = data.pointsList;
83
+ var corrected = this.orthogonalizePath(data.pointsList);
84
+ data.pointsList = corrected;
85
+ this.pointsList = corrected;
78
86
  }
79
87
  _super.prototype.initEdgeData.call(this, data);
80
88
  };
89
+ PolylineEdgeModel.prototype.setAttributes = function () {
90
+ var newOffset = this.properties.offset;
91
+ if (newOffset && newOffset !== this.offset) {
92
+ this.offset = newOffset;
93
+ this.updatePoints();
94
+ }
95
+ };
96
+ PolylineEdgeModel.prototype.orthogonalizePath = function (points) {
97
+ // 输入非法或不足两点时直接返回副本
98
+ if (!Array.isArray(points) || points.length < 2) {
99
+ return points;
100
+ }
101
+ // pushUnique: 向数组中添加唯一点,避免重复
102
+ var pushUnique = function (arr, p) {
103
+ var last = arr[arr.length - 1];
104
+ if (!last || last.x !== p.x || last.y !== p.y) {
105
+ arr.push({ x: p.x, y: p.y });
106
+ }
107
+ };
108
+ // isAxisAligned: 检查两点是否在同一条轴上
109
+ var isAxisAligned = function (a, b) { return a.x === b.x || a.y === b.y; };
110
+ // manhattanDistance: 计算两点在曼哈顿距离上的距离
111
+ var manhattanDistance = function (a, b) {
112
+ return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
113
+ };
114
+ // 1) 生成严格正交路径,尽量延续前一段方向以减少折点
115
+ var orthogonal = [];
116
+ pushUnique(orthogonal, points[0]);
117
+ // previousDirection: 记录前一段的方向,用于判断当前段的PreferredCorner
118
+ var previousDirection;
119
+ // 遍历所有点对,生成正交路径
120
+ for (var i = 0; i < points.length - 1; i++) {
121
+ var current = orthogonal[orthogonal.length - 1];
122
+ var next = points[i + 1];
123
+ if (!current || !next)
124
+ continue;
125
+ if (isAxisAligned(current, next)) {
126
+ pushUnique(orthogonal, next);
127
+ previousDirection =
128
+ current.x === next.x
129
+ ? constant_1.SegmentDirection.VERTICAL
130
+ : constant_1.SegmentDirection.HORIZONTAL;
131
+ continue;
132
+ }
133
+ var cornerHV = { x: next.x, y: current.y };
134
+ var cornerVH = { x: current.x, y: next.y };
135
+ // 根据前一段的方向,优先选择能延续该方向的拐角点,以减少折点数量;
136
+ // 若前一段为垂直方向,则优先选择垂直-水平拐角(cornerVH);
137
+ // 若前一段为水平方向,则优先选择水平-垂直拐角(cornerHV);
138
+ // 若前一段无方向(初始情况),则比较两个拐角的曼哈顿距离,选更近者。
139
+ var preferredCorner = previousDirection === constant_1.SegmentDirection.VERTICAL
140
+ ? cornerVH
141
+ : previousDirection === constant_1.SegmentDirection.HORIZONTAL
142
+ ? cornerHV
143
+ : manhattanDistance(current, cornerHV) <=
144
+ manhattanDistance(current, cornerVH)
145
+ ? cornerHV
146
+ : cornerVH;
147
+ if (preferredCorner.x !== current.x || preferredCorner.y !== current.y) {
148
+ pushUnique(orthogonal, preferredCorner);
149
+ }
150
+ pushUnique(orthogonal, next);
151
+ var a = orthogonal[orthogonal.length - 2];
152
+ var b = orthogonal[orthogonal.length - 1];
153
+ previousDirection =
154
+ a && b
155
+ ? a.x === b.x
156
+ ? constant_1.SegmentDirection.VERTICAL
157
+ : constant_1.SegmentDirection.HORIZONTAL
158
+ : previousDirection;
159
+ }
160
+ // 2) 去除冗余共线中间点
161
+ var simplified = [];
162
+ for (var i = 0; i < orthogonal.length; i++) {
163
+ var prev = orthogonal[i - 1];
164
+ var curr = orthogonal[i];
165
+ var next = orthogonal[i + 1];
166
+ // 如果当前点与前一个点和后一个点在同一条水平线或垂直线上,则跳过该点,去除冗余的共线中间点
167
+ if (prev &&
168
+ curr &&
169
+ next &&
170
+ ((prev.x === curr.x && curr.x === next.x) || // 水平共线
171
+ (prev.y === curr.y && curr.y === next.y)) // 垂直共线
172
+ ) {
173
+ continue;
174
+ }
175
+ pushUnique(simplified, curr);
176
+ }
177
+ // 3) 保留原始起点与终点位置
178
+ if (simplified.length >= 2) {
179
+ simplified[0] = { x: points[0].x, y: points[0].y };
180
+ simplified[simplified.length - 1] = {
181
+ x: points[points.length - 1].x,
182
+ y: points[points.length - 1].y,
183
+ };
184
+ }
185
+ // 4) 结果校验:任意相邻段都必须为水平/垂直;失败则退化为起止两点
186
+ var isOrthogonal = simplified.length < 2 ||
187
+ simplified.every(function (_, idx, arr) {
188
+ if (idx === 0)
189
+ return true;
190
+ return isAxisAligned(arr[idx - 1], arr[idx]);
191
+ });
192
+ return isOrthogonal
193
+ ? simplified
194
+ : [
195
+ { x: points[0].x, y: points[0].y },
196
+ { x: points[points.length - 1].x, y: points[points.length - 1].y },
197
+ ];
198
+ };
199
+ /**
200
+ * 计算默认 offset:箭头与折线重叠长度 + 5
201
+ * 重叠长度采用箭头样式中的 offset(沿边方向的长度)
202
+ */
203
+ PolylineEdgeModel.prototype.getDefaultOffset = function () {
204
+ var arrowStyle = this.getArrowStyle();
205
+ var arrowOverlap = typeof arrowStyle.offset === 'number' ? arrowStyle.offset : 0;
206
+ return arrowOverlap + 5;
207
+ };
81
208
  PolylineEdgeModel.prototype.getEdgeStyle = function () {
82
209
  var polyline = this.graphModel.theme.polyline;
83
210
  var style = _super.prototype.getEdgeStyle.call(this);
@@ -289,7 +416,7 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
289
416
  return list;
290
417
  };
291
418
  PolylineEdgeModel.prototype.updatePath = function (pointList) {
292
- this.pointsList = pointList;
419
+ this.pointsList = this.orthogonalizePath(pointList);
293
420
  this.points = this.getPath(this.pointsList);
294
421
  };
295
422
  PolylineEdgeModel.prototype.getData = function () {
@@ -324,8 +451,10 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
324
451
  x: this.endPoint.x,
325
452
  y: this.endPoint.y,
326
453
  }, this.sourceNode, this.targetNode, this.offset || 0);
327
- this.pointsList = pointsList;
328
- this.points = pointsList.map(function (point) { return "".concat(point.x, ",").concat(point.y); }).join(' ');
454
+ this.pointsList = this.orthogonalizePath(pointsList);
455
+ this.points = this.pointsList
456
+ .map(function (point) { return "".concat(point.x, ",").concat(point.y); })
457
+ .join(' ');
329
458
  };
330
459
  PolylineEdgeModel.prototype.updateStartPoint = function (anchor) {
331
460
  this.startPoint = Object.assign({}, anchor);
@@ -547,13 +676,13 @@ var PolylineEdgeModel = /** @class */ (function (_super) {
547
676
  // 起终点拖拽调整过程中,进行折线路径更新
548
677
  PolylineEdgeModel.prototype.updateAfterAdjustStartAndEnd = function (_a) {
549
678
  var startPoint = _a.startPoint, endPoint = _a.endPoint, sourceNode = _a.sourceNode, targetNode = _a.targetNode;
550
- this.pointsList = (0, util_1.getPolylinePoints)({
679
+ this.pointsList = this.orthogonalizePath((0, util_1.getPolylinePoints)({
551
680
  x: startPoint.x,
552
681
  y: startPoint.y,
553
682
  }, {
554
683
  x: endPoint.x,
555
684
  y: endPoint.y,
556
- }, sourceNode, targetNode, this.offset || 0);
685
+ }, sourceNode, targetNode, this.offset || 0));
557
686
  this.initPoints();
558
687
  };
559
688
  __decorate([
@@ -185,7 +185,18 @@ export declare class BaseNodeModel<P extends PropertiesType = PropertiesType> im
185
185
  * 获取当前节点缩放控制节点的样式
186
186
  */
187
187
  getResizeControlStyle(): LogicFlow.CommonTheme;
188
- getResizeOutlineStyle(): LogicFlow.CommonTheme;
188
+ getResizeOutlineStyle(): {
189
+ [x: string]: unknown;
190
+ fill?: string | undefined;
191
+ stroke?: string | undefined;
192
+ strokeWidth?: number | undefined;
193
+ radius?: number | undefined;
194
+ rx?: number | undefined;
195
+ ry?: number | undefined;
196
+ width?: number | undefined;
197
+ height?: number | undefined;
198
+ path?: string | undefined;
199
+ };
189
200
  /**
190
201
  * @overridable 支持重写
191
202
  * 获取当前节点锚点样式
@@ -382,7 +382,12 @@ var BaseNodeModel = /** @class */ (function () {
382
382
  };
383
383
  BaseNodeModel.prototype.getResizeOutlineStyle = function () {
384
384
  var resizeOutline = this.graphModel.theme.resizeOutline;
385
- return (0, lodash_es_1.cloneDeep)(resizeOutline);
385
+ var attributes = __assign({}, resizeOutline);
386
+ if (this.isHovered) {
387
+ var hoverStyle = resizeOutline.hover || {};
388
+ attributes = __assign(__assign({}, attributes), hoverStyle);
389
+ }
390
+ return (0, lodash_es_1.cloneDeep)(attributes);
386
391
  };
387
392
  /**
388
393
  * @overridable 支持重写
@@ -552,7 +557,9 @@ var BaseNodeModel = /** @class */ (function () {
552
557
  * 手动连接边到节点时,需要连接的锚点
553
558
  */
554
559
  BaseNodeModel.prototype.getTargetAnchor = function (position) {
555
- return (0, util_1.getClosestAnchor)(position, this);
560
+ var _a;
561
+ var customTargetAnchor = this.graphModel.customTargetAnchor;
562
+ return ((_a = customTargetAnchor === null || customTargetAnchor === void 0 ? void 0 : customTargetAnchor(this, position)) !== null && _a !== void 0 ? _a : (0, util_1.getClosestAnchor)(position, this));
556
563
  };
557
564
  /**
558
565
  * 获取节点BBox
@@ -16,5 +16,17 @@ export declare class HtmlNodeModel<P extends IHtmlNodeProperties = IHtmlNodeProp
16
16
  constructor(data: LogicFlow.NodeConfig<P>, graphModel: GraphModel);
17
17
  setAttributes(): void;
18
18
  getDefaultAnchor(): AnchorConfig[];
19
+ getNodeStyle(): {
20
+ [x: string]: unknown;
21
+ fill?: string | undefined;
22
+ stroke?: string | undefined;
23
+ strokeWidth?: number | undefined;
24
+ radius?: number | undefined;
25
+ rx?: number | undefined;
26
+ ry?: number | undefined;
27
+ width?: number | undefined;
28
+ height?: number | undefined;
29
+ path?: string | undefined;
30
+ };
19
31
  }
20
32
  export default HtmlNodeModel;
@@ -14,11 +14,23 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
17
28
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
30
  };
20
31
  Object.defineProperty(exports, "__esModule", { value: true });
21
32
  exports.HtmlNodeModel = void 0;
33
+ var lodash_es_1 = require("lodash-es");
22
34
  var BaseNodeModel_1 = __importDefault(require("./BaseNodeModel"));
23
35
  var constant_1 = require("../../constant");
24
36
  var HtmlNodeModel = /** @class */ (function (_super) {
@@ -48,6 +60,13 @@ var HtmlNodeModel = /** @class */ (function (_super) {
48
60
  { x: x - width / 2, y: y, id: "".concat(this.id, "_3") },
49
61
  ];
50
62
  };
63
+ HtmlNodeModel.prototype.getNodeStyle = function () {
64
+ var style = _super.prototype.getNodeStyle.call(this);
65
+ var _a = this.graphModel.theme, baseNode = _a.baseNode, html = _a.html;
66
+ var _b = this.properties.style, customStyle = _b === void 0 ? {} : _b;
67
+ var finalStyle = __assign(__assign(__assign(__assign({}, style), (0, lodash_es_1.cloneDeep)(baseNode)), (0, lodash_es_1.cloneDeep)(html)), (0, lodash_es_1.cloneDeep)(customStyle));
68
+ return finalStyle;
69
+ };
51
70
  return HtmlNodeModel;
52
71
  }(BaseNodeModel_1.default));
53
72
  exports.HtmlNodeModel = HtmlNodeModel;
@@ -94,9 +94,9 @@ var PolygonNodeModel = /** @class */ (function (_super) {
94
94
  };
95
95
  PolygonNodeModel.prototype.getNodeStyle = function () {
96
96
  var style = _super.prototype.getNodeStyle.call(this);
97
- var polygon = this.graphModel.theme.polygon;
98
- var _a = this.properties.style, customStyle = _a === void 0 ? {} : _a;
99
- return __assign(__assign(__assign({}, style), (0, lodash_es_1.cloneDeep)(polygon)), (0, lodash_es_1.cloneDeep)(customStyle));
97
+ var _a = this.graphModel, polygon = _a.theme.polygon, customPolygon = _a.customStyles.polygon;
98
+ var _b = this.properties.style, customStyle = _b === void 0 ? {} : _b;
99
+ return __assign(__assign(__assign(__assign({}, style), (0, lodash_es_1.cloneDeep)(polygon)), (0, lodash_es_1.cloneDeep)(customPolygon)), (0, lodash_es_1.cloneDeep)(customStyle));
100
100
  };
101
101
  Object.defineProperty(PolygonNodeModel.prototype, "pointsPosition", {
102
102
  /**
package/lib/options.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { TransformModel } from './model';
1
+ import type { TransformModel, BaseNodeModel, Model } from './model';
2
2
  import { createElement as h } from 'preact/compat';
3
3
  import LogicFlow from './LogicFlow';
4
4
  import { KeyboardDef } from './keyboard';
@@ -21,6 +21,7 @@ export declare namespace Options {
21
21
  edge: boolean;
22
22
  };
23
23
  type EdgeGeneratorType = (sourceNode: LogicFlow.NodeData, targetNode: LogicFlow.NodeData, currentEdge?: Partial<LogicFlow.EdgeConfig>) => any;
24
+ type customTargetAnchorType = (nodeModel: BaseNodeModel, position: LogicFlow.Point) => Model.AnchorInfo | undefined;
24
25
  interface CustomAnchorLineProps {
25
26
  sourcePoint: LogicFlow.Point;
26
27
  targetPoint: LogicFlow.Point;
@@ -67,8 +68,9 @@ export declare namespace Options {
67
68
  disabledTools?: string[];
68
69
  idGenerator?: (type?: string) => string;
69
70
  edgeGenerator?: EdgeGeneratorType;
71
+ customTargetAnchor?: customTargetAnchorType;
70
72
  customTrajectory?: (props: CustomAnchorLineProps) => h.JSX.Element;
71
- themeMode?: 'radius' | 'dark' | 'colorful';
73
+ themeMode?: LogicFlow.ThemeMode;
72
74
  parentTransform?: TransformModel;
73
75
  [key: string]: unknown;
74
76
  }
@@ -177,8 +177,9 @@
177
177
  }
178
178
  .lf-multiple-select {
179
179
  position: absolute;
180
- border: 2px dashed #187dffcc;
181
- box-shadow: 0 0 3px 0 #187dff80;
180
+ border: 2px dashed #4271dfcc;
181
+ border-radius: 12px;
182
+ box-shadow: 0 0 3px 0 #4271df80;
182
183
  cursor: move;
183
184
  }
184
185
  .lf-edge-adjust-point {
@@ -215,8 +215,9 @@
215
215
 
216
216
  .lf-multiple-select {
217
217
  position: absolute;
218
- border: 2px dashed #187dffcc;
219
- box-shadow: 0 0 3px 0 #187dff80;
218
+ border: 2px dashed #4271dfcc;
219
+ border-radius: 12px;
220
+ box-shadow: 0 0 3px 0 #4271df80;
220
221
  cursor: move;
221
222
  }
222
223
 
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Auto generated file, do not modify it!
3
3
  */
4
- export declare const content = ".lf-graph {\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n user-select: none;\n}\n.lf-element-text {\n cursor: text;\n}\n.lf-text-disabled {\n pointer-events: none;\n}\n.lf-text-draggable {\n cursor: move;\n}\n*:focus {\n outline: none;\n}\n.lf-node-anchor {\n cursor: crosshair;\n}\n.lf-node-anchor-hover {\n visibility: hidden;\n}\n.lf-anchor:hover .lf-node-anchor-hover {\n visibility: visible;\n}\n.lf-edge.pointer-none {\n pointer-events: none;\n}\n.lf-edge-append {\n cursor: pointer;\n}\n.lf-edge-animation {\n stroke-dashoffset: 100%;\n animation: lf_animate_dash 5s linear infinite;\n}\n@keyframes lf_animate_dash {\n to {\n stroke-dashoffset: 0;\n }\n}\n/* node */\n.lf-node-not-allow {\n cursor: not-allowed;\n}\n.lf-polyline-append-ns-resize {\n cursor: ns-resize;\n}\n.lf-polyline-append-ew-resize {\n cursor: ew-resize;\n}\n.lf-dragging {\n cursor: move;\n}\n.lf-dragging .lf-element-text {\n cursor: move;\n}\n.lf-draggable {\n cursor: default;\n}\n.lf-bezier-adjust-anchor {\n cursor: pointer;\n}\n/* background */\n.lf-background,\n.lf-grid {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\n.lf-background-area {\n width: 100%;\n height: 100%;\n}\n/* html-overlay */\n.lf-html-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n user-select: none;\n pointer-events: none;\n}\n.lf-html-overlay__transform > * {\n pointer-events: all;\n}\n.lf-text-editable {\n pointer-events: all;\n}\n.lf-text-input {\n position: absolute;\n box-sizing: border-box;\n min-width: 100px;\n min-height: 20px;\n padding: 5px;\n line-height: 1.2;\n white-space: pre;\n text-align: center;\n background: #fff;\n border: 1px solid #edefed;\n border-radius: 3px;\n outline: none;\n transform: translate(-50%, -50%);\n resize: none;\n}\n.lf-get-text-height {\n display: inline-block;\n box-sizing: border-box;\n word-break: break-all;\n /* \u4E3A\u4E86\u8DDF\u8F93\u5165\u6548\u679C\u4FDD\u6301\u4E00\u81F4\uFF0C\u8BBE\u7F6E\u900F\u660E\u8FB9\u6846\u5360\u4F4D */\n border: 1px solid transparent;\n}\n.lf-node-text-auto-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n /* border: 1px solid transparent; */\n}\n.lf-node-text-auto-wrap-content {\n width: 100%;\n line-height: 1.2;\n text-align: center;\n word-break: break-all;\n background: transparent;\n}\n.lf-node-text-ellipsis-content {\n width: 100%;\n line-height: 1.2;\n white-space: nowrap;\n text-align: center;\n background: transparent;\n /* overflow: hidden;\n text-overflow: ellipsis; */\n}\n.lf-node-text-ellipsis-content > div {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n/* tool-overlay */\n.lf-tool-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n overflow: hidden;\n pointer-events: none;\n}\n.lf-tool-overlay > * {\n pointer-events: all;\n}\n/* modification-overlay */\n.modification-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n}\n.modification-overlay > * {\n pointer-events: all;\n}\n.lf-outline,\n.lf-snapline {\n pointer-events: none;\n}\n.lf-keyboard-tips {\n float: right;\n}\n.lf-node-select-decorate {\n position: absolute;\n border: 1px dashed #343435;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.lf-multiple-select {\n position: absolute;\n border: 2px dashed #187dffcc;\n box-shadow: 0 0 3px 0 #187dff80;\n cursor: move;\n}\n.lf-edge-adjust-point {\n cursor: move;\n}\n.lf-rotate-control {\n cursor: grabbing;\n}\n.lf-resize-control-nw {\n cursor: nw-resize;\n}\n.lf-resize-control-n {\n cursor: n-resize;\n}\n.lf-resize-control-ne {\n cursor: ne-resize;\n}\n.lf-resize-control-e {\n cursor: e-resize;\n}\n.lf-resize-control-se {\n cursor: se-resize;\n}\n.lf-resize-control-s {\n cursor: s-resize;\n}\n.lf-resize-control-sw {\n cursor: sw-resize;\n}\n.lf-resize-control-w {\n cursor: w-resize;\n}\n";
4
+ export declare const content = ".lf-graph {\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n user-select: none;\n}\n.lf-element-text {\n cursor: text;\n}\n.lf-text-disabled {\n pointer-events: none;\n}\n.lf-text-draggable {\n cursor: move;\n}\n*:focus {\n outline: none;\n}\n.lf-node-anchor {\n cursor: crosshair;\n}\n.lf-node-anchor-hover {\n visibility: hidden;\n}\n.lf-anchor:hover .lf-node-anchor-hover {\n visibility: visible;\n}\n.lf-edge.pointer-none {\n pointer-events: none;\n}\n.lf-edge-append {\n cursor: pointer;\n}\n.lf-edge-animation {\n stroke-dashoffset: 100%;\n animation: lf_animate_dash 5s linear infinite;\n}\n@keyframes lf_animate_dash {\n to {\n stroke-dashoffset: 0;\n }\n}\n/* node */\n.lf-node-not-allow {\n cursor: not-allowed;\n}\n.lf-polyline-append-ns-resize {\n cursor: ns-resize;\n}\n.lf-polyline-append-ew-resize {\n cursor: ew-resize;\n}\n.lf-dragging {\n cursor: move;\n}\n.lf-dragging .lf-element-text {\n cursor: move;\n}\n.lf-draggable {\n cursor: default;\n}\n.lf-bezier-adjust-anchor {\n cursor: pointer;\n}\n/* background */\n.lf-background,\n.lf-grid {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\n.lf-background-area {\n width: 100%;\n height: 100%;\n}\n/* html-overlay */\n.lf-html-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n user-select: none;\n pointer-events: none;\n}\n.lf-html-overlay__transform > * {\n pointer-events: all;\n}\n.lf-text-editable {\n pointer-events: all;\n}\n.lf-text-input {\n position: absolute;\n box-sizing: border-box;\n min-width: 100px;\n min-height: 20px;\n padding: 5px;\n line-height: 1.2;\n white-space: pre;\n text-align: center;\n background: #fff;\n border: 1px solid #edefed;\n border-radius: 3px;\n outline: none;\n transform: translate(-50%, -50%);\n resize: none;\n}\n.lf-get-text-height {\n display: inline-block;\n box-sizing: border-box;\n word-break: break-all;\n /* \u4E3A\u4E86\u8DDF\u8F93\u5165\u6548\u679C\u4FDD\u6301\u4E00\u81F4\uFF0C\u8BBE\u7F6E\u900F\u660E\u8FB9\u6846\u5360\u4F4D */\n border: 1px solid transparent;\n}\n.lf-node-text-auto-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n /* border: 1px solid transparent; */\n}\n.lf-node-text-auto-wrap-content {\n width: 100%;\n line-height: 1.2;\n text-align: center;\n word-break: break-all;\n background: transparent;\n}\n.lf-node-text-ellipsis-content {\n width: 100%;\n line-height: 1.2;\n white-space: nowrap;\n text-align: center;\n background: transparent;\n /* overflow: hidden;\n text-overflow: ellipsis; */\n}\n.lf-node-text-ellipsis-content > div {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n/* tool-overlay */\n.lf-tool-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n overflow: hidden;\n pointer-events: none;\n}\n.lf-tool-overlay > * {\n pointer-events: all;\n}\n/* modification-overlay */\n.modification-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n}\n.modification-overlay > * {\n pointer-events: all;\n}\n.lf-outline,\n.lf-snapline {\n pointer-events: none;\n}\n.lf-keyboard-tips {\n float: right;\n}\n.lf-node-select-decorate {\n position: absolute;\n border: 1px dashed #343435;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.lf-multiple-select {\n position: absolute;\n border: 2px dashed #4271dfcc;\n border-radius: 12px;\n box-shadow: 0 0 3px 0 #4271df80;\n cursor: move;\n}\n.lf-edge-adjust-point {\n cursor: move;\n}\n.lf-rotate-control {\n cursor: grabbing;\n}\n.lf-resize-control-nw {\n cursor: nw-resize;\n}\n.lf-resize-control-n {\n cursor: n-resize;\n}\n.lf-resize-control-ne {\n cursor: ne-resize;\n}\n.lf-resize-control-e {\n cursor: e-resize;\n}\n.lf-resize-control-se {\n cursor: se-resize;\n}\n.lf-resize-control-s {\n cursor: s-resize;\n}\n.lf-resize-control-sw {\n cursor: sw-resize;\n}\n.lf-resize-control-w {\n cursor: w-resize;\n}\n";
package/lib/style/raw.js CHANGED
@@ -5,4 +5,4 @@ exports.content = void 0;
5
5
  /**
6
6
  * Auto generated file, do not modify it!
7
7
  */
8
- exports.content = ".lf-graph {\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n user-select: none;\n}\n.lf-element-text {\n cursor: text;\n}\n.lf-text-disabled {\n pointer-events: none;\n}\n.lf-text-draggable {\n cursor: move;\n}\n*:focus {\n outline: none;\n}\n.lf-node-anchor {\n cursor: crosshair;\n}\n.lf-node-anchor-hover {\n visibility: hidden;\n}\n.lf-anchor:hover .lf-node-anchor-hover {\n visibility: visible;\n}\n.lf-edge.pointer-none {\n pointer-events: none;\n}\n.lf-edge-append {\n cursor: pointer;\n}\n.lf-edge-animation {\n stroke-dashoffset: 100%;\n animation: lf_animate_dash 5s linear infinite;\n}\n@keyframes lf_animate_dash {\n to {\n stroke-dashoffset: 0;\n }\n}\n/* node */\n.lf-node-not-allow {\n cursor: not-allowed;\n}\n.lf-polyline-append-ns-resize {\n cursor: ns-resize;\n}\n.lf-polyline-append-ew-resize {\n cursor: ew-resize;\n}\n.lf-dragging {\n cursor: move;\n}\n.lf-dragging .lf-element-text {\n cursor: move;\n}\n.lf-draggable {\n cursor: default;\n}\n.lf-bezier-adjust-anchor {\n cursor: pointer;\n}\n/* background */\n.lf-background,\n.lf-grid {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\n.lf-background-area {\n width: 100%;\n height: 100%;\n}\n/* html-overlay */\n.lf-html-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n user-select: none;\n pointer-events: none;\n}\n.lf-html-overlay__transform > * {\n pointer-events: all;\n}\n.lf-text-editable {\n pointer-events: all;\n}\n.lf-text-input {\n position: absolute;\n box-sizing: border-box;\n min-width: 100px;\n min-height: 20px;\n padding: 5px;\n line-height: 1.2;\n white-space: pre;\n text-align: center;\n background: #fff;\n border: 1px solid #edefed;\n border-radius: 3px;\n outline: none;\n transform: translate(-50%, -50%);\n resize: none;\n}\n.lf-get-text-height {\n display: inline-block;\n box-sizing: border-box;\n word-break: break-all;\n /* \u4E3A\u4E86\u8DDF\u8F93\u5165\u6548\u679C\u4FDD\u6301\u4E00\u81F4\uFF0C\u8BBE\u7F6E\u900F\u660E\u8FB9\u6846\u5360\u4F4D */\n border: 1px solid transparent;\n}\n.lf-node-text-auto-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n /* border: 1px solid transparent; */\n}\n.lf-node-text-auto-wrap-content {\n width: 100%;\n line-height: 1.2;\n text-align: center;\n word-break: break-all;\n background: transparent;\n}\n.lf-node-text-ellipsis-content {\n width: 100%;\n line-height: 1.2;\n white-space: nowrap;\n text-align: center;\n background: transparent;\n /* overflow: hidden;\n text-overflow: ellipsis; */\n}\n.lf-node-text-ellipsis-content > div {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n/* tool-overlay */\n.lf-tool-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n overflow: hidden;\n pointer-events: none;\n}\n.lf-tool-overlay > * {\n pointer-events: all;\n}\n/* modification-overlay */\n.modification-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n}\n.modification-overlay > * {\n pointer-events: all;\n}\n.lf-outline,\n.lf-snapline {\n pointer-events: none;\n}\n.lf-keyboard-tips {\n float: right;\n}\n.lf-node-select-decorate {\n position: absolute;\n border: 1px dashed #343435;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.lf-multiple-select {\n position: absolute;\n border: 2px dashed #187dffcc;\n box-shadow: 0 0 3px 0 #187dff80;\n cursor: move;\n}\n.lf-edge-adjust-point {\n cursor: move;\n}\n.lf-rotate-control {\n cursor: grabbing;\n}\n.lf-resize-control-nw {\n cursor: nw-resize;\n}\n.lf-resize-control-n {\n cursor: n-resize;\n}\n.lf-resize-control-ne {\n cursor: ne-resize;\n}\n.lf-resize-control-e {\n cursor: e-resize;\n}\n.lf-resize-control-se {\n cursor: se-resize;\n}\n.lf-resize-control-s {\n cursor: s-resize;\n}\n.lf-resize-control-sw {\n cursor: sw-resize;\n}\n.lf-resize-control-w {\n cursor: w-resize;\n}\n";
8
+ exports.content = ".lf-graph {\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n user-select: none;\n}\n.lf-element-text {\n cursor: text;\n}\n.lf-text-disabled {\n pointer-events: none;\n}\n.lf-text-draggable {\n cursor: move;\n}\n*:focus {\n outline: none;\n}\n.lf-node-anchor {\n cursor: crosshair;\n}\n.lf-node-anchor-hover {\n visibility: hidden;\n}\n.lf-anchor:hover .lf-node-anchor-hover {\n visibility: visible;\n}\n.lf-edge.pointer-none {\n pointer-events: none;\n}\n.lf-edge-append {\n cursor: pointer;\n}\n.lf-edge-animation {\n stroke-dashoffset: 100%;\n animation: lf_animate_dash 5s linear infinite;\n}\n@keyframes lf_animate_dash {\n to {\n stroke-dashoffset: 0;\n }\n}\n/* node */\n.lf-node-not-allow {\n cursor: not-allowed;\n}\n.lf-polyline-append-ns-resize {\n cursor: ns-resize;\n}\n.lf-polyline-append-ew-resize {\n cursor: ew-resize;\n}\n.lf-dragging {\n cursor: move;\n}\n.lf-dragging .lf-element-text {\n cursor: move;\n}\n.lf-draggable {\n cursor: default;\n}\n.lf-bezier-adjust-anchor {\n cursor: pointer;\n}\n/* background */\n.lf-background,\n.lf-grid {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\n.lf-background-area {\n width: 100%;\n height: 100%;\n}\n/* html-overlay */\n.lf-html-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n user-select: none;\n pointer-events: none;\n}\n.lf-html-overlay__transform > * {\n pointer-events: all;\n}\n.lf-text-editable {\n pointer-events: all;\n}\n.lf-text-input {\n position: absolute;\n box-sizing: border-box;\n min-width: 100px;\n min-height: 20px;\n padding: 5px;\n line-height: 1.2;\n white-space: pre;\n text-align: center;\n background: #fff;\n border: 1px solid #edefed;\n border-radius: 3px;\n outline: none;\n transform: translate(-50%, -50%);\n resize: none;\n}\n.lf-get-text-height {\n display: inline-block;\n box-sizing: border-box;\n word-break: break-all;\n /* \u4E3A\u4E86\u8DDF\u8F93\u5165\u6548\u679C\u4FDD\u6301\u4E00\u81F4\uFF0C\u8BBE\u7F6E\u900F\u660E\u8FB9\u6846\u5360\u4F4D */\n border: 1px solid transparent;\n}\n.lf-node-text-auto-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n /* border: 1px solid transparent; */\n}\n.lf-node-text-auto-wrap-content {\n width: 100%;\n line-height: 1.2;\n text-align: center;\n word-break: break-all;\n background: transparent;\n}\n.lf-node-text-ellipsis-content {\n width: 100%;\n line-height: 1.2;\n white-space: nowrap;\n text-align: center;\n background: transparent;\n /* overflow: hidden;\n text-overflow: ellipsis; */\n}\n.lf-node-text-ellipsis-content > div {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n/* tool-overlay */\n.lf-tool-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n overflow: hidden;\n pointer-events: none;\n}\n.lf-tool-overlay > * {\n pointer-events: all;\n}\n/* modification-overlay */\n.modification-overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n pointer-events: none;\n}\n.modification-overlay > * {\n pointer-events: all;\n}\n.lf-outline,\n.lf-snapline {\n pointer-events: none;\n}\n.lf-keyboard-tips {\n float: right;\n}\n.lf-node-select-decorate {\n position: absolute;\n border: 1px dashed #343435;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.lf-multiple-select {\n position: absolute;\n border: 2px dashed #4271dfcc;\n border-radius: 12px;\n box-shadow: 0 0 3px 0 #4271df80;\n cursor: move;\n}\n.lf-edge-adjust-point {\n cursor: move;\n}\n.lf-rotate-control {\n cursor: grabbing;\n}\n.lf-resize-control-nw {\n cursor: nw-resize;\n}\n.lf-resize-control-n {\n cursor: n-resize;\n}\n.lf-resize-control-ne {\n cursor: ne-resize;\n}\n.lf-resize-control-e {\n cursor: e-resize;\n}\n.lf-resize-control-se {\n cursor: se-resize;\n}\n.lf-resize-control-s {\n cursor: s-resize;\n}\n.lf-resize-control-sw {\n cursor: sw-resize;\n}\n.lf-resize-control-w {\n cursor: w-resize;\n}\n";