@webspatial/core-sdk 1.0.4 → 1.1.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 (82) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +112 -81
  3. package/dist/iife/index.d.ts +683 -561
  4. package/dist/iife/index.global.js +3 -4
  5. package/dist/iife/index.global.js.map +1 -1
  6. package/dist/index.d.ts +683 -561
  7. package/dist/index.js +2193 -1291
  8. package/dist/index.js.map +1 -1
  9. package/package.json +7 -4
  10. package/src/JSBCommand.ts +631 -0
  11. package/src/Spatial.ts +68 -0
  12. package/src/SpatialObject.ts +46 -0
  13. package/src/SpatialScene.ts +75 -0
  14. package/src/SpatialSession.ts +187 -0
  15. package/src/SpatialWebEvent.ts +23 -0
  16. package/src/SpatialWebEventCreator.ts +12 -0
  17. package/src/Spatialized2DElement.ts +51 -0
  18. package/src/SpatializedDynamic3DElement.ts +30 -0
  19. package/src/SpatializedElement.ts +331 -0
  20. package/src/SpatializedElementCreator.ts +45 -0
  21. package/src/SpatializedStatic3DElement.ts +111 -0
  22. package/src/WebMsgCommand.ts +88 -0
  23. package/src/index.ts +23 -1
  24. package/src/platform-adapter/CommandResultUtils.ts +22 -0
  25. package/src/platform-adapter/android/AndroidPlatform.ts +133 -0
  26. package/src/platform-adapter/index.ts +21 -0
  27. package/src/platform-adapter/interface.ts +36 -0
  28. package/src/platform-adapter/ssr/SSRPlatform.ts +43 -0
  29. package/src/platform-adapter/vision-os/VisionOSPlatform.ts +77 -0
  30. package/src/reality/component/ModelComponent.ts +11 -0
  31. package/src/reality/component/SpatialComponent.ts +17 -0
  32. package/src/reality/component/index.ts +2 -0
  33. package/src/reality/entity/SpatialEntity.ts +259 -0
  34. package/src/reality/entity/SpatialModelEntity.ts +15 -0
  35. package/src/reality/entity/index.ts +2 -0
  36. package/src/reality/geometry/SpatialBoxGeometry.ts +12 -0
  37. package/src/reality/geometry/SpatialConeGeometry.ts +15 -0
  38. package/src/reality/geometry/SpatialCylinderGeometry.ts +15 -0
  39. package/src/reality/geometry/SpatialGeometry.ts +12 -0
  40. package/src/reality/geometry/SpatialPlaneGeometry.ts +15 -0
  41. package/src/reality/geometry/SpatialSphereGeometry.ts +15 -0
  42. package/src/reality/geometry/index.ts +6 -0
  43. package/src/reality/index.ts +5 -0
  44. package/src/reality/material/SpatialMaterial.ts +14 -0
  45. package/src/reality/material/SpatialUnlitMaterial.ts +16 -0
  46. package/src/reality/material/index.ts +2 -0
  47. package/src/reality/realityCreator.ts +94 -0
  48. package/src/reality/resource/SpatialModelAsset.ts +11 -0
  49. package/src/reality/resource/index.ts +1 -0
  50. package/src/scene-polyfill.test.ts +376 -0
  51. package/src/scene-polyfill.ts +379 -0
  52. package/src/spatial-window-polyfill.ts +182 -0
  53. package/src/ssr-polyfill.ts +3 -0
  54. package/src/types/global.d.ts +33 -1
  55. package/src/types/internal.ts +13 -0
  56. package/src/types/types.ts +380 -0
  57. package/src/utils.ts +61 -0
  58. package/tsconfig.json +1 -1
  59. package/vitest.config.ts +8 -0
  60. package/src/core/Spatial.ts +0 -50
  61. package/src/core/SpatialEntity.ts +0 -147
  62. package/src/core/SpatialHelper.ts +0 -230
  63. package/src/core/SpatialObject.ts +0 -26
  64. package/src/core/SpatialSession.ts +0 -457
  65. package/src/core/SpatialTransform.ts +0 -26
  66. package/src/core/SpatialWindowContainer.ts +0 -59
  67. package/src/core/component/EventSpatialComponent.ts +0 -32
  68. package/src/core/component/SpatialComponent.ts +0 -26
  69. package/src/core/component/SpatialInputComponent.ts +0 -24
  70. package/src/core/component/SpatialModel3DComponent.ts +0 -223
  71. package/src/core/component/SpatialModelComponent.ts +0 -39
  72. package/src/core/component/SpatialViewComponent.ts +0 -32
  73. package/src/core/component/SpatialWindowComponent.ts +0 -177
  74. package/src/core/component/index.ts +0 -14
  75. package/src/core/index.ts +0 -10
  76. package/src/core/private/WebSpatial.ts +0 -383
  77. package/src/core/private/remote-command/RemoteCommand.ts +0 -15
  78. package/src/core/private/remote-command/index.ts +0 -1
  79. package/src/core/resource/SpatialMeshResource.ts +0 -6
  80. package/src/core/resource/SpatialPhysicallyBasedMaterialResource.ts +0 -42
  81. package/src/core/resource/index.ts +0 -2
  82. package/src/core/types.ts +0 -32
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/core/private/remote-command/RemoteCommand.ts","../../src/core/private/WebSpatial.ts","../../src/core/SpatialObject.ts","../../src/core/SpatialTransform.ts","../../src/core/SpatialEntity.ts","../../src/core/component/SpatialComponent.ts","../../src/core/SpatialWindowContainer.ts","../../src/core/resource/SpatialMeshResource.ts","../../src/core/resource/SpatialPhysicallyBasedMaterialResource.ts","../../src/core/SpatialSession.ts","../../src/core/Spatial.ts","../../src/core/SpatialHelper.ts","../../src/core/component/SpatialWindowComponent.ts","../../src/core/component/EventSpatialComponent.ts","../../src/core/component/SpatialInputComponent.ts","../../src/core/component/SpatialModelComponent.ts","../../src/core/component/SpatialViewComponent.ts","../../src/core/component/SpatialModel3DComponent.ts"],"sourcesContent":["export * from './core/index'\n","export class RemoteCommand {\n private static requestCounter = 0\n\n command: string\n\n data: any\n\n requestID: number\n\n constructor(cmd: string, data?: any) {\n this.command = cmd\n this.data = data\n this.requestID = ++RemoteCommand.requestCounter\n }\n}\n","import { RemoteCommand } from './remote-command'\nimport {\n WindowStyle,\n WindowContainerOptions,\n LoadingMethodKind,\n sceneDataShape,\n sceneDataJSBShape,\n} from '../types'\n\ndeclare global {\n interface Window {\n // Location for webspatial custom functions\n __WebSpatialData: {\n androidNativeMessage: Function\n getNativeVersion: Function\n }\n\n // Location for webspatial internal callbacks (eg. completion events)\n __SpatialWebEvent: Function\n\n // Used to access webkit specific api\n webkit: any\n\n // Marks the page as unloaded so it doesn't send additional events\n __WebSpatialUnloaded: boolean\n\n // Internal id information mapping to internal state about the native window\n _webSpatialID: string\n _webSpatialGroupID: string\n _webSpatialParentGroupID: string\n\n // Will be removed in favor of __WebSpatialData\n WebSpatailNativeVersion: string\n }\n}\n\nexport class WindowContainer {\n id = ''\n}\n\nexport class WebSpatialResource {\n id = ''\n windowContainerId = ''\n data = {} as any\n\n receiveEvent() {}\n}\n\nexport class WebSpatial {\n public static eventPromises: any = {}\n\n public static transactionStarted = false\n public static transactionCommands = Array<RemoteCommand>()\n\n // store event receivers\n private static eventReceivers: { [resourceId: string]: (data: any) => void } =\n {}\n\n public static registerEventReceiver(\n resourceId: string,\n callback: (data: any) => void,\n ) {\n this.eventReceivers[resourceId] = callback\n }\n\n public static unregisterEventReceiver(resourceId: string) {\n delete this.eventReceivers[resourceId]\n }\n\n static init() {\n window.__SpatialWebEvent = (e: any) => {\n if (e.resourceId) {\n var callback = WebSpatial.eventReceivers[e.resourceId]\n callback(e.data)\n } else {\n var p = WebSpatial.eventPromises[e.requestID]\n if (p) {\n if (e.success) {\n p.res(e)\n } else {\n p.rej(e)\n }\n }\n }\n }\n }\n\n static startTransaction() {\n WebSpatial.transactionStarted = true\n WebSpatial.transactionCommands = []\n }\n\n static async sendTransaction() {\n WebSpatial.transactionStarted = false\n var cmd = new RemoteCommand('multiCommand', {\n commandList: WebSpatial.transactionCommands,\n })\n\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n return result\n }\n\n static getBackend() {\n if (window.webkit) {\n return 'AVP'\n } else {\n return 'UNKNOWN'\n }\n }\n\n static async sendCommand(cmd: RemoteCommand) {\n if (window.__WebSpatialUnloaded) {\n return\n }\n if (WebSpatial.transactionStarted) {\n WebSpatial.transactionCommands.push(cmd as any)\n return\n }\n\n var msg = JSON.stringify(cmd)\n\n if (WebSpatial.getBackend() == 'AVP') {\n window.webkit.messageHandlers.bridge.postMessage(msg)\n return\n } else {\n window.__WebSpatialData.androidNativeMessage(msg)\n return\n }\n }\n\n static getImmersiveWindowContainer() {\n var wg = new WindowContainer()\n wg.id = 'Immersive'\n return wg\n }\n\n static getCurrentWindowContainer() {\n var wg = new WindowContainer()\n wg.id = 'current'\n return wg\n }\n\n static getCurrentWebPanel() {\n var wg = new WebSpatialResource()\n wg.id = 'current'\n wg.windowContainerId = WebSpatial.getCurrentWindowContainer().id\n return wg\n }\n\n static async createScene(\n style: WindowStyle = 'Plain',\n cfg: {\n sceneData: sceneDataShape\n },\n ) {\n const { window: newWindow, ...sceneData } = cfg.sceneData\n const jsbSceneData: sceneDataJSBShape = {\n ...sceneData,\n windowID: newWindow._webSpatialID,\n windowContainerID: newWindow._webSpatialGroupID,\n }\n var cmd = new RemoteCommand('createScene', {\n windowStyle: style,\n sceneData: jsbSceneData,\n windowContainerID: window._webSpatialParentGroupID, // parent WindowContainerID\n })\n\n try {\n await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n return true\n } catch (error) {\n return false\n }\n }\n\n static async createWindowContainer(\n style: WindowStyle = 'Plain',\n windowContainer: WindowContainer | null,\n parentWebView: WebSpatialResource | null,\n ) {\n var cmd = new RemoteCommand('createWindowContainer', {\n windowStyle: style,\n windowContainerID: windowContainer ? windowContainer.id : undefined,\n resourceID: parentWebView ? parentWebView.id : undefined,\n })\n\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n var res = new WindowContainer()\n res.id = (result as any).data.createdID\n return res\n }\n\n static async destroyResource(resource: WebSpatialResource) {\n const data = {}\n var cmd = new RemoteCommand('destroyResource', {\n windowContainerID: resource.windowContainerId,\n resourceID: resource.id,\n })\n\n WebSpatial.sendCommand(cmd)\n }\n\n static async ping(msg: string) {\n var cmd = new RemoteCommand('ping', {\n windowContainerID: this.getCurrentWindowContainer().id,\n resourceID: this.getCurrentWebPanel().id,\n message: msg,\n })\n\n if (WebSpatial.transactionStarted) {\n WebSpatial.sendCommand(cmd)\n return null\n } else {\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n return result\n }\n }\n\n static async getStats() {\n var cmd = new RemoteCommand('getStats', {\n windowContainerID: this.getCurrentWindowContainer().id,\n resourceID: this.getCurrentWebPanel().id,\n })\n\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n return (result as any).data\n }\n\n static async inspect(spatialObjectId: string) {\n var cmd = new RemoteCommand('inspect', {\n resourceID: spatialObjectId,\n })\n\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n\n return (result as any).data\n }\n\n static async inspectRootWindowContainer() {\n return this.inspect('root')\n }\n\n static async setComponent(\n entity: WebSpatialResource,\n resource: WebSpatialResource,\n ) {\n var cmd = new RemoteCommand('setComponent', {\n windowContainerID: entity.windowContainerId,\n resourceID: resource.id,\n entityID: entity.id,\n })\n\n WebSpatial.sendCommand(cmd)\n }\n\n static async removeComponent(\n entity: WebSpatialResource,\n resource: WebSpatialResource,\n ) {\n var cmd = new RemoteCommand('removeComponent', {\n windowContainerID: entity.windowContainerId,\n resourceID: resource.id,\n entityID: entity.id,\n })\n\n WebSpatial.sendCommand(cmd)\n }\n\n // windowContainer is the group the resource will be tied to (if not provided it will use the current window grou)\n // parentWebView is the SpatialWebView that the resource will be tied to (if not provided, resource will continue to exist even if this page is unloaded)\n static async createResource(\n type: string,\n windowContainer: WindowContainer | null,\n parentWebView: WebSpatialResource | null,\n params = {} as any,\n ) {\n var cmd = new RemoteCommand('createResource', {\n windowContainerID: windowContainer ? windowContainer.id : undefined,\n resourceID: parentWebView ? parentWebView.id : undefined,\n type: type,\n params: params,\n })\n\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n var res = new WebSpatialResource()\n res.id = (result as any).data.createdID\n res.windowContainerId = cmd.data.windowContainerID\n return res\n }\n\n static async updateWindowContainer(wg: WindowContainer, data: any) {\n var cmd = new RemoteCommand('updateWindowContainer', {\n windowContainerID: wg.id,\n update: data,\n })\n\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n return result\n }\n\n static async updateResource(resource: WebSpatialResource, data: any = null) {\n var cmd = new RemoteCommand('updateResource', {\n windowContainerID: resource.windowContainerId,\n resourceID: resource.id,\n update: data || resource.data,\n })\n\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n return result\n }\n\n static async setLoading(method: LoadingMethodKind, style?: string) {\n var cmd = new RemoteCommand('setLoading', {\n windowContainerID: window._webSpatialParentGroupID, // parent WindowContainerID\n loading: {\n method,\n style,\n },\n })\n\n var result = await new Promise((res, rej) => {\n WebSpatial.eventPromises[cmd.requestID] = { res: res, rej: rej }\n WebSpatial.sendCommand(cmd)\n })\n return result\n }\n\n static async openImmersiveSpace() {\n var cmd = new RemoteCommand('openImmersiveSpace')\n await WebSpatial.sendCommand(cmd)\n }\n\n static async dismissImmersiveSpace() {\n var cmd = new RemoteCommand('dismissImmersiveSpace')\n await WebSpatial.sendCommand(cmd)\n }\n\n static onFrame(fn: (curTime: number) => Promise<any>) {\n var dt = 0\n var loop = async () => {\n var curTime = window.performance.now()\n await fn(curTime)\n var updateTime = window.performance.now() - curTime\n\n // Call update loop targetting 60 fps\n setTimeout(\n () => {\n loop()\n },\n Math.max(1000 / 60 - updateTime, 0),\n )\n }\n loop()\n }\n}\nWebSpatial.init()\n","import { WebSpatial } from './private/WebSpatial'\nimport { WebSpatialResource } from './private/WebSpatial'\n\n/**\n * @hidden\n * Parent class of spatial objects, should not be used directly\n */\nexport class SpatialObject {\n /** @hidden */\n constructor(\n /** @hidden */\n public _resource: WebSpatialResource,\n ) {}\n\n /**\n * Marks resource to be released (it should no longer be used)\n */\n async destroy() {\n await WebSpatial.destroyResource(this._resource)\n await this.onDestroy()\n }\n\n public name: string = ''\n\n protected async onDestroy() {}\n}\n","export class Vec3 {\n constructor(\n public x = 0,\n public y = 0,\n public z = 0,\n ) {}\n}\n\nexport class Vec4 {\n constructor(\n public x = 0,\n public y = 0,\n public z = 0,\n public w = 1,\n ) {}\n}\n\n/**\n * Transform containing position, orientation and scale\n */\nexport class SpatialTransform {\n position = new Vec3(0, 0, 0)\n /** Quaternion value for x,y,z,w */\n orientation = new Vec4(0, 0, 0, 1)\n scale = new Vec3(1, 1, 1)\n}\n","import { SpatialObject } from './SpatialObject'\nimport { SpatialTransform } from './SpatialTransform'\nimport { SpatialWindowContainer } from './SpatialWindowContainer'\nimport { WebSpatial } from './private/WebSpatial'\nimport { SpatialComponent } from './component'\n\n/**\n * Entity used to describe an object that can be added to the scene\n */\nexport class SpatialEntity extends SpatialObject {\n /**\n * Transform corresponding to the entity\n * note: updateTransform must be called for transform to be synced to rendering\n */\n transform = new SpatialTransform()\n\n /** @hidden */\n private _destroyed = false\n /** @hidden */\n private get _entity() {\n return this._resource\n }\n\n /**\n * Syncs the transform with the renderer, must be called to observe updates\n */\n async updateTransform() {\n await WebSpatial.updateResource(this._entity, this.transform)\n }\n\n /**\n * Syncs the zIndex with the renderer\n */\n async updateZIndex(zIndex: number) {\n await WebSpatial.updateResource(this._entity, { zIndex })\n }\n\n private components: Map<Function, SpatialComponent> = new Map()\n\n /**\n * Attaches a component to the entity to be displayed\n * [TODO] review pass by value vs ref and ownership model for this\n */\n async setComponent(component: SpatialComponent) {\n await WebSpatial.setComponent(this._entity, component._resource)\n this.components.set(component.constructor, component)\n }\n\n /**\n * Removes a component from the entity\n */\n async removeComponent<T extends SpatialComponent>(\n type: new (...args: any[]) => T,\n ) {\n var c = this.getComponent(type)\n if (c != undefined) {\n await WebSpatial.removeComponent(this._entity, c._resource)\n this.components.delete(c.constructor)\n }\n }\n\n /**\n * Gets a component from the entity\n */\n getComponent<T extends SpatialComponent>(\n type: new (...args: any[]) => T,\n ): T | undefined {\n return this.components.get(type) as T | undefined\n }\n\n /**\n * @hidden\n * Sets the window container that this entity should be rendered by (this does not effect resource ownership)\n * @param wg the window container that should render this entity\n */\n async _setParentWindowContainer(wg: SpatialWindowContainer) {\n await WebSpatial.updateResource(this._entity, {\n setParentWindowContainerID: wg._wg.id,\n })\n }\n\n /**\n * Sets a parent entity, if that entity or its parents are attached to a window container, this entity will be displayed\n * @param e parent entity or null to remove current parent\n */\n async setParent(e: SpatialEntity | null) {\n await WebSpatial.updateResource(this._entity, {\n setParent: e ? e._entity.id : '',\n })\n }\n\n /**\n * Sets the coordinate space of this entity (Default: App)\n * \"App\" = game engine style coordinates in meters\n * \"Dom\" = Windowing coordinates in dom units (eg. 0,0,0 is top left of window)\n * \"Root\" = Coordinate space is ignored and content is displayed and updated as window container's root object, window containers can only have one root entity\n * [TODO] review this api\n * @param space coordinate space mode\n */\n async setCoordinateSpace(space: 'App' | 'Dom' | 'Root') {\n await WebSpatial.updateResource(this._entity, { setCoordinateSpace: space })\n }\n\n /**\n * Query the 3d boudning box of the entity\n * @returns The bounding box of the entity\n */\n async getBoundingBox() {\n var res: any = await WebSpatial.updateResource(this._entity, {\n getBoundingBox: true,\n })\n return res.data as {\n center: { x: number; y: number; z: number }\n extents: { x: number; y: number; z: number }\n }\n }\n\n /**\n * Sets if the entity should be visible (default: True)\n * @param visible\n */\n async setVisible(visible: boolean) {\n await WebSpatial.updateResource(this._entity, { visible })\n }\n\n /**\n * Removes a reference to the entity by the renderer and this object should no longer be used. [TODO] Attached components will not be destroyed\n */\n async destroy() {\n this._destroyed = true\n await WebSpatial.destroyResource(this._entity)\n }\n\n /**\n * Check if destroy has been called\n */\n isDestroyed() {\n return this._destroyed\n }\n\n // Set Entity name. Currently for debugging only.\n /** @hidden */\n async _setName(name: string) {\n this.name = name\n return WebSpatial.updateResource(this._entity, { name })\n }\n}\n","import { WebSpatial, WebSpatialResource } from '../private/WebSpatial'\nimport { SpatialEntity } from '../SpatialEntity'\nimport { SpatialObject } from '../SpatialObject'\n\n/** @hidden */\nexport class SpatialComponent extends SpatialObject {\n /**\n * Gets the entity this component is attached to\n * @returns entity or null\n */\n async getEntity() {\n let reqResp: any = await WebSpatial.updateResource(\n WebSpatial.getCurrentWebPanel(),\n { getEntityID: '' },\n )\n if (reqResp.data.parentID === '') {\n return new Promise<SpatialEntity | null>((res, rej) => {\n res(null)\n })\n } else {\n var res = new WebSpatialResource()\n res.id = reqResp.data.parentID\n return new SpatialEntity(res)\n }\n }\n}\n","import {\n WebSpatial,\n WebSpatialResource,\n WindowContainer,\n} from './private/WebSpatial'\nimport { SpatialEntity } from './SpatialEntity'\n\n/**\n * Anchored window managed by the OS\n */\nexport class SpatialWindowContainer {\n /** @hidden */\n constructor(\n /** @hidden */\n public _wg: WindowContainer,\n ) {}\n /**\n * @hidden\n * Sets sets the open configuration for opening new window containers\n * @param options style options\n */\n async _setOpenSettings(options: {\n resolution: { width: number; height: number }\n }) {\n await WebSpatial.updateWindowContainer(this._wg, {\n nextOpenSettings: options,\n })\n }\n\n /**\n * Retrieves the root entity of the windowContainer\n * @returns the root entity of the windowContainer if one exists\n */\n async getRootEntity() {\n let reqResp: any = await WebSpatial.updateWindowContainer(this._wg, {\n getRootEntityID: '',\n })\n if (reqResp.data.rootEntId === '') {\n return null\n } else {\n var res = new WebSpatialResource()\n res.id = reqResp.data.rootEntId\n return new SpatialEntity(res)\n }\n }\n /*\n * Sets the root entity that this windowContainer will display (this does not effect resource ownership)\n * @param entity to display\n */\n async setRootEntity(entity: SpatialEntity) {\n await entity._setParentWindowContainer(this)\n }\n\n async close() {\n await WebSpatial.updateWindowContainer(this._wg, {\n close: true,\n })\n }\n}\n","import { SpatialObject } from '../SpatialObject'\n\n/**\n * Mesh asset containing geometry\n */\nexport class SpatialMeshResource extends SpatialObject {}\n","import { SpatialModelComponent } from '../component'\nimport { WebSpatial } from '../private/WebSpatial'\nimport { SpatialObject } from '../SpatialObject'\n\n/**\n * PBR material which can be set on a SpatialModelComponent\n */\nexport class SpatialPhysicallyBasedMaterialResource extends SpatialObject {\n /**\n * Base color of the material containing rgba between 0 and 1\n */\n baseColor = { r: 0.0, g: 0.7, b: 0.7, a: 1.0 }\n /**\n * PBR metalic value between 0 and 1\n */\n metallic = { value: 0.5 }\n /**\n * PBR roughness value between 0 and 1\n */\n roughness = { value: 0.5 }\n\n _modelComponentAttachedTo: { [key: string]: SpatialModelComponent } = {}\n _addToComponent(c: SpatialModelComponent) {\n this._modelComponentAttachedTo[c._resource.id] = c\n }\n\n /**\n * Syncs state of color, metallic, roupghness to the renderer\n */\n async update() {\n await WebSpatial.updateResource(this._resource, {\n baseColor: this.baseColor,\n metallic: this.metallic,\n roughness: this.roughness,\n })\n\n // Since realitykit's materials are structs and not references, every time we change a material, we must copy it to all of the components its attached to to observe the update\n for (var key in this._modelComponentAttachedTo) {\n await this._modelComponentAttachedTo[key]._syncMaterials()\n }\n }\n}\n","import { SpatialEntity } from './SpatialEntity'\nimport { SpatialWindowContainer } from './SpatialWindowContainer'\nimport {\n WebSpatial,\n WebSpatialResource,\n WindowContainer,\n} from './private/WebSpatial'\nimport {\n LoadingMethodKind,\n sceneDataShape,\n WindowContainerOptions,\n WindowStyle,\n} from './types'\n\nimport {\n SpatialMeshResource,\n SpatialPhysicallyBasedMaterialResource,\n} from './resource'\nimport {\n SpatialModelComponent,\n SpatialInputComponent,\n SpatialWindowComponent,\n SpatialViewComponent,\n SpatialModel3DComponent,\n} from './component'\nimport { RemoteCommand } from './private/remote-command'\n\ntype CreateResourceOptions = {\n windowContainer?: SpatialWindowContainer | null\n windowComponent?: SpatialWindowComponent | null\n}\n\n/**\n * Animation callback with timestamp\n */\ntype animCallback = (time: DOMHighResTimeStamp) => Promise<any>\n\n/**\n * Parses the resource owners of the created object. If unedfined, will use the current window container and web panel. If null the created resource will not be destroyed unless explicitly destroyed.\n * @param options\n * @returns parsed results\n */\nfunction _parseParentResources(\n options?: CreateResourceOptions,\n): [WindowContainer | null, WebSpatialResource | null] {\n var parentWindowContainer: WindowContainer | null = null\n if (options?.windowContainer !== null) {\n parentWindowContainer = options?.windowContainer\n ? options?.windowContainer._wg\n : WebSpatial.getCurrentWindowContainer()\n }\n\n var parentWindow: WebSpatialResource | null = null\n if (options?.windowComponent !== null) {\n parentWindow = options?.windowComponent\n ? options?.windowComponent._resource\n : WebSpatial.getCurrentWebPanel()\n }\n\n return [parentWindowContainer, parentWindow]\n}\n\n/**\n * Session use to establish a connection to the spatial renderer of the system. All resources must be created by the session\n */\nexport class SpatialSession {\n /** @hidden */\n _engineUpdateListeners = Array<animCallback>()\n /** @hidden */\n _frameLoopStarted = false\n\n /**\n * Add event listener callback to be called each frame\n * @param callback callback to be called each update\n */\n addOnEngineUpdateEventListener(callback: animCallback) {\n this._engineUpdateListeners.push(callback)\n\n if (!this._frameLoopStarted) {\n this._frameLoopStarted = true\n WebSpatial.onFrame(async (time: number) => {\n await Promise.all(\n this._engineUpdateListeners.map(cb => {\n return cb(time)\n }),\n )\n })\n }\n }\n\n /**\n * Creates a Entity\n * @returns Entity\n */\n async createEntity(options?: CreateResourceOptions) {\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n let entity = await WebSpatial.createResource(\n 'Entity',\n parentWindowContainer,\n parentWindow,\n )\n return new SpatialEntity(entity)\n }\n\n /**\n * Creates a WindowComponent\n * [TODO] should creation of components be moved to entity? and these made private?\n * @returns WindowComponent\n */\n async createWindowComponent(options?: CreateResourceOptions) {\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n let entity = await WebSpatial.createResource(\n 'SpatialWebView',\n parentWindowContainer,\n parentWindow,\n )\n return new SpatialWindowComponent(entity)\n }\n\n /**\n * Creates a ViewComponent used to display 3D content within the entity\n * @returns SpatialViewComponent\n */\n async createViewComponent(options?: CreateResourceOptions) {\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n let entity = await WebSpatial.createResource(\n 'SpatialView',\n parentWindowContainer,\n parentWindow,\n )\n return new SpatialViewComponent(entity)\n }\n\n /**\n * Creates a ModelComponent used to display geometry + material of a 3D model\n * @returns ModelComponent\n */\n async createModelComponent(\n options?: { url: string } & CreateResourceOptions,\n ) {\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n var opts = undefined\n if (options) {\n opts = { modelURL: options.url }\n }\n let entity = await WebSpatial.createResource(\n 'ModelComponent',\n parentWindowContainer,\n parentWindow,\n opts,\n )\n return new SpatialModelComponent(entity)\n }\n\n /**\n * Creates a Model3DComponent\n * @returns Model3DComponent\n */\n async createModel3DComponent(\n options?: { url: string } & CreateResourceOptions,\n ) {\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n var opts = undefined\n if (options) {\n opts = { modelURL: options.url }\n }\n let entity = await WebSpatial.createResource(\n 'Model3DComponent',\n parentWindowContainer,\n parentWindow,\n opts,\n )\n return new SpatialModel3DComponent(entity)\n }\n\n /**\n * Creates a InputComponent\n * [Experimental] Creates a InputComponent used to handle click and drag events of the entity containing a model\n * @returns InputComponent\n */\n async createInputComponent(options?: CreateResourceOptions) {\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n let entity = await WebSpatial.createResource(\n 'InputComponent',\n parentWindowContainer,\n parentWindow,\n )\n return new SpatialInputComponent(entity)\n }\n\n /**\n * Creates a MeshResource containing geometry data\n * @returns MeshResource\n */\n async createMeshResource(\n options?: { shape?: string } & CreateResourceOptions,\n ) {\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n let entity = await WebSpatial.createResource(\n 'MeshResource',\n parentWindowContainer,\n parentWindow,\n options,\n )\n return new SpatialMeshResource(entity)\n }\n\n /**\n * Creates a PhysicallyBasedMaterial containing PBR material data\n * @returns PhysicallyBasedMaterial\n */\n async createPhysicallyBasedMaterialResource(\n options?: {} & CreateResourceOptions,\n ) {\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n let entity = await WebSpatial.createResource(\n 'PhysicallyBasedMaterial',\n parentWindowContainer,\n parentWindow,\n options,\n )\n return new SpatialPhysicallyBasedMaterialResource(entity)\n }\n /**\n * Creates a WindowContainer\n * @returns SpatialWindowContainer\n * */\n async createWindowContainer(\n options?: {\n style: WindowStyle\n } & CreateResourceOptions,\n ) {\n var style = options?.style ? options?.style : 'Plain'\n var [parentWindowContainer, parentWindow] = _parseParentResources(options)\n return new SpatialWindowContainer(\n await WebSpatial.createWindowContainer(\n style,\n parentWindowContainer,\n parentWindow,\n ),\n )\n }\n\n /**\n * Creates a Scene to display content within an anchored area managed by the OS\n * @hidden\n * @param {WindowStyle} [style='Plain'] - The style of the Scene container to be created with. Defaults to 'Plain'.\n * @param {Object} [cfg={}] - Configuration object for the Scene.\n * @returns Boolean\n */\n async _createScene(\n style: WindowStyle = 'Plain',\n cfg: {\n sceneData: sceneDataShape\n },\n ) {\n return await WebSpatial.createScene(style, cfg)\n }\n\n /**\n * Retrieves the window for this page\n * @returns the window component corresponding to the js running on this page\n * [TODO] discuss implications of this not being async\n */\n getCurrentWindowComponent() {\n return new SpatialWindowComponent(WebSpatial.getCurrentWebPanel())\n }\n\n /**\n * Retrieves the parent window for this page or null if this is the root page\n * @returns the window component or null\n */\n async getParentWindowComponent() {\n let parentResp: any = await WebSpatial.updateResource(\n WebSpatial.getCurrentWebPanel(),\n { getParentID: '' },\n )\n if (parentResp.data.parentID === '') {\n return new Promise<SpatialWindowComponent | null>((res, rej) => {\n res(null)\n })\n } else {\n var res = new WebSpatialResource()\n res.id = parentResp.data.parentID\n return new SpatialWindowComponent(res)\n }\n }\n\n /**\n * Logs a message to the native apps console\n * @param msg mesage to log\n */\n async log(...msg: any[]) {\n await WebSpatial.sendCommand(\n new RemoteCommand('log', {\n logString: msg.map(x => {\n return JSON.stringify(x)\n }),\n }),\n )\n }\n\n /**\n * @hidden\n * Debugging only, used to ping the native renderer\n */\n async _ping(msg: string) {\n return await WebSpatial.ping(msg)\n }\n\n /**\n * @hidden\n * Debugging to get internal state from native code\n * @returns stats from native code. Objects tracks number of native objects that were created but not yet explicitly destroyed. RefObjects tracks bjects that still have references. After an object is destroyed, we should be cleaning up all of the native references. Expect objects.count == refObjects.count , if not, there is likely a leak.\n */\n async _getStats() {\n return (await WebSpatial.getStats()) as {\n backend: string\n objects: { count: number }\n refObjects: { count: number }\n }\n }\n\n /**\n * @hidden\n */\n async _inspect(spatialObjectId: string = WebSpatial.getCurrentWebPanel().id) {\n return WebSpatial.inspect(spatialObjectId)\n }\n\n /**\n * @hidden\n */\n async _inspectRootWindowContainer() {\n return WebSpatial.inspectRootWindowContainer()\n }\n\n /** Opens the immersive space */\n async openImmersiveSpace() {\n return await WebSpatial.openImmersiveSpace()\n }\n\n /** Closes the immersive space */\n async dismissImmersiveSpace() {\n return await WebSpatial.dismissImmersiveSpace()\n }\n\n private static _immersiveWindowContainer =\n null as null | SpatialWindowContainer\n /**\n * Retreives the window container corresponding to the Immersive space\n * @returns the immersive window container\n */\n async getImmersiveWindowContainer() {\n if (SpatialSession._immersiveWindowContainer) {\n return SpatialSession._immersiveWindowContainer\n } else {\n SpatialSession._immersiveWindowContainer = new SpatialWindowContainer(\n WebSpatial.getImmersiveWindowContainer(),\n )\n return SpatialSession._immersiveWindowContainer\n }\n }\n\n // Retreives the window container that is the parent to this spatial web page\n private static _currentWindowContainer = null as null | SpatialWindowContainer\n\n /**\n * Gets the current window container for the window\n * [TODO] discuss what happens if it doesnt yet have a window container\n * @returns the current window container for the window\n */\n getCurrentWindowContainer() {\n if (SpatialSession._currentWindowContainer) {\n return SpatialSession._currentWindowContainer\n } else {\n SpatialSession._currentWindowContainer = new SpatialWindowContainer(\n WebSpatial.getCurrentWindowContainer(),\n )\n return SpatialSession._currentWindowContainer\n }\n }\n\n /**\n * Start a transaction that queues up commands to submit them all at once to reduce ipc overhead\n * @param fn function to be run, within this function, promises will not resolve\n * @returns promise for the entire transaction completion\n */\n transaction(fn: Function) {\n WebSpatial.startTransaction()\n fn()\n return WebSpatial.sendTransaction()\n }\n\n /**\n * Creates a window context object that is compatable with SpatialWindowComponent's setFromWindow API\n * @returns window context\n */\n async createWindowContext() {\n let openedWindow = window.open('webspatial://createWindowContext')\n if (WebSpatial.getBackend() != 'AVP') {\n // Currently there is a bug with webview which requires us to trigger a navigation before native code can interact with created webview\n var counter = 0\n while ((openedWindow!.window as any).testAPI == null) {\n if (counter > 15) {\n openedWindow?.close()\n openedWindow = window.open('about:blank')\n counter = 0\n this.log('unexpected error when trying to open new window, retrying.')\n }\n var locName = 'about:blank?x' + counter\n openedWindow!!.location.href = locName\n counter++\n\n await new Promise(resolve => setTimeout(resolve, 10))\n }\n ;(openedWindow! as any)._webSpatialID = (\n openedWindow!.window as any\n ).testAPI.getWindowID()\n } else {\n while ((openedWindow!.window as any)._webSpatialID == undefined) {\n await new Promise(resolve => setTimeout(resolve, 10))\n }\n }\n openedWindow!.document.head.innerHTML = `<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <base href=\"${document.baseURI}\">\n `\n return openedWindow\n }\n\n // Get Entity by id. Currently for debugging only.\n /** @hidden */\n async _getEntity(id: string) {\n const entityInfo = await WebSpatial.inspect(id)\n const [_, x, y, z] = entityInfo.position.match(/(\\d+\\.?\\d*)/g)\n const [__, sx, sy, sz] = entityInfo.scale.match(/(\\d+\\.?\\d*)/g)\n\n var res = new WebSpatialResource()\n res.id = id\n res.windowContainerId = WebSpatial.getCurrentWindowContainer().id\n const entity = new SpatialEntity(res)\n entity.transform.position.x = parseFloat(x)\n entity.transform.position.y = parseFloat(y)\n entity.transform.position.z = parseFloat(z)\n\n entity.transform.scale.x = parseFloat(sx)\n entity.transform.scale.y = parseFloat(sy)\n entity.transform.scale.z = parseFloat(sz)\n\n return entity\n }\n // set loading view.\n /** @hidden */\n async setLoading(method: LoadingMethodKind, style?: string) {\n return WebSpatial.setLoading(method, style)\n }\n}\n","import { SpatialSession } from './SpatialSession'\n\n/**\n * Base object designed to be placed on navigator.spatial to mirror navigator.xr for webxr\n */\nexport class Spatial {\n /**\n * Requests a session object from the browser\n * @returns The session or null if not availible in the current browser\n * [TODO] discuss implications of this not being async\n */\n requestSession() {\n if (\n this.isSupported() &&\n this.getNativeVersion() === this.getClientVersion()\n ) {\n return new SpatialSession()\n } else {\n return null\n }\n }\n\n /**\n * @returns true if web spatial is supported by this webpage\n */\n isSupported() {\n return this.getNativeVersion() === this.getClientVersion()\n }\n\n /**\n * Gets the native version, format is \"x.x.x\"\n * @returns native version string\n */\n getNativeVersion() {\n if (window.__WebSpatialData && window.__WebSpatialData.getNativeVersion) {\n return window.__WebSpatialData.getNativeVersion()\n }\n return window.WebSpatailNativeVersion === 'PACKAGE_VERSION'\n ? this.getClientVersion()\n : window.WebSpatailNativeVersion\n }\n\n /**\n * Gets the client version, format is \"x.x.x\"\n * @returns client version string\n */\n getClientVersion() {\n return __WEBSPATIAL_CORE_SDK_VERSION__\n }\n}\n","import { SpatialViewComponent, StyleParam } from './component'\nimport { Spatial } from './Spatial'\nimport { SpatialEntity } from './SpatialEntity'\nimport { SpatialSession } from './SpatialSession'\nimport { Vec3 } from './SpatialTransform'\n\n/**\n * Helper class used to quickly add spatial content to standard web pages\n * [Experimental] expect APIs to potentially change in future versions\n */\nexport class SpatialHelper {\n private static _instance: SpatialHelper | null = null\n static get instance() {\n if (this._instance) {\n return this._instance\n } else {\n let spatial = new Spatial()\n if (spatial.isSupported()) {\n let session = spatial.requestSession()\n if (session) {\n this._instance = new SpatialHelper(session)\n return this._instance\n }\n }\n }\n return null\n }\n\n constructor(public session: SpatialSession) {}\n\n shape = {\n createShapeEntity: async (shape = 'box') => {\n var box = await this.session.createMeshResource({ shape: shape })\n var mat = await this.session.createPhysicallyBasedMaterialResource()\n await mat.update()\n\n var customModel = await this.session.createModelComponent()\n customModel.setMaterials([mat])\n customModel.setMesh(box)\n\n var boxEntity = await this.session.createEntity()\n await boxEntity.setComponent(customModel)\n boxEntity.transform.position.z = 0\n boxEntity.transform.scale = new Vec3(0.5, 0.5, 0.5)\n await boxEntity.updateTransform()\n return boxEntity\n },\n createModelEntity: async (url: string) => {\n var customModel = await this.session.createModelComponent({ url })\n var boxEntity = await this.session.createEntity()\n await boxEntity.setComponent(customModel)\n await boxEntity.updateTransform()\n return boxEntity\n },\n wrapInBoundingBoxEntity: async (entityToWrap: SpatialEntity) => {\n var bb = await entityToWrap.getBoundingBox()\n\n // Scale to fit\n var targetSize = 1.0\n var scale =\n targetSize / Math.max(bb.extents.x, bb.extents.y, bb.extents.z)\n entityToWrap.transform.scale.x = scale\n entityToWrap.transform.scale.y = scale\n entityToWrap.transform.scale.z = scale\n\n // Center within view\n entityToWrap.transform.position.x = -bb.center.x * scale\n entityToWrap.transform.position.y = -bb.center.y * scale\n entityToWrap.transform.position.z = -bb.center.z * scale\n await entityToWrap.updateTransform()\n\n // wrap in boudning box\n var boudningEntity = await SpatialHelper.instance?.session.createEntity()!\n await entityToWrap.setParent(boudningEntity!)\n return boudningEntity\n },\n }\n\n navigation = {\n openPanel: async (\n url: string,\n options?: { resolution: { width: number; height: number } },\n ) => {\n if (options?.resolution) {\n await this.session\n .getCurrentWindowContainer()\n ._setOpenSettings({ resolution: options.resolution })\n }\n\n // Create window container\n var wg = await this.session.createWindowContainer({\n style: 'Plain',\n windowComponent: null,\n windowContainer: null,\n })\n\n // Create a root entity displaying a webpage\n var ent = await this.session!.createEntity({\n windowComponent: null,\n windowContainer: wg,\n })\n var i = await this.session!.createWindowComponent({\n windowComponent: null,\n windowContainer: wg,\n })\n await i.loadURL(url)\n await ent.setCoordinateSpace('Root')\n await ent.setComponent(i)\n\n // Add enitity the window container\n await wg.setRootEntity(ent)\n\n // Restore default size\n await this.session\n .getCurrentWindowContainer()\n ._setOpenSettings({ resolution: { width: 900, height: 700 } })\n\n return {\n windowContainer: wg,\n }\n },\n openVolume: async (\n url: string,\n options?: { resolution: { width: number; height: number } },\n ) => {\n var wg = await this.session.createWindowContainer({\n style: 'Volumetric',\n windowComponent: null,\n windowContainer: null,\n })\n\n // Create a root view entity within the window container\n var rootEnt = await this.session!.createEntity({\n windowComponent: null,\n windowContainer: wg,\n })\n await rootEnt.setComponent(\n await this.session!.createViewComponent({\n windowComponent: null,\n windowContainer: wg,\n }),\n )\n await rootEnt.setCoordinateSpace('Root')\n await wg.setRootEntity(rootEnt)\n\n // Add webpage to the window container\n var ent = await this.session!.createEntity({\n windowComponent: null,\n windowContainer: wg,\n })\n var i = await this.session!.createWindowComponent({\n windowComponent: null,\n windowContainer: wg,\n })\n await i.loadURL(url)\n if (options?.resolution) {\n await i.setResolution(\n options.resolution.width,\n options.resolution.height,\n )\n } else {\n await i.setResolution(1000, 1000)\n }\n ent.transform.position.z = -0.49\n await ent.updateTransform()\n await ent.setCoordinateSpace('App')\n await ent.setComponent(i)\n await ent.setParent(rootEnt)\n },\n }\n\n dom = {\n attachSpatialView: async (divOnPage: HTMLElement) => {\n // Create SpatialView\n var viewEnt = await this.session.createEntity()\n await viewEnt.setCoordinateSpace('Dom') // Set coordinate space so its transform is relative to the webpage's pixels\n await viewEnt.setComponent(await this.session.createViewComponent())\n\n // Add to the root window component to display\n var wc = await this.session.getCurrentWindowComponent()\n var ent = await wc.getEntity()\n await viewEnt.setParent(ent!)\n\n // Keep spatialView positioned where the div is\n var update = () => {\n var rect = divOnPage.getBoundingClientRect()\n viewEnt.transform.position.x = rect.x + rect.width / 2\n viewEnt.transform.position.y = rect.y + rect.height / 2 + window.scrollY\n viewEnt.updateTransform()\n viewEnt\n .getComponent(SpatialViewComponent)!\n .setResolution(rect.width, rect.height)\n }\n var mo = new MutationObserver(update)\n mo.observe(divOnPage, { attributes: true })\n var ro = new ResizeObserver(update)\n ro.observe(divOnPage)\n const addRemoveObserver = new MutationObserver(mutations => {\n mutations.forEach(mutation => {\n mutation.removedNodes.forEach(node => {\n if (node instanceof HTMLElement) {\n update()\n }\n })\n mutation.addedNodes.forEach(node => {\n if (node instanceof HTMLElement) {\n update()\n }\n })\n })\n })\n addRemoveObserver.observe(document.body, {\n childList: true,\n subtree: true,\n })\n update()\n return {\n entity: viewEnt,\n }\n },\n }\n\n setBackgroundStyle = async (\n style: StyleParam,\n backgroundColor = '#00000000',\n ) => {\n document.documentElement.style.backgroundColor = backgroundColor\n await this.session!.getCurrentWindowComponent().setStyle(style)\n }\n}\n","import { SpatialComponent } from './SpatialComponent'\nimport { WebSpatial } from '../private/WebSpatial'\nimport { Vec3 } from '../SpatialTransform'\nimport { SpatialHelper } from '../SpatialHelper'\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 type StyleParam = {\n material?: {\n type: BackgroundMaterialType\n }\n cornerRadius?: number | CornerRadius\n}\n\n/**\n * Used to position an web window in 3D space\n */\nexport class SpatialWindowComponent extends SpatialComponent {\n /**\n * Loads a url page in the window\n * @param url url to load\n */\n async loadURL(url: string) {\n await WebSpatial.updateResource(this._resource, { url: url })\n }\n\n async setFromWindow(window: any) {\n if (window._webSpatialID) {\n await WebSpatial.updateResource(this._resource, {\n windowID: window._webSpatialID,\n })\n } else {\n await console.warn(\n 'failed to call setFromWindow, window provided is not valid',\n )\n }\n }\n\n /**\n * Sets the resolution of the window, the resulting dimensions when rendered will be equal to 1/1360 units\n * eg. if the resolution is set to 1360x1360 it will be a 1x1 plane\n * See 1360 in spatialViewUI.swift for how this ratio works\n * @param width width in pixels\n * @param height height in pixels\n */\n async setResolution(width: number, height: number) {\n await WebSpatial.updateResource(this._resource, {\n resolution: { x: width, y: height },\n })\n }\n\n /**\n * [Experimental] Sets the anchor which the entity this is attached to will rotate around\n * @param rotationAnchor\n */\n async setRotationAnchor(rotationAnchor: Vec3) {\n await WebSpatial.updateResource(this._resource, {\n rotationAnchor: rotationAnchor,\n })\n }\n\n /**\n * [Experimental] Sets the opacity of the window after apply material\n * @param opacity\n */\n async setOpacity(opacity: number) {\n await WebSpatial.updateResource(this._resource, {\n opacity,\n })\n }\n\n /**\n * Sets the style that should be applied to the window\n * @param options style options\n */\n async setStyle(styleParam: StyleParam) {\n const currentWindowComponent =\n SpatialHelper.instance?.session.getCurrentWindowComponent()\n const isSettingSelfStyle =\n currentWindowComponent?._resource.id == this._resource.id\n\n const { material, cornerRadius } = styleParam\n const options: any = {}\n if (material?.type) {\n options.backgroundMaterial = material.type\n }\n\n if (cornerRadius !== undefined) {\n if (typeof cornerRadius === 'number') {\n options.cornerRadius = {\n topLeading: cornerRadius,\n bottomLeading: cornerRadius,\n topTrailing: cornerRadius,\n bottomTrailing: cornerRadius,\n }\n } else {\n options.cornerRadius = { ...cornerRadius }\n }\n }\n\n if (isSettingSelfStyle && document && document.readyState == 'loading') {\n // Avoid flash of unstyled content by sending style command via a link element\n var encoded = encodeURIComponent(JSON.stringify(options))\n\n const a = document.createElement(`a`)\n a.href = 'forcestyle://mystyle.css?' + 'style=' + encoded\n document.body.appendChild(a)\n a.click()\n // remove this element after trigger forceStyle action\n a.remove()\n } else {\n await WebSpatial.updateResource(this._resource, { style: options })\n }\n }\n\n /**\n * Modifies the amount the spatial window can be scrolled\n * Should only be used internally\n * See https://developer.apple.com/documentation/uikit/1624475-uiedgeinsetsmake?language=objc\n * @param insets margin to modify scroll distances by\n */\n async setScrollEdgeInsets(insets: {\n top: number\n left: number\n bottom: number\n right: number\n }) {\n await WebSpatial.updateResource(this._resource, {\n setScrollEdgeInsets: insets,\n })\n }\n\n /**\n * Enable/Disable scrolling in the window (defaults to enabled), if disabled, scrolling will be applied to the root page\n * @param enabled value to set\n */\n async setScrollEnabled(enabled: boolean) {\n await WebSpatial.updateResource(this._resource, { scrollEnabled: enabled })\n }\n\n /**\n * Defaults to false. If set to true, scrolling the parent page will also scroll this window with it like other dom elements\n * @param scrollWithParent value to set\n */\n async setScrollWithParent(scrollWithParent: boolean) {\n await WebSpatial.updateResource(this._resource, {\n scrollWithParent: scrollWithParent,\n })\n }\n}\n","import { WebSpatial, WebSpatialResource } from '../private/WebSpatial'\nimport { SpatialComponent } from './SpatialComponent'\n\n/**\n * @description\n * Represents a spatial component that handles events related to spatial interactions.\n * This class extends `SpatialComponent` and provides additional functionality for managing\n * event-driven spatial behaviors.\n *\n * @hidden\n * This class is intended for internal use and should not be exposed in the public API.\n */\nexport abstract class EventSpatialComponent extends SpatialComponent {\n // Class implementation goes here\n constructor(_resource: WebSpatialResource) {\n super(_resource)\n WebSpatial.registerEventReceiver(_resource.id, (data: any) => {\n this.onRecvEvent(data)\n })\n }\n\n /**\n * @description\n * Abstract method to be implemented by subclasses. Called when a spatial event is received.\n * @param data The data associated with the received event.\n */\n protected abstract onRecvEvent(data: any): void\n\n protected override async onDestroy() {\n WebSpatial.unregisterEventReceiver(this._resource.id)\n }\n}\n","import { Vec3 } from '../SpatialTransform'\nimport { EventSpatialComponent } from './EventSpatialComponent'\n\n/**\n * Translate event, matching similar behavior to https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drag_event\n */\ntype TranslateEvent = {\n eventType: 'dragstart' | 'dragend' | 'drag'\n translate?: Vec3\n}\n/**\n * Used to handle input events on an entity\n */\nexport class SpatialInputComponent extends EventSpatialComponent {\n protected override onRecvEvent(data: any): void {\n this.onTranslate(data)\n }\n\n /**\n * Callback fired when a translate event occurs\n * @param data translate event data\n */\n public onTranslate(data: TranslateEvent) {}\n}\n","import { SpatialMeshResource } from '../resource/SpatialMeshResource'\nimport { SpatialPhysicallyBasedMaterialResource } from '../resource/SpatialPhysicallyBasedMaterialResource'\nimport { SpatialComponent } from './SpatialComponent'\nimport { WebSpatial } from '../private/WebSpatial'\n\n/**\n * Used to position a model in 3D space, made up of a mesh and materials to be applied to the mesh\n */\nexport class SpatialModelComponent extends SpatialComponent {\n private cachedMaterials = new Array<SpatialPhysicallyBasedMaterialResource>()\n /**\n * Sets the mesh to be displayed by the component\n * @param mesh mesh to set\n */\n async setMesh(mesh: SpatialMeshResource) {\n await WebSpatial.updateResource(this._resource, {\n meshResource: mesh._resource.id,\n })\n }\n\n /**\n * Sets the materials that should be applied to the mesh\n * @param materials array of materials to set\n */\n async setMaterials(materials: Array<SpatialPhysicallyBasedMaterialResource>) {\n this.cachedMaterials = materials\n await WebSpatial.updateResource(this._resource, {\n materials: materials.map(m => {\n m._addToComponent(this)\n return m._resource.id\n }),\n })\n }\n\n /** @hidden */\n async _syncMaterials() {\n await this.setMaterials(this.cachedMaterials)\n }\n}\n","import { WebSpatial } from '../private/WebSpatial'\nimport { SpatialComponent } from './SpatialComponent'\n\n/**\n * Represenets a volume that can be added to the webpage\n * Child entities will be added within this volume's space\n * Defaults to having 1x1x1 meter dimensions\n * Resolution defaults to 100x100 pixels\n * Only will be displayed on entities in \"ROOT\" or \"DOM\" space\n * If the resolution of the spatial view is not a square, the volume will be larger based on the ratio with the shortest side being 1 meter.\n * (eg. 200x100 = 2m x 1m x 1m volume)\n */\nexport class SpatialViewComponent extends SpatialComponent {\n /**\n * Sets the resolution of the spatial view in dom pixels\n */\n async setResolution(width: number, height: number) {\n await WebSpatial.updateResource(this._resource, {\n resolution: { x: width, y: height },\n })\n }\n\n /**\n * Sets if content of the spatialView should be within a portal\n * If true, volume will be behind the page, if false, it will be in front of the page\n */\n async setIsPortal(isPortal: Boolean) {\n await WebSpatial.updateResource(this._resource, {\n isPortal: isPortal,\n })\n }\n}\n","import { EventSpatialComponent } from './EventSpatialComponent'\nimport { WebSpatial } from '../private/WebSpatial'\nimport { Vec3 } from '../SpatialTransform'\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 type TapEvent = {\n eventType: 'tap'\n}\n\n/**\n * Used to position a model3d in 3D space\n */\nexport class SpatialModel3DComponent extends EventSpatialComponent {\n protected override onRecvEvent(data: any): void {\n const { eventType, value, error } = data\n switch (eventType) {\n case 'phase':\n if (value === 'success') {\n this.onSuccess?.()\n } else {\n this.onFailure?.(error as string)\n }\n break\n case 'dragstart':\n this._onDragStart?.(value)\n break\n case 'dragend':\n this._onDragEnd?.(value)\n break\n case 'drag':\n this._onDrag?.(value)\n break\n case 'tap':\n this._onTap?.()\n break\n case 'doubletap':\n this._onDoubleTap?.()\n break\n case 'longpress':\n this._onLongPress?.()\n break\n\n default:\n break\n }\n }\n /**\n * Sets the resolution of the spatial view in dom pixels\n */\n async setResolution(width: number, height: number) {\n await WebSpatial.updateResource(this._resource, {\n resolution: { x: width, y: height },\n })\n }\n\n async setRotationAnchor(rotationAnchor: Vec3) {\n await WebSpatial.updateResource(this._resource, {\n rotationAnchor: rotationAnchor,\n })\n }\n\n /**\n * Sets the opacity of the model\n * @param opacity\n */\n async setOpacity(opacity: number) {\n await WebSpatial.updateResource(this._resource, {\n opacity,\n })\n }\n\n /**\n * Sets how the model fill the rect\n * @param contentMode\n */\n async setContentMode(contentMode: 'fill' | 'fit') {\n await WebSpatial.updateResource(this._resource, {\n contentMode,\n })\n }\n\n /**\n * Constrains this model dimensions to the specified aspect ratio.\n * with a value of 0, the model will use the original aspect ratio.\n *\n * @param aspectRatio number\n */\n async setAspectRatio(aspectRatio: number) {\n await WebSpatial.updateResource(this._resource, {\n aspectRatio,\n })\n }\n\n /**\n * Defaults to false. If set to true, scrolling the parent page will also scroll this window with it like other dom elements\n * @param scrollWithParent value to set\n */\n async setScrollWithParent(scrollWithParent: boolean) {\n await WebSpatial.updateResource(this._resource, {\n scrollWithParent: scrollWithParent,\n })\n }\n\n /**\n * Sets whether the model appear in original size or fit the rect\n * @param resizable\n */\n async setResizable(resizable: boolean) {\n await WebSpatial.updateResource(this._resource, {\n resizable,\n })\n }\n\n /**\n * Callback fired when model load success\n */\n public onSuccess?: () => void\n\n /**\n * Callback fired when model load failure\n * @param errorReason\n */\n public onFailure?: (errorReason: string) => void\n\n /**\n * Callback fired when model was dragged at the beginning\n * @param dragEvent\n */\n private _onDragStart?: (dragEvent: SpatialModelDragEvent) => void\n public set onDragStart(\n callback: ((dragEvent: SpatialModelDragEvent) => void) | undefined,\n ) {\n if (this._onDragStart !== callback) {\n this._onDragStart = callback\n WebSpatial.updateResource(this._resource, {\n enableDragEvent: this.enableDragEvent,\n })\n }\n }\n\n /**\n * Callback fired when model was dragged\n * @param dragEvent\n */\n private _onDrag?: (dragEvent: SpatialModelDragEvent) => void\n public set onDrag(\n callback: ((dragEvent: SpatialModelDragEvent) => void) | undefined,\n ) {\n if (this._onDrag !== callback) {\n this._onDrag = callback\n WebSpatial.updateResource(this._resource, {\n enableDragEvent: this.enableDragEvent,\n })\n }\n }\n\n /**\n * Callback fired when model was dragged at the ending\n * @param dragEvent\n */\n private _onDragEnd?: (dragEvent: SpatialModelDragEvent) => void\n public set onDragEnd(\n callback: ((dragEvent: SpatialModelDragEvent) => void) | undefined,\n ) {\n if (this._onDragEnd !== callback) {\n this._onDragEnd = callback\n WebSpatial.updateResource(this._resource, {\n enableDragEvent: this.enableDragEvent,\n })\n }\n }\n\n private get enableDragEvent(): boolean {\n return (\n undefined !== this._onDrag ||\n undefined !== this._onDragStart ||\n undefined !== this._onDragEnd\n )\n }\n\n /**\n * Callback fired when model was tapped\n */\n private _onTap?: () => void\n public set onTap(callback: (() => void) | undefined) {\n if (this._onTap !== callback) {\n this._onTap = callback\n WebSpatial.updateResource(this._resource, {\n enableTapEvent: undefined !== callback,\n })\n }\n }\n\n /** Callback fired when model was double tapped */\n private _onDoubleTap?: () => void\n public set onDoubleTap(callback: (() => void) | undefined) {\n if (this._onDoubleTap !== callback) {\n this._onDoubleTap = callback\n WebSpatial.updateResource(this._resource, {\n enableDoubleTapEvent: undefined !== callback,\n })\n }\n }\n\n /** Callback fired when model was long pressed */\n private _onLongPress?: () => void\n public set onLongPress(callback: (() => void) | undefined) {\n if (this._onLongPress !== callback) {\n this._onLongPress = callback\n WebSpatial.updateResource(this._resource, {\n enableLongPressEvent: undefined !== callback,\n })\n }\n }\n}\n"],"mappings":";;;;;;;kcAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,qBAAAC,EAAA,kBAAAC,EAAA,kBAAAC,EAAA,0BAAAC,EAAA,wBAAAC,EAAA,4BAAAC,EAAA,0BAAAC,EAAA,2CAAAC,EAAA,mBAAAC,EAAA,qBAAAC,EAAA,yBAAAC,EAAA,2BAAAC,EAAA,2BAAAC,EAAA,SAAAC,EAAA,SAAAC,ICAO,IAAMC,EAAN,MAAMC,CAAc,CACzB,OAAe,eAAiB,EAEhC,QAEA,KAEA,UAEA,YAAYC,EAAaC,EAAY,CACnC,KAAK,QAAUD,EACf,KAAK,KAAOC,EACZ,KAAK,UAAY,EAAEF,EAAc,cACnC,CACF,ECsBO,IAAMG,EAAN,KAAsB,CAC3B,GAAK,EACP,EAEaC,EAAN,KAAyB,CAC9B,GAAK,GACL,kBAAoB,GACpB,KAAO,CAAC,EAER,cAAe,CAAC,CAClB,EAEaC,EAAN,MAAMC,CAAW,CACtB,OAAc,cAAqB,CAAC,EAEpC,OAAc,mBAAqB,GACnC,OAAc,oBAAsB,MAAqB,EAGzD,OAAe,eACb,CAAC,EAEH,OAAc,sBACZC,EACAC,EACA,CACA,KAAK,eAAeD,CAAU,EAAIC,CACpC,CAEA,OAAc,wBAAwBD,EAAoB,CACxD,OAAO,KAAK,eAAeA,CAAU,CACvC,CAEA,OAAO,MAAO,CACZ,OAAO,kBAAqB,GAAW,CACrC,GAAI,EAAE,WAAY,CAChB,IAAIC,EAAWF,E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Ad,MAClB,CAAC,EAEL,CAGQ,aACR,IAAW,YAAYA,EAAoC,CACrD,KAAK,eAAiBA,IACxB,KAAK,aAAeA,EACpBP,EAAW,eAAe,KAAK,UAAW,CACxC,qBAAoCO,IAAd,MACxB,CAAC,EAEL,CAGQ,aACR,IAAW,YAAYA,EAAoC,CACrD,KAAK,eAAiBA,IACxB,KAAK,aAAeA,EACpBP,EAAW,eAAe,KAAK,UAAW,CACxC,qBAAoCO,IAAd,MACxB,CAAC,EAEL,CACF","names":["index_exports","__export","Spatial","SpatialComponent","SpatialEntity","SpatialHelper","SpatialInputComponent","SpatialMeshResource","SpatialModel3DComponent","SpatialModelComponent","SpatialPhysicallyBasedMaterialResource","SpatialSession","SpatialTransform","SpatialViewComponent","SpatialWindowComponent","SpatialWindowContainer","Vec3","Vec4","RemoteCommand","_RemoteCommand","cmd","data","WindowContainer","WebSpatialResource","WebSpatial","_WebSpatial","resourceId","callback","p","cmd","RemoteCommand","result","res","rej","msg","wg","style","cfg","newWindow","sceneData","jsbSceneData","windowContainer","parentWebView","resource","data","spatialObjectId","entity","type","params","method","fn","dt","loop","curTime","updateTime","SpatialObject","_resource","WebSpatial","Vec3","x","y","z","Vec4","w","SpatialTransform","SpatialEntity","SpatialObject","SpatialTransform","WebSpatial","zIndex","component","type","c","wg","space","res","visible","name","SpatialComponent","SpatialObject","reqResp","WebSpatial","res","rej","WebSpatialResource","SpatialEntity","SpatialWindowContainer","_wg","options","WebSpatial","reqResp","res","WebSpatialResource","SpatialEntity","entity","SpatialMeshResource","SpatialObject","SpatialPhysicallyBasedMaterialResource","SpatialObject","c","WebSpatial","key","_parseParentResources","options","parentWindowContainer","WebSpatial","parentWindow","SpatialSession","_SpatialSession","callback","time","cb","entity","SpatialEntity","SpatialWindowComponent","SpatialViewComponent","opts","SpatialModelComponent","SpatialModel3DComponent","SpatialInputComponent","SpatialMeshResource","SpatialPhysicallyBasedMaterialResource","style","SpatialWindowContainer","cfg","parentResp","res","rej","WebSpatialResource","msg","RemoteCommand","x","spatialObjectId","fn","openedWindow","counter","locName","resolve","id","entityInfo","_","y","z","__","sx","sy","sz","method","Spatial","SpatialSession","SpatialHelper","_SpatialHelper","session","spatial","Spatial","shape","box","mat","customModel","boxEntity","Vec3","url","entityToWrap","bb","targetSize","scale","boudningEntity","options","wg","ent","i","rootEnt","divOnPage","viewEnt","wc","update","rect","SpatialViewComponent","mo","ro","mutations","mutation","node","style","backgroundColor","SpatialWindowComponent","SpatialComponent","url","WebSpatial","window","width","height","rotationAnchor","opacity","styleParam","isSettingSelfStyle","SpatialHelper","material","cornerRadius","options","encoded","a","insets","enabled","scrollWithParent","EventSpatialComponent","SpatialComponent","_resource","WebSpatial","data","SpatialInputComponent","EventSpatialComponent","data","SpatialModelComponent","SpatialComponent","mesh","WebSpatial","materials","m","SpatialViewComponent","SpatialComponent","width","height","WebSpatial","isPortal","SpatialModel3DComponent","EventSpatialComponent","data","eventType","value","error","width","height","WebSpatial","rotationAnchor","opacity","contentMode","aspectRatio","scrollWithParent","resizable","callback"]}
1
+ {"version":3,"sources":["../../src/ssr-polyfill.ts","../../src/platform-adapter/ssr/SSRPlatform.ts","../../src/platform-adapter/CommandResultUtils.ts","../../src/SpatialWebEvent.ts","../../src/platform-adapter/android/AndroidPlatform.ts","../../src/platform-adapter/vision-os/VisionOSPlatform.ts","../../src/platform-adapter/index.ts","../../src/utils.ts","../../src/JSBCommand.ts","../../src/index.ts","../../src/SpatialObject.ts","../../src/scene-polyfill.ts","../../src/SpatialScene.ts","../../src/types/types.ts","../../src/SpatializedElementCreator.ts","../../src/Spatialized2DElement.ts","../../src/SpatializedElement.ts","../../src/SpatialWebEventCreator.ts","../../src/SpatializedStatic3DElement.ts","../../src/SpatializedDynamic3DElement.ts","../../src/reality/realityCreator.ts","../../src/reality/entity/SpatialEntity.ts","../../src/reality/entity/SpatialModelEntity.ts","../../src/reality/component/SpatialComponent.ts","../../src/reality/component/ModelComponent.ts","../../src/reality/material/SpatialUnlitMaterial.ts","../../src/reality/material/SpatialMaterial.ts","../../src/reality/resource/SpatialModelAsset.ts","../../src/reality/geometry/SpatialGeometry.ts","../../src/reality/geometry/SpatialBoxGeometry.ts","../../src/reality/geometry/SpatialSphereGeometry.ts","../../src/reality/geometry/SpatialCylinderGeometry.ts","../../src/reality/geometry/SpatialPlaneGeometry.ts","../../src/reality/geometry/SpatialConeGeometry.ts","../../src/SpatialSession.ts","../../src/Spatial.ts","../../src/spatial-window-polyfill.ts"],"sourcesContent":["const isSSR = typeof window === 'undefined'\n\nexport const isSSREnv = () => isSSR\n","import {\n CommandResult,\n PlatformAbility,\n WebSpatialProtocolResult,\n} from '../interface'\n\nexport class SSRPlatform implements PlatformAbility {\n callJSB(cmd: string, msg: string): Promise<CommandResult> {\n return Promise.resolve({\n success: true,\n data: undefined,\n errorCode: undefined,\n errorMessage: undefined,\n })\n }\n callWebSpatialProtocol(\n schema: string,\n query?: string,\n target?: string,\n features?: string,\n ): Promise<WebSpatialProtocolResult> {\n return Promise.resolve({\n success: true,\n data: undefined,\n errorCode: undefined,\n errorMessage: undefined,\n })\n }\n callWebSpatialProtocolSync(\n schema: string,\n query?: string,\n target?: string,\n features?: string,\n resultCallback?: (result: CommandResult) => void,\n ): WebSpatialProtocolResult {\n return {\n success: true,\n data: undefined,\n errorCode: undefined,\n errorMessage: undefined,\n }\n }\n}\n","import { CommandResult } from './interface'\n\nexport function CommandResultSuccess(data: any): CommandResult {\n return {\n success: true,\n data,\n errorCode: '',\n errorMessage: '',\n }\n}\n\nexport function CommandResultFailure(\n errorCode: string,\n errorMessage = '',\n): CommandResult {\n return {\n success: false,\n data: undefined,\n errorCode,\n errorMessage,\n }\n}\n","interface SpatialWebEventData {\n id: string\n data: any\n}\n\nexport class SpatialWebEvent {\n static eventReceiver: Record<string, (data: any) => void> = {}\n static init() {\n // inject __SpatialWebEvent\n window.__SpatialWebEvent = ({ id, data }: SpatialWebEventData) => {\n // console.log('__SpatialWebEvent', id, data)\n SpatialWebEvent.eventReceiver[id]?.(data)\n }\n }\n\n static addEventReceiver(id: string, callback: (data: any) => void) {\n SpatialWebEvent.eventReceiver[id] = callback\n }\n\n static removeEventReceiver(id: string) {\n delete SpatialWebEvent.eventReceiver[id]\n }\n}\n","import { PlatformAbility, CommandResult } from '../interface'\nimport {\n CommandResultFailure,\n CommandResultSuccess,\n} from '../CommandResultUtils'\nimport { CheckWebViewCanCreateCommand } from '../../JSBCommand'\nimport { SpatialWebEvent } from '../../SpatialWebEvent'\n\ninterface JSBResponse {\n success: boolean\n data: any\n}\ntype JSBError = {\n code: string\n message: string\n}\n\nlet creatingElementCount = 0\n\nlet requestId = 0\n\nconst MAX_ID = 100000\n\nfunction nextRequestId() {\n requestId = (requestId + 1) % MAX_ID\n return `rId_${requestId}`\n}\n\nexport class AndroidPlatform implements PlatformAbility {\n async callJSB(cmd: string, msg: string): Promise<CommandResult> {\n // android JS Bridge interface only support sync invoking\n // in order to implement promise API, register every request by requestId and remove when resolve/reject.\n return new Promise((resolve, reject) => {\n try {\n const rId = nextRequestId()\n\n SpatialWebEvent.addEventReceiver(rId, (result: JSBResponse) => {\n SpatialWebEvent.removeEventReceiver(rId)\n if (result.success) {\n resolve(CommandResultSuccess(result.data))\n } else {\n const { code, message } = result.data as JSBError\n resolve(CommandResultFailure(code, message))\n }\n })\n\n const ans = window.webspatialBridge.postMessage(rId, cmd, msg)\n if (ans !== '') {\n SpatialWebEvent.removeEventReceiver(rId)\n // sync call\n const result = JSON.parse(ans) as JSBResponse\n if (result.success) {\n resolve(CommandResultSuccess(result.data))\n } else {\n const { code, message } = result.data as JSBError\n resolve(CommandResultFailure(code, message))\n }\n }\n } catch (error: unknown) {\n console.error(\n `AndroidPlatform cmd: ${cmd}, msg: ${msg} error: ${error}`,\n )\n const { code, message } = error as JSBError\n resolve(CommandResultFailure(code, message))\n }\n })\n }\n\n async callWebSpatialProtocol(\n command: string,\n query?: string,\n target?: string,\n features?: string,\n ): Promise<CommandResult> {\n // Waiting for request to create spatial div\n await new Promise(resolve => setTimeout(resolve, 16 * creatingElementCount))\n // Count the current total number of created spatial div queues\n creatingElementCount++\n // Create a spatial div through JSB polling request\n let canCreate = await new CheckWebViewCanCreateCommand().execute()\n while (!canCreate.data.can) {\n await new Promise(resolve => setTimeout(resolve, 16))\n canCreate = await new CheckWebViewCanCreateCommand().execute()\n }\n // Request successful, call window.open\n const { windowProxy } = this.openWindow(command, query, target, features)\n // Polling waiting for windowProxy to convert into a real window object\n while (!windowProxy?.open) {\n await new Promise(resolve => setTimeout(resolve, 16))\n }\n // Make the page renderable through window.open\n windowProxy?.open('about:blank', '_self')\n // Polling to check if SpatialId injection is successful\n while (!windowProxy?.__SpatialId) {\n await new Promise(resolve => setTimeout(resolve, 16))\n }\n let spatialId = windowProxy?.__SpatialId\n creatingElementCount--\n return Promise.resolve(\n CommandResultSuccess({ windowProxy: windowProxy, id: spatialId }),\n )\n }\n\n callWebSpatialProtocolSync(\n command: string,\n query?: string,\n target?: string,\n features?: string,\n ): CommandResult {\n const { spatialId: id = '', windowProxy } = this.openWindow(\n command,\n query,\n target,\n features,\n )\n\n return CommandResultSuccess({ windowProxy, id })\n }\n\n private openWindow(\n command: string,\n query?: string,\n target?: string,\n features?: string,\n ) {\n const windowProxy = window.open(\n `webspatial://${command}?${query || ''}`,\n target,\n features,\n )\n return { spatialId: '', windowProxy }\n }\n}\n","import { PlatformAbility, CommandResult } from '../interface'\nimport {\n CommandResultFailure,\n CommandResultSuccess,\n} from '../CommandResultUtils'\n\n\ntype JSBError = {\n message: string\n}\n\nexport class VisionOSPlatform implements PlatformAbility {\n async callJSB(cmd: string, msg: string): Promise<CommandResult> {\n try {\n const result = await window.webkit.messageHandlers.bridge.postMessage(\n `${cmd}::${msg}`,\n )\n return CommandResultSuccess(result)\n } catch (error: unknown) {\n // console.error(`VisionOSPlatform cmd: ${cmd}, msg: ${msg} error: ${error}`)\n const { code, message } = JSON.parse((error as JSBError).message)\n return CommandResultFailure(code, message)\n }\n }\n\n callWebSpatialProtocol(\n command: string,\n query?: string,\n target?: string,\n features?: string,\n ): Promise<CommandResult> {\n const { spatialId: id, windowProxy } = this.openWindow(\n command,\n query,\n target,\n features,\n )\n return Promise.resolve(\n CommandResultSuccess({ windowProxy: windowProxy, id }),\n )\n }\n\n callWebSpatialProtocolSync(\n command: string,\n query?: string,\n target?: string,\n features?: string,\n ): CommandResult {\n const { spatialId: id = '', windowProxy } = this.openWindow(\n command,\n query,\n target,\n features,\n )\n\n return CommandResultSuccess({ windowProxy, id })\n }\n\n private openWindow(\n command: string,\n query?: string,\n target?: string,\n features?: string,\n ) {\n const windowProxy = window.open(\n `webspatial://${command}?${query || ''}`,\n target,\n features,\n )\n const ua = windowProxy?.navigator.userAgent\n const spatialId = ua?.match(\n /\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b/gi,\n )?.[0]\n\n return { spatialId, windowProxy }\n }\n}\n","import { isSSREnv } from '../ssr-polyfill'\nimport { PlatformAbility } from './interface'\nimport { SSRPlatform } from './ssr/SSRPlatform'\n\nexport function createPlatform(): PlatformAbility {\n if (isSSREnv()) {\n return new SSRPlatform()\n }\n\n if (\n window.navigator.userAgent.includes('Android') ||\n window.navigator.userAgent.includes('Linux')\n ) {\n const AndroidPlatform = require('./android/AndroidPlatform').AndroidPlatform\n return new AndroidPlatform()\n } else {\n const VisionOSPlatform =\n require('./vision-os/VisionOSPlatform').VisionOSPlatform\n return new VisionOSPlatform()\n }\n}\n","import { Vec3 } from './types/types'\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","import { createPlatform } from './platform-adapter'\nimport { WebSpatialProtocolResult } from './platform-adapter/interface'\nimport { SpatialComponent } from './reality/component/SpatialComponent'\nimport { SpatialEntity } from './reality/entity/SpatialEntity'\nimport { SpatializedDynamic3DElement } from './SpatializedDynamic3DElement'\nimport { SpatializedElement } from './SpatializedElement'\nimport { SpatialObject } from './SpatialObject'\n\nimport {\n Spatialized2DElementProperties,\n SpatializedElementProperties,\n SpatializedStatic3DElementProperties,\n SpatialSceneProperties,\n SpatialSceneCreationOptions,\n SpatialUnlitMaterialOptions,\n SpatialGeometryOptions,\n SpatialGeometryType,\n ModelComponentOptions,\n SpatialEntityProperties,\n ModelAssetOptions,\n SpatialModelEntityCreationOptions,\n SpatialEntityEventType,\n Vec3,\n} from './types/types'\nimport { SpatialSceneCreationOptionsInternal } from './types/internal'\nimport { composeSRT } from './utils'\n\nconst platform = createPlatform()\n\nabstract class JSBCommand {\n commandType: string = ''\n protected abstract getParams(): Record<string, any> | undefined\n\n async execute() {\n const param = this.getParams()\n const msg = param ? JSON.stringify(param) : ''\n return platform.callJSB(this.commandType, msg)\n }\n}\n\nexport class UpdateEntityPropertiesCommand extends JSBCommand {\n commandType = 'UpdateEntityProperties'\n\n constructor(\n public entity: SpatialEntity,\n public properties: Partial<SpatialEntityProperties>,\n ) {\n super()\n }\n\n protected getParams() {\n const transform = composeSRT(\n this.properties.position ?? this.entity.position,\n this.properties.rotation ?? this.entity.rotation,\n this.properties.scale ?? this.entity.scale,\n ).toFloat64Array()\n return {\n entityId: this.entity.id,\n transform,\n }\n }\n}\n\nexport class UpdateEntityEventCommand extends JSBCommand {\n commandType = 'UpdateEntityEvent'\n\n constructor(\n public entity: SpatialEntity,\n public type: SpatialEntityEventType,\n public isEnable: boolean,\n ) {\n super()\n }\n\n protected getParams() {\n return {\n type: this.type,\n entityId: this.entity.id,\n isEnable: this.isEnable,\n }\n }\n}\n\n// todo: to be used in SpatialEntity\nexport class UpdateEntityEventsCommand extends JSBCommand {\n // let types:[String:Bool]\n // let entityId:String\n constructor(\n public entity: SpatialEntity,\n public types: Record<SpatialEntityEventType, boolean>,\n ) {\n super()\n }\n\n protected getParams() {\n return {\n entityId: this.entity.id,\n types: this.types,\n }\n }\n}\n\nexport class UpdateSpatialSceneProperties extends JSBCommand {\n properties: Partial<SpatialSceneProperties>\n commandType = 'UpdateSpatialSceneProperties'\n\n constructor(properties: Partial<SpatialSceneProperties>) {\n super()\n this.properties = properties\n }\n\n protected getParams() {\n return this.properties\n }\n}\n\nexport class UpdateSceneConfig extends JSBCommand {\n config: SpatialSceneCreationOptions\n commandType = 'UpdateSceneConfig'\n\n constructor(config: SpatialSceneCreationOptions) {\n super()\n this.config = config\n }\n\n protected getParams(): Record<string, any> | undefined {\n return { config: this.config }\n }\n}\n\nexport class FocusScene extends JSBCommand {\n commandType = 'FocusScene'\n\n constructor(public id: string) {\n super()\n }\n\n protected getParams(): Record<string, any> | undefined {\n return { id: this.id }\n }\n}\n\nexport class GetSpatialSceneState extends JSBCommand {\n commandType = 'GetSpatialSceneState'\n\n constructor() {\n super()\n }\n\n protected getParams(): Record<string, any> | undefined {\n return {}\n }\n}\n\nexport abstract class SpatializedElementCommand extends JSBCommand {\n constructor(readonly spatialObject: SpatialObject) {\n super()\n }\n\n protected getParams() {\n const extraParams = this.getExtraParams()\n return { id: this.spatialObject.id, ...extraParams }\n }\n\n protected abstract getExtraParams(): Record<string, any> | undefined\n}\n\nexport class UpdateSpatialized2DElementProperties extends SpatializedElementCommand {\n properties: Partial<Spatialized2DElementProperties>\n commandType = 'UpdateSpatialized2DElementProperties'\n\n constructor(\n spatialObject: SpatialObject,\n properties: Partial<SpatializedElementProperties>,\n ) {\n super(spatialObject)\n this.properties = properties\n }\n\n protected getExtraParams() {\n return this.properties\n }\n}\n\nexport class UpdateSpatializedDynamic3DElementProperties extends SpatializedElementCommand {\n properties: Partial<Spatialized2DElementProperties>\n commandType = 'UpdateSpatializedDynamic3DElementProperties'\n\n constructor(\n spatialObject: SpatialObject,\n properties: Partial<SpatializedElementProperties>,\n ) {\n super(spatialObject)\n this.properties = properties\n }\n\n protected getExtraParams() {\n return {\n id: this.spatialObject.id,\n ...this.properties,\n }\n }\n}\n\nexport class UpdateUnlitMaterialProperties extends SpatializedElementCommand {\n properties: Partial<SpatialUnlitMaterialOptions>\n commandType = 'UpdateUnlitMaterialProperties'\n\n constructor(\n spatialObject: SpatialObject,\n properties: Partial<SpatialUnlitMaterialOptions>,\n ) {\n super(spatialObject)\n this.properties = properties\n }\n\n protected getExtraParams() {\n return this.properties\n }\n}\n\nexport class UpdateSpatializedElementTransform extends SpatializedElementCommand {\n matrix: DOMMatrix\n commandType = 'UpdateSpatializedElementTransform'\n\n constructor(spatialObject: SpatialObject, matrix: DOMMatrix) {\n super(spatialObject)\n this.matrix = matrix\n }\n\n protected getExtraParams() {\n return { matrix: Array.from(this.matrix.toFloat64Array()) }\n }\n}\n\nexport class UpdateSpatializedStatic3DElementProperties extends SpatializedElementCommand {\n properties: Partial<SpatializedStatic3DElementProperties>\n commandType = 'UpdateSpatializedStatic3DElementProperties'\n\n constructor(\n spatialObject: SpatialObject,\n properties: Partial<SpatializedStatic3DElementProperties>,\n ) {\n super(spatialObject)\n this.properties = properties\n }\n\n protected getExtraParams() {\n return this.properties\n }\n}\n\nexport class AddSpatializedElementToSpatialized2DElement extends SpatializedElementCommand {\n commandType = 'AddSpatializedElementToSpatialized2DElement'\n spatializedElement: SpatializedElement\n\n constructor(\n spatialObject: SpatialObject,\n spatializedElement: SpatializedElement,\n ) {\n super(spatialObject)\n this.spatializedElement = spatializedElement\n }\n\n protected getExtraParams() {\n return { spatializedElementId: this.spatializedElement.id }\n }\n}\n\nexport class AddSpatializedElementToSpatialScene extends JSBCommand {\n commandType = 'AddSpatializedElementToSpatialScene'\n spatializedElement: SpatializedElement\n\n constructor(spatializedElement: SpatializedElement) {\n super()\n this.spatializedElement = spatializedElement\n }\n\n protected getParams() {\n return {\n spatializedElementId: this.spatializedElement.id,\n }\n }\n}\n\nexport class CreateSpatializedStatic3DElementCommand extends JSBCommand {\n commandType = 'CreateSpatializedStatic3DElement'\n\n constructor(readonly modelURL: string) {\n super()\n this.modelURL = modelURL\n }\n\n protected getParams() {\n return { modelURL: this.modelURL }\n }\n}\n\nexport class CreateSpatializedDynamic3DElementCommand extends JSBCommand {\n protected getParams(): Record<string, any> | undefined {\n return { test: true }\n }\n commandType = 'CreateSpatializedDynamic3DElement'\n}\n\nexport class CreateSpatialEntityCommand extends JSBCommand {\n constructor(private name?: string) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return { name: this.name }\n }\n commandType = 'CreateSpatialEntity'\n}\n\nexport class CreateModelComponentCommand extends JSBCommand {\n constructor(private options: ModelComponentOptions) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n let geometryId = this.options.mesh.id\n let materialIds = this.options.materials.map(material => material.id)\n return { geometryId, materialIds }\n }\n commandType = 'CreateModelComponent'\n}\n\nexport class CreateSpatialModelEntityCommand extends JSBCommand {\n constructor(private options: SpatialModelEntityCreationOptions) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return this.options\n }\n commandType = 'CreateSpatialModelEntity'\n}\n\nexport class CreateModelAssetCommand extends JSBCommand {\n constructor(private options: ModelAssetOptions) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return { url: this.options.url }\n }\n commandType = 'CreateModelAsset'\n}\n\nexport class CreateSpatialGeometryCommand extends JSBCommand {\n constructor(\n private type: SpatialGeometryType,\n private options: SpatialGeometryOptions = {},\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return { type: this.type, ...this.options }\n }\n commandType = 'CreateGeometry'\n}\n\nexport class CreateSpatialUnlitMaterialCommand extends JSBCommand {\n constructor(private options: SpatialUnlitMaterialOptions) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return this.options\n }\n commandType = 'CreateUnlitMaterial'\n}\n\nexport class AddComponentToEntityCommand extends JSBCommand {\n constructor(\n public entity: SpatialEntity,\n public comp: SpatialComponent,\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n entityId: this.entity.id,\n componentId: this.comp.id,\n }\n }\n commandType = 'AddComponentToEntity'\n}\n\nexport class AddEntityToDynamic3DCommand extends JSBCommand {\n constructor(\n public d3dEle: SpatializedDynamic3DElement,\n public entity: SpatialEntity,\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n entityId: this.entity.id,\n dynamic3dId: this.d3dEle.id,\n }\n }\n\n commandType = 'AddEntityToDynamic3D'\n}\n\nexport class AddEntityToEntityCommand extends JSBCommand {\n constructor(\n public parent: SpatialEntity,\n public child: SpatialEntity,\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n parentId: this.parent.id,\n childId: this.child.id,\n }\n }\n commandType = 'AddEntityToEntity'\n}\n\nexport class RemoveEntityFromParentCommand extends JSBCommand {\n constructor(public entity: SpatialEntity) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n entityId: this.entity.id,\n }\n }\n commandType = 'RemoveEntityFromParent'\n}\n\nexport class SetParentForEntityCommand extends JSBCommand {\n // childId, parentId\n constructor(\n public childId: string,\n public parentId?: string,\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n childId: this.childId,\n parentId: this.parentId,\n }\n }\n commandType = 'SetParentToEntity'\n}\n\nexport class ConvertFromEntityToEntityCommand extends JSBCommand {\n constructor(\n public fromEntityId: string,\n public toEntityId: string,\n public fromPosition: Vec3,\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n fromEntityId: this.fromEntityId,\n toEntityId: this.toEntityId,\n position: this.fromPosition,\n }\n }\n commandType = 'ConvertFromEntityToEntity'\n}\n\nexport class ConvertFromEntityToSceneCommand extends JSBCommand {\n constructor(\n public fromEntityId: string,\n public position: Vec3,\n ) {\n super()\n }\n\n protected getParams(): Record<string, any> | undefined {\n return {\n fromEntityId: this.fromEntityId,\n position: this.position,\n }\n }\n\n commandType = 'ConvertFromEntityToScene'\n}\n\nexport class ConvertFromSceneToEntityCommand extends JSBCommand {\n // let entityId: String\n // let position:Vec3\n constructor(\n public entityId: string,\n public position: Vec3,\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n entityId: this.entityId,\n position: this.position,\n }\n }\n commandType = 'ConvertFromSceneToEntity'\n}\n\nexport class CreateTextureResourceCommand extends JSBCommand {\n constructor(private url: string) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n url: this.url,\n }\n }\n commandType = 'CreateTextureResource'\n}\n\nexport class InspectCommand extends JSBCommand {\n commandType = 'Inspect'\n\n constructor(readonly id: string = '') {\n super()\n }\n\n protected getParams() {\n return this.id ? { id: this.id } : { id: '' }\n }\n}\n\nexport class DestroyCommand extends JSBCommand {\n commandType = 'Destroy'\n\n constructor(readonly id: string) {\n super()\n }\n\n protected getParams() {\n return { id: this.id }\n }\n}\n\nexport class CheckWebViewCanCreateCommand extends JSBCommand {\n commandType = 'CheckWebViewCanCreate'\n\n constructor(readonly id: string = \"\") {\n super()\n }\n\n protected getParams() {\n return { id: this.id }\n }\n}\n\n/* WebSpatial Protocol Begin */\nabstract class WebSpatialProtocolCommand extends JSBCommand {\n target?: string\n features?: string\n\n async execute(): Promise<WebSpatialProtocolResult> {\n const query = this.getQuery()\n return platform.callWebSpatialProtocol(\n this.commandType,\n query,\n this.target,\n this.features,\n )\n }\n\n executeSync(): WebSpatialProtocolResult {\n const query = this.getQuery()\n return platform.callWebSpatialProtocolSync(\n this.commandType,\n query,\n this.target,\n this.features,\n )\n }\n\n private getQuery() {\n let query = undefined\n const params = this.getParams()\n if (params) {\n query = Object.keys(params)\n .map(key => {\n const value = params[key]\n const finalValue =\n typeof value === 'object' ? JSON.stringify(value) : value\n return `${key}=${encodeURIComponent(finalValue)}`\n })\n .join('&')\n }\n\n return query\n }\n}\n\nexport class createSpatialized2DElementCommand extends WebSpatialProtocolCommand {\n commandType = 'createSpatialized2DElement'\n constructor() {\n super()\n }\n protected getParams() {\n return {}\n }\n}\n\nexport class createSpatialSceneCommand extends WebSpatialProtocolCommand {\n commandType = 'createSpatialScene'\n\n constructor(\n private url: string,\n private config: SpatialSceneCreationOptionsInternal | undefined,\n public target?: string,\n public features?: string,\n ) {\n super()\n }\n protected getParams() {\n return {\n url: this.url,\n config: this.config,\n }\n }\n}\n\n// TODO: Can crypto.randomUUID be used instead including in dev environments without https\nfunction uuid(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = (Math.random() * 16) | 0\n return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)\n })\n}\n\n/* WebSpatial Protocol End */\n","export { SpatialObject } from './SpatialObject'\nexport { Spatial } from './Spatial'\nexport { SpatialSession } from './SpatialSession'\nexport { SpatialScene } from './SpatialScene'\nexport { SpatializedElement } from './SpatializedElement'\nexport { Spatialized2DElement } from './Spatialized2DElement'\nexport { SpatializedStatic3DElement } from './SpatializedStatic3DElement'\nexport { SpatializedDynamic3DElement } from './SpatializedDynamic3DElement'\nexport * from './reality'\nexport * from './types/types'\nexport * from './types/global.d'\n\n// side effects\nimport { injectSceneHook } from './scene-polyfill'\nimport { isSSREnv } from './ssr-polyfill'\nimport { spatialWindowPolyfill } from './spatial-window-polyfill'\n\nexport { isSSREnv }\n\nif (!isSSREnv() && navigator.userAgent.indexOf('WebSpatial/') > 0) {\n injectSceneHook()\n spatialWindowPolyfill()\n}\n","import { DestroyCommand, InspectCommand } from './JSBCommand'\n\n/**\n * @hidden\n * Parent class of spatial objects, should not be used directly\n */\nexport class SpatialObject {\n /** @hidden */\n constructor(\n /** @hidden */\n public readonly id: string,\n ) {}\n\n name?: string\n\n isDestroyed = false\n\n async inspect() {\n const ret = await new InspectCommand(this.id).execute()\n if (ret.success) {\n return ret.data\n }\n throw new Error(ret.errorMessage)\n }\n\n async destroy() {\n if (this.isDestroyed) {\n return\n }\n\n const ret = await new DestroyCommand(this.id).execute()\n if (ret.success) {\n this.onDestroy()\n this.isDestroyed = true\n return ret.data\n } else if (this.isDestroyed) {\n // already destroyed\n return\n }\n\n throw new Error(ret.errorMessage)\n }\n\n // override this method to do some cleanup\n protected onDestroy() {}\n}\n","import { createSpatialSceneCommand, FocusScene } from './JSBCommand'\nimport { SpatialScene } from './SpatialScene'\nimport {\n SpatialSceneCreationOptions,\n SpatialSceneType,\n SpatialSceneState,\n isValidSceneUnit,\n isValidSpatialSceneType,\n isValidWorldScalingType,\n isValidWorldAlignmentType,\n isValidBaseplateVisibilityType,\n} from './types/types'\nimport { SpatialSceneCreationOptionsInternal } from './types/internal'\n\nconst defaultSceneConfig: SpatialSceneCreationOptions = {\n defaultSize: {\n width: 1280,\n height: 720,\n },\n}\n\nconst defaultSceneConfigVolume: SpatialSceneCreationOptions = {\n defaultSize: {\n width: 0.94,\n height: 0.94,\n depth: 0.94,\n },\n}\n\nconst INTERNAL_SCHEMA_PREFIX = 'webspatial://'\n\nclass SceneManager {\n private originalOpen: any\n private static instance: SceneManager\n static getInstance() {\n if (!SceneManager.instance) {\n SceneManager.instance = new SceneManager()\n }\n return SceneManager.instance\n }\n\n init(window: WindowProxy) {\n this.originalOpen = window.open.bind(window)\n ;(window as any).open = this.open\n }\n\n private configMap: Record<string, SpatialSceneCreationOptionsInternal> = {} // name=>config\n private getConfig(name?: string) {\n if (name === undefined || !this.configMap[name]) return undefined\n return this.configMap[name]\n }\n\n // Ensure URL is absolute; only convert when a relative path is provided\n // - Keep external and special schemes untouched (http, https, data, blob, about, file, mailto, etc.)\n // - Handle protocol-relative URLs (//example.com/path)\n // - Resolve relative paths against document.baseURI (respects <base href>)\n private ensureAbsoluteUrl(raw?: string): string | undefined {\n if (!raw) return raw\n // Already has a scheme (includes internal webspatial:// which is handled earlier)\n if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(raw)) {\n return raw\n }\n // Protocol-relative URL\n if (raw.startsWith('//')) {\n return `${window.location.protocol}${raw}`\n }\n // Resolve against base URI\n try {\n return new URL(raw, document.baseURI).toString()\n } catch {\n // Fallback: leave unchanged\n return raw\n }\n }\n\n private open = (url?: string, target?: string, features?: string) => {\n // bypass internal\n if (url?.startsWith(INTERNAL_SCHEMA_PREFIX)) {\n return this.originalOpen(url, target, features)\n }\n\n // Normalize only relative URLs to absolute for platform handling\n url = this.ensureAbsoluteUrl(url)\n\n // if target is special\n if (target === '_self' || target === '_parent' || target === '_top') {\n const newWindow = this.originalOpen(url, target, features)\n return newWindow\n }\n\n const cfg = target ? this.getConfig(target) : undefined\n const cmd = new createSpatialSceneCommand(url!, cfg, target, features)\n const result = cmd.executeSync()\n\n if (typeof target === 'string' && this.configMap[target]) {\n delete this.configMap[target]\n }\n\n const id = result.data?.id\n\n if (id) {\n // send JSB to focus\n let focusCmd = new FocusScene(id)\n focusCmd.execute()\n }\n\n return result.data?.windowProxy\n }\n initScene(\n name: string,\n callback: (pre: SpatialSceneCreationOptions) => SpatialSceneCreationOptions,\n options?: { type: SpatialSceneType },\n ) {\n const sceneType = options?.type ?? 'window'\n const defaultConfig = getSceneDefaultConfig(sceneType)\n const rawReturnVal = callback({ ...defaultConfig })\n const [formattedConfig, errors] = formatSceneConfig(rawReturnVal, sceneType)\n if (errors.length > 0) {\n console.warn(`initScene ${name} with errors: ${errors.join(', ')}`)\n }\n this.configMap[name] = {\n ...formattedConfig,\n type: sceneType,\n }\n }\n}\n\nfunction pxToMeter(px: number): number {\n return px / 1360\n}\n\nfunction meterToPx(meter: number): number {\n return meter * 1360\n}\n\nfunction formatToNumber(\n str: string | number,\n targetUnit: 'px' | 'm',\n defaultUnit: 'px' | 'm',\n): number {\n if (typeof str === 'number') {\n if (\n (defaultUnit === 'px' && targetUnit === 'px') ||\n (defaultUnit === 'm' && targetUnit === 'm')\n ) {\n return str\n }\n // unit not match target\n if (defaultUnit === 'px' && targetUnit === 'm') {\n return pxToMeter(str)\n } else if (defaultUnit === 'm' && targetUnit === 'px') {\n return meterToPx(str)\n }\n // fallback\n return str\n }\n if (targetUnit === 'm') {\n if (str.endsWith('m')) {\n // 1m\n return Number(str.slice(0, -1))\n } else if (str.endsWith('px')) {\n // 100px\n return pxToMeter(Number(str.slice(0, -2)))\n } else {\n throw new Error('formatToNumber: invalid str')\n }\n } else if (targetUnit === 'px') {\n if (str.endsWith('px')) {\n // 100px\n return Number(str.slice(0, -2))\n } else if (str.endsWith('m')) {\n // 1m\n return meterToPx(Number(str.slice(0, -1)))\n } else {\n throw new Error('formatToNumber: invalid str')\n }\n } else {\n throw new Error('formatToNumber: invalid targetUnit')\n }\n}\n\nexport function formatSceneConfig(\n config: SpatialSceneCreationOptions,\n sceneType: SpatialSceneType,\n): [SpatialSceneCreationOptions, string[]] {\n // defaultSize and resizability's width/height/depth can be 100 or \"100px\" or \"1m\"\n // expect:\n // resizability should format into px\n // defaultSize should format into px if window\n // defaultSize should format into m if volume\n\n const defaultSceneConfig = getSceneDefaultConfig(sceneType)\n\n const errors: string[] = []\n\n const isWindow = sceneType === 'window'\n if (!isValidSpatialSceneType(sceneType)) {\n errors.push(`sceneType`)\n }\n\n // format defaultSize\n if (config.defaultSize) {\n const iterKeys = ['width', 'height', 'depth']\n for (let k of iterKeys) {\n if (!(k in config.defaultSize)) continue\n if (isValidSceneUnit((config.defaultSize as any)[k])) {\n ;(config.defaultSize as any)[k] = formatToNumber(\n (config.defaultSize as any)[k],\n isWindow ? 'px' : 'm',\n isWindow ? 'px' : 'm',\n )\n } else {\n ;(config.defaultSize as any)[k] = (\n defaultSceneConfig.defaultSize as any\n )[k]\n errors.push(`defaultSize.${k}`)\n }\n }\n }\n\n // format resizability\n if (config.resizability) {\n const iterKeys = ['minWidth', 'minHeight', 'maxWidth', 'maxHeight']\n for (let k of iterKeys) {\n if (!(k in config.resizability)) continue\n if (isValidSceneUnit((config.resizability as any)[k])) {\n ;(config.resizability as any)[k] = formatToNumber(\n (config.resizability as any)[k],\n 'px',\n isWindow ? 'px' : 'm',\n )\n } else {\n ;(config.resizability as any)[k] = undefined\n errors.push(`resizability.${k}`)\n }\n }\n }\n\n // check value\n if (config.worldScaling) {\n if (!isValidWorldScalingType(config.worldScaling)) {\n config.worldScaling = 'automatic'\n errors.push('worldScaling')\n }\n }\n\n if (config.worldAlignment) {\n if (!isValidWorldAlignmentType(config.worldAlignment)) {\n config.worldAlignment = 'automatic'\n errors.push('worldAlignment')\n }\n }\n\n if (config.baseplateVisibility) {\n if (!isValidBaseplateVisibilityType(config.baseplateVisibility)) {\n config.baseplateVisibility = 'automatic'\n errors.push('baseplateVisibility')\n }\n }\n\n return [config, errors]\n}\n\nexport function initScene(\n name: string,\n callback: (pre: SpatialSceneCreationOptions) => SpatialSceneCreationOptions,\n options?: { type: SpatialSceneType },\n) {\n return SceneManager.getInstance().initScene(name, callback, options)\n}\n\nexport function hijackWindowOpen(window: WindowProxy) {\n SceneManager.getInstance().init(window)\n}\n\nexport function hijackWindowATag(openedWindow: WindowProxy) {\n openedWindow!.document.onclick = function (e) {\n let element = e.target as HTMLElement | null\n let found = false\n\n // Look for <a> element in the clicked elements parents and if found override navigation behavior if needed\n while (!found) {\n if (element && element.tagName == 'A') {\n // When using libraries like react route's <Link> it sets an onclick event, when this happens we should do nothing and let that occur\n\n // if onClick is set for the element, the raw onclick will be noop() trapped so the onclick check is no longer trustable\n // we handle all the scenarios\n\n if (handleATag(e)) {\n return false // prevent default action and stop event propagation\n }\n\n return true\n }\n if (element && element.parentElement) {\n element = element.parentElement\n } else {\n break\n }\n }\n }\n}\n\nfunction handleATag(event: MouseEvent) {\n const targetElement = event.target as HTMLElement\n if (targetElement.tagName === 'A') {\n const link = targetElement as HTMLAnchorElement\n const target = link.target\n const url = link.href\n\n if (target && target !== '_self') {\n event.preventDefault()\n window.open(url, target)\n return true\n }\n }\n}\n\nfunction getSceneDefaultConfig(sceneType: SpatialSceneType) {\n return sceneType === 'window' ? defaultSceneConfig : defaultSceneConfigVolume\n}\n\nasync function injectScenePolyfill() {\n if (!window.opener) return\n\n const state = await SpatialScene.getInstance().getState()\n\n // only run this in pending state\n if (state !== SpatialSceneState.pending) return\n\n function onContentLoaded(callback: any) {\n if (\n document.readyState === 'interactive' ||\n document.readyState === 'complete'\n ) {\n callback()\n } else {\n document.addEventListener('DOMContentLoaded', callback)\n }\n }\n\n onContentLoaded(async () => {\n let provideDefaultSceneConfig = getSceneDefaultConfig(\n window.xrCurrentSceneType ?? 'window',\n )\n let cfg = provideDefaultSceneConfig\n if (typeof window.xrCurrentSceneDefaults === 'function') {\n try {\n cfg = await window.xrCurrentSceneDefaults?.(provideDefaultSceneConfig)\n } catch (error) {\n console.error(error)\n }\n }\n // fixme: this duration is too short so that hide and show is at racing, so add a little delay to avoid\n await new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve(null)\n }, 1000)\n })\n\n const sceneType = window.xrCurrentSceneType ?? 'window'\n const [formattedConfig, errors] = formatSceneConfig(cfg, sceneType)\n if (errors.length > 0) {\n console.warn(\n `window.xrCurrentSceneDefaults with errors: ${errors.join(', ')}`,\n )\n }\n await SpatialScene.getInstance().updateSceneCreationConfig({\n ...formattedConfig,\n type: sceneType,\n })\n })\n}\n\nexport function injectSceneHook() {\n hijackWindowOpen(window)\n hijackWindowATag(window)\n injectScenePolyfill()\n}\n","import {\n SpatialSceneCreationOptions,\n SpatialSceneProperties,\n} from './types/types'\nimport { SpatialSceneCreationOptionsInternal } from \"./types/internal\"\nimport {\n AddSpatializedElementToSpatialScene,\n GetSpatialSceneState,\n UpdateSceneConfig,\n UpdateSpatialSceneProperties,\n} from './JSBCommand'\n\nimport { SpatializedElement } from './SpatializedElement'\nimport { SpatialObject } from './SpatialObject'\nimport { SpatialSceneState } from './types/internal'\n\nlet instance: SpatialScene\n\n/**\n * Represents the spatial scene that contains all spatialized elements.\n * This class follows the singleton pattern - only one instance exists per application.\n * The scene manages the overall spatial environment properties and contains all spatial elements.\n */\nexport class SpatialScene extends SpatialObject {\n /**\n * Gets the singleton instance of the SpatialScene.\n * Creates a new instance if one doesn't exist yet.\n * @returns The singleton SpatialScene instance\n */\n static getInstance(): SpatialScene {\n if (!instance) {\n instance = new SpatialScene('')\n }\n return instance\n }\n\n /**\n * Updates the properties of the spatial scene.\n * This can include background settings, lighting, and other scene-wide properties.\n * @param properties Partial set of properties to update\n * @returns Promise resolving when the update is complete\n */\n async updateSpatialProperties(properties: Partial<SpatialSceneProperties>) {\n return new UpdateSpatialSceneProperties(properties).execute()\n }\n\n /**\n * Adds a spatialized element to the scene.\n * This makes the element visible and interactive in the spatial environment.\n * @param element The SpatializedElement to add to the scene\n * @returns Promise resolving when the element is added\n */\n async addSpatializedElement(element: SpatializedElement) {\n return new AddSpatializedElementToSpatialScene(element).execute()\n }\n\n /**\n * Updates the scene creation configuration.\n * This allows changing scene parameters after initial creation.\n * @param config The new scene creation configuration\n * @returns Promise resolving when the update is complete\n */\n async updateSceneCreationConfig(config: SpatialSceneCreationOptionsInternal) {\n return new UpdateSceneConfig(config).execute()\n }\n\n /**\n * Gets the current state of the spatial scene.\n * This includes information about active elements and scene configuration.\n * @returns Promise resolving to the current SpatialSceneState\n */\n async getState(): Promise<SpatialSceneState> {\n return (await new GetSpatialSceneState().execute()).data.name\n }\n}","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\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 enableRotateStartGesture: boolean\n enableRotateGesture: boolean\n enableRotateEndGesture: boolean\n enableMagnifyStartGesture: boolean\n enableMagnifyGesture: boolean\n enableMagnifyEndGesture: boolean\n}\n\nexport interface Spatialized2DElementProperties\n extends SpatializedElementProperties {\n scrollPageEnabled: boolean\n cornerRadius: CornerRadius\n material: BackgroundMaterialType\n scrollEdgeInsetsMarginRight: number\n}\n\nexport interface SpatializedStatic3DElementProperties\n extends SpatializedElementProperties {\n modelURL: string\n modelTransform?: number[]\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 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 SpatialEntityEventType = 'spatialtap' //| 'drag' | 'rotate' | 'scale'\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 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}\n\nexport type SpatialTapEvent = CustomEvent<SpatialTapEventDetail>\n\nexport interface SpatialDragEventDetail {\n location3D: Point3D\n startLocation3D: Point3D\n translation3D: Vec3\n predictedEndTranslation3D: Vec3\n predictedEndLocation3D: Point3D\n velocity: Size\n}\n\nexport type SpatialDragEvent = CustomEvent<SpatialDragEventDetail>\n\nexport type SpatialDragEndEvent = SpatialDragEvent\n\nexport interface SpatialRotateEventDetail {\n rotation: { vector: [number, number, number, number] }\n startAnchor3D: Vec3\n startLocation3D: Point3D\n}\n\nexport type SpatialRotateEvent = CustomEvent<SpatialRotateEventDetail>\n\nexport type SpatialRotateEndEvent = SpatialRotateEvent\n\nexport interface SpatialMagnifyEventDetail {\n magnification: number\n velocity: number\n startAnchor3D: Vec3\n startLocation3D: Point3D\n}\n\nexport type SpatialMagnifyEvent = CustomEvent<SpatialMagnifyEventDetail>\n\nexport type SpatialMagnifyEndEvent = SpatialMagnifyEvent\n\nexport type SpatialEntityOrReality = SpatialEntity | SpatializedDynamic3DElement\n","import {\n createSpatialized2DElementCommand,\n CreateSpatializedDynamic3DElementCommand,\n CreateSpatializedStatic3DElementCommand,\n} from './JSBCommand'\nimport { Spatialized2DElement } from './Spatialized2DElement'\nimport { SpatializedStatic3DElement } from './SpatializedStatic3DElement'\nimport { SpatializedDynamic3DElement } from './SpatializedDynamic3DElement'\n\nexport async function createSpatialized2DElement(): Promise<Spatialized2DElement> {\n const result = await new createSpatialized2DElementCommand().execute()\n if (!result.success) {\n throw new Error('createSpatialized2DElement failed')\n } else {\n const { id, windowProxy } = result.data!\n // set base href to make sure the relative url is correct\n windowProxy.document.head.innerHTML = `<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <base href=\"${document.baseURI}\">`\n return new Spatialized2DElement(id, windowProxy)\n }\n}\n\nexport async function createSpatializedStatic3DElement(\n modelURL: string,\n): Promise<SpatializedStatic3DElement> {\n const result = await new CreateSpatializedStatic3DElementCommand(\n modelURL,\n ).execute()\n if (!result.success) {\n throw new Error('createSpatializedStatic3DElement failed')\n } else {\n const { id } = result.data\n return new SpatializedStatic3DElement(id)\n }\n}\n\nexport async function createSpatializedDynamic3DElement(): Promise<SpatializedDynamic3DElement> {\n const result = await new CreateSpatializedDynamic3DElementCommand().execute()\n if (!result.success) {\n throw new Error('createSpatializedDynamic3DElement failed')\n } else {\n const { id } = result.data\n return new SpatializedDynamic3DElement(id)\n }\n}\n","import {\n AddSpatializedElementToSpatialized2DElement,\n UpdateSpatialized2DElementProperties,\n} from './JSBCommand'\nimport { hijackWindowATag } from './scene-polyfill'\nimport { SpatializedElement } from './SpatializedElement'\nimport { Spatialized2DElementProperties } from './types/types'\n\n/**\n * Represents a 2D HTML element that has been spatialized in 3D space.\n * This class handles the integration between 2D web content and the 3D spatial environment,\n * allowing HTML elements to be positioned and interacted with in spatial applications.\n */\nexport class Spatialized2DElement extends SpatializedElement {\n /**\n * Creates a new spatialized 2D element.\n * @param id Unique identifier for this element\n * @param windowProxy Reference to the window object containing the 2D content\n */\n constructor(\n id: string,\n readonly windowProxy: WindowProxy,\n ) {\n super(id)\n // Hijack anchor tag events to handle navigation within the spatial context\n hijackWindowATag(windowProxy)\n }\n\n /**\n * Updates the properties of this 2D element.\n * This can include size, position, background, and other visual properties.\n * @param properties Partial set of properties to update\n * @returns Promise resolving when the update is complete\n */\n async updateProperties(properties: Partial<Spatialized2DElementProperties>) {\n return new UpdateSpatialized2DElementProperties(this, properties).execute()\n }\n\n /**\n * Adds a child spatialized element to this 2D element.\n * This allows for creating hierarchical structures of spatial elements.\n * @param element The child element to add\n * @returns Promise resolving when the element is added\n */\n async addSpatializedElement(element: SpatializedElement) {\n return new AddSpatializedElementToSpatialized2DElement(\n this,\n element,\n ).execute()\n }\n}\n","import { UpdateSpatializedElementTransform } from './JSBCommand'\nimport { WebSpatialProtocolResult } from './platform-adapter/interface'\nimport { SpatialObject } from './SpatialObject'\nimport { SpatialWebEvent } from './SpatialWebEvent'\nimport { createSpatialEvent } from './SpatialWebEventCreator'\nimport {\n CubeInfo,\n SpatialDragEndEvent,\n SpatialDragEvent,\n SpatializedElementProperties,\n SpatialMagnifyEndEvent,\n SpatialMagnifyEvent,\n SpatialRotateEndEvent,\n SpatialRotateEvent,\n SpatialTapEvent,\n} from './types/types'\nimport {\n CubeInfoMsg,\n ObjectDestroyMsg,\n SpatialDragEndMsg,\n SpatialDragMsg,\n SpatialMagnifyEndMsg,\n SpatialMagnifyMsg,\n SpatialRotateEndMsg,\n SpatialRotateMsg,\n SpatialTapMsg,\n SpatialWebMsgType,\n TransformMsg,\n} from './WebMsgCommand'\n\n/**\n * Abstract base class for all spatialized elements in the WebSpatial environment.\n * Provides common functionality for elements that can exist in 3D space,\n * including transformation handling and gesture event processing.\n */\nexport abstract class SpatializedElement extends SpatialObject {\n /**\n * Creates a new spatialized element with the specified ID.\n * Registers the element to receive spatial events.\n * @param id Unique identifier for this element\n */\n constructor(public readonly id: string) {\n super(id)\n\n SpatialWebEvent.addEventReceiver(id, this.onReceiveEvent.bind(this))\n }\n\n /**\n * Updates the properties of this spatialized element.\n * Must be implemented by derived classes to handle specific property updates.\n * @param properties Partial set of properties to update\n * @returns Promise resolving to the result of the update operation\n */\n abstract updateProperties(\n properties: Partial<SpatializedElementProperties>,\n ): Promise<WebSpatialProtocolResult>\n\n /**\n * Updates the transformation matrix of this element in 3D space.\n * This affects the position, rotation, and scale of the element.\n * @param matrix The new transformation matrix\n * @returns Promise resolving when the transform is updated\n */\n async updateTransform(matrix: DOMMatrix) {\n return new UpdateSpatializedElementTransform(this, matrix).execute()\n }\n\n /**\n * Information about the element's bounding cube.\n * Used for spatial calculations and hit testing.\n */\n private _cubeInfo?: CubeInfo\n\n /**\n * Gets the current cube information for this element.\n * @returns The current CubeInfo or undefined if not set\n */\n get cubeInfo() {\n return this._cubeInfo\n }\n\n /**\n * The current transformation matrix of this element.\n */\n private _transform?: DOMMatrix\n\n /**\n * The inverse of the current transformation matrix.\n * Used for converting world coordinates to local coordinates.\n */\n private _transformInv?: DOMMatrix\n\n /**\n * Gets the current transformation matrix.\n * @returns The current transformation matrix or undefined if not set\n */\n get transform() {\n return this._transform\n }\n\n /**\n * Gets the inverse of the current transformation matrix.\n * @returns The inverse transformation matrix or undefined if not set\n */\n get transformInv() {\n return this._transformInv\n }\n\n /**\n * Processes events received from the WebSpatial environment.\n * Handles various spatial events like transforms, gestures, and interactions.\n * @param data The event data received from the WebSpatial system\n */\n protected onReceiveEvent(\n data:\n | CubeInfoMsg\n | TransformMsg\n | SpatialTapMsg\n | SpatialDragMsg\n | SpatialDragEndMsg\n | SpatialRotateMsg\n | SpatialRotateEndMsg\n | ObjectDestroyMsg,\n ) {\n const { type } = data\n if (type === SpatialWebMsgType.objectdestroy) {\n this.isDestroyed = true\n } else if (type === SpatialWebMsgType.cubeInfo) {\n // Handle cube info updates (bounding box information)\n const cubeInfoMsg = data as CubeInfoMsg\n this._cubeInfo = new CubeInfo(cubeInfoMsg.size, cubeInfoMsg.origin)\n } else if (type === SpatialWebMsgType.transform) {\n // Handle transformation matrix updates\n this._transform = new DOMMatrix([\n data.detail.column0[0],\n data.detail.column0[1],\n data.detail.column0[2],\n 0,\n data.detail.column1[0],\n data.detail.column1[1],\n data.detail.column1[2],\n 0,\n data.detail.column2[0],\n data.detail.column2[1],\n data.detail.column2[2],\n 0,\n data.detail.column3[0],\n data.detail.column3[1],\n data.detail.column3[2],\n 1,\n ])\n this._transformInv = this._transform.inverse()\n } else if (type === SpatialWebMsgType.spatialtap) {\n // Handle tap gestures\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialtap,\n (data as SpatialTapMsg).detail,\n )\n this._onSpatialTap?.(event)\n } else if (type === SpatialWebMsgType.spatialdrag) {\n // Handle drag gestures, with special handling for drag start\n if (!this._isDragging) {\n const dragStartEvent = createSpatialEvent(\n SpatialWebMsgType.spatialdragstart,\n (data as SpatialDragMsg).detail,\n )\n this._onSpatialDragStart?.(dragStartEvent)\n }\n this._isDragging = true\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialdrag,\n (data as SpatialDragMsg).detail,\n )\n this._onSpatialDrag?.(event)\n } else if (type === SpatialWebMsgType.spatialdragend) {\n this._isDragging = false\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialdragend,\n (data as SpatialDragEndMsg).detail,\n )\n this._onSpatialDragEnd?.(event)\n } else if (type === SpatialWebMsgType.spatialrotate) {\n if (!this._isRotating) {\n const rotationStartEvent = createSpatialEvent(\n SpatialWebMsgType.spatialrotatestart,\n (data as SpatialRotateMsg).detail,\n )\n this._onSpatialRotateStart?.(rotationStartEvent)\n }\n this._isRotating = true\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialrotate,\n (data as SpatialRotateMsg).detail,\n )\n this._onSpatialRotate?.(event)\n } else if (type === SpatialWebMsgType.spatialrotateend) {\n this._isRotating = false\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialrotateend,\n (data as SpatialRotateEndMsg).detail,\n )\n this._onSpatialRotateEnd?.(event)\n } else if (type === SpatialWebMsgType.spatialmagnify) {\n if (!this._isMagnify) {\n const magnifyStartEvent = createSpatialEvent(\n SpatialWebMsgType.spatialmagnifystart,\n (data as SpatialMagnifyMsg).detail,\n )\n this._onSpatialMagnifyStart?.(magnifyStartEvent)\n }\n this._isMagnify = true\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialmagnify,\n (data as SpatialMagnifyMsg).detail,\n )\n this._onSpatialMagnify?.(event)\n } else if (type === SpatialWebMsgType.spatialmagnifyend) {\n this._isMagnify = false\n const event = createSpatialEvent(\n SpatialWebMsgType.spatialmagnifyend,\n (data as SpatialMagnifyEndMsg).detail,\n )\n this._onSpatialMagnifyEnd?.(event)\n }\n }\n\n private _onSpatialTap?: (event: SpatialTapEvent) => void\n set onSpatialTap(value: (event: SpatialTapEvent) => void | undefined) {\n this._onSpatialTap = value\n this.updateProperties({\n enableTapGesture: value !== undefined,\n })\n }\n\n private _isDragging = false\n private _onSpatialDragStart?: (event: SpatialDragEvent) => void\n set onSpatialDragStart(value: (event: SpatialDragEvent) => void | undefined) {\n this._onSpatialDragStart = value\n this.updateProperties({\n enableDragStartGesture: this._onSpatialDragStart !== undefined,\n })\n }\n\n private _onSpatialDrag?: (event: SpatialDragEvent) => void\n set onSpatialDrag(value: (event: SpatialDragEvent) => void | undefined) {\n this._onSpatialDrag = value\n this.updateProperties({\n enableDragGesture: this._onSpatialDrag !== undefined,\n })\n }\n\n private _onSpatialDragEnd?: (event: SpatialDragEndEvent) => void\n set onSpatialDragEnd(\n value: ((event: SpatialDragEndEvent) => void) | undefined,\n ) {\n this._onSpatialDragEnd = value\n this.updateProperties({\n enableDragEndGesture: value !== undefined,\n })\n }\n\n private _isRotating = false\n private _onSpatialRotateStart?: (event: SpatialRotateEvent) => void\n set onSpatialRotateStart(\n value: ((event: SpatialRotateEvent) => void) | undefined,\n ) {\n this._onSpatialRotateStart = value\n this.updateProperties({\n enableRotateStartGesture: this._onSpatialRotateStart !== undefined,\n })\n }\n\n private _onSpatialRotate?: (event: SpatialRotateEvent) => void\n set onSpatialRotate(\n value: ((event: SpatialRotateEvent) => void) | undefined,\n ) {\n this._onSpatialRotate = value\n this.updateProperties({\n enableRotateGesture: this._onSpatialRotate !== undefined,\n })\n }\n\n private _onSpatialRotateEnd?: (event: SpatialRotateEndEvent) => void\n set onSpatialRotateEnd(\n value: ((event: SpatialRotateEndEvent) => void) | undefined,\n ) {\n this._onSpatialRotateEnd = value\n this.updateProperties({\n enableRotateEndGesture: value !== undefined,\n })\n }\n\n private _isMagnify = false\n private _onSpatialMagnifyStart?: (event: SpatialMagnifyEvent) => void\n set onSpatialMagnifyStart(\n value: ((event: SpatialMagnifyEvent) => void) | undefined,\n ) {\n this._onSpatialMagnifyStart = value\n this.updateProperties({\n enableMagnifyStartGesture: value !== undefined,\n })\n }\n\n private _onSpatialMagnify?: (event: SpatialMagnifyEvent) => void\n set onSpatialMagnify(\n value: ((event: SpatialMagnifyEvent) => void) | undefined,\n ) {\n this._onSpatialMagnify = value\n this.updateProperties({\n enableMagnifyGesture: value !== undefined,\n })\n }\n\n private _onSpatialMagnifyEnd?: (event: SpatialMagnifyEndEvent) => void\n set onSpatialMagnifyEnd(\n value: ((event: SpatialMagnifyEndEvent) => void) | undefined,\n ) {\n this._onSpatialMagnifyEnd = value\n this.updateProperties({\n enableMagnifyEndGesture: value !== undefined,\n })\n }\n\n /**\n * Cleans up resources when this element is destroyed.\n * Removes event receivers to prevent memory leaks.\n */\n override onDestroy() {\n SpatialWebEvent.removeEventReceiver(this.id)\n }\n}\n","import { SpatialWebMsgType } from './WebMsgCommand'\n\nexport function createSpatialEvent<T>(\n type: SpatialWebMsgType,\n detail: T,\n): CustomEvent<T> {\n return new CustomEvent<T>(type, {\n bubbles: true,\n cancelable: false,\n detail,\n })\n}\n","import { UpdateSpatializedStatic3DElementProperties } from './JSBCommand'\nimport { SpatializedElement } from './SpatializedElement'\nimport { SpatializedStatic3DElementProperties } from './types/types'\nimport { SpatialWebMsgType } from './WebMsgCommand'\n\n/**\n * Represents a static 3D model element in the spatial environment.\n * This class handles loading and displaying pre-built 3D models from URLs,\n * and provides events for load success and failure.\n */\nexport class SpatializedStatic3DElement extends SpatializedElement {\n /**\n * Promise resolver for the ready state.\n * Used to resolve the ready promise when the model is loaded.\n */\n private _readyResolve?: (success: boolean) => void\n\n /**\n * Caches the last model URL to detect changes.\n * Used to reset the ready promise when the model URL changes.\n */\n private modelURL: string = ''\n\n /**\n * Creates a new promise for tracking the ready state of the model.\n * @returns Promise that resolves when the model is loaded (true) or fails to load (false)\n */\n private createReadyPromise() {\n return new Promise<boolean>(resolve => {\n this._readyResolve = resolve\n })\n }\n\n /**\n * Promise that resolves when the model is loaded.\n * Resolves to true on successful load, false on failure.\n */\n ready: Promise<boolean> = this.createReadyPromise()\n\n /**\n * Updates the properties of this static 3D element.\n * Handles special case for modelURL changes by resetting the ready promise.\n * @param properties Partial set of properties to update\n * @returns Promise resolving when the update is complete\n */\n async updateProperties(\n properties: Partial<SpatializedStatic3DElementProperties>,\n ) {\n if (properties.modelURL !== undefined) {\n if (this.modelURL !== properties.modelURL) {\n this.modelURL = properties.modelURL\n this.ready = this.createReadyPromise()\n }\n }\n return new UpdateSpatializedStatic3DElementProperties(\n this,\n properties,\n ).execute()\n }\n\n /**\n * Processes events received from the WebSpatial environment.\n * Handles model loading events in addition to base spatial events.\n * @param data The event data received from the WebSpatial system\n */\n override onReceiveEvent(data: { type: SpatialWebMsgType }) {\n if (data.type === SpatialWebMsgType.modelloaded) {\n // Handle successful model loading\n this._onLoadCallback?.()\n this._readyResolve?.(true)\n } else if (data.type === SpatialWebMsgType.modelloadfailed) {\n // Handle model loading failure\n this._onLoadFailureCallback?.()\n this._readyResolve?.(false)\n } else {\n // Handle other spatial events using the base class implementation\n super.onReceiveEvent(data as any)\n }\n }\n\n /**\n * Callback function for successful model loading.\n */\n private _onLoadCallback?: () => void\n\n /**\n * Sets the callback function for successful model loading.\n * @param callback Function to call when the model is loaded successfully\n */\n set onLoadCallback(callback: undefined | (() => void)) {\n this._onLoadCallback = callback\n }\n\n /**\n * Callback function for model loading failure.\n */\n private _onLoadFailureCallback?: undefined | (() => void)\n\n /**\n * Sets the callback function for model loading failure.\n * @param callback Function to call when the model fails to load\n */\n set onLoadFailureCallback(callback: undefined | (() => void)) {\n this._onLoadFailureCallback = callback\n }\n\n updateModelTransform(transform: DOMMatrix) {\n const modelTransform = Array.from(transform.toFloat64Array())\n this.updateProperties({ modelTransform })\n }\n}\n","import {\n AddEntityToDynamic3DCommand,\n SetParentForEntityCommand,\n UpdateSpatializedDynamic3DElementProperties,\n} from './JSBCommand'\nimport { SpatialEntity } from './reality'\nimport { SpatializedElement } from './SpatializedElement'\nimport {\n SpatialEntityOrReality,\n SpatializedElementProperties,\n} from './types/types'\nexport class SpatializedDynamic3DElement extends SpatializedElement {\n children: SpatialEntityOrReality[] = []\n constructor(id: string) {\n super(id)\n }\n\n async addEntity(entity: SpatialEntity) {\n const ans = new SetParentForEntityCommand(entity.id, this.id).execute()\n this.children.push(entity)\n entity.parent = this\n return ans\n }\n async updateProperties(properties: Partial<SpatializedElementProperties>) {\n return new UpdateSpatializedDynamic3DElementProperties(\n this,\n properties,\n ).execute()\n }\n}\n","import {\n CreateModelComponentCommand,\n CreateModelAssetCommand,\n CreateSpatialEntityCommand,\n CreateSpatialGeometryCommand,\n CreateSpatialModelEntityCommand,\n CreateSpatialUnlitMaterialCommand,\n} from '../JSBCommand'\nimport {\n ModelComponentOptions,\n ModelAssetOptions,\n SpatialGeometryOptions,\n SpatialModelEntityCreationOptions,\n SpatialUnlitMaterialOptions,\n SpatialEntityUserData,\n} from '../types/types'\nimport { SpatialEntity, SpatialModelEntity } from './entity'\nimport { ModelComponent } from './component'\nimport { SpatialGeometry } from './geometry'\nimport { SpatialUnlitMaterial } from './material'\nimport { SpatialModelAsset } from './resource'\n\nexport async function createSpatialEntity(\n userData?: SpatialEntityUserData,\n): Promise<SpatialEntity> {\n const result = await new CreateSpatialEntityCommand(userData?.name).execute()\n if (!result.success) {\n throw new Error('createSpatialEntity failed:' + result?.errorMessage)\n } else {\n const { id } = result.data\n return new SpatialEntity(id, userData)\n }\n}\n\nexport async function createSpatialGeometry<T extends SpatialGeometry>(\n ctor: new (...args: any[]) => T,\n options: SpatialGeometryOptions,\n) {\n const result = await new CreateSpatialGeometryCommand(\n (ctor as any).type,\n options,\n ).execute()\n if (!result.success) {\n throw new Error('createSpatialGeometry failed:' + result?.errorMessage)\n } else {\n const { id } = result.data\n return new ctor(id, options) as T\n }\n}\n\nexport async function createSpatialUnlitMaterial(\n options: SpatialUnlitMaterialOptions,\n) {\n const result = await new CreateSpatialUnlitMaterialCommand(options).execute()\n if (!result.success) {\n throw new Error('createSpatialUnlitMaterial failed:' + result?.errorMessage)\n } else {\n const { id } = result.data\n return new SpatialUnlitMaterial(id, options)\n }\n}\n\nexport async function createModelComponent(options: ModelComponentOptions) {\n const result = await new CreateModelComponentCommand(options).execute()\n if (!result.success) {\n throw new Error('createModelComponent failed:' + result?.errorMessage)\n } else {\n const { id } = result.data\n return new ModelComponent(id, options)\n }\n}\n\nexport async function createSpatialModelEntity(\n options: SpatialModelEntityCreationOptions,\n userData?: SpatialEntityUserData,\n) {\n const result = await new CreateSpatialModelEntityCommand(options).execute()\n if (!result.success) {\n throw new Error('createSpatialModelEntity failed:' + result?.errorMessage)\n } else {\n const { id } = result.data\n return new SpatialModelEntity(id, options, userData)\n }\n}\n\nexport async function createModelAsset(options: ModelAssetOptions) {\n const result = await new CreateModelAssetCommand(options).execute()\n if (!result.success) {\n throw new Error('createModelAsset failed:' + result?.errorMessage)\n } else {\n const { id } = result.data\n return new SpatialModelAsset(id, options)\n }\n}\n","import {\n ConvertFromEntityToEntityCommand,\n ConvertFromEntityToSceneCommand,\n ConvertFromSceneToEntityCommand,\n SetParentForEntityCommand,\n} from './../../JSBCommand'\nimport {\n SpatialEntityEventType,\n SpatialEntityOrReality,\n SpatialEntityUserData,\n Vec3,\n} from '../../types/types'\nimport {\n AddComponentToEntityCommand,\n AddEntityToEntityCommand,\n RemoveEntityFromParentCommand,\n UpdateEntityEventCommand,\n UpdateEntityPropertiesCommand,\n} from '../../JSBCommand'\nimport { SpatialObject } from '../../SpatialObject'\nimport { SpatialEntityProperties } from '../../types/types'\nimport { SpatialComponent } from '../component/SpatialComponent'\nimport { SpatialWebEvent } from '../../SpatialWebEvent'\nimport { createSpatialEvent } from '../../SpatialWebEventCreator'\nimport {\n CubeInfoMsg,\n ObjectDestroyMsg,\n SpatialDragEndMsg,\n SpatialDragMsg,\n SpatialMagnifyMsg,\n SpatialRotateEndMsg,\n SpatialRotateMsg,\n SpatialTapMsg,\n SpatialWebMsgType,\n TransformMsg,\n} from '../../WebMsgCommand'\n\nexport class SpatialEntity extends SpatialObject {\n position: Vec3 = { x: 0, y: 0, z: 0 }\n rotation: Vec3 = { x: 0, y: 0, z: 0 }\n scale: Vec3 = { x: 1, y: 1, z: 1 }\n\n events: Record<string, (data: any) => void> = {}\n children: SpatialEntity[] = []\n parent: SpatialEntityOrReality | null = null\n constructor(\n id: string,\n public userData?: SpatialEntityUserData,\n ) {\n super(id)\n SpatialWebEvent.addEventReceiver(id, this.onReceiveEvent)\n }\n\n async addComponent(component: SpatialComponent) {\n return new AddComponentToEntityCommand(this, component).execute()\n }\n async setPosition(position: Vec3) {\n return this.updateTransform({ position })\n }\n async setRotation(rotation: Vec3) {\n return this.updateTransform({ rotation })\n }\n async setScale(scale: Vec3) {\n return this.updateTransform({ scale })\n }\n\n async addEntity(ent: SpatialEntity) {\n const ans = await new SetParentForEntityCommand(ent.id, this.id).execute()\n this.children.push(ent)\n ent.parent = this\n return ans\n }\n async removeFromParent() {\n const ans = await new SetParentForEntityCommand(\n this.id,\n undefined,\n ).execute()\n if (this.parent) {\n this.parent.children = this.parent.children.filter(\n child => child.id !== this.id,\n )\n this.parent = null\n }\n return ans\n }\n\n async updateTransform(properties: Partial<SpatialEntityProperties>) {\n this.position = properties.position ?? this.position\n this.rotation = properties.rotation ?? this.rotation\n this.scale = properties.scale ?? this.scale\n return new UpdateEntityPropertiesCommand(this, properties).execute()\n }\n\n async addEvent(type: SpatialEntityEventType, callback: (data: any) => void) {\n if (this.events[type]) {\n // replace if exist\n this.events[type] = callback\n } else {\n try {\n await this.updateEntityEvent(type, true)\n this.events[type] = callback\n } catch (error) {\n console.error('addEvent failed', type)\n }\n }\n }\n\n async removeEvent(eventName: SpatialEntityEventType) {\n if (this.events[eventName]) {\n delete this.events[eventName]\n try {\n await this.updateEntityEvent(eventName, false)\n } catch (error) {\n console.error('removeEvent failed', eventName)\n }\n }\n }\n\n async updateEntityEvent(\n eventName: SpatialEntityEventType,\n isEnable: boolean,\n ) {\n return new UpdateEntityEventCommand(this, eventName, isEnable).execute()\n }\n private onReceiveEvent = (\n data: // | CubeInfoMsg\n // | TransformMsg\n | SpatialTapMsg\n // | SpatialDragMsg\n // | SpatialDragEndMsg\n // | SpatialRotateMsg\n // | SpatialRotateEndMsg\n | ObjectDestroyMsg,\n ) => {\n // console.log('SpatialEntityEvent', data)\n const { type } = data\n if (type === SpatialWebMsgType.objectdestroy) {\n this.isDestroyed = true\n }\n // tap\n else if (type === SpatialWebMsgType.spatialtap) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialtap,\n (data as SpatialTapMsg).detail,\n )\n this.dispatchEvent(evt)\n } else if (type === SpatialWebMsgType.spatialdragstart) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialdragstart,\n (data as SpatialDragMsg).detail,\n )\n this.dispatchEvent(evt)\n } else if (type === SpatialWebMsgType.spatialdrag) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialdrag,\n (data as SpatialDragMsg).detail,\n )\n this.dispatchEvent(evt)\n } else if (type === SpatialWebMsgType.spatialdragend) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialdragend,\n (data as SpatialDragEndMsg).detail,\n )\n this.dispatchEvent(evt)\n }\n // rotate\n else if (type === SpatialWebMsgType.spatialrotatestart) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialrotatestart,\n (data as SpatialRotateMsg).detail,\n )\n this.dispatchEvent(evt)\n } else if (type === SpatialWebMsgType.spatialrotate) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialrotate,\n (data as SpatialRotateMsg).detail,\n )\n this.dispatchEvent(evt)\n } else if (type === SpatialWebMsgType.spatialrotateend) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialrotateend,\n (data as SpatialRotateEndMsg).detail,\n )\n this.dispatchEvent(evt)\n }\n // magnify\n else if (type === SpatialWebMsgType.spatialmagnifystart) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialmagnifystart,\n (data as SpatialMagnifyMsg).detail,\n )\n this.dispatchEvent(evt)\n } else if (type === SpatialWebMsgType.spatialmagnify) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialmagnify,\n (data as SpatialMagnifyMsg).detail,\n )\n this.dispatchEvent(evt)\n } else if (type === SpatialWebMsgType.spatialmagnifyend) {\n const evt = createSpatialEvent(\n SpatialWebMsgType.spatialmagnifyend,\n (data as SpatialMagnifyMsg).detail,\n )\n this.dispatchEvent(evt)\n }\n }\n\n dispatchEvent(evt: CustomEvent) {\n // Set origin once at the first dispatch in the bubbling chain\n if (!(evt as any).__origin) {\n Object.defineProperty(evt, '__origin', { value: this, enumerable: false })\n }\n this.events[evt.type]?.(evt)\n if (evt.bubbles && !evt.cancelBubble) {\n if (this.parent && this.parent instanceof SpatialEntity) {\n this.parent.dispatchEvent(evt)\n }\n }\n }\n\n protected onDestroy(): void {\n SpatialWebEvent.removeEventReceiver(this.id)\n // handle children\n this.children.forEach(child => {\n child.parent = null\n })\n this.children = []\n // handle parent\n if (this.parent) {\n this.parent.children = this.parent.children.filter(\n child => child.id !== this.id,\n )\n this.parent = null\n }\n }\n // onUpdate(properties: SpatialEntityProperties) {\n // this.position = properties.position\n // this.rotation = properties.rotation\n // this.scale = properties.scale\n // }\n async convertFromEntityToEntity(\n fromEntityId: string,\n toEntityId: string,\n position: Vec3,\n ) {\n return new ConvertFromEntityToEntityCommand(\n fromEntityId,\n toEntityId,\n position,\n ).execute()\n }\n\n async convertFromEntityToScene(fromEntityId: string, position: Vec3) {\n return new ConvertFromEntityToSceneCommand(fromEntityId, position).execute()\n }\n async convertFromSceneToEntity(entityId: string, position: Vec3) {\n return new ConvertFromSceneToEntityCommand(entityId, position).execute()\n }\n}\n","import {\n SpatialEntityUserData,\n SpatialModelEntityCreationOptions,\n} from '../../types/types'\nimport { SpatialEntity } from './SpatialEntity'\n\nexport class SpatialModelEntity extends SpatialEntity {\n constructor(\n public id: string,\n public options?: SpatialModelEntityCreationOptions,\n public userData?: SpatialEntityUserData,\n ) {\n super(id, userData)\n }\n}\n","import { SpatialObject } from '../../SpatialObject'\nimport { SpatialWebEvent } from '../../SpatialWebEvent'\nimport { ObjectDestroyMsg, SpatialWebMsgType } from '../../WebMsgCommand'\n\nexport class SpatialComponent extends SpatialObject {\n constructor(id: string) {\n super(id)\n SpatialWebEvent.addEventReceiver(id, this.onReceiveEvent)\n }\n\n private onReceiveEvent = (data: ObjectDestroyMsg) => {\n const { type } = data\n if (type === SpatialWebMsgType.objectdestroy) {\n this.isDestroyed = true\n }\n }\n}\n","import { ModelComponentOptions } from '../../types/types'\nimport { SpatialComponent } from './SpatialComponent'\n\nexport class ModelComponent extends SpatialComponent {\n constructor(\n id: string,\n public options: ModelComponentOptions,\n ) {\n super(id)\n }\n}\n","import { UpdateUnlitMaterialProperties } from '../../JSBCommand'\nimport { SpatialUnlitMaterialOptions } from '../../types/types'\nimport { SpatialMaterial } from './SpatialMaterial'\n\nexport class SpatialUnlitMaterial extends SpatialMaterial {\n constructor(\n public id: string,\n public options: SpatialUnlitMaterialOptions,\n ) {\n super(id, 'unlit')\n }\n\n updateProperties(properties: Partial<SpatialUnlitMaterialOptions>) {\n return new UpdateUnlitMaterialProperties(this, properties).execute()\n }\n}\n","import { SpatialObject } from '../../SpatialObject'\nimport { SpatialMaterialType } from '../../types/types'\n\nexport abstract class SpatialMaterial extends SpatialObject {\n constructor(\n public id: string,\n public type: SpatialMaterialType,\n ) {\n super(id)\n this.type = type\n }\n\n abstract updateProperties(properties: any): void\n}\n","import { SpatialObject } from '../../SpatialObject'\nimport { ModelAssetOptions } from '../../types/types'\n\nexport class SpatialModelAsset extends SpatialObject {\n constructor(\n public id: string,\n public options: ModelAssetOptions,\n ) {\n super(id)\n }\n}\n","import { SpatialObject } from '../../SpatialObject'\nimport { SpatialGeometryOptions, SpatialGeometryType } from '../../types/types'\n\nexport class SpatialGeometry extends SpatialObject {\n static type: SpatialGeometryType\n constructor(\n public id: string,\n public options: SpatialGeometryOptions,\n ) {\n super(id)\n }\n}\n","import { SpatialBoxGeometryOptions, SpatialGeometryType } from '../../types/types'\nimport { SpatialGeometry } from './SpatialGeometry'\n\nexport class SpatialBoxGeometry extends SpatialGeometry {\n static type: SpatialGeometryType = 'BoxGeometry'\n constructor(\n public id: string,\n public options: SpatialBoxGeometryOptions,\n ) {\n super(id, options)\n }\n}\n","import {\n SpatialGeometryType,\n SpatialSphereGeometryOptions,\n} from '../../types/types'\nimport { SpatialGeometry } from './SpatialGeometry'\n\nexport class SpatialSphereGeometry extends SpatialGeometry {\n static type: SpatialGeometryType = 'SphereGeometry'\n constructor(\n public id: string,\n public options: SpatialSphereGeometryOptions,\n ) {\n super(id, options)\n }\n}\n","import {\n SpatialGeometryType,\n SpatialCylinderGeometryOptions,\n} from '../../types/types'\nimport { SpatialGeometry } from './SpatialGeometry'\n\nexport class SpatialCylinderGeometry extends SpatialGeometry {\n static type: SpatialGeometryType = 'CylinderGeometry'\n constructor(\n public id: string,\n public options: SpatialCylinderGeometryOptions,\n ) {\n super(id, options)\n }\n}\n","import {\n SpatialGeometryType,\n SpatialPlaneGeometryOptions,\n} from '../../types/types'\nimport { SpatialGeometry } from './SpatialGeometry'\n\nexport class SpatialPlaneGeometry extends SpatialGeometry {\n static type: SpatialGeometryType = 'PlaneGeometry'\n constructor(\n public id: string,\n public options: SpatialPlaneGeometryOptions,\n ) {\n super(id, options)\n }\n}\n","import {\n SpatialGeometryType,\n SpatialConeGeometryOptions,\n} from '../../types/types'\nimport { SpatialGeometry } from './SpatialGeometry'\n\nexport class SpatialConeGeometry extends SpatialGeometry {\n static type: SpatialGeometryType = 'ConeGeometry'\n constructor(\n public id: string,\n public options: SpatialConeGeometryOptions,\n ) {\n super(id, options)\n }\n}\n","import { initScene } from './scene-polyfill'\nimport { SpatialScene } from './SpatialScene'\nimport { Spatialized2DElement } from './Spatialized2DElement'\nimport {\n createSpatialized2DElement,\n createSpatializedDynamic3DElement,\n} from './SpatializedElementCreator'\nimport { createSpatializedStatic3DElement } from './SpatializedElementCreator'\nimport { SpatializedStatic3DElement } from './SpatializedStatic3DElement'\nimport {\n ModelComponentOptions,\n ModelAssetOptions,\n SpatialBoxGeometryOptions,\n SpatialConeGeometryOptions,\n SpatialCylinderGeometryOptions,\n SpatialGeometryOptions,\n SpatialModelEntityCreationOptions,\n SpatialPlaneGeometryOptions,\n SpatialSceneCreationOptions,\n SpatialSphereGeometryOptions,\n SpatialUnlitMaterialOptions,\n SpatialEntityUserData,\n} from './types/types'\nimport { SpatializedDynamic3DElement } from './SpatializedDynamic3DElement'\nimport { SpatialEntity } from './reality/entity/SpatialEntity'\nimport {\n createModelAsset,\n createModelComponent,\n createSpatialEntity,\n createSpatialGeometry,\n createSpatialModelEntity,\n createSpatialUnlitMaterial,\n} from './reality/realityCreator'\nimport {\n SpatialBoxGeometry,\n SpatialPlaneGeometry,\n SpatialSphereGeometry,\n SpatialConeGeometry,\n SpatialCylinderGeometry,\n} from './reality'\n\n/**\n * Session used to establish a connection to the spatial renderer of the system.\n * All spatial resources must be created through this session object.\n * This class serves as the main factory for creating spatial elements and geometries.\n */\nexport class SpatialSession {\n /**\n * Gets the singleton instance of the spatial scene.\n * The spatial scene is the root container for all spatial elements.\n * @returns The SpatialScene singleton instance\n */\n getSpatialScene(): SpatialScene {\n return SpatialScene.getInstance()\n }\n\n /**\n * Creates a new 2D element that can be spatialized in the 3D environment.\n * 2D elements represent HTML content that can be positioned in 3D space.\n * @returns Promise resolving to a new Spatialized2DElement instance\n */\n createSpatialized2DElement(): Promise<Spatialized2DElement> {\n return createSpatialized2DElement()\n }\n\n /**\n * Creates a new static 3D element with an optional model URL.\n * Static 3D elements represent pre-built 3D models that can be loaded from a URL.\n * @param modelURL Optional URL to the 3D model to load\n * @returns Promise resolving to a new SpatializedStatic3DElement instance\n */\n createSpatializedStatic3DElement(\n modelURL: string = '',\n ): Promise<SpatializedStatic3DElement> {\n return createSpatializedStatic3DElement(modelURL)\n }\n\n /**\n * Initializes the spatial scene with custom configuration.\n * This is a reference to the initScene function from scene-polyfill.\n */\n initScene = initScene\n \n /**\n * Creates a new dynamic 3D element that can be manipulated at runtime.\n * Dynamic 3D elements allow for programmatic creation and modification of 3D content.\n * @returns Promise resolving to a new SpatializedDynamic3DElement instance\n */\n createSpatializedDynamic3DElement(): Promise<SpatializedDynamic3DElement> {\n return createSpatializedDynamic3DElement()\n }\n\n /**\n * Creates a new spatial entity with an optional name.\n * Entities are the basic building blocks for creating custom 3D content.\n * @param name Optional name for the entity\n * @returns Promise resolving to a new SpatialEntity instance\n */\n createEntity(userData?: SpatialEntityUserData,): Promise<SpatialEntity> {\n return createSpatialEntity(userData)\n }\n\n /**\n * Creates a box geometry with optional configuration.\n * @param options Configuration options for the box geometry\n * @returns Promise resolving to a new SpatialBoxGeometry instance\n */\n createBoxGeometry(options: SpatialBoxGeometryOptions = {}) {\n return createSpatialGeometry(SpatialBoxGeometry, options)\n }\n\n /**\n * Creates a plane geometry with optional configuration.\n * @param options Configuration options for the plane geometry\n * @returns Promise resolving to a new SpatialPlaneGeometry instance\n */\n createPlaneGeometry(options: SpatialPlaneGeometryOptions = {}) {\n return createSpatialGeometry(SpatialPlaneGeometry, options)\n }\n\n /**\n * Creates a sphere geometry with optional configuration.\n * @param options Configuration options for the sphere geometry\n * @returns Promise resolving to a new SpatialSphereGeometry instance\n */\n createSphereGeometry(options: SpatialSphereGeometryOptions = {}) {\n return createSpatialGeometry(SpatialSphereGeometry, options)\n }\n\n /**\n * Creates a cone geometry with the specified configuration.\n * @param options Configuration options for the cone geometry\n * @returns Promise resolving to a new SpatialConeGeometry instance\n */\n createConeGeometry(options: SpatialConeGeometryOptions) {\n return createSpatialGeometry(SpatialConeGeometry, options)\n }\n\n /**\n * Creates a cylinder geometry with the specified configuration.\n * @param options Configuration options for the cylinder geometry\n * @returns Promise resolving to a new SpatialCylinderGeometry instance\n */\n createCylinderGeometry(options: SpatialCylinderGeometryOptions) {\n return createSpatialGeometry(SpatialCylinderGeometry, options)\n }\n\n /**\n * Creates a model component with the specified configuration.\n * Model components are used to add 3D model rendering capabilities to entities.\n * @param options Configuration options for the model component\n * @returns Promise resolving to a new ModelComponent instance\n */\n createModelComponent(options: ModelComponentOptions) {\n return createModelComponent(options)\n }\n\n /**\n * Creates an unlit material with the specified configuration.\n * Unlit materials don't respond to lighting in the scene.\n * @param options Configuration options for the unlit material\n * @returns Promise resolving to a new SpatialUnlitMaterial instance\n */\n createUnlitMaterial(options: SpatialUnlitMaterialOptions) {\n return createSpatialUnlitMaterial(options)\n }\n \n /**\n * Creates a model asset with the specified configuration.\n * Model assets represent 3D model resources that can be used by entities.\n * @param options Configuration options for the model asset\n * @returns Promise resolving to a new SpatialModelAsset instance\n */\n createModelAsset(options: ModelAssetOptions) {\n return createModelAsset(options)\n }\n\n /**\n * Creates a spatial model entity with the specified configuration.\n * This is a convenience method for creating an entity with a model component.\n * @param options Configuration options for the spatial model entity\n * @returns Promise resolving to a new SpatialModelEntity instance\n */\n createSpatialModelEntity(options: SpatialModelEntityCreationOptions, userData?: SpatialEntityUserData) {\n return createSpatialModelEntity(options, userData)\n }\n}\n","import { SpatialSession } from './SpatialSession'\nimport { SpatialWebEvent } from './SpatialWebEvent'\n\n/**\n * Base object designed to be placed on navigator.spatial to mirror navigator.xr for webxr.\n * This is the main entry point for the WebSpatial SDK, providing access to spatial capabilities.\n */\nexport class Spatial {\n /**\n * Requests a spatial session object from the browser.\n * This is the primary method to initialize spatial functionality.\n * @returns The SpatialSession instance or null if not available in the current browser\n * [TODO] discuss implications of this not being async\n */\n requestSession() {\n if (this.runInSpatialWeb()) {\n SpatialWebEvent.init()\n return new SpatialSession()\n } else {\n return null\n }\n }\n\n /**\n * Checks if the current page is running in a spatial web environment.\n * This method detects if the application is running in a WebSpatial-compatible browser.\n * @returns True if running in a spatial web environment, false otherwise\n */\n runInSpatialWeb() {\n if (navigator.userAgent.indexOf('WebSpatial/') > 0) {\n return true\n }\n return false\n }\n\n /** @deprecated\n * Checks if WebSpatial is supported in the current environment.\n * Verifies compatibility between native and client versions.\n * @returns True if web spatial is supported by this webpage\n */\n isSupported() {\n return true\n }\n\n /** @deprecated\n * Gets the native WebSpatial version from the browser environment.\n * The version format follows semantic versioning (x.x.x).\n * @returns Native version string in format \"x.x.x\"\n */\n getNativeVersion() {\n if (window.__WebSpatialData && window.__WebSpatialData.getNativeVersion) {\n return window.__WebSpatialData.getNativeVersion()\n }\n return window.WebSpatailNativeVersion === 'PACKAGE_VERSION'\n ? this.getClientVersion()\n : window.WebSpatailNativeVersion\n }\n\n /** @deprecated\n * Gets the client SDK version.\n * The version format follows semantic versioning (x.x.x).\n * @returns Client SDK version string in format \"x.x.x\"\n */\n getClientVersion() {\n // @ts-ignore\n return __WEBSPATIAL_CORE_SDK_VERSION__\n }\n}\n","import { parseCornerRadius } from './utils'\nimport { Spatial } from './Spatial'\nimport { SpatialSession } from './SpatialSession'\nimport { BackgroundMaterialType } from './types/types'\n\nconst spatial = new Spatial()\nlet session: SpatialSession | undefined = undefined\n\nconst SpatialGlobalCustomVars = {\n backgroundMaterial: '--xr-background-material',\n}\n\n// keep track of current html background material\nlet htmlBackgroundMaterial = ''\nfunction setCurrentWindowStyle(backgroundMaterial: string) {\n if (backgroundMaterial !== htmlBackgroundMaterial) {\n session?.getSpatialScene()?.updateSpatialProperties({\n material: backgroundMaterial as BackgroundMaterialType,\n })\n htmlBackgroundMaterial = backgroundMaterial\n }\n}\n\nfunction checkHtmlBackgroundMaterial() {\n const computedStyle = getComputedStyle(document.documentElement)\n\n const backgroundMaterial = computedStyle.getPropertyValue(\n SpatialGlobalCustomVars.backgroundMaterial,\n )\n\n setCurrentWindowStyle(backgroundMaterial || 'none')\n}\n\n// keep track of current corner radius\nlet htmlCornerRadius = {\n topLeading: 0,\n bottomLeading: 0,\n topTrailing: 0,\n bottomTrailing: 0,\n}\n\nfunction checkCornerRadius() {\n const computedStyle = getComputedStyle(document.documentElement)\n const cornerRadius = parseCornerRadius(computedStyle)\n setCornerRadius(cornerRadius)\n}\n\nfunction setCornerRadius(cornerRadius: any) {\n if (\n htmlCornerRadius.topLeading !== cornerRadius.topLeading ||\n htmlCornerRadius.bottomLeading !== cornerRadius.bottomLeading ||\n htmlCornerRadius.topTrailing !== cornerRadius.topTrailing ||\n htmlCornerRadius.bottomTrailing !== cornerRadius.bottomTrailing\n ) {\n session?.getSpatialScene()?.updateSpatialProperties({\n cornerRadius,\n })\n htmlCornerRadius.topLeading = cornerRadius.topLeading\n htmlCornerRadius.bottomLeading = cornerRadius.bottomLeading\n htmlCornerRadius.topTrailing = cornerRadius.topTrailing\n htmlCornerRadius.bottomTrailing = cornerRadius.bottomTrailing\n }\n}\n\nfunction setOpacity(opacity: number) {\n session?.getSpatialScene().updateSpatialProperties({\n opacity,\n })\n}\n\nfunction checkOpacity() {\n const computedStyle = getComputedStyle(document.documentElement)\n const opacity = parseFloat(computedStyle.getPropertyValue('opacity'))\n setOpacity(opacity)\n}\n\nfunction hijackDocumentElementStyle() {\n const rawDocumentStyle = document.documentElement.style\n const styleProxy = new Proxy(rawDocumentStyle, {\n set: function (target, key, value) {\n const ret = Reflect.set(target, key, value)\n\n if (key === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle(value)\n }\n\n if (\n key === 'border-radius' ||\n key === 'borderRadius' ||\n key === 'border-top-left-radius' ||\n key === 'borderTopLeftRadius' ||\n key === 'border-top-right-radius' ||\n key === 'borderTopRightRadius' ||\n key === 'border-bottom-left-radius' ||\n key === 'borderBottomLeftRadius' ||\n key === 'border-bottom-right-radius' ||\n key === 'borderBottomRightRadius'\n ) {\n checkCornerRadius()\n }\n\n if (key === 'opacity') {\n checkOpacity()\n }\n\n return ret\n },\n get: function (target, prop: string) {\n if (typeof target[prop as keyof CSSStyleDeclaration] === 'function') {\n return function (this: any, ...args: any[]) {\n if (prop === 'setProperty') {\n const [property, value] = args\n if (property === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle(value)\n }\n } else if (prop === 'removeProperty') {\n const [property] = args\n if (property === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle('none')\n }\n }\n return (target[prop as keyof CSSStyleDeclaration] as Function)(\n ...args,\n )\n }\n }\n return Reflect.get(target, prop)\n },\n })\n Object.defineProperty(document.documentElement, 'style', {\n get: function () {\n return styleProxy\n },\n })\n}\n\nfunction monitorExternalStyleChange() {\n const headObserver = new MutationObserver(checkCSSProperties)\n\n headObserver.observe(document.head, { childList: true, subtree: true })\n}\n\nfunction checkCSSProperties() {\n checkHtmlBackgroundMaterial()\n checkCornerRadius()\n checkOpacity()\n}\n\nfunction monitorHTMLAttributeChange() {\n const observer = new MutationObserver(mutations => {\n mutations.forEach(mutation => {\n if (mutation.type === 'attributes' && mutation.attributeName) {\n checkCSSProperties()\n }\n })\n })\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['style', 'class'],\n })\n}\n\nexport async function spatialWindowPolyfill() {\n if (!spatial.runInSpatialWeb()) {\n return\n }\n\n session = await spatial.requestSession()!\n\n if (document.readyState === 'complete') {\n checkCSSProperties()\n } else {\n window.addEventListener('load', () => {\n checkCSSProperties()\n })\n }\n\n hijackDocumentElementStyle()\n monitorExternalStyleChange()\n monitorHTMLAttributeChange()\n}\n"],"mappings":";;;;;;;mfAAA,IAAMA,GAEOC,EAFbC,GAAAC,EAAA,kBAAMH,GAAQ,OAAO,OAAW,IAEnBC,EAAW,IAAMD,KCF9B,IAMaI,EANbC,GAAAC,EAAA,kBAMaF,EAAN,KAA6C,CAClD,QAAQG,EAAaC,EAAqC,CACxD,OAAO,QAAQ,QAAQ,CACrB,QAAS,GACT,KAAM,OACN,UAAW,OACX,aAAc,MAChB,CAAC,CACH,CACA,uBACEC,EACAC,EACAC,EACAC,EACmC,CACnC,OAAO,QAAQ,QAAQ,CACrB,QAAS,GACT,KAAM,OACN,UAAW,OACX,aAAc,MAChB,CAAC,CACH,CACA,2BACEH,EACAC,EACAC,EACAC,EACAC,EAC0B,CAC1B,MAAO,CACL,QAAS,GACT,KAAM,OACN,UAAW,OACX,aAAc,MAChB,CACF,CACF,ICxCO,SAASC,EAAqBC,EAA0B,CAC7D,MAAO,CACL,QAAS,GACT,KAAAA,EACA,UAAW,GACX,aAAc,EAChB,CACF,CAEO,SAASC,EACdC,EACAC,EAAe,GACA,CACf,MAAO,CACL,QAAS,GACT,KAAM,OACN,UAAAD,EACA,aAAAC,CACF,CACF,CArBA,IAAAC,GAAAC,EAAA,oBCAA,IAKaC,EALbC,EAAAC,EAAA,kBAKaF,EAAN,MAAMG,CAAgB,CAC3B,OAAO,cAAqD,CAAC,EAC7D,OAAO,MAAO,CAEZ,OAAO,kBAAoB,CAAC,CAAE,GAAAC,EAAI,KAAAC,CAAK,IAA2B,CAEhEF,EAAgB,cAAcC,CAAE,IAAIC,CAAI,CAC1C,CACF,CAEA,OAAO,iBAAiBD,EAAYE,EAA+B,CACjEH,EAAgB,cAAcC,CAAE,EAAIE,CACtC,CAEA,OAAO,oBAAoBF,EAAY,CACrC,OAAOD,EAAgB,cAAcC,CAAE,CACzC,CACF,ICtBA,IAAAG,GAAA,GAAAC,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U,UAAU,QAAQ,aAAa,EAAI,IAC9DC,GAAgB,EAChBC,GAAsB","names":["isSSR","isSSREnv","init_ssr_polyfill","__esmMin","SSRPlatform","init_SSRPlatform","__esmMin","cmd","msg","schema","query","target","features","resultCallback","CommandResultSuccess","data","CommandResultFailure","errorCode","errorMessage","init_CommandResultUtils","__esmMin","SpatialWebEvent","init_SpatialWebEvent","__esmMin","_SpatialWebEvent","id","data","callback","AndroidPlatform_exports","__export","AndroidPlatform","nextRequestId","requestId","MAX_ID","creatingElementCount","init_AndroidPlatform","__esmMin","init_CommandResultUtils","init_JSBCommand","init_SpatialWebEvent","cmd","msg","resolve","reject","rId","SpatialWebEvent","result","CommandResultSuccess","code","message","CommandResultFailure","ans","error","command","query","target","features","canCreate","CheckWebViewCanCreateCommand","windowProxy","spatialId","id","VisionOSPlatform_exports","__export","VisionOSPlatform","init_VisionOSPlatform","__esmMin","init_CommandResultUtils","cmd","msg","result","CommandResultSuccess","error","code","message","CommandResultFailure","command","query","target","features","id","windowProxy","createPlatform","isSSREnv","SSRPlatform","AndroidPlatform","VisionOSPlatform","init_platform_adapter","__esmMin","init_ssr_polyfill","init_SSRPlatform","parseBorderRadius","borderProperty","width","parseCornerRadius","computedStyle","topLeftPropertyValue","topRightPropertyValue","bottomLeftPropertyValue","bottomRightPropertyValue","composeSRT","position","rotation","scale","px","py","pz","rx","ry","rz","sx","sy","sz","m","init_utils","__esmMin","platform","JSBCommand","UpdateEntityPropertiesCommand","UpdateEntityEventCommand","UpdateSpatialSceneProperties","UpdateSceneConfig","FocusScene","GetSpatialSceneState","SpatializedElementCommand","UpdateSpatialized2DElementProperties","UpdateSpatializedDynamic3DElementProperties","UpdateUnlitMaterialProperties","UpdateSpatializedElementTransform","UpdateSpatializedStatic3DElementProperties","AddSpatializedElementToSpatialized2DElement","AddSpatializedElementToSpatialScene","CreateSpatializedStatic3DElementCommand","CreateSpatializedDynamic3DElementCommand","CreateSpatialEntityCommand","CreateModelComponentCommand","CreateSpatialModelEntityCommand","CreateModelAssetCommand","CreateSpatialGeometryCommand","CreateSpatialUnlitMaterialCommand","AddComponentToEntityCommand","SetParentForEntityCommand","ConvertFromEntityToEntityCommand","ConvertFromEntityToSceneCommand","ConvertFromSceneToEntityCommand","InspectCommand","DestroyCommand","CheckWebViewCanCreateCommand","WebSpatialProtocolCommand","createSpatialized2DElementCommand","createSpatialSceneCommand","init_JSBCommand","__esmMin","init_platform_adapter","init_utils","createPlatform","param","msg","entity","properties","transform","composeSRT","type","isEnable","config","id","spatialObject","extraParams","matrix","spatializedElement","modelURL","name","options","geometryId","materialIds","material","comp","childId","parentId","fromEntityId","toEntityId","fromPosition","position","entityId","query","params","key","value","finalValue","url","target","features","index_exports","__export","BaseplateVisibilityValues","CubeInfo","ModelComponent","Spatial","SpatialBoxGeometry","SpatialComponent","SpatialConeGeometry","SpatialCylinderGeometry","SpatialEntity","SpatialGeometry","SpatialMaterial","SpatialModelAsset","SpatialModelEntity","SpatialObject","SpatialPlaneGeometry","SpatialScene","SpatialSceneState","SpatialSceneValues","SpatialSession","SpatialSphereGeometry","SpatialUnlitMaterial","Spatialized2DElement","SpatializedDynamic3DElement","SpatializedElement","SpatializedElementType","SpatializedStatic3DElement","WorldAlignmentValues","WorldScalingValues","isSSREnv","isValidBaseplateVisibilityType","isValidSceneUnit","isValidSpatialSceneType","isValidWorldAlignmentType","isValidWorldScalingType","init_JSBCommand","SpatialObject","id","ret","InspectCommand","DestroyCommand","init_JSBCommand","init_JSBCommand","instance","SpatialScene","_SpatialScene","SpatialObject","properties","UpdateSpatialSceneProperties","element","AddSpatializedElementToSpatialScene","config","UpdateSceneConfig","GetSpatialSceneState","SpatializedElementType","BaseplateVisibilityValues","isValidBaseplateVisibilityType","type","WorldScalingValues","isValidWorldScalingType","WorldAlignmentValues","isValidWorldAlignmentType","SpatialSceneValues","isValidSpatialSceneType","isValidSceneUnit","val","SpatialSceneState","CubeInfo","size","origin","defaultSceneConfig","defaultSceneConfigVolume","INTERNAL_SCHEMA_PREFIX","SceneManager","_SceneManager","window","name","raw","url","target","features","cfg","result","createSpatialSceneCommand","id","FocusScene","callback","options","sceneType","defaultConfig","getSceneDefaultConfig","rawReturnVal","formattedConfig","errors","formatSceneConfig","pxToMeter","px","meterToPx","meter","formatToNumber","str","targetUnit","defaultUnit","config","isWindow","isValidSpatialSceneType","iterKeys","k","isValidSceneUnit","isValidWorldScalingType","isValidWorldAlignmentType","isValidBaseplateVisibilityType","initScene","hijackWindowOpen","hijackWindowATag","openedWindow","element","found","handleATag","event","targetElement","link","injectScenePolyfill","SpatialScene","onContentLoaded","provideDefaultSceneConfig","error","resolve","reject","injectSceneHook","init_JSBCommand","init_JSBCommand","init_JSBCommand","init_SpatialWebEvent","createSpatialEvent","type","detail","SpatializedElement","SpatialObject","id","SpatialWebEvent","matrix","UpdateSpatializedElementTransform","data","type","cubeInfoMsg","CubeInfo","event","createSpatialEvent","dragStartEvent","rotationStartEvent","magnifyStartEvent","value","Spatialized2DElement","SpatializedElement","id","windowProxy","hijackWindowATag","properties","UpdateSpatialized2DElementProperties","element","AddSpatializedElementToSpatialized2DElement","init_JSBCommand","SpatializedStatic3DElement","SpatializedElement","resolve","properties","UpdateSpatializedStatic3DElementProperties","data","callback","transform","modelTransform","init_JSBCommand","SpatializedDynamic3DElement","SpatializedElement","id","entity","ans","SetParentForEntityCommand","properties","UpdateSpatializedDynamic3DElementProperties","createSpatialized2DElement","result","createSpatialized2DElementCommand","id","windowProxy","Spatialized2DElement","createSpatializedStatic3DElement","modelURL","CreateSpatializedStatic3DElementCommand","SpatializedStatic3DElement","createSpatializedDynamic3DElement","CreateSpatializedDynamic3DElementCommand","SpatializedDynamic3DElement","init_JSBCommand","init_JSBCommand","init_SpatialWebEvent","SpatialEntity","_SpatialEntity","SpatialObject","id","userData","SpatialWebEvent","component","AddComponentToEntityCommand","position","rotation","scale","ent","ans","SetParentForEntityCommand","child","properties","UpdateEntityPropertiesCommand","type","callback","eventName","isEnable","UpdateEntityEventCommand","data","evt","createSpatialEvent","fromEntityId","toEntityId","ConvertFromEntityToEntityCommand","ConvertFromEntityToSceneCommand","entityId","ConvertFromSceneToEntityCommand","SpatialModelEntity","SpatialEntity","id","options","userData","init_SpatialWebEvent","SpatialComponent","SpatialObject","id","SpatialWebEvent","data","type","ModelComponent","SpatialComponent","id","options","init_JSBCommand","SpatialMaterial","SpatialObject","id","type","SpatialUnlitMaterial","SpatialMaterial","id","options","properties","UpdateUnlitMaterialProperties","SpatialModelAsset","SpatialObject","id","options","createSpatialEntity","userData","result","CreateSpatialEntityCommand","id","SpatialEntity","createSpatialGeometry","ctor","options","CreateSpatialGeometryCommand","createSpatialUnlitMaterial","CreateSpatialUnlitMaterialCommand","SpatialUnlitMaterial","createModelComponent","CreateModelComponentCommand","ModelComponent","createSpatialModelEntity","CreateSpatialModelEntityCommand","SpatialModelEntity","createModelAsset","CreateModelAssetCommand","SpatialModelAsset","SpatialGeometry","SpatialObject","id","options","SpatialBoxGeometry","SpatialGeometry","id","options","SpatialSphereGeometry","SpatialGeometry","id","options","SpatialCylinderGeometry","SpatialGeometry","id","options","SpatialPlaneGeometry","SpatialGeometry","id","options","SpatialConeGeometry","SpatialGeometry","id","options","SpatialSession","SpatialScene","createSpatialized2DElement","modelURL","createSpatializedStatic3DElement","initScene","createSpatializedDynamic3DElement","userData","createSpatialEntity","options","createSpatialGeometry","SpatialBoxGeometry","SpatialPlaneGeometry","SpatialSphereGeometry","SpatialConeGeometry","SpatialCylinderGeometry","createModelComponent","createSpatialUnlitMaterial","createModelAsset","createSpatialModelEntity","init_SpatialWebEvent","Spatial","SpatialWebEvent","SpatialSession","init_ssr_polyfill","init_utils","spatial","Spatial","session","SpatialGlobalCustomVars","htmlBackgroundMaterial","setCurrentWindowStyle","backgroundMaterial","checkHtmlBackgroundMaterial","htmlCornerRadius","checkCornerRadius","computedStyle","cornerRadius","parseCornerRadius","setCornerRadius","setOpacity","opacity","checkOpacity","hijackDocumentElementStyle","rawDocumentStyle","styleProxy","target","key","value","ret","prop","args","property","monitorExternalStyleChange","checkCSSProperties","monitorHTMLAttributeChange","mutations","mutation","spatialWindowPolyfill","isSSREnv","injectSceneHook","spatialWindowPolyfill"]}