@webspatial/react-sdk 1.6.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +270 -0
  2. package/dist/Model-DO5ps8NA.d.ts +35 -0
  3. package/dist/Reality-BDyKL6th.d.ts +256 -0
  4. package/dist/Reality-DO-itiWW.d.ts +33 -0
  5. package/dist/SceneGraph-DxH74y6-.d.ts +214 -0
  6. package/dist/chunk-6JSRUX7P.js +2 -0
  7. package/dist/chunk-6JSRUX7P.js.map +1 -0
  8. package/dist/chunk-BTLTBCA7.js +2 -0
  9. package/dist/chunk-BTLTBCA7.js.map +1 -0
  10. package/dist/chunk-GG2QK5MA.js +2 -0
  11. package/dist/chunk-GG2QK5MA.js.map +1 -0
  12. package/dist/chunk-IOLNY4GP.js +2 -0
  13. package/dist/chunk-IOLNY4GP.js.map +1 -0
  14. package/dist/chunk-NWVQY6CN.js +2 -0
  15. package/dist/chunk-NWVQY6CN.js.map +1 -0
  16. package/dist/chunk-NXEOIP4Z.js +2 -0
  17. package/dist/chunk-NXEOIP4Z.js.map +1 -0
  18. package/dist/chunk-PDUEHFTO.js +2 -0
  19. package/dist/chunk-PDUEHFTO.js.map +1 -0
  20. package/dist/chunk-QHUROD77.js +2 -0
  21. package/dist/chunk-QHUROD77.js.map +1 -0
  22. package/dist/chunk-UHEO47WY.js +2 -0
  23. package/dist/chunk-UHEO47WY.js.map +1 -0
  24. package/dist/chunk-WDOPCAA3.js +19 -0
  25. package/dist/chunk-WDOPCAA3.js.map +1 -0
  26. package/dist/eager.d.ts +46 -0
  27. package/dist/eager.js +8 -0
  28. package/dist/eager.js.map +1 -0
  29. package/dist/experimental.d.ts +24 -0
  30. package/dist/experimental.js +8 -0
  31. package/dist/experimental.js.map +1 -0
  32. package/dist/index.d.ts +70 -0
  33. package/dist/index.js +8 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/internal/facades-client.d.ts +50 -0
  36. package/dist/internal/facades-client.js +3 -0
  37. package/dist/internal/facades-client.js.map +1 -0
  38. package/dist/jsx/jsx-dev-runtime.d.ts +7 -79
  39. package/dist/jsx/jsx-dev-runtime.js +1 -66
  40. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  41. package/dist/jsx/jsx-runtime.d.ts +81 -2
  42. package/dist/jsx/jsx-runtime.js +1 -66
  43. package/dist/jsx/jsx-runtime.js.map +1 -1
  44. package/dist/jsx-shared-CFDVUVpc.d.ts +16 -0
  45. package/dist/motionBindingTypes-CjxIC5bP.d.ts +25 -0
  46. package/dist/runtime/registerEagerEntry.d.ts +8 -0
  47. package/dist/runtime/registerEagerEntry.js +2 -0
  48. package/dist/runtime/registerEagerEntry.js.map +1 -0
  49. package/dist/spatial.d.ts +25 -0
  50. package/dist/spatial.js +7 -0
  51. package/dist/spatial.js.map +1 -0
  52. package/dist/useAnimation-C1LXt-xO.d.ts +28 -0
  53. package/dist/useMetrics-Bm_Urbtp.d.ts +96 -0
  54. package/package.json +53 -33
  55. package/dist/default/index.d.ts +0 -408
  56. package/dist/default/index.js +0 -3852
  57. package/dist/default/index.js.map +0 -1
  58. package/dist/jsx/jsx-dev-runtime.web.d.ts +0 -2
  59. package/dist/jsx/jsx-dev-runtime.web.js +0 -18
  60. package/dist/jsx/jsx-dev-runtime.web.js.map +0 -1
  61. package/dist/jsx/jsx-runtime.web.d.ts +0 -1
  62. package/dist/jsx/jsx-runtime.web.js +0 -18
  63. package/dist/jsx/jsx-runtime.web.js.map +0 -1
  64. package/dist/web/index.d.ts +0 -408
  65. package/dist/web/index.js +0 -3905
  66. package/dist/web/index.js.map +0 -1
@@ -1,5 +1,84 @@
1
1
  export { Fragment } from 'react/jsx-runtime';
