@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
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createContext as n } from "react";
|
|
1
|
+
import { useCdfCaches as e } from "../components/RevealCanvas/ViewerContext.js";
|
|
2
|
+
import { createContext as t } from "react";
|
|
4
3
|
//#region libs/shared/reveal-components/src/ui/query/useInstancesByIdsQuery.context.ts
|
|
5
|
-
var r =
|
|
6
|
-
useAssetsByIdsQuery: e,
|
|
7
|
-
useDmInstancesByIds: t
|
|
8
|
-
}, i = n(r);
|
|
4
|
+
var n = { useCdfCaches: e }, r = t(n);
|
|
9
5
|
//#endregion
|
|
10
|
-
export {
|
|
6
|
+
export { r as UseInstancesByIdsQueryContext, n as defaultUseInstancesByIdsQueryDependencies };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
1
|
import { Asset } from '@cognite/sdk';
|
|
3
|
-
import {
|
|
2
|
+
import { DmsDescribableNode } from '../../data-providers/assets/createDmsDescribableNodesCache';
|
|
4
3
|
import { InstanceReference, InstanceReferenceKey } from '../../utilities';
|
|
5
|
-
export type UseInstancesByIdsQueryResult =
|
|
4
|
+
export type UseInstancesByIdsQueryResult<T> = {
|
|
5
|
+
data: T | undefined;
|
|
6
|
+
error: Error | undefined;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function useInstancesByIdsQuery(instances: InstanceReference[]): UseInstancesByIdsQueryResult<Map<InstanceReferenceKey, {
|
|
6
10
|
name: string;
|
|
7
|
-
asset: Asset |
|
|
8
|
-
}
|
|
9
|
-
export declare function useInstancesByIdsQuery(instances: InstanceReference[]): UseInstancesByIdsQueryResult;
|
|
11
|
+
asset: Asset | DmsDescribableNode;
|
|
12
|
+
}>>;
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
import { isDmsInstance as e, isIdEither as t } from "../../utilities/instanceIds/typeGuards.js";
|
|
2
2
|
import { createInstanceReferenceKey as n } from "../../utilities/instanceIds/toKey.js";
|
|
3
|
-
import { restrictToDmsId as r } from "../../utilities/restrictToDmsId.js";
|
|
4
|
-
import { COGNITE_DESCRIBABLE_SOURCE as i } from "../../data-providers/core-dm-provider/dataModels.js";
|
|
5
3
|
import "../../utilities/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { isDefined as r } from "../../utilities/isDefined.js";
|
|
5
|
+
import { UseInstancesByIdsQueryContext as i } from "./useInstancesByIdsQuery.context.js";
|
|
6
|
+
import { useContext as a } from "react";
|
|
7
|
+
import { useDerivedPromise as o } from "@cognite/underscore/react";
|
|
8
8
|
//#region libs/shared/reveal-components/src/ui/query/useInstancesByIdsQuery.ts
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
isLoading: h || v,
|
|
14
|
-
isError: g || y,
|
|
15
|
-
data: new Map([...(_ ?? []).map((e) => [n(e), {
|
|
9
|
+
function s(s) {
|
|
10
|
+
let { useCdfCaches: c } = a(i), l = c();
|
|
11
|
+
return o(async () => {
|
|
12
|
+
let i = s.filter(t), a = s.filter(e), o = l.classicAssetsCache.getEntities(i), c = l.dmsDescribableCache.getEntities(a), u = [...(await o).values().filter(r).map((e) => ({
|
|
16
13
|
name: e.name,
|
|
17
14
|
asset: e
|
|
18
|
-
}
|
|
19
|
-
name: e.properties
|
|
15
|
+
})), ...(await c).values().map((e) => ({
|
|
16
|
+
name: e.properties?.cdf_cdm?.["CogniteDescribable/v1"]?.name ?? e.externalId,
|
|
20
17
|
asset: e
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
m,
|
|
25
|
-
v,
|
|
26
|
-
y,
|
|
27
|
-
h,
|
|
28
|
-
g
|
|
29
|
-
]);
|
|
18
|
+
}))];
|
|
19
|
+
return new Map(u.map((e) => [n(e.asset), e]));
|
|
20
|
+
}, [s, l]);
|
|
30
21
|
}
|
|
31
22
|
//#endregion
|
|
32
|
-
export {
|
|
23
|
+
export { s as useInstancesByIdsQuery };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Context } from 'react';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { PickDeep } from 'type-fest';
|
|
4
|
+
import { DmsDescribableNode } from '../../data-providers/assets/createDmsDescribableNodesCache';
|
|
5
|
+
import { DmsUniqueIdentifier } from '../../data-providers/FdmSDK';
|
|
6
|
+
import { CdfCaches } from '../../foundation/renderTarget/CdfCaches';
|
|
7
|
+
export type UseNamedDmInstancesByIdsDependencies = {
|
|
8
|
+
useCdfCaches: () => PickDeep<CdfCaches, 'dmsDescribableCache.getEntities'>;
|
|
9
|
+
};
|
|
10
|
+
export declare const defaultUseNamedDmInstancesByIdsDependencies: UseNamedDmInstancesByIdsDependencies;
|
|
11
|
+
export declare const UseNamedDmInstancesByIdsContext: Context<UseNamedDmInstancesByIdsDependencies>;
|
|
12
|
+
export declare const useNamedDmInstancesByIds: (ids: DmsUniqueIdentifier[]) => Pick<UseQueryResult<Array<DmsDescribableNode | undefined>>, "data" | "isLoading" | "isError" | "isFetching">;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type ReadonlyEntityCache<K, T, SerializedKey extends string | number = string> = {
|
|
2
|
+
getEntities(key: K[]): Promise<Map<SerializedKey, T>>;
|
|
3
|
+
};
|
|
4
|
+
export declare function createReadonlyEntityCache<K, T, SerializedKey extends string | number = string>(fetch: (keys: K[]) => Promise<Map<SerializedKey, T>>, serializeKey: (key: K) => SerializedKey): ReadonlyEntityCache<K, T, SerializedKey>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isDefined as e } from "../isDefined.js";
|
|
2
|
+
//#region libs/shared/reveal-components/src/utilities/cache/ReadonlyEntityCache.ts
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
return new n(e, t);
|
|
5
|
+
}
|
|
6
|
+
var n = class {
|
|
7
|
+
_fetch;
|
|
8
|
+
_serializeKey;
|
|
9
|
+
_cache = /* @__PURE__ */ new Map();
|
|
10
|
+
constructor(e, t) {
|
|
11
|
+
this._fetch = e, this._serializeKey = t;
|
|
12
|
+
}
|
|
13
|
+
async getEntities(t) {
|
|
14
|
+
let n = t.filter((e) => !this._cache.has(this._serializeKey(e))), r = n.length === 0 ? Promise.resolve(/* @__PURE__ */ new Map()) : this._fetch(n);
|
|
15
|
+
n.forEach((e) => {
|
|
16
|
+
let t = this._serializeKey(e), n = r.then((e) => e.get(t));
|
|
17
|
+
this._cache.set(t, n), n.catch(() => this._cache.delete(t));
|
|
18
|
+
});
|
|
19
|
+
let i = await Promise.all(t.map((e) => {
|
|
20
|
+
let t = this._serializeKey(e);
|
|
21
|
+
return this._cache.get(t)?.then((e) => e === void 0 ? void 0 : [t, e]);
|
|
22
|
+
}));
|
|
23
|
+
return new Map(i.filter(e));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { t as createReadonlyEntityCache };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UsageMetricsTracker } from './usageMetricsTracker';
|
|
2
|
+
/** The subset of the `mixpanel-browser` instance API this module relies on. */
|
|
3
|
+
export type MixpanelInstance = {
|
|
4
|
+
register: (properties: Record<string, string>) => void;
|
|
5
|
+
track: (event: string, properties?: Record<string, unknown>) => void;
|
|
6
|
+
};
|
|
7
|
+
/** Narrow, injectable seam around `mixpanel.init` so tests don't need to `vi.mock` the library. */
|
|
8
|
+
export type MixpanelInitFn = (token: string, config: Record<string, unknown>, name: string) => MixpanelInstance;
|
|
9
|
+
export type CreateMixpanelUsageMetricsTrackerDeps = {
|
|
10
|
+
mixpanelInit: MixpanelInitFn;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Mixpanel project token `RevealWidget` reports to by default when a consumer doesn't supply its
|
|
14
|
+
* own `tracking.mixpanelToken` or `tracking.usageMetricsTracker` (and hasn't set
|
|
15
|
+
* `tracking.disabled`). Tracking is a no-op until this is filled in with a real project token.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_REVEAL_WIDGET_MIXPANEL_TOKEN = "35470288c6070af490c9c1aa3c487d9d";
|
|
18
|
+
/**
|
|
19
|
+
* Default `UsageMetricsTracker` sink for `RevealWidget`, backed by a dedicated, named
|
|
20
|
+
* `mixpanel-browser` instance so that a host application's
|
|
21
|
+
* own Mixpanel setup is never overwritten by the widget, and vice versa.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createMixpanelUsageMetricsTracker(mixpanelToken: string, appIdentifier: string, deps?: CreateMixpanelUsageMetricsTrackerDeps): UsageMetricsTracker;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import e from "mixpanel-browser";
|
|
2
|
+
//#region libs/shared/reveal-components/src/utilities/createMixpanelUsageMetricsTracker.ts
|
|
3
|
+
var t = "https://api-eu.mixpanel.com", n = "reveal-widget", r = { mixpanelInit: e.init }, i = "35470288c6070af490c9c1aa3c487d9d";
|
|
4
|
+
function a(e, i, a = r) {
|
|
5
|
+
let o = a.mixpanelInit(e, {
|
|
6
|
+
api_host: t,
|
|
7
|
+
persistence: "localStorage",
|
|
8
|
+
property_blacklist: [
|
|
9
|
+
"$current_url",
|
|
10
|
+
"$referrer",
|
|
11
|
+
"$initial_referrer"
|
|
12
|
+
]
|
|
13
|
+
}, n);
|
|
14
|
+
return o.register({ application: i }), { track(e, t) {
|
|
15
|
+
try {
|
|
16
|
+
o.track(e, t);
|
|
17
|
+
} catch (t) {
|
|
18
|
+
console.warn(`RevealWidget: failed to track "${e}"`, t);
|
|
19
|
+
}
|
|
20
|
+
} };
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { i as DEFAULT_REVEAL_WIDGET_MIXPANEL_TOKEN, a as createMixpanelUsageMetricsTracker };
|
|
@@ -4,3 +4,5 @@ export { type Image360AnnotationContent, type Image360AnnotationId, isAnnotation
|
|
|
4
4
|
export { DataPaginator, type QueryDataProvider, AutoCursoringProvider, type CursorQueryFunction, } from './cursoring';
|
|
5
5
|
export { enterNearby360Image } from './navigation';
|
|
6
6
|
export { queryKeys } from './queryKeys';
|
|
7
|
+
export { useMemoWithUpdateSignal } from './signal/useMemoWithUpdateSignal';
|
|
8
|
+
export { useCombinedUpdateSignal } from './signal/useCombinedUpdateSignal';
|
|
@@ -15,4 +15,6 @@ import { AutoCursoringProvider as k } from "./cursoring/autoCursoringProvider.js
|
|
|
15
15
|
import { enterNearby360Image as A } from "./navigation/enterNearby360Image.js";
|
|
16
16
|
import "./navigation/index.js";
|
|
17
17
|
import { queryKeys as j } from "./queryKeys.js";
|
|
18
|
-
|
|
18
|
+
import { useMemoWithUpdateSignal as M } from "./signal/useMemoWithUpdateSignal.js";
|
|
19
|
+
import { useCombinedUpdateSignal as N } from "./signal/useCombinedUpdateSignal.js";
|
|
20
|
+
export { k as AutoCursoringProvider, O as DataPaginator, y as createInstanceReferenceKey, b as createResourceIdentifierKey, A as enterNearby360Image, D as getAssetInstanceReference, x as getImage360AnnotationAssetRef, S as getImage360AnnotationId, e as isAnnotationInstanceRef, T as isClassicAsset, t as isClassicImage360Annotation, n as isClassicImage360AnnotationId, r as isClassicImage360AssetAnnotationData, s as isClassicInstanceId, c as isClassicModelIdentifier, i as isDMImage360Annotation, a as isDMImage360AnnotationId, l as isDMModelIdentifier, E as isDmAsset, u as isDmsInstance, d as isExternalId, o as isHybridImage360AssetAnnotationData, f as isIdEither, p as isInternalId, m as isSameAssetReference, C as isSameDMAnnotationId, h as isSameDmsId, g as isSameExternalId, _ as isSameIdEither, w as isSameImage360AnnotationId, v as isSameInternalId, j as queryKeys, N as useCombinedUpdateSignal, M as useMemoWithUpdateSignal };
|
|
@@ -3,10 +3,10 @@ import { instanceIdToInstanceReference as n } from "../data-providers/cache/idAn
|
|
|
3
3
|
import "./instanceIds/index.js";
|
|
4
4
|
import { getImage360AnnotationAssetRef as r } from "./image360Annotations/getImage360AnnotationAssetRef.js";
|
|
5
5
|
import "./image360Annotations/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { isDM3DModelIdentifier as i } from "./modelIds/typeGuards.js";
|
|
7
|
+
import { getMappingInstanceId as a } from "../data-providers/cache/cad/assetMappingTypes.js";
|
|
8
|
+
import { fetchAncestorNodesForTreeIndex as o } from "../data-providers/cache/requests.js";
|
|
9
|
+
import { EMPTY_ARRAY as s } from "./constants.js";
|
|
10
10
|
//#region libs/shared/reveal-components/src/utilities/getInstancesFromClick.ts
|
|
11
11
|
async function c(e, t, n) {
|
|
12
12
|
let i = e.viewer, a = e.cdfCaches, o = a.coreDmOnly, s = i.getPixelCoordinatesFromEvent(t), c = await i.getAnyIntersectionFromPixel(s), u = (await i.get360AnnotationIntersectionFromPixel(t.offsetX, t.offsetY))?.annotation.annotation, d = u === void 0 ? void 0 : r(u);
|
|
@@ -17,7 +17,7 @@ async function c(e, t, n) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
async function l(e, t) {
|
|
20
|
-
return
|
|
20
|
+
return i(e.model.modelIdentifier) ? d(e) : await u(e, t);
|
|
21
21
|
}
|
|
22
22
|
async function u(n, r) {
|
|
23
23
|
if (r.coreDmOnly) return [];
|
|
@@ -25,19 +25,19 @@ async function u(n, r) {
|
|
|
25
25
|
return n.volumeMetadata?.instanceRef !== void 0 && e(n.volumeMetadata.instanceRef) && i.push(n.volumeMetadata.instanceRef), n.volumeMetadata?.assetRef !== void 0 && (t(n.volumeMetadata.assetRef) || e(n.volumeMetadata.assetRef)) && i.push(n.volumeMetadata.assetRef), i;
|
|
26
26
|
}
|
|
27
27
|
function d(e) {
|
|
28
|
-
return e.volumeMetadata?.assetRef === void 0 ?
|
|
28
|
+
return e.volumeMetadata?.assetRef === void 0 ? s : [e.volumeMetadata.assetRef];
|
|
29
29
|
}
|
|
30
30
|
async function f(e, t, n) {
|
|
31
31
|
let r = p(e, t), i = m(e, t, n), [a, o] = await Promise.all([r, i]);
|
|
32
32
|
return [...a, ...o];
|
|
33
33
|
}
|
|
34
34
|
async function p(e, t) {
|
|
35
|
-
return t.fdmCadNodeCache === void 0 ? [] : (await t.fdmCadNodeCache.getClosestParentDataPromises(e.model.modelId, e.model.revisionId, e.treeIndex).cadAndFdmNodesPromise)?.fdmIds ??
|
|
35
|
+
return t.fdmCadNodeCache === void 0 ? [] : (await t.fdmCadNodeCache.getClosestParentDataPromises(e.model.modelId, e.model.revisionId, e.treeIndex).cadAndFdmNodesPromise)?.fdmIds ?? s;
|
|
36
36
|
}
|
|
37
37
|
async function m(e, t, r) {
|
|
38
38
|
if (t.coreDmOnly) return [];
|
|
39
|
-
let
|
|
40
|
-
return (await t.classicCadAssetMappingCache.getAssetMappingsForLowestAncestor(e.model.modelId, e.model.revisionId,
|
|
39
|
+
let i = await (r?.fetchAncestorNodesTreeIndex ?? o)(e.model.modelId, e.model.revisionId, e.treeIndex, t.cogniteClient);
|
|
40
|
+
return (await t.classicCadAssetMappingCache.getAssetMappingsForLowestAncestor(e.model.modelId, e.model.revisionId, i)).mappings.map((e) => n(a(e)));
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
export { f as getInstancesFromCadIntersection, c as getInstancesFromClick, l as getInstancesFromPointCloudIntersection };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { LoadMetricsRecorder, LoadMetricsParameters, } from './loadMetricsParameters';
|
|
2
|
+
export { type UsageMetricsTracker, noopUsageMetricsTracker, } from './usageMetricsTracker';
|
|
2
3
|
export { getUnifiedThreeDUrlForResource, type ThreeDURLParametersBaseState, } from './getUnifiedThreeDUrlForResource';
|
|
3
4
|
export { resetRevealQualitySettings } from './resourceSettings';
|
|
4
|
-
export { type AnnotationAssetRef, type AssetInstance, AutoCursoringProvider, createInstanceReferenceKey, createResourceIdentifierKey, type CursorQueryFunction, DataPaginator, enterNearby360Image, type FdmInstanceWithView, getAssetInstanceReference, getImage360AnnotationAssetRef, getImage360AnnotationId, type Image360AnnotationContent, type Image360AnnotationId, type InstanceId, type InstanceKey, type InstanceReference, type InstanceReferenceKey, isAnnotationInstanceRef, isClassicAsset, isClassicImage360Annotation, isClassicImage360AnnotationId, isClassicImage360AssetAnnotationData, isClassicInstanceId, isClassicModelIdentifier, isDmAsset, isDMImage360Annotation, isDMImage360AnnotationId, isDMModelIdentifier, isDmsInstance, isExternalId, isHybridImage360AssetAnnotationData, isIdEither, isInternalId, isSameAssetReference, isSameDMAnnotationId, isSameDmsId, isSameExternalId, isSameIdEither, isSameImage360AnnotationId, isSameInternalId, queryKeys, type QueryDataProvider, } from './externalIndex';
|
|
5
|
+
export { type AnnotationAssetRef, type AssetInstance, AutoCursoringProvider, createInstanceReferenceKey, createResourceIdentifierKey, type CursorQueryFunction, DataPaginator, enterNearby360Image, type FdmInstanceWithView, getAssetInstanceReference, getImage360AnnotationAssetRef, getImage360AnnotationId, type Image360AnnotationContent, type Image360AnnotationId, type InstanceId, type InstanceKey, type InstanceReference, type InstanceReferenceKey, isAnnotationInstanceRef, isClassicAsset, isClassicImage360Annotation, isClassicImage360AnnotationId, isClassicImage360AssetAnnotationData, isClassicInstanceId, isClassicModelIdentifier, isDmAsset, isDMImage360Annotation, isDMImage360AnnotationId, isDMModelIdentifier, isDmsInstance, isExternalId, isHybridImage360AssetAnnotationData, isIdEither, isInternalId, isSameAssetReference, isSameDMAnnotationId, isSameDmsId, isSameExternalId, isSameIdEither, isSameImage360AnnotationId, isSameInternalId, queryKeys, type QueryDataProvider, useMemoWithUpdateSignal, useCombinedUpdateSignal, } from './externalIndex';
|
package/dist/utilities/index.js
CHANGED
|
@@ -5,13 +5,16 @@ import { createInstanceReferenceKey as y, createResourceIdentifierKey as b } fro
|
|
|
5
5
|
import { getImage360AnnotationAssetRef as x } from "./image360Annotations/getImage360AnnotationAssetRef.js";
|
|
6
6
|
import { getImage360AnnotationId as S } from "./image360Annotations/getImage360AnnotationId.js";
|
|
7
7
|
import { isSameDMAnnotationId as C, isSameImage360AnnotationId as w } from "./image360Annotations/equality.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
8
|
+
import { noopUsageMetricsTracker as T } from "./usageMetricsTracker.js";
|
|
9
|
+
import { getUnifiedThreeDUrlForResource as E } from "./getUnifiedThreeDUrlForResource.js";
|
|
10
|
+
import { resetRevealQualitySettings as D } from "./resourceSettings.js";
|
|
11
|
+
import { isClassicAsset as O, isDmAsset as k } from "./instances/typeGuards.js";
|
|
12
|
+
import { getAssetInstanceReference as A } from "./instances/toId.js";
|
|
13
|
+
import { DataPaginator as j } from "./cursoring/dataPaginator.js";
|
|
14
|
+
import { AutoCursoringProvider as M } from "./cursoring/autoCursoringProvider.js";
|
|
15
|
+
import { enterNearby360Image as N } from "./navigation/enterNearby360Image.js";
|
|
16
|
+
import { queryKeys as P } from "./queryKeys.js";
|
|
17
|
+
import { useMemoWithUpdateSignal as F } from "./signal/useMemoWithUpdateSignal.js";
|
|
18
|
+
import { useCombinedUpdateSignal as I } from "./signal/useCombinedUpdateSignal.js";
|
|
16
19
|
import "./externalIndex.js";
|
|
17
|
-
export {
|
|
20
|
+
export { M as AutoCursoringProvider, j as DataPaginator, y as createInstanceReferenceKey, b as createResourceIdentifierKey, N as enterNearby360Image, A as getAssetInstanceReference, x as getImage360AnnotationAssetRef, S as getImage360AnnotationId, E as getUnifiedThreeDUrlForResource, e as isAnnotationInstanceRef, O as isClassicAsset, t as isClassicImage360Annotation, n as isClassicImage360AnnotationId, r as isClassicImage360AssetAnnotationData, s as isClassicInstanceId, c as isClassicModelIdentifier, i as isDMImage360Annotation, a as isDMImage360AnnotationId, l as isDMModelIdentifier, k as isDmAsset, u as isDmsInstance, d as isExternalId, o as isHybridImage360AssetAnnotationData, f as isIdEither, p as isInternalId, m as isSameAssetReference, C as isSameDMAnnotationId, h as isSameDmsId, g as isSameExternalId, _ as isSameIdEither, w as isSameImage360AnnotationId, v as isSameInternalId, T as noopUsageMetricsTracker, P as queryKeys, D as resetRevealQualitySettings, I as useCombinedUpdateSignal, F as useMemoWithUpdateSignal };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReadonlySignal, Signal } from '@cognite/signal-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a stable reference to an update signal that combines a list of update signals
|
|
4
|
+
* Takes a lits of objects and the delegate to extract update signals from them separately,
|
|
5
|
+
* in order to provide a stable output signal
|
|
6
|
+
* @param objects Objects that contain update signals. Expected to be a stable list
|
|
7
|
+
* @param extractSignal The delegate function to extract signals from the objects
|
|
8
|
+
*/
|
|
9
|
+
export declare function useCombinedUpdateSignal<T>(objects: T[], extractSignal: (entity: T) => Signal<number>): ReadonlySignal<number>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEffect as e, useMemo as t, useRef as n } from "react";
|
|
2
|
+
import { computed as r } from "@cognite/signal-utils";
|
|
3
|
+
//#region libs/shared/reveal-components/src/utilities/signal/useCombinedUpdateSignal.ts
|
|
4
|
+
function i(i, a) {
|
|
5
|
+
let o = n(a);
|
|
6
|
+
return e(() => {
|
|
7
|
+
o.current = a;
|
|
8
|
+
}, [a]), t(() => {
|
|
9
|
+
let e = i.map(o.current);
|
|
10
|
+
return r(() => e.reduce((e, t) => e + t(), 0));
|
|
11
|
+
}, [i]);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { i as useCombinedUpdateSignal };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMemo as e } from "react";
|
|
2
|
+
import { useSignalValue as t } from "@cognite/signal-utils/react";
|
|
3
|
+
//#region libs/shared/reveal-components/src/utilities/signal/useMemoWithUpdateSignal.ts
|
|
4
|
+
function n(n, r, i) {
|
|
5
|
+
let a = t(r);
|
|
6
|
+
return e(n, [
|
|
7
|
+
r,
|
|
8
|
+
a,
|
|
9
|
+
...i ?? []
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as useMemoWithUpdateSignal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "React components, hooks, and data providers for building 3D applications on top of Cognite Reveal.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -83,14 +83,16 @@
|
|
|
83
83
|
"@tanstack/react-table": "^8.7.4",
|
|
84
84
|
"dayjs": "^1.11.13",
|
|
85
85
|
"lodash-es": "^4.18.1",
|
|
86
|
+
"mixpanel-browser": "^2.45.0",
|
|
86
87
|
"ml-matrix": "^6.12.1",
|
|
87
88
|
"random-seed": "^0.3.0",
|
|
88
89
|
"react": "^18.3.1",
|
|
89
90
|
"react-dom": "^18.3.1",
|
|
90
91
|
"three": "0.184.0",
|
|
91
|
-
"
|
|
92
|
+
"type-fest": "^4.33.0",
|
|
92
93
|
"@cognite/signal-utils": "1.0.1",
|
|
93
|
-
"@cognite/underscore": "1.0.1"
|
|
94
|
+
"@cognite/underscore": "1.0.1",
|
|
95
|
+
"@cognite/aura": "0.3.5"
|
|
94
96
|
},
|
|
95
97
|
"devDependencies": {
|
|
96
98
|
"@azure/msal-browser": "^2.31.0",
|
|
@@ -104,6 +106,7 @@
|
|
|
104
106
|
"@testing-library/react": "16.0.1",
|
|
105
107
|
"@testing-library/user-event": "^14.6.1",
|
|
106
108
|
"@types/lodash-es": "^4.17.12",
|
|
109
|
+
"@types/mixpanel-browser": "^2.38.0",
|
|
107
110
|
"@types/react": "18.3.14",
|
|
108
111
|
"@types/react-dom": "18.3.2",
|
|
109
112
|
"@types/three": "0.184.1",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import { DmsUniqueIdentifier, FdmNode, Source } from '../../data-providers/FdmSDK';
|
|
3
|
-
export declare const useDmInstancesByIds: (ids: DmsUniqueIdentifier[], sources: Source[]) => UseQueryResult<Array<FdmNode<Record<string, unknown>>>>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { queryKeys as e } from "../../utilities/queryKeys.js";
|
|
2
|
-
import { useFdmSdk as t } from "../components/RevealCanvas/SDKProvider.js";
|
|
3
|
-
import { useQuery as n } from "@tanstack/react-query";
|
|
4
|
-
//#region libs/shared/reveal-components/src/ui/query/useDmsInstanceByIdsQuery.ts
|
|
5
|
-
var r = (r, i) => {
|
|
6
|
-
let a = t();
|
|
7
|
-
return n({
|
|
8
|
-
queryKey: e.dmNodesById(r),
|
|
9
|
-
queryFn: async () => (await a.getByExternalIds(r.map((e) => ({
|
|
10
|
-
instanceType: "node",
|
|
11
|
-
externalId: e.externalId,
|
|
12
|
-
space: e.space
|
|
13
|
-
})), i)).items,
|
|
14
|
-
enabled: r.length > 0
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { r as useDmInstancesByIds };
|