@webspatial/react-sdk 1.2.1 → 1.3.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.
@@ -1,4 +1,5 @@
1
- import { SpatialSceneCreationOptions, SpatialSceneType, 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, Point3D, SpatialObject, SpatialSession, SpatializedDynamic3DElement, Vec3, SpatialEntity, SpatialBoxGeometryOptions, SpatialUnlitMaterialOptions, SpatialSphereGeometryOptions, SpatialConeGeometryOptions, SpatialCylinderGeometryOptions, SpatialPlaneGeometryOptions } from '@webspatial/core-sdk';
1
+ import * as _webspatial_core_sdk from '@webspatial/core-sdk';
2
+ import { SpatialSceneCreationOptions, SpatialSceneType, 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, Point3D, SpatialObject, SpatialSession, SpatializedDynamic3DElement, Vec3, SpatialEntity, Quaternion, SpatialBoxGeometryOptions, SpatialUnlitMaterialOptions, SpatialSphereGeometryOptions, SpatialConeGeometryOptions, SpatialCylinderGeometryOptions, SpatialPlaneGeometryOptions } from '@webspatial/core-sdk';
2
3
  export { Point3D, Vec3 } from '@webspatial/core-sdk';
3
4
  import * as React$1 from 'react';
4
5
  import React__default, { ElementType, ForwardedRef } from 'react';
@@ -70,17 +71,31 @@ type SpatialTapEvent<T extends SpatializedElementRef = SpatializedElementRef> =
70
71
  readonly offsetX: number;
71
72
  readonly offsetY: number;
72
73
  readonly offsetZ: number;
74
+ readonly clientX: number;
75
+ readonly clientY: number;
76
+ readonly clientZ: number;
73
77
  };
74
78
  type SpatialDragStartEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragStartEvent$1 & CurrentTarget<T> & {
75
79
  readonly offsetX: number;
76
80
  readonly offsetY: number;
77
81
  readonly offsetZ: number;
82
+ readonly clientX: number;
83
+ readonly clientY: number;
84
+ readonly clientZ: number;
85
+ };
86
+ type SpatialDragEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragEvent$1 & CurrentTarget<T> & {
87
+ readonly translationX: number;
88
+ readonly translationY: number;
89
+ readonly translationZ: number;
78
90
  };
79
- type SpatialDragEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragEvent$1 & CurrentTarget<T>;
80
91
  type SpatialDragEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialDragEndEvent$1 & CurrentTarget<T>;
81
- type SpatialRotateEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialRotateEvent$1 & CurrentTarget<T>;
92
+ type SpatialRotateEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialRotateEvent$1 & CurrentTarget<T> & {
93
+ readonly quaternion: _webspatial_core_sdk.Quaternion;
94
+ };
82
95
  type SpatialRotateEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialRotateEndEvent$1 & CurrentTarget<T>;
83
- type SpatialMagnifyEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialMagnifyEvent$1 & CurrentTarget<T>;
96
+ type SpatialMagnifyEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialMagnifyEvent$1 & CurrentTarget<T> & {
97
+ readonly magnification: number;
98
+ };
84
99
  type SpatialMagnifyEndEvent<T extends SpatializedElementRef = SpatializedElementRef> = SpatialMagnifyEndEvent$1 & CurrentTarget<T>;
85
100
  type ModelSpatialTapEvent = SpatialTapEvent<SpatializedStatic3DElementRef>;
86
101
  type ModelSpatialDragStartEvent = SpatialDragStartEvent<SpatializedStatic3DElementRef>;
@@ -140,10 +155,23 @@ declare class ResourceRegistry {
140
155
  destroy(): void;
141
156
  }
142
157
 
158
+ type ContainersChangeCallback = (containers: HTMLElement[]) => void;
159
+ declare class AttachmentRegistry {
160
+ private containers;
161
+ private listeners;
162
+ addContainer(name: string, instanceId: string, container: HTMLElement): void;
163
+ removeContainer(name: string, instanceId: string): void;
164
+ getContainers(name: string): HTMLElement[];
165
+ onContainersChange(name: string, cb: ContainersChangeCallback): () => void;
166
+ private notifyListeners;
167
+ destroy(): void;
168
+ }
169
+
143
170
  type RealityContextValue = {
144
171
  session: SpatialSession;
145
172
  reality: SpatializedDynamic3DElement;
146
173
  resourceRegistry: ResourceRegistry;
174
+ attachmentRegistry: AttachmentRegistry;
147
175
  } | null;
