@webspatial/react-sdk 0.0.0-beta-a19231bc7abce8581b3209af150c2726eb00c4f7

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Spatial Web
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ <div align="left">
2
+ <img src="../../assets/logo.png" alt="WebSpatial Logo" width="400"/>
3
+ </div>
4
+ <br/>
5
+
6
+ # React SDK for WebSpatial
7
+
8
+ The React SDK from the WebSpatial SDK makes the WebSpatial API immediately available inside React.
9
+
10
+ ## Documentation
11
+
12
+ - [Introduction](https://webspatial.dev/docs/introduction)
13
+ - [Quick Example](https://webspatial.dev/docs/quick-example)
14
+ - [Core Concepts](https://webspatial.dev/docs/core-concepts)
15
+ - [Development Guide](https://webspatial.dev/docs/development-guide)
16
+
17
+ ## SpatialDiv `onSpatialContentReady` runtime note
18
+
19
+ When using nested `SpatialDiv` (`enable-xr`) with `onSpatialContentReady`, callback ordering differs by runtime:
20
+
21
+ - In WebSpatial runtime, parent `SpatialDiv` callback runs before child callback on the same ready edge.
22
+ - In non-WebSpatial fallback (plain web DOM), callback ordering between parent and child is not a guaranteed contract and should be treated as unspecified.
23
+
24
+ Recommended practice: initialize imperative renderers from each container's own `ctx.host` and avoid coupling setup logic to parent/child callback sequence in fallback web mode.
@@ -0,0 +1,462 @@
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, 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
+ children?: React__default.ReactNode;
86
+ onLoad?: (event: ModelLoadEvent) => void;
87
+ onError?: (event: ModelLoadEvent) => void;
88
+ spatialEventOptions?: SpatialEventOptions;
89
+ };
90
+ type SpatializedElementRef<T extends HTMLElement = HTMLElement> = T;
91
+ type SpatializedDivElementRef = SpatializedElementRef<HTMLDivElement>;
92
+ type SpatializedStatic3DElementRef = SpatializedDivElementRef & {
93
+ currentSrc: string;
94
+ ready: Promise<ModelLoadEvent>;
95
+ entityTransform: DOMMatrixReadOnly;
96
+ play(): Promise<void>;
97
+ pause(): Promise<void>;
98
+ readonly paused: boolean;
99
+ readonly duration: number;
100
+ playbackRate: number;
101
+ currentTime: number;
102
+ };
103
+ type CurrentTarget<T extends SpatializedElementRef> = {
104
+ currentTarget: T;
105
+ };
106
+ type SpatialTapEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialTapEvent$1 & CurrentTarget<T> & {
107
+ readonly offsetX: number;
108
+ readonly offsetY: number;
109
+ readonly offsetZ: number;
110
+ readonly clientX: number;
111
+ readonly clientY: number;
112
+ readonly clientZ: number;
113
+ };
114
+ type SpatialDragStartEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragStartEvent$1 & CurrentTarget<T> & {
115
+ readonly offsetX: number;
116
+ readonly offsetY: number;
117
+ readonly offsetZ: number;
118
+ readonly clientX: number;
119
+ readonly clientY: number;
120
+ readonly clientZ: number;
121
+ };
122
+ type SpatialDragEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragEvent$1 & CurrentTarget<T> & {
123
+ readonly translationX: number;
124
+ readonly translationY: number;
125
+ readonly translationZ: number;
126
+ };
127
+ type SpatialDragEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragEndEvent$1 & CurrentTarget<T>;
128
+ type SpatialRotateEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialRotateEvent$1 & CurrentTarget<T> & {
129
+ readonly quaternion: _webspatial_core_sdk.Quaternion;
130
+ };
131
+ type SpatialRotateEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialRotateEndEvent$1 & CurrentTarget<T>;
132
+ type SpatialMagnifyEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialMagnifyEvent$1 & CurrentTarget<T> & {
133
+ readonly magnification: number;
134
+ };
135
+ type SpatialMagnifyEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialMagnifyEndEvent$1 & CurrentTarget<T>;
136
+ type ModelSpatialTapEvent = SpatialTapEvent<SpatializedStatic3DElementRef>;
137
+ type ModelSpatialDragStartEvent = SpatialDragStartEvent<SpatializedStatic3DElementRef>;
138
+ type ModelSpatialDragEvent = SpatialDragEvent<SpatializedStatic3DElementRef>;
139
+ type ModelSpatialDragEndEvent = SpatialDragEndEvent<SpatializedStatic3DElementRef>;
140
+ type ModelSpatialRotateEvent = SpatialRotateEvent<SpatializedStatic3DElementRef>;
141
+ type ModelSpatialRotateEndEvent = SpatialRotateEndEvent<SpatializedStatic3DElementRef>;
142
+ type ModelSpatialMagnifyEvent = SpatialMagnifyEvent<SpatializedStatic3DElementRef>;
143
+ type ModelSpatialMagnifyEndEvent = SpatialMagnifyEndEvent<SpatializedStatic3DElementRef>;
144
+ type ModelLoadEvent = CustomEvent & {
145
+ target: SpatializedStatic3DElementRef;
146
+ };
147
+
148
+ declare const SpatializedContainer: <T extends SpatializedElementRef>(props: SpatializedContainerProps<T> & {
149
+ ref?: ForwardedRef<SpatializedElementRef<T>>;
150
+ }) => React.ReactElement | null;
151
+
152
+ declare const Spatialized2DElementContainer: <P extends ElementType>(props: Spatialized2DElementContainerProps<P> & {
153
+ ref: ForwardedRef<SpatializedElementRef>;
154
+ }) => React__default.ReactElement | null;
155
+
156
+ declare const SpatializedStatic3DElementContainer: React$1.ForwardRefExoticComponent<{
157
+ onSpatialTap?: ((event: SpatialTapEvent<SpatializedStatic3DElementRef>) => void) | undefined;
158
+ onSpatialDragStart?: ((event: SpatialDragStartEvent<SpatializedStatic3DElementRef>) => void) | undefined;
159
+ onSpatialDrag?: ((event: SpatialDragEvent<SpatializedStatic3DElementRef>) => void) | undefined;
160
+ onSpatialDragEnd?: ((event: SpatialDragEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
161
+ onSpatialRotate?: ((event: SpatialRotateEvent<SpatializedStatic3DElementRef>) => void) | undefined;
162
+ onSpatialRotateEnd?: ((event: SpatialRotateEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
163
+ onSpatialMagnify?: ((event: SpatialMagnifyEvent<SpatializedStatic3DElementRef>) => void) | undefined;
164
+ onSpatialMagnifyEnd?: ((event: SpatialMagnifyEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
165
+ } & Omit<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onLoad" | "onError"> & {
166
+ src?: string;
167
+ poster?: string;
168
+ autoPlay?: boolean;
169
+ loop?: boolean;
170
+ children?: React.ReactNode;
171
+ onLoad?: (event: ModelLoadEvent) => void;
172
+ onError?: (event: ModelLoadEvent) => void;
173
+ spatialEventOptions?: SpatialEventOptions;
174
+ } & React$1.RefAttributes<SpatializedStatic3DElementRef>>;
175
+
176
+ declare function withSpatialized2DElementContainer<P extends ElementType>(Component: P): P | React$1.ForwardRefExoticComponent<Omit<Spatialized2DElementContainerProps<P>, "ref"> & React$1.RefAttributes<HTMLElement>>;
177
+
178
+ declare function initPolyfill(): void;
179
+
180
+ declare function withSpatialMonitor(El: React__default.ElementType): any;
181
+
182
+ type SpatialMonitorProps = {
183
+ El?: ElementType;
184
+ };
185
+ declare const SpatialMonitor: React$1.ForwardRefExoticComponent<SpatialMonitorProps & React$1.RefAttributes<HTMLElement>>;
186
+
187
+ /**
188
+ * Tracks spatial resources (textures, materials, entities, …) by string id under one Reality.
189
+ *
190
+ * Native creation is async (`createTexture`, `createUnlitMaterial`, …). The map
191
+ * stores `Promise<SpatialObject>` so `add(id, pendingCreation)` can run after `get(id)` — sibling
192
+ * JSX order does not need to match registration order. Callers are responsible for using the
193
+ * correct id for each resource kind (same as with string ids today).
194
+ *
195
+ * Callers can `await get(id)` before `add(id, promise)` runs: `get` returns a promise that
196
+ * settles when something later calls `add` with the same id.
197
+ */
198
+ declare class ResourceRegistry {
199
+ /** Every id maps to a promise — either the real resource from add(), or a placeholder until then. */
200
+ private resources;
201
+ /** If get() ran first, we stash resolve/reject so add() can complete the waiting promise. */
202
+ private deferreds;
203
+ add<T extends SpatialObject>(id: string, resource: Promise<T>): void;
204
+ get(id: string): Promise<SpatialObject>;
205
+ remove(id: string): void;
206
+ removeAndDestroy(id: string): void;
207
+ destroy(): void;
208
+ }
209
+
210
+ type ContainerEntry = {
211
+ instanceId: string;
212
+ container: HTMLElement;
213
+ };
214
+ type ContainersChangeCallback = (containers: ContainerEntry[]) => void;
215
+ declare class AttachmentRegistry {
216
+ private containers;
217
+ private listeners;
218
+ addContainer(name: string, instanceId: string, container: HTMLElement): void;
219
+ removeContainer(name: string, instanceId: string): void;
220
+ getContainers(name: string): ContainerEntry[];
221
+ onContainersChange(name: string, cb: ContainersChangeCallback): () => void;
222
+ private notifyListeners;
223
+ destroy(): void;
224
+ }
225
+
226
+ type RealityContextValue = {
227
+ session: SpatialSession;
228
+ reality: SpatializedDynamic3DElement;
229
+ resourceRegistry: ResourceRegistry;
230
+ attachmentRegistry: AttachmentRegistry;
231
+ } | null;
232
+
233
+ interface EntityRefShape {
234
+ convertFromEntityToEntity: (fromEntityId: string, toEntityId: string, position: Vec3) => Promise<Vec3>;
235
+ convertFromEntityToReality: (entityId: string, position: Vec3) => Promise<Vec3>;
236
+ convertFromRealityToEntity: (entityId: string, position: Vec3) => Promise<Vec3>;
237
+ id: string | undefined;
238
+ name: string | undefined;
239
+ entity: SpatialEntity | null;
240
+ }
241
+ declare class EntityRef implements EntityRefShape {
242
+ private _entity;
243
+ private _ctx;
244
+ constructor(entity?: SpatialEntity | null, ctx?: RealityContextValue | null);
245
+ updateEntity(entity?: SpatialEntity | null): void;
246
+ updateCtx(ctx?: RealityContextValue | null): void;
247
+ destroy(): void;
248
+ get entity(): SpatialEntity | null;
249
+ get id(): string | undefined;
250
+ get name(): string | undefined;
251
+ convertFromEntityToEntity(fromEntityId: string, toEntityId: string, position: Vec3): Promise<Vec3>;
252
+ convertFromEntityToReality(entityId: string, position: Vec3): Promise<Vec3>;
253
+ convertFromRealityToEntity(entityId: string, position: Vec3): Promise<Vec3>;
254
+ }
255
+
256
+ type EntityProps = {
257
+ id?: string;
258
+ name?: string;
259
+ position?: Vec3;
260
+ rotation?: Vec3;
261
+ scale?: Vec3;
262
+ enableInput?: boolean;
263
+ };
264
+ type allTarget<T extends EntityRefShape> = {
265
+ target: T;
266
+ currentTarget: T;
267
+ };
268
+ type SpatialTapEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialTapEvent$1 & allTarget<T> & {
269
+ readonly offsetX: number;
270
+ readonly offsetY: number;
271
+ readonly offsetZ: number;
272
+ readonly clientX: number;
273
+ readonly clientY: number;
274
+ readonly clientZ: number;
275
+ };
276
+ type SpatialDragStartEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragStartEvent$1 & allTarget<T> & {
277
+ readonly offsetX: number;
278
+ readonly offsetY: number;
279
+ readonly offsetZ: number;
280
+ readonly clientX: number;
281
+ readonly clientY: number;
282
+ readonly clientZ: number;
283
+ };
284
+ type SpatialDragEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragEvent$1 & allTarget<T> & {
285
+ readonly translationX: number;
286
+ readonly translationY: number;
287
+ readonly translationZ: number;
288
+ };
289
+ type SpatialDragEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragEndEvent$1 & allTarget<T>;
290
+ type SpatialRotateEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialRotateEvent$1 & allTarget<T> & {
291
+ readonly quaternion: Quaternion;
292
+ };
293
+ type SpatialRotateEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialRotateEndEvent$1 & allTarget<T>;
294
+ type SpatialMagnifyEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialMagnifyEvent$1 & allTarget<T> & {
295
+ readonly magnification: number;
296
+ };
297
+ type SpatialMagnifyEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialMagnifyEndEvent$1 & allTarget<T>;
298
+ type EntityEventHandler = {
299
+ onSpatialTap?: (event: SpatialTapEntityEvent) => void;
300
+ onSpatialDragStart?: (event: SpatialDragStartEntityEvent) => void;
301
+ onSpatialDrag?: (event: SpatialDragEntityEvent) => void;
302
+ onSpatialDragEnd?: (event: SpatialDragEndEntityEvent) => void;
303
+ spatialEventOptions?: SpatialEventOptions;
304
+ onSpatialRotate?: (event: SpatialRotateEntityEvent) => void;
305
+ onSpatialRotateEnd?: (event: SpatialRotateEndEntityEvent) => void;
306
+ onSpatialMagnify?: (event: SpatialMagnifyEntityEvent) => void;
307
+ onSpatialMagnifyEnd?: (event: SpatialMagnifyEndEntityEvent) => void;
308
+ };
309
+ declare const eventMap: {
310
+ readonly onSpatialTap: "spatialtap";
311
+ readonly onSpatialDragStart: "spatialdragstart";
312
+ readonly onSpatialDrag: "spatialdrag";
313
+ readonly onSpatialDragEnd: "spatialdragend";
314
+ readonly onSpatialRotate: "spatialrotate";
315
+ readonly onSpatialRotateEnd: "spatialrotateend";
316
+ readonly onSpatialMagnify: "spatialmagnify";
317
+ readonly onSpatialMagnifyEnd: "spatialmagnifyend";
318
+ };
319
+
320
+ declare const Entity: React__default.ForwardRefExoticComponent<EntityProps & {
321
+ children?: React__default.ReactNode;
322
+ } & React__default.RefAttributes<EntityRefShape>>;
323
+
324
+ declare const BoxEntity: React__default.ForwardRefExoticComponent<EntityProps & {
325
+ children?: React__default.ReactNode;
326
+ materials?: string[];
327
+ } & SpatialBoxGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
328
+
329
+ type UnlitMaterialProps = {
330
+ children?: React__default.ReactNode;
331
+ id: string;
332
+ } & SpatialUnlitMaterialOptions;
333
+ declare const UnlitMaterial: React__default.FC<UnlitMaterialProps>;
334
+
335
+ type TextureProps = {
336
+ children?: React__default.ReactNode;
337
+ id: string;
338
+ url: string;
339
+ onLoad?: () => void;
340
+ onError?: (error: unknown) => void;
341
+ };
342
+ declare const Texture: React__default.FC<TextureProps>;
343
+
344
+ declare const SphereEntity: React__default.ForwardRefExoticComponent<EntityProps & {
345
+ children?: React__default.ReactNode;
346
+ materials?: string[];
347
+ } & SpatialSphereGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
348
+
349
+ declare const ConeEntity: React__default.ForwardRefExoticComponent<EntityProps & {
350
+ children?: React__default.ReactNode;
351
+ materials?: string[];
352
+ } & SpatialConeGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
353
+
354
+ declare const CylinderEntity: React__default.ForwardRefExoticComponent<EntityProps & {
355
+ children?: React__default.ReactNode;
356
+ materials?: string[];
357
+ } & SpatialCylinderGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
358
+
359
+ declare const PlaneEntity: React__default.ForwardRefExoticComponent<EntityProps & {
360
+ children?: React__default.ReactNode;
361
+ materials?: string[];
362
+ } & SpatialPlaneGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
363
+
364
+ type Props$1 = {
365
+ children?: React__default.ReactNode;
366
+ };
367
+ declare const SceneGraph: React__default.FC<Props$1>;
368
+
369
+ type Props = {
370
+ children?: React__default.ReactNode;
371
+ id: string;
372
+ src: string;
373
+ onLoad?: () => void;
374
+ onError?: (error: unknown) => void;
375
+ };
376
+ declare const ModelAsset: React__default.FC<Props>;
377
+
378
+ declare const ModelEntity: React__default.ForwardRefExoticComponent<EntityProps & {
379
+ model: string;
380
+ materials?: string[];
381
+ } & EntityEventHandler & {
382
+ children?: React__default.ReactNode;
383
+ } & React__default.RefAttributes<EntityRefShape>>;
384
+
385
+ type RealityProps = Omit<React__default.ComponentPropsWithRef<'div'>, 'onSpatialContentReady'> & EntityEventHandler;
386
+ declare const Reality: React__default.ForwardRefExoticComponent<Omit<RealityProps, "ref"> & React__default.RefAttributes<HTMLElement>>;
387
+
388
+ type AttachmentAssetProps = {
389
+ name: string;
390
+ children?: React__default.ReactNode;
391
+ };
392
+ declare const AttachmentAsset: React__default.FC<AttachmentAssetProps>;
393
+
394
+ type AttachmentEntityProps = {
395
+ attachment: string;
396
+ position?: [number, number, number];
397
+ size: {
398
+ width: number;
399
+ height: number;
400
+ };
401
+ };
402
+ declare const AttachmentEntity: React__default.FC<AttachmentEntityProps>;
403
+
404
+ type MaterialProps = {
405
+ type: 'unlit';
406
+ } & UnlitMaterialProps;
407
+ declare const Material: React__default.FC<MaterialProps>;
408
+
409
+ type ModelProps = SpatializedStatic3DContainerProps & {
410
+ 'enable-xr'?: boolean;
411
+ };
412
+ type ModelRef = SpatializedStatic3DElementRef;
413
+ declare const Model: React$1.ForwardRefExoticComponent<Omit<{
414
+ onSpatialTap?: ((event: SpatialTapEvent<SpatializedStatic3DElementRef>) => void) | undefined;
415
+ onSpatialDragStart?: ((event: SpatialDragStartEvent<SpatializedStatic3DElementRef>) => void) | undefined;
416
+ onSpatialDrag?: ((event: SpatialDragEvent<SpatializedStatic3DElementRef>) => void) | undefined;
417
+ onSpatialDragEnd?: ((event: SpatialDragEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
418
+ onSpatialRotate?: ((event: SpatialRotateEvent<SpatializedStatic3DElementRef>) => void) | undefined;
419
+ onSpatialRotateEnd?: ((event: SpatialRotateEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
420
+ onSpatialMagnify?: ((event: SpatialMagnifyEvent<SpatializedStatic3DElementRef>) => void) | undefined;
421
+ onSpatialMagnifyEnd?: ((event: SpatialMagnifyEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
422
+ } & Omit<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onLoad" | "onError"> & {
423
+ src?: string;
424
+ poster?: string;
425
+ autoPlay?: boolean;
426
+ loop?: boolean;
427
+ children?: React.ReactNode;
428
+ onLoad?: (event: ModelLoadEvent) => void;
429
+ onError?: (event: ModelLoadEvent) => void;
430
+ spatialEventOptions?: SpatialEventOptions;
431
+ } & {
432
+ 'enable-xr'?: boolean;
433
+ } & React$1.RefAttributes<SpatializedStatic3DElementRef>, "ref"> & React$1.RefAttributes<any>>;
434
+
435
+ declare const SSRProvider: ({ isSSR: initialIsSSR, children, }: {
436
+ isSSR?: boolean;
437
+ children: React__default.ReactNode;
438
+ }) => react_jsx_runtime.JSX.Element;
439
+
440
+ declare function useMetrics(): {
441
+ pointToPhysical: typeof PhysicalMetrics.pointToPhysical;
442
+ physicalToPoint: typeof PhysicalMetrics.physicalToPoint;
443
+ };
444
+
445
+ declare function createElement(...args: Parameters<typeof createElement$1>): React$1.DetailedReactHTMLElement<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
446
+
447
+ /**
448
+ * const e2e = await convertCoordinate(position, { from: elementOrEntity, to: elementOrEntity })
449
+ const e2w = await convertCoordinate(position, { from: elementOrEntity, to: window })
450
+ const w2e = await convertCoordinate(position, { from: window, to: elementOrEntity })
451
+ *
452
+ */
453
+
454
+ type CoordinateConvertible = Window | SpatializedElementRef<any> | EntityRef | ModelRef;
455
+ declare function convertCoordinate(position: Vec3, { from, to }: {
456
+ from: CoordinateConvertible;
457
+ to: CoordinateConvertible;
458
+ }): Promise<Vec3>;
459
+
460
+ declare const version: string;
461
+
462
+ 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 };