@webspatial/react-sdk 1.6.1 → 1.7.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,7 +1,7 @@
1
1
  export { Fragment } from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { JSXSource } from 'react/jsx-dev-runtime';
4
- import { SpatialTapEvent, SpatialDragStartEvent, SpatialDragEvent, SpatialDragEndEvent, SpatialRotateEvent, SpatialRotateEndEvent, SpatialMagnifyEvent, SpatialMagnifyEndEvent, SpatialEventOptions } from '@webspatial/react-sdk';
4
+ import { SpatialTapEvent, SpatialDragStartEvent, SpatialDragEvent, SpatialDragEndEvent, SpatialRotateEvent, SpatialRotateEndEvent, SpatialMagnifyEvent, SpatialMagnifyEndEvent, SpatialEventOptions, SpatialContentReadyCallback } from '@webspatial/react-sdk';
5
5
 
6
6
  declare function jsxs(type: React.ElementType, props: unknown, key?: React.Key): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
7
7
  declare function jsx(type: React.ElementType, props: unknown, key?: React.Key): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
@@ -27,35 +27,39 @@ type ReactJSXIntrinsicElements = true extends IsPreReact19 ? JSX.IntrinsicElemen
27
27
  /** @ts-ignore */
28
28
  type ReactJSXElementType = true extends IsPreReact19 ? string | React.JSXElementConstructor<any> : React.JSX.ElementType;
