@webspatial/react-sdk 1.0.3 → 1.0.4

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.
@@ -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.0.3"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.0.4"
6
6
  window.__webspatialsdk__['XR_ENV'] = "avp"
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.0.3"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.0.4"
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.0.3"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.0.4"
6
6
  window.__webspatialsdk__['XR_ENV'] = "avp"
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.0.3"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.0.4"
6
6
  window.__webspatialsdk__['XR_ENV'] = "web"
7
7
  })()
8
8
 
package/dist/web/index.js CHANGED
@@ -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.0.3"
5
+ window.__webspatialsdk__['react-sdk-version'] = "1.0.4"
6
6
  window.__webspatialsdk__['XR_ENV'] = "web"
7
7
  })()
8
8
 
@@ -1534,6 +1534,7 @@ import {
1534
1534
  useMemo as useMemo4,
1535
1535
  useRef as useRef6
1536
1536
  } from "react";
1537
+ import { createPortal as createPortal2 } from "react-dom";
1537
1538
 
1538
1539
  // src/spatial-react-components/CSSSpatialDiv/useSpatialStyle.ts
1539
1540
  import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef5, useState as useState3 } from "react";
@@ -1746,7 +1747,7 @@ function useSpatialStyle() {
1746
1747
  );
1747
1748
  };
1748
1749
  }, []);
1749
- return { ref, ready, spatialStyle };
1750
+ return { ref, ready: true, spatialStyle };
1750
1751
  }
1751
1752
 
1752
1753
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialDebugNameContext.ts
@@ -2029,6 +2030,9 @@ var CSSSpatialRootContext = createContext8(null);
2029
2030
 
2030
2031
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialComponent.tsx
2031
2032
  import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
2033
+ var cssParserDivContainer = document.createElement("div");
2034
+ cssParserDivContainer.style.position = "absolute";
2035
+ document.body.appendChild(cssParserDivContainer);
2032
2036
  function renderRootCSSSpatialComponent(inProps, refIn) {
2033
2037
  const cssSpatialRootContextObject = useMemo4(
2034
2038
  () => new CSSSpatialRootContextObject(),
@@ -2062,6 +2066,19 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
2062
2066
  const El = inProps.component || "div";
2063
2067
  const spatialDivRef = useHijackSpatialDivRef(refIn, ref);
2064
2068
  const divRefClassName = className + " " + InjectClassName;
2069
+ const cssParserDom = createPortal2(
2070
+ /* @__PURE__ */ jsx7(
2071
+ El,
2072
+ {
2073
+ style: divRefStyle,
2074
+ className: divRefClassName,
2075
+ ...props,
2076
+ ref,
2077
+ "data-cssparser": true
2078
+ }
2079
+ ),
2080
+ cssParserDivContainer
2081
+ );
2065
2082
  return /* @__PURE__ */ jsxs3(CSSSpatialRootContext.Provider, { value: cssSpatialRootContextObject, children: [
2066
2083
  ready && /* @__PURE__ */ jsx7(
2067
2084
  SpatialReactComponent,
@@ -2076,16 +2093,7 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
2076
2093
  ref: spatialDivRef
2077
2094
  }
2078
2095
  ),
2079
- /* @__PURE__ */ jsx7(
2080
- El,
2081
- {
2082
- style: divRefStyle,
2083
- className: divRefClassName,
2084
- ...props,
2085
- ref,
2086
- "data-cssparser": true
2087
- }
2088
- )
2096
+ cssParserDom
2089
2097
  ] });
2090
2098
  }
2091
2099
  function renderInWebEnv(props, ref) {
@@ -2142,6 +2150,10 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
2142
2150
  useEffect7(() => {
2143
2151
  cssSpatialRootContextObject.setCSSParserRef(cssSpatialID, ref.current);
2144
2152
  }, [ref.current]);
2153
+ const cssParserDom = createPortal2(
2154
+ /* @__PURE__ */ jsx7(El, { style: divRefStyle, className: divRefClassName, ...props, ref }),
2155
+ cssParserDivContainer
2156
+ );
2145
2157
  return /* @__PURE__ */ jsxs3(Fragment, { children: [
2146
2158
  ready && /* @__PURE__ */ jsx7(
2147
2159
  SpatialReactComponent,
@@ -2155,15 +2167,7 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
2155
2167
  debugShowStandardInstance
2156
2168
  }
2157
2169
  ),
2158
- /* @__PURE__ */ jsx7(
2159
- El,
2160
- {
2161
- style: divRefStyle,
2162
- className: divRefClassName,
2163
- ...props,
2164
- ref
2165
- }
2166
- )
2170
+ cssParserDom
2167
2171
  ] });
2168
2172
  }
2169
2173
  function CSSSpatialComponentBase(inProps, ref) {
@@ -3842,7 +3846,7 @@ function spatialPolyfill() {
3842
3846
  }
3843
3847
 
3844
3848
  // src/index.ts
3845
- var version = "1.0.3";
3849
+ var version = "1.0.4";
3846
3850
  export {
3847
3851
  CSSSpatialDiv,
3848
3852
  CSSSpatialPrimitive,