@luxonis/depthai-pipeline-lib 3.7.6 → 3.8.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/dist/index.css CHANGED
@@ -909,6 +909,9 @@
909
909
  .border-black {
910
910
  border-color: var(--color-black);
911
911
  }
912
+ .border-border {
913
+ border-color: var(--lux-border);
914
+ }
912
915
  .border-transparent {
913
916
  border-color: transparent;
914
917
  }
@@ -981,6 +984,12 @@
981
984
  background-color: color-mix(in oklab, var(--color-black) 50%, transparent);
982
985
  }
983
986
  }
987
+ .bg-border {
988
+ background-color: var(--lux-border);
989
+ }
990
+ .bg-card {
991
+ background-color: var(--lux-card);
992
+ }
984
993
  .bg-transparent {
985
994
  background-color: transparent;
986
995
  }
@@ -1201,6 +1210,9 @@
1201
1210
  .text-black {
1202
1211
  color: var(--color-black);
1203
1212
  }
1213
+ .text-border {
1214
+ color: var(--lux-border);
1215
+ }
1204
1216
  .text-inherit {
1205
1217
  color: inherit;
1206
1218
  }
@@ -1429,6 +1441,12 @@
1429
1441
  rotate: 180deg;
1430
1442
  }
1431
1443
  }
