@webspatial/core-sdk 1.7.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +10 -0
  3. package/dist/JSBCommand.d.ts +398 -0
  4. package/dist/JSBCommand.js +668 -0
  5. package/dist/JSBCommand.js.map +1 -0
  6. package/dist/Spatial.d.ts +63 -0
  7. package/dist/Spatial.js +60 -0
  8. package/dist/Spatial.js.map +1 -0
  9. package/dist/SpatialObject.d.ts +19 -0
  10. package/dist/SpatialObject.js +44 -0
  11. package/dist/SpatialObject.js.map +1 -0
  12. package/dist/SpatialScene.d.ts +51 -0
  13. package/dist/SpatialScene.js +74 -0
  14. package/dist/SpatialScene.js.map +1 -0
  15. package/dist/SpatialSession.d.ts +143 -0
  16. package/dist/SpatialSession.js +173 -0
  17. package/dist/SpatialSession.js.map +1 -0
  18. package/dist/SpatialWebEvent.d.ts +8 -0
  19. package/dist/SpatialWebEvent.js +18 -0
  20. package/dist/SpatialWebEvent.js.map +1 -0
  21. package/dist/SpatialWebEventCreator.d.ts +11 -0
  22. package/dist/SpatialWebEventCreator.js +11 -0
  23. package/dist/SpatialWebEventCreator.js.map +1 -0
  24. package/dist/Spatialized2DElement.d.ts +42 -0
  25. package/dist/Spatialized2DElement.js +47 -0
  26. package/dist/Spatialized2DElement.js.map +1 -0
  27. package/dist/SpatializedDynamic3DElement.d.ts +7 -0
  28. package/dist/SpatializedDynamic3DElement.js +43 -0
  29. package/dist/SpatializedDynamic3DElement.js.map +1 -0
  30. package/dist/SpatializedElement.d.ts +7 -0
  31. package/dist/SpatializedElement.js +206 -0
  32. package/dist/SpatializedElement.js.map +1 -0
  33. package/dist/SpatializedElementCreator.d.ts +15 -0
  34. package/dist/SpatializedElementCreator.js +47 -0
  35. package/dist/SpatializedElementCreator.js.map +1 -0
  36. package/dist/SpatializedStatic3DElement.d.ts +195 -0
  37. package/dist/SpatializedStatic3DElement.js +327 -0
  38. package/dist/SpatializedStatic3DElement.js.map +1 -0
  39. package/dist/WebMsgCommand.d.ts +7 -0
  40. package/dist/WebMsgCommand.js +23 -0
  41. package/dist/WebMsgCommand.js.map +1 -0
  42. package/dist/index.d.ts +35 -1251
  43. package/dist/index.js +21 -3650
  44. package/dist/index.js.map +1 -1
  45. package/dist/install-polyfills.d.ts +2 -0
  46. package/dist/install-polyfills.js +13 -0
  47. package/dist/install-polyfills.js.map +1 -0
  48. package/dist/isSSREnv.d.ts +3 -0
  49. package/dist/isSSREnv.js +6 -0
  50. package/dist/isSSREnv.js.map +1 -0
  51. package/dist/motion/AnimationObject.d.ts +7 -0
  52. package/dist/motion/AnimationObject.js +140 -0
  53. package/dist/motion/AnimationObject.js.map +1 -0
  54. package/dist/motion/compute/index.d.ts +10 -0
  55. package/dist/motion/compute/index.js +19 -0
  56. package/dist/motion/compute/index.js.map +1 -0
  57. package/dist/motion/compute/motionPropertyValues.d.ts +19 -0
  58. package/dist/motion/compute/motionPropertyValues.js +50 -0
  59. package/dist/motion/compute/motionPropertyValues.js.map +1 -0
  60. package/dist/motion/compute/normalize.d.ts +31 -0
  61. package/dist/motion/compute/normalize.js +201 -0
  62. package/dist/motion/compute/normalize.js.map +1 -0
  63. package/dist/motion/compute/validate.d.ts +22 -0
  64. package/dist/motion/compute/validate.js +103 -0
  65. package/dist/motion/compute/validate.js.map +1 -0
  66. package/dist/motion/index.d.ts +8 -0
  67. package/dist/motion/index.js +6 -0
  68. package/dist/motion/index.js.map +1 -0
  69. package/dist/motion/native/serializeMotionTimeline.d.ts +12 -0
  70. package/dist/motion/native/serializeMotionTimeline.js +21 -0
  71. package/dist/motion/native/serializeMotionTimeline.js.map +1 -0
  72. package/dist/physicalMetrics-W5uZ5xKb.d.ts +48 -0
  73. package/dist/physicalMetrics.d.ts +1 -0
  74. package/dist/physicalMetrics.js +58 -0
  75. package/dist/physicalMetrics.js.map +1 -0
  76. package/dist/platform-adapter/CommandResultUtils.d.ts +12 -0
  77. package/dist/platform-adapter/CommandResultUtils.js +21 -0
  78. package/dist/platform-adapter/CommandResultUtils.js.map +1 -0
  79. package/dist/platform-adapter/createPlatformSync.d.ts +16 -0
  80. package/dist/platform-adapter/createPlatformSync.js +30 -0
  81. package/dist/platform-adapter/createPlatformSync.js.map +1 -0
  82. package/dist/platform-adapter/index.d.ts +12 -0
  83. package/dist/platform-adapter/index.js +10 -0
  84. package/dist/platform-adapter/index.js.map +1 -0
  85. package/dist/platform-adapter/interface.d.ts +7 -0
  86. package/dist/platform-adapter/interface.js +1 -0
  87. package/dist/platform-adapter/interface.js.map +1 -0
  88. package/dist/platform-adapter/pico-os/PicoOSPlatform.d.ts +25 -0
  89. package/dist/platform-adapter/pico-os/PicoOSPlatform.js +168 -0
  90. package/dist/platform-adapter/pico-os/PicoOSPlatform.js.map +1 -0
  91. package/dist/platform-adapter/puppeteer/PuppeteerPlatform.d.ts +66 -0
  92. package/dist/platform-adapter/puppeteer/PuppeteerPlatform.js +372 -0
  93. package/dist/platform-adapter/puppeteer/PuppeteerPlatform.js.map +1 -0
  94. package/dist/platform-adapter/spatialRequestMetadata.d.ts +6 -0
  95. package/dist/platform-adapter/spatialRequestMetadata.js +39 -0
  96. package/dist/platform-adapter/spatialRequestMetadata.js.map +1 -0
  97. package/dist/platform-adapter/spatialSceneQuery.d.ts +12 -0
  98. package/dist/platform-adapter/spatialSceneQuery.js +12 -0
  99. package/dist/platform-adapter/spatialSceneQuery.js.map +1 -0
  100. package/dist/platform-adapter/vision-os/VisionOSPlatform.d.ts +19 -0
  101. package/dist/platform-adapter/vision-os/VisionOSPlatform.js +77 -0
  102. package/dist/platform-adapter/vision-os/VisionOSPlatform.js.map +1 -0
  103. package/dist/platform-runtime.d.ts +12 -0
  104. package/dist/platform-runtime.js +14 -0
  105. package/dist/platform-runtime.js.map +1 -0
  106. package/dist/reality/Attachment.d.ts +19 -0
  107. package/dist/reality/Attachment.js +39 -0
  108. package/dist/reality/Attachment.js.map +1 -0
  109. package/dist/reality/component/ModelComponent.d.ts +14 -0
  110. package/dist/reality/component/ModelComponent.js +11 -0
  111. package/dist/reality/component/ModelComponent.js.map +1 -0
  112. package/dist/reality/component/SpatialComponent.d.ts +8 -0
  113. package/dist/reality/component/SpatialComponent.js +19 -0
  114. package/dist/reality/component/SpatialComponent.js.map +1 -0
  115. package/dist/reality/component/index.d.ts +8 -0
  116. package/dist/reality/component/index.js +3 -0
  117. package/dist/reality/component/index.js.map +1 -0
  118. package/dist/reality/entity/SpatialEntity.d.ts +7 -0
  119. package/dist/reality/entity/SpatialEntity.js +291 -0
  120. package/dist/reality/entity/SpatialEntity.js.map +1 -0
  121. package/dist/reality/entity/SpatialModelEntity.d.ts +17 -0
  122. package/dist/reality/entity/SpatialModelEntity.js +17 -0
  123. package/dist/reality/entity/SpatialModelEntity.js.map +1 -0
  124. package/dist/reality/entity/index.d.ts +8 -0
  125. package/dist/reality/entity/index.js +3 -0
  126. package/dist/reality/entity/index.js.map +1 -0
  127. package/dist/reality/geometry/SpatialBoxGeometry.d.ts +16 -0
  128. package/dist/reality/geometry/SpatialBoxGeometry.js +13 -0
  129. package/dist/reality/geometry/SpatialBoxGeometry.js.map +1 -0
  130. package/dist/reality/geometry/SpatialConeGeometry.d.ts +16 -0
  131. package/dist/reality/geometry/SpatialConeGeometry.js +13 -0
  132. package/dist/reality/geometry/SpatialConeGeometry.js.map +1 -0
  133. package/dist/reality/geometry/SpatialCylinderGeometry.d.ts +16 -0
  134. package/dist/reality/geometry/SpatialCylinderGeometry.js +13 -0
  135. package/dist/reality/geometry/SpatialCylinderGeometry.js.map +1 -0
  136. package/dist/reality/geometry/SpatialGeometry.d.ts +7 -0
  137. package/dist/reality/geometry/SpatialGeometry.js +13 -0
  138. package/dist/reality/geometry/SpatialGeometry.js.map +1 -0
  139. package/dist/reality/geometry/SpatialPlaneGeometry.d.ts +16 -0
  140. package/dist/reality/geometry/SpatialPlaneGeometry.js +13 -0
  141. package/dist/reality/geometry/SpatialPlaneGeometry.js.map +1 -0
  142. package/dist/reality/geometry/SpatialSphereGeometry.d.ts +16 -0
  143. package/dist/reality/geometry/SpatialSphereGeometry.js +13 -0
  144. package/dist/reality/geometry/SpatialSphereGeometry.js.map +1 -0
  145. package/dist/reality/geometry/index.d.ts +12 -0
  146. package/dist/reality/geometry/index.js +7 -0
  147. package/dist/reality/geometry/index.js.map +1 -0
  148. package/dist/reality/index.d.ts +18 -0
  149. package/dist/reality/index.js +7 -0
  150. package/dist/reality/index.js.map +1 -0
  151. package/dist/reality/material/SpatialMaterial.d.ts +7 -0
  152. package/dist/reality/material/SpatialMaterial.js +13 -0
  153. package/dist/reality/material/SpatialMaterial.js.map +1 -0
  154. package/dist/reality/material/SpatialUnlitMaterial.d.ts +16 -0
  155. package/dist/reality/material/SpatialUnlitMaterial.js +16 -0
  156. package/dist/reality/material/SpatialUnlitMaterial.js.map +1 -0
  157. package/dist/reality/material/index.d.ts +8 -0
  158. package/dist/reality/material/index.js +3 -0
  159. package/dist/reality/material/index.js.map +1 -0
  160. package/dist/reality/realityCreator.d.ts +22 -0
  161. package/dist/reality/realityCreator.js +89 -0
  162. package/dist/reality/realityCreator.js.map +1 -0
  163. package/dist/reality/resource/SpatialModelAsset.d.ts +15 -0
  164. package/dist/reality/resource/SpatialModelAsset.js +12 -0
  165. package/dist/reality/resource/SpatialModelAsset.js.map +1 -0
  166. package/dist/reality/resource/SpatialTextureResource.d.ts +16 -0
  167. package/dist/reality/resource/SpatialTextureResource.js +16 -0
  168. package/dist/reality/resource/SpatialTextureResource.js.map +1 -0
  169. package/dist/reality/resource/index.d.ts +9 -0
  170. package/dist/reality/resource/index.js +3 -0
  171. package/dist/reality/resource/index.js.map +1 -0
  172. package/dist/runtime/WebSpatialRuntimeError.d.ts +10 -0
  173. package/dist/runtime/WebSpatialRuntimeError.js +14 -0
  174. package/dist/runtime/WebSpatialRuntimeError.js.map +1 -0
  175. package/dist/runtime/capability-data.d.ts +12 -0
  176. package/dist/runtime/capability-data.js +134 -0
  177. package/dist/runtime/capability-data.js.map +1 -0
  178. package/dist/runtime/index.d.ts +8 -0
  179. package/dist/runtime/index.js +27 -0
  180. package/dist/runtime/index.js.map +1 -0
  181. package/dist/runtime/jsbAdapterPlatform.d.ts +9 -0
  182. package/dist/runtime/jsbAdapterPlatform.js +38 -0
  183. package/dist/runtime/jsbAdapterPlatform.js.map +1 -0
  184. package/dist/runtime/keys.d.ts +34 -0
  185. package/dist/runtime/keys.js +122 -0
  186. package/dist/runtime/keys.js.map +1 -0
  187. package/dist/runtime/semver.d.ts +8 -0
  188. package/dist/runtime/semver.js +32 -0
  189. package/dist/runtime/semver.js.map +1 -0
  190. package/dist/runtime/supports.d.ts +22 -0
  191. package/dist/runtime/supports.js +78 -0
  192. package/dist/runtime/supports.js.map +1 -0
  193. package/dist/runtime/types.d.ts +12 -0
  194. package/dist/runtime/types.js +1 -0
  195. package/dist/runtime/types.js.map +1 -0
  196. package/dist/runtime/userAgent.d.ts +20 -0
  197. package/dist/runtime/userAgent.js +41 -0
  198. package/dist/runtime/userAgent.js.map +1 -0
  199. package/dist/scene-polyfill.d.ts +18 -0
  200. package/dist/scene-polyfill.js +480 -0
  201. package/dist/scene-polyfill.js.map +1 -0
  202. package/dist/spatial-host.d.ts +13 -0
  203. package/dist/spatial-host.js +18 -0
  204. package/dist/spatial-host.js.map +1 -0
  205. package/dist/spatial-window-polyfill.d.ts +3 -0
  206. package/dist/spatial-window-polyfill.js +155 -0
  207. package/dist/spatial-window-polyfill.js.map +1 -0
  208. package/dist/spatializedElementMotion-_0XWPQCE.d.ts +1009 -0
  209. package/dist/types/animation.d.ts +7 -0
  210. package/dist/types/animation.js +1 -0
  211. package/dist/types/animation.js.map +1 -0
  212. package/dist/types/global.d.ts +38 -0
  213. package/dist/types/global.js +1 -0
  214. package/dist/types/global.js.map +1 -0
  215. package/dist/types/internal.d.ts +7 -0
  216. package/dist/types/internal.js +12 -0
  217. package/dist/types/internal.js.map +1 -0
  218. package/dist/types/motion/index.d.ts +7 -0
  219. package/dist/types/motion/index.js +3 -0
  220. package/dist/types/motion/index.js.map +1 -0
  221. package/dist/types/motion/spatializedElementMotion.d.ts +7 -0
  222. package/dist/types/motion/spatializedElementMotion.js +1 -0
  223. package/dist/types/motion/spatializedElementMotion.js.map +1 -0
  224. package/dist/types/motion/spatializedMotion.d.ts +7 -0
  225. package/dist/types/motion/spatializedMotion.js +16 -0
  226. package/dist/types/motion/spatializedMotion.js.map +1 -0
  227. package/dist/types/motion/spatializedPlayback.d.ts +11 -0
  228. package/dist/types/motion/spatializedPlayback.js +1 -0
  229. package/dist/types/motion/spatializedPlayback.js.map +1 -0
  230. package/dist/types/motion/spatializedVisual.d.ts +35 -0
  231. package/dist/types/motion/spatializedVisual.js +1 -0
  232. package/dist/types/motion/spatializedVisual.js.map +1 -0
  233. package/dist/types/types.d.ts +7 -0
  234. package/dist/types/types.js +117 -0
  235. package/dist/types/types.js.map +1 -0
  236. package/dist/utils.d.ts +44 -0
  237. package/dist/utils.js +86 -0
  238. package/dist/utils.js.map +1 -0
  239. package/package.json +20 -4
  240. package/src/JSBCommand.ts +132 -5
  241. package/src/SpatialObject.ts +10 -0
  242. package/src/Spatialized2DElement.ts +5 -0
  243. package/src/SpatializedDynamic3DElement.ts +5 -0
  244. package/src/SpatializedElement.ts +29 -0
  245. package/src/SpatializedStatic3DElement.ts +42 -3
  246. package/src/WebMsgCommand.ts +40 -0
  247. package/src/coverage-boost.test.ts +239 -216
  248. package/src/index.ts +25 -11
  249. package/src/install-polyfills.ts +38 -0
  250. package/src/jsbcommand.coverage.test.ts +23 -0
  251. package/src/motion/AnimationObject.test.ts +421 -0
  252. package/src/motion/AnimationObject.ts +208 -0
  253. package/src/motion/compute/index.ts +10 -0
  254. package/src/motion/compute/motionPropertyValues.test.ts +55 -0
  255. package/src/motion/compute/motionPropertyValues.ts +70 -0
  256. package/src/motion/compute/normalize.test.ts +99 -0
  257. package/src/motion/compute/normalize.ts +289 -0
  258. package/src/motion/compute/validate.test.ts +229 -0
  259. package/src/motion/compute/validate.ts +156 -0
  260. package/src/motion/index.ts +2 -0
  261. package/src/motion/native/serializeMotionTimeline.test.ts +61 -0
  262. package/src/motion/native/serializeMotionTimeline.ts +27 -0
  263. package/src/platform-adapter/createPlatformSync.ts +5 -3
  264. package/src/platform-adapter/pico-os/PicoOSPlatform.ts +76 -11
  265. package/src/platform-adapter/spatialRequestMetadata.test.ts +175 -0
  266. package/src/platform-adapter/spatialRequestMetadata.ts +48 -0
  267. package/src/platform-adapter/vision-os/VisionOSPlatform.ts +6 -1
  268. package/src/reality/entity/SpatialEntity.ts +127 -0
  269. package/src/runtime/capability-data.ts +104 -4
  270. package/src/runtime/index.ts +0 -11
  271. package/src/runtime/keys.ts +12 -1
  272. package/src/runtime/supports.test.ts +143 -4
  273. package/src/runtime/supports.ts +3 -1
  274. package/src/runtime/useAnimation.capability.test.ts +275 -0
  275. package/src/scene-polyfill.manifest.test.ts +306 -5
  276. package/src/scene-polyfill.request-metadata.test.ts +39 -0
  277. package/src/scene-polyfill.test.ts +33 -94
  278. package/src/scene-polyfill.ts +117 -87
  279. package/src/spatial-window-polyfill.ts +18 -2
  280. package/src/transform-roundtrip.test.ts +90 -0
  281. package/src/types/animation.ts +224 -0
  282. package/src/types/global.ts +1 -8
  283. package/src/types/motion/index.ts +10 -0
  284. package/src/types/motion/spatializedElementMotion.ts +49 -0
  285. package/src/types/motion/spatializedMotion.ts +147 -0
  286. package/src/types/motion/spatializedPlayback.ts +17 -0
  287. package/src/types/motion/spatializedVisual.ts +24 -0
  288. package/src/types/types.ts +3 -0
  289. package/src/utils.ts +54 -0
  290. package/tsup.config.ts +61 -36
  291. package/vitest.config.ts +5 -1
  292. package/dist/iife/index.d.ts +0 -1251
  293. package/dist/iife/index.global.js +0 -75
  294. package/dist/iife/index.global.js.map +0 -1
  295. package/src/platform-adapter/ssr/SSRPlatform.ts +0 -52
  296. /package/src/{ssr-polyfill.ts → isSSREnv.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ export { A as AnimateTransformCommand, a as AnimateTransformResult, b as AnimatedProps, c as AnimatedPropsInternal, d as AnimationApi, e as AnimationConfig, f as AnimationError, g as AnimationPlayState, F as Float4x4, ar as TimingFunction, as as TransformValues } from '../spatializedElementMotion-_0XWPQCE.js';
2
+ import './motion/spatializedVisual.js';
3
+ import './motion/spatializedPlayback.js';
4
+ import './global.js';
5
+ import '../physicalMetrics-W5uZ5xKb.js';
6
+ import '../SpatialObject.js';
7
+ import '../reality/component/SpatialComponent.js';
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,38 @@
1
+ import { P as PhysicalMetricsValueShape } from '../physicalMetrics-W5uZ5xKb.js';
2
+
3
+ declare global {
4
+ const __WEBSPATIAL_CORE_SDK_VERSION__: string;
5
+ interface Window {
6
+ __WebSpatialData: {
7
+ androidNativeMessage: Function;
8
+ getNativeVersion: Function;
9
+ };
10
+ __SpatialWebEvent: Function;
11
+ webkit: any;
12
+ webspatialBridge: any;
13
+ webSpatial?: {
14
+ genToken?: () => string;
15
+ };
16
+ __webspatialShell__?: {
17
+ genToken?: () => string;
18
+ };
19
+ WebSpatailNativeVersion: string;
20
+ __webspatialsdk__?: {
21
+ 'natvie-version'?: string;
22
+ 'react-sdk-version'?: string;
23
+ 'core-sdk-version'?: string;
24
+ physicalMetrics?: PhysicalMetricsValueShape;
25
+ pageEpoch?: string | number;
26
+ };
27
+ /** Present when `supports('xrInnerDepth')` is true; otherwise `undefined`. */
28
+ xrInnerDepth?: number;
29
+ /** Present when `supports('xrOuterDepth')` is true; otherwise `undefined`. */
30
+ xrOuterDepth?: number;
31
+ }
32
+ interface HTMLElement {
33
+ /** Present when `supports('xrOffsetBack')` is true for element readbacks. */
34
+ xrOffsetBack?: number;
35
+ /** Present when `supports('xrClientDepth')` is true for element readbacks. */
36
+ xrClientDepth?: number;
37
+ }
38
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=global.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ export { aQ as SpatialSceneCreationOptionsInternal, aR as SpatialSceneState } from '../spatializedElementMotion-_0XWPQCE.js';
2
+ import './motion/spatializedVisual.js';
3
+ import './motion/spatializedPlayback.js';
4
+ import './global.js';
5
+ import '../physicalMetrics-W5uZ5xKb.js';
6
+ import '../SpatialObject.js';
7
+ import '../reality/component/SpatialComponent.js';
@@ -0,0 +1,12 @@
1
+ var SpatialSceneState = /* @__PURE__ */ ((SpatialSceneState2) => {
2
+ SpatialSceneState2["idle"] = "idle";
3
+ SpatialSceneState2["pending"] = "pending";
4
+ SpatialSceneState2["willVisible"] = "willVisible";
5
+ SpatialSceneState2["visible"] = "visible";
6
+ SpatialSceneState2["fail"] = "fail";
7
+ return SpatialSceneState2;
8
+ })(SpatialSceneState || {});
9
+ export {
10
+ SpatialSceneState
11
+ };
12
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/internal.ts"],"sourcesContent":["import { SpatialSceneCreationOptions, SpatialSceneType } from './types'\n\nexport type SpatialSceneCreationOptionsInternal =\n SpatialSceneCreationOptions & {\n type: SpatialSceneType\n }\nexport enum SpatialSceneState {\n idle = 'idle',\n pending = 'pending',\n willVisible = 'willVisible',\n visible = 'visible',\n fail = 'fail',\n}\n"],"mappings":"AAMO,IAAK,oBAAL,kBAAKA,uBAAL;AACL,EAAAA,mBAAA,UAAO;AACP,EAAAA,mBAAA,aAAU;AACV,EAAAA,mBAAA,iBAAc;AACd,EAAAA,mBAAA,aAAU;AACV,EAAAA,mBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;","names":["SpatialSceneState"]}
@@ -0,0 +1,7 @@
1
+ export { SpatializedVisualTransform, SpatializedVisualValues } from './spatializedVisual.js';
2
+ export { SpatializedPlaybackError } from './spatializedPlayback.js';
3
+ export { aj as SpatializedMotionConfig, ak as SpatializedMotionKind, al as SpatializedMotionPlayState, am as SpatializedMotionSegmentConfig, an as SpatializedMotionTimelineConfig, ao as SpatializedPlaybackApi } from '../../spatializedElementMotion-_0XWPQCE.js';
4
+ import '../global.js';
5
+ import '../../physicalMetrics-W5uZ5xKb.js';
6
+ import '../../SpatialObject.js';
7
+ import '../../reality/component/SpatialComponent.js';
@@ -0,0 +1,3 @@
1
+ export * from "./spatializedVisual";
2
+ export * from "./spatializedPlayback";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/motion/index.ts"],"sourcesContent":["export * from './spatializedVisual'\nexport * from './spatializedPlayback'\nexport type {\n SpatializedMotionKind,\n SpatializedMotionSegmentConfig,\n SpatializedMotionTimelineConfig,\n SpatializedMotionConfig,\n SpatializedMotionPlayState,\n SpatializedPlaybackApi,\n} from './spatializedMotion'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,7 @@
1
+ export { aL as ControlSpatializedElementAnimationCommand, aN as CreateSpatializedElementAnimationCommand, bk as SpatialAnimationStateChangedDetail, bl as SpatialAnimationStateChangedMsg, aM as SpatializedElementAnimationControlType } from '../../spatializedElementMotion-_0XWPQCE.js';
2
+ import './spatializedVisual.js';
3
+ import './spatializedPlayback.js';
4
+ import '../global.js';
5
+ import '../../physicalMetrics-W5uZ5xKb.js';
6
+ import '../../SpatialObject.js';
7
+ import '../../reality/component/SpatialComponent.js';
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=spatializedElementMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ export { a$ as NormalizedSpatializedMotionConfig, bg as SPATIALIZED_MOTION_PROPERTIES, aj as SpatializedMotionConfig, bh as SpatializedMotionKeyframe, bi as SpatializedMotionKeyframeValues, ak as SpatializedMotionKind, al as SpatializedMotionPlayState, a_ as SpatializedMotionProperty, am as SpatializedMotionSegmentConfig, aO as SpatializedMotionTimeline, an as SpatializedMotionTimelineConfig, bj as SpatializedMotionTrack, ao as SpatializedPlaybackApi } from '../../spatializedElementMotion-_0XWPQCE.js';
2
+ import './spatializedPlayback.js';
3
+ import './spatializedVisual.js';
4
+ import '../global.js';
5
+ import '../../physicalMetrics-W5uZ5xKb.js';
6
+ import '../../SpatialObject.js';
7
+ import '../../reality/component/SpatialComponent.js';
@@ -0,0 +1,16 @@
1
+ const SPATIALIZED_MOTION_PROPERTIES = [
2
+ "opacity",
3
+ "transform.translate.x",
4
+ "transform.translate.y",
5
+ "transform.translate.z",
6
+ "transform.rotate.x",
7
+ "transform.rotate.y",
8
+ "transform.rotate.z",
9
+ "transform.scale.x",
10
+ "transform.scale.y",
11
+ "transform.scale.z"
12
+ ];
13
+ export {
14
+ SPATIALIZED_MOTION_PROPERTIES
15
+ };
16
+ //# sourceMappingURL=spatializedMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/motion/spatializedMotion.ts"],"sourcesContent":["import type { TimingFunction } from '../animation'\nimport type { SpatializedPlaybackError } from './spatializedPlayback'\nimport type { SpatializedVisualValues } from './spatializedVisual'\n\n/** Spatialized container kinds with declarative timeline motion. */\nexport type SpatializedMotionKind = 'spatialized2d' | 'static3d' | 'dynamic3d'\n\n/** Scalar property path on the spatialized visual whitelist. */\nexport const SPATIALIZED_MOTION_PROPERTIES = [\n 'opacity',\n 'transform.translate.x',\n 'transform.translate.y',\n 'transform.translate.z',\n 'transform.rotate.x',\n 'transform.rotate.y',\n 'transform.rotate.z',\n 'transform.scale.x',\n 'transform.scale.y',\n 'transform.scale.z',\n] as const\n\nexport type SpatializedMotionProperty =\n (typeof SPATIALIZED_MOTION_PROPERTIES)[number]\n\nexport interface SpatializedMotionKeyframe {\n /** Time in seconds from timeline start, in `[0, duration]`. */\n at: number\n value: number\n timingFunction?: TimingFunction\n}\n\nexport type SpatializedMotionKeyframeValues = SpatializedVisualValues & {\n timingFunction?: TimingFunction\n}\n\n/** One animatable property path and its keyframes (config-only, not a runtime handle). */\nexport interface SpatializedMotionTrack {\n property: SpatializedMotionProperty\n keyframes: SpatializedMotionKeyframe[]\n timingFunction?: TimingFunction\n}\n\n/** Single-segment motion: `from` → `to` over `duration`. */\nexport interface SpatializedMotionSegmentConfig {\n to: SpatializedVisualValues\n from: SpatializedVisualValues\n tracks?: never\n timeline?: never\n duration?: number\n timingFunction?: TimingFunction\n delay?: number\n autoStart?: boolean\n loop?: boolean | { reverse?: boolean }\n playbackRate?: number\n onStart?: () => void\n onComplete?: (values: SpatializedVisualValues) => void\n onStop?: (values: SpatializedVisualValues) => void\n onReset?: (values: SpatializedVisualValues) => void\n onError?: (error: SpatializedPlaybackError) => void\n}\n\n/** Percentage-keyframe timeline authoring shape before desugaring. */\nexport interface SpatializedMotionTimelineConfig {\n duration?: number\n timeline: Record<string, SpatializedMotionKeyframeValues>\n /** Ignored when timeline authoring is present. */\n from?: SpatializedVisualValues\n /** Ignored when timeline authoring is present. */\n to?: SpatializedVisualValues\n tracks?: never\n timingFunction?: TimingFunction\n delay?: number\n autoStart?: boolean\n loop?: boolean | { reverse?: boolean }\n playbackRate?: number\n onStart?: () => void\n onComplete?: (values: SpatializedVisualValues) => void\n onStop?: (values: SpatializedVisualValues) => void\n onReset?: (values: SpatializedVisualValues) => void\n onError?: (error: SpatializedPlaybackError) => void\n}\n\n/** Public authoring accepted by spatialized container motion. */\nexport type SpatializedMotionConfig =\n | SpatializedMotionSegmentConfig\n | SpatializedMotionTimelineConfig\n\n/** Canonical internal track document produced before native create. */\nexport interface NormalizedSpatializedMotionConfig {\n /** Timeline duration in seconds. */\n duration: number\n /** Canonical per-property numeric tracks. */\n tracks: SpatializedMotionTrack[]\n /** Default interpolation for tracks without an override. */\n timingFunction?: TimingFunction\n /** Playback delay in seconds. */\n delay?: number\n /** Whether playback starts automatically after binding. */\n autoStart?: boolean\n /** Loop behavior for the animation session. */\n loop?: boolean | { reverse?: boolean }\n /** Playback speed multiplier. */\n playbackRate?: number\n /** Called when playback starts. */\n onStart?: () => void\n /** Called when playback completes. */\n onComplete?: (values: SpatializedVisualValues) => void\n /** Called when playback stops. */\n onStop?: (values: SpatializedVisualValues) => void\n /** Called when playback resets. */\n onReset?: (values: SpatializedVisualValues) => void\n /** Called when asynchronous playback fails. */\n onError?: (error: SpatializedPlaybackError) => void\n}\n\n/** Normalized timeline wire payload for native playback. */\nexport interface SpatializedMotionTimeline {\n duration: number\n delay?: number\n playbackRate?: number\n loop?: boolean | { reverse?: boolean }\n tracks: Array<{\n property: SpatializedMotionProperty\n keyframes: SpatializedMotionKeyframe[]\n timingFunction: TimingFunction\n }>\n}\n\nexport type SpatializedMotionPlayState =\n | 'idle'\n | 'queued'\n | 'running'\n | 'paused'\n | 'finished'\n\n/** Public imperative playback controls exposed to spatialized motion consumers. */\nexport interface SpatializedPlaybackApi {\n play(): void\n pause(): void\n stop(): void\n reset(): void\n finish(): void\n readonly isAnimating: boolean\n readonly isPaused: boolean\n readonly finished: boolean\n readonly playState: SpatializedMotionPlayState\n}\n"],"mappings":"AAQO,MAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,11 @@
1
+ /** Async playback failure from native bridge. */
2
+ interface SpatializedPlaybackError {
3
+ /** Operation that failed. */
4
+ command: 'create' | 'play' | 'pause' | 'resume' | 'stop' | 'reset' | 'finish' | 'destroy';
5
+ /** Native or SDK error code when available. */
6
+ code?: string;
7
+ /** Human-readable failure reason. */
8
+ reason: string;
9
+ }
10
+
11
+ export type { SpatializedPlaybackError };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=spatializedPlayback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Structured visual transform for a spatialized container element.
3
+ * Composed in fixed order: translate → rotate → scale.
4
+ * Does NOT support arbitrary CSS transform strings, skew, perspective, or matrix interpolation.
5
+ */
6
+ interface SpatializedVisualTransform {
7
+ /** Translation in CSS pixels. */
8
+ translate?: {
9
+ x?: number;
10
+ y?: number;
11
+ z?: number;
12
+ };
13
+ /** Rotation in degrees, aligning with CSS rotateX/Y/Z(). */
14
+ rotate?: {
15
+ x?: number;
16
+ y?: number;
17
+ z?: number;
18
+ };
19
+ /** Scale as unitless multipliers, aligning with CSS scaleX/Y/Z(). */
20
+ scale?: {
21
+ x?: number;
22
+ y?: number;
23
+ z?: number;
24
+ };
25
+ }
26
+ /**
27
+ * Whitelisted visual fields on a spatialized element at an instant in time.
28
+ * Does not include layout/size fields (width, height, back, depth).
29
+ */
30
+ interface SpatializedVisualValues {
31
+ transform?: SpatializedVisualTransform;
32
+ opacity?: number;
33
+ }
34
+
35
+ export type { SpatializedVisualTransform, SpatializedVisualValues };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=spatializedVisual.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ import './global.js';
2
+ export { h as AttachmentEntityOptions, i as AttachmentEntityUpdateOptions, B as BackgroundMaterialType, j as BaseplateVisibilityType, k as BaseplateVisibilityValues, C as CornerRadius, l as CubeInfo, M as ModelAssetOptions, m as ModelComponentOptions, n as ModelLoadingMode, o as ModelSource, P as PWAManifest, p as Point3D, Q as Quaternion, S as SceneUnit, q as SceneUnitM, r as SceneUnitPx, s as Size, t as Size3D, u as SpatialBoxGeometryOptions, v as SpatialConeGeometryOptions, w as SpatialCylinderGeometryOptions, x as SpatialDragEndEvent, y as SpatialDragEndEventDetail, z as SpatialDragEvent, D as SpatialDragEventDetail, E as SpatialDragStartEvent, G as SpatialDragStartEventDetail, I as SpatialEntityEventType, J as SpatialEntityOrReality, K as SpatialEntityProperties, L as SpatialEntityUserData, O as SpatialGeometryOptions, R as SpatialGeometryType, T as SpatialMagnifyEndEvent, U as SpatialMagnifyEndEventDetail, V as SpatialMagnifyEvent, W as SpatialMagnifyEventDetail, Y as SpatialMaterialType, Z as SpatialModelDragEvent, _ as SpatialModelEntityCreationOptions, $ as SpatialPlaneGeometryOptions, a0 as SpatialRotateEndEvent, a1 as SpatialRotateEndEventDetail, a2 as SpatialRotateEvent, a3 as SpatialRotateEventDetail, a4 as SpatialSceneCreationOptions, a5 as SpatialSceneProperties, a6 as SpatialSceneState, a7 as SpatialSceneType, a8 as SpatialSceneValues, a9 as SpatialSphereGeometryOptions, aa as SpatialTapEvent, ab as SpatialTapEventDetail, ac as SpatialTextureResourceOptions, ad as SpatialUnlitMaterialOptions, ae as Spatialized2DElementProperties, ah as SpatializedElementProperties, ai as SpatializedElementType, ap as SpatializedStatic3DElementProperties, aq as StageMode, at as Vec3, au as WorldAlignmentType, av as WorldAlignmentValues, aw as WorldScalingType, ax as WorldScalingValues, ay as XRMainSceneConfig, az as XRPrdConfig, aA as XRSceneResizability, aB as XRSceneSize, aC as XRSpatialSceneConfig, aD as XRSpatialSceneDefaults, aE as XRSpatialSceneOverrides, aF as isValidBaseplateVisibilityType, aG as isValidSceneUnit, aH as isValidSpatialSceneType, aI as isValidWorldAlignmentType, aJ as isValidWorldScalingType } from '../spatializedElementMotion-_0XWPQCE.js';
3
+ import '../physicalMetrics-W5uZ5xKb.js';
4
+ import './motion/spatializedVisual.js';
5
+ import './motion/spatializedPlayback.js';
6
+ import '../SpatialObject.js';
7
+ import '../reality/component/SpatialComponent.js';
@@ -0,0 +1,117 @@
1
+ var SpatializedElementType = /* @__PURE__ */ ((SpatializedElementType2) => {
2
+ SpatializedElementType2[SpatializedElementType2["Spatialized2DElement"] = 0] = "Spatialized2DElement";
3
+ SpatializedElementType2[SpatializedElementType2["SpatializedStatic3DElement"] = 1] = "SpatializedStatic3DElement";
4
+ SpatializedElementType2[SpatializedElementType2["SpatializedDynamic3DElement"] = 2] = "SpatializedDynamic3DElement";
5
+ return SpatializedElementType2;
6
+ })(SpatializedElementType || {});
7
+ const BaseplateVisibilityValues = [
8
+ "automatic",
9
+ "visible",
10
+ "hidden"
11
+ ];
12
+ function isValidBaseplateVisibilityType(type) {
13
+ return BaseplateVisibilityValues.includes(type);
14
+ }
15
+ const WorldScalingValues = ["automatic", "dynamic"];
16
+ function isValidWorldScalingType(type) {
17
+ return WorldScalingValues.includes(type);
18
+ }
19
+ const WorldAlignmentValues = [
20
+ "adaptive",
21
+ "automatic",
22
+ "gravityAligned"
23
+ ];
24
+ function isValidWorldAlignmentType(type) {
25
+ return WorldAlignmentValues.includes(type);
26
+ }
27
+ const SpatialSceneValues = ["window", "volume"];
28
+ function isValidSpatialSceneType(type) {
29
+ return SpatialSceneValues.includes(type);
30
+ }
31
+ function isValidSceneUnit(val) {
32
+ if (typeof val === "number") {
33
+ return val >= 0;
34
+ }
35
+ if (typeof val === "string") {
36
+ if (val.endsWith("px")) {
37
+ if (isNaN(Number(val.slice(0, -2)))) {
38
+ return false;
39
+ }
40
+ return Number(val.slice(0, -2)) >= 0;
41
+ }
42
+ if (val.endsWith("m")) {
43
+ if (isNaN(Number(val.slice(0, -1)))) {
44
+ return false;
45
+ }
46
+ return Number(val.slice(0, -1)) >= 0;
47
+ }
48
+ }
49
+ return false;
50
+ }
51
+ var SpatialSceneState = /* @__PURE__ */ ((SpatialSceneState2) => {
52
+ SpatialSceneState2["idle"] = "idle";
53
+ SpatialSceneState2["pending"] = "pending";
54
+ SpatialSceneState2["willVisible"] = "willVisible";
55
+ SpatialSceneState2["visible"] = "visible";
56
+ SpatialSceneState2["fail"] = "fail";
57
+ return SpatialSceneState2;
58
+ })(SpatialSceneState || {});
59
+ class CubeInfo {
60
+ constructor(size, origin) {
61
+ this.size = size;
62
+ this.origin = origin;
63
+ this.size = size;
64
+ this.origin = origin;
65
+ }
66
+ get x() {
67
+ return this.origin.x;
68
+ }
69
+ get y() {
70
+ return this.origin.y;
71
+ }
72
+ get z() {
73
+ return this.origin.z;
74
+ }
75
+ get width() {
76
+ return this.size.width;
77
+ }
78
+ get height() {
79
+ return this.size.height;
80
+ }
81
+ get depth() {
82
+ return this.size.depth;
83
+ }
84
+ get left() {
85
+ return this.x;
86
+ }
87
+ get top() {
88
+ return this.y;
89
+ }
90
+ get right() {
91
+ return this.x + this.width;
92
+ }
93
+ get bottom() {
94
+ return this.y + this.height;
95
+ }
96
+ get back() {
97
+ return this.z;
98
+ }
99
+ get front() {
100
+ return this.z + this.depth;
101
+ }
102
+ }
103
+ export {
104
+ BaseplateVisibilityValues,
105
+ CubeInfo,
106
+ SpatialSceneState,
107
+ SpatialSceneValues,
108
+ SpatializedElementType,
109
+ WorldAlignmentValues,
110
+ WorldScalingValues,
111
+ isValidBaseplateVisibilityType,
112
+ isValidSceneUnit,
113
+ isValidSpatialSceneType,
114
+ isValidWorldAlignmentType,
115
+ isValidWorldScalingType
116
+ };
117
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/types.ts"],"sourcesContent":["import type { SpatialEntity } from '..'\nimport { SpatialGeometry } from '../reality/geometry/SpatialGeometry'\nimport { SpatialMaterial } from '../reality/material/SpatialMaterial'\nimport type { SpatializedDynamic3DElement } from '../SpatializedDynamic3DElement'\n\nexport interface Vec3 {\n x: number\n y: number\n z: number\n}\n\nexport type Point3D = Vec3\n\nexport interface Quaternion {\n x: number\n y: number\n z: number\n w: number\n}\n\n/**\n * Material type for SpatialDiv or HTML document.\n *\n * This type defines the background material options for both SpatialDiv elements and HTML documents.\n *\n * - `'none'`: This is the default value.\n * - For HTML documents, the web page window will have the default native background.\n * - For SpatialDiv, the window will have a transparent background.\n * - `'translucent'`: Represents a glass-like material in AVP (Apple Vision Pro).\n * - `'thick'`: Represents a thick material in AVP.\n * - `'regular'`: Represents a regular material in AVP.\n * - `'thin'`: Represents a thin material in AVP.\n * - `'transparent'`: Represents a fully transparent background.\n */\nexport type BackgroundMaterialType =\n | 'none'\n | 'translucent'\n | 'thick'\n | 'regular'\n | 'thin'\n | 'transparent'\n\nexport type CornerRadius = {\n topLeading: number\n bottomLeading: number\n topTrailing: number\n bottomTrailing: number\n}\n\nexport interface SpatialSceneProperties {\n cornerRadius: CornerRadius\n material: BackgroundMaterialType\n opacity: number\n}\n\nexport enum SpatializedElementType {\n Spatialized2DElement,\n SpatializedStatic3DElement,\n SpatializedDynamic3DElement,\n}\n\nexport interface SpatializedElementProperties {\n name: string\n clientX: number\n clientY: number\n width: number\n height: number\n depth: number\n opacity: number\n visible: boolean\n scrollWithParent: boolean\n zIndex: number\n backOffset: number\n rotationAnchor: Point3D\n enableTapGesture: boolean\n enableDragStartGesture: boolean\n enableDragGesture: boolean\n enableDragEndGesture: boolean\n enableRotateGesture: boolean\n enableRotateEndGesture: boolean\n enableMagnifyGesture: boolean\n enableMagnifyEndGesture: boolean\n /**\n * Optional world-space axis for spatial rotate gesture. Omitted or zero vector\n * means unconstrained rotation (platform default).\n */\n rotateConstrainedToAxis?: Vec3\n}\n\nexport interface Spatialized2DElementProperties\n extends SpatializedElementProperties {\n scrollPageEnabled: boolean\n cornerRadius: CornerRadius\n material: BackgroundMaterialType\n scrollEdgeInsetsMarginRight: number\n}\n\nexport interface ModelSource {\n src: string\n type?: string\n}\n\nexport type ModelLoadingMode = 'eager' | 'lazy'\n\nexport type StageMode = 'orbit' | 'none'\n\nexport interface SpatializedStatic3DElementProperties\n extends SpatializedElementProperties {\n modelURL: string\n sources?: ModelSource[]\n modelTransform?: number[]\n stagemode?: StageMode\n autoplay?: boolean\n loop?: boolean\n animationPaused?: boolean\n playbackRate?: number\n currentTime?: number\n posterURL?: string\n loading?: ModelLoadingMode\n}\n\nexport interface SpatialSceneCreationOptions {\n defaultSize?: {\n width: number | string // Initial width of the window\n height: number | string // Initial height of the window\n depth?: number | string // Initial depth of the window, only for volume\n }\n\n resizability?: {\n minWidth?: number | string // Minimum width of the window\n minHeight?: number | string // Minimum height of the window\n maxWidth?: number | string // Maximum width of the window\n maxHeight?: number | string // Maximum height of the window\n }\n worldScaling?: WorldScalingType\n worldAlignment?: WorldAlignmentType\n\n baseplateVisibility?: BaseplateVisibilityType\n}\n\nexport type SpatialEntityEventType =\n | 'spatialtap'\n | 'spatialdragstart'\n | 'spatialdrag'\n | 'spatialdragend'\n | 'spatialrotate'\n | 'spatialrotateend'\n | 'spatialmagnify'\n | 'spatialmagnifyend'\n\nexport const BaseplateVisibilityValues = [\n 'automatic',\n 'visible',\n 'hidden',\n] as const\nexport type BaseplateVisibilityType = (typeof BaseplateVisibilityValues)[number]\n\nexport function isValidBaseplateVisibilityType(type: string): Boolean {\n return BaseplateVisibilityValues.includes(type as BaseplateVisibilityType)\n}\n\nexport const WorldScalingValues = ['automatic', 'dynamic'] as const\nexport type WorldScalingType = (typeof WorldScalingValues)[number]\n\nexport function isValidWorldScalingType(type: string): Boolean {\n return WorldScalingValues.includes(type as WorldScalingType)\n}\n\nexport const WorldAlignmentValues = [\n 'adaptive',\n 'automatic',\n 'gravityAligned',\n] as const\nexport type WorldAlignmentType = (typeof WorldAlignmentValues)[number]\n\nexport function isValidWorldAlignmentType(type: string): Boolean {\n return WorldAlignmentValues.includes(type as WorldAlignmentType)\n}\n\nexport const SpatialSceneValues = ['window', 'volume'] as const\nexport type SpatialSceneType = (typeof SpatialSceneValues)[number]\n\nexport function isValidSpatialSceneType(type: string): Boolean {\n return SpatialSceneValues.includes(type as SpatialSceneType)\n}\n\n/**\n * check px,m and number, number must be >= 0\n *\n * */\nexport function isValidSceneUnit(val: string | number): boolean {\n // only support number or string with unit px or m\n // rpx cm mm not allowed\n if (typeof val === 'number') {\n return val >= 0\n }\n if (typeof val === 'string') {\n if (val.endsWith('px')) {\n // check if number\n if (isNaN(Number(val.slice(0, -2)))) {\n return false\n }\n return Number(val.slice(0, -2)) >= 0\n }\n if (val.endsWith('m')) {\n // check if number\n if (isNaN(Number(val.slice(0, -1)))) {\n return false\n }\n return Number(val.slice(0, -1)) >= 0\n }\n }\n return false\n}\n\nexport interface SpatialEntityProperties {\n position: Vec3\n rotation: Vec3\n scale: Vec3\n}\n\nexport type SpatialGeometryType =\n | 'BoxGeometry'\n | 'PlaneGeometry'\n | 'SphereGeometry'\n | 'CylinderGeometry'\n | 'ConeGeometry'\n\nexport interface SpatialBoxGeometryOptions {\n width?: number\n height?: number\n depth?: number\n cornerRadius?: number\n splitFaces?: boolean\n}\n\nexport interface SpatialPlaneGeometryOptions {\n width?: number\n height?: number\n cornerRadius?: number\n}\n\nexport interface SpatialSphereGeometryOptions {\n radius?: number\n}\n\nexport interface SpatialConeGeometryOptions {\n radius?: number\n height?: number\n}\n\nexport interface SpatialCylinderGeometryOptions {\n radius?: number\n height?: number\n}\n\nexport type SpatialGeometryOptions =\n | SpatialBoxGeometryOptions\n | SpatialPlaneGeometryOptions\n | SpatialSphereGeometryOptions\n | SpatialCylinderGeometryOptions\n | SpatialConeGeometryOptions\n\nexport type SpatialMaterialType = 'unlit'\n\nexport interface SpatialUnlitMaterialOptions {\n color?: string\n textureId?: string\n transparent?: boolean\n opacity?: number\n}\n\nexport interface SpatialTextureResourceOptions {\n url: string\n}\n\nexport interface ModelComponentOptions {\n mesh: SpatialGeometry\n materials: SpatialMaterial[]\n}\n\nexport interface SpatialEntityUserData {\n id?: string\n name?: string\n}\n\nexport interface SpatialModelEntityCreationOptions {\n modelAssetId: string\n name?: string\n}\n\nexport interface ModelAssetOptions {\n url: string\n}\n\nexport enum SpatialSceneState {\n idle = 'idle',\n pending = 'pending',\n willVisible = 'willVisible',\n visible = 'visible',\n fail = 'fail',\n}\n\n/**\n * Translate event, matching similar behavior to https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drag_event\n */\nexport type SpatialModelDragEvent = {\n eventType: 'dragstart' | 'dragend' | 'drag'\n translation3D: Vec3\n startLocation3D: Vec3\n}\n\nexport interface Size {\n width: number\n height: number\n}\n\nexport interface Size3D extends Size {\n depth: number\n}\n\nexport class CubeInfo {\n constructor(\n public size: Size3D,\n public origin: Vec3,\n ) {\n this.size = size\n this.origin = origin\n }\n\n get x() {\n return this.origin.x\n }\n\n get y() {\n return this.origin.y\n }\n\n get z() {\n return this.origin.z\n }\n\n get width() {\n return this.size.width\n }\n\n get height() {\n return this.size.height\n }\n\n get depth() {\n return this.size.depth\n }\n\n get left() {\n return this.x\n }\n\n get top() {\n return this.y\n }\n\n get right() {\n return this.x + this.width\n }\n\n get bottom() {\n return this.y + this.height\n }\n\n get back() {\n return this.z\n }\n\n get front() {\n return this.z + this.depth\n }\n}\n\nexport interface SpatialTapEventDetail {\n location3D: Point3D\n globalLocation3D?: Point3D\n}\n\nexport type SpatialTapEvent = CustomEvent<SpatialTapEventDetail>\n\nexport interface SpatialDragStartEventDetail {\n startLocation3D: Point3D\n globalLocation3D?: Point3D\n}\n\nexport interface SpatialDragEventDetail {\n translation3D: Vec3\n}\n\nexport interface SpatialDragEndEventDetail {}\n\nexport type SpatialDragStartEvent = CustomEvent<SpatialDragStartEventDetail>\n\nexport type SpatialDragEvent = CustomEvent<SpatialDragEventDetail>\n\nexport type SpatialDragEndEvent = CustomEvent<SpatialDragEndEventDetail>\nexport interface SpatialRotateEventDetail {\n quaternion: Quaternion\n}\n\nexport interface SpatialRotateEndEventDetail {}\n\nexport type SpatialRotateEvent = CustomEvent<SpatialRotateEventDetail>\n\nexport type SpatialRotateEndEvent = CustomEvent<SpatialRotateEndEventDetail>\n\nexport interface SpatialMagnifyEventDetail {\n magnification: number\n}\n\nexport interface SpatialMagnifyEndEventDetail {}\n\nexport type SpatialMagnifyEvent = CustomEvent<SpatialMagnifyEventDetail>\n\nexport type SpatialMagnifyEndEvent = CustomEvent<SpatialMagnifyEndEventDetail>\n\nexport type SpatialEntityOrReality = SpatialEntity | SpatializedDynamic3DElement\n\nexport interface AttachmentEntityOptions {\n parentEntityId: string\n position?: [number, number, number]\n size: { width: number; height: number }\n ownerViewId: string\n}\n\nexport interface AttachmentEntityUpdateOptions {\n position?: [number, number, number]\n size?: { width: number; height: number }\n}\n\n// manifest\n\nexport type SceneUnitPx = `${number}px`\nexport type SceneUnitM = `${number}m`\nexport type SceneUnit = number | SceneUnitPx | SceneUnitM\n\nexport interface XRSceneSize {\n width: SceneUnit\n height: SceneUnit\n depth?: SceneUnit\n}\n\nexport interface XRSceneResizability {\n minWidth?: SceneUnit\n minHeight?: SceneUnit\n maxWidth?: SceneUnit\n maxHeight?: SceneUnit\n}\n\nexport interface XRMainSceneConfig extends XRSpatialSceneDefaults {\n type?: SpatialSceneType\n}\n\nexport interface XRSpatialSceneDefaults {\n default_size?: XRSceneSize\n resizability?: XRSceneResizability\n worldScaling?: WorldScalingType\n worldAlignment?: WorldAlignmentType\n baseplateVisibility?: BaseplateVisibilityType\n}\n\nexport interface XRSpatialSceneOverrides {\n window_scene?: XRSpatialSceneDefaults\n volume_scene?: XRSpatialSceneDefaults\n}\n\nexport interface XRSpatialSceneConfig extends XRSpatialSceneDefaults {\n overrides?: XRSpatialSceneOverrides\n}\n\nexport interface XRPrdConfig {\n xr_main_scene?: XRMainSceneConfig\n xr_spatial_scene?: XRSpatialSceneConfig\n}\n\nexport interface PWAManifest extends XRPrdConfig {\n name?: string\n short_name?: string\n start_url?: string\n display?: string\n icons?: Array<{\n src: string\n sizes?: string\n type?: string\n purpose?: string\n }>\n id?: string\n scope?: string\n [key: string]: any\n}\n"],"mappings":"AAuDO,IAAK,yBAAL,kBAAKA,4BAAL;AACL,EAAAA,gDAAA;AACA,EAAAA,gDAAA;AACA,EAAAA,gDAAA;AAHU,SAAAA;AAAA,GAAA;AA+FL,MAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF;AAGO,SAAS,+BAA+B,MAAuB;AACpE,SAAO,0BAA0B,SAAS,IAA+B;AAC3E;AAEO,MAAM,qBAAqB,CAAC,aAAa,SAAS;AAGlD,SAAS,wBAAwB,MAAuB;AAC7D,SAAO,mBAAmB,SAAS,IAAwB;AAC7D;AAEO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACF;AAGO,SAAS,0BAA0B,MAAuB;AAC/D,SAAO,qBAAqB,SAAS,IAA0B;AACjE;AAEO,MAAM,qBAAqB,CAAC,UAAU,QAAQ;AAG9C,SAAS,wBAAwB,MAAuB;AAC7D,SAAO,mBAAmB,SAAS,IAAwB;AAC7D;AAMO,SAAS,iBAAiB,KAA+B;AAG9D,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,OAAO;AAAA,EAChB;AACA,MAAI,OAAO,QAAQ,UAAU;AAC3B,QAAI,IAAI,SAAS,IAAI,GAAG;AAEtB,UAAI,MAAM,OAAO,IAAI,MAAM,GAAG,EAAE,CAAC,CAAC,GAAG;AACnC,eAAO;AAAA,MACT;AACA,aAAO,OAAO,IAAI,MAAM,GAAG,EAAE,CAAC,KAAK;AAAA,IACrC;AACA,QAAI,IAAI,SAAS,GAAG,GAAG;AAErB,UAAI,MAAM,OAAO,IAAI,MAAM,GAAG,EAAE,CAAC,CAAC,GAAG;AACnC,eAAO;AAAA,MACT;AACA,aAAO,OAAO,IAAI,MAAM,GAAG,EAAE,CAAC,KAAK;AAAA,IACrC;AAAA,EACF;AACA,SAAO;AACT;AAkFO,IAAK,oBAAL,kBAAKC,uBAAL;AACL,EAAAA,mBAAA,UAAO;AACP,EAAAA,mBAAA,aAAU;AACV,EAAAA,mBAAA,iBAAc;AACd,EAAAA,mBAAA,aAAU;AACV,EAAAA,mBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AA0BL,MAAM,SAAS;AAAA,EACpB,YACS,MACA,QACP;AAFO;AACA;AAEP,SAAK,OAAO;AACZ,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,IAAI,IAAI;AACN,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,IAAI;AACN,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,IAAI;AACN,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EAEA,IAAI,SAAS;AACX,WAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EAEA,IAAI,OAAO;AACT,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,MAAM;AACR,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,IAAI,KAAK;AAAA,EACvB;AAAA,EAEA,IAAI,SAAS;AACX,WAAO,KAAK,IAAI,KAAK;AAAA,EACvB;AAAA,EAEA,IAAI,OAAO;AACT,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,IAAI,KAAK;AAAA,EACvB;AACF;","names":["SpatializedElementType","SpatialSceneState"]}
@@ -0,0 +1,44 @@
1
+ import { at as Vec3, as as TransformValues } 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 parseCornerRadius(computedStyle: CSSStyleDeclaration): {
10
+ topLeading: number;
11
+ bottomLeading: number;
12
+ topTrailing: number;
13
+ bottomTrailing: number;
14
+ };
15
+ /**
16
+ *
17
+ * compose SRT matrix
18
+ * @export
19
+ * @param {Vec3} position meter
20
+ * @param {Vec3} rotation degree
21
+ * @param {Vec3} scale
22
+ * @return {*} {DOMMatrix}
23
+ */
24
+ declare function composeSRT(position: Vec3, rotation: Vec3, scale: Vec3): DOMMatrix;
25
+ /**
26
+ * Deep-clone a plain JSON-serializable object by value.
27
+ *
28
+ * Notes:
29
+ * - Only use for data composed of primitives, arrays, and plain objects.
30
+ * - Functions, Dates, Maps/Sets, DOM nodes, and circular structures are not supported.
31
+ */
32
+ declare function deepCloneJSON<T>(value: T): T;
33
+ /**
34
+ * Decompose a column-major 4x4 matrix (16 numbers) back into
35
+ * position, rotation (Euler degrees), and scale Vec3 values.
36
+ *
37
+ * This is the inverse of `composeSRT`. It extracts:
38
+ * - Translation from the last column
39
+ * - Scale from the lengths of the first three column vectors
40
+ * - Rotation from the normalised upper-3x3 → Euler XYZ in degrees
41
+ */
42
+ declare function decomposeSRT(m: number[]): TransformValues;
43
+
44
+ export { composeSRT, decomposeSRT, deepCloneJSON, parseCornerRadius };
package/dist/utils.js ADDED
@@ -0,0 +1,86 @@
1
+ function parseBorderRadius(borderProperty, width) {
2
+ if (borderProperty === "") {
3
+ return 0;
4
+ }
5
+ if (borderProperty.endsWith("%")) {
6
+ return width * parseFloat(borderProperty) / 100;
7
+ }
8
+ return parseFloat(borderProperty);
9
+ }
10
+ function parseCornerRadius(computedStyle) {
11
+ const width = parseFloat(computedStyle.getPropertyValue("width"));
12
+ const topLeftPropertyValue = computedStyle.getPropertyValue(
13
+ "border-top-left-radius"
14
+ );
15
+ const topRightPropertyValue = computedStyle.getPropertyValue(
16
+ "border-top-right-radius"
17
+ );
18
+ const bottomLeftPropertyValue = computedStyle.getPropertyValue(
19
+ "border-bottom-left-radius"
20
+ );
21
+ const bottomRightPropertyValue = computedStyle.getPropertyValue(
22
+ "border-bottom-right-radius"
23
+ );
24
+ const cornerRadius = {
25
+ topLeading: parseBorderRadius(topLeftPropertyValue, width),
26
+ bottomLeading: parseBorderRadius(bottomLeftPropertyValue, width),
27
+ topTrailing: parseBorderRadius(topRightPropertyValue, width),
28
+ bottomTrailing: parseBorderRadius(bottomRightPropertyValue, width)
29
+ };
30
+ return cornerRadius;
31
+ }
32
+ function composeSRT(position, rotation, scale) {
33
+ const { x: px, y: py, z: pz } = position;
34
+ const { x: rx, y: ry, z: rz } = rotation;
35
+ const { x: sx, y: sy, z: sz } = scale;
36
+ let m = new DOMMatrix();
37
+ m = m.translate(px, py, pz);
38
+ m = m.rotate(rx, ry, rz);
39
+ m = m.scale(sx, sy, sz);
40
+ return m;
41
+ }
42
+ function deepCloneJSON(value) {
43
+ const sc = globalThis.structuredClone;
44
+ if (typeof sc === "function") {
45
+ try {
46
+ return sc(value);
47
+ } catch {
48
+ }
49
+ }
50
+ return JSON.parse(JSON.stringify(value));
51
+ }
52
+ function decomposeSRT(m) {
53
+ const position = { x: m[12], y: m[13], z: m[14] };
54
+ const sx = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);
55
+ const sy = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);
56
+ const sz = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);
57
+ const scale = { x: sx, y: sy, z: sz };
58
+ const r00 = sx !== 0 ? m[0] / sx : 0;
59
+ const r10 = sx !== 0 ? m[1] / sx : 0;
60
+ const r20 = sx !== 0 ? m[2] / sx : 0;
61
+ const r11 = sy !== 0 ? m[5] / sy : 0;
62
+ const r21 = sy !== 0 ? m[6] / sy : 0;
63
+ const r12 = sz !== 0 ? m[9] / sz : 0;
64
+ const r22 = sz !== 0 ? m[10] / sz : 0;
65
+ const RAD2DEG = 180 / Math.PI;
66
+ let rx, ry, rz;
67
+ const sinY = -r20;
68
+ const clampedSinY = Math.max(-1, Math.min(1, sinY));
69
+ ry = Math.asin(clampedSinY) * RAD2DEG;
70
+ if (Math.abs(sinY) < 0.9999999) {
71
+ rx = Math.atan2(r21, r22) * RAD2DEG;
72
+ rz = Math.atan2(r10, r00) * RAD2DEG;
73
+ } else {
74
+ rx = Math.atan2(-r12, r11) * RAD2DEG;
75
+ rz = 0;
76
+ }
77
+ const rotation = { x: rx, y: ry, z: rz };
78
+ return { position, rotation, scale };
79
+ }
80
+ export {
81
+ composeSRT,
82
+ decomposeSRT,
83
+ deepCloneJSON,
84
+ parseCornerRadius
85
+ };
86
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import { Vec3 } from './types/types'\nimport type { TransformValues } from './types/animation'\n\nfunction parseBorderRadius(borderProperty: string, width: number) {\n if (borderProperty === '') {\n return 0\n }\n if (borderProperty.endsWith('%')) {\n return (width * parseFloat(borderProperty)) / 100\n }\n return parseFloat(borderProperty)\n}\n\nexport function parseCornerRadius(computedStyle: CSSStyleDeclaration) {\n const width = parseFloat(computedStyle.getPropertyValue('width'))\n\n const topLeftPropertyValue = computedStyle.getPropertyValue(\n 'border-top-left-radius',\n )\n const topRightPropertyValue = computedStyle.getPropertyValue(\n 'border-top-right-radius',\n )\n const bottomLeftPropertyValue = computedStyle.getPropertyValue(\n 'border-bottom-left-radius',\n )\n const bottomRightPropertyValue = computedStyle.getPropertyValue(\n 'border-bottom-right-radius',\n )\n\n const cornerRadius = {\n topLeading: parseBorderRadius(topLeftPropertyValue, width),\n bottomLeading: parseBorderRadius(bottomLeftPropertyValue, width),\n topTrailing: parseBorderRadius(topRightPropertyValue, width),\n bottomTrailing: parseBorderRadius(bottomRightPropertyValue, width),\n }\n\n return cornerRadius\n}\n\n/**\n *\n * compose SRT matrix\n * @export\n * @param {Vec3} position meter\n * @param {Vec3} rotation degree\n * @param {Vec3} scale\n * @return {*} {DOMMatrix}\n */\nexport function composeSRT(position: Vec3, rotation: Vec3, scale: Vec3) {\n const { x: px, y: py, z: pz } = position\n const { x: rx, y: ry, z: rz } = rotation\n const { x: sx, y: sy, z: sz } = scale\n\n let m = new DOMMatrix()\n // https://drafts.fxtf.org/geometry/#immutable-transformation-methods\n // as these methods are post-multiplication, the order of transformations is reversed\n // we want SRT = T * R * S\n m = m.translate(px, py, pz)\n m = m.rotate(rx, ry, rz)\n m = m.scale(sx, sy, sz)\n return m\n}\n\n/**\n * Deep-clone a plain JSON-serializable object by value.\n *\n * Notes:\n * - Only use for data composed of primitives, arrays, and plain objects.\n * - Functions, Dates, Maps/Sets, DOM nodes, and circular structures are not supported.\n */\nexport function deepCloneJSON<T>(value: T): T {\n const sc = (globalThis as any).structuredClone as\n | ((v: any) => any)\n | undefined\n if (typeof sc === 'function') {\n try {\n return sc(value)\n } catch {\n // fall through to JSON method\n }\n }\n return JSON.parse(JSON.stringify(value))\n}\n\n/**\n * Decompose a column-major 4x4 matrix (16 numbers) back into\n * position, rotation (Euler degrees), and scale Vec3 values.\n *\n * This is the inverse of `composeSRT`. It extracts:\n * - Translation from the last column\n * - Scale from the lengths of the first three column vectors\n * - Rotation from the normalised upper-3x3 → Euler XYZ in degrees\n */\nexport function decomposeSRT(m: number[]): TransformValues {\n // Translation\n const position: Vec3 = { x: m[12], y: m[13], z: m[14] }\n\n // Scale — column vector lengths\n const sx = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2])\n const sy = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6])\n const sz = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10])\n const scale: Vec3 = { x: sx, y: sy, z: sz }\n\n // Normalise columns to get rotation matrix\n const r00 = sx !== 0 ? m[0] / sx : 0\n const r10 = sx !== 0 ? m[1] / sx : 0\n const r20 = sx !== 0 ? m[2] / sx : 0\n const r11 = sy !== 0 ? m[5] / sy : 0\n const r21 = sy !== 0 ? m[6] / sy : 0\n const r12 = sz !== 0 ? m[9] / sz : 0\n const r22 = sz !== 0 ? m[10] / sz : 0\n\n // DOMMatrix.rotate(rx, ry, rz) uses ZYX intrinsic order which maps to\n // extrinsic XYZ. The decomposition below extracts Euler angles that\n // match this convention.\n const RAD2DEG = 180 / Math.PI\n let rx: number, ry: number, rz: number\n\n // clamp to avoid NaN from asin\n const sinY = -r20\n const clampedSinY = Math.max(-1, Math.min(1, sinY))\n ry = Math.asin(clampedSinY) * RAD2DEG\n\n if (Math.abs(sinY) < 0.9999999) {\n rx = Math.atan2(r21, r22) * RAD2DEG\n rz = Math.atan2(r10, r00) * RAD2DEG\n } else {\n // Gimbal lock\n rx = Math.atan2(-r12, r11) * RAD2DEG\n rz = 0\n }\n\n const rotation: Vec3 = { x: rx, y: ry, z: rz }\n\n return { position, rotation, scale }\n}\n"],"mappings":"AAGA,SAAS,kBAAkB,gBAAwB,OAAe;AAChE,MAAI,mBAAmB,IAAI;AACzB,WAAO;AAAA,EACT;AACA,MAAI,eAAe,SAAS,GAAG,GAAG;AAChC,WAAQ,QAAQ,WAAW,cAAc,IAAK;AAAA,EAChD;AACA,SAAO,WAAW,cAAc;AAClC;AAEO,SAAS,kBAAkB,eAAoC;AACpE,QAAM,QAAQ,WAAW,cAAc,iBAAiB,OAAO,CAAC;AAEhE,QAAM,uBAAuB,cAAc;AAAA,IACzC;AAAA,EACF;AACA,QAAM,wBAAwB,cAAc;AAAA,IAC1C;AAAA,EACF;AACA,QAAM,0BAA0B,cAAc;AAAA,IAC5C;AAAA,EACF;AACA,QAAM,2BAA2B,cAAc;AAAA,IAC7C;AAAA,EACF;AAEA,QAAM,eAAe;AAAA,IACnB,YAAY,kBAAkB,sBAAsB,KAAK;AAAA,IACzD,eAAe,kBAAkB,yBAAyB,KAAK;AAAA,IAC/D,aAAa,kBAAkB,uBAAuB,KAAK;AAAA,IAC3D,gBAAgB,kBAAkB,0BAA0B,KAAK;AAAA,EACnE;AAEA,SAAO;AACT;AAWO,SAAS,WAAW,UAAgB,UAAgB,OAAa;AACtE,QAAM,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,IAAI;AAChC,QAAM,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,IAAI;AAChC,QAAM,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,IAAI;AAEhC,MAAI,IAAI,IAAI,UAAU;AAItB,MAAI,EAAE,UAAU,IAAI,IAAI,EAAE;AAC1B,MAAI,EAAE,OAAO,IAAI,IAAI,EAAE;AACvB,MAAI,EAAE,MAAM,IAAI,IAAI,EAAE;AACtB,SAAO;AACT;AASO,SAAS,cAAiB,OAAa;AAC5C,QAAM,KAAM,WAAmB;AAG/B,MAAI,OAAO,OAAO,YAAY;AAC5B,QAAI;AACF,aAAO,GAAG,KAAK;AAAA,IACjB,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AACzC;AAWO,SAAS,aAAa,GAA8B;AAEzD,QAAM,WAAiB,EAAE,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE;AAGtD,QAAM,KAAK,KAAK,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5D,QAAM,KAAK,KAAK,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5D,QAAM,KAAK,KAAK,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;AAC9D,QAAM,QAAc,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG;AAG1C,QAAM,MAAM,OAAO,IAAI,EAAE,CAAC,IAAI,KAAK;AACnC,QAAM,MAAM,OAAO,IAAI,EAAE,CAAC,IAAI,KAAK;AACnC,QAAM,MAAM,OAAO,IAAI,EAAE,CAAC,IAAI,KAAK;AACnC,QAAM,MAAM,OAAO,IAAI,EAAE,CAAC,IAAI,KAAK;AACnC,QAAM,MAAM,OAAO,IAAI,EAAE,CAAC,IAAI,KAAK;AACnC,QAAM,MAAM,OAAO,IAAI,EAAE,CAAC,IAAI,KAAK;AACnC,QAAM,MAAM,OAAO,IAAI,EAAE,EAAE,IAAI,KAAK;AAKpC,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,IAAY,IAAY;AAG5B,QAAM,OAAO,CAAC;AACd,QAAM,cAAc,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC;AAClD,OAAK,KAAK,KAAK,WAAW,IAAI;AAE9B,MAAI,KAAK,IAAI,IAAI,IAAI,WAAW;AAC9B,SAAK,KAAK,MAAM,KAAK,GAAG,IAAI;AAC5B,SAAK,KAAK,MAAM,KAAK,GAAG,IAAI;AAAA,EAC9B,OAAO;AAEL,SAAK,KAAK,MAAM,CAAC,KAAK,GAAG,IAAI;AAC7B,SAAK;AAAA,EACP;AAEA,QAAM,WAAiB,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG;AAE7C,SAAO,EAAE,UAAU,UAAU,MAAM;AACrC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webspatial/core-sdk",
3
- "version": "1.7.0",
3
+ "version": "2.0.0",
4
4
  "description": "this is the core js API for webspatial",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -9,10 +9,26 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
- }
12
+ },
13
+ "./runtime": {
14
+ "types": "./dist/runtime/index.d.ts",
15
+ "import": "./dist/runtime/index.js"
16
+ },
17
+ "./runtime/keys": {
18
+ "types": "./dist/runtime/keys.d.ts",
19
+ "import": "./dist/runtime/keys.js"
20
+ },
21
+ "./install-polyfills": {
22
+ "types": "./dist/install-polyfills.d.ts",
23
+ "import": "./dist/install-polyfills.js"
24
+ },
25
+ "./package.json": "./package.json"
13
26
  },
14
27
  "type": "module",
15
- "sideEffects": false,
28
+ "sideEffects": [
29
+ "./dist/install-polyfills.js",
30
+ "./src/install-polyfills.ts"
31
+ ],
16
32
  "repository": {
17
33
  "type": "git",
18
34
  "url": "git+https://github.com/webspatial/webspatial-sdk.git",
@@ -25,6 +41,7 @@
25
41
  },
26
42
  "homepage": "https://github.com/webspatial/webspatial-sdk#readme",
27
43
  "devDependencies": {
44
+ "happy-dom": "^20.9.0",
28
45
  "jsdom": "^26.1.0",
29
46
  "tsup": "^8.4.0",
30
47
  "typedoc": "^0.26.5",
@@ -38,7 +55,6 @@
38
55
  "test:w": "vitest",
39
56
  "build": "tsup",
40
57
  "start": "tsup --watch",
41
- "buildIife": "esbuild dist/index.js --outdir=dist/iife --minify --bundle --format=iife --global-name=webspatialCore",
42
58
  "format": "npx prettier --write 'src/**/*.ts' 'src/**/*.tsx' || true",
43
59
  "genDocs": "typedoc --plugin typedoc-plugin-markdown src/core/index.ts"
44
60
  }