@luxonis/depthai-pipeline-lib 1.4.11 → 1.4.13
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { NodeProps } from '@xyflow/react';
|
|
3
|
-
import type
|
|
3
|
+
import { type ParsedNode } from '../services/pipeline.js';
|
|
4
4
|
export type PipelineNodeProps = NodeProps<ParsedNode>;
|
|
5
5
|
export declare const PipelineNode: React.FC<PipelineNodeProps>;
|
|
@@ -3,7 +3,7 @@ import { Handle, Position } from '@xyflow/react';
|
|
|
3
3
|
import { clsx } from '@luxonis/common-fe-components/helpers';
|
|
4
4
|
import { Button, Flex, HelpIcon, Label, SubLabel } from '@luxonis/common-fe-components';
|
|
5
5
|
import { css } from '../styled-system/css/css.mjs';
|
|
6
|
-
|
|
6
|
+
import { DOCS_BASE_URL, NodesWithLinks, } from '../services/pipeline.js';
|
|
7
7
|
const NodeHandles = props => {
|
|
8
8
|
const { handles, type } = props;
|
|
9
9
|
return (_jsx(Flex, { full: true, direction: "column", align: type === 'input' ? 'start' : 'end', children: handles.map(({ type: handleType, id, blocking, queueSize, name }) => (_jsxs(Flex, { position: "relative", align: "end", direction: handleType === 'input' ? 'row' : 'row-reverse', children: [_jsx(Handle, { type: handleType === 'input' ? 'target' : 'source', position: handleType === 'input' ? Position.Left : Position.Right, id: name, isConnectable: false, className: css({
|
|
@@ -19,6 +19,10 @@ const NodeHandles = props => {
|
|
|
19
19
|
};
|
|
20
20
|
export const PipelineNode = props => {
|
|
21
21
|
const { data: node } = props;
|
|
22
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
23
|
+
const link = NodesWithLinks.hasOwnProperty(node.name)
|
|
24
|
+
? `${DOCS_BASE_URL}/${NodesWithLinks[node.name]}`
|
|
25
|
+
: DOCS_BASE_URL;
|
|
22
26
|
return (_jsxs(Flex, { direction: "column", className: css({
|
|
23
27
|
'minWidth': 'container.smaller.xxs',
|
|
24
28
|
'border': 'base',
|
|
@@ -34,7 +38,7 @@ export const PipelineNode = props => {
|
|
|
34
38
|
}), children: [_jsx("span", { className: css({
|
|
35
39
|
width: 'icon.sm',
|
|
36
40
|
height: 'icon.sm',
|
|
37
|
-
}) }), _jsx(Label, { text: node.name, color: "unset" }), _jsx(Button, { variant: "ghost", color: "transparent", icon: HelpIcon, onClick: () => window.open(
|
|
41
|
+
}) }), _jsx(Label, { text: node.name, color: "unset" }), _jsx(Button, { variant: "ghost", color: "transparent", icon: HelpIcon, onClick: () => window.open(link, '_blank'), className: clsx('node-help-icon', css({
|
|
38
42
|
width: 'auto',
|
|
39
43
|
height: 'auto',
|
|
40
44
|
right: 'xs',
|
|
@@ -49,16 +49,21 @@ const PipelineCanvasBody = ({ pipeline, ...flexProps }) => {
|
|
|
49
49
|
const layouted = getLayoutedElements(pipeline?.nodes ?? [], pipeline?.edges ?? []);
|
|
50
50
|
setNodes([...layouted.nodes]);
|
|
51
51
|
setEdges([...layouted.edges]);
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
}, [pipeline?.edges, pipeline?.nodes, setEdges, setNodes]);
|
|
53
|
+
const setViewportAndFit = async (x, y, zoom, nds) => {
|
|
54
|
+
await setViewport({ x, y, zoom });
|
|
55
|
+
await fitView({ nodes: nds });
|
|
56
|
+
};
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
if (!autoArrangeRef.current) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (nodes.length > 0 && edges.length > 0) {
|
|
54
62
|
const viewport = getViewport();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}, [fitView, getViewport, pipeline?.edges, pipeline?.nodes, setEdges, setNodes, setViewport]);
|
|
63
|
+
void setViewportAndFit(viewport.x, viewport.y, viewport.zoom, nodes);
|
|
64
|
+
}
|
|
65
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
|
+
}, [nodes, edges]);
|
|
62
67
|
return (_jsxs(Flex, { align: "center", justify: "center", full: true, height: "container.xs", rounded: "common", border: "base", ...flexProps, children: [!pipeline && _jsx(Header, { text: "Loading pipeline..." }), pipeline && (_jsx(ReactFlow, { nodes: nodes, edges: edges, onNodeDragStart: () => (autoArrangeRef.current = false), onNodesChange: onNodesChange, fitView: true, nodeTypes: { generic: PipelineNode }, minZoom: 0.4 }))] }));
|
|
63
68
|
};
|
|
64
69
|
export const PipelineCanvas = props => (_jsx(ReactFlowProvider, { children: _jsx(PipelineCanvasBody, { ...props }) }));
|
|
@@ -49,3 +49,29 @@ export type ParsedNode = Node<{
|
|
|
49
49
|
};
|
|
50
50
|
}>;
|
|
51
51
|
export declare function parsePipeline(rawPayload: RawPipelinePayload): Pipeline;
|
|
52
|
+
export declare const DOCS_BASE_URL = "https://docs.luxonis.com/software-v3/depthai/depthai-components/nodes";
|
|
53
|
+
export declare const NodesWithLinks: {
|
|
54
|
+
AprilTag: string;
|
|
55
|
+
BenchmarkIn: string;
|
|
56
|
+
BenchmarkOut: string;
|
|
57
|
+
Camera: string;
|
|
58
|
+
DetectionNetwork: string;
|
|
59
|
+
EdgeDetector: string;
|
|
60
|
+
SpatialDetectionNetwork: string;
|
|
61
|
+
FeatureTracker: string;
|
|
62
|
+
ImageAlign: string;
|
|
63
|
+
ImageManip: string;
|
|
64
|
+
IMU: string;
|
|
65
|
+
NeuralNetwork: string;
|
|
66
|
+
ObjectTracker: string;
|
|
67
|
+
RGBD: string;
|
|
68
|
+
Script: string;
|
|
69
|
+
SpatialLocationCalculator: string;
|
|
70
|
+
StereoDepth: string;
|
|
71
|
+
Sync: string;
|
|
72
|
+
SystemLogger: string;
|
|
73
|
+
Thermal: string;
|
|
74
|
+
ToF: string;
|
|
75
|
+
VideoEncoder: string;
|
|
76
|
+
Warp: string;
|
|
77
|
+
};
|
|
@@ -38,3 +38,29 @@ export function parsePipeline(rawPayload) {
|
|
|
38
38
|
})) ?? [];
|
|
39
39
|
return { nodes, edges };
|
|
40
40
|
}
|
|
41
|
+
export const DOCS_BASE_URL = `https://docs.luxonis.com/software-v3/depthai/depthai-components/nodes`;
|
|
42
|
+
export const NodesWithLinks = {
|
|
43
|
+
AprilTag: 'april_tag',
|
|
44
|
+
BenchmarkIn: 'benchmark_in',
|
|
45
|
+
BenchmarkOut: 'benchmark_out',
|
|
46
|
+
Camera: 'camera',
|
|
47
|
+
DetectionNetwork: 'detection_network',
|
|
48
|
+
EdgeDetector: 'edge_detector',
|
|
49
|
+
SpatialDetectionNetwork: 'spatial_detection_network',
|
|
50
|
+
FeatureTracker: 'feature_tracker',
|
|
51
|
+
ImageAlign: 'image_align',
|
|
52
|
+
ImageManip: 'image_manip',
|
|
53
|
+
IMU: 'imu',
|
|
54
|
+
NeuralNetwork: 'neural_network',
|
|
55
|
+
ObjectTracker: 'object_tracker',
|
|
56
|
+
RGBD: 'rgbd',
|
|
57
|
+
Script: 'script',
|
|
58
|
+
SpatialLocationCalculator: 'spatial_location_calculator',
|
|
59
|
+
StereoDepth: 'stereo_depth',
|
|
60
|
+
Sync: 'sync',
|
|
61
|
+
SystemLogger: 'system_logger',
|
|
62
|
+
Thermal: 'thermal',
|
|
63
|
+
ToF: 'tof',
|
|
64
|
+
VideoEncoder: 'video_encoder',
|
|
65
|
+
Warp: 'warp',
|
|
66
|
+
};
|