@luxonis/depthai-viewer-common 0.0.2 → 0.0.4
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/components/ButtonLink.d.ts +8 -0
- package/dist/components/ButtonLink.d.ts.map +1 -0
- package/dist/components/ButtonLink.js +8 -0
- package/dist/components/ButtonLink.js.map +1 -0
- package/dist/components/CTASubLabel.d.ts +2 -0
- package/dist/components/CTASubLabel.d.ts.map +1 -0
- package/dist/components/CTASubLabel.js +17 -0
- package/dist/components/CTASubLabel.js.map +1 -0
- package/dist/components/Link.d.ts +5 -0
- package/dist/components/Link.d.ts.map +1 -0
- package/dist/components/Link.js +8 -0
- package/dist/components/Link.js.map +1 -0
- package/dist/components/Pipeline.d.ts +3 -0
- package/dist/components/Pipeline.d.ts.map +1 -0
- package/dist/components/Pipeline.js +22 -0
- package/dist/components/Pipeline.js.map +1 -0
- package/dist/components/Resizable.d.ts +10 -0
- package/dist/components/Resizable.d.ts.map +1 -0
- package/dist/components/Resizable.js +12 -0
- package/dist/components/Resizable.js.map +1 -0
- package/dist/components/Streams.d.ts +10 -0
- package/dist/components/Streams.d.ts.map +1 -0
- package/dist/components/Streams.js +80 -0
- package/dist/components/Streams.js.map +1 -0
- package/dist/constants/connection.d.ts +36 -0
- package/dist/constants/connection.d.ts.map +1 -0
- package/dist/constants/connection.js +35 -0
- package/dist/constants/connection.js.map +1 -0
- package/dist/constants/streams.d.ts +13 -0
- package/dist/constants/streams.d.ts.map +1 -0
- package/dist/constants/streams.js +13 -0
- package/dist/constants/streams.js.map +1 -0
- package/dist/constants/url.d.ts +4 -0
- package/dist/constants/url.d.ts.map +1 -0
- package/dist/constants/url.js +4 -0
- package/dist/constants/url.js.map +1 -0
- package/dist/dai-connection/connection.d.ts +55 -0
- package/dist/dai-connection/connection.d.ts.map +1 -0
- package/dist/dai-connection/connection.js +291 -0
- package/dist/dai-connection/connection.js.map +1 -0
- package/dist/dai-connection/decoder.worker.d.ts +16 -0
- package/dist/dai-connection/decoder.worker.d.ts.map +1 -0
- package/dist/dai-connection/decoder.worker.js +24 -0
- package/dist/dai-connection/decoder.worker.js.map +1 -0
- package/dist/hooks/connection.d.ts +30 -0
- package/dist/hooks/connection.d.ts.map +1 -0
- package/dist/hooks/connection.js +145 -0
- package/dist/hooks/connection.js.map +1 -0
- package/dist/hooks/navigation.d.ts +12 -0
- package/dist/hooks/navigation.d.ts.map +1 -0
- package/dist/hooks/navigation.js +15 -0
- package/dist/hooks/navigation.js.map +1 -0
- package/dist/hooks/search.d.ts +11 -0
- package/dist/hooks/search.d.ts.map +1 -0
- package/dist/hooks/search.js +31 -0
- package/dist/hooks/search.js.map +1 -0
- package/{src/index.ts → dist/index.d.ts} +1 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/ConnectionProvider.d.ts +9 -0
- package/dist/providers/ConnectionProvider.d.ts.map +1 -0
- package/dist/providers/ConnectionProvider.js +29 -0
- package/dist/providers/ConnectionProvider.js.map +1 -0
- package/dist/providers/DataProvider.d.ts +13 -0
- package/dist/providers/DataProvider.d.ts.map +1 -0
- package/dist/providers/DataProvider.js +43 -0
- package/dist/providers/DataProvider.js.map +1 -0
- package/dist/utils/arrays.d.ts +2 -0
- package/dist/utils/arrays.d.ts.map +1 -0
- package/dist/utils/arrays.js +11 -0
- package/dist/utils/arrays.js.map +1 -0
- package/dist/utils/dynamic-base-worker.d.ts +8 -0
- package/dist/utils/dynamic-base-worker.d.ts.map +1 -0
- package/dist/utils/dynamic-base-worker.js +19 -0
- package/dist/utils/dynamic-base-worker.js.map +1 -0
- package/dist/utils/functions.d.ts +2 -0
- package/dist/utils/functions.d.ts.map +1 -0
- package/dist/utils/functions.js +4 -0
- package/dist/utils/functions.js.map +1 -0
- package/dist/utils/sorting.d.ts +3 -0
- package/dist/utils/sorting.d.ts.map +1 -0
- package/dist/utils/sorting.js +34 -0
- package/dist/utils/sorting.js.map +1 -0
- package/dist/utils/url.d.ts +5 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/url.js +7 -0
- package/dist/utils/url.js.map +1 -0
- package/package.json +5 -4
- package/src/components/ButtonLink.tsx +0 -12
- package/src/components/CTASubLabel.tsx +0 -39
- package/src/components/Link.tsx +0 -10
- package/src/components/Pipeline.tsx +0 -35
- package/src/components/Resizable.tsx +0 -56
- package/src/components/Streams.tsx +0 -261
- package/src/constants/connection.ts +0 -45
- package/src/constants/streams.ts +0 -12
- package/src/constants/url.ts +0 -6
- package/src/dai-connection/connection.ts +0 -402
- package/src/dai-connection/decoder.worker.ts +0 -47
- package/src/hooks/connection.ts +0 -204
- package/src/hooks/navigation.ts +0 -25
- package/src/hooks/search.ts +0 -45
- package/src/models/device-configuration.ts +0 -27
- package/src/providers/ConnectionProvider.tsx +0 -39
- package/src/providers/DataProvider.tsx +0 -71
- package/src/utils/arrays.ts +0 -10
- package/src/utils/dynamic-base-worker.ts +0 -21
- package/src/utils/functions.ts +0 -3
- package/src/utils/sorting.ts +0 -42
- package/src/utils/url.ts +0 -8
- package/src/window.d.ts +0 -7
- package/tsconfig.json +0 -37
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
export * from './utils/functions.js';
|
|
2
|
-
|
|
3
2
|
export * from './components/ButtonLink.js';
|
|
4
3
|
export * from './components/Link.js';
|
|
5
4
|
export * from './components/Pipeline.js';
|
|
6
5
|
export * from './components/Resizable.js';
|
|
7
6
|
export * from './components/Streams.js';
|
|
8
7
|
export * from './components/CTASubLabel.js';
|
|
9
|
-
|
|
10
8
|
export * from './constants/connection.js';
|
|
11
9
|
export * from './constants/url.js';
|
|
12
|
-
|
|
13
10
|
export * from './dai-connection/connection.js';
|
|
14
11
|
export * from './dai-connection/decoder.worker.js';
|
|
15
|
-
|
|
16
12
|
export * from './hooks/connection.js';
|
|
17
13
|
export * from './hooks/navigation.js';
|
|
18
14
|
export * from './hooks/search.js';
|
|
19
|
-
|
|
20
|
-
export * from './models/device-configuration.js';
|
|
21
|
-
|
|
22
15
|
export * from './utils/dynamic-base-worker.js';
|
|
23
16
|
export * from './utils/functions.js';
|
|
24
17
|
export * from './utils/sorting.js';
|
|
25
18
|
export * from './utils/url.js';
|
|
26
|
-
|
|
27
19
|
export * from './providers/DataProvider.js';
|
|
28
20
|
export * from './providers/ConnectionProvider.js';
|
|
29
21
|
export * from './constants/streams.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AAErC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAElC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from './utils/functions.js';
|
|
2
|
+
export * from './components/ButtonLink.js';
|
|
3
|
+
export * from './components/Link.js';
|
|
4
|
+
export * from './components/Pipeline.js';
|
|
5
|
+
export * from './components/Resizable.js';
|
|
6
|
+
export * from './components/Streams.js';
|
|
7
|
+
export * from './components/CTASubLabel.js';
|
|
8
|
+
export * from './constants/connection.js';
|
|
9
|
+
export * from './constants/url.js';
|
|
10
|
+
export * from './dai-connection/connection.js';
|
|
11
|
+
export * from './dai-connection/decoder.worker.js';
|
|
12
|
+
export * from './hooks/connection.js';
|
|
13
|
+
export * from './hooks/navigation.js';
|
|
14
|
+
export * from './hooks/search.js';
|
|
15
|
+
export * from './utils/dynamic-base-worker.js';
|
|
16
|
+
export * from './utils/functions.js';
|
|
17
|
+
export * from './utils/sorting.js';
|
|
18
|
+
export * from './utils/url.js';
|
|
19
|
+
export * from './providers/DataProvider.js';
|
|
20
|
+
export * from './providers/ConnectionProvider.js';
|
|
21
|
+
export * from './constants/streams.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AAErC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAElC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ConnectionData } from '../hooks/connection.js';
|
|
2
|
+
import type { DAIService } from '../dai-connection/connection.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export declare const ConnectionContext: React.Context<ConnectionData>;
|
|
5
|
+
export declare const ConnectionProvider: React.FC<React.PropsWithChildren<{
|
|
6
|
+
activeServices: DAIService[];
|
|
7
|
+
}>>;
|
|
8
|
+
export declare const useConnection: () => ConnectionData;
|
|
9
|
+
//# sourceMappingURL=ConnectionProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ConnectionProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAElF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,iBAAiB,+BAS5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CACxC,KAAK,CAAC,iBAAiB,CAAC;IAAE,cAAc,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC,CAiBzD,CAAC;AAEF,eAAO,MAAM,aAAa,sBAA4C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { VisualizerContext } from '@luxonis/visualizer-protobuf';
|
|
3
|
+
import { useCreateConnection } from '../hooks/connection.js';
|
|
4
|
+
import { useData } from './DataProvider.js';
|
|
5
|
+
import { noop } from '../utils/functions.js';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
export const ConnectionContext = React.createContext({
|
|
8
|
+
daiConnection: null,
|
|
9
|
+
connected: false,
|
|
10
|
+
topics: [],
|
|
11
|
+
pipeline: undefined,
|
|
12
|
+
isPipelineLoading: false,
|
|
13
|
+
setIsPipelineLoading: noop,
|
|
14
|
+
connections: [],
|
|
15
|
+
toggleTopic: noop,
|
|
16
|
+
});
|
|
17
|
+
export const ConnectionProvider = ({ children, activeServices }) => {
|
|
18
|
+
const { connectionType, wsUrl, token, clientId } = useData();
|
|
19
|
+
const connectionData = useCreateConnection({
|
|
20
|
+
type: connectionType,
|
|
21
|
+
token,
|
|
22
|
+
clientId,
|
|
23
|
+
connectionUrl: wsUrl,
|
|
24
|
+
activeServices,
|
|
25
|
+
});
|
|
26
|
+
return (_jsx(VisualizerContext, { connections: connectionData.connections, children: _jsx(ConnectionContext.Provider, { value: connectionData, children: children }) }));
|
|
27
|
+
};
|
|
28
|
+
export const useConnection = () => React.useContext(ConnectionContext);
|
|
29
|
+
//# sourceMappingURL=ConnectionProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionProvider.js","sourceRoot":"","sources":["../../src/providers/ConnectionProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAuB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAiB;IACpE,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,SAAS;IACnB,iBAAiB,EAAE,KAAK;IACxB,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,IAAI;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAE3B,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,EAAE;IACpC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;IAE7D,MAAM,cAAc,GAAG,mBAAmB,CAAC;QAC1C,IAAI,EAAE,cAAc;QACpB,KAAK;QACL,QAAQ;QACR,aAAa,EAAE,KAAK;QACpB,cAAc;KACd,CAAC,CAAC;IAEH,OAAO,CACN,KAAC,iBAAiB,IAAC,WAAW,EAAE,cAAc,CAAC,WAAW,YACzD,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,YAAG,QAAQ,GAA8B,GACvE,CACpB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type DataContext = {
|
|
3
|
+
columns: number | null;
|
|
4
|
+
changeColumns: (columns: number | null) => void;
|
|
5
|
+
changeWsUrl: (url: string) => void;
|
|
6
|
+
connectionType: 'ws' | 'webrtc';
|
|
7
|
+
wsUrl: string;
|
|
8
|
+
token: string;
|
|
9
|
+
clientId: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const useData: () => DataContext;
|
|
12
|
+
export declare const DataProvider: React.FC<React.PropsWithChildren>;
|
|
13
|
+
//# sourceMappingURL=DataProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataProvider.d.ts","sourceRoot":"","sources":["../../src/providers/DataProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,cAAc,EAAE,IAAI,GAAG,QAAQ,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC;AAYF,eAAO,MAAM,OAAO,mBAAsC,CAAC;AAE3D,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CA2C1D,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DEFAULT_WS_URL, IS_LOCALHOST, LOCALHOST_WS_URL } from '../constants/url.js';
|
|
4
|
+
import { useFlatSearch } from '../hooks/search.js';
|
|
5
|
+
import { noop } from '../utils/functions.js';
|
|
6
|
+
const DataContext = React.createContext({
|
|
7
|
+
columns: null,
|
|
8
|
+
connectionType: 'ws',
|
|
9
|
+
wsUrl: DEFAULT_WS_URL,
|
|
10
|
+
changeColumns: noop,
|
|
11
|
+
changeWsUrl: noop,
|
|
12
|
+
token: '',
|
|
13
|
+
clientId: '',
|
|
14
|
+
});
|
|
15
|
+
export const useData = () => React.useContext(DataContext);
|
|
16
|
+
export const DataProvider = ({ children }) => {
|
|
17
|
+
const { search, updateSearch } = useFlatSearch({
|
|
18
|
+
defaultInit: { layout: '0', t: '', cid: '' },
|
|
19
|
+
});
|
|
20
|
+
const [columns, setColumns] = React.useState(() => {
|
|
21
|
+
return search.layout === '0' ? null : Number(search.layout);
|
|
22
|
+
});
|
|
23
|
+
const [connectionUrl, setConnectionUrl] = React.useState(search.t && search.cid ? '' : IS_LOCALHOST ? LOCALHOST_WS_URL : DEFAULT_WS_URL);
|
|
24
|
+
const changeColumns = React.useCallback((columns) => {
|
|
25
|
+
setColumns(columns);
|
|
26
|
+
updateSearch('layout', columns ?? 0);
|
|
27
|
+
}, [updateSearch]);
|
|
28
|
+
const changeWsUrl = React.useCallback((url) => {
|
|
29
|
+
setConnectionUrl(url);
|
|
30
|
+
updateSearch('t', null);
|
|
31
|
+
updateSearch('cid', null);
|
|
32
|
+
}, [updateSearch]);
|
|
33
|
+
return (_jsx(DataContext.Provider, { value: {
|
|
34
|
+
token: search.t,
|
|
35
|
+
clientId: search.cid,
|
|
36
|
+
wsUrl: connectionUrl,
|
|
37
|
+
connectionType: search.t && search.cid ? 'webrtc' : 'ws',
|
|
38
|
+
columns,
|
|
39
|
+
changeColumns,
|
|
40
|
+
changeWsUrl,
|
|
41
|
+
}, children: children }));
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=DataProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataProvider.js","sourceRoot":"","sources":["../../src/providers/DataProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAY7C,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAc;IACpD,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,IAAI;IACpB,KAAK,EAAE,cAAc;IACrB,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;CACZ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,YAAY,GAAsC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/E,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC;QAC9C,WAAW,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;KAC5C,CAAC,CAAC;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,GAAG,EAAE;QAChE,OAAO,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CACvD,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,CAC9E,CAAC;IAEF,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CACtC,CAAC,OAAsB,EAAE,EAAE;QAC1B,UAAU,CAAC,OAAO,CAAC,CAAC;QACpB,YAAY,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC,EACD,CAAC,YAAY,CAAC,CACd,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACpC,CAAC,GAAW,EAAE,EAAE;QACf,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACtB,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC,EACD,CAAC,YAAY,CAAC,CACd,CAAC;IAEF,OAAO,CACN,KAAC,WAAW,CAAC,QAAQ,IACpB,KAAK,EAAE;YACN,KAAK,EAAE,MAAM,CAAC,CAAW;YACzB,QAAQ,EAAE,MAAM,CAAC,GAAa;YAC9B,KAAK,EAAE,aAAa;YACpB,cAAc,EAAE,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;YACxD,OAAO;YACP,aAAa;YACb,WAAW;SACX,YAEA,QAAQ,GACa,CACvB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../../src/utils/arrays.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,EAAE,EAAE,CASvE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function makeColumns(list, columns) {
|
|
2
|
+
if (!columns) {
|
|
3
|
+
return [list];
|
|
4
|
+
}
|
|
5
|
+
const result = [];
|
|
6
|
+
for (let i = 0; i < list.length; i += columns) {
|
|
7
|
+
result.push(list.slice(i, i + columns));
|
|
8
|
+
}
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=arrays.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../src/utils/arrays.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAI,IAAS,EAAE,OAAsB;IAC/D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class DynamicBaseWorker extends Worker {
|
|
2
|
+
DEBUG_IS_DYNAMIC_POLYFILL: boolean;
|
|
3
|
+
constructor(scriptUrl: string | URL, options?: WorkerOptions & {
|
|
4
|
+
basePath?: string;
|
|
5
|
+
});
|
|
6
|
+
postMessage(message: any, transfer?: Transferable[] | StructuredSerializeOptions): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=dynamic-base-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-base-worker.d.ts","sourceRoot":"","sources":["../../src/utils/dynamic-base-worker.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAkB,SAAQ,MAAM;IACrC,yBAAyB,UAAQ;gBAE5B,SAAS,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAU7E,WAAW,CAEjB,OAAO,EAAE,GAAG,EACZ,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAG,0BAA0B,GACpD,IAAI;CAGP"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class DynamicBaseWorker extends Worker {
|
|
2
|
+
DEBUG_IS_DYNAMIC_POLYFILL = true;
|
|
3
|
+
constructor(scriptUrl, options) {
|
|
4
|
+
const url = new URL(scriptUrl);
|
|
5
|
+
if (options?.basePath !== undefined) {
|
|
6
|
+
url.pathname = `${options.basePath}${url.pathname}`;
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
url.pathname = `${window.__basePath}${url.pathname}`;
|
|
10
|
+
}
|
|
11
|
+
super(url.toString(), options);
|
|
12
|
+
}
|
|
13
|
+
postMessage(
|
|
14
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
15
|
+
message, transfer) {
|
|
16
|
+
super.postMessage(message, transfer);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=dynamic-base-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-base-worker.js","sourceRoot":"","sources":["../../src/utils/dynamic-base-worker.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IACrC,yBAAyB,GAAG,IAAI,CAAC;IAExC,YAAY,SAAuB,EAAE,OAA+C;QACnF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QAC/B,IAAI,OAAO,EAAE,QAAQ,KAAK,SAAS,EAAE,CAAC;YACrC,GAAG,CAAC,QAAQ,GAAG,GAAG,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QACrD,CAAC;aAAM,CAAC;YACP,GAAG,CAAC,QAAQ,GAAG,GAAG,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QACtD,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;IAEM,WAAW;IACjB,4DAA4D;IAC5D,OAAY,EACZ,QAAsD;QAEtD,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,QAAkD,CAAC,CAAC;IAChF,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/utils/functions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,YAEhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/utils/functions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,EAAE;IACxB,WAAW;AACZ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../src/utils/sorting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAcpD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,WA2BlD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StreamTypes } from '../constants/streams.js';
|
|
2
|
+
const PreferredStreamOrder = [
|
|
3
|
+
StreamTypes.Encoded,
|
|
4
|
+
StreamTypes.Raw,
|
|
5
|
+
StreamTypes.Disparity,
|
|
6
|
+
StreamTypes.PointCloud,
|
|
7
|
+
StreamTypes.LeftEncoded,
|
|
8
|
+
StreamTypes.LeftRaw,
|
|
9
|
+
StreamTypes.RightEncoded,
|
|
10
|
+
StreamTypes.RightRaw,
|
|
11
|
+
];
|
|
12
|
+
export function sortStreamsDefault(streams) {
|
|
13
|
+
return streams.sort((a, b) => {
|
|
14
|
+
const indexA = PreferredStreamOrder.indexOf(a.name);
|
|
15
|
+
const indexB = PreferredStreamOrder.indexOf(b.name);
|
|
16
|
+
if (indexA === -1 && indexB === -1) {
|
|
17
|
+
if (indexA === -1) {
|
|
18
|
+
console.warn('No index for stream', a.name);
|
|
19
|
+
}
|
|
20
|
+
if (indexB === -1) {
|
|
21
|
+
console.warn('No index for stream', b.name);
|
|
22
|
+
}
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
if (indexA === -1) {
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
if (indexB === -1) {
|
|
29
|
+
return -1;
|
|
30
|
+
}
|
|
31
|
+
return indexA - indexB;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=sorting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sorting.js","sourceRoot":"","sources":["../../src/utils/sorting.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,oBAAoB,GAAa;IACtC,WAAW,CAAC,OAAO;IACnB,WAAW,CAAC,GAAG;IACf,WAAW,CAAC,SAAS;IACrB,WAAW,CAAC,UAAU;IACtB,WAAW,CAAC,WAAW;IACvB,WAAW,CAAC,OAAO;IACnB,WAAW,CAAC,YAAY;IACxB,WAAW,CAAC,QAAQ;CACpB,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IAClD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAEpD,IAAI,MAAM,KAAK,CAAC,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACpC,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;gBACnB,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;YAC7C,CAAC;YAED,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;gBACnB,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;YAC7C,CAAC;YAED,OAAO,CAAC,CAAC;QACV,CAAC;QAED,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACnB,OAAO,CAAC,CAAC;QACV,CAAC;QAED,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACnB,OAAO,CAAC,CAAC,CAAC;QACX,CAAC;QAED,OAAO,MAAM,GAAG,MAAM,CAAC;IACxB,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM;;;EAOxC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function parseUrl(pathname) {
|
|
2
|
+
const segments = pathname.split('/').filter(Boolean);
|
|
3
|
+
const page = segments.at(-1) === 'pipeline' ? 'pipeline' : 'streams';
|
|
4
|
+
const basePath = segments.slice(0, page === 'pipeline' ? -1 : undefined).join('/');
|
|
5
|
+
return { basePath, page };
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAC,QAAgB;IACxC,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IAErE,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxonis/depthai-viewer-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Common utilities and components for building a frontend application for DepthAI projects",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Luxonis Holding Corporation",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "index.js",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./dist/index.js"
|
|
11
11
|
},
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
"@luxonis/visualizer-protobuf": "^2.31.0",
|
|
22
22
|
"@luxonis/depthai-pipeline-lib": "^1.4.8",
|
|
23
23
|
"@luxonis/common-fe-components": "1.14.0",
|
|
24
|
-
"@luxonis/common-fe-utils": "1.
|
|
24
|
+
"@luxonis/common-fe-utils": "1.20.0",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
|
-
"zod": "^3.24.3"
|
|
26
|
+
"zod": "^3.24.3",
|
|
27
|
+
"react-resizable-panels": "^2.1.3"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"react": "^18.3.1",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { Button, type ButtonProps } from '@luxonis/common-fe-components';
|
|
3
|
-
import { Link, type LinkProps } from './Link.js';
|
|
4
|
-
|
|
5
|
-
export type ButtonLinkProps = ButtonProps & {
|
|
6
|
-
linkProps: LinkProps;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const ButtonLink: React.FC<ButtonLinkProps> = ({ linkProps, ...buttonProps }) => {
|
|
10
|
-
const button = <Button {...buttonProps} />;
|
|
11
|
-
return !buttonProps.disabled ? <Link {...linkProps}>{button}</Link> : button;
|
|
12
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ExternalLink, Flex, SubLabel } from '@luxonis/common-fe-components';
|
|
2
|
-
import { useConnection } from '../providers/ConnectionProvider.js';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
const DISPLAY_LABEL_TIMEOUT = 30_000 as const;
|
|
6
|
-
|
|
7
|
-
export const CTASubLabel = () => {
|
|
8
|
-
const { connected, topics } = useConnection();
|
|
9
|
-
const [shouldDisplayLabel, setShouldDisplayLabel] = React.useState(false);
|
|
10
|
-
React.useEffect(() => {
|
|
11
|
-
if (connected && topics.length === 0 && !shouldDisplayLabel) {
|
|
12
|
-
const timeout = setTimeout(() => setShouldDisplayLabel(true), DISPLAY_LABEL_TIMEOUT);
|
|
13
|
-
return () => clearTimeout(timeout);
|
|
14
|
-
}
|
|
15
|
-
}, [connected, topics, shouldDisplayLabel]);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
shouldDisplayLabel && (
|
|
19
|
-
<Flex textAlign="center">
|
|
20
|
-
<SubLabel
|
|
21
|
-
text={
|
|
22
|
-
<p>
|
|
23
|
-
You can purchase an OAK camera from the{' '}
|
|
24
|
-
<ExternalLink raw to="https://shop.luxonis.com" color="light.active">
|
|
25
|
-
<SubLabel color="link" text="Luxonis Store" />
|
|
26
|
-
</ExternalLink>
|
|
27
|
-
. After your purchase,
|
|
28
|
-
<br /> explore the{' '}
|
|
29
|
-
<ExternalLink raw to="https://rvc4.docs.luxonis.com/hardware" color="light.active">
|
|
30
|
-
<SubLabel color="link" text="Luxonis Documentation" />
|
|
31
|
-
</ExternalLink>{' '}
|
|
32
|
-
for comprehensive setup tutorials to get started.
|
|
33
|
-
</p>
|
|
34
|
-
}
|
|
35
|
-
/>
|
|
36
|
-
</Flex>
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
|
-
};
|
package/src/components/Link.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Link as _Link } from 'react-router-dom';
|
|
2
|
-
import { useNavigation } from '../hooks/navigation.js';
|
|
3
|
-
|
|
4
|
-
export type LinkProps = { to: 'pipeline' | 'streams' };
|
|
5
|
-
|
|
6
|
-
export const Link: React.FC<React.PropsWithChildren<LinkProps>> = ({ to, children }) => {
|
|
7
|
-
const { makePath } = useNavigation();
|
|
8
|
-
|
|
9
|
-
return <_Link to={makePath(to)}>{children}</_Link>;
|
|
10
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Flex, Header } from '@luxonis/common-fe-components';
|
|
2
|
-
import { PipelineCanvas } from '@luxonis/depthai-pipeline-lib';
|
|
3
|
-
import { useConnection } from '../providers/ConnectionProvider.js';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
const PIPELINE_LOADING_TIMEOUT = 60_000;
|
|
7
|
-
|
|
8
|
-
export const Pipeline: React.FC = () => {
|
|
9
|
-
const { pipeline, isPipelineLoading, setIsPipelineLoading } = useConnection();
|
|
10
|
-
|
|
11
|
-
React.useEffect(() => {
|
|
12
|
-
if (isPipelineLoading && pipeline === undefined) {
|
|
13
|
-
const timeout = setTimeout(() => {
|
|
14
|
-
setIsPipelineLoading(false);
|
|
15
|
-
}, PIPELINE_LOADING_TIMEOUT);
|
|
16
|
-
return () => clearTimeout(timeout);
|
|
17
|
-
}
|
|
18
|
-
}, [isPipelineLoading, pipeline, setIsPipelineLoading]);
|
|
19
|
-
|
|
20
|
-
if (isPipelineLoading) {
|
|
21
|
-
return (
|
|
22
|
-
<Flex align="center" justify="center" full>
|
|
23
|
-
<Header text="Loading pipeline..." />
|
|
24
|
-
</Flex>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return pipeline === undefined ? (
|
|
29
|
-
<Flex align="center" justify="center" full>
|
|
30
|
-
<Header text="Pipeline is not available" />
|
|
31
|
-
</Flex>
|
|
32
|
-
) : (
|
|
33
|
-
<PipelineCanvas pipeline={pipeline} height="full" />
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
|
|
3
|
-
|
|
4
|
-
export type ResizableItem = {
|
|
5
|
-
component: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type ResizableLayoutProps = {
|
|
9
|
-
id?: string | null;
|
|
10
|
-
items: ResizableItem[][];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const ResizableLayout: React.FC<ResizableLayoutProps> = ({
|
|
14
|
-
items,
|
|
15
|
-
id = 'resizable-layout',
|
|
16
|
-
}) => {
|
|
17
|
-
const groupStyles: React.CSSProperties = React.useMemo(
|
|
18
|
-
() => ({
|
|
19
|
-
display: 'flex',
|
|
20
|
-
gap: '5px',
|
|
21
|
-
}),
|
|
22
|
-
[],
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const panels = React.useMemo(
|
|
26
|
-
() =>
|
|
27
|
-
items.map((row, rowIndex) => (
|
|
28
|
-
<React.Fragment key={`resizable-row-${rowIndex}`}>
|
|
29
|
-
<Panel order={rowIndex}>
|
|
30
|
-
<PanelGroup
|
|
31
|
-
autoSaveId={id && `${id}-${rowIndex}`}
|
|
32
|
-
direction="horizontal"
|
|
33
|
-
style={groupStyles}
|
|
34
|
-
>
|
|
35
|
-
{row.map((item, itemIndex) => (
|
|
36
|
-
<React.Fragment key={`resizable-row-${rowIndex}-item-${itemIndex}`}>
|
|
37
|
-
<Panel order={itemIndex} style={{ display: 'flex' }}>
|
|
38
|
-
{item.component}
|
|
39
|
-
</Panel>
|
|
40
|
-
{itemIndex !== row.length - 1 && <PanelResizeHandle />}
|
|
41
|
-
</React.Fragment>
|
|
42
|
-
))}
|
|
43
|
-
</PanelGroup>
|
|
44
|
-
</Panel>
|
|
45
|
-
{rowIndex !== items.length - 1 && <PanelResizeHandle />}
|
|
46
|
-
</React.Fragment>
|
|
47
|
-
)),
|
|
48
|
-
[groupStyles, id, items],
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<PanelGroup autoSaveId={id} direction="vertical" style={groupStyles}>
|
|
53
|
-
{panels}
|
|
54
|
-
</PanelGroup>
|
|
55
|
-
);
|
|
56
|
-
};
|