@webspatial/core-sdk 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/iife/index.d.ts +386 -236
- package/dist/iife/index.global.js +7 -7
- package/dist/iife/index.global.js.map +1 -1
- package/dist/index.d.ts +386 -236
- package/dist/index.js +1479 -1226
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/JSBCommand.ts +30 -100
- package/src/Spatial.ts +0 -21
- package/src/SpatialScene.ts +1 -5
- package/src/SpatialSession.ts +17 -3
- package/src/SpatializedDynamic3DElement.ts +0 -1
- package/src/SpatializedElementCreator.ts +6 -4
- package/src/SpatializedStatic3DElement.test.ts +99 -0
- package/src/SpatializedStatic3DElement.ts +99 -1
- package/src/WebMsgCommand.ts +10 -0
- package/src/coverage-boost.test.ts +38 -119
- package/src/index.ts +3 -1
- package/src/jsbcommand.coverage.test.ts +19 -48
- package/src/platform-adapter/CommandResultUtils.ts +2 -2
- package/src/platform-adapter/createPlatformSync.ts +34 -0
- package/src/platform-adapter/index.ts +5 -51
- package/src/platform-adapter/interface.ts +35 -23
- package/src/platform-adapter/pico-os/PicoOSPlatform.ts +84 -52
- package/src/platform-adapter/puppeteer/PuppeteerPlatform.ts +37 -11
- package/src/platform-adapter/spatialSceneQuery.ts +17 -0
- package/src/platform-adapter/ssr/SSRPlatform.ts +24 -15
- package/src/platform-adapter/vision-os/VisionOSPlatform.ts +55 -24
- package/src/platform-runtime.ts +13 -0
- package/src/reality/Attachment.ts +2 -2
- package/src/reality/entity/SpatialEntity.ts +0 -2
- package/src/reality/realityCreator.ts +15 -1
- package/src/reality/resource/SpatialTextureResource.ts +16 -0
- package/src/reality/resource/index.ts +1 -0
- package/src/runtime/WebSpatialRuntimeError.ts +16 -0
- package/src/runtime/capability-data.ts +113 -0
- package/src/runtime/contract-review.test.ts +44 -0
- package/src/runtime/index.ts +28 -0
- package/src/runtime/jsbAdapterPlatform.test.ts +36 -0
- package/src/runtime/jsbAdapterPlatform.ts +51 -0
- package/src/runtime/keys.ts +129 -0
- package/src/runtime/semver.ts +33 -0
- package/src/runtime/supports.test.ts +207 -0
- package/src/runtime/supports.ts +110 -0
- package/src/runtime/types.ts +11 -0
- package/src/runtime/userAgent.ts +64 -0
- package/src/scene-polyfill.manifest.test.ts +7 -5
- package/src/scene-polyfill.test.ts +60 -0
- package/src/scene-polyfill.ts +23 -22
- package/src/spatial-host.ts +25 -0
- package/src/types/{global.d.ts → global.ts} +10 -5
- package/src/types/types.ts +9 -0
- package/src/platform-adapter/android/AndroidPlatform.ts +0 -133
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
+
type PhysicalMetricsValueShape = {
|
|
2
|
+
meterToPtUnscaled: number;
|
|
3
|
+
meterToPtScaled: number;
|
|
4
|
+
};
|
|
5
|
+
type WorldScalingCompensation = 'unscaled' | 'scaled';
|
|
6
|
+
type ConvertOption = {
|
|
7
|
+
worldScalingCompensation: WorldScalingCompensation;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Converts scene points (pt) to physical meters (m).
|
|
11
|
+
*
|
|
12
|
+
* @param point Points value to convert.
|
|
13
|
+
* @param options Optional conversion options to select world scaling compensation.
|
|
14
|
+
* @returns Physical length in meters.
|
|
15
|
+
*/
|
|
16
|
+
declare function pointToPhysical(point: number, options?: ConvertOption): number;
|
|
17
|
+
/**
|
|
18
|
+
* Converts physical meters (m) to scene points (pt).
|
|
19
|
+
*
|
|
20
|
+
* @param physical Physical length in meters to convert.
|
|
21
|
+
* @param options Optional conversion options to select world scaling compensation.
|
|
22
|
+
* @returns Points length in the scene.
|
|
23
|
+
*/
|
|
24
|
+
declare function physicalToPoint(physical: number, options?: ConvertOption): number;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the current physical metrics used for conversions.
|
|
27
|
+
*
|
|
28
|
+
* @returns The current metrics snapshot `{ meterToPtUnscaled, meterToPtScaled }`.
|
|
29
|
+
*/
|
|
30
|
+
declare function getValue(): PhysicalMetricsValueShape;
|
|
31
|
+
/**
|
|
32
|
+
* Subscribes to physical metrics changes.
|
|
33
|
+
*
|
|
34
|
+
* @param cb Callback invoked when metrics update is detected.
|
|
35
|
+
* @returns Unsubscribe function to remove the listener.
|
|
36
|
+
*/
|
|
37
|
+
declare function subscribe(cb: () => void): () => void;
|
|
38
|
+
|
|
39
|
+
type physicalMetrics_PhysicalMetricsValueShape = PhysicalMetricsValueShape;
|
|
40
|
+
declare const physicalMetrics_getValue: typeof getValue;
|
|
41
|
+
declare const physicalMetrics_physicalToPoint: typeof physicalToPoint;
|
|
42
|
+
declare const physicalMetrics_pointToPhysical: typeof pointToPhysical;
|
|
43
|
+
declare const physicalMetrics_subscribe: typeof subscribe;
|
|
44
|
+
declare namespace physicalMetrics {
|
|
45
|
+
export { type physicalMetrics_PhysicalMetricsValueShape as PhysicalMetricsValueShape, physicalMetrics_getValue as getValue, physicalMetrics_physicalToPoint as physicalToPoint, physicalMetrics_pointToPhysical as pointToPhysical, physicalMetrics_subscribe as subscribe };
|
|
46
|
+
}
|
|
47
|
+
|
|
1
48
|
/**
|
|
2
49
|
* @hidden
|
|
3
50
|
* Parent class of spatial objects, should not be used directly
|
|
@@ -16,22 +63,6 @@ declare class SpatialObject {
|
|
|
16
63
|
protected onDestroy(): void;
|
|
17
64
|
}
|
|
18
65
|
|
|
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
66
|
declare class SpatialGeometry extends SpatialObject {
|
|
36
67
|
id: string;
|
|
37
68
|
options: SpatialGeometryOptions;
|
|
@@ -46,6 +77,142 @@ declare abstract class SpatialMaterial extends SpatialObject {
|
|
|
46
77
|
abstract updateProperties(properties: any): void;
|
|
47
78
|
}
|
|
48
79
|
|
|
80
|
+
type SpatialSceneCreationOptionsInternal = SpatialSceneCreationOptions & {
|
|
81
|
+
type: SpatialSceneType;
|
|
82
|
+
};
|
|
83
|
+
declare enum SpatialSceneState$1 {
|
|
84
|
+
idle = "idle",
|
|
85
|
+
pending = "pending",
|
|
86
|
+
willVisible = "willVisible",
|
|
87
|
+
visible = "visible",
|
|
88
|
+
fail = "fail"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface CommandResult<TData = any> {
|
|
92
|
+
success: boolean;
|
|
93
|
+
data: TData;
|
|
94
|
+
errorCode: string | undefined;
|
|
95
|
+
errorMessage: string | undefined;
|
|
96
|
+
}
|
|
97
|
+
type WebSpatialProtocolResult = CommandResult<{
|
|
98
|
+
windowProxy: any;
|
|
99
|
+
id: string;
|
|
100
|
+
} | undefined>;
|
|
101
|
+
|
|
102
|
+
declare class SpatialComponent extends SpatialObject {
|
|
103
|
+
constructor(id: string);
|
|
104
|
+
private onReceiveEvent;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare class SpatialEntity extends SpatialObject {
|
|
108
|
+
userData?: SpatialEntityUserData | undefined;
|
|
109
|
+
position: Vec3;
|
|
110
|
+
rotation: Vec3;
|
|
111
|
+
scale: Vec3;
|
|
112
|
+
events: Record<string, (data: any) => void>;
|
|
113
|
+
children: SpatialEntity[];
|
|
114
|
+
parent: SpatialEntityOrReality | null;
|
|
115
|
+
private _enableInput;
|
|
116
|
+
get enableInput(): boolean;
|
|
117
|
+
set enableInput(value: boolean);
|
|
118
|
+
constructor(id: string, userData?: SpatialEntityUserData | undefined);
|
|
119
|
+
addComponent(component: SpatialComponent): Promise<CommandResult<any>>;
|
|
120
|
+
removeComponent(component: SpatialComponent): Promise<CommandResult<any>>;
|
|
121
|
+
setPosition(position: Vec3): Promise<CommandResult<any>>;
|
|
122
|
+
setRotation(rotation: Vec3): Promise<CommandResult<any>>;
|
|
123
|
+
setScale(scale: Vec3): Promise<CommandResult<any>>;
|
|
124
|
+
addEntity(ent: SpatialEntity): Promise<CommandResult<any>>;
|
|
125
|
+
removeFromParent(): Promise<CommandResult<any>>;
|
|
126
|
+
updateTransform(properties: Partial<SpatialEntityProperties>): Promise<CommandResult<any>>;
|
|
127
|
+
addEvent(type: SpatialEntityEventType, callback: (data: any) => void): Promise<void>;
|
|
128
|
+
removeEvent(eventName: SpatialEntityEventType): Promise<void>;
|
|
129
|
+
updateEntityEvent(eventName: SpatialEntityEventType, isEnable: boolean): Promise<CommandResult<any>>;
|
|
130
|
+
private onReceiveEvent;
|
|
131
|
+
dispatchEvent(evt: CustomEvent): void;
|
|
132
|
+
protected onDestroy(): void;
|
|
133
|
+
convertFromEntityToEntity(fromEntityId: string, toEntityId: string, position: Vec3): Promise<CommandResult<any>>;
|
|
134
|
+
convertFromEntityToScene(fromEntityId: string, position: Vec3): Promise<CommandResult<any>>;
|
|
135
|
+
convertFromSceneToEntity(entityId: string, position: Vec3): Promise<CommandResult<any>>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
declare class SpatialModelEntity extends SpatialEntity {
|
|
139
|
+
id: string;
|
|
140
|
+
options?: SpatialModelEntityCreationOptions | undefined;
|
|
141
|
+
userData?: SpatialEntityUserData | undefined;
|
|
142
|
+
constructor(id: string, options?: SpatialModelEntityCreationOptions | undefined, userData?: SpatialEntityUserData | undefined);
|
|
143
|
+
setMaterials(materials: SpatialMaterial[]): Promise<CommandResult<any>>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare class ModelComponent extends SpatialComponent {
|
|
147
|
+
options: ModelComponentOptions;
|
|
148
|
+
constructor(id: string, options: ModelComponentOptions);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare class SpatialUnlitMaterial extends SpatialMaterial {
|
|
152
|
+
id: string;
|
|
153
|
+
options: SpatialUnlitMaterialOptions;
|
|
154
|
+
constructor(id: string, options: SpatialUnlitMaterialOptions);
|
|
155
|
+
updateProperties(properties: Partial<SpatialUnlitMaterialOptions>): Promise<CommandResult<any>>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare class SpatialBoxGeometry extends SpatialGeometry {
|
|
159
|
+
id: string;
|
|
160
|
+
options: SpatialBoxGeometryOptions;
|
|
161
|
+
static type: SpatialGeometryType;
|
|
162
|
+
constructor(id: string, options: SpatialBoxGeometryOptions);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
declare class SpatialSphereGeometry extends SpatialGeometry {
|
|
166
|
+
id: string;
|
|
167
|
+
options: SpatialSphereGeometryOptions;
|
|
168
|
+
static type: SpatialGeometryType;
|
|
169
|
+
constructor(id: string, options: SpatialSphereGeometryOptions);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
declare class SpatialCylinderGeometry extends SpatialGeometry {
|
|
173
|
+
id: string;
|
|
174
|
+
options: SpatialCylinderGeometryOptions;
|
|
175
|
+
static type: SpatialGeometryType;
|
|
176
|
+
constructor(id: string, options: SpatialCylinderGeometryOptions);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
declare class SpatialPlaneGeometry extends SpatialGeometry {
|
|
180
|
+
id: string;
|
|
181
|
+
options: SpatialPlaneGeometryOptions;
|
|
182
|
+
static type: SpatialGeometryType;
|
|
183
|
+
constructor(id: string, options: SpatialPlaneGeometryOptions);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare class SpatialConeGeometry extends SpatialGeometry {
|
|
187
|
+
id: string;
|
|
188
|
+
options: SpatialConeGeometryOptions;
|
|
189
|
+
static type: SpatialGeometryType;
|
|
190
|
+
constructor(id: string, options: SpatialConeGeometryOptions);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class SpatialModelAsset extends SpatialObject {
|
|
194
|
+
id: string;
|
|
195
|
+
options: ModelAssetOptions;
|
|
196
|
+
constructor(id: string, options: ModelAssetOptions);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare class SpatialTextureResource extends SpatialObject {
|
|
200
|
+
id: string;
|
|
201
|
+
options: SpatialTextureResourceOptions;
|
|
202
|
+
constructor(id: string, options: SpatialTextureResourceOptions);
|
|
203
|
+
updateProperties(properties: Partial<SpatialTextureResourceOptions>): Promise<CommandResult<any>>;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare class Attachment extends SpatialObject {
|
|
207
|
+
private readonly windowProxy;
|
|
208
|
+
private options;
|
|
209
|
+
constructor(id: string, windowProxy: WindowProxy, options: AttachmentEntityOptions);
|
|
210
|
+
getContainer(): HTMLElement;
|
|
211
|
+
getWindowProxy(): WindowProxy;
|
|
212
|
+
update(options: AttachmentEntityUpdateOptions): Promise<CommandResult<any> | undefined>;
|
|
213
|
+
}
|
|
214
|
+
declare function createAttachmentEntity(options: AttachmentEntityOptions): Promise<Attachment>;
|
|
215
|
+
|
|
49
216
|
declare enum SpatialWebMsgType {
|
|
50
217
|
modelloaded = "modelloaded",
|
|
51
218
|
modelloadfailed = "modelloadfailed",
|
|
@@ -99,6 +266,16 @@ interface ModelLoadFailure {
|
|
|
99
266
|
interface AnimationStateChangeDetail {
|
|
100
267
|
paused: boolean;
|
|
101
268
|
duration: number;
|
|
269
|
+
/**
|
|
270
|
+
* Sampled animation playback position in seconds at `timestamp`.
|
|
271
|
+
* Optional for compatibility with older native runtimes.
|
|
272
|
+
*/
|
|
273
|
+
currentTime?: number;
|
|
274
|
+
/**
|
|
275
|
+
* Unix epoch time in milliseconds at which `currentTime` was sampled.
|
|
276
|
+
* Used to extrapolate `currentTime` between samples while playing.
|
|
277
|
+
*/
|
|
278
|
+
timestamp?: number;
|
|
102
279
|
}
|
|
103
280
|
interface AnimationStateChangeMsg {
|
|
104
281
|
type: SpatialWebMsgType.animationstatechange;
|
|
@@ -131,7 +308,7 @@ declare abstract class SpatializedElement extends SpatialObject {
|
|
|
131
308
|
* @param matrix The new transformation matrix
|
|
132
309
|
* @returns Promise resolving when the transform is updated
|
|
133
310
|
*/
|
|
134
|
-
updateTransform(matrix: DOMMatrix): Promise<CommandResult
|
|
311
|
+
updateTransform(matrix: DOMMatrix): Promise<CommandResult<any>>;
|
|
135
312
|
/**
|
|
136
313
|
* Information about the element's bounding cube.
|
|
137
314
|
* Used for spatial calculations and hit testing.
|
|
@@ -195,11 +372,11 @@ declare class SpatializedDynamic3DElement extends SpatializedElement {
|
|
|
195
372
|
children: SpatialEntityOrReality[];
|
|
196
373
|
events: Record<string, (data: any) => void>;
|
|
197
374
|
constructor(id: string);
|
|
198
|
-
addEntity(entity: SpatialEntity): Promise<CommandResult
|
|
375
|
+
addEntity(entity: SpatialEntity): Promise<CommandResult<any>>;
|
|
199
376
|
addEvent(type: SpatialEntityEventType, callback: (data: any) => void): void;
|
|
200
377
|
removeEvent(eventName: SpatialEntityEventType): void;
|
|
201
378
|
dispatchEvent(evt: CustomEvent): void;
|
|
202
|
-
updateProperties(properties: Partial<SpatializedElementProperties>): Promise<CommandResult
|
|
379
|
+
updateProperties(properties: Partial<SpatializedElementProperties>): Promise<CommandResult<any>>;
|
|
203
380
|
}
|
|
204
381
|
|
|
205
382
|
interface Vec3 {
|
|
@@ -282,6 +459,7 @@ interface ModelSource {
|
|
|
282
459
|
src: string;
|
|
283
460
|
type?: string;
|
|
284
461
|
}
|
|
462
|
+
type ModelLoadingMode = 'eager' | 'lazy';
|
|
285
463
|
interface SpatializedStatic3DElementProperties extends SpatializedElementProperties {
|
|
286
464
|
modelURL: string;
|
|
287
465
|
sources?: ModelSource[];
|
|
@@ -290,8 +468,11 @@ interface SpatializedStatic3DElementProperties extends SpatializedElementPropert
|
|
|
290
468
|
loop?: boolean;
|
|
291
469
|
animationPaused?: boolean;
|
|
292
470
|
playbackRate?: number;
|
|
471
|
+
currentTime?: number;
|
|
472
|
+
posterURL?: string;
|
|
473
|
+
loading?: ModelLoadingMode;
|
|
293
474
|
}
|
|
294
|
-
interface SpatialSceneCreationOptions
|
|
475
|
+
interface SpatialSceneCreationOptions {
|
|
295
476
|
defaultSize?: {
|
|
296
477
|
width: number | string;
|
|
297
478
|
height: number | string;
|
|
@@ -318,7 +499,7 @@ declare const WorldAlignmentValues: readonly ["adaptive", "automatic", "gravityA
|
|
|
318
499
|
type WorldAlignmentType = (typeof WorldAlignmentValues)[number];
|
|
319
500
|
declare function isValidWorldAlignmentType(type: string): Boolean;
|
|
320
501
|
declare const SpatialSceneValues: readonly ["window", "volume"];
|
|
321
|
-
type SpatialSceneType
|
|
502
|
+
type SpatialSceneType = (typeof SpatialSceneValues)[number];
|
|
322
503
|
declare function isValidSpatialSceneType(type: string): Boolean;
|
|
323
504
|
/**
|
|
324
505
|
* check px,m and number, number must be >= 0
|
|
@@ -362,6 +543,9 @@ interface SpatialUnlitMaterialOptions {
|
|
|
362
543
|
transparent?: boolean;
|
|
363
544
|
opacity?: number;
|
|
364
545
|
}
|
|
546
|
+
interface SpatialTextureResourceOptions {
|
|
547
|
+
url: string;
|
|
548
|
+
}
|
|
365
549
|
interface ModelComponentOptions {
|
|
366
550
|
mesh: SpatialGeometry;
|
|
367
551
|
materials: SpatialMaterial[];
|
|
@@ -377,7 +561,7 @@ interface SpatialModelEntityCreationOptions {
|
|
|
377
561
|
interface ModelAssetOptions {
|
|
378
562
|
url: string;
|
|
379
563
|
}
|
|
380
|
-
declare enum SpatialSceneState
|
|
564
|
+
declare enum SpatialSceneState {
|
|
381
565
|
idle = "idle",
|
|
382
566
|
pending = "pending",
|
|
383
567
|
willVisible = "willVisible",
|
|
@@ -479,7 +663,7 @@ interface XRSceneResizability {
|
|
|
479
663
|
maxHeight?: SceneUnit;
|
|
480
664
|
}
|
|
481
665
|
interface XRMainSceneConfig extends XRSpatialSceneDefaults {
|
|
482
|
-
type?: SpatialSceneType
|
|
666
|
+
type?: SpatialSceneType;
|
|
483
667
|
}
|
|
484
668
|
interface XRSpatialSceneDefaults {
|
|
485
669
|
default_size?: XRSceneSize;
|
|
@@ -515,126 +699,47 @@ interface PWAManifest extends XRPrdConfig {
|
|
|
515
699
|
[key: string]: any;
|
|
516
700
|
}
|
|
517
701
|
|
|
518
|
-
declare
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
id: string;
|
|
556
|
-
options?: SpatialModelEntityCreationOptions | undefined;
|
|
557
|
-
userData?: SpatialEntityUserData | undefined;
|
|
558
|
-
constructor(id: string, options?: SpatialModelEntityCreationOptions | undefined, userData?: SpatialEntityUserData | undefined);
|
|
559
|
-
setMaterials(materials: SpatialMaterial[]): Promise<CommandResult>;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
declare class ModelComponent extends SpatialComponent {
|
|
563
|
-
options: ModelComponentOptions;
|
|
564
|
-
constructor(id: string, options: ModelComponentOptions);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
declare class SpatialUnlitMaterial extends SpatialMaterial {
|
|
568
|
-
id: string;
|
|
569
|
-
options: SpatialUnlitMaterialOptions;
|
|
570
|
-
constructor(id: string, options: SpatialUnlitMaterialOptions);
|
|
571
|
-
updateProperties(properties: Partial<SpatialUnlitMaterialOptions>): Promise<CommandResult>;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
declare class SpatialBoxGeometry extends SpatialGeometry {
|
|
575
|
-
id: string;
|
|
576
|
-
options: SpatialBoxGeometryOptions;
|
|
577
|
-
static type: SpatialGeometryType;
|
|
578
|
-
constructor(id: string, options: SpatialBoxGeometryOptions);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
declare class SpatialSphereGeometry extends SpatialGeometry {
|
|
582
|
-
id: string;
|
|
583
|
-
options: SpatialSphereGeometryOptions;
|
|
584
|
-
static type: SpatialGeometryType;
|
|
585
|
-
constructor(id: string, options: SpatialSphereGeometryOptions);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
declare class SpatialCylinderGeometry extends SpatialGeometry {
|
|
589
|
-
id: string;
|
|
590
|
-
options: SpatialCylinderGeometryOptions;
|
|
591
|
-
static type: SpatialGeometryType;
|
|
592
|
-
constructor(id: string, options: SpatialCylinderGeometryOptions);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
declare class SpatialPlaneGeometry extends SpatialGeometry {
|
|
596
|
-
id: string;
|
|
597
|
-
options: SpatialPlaneGeometryOptions;
|
|
598
|
-
static type: SpatialGeometryType;
|
|
599
|
-
constructor(id: string, options: SpatialPlaneGeometryOptions);
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
declare class SpatialConeGeometry extends SpatialGeometry {
|
|
603
|
-
id: string;
|
|
604
|
-
options: SpatialConeGeometryOptions;
|
|
605
|
-
static type: SpatialGeometryType;
|
|
606
|
-
constructor(id: string, options: SpatialConeGeometryOptions);
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
declare class SpatialModelAsset extends SpatialObject {
|
|
610
|
-
id: string;
|
|
611
|
-
options: ModelAssetOptions;
|
|
612
|
-
constructor(id: string, options: ModelAssetOptions);
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
declare class Attachment extends SpatialObject {
|
|
616
|
-
private readonly windowProxy;
|
|
617
|
-
private options;
|
|
618
|
-
constructor(id: string, windowProxy: WindowProxy, options: AttachmentEntityOptions);
|
|
619
|
-
getContainer(): HTMLElement;
|
|
620
|
-
getWindowProxy(): WindowProxy;
|
|
621
|
-
update(options: AttachmentEntityUpdateOptions): Promise<CommandResult | undefined>;
|
|
622
|
-
}
|
|
623
|
-
declare function createAttachmentEntity(options: AttachmentEntityOptions): Promise<Attachment>;
|
|
624
|
-
|
|
625
|
-
type SpatialSceneCreationOptionsInternal = SpatialSceneCreationOptions$1 & {
|
|
626
|
-
type: SpatialSceneType$1;
|
|
627
|
-
};
|
|
628
|
-
declare enum SpatialSceneState {
|
|
629
|
-
idle = "idle",
|
|
630
|
-
pending = "pending",
|
|
631
|
-
willVisible = "willVisible",
|
|
632
|
-
visible = "visible",
|
|
633
|
-
fail = "fail"
|
|
702
|
+
declare global {
|
|
703
|
+
const __WEBSPATIAL_CORE_SDK_VERSION__: string;
|
|
704
|
+
interface Window {
|
|
705
|
+
xrCurrentSceneType: SpatialSceneType;
|
|
706
|
+
xrCurrentSceneDefaults: (defaultConfig: SpatialSceneCreationOptions) => Promise<SpatialSceneCreationOptions>;
|
|
707
|
+
__WebSpatialData: {
|
|
708
|
+
androidNativeMessage: Function;
|
|
709
|
+
getNativeVersion: Function;
|
|
710
|
+
};
|
|
711
|
+
__SpatialWebEvent: Function;
|
|
712
|
+
webkit: any;
|
|
713
|
+
webspatialBridge: any;
|
|
714
|
+
webSpatial?: {
|
|
715
|
+
genToken?: () => string;
|
|
716
|
+
};
|
|
717
|
+
__webspatialShell__?: {
|
|
718
|
+
genToken?: () => string;
|
|
719
|
+
};
|
|
720
|
+
WebSpatailNativeVersion: string;
|
|
721
|
+
__webspatialsdk__?: {
|
|
722
|
+
XR_ENV?: string;
|
|
723
|
+
'natvie-version'?: string;
|
|
724
|
+
'react-sdk-version'?: string;
|
|
725
|
+
'core-sdk-version'?: string;
|
|
726
|
+
physicalMetrics?: PhysicalMetricsValueShape;
|
|
727
|
+
};
|
|
728
|
+
/** Present when `supports('xrInnerDepth')` is true; otherwise `undefined`. */
|
|
729
|
+
xrInnerDepth?: number;
|
|
730
|
+
/** Present when `supports('xrOuterDepth')` is true; otherwise `undefined`. */
|
|
731
|
+
xrOuterDepth?: number;
|
|
732
|
+
}
|
|
733
|
+
interface HTMLElement {
|
|
734
|
+
/** Present when `supports('xrOffsetBack')` is true for element readbacks. */
|
|
735
|
+
xrOffsetBack?: number;
|
|
736
|
+
/** Present when `supports('xrClientDepth')` is true for element readbacks. */
|
|
737
|
+
xrClientDepth?: number;
|
|
738
|
+
}
|
|
634
739
|
}
|
|
635
740
|
|
|
636
|
-
declare function initScene(name: string, callback: (pre: SpatialSceneCreationOptions
|
|
637
|
-
type: SpatialSceneType
|
|
741
|
+
declare function initScene(name: string, callback: (pre: SpatialSceneCreationOptions) => SpatialSceneCreationOptions, options?: {
|
|
742
|
+
type: SpatialSceneType;
|
|
638
743
|
}): void;
|
|
639
744
|
|
|
640
745
|
/**
|
|
@@ -656,27 +761,27 @@ declare class SpatialScene extends SpatialObject {
|
|
|
656
761
|
* @param properties Partial set of properties to update
|
|
657
762
|
* @returns Promise resolving when the update is complete
|
|
658
763
|
*/
|
|
659
|
-
updateSpatialProperties(properties: Partial<SpatialSceneProperties>): Promise<CommandResult
|
|
764
|
+
updateSpatialProperties(properties: Partial<SpatialSceneProperties>): Promise<CommandResult<any>>;
|
|
660
765
|
/**
|
|
661
766
|
* Adds a spatialized element to the scene.
|
|
662
767
|
* This makes the element visible and interactive in the spatial environment.
|
|
663
768
|
* @param element The SpatializedElement to add to the scene
|
|
664
769
|
* @returns Promise resolving when the element is added
|
|
665
770
|
*/
|
|
666
|
-
addSpatializedElement(element: SpatializedElement): Promise<CommandResult
|
|
771
|
+
addSpatializedElement(element: SpatializedElement): Promise<CommandResult<any>>;
|
|
667
772
|
/**
|
|
668
773
|
* Updates the scene creation configuration.
|
|
669
774
|
* This allows changing scene parameters after initial creation.
|
|
670
775
|
* @param config The new scene creation configuration
|
|
671
776
|
* @returns Promise resolving when the update is complete
|
|
672
777
|
*/
|
|
673
|
-
updateSceneCreationConfig(config: SpatialSceneCreationOptionsInternal): Promise<CommandResult
|
|
778
|
+
updateSceneCreationConfig(config: SpatialSceneCreationOptionsInternal): Promise<CommandResult<any>>;
|
|
674
779
|
/**
|
|
675
780
|
* Gets the current state of the spatial scene.
|
|
676
781
|
* This includes information about active elements and scene configuration.
|
|
677
782
|
* @returns Promise resolving to the current SpatialSceneState
|
|
678
783
|
*/
|
|
679
|
-
getState(): Promise<SpatialSceneState>;
|
|
784
|
+
getState(): Promise<SpatialSceneState$1>;
|
|
680
785
|
}
|
|
681
786
|
|
|
682
787
|
/**
|
|
@@ -698,14 +803,14 @@ declare class Spatialized2DElement extends SpatializedElement {
|
|
|
698
803
|
* @param properties Partial set of properties to update
|
|
699
804
|
* @returns Promise resolving when the update is complete
|
|
700
805
|
*/
|
|
701
|
-
updateProperties(properties: Partial<Spatialized2DElementProperties>): Promise<CommandResult
|
|
806
|
+
updateProperties(properties: Partial<Spatialized2DElementProperties>): Promise<CommandResult<any>>;
|
|
702
807
|
/**
|
|
703
808
|
* Adds a child spatialized element to this 2D element.
|
|
704
809
|
* This allows for creating hierarchical structures of spatial elements.
|
|
705
810
|
* @param element The child element to add
|
|
706
811
|
* @returns Promise resolving when the element is added
|
|
707
812
|
*/
|
|
708
|
-
addSpatializedElement(element: SpatializedElement): Promise<CommandResult
|
|
813
|
+
addSpatializedElement(element: SpatializedElement): Promise<CommandResult<any>>;
|
|
709
814
|
}
|
|
710
815
|
|
|
711
816
|
/**
|
|
@@ -720,8 +825,9 @@ declare class SpatializedStatic3DElement extends SpatializedElement {
|
|
|
720
825
|
* @param id Unique identifier for this element
|
|
721
826
|
* @param modelURL URL of the 3D model
|
|
722
827
|
* @param sources Optional fallback model sources
|
|
828
|
+
* @param loading Initial loading mode (`'eager'` by default)
|
|
723
829
|
*/
|
|
724
|
-
constructor(id: string, modelURL?: string, sources?: ModelSource[]);
|
|
830
|
+
constructor(id: string, modelURL?: string, sources?: ModelSource[], loading?: ModelLoadingMode);
|
|
725
831
|
/**
|
|
726
832
|
* Promise resolver for the ready state.
|
|
727
833
|
* Used to resolve the ready promise when the model is loaded.
|
|
@@ -732,6 +838,7 @@ declare class SpatializedStatic3DElement extends SpatializedElement {
|
|
|
732
838
|
* Used to reset the ready promise when the model URL changes.
|
|
733
839
|
*/
|
|
734
840
|
private modelURL?;
|
|
841
|
+
get modelUrl(): string | undefined;
|
|
735
842
|
/**
|
|
736
843
|
* Caches the last sources array to detect changes.
|
|
737
844
|
*/
|
|
@@ -757,7 +864,7 @@ declare class SpatializedStatic3DElement extends SpatializedElement {
|
|
|
757
864
|
* @param properties Partial set of properties to update
|
|
758
865
|
* @returns Promise resolving when the update is complete
|
|
759
866
|
*/
|
|
760
|
-
updateProperties(properties: Partial<SpatializedStatic3DElementProperties>): Promise<CommandResult
|
|
867
|
+
updateProperties(properties: Partial<SpatializedStatic3DElementProperties>): Promise<CommandResult<any>>;
|
|
761
868
|
/**
|
|
762
869
|
* Total animation duration in seconds, synced from native.
|
|
763
870
|
*/
|
|
@@ -778,6 +885,28 @@ declare class SpatializedStatic3DElement extends SpatializedElement {
|
|
|
778
885
|
* Sets the playback rate and sends it to native.
|
|
779
886
|
*/
|
|
780
887
|
set playbackRate(value: number);
|
|
888
|
+
/**
|
|
889
|
+
* Last playback position sampled from native (seconds).
|
|
890
|
+
*/
|
|
891
|
+
private _currentTime;
|
|
892
|
+
/**
|
|
893
|
+
* Unix epoch time (ms) corresponding to `_currentTime`. Sourced from the
|
|
894
|
+
* native `timestamp` on samples, or `Date.now()` on local seeks/transitions.
|
|
895
|
+
*/
|
|
896
|
+
private _anchorTimestamp;
|
|
897
|
+
private clampTime;
|
|
898
|
+
/**
|
|
899
|
+
* Returns the current (un-scaled) playback position in seconds. While
|
|
900
|
+
* playing, the value is extrapolated from the last anchor using
|
|
901
|
+
* `playbackRate` and clamped to `[0, duration]`; while paused it returns
|
|
902
|
+
* the anchor directly.
|
|
903
|
+
*/
|
|
904
|
+
get currentTime(): number;
|
|
905
|
+
/**
|
|
906
|
+
* Seeks the animation to `value` seconds (clamped to `[0, duration]`) and
|
|
907
|
+
* forwards the request to native.
|
|
908
|
+
*/
|
|
909
|
+
set currentTime(value: number);
|
|
781
910
|
/**
|
|
782
911
|
* Whether the animation is currently paused.
|
|
783
912
|
*/
|
|
@@ -818,6 +947,12 @@ declare class SpatializedStatic3DElement extends SpatializedElement {
|
|
|
818
947
|
* Returns whether autoplay is enabled for this element.
|
|
819
948
|
*/
|
|
820
949
|
get autoplay(): boolean;
|
|
950
|
+
/**
|
|
951
|
+
* Asset fetch policy. `'lazy'` defers fetching until the host signals the
|
|
952
|
+
* element is in view; `'eager'` fetches immediately.
|
|
953
|
+
*/
|
|
954
|
+
private _loading;
|
|
955
|
+
get loading(): ModelLoadingMode;
|
|
821
956
|
/**
|
|
822
957
|
* Whether the model animation should loop continuously.
|
|
823
958
|
*/
|
|
@@ -870,9 +1005,11 @@ declare class SpatialSession {
|
|
|
870
1005
|
* Creates a new static 3D element with an optional model URL.
|
|
871
1006
|
* Static 3D elements represent pre-built 3D models that can be loaded from a URL.
|
|
872
1007
|
* @param modelURL Optional URL to the 3D model to load
|
|
1008
|
+
* @param sources Optional list of fallback model sources
|
|
1009
|
+
* @param loading Whether the asset should fetch eagerly or be deferred (`'lazy'`)
|
|
873
1010
|
* @returns Promise resolving to a new SpatializedStatic3DElement instance
|
|
874
1011
|
*/
|
|
875
|
-
createSpatializedStatic3DElement(modelURL?: string, sources?: ModelSource[]): Promise<SpatializedStatic3DElement>;
|
|
1012
|
+
createSpatializedStatic3DElement(modelURL?: string, sources?: ModelSource[], loading?: ModelLoadingMode): Promise<SpatializedStatic3DElement>;
|
|
876
1013
|
/**
|
|
877
1014
|
* Initializes the spatial scene with custom configuration.
|
|
878
1015
|
* This is a reference to the initScene function from scene-polyfill.
|
|
@@ -935,6 +1072,13 @@ declare class SpatialSession {
|
|
|
935
1072
|
* @returns Promise resolving to a new SpatialUnlitMaterial instance
|
|
936
1073
|
*/
|
|
937
1074
|
createUnlitMaterial(options: SpatialUnlitMaterialOptions): Promise<SpatialUnlitMaterial>;
|
|
1075
|
+
/**
|
|
1076
|
+
* Creates a texture resource from the specified image URL.
|
|
1077
|
+
* Texture resources can be referenced by materials and other spatial content.
|
|
1078
|
+
* @param options Configuration options for the texture resource
|
|
1079
|
+
* @returns Promise resolving to a new SpatialTextureResource instance
|
|
1080
|
+
*/
|
|
1081
|
+
createTexture(options: SpatialTextureResourceOptions): Promise<SpatialTextureResource>;
|
|
938
1082
|
/**
|
|
939
1083
|
* Creates a model asset with the specified configuration.
|
|
940
1084
|
* Model assets represent 3D model resources that can be used by entities.
|
|
@@ -963,7 +1107,6 @@ declare class SpatialSession {
|
|
|
963
1107
|
* This is the main entry point for the WebSpatial SDK, providing access to spatial capabilities.
|
|
964
1108
|
*/
|
|
965
1109
|
declare class Spatial {
|
|
966
|
-
private wsAppShellVersionFromUA;
|
|
967
1110
|
/**
|
|
968
1111
|
* Requests a spatial session object from the browser.
|
|
969
1112
|
* This is the primary method to initialize spatial functionality.
|
|
@@ -977,7 +1120,6 @@ declare class Spatial {
|
|
|
977
1120
|
* @returns True if running in a spatial web environment, false otherwise
|
|
978
1121
|
*/
|
|
979
1122
|
runInSpatialWeb(): boolean;
|
|
980
|
-
getShellVersionFromUA(): string | null;
|
|
981
1123
|
/** @deprecated
|
|
982
1124
|
* Checks if WebSpatial is supported in the current environment.
|
|
983
1125
|
* Verifies compatibility between native and client versions.
|
|
@@ -998,104 +1140,112 @@ declare class Spatial {
|
|
|
998
1140
|
getClientVersion(): string;
|
|
999
1141
|
}
|
|
1000
1142
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
type
|
|
1006
|
-
|
|
1007
|
-
|
|
1143
|
+
/**
|
|
1144
|
+
* Internal runtime classification (see OpenSpec `review.md`).
|
|
1145
|
+
* `puppeteer`: automation / test harness UA — not a product matrix row; see `supports()`.
|
|
1146
|
+
*/
|
|
1147
|
+
type WebSpatialRuntimeType = 'visionos' | 'picoos' | 'puppeteer' | null;
|
|
1148
|
+
/** Snapshot returned by internal `getRuntime()` (not a public app API). */
|
|
1149
|
+
type WebSpatialRuntimeSnapshot = {
|
|
1150
|
+
type: WebSpatialRuntimeType;
|
|
1151
|
+
shellVersion: string | null;
|
|
1008
1152
|
};
|
|
1153
|
+
|
|
1009
1154
|
/**
|
|
1010
|
-
*
|
|
1011
|
-
*
|
|
1012
|
-
* @param point Points value to convert.
|
|
1013
|
-
* @param options Optional conversion options to select world scaling compensation.
|
|
1014
|
-
* @returns Physical length in meters.
|
|
1155
|
+
* Thrown when a runtime-gated JS API is invoked but `supports('<name>')` is false.
|
|
1156
|
+
* See OpenSpec `runtime-capabilities/spec.md` (Unsupported behavior contracts).
|
|
1015
1157
|
*/
|
|
1016
|
-
declare
|
|
1158
|
+
declare class WebSpatialRuntimeError extends Error {
|
|
1159
|
+
readonly capability: string;
|
|
1160
|
+
constructor(capability: string, message?: string);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1017
1163
|
/**
|
|
1018
|
-
*
|
|
1019
|
-
*
|
|
1020
|
-
* @param physical Physical length in meters to convert.
|
|
1021
|
-
* @param options Optional conversion options to select world scaling compensation.
|
|
1022
|
-
* @returns Points length in the scene.
|
|
1164
|
+
* Canonical `supports(name)` keys (OpenSpec `review.md` §3).
|
|
1165
|
+
* Aliases are normalized before lookup (see `normalizeCapabilityName`).
|
|
1023
1166
|
*/
|
|
1024
|
-
declare
|
|
1167
|
+
declare const COMPONENT_KEYS: readonly ["Model", "Reality", "Entity", "BoxEntity", "SphereEntity", "ConeEntity", "CylinderEntity", "PlaneEntity", "SceneGraph", "ModelAsset", "ModelEntity", "UnlitMaterial", "Material", "AttachmentAsset", "AttachmentEntity"];
|
|
1168
|
+
declare const CSS_KEYS: readonly ["-xr-background-material", "-xr-back", "-xr-depth", "-xr-transform"];
|
|
1169
|
+
declare const GESTURE_KEYS: readonly ["SpatialTapEvent", "SpatialDragStartEvent", "SpatialDragEvent", "SpatialDragEndEvent", "SpatialRotateEvent", "SpatialRotateEndEvent", "SpatialMagnifyEvent", "SpatialMagnifyEndEvent"];
|
|
1170
|
+
declare const JS_SCENE_KEYS: readonly ["useMetrics", "convertCoordinate", "initScene", "WindowScene", "VolumeScene"];
|
|
1025
1171
|
/**
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1028
|
-
* @returns The current metrics snapshot `{ meterToPtUnscaled, meterToPtScaled }`.
|
|
1172
|
+
* Spatialized container `ref` readbacks (`HTMLElement` / React `useDomProxy` Proxy).
|
|
1173
|
+
* See `global.d.ts` (`HTMLElement`) and `useDomProxy.ts` (`has` / `get` traps).
|
|
1029
1174
|
*/
|
|
1030
|
-
declare
|
|
1175
|
+
declare const ELEMENT_DOM_DEPTH_KEYS: readonly ["xrClientDepth", "xrOffsetBack"];
|
|
1031
1176
|
/**
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1034
|
-
* @param cb Callback invoked when metrics update is detected.
|
|
1035
|
-
* @returns Unsubscribe function to remove the listener.
|
|
1177
|
+
* Scene / global readbacks on `Window` (`global.d.ts` → `Window`).
|
|
1036
1178
|
*/
|
|
1037
|
-
declare
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
declare const
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
declare
|
|
1045
|
-
export { type physicalMetrics_PhysicalMetricsValueShape as PhysicalMetricsValueShape, physicalMetrics_getValue as getValue, physicalMetrics_physicalToPoint as physicalToPoint, physicalMetrics_pointToPhysical as pointToPhysical, physicalMetrics_subscribe as subscribe };
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
declare global {
|
|
1049
|
-
declare const __WEBSPATIAL_CORE_SDK_VERSION__: string
|
|
1050
|
-
|
|
1051
|
-
interface Window {
|
|
1052
|
-
xrCurrentSceneType: SpatialSceneType
|
|
1053
|
-
xrCurrentSceneDefaults: (
|
|
1054
|
-
defaultConfig: SpatialSceneCreationOptions,
|
|
1055
|
-
) => Promise<SpatialSceneCreationOptions>
|
|
1056
|
-
|
|
1057
|
-
// Location for webspatial custom functions
|
|
1058
|
-
__WebSpatialData: {
|
|
1059
|
-
androidNativeMessage: Function
|
|
1060
|
-
getNativeVersion: Function
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
// Location for webspatial internal callbacks (eg. completion events)
|
|
1064
|
-
__SpatialWebEvent: Function
|
|
1065
|
-
|
|
1066
|
-
// Used to access webkit specific api
|
|
1067
|
-
webkit: any
|
|
1068
|
-
webspatialBridge: any
|
|
1179
|
+
declare const WINDOW_DOM_DEPTH_KEYS: readonly ["xrInnerDepth", "xrOuterDepth"];
|
|
1180
|
+
declare const DOM_DEPTH_KEYS: readonly ["xrClientDepth", "xrOffsetBack", "xrInnerDepth", "xrOuterDepth"];
|
|
1181
|
+
/** Top-level names accepted by `supports(name)` (canonical keys after alias normalization). */
|
|
1182
|
+
declare const TOP_LEVEL_KEYS: readonly ["Model", "Reality", "Entity", "BoxEntity", "SphereEntity", "ConeEntity", "CylinderEntity", "PlaneEntity", "SceneGraph", "ModelAsset", "ModelEntity", "UnlitMaterial", "Material", "AttachmentAsset", "AttachmentEntity", "-xr-background-material", "-xr-back", "-xr-depth", "-xr-transform", "SpatialTapEvent", "SpatialDragStartEvent", "SpatialDragEvent", "SpatialDragEndEvent", "SpatialRotateEvent", "SpatialRotateEndEvent", "SpatialMagnifyEvent", "SpatialMagnifyEndEvent", "useMetrics", "convertCoordinate", "initScene", "WindowScene", "VolumeScene", "xrClientDepth", "xrOffsetBack", "xrInnerDepth", "xrOuterDepth"];
|
|
1183
|
+
/** Union of documented capability keys; unknown strings may still be passed to `supports` (returns `false`). */
|
|
1184
|
+
type CapabilityKey = (typeof TOP_LEVEL_KEYS)[number];
|
|
1185
|
+
/** Known sub-tokens per canonical top-level `name` (AND semantics). */
|
|
1186
|
+
declare const SUB_TOKENS_BY_NAME: Readonly<Record<string, readonly string[]>>;
|
|
1069
1187
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1188
|
+
/**
|
|
1189
|
+
* Unsubstituted shell version placeholder from visionOS manifest / Xcode template
|
|
1190
|
+
* (`manifest.swift`). When still present in `WSAppShell/<version>`, treat as debug
|
|
1191
|
+
* build: {@link supports} returns true for every valid capability query.
|
|
1192
|
+
*/
|
|
1193
|
+
declare const VISIONOS_DEBUG_SHELL_VERSION_PLACEHOLDER = "WS_SHELL_VERSION";
|
|
1194
|
+
/** Test helper: clear cached UA/runtime snapshot between Vitest cases. */
|
|
1195
|
+
declare function resetRuntimeCacheForTests(): void;
|
|
1196
|
+
/**
|
|
1197
|
+
* Internal runtime snapshot (not part of the public `@webspatial/react-sdk` surface).
|
|
1198
|
+
*/
|
|
1199
|
+
declare function getRuntime(): WebSpatialRuntimeSnapshot;
|
|
1200
|
+
/**
|
|
1201
|
+
* Public capability probe (`WebSpatialRuntime.supports` re-exports this from React SDK).
|
|
1202
|
+
*/
|
|
1203
|
+
declare function supports(name: CapabilityKey, tokens?: readonly string[]): boolean;
|
|
1204
|
+
declare function supports(name: string, tokens?: readonly string[]): boolean;
|
|
1077
1205
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1206
|
+
/**
|
|
1207
|
+
* Minimal semver compare for capability table rows (`major.minor.patch`).
|
|
1208
|
+
* Returns negative if a < b, zero if equal, positive if a > b.
|
|
1209
|
+
*/
|
|
1210
|
+
declare function compareSemver(a: string, b: string): number;
|
|
1211
|
+
declare function parseSemverOrNull(v: string): string | null;
|
|
1080
1212
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1213
|
+
/**
|
|
1214
|
+
* Parse shell token from UA:
|
|
1215
|
+
* - packaged/hybrid runtimes use `WSAppShell/<version>`
|
|
1216
|
+
* - browser-mode runtime on Pico OS uses `PicoWebApp/<version>`
|
|
1217
|
+
*
|
|
1218
|
+
* Keep `WSAppShell` precedence when both appear in one UA.
|
|
1219
|
+
*/
|
|
1220
|
+
declare function parseShellToken(ua: string): {
|
|
1221
|
+
version: string | null;
|
|
1222
|
+
source: 'wsapp' | 'picoapp' | null;
|
|
1223
|
+
};
|
|
1224
|
+
/**
|
|
1225
|
+
* Resolve internal runtime snapshot from `navigator.userAgent`.
|
|
1226
|
+
* SSR / no navigator → `{ type: null, shellVersion: null }` (no throw).
|
|
1227
|
+
*/
|
|
1228
|
+
declare function computeRuntimeFromUserAgent(userAgent: string | undefined): WebSpatialRuntimeSnapshot;
|
|
1088
1229
|
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1230
|
+
/**
|
|
1231
|
+
* Which native JSB / protocol adapter to load in the browser.
|
|
1232
|
+
* Derived from {@link computeRuntimeFromUserAgent} plus legacy fallbacks
|
|
1233
|
+
* (Pico WebSpatial semver gate; otherwise default visionOS shell).
|
|
1234
|
+
*/
|
|
1235
|
+
type JsbAdapterPlatformKind = 'puppeteer' | 'picoos' | 'visionos';
|
|
1236
|
+
declare function resolveJsbAdapterPlatform(userAgent: string): JsbAdapterPlatformKind;
|
|
1092
1237
|
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1238
|
+
type CapabilityVersionRow = {
|
|
1239
|
+
/** Semver string from `WSAppShell` / `PicoWebApp` (see `review.md` §4). */
|
|
1240
|
+
version: string;
|
|
1241
|
+
/** Top-level keys and `name:subToken` compound keys. */
|
|
1242
|
+
flags: Record<string, boolean>;
|
|
1243
|
+
};
|
|
1244
|
+
declare const CAPABILITY_TABLE: {
|
|
1245
|
+
visionos: CapabilityVersionRow[];
|
|
1246
|
+
picoos: CapabilityVersionRow[];
|
|
1247
|
+
};
|
|
1098
1248
|
|
|
1099
1249
|
declare const isSSREnv: () => boolean;
|
|
1100
1250
|
|
|
1101
|
-
export { Attachment, type AttachmentEntityOptions, type AttachmentEntityUpdateOptions, type BackgroundMaterialType, type BaseplateVisibilityType, BaseplateVisibilityValues, type CornerRadius, CubeInfo, type ModelAssetOptions, ModelComponent, type ModelComponentOptions, type ModelSource, type PWAManifest, physicalMetrics as PhysicalMetrics, type Point3D, type Quaternion, type SceneUnit, type SceneUnitM, type SceneUnitPx, 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
|
|
1251
|
+
export { Attachment, type AttachmentEntityOptions, type AttachmentEntityUpdateOptions, type BackgroundMaterialType, type BaseplateVisibilityType, BaseplateVisibilityValues, CAPABILITY_TABLE, COMPONENT_KEYS, CSS_KEYS, type CapabilityKey, type CapabilityVersionRow, type CornerRadius, CubeInfo, DOM_DEPTH_KEYS, ELEMENT_DOM_DEPTH_KEYS, GESTURE_KEYS, JS_SCENE_KEYS, type JsbAdapterPlatformKind, type ModelAssetOptions, ModelComponent, type ModelComponentOptions, type ModelLoadingMode, type ModelSource, type PWAManifest, physicalMetrics as PhysicalMetrics, type Point3D, type Quaternion, SUB_TOKENS_BY_NAME, type SceneUnit, type SceneUnitM, type SceneUnitPx, 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, type SpatialSceneProperties, SpatialSceneState, type SpatialSceneType, SpatialSceneValues, SpatialSession, SpatialSphereGeometry, type SpatialSphereGeometryOptions, type SpatialTapEvent, type SpatialTapEventDetail, SpatialTextureResource, type SpatialTextureResourceOptions, SpatialUnlitMaterial, type SpatialUnlitMaterialOptions, Spatialized2DElement, type Spatialized2DElementProperties, SpatializedDynamic3DElement, SpatializedElement, type SpatializedElementProperties, SpatializedElementType, SpatializedStatic3DElement, type SpatializedStatic3DElementProperties, TOP_LEVEL_KEYS, VISIONOS_DEBUG_SHELL_VERSION_PLACEHOLDER, type Vec3, WINDOW_DOM_DEPTH_KEYS, WebSpatialRuntimeError, type WebSpatialRuntimeSnapshot, type WebSpatialRuntimeType, type WorldAlignmentType, WorldAlignmentValues, type WorldScalingType, WorldScalingValues, type XRMainSceneConfig, type XRPrdConfig, type XRSceneResizability, type XRSceneSize, type XRSpatialSceneConfig, type XRSpatialSceneDefaults, type XRSpatialSceneOverrides, compareSemver, computeRuntimeFromUserAgent, createAttachmentEntity, getRuntime, isSSREnv, isValidBaseplateVisibilityType, isValidSceneUnit, isValidSpatialSceneType, isValidWorldAlignmentType, isValidWorldScalingType, parseSemverOrNull, parseShellToken, resetRuntimeCacheForTests, resolveJsbAdapterPlatform, supports };
|