@logicflow/extension 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 (201) hide show
  1. package/README.md +16 -0
  2. package/dist/index.css +1 -1
  3. package/dist/index.min.js +1 -1
  4. package/dist/index.min.js.map +1 -1
  5. package/es/NodeResize/node/RectResize.d.ts +0 -6
  6. package/es/NodeResize/node/RectResize.js +2 -11
  7. package/es/bpmn-elements-adapter/json2xml.d.ts +2 -1
  8. package/es/bpmn-elements-adapter/json2xml.js +18 -4
  9. package/es/bpmn-elements-adapter/xml2json.js +2 -7
  10. package/es/components/control/index.d.ts +1 -0
  11. package/es/components/control/index.js +24 -11
  12. package/es/components/mini-map/index.js +1 -1
  13. package/es/dynamic-group/model.d.ts +2 -1
  14. package/es/dynamic-group/model.js +28 -11
  15. package/es/dynamic-group/node.js +1 -0
  16. package/es/index.css +1 -1
  17. package/es/index.d.ts +1 -0
  18. package/es/index.js +2 -0
  19. package/es/insert-node-in-polyline/index.js +11 -35
  20. package/es/materials/curved-edge/index.js +49 -21
  21. package/es/materials/group/GroupNode.d.ts +0 -6
  22. package/es/materials/group/GroupNode.js +1 -6
  23. package/es/pool/LaneModel.d.ts +90 -0
  24. package/es/pool/LaneModel.js +252 -0
  25. package/es/pool/LaneView.d.ts +40 -0
  26. package/es/pool/LaneView.js +202 -0
  27. package/es/pool/PoolModel.d.ts +120 -0
  28. package/es/pool/PoolModel.js +586 -0
  29. package/es/pool/PoolView.d.ts +17 -0
  30. package/es/pool/PoolView.js +76 -0
  31. package/es/pool/constant.d.ts +15 -0
  32. package/es/pool/constant.js +17 -0
  33. package/es/pool/index.d.ts +89 -0
  34. package/es/pool/index.js +524 -0
  35. package/es/pool/utils.d.ts +19 -0
  36. package/es/pool/utils.js +33 -0
  37. package/es/style/index.css +1 -1
  38. package/es/style/raw.d.ts +1 -1
  39. package/es/style/raw.js +1 -1
  40. package/es/tools/label/LabelOverlay.js +3 -3
  41. package/es/tools/label/mediumEditor.d.ts +1 -1
  42. package/es/tools/label/mediumEditor.js +89 -52
  43. package/es/tools/snapshot/index.d.ts +7 -3
  44. package/es/tools/snapshot/index.js +72 -77
  45. package/lib/NodeResize/node/RectResize.d.ts +0 -6
  46. package/lib/NodeResize/node/RectResize.js +1 -10
  47. package/lib/bpmn-elements-adapter/json2xml.d.ts +2 -1
  48. package/lib/bpmn-elements-adapter/json2xml.js +19 -4
  49. package/lib/bpmn-elements-adapter/xml2json.js +2 -7
  50. package/lib/components/control/index.d.ts +1 -0
  51. package/lib/components/control/index.js +24 -11
  52. package/lib/components/mini-map/index.js +1 -1
  53. package/lib/dynamic-group/model.d.ts +2 -1
  54. package/lib/dynamic-group/model.js +28 -11
  55. package/lib/dynamic-group/node.js +1 -0
  56. package/lib/index.css +1 -1
  57. package/lib/index.d.ts +1 -0
  58. package/lib/index.js +2 -0
  59. package/lib/insert-node-in-polyline/index.js +10 -34
  60. package/lib/materials/curved-edge/index.js +49 -21
  61. package/lib/materials/group/GroupNode.d.ts +0 -6
  62. package/lib/materials/group/GroupNode.js +1 -6
  63. package/lib/pool/LaneModel.d.ts +90 -0
  64. package/lib/pool/LaneModel.js +255 -0
  65. package/lib/pool/LaneView.d.ts +40 -0
  66. package/lib/pool/LaneView.js +205 -0
  67. package/lib/pool/PoolModel.d.ts +120 -0
  68. package/lib/pool/PoolModel.js +589 -0
  69. package/lib/pool/PoolView.d.ts +17 -0
  70. package/lib/pool/PoolView.js +79 -0
  71. package/lib/pool/constant.d.ts +15 -0
  72. package/lib/pool/constant.js +20 -0
  73. package/lib/pool/index.d.ts +89 -0
  74. package/lib/pool/index.js +527 -0
  75. package/lib/pool/utils.d.ts +19 -0
  76. package/lib/pool/utils.js +38 -0
  77. package/lib/style/index.css +1 -1
  78. package/lib/style/raw.d.ts +1 -1
  79. package/lib/style/raw.js +1 -1
  80. package/lib/tools/label/LabelOverlay.js +2 -2
  81. package/lib/tools/label/mediumEditor.d.ts +1 -1
  82. package/lib/tools/label/mediumEditor.js +91 -53
  83. package/lib/tools/snapshot/index.d.ts +7 -3
  84. package/lib/tools/snapshot/index.js +72 -77
  85. package/package.json +10 -7
  86. package/.turbo/turbo-build.log +0 -38
  87. package/CHANGELOG.md +0 -1766
  88. package/__test__/bpmn-adapter.test.js +0 -227
  89. package/es/materials/curved-edge/__test__/curved-edge.test.d.ts +0 -1
  90. package/es/materials/curved-edge/__test__/curved-edge.test.js +0 -18
  91. package/jest.config.js +0 -198
  92. package/lib/materials/curved-edge/__test__/curved-edge.test.d.ts +0 -1
  93. package/lib/materials/curved-edge/__test__/curved-edge.test.js +0 -20
  94. package/rollup.config.js +0 -52
  95. package/src/NodeResize/BasicShape/Ellipse.tsx +0 -22
  96. package/src/NodeResize/BasicShape/Polygon.tsx +0 -24
  97. package/src/NodeResize/BasicShape/Rect.tsx +0 -44
  98. package/src/NodeResize/control/Control.tsx +0 -537
  99. package/src/NodeResize/control/ControlGroup.tsx +0 -76
  100. package/src/NodeResize/control/Util.ts +0 -206
  101. package/src/NodeResize/index.ts +0 -26
  102. package/src/NodeResize/node/DiamondResize.tsx +0 -149
  103. package/src/NodeResize/node/EllipseResize.tsx +0 -140
  104. package/src/NodeResize/node/HtmlResize.tsx +0 -125
  105. package/src/NodeResize/node/RectResize.tsx +0 -146
  106. package/src/NodeResize/node/index.ts +0 -4
  107. package/src/bpmn/constant.ts +0 -56
  108. package/src/bpmn/events/EndEvent.ts +0 -73
  109. package/src/bpmn/events/StartEvent.ts +0 -52
  110. package/src/bpmn/events/index.ts +0 -2
  111. package/src/bpmn/flow/SequenceFlow.ts +0 -25
  112. package/src/bpmn/flow/index.ts +0 -1
  113. package/src/bpmn/gateways/ExclusiveGateway.ts +0 -71
  114. package/src/bpmn/gateways/index.ts +0 -1
  115. package/src/bpmn/getBpmnId.ts +0 -31
  116. package/src/bpmn/index.ts +0 -60
  117. package/src/bpmn/tasks/ServiceTask.ts +0 -63
  118. package/src/bpmn/tasks/UserTask.ts +0 -64
  119. package/src/bpmn/tasks/index.ts +0 -2
  120. package/src/bpmn-adapter/bpmnIds.ts +0 -31
  121. package/src/bpmn-adapter/index.ts +0 -835
  122. package/src/bpmn-adapter/json2xml.ts +0 -127
  123. package/src/bpmn-adapter/xml2json.ts +0 -544
  124. package/src/bpmn-elements/README.md +0 -223
  125. package/src/bpmn-elements/__tests__/definition.test.js +0 -72
  126. package/src/bpmn-elements/index.d.ts +0 -26
  127. package/src/bpmn-elements/index.ts +0 -107
  128. package/src/bpmn-elements/presets/Event/EndEventFactory.ts +0 -114
  129. package/src/bpmn-elements/presets/Event/IntermediateCatchEvent.ts +0 -108
  130. package/src/bpmn-elements/presets/Event/IntermediateThrowEvent.ts +0 -109
  131. package/src/bpmn-elements/presets/Event/StartEventFactory.ts +0 -114
  132. package/src/bpmn-elements/presets/Event/boundaryEventFactory.ts +0 -117
  133. package/src/bpmn-elements/presets/Event/index.ts +0 -14
  134. package/src/bpmn-elements/presets/Flow/flow.d.ts +0 -6
  135. package/src/bpmn-elements/presets/Flow/index.ts +0 -8
  136. package/src/bpmn-elements/presets/Flow/manhattan.ts +0 -691
  137. package/src/bpmn-elements/presets/Flow/sequenceFlow.ts +0 -65
  138. package/src/bpmn-elements/presets/Gateway/gateway.ts +0 -107
  139. package/src/bpmn-elements/presets/Gateway/index.ts +0 -23
  140. package/src/bpmn-elements/presets/Pool/Lane.ts +0 -211
  141. package/src/bpmn-elements/presets/Pool/Pool.ts +0 -284
  142. package/src/bpmn-elements/presets/Pool/index.ts +0 -89
  143. package/src/bpmn-elements/presets/Task/index.ts +0 -122
  144. package/src/bpmn-elements/presets/Task/subProcess.ts +0 -189
  145. package/src/bpmn-elements/presets/Task/task.ts +0 -193
  146. package/src/bpmn-elements/presets/icons.ts +0 -155
  147. package/src/bpmn-elements/utils.ts +0 -52
  148. package/src/bpmn-elements-adapter/README.md +0 -293
  149. package/src/bpmn-elements-adapter/__tests__/adapter_in.test.js +0 -528
  150. package/src/bpmn-elements-adapter/__tests__/adapter_out.test.js +0 -569
  151. package/src/bpmn-elements-adapter/constant.ts +0 -76
  152. package/src/bpmn-elements-adapter/index.ts +0 -1134
  153. package/src/bpmn-elements-adapter/json2xml.ts +0 -91
  154. package/src/bpmn-elements-adapter/xml2json.ts +0 -548
  155. package/src/components/context-menu/index.ts +0 -253
  156. package/src/components/control/index.ts +0 -141
  157. package/src/components/dnd-panel/index.ts +0 -137
  158. package/src/components/highlight/index.ts +0 -227
  159. package/src/components/menu/index.ts +0 -748
  160. package/src/components/mini-map/index.ts +0 -686
  161. package/src/components/selection-select/index.ts +0 -387
  162. package/src/dynamic-group/index.ts +0 -775
  163. package/src/dynamic-group/model.ts +0 -562
  164. package/src/dynamic-group/node.ts +0 -288
  165. package/src/dynamic-group/utils.ts +0 -46
  166. package/src/index.less +0 -1
  167. package/src/index.ts +0 -45
  168. package/src/insert-node-in-polyline/edge.ts +0 -175
  169. package/src/insert-node-in-polyline/index.ts +0 -187
  170. package/src/materials/curved-edge/__test__/curved-edge.test.ts +0 -46
  171. package/src/materials/curved-edge/index.ts +0 -185
  172. package/src/materials/group/GroupNode.ts +0 -442
  173. package/src/materials/group/index.ts +0 -542
  174. package/src/materials/node-selection/index.ts +0 -380
  175. package/src/mindmap/fakerRoot.ts +0 -19
  176. package/src/mindmap/index.ts +0 -328
  177. package/src/mindmap/markContent.ts +0 -81
  178. package/src/mindmap/markContentOption.ts +0 -81
  179. package/src/mindmap/markEntity.ts +0 -82
  180. package/src/mindmap/markRoot.ts +0 -83
  181. package/src/mindmap/theme.ts +0 -11
  182. package/src/rect-label-node/RectLabelNodeView.ts +0 -33
  183. package/src/rect-label-node/index.ts +0 -15
  184. package/src/style/index.less +0 -342
  185. package/src/style/raw.ts +0 -295
  186. package/src/tools/auto-layout/index.ts +0 -282
  187. package/src/tools/flow-path/index.ts +0 -233
  188. package/src/tools/label/Label.tsx +0 -357
  189. package/src/tools/label/LabelModel.ts +0 -83
  190. package/src/tools/label/LabelOverlay.tsx +0 -158
  191. package/src/tools/label/algorithm.ts +0 -42
  192. package/src/tools/label/index.ts +0 -479
  193. package/src/tools/label/mediumEditor.ts +0 -94
  194. package/src/tools/label/utils.ts +0 -395
  195. package/src/tools/proximity-connect/index.ts +0 -435
  196. package/src/tools/snapshot/README.md +0 -145
  197. package/src/tools/snapshot/index.ts +0 -718
  198. package/src/tools/snapshot/utils.ts +0 -163
  199. package/src/turbo-adapter/index.ts +0 -212
  200. package/stats.html +0 -4842
  201. package/tsconfig.json +0 -18
