@logicflow/core 2.0.12 → 2.0.14
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/.turbo/turbo-build$colon$dev.log +2 -2
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +12 -0
- package/__tests__/algorithm/index.test.ts +22 -17
- package/__tests__/algorithm/outline.test.ts +9 -9
- package/__tests__/event/event.test.ts +18 -18
- package/__tests__/history/history.test.ts +23 -23
- package/__tests__/logicflow.test.ts +236 -228
- package/__tests__/model/graphmodel.test.ts +51 -31
- package/__tests__/util/compatible.test.ts +5 -5
- package/__tests__/util/geometry.test.ts +10 -10
- package/__tests__/util/graph.test.ts +12 -12
- package/__tests__/util/matrix.test.ts +26 -26
- package/__tests__/util/node.test.ts +22 -22
- package/__tests__/util/sampling.test.ts +6 -10
- package/__tests__/util/vector.test.ts +36 -36
- package/__tests__/util/zIndex.test.ts +6 -6
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/LogicFlow.d.ts +29 -4
- package/es/LogicFlow.js +35 -6
- package/es/model/GraphModel.d.ts +35 -1
- package/es/model/GraphModel.js +45 -5
- package/es/model/node/RectNodeModel.js +3 -0
- package/es/options.d.ts +1 -0
- package/es/util/theme.d.ts +67 -2
- package/es/util/theme.js +189 -2
- package/es/view/Graph.d.ts +0 -3
- package/es/view/Graph.js +3 -7
- package/es/view/edge/BaseEdge.d.ts +4 -0
- package/es/view/edge/BaseEdge.js +45 -3
- package/es/view/overlay/Grid.js +3 -2
- package/es/view/overlay/ToolOverlay.d.ts +1 -3
- package/es/view/overlay/ToolOverlay.js +2 -39
- package/es/view/shape/Polygon.d.ts +8 -0
- package/es/view/shape/Polygon.js +50 -3
- package/lib/LogicFlow.d.ts +29 -4
- package/lib/LogicFlow.js +34 -5
- package/lib/model/GraphModel.d.ts +35 -1
- package/lib/model/GraphModel.js +43 -3
- package/lib/model/node/RectNodeModel.js +3 -0
- package/lib/options.d.ts +1 -0
- package/lib/util/theme.d.ts +67 -2
- package/lib/util/theme.js +192 -2
- package/lib/view/Graph.d.ts +0 -3
- package/lib/view/Graph.js +2 -6
- package/lib/view/edge/BaseEdge.d.ts +4 -0
- package/lib/view/edge/BaseEdge.js +45 -3
- package/lib/view/overlay/Grid.js +3 -2
- package/lib/view/overlay/ToolOverlay.d.ts +1 -3
- package/lib/view/overlay/ToolOverlay.js +2 -39
- package/lib/view/shape/Polygon.d.ts +8 -0
- package/lib/view/shape/Polygon.js +52 -4
- package/package.json +1 -1
- package/src/LogicFlow.tsx +57 -7
- package/src/model/GraphModel.ts +56 -3
- package/src/model/edge/index.ts +4 -4
- package/src/model/index.ts +7 -7
- package/src/model/node/RectNodeModel.ts +2 -1
- package/src/model/node/index.ts +8 -8
- package/src/options.ts +1 -0
- package/src/util/theme.ts +198 -3
- package/src/view/Graph.tsx +3 -15
- package/src/view/edge/BaseEdge.tsx +96 -12
- package/src/view/overlay/Grid.tsx +2 -1
- package/src/view/overlay/ToolOverlay.tsx +2 -17
- package/src/view/shape/Polygon.tsx +56 -4
- package/stats.html +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
> @logicflow/core@2.0.
|
|
2
|
+
> @logicflow/core@2.0.13 build:dev /Users/didi/Desktop/github/LogicFlow/packages/core
|
|
3
3
|
> rss
|
|
4
4
|
|
|
5
5
|
> [build:dev] pnpm run --if-present build:less && run-p -s build:cjs build:esm
|
|
6
6
|
|
|
7
|
-
> @logicflow/core@2.0.
|
|
7
|
+
> @logicflow/core@2.0.13 build:less /Users/didi/Desktop/github/LogicFlow/packages/core
|
|
8
8
|
> rss
|
|
9
9
|
|
|
10
10
|
> [build:less] ./scripts/build-less
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
> @logicflow/core@2.0.
|
|
2
|
+
> @logicflow/core@2.0.13 prebuild /Users/didi/Desktop/github/LogicFlow/packages/core
|
|
3
3
|
> rss
|
|
4
4
|
|
|
5
5
|
> [prebuild] run-s -s clean:build
|
|
6
6
|
> [clean:build] rimraf dist es lib
|
|
7
7
|
|
|
8
|
-
> @logicflow/core@2.0.
|
|
8
|
+
> @logicflow/core@2.0.13 build /Users/didi/Desktop/github/LogicFlow/packages/core
|
|
9
9
|
> rss
|
|
10
10
|
|
|
11
11
|
> [build] run-p -s build:dev build:umd
|
|
12
|
-
> [build:dev] pnpm run --if-present build:less && run-p -s build:cjs build:esm
|
|
13
12
|
> [build:umd] pnpm run --if-present build:less && rollup -c ../../rollup.config.js --bundleConfigAsCjs
|
|
13
|
+
> [build:dev] pnpm run --if-present build:less && run-p -s build:cjs build:esm
|
|
14
14
|
> [build:less] ./scripts/build-less
|
|
15
15
|
> [build:less] ./scripts/build-less
|
|
16
16
|
[36m
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
| [32m[1mBundle Format:[22m[39m [33mumd[39m |
|
|
21
21
|
| [32m[1mBundle Name:[22m[39m [33mCore[39m |
|
|
22
22
|
| [32m[1mDestination:[22m[39m [33mdist/index.min.js[39m |
|
|
23
|
-
| [32m[1mBundle Size:[22m[39m [
|
|
24
|
-
| [32m[1mMinified Size:[22m[39m [
|
|
25
|
-
| [32m[1mGZipped Size:[22m[39m [
|
|
23
|
+
| [32m[1mBundle Size:[22m[39m [33m388.57 KB[39m |
|
|
24
|
+
| [32m[1mMinified Size:[22m[39m [33m387.34 KB[39m |
|
|
25
|
+
| [32m[1mGZipped Size:[22m[39m [33m112.19 KB[39m |
|
|
26
26
|
| |
|
|
27
27
|
+------------------------------------+
|
|
28
28
|
[1m[33m(!) Circular dependencies[39m[22m
|
|
@@ -30,4 +30,4 @@ src/index.ts -> src/LogicFlow.tsx -> src/index.ts
|
|
|
30
30
|
src/util/index.ts -> src/util/edge.ts -> src/util/index.ts
|
|
31
31
|
src/util/index.ts -> src/util/edge.ts -> src/algorithm/index.ts -> src/algorithm/outline.ts -> src/util/index.ts
|
|
32
32
|
...and 19 more
|
|
33
|
-
[32mcreated [1mdist/index.min.js[22m in [
|
|
33
|
+
[32mcreated [1mdist/index.min.js[22m in [1m20.9s[22m[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getVerticalPointOfLine } from '../../src/algorithm'
|
|
1
|
+
import { getVerticalPointOfLine } from '../../src/algorithm'
|
|
2
2
|
|
|
3
3
|
describe('algorithm/index', () => {
|
|
4
4
|
test('getVerticalPointOfLine', () => {
|
|
@@ -14,7 +14,8 @@ describe('algorithm/index', () => {
|
|
|
14
14
|
offset: 3,
|
|
15
15
|
verticalLength: 3,
|
|
16
16
|
type: 'start',
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
|
+
|
|
18
19
|
const config2 = {
|
|
19
20
|
start: {
|
|
20
21
|
x: 0,
|
|
@@ -27,7 +28,9 @@ describe('algorithm/index', () => {
|
|
|
27
28
|
offset: 3,
|
|
28
29
|
verticalLength: 3,
|
|
29
30
|
type: 'end',
|
|
30
|
-
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
34
|
const config3 = {
|
|
32
35
|
start: {
|
|
33
36
|
x: 10,
|
|
@@ -40,7 +43,9 @@ describe('algorithm/index', () => {
|
|
|
40
43
|
offset: 3,
|
|
41
44
|
verticalLength: 3,
|
|
42
45
|
type: 'start',
|
|
43
|
-
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
49
|
const config4 = {
|
|
45
50
|
start: {
|
|
46
51
|
x: 10,
|
|
@@ -53,17 +58,17 @@ describe('algorithm/index', () => {
|
|
|
53
58
|
offset: 3,
|
|
54
59
|
verticalLength: 3,
|
|
55
60
|
type: 'end',
|
|
56
|
-
}
|
|
57
|
-
const res1 = getVerticalPointOfLine(config1)
|
|
58
|
-
expect(Math.abs(res1.leftX) - 5 < Number.EPSILON).toBeTruthy()
|
|
59
|
-
expect(Math.abs(res1.leftY) - 3 < Number.EPSILON).toBeTruthy()
|
|
60
|
-
expect(Math.abs(res1.rightX) - 5 < Number.EPSILON).toBeTruthy()
|
|
61
|
-
expect(Math.abs(res1.rightY) - 3 < Number.EPSILON).toBeTruthy()
|
|
61
|
+
}
|
|
62
|
+
const res1 = getVerticalPointOfLine(config1)
|
|
63
|
+
expect(Math.abs(res1.leftX) - 5 < Number.EPSILON).toBeTruthy()
|
|
64
|
+
expect(Math.abs(res1.leftY) - 3 < Number.EPSILON).toBeTruthy()
|
|
65
|
+
expect(Math.abs(res1.rightX) - 5 < Number.EPSILON).toBeTruthy()
|
|
66
|
+
expect(Math.abs(res1.rightY) - 3 < Number.EPSILON).toBeTruthy()
|
|
62
67
|
|
|
63
|
-
const res2 = getVerticalPointOfLine(config2)
|
|
64
|
-
expect(Math.abs(res2.leftX) - 7 < Number.EPSILON).toBeTruthy()
|
|
65
|
-
expect(Math.abs(res2.leftY) - 3 < Number.EPSILON).toBeTruthy()
|
|
66
|
-
expect(Math.abs(res2.rightX) - 7 < Number.EPSILON).toBeTruthy()
|
|
67
|
-
expect(Math.abs(res2.rightY) - 3 < Number.EPSILON).toBeTruthy()
|
|
68
|
-
})
|
|
69
|
-
})
|
|
68
|
+
const res2 = getVerticalPointOfLine(config2)
|
|
69
|
+
expect(Math.abs(res2.leftX) - 7 < Number.EPSILON).toBeTruthy()
|
|
70
|
+
expect(Math.abs(res2.leftY) - 3 < Number.EPSILON).toBeTruthy()
|
|
71
|
+
expect(Math.abs(res2.rightX) - 7 < Number.EPSILON).toBeTruthy()
|
|
72
|
+
expect(Math.abs(res2.rightY) - 3 < Number.EPSILON).toBeTruthy()
|
|
73
|
+
})
|
|
74
|
+
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getEdgeOutline } from '../../src/algorithm/outline'
|
|
1
|
+
import { getEdgeOutline } from '../../src/algorithm/outline'
|
|
2
2
|
|
|
3
3
|
describe('algorithm/outline', () => {
|
|
4
4
|
test('get edge outline', () => {
|
|
@@ -12,32 +12,32 @@ describe('algorithm/outline', () => {
|
|
|
12
12
|
x: 10,
|
|
13
13
|
y: 10,
|
|
14
14
|
},
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
expect(getEdgeOutline(edge1)).toEqual({
|
|
17
17
|
x: -5,
|
|
18
18
|
y: -5,
|
|
19
19
|
x1: 15,
|
|
20
20
|
y1: 15,
|
|
21
|
-
})
|
|
21
|
+
})
|
|
22
22
|
const edge2 = {
|
|
23
23
|
modelType: 'polyline-edge',
|
|
24
24
|
points: '0,0 10,10',
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
expect(getEdgeOutline(edge2)).toEqual({
|
|
27
27
|
x: -4,
|
|
28
28
|
y: -4,
|
|
29
29
|
x1: 14,
|
|
30
30
|
y1: 14,
|
|
31
|
-
})
|
|
31
|
+
})
|
|
32
32
|
const edge3 = {
|
|
33
33
|
modelType: 'bezier-edge',
|
|
34
34
|
path: 'M 270 195C 370 195,305 290,405 290',
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
expect(getEdgeOutline(edge3)).toEqual({
|
|
37
37
|
x: 266,
|
|
38
38
|
y: 191,
|
|
39
39
|
x1: 409,
|
|
40
40
|
y1: 294,
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
})
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import EventEmitter from '../../src/event/eventEmitter'
|
|
1
|
+
import EventEmitter from '../../src/event/eventEmitter'
|
|
2
2
|
|
|
3
3
|
describe('event/eventEmitter', () => {
|
|
4
|
-
const em = new EventEmitter()
|
|
4
|
+
const em = new EventEmitter()
|
|
5
5
|
test('event emitter', () => {
|
|
6
|
-
const fn = jest.fn()
|
|
7
|
-
em.on('test', fn)
|
|
8
|
-
em.emit('test', { a: 1 })
|
|
9
|
-
expect(fn).toBeCalledWith({ a: 1 })
|
|
10
|
-
em.off('test', fn)
|
|
11
|
-
em.emit('test', { a: 1 })
|
|
12
|
-
expect(fn).toBeCalledTimes(1)
|
|
6
|
+
const fn = jest.fn()
|
|
7
|
+
em.on('test', fn)
|
|
8
|
+
em.emit('test', { a: 1 })
|
|
9
|
+
expect(fn).toBeCalledWith({ a: 1 })
|
|
10
|
+
em.off('test', fn)
|
|
11
|
+
em.emit('test', { a: 1 })
|
|
12
|
+
expect(fn).toBeCalledTimes(1)
|
|
13
13
|
|
|
14
|
-
em.once('test1', fn)
|
|
15
|
-
em.emit('test1', { a: 1 })
|
|
16
|
-
expect(fn).toBeCalledTimes(2)
|
|
17
|
-
em.once('test1', fn)
|
|
18
|
-
em.emit('test1', { a: 1 })
|
|
19
|
-
const test1Events = em.getEvents().test1
|
|
20
|
-
expect(test1Events).toBeUndefined()
|
|
21
|
-
})
|
|
22
|
-
})
|
|
14
|
+
em.once('test1', fn)
|
|
15
|
+
em.emit('test1', { a: 1 })
|
|
16
|
+
expect(fn).toBeCalledTimes(2)
|
|
17
|
+
em.once('test1', fn)
|
|
18
|
+
em.emit('test1', { a: 1 })
|
|
19
|
+
const test1Events = em.getEvents().test1
|
|
20
|
+
expect(test1Events).toBeUndefined()
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import History from '../../src/history/History'
|
|
2
|
-
import EventEmitter from '../../src/event/eventEmitter'
|
|
1
|
+
import History from '../../src/history/History'
|
|
2
|
+
import EventEmitter from '../../src/event/eventEmitter'
|
|
3
3
|
|
|
4
4
|
describe('history', () => {
|
|
5
|
-
const event = new EventEmitter()
|
|
6
|
-
const history = new History(event)
|
|
7
|
-
expect(history).toBeDefined()
|
|
5
|
+
const event = new EventEmitter()
|
|
6
|
+
const history = new History(event)
|
|
7
|
+
expect(history).toBeDefined()
|
|
8
8
|
test('add', () => {
|
|
9
|
-
history.add(1)
|
|
10
|
-
expect(history.undos).toEqual([1])
|
|
11
|
-
expect(history.redos).toEqual([])
|
|
12
|
-
})
|
|
9
|
+
history.add(1)
|
|
10
|
+
expect(history.undos).toEqual([1])
|
|
11
|
+
expect(history.redos).toEqual([])
|
|
12
|
+
})
|
|
13
13
|
test('undo', () => {
|
|
14
|
-
history.add(1)
|
|
15
|
-
history.add(2)
|
|
16
|
-
history.undo()
|
|
17
|
-
expect(history.undos).toEqual([])
|
|
18
|
-
expect(history.redos).toEqual([2])
|
|
19
|
-
})
|
|
14
|
+
history.add(1)
|
|
15
|
+
history.add(2)
|
|
16
|
+
history.undo()
|
|
17
|
+
expect(history.undos).toEqual([])
|
|
18
|
+
expect(history.redos).toEqual([2])
|
|
19
|
+
})
|
|
20
20
|
test('redo', () => {
|
|
21
|
-
history.add(1)
|
|
22
|
-
history.add(2)
|
|
23
|
-
history.undo()
|
|
24
|
-
history.redo()
|
|
25
|
-
expect(history.undos).toEqual([])
|
|
26
|
-
expect(history.redos).toEqual([])
|
|
27
|
-
})
|
|
28
|
-
})
|
|
21
|
+
history.add(1)
|
|
22
|
+
history.add(2)
|
|
23
|
+
history.undo()
|
|
24
|
+
history.redo()
|
|
25
|
+
expect(history.undos).toEqual([])
|
|
26
|
+
expect(history.redos).toEqual([])
|
|
27
|
+
})
|
|
28
|
+
})
|