@liveroom-tech/react-immersive 4.2.9 → 4.3.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.
@@ -1,3 +1,50 @@
1
+ type ViewerCameraState = {
2
+ position: [number, number, number];
3
+ target: [number, number, number];
4
+ fov: number | null;
5
+ zoom: number;
6
+ azimuthAngle?: number;
7
+ polarAngle?: number;
8
+ };
9
+
10
+ type DeepPartial<T> = T extends readonly unknown[] ? T : T extends object ? {
11
+ [K in keyof T]?: DeepPartial<T[K]>;
12
+ } : T;
13
+
14
+ type ObjectBindingSelector = {
15
+ group: string;
16
+ } | {
17
+ tag: string;
18
+ } | {
19
+ type: ObjectBindingType;
20
+ };
21
+ type ObjectBindingTarget = string | readonly string[] | ObjectBindingSelector;
22
+ /**
23
+ * Resolves IDs and selectors to binding-map keys in stable record order.
24
+ * Explicit ID arrays keep their supplied order. Duplicate matches are removed.
25
+ */
26
+ declare function selectBindingKeys(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget): string[];
27
+ /** Selects bindings by ID, group, tag, or binding type. */
28
+ declare function selectBindings(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget): ObjectBinding[];
29
+
30
+ type ObjectBindingPatch = DeepPartial<ObjectBinding>;
31
+ type BindingEdit = {
32
+ ids: ObjectBindingTarget;
33
+ patch: ObjectBindingPatch;
34
+ };
35
+ /**
36
+ * Applies field-level patches to object bindings and returns the updated
37
+ * record. Pure — nothing is mutated, and the original reference comes back
38
+ * untouched when no id matched, so React can skip the re-render.
39
+ *
40
+ * Ids resolve the same way everywhere else in the library: binding key first,
41
+ * then `binding.id`, then `binding.modelObjectId`.
42
+ */
43
+ declare function patchBindings(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget, patch: ObjectBindingPatch): Record<string, ObjectBinding>;
44
+ declare function patchBindings(bindings: Record<string, ObjectBinding>, edits: BindingEdit[]): Record<string, ObjectBinding>;
45
+ /** Shorthand for the common `{ style: { material: … } }` nesting. */
46
+ declare function material(value: ObjectBindingMaterial): ObjectBindingPatch;
47
+
1
48
  declare const LIGHT_TYPES: readonly ["none", "directional", "point", "spot", "hemisphere"];
2
49
  type SceneLightType = (typeof LIGHT_TYPES)[number];
