@luxonis/depthai-viewer-common 3.8.2 → 3.9.0
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/README.md +104 -11
- package/dist/components/CTASubLabel.d.ts +10 -2
- package/dist/components/CTASubLabel.d.ts.map +1 -1
- package/dist/components/CTASubLabel.js +3 -0
- package/dist/components/CTASubLabel.js.map +1 -1
- package/dist/components/DepthAIContext.d.ts +25 -2
- package/dist/components/DepthAIContext.d.ts.map +1 -1
- package/dist/components/DepthAIContext.js +3 -0
- package/dist/components/DepthAIContext.js.map +1 -1
- package/dist/components/Pipeline.d.ts +19 -2
- package/dist/components/Pipeline.d.ts.map +1 -1
- package/dist/components/Pipeline.js +12 -0
- package/dist/components/Pipeline.js.map +1 -1
- package/dist/components/Resizable.d.ts +20 -0
- package/dist/components/Resizable.d.ts.map +1 -1
- package/dist/components/Resizable.js +8 -0
- package/dist/components/Resizable.js.map +1 -1
- package/dist/components/Streams.d.ts +98 -4
- package/dist/components/Streams.d.ts.map +1 -1
- package/dist/components/Streams.js +8 -0
- package/dist/components/Streams.js.map +1 -1
- package/dist/components/ThemeToggle.d.ts +8 -0
- package/dist/components/ThemeToggle.d.ts.map +1 -1
- package/dist/components/ThemeToggle.js +8 -0
- package/dist/components/ThemeToggle.js.map +1 -1
- package/dist/constants/connection.d.ts +28 -0
- package/dist/constants/connection.d.ts.map +1 -1
- package/dist/constants/connection.js +13 -0
- package/dist/constants/connection.js.map +1 -1
- package/dist/constants/streams.d.ts +9 -0
- package/dist/constants/streams.d.ts.map +1 -1
- package/dist/constants/streams.js +6 -0
- package/dist/constants/streams.js.map +1 -1
- package/dist/constants/url.d.ts +12 -0
- package/dist/constants/url.d.ts.map +1 -1
- package/dist/constants/url.js +12 -0
- package/dist/constants/url.js.map +1 -1
- package/dist/dai-connection/connection.d.ts +189 -2
- package/dist/dai-connection/connection.d.ts.map +1 -1
- package/dist/dai-connection/connection.js +121 -5
- package/dist/dai-connection/connection.js.map +1 -1
- package/dist/dai-connection/decoder.worker.d.ts +21 -0
- package/dist/dai-connection/decoder.worker.d.ts.map +1 -1
- package/dist/dai-connection/decoder.worker.js +6 -0
- package/dist/dai-connection/decoder.worker.js.map +1 -1
- package/dist/hooks/connection.d.ts +206 -0
- package/dist/hooks/connection.d.ts.map +1 -1
- package/dist/hooks/connection.js +22 -0
- package/dist/hooks/connection.js.map +1 -1
- package/dist/hooks/navigation.d.ts +5 -0
- package/dist/hooks/navigation.d.ts.map +1 -1
- package/dist/hooks/navigation.js +5 -0
- package/dist/hooks/navigation.js.map +1 -1
- package/dist/hooks/search.d.ts +12 -0
- package/dist/hooks/search.d.ts.map +1 -1
- package/dist/hooks/search.js +3 -0
- package/dist/hooks/search.js.map +1 -1
- package/dist/hooks/useFullScreen.d.ts +8 -0
- package/dist/hooks/useFullScreen.d.ts.map +1 -1
- package/dist/hooks/useFullScreen.js +8 -0
- package/dist/hooks/useFullScreen.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/models/device-configuration.d.ts +69 -0
- package/dist/models/device-configuration.d.ts.map +1 -1
- package/dist/models/device-configuration.js +21 -0
- package/dist/models/device-configuration.js.map +1 -1
- package/dist/providers/ConnectionProvider.d.ts +56 -2
- package/dist/providers/ConnectionProvider.d.ts.map +1 -1
- package/dist/providers/ConnectionProvider.js +26 -0
- package/dist/providers/ConnectionProvider.js.map +1 -1
- package/dist/providers/DataProvider.d.ts +129 -0
- package/dist/providers/DataProvider.d.ts.map +1 -1
- package/dist/providers/DataProvider.js +21 -0
- package/dist/providers/DataProvider.js.map +1 -1
- package/dist/providers/ThemeProvider.d.ts +67 -7
- package/dist/providers/ThemeProvider.d.ts.map +1 -1
- package/dist/providers/ThemeProvider.js +39 -2
- package/dist/providers/ThemeProvider.js.map +1 -1
- package/dist/providers/VisualizerRuntimeConfigProvider.d.ts +43 -3
- package/dist/providers/VisualizerRuntimeConfigProvider.d.ts.map +1 -1
- package/dist/providers/VisualizerRuntimeConfigProvider.js +20 -3
- package/dist/providers/VisualizerRuntimeConfigProvider.js.map +1 -1
- package/dist/utils/arrays.d.ts +7 -0
- package/dist/utils/arrays.d.ts.map +1 -1
- package/dist/utils/arrays.js +7 -0
- package/dist/utils/arrays.js.map +1 -1
- package/dist/utils/functions.d.ts +3 -0
- package/dist/utils/functions.d.ts.map +1 -1
- package/dist/utils/functions.js +3 -0
- package/dist/utils/functions.js.map +1 -1
- package/dist/utils/local-storage.d.ts +20 -0
- package/dist/utils/local-storage.d.ts.map +1 -1
- package/dist/utils/local-storage.js +17 -0
- package/dist/utils/local-storage.js.map +1 -1
- package/dist/utils/logger.d.ts +31 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +36 -7
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/sorting.d.ts +6 -0
- package/dist/utils/sorting.d.ts.map +1 -1
- package/dist/utils/sorting.js +6 -0
- package/dist/utils/sorting.js.map +1 -1
- package/dist/utils/topic.d.ts +6 -0
- package/dist/utils/topic.d.ts.map +1 -1
- package/dist/utils/topic.js +3 -0
- package/dist/utils/topic.js.map +1 -1
- package/dist/utils/units.d.ts +24 -0
- package/dist/utils/units.d.ts.map +1 -1
- package/dist/utils/units.js +24 -0
- package/dist/utils/units.js.map +1 -1
- package/dist/utils/url.d.ts +9 -0
- package/dist/utils/url.d.ts.map +1 -1
- package/dist/utils/url.js +10 -1
- package/dist/utils/url.js.map +1 -1
- package/dist/utils/vite-dev-fix.d.ts +13 -0
- package/dist/utils/vite-dev-fix.d.ts.map +1 -1
- package/dist/utils/vite-dev-fix.js +13 -0
- package/dist/utils/vite-dev-fix.js.map +1 -1
- package/package.json +2 -2
- package/protobuf-gen.sh +60 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-configuration.d.ts","sourceRoot":"","sources":["../../src/models/device-configuration.ts"],"names":[],"mappings":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AC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IACjC;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,EAAE,EAAE,EAAE,CAAC;IACP;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;IAC9C;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAYnE,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DeviceListSchema } from '@luxonis/ui-components';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Runtime validation schema for camera sensor metadata reported by a DepthAI device.
|
|
5
|
+
*/
|
|
3
6
|
export const SensorSchema = z.object({
|
|
4
7
|
boardSocket: z.string(),
|
|
5
8
|
maxFps: z.number(),
|
|
@@ -7,22 +10,40 @@ export const SensorSchema = z.object({
|
|
|
7
10
|
type: z.string(),
|
|
8
11
|
supportedResolutions: z.array(z.object({ width: z.number(), height: z.number() })),
|
|
9
12
|
});
|
|
13
|
+
/**
|
|
14
|
+
* Runtime validation schema for infrared emitter availability.
|
|
15
|
+
*/
|
|
10
16
|
export const IrSchema = z.object({
|
|
11
17
|
floodLight: z.boolean(),
|
|
12
18
|
dotProjector: z.boolean(),
|
|
13
19
|
});
|
|
20
|
+
/**
|
|
21
|
+
* Runtime validation schema for supported DepthAI platform identifiers.
|
|
22
|
+
*/
|
|
14
23
|
export const PlatformSchema = z.enum(['RVC2', 'RVC4', 'UNKNOWN']);
|
|
24
|
+
/**
|
|
25
|
+
* Human-readable labels for DepthAI platform identifiers.
|
|
26
|
+
*/
|
|
15
27
|
export const PLATFORM_NAMES = {
|
|
16
28
|
RVC2: 'RVC2',
|
|
17
29
|
RVC4: 'RVC4',
|
|
18
30
|
UNKNOWN: 'Unknown',
|
|
19
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* UI color intents associated with DepthAI platform identifiers.
|
|
34
|
+
*/
|
|
20
35
|
export const PLATFORM_COLORS = {
|
|
21
36
|
RVC2: 'active',
|
|
22
37
|
RVC4: 'success',
|
|
23
38
|
UNKNOWN: 'gray',
|
|
24
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Runtime validation schema for device connection transport identifiers.
|
|
42
|
+
*/
|
|
25
43
|
export const ConnectionTypeSchema = z.enum(['USB', 'ETH', 'UNKNOWN']);
|
|
44
|
+
/**
|
|
45
|
+
* Runtime validation schema for normalized DepthAI device configuration.
|
|
46
|
+
*/
|
|
26
47
|
export const DeviceConfigurationSchema = z.object({
|
|
27
48
|
cameraSensors: z.array(SensorSchema),
|
|
28
49
|
ir: IrSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-configuration.js","sourceRoot":"","sources":["../../src/models/device-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,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M;IACZ,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;CAClB,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,MAAM;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AAyDtE;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAmC,CAAC,CAAC,MAAM,CAAC;IACjF,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;IACpC,EAAE,EAAE,QAAQ;IACZ,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,WAAW,EAAE,gBAAgB;IAC7B,QAAQ,EAAE,cAAc;IACxB,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC/B,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;CAC7B,CAAC,CAAC"}
|
|
@@ -1,13 +1,67 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { DAIService, MessageHandlerVersion } from '../dai-connection/connection.js';
|
|
3
3
|
import { type ConnectionData, type TokenRefreshHandler } from '../hooks/connection.js';
|
|
4
|
+
/**
|
|
5
|
+
* React context containing the current DepthAI connection state.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The default value represents a disconnected, idle provider state and is used only
|
|
9
|
+
* before a matching {@link ConnectionProvider} is mounted.
|
|
10
|
+
*/
|
|
4
11
|
export declare const ConnectionContext: React.Context<ConnectionData>;
|
|
5
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Props for the DepthAI connection provider.
|
|
14
|
+
*/
|
|
15
|
+
export type ConnectionProviderProps = React.PropsWithChildren<{
|
|
16
|
+
/**
|
|
17
|
+
* DepthAI service names polled while the connection is alive.
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue `[]`
|
|
20
|
+
*/
|
|
6
21
|
activeServices: DAIService[];
|
|
22
|
+
/**
|
|
23
|
+
* Enables verbose connection logging.
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue `false`
|
|
26
|
+
*/
|
|
7
27
|
withDebugLogs?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Stream topics opened automatically after connection.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* `undefined` preserves the connection/backend default topic behavior.
|
|
33
|
+
*/
|
|
8
34
|
defaultTopics?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Backend message handling protocol expected by the visualizer connection.
|
|
37
|
+
*/
|
|
9
38
|
messageHandlerVersion?: MessageHandlerVersion;
|
|
39
|
+
/**
|
|
40
|
+
* Controls how refreshed WebRTC tokens are propagated to the host application.
|
|
41
|
+
*
|
|
42
|
+
* @defaultValue `false`
|
|
43
|
+
*/
|
|
10
44
|
tokenRefresh?: TokenRefreshHandler;
|
|
11
|
-
}
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates and provides a DepthAI connection based on data provider connection settings.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* This provider reads transport settings from {@link DataProvider}, delegates connection
|
|
51
|
+
* creation to {@link useCreateConnection}, and wraps children with the visualizer
|
|
52
|
+
* connection context used by stream panels.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <ConnectionProvider activeServices={[]}>{children}</ConnectionProvider>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare const ConnectionProvider: React.FC<ConnectionProviderProps>;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the current DepthAI connection context.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* Outside {@link ConnectionProvider}, this hook returns the disconnected default context.
|
|
65
|
+
*/
|
|
12
66
|
export declare const useDaiConnection: () => ConnectionData;
|
|
13
67
|
//# sourceMappingURL=ConnectionProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ConnectionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAExB,MAAM,wBAAwB,CAAC;AAKhC,eAAO,MAAM,iBAAiB,+BAc5B,CAAC;AAEH,
|
|
1
|
+
{"version":3,"file":"ConnectionProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ConnectionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAExB,MAAM,wBAAwB,CAAC;AAKhC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,+BAc5B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAC7D;;;;OAIG;IACH,cAAc,EAAE,UAAU,EAAE,CAAC;IAC7B;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C;;;;OAIG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACnC,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA2BhE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,sBAA4C,CAAC"}
|
|
@@ -4,6 +4,13 @@ import { useCreateConnection, } from '../hooks/connection.js';
|
|
|
4
4
|
import { noop } from '../utils/functions.js';
|
|
5
5
|
import { VisualizerContext } from '../visualizer/index.js';
|
|
6
6
|
import { useData } from './DataProvider.js';
|
|
7
|
+
/**
|
|
8
|
+
* React context containing the current DepthAI connection state.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The default value represents a disconnected, idle provider state and is used only
|
|
12
|
+
* before a matching {@link ConnectionProvider} is mounted.
|
|
13
|
+
*/
|
|
7
14
|
export const ConnectionContext = React.createContext({
|
|
8
15
|
daiConnection: null,
|
|
9
16
|
connected: false,
|
|
@@ -19,6 +26,19 @@ export const ConnectionContext = React.createContext({
|
|
|
19
26
|
toggleTopic: noop,
|
|
20
27
|
isConnectionError: false,
|
|
21
28
|
});
|
|
29
|
+
/**
|
|
30
|
+
* Creates and provides a DepthAI connection based on data provider connection settings.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* This provider reads transport settings from {@link DataProvider}, delegates connection
|
|
34
|
+
* creation to {@link useCreateConnection}, and wraps children with the visualizer
|
|
35
|
+
* connection context used by stream panels.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <ConnectionProvider activeServices={[]}>{children}</ConnectionProvider>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
22
42
|
export const ConnectionProvider = ({ children, activeServices, withDebugLogs, defaultTopics, messageHandlerVersion, tokenRefresh, }) => {
|
|
23
43
|
const { connectionType, wsUrl, token, clientId } = useData();
|
|
24
44
|
const connectionData = useCreateConnection({
|
|
@@ -34,5 +54,11 @@ export const ConnectionProvider = ({ children, activeServices, withDebugLogs, de
|
|
|
34
54
|
});
|
|
35
55
|
return (_jsx(VisualizerContext, { connections: connectionData.connections, children: _jsx(ConnectionContext.Provider, { value: connectionData, children: children }) }));
|
|
36
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Returns the current DepthAI connection context.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* Outside {@link ConnectionProvider}, this hook returns the disconnected default context.
|
|
62
|
+
*/
|
|
37
63
|
export const useDaiConnection = () => React.useContext(ConnectionContext);
|
|
38
64
|
//# sourceMappingURL=ConnectionProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionProvider.js","sourceRoot":"","sources":["../../src/providers/ConnectionProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAGN,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAiB;IACpE,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,KAAK;IACpB,iBAAiB,EAAE,EAAE;IACrB,QAAQ,EAAE,SAAS;IACnB,YAAY,EAAE,SAAS;IACvB,aAAa,EAAE,SAAS;IACxB,iBAAiB,EAAE,KAAK;IACxB,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,KAAK;CACxB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ConnectionProvider.js","sourceRoot":"","sources":["../../src/providers/ConnectionPro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iB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,YAAG,QAAQ,GAA8B,GACvE,CACpB,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,28 +1,157 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Shared UI state derived from URL parameters and connection configuration.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Values come from explicit `connectionConfig` first, then URL parameters, then local
|
|
7
|
+
* defaults. Mutation helpers update both React state and the relevant URL parameters.
|
|
8
|
+
*/
|
|
2
9
|
export type DataContext = {
|
|
10
|
+
/**
|
|
11
|
+
* Number of stream columns requested by the layout state, or `null` for automatic layout.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* `null` is persisted as layout `0` in the URL.
|
|
15
|
+
*/
|
|
3
16
|
columns: number | null;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the user is controlling panel layout manually instead of using column layout.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue `false`
|
|
21
|
+
*/
|
|
4
22
|
customLayout: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Updates the number of stream columns and persists it to the URL.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Calling this also disables custom layout mode.
|
|
28
|
+
*/
|
|
5
29
|
changeColumns: (columns: number | null) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Enables or disables custom stream layout mode.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Calling this resets `columns` to `null` and persists layout `0` to the URL.
|
|
35
|
+
*/
|
|
6
36
|
changeCustomLayout: (value: boolean) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Updates the WebSocket URL and clears WebRTC URL parameters.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* Calling this removes `t` and `cid` from the URL so the next connection uses
|
|
42
|
+
* WebSocket settings.
|
|
43
|
+
*/
|
|
7
44
|
changeWsUrl: (url: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Active connection transport selected from props or URL parameters.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* WebRTC is selected only when token and client id are available.
|
|
50
|
+
*/
|
|
8
51
|
connectionType: 'ws' | 'webrtc';
|
|
52
|
+
/**
|
|
53
|
+
* WebSocket endpoint used when `connectionType` is `ws`.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Defaults to the local backend URL on localhost/Electron and to the production
|
|
57
|
+
* default URL elsewhere.
|
|
58
|
+
*/
|
|
9
59
|
wsUrl: string;
|
|
60
|
+
/**
|
|
61
|
+
* WebRTC auth token used when `connectionType` is `webrtc`.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* Empty when WebRTC parameters are not available.
|
|
65
|
+
*/
|
|
10
66
|
token: string;
|
|
67
|
+
/**
|
|
68
|
+
* WebRTC client id used when `connectionType` is `webrtc`.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* Empty when WebRTC parameters are not available.
|
|
72
|
+
*/
|
|
11
73
|
clientId: string;
|
|
74
|
+
/**
|
|
75
|
+
* Selected distance unit system for stream overlays.
|
|
76
|
+
*
|
|
77
|
+
* @defaultValue `'metric'`
|
|
78
|
+
*/
|
|
12
79
|
units: SelectedUnits;
|
|
80
|
+
/**
|
|
81
|
+
* Updates the selected distance unit system.
|
|
82
|
+
*/
|
|
13
83
|
setUnits: (units: SelectedUnits) => void;
|
|
14
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Returns shared URL, layout, connection, and unit preferences for viewer components.
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* Outside {@link DataProvider}, this hook returns the default WebSocket-based context.
|
|
90
|
+
*/
|
|
15
91
|
export declare const useData: () => DataContext;
|
|
92
|
+
/**
|
|
93
|
+
* Supported unit systems for stream overlay distance values.
|
|
94
|
+
*/
|
|
16
95
|
export type SelectedUnits = 'imperial' | 'metric';
|
|
96
|
+
/**
|
|
97
|
+
* Props for the shared data provider.
|
|
98
|
+
*/
|
|
17
99
|
export type DataProviderProps = React.PropsWithChildren & {
|
|
100
|
+
/**
|
|
101
|
+
* Optional connection configuration supplied by the host application instead of URL parameters.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* When omitted, the provider reads WebRTC parameters from `t` and `cid`, or a WebSocket
|
|
105
|
+
* URL from `ws_url`. If no URL parameters are present, it falls back to the default
|
|
106
|
+
* WebSocket URL.
|
|
107
|
+
*/
|
|
18
108
|
connectionConfig?: {
|
|
109
|
+
/**
|
|
110
|
+
* Selects a WebSocket connection.
|
|
111
|
+
*/
|
|
19
112
|
type: 'ws';
|
|
113
|
+
/**
|
|
114
|
+
* WebSocket URL of the DepthAI backend.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* This value takes precedence over `ws_url` from the current URL.
|
|
118
|
+
*/
|
|
20
119
|
wsUrl: string;
|
|
21
120
|
} | {
|
|
121
|
+
/**
|
|
122
|
+
* Selects a WebRTC connection.
|
|
123
|
+
*/
|
|
22
124
|
type: 'webrtc';
|
|
125
|
+
/**
|
|
126
|
+
* WebRTC auth token.
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* This value takes precedence over `t` from the current URL.
|
|
130
|
+
*/
|
|
23
131
|
token: string;
|
|
132
|
+
/**
|
|
133
|
+
* WebRTC client id.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* This value takes precedence over `cid` from the current URL.
|
|
137
|
+
*/
|
|
24
138
|
clientId: string;
|
|
25
139
|
};
|
|
26
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* Provides shared viewer state resolved from explicit connection config and URL parameters.
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* The provider keeps layout state synchronized with URL search parameters and chooses
|
|
146
|
+
* the active transport in this order: explicit `connectionConfig`, WebRTC URL params,
|
|
147
|
+
* WebSocket URL param, environment default URL.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```tsx
|
|
151
|
+
* <DataProvider connectionConfig={{ type: 'ws', wsUrl: 'ws://localhost:8765' }}>
|
|
152
|
+
* {children}
|
|
153
|
+
* </DataProvider>
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
27
156
|
export declare const DataProvider: React.FC<DataProviderProps>;
|
|
28
157
|
//# sourceMappingURL=DataProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProvider.d.ts","sourceRoot":"","sources":["../../src/providers/DataProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,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;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CACzC,CAAC;AAgBF,eAAO,MAAM,OAAO,mBAAsC,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,GAAG;IACzD,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QAAQ,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,GAAG;IACzD;;;;;;;OAOG;IACH,gBAAgB,CAAC,EACd;QACA;;WAEG;QACH,IAAI,EAAE,IAAI,CAAC;QACX;;;;;WAKG;QACH,KAAK,EAAE,MAAM,CAAC;KACb,GACD;QACA;;WAEG;QACH,IAAI,EAAE,QAAQ,CAAC;QACf;;;;;WAKG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;;;;WAKG;QACH,QAAQ,EAAE,MAAM,CAAC;KAChB,CAAC;CACL,CAAC;AAIF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoGpD,CAAC"}
|
|
@@ -17,8 +17,29 @@ const DataContext = React.createContext({
|
|
|
17
17
|
units: 'metric',
|
|
18
18
|
setUnits: noop,
|
|
19
19
|
});
|
|
20
|
+
/**
|
|
21
|
+
* Returns shared URL, layout, connection, and unit preferences for viewer components.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Outside {@link DataProvider}, this hook returns the default WebSocket-based context.
|
|
25
|
+
*/
|
|
20
26
|
export const useData = () => React.useContext(DataContext);
|
|
21
27
|
const DEFAULT_SEARCH_INIT = { layout: '0', t: '', cid: '' };
|
|
28
|
+
/**
|
|
29
|
+
* Provides shared viewer state resolved from explicit connection config and URL parameters.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* The provider keeps layout state synchronized with URL search parameters and chooses
|
|
33
|
+
* the active transport in this order: explicit `connectionConfig`, WebRTC URL params,
|
|
34
|
+
* WebSocket URL param, environment default URL.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <DataProvider connectionConfig={{ type: 'ws', wsUrl: 'ws://localhost:8765' }}>
|
|
39
|
+
* {children}
|
|
40
|
+
* </DataProvider>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
22
43
|
export const DataProvider = ({ children, connectionConfig }) => {
|
|
23
44
|
const { search, updateSearch } = useFlatSearch({
|
|
24
45
|
defaultInit: DEFAULT_SEARCH_INIT,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProvider.js","sourceRoot":"","sources":["../../src/providers/DataProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,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;
|
|
1
|
+
{"version":3,"file":"DataProvider.js","sourceRoot":"","sources":["../../src/providers/DataProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,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;AAsF7C,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAc;IACpD,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,IAAI;IACpB,KAAK,EAAE,cAAc;IACrB,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;IACxB,WAAW,EAAE,IAAI;IACjB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,IAAI;CACd,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,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AAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3B,CAAC,EACD,CAAC,YAAY,CAAC,CACd,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACpC,CAAC,GAAW,EAAE,EAAE;QACf,yBAAyB,CAAC,GAAG,CAAC,CAAC;QAC/B,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,YAAY,EAAE,CAAW;YAChC,QAAQ,EAAE,YAAY,EAAE,GAAa;YACrC,KAAK,EAAE,sBAAsB;YAC7B,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;YAC9C,OAAO;YACP,YAAY;YACZ,aAAa;YACb,kBAAkB;YAClB,WAAW;YACX,KAAK;YACL,QAAQ;SACR,YAEA,QAAQ,GACa,CACvB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,25 +1,85 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Theme preference selected by the user.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* `system` follows the operating system preference and keeps listening for OS changes.
|
|
7
|
+
*/
|
|
3
8
|
export type ThemePreference = 'light' | 'dark' | 'system';
|
|
4
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Theme that is currently rendered on screen after resolving `system`.
|
|
11
|
+
*/
|
|
5
12
|
export type ResolvedTheme = 'light' | 'dark';
|
|
13
|
+
/**
|
|
14
|
+
* Supported theme preferences shown by the theme picker.
|
|
15
|
+
*/
|
|
6
16
|
export declare const THEME_PREFERENCES: ThemePreference[];
|
|
17
|
+
/**
|
|
18
|
+
* Resolves a user theme preference into the theme currently rendered by the UI.
|
|
19
|
+
*
|
|
20
|
+
* @param preference - User-selected theme preference.
|
|
21
|
+
* @returns Concrete light or dark theme.
|
|
22
|
+
*/
|
|
7
23
|
export declare const resolveTheme: (preference: ThemePreference) => ResolvedTheme;
|
|
24
|
+
/**
|
|
25
|
+
* Reads the stored theme preference from local storage.
|
|
26
|
+
*
|
|
27
|
+
* @returns Stored theme preference, or `system` when the stored value is missing or invalid.
|
|
28
|
+
*/
|
|
8
29
|
export declare const readStoredTheme: () => ThemePreference;
|
|
9
30
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
31
|
+
* Applies a resolved theme to the document root.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This toggles the `dark` class on `document.documentElement`. It is used both from
|
|
35
|
+
* React and from the inline bootstrap script in `index.html`, which runs before first
|
|
36
|
+
* paint so the app never flashes the light theme on load.
|
|
12
37
|
*/
|
|
13
38
|
export declare const applyTheme: (theme: ResolvedTheme) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Theme state and actions exposed by {@link ThemeProvider}.
|
|
41
|
+
*/
|
|
14
42
|
export type ThemeContext = {
|
|
15
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* User-selected preference, including `system`.
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue `'system'`
|
|
47
|
+
*/
|
|
16
48
|
theme: ThemePreference;
|
|
17
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Concrete theme currently rendered on screen.
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue `'light'`
|
|
53
|
+
*/
|
|
18
54
|
resolvedTheme: ResolvedTheme;
|
|
55
|
+
/**
|
|
56
|
+
* Updates the user-selected theme and persists it to local storage.
|
|
57
|
+
*/
|
|
19
58
|
setTheme: (theme: ThemePreference) => void;
|
|
20
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Flips between light and dark, resolving `system` first.
|
|
61
|
+
*/
|
|
21
62
|
toggleTheme: () => void;
|
|
22
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Returns the current theme context.
|
|
66
|
+
*
|
|
67
|
+
* @remarks
|
|
68
|
+
* Outside {@link ThemeProvider}, this hook returns the default system/light context.
|
|
69
|
+
*/
|
|
23
70
|
export declare const useTheme: () => ThemeContext;
|
|
71
|
+
/**
|
|
72
|
+
* Provides shared theme state and keeps DOM/local storage in sync.
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* The provider reads the initial preference from local storage, follows OS theme changes
|
|
76
|
+
* while the preference is `system`, persists explicit user changes, and applies the
|
|
77
|
+
* resolved theme to the document root.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <ThemeProvider>{children}</ThemeProvider>
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
24
84
|
export declare const ThemeProvider: React.FC<React.PropsWithChildren>;
|
|
25
85
|
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,eAAe,EAAgC,CAAC;AAWhF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,YAAY,eAAe,KAAG,aACe,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAO,eAGlC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,aAAa,SAE9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,aAAa,EAAE,aAAa,CAAC;IAC7B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C;;OAEG;IACH,WAAW,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AASF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,oBAAuC,CAAC;AAE7D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAsC3D,CAAC"}
|
|
@@ -2,19 +2,37 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { noop } from '../utils/functions.js';
|
|
4
4
|
import { getItemFromLocalStorage, setItemToLocalStorage } from '../utils/local-storage.js';
|
|
5
|
+
/**
|
|
6
|
+
* Supported theme preferences shown by the theme picker.
|
|
7
|
+
*/
|
|
5
8
|
export const THEME_PREFERENCES = ['light', 'dark', 'system'];
|
|
6
9
|
const DARK_CLASS = 'dark';
|
|
7
10
|
const COLOR_SCHEME_QUERY = '(prefers-color-scheme: dark)';
|
|
8
11
|
const isThemePreference = (value) => THEME_PREFERENCES.includes(value);
|
|
9
12
|
const prefersDark = () => typeof window !== 'undefined' && window.matchMedia(COLOR_SCHEME_QUERY).matches;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves a user theme preference into the theme currently rendered by the UI.
|
|
15
|
+
*
|
|
16
|
+
* @param preference - User-selected theme preference.
|
|
17
|
+
* @returns Concrete light or dark theme.
|
|
18
|
+
*/
|
|
10
19
|
export const resolveTheme = (preference) => preference === 'system' ? (prefersDark() ? 'dark' : 'light') : preference;
|
|
20
|
+
/**
|
|
21
|
+
* Reads the stored theme preference from local storage.
|
|
22
|
+
*
|
|
23
|
+
* @returns Stored theme preference, or `system` when the stored value is missing or invalid.
|
|
24
|
+
*/
|
|
11
25
|
export const readStoredTheme = () => {
|
|
12
26
|
const stored = getItemFromLocalStorage('theme');
|
|
13
27
|
return isThemePreference(stored) ? stored : 'system';
|
|
14
28
|
};
|
|
15
29
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
30
|
+
* Applies a resolved theme to the document root.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* This toggles the `dark` class on `document.documentElement`. It is used both from
|
|
34
|
+
* React and from the inline bootstrap script in `index.html`, which runs before first
|
|
35
|
+
* paint so the app never flashes the light theme on load.
|
|
18
36
|
*/
|
|
19
37
|
export const applyTheme = (theme) => {
|
|
20
38
|
document.documentElement.classList.toggle(DARK_CLASS, theme === 'dark');
|
|
@@ -25,7 +43,26 @@ const ThemeContext = React.createContext({
|
|
|
25
43
|
setTheme: noop,
|
|
26
44
|
toggleTheme: noop,
|
|
27
45
|
});
|
|
46
|
+
/**
|
|
47
|
+
* Returns the current theme context.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Outside {@link ThemeProvider}, this hook returns the default system/light context.
|
|
51
|
+
*/
|
|
28
52
|
export const useTheme = () => React.useContext(ThemeContext);
|
|
53
|
+
/**
|
|
54
|
+
* Provides shared theme state and keeps DOM/local storage in sync.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* The provider reads the initial preference from local storage, follows OS theme changes
|
|
58
|
+
* while the preference is `system`, persists explicit user changes, and applies the
|
|
59
|
+
* resolved theme to the document root.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <ThemeProvider>{children}</ThemeProvider>
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
29
66
|
export const ThemeProvider = ({ children }) => {
|
|
30
67
|
const [theme, setThemeState] = React.useState(readStoredTheme);
|
|
31
68
|
const [systemTheme, setSystemTheme] = React.useState(() => prefersDark() ? 'dark' : 'light');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/providers/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/providers/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAe3F;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEhF,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AAE1D,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAA4B,EAAE,CACtE,iBAAiB,CAAC,QAAQ,CAAC,KAAwB,CAAC,CAAC;AAEtD,MAAM,WAAW,GAAG,GAAG,EAAE,CACxB,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAA2B,EAAiB,EAAE,CAC1E,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;AA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QAAQ,GAAyB,CAAC;AAChF,CAAC,CAAC"}
|
|
@@ -1,17 +1,57 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type RuntimeConfig } from '../visualizer/index.js';
|
|
3
3
|
export declare const STREAM_DIAGNOSTICS_LOCAL_STORAGE_KEY: "viewer-stream-diagnostics-enabled";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Runtime configuration state exposed to visualizer consumers.
|
|
6
|
+
*/
|
|
7
|
+
export type VisualizerRuntimeConfigContextValue = {
|
|
8
|
+
/**
|
|
9
|
+
* Current immutable visualizer runtime configuration.
|
|
10
|
+
*/
|
|
5
11
|
runtimeConfig: Readonly<RuntimeConfig>;
|
|
12
|
+
/**
|
|
13
|
+
* Merges a partial runtime configuration into the current value.
|
|
14
|
+
*/
|
|
6
15
|
updateRuntimeConfig: (runtimeConfig: Readonly<RuntimeConfig>) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Updates the maximum expected stereo depth value in millimeters.
|
|
18
|
+
*/
|
|
7
19
|
setStereoDepthMaxValue: (value: number | undefined) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Enables or disables perspective rendering for point cloud panels.
|
|
22
|
+
*/
|
|
8
23
|
setPerspective: (value: boolean | undefined) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Updates neural camera intrinsics used by depth and point cloud decoding.
|
|
26
|
+
*/
|
|
9
27
|
setNeuralCameraIntrinsics: (value: RuntimeConfig['neuralCameraIntrinsics']) => void;
|
|
10
28
|
};
|
|
11
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Props for the visualizer runtime configuration provider.
|
|
31
|
+
*/
|
|
32
|
+
export type VisualizerRuntimeConfigProviderProps = React.PropsWithChildren<{
|
|
33
|
+
/**
|
|
34
|
+
* Runtime configuration applied on initial render before any user changes.
|
|
35
|
+
*/
|
|
12
36
|
initialRuntimeConfig?: Readonly<RuntimeConfig>;
|
|
13
37
|
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Provides visualizer runtime settings and synchronizes them with the shared visualizer runtime store.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Initial values are merged with persisted runtime settings, then updates are mirrored
|
|
43
|
+
* into the visualizer runtime store used by stream panels.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <VisualizerRuntimeConfigProvider initialRuntimeConfig={{ debugLogs: true }}>
|
|
48
|
+
* {children}
|
|
49
|
+
* </VisualizerRuntimeConfigProvider>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
14
52
|
export declare const VisualizerRuntimeConfigProvider: React.FC<VisualizerRuntimeConfigProviderProps>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the current visualizer runtime configuration context.
|
|
55
|
+
*/
|
|
15
56
|
export declare function useVisualizerRuntimeConfig(): VisualizerRuntimeConfigContextValue;
|
|
16
|
-
export {};
|
|
17
57
|
//# sourceMappingURL=VisualizerRuntimeConfigProvider.d.ts.map
|