@webspatial/core-sdk 1.0.3 → 1.0.5
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/CHANGELOG.md +4 -0
- package/README.md +112 -81
- package/dist/iife/index.d.ts +683 -561
- package/dist/iife/index.global.js +3 -4
- package/dist/iife/index.global.js.map +1 -1
- package/dist/index.d.ts +683 -561
- package/dist/index.js +2175 -1291
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/src/JSBCommand.ts +631 -0
- package/src/Spatial.ts +68 -0
- package/src/SpatialObject.ts +46 -0
- package/src/SpatialScene.ts +75 -0
- package/src/SpatialSession.ts +187 -0
- package/src/SpatialWebEvent.ts +23 -0
- package/src/SpatialWebEventCreator.ts +12 -0
- package/src/Spatialized2DElement.ts +51 -0
- package/src/SpatializedDynamic3DElement.ts +30 -0
- package/src/SpatializedElement.ts +331 -0
- package/src/SpatializedElementCreator.ts +45 -0
- package/src/SpatializedStatic3DElement.ts +111 -0
- package/src/WebMsgCommand.ts +88 -0
- package/src/index.ts +23 -1
- package/src/platform-adapter/CommandResultUtils.ts +22 -0
- package/src/platform-adapter/android/AndroidPlatform.ts +133 -0
- package/src/platform-adapter/index.ts +21 -0
- package/src/platform-adapter/interface.ts +36 -0
- package/src/platform-adapter/ssr/SSRPlatform.ts +43 -0
- package/src/platform-adapter/vision-os/VisionOSPlatform.ts +77 -0
- package/src/reality/component/ModelComponent.ts +11 -0
- package/src/reality/component/SpatialComponent.ts +17 -0
- package/src/reality/component/index.ts +2 -0
- package/src/reality/entity/SpatialEntity.ts +255 -0
- package/src/reality/entity/SpatialModelEntity.ts +15 -0
- package/src/reality/entity/index.ts +2 -0
- package/src/reality/geometry/SpatialBoxGeometry.ts +12 -0
- package/src/reality/geometry/SpatialConeGeometry.ts +15 -0
- package/src/reality/geometry/SpatialCylinderGeometry.ts +15 -0
- package/src/reality/geometry/SpatialGeometry.ts +12 -0
- package/src/reality/geometry/SpatialPlaneGeometry.ts +15 -0
- package/src/reality/geometry/SpatialSphereGeometry.ts +15 -0
- package/src/reality/geometry/index.ts +6 -0
- package/src/reality/index.ts +5 -0
- package/src/reality/material/SpatialMaterial.ts +14 -0
- package/src/reality/material/SpatialUnlitMaterial.ts +16 -0
- package/src/reality/material/index.ts +2 -0
- package/src/reality/realityCreator.ts +94 -0
- package/src/reality/resource/SpatialModelAsset.ts +11 -0
- package/src/reality/resource/index.ts +1 -0
- package/src/scene-polyfill.test.ts +376 -0
- package/src/scene-polyfill.ts +359 -0
- package/src/spatial-window-polyfill.ts +182 -0
- package/src/ssr-polyfill.ts +3 -0
- package/src/types/global.d.ts +33 -1
- package/src/types/internal.ts +13 -0
- package/src/types/types.ts +380 -0
- package/src/utils.ts +61 -0
- package/tsconfig.json +1 -1
- package/vitest.config.ts +8 -0
- package/src/core/Spatial.ts +0 -50
- package/src/core/SpatialEntity.ts +0 -147
- package/src/core/SpatialHelper.ts +0 -230
- package/src/core/SpatialObject.ts +0 -26
- package/src/core/SpatialSession.ts +0 -457
- package/src/core/SpatialTransform.ts +0 -26
- package/src/core/SpatialWindowContainer.ts +0 -59
- package/src/core/component/EventSpatialComponent.ts +0 -32
- package/src/core/component/SpatialComponent.ts +0 -26
- package/src/core/component/SpatialInputComponent.ts +0 -24
- package/src/core/component/SpatialModel3DComponent.ts +0 -223
- package/src/core/component/SpatialModelComponent.ts +0 -39
- package/src/core/component/SpatialViewComponent.ts +0 -32
- package/src/core/component/SpatialWindowComponent.ts +0 -177
- package/src/core/component/index.ts +0 -14
- package/src/core/index.ts +0 -10
- package/src/core/private/WebSpatial.ts +0 -383
- package/src/core/private/remote-command/RemoteCommand.ts +0 -15
- package/src/core/private/remote-command/index.ts +0 -1
- package/src/core/resource/SpatialMeshResource.ts +0 -6
- package/src/core/resource/SpatialPhysicallyBasedMaterialResource.ts +0 -42
- package/src/core/resource/index.ts +0 -2
- package/src/core/types.ts +0 -32
package/dist/iife/index.d.ts
CHANGED
|
@@ -1,225 +1,216 @@
|
|
|
1
|
-
type WindowStyle = 'Plain' | 'Volumetric';
|
|
2
|
-
interface WindowContainerOptions {
|
|
3
|
-
defaultSize?: {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
};
|
|
7
|
-
resizability?: {
|
|
8
|
-
minWidth?: number;
|
|
9
|
-
minHeight?: number;
|
|
10
|
-
maxWidth?: number;
|
|
11
|
-
maxHeight?: number;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
type LoadingMethodKind = 'show' | 'hide';
|
|
15
|
-
interface sceneDataShape {
|
|
16
|
-
method?: 'createRoot' | 'showRoot';
|
|
17
|
-
sceneConfig?: WindowContainerOptions;
|
|
18
|
-
url?: string;
|
|
19
|
-
window: Window;
|
|
20
|
-
}
|
|
21
|
-
interface sceneDataJSBShape {
|
|
22
|
-
method?: 'createRoot' | 'showRoot';
|
|
23
|
-
sceneConfig?: WindowContainerOptions;
|
|
24
|
-
url?: string;
|
|
25
|
-
windowID?: string;
|
|
26
|
-
windowContainerID?: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare global {
|
|
30
|
-
interface Window {
|
|
31
|
-
__WebSpatialData: {
|
|
32
|
-
androidNativeMessage: Function;
|
|
33
|
-
getNativeVersion: Function;
|
|
34
|
-
};
|
|
35
|
-
__SpatialWebEvent: Function;
|
|
36
|
-
webkit: any;
|
|
37
|
-
__WebSpatialUnloaded: boolean;
|
|
38
|
-
_webSpatialID: string;
|
|
39
|
-
_webSpatialGroupID: string;
|
|
40
|
-
_webSpatialParentGroupID: string;
|
|
41
|
-
WebSpatailNativeVersion: string;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
declare class WindowContainer {
|
|
45
|
-
id: string;
|
|
46
|
-
}
|
|
47
|
-
declare class WebSpatialResource {
|
|
48
|
-
id: string;
|
|
49
|
-
windowContainerId: string;
|
|
50
|
-
data: any;
|
|
51
|
-
receiveEvent(): void;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
1
|
/**
|
|
55
2
|
* @hidden
|
|
56
3
|
* Parent class of spatial objects, should not be used directly
|
|
57
4
|
*/
|
|
58
5
|
declare class SpatialObject {
|
|
59
6
|
/** @hidden */
|
|
60
|
-
|
|
7
|
+
readonly id: string;
|
|
61
8
|
/** @hidden */
|
|
62
9
|
constructor(
|
|
63
10
|
/** @hidden */
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
destroy(): Promise<
|
|
69
|
-
|
|
70
|
-
protected onDestroy(): Promise<void>;
|
|
11
|
+
id: string);
|
|
12
|
+
name?: string;
|
|
13
|
+
isDestroyed: boolean;
|
|
14
|
+
inspect(): Promise<any>;
|
|
15
|
+
destroy(): Promise<any>;
|
|
16
|
+
protected onDestroy(): void;
|
|
71
17
|
}
|
|
72
18
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
19
|
+
interface CommandResult {
|
|
20
|
+
success: boolean;
|
|
21
|
+
data: any;
|
|
22
|
+
errorCode: string | undefined;
|
|
23
|
+
errorMessage: string | undefined;
|
|
78
24
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
25
|
+
interface WebSpatialProtocolResult extends CommandResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
data: {
|
|
28
|
+
windowProxy: WindowProxy;
|
|
29
|
+
id: string;
|
|
30
|
+
} | undefined;
|
|
31
|
+
errorCode: string | undefined;
|
|
32
|
+
errorMessage: string | undefined;
|
|
85
33
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
orientation: Vec4;
|
|
93
|
-
scale: Vec3;
|
|
34
|
+
|
|
35
|
+
declare class SpatialGeometry extends SpatialObject {
|
|
36
|
+
id: string;
|
|
37
|
+
options: SpatialGeometryOptions;
|
|
38
|
+
static type: SpatialGeometryType;
|
|
39
|
+
constructor(id: string, options: SpatialGeometryOptions);
|
|
94
40
|
}
|
|
95
41
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
42
|
+
declare abstract class SpatialMaterial extends SpatialObject {
|
|
43
|
+
id: string;
|
|
44
|
+
type: SpatialMaterialType;
|
|
45
|
+
constructor(id: string, type: SpatialMaterialType);
|
|
46
|
+
abstract updateProperties(properties: any): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare enum SpatialWebMsgType {
|
|
50
|
+
cubeInfo = "cubeInfo",
|
|
51
|
+
transform = "transform",
|
|
52
|
+
modelloaded = "modelloaded",
|
|
53
|
+
modelloadfailed = "modelloadfailed",
|
|
54
|
+
spatialtap = "spatialtap",
|
|
55
|
+
spatialdragstart = "spatialdragstart",
|
|
56
|
+
spatialdrag = "spatialdrag",
|
|
57
|
+
spatialdragend = "spatialdragend",
|
|
58
|
+
spatialrotatestart = "spatialrotatestart",
|
|
59
|
+
spatialrotate = "spatialrotate",
|
|
60
|
+
spatialrotateend = "spatialrotateend",
|
|
61
|
+
spatialmagnifystart = "spatialmagnifystart",
|
|
62
|
+
spatialmagnify = "spatialmagnify",
|
|
63
|
+
spatialmagnifyend = "spatialmagnifyend",
|
|
64
|
+
objectdestroy = "objectdestroy"
|
|
65
|
+
}
|
|
66
|
+
interface ObjectDestroyMsg {
|
|
67
|
+
type: SpatialWebMsgType.objectdestroy;
|
|
68
|
+
}
|
|
69
|
+
interface CubeInfoMsg {
|
|
70
|
+
type: SpatialWebMsgType.cubeInfo;
|
|
71
|
+
origin: Vec3;
|
|
72
|
+
size: Size3D;
|
|
73
|
+
}
|
|
74
|
+
interface CubeInfoMsg {
|
|
75
|
+
type: SpatialWebMsgType.cubeInfo;
|
|
76
|
+
origin: Vec3;
|
|
77
|
+
size: Size3D;
|
|
78
|
+
}
|
|
79
|
+
interface TransformMsg {
|
|
80
|
+
type: SpatialWebMsgType.transform;
|
|
81
|
+
detail: {
|
|
82
|
+
column0: [number, number, number];
|
|
83
|
+
column1: [number, number, number];
|
|
84
|
+
column2: [number, number, number];
|
|
85
|
+
column3: [number, number, number];
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
interface SpatialTapMsg {
|
|
89
|
+
type: SpatialWebMsgType.spatialtap;
|
|
90
|
+
detail: SpatialTapEventDetail;
|
|
91
|
+
}
|
|
92
|
+
interface SpatialDragMsg {
|
|
93
|
+
type: SpatialWebMsgType.spatialdrag;
|
|
94
|
+
detail: SpatialDragEventDetail;
|
|
95
|
+
}
|
|
96
|
+
interface SpatialDragEndMsg {
|
|
97
|
+
type: SpatialWebMsgType.spatialdragend;
|
|
98
|
+
detail: SpatialDragEventDetail;
|
|
99
|
+
}
|
|
100
|
+
interface SpatialRotateMsg {
|
|
101
|
+
type: SpatialWebMsgType.spatialrotate;
|
|
102
|
+
detail: SpatialRotateEventDetail;
|
|
103
|
+
}
|
|
104
|
+
interface SpatialRotateEndMsg {
|
|
105
|
+
type: SpatialWebMsgType.spatialrotateend;
|
|
106
|
+
detail: SpatialRotateEventDetail;
|
|
124
107
|
}
|
|
125
108
|
|
|
126
109
|
/**
|
|
127
|
-
*
|
|
110
|
+
* Abstract base class for all spatialized elements in the WebSpatial environment.
|
|
111
|
+
* Provides common functionality for elements that can exist in 3D space,
|
|
112
|
+
* including transformation handling and gesture event processing.
|
|
128
113
|
*/
|
|
129
|
-
declare class
|
|
114
|
+
declare abstract class SpatializedElement extends SpatialObject {
|
|
115
|
+
readonly id: string;
|
|
130
116
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
117
|
+
* Creates a new spatialized element with the specified ID.
|
|
118
|
+
* Registers the element to receive spatial events.
|
|
119
|
+
* @param id Unique identifier for this element
|
|
133
120
|
*/
|
|
134
|
-
|
|
135
|
-
/** @hidden */
|
|
136
|
-
private _destroyed;
|
|
137
|
-
/** @hidden */
|
|
138
|
-
private get _entity();
|
|
121
|
+
constructor(id: string);
|
|
139
122
|
/**
|
|
140
|
-
*
|
|
123
|
+
* Updates the properties of this spatialized element.
|
|
124
|
+
* Must be implemented by derived classes to handle specific property updates.
|
|
125
|
+
* @param properties Partial set of properties to update
|
|
126
|
+
* @returns Promise resolving to the result of the update operation
|
|
141
127
|
*/
|
|
142
|
-
|
|
128
|
+
abstract updateProperties(properties: Partial<SpatializedElementProperties>): Promise<WebSpatialProtocolResult>;
|
|
143
129
|
/**
|
|
144
|
-
*
|
|
130
|
+
* Updates the transformation matrix of this element in 3D space.
|
|
131
|
+
* This affects the position, rotation, and scale of the element.
|
|
132
|
+
* @param matrix The new transformation matrix
|
|
133
|
+
* @returns Promise resolving when the transform is updated
|
|
145
134
|
*/
|
|
146
|
-
|
|
147
|
-
private components;
|
|
135
|
+
updateTransform(matrix: DOMMatrix): Promise<CommandResult>;
|
|
148
136
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
137
|
+
* Information about the element's bounding cube.
|
|
138
|
+
* Used for spatial calculations and hit testing.
|
|
151
139
|
*/
|
|
152
|
-
|
|
140
|
+
private _cubeInfo?;
|
|
153
141
|
/**
|
|
154
|
-
*
|
|
142
|
+
* Gets the current cube information for this element.
|
|
143
|
+
* @returns The current CubeInfo or undefined if not set
|
|
155
144
|
*/
|
|
156
|
-
|
|
145
|
+
get cubeInfo(): CubeInfo$1 | undefined;
|
|
157
146
|
/**
|
|
158
|
-
*
|
|
147
|
+
* The current transformation matrix of this element.
|
|
159
148
|
*/
|
|
160
|
-
|
|
149
|
+
private _transform?;
|
|
161
150
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* @param wg the window container that should render this entity
|
|
151
|
+
* The inverse of the current transformation matrix.
|
|
152
|
+
* Used for converting world coordinates to local coordinates.
|
|
165
153
|
*/
|
|
166
|
-
|
|
154
|
+
private _transformInv?;
|
|
167
155
|
/**
|
|
168
|
-
*
|
|
169
|
-
* @
|
|
156
|
+
* Gets the current transformation matrix.
|
|
157
|
+
* @returns The current transformation matrix or undefined if not set
|
|
170
158
|
*/
|
|
171
|
-
|
|
159
|
+
get transform(): DOMMatrix | undefined;
|
|
172
160
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* "Dom" = Windowing coordinates in dom units (eg. 0,0,0 is top left of window)
|
|
176
|
-
* "Root" = Coordinate space is ignored and content is displayed and updated as window container's root object, window containers can only have one root entity
|
|
177
|
-
* [TODO] review this api
|
|
178
|
-
* @param space coordinate space mode
|
|
161
|
+
* Gets the inverse of the current transformation matrix.
|
|
162
|
+
* @returns The inverse transformation matrix or undefined if not set
|
|
179
163
|
*/
|
|
180
|
-
|
|
164
|
+
get transformInv(): DOMMatrix | undefined;
|
|
181
165
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
166
|
+
* Processes events received from the WebSpatial environment.
|
|
167
|
+
* Handles various spatial events like transforms, gestures, and interactions.
|
|
168
|
+
* @param data The event data received from the WebSpatial system
|
|
184
169
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
170
|
+
protected onReceiveEvent(data: CubeInfoMsg | TransformMsg | SpatialTapMsg | SpatialDragMsg | SpatialDragEndMsg | SpatialRotateMsg | SpatialRotateEndMsg | ObjectDestroyMsg): void;
|
|
171
|
+
private _onSpatialTap?;
|
|
172
|
+
set onSpatialTap(value: (event: SpatialTapEvent) => void | undefined);
|
|
173
|
+
private _isDragging;
|
|
174
|
+
private _onSpatialDragStart?;
|
|
175
|
+
set onSpatialDragStart(value: (event: SpatialDragEvent) => void | undefined);
|
|
176
|
+
private _onSpatialDrag?;
|
|
177
|
+
set onSpatialDrag(value: (event: SpatialDragEvent) => void | undefined);
|
|
178
|
+
private _onSpatialDragEnd?;
|
|
179
|
+
set onSpatialDragEnd(value: ((event: SpatialDragEndEvent) => void) | undefined);
|
|
180
|
+
private _isRotating;
|
|
181
|
+
private _onSpatialRotateStart?;
|
|
182
|
+
set onSpatialRotateStart(value: ((event: SpatialRotateEvent) => void) | undefined);
|
|
183
|
+
private _onSpatialRotate?;
|
|
184
|
+
set onSpatialRotate(value: ((event: SpatialRotateEvent) => void) | undefined);
|
|
185
|
+
private _onSpatialRotateEnd?;
|
|
186
|
+
set onSpatialRotateEnd(value: ((event: SpatialRotateEndEvent) => void) | undefined);
|
|
187
|
+
private _isMagnify;
|
|
188
|
+
private _onSpatialMagnifyStart?;
|
|
189
|
+
set onSpatialMagnifyStart(value: ((event: SpatialMagnifyEvent) => void) | undefined);
|
|
190
|
+
private _onSpatialMagnify?;
|
|
191
|
+
set onSpatialMagnify(value: ((event: SpatialMagnifyEvent) => void) | undefined);
|
|
192
|
+
private _onSpatialMagnifyEnd?;
|
|
193
|
+
set onSpatialMagnifyEnd(value: ((event: SpatialMagnifyEndEvent) => void) | undefined);
|
|
197
194
|
/**
|
|
198
|
-
*
|
|
199
|
-
*
|
|
195
|
+
* Cleans up resources when this element is destroyed.
|
|
196
|
+
* Removes event receivers to prevent memory leaks.
|
|
200
197
|
*/
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Removes a reference to the entity by the renderer and this object should no longer be used. [TODO] Attached components will not be destroyed
|
|
204
|
-
*/
|
|
205
|
-
destroy(): Promise<void>;
|
|
206
|
-
/**
|
|
207
|
-
* Check if destroy has been called
|
|
208
|
-
*/
|
|
209
|
-
isDestroyed(): boolean;
|
|
210
|
-
/** @hidden */
|
|
211
|
-
_setName(name: string): Promise<unknown>;
|
|
198
|
+
onDestroy(): void;
|
|
212
199
|
}
|
|
213
200
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*/
|
|
220
|
-
getEntity(): Promise<SpatialEntity | null>;
|
|
201
|
+
declare class SpatializedDynamic3DElement extends SpatializedElement {
|
|
202
|
+
children: SpatialEntityOrReality[];
|
|
203
|
+
constructor(id: string);
|
|
204
|
+
addEntity(entity: SpatialEntity): Promise<CommandResult>;
|
|
205
|
+
updateProperties(properties: Partial<SpatializedElementProperties>): Promise<CommandResult>;
|
|
221
206
|
}
|
|
222
207
|
|
|
208
|
+
interface Vec3 {
|
|
209
|
+
x: number;
|
|
210
|
+
y: number;
|
|
211
|
+
z: number;
|
|
212
|
+
}
|
|
213
|
+
type Point3D = Vec3;
|
|
223
214
|
/**
|
|
224
215
|
* Material type for SpatialDiv or HTML document.
|
|
225
216
|
*
|
|
@@ -241,500 +232,631 @@ type CornerRadius = {
|
|
|
241
232
|
topTrailing: number;
|
|
242
233
|
bottomTrailing: number;
|
|
243
234
|
};
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
235
|
+
interface SpatialSceneProperties {
|
|
236
|
+
cornerRadius: CornerRadius;
|
|
237
|
+
material: BackgroundMaterialType;
|
|
238
|
+
opacity: number;
|
|
239
|
+
}
|
|
240
|
+
declare enum SpatializedElementType {
|
|
241
|
+
Spatialized2DElement = 0,
|
|
242
|
+
SpatializedStatic3DElement = 1,
|
|
243
|
+
SpatializedDynamic3DElement = 2
|
|
244
|
+
}
|
|
245
|
+
interface SpatializedElementProperties {
|
|
246
|
+
name: string;
|
|
247
|
+
clientX: number;
|
|
248
|
+
clientY: number;
|
|
249
|
+
width: number;
|
|
250
|
+
height: number;
|
|
251
|
+
depth: number;
|
|
252
|
+
opacity: number;
|
|
253
|
+
visible: boolean;
|
|
254
|
+
scrollWithParent: boolean;
|
|
255
|
+
zIndex: number;
|
|
256
|
+
backOffset: number;
|
|
257
|
+
rotationAnchor: Point3D;
|
|
258
|
+
enableTapGesture: boolean;
|
|
259
|
+
enableDragStartGesture: boolean;
|
|
260
|
+
enableDragGesture: boolean;
|
|
261
|
+
enableDragEndGesture: boolean;
|
|
262
|
+
enableRotateStartGesture: boolean;
|
|
263
|
+
enableRotateGesture: boolean;
|
|
264
|
+
enableRotateEndGesture: boolean;
|
|
265
|
+
enableMagnifyStartGesture: boolean;
|
|
266
|
+
enableMagnifyGesture: boolean;
|
|
267
|
+
enableMagnifyEndGesture: boolean;
|
|
268
|
+
}
|
|
269
|
+
interface Spatialized2DElementProperties extends SpatializedElementProperties {
|
|
270
|
+
scrollPageEnabled: boolean;
|
|
271
|
+
cornerRadius: CornerRadius;
|
|
272
|
+
material: BackgroundMaterialType;
|
|
273
|
+
scrollEdgeInsetsMarginRight: number;
|
|
274
|
+
}
|
|
275
|
+
interface SpatializedStatic3DElementProperties extends SpatializedElementProperties {
|
|
276
|
+
modelURL: string;
|
|
277
|
+
modelTransform?: number[];
|
|
278
|
+
}
|
|
279
|
+
interface SpatialSceneCreationOptions$1 {
|
|
280
|
+
defaultSize?: {
|
|
281
|
+
width: number | string;
|
|
282
|
+
height: number | string;
|
|
283
|
+
depth?: number | string;
|
|
247
284
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
*/
|
|
258
|
-
loadURL(url: string): Promise<void>;
|
|
259
|
-
setFromWindow(window: any): Promise<void>;
|
|
260
|
-
/**
|
|
261
|
-
* Sets the resolution of the window, the resulting dimensions when rendered will be equal to 1/1360 units
|
|
262
|
-
* eg. if the resolution is set to 1360x1360 it will be a 1x1 plane
|
|
263
|
-
* See 1360 in spatialViewUI.swift for how this ratio works
|
|
264
|
-
* @param width width in pixels
|
|
265
|
-
* @param height height in pixels
|
|
266
|
-
*/
|
|
267
|
-
setResolution(width: number, height: number): Promise<void>;
|
|
268
|
-
/**
|
|
269
|
-
* [Experimental] Sets the anchor which the entity this is attached to will rotate around
|
|
270
|
-
* @param rotationAnchor
|
|
271
|
-
*/
|
|
272
|
-
setRotationAnchor(rotationAnchor: Vec3): Promise<void>;
|
|
273
|
-
/**
|
|
274
|
-
* [Experimental] Sets the opacity of the window after apply material
|
|
275
|
-
* @param opacity
|
|
276
|
-
*/
|
|
277
|
-
setOpacity(opacity: number): Promise<void>;
|
|
278
|
-
/**
|
|
279
|
-
* Sets the style that should be applied to the window
|
|
280
|
-
* @param options style options
|
|
281
|
-
*/
|
|
282
|
-
setStyle(styleParam: StyleParam): Promise<void>;
|
|
283
|
-
/**
|
|
284
|
-
* Modifies the amount the spatial window can be scrolled
|
|
285
|
-
* Should only be used internally
|
|
286
|
-
* See https://developer.apple.com/documentation/uikit/1624475-uiedgeinsetsmake?language=objc
|
|
287
|
-
* @param insets margin to modify scroll distances by
|
|
288
|
-
*/
|
|
289
|
-
setScrollEdgeInsets(insets: {
|
|
290
|
-
top: number;
|
|
291
|
-
left: number;
|
|
292
|
-
bottom: number;
|
|
293
|
-
right: number;
|
|
294
|
-
}): Promise<void>;
|
|
295
|
-
/**
|
|
296
|
-
* Enable/Disable scrolling in the window (defaults to enabled), if disabled, scrolling will be applied to the root page
|
|
297
|
-
* @param enabled value to set
|
|
298
|
-
*/
|
|
299
|
-
setScrollEnabled(enabled: boolean): Promise<void>;
|
|
300
|
-
/**
|
|
301
|
-
* Defaults to false. If set to true, scrolling the parent page will also scroll this window with it like other dom elements
|
|
302
|
-
* @param scrollWithParent value to set
|
|
303
|
-
*/
|
|
304
|
-
setScrollWithParent(scrollWithParent: boolean): Promise<void>;
|
|
285
|
+
resizability?: {
|
|
286
|
+
minWidth?: number | string;
|
|
287
|
+
minHeight?: number | string;
|
|
288
|
+
maxWidth?: number | string;
|
|
289
|
+
maxHeight?: number | string;
|
|
290
|
+
};
|
|
291
|
+
worldScaling?: WorldScalingType;
|
|
292
|
+
worldAlignment?: WorldAlignmentType;
|
|
293
|
+
baseplateVisibility?: BaseplateVisibilityType;
|
|
305
294
|
}
|
|
306
|
-
|
|
295
|
+
declare const BaseplateVisibilityValues: readonly ["automatic", "visible", "hidden"];
|
|
296
|
+
type BaseplateVisibilityType = (typeof BaseplateVisibilityValues)[number];
|
|
297
|
+
declare function isValidBaseplateVisibilityType(type: string): Boolean;
|
|
298
|
+
declare const WorldScalingValues: readonly ["automatic", "dynamic"];
|
|
299
|
+
type WorldScalingType = (typeof WorldScalingValues)[number];
|
|
300
|
+
declare function isValidWorldScalingType(type: string): Boolean;
|
|
301
|
+
declare const WorldAlignmentValues: readonly ["adaptive", "automatic", "gravityAligned"];
|
|
302
|
+
type WorldAlignmentType = (typeof WorldAlignmentValues)[number];
|
|
303
|
+
declare function isValidWorldAlignmentType(type: string): Boolean;
|
|
304
|
+
declare const SpatialSceneValues: readonly ["window", "volume"];
|
|
305
|
+
type SpatialSceneType$1 = (typeof SpatialSceneValues)[number];
|
|
306
|
+
declare function isValidSpatialSceneType(type: string): Boolean;
|
|
307
307
|
/**
|
|
308
|
-
*
|
|
309
|
-
* Represents a spatial component that handles events related to spatial interactions.
|
|
310
|
-
* This class extends `SpatialComponent` and provides additional functionality for managing
|
|
311
|
-
* event-driven spatial behaviors.
|
|
308
|
+
* check px,m and number, number must be >= 0
|
|
312
309
|
*
|
|
313
|
-
*
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
310
|
+
* */
|
|
311
|
+
declare function isValidSceneUnit(val: string | number): boolean;
|
|
312
|
+
interface SpatialEntityProperties {
|
|
313
|
+
position: Vec3;
|
|
314
|
+
rotation: Vec3;
|
|
315
|
+
scale: Vec3;
|
|
316
|
+
}
|
|
317
|
+
type SpatialEntityEventType = 'spatialtap';
|
|
318
|
+
type SpatialGeometryType = 'BoxGeometry' | 'PlaneGeometry' | 'SphereGeometry' | 'CylinderGeometry' | 'ConeGeometry';
|
|
319
|
+
interface SpatialBoxGeometryOptions {
|
|
320
|
+
width?: number;
|
|
321
|
+
height?: number;
|
|
322
|
+
depth?: number;
|
|
323
|
+
cornerRadius?: number;
|
|
324
|
+
splitFaces?: boolean;
|
|
325
|
+
}
|
|
326
|
+
interface SpatialPlaneGeometryOptions {
|
|
327
|
+
width?: number;
|
|
328
|
+
height?: number;
|
|
329
|
+
cornerRadius?: number;
|
|
330
|
+
}
|
|
331
|
+
interface SpatialSphereGeometryOptions {
|
|
332
|
+
radius?: number;
|
|
333
|
+
}
|
|
334
|
+
interface SpatialConeGeometryOptions {
|
|
335
|
+
radius?: number;
|
|
336
|
+
height?: number;
|
|
337
|
+
}
|
|
338
|
+
interface SpatialCylinderGeometryOptions {
|
|
339
|
+
radius?: number;
|
|
340
|
+
height?: number;
|
|
341
|
+
}
|
|
342
|
+
type SpatialGeometryOptions = SpatialBoxGeometryOptions | SpatialPlaneGeometryOptions | SpatialSphereGeometryOptions | SpatialCylinderGeometryOptions | SpatialConeGeometryOptions;
|
|
343
|
+
type SpatialMaterialType = 'unlit';
|
|
344
|
+
interface SpatialUnlitMaterialOptions {
|
|
345
|
+
color?: string;
|
|
346
|
+
textureId?: string;
|
|
347
|
+
transparent?: boolean;
|
|
348
|
+
opacity?: number;
|
|
349
|
+
}
|
|
350
|
+
interface ModelComponentOptions {
|
|
351
|
+
mesh: SpatialGeometry;
|
|
352
|
+
materials: SpatialMaterial[];
|
|
353
|
+
}
|
|
354
|
+
interface SpatialEntityUserData {
|
|
355
|
+
id?: string;
|
|
356
|
+
name?: string;
|
|
357
|
+
}
|
|
358
|
+
interface SpatialModelEntityCreationOptions {
|
|
359
|
+
modelAssetId: string;
|
|
360
|
+
name?: string;
|
|
361
|
+
}
|
|
362
|
+
interface ModelAssetOptions {
|
|
363
|
+
url: string;
|
|
364
|
+
}
|
|
365
|
+
declare enum SpatialSceneState$1 {
|
|
366
|
+
idle = "idle",
|
|
367
|
+
pending = "pending",
|
|
368
|
+
willVisible = "willVisible",
|
|
369
|
+
visible = "visible",
|
|
370
|
+
fail = "fail"
|
|
325
371
|
}
|
|
326
|
-
|
|
327
372
|
/**
|
|
328
373
|
* Translate event, matching similar behavior to https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drag_event
|
|
329
374
|
*/
|
|
330
|
-
type
|
|
375
|
+
type SpatialModelDragEvent = {
|
|
331
376
|
eventType: 'dragstart' | 'dragend' | 'drag';
|
|
332
|
-
|
|
377
|
+
translation3D: Vec3;
|
|
378
|
+
startLocation3D: Vec3;
|
|
333
379
|
};
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
380
|
+
interface Size {
|
|
381
|
+
width: number;
|
|
382
|
+
height: number;
|
|
383
|
+
}
|
|
384
|
+
interface Size3D extends Size {
|
|
385
|
+
depth: number;
|
|
386
|
+
}
|
|
387
|
+
declare class CubeInfo$1 {
|
|
388
|
+
size: Size3D;
|
|
389
|
+
origin: Vec3;
|
|
390
|
+
constructor(size: Size3D, origin: Vec3);
|
|
391
|
+
get x(): number;
|
|
392
|
+
get y(): number;
|
|
393
|
+
get z(): number;
|
|
394
|
+
get width(): number;
|
|
395
|
+
get height(): number;
|
|
396
|
+
get depth(): number;
|
|
397
|
+
get left(): number;
|
|
398
|
+
get top(): number;
|
|
399
|
+
get right(): number;
|
|
400
|
+
get bottom(): number;
|
|
401
|
+
get back(): number;
|
|
402
|
+
get front(): number;
|
|
344
403
|
}
|
|
404
|
+
interface SpatialTapEventDetail {
|
|
405
|
+
location3D: Point3D;
|
|
406
|
+
}
|
|
407
|
+
type SpatialTapEvent = CustomEvent<SpatialTapEventDetail>;
|
|
408
|
+
interface SpatialDragEventDetail {
|
|
409
|
+
location3D: Point3D;
|
|
410
|
+
startLocation3D: Point3D;
|
|
411
|
+
translation3D: Vec3;
|
|
412
|
+
predictedEndTranslation3D: Vec3;
|
|
413
|
+
predictedEndLocation3D: Point3D;
|
|
414
|
+
velocity: Size;
|
|
415
|
+
}
|
|
416
|
+
type SpatialDragEvent = CustomEvent<SpatialDragEventDetail>;
|
|
417
|
+
type SpatialDragEndEvent = SpatialDragEvent;
|
|
418
|
+
interface SpatialRotateEventDetail {
|
|
419
|
+
rotation: {
|
|
420
|
+
vector: [number, number, number, number];
|
|
421
|
+
};
|
|
422
|
+
startAnchor3D: Vec3;
|
|
423
|
+
startLocation3D: Point3D;
|
|
424
|
+
}
|
|
425
|
+
type SpatialRotateEvent = CustomEvent<SpatialRotateEventDetail>;
|
|
426
|
+
type SpatialRotateEndEvent = SpatialRotateEvent;
|
|
427
|
+
interface SpatialMagnifyEventDetail {
|
|
428
|
+
magnification: number;
|
|
429
|
+
velocity: number;
|
|
430
|
+
startAnchor3D: Vec3;
|
|
431
|
+
startLocation3D: Point3D;
|
|
432
|
+
}
|
|
433
|
+
type SpatialMagnifyEvent = CustomEvent<SpatialMagnifyEventDetail>;
|
|
434
|
+
type SpatialMagnifyEndEvent = SpatialMagnifyEvent;
|
|
435
|
+
type SpatialEntityOrReality = SpatialEntity | SpatializedDynamic3DElement;
|
|
345
436
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
437
|
+
declare class SpatialComponent extends SpatialObject {
|
|
438
|
+
constructor(id: string);
|
|
439
|
+
private onReceiveEvent;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
declare class SpatialEntity extends SpatialObject {
|
|
443
|
+
userData?: SpatialEntityUserData | undefined;
|
|
444
|
+
position: Vec3;
|
|
445
|
+
rotation: Vec3;
|
|
446
|
+
scale: Vec3;
|
|
447
|
+
events: Record<string, (data: any) => void>;
|
|
448
|
+
children: SpatialEntity[];
|
|
449
|
+
parent: SpatialEntityOrReality | null;
|
|
450
|
+
constructor(id: string, userData?: SpatialEntityUserData | undefined);
|
|
451
|
+
addComponent(component: SpatialComponent): Promise<CommandResult>;
|
|
452
|
+
setPosition(position: Vec3): Promise<CommandResult>;
|
|
453
|
+
setRotation(rotation: Vec3): Promise<CommandResult>;
|
|
454
|
+
setScale(scale: Vec3): Promise<CommandResult>;
|
|
455
|
+
addEntity(ent: SpatialEntity): Promise<CommandResult>;
|
|
456
|
+
removeFromParent(): Promise<CommandResult>;
|
|
457
|
+
updateTransform(properties: Partial<SpatialEntityProperties>): Promise<CommandResult>;
|
|
458
|
+
addEvent(type: SpatialEntityEventType, callback: (data: any) => void): Promise<void>;
|
|
459
|
+
removeEvent(eventName: SpatialEntityEventType): Promise<void>;
|
|
460
|
+
updateEntityEvent(eventName: SpatialEntityEventType, isEnable: boolean): Promise<CommandResult>;
|
|
461
|
+
private onReceiveEvent;
|
|
462
|
+
dispatchEvent(evt: CustomEvent): void;
|
|
463
|
+
protected onDestroy(): void;
|
|
464
|
+
convertFromEntityToEntity(fromEntityId: string, toEntityId: string, position: Vec3): Promise<CommandResult>;
|
|
465
|
+
convertFromEntityToScene(fromEntityId: string, position: Vec3): Promise<CommandResult>;
|
|
466
|
+
convertFromSceneToEntity(entityId: string, position: Vec3): Promise<CommandResult>;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
declare class SpatialModelEntity extends SpatialEntity {
|
|
470
|
+
id: string;
|
|
471
|
+
options?: SpatialModelEntityCreationOptions | undefined;
|
|
472
|
+
userData?: SpatialEntityUserData | undefined;
|
|
473
|
+
constructor(id: string, options?: SpatialModelEntityCreationOptions | undefined, userData?: SpatialEntityUserData | undefined);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
declare class ModelComponent extends SpatialComponent {
|
|
477
|
+
options: ModelComponentOptions;
|
|
478
|
+
constructor(id: string, options: ModelComponentOptions);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
declare class SpatialUnlitMaterial extends SpatialMaterial {
|
|
482
|
+
id: string;
|
|
483
|
+
options: SpatialUnlitMaterialOptions;
|
|
484
|
+
constructor(id: string, options: SpatialUnlitMaterialOptions);
|
|
485
|
+
updateProperties(properties: Partial<SpatialUnlitMaterialOptions>): Promise<CommandResult>;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
declare class SpatialBoxGeometry extends SpatialGeometry {
|
|
489
|
+
id: string;
|
|
490
|
+
options: SpatialBoxGeometryOptions;
|
|
491
|
+
static type: SpatialGeometryType;
|
|
492
|
+
constructor(id: string, options: SpatialBoxGeometryOptions);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
declare class SpatialSphereGeometry extends SpatialGeometry {
|
|
496
|
+
id: string;
|
|
497
|
+
options: SpatialSphereGeometryOptions;
|
|
498
|
+
static type: SpatialGeometryType;
|
|
499
|
+
constructor(id: string, options: SpatialSphereGeometryOptions);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
declare class SpatialCylinderGeometry extends SpatialGeometry {
|
|
503
|
+
id: string;
|
|
504
|
+
options: SpatialCylinderGeometryOptions;
|
|
505
|
+
static type: SpatialGeometryType;
|
|
506
|
+
constructor(id: string, options: SpatialCylinderGeometryOptions);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
declare class SpatialPlaneGeometry extends SpatialGeometry {
|
|
510
|
+
id: string;
|
|
511
|
+
options: SpatialPlaneGeometryOptions;
|
|
512
|
+
static type: SpatialGeometryType;
|
|
513
|
+
constructor(id: string, options: SpatialPlaneGeometryOptions);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
declare class SpatialConeGeometry extends SpatialGeometry {
|
|
517
|
+
id: string;
|
|
518
|
+
options: SpatialConeGeometryOptions;
|
|
519
|
+
static type: SpatialGeometryType;
|
|
520
|
+
constructor(id: string, options: SpatialConeGeometryOptions);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
declare class SpatialModelAsset extends SpatialObject {
|
|
524
|
+
id: string;
|
|
525
|
+
options: ModelAssetOptions;
|
|
526
|
+
constructor(id: string, options: ModelAssetOptions);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
declare function initScene(name: string, callback: (pre: SpatialSceneCreationOptions$1) => SpatialSceneCreationOptions$1, options?: {
|
|
530
|
+
type: SpatialSceneType$1;
|
|
531
|
+
}): void;
|
|
532
|
+
|
|
533
|
+
type SpatialSceneCreationOptionsInternal = SpatialSceneCreationOptions$1 & {
|
|
534
|
+
type: SpatialSceneType$1;
|
|
535
|
+
};
|
|
536
|
+
declare enum SpatialSceneState {
|
|
537
|
+
idle = "idle",
|
|
538
|
+
pending = "pending",
|
|
539
|
+
willVisible = "willVisible",
|
|
540
|
+
visible = "visible",
|
|
541
|
+
fail = "fail"
|
|
350
542
|
}
|
|
351
543
|
|
|
352
544
|
/**
|
|
353
|
-
*
|
|
545
|
+
* Represents the spatial scene that contains all spatialized elements.
|
|
546
|
+
* This class follows the singleton pattern - only one instance exists per application.
|
|
547
|
+
* The scene manages the overall spatial environment properties and contains all spatial elements.
|
|
354
548
|
*/
|
|
355
|
-
declare class
|
|
549
|
+
declare class SpatialScene extends SpatialObject {
|
|
356
550
|
/**
|
|
357
|
-
*
|
|
551
|
+
* Gets the singleton instance of the SpatialScene.
|
|
552
|
+
* Creates a new instance if one doesn't exist yet.
|
|
553
|
+
* @returns The singleton SpatialScene instance
|
|
358
554
|
*/
|
|
359
|
-
|
|
360
|
-
r: number;
|
|
361
|
-
g: number;
|
|
362
|
-
b: number;
|
|
363
|
-
a: number;
|
|
364
|
-
};
|
|
555
|
+
static getInstance(): SpatialScene;
|
|
365
556
|
/**
|
|
366
|
-
*
|
|
557
|
+
* Updates the properties of the spatial scene.
|
|
558
|
+
* This can include background settings, lighting, and other scene-wide properties.
|
|
559
|
+
* @param properties Partial set of properties to update
|
|
560
|
+
* @returns Promise resolving when the update is complete
|
|
367
561
|
*/
|
|
368
|
-
|
|
369
|
-
value: number;
|
|
370
|
-
};
|
|
562
|
+
updateSpatialProperties(properties: Partial<SpatialSceneProperties>): Promise<CommandResult>;
|
|
371
563
|
/**
|
|
372
|
-
*
|
|
564
|
+
* Adds a spatialized element to the scene.
|
|
565
|
+
* This makes the element visible and interactive in the spatial environment.
|
|
566
|
+
* @param element The SpatializedElement to add to the scene
|
|
567
|
+
* @returns Promise resolving when the element is added
|
|
373
568
|
*/
|
|
374
|
-
|
|
375
|
-
value: number;
|
|
376
|
-
};
|
|
377
|
-
_modelComponentAttachedTo: {
|
|
378
|
-
[key: string]: SpatialModelComponent;
|
|
379
|
-
};
|
|
380
|
-
_addToComponent(c: SpatialModelComponent): void;
|
|
381
|
-
/**
|
|
382
|
-
* Syncs state of color, metallic, roupghness to the renderer
|
|
383
|
-
*/
|
|
384
|
-
update(): Promise<void>;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Used to position a model in 3D space, made up of a mesh and materials to be applied to the mesh
|
|
389
|
-
*/
|
|
390
|
-
declare class SpatialModelComponent extends SpatialComponent {
|
|
391
|
-
private cachedMaterials;
|
|
569
|
+
addSpatializedElement(element: SpatializedElement): Promise<CommandResult>;
|
|
392
570
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
571
|
+
* Updates the scene creation configuration.
|
|
572
|
+
* This allows changing scene parameters after initial creation.
|
|
573
|
+
* @param config The new scene creation configuration
|
|
574
|
+
* @returns Promise resolving when the update is complete
|
|
395
575
|
*/
|
|
396
|
-
|
|
576
|
+
updateSceneCreationConfig(config: SpatialSceneCreationOptionsInternal): Promise<CommandResult>;
|
|
397
577
|
/**
|
|
398
|
-
*
|
|
399
|
-
*
|
|
578
|
+
* Gets the current state of the spatial scene.
|
|
579
|
+
* This includes information about active elements and scene configuration.
|
|
580
|
+
* @returns Promise resolving to the current SpatialSceneState
|
|
400
581
|
*/
|
|
401
|
-
|
|
402
|
-
/** @hidden */
|
|
403
|
-
_syncMaterials(): Promise<void>;
|
|
582
|
+
getState(): Promise<SpatialSceneState>;
|
|
404
583
|
}
|
|
405
584
|
|
|
406
585
|
/**
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
* Resolution defaults to 100x100 pixels
|
|
411
|
-
* Only will be displayed on entities in "ROOT" or "DOM" space
|
|
412
|
-
* If the resolution of the spatial view is not a square, the volume will be larger based on the ratio with the shortest side being 1 meter.
|
|
413
|
-
* (eg. 200x100 = 2m x 1m x 1m volume)
|
|
586
|
+
* Represents a 2D HTML element that has been spatialized in 3D space.
|
|
587
|
+
* This class handles the integration between 2D web content and the 3D spatial environment,
|
|
588
|
+
* allowing HTML elements to be positioned and interacted with in spatial applications.
|
|
414
589
|
*/
|
|
415
|
-
declare class
|
|
590
|
+
declare class Spatialized2DElement extends SpatializedElement {
|
|
591
|
+
readonly windowProxy: WindowProxy;
|
|
416
592
|
/**
|
|
417
|
-
*
|
|
593
|
+
* Creates a new spatialized 2D element.
|
|
594
|
+
* @param id Unique identifier for this element
|
|
595
|
+
* @param windowProxy Reference to the window object containing the 2D content
|
|
418
596
|
*/
|
|
419
|
-
|
|
597
|
+
constructor(id: string, windowProxy: WindowProxy);
|
|
420
598
|
/**
|
|
421
|
-
*
|
|
422
|
-
*
|
|
599
|
+
* Updates the properties of this 2D element.
|
|
600
|
+
* This can include size, position, background, and other visual properties.
|
|
601
|
+
* @param properties Partial set of properties to update
|
|
602
|
+
* @returns Promise resolving when the update is complete
|
|
423
603
|
*/
|
|
424
|
-
|
|
604
|
+
updateProperties(properties: Partial<Spatialized2DElementProperties>): Promise<CommandResult>;
|
|
605
|
+
/**
|
|
606
|
+
* Adds a child spatialized element to this 2D element.
|
|
607
|
+
* This allows for creating hierarchical structures of spatial elements.
|
|
608
|
+
* @param element The child element to add
|
|
609
|
+
* @returns Promise resolving when the element is added
|
|
610
|
+
*/
|
|
611
|
+
addSpatializedElement(element: SpatializedElement): Promise<CommandResult>;
|
|
425
612
|
}
|
|
426
613
|
|
|
427
614
|
/**
|
|
428
|
-
*
|
|
615
|
+
* Represents a static 3D model element in the spatial environment.
|
|
616
|
+
* This class handles loading and displaying pre-built 3D models from URLs,
|
|
617
|
+
* and provides events for load success and failure.
|
|
429
618
|
*/
|
|
430
|
-
|
|
431
|
-
eventType: 'dragstart' | 'dragend' | 'drag';
|
|
432
|
-
translation3D: Vec3;
|
|
433
|
-
startLocation3D: Vec3;
|
|
434
|
-
};
|
|
435
|
-
/**
|
|
436
|
-
* Used to position a model3d in 3D space
|
|
437
|
-
*/
|
|
438
|
-
declare class SpatialModel3DComponent extends EventSpatialComponent {
|
|
439
|
-
protected onRecvEvent(data: any): void;
|
|
440
|
-
/**
|
|
441
|
-
* Sets the resolution of the spatial view in dom pixels
|
|
442
|
-
*/
|
|
443
|
-
setResolution(width: number, height: number): Promise<void>;
|
|
444
|
-
setRotationAnchor(rotationAnchor: Vec3): Promise<void>;
|
|
445
|
-
/**
|
|
446
|
-
* Sets the opacity of the model
|
|
447
|
-
* @param opacity
|
|
448
|
-
*/
|
|
449
|
-
setOpacity(opacity: number): Promise<void>;
|
|
619
|
+
declare class SpatializedStatic3DElement extends SpatializedElement {
|
|
450
620
|
/**
|
|
451
|
-
*
|
|
452
|
-
*
|
|
621
|
+
* Promise resolver for the ready state.
|
|
622
|
+
* Used to resolve the ready promise when the model is loaded.
|
|
453
623
|
*/
|
|
454
|
-
|
|
624
|
+
private _readyResolve?;
|
|
455
625
|
/**
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
* @param aspectRatio number
|
|
626
|
+
* Caches the last model URL to detect changes.
|
|
627
|
+
* Used to reset the ready promise when the model URL changes.
|
|
460
628
|
*/
|
|
461
|
-
|
|
629
|
+
private modelURL;
|
|
462
630
|
/**
|
|
463
|
-
*
|
|
464
|
-
* @
|
|
631
|
+
* Creates a new promise for tracking the ready state of the model.
|
|
632
|
+
* @returns Promise that resolves when the model is loaded (true) or fails to load (false)
|
|
465
633
|
*/
|
|
466
|
-
|
|
634
|
+
private createReadyPromise;
|
|
467
635
|
/**
|
|
468
|
-
*
|
|
469
|
-
*
|
|
636
|
+
* Promise that resolves when the model is loaded.
|
|
637
|
+
* Resolves to true on successful load, false on failure.
|
|
470
638
|
*/
|
|
471
|
-
|
|
639
|
+
ready: Promise<boolean>;
|
|
472
640
|
/**
|
|
473
|
-
*
|
|
641
|
+
* Updates the properties of this static 3D element.
|
|
642
|
+
* Handles special case for modelURL changes by resetting the ready promise.
|
|
643
|
+
* @param properties Partial set of properties to update
|
|
644
|
+
* @returns Promise resolving when the update is complete
|
|
474
645
|
*/
|
|
475
|
-
|
|
646
|
+
updateProperties(properties: Partial<SpatializedStatic3DElementProperties>): Promise<CommandResult>;
|
|
476
647
|
/**
|
|
477
|
-
*
|
|
478
|
-
*
|
|
648
|
+
* Processes events received from the WebSpatial environment.
|
|
649
|
+
* Handles model loading events in addition to base spatial events.
|
|
650
|
+
* @param data The event data received from the WebSpatial system
|
|
479
651
|
*/
|
|
480
|
-
|
|
652
|
+
onReceiveEvent(data: {
|
|
653
|
+
type: SpatialWebMsgType;
|
|
654
|
+
}): void;
|
|
481
655
|
/**
|
|
482
|
-
* Callback
|
|
483
|
-
* @param dragEvent
|
|
656
|
+
* Callback function for successful model loading.
|
|
484
657
|
*/
|
|
485
|
-
private
|
|
486
|
-
set onDragStart(callback: ((dragEvent: SpatialModelDragEvent) => void) | undefined);
|
|
658
|
+
private _onLoadCallback?;
|
|
487
659
|
/**
|
|
488
|
-
*
|
|
489
|
-
* @param
|
|
660
|
+
* Sets the callback function for successful model loading.
|
|
661
|
+
* @param callback Function to call when the model is loaded successfully
|
|
490
662
|
*/
|
|
491
|
-
|
|
492
|
-
set onDrag(callback: ((dragEvent: SpatialModelDragEvent) => void) | undefined);
|
|
663
|
+
set onLoadCallback(callback: undefined | (() => void));
|
|
493
664
|
/**
|
|
494
|
-
* Callback
|
|
495
|
-
* @param dragEvent
|
|
665
|
+
* Callback function for model loading failure.
|
|
496
666
|
*/
|
|
497
|
-
private
|
|
498
|
-
set onDragEnd(callback: ((dragEvent: SpatialModelDragEvent) => void) | undefined);
|
|
499
|
-
private get enableDragEvent();
|
|
667
|
+
private _onLoadFailureCallback?;
|
|
500
668
|
/**
|
|
501
|
-
*
|
|
669
|
+
* Sets the callback function for model loading failure.
|
|
670
|
+
* @param callback Function to call when the model fails to load
|
|
502
671
|
*/
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
/** Callback fired when model was double tapped */
|
|
506
|
-
private _onDoubleTap?;
|
|
507
|
-
set onDoubleTap(callback: (() => void) | undefined);
|
|
508
|
-
/** Callback fired when model was long pressed */
|
|
509
|
-
private _onLongPress?;
|
|
510
|
-
set onLongPress(callback: (() => void) | undefined);
|
|
672
|
+
set onLoadFailureCallback(callback: undefined | (() => void));
|
|
673
|
+
updateModelTransform(transform: DOMMatrix): void;
|
|
511
674
|
}
|
|
512
675
|
|
|
513
|
-
type CreateResourceOptions = {
|
|
514
|
-
windowContainer?: SpatialWindowContainer | null;
|
|
515
|
-
windowComponent?: SpatialWindowComponent | null;
|
|
516
|
-
};
|
|
517
676
|
/**
|
|
518
|
-
*
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Session use to establish a connection to the spatial renderer of the system. All resources must be created by the session
|
|
677
|
+
* Session used to establish a connection to the spatial renderer of the system.
|
|
678
|
+
* All spatial resources must be created through this session object.
|
|
679
|
+
* This class serves as the main factory for creating spatial elements and geometries.
|
|
523
680
|
*/
|
|
524
681
|
declare class SpatialSession {
|
|
525
|
-
/** @hidden */
|
|
526
|
-
_engineUpdateListeners: animCallback[];
|
|
527
|
-
/** @hidden */
|
|
528
|
-
_frameLoopStarted: boolean;
|
|
529
682
|
/**
|
|
530
|
-
*
|
|
531
|
-
*
|
|
683
|
+
* Gets the singleton instance of the spatial scene.
|
|
684
|
+
* The spatial scene is the root container for all spatial elements.
|
|
685
|
+
* @returns The SpatialScene singleton instance
|
|
532
686
|
*/
|
|
533
|
-
|
|
687
|
+
getSpatialScene(): SpatialScene;
|
|
534
688
|
/**
|
|
535
|
-
* Creates a
|
|
536
|
-
*
|
|
689
|
+
* Creates a new 2D element that can be spatialized in the 3D environment.
|
|
690
|
+
* 2D elements represent HTML content that can be positioned in 3D space.
|
|
691
|
+
* @returns Promise resolving to a new Spatialized2DElement instance
|
|
537
692
|
*/
|
|
538
|
-
|
|
693
|
+
createSpatialized2DElement(): Promise<Spatialized2DElement>;
|
|
539
694
|
/**
|
|
540
|
-
* Creates a
|
|
541
|
-
*
|
|
542
|
-
* @
|
|
695
|
+
* Creates a new static 3D element with an optional model URL.
|
|
696
|
+
* Static 3D elements represent pre-built 3D models that can be loaded from a URL.
|
|
697
|
+
* @param modelURL Optional URL to the 3D model to load
|
|
698
|
+
* @returns Promise resolving to a new SpatializedStatic3DElement instance
|
|
543
699
|
*/
|
|
544
|
-
|
|
700
|
+
createSpatializedStatic3DElement(modelURL?: string): Promise<SpatializedStatic3DElement>;
|
|
545
701
|
/**
|
|
546
|
-
*
|
|
547
|
-
*
|
|
702
|
+
* Initializes the spatial scene with custom configuration.
|
|
703
|
+
* This is a reference to the initScene function from scene-polyfill.
|
|
548
704
|
*/
|
|
549
|
-
|
|
705
|
+
initScene: typeof initScene;
|
|
550
706
|
/**
|
|
551
|
-
* Creates a
|
|
552
|
-
*
|
|
707
|
+
* Creates a new dynamic 3D element that can be manipulated at runtime.
|
|
708
|
+
* Dynamic 3D elements allow for programmatic creation and modification of 3D content.
|
|
709
|
+
* @returns Promise resolving to a new SpatializedDynamic3DElement instance
|
|
553
710
|
*/
|
|
554
|
-
|
|
555
|
-
url: string;
|
|
556
|
-
} & CreateResourceOptions): Promise<SpatialModelComponent>;
|
|
711
|
+
createSpatializedDynamic3DElement(): Promise<SpatializedDynamic3DElement>;
|
|
557
712
|
/**
|
|
558
|
-
* Creates a
|
|
559
|
-
*
|
|
713
|
+
* Creates a new spatial entity with an optional name.
|
|
714
|
+
* Entities are the basic building blocks for creating custom 3D content.
|
|
715
|
+
* @param name Optional name for the entity
|
|
716
|
+
* @returns Promise resolving to a new SpatialEntity instance
|
|
560
717
|
*/
|
|
561
|
-
|
|
562
|
-
url: string;
|
|
563
|
-
} & CreateResourceOptions): Promise<SpatialModel3DComponent>;
|
|
718
|
+
createEntity(userData?: SpatialEntityUserData): Promise<SpatialEntity>;
|
|
564
719
|
/**
|
|
565
|
-
* Creates a
|
|
566
|
-
*
|
|
567
|
-
* @returns
|
|
720
|
+
* Creates a box geometry with optional configuration.
|
|
721
|
+
* @param options Configuration options for the box geometry
|
|
722
|
+
* @returns Promise resolving to a new SpatialBoxGeometry instance
|
|
568
723
|
*/
|
|
569
|
-
|
|
724
|
+
createBoxGeometry(options?: SpatialBoxGeometryOptions): Promise<SpatialBoxGeometry>;
|
|
570
725
|
/**
|
|
571
|
-
* Creates a
|
|
572
|
-
* @
|
|
726
|
+
* Creates a plane geometry with optional configuration.
|
|
727
|
+
* @param options Configuration options for the plane geometry
|
|
728
|
+
* @returns Promise resolving to a new SpatialPlaneGeometry instance
|
|
573
729
|
*/
|
|
574
|
-
|
|
575
|
-
shape?: string;
|
|
576
|
-
} & CreateResourceOptions): Promise<SpatialMeshResource>;
|
|
730
|
+
createPlaneGeometry(options?: SpatialPlaneGeometryOptions): Promise<SpatialPlaneGeometry>;
|
|
577
731
|
/**
|
|
578
|
-
* Creates a
|
|
579
|
-
* @
|
|
732
|
+
* Creates a sphere geometry with optional configuration.
|
|
733
|
+
* @param options Configuration options for the sphere geometry
|
|
734
|
+
* @returns Promise resolving to a new SpatialSphereGeometry instance
|
|
580
735
|
*/
|
|
581
|
-
|
|
736
|
+
createSphereGeometry(options?: SpatialSphereGeometryOptions): Promise<SpatialSphereGeometry>;
|
|
582
737
|
/**
|
|
583
|
-
* Creates a
|
|
584
|
-
* @
|
|
585
|
-
*
|
|
586
|
-
createWindowContainer(options?: {
|
|
587
|
-
style: WindowStyle;
|
|
588
|
-
} & CreateResourceOptions): Promise<SpatialWindowContainer>;
|
|
589
|
-
/**
|
|
590
|
-
* Creates a Scene to display content within an anchored area managed by the OS
|
|
591
|
-
* @hidden
|
|
592
|
-
* @param {WindowStyle} [style='Plain'] - The style of the Scene container to be created with. Defaults to 'Plain'.
|
|
593
|
-
* @param {Object} [cfg={}] - Configuration object for the Scene.
|
|
594
|
-
* @returns Boolean
|
|
595
|
-
*/
|
|
596
|
-
_createScene(style: WindowStyle | undefined, cfg: {
|
|
597
|
-
sceneData: sceneDataShape;
|
|
598
|
-
}): Promise<boolean>;
|
|
599
|
-
/**
|
|
600
|
-
* Retrieves the window for this page
|
|
601
|
-
* @returns the window component corresponding to the js running on this page
|
|
602
|
-
* [TODO] discuss implications of this not being async
|
|
738
|
+
* Creates a cone geometry with the specified configuration.
|
|
739
|
+
* @param options Configuration options for the cone geometry
|
|
740
|
+
* @returns Promise resolving to a new SpatialConeGeometry instance
|
|
603
741
|
*/
|
|
604
|
-
|
|
742
|
+
createConeGeometry(options: SpatialConeGeometryOptions): Promise<SpatialConeGeometry>;
|
|
605
743
|
/**
|
|
606
|
-
*
|
|
607
|
-
* @
|
|
744
|
+
* Creates a cylinder geometry with the specified configuration.
|
|
745
|
+
* @param options Configuration options for the cylinder geometry
|
|
746
|
+
* @returns Promise resolving to a new SpatialCylinderGeometry instance
|
|
608
747
|
*/
|
|
609
|
-
|
|
748
|
+
createCylinderGeometry(options: SpatialCylinderGeometryOptions): Promise<SpatialCylinderGeometry>;
|
|
610
749
|
/**
|
|
611
|
-
*
|
|
612
|
-
*
|
|
750
|
+
* Creates a model component with the specified configuration.
|
|
751
|
+
* Model components are used to add 3D model rendering capabilities to entities.
|
|
752
|
+
* @param options Configuration options for the model component
|
|
753
|
+
* @returns Promise resolving to a new ModelComponent instance
|
|
613
754
|
*/
|
|
614
|
-
|
|
755
|
+
createModelComponent(options: ModelComponentOptions): Promise<ModelComponent>;
|
|
615
756
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
757
|
+
* Creates an unlit material with the specified configuration.
|
|
758
|
+
* Unlit materials don't respond to lighting in the scene.
|
|
759
|
+
* @param options Configuration options for the unlit material
|
|
760
|
+
* @returns Promise resolving to a new SpatialUnlitMaterial instance
|
|
618
761
|
*/
|
|
619
|
-
|
|
762
|
+
createUnlitMaterial(options: SpatialUnlitMaterialOptions): Promise<SpatialUnlitMaterial>;
|
|
620
763
|
/**
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
* @
|
|
764
|
+
* Creates a model asset with the specified configuration.
|
|
765
|
+
* Model assets represent 3D model resources that can be used by entities.
|
|
766
|
+
* @param options Configuration options for the model asset
|
|
767
|
+
* @returns Promise resolving to a new SpatialModelAsset instance
|
|
624
768
|
*/
|
|
625
|
-
|
|
626
|
-
backend: string;
|
|
627
|
-
objects: {
|
|
628
|
-
count: number;
|
|
629
|
-
};
|
|
630
|
-
refObjects: {
|
|
631
|
-
count: number;
|
|
632
|
-
};
|
|
633
|
-
}>;
|
|
769
|
+
createModelAsset(options: ModelAssetOptions): Promise<SpatialModelAsset>;
|
|
634
770
|
/**
|
|
635
|
-
*
|
|
771
|
+
* Creates a spatial model entity with the specified configuration.
|
|
772
|
+
* This is a convenience method for creating an entity with a model component.
|
|
773
|
+
* @param options Configuration options for the spatial model entity
|
|
774
|
+
* @returns Promise resolving to a new SpatialModelEntity instance
|
|
636
775
|
*/
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* @hidden
|
|
640
|
-
*/
|
|
641
|
-
_inspectRootWindowContainer(): Promise<any>;
|
|
642
|
-
/** Opens the immersive space */
|
|
643
|
-
openImmersiveSpace(): Promise<void>;
|
|
644
|
-
/** Closes the immersive space */
|
|
645
|
-
dismissImmersiveSpace(): Promise<void>;
|
|
646
|
-
private static _immersiveWindowContainer;
|
|
647
|
-
/**
|
|
648
|
-
* Retreives the window container corresponding to the Immersive space
|
|
649
|
-
* @returns the immersive window container
|
|
650
|
-
*/
|
|
651
|
-
getImmersiveWindowContainer(): Promise<SpatialWindowContainer>;
|
|
652
|
-
private static _currentWindowContainer;
|
|
653
|
-
/**
|
|
654
|
-
* Gets the current window container for the window
|
|
655
|
-
* [TODO] discuss what happens if it doesnt yet have a window container
|
|
656
|
-
* @returns the current window container for the window
|
|
657
|
-
*/
|
|
658
|
-
getCurrentWindowContainer(): SpatialWindowContainer;
|
|
659
|
-
/**
|
|
660
|
-
* Start a transaction that queues up commands to submit them all at once to reduce ipc overhead
|
|
661
|
-
* @param fn function to be run, within this function, promises will not resolve
|
|
662
|
-
* @returns promise for the entire transaction completion
|
|
663
|
-
*/
|
|
664
|
-
transaction(fn: Function): Promise<unknown>;
|
|
665
|
-
/**
|
|
666
|
-
* Creates a window context object that is compatable with SpatialWindowComponent's setFromWindow API
|
|
667
|
-
* @returns window context
|
|
668
|
-
*/
|
|
669
|
-
createWindowContext(): Promise<Window | null>;
|
|
670
|
-
/** @hidden */
|
|
671
|
-
_getEntity(id: string): Promise<SpatialEntity>;
|
|
672
|
-
/** @hidden */
|
|
673
|
-
setLoading(method: LoadingMethodKind, style?: string): Promise<unknown>;
|
|
776
|
+
createSpatialModelEntity(options: SpatialModelEntityCreationOptions, userData?: SpatialEntityUserData): Promise<SpatialModelEntity>;
|
|
674
777
|
}
|
|
675
778
|
|
|
676
779
|
/**
|
|
677
|
-
* Base object designed to be placed on navigator.spatial to mirror navigator.xr for webxr
|
|
780
|
+
* Base object designed to be placed on navigator.spatial to mirror navigator.xr for webxr.
|
|
781
|
+
* This is the main entry point for the WebSpatial SDK, providing access to spatial capabilities.
|
|
678
782
|
*/
|
|
679
783
|
declare class Spatial {
|
|
680
784
|
/**
|
|
681
|
-
* Requests a session object from the browser
|
|
682
|
-
*
|
|
785
|
+
* Requests a spatial session object from the browser.
|
|
786
|
+
* This is the primary method to initialize spatial functionality.
|
|
787
|
+
* @returns The SpatialSession instance or null if not available in the current browser
|
|
683
788
|
* [TODO] discuss implications of this not being async
|
|
684
789
|
*/
|
|
685
790
|
requestSession(): SpatialSession | null;
|
|
686
791
|
/**
|
|
687
|
-
*
|
|
792
|
+
* Checks if the current page is running in a spatial web environment.
|
|
793
|
+
* This method detects if the application is running in a WebSpatial-compatible browser.
|
|
794
|
+
* @returns True if running in a spatial web environment, false otherwise
|
|
795
|
+
*/
|
|
796
|
+
runInSpatialWeb(): boolean;
|
|
797
|
+
/** @deprecated
|
|
798
|
+
* Checks if WebSpatial is supported in the current environment.
|
|
799
|
+
* Verifies compatibility between native and client versions.
|
|
800
|
+
* @returns True if web spatial is supported by this webpage
|
|
688
801
|
*/
|
|
689
802
|
isSupported(): boolean;
|
|
690
|
-
/**
|
|
691
|
-
* Gets the native version
|
|
692
|
-
*
|
|
803
|
+
/** @deprecated
|
|
804
|
+
* Gets the native WebSpatial version from the browser environment.
|
|
805
|
+
* The version format follows semantic versioning (x.x.x).
|
|
806
|
+
* @returns Native version string in format "x.x.x"
|
|
693
807
|
*/
|
|
694
808
|
getNativeVersion(): any;
|
|
695
|
-
/**
|
|
696
|
-
* Gets the client version
|
|
697
|
-
*
|
|
809
|
+
/** @deprecated
|
|
810
|
+
* Gets the client SDK version.
|
|
811
|
+
* The version format follows semantic versioning (x.x.x).
|
|
812
|
+
* @returns Client SDK version string in format "x.x.x"
|
|
698
813
|
*/
|
|
699
814
|
getClientVersion(): string;
|
|
700
815
|
}
|
|
701
816
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
817
|
+
declare global {
|
|
818
|
+
declare const __WEBSPATIAL_CORE_SDK_VERSION__: string
|
|
819
|
+
|
|
820
|
+
interface Window {
|
|
821
|
+
xrCurrentSceneType: SpatialSceneType
|
|
822
|
+
xrCurrentSceneDefaults: (
|
|
823
|
+
defaultConfig: SpatialSceneCreationOptions,
|
|
824
|
+
) => Promise<SpatialSceneCreationOptions>
|
|
825
|
+
|
|
826
|
+
// Location for webspatial custom functions
|
|
827
|
+
__WebSpatialData: {
|
|
828
|
+
androidNativeMessage: Function
|
|
829
|
+
getNativeVersion: Function
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// Location for webspatial internal callbacks (eg. completion events)
|
|
833
|
+
__SpatialWebEvent: Function
|
|
834
|
+
|
|
835
|
+
// Used to access webkit specific api
|
|
836
|
+
webkit: any
|
|
837
|
+
webspatialBridge: any
|
|
838
|
+
|
|
839
|
+
// Will be removed in favor of __WebSpatialData
|
|
840
|
+
WebSpatailNativeVersion: string
|
|
841
|
+
|
|
842
|
+
__webspatialsdk__?: {
|
|
843
|
+
XR_ENV?: string
|
|
844
|
+
'natvie-version'?: string
|
|
845
|
+
'react-sdk-version'?: string
|
|
846
|
+
'core-sdk-version'?: string
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
innerDepth: number
|
|
850
|
+
outerDepth: number
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
interface HTMLElement {
|
|
854
|
+
offsetBack: number
|
|
855
|
+
clientDepth: number
|
|
856
|
+
getBoundingClientCube: () => CubeInfo | undefined
|
|
857
|
+
}
|
|
738
858
|
}
|
|
739
859
|
|
|
740
|
-
|
|
860
|
+
declare const isSSREnv: () => boolean;
|
|
861
|
+
|
|
862
|
+
export { type BackgroundMaterialType, type BaseplateVisibilityType, BaseplateVisibilityValues, type CornerRadius, CubeInfo$1 as CubeInfo, type ModelAssetOptions, ModelComponent, type ModelComponentOptions, type Point3D, type Size, type Size3D, Spatial, SpatialBoxGeometry, type SpatialBoxGeometryOptions, SpatialComponent, SpatialConeGeometry, type SpatialConeGeometryOptions, SpatialCylinderGeometry, type SpatialCylinderGeometryOptions, type SpatialDragEndEvent, type SpatialDragEvent, type SpatialDragEventDetail, SpatialEntity, type SpatialEntityEventType, type SpatialEntityOrReality, type SpatialEntityProperties, type SpatialEntityUserData, SpatialGeometry, type SpatialGeometryOptions, type SpatialGeometryType, type SpatialMagnifyEndEvent, type SpatialMagnifyEvent, type SpatialMagnifyEventDetail, SpatialMaterial, type SpatialMaterialType, SpatialModelAsset, type SpatialModelDragEvent, SpatialModelEntity, type SpatialModelEntityCreationOptions, SpatialObject, SpatialPlaneGeometry, type SpatialPlaneGeometryOptions, type SpatialRotateEndEvent, type SpatialRotateEvent, type SpatialRotateEventDetail, SpatialScene, type SpatialSceneCreationOptions$1 as SpatialSceneCreationOptions, type SpatialSceneProperties, SpatialSceneState$1 as SpatialSceneState, type SpatialSceneType$1 as SpatialSceneType, SpatialSceneValues, SpatialSession, SpatialSphereGeometry, type SpatialSphereGeometryOptions, type SpatialTapEvent, type SpatialTapEventDetail, SpatialUnlitMaterial, type SpatialUnlitMaterialOptions, Spatialized2DElement, type Spatialized2DElementProperties, SpatializedDynamic3DElement, SpatializedElement, type SpatializedElementProperties, SpatializedElementType, SpatializedStatic3DElement, type SpatializedStatic3DElementProperties, type Vec3, type WorldAlignmentType, WorldAlignmentValues, type WorldScalingType, WorldScalingValues, isSSREnv, isValidBaseplateVisibilityType, isValidSceneUnit, isValidSpatialSceneType, isValidWorldAlignmentType, isValidWorldScalingType };
|