2
- export { JSX, jsx, j as jsxs } from './jsx-dev-runtime.js';
2
+ export { j as jsx, a as jsxs } from '../jsx-shared-CFDVUVpc.js';
3
+ import { SpatialTapEvent, SpatialDragStartEvent, SpatialDragEvent, SpatialDragEndEvent, SpatialRotateEvent, SpatialRotateEndEvent, SpatialMagnifyEvent, SpatialMagnifyEndEvent, SpatialEventOptions, SpatialContentReadyCallback } from '@webspatial/react-sdk';
4
+ import { S as SpatializedMotionBinding } from '../motionBindingTypes-CjxIC5bP.js';
3
5
  import 'react';
4
6
  import 'react/jsx-dev-runtime';
5
- import '@webspatial/react-sdk';
7
+ import '@webspatial/core-sdk';
8
+
9
+ type IsPreReact19 = 2 extends Parameters<React.FunctionComponent<any>>['length'] ? true : false;
10
+ /** @ts-ignore */
11
+ type ReactJSXElement = true extends IsPreReact19 ? JSX.Element : React.JSX.Element;
12
+ /** @ts-ignore */
13
+ type ReactJSXElementClass = true extends IsPreReact19 ? JSX.ElementClass : React.JSX.ElementClass;
14
+ /** @ts-ignore */
15
+ type ReactJSXElementAttributesProperty = true extends IsPreReact19 ? JSX.ElementAttributesProperty : React.JSX.ElementAttributesProperty;
16
+ /** @ts-ignore */
17
+ type ReactJSXElementChildrenAttribute = true extends IsPreReact19 ? JSX.ElementChildrenAttribute : React.JSX.ElementChildrenAttribute;
18
+ /** @ts-ignore */
19
+ type ReactJSXLibraryManagedAttributes<C, P> = true extends IsPreReact19 ? JSX.LibraryManagedAttributes<C, P> : React.JSX.LibraryManagedAttributes<C, P>;
20
+ /** @ts-ignore */
21
+ type ReactJSXIntrinsicAttributes = true extends IsPreReact19 ? JSX.IntrinsicAttributes : React.JSX.IntrinsicAttributes;
22
+ /** @ts-ignore */
23
+ type ReactJSXIntrinsicClassAttributes<T> = true extends IsPreReact19 ? JSX.IntrinsicClassAttributes<T> : React.JSX.IntrinsicClassAttributes<T>;
24
+ /** @ts-ignore */
25
+ type ReactJSXIntrinsicElements = true extends IsPreReact19 ? JSX.IntrinsicElements : React.JSX.IntrinsicElements;
26
+ /** @ts-ignore */
27
+ type ReactJSXElementType = true extends IsPreReact19 ? string | React.JSXElementConstructor<any> : React.JSX.ElementType;
28
+ declare namespace WebSpatialJSX {
29
+ export type ElementType = ReactJSXElementType;
30
+ export interface Element extends ReactJSXElement {
31
+ }
32
+ export interface ElementClass extends ReactJSXElementClass {
33
+ }
34
+ export interface ElementAttributesProperty extends ReactJSXElementAttributesProperty {
35
+ }
36
+ export interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {
37
+ }
38
+ export type LibraryManagedAttributes<C, P> = ReactJSXLibraryManagedAttributes<C, P>;
39
+ export interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {
40
+ }
41
+ export interface IntrinsicClassAttributes<T> extends ReactJSXIntrinsicClassAttributes<T> {
42
+ }
43
+ type BaseSpatialIntrinsic = {
44
+ style?: React.CSSProperties;
45
+ 'enable-xr'?: boolean;
46
+ 'xr-animation'?: SpatializedMotionBinding;
47
+ onSpatialTap?: (e: SpatialTapEvent) => void;
48
+ onSpatialDragStart?: (e: SpatialDragStartEvent) => void;
49
+ onSpatialDrag?: (e: SpatialDragEvent) => void;
50
+ onSpatialDragEnd?: (e: SpatialDragEndEvent) => void;
51
+ onSpatialRotate?: (e: SpatialRotateEvent) => void;
52
+ onSpatialRotateEnd?: (e: SpatialRotateEndEvent) => void;
53
+ onSpatialMagnify?: (e: SpatialMagnifyEvent) => void;
54
+ onSpatialMagnifyEnd?: (e: SpatialMagnifyEndEvent) => void;
55
+ spatialEventOptions?: SpatialEventOptions;
56
+ };
57
+ export type IntrinsicElements = {
58
+ [K in keyof ReactJSXIntrinsicElements]: ReactJSXIntrinsicElements[K] & BaseSpatialIntrinsic & (K extends 'div' ? {
59
+ onSpatialContentReady?: SpatialContentReadyCallback;
60
+ } : {});
61
+ };
62
+ export { };
63
+ }
64
+ declare module 'react' {
65
+ interface CSSProperties {
66
+ '--xr-background-material'?: string;
67
+ '--xr-back'?: number | string;
68
+ '--xr-depth'?: number | string;
69
+ '--xr-z-index'?: number | string;
70
+ enableXr?: boolean;
71
+ }
72
+ }
73
+
74
+ declare global {
75
+ interface CSSStyleDeclaration {
76
+ '--xr-background-material'?: string;
77
+ '--xr-back'?: number | string;
78
+ '--xr-depth'?: number | string;
79
+ '--xr-z-index'?: number | string;
80
+ enableXr?: boolean;
81
+ }
82
+ }
83
+
84
+ export { WebSpatialJSX as JSX };
@@ -1,67 +1,2 @@
1
-
2
- (function(){
3
- if(typeof window === 'undefined') return;
4
- if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
5
- window.__webspatialsdk__['react-sdk-version'] = "1.6.1"
6
- window.__webspatialsdk__['XR_ENV'] = "avp"
7
- })()
8
-
9
-
10
- // src/jsx/jsx-runtime.ts
11
- import { Fragment } from "react/jsx-runtime";
12
-
13
- // src/jsx/jsx-shared.ts
14
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
15
- import reactJSXRuntime from "react/jsx-runtime";
16
- import { createElement as reactCreateElement } from "react";
17
- import {
18
- withSpatialMonitor,
19
- withSpatialized2DElementContainer,
20
- Model
21
- } from "@webspatial/react-sdk";
22
- var attributeFlag = "enable-xr";
23
- var styleFlag = "enableXr";
24
- var classFlag = "__enableXr__";
25
- var xrMonitorFlag = "enable-xr-monitor";
26
- function replaceToSpatialPrimitiveType(type, props) {
27
- if (type === Model) {
28
- return type;
29
- }
30
- const propsObject = props;
31
- if (attributeFlag in propsObject) {
32
- delete propsObject[attributeFlag];
33
- return withSpatialized2DElementContainer(type);
34
- }
35
- if (xrMonitorFlag in propsObject) {
36
- delete propsObject[xrMonitorFlag];
37
- return withSpatialMonitor(type);
38
- }
39
- if (propsObject && propsObject.style && styleFlag in propsObject.style) {
40
- delete propsObject.style[styleFlag];
41
- return withSpatialized2DElementContainer(type);
42
- }
43
- if (propsObject && typeof propsObject.className === "string") {
44
- const originalClassNames = propsObject.className.split(" ");
45
- const idx = originalClassNames.indexOf(classFlag);
46
- if (idx !== -1) {
47
- originalClassNames.splice(idx, 1);
48
- propsObject.className = originalClassNames.join(" ");
49
- return withSpatialized2DElementContainer(type);
50
- }
51
- }
52
- return type;
53
- }
54
- function jsxs(type, props, key) {
55
- type = replaceToSpatialPrimitiveType(type, props);
56
- return reactJSXRuntime.jsxs(type, props, key);
57
- }
58
- function jsx(type, props, key) {
59
- type = replaceToSpatialPrimitiveType(type, props);
60
- return reactJSXRuntime.jsx(type, props, key);
61
- }
62
- export {
63
- Fragment,
64
- jsx,
65
- jsxs
66
- };
1
+ import{jsx,jsxs}from"../chunk-PDUEHFTO.js";import"../chunk-QHUROD77.js";import"../chunk-NXEOIP4Z.js";import{Fragment}from"react/jsx-runtime";export{Fragment,jsx,jsxs};
67
2
  //# sourceMappingURL=jsx-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/jsx-shared.ts"],"sourcesContent":["export { Fragment } from 'react/jsx-runtime'\nexport { jsx, jsxs } from './jsx-shared'\n\nexport type { WebSpatialJSX as JSX } from './jsx-namespace'\nexport * from './xr-css-extension'\n","import { jsxDEV as _jsxDEV, JSXSource } from 'react/jsx-dev-runtime'\nimport reactJSXRuntime from 'react/jsx-runtime'\nimport { createElement as reactCreateElement } from 'react'\nimport {\n withSpatialMonitor,\n withSpatialized2DElementContainer,\n Model,\n //@ts-ignore bypass ts check for external\n} from '@webspatial/react-sdk'\nconst attributeFlag = 'enable-xr'\nconst styleFlag = 'enableXr'\nconst classFlag = '__enableXr__'\nconst xrMonitorFlag = 'enable-xr-monitor'\n\nexport function replaceToSpatialPrimitiveType(\n type: React.ElementType,\n props: unknown,\n) {\n if (type === Model) {\n return type\n }\n\n const propsObject = props as Record<string, any>\n if (attributeFlag in propsObject) {\n delete propsObject[attributeFlag]\n return withSpatialized2DElementContainer(type)\n }\n\n if (xrMonitorFlag in propsObject) {\n delete propsObject[xrMonitorFlag]\n return withSpatialMonitor(type)\n }\n\n if (propsObject && propsObject.style && styleFlag in propsObject.style) {\n delete propsObject.style[styleFlag]\n return withSpatialized2DElementContainer(type)\n }\n\n if (propsObject && typeof propsObject.className === 'string') {\n const originalClassNames = propsObject.className.split(' ')\n const idx = originalClassNames.indexOf(classFlag)\n if (idx !== -1) {\n originalClassNames.splice(idx, 1)\n propsObject.className = originalClassNames.join(' ')\n return withSpatialized2DElementContainer(type)\n }\n }\n\n return type\n}\n\nexport function jsxs(type: React.ElementType, props: unknown, key?: React.Key) {\n type = replaceToSpatialPrimitiveType(type, props)\n return reactJSXRuntime.jsxs(type, props, key)\n}\n\nexport function jsx(type: React.ElementType, props: unknown, key?: React.Key) {\n type = replaceToSpatialPrimitiveType(type, props)\n return reactJSXRuntime.jsx(type, props, key)\n}\n\nexport function jsxDEV(\n type: React.ElementType,\n props: unknown,\n key: React.Key,\n isStatic: boolean,\n source?: JSXSource,\n self?: unknown,\n) {\n type = replaceToSpatialPrimitiveType(type, props)\n return _jsxDEV(type, props, key, isStatic, source, self)\n}\n\nexport function createElement(...args: Parameters<typeof reactCreateElement>) {\n const [type, props, ...rest] = args\n const newType = replaceToSpatialPrimitiveType(type as any, props)\n return reactCreateElement(newType, props, ...rest)\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,gBAAgB;;;ACAzB,SAAS,UAAU,eAA0B;AAC7C,OAAO,qBAAqB;AAC5B,SAAS,iBAAiB,0BAA0B;AACpD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,IAAM,gBAAgB;AACtB,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,gBAAgB;AAEf,SAAS,8BACd,MACA,OACA;AACA,MAAI,SAAS,OAAO;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,cAAc;AACpB,MAAI,iBAAiB,aAAa;AAChC,WAAO,YAAY,aAAa;AAChC,WAAO,kCAAkC,IAAI;AAAA,EAC/C;AAEA,MAAI,iBAAiB,aAAa;AAChC,WAAO,YAAY,aAAa;AAChC,WAAO,mBAAmB,IAAI;AAAA,EAChC;AAEA,MAAI,eAAe,YAAY,SAAS,aAAa,YAAY,OAAO;AACtE,WAAO,YAAY,MAAM,SAAS;AAClC,WAAO,kCAAkC,IAAI;AAAA,EAC/C;AAEA,MAAI,eAAe,OAAO,YAAY,cAAc,UAAU;AAC5D,UAAM,qBAAqB,YAAY,UAAU,MAAM,GAAG;AAC1D,UAAM,MAAM,mBAAmB,QAAQ,SAAS;AAChD,QAAI,QAAQ,IAAI;AACd,yBAAmB,OAAO,KAAK,CAAC;AAChC,kBAAY,YAAY,mBAAmB,KAAK,GAAG;AACnD,aAAO,kCAAkC,IAAI;AAAA,IAC/C;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,KAAK,MAAyB,OAAgB,KAAiB;AAC7E,SAAO,8BAA8B,MAAM,KAAK;AAChD,SAAO,gBAAgB,KAAK,MAAM,OAAO,GAAG;AAC9C;AAEO,SAAS,IAAI,MAAyB,OAAgB,KAAiB;AAC5E,SAAO,8BAA8B,MAAM,KAAK;AAChD,SAAO,gBAAgB,IAAI,MAAM,OAAO,GAAG;AAC7C;","names":[]}
