@webspatial/core-sdk 1.6.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/README.md +10 -0
- package/dist/JSBCommand.d.ts +398 -0
- package/dist/JSBCommand.js +668 -0
- package/dist/JSBCommand.js.map +1 -0
- package/dist/Spatial.d.ts +63 -0
- package/dist/Spatial.js +60 -0
- package/dist/Spatial.js.map +1 -0
- package/dist/SpatialObject.d.ts +19 -0
- package/dist/SpatialObject.js +44 -0
- package/dist/SpatialObject.js.map +1 -0
- package/dist/SpatialScene.d.ts +51 -0
- package/dist/SpatialScene.js +74 -0
- package/dist/SpatialScene.js.map +1 -0
- package/dist/SpatialSession.d.ts +143 -0
- package/dist/SpatialSession.js +173 -0
- package/dist/SpatialSession.js.map +1 -0
- package/dist/SpatialWebEvent.d.ts +8 -0
- package/dist/SpatialWebEvent.js +18 -0
- package/dist/SpatialWebEvent.js.map +1 -0
- package/dist/SpatialWebEventCreator.d.ts +11 -0
- package/dist/SpatialWebEventCreator.js +11 -0
- package/dist/SpatialWebEventCreator.js.map +1 -0
- package/dist/Spatialized2DElement.d.ts +42 -0
- package/dist/Spatialized2DElement.js +47 -0
- package/dist/Spatialized2DElement.js.map +1 -0
- package/dist/SpatializedDynamic3DElement.d.ts +7 -0
- package/dist/SpatializedDynamic3DElement.js +43 -0
- package/dist/SpatializedDynamic3DElement.js.map +1 -0
- package/dist/SpatializedElement.d.ts +7 -0
- package/dist/SpatializedElement.js +206 -0
- package/dist/SpatializedElement.js.map +1 -0
- package/dist/SpatializedElementCreator.d.ts +15 -0
- package/dist/SpatializedElementCreator.js +47 -0
- package/dist/SpatializedElementCreator.js.map +1 -0
- package/dist/SpatializedStatic3DElement.d.ts +195 -0
- package/dist/SpatializedStatic3DElement.js +327 -0
- package/dist/SpatializedStatic3DElement.js.map +1 -0
- package/dist/WebMsgCommand.d.ts +7 -0
- package/dist/WebMsgCommand.js +23 -0
- package/dist/WebMsgCommand.js.map +1 -0
- package/dist/index.d.ts +35 -1101
- package/dist/index.js +21 -3393
- package/dist/index.js.map +1 -1
- package/dist/install-polyfills.d.ts +2 -0
- package/dist/install-polyfills.js +13 -0
- package/dist/install-polyfills.js.map +1 -0
- package/dist/isSSREnv.d.ts +3 -0
- package/dist/isSSREnv.js +6 -0
- package/dist/isSSREnv.js.map +1 -0
- package/dist/motion/AnimationObject.d.ts +7 -0
- package/dist/motion/AnimationObject.js +140 -0
- package/dist/motion/AnimationObject.js.map +1 -0
- package/dist/motion/compute/index.d.ts +10 -0
- package/dist/motion/compute/index.js +19 -0
- package/dist/motion/compute/index.js.map +1 -0
- package/dist/motion/compute/motionPropertyValues.d.ts +19 -0
- package/dist/motion/compute/motionPropertyValues.js +50 -0
- package/dist/motion/compute/motionPropertyValues.js.map +1 -0
- package/dist/motion/compute/normalize.d.ts +31 -0
- package/dist/motion/compute/normalize.js +201 -0
- package/dist/motion/compute/normalize.js.map +1 -0
- package/dist/motion/compute/validate.d.ts +22 -0
- package/dist/motion/compute/validate.js +103 -0
- package/dist/motion/compute/validate.js.map +1 -0
- package/dist/motion/index.d.ts +8 -0
- package/dist/motion/index.js +6 -0
- package/dist/motion/index.js.map +1 -0
- package/dist/motion/native/serializeMotionTimeline.d.ts +12 -0
- package/dist/motion/native/serializeMotionTimeline.js +21 -0
- package/dist/motion/native/serializeMotionTimeline.js.map +1 -0
- package/dist/physicalMetrics-W5uZ5xKb.d.ts +48 -0
- package/dist/physicalMetrics.d.ts +1 -0
- package/dist/physicalMetrics.js +58 -0
- package/dist/physicalMetrics.js.map +1 -0
- package/dist/platform-adapter/CommandResultUtils.d.ts +12 -0
- package/dist/platform-adapter/CommandResultUtils.js +21 -0
- package/dist/platform-adapter/CommandResultUtils.js.map +1 -0
- package/dist/platform-adapter/createPlatformSync.d.ts +16 -0
- package/dist/platform-adapter/createPlatformSync.js +30 -0
- package/dist/platform-adapter/createPlatformSync.js.map +1 -0
- package/dist/platform-adapter/index.d.ts +12 -0
- package/dist/platform-adapter/index.js +10 -0
- package/dist/platform-adapter/index.js.map +1 -0
- package/dist/platform-adapter/interface.d.ts +7 -0
- package/dist/platform-adapter/interface.js +1 -0
- package/dist/platform-adapter/interface.js.map +1 -0
- package/dist/platform-adapter/pico-os/PicoOSPlatform.d.ts +25 -0
- package/dist/platform-adapter/pico-os/PicoOSPlatform.js +168 -0
- package/dist/platform-adapter/pico-os/PicoOSPlatform.js.map +1 -0
- package/dist/platform-adapter/puppeteer/PuppeteerPlatform.d.ts +66 -0
- package/dist/platform-adapter/puppeteer/PuppeteerPlatform.js +372 -0
- package/dist/platform-adapter/puppeteer/PuppeteerPlatform.js.map +1 -0
- package/dist/platform-adapter/spatialRequestMetadata.d.ts +6 -0
- package/dist/platform-adapter/spatialRequestMetadata.js +39 -0
- package/dist/platform-adapter/spatialRequestMetadata.js.map +1 -0
- package/dist/platform-adapter/spatialSceneQuery.d.ts +12 -0
- package/dist/platform-adapter/spatialSceneQuery.js +12 -0
- package/dist/platform-adapter/spatialSceneQuery.js.map +1 -0
- package/dist/platform-adapter/vision-os/VisionOSPlatform.d.ts +19 -0
- package/dist/platform-adapter/vision-os/VisionOSPlatform.js +77 -0
- package/dist/platform-adapter/vision-os/VisionOSPlatform.js.map +1 -0
- package/dist/platform-runtime.d.ts +12 -0
- package/dist/platform-runtime.js +14 -0
- package/dist/platform-runtime.js.map +1 -0
- package/dist/reality/Attachment.d.ts +19 -0
- package/dist/reality/Attachment.js +39 -0
- package/dist/reality/Attachment.js.map +1 -0
- package/dist/reality/component/ModelComponent.d.ts +14 -0
- package/dist/reality/component/ModelComponent.js +11 -0
- package/dist/reality/component/ModelComponent.js.map +1 -0
- package/dist/reality/component/SpatialComponent.d.ts +8 -0
- package/dist/reality/component/SpatialComponent.js +19 -0
- package/dist/reality/component/SpatialComponent.js.map +1 -0
- package/dist/reality/component/index.d.ts +8 -0
- package/dist/reality/component/index.js +3 -0
- package/dist/reality/component/index.js.map +1 -0
- package/dist/reality/entity/SpatialEntity.d.ts +7 -0
- package/dist/reality/entity/SpatialEntity.js +291 -0
- package/dist/reality/entity/SpatialEntity.js.map +1 -0
- package/dist/reality/entity/SpatialModelEntity.d.ts +17 -0
- package/dist/reality/entity/SpatialModelEntity.js +17 -0
- package/dist/reality/entity/SpatialModelEntity.js.map +1 -0
- package/dist/reality/entity/index.d.ts +8 -0
- package/dist/reality/entity/index.js +3 -0
- package/dist/reality/entity/index.js.map +1 -0
- package/dist/reality/geometry/SpatialBoxGeometry.d.ts +16 -0
- package/dist/reality/geometry/SpatialBoxGeometry.js +13 -0
- package/dist/reality/geometry/SpatialBoxGeometry.js.map +1 -0
- package/dist/reality/geometry/SpatialConeGeometry.d.ts +16 -0
- package/dist/reality/geometry/SpatialConeGeometry.js +13 -0
- package/dist/reality/geometry/SpatialConeGeometry.js.map +1 -0
- package/dist/reality/geometry/SpatialCylinderGeometry.d.ts +16 -0
- package/dist/reality/geometry/SpatialCylinderGeometry.js +13 -0
- package/dist/reality/geometry/SpatialCylinderGeometry.js.map +1 -0
- package/dist/reality/geometry/SpatialGeometry.d.ts +7 -0
- package/dist/reality/geometry/SpatialGeometry.js +13 -0
- package/dist/reality/geometry/SpatialGeometry.js.map +1 -0
- package/dist/reality/geometry/SpatialPlaneGeometry.d.ts +16 -0
- package/dist/reality/geometry/SpatialPlaneGeometry.js +13 -0
- package/dist/reality/geometry/SpatialPlaneGeometry.js.map +1 -0
- package/dist/reality/geometry/SpatialSphereGeometry.d.ts +16 -0
- package/dist/reality/geometry/SpatialSphereGeometry.js +13 -0
- package/dist/reality/geometry/SpatialSphereGeometry.js.map +1 -0
- package/dist/reality/geometry/index.d.ts +12 -0
- package/dist/reality/geometry/index.js +7 -0
- package/dist/reality/geometry/index.js.map +1 -0
- package/dist/reality/index.d.ts +18 -0
- package/dist/reality/index.js +7 -0
- package/dist/reality/index.js.map +1 -0
- package/dist/reality/material/SpatialMaterial.d.ts +7 -0
- package/dist/reality/material/SpatialMaterial.js +13 -0
- package/dist/reality/material/SpatialMaterial.js.map +1 -0
- package/dist/reality/material/SpatialUnlitMaterial.d.ts +16 -0
- package/dist/reality/material/SpatialUnlitMaterial.js +16 -0
- package/dist/reality/material/SpatialUnlitMaterial.js.map +1 -0
- package/dist/reality/material/index.d.ts +8 -0
- package/dist/reality/material/index.js +3 -0
- package/dist/reality/material/index.js.map +1 -0
- package/dist/reality/realityCreator.d.ts +22 -0
- package/dist/reality/realityCreator.js +89 -0
- package/dist/reality/realityCreator.js.map +1 -0
- package/dist/reality/resource/SpatialModelAsset.d.ts +15 -0
- package/dist/reality/resource/SpatialModelAsset.js +12 -0
- package/dist/reality/resource/SpatialModelAsset.js.map +1 -0
- package/dist/reality/resource/SpatialTextureResource.d.ts +16 -0
- package/dist/reality/resource/SpatialTextureResource.js +16 -0
- package/dist/reality/resource/SpatialTextureResource.js.map +1 -0
- package/dist/reality/resource/index.d.ts +9 -0
- package/dist/reality/resource/index.js +3 -0
- package/dist/reality/resource/index.js.map +1 -0
- package/dist/runtime/WebSpatialRuntimeError.d.ts +10 -0
- package/dist/runtime/WebSpatialRuntimeError.js +14 -0
- package/dist/runtime/WebSpatialRuntimeError.js.map +1 -0
- package/dist/runtime/capability-data.d.ts +12 -0
- package/dist/runtime/capability-data.js +134 -0
- package/dist/runtime/capability-data.js.map +1 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.js +27 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/jsbAdapterPlatform.d.ts +9 -0
- package/dist/runtime/jsbAdapterPlatform.js +38 -0
- package/dist/runtime/jsbAdapterPlatform.js.map +1 -0
- package/dist/runtime/keys.d.ts +34 -0
- package/dist/runtime/keys.js +122 -0
- package/dist/runtime/keys.js.map +1 -0
- package/dist/runtime/semver.d.ts +8 -0
- package/dist/runtime/semver.js +32 -0
- package/dist/runtime/semver.js.map +1 -0
- package/dist/runtime/supports.d.ts +22 -0
- package/dist/runtime/supports.js +78 -0
- package/dist/runtime/supports.js.map +1 -0
- package/dist/runtime/types.d.ts +12 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/userAgent.d.ts +20 -0
- package/dist/runtime/userAgent.js +41 -0
- package/dist/runtime/userAgent.js.map +1 -0
- package/dist/scene-polyfill.d.ts +18 -0
- package/dist/scene-polyfill.js +480 -0
- package/dist/scene-polyfill.js.map +1 -0
- package/dist/spatial-host.d.ts +13 -0
- package/dist/spatial-host.js +18 -0
- package/dist/spatial-host.js.map +1 -0
- package/dist/spatial-window-polyfill.d.ts +3 -0
- package/dist/spatial-window-polyfill.js +155 -0
- package/dist/spatial-window-polyfill.js.map +1 -0
- package/dist/spatializedElementMotion-_0XWPQCE.d.ts +1009 -0
- package/dist/types/animation.d.ts +7 -0
- package/dist/types/animation.js +1 -0
- package/dist/types/animation.js.map +1 -0
- package/dist/types/global.d.ts +38 -0
- package/dist/types/global.js +1 -0
- package/dist/types/global.js.map +1 -0
- package/dist/types/internal.d.ts +7 -0
- package/dist/types/internal.js +12 -0
- package/dist/types/internal.js.map +1 -0
- package/dist/types/motion/index.d.ts +7 -0
- package/dist/types/motion/index.js +3 -0
- package/dist/types/motion/index.js.map +1 -0
- package/dist/types/motion/spatializedElementMotion.d.ts +7 -0
- package/dist/types/motion/spatializedElementMotion.js +1 -0
- package/dist/types/motion/spatializedElementMotion.js.map +1 -0
- package/dist/types/motion/spatializedMotion.d.ts +7 -0
- package/dist/types/motion/spatializedMotion.js +16 -0
- package/dist/types/motion/spatializedMotion.js.map +1 -0
- package/dist/types/motion/spatializedPlayback.d.ts +11 -0
- package/dist/types/motion/spatializedPlayback.js +1 -0
- package/dist/types/motion/spatializedPlayback.js.map +1 -0
- package/dist/types/motion/spatializedVisual.d.ts +35 -0
- package/dist/types/motion/spatializedVisual.js +1 -0
- package/dist/types/motion/spatializedVisual.js.map +1 -0
- package/dist/types/types.d.ts +7 -0
- package/dist/types/types.js +117 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils.d.ts +44 -0
- package/dist/utils.js +86 -0
- package/dist/utils.js.map +1 -0
- package/package.json +20 -4
- package/src/JSBCommand.ts +148 -91
- package/src/Spatial.ts +0 -21
- package/src/SpatialObject.ts +10 -0
- package/src/SpatialScene.ts +1 -5
- package/src/SpatialSession.ts +17 -3
- package/src/Spatialized2DElement.ts +5 -0
- package/src/SpatializedDynamic3DElement.ts +5 -1
- package/src/SpatializedElement.ts +29 -0
- package/src/SpatializedElementCreator.ts +6 -4
- package/src/SpatializedStatic3DElement.test.ts +99 -0
- package/src/SpatializedStatic3DElement.ts +141 -4
- package/src/WebMsgCommand.ts +50 -0
- package/src/coverage-boost.test.ts +258 -316
- package/src/index.ts +28 -12
- package/src/install-polyfills.ts +38 -0
- package/src/jsbcommand.coverage.test.ts +42 -48
- package/src/motion/AnimationObject.test.ts +421 -0
- package/src/motion/AnimationObject.ts +208 -0
- package/src/motion/compute/index.ts +10 -0
- package/src/motion/compute/motionPropertyValues.test.ts +55 -0
- package/src/motion/compute/motionPropertyValues.ts +70 -0
- package/src/motion/compute/normalize.test.ts +99 -0
- package/src/motion/compute/normalize.ts +289 -0
- package/src/motion/compute/validate.test.ts +229 -0
- package/src/motion/compute/validate.ts +156 -0
- package/src/motion/index.ts +2 -0
- package/src/motion/native/serializeMotionTimeline.test.ts +61 -0
- package/src/motion/native/serializeMotionTimeline.ts +27 -0
- package/src/platform-adapter/CommandResultUtils.ts +2 -2
- package/src/platform-adapter/createPlatformSync.ts +36 -0
- package/src/platform-adapter/index.ts +5 -51
- package/src/platform-adapter/interface.ts +35 -23
- package/src/platform-adapter/pico-os/PicoOSPlatform.ts +156 -59
- package/src/platform-adapter/puppeteer/PuppeteerPlatform.ts +37 -11
- package/src/platform-adapter/spatialRequestMetadata.test.ts +175 -0
- package/src/platform-adapter/spatialRequestMetadata.ts +48 -0
- package/src/platform-adapter/spatialSceneQuery.ts +17 -0
- package/src/platform-adapter/vision-os/VisionOSPlatform.ts +60 -24
- package/src/platform-runtime.ts +13 -0
- package/src/reality/Attachment.ts +2 -2
- package/src/reality/entity/SpatialEntity.ts +127 -2
- package/src/reality/realityCreator.ts +15 -1
- package/src/reality/resource/SpatialTextureResource.ts +16 -0
- package/src/reality/resource/index.ts +1 -0
- package/src/runtime/WebSpatialRuntimeError.ts +16 -0
- package/src/runtime/capability-data.ts +213 -0
- package/src/runtime/contract-review.test.ts +44 -0
- package/src/runtime/index.ts +17 -0
- package/src/runtime/jsbAdapterPlatform.test.ts +36 -0
- package/src/runtime/jsbAdapterPlatform.ts +51 -0
- package/src/runtime/keys.ts +140 -0
- package/src/runtime/semver.ts +33 -0
- package/src/runtime/supports.test.ts +346 -0
- package/src/runtime/supports.ts +112 -0
- package/src/runtime/types.ts +11 -0
- package/src/runtime/useAnimation.capability.test.ts +275 -0
- package/src/runtime/userAgent.ts +64 -0
- package/src/scene-polyfill.manifest.test.ts +312 -9
- package/src/scene-polyfill.request-metadata.test.ts +39 -0
- package/src/scene-polyfill.test.ts +33 -94
- package/src/scene-polyfill.ts +125 -92
- package/src/spatial-host.ts +25 -0
- package/src/spatial-window-polyfill.ts +18 -2
- package/src/transform-roundtrip.test.ts +90 -0
- package/src/types/animation.ts +224 -0
- package/src/types/{global.d.ts → global.ts} +10 -12
- package/src/types/motion/index.ts +10 -0
- package/src/types/motion/spatializedElementMotion.ts +49 -0
- package/src/types/motion/spatializedMotion.ts +147 -0
- package/src/types/motion/spatializedPlayback.ts +17 -0
- package/src/types/motion/spatializedVisual.ts +24 -0
- package/src/types/types.ts +12 -0
- package/src/utils.ts +54 -0
- package/tsup.config.ts +61 -36
- package/vitest.config.ts +5 -1
- package/dist/iife/index.d.ts +0 -1101
- package/dist/iife/index.global.js +0 -75
- package/dist/iife/index.global.js.map +0 -1
- package/src/platform-adapter/android/AndroidPlatform.ts +0 -133
- package/src/platform-adapter/ssr/SSRPlatform.ts +0 -43
- /package/src/{ssr-polyfill.ts → isSSREnv.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/JSBCommand.ts"],"sourcesContent":["import { getPlatform } from './platform-runtime'\nimport { pointToPhysical } from './physicalMetrics'\nimport {\n getRuntime,\n supports,\n VISIONOS_DEBUG_SHELL_VERSION_PLACEHOLDER,\n} from './runtime/supports'\nimport { SpatialComponent } from './reality/component/SpatialComponent'\nimport { SpatialEntity } from './reality/entity/SpatialEntity'\nimport { SpatialMaterial } from './reality/material/SpatialMaterial'\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 AttachmentEntityOptions,\n AttachmentEntityUpdateOptions,\n ModelLoadingMode,\n ModelSource,\n SpatialTextureResourceOptions,\n} from './types/types'\nimport type { AnimateTransformCommand } from './types/animation'\nimport { composeSRT } from './utils'\nimport type {\n ControlSpatializedElementAnimationCommand,\n CreateSpatializedElementAnimationCommand,\n} from './types/motion/spatializedElementMotion'\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 const platform = await getPlatform()\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(\n readonly modelURL?: string,\n readonly sources?: ModelSource[],\n readonly loading: ModelLoadingMode = 'eager',\n ) {\n super()\n this.modelURL = modelURL\n this.sources = sources\n this.loading = loading\n }\n\n protected getParams() {\n return {\n modelURL: this.modelURL,\n sources: this.sources,\n loading: this.loading,\n }\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 RemoveComponentFromEntityCommand 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 = 'RemoveComponentFromEntity'\n}\n\nexport class SetMaterialsOnEntityCommand extends JSBCommand {\n constructor(\n public entityId: string,\n public materials: SpatialMaterial[],\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n entityId: this.entityId,\n materialIds: this.materials.map(m => m.id),\n }\n }\n commandType = 'SetMaterialsOnEntity'\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 ConvertCoordinateCommand extends JSBCommand {\n constructor(\n public position: Vec3,\n public fromId: string,\n public toId: string,\n ) {\n super()\n }\n protected getParams(): Record<string, any> | undefined {\n return {\n position: this.position,\n fromId: this.fromId,\n toId: this.toId,\n }\n }\n commandType = 'ConvertCoordinate'\n}\n\nexport class CreateTextureCommand 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 = 'CreateTexture'\n}\n\nexport class UpdateTexturePropertiesCommand extends SpatializedElementCommand {\n properties: Partial<SpatialTextureResourceOptions>\n commandType = 'UpdateTextureProperties'\n\n constructor(\n spatialObject: SpatialObject,\n properties: Partial<SpatialTextureResourceOptions>,\n ) {\n super(spatialObject)\n this.properties = properties\n }\n\n protected getExtraParams() {\n return this.properties\n }\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\nexport class AnimateTransformJSBCommand extends JSBCommand {\n commandType = 'AnimateTransform'\n\n constructor(private command: AnimateTransformCommand) {\n super()\n }\n\n protected getParams(): Record<string, any> | undefined {\n const { type, animationId, entityId } = this.command\n const params: Record<string, any> = { type, animationId }\n\n if (entityId !== undefined) params.entityId = entityId\n\n if (type === 'play') {\n if (this.command.toTransform) {\n params.toTransform = Array.from(this.command.toTransform)\n }\n if (this.command.fromTransform) {\n params.fromTransform = Array.from(this.command.fromTransform)\n }\n if (this.command.duration !== undefined)\n params.duration = this.command.duration\n if (this.command.timingFunction !== undefined)\n params.timingFunction = this.command.timingFunction\n if (this.command.delay !== undefined) params.delay = this.command.delay\n if (this.command.loop !== undefined) params.loop = this.command.loop\n if (this.command.playbackRate !== undefined)\n params.playbackRate = this.command.playbackRate\n }\n\n return params\n }\n}\n// TODO(remove): temporary OTA0 compat shim — delete once #1330 lands and\n// attachment JSB always uses the placement-shaped payload.\nfunction usePlacementProtocol(): boolean {\n // WS_SHELL_VERSION debug shells claim every capability via supports(), but\n // the in-repo visionOS runtime still decodes only the legacy attachment\n // payload — keep sending it there.\n const rt = getRuntime()\n if (\n rt.type === 'visionos' &&\n rt.shellVersion === VISIONOS_DEBUG_SHELL_VERSION_PLACEHOLDER\n ) {\n return false\n }\n return supports('AttachmentEntity', ['placement'])\n}\n\nfunction toPlacementVec3(position?: [number, number, number]): {\n x: number\n y: number\n z: number\n} {\n const [x, y, z] = position ?? [0, 0, 0]\n return { x, y, z }\n}\n\nexport class InitializeAttachmentCommand extends JSBCommand {\n commandType = 'InitializeAttachment'\n constructor(\n private attachmentId: string,\n private options: AttachmentEntityOptions,\n ) {\n super()\n }\n protected getParams() {\n const p = this.options\n if (!usePlacementProtocol()) {\n return {\n id: this.attachmentId,\n parentEntityId: p.parentEntityId,\n position: p.position ?? [0, 0, 0],\n size: p.size,\n ownerViewId: p.ownerViewId,\n }\n }\n // Runtimes advertising this capability decode a Vec3 position and meter\n // dimensions instead of the legacy tuple and point size.\n return {\n id: this.attachmentId,\n placementId: p.parentEntityId,\n position: toPlacementVec3(p.position),\n width: pointToPhysical(p.size.width),\n height: pointToPhysical(p.size.height),\n ownerViewId: p.ownerViewId,\n }\n }\n}\n\nexport class UpdateAttachmentEntityCommand extends JSBCommand {\n commandType = 'UpdateAttachmentEntity'\n constructor(\n private attachmentId: string,\n private options: AttachmentEntityUpdateOptions,\n ) {\n super()\n }\n protected getParams() {\n if (!usePlacementProtocol()) {\n return {\n id: this.attachmentId,\n ...this.options,\n }\n }\n const { position, size } = this.options\n return {\n id: this.attachmentId,\n ...(position ? { position: toPlacementVec3(position) } : {}),\n ...(size\n ? {\n width: pointToPhysical(size.width),\n height: pointToPhysical(size.height),\n }\n : {}),\n }\n }\n}\n\nexport class CreateSpatializedElementAnimationJSBCommand extends JSBCommand {\n commandType = 'CreateSpatializedElementAnimation'\n\n constructor(private command: CreateSpatializedElementAnimationCommand) {\n super()\n }\n\n protected getParams() {\n const { elementId, timeline } = this.command\n return {\n elementId,\n timeline,\n }\n }\n}\n\nexport class ControlSpatializedElementAnimationJSBCommand extends JSBCommand {\n commandType = 'ControlSpatializedElementAnimation'\n\n constructor(private command: ControlSpatializedElementAnimationCommand) {\n super()\n }\n\n protected getParams() {\n const { animationId, type } = this.command\n return {\n animationId,\n type,\n }\n }\n}\n"],"mappings":"AAAA,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA8BP,SAAS,kBAAkB;AAM3B,MAAe,WAAW;AAAA,EACxB,cAAsB;AAAA,EAGtB,MAAM,UAAU;AACd,UAAM,QAAQ,KAAK,UAAU;AAC7B,UAAM,MAAM,QAAQ,KAAK,UAAU,KAAK,IAAI;AAC5C,UAAM,WAAW,MAAM,YAAY;AACnC,WAAO,SAAS,QAAQ,KAAK,aAAa,GAAG;AAAA,EAC/C;AACF;AAEO,MAAM,sCAAsC,WAAW;AAAA,EAG5D,YACS,QACA,YACP;AACA,UAAM;AAHC;AACA;AAAA,EAGT;AAAA,EAPA,cAAc;AAAA,EASJ,YAAY;AACpB,UAAM,YAAY;AAAA,MAChB,KAAK,WAAW,YAAY,KAAK,OAAO;AAAA,MACxC,KAAK,WAAW,YAAY,KAAK,OAAO;AAAA,MACxC,KAAK,WAAW,SAAS,KAAK,OAAO;AAAA,IACvC,EAAE,eAAe;AACjB,WAAO;AAAA,MACL,UAAU,KAAK,OAAO;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,iCAAiC,WAAW;AAAA,EAGvD,YACS,QACA,MACA,UACP;AACA,UAAM;AAJC;AACA;AACA;AAAA,EAGT;AAAA,EARA,cAAc;AAAA,EAUJ,YAAY;AACpB,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,UAAU,KAAK,OAAO;AAAA,MACtB,UAAU,KAAK;AAAA,IACjB;AAAA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mD;AACrE,UAAM;AADY;AAAA,EAEpB;AAAA,EAJA,cAAc;AAAA,EAMJ,YAAY;AACpB,UAAM,EAAE,WAAW,SAAS,IAAI,KAAK;AACrC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,qDAAqD,WAAW;AAAA,EAG3E,YAAoB,SAAoD;AACtE,UAAM;AADY;AAAA,EAEpB;AAAA,EAJA,cAAc;AAAA,EAMJ,YAAY;AACpB,UAAM,EAAE,aAAa,KAAK,IAAI,KAAK;AACnC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SpatialSession } from './SpatialSession.js';
|
|
2
|
+
import './spatializedElementMotion-_0XWPQCE.js';
|
|
3
|
+
import './types/motion/spatializedVisual.js';
|
|
4
|
+
import './types/motion/spatializedPlayback.js';
|
|
5
|
+
import './types/global.js';
|
|
6
|
+
import './physicalMetrics-W5uZ5xKb.js';
|
|
7
|
+
import './SpatialObject.js';
|
|
8
|
+
import './reality/component/SpatialComponent.js';
|
|
9
|
+
import './reality/entity/SpatialModelEntity.js';
|
|
10
|
+
import './reality/component/ModelComponent.js';
|
|
11
|
+
import './reality/material/SpatialUnlitMaterial.js';
|
|
12
|
+
import './reality/geometry/SpatialBoxGeometry.js';
|
|
13
|
+
import './reality/geometry/SpatialSphereGeometry.js';
|
|
14
|
+
import './reality/geometry/SpatialCylinderGeometry.js';
|
|
15
|
+
import './reality/geometry/SpatialPlaneGeometry.js';
|
|
16
|
+
import './reality/geometry/SpatialConeGeometry.js';
|
|
17
|
+
import './reality/resource/SpatialModelAsset.js';
|
|
18
|
+
import './reality/resource/SpatialTextureResource.js';
|
|
19
|
+
import './reality/Attachment.js';
|
|
20
|
+
import './scene-polyfill.js';
|
|
21
|
+
import './SpatialScene.js';
|
|
22
|
+
import './Spatialized2DElement.js';
|
|
23
|
+
import './SpatializedStatic3DElement.js';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Base object designed to be placed on navigator.spatial to mirror navigator.xr for webxr.
|
|
27
|
+
* This is the main entry point for the WebSpatial SDK, providing access to spatial capabilities.
|
|
28
|
+
*/
|
|
29
|
+
declare class Spatial {
|
|
30
|
+
/**
|
|
31
|
+
* Requests a spatial session object from the browser.
|
|
32
|
+
* This is the primary method to initialize spatial functionality.
|
|
33
|
+
* @returns The SpatialSession instance or null if not available in the current browser
|
|
34
|
+
* [TODO] discuss implications of this not being async
|
|
35
|
+
*/
|
|
36
|
+
requestSession(): SpatialSession | null;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the current page is running in a spatial web environment.
|
|
39
|
+
* This method detects if the application is running in a WebSpatial-compatible browser.
|
|
40
|
+
* @returns True if running in a spatial web environment, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
runInSpatialWeb(): boolean;
|
|
43
|
+
/** @deprecated
|
|
44
|
+
* Checks if WebSpatial is supported in the current environment.
|
|
45
|
+
* Verifies compatibility between native and client versions.
|
|
46
|
+
* @returns True if web spatial is supported by this webpage
|
|
47
|
+
*/
|
|
48
|
+
isSupported(): boolean;
|
|
49
|
+
/** @deprecated
|
|
50
|
+
* Gets the native WebSpatial version from the browser environment.
|
|
51
|
+
* The version format follows semantic versioning (x.x.x).
|
|
52
|
+
* @returns Native version string in format "x.x.x"
|
|
53
|
+
*/
|
|
54
|
+
getNativeVersion(): any;
|
|
55
|
+
/** @deprecated
|
|
56
|
+
* Gets the client SDK version.
|
|
57
|
+
* The version format follows semantic versioning (x.x.x).
|
|
58
|
+
* @returns Client SDK version string in format "x.x.x"
|
|
59
|
+
*/
|
|
60
|
+
getClientVersion(): string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { Spatial };
|
package/dist/Spatial.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { SpatialSession } from "./SpatialSession";
|
|
2
|
+
import { SpatialWebEvent } from "./SpatialWebEvent";
|
|
3
|
+
class Spatial {
|
|
4
|
+
/**
|
|
5
|
+
* Requests a spatial session object from the browser.
|
|
6
|
+
* This is the primary method to initialize spatial functionality.
|
|
7
|
+
* @returns The SpatialSession instance or null if not available in the current browser
|
|
8
|
+
* [TODO] discuss implications of this not being async
|
|
9
|
+
*/
|
|
10
|
+
requestSession() {
|
|
11
|
+
if (this.runInSpatialWeb()) {
|
|
12
|
+
SpatialWebEvent.init();
|
|
13
|
+
return new SpatialSession();
|
|
14
|
+
} else {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Checks if the current page is running in a spatial web environment.
|
|
20
|
+
* This method detects if the application is running in a WebSpatial-compatible browser.
|
|
21
|
+
* @returns True if running in a spatial web environment, false otherwise
|
|
22
|
+
*/
|
|
23
|
+
runInSpatialWeb() {
|
|
24
|
+
if (navigator.userAgent.indexOf("WebSpatial/") >= 0) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
/** @deprecated
|
|
30
|
+
* Checks if WebSpatial is supported in the current environment.
|
|
31
|
+
* Verifies compatibility between native and client versions.
|
|
32
|
+
* @returns True if web spatial is supported by this webpage
|
|
33
|
+
*/
|
|
34
|
+
isSupported() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
/** @deprecated
|
|
38
|
+
* Gets the native WebSpatial version from the browser environment.
|
|
39
|
+
* The version format follows semantic versioning (x.x.x).
|
|
40
|
+
* @returns Native version string in format "x.x.x"
|
|
41
|
+
*/
|
|
42
|
+
getNativeVersion() {
|
|
43
|
+
if (window.__WebSpatialData && window.__WebSpatialData.getNativeVersion) {
|
|
44
|
+
return window.__WebSpatialData.getNativeVersion();
|
|
45
|
+
}
|
|
46
|
+
return window.WebSpatailNativeVersion === "WS_SHELL_VERSION" ? this.getClientVersion() : window.WebSpatailNativeVersion;
|
|
47
|
+
}
|
|
48
|
+
/** @deprecated
|
|
49
|
+
* Gets the client SDK version.
|
|
50
|
+
* The version format follows semantic versioning (x.x.x).
|
|
51
|
+
* @returns Client SDK version string in format "x.x.x"
|
|
52
|
+
*/
|
|
53
|
+
getClientVersion() {
|
|
54
|
+
return "2.0.0";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
Spatial
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=Spatial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Spatial.ts"],"sourcesContent":["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 === 'WS_SHELL_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"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAMzB,MAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOnB,iBAAiB;AACf,QAAI,KAAK,gBAAgB,GAAG;AAC1B,sBAAgB,KAAK;AACrB,aAAO,IAAI,eAAe;AAAA,IAC5B,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,kBAAkB;AAChB,QAAI,UAAU,UAAU,QAAQ,aAAa,KAAK,GAAG;AACnD,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAc;AACZ,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,mBAAmB;AACjB,QAAI,OAAO,oBAAoB,OAAO,iBAAiB,kBAAkB;AACvE,aAAO,OAAO,iBAAiB,iBAAiB;AAAA,IAClD;AACA,WAAO,OAAO,4BAA4B,qBACtC,KAAK,iBAAiB,IACtB,OAAO;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,mBAAmB;AAEjB,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* Parent class of spatial objects, should not be used directly
|
|
4
|
+
*/
|
|
5
|
+
declare class SpatialObject {
|
|
6
|
+
/** @hidden */
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/** @hidden */
|
|
9
|
+
constructor(
|
|
10
|
+
/** @hidden */
|
|
11
|
+
id: string);
|
|
12
|
+
name?: string;
|
|
13
|
+
isDestroyed: boolean;
|
|
14
|
+
inspect(): Promise<any>;
|
|
15
|
+
destroy(): Promise<any>;
|
|
16
|
+
protected onDestroy(): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { SpatialObject };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DestroyCommand, InspectCommand } from "./JSBCommand";
|
|
2
|
+
class SpatialObject {
|
|
3
|
+
/** @hidden */
|
|
4
|
+
constructor(id) {
|
|
5
|
+
this.id = id;
|
|
6
|
+
}
|
|
7
|
+
name;
|
|
8
|
+
isDestroyed = false;
|
|
9
|
+
async inspect() {
|
|
10
|
+
const ret = await new InspectCommand(this.id).execute();
|
|
11
|
+
if (ret.success) {
|
|
12
|
+
return ret.data;
|
|
13
|
+
}
|
|
14
|
+
throw new Error(ret.errorMessage);
|
|
15
|
+
}
|
|
16
|
+
async destroy() {
|
|
17
|
+
if (this.isDestroyed) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const ret = await new DestroyCommand(this.id).execute();
|
|
21
|
+
if (ret.success) {
|
|
22
|
+
this.onDestroy();
|
|
23
|
+
this.isDestroyed = true;
|
|
24
|
+
return ret.data;
|
|
25
|
+
} else if (this.isDestroyed) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const errorMessage = typeof ret.errorMessage === "string" ? ret.errorMessage.toLowerCase() : "";
|
|
29
|
+
const isMissingNativeObject = errorMessage.includes("not exsit");
|
|
30
|
+
if (isMissingNativeObject) {
|
|
31
|
+
this.onDestroy();
|
|
32
|
+
this.isDestroyed = true;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
throw new Error(ret.errorMessage);
|
|
36
|
+
}
|
|
37
|
+
// override this method to do some cleanup
|
|
38
|
+
onDestroy() {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
SpatialObject
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=SpatialObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/SpatialObject.ts"],"sourcesContent":["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 const errorMessage =\n typeof ret.errorMessage === 'string' ? ret.errorMessage.toLowerCase() : ''\n const isMissingNativeObject = errorMessage.includes('not exsit')\n if (isMissingNativeObject) {\n // Treat native pre-teardown as an idempotent destroy during page back navigation.\n this.onDestroy()\n this.isDestroyed = true\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"],"mappings":"AAAA,SAAS,gBAAgB,sBAAsB;AAMxC,MAAM,cAAc;AAAA;AAAA,EAEzB,YAEkB,IAChB;AADgB;AAAA,EACf;AAAA,EAEH;AAAA,EAEA,cAAc;AAAA,EAEd,MAAM,UAAU;AACd,UAAM,MAAM,MAAM,IAAI,eAAe,KAAK,EAAE,EAAE,QAAQ;AACtD,QAAI,IAAI,SAAS;AACf,aAAO,IAAI;AAAA,IACb;AACA,UAAM,IAAI,MAAM,IAAI,YAAY;AAAA,EAClC;AAAA,EAEA,MAAM,UAAU;AACd,QAAI,KAAK,aAAa;AACpB;AAAA,IACF;AAEA,UAAM,MAAM,MAAM,IAAI,eAAe,KAAK,EAAE,EAAE,QAAQ;AACtD,QAAI,IAAI,SAAS;AACf,WAAK,UAAU;AACf,WAAK,cAAc;AACnB,aAAO,IAAI;AAAA,IACb,WAAW,KAAK,aAAa;AAE3B;AAAA,IACF;AAEA,UAAM,eACJ,OAAO,IAAI,iBAAiB,WAAW,IAAI,aAAa,YAAY,IAAI;AAC1E,UAAM,wBAAwB,aAAa,SAAS,WAAW;AAC/D,QAAI,uBAAuB;AAEzB,WAAK,UAAU;AACf,WAAK,cAAc;AACnB;AAAA,IACF;AAEA,UAAM,IAAI,MAAM,IAAI,YAAY;AAAA,EAClC;AAAA;AAAA,EAGU,YAAY;AAAA,EAAC;AACzB;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { at as Vec3, a5 as SpatialSceneProperties, aK as CommandResult, ag as SpatializedElement, aQ as SpatialSceneCreationOptionsInternal, aR as SpatialSceneState } from './spatializedElementMotion-_0XWPQCE.js';
|
|
2
|
+
import { SpatialObject } from './SpatialObject.js';
|
|
3
|
+
import './types/motion/spatializedVisual.js';
|
|
4
|
+
import './types/motion/spatializedPlayback.js';
|
|
5
|
+
import './types/global.js';
|
|
6
|
+
import './physicalMetrics-W5uZ5xKb.js';
|
|
7
|
+
import './reality/component/SpatialComponent.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents the spatial scene that contains all spatialized elements.
|
|
11
|
+
* This class follows the singleton pattern - only one instance exists per application.
|
|
12
|
+
* The scene manages the overall spatial environment properties and contains all spatial elements.
|
|
13
|
+
*/
|
|
14
|
+
declare class SpatialScene extends SpatialObject {
|
|
15
|
+
/**
|
|
16
|
+
* Gets the singleton instance of the SpatialScene.
|
|
17
|
+
* Creates a new instance if one doesn't exist yet.
|
|
18
|
+
* @returns The singleton SpatialScene instance
|
|
19
|
+
*/
|
|
20
|
+
static getInstance(): SpatialScene;
|
|
21
|
+
convertCoordinate(position: Vec3, fromId: string, toId: string): Promise<Vec3>;
|
|
22
|
+
/**
|
|
23
|
+
* Updates the properties of the spatial scene.
|
|
24
|
+
* This can include background settings, lighting, and other scene-wide properties.
|
|
25
|
+
* @param properties Partial set of properties to update
|
|
26
|
+
* @returns Promise resolving when the update is complete
|
|
27
|
+
*/
|
|
28
|
+
updateSpatialProperties(properties: Partial<SpatialSceneProperties>): Promise<CommandResult<any>>;
|
|
29
|
+
/**
|
|
30
|
+
* Adds a spatialized element to the scene.
|
|
31
|
+
* This makes the element visible and interactive in the spatial environment.
|
|
32
|
+
* @param element The SpatializedElement to add to the scene
|
|
33
|
+
* @returns Promise resolving when the element is added
|
|
34
|
+
*/
|
|
35
|
+
addSpatializedElement(element: SpatializedElement): Promise<CommandResult<any>>;
|
|
36
|
+
/**
|
|
37
|
+
* Updates the scene creation configuration.
|
|
38
|
+
* This allows changing scene parameters after initial creation.
|
|
39
|
+
* @param config The new scene creation configuration
|
|
40
|
+
* @returns Promise resolving when the update is complete
|
|
41
|
+
*/
|
|
42
|
+
updateSceneCreationConfig(config: SpatialSceneCreationOptionsInternal): Promise<CommandResult<any>>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the current state of the spatial scene.
|
|
45
|
+
* This includes information about active elements and scene configuration.
|
|
46
|
+
* @returns Promise resolving to the current SpatialSceneState
|
|
47
|
+
*/
|
|
48
|
+
getState(): Promise<SpatialSceneState>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { SpatialScene };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AddSpatializedElementToSpatialScene,
|
|
3
|
+
GetSpatialSceneState,
|
|
4
|
+
UpdateSceneConfig,
|
|
5
|
+
UpdateSpatialSceneProperties
|
|
6
|
+
} from "./JSBCommand";
|
|
7
|
+
import { ConvertCoordinateCommand } from "./JSBCommand";
|
|
8
|
+
import { SpatialObject } from "./SpatialObject";
|
|
9
|
+
let instance;
|
|
10
|
+
class SpatialScene extends SpatialObject {
|
|
11
|
+
/**
|
|
12
|
+
* Gets the singleton instance of the SpatialScene.
|
|
13
|
+
* Creates a new instance if one doesn't exist yet.
|
|
14
|
+
* @returns The singleton SpatialScene instance
|
|
15
|
+
*/
|
|
16
|
+
static getInstance() {
|
|
17
|
+
if (!instance) {
|
|
18
|
+
instance = new SpatialScene("");
|
|
19
|
+
}
|
|
20
|
+
return instance;
|
|
21
|
+
}
|
|
22
|
+
async convertCoordinate(position, fromId, toId) {
|
|
23
|
+
try {
|
|
24
|
+
const ret = await new ConvertCoordinateCommand(
|
|
25
|
+
position,
|
|
26
|
+
fromId,
|
|
27
|
+
toId
|
|
28
|
+
).execute();
|
|
29
|
+
return ret?.data ?? position;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.warn("SpatialScene.convertCoordinate error:", error);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Updates the properties of the spatial scene.
|
|
37
|
+
* This can include background settings, lighting, and other scene-wide properties.
|
|
38
|
+
* @param properties Partial set of properties to update
|
|
39
|
+
* @returns Promise resolving when the update is complete
|
|
40
|
+
*/
|
|
41
|
+
async updateSpatialProperties(properties) {
|
|
42
|
+
return new UpdateSpatialSceneProperties(properties).execute();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Adds a spatialized element to the scene.
|
|
46
|
+
* This makes the element visible and interactive in the spatial environment.
|
|
47
|
+
* @param element The SpatializedElement to add to the scene
|
|
48
|
+
* @returns Promise resolving when the element is added
|
|
49
|
+
*/
|
|
50
|
+
async addSpatializedElement(element) {
|
|
51
|
+
return new AddSpatializedElementToSpatialScene(element).execute();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Updates the scene creation configuration.
|
|
55
|
+
* This allows changing scene parameters after initial creation.
|
|
56
|
+
* @param config The new scene creation configuration
|
|
57
|
+
* @returns Promise resolving when the update is complete
|
|
58
|
+
*/
|
|
59
|
+
async updateSceneCreationConfig(config) {
|
|
60
|
+
return new UpdateSceneConfig(config).execute();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Gets the current state of the spatial scene.
|
|
64
|
+
* This includes information about active elements and scene configuration.
|
|
65
|
+
* @returns Promise resolving to the current SpatialSceneState
|
|
66
|
+
*/
|
|
67
|
+
async getState() {
|
|
68
|
+
return (await new GetSpatialSceneState().execute()).data.name;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
SpatialScene
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=SpatialScene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/SpatialScene.ts"],"sourcesContent":["import { SpatialSceneProperties, Vec3 } from './types/types'\nimport { SpatialSceneCreationOptionsInternal } from './types/internal'\nimport {\n AddSpatializedElementToSpatialScene,\n GetSpatialSceneState,\n UpdateSceneConfig,\n UpdateSpatialSceneProperties,\n} from './JSBCommand'\nimport { ConvertCoordinateCommand } 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 async convertCoordinate(\n position: Vec3,\n fromId: string,\n toId: string,\n ): Promise<Vec3> {\n try {\n const ret = await new ConvertCoordinateCommand(\n position,\n fromId,\n toId,\n ).execute()\n return (ret as any)?.data ?? position\n } catch (error) {\n console.warn('SpatialScene.convertCoordinate error:', error)\n throw error\n }\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}\n"],"mappings":"AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AAGzC,SAAS,qBAAqB;AAG9B,IAAI;AAOG,MAAM,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9C,OAAO,cAA4B;AACjC,QAAI,CAAC,UAAU;AACb,iBAAW,IAAI,aAAa,EAAE;AAAA,IAChC;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,kBACJ,UACA,QACA,MACe;AACf,QAAI;AACF,YAAM,MAAM,MAAM,IAAI;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,MACF,EAAE,QAAQ;AACV,aAAQ,KAAa,QAAQ;AAAA,IAC/B,SAAS,OAAO;AACd,cAAQ,KAAK,yCAAyC,KAAK;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,wBAAwB,YAA6C;AACzE,WAAO,IAAI,6BAA6B,UAAU,EAAE,QAAQ;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,sBAAsB,SAA6B;AACvD,WAAO,IAAI,oCAAoC,OAAO,EAAE,QAAQ;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,0BAA0B,QAA6C;AAC3E,WAAO,IAAI,kBAAkB,MAAM,EAAE,QAAQ;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,WAAuC;AAC3C,YAAQ,MAAM,IAAI,qBAAqB,EAAE,QAAQ,GAAG,KAAK;AAAA,EAC3D;AACF;","names":[]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { o as ModelSource, n as ModelLoadingMode, af as SpatializedDynamic3DElement, L as SpatialEntityUserData, H as SpatialEntity, u as SpatialBoxGeometryOptions, $ as SpatialPlaneGeometryOptions, a9 as SpatialSphereGeometryOptions, v as SpatialConeGeometryOptions, w as SpatialCylinderGeometryOptions, m as ModelComponentOptions, ad as SpatialUnlitMaterialOptions, ac as SpatialTextureResourceOptions, M as ModelAssetOptions, _ as SpatialModelEntityCreationOptions, h as AttachmentEntityOptions } from './spatializedElementMotion-_0XWPQCE.js';
|
|
2
|
+
import { SpatialModelEntity } from './reality/entity/SpatialModelEntity.js';
|
|
3
|
+
import { ModelComponent } from './reality/component/ModelComponent.js';
|
|
4
|
+
import { SpatialUnlitMaterial } from './reality/material/SpatialUnlitMaterial.js';
|
|
5
|
+
import { SpatialBoxGeometry } from './reality/geometry/SpatialBoxGeometry.js';
|
|
6
|
+
import { SpatialSphereGeometry } from './reality/geometry/SpatialSphereGeometry.js';
|
|
7
|
+
import { SpatialCylinderGeometry } from './reality/geometry/SpatialCylinderGeometry.js';
|
|
8
|
+
import { SpatialPlaneGeometry } from './reality/geometry/SpatialPlaneGeometry.js';
|
|
9
|
+
import { SpatialConeGeometry } from './reality/geometry/SpatialConeGeometry.js';
|
|
10
|
+
import { SpatialModelAsset } from './reality/resource/SpatialModelAsset.js';
|
|
11
|
+
import { SpatialTextureResource } from './reality/resource/SpatialTextureResource.js';
|
|
12
|
+
import { Attachment } from './reality/Attachment.js';
|
|
13
|
+
import { initScene } from './scene-polyfill.js';
|
|
14
|
+
import { SpatialScene } from './SpatialScene.js';
|
|
15
|
+
import { Spatialized2DElement } from './Spatialized2DElement.js';
|
|
16
|
+
import { SpatializedStatic3DElement } from './SpatializedStatic3DElement.js';
|
|
17
|
+
import './types/motion/spatializedVisual.js';
|
|
18
|
+
import './types/motion/spatializedPlayback.js';
|
|
19
|
+
import './types/global.js';
|
|
20
|
+
import './physicalMetrics-W5uZ5xKb.js';
|
|
21
|
+
import './SpatialObject.js';
|
|
22
|
+
import './reality/component/SpatialComponent.js';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Session used to establish a connection to the spatial renderer of the system.
|
|
26
|
+
* All spatial resources must be created through this session object.
|
|
27
|
+
* This class serves as the main factory for creating spatial elements and geometries.
|
|
28
|
+
*/
|
|
29
|
+
declare class SpatialSession {
|
|
30
|
+
/**
|
|
31
|
+
* Gets the singleton instance of the spatial scene.
|
|
32
|
+
* The spatial scene is the root container for all spatial elements.
|
|
33
|
+
* @returns The SpatialScene singleton instance
|
|
34
|
+
*/
|
|
35
|
+
getSpatialScene(): SpatialScene;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new 2D element that can be spatialized in the 3D environment.
|
|
38
|
+
* 2D elements represent HTML content that can be positioned in 3D space.
|
|
39
|
+
* @returns Promise resolving to a new Spatialized2DElement instance
|
|
40
|
+
*/
|
|
41
|
+
createSpatialized2DElement(): Promise<Spatialized2DElement>;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new static 3D element with an optional model URL.
|
|
44
|
+
* Static 3D elements represent pre-built 3D models that can be loaded from a URL.
|
|
45
|
+
* @param modelURL Optional URL to the 3D model to load
|
|
46
|
+
* @param sources Optional list of fallback model sources
|
|
47
|
+
* @param loading Whether the asset should fetch eagerly or be deferred (`'lazy'`)
|
|
48
|
+
* @returns Promise resolving to a new SpatializedStatic3DElement instance
|
|
49
|
+
*/
|
|
50
|
+
createSpatializedStatic3DElement(modelURL?: string, sources?: ModelSource[], loading?: ModelLoadingMode): Promise<SpatializedStatic3DElement>;
|
|
51
|
+
/**
|
|
52
|
+
* Initializes the spatial scene with custom configuration.
|
|
53
|
+
* This is a reference to the initScene function from scene-polyfill.
|
|
54
|
+
*/
|
|
55
|
+
initScene: typeof initScene;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new dynamic 3D element that can be manipulated at runtime.
|
|
58
|
+
* Dynamic 3D elements allow for programmatic creation and modification of 3D content.
|
|
59
|
+
* @returns Promise resolving to a new SpatializedDynamic3DElement instance
|
|
60
|
+
*/
|
|
61
|
+
createSpatializedDynamic3DElement(): Promise<SpatializedDynamic3DElement>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new spatial entity with an optional name.
|
|
64
|
+
* Entities are the basic building blocks for creating custom 3D content.
|
|
65
|
+
* @param name Optional name for the entity
|
|
66
|
+
* @returns Promise resolving to a new SpatialEntity instance
|
|
67
|
+
*/
|
|
68
|
+
createEntity(userData?: SpatialEntityUserData): Promise<SpatialEntity>;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a box geometry with optional configuration.
|
|
71
|
+
* @param options Configuration options for the box geometry
|
|
72
|
+
* @returns Promise resolving to a new SpatialBoxGeometry instance
|
|
73
|
+
*/
|
|
74
|
+
createBoxGeometry(options?: SpatialBoxGeometryOptions): Promise<SpatialBoxGeometry>;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a plane geometry with optional configuration.
|
|
77
|
+
* @param options Configuration options for the plane geometry
|
|
78
|
+
* @returns Promise resolving to a new SpatialPlaneGeometry instance
|
|
79
|
+
*/
|
|
80
|
+
createPlaneGeometry(options?: SpatialPlaneGeometryOptions): Promise<SpatialPlaneGeometry>;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a sphere geometry with optional configuration.
|
|
83
|
+
* @param options Configuration options for the sphere geometry
|
|
84
|
+
* @returns Promise resolving to a new SpatialSphereGeometry instance
|
|
85
|
+
*/
|
|
86
|
+
createSphereGeometry(options?: SpatialSphereGeometryOptions): Promise<SpatialSphereGeometry>;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a cone geometry with the specified configuration.
|
|
89
|
+
* @param options Configuration options for the cone geometry
|
|
90
|
+
* @returns Promise resolving to a new SpatialConeGeometry instance
|
|
91
|
+
*/
|
|
92
|
+
createConeGeometry(options: SpatialConeGeometryOptions): Promise<SpatialConeGeometry>;
|
|
93
|
+
/**
|
|
94
|
+
* Creates a cylinder geometry with the specified configuration.
|
|
95
|
+
* @param options Configuration options for the cylinder geometry
|
|
96
|
+
* @returns Promise resolving to a new SpatialCylinderGeometry instance
|
|
97
|
+
*/
|
|
98
|
+
createCylinderGeometry(options: SpatialCylinderGeometryOptions): Promise<SpatialCylinderGeometry>;
|
|
99
|
+
/**
|
|
100
|
+
* Creates a model component with the specified configuration.
|
|
101
|
+
* Model components are used to add 3D model rendering capabilities to entities.
|
|
102
|
+
* @param options Configuration options for the model component
|
|
103
|
+
* @returns Promise resolving to a new ModelComponent instance
|
|
104
|
+
*/
|
|
105
|
+
createModelComponent(options: ModelComponentOptions): Promise<ModelComponent>;
|
|
106
|
+
/**
|
|
107
|
+
* Creates an unlit material with the specified configuration.
|
|
108
|
+
* Unlit materials don't respond to lighting in the scene.
|
|
109
|
+
* @param options Configuration options for the unlit material
|
|
110
|
+
* @returns Promise resolving to a new SpatialUnlitMaterial instance
|
|
111
|
+
*/
|
|
112
|
+
createUnlitMaterial(options: SpatialUnlitMaterialOptions): Promise<SpatialUnlitMaterial>;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a texture resource from the specified image URL.
|
|
115
|
+
* Texture resources can be referenced by materials and other spatial content.
|
|
116
|
+
* @param options Configuration options for the texture resource
|
|
117
|
+
* @returns Promise resolving to a new SpatialTextureResource instance
|
|
118
|
+
*/
|
|
119
|
+
createTexture(options: SpatialTextureResourceOptions): Promise<SpatialTextureResource>;
|
|
120
|
+
/**
|
|
121
|
+
* Creates a model asset with the specified configuration.
|
|
122
|
+
* Model assets represent 3D model resources that can be used by entities.
|
|
123
|
+
* @param options Configuration options for the model asset
|
|
124
|
+
* @returns Promise resolving to a new SpatialModelAsset instance
|
|
125
|
+
*/
|
|
126
|
+
createModelAsset(options: ModelAssetOptions): Promise<SpatialModelAsset>;
|
|
127
|
+
/**
|
|
128
|
+
* Creates a spatial model entity with the specified configuration.
|
|
129
|
+
* This is a convenience method for creating an entity with a model component.
|
|
130
|
+
* @param options Configuration options for the spatial model entity
|
|
131
|
+
* @returns Promise resolving to a new SpatialModelEntity instance
|
|
132
|
+
*/
|
|
133
|
+
createSpatialModelEntity(options: SpatialModelEntityCreationOptions, userData?: SpatialEntityUserData): Promise<SpatialModelEntity>;
|
|
134
|
+
/**
|
|
135
|
+
* Creates an attachment entity that renders 2D HTML content as a child
|
|
136
|
+
* of a 3D entity in the scene graph.
|
|
137
|
+
* @param options Configuration options including parent entity ID, position, and size
|
|
138
|
+
* @returns Promise resolving to a new Attachment instance
|
|
139
|
+
*/
|
|
140
|
+
createAttachmentEntity(options: AttachmentEntityOptions): Promise<Attachment>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export { SpatialSession };
|