@liveroom-tech/react-immersive 4.3.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +697 -83
- package/dist/ModelViewer-CbbJT85n.d.mts +448 -0
- package/dist/ModelViewer-DOexHkJC.d.ts +448 -0
- package/dist/binding-builder.css +1 -0
- package/dist/binding-builder.d.mts +6 -0
- package/dist/binding-builder.d.ts +6 -0
- package/dist/binding-builder.js +3694 -0
- package/dist/binding-builder.mjs +1 -0
- package/dist/chunk-7EW6JZ46.mjs +27 -0
- package/dist/chunk-BGYK4Y2Y.mjs +1 -0
- package/dist/chunk-MMO7KCYU.mjs +3 -0
- package/dist/chunk-NVY7N7CU.mjs +3 -0
- package/dist/chunk-SEESCGUS.mjs +1 -0
- package/dist/chunk-WFEYRUZC.mjs +1 -0
- package/dist/chunk-XTLSAYAQ.mjs +1 -0
- package/dist/hosted.css +1 -1
- package/dist/hosted.d.mts +33 -13
- package/dist/hosted.d.ts +33 -13
- package/dist/hosted.js +11 -8
- package/dist/hosted.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +107 -83
- package/dist/index.d.ts +107 -83
- package/dist/index.js +11 -8
- package/dist/index.mjs +1 -1
- package/dist/modelInfo-CEmmvVCH.d.mts +17 -0
- package/dist/modelInfo-CEmmvVCH.d.ts +17 -0
- package/dist/{objectBinding-CBRYMYk6.d.ts → objectCatalog-5W8n5xNQ.d.mts} +55 -3
- package/dist/{objectBinding-CBRYMYk6.d.mts → objectCatalog-5W8n5xNQ.d.ts} +55 -3
- package/dist/publicProps-tJuWZgT3.d.mts +12 -0
- package/dist/publicProps-tJuWZgT3.d.ts +12 -0
- package/dist/simple-model-viewer.css +1 -0
- package/dist/simple-model-viewer.d.mts +38 -0
- package/dist/simple-model-viewer.d.ts +38 -0
- package/dist/simple-model-viewer.js +3666 -0
- package/dist/simple-model-viewer.mjs +1 -0
- package/dist/utils.d.mts +49 -3
- package/dist/utils.d.ts +49 -3
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +28 -18
- package/dist/chunk-7X37KAPE.mjs +0 -1
- package/dist/chunk-GYB4BOVW.mjs +0 -26
- package/dist/chunk-K7DMBJBJ.mjs +0 -1
- package/dist/publicProps-BST1E8an.d.mts +0 -349
- package/dist/publicProps-Bv3_PCP0.d.ts +0 -349
package/dist/index.d.mts
CHANGED
|
@@ -1,62 +1,16 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
export { A as AnimationClipInfo, a as AnimationControls, b as AnimationPlaybackState, c as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { n as ModelViewerProps, V as ViewerAnimationsProps, u as ViewerCameraProps, v as ViewerReadyState, e as CaptureImageOptions, U as UseViewerCameraOptions } from './ModelViewer-CbbJT85n.mjs';
|
|
3
|
+
export { A as AnimationClipInfo, a as AnimationControls, b as AnimationPlaybackState, c as AnnotationMarker, C as CameraControllerType, d as CameraLimits, f as CinematicConfig, g as CinematicWaypoint, h as CustomObjectBindingDataPanelProps, i as CustomSceneObjectsPanelProps, G as GroupedModelViewerProps, H as HomeCameraState, M as MODEL_VIEWER_PRESETS, j as ModelViewerControlsOptions, k as ModelViewerDecoderOptions, l as ModelViewerPerfOptions, m as ModelViewerPreset, o as ModelViewerTilesOptions, p as ModelViewerToolsOptions, q as ModelViewerUiOptions, r as ModelViewerXrOptions, s as MouseControllerPosition, O as ObjectTransformSpace, P as PerformanceProfile, T as TexturePositioningControls, t as ViewerCameraPreset, X as XRScaleMode, w as useViewerAnimations, x as useViewerCamera } from './ModelViewer-CbbJT85n.mjs';
|
|
4
|
+
import { g as ObjectBinding, q as ObjectBindingTarget, m as ObjectBindingPatch, B as BindingEdit, j as ObjectBindingMaterial, s as ObjectBindingTextureSlot, r as ObjectBindingTextureChannel, t as ObjectBindingTransform, J as SceneConfig, N as SceneConfigPatch, T as SceneLight, U as SceneLightAttachment, h as ObjectBindingAction, f as ObjectActionEvent, a2 as ViewerObjectInfo, a1 as ViewerCameraState } from './objectCatalog-5W8n5xNQ.mjs';
|
|
5
|
+
export { A as AnimationAction, a as AnimationActionEffect, b as AnimationLoopMode, C as CameraAction, c as CameraActionEffect, D as DEFAULT_SCENE_CONFIG, d as DeepPartial, E as EnvironmentPreset, G as GlitchModeName, K as KernelSizeName, M as MATERIAL_BLENDING_MODES, e as MATERIAL_SIDES, O as ObjectActionEffect, i as ObjectBindingCameraState, k as ObjectBindingMaterialBlendingMode, l as ObjectBindingMaterialSide, n as ObjectBindingSelector, o as ObjectBindingStatus, p as ObjectBindingStyle, u as ObjectBindingType, v as ObjectBindingsActionEffect, w as ObjectPointerEvent, R as RampTypeName, S as SceneAnimationClipConfig, x as SceneAnimationConfig, y as SceneAnnotationMarker, z as SceneBackgroundConfig, F as SceneCameraConfig, H as SceneCinematicConfig, I as SceneCinematicWaypoint, L as SceneConfigActionEffect, P as SceneEnvironmentConfig, Q as SceneGroundShadowConfig, V as SceneLightType, W as SceneLightingConfig, X as SceneModelConfig, Y as SceneModelRenderer, Z as ScenePostProcessingConfig, _ as SceneShadowConfig, $ as SceneWireframeConfig, a0 as ViewerCameraConfig, a3 as VisibilityActionEffect, a4 as material, a5 as patchBindings, a6 as patchSceneConfig, a7 as selectBindingKeys, a8 as selectBindings } from './objectCatalog-5W8n5xNQ.mjs';
|
|
6
|
+
import { SceneLightInput } from './utils.mjs';
|
|
7
|
+
export { ACTION_CATALOG, ActionCatalogEntry, ActionHandling, ObjectBindingActionId, ObjectBindingKey, buildBindingsFromNodes, createDefaultBinding, defineObjectBindings, findCatalogAction, inferType, sceneLight } from './utils.mjs';
|
|
8
|
+
import { V as ViewerModelBounds, a as ViewerModelInfo } from './modelInfo-CEmmvVCH.mjs';
|
|
9
|
+
export { M as ModelFormat } from './modelInfo-CEmmvVCH.mjs';
|
|
10
10
|
import '@react-three/drei';
|
|
11
|
-
import '
|
|
12
|
-
import '@react-three/fiber';
|
|
11
|
+
import 'three';
|
|
13
12
|
|
|
14
|
-
declare function
|
|
15
|
-
|
|
16
|
-
declare function BindingBuilder(props: BindingBuilderProps): react_jsx_runtime.JSX.Element;
|
|
17
|
-
|
|
18
|
-
type SimpleModelViewerProps = {
|
|
19
|
-
modelUrl: string;
|
|
20
|
-
/** Explicit format for extensionless or signed model URLs. */
|
|
21
|
-
modelFormat?: ModelFormat;
|
|
22
|
-
/** Directory containing the DRACO decoder files, or false. */
|
|
23
|
-
dracoDecoderPath?: string | false;
|
|
24
|
-
/** Directory containing the Basis/KTX2 transcoder files, or false. */
|
|
25
|
-
ktx2TranscoderPath?: string | false;
|
|
26
|
-
/** Enable the bundled Meshopt decoder. Defaults to true. */
|
|
27
|
-
meshopt?: boolean;
|
|
28
|
-
backgroundColor?: string;
|
|
29
|
-
showSceneObjectsPanel?: boolean;
|
|
30
|
-
showSceneSettingsPanel?: boolean;
|
|
31
|
-
enableModelUpload?: boolean;
|
|
32
|
-
zoomOnSelected?: boolean;
|
|
33
|
-
highlightOnHover?: boolean;
|
|
34
|
-
showLoadingOverlay?: boolean;
|
|
35
|
-
refitOnResize?: boolean;
|
|
36
|
-
backgroundEnabled?: boolean;
|
|
37
|
-
autoRotate?: boolean;
|
|
38
|
-
envPreset?: PresetsType;
|
|
39
|
-
exposure?: number;
|
|
40
|
-
ambientIntensity?: number;
|
|
41
|
-
ambientColor?: string;
|
|
42
|
-
directionalIntensity?: number;
|
|
43
|
-
directionalColor?: string;
|
|
44
|
-
onModelLoaded?: (scene: Object3D) => void;
|
|
45
|
-
onLoadError?: (error: unknown) => void;
|
|
46
|
-
};
|
|
47
|
-
declare function SimpleModelViewer({ modelUrl, modelFormat, dracoDecoderPath, ktx2TranscoderPath, meshopt, backgroundColor, showSceneObjectsPanel, showSceneSettingsPanel, enableModelUpload, zoomOnSelected, highlightOnHover, showLoadingOverlay, refitOnResize, backgroundEnabled, autoRotate, envPreset, exposure, ambientIntensity, ambientColor, directionalIntensity, directionalColor, onModelLoaded, onLoadError, }: SimpleModelViewerProps): react_jsx_runtime.JSX.Element;
|
|
48
|
-
|
|
49
|
-
type ViewerSelectionProps = {
|
|
50
|
-
selectedObjectBinding: ObjectBinding | null;
|
|
51
|
-
setSelectedObjectBinding: (binding: ObjectBinding | null) => void;
|
|
52
|
-
handleObjectSelect: (binding: ObjectBinding | null) => void;
|
|
53
|
-
clearSelection: () => void;
|
|
54
|
-
};
|
|
55
|
-
declare function useViewerSelection(initialSelectedObjectBinding?: ObjectBinding | null): ViewerSelectionProps;
|
|
56
|
-
|
|
57
|
-
declare function useObjectBinding(objectBindings: Record<string, ObjectBinding>, objectId: string | null | undefined): ObjectBinding | null;
|
|
58
|
-
|
|
59
|
-
declare function useObjectBindingIds(objectBindings: Record<string, ObjectBinding>): string[];
|
|
13
|
+
declare function PublicModelViewer(props: ModelViewerProps): react.JSX.Element;
|
|
60
14
|
|
|
61
15
|
type HiddenObjectsState = Record<string, boolean>;
|
|
62
16
|
type ObjectBindingsController = {
|
|
@@ -103,7 +57,6 @@ type SceneConfigController = {
|
|
|
103
57
|
resetSceneConfig: () => void;
|
|
104
58
|
lights: SceneLightsController;
|
|
105
59
|
};
|
|
106
|
-
type SceneLightInput = Pick<SceneLight, "id"> & Partial<Omit<SceneLight, "id">>;
|
|
107
60
|
type SceneLightPatch = Partial<Omit<SceneLight, "id">>;
|
|
108
61
|
type SceneLightsController = {
|
|
109
62
|
items: SceneLight[];
|
|
@@ -125,30 +78,6 @@ type SceneLightsController = {
|
|
|
125
78
|
*/
|
|
126
79
|
declare function useSceneConfig(initialSceneConfig: SceneConfig | (() => SceneConfig)): SceneConfigController;
|
|
127
80
|
|
|
128
|
-
type ViewerHoverProps = {
|
|
129
|
-
hoveredObjectBinding: ObjectBinding | null;
|
|
130
|
-
handleHoveredObject: (binding: ObjectBinding | null) => void;
|
|
131
|
-
};
|
|
132
|
-
declare function useViewerHover(): ViewerHoverProps;
|
|
133
|
-
|
|
134
|
-
type ViewerModelBounds = {
|
|
135
|
-
min: [number, number, number];
|
|
136
|
-
max: [number, number, number];
|
|
137
|
-
center: [number, number, number];
|
|
138
|
-
size: [number, number, number];
|
|
139
|
-
};
|
|
140
|
-
type ViewerModelProps = {
|
|
141
|
-
isLoading: boolean;
|
|
142
|
-
isReady: boolean;
|
|
143
|
-
error: unknown;
|
|
144
|
-
bounds: ViewerModelBounds | null;
|
|
145
|
-
objectCount: number;
|
|
146
|
-
handleModelLoaded: (scene: Object3D) => void;
|
|
147
|
-
handleLoadError: (error: unknown) => void;
|
|
148
|
-
resetModelState: () => void;
|
|
149
|
-
};
|
|
150
|
-
declare function useViewerModel(): ViewerModelProps;
|
|
151
|
-
|
|
152
81
|
type ViewerActionBindingsController = Pick<ObjectBindingsController, "objectBindings" | "updateObjectBindings" | "showObject" | "hideObject" | "toggleObjectVisibility">;
|
|
153
82
|
type ViewerActionSceneController = Pick<SceneConfigController, "updateSceneConfig">;
|
|
154
83
|
type ViewerActionCameraController = Pick<ViewerCameraProps, "focusObject" | "fitScene" | "resetView" | "setCameraTarget" | "setCameraState">;
|
|
@@ -314,6 +243,95 @@ type ViewerEffectsController = {
|
|
|
314
243
|
*/
|
|
315
244
|
declare function useViewerEffects(options?: UseViewerEffectsOptions): ViewerEffectsController;
|
|
316
245
|
|
|
246
|
+
type ViewerHoverProps = {
|
|
247
|
+
hoveredObjectBinding: ObjectBinding | null;
|
|
248
|
+
handleHoveredObject: (binding: ObjectBinding | null) => void;
|
|
249
|
+
};
|
|
250
|
+
declare function useViewerHover(): ViewerHoverProps;
|
|
251
|
+
|
|
252
|
+
type ViewerModelProps = {
|
|
253
|
+
isLoading: boolean;
|
|
254
|
+
isReady: boolean;
|
|
255
|
+
error: unknown;
|
|
256
|
+
bounds: ViewerModelBounds | null;
|
|
257
|
+
objectCount: number;
|
|
258
|
+
/**
|
|
259
|
+
* Every bindable object in the model (see `ViewerObjectInfo`). Filled by
|
|
260
|
+
* `handleObjectCatalog`, so pass that to `ModelViewer`'s `onObjectCatalog`.
|
|
261
|
+
*/
|
|
262
|
+
objects: ViewerObjectInfo[];
|
|
263
|
+
handleModelLoaded: (model: ViewerModelInfo) => void;
|
|
264
|
+
handleObjectCatalog: (objects: ViewerObjectInfo[]) => void;
|
|
265
|
+
handleLoadError: (error: unknown) => void;
|
|
266
|
+
resetModelState: () => void;
|
|
267
|
+
};
|
|
268
|
+
declare function useViewerModel(): ViewerModelProps;
|
|
269
|
+
|
|
270
|
+
type ViewerSelectionProps = {
|
|
271
|
+
selectedObjectBinding: ObjectBinding | null;
|
|
272
|
+
setSelectedObjectBinding: (binding: ObjectBinding | null) => void;
|
|
273
|
+
handleObjectSelect: (binding: ObjectBinding | null) => void;
|
|
274
|
+
clearSelection: () => void;
|
|
275
|
+
};
|
|
276
|
+
declare function useViewerSelection(initialSelectedObjectBinding?: ObjectBinding | null): ViewerSelectionProps;
|
|
277
|
+
|
|
278
|
+
type UseViewerOptions = {
|
|
279
|
+
/**
|
|
280
|
+
* The starting bindings. Defaults to `"auto"`: a binding for every mesh,
|
|
281
|
+
* generated when the model loads.
|
|
282
|
+
*/
|
|
283
|
+
bindings?: Record<string, ObjectBinding> | (() => Record<string, ObjectBinding>) | "auto";
|
|
284
|
+
/** The starting scene config (lighting, environment, post-processing, ...). */
|
|
285
|
+
sceneConfig?: SceneConfig | (() => SceneConfig);
|
|
286
|
+
/** Initial camera position, target and named presets. */
|
|
287
|
+
camera?: UseViewerCameraOptions;
|
|
288
|
+
/** Called for every action button, after built-in behavior and effects. */
|
|
289
|
+
onAction?: (event: ObjectActionEvent) => void | Promise<void>;
|
|
290
|
+
onObjectSelect?: (binding: ObjectBinding | null) => void;
|
|
291
|
+
onObjectHover?: (binding: ObjectBinding | null) => void;
|
|
292
|
+
onLoadError?: (error: unknown) => void;
|
|
293
|
+
};
|
|
294
|
+
/** The ModelViewer props that connect it to `useViewer`; spread them onto it. */
|
|
295
|
+
type UseViewerProps = Required<Pick<ModelViewerProps, "onObjectBindingsChange" | "selectedObject" | "onObjectSelect" | "onObjectHover" | "onCameraChange" | "onViewerReady" | "onModelLoaded" | "onLoadError" | "onObjectCatalog" | "onAnimationsReady" | "onAction">> & {
|
|
296
|
+
objectBindings: Record<string, ObjectBinding>;
|
|
297
|
+
sceneConfig?: SceneConfig;
|
|
298
|
+
onSceneConfigChange: (config: SceneConfig) => void;
|
|
299
|
+
};
|
|
300
|
+
type UseViewerResult = {
|
|
301
|
+
/** Spread onto ModelViewer: `<ModelViewer {...viewer.props} />`. */
|
|
302
|
+
props: UseViewerProps;
|
|
303
|
+
bindings: ObjectBindingsController;
|
|
304
|
+
selection: ViewerSelectionProps;
|
|
305
|
+
hover: ViewerHoverProps;
|
|
306
|
+
camera: ViewerCameraProps;
|
|
307
|
+
model: ViewerModelProps;
|
|
308
|
+
animations: ViewerAnimationsProps;
|
|
309
|
+
actions: ViewerActionsProps;
|
|
310
|
+
scene: SceneConfigController;
|
|
311
|
+
effects: ViewerEffectsController;
|
|
312
|
+
/** The live viewer, image capture and redraw requests. */
|
|
313
|
+
connection: ViewerConnectionController;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* All of the viewer hooks in one, already connected to each other and to
|
|
317
|
+
* ModelViewer:
|
|
318
|
+
*
|
|
319
|
+
* ```tsx
|
|
320
|
+
* const viewer = useViewer();
|
|
321
|
+
* <ModelViewer modelUrl="/car.glb" licenseKey={key} {...viewer.props} />;
|
|
322
|
+
* viewer.bindings.setBaseColor({ group: "paint" }, "#b91c1c");
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* Each part is the result of the hook it's named after (`viewer.camera` is
|
|
326
|
+
* `useViewerCamera()`'s result, and so on), so everything those hooks offer is
|
|
327
|
+
* available here too.
|
|
328
|
+
*/
|
|
329
|
+
declare function useViewer(options?: UseViewerOptions): UseViewerResult;
|
|
330
|
+
|
|
331
|
+
declare function useObjectBinding(objectBindings: Record<string, ObjectBinding>, objectId: string | null | undefined): ObjectBinding | null;
|
|
332
|
+
|
|
333
|
+
declare function useObjectBindingIds(objectBindings: Record<string, ObjectBinding>): string[];
|
|
334
|
+
|
|
317
335
|
type UseShareableViewerStateOptions = {
|
|
318
336
|
cameraState: ViewerCameraState | null;
|
|
319
337
|
setCameraState: (state: ViewerCameraState, enableTransition?: boolean) => Promise<boolean>;
|
|
@@ -332,4 +350,10 @@ type ShareableViewerStateProps = {
|
|
|
332
350
|
};
|
|
333
351
|
declare function useShareableViewerState({ cameraState, setCameraState, objectBindings, onObjectBindingsChange, selectedObjectBinding, setSelectedObjectBinding, paramKey, debounceMs, autoSync, }: UseShareableViewerStateOptions): ShareableViewerStateProps;
|
|
334
352
|
|
|
335
|
-
|
|
353
|
+
/**
|
|
354
|
+
* One entry of the object catalog the processor writes beside `tileset.json`.
|
|
355
|
+
* @deprecated Use `ViewerObjectInfo`, which every model now reports.
|
|
356
|
+
*/
|
|
357
|
+
type TileObjectCatalogEntry = ViewerObjectInfo;
|
|
358
|
+
|
|
359
|
+
export { BindingEdit, CaptureImageOptions, type HiddenObjectsState, PublicModelViewer as ModelViewer, ModelViewerProps, ObjectActionEvent, ObjectBinding, ObjectBindingAction, ObjectBindingMaterial, ObjectBindingPatch, ObjectBindingTarget, ObjectBindingTextureChannel, ObjectBindingTextureSlot, ObjectBindingTransform, type ObjectBindingsController, type RuntimeMaterialPatch, type RuntimeMaterialRanges, type RuntimePointLightOptions, type RuntimePointLightPatch, type RuntimeTransformPatch, type RuntimeTransformRanges, SceneConfig, type SceneConfigController, SceneConfigPatch, type SceneConfigUpdate, SceneLight, SceneLightAttachment, SceneLightInput, type SceneLightPatch, type SceneLightsController, type ShareableViewerStateProps, type TileObjectCatalogEntry, type UseShareableViewerStateOptions, UseViewerCameraOptions, type UseViewerEffectsOptions, type UseViewerOptions, type UseViewerProps, type UseViewerResult, type ViewerActionAnimationController, type ViewerActionBindingsController, type ViewerActionCameraController, type ViewerActionSceneController, type ViewerActionsOptions, type ViewerActionsProps, ViewerAnimationsProps, ViewerCameraProps, ViewerCameraState, type ViewerConnectionController, type ViewerEffectChannels, type ViewerEffectEasing, type ViewerEffectRange, type ViewerEffectTarget, type ViewerEffectsController, type ViewerFlickerOptions, type ViewerHoverProps, type ViewerLightEffectChannel, type ViewerMaterialEffectChannel, ViewerModelBounds, ViewerModelInfo, type ViewerModelProps, ViewerObjectInfo, type ViewerPulseOptions, type ViewerReadyConsumer, type ViewerReadyHandler, ViewerReadyState, type ViewerSelectionProps, type ViewerTimelineOptions, type ViewerTimelineStep, type ViewerTransformEffectChannel, type ViewerTransitionOptions, type ViewerVector3, useObjectBinding, useObjectBindingIds, useObjectBindings, useSceneConfig, useShareableViewerState, useViewer, useViewerActions, useViewerConnection, useViewerEffects, useViewerHover, useViewerModel, useViewerSelection };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,62 +1,16 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
export { A as AnimationClipInfo, a as AnimationControls, b as AnimationPlaybackState, c as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { n as ModelViewerProps, V as ViewerAnimationsProps, u as ViewerCameraProps, v as ViewerReadyState, e as CaptureImageOptions, U as UseViewerCameraOptions } from './ModelViewer-DOexHkJC.js';
|
|
3
|
+
export { A as AnimationClipInfo, a as AnimationControls, b as AnimationPlaybackState, c as AnnotationMarker, C as CameraControllerType, d as CameraLimits, f as CinematicConfig, g as CinematicWaypoint, h as CustomObjectBindingDataPanelProps, i as CustomSceneObjectsPanelProps, G as GroupedModelViewerProps, H as HomeCameraState, M as MODEL_VIEWER_PRESETS, j as ModelViewerControlsOptions, k as ModelViewerDecoderOptions, l as ModelViewerPerfOptions, m as ModelViewerPreset, o as ModelViewerTilesOptions, p as ModelViewerToolsOptions, q as ModelViewerUiOptions, r as ModelViewerXrOptions, s as MouseControllerPosition, O as ObjectTransformSpace, P as PerformanceProfile, T as TexturePositioningControls, t as ViewerCameraPreset, X as XRScaleMode, w as useViewerAnimations, x as useViewerCamera } from './ModelViewer-DOexHkJC.js';
|
|
4
|
+
import { g as ObjectBinding, q as ObjectBindingTarget, m as ObjectBindingPatch, B as BindingEdit, j as ObjectBindingMaterial, s as ObjectBindingTextureSlot, r as ObjectBindingTextureChannel, t as ObjectBindingTransform, J as SceneConfig, N as SceneConfigPatch, T as SceneLight, U as SceneLightAttachment, h as ObjectBindingAction, f as ObjectActionEvent, a2 as ViewerObjectInfo, a1 as ViewerCameraState } from './objectCatalog-5W8n5xNQ.js';
|
|
5
|
+
export { A as AnimationAction, a as AnimationActionEffect, b as AnimationLoopMode, C as CameraAction, c as CameraActionEffect, D as DEFAULT_SCENE_CONFIG, d as DeepPartial, E as EnvironmentPreset, G as GlitchModeName, K as KernelSizeName, M as MATERIAL_BLENDING_MODES, e as MATERIAL_SIDES, O as ObjectActionEffect, i as ObjectBindingCameraState, k as ObjectBindingMaterialBlendingMode, l as ObjectBindingMaterialSide, n as ObjectBindingSelector, o as ObjectBindingStatus, p as ObjectBindingStyle, u as ObjectBindingType, v as ObjectBindingsActionEffect, w as ObjectPointerEvent, R as RampTypeName, S as SceneAnimationClipConfig, x as SceneAnimationConfig, y as SceneAnnotationMarker, z as SceneBackgroundConfig, F as SceneCameraConfig, H as SceneCinematicConfig, I as SceneCinematicWaypoint, L as SceneConfigActionEffect, P as SceneEnvironmentConfig, Q as SceneGroundShadowConfig, V as SceneLightType, W as SceneLightingConfig, X as SceneModelConfig, Y as SceneModelRenderer, Z as ScenePostProcessingConfig, _ as SceneShadowConfig, $ as SceneWireframeConfig, a0 as ViewerCameraConfig, a3 as VisibilityActionEffect, a4 as material, a5 as patchBindings, a6 as patchSceneConfig, a7 as selectBindingKeys, a8 as selectBindings } from './objectCatalog-5W8n5xNQ.js';
|
|
6
|
+
import { SceneLightInput } from './utils.js';
|
|
7
|
+
export { ACTION_CATALOG, ActionCatalogEntry, ActionHandling, ObjectBindingActionId, ObjectBindingKey, buildBindingsFromNodes, createDefaultBinding, defineObjectBindings, findCatalogAction, inferType, sceneLight } from './utils.js';
|
|
8
|
+
import { V as ViewerModelBounds, a as ViewerModelInfo } from './modelInfo-CEmmvVCH.js';
|
|
9
|
+
export { M as ModelFormat } from './modelInfo-CEmmvVCH.js';
|
|
10
10
|
import '@react-three/drei';
|
|
11
|
-
import '
|
|
12
|
-
import '@react-three/fiber';
|
|
11
|
+
import 'three';
|
|
13
12
|
|
|
14
|
-
declare function
|
|
15
|
-
|
|
16
|
-
declare function BindingBuilder(props: BindingBuilderProps): react_jsx_runtime.JSX.Element;
|
|
17
|
-
|
|
18
|
-
type SimpleModelViewerProps = {
|
|
19
|
-
modelUrl: string;
|
|
20
|
-
/** Explicit format for extensionless or signed model URLs. */
|
|
21
|
-
modelFormat?: ModelFormat;
|
|
22
|
-
/** Directory containing the DRACO decoder files, or false. */
|
|
23
|
-
dracoDecoderPath?: string | false;
|
|
24
|
-
/** Directory containing the Basis/KTX2 transcoder files, or false. */
|
|
25
|
-
ktx2TranscoderPath?: string | false;
|
|
26
|
-
/** Enable the bundled Meshopt decoder. Defaults to true. */
|
|
27
|
-
meshopt?: boolean;
|
|
28
|
-
backgroundColor?: string;
|
|
29
|
-
showSceneObjectsPanel?: boolean;
|
|
30
|
-
showSceneSettingsPanel?: boolean;
|
|
31
|
-
enableModelUpload?: boolean;
|
|
32
|
-
zoomOnSelected?: boolean;
|
|
33
|
-
highlightOnHover?: boolean;
|
|
34
|
-
showLoadingOverlay?: boolean;
|
|
35
|
-
refitOnResize?: boolean;
|
|
36
|
-
backgroundEnabled?: boolean;
|
|
37
|
-
autoRotate?: boolean;
|
|
38
|
-
envPreset?: PresetsType;
|
|
39
|
-
exposure?: number;
|
|
40
|
-
ambientIntensity?: number;
|
|
41
|
-
ambientColor?: string;
|
|
42
|
-
directionalIntensity?: number;
|
|
43
|
-
directionalColor?: string;
|
|
44
|
-
onModelLoaded?: (scene: Object3D) => void;
|
|
45
|
-
onLoadError?: (error: unknown) => void;
|
|
46
|
-
};
|
|
47
|
-
declare function SimpleModelViewer({ modelUrl, modelFormat, dracoDecoderPath, ktx2TranscoderPath, meshopt, backgroundColor, showSceneObjectsPanel, showSceneSettingsPanel, enableModelUpload, zoomOnSelected, highlightOnHover, showLoadingOverlay, refitOnResize, backgroundEnabled, autoRotate, envPreset, exposure, ambientIntensity, ambientColor, directionalIntensity, directionalColor, onModelLoaded, onLoadError, }: SimpleModelViewerProps): react_jsx_runtime.JSX.Element;
|
|
48
|
-
|
|
49
|
-
type ViewerSelectionProps = {
|
|
50
|
-
selectedObjectBinding: ObjectBinding | null;
|
|
51
|
-
setSelectedObjectBinding: (binding: ObjectBinding | null) => void;
|
|
52
|
-
handleObjectSelect: (binding: ObjectBinding | null) => void;
|
|
53
|
-
clearSelection: () => void;
|
|
54
|
-
};
|
|
55
|
-
declare function useViewerSelection(initialSelectedObjectBinding?: ObjectBinding | null): ViewerSelectionProps;
|
|
56
|
-
|
|
57
|
-
declare function useObjectBinding(objectBindings: Record<string, ObjectBinding>, objectId: string | null | undefined): ObjectBinding | null;
|
|
58
|
-
|
|
59
|
-
declare function useObjectBindingIds(objectBindings: Record<string, ObjectBinding>): string[];
|
|
13
|
+
declare function PublicModelViewer(props: ModelViewerProps): react.JSX.Element;
|
|
60
14
|
|
|
61
15
|
type HiddenObjectsState = Record<string, boolean>;
|
|
62
16
|
type ObjectBindingsController = {
|
|
@@ -103,7 +57,6 @@ type SceneConfigController = {
|
|
|
103
57
|
resetSceneConfig: () => void;
|
|
104
58
|
lights: SceneLightsController;
|
|
105
59
|
};
|
|
106
|
-
type SceneLightInput = Pick<SceneLight, "id"> & Partial<Omit<SceneLight, "id">>;
|
|
107
60
|
type SceneLightPatch = Partial<Omit<SceneLight, "id">>;
|
|
108
61
|
type SceneLightsController = {
|
|
109
62
|
items: SceneLight[];
|
|
@@ -125,30 +78,6 @@ type SceneLightsController = {
|
|
|
125
78
|
*/
|
|
126
79
|
declare function useSceneConfig(initialSceneConfig: SceneConfig | (() => SceneConfig)): SceneConfigController;
|
|
127
80
|
|
|
128
|
-
type ViewerHoverProps = {
|
|
129
|
-
hoveredObjectBinding: ObjectBinding | null;
|
|
130
|
-
handleHoveredObject: (binding: ObjectBinding | null) => void;
|
|
131
|
-
};
|
|
132
|
-
declare function useViewerHover(): ViewerHoverProps;
|
|
133
|
-
|
|
134
|
-
type ViewerModelBounds = {
|
|
135
|
-
min: [number, number, number];
|
|
136
|
-
max: [number, number, number];
|
|
137
|
-
center: [number, number, number];
|
|
138
|
-
size: [number, number, number];
|
|
139
|
-
};
|
|
140
|
-
type ViewerModelProps = {
|
|
141
|
-
isLoading: boolean;
|
|
142
|
-
isReady: boolean;
|
|
143
|
-
error: unknown;
|
|
144
|
-
bounds: ViewerModelBounds | null;
|
|
145
|
-
objectCount: number;
|
|
146
|
-
handleModelLoaded: (scene: Object3D) => void;
|
|
147
|
-
handleLoadError: (error: unknown) => void;
|
|
148
|
-
resetModelState: () => void;
|
|
149
|
-
};
|
|
150
|
-
declare function useViewerModel(): ViewerModelProps;
|
|
151
|
-
|
|
152
81
|
type ViewerActionBindingsController = Pick<ObjectBindingsController, "objectBindings" | "updateObjectBindings" | "showObject" | "hideObject" | "toggleObjectVisibility">;
|
|
153
82
|
type ViewerActionSceneController = Pick<SceneConfigController, "updateSceneConfig">;
|
|
154
83
|
type ViewerActionCameraController = Pick<ViewerCameraProps, "focusObject" | "fitScene" | "resetView" | "setCameraTarget" | "setCameraState">;
|
|
@@ -314,6 +243,95 @@ type ViewerEffectsController = {
|
|
|
314
243
|
*/
|
|
315
244
|
declare function useViewerEffects(options?: UseViewerEffectsOptions): ViewerEffectsController;
|
|
316
245
|
|
|
246
|
+
type ViewerHoverProps = {
|
|
247
|
+
hoveredObjectBinding: ObjectBinding | null;
|
|
248
|
+
handleHoveredObject: (binding: ObjectBinding | null) => void;
|
|
249
|
+
};
|
|
250
|
+
declare function useViewerHover(): ViewerHoverProps;
|
|
251
|
+
|
|
252
|
+
type ViewerModelProps = {
|
|
253
|
+
isLoading: boolean;
|
|
254
|
+
isReady: boolean;
|
|
255
|
+
error: unknown;
|
|
256
|
+
bounds: ViewerModelBounds | null;
|
|
257
|
+
objectCount: number;
|
|
258
|
+
/**
|
|
259
|
+
* Every bindable object in the model (see `ViewerObjectInfo`). Filled by
|
|
260
|
+
* `handleObjectCatalog`, so pass that to `ModelViewer`'s `onObjectCatalog`.
|
|
261
|
+
*/
|
|
262
|
+
objects: ViewerObjectInfo[];
|
|
263
|
+
handleModelLoaded: (model: ViewerModelInfo) => void;
|
|
264
|
+
handleObjectCatalog: (objects: ViewerObjectInfo[]) => void;
|
|
265
|
+
handleLoadError: (error: unknown) => void;
|
|
266
|
+
resetModelState: () => void;
|
|
267
|
+
};
|
|
268
|
+
declare function useViewerModel(): ViewerModelProps;
|
|
269
|
+
|
|
270
|
+
type ViewerSelectionProps = {
|
|
271
|
+
selectedObjectBinding: ObjectBinding | null;
|
|
272
|
+
setSelectedObjectBinding: (binding: ObjectBinding | null) => void;
|
|
273
|
+
handleObjectSelect: (binding: ObjectBinding | null) => void;
|
|
274
|
+
clearSelection: () => void;
|
|
275
|
+
};
|
|
276
|
+
declare function useViewerSelection(initialSelectedObjectBinding?: ObjectBinding | null): ViewerSelectionProps;
|
|
277
|
+
|
|
278
|
+
type UseViewerOptions = {
|
|
279
|
+
/**
|
|
280
|
+
* The starting bindings. Defaults to `"auto"`: a binding for every mesh,
|
|
281
|
+
* generated when the model loads.
|
|
282
|
+
*/
|
|
283
|
+
bindings?: Record<string, ObjectBinding> | (() => Record<string, ObjectBinding>) | "auto";
|
|
284
|
+
/** The starting scene config (lighting, environment, post-processing, ...). */
|
|
285
|
+
sceneConfig?: SceneConfig | (() => SceneConfig);
|
|
286
|
+
/** Initial camera position, target and named presets. */
|
|
287
|
+
camera?: UseViewerCameraOptions;
|
|
288
|
+
/** Called for every action button, after built-in behavior and effects. */
|
|
289
|
+
onAction?: (event: ObjectActionEvent) => void | Promise<void>;
|
|
290
|
+
onObjectSelect?: (binding: ObjectBinding | null) => void;
|
|
291
|
+
onObjectHover?: (binding: ObjectBinding | null) => void;
|
|
292
|
+
onLoadError?: (error: unknown) => void;
|
|
293
|
+
};
|
|
294
|
+
/** The ModelViewer props that connect it to `useViewer`; spread them onto it. */
|
|
295
|
+
type UseViewerProps = Required<Pick<ModelViewerProps, "onObjectBindingsChange" | "selectedObject" | "onObjectSelect" | "onObjectHover" | "onCameraChange" | "onViewerReady" | "onModelLoaded" | "onLoadError" | "onObjectCatalog" | "onAnimationsReady" | "onAction">> & {
|
|
296
|
+
objectBindings: Record<string, ObjectBinding>;
|
|
297
|
+
sceneConfig?: SceneConfig;
|
|
298
|
+
onSceneConfigChange: (config: SceneConfig) => void;
|
|
299
|
+
};
|
|
300
|
+
type UseViewerResult = {
|
|
301
|
+
/** Spread onto ModelViewer: `<ModelViewer {...viewer.props} />`. */
|
|
302
|
+
props: UseViewerProps;
|
|
303
|
+
bindings: ObjectBindingsController;
|
|
304
|
+
selection: ViewerSelectionProps;
|
|
305
|
+
hover: ViewerHoverProps;
|
|
306
|
+
camera: ViewerCameraProps;
|
|
307
|
+
model: ViewerModelProps;
|
|
308
|
+
animations: ViewerAnimationsProps;
|
|
309
|
+
actions: ViewerActionsProps;
|
|
310
|
+
scene: SceneConfigController;
|
|
311
|
+
effects: ViewerEffectsController;
|
|
312
|
+
/** The live viewer, image capture and redraw requests. */
|
|
313
|
+
connection: ViewerConnectionController;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* All of the viewer hooks in one, already connected to each other and to
|
|
317
|
+
* ModelViewer:
|
|
318
|
+
*
|
|
319
|
+
* ```tsx
|
|
320
|
+
* const viewer = useViewer();
|
|
321
|
+
* <ModelViewer modelUrl="/car.glb" licenseKey={key} {...viewer.props} />;
|
|
322
|
+
* viewer.bindings.setBaseColor({ group: "paint" }, "#b91c1c");
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* Each part is the result of the hook it's named after (`viewer.camera` is
|
|
326
|
+
* `useViewerCamera()`'s result, and so on), so everything those hooks offer is
|
|
327
|
+
* available here too.
|
|
328
|
+
*/
|
|
329
|
+
declare function useViewer(options?: UseViewerOptions): UseViewerResult;
|
|
330
|
+
|
|
331
|
+
declare function useObjectBinding(objectBindings: Record<string, ObjectBinding>, objectId: string | null | undefined): ObjectBinding | null;
|
|
332
|
+
|
|
333
|
+
declare function useObjectBindingIds(objectBindings: Record<string, ObjectBinding>): string[];
|
|
334
|
+
|
|
317
335
|
type UseShareableViewerStateOptions = {
|
|
318
336
|
cameraState: ViewerCameraState | null;
|
|
319
337
|
setCameraState: (state: ViewerCameraState, enableTransition?: boolean) => Promise<boolean>;
|
|
@@ -332,4 +350,10 @@ type ShareableViewerStateProps = {
|
|
|
332
350
|
};
|
|
333
351
|
declare function useShareableViewerState({ cameraState, setCameraState, objectBindings, onObjectBindingsChange, selectedObjectBinding, setSelectedObjectBinding, paramKey, debounceMs, autoSync, }: UseShareableViewerStateOptions): ShareableViewerStateProps;
|
|
334
352
|
|
|
335
|
-
|
|
353
|
+
/**
|
|
354
|
+
* One entry of the object catalog the processor writes beside `tileset.json`.
|
|
355
|
+
* @deprecated Use `ViewerObjectInfo`, which every model now reports.
|
|
356
|
+
*/
|
|
357
|
+
type TileObjectCatalogEntry = ViewerObjectInfo;
|
|
358
|
+
|
|
359
|
+
export { BindingEdit, CaptureImageOptions, type HiddenObjectsState, PublicModelViewer as ModelViewer, ModelViewerProps, ObjectActionEvent, ObjectBinding, ObjectBindingAction, ObjectBindingMaterial, ObjectBindingPatch, ObjectBindingTarget, ObjectBindingTextureChannel, ObjectBindingTextureSlot, ObjectBindingTransform, type ObjectBindingsController, type RuntimeMaterialPatch, type RuntimeMaterialRanges, type RuntimePointLightOptions, type RuntimePointLightPatch, type RuntimeTransformPatch, type RuntimeTransformRanges, SceneConfig, type SceneConfigController, SceneConfigPatch, type SceneConfigUpdate, SceneLight, SceneLightAttachment, SceneLightInput, type SceneLightPatch, type SceneLightsController, type ShareableViewerStateProps, type TileObjectCatalogEntry, type UseShareableViewerStateOptions, UseViewerCameraOptions, type UseViewerEffectsOptions, type UseViewerOptions, type UseViewerProps, type UseViewerResult, type ViewerActionAnimationController, type ViewerActionBindingsController, type ViewerActionCameraController, type ViewerActionSceneController, type ViewerActionsOptions, type ViewerActionsProps, ViewerAnimationsProps, ViewerCameraProps, ViewerCameraState, type ViewerConnectionController, type ViewerEffectChannels, type ViewerEffectEasing, type ViewerEffectRange, type ViewerEffectTarget, type ViewerEffectsController, type ViewerFlickerOptions, type ViewerHoverProps, type ViewerLightEffectChannel, type ViewerMaterialEffectChannel, ViewerModelBounds, ViewerModelInfo, type ViewerModelProps, ViewerObjectInfo, type ViewerPulseOptions, type ViewerReadyConsumer, type ViewerReadyHandler, ViewerReadyState, type ViewerSelectionProps, type ViewerTimelineOptions, type ViewerTimelineStep, type ViewerTransformEffectChannel, type ViewerTransitionOptions, type ViewerVector3, useObjectBinding, useObjectBindingIds, useObjectBindings, useSceneConfig, useShareableViewerState, useViewer, useViewerActions, useViewerConnection, useViewerEffects, useViewerHover, useViewerModel, useViewerSelection };
|