sequential-workflow-designer 0.26.0 → 0.26.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.
- package/README.md +4 -4
- package/dist/index.umd.js +20 -19
- package/lib/cjs/index.cjs +20 -19
- package/lib/esm/index.js +20 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,10 +104,10 @@ Add the below code to your head section in HTML document.
|
|
|
104
104
|
```html
|
|
105
105
|
<head>
|
|
106
106
|
...
|
|
107
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.26.
|
|
108
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.26.
|
|
109
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.26.
|
|
110
|
-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.26.
|
|
107
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.26.1/css/designer.css" rel="stylesheet">
|
|
108
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.26.1/css/designer-light.css" rel="stylesheet">
|
|
109
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.26.1/css/designer-dark.css" rel="stylesheet">
|
|
110
|
+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.26.1/dist/index.umd.js"></script>
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
Call the designer by:
|
package/dist/index.umd.js
CHANGED
|
@@ -1057,54 +1057,58 @@
|
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
1059
|
|
|
1060
|
+
const EPS = 0.5; // Epsilon, a tiny offset to avoid rendering issues
|
|
1060
1061
|
class JoinView {
|
|
1061
1062
|
static createStraightJoin(parent, start, height) {
|
|
1063
|
+
const dy = Math.sign(height);
|
|
1062
1064
|
const join = Dom.svg('line', {
|
|
1063
1065
|
class: 'sqd-join',
|
|
1064
1066
|
x1: start.x,
|
|
1065
|
-
y1: start.y,
|
|
1067
|
+
y1: start.y - EPS * dy,
|
|
1066
1068
|
x2: start.x,
|
|
1067
|
-
y2: start.y + height
|
|
1069
|
+
y2: start.y + height + EPS * dy
|
|
1068
1070
|
});
|
|
1069
1071
|
parent.insertBefore(join, parent.firstChild);
|
|
1070
1072
|
}
|
|
1071
1073
|
static createJoins(parent, start, targets) {
|
|
1072
1074
|
const firstTarget = targets[0];
|
|
1073
1075
|
const h = Math.abs(firstTarget.y - start.y) / 2; // half height
|
|
1074
|
-
const
|
|
1076
|
+
const dy = Math.sign(firstTarget.y - start.y); // direction y
|
|
1075
1077
|
switch (targets.length) {
|
|
1076
1078
|
case 1:
|
|
1077
1079
|
if (start.x === targets[0].x) {
|
|
1078
|
-
JoinView.createStraightJoin(parent, start, firstTarget.y *
|
|
1080
|
+
JoinView.createStraightJoin(parent, start, firstTarget.y * dy);
|
|
1079
1081
|
}
|
|
1080
1082
|
else {
|
|
1081
|
-
appendCurvedJoins(parent, start, targets, h,
|
|
1083
|
+
appendCurvedJoins(parent, start, targets, h, dy);
|
|
1082
1084
|
}
|
|
1083
1085
|
break;
|
|
1084
1086
|
case 2:
|
|
1085
|
-
appendCurvedJoins(parent, start, targets, h,
|
|
1087
|
+
appendCurvedJoins(parent, start, targets, h, dy);
|
|
1086
1088
|
break;
|
|
1087
1089
|
default:
|
|
1088
1090
|
{
|
|
1089
1091
|
const f = targets[0]; // first
|
|
1090
1092
|
const l = targets[targets.length - 1]; // last
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
+
const eps = EPS * dy;
|
|
1094
|
+
appendJoin(parent, `M ${f.x} ${f.y + eps} l 0 ${-eps} q ${h * 0.3} ${h * -dy * 0.8} ${h} ${h * -dy} ` +
|
|
1095
|
+
`l ${l.x - f.x - h * 2} 0 q ${h * 0.8} ${-h * -dy * 0.3} ${h} ${-h * -dy} l 0 ${eps}`);
|
|
1093
1096
|
for (let i = 1; i < targets.length - 1; i++) {
|
|
1094
|
-
JoinView.createStraightJoin(parent, targets[i], h * -
|
|
1097
|
+
JoinView.createStraightJoin(parent, targets[i], h * -dy);
|
|
1095
1098
|
}
|
|
1096
|
-
JoinView.createStraightJoin(parent, start, h *
|
|
1099
|
+
JoinView.createStraightJoin(parent, start, h * dy);
|
|
1097
1100
|
}
|
|
1098
1101
|
break;
|
|
1099
1102
|
}
|
|
1100
1103
|
}
|
|
1101
1104
|
}
|
|
1102
|
-
function appendCurvedJoins(parent, start, targets, h,
|
|
1105
|
+
function appendCurvedJoins(parent, start, targets, h, dy) {
|
|
1106
|
+
const eps = EPS * dy;
|
|
1103
1107
|
for (const target of targets) {
|
|
1104
|
-
const l = Math.abs(target.x - start.x) - h * 2; // line
|
|
1105
|
-
const
|
|
1106
|
-
appendJoin(parent, `M ${start.x} ${start.y} q ${
|
|
1107
|
-
`l ${
|
|
1108
|
+
const l = Math.abs(target.x - start.x) - h * 2; // straight line length
|
|
1109
|
+
const dx = Math.sign(target.x - start.x); // direction x
|
|
1110
|
+
appendJoin(parent, `M ${start.x} ${start.y - eps} l 0 ${eps} q ${dx * h * 0.3} ${dy * h * 0.8} ${dx * h} ${dy * h} ` +
|
|
1111
|
+
`l ${dx * l} 0 q ${dx * h * 0.7} ${dy * h * 0.2} ${dx * h} ${dy * h} l 0 ${eps}`);
|
|
1108
1112
|
}
|
|
1109
1113
|
}
|
|
1110
1114
|
function appendJoin(parent, d) {
|
|
@@ -3658,10 +3662,7 @@
|
|
|
3658
3662
|
const zoomRealPoint = zoomPoint
|
|
3659
3663
|
.divideByScalar(this.state.lastViewport.scale)
|
|
3660
3664
|
.subtract(this.state.lastViewport.position.divideByScalar(this.state.lastViewport.scale));
|
|
3661
|
-
const position = zoomRealPoint
|
|
3662
|
-
.multiplyByScalar(-scale)
|
|
3663
|
-
.add(zoomPoint)
|
|
3664
|
-
.add(deltaCenterPoint.divideByScalar(this.state.lastViewport.scale));
|
|
3665
|
+
const position = zoomRealPoint.multiplyByScalar(-scale).add(zoomPoint).add(deltaCenterPoint);
|
|
3665
3666
|
const newViewport = {
|
|
3666
3667
|
position,
|
|
3667
3668
|
scale
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -1055,54 +1055,58 @@ class InputView {
|
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
1057
|
|
|
1058
|
+
const EPS = 0.5; // Epsilon, a tiny offset to avoid rendering issues
|
|
1058
1059
|
class JoinView {
|
|
1059
1060
|
static createStraightJoin(parent, start, height) {
|
|
1061
|
+
const dy = Math.sign(height);
|
|
1060
1062
|
const join = Dom.svg('line', {
|
|
1061
1063
|
class: 'sqd-join',
|
|
1062
1064
|
x1: start.x,
|
|
1063
|
-
y1: start.y,
|
|
1065
|
+
y1: start.y - EPS * dy,
|
|
1064
1066
|
x2: start.x,
|
|
1065
|
-
y2: start.y + height
|
|
1067
|
+
y2: start.y + height + EPS * dy
|
|
1066
1068
|
});
|
|
1067
1069
|
parent.insertBefore(join, parent.firstChild);
|
|
1068
1070
|
}
|
|
1069
1071
|
static createJoins(parent, start, targets) {
|
|
1070
1072
|
const firstTarget = targets[0];
|
|
1071
1073
|
const h = Math.abs(firstTarget.y - start.y) / 2; // half height
|
|
1072
|
-
const
|
|
1074
|
+
const dy = Math.sign(firstTarget.y - start.y); // direction y
|
|
1073
1075
|
switch (targets.length) {
|
|
1074
1076
|
case 1:
|
|
1075
1077
|
if (start.x === targets[0].x) {
|
|
1076
|
-
JoinView.createStraightJoin(parent, start, firstTarget.y *
|
|
1078
|
+
JoinView.createStraightJoin(parent, start, firstTarget.y * dy);
|
|
1077
1079
|
}
|
|
1078
1080
|
else {
|
|
1079
|
-
appendCurvedJoins(parent, start, targets, h,
|
|
1081
|
+
appendCurvedJoins(parent, start, targets, h, dy);
|
|
1080
1082
|
}
|
|
1081
1083
|
break;
|
|
1082
1084
|
case 2:
|
|
1083
|
-
appendCurvedJoins(parent, start, targets, h,
|
|
1085
|
+
appendCurvedJoins(parent, start, targets, h, dy);
|
|
1084
1086
|
break;
|
|
1085
1087
|
default:
|
|
1086
1088
|
{
|
|
1087
1089
|
const f = targets[0]; // first
|
|
1088
1090
|
const l = targets[targets.length - 1]; // last
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
+
const eps = EPS * dy;
|
|
1092
|
+
appendJoin(parent, `M ${f.x} ${f.y + eps} l 0 ${-eps} q ${h * 0.3} ${h * -dy * 0.8} ${h} ${h * -dy} ` +
|
|
1093
|
+
`l ${l.x - f.x - h * 2} 0 q ${h * 0.8} ${-h * -dy * 0.3} ${h} ${-h * -dy} l 0 ${eps}`);
|
|
1091
1094
|
for (let i = 1; i < targets.length - 1; i++) {
|
|
1092
|
-
JoinView.createStraightJoin(parent, targets[i], h * -
|
|
1095
|
+
JoinView.createStraightJoin(parent, targets[i], h * -dy);
|
|
1093
1096
|
}
|
|
1094
|
-
JoinView.createStraightJoin(parent, start, h *
|
|
1097
|
+
JoinView.createStraightJoin(parent, start, h * dy);
|
|
1095
1098
|
}
|
|
1096
1099
|
break;
|
|
1097
1100
|
}
|
|
1098
1101
|
}
|
|
1099
1102
|
}
|
|
1100
|
-
function appendCurvedJoins(parent, start, targets, h,
|
|
1103
|
+
function appendCurvedJoins(parent, start, targets, h, dy) {
|
|
1104
|
+
const eps = EPS * dy;
|
|
1101
1105
|
for (const target of targets) {
|
|
1102
|
-
const l = Math.abs(target.x - start.x) - h * 2; // line
|
|
1103
|
-
const
|
|
1104
|
-
appendJoin(parent, `M ${start.x} ${start.y} q ${
|
|
1105
|
-
`l ${
|
|
1106
|
+
const l = Math.abs(target.x - start.x) - h * 2; // straight line length
|
|
1107
|
+
const dx = Math.sign(target.x - start.x); // direction x
|
|
1108
|
+
appendJoin(parent, `M ${start.x} ${start.y - eps} l 0 ${eps} q ${dx * h * 0.3} ${dy * h * 0.8} ${dx * h} ${dy * h} ` +
|
|
1109
|
+
`l ${dx * l} 0 q ${dx * h * 0.7} ${dy * h * 0.2} ${dx * h} ${dy * h} l 0 ${eps}`);
|
|
1106
1110
|
}
|
|
1107
1111
|
}
|
|
1108
1112
|
function appendJoin(parent, d) {
|
|
@@ -3473,10 +3477,7 @@ class PinchToZoomController {
|
|
|
3473
3477
|
const zoomRealPoint = zoomPoint
|
|
3474
3478
|
.divideByScalar(this.state.lastViewport.scale)
|
|
3475
3479
|
.subtract(this.state.lastViewport.position.divideByScalar(this.state.lastViewport.scale));
|
|
3476
|
-
const position = zoomRealPoint
|
|
3477
|
-
.multiplyByScalar(-scale)
|
|
3478
|
-
.add(zoomPoint)
|
|
3479
|
-
.add(deltaCenterPoint.divideByScalar(this.state.lastViewport.scale));
|
|
3480
|
+
const position = zoomRealPoint.multiplyByScalar(-scale).add(zoomPoint).add(deltaCenterPoint);
|
|
3480
3481
|
const newViewport = {
|
|
3481
3482
|
position,
|
|
3482
3483
|
scale
|
package/lib/esm/index.js
CHANGED
|
@@ -1054,54 +1054,58 @@ class InputView {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
1056
|
|
|
1057
|
+
const EPS = 0.5; // Epsilon, a tiny offset to avoid rendering issues
|
|
1057
1058
|
class JoinView {
|
|
1058
1059
|
static createStraightJoin(parent, start, height) {
|
|
1060
|
+
const dy = Math.sign(height);
|
|
1059
1061
|
const join = Dom.svg('line', {
|
|
1060
1062
|
class: 'sqd-join',
|
|
1061
1063
|
x1: start.x,
|
|
1062
|
-
y1: start.y,
|
|
1064
|
+
y1: start.y - EPS * dy,
|
|
1063
1065
|
x2: start.x,
|
|
1064
|
-
y2: start.y + height
|
|
1066
|
+
y2: start.y + height + EPS * dy
|
|
1065
1067
|
});
|
|
1066
1068
|
parent.insertBefore(join, parent.firstChild);
|
|
1067
1069
|
}
|
|
1068
1070
|
static createJoins(parent, start, targets) {
|
|
1069
1071
|
const firstTarget = targets[0];
|
|
1070
1072
|
const h = Math.abs(firstTarget.y - start.y) / 2; // half height
|
|
1071
|
-
const
|
|
1073
|
+
const dy = Math.sign(firstTarget.y - start.y); // direction y
|
|
1072
1074
|
switch (targets.length) {
|
|
1073
1075
|
case 1:
|
|
1074
1076
|
if (start.x === targets[0].x) {
|
|
1075
|
-
JoinView.createStraightJoin(parent, start, firstTarget.y *
|
|
1077
|
+
JoinView.createStraightJoin(parent, start, firstTarget.y * dy);
|
|
1076
1078
|
}
|
|
1077
1079
|
else {
|
|
1078
|
-
appendCurvedJoins(parent, start, targets, h,
|
|
1080
|
+
appendCurvedJoins(parent, start, targets, h, dy);
|
|
1079
1081
|
}
|
|
1080
1082
|
break;
|
|
1081
1083
|
case 2:
|
|
1082
|
-
appendCurvedJoins(parent, start, targets, h,
|
|
1084
|
+
appendCurvedJoins(parent, start, targets, h, dy);
|
|
1083
1085
|
break;
|
|
1084
1086
|
default:
|
|
1085
1087
|
{
|
|
1086
1088
|
const f = targets[0]; // first
|
|
1087
1089
|
const l = targets[targets.length - 1]; // last
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
+
const eps = EPS * dy;
|
|
1091
|
+
appendJoin(parent, `M ${f.x} ${f.y + eps} l 0 ${-eps} q ${h * 0.3} ${h * -dy * 0.8} ${h} ${h * -dy} ` +
|
|
1092
|
+
`l ${l.x - f.x - h * 2} 0 q ${h * 0.8} ${-h * -dy * 0.3} ${h} ${-h * -dy} l 0 ${eps}`);
|
|
1090
1093
|
for (let i = 1; i < targets.length - 1; i++) {
|
|
1091
|
-
JoinView.createStraightJoin(parent, targets[i], h * -
|
|
1094
|
+
JoinView.createStraightJoin(parent, targets[i], h * -dy);
|
|
1092
1095
|
}
|
|
1093
|
-
JoinView.createStraightJoin(parent, start, h *
|
|
1096
|
+
JoinView.createStraightJoin(parent, start, h * dy);
|
|
1094
1097
|
}
|
|
1095
1098
|
break;
|
|
1096
1099
|
}
|
|
1097
1100
|
}
|
|
1098
1101
|
}
|
|
1099
|
-
function appendCurvedJoins(parent, start, targets, h,
|
|
1102
|
+
function appendCurvedJoins(parent, start, targets, h, dy) {
|
|
1103
|
+
const eps = EPS * dy;
|
|
1100
1104
|
for (const target of targets) {
|
|
1101
|
-
const l = Math.abs(target.x - start.x) - h * 2; // line
|
|
1102
|
-
const
|
|
1103
|
-
appendJoin(parent, `M ${start.x} ${start.y} q ${
|
|
1104
|
-
`l ${
|
|
1105
|
+
const l = Math.abs(target.x - start.x) - h * 2; // straight line length
|
|
1106
|
+
const dx = Math.sign(target.x - start.x); // direction x
|
|
1107
|
+
appendJoin(parent, `M ${start.x} ${start.y - eps} l 0 ${eps} q ${dx * h * 0.3} ${dy * h * 0.8} ${dx * h} ${dy * h} ` +
|
|
1108
|
+
`l ${dx * l} 0 q ${dx * h * 0.7} ${dy * h * 0.2} ${dx * h} ${dy * h} l 0 ${eps}`);
|
|
1105
1109
|
}
|
|
1106
1110
|
}
|
|
1107
1111
|
function appendJoin(parent, d) {
|
|
@@ -3472,10 +3476,7 @@ class PinchToZoomController {
|
|
|
3472
3476
|
const zoomRealPoint = zoomPoint
|
|
3473
3477
|
.divideByScalar(this.state.lastViewport.scale)
|
|
3474
3478
|
.subtract(this.state.lastViewport.position.divideByScalar(this.state.lastViewport.scale));
|
|
3475
|
-
const position = zoomRealPoint
|
|
3476
|
-
.multiplyByScalar(-scale)
|
|
3477
|
-
.add(zoomPoint)
|
|
3478
|
-
.add(deltaCenterPoint.divideByScalar(this.state.lastViewport.scale));
|
|
3479
|
+
const position = zoomRealPoint.multiplyByScalar(-scale).add(zoomPoint).add(deltaCenterPoint);
|
|
3479
3480
|
const newViewport = {
|
|
3480
3481
|
position,
|
|
3481
3482
|
scale
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sequential-workflow-designer",
|
|
3
3
|
"description": "Customizable no-code component for building flow-based programming applications.",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|