@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
@@ -49,7 +49,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
49
  }
50
50
  return to.concat(ar || Array.prototype.slice.call(from));
51
51
  };
52
- import { jsx as _jsx } from "preact/jsx-runtime";
52
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
53
53
  import { createRef } from 'preact/compat';
54
54
  import BaseNode from './BaseNode';
55
55
  var HtmlNode = /** @class */ (function (_super) {
@@ -99,13 +99,11 @@ var HtmlNode = /** @class */ (function (_super) {
99
99
  return true;
100
100
  };
101
101
  HtmlNode.prototype.componentDidMount = function () {
102
- // console.log('HtmlNode --->>> componentDidMount - 初始化内容')
103
102
  if (this.shouldUpdate() && this.rootEl) {
104
103
  this.setHtml(this.rootEl);
105
104
  }
106
105
  };
107
106
  HtmlNode.prototype.componentDidUpdate = function () {
108
- // console.log('HtmlNode --->>> componentDidUpdate - 更新节点内容')
109
107
  // DONE: 将 componentDidMount 和 componentDidUpdate 区分开,如果写在一次,渲染 React 组件会重复初始化,消耗过多资源
110
108
  // 为了保证历史兼容性,先将默认 HTML 节点的 setHtml 和 confirmUpdate 保持一直,用户可通过自定义的方式重新定义
111
109
  if (this.shouldUpdate() && this.rootEl) {
@@ -121,7 +119,7 @@ var HtmlNode = /** @class */ (function (_super) {
121
119
  var x = model.x, y = model.y, height = model.height, width = model.width;
122
120
  var style = model.getNodeStyle();
123
121
  this.currentProperties = JSON.stringify(model.properties);
124
- return (_jsx("foreignObject", __assign({}, style, { x: x - width / 2, y: y - height / 2, width: width, height: height, ref: this.ref })));
122
+ return (_jsxs("g", { children: [style.shadow && (_jsx("defs", { children: _jsx("filter", { id: "shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: _jsx("feDropShadow", __assign({}, style.shadow)) }) })), _jsx("rect", __assign({ x: x - width / 2, y: y - height / 2, width: width, height: height, rx: style.radius, ry: style.radius }, style, { filter: "url(#shadow)" })), _jsx("foreignObject", __assign({}, style, { x: x - width / 2, y: y - height / 2, width: width, height: height, ref: this.ref }))] }));
125
123
  };
126
124
  return HtmlNode;
127
125
  }(BaseNode));
@@ -97,6 +97,9 @@ var CanvasOverlay = /** @class */ (function (_super) {
97
97
  if (selectElements.size > 0) {
98
98
  graphModel.clearSelectElements();
99
99
  }
100
+ // 如果是拖拽状态,不触发点击事件
101
+ if (_this.state.isDragging)
102
+ return;
100
103
  graphModel.eventCenter.emit(EventType.BLANK_CLICK, { e: ev });
101
104
  }
102
105
  };
@@ -158,8 +161,6 @@ var CanvasOverlay = /** @class */ (function (_super) {
158
161
  else {
159
162
  eventCenter.emit(EventType.BLANK_MOUSEDOWN, { e: ev });
160
163
  }
161
- // 为了处理画布移动的时候,编辑和菜单仍然存在的问题。
162
- _this.clickHandler(ev);
163
164
  }
164
165
  };
165
166
  _this.pointerMoveHandler = function (ev) {
@@ -217,6 +218,8 @@ var CanvasOverlay = /** @class */ (function (_super) {
217
218
  var editConfigModel = _this.props.graphModel.editConfigModel;
218
219
  // 标记退出捏合,框选等交互可恢复
219
220
  editConfigModel.updateEditConfig({ isPinching: false });
221
+ // 为了处理画布移动的时候,编辑和菜单仍然存在的问题。
222
+ _this.clickHandler(ev);
220
223
  }
221
224
  };
222
225
  var _a = props.graphModel, gridSize = _a.gridSize, eventCenter = _a.eventCenter;
@@ -1,4 +1,5 @@
1
1
  import { Component } from 'preact/compat';
2
+ import { MajorBoldConfig } from './gridConfig';
2
3
  import { GraphModel } from '../../model';
3
4
  type IProps = {
4
5
  graphModel: GraphModel;
@@ -8,6 +9,10 @@ export declare class Grid extends Component<IProps> {
8
9
  readonly id: string;
9
10
  constructor(props: IProps);
10
11
  renderDot(): import("preact/compat").JSX.Element;
12
+ private getDashArrayForSize;
13
+ private getPeriod;
14
+ private getBoldStrokeWidth;
15
+ private renderMeshEdgeLines;
11
16
  renderMesh(): import("preact/compat").JSX.Element;
12
17
  render(): import("preact/compat").JSX.Element;
13
18
  }
@@ -39,8 +44,14 @@ export declare namespace Grid {
39
44
  */
40
45
  thickness?: number;
41
46
  };
47
+ /**
48
+ * 行为配置:支持 boolean 或高级对象
49
+ * - false: 禁用特殊样式,opacity=1,无加粗,无虚线
50
+ * - true: 启用默认样式,opacity=0.75,每第5个加粗/实线,虚线动态计算
51
+ * - object: 高级配置,详见 MajorBoldConfig
52
+ */
53
+ majorBold?: boolean | MajorBoldConfig;
42
54
  };
43
- const defaultProps: GridOptions;
44
55
  function getGridOptions(options: number | boolean | GridOptions): GridOptions;
45
56
  }
46
57
  export {};
@@ -19,12 +19,38 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
19
19
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
20
20
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21
21
  };
22
+ var __read = (this && this.__read) || function (o, n) {
23
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
24
+ if (!m) return o;
25
+ var i = m.call(o), r, ar = [], e;
26
+ try {
27
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
28
+ }
29
+ catch (error) { e = { error: error }; }
30
+ finally {
31
+ try {
32
+ if (r && !r.done && (m = i["return"])) m.call(i);
33
+ }
34
+ finally { if (e) throw e.error; }
35
+ }
36
+ return ar;
37
+ };
38
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
+ if (ar || !(i in from)) {
41
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
+ ar[i] = from[i];
43
+ }
44
+ }
45
+ return to.concat(ar || Array.prototype.slice.call(from));
46
+ };
22
47
  import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
23
48
  import { Component } from 'preact/compat';
24
- import { cloneDeep, assign } from 'lodash-es';
49
+ import { cloneDeep, assign, isNil } from 'lodash-es';
25
50
  import { observer } from '../..';
51
+ import { mergeMajorBoldConfig } from './gridConfig';
26
52
  import { createUuid } from '../../util';
27
- import { DEFAULT_GRID_SIZE } from '../../constant';
53
+ import { defaultGrid } from '../../constant';
28
54
  var Grid = /** @class */ (function (_super) {
29
55
  __extends(Grid, _super);
30
56
  function Grid(props) {
@@ -42,21 +68,64 @@ var Grid = /** @class */ (function (_super) {
42
68
  var opacity = visible ? 1 : 0;
43
69
  return (_jsxs("g", { fill: color, opacity: opacity, children: [_jsx("circle", { cx: 0, cy: 0, r: radius / 2 }), _jsx("circle", { cx: 0, cy: size, r: radius / 2 }), _jsx("circle", { cx: size, cy: 0, r: radius / 2 }), _jsx("circle", { cx: size, cy: size, r: radius / 2 })] }));
44
70
  };
71
+ // 计算与 size 整除的虚线周期,使边长能被 (dash + gap) 完整分割
72
+ Grid.prototype.getDashArrayForSize = function (dashCfg) {
73
+ var _a;
74
+ // 若提供了直接可用的 pattern,则优先使用
75
+ var direct = (_a = dashCfg === null || dashCfg === void 0 ? void 0 : dashCfg.pattern) === null || _a === void 0 ? void 0 : _a.filter(function (n) { return typeof n === 'number' && n > 0; });
76
+ return (direct === null || direct === void 0 ? void 0 : direct.join(',')) || '2,1';
77
+ };
78
+ // 计算一个周期内的最大加粗索引(作为周期大小)
79
+ Grid.prototype.getPeriod = function (advanced) {
80
+ var list = Array.isArray(advanced === null || advanced === void 0 ? void 0 : advanced.boldIndices)
81
+ ? advanced.boldIndices.filter(function (n) { return typeof n === 'number' && n > 0; })
82
+ : [];
83
+ return list.length ? Math.max.apply(Math, __spreadArray([], __read(list), false)) : 0;
84
+ };
85
+ // 计算加粗线宽,优先使用自定义;否则根据周期与厚度估算
86
+ Grid.prototype.getBoldStrokeWidth = function (advanced, size, thickness, period) {
87
+ if (typeof (advanced === null || advanced === void 0 ? void 0 : advanced.customBoldWidth) === 'number')
88
+ return advanced.customBoldWidth;
89
+ var baseThickness = Math.max(1, thickness !== null && thickness !== void 0 ? thickness : 1);
90
+ var p = Math.max(1, period !== null && period !== void 0 ? period : this.getPeriod(advanced));
91
+ return Math.min(baseThickness, (size * p) / 2) / 2;
92
+ };
93
+ // 渲染 mesh 类型四条边的虚线,减少重复代码
94
+ Grid.prototype.renderMeshEdgeLines = function (size, color, strokeWidth, opacity, dash) {
95
+ var segments = [
96
+ { d: "M 0 0 H ".concat(size) },
97
+ { d: "M 0 ".concat(size, " H ").concat(size) },
98
+ { d: "M 0 0 V ".concat(size) },
99
+ { d: "M ".concat(size, " 0 V ").concat(size) },
100
+ ];
101
+ return (_jsx("g", { opacity: opacity, fill: "transparent", children: segments.map(function (seg) { return (_jsx("path", { d: seg.d, stroke: color, strokeWidth: strokeWidth / 2, strokeDasharray: dash, strokeLinecap: "butt", fill: "transparent" })); }) }));
102
+ };
45
103
  // 网格类型为交叉线
46
104
  // todo: 采用背景缩放的方式,实现更好的体验
47
105
  Grid.prototype.renderMesh = function () {
48
- var _a = this.gridOptions, config = _a.config, _b = _a.size, size = _b === void 0 ? 1 : _b, visible = _a.visible;
49
- var _c = config !== null && config !== void 0 ? config : {}, color = _c.color, _d = _c.thickness, thickness = _d === void 0 ? 1 : _d;
106
+ var _a, _b;
107
+ var _c = this.gridOptions, config = _c.config, _d = _c.size, size = _d === void 0 ? 1 : _d, visible = _c.visible, majorBold = _c.majorBold;
108
+ var advanced = mergeMajorBoldConfig(majorBold).config;
109
+ var baseOpacity = advanced.opacity;
110
+ var color = ((_a = config === null || config === void 0 ? void 0 : config.color) !== null && _a !== void 0 ? _a : '#D7DEEB');
111
+ var thickness = ((_b = config === null || config === void 0 ? void 0 : config.thickness) !== null && _b !== void 0 ? _b : 1);
50
112
  // 对于交叉线网格,线的宽度不能大于网格大小的一半
51
113
  var strokeWidth = Math.min(Math.max(1, thickness), size / 2);
52
- var d = "M 0 0 H ".concat(size, " V ").concat(size, " H 0 Z");
53
- var opacity = visible ? 1 : 0;
54
- return (_jsx("path", { d: d, stroke: color, strokeWidth: strokeWidth / 2, opacity: opacity, fill: "transparent" }));
114
+ var opacity = visible ? baseOpacity : 0;
115
+ // 根据 size 自动计算合适的 dash/gap 周期,使 size 能被 (dash + gap) 整除
116
+ var dash = majorBold === false
117
+ ? undefined
118
+ : this.getDashArrayForSize(advanced.dashArrayConfig);
119
+ return this.renderMeshEdgeLines(size, color, strokeWidth, opacity, dash);
55
120
  };
56
121
  Grid.prototype.render = function () {
57
- var _a = this.props.graphModel, transformModel = _a.transformModel, grid = _a.grid;
122
+ var _this = this;
123
+ var _a, _b, _c;
124
+ var _d = this.props.graphModel, transformModel = _d.transformModel, grid = _d.grid;
58
125
  this.gridOptions = grid;
59
- var _b = this.gridOptions, type = _b.type, _c = _b.size, size = _c === void 0 ? 1 : _c;
126
+ var _e = this.gridOptions, type = _e.type, _f = _e.config, config = _f === void 0 ? {} : _f, _g = _e.size, size = _g === void 0 ? 1 : _g, majorBold = _e.majorBold;
127
+ var showMajorBold = majorBold !== false && !isNil(majorBold);
128
+ var advanced = mergeMajorBoldConfig(majorBold).config;
60
129
  var SCALE_X = transformModel.SCALE_X, SKEW_Y = transformModel.SKEW_Y, SKEW_X = transformModel.SKEW_X, SCALE_Y = transformModel.SCALE_Y, TRANSLATE_X = transformModel.TRANSLATE_X, TRANSLATE_Y = transformModel.TRANSLATE_Y;
61
130
  var matrixString = [
62
131
  SCALE_X,
@@ -67,10 +136,12 @@ var Grid = /** @class */ (function (_super) {
67
136
  TRANSLATE_Y,
68
137
  ].join(',');
69
138
  var transform = "matrix(".concat(matrixString, ")");
70
- // const transitionStyle = {
71
- // transition: 'all 0.1s ease',
72
- // };
73
- return (_jsx("div", { className: "lf-grid", children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1.1", width: "100%", height: "100%", children: [_jsx("defs", { children: _jsxs("pattern", { id: this.id, patternUnits: "userSpaceOnUse", patternTransform: transform, x: "0", y: "0", width: size, height: size, children: [type === 'dot' && this.renderDot(), type === 'mesh' && this.renderMesh()] }) }), _jsx("rect", { width: "100%", height: "100%", fill: "url(#".concat(this.id, ")") })] }) }));
139
+ var radius = Math.min(Math.max(2, (_a = config.thickness) !== null && _a !== void 0 ? _a : 1), size / 4);
140
+ var opacity = showMajorBold ? advanced.opacity : 1;
141
+ return (_jsx("div", { className: "lf-grid", children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1.1", width: "100%", height: "100%", children: [_jsxs("defs", { children: [_jsxs("pattern", { id: this.id, patternUnits: "userSpaceOnUse", patternTransform: transform, x: "0", y: "0", width: size, height: size, children: [type === 'dot' && this.renderDot(), type === 'mesh' && this.renderMesh()] }), type === 'dot' && advanced.boldIndices.length ? (_jsx("pattern", { id: "".concat(this.id, "-dot-major"), patternUnits: "userSpaceOnUse", patternTransform: transform, x: "0", y: "0", width: size * this.getPeriod(advanced), height: size * this.getPeriod(advanced), children: _jsxs("g", { fill: (_c = (_b = this.gridOptions.config) === null || _b === void 0 ? void 0 : _b.color) !== null && _c !== void 0 ? _c : '#D7DEEB', opacity: this.gridOptions.visible ? opacity : 0, children: [_jsx("circle", { cx: 0, cy: 0, r: (radius * 1.5) / 2 }), _jsx("circle", { cx: size * this.getPeriod(advanced), cy: 0, r: (radius * 1.5) / 2 }), _jsx("circle", { cx: 0, cy: size * this.getPeriod(advanced), r: (radius * 1.5) / 2 }), _jsx("circle", { cx: size * this.getPeriod(advanced), cy: size * this.getPeriod(advanced), r: (radius * 1.5) / 2 })] }) })) : null, type === 'mesh' && advanced.boldIndices.length ? (_jsx("pattern", { id: "".concat(this.id, "-major"), patternUnits: "userSpaceOnUse", patternTransform: transform, x: "0", y: "0", width: size * this.getPeriod(advanced), height: size * this.getPeriod(advanced), children: advanced.boldIndices.map(function (i) {
142
+ var _a, _b, _c, _d, _e, _f;
143
+ return (_jsxs("g", { children: [_jsx("path", { d: "M ".concat(size * i, " 0 V ").concat(size * _this.getPeriod(advanced)), stroke: (_b = (_a = _this.gridOptions.config) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : '#D7DEEB', strokeWidth: _this.getBoldStrokeWidth(advanced, size, ((_c = _this.gridOptions.config) !== null && _c !== void 0 ? _c : {}).thickness, _this.getPeriod(advanced)), opacity: _this.gridOptions.visible ? opacity : 0, fill: "transparent" }), _jsx("path", { d: "M 0 ".concat(size * i, " H ").concat(size * _this.getPeriod(advanced)), stroke: (_e = (_d = _this.gridOptions.config) === null || _d === void 0 ? void 0 : _d.color) !== null && _e !== void 0 ? _e : '#D7DEEB', strokeWidth: _this.getBoldStrokeWidth(advanced, size, ((_f = _this.gridOptions.config) !== null && _f !== void 0 ? _f : {}).thickness, _this.getPeriod(advanced)), opacity: _this.gridOptions.visible ? opacity : 0, fill: "transparent" })] }));
144
+ }) })) : null] }), _jsx("rect", { width: "100%", height: "100%", fill: "url(#".concat(this.id, ")") }), type === 'dot' && showMajorBold && advanced.boldIndices.length ? (_jsx("rect", { width: "100%", height: "100%", fill: "url(#".concat(this.id, "-dot-major)") })) : null, type === 'mesh' && showMajorBold && advanced.boldIndices.length ? (_jsx("rect", { width: "100%", height: "100%", fill: "url(#".concat(this.id, "-major)") })) : null] }) }));
74
145
  };
75
146
  Grid = __decorate([
76
147
  observer
@@ -79,17 +150,8 @@ var Grid = /** @class */ (function (_super) {
79
150
  }(Component));
80
151
  export { Grid };
81
152
  (function (Grid) {
82
- Grid.defaultProps = {
83
- size: DEFAULT_GRID_SIZE,
84
- visible: true,
85
- type: 'dot',
86
- config: {
87
- color: '#ababab',
88
- thickness: 1,
89
- },
90
- };
91
153
  function getGridOptions(options) {
92
- var defaultOptions = cloneDeep(Grid.defaultProps);
154
+ var defaultOptions = cloneDeep(defaultGrid);
93
155
  if (typeof options === 'number') {
94
156
  return assign(defaultOptions, { size: options });
95
157
  }
@@ -4,6 +4,7 @@ type IProps = {
4
4
  graphModel: GraphModel;
5
5
  };
6
6
  export declare class OutlineOverlay extends Component<IProps> {
7
+ private renderRectOutline;
7
8
  getNodesOutline(): any;
8
9
  getEdgeOutline(): any;
9
10
  getLineOutline(line: LineEdgeModel): import("preact/compat").JSX.Element;
@@ -41,6 +41,12 @@ var OutlineOverlay = /** @class */ (function (_super) {
41
41
  function OutlineOverlay() {
42
42
  return _super !== null && _super.apply(this, arguments) || this;
43
43
  }
44
+ // 通用渲染函数:根据点集合与样式计算包围盒并返回矩形轮廓
45
+ OutlineOverlay.prototype.renderRectOutline = function (pointsList, style, className, defaultOffsets) {
46
+ var _a = (style || {}), _b = _a.widthOffset, widthOffset = _b === void 0 ? defaultOffsets.widthOffset : _b, _c = _a.heightOffset, heightOffset = _c === void 0 ? defaultOffsets.heightOffset : _c;
47
+ var _d = getBBoxOfPoints(pointsList, widthOffset, heightOffset), x = _d.x, y = _d.y, width = _d.width, height = _d.height;
48
+ return (_jsx(Rect, __assign({ className: className, x: x, y: y, width: width, height: height }, style)));
49
+ };
44
50
  // 节点outline
45
51
  OutlineOverlay.prototype.getNodesOutline = function () {
46
52
  var graphModel = this.props.graphModel;
@@ -51,7 +57,7 @@ var OutlineOverlay = /** @class */ (function (_super) {
51
57
  var isHovered = element.isHovered, isSelected = element.isSelected, x = element.x, y = element.y, width = element.width, height = element.height;
52
58
  if ((nodeSelectedOutline && isSelected) ||
53
59
  (hoverOutline && isHovered)) {
54
- var style_1 = element.getOutlineStyle();
60
+ var style_1 = element.getOutlineStyle() || {};
55
61
  var attributes_1 = {};
56
62
  Object.keys(style_1).forEach(function (key) {
57
63
  if (key !== 'hover') {
@@ -62,11 +68,8 @@ var OutlineOverlay = /** @class */ (function (_super) {
62
68
  var hoverStyle = style_1.hover;
63
69
  attributes_1 = __assign(__assign({}, attributes_1), hoverStyle);
64
70
  }
65
- nodeOutline.push(_jsx(Rect, __assign({ transform: element.transform, className: "lf-outline-node", x: x, y: y,
66
- // width: width + 10,
67
- // height: height + 10,
68
- width: width + 10,
69
- height: height + 10 }, attributes_1)));
71
+ nodeOutline.push(_jsx(Rect, __assign({ transform: element.transform, className: "lf-outline-node", x: x, y: y, width: width + 4,
72
+ height: height + 4 }, attributes_1)));
70
73
  }
71
74
  }
72
75
  });
@@ -96,30 +99,28 @@ var OutlineOverlay = /** @class */ (function (_super) {
96
99
  // 直线outline
97
100
  OutlineOverlay.prototype.getLineOutline = function (line) {
98
101
  var startPoint = line.startPoint, endPoint = line.endPoint;
99
- var x = (startPoint.x + endPoint.x) / 2;
100
- var y = (startPoint.y + endPoint.y) / 2;
101
- var width = Math.abs(startPoint.x - endPoint.x) + 10;
102
- var height = Math.abs(startPoint.y - endPoint.y) + 10;
103
102
  var style = line.getOutlineStyle();
104
- return (_jsx(Rect, __assign({ className: "lf-outline-edge", x: x, y: y, width: width, height: height }, style)));
103
+ return this.renderRectOutline([startPoint, endPoint], style, 'lf-outline-edge', { widthOffset: 10, heightOffset: 10 });
105
104
  };
106
105
  // 折线outline
107
106
  OutlineOverlay.prototype.getPolylineOutline = function (polyline) {
108
107
  var points = polyline.points;
109
108
  var pointsList = points2PointsList(points);
110
- var bbox = getBBoxOfPoints(pointsList, 8);
111
- var x = bbox.x, y = bbox.y, width = bbox.width, height = bbox.height;
112
109
  var style = polyline.getOutlineStyle();
113
- return (_jsx(Rect, __assign({ className: "lf-outline", x: x, y: y, width: width, height: height }, style)));
110
+ return this.renderRectOutline(pointsList, style, 'lf-outline', {
111
+ widthOffset: 8,
112
+ heightOffset: 16,
113
+ });
114
114
  };
115
115
  // 曲线outline
116
116
  OutlineOverlay.prototype.getBezierOutline = function (bezier) {
117
117
  var path = bezier.path;
118
118
  var pointsList = getBezierPoints(path);
119
- var bbox = getBBoxOfPoints(pointsList, 8);
120
- var x = bbox.x, y = bbox.y, width = bbox.width, height = bbox.height;
121
119
  var style = bezier.getOutlineStyle();
122
- return (_jsx(Rect, __assign({ className: "lf-outline", x: x, y: y, width: width, height: height }, style)));
120
+ return this.renderRectOutline(pointsList, style, 'lf-outline', {
121
+ widthOffset: 8,
122
+ heightOffset: 16,
123
+ });
123
124
  };
124
125
  OutlineOverlay.prototype.render = function () {
125
126
  return (_jsxs("g", { className: "lf-outline", children: [this.getNodesOutline(), this.getEdgeOutline()] }));
@@ -0,0 +1,46 @@
1
+ /**
2
+ * 网格高级 majorBold 配置。
3
+ *
4
+ * 示例(布尔值):
5
+ * - false:禁用特殊样式,opacity=1,无加粗,无虚线
6
+ * - true:启用默认值,opacity=0.75,每第 5 条线/点加粗/实线,
7
+ * 虚线图案通过 getDashArrayForSize(size) 计算
8
+ *
9
+ * 示例(对象):
10
+ * {
11
+ * opacity: 0.6,
12
+ * boldIndices: [4, 8],
13
+ * dashArrayConfig: { pattern: [4,2,4] },
14
+ * customBoldWidth: 2,
15
+ * }
16
+ */
17
+ export type MajorBoldConfig = {
18
+ /** 默认网格透明度 (0-1) */
19
+ opacity: number;
20
+ /** 一个周期内需要加粗/实线的索引列表 */
21
+ boldIndices: number[];
22
+ /** 虚线样式的计算配置 */
23
+ dashArrayConfig: {
24
+ /** 固定的虚线模式(可选) */
25
+ pattern: number[];
26
+ };
27
+ /** mesh 网格的自定义加粗线宽(可选) */
28
+ customBoldWidth?: number;
29
+ };
30
+ export declare const defaultGridConfig: MajorBoldConfig;
31
+ /**
32
+ * 校验并规范化 GridConfig。
33
+ * - 将 opacity 限制在 [0,1] 范围
34
+ * - boldIndices 过滤为正整数并去重
35
+ */
36
+ export declare function validateGridConfig(cfg: MajorBoldConfig): MajorBoldConfig;
37
+ /**
38
+ * 合并用户行为配置与默认值。
39
+ * - false → 关闭模式:opacity=1,bold=[],关闭虚线
40
+ * - true → 默认模式:采用 defaultGridConfig
41
+ * - object → 自定义模式:校验后使用用户配置
42
+ */
43
+ export declare function mergeMajorBoldConfig(input?: boolean | MajorBoldConfig): {
44
+ mode: 'disabled' | 'default' | 'custom';
45
+ config: MajorBoldConfig;
46
+ };
@@ -0,0 +1,99 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __values = (this && this.__values) || function(o) {
13
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
14
+ if (m) return m.call(o);
15
+ if (o && typeof o.length === "number") return {
16
+ next: function () {
17
+ if (o && i >= o.length) o = void 0;
18
+ return { value: o && o[i++], done: !o };
19
+ }
20
+ };
21
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
22
+ };
23
+ export var defaultGridConfig = {
24
+ opacity: 1,
25
+ boldIndices: [5],
26
+ dashArrayConfig: {
27
+ pattern: [2, 1],
28
+ },
29
+ customBoldWidth: 2,
30
+ };
31
+ /**
32
+ * 校验并规范化 GridConfig。
33
+ * - 将 opacity 限制在 [0,1] 范围
34
+ * - boldIndices 过滤为正整数并去重
35
+ */
36
+ export function validateGridConfig(cfg) {
37
+ var e_1, _a;
38
+ var _b, _c;
39
+ var opacity = Math.max(0, Math.min(1, (_b = cfg.opacity) !== null && _b !== void 0 ? _b : defaultGridConfig.opacity));
40
+ var boldIndicesSet = new Set();
41
+ var boldRaw = Array.isArray(cfg.boldIndices)
42
+ ? cfg.boldIndices
43
+ : defaultGridConfig.boldIndices;
44
+ try {
45
+ for (var boldRaw_1 = __values(boldRaw), boldRaw_1_1 = boldRaw_1.next(); !boldRaw_1_1.done; boldRaw_1_1 = boldRaw_1.next()) {
46
+ var n = boldRaw_1_1.value;
47
+ if (typeof n === 'number' && Number.isFinite(n) && n > 0) {
48
+ boldIndicesSet.add(Math.floor(n));
49
+ }
50
+ }
51
+ }
52
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
53
+ finally {
54
+ try {
55
+ if (boldRaw_1_1 && !boldRaw_1_1.done && (_a = boldRaw_1.return)) _a.call(boldRaw_1);
56
+ }
57
+ finally { if (e_1) throw e_1.error; }
58
+ }
59
+ var boldIndices = Array.from(boldIndicesSet);
60
+ var pattern = Array.isArray((_c = cfg.dashArrayConfig) === null || _c === void 0 ? void 0 : _c.pattern)
61
+ ? cfg.dashArrayConfig.pattern
62
+ : defaultGridConfig.dashArrayConfig.pattern;
63
+ var dashArrayConfig = {
64
+ pattern: pattern,
65
+ };
66
+ var customBoldWidth = cfg.customBoldWidth;
67
+ return {
68
+ opacity: opacity,
69
+ boldIndices: boldIndices.length
70
+ ? boldIndices
71
+ : defaultGridConfig.boldIndices,
72
+ dashArrayConfig: dashArrayConfig,
73
+ customBoldWidth: customBoldWidth,
74
+ };
75
+ }
76
+ /**
77
+ * 合并用户行为配置与默认值。
78
+ * - false → 关闭模式:opacity=1,bold=[],关闭虚线
79
+ * - true → 默认模式:采用 defaultGridConfig
80
+ * - object → 自定义模式:校验后使用用户配置
81
+ */
82
+ export function mergeMajorBoldConfig(input) {
83
+ if (input === false) {
84
+ return {
85
+ mode: 'disabled',
86
+ config: {
87
+ opacity: 1,
88
+ boldIndices: [],
89
+ dashArrayConfig: {
90
+ pattern: [],
91
+ },
92
+ },
93
+ };
94
+ }
95
+ if (input === true || input == null) {
96
+ return { mode: 'default', config: __assign({}, defaultGridConfig) };
97
+ }
98
+ return { mode: 'custom', config: validateGridConfig(input) };
99
+ }
@@ -7,12 +7,5 @@ export type IPolygonProps = {
7
7
  className?: string;
8
8
  radius?: number;
9
9
  };
10
- /**
11
- * 生成带圆角的多边形路径
12
- * @param points 多边形顶点坐标数组
13
- * @param radius 圆角半径
14
- * @returns SVG 路径字符串
15
- */
16
- export declare function createRoundedPolygonPath(points: any, radius: any): string;
17
10
  export declare function Polygon(props: IPolygonProps): h.JSX.Element;
18
11
  export default Polygon;
@@ -27,46 +27,7 @@ var __read = (this && this.__read) || function (o, n) {
27
27
  };
28
28
  import { jsx as _jsx } from "preact/jsx-runtime";
29
29
  import { forEach, toPairs } from 'lodash-es';
30
- /**
31
- * 生成带圆角的多边形路径
32
- * @param points 多边形顶点坐标数组
33
- * @param radius 圆角半径
34
- * @returns SVG 路径字符串
35
- */
36
- export function createRoundedPolygonPath(points, radius) {
37
- var pointList = points.map(function (point) { return ({ x: point[0], y: point[1] }); });
38
- var len = pointList.length;
39
- if (len < 3)
40
- return '';
41
- var r = Math.abs(radius);
42
- var path = '';
43
- for (var i = 0; i < len; i++) {
44
- var prev = pointList[(i - 1 + len) % len];
45
- var curr = pointList[i];
46
- var next = pointList[(i + 1) % len];
47
- // 向量
48
- var v1 = { x: curr.x - prev.x, y: curr.y - prev.y };
49
- var v2 = { x: next.x - curr.x, y: next.y - curr.y };
50
- // 单位向量
51
- var len1 = Math.hypot(v1.x, v1.y);
52
- var len2 = Math.hypot(v2.x, v2.y);
53
- var u1 = { x: v1.x / len1, y: v1.y / len1 };
54
- var u2 = { x: v2.x / len2, y: v2.y / len2 };
55
- // 起点 = curr - u1 * r,终点 = curr + u2 * r
56
- var start = { x: curr.x - u1.x * r, y: curr.y - u1.y * r };
57
- var end = { x: curr.x + u2.x * r, y: curr.y + u2.y * r };
58
- if (i === 0) {
59
- path += "M ".concat(start.x, " ").concat(start.y, " ");
60
- }
61
- else {
62
- path += "L ".concat(start.x, " ").concat(start.y, " ");
63
- }
64
- // Q 控制点是当前拐角点
65
- path += "Q ".concat(curr.x, " ").concat(curr.y, " ").concat(end.x, " ").concat(end.y, " ");
66
- }
67
- path += 'Z';
68
- return path;
69
- }
30
+ import { generateRoundedCorners } from '../../util/geometry';
70
31
  export function Polygon(props) {
71
32
  var _a = props.points, points = _a === void 0 ? [] : _a, className = props.className, radius = props.radius;
72
33
  var attrs = {
@@ -84,14 +45,22 @@ export function Polygon(props) {
84
45
  }
85
46
  });
86
47
  if (className) {
87
- attrs.classNmae = "lf-basic-shape ".concat(className);
48
+ attrs.className = "lf-basic-shape ".concat(className);
88
49
  }
89
50
  else {
90
51
  attrs.className = 'lf-basic-shape';
91
52
  }
92
53
  if (radius) {
93
- var path = createRoundedPolygonPath(points, radius);
94
- attrs.d = path;
54
+ var pointList = points.map(function (point) { return ({ x: point[0], y: point[1] }); });
55
+ var rounded = generateRoundedCorners(pointList, radius, true);
56
+ var d = rounded.length
57
+ ? "M ".concat(rounded[0].x, " ").concat(rounded[0].y, " ").concat(rounded
58
+ .slice(1)
59
+ .map(function (p) { return "L ".concat(p.x, " ").concat(p.y); })
60
+ .join(' '), " Z")
61
+ : '';
62
+ attrs.d = d;
63
+ delete attrs.points;
95
64
  return _jsx("path", __assign({}, attrs));
96
65
  }
97
66
  else {
@@ -899,6 +899,8 @@ export declare namespace LogicFlow {
899
899
  };
900
900
  type OutlineTheme = {
901
901
  hover?: CommonTheme;
902
+ widthOffset?: number;
903
+ heightOffset?: number;
902
904
  } & CommonTheme & EdgeAnimation;
903
905
  type ArrowTheme = {
904
906
  /**
@@ -933,6 +935,7 @@ export declare namespace LogicFlow {
933
935
  diamond: PolygonTheme;
934
936
  ellipse: EllipseTheme;
935
937
  polygon: PolygonTheme;
938
+ html: RectTheme;
936
939
  /**
937
940
  * 基础图形线相关主题
938
941
  */
@@ -956,6 +959,10 @@ export declare namespace LogicFlow {
956
959
  rotateControl: CommonTheme;
957
960
  resizeControl: CommonTheme;
958
961
  resizeOutline: CommonTheme;
962
+ multiSelect?: {
963
+ xPadding?: number;
964
+ yPadding?: number;
965
+ };
959
966
  /**
960
967
  * REMIND: 当开启了跳转边的起点和终点(adjustEdgeStartAndEnd:true)后
961
968
  * 边的两端会出现调整按钮
@@ -963,10 +970,12 @@ export declare namespace LogicFlow {
963
970
  */
964
971
  edgeAdjust: CircleTheme;
965
972
  outline: OutlineTheme;
973
+ edgeOutline: OutlineTheme;
966
974
  edgeAnimation: EdgeAnimation;
967
975
  background?: boolean | Partial<LFOptions.BackgroundConfig>;
968
976
  grid?: boolean | Partial<Grid.GridOptions>;
969
977
  }
978
+ type ThemeMode = 'default' | 'retro' | 'dark' | 'colorful';
970
979
  }
971
980
  export declare namespace LogicFlow {
972
981
  type FocusOnById = {
package/lib/LogicFlow.js CHANGED
@@ -1246,7 +1246,6 @@ var LogicFlow = /** @class */ (function () {
1246
1246
  this.graphModel.destroy();
1247
1247
  this.tool.destroy();
1248
1248
  this.history.destroy();
1249
- (0, util_1.clearThemeMode)();
1250
1249
  for (var extensionName in this.extension) {
1251
1250
  var extensionInstance = this.extension[extensionName];
1252
1251
  if ('destroy' in extensionInstance) {
@@ -1,6 +1,5 @@
1
1
  export declare const DEFAULT_VISIBLE_SPACE = 200;
2
2
  export declare const ELEMENT_MAX_Z_INDEX = 9999;
3
- export declare const DEFAULT_GRID_SIZE = 10;
4
3
  export declare enum ElementState {
5
4
  DEFAULT = 1,// 默认显示
6
5
  TEXT_EDIT = 2,// 此元素正在进行文本编辑
@@ -147,3 +146,4 @@ export declare enum TextMode {
147
146
  TEXT = "text",
148
147
  LABEL = "label"
149
148
  }
149
+ export * from './theme';