1444
+ html.dark .react-flow__attribution {
1445
+ background: var(--lux-surface-raised, #1a2437);
1446
+ }
1447
+ html.dark .react-flow__attribution a {
1448
+ color: var(--lux-muted-foreground, #98a2b3);
1449
+ }
1432
1450
  @property --tw-translate-x {
1433
1451
  syntax: "*";
1434
1452
  inherits: false;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Flex, Header } from '@luxonis/ui-components';
3
3
  import { BezierEdge, Panel, ReactFlow, ReactFlowProvider, useEdgesState, useNodesState, useReactFlow, useStore, } from '@xyflow/react';
4
4
  import React from 'react';
5
+ import { useColorMode } from '../services/use-color-mode.js';
5
6
  import { adjustNodes, getLayoutedElements, updateNodesOnPipelineStateChange, } from '../services/utils.js';
6
7
  import { BridgeEdge } from './BridgeEdge.js';
7
8
  import { PipelineNode } from './Node.js';
@@ -15,6 +16,7 @@ const PipelineCanvasBody = ({ pipeline, pipelineState: pipelineStateParsed, head
15
16
  const reactFlowHeight = useStore((state) => state.height);
16
17
  const [shouldFitAndResize, setShouldFitAndResize] = React.useState(false);
17
18
  const [openLegend, setOpenLegend] = React.useState(false);
19
+ const colorMode = useColorMode();
18
20
  const pipelineState = React.useMemo(() => pipelineStateParsed, [pipelineStateParsed]);
19
21
  const layoutSignature = React.useMemo(() => {
20
22
  if (!pipeline) {
@@ -66,6 +68,6 @@ const PipelineCanvasBody = ({ pipeline, pipelineState: pipelineStateParsed, head
66
68
  setShouldFitAndResize(false);
67
69
  }
68
70
  }, [shouldFitAndResize]);
69
- return (_jsxs(Flex, { align: "center", justify: "center", full: true, className: "border border-border rounded-sm", children: [!pipeline && _jsx(Header, { text: "Loading pipeline..." }), pipeline && (_jsxs(ReactFlow, { nodes: nodes, edges: edges, onNodeDragStart: () => (autoArrangeRef.current = false), onNodesChange: onNodesChange, fitView: true, nodeTypes: nodeTypes, edgeTypes: edgeTypes, minZoom: 0.4, children: [header && _jsx(Panel, { position: "top-center", children: header }), _jsx(Panel, { position: "top-right", children: _jsxs(Flex, { gap: "xs", direction: "column", children: [_jsx(Button, { onClick: () => setOpenLegend(!openLegend), label: openLegend ? 'Collapse' : 'Legend' }), openLegend && _jsx(PipelineLegend, { isDebugging: isDebugging })] }) })] }))] }));
71
+ return (_jsxs(Flex, { align: "center", justify: "center", full: true, className: "border border-border rounded-sm", children: [!pipeline && _jsx(Header, { text: "Loading pipeline..." }), pipeline && (_jsxs(ReactFlow, { nodes: nodes, edges: edges, onNodeDragStart: () => (autoArrangeRef.current = false), onNodesChange: onNodesChange, fitView: true, nodeTypes: nodeTypes, edgeTypes: edgeTypes, minZoom: 0.4, colorMode: colorMode, children: [header && _jsx(Panel, { position: "top-center", children: header }), _jsx(Panel, { position: "top-right", children: _jsxs(Flex, { gap: "xs", direction: "column", children: [_jsx(Button, { onClick: () => setOpenLegend(!openLegend), label: openLegend ? 'Collapse' : 'Legend' }), openLegend && _jsx(PipelineLegend, { isDebugging: isDebugging })] }) })] }))] }));
70
72
  };
71
73
  export const PipelineCanvas = (props) => (_jsx(ReactFlowProvider, { children: _jsx(PipelineCanvasBody, { ...props }) }));
@@ -199,5 +199,5 @@ export const PipelineLegend = ({ isDebugging }) => {
199
199
  bridgeSection,
200
200
  ]
201
201
  : sharedSections;
202
- return (_jsxs(Flex, { direction: "column", gap: "xs", className: "w-full max-w-[390px] bg-white border border-border rounded-sm p-4", children: [_jsx(Label, { text: "Legend", color: "black", weight: "medium", align: "center" }), _jsx(Flex, { direction: "column", gap: "xs", className: "w-full", children: sections.map((section) => (_jsx(LegendSection, { title: section.title, items: section.items }, section.title))) }), _jsx(SubLabel, { text: `v${PACKAGE_VERSION}`, color: "lightGray", align: "right" })] }));
202
+ return (_jsxs(Flex, { direction: "column", gap: "xs", className: "w-full max-w-[390px] bg-card border border-border rounded-sm p-4", children: [_jsx(Label, { text: "Legend", color: "normal", weight: "medium", align: "center" }), _jsx(Flex, { direction: "column", gap: "xs", className: "w-full", children: sections.map((section) => (_jsx(LegendSection, { title: section.title, items: section.items }, section.title))) }), _jsx(SubLabel, { text: `v${PACKAGE_VERSION}`, color: "lightGray", align: "right" })] }));
203
203
  };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tracks the host app's theme by watching the `dark` class on <html>.
3
+ *
4
+ * React Flow keeps its dark tokens under `.react-flow.dark`, which it only applies when
5
+ * given `colorMode`. Without this the canvas stays light-themed inside a dark app — most
6
+ * visibly the attribution pill, which renders 50%-white with #999 text.
7
+ *
8
+ * Implemented locally rather than imported from packages/common so this published library
9
+ * stays free of workspace coupling.
10
+ */
11
+ export declare function useColorMode(): 'light' | 'dark';
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ /**
3
+ * Tracks the host app's theme by watching the `dark` class on <html>.
4
+ *
5
+ * React Flow keeps its dark tokens under `.react-flow.dark`, which it only applies when
6
+ * given `colorMode`. Without this the canvas stays light-themed inside a dark app — most
7
+ * visibly the attribution pill, which renders 50%-white with #999 text.
8
+ *
9
+ * Implemented locally rather than imported from packages/common so this published library
10
+ * stays free of workspace coupling.
11
+ */
12
+ export function useColorMode() {
13
+ const read = React.useCallback(() => {
14
+ if (typeof document === 'undefined')
15
+ return 'light';
16
+ return document.documentElement.classList.contains('dark') ? 'dark' : 'light';
17
+ }, []);
18
+ const [colorMode, setColorMode] = React.useState(read);
19
+ React.useEffect(() => {
20
+ if (typeof document === 'undefined')
21
+ return;
22
+ setColorMode(read());
23
+ const observer = new MutationObserver(() => setColorMode(read()));
24
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
25
+ return () => observer.disconnect();
26
+ }, [read]);
27
+ return colorMode;
28
+ }
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "3.7.6";
1
+ export declare const PACKAGE_VERSION = "3.8.1";
@@ -1,2 +1,2 @@
1
1
  // Do not edit it manually.
2
- export const PACKAGE_VERSION = '3.7.6';
2
+ export const PACKAGE_VERSION = '3.8.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxonis/depthai-pipeline-lib",
3
- "version": "3.7.6",
3
+ "version": "3.8.1",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "main": "./dist/src/index.js",