@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # @webspatial/core-sdk
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 8bb148b: BREAKING: restructure the Core SDK runtime and platform packaging around explicit ESM subpaths.
8
+
9
+ - Add `@webspatial/core-sdk/runtime` for runtime detection (`supports`, `getRuntime`) and `@webspatial/core-sdk/runtime/keys` for capability registry constants. `CapabilityKey` and `supports()` remain available, but registry constants are no longer exported from the main runtime entry.
10
+ - Move WebSpatial polyfill installation to `@webspatial/core-sdk/install-polyfills`. Consumers that previously relied on top-level `@webspatial/core-sdk` import side effects must import this subpath explicitly when they need polyfills. The React SDK loads it from the spatial chunk after `bootSpatial()`.
11
+ - Remove the legacy IIFE bundle (`dist/iife/index.global.js`) and its build target. ESM imports are the supported distribution path.
12
+ - Make `createPlatformSync()` / `createPlatform()` throw during SSR instead of returning an internal no-op `SSRPlatform`.
13
+ - Emit the Core SDK as unbundled ESM so downstream bundlers can tree-shake runtime detection and spatial implementation code independently.
14
+
15
+ ### Minor Changes
16
+
17
+ - 7c91edd: Add entity transform animation API (`useAnimation` hook, `animation` prop, and native visionOS playback).
18
+
19
+ **Core SDK**
20
+
21
+ - New `AnimationConfig`, `AnimatedProps`, `AnimationApi`, `AnimationError`, and related types.
22
+ - `SpatialEntity.animateTransform()` sends a unified `AnimateTransform` JSB command with play/pause/resume/stop actions.
23
+ - `composeSRT` and `decomposeTransformMatrix` utilities exported for matrix round-trip.
24
+ - `supports('useAnimation')` capability key added (currently disabled; will be enabled when native shell ships support).
25
+
26
+ **React SDK**
27
+
28
+ - `useAnimation(config)` hook returns `[AnimatedProps, AnimationApi]` with declarative config validation, `autoStart`, `delay`, `loop` (including reverse), `timingFunction`, and lifecycle callbacks (`onStart`, `onComplete`, `onCancel`, `onError`).
29
+ - Entity components (`BoxEntity`, `SphereEntity`, etc.) accept an `animation` prop that binds animated transforms and suppresses competing ordinary transform updates for animated fields.
30
+ - Transform suppression logic ensures non-animated fields still update normally during an active animation session.
31
+
32
+ **visionOS native**
33
+
34
+ - `EntityAnimationManager` handles play/pause/resume/stop commands, builds `FromToByAnimation<Transform>` for RealityKit playback, and manages per-animation session state (idle/queued/delaying/running/paused).
35
+ - Delay timer preserves remaining time across pause/resume cycles.
36
+ - Completion, stop, and failure events are emitted back to JS via the SpatialWebEvent bridge.
37
+ - Animation sessions are cleaned up on page navigation and scene destruction.
38
+
39
+ - f3a4975: Add `stagemode` prop to `<Model>` for built-in orbit interaction
40
+ - 1a8f46b: Add spatialized element motion support through the React `useAnimation` API.
41
+
42
+ ### Patch Changes
43
+
44
+ - b96e139: Send placement-shaped attachment payloads when the runtime advertises AttachmentEntity placement support.
45
+ - f34e327: Fix html background material updates written through bracket syntax so CSS custom
46
+ properties are stored in CSSOM before later html style mutations recompute scene
47
+ material.
48
+ - 9c1a3ec: Fix spatial child window creation so platform handoff resolves only after the child document reaches `complete`. This avoids rare caller-side DOM write failures such as `TypeError: Cannot set properties of null (setting 'innerHTML')` when the returned window proxy still has a loading document.
49
+ - 88fa5cb: Add snake_case/camelCase alias support for `manifest.json` `xr_spatial_scene` config.
50
+
51
+ - Same-object alias resolution prefers snake_case when both are present
52
+ - Override priority remains unchanged (overrides > top-level)
53
+ - Support snake_case keys for `resizability` and `overrides` scene selectors
54
+
55
+ - 05f6738: Remove the undocumented, non-public `window.xrCurrentSceneDefaults` and `window.xrCurrentSceneType` scene globals.
56
+
57
+ - Drop the global type declarations that these internal APIs added to `Window`.
58
+ - Remove the Core SDK scene-polyfill path that read these globals. `window.open` still resolves scene defaults from the manifest / native fallback layers, and `initScene()` remains the supported way to customize scene configuration.
59
+ - Remove the visionOS native `checkHookExist` path so a pending scene moves to `.willVisible` directly instead of waiting on the deleted globals.
60
+
61
+ - 9cf2a58: chore: update capability table for Model
62
+ - 5361e45: Add refresh-safe SpatialDiv and attachment request metadata, and guard VisionOS scene refreshes from stale spatial creation requests.
63
+
64
+ ## 1.7.0
65
+
66
+ ### Minor Changes
67
+
68
+ - fdc1e85: The Core SDK lets you query WebSpatial runtime capabilities and shell versions at runtime (`supports`, `getRuntime`) and resolve JSB-style embedded shells via `resolveJsbAdapterPlatform`. The built-in Android platform adapter is removed from core—integrate Android through your host shell instead.
69
+
70
+ The React SDK adds runtime gating (`noRuntime`, `webSpatialRuntime`) and updates spatialized components and related hooks so behavior matches runtime availability.
71
+
72
+ - 9801a07: Add lazy loading support to Model
73
+ - 550b3fe: Add currentTime property to Model to read and seek animation time
74
+ - 23b353e: Export `CapabilityKey` from core runtime and re-export it from the React SDK so app code can type capability checks via `@webspatial/react-sdk` without importing `@webspatial/core-sdk` directly.
75
+ - 9be9a9f: add poster attribute to <Model>
76
+ - 68c3fdd: Add loadable texture resources for Dynamic 3D: core `SpatialTextureResource`, `CreateTexture` / `UpdateTextureProperties`, and `textureId` on unlit materials; React `<Texture>` plus `UnlitMaterial` wiring that resolves logical ids to platform ids; VisionOS async `TextureResource` loading and scene handlers. Test-server includes a textured unlit box demo; Dynamic 3D PRD documents textures and trims out-of-scope sections.
77
+
78
+ ### Patch Changes
79
+
80
+ - 8e5209e: Remove unused local variables and imports flagged by CodeQL quality checks.
81
+ - fa404a9: Avoid exporting `global.d.ts` as a runtime module from `@webspatial/core-sdk`, so stricter bundlers and local `file:`/workspace consumers can resolve the built package correctly.
82
+ - 30357a3: fix: setting currentTime to greater than Model animation duration
83
+ - e95d4bd: Fix Model ready promise not working
84
+ - 0932bf3: Split **picoOS** capability rows from visionOS in `CAPABILITY_TABLE`: `supports('xrInnerDepth')` and `supports('xrOuterDepth')` are **false** for PicoWebApp **0.1.1** and **0.1.2**; visionOS shell rows are unchanged.
85
+ - 04c42b5: Refactor spatial host integration by introducing explicit platform capability APIs and a shared `spatial-host` facade. This simplifies scene/div/attachment call paths, removes redundant command wrappers, and improves platform adapter robustness for VisionOS and Pico OS error handling.
86
+
3
87
  ## 1.6.1
