@liveroom-tech/react-immersive 1.3.5 → 2.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 +103 -59
- package/dist/index.d.mts +49 -8
- package/dist/index.d.ts +49 -8
- package/dist/index.js +576 -331
- package/dist/index.mjs +587 -342
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,10 +26,12 @@ type SceneLightingConfig = {
|
|
|
26
26
|
};
|
|
27
27
|
lights: SceneLight[];
|
|
28
28
|
};
|
|
29
|
+
declare const SCENE_MODEL_RENDERERS: readonly ["pbr", "matcap", "uv-checker"];
|
|
30
|
+
type SceneModelRenderer = (typeof SCENE_MODEL_RENDERERS)[number];
|
|
29
31
|
type SceneModelConfig = {
|
|
30
32
|
rotation: [number, number, number];
|
|
31
33
|
showAdvancedRotation: boolean;
|
|
32
|
-
renderer:
|
|
34
|
+
renderer: SceneModelRenderer;
|
|
33
35
|
shading: "lit" | "unlit" | "normals";
|
|
34
36
|
};
|
|
35
37
|
type SceneCameraConfig = {
|
|
@@ -610,6 +612,7 @@ type ModelViewerProps = {
|
|
|
610
612
|
ktx2TranscoderPath?: string | false;
|
|
611
613
|
meshopt?: boolean;
|
|
612
614
|
showMeasureTools?: boolean;
|
|
615
|
+
showUvCheckerButton?: boolean;
|
|
613
616
|
showExplodeControls?: boolean;
|
|
614
617
|
cinematic?: boolean | CinematicConfig;
|
|
615
618
|
measurementUnit?: string;
|
|
@@ -620,7 +623,7 @@ type ModelViewerProps = {
|
|
|
620
623
|
showAnnotationNavigation?: boolean;
|
|
621
624
|
showAnnotationOnHover?: boolean;
|
|
622
625
|
};
|
|
623
|
-
declare function ModelViewer({ modelUrl, licenseKey, objectBindings, selectedObject, panelHoveredObject, onObjectBindingsChange, onObjectSelect, onObjectHover, onModelLoaded, onLoadError, onAction, onHiddenObjectsChange, onCameraChange, onViewerReady, onTextureUpload, onAnimationsReady, onAnnotationsChange, activeAnnotation: controlledActiveAnnotation, onActiveAnnotationChange, lights, camera, backgroundColor, shadows, showObjectBindingDataPanel, customObjectBindingDataPanel, customSceneObjectsPanel, showSceneObjectsPanel, showDownloadButton, downloadFilename, showResetButton, showLoadingOverlay, showMouseController, mouseControllerPosition, mouseControllerOpacity, moveSensitivity, zoomSensitivity, sceneConfig, disableZoom, zoomOnSelected, highlightOnHover, onAutoFit, refitOnResize, renderMode, maxDpr, performanceProfile, dracoDecoderPath, ktx2TranscoderPath, meshopt, showMeasureTools, showExplodeControls, cinematic, measurementUnit, enableXR, usdzUrl, arScaleMode, mobileHandoffUrl, showAnnotationNavigation, showAnnotationOnHover, }: ModelViewerProps): react_jsx_runtime.JSX.Element;
|
|
626
|
+
declare function ModelViewer({ modelUrl, licenseKey, objectBindings, selectedObject, panelHoveredObject, onObjectBindingsChange, onObjectSelect, onObjectHover, onModelLoaded, onLoadError, onAction, onHiddenObjectsChange, onCameraChange, onViewerReady, onTextureUpload, onAnimationsReady, onAnnotationsChange, activeAnnotation: controlledActiveAnnotation, onActiveAnnotationChange, lights, camera, backgroundColor, shadows, showObjectBindingDataPanel, customObjectBindingDataPanel, customSceneObjectsPanel, showSceneObjectsPanel, showDownloadButton, downloadFilename, showResetButton, showLoadingOverlay, showMouseController, mouseControllerPosition, mouseControllerOpacity, moveSensitivity, zoomSensitivity, sceneConfig, disableZoom, zoomOnSelected, highlightOnHover, onAutoFit, refitOnResize, renderMode, maxDpr, performanceProfile, dracoDecoderPath, ktx2TranscoderPath, meshopt, showMeasureTools, showUvCheckerButton, showExplodeControls, cinematic, measurementUnit, enableXR, usdzUrl, arScaleMode, mobileHandoffUrl, showAnnotationNavigation, showAnnotationOnHover, }: ModelViewerProps): react_jsx_runtime.JSX.Element;
|
|
624
627
|
|
|
625
628
|
declare function BindingBuilder({ licenseKey }: {
|
|
626
629
|
licenseKey: string;
|
|
@@ -661,17 +664,55 @@ declare function useObjectBinding(objectBindings: Record<string, ObjectBinding>,
|
|
|
661
664
|
|
|
662
665
|
declare function useObjectBindingIds(objectBindings: Record<string, ObjectBinding>): string[];
|
|
663
666
|
|
|
667
|
+
type DeepPartial<T> = T extends (infer _U)[] ? T : T extends object ? {
|
|
668
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
669
|
+
} : T;
|
|
670
|
+
type ObjectBindingPatch = DeepPartial<ObjectBinding>;
|
|
671
|
+
type BindingEdit = {
|
|
672
|
+
ids: string | string[];
|
|
673
|
+
patch: ObjectBindingPatch;
|
|
674
|
+
};
|
|
675
|
+
/**
|
|
676
|
+
* Applies field-level patches to object bindings and returns the updated
|
|
677
|
+
* record. Pure — nothing is mutated, and the original reference comes back
|
|
678
|
+
* untouched when no id matched, so React can skip the re-render.
|
|
679
|
+
*
|
|
680
|
+
* Ids resolve the same way everywhere else in the library: binding key first,
|
|
681
|
+
* then `binding.id`, then `binding.modelObjectId`.
|
|
682
|
+
*/
|
|
683
|
+
declare function patchBindings(bindings: Record<string, ObjectBinding>, objectId: string | string[], patch: ObjectBindingPatch): Record<string, ObjectBinding>;
|
|
684
|
+
declare function patchBindings(bindings: Record<string, ObjectBinding>, edits: BindingEdit[]): Record<string, ObjectBinding>;
|
|
685
|
+
/** Shorthand for the common `{ style: { material: … } }` nesting. */
|
|
686
|
+
declare function material(value: ObjectBindingMaterial): ObjectBindingPatch;
|
|
687
|
+
|
|
664
688
|
type HiddenObjectsState = Record<string, boolean>;
|
|
665
|
-
type
|
|
689
|
+
type ObjectBindingsController = {
|
|
690
|
+
objectBindings: Record<string, ObjectBinding>;
|
|
691
|
+
setObjectBindings: React.Dispatch<React.SetStateAction<Record<string, ObjectBinding>>>;
|
|
692
|
+
patch: {
|
|
693
|
+
(objectId: string | string[], patch: ObjectBindingPatch): void;
|
|
694
|
+
(edits: BindingEdit[]): void;
|
|
695
|
+
};
|
|
696
|
+
setMaterial: (objectId: string | string[], material: ObjectBindingMaterial) => void;
|
|
697
|
+
setBaseColor: (objectId: string | string[], color: string) => void;
|
|
698
|
+
resetMaterial: (objectId: string | string[]) => void;
|
|
699
|
+
getMaterial: (objectId: string) => ObjectBindingMaterial | null;
|
|
666
700
|
hiddenObjects: HiddenObjectsState;
|
|
667
701
|
hiddenObjectIds: string[];
|
|
668
|
-
hideObject: (objectId: string) => void;
|
|
669
|
-
showObject: (objectId: string) => void;
|
|
670
|
-
toggleObjectVisibility: (objectId: string) => void;
|
|
702
|
+
hideObject: (objectId: string | string[]) => void;
|
|
703
|
+
showObject: (objectId: string | string[]) => void;
|
|
704
|
+
toggleObjectVisibility: (objectId: string | string[]) => void;
|
|
671
705
|
isObjectHidden: (objectId: string) => boolean;
|
|
672
706
|
clearHiddenObjects: () => void;
|
|
673
707
|
};
|
|
674
|
-
|
|
708
|
+
/**
|
|
709
|
+
* Owns object-binding state and exposes field-level, material, and visibility
|
|
710
|
+
* operations over the same functional state updater.
|
|
711
|
+
*
|
|
712
|
+
* Consecutive calls in the same tick compose instead of overwriting each other,
|
|
713
|
+
* including calls across material and visibility concerns.
|
|
714
|
+
*/
|
|
715
|
+
declare function useObjectBindings(initialBindings: Record<string, ObjectBinding> | (() => Record<string, ObjectBinding>)): ObjectBindingsController;
|
|
675
716
|
|
|
676
717
|
type ViewerHoverProps = {
|
|
677
718
|
hoveredObjectBinding: ObjectBinding | null;
|
|
@@ -725,4 +766,4 @@ type ShareableViewerStateProps = {
|
|
|
725
766
|
};
|
|
726
767
|
declare function useShareableViewerState({ cameraState, setCameraState, objectBindings, onObjectBindingsChange, selectedObjectBinding, setSelectedObjectBinding, paramKey, debounceMs, autoSync, }: UseShareableViewerStateOptions): ShareableViewerStateProps;
|
|
727
768
|
|
|
728
|
-
export { type AnimationClipInfo, type AnimationControls, type AnimationLoopMode, type AnimationPlaybackState, BindingBuilder, type CaptureImageOptions, type CinematicConfig, type CinematicWaypoint, type CustomObjectBindingDataPanelProps, type CustomSceneObjectsPanelProps, type HiddenObjectsState, type HomeCameraState, MATERIAL_BLENDING_MODES, MATERIAL_SIDES, ModelViewer, type ModelViewerProps, type ObjectActionEvent, type ObjectBinding, type ObjectBindingAction, type ObjectBindingMaterial, type ObjectBindingMaterialBlendingMode, type ObjectBindingMaterialSide, type ObjectBindingTextureSlot, type
|
|
769
|
+
export { type AnimationClipInfo, type AnimationControls, type AnimationLoopMode, type AnimationPlaybackState, BindingBuilder, type BindingEdit, type CaptureImageOptions, type CinematicConfig, type CinematicWaypoint, type CustomObjectBindingDataPanelProps, type CustomSceneObjectsPanelProps, type HiddenObjectsState, type HomeCameraState, MATERIAL_BLENDING_MODES, MATERIAL_SIDES, ModelViewer, type ModelViewerProps, type ObjectActionEvent, type ObjectBinding, type ObjectBindingAction, type ObjectBindingMaterial, type ObjectBindingMaterialBlendingMode, type ObjectBindingMaterialSide, type ObjectBindingPatch, type ObjectBindingTextureSlot, type ObjectBindingsController, type SceneAnimationClipConfig, type SceneAnimationConfig, type SceneCinematicConfig, type SceneCinematicWaypoint, type SceneConfig, type SceneModelRenderer, SimpleModelViewer, type SimpleModelViewerProps, type ViewerActionsOptions, type ViewerActionsProps, type ViewerAnimationsProps, type ViewerCameraProps, type ViewerCameraState, type ViewerModelBounds, type ViewerModelProps, type ViewerReadyState, type ViewerSelectionProps, type XRScaleMode, material, patchBindings, useObjectBinding, useObjectBindingIds, useObjectBindings, useShareableViewerState, useViewerActions, useViewerAnimations, useViewerCamera, useViewerHover, useViewerModel, useViewerSelection };
|