@liveroom-tech/react-immersive 5.2.0 → 6.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.
Files changed (52) hide show
  1. package/LICENSE +10 -6
  2. package/README.md +106 -3856
  3. package/dist/binding-builder.css +1 -1
  4. package/dist/binding-builder.d.mts +5 -1
  5. package/dist/binding-builder.d.ts +5 -1
  6. package/dist/binding-builder.js +67 -17
  7. package/dist/binding-builder.mjs +1 -1
  8. package/dist/chunk-2JFUMJUP.mjs +1 -0
  9. package/dist/chunk-4JMJALRO.mjs +2 -0
  10. package/dist/chunk-OTSCPJWF.mjs +1 -0
  11. package/dist/chunk-P2JZ5Z7I.mjs +1 -0
  12. package/dist/chunk-UGPR4EPP.mjs +81 -0
  13. package/dist/chunk-V7WZUWJ5.mjs +1 -0
  14. package/dist/chunk-WWUWEPFK.mjs +3 -0
  15. package/dist/hosted.css +1 -1
  16. package/dist/hosted.d.mts +48 -19
  17. package/dist/hosted.d.ts +48 -19
  18. package/dist/hosted.js +66 -16
  19. package/dist/hosted.mjs +1 -1
  20. package/dist/index.css +1 -1
  21. package/dist/index.d.mts +78 -12
  22. package/dist/index.d.ts +78 -12
  23. package/dist/index.js +65 -15
  24. package/dist/index.mjs +1 -1
  25. package/dist/{materialVariants-DnZe9eMC.d.mts → modelFileResolver-Co7j1tdQ.d.mts} +125 -27
  26. package/dist/{materialVariants-DnZe9eMC.d.ts → modelFileResolver-Co7j1tdQ.d.ts} +125 -27
  27. package/dist/modelViewerProps-BibuMND7.d.ts +1988 -0
  28. package/dist/modelViewerProps-Ce4-wb57.d.mts +1988 -0
  29. package/dist/{publicProps-tJuWZgT3.d.ts → publicProps-BaJHCDa_.d.mts} +7 -0
  30. package/dist/{publicProps-tJuWZgT3.d.mts → publicProps-CP18d_mt.d.ts} +7 -0
  31. package/dist/simple-model-viewer.d.mts +2 -4
  32. package/dist/simple-model-viewer.d.ts +2 -4
  33. package/dist/simple-model-viewer.js +3 -3
  34. package/dist/simple-model-viewer.mjs +1 -1
  35. package/dist/utils.d.mts +62 -4
  36. package/dist/utils.d.ts +62 -4
  37. package/dist/utils.js +2 -1
  38. package/dist/utils.mjs +1 -1
  39. package/package.json +2 -1
  40. package/dist/chunk-4NLJSD3S.mjs +0 -1
  41. package/dist/chunk-B7REIGDG.mjs +0 -1
  42. package/dist/chunk-HYFJ5DYJ.mjs +0 -1
  43. package/dist/chunk-QC3NT76G.mjs +0 -3
  44. package/dist/chunk-SEESCGUS.mjs +0 -1
  45. package/dist/chunk-T3M3BQ7H.mjs +0 -32
  46. package/dist/chunk-ZPK67UG7.mjs +0 -1
  47. package/dist/modelInfo-BYebMPdZ.d.mts +0 -43
  48. package/dist/modelInfo-XfUQO7C_.d.ts +0 -43
  49. package/dist/modelViewerProps-CIZ2R_Fv.d.ts +0 -569
  50. package/dist/modelViewerProps-DoRiTZMn.d.mts +0 -569
  51. package/dist/rendererBackend-QwMzISTn.d.mts +0 -903
  52. package/dist/rendererBackend-QwMzISTn.d.ts +0 -903
package/dist/hosted.d.mts CHANGED
@@ -1,11 +1,9 @@
1
1
  import * as react from 'react';
