@liveroom-tech/react-immersive 5.3.0 → 6.0.1

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.
Files changed (50) hide show
  1. package/dist/binding-builder.css +1 -1
  2. package/dist/binding-builder.d.mts +5 -1
  3. package/dist/binding-builder.d.ts +5 -1
  4. package/dist/binding-builder.js +23 -20
  5. package/dist/binding-builder.mjs +1 -1
  6. package/dist/chunk-2JFUMJUP.mjs +1 -0
  7. package/dist/chunk-4JMJALRO.mjs +2 -0
  8. package/dist/chunk-OTSCPJWF.mjs +1 -0
  9. package/dist/chunk-P2JZ5Z7I.mjs +1 -0
  10. package/dist/chunk-UGPR4EPP.mjs +81 -0
  11. package/dist/chunk-V7WZUWJ5.mjs +1 -0
  12. package/dist/chunk-VQGYZOMX.mjs +3 -0
  13. package/dist/hosted.css +1 -1
  14. package/dist/hosted.d.mts +44 -17
  15. package/dist/hosted.d.ts +44 -17
  16. package/dist/hosted.js +22 -19
  17. package/dist/hosted.mjs +1 -1
  18. package/dist/index.css +1 -1
  19. package/dist/index.d.mts +70 -12
  20. package/dist/index.d.ts +70 -12
  21. package/dist/index.js +21 -18
  22. package/dist/index.mjs +1 -1
  23. package/dist/{materialVariants-DjTuiWmN.d.mts → modelFileResolver-Co7j1tdQ.d.mts} +122 -29
  24. package/dist/{materialVariants-DjTuiWmN.d.ts → modelFileResolver-Co7j1tdQ.d.ts} +122 -29
  25. package/dist/modelViewerProps-BibuMND7.d.ts +1988 -0
  26. package/dist/modelViewerProps-Ce4-wb57.d.mts +1988 -0
  27. package/dist/{publicProps-tJuWZgT3.d.ts → publicProps-BaJHCDa_.d.mts} +7 -0
  28. package/dist/{publicProps-tJuWZgT3.d.mts → publicProps-CP18d_mt.d.ts} +7 -0
  29. package/dist/simple-model-viewer.d.mts +2 -4
  30. package/dist/simple-model-viewer.d.ts +2 -4
  31. package/dist/simple-model-viewer.js +3 -3
  32. package/dist/simple-model-viewer.mjs +1 -1
  33. package/dist/utils.d.mts +62 -4
  34. package/dist/utils.d.ts +62 -4
  35. package/dist/utils.js +2 -1
  36. package/dist/utils.mjs +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-4FDMYUGT.mjs +0 -3
  39. package/dist/chunk-CV4E7DOO.mjs +0 -79
  40. package/dist/chunk-F4WT3HEK.mjs +0 -1
  41. package/dist/chunk-FPJZDEON.mjs +0 -1
  42. package/dist/chunk-JHKMRMJH.mjs +0 -1
  43. package/dist/chunk-TW2M4UXT.mjs +0 -1
  44. package/dist/chunk-W24UP6NM.mjs +0 -1
  45. package/dist/modelInfo-BQ5UZu95.d.ts +0 -43
  46. package/dist/modelInfo-CcYpydB7.d.mts +0 -43
  47. package/dist/modelViewerProps-BalkRDni.d.ts +0 -618
  48. package/dist/modelViewerProps-DdsJDRB7.d.mts +0 -618
  49. package/dist/rendererBackend-C_Jb4_Jy.d.mts +0 -917
  50. package/dist/rendererBackend-C_Jb4_Jy.d.ts +0 -917
