@logicflow/core 2.2.1 → 2.2.3
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.
- package/README.md +32 -0
- package/dist/docs/api/logicflow-constructor/index.en.md +106 -0
- package/dist/docs/api/logicflow-constructor/index.zh.md +106 -0
- package/dist/docs/api/logicflow-constructor/use.en.md +61 -0
- package/dist/docs/api/logicflow-constructor/use.zh.md +61 -0
- package/dist/docs/api/logicflow-instance/canvas.en.md +197 -0
- package/dist/docs/api/logicflow-instance/canvas.zh.md +199 -0
- package/dist/docs/api/logicflow-instance/edge.en.md +273 -0
- package/dist/docs/api/logicflow-instance/edge.zh.md +273 -0
- package/dist/docs/api/logicflow-instance/edit-config.en.md +59 -0
- package/dist/docs/api/logicflow-instance/edit-config.zh.md +59 -0
- package/dist/docs/api/logicflow-instance/element.en.md +375 -0
- package/dist/docs/api/logicflow-instance/element.zh.md +379 -0
- package/dist/docs/api/logicflow-instance/event.en.md +326 -0
- package/dist/docs/api/logicflow-instance/event.zh.md +406 -0
- package/dist/docs/api/logicflow-instance/history.en.md +38 -0
- package/dist/docs/api/logicflow-instance/history.zh.md +38 -0
- package/dist/docs/api/logicflow-instance/index.en.md +41 -0
- package/dist/docs/api/logicflow-instance/index.zh.md +41 -0
- package/dist/docs/api/logicflow-instance/node.en.md +308 -0
- package/dist/docs/api/logicflow-instance/node.zh.md +308 -0
- package/dist/docs/api/logicflow-instance/register.en.md +76 -0
- package/dist/docs/api/logicflow-instance/register.zh.md +76 -0
- package/dist/docs/api/logicflow-instance/render-and-data.en.md +179 -0
- package/dist/docs/api/logicflow-instance/render-and-data.zh.md +181 -0
- package/dist/docs/api/logicflow-instance/text.en.md +60 -0
- package/dist/docs/api/logicflow-instance/text.zh.md +60 -0
- package/dist/docs/api/logicflow-instance/theme.en.md +179 -0
- package/dist/docs/api/logicflow-instance/theme.zh.md +179 -0
- package/dist/docs/api/runtime-model/edgeModel.en.md +29 -0
- package/dist/docs/api/runtime-model/edgeModel.zh.md +325 -0
- package/dist/docs/api/runtime-model/graphModel.en.md +275 -0
- package/dist/docs/api/runtime-model/graphModel.zh.md +1153 -0
- package/dist/docs/api/runtime-model/nodeModel.en.md +37 -0
- package/dist/docs/api/runtime-model/nodeModel.zh.md +644 -0
- package/dist/docs/api/type/MainTypes.en.md +598 -0
- package/dist/docs/api/type/MainTypes.zh.md +867 -0
- package/dist/docs/api/type/Theme.en.md +187 -0
- package/dist/docs/api/type/Theme.zh.md +187 -0
- package/dist/docs/api/type/canvas-types.en.md +25 -0
- package/dist/docs/api/type/canvas-types.zh.md +25 -0
- package/dist/docs/api/type/index.en.md +96 -0
- package/dist/docs/api/type/index.zh.md +99 -0
- package/dist/docs/api/type/node-types.en.md +21 -0
- package/dist/docs/api/type/node-types.zh.md +21 -0
- package/dist/docs/api/type/plugin-types.en.md +24 -0
- package/dist/docs/api/type/plugin-types.zh.md +24 -0
- package/dist/docs/index.md +11 -0
- package/dist/docs/tutorial/about.en.md +38 -0
- package/dist/docs/tutorial/about.zh.md +65 -0
- package/dist/docs/tutorial/advanced/dnd.en.md +62 -0
- package/dist/docs/tutorial/advanced/dnd.zh.md +52 -0
- package/dist/docs/tutorial/advanced/edge.en.md +64 -0
- package/dist/docs/tutorial/advanced/edge.zh.md +66 -0
- package/dist/docs/tutorial/advanced/keyboard.en.md +70 -0
- package/dist/docs/tutorial/advanced/keyboard.zh.md +67 -0
- package/dist/docs/tutorial/advanced/node.en.md +338 -0
- package/dist/docs/tutorial/advanced/node.zh.md +338 -0
- package/dist/docs/tutorial/advanced/react.en.md +106 -0
- package/dist/docs/tutorial/advanced/react.zh.md +114 -0
- package/dist/docs/tutorial/advanced/silent-mode.en.md +75 -0
- package/dist/docs/tutorial/advanced/silent-mode.zh.md +71 -0
- package/dist/docs/tutorial/advanced/snapline.en.md +54 -0
- package/dist/docs/tutorial/advanced/vue.en.md +249 -0
- package/dist/docs/tutorial/advanced/vue.zh.md +248 -0
- package/dist/docs/tutorial/ai.en.md +64 -0
- package/dist/docs/tutorial/ai.zh.md +64 -0
- package/dist/docs/tutorial/basic/background.en.md +50 -0
- package/dist/docs/tutorial/basic/canvas.en.md +164 -0
- package/dist/docs/tutorial/basic/canvas.zh.md +183 -0
- package/dist/docs/tutorial/basic/class.en.md +106 -0
- package/dist/docs/tutorial/basic/class.zh.md +103 -0
- package/dist/docs/tutorial/basic/edge.en.md +151 -0
- package/dist/docs/tutorial/basic/edge.zh.md +152 -0
- package/dist/docs/tutorial/basic/event.en.md +70 -0
- package/dist/docs/tutorial/basic/event.zh.md +66 -0
- package/dist/docs/tutorial/basic/grid.en.md +77 -0
- package/dist/docs/tutorial/basic/node.en.md +358 -0
- package/dist/docs/tutorial/basic/node.zh.md +318 -0
- package/dist/docs/tutorial/basic/theme.en.md +154 -0
- package/dist/docs/tutorial/basic/theme.zh.md +157 -0
- package/dist/docs/tutorial/extension/adapter.en.md +446 -0
- package/dist/docs/tutorial/extension/adapter.zh.md +429 -0
- package/dist/docs/tutorial/extension/bpmn-element.en.md +1427 -0
- package/dist/docs/tutorial/extension/bpmn-element.zh.md +1472 -0
- package/dist/docs/tutorial/extension/control.en.md +117 -0
- package/dist/docs/tutorial/extension/control.zh.md +118 -0
- package/dist/docs/tutorial/extension/curved-edge.en.md +46 -0
- package/dist/docs/tutorial/extension/curved-edge.zh.md +46 -0
- package/dist/docs/tutorial/extension/custom.en.md +142 -0
- package/dist/docs/tutorial/extension/custom.zh.md +138 -0
- package/dist/docs/tutorial/extension/dnd-panel.en.md +109 -0
- package/dist/docs/tutorial/extension/dnd-panel.zh.md +109 -0
- package/dist/docs/tutorial/extension/dynamic-group.en.md +606 -0
- package/dist/docs/tutorial/extension/dynamic-group.zh.md +606 -0
- package/dist/docs/tutorial/extension/group.en.md +217 -0
- package/dist/docs/tutorial/extension/group.zh.md +209 -0
- package/dist/docs/tutorial/extension/highlight.en.md +50 -0
- package/dist/docs/tutorial/extension/highlight.zh.md +50 -0
- package/dist/docs/tutorial/extension/insert-node-in-polyline.en.md +52 -0
- package/dist/docs/tutorial/extension/insert-node-in-polyline.zh.md +47 -0
- package/dist/docs/tutorial/extension/intro.en.md +72 -0
- package/dist/docs/tutorial/extension/intro.zh.md +95 -0
- package/dist/docs/tutorial/extension/label.en.md +136 -0
- package/dist/docs/tutorial/extension/label.zh.md +135 -0
- package/dist/docs/tutorial/extension/layout.en.md +156 -0
- package/dist/docs/tutorial/extension/layout.zh.md +156 -0
- package/dist/docs/tutorial/extension/menu.en.md +319 -0
- package/dist/docs/tutorial/extension/menu.zh.md +377 -0
- package/dist/docs/tutorial/extension/minimap.en.md +164 -0
- package/dist/docs/tutorial/extension/minimap.zh.md +180 -0
- package/dist/docs/tutorial/extension/node-resize.en.md +199 -0
- package/dist/docs/tutorial/extension/node-resize.zh.md +221 -0
- package/dist/docs/tutorial/extension/pool.en.md +227 -0
- package/dist/docs/tutorial/extension/pool.zh.md +227 -0
- package/dist/docs/tutorial/extension/proximity-connect.en.md +104 -0
- package/dist/docs/tutorial/extension/proximity-connect.zh.md +107 -0
- package/dist/docs/tutorial/extension/selection.en.md +166 -0
- package/dist/docs/tutorial/extension/selection.zh.md +150 -0
- package/dist/docs/tutorial/extension/snapshot.en.md +276 -0
- package/dist/docs/tutorial/extension/snapshot.zh.md +276 -0
- package/dist/docs/tutorial/get-started.en.md +501 -0
- package/dist/docs/tutorial/get-started.zh.md +139 -0
- package/dist/docs/tutorial/update.en.md +213 -0
- package/dist/docs/tutorial/update.zh.md +212 -0
- package/package.json +5 -3
- package/scripts/postinstall-ai-prompt.js +67 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 指南
|
|
3
|
+
group:
|
|
4
|
+
title: 介绍
|
|
5
|
+
order: 0
|
|
6
|
+
title: 升级到 2.0 版本
|
|
7
|
+
order: 7
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
In the `2.0` version, we optimized multiple modules of project infrastructure, core functions, and plug-ins, and fixed a series of problems. There are several main areas that need to be adjusted:
|
|
11
|
+
1. The CDN import path needs to be changed:
|
|
12
|
+
```html | pure
|
|
13
|
+
<!-- Original import path -->
|
|
14
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/core/dist/logic-flow.js"></script>
|
|
15
|
+
<link href="https://cdn.jsdelivr.net/npm/@logicflow/core/dist/style/index.css" rel="stylesheet">
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/extension/lib/Menu.js"></script>
|
|
17
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@logicflow/extension/lib/style/index.css" />
|
|
18
|
+
|
|
19
|
+
<!-- Current import path -->
|
|
20
|
+
<!-- When importing the old version, you need to add the version number after the package name and use the old path -->
|
|
21
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/core@1.2.27/dist/logic-flow.js"></script>
|
|
22
|
+
<link href="https://cdn.jsdelivr.net/npm/@logicflow/core@1.2.27/dist/style/index.css" rel="stylesheet">
|
|
23
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/extension@1.2.27/lib/Menu.js"></script>
|
|
24
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@logicflow/extension@1.2.27/lib/style/index.css" />
|
|
25
|
+
<!-- If you want to directly import the latest version of 2.0, just copy the following code -->
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/core/dist/index.min.js"></script>
|
|
27
|
+
<link href="https://cdn.jsdelivr.net/npm/@logicflow/core/lib/style/index.min.css" rel="stylesheet">
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/extension/dist/index.min.js"></script>
|
|
29
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@logicflow/extension/lib/style/index.min.css" />
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
2. The style path of the LogicFlow core package needs to be changed when importing it through the package manager:
|
|
33
|
+
```js
|
|
34
|
+
|
|
35
|
+
// 1.x version import method
|
|
36
|
+
import "@logicflow/core/dist/style/index.css";
|
|
37
|
+
// How to import version 2.0
|
|
38
|
+
import "@logicflow/core/lib/style/index.css";
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
1. The options of each plugin passed in by the pluginOptions parameter need to be separated according to the plugin name
|
|
43
|
+
```js
|
|
44
|
+
// Here, we take the configuration item showEdge to set whether the minimap displays the connection as an example
|
|
45
|
+
// 1.x version
|
|
46
|
+
new LogicFlow({
|
|
47
|
+
pluginsOptions: {
|
|
48
|
+
showEdge, // MiniMap can be displayed normally
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
// 2.0 version
|
|
52
|
+
new LogicFlow({
|
|
53
|
+
pluginsOptions: {
|
|
54
|
+
showEdge, // ❌MiniMap cannot be displayed normally
|
|
55
|
+
MiniMap: {
|
|
56
|
+
showEdge,// ✅MiniMap can be displayed normally
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
Other changes theoretically have no impact on usage. Here is a list of changes:
|
|
62
|
+
|
|
63
|
+
### Project infrastructure
|
|
64
|
+
**Optimization**
|
|
65
|
+
1. Supplement the type definitions of all components and methods in the project;
|
|
66
|
+
2. preact -> preact/compat in the core package;
|
|
67
|
+
3. Remove jest dependencies in dependencies, lodash -> lodash-es
|
|
68
|
+
4. Improve README.md and CONTRIBUTING related documents;
|
|
69
|
+
|
|
70
|
+
### Core
|
|
71
|
+
|
|
72
|
+
#### Node
|
|
73
|
+
**New capabilities**
|
|
74
|
+
1. Added `node:resize`, `node:rotate` and `node:properties-change` events
|
|
75
|
+
|
|
76
|
+
**Optimization**
|
|
77
|
+
1. Shape component refactoring, some methods renamed
|
|
78
|
+
1. `formateAnchorConnectValidateData` -> `formatAnchorConnectValidateData`;
|
|
79
|
+
2. `setHoverON` -> `setHoverOn`;
|
|
80
|
+
3. `setHoverOFF` -> `setHoverOff`;
|
|
81
|
+
2. Remove the setting of y: y-1 under rectAttr in TextNode getBackground;
|
|
82
|
+
3. fakerNode renamed to fakeNode;
|
|
83
|
+
|
|
84
|
+
4. Node text style supports configuration through `properties.textStyle`
|
|
85
|
+
|
|
86
|
+
**Bug fix**
|
|
87
|
+
|
|
88
|
+
1. Solve the problem of abnormal polygon shape and border positioning by setting the origin in points and scaling based on the set width and height;
|
|
89
|
+
|
|
90
|
+
#### Edge
|
|
91
|
+
**New capabilities**
|
|
92
|
+
|
|
93
|
+
1. Added adjustEdgeStart and adjustEdgeEnd, which can adjust the start point or end point separately;
|
|
94
|
+
|
|
95
|
+
2. Edge text style supports configuration through `properties.textStyle`;
|
|
96
|
+
|
|
97
|
+
**Bug fix**
|
|
98
|
+
|
|
99
|
+
1. Fix the bug that graphModel.edgeType (default edge type) is not used to initialize the edge when the type in edgeConfig is not passed during initialization
|
|
100
|
+
|
|
101
|
+
#### Grid
|
|
102
|
+
**Optimization**
|
|
103
|
+
|
|
104
|
+
1. The Grid class implements the initialization of grid configuration options by itself
|
|
105
|
+
|
|
106
|
+
2. Modify the maximum radius calculation logic of the point in the dot grid and add relevant comments
|
|
107
|
+
|
|
108
|
+
**Bug fix**
|
|
109
|
+
|
|
110
|
+
1. Correct the problem of offset in the original grid
|
|
111
|
+
|
|
112
|
+
2. Corrected the type declaration of grid configuration options
|
|
113
|
+
|
|
114
|
+
#### Graph
|
|
115
|
+
**Optimization**
|
|
116
|
+
1. Optimized the logic of setting the canvas size during initialization: when adjusting the window, the canvas size can be updated synchronously;
|
|
117
|
+
2. "Breaking Change" adjusted pluginOptions to only pass in the options data corresponding to the plugin (previously all data was passed in)
|
|
118
|
+
|
|
119
|
+
**Bug fixes**
|
|
120
|
+
1. Fixed the problem that the canvas cannot scroll when stopMoveGraph:true is set but stopScrollGraph:true is not set;
|
|
121
|
+
2. Fixed the bug of the getAreaElement method in GraphModel;
|
|
122
|
+
|
|
123
|
+
#### Tool
|
|
124
|
+
**bigfix**
|
|
125
|
+
Fixed the bug that TextEditTool is invalid, and the reason is noted later
|
|
126
|
+
- When the TextEditTool component is updated, the original graphModel and LogicFlow props will not trigger the component update. The component update is triggered by passing in textEditElement
|
|
127
|
+
- Removed the useless console in the code
|
|
128
|
+
- Updated the dependency @babel/plugin-proposal-class-properties -> @babel/plugin-transform-class-properties
|
|
129
|
+
- EventArgs related types are changed from unknown Changed to any
|
|
130
|
+
|
|
131
|
+
### Extension
|
|
132
|
+
|
|
133
|
+
#### Box selection plug-in
|
|
134
|
+
**New capabilities**
|
|
135
|
+
1. Add `selection:selected-area` event to return the box selection range;
|
|
136
|
+
2. The default enabled state of the box selection plug-in is changed to disabled. If you need to enable the box selection during initialization, call the `lf.extension.selectionSelect.open()` method to enable the box selection after the LogicFlow instance is created;
|
|
137
|
+
**Bug fixes**
|
|
138
|
+
1. Fix the problem that the page scrolling event is blocked after the box selection is enabled;
|
|
139
|
+
2. Fix the problem of calculating the box selection margin and outer border width after zooming;
|
|
140
|
+
|
|
141
|
+
#### Minimap plug-in
|
|
142
|
+
**New capabilities**
|
|
143
|
+
1. Support configuration of the minimap display position;
|
|
144
|
+
2. Support the selection of whether to render the connection, support setting during initialization or updating the setting through the `setShowEdge` method;
|
|
145
|
+
3. Optimize the display content of the minimap. Currently, the canvas element and the viewport position will jointly determine the display content;
|
|
146
|
+
4. Optimize the drag interaction experience of the minimap preview;
|
|
147
|
+
5. Added the callback event `miniMap:close` for closing the minimap;
|
|
148
|
+
**Problem fix**
|
|
149
|
+
1. Optimized the update strategy of the minimap when the canvas moves to reduce performance consumption;
|
|
150
|
+
2. Fixed the problem that clicking the minimap preview window triggers unexpected canvas movement;
|
|
151
|
+
3. Fixed the problem that the minimap preview window cannot be dragged;
|
|
152
|
+
|
|
153
|
+
#### NodeResize plug-in
|
|
154
|
+
**Optimization**
|
|
155
|
+
In version 1.x, the node scaling capability needs to be implemented by introducing the NodeResize plug-in. In version 2.0, we built the resize capability into the basic node; and also supported the configurable node rotation capability.
|
|
156
|
+
1. Users can set whether all nodes in the current instance are scalable and rotatable through the global configuration items `allowResize` and `allowRotate`;
|
|
157
|
+
2. You can also add `resizable` and `rotatable` parameters in the `properties` of the initial rendering incoming data to control whether a single node is rotatable and scalable(This will only take effect if `allowResize`/`allowRotate` is set to true globally.). Internally, the node's `resizable` and `rotatable` default to `true`;
|
|
158
|
+
|
|
159
|
+
:::warning{title=Tip}
|
|
160
|
+
After the scaling capability is built-in, the NodeResize plug-in will be gradually abandoned
|
|
161
|
+
:::
|
|
162
|
+
|
|
163
|
+
3. Unify the return values of getResizeOutlineStyle fill and stroke in NodeResize;
|
|
164
|
+
|
|
165
|
+
**Bug fix**
|
|
166
|
+
1. Solve the problem of node repositioning after resize ends;
|
|
167
|
+
2. Fix the bug that the outlineStyle fill of HtmlResize node defaults to black;
|
|
168
|
+
|
|
169
|
+
#### Snapshot plug-in
|
|
170
|
+
**Optimization**
|
|
171
|
+
1. Optimize the export content of the bpmn plug-in;
|
|
172
|
+
2. Support network images in the export node;
|
|
173
|
+
3. Improve the snapshot usage, support custom export file name, file type, image width and height, background color, image quality and other attributes;
|
|
174
|
+
|
|
175
|
+
**Bug fix**
|
|
176
|
+
1. Fixed the problem of missing exported content after turning on local rendering;
|
|
177
|
+
|
|
178
|
+
#### Group plugin
|
|
179
|
+
In version 2.0, we rewrote the logic of the group plugin and upgraded the Group plugin to [Dynamic Group plugin](extension/dynamic-group.en.md)
|
|
180
|
+
**New capabilities**
|
|
181
|
+
1. Support the synchronous scaling and rotation of group nodes, and the internal elements will also scale and rotate synchronously;
|
|
182
|
+
|
|
183
|
+
**Optimization**
|
|
184
|
+
1. Reduce the range of ResizeControl 30 -> 15, because it will cover the small button of Group folding;
|
|
185
|
+
|
|
186
|
+
2. Optimize the logic judgment of allowing text dragging -> nodeTextDraggable && draggable can only allow dragging;
|
|
187
|
+
|
|
188
|
+
#### HighLight plugin
|
|
189
|
+
**New capabilities**
|
|
190
|
+
1. Support highlight neighbor node mode;
|
|
191
|
+
2. Support external parameter configuration of highlight form;
|
|
192
|
+
|
|
193
|
+
**Optimizations**
|
|
194
|
+
1. Supplementary function introduction document [HighLight plugin](extension/highlight.en.md)
|
|
195
|
+
|
|
196
|
+
#### 「New」Label plugin
|
|
197
|
+
**New capabilities**
|
|
198
|
+
In version 2.0, we added a new text display format: Label. The main differences between this format and the existing Text format are:
|
|
199
|
+
1. Supports adding multiple texts to a node/edge, and can set the text direction;
|
|
200
|
+
2. Comes with rich text editing capabilities, supports set local text style;
|
|
201
|
+
3. Use the new position calculation algorithm to optimize the mobile experience of associated text when adjusting nodes and edges;
|
|
202
|
+
Welcome everyone to use it, the function introduction portal: [Label plugin](extension/label.en.md)
|
|
203
|
+
|
|
204
|
+
**Optimization**
|
|
205
|
+
1. Optimize the assignment priority of text editable configuration items: textEdit (global) > nodeTextEdit/edgeTextEdit (category) > element itself editable;
|
|
206
|
+
2. Add the textMode attribute to graphModel to identify the current text mode;
|
|
207
|
+
3. Add the method to update textMode in BaseNodeModel, BaseEdgeModel and graphModel; `updateTextMode`;
|
|
208
|
+
4. Add listenable events to the text module;
|
|
209
|
+
|
|
210
|
+
### Engine
|
|
211
|
+
**Optimization**
|
|
212
|
+
1. Refactor the engine module code and use sandbox.js to solve the performance problem caused by frequent iframe appends
|
|
213
|
+
2. @logicflow/engine uses the browser to execute code by default, and the node side also uses @nyariv/sandboxjs to execute code snippets to keep both ends consistent
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 指南
|
|
3
|
+
group:
|
|
4
|
+
title: 介绍
|
|
5
|
+
order: 0
|
|
6
|
+
title: 升级到 2.0 版本
|
|
7
|
+
order: 7
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
在`2.0`版本中,我们对项目基建、核心功能、插件的多个模块进行了优化,修复了一系列问题,主要有几个需要调整的地方:
|
|
11
|
+
1. CDN引入路径需要变更:
|
|
12
|
+
```html | pure
|
|
13
|
+
<!-- 原引入路径 -->
|
|
14
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/core/dist/logic-flow.js"></script>
|
|
15
|
+
<link href="https://cdn.jsdelivr.net/npm/@logicflow/core/dist/style/index.css" rel="stylesheet">
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/extension/lib/Menu.js"></script>
|
|
17
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@logicflow/extension/lib/style/index.css" />
|
|
18
|
+
|
|
19
|
+
<!-- 现引入路径 -->
|
|
20
|
+
<!-- 旧版本引入时,需要在包名后面加上版本号、路径也需要使用老的 -->
|
|
21
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/core@1.2.27/dist/logic-flow.js"></script>
|
|
22
|
+
<link href="https://cdn.jsdelivr.net/npm/@logicflow/core@1.2.27/dist/style/index.css" rel="stylesheet">
|
|
23
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/extension@1.2.27/lib/Menu.js"></script>
|
|
24
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@logicflow/extension@1.2.27/lib/style/index.css" />
|
|
25
|
+
<!-- 如果想直接引入2.0最新的版本,只需要复制下面这段代码即可 -->
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/core/dist/index.min.js"></script>
|
|
27
|
+
<link href="https://cdn.jsdelivr.net/npm/@logicflow/core/lib/style/index.min.css" rel="stylesheet">
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/npm/@logicflow/extension/dist/index.min.js"></script>
|
|
29
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@logicflow/extension/lib/style/index.min.css" />
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
2. 通过包管理器方式引入LogicFlow core包样式路径需要变更:
|
|
33
|
+
```js
|
|
34
|
+
|
|
35
|
+
// 1.x版本的引入方式
|
|
36
|
+
import "@logicflow/core/dist/style/index.css";
|
|
37
|
+
// 2.0版本的引入方式
|
|
38
|
+
import "@logicflow/core/lib/style/index.css";
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
3. pluginOptions参数传入的各插件的options需要根据插件名分割开
|
|
43
|
+
```js
|
|
44
|
+
// 这里以设置小地图是否显示连线配置项:showEdge为例
|
|
45
|
+
// 1.x版本
|
|
46
|
+
new LogicFlow({
|
|
47
|
+
pluginsOptions: {
|
|
48
|
+
showEdge, // MiniMap能正常显示
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
// 2.0版本
|
|
52
|
+
new LogicFlow({
|
|
53
|
+
pluginsOptions: {
|
|
54
|
+
showEdge, // ❌MiniMap不能正常显示
|
|
55
|
+
MiniMap: {
|
|
56
|
+
showEdge,// ✅MiniMap能正常显示
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
4. Group插件提供的isAllowMoveTo方法和isInRange方法的参数名调整:
|
|
63
|
+
```
|
|
64
|
+
x1 → minX
|
|
65
|
+
y1 → minY
|
|
66
|
+
x2 → maxX
|
|
67
|
+
y2 → maxY
|
|
68
|
+
```
|
|
69
|
+
其他改动理论上对使用没有影响,以下是改动内容一览:
|
|
70
|
+
|
|
71
|
+
### 项目基建
|
|
72
|
+
**优化**
|
|
73
|
+
1. 补充项目中所有组件、方法的类型定义;
|
|
74
|
+
2. core 包中 preact -> preact/compat;
|
|
75
|
+
3. 移除dependences中的 jest 依赖, lodash -> lodash-es
|
|
76
|
+
4. 完善 README.md 以及 CONTRIBUTING 相关文档;
|
|
77
|
+
|
|
78
|
+
### Core
|
|
79
|
+
|
|
80
|
+
#### Node
|
|
81
|
+
**新能力**
|
|
82
|
+
1. 新增`node:resize`、`node:rotate` 和 `node:properties-change`事件
|
|
83
|
+
|
|
84
|
+
**优化**
|
|
85
|
+
1. 形状组件重构,一些方法进行了重命名
|
|
86
|
+
1. `formateAnchorConnectValidateData` -> `formatAnchorConnectValidateData`;
|
|
87
|
+
2. `setHoverON` -> `setHoverOn`;
|
|
88
|
+
3. `setHoverOFF` -> `setHoverOff`;
|
|
89
|
+
2. 移除 TextNode getBackground 中 rectAttr下 y: y-1 的设置;
|
|
90
|
+
3. fakerNode 重命名为 fakeNode;
|
|
91
|
+
4. 节点文本样式支持通过`properties.textStyle`配置
|
|
92
|
+
|
|
93
|
+
**问题修复**
|
|
94
|
+
1. 通过 points 置原点并基于设定的 width 和 height 缩放的方法,解决多边形形状与边框定位异常的问题;
|
|
95
|
+
|
|
96
|
+
#### Edge
|
|
97
|
+
**新能力**
|
|
98
|
+
1. 新增 adjustEdgeStart 和 adjustEdgeEnd,可单独控制调整起始点或结束点;
|
|
99
|
+
2. 边文本支样式持通过`properties.textStyle`配置;
|
|
100
|
+
|
|
101
|
+
**问题修复**
|
|
102
|
+
1. 修复初始化时 edgeConfig 中 type 未传值场景下,未使用 graphModel.edgeType(默认边类型) 初始化边的 bug
|
|
103
|
+
|
|
104
|
+
#### Grid
|
|
105
|
+
**优化**
|
|
106
|
+
1. 由 Grid 类自行实现网格配置选项的初始化
|
|
107
|
+
2. 修改点状网格中点的最大半径计算逻辑,并增加相关注释
|
|
108
|
+
|
|
109
|
+
**问题修复**
|
|
110
|
+
1. 修正原有网格存在偏移的问题
|
|
111
|
+
2. 修正网格配置选项的类型声明
|
|
112
|
+
|
|
113
|
+
#### Graph
|
|
114
|
+
**优化**
|
|
115
|
+
1. 优化初始化时设置画布大小的逻辑:调整视窗时,画布大小可以同步更新;
|
|
116
|
+
2. 「Breaking Change」调整 pluginOptions 只传入插件对应的 options 数据(之前是全量传入)
|
|
117
|
+
|
|
118
|
+
**问题修复**
|
|
119
|
+
1. 修复 设置stopMoveGraph:true但没有设置stopScrollGraph:true,画布无法滚动 的问题;
|
|
120
|
+
2. 修复 GraphModel 中 getAreaElement 方法的 bug;
|
|
121
|
+
|
|
122
|
+
#### Tool
|
|
123
|
+
**bigfix**
|
|
124
|
+
修复 TextEditTool 无效的 bug,后注原因
|
|
125
|
+
- TextEditTool 组件更新时,原先的 graphModel 和 LogicFlow props 不会触发组件的更新,通过将 textEditElement 传入触发组件更新
|
|
126
|
+
- 移除代码中无用的 console
|
|
127
|
+
- 更新依赖 @babel/plugin-proposal-class-properties -> @babel/plugin-transform-class-properties
|
|
128
|
+
- EventArgs 相关类型由 unknown 改为 any
|
|
129
|
+
|
|
130
|
+
### Extension
|
|
131
|
+
|
|
132
|
+
#### 框选插件
|
|
133
|
+
**新能力**
|
|
134
|
+
1. 增加`selection:selected-area`事件,返回框选范围;
|
|
135
|
+
2. 框选插件默认启用状态改为不启用,如需初始化时就启用框选,在LogicFlow实例创建后调用`lf.extension.selectionSelect.open()`方法开启框选;
|
|
136
|
+
**问题修复**
|
|
137
|
+
1. 修复框选启用后,页面滚动事件被阻塞的问题;
|
|
138
|
+
2. 修复缩放后,框选边距与外边框宽度计算问题;
|
|
139
|
+
|
|
140
|
+
#### 小地图插件
|
|
141
|
+
**新能力**
|
|
142
|
+
1. 支持配置小地图展示位置;
|
|
143
|
+
2. 支持选择是否渲染连线,支持初始化时设置或通过`setShowEdge`方法更新设置;
|
|
144
|
+
3. 小地图显示内容优化,目前会有画布元素与视口位置共同决定展示内容;
|
|
145
|
+
4. 优化小地图预览实况的拖拽交互体验;
|
|
146
|
+
5. 增加小地图关闭的回调事件`miniMap:close`;
|
|
147
|
+
**问题修复**
|
|
148
|
+
1. 优化画布移动时,小地图的更新策略,减少性能消耗;
|
|
149
|
+
2. 修复点击小地图预览视窗会触发不可预期的画布移动的问题;
|
|
150
|
+
3. 修复小地图的预览视窗无法拖拽的问题;
|
|
151
|
+
|
|
152
|
+
#### NodeResize插件
|
|
153
|
+
**优化**
|
|
154
|
+
在1.x版本中,节点缩放能力需要通过引入NodeResize插件实现,在2.0版本中,我们将resize能力内置到基础节点上;同时还支持了节点旋转能力可配置。
|
|
155
|
+
1. 用户可以通过全局配置项`allowResize`、`allowRotate`设置当前实例中所有节点是否可缩放、可旋转;
|
|
156
|
+
2. 也可以在初始化渲染传入数据的`properties`中增加`resizable`(需要全局配置`allowResize`为true才会生效)、`rotatable`参数控制单个节点是否可旋转可缩放(需要全局配置`allowRotate`为true才会生效),在内部,节点的`resizable`和`rotatable`默认为`true`;
|
|
157
|
+
|
|
158
|
+
:::warning{title=Tip}
|
|
159
|
+
缩放能力内置后,NodeResize插件会逐步废弃
|
|
160
|
+
:::
|
|
161
|
+
|
|
162
|
+
3. 统一 NodeResize 中 getResizeOutlineStyle fill 和 stroke 的返回值;
|
|
163
|
+
|
|
164
|
+
**问题修复**
|
|
165
|
+
1. 解决resize 结束后节点重新定位的问题;
|
|
166
|
+
2. 修复 HtmlResize 节点 outlineStyle fill 默认为 黑色的 bug;
|
|
167
|
+
|
|
168
|
+
#### Snapshot插件
|
|
169
|
+
**优化**
|
|
170
|
+
1. 优化 bpmn 插件的导出内容;
|
|
171
|
+
2. 支持导出节点中的网络图片;
|
|
172
|
+
3. 完善snapshot使用方式,支持自定义导出的文件名、文件类型、图片宽高、背景颜色、图片质量等属性;
|
|
173
|
+
|
|
174
|
+
**问题修复**
|
|
175
|
+
1. 修复开启局部渲染后导出内容缺失问题;
|
|
176
|
+
|
|
177
|
+
#### Group插件
|
|
178
|
+
在2.0版本里,我们重写了分组插件相关逻辑,将 Group 插件升级为 [Dynamic Group 插件](extension/dynamic-group.zh.md)
|
|
179
|
+
**新能力**
|
|
180
|
+
1. 支持分组节点缩放旋转时,内部元素也随之同步缩放旋转;
|
|
181
|
+
|
|
182
|
+
**优化**
|
|
183
|
+
1. 调小 ResizeControl 的范围 30 -> 15,原因是会盖住 Group 折叠的小按钮;
|
|
184
|
+
2. 优化允许文本拖动的逻辑判断 -> nodeTextDraggable && draggable 才可以允许拖动;
|
|
185
|
+
|
|
186
|
+
#### HighLight插件
|
|
187
|
+
**新能力**
|
|
188
|
+
1. 支持高亮邻居节点模式;
|
|
189
|
+
2. 支持外部传参配置高亮形式;
|
|
190
|
+
|
|
191
|
+
**Optimizations**
|
|
192
|
+
1. 补充功能介绍文档[HighLight 插件](extension/highlight.zh.md)
|
|
193
|
+
|
|
194
|
+
#### 「New」Label插件
|
|
195
|
+
**新能力**
|
|
196
|
+
在2.0版本里,我们新增了一种文本展现形式:Label,这种形式与现有Text形式文本之间的主要区别点在于:
|
|
197
|
+
1. 支持一个节点/一条边 上可以添加多个文本,且可以设置文本朝向;
|
|
198
|
+
2. 自带富文本编辑能力,支持设置局部文本样式;
|
|
199
|
+
3. 使用新的位置计算算法,优化节点和边调整时,关联文本的移动体验;
|
|
200
|
+
欢迎大家使用,功能介绍传送门:[Label 插件](extension/label.zh.md)
|
|
201
|
+
|
|
202
|
+
**优化**
|
|
203
|
+
1. 优化文本可编辑配置项的赋值优先级:textEdit(全局) > nodeTextEdit/edgeTextEdit(分类) > 元素本身 editable;
|
|
204
|
+
2. graphModel 中增加 textMode 属性,用于标识当前使用什么文本模式;
|
|
205
|
+
3. BaseNodeModel、 BaseEdgeModel 以及 graphModel 中增加 更新 textMode 的方法;`updateTextMode`;
|
|
206
|
+
4. 为文本模块增加可监听的事件;
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
### Engine
|
|
210
|
+
**优化**
|
|
211
|
+
1. 重构 engine 模块代码,使用 sandbox.js 解决 iframe 频繁 append 导致的性能问题
|
|
212
|
+
2. @logicflow/engine 默认使用 browser 执行代码,node 端也使用 @nyariv/sandboxjs 执行代码片段,保持两端一致
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "LogicFlow, help you quickly create flowcharts",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"files": [
|
|
41
41
|
"dist",
|
|
42
42
|
"es",
|
|
43
|
-
"lib"
|
|
43
|
+
"lib",
|
|
44
|
+
"scripts"
|
|
44
45
|
],
|
|
45
46
|
"scripts": {
|
|
46
47
|
"clean:turbo": "rss",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"build:watch:cjs": "rss",
|
|
57
58
|
"build": "rss",
|
|
58
59
|
"prebuild": "rss",
|
|
59
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
60
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
61
|
+
"postinstall": "node scripts/postinstall-ai-prompt.js"
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const RESET = '\x1b[0m'
|
|
4
|
+
const REMINDER_STYLE = '\x1b[1m\x1b[43m\x1b[30m' // bold, yellow bg, black fg
|
|
5
|
+
|
|
6
|
+
const AGENT_RULES = `<!-- BEGIN:logicflow-agent-rules -->
|
|
7
|
+
# LogicFlow Agent Rules
|
|
8
|
+
|
|
9
|
+
LogicFlow documentation is available at:
|
|
10
|
+
|
|
11
|
+
- \`node_modules/@logicflow/core/dist/docs/\`
|
|
12
|
+
|
|
13
|
+
Package roles:
|
|
14
|
+
|
|
15
|
+
- \`@logicflow/core\`: core graph editor runtime, including canvas, nodes, edges, models, events, rendering, themes, and basic interactions.
|
|
16
|
+
- \`@logicflow/extension\`: official plugins for common product features.
|
|
17
|
+
- \`@logicflow/layout\`: official layout plugins for automatic graph layout.
|
|
18
|
+
|
|
19
|
+
The docs for \`@logicflow/extension\` and \`@logicflow/layout\` are included under:
|
|
20
|
+
|
|
21
|
+
- \`node_modules/@logicflow/core/dist/docs/tutorial/extension/\`
|
|
22
|
+
|
|
23
|
+
Before implementing any LogicFlow feature, check the local docs first to see whether LogicFlow already provides a built-in, extension, or layout capability. If it does, prefer the documented official capability instead of reimplementing it from scratch.
|
|
24
|
+
|
|
25
|
+
If an official package is needed but not installed, ask the user before installing it.
|
|
26
|
+
<!-- END:logicflow-agent-rules -->`
|
|
27
|
+
|
|
28
|
+
const REMINDER_LINES = [
|
|
29
|
+
'请将下方的规则复制给你的 AI Agent,让 AI Agent 可以更了解 LogicFlow。',
|
|
30
|
+
'您还可以在 README 和官网的 AI 编程章节找到此规则',
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
function shouldUseAnsi() {
|
|
34
|
+
if (!process.stdout.isTTY) return false
|
|
35
|
+
if (process.env.NO_COLOR !== undefined && process.env.NO_COLOR !== '')
|
|
36
|
+
return false
|
|
37
|
+
if (process.env.TERM === 'dumb') return false
|
|
38
|
+
if (process.env.CI === 'true' && !process.env.FORCE_COLOR) return false
|
|
39
|
+
return true
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function dividerWidth() {
|
|
43
|
+
const c = process.stdout.columns
|
|
44
|
+
if (typeof c === 'number' && Number.isFinite(c) && c > 0) {
|
|
45
|
+
return Math.min(c, 120)
|
|
46
|
+
}
|
|
47
|
+
return 80
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function dividerLine() {
|
|
51
|
+
return '─'.repeat(dividerWidth())
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function printReminder() {
|
|
55
|
+
const useAnsi = shouldUseAnsi()
|
|
56
|
+
for (const line of REMINDER_LINES) {
|
|
57
|
+
if (useAnsi) {
|
|
58
|
+
process.stdout.write(`${REMINDER_STYLE}${line}${RESET}\n`)
|
|
59
|
+
} else {
|
|
60
|
+
process.stdout.write(`${line}\n`)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
printReminder()
|
|
66
|
+
console.log(dividerLine())
|
|
67
|
+
console.log(AGENT_RULES)
|