oomi-ai 0.2.39 → 0.2.40
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 +5 -3
- package/lib/personaRuntimeManager.js +21 -17
- package/lib/personaRuntimeProcess.js +392 -49
- package/lib/scaffold.js +14 -14
- package/openclaw.plugin.json +1 -1
- package/package.json +10 -8
- package/templates/persona-app/package.json +6 -4
- package/templates/persona-app/src/App.css +564 -79
- package/templates/persona-app/src/App.tsx +2 -2
- package/templates/persona-app/src/main.tsx +13 -0
- package/templates/persona-app/src/pages/HomePage.tsx +120 -39
- package/templates/persona-app/src/pages/ScenePage.tsx +2 -15
- package/templates/persona-app/src/persona/notes.ts +3 -1
- package/templates/persona-app/src/spatial.ts +82 -0
- package/templates/persona-app/template.json +1 -1
- package/templates/persona-app/vendor/webspatial/FORK.md +6 -0
- package/templates/persona-app/vendor/webspatial/core-sdk/LICENSE +21 -0
- package/templates/persona-app/vendor/webspatial/core-sdk/dist/iife/index.d.ts +906 -0
- package/templates/persona-app/vendor/webspatial/core-sdk/dist/iife/index.global.js +75 -0
- package/templates/persona-app/vendor/webspatial/core-sdk/dist/iife/index.global.js.map +1 -0
- package/templates/persona-app/vendor/webspatial/core-sdk/dist/index.d.ts +906 -0
- package/templates/persona-app/vendor/webspatial/core-sdk/dist/index.js +3131 -0
- package/templates/persona-app/vendor/webspatial/core-sdk/dist/index.js.map +1 -0
- package/templates/persona-app/vendor/webspatial/core-sdk/package.json +45 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/LICENSE +21 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/default/index.d.ts +365 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/default/index.js +4296 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/default/index.js.map +1 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.d.ts +82 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.js +66 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.js.map +1 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.web.d.ts +2 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.web.js +18 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.web.js.map +1 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.d.ts +5 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.js +66 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.js.map +1 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.web.d.ts +1 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.web.js +18 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.web.js.map +1 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/web/index.d.ts +365 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/web/index.js +4336 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/dist/web/index.js.map +1 -0
- package/templates/persona-app/vendor/webspatial/react-sdk/package.json +94 -0
- package/templates/persona-app/vite.config.ts +13 -0
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* Parent class of spatial objects, should not be used directly
|
|
4
|
+
*/
|
|
5
|
+
declare class SpatialObject {
|
|
6
|
+
/** @hidden */
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/** @hidden */
|
|
9
|
+
constructor(
|
|
10
|
+
/** @hidden */
|
|
11
|
+
id: string);
|
|
12
|
+
name?: string;
|
|
13
|
+
isDestroyed: boolean;
|
|
14
|
+
inspect(): Promise<any>;
|
|
15
|
+
destroy(): Promise<any>;
|
|
16
|
+
protected onDestroy(): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface CommandResult {
|
|
20
|
+
success: boolean;
|
|
21
|
+
data: any;
|
|
22
|
+
errorCode: string | undefined;
|
|
23
|
+
errorMessage: string | undefined;
|
|
24
|
+
}
|
|
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;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class SpatialGeometry extends SpatialObject {
|
|
36
|
+
id: string;
|
|
37
|
+
options: SpatialGeometryOptions;
|
|
38
|
+
static type: SpatialGeometryType;
|
|
39
|
+
constructor(id: string, options: SpatialGeometryOptions);
|
|
40
|
+
}
|
|
41
|
+
|
|
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
|
+
spatialrotate = "spatialrotate",
|
|
59
|
+
spatialrotateend = "spatialrotateend",
|
|
60
|
+
spatialmagnify = "spatialmagnify",
|
|
61
|
+
spatialmagnifyend = "spatialmagnifyend",
|
|
62
|
+
objectdestroy = "objectdestroy"
|
|
63
|
+
}
|
|
64
|
+
interface ObjectDestroyMsg {
|
|
65
|
+
type: SpatialWebMsgType.objectdestroy;
|
|
66
|
+
}
|
|
67
|
+
interface CubeInfoMsg {
|
|
68
|
+
type: SpatialWebMsgType.cubeInfo;
|
|
69
|
+
origin: Vec3;
|
|
70
|
+
size: Size3D;
|
|
71
|
+
}
|
|
72
|
+
interface CubeInfoMsg {
|
|
73
|
+
type: SpatialWebMsgType.cubeInfo;
|
|
74
|
+
origin: Vec3;
|
|
75
|
+
size: Size3D;
|
|
76
|
+
}
|
|
77
|
+
interface TransformMsg {
|
|
78
|
+
type: SpatialWebMsgType.transform;
|
|
79
|
+
detail: {
|
|
80
|
+
column0: [number, number, number];
|
|
81
|
+
column1: [number, number, number];
|
|
82
|
+
column2: [number, number, number];
|
|
83
|
+
column3: [number, number, number];
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
interface SpatialTapMsg {
|
|
87
|
+
type: SpatialWebMsgType.spatialtap;
|
|
88
|
+
detail: SpatialTapEventDetail;
|
|
89
|
+
}
|
|
90
|
+
interface SpatialDragStartMsg {
|
|
91
|
+
type: SpatialWebMsgType.spatialdragstart;
|
|
92
|
+
detail: SpatialDragStartEventDetail;
|
|
93
|
+
}
|
|
94
|
+
interface SpatialDragMsg {
|
|
95
|
+
type: SpatialWebMsgType.spatialdrag;
|
|
96
|
+
detail: SpatialDragEventDetail;
|
|
97
|
+
}
|
|
98
|
+
interface SpatialDragEndMsg {
|
|
99
|
+
type: SpatialWebMsgType.spatialdragend;
|
|
100
|
+
detail: SpatialDragEndEventDetail;
|
|
101
|
+
}
|
|
102
|
+
interface SpatialRotateMsg {
|
|
103
|
+
type: SpatialWebMsgType.spatialrotate;
|
|
104
|
+
detail: SpatialRotateEventDetail;
|
|
105
|
+
}
|
|
106
|
+
interface SpatialRotateEndMsg {
|
|
107
|
+
type: SpatialWebMsgType.spatialrotateend;
|
|
108
|
+
detail: SpatialRotateEventDetail;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Abstract base class for all spatialized elements in the WebSpatial environment.
|
|
113
|
+
* Provides common functionality for elements that can exist in 3D space,
|
|
114
|
+
* including transformation handling and gesture event processing.
|
|
115
|
+
*/
|
|
116
|
+
declare abstract class SpatializedElement extends SpatialObject {
|
|
117
|
+
readonly id: string;
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new spatialized element with the specified ID.
|
|
120
|
+
* Registers the element to receive spatial events.
|
|
121
|
+
* @param id Unique identifier for this element
|
|
122
|
+
*/
|
|
123
|
+
constructor(id: string);
|
|
124
|
+
/**
|
|
125
|
+
* Updates the properties of this spatialized element.
|
|
126
|
+
* Must be implemented by derived classes to handle specific property updates.
|
|
127
|
+
* @param properties Partial set of properties to update
|
|
128
|
+
* @returns Promise resolving to the result of the update operation
|
|
129
|
+
*/
|
|
130
|
+
abstract updateProperties(properties: Partial<SpatializedElementProperties>): Promise<WebSpatialProtocolResult>;
|
|
131
|
+
/**
|
|
132
|
+
* Updates the transformation matrix of this element in 3D space.
|
|
133
|
+
* This affects the position, rotation, and scale of the element.
|
|
134
|
+
* @param matrix The new transformation matrix
|
|
135
|
+
* @returns Promise resolving when the transform is updated
|
|
136
|
+
*/
|
|
137
|
+
updateTransform(matrix: DOMMatrix): Promise<CommandResult>;
|
|
138
|
+
/**
|
|
139
|
+
* Information about the element's bounding cube.
|
|
140
|
+
* Used for spatial calculations and hit testing.
|
|
141
|
+
*/
|
|
142
|
+
private _cubeInfo?;
|
|
143
|
+
/**
|
|
144
|
+
* Gets the current cube information for this element.
|
|
145
|
+
* @returns The current CubeInfo or undefined if not set
|
|
146
|
+
*/
|
|
147
|
+
get cubeInfo(): CubeInfo$1 | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* The current transformation matrix of this element.
|
|
150
|
+
*/
|
|
151
|
+
private _transform?;
|
|
152
|
+
/**
|
|
153
|
+
* The inverse of the current transformation matrix.
|
|
154
|
+
* Used for converting world coordinates to local coordinates.
|
|
155
|
+
*/
|
|
156
|
+
private _transformInv?;
|
|
157
|
+
/**
|
|
158
|
+
* Gets the current transformation matrix.
|
|
159
|
+
* @returns The current transformation matrix or undefined if not set
|
|
160
|
+
*/
|
|
161
|
+
get transform(): DOMMatrix | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Gets the inverse of the current transformation matrix.
|
|
164
|
+
* @returns The inverse transformation matrix or undefined if not set
|
|
165
|
+
*/
|
|
166
|
+
get transformInv(): DOMMatrix | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Processes events received from the WebSpatial environment.
|
|
169
|
+
* Handles various spatial events like transforms, gestures, and interactions.
|
|
170
|
+
* @param data The event data received from the WebSpatial system
|
|
171
|
+
*/
|
|
172
|
+
protected onReceiveEvent(data: CubeInfoMsg | TransformMsg | SpatialTapMsg | SpatialDragStartMsg | SpatialDragMsg | SpatialDragEndMsg | SpatialRotateMsg | SpatialRotateEndMsg | ObjectDestroyMsg): void;
|
|
173
|
+
private _onSpatialTap?;
|
|
174
|
+
set onSpatialTap(value: (event: SpatialTapEvent) => void | undefined);
|
|
175
|
+
private _onSpatialDragStart?;
|
|
176
|
+
set onSpatialDragStart(value: (event: SpatialDragStartEvent) => void | undefined);
|
|
177
|
+
private _onSpatialDrag?;
|
|
178
|
+
set onSpatialDrag(value: (event: SpatialDragEvent) => void | undefined);
|
|
179
|
+
private _onSpatialDragEnd?;
|
|
180
|
+
set onSpatialDragEnd(value: ((event: SpatialDragEndEvent) => void) | undefined);
|
|
181
|
+
private _onSpatialRotate?;
|
|
182
|
+
set onSpatialRotate(value: ((event: SpatialRotateEvent) => void) | undefined);
|
|
183
|
+
private _onSpatialRotateEnd?;
|
|
184
|
+
set onSpatialRotateEnd(value: ((event: SpatialRotateEndEvent) => void) | undefined);
|
|
185
|
+
private _onSpatialMagnify?;
|
|
186
|
+
set onSpatialMagnify(value: ((event: SpatialMagnifyEvent) => void) | undefined);
|
|
187
|
+
private _onSpatialMagnifyEnd?;
|
|
188
|
+
set onSpatialMagnifyEnd(value: ((event: SpatialMagnifyEndEvent) => void) | undefined);
|
|
189
|
+
/**
|
|
190
|
+
* Cleans up resources when this element is destroyed.
|
|
191
|
+
* Removes event receivers to prevent memory leaks.
|
|
192
|
+
*/
|
|
193
|
+
onDestroy(): void;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare class SpatializedDynamic3DElement extends SpatializedElement {
|
|
197
|
+
children: SpatialEntityOrReality[];
|
|
198
|
+
constructor(id: string);
|
|
199
|
+
addEntity(entity: SpatialEntity): Promise<CommandResult>;
|
|
200
|
+
updateProperties(properties: Partial<SpatializedElementProperties>): Promise<CommandResult>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface Vec3 {
|
|
204
|
+
x: number;
|
|
205
|
+
y: number;
|
|
206
|
+
z: number;
|
|
207
|
+
}
|
|
208
|
+
type Point3D = Vec3;
|
|
209
|
+
interface Quaternion {
|
|
210
|
+
x: number;
|
|
211
|
+
y: number;
|
|
212
|
+
z: number;
|
|
213
|
+
w: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Material type for SpatialDiv or HTML document.
|
|
217
|
+
*
|
|
218
|
+
* This type defines the background material options for both SpatialDiv elements and HTML documents.
|
|
219
|
+
*
|
|
220
|
+
* - `'none'`: This is the default value.
|
|
221
|
+
* - For HTML documents, the web page window will have the default native background.
|
|
222
|
+
* - For SpatialDiv, the window will have a transparent background.
|
|
223
|
+
* - `'translucent'`: Represents a glass-like material in AVP (Apple Vision Pro).
|
|
224
|
+
* - `'thick'`: Represents a thick material in AVP.
|
|
225
|
+
* - `'regular'`: Represents a regular material in AVP.
|
|
226
|
+
* - `'thin'`: Represents a thin material in AVP.
|
|
227
|
+
* - `'transparent'`: Represents a fully transparent background.
|
|
228
|
+
*/
|
|
229
|
+
type BackgroundMaterialType = 'none' | 'translucent' | 'thick' | 'regular' | 'thin' | 'transparent';
|
|
230
|
+
type CornerRadius = {
|
|
231
|
+
topLeading: number;
|
|
232
|
+
bottomLeading: number;
|
|
233
|
+
topTrailing: number;
|
|
234
|
+
bottomTrailing: number;
|
|
235
|
+
};
|
|
236
|
+
interface SpatialSceneProperties {
|
|
237
|
+
cornerRadius: CornerRadius;
|
|
238
|
+
material: BackgroundMaterialType;
|
|
239
|
+
opacity: number;
|
|
240
|
+
}
|
|
241
|
+
declare enum SpatializedElementType {
|
|
242
|
+
Spatialized2DElement = 0,
|
|
243
|
+
SpatializedStatic3DElement = 1,
|
|
244
|
+
SpatializedDynamic3DElement = 2
|
|
245
|
+
}
|
|
246
|
+
interface SpatializedElementProperties {
|
|
247
|
+
name: string;
|
|
248
|
+
clientX: number;
|
|
249
|
+
clientY: number;
|
|
250
|
+
width: number;
|
|
251
|
+
height: number;
|
|
252
|
+
depth: number;
|
|
253
|
+
opacity: number;
|
|
254
|
+
visible: boolean;
|
|
255
|
+
scrollWithParent: boolean;
|
|
256
|
+
zIndex: number;
|
|
257
|
+
backOffset: number;
|
|
258
|
+
rotationAnchor: Point3D;
|
|
259
|
+
enableTapGesture: boolean;
|
|
260
|
+
enableDragStartGesture: boolean;
|
|
261
|
+
enableDragGesture: boolean;
|
|
262
|
+
enableDragEndGesture: boolean;
|
|
263
|
+
enableRotateGesture: boolean;
|
|
264
|
+
enableRotateEndGesture: boolean;
|
|
265
|
+
enableMagnifyGesture: boolean;
|
|
266
|
+
enableMagnifyEndGesture: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Base64-encoded bitmap data for Android XR rendering.
|
|
269
|
+
* On Android, since we can't create multiple WebViews like visionOS,
|
|
270
|
+
* we capture HTML content as bitmaps and render them on SpatialPanels.
|
|
271
|
+
*/
|
|
272
|
+
bitmap: string;
|
|
273
|
+
}
|
|
274
|
+
interface Spatialized2DElementProperties extends SpatializedElementProperties {
|
|
275
|
+
scrollPageEnabled: boolean;
|
|
276
|
+
cornerRadius: CornerRadius;
|
|
277
|
+
material: BackgroundMaterialType;
|
|
278
|
+
scrollEdgeInsetsMarginRight: number;
|
|
279
|
+
}
|
|
280
|
+
interface SpatializedStatic3DElementProperties extends SpatializedElementProperties {
|
|
281
|
+
modelURL: string;
|
|
282
|
+
modelTransform?: number[];
|
|
283
|
+
}
|
|
284
|
+
interface SpatialSceneCreationOptions$1 {
|
|
285
|
+
defaultSize?: {
|
|
286
|
+
width: number | string;
|
|
287
|
+
height: number | string;
|
|
288
|
+
depth?: number | string;
|
|
289
|
+
};
|
|
290
|
+
resizability?: {
|
|
291
|
+
minWidth?: number | string;
|
|
292
|
+
minHeight?: number | string;
|
|
293
|
+
maxWidth?: number | string;
|
|
294
|
+
maxHeight?: number | string;
|
|
295
|
+
};
|
|
296
|
+
worldScaling?: WorldScalingType;
|
|
297
|
+
worldAlignment?: WorldAlignmentType;
|
|
298
|
+
baseplateVisibility?: BaseplateVisibilityType;
|
|
299
|
+
}
|
|
300
|
+
declare const BaseplateVisibilityValues: readonly ["automatic", "visible", "hidden"];
|
|
301
|
+
type BaseplateVisibilityType = (typeof BaseplateVisibilityValues)[number];
|
|
302
|
+
declare function isValidBaseplateVisibilityType(type: string): Boolean;
|
|
303
|
+
declare const WorldScalingValues: readonly ["automatic", "dynamic"];
|
|
304
|
+
type WorldScalingType = (typeof WorldScalingValues)[number];
|
|
305
|
+
declare function isValidWorldScalingType(type: string): Boolean;
|
|
306
|
+
declare const WorldAlignmentValues: readonly ["adaptive", "automatic", "gravityAligned"];
|
|
307
|
+
type WorldAlignmentType = (typeof WorldAlignmentValues)[number];
|
|
308
|
+
declare function isValidWorldAlignmentType(type: string): Boolean;
|
|
309
|
+
declare const SpatialSceneValues: readonly ["window", "volume"];
|
|
310
|
+
type SpatialSceneType$1 = (typeof SpatialSceneValues)[number];
|
|
311
|
+
declare function isValidSpatialSceneType(type: string): Boolean;
|
|
312
|
+
/**
|
|
313
|
+
* check px,m and number, number must be >= 0
|
|
314
|
+
*
|
|
315
|
+
* */
|
|
316
|
+
declare function isValidSceneUnit(val: string | number): boolean;
|
|
317
|
+
interface SpatialEntityProperties {
|
|
318
|
+
position: Vec3;
|
|
319
|
+
rotation: Vec3;
|
|
320
|
+
scale: Vec3;
|
|
321
|
+
}
|
|
322
|
+
type SpatialEntityEventType = 'spatialtap';
|
|
323
|
+
type SpatialGeometryType = 'BoxGeometry' | 'PlaneGeometry' | 'SphereGeometry' | 'CylinderGeometry' | 'ConeGeometry';
|
|
324
|
+
interface SpatialBoxGeometryOptions {
|
|
325
|
+
width?: number;
|
|
326
|
+
height?: number;
|
|
327
|
+
depth?: number;
|
|
328
|
+
cornerRadius?: number;
|
|
329
|
+
splitFaces?: boolean;
|
|
330
|
+
}
|
|
331
|
+
interface SpatialPlaneGeometryOptions {
|
|
332
|
+
width?: number;
|
|
333
|
+
height?: number;
|
|
334
|
+
cornerRadius?: number;
|
|
335
|
+
}
|
|
336
|
+
interface SpatialSphereGeometryOptions {
|
|
337
|
+
radius?: number;
|
|
338
|
+
}
|
|
339
|
+
interface SpatialConeGeometryOptions {
|
|
340
|
+
radius?: number;
|
|
341
|
+
height?: number;
|
|
342
|
+
}
|
|
343
|
+
interface SpatialCylinderGeometryOptions {
|
|
344
|
+
radius?: number;
|
|
345
|
+
height?: number;
|
|
346
|
+
}
|
|
347
|
+
type SpatialGeometryOptions = SpatialBoxGeometryOptions | SpatialPlaneGeometryOptions | SpatialSphereGeometryOptions | SpatialCylinderGeometryOptions | SpatialConeGeometryOptions;
|
|
348
|
+
type SpatialMaterialType = 'unlit';
|
|
349
|
+
interface SpatialUnlitMaterialOptions {
|
|
350
|
+
color?: string;
|
|
351
|
+
textureId?: string;
|
|
352
|
+
transparent?: boolean;
|
|
353
|
+
opacity?: number;
|
|
354
|
+
}
|
|
355
|
+
interface ModelComponentOptions {
|
|
356
|
+
mesh: SpatialGeometry;
|
|
357
|
+
materials: SpatialMaterial[];
|
|
358
|
+
}
|
|
359
|
+
interface SpatialEntityUserData {
|
|
360
|
+
id?: string;
|
|
361
|
+
name?: string;
|
|
362
|
+
}
|
|
363
|
+
interface SpatialModelEntityCreationOptions {
|
|
364
|
+
modelAssetId: string;
|
|
365
|
+
name?: string;
|
|
366
|
+
}
|
|
367
|
+
interface ModelAssetOptions {
|
|
368
|
+
url: string;
|
|
369
|
+
}
|
|
370
|
+
declare enum SpatialSceneState$1 {
|
|
371
|
+
idle = "idle",
|
|
372
|
+
pending = "pending",
|
|
373
|
+
willVisible = "willVisible",
|
|
374
|
+
visible = "visible",
|
|
375
|
+
fail = "fail"
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Translate event, matching similar behavior to https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drag_event
|
|
379
|
+
*/
|
|
380
|
+
type SpatialModelDragEvent = {
|
|
381
|
+
eventType: 'dragstart' | 'dragend' | 'drag';
|
|
382
|
+
translation3D: Vec3;
|
|
383
|
+
startLocation3D: Vec3;
|
|
384
|
+
};
|
|
385
|
+
interface Size {
|
|
386
|
+
width: number;
|
|
387
|
+
height: number;
|
|
388
|
+
}
|
|
389
|
+
interface Size3D extends Size {
|
|
390
|
+
depth: number;
|
|
391
|
+
}
|
|
392
|
+
declare class CubeInfo$1 {
|
|
393
|
+
size: Size3D;
|
|
394
|
+
origin: Vec3;
|
|
395
|
+
constructor(size: Size3D, origin: Vec3);
|
|
396
|
+
get x(): number;
|
|
397
|
+
get y(): number;
|
|
398
|
+
get z(): number;
|
|
399
|
+
get width(): number;
|
|
400
|
+
get height(): number;
|
|
401
|
+
get depth(): number;
|
|
402
|
+
get left(): number;
|
|
403
|
+
get top(): number;
|
|
404
|
+
get right(): number;
|
|
405
|
+
get bottom(): number;
|
|
406
|
+
get back(): number;
|
|
407
|
+
get front(): number;
|
|
408
|
+
}
|
|
409
|
+
interface SpatialTapEventDetail {
|
|
410
|
+
location3D: Point3D;
|
|
411
|
+
globalLocation3D?: Point3D;
|
|
412
|
+
}
|
|
413
|
+
type SpatialTapEvent = CustomEvent<SpatialTapEventDetail>;
|
|
414
|
+
interface SpatialDragStartEventDetail {
|
|
415
|
+
startLocation3D: Point3D;
|
|
416
|
+
globalLocation3D?: Point3D;
|
|
417
|
+
}
|
|
418
|
+
interface SpatialDragEventDetail {
|
|
419
|
+
translation3D: Vec3;
|
|
420
|
+
}
|
|
421
|
+
interface SpatialDragEndEventDetail {
|
|
422
|
+
}
|
|
423
|
+
type SpatialDragStartEvent = CustomEvent<SpatialDragStartEventDetail>;
|
|
424
|
+
type SpatialDragEvent = CustomEvent<SpatialDragEventDetail>;
|
|
425
|
+
type SpatialDragEndEvent = CustomEvent<SpatialDragEndEventDetail>;
|
|
426
|
+
interface SpatialRotateEventDetail {
|
|
427
|
+
quaternion: Quaternion;
|
|
428
|
+
}
|
|
429
|
+
interface SpatialRotateEndEventDetail {
|
|
430
|
+
}
|
|
431
|
+
type SpatialRotateEvent = CustomEvent<SpatialRotateEventDetail>;
|
|
432
|
+
type SpatialRotateEndEvent = CustomEvent<SpatialRotateEndEventDetail>;
|
|
433
|
+
interface SpatialMagnifyEventDetail {
|
|
434
|
+
magnification: number;
|
|
435
|
+
}
|
|
436
|
+
interface SpatialMagnifyEndEventDetail {
|
|
437
|
+
}
|
|
438
|
+
type SpatialMagnifyEvent = CustomEvent<SpatialMagnifyEventDetail>;
|
|
439
|
+
type SpatialMagnifyEndEvent = CustomEvent<SpatialMagnifyEndEventDetail>;
|
|
440
|
+
type SpatialEntityOrReality = SpatialEntity | SpatializedDynamic3DElement;
|
|
441
|
+
interface AttachmentEntityOptions {
|
|
442
|
+
parentEntityId: string;
|
|
443
|
+
position?: [number, number, number];
|
|
444
|
+
size: {
|
|
445
|
+
width: number;
|
|
446
|
+
height: number;
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
interface AttachmentEntityUpdateOptions {
|
|
450
|
+
position?: [number, number, number];
|
|
451
|
+
size?: {
|
|
452
|
+
width: number;
|
|
453
|
+
height: number;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
declare class SpatialComponent extends SpatialObject {
|
|
458
|
+
constructor(id: string);
|
|
459
|
+
private onReceiveEvent;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
declare class SpatialEntity extends SpatialObject {
|
|
463
|
+
userData?: SpatialEntityUserData | undefined;
|
|
464
|
+
position: Vec3;
|
|
465
|
+
rotation: Vec3;
|
|
466
|
+
scale: Vec3;
|
|
467
|
+
events: Record<string, (data: any) => void>;
|
|
468
|
+
children: SpatialEntity[];
|
|
469
|
+
parent: SpatialEntityOrReality | null;
|
|
470
|
+
constructor(id: string, userData?: SpatialEntityUserData | undefined);
|
|
471
|
+
addComponent(component: SpatialComponent): Promise<CommandResult>;
|
|
472
|
+
setPosition(position: Vec3): Promise<CommandResult>;
|
|
473
|
+
setRotation(rotation: Vec3): Promise<CommandResult>;
|
|
474
|
+
setScale(scale: Vec3): Promise<CommandResult>;
|
|
475
|
+
addEntity(ent: SpatialEntity): Promise<CommandResult>;
|
|
476
|
+
removeFromParent(): Promise<CommandResult>;
|
|
477
|
+
updateTransform(properties: Partial<SpatialEntityProperties>): Promise<CommandResult>;
|
|
478
|
+
addEvent(type: SpatialEntityEventType, callback: (data: any) => void): Promise<void>;
|
|
479
|
+
removeEvent(eventName: SpatialEntityEventType): Promise<void>;
|
|
480
|
+
updateEntityEvent(eventName: SpatialEntityEventType, isEnable: boolean): Promise<CommandResult>;
|
|
481
|
+
private onReceiveEvent;
|
|
482
|
+
dispatchEvent(evt: CustomEvent): void;
|
|
483
|
+
protected onDestroy(): void;
|
|
484
|
+
convertFromEntityToEntity(fromEntityId: string, toEntityId: string, position: Vec3): Promise<CommandResult>;
|
|
485
|
+
convertFromEntityToScene(fromEntityId: string, position: Vec3): Promise<CommandResult>;
|
|
486
|
+
convertFromSceneToEntity(entityId: string, position: Vec3): Promise<CommandResult>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare class SpatialModelEntity extends SpatialEntity {
|
|
490
|
+
id: string;
|
|
491
|
+
options?: SpatialModelEntityCreationOptions | undefined;
|
|
492
|
+
userData?: SpatialEntityUserData | undefined;
|
|
493
|
+
constructor(id: string, options?: SpatialModelEntityCreationOptions | undefined, userData?: SpatialEntityUserData | undefined);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
declare class ModelComponent extends SpatialComponent {
|
|
497
|
+
options: ModelComponentOptions;
|
|
498
|
+
constructor(id: string, options: ModelComponentOptions);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
declare class SpatialUnlitMaterial extends SpatialMaterial {
|
|
502
|
+
id: string;
|
|
503
|
+
options: SpatialUnlitMaterialOptions;
|
|
504
|
+
constructor(id: string, options: SpatialUnlitMaterialOptions);
|
|
505
|
+
updateProperties(properties: Partial<SpatialUnlitMaterialOptions>): Promise<CommandResult>;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
declare class SpatialBoxGeometry extends SpatialGeometry {
|
|
509
|
+
id: string;
|
|
510
|
+
options: SpatialBoxGeometryOptions;
|
|
511
|
+
static type: SpatialGeometryType;
|
|
512
|
+
constructor(id: string, options: SpatialBoxGeometryOptions);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
declare class SpatialSphereGeometry extends SpatialGeometry {
|
|
516
|
+
id: string;
|
|
517
|
+
options: SpatialSphereGeometryOptions;
|
|
518
|
+
static type: SpatialGeometryType;
|
|
519
|
+
constructor(id: string, options: SpatialSphereGeometryOptions);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
declare class SpatialCylinderGeometry extends SpatialGeometry {
|
|
523
|
+
id: string;
|
|
524
|
+
options: SpatialCylinderGeometryOptions;
|
|
525
|
+
static type: SpatialGeometryType;
|
|
526
|
+
constructor(id: string, options: SpatialCylinderGeometryOptions);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
declare class SpatialPlaneGeometry extends SpatialGeometry {
|
|
530
|
+
id: string;
|
|
531
|
+
options: SpatialPlaneGeometryOptions;
|
|
532
|
+
static type: SpatialGeometryType;
|
|
533
|
+
constructor(id: string, options: SpatialPlaneGeometryOptions);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
declare class SpatialConeGeometry extends SpatialGeometry {
|
|
537
|
+
id: string;
|
|
538
|
+
options: SpatialConeGeometryOptions;
|
|
539
|
+
static type: SpatialGeometryType;
|
|
540
|
+
constructor(id: string, options: SpatialConeGeometryOptions);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
declare class SpatialModelAsset extends SpatialObject {
|
|
544
|
+
id: string;
|
|
545
|
+
options: ModelAssetOptions;
|
|
546
|
+
constructor(id: string, options: ModelAssetOptions);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
declare class Attachment extends SpatialObject {
|
|
550
|
+
private readonly windowProxy;
|
|
551
|
+
private options;
|
|
552
|
+
constructor(id: string, windowProxy: WindowProxy, options: AttachmentEntityOptions);
|
|
553
|
+
getContainer(): HTMLElement;
|
|
554
|
+
getWindowProxy(): WindowProxy;
|
|
555
|
+
update(options: AttachmentEntityUpdateOptions): Promise<CommandResult | undefined>;
|
|
556
|
+
}
|
|
557
|
+
declare function createAttachmentEntity(options: AttachmentEntityOptions): Promise<Attachment>;
|
|
558
|
+
|
|
559
|
+
declare function initScene(name: string, callback: (pre: SpatialSceneCreationOptions$1) => SpatialSceneCreationOptions$1, options?: {
|
|
560
|
+
type: SpatialSceneType$1;
|
|
561
|
+
}): void;
|
|
562
|
+
|
|
563
|
+
type SpatialSceneCreationOptionsInternal = SpatialSceneCreationOptions$1 & {
|
|
564
|
+
type: SpatialSceneType$1;
|
|
565
|
+
};
|
|
566
|
+
declare enum SpatialSceneState {
|
|
567
|
+
idle = "idle",
|
|
568
|
+
pending = "pending",
|
|
569
|
+
willVisible = "willVisible",
|
|
570
|
+
visible = "visible",
|
|
571
|
+
fail = "fail"
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Represents the spatial scene that contains all spatialized elements.
|
|
576
|
+
* This class follows the singleton pattern - only one instance exists per application.
|
|
577
|
+
* The scene manages the overall spatial environment properties and contains all spatial elements.
|
|
578
|
+
*/
|
|
579
|
+
declare class SpatialScene extends SpatialObject {
|
|
580
|
+
/**
|
|
581
|
+
* Gets the singleton instance of the SpatialScene.
|
|
582
|
+
* Creates a new instance if one doesn't exist yet.
|
|
583
|
+
* @returns The singleton SpatialScene instance
|
|
584
|
+
*/
|
|
585
|
+
static getInstance(): SpatialScene;
|
|
586
|
+
/**
|
|
587
|
+
* Updates the properties of the spatial scene.
|
|
588
|
+
* This can include background settings, lighting, and other scene-wide properties.
|
|
589
|
+
* @param properties Partial set of properties to update
|
|
590
|
+
* @returns Promise resolving when the update is complete
|
|
591
|
+
*/
|
|
592
|
+
updateSpatialProperties(properties: Partial<SpatialSceneProperties>): Promise<CommandResult>;
|
|
593
|
+
/**
|
|
594
|
+
* Adds a spatialized element to the scene.
|
|
595
|
+
* This makes the element visible and interactive in the spatial environment.
|
|
596
|
+
* @param element The SpatializedElement to add to the scene
|
|
597
|
+
* @returns Promise resolving when the element is added
|
|
598
|
+
*/
|
|
599
|
+
addSpatializedElement(element: SpatializedElement): Promise<CommandResult>;
|
|
600
|
+
/**
|
|
601
|
+
* Updates the scene creation configuration.
|
|
602
|
+
* This allows changing scene parameters after initial creation.
|
|
603
|
+
* @param config The new scene creation configuration
|
|
604
|
+
* @returns Promise resolving when the update is complete
|
|
605
|
+
*/
|
|
606
|
+
updateSceneCreationConfig(config: SpatialSceneCreationOptionsInternal): Promise<CommandResult>;
|
|
607
|
+
/**
|
|
608
|
+
* Gets the current state of the spatial scene.
|
|
609
|
+
* This includes information about active elements and scene configuration.
|
|
610
|
+
* @returns Promise resolving to the current SpatialSceneState
|
|
611
|
+
*/
|
|
612
|
+
getState(): Promise<SpatialSceneState>;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Represents a 2D HTML element that has been spatialized in 3D space.
|
|
617
|
+
* This class handles the integration between 2D web content and the 3D spatial environment,
|
|
618
|
+
* allowing HTML elements to be positioned and interacted with in spatial applications.
|
|
619
|
+
*/
|
|
620
|
+
declare class Spatialized2DElement extends SpatializedElement {
|
|
621
|
+
readonly windowProxy: WindowProxy;
|
|
622
|
+
/**
|
|
623
|
+
* Creates a new spatialized 2D element.
|
|
624
|
+
* @param id Unique identifier for this element
|
|
625
|
+
* @param windowProxy Reference to the window object containing the 2D content
|
|
626
|
+
*/
|
|
627
|
+
constructor(id: string, windowProxy: WindowProxy);
|
|
628
|
+
/**
|
|
629
|
+
* Updates the properties of this 2D element.
|
|
630
|
+
* This can include size, position, background, and other visual properties.
|
|
631
|
+
* @param properties Partial set of properties to update
|
|
632
|
+
* @returns Promise resolving when the update is complete
|
|
633
|
+
*/
|
|
634
|
+
updateProperties(properties: Partial<Spatialized2DElementProperties>): Promise<CommandResult>;
|
|
635
|
+
/**
|
|
636
|
+
* Adds a child spatialized element to this 2D element.
|
|
637
|
+
* This allows for creating hierarchical structures of spatial elements.
|
|
638
|
+
* @param element The child element to add
|
|
639
|
+
* @returns Promise resolving when the element is added
|
|
640
|
+
*/
|
|
641
|
+
addSpatializedElement(element: SpatializedElement): Promise<CommandResult>;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Represents a static 3D model element in the spatial environment.
|
|
646
|
+
* This class handles loading and displaying pre-built 3D models from URLs,
|
|
647
|
+
* and provides events for load success and failure.
|
|
648
|
+
*/
|
|
649
|
+
declare class SpatializedStatic3DElement extends SpatializedElement {
|
|
650
|
+
/**
|
|
651
|
+
* Creates a new spatialized static 3D element with the specified ID and URL.
|
|
652
|
+
* Registers the element to receive spatial events.
|
|
653
|
+
* @param id Unique identifier for this element
|
|
654
|
+
* @param modelURL URL of the 3D model
|
|
655
|
+
*/
|
|
656
|
+
constructor(id: string, modelURL: string);
|
|
657
|
+
/**
|
|
658
|
+
* Promise resolver for the ready state.
|
|
659
|
+
* Used to resolve the ready promise when the model is loaded.
|
|
660
|
+
*/
|
|
661
|
+
private _readyResolve?;
|
|
662
|
+
/**
|
|
663
|
+
* Caches the last model URL to detect changes.
|
|
664
|
+
* Used to reset the ready promise when the model URL changes.
|
|
665
|
+
*/
|
|
666
|
+
private modelURL;
|
|
667
|
+
/**
|
|
668
|
+
* Creates a new promise for tracking the ready state of the model.
|
|
669
|
+
* @returns Promise that resolves when the model is loaded (true) or fails to load (false)
|
|
670
|
+
*/
|
|
671
|
+
private createReadyPromise;
|
|
672
|
+
/**
|
|
673
|
+
* Promise that resolves when the model is loaded.
|
|
674
|
+
* Resolves to true on successful load, false on failure.
|
|
675
|
+
*/
|
|
676
|
+
ready: Promise<boolean>;
|
|
677
|
+
/**
|
|
678
|
+
* Updates the properties of this static 3D element.
|
|
679
|
+
* Handles special case for modelURL changes by resetting the ready promise.
|
|
680
|
+
* @param properties Partial set of properties to update
|
|
681
|
+
* @returns Promise resolving when the update is complete
|
|
682
|
+
*/
|
|
683
|
+
updateProperties(properties: Partial<SpatializedStatic3DElementProperties>): Promise<CommandResult>;
|
|
684
|
+
/**
|
|
685
|
+
* Processes events received from the WebSpatial environment.
|
|
686
|
+
* Handles model loading events in addition to base spatial events.
|
|
687
|
+
* @param data The event data received from the WebSpatial system
|
|
688
|
+
*/
|
|
689
|
+
onReceiveEvent(data: {
|
|
690
|
+
type: SpatialWebMsgType;
|
|
691
|
+
}): void;
|
|
692
|
+
/**
|
|
693
|
+
* Callback function for successful model loading.
|
|
694
|
+
*/
|
|
695
|
+
private _onLoadCallback?;
|
|
696
|
+
/**
|
|
697
|
+
* Sets the callback function for successful model loading.
|
|
698
|
+
* @param callback Function to call when the model is loaded successfully
|
|
699
|
+
*/
|
|
700
|
+
set onLoadCallback(callback: undefined | (() => void));
|
|
701
|
+
/**
|
|
702
|
+
* Callback function for model loading failure.
|
|
703
|
+
*/
|
|
704
|
+
private _onLoadFailureCallback?;
|
|
705
|
+
/**
|
|
706
|
+
* Sets the callback function for model loading failure.
|
|
707
|
+
* @param callback Function to call when the model fails to load
|
|
708
|
+
*/
|
|
709
|
+
set onLoadFailureCallback(callback: undefined | (() => void));
|
|
710
|
+
updateModelTransform(transform: DOMMatrixReadOnly): void;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Session used to establish a connection to the spatial renderer of the system.
|
|
715
|
+
* All spatial resources must be created through this session object.
|
|
716
|
+
* This class serves as the main factory for creating spatial elements and geometries.
|
|
717
|
+
*/
|
|
718
|
+
declare class SpatialSession {
|
|
719
|
+
/**
|
|
720
|
+
* Gets the singleton instance of the spatial scene.
|
|
721
|
+
* The spatial scene is the root container for all spatial elements.
|
|
722
|
+
* @returns The SpatialScene singleton instance
|
|
723
|
+
*/
|
|
724
|
+
getSpatialScene(): SpatialScene;
|
|
725
|
+
/**
|
|
726
|
+
* Creates a new 2D element that can be spatialized in the 3D environment.
|
|
727
|
+
* 2D elements represent HTML content that can be positioned in 3D space.
|
|
728
|
+
* @returns Promise resolving to a new Spatialized2DElement instance
|
|
729
|
+
*/
|
|
730
|
+
createSpatialized2DElement(): Promise<Spatialized2DElement>;
|
|
731
|
+
/**
|
|
732
|
+
* Creates a new static 3D element with an optional model URL.
|
|
733
|
+
* Static 3D elements represent pre-built 3D models that can be loaded from a URL.
|
|
734
|
+
* @param modelURL Optional URL to the 3D model to load
|
|
735
|
+
* @returns Promise resolving to a new SpatializedStatic3DElement instance
|
|
736
|
+
*/
|
|
737
|
+
createSpatializedStatic3DElement(modelURL: string): Promise<SpatializedStatic3DElement>;
|
|
738
|
+
/**
|
|
739
|
+
* Initializes the spatial scene with custom configuration.
|
|
740
|
+
* This is a reference to the initScene function from scene-polyfill.
|
|
741
|
+
*/
|
|
742
|
+
initScene: typeof initScene;
|
|
743
|
+
/**
|
|
744
|
+
* Creates a new dynamic 3D element that can be manipulated at runtime.
|
|
745
|
+
* Dynamic 3D elements allow for programmatic creation and modification of 3D content.
|
|
746
|
+
* @returns Promise resolving to a new SpatializedDynamic3DElement instance
|
|
747
|
+
*/
|
|
748
|
+
createSpatializedDynamic3DElement(): Promise<SpatializedDynamic3DElement>;
|
|
749
|
+
/**
|
|
750
|
+
* Creates a new spatial entity with an optional name.
|
|
751
|
+
* Entities are the basic building blocks for creating custom 3D content.
|
|
752
|
+
* @param name Optional name for the entity
|
|
753
|
+
* @returns Promise resolving to a new SpatialEntity instance
|
|
754
|
+
*/
|
|
755
|
+
createEntity(userData?: SpatialEntityUserData): Promise<SpatialEntity>;
|
|
756
|
+
/**
|
|
757
|
+
* Creates a box geometry with optional configuration.
|
|
758
|
+
* @param options Configuration options for the box geometry
|
|
759
|
+
* @returns Promise resolving to a new SpatialBoxGeometry instance
|
|
760
|
+
*/
|
|
761
|
+
createBoxGeometry(options?: SpatialBoxGeometryOptions): Promise<SpatialBoxGeometry>;
|
|
762
|
+
/**
|
|
763
|
+
* Creates a plane geometry with optional configuration.
|
|
764
|
+
* @param options Configuration options for the plane geometry
|
|
765
|
+
* @returns Promise resolving to a new SpatialPlaneGeometry instance
|
|
766
|
+
*/
|
|
767
|
+
createPlaneGeometry(options?: SpatialPlaneGeometryOptions): Promise<SpatialPlaneGeometry>;
|
|
768
|
+
/**
|
|
769
|
+
* Creates a sphere geometry with optional configuration.
|
|
770
|
+
* @param options Configuration options for the sphere geometry
|
|
771
|
+
* @returns Promise resolving to a new SpatialSphereGeometry instance
|
|
772
|
+
*/
|
|
773
|
+
createSphereGeometry(options?: SpatialSphereGeometryOptions): Promise<SpatialSphereGeometry>;
|
|
774
|
+
/**
|
|
775
|
+
* Creates a cone geometry with the specified configuration.
|
|
776
|
+
* @param options Configuration options for the cone geometry
|
|
777
|
+
* @returns Promise resolving to a new SpatialConeGeometry instance
|
|
778
|
+
*/
|
|
779
|
+
createConeGeometry(options: SpatialConeGeometryOptions): Promise<SpatialConeGeometry>;
|
|
780
|
+
/**
|
|
781
|
+
* Creates a cylinder geometry with the specified configuration.
|
|
782
|
+
* @param options Configuration options for the cylinder geometry
|
|
783
|
+
* @returns Promise resolving to a new SpatialCylinderGeometry instance
|
|
784
|
+
*/
|
|
785
|
+
createCylinderGeometry(options: SpatialCylinderGeometryOptions): Promise<SpatialCylinderGeometry>;
|
|
786
|
+
/**
|
|
787
|
+
* Creates a model component with the specified configuration.
|
|
788
|
+
* Model components are used to add 3D model rendering capabilities to entities.
|
|
789
|
+
* @param options Configuration options for the model component
|
|
790
|
+
* @returns Promise resolving to a new ModelComponent instance
|
|
791
|
+
*/
|
|
792
|
+
createModelComponent(options: ModelComponentOptions): Promise<ModelComponent>;
|
|
793
|
+
/**
|
|
794
|
+
* Creates an unlit material with the specified configuration.
|
|
795
|
+
* Unlit materials don't respond to lighting in the scene.
|
|
796
|
+
* @param options Configuration options for the unlit material
|
|
797
|
+
* @returns Promise resolving to a new SpatialUnlitMaterial instance
|
|
798
|
+
*/
|
|
799
|
+
createUnlitMaterial(options: SpatialUnlitMaterialOptions): Promise<SpatialUnlitMaterial>;
|
|
800
|
+
/**
|
|
801
|
+
* Creates a model asset with the specified configuration.
|
|
802
|
+
* Model assets represent 3D model resources that can be used by entities.
|
|
803
|
+
* @param options Configuration options for the model asset
|
|
804
|
+
* @returns Promise resolving to a new SpatialModelAsset instance
|
|
805
|
+
*/
|
|
806
|
+
createModelAsset(options: ModelAssetOptions): Promise<SpatialModelAsset>;
|
|
807
|
+
/**
|
|
808
|
+
* Creates a spatial model entity with the specified configuration.
|
|
809
|
+
* This is a convenience method for creating an entity with a model component.
|
|
810
|
+
* @param options Configuration options for the spatial model entity
|
|
811
|
+
* @returns Promise resolving to a new SpatialModelEntity instance
|
|
812
|
+
*/
|
|
813
|
+
createSpatialModelEntity(options: SpatialModelEntityCreationOptions, userData?: SpatialEntityUserData): Promise<SpatialModelEntity>;
|
|
814
|
+
/**
|
|
815
|
+
* Creates an attachment entity that renders 2D HTML content as a child
|
|
816
|
+
* of a 3D entity in the scene graph.
|
|
817
|
+
* @param options Configuration options including parent entity ID, position, and size
|
|
818
|
+
* @returns Promise resolving to a new Attachment instance
|
|
819
|
+
*/
|
|
820
|
+
createAttachmentEntity(options: AttachmentEntityOptions): Promise<Attachment>;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Base object designed to be placed on navigator.spatial to mirror navigator.xr for webxr.
|
|
825
|
+
* This is the main entry point for the WebSpatial SDK, providing access to spatial capabilities.
|
|
826
|
+
*/
|
|
827
|
+
declare class Spatial {
|
|
828
|
+
/**
|
|
829
|
+
* Requests a spatial session object from the browser.
|
|
830
|
+
* This is the primary method to initialize spatial functionality.
|
|
831
|
+
* @returns The SpatialSession instance or null if not available in the current browser
|
|
832
|
+
* [TODO] discuss implications of this not being async
|
|
833
|
+
*/
|
|
834
|
+
requestSession(): SpatialSession | null;
|
|
835
|
+
/**
|
|
836
|
+
* Checks if the current page is running in a spatial web environment.
|
|
837
|
+
* This method detects if the application is running in a WebSpatial-compatible browser.
|
|
838
|
+
* @returns True if running in a spatial web environment, false otherwise
|
|
839
|
+
*/
|
|
840
|
+
runInSpatialWeb(): boolean;
|
|
841
|
+
/** @deprecated
|
|
842
|
+
* Checks if WebSpatial is supported in the current environment.
|
|
843
|
+
* Verifies compatibility between native and client versions.
|
|
844
|
+
* @returns True if web spatial is supported by this webpage
|
|
845
|
+
*/
|
|
846
|
+
isSupported(): boolean;
|
|
847
|
+
/** @deprecated
|
|
848
|
+
* Gets the native WebSpatial version from the browser environment.
|
|
849
|
+
* The version format follows semantic versioning (x.x.x).
|
|
850
|
+
* @returns Native version string in format "x.x.x"
|
|
851
|
+
*/
|
|
852
|
+
getNativeVersion(): any;
|
|
853
|
+
/** @deprecated
|
|
854
|
+
* Gets the client SDK version.
|
|
855
|
+
* The version format follows semantic versioning (x.x.x).
|
|
856
|
+
* @returns Client SDK version string in format "x.x.x"
|
|
857
|
+
*/
|
|
858
|
+
getClientVersion(): string;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
declare global {
|
|
862
|
+
declare const __WEBSPATIAL_CORE_SDK_VERSION__: string
|
|
863
|
+
|
|
864
|
+
interface Window {
|
|
865
|
+
xrCurrentSceneType: SpatialSceneType
|
|
866
|
+
xrCurrentSceneDefaults: (
|
|
867
|
+
defaultConfig: SpatialSceneCreationOptions,
|
|
868
|
+
) => Promise<SpatialSceneCreationOptions>
|
|
869
|
+
|
|
870
|
+
// Location for webspatial custom functions
|
|
871
|
+
__WebSpatialData: {
|
|
872
|
+
androidNativeMessage: Function
|
|
873
|
+
getNativeVersion: Function
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// Location for webspatial internal callbacks (eg. completion events)
|
|
877
|
+
__SpatialWebEvent: Function
|
|
878
|
+
|
|
879
|
+
// Used to access webkit specific api
|
|
880
|
+
webkit: any
|
|
881
|
+
webspatialBridge: any
|
|
882
|
+
|
|
883
|
+
// Will be removed in favor of __WebSpatialData
|
|
884
|
+
WebSpatailNativeVersion: string
|
|
885
|
+
|
|
886
|
+
__webspatialsdk__?: {
|
|
887
|
+
XR_ENV?: string
|
|
888
|
+
'natvie-version'?: string
|
|
889
|
+
'react-sdk-version'?: string
|
|
890
|
+
'core-sdk-version'?: string
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
innerDepth: number
|
|
894
|
+
outerDepth: number
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
interface HTMLElement {
|
|
898
|
+
offsetBack: number
|
|
899
|
+
clientDepth: number
|
|
900
|
+
getBoundingClientCube: () => CubeInfo | undefined
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
declare const isSSREnv: () => boolean;
|
|
905
|
+
|
|
906
|
+
export { Attachment, type AttachmentEntityOptions, type AttachmentEntityUpdateOptions, type BackgroundMaterialType, type BaseplateVisibilityType, BaseplateVisibilityValues, type CornerRadius, CubeInfo$1 as CubeInfo, type ModelAssetOptions, ModelComponent, type ModelComponentOptions, type Point3D, type Quaternion, type Size, type Size3D, Spatial, SpatialBoxGeometry, type SpatialBoxGeometryOptions, SpatialComponent, SpatialConeGeometry, type SpatialConeGeometryOptions, SpatialCylinderGeometry, type SpatialCylinderGeometryOptions, type SpatialDragEndEvent, type SpatialDragEndEventDetail, type SpatialDragEvent, type SpatialDragEventDetail, type SpatialDragStartEvent, type SpatialDragStartEventDetail, SpatialEntity, type SpatialEntityEventType, type SpatialEntityOrReality, type SpatialEntityProperties, type SpatialEntityUserData, SpatialGeometry, type SpatialGeometryOptions, type SpatialGeometryType, type SpatialMagnifyEndEvent, type SpatialMagnifyEndEventDetail, type SpatialMagnifyEvent, type SpatialMagnifyEventDetail, SpatialMaterial, type SpatialMaterialType, SpatialModelAsset, type SpatialModelDragEvent, SpatialModelEntity, type SpatialModelEntityCreationOptions, SpatialObject, SpatialPlaneGeometry, type SpatialPlaneGeometryOptions, type SpatialRotateEndEvent, type SpatialRotateEndEventDetail, 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, createAttachmentEntity, isSSREnv, isValidBaseplateVisibilityType, isValidSceneUnit, isValidSpatialSceneType, isValidWorldAlignmentType, isValidWorldScalingType };
|