@logicflow/core 2.2.0 → 2.2.2
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/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/dist/index.css +3 -2
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/LogicFlow.d.ts +9 -0
- package/es/LogicFlow.js +0 -1
- package/es/constant/index.d.ts +1 -1
- package/es/constant/index.js +1 -1
- package/es/constant/theme.d.ts +136 -0
- package/es/constant/theme.js +680 -0
- package/es/index.css +3 -2
- package/es/model/GraphModel.d.ts +10 -2
- package/es/model/GraphModel.js +48 -14
- package/es/model/TransformModel.js +9 -9
- package/es/model/edge/BaseEdgeModel.js +7 -2
- package/es/model/edge/PolylineEdgeModel.d.ts +7 -0
- package/es/model/edge/PolylineEdgeModel.js +136 -7
- package/es/model/node/BaseNodeModel.d.ts +12 -1
- package/es/model/node/BaseNodeModel.js +9 -2
- package/es/model/node/HtmlNodeModel.d.ts +12 -0
- package/es/model/node/HtmlNodeModel.js +19 -0
- package/es/model/node/PolygonNodeModel.js +3 -3
- package/es/options.d.ts +4 -2
- package/es/style/index.css +3 -2
- package/es/style/index.less +3 -2
- package/es/style/raw.d.ts +1 -1
- package/es/style/raw.js +1 -1
- package/es/tool/MultipleSelectTool.js +10 -5
- package/es/util/drag.js +0 -1
- package/es/util/edge.d.ts +40 -1
- package/es/util/edge.js +43 -9
- package/es/util/geometry.d.ts +8 -0
- package/es/util/geometry.js +79 -0
- package/es/util/theme.d.ts +2 -65
- package/es/util/theme.js +4 -281
- package/es/view/Anchor.d.ts +1 -0
- package/es/view/Anchor.js +24 -21
- package/es/view/Control.d.ts +5 -0
- package/es/view/Control.js +44 -57
- package/es/view/edge/BaseEdge.js +9 -0
- package/es/view/edge/PolylineEdge.js +13 -2
- package/es/view/node/BaseNode.d.ts +1 -0
- package/es/view/node/BaseNode.js +23 -11
- package/es/view/node/HtmlNode.js +2 -4
- package/es/view/overlay/CanvasOverlay.js +5 -2
- package/es/view/overlay/Grid.d.ts +12 -1
- package/es/view/overlay/Grid.js +85 -23
- package/es/view/overlay/OutlineOverlay.d.ts +1 -0
- package/es/view/overlay/OutlineOverlay.js +18 -17
- package/es/view/overlay/gridConfig.d.ts +46 -0
- package/es/view/overlay/gridConfig.js +99 -0
- package/es/view/shape/Polygon.d.ts +0 -7
- package/es/view/shape/Polygon.js +12 -43
- package/lib/LogicFlow.d.ts +9 -0
- package/lib/LogicFlow.js +0 -1
- package/lib/constant/index.d.ts +1 -1
- package/lib/constant/index.js +16 -2
- package/lib/constant/theme.d.ts +136 -0
- package/lib/constant/theme.js +683 -0
- package/lib/index.css +3 -2
- package/lib/model/GraphModel.d.ts +10 -2
- package/lib/model/GraphModel.js +49 -15
- package/lib/model/TransformModel.js +9 -9
- package/lib/model/edge/BaseEdgeModel.js +7 -2
- package/lib/model/edge/PolylineEdgeModel.d.ts +7 -0
- package/lib/model/edge/PolylineEdgeModel.js +136 -7
- package/lib/model/node/BaseNodeModel.d.ts +12 -1
- package/lib/model/node/BaseNodeModel.js +9 -2
- package/lib/model/node/HtmlNodeModel.d.ts +12 -0
- package/lib/model/node/HtmlNodeModel.js +19 -0
- package/lib/model/node/PolygonNodeModel.js +3 -3
- package/lib/options.d.ts +4 -2
- package/lib/style/index.css +3 -2
- package/lib/style/index.less +3 -2
- package/lib/style/raw.d.ts +1 -1
- package/lib/style/raw.js +1 -1
- package/lib/tool/MultipleSelectTool.js +10 -5
- package/lib/util/drag.js +0 -1
- package/lib/util/edge.d.ts +40 -1
- package/lib/util/edge.js +43 -9
- package/lib/util/geometry.d.ts +8 -0
- package/lib/util/geometry.js +81 -1
- package/lib/util/theme.d.ts +2 -65
- package/lib/util/theme.js +15 -292
- package/lib/view/Anchor.d.ts +1 -0
- package/lib/view/Anchor.js +24 -21
- package/lib/view/Control.d.ts +5 -0
- package/lib/view/Control.js +44 -57
- package/lib/view/edge/BaseEdge.js +9 -0
- package/lib/view/edge/PolylineEdge.js +13 -2
- package/lib/view/node/BaseNode.d.ts +1 -0
- package/lib/view/node/BaseNode.js +22 -10
- package/lib/view/node/HtmlNode.js +1 -3
- package/lib/view/overlay/CanvasOverlay.js +5 -2
- package/lib/view/overlay/Grid.d.ts +12 -1
- package/lib/view/overlay/Grid.js +83 -21
- package/lib/view/overlay/OutlineOverlay.d.ts +1 -0
- package/lib/view/overlay/OutlineOverlay.js +18 -17
- package/lib/view/overlay/gridConfig.d.ts +46 -0
- package/lib/view/overlay/gridConfig.js +104 -0
- package/lib/view/shape/Polygon.d.ts +0 -7
- package/lib/view/shape/Polygon.js +13 -45
- package/package.json +9 -2
- package/scripts/postinstall-ai-prompt.js +67 -0
- package/.turbo/turbo-build$colon$dev.log +0 -10
- package/.turbo/turbo-build.log +0 -33
- package/CHANGELOG.md +0 -1849
- package/__tests__/algorithm/egde.test.ts +0 -131
- package/__tests__/algorithm/index.test.ts +0 -74
- package/__tests__/algorithm/outline.test.ts +0 -43
- package/__tests__/bugs/1545-spec.test.ts +0 -42
- package/__tests__/event/event.test.ts +0 -22
- package/__tests__/history/history.test.ts +0 -28
- package/__tests__/logicflow.test.ts +0 -575
- package/__tests__/model/graphmodel.test.ts +0 -87
- package/__tests__/util/compatible.test.ts +0 -48
- package/__tests__/util/edge.test.ts +0 -224
- package/__tests__/util/geometry.test.ts +0 -14
- package/__tests__/util/graph.test.ts +0 -16
- package/__tests__/util/matrix.test.ts +0 -41
- package/__tests__/util/node.test.ts +0 -68
- package/__tests__/util/sampling.test.ts +0 -12
- package/__tests__/util/vector.test.ts +0 -50
- package/__tests__/util/zIndex.test.ts +0 -10
- package/src/LogicFlow.tsx +0 -2008
- package/src/algorithm/edge.ts +0 -67
- package/src/algorithm/index.ts +0 -70
- package/src/algorithm/outline.ts +0 -77
- package/src/algorithm/rotate.ts +0 -55
- package/src/common/drag.ts +0 -219
- package/src/common/history.ts +0 -108
- package/src/common/index.ts +0 -6
- package/src/common/keyboard.ts +0 -108
- package/src/common/matrix.ts +0 -122
- package/src/common/vector.ts +0 -93
- package/src/constant/index.ts +0 -179
- package/src/event/event.md +0 -66
- package/src/event/eventArgs.ts +0 -643
- package/src/event/eventEmitter.ts +0 -156
- package/src/history/index.ts +0 -119
- package/src/index.less +0 -1
- package/src/index.ts +0 -26
- package/src/keyboard/index.ts +0 -112
- package/src/keyboard/shortcut.ts +0 -200
- package/src/model/BaseModel.ts +0 -250
- package/src/model/EditConfigModel.ts +0 -334
- package/src/model/GraphModel.ts +0 -1788
- package/src/model/NestedTransformModel.ts +0 -121
- package/src/model/SnaplineModel.ts +0 -256
- package/src/model/TransformModel.ts +0 -258
- package/src/model/edge/BaseEdgeModel.ts +0 -777
- package/src/model/edge/BezierEdgeModel.ts +0 -197
- package/src/model/edge/LineEdgeModel.ts +0 -36
- package/src/model/edge/PolylineEdgeModel.ts +0 -672
- package/src/model/edge/index.ts +0 -4
- package/src/model/index.ts +0 -9
- package/src/model/node/BaseNodeModel.ts +0 -949
- package/src/model/node/CircleNodeModel.ts +0 -91
- package/src/model/node/DiamondNodeModel.ts +0 -132
- package/src/model/node/EllipseNodeModel.ts +0 -98
- package/src/model/node/HtmlNodeModel.ts +0 -50
- package/src/model/node/PolygonNodeModel.ts +0 -150
- package/src/model/node/RectNodeModel.ts +0 -69
- package/src/model/node/TextNodeModel.ts +0 -54
- package/src/model/node/index.ts +0 -8
- package/src/options.ts +0 -145
- package/src/style/index.less +0 -261
- package/src/style/raw.ts +0 -220
- package/src/tool/MultipleSelectTool.tsx +0 -132
- package/src/tool/TextEditTool.tsx +0 -193
- package/src/tool/index.ts +0 -101
- package/src/typings.d.ts +0 -5
- package/src/util/animation.ts +0 -29
- package/src/util/browser.ts +0 -4
- package/src/util/compatible.ts +0 -15
- package/src/util/drag.ts +0 -220
- package/src/util/edge.ts +0 -1060
- package/src/util/geometry.ts +0 -55
- package/src/util/graph.ts +0 -46
- package/src/util/index.ts +0 -17
- package/src/util/matrix.ts +0 -129
- package/src/util/mobx.ts +0 -23
- package/src/util/node.ts +0 -543
- package/src/util/raf.ts +0 -28
- package/src/util/resize.ts +0 -606
- package/src/util/sampling.ts +0 -85
- package/src/util/theme.ts +0 -375
- package/src/util/uuid.ts +0 -26
- package/src/util/vector.ts +0 -93
- package/src/util/zIndex.ts +0 -6
- package/src/view/Anchor.tsx +0 -445
- package/src/view/Control.tsx +0 -512
- package/src/view/Graph.tsx +0 -141
- package/src/view/Rotate.tsx +0 -113
- package/src/view/behavior/dnd.ts +0 -162
- package/src/view/behavior/index.ts +0 -2
- package/src/view/behavior/snapline.ts +0 -16
- package/src/view/edge/AdjustPoint.tsx +0 -425
- package/src/view/edge/Arrow.tsx +0 -54
- package/src/view/edge/BaseEdge.tsx +0 -650
- package/src/view/edge/BezierEdge.tsx +0 -101
- package/src/view/edge/LineEdge.tsx +0 -81
- package/src/view/edge/PolylineEdge.tsx +0 -299
- package/src/view/edge/index.ts +0 -6
- package/src/view/index.ts +0 -8
- package/src/view/node/BaseNode.tsx +0 -571
- package/src/view/node/CircleNode.tsx +0 -21
- package/src/view/node/DiamondNode.tsx +0 -24
- package/src/view/node/EllipseNode.tsx +0 -22
- package/src/view/node/HtmlNode.tsx +0 -95
- package/src/view/node/PolygonNode.tsx +0 -28
- package/src/view/node/RectNode.tsx +0 -30
- package/src/view/node/TextNode.tsx +0 -39
- package/src/view/node/index.ts +0 -8
- package/src/view/overlay/BackgroundOverlay.tsx +0 -34
- package/src/view/overlay/BezierAdjustOverlay.tsx +0 -150
- package/src/view/overlay/CanvasOverlay.tsx +0 -288
- package/src/view/overlay/Grid.tsx +0 -162
- package/src/view/overlay/ModificationOverlay.tsx +0 -31
- package/src/view/overlay/OutlineOverlay.tsx +0 -170
- package/src/view/overlay/SnaplineOverlay.tsx +0 -44
- package/src/view/overlay/ToolOverlay.tsx +0 -65
- package/src/view/overlay/getTransformHoc.tsx +0 -50
- package/src/view/overlay/index.ts +0 -8
- package/src/view/shape/Circle.tsx +0 -41
- package/src/view/shape/Ellipse.tsx +0 -42
- package/src/view/shape/Line.tsx +0 -39
- package/src/view/shape/Path.tsx +0 -22
- package/src/view/shape/Polygon.tsx +0 -91
- package/src/view/shape/Polyline.tsx +0 -31
- package/src/view/shape/Rect.tsx +0 -44
- package/src/view/shape/Text.tsx +0 -169
- package/src/view/shape/index.ts +0 -8
- package/src/view/text/BaseText.tsx +0 -134
- package/src/view/text/LineText.tsx +0 -168
- package/src/view/text/index.ts +0 -2
- package/stats.html +0 -4842
- package/tsconfig.json +0 -18
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: Guide
|
|
3
|
+
group:
|
|
4
|
+
title: Intermediate
|
|
5
|
+
order: 2
|
|
6
|
+
title: Snapline
|
|
7
|
+
order: 2
|
|
8
|
+
toc: content
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Snap-lines assist in positional adjustment by comparing the position of a moving node with the
|
|
12
|
+
position of other nodes in the canvas as the node moves. The position comparison is done in two
|
|
13
|
+
ways.
|
|
14
|
+
|
|
15
|
+
- The center of the node
|
|
16
|
+
- The border of the node
|
|
17
|
+
|
|
18
|
+
## Alignment Line Usage
|
|
19
|
+
|
|
20
|
+
Alignment lines are turned on by default in normal editing mode, and can also be turned off by
|
|
21
|
+
configuration.
|
|
22
|
+
In [silent mode](silent-mode.en.md#silent-mode), it is not possible to move the node, so the
|
|
23
|
+
alignment line function is turned off and cannot be turned on by configuration.
|
|
24
|
+
|
|
25
|
+
```tsx | pure
|
|
26
|
+
const lf = new LogicFlow({
|
|
27
|
+
snapline: false,
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Alignment Line Style Settings
|
|
32
|
+
|
|
33
|
+
The style of the alignment line includes color and width, which can be modified by setting the
|
|
34
|
+
theme.
|
|
35
|
+
|
|
36
|
+
```tsx | pure
|
|
37
|
+
// default configuration
|
|
38
|
+
// {
|
|
39
|
+
// stroke: '#1E90FF',
|
|
40
|
+
// strokeWidth: 1,
|
|
41
|
+
// }
|
|
42
|
+
|
|
43
|
+
// Modify the alignment line style
|
|
44
|
+
lf.setTheme({
|
|
45
|
+
snapline: {
|
|
46
|
+
stroke: '#1E90FF',
|
|
47
|
+
strokeWidth: 1,
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
<example :height="400" ></example>
|
|
53
|
+
|
|
54
|
+
For more modifications to the styles see [Theme](../basic/theme.en.md)
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: Guide
|
|
3
|
+
group:
|
|
4
|
+
title: Intermediate
|
|
5
|
+
order: 2
|
|
6
|
+
title: Vue Node Registry
|
|
7
|
+
order: 7
|
|
8
|
+
toc: content
|
|
9
|
+
tag: New
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
:::info{title=New-Features-Introduction}
|
|
13
|
+
* How to use Vue components to register node content
|
|
14
|
+
* How to synchronize node content updates when properties change
|
|
15
|
+
:::
|
|
16
|
+
|
|
17
|
+
## Rendering Vue Components as Node Content
|
|
18
|
+
|
|
19
|
+
Similar to React, we provide a separate package `@logicflow/vue-node-registry` for rendering nodes with Vue components.
|
|
20
|
+
|
|
21
|
+
### Vue 3
|
|
22
|
+
|
|
23
|
+
Here's an example of how to use Vue 3:
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<template>
|
|
27
|
+
<div ref="containerRef" id="graph" class="viewport"></div>
|
|
28
|
+
<TeleportContainer :flow-id="flowId"/>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { onMounted, ref } from 'vue'
|
|
33
|
+
import { has } from 'lodash-es'
|
|
34
|
+
import LogicFlow from '@logicflow/core'
|
|
35
|
+
import { register, getTeleport } from '@logicflow/vue-node-registry'
|
|
36
|
+
import '@logicflow/core/es/index.css'
|
|
37
|
+
|
|
38
|
+
import ProgressNode from '@/components/LFElements/ProgressNode.vue'
|
|
39
|
+
|
|
40
|
+
const lfRef = ref<LogicFlow | null>(null)
|
|
41
|
+
const containerRef = ref<HTMLDivElement | null>(null)
|
|
42
|
+
const TeleportContainer = getTeleport()
|
|
43
|
+
const flowId = ref('')
|
|
44
|
+
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
if (containerRef.value) {
|
|
47
|
+
const lf = new LogicFlow({
|
|
48
|
+
container: containerRef.value,
|
|
49
|
+
grid: true,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
// 注册自定义 vue 节点
|
|
53
|
+
register({
|
|
54
|
+
type: 'custom-vue-node',
|
|
55
|
+
component: ProgressNode
|
|
56
|
+
}, lf)
|
|
57
|
+
|
|
58
|
+
lf.on('graph:rendered', ({ graphModel }) => {
|
|
59
|
+
flowId.value = graphModel.flowId!
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
// 注册事件
|
|
63
|
+
lf.render({})
|
|
64
|
+
|
|
65
|
+
const node1 = lf.addNode({
|
|
66
|
+
id: 'vue-node-1',
|
|
67
|
+
type: 'custom-vue-node',
|
|
68
|
+
x: 80,
|
|
69
|
+
y: 80,
|
|
70
|
+
properties: {
|
|
71
|
+
progress: 60,
|
|
72
|
+
width: 80,
|
|
73
|
+
height: 80
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
console.log('node1 --->>>', node1)
|
|
77
|
+
|
|
78
|
+
const node2 = lf.addNode({
|
|
79
|
+
id: 'vue-node-2',
|
|
80
|
+
type: 'custom-vue-node',
|
|
81
|
+
x: 360,
|
|
82
|
+
y: 80,
|
|
83
|
+
properties: {
|
|
84
|
+
progress: 60,
|
|
85
|
+
width: 80,
|
|
86
|
+
height: 80
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
setInterval(() => {
|
|
91
|
+
const { properties } = node2.getData()
|
|
92
|
+
console.log('properties.progress --->>>', properties?.progress)
|
|
93
|
+
if (has(properties, 'progress')) {
|
|
94
|
+
const progress = properties?.progress
|
|
95
|
+
node2.setProperty('progress', (progress + 10) % 100)
|
|
96
|
+
}
|
|
97
|
+
}, 2000)
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
</script>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Node component content is as follows:
|
|
104
|
+
|
|
105
|
+
```html
|
|
106
|
+
<template>
|
|
107
|
+
<el-progress type="dashboard" :percentage="percentage" :width="80">
|
|
108
|
+
<template #default="{ percentage }">
|
|
109
|
+
<span class="percentage-value">{{ percentage }}%</span>
|
|
110
|
+
</template>
|
|
111
|
+
</el-progress>
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<script lang="ts">
|
|
115
|
+
import {
|
|
116
|
+
defineComponent
|
|
117
|
+
} from 'vue'
|
|
118
|
+
import {
|
|
119
|
+
EventType
|
|
120
|
+
} from '@logicflow/core'
|
|
121
|
+
import {
|
|
122
|
+
vueNodesMap
|
|
123
|
+
} from '@logicflow/vue-node-registry'
|
|
124
|
+
|
|
125
|
+
export default defineComponent({
|
|
126
|
+
name: 'ProgressNode',
|
|
127
|
+
inject: ['getNode', 'getGraph'],
|
|
128
|
+
data() {
|
|
129
|
+
return {
|
|
130
|
+
percentage: 80
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
mounted() {
|
|
134
|
+
const node = (this as any).getNode()
|
|
135
|
+
const graph = (this as any).getGraph()
|
|
136
|
+
graph.eventCenter.on(EventType.NODE_PROPERTIES_CHANGE, (eventData: any) => {
|
|
137
|
+
const keys = eventData.keys as string[]
|
|
138
|
+
const content = vueNodesMap[node.type]
|
|
139
|
+
if (content && eventData.id === node.id) {
|
|
140
|
+
const {
|
|
141
|
+
effect
|
|
142
|
+
} = content
|
|
143
|
+
|
|
144
|
+
// If effect is not defined, default to updating; if effect is defined, only update when properties in effect change
|
|
145
|
+
if (!effect || keys.some((key) => effect.includes(key))) {
|
|
146
|
+
console.log('eventData --->>>', eventData)
|
|
147
|
+
this.percentage = eventData.properties?.progress || 0
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
</script>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Below is an animated image showing the effect. To experience the functionality, you can start the `examples/vue3-app` project.
|
|
157
|
+
<img src="/vue3-app.gif">
|
|
158
|
+
|
|
159
|
+
## Updating Nodes
|
|
160
|
+
|
|
161
|
+
Similar to `HTMLNode`, when users update node properties using `setProperties` or `setProperty`, we need to listen to the `node:properties-change` event inside the component and update the component's state based on the properties value, as demonstrated in the example above.
|
|
162
|
+
|
|
163
|
+
## Using Vue 2
|
|
164
|
+
|
|
165
|
+
In the example above, we used teleport, a feature of Vue 3. How can this be done in Vue 2?
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
<template>
|
|
169
|
+
<div id="app">
|
|
170
|
+
<div ref="containerRef" id="graph"></div>
|
|
171
|
+
</div>
|
|
172
|
+
</template>
|
|
173
|
+
|
|
174
|
+
<script>
|
|
175
|
+
import LogicFlow from '@logicflow/core'
|
|
176
|
+
import {
|
|
177
|
+
register
|
|
178
|
+
} from '@logicflow/vue-node-registry'
|
|
179
|
+
|
|
180
|
+
import ProgressNode from '@/components/ProgressNode'
|
|
181
|
+
import '@logicflow/core/dist/index.css'
|
|
182
|
+
|
|
183
|
+
export default {
|
|
184
|
+
name: 'App',
|
|
185
|
+
data() {
|
|
186
|
+
return {
|
|
187
|
+
lf: null,
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
mounted() {
|
|
191
|
+
this.lf = new LogicFlow({
|
|
192
|
+
container: this.$refs.containerRef,
|
|
193
|
+
grid: true,
|
|
194
|
+
})
|
|
195
|
+
register({
|
|
196
|
+
type: 'progress',
|
|
197
|
+
component: ProgressNode,
|
|
198
|
+
},
|
|
199
|
+
this.lf,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
this.lf.render({})
|
|
203
|
+
|
|
204
|
+
const node1 = this.lf.addNode({
|
|
205
|
+
id: 'vue-node-1',
|
|
206
|
+
type: 'progress',
|
|
207
|
+
x: 80,
|
|
208
|
+
y: 80,
|
|
209
|
+
properties: {
|
|
210
|
+
progress: 60,
|
|
211
|
+
width: 80,
|
|
212
|
+
height: 80,
|
|
213
|
+
},
|
|
214
|
+
})
|
|
215
|
+
console.log('node1 --->>>', node1)
|
|
216
|
+
},
|
|
217
|
+
}
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
<style>
|
|
221
|
+
#graph {
|
|
222
|
+
height: 100vh;
|
|
223
|
+
}
|
|
224
|
+
</style>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Node component content is as follows:
|
|
228
|
+
|
|
229
|
+
```html
|
|
230
|
+
<template>
|
|
231
|
+
<div>vue2 node</div>
|
|
232
|
+
</template>
|
|
233
|
+
|
|
234
|
+
<script>
|
|
235
|
+
export default {
|
|
236
|
+
name: 'ProgressNode',
|
|
237
|
+
inject: ['getNode', 'getGraph'],
|
|
238
|
+
data() {
|
|
239
|
+
return {
|
|
240
|
+
percentage: 80,
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
}
|
|
244
|
+
</script>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
:::warning{title=Note}
|
|
248
|
+
Currently, there are some limitations with node component content in Vue 2, such as the inability to use Vuex, i18n, element-ui, etc. If you need these features, you can try using `vue2-teleport` to enhance the capabilities, and we welcome PRs (we will also gradually enhance this functionality in the future).
|
|
249
|
+
:::
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 指南
|
|
3
|
+
group:
|
|
4
|
+
title: 进阶
|
|
5
|
+
order: 2
|
|
6
|
+
title: Vue 节点
|
|
7
|
+
order: 7
|
|
8
|
+
toc: content
|
|
9
|
+
tag: 新特性
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
:::info{title=我们带来了新特性,本节内容主要介绍}
|
|
13
|
+
- 如何使用 Vue 组件来注册节点内容
|
|
14
|
+
- properties 更新后如何同步更新节点内容
|
|
15
|
+
::::
|
|
16
|
+
|
|
17
|
+
::::info{title=阅读提示}
|
|
18
|
+
- 适合已经理解 [节点](../basic/node.zh.md) 的 Vue 项目用户
|
|
19
|
+
- 当前推荐优先使用 `@logicflow/vue-node-registry`
|
|
20
|
+
- Vue3 和 Vue2 的使用方式不同,建议按自己的技术栈跳读,不要混在一起理解
|
|
21
|
+
- 本页不展开连接规则、锚点和边能力;这些内容请回到 [进阶节点](node.zh.md)
|
|
22
|
+
- 相关 API:[`nodeModel`](../../api/runtime-model/nodeModel.zh.md)、[`graphModel`](../../api/runtime-model/graphModel.zh.md)、[`事件`](../../api/logicflow-instance/event.zh.md)
|
|
23
|
+
::::
|
|
24
|
+
|
|
25
|
+
## 渲染 Vue 组件为节点内容
|
|
26
|
+
同 React 一样我们提供了一个独立的包 `@logicflow/vue-node-registry` 来使用 Vue 组件渲染节点。
|
|
27
|
+
|
|
28
|
+
### Vue3
|
|
29
|
+
在 Vue3 中使用示例如下:
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<template>
|
|
33
|
+
<div ref="containerRef" id="graph" class="viewport"></div>
|
|
34
|
+
<TeleportContainer :flow-id="flowId"/>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import { onMounted, ref } from 'vue'
|
|
39
|
+
import { has } from 'lodash-es'
|
|
40
|
+
import LogicFlow from '@logicflow/core'
|
|
41
|
+
import { register, getTeleport } from '@logicflow/vue-node-registry'
|
|
42
|
+
import '@logicflow/core/es/index.css'
|
|
43
|
+
|
|
44
|
+
import ProgressNode from '@/components/LFElements/ProgressNode.vue'
|
|
45
|
+
|
|
46
|
+
const lfRef = ref<LogicFlow | null>(null)
|
|
47
|
+
const containerRef = ref<HTMLDivElement | null>(null)
|
|
48
|
+
const TeleportContainer = getTeleport()
|
|
49
|
+
const flowId = ref('')
|
|
50
|
+
|
|
51
|
+
onMounted(() => {
|
|
52
|
+
if (containerRef.value) {
|
|
53
|
+
const lf = new LogicFlow({
|
|
54
|
+
container: containerRef.value,
|
|
55
|
+
grid: true,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// 注册自定义 vue 节点
|
|
59
|
+
register({
|
|
60
|
+
type: 'custom-vue-node',
|
|
61
|
+
component: ProgressNode
|
|
62
|
+
}, lf)
|
|
63
|
+
|
|
64
|
+
lf.on('graph:rendered', ({ graphModel }) => {
|
|
65
|
+
flowId.value = graphModel.flowId!
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
// 注册事件
|
|
69
|
+
lf.render({})
|
|
70
|
+
|
|
71
|
+
const node1 = lf.addNode({
|
|
72
|
+
id: 'vue-node-1',
|
|
73
|
+
type: 'custom-vue-node',
|
|
74
|
+
x: 80,
|
|
75
|
+
y: 80,
|
|
76
|
+
properties: {
|
|
77
|
+
progress: 60,
|
|
78
|
+
width: 80,
|
|
79
|
+
height: 80
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
console.log('node1 --->>>', node1)
|
|
83
|
+
|
|
84
|
+
const node2 = lf.addNode({
|
|
85
|
+
id: 'vue-node-2',
|
|
86
|
+
type: 'custom-vue-node',
|
|
87
|
+
x: 360,
|
|
88
|
+
y: 80,
|
|
89
|
+
properties: {
|
|
90
|
+
progress: 60,
|
|
91
|
+
width: 80,
|
|
92
|
+
height: 80
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
setInterval(() => {
|
|
97
|
+
const { properties } = node2.getData()
|
|
98
|
+
console.log('properties.progress --->>>', properties?.progress)
|
|
99
|
+
if (has(properties, 'progress')) {
|
|
100
|
+
const progress = properties?.progress
|
|
101
|
+
node2.setProperty('progress', (progress + 10) % 100)
|
|
102
|
+
}
|
|
103
|
+
}, 2000)
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
节点组件内容如下:
|
|
111
|
+
```html
|
|
112
|
+
<template>
|
|
113
|
+
<el-progress type="dashboard" :percentage="percentage" :width="80">
|
|
114
|
+
<template #default="{ percentage }">
|
|
115
|
+
<span class="percentage-value">{{ percentage }}%</span>
|
|
116
|
+
</template>
|
|
117
|
+
</el-progress>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<script lang="ts">
|
|
121
|
+
import { defineComponent } from 'vue'
|
|
122
|
+
import { EventType } from '@logicflow/core'
|
|
123
|
+
import { vueNodesMap } from '@logicflow/vue-node-registry'
|
|
124
|
+
|
|
125
|
+
export default defineComponent({
|
|
126
|
+
name: 'ProgressNode',
|
|
127
|
+
inject: ['getNode', 'getGraph'],
|
|
128
|
+
data() {
|
|
129
|
+
return {
|
|
130
|
+
percentage: 80
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
mounted() {
|
|
134
|
+
const node = (this as any).getNode()
|
|
135
|
+
const graph = (this as any).getGraph()
|
|
136
|
+
graph.eventCenter.on(EventType.NODE_PROPERTIES_CHANGE, (eventData: any) => {
|
|
137
|
+
const keys = eventData.keys as string[]
|
|
138
|
+
const content = vueNodesMap[node.type]
|
|
139
|
+
if (content && eventData.id === node.id) {
|
|
140
|
+
const { effect } = content
|
|
141
|
+
|
|
142
|
+
// 如果没有定义 effect,则默认更新;如果定义了 effect,则只有在 effect 中的属性发生变化时才更新
|
|
143
|
+
if (!effect || keys.some((key) => effect.includes(key))) {
|
|
144
|
+
console.log('eventData --->>>', eventData)
|
|
145
|
+
this.percentage = eventData.properties?.progress || 0
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
下面插入一张动图展示效果。如果想体验具体功能可以通过启动:examples/vue3-app 项目查看。
|
|
156
|
+
<img src="/vue3-app.gif">
|
|
157
|
+
|
|
158
|
+
## 更新节点
|
|
159
|
+
跟 `HTMLNode` 一样,当用户通过 `setProperties` 或 `setProperty` 等更新节点 properties 时,
|
|
160
|
+
我们需要在组件内部监听 `node:properties-change` 事件,根据 properties 值更新组件状态。如上面 Demo 所示。
|
|
161
|
+
|
|
162
|
+
## Vue2 使用
|
|
163
|
+
上面我们使用到了 teleport,它是 Vue3 中的特性,如果在 Vue2 中,如何使用呢?
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
<template>
|
|
167
|
+
<div id="app">
|
|
168
|
+
<div ref="containerRef" id="graph"></div>
|
|
169
|
+
</div>
|
|
170
|
+
</template>
|
|
171
|
+
|
|
172
|
+
<script>
|
|
173
|
+
import LogicFlow from '@logicflow/core'
|
|
174
|
+
import { register } from '@logicflow/vue-node-registry'
|
|
175
|
+
|
|
176
|
+
import ProgressNode from '@/components/ProgressNode'
|
|
177
|
+
import '@logicflow/core/dist/index.css'
|
|
178
|
+
|
|
179
|
+
export default {
|
|
180
|
+
name: 'App',
|
|
181
|
+
data() {
|
|
182
|
+
return {
|
|
183
|
+
lf: null,
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
mounted() {
|
|
187
|
+
this.lf = new LogicFlow({
|
|
188
|
+
container: this.$refs.containerRef,
|
|
189
|
+
grid: true,
|
|
190
|
+
})
|
|
191
|
+
register(
|
|
192
|
+
{
|
|
193
|
+
type: 'progress',
|
|
194
|
+
component: ProgressNode,
|
|
195
|
+
},
|
|
196
|
+
this.lf,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
this.lf.render({})
|
|
200
|
+
|
|
201
|
+
const node1 = this.lf.addNode({
|
|
202
|
+
id: 'vue-node-1',
|
|
203
|
+
type: 'progress',
|
|
204
|
+
x: 80,
|
|
205
|
+
y: 80,
|
|
206
|
+
properties: {
|
|
207
|
+
progress: 60,
|
|
208
|
+
width: 80,
|
|
209
|
+
height: 80,
|
|
210
|
+
},
|
|
211
|
+
})
|
|
212
|
+
console.log('node1 --->>>', node1)
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
</script>
|
|
216
|
+
|
|
217
|
+
<style>
|
|
218
|
+
#graph {
|
|
219
|
+
height: 100vh;
|
|
220
|
+
}
|
|
221
|
+
</style>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
节点组件内容如下:
|
|
225
|
+
```html
|
|
226
|
+
<template>
|
|
227
|
+
<div>vue2 node</div>
|
|
228
|
+
</template>
|
|
229
|
+
|
|
230
|
+
<script>
|
|
231
|
+
export default {
|
|
232
|
+
name: 'ProgressNode',
|
|
233
|
+
inject: ['getNode', 'getGraph'],
|
|
234
|
+
data() {
|
|
235
|
+
return {
|
|
236
|
+
percentage: 80,
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
:::warning{title=注意}
|
|
245
|
+
目前在 Vue2 中,节点组件内容有一些限制,比如无法使用 Vuex、i18n、element-ui 等。如果需要使用这些功能,可以尝试
|
|
246
|
+
使用 vue2-teleport 来增强能力,欢迎给我们提 PR(我们后面也会逐步增强该功能)。
|
|
247
|
+
:::
|
|
248
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: Guide
|
|
3
|
+
group:
|
|
4
|
+
title: Introduction
|
|
5
|
+
title: AI Programming Support
|
|
6
|
+
order: 2
|
|
7
|
+
toc: content
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
Starting from `@logicflow/core@2.3.0`, LogicFlow ships tutorial and API docs with the npm package. Copy the prompt on this page to your AI Agent so it can read local docs in your project instead of implementing LogicFlow features from general knowledge alone.
|
|
11
|
+
|
|
12
|
+
## When to Copy the Prompt
|
|
13
|
+
|
|
14
|
+
Copy the prompt in these situations:
|
|
15
|
+
|
|
16
|
+
1. After installing `@logicflow/core` for the first time
|
|
17
|
+
2. After upgrading `@logicflow/core`
|
|
18
|
+
3. Before asking an Agent to implement LogicFlow features
|
|
19
|
+
|
|
20
|
+
If your Agent already has an older prompt but still misses official plugin or layout capabilities, copy the latest prompt below again.
|
|
21
|
+
|
|
22
|
+
## What the Agent Should Know
|
|
23
|
+
|
|
24
|
+
LogicFlow is organized around three main packages:
|
|
25
|
+
|
|
26
|
+
- `@logicflow/core`: the core graph editor runtime, including canvas, nodes, edges, models, events, rendering, themes, and basic interactions.
|
|
27
|
+
- `@logicflow/extension`: the official extension package for common product features.
|
|
28
|
+
- `@logicflow/layout`: the official layout plugin package for automatic graph layout.
|
|
29
|
+
|
|
30
|
+
The docs for these packages are shipped under `node_modules/@logicflow/core/dist/docs/`. The docs for `@logicflow/extension` and `@logicflow/layout` mainly live under `tutorial/extension/`.
|
|
31
|
+
|
|
32
|
+
## Prompt to Copy
|
|
33
|
+
|
|
34
|
+
Copy the whole block below to your AI Agent:
|
|
35
|
+
|
|
36
|
+
```md
|
|
37
|
+
<!-- BEGIN:logicflow-agent-rules -->
|
|
38
|
+
# LogicFlow Agent Rules
|
|
39
|
+
|
|
40
|
+
LogicFlow documentation is available at:
|
|
41
|
+
|
|
42
|
+
- `node_modules/@logicflow/core/dist/docs/`
|
|
43
|
+
|
|
44
|
+
Package roles:
|
|
45
|
+
|
|
46
|
+
- `@logicflow/core`: core graph editor runtime, including canvas, nodes, edges, models, events, rendering, themes, and basic interactions.
|
|
47
|
+
- `@logicflow/extension`: official plugins for common product features.
|
|
48
|
+
- `@logicflow/layout`: official layout plugins for automatic graph layout.
|
|
49
|
+
|
|
50
|
+
The docs for `@logicflow/extension` and `@logicflow/layout` are included under:
|
|
51
|
+
|
|
52
|
+
- `node_modules/@logicflow/core/dist/docs/tutorial/extension/`
|
|
53
|
+
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
If an official package is needed but not installed, ask the user before installing it.
|
|
57
|
+
<!-- END:logicflow-agent-rules -->
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Next Reading
|
|
61
|
+
|
|
62
|
+
- New to LogicFlow: read [Getting Started](get-started.en.md)
|
|
63
|
+
- Need plugins or layout: read [Plugin Introduction](extension/intro.en.md)
|
|
64
|
+
- Need exact API options: read [API Guide](../api/logicflow-instance/index.en.md)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 指南
|
|
3
|
+
group:
|
|
4
|
+
title: 介绍
|
|
5
|
+
title: AI 编程支持
|
|
6
|
+
order: 2
|
|
7
|
+
toc: content
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
LogicFlow 会从 `@logicflow/core@2.3.0` 开始,把教程和 API 文档随 npm 包一起发布。你可以把本页的提示词复制给 AI Agent,让它在你的项目里直接读取本地文档,而不是只凭通用经验实现功能。
|
|
11
|
+
|
|
12
|
+
## 什么时候复制给 Agent
|
|
13
|
+
|
|
14
|
+
建议在这些场景复制:
|
|
15
|
+
|
|
16
|
+
1. 首次安装 `@logicflow/core` 后
|
|
17
|
+
2. 升级 `@logicflow/core` 后
|
|
18
|
+
3. 准备让 Agent 实现 LogicFlow 相关功能前
|
|
19
|
+
|
|
20
|
+
如果 Agent 已经拿到旧提示词,但仍然没有按官方插件或布局能力实现功能,也可以重新复制下面的最新提示词。
|
|
21
|
+
|
|
22
|
+
## Agent 需要知道什么
|
|
23
|
+
|
|
24
|
+
LogicFlow 主要由三个包组成:
|
|
25
|
+
|
|
26
|
+
- `@logicflow/core`:核心画布运行时,包含画布、节点、边、模型、事件、渲染、主题和基础交互能力。
|
|
27
|
+
- `@logicflow/extension`:官方插件包,用于常见产品功能。
|
|
28
|
+
- `@logicflow/layout`:官方布局插件包,用于自动布局。
|
|
29
|
+
|
|
30
|
+
这些包的使用文档都发布在 `node_modules/@logicflow/core/dist/docs/` 中。其中 `@logicflow/extension` 和 `@logicflow/layout` 的文档主要在 `tutorial/extension/` 目录下。
|
|
31
|
+
|
|
32
|
+
## 复制给 Agent 的提示词
|
|
33
|
+
|
|
34
|
+
将下面整段内容复制给你的 AI Agent:
|
|
35
|
+
|
|
36
|
+
```md
|
|
37
|
+
<!-- BEGIN:logicflow-agent-rules -->
|
|
38
|
+
# LogicFlow Agent Rules
|
|
39
|
+
|
|
40
|
+
LogicFlow documentation is available at:
|
|
41
|
+
|
|
42
|
+
- `node_modules/@logicflow/core/dist/docs/`
|
|
43
|
+
|
|
44
|
+
Package roles:
|
|
45
|
+
|
|
46
|
+
- `@logicflow/core`: core graph editor runtime, including canvas, nodes, edges, models, events, rendering, themes, and basic interactions.
|
|
47
|
+
- `@logicflow/extension`: official plugins for common product features.
|
|
48
|
+
- `@logicflow/layout`: official layout plugins for automatic graph layout.
|
|
49
|
+
|
|
50
|
+
The docs for `@logicflow/extension` and `@logicflow/layout` are included under:
|
|
51
|
+
|
|
52
|
+
- `node_modules/@logicflow/core/dist/docs/tutorial/extension/`
|
|
53
|
+
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
If an official package is needed but not installed, ask the user before installing it.
|
|
57
|
+
<!-- END:logicflow-agent-rules -->
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 下一步阅读
|
|
61
|
+
|
|
62
|
+
- 第一次接入 LogicFlow:阅读 [快速上手](get-started.zh.md)
|
|
63
|
+
- 需要插件或布局能力:阅读 [插件简介](extension/intro.zh.md)
|
|
64
|
+
- 需要精确 API 参数:阅读 [API 导览](../api/logicflow-instance/index.zh.md)
|