29
29
  declare namespace WebSpatialJSX {
30
- type ElementType = ReactJSXElementType;
31
- interface Element extends ReactJSXElement {
30
+ export type ElementType = ReactJSXElementType;
31
+ export interface Element extends ReactJSXElement {
32
32
  }
33
- interface ElementClass extends ReactJSXElementClass {
33
+ export interface ElementClass extends ReactJSXElementClass {
34
34
  }
35
- interface ElementAttributesProperty extends ReactJSXElementAttributesProperty {
35
+ export interface ElementAttributesProperty extends ReactJSXElementAttributesProperty {
36
36
  }
37
- interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {
37
+ export interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {
38
38
  }
39
- type LibraryManagedAttributes<C, P> = ReactJSXLibraryManagedAttributes<C, P>;
40
- interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {
39
+ export type LibraryManagedAttributes<C, P> = ReactJSXLibraryManagedAttributes<C, P>;
40
+ export interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {
41
41
  }
42
- interface IntrinsicClassAttributes<T> extends ReactJSXIntrinsicClassAttributes<T> {
42
+ export interface IntrinsicClassAttributes<T> extends ReactJSXIntrinsicClassAttributes<T> {
43
43
  }
44
- type IntrinsicElements = {
45
- [K in keyof ReactJSXIntrinsicElements]: ReactJSXIntrinsicElements[K] & {
46
- style?: React.CSSProperties;
47
- 'enable-xr'?: boolean;
48
- onSpatialTap?: (e: SpatialTapEvent) => void;
49
- onSpatialDragStart?: (e: SpatialDragStartEvent) => void;
50
- onSpatialDrag?: (e: SpatialDragEvent) => void;
51
- onSpatialDragEnd?: (e: SpatialDragEndEvent) => void;
52
- onSpatialRotate?: (e: SpatialRotateEvent) => void;
53
- onSpatialRotateEnd?: (e: SpatialRotateEndEvent) => void;
54
- onSpatialMagnify?: (e: SpatialMagnifyEvent) => void;
55
- onSpatialMagnifyEnd?: (e: SpatialMagnifyEndEvent) => void;
56
- spatialEventOptions?: SpatialEventOptions;
57
- };
44
+ type BaseSpatialIntrinsic = {
45
+ style?: React.CSSProperties;
46
+ 'enable-xr'?: boolean;
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;
58
56
  };
57
+ export type IntrinsicElements = {
58
+ [K in keyof ReactJSXIntrinsicElements]: ReactJSXIntrinsicElements[K] & BaseSpatialIntrinsic & (K extends 'div' ? {
59
+ onSpatialContentReady?: SpatialContentReadyCallback;
60
+ } : {});
61
+ };
62
+ export { };
59
63
  }
60
64
  declare module 'react' {
61
65
  interface CSSProperties {
@@ -2,7 +2,7 @@
2
2
  (function(){
3
3
  if(typeof window === 'undefined') return;
4
4
  if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
5
- window.__webspatialsdk__['react-sdk-version'] = "1.6.1"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.7.0"
6
6
  window.__webspatialsdk__['XR_ENV'] = "avp"
7
7
  })()
8
8
 
@@ -17,14 +17,15 @@ import { createElement as reactCreateElement } from "react";
17
17
  import {
18
18
  withSpatialMonitor,
19
19
  withSpatialized2DElementContainer,
20
- Model
20
+ Model,
21
+ Reality
21
22
  } from "@webspatial/react-sdk";
22
23
  var attributeFlag = "enable-xr";
23
24
  var styleFlag = "enableXr";
24
25
  var classFlag = "__enableXr__";
25
26
  var xrMonitorFlag = "enable-xr-monitor";
26
27
  function replaceToSpatialPrimitiveType(type, props) {
27
- if (type === Model) {
28
+ if (type === Model || type === Reality) {
28
29
  return type;
29
30
  }
30
31
  const propsObject = props;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-shared.ts"],"sourcesContent":["export { Fragment } from 'react/jsx-runtime'\nexport { jsxDEV, jsx } 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;AAOO,SAAS,IAAI,MAAyB,OAAgB,KAAiB;AAC5E,SAAO,8BAA8B,MAAM,KAAK;AAChD,SAAO,gBAAgB,IAAI,MAAM,OAAO,GAAG;AAC7C;AAEO,SAAS,OACd,MACA,OACA,KACA,UACA,QACA,MACA;AACA,SAAO,8BAA8B,MAAM,KAAK;AAChD,SAAO,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,IAAI;AACzD;","names":[]}
1
+ {"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-shared.ts"],"sourcesContent":["export { Fragment } from 'react/jsx-runtime'\nexport { jsxDEV, jsx } 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 Reality,\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 || type === Reality) {\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,EACA;AAAA,OAEK;AACP,IAAM,gBAAgB;AACtB,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,gBAAgB;AAEf,SAAS,8BACd,MACA,OACA;AACA,MAAI,SAAS,SAAS,SAAS,SAAS;AACtC,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;AAOO,SAAS,IAAI,MAAyB,OAAgB,KAAiB;AAC5E,SAAO,8BAA8B,MAAM,KAAK;AAChD,SAAO,gBAAgB,IAAI,MAAM,OAAO,GAAG;AAC7C;AAEO,SAAS,OACd,MACA,OACA,KACA,UACA,QACA,MACA;AACA,SAAO,8BAA8B,MAAM,KAAK;AAChD,SAAO,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,IAAI;AACzD;","names":[]}
@@ -2,7 +2,7 @@
2
2
  (function(){
3
3
  if(typeof window === 'undefined') return;
4
4
  if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
5
- window.__webspatialsdk__['react-sdk-version'] = "1.6.1"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.7.0"
6
6
  window.__webspatialsdk__['XR_ENV'] = "web"
7
7
  })()
8
8
 
@@ -2,7 +2,7 @@
2
2
  (function(){
3
3
  if(typeof window === 'undefined') return;
4
4
  if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
5
- window.__webspatialsdk__['react-sdk-version'] = "1.6.1"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.7.0"
6
6
  window.__webspatialsdk__['XR_ENV'] = "avp"
7
7
  })()
8
8
 
@@ -17,14 +17,15 @@ import { createElement as reactCreateElement } from "react";
17
17
  import {
18
18
  withSpatialMonitor,
19
19
  withSpatialized2DElementContainer,
20
- Model
20
+ Model,
21
+ Reality
21
22
  } from "@webspatial/react-sdk";
22
23
  var attributeFlag = "enable-xr";
23
24
  var styleFlag = "enableXr";
24
25
  var classFlag = "__enableXr__";
25
26
  var xrMonitorFlag = "enable-xr-monitor";
26
27
  function replaceToSpatialPrimitiveType(type, props) {
27
- if (type === Model) {
28
+ if (type === Model || type === Reality) {
28
29
  return type;
29
30
  }
30
31
  const propsObject = props;
@@ -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","../../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 Reality,\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 || type === Reality) {\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,EACA;AAAA,OAEK;AACP,IAAM,gBAAgB;AACtB,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,gBAAgB;AAEf,SAAS,8BACd,MACA,OACA;AACA,MAAI,SAAS,SAAS,SAAS,SAAS;AACtC,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":[]}
@@ -2,7 +2,7 @@
2
2
  (function(){
3
3
  if(typeof window === 'undefined') return;
4
4
  if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
5
- window.__webspatialsdk__['react-sdk-version'] = "1.6.1"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.7.0"
6
6
  window.__webspatialsdk__['XR_ENV'] = "web"
7
7
  })()
8
8
 
@@ -1,18 +1,39 @@
1
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, Vec3, SpatialObject, SpatialSession, SpatializedDynamic3DElement, SpatialEntity, Quaternion, SpatialBoxGeometryOptions, SpatialUnlitMaterialOptions, SpatialSphereGeometryOptions, SpatialConeGeometryOptions, SpatialCylinderGeometryOptions, SpatialPlaneGeometryOptions, PhysicalMetrics } from '@webspatial/core-sdk';
3
- export { Point3D, Vec3 } 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
4
  import * as React$1 from 'react';
5
5
  import React__default, { ElementType, ForwardedRef, createElement as createElement$1 } from 'react';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
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
+
8
16
  declare function enableDebugTool(): void;
9
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
+
10
26
  declare function initScene(name: string, callback: (pre: SpatialSceneCreationOptions) => SpatialSceneCreationOptions, options?: {
11
27
  type: SpatialSceneType;
12
28
  }): void | undefined;
13
29
 
14
30
  declare const SpatialID = "data-spatial-id";
15
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);
16
37
  /** Options for spatial pointer/gesture behavior (not DOM attributes). */
17
38
  type SpatialEventOptions = {
18
39
  /**
@@ -45,15 +66,23 @@ type PortalSpatializedContainerProps<T extends SpatializedElementRef> = SpatialE
45
66
  };
46
67
  type SpatializedContainerProps<T extends SpatializedElementRef> = Omit<StandardSpatializedContainerProps & PortalSpatializedContainerProps<T>, typeof SpatialID | 'onLoad' | 'onError'> & {
47
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;
48
74
  };
49
75
  type Spatialized2DElementContainerProps<P extends ElementType> = SpatialEventProps<SpatializedElementRef> & React__default.ComponentPropsWithRef<'div'> & {
50
76
  component: P;
51
77
  spatialEventOptions?: SpatialEventOptions;
78
+ onSpatialContentReady?: SpatialContentReadyCallback;
52
79
  };
53
80
  type SpatializedStatic3DContainerProps = SpatialEventProps<SpatializedStatic3DElementRef> & Omit<React__default.ComponentPropsWithoutRef<'div'>, 'onLoad' | 'onError'> & {
54
81
  src?: string;
82
+ poster?: string;
55
83
  autoPlay?: boolean;
56
84
  loop?: boolean;
85
+ loading?: ModelLoadingMode;
57
86
  children?: React__default.ReactNode;
58
87
  onLoad?: (event: ModelLoadEvent) => void;
59
88
  onError?: (event: ModelLoadEvent) => void;
@@ -70,6 +99,7 @@ type SpatializedStatic3DElementRef = SpatializedDivElementRef & {
70
99
  readonly paused: boolean;
71
100
  readonly duration: number;
72
101
  playbackRate: number;
102
+ currentTime: number;
73
103
  };
74
104
  type CurrentTarget<T extends SpatializedElementRef> = {
75
105
  currentTarget: T;
@@ -135,8 +165,10 @@ declare const SpatializedStatic3DElementContainer: React$1.ForwardRefExoticCompo
135
165
  onSpatialMagnifyEnd?: ((event: SpatialMagnifyEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
136
166
  } & Omit<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onLoad" | "onError"> & {
137
167
  src?: string;
168
+ poster?: string;
138
169
  autoPlay?: boolean;
139
170
  loop?: boolean;
171
+ loading?: ModelLoadingMode;
140
172
  children?: React.ReactNode;
141
173
  onLoad?: (event: ModelLoadEvent) => void;
142
174
  onError?: (event: ModelLoadEvent) => void;
@@ -154,12 +186,36 @@ type SpatialMonitorProps = {
154
186
  };
155
187
  declare const SpatialMonitor: React$1.ForwardRefExoticComponent<SpatialMonitorProps & React$1.RefAttributes<HTMLElement>>;
156
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
+ */
157
206
  declare class ResourceRegistry {
207
+ /** Every id maps to a promise — either the real resource from add(), or a placeholder until then. */
158
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;
159
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>;
160
217
  remove(id: string): void;
161
218
  removeAndDestroy(id: string): void;
162
- get<T extends SpatialObject>(id: string): Promise<T>;
163
219
  destroy(): void;
164
220
  }
165
221
 
@@ -288,6 +344,15 @@ type UnlitMaterialProps = {
288
344
  } & SpatialUnlitMaterialOptions;
289
345
  declare const UnlitMaterial: React__default.FC<UnlitMaterialProps>;
290
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
+
291
356
  declare const SphereEntity: React__default.ForwardRefExoticComponent<EntityProps & {
292
357
  children?: React__default.ReactNode;
293
358
  materials?: string[];
@@ -318,7 +383,7 @@ type Props = {
318
383
  id: string;
319
384
  src: string;
320
385
  onLoad?: () => void;
321
- onError?: (error: any) => void;
386
+ onError?: (error: unknown) => void;
322
387
  };
323
388
  declare const ModelAsset: React__default.FC<Props>;
324
389
 
@@ -329,7 +394,7 @@ declare const ModelEntity: React__default.ForwardRefExoticComponent<EntityProps
329
394
  children?: React__default.ReactNode;
330
395
  } & React__default.RefAttributes<EntityRefShape>>;
331
396
 
332
- type RealityProps = React__default.ComponentPropsWithRef<'div'> & EntityEventHandler;
397
+ type RealityProps = Omit<React__default.ComponentPropsWithRef<'div'>, 'onSpatialContentReady'> & EntityEventHandler;
333
398
  declare const Reality: React__default.ForwardRefExoticComponent<Omit<RealityProps, "ref"> & React__default.RefAttributes<HTMLElement>>;
334
399
 
335
400
  type AttachmentAssetProps = {
@@ -368,8 +433,10 @@ declare const Model: React$1.ForwardRefExoticComponent<Omit<{
368
433
  onSpatialMagnifyEnd?: ((event: SpatialMagnifyEndEvent<SpatializedStatic3DElementRef>) => void) | undefined;
369
434
  } & Omit<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onLoad" | "onError"> & {
370
435
  src?: string;
436
+ poster?: string;
371
437
  autoPlay?: boolean;
372
438
  loop?: boolean;
439
+ loading?: _webspatial_core_sdk.ModelLoadingMode;
373
440
  children?: React.ReactNode;
374
441
  onLoad?: (event: ModelLoadEvent) => void;
375
442
  onError?: (event: ModelLoadEvent) => void;
@@ -405,4 +472,4 @@ declare function convertCoordinate(position: Vec3, { from, to }: {
405
472
 
406
473
  declare const version: string;
407
474
 
408
- 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 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, UnlitMaterial, type UnlitMaterialProps, SceneGraph as World, convertCoordinate, createElement, enableDebugTool, eventMap, initPolyfill, initScene, useMetrics, version, withSpatialMonitor, withSpatialized2DElementContainer };
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 };