@webspatial/react-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/README.md +265 -4
- package/dist/Model-DO5ps8NA.d.ts +35 -0
- package/dist/Reality-BDyKL6th.d.ts +256 -0
- package/dist/Reality-DO-itiWW.d.ts +33 -0
- package/dist/SceneGraph-DxH74y6-.d.ts +214 -0
- package/dist/chunk-6JSRUX7P.js +2 -0
- package/dist/chunk-6JSRUX7P.js.map +1 -0
- package/dist/chunk-BTLTBCA7.js +2 -0
- package/dist/chunk-BTLTBCA7.js.map +1 -0
- package/dist/chunk-GG2QK5MA.js +2 -0
- package/dist/chunk-GG2QK5MA.js.map +1 -0
- package/dist/chunk-IOLNY4GP.js +2 -0
- package/dist/chunk-IOLNY4GP.js.map +1 -0
- package/dist/chunk-NWVQY6CN.js +2 -0
- package/dist/chunk-NWVQY6CN.js.map +1 -0
- package/dist/chunk-NXEOIP4Z.js +2 -0
- package/dist/chunk-NXEOIP4Z.js.map +1 -0
- package/dist/chunk-PDUEHFTO.js +2 -0
- package/dist/chunk-PDUEHFTO.js.map +1 -0
- package/dist/chunk-QHUROD77.js +2 -0
- package/dist/chunk-QHUROD77.js.map +1 -0
- package/dist/chunk-UHEO47WY.js +2 -0
- package/dist/chunk-UHEO47WY.js.map +1 -0
- package/dist/chunk-WDOPCAA3.js +19 -0
- package/dist/chunk-WDOPCAA3.js.map +1 -0
- package/dist/eager.d.ts +46 -0
- package/dist/eager.js +8 -0
- package/dist/eager.js.map +1 -0
- package/dist/experimental.d.ts +24 -0
- package/dist/experimental.js +8 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/facades-client.d.ts +50 -0
- package/dist/internal/facades-client.js +3 -0
- package/dist/internal/facades-client.js.map +1 -0
- package/dist/jsx/jsx-dev-runtime.d.ts +7 -83
- package/dist/jsx/jsx-dev-runtime.js +1 -67
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +81 -2
- package/dist/jsx/jsx-runtime.js +1 -67
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/jsx-shared-CFDVUVpc.d.ts +16 -0
- package/dist/motionBindingTypes-CjxIC5bP.d.ts +25 -0
- package/dist/runtime/registerEagerEntry.d.ts +8 -0
- package/dist/runtime/registerEagerEntry.js +2 -0
- package/dist/runtime/registerEagerEntry.js.map +1 -0
- package/dist/spatial.d.ts +25 -0
- package/dist/spatial.js +7 -0
- package/dist/spatial.js.map +1 -0
- package/dist/useAnimation-C1LXt-xO.d.ts +28 -0
- package/dist/useMetrics-Bm_Urbtp.d.ts +96 -0
- package/package.json +51 -31
- package/dist/default/index.d.ts +0 -475
- package/dist/default/index.js +0 -4269
- package/dist/default/index.js.map +0 -1
- package/dist/jsx/jsx-dev-runtime.web.d.ts +0 -2
- package/dist/jsx/jsx-dev-runtime.web.js +0 -18
- package/dist/jsx/jsx-dev-runtime.web.js.map +0 -1
- package/dist/jsx/jsx-runtime.web.d.ts +0 -1
- package/dist/jsx/jsx-runtime.web.js +0 -18
- package/dist/jsx/jsx-runtime.web.js.map +0 -1
- package/dist/web/index.d.ts +0 -475
- package/dist/web/index.js +0 -4333
- package/dist/web/index.js.map +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
(function(){
|
|
3
|
-
if(typeof window === 'undefined') return;
|
|
4
|
-
if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
|
|
5
|
-
window.__webspatialsdk__['react-sdk-version'] = "1.7.0"
|
|
6
|
-
window.__webspatialsdk__['XR_ENV'] = "web"
|
|
7
|
-
})()
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// src/jsx/jsx-dev-runtime.web.ts
|
|
11
|
-
import { Fragment } from "react/jsx-runtime";
|
|
12
|
-
import { jsxDEV, jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
13
|
-
export {
|
|
14
|
-
Fragment,
|
|
15
|
-
jsxDEV2 as jsx,
|
|
16
|
-
jsxDEV
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=jsx-dev-runtime.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.web.ts"],"sourcesContent":["export { Fragment } from 'react/jsx-runtime'\nexport { jsxDEV, jsxDEV as jsx } from 'react/jsx-dev-runtime'\n"],"mappings":";;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,QAAkB,UAAVA,eAAqB;","names":["jsxDEV"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Fragment, jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
(function(){
|
|
3
|
-
if(typeof window === 'undefined') return;
|
|
4
|
-
if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
|
|
5
|
-
window.__webspatialsdk__['react-sdk-version'] = "1.7.0"
|
|
6
|
-
window.__webspatialsdk__['XR_ENV'] = "web"
|
|
7
|
-
})()
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// src/jsx/jsx-runtime.web.ts
|
|
11
|
-
import { Fragment } from "react/jsx-runtime";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
export {
|
|
14
|
-
Fragment,
|
|
15
|
-
jsx,
|
|
16
|
-
jsxs
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=jsx-runtime.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/jsx/jsx-runtime.web.ts"],"sourcesContent":["export { Fragment } from 'react/jsx-runtime'\nexport { jsx, jsxs } from 'react/jsx-runtime'\n"],"mappings":";;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,KAAK,YAAY;","names":[]}
|
package/dist/web/index.d.ts
DELETED
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
import * as _webspatial_core_sdk from '@webspatial/core-sdk';
|
|
2
|
-
import { supports, SpatialSceneCreationOptions, SpatialSceneType, Vec3, SpatialTapEvent as SpatialTapEvent$1, SpatialDragStartEvent as SpatialDragStartEvent$1, SpatialDragEvent as SpatialDragEvent$1, SpatialDragEndEvent as SpatialDragEndEvent$1, SpatialRotateEvent as SpatialRotateEvent$1, SpatialRotateEndEvent as SpatialRotateEndEvent$1, SpatialMagnifyEvent as SpatialMagnifyEvent$1, SpatialMagnifyEndEvent as SpatialMagnifyEndEvent$1, ModelLoadingMode, SpatializedElement, SpatialObject, SpatialSession, SpatializedDynamic3DElement, SpatialEntity, Quaternion, SpatialBoxGeometryOptions, SpatialUnlitMaterialOptions, SpatialSphereGeometryOptions, SpatialConeGeometryOptions, SpatialCylinderGeometryOptions, SpatialPlaneGeometryOptions, PhysicalMetrics } from '@webspatial/core-sdk';
|
|
3
|
-
export { CapabilityKey, Point3D, Vec3, WebSpatialRuntimeError } from '@webspatial/core-sdk';
|
|
4
|
-
import * as React$1 from 'react';
|
|
5
|
-
import React__default, { ElementType, ForwardedRef, createElement as createElement$1 } from 'react';
|
|
6
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Runtime capability checks (`supports('Model')`, `supports('WindowScene', ['defaultSize'])`, ...).
|
|
10
|
-
* Spec: `openspec/specs/runtime-capabilities/spec.md`.
|
|
11
|
-
*/
|
|
12
|
-
declare const WebSpatialRuntime: {
|
|
13
|
-
readonly supports: typeof supports;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
declare function enableDebugTool(): void;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Resolve asset URLs for the native bridge: relative paths become absolute against the
|
|
20
|
-
* current document (typical dev server is `http://localhost/...`).
|
|
21
|
-
*
|
|
22
|
-
* With no `window` (SSR), returns `url` unchanged — pass absolute `http(s)` URLs if needed.
|
|
23
|
-
*/
|
|
24
|
-
declare function getAbsoluteUrl(url: string): string;
|
|
25
|
-
|
|
26
|
-
declare function initScene(name: string, callback: (pre: SpatialSceneCreationOptions) => SpatialSceneCreationOptions, options?: {
|
|
27
|
-
type: SpatialSceneType;
|
|
28
|
-
}): void | undefined;
|
|
29
|
-
|
|
30
|
-
declare const SpatialID = "data-spatial-id";
|
|
31
|
-
|
|
32
|
-
/** Connected content root for imperative mounting (portal root or web fallback host). */
|
|
33
|
-
type SpatialContentReadyContext = {
|
|
34
|
-
host: HTMLElement;
|
|
35
|
-
};
|
|
36
|
-
type SpatialContentReadyCallback = (ctx: SpatialContentReadyContext) => void | (() => void);
|
|
37
|
-
/** Options for spatial pointer/gesture behavior (not DOM attributes). */
|
|
38
|
-
type SpatialEventOptions = {
|
|
39
|
-
/**
|
|
40
|
-
* Direction vector for rotate gesture constraint. `[0, 0, 0]` or omit = unconstrained.
|
|
41
|
-
*/
|
|
42
|
-
constrainedToAxis?: Vec3 | readonly [number, number, number];
|
|
43
|
-
};
|
|
44
|
-
type SpatialEventProps<T extends SpatializedElementRef> = {
|
|
45
|
-
onSpatialTap?: (event: SpatialTapEvent<T>) => void;
|
|
46
|
-
onSpatialDragStart?: (event: SpatialDragStartEvent<T>) => void;
|
|
47
|
-
onSpatialDrag?: (event: SpatialDragEvent<T>) => void;
|
|
48
|
-
onSpatialDragEnd?: (event: SpatialDragEndEvent<T>) => void;
|
|
49
|
-
onSpatialRotate?: (event: SpatialRotateEvent<T>) => void;
|
|
50
|
-
onSpatialRotateEnd?: (event: SpatialRotateEndEvent<T>) => void;
|
|
51
|
-
onSpatialMagnify?: (event: SpatialMagnifyEvent<T>) => void;
|
|
52
|
-
onSpatialMagnifyEnd?: (event: SpatialMagnifyEndEvent<T>) => void;
|
|
53
|
-
};
|
|
54
|
-
interface StandardSpatializedContainerProps extends React__default.ComponentPropsWithoutRef<'div'> {
|
|
55
|
-
component: ElementType;
|
|
56
|
-
inStandardSpatializedContainer?: boolean;
|
|
57
|
-
[SpatialID]: string;
|
|
58
|
-
}
|
|
59
|
-
type PortalSpatializedContainerProps<T extends SpatializedElementRef> = SpatialEventProps<T> & React__default.ComponentPropsWithoutRef<'div'> & {
|
|
60
|
-
component: ElementType;
|
|
61
|
-
spatializedContent: ElementType;
|
|
62
|
-
createSpatializedElement: () => Promise<SpatializedElement>;
|
|
63
|
-
getExtraSpatializedElementProperties?: (computedStyle: CSSStyleDeclaration) => Record<string, any>;
|
|
64
|
-
spatialEventOptions?: SpatialEventOptions;
|
|
65
|
-
[SpatialID]: string;
|
|
66
|
-
};
|
|
67
|
-
type SpatializedContainerProps<T extends SpatializedElementRef> = Omit<StandardSpatializedContainerProps & PortalSpatializedContainerProps<T>, typeof SpatialID | 'onLoad' | 'onError'> & {
|
|
68
|
-
extraRefProps?: (domProxy: T) => Record<string, unknown>;
|
|
69
|
-
/**
|
|
70
|
-
* SpatialDiv only — fired when `ctx.host` is connected (portal root or web fallback host).
|
|
71
|
-
* Not part of `Model` / `Reality` public APIs.
|
|
72
|
-
*/
|
|
73
|
-
onSpatialContentReady?: SpatialContentReadyCallback;
|
|
74
|
-
};
|
|
75
|
-
type Spatialized2DElementContainerProps<P extends ElementType> = SpatialEventProps<SpatializedElementRef> & React__default.ComponentPropsWithRef<'div'> & {
|
|
76
|
-
component: P;
|
|
77
|
-
spatialEventOptions?: SpatialEventOptions;
|
|
78
|
-
onSpatialContentReady?: SpatialContentReadyCallback;
|
|
79
|
-
};
|
|
80
|
-
type SpatializedStatic3DContainerProps = SpatialEventProps<SpatializedStatic3DElementRef> & Omit<React__default.ComponentPropsWithoutRef<'div'>, 'onLoad' | 'onError'> & {
|
|
81
|
-
src?: string;
|
|
82
|
-
poster?: string;
|
|
83
|
-
autoPlay?: boolean;
|
|
84
|
-
loop?: boolean;
|
|
85
|
-
loading?: ModelLoadingMode;
|
|
86
|
-
children?: React__default.ReactNode;
|
|
87
|
-
onLoad?: (event: ModelLoadEvent) => void;
|
|
88
|
-
onError?: (event: ModelLoadEvent) => void;
|
|
89
|
-
spatialEventOptions?: SpatialEventOptions;
|
|
90
|
-
};
|
|
91
|
-
type SpatializedElementRef<T extends HTMLElement = HTMLElement> = T;
|
|
92
|
-
type SpatializedDivElementRef = SpatializedElementRef<HTMLDivElement>;
|
|
93
|
-
type SpatializedStatic3DElementRef = SpatializedDivElementRef & {
|
|
94
|
-
currentSrc: string;
|
|
95
|
-
ready: Promise<ModelLoadEvent>;
|
|
96
|
-
entityTransform: DOMMatrixReadOnly;
|
|
97
|
-
play(): Promise<void>;
|
|
98
|
-
pause(): Promise<void>;
|
|
99
|
-
readonly paused: boolean;
|
|
100
|
-
readonly duration: number;
|
|
101
|
-
playbackRate: number;
|
|
102
|
-
currentTime: number;
|
|
103
|
-
};
|
|
104
|
-
type CurrentTarget<T extends SpatializedElementRef> = {
|
|
105
|
-
currentTarget: T;
|
|
106
|
-
};
|
|
107
|
-
type SpatialTapEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialTapEvent$1 & CurrentTarget<T> & {
|
|
108
|
-
readonly offsetX: number;
|
|
109
|
-
readonly offsetY: number;
|
|
110
|
-
readonly offsetZ: number;
|
|
111
|
-
readonly clientX: number;
|
|
112
|
-
readonly clientY: number;
|
|
113
|
-
readonly clientZ: number;
|
|
114
|
-
};
|
|
115
|
-
type SpatialDragStartEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragStartEvent$1 & CurrentTarget<T> & {
|
|
116
|
-
readonly offsetX: number;
|
|
117
|
-
readonly offsetY: number;
|
|
118
|
-
readonly offsetZ: number;
|
|
119
|
-
readonly clientX: number;
|
|
120
|
-
readonly clientY: number;
|
|
121
|
-
readonly clientZ: number;
|
|
122
|
-
};
|
|
123
|
-
type SpatialDragEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragEvent$1 & CurrentTarget<T> & {
|
|
124
|
-
readonly translationX: number;
|
|
125
|
-
readonly translationY: number;
|
|
126
|
-
readonly translationZ: number;
|
|
127
|
-
};
|
|
128
|
-
type SpatialDragEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragEndEvent$1 & CurrentTarget<T>;
|
|
129
|
-
type SpatialRotateEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialRotateEvent$1 & CurrentTarget<T> & {
|
|
130
|
-
readonly quaternion: _webspatial_core_sdk.Quaternion;
|
|
131
|
-
};
|
|
132
|
-
type SpatialRotateEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialRotateEndEvent$1 & CurrentTarget<T>;
|
|
133
|
-
type SpatialMagnifyEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialMagnifyEvent$1 & CurrentTarget<T> & {
|
|
134
|
-
readonly magnification: number;
|
|
135
|
-
};
|
|
136
|
-
type SpatialMagnifyEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialMagnifyEndEvent$1 & CurrentTarget<T>;
|
|
137
|
-
type ModelSpatialTapEvent = SpatialTapEvent<SpatializedStatic3DElementRef>;
|
|
138
|
-
type ModelSpatialDragStartEvent = SpatialDragStartEvent<SpatializedStatic3DElementRef>;
|
|
139
|
-
type ModelSpatialDragEvent = SpatialDragEvent<SpatializedStatic3DElementRef>;
|
|
140
|
-
type ModelSpatialDragEndEvent = SpatialDragEndEvent<SpatializedStatic3DElementRef>;
|
|
141
|
-
type ModelSpatialRotateEvent = SpatialRotateEvent<SpatializedStatic3DElementRef>;
|
|
142
|
-
type ModelSpatialRotateEndEvent = SpatialRotateEndEvent<SpatializedStatic3DElementRef>;
|
|
143
|
-
type ModelSpatialMagnifyEvent = SpatialMagnifyEvent<SpatializedStatic3DElementRef>;
|
|
144
|
-
type ModelSpatialMagnifyEndEvent = SpatialMagnifyEndEvent<SpatializedStatic3DElementRef>;
|
|
145
|
-
type ModelLoadEvent = CustomEvent & {
|
|
146
|
-
target: SpatializedStatic3DElementRef;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
declare const SpatializedContainer: <T extends SpatializedElementRef>(props: SpatializedContainerProps<T> & {
|
|
150
|
-
ref?: ForwardedRef<SpatializedElementRef<T>>;
|
|
151
|
-
}) => React.ReactElement | null;
|
|
152
|
-
|
|
153
|
-
declare const Spatialized2DElementContainer: <P extends ElementType>(props: Spatialized2DElementContainerProps<P> & {
|
|
154
|
-
ref: ForwardedRef<SpatializedElementRef>;
|
|
155
|
-
}) => React__default.ReactElement | null;
|
|
156
|
-
|
|
157
|
-
declare const SpatializedStatic3DElementContainer: React$1.ForwardRefExoticComponent<{
|
|
158
|
-
onSpatialTap?: ((event: SpatialTapEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
159
|
-
onSpatialDragStart?: ((event: SpatialDragStartEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
160
|
-
onSpatialDrag?: ((event: SpatialDragEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
161
|
-
onSpatialDragEnd?: ((event: SpatialDragEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
162
|
-
onSpatialRotate?: ((event: SpatialRotateEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
163
|
-
onSpatialRotateEnd?: ((event: SpatialRotateEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
164
|
-
onSpatialMagnify?: ((event: SpatialMagnifyEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
165
|
-
onSpatialMagnifyEnd?: ((event: SpatialMagnifyEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
166
|
-
} & Omit<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onLoad" | "onError"> & {
|
|
167
|
-
src?: string;
|
|
168
|
-
poster?: string;
|
|
169
|
-
autoPlay?: boolean;
|
|
170
|
-
loop?: boolean;
|
|
171
|
-
loading?: ModelLoadingMode;
|
|
172
|
-
children?: React.ReactNode;
|
|
173
|
-
onLoad?: (event: ModelLoadEvent) => void;
|
|
174
|
-
onError?: (event: ModelLoadEvent) => void;
|
|
175
|
-
spatialEventOptions?: SpatialEventOptions;
|
|
176
|
-
} & React$1.RefAttributes<SpatializedStatic3DElementRef>>;
|
|
177
|
-
|
|
178
|
-
declare function withSpatialized2DElementContainer<P extends ElementType>(Component: P): P | React$1.ForwardRefExoticComponent<Omit<Spatialized2DElementContainerProps<P>, "ref"> & React$1.RefAttributes<HTMLElement>>;
|
|
179
|
-
|
|
180
|
-
declare function initPolyfill(): void;
|
|
181
|
-
|
|
182
|
-
declare function withSpatialMonitor(El: React__default.ElementType): any;
|
|
183
|
-
|
|
184
|
-
type SpatialMonitorProps = {
|
|
185
|
-
El?: ElementType;
|
|
186
|
-
};
|
|
187
|
-
declare const SpatialMonitor: React$1.ForwardRefExoticComponent<SpatialMonitorProps & React$1.RefAttributes<HTMLElement>>;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Tracks spatial resources (textures, materials, entities, …) by string id under one Reality.
|
|
191
|
-
*
|
|
192
|
-
* Native creation is async (`createTexture`, `createUnlitMaterial`, …). The map
|
|
193
|
-
* stores `Promise<SpatialObject>` so `add(id, pendingCreation)` can run after `get(id)` — sibling
|
|
194
|
-
* JSX order does not need to match registration order. Callers are responsible for using the
|
|
195
|
-
* correct id for each resource kind (same as with string ids today).
|
|
196
|
-
*
|
|
197
|
-
* Callers can `await get(id)` before `add(id, promise)` runs: `get` returns a promise that
|
|
198
|
-
* settles when something later calls `add` with the same id.
|
|
199
|
-
*
|
|
200
|
-
* **Subscriptions:** `subscribe(id, listener)` runs `listener` whenever `notify(id)` is invoked.
|
|
201
|
-
* The registry auto-notifies after each `add()` promise settles (then or catch), and on
|
|
202
|
-
* `remove`, `removeAndDestroy`, and `destroy()`. Components such as `<Texture>` may call
|
|
203
|
-
* `notify(id)` manually when a resource mutates in place without a new `add()` (e.g. same texture
|
|
204
|
-
* id, new URL via `updateProperties`).
|
|
205
|
-
*/
|
|
206
|
-
declare class ResourceRegistry {
|
|
207
|
-
/** Every id maps to a promise — either the real resource from add(), or a placeholder until then. */
|
|
208
|
-
private resources;
|
|
209
|
-
/** If get() ran first, we stash resolve/reject so add() can complete the waiting promise. */
|
|
210
|
-
private deferreds;
|
|
211
|
-
/** Subscribers are notified whenever an id gets a fresh resolved or failed resource attempt. */
|
|
212
|
-
private listeners;
|
|
213
|
-
add<T extends SpatialObject>(id: string, resource: Promise<T>): void;
|
|
214
|
-
subscribe(id: string, listener: () => void): () => void;
|
|
215
|
-
notify(id: string): void;
|
|
216
|
-
get(id: string): Promise<SpatialObject>;
|
|
217
|
-
remove(id: string): void;
|
|
218
|
-
removeAndDestroy(id: string): void;
|
|
219
|
-
destroy(): void;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
type ContainerEntry = {
|
|
223
|
-
instanceId: string;
|
|
224
|
-
container: HTMLElement;
|
|
225
|
-
};
|
|
226
|
-
type ContainersChangeCallback = (containers: ContainerEntry[]) => void;
|
|
227
|
-
declare class AttachmentRegistry {
|
|
228
|
-
private containers;
|
|
229
|
-
private listeners;
|
|
230
|
-
addContainer(name: string, instanceId: string, container: HTMLElement): void;
|
|
231
|
-
removeContainer(name: string, instanceId: string): void;
|
|
232
|
-
getContainers(name: string): ContainerEntry[];
|
|
233
|
-
onContainersChange(name: string, cb: ContainersChangeCallback): () => void;
|
|
234
|
-
private notifyListeners;
|
|
235
|
-
destroy(): void;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
type RealityContextValue = {
|
|
239
|
-
session: SpatialSession;
|
|
240
|
-
reality: SpatializedDynamic3DElement;
|
|
241
|
-
resourceRegistry: ResourceRegistry;
|
|
242
|
-
attachmentRegistry: AttachmentRegistry;
|
|
243
|
-
} | null;
|
|
244
|
-
|
|
245
|
-
interface EntityRefShape {
|
|
246
|
-
convertFromEntityToEntity: (fromEntityId: string, toEntityId: string, position: Vec3) => Promise<Vec3>;
|
|
247
|
-
convertFromEntityToReality: (entityId: string, position: Vec3) => Promise<Vec3>;
|
|
248
|
-
convertFromRealityToEntity: (entityId: string, position: Vec3) => Promise<Vec3>;
|
|
249
|
-
id: string | undefined;
|
|
250
|
-
name: string | undefined;
|
|
251
|
-
entity: SpatialEntity | null;
|
|
252
|
-
}
|
|
253
|
-
declare class EntityRef implements EntityRefShape {
|
|
254
|
-
private _entity;
|
|
255
|
-
private _ctx;
|
|
256
|
-
constructor(entity?: SpatialEntity | null, ctx?: RealityContextValue | null);
|
|
257
|
-
updateEntity(entity?: SpatialEntity | null): void;
|
|
258
|
-
updateCtx(ctx?: RealityContextValue | null): void;
|
|
259
|
-
destroy(): void;
|
|
260
|
-
get entity(): SpatialEntity | null;
|
|
261
|
-
get id(): string | undefined;
|
|
262
|
-
get name(): string | undefined;
|
|
263
|
-
convertFromEntityToEntity(fromEntityId: string, toEntityId: string, position: Vec3): Promise<Vec3>;
|
|
264
|
-
convertFromEntityToReality(entityId: string, position: Vec3): Promise<Vec3>;
|
|
265
|
-
convertFromRealityToEntity(entityId: string, position: Vec3): Promise<Vec3>;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
type EntityProps = {
|
|
269
|
-
id?: string;
|
|
270
|
-
name?: string;
|
|
271
|
-
position?: Vec3;
|
|
272
|
-
rotation?: Vec3;
|
|
273
|
-
scale?: Vec3;
|
|
274
|
-
enableInput?: boolean;
|
|
275
|
-
};
|
|
276
|
-
type allTarget<T extends EntityRefShape> = {
|
|
277
|
-
target: T;
|
|
278
|
-
currentTarget: T;
|
|
279
|
-
};
|
|
280
|
-
type SpatialTapEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialTapEvent$1 & allTarget<T> & {
|
|
281
|
-
readonly offsetX: number;
|
|
282
|
-
readonly offsetY: number;
|
|
283
|
-
readonly offsetZ: number;
|
|
284
|
-
readonly clientX: number;
|
|
285
|
-
readonly clientY: number;
|
|
286
|
-
readonly clientZ: number;
|
|
287
|
-
};
|
|
288
|
-
type SpatialDragStartEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragStartEvent$1 & allTarget<T> & {
|
|
289
|
-
readonly offsetX: number;
|
|
290
|
-
readonly offsetY: number;
|
|
291
|
-
readonly offsetZ: number;
|
|
292
|
-
readonly clientX: number;
|
|
293
|
-
readonly clientY: number;
|
|
294
|
-
readonly clientZ: number;
|
|
295
|
-
};
|
|
296
|
-
type SpatialDragEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragEvent$1 & allTarget<T> & {
|
|
297
|
-
readonly translationX: number;
|
|
298
|
-
readonly translationY: number;
|
|
299
|
-
readonly translationZ: number;
|
|
300
|
-
};
|
|
301
|
-
type SpatialDragEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragEndEvent$1 & allTarget<T>;
|
|
302
|
-
type SpatialRotateEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialRotateEvent$1 & allTarget<T> & {
|
|
303
|
-
readonly quaternion: Quaternion;
|
|
304
|
-
};
|
|
305
|
-
type SpatialRotateEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialRotateEndEvent$1 & allTarget<T>;
|
|
306
|
-
type SpatialMagnifyEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialMagnifyEvent$1 & allTarget<T> & {
|
|
307
|
-
readonly magnification: number;
|
|
308
|
-
};
|
|
309
|
-
type SpatialMagnifyEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialMagnifyEndEvent$1 & allTarget<T>;
|
|
310
|
-
type EntityEventHandler = {
|
|
311
|
-
onSpatialTap?: (event: SpatialTapEntityEvent) => void;
|
|
312
|
-
onSpatialDragStart?: (event: SpatialDragStartEntityEvent) => void;
|
|
313
|
-
onSpatialDrag?: (event: SpatialDragEntityEvent) => void;
|
|
314
|
-
onSpatialDragEnd?: (event: SpatialDragEndEntityEvent) => void;
|
|
315
|
-
spatialEventOptions?: SpatialEventOptions;
|
|
316
|
-
onSpatialRotate?: (event: SpatialRotateEntityEvent) => void;
|
|
317
|
-
onSpatialRotateEnd?: (event: SpatialRotateEndEntityEvent) => void;
|
|
318
|
-
onSpatialMagnify?: (event: SpatialMagnifyEntityEvent) => void;
|
|
319
|
-
onSpatialMagnifyEnd?: (event: SpatialMagnifyEndEntityEvent) => void;
|
|
320
|
-
};
|
|
321
|
-
declare const eventMap: {
|
|
322
|
-
readonly onSpatialTap: "spatialtap";
|
|
323
|
-
readonly onSpatialDragStart: "spatialdragstart";
|
|
324
|
-
readonly onSpatialDrag: "spatialdrag";
|
|
325
|
-
readonly onSpatialDragEnd: "spatialdragend";
|
|
326
|
-
readonly onSpatialRotate: "spatialrotate";
|
|
327
|
-
readonly onSpatialRotateEnd: "spatialrotateend";
|
|
328
|
-
readonly onSpatialMagnify: "spatialmagnify";
|
|
329
|
-
readonly onSpatialMagnifyEnd: "spatialmagnifyend";
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
declare const Entity: React__default.ForwardRefExoticComponent<EntityProps & {
|
|
333
|
-
children?: React__default.ReactNode;
|
|
334
|
-
} & React__default.RefAttributes<EntityRefShape>>;
|
|
335
|
-
|
|
336
|
-
declare const BoxEntity: React__default.ForwardRefExoticComponent<EntityProps & {
|
|
337
|
-
children?: React__default.ReactNode;
|
|
338
|
-
materials?: string[];
|
|
339
|
-
} & SpatialBoxGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
|
|
340
|
-
|
|
341
|
-
type UnlitMaterialProps = {
|
|
342
|
-
children?: React__default.ReactNode;
|
|
343
|
-
id: string;
|
|
344
|
-
} & SpatialUnlitMaterialOptions;
|
|
345
|
-
declare const UnlitMaterial: React__default.FC<UnlitMaterialProps>;
|
|
346
|
-
|
|
347
|
-
type TextureProps = {
|
|
348
|
-
children?: React__default.ReactNode;
|
|
349
|
-
id: string;
|
|
350
|
-
url: string;
|
|
351
|
-
onLoad?: () => void;
|
|
352
|
-
onError?: (error: unknown) => void;
|
|
353
|
-
};
|
|
354
|
-
declare const Texture: React__default.FC<TextureProps>;
|
|
355
|
-
|
|
356
|
-
declare const SphereEntity: React__default.ForwardRefExoticComponent<EntityProps & {
|
|
357
|
-
children?: React__default.ReactNode;
|
|
358
|
-
materials?: string[];
|
|
359
|
-
} & SpatialSphereGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
|
|
360
|
-
|
|
361
|
-
declare const ConeEntity: React__default.ForwardRefExoticComponent<EntityProps & {
|
|
362
|
-
children?: React__default.ReactNode;
|
|
363
|
-
materials?: string[];
|
|
364
|
-
} & SpatialConeGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
|
|
365
|
-
|
|
366
|
-
declare const CylinderEntity: React__default.ForwardRefExoticComponent<EntityProps & {
|
|
367
|
-
children?: React__default.ReactNode;
|
|
368
|
-
materials?: string[];
|
|
369
|
-
} & SpatialCylinderGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
|
|
370
|
-
|
|
371
|
-
declare const PlaneEntity: React__default.ForwardRefExoticComponent<EntityProps & {
|
|
372
|
-
children?: React__default.ReactNode;
|
|
373
|
-
materials?: string[];
|
|
374
|
-
} & SpatialPlaneGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
|
|
375
|
-
|
|
376
|
-
type Props$1 = {
|
|
377
|
-
children?: React__default.ReactNode;
|
|
378
|
-
};
|
|
379
|
-
declare const SceneGraph: React__default.FC<Props$1>;
|
|
380
|
-
|
|
381
|
-
type Props = {
|
|
382
|
-
children?: React__default.ReactNode;
|
|
383
|
-
id: string;
|
|
384
|
-
src: string;
|
|
385
|
-
onLoad?: () => void;
|
|
386
|
-
onError?: (error: unknown) => void;
|
|
387
|
-
};
|
|
388
|
-
declare const ModelAsset: React__default.FC<Props>;
|
|
389
|
-
|
|
390
|
-
declare const ModelEntity: React__default.ForwardRefExoticComponent<EntityProps & {
|
|
391
|
-
model: string;
|
|
392
|
-
materials?: string[];
|
|
393
|
-
} & EntityEventHandler & {
|
|
394
|
-
children?: React__default.ReactNode;
|
|
395
|
-
} & React__default.RefAttributes<EntityRefShape>>;
|
|
396
|
-
|
|
397
|
-
type RealityProps = Omit<React__default.ComponentPropsWithRef<'div'>, 'onSpatialContentReady'> & EntityEventHandler;
|
|
398
|
-
declare const Reality: React__default.ForwardRefExoticComponent<Omit<RealityProps, "ref"> & React__default.RefAttributes<HTMLElement>>;
|
|
399
|
-
|
|
400
|
-
type AttachmentAssetProps = {
|
|
401
|
-
name: string;
|
|
402
|
-
children?: React__default.ReactNode;
|
|
403
|
-
};
|
|
404
|
-
declare const AttachmentAsset: React__default.FC<AttachmentAssetProps>;
|
|
405
|
-
|
|
406
|
-
type AttachmentEntityProps = {
|
|
407
|
-
attachment: string;
|
|
408
|
-
position?: [number, number, number];
|
|
409
|
-
size: {
|
|
410
|
-
width: number;
|
|
411
|
-
height: number;
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
declare const AttachmentEntity: React__default.FC<AttachmentEntityProps>;
|
|
415
|
-
|
|
416
|
-
type MaterialProps = {
|
|
417
|
-
type: 'unlit';
|
|
418
|
-
} & UnlitMaterialProps;
|
|
419
|
-
declare const Material: React__default.FC<MaterialProps>;
|
|
420
|
-
|
|
421
|
-
type ModelProps = SpatializedStatic3DContainerProps & {
|
|
422
|
-
'enable-xr'?: boolean;
|
|
423
|
-
};
|
|
424
|
-
type ModelRef = SpatializedStatic3DElementRef;
|
|
425
|
-
declare const Model: React$1.ForwardRefExoticComponent<Omit<{
|
|
426
|
-
onSpatialTap?: ((event: SpatialTapEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
427
|
-
onSpatialDragStart?: ((event: SpatialDragStartEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
428
|
-
onSpatialDrag?: ((event: SpatialDragEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
429
|
-
onSpatialDragEnd?: ((event: SpatialDragEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
430
|
-
onSpatialRotate?: ((event: SpatialRotateEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
431
|
-
onSpatialRotateEnd?: ((event: SpatialRotateEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
432
|
-
onSpatialMagnify?: ((event: SpatialMagnifyEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
433
|
-
onSpatialMagnifyEnd?: ((event: SpatialMagnifyEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
|
|
434
|
-
} & Omit<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onLoad" | "onError"> & {
|
|
435
|
-
src?: string;
|
|
436
|
-
poster?: string;
|
|
437
|
-
autoPlay?: boolean;
|
|
438
|
-
loop?: boolean;
|
|
439
|
-
loading?: _webspatial_core_sdk.ModelLoadingMode;
|
|
440
|
-
children?: React.ReactNode;
|
|
441
|
-
onLoad?: (event: ModelLoadEvent) => void;
|
|
442
|
-
onError?: (event: ModelLoadEvent) => void;
|
|
443
|
-
spatialEventOptions?: SpatialEventOptions;
|
|
444
|
-
} & {
|
|
445
|
-
'enable-xr'?: boolean;
|
|
446
|
-
} & React$1.RefAttributes<SpatializedStatic3DElementRef>, "ref"> & React$1.RefAttributes<any>>;
|
|
447
|
-
|
|
448
|
-
declare const SSRProvider: ({ isSSR: initialIsSSR, children, }: {
|
|
449
|
-
isSSR?: boolean;
|
|
450
|
-
children: React__default.ReactNode;
|
|
451
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
452
|
-
|
|
453
|
-
declare function useMetrics(): {
|
|
454
|
-
pointToPhysical: typeof PhysicalMetrics.pointToPhysical;
|
|
455
|
-
physicalToPoint: typeof PhysicalMetrics.physicalToPoint;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
declare function createElement(...args: Parameters<typeof createElement$1>): React$1.DetailedReactHTMLElement<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* const e2e = await convertCoordinate(position, { from: elementOrEntity, to: elementOrEntity })
|
|
462
|
-
const e2w = await convertCoordinate(position, { from: elementOrEntity, to: window })
|
|
463
|
-
const w2e = await convertCoordinate(position, { from: window, to: elementOrEntity })
|
|
464
|
-
*
|
|
465
|
-
*/
|
|
466
|
-
|
|
467
|
-
type CoordinateConvertible = Window | SpatializedElementRef<any> | EntityRef | ModelRef;
|
|
468
|
-
declare function convertCoordinate(position: Vec3, { from, to }: {
|
|
469
|
-
from: CoordinateConvertible;
|
|
470
|
-
to: CoordinateConvertible;
|
|
471
|
-
}): Promise<Vec3>;
|
|
472
|
-
|
|
473
|
-
declare const version: string;
|
|
474
|
-
|
|
475
|
-
export { AttachmentAsset, AttachmentEntity, BoxEntity as Box, BoxEntity, ConeEntity as Cone, ConeEntity, CylinderEntity as Cylinder, CylinderEntity, Entity, type EntityEventHandler, type EntityProps, EntityRef, Material, type MaterialProps, Model, ModelAsset, ModelEntity, type ModelLoadEvent, type ModelProps, type ModelRef, type ModelSpatialDragEndEvent, type ModelSpatialDragEvent, type ModelSpatialDragStartEvent, type ModelSpatialMagnifyEndEvent, type ModelSpatialMagnifyEvent, type ModelSpatialRotateEndEvent, type ModelSpatialRotateEvent, type ModelSpatialTapEvent, PlaneEntity as Plane, PlaneEntity, Reality, type RealityProps, SSRProvider, SceneGraph, type SpatialContentReadyCallback, type SpatialContentReadyContext, type SpatialDragEndEntityEvent, type SpatialDragEndEvent, type SpatialDragEntityEvent, type SpatialDragEvent, type SpatialDragStartEntityEvent, type SpatialDragStartEvent, type SpatialEventOptions, type SpatialMagnifyEndEntityEvent, type SpatialMagnifyEndEvent, type SpatialMagnifyEntityEvent, type SpatialMagnifyEvent, SpatialMonitor, type SpatialRotateEndEntityEvent, type SpatialRotateEndEvent, type SpatialRotateEntityEvent, type SpatialRotateEvent, type SpatialTapEntityEvent, type SpatialTapEvent, Spatialized2DElementContainer, type Spatialized2DElementContainerProps, SpatializedContainer, type SpatializedElementRef, type SpatializedStatic3DContainerProps, SpatializedStatic3DElementContainer, type SpatializedStatic3DElementRef, SphereEntity as Sphere, SphereEntity, Texture, type TextureProps, UnlitMaterial, type UnlitMaterialProps, WebSpatialRuntime, SceneGraph as World, convertCoordinate, createElement, enableDebugTool, eventMap, getAbsoluteUrl, initPolyfill, initScene, useMetrics, version, withSpatialMonitor, withSpatialized2DElementContainer };
|