@lincle/react-native-base 0.4.0-next.16 → 0.4.0-next.18
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/cjs/components/Edge/index.js +57 -0
- package/dist/cjs/components/Edge/index.js.map +1 -0
- package/dist/cjs/components/Edges/Marker.js +28 -0
- package/dist/cjs/components/Edges/Marker.js.map +1 -0
- package/dist/cjs/components/Edges/Paths/Path/Path.js +74 -0
- package/dist/cjs/components/Edges/Paths/Path/Path.js.map +1 -0
- package/dist/cjs/components/Edges/Paths/Path/index.js +64 -0
- package/dist/cjs/components/Edges/Paths/Path/index.js.map +1 -0
- package/dist/cjs/components/Edges/Paths/index.js +27 -0
- package/dist/cjs/components/Edges/Paths/index.js.map +1 -0
- package/dist/cjs/components/Edges/index.js +51 -0
- package/dist/cjs/components/Edges/index.js.map +1 -0
- package/dist/cjs/components/Graph/Grid/index.js +51 -0
- package/dist/cjs/components/Graph/Grid/index.js.map +1 -0
- package/dist/cjs/components/Graph/index.js +17 -0
- package/dist/cjs/components/Graph/index.js.map +1 -0
- package/dist/cjs/components/Node/index.js +118 -0
- package/dist/cjs/components/Node/index.js.map +1 -0
- package/dist/cjs/components/Nodes/index.js +7 -0
- package/dist/cjs/components/Nodes/index.js.map +1 -0
- package/dist/cjs/components/index.js +6 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/shared.js +2 -0
- package/dist/cjs/shared.js.map +1 -0
- package/dist/esm/components/Edge/index.js +57 -0
- package/dist/esm/components/Edge/index.js.map +1 -0
- package/dist/esm/components/Edges/Marker.js +28 -0
- package/dist/esm/components/Edges/Marker.js.map +1 -0
- package/dist/esm/components/Edges/Paths/Path/Path.js +74 -0
- package/dist/esm/components/Edges/Paths/Path/Path.js.map +1 -0
- package/dist/esm/components/Edges/Paths/Path/index.js +64 -0
- package/dist/esm/components/Edges/Paths/Path/index.js.map +1 -0
- package/dist/esm/components/Edges/Paths/index.js +27 -0
- package/dist/esm/components/Edges/Paths/index.js.map +1 -0
- package/dist/esm/components/Edges/index.js +51 -0
- package/dist/esm/components/Edges/index.js.map +1 -0
- package/dist/esm/components/Graph/Grid/index.js +51 -0
- package/dist/esm/components/Graph/Grid/index.js.map +1 -0
- package/dist/esm/components/Graph/index.js +17 -0
- package/dist/esm/components/Graph/index.js.map +1 -0
- package/dist/esm/components/Node/index.js +118 -0
- package/dist/esm/components/Node/index.js.map +1 -0
- package/dist/esm/components/Nodes/index.js +7 -0
- package/dist/esm/components/Nodes/index.js.map +1 -0
- package/dist/esm/components/index.js +6 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/shared.js +2 -0
- package/dist/esm/shared.js.map +1 -0
- package/package.json +29 -24
- package/dist/components/Edge/index.js +0 -61
- package/dist/components/Edges/Marker.js +0 -29
- package/dist/components/Edges/Paths/Path/Path.js +0 -57
- package/dist/components/Edges/Paths/Path/index.js +0 -59
- package/dist/components/Edges/Paths/index.js +0 -33
- package/dist/components/Edges/index.js +0 -86
- package/dist/components/Graph/Grid/index.js +0 -84
- package/dist/components/Graph/index.js +0 -23
- package/dist/components/Node/index.js +0 -128
- package/dist/components/Nodes/index.js +0 -9
- package/dist/components/index.js +0 -21
- package/dist/index.js +0 -18
- package/dist/shared.js +0 -18
- /package/dist/{components → esm/components}/Edge/index.d.ts +0 -0
- /package/dist/{components → esm/components}/Edges/Marker.d.ts +0 -0
- /package/dist/{components → esm/components}/Edges/Paths/Path/Path.d.ts +0 -0
- /package/dist/{components → esm/components}/Edges/Paths/Path/index.d.ts +0 -0
- /package/dist/{components → esm/components}/Edges/Paths/index.d.ts +0 -0
- /package/dist/{components → esm/components}/Edges/index.d.ts +0 -0
- /package/dist/{components → esm/components}/Graph/Grid/index.d.ts +0 -0
- /package/dist/{components → esm/components}/Graph/index.d.ts +0 -0
- /package/dist/{components → esm/components}/Node/index.d.ts +0 -0
- /package/dist/{components → esm/components}/Nodes/index.d.ts +0 -0
- /package/dist/{components → esm/components}/index.d.ts +0 -0
- /package/dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/dist/{shared.d.ts → esm/shared.d.ts} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useDiagramId } from '../../shared';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { Circle, Marker as NativeMarker, Path } from 'react-native-svg';
|
|
5
|
+
const Marker = () => {
|
|
6
|
+
const id = useDiagramId();
|
|
7
|
+
const markerId = useMemo(() => {
|
|
8
|
+
return id ?
|
|
9
|
+
`${id}-` :
|
|
10
|
+
'';
|
|
11
|
+
}, [
|
|
12
|
+
id
|
|
13
|
+
]);
|
|
14
|
+
const arrowId = useMemo(() => {
|
|
15
|
+
return `diagram-${markerId}marker-arrow`;
|
|
16
|
+
}, [
|
|
17
|
+
markerId
|
|
18
|
+
]);
|
|
19
|
+
const circleId = useMemo(() => {
|
|
20
|
+
return `diagram-${markerId}marker-circle`;
|
|
21
|
+
}, [
|
|
22
|
+
markerId
|
|
23
|
+
]);
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx(NativeMarker, { id: arrowId, markerHeight: '10', markerUnits: 'strokeWidth', markerWidth: '10', orient: 'auto', refX: '9', refY: '5', children: _jsx(Path, { d: 'M 0 0 L 10 5 L 0 10 z', fill: 'black' }) }), _jsx(NativeMarker, { id: circleId, markerHeight: '10', markerUnits: 'strokeWidth', markerWidth: '10', orient: 'auto', refX: '5', refY: '5', children: _jsx(Circle, { cx: '5', cy: '5', fill: 'black', r: '3' }) })] }));
|
|
25
|
+
};
|
|
26
|
+
Marker.displayName = 'LincleMarker';
|
|
27
|
+
export default Marker;
|
|
28
|
+
//# sourceMappingURL=Marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../../src/components/Edges/Marker.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EACL,MAAM,EACN,MAAM,IAAI,YAAY,EACtB,IAAI,EACL,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,GAA8B,GAAG,EAAE;IAC7C,MAAM,EAAE,GAAG,YAAY,EAAE,CAAC;IAE1B,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE;QACH,OAAO,EAAE,CAAC,CAAC;YACT,GAAG,EAAE,GAAG,CAAC,CAAC;YACV,EAAE,CAAC;IACP,CAAC,EACD;QACE,EAAE;KACH,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE;QACH,OAAO,WAAW,QAAQ,cAAc,CAAC;IAC3C,CAAC,EACD;QACE,QAAQ;KACT,CACF,CAAC;IAEF,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE;QACH,OAAO,WAAW,QAAQ,eAAe,CAAC;IAC5C,CAAC,EACD;QACE,QAAQ;KACT,CACF,CAAC;IAEF,OAAO,CACL,8BACE,KAAC,YAAY,IACX,EAAE,EAAE,OAAO,EACX,YAAY,EAAC,IAAI,EACjB,WAAW,EAAC,aAAa,EACzB,WAAW,EAAC,IAAI,EAChB,MAAM,EAAC,MAAM,EACb,IAAI,EAAC,GAAG,EACR,IAAI,EAAC,GAAG,YAER,KAAC,IAAI,IACH,CAAC,EAAC,uBAAuB,EACzB,IAAI,EAAC,OAAO,GACZ,GACW,EACf,KAAC,YAAY,IACX,EAAE,EAAE,QAAQ,EACZ,YAAY,EAAC,IAAI,EACjB,WAAW,EAAC,aAAa,EACzB,WAAW,EAAC,IAAI,EAChB,MAAM,EAAC,MAAM,EACb,IAAI,EAAC,GAAG,EACR,IAAI,EAAC,GAAG,YAER,KAAC,MAAM,IACL,EAAE,EAAC,GAAG,EACN,EAAE,EAAC,GAAG,EACN,IAAI,EAAC,OAAO,EACZ,CAAC,EAAC,GAAG,GACL,GACW,IACd,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,cAAc,CAAC;AAEpC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { generateOrigins, useDiagramId, useUpdateEdge } from '../../../../shared';
|
|
3
|
+
import { useEffect, useMemo } from 'react';
|
|
4
|
+
import { createAnimatedComponent, Easing, ReduceMotion, useAnimatedStyle, useSharedValue, withRepeat, withTiming, } from 'react-native-reanimated';
|
|
5
|
+
import { G, Path as NativePath } from 'react-native-svg';
|
|
6
|
+
const AnimatedPath = createAnimatedComponent(NativePath);
|
|
7
|
+
const Path = ({ center = true, edgeId, isConnecting, line, markerEnd: givenMarkerEnd, markerStart: givenMarkerStart, source, target }) => {
|
|
8
|
+
const progress = useSharedValue(0);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
progress.value = withRepeat(withTiming(1, {
|
|
11
|
+
duration: 5000,
|
|
12
|
+
easing: Easing.linear
|
|
13
|
+
}), -1, false, () => { }, ReduceMotion.Never);
|
|
14
|
+
}, [
|
|
15
|
+
progress
|
|
16
|
+
]);
|
|
17
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
18
|
+
return {
|
|
19
|
+
strokeDashoffset: 100 * (30 - progress.value)
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
const diagramId = useDiagramId();
|
|
23
|
+
const updateEdge = useUpdateEdge();
|
|
24
|
+
const origins = useMemo(() => {
|
|
25
|
+
if (source &&
|
|
26
|
+
target &&
|
|
27
|
+
line) {
|
|
28
|
+
const generatedOrigins = generateOrigins(source, target, line, center);
|
|
29
|
+
return generatedOrigins;
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}, [
|
|
33
|
+
center,
|
|
34
|
+
line,
|
|
35
|
+
source,
|
|
36
|
+
target
|
|
37
|
+
]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (origins?.center &&
|
|
40
|
+
updateEdge) {
|
|
41
|
+
updateEdge(edgeId, {
|
|
42
|
+
center: origins.center
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, [
|
|
46
|
+
edgeId,
|
|
47
|
+
origins?.center,
|
|
48
|
+
updateEdge
|
|
49
|
+
]);
|
|
50
|
+
const markerEnd = useMemo(() => {
|
|
51
|
+
const id = diagramId ?
|
|
52
|
+
`${diagramId}-` :
|
|
53
|
+
'';
|
|
54
|
+
return givenMarkerEnd ??
|
|
55
|
+
`url(#diagram-${id}marker-arrow)`;
|
|
56
|
+
}, [
|
|
57
|
+
diagramId,
|
|
58
|
+
givenMarkerEnd
|
|
59
|
+
]);
|
|
60
|
+
const markerStart = useMemo(() => {
|
|
61
|
+
const id = diagramId ?
|
|
62
|
+
`${diagramId}-` :
|
|
63
|
+
'';
|
|
64
|
+
return givenMarkerStart ??
|
|
65
|
+
`url(#diagram-${id}marker-circle)`;
|
|
66
|
+
}, [
|
|
67
|
+
diagramId,
|
|
68
|
+
givenMarkerStart
|
|
69
|
+
]);
|
|
70
|
+
return (_jsxs(G, { children: [_jsx(NativePath, { d: origins?.path, fill: 'transparent', id: diagramId + '1', opacity: 0, pointerEvents: 'box-none', stroke: 'black', strokeWidth: 30 }), _jsx(AnimatedPath, { d: origins?.path, fill: 'transparent', id: diagramId + '2', markerEnd: markerEnd, markerStart: markerStart, pointerEvents: 'box-none', stroke: 'black', strokeDasharray: isConnecting ? '5 5' : undefined, style: isConnecting ? animatedStyle : undefined })] }));
|
|
71
|
+
};
|
|
72
|
+
Path.displayName = 'LinclePath';
|
|
73
|
+
export default Path;
|
|
74
|
+
//# sourceMappingURL=Path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Path.js","sourceRoot":"","sources":["../../../../../../src/components/Edges/Paths/Path/Path.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,SAAS,EACT,OAAO,EACR,MAAM,OAAO,CAAC;AAMf,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,CAAC,EACD,IAAI,IAAI,UAAU,EACnB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,YAAY,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;AAEzD,MAAM,IAAI,GAAiC,CAAC,EAC1C,MAAM,GAAG,IAAI,EACb,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,gBAAgB,EAC7B,MAAM,EACN,MAAM,EACP,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAEnC,SAAS,CACP,GAAG,EAAE;QACH,QAAQ,CAAC,KAAK,GAAG,UAAU,CACzB,UAAU,CACR,CAAC,EACD;YACE,QAAQ,EAAE,IAAK;YACf,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CACF,EACD,CAAC,CAAC,EACF,KAAK,EACL,GAAG,EAAE,GAAE,CAAC,EACR,YAAY,CAAC,KAAK,CACnB,CAAC;IACJ,CAAC,EACD;QACE,QAAQ;KACT,CACF,CAAC;IAEF,MAAM,aAAa,GAAG,gBAAgB,CACpC,GAAG,EAAE;QACH,OAAO;YACL,gBAAgB,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC;SACR,CAAC;IAC1C,CAAC,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,UAAU,GA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GAAG,EACnB,OAAO,EAAE,CAAC,EACV,aAAa,EAAC,UAAU,EACxB,MAAM,EAAC,OAAO,EACd,WAAW,EAAE,EAAE,GACf,EACF,KAAC,YAAY,IACX,CAAC,EAAE,OAAO,EAAE,IAAI,EAChB,IAAI,EAAC,aAAa,EAClB,EAAE,EAAE,SAAS,GAAG,GAAG,EACnB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAC,UAAU,EACxB,MAAM,EAAC,OAAO,EACd,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAGjD,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,GAC/C,IACA,CACL,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC;AAEhC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDefaultLine, useEdgeSubscriber } from '../../../../shared';
|
|
3
|
+
import Path from './Path';
|
|
4
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
5
|
+
const RegisterEdge = ({ id: edgeId, line: givenLine, markerEnd, markerStart, path, sourceId, targetId }) => {
|
|
6
|
+
const defaultLine = useDefaultLine();
|
|
7
|
+
const edgeSubscriber = useEdgeSubscriber();
|
|
8
|
+
const line = givenLine ?? defaultLine;
|
|
9
|
+
const [source, setSource] = useState();
|
|
10
|
+
const [target, setTarget] = useState();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setSource(edgeSubscriber?.register(edgeId, sourceId, setSource));
|
|
13
|
+
setTarget(edgeSubscriber?.register(edgeId, targetId, setTarget));
|
|
14
|
+
return () => {
|
|
15
|
+
edgeSubscriber?.unregister(edgeId, sourceId);
|
|
16
|
+
edgeSubscriber?.unregister(edgeId, targetId);
|
|
17
|
+
};
|
|
18
|
+
}, []);
|
|
19
|
+
const pathSource = useMemo(() => {
|
|
20
|
+
return source ?
|
|
21
|
+
{
|
|
22
|
+
...source,
|
|
23
|
+
x: source.x,
|
|
24
|
+
y: source.y
|
|
25
|
+
} :
|
|
26
|
+
undefined;
|
|
27
|
+
}, [
|
|
28
|
+
source?.x,
|
|
29
|
+
source?.y
|
|
30
|
+
]);
|
|
31
|
+
const pathTarget = useMemo(() => {
|
|
32
|
+
return target ?
|
|
33
|
+
{
|
|
34
|
+
...target,
|
|
35
|
+
x: target.x,
|
|
36
|
+
y: target.y
|
|
37
|
+
} :
|
|
38
|
+
undefined;
|
|
39
|
+
}, [
|
|
40
|
+
target?.x,
|
|
41
|
+
target?.y
|
|
42
|
+
]);
|
|
43
|
+
const customPath = useMemo(() => {
|
|
44
|
+
return path ?
|
|
45
|
+
path(pathSource, pathTarget) :
|
|
46
|
+
undefined;
|
|
47
|
+
}, [
|
|
48
|
+
path,
|
|
49
|
+
pathSource,
|
|
50
|
+
pathTarget
|
|
51
|
+
]);
|
|
52
|
+
if (source &&
|
|
53
|
+
target) {
|
|
54
|
+
return customPath ??
|
|
55
|
+
_jsx(Path, { center: true, edgeId: edgeId, line: line, markerEnd: markerEnd, markerStart: markerStart, source: pathSource, target: pathTarget });
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
RegisterEdge.displayName = 'LincleRegisterEdge';
|
|
62
|
+
export default RegisterEdge;
|
|
63
|
+
export { default as Path } from './Path';
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/Edges/Paths/Path/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAGL,cAAc,EACd,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,EAEL,SAAS,EACT,OA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G,MAAM;gBACT,CAAC,EAAE,MAAM,CAAC,CAAC;gBACX,CAAC,EAAE,MAAM,CAAC,CAAC;aACZ,CAAC,CAAC;YACH,SAAS,CAAC;IACd,CAAC,EACD;QACE,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;KACV,CACF,CAAC;IAEF,MAAM,UAAU,GAAG,OAAO,CACxB,GAAG,EAAE;QACH,OAAO,IAAI,CAAC,CAAC;YACX,IAAI,CACF,UAAU,EACV,UAAU,CACX,CAAC,CAAC;YACH,SAAS,CAAC;IACd,CAAC,EAED;QACE,IAAI;QACJ,UAAU;QACV,UAAU;KACX,CACF,CAAC;IAEF,IACE,MAAM;QACN,MAAM,EACN,CAAC;QACD,OAAO,UAAU;YACjB,KAAC,IAAI,IACH,MAAM,QACN,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,GAClB,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEhD,eAAe,YAAY,CAAC;AAE5B,OAAO,EACL,OAAO,IAAI,IAAI,EAChB,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEdges } from '../../../shared';
|
|
3
|
+
import RegisterEdge from './Path';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
const Paths = () => {
|
|
6
|
+
const edges = useEdges();
|
|
7
|
+
const paths = useMemo(() => {
|
|
8
|
+
const edgesMap = Object.keys(edges).map((edgeId) => {
|
|
9
|
+
const { line, sourceId, targetId } = edges[edgeId] ?? {};
|
|
10
|
+
if (sourceId &&
|
|
11
|
+
targetId) {
|
|
12
|
+
return (_jsx(RegisterEdge, { id: edgeId, line: line, sourceId: sourceId, targetId: targetId }, edgeId));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return edgesMap;
|
|
19
|
+
}, [
|
|
20
|
+
edges
|
|
21
|
+
]);
|
|
22
|
+
return paths;
|
|
23
|
+
};
|
|
24
|
+
Paths.displayName = 'LinclePaths';
|
|
25
|
+
export default Paths;
|
|
26
|
+
export { Path } from './Path';
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/Edges/Paths/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAEL,OAAO,EACR,MAAM,OAAO,CAAC;AAEf,MAAM,KAAK,GAAkC,GAAG,EAAE;IAChD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE;QACH,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CACrC,CAAC,MAAM,EAAE,EAAE;YACT,MAAM,EACJ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACT,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAExB,IACE,QAAQ;gBACR,QAAQ,EACR,CAAC;gBACD,OAAO,CACL,KAAC,YAAY,IACX,EAAE,EAAE,MAAM,EAEV,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,IAHb,MAAM,CAIX,CACH,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC,EACD;QACE,KAAK;KACN,CACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC;AAIlC,eAAe,KAAK,CAAC;AAErB,OAAO,EACL,IAAI,EACL,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import Marker from './Marker';
|
|
3
|
+
import Paths from './Paths';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { StyleSheet, View } from 'react-native';
|
|
6
|
+
import Svg, { Defs, G } from 'react-native-svg';
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
bridges: {
|
|
9
|
+
bottom: 0,
|
|
10
|
+
left: 0,
|
|
11
|
+
overflow: 'visible',
|
|
12
|
+
pointerEvents: 'box-none',
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
right: 0,
|
|
15
|
+
top: 0
|
|
16
|
+
},
|
|
17
|
+
edges: {
|
|
18
|
+
backfaceVisibility: 'hidden',
|
|
19
|
+
overflow: 'visible',
|
|
20
|
+
pointerEvents: 'box-none'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const Edges = ({ children, scale = 1, translate = {
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0
|
|
26
|
+
} }) => {
|
|
27
|
+
const { style, transform } = useMemo(() => {
|
|
28
|
+
const tx = translate.x;
|
|
29
|
+
const ty = translate.y;
|
|
30
|
+
const tz = scale;
|
|
31
|
+
return {
|
|
32
|
+
style: {
|
|
33
|
+
...styles.bridges,
|
|
34
|
+
pointerEvents: 'box-none',
|
|
35
|
+
transform: `translateX(${tx}px) translateY(${ty}px) scale(${tz})`,
|
|
36
|
+
transformOrigin: 'top left'
|
|
37
|
+
},
|
|
38
|
+
transform: `translate(${tx}, ${ty}) scale(${tz})`
|
|
39
|
+
};
|
|
40
|
+
}, [
|
|
41
|
+
translate.x,
|
|
42
|
+
translate.y,
|
|
43
|
+
scale
|
|
44
|
+
]);
|
|
45
|
+
return (_jsxs(_Fragment, { children: [_jsx(Svg, { style: styles.edges, children: _jsxs(G, { transform: transform, children: [_jsx(Defs, { children: _jsx(Marker, {}) }), _jsx(Paths, {})] }) }), _jsx(View, { style: style, children: children })] }));
|
|
46
|
+
};
|
|
47
|
+
Edges.displayName = 'LincleEdges';
|
|
48
|
+
export { Edges };
|
|
49
|
+
export { default as Marker } from './Marker';
|
|
50
|
+
export { Path } from './Paths';
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Edges/index.tsx"],"names":[],"mappings":";AAGA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAEL,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EACL,UAAU,EACV,IAAI,EACL,MAAM,cAAc,CAAC;AACtB,OAAO,GAAG,EAAE,EACV,IAAI,EACJ,CAAC,EACF,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,SAAS;QACnB,aAAa,EAAE,UAAU;QACzB,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;IACD,KAAK,EAAE;QACL,kBAAkB,EAAE,QAAQ;QAE5B,QAAQ,EAAE,SAAS;QAEnB,aAAa,EAAE,UAAU;KAC1B;CACF,CAAC,CAAC;AAEH,MAAM,KAAK,GAAkC,CAAC,EAC5C,QAAQ,EACR,KAAK,GAAG,CAAC,EACT,SAAS,GAAG;IACV,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;CACL,EACF,EAAE,EAAE;IACH,MAAM,EACJ,KAAK,EACL,SAAS,EACV,GAAG,OAAO,CACT,GAAG,EAAE;QACH,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;QACvB,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;QACvB,MAAM,EAAE,GAAG,KAAK,CAAC;QAEjB,OAAO;YACL,KAAK,EAAE;gBACL,GAAG,MAAM,CAAC,OAAO;gBACjB,aAAa,EAAE,UAAmB;gBAClC,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAAG;gBACjE,eAAe,EAAE,UAAU;aAC5B;YACD,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG;SAClD,CAAC;IACJ,CAAC,EACD;QACE,SAAS,CAAC,CAAC;QACX,SAAS,CAAC,CAAC;QACX,KAAK;KACN,CACF,CAAC;IAEF,OAAO,CACL,8BACE,KAAC,GAAG,IACF,KAAK,EAAE,MAAM,CAAC,KAAK,YAEnB,MAAC,CAAC,IACA,SAAS,EAAE,SAAS,aAEpB,KAAC,IAAI,cACH,KAAC,MAAM,KAAG,GACL,EACP,KAAC,KAAK,KAAG,IACP,GACA,EACN,KAAC,IAAI,IACH,KAAK,EAAE,KAAK,YAEX,QAAQ,GACJ,IACN,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC;AAElC,OAAO,EACL,KAAK,EACN,CAAC;AAEF,OAAO,EACL,OAAO,IAAI,MAAM,EAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,IAAI,EACL,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useDiagramId, useGrid } from '../../../shared';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
import Svg, { Circle as NativeCircle, Pattern, Rect } from 'react-native-svg';
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
grid: {
|
|
8
|
+
height: '100%',
|
|
9
|
+
pointerEvents: 'none',
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
width: '100%'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const SIZE = 0.4;
|
|
15
|
+
const Circle = _jsx(NativeCircle, { cx: SIZE, cy: SIZE, fill: 'black', r: SIZE });
|
|
16
|
+
const Grid = ({ children, scale = 1, xOffset: givenXOffset = 0, yOffset: givenYOffset = 0 }) => {
|
|
17
|
+
const diagramId = useDiagramId();
|
|
18
|
+
const [givenGridX, givenGridY] = useGrid() || [
|
|
19
|
+
1,
|
|
20
|
+
1
|
|
21
|
+
];
|
|
22
|
+
const id = `lincle-grid-${diagramId}`;
|
|
23
|
+
const gridX = useMemo(() => {
|
|
24
|
+
return givenGridX * scale;
|
|
25
|
+
}, [
|
|
26
|
+
givenGridX,
|
|
27
|
+
scale
|
|
28
|
+
]);
|
|
29
|
+
const gridY = useMemo(() => {
|
|
30
|
+
return givenGridY * scale;
|
|
31
|
+
}, [
|
|
32
|
+
givenGridY,
|
|
33
|
+
scale
|
|
34
|
+
]);
|
|
35
|
+
const xOffset = useMemo(() => {
|
|
36
|
+
return givenXOffset % gridX;
|
|
37
|
+
}, [
|
|
38
|
+
givenXOffset,
|
|
39
|
+
gridX
|
|
40
|
+
]);
|
|
41
|
+
const yOffset = useMemo(() => {
|
|
42
|
+
return givenYOffset % gridY;
|
|
43
|
+
}, [
|
|
44
|
+
givenYOffset,
|
|
45
|
+
gridY
|
|
46
|
+
]);
|
|
47
|
+
return (_jsxs(Svg, { style: styles.grid, children: [_jsx(Pattern, { height: gridY, id: id, patternUnits: 'userSpaceOnUse', width: gridX, x: xOffset, y: yOffset, children: children ?? Circle }), _jsx(Rect, { fill: `url(#${id})`, height: '100%', width: '100%', x: '0', y: '0' })] }));
|
|
48
|
+
};
|
|
49
|
+
Grid.displayName = 'LincleGrid';
|
|
50
|
+
export default Grid;
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/Graph/Grid/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,YAAY,EACZ,OAAO,EACR,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EACL,UAAU,EACX,MAAM,cAAc,CAAC;AACtB,OAAO,GAAG,EAAE,EACV,MAAM,IAAI,YAAY,EACtB,OAAO,EACP,IAAI,EACL,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,MAAM,MAAM,GACV,KAAC,YAAY,IACX,EAAE,EAAE,IAAI,EACR,EAAE,EAAE,IAAI,EACR,IAAI,EAAC,OAAO,EACZ,CAAC,EAAE,IAAI,GACP,CAAC;AACL,MAAM,IAAI,GAAiC,CACzC,EACE,QAAQ,EACR,KAAK,GAAG,CAAC,EACT,OAAO,EAAE,YAAY,GAAG,CAAC,EACzB,OAAO,EAAE,YAAY,GAAG,CAAC,EACf,EACZ,EAAE;IACF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,CACJ,UAAU,EACV,UAAU,CACX,GAAG,OAAO,EAAE,IAAI;QACf,CAAC;QACD,CAAC;KACF,CAAC;IAEF,MAAM,EAAE,GAAG,eAAe,SAAS,EAAE,CAAC;IAEtC,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE;QACH,OAAO,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC,EACD;QACE,UAAU;QACV,KAAK;KACN,CACF,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE;QACH,OAAO,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC,EACD;QACE,UAAU;QACV,KAAK;KACN,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE;QACH,OAAO,YAAY,GAAG,KAAK,CAAC;IAC9B,CAAC,EACD;QACE,YAAY;QACZ,KAAK;KACN,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE;QACH,OAAO,YAAY,GAAG,KAAK,CAAC;IAC9B,CAAC,EACD;QACE,YAAY;QACZ,KAAK;KACN,CACF,CAAC;IAEF,OAAO,CACL,MAAC,GAAG,IACF,KAAK,EAAE,MAAM,CAAC,IAAI,aAElB,KAAC,OAAO,IACN,MAAM,EAAE,KAAK,EACb,EAAE,EAAE,EAAE,EACN,YAAY,EAAC,gBAAgB,EAC7B,KAAK,EAAE,KAAK,EAEZ,CAAC,EAAE,OAAO,EAEV,CAAC,EAAE,OAAO,YAET,QAAQ,IAAI,MAAM,GACX,EACV,KAAC,IAAI,IACH,IAAI,EAAE,QAAQ,EAAE,GAAG,EACnB,MAAM,EAAC,MAAM,EACb,KAAK,EAAC,MAAM,EAEZ,CAAC,EAAC,GAAG,EAEL,CAAC,EAAC,GAAG,GACL,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC;AAEhC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Providers } from '../../shared';
|
|
3
|
+
import Grid from './Grid';
|
|
4
|
+
const Graph = ({ children, edgeFrequency, grid, id, line, nodeFrequency, nodeHeight, nodeWidth, shape, showGrid }) => {
|
|
5
|
+
if (!id) {
|
|
6
|
+
console.error('No ID provided to @lincle/base Graph!');
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const gird = showGrid === false ?
|
|
10
|
+
null :
|
|
11
|
+
_jsx(Grid, {});
|
|
12
|
+
return (_jsxs(Providers, { edgeFrequency: edgeFrequency, grid: grid, id: id, line: line, nodeFrequency: nodeFrequency, nodeHeight: nodeHeight, nodeWidth: nodeWidth, shape: shape, children: [gird, children] }));
|
|
13
|
+
};
|
|
14
|
+
Graph.displayName = 'LincleGraph';
|
|
15
|
+
export { Graph };
|
|
16
|
+
export { default as Grid } from './Grid';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Graph/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,IAAI,MAAM,QAAQ,CAAC;AAK1B,MAAM,KAAK,GAAkC,CAAC,EAC5C,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,EACT,EAAE,EAAE;IACH,IAAI,CAAC,EAAE,EAAE,CAAC;QAER,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,KAAK,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,CAAC;QACN,KAAC,IAAI,KAAG,CAAC;IAEX,OAAO,CACL,MAAC,SAAS,IACR,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,aAEX,IAAI,EACJ,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC;AAElC,OAAO,EACL,KAAK,EACN,CAAC;AAEF,OAAO,EACL,OAAO,IAAI,IAAI,EAChB,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDefaultNodeHeight, useDefaultNodeWidth, useDefaultShape, useEdgeSubscriber, useNodePositions } from '../../shared';
|
|
3
|
+
import { forwardRef, useEffect, useMemo } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
const Node = ({ children, height: givenHeight, id: nodeId, shape: givenShape, style: { node: nodeStyle } = {}, track = true, width: givenWidth, x: givenX = 0, y: givenY = 0, ...additionalProperties }, ref) => {
|
|
6
|
+
const defaultHeight = useDefaultNodeHeight();
|
|
7
|
+
const defaultShape = useDefaultShape();
|
|
8
|
+
const defaultWidth = useDefaultNodeWidth();
|
|
9
|
+
const edgeSubscriber = useEdgeSubscriber();
|
|
10
|
+
const nodePositions = useNodePositions();
|
|
11
|
+
const height = givenHeight ?? defaultHeight ?? 0;
|
|
12
|
+
const shape = givenShape ?? defaultShape ?? 'oval';
|
|
13
|
+
const width = givenWidth ?? defaultWidth ?? 0;
|
|
14
|
+
const { x, y } = useMemo(() => {
|
|
15
|
+
if (!(givenX || givenY)) {
|
|
16
|
+
const getNumber = /(-?\d+(\.\d+)?)/gu;
|
|
17
|
+
const transform = nodeStyle?.transform;
|
|
18
|
+
const [translateX, translateY] = transform ?
|
|
19
|
+
transform.match(getNumber) ?? [
|
|
20
|
+
undefined,
|
|
21
|
+
undefined
|
|
22
|
+
] :
|
|
23
|
+
[
|
|
24
|
+
undefined,
|
|
25
|
+
undefined
|
|
26
|
+
];
|
|
27
|
+
const left = nodeStyle?.left ?? undefined;
|
|
28
|
+
const top = nodeStyle?.top ?? undefined;
|
|
29
|
+
return {
|
|
30
|
+
x: Number(translateX) || Number(left) || 0,
|
|
31
|
+
y: Number(translateY) || Number(top) || 0
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
x: givenX,
|
|
36
|
+
y: givenY
|
|
37
|
+
};
|
|
38
|
+
}, [
|
|
39
|
+
givenX,
|
|
40
|
+
givenY,
|
|
41
|
+
nodeStyle
|
|
42
|
+
]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
nodePositions?.register({
|
|
45
|
+
height,
|
|
46
|
+
id: nodeId,
|
|
47
|
+
shape,
|
|
48
|
+
width,
|
|
49
|
+
x,
|
|
50
|
+
y
|
|
51
|
+
});
|
|
52
|
+
return () => {
|
|
53
|
+
nodePositions?.unregister(nodeId);
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
nodePositions?.update({
|
|
58
|
+
height,
|
|
59
|
+
id: nodeId,
|
|
60
|
+
shape,
|
|
61
|
+
width,
|
|
62
|
+
x,
|
|
63
|
+
y
|
|
64
|
+
});
|
|
65
|
+
}, [
|
|
66
|
+
height,
|
|
67
|
+
nodeId,
|
|
68
|
+
nodePositions,
|
|
69
|
+
shape,
|
|
70
|
+
width,
|
|
71
|
+
x,
|
|
72
|
+
y
|
|
73
|
+
]);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
edgeSubscriber?.update({
|
|
76
|
+
height,
|
|
77
|
+
id: nodeId,
|
|
78
|
+
shape,
|
|
79
|
+
width,
|
|
80
|
+
x,
|
|
81
|
+
y
|
|
82
|
+
});
|
|
83
|
+
}, [
|
|
84
|
+
edgeSubscriber,
|
|
85
|
+
height,
|
|
86
|
+
nodeId,
|
|
87
|
+
shape,
|
|
88
|
+
width,
|
|
89
|
+
x,
|
|
90
|
+
y
|
|
91
|
+
]);
|
|
92
|
+
const adjustedStyle = useMemo(() => {
|
|
93
|
+
return {
|
|
94
|
+
...nodeStyle,
|
|
95
|
+
height,
|
|
96
|
+
position: track ?
|
|
97
|
+
'absolute' :
|
|
98
|
+
'relative',
|
|
99
|
+
transform: track ?
|
|
100
|
+
(nodeStyle?.transform ?? `translate(${x}px, ${y}px)`) :
|
|
101
|
+
'translate(0px, 0px)',
|
|
102
|
+
transformOrigin: '0 0',
|
|
103
|
+
width
|
|
104
|
+
};
|
|
105
|
+
}, [
|
|
106
|
+
height,
|
|
107
|
+
nodeStyle,
|
|
108
|
+
track,
|
|
109
|
+
width,
|
|
110
|
+
x,
|
|
111
|
+
y
|
|
112
|
+
]);
|
|
113
|
+
return (_jsx(View, { "data-testid": `node-${nodeId}`, ref: ref, role: 'none', style: adjustedStyle, ...additionalProperties, children: children }));
|
|
114
|
+
};
|
|
115
|
+
Node.displayName = 'LincleNode';
|
|
116
|
+
const refNode = forwardRef(Node);
|
|
117
|
+
export { refNode as Node };
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Node/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,UAAU,EAEV,SAAS,EACT,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EACL,IAAI,EAEL,MAAM,cAAc,CAAC;AAEtB,MAAM,IAAI,GAAwD,CAChE,EACE,QAAQ,EACR,MAAM,EAAE,WAAW,EACnB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,EACL,IAAI,EAAE,SAAS,EAChB,GAAG,EAAE,EACN,KAAK,GAAG,IAAI,EACZ,KAAK,EAAE,UAAU,EACjB,CAAC,EAAE,MAAM,GAAG,CAAC,EACb,CAAC,EAAE,MAAM,GAAG,CAAC,EACb,GAAG,oBAAoB,EACxB,EACD,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,oBAAoB,EAAE,CAAC;IAC7C,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ACF,CAAC;IAEF,OAAO,CACL,KAAC,IAAI,mBACU,QAAQ,MAAM,EAAE,EAE7B,GAAG,EAAE,GAAU,EACf,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,aAAa,KAChB,oBAAoB,YAEvB,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC;AAEhC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AAEjC,OAAO,EACL,OAAO,IAAI,IAAI,EAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Nodes/index.tsx"],"names":[],"mappings":";AAOA,MAAM,KAAK,GAAkC,CAAC,EAC5C,QAAQ,EACT,EAAE,EAAE;IACH,OAAO,CACL,4BACG,QAAQ,GACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC;AAElC,OAAO,EACL,KAAK,EACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { generateOrigins, Providers, useDefaultLine, useDefaultNodeHeight, useDefaultNodeWidth, useDefaultShape, useDiagramId, useEdge, useEdges, useEdgeSubscriber, useGrid, useNodePositions, useRemoveEdge, useUpdateEdge } from '@lincle/react-shared';
|
|
2
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/shared.ts"],"names":[],"mappings":"AA4BA,OAAO,EAEL,eAAe,EAKf,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,iBAAiB,EACjB,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,aAAa,EACd,MAAM,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lincle/react-native-base",
|
|
3
3
|
"title": "lincle react native base",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
|
-
"version": "0.4.0-next.
|
|
5
|
+
"version": "0.4.0-next.18",
|
|
6
6
|
"private": false,
|
|
7
7
|
"description": "A 'reactive' React node and edge generator",
|
|
8
8
|
"author": "wallzero @wallzeroblog (http://wallzero.com)",
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
"position": "Initial and Lead Developer"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"
|
|
16
|
+
"main": "dist/cjs/index.js",
|
|
17
|
+
"module": "dist/esm/index.js",
|
|
18
|
+
"types": "dist/esm/index.d.ts",
|
|
18
19
|
"files": [
|
|
19
20
|
"dist/",
|
|
20
21
|
"COPYING.md",
|
|
@@ -30,7 +31,9 @@
|
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
33
|
"build": "run-s clean:dist build:prod",
|
|
33
|
-
"build:prod": "
|
|
34
|
+
"build:prod": "run-p build:cjs:prod build:esm:prod",
|
|
35
|
+
"build:cjs:prod": "tsc -p ./tsconfig.cjs.json",
|
|
36
|
+
"build:esm:prod": "tsc -p ./tsconfig.json",
|
|
34
37
|
"build:watch": "run-s clean:dist build:prod build:watch:tsc",
|
|
35
38
|
"build:watch:tsc": "tsc -p ./tsconfig.json --watch --pretty --preserveWatchOutput",
|
|
36
39
|
"----------------------------------------------------------------": "",
|
|
@@ -43,35 +46,37 @@
|
|
|
43
46
|
"clean:dist": "rimraf dist"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
|
-
"@digest/eslint-config-jest": "^4.14.
|
|
47
|
-
"@digest/eslint-config-react": "^4.14.
|
|
48
|
-
"@digest/eslint-config-typescript": "^4.14.
|
|
49
|
-
"@digest/jest-junit": "^4.14.
|
|
50
|
-
"@digest/jest-react": "^4.14.
|
|
51
|
-
"@digest/jest-typescript": "^4.14.
|
|
52
|
-
"@digest/typescript": "^4.14.
|
|
53
|
-
"@types/jest": "^
|
|
54
|
-
"@types/node": "^
|
|
55
|
-
"@types/react": "^19.
|
|
49
|
+
"@digest/eslint-config-jest": "^4.14.14",
|
|
50
|
+
"@digest/eslint-config-react": "^4.14.14",
|
|
51
|
+
"@digest/eslint-config-typescript": "^4.14.14",
|
|
52
|
+
"@digest/jest-junit": "^4.14.14",
|
|
53
|
+
"@digest/jest-react": "^4.14.14",
|
|
54
|
+
"@digest/jest-typescript": "^4.14.14",
|
|
55
|
+
"@digest/typescript": "^4.14.14",
|
|
56
|
+
"@types/jest": "^30.0.0",
|
|
57
|
+
"@types/node": "^25.2.1",
|
|
58
|
+
"@types/react": "^19.2.13",
|
|
56
59
|
"@types/react-native": "^0.73.0",
|
|
57
60
|
"@types/react-test-renderer": "^19.1.0",
|
|
58
|
-
"cross-env": "^
|
|
59
|
-
"jest-environment-jsdom": "^
|
|
61
|
+
"cross-env": "^10.1.0",
|
|
62
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
60
63
|
"jest-environment-jsdom-global": "^4.0.0",
|
|
61
64
|
"ncp": "^2.0.0",
|
|
62
65
|
"npm-run-all": "^4.1.5",
|
|
63
|
-
"react": "^19.
|
|
64
|
-
"react-native": "^0.
|
|
65
|
-
"react-native-
|
|
66
|
-
"react-
|
|
67
|
-
"
|
|
66
|
+
"react": "^19.2.4",
|
|
67
|
+
"react-native": "^0.83.1",
|
|
68
|
+
"react-native-reanimated": "^4.2.1",
|
|
69
|
+
"react-native-svg": "^15.15.2",
|
|
70
|
+
"react-test-renderer": "^19.2.4",
|
|
71
|
+
"rimraf": "^6.1.2"
|
|
68
72
|
},
|
|
69
73
|
"dependencies": {
|
|
70
|
-
"@lincle/react-shared": "^0.4.0-next.
|
|
74
|
+
"@lincle/react-shared": "^0.4.0-next.18"
|
|
71
75
|
},
|
|
72
76
|
"peerDependencies": {
|
|
73
77
|
"react": "^18.0.0 || ^19.0.0",
|
|
74
|
-
"react-native": "^0.
|
|
78
|
+
"react-native": "^0.83.0",
|
|
79
|
+
"react-native-reanimated": "^4.0.0",
|
|
75
80
|
"react-native-svg": "^15.0.0"
|
|
76
81
|
},
|
|
77
82
|
"keywords": [
|
|
@@ -89,5 +94,5 @@
|
|
|
89
94
|
"acyclical graph",
|
|
90
95
|
"cyclical graph"
|
|
91
96
|
],
|
|
92
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "8c8017797cadc70f9c4a7665982040b192c8e357"
|
|
93
98
|
}
|