@cognite/reveal-components 1.0.1 → 1.0.2
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/assets/poi-markers/poi-create-cursor.js +4 -0
- package/dist/data-providers/FdmSDK.d.ts +8 -0
- package/dist/data-providers/FdmSDK.js +34 -21
- package/dist/data-providers/assets/createClassicAssetsCache.d.ts +7 -0
- package/dist/data-providers/assets/createClassicAssetsCache.js +18 -0
- package/dist/data-providers/assets/createDmsDescribableNodesCache.d.ts +23 -0
- package/dist/data-providers/assets/createDmsDescribableNodesCache.js +19 -0
- package/dist/data-providers/cache/PointCloudAnnotationCache.js +10 -10
- package/dist/data-providers/cache/annotationModelUtils.js +8 -6
- package/dist/data-providers/cache/cad/CadInstanceMappingsCacheImpl.js +6 -6
- package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.js +11 -11
- package/dist/data-providers/core-dm-provider/filterNodesByMappedTo3d.js +13 -13
- package/dist/data-providers/core-dm-provider/getCadConnectionsForInstances.js +18 -18
- package/dist/data-providers/core-dm-provider/getCadConnectionsForRevisions.js +11 -11
- package/dist/data-providers/core-dm-provider/getCadModelsForInstance.js +3 -3
- package/dist/data-providers/core-dm-provider/getDMSModels.js +6 -6
- package/dist/data-providers/core-dm-provider/getEdgeConnected3dInstances.js +8 -8
- package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.js +19 -19
- package/dist/data-providers/core-dm-provider/listMappedFdmNodes.js +14 -14
- package/dist/data-providers/legacy-fdm-provider/fdmEdgesToCadConnections.js +3 -3
- package/dist/data-providers/network/cad/searchClassicAssetsForCadModels.js +5 -5
- package/dist/data-providers/network/cad/searchHybridDmAssetsForCadModels.js +3 -3
- package/dist/data-providers/network/common/getDMAssetsForAnnotationReference.js +3 -3
- package/dist/data-providers/utils/getDMSModelRevisionRefs.js +3 -3
- package/dist/domains/annotation360/image360SceneCollectionTransform.d.ts +18 -0
- package/dist/domains/annotation360/image360SceneCollectionTransform.js +37 -0
- package/dist/domains/index.d.ts +2 -1
- package/dist/domains/index.js +3 -2
- package/dist/domains/pointsOfInterest/PointsOfInterestTool.d.ts +5 -0
- package/dist/domains/pointsOfInterest/PointsOfInterestTool.js +36 -17
- package/dist/domains/reveal/RevealDomainObjectUtils.d.ts +1 -0
- package/dist/domains/reveal/RevealDomainObjectUtils.js +1 -1
- package/dist/domains/reveal/cad/CadDomainObject.d.ts +18 -1
- package/dist/domains/reveal/cad/CadDomainObject.js +31 -15
- package/dist/foundation/renderTarget/CdfCaches.d.ts +9 -1
- package/dist/foundation/renderTarget/CdfCaches.js +24 -14
- package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.d.ts +3 -1
- package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.js +33 -22
- package/dist/foundation/treeNodes/cad-tree-node/cad-node-update-styling.js +6 -6
- package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js +1 -1
- package/dist/ui/components/InstanceLabel/InstanceLabel.js +18 -30
- package/dist/ui/components/Reveal3DResources/Reveal3DResources.js +20 -20
- package/dist/ui/components/RevealCanvas/SDKProvider.js +6 -6
- package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.d.ts +3 -0
- package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.js +6 -0
- package/dist/ui/components/RevealCanvas/ViewerContext.d.ts +2 -0
- package/dist/ui/components/RevealCanvas/ViewerContext.js +5 -5
- package/dist/ui/components/RevealContext/RevealContext.js +6 -6
- package/dist/ui/components/RevealToolbar/AssetContextualizedButton.js +1 -1
- package/dist/ui/components/RuleBasedOutputs/hooks/useGetDMConnectionWithNodeFromHybridMappingsQuery.js +11 -11
- package/dist/ui/components/Widget/RevealWidget.context.d.ts +2 -1
- package/dist/ui/components/Widget/RevealWidget.context.js +1 -1
- package/dist/ui/components/Widget/RevealWidget.d.ts +11 -2
- package/dist/ui/components/Widget/RevealWidget.js +35 -20
- package/dist/ui/components/Widget/RevealWidgetCameraController.d.ts +3 -1
- package/dist/ui/components/Widget/RevealWidgetCameraController.js +12 -10
- package/dist/ui/components/Widget/RevealWidgetController.d.ts +3 -1
- package/dist/ui/components/Widget/RevealWidgetController.js +40 -33
- package/dist/ui/components/Widget/index.d.ts +1 -1
- package/dist/ui/components/Widget/styling/applyPointCloudInstanceStyling.js +5 -5
- package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.d.ts +21 -0
- package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.js +33 -0
- package/dist/ui/components/commandBased/Factories/DefaultIcons.js +31 -31
- package/dist/ui/components/commandBased/buttons/DropdownButton.d.ts +2 -0
- package/dist/ui/components/commandBased/buttons/DropdownButton.js +67 -48
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.d.ts +13 -2
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.js +17 -9
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.js +21 -20
- package/dist/ui/components/commandBased/treeView/TreeView/components/tree-view-info.js +2 -2
- package/dist/ui/components/commandBased/treeView/TreeView/extraComponents/CadTreeAssetMappingDropdown.js +34 -33
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view-node.js +1 -0
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view-props.d.ts +1 -0
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view.js +27 -25
- package/dist/ui/components/i18n/I18n.js +3 -3
- package/dist/ui/components/index.d.ts +1 -1
- package/dist/ui/hooks/network/fetchLinkFromRelationshipsByTimeseries.js +4 -4
- package/dist/ui/hooks/network/getImage360CollectionsForDmInstance.js +7 -7
- package/dist/ui/hooks/network/getTimeseriesLatestDatapoints.js +3 -3
- package/dist/ui/hooks/pointClouds/fetchAnnotationsForModel.js +4 -4
- package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingForIntersection.js +11 -11
- package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingsForAssetInstances.js +4 -4
- package/dist/ui/hooks/scenes/use3dScenes.js +4 -4
- package/dist/ui/query/core-dm/usePointCloudDMVolumeMappingForIntersection.js +9 -9
- package/dist/ui/query/core-dm/usePointCloudDMVolumes.js +10 -10
- package/dist/ui/query/index.d.ts +1 -0
- package/dist/ui/query/index.js +17 -16
- package/dist/ui/query/useAll3dDirectConnectionsWithProperties.js +6 -6
- package/dist/ui/query/useAssetsAndTimeseriesLinkageDataQuery.js +24 -24
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.d.ts +3 -2
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.js +4 -4
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.js +13 -13
- package/dist/ui/query/useAssetsByIdsQuery.js +10 -11
- package/dist/ui/query/useFetchClassicAssetsByIds.js +5 -5
- package/dist/ui/query/useFilterOnClassicAssetsInScene.js +6 -6
- package/dist/ui/query/useHybridMappingsForAssetInstances.js +9 -9
- package/dist/ui/query/useInstanceNames.d.ts +11 -0
- package/dist/ui/query/useInstanceNames.js +17 -0
- package/dist/ui/query/useInstancesByIdsQuery.context.d.ts +3 -5
- package/dist/ui/query/useInstancesByIdsQuery.context.js +4 -8
- package/dist/ui/query/useInstancesByIdsQuery.d.ts +9 -6
- package/dist/ui/query/useInstancesByIdsQuery.js +14 -23
- package/dist/ui/query/useNamedDmInstancesByIds.d.ts +12 -0
- package/dist/utilities/cache/ReadonlyEntityCache.d.ts +4 -0
- package/dist/utilities/cache/ReadonlyEntityCache.js +27 -0
- package/dist/utilities/createMixpanelUsageMetricsTracker.d.ts +23 -0
- package/dist/utilities/createMixpanelUsageMetricsTracker.js +23 -0
- package/dist/utilities/externalIndex.d.ts +2 -0
- package/dist/utilities/externalIndex.js +3 -1
- package/dist/utilities/getInstancesFromClick.js +9 -9
- package/dist/utilities/index.d.ts +2 -1
- package/dist/utilities/index.js +12 -9
- package/dist/utilities/signal/useCombinedUpdateSignal.d.ts +9 -0
- package/dist/utilities/signal/useCombinedUpdateSignal.js +14 -0
- package/dist/utilities/signal/useMemoWithUpdateSignal.d.ts +3 -0
- package/dist/utilities/signal/useMemoWithUpdateSignal.js +13 -0
- package/dist/utilities/usageMetricsTracker.d.ts +4 -0
- package/dist/utilities/usageMetricsTracker.js +4 -0
- package/package.json +6 -3
- package/dist/ui/hooks/network/getAssetsByIds.d.ts +0 -2
- package/dist/ui/hooks/network/getAssetsByIds.js +0 -4
- package/dist/ui/query/useDmsInstanceByIdsQuery.d.ts +0 -3
- package/dist/ui/query/useDmsInstanceByIdsQuery.js +0 -18
|
@@ -23,7 +23,7 @@ var p = {
|
|
|
23
23
|
return /* @__PURE__ */ o(u, { children: /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ o(d, { render: /* @__PURE__ */ o(f, {
|
|
24
24
|
variant: S,
|
|
25
25
|
size: "icon-sm",
|
|
26
|
-
"aria-label":
|
|
26
|
+
"aria-label": h(x),
|
|
27
27
|
onClick: E,
|
|
28
28
|
children: /* @__PURE__ */ o(t, {
|
|
29
29
|
iconName: "AssetsIcon",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createFdmKey as e } from "../../../../data-providers/cache/idAndKeyTranslation.js";
|
|
2
2
|
import { restrictToDmsId as t } from "../../../../utilities/restrictToDmsId.js";
|
|
3
|
-
import {
|
|
3
|
+
import { queryKeys as n } from "../../../../utilities/queryKeys.js";
|
|
4
4
|
import { isDefined as r } from "../../../../utilities/isDefined.js";
|
|
5
|
-
import { inspectNodes as i } from "../../../../data-providers/cache/requests.js";
|
|
6
|
-
import { EMPTY_ARRAY as a } from "../../../../utilities/constants.js";
|
|
7
|
-
import { queryKeys as o } from "../../../../utilities/queryKeys.js";
|
|
8
5
|
import "../../../../data-providers/cache/index.js";
|
|
6
|
+
import { executeParallel as i } from "../../../../utilities/executeParallel.js";
|
|
7
|
+
import { inspectNodes as a } from "../../../../data-providers/cache/requests.js";
|
|
8
|
+
import { EMPTY_ARRAY as o } from "../../../../utilities/constants.js";
|
|
9
9
|
import { UseGetDMConnectionWithNodeFromHybridMappingsQueryContext as s } from "./useGetDMConnectionWithNodeFromHybridMappingsQuery.context.js";
|
|
10
10
|
import { useContext as c, useMemo as l } from "react";
|
|
11
11
|
import { uniqBy as u } from "lodash-es";
|
|
@@ -14,16 +14,16 @@ import { useQuery as d } from "@tanstack/react-query";
|
|
|
14
14
|
function f(e, t) {
|
|
15
15
|
let { useClassicCadAssetMappingCache: f, useFdmSdk: h } = c(s), g = f(), _ = h(), v = l(() => e.map((e) => e.instanceId).filter(r), [e]);
|
|
16
16
|
return d({
|
|
17
|
-
queryKey:
|
|
17
|
+
queryKey: n.fdmConnectionWithNode(v, t),
|
|
18
18
|
queryFn: async () => {
|
|
19
|
-
if (v.length === 0 || t.length === 0) return
|
|
20
|
-
let e = await
|
|
21
|
-
if (e.items.length === 0) return
|
|
22
|
-
let
|
|
19
|
+
if (v.length === 0 || t.length === 0) return o;
|
|
20
|
+
let e = await a(_, v);
|
|
21
|
+
if (e.items.length === 0) return o;
|
|
22
|
+
let n = await i(t.map(({ modelId: t, revisionId: n }) => async () => {
|
|
23
23
|
let r = await g.getNodesForInstanceIds(t, n, v);
|
|
24
|
-
return r.size === 0 ?
|
|
24
|
+
return r.size === 0 ? o : m(e, r, t, n);
|
|
25
25
|
}), 2);
|
|
26
|
-
return u(
|
|
26
|
+
return u(n.filter(r).flat(), p);
|
|
27
27
|
},
|
|
28
28
|
enabled: v.length > 0 && t.length > 0,
|
|
29
29
|
staleTime: Infinity
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context } from 'react';
|
|
2
2
|
import { RevealRenderTarget } from '../../../domains';
|
|
3
|
+
import { UsageMetricsTracker } from '../../../utilities/usageMetricsTracker';
|
|
3
4
|
import { RevealCanvas, useRenderTarget } from '../RevealCanvas';
|
|
4
5
|
import { RevealContext } from '../RevealContext';
|
|
5
6
|
import { RevealWidgetController } from './RevealWidgetController';
|
|
6
|
-
type RevealWidgetFactory = (renderTarget: RevealRenderTarget) => RevealWidgetController;
|
|
7
|
+
type RevealWidgetFactory = (renderTarget: RevealRenderTarget, usageMetricsTracker: UsageMetricsTracker) => RevealWidgetController;
|
|
7
8
|
export type RevealWidgetDependencies = {
|
|
8
9
|
createRevealWidgetController: RevealWidgetFactory;
|
|
9
10
|
RevealCanvas: typeof RevealCanvas;
|
|
@@ -7,7 +7,7 @@ import { RevealWidgetController as r } from "./RevealWidgetController.js";
|
|
|
7
7
|
import { createContext as i } from "react";
|
|
8
8
|
//#region libs/shared/reveal-components/src/ui/components/Widget/RevealWidget.context.ts
|
|
9
9
|
var a = {
|
|
10
|
-
createRevealWidgetController: (e) => new r(e),
|
|
10
|
+
createRevealWidgetController: (e, t) => new r(e, void 0, t),
|
|
11
11
|
RevealCanvas: t,
|
|
12
12
|
RevealContext: n,
|
|
13
13
|
useRenderTarget: e
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { Cognite3DViewerOptions } from '@cognite/reveal';
|
|
3
3
|
import { RevealWidgetController } from './RevealWidgetController';
|
|
4
|
+
import { RevealWidgetTrackingProps } from './useRevealWidgetMetricsTracking';
|
|
5
|
+
export type { RevealWidgetTrackingProps };
|
|
4
6
|
/**
|
|
5
7
|
* React-properties for the RevealWidget
|
|
6
8
|
*/
|
|
@@ -25,12 +27,19 @@ export type RevealWidgetProps = {
|
|
|
25
27
|
* The widget calls this with `undefined` when the component unmounts or this callback changes
|
|
26
28
|
*/
|
|
27
29
|
setControllerRef?: (controller: RevealWidgetController | undefined) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Reports which application is using the widget and which of its features are being triggered
|
|
32
|
+
* (e.g. adding a resource, moving the camera). See `RevealWidgetTrackingProps` for the options.
|
|
33
|
+
*/
|
|
34
|
+
tracking?: RevealWidgetTrackingProps;
|
|
35
|
+
/** Identifies the host application */
|
|
36
|
+
appIdentifier: string;
|
|
28
37
|
};
|
|
29
38
|
/**
|
|
30
39
|
* RevealWidget component - the React entry point for the Reveal Widget.
|
|
31
40
|
* An example with some custom UI components:
|
|
32
41
|
* ```
|
|
33
|
-
* <RevealWidget setControllerRef={setControllerRef} viewerOptions={{ sdk, useCoreDm: true }}>
|
|
42
|
+
* <RevealWidget setControllerRef={setControllerRef} viewerOptions={{ sdk, useCoreDm: true }} appIdentifier="YourAppId">
|
|
34
43
|
* <RevealToolbar
|
|
35
44
|
* toolBarContent={
|
|
36
45
|
* <CommandButtons
|
|
@@ -59,4 +68,4 @@ export type RevealWidgetProps = {
|
|
|
59
68
|
* }, []);
|
|
60
69
|
* ```
|
|
61
70
|
*/
|
|
62
|
-
export declare function RevealWidget({ viewerOptions, setControllerRef, children, }: PropsWithChildren<RevealWidgetProps>): ReactElement;
|
|
71
|
+
export declare function RevealWidget({ viewerOptions, setControllerRef, tracking, appIdentifier, children, }: PropsWithChildren<RevealWidgetProps>): ReactElement;
|
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
import { ToolUI as e } from "../commandBased/main/ToolUI.js";
|
|
2
2
|
import "../commandBased/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { UsageMetricsTrackerContext as t } from "../RevealCanvas/UsageMetricsTrackerContext.js";
|
|
4
|
+
import { RevealWidgetContext as n } from "./RevealWidget.context.js";
|
|
5
|
+
import { useRevealWidgetMetricsTracking as r } from "./useRevealWidgetMetricsTracking.js";
|
|
6
|
+
import { useContext as i, useEffect as a, useMemo as o, useRef as s } from "react";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
8
|
//#region libs/shared/reveal-components/src/ui/components/Widget/RevealWidget.tsx
|
|
7
|
-
function
|
|
8
|
-
let { RevealContext:
|
|
9
|
-
if ("inheritFromRevealContext" in e) return /* @__PURE__ */
|
|
10
|
-
setControllerRef:
|
|
11
|
-
|
|
9
|
+
function u({ viewerOptions: e, setControllerRef: t, tracking: a, appIdentifier: o, children: s }) {
|
|
10
|
+
let { RevealContext: l } = i(n), u = r(o, a);
|
|
11
|
+
if ("inheritFromRevealContext" in e) return /* @__PURE__ */ c(d, {
|
|
12
|
+
setControllerRef: t,
|
|
13
|
+
usageMetricsTracker: u,
|
|
14
|
+
children: s
|
|
12
15
|
});
|
|
13
16
|
{
|
|
14
|
-
let { sdk:
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
viewerOptions:
|
|
17
|
-
sdk:
|
|
18
|
-
useCoreDm:
|
|
19
|
-
children: /* @__PURE__ */
|
|
20
|
-
setControllerRef:
|
|
21
|
-
|
|
17
|
+
let { sdk: n, useCoreDm: r, ...i } = e;
|
|
18
|
+
return /* @__PURE__ */ c(l, {
|
|
19
|
+
viewerOptions: i,
|
|
20
|
+
sdk: n,
|
|
21
|
+
useCoreDm: r,
|
|
22
|
+
children: /* @__PURE__ */ c(d, {
|
|
23
|
+
setControllerRef: t,
|
|
24
|
+
usageMetricsTracker: u,
|
|
25
|
+
children: s
|
|
22
26
|
})
|
|
23
27
|
});
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
|
-
function
|
|
27
|
-
let { createRevealWidgetController:
|
|
28
|
-
|
|
30
|
+
function d({ setControllerRef: r, usageMetricsTracker: u, children: d }) {
|
|
31
|
+
let { createRevealWidgetController: f, RevealCanvas: p, useRenderTarget: m } = i(n), h = m(), g = s(u);
|
|
32
|
+
a(() => {
|
|
33
|
+
g.current = u;
|
|
34
|
+
}, [u]);
|
|
35
|
+
let _ = o(() => ({ track: (e, t) => g.current.track(e, t) }), []), v = o(() => f(h, _), [
|
|
36
|
+
h,
|
|
37
|
+
f,
|
|
38
|
+
_
|
|
39
|
+
]);
|
|
40
|
+
return a(() => (r?.(v), () => r?.(void 0)), [r, v]), /* @__PURE__ */ c(t.Provider, {
|
|
41
|
+
value: _,
|
|
42
|
+
children: /* @__PURE__ */ l(p, { children: [d, /* @__PURE__ */ c(e, {})] })
|
|
43
|
+
});
|
|
29
44
|
}
|
|
30
45
|
//#endregion
|
|
31
|
-
export {
|
|
46
|
+
export { u as RevealWidget };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { CameraState } from '@cognite/reveal';
|
|
2
2
|
import { RevealDomainObject, RevealRenderTarget } from '../../../domains';
|
|
3
|
+
import { UsageMetricsTracker } from '../../../utilities/usageMetricsTracker';
|
|
3
4
|
/**
|
|
4
5
|
* Controller class for simple camera manipulation in
|
|
5
6
|
* the RevealWidget
|
|
6
7
|
*/
|
|
7
8
|
export declare class RevealWidgetCameraController {
|
|
8
9
|
private _renderTarget;
|
|
9
|
-
|
|
10
|
+
private readonly _usageMetricsTracker;
|
|
11
|
+
constructor(_renderTarget: RevealRenderTarget, _usageMetricsTracker?: UsageMetricsTracker);
|
|
10
12
|
/**
|
|
11
13
|
* Focus all visible models in the scene
|
|
12
14
|
*/
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { noopUsageMetricsTracker as e } from "../../../utilities/usageMetricsTracker.js";
|
|
2
|
+
import { enterNearby360Image as t } from "../../../utilities/navigation/enterNearby360Image.js";
|
|
2
3
|
import "../../../utilities/navigation/index.js";
|
|
3
|
-
import { CDF_TO_VIEWER_TRANSFORMATION as
|
|
4
|
+
import { CDF_TO_VIEWER_TRANSFORMATION as n } from "@cognite/reveal";
|
|
4
5
|
//#region libs/shared/reveal-components/src/ui/components/Widget/RevealWidgetCameraController.ts
|
|
5
|
-
var
|
|
6
|
+
var r = class {
|
|
6
7
|
_renderTarget;
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
_usageMetricsTracker;
|
|
9
|
+
constructor(t, n = e) {
|
|
10
|
+
this._renderTarget = t, this._usageMetricsTracker = n;
|
|
9
11
|
}
|
|
10
12
|
focusCameraAll() {
|
|
11
|
-
this._renderTarget.fitView();
|
|
13
|
+
this._usageMetricsTracker.track("reveal-widget.camera.focusCameraAll"), this._renderTarget.fitView();
|
|
12
14
|
}
|
|
13
15
|
focusModel(e) {
|
|
14
|
-
this._renderTarget.viewer.fitCameraToBoundingBox(e.getBoundingBox().applyMatrix4(
|
|
16
|
+
this._usageMetricsTracker.track("reveal-widget.camera.focusModel"), this._renderTarget.viewer.fitCameraToBoundingBox(e.getBoundingBox().applyMatrix4(n));
|
|
15
17
|
}
|
|
16
18
|
getCameraState() {
|
|
17
19
|
return this._renderTarget.viewer.cameraManager.getCameraState();
|
|
18
20
|
}
|
|
19
21
|
setCameraState(e) {
|
|
20
|
-
return this._renderTarget.viewer.cameraManager.setCameraState(e);
|
|
22
|
+
return this._usageMetricsTracker.track("reveal-widget.camera.setCameraState"), this._renderTarget.viewer.cameraManager.setCameraState(e);
|
|
21
23
|
}
|
|
22
24
|
enterNearby360Image() {
|
|
23
|
-
return
|
|
25
|
+
return this._usageMetricsTracker.track("reveal-widget.camera.enterNearby360Image"), t(this._renderTarget.viewer);
|
|
24
26
|
}
|
|
25
27
|
};
|
|
26
28
|
//#endregion
|
|
27
|
-
export {
|
|
29
|
+
export { r as RevealWidgetCameraController };
|
|
@@ -8,6 +8,7 @@ import { RevealDomainObjectUtils } from '../../../domains/reveal/RevealDomainObj
|
|
|
8
8
|
import { SceneDomainObject } from '../../../domains/scene/SceneDomainObject';
|
|
9
9
|
import { InstanceId } from '../../../utilities/instanceIds';
|
|
10
10
|
import { InstanceStylingGroup } from '../../../utilities/modelIds';
|
|
11
|
+
import { UsageMetricsTracker } from '../../../utilities/usageMetricsTracker';
|
|
11
12
|
import { RevealWidgetCameraController } from './RevealWidgetCameraController';
|
|
12
13
|
import { applyCadDefaultStyling } from './styling/applyCadDefaultStyling';
|
|
13
14
|
import { applyPointCloudDefaultStyling } from './styling/applyPointCloudDefaultStyling';
|
|
@@ -28,8 +29,9 @@ export declare const defaultRevealWidgetControllerDependencies: RevealWidgetCont
|
|
|
28
29
|
export declare class RevealWidgetController {
|
|
29
30
|
private readonly _renderTarget;
|
|
30
31
|
private readonly _dependencies;
|
|
32
|
+
private readonly _usageMetricsTracker;
|
|
31
33
|
private readonly _cameraController;
|
|
32
|
-
constructor(_renderTarget: RevealRenderTarget, _dependencies?: RevealWidgetControllerDependencies);
|
|
34
|
+
constructor(_renderTarget: RevealRenderTarget, _dependencies?: RevealWidgetControllerDependencies, _usageMetricsTracker?: UsageMetricsTracker);
|
|
33
35
|
/**
|
|
34
36
|
* Access the RevealWidgetCameraController for camera controls
|
|
35
37
|
*/
|
|
@@ -2,44 +2,46 @@ import { assertNever as e } from "../../../utilities/assertNever.js";
|
|
|
2
2
|
import { RevealDomainObject as t } from "../../../domains/reveal/RevealDomainObject.js";
|
|
3
3
|
import { Image360CollectionDomainObject as n } from "../../../domains/reveal/Image360Collection/Image360CollectionDomainObject.js";
|
|
4
4
|
import { PointCloudDomainObject as r } from "../../../domains/reveal/pointCloud/PointCloudDomainObject.js";
|
|
5
|
-
import {
|
|
5
|
+
import { noopUsageMetricsTracker as i } from "../../../utilities/usageMetricsTracker.js";
|
|
6
6
|
import { convertNewImage360AddOptionToRevealAddOptions as a, convertNewModel3dAddOptionToRevealAddOptions as o } from "../../../data-providers/types/typeAdapters.js";
|
|
7
|
-
import {
|
|
8
|
-
import { RevealDomainObjectUtils as c } from "../../../domains/reveal/RevealDomainObjectUtils.js";
|
|
9
|
-
import { SceneDomainObject as l } from "../../../domains/scene/SceneDomainObject.js";
|
|
10
|
-
import "../../../domains/index.js";
|
|
7
|
+
import { findViewerAnnotationInfo as s } from "../../../data-providers/cache/utils.js";
|
|
11
8
|
import "../../../data-providers/cache/index.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
9
|
+
import { CadDomainObject as c } from "../../../domains/reveal/cad/CadDomainObject.js";
|
|
10
|
+
import { RevealDomainObjectUtils as l } from "../../../domains/reveal/RevealDomainObjectUtils.js";
|
|
11
|
+
import { SceneDomainObject as u } from "../../../domains/scene/SceneDomainObject.js";
|
|
12
|
+
import "../../../domains/index.js";
|
|
13
|
+
import { getBoundsForInstance as d } from "../../../data-providers/network/bounds/getBoundsForInstance.js";
|
|
14
|
+
import { getResourceIdentifiersFromResourceOptions as f } from "../../../data-providers/network/common/getResourceIdentifierFromResourceOptions.js";
|
|
15
|
+
import { getResourceIdentifierWithType as p } from "../../../data-providers/network/common/getResourceIdentifierWithType.js";
|
|
16
|
+
import { RevealWidgetCameraController as m } from "./RevealWidgetCameraController.js";
|
|
17
|
+
import { applyCadDefaultStyling as h } from "./styling/applyCadDefaultStyling.js";
|
|
18
|
+
import { applyCadInstanceStyling as g } from "./styling/applyCadInstanceStyling.js";
|
|
19
|
+
import { applyImage360InstanceStyling as _ } from "./styling/applyImage360InstanceStyling.js";
|
|
20
|
+
import { applyPointCloudDefaultStyling as v } from "./styling/applyPointCloudDefaultStyling.js";
|
|
21
|
+
import { applyPointCloudInstanceStyling as y } from "./styling/applyPointCloudInstanceStyling.js";
|
|
21
22
|
//#region libs/shared/reveal-components/src/ui/components/Widget/RevealWidgetController.ts
|
|
22
|
-
var
|
|
23
|
-
addCadModel:
|
|
24
|
-
addPointCloud:
|
|
25
|
-
addImage360:
|
|
26
|
-
sceneFactory: (e) => new
|
|
27
|
-
getBoundsForInstance:
|
|
28
|
-
findViewerAnnotationInfo:
|
|
29
|
-
applyCadDefaultStyling:
|
|
30
|
-
applyPointCloudDefaultStyling:
|
|
31
|
-
},
|
|
23
|
+
var b = {
|
|
24
|
+
addCadModel: l.addCadDomainObject,
|
|
25
|
+
addPointCloud: l.addPointCloudDomainObject,
|
|
26
|
+
addImage360: l.addImage360CollectionDomainObject,
|
|
27
|
+
sceneFactory: (e) => new u(e),
|
|
28
|
+
getBoundsForInstance: d,
|
|
29
|
+
findViewerAnnotationInfo: s,
|
|
30
|
+
applyCadDefaultStyling: h,
|
|
31
|
+
applyPointCloudDefaultStyling: v
|
|
32
|
+
}, x = class {
|
|
32
33
|
_renderTarget;
|
|
33
34
|
_dependencies;
|
|
35
|
+
_usageMetricsTracker;
|
|
34
36
|
_cameraController;
|
|
35
|
-
constructor(e, t =
|
|
36
|
-
this._renderTarget = e, this._dependencies = t, this._cameraController = new
|
|
37
|
+
constructor(e, t = b, n = i) {
|
|
38
|
+
this._renderTarget = e, this._dependencies = t, this._usageMetricsTracker = n, this._cameraController = new m(this._renderTarget, this._usageMetricsTracker);
|
|
37
39
|
}
|
|
38
40
|
get cameraController() {
|
|
39
41
|
return this._cameraController;
|
|
40
42
|
}
|
|
41
43
|
async addResource(t) {
|
|
42
|
-
if (t.type === "scene") {
|
|
44
|
+
if (this._usageMetricsTracker.track("reveal-widget.resource.add", { resourceType: t.type }), t.type === "scene") {
|
|
43
45
|
let e = this._dependencies.sceneFactory(t);
|
|
44
46
|
return this._renderTarget.root.addChild(e), await e.load(this._renderTarget), e;
|
|
45
47
|
}
|
|
@@ -73,16 +75,21 @@ var y = {
|
|
|
73
75
|
return this.getModels().filter((e) => e.isVisible(this._renderTarget));
|
|
74
76
|
}
|
|
75
77
|
styleByInstance(e, t) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
this._usageMetricsTracker.track("reveal-widget.style.byInstance", {
|
|
79
|
+
instanceGroupCount: e.length,
|
|
80
|
+
modelCount: t.length
|
|
81
|
+
});
|
|
82
|
+
let i = g(e, t.filter((e) => e instanceof c), this._renderTarget.cdfCaches.cogniteClient, this._renderTarget.cdfCaches.cadMappingsCache);
|
|
83
|
+
return y(e, t.filter((e) => e instanceof r)), _(e, t.filter((e) => e instanceof n)), i;
|
|
78
84
|
}
|
|
79
85
|
async applyDefaultStyling(e, t) {
|
|
80
|
-
let i = this._dependencies.applyCadDefaultStyling(e, t.filter((e) => e instanceof
|
|
86
|
+
let i = this._dependencies.applyCadDefaultStyling(e, t.filter((e) => e instanceof c), this._renderTarget.cdfCaches.cadMappingsCache);
|
|
81
87
|
this._dependencies.applyPointCloudDefaultStyling(e, t.filter((e) => e instanceof r));
|
|
82
88
|
let a = e.contextualizedAppearance ?? e.defaultAppearance ?? {};
|
|
83
89
|
t.filter((e) => e instanceof n).forEach((e) => e.setDefaultStyling(a)), await i;
|
|
84
90
|
}
|
|
85
91
|
async focusInstances(e) {
|
|
92
|
+
this._usageMetricsTracker.track("reveal-widget.camera.focusInstances", { instanceCount: e.length });
|
|
86
93
|
let t = await this._dependencies.getBoundsForInstance(e, this.getVisibleModels(), this._renderTarget.viewer, this._renderTarget.cdfCaches.cadMappingsCache, this._renderTarget.cdfCaches.image360Cache);
|
|
87
94
|
if (t.length === 0) return;
|
|
88
95
|
let n = t[0];
|
|
@@ -97,14 +104,14 @@ var y = {
|
|
|
97
104
|
}
|
|
98
105
|
}
|
|
99
106
|
async getResourceIdentifierWithType(e) {
|
|
100
|
-
return
|
|
107
|
+
return p(e, this._renderTarget.viewer, this._renderTarget.root.fdmSdk);
|
|
101
108
|
}
|
|
102
109
|
async getResourceIdentifiersFromResourceOptions(e) {
|
|
103
|
-
return
|
|
110
|
+
return f(e, this._renderTarget.viewer, this._renderTarget.root.fdmSdk);
|
|
104
111
|
}
|
|
105
112
|
async getScreenshot(e, t, n) {
|
|
106
113
|
return this._renderTarget.viewer.getScreenshot(e, t, n);
|
|
107
114
|
}
|
|
108
115
|
};
|
|
109
116
|
//#endregion
|
|
110
|
-
export {
|
|
117
|
+
export { x as RevealWidgetController, b as defaultRevealWidgetControllerDependencies };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { RevealWidget, type RevealWidgetProps } from './RevealWidget';
|
|
1
|
+
export { RevealWidget, type RevealWidgetProps, type RevealWidgetTrackingProps, } from './RevealWidget';
|
|
2
2
|
export { RevealWidgetController } from './RevealWidgetController';
|
|
3
3
|
export { Default3DStyles } from './styling/constants';
|
|
4
4
|
export { RevealWidgetCameraController } from './RevealWidgetCameraController';
|
|
@@ -2,18 +2,18 @@ import { createInstanceKey as e } from "../../../../data-providers/cache/idAndKe
|
|
|
2
2
|
import { createInstanceReferenceKey as t } from "../../../../utilities/instanceIds/toKey.js";
|
|
3
3
|
import "../../../../utilities/instanceIds/index.js";
|
|
4
4
|
import { isDefined as n } from "../../../../utilities/isDefined.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { getInstanceReferencesFromPointCloudVolume as r, getPointCloudVolumeId as i } from "../../../../data-providers/cache/utils.js";
|
|
6
|
+
import { concatenateMapValues as a } from "../../../../utilities/map/concatenateMapValues.js";
|
|
7
7
|
import { createPointCloudObjectCollectionFromVolumeIds as o } from "../../PointCloudContainer/useApplyPointCloudStyling.js";
|
|
8
8
|
//#region libs/shared/reveal-components/src/ui/components/Widget/styling/applyPointCloudInstanceStyling.ts
|
|
9
9
|
var s = Symbol("widget-instance-styling");
|
|
10
10
|
function c(c, l) {
|
|
11
11
|
let u = new Map(c.flatMap((t) => t.instanceIds.map((n) => t.style.pointcloud === void 0 ? void 0 : [e(n), t.style.pointcloud]).filter(n)));
|
|
12
12
|
l.forEach((e) => {
|
|
13
|
-
let c = e.model.stylableObjects.flatMap((e) =>
|
|
13
|
+
let c = e.model.stylableObjects.flatMap((e) => r(e).map((n) => {
|
|
14
14
|
let r = u.get(t(n));
|
|
15
|
-
return r === void 0 ? void 0 : [r,
|
|
16
|
-
}).filter(n)), l =
|
|
15
|
+
return r === void 0 ? void 0 : [r, i(e)];
|
|
16
|
+
}).filter(n)), l = a(c), d = l.entries().map(([e, t]) => {
|
|
17
17
|
let n = o(t);
|
|
18
18
|
return n === void 0 ? void 0 : {
|
|
19
19
|
collection: n,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createMixpanelUsageMetricsTracker } from '../../../utilities/createMixpanelUsageMetricsTracker';
|
|
2
|
+
import { UsageMetricsTracker } from '../../../utilities/usageMetricsTracker';
|
|
3
|
+
export type UseRevealWidgetMetricsTrackingDeps = {
|
|
4
|
+
createMixpanelUsageMetricsTracker: typeof createMixpanelUsageMetricsTracker;
|
|
5
|
+
};
|
|
6
|
+
export type RevealWidgetTrackingProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Mixpanel project token used to report usage events.
|
|
9
|
+
* Defaults to a Cognite-owned reveal-widget project if omitted.
|
|
10
|
+
*/
|
|
11
|
+
mixpanelToken?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Routes events into the host application's own tracker instead of Mixpanel. */
|
|
14
|
+
| {
|
|
15
|
+
usageMetricsTracker: UsageMetricsTracker;
|
|
16
|
+
}
|
|
17
|
+
/** Opts out of usage tracking entirely, including the default Mixpanel sink. */
|
|
18
|
+
| {
|
|
19
|
+
disabled: true;
|
|
20
|
+
};
|
|
21
|
+
export declare function useRevealWidgetMetricsTracking(appIdentifier: string, tracking: RevealWidgetTrackingProps | undefined, deps?: UseRevealWidgetMetricsTrackingDeps): UsageMetricsTracker;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { noopUsageMetricsTracker as e } from "../../../utilities/usageMetricsTracker.js";
|
|
2
|
+
import { DEFAULT_REVEAL_WIDGET_MIXPANEL_TOKEN as t, createMixpanelUsageMetricsTracker as n } from "../../../utilities/createMixpanelUsageMetricsTracker.js";
|
|
3
|
+
import { useMemo as r } from "react";
|
|
4
|
+
//#region libs/shared/reveal-components/src/ui/components/Widget/useRevealWidgetMetricsTracking.ts
|
|
5
|
+
var i = { createMixpanelUsageMetricsTracker: n };
|
|
6
|
+
function a(t, n, a = i) {
|
|
7
|
+
let { disabled: s, usageMetricsTracker: c, mixpanelToken: l } = o(n);
|
|
8
|
+
return r(() => s ? e : c === void 0 ? a.createMixpanelUsageMetricsTracker(l, t) : c, [
|
|
9
|
+
s,
|
|
10
|
+
c,
|
|
11
|
+
l,
|
|
12
|
+
t,
|
|
13
|
+
a
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
function o(e) {
|
|
17
|
+
let n = {
|
|
18
|
+
disabled: !1,
|
|
19
|
+
mixpanelToken: t
|
|
20
|
+
};
|
|
21
|
+
return e === void 0 ? n : "disabled" in e ? {
|
|
22
|
+
...n,
|
|
23
|
+
disabled: e.disabled
|
|
24
|
+
} : "usageMetricsTracker" in e ? {
|
|
25
|
+
...n,
|
|
26
|
+
usageMetricsTracker: e.usageMetricsTracker
|
|
27
|
+
} : {
|
|
28
|
+
...n,
|
|
29
|
+
mixpanelToken: e.mixpanelToken ?? "35470288c6070af490c9c1aa3c487d9d"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { a as useRevealWidgetMetricsTracking };
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { IconAlertTriangle as e, IconAngle as t, IconArrowLeft as n, IconArrowRight as r,
|
|
1
|
+
import { IconAlertTriangle as e, IconAngle as t, IconArrowLeft as n, IconArrowRight as r, IconBorderHorizontal as i, IconBorderVertical as a, IconBug as o, IconChartScatter3d as s, IconCircle as c, IconClearAll as l, IconCloudFog as u, IconCopy as d, IconCrop as f, IconCube as p, IconCubeSend as m, IconCubeUnfolded as h, IconCursorText as g, IconCylinder as _, IconDeviceFloppy as v, IconDrone as y, IconEye as b, IconFilter as x, IconFlag as S, IconFlipHorizontal as C, IconFlipVertical as w, IconFolder as T, IconFolderFilled as E, IconGripVertical as D, IconHelp as O, IconHexagon as k, IconHierarchy as A, IconInfoCircle as j, IconLeaf as ee, IconLine as M, IconListTree as N, IconMapPin as P, IconMaximize as F, IconPerspective as I, IconPhotoScan as L, IconPlus as R, IconPoint as z, IconPolygon as B, IconRefresh as V, IconRestore as H, IconRuler as U, IconRulerMeasure as W, IconSettings as G, IconShape as K, IconShare as q, IconSnowflake as J, IconStack2 as Y, IconSun as X, IconTrash as Z, IconVectorBezier as Q, IconX as $ } from "@tabler/icons-react";
|
|
2
2
|
//#region libs/shared/reveal-components/src/ui/components/commandBased/Factories/DefaultIcons.tsx
|
|
3
3
|
var te = [
|
|
4
4
|
["Angle", t],
|
|
5
|
-
["AssetsIcon",
|
|
5
|
+
["AssetsIcon", k],
|
|
6
6
|
["ArrowLeft", n],
|
|
7
7
|
["ArrowRight", r],
|
|
8
|
-
["Axis3D",
|
|
9
|
-
["BorderHorizontal",
|
|
10
|
-
["BorderVertical",
|
|
11
|
-
["Bug",
|
|
12
|
-
["Circle",
|
|
13
|
-
["ClearAll",
|
|
8
|
+
["Axis3D", s],
|
|
9
|
+
["BorderHorizontal", i],
|
|
10
|
+
["BorderVertical", a],
|
|
11
|
+
["Bug", o],
|
|
12
|
+
["Circle", c],
|
|
13
|
+
["ClearAll", l],
|
|
14
14
|
["CloseLarge", $],
|
|
15
|
-
["CloudFog",
|
|
15
|
+
["CloudFog", u],
|
|
16
16
|
["Coordinates", P],
|
|
17
|
-
["Copy",
|
|
18
|
-
["Crop",
|
|
19
|
-
["Cube",
|
|
20
|
-
["CubeFrontLeft",
|
|
21
|
-
["CubeFrontRight",
|
|
22
|
-
["Cubes",
|
|
23
|
-
["CubeTop",
|
|
24
|
-
["Cursor",
|
|
25
|
-
["CylinderArbitrary",
|
|
26
|
-
["CylinderHorizontal",
|
|
27
|
-
["CylinderVertical",
|
|
17
|
+
["Copy", d],
|
|
18
|
+
["Crop", f],
|
|
19
|
+
["Cube", p],
|
|
20
|
+
["CubeFrontLeft", m],
|
|
21
|
+
["CubeFrontRight", m],
|
|
22
|
+
["Cubes", h],
|
|
23
|
+
["CubeTop", p],
|
|
24
|
+
["Cursor", g],
|
|
25
|
+
["CylinderArbitrary", _],
|
|
26
|
+
["CylinderHorizontal", _],
|
|
27
|
+
["CylinderVertical", _],
|
|
28
28
|
["Delete", Z],
|
|
29
|
-
["Drone",
|
|
29
|
+
["Drone", y],
|
|
30
30
|
["ExpandAlternative", F],
|
|
31
|
-
["EyeShow",
|
|
32
|
-
["Filter",
|
|
33
|
-
["Flag",
|
|
34
|
-
["FlipHorizontal",
|
|
35
|
-
["FlipVertical",
|
|
36
|
-
["Folder",
|
|
37
|
-
["FolderFilled",
|
|
38
|
-
["Grab",
|
|
39
|
-
["Help",
|
|
31
|
+
["EyeShow", b],
|
|
32
|
+
["Filter", x],
|
|
33
|
+
["Flag", S],
|
|
34
|
+
["FlipHorizontal", C],
|
|
35
|
+
["FlipVertical", w],
|
|
36
|
+
["Folder", T],
|
|
37
|
+
["FolderFilled", E],
|
|
38
|
+
["Grab", D],
|
|
39
|
+
["Help", O],
|
|
40
40
|
["Info", j],
|
|
41
41
|
["Layers", Y],
|
|
42
42
|
["Leaf", ee],
|
|
@@ -53,7 +53,7 @@ var te = [
|
|
|
53
53
|
["Restore", H],
|
|
54
54
|
["Ruler", U],
|
|
55
55
|
["RulerAlternative", W],
|
|
56
|
-
["Save",
|
|
56
|
+
["Save", v],
|
|
57
57
|
["Settings", G],
|
|
58
58
|
["Shapes", K],
|
|
59
59
|
["Share", q],
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
2
3
|
import { BaseCommand } from '../../../../foundation/commands/BaseCommand';
|
|
3
4
|
import { BaseOptionCommand } from '../../../../foundation/commands/BaseOptionCommand';
|
|
4
5
|
import { PlacementType } from '../utils/types';
|
|
6
|
+
export declare function isSpuriousTriggerClickClose(open: boolean, { reason, event }: MenuPrimitive.Root.ChangeEventDetails): boolean;
|
|
5
7
|
export declare function createDropdownButton(command: BaseCommand, placement: PlacementType): ReactElement | undefined;
|
|
6
8
|
export declare const DropdownButton: ({ inputCommand, placement, usedInSettings, }: {
|
|
7
9
|
inputCommand: BaseOptionCommand;
|