@webspatial/core-sdk 1.6.1 → 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 (320) hide show
  1. package/CHANGELOG.md +84 -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 -1101
  43. package/dist/index.js +21 -3393
  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 +148 -91
  241. package/src/Spatial.ts +0 -21
  242. package/src/SpatialObject.ts +10 -0
  243. package/src/SpatialScene.ts +1 -5
  244. package/src/SpatialSession.ts +17 -3
  245. package/src/Spatialized2DElement.ts +5 -0
  246. package/src/SpatializedDynamic3DElement.ts +5 -1
  247. package/src/SpatializedElement.ts +29 -0
  248. package/src/SpatializedElementCreator.ts +6 -4
  249. package/src/SpatializedStatic3DElement.test.ts +99 -0
  250. package/src/SpatializedStatic3DElement.ts +141 -4
  251. package/src/WebMsgCommand.ts +50 -0
  252. package/src/coverage-boost.test.ts +258 -316
  253. package/src/index.ts +28 -12
  254. package/src/install-polyfills.ts +38 -0
  255. package/src/jsbcommand.coverage.test.ts +42 -48
  256. package/src/motion/AnimationObject.test.ts +421 -0
  257. package/src/motion/AnimationObject.ts +208 -0
  258. package/src/motion/compute/index.ts +10 -0
  259. package/src/motion/compute/motionPropertyValues.test.ts +55 -0
  260. package/src/motion/compute/motionPropertyValues.ts +70 -0
  261. package/src/motion/compute/normalize.test.ts +99 -0
  262. package/src/motion/compute/normalize.ts +289 -0
  263. package/src/motion/compute/validate.test.ts +229 -0
  264. package/src/motion/compute/validate.ts +156 -0
  265. package/src/motion/index.ts +2 -0
  266. package/src/motion/native/serializeMotionTimeline.test.ts +61 -0
  267. package/src/motion/native/serializeMotionTimeline.ts +27 -0
  268. package/src/platform-adapter/CommandResultUtils.ts +2 -2
  269. package/src/platform-adapter/createPlatformSync.ts +36 -0
  270. package/src/platform-adapter/index.ts +5 -51
  271. package/src/platform-adapter/interface.ts +35 -23
  272. package/src/platform-adapter/pico-os/PicoOSPlatform.ts +156 -59
  273. package/src/platform-adapter/puppeteer/PuppeteerPlatform.ts +37 -11
  274. package/src/platform-adapter/spatialRequestMetadata.test.ts +175 -0
  275. package/src/platform-adapter/spatialRequestMetadata.ts +48 -0
  276. package/src/platform-adapter/spatialSceneQuery.ts +17 -0
  277. package/src/platform-adapter/vision-os/VisionOSPlatform.ts +60 -24
  278. package/src/platform-runtime.ts +13 -0
  279. package/src/reality/Attachment.ts +2 -2
  280. package/src/reality/entity/SpatialEntity.ts +127 -2
  281. package/src/reality/realityCreator.ts +15 -1
  282. package/src/reality/resource/SpatialTextureResource.ts +16 -0
  283. package/src/reality/resource/index.ts +1 -0
  284. package/src/runtime/WebSpatialRuntimeError.ts +16 -0
  285. package/src/runtime/capability-data.ts +213 -0
  286. package/src/runtime/contract-review.test.ts +44 -0
  287. package/src/runtime/index.ts +17 -0
  288. package/src/runtime/jsbAdapterPlatform.test.ts +36 -0
  289. package/src/runtime/jsbAdapterPlatform.ts +51 -0
  290. package/src/runtime/keys.ts +140 -0
  291. package/src/runtime/semver.ts +33 -0
  292. package/src/runtime/supports.test.ts +346 -0
  293. package/src/runtime/supports.ts +112 -0
  294. package/src/runtime/types.ts +11 -0
  295. package/src/runtime/useAnimation.capability.test.ts +275 -0
  296. package/src/runtime/userAgent.ts +64 -0
  297. package/src/scene-polyfill.manifest.test.ts +312 -9
  298. package/src/scene-polyfill.request-metadata.test.ts +39 -0
  299. package/src/scene-polyfill.test.ts +33 -94
  300. package/src/scene-polyfill.ts +125 -92
  301. package/src/spatial-host.ts +25 -0
  302. package/src/spatial-window-polyfill.ts +18 -2
  303. package/src/transform-roundtrip.test.ts +90 -0
  304. package/src/types/animation.ts +224 -0
  305. package/src/types/{global.d.ts → global.ts} +10 -12
  306. package/src/types/motion/index.ts +10 -0
  307. package/src/types/motion/spatializedElementMotion.ts +49 -0
  308. package/src/types/motion/spatializedMotion.ts +147 -0
  309. package/src/types/motion/spatializedPlayback.ts +17 -0
  310. package/src/types/motion/spatializedVisual.ts +24 -0
  311. package/src/types/types.ts +12 -0
  312. package/src/utils.ts +54 -0
  313. package/tsup.config.ts +61 -36
  314. package/vitest.config.ts +5 -1
  315. package/dist/iife/index.d.ts +0 -1101
  316. package/dist/iife/index.global.js +0 -75
  317. package/dist/iife/index.global.js.map +0 -1
  318. package/src/platform-adapter/android/AndroidPlatform.ts +0 -133
  319. package/src/platform-adapter/ssr/SSRPlatform.ts +0 -43
  320. /package/src/{ssr-polyfill.ts → isSSREnv.ts} +0 -0