1
+ {"version":3,"sources":["../../src/jsx/jsx-runtime.ts"],"sourcesContent":["export { Fragment } from 'react/jsx-runtime'\nexport { jsx, jsxs } from './jsx-shared'\n\nexport type { WebSpatialJSX as JSX } from './jsx-namespace'\nexport * from './xr-css-extension'\n"],"mappings":"qGAAA,OAAS,aAAgB","names":[]}
@@ -0,0 +1,16 @@
1
+ import * as React$1 from 'react';
2
+ import { createElement as createElement$1 } from 'react';
3
+ import { JSXSource } from 'react/jsx-dev-runtime';
4
+
5
+ declare function jsxs(type: React.ElementType, props: unknown, key?: React.Key): any;
6
+ declare function jsx(type: React.ElementType, props: unknown, key?: React.Key): any;
7
+ declare function jsxDEV(type: React.ElementType, props: unknown, key: React.Key, isStatic: boolean, source?: JSXSource, self?: unknown): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>>;
8
+ /**
9
+ * @deprecated Use the new JSX transform (tsconfig `"jsx": "react-jsx"` or
10
+ * babel `runtime: "automatic"`) instead. SDK strip + facade-HOC wrap is
11
+ * provided via the `package.json` `"./jsx-runtime"` mapping. This export
12
+ * will be removed in v2.
13
+ */
14
+ declare function createElement(...args: Parameters<typeof createElement$1>): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>>;
15
+
16
+ export { jsxs as a, jsxDEV as b, createElement as c, jsx as j };
@@ -0,0 +1,25 @@
1
+ import { SpatializedElement } from '@webspatial/core-sdk';
2
+
3
+ /**
4
+ * Internal binding contract shared between React container wiring and the Core
5
+ * motion controller for `xr-animation`.
6
+ */
7
+ interface SpatializedMotionBinding {
8
+ /** Identifies the binding family for runtime guards. */
9
+ readonly __kind: 'spatializedMotion';
10
+ /**
11
+ * Attaches or detaches the resolved runtime element from the binding.
12
+ *
13
+ * @param element - The resolved runtime element or `null` when detaching.
14
+ */
15
+ __setElement: (element: SpatializedElement | null) => void;
16
+ /**
17
+ * Performs owner-aware unbind cleanup without forcing an extra
18
+ * `__setElement(null)` call.
19
+ *
20
+ * @param element - The runtime element owned by the cleanup effect.
21
+ */
22
+ __onUnbind?: (element: SpatializedElement) => void;
23
+ }
24
+
25
+ export type { SpatializedMotionBinding as S };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Registers the eager entry root as a side effect of computing this value.
3
+ * `src/eager.ts` MUST reference this binding (see its bridge-setup expression)
4
+ * so downstream bundlers cannot tree-shake the registration away.
5
+ */
6
+ declare const eagerEntryRegistered: "eager";
7
+
8
+ export { eagerEntryRegistered };
@@ -0,0 +1,2 @@
1
+ import{eagerEntryRegistered}from"../chunk-IOLNY4GP.js";import"../chunk-6JSRUX7P.js";import"../chunk-NXEOIP4Z.js";export{eagerEntryRegistered};
2
+ //# sourceMappingURL=registerEagerEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,25 @@
1
+ export { M as Model, a as ModelProps, b as ModelRef } from './Model-DO5ps8NA.js';
2
+ export { A as AttachmentAsset, a as AttachmentEntity, B as Box, B as BoxEntity, C as Cone, C as ConeEntity, b as Cylinder, b as CylinderEntity, E as Entity, M as Material, f as MaterialProps, c as ModelAsset, d as ModelEntity, P as Plane, P as PlaneEntity, S as SceneGraph, e as Sphere, e as SphereEntity, T as Texture, g as TextureProps, U as UnlitMaterial, h as UnlitMaterialProps, S as World, u as useMetrics } from './useMetrics-Bm_Urbtp.js';
3
+ import { J as Spatialized2DElementContainerProps } from './Reality-BDyKL6th.js';
4
+ export { E as EntityEventHandler, k as EntityProps, l as EntityRef, R as Reality, v as RealityProps, y as SpatialDragEndEntityEvent, z as SpatialDragEntityEvent, A as SpatialDragStartEntityEvent, B as SpatialMagnifyEndEntityEvent, C as SpatialMagnifyEntityEvent, D as SpatialRotateEndEntityEvent, F as SpatialRotateEntityEvent, G as SpatialTapEntityEvent, K as eventMap } from './Reality-BDyKL6th.js';
5
+ import { AnimationConfig, AnimatedProps, AnimationApi, SpatialSession } from '@webspatial/core-sdk';
6
+ export { u as useAnimation } from './useAnimation-C1LXt-xO.js';
7
+ import * as React from 'react';
8
+ import React__default, { ElementType } from 'react';
9
+ import './motionBindingTypes-CjxIC5bP.js';
10
+
11
+ declare function withSpatialized2DElementContainer<P extends ElementType>(Component: P): P | React.ForwardRefExoticComponent<Omit<Spatialized2DElementContainerProps<P>, "ref"> & React.RefAttributes<HTMLElement>>;
12
+
13
+ /**
14
+ * Internal entity animation hook.
15
+ * Called unconditionally by the dispatch layer; `active` controls whether effects run.
16
+ * When `active` is false, all hooks still execute but effects short-circuit.
17
+ */
18
+ declare function useEntityAnimation(config: AnimationConfig, active?: boolean): [AnimatedProps, AnimationApi];
19
+
20
+ declare function withSpatialMonitor(El: React__default.ElementType): any;
21
+
22
+ /** @hidden */
23
+ declare function getSession(): SpatialSession | null;
24
+
25
+ export { getSession, useEntityAnimation, withSpatialMonitor, withSpatialized2DElementContainer };
@@ -0,0 +1,7 @@
1
+ (function(){
2
+ if(typeof window === 'undefined') return;
3
+ if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
4
+ window.__webspatialsdk__['react-sdk-version'] = "2.0.0"
5
+ })()
6
+ import{AttachmentAsset,AttachmentEntity,BoxEntity,ConeEntity,CylinderEntity,Entity,Material,Model,ModelAsset,ModelEntity,PlaneEntity,Reality,SceneGraph,SphereEntity,Texture,UnlitMaterial,eventMap,getSession,useAnimation,useEntityAnimation,useMetrics,withSpatialMonitor,withSpatialized2DElementContainer}from"./chunk-WDOPCAA3.js";import"./chunk-UHEO47WY.js";import"./chunk-GG2QK5MA.js";import"./chunk-QHUROD77.js";import"./chunk-NXEOIP4Z.js";export{AttachmentAsset,AttachmentEntity,BoxEntity as Box,BoxEntity,ConeEntity as Cone,ConeEntity,CylinderEntity as Cylinder,CylinderEntity,Entity,Material,Model,ModelAsset,ModelEntity,PlaneEntity as Plane,PlaneEntity,Reality,SceneGraph,SphereEntity as Sphere,SphereEntity,Texture,UnlitMaterial,SceneGraph as World,eventMap,getSession,useAnimation,useEntityAnimation,useMetrics,withSpatialMonitor,withSpatialized2DElementContainer};
7
+ //# sourceMappingURL=spatial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,28 @@
1
+ import { CSSProperties } from 'react';
2
+ import { SpatializedMotionConfig as SpatializedMotionConfig$1, SpatializedMotionSegmentConfig as SpatializedMotionSegmentConfig$1, SpatializedPlaybackApi } from '@webspatial/core-sdk';
3
+ import { S as SpatializedMotionBinding } from './motionBindingTypes-CjxIC5bP.js';
4
+
5
+ /**
6
+ * React-facing motion config accepted by `useAnimation()`.
7
+ */
8
+ type SpatializedMotionConfig = SpatializedMotionConfig$1;
9
+ /** Convenience alias for the segment-style authoring shape. */
10
+ type SpatializedMotionSegmentConfig = SpatializedMotionSegmentConfig$1;
11
+ /**
12
+ * Tuple returned by `useAnimation()`.
13
+ */
14
+ type UseAnimationResult = readonly [
15
+ animation: SpatializedMotionBinding,
16
+ api: SpatializedPlaybackApi,
17
+ style: CSSProperties
18
+ ];
19
+ /**
20
+ * Creates the target-agnostic spatialized motion tuple used by React
21
+ * containers.
22
+ *
23
+ * @param config - The motion config to normalize and bind to a controller.
24
+ * @returns The opaque binding, playback api, and React style outlet.
25
+ */
26
+ declare function useAnimation(config: SpatializedMotionConfig): UseAnimationResult;
27
+
28
+ export { type SpatializedMotionConfig as S, type UseAnimationResult as U, type SpatializedMotionSegmentConfig as a, useAnimation as u };
@@ -0,0 +1,96 @@
1
+ import React__default from 'react';
2
+ import { k as EntityProps, m as EntityRefShape, E as EntityEventHandler } from './Reality-BDyKL6th.js';
3
+ import { SpatialBoxGeometryOptions, SpatialUnlitMaterialOptions, SpatialSphereGeometryOptions, SpatialConeGeometryOptions, SpatialCylinderGeometryOptions, SpatialPlaneGeometryOptions, PhysicalMetrics } from '@webspatial/core-sdk';
4
+
5
+ declare const Entity: React__default.ForwardRefExoticComponent<EntityProps & {
6
+ children?: React__default.ReactNode;
7
+ } & React__default.RefAttributes<EntityRefShape>>;
8
+
9
+ declare const BoxEntity: React__default.ForwardRefExoticComponent<EntityProps & {
10
+ children?: React__default.ReactNode;
11
+ materials?: string[];
12
+ } & SpatialBoxGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
13
+
14
+ type UnlitMaterialProps = {
15
+ children?: React__default.ReactNode;
16
+ id: string;
17
+ } & SpatialUnlitMaterialOptions;
18
+ declare const UnlitMaterial: React__default.FC<UnlitMaterialProps>;
19
+
20
+ type TextureProps = {
21
+ children?: React__default.ReactNode;
22
+ id: string;
23
+ url: string;
24
+ onLoad?: () => void;
25
+ onError?: (error: unknown) => void;
26
+ };
27
+ declare const Texture: React__default.FC<TextureProps>;
28
+
29
+ declare const SphereEntity: React__default.ForwardRefExoticComponent<EntityProps & {
30
+ children?: React__default.ReactNode;
31
+ materials?: string[];
32
+ } & SpatialSphereGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
33
+
34
+ declare const ConeEntity: React__default.ForwardRefExoticComponent<EntityProps & {
35
+ children?: React__default.ReactNode;
36
+ materials?: string[];
37
+ } & SpatialConeGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
38
+
39
+ declare const CylinderEntity: React__default.ForwardRefExoticComponent<EntityProps & {
40
+ children?: React__default.ReactNode;
41
+ materials?: string[];
42
+ } & SpatialCylinderGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
43
+
44
+ declare const PlaneEntity: React__default.ForwardRefExoticComponent<EntityProps & {
45
+ children?: React__default.ReactNode;
46
+ materials?: string[];
47
+ } & SpatialPlaneGeometryOptions & React__default.RefAttributes<EntityRefShape>>;
48
+
49
+ type Props$1 = {
50
+ children?: React__default.ReactNode;
51
+ };
52
+ declare const SceneGraph: React__default.FC<Props$1>;
53
+
54
+ type Props = {
55
+ children?: React__default.ReactNode;
56
+ id: string;
57
+ src: string;
58
+ onLoad?: () => void;
59
+ onError?: (error: unknown) => void;
60
+ };
61
+ declare const ModelAsset: React__default.FC<Props>;
62
+
63
+ declare const ModelEntity: React__default.ForwardRefExoticComponent<EntityProps & {
64
+ model: string;
65
+ materials?: string[];
66
+ } & EntityEventHandler & {
67
+ children?: React__default.ReactNode;
68
+ } & React__default.RefAttributes<EntityRefShape>>;
69
+
70
+ type AttachmentAssetProps = {
71
+ name: string;
72
+ children?: React__default.ReactNode;
73
+ };
74
+ declare const AttachmentAsset: React__default.FC<AttachmentAssetProps>;
75
+
76
+ type AttachmentEntityProps = {
77
+ attachment: string;
78
+ position?: [number, number, number];
79
+ size: {
80
+ width: number;
81
+ height: number;
82
+ };
83
+ };
84
+ declare const AttachmentEntity: React__default.FC<AttachmentEntityProps>;
85
+
86
+ type MaterialProps = {
87
+ type: 'unlit';
88
+ } & UnlitMaterialProps;
89
+ declare const Material: React__default.FC<MaterialProps>;
90
+
91
+ declare function useMetrics(): {
92
+ pointToPhysical: typeof PhysicalMetrics.pointToPhysical;
93
+ physicalToPoint: typeof PhysicalMetrics.physicalToPoint;
94
+ };
95
+
96
+ export { AttachmentAsset as A, BoxEntity as B, ConeEntity as C, Entity as E, Material as M, PlaneEntity as P, SceneGraph as S, Texture as T, UnlitMaterial as U, AttachmentEntity as a, CylinderEntity as b, ModelAsset as c, ModelEntity as d, SphereEntity as e, type MaterialProps as f, type TextureProps as g, type UnlitMaterialProps as h, useMetrics as u };
package/package.json CHANGED
@@ -1,32 +1,49 @@
1
1
  {
2
2
  "name": "@webspatial/react-sdk",
3
- "version": "1.6.1",
3
+ "version": "2.0.0",
4
4
  "description": "React components for WebSpatial",
5
- "main": "./dist/default/index.js",
5
+ "main": "./dist/index.js",
6
6
  "type": "module",
7
- "types": "./dist/default/index.d.ts",
7
+ "types": "./dist/index.d.ts",
8
+ "sideEffects": [
9
+ "./dist/index.js",
10
+ "./dist/eager.js",
11
+ "./dist/experimental.js",
12
+ "./dist/spatial.js",
13
+ "./src/eager.ts",
14
+ "./src/runtime/registerEagerEntry.ts",
15
+ "./src/spatial/index.ts"
16
+ ],
8
17
  "exports": {
9
- ".": "./dist/default/index.js",
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./eager": {
23
+ "types": "./dist/eager.d.ts",
24
+ "default": "./dist/eager.js"
25
+ },
26
+ "./experimental": {
27
+ "types": "./dist/experimental.d.ts",
28
+ "default": "./dist/experimental.js"
29
+ },
30
+ "./spatial": {
31
+ "types": "./dist/spatial.d.ts",
32
+ "default": "./dist/spatial.js"
33
+ },
10
34
  "./jsx-runtime": {
11
- "react-server": "./dist/jsx/jsx-runtime.web.js",
35
+ "types": "./dist/jsx/jsx-runtime.d.ts",
12
36
  "default": "./dist/jsx/jsx-runtime.js"
13
37
  },
14
38
  "./jsx-dev-runtime": {
15
- "react-server": "./dist/jsx/jsx-dev-runtime.web.js",
39
+ "types": "./dist/jsx/jsx-dev-runtime.d.ts",
16
40
  "default": "./dist/jsx/jsx-dev-runtime.js"
17
41
  },
18
- "./default": "./dist/default/index.js",
19
- "./default/jsx-dev-runtime": {
20
- "react-server": "./dist/jsx/jsx-dev-runtime.web.js",
21
- "default": "./dist/jsx/jsx-dev-runtime.js"
22
- },
23
- "./default/jsx-runtime": {
24
- "react-server": "./dist/jsx/jsx-runtime.web.js",
25
- "default": "./dist/jsx/jsx-runtime.js"
42
+ "./internal/facades-client": {
43
+ "types": "./dist/internal/facades-client.d.ts",
44
+ "default": "./dist/internal/facades-client.js"
26
45
  },
27
- "./web": "./dist/web/index.js",
28
- "./web/jsx-dev-runtime": "./dist/jsx/jsx-dev-runtime.web.js",
29
- "./web/jsx-runtime": "./dist/jsx/jsx-runtime.web.js"
46
+ "./package.json": "./package.json"
30
47
  },
31
48
  "files": [
32
49
  "dist"
@@ -42,47 +59,50 @@
42
59
  "url": "https://github.com/webspatial/webspatial-sdk/issues"
43
60
  },
44
61
  "homepage": "https://github.com/webspatial/webspatial-sdk#readme",
62
+ "dependencies": {
63
+ "@webspatial/core-sdk": "^2.0.0"
64
+ },
45
65
  "peerDependencies": {
46
- "@webspatial/core-sdk": "^1.5.0",
47
- "react": ">=18.0.0",
48
- "react-dom": ">=18.0.0"
66
+ "@webspatial/core-sdk": "^2.0.0",
67
+ "react": ">=18.0",
68
+ "react-dom": ">=18.0"
49
69
  },
50
70
  "peerDependenciesMeta": {
51
- "@webspatial/core-sdk": {
52
- "optional": false
53
- },
54
71
  "react": {
55
- "optional": true
72
+ "optional": false
56
73
  },
57
74
  "react-dom": {
58
- "optional": true
75
+ "optional": false
59
76
  }
60
77
  },
61
78
  "devDependencies": {
79
+ "@babel/parser": "^7.29.3",
80
+ "@babel/types": "^7.29.0",
62
81
  "@testing-library/jest-dom": "^6.4.8",
63
82
  "@testing-library/react": "^16.0.0",
64
83
  "@types/node": "^22.5.5",
65
84
  "@types/react": "^18.3.3",
66
85
  "@types/react-dom": "^18.3.0",
67
86
  "@types/unist": "^3.0.2",
68
- "@vitest/coverage-v8": "^2.0.4",
69
- "@vitejs/plugin-react": "^4.3.1",
70
- "react": "^18.2.0",
71
- "react-dom": "^18.2.0",
72
- "esbuild": "^0.23.1",
87
+ "@vitest/coverage-v8": "^4.1.8",
88
+ "@vitejs/plugin-react": "^4.4.1",
89
+ "esbuild": "^0.25.0",
73
90
  "esbuild-plugin-d.ts": "^1.3.1",
74
91
  "esbuild-plugin-define": "^0.5.0",
75
92
  "jsdom": "^24.1.1",
93
+ "react": "^18.2.0",
94
+ "react-dom": "^18.2.0",
76
95
  "tiny-glob": "^0.2.9",
77
96
  "tsup": "^8.4.0",
78
97
  "typedoc": "^0.26.5",
79
98
  "typedoc-plugin-markdown": "^4.2.2",
80
99
  "typescript": "^5.5.4",
81
- "vitest": "^2.0.4",
82
- "@webspatial/core-sdk": "1.6.1"
100
+ "vite": "6.4.2",
101
+ "vitest": "^4.1.8",
102
+ "@webspatial/core-sdk": "2.0.0"
83
103
  },
84
104
  "scripts": {
85
- "test": "tsc -p ./tsconfig.json && vitest run",
105
+ "test": "tsc -p ./tsconfig.json && tsup && vitest run",
86
106
  "dev": "tsup --watch",
87
107
  "build": "tsup",
88
108
  "start": "npm run dev",