@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
 
@@ -1502,6 +1502,7 @@ import {
1502
1502
  useMemo as useMemo4,
1503
1503
  useRef as useRef6
1504
1504
  } from "react";
1505
+ import { createPortal as createPortal2 } from "react-dom";
1505
1506
 
1506
1507
  // src/spatial-react-components/CSSSpatialDiv/useSpatialStyle.ts
1507
1508
  import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef5, useState as useState3 } from "react";
@@ -1714,7 +1715,7 @@ function useSpatialStyle() {
1714
1715
  );
1715
1716
  };
1716
1717
  }, []);
1717
- return { ref, ready, spatialStyle };
1718
+ return { ref, ready: true, spatialStyle };
1718
1719
  }
1719
1720
 
1720
1721
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialDebugNameContext.ts
@@ -1997,6 +1998,9 @@ var CSSSpatialRootContext = createContext8(null);
1997
1998
 
1998
1999
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialComponent.tsx
1999
2000
  import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
2001
+ var cssParserDivContainer = document.createElement("div");
2002
+ cssParserDivContainer.style.position = "absolute";
2003
+ document.body.appendChild(cssParserDivContainer);
2000
2004
  function renderRootCSSSpatialComponent(inProps, refIn) {
2001
2005
  const cssSpatialRootContextObject = useMemo4(
2002
2006
  () => new CSSSpatialRootContextObject(),
@@ -2030,6 +2034,19 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
2030
2034
  const El = inProps.component || "div";
2031
2035
  const spatialDivRef = useHijackSpatialDivRef(refIn, ref);
2032
2036
  const divRefClassName = className + " " + InjectClassName;
2037
+ const cssParserDom = createPortal2(
2038
+ /* @__PURE__ */ jsx7(
2039
+ El,
2040
+ {
2041
+ style: divRefStyle,
2042
+ className: divRefClassName,
2043
+ ...props,
2044
+ ref,
2045
+ "data-cssparser": true
2046
+ }
2047
+ ),
2048
+ cssParserDivContainer
2049
+ );
2033
2050
  return /* @__PURE__ */ jsxs3(CSSSpatialRootContext.Provider, { value: cssSpatialRootContextObject, children: [
2034
2051
  ready && /* @__PURE__ */ jsx7(
2035
2052
  SpatialReactComponent,
@@ -2044,16 +2061,7 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
2044
2061
  ref: spatialDivRef
2045
2062
  }
2046
2063
  ),
2047
- /* @__PURE__ */ jsx7(
2048
- El,
2049
- {
2050
- style: divRefStyle,
2051
- className: divRefClassName,
2052
- ...props,
2053
- ref,
2054
- "data-cssparser": true
2055
- }
2056
- )
2064
+ cssParserDom
2057
2065
  ] });
2058
2066
  }
2059
2067
  function renderInWebEnv(props, ref) {
@@ -2110,6 +2118,10 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
2110
2118
  useEffect7(() => {
2111
2119
  cssSpatialRootContextObject.setCSSParserRef(cssSpatialID, ref.current);
2112
2120
  }, [ref.current]);
2121
+ const cssParserDom = createPortal2(
2122
+ /* @__PURE__ */ jsx7(El, { style: divRefStyle, className: divRefClassName, ...props, ref }),
2123
+ cssParserDivContainer
2124
+ );
2113
2125
  return /* @__PURE__ */ jsxs3(Fragment, { children: [
2114
2126
  ready && /* @__PURE__ */ jsx7(
2115
2127
  SpatialReactComponent,
@@ -2123,15 +2135,7 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
2123
2135
  debugShowStandardInstance
2124
2136
  }
2125
2137
  ),
2126
- /* @__PURE__ */ jsx7(
2127
- El,
2128
- {
2129
- style: divRefStyle,
2130
- className: divRefClassName,
2131
- ...props,
2132
- ref
2133
- }
2134
- )
2138
+ cssParserDom
2135
2139
  ] });
2136
2140
  }
2137
2141
  function CSSSpatialComponentBase(inProps, ref) {
@@ -3811,7 +3815,7 @@ function spatialPolyfill() {
3811
3815
  }
3812
3816
 
3813
3817
  // src/index.ts
3814
- var version = "1.0.3";
3818
+ var version = "1.0.4";
3815
3819
  export {
3816
3820
  CSSSpatialDiv,
3817
3821
  CSSSpatialPrimitive,