3
50
  type SceneLightAttachment = {
@@ -333,53 +380,6 @@ type SceneConfig = {
333
380
  };
334
381
  declare const DEFAULT_SCENE_CONFIG: SceneConfig;
335
382
 
336
- type ViewerCameraState = {
337
- position: [number, number, number];
338
- target: [number, number, number];
339
- fov: number | null;
340
- zoom: number;
341
- azimuthAngle?: number;
342
- polarAngle?: number;
343
- };
344
-
345
- type DeepPartial<T> = T extends readonly unknown[] ? T : T extends object ? {
346
- [K in keyof T]?: DeepPartial<T[K]>;
347
- } : T;
348
-
349
- type ObjectBindingSelector = {
350
- group: string;
351
- } | {
352
- tag: string;
353
- } | {
354
- type: ObjectBindingType;
355
- };
356
- type ObjectBindingTarget = string | readonly string[] | ObjectBindingSelector;
357
- /**
358
- * Resolves IDs and selectors to binding-map keys in stable record order.
359
- * Explicit ID arrays keep their supplied order. Duplicate matches are removed.
360
- */
361
- declare function selectBindingKeys(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget): string[];
362
- /** Selects bindings by ID, group, tag, or binding type. */
363
- declare function selectBindings(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget): ObjectBinding[];
364
-
365
- type ObjectBindingPatch = DeepPartial<ObjectBinding>;
366
- type BindingEdit = {
367
- ids: ObjectBindingTarget;
368
- patch: ObjectBindingPatch;
369
- };
370
- /**
371
- * Applies field-level patches to object bindings and returns the updated
372
- * record. Pure — nothing is mutated, and the original reference comes back
373
- * untouched when no id matched, so React can skip the re-render.
374
- *
375
- * Ids resolve the same way everywhere else in the library: binding key first,
376
- * then `binding.id`, then `binding.modelObjectId`.
377
- */
378
- declare function patchBindings(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget, patch: ObjectBindingPatch): Record<string, ObjectBinding>;
379
- declare function patchBindings(bindings: Record<string, ObjectBinding>, edits: BindingEdit[]): Record<string, ObjectBinding>;
380
- /** Shorthand for the common `{ style: { material: … } }` nesting. */
381
- declare function material(value: ObjectBindingMaterial): ObjectBindingPatch;
382
-
383
383
  type SceneConfigPatch = DeepPartial<SceneConfig>;
384
384
  /**
385
385
  * Applies a nested scene-config patch without mutating either input. Objects
@@ -549,18 +549,4 @@ type ObjectActionEvent = {
549
549
  screenY?: number;
550
550
  };
551
551
 
552
- /**
553
- * Validates an object-bindings literal while preserving its exact keys and
554
- * literal values for TypeScript autocomplete and derived union types.
555
- *
556
- * This is an identity function at runtime.
557
- */
558
- declare function defineObjectBindings<const TBindings extends Record<string, ObjectBinding>>(bindings: TBindings): TBindings;
559
- /** Binding-map keys preserved by defineObjectBindings. */
560
- type ObjectBindingKey<TBindings extends Record<string, ObjectBinding>> = Extract<keyof TBindings, string>;
561
- /** Action ids declared on one binding in a defined bindings map. */
562
- type ObjectBindingActionId<TBindings extends Record<string, ObjectBinding>, TKey extends ObjectBindingKey<TBindings>> = TBindings[TKey]["actions"] extends readonly (infer TAction)[] ? TAction extends {
563
- id: infer TId extends string;
564
- } ? TId : never : never;
565
-
566
- export { type AnimationAction as A, type BindingEdit as B, type CameraAction as C, DEFAULT_SCENE_CONFIG as D, type SceneLight as E, type SceneLightAttachment as F, type SceneLightType as G, type SceneModelRenderer as H, type VisibilityActionEffect as I, defineObjectBindings as J, material as K, patchBindings as L, MATERIAL_BLENDING_MODES as M, patchSceneConfig as N, type ObjectActionEffect as O, selectBindingKeys as P, selectBindings as Q, type SceneAnimationClipConfig as S, type ViewerCameraState as V, type AnimationActionEffect as a, type AnimationLoopMode as b, type CameraActionEffect as c, MATERIAL_SIDES as d, type ObjectActionEvent as e, type ObjectBinding as f, type ObjectBindingAction as g, type ObjectBindingActionId as h, type ObjectBindingKey as i, type ObjectBindingMaterial as j, type ObjectBindingMaterialBlendingMode as k, type ObjectBindingMaterialSide as l, type ObjectBindingPatch as m, type ObjectBindingSelector as n, type ObjectBindingTarget as o, type ObjectBindingTextureChannel as p, type ObjectBindingTextureSlot as q, type ObjectBindingTransform as r, type ObjectBindingsActionEffect as s, type SceneAnimationConfig as t, type SceneAnnotationMarker as u, type SceneCinematicConfig as v, type SceneCinematicWaypoint as w, type SceneConfig as x, type SceneConfigActionEffect as y, type SceneConfigPatch as z };
552
+ export { type AnimationAction as A, type BindingEdit as B, type CameraAction as C, DEFAULT_SCENE_CONFIG as D, type SceneLightType as E, type SceneModelRenderer as F, type VisibilityActionEffect as G, material as H, patchBindings as I, patchSceneConfig as J, selectBindingKeys as K, selectBindings as L, MATERIAL_BLENDING_MODES as M, type ObjectActionEffect as O, type SceneAnimationClipConfig as S, type ViewerCameraState as V, type AnimationActionEffect as a, type AnimationLoopMode as b, type CameraActionEffect as c, MATERIAL_SIDES as d, type ObjectActionEvent as e, type ObjectBinding as f, type ObjectBindingAction as g, type ObjectBindingMaterial as h, type ObjectBindingMaterialBlendingMode as i, type ObjectBindingMaterialSide as j, type ObjectBindingPatch as k, type ObjectBindingSelector as l, type ObjectBindingTarget as m, type ObjectBindingTextureChannel as n, type ObjectBindingTextureSlot as o, type ObjectBindingTransform as p, type ObjectBindingsActionEffect as q, type SceneAnimationConfig as r, type SceneAnnotationMarker as s, type SceneCinematicConfig as t, type SceneCinematicWaypoint as u, type SceneConfig as v, type SceneConfigActionEffect as w, type SceneConfigPatch as x, type SceneLight as y, type SceneLightAttachment as z };
@@ -1,3 +1,50 @@
1
+ type ViewerCameraState = {
2
+ position: [number, number, number];
3
+ target: [number, number, number];
4
+ fov: number | null;
5
+ zoom: number;
6
+ azimuthAngle?: number;
7
+ polarAngle?: number;
8
+ };
9
+
10
+ type DeepPartial<T> = T extends readonly unknown[] ? T : T extends object ? {
11
+ [K in keyof T]?: DeepPartial<T[K]>;
12
+ } : T;
13
+
14
+ type ObjectBindingSelector = {
15
+ group: string;
16
+ } | {
17
+ tag: string;
18
+ } | {
19
+ type: ObjectBindingType;
20
+ };
21
+ type ObjectBindingTarget = string | readonly string[] | ObjectBindingSelector;
22
+ /**
23
+ * Resolves IDs and selectors to binding-map keys in stable record order.
24
+ * Explicit ID arrays keep their supplied order. Duplicate matches are removed.
25
+ */
26
+ declare function selectBindingKeys(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget): string[];
27
+ /** Selects bindings by ID, group, tag, or binding type. */
28
+ declare function selectBindings(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget): ObjectBinding[];
29
+
30
+ type ObjectBindingPatch = DeepPartial<ObjectBinding>;
31
+ type BindingEdit = {
32
+ ids: ObjectBindingTarget;
33
+ patch: ObjectBindingPatch;
34
+ };
35
+ /**
36
+ * Applies field-level patches to object bindings and returns the updated
37
+ * record. Pure — nothing is mutated, and the original reference comes back
38
+ * untouched when no id matched, so React can skip the re-render.
39
+ *
40
+ * Ids resolve the same way everywhere else in the library: binding key first,
41
+ * then `binding.id`, then `binding.modelObjectId`.
42
+ */
43
+ declare function patchBindings(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget, patch: ObjectBindingPatch): Record<string, ObjectBinding>;
44
+ declare function patchBindings(bindings: Record<string, ObjectBinding>, edits: BindingEdit[]): Record<string, ObjectBinding>;
45
+ /** Shorthand for the common `{ style: { material: … } }` nesting. */
46
+ declare function material(value: ObjectBindingMaterial): ObjectBindingPatch;
47
+
1
48
  declare const LIGHT_TYPES: readonly ["none", "directional", "point", "spot", "hemisphere"];
2
49
  type SceneLightType = (typeof LIGHT_TYPES)[number];
3
50
  type SceneLightAttachment = {
@@ -333,53 +380,6 @@ type SceneConfig = {
333
380
  };
334
381
  declare const DEFAULT_SCENE_CONFIG: SceneConfig;
335
382
 
336
- type ViewerCameraState = {
337
- position: [number, number, number];
338
- target: [number, number, number];
339
- fov: number | null;
340
- zoom: number;
341
- azimuthAngle?: number;
342
- polarAngle?: number;
343
- };
344
-
345
- type DeepPartial<T> = T extends readonly unknown[] ? T : T extends object ? {
346
- [K in keyof T]?: DeepPartial<T[K]>;
347
- } : T;
348
-
349
- type ObjectBindingSelector = {
350
- group: string;
351
- } | {
352
- tag: string;
353
- } | {
354
- type: ObjectBindingType;
355
- };
356
- type ObjectBindingTarget = string | readonly string[] | ObjectBindingSelector;
357
- /**
358
- * Resolves IDs and selectors to binding-map keys in stable record order.
359
- * Explicit ID arrays keep their supplied order. Duplicate matches are removed.
360
- */
361
- declare function selectBindingKeys(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget): string[];
362
- /** Selects bindings by ID, group, tag, or binding type. */
363
- declare function selectBindings(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget): ObjectBinding[];
364
-
365
- type ObjectBindingPatch = DeepPartial<ObjectBinding>;
366
- type BindingEdit = {
367
- ids: ObjectBindingTarget;
368
- patch: ObjectBindingPatch;
369
- };
370
- /**
371
- * Applies field-level patches to object bindings and returns the updated
372
- * record. Pure — nothing is mutated, and the original reference comes back
373
- * untouched when no id matched, so React can skip the re-render.
374
- *
375
- * Ids resolve the same way everywhere else in the library: binding key first,
376
- * then `binding.id`, then `binding.modelObjectId`.
377
- */
378
- declare function patchBindings(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget, patch: ObjectBindingPatch): Record<string, ObjectBinding>;
379
- declare function patchBindings(bindings: Record<string, ObjectBinding>, edits: BindingEdit[]): Record<string, ObjectBinding>;
380
- /** Shorthand for the common `{ style: { material: … } }` nesting. */
381
- declare function material(value: ObjectBindingMaterial): ObjectBindingPatch;
382
-
383
383
  type SceneConfigPatch = DeepPartial<SceneConfig>;
384
384
  /**
385
385
  * Applies a nested scene-config patch without mutating either input. Objects
@@ -549,18 +549,4 @@ type ObjectActionEvent = {
549
549
  screenY?: number;
550
550
  };
551
551
 
552
- /**
553
- * Validates an object-bindings literal while preserving its exact keys and
554
- * literal values for TypeScript autocomplete and derived union types.
555
- *
556
- * This is an identity function at runtime.
557
- */
558
- declare function defineObjectBindings<const TBindings extends Record<string, ObjectBinding>>(bindings: TBindings): TBindings;
559
- /** Binding-map keys preserved by defineObjectBindings. */
560
- type ObjectBindingKey<TBindings extends Record<string, ObjectBinding>> = Extract<keyof TBindings, string>;
561
- /** Action ids declared on one binding in a defined bindings map. */
562
- type ObjectBindingActionId<TBindings extends Record<string, ObjectBinding>, TKey extends ObjectBindingKey<TBindings>> = TBindings[TKey]["actions"] extends readonly (infer TAction)[] ? TAction extends {
563
- id: infer TId extends string;
564
- } ? TId : never : never;
565
-
566
- export { type AnimationAction as A, type BindingEdit as B, type CameraAction as C, DEFAULT_SCENE_CONFIG as D, type SceneLight as E, type SceneLightAttachment as F, type SceneLightType as G, type SceneModelRenderer as H, type VisibilityActionEffect as I, defineObjectBindings as J, material as K, patchBindings as L, MATERIAL_BLENDING_MODES as M, patchSceneConfig as N, type ObjectActionEffect as O, selectBindingKeys as P, selectBindings as Q, type SceneAnimationClipConfig as S, type ViewerCameraState as V, type AnimationActionEffect as a, type AnimationLoopMode as b, type CameraActionEffect as c, MATERIAL_SIDES as d, type ObjectActionEvent as e, type ObjectBinding as f, type ObjectBindingAction as g, type ObjectBindingActionId as h, type ObjectBindingKey as i, type ObjectBindingMaterial as j, type ObjectBindingMaterialBlendingMode as k, type ObjectBindingMaterialSide as l, type ObjectBindingPatch as m, type ObjectBindingSelector as n, type ObjectBindingTarget as o, type ObjectBindingTextureChannel as p, type ObjectBindingTextureSlot as q, type ObjectBindingTransform as r, type ObjectBindingsActionEffect as s, type SceneAnimationConfig as t, type SceneAnnotationMarker as u, type SceneCinematicConfig as v, type SceneCinematicWaypoint as w, type SceneConfig as x, type SceneConfigActionEffect as y, type SceneConfigPatch as z };
552
+ export { type AnimationAction as A, type BindingEdit as B, type CameraAction as C, DEFAULT_SCENE_CONFIG as D, type SceneLightType as E, type SceneModelRenderer as F, type VisibilityActionEffect as G, material as H, patchBindings as I, patchSceneConfig as J, selectBindingKeys as K, selectBindings as L, MATERIAL_BLENDING_MODES as M, type ObjectActionEffect as O, type SceneAnimationClipConfig as S, type ViewerCameraState as V, type AnimationActionEffect as a, type AnimationLoopMode as b, type CameraActionEffect as c, MATERIAL_SIDES as d, type ObjectActionEvent as e, type ObjectBinding as f, type ObjectBindingAction as g, type ObjectBindingMaterial as h, type ObjectBindingMaterialBlendingMode as i, type ObjectBindingMaterialSide as j, type ObjectBindingPatch as k, type ObjectBindingSelector as l, type ObjectBindingTarget as m, type ObjectBindingTextureChannel as n, type ObjectBindingTextureSlot as o, type ObjectBindingTransform as p, type ObjectBindingsActionEffect as q, type SceneAnimationConfig as r, type SceneAnnotationMarker as s, type SceneCinematicConfig as t, type SceneCinematicWaypoint as u, type SceneConfig as v, type SceneConfigActionEffect as w, type SceneConfigPatch as x, type SceneLight as y, type SceneLightAttachment as z };
@@ -0,0 +1,349 @@
1
+ import { ComponentProps, ReactNode, MutableRefObject } from 'react';
2
+ import { CameraControls } from '@react-three/drei';
3
+ import { Object3D, WebGLRenderer, Scene, Camera, Box3, Material } from 'three';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { XRStore } from '@react-three/xr';
6
+ import { v as SceneConfig, f as ObjectBinding, V as ViewerCameraState, e as ObjectActionEvent, s as SceneAnnotationMarker } from './objectBinding-CBRYMYk6.mjs';
7
+ import { Canvas } from '@react-three/fiber';
8
+
9
+ type CanvasCamera = ComponentProps<typeof Canvas>["camera"];
10
+
11
+ type RendererCapture = {
12
+ gl: WebGLRenderer;
13
+ scene: Scene;
14
+ camera: Camera;
15
+ invalidate: () => void;
16
+ };
17
+ type Props = {
18
+ children: ReactNode;
19
+ camera?: CanvasCamera;
20
+ backgroundColor?: string;
21
+ shadows?: boolean;
22
+ sceneConfig?: SceneConfig;
23
+ selectedObjectRef?: Object3D | null;
24
+ hoveredObjectRef?: Object3D | null;
25
+ highlightOnHover?: boolean;
26
+ renderMode?: "always" | "demand";
27
+ maxDpr?: number;
28
+ xrStore?: XRStore | null;
29
+ rendererCaptureRef?: MutableRefObject<RendererCapture | null>;
30
+ preserveDrawingBuffer?: boolean;
31
+ reduceGpuLoad?: boolean;
32
+ };
33
+ declare function Viewer({ children, camera, backgroundColor, shadows, sceneConfig, selectedObjectRef, hoveredObjectRef, highlightOnHover, renderMode, maxDpr, xrStore, rendererCaptureRef, preserveDrawingBuffer, reduceGpuLoad, }: Props): react_jsx_runtime.JSX.Element;
34
+
35
+ type PerformanceProfile = "auto" | "high" | "low";
36
+
37
+ type CameraLimits = {
38
+ minDistance?: number;
39
+ maxDistance?: number;
40
+ minPolarAngle?: number;
41
+ maxPolarAngle?: number;
42
+ minAzimuthAngle?: number;
43
+ maxAzimuthAngle?: number;
44
+ panBoundary?: [min: [number, number, number], max: [number, number, number]];
45
+ boundaryEnclosesCamera?: boolean;
46
+ boundaryFriction?: number;
47
+ };
48
+ type CameraControllerType = "orbit" | "pointerLock";
49
+
50
+ type GltfDecoderConfig = {
51
+ dracoDecoderPath?: string | false;
52
+ ktx2TranscoderPath?: string | false;
53
+ meshopt?: boolean;
54
+ };
55
+
56
+ /** One entry of the object catalog the processor writes beside `tileset.json`. */
57
+ type TileObjectCatalogEntry = {
58
+ name: string;
59
+ triangles: number;
60
+ minimum: [number, number, number];
61
+ maximum: [number, number, number];
62
+ };
63
+ type StreamingTilesModelProps = {
64
+ url: string;
65
+ rotation?: [number, number, number];
66
+ errorTarget?: number;
67
+ cacheSize?: number;
68
+ /**
69
+ * Ceiling on the geometry and texture the renderer keeps resident, in MB.
70
+ * Reaching it does not degrade quality — it stops content being requested
71
+ * entirely — so it is a limit to stay under, not one to aim at.
72
+ */
73
+ memoryBudgetMB?: number;
74
+ /** Same decoder configuration the monolithic loader uses. */
75
+ decoderConfig?: GltfDecoderConfig;
76
+ /** Bindings keyed the same way as the monolithic viewer's. */
77
+ objectBindings?: Record<string, ObjectBinding>;
78
+ /** Live colour overrides from the editor's picker. */
79
+ itemMaterials?: Record<string, {
80
+ hex?: string;
81
+ }>;
82
+ /** Supplies the shading and renderer modes, as it does for the model path. */
83
+ sceneConfig?: SceneConfig;
84
+ selectedItem?: string | null;
85
+ /** Matches the monolithic viewer: a binding, not a node name. */
86
+ panelHoveredItem?: ObjectBinding | null;
87
+ highlightOnHover?: boolean;
88
+ onItemClick?: (binding: ObjectBinding) => void;
89
+ onItemHover?: (binding: ObjectBinding | null) => void;
90
+ /** Every bindable object in the model, available before any tile loads. */
91
+ onObjectCatalog?: (objects: TileObjectCatalogEntry[]) => void;
92
+ /**
93
+ * The whole model's world-space extent, reported as soon as tileset.json is
94
+ * parsed and long before any content is fetched. The viewer needs it to frame
95
+ * the camera; see the reporting effect below for why waiting is not an option.
96
+ */
97
+ onTilesetBounds?: (box: Box3) => void;
98
+ onModelLoaded?: (scene: Object3D) => void;
99
+ onLoadError?: (error: unknown) => void;
100
+ /**
101
+ * One representative resident mesh per binding, for the transform gizmo and
102
+ * for framing the camera. A streamed object has no single node — it exists
103
+ * once per resolved level of detail, and those come and go — so this is
104
+ * rebuilt as tiles arrive and are evicted rather than being written once.
105
+ */
106
+ nodeRefsOut?: React.MutableRefObject<Record<string, Object3D>>;
107
+ onNodeRefsChange?: () => void;
108
+ materialRefsOut?: React.MutableRefObject<Record<string, Material | Material[]>>;
109
+ /** 0-1. Eased here, so the value can be driven straight from a slider. */
110
+ explodeFactor?: number;
111
+ suspendBindingTransforms?: boolean;
112
+ };
113
+
114
+ type ModelFormat = "glb" | "gltf" | "obj" | "fbx" | "usdz";
115
+
116
+ type XRScaleMode = "normalized" | "real-world";
117
+
118
+ type CinematicWaypoint = {
119
+ position: [number, number, number];
120
+ target: [number, number, number];
121
+ azimuthAngle?: number;
122
+ polarAngle?: number;
123
+ segmentDuration?: number;
124
+ };
125
+ type CinematicConfig = {
126
+ waypoints?: CinematicWaypoint[];
127
+ duration?: number;
128
+ loop?: boolean;
129
+ autoPlay?: boolean;
130
+ };
131
+
132
+ type MouseControllerPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'center' | 'center-bottom' | 'center-top';
133
+
134
+ type CaptureImageOptions = {
135
+ width?: number;
136
+ height?: number;
137
+ transparent?: boolean;
138
+ };
139
+
140
+ type ViewerCameraPreset = {
141
+ position: [number, number, number];
142
+ target: [number, number, number];
143
+ fov?: number | null;
144
+ zoom?: number;
145
+ azimuthAngle?: number;
146
+ polarAngle?: number;
147
+ };
148
+ type UseViewerCameraOptions = {
149
+ /** Camera position applied once when each model becomes ready. */
150
+ initialPosition?: [number, number, number];
151
+ /** Orbit target applied once when each model becomes ready. */
152
+ initialTarget?: [number, number, number];
153
+ /** Whether the initial position/target should animate. Defaults to false. */
154
+ initialTransition?: boolean;
155
+ /** Named views that can be opened with goToPreset. */
156
+ presets?: Record<string, ViewerCameraPreset>;
157
+ };
158
+ type HomeCameraState = {
159
+ position: [number, number, number];
160
+ target: [number, number, number];
161
+ };
162
+ type ViewerReadyState = {
163
+ controls: CameraControls;
164
+ scene: Object3D | null;
165
+ objectBindings: Record<string, ObjectBinding>;
166
+ nodeRefs: Record<string, Object3D>;
167
+ homeCameraState: HomeCameraState | null;
168
+ captureImage: (options?: CaptureImageOptions) => Promise<string>;
169
+ invalidate: () => void;
170
+ };
171
+ type ViewerCameraProps = {
172
+ cameraState: ViewerCameraState | null;
173
+ cameraPresets: Record<string, ViewerCameraPreset>;
174
+ resetView: () => Promise<boolean>;
175
+ focusObject: (objectId: string) => Promise<boolean>;
176
+ fitScene: () => Promise<boolean>;
177
+ setCameraTarget: (target: [number, number, number], enableTransition?: boolean) => Promise<boolean>;
178
+ setCameraState: (state: ViewerCameraState, enableTransition?: boolean) => Promise<boolean>;
179
+ lookAt: (position: [number, number, number], target: [number, number, number], enableTransition?: boolean) => Promise<boolean>;
180
+ orbitTo: (azimuthAngle: number, polarAngle: number, enableTransition?: boolean) => Promise<boolean>;
181
+ dollyTo: (distance: number, enableTransition?: boolean) => Promise<boolean>;
182
+ savePreset: (name: string) => ViewerCameraState | null;
183
+ goToPreset: (name: string, enableTransition?: boolean) => Promise<boolean>;
184
+ handleCameraChange: (camera: Camera, controls: CameraControls) => void;
185
+ handleViewerReady: (viewer: ViewerReadyState) => void;
186
+ };
187
+ declare function useViewerCamera(options?: UseViewerCameraOptions): ViewerCameraProps;
188
+
189
+ type AnimationClipInfo = {
190
+ sourceName: string;
191
+ duration: number;
192
+ };
193
+ type AnimationPlaybackState = {
194
+ currentClip: string | null;
195
+ isPlaying: boolean;
196
+ speed: number;
197
+ time: number;
198
+ duration: number;
199
+ };
200
+ type AnimationControls = {
201
+ clips: string[];
202
+ clipDetails?: AnimationClipInfo[];
203
+ play: (clipName: string) => void;
204
+ pause: () => void;
205
+ stop: () => void;
206
+ setSpeed: (speed: number) => void;
207
+ seek?: (time: number) => void;
208
+ getState?: () => AnimationPlaybackState;
209
+ subscribe?: (listener: (state: AnimationPlaybackState) => void) => () => void;
210
+ };
211
+ type ViewerAnimationsProps = {
212
+ clips: string[];
213
+ clipDetails: AnimationClipInfo[];
214
+ currentClip: string | null;
215
+ isPlaying: boolean;
216
+ speed: number;
217
+ time: number;
218
+ duration: number;
219
+ play: (clipName: string) => void;
220
+ pause: () => void;
221
+ stop: () => void;
222
+ setSpeed: (speed: number) => void;
223
+ seek: (time: number) => void;
224
+ handleAnimationsReady: (controls: AnimationControls) => void;
225
+ };
226
+ declare function useViewerAnimations(): ViewerAnimationsProps;
227
+
228
+ type ObjectTransformSpace = "local" | "world";
229
+
230
+ type ViewerCamera = React.ComponentProps<typeof Viewer>["camera"];
231
+ type AnnotationMarker = SceneAnnotationMarker & {
232
+ markerId?: string;
233
+ };
234
+ type CustomObjectBindingDataPanelProps = {
235
+ isOpen: boolean;
236
+ selectedObject: ObjectBinding | null;
237
+ currentAction: ObjectActionEvent | null;
238
+ onClose: () => void;
239
+ onAction: (event: ObjectActionEvent) => void;
240
+ };
241
+ type CustomSceneObjectsPanelProps = {
242
+ objectBindings: Record<string, ObjectBinding>;
243
+ onAction?: (event: ObjectActionEvent) => void;
244
+ onFocus?: (binding: ObjectBinding) => void;
245
+ onHover?: (binding: ObjectBinding | null) => void;
246
+ };
247
+ type ModelViewerProps = {
248
+ modelUrl: string;
249
+ /** Optional 3D Tiles manifest used instead of loading `modelUrl` monolithically. */
250
+ tilesetUrl?: string | null;
251
+ /** Screen-space error target for streamed 3D Tiles. Lower is sharper. */
252
+ tilesErrorTarget?: number;
253
+ /** Maximum number of parsed tiles retained by the client cache. */
254
+ tilesCacheSize?: number;
255
+ /**
256
+ * Every bindable object in a streamed model, read from the catalog the
257
+ * processor writes beside `tileset.json`. Reported once, before the tiles
258
+ * that contain those objects have necessarily loaded.
259
+ */
260
+ onObjectCatalog?: (objects: TileObjectCatalogEntry[]) => void;
261
+ /** Explicit format for extensionless or signed model URLs. */
262
+ modelFormat?: ModelFormat;
263
+ licenseKey: string;
264
+ objectBindings: Record<string, ObjectBinding>;
265
+ selectedObject?: ObjectBinding | null;
266
+ panelHoveredObject?: ObjectBinding | null;
267
+ onObjectBindingsChange?: (next: Record<string, ObjectBinding>) => void;
268
+ onObjectSelect?: (binding: ObjectBinding | null) => void;
269
+ onObjectHover?: (binding: ObjectBinding | null) => void;
270
+ onModelLoaded?: (scene: Object3D) => void;
271
+ onLoadError?: (error: unknown) => void;
272
+ onProgress?: (event: ProgressEvent) => void;
273
+ onCameraControllerChange?: (controller: CameraControllerType) => void;
274
+ cameraControllerType?: CameraControllerType;
275
+ onAction?: (event: ObjectActionEvent) => void;
276
+ onHiddenObjectsChange?: (next: Record<string, boolean>) => void;
277
+ onCameraChange?: (camera: Camera, controls: CameraControls) => void;
278
+ onViewerReady?: (viewer: ViewerReadyState) => void;
279
+ onTextureUpload?: (file: File, objectId: string) => Promise<string>;
280
+ onAnimationsReady?: (controls: AnimationControls) => void;
281
+ onAnnotationsChange?: (annotations: AnnotationMarker[]) => void;
282
+ activeAnnotation?: AnnotationMarker | null;
283
+ onActiveAnnotationChange?: (annotation: AnnotationMarker | null) => void;
284
+ lights?: ReactNode;
285
+ camera?: ViewerCamera;
286
+ cameraLimits?: CameraLimits;
287
+ backgroundColor?: string;
288
+ shadows?: boolean;
289
+ showObjectBindingDataPanel?: boolean;
290
+ customObjectBindingDataPanel?: (props: CustomObjectBindingDataPanelProps) => ReactNode;
291
+ customSceneObjectsPanel?: (props: CustomSceneObjectsPanelProps) => ReactNode;
292
+ showSceneObjectsPanel?: boolean;
293
+ showDownloadButton?: boolean;
294
+ downloadFilename?: string;
295
+ showResetButton?: boolean;
296
+ showLoadingOverlay?: boolean;
297
+ showMouseController?: boolean;
298
+ mouseControllerPosition?: MouseControllerPosition;
299
+ mouseControllerOpacity?: number;
300
+ moveSensitivity?: number;
301
+ zoomSensitivity?: number;
302
+ sceneConfig?: SceneConfig;
303
+ disableZoom?: boolean;
304
+ zoomOnSelected?: boolean;
305
+ highlightOnHover?: boolean;
306
+ onAutoFit?: () => Promise<boolean>;
307
+ enableCameraControls?: boolean;
308
+ moveModeEnabled?: boolean;
309
+ /** Aligns PivotControls to the scene or to the selected object. */
310
+ objectTransformSpace?: ObjectTransformSpace;
311
+ /** Enables canvas-focused camera shortcuts. Disabled by default. */
312
+ enableKeyboardNavigation?: boolean;
313
+ refitOnResize?: boolean;
314
+ renderMode?: "always" | "demand";
315
+ maxDpr?: number;
316
+ preserveDrawingBuffer?: boolean;
317
+ performanceProfile?: PerformanceProfile;
318
+ dracoDecoderPath?: string | false;
319
+ ktx2TranscoderPath?: string | false;
320
+ meshopt?: boolean;
321
+ showMeasureTools?: boolean;
322
+ showUvCheckerButton?: boolean;
323
+ showExplodeControls?: boolean;
324
+ cinematic?: boolean | CinematicConfig;
325
+ measurementUnit?: string;
326
+ enableXR?: boolean;
327
+ usdzUrl?: string;
328
+ arScaleMode?: XRScaleMode;
329
+ mobileHandoffUrl?: string;
330
+ showAnnotationNavigation?: boolean;
331
+ showAnnotationOnHover?: boolean;
332
+ onSceneConfigChange?: (config: SceneConfig) => void;
333
+ showViewGizmo?: boolean;
334
+ autoRotate?: boolean;
335
+ autoRotateSpeed?: number;
336
+ };
337
+
338
+ /** Props of `BindingBuilder`. */
339
+ type BindingBuilderProps = {
340
+ licenseKey: string;
341
+ /** Directory containing the DRACO decoder files, or false. */
342
+ dracoDecoderPath?: string | false;
343
+ /** Directory containing the Basis/KTX2 transcoder files, or false. */
344
+ ktx2TranscoderPath?: string | false;
345
+ /** Enable the bundled Meshopt decoder. Defaults to true. */
346
+ meshopt?: boolean;
347
+ };
348
+
349
+ export { type AnimationClipInfo as A, type BindingBuilderProps as B, type CaptureImageOptions as C, type HomeCameraState as H, type ModelFormat as M, type ObjectTransformSpace as O, type StreamingTilesModelProps as S, type TileObjectCatalogEntry as T, type UseViewerCameraOptions as U, type ViewerAnimationsProps as V, type XRScaleMode as X, type AnimationControls as a, type AnimationPlaybackState as b, type CinematicConfig as c, type CinematicWaypoint as d, type CustomObjectBindingDataPanelProps as e, type CustomSceneObjectsPanelProps as f, type ModelViewerProps as g, type ViewerCameraPreset as h, type ViewerCameraProps as i, type ViewerReadyState as j, useViewerCamera as k, useViewerAnimations as u };