4
88
 
5
89
  ### Patch Changes
package/README.md CHANGED
@@ -136,6 +136,16 @@ The SDK supports various spatial events:
136
136
  - Rotate events (start, rotate, end)
137
137
  - Magnify events (start, magnify, end)
138
138
 
139
+ ## SSR and server bundles
140
+
141
+ `@webspatial/core-sdk` targets **client** WebSpatial shells. Do not run spatial side effects (session creation, JSB commands, `openSpatialSceneSync`) during SSR or in Node without `window`.
142
+
143
+ `createPlatformSync()` throws when `typeof window === 'undefined'` so misconfigured server imports fail fast instead of returning fake `{ success: true }` bridge results.
144
+
145
+ For SSR pages, use [`@webspatial/react-sdk`](https://github.com/webspatial/webspatial-sdk/tree/main/packages/react) default-entry facades and `bootSpatial()` on the client. See [Migrating to lazy-load `@webspatial/react-sdk`](../../docs/migration/lazy-load-spatial-runtime.md).
146
+
147
+ Polyfills are opt-in via `import '@webspatial/core-sdk/install-polyfills'` (typically from the React SDK spatial chunk); that module skips installation when `window` is unavailable.
148
+
139
149
  ## Advanced Usage
140
150
 
141
151
  For more advanced usage and detailed API documentation, please refer to the [official documentation](https://github.com/webspatial/webspatial-sdk).
@@ -0,0 +1,398 @@
1
+ import { aK as CommandResult, H as SpatialEntity, af as SpatializedDynamic3DElement, ag as SpatializedElement, A as AnimateTransformCommand, aL as ControlSpatializedElementAnimationCommand, aM as SpatializedElementAnimationControlType, at as Vec3, M as ModelAssetOptions, m as ModelComponentOptions, R as SpatialGeometryType, O as SpatialGeometryOptions, _ as SpatialModelEntityCreationOptions, ad as SpatialUnlitMaterialOptions, aN as CreateSpatializedElementAnimationCommand, aO as SpatializedMotionTimeline, o as ModelSource, n as ModelLoadingMode, h as AttachmentEntityOptions, X as SpatialMaterial, i as AttachmentEntityUpdateOptions, I as SpatialEntityEventType, K as SpatialEntityProperties, a4 as SpatialSceneCreationOptions, a5 as SpatialSceneProperties, ae as Spatialized2DElementProperties, ah as SpatializedElementProperties, C as CornerRadius, B as BackgroundMaterialType, ap as SpatializedStatic3DElementProperties, ac as SpatialTextureResourceOptions } from './spatializedElementMotion-_0XWPQCE.js';
2
+ import { SpatialComponent } from './reality/component/SpatialComponent.js';
3
+ import { SpatialObject } from './SpatialObject.js';
4
+ import './types/motion/spatializedVisual.js';
5
+ import './types/motion/spatializedPlayback.js';
6
+ import './types/global.js';
7
+ import './physicalMetrics-W5uZ5xKb.js';
8
+
9
+ declare abstract class JSBCommand {
10
+ commandType: string;
11
+ protected abstract getParams(): Record<string, any> | undefined;
12
+ execute(): Promise<CommandResult<any>>;
13
+ }
14
+ declare class UpdateEntityPropertiesCommand extends JSBCommand {
15
+ entity: SpatialEntity;
16
+ properties: Partial<SpatialEntityProperties>;
17
+ commandType: string;
18
+ constructor(entity: SpatialEntity, properties: Partial<SpatialEntityProperties>);
19
+ protected getParams(): {
20
+ entityId: string;
21
+ transform: Float64Array<ArrayBufferLike>;
22
+ };
23
+ }
24
+ declare class UpdateEntityEventCommand extends JSBCommand {
25
+ entity: SpatialEntity;
26
+ type: SpatialEntityEventType;
27
+ isEnable: boolean;
28
+ commandType: string;
29
+ constructor(entity: SpatialEntity, type: SpatialEntityEventType, isEnable: boolean);
30
+ protected getParams(): {
31
+ type: SpatialEntityEventType;
32
+ entityId: string;
33
+ isEnable: boolean;
34
+ };
35
+ }
36
+ declare class UpdateEntityEventsCommand extends JSBCommand {
37
+ entity: SpatialEntity;
38
+ types: Record<SpatialEntityEventType, boolean>;
39
+ constructor(entity: SpatialEntity, types: Record<SpatialEntityEventType, boolean>);
40
+ protected getParams(): {
41
+ entityId: string;
42
+ types: Record<SpatialEntityEventType, boolean>;
43
+ };
44
+ }
45
+ declare class UpdateSpatialSceneProperties extends JSBCommand {
46
+ properties: Partial<SpatialSceneProperties>;
47
+ commandType: string;
48
+ constructor(properties: Partial<SpatialSceneProperties>);
49
+ protected getParams(): Partial<SpatialSceneProperties>;
50
+ }
51
+ declare class UpdateSceneConfig extends JSBCommand {
52
+ config: SpatialSceneCreationOptions;
53
+ commandType: string;
54
+ constructor(config: SpatialSceneCreationOptions);
55
+ protected getParams(): Record<string, any> | undefined;
56
+ }
57
+ declare class FocusScene extends JSBCommand {
58
+ id: string;
59
+ commandType: string;
60
+ constructor(id: string);
61
+ protected getParams(): Record<string, any> | undefined;
62
+ }
63
+ declare class GetSpatialSceneState extends JSBCommand {
64
+ commandType: string;
65
+ constructor();
66
+ protected getParams(): Record<string, any> | undefined;
67
+ }
68
+ declare abstract class SpatializedElementCommand extends JSBCommand {
69
+ readonly spatialObject: SpatialObject;
70
+ constructor(spatialObject: SpatialObject);
71
+ protected getParams(): {
72
+ id: string;
73
+ };
74
+ protected abstract getExtraParams(): Record<string, any> | undefined;
75
+ }
76
+ declare class UpdateSpatialized2DElementProperties extends SpatializedElementCommand {
77
+ properties: Partial<Spatialized2DElementProperties>;
78
+ commandType: string;
79
+ constructor(spatialObject: SpatialObject, properties: Partial<SpatializedElementProperties>);
80
+ protected getExtraParams(): Partial<Spatialized2DElementProperties>;
81
+ }
82
+ declare class UpdateSpatializedDynamic3DElementProperties extends SpatializedElementCommand {
83
+ properties: Partial<Spatialized2DElementProperties>;
84
+ commandType: string;
85
+ constructor(spatialObject: SpatialObject, properties: Partial<SpatializedElementProperties>);
86
+ protected getExtraParams(): {
87
+ scrollPageEnabled?: boolean | undefined;
88
+ cornerRadius?: CornerRadius | undefined;
89
+ material?: BackgroundMaterialType | undefined;
90
+ scrollEdgeInsetsMarginRight?: number | undefined;
91
+ name?: string | undefined;
92
+ clientX?: number | undefined;
93
+ clientY?: number | undefined;
94
+ width?: number | undefined;
95
+ height?: number | undefined;
96
+ depth?: number | undefined;
97
+ opacity?: number | undefined;
98
+ visible?: boolean | undefined;
99
+ scrollWithParent?: boolean | undefined;
100
+ zIndex?: number | undefined;
101
+ backOffset?: number | undefined;
102
+ rotationAnchor?: Vec3 | undefined;
103
+ enableTapGesture?: boolean | undefined;
104
+ enableDragStartGesture?: boolean | undefined;
105
+ enableDragGesture?: boolean | undefined;
106
+ enableDragEndGesture?: boolean | undefined;
107
+ enableRotateGesture?: boolean | undefined;
108
+ enableRotateEndGesture?: boolean | undefined;
109
+ enableMagnifyGesture?: boolean | undefined;
110
+ enableMagnifyEndGesture?: boolean | undefined;
111
+ rotateConstrainedToAxis?: Vec3 | undefined;
112
+ id: string;
113
+ };
114
+ }
115
+ declare class UpdateUnlitMaterialProperties extends SpatializedElementCommand {
116
+ properties: Partial<SpatialUnlitMaterialOptions>;
117
+ commandType: string;
118
+ constructor(spatialObject: SpatialObject, properties: Partial<SpatialUnlitMaterialOptions>);
119
+ protected getExtraParams(): Partial<SpatialUnlitMaterialOptions>;
120
+ }
121
+ declare class UpdateSpatializedElementTransform extends SpatializedElementCommand {
122
+ matrix: DOMMatrix;
123
+ commandType: string;
124
+ constructor(spatialObject: SpatialObject, matrix: DOMMatrix);
125
+ protected getExtraParams(): {
126
+ matrix: number[];
127
+ };
128
+ }
129
+ declare class UpdateSpatializedStatic3DElementProperties extends SpatializedElementCommand {
130
+ properties: Partial<SpatializedStatic3DElementProperties>;
131
+ commandType: string;
132
+ constructor(spatialObject: SpatialObject, properties: Partial<SpatializedStatic3DElementProperties>);
133
+ protected getExtraParams(): Partial<SpatializedStatic3DElementProperties>;
134
+ }
135
+ declare class AddSpatializedElementToSpatialized2DElement extends SpatializedElementCommand {
136
+ commandType: string;
137
+ spatializedElement: SpatializedElement;
138
+ constructor(spatialObject: SpatialObject, spatializedElement: SpatializedElement);
139
+ protected getExtraParams(): {
140
+ spatializedElementId: string;
141
+ };
142
+ }
143
+ declare class AddSpatializedElementToSpatialScene extends JSBCommand {
144
+ commandType: string;
145
+ spatializedElement: SpatializedElement;
146
+ constructor(spatializedElement: SpatializedElement);
147
+ protected getParams(): {
148
+ spatializedElementId: string;
149
+ };
150
+ }
151
+ declare class CreateSpatializedStatic3DElementCommand extends JSBCommand {
152
+ readonly modelURL?: string | undefined;
153
+ readonly sources?: ModelSource[] | undefined;
154
+ readonly loading: ModelLoadingMode;
155
+ commandType: string;
156
+ constructor(modelURL?: string | undefined, sources?: ModelSource[] | undefined, loading?: ModelLoadingMode);
157
+ protected getParams(): {
158
+ modelURL: string | undefined;
159
+ sources: ModelSource[] | undefined;
160
+ loading: ModelLoadingMode;
161
+ };
162
+ }
163
+ declare class CreateSpatializedDynamic3DElementCommand extends JSBCommand {
164
+ protected getParams(): Record<string, any> | undefined;
165
+ commandType: string;
166
+ }
167
+ declare class CreateSpatialEntityCommand extends JSBCommand {
168
+ private name?;
169
+ constructor(name?: string | undefined);
170
+ protected getParams(): Record<string, any> | undefined;
171
+ commandType: string;
172
+ }
173
+ declare class CreateModelComponentCommand extends JSBCommand {
174
+ private options;
175
+ constructor(options: ModelComponentOptions);
176
+ protected getParams(): Record<string, any> | undefined;
177
+ commandType: string;
178
+ }
179
+ declare class CreateSpatialModelEntityCommand extends JSBCommand {
180
+ private options;
181
+ constructor(options: SpatialModelEntityCreationOptions);
182
+ protected getParams(): Record<string, any> | undefined;
183
+ commandType: string;
184
+ }
185
+ declare class CreateModelAssetCommand extends JSBCommand {
186
+ private options;
187
+ constructor(options: ModelAssetOptions);
188
+ protected getParams(): Record<string, any> | undefined;
189
+ commandType: string;
190
+ }
191
+ declare class CreateSpatialGeometryCommand extends JSBCommand {
192
+ private type;
193
+ private options;
194
+ constructor(type: SpatialGeometryType, options?: SpatialGeometryOptions);
195
+ protected getParams(): Record<string, any> | undefined;
196
+ commandType: string;
197
+ }
198
+ declare class CreateSpatialUnlitMaterialCommand extends JSBCommand {
199
+ private options;
200
+ constructor(options: SpatialUnlitMaterialOptions);
201
+ protected getParams(): Record<string, any> | undefined;
202
+ commandType: string;
203
+ }
204
+ declare class AddComponentToEntityCommand extends JSBCommand {
205
+ entity: SpatialEntity;
206
+ comp: SpatialComponent;
207
+ constructor(entity: SpatialEntity, comp: SpatialComponent);
208
+ protected getParams(): Record<string, any> | undefined;
209
+ commandType: string;
210
+ }
211
+ declare class RemoveComponentFromEntityCommand extends JSBCommand {
212
+ entity: SpatialEntity;
213
+ comp: SpatialComponent;
214
+ constructor(entity: SpatialEntity, comp: SpatialComponent);
215
+ protected getParams(): Record<string, any> | undefined;
216
+ commandType: string;
217
+ }
218
+ declare class SetMaterialsOnEntityCommand extends JSBCommand {
219
+ entityId: string;
220
+ materials: SpatialMaterial[];
221
+ constructor(entityId: string, materials: SpatialMaterial[]);
222
+ protected getParams(): Record<string, any> | undefined;
223
+ commandType: string;
224
+ }
225
+ declare class AddEntityToDynamic3DCommand extends JSBCommand {
226
+ d3dEle: SpatializedDynamic3DElement;
227
+ entity: SpatialEntity;
228
+ constructor(d3dEle: SpatializedDynamic3DElement, entity: SpatialEntity);
229
+ protected getParams(): Record<string, any> | undefined;
230
+ commandType: string;
231
+ }
232
+ declare class AddEntityToEntityCommand extends JSBCommand {
233
+ parent: SpatialEntity;
234
+ child: SpatialEntity;
235
+ constructor(parent: SpatialEntity, child: SpatialEntity);
236
+ protected getParams(): Record<string, any> | undefined;
237
+ commandType: string;
238
+ }
239
+ declare class RemoveEntityFromParentCommand extends JSBCommand {
240
+ entity: SpatialEntity;
241
+ constructor(entity: SpatialEntity);
242
+ protected getParams(): Record<string, any> | undefined;
243
+ commandType: string;
244
+ }
245
+ declare class SetParentForEntityCommand extends JSBCommand {
246
+ childId: string;
247
+ parentId?: string | undefined;
248
+ constructor(childId: string, parentId?: string | undefined);
249
+ protected getParams(): Record<string, any> | undefined;
250
+ commandType: string;
251
+ }
252
+ declare class ConvertFromEntityToEntityCommand extends JSBCommand {
253
+ fromEntityId: string;
254
+ toEntityId: string;
255
+ fromPosition: Vec3;
256
+ constructor(fromEntityId: string, toEntityId: string, fromPosition: Vec3);
257
+ protected getParams(): Record<string, any> | undefined;
258
+ commandType: string;
259
+ }
260
+ declare class ConvertFromEntityToSceneCommand extends JSBCommand {
261
+ fromEntityId: string;
262
+ position: Vec3;
263
+ constructor(fromEntityId: string, position: Vec3);
264
+ protected getParams(): Record<string, any> | undefined;
265
+ commandType: string;
266
+ }
267
+ declare class ConvertFromSceneToEntityCommand extends JSBCommand {
268
+ entityId: string;
269
+ position: Vec3;
270
+ constructor(entityId: string, position: Vec3);
271
+ protected getParams(): Record<string, any> | undefined;
272
+ commandType: string;
273
+ }
274
+ declare class ConvertCoordinateCommand extends JSBCommand {
275
+ position: Vec3;
276
+ fromId: string;
277
+ toId: string;
278
+ constructor(position: Vec3, fromId: string, toId: string);
279
+ protected getParams(): Record<string, any> | undefined;
280
+ commandType: string;
281
+ }
282
+ declare class CreateTextureCommand extends JSBCommand {
283
+ private url;
284
+ constructor(url: string);
285
+ protected getParams(): Record<string, any> | undefined;
286
+ commandType: string;
287
+ }
288
+ declare class UpdateTexturePropertiesCommand extends SpatializedElementCommand {
289
+ properties: Partial<SpatialTextureResourceOptions>;
290
+ commandType: string;
291
+ constructor(spatialObject: SpatialObject, properties: Partial<SpatialTextureResourceOptions>);
292
+ protected getExtraParams(): Partial<SpatialTextureResourceOptions>;
293
+ }
294
+ declare class InspectCommand extends JSBCommand {
295
+ readonly id: string;
296
+ commandType: string;
297
+ constructor(id?: string);
298
+ protected getParams(): {
299
+ id: string;
300
+ };
301
+ }
302
+ declare class DestroyCommand extends JSBCommand {
303
+ readonly id: string;
304
+ commandType: string;
305
+ constructor(id: string);
306
+ protected getParams(): {
307
+ id: string;
308
+ };
309
+ }
310
+ declare class CheckWebViewCanCreateCommand extends JSBCommand {
311
+ readonly id: string;
312
+ commandType: string;
313
+ constructor(id?: string);
314
+ protected getParams(): {
315
+ id: string;
316
+ };
317
+ }
318
+ declare class AnimateTransformJSBCommand extends JSBCommand {
319
+ private command;
320
+ commandType: string;
321
+ constructor(command: AnimateTransformCommand);
322
+ protected getParams(): Record<string, any> | undefined;
323
+ }
324
+ declare class InitializeAttachmentCommand extends JSBCommand {
325
+ private attachmentId;
326
+ private options;
327
+ commandType: string;
328
+ constructor(attachmentId: string, options: AttachmentEntityOptions);
329
+ protected getParams(): {
330
+ id: string;
331
+ parentEntityId: string;
332
+ position: [number, number, number];
333
+ size: {
334
+ width: number;
335
+ height: number;
336
+ };
337
+ ownerViewId: string;
338
+ placementId?: undefined;
339
+ width?: undefined;
340
+ height?: undefined;
341
+ } | {
342
+ id: string;
343
+ placementId: string;
344
+ position: {
345
+ x: number;
346
+ y: number;
347
+ z: number;
348
+ };
349
+ width: number;
350
+ height: number;
351
+ ownerViewId: string;
352
+ parentEntityId?: undefined;
353
+ size?: undefined;
354
+ };
355
+ }
356
+ declare class UpdateAttachmentEntityCommand extends JSBCommand {
357
+ private attachmentId;
358
+ private options;
359
+ commandType: string;
360
+ constructor(attachmentId: string, options: AttachmentEntityUpdateOptions);
361
+ protected getParams(): {
362
+ position?: [number, number, number];
363
+ size?: {
364
+ width: number;
365
+ height: number;
366
+ };
367
+ id: string;
368
+ } | {
369
+ width?: number | undefined;
370
+ height?: number | undefined;
371
+ position?: {
372
+ x: number;
373
+ y: number;
374
+ z: number;
375
+ } | undefined;
376
+ id: string;
377
+ };
378
+ }
379
+ declare class CreateSpatializedElementAnimationJSBCommand extends JSBCommand {
380
+ private command;
381
+ commandType: string;
382
+ constructor(command: CreateSpatializedElementAnimationCommand);
383
+ protected getParams(): {
384
+ elementId: string;
385
+ timeline: SpatializedMotionTimeline;
386
+ };
387
+ }
388
+ declare class ControlSpatializedElementAnimationJSBCommand extends JSBCommand {
389
+ private command;
390
+ commandType: string;
391
+ constructor(command: ControlSpatializedElementAnimationCommand);
392
+ protected getParams(): {
393
+ animationId: string;
394
+ type: SpatializedElementAnimationControlType;
395
+ };
396
+ }
397
+
398
+ export { AddComponentToEntityCommand, AddEntityToDynamic3DCommand, AddEntityToEntityCommand, AddSpatializedElementToSpatialScene, AddSpatializedElementToSpatialized2DElement, AnimateTransformJSBCommand, CheckWebViewCanCreateCommand, ControlSpatializedElementAnimationJSBCommand, ConvertCoordinateCommand, ConvertFromEntityToEntityCommand, ConvertFromEntityToSceneCommand, ConvertFromSceneToEntityCommand, CreateModelAssetCommand, CreateModelComponentCommand, CreateSpatialEntityCommand, CreateSpatialGeometryCommand, CreateSpatialModelEntityCommand, CreateSpatialUnlitMaterialCommand, CreateSpatializedDynamic3DElementCommand, CreateSpatializedElementAnimationJSBCommand, CreateSpatializedStatic3DElementCommand, CreateTextureCommand, DestroyCommand, FocusScene, GetSpatialSceneState, InitializeAttachmentCommand, InspectCommand, RemoveComponentFromEntityCommand, RemoveEntityFromParentCommand, SetMaterialsOnEntityCommand, SetParentForEntityCommand, SpatializedElementCommand, UpdateAttachmentEntityCommand, UpdateEntityEventCommand, UpdateEntityEventsCommand, UpdateEntityPropertiesCommand, UpdateSceneConfig, UpdateSpatialSceneProperties, UpdateSpatialized2DElementProperties, UpdateSpatializedDynamic3DElementProperties, UpdateSpatializedElementTransform, UpdateSpatializedStatic3DElementProperties, UpdateTexturePropertiesCommand, UpdateUnlitMaterialProperties };