@webspatial/core-sdk 1.7.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +10 -0
  3. package/dist/JSBCommand.d.ts +398 -0
  4. package/dist/JSBCommand.js +668 -0
  5. package/dist/JSBCommand.js.map +1 -0
  6. package/dist/Spatial.d.ts +63 -0
  7. package/dist/Spatial.js +60 -0
  8. package/dist/Spatial.js.map +1 -0
  9. package/dist/SpatialObject.d.ts +19 -0
  10. package/dist/SpatialObject.js +44 -0
  11. package/dist/SpatialObject.js.map +1 -0
  12. package/dist/SpatialScene.d.ts +51 -0
  13. package/dist/SpatialScene.js +74 -0
  14. package/dist/SpatialScene.js.map +1 -0
  15. package/dist/SpatialSession.d.ts +143 -0
  16. package/dist/SpatialSession.js +173 -0
  17. package/dist/SpatialSession.js.map +1 -0
  18. package/dist/SpatialWebEvent.d.ts +8 -0
  19. package/dist/SpatialWebEvent.js +18 -0
  20. package/dist/SpatialWebEvent.js.map +1 -0
  21. package/dist/SpatialWebEventCreator.d.ts +11 -0
  22. package/dist/SpatialWebEventCreator.js +11 -0
  23. package/dist/SpatialWebEventCreator.js.map +1 -0
  24. package/dist/Spatialized2DElement.d.ts +42 -0
  25. package/dist/Spatialized2DElement.js +47 -0
  26. package/dist/Spatialized2DElement.js.map +1 -0
  27. package/dist/SpatializedDynamic3DElement.d.ts +7 -0
  28. package/dist/SpatializedDynamic3DElement.js +43 -0
  29. package/dist/SpatializedDynamic3DElement.js.map +1 -0
  30. package/dist/SpatializedElement.d.ts +7 -0
  31. package/dist/SpatializedElement.js +206 -0
  32. package/dist/SpatializedElement.js.map +1 -0
  33. package/dist/SpatializedElementCreator.d.ts +15 -0
  34. package/dist/SpatializedElementCreator.js +47 -0
  35. package/dist/SpatializedElementCreator.js.map +1 -0
  36. package/dist/SpatializedStatic3DElement.d.ts +195 -0
  37. package/dist/SpatializedStatic3DElement.js +327 -0
  38. package/dist/SpatializedStatic3DElement.js.map +1 -0
  39. package/dist/WebMsgCommand.d.ts +7 -0
  40. package/dist/WebMsgCommand.js +23 -0
  41. package/dist/WebMsgCommand.js.map +1 -0
  42. package/dist/index.d.ts +35 -1251
  43. package/dist/index.js +21 -3650
  44. package/dist/index.js.map +1 -1
  45. package/dist/install-polyfills.d.ts +2 -0
  46. package/dist/install-polyfills.js +13 -0
  47. package/dist/install-polyfills.js.map +1 -0
  48. package/dist/isSSREnv.d.ts +3 -0
  49. package/dist/isSSREnv.js +6 -0
  50. package/dist/isSSREnv.js.map +1 -0
  51. package/dist/motion/AnimationObject.d.ts +7 -0
  52. package/dist/motion/AnimationObject.js +140 -0
  53. package/dist/motion/AnimationObject.js.map +1 -0
  54. package/dist/motion/compute/index.d.ts +10 -0
  55. package/dist/motion/compute/index.js +19 -0
  56. package/dist/motion/compute/index.js.map +1 -0
  57. package/dist/motion/compute/motionPropertyValues.d.ts +19 -0
  58. package/dist/motion/compute/motionPropertyValues.js +50 -0
  59. package/dist/motion/compute/motionPropertyValues.js.map +1 -0
  60. package/dist/motion/compute/normalize.d.ts +31 -0
  61. package/dist/motion/compute/normalize.js +201 -0
  62. package/dist/motion/compute/normalize.js.map +1 -0
  63. package/dist/motion/compute/validate.d.ts +22 -0
  64. package/dist/motion/compute/validate.js +103 -0
  65. package/dist/motion/compute/validate.js.map +1 -0
  66. package/dist/motion/index.d.ts +8 -0
  67. package/dist/motion/index.js +6 -0
  68. package/dist/motion/index.js.map +1 -0
  69. package/dist/motion/native/serializeMotionTimeline.d.ts +12 -0
  70. package/dist/motion/native/serializeMotionTimeline.js +21 -0
  71. package/dist/motion/native/serializeMotionTimeline.js.map +1 -0
  72. package/dist/physicalMetrics-W5uZ5xKb.d.ts +48 -0
  73. package/dist/physicalMetrics.d.ts +1 -0
  74. package/dist/physicalMetrics.js +58 -0
  75. package/dist/physicalMetrics.js.map +1 -0
  76. package/dist/platform-adapter/CommandResultUtils.d.ts +12 -0
  77. package/dist/platform-adapter/CommandResultUtils.js +21 -0
  78. package/dist/platform-adapter/CommandResultUtils.js.map +1 -0
  79. package/dist/platform-adapter/createPlatformSync.d.ts +16 -0
  80. package/dist/platform-adapter/createPlatformSync.js +30 -0
  81. package/dist/platform-adapter/createPlatformSync.js.map +1 -0
  82. package/dist/platform-adapter/index.d.ts +12 -0
  83. package/dist/platform-adapter/index.js +10 -0
  84. package/dist/platform-adapter/index.js.map +1 -0
  85. package/dist/platform-adapter/interface.d.ts +7 -0
  86. package/dist/platform-adapter/interface.js +1 -0
  87. package/dist/platform-adapter/interface.js.map +1 -0
  88. package/dist/platform-adapter/pico-os/PicoOSPlatform.d.ts +25 -0
  89. package/dist/platform-adapter/pico-os/PicoOSPlatform.js +168 -0
  90. package/dist/platform-adapter/pico-os/PicoOSPlatform.js.map +1 -0
  91. package/dist/platform-adapter/puppeteer/PuppeteerPlatform.d.ts +66 -0
  92. package/dist/platform-adapter/puppeteer/PuppeteerPlatform.js +372 -0
  93. package/dist/platform-adapter/puppeteer/PuppeteerPlatform.js.map +1 -0
  94. package/dist/platform-adapter/spatialRequestMetadata.d.ts +6 -0
  95. package/dist/platform-adapter/spatialRequestMetadata.js +39 -0
  96. package/dist/platform-adapter/spatialRequestMetadata.js.map +1 -0
  97. package/dist/platform-adapter/spatialSceneQuery.d.ts +12 -0
  98. package/dist/platform-adapter/spatialSceneQuery.js +12 -0
  99. package/dist/platform-adapter/spatialSceneQuery.js.map +1 -0
  100. package/dist/platform-adapter/vision-os/VisionOSPlatform.d.ts +19 -0
  101. package/dist/platform-adapter/vision-os/VisionOSPlatform.js +77 -0
  102. package/dist/platform-adapter/vision-os/VisionOSPlatform.js.map +1 -0
  103. package/dist/platform-runtime.d.ts +12 -0
  104. package/dist/platform-runtime.js +14 -0
  105. package/dist/platform-runtime.js.map +1 -0
  106. package/dist/reality/Attachment.d.ts +19 -0
  107. package/dist/reality/Attachment.js +39 -0
  108. package/dist/reality/Attachment.js.map +1 -0
  109. package/dist/reality/component/ModelComponent.d.ts +14 -0
  110. package/dist/reality/component/ModelComponent.js +11 -0
  111. package/dist/reality/component/ModelComponent.js.map +1 -0
  112. package/dist/reality/component/SpatialComponent.d.ts +8 -0
  113. package/dist/reality/component/SpatialComponent.js +19 -0
  114. package/dist/reality/component/SpatialComponent.js.map +1 -0
  115. package/dist/reality/component/index.d.ts +8 -0
  116. package/dist/reality/component/index.js +3 -0
  117. package/dist/reality/component/index.js.map +1 -0
  118. package/dist/reality/entity/SpatialEntity.d.ts +7 -0
  119. package/dist/reality/entity/SpatialEntity.js +291 -0
  120. package/dist/reality/entity/SpatialEntity.js.map +1 -0
  121. package/dist/reality/entity/SpatialModelEntity.d.ts +17 -0
  122. package/dist/reality/entity/SpatialModelEntity.js +17 -0
  123. package/dist/reality/entity/SpatialModelEntity.js.map +1 -0
  124. package/dist/reality/entity/index.d.ts +8 -0
  125. package/dist/reality/entity/index.js +3 -0
  126. package/dist/reality/entity/index.js.map +1 -0
  127. package/dist/reality/geometry/SpatialBoxGeometry.d.ts +16 -0
  128. package/dist/reality/geometry/SpatialBoxGeometry.js +13 -0
  129. package/dist/reality/geometry/SpatialBoxGeometry.js.map +1 -0
  130. package/dist/reality/geometry/SpatialConeGeometry.d.ts +16 -0
  131. package/dist/reality/geometry/SpatialConeGeometry.js +13 -0
  132. package/dist/reality/geometry/SpatialConeGeometry.js.map +1 -0
  133. package/dist/reality/geometry/SpatialCylinderGeometry.d.ts +16 -0
  134. package/dist/reality/geometry/SpatialCylinderGeometry.js +13 -0
  135. package/dist/reality/geometry/SpatialCylinderGeometry.js.map +1 -0
  136. package/dist/reality/geometry/SpatialGeometry.d.ts +7 -0
  137. package/dist/reality/geometry/SpatialGeometry.js +13 -0
  138. package/dist/reality/geometry/SpatialGeometry.js.map +1 -0
  139. package/dist/reality/geometry/SpatialPlaneGeometry.d.ts +16 -0
  140. package/dist/reality/geometry/SpatialPlaneGeometry.js +13 -0
  141. package/dist/reality/geometry/SpatialPlaneGeometry.js.map +1 -0
  142. package/dist/reality/geometry/SpatialSphereGeometry.d.ts +16 -0
  143. package/dist/reality/geometry/SpatialSphereGeometry.js +13 -0
  144. package/dist/reality/geometry/SpatialSphereGeometry.js.map +1 -0
  145. package/dist/reality/geometry/index.d.ts +12 -0
  146. package/dist/reality/geometry/index.js +7 -0
  147. package/dist/reality/geometry/index.js.map +1 -0
  148. package/dist/reality/index.d.ts +18 -0
  149. package/dist/reality/index.js +7 -0
  150. package/dist/reality/index.js.map +1 -0
  151. package/dist/reality/material/SpatialMaterial.d.ts +7 -0
  152. package/dist/reality/material/SpatialMaterial.js +13 -0
  153. package/dist/reality/material/SpatialMaterial.js.map +1 -0
  154. package/dist/reality/material/SpatialUnlitMaterial.d.ts +16 -0
  155. package/dist/reality/material/SpatialUnlitMaterial.js +16 -0
  156. package/dist/reality/material/SpatialUnlitMaterial.js.map +1 -0
  157. package/dist/reality/material/index.d.ts +8 -0
  158. package/dist/reality/material/index.js +3 -0
  159. package/dist/reality/material/index.js.map +1 -0
  160. package/dist/reality/realityCreator.d.ts +22 -0
  161. package/dist/reality/realityCreator.js +89 -0
  162. package/dist/reality/realityCreator.js.map +1 -0
  163. package/dist/reality/resource/SpatialModelAsset.d.ts +15 -0
  164. package/dist/reality/resource/SpatialModelAsset.js +12 -0
  165. package/dist/reality/resource/SpatialModelAsset.js.map +1 -0
  166. package/dist/reality/resource/SpatialTextureResource.d.ts +16 -0
  167. package/dist/reality/resource/SpatialTextureResource.js +16 -0
  168. package/dist/reality/resource/SpatialTextureResource.js.map +1 -0
  169. package/dist/reality/resource/index.d.ts +9 -0
  170. package/dist/reality/resource/index.js +3 -0
  171. package/dist/reality/resource/index.js.map +1 -0
  172. package/dist/runtime/WebSpatialRuntimeError.d.ts +10 -0
  173. package/dist/runtime/WebSpatialRuntimeError.js +14 -0
  174. package/dist/runtime/WebSpatialRuntimeError.js.map +1 -0
  175. package/dist/runtime/capability-data.d.ts +12 -0
  176. package/dist/runtime/capability-data.js +134 -0
  177. package/dist/runtime/capability-data.js.map +1 -0
  178. package/dist/runtime/index.d.ts +8 -0
  179. package/dist/runtime/index.js +27 -0
  180. package/dist/runtime/index.js.map +1 -0
  181. package/dist/runtime/jsbAdapterPlatform.d.ts +9 -0
  182. package/dist/runtime/jsbAdapterPlatform.js +38 -0
  183. package/dist/runtime/jsbAdapterPlatform.js.map +1 -0
  184. package/dist/runtime/keys.d.ts +34 -0
  185. package/dist/runtime/keys.js +122 -0
  186. package/dist/runtime/keys.js.map +1 -0
  187. package/dist/runtime/semver.d.ts +8 -0
  188. package/dist/runtime/semver.js +32 -0
  189. package/dist/runtime/semver.js.map +1 -0
  190. package/dist/runtime/supports.d.ts +22 -0
  191. package/dist/runtime/supports.js +78 -0
  192. package/dist/runtime/supports.js.map +1 -0
  193. package/dist/runtime/types.d.ts +12 -0
  194. package/dist/runtime/types.js +1 -0
  195. package/dist/runtime/types.js.map +1 -0
  196. package/dist/runtime/userAgent.d.ts +20 -0
  197. package/dist/runtime/userAgent.js +41 -0
  198. package/dist/runtime/userAgent.js.map +1 -0
  199. package/dist/scene-polyfill.d.ts +18 -0
  200. package/dist/scene-polyfill.js +480 -0
  201. package/dist/scene-polyfill.js.map +1 -0
  202. package/dist/spatial-host.d.ts +13 -0
  203. package/dist/spatial-host.js +18 -0
  204. package/dist/spatial-host.js.map +1 -0
  205. package/dist/spatial-window-polyfill.d.ts +3 -0
  206. package/dist/spatial-window-polyfill.js +155 -0
  207. package/dist/spatial-window-polyfill.js.map +1 -0
  208. package/dist/spatializedElementMotion-_0XWPQCE.d.ts +1009 -0
  209. package/dist/types/animation.d.ts +7 -0
  210. package/dist/types/animation.js +1 -0
  211. package/dist/types/animation.js.map +1 -0
  212. package/dist/types/global.d.ts +38 -0
  213. package/dist/types/global.js +1 -0
  214. package/dist/types/global.js.map +1 -0
  215. package/dist/types/internal.d.ts +7 -0
  216. package/dist/types/internal.js +12 -0
  217. package/dist/types/internal.js.map +1 -0
  218. package/dist/types/motion/index.d.ts +7 -0
  219. package/dist/types/motion/index.js +3 -0
  220. package/dist/types/motion/index.js.map +1 -0
  221. package/dist/types/motion/spatializedElementMotion.d.ts +7 -0
  222. package/dist/types/motion/spatializedElementMotion.js +1 -0
  223. package/dist/types/motion/spatializedElementMotion.js.map +1 -0
  224. package/dist/types/motion/spatializedMotion.d.ts +7 -0
  225. package/dist/types/motion/spatializedMotion.js +16 -0
  226. package/dist/types/motion/spatializedMotion.js.map +1 -0
  227. package/dist/types/motion/spatializedPlayback.d.ts +11 -0
  228. package/dist/types/motion/spatializedPlayback.js +1 -0
  229. package/dist/types/motion/spatializedPlayback.js.map +1 -0
  230. package/dist/types/motion/spatializedVisual.d.ts +35 -0
  231. package/dist/types/motion/spatializedVisual.js +1 -0
  232. package/dist/types/motion/spatializedVisual.js.map +1 -0
  233. package/dist/types/types.d.ts +7 -0
  234. package/dist/types/types.js +117 -0
  235. package/dist/types/types.js.map +1 -0
  236. package/dist/utils.d.ts +44 -0
  237. package/dist/utils.js +86 -0
  238. package/dist/utils.js.map +1 -0
  239. package/package.json +20 -4
  240. package/src/JSBCommand.ts +132 -5
  241. package/src/SpatialObject.ts +10 -0
  242. package/src/Spatialized2DElement.ts +5 -0
  243. package/src/SpatializedDynamic3DElement.ts +5 -0
  244. package/src/SpatializedElement.ts +29 -0
  245. package/src/SpatializedStatic3DElement.ts +42 -3
  246. package/src/WebMsgCommand.ts +40 -0
  247. package/src/coverage-boost.test.ts +239 -216
  248. package/src/index.ts +25 -11
  249. package/src/install-polyfills.ts +38 -0
  250. package/src/jsbcommand.coverage.test.ts +23 -0
  251. package/src/motion/AnimationObject.test.ts +421 -0
  252. package/src/motion/AnimationObject.ts +208 -0
  253. package/src/motion/compute/index.ts +10 -0
  254. package/src/motion/compute/motionPropertyValues.test.ts +55 -0
  255. package/src/motion/compute/motionPropertyValues.ts +70 -0
  256. package/src/motion/compute/normalize.test.ts +99 -0
  257. package/src/motion/compute/normalize.ts +289 -0
  258. package/src/motion/compute/validate.test.ts +229 -0
  259. package/src/motion/compute/validate.ts +156 -0
  260. package/src/motion/index.ts +2 -0
  261. package/src/motion/native/serializeMotionTimeline.test.ts +61 -0
  262. package/src/motion/native/serializeMotionTimeline.ts +27 -0
  263. package/src/platform-adapter/createPlatformSync.ts +5 -3
  264. package/src/platform-adapter/pico-os/PicoOSPlatform.ts +76 -11
  265. package/src/platform-adapter/spatialRequestMetadata.test.ts +175 -0
  266. package/src/platform-adapter/spatialRequestMetadata.ts +48 -0
  267. package/src/platform-adapter/vision-os/VisionOSPlatform.ts +6 -1
  268. package/src/reality/entity/SpatialEntity.ts +127 -0
  269. package/src/runtime/capability-data.ts +104 -4
  270. package/src/runtime/index.ts +0 -11
  271. package/src/runtime/keys.ts +12 -1
  272. package/src/runtime/supports.test.ts +143 -4
  273. package/src/runtime/supports.ts +3 -1
  274. package/src/runtime/useAnimation.capability.test.ts +275 -0
  275. package/src/scene-polyfill.manifest.test.ts +306 -5
  276. package/src/scene-polyfill.request-metadata.test.ts +39 -0
  277. package/src/scene-polyfill.test.ts +33 -94
  278. package/src/scene-polyfill.ts +117 -87
  279. package/src/spatial-window-polyfill.ts +18 -2
  280. package/src/transform-roundtrip.test.ts +90 -0
  281. package/src/types/animation.ts +224 -0
  282. package/src/types/global.ts +1 -8
  283. package/src/types/motion/index.ts +10 -0
  284. package/src/types/motion/spatializedElementMotion.ts +49 -0
  285. package/src/types/motion/spatializedMotion.ts +147 -0
  286. package/src/types/motion/spatializedPlayback.ts +17 -0
  287. package/src/types/motion/spatializedVisual.ts +24 -0
  288. package/src/types/types.ts +3 -0
  289. package/src/utils.ts +54 -0
  290. package/tsup.config.ts +61 -36
  291. package/vitest.config.ts +5 -1
  292. package/dist/iife/index.d.ts +0 -1251
  293. package/dist/iife/index.global.js +0 -75
  294. package/dist/iife/index.global.js.map +0 -1
  295. package/src/platform-adapter/ssr/SSRPlatform.ts +0 -52
  296. /package/src/{ssr-polyfill.ts → isSSREnv.ts} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,1251 +1,35 @@
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
-
48
- /**
49
- * @hidden
50
- * Parent class of spatial objects, should not be used directly
51
- */
52
- declare class SpatialObject {
53
- /** @hidden */
54
- readonly id: string;
55
- /** @hidden */
56
- constructor(
57
- /** @hidden */
58
- id: string);
59
- name?: string;
60
- isDestroyed: boolean;
61
- inspect(): Promise<any>;
62
- destroy(): Promise<any>;
63
- protected onDestroy(): void;
64
- }
65
-
66
- declare class SpatialGeometry extends SpatialObject {
67
- id: string;
68
- options: SpatialGeometryOptions;
69
- static type: SpatialGeometryType;
70
- constructor(id: string, options: SpatialGeometryOptions);
71
- }
72
-
73
- declare abstract class SpatialMaterial extends SpatialObject {
74
- id: string;
75
- type: SpatialMaterialType;
76
- constructor(id: string, type: SpatialMaterialType);
77
- abstract updateProperties(properties: any): void;
78
- }
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
-
216
- declare enum SpatialWebMsgType {
217
- modelloaded = "modelloaded",
218
- modelloadfailed = "modelloadfailed",
219
- spatialtap = "spatialtap",
220
- spatialdragstart = "spatialdragstart",
221
- spatialdrag = "spatialdrag",
222
- spatialdragend = "spatialdragend",
223
- spatialrotate = "spatialrotate",
224
- spatialrotateend = "spatialrotateend",
225
- spatialmagnify = "spatialmagnify",
226
- spatialmagnifyend = "spatialmagnifyend",
227
- animationstatechange = "animationstatechange",
228
- objectdestroy = "objectdestroy"
229
- }
230
- interface ObjectDestroyMsg {
231
- type: SpatialWebMsgType.objectdestroy;
232
- }
233
- interface SpatialTapMsg {
234
- type: SpatialWebMsgType.spatialtap;
235
- detail: SpatialTapEventDetail;
236
- }
237
- interface SpatialDragStartMsg {
238
- type: SpatialWebMsgType.spatialdragstart;
239
- detail: SpatialDragStartEventDetail;
240
- }
241
- interface SpatialDragMsg {
242
- type: SpatialWebMsgType.spatialdrag;
243
- detail: SpatialDragEventDetail;
244
- }
245
- interface SpatialDragEndMsg {
246
- type: SpatialWebMsgType.spatialdragend;
247
- detail: SpatialDragEndEventDetail;
248
- }
249
- interface SpatialRotateMsg {
250
- type: SpatialWebMsgType.spatialrotate;
251
- detail: SpatialRotateEventDetail;
252
- }
253
- interface SpatialRotateEndMsg {
254
- type: SpatialWebMsgType.spatialrotateend;
255
- detail: SpatialRotateEventDetail;
256
- }
257
- interface ModelLoadSuccess {
258
- type: SpatialWebMsgType.modelloaded;
259
- detail?: {
260
- src: string;
261
- };
262
- }
263
- interface ModelLoadFailure {
264
- type: SpatialWebMsgType.modelloadfailed;
265
- }
266
- interface AnimationStateChangeDetail {
267
- paused: boolean;
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;
279
- }
280
- interface AnimationStateChangeMsg {
281
- type: SpatialWebMsgType.animationstatechange;
282
- detail: AnimationStateChangeDetail;
283
- }
284
-
285
- /**
286
- * Abstract base class for all spatialized elements in the WebSpatial environment.
287
- * Provides common functionality for elements that can exist in 3D space,
288
- * including transformation handling and gesture event processing.
289
- */
290
- declare abstract class SpatializedElement extends SpatialObject {
291
- readonly id: string;
292
- /**
293
- * Creates a new spatialized element with the specified ID.
294
- * Registers the element to receive spatial events.
295
- * @param id Unique identifier for this element
296
- */
297
- constructor(id: string);
298
- /**
299
- * Updates the properties of this spatialized element.
300
- * Must be implemented by derived classes to handle specific property updates.
301
- * @param properties Partial set of properties to update
302
- * @returns Promise resolving to the result of the update operation
303
- */
304
- abstract updateProperties(properties: Partial<SpatializedElementProperties>): Promise<WebSpatialProtocolResult>;
305
- /**
306
- * Updates the transformation matrix of this element in 3D space.
307
- * This affects the position, rotation, and scale of the element.
308
- * @param matrix The new transformation matrix
309
- * @returns Promise resolving when the transform is updated
310
- */
311
- updateTransform(matrix: DOMMatrix): Promise<CommandResult<any>>;
312
- /**
313
- * Information about the element's bounding cube.
314
- * Used for spatial calculations and hit testing.
315
- */
316
- private _cubeInfo?;
317
- /**
318
- * Gets the current cube information for this element.
319
- * @returns The current CubeInfo or undefined if not set
320
- */
321
- get cubeInfo(): CubeInfo | undefined;
322
- /**
323
- * The current transformation matrix of this element.
324
- */
325
- private _transform?;
326
- /**
327
- * The inverse of the current transformation matrix.
328
- * Used for converting world coordinates to local coordinates.
329
- */
330
- private _transformInv?;
331
- /**
332
- * Gets the current transformation matrix.
333
- * @returns The current transformation matrix or undefined if not set
334
- */
335
- get transform(): DOMMatrix | undefined;
336
- /**
337
- * Gets the inverse of the current transformation matrix.
338
- * @returns The inverse transformation matrix or undefined if not set
339
- */
340
- get transformInv(): DOMMatrix | undefined;
341
- /**
342
- * Processes events received from the WebSpatial environment.
343
- * Handles various spatial events like transforms, gestures, and interactions.
344
- * @param data The event data received from the WebSpatial system
345
- */
346
- protected onReceiveEvent(data: ReceiveEventData): void;
347
- private _onSpatialTap?;
348
- set onSpatialTap(value: (event: SpatialTapEvent) => void | undefined);
349
- private _onSpatialDragStart?;
350
- set onSpatialDragStart(value: (event: SpatialDragStartEvent) => void | undefined);
351
- private _onSpatialDrag?;
352
- set onSpatialDrag(value: (event: SpatialDragEvent) => void | undefined);
353
- private _onSpatialDragEnd?;
354
- set onSpatialDragEnd(value: ((event: SpatialDragEndEvent) => void) | undefined);
355
- private _onSpatialRotate?;
356
- set onSpatialRotate(value: ((event: SpatialRotateEvent) => void) | undefined);
357
- private _onSpatialRotateEnd?;
358
- set onSpatialRotateEnd(value: ((event: SpatialRotateEndEvent) => void) | undefined);
359
- private _onSpatialMagnify?;
360
- set onSpatialMagnify(value: ((event: SpatialMagnifyEvent) => void) | undefined);
361
- private _onSpatialMagnifyEnd?;
362
- set onSpatialMagnifyEnd(value: ((event: SpatialMagnifyEndEvent) => void) | undefined);
363
- /**
364
- * Cleans up resources when this element is destroyed.
365
- * Removes event receivers to prevent memory leaks.
366
- */
367
- onDestroy(): void;
368
- }
369
- type ReceiveEventData = SpatialTapMsg | SpatialDragStartMsg | SpatialDragMsg | SpatialDragEndMsg | SpatialRotateMsg | SpatialRotateEndMsg | ObjectDestroyMsg;
370
-
371
- declare class SpatializedDynamic3DElement extends SpatializedElement {
372
- children: SpatialEntityOrReality[];
373
- events: Record<string, (data: any) => void>;
374
- constructor(id: string);
375
- addEntity(entity: SpatialEntity): Promise<CommandResult<any>>;
376
- addEvent(type: SpatialEntityEventType, callback: (data: any) => void): void;
377
- removeEvent(eventName: SpatialEntityEventType): void;
378
- dispatchEvent(evt: CustomEvent): void;
379
- updateProperties(properties: Partial<SpatializedElementProperties>): Promise<CommandResult<any>>;
380
- }
381
-
382
- interface Vec3 {
383
- x: number;
384
- y: number;
385
- z: number;
386
- }
387
- type Point3D = Vec3;
388
- interface Quaternion {
389
- x: number;
390
- y: number;
391
- z: number;
392
- w: number;
393
- }
394
- /**
395
- * Material type for SpatialDiv or HTML document.
396
- *
397
- * This type defines the background material options for both SpatialDiv elements and HTML documents.
398
- *
399
- * - `'none'`: This is the default value.
400
- * - For HTML documents, the web page window will have the default native background.
401
- * - For SpatialDiv, the window will have a transparent background.
402
- * - `'translucent'`: Represents a glass-like material in AVP (Apple Vision Pro).
403
- * - `'thick'`: Represents a thick material in AVP.
404
- * - `'regular'`: Represents a regular material in AVP.
405
- * - `'thin'`: Represents a thin material in AVP.
406
- * - `'transparent'`: Represents a fully transparent background.
407
- */
408
- type BackgroundMaterialType = 'none' | 'translucent' | 'thick' | 'regular' | 'thin' | 'transparent';
409
- type CornerRadius = {
410
- topLeading: number;
411
- bottomLeading: number;
412
- topTrailing: number;
413
- bottomTrailing: number;
414
- };
415
- interface SpatialSceneProperties {
416
- cornerRadius: CornerRadius;
417
- material: BackgroundMaterialType;
418
- opacity: number;
419
- }
420
- declare enum SpatializedElementType {
421
- Spatialized2DElement = 0,
422
- SpatializedStatic3DElement = 1,
423
- SpatializedDynamic3DElement = 2
424
- }
425
- interface SpatializedElementProperties {
426
- name: string;
427
- clientX: number;
428
- clientY: number;
429
- width: number;
430
- height: number;
431
- depth: number;
432
- opacity: number;
433
- visible: boolean;
434
- scrollWithParent: boolean;
435
- zIndex: number;
436
- backOffset: number;
437
- rotationAnchor: Point3D;
438
- enableTapGesture: boolean;
439
- enableDragStartGesture: boolean;
440
- enableDragGesture: boolean;
441
- enableDragEndGesture: boolean;
442
- enableRotateGesture: boolean;
443
- enableRotateEndGesture: boolean;
444
- enableMagnifyGesture: boolean;
445
- enableMagnifyEndGesture: boolean;
446
- /**
447
- * Optional world-space axis for spatial rotate gesture. Omitted or zero vector
448
- * means unconstrained rotation (platform default).
449
- */
450
- rotateConstrainedToAxis?: Vec3;
451
- }
452
- interface Spatialized2DElementProperties extends SpatializedElementProperties {
453
- scrollPageEnabled: boolean;
454
- cornerRadius: CornerRadius;
455
- material: BackgroundMaterialType;
456
- scrollEdgeInsetsMarginRight: number;
457
- }
458
- interface ModelSource {
459
- src: string;
460
- type?: string;
461
- }
462
- type ModelLoadingMode = 'eager' | 'lazy';
463
- interface SpatializedStatic3DElementProperties extends SpatializedElementProperties {
464
- modelURL: string;
465
- sources?: ModelSource[];
466
- modelTransform?: number[];
467
- autoplay?: boolean;
468
- loop?: boolean;
469
- animationPaused?: boolean;
470
- playbackRate?: number;
471
- currentTime?: number;
472
- posterURL?: string;
473
- loading?: ModelLoadingMode;
474
- }
475
- interface SpatialSceneCreationOptions {
476
- defaultSize?: {
477
- width: number | string;
478
- height: number | string;
479
- depth?: number | string;
480
- };
481
- resizability?: {
482
- minWidth?: number | string;
483
- minHeight?: number | string;
484
- maxWidth?: number | string;
485
- maxHeight?: number | string;
486
- };
487
- worldScaling?: WorldScalingType;
488
- worldAlignment?: WorldAlignmentType;
489
- baseplateVisibility?: BaseplateVisibilityType;
490
- }
491
- type SpatialEntityEventType = 'spatialtap' | 'spatialdragstart' | 'spatialdrag' | 'spatialdragend' | 'spatialrotate' | 'spatialrotateend' | 'spatialmagnify' | 'spatialmagnifyend';
492
- declare const BaseplateVisibilityValues: readonly ["automatic", "visible", "hidden"];
493
- type BaseplateVisibilityType = (typeof BaseplateVisibilityValues)[number];
494
- declare function isValidBaseplateVisibilityType(type: string): Boolean;
495
- declare const WorldScalingValues: readonly ["automatic", "dynamic"];
496
- type WorldScalingType = (typeof WorldScalingValues)[number];
497
- declare function isValidWorldScalingType(type: string): Boolean;
498
- declare const WorldAlignmentValues: readonly ["adaptive", "automatic", "gravityAligned"];
499
- type WorldAlignmentType = (typeof WorldAlignmentValues)[number];
500
- declare function isValidWorldAlignmentType(type: string): Boolean;
501
- declare const SpatialSceneValues: readonly ["window", "volume"];
502
- type SpatialSceneType = (typeof SpatialSceneValues)[number];
503
- declare function isValidSpatialSceneType(type: string): Boolean;
504
- /**
505
- * check px,m and number, number must be >= 0
506
- *
507
- * */
508
- declare function isValidSceneUnit(val: string | number): boolean;
509
- interface SpatialEntityProperties {
510
- position: Vec3;
511
- rotation: Vec3;
512
- scale: Vec3;
513
- }
514
- type SpatialGeometryType = 'BoxGeometry' | 'PlaneGeometry' | 'SphereGeometry' | 'CylinderGeometry' | 'ConeGeometry';
515
- interface SpatialBoxGeometryOptions {
516
- width?: number;
517
- height?: number;
518
- depth?: number;
519
- cornerRadius?: number;
520
- splitFaces?: boolean;
521
- }
522
- interface SpatialPlaneGeometryOptions {
523
- width?: number;
524
- height?: number;
525
- cornerRadius?: number;
526
- }
527
- interface SpatialSphereGeometryOptions {
528
- radius?: number;
529
- }
530
- interface SpatialConeGeometryOptions {
531
- radius?: number;
532
- height?: number;
533
- }
534
- interface SpatialCylinderGeometryOptions {
535
- radius?: number;
536
- height?: number;
537
- }
538
- type SpatialGeometryOptions = SpatialBoxGeometryOptions | SpatialPlaneGeometryOptions | SpatialSphereGeometryOptions | SpatialCylinderGeometryOptions | SpatialConeGeometryOptions;
539
- type SpatialMaterialType = 'unlit';
540
- interface SpatialUnlitMaterialOptions {
541
- color?: string;
542
- textureId?: string;
543
- transparent?: boolean;
544
- opacity?: number;
545
- }
546
- interface SpatialTextureResourceOptions {
547
- url: string;
548
- }
549
- interface ModelComponentOptions {
550
- mesh: SpatialGeometry;
551
- materials: SpatialMaterial[];
552
- }
553
- interface SpatialEntityUserData {
554
- id?: string;
555
- name?: string;
556
- }
557
- interface SpatialModelEntityCreationOptions {
558
- modelAssetId: string;
559
- name?: string;
560
- }
561
- interface ModelAssetOptions {
562
- url: string;
563
- }
564
- declare enum SpatialSceneState {
565
- idle = "idle",
566
- pending = "pending",
567
- willVisible = "willVisible",
568
- visible = "visible",
569
- fail = "fail"
570
- }
571
- /**
572
- * Translate event, matching similar behavior to https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drag_event
573
- */
574
- type SpatialModelDragEvent = {
575
- eventType: 'dragstart' | 'dragend' | 'drag';
576
- translation3D: Vec3;
577
- startLocation3D: Vec3;
578
- };
579
- interface Size {
580
- width: number;
581
- height: number;
582
- }
583
- interface Size3D extends Size {
584
- depth: number;
585
- }
586
- declare class CubeInfo {
587
- size: Size3D;
588
- origin: Vec3;
589
- constructor(size: Size3D, origin: Vec3);
590
- get x(): number;
591
- get y(): number;
592
- get z(): number;
593
- get width(): number;
594
- get height(): number;
595
- get depth(): number;
596
- get left(): number;
597
- get top(): number;
598
- get right(): number;
599
- get bottom(): number;
600
- get back(): number;
601
- get front(): number;
602
- }
603
- interface SpatialTapEventDetail {
604
- location3D: Point3D;
605
- globalLocation3D?: Point3D;
606
- }
607
- type SpatialTapEvent = CustomEvent<SpatialTapEventDetail>;
608
- interface SpatialDragStartEventDetail {
609
- startLocation3D: Point3D;
610
- globalLocation3D?: Point3D;
611
- }
612
- interface SpatialDragEventDetail {
613
- translation3D: Vec3;
614
- }
615
- interface SpatialDragEndEventDetail {
616
- }
617
- type SpatialDragStartEvent = CustomEvent<SpatialDragStartEventDetail>;
618
- type SpatialDragEvent = CustomEvent<SpatialDragEventDetail>;
619
- type SpatialDragEndEvent = CustomEvent<SpatialDragEndEventDetail>;
620
- interface SpatialRotateEventDetail {
621
- quaternion: Quaternion;
622
- }
623
- interface SpatialRotateEndEventDetail {
624
- }
625
- type SpatialRotateEvent = CustomEvent<SpatialRotateEventDetail>;
626
- type SpatialRotateEndEvent = CustomEvent<SpatialRotateEndEventDetail>;
627
- interface SpatialMagnifyEventDetail {
628
- magnification: number;
629
- }
630
- interface SpatialMagnifyEndEventDetail {
631
- }
632
- type SpatialMagnifyEvent = CustomEvent<SpatialMagnifyEventDetail>;
633
- type SpatialMagnifyEndEvent = CustomEvent<SpatialMagnifyEndEventDetail>;
634
- type SpatialEntityOrReality = SpatialEntity | SpatializedDynamic3DElement;
635
- interface AttachmentEntityOptions {
636
- parentEntityId: string;
637
- position?: [number, number, number];
638
- size: {
639
- width: number;
640
- height: number;
641
- };
642
- ownerViewId: string;
643
- }
644
- interface AttachmentEntityUpdateOptions {
645
- position?: [number, number, number];
646
- size?: {
647
- width: number;
648
- height: number;
649
- };
650
- }
651
- type SceneUnitPx = `${number}px`;
652
- type SceneUnitM = `${number}m`;
653
- type SceneUnit = number | SceneUnitPx | SceneUnitM;
654
- interface XRSceneSize {
655
- width: SceneUnit;
656
- height: SceneUnit;
657
- depth?: SceneUnit;
658
- }
659
- interface XRSceneResizability {
660
- minWidth?: SceneUnit;
661
- minHeight?: SceneUnit;
662
- maxWidth?: SceneUnit;
663
- maxHeight?: SceneUnit;
664
- }
665
- interface XRMainSceneConfig extends XRSpatialSceneDefaults {
666
- type?: SpatialSceneType;
667
- }
668
- interface XRSpatialSceneDefaults {
669
- default_size?: XRSceneSize;
670
- resizability?: XRSceneResizability;
671
- worldScaling?: WorldScalingType;
672
- worldAlignment?: WorldAlignmentType;
673
- baseplateVisibility?: BaseplateVisibilityType;
674
- }
675
- interface XRSpatialSceneOverrides {
676
- window_scene?: XRSpatialSceneDefaults;
677
- volume_scene?: XRSpatialSceneDefaults;
678
- }
679
- interface XRSpatialSceneConfig extends XRSpatialSceneDefaults {
680
- overrides?: XRSpatialSceneOverrides;
681
- }
682
- interface XRPrdConfig {
683
- xr_main_scene?: XRMainSceneConfig;
684
- xr_spatial_scene?: XRSpatialSceneConfig;
685
- }
686
- interface PWAManifest extends XRPrdConfig {
687
- name?: string;
688
- short_name?: string;
689
- start_url?: string;
690
- display?: string;
691
- icons?: Array<{
692
- src: string;
693
- sizes?: string;
694
- type?: string;
695
- purpose?: string;
696
- }>;
697
- id?: string;
698
- scope?: string;
699
- [key: string]: any;
700
- }
701
-
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
- }
739
- }
740
-
741
- declare function initScene(name: string, callback: (pre: SpatialSceneCreationOptions) => SpatialSceneCreationOptions, options?: {
742
- type: SpatialSceneType;
743
- }): void;
744
-
745
- /**
746
- * Represents the spatial scene that contains all spatialized elements.
747
- * This class follows the singleton pattern - only one instance exists per application.
748
- * The scene manages the overall spatial environment properties and contains all spatial elements.
749
- */
750
- declare class SpatialScene extends SpatialObject {
751
- /**
752
- * Gets the singleton instance of the SpatialScene.
753
- * Creates a new instance if one doesn't exist yet.
754
- * @returns The singleton SpatialScene instance
755
- */
756
- static getInstance(): SpatialScene;
757
- convertCoordinate(position: Vec3, fromId: string, toId: string): Promise<Vec3>;
758
- /**
759
- * Updates the properties of the spatial scene.
760
- * This can include background settings, lighting, and other scene-wide properties.
761
- * @param properties Partial set of properties to update
762
- * @returns Promise resolving when the update is complete
763
- */
764
- updateSpatialProperties(properties: Partial<SpatialSceneProperties>): Promise<CommandResult<any>>;
765
- /**
766
- * Adds a spatialized element to the scene.
767
- * This makes the element visible and interactive in the spatial environment.
768
- * @param element The SpatializedElement to add to the scene
769
- * @returns Promise resolving when the element is added
770
- */
771
- addSpatializedElement(element: SpatializedElement): Promise<CommandResult<any>>;
772
- /**
773
- * Updates the scene creation configuration.
774
- * This allows changing scene parameters after initial creation.
775
- * @param config The new scene creation configuration
776
- * @returns Promise resolving when the update is complete
777
- */
778
- updateSceneCreationConfig(config: SpatialSceneCreationOptionsInternal): Promise<CommandResult<any>>;
779
- /**
780
- * Gets the current state of the spatial scene.
781
- * This includes information about active elements and scene configuration.
782
- * @returns Promise resolving to the current SpatialSceneState
783
- */
784
- getState(): Promise<SpatialSceneState$1>;
785
- }
786
-
787
- /**
788
- * Represents a 2D HTML element that has been spatialized in 3D space.
789
- * This class handles the integration between 2D web content and the 3D spatial environment,
790
- * allowing HTML elements to be positioned and interacted with in spatial applications.
791
- */
792
- declare class Spatialized2DElement extends SpatializedElement {
793
- readonly windowProxy: WindowProxy;
794
- /**
795
- * Creates a new spatialized 2D element.
796
- * @param id Unique identifier for this element
797
- * @param windowProxy Reference to the window object containing the 2D content
798
- */
799
- constructor(id: string, windowProxy: WindowProxy);
800
- /**
801
- * Updates the properties of this 2D element.
802
- * This can include size, position, background, and other visual properties.
803
- * @param properties Partial set of properties to update
804
- * @returns Promise resolving when the update is complete
805
- */
806
- updateProperties(properties: Partial<Spatialized2DElementProperties>): Promise<CommandResult<any>>;
807
- /**
808
- * Adds a child spatialized element to this 2D element.
809
- * This allows for creating hierarchical structures of spatial elements.
810
- * @param element The child element to add
811
- * @returns Promise resolving when the element is added
812
- */
813
- addSpatializedElement(element: SpatializedElement): Promise<CommandResult<any>>;
814
- }
815
-
816
- /**
817
- * Represents a static 3D model element in the spatial environment.
818
- * This class handles loading and displaying pre-built 3D models from URLs,
819
- * and provides events for load success and failure.
820
- */
821
- declare class SpatializedStatic3DElement extends SpatializedElement {
822
- /**
823
- * Creates a new spatialized static 3D element with the specified ID and URL.
824
- * Registers the element to receive spatial events.
825
- * @param id Unique identifier for this element
826
- * @param modelURL URL of the 3D model
827
- * @param sources Optional fallback model sources
828
- * @param loading Initial loading mode (`'eager'` by default)
829
- */
830
- constructor(id: string, modelURL?: string, sources?: ModelSource[], loading?: ModelLoadingMode);
831
- /**
832
- * Promise resolver for the ready state.
833
- * Used to resolve the ready promise when the model is loaded.
834
- */
835
- private _readyResolve?;
836
- /**
837
- * Caches the last model URL to detect changes.
838
- * Used to reset the ready promise when the model URL changes.
839
- */
840
- private modelURL?;
841
- get modelUrl(): string | undefined;
842
- /**
843
- * Caches the last sources array to detect changes.
844
- */
845
- private sources?;
846
- /**
847
- * The model URL that was successfully loaded by the native runtime.
848
- */
849
- private _currentSrc;
850
- get currentSrc(): string;
851
- /**
852
- * Creates a new promise for tracking the ready state of the model.
853
- * @returns Promise that resolves when the model is loaded (true) or fails to load (false)
854
- */
855
- private createReadyPromise;
856
- /**
857
- * Promise that resolves when the model is loaded.
858
- * Resolves to true on successful load, false on failure.
859
- */
860
- ready: Promise<boolean>;
861
- /**
862
- * Updates the properties of this static 3D element.
863
- * Handles special case for modelURL changes by resetting the ready promise.
864
- * @param properties Partial set of properties to update
865
- * @returns Promise resolving when the update is complete
866
- */
867
- updateProperties(properties: Partial<SpatializedStatic3DElementProperties>): Promise<CommandResult<any>>;
868
- /**
869
- * Total animation duration in seconds, synced from native.
870
- */
871
- private _duration;
872
- /**
873
- * Returns the total animation duration in seconds.
874
- */
875
- get duration(): number;
876
- /**
877
- * Playback speed multiplier.
878
- */
879
- private _playbackRate;
880
- /**
881
- * Returns the current playback rate.
882
- */
883
- get playbackRate(): number;
884
- /**
885
- * Sets the playback rate and sends it to native.
886
- */
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);
910
- /**
911
- * Whether the animation is currently paused.
912
- */
913
- private _paused;
914
- /**
915
- * Returns whether the animation is currently paused.
916
- */
917
- get paused(): boolean;
918
- /**
919
- * Callback for animation state changes.
920
- */
921
- private _onAnimationStateChangeCallback?;
922
- /**
923
- * Sets the callback for animation state changes.
924
- */
925
- set onAnimationStateChangeCallback(callback: undefined | ((detail: AnimationStateChangeDetail) => void));
926
- /**
927
- * Starts or resumes animation playback.
928
- * @returns Promise resolving when the command is sent
929
- */
930
- play(): Promise<void>;
931
- /**
932
- * Pauses animation playback.
933
- * @returns Promise resolving when the command is sent
934
- */
935
- pause(): Promise<void>;
936
- /**
937
- * Processes events received from the WebSpatial environment.
938
- * Handles model loading events in addition to base spatial events.
939
- * @param data The event data received from the WebSpatial system
940
- */
941
- onReceiveEvent(data: Static3DReceiveEventData): void;
942
- /**
943
- * Whether the model should automatically play its first animation on load.
944
- */
945
- private _autoplay;
946
- /**
947
- * Returns whether autoplay is enabled for this element.
948
- */
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;
956
- /**
957
- * Whether the model animation should loop continuously.
958
- */
959
- private _loop;
960
- /**
961
- * Returns whether loop is enabled for this element.
962
- */
963
- get loop(): boolean;
964
- /**
965
- * Callback function for successful model loading.
966
- */
967
- private _onLoadCallback?;
968
- /**
969
- * Sets the callback function for successful model loading.
970
- * @param callback Function to call when the model is loaded successfully
971
- */
972
- set onLoadCallback(callback: undefined | (() => void));
973
- /**
974
- * Callback function for model loading failure.
975
- */
976
- private _onLoadFailureCallback?;
977
- /**
978
- * Sets the callback function for model loading failure.
979
- * @param callback Function to call when the model fails to load
980
- */
981
- set onLoadFailureCallback(callback: undefined | (() => void));
982
- updateModelTransform(transform: DOMMatrixReadOnly): void;
983
- }
984
- type Static3DReceiveEventData = ModelLoadSuccess | ModelLoadFailure | ReceiveEventData | AnimationStateChangeMsg;
985
-
986
- /**
987
- * Session used to establish a connection to the spatial renderer of the system.
988
- * All spatial resources must be created through this session object.
989
- * This class serves as the main factory for creating spatial elements and geometries.
990
- */
991
- declare class SpatialSession {
992
- /**
993
- * Gets the singleton instance of the spatial scene.
994
- * The spatial scene is the root container for all spatial elements.
995
- * @returns The SpatialScene singleton instance
996
- */
997
- getSpatialScene(): SpatialScene;
998
- /**
999
- * Creates a new 2D element that can be spatialized in the 3D environment.
1000
- * 2D elements represent HTML content that can be positioned in 3D space.
1001
- * @returns Promise resolving to a new Spatialized2DElement instance
1002
- */
1003
- createSpatialized2DElement(): Promise<Spatialized2DElement>;
1004
- /**
1005
- * Creates a new static 3D element with an optional model URL.
1006
- * Static 3D elements represent pre-built 3D models that can be loaded from a URL.
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'`)
1010
- * @returns Promise resolving to a new SpatializedStatic3DElement instance
1011
- */
1012
- createSpatializedStatic3DElement(modelURL?: string, sources?: ModelSource[], loading?: ModelLoadingMode): Promise<SpatializedStatic3DElement>;
1013
- /**
1014
- * Initializes the spatial scene with custom configuration.
1015
- * This is a reference to the initScene function from scene-polyfill.
1016
- */
1017
- initScene: typeof initScene;
1018
- /**
1019
- * Creates a new dynamic 3D element that can be manipulated at runtime.
1020
- * Dynamic 3D elements allow for programmatic creation and modification of 3D content.
1021
- * @returns Promise resolving to a new SpatializedDynamic3DElement instance
1022
- */
1023
- createSpatializedDynamic3DElement(): Promise<SpatializedDynamic3DElement>;
1024
- /**
1025
- * Creates a new spatial entity with an optional name.
1026
- * Entities are the basic building blocks for creating custom 3D content.
1027
- * @param name Optional name for the entity
1028
- * @returns Promise resolving to a new SpatialEntity instance
1029
- */
1030
- createEntity(userData?: SpatialEntityUserData): Promise<SpatialEntity>;
1031
- /**
1032
- * Creates a box geometry with optional configuration.
1033
- * @param options Configuration options for the box geometry
1034
- * @returns Promise resolving to a new SpatialBoxGeometry instance
1035
- */
1036
- createBoxGeometry(options?: SpatialBoxGeometryOptions): Promise<SpatialBoxGeometry>;
1037
- /**
1038
- * Creates a plane geometry with optional configuration.
1039
- * @param options Configuration options for the plane geometry
1040
- * @returns Promise resolving to a new SpatialPlaneGeometry instance
1041
- */
1042
- createPlaneGeometry(options?: SpatialPlaneGeometryOptions): Promise<SpatialPlaneGeometry>;
1043
- /**
1044
- * Creates a sphere geometry with optional configuration.
1045
- * @param options Configuration options for the sphere geometry
1046
- * @returns Promise resolving to a new SpatialSphereGeometry instance
1047
- */
1048
- createSphereGeometry(options?: SpatialSphereGeometryOptions): Promise<SpatialSphereGeometry>;
1049
- /**
1050
- * Creates a cone geometry with the specified configuration.
1051
- * @param options Configuration options for the cone geometry
1052
- * @returns Promise resolving to a new SpatialConeGeometry instance
1053
- */
1054
- createConeGeometry(options: SpatialConeGeometryOptions): Promise<SpatialConeGeometry>;
1055
- /**
1056
- * Creates a cylinder geometry with the specified configuration.
1057
- * @param options Configuration options for the cylinder geometry
1058
- * @returns Promise resolving to a new SpatialCylinderGeometry instance
1059
- */
1060
- createCylinderGeometry(options: SpatialCylinderGeometryOptions): Promise<SpatialCylinderGeometry>;
1061
- /**
1062
- * Creates a model component with the specified configuration.
1063
- * Model components are used to add 3D model rendering capabilities to entities.
1064
- * @param options Configuration options for the model component
1065
- * @returns Promise resolving to a new ModelComponent instance
1066
- */
1067
- createModelComponent(options: ModelComponentOptions): Promise<ModelComponent>;
1068
- /**
1069
- * Creates an unlit material with the specified configuration.
1070
- * Unlit materials don't respond to lighting in the scene.
1071
- * @param options Configuration options for the unlit material
1072
- * @returns Promise resolving to a new SpatialUnlitMaterial instance
1073
- */
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>;
1082
- /**
1083
- * Creates a model asset with the specified configuration.
1084
- * Model assets represent 3D model resources that can be used by entities.
1085
- * @param options Configuration options for the model asset
1086
- * @returns Promise resolving to a new SpatialModelAsset instance
1087
- */
1088
- createModelAsset(options: ModelAssetOptions): Promise<SpatialModelAsset>;
1089
- /**
1090
- * Creates a spatial model entity with the specified configuration.
1091
- * This is a convenience method for creating an entity with a model component.
1092
- * @param options Configuration options for the spatial model entity
1093
- * @returns Promise resolving to a new SpatialModelEntity instance
1094
- */
1095
- createSpatialModelEntity(options: SpatialModelEntityCreationOptions, userData?: SpatialEntityUserData): Promise<SpatialModelEntity>;
1096
- /**
1097
- * Creates an attachment entity that renders 2D HTML content as a child
1098
- * of a 3D entity in the scene graph.
1099
- * @param options Configuration options including parent entity ID, position, and size
1100
- * @returns Promise resolving to a new Attachment instance
1101
- */
1102
- createAttachmentEntity(options: AttachmentEntityOptions): Promise<Attachment>;
1103
- }
1104
-
1105
- /**
1106
- * Base object designed to be placed on navigator.spatial to mirror navigator.xr for webxr.
1107
- * This is the main entry point for the WebSpatial SDK, providing access to spatial capabilities.
1108
- */
1109
- declare class Spatial {
1110
- /**
1111
- * Requests a spatial session object from the browser.
1112
- * This is the primary method to initialize spatial functionality.
1113
- * @returns The SpatialSession instance or null if not available in the current browser
1114
- * [TODO] discuss implications of this not being async
1115
- */
1116
- requestSession(): SpatialSession | null;
1117
- /**
1118
- * Checks if the current page is running in a spatial web environment.
1119
- * This method detects if the application is running in a WebSpatial-compatible browser.
1120
- * @returns True if running in a spatial web environment, false otherwise
1121
- */
1122
- runInSpatialWeb(): boolean;
1123
- /** @deprecated
1124
- * Checks if WebSpatial is supported in the current environment.
1125
- * Verifies compatibility between native and client versions.
1126
- * @returns True if web spatial is supported by this webpage
1127
- */
1128
- isSupported(): boolean;
1129
- /** @deprecated
1130
- * Gets the native WebSpatial version from the browser environment.
1131
- * The version format follows semantic versioning (x.x.x).
1132
- * @returns Native version string in format "x.x.x"
1133
- */
1134
- getNativeVersion(): any;
1135
- /** @deprecated
1136
- * Gets the client SDK version.
1137
- * The version format follows semantic versioning (x.x.x).
1138
- * @returns Client SDK version string in format "x.x.x"
1139
- */
1140
- getClientVersion(): string;
1141
- }
1142
-
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;
1152
- };
1153
-
1154
- /**
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).
1157
- */
1158
- declare class WebSpatialRuntimeError extends Error {
1159
- readonly capability: string;
1160
- constructor(capability: string, message?: string);
1161
- }
1162
-
1163
- /**
1164
- * Canonical `supports(name)` keys (OpenSpec `review.md` §3).
1165
- * Aliases are normalized before lookup (see `normalizeCapabilityName`).
1166
- */
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"];
1171
- /**
1172
- * Spatialized container `ref` readbacks (`HTMLElement` / React `useDomProxy` Proxy).
1173
- * See `global.d.ts` (`HTMLElement`) and `useDomProxy.ts` (`has` / `get` traps).
1174
- */
1175
- declare const ELEMENT_DOM_DEPTH_KEYS: readonly ["xrClientDepth", "xrOffsetBack"];
1176
- /**
1177
- * Scene / global readbacks on `Window` (`global.d.ts` → `Window`).
1178
- */
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[]>>;
1187
-
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;
1205
-
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;
1212
-
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;
1229
-
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;
1237
-
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
- };
1248
-
1249
- declare const isSSREnv: () => boolean;
1250
-
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 };
1
+ import './types/global.js';
2
+ export { SpatialObject } from './SpatialObject.js';
3
+ export { Spatial } from './Spatial.js';
4
+ export { SpatialSession } from './SpatialSession.js';
5
+ export { SpatialScene } from './SpatialScene.js';
6
+ export { A as AnimateTransformCommand, a as AnimateTransformResult, b as AnimatedProps, c as AnimatedPropsInternal, d as AnimationApi, e as AnimationConfig, f as AnimationError, g as AnimationPlayState, h as AttachmentEntityOptions, i as AttachmentEntityUpdateOptions, B as BackgroundMaterialType, j as BaseplateVisibilityType, k as BaseplateVisibilityValues, C as CornerRadius, l as CubeInfo, F as Float4x4, M as ModelAssetOptions, m as ModelComponentOptions, n as ModelLoadingMode, o as ModelSource, P as PWAManifest, p as Point3D, Q as Quaternion, S as SceneUnit, q as SceneUnitM, r as SceneUnitPx, s as Size, t as Size3D, u as SpatialBoxGeometryOptions, v as SpatialConeGeometryOptions, w as SpatialCylinderGeometryOptions, x as SpatialDragEndEvent, y as SpatialDragEndEventDetail, z as SpatialDragEvent, D as SpatialDragEventDetail, E as SpatialDragStartEvent, G as SpatialDragStartEventDetail, H as SpatialEntity, I as SpatialEntityEventType, J as SpatialEntityOrReality, K as SpatialEntityProperties, L as SpatialEntityUserData, N as SpatialGeometry, O as SpatialGeometryOptions, R as SpatialGeometryType, T as SpatialMagnifyEndEvent, U as SpatialMagnifyEndEventDetail, V as SpatialMagnifyEvent, W as SpatialMagnifyEventDetail, X as SpatialMaterial, Y as SpatialMaterialType, Z as SpatialModelDragEvent, _ as SpatialModelEntityCreationOptions, $ as SpatialPlaneGeometryOptions, a0 as SpatialRotateEndEvent, a1 as SpatialRotateEndEventDetail, a2 as SpatialRotateEvent, a3 as SpatialRotateEventDetail, a4 as SpatialSceneCreationOptions, a5 as SpatialSceneProperties, a6 as SpatialSceneState, a7 as SpatialSceneType, a8 as SpatialSceneValues, a9 as SpatialSphereGeometryOptions, aa as SpatialTapEvent, ab as SpatialTapEventDetail, ac as SpatialTextureResourceOptions, ad as SpatialUnlitMaterialOptions, ae as Spatialized2DElementProperties, af as SpatializedDynamic3DElement, ag as SpatializedElement, ah as SpatializedElementProperties, ai as SpatializedElementType, aj as SpatializedMotionConfig, ak as SpatializedMotionKind, al as SpatializedMotionPlayState, am as SpatializedMotionSegmentConfig, an as SpatializedMotionTimelineConfig, ao as SpatializedPlaybackApi, ap as SpatializedStatic3DElementProperties, aq as StageMode, ar as TimingFunction, as as TransformValues, at as Vec3, au as WorldAlignmentType, av as WorldAlignmentValues, aw as WorldScalingType, ax as WorldScalingValues, ay as XRMainSceneConfig, az as XRPrdConfig, aA as XRSceneResizability, aB as XRSceneSize, aC as XRSpatialSceneConfig, aD as XRSpatialSceneDefaults, aE as XRSpatialSceneOverrides, aF as isValidBaseplateVisibilityType, aG as isValidSceneUnit, aH as isValidSpatialSceneType, aI as isValidWorldAlignmentType, aJ as isValidWorldScalingType } from './spatializedElementMotion-_0XWPQCE.js';
7
+ export { Spatialized2DElement } from './Spatialized2DElement.js';
8
+ export { SpatializedStatic3DElement } from './SpatializedStatic3DElement.js';
9
+ export { p as PhysicalMetrics } from './physicalMetrics-W5uZ5xKb.js';
10
+ export { SpatialModelEntity } from './reality/entity/SpatialModelEntity.js';
11
+ export { SpatialComponent } from './reality/component/SpatialComponent.js';
12
+ export { ModelComponent } from './reality/component/ModelComponent.js';
13
+ export { SpatialUnlitMaterial } from './reality/material/SpatialUnlitMaterial.js';
14
+ export { SpatialBoxGeometry } from './reality/geometry/SpatialBoxGeometry.js';
15
+ export { SpatialSphereGeometry } from './reality/geometry/SpatialSphereGeometry.js';
16
+ export { SpatialCylinderGeometry } from './reality/geometry/SpatialCylinderGeometry.js';
17
+ export { SpatialPlaneGeometry } from './reality/geometry/SpatialPlaneGeometry.js';
18
+ export { SpatialConeGeometry } from './reality/geometry/SpatialConeGeometry.js';
19
+ export { SpatialModelAsset } from './reality/resource/SpatialModelAsset.js';
20
+ export { SpatialTextureResource } from './reality/resource/SpatialTextureResource.js';
21
+ export { Attachment, createAttachmentEntity } from './reality/Attachment.js';
22
+ export { SpatializedVisualTransform, SpatializedVisualValues } from './types/motion/spatializedVisual.js';
23
+ export { SpatializedPlaybackError } from './types/motion/spatializedPlayback.js';
24
+ export { validateSpatializedMotionConfig } from './motion/compute/validate.js';
25
+ export { WebSpatialRuntimeSnapshot, WebSpatialRuntimeType } from './runtime/types.js';
26
+ export { WebSpatialRuntimeError } from './runtime/WebSpatialRuntimeError.js';
27
+ export { VISIONOS_DEBUG_SHELL_VERSION_PLACEHOLDER, getRuntime, resetRuntimeCacheForTests, supports } from './runtime/supports.js';
28
+ export { compareSemver, parseSemverOrNull } from './runtime/semver.js';
29
+ export { computeRuntimeFromUserAgent, parseShellToken } from './runtime/userAgent.js';
30
+ export { JsbAdapterPlatformKind, resolveJsbAdapterPlatform } from './runtime/jsbAdapterPlatform.js';
31
+ export { CAPABILITY_TABLE, CapabilityVersionRow } from './runtime/capability-data.js';
32
+ export { CapabilityKey } from './runtime/keys.js';
33
+ export { composeSRT, decomposeSRT } from './utils.js';
34
+ export { isSSREnv } from './isSSREnv.js';
35
+ import './scene-polyfill.js';