@webspatial/core-sdk 1.7.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -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 -1251
- package/dist/index.js +21 -3650
- 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 +132 -5
- package/src/SpatialObject.ts +10 -0
- package/src/Spatialized2DElement.ts +5 -0
- package/src/SpatializedDynamic3DElement.ts +5 -0
- package/src/SpatializedElement.ts +29 -0
- package/src/SpatializedStatic3DElement.ts +42 -3
- package/src/WebMsgCommand.ts +40 -0
- package/src/coverage-boost.test.ts +239 -216
- package/src/index.ts +25 -11
- package/src/install-polyfills.ts +38 -0
- package/src/jsbcommand.coverage.test.ts +23 -0
- 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/createPlatformSync.ts +5 -3
- package/src/platform-adapter/pico-os/PicoOSPlatform.ts +76 -11
- package/src/platform-adapter/spatialRequestMetadata.test.ts +175 -0
- package/src/platform-adapter/spatialRequestMetadata.ts +48 -0
- package/src/platform-adapter/vision-os/VisionOSPlatform.ts +6 -1
- package/src/reality/entity/SpatialEntity.ts +127 -0
- package/src/runtime/capability-data.ts +104 -4
- package/src/runtime/index.ts +0 -11
- package/src/runtime/keys.ts +12 -1
- package/src/runtime/supports.test.ts +143 -4
- package/src/runtime/supports.ts +3 -1
- package/src/runtime/useAnimation.capability.test.ts +275 -0
- package/src/scene-polyfill.manifest.test.ts +306 -5
- package/src/scene-polyfill.request-metadata.test.ts +39 -0
- package/src/scene-polyfill.test.ts +33 -94
- package/src/scene-polyfill.ts +117 -87
- 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.ts +1 -8
- 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 +3 -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 -1251
- package/dist/iife/index.global.js +0 -75
- package/dist/iife/index.global.js.map +0 -1
- package/src/platform-adapter/ssr/SSRPlatform.ts +0 -52
- /package/src/{ssr-polyfill.ts → isSSREnv.ts} +0 -0
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
import { SpatializedVisualValues } from './types/motion/spatializedVisual.js';
|
|
2
|
+
import { SpatializedPlaybackError } from './types/motion/spatializedPlayback.js';
|
|
3
|
+
import './types/global.js';
|
|
4
|
+
import { SpatialObject } from './SpatialObject.js';
|
|
5
|
+
import { SpatialComponent } from './reality/component/SpatialComponent.js';
|
|
6
|
+
|
|
7
|
+
declare abstract class SpatialMaterial extends SpatialObject {
|
|
8
|
+
id: string;
|
|
9
|
+
type: SpatialMaterialType;
|
|
10
|
+
constructor(id: string, type: SpatialMaterialType);
|
|
11
|
+
abstract updateProperties(properties: any): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare class SpatialGeometry extends SpatialObject {
|
|
15
|
+
id: string;
|
|
16
|
+
options: SpatialGeometryOptions;
|
|
17
|
+
static type: SpatialGeometryType;
|
|
18
|
+
constructor(id: string, options: SpatialGeometryOptions);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface AnimationObjectCreateOptions {
|
|
22
|
+
elementId: string;
|
|
23
|
+
timeline: SpatializedMotionTimeline;
|
|
24
|
+
}
|
|
25
|
+
interface AnimationObjectCallbacks {
|
|
26
|
+
onStart?: () => void;
|
|
27
|
+
onComplete?: (values: SpatializedVisualValues) => void;
|
|
28
|
+
onStop?: (values: SpatializedVisualValues) => void;
|
|
29
|
+
onReset?: (values: SpatializedVisualValues) => void;
|
|
30
|
+
onError?: (error: SpatializedPlaybackError) => void;
|
|
31
|
+
onValuesChange?: (values: SpatializedVisualValues) => void;
|
|
32
|
+
onStateChange?: () => void;
|
|
33
|
+
}
|
|
34
|
+
declare class AnimationObject extends SpatialObject implements SpatializedPlaybackApi {
|
|
35
|
+
readonly elementId: string;
|
|
36
|
+
readonly timeline: SpatializedMotionTimeline;
|
|
37
|
+
private callbacks;
|
|
38
|
+
private _playState;
|
|
39
|
+
private _finished;
|
|
40
|
+
private started;
|
|
41
|
+
constructor(id: string, options: AnimationObjectCreateOptions);
|
|
42
|
+
static create(options: AnimationObjectCreateOptions): Promise<AnimationObject>;
|
|
43
|
+
setCallbacks(callbacks: AnimationObjectCallbacks): void;
|
|
44
|
+
get playState(): SpatializedMotionPlayState;
|
|
45
|
+
get isAnimating(): boolean;
|
|
46
|
+
get isPaused(): boolean;
|
|
47
|
+
get finished(): boolean;
|
|
48
|
+
play(): Promise<void>;
|
|
49
|
+
pause(): Promise<void>;
|
|
50
|
+
stop(): Promise<void>;
|
|
51
|
+
reset(): Promise<void>;
|
|
52
|
+
finish(): Promise<void>;
|
|
53
|
+
protected onDestroy(): void;
|
|
54
|
+
private control;
|
|
55
|
+
onReceiveEvent(data: SpatialAnimationStateChangedMsg | {
|
|
56
|
+
detail?: unknown;
|
|
57
|
+
}): void;
|
|
58
|
+
private isSpatialAnimationStateChangedDetail;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare enum SpatialWebMsgType {
|
|
62
|
+
modelloaded = "modelloaded",
|
|
63
|
+
modelloadfailed = "modelloadfailed",
|
|
64
|
+
spatialtap = "spatialtap",
|
|
65
|
+
spatialdragstart = "spatialdragstart",
|
|
66
|
+
spatialdrag = "spatialdrag",
|
|
67
|
+
spatialdragend = "spatialdragend",
|
|
68
|
+
spatialrotate = "spatialrotate",
|
|
69
|
+
spatialrotateend = "spatialrotateend",
|
|
70
|
+
spatialmagnify = "spatialmagnify",
|
|
71
|
+
spatialmagnifyend = "spatialmagnifyend",
|
|
72
|
+
animationstatechange = "animationstatechange",
|
|
73
|
+
entitytransformchange = "entitytransformchange",
|
|
74
|
+
animationcompleted = "animationcompleted",
|
|
75
|
+
animationstopped = "animationstopped",
|
|
76
|
+
animationfailed = "animationfailed",
|
|
77
|
+
objectdestroy = "objectdestroy"
|
|
78
|
+
}
|
|
79
|
+
interface ObjectDestroyMsg {
|
|
80
|
+
type: SpatialWebMsgType.objectdestroy;
|
|
81
|
+
}
|
|
82
|
+
interface SpatialTapMsg {
|
|
83
|
+
type: SpatialWebMsgType.spatialtap;
|
|
84
|
+
detail: SpatialTapEventDetail;
|
|
85
|
+
}
|
|
86
|
+
interface SpatialDragStartMsg {
|
|
87
|
+
type: SpatialWebMsgType.spatialdragstart;
|
|
88
|
+
detail: SpatialDragStartEventDetail;
|
|
89
|
+
}
|
|
90
|
+
interface SpatialDragMsg {
|
|
91
|
+
type: SpatialWebMsgType.spatialdrag;
|
|
92
|
+
detail: SpatialDragEventDetail;
|
|
93
|
+
}
|
|
94
|
+
interface SpatialDragEndMsg {
|
|
95
|
+
type: SpatialWebMsgType.spatialdragend;
|
|
96
|
+
detail: SpatialDragEndEventDetail;
|
|
97
|
+
}
|
|
98
|
+
interface SpatialRotateMsg {
|
|
99
|
+
type: SpatialWebMsgType.spatialrotate;
|
|
100
|
+
detail: SpatialRotateEventDetail;
|
|
101
|
+
}
|
|
102
|
+
interface SpatialRotateEndMsg {
|
|
103
|
+
type: SpatialWebMsgType.spatialrotateend;
|
|
104
|
+
detail: SpatialRotateEventDetail;
|
|
105
|
+
}
|
|
106
|
+
interface SpatialMagnifyMsg {
|
|
107
|
+
type: SpatialWebMsgType.spatialmagnify;
|
|
108
|
+
detail: SpatialMagnifyEventDetail;
|
|
109
|
+
}
|
|
110
|
+
interface SpatialMagnifyEndMsg {
|
|
111
|
+
type: SpatialWebMsgType.spatialmagnifyend;
|
|
112
|
+
detail: SpatialMagnifyEventDetail;
|
|
113
|
+
}
|
|
114
|
+
interface ModelLoadSuccess {
|
|
115
|
+
type: SpatialWebMsgType.modelloaded;
|
|
116
|
+
detail?: {
|
|
117
|
+
src: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
interface ModelLoadFailure {
|
|
121
|
+
type: SpatialWebMsgType.modelloadfailed;
|
|
122
|
+
}
|
|
123
|
+
interface AnimationStateChangeDetail {
|
|
124
|
+
paused: boolean;
|
|
125
|
+
duration: number;
|
|
126
|
+
/**
|
|
127
|
+
* Sampled animation playback position in seconds at `timestamp`.
|
|
128
|
+
* Optional for compatibility with older native runtimes.
|
|
129
|
+
*/
|
|
130
|
+
currentTime?: number;
|
|
131
|
+
/**
|
|
132
|
+
* Unix epoch time in milliseconds at which `currentTime` was sampled.
|
|
133
|
+
* Used to extrapolate `currentTime` between samples while playing.
|
|
134
|
+
*/
|
|
135
|
+
timestamp?: number;
|
|
136
|
+
}
|
|
137
|
+
interface AnimationStateChangeMsg {
|
|
138
|
+
type: SpatialWebMsgType.animationstatechange;
|
|
139
|
+
detail: AnimationStateChangeDetail;
|
|
140
|
+
}
|
|
141
|
+
interface EntityTransformChangeDetail {
|
|
142
|
+
/** Column-major 4x4 matrix (16 numbers) representing the manipulated transform. */
|
|
143
|
+
transform: number[];
|
|
144
|
+
}
|
|
145
|
+
interface EntityTransformChangeMsg {
|
|
146
|
+
type: SpatialWebMsgType.entitytransformchange;
|
|
147
|
+
detail: EntityTransformChangeDetail;
|
|
148
|
+
}
|
|
149
|
+
interface AnimationCompletedEventPayload {
|
|
150
|
+
type: 'completed';
|
|
151
|
+
/** Column-major 4x4 matrix (16 numbers) representing the final native transform. */
|
|
152
|
+
transform: number[];
|
|
153
|
+
}
|
|
154
|
+
interface AnimationCanceledEventPayload {
|
|
155
|
+
type: 'canceled';
|
|
156
|
+
/** Column-major 4x4 matrix (16 numbers) representing the restored transform after cancel. */
|
|
157
|
+
transform: number[];
|
|
158
|
+
}
|
|
159
|
+
interface AnimationFailedEventPayload {
|
|
160
|
+
type: 'failed';
|
|
161
|
+
animationId: string;
|
|
162
|
+
command: 'play' | 'pause' | 'resume' | 'cancel';
|
|
163
|
+
code?: string;
|
|
164
|
+
reason: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Abstract base class for all spatialized elements in the WebSpatial environment.
|
|
169
|
+
* Provides common functionality for elements that can exist in 3D space,
|
|
170
|
+
* including transformation handling and gesture event processing.
|
|
171
|
+
*/
|
|
172
|
+
declare abstract class SpatializedElement extends SpatialObject {
|
|
173
|
+
readonly id: string;
|
|
174
|
+
/**
|
|
175
|
+
* Identifies the motion target kind supported by this spatialized element.
|
|
176
|
+
*/
|
|
177
|
+
abstract readonly kind: SpatializedMotionKind;
|
|
178
|
+
/**
|
|
179
|
+
* Creates a new spatialized element with the specified ID.
|
|
180
|
+
* Registers the element to receive spatial events.
|
|
181
|
+
* @param id Unique identifier for this element
|
|
182
|
+
*/
|
|
183
|
+
constructor(id: string);
|
|
184
|
+
/**
|
|
185
|
+
* Updates the properties of this spatialized element.
|
|
186
|
+
* Must be implemented by derived classes to handle specific property updates.
|
|
187
|
+
* @param properties Partial set of properties to update
|
|
188
|
+
* @returns Promise resolving to the result of the update operation
|
|
189
|
+
*/
|
|
190
|
+
abstract updateProperties(properties: Partial<SpatializedElementProperties>): Promise<WebSpatialProtocolResult>;
|
|
191
|
+
/**
|
|
192
|
+
* Creates a native-first AnimationObject bound to this spatialized element.
|
|
193
|
+
*/
|
|
194
|
+
createAnimation(config: SpatializedMotionConfig): Promise<AnimationObject>;
|
|
195
|
+
/**
|
|
196
|
+
* Updates the transformation matrix of this element in 3D space.
|
|
197
|
+
* This affects the position, rotation, and scale of the element.
|
|
198
|
+
* @param matrix The new transformation matrix
|
|
199
|
+
* @returns Promise resolving when the transform is updated
|
|
200
|
+
*/
|
|
201
|
+
updateTransform(matrix: DOMMatrix): Promise<CommandResult<any>>;
|
|
202
|
+
/**
|
|
203
|
+
* Information about the element's bounding cube.
|
|
204
|
+
* Used for spatial calculations and hit testing.
|
|
205
|
+
*/
|
|
206
|
+
private _cubeInfo?;
|
|
207
|
+
/**
|
|
208
|
+
* Gets the current cube information for this element.
|
|
209
|
+
* @returns The current CubeInfo or undefined if not set
|
|
210
|
+
*/
|
|
211
|
+
get cubeInfo(): CubeInfo | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* The current transformation matrix of this element.
|
|
214
|
+
*/
|
|
215
|
+
private _transform?;
|
|
216
|
+
/**
|
|
217
|
+
* The inverse of the current transformation matrix.
|
|
218
|
+
* Used for converting world coordinates to local coordinates.
|
|
219
|
+
*/
|
|
220
|
+
private _transformInv?;
|
|
221
|
+
/**
|
|
222
|
+
* Gets the current transformation matrix.
|
|
223
|
+
* @returns The current transformation matrix or undefined if not set
|
|
224
|
+
*/
|
|
225
|
+
get transform(): DOMMatrix | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Gets the inverse of the current transformation matrix.
|
|
228
|
+
* @returns The inverse transformation matrix or undefined if not set
|
|
229
|
+
*/
|
|
230
|
+
get transformInv(): DOMMatrix | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* Processes events received from the WebSpatial environment.
|
|
233
|
+
* Handles various spatial events like transforms, gestures, and interactions.
|
|
234
|
+
* @param data The event data received from the WebSpatial system
|
|
235
|
+
*/
|
|
236
|
+
protected onReceiveEvent(data: ReceiveEventData): void;
|
|
237
|
+
private _onSpatialTap?;
|
|
238
|
+
set onSpatialTap(value: (event: SpatialTapEvent) => void | undefined);
|
|
239
|
+
private _onSpatialDragStart?;
|
|
240
|
+
set onSpatialDragStart(value: (event: SpatialDragStartEvent) => void | undefined);
|
|
241
|
+
private _onSpatialDrag?;
|
|
242
|
+
set onSpatialDrag(value: (event: SpatialDragEvent) => void | undefined);
|
|
243
|
+
private _onSpatialDragEnd?;
|
|
244
|
+
set onSpatialDragEnd(value: ((event: SpatialDragEndEvent) => void) | undefined);
|
|
245
|
+
private _onSpatialRotate?;
|
|
246
|
+
set onSpatialRotate(value: ((event: SpatialRotateEvent) => void) | undefined);
|
|
247
|
+
private _onSpatialRotateEnd?;
|
|
248
|
+
set onSpatialRotateEnd(value: ((event: SpatialRotateEndEvent) => void) | undefined);
|
|
249
|
+
private _onSpatialMagnify?;
|
|
250
|
+
set onSpatialMagnify(value: ((event: SpatialMagnifyEvent) => void) | undefined);
|
|
251
|
+
private _onSpatialMagnifyEnd?;
|
|
252
|
+
set onSpatialMagnifyEnd(value: ((event: SpatialMagnifyEndEvent) => void) | undefined);
|
|
253
|
+
/**
|
|
254
|
+
* Cleans up resources when this element is destroyed.
|
|
255
|
+
* Removes event receivers to prevent memory leaks.
|
|
256
|
+
*/
|
|
257
|
+
onDestroy(): void;
|
|
258
|
+
}
|
|
259
|
+
type ReceiveEventData = SpatialTapMsg | SpatialDragStartMsg | SpatialDragMsg | SpatialDragEndMsg | SpatialRotateMsg | SpatialRotateEndMsg | ObjectDestroyMsg;
|
|
260
|
+
|
|
261
|
+
declare class SpatializedDynamic3DElement extends SpatializedElement {
|
|
262
|
+
/**
|
|
263
|
+
* Identifies the motion target kind supported by this element.
|
|
264
|
+
*/
|
|
265
|
+
readonly kind: "dynamic3d";
|
|
266
|
+
children: SpatialEntityOrReality[];
|
|
267
|
+
events: Record<string, (data: any) => void>;
|
|
268
|
+
constructor(id: string);
|
|
269
|
+
addEntity(entity: SpatialEntity): Promise<CommandResult<any>>;
|
|
270
|
+
addEvent(type: SpatialEntityEventType, callback: (data: any) => void): void;
|
|
271
|
+
removeEvent(eventName: SpatialEntityEventType): void;
|
|
272
|
+
dispatchEvent(evt: CustomEvent): void;
|
|
273
|
+
updateProperties(properties: Partial<SpatializedElementProperties>): Promise<CommandResult<any>>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
interface Vec3 {
|
|
277
|
+
x: number;
|
|
278
|
+
y: number;
|
|
279
|
+
z: number;
|
|
280
|
+
}
|
|
281
|
+
type Point3D = Vec3;
|
|
282
|
+
interface Quaternion {
|
|
283
|
+
x: number;
|
|
284
|
+
y: number;
|
|
285
|
+
z: number;
|
|
286
|
+
w: number;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Material type for SpatialDiv or HTML document.
|
|
290
|
+
*
|
|
291
|
+
* This type defines the background material options for both SpatialDiv elements and HTML documents.
|
|
292
|
+
*
|
|
293
|
+
* - `'none'`: This is the default value.
|
|
294
|
+
* - For HTML documents, the web page window will have the default native background.
|
|
295
|
+
* - For SpatialDiv, the window will have a transparent background.
|
|
296
|
+
* - `'translucent'`: Represents a glass-like material in AVP (Apple Vision Pro).
|
|
297
|
+
* - `'thick'`: Represents a thick material in AVP.
|
|
298
|
+
* - `'regular'`: Represents a regular material in AVP.
|
|
299
|
+
* - `'thin'`: Represents a thin material in AVP.
|
|
300
|
+
* - `'transparent'`: Represents a fully transparent background.
|
|
301
|
+
*/
|
|
302
|
+
type BackgroundMaterialType = 'none' | 'translucent' | 'thick' | 'regular' | 'thin' | 'transparent';
|
|
303
|
+
type CornerRadius = {
|
|
304
|
+
topLeading: number;
|
|
305
|
+
bottomLeading: number;
|
|
306
|
+
topTrailing: number;
|
|
307
|
+
bottomTrailing: number;
|
|
308
|
+
};
|
|
309
|
+
interface SpatialSceneProperties {
|
|
310
|
+
cornerRadius: CornerRadius;
|
|
311
|
+
material: BackgroundMaterialType;
|
|
312
|
+
opacity: number;
|
|
313
|
+
}
|
|
314
|
+
declare enum SpatializedElementType {
|
|
315
|
+
Spatialized2DElement = 0,
|
|
316
|
+
SpatializedStatic3DElement = 1,
|
|
317
|
+
SpatializedDynamic3DElement = 2
|
|
318
|
+
}
|
|
319
|
+
interface SpatializedElementProperties {
|
|
320
|
+
name: string;
|
|
321
|
+
clientX: number;
|
|
322
|
+
clientY: number;
|
|
323
|
+
width: number;
|
|
324
|
+
height: number;
|
|
325
|
+
depth: number;
|
|
326
|
+
opacity: number;
|
|
327
|
+
visible: boolean;
|
|
328
|
+
scrollWithParent: boolean;
|
|
329
|
+
zIndex: number;
|
|
330
|
+
backOffset: number;
|
|
331
|
+
rotationAnchor: Point3D;
|
|
332
|
+
enableTapGesture: boolean;
|
|
333
|
+
enableDragStartGesture: boolean;
|
|
334
|
+
enableDragGesture: boolean;
|
|
335
|
+
enableDragEndGesture: boolean;
|
|
336
|
+
enableRotateGesture: boolean;
|
|
337
|
+
enableRotateEndGesture: boolean;
|
|
338
|
+
enableMagnifyGesture: boolean;
|
|
339
|
+
enableMagnifyEndGesture: boolean;
|
|
340
|
+
/**
|
|
341
|
+
* Optional world-space axis for spatial rotate gesture. Omitted or zero vector
|
|
342
|
+
* means unconstrained rotation (platform default).
|
|
343
|
+
*/
|
|
344
|
+
rotateConstrainedToAxis?: Vec3;
|
|
345
|
+
}
|
|
346
|
+
interface Spatialized2DElementProperties extends SpatializedElementProperties {
|
|
347
|
+
scrollPageEnabled: boolean;
|
|
348
|
+
cornerRadius: CornerRadius;
|
|
349
|
+
material: BackgroundMaterialType;
|
|
350
|
+
scrollEdgeInsetsMarginRight: number;
|
|
351
|
+
}
|
|
352
|
+
interface ModelSource {
|
|
353
|
+
src: string;
|
|
354
|
+
type?: string;
|
|
355
|
+
}
|
|
356
|
+
type ModelLoadingMode = 'eager' | 'lazy';
|
|
357
|
+
type StageMode = 'orbit' | 'none';
|
|
358
|
+
interface SpatializedStatic3DElementProperties extends SpatializedElementProperties {
|
|
359
|
+
modelURL: string;
|
|
360
|
+
sources?: ModelSource[];
|
|
361
|
+
modelTransform?: number[];
|
|
362
|
+
stagemode?: StageMode;
|
|
363
|
+
autoplay?: boolean;
|
|
364
|
+
loop?: boolean;
|
|
365
|
+
animationPaused?: boolean;
|
|
366
|
+
playbackRate?: number;
|
|
367
|
+
currentTime?: number;
|
|
368
|
+
posterURL?: string;
|
|
369
|
+
loading?: ModelLoadingMode;
|
|
370
|
+
}
|
|
371
|
+
interface SpatialSceneCreationOptions {
|
|
372
|
+
defaultSize?: {
|
|
373
|
+
width: number | string;
|
|
374
|
+
height: number | string;
|
|
375
|
+
depth?: number | string;
|
|
376
|
+
};
|
|
377
|
+
resizability?: {
|
|
378
|
+
minWidth?: number | string;
|
|
379
|
+
minHeight?: number | string;
|
|
380
|
+
maxWidth?: number | string;
|
|
381
|
+
maxHeight?: number | string;
|
|
382
|
+
};
|
|
383
|
+
worldScaling?: WorldScalingType;
|
|
384
|
+
worldAlignment?: WorldAlignmentType;
|
|
385
|
+
baseplateVisibility?: BaseplateVisibilityType;
|
|
386
|
+
}
|
|
387
|
+
type SpatialEntityEventType = 'spatialtap' | 'spatialdragstart' | 'spatialdrag' | 'spatialdragend' | 'spatialrotate' | 'spatialrotateend' | 'spatialmagnify' | 'spatialmagnifyend';
|
|
388
|
+
declare const BaseplateVisibilityValues: readonly ["automatic", "visible", "hidden"];
|
|
389
|
+
type BaseplateVisibilityType = (typeof BaseplateVisibilityValues)[number];
|
|
390
|
+
declare function isValidBaseplateVisibilityType(type: string): Boolean;
|
|
391
|
+
declare const WorldScalingValues: readonly ["automatic", "dynamic"];
|
|
392
|
+
type WorldScalingType = (typeof WorldScalingValues)[number];
|
|
393
|
+
declare function isValidWorldScalingType(type: string): Boolean;
|
|
394
|
+
declare const WorldAlignmentValues: readonly ["adaptive", "automatic", "gravityAligned"];
|
|
395
|
+
type WorldAlignmentType = (typeof WorldAlignmentValues)[number];
|
|
396
|
+
declare function isValidWorldAlignmentType(type: string): Boolean;
|
|
397
|
+
declare const SpatialSceneValues: readonly ["window", "volume"];
|
|
398
|
+
type SpatialSceneType = (typeof SpatialSceneValues)[number];
|
|
399
|
+
declare function isValidSpatialSceneType(type: string): Boolean;
|
|
400
|
+
/**
|
|
401
|
+
* check px,m and number, number must be >= 0
|
|
402
|
+
*
|
|
403
|
+
* */
|
|
404
|
+
declare function isValidSceneUnit(val: string | number): boolean;
|
|
405
|
+
interface SpatialEntityProperties {
|
|
406
|
+
position: Vec3;
|
|
407
|
+
rotation: Vec3;
|
|
408
|
+
scale: Vec3;
|
|
409
|
+
}
|
|
410
|
+
type SpatialGeometryType = 'BoxGeometry' | 'PlaneGeometry' | 'SphereGeometry' | 'CylinderGeometry' | 'ConeGeometry';
|
|
411
|
+
interface SpatialBoxGeometryOptions {
|
|
412
|
+
width?: number;
|
|
413
|
+
height?: number;
|
|
414
|
+
depth?: number;
|
|
415
|
+
cornerRadius?: number;
|
|
416
|
+
splitFaces?: boolean;
|
|
417
|
+
}
|
|
418
|
+
interface SpatialPlaneGeometryOptions {
|
|
419
|
+
width?: number;
|
|
420
|
+
height?: number;
|
|
421
|
+
cornerRadius?: number;
|
|
422
|
+
}
|
|
423
|
+
interface SpatialSphereGeometryOptions {
|
|
424
|
+
radius?: number;
|
|
425
|
+
}
|
|
426
|
+
interface SpatialConeGeometryOptions {
|
|
427
|
+
radius?: number;
|
|
428
|
+
height?: number;
|
|
429
|
+
}
|
|
430
|
+
interface SpatialCylinderGeometryOptions {
|
|
431
|
+
radius?: number;
|
|
432
|
+
height?: number;
|
|
433
|
+
}
|
|
434
|
+
type SpatialGeometryOptions = SpatialBoxGeometryOptions | SpatialPlaneGeometryOptions | SpatialSphereGeometryOptions | SpatialCylinderGeometryOptions | SpatialConeGeometryOptions;
|
|
435
|
+
type SpatialMaterialType = 'unlit';
|
|
436
|
+
interface SpatialUnlitMaterialOptions {
|
|
437
|
+
color?: string;
|
|
438
|
+
textureId?: string;
|
|
439
|
+
transparent?: boolean;
|
|
440
|
+
opacity?: number;
|
|
441
|
+
}
|
|
442
|
+
interface SpatialTextureResourceOptions {
|
|
443
|
+
url: string;
|
|
444
|
+
}
|
|
445
|
+
interface ModelComponentOptions {
|
|
446
|
+
mesh: SpatialGeometry;
|
|
447
|
+
materials: SpatialMaterial[];
|
|
448
|
+
}
|
|
449
|
+
interface SpatialEntityUserData {
|
|
450
|
+
id?: string;
|
|
451
|
+
name?: string;
|
|
452
|
+
}
|
|
453
|
+
interface SpatialModelEntityCreationOptions {
|
|
454
|
+
modelAssetId: string;
|
|
455
|
+
name?: string;
|
|
456
|
+
}
|
|
457
|
+
interface ModelAssetOptions {
|
|
458
|
+
url: string;
|
|
459
|
+
}
|
|
460
|
+
declare enum SpatialSceneState$1 {
|
|
461
|
+
idle = "idle",
|
|
462
|
+
pending = "pending",
|
|
463
|
+
willVisible = "willVisible",
|
|
464
|
+
visible = "visible",
|
|
465
|
+
fail = "fail"
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Translate event, matching similar behavior to https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drag_event
|
|
469
|
+
*/
|
|
470
|
+
type SpatialModelDragEvent = {
|
|
471
|
+
eventType: 'dragstart' | 'dragend' | 'drag';
|
|
472
|
+
translation3D: Vec3;
|
|
473
|
+
startLocation3D: Vec3;
|
|
474
|
+
};
|
|
475
|
+
interface Size {
|
|
476
|
+
width: number;
|
|
477
|
+
height: number;
|
|
478
|
+
}
|
|
479
|
+
interface Size3D extends Size {
|
|
480
|
+
depth: number;
|
|
481
|
+
}
|
|
482
|
+
declare class CubeInfo {
|
|
483
|
+
size: Size3D;
|
|
484
|
+
origin: Vec3;
|
|
485
|
+
constructor(size: Size3D, origin: Vec3);
|
|
486
|
+
get x(): number;
|
|
487
|
+
get y(): number;
|
|
488
|
+
get z(): number;
|
|
489
|
+
get width(): number;
|
|
490
|
+
get height(): number;
|
|
491
|
+
get depth(): number;
|
|
492
|
+
get left(): number;
|
|
493
|
+
get top(): number;
|
|
494
|
+
get right(): number;
|
|
495
|
+
get bottom(): number;
|
|
496
|
+
get back(): number;
|
|
497
|
+
get front(): number;
|
|
498
|
+
}
|
|
499
|
+
interface SpatialTapEventDetail {
|
|
500
|
+
location3D: Point3D;
|
|
501
|
+
globalLocation3D?: Point3D;
|
|
502
|
+
}
|
|
503
|
+
type SpatialTapEvent = CustomEvent<SpatialTapEventDetail>;
|
|
504
|
+
interface SpatialDragStartEventDetail {
|
|
505
|
+
startLocation3D: Point3D;
|
|
506
|
+
globalLocation3D?: Point3D;
|
|
507
|
+
}
|
|
508
|
+
interface SpatialDragEventDetail {
|
|
509
|
+
translation3D: Vec3;
|
|
510
|
+
}
|
|
511
|
+
interface SpatialDragEndEventDetail {
|
|
512
|
+
}
|
|
513
|
+
type SpatialDragStartEvent = CustomEvent<SpatialDragStartEventDetail>;
|
|
514
|
+
type SpatialDragEvent = CustomEvent<SpatialDragEventDetail>;
|
|
515
|
+
type SpatialDragEndEvent = CustomEvent<SpatialDragEndEventDetail>;
|
|
516
|
+
interface SpatialRotateEventDetail {
|
|
517
|
+
quaternion: Quaternion;
|
|
518
|
+
}
|
|
519
|
+
interface SpatialRotateEndEventDetail {
|
|
520
|
+
}
|
|
521
|
+
type SpatialRotateEvent = CustomEvent<SpatialRotateEventDetail>;
|
|
522
|
+
type SpatialRotateEndEvent = CustomEvent<SpatialRotateEndEventDetail>;
|
|
523
|
+
interface SpatialMagnifyEventDetail {
|
|
524
|
+
magnification: number;
|
|
525
|
+
}
|
|
526
|
+
interface SpatialMagnifyEndEventDetail {
|
|
527
|
+
}
|
|
528
|
+
type SpatialMagnifyEvent = CustomEvent<SpatialMagnifyEventDetail>;
|
|
529
|
+
type SpatialMagnifyEndEvent = CustomEvent<SpatialMagnifyEndEventDetail>;
|
|
530
|
+
type SpatialEntityOrReality = SpatialEntity | SpatializedDynamic3DElement;
|
|
531
|
+
interface AttachmentEntityOptions {
|
|
532
|
+
parentEntityId: string;
|
|
533
|
+
position?: [number, number, number];
|
|
534
|
+
size: {
|
|
535
|
+
width: number;
|
|
536
|
+
height: number;
|
|
537
|
+
};
|
|
538
|
+
ownerViewId: string;
|
|
539
|
+
}
|
|
540
|
+
interface AttachmentEntityUpdateOptions {
|
|
541
|
+
position?: [number, number, number];
|
|
542
|
+
size?: {
|
|
543
|
+
width: number;
|
|
544
|
+
height: number;
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
type SceneUnitPx = `${number}px`;
|
|
548
|
+
type SceneUnitM = `${number}m`;
|
|
549
|
+
type SceneUnit = number | SceneUnitPx | SceneUnitM;
|
|
550
|
+
interface XRSceneSize {
|
|
551
|
+
width: SceneUnit;
|
|
552
|
+
height: SceneUnit;
|
|
553
|
+
depth?: SceneUnit;
|
|
554
|
+
}
|
|
555
|
+
interface XRSceneResizability {
|
|
556
|
+
minWidth?: SceneUnit;
|
|
557
|
+
minHeight?: SceneUnit;
|
|
558
|
+
maxWidth?: SceneUnit;
|
|
559
|
+
maxHeight?: SceneUnit;
|
|
560
|
+
}
|
|
561
|
+
interface XRMainSceneConfig extends XRSpatialSceneDefaults {
|
|
562
|
+
type?: SpatialSceneType;
|
|
563
|
+
}
|
|
564
|
+
interface XRSpatialSceneDefaults {
|
|
565
|
+
default_size?: XRSceneSize;
|
|
566
|
+
resizability?: XRSceneResizability;
|
|
567
|
+
worldScaling?: WorldScalingType;
|
|
568
|
+
worldAlignment?: WorldAlignmentType;
|
|
569
|
+
baseplateVisibility?: BaseplateVisibilityType;
|
|
570
|
+
}
|
|
571
|
+
interface XRSpatialSceneOverrides {
|
|
572
|
+
window_scene?: XRSpatialSceneDefaults;
|
|
573
|
+
volume_scene?: XRSpatialSceneDefaults;
|
|
574
|
+
}
|
|
575
|
+
interface XRSpatialSceneConfig extends XRSpatialSceneDefaults {
|
|
576
|
+
overrides?: XRSpatialSceneOverrides;
|
|
577
|
+
}
|
|
578
|
+
interface XRPrdConfig {
|
|
579
|
+
xr_main_scene?: XRMainSceneConfig;
|
|
580
|
+
xr_spatial_scene?: XRSpatialSceneConfig;
|
|
581
|
+
}
|
|
582
|
+
interface PWAManifest extends XRPrdConfig {
|
|
583
|
+
name?: string;
|
|
584
|
+
short_name?: string;
|
|
585
|
+
start_url?: string;
|
|
586
|
+
display?: string;
|
|
587
|
+
icons?: Array<{
|
|
588
|
+
src: string;
|
|
589
|
+
sizes?: string;
|
|
590
|
+
type?: string;
|
|
591
|
+
purpose?: string;
|
|
592
|
+
}>;
|
|
593
|
+
id?: string;
|
|
594
|
+
scope?: string;
|
|
595
|
+
[key: string]: any;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
type SpatialSceneCreationOptionsInternal = SpatialSceneCreationOptions & {
|
|
599
|
+
type: SpatialSceneType;
|
|
600
|
+
};
|
|
601
|
+
declare enum SpatialSceneState {
|
|
602
|
+
idle = "idle",
|
|
603
|
+
pending = "pending",
|
|
604
|
+
willVisible = "willVisible",
|
|
605
|
+
visible = "visible",
|
|
606
|
+
fail = "fail"
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
interface CommandResult<TData = any> {
|
|
610
|
+
success: boolean;
|
|
611
|
+
data: TData;
|
|
612
|
+
errorCode: string | undefined;
|
|
613
|
+
errorMessage: string | undefined;
|
|
614
|
+
}
|
|
615
|
+
type WebSpatialProtocolResult = CommandResult<{
|
|
616
|
+
windowProxy: any;
|
|
617
|
+
id: string;
|
|
618
|
+
} | undefined>;
|
|
619
|
+
/**
|
|
620
|
+
* Host/runtime bridge: JSB plus explicit spatial host capabilities.
|
|
621
|
+
* Implementations may use webspatial://, iframes, native events, etc.
|
|
622
|
+
*/
|
|
623
|
+
interface PlatformAbility {
|
|
624
|
+
callJSB(cmd: string, msg: string): Promise<CommandResult>;
|
|
625
|
+
/**
|
|
626
|
+
* Open a spatial scene synchronously (e.g. window.open polyfill).
|
|
627
|
+
* Implementations may use webspatial://createSpatialScene under the hood.
|
|
628
|
+
*/
|
|
629
|
+
openSpatialSceneSync(url: string, config: SpatialSceneCreationOptionsInternal | undefined, target?: string, features?: string): WebSpatialProtocolResult;
|
|
630
|
+
/** Create a native-backed spatial 2D surface (spatial div). */
|
|
631
|
+
createNativeSpatialDiv(): Promise<WebSpatialProtocolResult>;
|
|
632
|
+
/** Create a native attachment surface; options reserved for future protocol fields. */
|
|
633
|
+
createNativeAttachment(options?: AttachmentEntityOptions): Promise<WebSpatialProtocolResult>;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
declare class SpatialEntity extends SpatialObject {
|
|
637
|
+
userData?: SpatialEntityUserData | undefined;
|
|
638
|
+
position: Vec3;
|
|
639
|
+
rotation: Vec3;
|
|
640
|
+
scale: Vec3;
|
|
641
|
+
events: Record<string, (data: any) => void>;
|
|
642
|
+
children: SpatialEntity[];
|
|
643
|
+
parent: SpatialEntityOrReality | null;
|
|
644
|
+
private _enableInput;
|
|
645
|
+
get enableInput(): boolean;
|
|
646
|
+
set enableInput(value: boolean);
|
|
647
|
+
constructor(id: string, userData?: SpatialEntityUserData | undefined);
|
|
648
|
+
addComponent(component: SpatialComponent): Promise<CommandResult<any>>;
|
|
649
|
+
removeComponent(component: SpatialComponent): Promise<CommandResult<any>>;
|
|
650
|
+
setPosition(position: Vec3): Promise<CommandResult<any>>;
|
|
651
|
+
setRotation(rotation: Vec3): Promise<CommandResult<any>>;
|
|
652
|
+
setScale(scale: Vec3): Promise<CommandResult<any>>;
|
|
653
|
+
addEntity(ent: SpatialEntity): Promise<CommandResult<any>>;
|
|
654
|
+
removeFromParent(): Promise<CommandResult<any>>;
|
|
655
|
+
updateTransform(properties: Partial<SpatialEntityProperties>): Promise<CommandResult<any>>;
|
|
656
|
+
/**
|
|
657
|
+
* Send an animation command to the native layer.
|
|
658
|
+
*
|
|
659
|
+
* For `play`: registers event listeners for completion / stop / failure,
|
|
660
|
+
* sends the JSB command, and returns an `AnimateTransformResult` with
|
|
661
|
+
* `finished` and `stopped` promises.
|
|
662
|
+
*
|
|
663
|
+
* For `pause`, `resume`, `cancel``: sends the command and resolves when
|
|
664
|
+
* the bridge acknowledges it.
|
|
665
|
+
*/
|
|
666
|
+
animateTransform(command: AnimateTransformCommand & {
|
|
667
|
+
type: 'play';
|
|
668
|
+
}): Promise<AnimateTransformResult>;
|
|
669
|
+
animateTransform(command: AnimateTransformCommand): Promise<void>;
|
|
670
|
+
/**
|
|
671
|
+
* Remove all animation event receivers for a given animationId.
|
|
672
|
+
* Called on entity unmount to prevent leaked listeners.
|
|
673
|
+
*/
|
|
674
|
+
cleanupAnimationListeners(animationId: string): void;
|
|
675
|
+
addEvent(type: SpatialEntityEventType, callback: (data: any) => void): Promise<void>;
|
|
676
|
+
removeEvent(eventName: SpatialEntityEventType): Promise<void>;
|
|
677
|
+
updateEntityEvent(eventName: SpatialEntityEventType, isEnable: boolean): Promise<CommandResult<any>>;
|
|
678
|
+
private onReceiveEvent;
|
|
679
|
+
dispatchEvent(evt: CustomEvent): void;
|
|
680
|
+
protected onDestroy(): void;
|
|
681
|
+
convertFromEntityToEntity(fromEntityId: string, toEntityId: string, position: Vec3): Promise<CommandResult<any>>;
|
|
682
|
+
convertFromEntityToScene(fromEntityId: string, position: Vec3): Promise<CommandResult<any>>;
|
|
683
|
+
convertFromSceneToEntity(entityId: string, position: Vec3): Promise<CommandResult<any>>;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
type TimingFunction = 'linear' | 'easeIn' | 'easeOut' | 'easeInOut';
|
|
687
|
+
/**
|
|
688
|
+
* Transform values used in animation callbacks (`onComplete`, `onCancel`).
|
|
689
|
+
* Rotation values are Euler angles in **degrees**, matching the input convention
|
|
690
|
+
* of `AnimationConfig` and the entity `rotation` prop.
|
|
691
|
+
*/
|
|
692
|
+
interface TransformValues {
|
|
693
|
+
position?: Vec3;
|
|
694
|
+
rotation?: Vec3;
|
|
695
|
+
scale?: Vec3;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Represents the current state of an animation session as exposed by
|
|
699
|
+
* `api.playState`. The internal `delaying` state maps to `'running'`
|
|
700
|
+
* because from the developer's perspective the session is actively progressing.
|
|
701
|
+
*/
|
|
702
|
+
type AnimationPlayState = 'idle' | 'queued' | 'running' | 'paused' | 'finished';
|
|
703
|
+
/**
|
|
704
|
+
* Configuration for `useAnimation`.
|
|
705
|
+
*
|
|
706
|
+
* `to` is required and declares which transform fields are animated.
|
|
707
|
+
* `from` is optional; omitting it causes the native layer to snapshot
|
|
708
|
+
* the entity's current transform at playback time.
|
|
709
|
+
*/
|
|
710
|
+
interface AnimationConfig {
|
|
711
|
+
/**
|
|
712
|
+
* Target transform values (required).
|
|
713
|
+
* Rotation values are Euler angles in degrees.
|
|
714
|
+
* Single-axis rotation > 180 deg may produce unexpected results (shortest-path SLERP).
|
|
715
|
+
*/
|
|
716
|
+
to: TransformValues;
|
|
717
|
+
/** Starting transform values. Omit to animate from the entity's current state. */
|
|
718
|
+
from?: TransformValues;
|
|
719
|
+
/** Duration in seconds. Default: 0.3 */
|
|
720
|
+
duration?: number;
|
|
721
|
+
/**
|
|
722
|
+
* Easing curve. Default: 'easeInOut'
|
|
723
|
+
* Only these four values are valid; other strings will throw at validation time.
|
|
724
|
+
*/
|
|
725
|
+
timingFunction?: TimingFunction;
|
|
726
|
+
/** Delay before playback starts, in seconds. Default: 0 */
|
|
727
|
+
delay?: number;
|
|
728
|
+
/** Start automatically when the entity mounts. Default: true */
|
|
729
|
+
autoStart?: boolean;
|
|
730
|
+
/**
|
|
731
|
+
* Loop behavior.
|
|
732
|
+
* - true: reset to `from` and replay (infinite reset loop)
|
|
733
|
+
* - { reverse: true }: alternate direction each cycle (infinite reverse loop)
|
|
734
|
+
* - undefined / false: play once
|
|
735
|
+
*/
|
|
736
|
+
loop?: boolean | {
|
|
737
|
+
reverse?: boolean;
|
|
738
|
+
};
|
|
739
|
+
/**
|
|
740
|
+
* Playback speed multiplier. Default: 1
|
|
741
|
+
* Values > 1 speed up; values between 0 and 1 slow down.
|
|
742
|
+
* Must be a positive finite number (> 0).
|
|
743
|
+
* Applied at session creation time and remains constant for the session.
|
|
744
|
+
* Maps to AnimationView.speed on the native (AVP) side.
|
|
745
|
+
*/
|
|
746
|
+
playbackRate?: number;
|
|
747
|
+
/** Called when the session is established successfully. */
|
|
748
|
+
onStart?: () => void;
|
|
749
|
+
/** Called when a non-looping animation finishes naturally. */
|
|
750
|
+
onComplete?: (finalValues: TransformValues) => void;
|
|
751
|
+
/** Called when playback is canceled via api.cancel(). Receives the restored transform. */
|
|
752
|
+
onCancel?: (currentValues: TransformValues) => void;
|
|
753
|
+
/**
|
|
754
|
+
* Called when an asynchronous error occurs during a bridge or native operation.
|
|
755
|
+
* If not provided, the SDK logs the error via console.error.
|
|
756
|
+
*/
|
|
757
|
+
onError?: (error: AnimationError) => void;
|
|
758
|
+
}
|
|
759
|
+
interface AnimationError {
|
|
760
|
+
/** The session that encountered the error. */
|
|
761
|
+
animationId: string;
|
|
762
|
+
/** The command that failed. */
|
|
763
|
+
command: 'play' | 'pause' | 'resume' | 'cancel';
|
|
764
|
+
/** Optional machine-readable error code. */
|
|
765
|
+
code?: string;
|
|
766
|
+
/** Human-readable failure reason. */
|
|
767
|
+
reason: string;
|
|
768
|
+
}
|
|
769
|
+
interface AnimationApi {
|
|
770
|
+
/** Start the animation, or continue it from paused progress. */
|
|
771
|
+
play(): void;
|
|
772
|
+
/** Pause the animation at the current progress. */
|
|
773
|
+
pause(): void;
|
|
774
|
+
/** Cancel the animation and restore `from`, or the start snapshot when `from` is omitted. */
|
|
775
|
+
cancel(): void;
|
|
776
|
+
/** Whether the session is currently queued, delaying, or running (false while paused or idle). */
|
|
777
|
+
readonly isAnimating: boolean;
|
|
778
|
+
/** Whether the animation is currently paused. */
|
|
779
|
+
readonly isPaused: boolean;
|
|
780
|
+
/** Current session state. */
|
|
781
|
+
readonly playState: AnimationPlayState;
|
|
782
|
+
/** Whether the most recent current session completed naturally. */
|
|
783
|
+
readonly finished: boolean;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Opaque object returned as the first tuple element of `useAnimation`.
|
|
787
|
+
* Pass it directly to the entity's `animation` prop.
|
|
788
|
+
* Application code should not read or modify its internal fields.
|
|
789
|
+
*/
|
|
790
|
+
interface AnimatedProps {
|
|
791
|
+
/** @internal Unique identifier for this animation object. */
|
|
792
|
+
readonly __animationObjectId: string;
|
|
793
|
+
/** @internal Transform fields targeted by this animation. */
|
|
794
|
+
readonly __animatedFields: readonly ('position' | 'rotation' | 'scale')[];
|
|
795
|
+
/** @internal Whether the animation currently has an alive session. */
|
|
796
|
+
readonly __animating: boolean;
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* Float4x4 is a 16-element column-major matrix stored in a Float64Array,
|
|
800
|
+
* matching `DOMMatrix.toFloat64Array()`.
|
|
801
|
+
*/
|
|
802
|
+
type Float4x4 = Float64Array;
|
|
803
|
+
/**
|
|
804
|
+
* Unified command sent from React SDK -> Core SDK -> native.
|
|
805
|
+
*/
|
|
806
|
+
interface AnimateTransformCommand {
|
|
807
|
+
/**
|
|
808
|
+
* Unique session identifier. A new `animationId` is generated for each
|
|
809
|
+
* `play` command; `pause`, `resume`, and `stop` reuse the session's id.
|
|
810
|
+
*/
|
|
811
|
+
animationId: string;
|
|
812
|
+
type: 'play' | 'pause' | 'resume' | 'cancel';
|
|
813
|
+
/** Required when type is 'play'; ignored otherwise. */
|
|
814
|
+
entityId?: string;
|
|
815
|
+
toTransform?: Float4x4;
|
|
816
|
+
fromTransform?: Float4x4;
|
|
817
|
+
duration?: number;
|
|
818
|
+
timingFunction?: TimingFunction;
|
|
819
|
+
delay?: number;
|
|
820
|
+
loop?: boolean | {
|
|
821
|
+
reverse?: boolean;
|
|
822
|
+
};
|
|
823
|
+
/** Playback speed multiplier. Default: 1. Must be positive (> 0). Maps to AnimationView.speed on AVP. */
|
|
824
|
+
playbackRate?: number;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Result returned by `SpatialEntity.animateTransform({ type: 'play' })`.
|
|
828
|
+
*/
|
|
829
|
+
interface AnimateTransformResult {
|
|
830
|
+
animationId: string;
|
|
831
|
+
/** Resolves when a non-looping animation completes naturally. */
|
|
832
|
+
finished: Promise<TransformValues>;
|
|
833
|
+
/**
|
|
834
|
+
* Resolves when the animation is canceled and restored to `from`.
|
|
835
|
+
* After cancel, `finished` MUST remain pending (not rejected).
|
|
836
|
+
*/
|
|
837
|
+
canceled: Promise<TransformValues>;
|
|
838
|
+
/**
|
|
839
|
+
* Resolves when the animation fails due to a native or bridge error.
|
|
840
|
+
* Optional because older native runtimes may not emit the failed event.
|
|
841
|
+
*/
|
|
842
|
+
failed?: Promise<AnimationError>;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* @internal
|
|
846
|
+
* Extended interface for `AnimatedProps` used internally by the entity layer
|
|
847
|
+
* to bind/unbind animations and query suppressed transform fields.
|
|
848
|
+
* Application code should never use this interface directly.
|
|
849
|
+
*/
|
|
850
|
+
interface AnimatedPropsInternal extends AnimatedProps {
|
|
851
|
+
/** Called by the entity layer when the entity instance becomes available. */
|
|
852
|
+
__bind: (entity: SpatialEntity) => void;
|
|
853
|
+
/** Called by the entity layer when the entity is destroyed or animation prop changes. */
|
|
854
|
+
__unbind: () => void;
|
|
855
|
+
/** Returns the transform fields currently suppressed by an alive animation session. */
|
|
856
|
+
__getSuppressedFields: () => readonly ('position' | 'rotation' | 'scale')[] | null;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/** Spatialized container kinds with declarative timeline motion. */
|
|
860
|
+
type SpatializedMotionKind = 'spatialized2d' | 'static3d' | 'dynamic3d';
|
|
861
|
+
/** Scalar property path on the spatialized visual whitelist. */
|
|
862
|
+
declare const SPATIALIZED_MOTION_PROPERTIES: readonly ["opacity", "transform.translate.x", "transform.translate.y", "transform.translate.z", "transform.rotate.x", "transform.rotate.y", "transform.rotate.z", "transform.scale.x", "transform.scale.y", "transform.scale.z"];
|
|
863
|
+
type SpatializedMotionProperty = (typeof SPATIALIZED_MOTION_PROPERTIES)[number];
|
|
864
|
+
interface SpatializedMotionKeyframe {
|
|
865
|
+
/** Time in seconds from timeline start, in `[0, duration]`. */
|
|
866
|
+
at: number;
|
|
867
|
+
value: number;
|
|
868
|
+
timingFunction?: TimingFunction;
|
|
869
|
+
}
|
|
870
|
+
type SpatializedMotionKeyframeValues = SpatializedVisualValues & {
|
|
871
|
+
timingFunction?: TimingFunction;
|
|
872
|
+
};
|
|
873
|
+
/** One animatable property path and its keyframes (config-only, not a runtime handle). */
|
|
874
|
+
interface SpatializedMotionTrack {
|
|
875
|
+
property: SpatializedMotionProperty;
|
|
876
|
+
keyframes: SpatializedMotionKeyframe[];
|
|
877
|
+
timingFunction?: TimingFunction;
|
|
878
|
+
}
|
|
879
|
+
/** Single-segment motion: `from` → `to` over `duration`. */
|
|
880
|
+
interface SpatializedMotionSegmentConfig {
|
|
881
|
+
to: SpatializedVisualValues;
|
|
882
|
+
from: SpatializedVisualValues;
|
|
883
|
+
tracks?: never;
|
|
884
|
+
timeline?: never;
|
|
885
|
+
duration?: number;
|
|
886
|
+
timingFunction?: TimingFunction;
|
|
887
|
+
delay?: number;
|
|
888
|
+
autoStart?: boolean;
|
|
889
|
+
loop?: boolean | {
|
|
890
|
+
reverse?: boolean;
|
|
891
|
+
};
|
|
892
|
+
playbackRate?: number;
|
|
893
|
+
onStart?: () => void;
|
|
894
|
+
onComplete?: (values: SpatializedVisualValues) => void;
|
|
895
|
+
onStop?: (values: SpatializedVisualValues) => void;
|
|
896
|
+
onReset?: (values: SpatializedVisualValues) => void;
|
|
897
|
+
onError?: (error: SpatializedPlaybackError) => void;
|
|
898
|
+
}
|
|
899
|
+
/** Percentage-keyframe timeline authoring shape before desugaring. */
|
|
900
|
+
interface SpatializedMotionTimelineConfig {
|
|
901
|
+
duration?: number;
|
|
902
|
+
timeline: Record<string, SpatializedMotionKeyframeValues>;
|
|
903
|
+
/** Ignored when timeline authoring is present. */
|
|
904
|
+
from?: SpatializedVisualValues;
|
|
905
|
+
/** Ignored when timeline authoring is present. */
|
|
906
|
+
to?: SpatializedVisualValues;
|
|
907
|
+
tracks?: never;
|
|
908
|
+
timingFunction?: TimingFunction;
|
|
909
|
+
delay?: number;
|
|
910
|
+
autoStart?: boolean;
|
|
911
|
+
loop?: boolean | {
|
|
912
|
+
reverse?: boolean;
|
|
913
|
+
};
|
|
914
|
+
playbackRate?: number;
|
|
915
|
+
onStart?: () => void;
|
|
916
|
+
onComplete?: (values: SpatializedVisualValues) => void;
|
|
917
|
+
onStop?: (values: SpatializedVisualValues) => void;
|
|
918
|
+
onReset?: (values: SpatializedVisualValues) => void;
|
|
919
|
+
onError?: (error: SpatializedPlaybackError) => void;
|
|
920
|
+
}
|
|
921
|
+
/** Public authoring accepted by spatialized container motion. */
|
|
922
|
+
type SpatializedMotionConfig = SpatializedMotionSegmentConfig | SpatializedMotionTimelineConfig;
|
|
923
|
+
/** Canonical internal track document produced before native create. */
|
|
924
|
+
interface NormalizedSpatializedMotionConfig {
|
|
925
|
+
/** Timeline duration in seconds. */
|
|
926
|
+
duration: number;
|
|
927
|
+
/** Canonical per-property numeric tracks. */
|
|
928
|
+
tracks: SpatializedMotionTrack[];
|
|
929
|
+
/** Default interpolation for tracks without an override. */
|
|
930
|
+
timingFunction?: TimingFunction;
|
|
931
|
+
/** Playback delay in seconds. */
|
|
932
|
+
delay?: number;
|
|
933
|
+
/** Whether playback starts automatically after binding. */
|
|
934
|
+
autoStart?: boolean;
|
|
935
|
+
/** Loop behavior for the animation session. */
|
|
936
|
+
loop?: boolean | {
|
|
937
|
+
reverse?: boolean;
|
|
938
|
+
};
|
|
939
|
+
/** Playback speed multiplier. */
|
|
940
|
+
playbackRate?: number;
|
|
941
|
+
/** Called when playback starts. */
|
|
942
|
+
onStart?: () => void;
|
|
943
|
+
/** Called when playback completes. */
|
|
944
|
+
onComplete?: (values: SpatializedVisualValues) => void;
|
|
945
|
+
/** Called when playback stops. */
|
|
946
|
+
onStop?: (values: SpatializedVisualValues) => void;
|
|
947
|
+
/** Called when playback resets. */
|
|
948
|
+
onReset?: (values: SpatializedVisualValues) => void;
|
|
949
|
+
/** Called when asynchronous playback fails. */
|
|
950
|
+
onError?: (error: SpatializedPlaybackError) => void;
|
|
951
|
+
}
|
|
952
|
+
/** Normalized timeline wire payload for native playback. */
|
|
953
|
+
interface SpatializedMotionTimeline {
|
|
954
|
+
duration: number;
|
|
955
|
+
delay?: number;
|
|
956
|
+
playbackRate?: number;
|
|
957
|
+
loop?: boolean | {
|
|
958
|
+
reverse?: boolean;
|
|
959
|
+
};
|
|
960
|
+
tracks: Array<{
|
|
961
|
+
property: SpatializedMotionProperty;
|
|
962
|
+
keyframes: SpatializedMotionKeyframe[];
|
|
963
|
+
timingFunction: TimingFunction;
|
|
964
|
+
}>;
|
|
965
|
+
}
|
|
966
|
+
type SpatializedMotionPlayState = 'idle' | 'queued' | 'running' | 'paused' | 'finished';
|
|
967
|
+
/** Public imperative playback controls exposed to spatialized motion consumers. */
|
|
968
|
+
interface SpatializedPlaybackApi {
|
|
969
|
+
play(): void;
|
|
970
|
+
pause(): void;
|
|
971
|
+
stop(): void;
|
|
972
|
+
reset(): void;
|
|
973
|
+
finish(): void;
|
|
974
|
+
readonly isAnimating: boolean;
|
|
975
|
+
readonly isPaused: boolean;
|
|
976
|
+
readonly finished: boolean;
|
|
977
|
+
readonly playState: SpatializedMotionPlayState;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/** Native playback error payload carried by the bridge event. */
|
|
981
|
+
interface SpatializedElementAnimationErrorDetail {
|
|
982
|
+
/** Machine-readable native error code. */
|
|
983
|
+
code: string;
|
|
984
|
+
/** Human-readable native error message. */
|
|
985
|
+
message: string;
|
|
986
|
+
}
|
|
987
|
+
interface CreateSpatializedElementAnimationCommand {
|
|
988
|
+
elementId: string;
|
|
989
|
+
timeline: SpatializedMotionTimeline;
|
|
990
|
+
}
|
|
991
|
+
type SpatializedElementAnimationControlType = 'play' | 'pause' | 'resume' | 'stop' | 'reset' | 'finish' | 'destroy';
|
|
992
|
+
interface ControlSpatializedElementAnimationCommand {
|
|
993
|
+
animationId: string;
|
|
994
|
+
type: SpatializedElementAnimationControlType;
|
|
995
|
+
}
|
|
996
|
+
interface SpatialAnimationStateChangedDetail {
|
|
997
|
+
animationId: string;
|
|
998
|
+
action: SpatializedElementAnimationControlType | 'start' | 'complete' | 'error';
|
|
999
|
+
playState: SpatializedMotionPlayState;
|
|
1000
|
+
finished: boolean;
|
|
1001
|
+
values?: SpatializedVisualValues;
|
|
1002
|
+
error?: SpatializedElementAnimationErrorDetail;
|
|
1003
|
+
}
|
|
1004
|
+
interface SpatialAnimationStateChangedMsg {
|
|
1005
|
+
type: SpatialWebMsgType.animationstatechange;
|
|
1006
|
+
detail: SpatialAnimationStateChangedDetail;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
export { type SpatialPlaneGeometryOptions as $, type AnimateTransformCommand as A, type BackgroundMaterialType as B, type CornerRadius as C, type SpatialDragEventDetail as D, type SpatialDragStartEvent as E, type Float4x4 as F, type SpatialDragStartEventDetail as G, SpatialEntity as H, type SpatialEntityEventType as I, type SpatialEntityOrReality as J, type SpatialEntityProperties as K, type SpatialEntityUserData as L, type ModelAssetOptions as M, SpatialGeometry as N, type SpatialGeometryOptions as O, type PWAManifest as P, type Quaternion as Q, type SpatialGeometryType as R, type SceneUnit as S, type SpatialMagnifyEndEvent as T, type SpatialMagnifyEndEventDetail as U, type SpatialMagnifyEvent as V, type SpatialMagnifyEventDetail as W, SpatialMaterial as X, type SpatialMaterialType as Y, type SpatialModelDragEvent as Z, type SpatialModelEntityCreationOptions as _, type AnimateTransformResult as a, type NormalizedSpatializedMotionConfig as a$, type SpatialRotateEndEvent as a0, type SpatialRotateEndEventDetail as a1, type SpatialRotateEvent as a2, type SpatialRotateEventDetail as a3, type SpatialSceneCreationOptions as a4, type SpatialSceneProperties as a5, SpatialSceneState$1 as a6, type SpatialSceneType as a7, SpatialSceneValues as a8, type SpatialSphereGeometryOptions as a9, type XRSceneResizability as aA, type XRSceneSize as aB, type XRSpatialSceneConfig as aC, type XRSpatialSceneDefaults as aD, type XRSpatialSceneOverrides as aE, isValidBaseplateVisibilityType as aF, isValidSceneUnit as aG, isValidSpatialSceneType as aH, isValidWorldAlignmentType as aI, isValidWorldScalingType as aJ, type CommandResult as aK, type ControlSpatializedElementAnimationCommand as aL, type SpatializedElementAnimationControlType as aM, type CreateSpatializedElementAnimationCommand as aN, type SpatializedMotionTimeline as aO, SpatialWebMsgType as aP, type SpatialSceneCreationOptionsInternal as aQ, SpatialSceneState as aR, type AnimationStateChangeDetail as aS, type ModelLoadSuccess as aT, type ModelLoadFailure as aU, type ReceiveEventData as aV, type AnimationStateChangeMsg as aW, type EntityTransformChangeMsg as aX, type PlatformAbility as aY, type WebSpatialProtocolResult as aZ, type SpatializedMotionProperty as a_, type SpatialTapEvent as aa, type SpatialTapEventDetail as ab, type SpatialTextureResourceOptions as ac, type SpatialUnlitMaterialOptions as ad, type Spatialized2DElementProperties as ae, SpatializedDynamic3DElement as af, SpatializedElement as ag, type SpatializedElementProperties as ah, SpatializedElementType as ai, type SpatializedMotionConfig as aj, type SpatializedMotionKind as ak, type SpatializedMotionPlayState as al, type SpatializedMotionSegmentConfig as am, type SpatializedMotionTimelineConfig as an, type SpatializedPlaybackApi as ao, type SpatializedStatic3DElementProperties as ap, type StageMode as aq, type TimingFunction as ar, type TransformValues as as, type Vec3 as at, type WorldAlignmentType as au, WorldAlignmentValues as av, type WorldScalingType as aw, WorldScalingValues as ax, type XRMainSceneConfig as ay, type XRPrdConfig as az, type AnimatedProps as b, AnimationObject as b0, type AnimationObjectCallbacks as b1, type AnimationObjectCreateOptions as b2, type AnimationCanceledEventPayload as b3, type AnimationCompletedEventPayload as b4, type AnimationFailedEventPayload as b5, type EntityTransformChangeDetail as b6, type ObjectDestroyMsg as b7, type SpatialDragEndMsg as b8, type SpatialDragMsg as b9, type SpatialDragStartMsg as ba, type SpatialMagnifyEndMsg as bb, type SpatialMagnifyMsg as bc, type SpatialRotateEndMsg as bd, type SpatialRotateMsg as be, type SpatialTapMsg as bf, SPATIALIZED_MOTION_PROPERTIES as bg, type SpatializedMotionKeyframe as bh, type SpatializedMotionKeyframeValues as bi, type SpatializedMotionTrack as bj, type SpatialAnimationStateChangedDetail as bk, type SpatialAnimationStateChangedMsg as bl, type AnimatedPropsInternal as c, type AnimationApi as d, type AnimationConfig as e, type AnimationError as f, type AnimationPlayState as g, type AttachmentEntityOptions as h, type AttachmentEntityUpdateOptions as i, type BaseplateVisibilityType as j, BaseplateVisibilityValues as k, CubeInfo as l, type ModelComponentOptions as m, type ModelLoadingMode as n, type ModelSource as o, type Point3D as p, type SceneUnitM as q, type SceneUnitPx as r, type Size as s, type Size3D as t, type SpatialBoxGeometryOptions as u, type SpatialConeGeometryOptions as v, type SpatialCylinderGeometryOptions as w, type SpatialDragEndEvent as x, type SpatialDragEndEventDetail as y, type SpatialDragEvent as z };
|