@@ -1,618 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { Object3D } from 'three';
3
- import { R as ReducedMotionSetting, c as ModelViewerLabels } from './materialVariants-DjTuiWmN.js';
4
- import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-BQ5UZu95.js';
5
- import { r as ObjectBindingDecal, Q as ObjectSurfacePoint, o as ObjectBinding, S as RendererBackend, ap as ViewerCameraState, Y as SceneAnnotationMarker, ar as ViewerObjectInfo, P as ObjectPointerEvent, n as ObjectActionEvent, e as AnimationControls, ao as ViewerCameraConfig, a1 as SceneConfig, aq as ViewerIsolation } from './rendererBackend-C_Jb4_Jy.js';
6
- import { CameraControls } from '@react-three/drei';
7
-
8
- /** Engagement from deliberate viewer interactions, with model/session context. */
9
- type ViewerEngagementEvent = {
10
- /** Ephemeral identifier for this viewer/model session; no persistent storage. */
11
- sessionId: string;
12
- /** ISO timestamp of the event. */
13
- timestamp: string;
14
- /** Milliseconds since tracking started for this model. */
15
- elapsedMs: number;
16
- modelUrl: string;
17
- tilesetUrl: string | null;
18
- } & ({
19
- type: "part-viewed";
20
- objectId: string;
21
- objectKey: string;
22
- label?: string;
23
- source: "canvas" | "panel" | "keyboard";
24
- } | {
25
- type: "variant-chosen";
26
- /** The variant chosen; null when a group's choice was cleared. */
27
- variant: string | null;
28
- /** The group's previous choice. */
29
- previousVariant: string | null;
30
- /** The option group's name; null for a group without one. */
31
- group: string | null;
32
- } | {
33
- type: "ar-started";
34
- } | {
35
- type: "ar-ended";
36
- durationMs: number;
37
- reason: "session-ended" | "interrupted";
38
- } | {
39
- type: "ar-launch-requested";
40
- channel: "quick-look" | "mobile-handoff";
41
- } | {
42
- type: "tour-started";
43
- annotationCount: number;
44
- } | {
45
- type: "tour-completed";
46
- annotationCount: number;
47
- durationMs: number;
48
- } | {
49
- type: "tour-stopped";
50
- annotationCount: number;
51
- durationMs: number;
52
- reason: "stopped" | "restarted" | "annotations-changed" | "interrupted";
53
- });
54
-
55
- type CameraLimits = {
56
- /** Closest the camera can get to its target, in scene units. Default 0. */
57
- minDistance?: number;
58
- /** Farthest the camera can get from its target, in scene units. Default Infinity. */
59
- maxDistance?: number;
60
- /**
61
- * Lowest vertical angle, in degrees: 0 looks straight down from above, 90 is
62
- * level with the target, 180 looks straight up from below. Default 0.
63
- */
64
- minPolarAngle?: number;
65
- /** Highest vertical angle, in degrees (see minPolarAngle). Default 180. */
66
- maxPolarAngle?: number;
67
- /**
68
- * Leftmost horizontal angle, in degrees around the vertical axis: 0 views
69
- * the target from the front (+Z), 90 from its right (+X), -90 from its
70
- * left. Default -Infinity (no limit).
71
- */
72
- minAzimuthAngle?: number;
73
- /** Rightmost horizontal angle, in degrees (see minAzimuthAngle). Default Infinity. */
74
- maxAzimuthAngle?: number;
75
- /** An axis-aligned world-space box the camera's target can pan within. */
76
- panBoundary?: [min: [number, number, number], max: [number, number, number]];
77
- /** Keeps the camera itself, not just its target, inside panBoundary. Default false. */
78
- boundaryEnclosesCamera?: boolean;
79
- /** How strongly panning slows near panBoundary, 0–1. Default 0. */
80
- boundaryFriction?: number;
81
- };
82
-
83
- type MouseControllerPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'center' | 'center-bottom' | 'center-top';
84
-
85
- type PerformanceProfile = "auto" | "high" | "low";
86
-
87
- type XRScaleMode = "normalized" | "real-world";
88
-
89
- /** A starting set of ModelViewer props for a common kind of page. */
90
- type ModelViewerPreset = "minimal" | "showcase" | "configurator" | "inspector";
91
- type ModelViewerUiOptions = {
92
- /** The left panel for the selected object. Default `true`. */
93
- objectPanel?: boolean;
94
- /** The right panel listing the model's objects. Default `true`. */
95
- sceneObjects?: boolean;
96
- /** The download button; a string also sets the file name. Default `true`. */
97
- download?: boolean | string;
98
- /** The reset-view button. Default `true`. */
99
- reset?: boolean;
100
- /** The viewer fullscreen toggle in the action bar. Default `false`. */
101
- fullscreen?: boolean;
102
- /** The loading overlay and load-error message. Default `true`. */
103
- loadingOverlay?: boolean;
104
- /** The axis gizmo in the top-right corner. Default `false`. */
105
- viewGizmo?: boolean;
106
- /** The on-screen movement pad; an object also places it. Default `false`. */
107
- mouseController?: boolean | {
108
- position?: MouseControllerPosition;
109
- opacity?: number;
110
- };
111
- /** Previous/Stop/Next controls for annotation tours. Default `true`. */
112
- annotationNavigation?: boolean;
113
- /** Show an annotation's details when its marker is hovered. Default `false`. */
114
- annotationOnHover?: boolean;
115
- /** Category filter chips. Default `true` when annotations have categories. */
116
- annotationFilters?: boolean;
117
- /** Highlight objects under the pointer. Default `true`. */
118
- highlightOnHover?: boolean;
119
- /** Swatch rows for the model's glTF material variants, one per option group. Default `true`. */
120
- materialVariants?: boolean;
121
- /**
122
- * A tab stop for moving through and selecting objects with the keyboard,
123
- * shown only while it has focus. Default `true`.
124
- */
125
- objectNavigator?: boolean;
126
- };
127
- /**
128
- * Takes over parts of texture positioning (`texturePositioning`). Fields left
129
- * out keep the viewer's own behavior, which reads and writes the binding.
130
- */
131
- type TexturePositioningControls = {
132
- /** Shown in the Offset fields instead of the binding's offset. */
133
- offset?: [number, number];
134
- /** Shown in the Rotation field instead of the binding's, in degrees (0–360). */
135
- rotationDegrees?: number;
136
- /** Replaces the viewer's write when an Offset field changes. */
137
- onOffsetChange?: (objectId: string, axisIndex: 0 | 1, value: number) => void;
138
- /** Replaces the viewer's write when the Rotation field changes. */
139
- onRotationChange?: (objectId: string, degrees: number) => void;
140
- /** Whether to show "Done positioning" rather than the hint. */
141
- isPositioning?: boolean;
142
- /** Called after "Done positioning" ends Move/Zoom mode. */
143
- onEndPositioning?: () => void;
144
- };
145
- type ModelViewerToolsOptions = {
146
- /** Distance and dimension tools; an object also sets the unit. Default `false`. */
147
- measure?: boolean | {
148
- unit?: string;
149
- };
150
- /** The UV checker toggle. Default `false`. */
151
- uvChecker?: boolean;
152
- /** The exploded-view slider. Default `false`. */
153
- explode?: boolean;
154
- /** The section-cut tool, to cut the model open along an axis. Default `false`. */
155
- section?: boolean;
156
- /** Isolate buttons in the scene objects panel, and a "Show all" pill. Default `false`. */
157
- isolate?: boolean;
158
- /** Texture offset, rotation and Move/Zoom for textured objects. Default `false`. */
159
- texturePositioning?: boolean | TexturePositioningControls;
160
- };
161
- type ModelViewerControlsOptions = {
162
- /** Orbit, pan and zoom with the pointer. Default `true`. */
163
- enabled?: boolean;
164
- /** Move the camera with the keyboard while the canvas has focus. Default `false`. */
165
- keyboard?: boolean;
166
- /**
167
- * Cut motion the viewer starts on its own (auto-rotate, cinematic autoplay,
168
- * camera glides). `"user"` follows the visitor's reduced-motion setting.
169
- * Default `"user"`.
170
- */
171
- reducedMotion?: ReducedMotionSetting;
172
- /** Allow zooming. Default `true`. */
173
- zoom?: boolean;
174
- /** Zoom to an object when it's selected. Default `true`. */
175
- zoomOnSelect?: boolean;
176
- /** Turn the model slowly; a number sets the speed (1 is normal). Default `false`. */
177
- autoRotate?: boolean | number;
178
- /** Re-frame the model, or the selected object it zoomed to, when the viewer is resized. Default `true`. */
179
- refitOnResize?: boolean;
180
- /** Distance, angle and pan limits for the camera. */
181
- limits?: CameraLimits;
182
- /** Movement pad speed. Default `0.08`. */
183
- moveSensitivity?: number;
184
- /** Movement pad zoom speed. Default `1`. */
185
- zoomSensitivity?: number;
186
- };
187
- type ModelViewerPerfOptions = {
188
- /** `"demand"` draws only when something changes. Default `"demand"`. */
189
- renderMode?: "always" | "demand";
190
- /** Highest device pixel ratio to render at. Default `2`. */
191
- maxDpr?: number;
192
- /** `"low"` trades quality for speed on weak devices. Default `"auto"`. */
193
- profile?: PerformanceProfile;
194
- /** Needed for Download PNG and captureImage; costs GPU time. Default `false`. */
195
- preserveDrawingBuffer?: boolean;
196
- /**
197
- * Draw with three's WebGPU renderer where the browser has WebGPU, WebGL
198
- * elsewhere. Leaves out post-processing effects, contact shadows and WebXR.
199
- * Default `false`.
200
- */
201
- webgpu?: boolean;
202
- };
203
- type ModelViewerTilesOptions = {
204
- /** A 3D Tiles `tileset.json` to stream instead of loading `modelUrl` whole. */
205
- url?: string | null;
206
- /** Screen-space error target; lower is sharper. Default `8`. */
207
- errorTarget?: number;
208
- /** Most parsed tiles kept in memory. Default `800`. */
209
- cacheSize?: number;
210
- };
211
- type ModelViewerXrOptions = {
212
- /** "View in your space" (AR) and "Enter VR". Default `false`. */
213
- enabled?: boolean;
214
- /** A USDZ file for iOS AR Quick Look. */
215
- usdzUrl?: string;
216
- /** How the model is sized in AR. Default `"normalized"`. */
217
- scaleMode?: XRScaleMode;
218
- /** The page the desktop QR code opens on a phone. Default: the current page. */
219
- mobileHandoffUrl?: string;
220
- };
221
- type ModelViewerDecoderOptions = {
222
- /** Directory of the DRACO decoder files, or `false`. */
223
- draco?: string | false;
224
- /** Directory of the Basis/KTX2 transcoder files, or `false`. */
225
- ktx2?: string | false;
226
- /** Enable the bundled Meshopt decoder. Default `true`. */
227
- meshopt?: boolean;
228
- };
229
- type GroupedModelViewerProps = {
230
- /**
231
- * A starting set of props for a common kind of page. Anything else you pass
232
- * overrides it.
233
- */
234
- preset?: ModelViewerPreset;
235
- ui?: ModelViewerUiOptions;
236
- tools?: ModelViewerToolsOptions;
237
- controls?: ModelViewerControlsOptions;
238
- perf?: ModelViewerPerfOptions;
239
- tiles?: ModelViewerTilesOptions;
240
- xr?: ModelViewerXrOptions;
241
- decoders?: ModelViewerDecoderOptions;
242
- };
243
- /** What each preset sets. Props that aren't listed keep their defaults. */
244
- declare const MODEL_VIEWER_PRESETS: Readonly<Record<ModelViewerPreset, Readonly<Partial<ModelViewerProps>>>>;
245
-
246
- type DecalMoveTarget = {
247
- objectId: string;
248
- decal: ObjectBindingDecal;
249
- onCommit: (surface: ObjectSurfacePoint) => void;
250
- onCancel: () => void;
251
- };
252
-
253
- type CameraControllerType = "orbit" | "pointerLock";
254
-
255
- type CinematicWaypoint = {
256
- position: [number, number, number];
257
- target: [number, number, number];
258
- /**
259
- * Orbit angles in radians, as BindingBuilder captures them: position and
260
- * target alone can't represent the rotation straight above or below the
261
- * target. Leave them out when writing waypoints by hand.
262
- */
263
- azimuthAngle?: number;
264
- polarAngle?: number;
265
- segmentDuration?: number;
266
- };
267
- type CinematicConfig = {
268
- waypoints?: CinematicWaypoint[];
269
- duration?: number;
270
- loop?: boolean;
271
- autoPlay?: boolean;
272
- };
273
-
274
- type CaptureImageOptions = {
275
- width?: number;
276
- height?: number;
277
- transparent?: boolean;
278
- };
279
-
280
- type CaptureVideoOptions = {
281
- /** Defaults to cinematic when a path is enabled, otherwise turntable. */
282
- mode?: "cinematic" | "turntable";
283
- /**
284
- * Auto prefers WebM, then MP4. `"gif"` makes an animated GIF that loops
285
- * forever. Explicit formats reject if unsupported.
286
- */
287
- format?: "auto" | "webm" | "mp4" | "gif";
288
- /**
289
- * Seconds per pass, in (0, 300]. Defaults to path timing, or an orbit of
290
- * 24s (8s for a GIF).
291
- */
292
- duration?: number;
293
- /** Capture frame rate, from 1 to 60. Default 30 (15 for a GIF). */
294
- fps?: number;
295
- /** Encoder target bitrate in bits per second. Default 8,000,000. Not used for GIFs. */
296
- videoBitsPerSecond?: number;
297
- /**
298
- * GIF width in pixels, from 16 to 4096; the height follows the canvas. Never
299
- * wider than the canvas. Default 480.
300
- */
301
- gifWidth?: number;
302
- /** Aborting discards the recording and restores the viewer. */
303
- signal?: AbortSignal;
304
- };
305
-
306
- type ViewerCameraPreset = {
307
- position: [number, number, number];
308
- target: [number, number, number];
309
- fov?: number | null;
310
- zoom?: number;
311
- azimuthAngle?: number;
312
- polarAngle?: number;
313
- };
314
- type UseViewerCameraOptions = {
315
- /** Camera position applied once when each model becomes ready. */
316
- initialPosition?: [number, number, number];
317
- /** Orbit target applied once when each model becomes ready. */
318
- initialTarget?: [number, number, number];
319
- /** Whether the initial position/target should animate. Defaults to false. */
320
- initialTransition?: boolean;
321
- /** Named views that can be opened with goToPreset. */
322
- presets?: Record<string, ViewerCameraPreset>;
323
- };
324
- type HomeCameraState = {
325
- position: [number, number, number];
326
- target: [number, number, number];
327
- };
328
- type ViewerReadyState = {
329
- objectBindings: Record<string, ObjectBinding>;
330
- homeCameraState: HomeCameraState | null;
331
- captureImage: (options?: CaptureImageOptions) => Promise<string>;
332
- /** Records one cinematic pass or turntable revolution as a video Blob. */
333
- captureVideo: (options?: CaptureVideoOptions) => Promise<Blob>;
334
- invalidate: () => void;
335
- /**
336
- * The renderer drawing the viewer: "webgpu" only when ModelViewer's
337
- * `webgpu` asked for it and the browser has WebGPU.
338
- */
339
- rendererBackend: RendererBackend;
340
- /**
341
- * The live three.js scene, camera-controls instance, and model nodes, for
342
- * integrations the rest of the API doesn't cover. Their shapes are those
343
- * libraries' own and can change with them.
344
- */
345
- raw: {
346
- controls: CameraControls;
347
- scene: Object3D | null;
348
- /** Model nodes by binding key and node name. */
349
- nodes: Record<string, Object3D>;
350
- };
351
- };
352
- type ViewerCameraProps = {
353
- cameraState: ViewerCameraState | null;
354
- cameraPresets: Record<string, ViewerCameraPreset>;
355
- resetView: () => Promise<boolean>;
356
- focusObject: (objectId: string) => Promise<boolean>;
357
- fitScene: () => Promise<boolean>;
358
- setCameraTarget: (target: [number, number, number], enableTransition?: boolean) => Promise<boolean>;
359
- setCameraState: (state: ViewerCameraState, enableTransition?: boolean) => Promise<boolean>;
360
- lookAt: (position: [number, number, number], target: [number, number, number], enableTransition?: boolean) => Promise<boolean>;
361
- /**
362
- * Orbits the camera around its target to the given angles, in degrees.
363
- * Azimuth is the horizontal angle (0 is the front, +Z; 90 the right, +X);
364
- * polar is the vertical angle (0 straight down, 90 level, 180 straight up).
365
- */
366
- orbitTo: (azimuthDegrees: number, polarDegrees: number, enableTransition?: boolean) => Promise<boolean>;
367
- dollyTo: (distance: number, enableTransition?: boolean) => Promise<boolean>;
368
- savePreset: (name: string) => ViewerCameraState | null;
369
- goToPreset: (name: string, enableTransition?: boolean) => Promise<boolean>;
370
- handleCameraChange: (state: ViewerCameraState) => void;
371
- handleViewerReady: (viewer: ViewerReadyState) => void;
372
- };
373
- declare function useViewerCamera(options?: UseViewerCameraOptions): ViewerCameraProps;
374
-
375
- type ObjectTransformSpace = "local" | "world";
376
-
377
- type ModelMergeSource = {
378
- url: string;
379
- namePrefix: string;
380
- };
381
-
382
- type AnnotationMarker = SceneAnnotationMarker & {
383
- markerId?: string;
384
- };
385
- type CustomObjectBindingDataPanelProps = {
386
- isOpen: boolean;
387
- selectedObject: ObjectBinding | null;
388
- currentAction: ObjectActionEvent | null;
389
- onClose: () => void;
390
- onAction: (event: ObjectActionEvent) => void;
391
- };
392
- type CustomSceneObjectsPanelProps = {
393
- objectBindings: Record<string, ObjectBinding>;
394
- onAction?: (event: ObjectActionEvent) => void;
395
- onFocus?: (binding: ObjectBinding) => void;
396
- onHover?: (binding: ObjectBinding | null) => void;
397
- };
398
- type ModelViewerProps = GroupedModelViewerProps & {
399
- /** Plain-text overrides for built-in UI labels. Missing keys use English. */
400
- labels?: ModelViewerLabels;
401
- modelUrl: string;
402
- /**
403
- * An image shown in the viewer's place until its 3D view is drawn: a render
404
- * or photo of the model, best framed as the viewer frames it. Fitted inside
405
- * the viewer; set the CSS variable `--ri-poster-fit: cover` to fill it.
406
- */
407
- poster?: string;
408
- /**
409
- * `"lazy"` (default) starts the 3D view when the viewer is on or near the
410
- * screen. When the page needs room for viewers in view, one scrolled away
411
- * from goes back to a picture of itself, and comes back as it was. `"eager"`
412
- * starts at once and keeps its view.
413
- */
414
- loading?: ViewerLoading;
415
- /**
416
- * `"interaction"` keeps the poster, with a "View in 3D" button, until the
417
- * visitor asks for the 3D view. Default `"auto"`.
418
- */
419
- reveal?: ViewerReveal;
420
- /** Optional 3D Tiles manifest used instead of loading `modelUrl` monolithically. */
421
- tilesetUrl?: string | null;
422
- /** Screen-space error target for streamed 3D Tiles. Lower is sharper. */
423
- tilesErrorTarget?: number;
424
- /** Maximum number of parsed tiles retained by the client cache. */
425
- tilesCacheSize?: number;
426
- /**
427
- * Every bindable object in the model: each named mesh, under the identifier
428
- * bindings are keyed by. Reported each time a model loads; for a streamed
429
- * model it comes from the catalog beside `tileset.json`, before the tiles
430
- * that contain those objects have necessarily loaded.
431
- */
432
- onObjectCatalog?: (objects: ViewerObjectInfo[]) => void;
433
- /** Explicit format for extensionless or signed model URLs. */
434
- modelFormat?: ModelFormat;
435
- licenseKey: string;
436
- /**
437
- * The model's interactive objects, keyed by node name. Defaults to `"auto"`:
438
- * a default binding for every mesh, generated when the model loads and
439
- * reported through `onObjectBindingsChange`.
440
- */
441
- objectBindings?: Record<string, ObjectBinding> | "auto";
442
- selectedObject?: ObjectBinding | null;
443
- /**
444
- * Binding keys of several selected objects. Each is outlined in green.
445
- * While set, the single-selection (blue) outline is hidden.
446
- */
447
- multiSelectedKeys?: readonly string[];
448
- /** Explicit nodes to outline together, overriding multiSelectedKeys. */
449
- selectedObjectRefs?: Object3D[] | null;
450
- /** Color of the multi-selection outlines. Defaults to green. */
451
- selectedObjectOutlineColor?: string;
452
- panelHoveredObject?: ObjectBinding | null;
453
- onObjectBindingsChange?: (next: Record<string, ObjectBinding>) => void;
454
- onObjectSelect?: (binding: ObjectBinding | null) => void;
455
- onObjectHover?: (binding: ObjectBinding | null) => void;
456
- /**
457
- * An object was double-clicked. Return `true` to skip the viewer's own
458
- * double-click behavior: moving the orbit point to that spot, or starting
459
- * texture positioning when that's enabled.
460
- */
461
- onObjectDoubleClick?: (event: ObjectPointerEvent) => boolean | void;
462
- /** A decal on the model was double-clicked (the editor uses this to enable Move). */
463
- onDecalDoubleClick?: (binding: ObjectBinding, decalId: string) => void;
464
- /**
465
- * An object was right-clicked or, on touch screens, long-pressed. Use it to
466
- * open your own menu at `clientX`/`clientY`. A right-drag still pans.
467
- */
468
- onObjectContextMenu?: (event: ObjectPointerEvent) => void;
469
- /** Editor preview: grab this decal and drag it over its object's surface. */
470
- decalMove?: DecalMoveTarget | null;
471
- /** The model finished loading: its bounds and mesh count. */
472
- onModelLoaded?: (model: ViewerModelInfo) => void;
473
- onLoadError?: (error: unknown) => void;
474
- onProgress?: (event: ProgressEvent) => void;
475
- onCameraControllerChange?: (controller: CameraControllerType) => void;
476
- cameraControllerType?: CameraControllerType;
477
- onAction?: (event: ObjectActionEvent) => void;
478
- onHiddenObjectsChange?: (next: Record<string, boolean>) => void;
479
- /** Opt-in interaction analytics; no telemetry is sent by the viewer. */
480
- onEngagement?: (event: ViewerEngagementEvent) => void | Promise<void>;
481
- /** Log engagement events in the developer console. Default `false`. */
482
- debugEngagement?: boolean;
483
- /** The camera moved. Fires often while the user orbits, pans or zooms. */
484
- onCameraChange?: (state: ViewerCameraState) => void;
485
- onViewerReady?: (viewer: ViewerReadyState) => void;
486
- onTextureUpload?: (file: File, objectId: string) => Promise<string>;
487
- onAnimationsReady?: (controls: AnimationControls) => void;
488
- onModelAnimationsReady?: (url: string, controls: AnimationControls) => void;
489
- onAnnotationsChange?: (annotations: AnnotationMarker[]) => void;
490
- activeAnnotation?: AnnotationMarker | null;
491
- onActiveAnnotationChange?: (annotation: AnnotationMarker | null) => void;
492
- camera?: ViewerCameraConfig;
493
- cameraLimits?: CameraLimits;
494
- backgroundColor?: string;
495
- shadows?: boolean;
496
- showObjectBindingDataPanel?: boolean;
497
- customObjectBindingDataPanel?: (props: CustomObjectBindingDataPanelProps) => ReactNode;
498
- customSceneObjectsPanel?: (props: CustomSceneObjectsPanelProps) => ReactNode;
499
- showSceneObjectsPanel?: boolean;
500
- showDownloadButton?: boolean;
501
- downloadFilename?: string;
502
- showResetButton?: boolean;
503
- /** Fullscreen action button; grouped form: `ui.fullscreen`. Default `false`. */
504
- showFullscreenButton?: boolean;
505
- showLoadingOverlay?: boolean;
506
- showMouseController?: boolean;
507
- mouseControllerPosition?: MouseControllerPosition;
508
- mouseControllerOpacity?: number;
509
- moveSensitivity?: number;
510
- zoomSensitivity?: number;
511
- sceneConfig?: SceneConfig;
512
- disableZoom?: boolean;
513
- zoomOnSelected?: boolean;
514
- highlightOnHover?: boolean;
515
- onAutoFit?: () => Promise<boolean>;
516
- enableCameraControls?: boolean;
517
- moveModeEnabled?: boolean;
518
- /** Shows a draggable corner handle to resize the selected object, independently of moveModeEnabled. */
519
- scaleModeEnabled?: boolean;
520
- /** Aligns PivotControls to the scene or to the selected object. */
521
- objectTransformSpace?: ObjectTransformSpace;
522
- /** Enables canvas-focused camera shortcuts. Disabled by default. */
523
- enableKeyboardNavigation?: boolean;
524
- /**
525
- * Cuts motion the viewer starts on its own: auto-rotate and cinematic
526
- * autoplay don't start, and camera moves jump instead of gliding. `"user"`
527
- * (default) follows the visitor's `prefers-reduced-motion` setting;
528
- * `"always"` and `"never"` override it.
529
- */
530
- reducedMotion?: ReducedMotionSetting;
531
- refitOnResize?: boolean;
532
- renderMode?: "always" | "demand";
533
- maxDpr?: number;
534
- preserveDrawingBuffer?: boolean;
535
- webgpu?: boolean;
536
- performanceProfile?: PerformanceProfile;
537
- dracoDecoderPath?: string | false;
538
- ktx2TranscoderPath?: string | false;
539
- meshopt?: boolean;
540
- showMeasureTools?: boolean;
541
- showUvCheckerButton?: boolean;
542
- showExplodeControls?: boolean;
543
- isolation?: ViewerIsolation | null;
544
- onIsolationChange?: (isolation: ViewerIsolation | null) => void;
545
- showIsolateControls?: boolean;
546
- showSectionTools?: boolean;
547
- showMaterialVariants?: boolean;
548
- showObjectNavigator?: boolean;
549
- cinematic?: boolean | CinematicConfig;
550
- measurementUnit?: string;
551
- enableXR?: boolean;
552
- usdzUrl?: string;
553
- arScaleMode?: XRScaleMode;
554
- mobileHandoffUrl?: string;
555
- showAnnotationNavigation?: boolean;
556
- showAnnotationOnHover?: boolean;
557
- showAnnotationFilters?: boolean;
558
- annotationCategories?: string[] | null;
559
- onAnnotationCategoriesChange?: (categories: string[] | null) => void;
560
- onSceneConfigChange?: (config: SceneConfig) => void;
561
- showViewGizmo?: boolean;
562
- /**
563
- * Your own UI over the 3D view: badges, HUDs, custom panels. It sits above
564
- * the model and below the viewer's toolbars. The layer lets pointer events
565
- * through to the model; its direct children receive them, so position them
566
- * yourself (for example `position: "absolute"`).
567
- */
568
- overlay?: ReactNode;
569
- /**
570
- * react-three-fiber elements rendered inside the scene, for anything the
571
- * viewer can't do itself. They work with three.js directly, so they're
572
- * outside the viewer's own API and can break when three.js or
573
- * react-three-fiber change.
574
- */
575
- unsafe_sceneChildren?: ReactNode;
576
- autoRotate?: boolean;
577
- autoRotateSpeed?: number;
578
- /**
579
- * Texture positioning for objects with an uploaded texture: Offset and
580
- * Rotation fields in the Change Material panel, and Move/Zoom mode on
581
- * double-click (drag to move, scroll to scale). Off by default. Pass `true`,
582
- * or an object to take over parts of it; changes are written to the
583
- * binding's `style.material.texture`.
584
- */
585
- texturePositioning?: boolean | TexturePositioningControls;
586
- extraModelUrls?: string[];
587
- onExtraModelError?: (url: string, error: unknown) => void;
588
- onExtraModelLoaded?: (url: string, scene: Object3D) => void;
589
- originalNodePoses?: Record<string, {
590
- position: [number, number, number];
591
- rotation?: [number, number, number];
592
- scale?: [number, number, number];
593
- }>;
594
- /** Each entry supplies its own bindings. Uncontrolled edits are kept per URL. */
595
- models?: ModelViewerModelEntry[];
596
- mergeModels?: ModelMergeSource[];
597
- onMergeModelLoaded?: (url: string, mergedRoot: Object3D) => void;
598
- onMergeModelError?: (url: string, error: unknown) => void;
599
- /** Selects a model from the switcher. The switcher is hidden when omitted. */
600
- onModelChange?: (url: string) => void;
601
- };
602
- type ModelViewerModelEntry = {
603
- url: string;
604
- /** Display name for the model switcher; falls back to the URL's filename. */
605
- label?: string;
606
- /** Bindings for this model; used in preference to top-level objectBindings. */
607
- objectBindings: Record<string, ObjectBinding>;
608
- originalNodePoses?: Record<string, {
609
- position: [number, number, number];
610
- rotation?: [number, number, number];
611
- scale?: [number, number, number];
612
- }>;
613
- mergeModels?: ModelMergeSource[];
614
- /** Scene settings for this slot while parked; the active slot uses the viewer's sceneConfig. */
615
- sceneConfig?: SceneConfig;
616
- };
617
-
618
- export { type AnnotationMarker as A, type CameraControllerType as C, type DecalMoveTarget as D, type GroupedModelViewerProps as G, type HomeCameraState as H, MODEL_VIEWER_PRESETS as M, type ObjectTransformSpace as O, type PerformanceProfile as P, type TexturePositioningControls as T, type UseViewerCameraOptions as U, type ViewerCameraPreset as V, type XRScaleMode as X, type CameraLimits as a, type CaptureImageOptions as b, type CaptureVideoOptions as c, type CinematicConfig as d, type CinematicWaypoint as e, type CustomObjectBindingDataPanelProps as f, type CustomSceneObjectsPanelProps as g, type ModelMergeSource as h, type ModelViewerControlsOptions as i, type ModelViewerDecoderOptions as j, type ModelViewerModelEntry as k, type ModelViewerPerfOptions as l, type ModelViewerPreset as m, type ModelViewerProps as n, type ModelViewerTilesOptions as o, type ModelViewerToolsOptions as p, type ModelViewerUiOptions as q, type ModelViewerXrOptions as r, type MouseControllerPosition as s, type ViewerCameraProps as t, type ViewerEngagementEvent as u, type ViewerReadyState as v, useViewerCamera as w };