@lincle/react-web-base 0.0.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/COPYING.LESSER.md +157 -0
- package/COPYING.md +675 -0
- package/README.md +225 -0
- package/dist/Edge/index.d.ts +4 -0
- package/dist/Edge/index.js +40 -0
- package/dist/Edges/index.d.ts +8 -0
- package/dist/Edges/index.js +19 -0
- package/dist/Graph/index.d.ts +4 -0
- package/dist/Graph/index.js +22 -0
- package/dist/GraphContexts/index.d.ts +4 -0
- package/dist/GraphContexts/index.js +46 -0
- package/dist/Grid/index.d.ts +4 -0
- package/dist/Grid/index.js +40 -0
- package/dist/Node/index.d.ts +4 -0
- package/dist/Node/index.js +125 -0
- package/dist/Nodes/index.d.ts +4 -0
- package/dist/Nodes/index.js +7 -0
- package/dist/Path/generateOrigins.d.ts +5 -0
- package/dist/Path/generateOrigins.js +18 -0
- package/dist/Path/index.d.ts +4 -0
- package/dist/Path/index.js +44 -0
- package/dist/Path/lines/generateCurve.d.ts +17 -0
- package/dist/Path/lines/generateCurve.js +50 -0
- package/dist/Path/lines/generateDirect.d.ts +16 -0
- package/dist/Path/lines/generateDirect.js +32 -0
- package/dist/Path/lines/generatePoints.d.ts +15 -0
- package/dist/Path/lines/generatePoints.js +111 -0
- package/dist/Path/lines/generateStep.d.ts +17 -0
- package/dist/Path/lines/generateStep.js +63 -0
- package/dist/Path/lines/index.d.ts +4 -0
- package/dist/Path/lines/index.js +12 -0
- package/dist/Path/lines/types.d.ts +34 -0
- package/dist/Path/lines/types.js +2 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.js +30 -0
- package/dist/styles.g.css +99 -0
- package/package.json +96 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Coordinates, type Line } from './types';
|
|
2
|
+
export declare const curveHorizontal: (rx1: number, ry1: number, rx2: number, ry2: number, center?: boolean) => Line;
|
|
3
|
+
export declare const curveVertical: (rx1: number, ry1: number, rx2: number, ry2: number, center?: boolean) => Line;
|
|
4
|
+
declare const _default: (source: {
|
|
5
|
+
height: number;
|
|
6
|
+
shape: 'oval' | 'rectangle';
|
|
7
|
+
width: number;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}, target: {
|
|
11
|
+
height: number;
|
|
12
|
+
shape: 'oval' | 'rectangle';
|
|
13
|
+
width: number;
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}, center?: boolean) => Coordinates;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.curveVertical = exports.curveHorizontal = void 0;
|
|
7
|
+
const generatePoints_1 = __importDefault(require("./generatePoints"));
|
|
8
|
+
const bezier_js_1 = require("bezier-js");
|
|
9
|
+
const curveHorizontal = (rx1, ry1, rx2, ry2, center) => {
|
|
10
|
+
const x1 = Math.round(rx1);
|
|
11
|
+
const y1 = Math.round(ry1);
|
|
12
|
+
const x2 = Math.round(rx2);
|
|
13
|
+
const y2 = Math.round(ry2);
|
|
14
|
+
const d = [];
|
|
15
|
+
const mx = Math.round(x1 + (x2 - x1) / 2);
|
|
16
|
+
const c = center ?
|
|
17
|
+
new bezier_js_1.Bezier(x1, y1, mx, y1, mx, y2, x2, y2).compute(0.5) :
|
|
18
|
+
undefined;
|
|
19
|
+
d.push('M', x1, y1);
|
|
20
|
+
d.push('C', mx, y1, mx, y2, x2, y2);
|
|
21
|
+
return {
|
|
22
|
+
center: c,
|
|
23
|
+
path: d.join(' ')
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.curveHorizontal = curveHorizontal;
|
|
27
|
+
const curveVertical = (rx1, ry1, rx2, ry2, center) => {
|
|
28
|
+
const x1 = Math.round(rx1);
|
|
29
|
+
const y1 = Math.round(ry1);
|
|
30
|
+
const x2 = Math.round(rx2);
|
|
31
|
+
const y2 = Math.round(ry2);
|
|
32
|
+
const d = [];
|
|
33
|
+
const my = Math.round(y1 + (y2 - y1) / 2);
|
|
34
|
+
const c = center ?
|
|
35
|
+
new bezier_js_1.Bezier(x1, y1, x1, my, x2, my, x2, y2).compute(0.5) :
|
|
36
|
+
undefined;
|
|
37
|
+
d.push('M', x1, y1);
|
|
38
|
+
d.push('C', x1, my, x2, my, x2, y2);
|
|
39
|
+
return {
|
|
40
|
+
center: c,
|
|
41
|
+
path: d.join(' ')
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.curveVertical = curveVertical;
|
|
45
|
+
exports.default = (source, target, center) => {
|
|
46
|
+
const { orientation, source: sourcePoints, target: targetPoints } = (0, generatePoints_1.default)(source, target);
|
|
47
|
+
return Object.assign(Object.assign({}, (orientation === 'horizontal' ?
|
|
48
|
+
(0, exports.curveHorizontal)(sourcePoints.x, sourcePoints.y, targetPoints.x, targetPoints.y, center) :
|
|
49
|
+
(0, exports.curveVertical)(sourcePoints.x, sourcePoints.y, targetPoints.x, targetPoints.y, center))), { source: sourcePoints, target: targetPoints });
|
|
50
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Coordinates, type Line } from './types';
|
|
2
|
+
export declare const direct: (rx1: number, ry1: number, rx2: number, ry2: number, center?: boolean) => Line;
|
|
3
|
+
declare const _default: (source: {
|
|
4
|
+
height: number;
|
|
5
|
+
shape: 'oval' | 'rectangle';
|
|
6
|
+
width: number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}, target: {
|
|
10
|
+
height: number;
|
|
11
|
+
shape: 'oval' | 'rectangle';
|
|
12
|
+
width: number;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
}, center?: boolean) => Coordinates;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.direct = void 0;
|
|
7
|
+
const generatePoints_1 = __importDefault(require("./generatePoints"));
|
|
8
|
+
const direct = (rx1, ry1, rx2, ry2, center) => {
|
|
9
|
+
const x1 = Math.round(rx1);
|
|
10
|
+
const y1 = Math.round(ry1);
|
|
11
|
+
const x2 = Math.round(rx2);
|
|
12
|
+
const y2 = Math.round(ry2);
|
|
13
|
+
const cx = Math.round((x2 + x1) / 2);
|
|
14
|
+
const cy = Math.round((y2 + y1) / 2);
|
|
15
|
+
const d = [];
|
|
16
|
+
d.push('M', x1, y1);
|
|
17
|
+
d.push('L', x2, y2);
|
|
18
|
+
return {
|
|
19
|
+
center: center ?
|
|
20
|
+
{
|
|
21
|
+
x: cx,
|
|
22
|
+
y: cy
|
|
23
|
+
} :
|
|
24
|
+
undefined,
|
|
25
|
+
path: d.join(' ')
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.direct = direct;
|
|
29
|
+
exports.default = (source, target, center) => {
|
|
30
|
+
const { source: sourcePoints, target: targetPoints } = (0, generatePoints_1.default)(source, target);
|
|
31
|
+
return Object.assign(Object.assign({}, (0, exports.direct)(sourcePoints.x, sourcePoints.y, targetPoints.x, targetPoints.y, center)), { source: sourcePoints, target: targetPoints });
|
|
32
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Points } from './types';
|
|
2
|
+
declare const _default: (source: {
|
|
3
|
+
height: number;
|
|
4
|
+
shape: 'oval' | 'rectangle';
|
|
5
|
+
width: number;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}, target: {
|
|
9
|
+
height: number;
|
|
10
|
+
shape: 'oval' | 'rectangle';
|
|
11
|
+
width: number;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}) => Points;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = (source, target) => {
|
|
4
|
+
const sx = Math.round(source.x);
|
|
5
|
+
const sy = Math.round(source.y);
|
|
6
|
+
const tx = Math.round(target.x);
|
|
7
|
+
const ty = Math.round(target.y);
|
|
8
|
+
const halfTargetWidth = Math.round(target.width / 2);
|
|
9
|
+
const halfTargetHeight = Math.round(target.height / 2);
|
|
10
|
+
const halfSourceWidth = Math.round(source.width / 2);
|
|
11
|
+
const halfSourceHeight = Math.round(source.height / 2);
|
|
12
|
+
const sourceAngle = Math.atan2(tx + halfTargetWidth - (sx + halfSourceWidth), ty + halfTargetHeight - (sy + halfSourceHeight));
|
|
13
|
+
const targetAngle = Math.atan2(sx + halfSourceWidth - (tx + halfTargetWidth), sy + halfSourceHeight - (ty + halfTargetHeight));
|
|
14
|
+
const sourceEdgeX = Math.sin(sourceAngle) * halfSourceWidth + halfSourceWidth;
|
|
15
|
+
const sourceEdgeY = Math.cos(sourceAngle) * halfSourceHeight + halfSourceHeight;
|
|
16
|
+
const targetEdgeX = Math.sin(targetAngle) * halfTargetWidth + halfTargetWidth;
|
|
17
|
+
const targetEdgeY = Math.cos(targetAngle) * halfTargetHeight + halfTargetHeight;
|
|
18
|
+
const sourceDX = sx + sourceEdgeX - tx - targetEdgeX;
|
|
19
|
+
const sourceDY = sy + sourceEdgeY - ty - targetEdgeY;
|
|
20
|
+
const sourceROR = sourceDX / sourceDY;
|
|
21
|
+
let orientation;
|
|
22
|
+
let targetPoints = {
|
|
23
|
+
x: sourceEdgeX,
|
|
24
|
+
y: sourceEdgeY
|
|
25
|
+
};
|
|
26
|
+
if (sourceROR < 1 && sourceROR > -1) {
|
|
27
|
+
orientation = 'vertical';
|
|
28
|
+
if (sourceDY > 0) {
|
|
29
|
+
targetPoints = {
|
|
30
|
+
x: sx + sourceEdgeX,
|
|
31
|
+
y: sy + (source.shape === 'oval' ?
|
|
32
|
+
sourceEdgeY :
|
|
33
|
+
0)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
targetPoints = {
|
|
38
|
+
x: sx + sourceEdgeX,
|
|
39
|
+
y: sy + (source.shape === 'oval' ?
|
|
40
|
+
sourceEdgeY :
|
|
41
|
+
source.height)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
orientation = 'horizontal';
|
|
47
|
+
if (sourceDX > 0) {
|
|
48
|
+
targetPoints = {
|
|
49
|
+
x: sx + (source.shape === 'oval' ?
|
|
50
|
+
sourceEdgeX :
|
|
51
|
+
0),
|
|
52
|
+
y: sy + sourceEdgeY
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
targetPoints = {
|
|
57
|
+
x: sx + (source.shape === 'oval' ?
|
|
58
|
+
sourceEdgeX :
|
|
59
|
+
source.width),
|
|
60
|
+
y: sy + sourceEdgeY
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const targetDX = tx - targetEdgeX - sx - sourceEdgeX;
|
|
65
|
+
const targetDY = ty - targetEdgeY - sy - sourceEdgeY;
|
|
66
|
+
let sourcePoints = {
|
|
67
|
+
x: targetEdgeX,
|
|
68
|
+
y: targetEdgeY
|
|
69
|
+
};
|
|
70
|
+
if (orientation === 'vertical') {
|
|
71
|
+
if (targetDY > 0) {
|
|
72
|
+
sourcePoints = {
|
|
73
|
+
x: tx + targetEdgeX,
|
|
74
|
+
y: ty + (target.shape === 'oval' ?
|
|
75
|
+
targetEdgeY :
|
|
76
|
+
0)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
sourcePoints = {
|
|
81
|
+
x: tx + targetEdgeX,
|
|
82
|
+
y: ty + (target.shape === 'oval' ?
|
|
83
|
+
targetEdgeY :
|
|
84
|
+
target.height)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
if (targetDX > 0) {
|
|
90
|
+
sourcePoints = {
|
|
91
|
+
x: tx + (target.shape === 'oval' ?
|
|
92
|
+
targetEdgeX :
|
|
93
|
+
0),
|
|
94
|
+
y: ty + targetEdgeY
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
sourcePoints = {
|
|
99
|
+
x: tx + (target.shape === 'oval' ?
|
|
100
|
+
targetEdgeX :
|
|
101
|
+
target.width),
|
|
102
|
+
y: ty + targetEdgeY
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
orientation,
|
|
108
|
+
source: sourcePoints,
|
|
109
|
+
target: targetPoints
|
|
110
|
+
};
|
|
111
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Coordinates, type Line } from './types';
|
|
2
|
+
export declare const stepHorizontal: (rx1: number, ry1: number, rx2: number, ry2: number, center?: boolean) => Line;
|
|
3
|
+
export declare const stepVertical: (rx1: number, ry1: number, rx2: number, ry2: number, center?: boolean) => Line;
|
|
4
|
+
declare const _default: (source: {
|
|
5
|
+
height: number;
|
|
6
|
+
shape: 'oval' | 'rectangle';
|
|
7
|
+
width: number;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}, target: {
|
|
11
|
+
height: number;
|
|
12
|
+
shape: 'oval' | 'rectangle';
|
|
13
|
+
width: number;
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}, center?: boolean) => Coordinates;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.stepVertical = exports.stepHorizontal = void 0;
|
|
7
|
+
const generatePoints_1 = __importDefault(require("./generatePoints"));
|
|
8
|
+
const stepHorizontal = (rx1, ry1, rx2, ry2, center) => {
|
|
9
|
+
const x1 = Math.round(rx1);
|
|
10
|
+
const y1 = Math.round(ry1);
|
|
11
|
+
const x2 = Math.round(rx2);
|
|
12
|
+
const y2 = Math.round(ry2);
|
|
13
|
+
const d = [];
|
|
14
|
+
const mx = Math.round(x1 + (x2 - x1) / 2);
|
|
15
|
+
const my = Math.round(y1 + (y2 - y1) / 2);
|
|
16
|
+
const cx = Math.round((x2 + x1) / 2);
|
|
17
|
+
const cy = my;
|
|
18
|
+
d.push('M', x1, y1);
|
|
19
|
+
d.push('L', mx, y1);
|
|
20
|
+
d.push('L', mx, y2);
|
|
21
|
+
d.push('L', x2, y2);
|
|
22
|
+
return {
|
|
23
|
+
center: center ?
|
|
24
|
+
{
|
|
25
|
+
x: cx,
|
|
26
|
+
y: cy
|
|
27
|
+
} :
|
|
28
|
+
undefined,
|
|
29
|
+
path: d.join(' ')
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.stepHorizontal = stepHorizontal;
|
|
33
|
+
const stepVertical = (rx1, ry1, rx2, ry2, center) => {
|
|
34
|
+
const x1 = Math.round(rx1);
|
|
35
|
+
const y1 = Math.round(ry1);
|
|
36
|
+
const x2 = Math.round(rx2);
|
|
37
|
+
const y2 = Math.round(ry2);
|
|
38
|
+
const d = [];
|
|
39
|
+
const mx = Math.round(x1 + (x2 - x1) / 2);
|
|
40
|
+
const my = Math.round(y1 + (y2 - y1) / 2);
|
|
41
|
+
const cx = mx;
|
|
42
|
+
const cy = Math.round((y2 + y1) / 2);
|
|
43
|
+
d.push('M', x1, y1);
|
|
44
|
+
d.push('L', x1, my);
|
|
45
|
+
d.push('L', x2, my);
|
|
46
|
+
d.push('L', x2, y2);
|
|
47
|
+
return {
|
|
48
|
+
center: center ?
|
|
49
|
+
{
|
|
50
|
+
x: cx,
|
|
51
|
+
y: cy
|
|
52
|
+
} :
|
|
53
|
+
undefined,
|
|
54
|
+
path: d.join(' ')
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
exports.stepVertical = stepVertical;
|
|
58
|
+
exports.default = (source, target, center) => {
|
|
59
|
+
const { orientation, source: sourcePoints, target: targetPoints } = (0, generatePoints_1.default)(source, target);
|
|
60
|
+
return Object.assign(Object.assign({}, (orientation === 'horizontal' ?
|
|
61
|
+
(0, exports.stepHorizontal)(sourcePoints.x, sourcePoints.y, targetPoints.x, targetPoints.y, center) :
|
|
62
|
+
(0, exports.stepVertical)(sourcePoints.x, sourcePoints.y, targetPoints.x, targetPoints.y, center))), { source: sourcePoints, target: targetPoints });
|
|
63
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateStep = exports.generateDirect = exports.generateCurve = void 0;
|
|
7
|
+
var generateCurve_1 = require("./generateCurve");
|
|
8
|
+
Object.defineProperty(exports, "generateCurve", { enumerable: true, get: function () { return __importDefault(generateCurve_1).default; } });
|
|
9
|
+
var generateDirect_1 = require("./generateDirect");
|
|
10
|
+
Object.defineProperty(exports, "generateDirect", { enumerable: true, get: function () { return __importDefault(generateDirect_1).default; } });
|
|
11
|
+
var generateStep_1 = require("./generateStep");
|
|
12
|
+
Object.defineProperty(exports, "generateStep", { enumerable: true, get: function () { return __importDefault(generateStep_1).default; } });
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type Line = {
|
|
2
|
+
center?: {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
path: string;
|
|
7
|
+
};
|
|
8
|
+
export type Orientation = 'horizontal' | 'vertical';
|
|
9
|
+
export type Points = {
|
|
10
|
+
orientation: Orientation;
|
|
11
|
+
source: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
target: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type Coordinates = {
|
|
21
|
+
center?: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
path: string;
|
|
26
|
+
source: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
target: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type EdgeNodeProps } from '@lincle/react-shared';
|
|
2
|
+
import { type CSSProperties, type FunctionComponent, type ReactElement, type ReactNode } from 'react';
|
|
3
|
+
declare const Edge: FunctionComponent<EdgeProps>;
|
|
4
|
+
declare const Edges: FunctionComponent<EdgesProps>;
|
|
5
|
+
declare const Graph: FunctionComponent<GraphProps>;
|
|
6
|
+
declare const GraphContexts: FunctionComponent<GraphContextsProps>;
|
|
7
|
+
declare const Grid: FunctionComponent<GridProps>;
|
|
8
|
+
declare const Node: FunctionComponent<NodeProps>;
|
|
9
|
+
declare const Nodes: FunctionComponent<NodesProps>;
|
|
10
|
+
declare const Path: FunctionComponent<PathProps>;
|
|
11
|
+
export type Line = 'curve' | 'direct' | 'step';
|
|
12
|
+
export type Shape = 'oval' | 'rectangle';
|
|
13
|
+
export type EdgeProps = {
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
dash?: Boolean;
|
|
17
|
+
id: number | string;
|
|
18
|
+
line?: Line;
|
|
19
|
+
markerEnd?: string;
|
|
20
|
+
markerStart?: string;
|
|
21
|
+
path?: (source?: EdgeNodeProps, target?: EdgeNodeProps, children?: ReactNode) => ReactElement;
|
|
22
|
+
sourceId: number | string;
|
|
23
|
+
targetId: number | string;
|
|
24
|
+
};
|
|
25
|
+
export type EdgesProps = {
|
|
26
|
+
children: Array<ReactElement<EdgeProps>> | ReactElement<EdgeProps>;
|
|
27
|
+
dash?: Boolean;
|
|
28
|
+
};
|
|
29
|
+
export type PathProps = {
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
className?: string;
|
|
32
|
+
diagramId?: number | string;
|
|
33
|
+
id: number | string;
|
|
34
|
+
line?: Line;
|
|
35
|
+
markerEnd?: string;
|
|
36
|
+
markerStart?: string;
|
|
37
|
+
source?: EdgeNodeProps;
|
|
38
|
+
target?: EdgeNodeProps;
|
|
39
|
+
};
|
|
40
|
+
export type NodeProps = {
|
|
41
|
+
children?: ReactElement | ReactElement[];
|
|
42
|
+
className?: string;
|
|
43
|
+
height?: number;
|
|
44
|
+
id: number | string;
|
|
45
|
+
ref?: React.MutableRefObject<HTMLDivElement | null> | ((instance: HTMLDivElement | null) => void) | null;
|
|
46
|
+
shape?: Shape;
|
|
47
|
+
style?: CSSProperties;
|
|
48
|
+
width?: number;
|
|
49
|
+
x?: number;
|
|
50
|
+
y?: number;
|
|
51
|
+
};
|
|
52
|
+
export type NodesProps = {
|
|
53
|
+
children: Array<ReactElement<NodeProps>> | ReactElement<NodeProps>;
|
|
54
|
+
};
|
|
55
|
+
export type GridType = [
|
|
56
|
+
number,
|
|
57
|
+
number
|
|
58
|
+
];
|
|
59
|
+
export type GridContextProps = GridType;
|
|
60
|
+
export type GridProps = {
|
|
61
|
+
children?: ReactNode;
|
|
62
|
+
scale?: number;
|
|
63
|
+
xOffset?: number;
|
|
64
|
+
yOffset?: number;
|
|
65
|
+
};
|
|
66
|
+
export type GraphProps = {
|
|
67
|
+
children?: ReactNode | ReactNode[];
|
|
68
|
+
edgeFrequency?: number;
|
|
69
|
+
grid?: GridType | false;
|
|
70
|
+
id: number | string;
|
|
71
|
+
line?: Line;
|
|
72
|
+
nodeFrequency?: number;
|
|
73
|
+
nodeHeight?: number;
|
|
74
|
+
nodeWidth?: number;
|
|
75
|
+
shape?: Shape;
|
|
76
|
+
};
|
|
77
|
+
export type Dimensions = {
|
|
78
|
+
height: number;
|
|
79
|
+
id: number | string;
|
|
80
|
+
shape: Shape;
|
|
81
|
+
width: number;
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
};
|
|
85
|
+
export type Size = {
|
|
86
|
+
bottom: number;
|
|
87
|
+
height: number;
|
|
88
|
+
left: number;
|
|
89
|
+
right: number;
|
|
90
|
+
top: number;
|
|
91
|
+
width: number;
|
|
92
|
+
};
|
|
93
|
+
export type NodesDimensions = {
|
|
94
|
+
[key: string]: Dimensions;
|
|
95
|
+
};
|
|
96
|
+
export type GraphContextsProps = Omit<GraphProps, 'children'> & {
|
|
97
|
+
children: ReactElement<GraphProps> | ReactNode | ReactNode[];
|
|
98
|
+
};
|
|
99
|
+
export { Edge, Edges, Graph, GraphContexts, Grid, Node, Nodes, Path };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Path = exports.Nodes = exports.Node = exports.Grid = exports.GraphContexts = exports.Graph = exports.Edges = exports.Edge = void 0;
|
|
7
|
+
const Edge_1 = __importDefault(require("./Edge"));
|
|
8
|
+
const Edges_1 = __importDefault(require("./Edges"));
|
|
9
|
+
const Graph_1 = __importDefault(require("./Graph"));
|
|
10
|
+
const GraphContexts_1 = __importDefault(require("./GraphContexts"));
|
|
11
|
+
const Grid_1 = __importDefault(require("./Grid"));
|
|
12
|
+
const Node_1 = __importDefault(require("./Node"));
|
|
13
|
+
const Nodes_1 = __importDefault(require("./Nodes"));
|
|
14
|
+
const Path_1 = __importDefault(require("./Path"));
|
|
15
|
+
const Edge = Edge_1.default;
|
|
16
|
+
exports.Edge = Edge;
|
|
17
|
+
const Edges = Edges_1.default;
|
|
18
|
+
exports.Edges = Edges;
|
|
19
|
+
const Graph = Graph_1.default;
|
|
20
|
+
exports.Graph = Graph;
|
|
21
|
+
const GraphContexts = GraphContexts_1.default;
|
|
22
|
+
exports.GraphContexts = GraphContexts;
|
|
23
|
+
const Grid = Grid_1.default;
|
|
24
|
+
exports.Grid = Grid;
|
|
25
|
+
const Node = Node_1.default;
|
|
26
|
+
exports.Node = Node;
|
|
27
|
+
const Nodes = Nodes_1.default;
|
|
28
|
+
exports.Nodes = Nodes;
|
|
29
|
+
const Path = Path_1.default;
|
|
30
|
+
exports.Path = Path;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* edge */
|
|
2
|
+
|
|
3
|
+
.lincle-base-edges {
|
|
4
|
+
position: absolute;
|
|
5
|
+
z-index: -1;
|
|
6
|
+
overflow: visible;
|
|
7
|
+
|
|
8
|
+
/* width: 1px; */
|
|
9
|
+
|
|
10
|
+
/* height: 1px; */
|
|
11
|
+
filter: drop-shadow(0 3px 6px rgba(0 0 0 / 16%)) drop-shadow(0 3px 6px rgba(0 0 0 23%));
|
|
12
|
+
backface-visibility: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.lincle-base-edges > :not(path) {
|
|
16
|
+
cursor: unset;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.lincle-base-edge-marker-arrow {
|
|
20
|
+
fill: black;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.lincle-base-edge-marker-circle {
|
|
24
|
+
fill: black;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* grid */
|
|
28
|
+
|
|
29
|
+
.lincle-base-grid {
|
|
30
|
+
position: absolute;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* node */
|
|
36
|
+
|
|
37
|
+
.lincle-base-node {
|
|
38
|
+
position: absolute;
|
|
39
|
+
transform-origin: 0 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* path */
|
|
43
|
+
|
|
44
|
+
.lincle-base-edge-path {
|
|
45
|
+
stroke: black;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.lincle-base-edge-path:hover {
|
|
49
|
+
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
50
|
+
stroke-dasharray: 5 5;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.lincle-base-edge-dash-all .lincle-base-edge-path {
|
|
54
|
+
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
55
|
+
stroke-dasharray: 5 5;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.lincle-base-edge-dash-none .lincle-base-edge-path {
|
|
59
|
+
animation: none;
|
|
60
|
+
stroke-dasharray: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.lincle-base-edge-dash-on {
|
|
64
|
+
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
65
|
+
stroke-dasharray: 5 5;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.lincle-base-edge-dash-off.lincle-base-edge-path:hover {
|
|
69
|
+
animation: none;
|
|
70
|
+
stroke-dasharray: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.lincle-base-edge-path-border {
|
|
74
|
+
stroke-width: 30px;
|
|
75
|
+
stroke: black;
|
|
76
|
+
opacity: 0;
|
|
77
|
+
pointer-events: all;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.lincle-base-edge-path-border:hover + .lincle-base-edge-path {
|
|
81
|
+
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
82
|
+
stroke-dasharray: 5 5;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.lincle-base-edge-path-border:hover + .lincle-base-edge-dash-off.lincle-base-edge-path {
|
|
86
|
+
animation: none;
|
|
87
|
+
stroke-dasharray: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.lincle-base-edge-dash-none .lincle-base-edge-path-border:hover + .lincle-base-edge-path {
|
|
91
|
+
animation: none;
|
|
92
|
+
stroke-dasharray: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@keyframes lincle-base-edgedash {
|
|
96
|
+
to {
|
|
97
|
+
stroke-dashoffset: 30;
|
|
98
|
+
}
|
|
99
|
+
}
|