@@ -1,227 +0,0 @@
1
- import { toXmlJson, toNormalJson } from '../src/bpmn-adapter/index'
2
- import { lfJson2Xml } from '../src/bpmn-adapter/json2xml'
3
- import { lfXml2Json } from '../src/bpmn-adapter/xml2json'
4
-
5
- /**
6
- * @jest-environment jsdom
7
- */
8
- test('transform data from json to xml', () => {
9
- const testObj = {
10
- nodes: [
11
- {
12
- id: 'node_1',
13
- type: 'rect',
14
- x: 100,
15
- y: 200,
16
- properties: {},
17
- },
18
- {
19
- id: 'node_2',
20
- type: 'circle',
21
- x: 300,
22
- y: 160,
23
- properties: {},
24
- },
25
- ],
26
- edges: [
27
- {
28
- id: 'ca1dea84-c5e8-4344-b888-8bb09666ac42',
29
- type: 'polyline',
30
- sourceNodeId: 'node_1',
31
- targetNodeId: 'node_2',
32
- startPoint: {
33
- x: 150,
34
- y: 200,
35
- },
36
- endPoint: {
37
- x: 250,
38
- y: 160,
39
- },
40
- properties: {},
41
- pointsList: [
42
- {
43
- x: 150,
44
- y: 200,
45
- },
46
- {
47
- x: 200,
48
- y: 200,
49
- },
50
- {
51
- x: 200,
52
- y: 160,
53
- },
54
- {
55
- x: 250,
56
- y: 160,
57
- },
58
- ],
59
- },
60
- ],
61
- }
62
- expect(toXmlJson()(testObj)).toStrictEqual({
63
- nodes: [
64
- {
65
- '-id': 'node_1',
66
- '-type': 'rect',
67
- '-x': 100,
68
- '-y': 200,
69
- '-properties': {},
70
- },
71
- {
72
- '-id': 'node_2',
73
- '-type': 'circle',
74
- '-x': 300,
75
- '-y': 160,
76
- '-properties': {},
77
- },
78
- ],
79
- edges: [
80
- {
81
- '-id': 'ca1dea84-c5e8-4344-b888-8bb09666ac42',
82
- '-type': 'polyline',
83
- '-sourceNodeId': 'node_1',
84
- '-targetNodeId': 'node_2',
85
- '-startPoint': {
86
- '-x': 150,
87
- '-y': 200,
88
- },
89
- '-endPoint': {
90
- '-x': 250,
91
- '-y': 160,
92
- },
93
- '-properties': {},
94
- '-pointsList': [
95
- {
96
- '-x': 150,
97
- '-y': 200,
98
- },
99
- {
100
- '-x': 200,
101
- '-y': 200,
102
- },
103
- {
104
- '-x': 200,
105
- '-y': 160,
106
- },
107
- {
108
- '-x': 250,
109
- '-y': 160,
110
- },
111
- ],
112
- },
113
- ],
114
- })
115
-
116
- const xmlJson = toXmlJson()(testObj)
117
- expect(toNormalJson(xmlJson)).toStrictEqual({
118
- nodes: [
119
- {
120
- id: 'node_1',
121
- type: 'rect',
122
- x: 100,
123
- y: 200,
124
- properties: {},
125
- },
126
- {
127
- id: 'node_2',
128
- type: 'circle',
129
- x: 300,
130
- y: 160,
131
- properties: {},
132
- },
133
- ],
134
- edges: [
135
- {
136
- id: 'ca1dea84-c5e8-4344-b888-8bb09666ac42',
137
- type: 'polyline',
138
- sourceNodeId: 'node_1',
139
- targetNodeId: 'node_2',
140
- startPoint: {
141
- x: 150,
142
- y: 200,
143
- },
144
- endPoint: {
145
- x: 250,
146
- y: 160,
147
- },
148
- properties: {},
149
- pointsList: [
150
- {
151
- x: 150,
152
- y: 200,
153
- },
154
- {
155
- x: 200,
156
- y: 200,
157
- },
158
- {
159
- x: 200,
160
- y: 160,
161
- },
162
- {
163
- x: 250,
164
- y: 160,
165
- },
166
- ],
167
- },
168
- ],
169
- })
170
-
171
- expect(lfJson2Xml(xmlJson)).toStrictEqual(
172
- '\t\n <nodes id="node_1" type="rect" x="100" y="200" properties="{}" />\t\n <nodes id="node_2" type="circle" x="300" y="160" properties="{}" />\t\n <edges id="ca1dea84-c5e8-4344-b888-8bb09666ac42" type="polyline" sourceNodeId="node_1" targetNodeId="node_2" startPoint="{\'x\':150,\'y\':200}" endPoint="{\'x\':250,\'y\':160}" properties="{}" pointsList="[{\'x\':150,\'y\':200},{\'x\':200,\'y\':200},{\'x\':200,\'y\':160},{\'x\':250,\'y\':160}]" />',
173
- )
174
-
175
- const xml = lfJson2Xml(xmlJson)
176
- expect(lfXml2Json(xml)).toStrictEqual({
177
- nodes: [
178
- {
179
- '-id': 'node_1',
180
- '-type': 'rect',
181
- '-x': 100,
182
- '-y': 200,
183
- '-properties': {},
184
- },
185
- {
186
- '-id': 'node_2',
187
- '-type': 'circle',
188
- '-x': 300,
189
- '-y': 160,
190
- '-properties': {},
191
- },
192
- ],
193
- edges: {
194
- '-id': 'ca1dea84-c5e8-4344-b888-8bb09666ac42',
195
- '-type': 'polyline',
196
- '-sourceNodeId': 'node_1',
197
- '-targetNodeId': 'node_2',
198
- '-startPoint': {
199
- x: 150,
200
- y: 200,
201
- },
202
- '-endPoint': {
203
- x: 250,
204
- y: 160,
205
- },
206
- '-properties': {},
207
- '-pointsList': [
208
- {
209
- x: 150,
210
- y: 200,
211
- },
212
- {
213
- x: 200,
214
- y: 200,
215
- },
216
- {
217
- x: 200,
218
- y: 160,
219
- },
220
- {
221
- x: 250,
222
- y: 160,
223
- },
224
- ],
225
- },
226
- })
227
- })
@@ -1,18 +0,0 @@
1
- import { getCurvedEdgePath } from '../index';
2
- describe('test curved edge ', function () {
3
- test('path calculation', function () {
4
- var radius = 5;
5
- var points1 = '460,150 670,150';
6
- var path1 = 'M460 150 L 670 150';
7
- expect(getCurvedEdgePath(points1.split(' ').map(function (p) { return p.split(',').map(function (a) { return +a; }); }), radius)).toBe(path1);
8
- var points2 = '510,250 540,250 540,175 490,175 490,100 520,100';
9
- var path2 = 'M510 250L 510 250L 535 250 Q 540 250 540 245L 540 245L 540 180 Q 540 175 535 175L 535 175L 495 175 Q 490 175 490 170L 490 170L 490 105 Q 490 100 495 100L 520 100';
10
- expect(getCurvedEdgePath(points2.split(' ').map(function (p) { return p.split(',').map(function (a) { return +a; }); }), radius)).toBe(path2);
11
- var points3 = '690,120 720,120 720,50 560,50 560,260 690,260';
12
- var path3 = 'M690 120L 690 120L 715 120 Q 720 120 720 115L 720 115L 720 55 Q 720 50 715 50L 715 50L 565 50 Q 560 50 560 55L 560 55L 560 255 Q 560 260 565 260L 690 260';
13
- expect(getCurvedEdgePath(points3.split(' ').map(function (p) { return p.split(',').map(function (a) { return +a; }); }), radius)).toBe(path3);
14
- var point4 = '690,180 690,210 660,210 660,190 630,190 630,220';
15
- var path4 = 'M690 180L 690 180L 690 205 Q 690 210 685 210L 685 210L 665 210 Q 660 210 660 205L 660 205L 660 195 Q 660 190 655 190L 655 190L 635 190 Q 630 190 630 195L 630 220';
16
- expect(getCurvedEdgePath(point4.split(' ').map(function (p) { return p.split(',').map(function (a) { return +a; }); }), radius)).toBe(path4);
17
- });
18
- });
package/jest.config.js DELETED
@@ -1,198 +0,0 @@
1
- /* eslint-disable max-len */
2
- /*
3
- * For a detailed explanation regarding each configuration property, visit:
4
- * https://jestjs.io/docs/en/configuration.html
5
- */
6
-
7
- module.exports = {
8
- // All imported modules in your tests should be mocked automatically
9
- // automock: false,
10
-
11
- // Stop running tests after `n` failures
12
- // bail: 0,
13
-
14
- // The directory where Jest should store its cached dependency information
15
- // cacheDirectory: "/private/var/folders/xw/v6yjfmzn2hvglj9fm0cb4xbm0000ks/T/jest_gp",
16
-
17
- // Automatically clear mock calls and instances between every test
18
- // clearMocks: false,
19
-
20
- // Indicates whether the coverage information should be collected while executing the test
21
- // collectCoverage: false,
22
-
23
- // An array of glob patterns indicating a set of files for which coverage information should be collected
24
- // collectCoverageFrom: undefined,
25
-
26
- // The directory where Jest should output its coverage files
27
- coverageDirectory: 'coverage',
28
-
29
- // An array of regexp pattern strings used to skip coverage collection
30
- // coveragePathIgnorePatterns: [
31
- // "/node_modules/"
32
- // ],
33
-
34
- // Indicates which provider should be used to instrument code for coverage
35
- coverageProvider: 'v8',
36
-
37
- // A list of reporter names that Jest uses when writing coverage reports
38
- // coverageReporters: [
39
- // "json",
40
- // "text",
41
- // "lcov",
42
- // "clover"
43
- // ],
44
-
45
- // An object that configures minimum threshold enforcement for coverage results
46
- // coverageThreshold: undefined,
47
-
48
- // A path to a custom dependency extractor
49
- // dependencyExtractor: undefined,
50
-
51
- // Make calling deprecated APIs throw helpful error messages
52
- // errorOnDeprecated: false,
53
-
54
- // Force coverage collection from ignored files using an array of glob patterns
55
- // forceCoverageMatch: [],
56
-
57
- // A path to a module which exports an async function that is triggered once before all test suites
58
- // globalSetup: undefined,
59
-
60
- // A path to a module which exports an async function that is triggered once after all test suites
61
- // globalTeardown: undefined,
62
-
63
- // A set of global variables that need to be available in all test environments
64
- // globals: {},
65
-
66
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
67
- // maxWorkers: "50%",
68
-
69
- // An array of directory names to be searched recursively up from the requiring module's location
70
- // moduleDirectories: [
71
- // "node_modules"
72
- // ],
73
-
74
- // An array of file extensions your modules use
75
- // moduleFileExtensions: [
76
- // "js",
77
- // "json",
78
- // "jsx",
79
- // "ts",
80
- // "tsx",
81
- // "node"
82
- // ],
83
-
84
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
85
- // moduleNameMapper: {},
86
- moduleNameMapper: {
87
- '^lodash-es$': 'lodash',
88
- },
89
-
90
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
91
- // modulePathIgnorePatterns: [],
92
-
93
- // Activates notifications for test results
94
- // notify: false,
95
-
96
- // An enum that specifies notification mode. Requires { notify: true }
97
- // notifyMode: "failure-change",
98
-
99
- // A preset that is used as a base for Jest's configuration
100
- // preset: undefined,
101
-
102
- // Run tests from one or more projects
103
- // projects: undefined,
104
-
105
- // Use this configuration option to add custom reporters to Jest
106
- // reporters: undefined,
107
-
108
- // Automatically reset mock state between every test
109
- // resetMocks: false,
110
-
111
- // Reset the module registry before running each individual test
112
- // resetModules: false,
113
-
114
- // A path to a custom resolver
115
- // resolver: undefined,
116
-
117
- // Automatically restore mock state between every test
118
- // restoreMocks: false,
119
-
120
- // The root directory that Jest should scan for tests and modules within
121
- // rootDir: undefined,
122
-
123
- // A list of paths to directories that Jest should use to search for files in
124
- // roots: [
125
- // "<rootDir>"
126
- // ],
127
-
128
- // Allows you to use a custom runner instead of Jest's default test runner
129
- // runner: "jest-runner",
130
-
131
- // The paths to modules that run some code to configure or set up the testing environment before each test
132
- // setupFiles: [],
133
-
134
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
135
- // setupFilesAfterEnv: [],
136
-
137
- // The number of seconds after which a test is considered as slow and reported as such in the results.
138
- // slowTestThreshold: 5,
139
-
140
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
141
- // snapshotSerializers: [],
142
-
143
- // The test environment that will be used for testing
144
- testEnvironment: 'jest-environment-jsdom',
145
-
146
- // Options that will be passed to the testEnvironment
147
- // testEnvironmentOptions: {},
148
-
149
- // Adds a location field to test results
150
- // testLocationInResults: false,
151
-
152
- // The glob patterns Jest uses to detect test files
153
- // testMatch: [
154
- // "**/__tests__/**/*.[jt]s?(x)",
155
- // "**/?(*.)+(spec|test).[tj]s?(x)"
156
- // ],
157
-
158
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
159
- // testPathIgnorePatterns: [
160
- // "/node_modules/"
161
- // ],
162
-
163
- // The regexp pattern or array of patterns that Jest uses to detect test files
164
- // testRegex: [],
165
-
166
- // This option allows the use of a custom results processor
167
- // testResultsProcessor: undefined,
168
-
169
- // This option allows use of a custom test runner
170
- // testRunner: "jasmine2",
171
-
172
- // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
173
- // testURL: "http://localhost",
174
-
175
- // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
176
- // timers: "real",
177
-
178
- // A map from regular expressions to paths to transformers
179
- // transform: undefined,
180
-
181
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
182
- // transformIgnorePatterns: [
183
- // "/node_modules/",
184
- // "\\.pnp\\.[^\\/]+$"
185
- // ],
186
-
187
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
188
- // unmockedModulePathPatterns: undefined,
189
-
190
- // Indicates whether each individual test should be reported during the run
191
- // verbose: undefined,
192
-
193
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
194
- // watchPathIgnorePatterns: [],
195
-
196
- // Whether to use watchman for file crawling
197
- // watchman: true,
198
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var index_1 = require("../index");
4
- describe('test curved edge ', function () {
5
- test('path calculation', function () {
6
- var radius = 5;
7
- var points1 = '460,150 670,150';
8
- var path1 = 'M460 150 L 670 150';
9
- expect((0, index_1.getCurvedEdgePath)(points1.split(' ').map(function (p) { return p.split(',').map(function (a) { return +a; }); }), radius)).toBe(path1);
10
- var points2 = '510,250 540,250 540,175 490,175 490,100 520,100';
11
- var path2 = 'M510 250L 510 250L 535 250 Q 540 250 540 245L 540 245L 540 180 Q 540 175 535 175L 535 175L 495 175 Q 490 175 490 170L 490 170L 490 105 Q 490 100 495 100L 520 100';
12
- expect((0, index_1.getCurvedEdgePath)(points2.split(' ').map(function (p) { return p.split(',').map(function (a) { return +a; }); }), radius)).toBe(path2);
13
- var points3 = '690,120 720,120 720,50 560,50 560,260 690,260';
14
- var path3 = 'M690 120L 690 120L 715 120 Q 720 120 720 115L 720 115L 720 55 Q 720 50 715 50L 715 50L 565 50 Q 560 50 560 55L 560 55L 560 255 Q 560 260 565 260L 690 260';
15
- expect((0, index_1.getCurvedEdgePath)(points3.split(' ').map(function (p) { return p.split(',').map(function (a) { return +a; }); }), radius)).toBe(path3);
16
- var point4 = '690,180 690,210 660,210 660,190 630,190 630,220';
17
- var path4 = 'M690 180L 690 180L 690 205 Q 690 210 685 210L 685 210L 665 210 Q 660 210 660 205L 660 205L 660 195 Q 660 190 655 190L 655 190L 635 190 Q 630 190 630 195L 630 220';
18
- expect((0, index_1.getCurvedEdgePath)(point4.split(' ').map(function (p) { return p.split(',').map(function (a) { return +a; }); }), radius)).toBe(path4);
19
- });
20
- });
package/rollup.config.js DELETED
@@ -1,52 +0,0 @@
1
- import path from 'node:path'
2
- import postcss from 'rollup-plugin-postcss'
3
- import postcssUrl from 'postcss-url'
4
- import postcssImport from 'postcss-import'
5
- import { rollupConfig } from '../../rollup.config'
6
-
7
- export default [
8
- {
9
- input: 'src/index.less',
10
- output: [
11
- {
12
- file: 'dist/index.css',
13
- },
14
- {
15
- file: 'lib/index.css',
16
- },
17
- {
18
- file: 'lib/style/index.css',
19
- },
20
- {
21
- file: 'es/index.css',
22
- },
23
- {
24
- file: 'es/style/index.css',
25
- },
26
- ],
27
- plugins: [
28
- postcss({
29
- plugins: [
30
- postcssImport({
31
- resolve: (id) => {
32
- if (id.startsWith('~')) {
33
- return path.resolve('node_modules', id.slice(1))
34
- }
35
- return id
36
- },
37
- }),
38
- postcssUrl({
39
- url: 'inline', // 选择 'inline' 选项将外部资源内联到最终的 CSS 文件中
40
- // maxSize: 10, // 以KB为单位的最大文件大小,超过此大小的文件将不会被内联
41
- }),
42
- ],
43
- use: [['less', { javascriptEnabled: true }]],
44
- extract: true,
45
- // extract: 'index.css', // 提取到一个单独的 CSS 文件
46
- // extract: path.resolve('dist/index.css'), // 提取到一个单独的 CSS 文件
47
- minimize: true,
48
- }),
49
- ],
50
- },
51
- rollupConfig(),
52
- ]
@@ -1,22 +0,0 @@
1
- import { h } from '@logicflow/core'
2
-
3
- function Ellipse(props: Record<string, any>): h.JSX.Element {
4
- const { x = 0, y = 0, rx = 4, ry = 4 } = props
5
-
6
- const attrs = {
7
- cx: x,
8
- cy: y,
9
- rx,
10
- ry,
11
- fill: 'transparent',
12
- fillOpacity: 1,
13
- strokeWidth: 1,
14
- stroke: '#000',
15
- strokeOpacity: 1,
16
- ...props,
17
- }
18
-
19
- return <ellipse {...attrs} />
20
- }
21
-
22
- export default Ellipse
@@ -1,24 +0,0 @@
1
- import { h } from '@logicflow/core'
2
-
3
- export default function Polygon({
4
- fillOpacity = 1,
5
- strokeWidth = 1,
6
- strokeOpacity = 1,
7
- fill = 'transparent',
8
- stroke = '#000',
9
- points,
10
- className = 'lf-basic-shape',
11
- }: any): h.JSX.Element {
12
- const attrs = {
13
- fill,
14
- fillOpacity,
15
- strokeWidth,
16
- stroke,
17
- strokeOpacity,
18
- points: '',
19
- className,
20
- }
21
- attrs.points = points.map((point: any) => point.join(',')).join(' ')
22
-
23
- return <polygon {...attrs} />
24
- }
@@ -1,44 +0,0 @@
1
- import LogicFlow from '@logicflow/core'
2
-
3
- import Point = LogicFlow.Point
4
- import RectSize = LogicFlow.RectSize
5
-
6
- type IProps = {
7
- className?: string
8
- radius?: number
9
- stroke?: string
10
- strokeDasharray?: string
11
- } & Point &
12
- RectSize
13
-
14
- export default function Rect(props: IProps) {
15
- const { x, y, width = 10, height = 10, radius, className } = props
16
-
17
- const leftTopX = x - width / 2
18
- const leftTopY = y - height / 2
19
-
20
- const attrs = {
21
- // default
22
- cx: 0,
23
- cy: 0,
24
- rx: radius || 0,
25
- ry: radius || 0,
26
- fill: 'transparent',
27
- fillOpacity: 1,
28
- strokeWidth: '1px',
29
- stroke: '#000',
30
- strokeOpacity: 1,
31
- className: `lf-basic-shape ${className}`,
32
- ...props,
33
- x: leftTopX,
34
- y: leftTopY,
35
- }
36
- return <rect {...attrs} />
37
- }
38
-
39
- Rect.defaultProps = {
40
- radius: 0,
41
- stroke: '',
42
- strokeDasharray: '',
43
- className: '',
44
- }