148
176
 
149
177
  interface EntityRefShape {
@@ -184,17 +212,31 @@ type SpatialTapEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialT
184
212
  readonly offsetX: number;
185
213
  readonly offsetY: number;
186
214
  readonly offsetZ: number;
215
+ readonly clientX: number;
216
+ readonly clientY: number;
217
+ readonly clientZ: number;
187
218
  };
188
219
  type SpatialDragStartEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragStartEvent$1 & allTarget<T> & {
189
220
  readonly offsetX: number;
190
221
  readonly offsetY: number;
191
222
  readonly offsetZ: number;
223
+ readonly clientX: number;
224
+ readonly clientY: number;
225
+ readonly clientZ: number;
226
+ };
227
+ type SpatialDragEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragEvent$1 & allTarget<T> & {
228
+ readonly translationX: number;
229
+ readonly translationY: number;
230
+ readonly translationZ: number;
192
231
  };
193
- type SpatialDragEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragEvent$1 & allTarget<T>;
194
232
  type SpatialDragEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialDragEndEvent$1 & allTarget<T>;
195
- type SpatialRotateEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialRotateEvent$1 & allTarget<T>;
233
+ type SpatialRotateEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialRotateEvent$1 & allTarget<T> & {
234
+ readonly quaternion: Quaternion;
235
+ };
196
236
  type SpatialRotateEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialRotateEndEvent$1 & allTarget<T>;
197
- type SpatialMagnifyEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialMagnifyEvent$1 & allTarget<T>;
237
+ type SpatialMagnifyEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialMagnifyEvent$1 & allTarget<T> & {
238
+ readonly magnification: number;
239
+ };
198
240
  type SpatialMagnifyEndEntityEvent<T extends EntityRefShape = EntityRefShape> = SpatialMagnifyEndEvent$1 & allTarget<T>;
199
241
  type EntityEventHandler = {
200
242
  onSpatialTap?: (event: SpatialTapEntityEvent) => void;
@@ -276,6 +318,22 @@ declare const ModelEntity: React__default.ForwardRefExoticComponent<EntityProps
276
318
 
277
319
  declare const Reality: React__default.ForwardRefExoticComponent<Omit<RealityProps, "ref"> & React__default.RefAttributes<HTMLElement>>;
278
320
 
321
+ type AttachmentAssetProps = {
322
+ name: string;
323
+ children?: React__default.ReactNode;
324
+ };
325
+ declare const AttachmentAsset: React__default.FC<AttachmentAssetProps>;
326
+
327
+ interface AttachmentEntityProps {
328
+ attachment: string;
329
+ position?: [number, number, number];
330
+ size: {
331
+ width: number;
332
+ height: number;
333
+ };
334
+ }
335
+ declare const AttachmentEntity: React__default.FC<AttachmentEntityProps>;
336
+
279
337
  type ModelProps = SpatializedStatic3DContainerProps & {
280
338
  'enable-xr'?: boolean;
281
339
  };
@@ -304,4 +362,4 @@ declare const SSRProvider: ({ isSSR: initialIsSSR, children, }: {
304
362
 
305
363
  declare const version: string;
306
364
 
307
- export { BoxEntity, ConeEntity, CylinderEntity, Entity, type EntityEventHandler, type EntityProps, EntityRef, 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, Reality, SSRProvider, SceneGraph, type SpatialDragEndEntityEvent, type SpatialDragEndEvent, type SpatialDragEntityEvent, type SpatialDragEvent, type SpatialDragStartEntityEvent, type SpatialDragStartEvent, 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, UnlitMaterial, enableDebugTool, eventMap, initPolyfill, initScene, toLocalSpace, toSceneSpatial, version, withSpatialMonitor, withSpatialized2DElementContainer };
365
+ export { AttachmentAsset, AttachmentEntity, BoxEntity, ConeEntity, CylinderEntity, Entity, type EntityEventHandler, type EntityProps, EntityRef, 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, Reality, SSRProvider, SceneGraph, type SpatialDragEndEntityEvent, type SpatialDragEndEvent, type SpatialDragEntityEvent, type SpatialDragEvent, type SpatialDragStartEntityEvent, type SpatialDragStartEvent, 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, UnlitMaterial, enableDebugTool, eventMap, initPolyfill, initScene, toLocalSpace, toSceneSpatial, version, withSpatialMonitor, withSpatialized2DElementContainer };