2
- import { RefObject } from 'react';
3
- import { o as ObjectBinding, a1 as SceneConfig } from './rendererBackend-QwMzISTn.mjs';
4
- import { B as BindingBuilderProps } from './publicProps-tJuWZgT3.mjs';
2
+ import { MutableRefObject } from 'react';
3
+ import { ag as ModelViewerProps, ao as ObjectBinding, aX as SceneConfig, aW as SceneComposition, ad as ModelViewerModelEntry } from './modelViewerProps-Ce4-wb57.mjs';
4
+ import { B as BindingBuilderProps } from './publicProps-BaJHCDa_.mjs';
5
5
  import { Object3D } from 'three';
6
- import { l as ModelViewerProps } from './modelViewerProps-DoRiTZMn.mjs';
7
- import './materialVariants-DnZe9eMC.mjs';
8
- import './modelInfo-BYebMPdZ.mjs';
6
+ import './modelFileResolver-Co7j1tdQ.mjs';
9
7
  import '@react-three/drei';
10
8
 
11
9
  declare const TEXTURE_KEYS: readonly ["texture", "metalnessMap", "roughnessMap", "emissiveMap", "alphaMap", "normalMap", "bumpMap", "aoMap", "displacementMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "anisotropyMap", "transmissionMap", "thicknessMap", "sheenColorMap", "sheenRoughnessMap", "specularIntensityMap", "specularColorMap"];
@@ -23,6 +21,8 @@ type ProjectModelViewerProps = ModelViewerProps & {
23
21
  * service, so this cannot approve a licence by itself.
24
22
  */
25
23
  licenseValidationUrl?: string;
24
+ /** An explicit clear command, distinct from clicking empty canvas space. */
25
+ onSelectionClear?: () => void;
26
26
  /** Reports transform-gizmo edit leases for collaborative hosts. */
27
27
  onObjectEditLeaseChange?: (binding: ObjectBinding, editing: boolean) => void;
28
28
  /** The loaded three.js scene, which the editor builds bindings from. */
@@ -40,11 +40,17 @@ type ProjectModelViewerProps = ModelViewerProps & {
40
40
  * Receives a function that ends Move/Zoom mode the way a plain canvas click
41
41
  * does, for the editor's own "Done positioning" button.
42
42
  */
43
- endTexturePositioningRef?: RefObject<(() => void) | null>;
43
+ endTexturePositioningRef?: MutableRefObject<(() => void) | null>;
44
44
  };
45
45
  declare function ProjectModelViewer(props: ProjectModelViewerProps): react.JSX.Element;
46
46
 
47
- type BindingBuilderProjectModel = {
47
+ /** Settings whose names or positions belong to a particular model. */
48
+ type ModelSettings = Pick<SceneConfig, "annotations" | "animations" | "measurements" | "selectionSets" | "sequences"> & {
49
+ activeVariants?: string[];
50
+ };
51
+
52
+ /** Where a model's files are: what an upload returns. */
53
+ type BindingBuilderModelSource = {
48
54
  url: string;
49
55
  name?: string;
50
56
  assetId?: string | null;
@@ -56,18 +62,33 @@ type BindingBuilderProjectModel = {
56
62
  tilesetUrl?: string | null;
57
63
  assetVersion?: string | null;
58
64
  };
65
+ /** One model of a project. Its `url` identifies it within the project. */
66
+ type BindingBuilderProjectModel = BindingBuilderModelSource & {
67
+ objectBindings: Record<string, ObjectBinding>;
68
+ /** Files whose nodes were spliced into this model. */
69
+ mergeModels?: {
70
+ url: string;
71
+ assetId?: string | null;
72
+ namePrefix: string;
73
+ }[];
74
+ /** The scene settings that belong to this model, such as its annotations. */
75
+ modelSettings?: ModelSettings;
76
+ };
59
77
  type BindingBuilderProject = {
60
78
  id: string;
61
79
  revision: number;
62
- model: BindingBuilderProjectModel;
63
- objectBindings: Record<string, ObjectBinding>;
80
+ /** In display order. A removed model stays, marked deleted in `composition`. */
81
+ models: BindingBuilderProjectModel[];
82
+ /** Each model's placement, keyed by `url:<model url>`. */
83
+ composition: SceneComposition;
84
+ /** The settings all the models share. */
64
85
  sceneConfig: SceneConfig;
65
86
  };
66
87
  type BindingBuilderProjectSnapshot = {
67
88
  projectId: string;
68
89
  baseRevision: number;
69
- model: BindingBuilderProjectModel;
70
- objectBindings: Record<string, ObjectBinding>;
90
+ models: BindingBuilderProjectModel[];
91
+ composition: SceneComposition;
71
92
  sceneConfig: SceneConfig;
72
93
  };
73
94
  type BindingBuilderProjectChangeOrigin = "local" | "remote";
@@ -101,18 +122,26 @@ type ProjectBindingBuilderProps = BindingBuilderProps & {
101
122
  * Lets a hosted editor upload a selected model before it is loaded. Return
102
123
  * the durable model URL/version that should be saved with the project.
103
124
  */
104
- onModelUpload?: (file: File) => Promise<BindingBuilderProject["model"]>;
125
+ onModelUpload?: (file: File) => Promise<BindingBuilderModelSource>;
126
+ /**
127
+ * Saves an image chosen in the editor and returns its durable URL. With a
128
+ * `project`, every image goes through this before it is reported.
129
+ */
105
130
  onTextureUpload?: (file: File, objectId: string) => Promise<string>;
106
131
  /** Requests/releases a short collaborative lease around gizmo edits. */
107
132
  onEditLeaseChange?: (featureId: string, editing: boolean) => void;
108
133
  /**
109
- * Whether the model itself may be replaced or removed. False hides the
110
- * Remove model and Upload controls and ignores picked or dropped files;
111
- * bindings and scene settings stay editable. Defaults to true. Remove model
112
- * never appears with a `project`, which always has a model.
134
+ * Whether models may be replaced, added or removed. False hides those
135
+ * controls and ignores picked or dropped files; bindings and scene settings
136
+ * stay editable. Defaults to true.
113
137
  */
114
138
  allowModelChange?: boolean;
115
139
  };
116
- declare function ProjectBindingBuilder({ licenseKey, licenseValidationUrl, dracoDecoderPath, ktx2TranscoderPath, meshopt, project, onProjectChange, projectChangeDebounceMs, onModelUpload, onTextureUpload, onEditLeaseChange, allowModelChange, }: ProjectBindingBuilderProps): react.JSX.Element;
140
+ declare function ProjectBindingBuilder({ licenseKey, licenseValidationUrl, arHandoff, mobileHandoffUrl, dracoDecoderPath, ktx2TranscoderPath, meshopt, project, onProjectChange, projectChangeDebounceMs, onModelUpload, onTextureUpload, onEditLeaseChange, allowModelChange, hideLicenseCheckingOverlay, }: ProjectBindingBuilderProps): react.JSX.Element;
141
+
142
+ /** A model's view of the scene: the shared settings plus its own. */
143
+ declare function sceneConfigForModel(sceneConfig: SceneConfig, model: BindingBuilderProjectModel): SceneConfig;
144
+ /** The models to hand ModelViewer, or undefined for a project of one. */
145
+ declare function viewerModelsFromProject(project: Pick<BindingBuilderProject, "models" | "composition" | "sceneConfig">): ModelViewerModelEntry[] | undefined;
117
146
 
118
- export { type BindingBuilderProject, type BindingBuilderProjectChangeOrigin, type BindingBuilderProjectModel, type BindingBuilderProjectSnapshot, ProjectBindingBuilder, type ProjectBindingBuilderProps, ProjectModelViewer, type ProjectModelViewerProps };
147
+ export { type BindingBuilderModelSource, type BindingBuilderProject, type BindingBuilderProjectChangeOrigin, type BindingBuilderProjectModel, type BindingBuilderProjectSnapshot, ProjectBindingBuilder, type ProjectBindingBuilderProps, ProjectModelViewer, type ProjectModelViewerProps, sceneConfigForModel, viewerModelsFromProject };
package/dist/hosted.d.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  import * as react from 'react';
2
- import { RefObject } from 'react';
3
- import { o as ObjectBinding, a1 as SceneConfig } from './rendererBackend-QwMzISTn.js';
4
- import { B as BindingBuilderProps } from './publicProps-tJuWZgT3.js';
2
+ import { MutableRefObject } from 'react';
3
+ import { ag as ModelViewerProps, ao as ObjectBinding, aX as SceneConfig, aW as SceneComposition, ad as ModelViewerModelEntry } from './modelViewerProps-BibuMND7.js';
4
+ import { B as BindingBuilderProps } from './publicProps-CP18d_mt.js';
5
5
  import { Object3D } from 'three';
6
- import { l as ModelViewerProps } from './modelViewerProps-CIZ2R_Fv.js';
7
- import './materialVariants-DnZe9eMC.js';
8
- import './modelInfo-XfUQO7C_.js';
6
+ import './modelFileResolver-Co7j1tdQ.js';
9
7
  import '@react-three/drei';
10
8
 
11
9
  declare const TEXTURE_KEYS: readonly ["texture", "metalnessMap", "roughnessMap", "emissiveMap", "alphaMap", "normalMap", "bumpMap", "aoMap", "displacementMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "anisotropyMap", "transmissionMap", "thicknessMap", "sheenColorMap", "sheenRoughnessMap", "specularIntensityMap", "specularColorMap"];
@@ -23,6 +21,8 @@ type ProjectModelViewerProps = ModelViewerProps & {
23
21
  * service, so this cannot approve a licence by itself.
24
22
  */
25
23
  licenseValidationUrl?: string;
24
+ /** An explicit clear command, distinct from clicking empty canvas space. */
25
+ onSelectionClear?: () => void;
26
26
  /** Reports transform-gizmo edit leases for collaborative hosts. */
27
27
  onObjectEditLeaseChange?: (binding: ObjectBinding, editing: boolean) => void;
28
28
  /** The loaded three.js scene, which the editor builds bindings from. */
@@ -40,11 +40,17 @@ type ProjectModelViewerProps = ModelViewerProps & {
40
40
  * Receives a function that ends Move/Zoom mode the way a plain canvas click
41
41
  * does, for the editor's own "Done positioning" button.
42
42
  */
43
- endTexturePositioningRef?: RefObject<(() => void) | null>;
43
+ endTexturePositioningRef?: MutableRefObject<(() => void) | null>;
44
44
  };
45
45
  declare function ProjectModelViewer(props: ProjectModelViewerProps): react.JSX.Element;
46
46
 
47
- type BindingBuilderProjectModel = {
47
+ /** Settings whose names or positions belong to a particular model. */
48
+ type ModelSettings = Pick<SceneConfig, "annotations" | "animations" | "measurements" | "selectionSets" | "sequences"> & {
49
+ activeVariants?: string[];
50
+ };
51
+
52
+ /** Where a model's files are: what an upload returns. */
53
+ type BindingBuilderModelSource = {
48
54
  url: string;
49
55
  name?: string;
50
56
  assetId?: string | null;
@@ -56,18 +62,33 @@ type BindingBuilderProjectModel = {
56
62
  tilesetUrl?: string | null;
57
63
  assetVersion?: string | null;
58
64
  };
65
+ /** One model of a project. Its `url` identifies it within the project. */
66
+ type BindingBuilderProjectModel = BindingBuilderModelSource & {
67
+ objectBindings: Record<string, ObjectBinding>;
68
+ /** Files whose nodes were spliced into this model. */
69
+ mergeModels?: {
70
+ url: string;
71
+ assetId?: string | null;
72
+ namePrefix: string;
73
+ }[];
74
+ /** The scene settings that belong to this model, such as its annotations. */
75
+ modelSettings?: ModelSettings;
76
+ };
59
77
  type BindingBuilderProject = {
60
78
  id: string;
61
79
  revision: number;
62
- model: BindingBuilderProjectModel;
63
- objectBindings: Record<string, ObjectBinding>;
80
+ /** In display order. A removed model stays, marked deleted in `composition`. */
81
+ models: BindingBuilderProjectModel[];
82
+ /** Each model's placement, keyed by `url:<model url>`. */
83
+ composition: SceneComposition;
84
+ /** The settings all the models share. */
64
85
  sceneConfig: SceneConfig;
65
86
  };
66
87
  type BindingBuilderProjectSnapshot = {
67
88
  projectId: string;
68
89
  baseRevision: number;
69
- model: BindingBuilderProjectModel;
70
- objectBindings: Record<string, ObjectBinding>;
90
+ models: BindingBuilderProjectModel[];
91
+ composition: SceneComposition;
71
92
  sceneConfig: SceneConfig;
72
93
  };
73
94
  type BindingBuilderProjectChangeOrigin = "local" | "remote";
@@ -101,18 +122,26 @@ type ProjectBindingBuilderProps = BindingBuilderProps & {
101
122
  * Lets a hosted editor upload a selected model before it is loaded. Return
102
123
  * the durable model URL/version that should be saved with the project.
103
124
  */
104
- onModelUpload?: (file: File) => Promise<BindingBuilderProject["model"]>;
125
+ onModelUpload?: (file: File) => Promise<BindingBuilderModelSource>;
126
+ /**
127
+ * Saves an image chosen in the editor and returns its durable URL. With a
128
+ * `project`, every image goes through this before it is reported.
129
+ */
105
130
  onTextureUpload?: (file: File, objectId: string) => Promise<string>;
106
131
  /** Requests/releases a short collaborative lease around gizmo edits. */
107
132
  onEditLeaseChange?: (featureId: string, editing: boolean) => void;
108
133
  /**
109
- * Whether the model itself may be replaced or removed. False hides the
110
- * Remove model and Upload controls and ignores picked or dropped files;
111
- * bindings and scene settings stay editable. Defaults to true. Remove model
112
- * never appears with a `project`, which always has a model.
134
+ * Whether models may be replaced, added or removed. False hides those
135
+ * controls and ignores picked or dropped files; bindings and scene settings
136
+ * stay editable. Defaults to true.
113
137
  */
114
138
  allowModelChange?: boolean;
115
139
  };
116
- declare function ProjectBindingBuilder({ licenseKey, licenseValidationUrl, dracoDecoderPath, ktx2TranscoderPath, meshopt, project, onProjectChange, projectChangeDebounceMs, onModelUpload, onTextureUpload, onEditLeaseChange, allowModelChange, }: ProjectBindingBuilderProps): react.JSX.Element;
140
+ declare function ProjectBindingBuilder({ licenseKey, licenseValidationUrl, arHandoff, mobileHandoffUrl, dracoDecoderPath, ktx2TranscoderPath, meshopt, project, onProjectChange, projectChangeDebounceMs, onModelUpload, onTextureUpload, onEditLeaseChange, allowModelChange, hideLicenseCheckingOverlay, }: ProjectBindingBuilderProps): react.JSX.Element;
141
+
142
+ /** A model's view of the scene: the shared settings plus its own. */
143
+ declare function sceneConfigForModel(sceneConfig: SceneConfig, model: BindingBuilderProjectModel): SceneConfig;
144
+ /** The models to hand ModelViewer, or undefined for a project of one. */
145
+ declare function viewerModelsFromProject(project: Pick<BindingBuilderProject, "models" | "composition" | "sceneConfig">): ModelViewerModelEntry[] | undefined;
117
146
 
118
- export { type BindingBuilderProject, type BindingBuilderProjectChangeOrigin, type BindingBuilderProjectModel, type BindingBuilderProjectSnapshot, ProjectBindingBuilder, type ProjectBindingBuilderProps, ProjectModelViewer, type ProjectModelViewerProps };
147
+ export { type BindingBuilderModelSource, type BindingBuilderProject, type BindingBuilderProjectChangeOrigin, type BindingBuilderProjectModel, type BindingBuilderProjectSnapshot, ProjectBindingBuilder, type ProjectBindingBuilderProps, ProjectModelViewer, type ProjectModelViewerProps, sceneConfigForModel, viewerModelsFromProject };