@@ -0,0 +1,173 @@
1
+ import { initScene } from "./scene-polyfill";
2
+ import { SpatialScene } from "./SpatialScene";
3
+ import {
4
+ createSpatialized2DElement,
5
+ createSpatializedDynamic3DElement
6
+ } from "./SpatializedElementCreator";
7
+ import { createSpatializedStatic3DElement } from "./SpatializedElementCreator";
8
+ import { createAttachmentEntity } from "./reality/Attachment";
9
+ import {
10
+ createModelAsset,
11
+ createModelComponent,
12
+ createSpatialEntity,
13
+ createSpatialGeometry,
14
+ createSpatialModelEntity,
15
+ createSpatialTexture,
16
+ createSpatialUnlitMaterial
17
+ } from "./reality/realityCreator";
18
+ import {
19
+ SpatialBoxGeometry,
20
+ SpatialPlaneGeometry,
21
+ SpatialSphereGeometry,
22
+ SpatialConeGeometry,
23
+ SpatialCylinderGeometry
24
+ } from "./reality";
25
+ class SpatialSession {
26
+ /**
27
+ * Gets the singleton instance of the spatial scene.
28
+ * The spatial scene is the root container for all spatial elements.
29
+ * @returns The SpatialScene singleton instance
30
+ */
31
+ getSpatialScene() {
32
+ return SpatialScene.getInstance();
33
+ }
34
+ /**
35
+ * Creates a new 2D element that can be spatialized in the 3D environment.
36
+ * 2D elements represent HTML content that can be positioned in 3D space.
37
+ * @returns Promise resolving to a new Spatialized2DElement instance
38
+ */
39
+ createSpatialized2DElement() {
40
+ return createSpatialized2DElement();
41
+ }
42
+ /**
43
+ * Creates a new static 3D element with an optional model URL.
44
+ * Static 3D elements represent pre-built 3D models that can be loaded from a URL.
45
+ * @param modelURL Optional URL to the 3D model to load
46
+ * @param sources Optional list of fallback model sources
47
+ * @param loading Whether the asset should fetch eagerly or be deferred (`'lazy'`)
48
+ * @returns Promise resolving to a new SpatializedStatic3DElement instance
49
+ */
50
+ createSpatializedStatic3DElement(modelURL, sources, loading = "eager") {
51
+ return createSpatializedStatic3DElement(modelURL, sources, loading);
52
+ }
53
+ /**
54
+ * Initializes the spatial scene with custom configuration.
55
+ * This is a reference to the initScene function from scene-polyfill.
56
+ */
57
+ initScene = initScene;
58
+ /**
59
+ * Creates a new dynamic 3D element that can be manipulated at runtime.
60
+ * Dynamic 3D elements allow for programmatic creation and modification of 3D content.
61
+ * @returns Promise resolving to a new SpatializedDynamic3DElement instance
62
+ */
63
+ createSpatializedDynamic3DElement() {
64
+ return createSpatializedDynamic3DElement();
65
+ }
66
+ /**
67
+ * Creates a new spatial entity with an optional name.
68
+ * Entities are the basic building blocks for creating custom 3D content.
69
+ * @param name Optional name for the entity
70
+ * @returns Promise resolving to a new SpatialEntity instance
71
+ */
72
+ createEntity(userData) {
73
+ return createSpatialEntity(userData);
74
+ }
75
+ /**
76
+ * Creates a box geometry with optional configuration.
77
+ * @param options Configuration options for the box geometry
78
+ * @returns Promise resolving to a new SpatialBoxGeometry instance
79
+ */
80
+ createBoxGeometry(options = {}) {
81
+ return createSpatialGeometry(SpatialBoxGeometry, options);
82
+ }
83
+ /**
84
+ * Creates a plane geometry with optional configuration.
85
+ * @param options Configuration options for the plane geometry
86
+ * @returns Promise resolving to a new SpatialPlaneGeometry instance
87
+ */
88
+ createPlaneGeometry(options = {}) {
89
+ return createSpatialGeometry(SpatialPlaneGeometry, options);
90
+ }
91
+ /**
92
+ * Creates a sphere geometry with optional configuration.
93
+ * @param options Configuration options for the sphere geometry
94
+ * @returns Promise resolving to a new SpatialSphereGeometry instance
95
+ */
96
+ createSphereGeometry(options = {}) {
97
+ return createSpatialGeometry(SpatialSphereGeometry, options);
98
+ }
99
+ /**
100
+ * Creates a cone geometry with the specified configuration.
101
+ * @param options Configuration options for the cone geometry
102
+ * @returns Promise resolving to a new SpatialConeGeometry instance
103
+ */
104
+ createConeGeometry(options) {
105
+ return createSpatialGeometry(SpatialConeGeometry, options);
106
+ }
107
+ /**
108
+ * Creates a cylinder geometry with the specified configuration.
109
+ * @param options Configuration options for the cylinder geometry
110
+ * @returns Promise resolving to a new SpatialCylinderGeometry instance
111
+ */
112
+ createCylinderGeometry(options) {
113
+ return createSpatialGeometry(SpatialCylinderGeometry, options);
114
+ }
115
+ /**
116
+ * Creates a model component with the specified configuration.
117
+ * Model components are used to add 3D model rendering capabilities to entities.
118
+ * @param options Configuration options for the model component
119
+ * @returns Promise resolving to a new ModelComponent instance
120
+ */
121
+ createModelComponent(options) {
122
+ return createModelComponent(options);
123
+ }
124
+ /**
125
+ * Creates an unlit material with the specified configuration.
126
+ * Unlit materials don't respond to lighting in the scene.
127
+ * @param options Configuration options for the unlit material
128
+ * @returns Promise resolving to a new SpatialUnlitMaterial instance
129
+ */
130
+ createUnlitMaterial(options) {
131
+ return createSpatialUnlitMaterial(options);
132
+ }
133
+ /**
134
+ * Creates a texture resource from the specified image URL.
135
+ * Texture resources can be referenced by materials and other spatial content.
136
+ * @param options Configuration options for the texture resource
137
+ * @returns Promise resolving to a new SpatialTextureResource instance
138
+ */
139
+ createTexture(options) {
140
+ return createSpatialTexture(options);
141
+ }
142
+ /**
143
+ * Creates a model asset with the specified configuration.
144
+ * Model assets represent 3D model resources that can be used by entities.
145
+ * @param options Configuration options for the model asset
146
+ * @returns Promise resolving to a new SpatialModelAsset instance
147
+ */
148
+ createModelAsset(options) {
149
+ return createModelAsset(options);
150
+ }
151
+ /**
152
+ * Creates a spatial model entity with the specified configuration.
153
+ * This is a convenience method for creating an entity with a model component.
154
+ * @param options Configuration options for the spatial model entity
155
+ * @returns Promise resolving to a new SpatialModelEntity instance
156
+ */
157
+ createSpatialModelEntity(options, userData) {
158
+ return createSpatialModelEntity(options, userData);
159
+ }
160
+ /**
161
+ * Creates an attachment entity that renders 2D HTML content as a child
162
+ * of a 3D entity in the scene graph.
163
+ * @param options Configuration options including parent entity ID, position, and size
164
+ * @returns Promise resolving to a new Attachment instance
165
+ */
166
+ createAttachmentEntity(options) {
167
+ return createAttachmentEntity(options);
168
+ }
169
+ }
170
+ export {
171
+ SpatialSession
172
+ };
173
+ //# sourceMappingURL=SpatialSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SpatialSession.ts"],"sourcesContent":["import { initScene } from './scene-polyfill'\nimport { SpatialScene } from './SpatialScene'\nimport { Spatialized2DElement } from './Spatialized2DElement'\nimport {\n createSpatialized2DElement,\n createSpatializedDynamic3DElement,\n} from './SpatializedElementCreator'\nimport { createSpatializedStatic3DElement } from './SpatializedElementCreator'\nimport { Attachment, createAttachmentEntity } from './reality/Attachment'\nimport { SpatializedStatic3DElement } from './SpatializedStatic3DElement'\nimport {\n ModelComponentOptions,\n ModelAssetOptions,\n SpatialBoxGeometryOptions,\n SpatialConeGeometryOptions,\n SpatialCylinderGeometryOptions,\n SpatialModelEntityCreationOptions,\n SpatialPlaneGeometryOptions,\n SpatialSphereGeometryOptions,\n SpatialUnlitMaterialOptions,\n SpatialTextureResourceOptions,\n SpatialEntityUserData,\n AttachmentEntityOptions,\n ModelLoadingMode,\n ModelSource,\n} from './types/types'\nimport { SpatializedDynamic3DElement } from './SpatializedDynamic3DElement'\nimport { SpatialEntity } from './reality/entity/SpatialEntity'\nimport {\n createModelAsset,\n createModelComponent,\n createSpatialEntity,\n createSpatialGeometry,\n createSpatialModelEntity,\n createSpatialTexture,\n createSpatialUnlitMaterial,\n} from './reality/realityCreator'\nimport {\n SpatialBoxGeometry,\n SpatialPlaneGeometry,\n SpatialSphereGeometry,\n SpatialConeGeometry,\n SpatialCylinderGeometry,\n} from './reality'\n\n/**\n * Session used to establish a connection to the spatial renderer of the system.\n * All spatial resources must be created through this session object.\n * This class serves as the main factory for creating spatial elements and geometries.\n */\nexport class SpatialSession {\n /**\n * Gets the singleton instance of the spatial scene.\n * The spatial scene is the root container for all spatial elements.\n * @returns The SpatialScene singleton instance\n */\n getSpatialScene(): SpatialScene {\n return SpatialScene.getInstance()\n }\n\n /**\n * Creates a new 2D element that can be spatialized in the 3D environment.\n * 2D elements represent HTML content that can be positioned in 3D space.\n * @returns Promise resolving to a new Spatialized2DElement instance\n */\n createSpatialized2DElement(): Promise<Spatialized2DElement> {\n return createSpatialized2DElement()\n }\n\n /**\n * Creates a new static 3D element with an optional model URL.\n * Static 3D elements represent pre-built 3D models that can be loaded from a URL.\n * @param modelURL Optional URL to the 3D model to load\n * @param sources Optional list of fallback model sources\n * @param loading Whether the asset should fetch eagerly or be deferred (`'lazy'`)\n * @returns Promise resolving to a new SpatializedStatic3DElement instance\n */\n createSpatializedStatic3DElement(\n modelURL?: string,\n sources?: ModelSource[],\n loading: ModelLoadingMode = 'eager',\n ): Promise<SpatializedStatic3DElement> {\n return createSpatializedStatic3DElement(modelURL, sources, loading)\n }\n\n /**\n * Initializes the spatial scene with custom configuration.\n * This is a reference to the initScene function from scene-polyfill.\n */\n initScene = initScene\n\n /**\n * Creates a new dynamic 3D element that can be manipulated at runtime.\n * Dynamic 3D elements allow for programmatic creation and modification of 3D content.\n * @returns Promise resolving to a new SpatializedDynamic3DElement instance\n */\n createSpatializedDynamic3DElement(): Promise<SpatializedDynamic3DElement> {\n return createSpatializedDynamic3DElement()\n }\n\n /**\n * Creates a new spatial entity with an optional name.\n * Entities are the basic building blocks for creating custom 3D content.\n * @param name Optional name for the entity\n * @returns Promise resolving to a new SpatialEntity instance\n */\n createEntity(userData?: SpatialEntityUserData): Promise<SpatialEntity> {\n return createSpatialEntity(userData)\n }\n\n /**\n * Creates a box geometry with optional configuration.\n * @param options Configuration options for the box geometry\n * @returns Promise resolving to a new SpatialBoxGeometry instance\n */\n createBoxGeometry(options: SpatialBoxGeometryOptions = {}) {\n return createSpatialGeometry(SpatialBoxGeometry, options)\n }\n\n /**\n * Creates a plane geometry with optional configuration.\n * @param options Configuration options for the plane geometry\n * @returns Promise resolving to a new SpatialPlaneGeometry instance\n */\n createPlaneGeometry(options: SpatialPlaneGeometryOptions = {}) {\n return createSpatialGeometry(SpatialPlaneGeometry, options)\n }\n\n /**\n * Creates a sphere geometry with optional configuration.\n * @param options Configuration options for the sphere geometry\n * @returns Promise resolving to a new SpatialSphereGeometry instance\n */\n createSphereGeometry(options: SpatialSphereGeometryOptions = {}) {\n return createSpatialGeometry(SpatialSphereGeometry, options)\n }\n\n /**\n * Creates a cone geometry with the specified configuration.\n * @param options Configuration options for the cone geometry\n * @returns Promise resolving to a new SpatialConeGeometry instance\n */\n createConeGeometry(options: SpatialConeGeometryOptions) {\n return createSpatialGeometry(SpatialConeGeometry, options)\n }\n\n /**\n * Creates a cylinder geometry with the specified configuration.\n * @param options Configuration options for the cylinder geometry\n * @returns Promise resolving to a new SpatialCylinderGeometry instance\n */\n createCylinderGeometry(options: SpatialCylinderGeometryOptions) {\n return createSpatialGeometry(SpatialCylinderGeometry, options)\n }\n\n /**\n * Creates a model component with the specified configuration.\n * Model components are used to add 3D model rendering capabilities to entities.\n * @param options Configuration options for the model component\n * @returns Promise resolving to a new ModelComponent instance\n */\n createModelComponent(options: ModelComponentOptions) {\n return createModelComponent(options)\n }\n\n /**\n * Creates an unlit material with the specified configuration.\n * Unlit materials don't respond to lighting in the scene.\n * @param options Configuration options for the unlit material\n * @returns Promise resolving to a new SpatialUnlitMaterial instance\n */\n createUnlitMaterial(options: SpatialUnlitMaterialOptions) {\n return createSpatialUnlitMaterial(options)\n }\n\n /**\n * Creates a texture resource from the specified image URL.\n * Texture resources can be referenced by materials and other spatial content.\n * @param options Configuration options for the texture resource\n * @returns Promise resolving to a new SpatialTextureResource instance\n */\n createTexture(options: SpatialTextureResourceOptions) {\n return createSpatialTexture(options)\n }\n\n /**\n * Creates a model asset with the specified configuration.\n * Model assets represent 3D model resources that can be used by entities.\n * @param options Configuration options for the model asset\n * @returns Promise resolving to a new SpatialModelAsset instance\n */\n createModelAsset(options: ModelAssetOptions) {\n return createModelAsset(options)\n }\n\n /**\n * Creates a spatial model entity with the specified configuration.\n * This is a convenience method for creating an entity with a model component.\n * @param options Configuration options for the spatial model entity\n * @returns Promise resolving to a new SpatialModelEntity instance\n */\n createSpatialModelEntity(\n options: SpatialModelEntityCreationOptions,\n userData?: SpatialEntityUserData,\n ) {\n return createSpatialModelEntity(options, userData)\n }\n\n /**\n * Creates an attachment entity that renders 2D HTML content as a child\n * of a 3D entity in the scene graph.\n * @param options Configuration options including parent entity ID, position, and size\n * @returns Promise resolving to a new Attachment instance\n */\n createAttachmentEntity(\n options: AttachmentEntityOptions,\n ): Promise<Attachment> {\n return createAttachmentEntity(options)\n }\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,wCAAwC;AACjD,SAAqB,8BAA8B;AAoBnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOA,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1B,kBAAgC;AAC9B,WAAO,aAAa,YAAY;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,6BAA4D;AAC1D,WAAO,2BAA2B;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,iCACE,UACA,SACA,UAA4B,SACS;AACrC,WAAO,iCAAiC,UAAU,SAAS,OAAO;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOZ,oCAA0E;AACxE,WAAO,kCAAkC;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAa,UAA0D;AACrE,WAAO,oBAAoB,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,kBAAkB,UAAqC,CAAC,GAAG;AACzD,WAAO,sBAAsB,oBAAoB,OAAO;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,oBAAoB,UAAuC,CAAC,GAAG;AAC7D,WAAO,sBAAsB,sBAAsB,OAAO;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,qBAAqB,UAAwC,CAAC,GAAG;AAC/D,WAAO,sBAAsB,uBAAuB,OAAO;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,mBAAmB,SAAqC;AACtD,WAAO,sBAAsB,qBAAqB,OAAO;AAAA,EAC3D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,uBAAuB,SAAyC;AAC9D,WAAO,sBAAsB,yBAAyB,OAAO;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,qBAAqB,SAAgC;AACnD,WAAO,qBAAqB,OAAO;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,oBAAoB,SAAsC;AACxD,WAAO,2BAA2B,OAAO;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cAAc,SAAwC;AACpD,WAAO,qBAAqB,OAAO;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAiB,SAA4B;AAC3C,WAAO,iBAAiB,OAAO;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,yBACE,SACA,UACA;AACA,WAAO,yBAAyB,SAAS,QAAQ;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,uBACE,SACqB;AACrB,WAAO,uBAAuB,OAAO;AAAA,EACvC;AACF;","names":[]}
@@ -0,0 +1,8 @@
1
+ declare class SpatialWebEvent {
2
+ static eventReceiver: Record<string, (data: any) => void>;
3
+ static init(): void;
4
+ static addEventReceiver(id: string, callback: (data: any) => void): void;
5
+ static removeEventReceiver(id: string): void;
6
+ }
7
+
8
+ export { SpatialWebEvent };
@@ -0,0 +1,18 @@
1
+ class SpatialWebEvent {
2
+ static eventReceiver = {};
3
+ static init() {
4
+ window.__SpatialWebEvent = ({ id, data }) => {
5
+ SpatialWebEvent.eventReceiver[id]?.(data);
6
+ };
7
+ }
8
+ static addEventReceiver(id, callback) {
9
+ SpatialWebEvent.eventReceiver[id] = callback;
10
+ }
11
+ static removeEventReceiver(id) {
12
+ delete SpatialWebEvent.eventReceiver[id];
13
+ }
14
+ }
15
+ export {
16
+ SpatialWebEvent
17
+ };
18
+ //# sourceMappingURL=SpatialWebEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SpatialWebEvent.ts"],"sourcesContent":["interface SpatialWebEventData {\n id: string\n data: any\n}\n\nexport class SpatialWebEvent {\n static eventReceiver: Record<string, (data: any) => void> = {}\n static init() {\n // inject __SpatialWebEvent\n window.__SpatialWebEvent = ({ id, data }: SpatialWebEventData) => {\n // console.log('__SpatialWebEvent', id, data)\n SpatialWebEvent.eventReceiver[id]?.(data)\n }\n }\n\n static addEventReceiver(id: string, callback: (data: any) => void) {\n SpatialWebEvent.eventReceiver[id] = callback\n }\n\n static removeEventReceiver(id: string) {\n delete SpatialWebEvent.eventReceiver[id]\n }\n}\n"],"mappings":"AAKO,MAAM,gBAAgB;AAAA,EAC3B,OAAO,gBAAqD,CAAC;AAAA,EAC7D,OAAO,OAAO;AAEZ,WAAO,oBAAoB,CAAC,EAAE,IAAI,KAAK,MAA2B;AAEhE,sBAAgB,cAAc,EAAE,IAAI,IAAI;AAAA,IAC1C;AAAA,EACF;AAAA,EAEA,OAAO,iBAAiB,IAAY,UAA+B;AACjE,oBAAgB,cAAc,EAAE,IAAI;AAAA,EACtC;AAAA,EAEA,OAAO,oBAAoB,IAAY;AACrC,WAAO,gBAAgB,cAAc,EAAE;AAAA,EACzC;AACF;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { aP as SpatialWebMsgType } from './spatializedElementMotion-_0XWPQCE.js';
2
+ import './types/motion/spatializedVisual.js';
3
+ import './types/motion/spatializedPlayback.js';
4
+ import './types/global.js';
5
+ import './physicalMetrics-W5uZ5xKb.js';
6
+ import './SpatialObject.js';
7
+ import './reality/component/SpatialComponent.js';
8
+
9
+ declare function createSpatialEvent<T>(type: SpatialWebMsgType, detail: T): CustomEvent<T>;
10
+
11
+ export { createSpatialEvent };
@@ -0,0 +1,11 @@
1
+ function createSpatialEvent(type, detail) {
2
+ return new CustomEvent(type, {
3
+ bubbles: true,
4
+ cancelable: false,
5
+ detail
6
+ });
7
+ }
8
+ export {
9
+ createSpatialEvent
10
+ };
11
+ //# sourceMappingURL=SpatialWebEventCreator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SpatialWebEventCreator.ts"],"sourcesContent":["import { SpatialWebMsgType } from './WebMsgCommand'\n\nexport function createSpatialEvent<T>(\n type: SpatialWebMsgType,\n detail: T,\n): CustomEvent<T> {\n return new CustomEvent<T>(type, {\n bubbles: true,\n cancelable: false,\n detail,\n })\n}\n"],"mappings":"AAEO,SAAS,mBACd,MACA,QACgB;AAChB,SAAO,IAAI,YAAe,MAAM;AAAA,IAC9B,SAAS;AAAA,IACT,YAAY;AAAA,IACZ;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,42 @@
1
+ import { ag as SpatializedElement, ae as Spatialized2DElementProperties, aK as CommandResult } from './spatializedElementMotion-_0XWPQCE.js';
2
+ import './types/motion/spatializedVisual.js';
3
+ import './types/motion/spatializedPlayback.js';
4
+ import './types/global.js';
5
+ import './physicalMetrics-W5uZ5xKb.js';
6
+ import './SpatialObject.js';
7
+ import './reality/component/SpatialComponent.js';
8
+
9
+ /**
10
+ * Represents a 2D HTML element that has been spatialized in 3D space.
11
+ * This class handles the integration between 2D web content and the 3D spatial environment,
12
+ * allowing HTML elements to be positioned and interacted with in spatial applications.
13
+ */
14
+ declare class Spatialized2DElement extends SpatializedElement {
15
+ readonly windowProxy: WindowProxy;
16
+ /**
17
+ * Identifies the motion target kind supported by this element.
18
+ */
19
+ readonly kind: "spatialized2d";
20
+ /**
21
+ * Creates a new spatialized 2D element.
22
+ * @param id Unique identifier for this element
23
+ * @param windowProxy Reference to the window object containing the 2D content
24
+ */
25
+ constructor(id: string, windowProxy: WindowProxy);
26
+ /**
27
+ * Updates the properties of this 2D element.
28
+ * This can include size, position, background, and other visual properties.
29
+ * @param properties Partial set of properties to update
30
+ * @returns Promise resolving when the update is complete
31
+ */
32
+ updateProperties(properties: Partial<Spatialized2DElementProperties>): Promise<CommandResult<any>>;
33
+ /**
34
+ * Adds a child spatialized element to this 2D element.
35
+ * This allows for creating hierarchical structures of spatial elements.
36
+ * @param element The child element to add
37
+ * @returns Promise resolving when the element is added
38
+ */
39
+ addSpatializedElement(element: SpatializedElement): Promise<CommandResult<any>>;
40
+ }
41
+
42
+ export { Spatialized2DElement };
@@ -0,0 +1,47 @@
1
+ import {
2
+ AddSpatializedElementToSpatialized2DElement,
3
+ UpdateSpatialized2DElementProperties
4
+ } from "./JSBCommand";
5
+ import { hijackWindowATag } from "./scene-polyfill";
6
+ import { SpatializedElement } from "./SpatializedElement";
7
+ class Spatialized2DElement extends SpatializedElement {
8
+ /**
9
+ * Creates a new spatialized 2D element.
10
+ * @param id Unique identifier for this element
11
+ * @param windowProxy Reference to the window object containing the 2D content
12
+ */
13
+ constructor(id, windowProxy) {
14
+ super(id);
15
+ this.windowProxy = windowProxy;
16
+ hijackWindowATag(windowProxy);
17
+ }
18
+ /**
19
+ * Identifies the motion target kind supported by this element.
20
+ */
21
+ kind = "spatialized2d";
22
+ /**
23
+ * Updates the properties of this 2D element.
24
+ * This can include size, position, background, and other visual properties.
25
+ * @param properties Partial set of properties to update
26
+ * @returns Promise resolving when the update is complete
27
+ */
28
+ async updateProperties(properties) {
29
+ return new UpdateSpatialized2DElementProperties(this, properties).execute();
30
+ }
31
+ /**
32
+ * Adds a child spatialized element to this 2D element.
33
+ * This allows for creating hierarchical structures of spatial elements.
34
+ * @param element The child element to add
35
+ * @returns Promise resolving when the element is added
36
+ */
37
+ async addSpatializedElement(element) {
38
+ return new AddSpatializedElementToSpatialized2DElement(
39
+ this,
40
+ element
41
+ ).execute();
42
+ }
43
+ }
44
+ export {
45
+ Spatialized2DElement
46
+ };
47
+ //# sourceMappingURL=Spatialized2DElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Spatialized2DElement.ts"],"sourcesContent":["import {\n AddSpatializedElementToSpatialized2DElement,\n UpdateSpatialized2DElementProperties,\n} from './JSBCommand'\nimport { hijackWindowATag } from './scene-polyfill'\nimport { SpatializedElement } from './SpatializedElement'\nimport { Spatialized2DElementProperties } from './types/types'\n\n/**\n * Represents a 2D HTML element that has been spatialized in 3D space.\n * This class handles the integration between 2D web content and the 3D spatial environment,\n * allowing HTML elements to be positioned and interacted with in spatial applications.\n */\nexport class Spatialized2DElement extends SpatializedElement {\n /**\n * Identifies the motion target kind supported by this element.\n */\n override readonly kind = 'spatialized2d' as const\n\n /**\n * Creates a new spatialized 2D element.\n * @param id Unique identifier for this element\n * @param windowProxy Reference to the window object containing the 2D content\n */\n constructor(\n id: string,\n readonly windowProxy: WindowProxy,\n ) {\n super(id)\n // Hijack anchor tag events to handle navigation within the spatial context\n hijackWindowATag(windowProxy)\n }\n\n /**\n * Updates the properties of this 2D element.\n * This can include size, position, background, and other visual properties.\n * @param properties Partial set of properties to update\n * @returns Promise resolving when the update is complete\n */\n async updateProperties(properties: Partial<Spatialized2DElementProperties>) {\n return new UpdateSpatialized2DElementProperties(this, properties).execute()\n }\n\n /**\n * Adds a child spatialized element to this 2D element.\n * This allows for creating hierarchical structures of spatial elements.\n * @param element The child element to add\n * @returns Promise resolving when the element is added\n */\n async addSpatializedElement(element: SpatializedElement) {\n return new AddSpatializedElementToSpatialized2DElement(\n this,\n element,\n ).execute()\n }\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAQ5B,MAAM,6BAA6B,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW3D,YACE,IACS,aACT;AACA,UAAM,EAAE;AAFC;AAIT,qBAAiB,WAAW;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA,EAdkB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBzB,MAAM,iBAAiB,YAAqD;AAC1E,WAAO,IAAI,qCAAqC,MAAM,UAAU,EAAE,QAAQ;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,sBAAsB,SAA6B;AACvD,WAAO,IAAI;AAAA,MACT;AAAA,MACA;AAAA,IACF,EAAE,QAAQ;AAAA,EACZ;AACF;","names":[]}
@@ -0,0 +1,7 @@
1
+ export { af as SpatializedDynamic3DElement } from './spatializedElementMotion-_0XWPQCE.js';
2
+ import './types/motion/spatializedVisual.js';
3
+ import './types/motion/spatializedPlayback.js';
4
+ import './types/global.js';
5
+ import './physicalMetrics-W5uZ5xKb.js';
6
+ import './SpatialObject.js';
7
+ import './reality/component/SpatialComponent.js';
@@ -0,0 +1,43 @@
1
+ import {
2
+ SetParentForEntityCommand,
3
+ UpdateSpatializedDynamic3DElementProperties
4
+ } from "./JSBCommand";
5
+ import { SpatializedElement } from "./SpatializedElement";
6
+ class SpatializedDynamic3DElement extends SpatializedElement {
7
+ /**
8
+ * Identifies the motion target kind supported by this element.
9
+ */
10
+ kind = "dynamic3d";
11
+ children = [];
12
+ events = {};
13
+ constructor(id) {
14
+ super(id);
15
+ }
16
+ async addEntity(entity) {
17
+ const ans = new SetParentForEntityCommand(entity.id, this.id).execute();
18
+ this.children.push(entity);
19
+ entity.parent = this;
20
+ return ans;
21
+ }
22
+ addEvent(type, callback) {
23
+ this.events[type] = callback;
24
+ }
25
+ removeEvent(eventName) {
26
+ if (this.events[eventName]) {
27
+ delete this.events[eventName];
28
+ }
29
+ }
30
+ dispatchEvent(evt) {
31
+ this.events[evt.type]?.(evt);
32
+ }
33
+ async updateProperties(properties) {
34
+ return new UpdateSpatializedDynamic3DElementProperties(
35
+ this,
36
+ properties
37
+ ).execute();
38
+ }
39
+ }
40
+ export {
41
+ SpatializedDynamic3DElement
42
+ };
43
+ //# sourceMappingURL=SpatializedDynamic3DElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SpatializedDynamic3DElement.ts"],"sourcesContent":["import {\n SetParentForEntityCommand,\n UpdateSpatializedDynamic3DElementProperties,\n} from './JSBCommand'\nimport { SpatialEntity } from './reality'\nimport { SpatializedElement } from './SpatializedElement'\nimport {\n SpatialEntityEventType,\n SpatialEntityOrReality,\n SpatializedElementProperties,\n} from './types/types'\n\nexport class SpatializedDynamic3DElement extends SpatializedElement {\n /**\n * Identifies the motion target kind supported by this element.\n */\n override readonly kind = 'dynamic3d' as const\n\n children: SpatialEntityOrReality[] = []\n events: Record<string, (data: any) => void> = {}\n\n constructor(id: string) {\n super(id)\n }\n\n async addEntity(entity: SpatialEntity) {\n const ans = new SetParentForEntityCommand(entity.id, this.id).execute()\n this.children.push(entity)\n entity.parent = this\n return ans\n }\n\n addEvent(type: SpatialEntityEventType, callback: (data: any) => void) {\n this.events[type] = callback\n }\n\n removeEvent(eventName: SpatialEntityEventType) {\n if (this.events[eventName]) {\n delete this.events[eventName]\n }\n }\n\n dispatchEvent(evt: CustomEvent) {\n this.events[evt.type]?.(evt)\n }\n\n async updateProperties(properties: Partial<SpatializedElementProperties>) {\n return new UpdateSpatializedDynamic3DElementProperties(\n this,\n properties,\n ).execute()\n }\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,0BAA0B;AAO5B,MAAM,oCAAoC,mBAAmB;AAAA;AAAA;AAAA;AAAA,EAIhD,OAAO;AAAA,EAEzB,WAAqC,CAAC;AAAA,EACtC,SAA8C,CAAC;AAAA,EAE/C,YAAY,IAAY;AACtB,UAAM,EAAE;AAAA,EACV;AAAA,EAEA,MAAM,UAAU,QAAuB;AACrC,UAAM,MAAM,IAAI,0BAA0B,OAAO,IAAI,KAAK,EAAE,EAAE,QAAQ;AACtE,SAAK,SAAS,KAAK,MAAM;AACzB,WAAO,SAAS;AAChB,WAAO;AAAA,EACT;AAAA,EAEA,SAAS,MAA8B,UAA+B;AACpE,SAAK,OAAO,IAAI,IAAI;AAAA,EACtB;AAAA,EAEA,YAAY,WAAmC;AAC7C,QAAI,KAAK,OAAO,SAAS,GAAG;AAC1B,aAAO,KAAK,OAAO,SAAS;AAAA,IAC9B;AAAA,EACF;AAAA,EAEA,cAAc,KAAkB;AAC9B,SAAK,OAAO,IAAI,IAAI,IAAI,GAAG;AAAA,EAC7B;AAAA,EAEA,MAAM,iBAAiB,YAAmD;AACxE,WAAO,IAAI;AAAA,MACT;AAAA,MACA;AAAA,IACF,EAAE,QAAQ;AAAA,EACZ;AACF;","names":[]}
@@ -0,0 +1,7 @@
1
+ export { aV as ReceiveEventData, ag as SpatializedElement } from './spatializedElementMotion-_0XWPQCE.js';
2
+ import './SpatialObject.js';
3
+ import './types/motion/spatializedVisual.js';
4
+ import './types/motion/spatializedPlayback.js';
5
+ import './types/global.js';
6
+ import './physicalMetrics-W5uZ5xKb.js';
7
+ import './reality/component/SpatialComponent.js';
@@ -0,0 +1,206 @@
1
+ import { UpdateSpatializedElementTransform } from "./JSBCommand";
2
+ import { AnimationObject } from "./motion/AnimationObject";
3
+ import { SpatialObject } from "./SpatialObject";
4
+ import { SpatialWebEvent } from "./SpatialWebEvent";
5
+ import { createSpatialEvent } from "./SpatialWebEventCreator";
6
+ import {
7
+ normalizeMotionConfig,
8
+ validateNormalizedMotionConfig
9
+ } from "./motion/compute";
10
+ import { motionConfigToNativeTimeline } from "./motion/native/serializeMotionTimeline";
11
+ import {
12
+ SpatialWebMsgType
13
+ } from "./WebMsgCommand";
14
+ class SpatializedElement extends SpatialObject {
15
+ /**
16
+ * Creates a new spatialized element with the specified ID.
17
+ * Registers the element to receive spatial events.
18
+ * @param id Unique identifier for this element
19
+ */
20
+ constructor(id) {
21
+ super(id);
22
+ this.id = id;
23
+ SpatialWebEvent.addEventReceiver(id, this.onReceiveEvent.bind(this));
24
+ }
25
+ /**
26
+ * Creates a native-first AnimationObject bound to this spatialized element.
27
+ */
28
+ async createAnimation(config) {
29
+ const normalized = normalizeMotionConfig(config);
30
+ validateNormalizedMotionConfig(normalized);
31
+ return AnimationObject.create({
32
+ elementId: this.id,
33
+ timeline: motionConfigToNativeTimeline(normalized)
34
+ });
35
+ }
36
+ /**
37
+ * Updates the transformation matrix of this element in 3D space.
38
+ * This affects the position, rotation, and scale of the element.
39
+ * @param matrix The new transformation matrix
40
+ * @returns Promise resolving when the transform is updated
41
+ */
42
+ async updateTransform(matrix) {
43
+ return new UpdateSpatializedElementTransform(this, matrix).execute();
44
+ }
45
+ /**
46
+ * Information about the element's bounding cube.
47
+ * Used for spatial calculations and hit testing.
48
+ */
49
+ _cubeInfo;
50
+ /**
51
+ * Gets the current cube information for this element.
52
+ * @returns The current CubeInfo or undefined if not set
53
+ */
54
+ get cubeInfo() {
55
+ return this._cubeInfo;
56
+ }
57
+ /**
58
+ * The current transformation matrix of this element.
59
+ */
60
+ _transform;
61
+ /**
62
+ * The inverse of the current transformation matrix.
63
+ * Used for converting world coordinates to local coordinates.
64
+ */
65
+ _transformInv;
66
+ /**
67
+ * Gets the current transformation matrix.
68
+ * @returns The current transformation matrix or undefined if not set
69
+ */
70
+ get transform() {
71
+ return this._transform;
72
+ }
73
+ /**
74
+ * Gets the inverse of the current transformation matrix.
75
+ * @returns The inverse transformation matrix or undefined if not set
76
+ */
77
+ get transformInv() {
78
+ return this._transformInv;
79
+ }
80
+ /**
81
+ * Processes events received from the WebSpatial environment.
82
+ * Handles various spatial events like transforms, gestures, and interactions.
83
+ * @param data The event data received from the WebSpatial system
84
+ */
85
+ onReceiveEvent(data) {
86
+ const { type } = data;
87
+ if (type === SpatialWebMsgType.objectdestroy) {
88
+ this.isDestroyed = true;
89
+ } else if (type === SpatialWebMsgType.spatialtap) {
90
+ const event = createSpatialEvent(
91
+ SpatialWebMsgType.spatialtap,
92
+ data.detail
93
+ );
94
+ this._onSpatialTap?.(event);
95
+ } else if (type === SpatialWebMsgType.spatialdragstart) {
96
+ const dragStartEvent = createSpatialEvent(
97
+ SpatialWebMsgType.spatialdragstart,
98
+ data.detail
99
+ );
100
+ this._onSpatialDragStart?.(dragStartEvent);
101
+ } else if (type === SpatialWebMsgType.spatialdrag) {
102
+ const event = createSpatialEvent(
103
+ SpatialWebMsgType.spatialdrag,
104
+ data.detail
105
+ );
106
+ this._onSpatialDrag?.(event);
107
+ } else if (type === SpatialWebMsgType.spatialdragend) {
108
+ const event = createSpatialEvent(
109
+ SpatialWebMsgType.spatialdragend,
110
+ data.detail
111
+ );
112
+ this._onSpatialDragEnd?.(event);
113
+ } else if (type === SpatialWebMsgType.spatialrotate) {
114
+ const event = createSpatialEvent(
115
+ SpatialWebMsgType.spatialrotate,
116
+ data.detail
117
+ );
118
+ this._onSpatialRotate?.(event);
119
+ } else if (type === SpatialWebMsgType.spatialrotateend) {
120
+ const event = createSpatialEvent(
121
+ SpatialWebMsgType.spatialrotateend,
122
+ data.detail
123
+ );
124
+ this._onSpatialRotateEnd?.(event);
125
+ } else if (type === SpatialWebMsgType.spatialmagnify) {
126
+ const event = createSpatialEvent(
127
+ SpatialWebMsgType.spatialmagnify,
128
+ data.detail
129
+ );
130
+ this._onSpatialMagnify?.(event);
131
+ } else if (type === SpatialWebMsgType.spatialmagnifyend) {
132
+ const event = createSpatialEvent(
133
+ SpatialWebMsgType.spatialmagnifyend,
134
+ data.detail
135
+ );
136
+ this._onSpatialMagnifyEnd?.(event);
137
+ }
138
+ }
139
+ _onSpatialTap;
140
+ set onSpatialTap(value) {
141
+ this._onSpatialTap = value;
142
+ this.updateProperties({
143
+ enableTapGesture: value !== void 0
144
+ });
145
+ }
146
+ _onSpatialDragStart;
147
+ set onSpatialDragStart(value) {
148
+ this._onSpatialDragStart = value;
149
+ this.updateProperties({
150
+ enableDragStartGesture: this._onSpatialDragStart !== void 0
151
+ });
152
+ }
153
+ _onSpatialDrag;
154
+ set onSpatialDrag(value) {
155
+ this._onSpatialDrag = value;
156
+ this.updateProperties({
157
+ enableDragGesture: this._onSpatialDrag !== void 0
158
+ });
159
+ }
160
+ _onSpatialDragEnd;
161
+ set onSpatialDragEnd(value) {
162
+ this._onSpatialDragEnd = value;
163
+ this.updateProperties({
164
+ enableDragEndGesture: value !== void 0
165
+ });
166
+ }
167
+ _onSpatialRotate;
168
+ set onSpatialRotate(value) {
169
+ this._onSpatialRotate = value;
170
+ this.updateProperties({
171
+ enableRotateGesture: this._onSpatialRotate !== void 0
172
+ });
173
+ }
174
+ _onSpatialRotateEnd;
175
+ set onSpatialRotateEnd(value) {
176
+ this._onSpatialRotateEnd = value;
177
+ this.updateProperties({
178
+ enableRotateEndGesture: value !== void 0
179
+ });
180
+ }
181
+ _onSpatialMagnify;
182
+ set onSpatialMagnify(value) {
183
+ this._onSpatialMagnify = value;
184
+ this.updateProperties({
185
+ enableMagnifyGesture: value !== void 0
186
+ });
187
+ }
188
+ _onSpatialMagnifyEnd;
189
+ set onSpatialMagnifyEnd(value) {
190
+ this._onSpatialMagnifyEnd = value;
191
+ this.updateProperties({
192
+ enableMagnifyEndGesture: value !== void 0
193
+ });
194
+ }
195
+ /**
196
+ * Cleans up resources when this element is destroyed.
197
+ * Removes event receivers to prevent memory leaks.
198
+ */
199
+ onDestroy() {
200
+ SpatialWebEvent.removeEventReceiver(this.id);
201
+ }
202
+ }
203
+ export {
204
+ SpatializedElement
205
+ };
206
+ //# sourceMappingURL=SpatializedElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SpatializedElement.ts"],"sourcesContent":["import { UpdateSpatializedElementTransform } from './JSBCommand'\nimport { AnimationObject } from './motion/AnimationObject'\nimport { WebSpatialProtocolResult } from './platform-adapter/interface'\nimport { SpatialObject } from './SpatialObject'\nimport { SpatialWebEvent } from './SpatialWebEvent'\nimport { createSpatialEvent } from './SpatialWebEventCreator'\nimport {\n normalizeMotionConfig,\n validateNormalizedMotionConfig,\n} from './motion/compute'\nimport { motionConfigToNativeTimeline } from './motion/native/serializeMotionTimeline'\nimport {\n CubeInfo,\n SpatialDragEndEvent,\n SpatialDragEvent,\n SpatialDragStartEvent,\n SpatializedElementProperties,\n SpatialMagnifyEndEvent,\n SpatialMagnifyEvent,\n SpatialRotateEndEvent,\n SpatialRotateEvent,\n SpatialTapEvent,\n} from './types/types'\nimport {\n ObjectDestroyMsg,\n SpatialDragEndMsg,\n SpatialDragMsg,\n SpatialDragStartMsg,\n SpatialMagnifyEndMsg,\n SpatialMagnifyMsg,\n SpatialRotateEndMsg,\n SpatialRotateMsg,\n SpatialTapMsg,\n SpatialWebMsgType,\n} from './WebMsgCommand'\nimport type {\n SpatializedMotionConfig,\n SpatializedMotionKind,\n} from './types/motion/spatializedMotion'\n\n/**\n * Abstract base class for all spatialized elements in the WebSpatial environment.\n * Provides common functionality for elements that can exist in 3D space,\n * including transformation handling and gesture event processing.\n */\nexport abstract class SpatializedElement extends SpatialObject {\n /**\n * Identifies the motion target kind supported by this spatialized element.\n */\n abstract readonly kind: SpatializedMotionKind\n\n /**\n * Creates a new spatialized element with the specified ID.\n * Registers the element to receive spatial events.\n * @param id Unique identifier for this element\n */\n constructor(public readonly id: string) {\n super(id)\n\n SpatialWebEvent.addEventReceiver(id, this.onReceiveEvent.bind(this))\n }\n\n /**\n * Updates the properties of this spatialized element.\n * Must be implemented by derived classes to handle specific property updates.\n * @param properties Partial set of properties to update\n * @returns Promise resolving to the result of the update operation\n */\n abstract updateProperties(\n properties: Partial<SpatializedElementProperties>,\n ): Promise<WebSpatialProtocolResult>\n\n /**\n * Creates a native-first AnimationObject bound to this spatialized element.\n */\n async createAnimation(\n config: SpatializedMotionConfig,\n ): Promise<AnimationObject> {\n const normalized = normalizeMotionConfig(config)\n validateNormalizedMotionConfig(normalized)\n return AnimationObject.create({\n elementId: this.id,\n timeline: motionConfigToNativeTimeline(normalized),\n })\n }\n\n /**\n * Updates the transformation matrix of this element in 3D space.\n * This affects the position, rotation, and scale of the element.\n * @param matrix The new transformation matrix\n * @returns Promise resolving when the transform is updated\n */\n async updateTransform(matrix: DOMMatrix) {\n return new UpdateSpatializedElementTransform(this, matrix).execute()\n }\n\n /**\n * Information about the element's bounding cube.\n * Used for spatial calculations and hit testing.\n */\n private _cubeInfo?: CubeInfo\n\n /**\n * Gets the current cube information for this element.\n * @returns The current CubeInfo or undefined if not set\n */\n get cubeInfo() {\n return this._cubeInfo\n }\n\n /**\n * The current transformation matrix of this element.\n */\n private _transform?: DOMMatrix\n\n /**\n * The inverse of the current transformation matrix.\n * Used for converting world coordinates to local coordinates.\n */\n private _transformInv?: DOMMatrix\n\n /**\n * Gets the current transformation matrix.\n * @returns The current transformation matrix or undefined if not set\n */\n get transform() {\n return this._transform\n }\n\n /**\n * Gets the inverse of the current transformation matrix.\n * @returns The inverse transformation matrix or undefined if not set\n */\n get transformInv() {\n return this._transformInv\n }\n\n /**\n * Processes events received from the WebSpatial environment.\n * Handles various spatial events like transforms, gestures, and interactions.\n * @param data The event data received from the WebSpatial system\n */\n protected onReceiveEvent(data: ReceiveEventData) {\n const { type } = data\n if (type === SpatialWebMsgType.objectdestroy) {\n this.isDestroyed = true\n } else if (type === SpatialWebMsgType.spatialtap) {\n // Handle tap gestures\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialtap,\n (data as SpatialTapMsg).detail,\n )\n this._onSpatialTap?.(event)\n } else if (type === SpatialWebMsgType.spatialdragstart) {\n const dragStartEvent = createSpatialEvent(\n SpatialWebMsgType.spatialdragstart,\n (data as SpatialDragStartMsg).detail,\n )\n this._onSpatialDragStart?.(dragStartEvent)\n } else if (type === SpatialWebMsgType.spatialdrag) {\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialdrag,\n (data as SpatialDragMsg).detail,\n )\n this._onSpatialDrag?.(event)\n } else if (type === SpatialWebMsgType.spatialdragend) {\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialdragend,\n (data as SpatialDragEndMsg).detail,\n )\n this._onSpatialDragEnd?.(event)\n } else if (type === SpatialWebMsgType.spatialrotate) {\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialrotate,\n (data as SpatialRotateMsg).detail,\n )\n this._onSpatialRotate?.(event)\n } else if (type === SpatialWebMsgType.spatialrotateend) {\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialrotateend,\n (data as SpatialRotateEndMsg).detail,\n )\n this._onSpatialRotateEnd?.(event)\n } else if (type === SpatialWebMsgType.spatialmagnify) {\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialmagnify,\n (data as SpatialMagnifyMsg).detail,\n )\n this._onSpatialMagnify?.(event)\n } else if (type === SpatialWebMsgType.spatialmagnifyend) {\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialmagnifyend,\n (data as SpatialMagnifyEndMsg).detail,\n )\n this._onSpatialMagnifyEnd?.(event)\n }\n }\n\n private _onSpatialTap?: (event: SpatialTapEvent) => void\n set onSpatialTap(value: (event: SpatialTapEvent) => void | undefined) {\n this._onSpatialTap = value\n this.updateProperties({\n enableTapGesture: value !== undefined,\n })\n }\n\n private _onSpatialDragStart?: (event: SpatialDragStartEvent) => void\n set onSpatialDragStart(\n value: (event: SpatialDragStartEvent) => void | undefined,\n ) {\n this._onSpatialDragStart = value\n this.updateProperties({\n enableDragStartGesture: this._onSpatialDragStart !== undefined,\n })\n }\n\n private _onSpatialDrag?: (event: SpatialDragEvent) => void\n set onSpatialDrag(value: (event: SpatialDragEvent) => void | undefined) {\n this._onSpatialDrag = value\n this.updateProperties({\n enableDragGesture: this._onSpatialDrag !== undefined,\n })\n }\n\n private _onSpatialDragEnd?: (event: SpatialDragEndEvent) => void\n set onSpatialDragEnd(\n value: ((event: SpatialDragEndEvent) => void) | undefined,\n ) {\n this._onSpatialDragEnd = value\n this.updateProperties({\n enableDragEndGesture: value !== undefined,\n })\n }\n\n private _onSpatialRotate?: (event: SpatialRotateEvent) => void\n set onSpatialRotate(\n value: ((event: SpatialRotateEvent) => void) | undefined,\n ) {\n this._onSpatialRotate = value\n this.updateProperties({\n enableRotateGesture: this._onSpatialRotate !== undefined,\n })\n }\n\n private _onSpatialRotateEnd?: (event: SpatialRotateEndEvent) => void\n set onSpatialRotateEnd(\n value: ((event: SpatialRotateEndEvent) => void) | undefined,\n ) {\n this._onSpatialRotateEnd = value\n this.updateProperties({\n enableRotateEndGesture: value !== undefined,\n })\n }\n\n private _onSpatialMagnify?: (event: SpatialMagnifyEvent) => void\n set onSpatialMagnify(\n value: ((event: SpatialMagnifyEvent) => void) | undefined,\n ) {\n this._onSpatialMagnify = value\n this.updateProperties({\n enableMagnifyGesture: value !== undefined,\n })\n }\n\n private _onSpatialMagnifyEnd?: (event: SpatialMagnifyEndEvent) => void\n set onSpatialMagnifyEnd(\n value: ((event: SpatialMagnifyEndEvent) => void) | undefined,\n ) {\n this._onSpatialMagnifyEnd = value\n this.updateProperties({\n enableMagnifyEndGesture: value !== undefined,\n })\n }\n\n /**\n * Cleans up resources when this element is destroyed.\n * Removes event receivers to prevent memory leaks.\n */\n override onDestroy() {\n SpatialWebEvent.removeEventReceiver(this.id)\n }\n}\n\nexport type ReceiveEventData =\n | SpatialTapMsg\n | SpatialDragStartMsg\n | SpatialDragMsg\n | SpatialDragEndMsg\n | SpatialRotateMsg\n | SpatialRotateEndMsg\n | ObjectDestroyMsg\n"],"mappings":"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","names":[]}