@liveroom-tech/react-immersive 5.0.2 → 5.2.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 +1030 -59
- package/dist/binding-builder.css +1 -1
- package/dist/binding-builder.js +17 -12
- package/dist/binding-builder.mjs +1 -1
- package/dist/chunk-4NLJSD3S.mjs +1 -0
- package/dist/chunk-B7REIGDG.mjs +1 -0
- package/dist/chunk-HYFJ5DYJ.mjs +1 -0
- package/dist/chunk-QC3NT76G.mjs +3 -0
- package/dist/chunk-T3M3BQ7H.mjs +32 -0
- package/dist/chunk-ZPK67UG7.mjs +1 -0
- package/dist/hosted.css +1 -1
- package/dist/hosted.d.mts +4 -3
- package/dist/hosted.d.ts +4 -3
- package/dist/hosted.js +16 -11
- package/dist/hosted.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +85 -10
- package/dist/index.d.ts +85 -10
- package/dist/index.js +15 -10
- package/dist/index.mjs +1 -1
- package/dist/materialVariants-DnZe9eMC.d.mts +309 -0
- package/dist/materialVariants-DnZe9eMC.d.ts +309 -0
- package/dist/modelInfo-BYebMPdZ.d.mts +43 -0
- package/dist/modelInfo-XfUQO7C_.d.ts +43 -0
- package/dist/{ModelViewer-CbbJT85n.d.mts → modelViewerProps-CIZ2R_Fv.d.ts} +164 -43
- package/dist/{ModelViewer-DOexHkJC.d.ts → modelViewerProps-DoRiTZMn.d.mts} +164 -43
- package/dist/{objectCatalog-5W8n5xNQ.d.ts → rendererBackend-QwMzISTn.d.mts} +304 -5
- package/dist/{objectCatalog-5W8n5xNQ.d.mts → rendererBackend-QwMzISTn.d.ts} +304 -5
- package/dist/simple-model-viewer.css +1 -1
- package/dist/simple-model-viewer.d.mts +32 -4
- package/dist/simple-model-viewer.d.ts +32 -4
- package/dist/simple-model-viewer.js +3 -3
- package/dist/simple-model-viewer.mjs +1 -1
- package/dist/utils.d.mts +5 -4
- package/dist/utils.d.ts +5 -4
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-3GX7DOGS.mjs +0 -3
- package/dist/chunk-AH5NAZWX.mjs +0 -27
- package/dist/chunk-BGYK4Y2Y.mjs +0 -1
- package/dist/chunk-WFEYRUZC.mjs +0 -1
- package/dist/chunk-XTLSAYAQ.mjs +0 -1
- package/dist/modelInfo-CEmmvVCH.d.mts +0 -17
- package/dist/modelInfo-CEmmvVCH.d.ts +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,46 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export { A as
|
|
4
|
-
import {
|
|
5
|
-
export { A as AnimationAction, a as AnimationActionEffect, b as AnimationLoopMode, C as CameraAction,
|
|
2
|
+
import { l as ModelViewerProps, r as ViewerCameraProps, t as ViewerReadyState, b as CaptureImageOptions, c as CaptureVideoOptions, U as UseViewerCameraOptions } from './modelViewerProps-CIZ2R_Fv.js';
|
|
3
|
+
export { A as AnnotationMarker, C as CameraControllerType, a as CameraLimits, d as CinematicConfig, e as CinematicWaypoint, f as CustomObjectBindingDataPanelProps, g as CustomSceneObjectsPanelProps, D as DecalMoveTarget, G as GroupedModelViewerProps, H as HomeCameraState, M as MODEL_VIEWER_PRESETS, h as ModelViewerControlsOptions, i as ModelViewerDecoderOptions, j as ModelViewerPerfOptions, k as ModelViewerPreset, m as ModelViewerTilesOptions, n as ModelViewerToolsOptions, o as ModelViewerUiOptions, p as ModelViewerXrOptions, q as MouseControllerPosition, O as ObjectTransformSpace, P as PerformanceProfile, T as TexturePositioningControls, V as ViewerCameraPreset, s as ViewerEngagementEvent, X as XRScaleMode, u as useViewerCamera } from './modelViewerProps-CIZ2R_Fv.js';
|
|
4
|
+
import { o as ObjectBinding, z as ObjectBindingTarget, v as ObjectBindingPatch, B as BindingEdit, s as ObjectBindingMaterial, H as ObjectBindingTextureSlot, F as ObjectBindingTextureChannel, J as ObjectBindingTransform, r as ObjectBindingDecal, a1 as SceneConfig, a3 as SceneConfigPatch, a6 as SceneLight, a7 as SceneLightAttachment, aq as ViewerIsolation, p as ObjectBindingAction, n as ObjectActionEvent, an as ViewerAnimationsProps, ar as ViewerObjectInfo, ap as ViewerCameraState } from './rendererBackend-QwMzISTn.js';
|
|
5
|
+
export { A as AnimationAction, a as AnimationActionEffect, b as AnimationClipInfo, c as AnimationClipState, d as AnimationClipStatus, e as AnimationControls, f as AnimationLoopMode, g as AnimationPlayOptions, h as AnimationPlaybackState, C as CameraAction, i as CameraActionEffect, D as DEFAULT_SCENE_CONFIG, j as DEFAULT_SECTION_CONFIG, k as DeepPartial, E as EnvironmentPreset, G as GlitchModeName, I as IsolatedObjectBindings, l as IsolationActionEffect, K as KernelSizeName, M as MATERIAL_BLENDING_MODES, m as MATERIAL_SIDES, O as ObjectActionEffect, q as ObjectBindingCameraState, t as ObjectBindingMaterialBlendingMode, u as ObjectBindingMaterialSide, w as ObjectBindingSelector, x as ObjectBindingStatus, y as ObjectBindingStyle, L as ObjectBindingType, N as ObjectBindingsActionEffect, P as ObjectPointerEvent, Q as ObjectSurfacePoint, R as RampTypeName, S as RendererBackend, T as SceneAnimationClipConfig, U as SceneAnimationConfig, V as SceneAnnotationCameraView, W as SceneAnnotationImage, X as SceneAnnotationLink, Y as SceneAnnotationMarker, Z as SceneBackgroundConfig, _ as SceneCameraConfig, $ as SceneCinematicConfig, a0 as SceneCinematicWaypoint, a2 as SceneConfigActionEffect, a4 as SceneEnvironmentConfig, a5 as SceneGroundShadowConfig, a8 as SceneLightType, a9 as SceneLightingConfig, aa as SceneModelConfig, ab as SceneModelRenderer, ac as ScenePostProcessingConfig, ad as SceneSectionAxis, ae as SceneSectionConfig, af as SceneShadowConfig, ag as SceneStyleColorScale, ah as SceneStyleCondition, ai as SceneStylePulse, aj as SceneStyleRule, ak as SceneWireframeConfig, al as StyledObjectBindings, am as StyledObjectPulse, ao as ViewerCameraConfig, as as VisibilityActionEffect, at as applyIsolation, au as applyStyleRules, av as colorScaleValue, aw as isolatedBindingKeys, ax as material, ay as patchBindings, az as patchSceneConfig, aA as selectBindingKeys, aB as selectBindings, aC as useViewerAnimations } from './rendererBackend-QwMzISTn.js';
|
|
6
6
|
import { SceneLightInput } from './utils.js';
|
|
7
7
|
export { ACTION_CATALOG, ActionCatalogEntry, ActionHandling, ObjectBindingActionId, ObjectBindingKey, buildBindingsFromNodes, createDefaultBinding, defineObjectBindings, findCatalogAction, inferType, sceneLight } from './utils.js';
|
|
8
|
-
import {
|
|
9
|
-
export { M as ModelFormat } from './modelInfo-
|
|
8
|
+
import { a as ViewerModelBounds, b as ViewerModelInfo } from './modelInfo-XfUQO7C_.js';
|
|
9
|
+
export { M as ModelFormat, V as ViewerLoading, c as ViewerReveal } from './modelInfo-XfUQO7C_.js';
|
|
10
|
+
import { M as MaterialVariantGroup } from './materialVariants-DnZe9eMC.js';
|
|
11
|
+
export { D as DEFAULT_MODEL_VIEWER_LABELS, a as MaterialVariantOption, b as ModelViewerLabelKey, c as ModelViewerLabels, R as ReducedMotionSetting, d as chooseMaterialVariant } from './materialVariants-DnZe9eMC.js';
|
|
10
12
|
import '@react-three/drei';
|
|
11
13
|
import 'three';
|
|
12
14
|
|
|
13
15
|
declare function PublicModelViewer(props: ModelViewerProps): react.JSX.Element;
|
|
14
16
|
|
|
17
|
+
/** One side of a comparison: any ModelViewer props, over the shared ones. */
|
|
18
|
+
type CompareViewerSide = Partial<ModelViewerProps> & {
|
|
19
|
+
/** Shown over this side. Defaults to "Before" and "After". */
|
|
20
|
+
label?: string;
|
|
21
|
+
};
|
|
22
|
+
type CompareViewerProps = Partial<ModelViewerProps> & {
|
|
23
|
+
licenseKey: string;
|
|
24
|
+
/** The left side: the shared props with these on top. */
|
|
25
|
+
before: CompareViewerSide;
|
|
26
|
+
/** The right side. */
|
|
27
|
+
after: CompareViewerSide;
|
|
28
|
+
/**
|
|
29
|
+
* `"slider"` lays the two views over each other with a divider to drag
|
|
30
|
+
* across; `"side-by-side"` shows them next to each other. Default
|
|
31
|
+
* `"slider"`.
|
|
32
|
+
*/
|
|
33
|
+
layout?: "slider" | "side-by-side";
|
|
34
|
+
/** Where the slider's divider is, from 0 (left edge) to 1. Default 0.5. */
|
|
35
|
+
split?: number;
|
|
36
|
+
onSplitChange?: (split: number) => void;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Two ModelViewers showing two configurations of a model (or two models) with
|
|
40
|
+
* one camera: moving either view moves both.
|
|
41
|
+
*/
|
|
42
|
+
declare function CompareViewer(props: CompareViewerProps): react.JSX.Element;
|
|
43
|
+
|
|
15
44
|
type HiddenObjectsState = Record<string, boolean>;
|
|
16
45
|
type ObjectBindingsController = {
|
|
17
46
|
objectBindings: Record<string, ObjectBinding>;
|
|
@@ -30,6 +59,15 @@ type ObjectBindingsController = {
|
|
|
30
59
|
setTransform: (target: ObjectBindingTarget, transform: ObjectBindingTransform) => void;
|
|
31
60
|
resetTransform: (target: ObjectBindingTarget) => void;
|
|
32
61
|
updateMetadata: (target: ObjectBindingTarget, metadata: Record<string, unknown>) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Prints an image or text on the target objects and returns the decal's id
|
|
64
|
+
* (the one passed, or a generated one).
|
|
65
|
+
*/
|
|
66
|
+
addDecal: (target: ObjectBindingTarget, decal: Omit<ObjectBindingDecal, "id"> & {
|
|
67
|
+
id?: string;
|
|
68
|
+
}) => string;
|
|
69
|
+
updateDecal: (target: ObjectBindingTarget, decalId: string, patch: Partial<Omit<ObjectBindingDecal, "id">>) => void;
|
|
70
|
+
removeDecal: (target: ObjectBindingTarget, decalId: string) => void;
|
|
33
71
|
selectObjectBindings: (target: ObjectBindingTarget) => ObjectBinding[];
|
|
34
72
|
selectObjectBindingIds: (target: ObjectBindingTarget) => string[];
|
|
35
73
|
hiddenObjects: HiddenObjectsState;
|
|
@@ -78,15 +116,40 @@ type SceneLightsController = {
|
|
|
78
116
|
*/
|
|
79
117
|
declare function useSceneConfig(initialSceneConfig: SceneConfig | (() => SceneConfig)): SceneConfigController;
|
|
80
118
|
|
|
119
|
+
type ViewerIsolationProps = {
|
|
120
|
+
/** The current isolation, or `null` when every object shows normally. */
|
|
121
|
+
isolation: ViewerIsolation | null;
|
|
122
|
+
/** Focuses on the target's objects, ghosting (or hiding) the rest. */
|
|
123
|
+
isolate: (target: ObjectBindingTarget, options?: Omit<ViewerIsolation, "target">) => void;
|
|
124
|
+
clearIsolation: () => void;
|
|
125
|
+
/** Pass to `ModelViewer`'s `onIsolationChange`. */
|
|
126
|
+
handleIsolationChange: (isolation: ViewerIsolation | null) => void;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* State for `ModelViewer`'s `isolation` prop:
|
|
130
|
+
*
|
|
131
|
+
* ```tsx
|
|
132
|
+
* const isolation = useViewerIsolation();
|
|
133
|
+
* <ModelViewer
|
|
134
|
+
* isolation={isolation.isolation}
|
|
135
|
+
* onIsolationChange={isolation.handleIsolationChange}
|
|
136
|
+
* />;
|
|
137
|
+
* isolation.isolate({ group: "engine" });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
declare function useViewerIsolation(initialIsolation?: ViewerIsolation | null): ViewerIsolationProps;
|
|
141
|
+
|
|
81
142
|
type ViewerActionBindingsController = Pick<ObjectBindingsController, "objectBindings" | "updateObjectBindings" | "showObject" | "hideObject" | "toggleObjectVisibility">;
|
|
82
143
|
type ViewerActionSceneController = Pick<SceneConfigController, "updateSceneConfig">;
|
|
83
144
|
type ViewerActionCameraController = Pick<ViewerCameraProps, "focusObject" | "fitScene" | "resetView" | "setCameraTarget" | "setCameraState">;
|
|
84
145
|
type ViewerActionAnimationController = Pick<ViewerAnimationsProps, "play" | "pause" | "stop" | "setSpeed" | "seek">;
|
|
146
|
+
type ViewerActionIsolationController = Pick<ViewerIsolationProps, "handleIsolationChange">;
|
|
85
147
|
type ViewerActionsOptions = {
|
|
86
148
|
bindings: ViewerActionBindingsController;
|
|
87
149
|
scene?: ViewerActionSceneController;
|
|
88
150
|
camera?: ViewerActionCameraController;
|
|
89
151
|
animations?: ViewerActionAnimationController;
|
|
152
|
+
isolation?: ViewerActionIsolationController;
|
|
90
153
|
onAction?: (event: ObjectActionEvent) => void | Promise<void>;
|
|
91
154
|
};
|
|
92
155
|
type ViewerActionsProps = {
|
|
@@ -98,7 +161,7 @@ type ViewerActionsProps = {
|
|
|
98
161
|
* Resolves object actions and executes their declarative binding, scene,
|
|
99
162
|
* visibility, camera, and animation effects in declaration order.
|
|
100
163
|
*/
|
|
101
|
-
declare function useViewerActions({ bindings, scene, camera, animations, onAction, }: ViewerActionsOptions): ViewerActionsProps;
|
|
164
|
+
declare function useViewerActions({ bindings, scene, camera, animations, isolation, onAction, }: ViewerActionsOptions): ViewerActionsProps;
|
|
102
165
|
|
|
103
166
|
type ViewerReadyHandler = (viewer: ViewerReadyState) => void;
|
|
104
167
|
type ViewerReadyConsumer = ViewerReadyHandler | {
|
|
@@ -111,6 +174,8 @@ type ViewerConnectionController = {
|
|
|
111
174
|
getViewer: () => ViewerReadyState | null;
|
|
112
175
|
/** Captures the connected viewer, or rejects when it is not ready yet. */
|
|
113
176
|
captureImage: (options?: CaptureImageOptions) => Promise<string>;
|
|
177
|
+
/** Records the connected viewer, or rejects when not ready/unsupported. */
|
|
178
|
+
captureVideo: (options?: CaptureVideoOptions) => Promise<Blob>;
|
|
114
179
|
/** Requests a frame from the connected viewer. */
|
|
115
180
|
invalidate: () => boolean;
|
|
116
181
|
};
|
|
@@ -255,6 +320,13 @@ type ViewerModelProps = {
|
|
|
255
320
|
error: unknown;
|
|
256
321
|
bounds: ViewerModelBounds | null;
|
|
257
322
|
objectCount: number;
|
|
323
|
+
/**
|
|
324
|
+
* The model's glTF material variants, by name; empty when it has none. Show
|
|
325
|
+
* them by setting `sceneConfig.model.activeVariants`.
|
|
326
|
+
*/
|
|
327
|
+
materialVariants: string[];
|
|
328
|
+
/** The same variants as option groups, with labels and swatches. */
|
|
329
|
+
materialVariantGroups: MaterialVariantGroup[];
|
|
258
330
|
/**
|
|
259
331
|
* Every bindable object in the model (see `ViewerObjectInfo`). Filled by
|
|
260
332
|
* `handleObjectCatalog`, so pass that to `ModelViewer`'s `onObjectCatalog`.
|
|
@@ -292,7 +364,8 @@ type UseViewerOptions = {
|
|
|
292
364
|
onLoadError?: (error: unknown) => void;
|
|
293
365
|
};
|
|
294
366
|
/** 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">> & {
|
|
367
|
+
type UseViewerProps = Required<Pick<ModelViewerProps, "onObjectBindingsChange" | "selectedObject" | "onObjectSelect" | "onObjectHover" | "onCameraChange" | "onViewerReady" | "onModelLoaded" | "onLoadError" | "onObjectCatalog" | "onAnimationsReady" | "onAction" | "onIsolationChange">> & {
|
|
368
|
+
isolation: ModelViewerProps["isolation"];
|
|
296
369
|
objectBindings: Record<string, ObjectBinding>;
|
|
297
370
|
sceneConfig?: SceneConfig;
|
|
298
371
|
onSceneConfigChange: (config: SceneConfig) => void;
|
|
@@ -308,8 +381,10 @@ type UseViewerResult = {
|
|
|
308
381
|
animations: ViewerAnimationsProps;
|
|
309
382
|
actions: ViewerActionsProps;
|
|
310
383
|
scene: SceneConfigController;
|
|
384
|
+
/** Focus on some objects, ghosting or hiding the rest. */
|
|
385
|
+
isolation: ViewerIsolationProps;
|
|
311
386
|
effects: ViewerEffectsController;
|
|
312
|
-
/** The live viewer, image capture and redraw requests. */
|
|
387
|
+
/** The live viewer, image/video capture and redraw requests. */
|
|
313
388
|
connection: ViewerConnectionController;
|
|
314
389
|
};
|
|
315
390
|
/**
|
|
@@ -350,4 +425,4 @@ type ShareableViewerStateProps = {
|
|
|
350
425
|
};
|
|
351
426
|
declare function useShareableViewerState({ cameraState, setCameraState, objectBindings, onObjectBindingsChange, selectedObjectBinding, setSelectedObjectBinding, paramKey, debounceMs, autoSync, }: UseShareableViewerStateOptions): ShareableViewerStateProps;
|
|
352
427
|
|
|
353
|
-
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 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 };
|
|
428
|
+
export { BindingEdit, CaptureImageOptions, CaptureVideoOptions, CompareViewer, type CompareViewerProps, type CompareViewerSide, type HiddenObjectsState, MaterialVariantGroup, PublicModelViewer as ModelViewer, ModelViewerProps, ObjectActionEvent, ObjectBinding, ObjectBindingAction, ObjectBindingDecal, 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 UseShareableViewerStateOptions, UseViewerCameraOptions, type UseViewerEffectsOptions, type UseViewerOptions, type UseViewerProps, type UseViewerResult, type ViewerActionAnimationController, type ViewerActionBindingsController, type ViewerActionCameraController, type ViewerActionIsolationController, 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, ViewerIsolation, type ViewerIsolationProps, 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, useViewerIsolation, useViewerModel, useViewerSelection };
|