@webspatial/react-sdk 1.0.2 → 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.2"
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.2"
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.2"
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.2"
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.2"
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(),
@@ -2045,8 +2049,12 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
2045
2049
  const { ref, spatialStyle, ready } = useSpatialStyle();
2046
2050
  const divRefStyle = {
2047
2051
  ...style,
2048
- width: 0,
2049
- height: 0,
2052
+ // width: 0,
2053
+ // height: 0,
2054
+ left: -1e4,
2055
+ top: -1e4,
2056
+ opacity: 0,
2057
+ pointerEvents: "none",
2050
2058
  padding: 0,
2051
2059
  transition: "none",
2052
2060
  position: "absolute"
@@ -2058,6 +2066,19 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
2058
2066
  const El = inProps.component || "div";
2059
2067
  const spatialDivRef = useHijackSpatialDivRef(refIn, ref);
2060
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
+ );
2061
2082
  return /* @__PURE__ */ jsxs3(CSSSpatialRootContext.Provider, { value: cssSpatialRootContextObject, children: [
2062
2083
  ready && /* @__PURE__ */ jsx7(
2063
2084
  SpatialReactComponent,
@@ -2072,16 +2093,7 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
2072
2093
  ref: spatialDivRef
2073
2094
  }
2074
2095
  ),
2075
- /* @__PURE__ */ jsx7(
2076
- El,
2077
- {
2078
- style: divRefStyle,
2079
- className: divRefClassName,
2080
- ...props,
2081
- ref,
2082
- "data-cssparser": true
2083
- }
2084
- )
2096
+ cssParserDom
2085
2097
  ] });
2086
2098
  }
2087
2099
  function renderInWebEnv(props, ref) {
@@ -2119,8 +2131,12 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
2119
2131
  const { ref, spatialStyle, ready } = useSpatialStyle();
2120
2132
  const divRefStyle = {
2121
2133
  ...style,
2122
- width: 0,
2123
- height: 0,
2134
+ // width: 0,
2135
+ // height: 0,
2136
+ left: -1e4,
2137
+ top: -1e4,
2138
+ opacity: 0,
2139
+ pointerEvents: "none",
2124
2140
  padding: 0,
2125
2141
  transition: "none",
2126
2142
  position: "absolute"
@@ -2134,6 +2150,10 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
2134
2150
  useEffect7(() => {
2135
2151
  cssSpatialRootContextObject.setCSSParserRef(cssSpatialID, ref.current);
2136
2152
  }, [ref.current]);
2153
+ const cssParserDom = createPortal2(
2154
+ /* @__PURE__ */ jsx7(El, { style: divRefStyle, className: divRefClassName, ...props, ref }),
2155
+ cssParserDivContainer
2156
+ );
2137
2157
  return /* @__PURE__ */ jsxs3(Fragment, { children: [
2138
2158
  ready && /* @__PURE__ */ jsx7(
2139
2159
  SpatialReactComponent,
@@ -2147,15 +2167,7 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
2147
2167
  debugShowStandardInstance
2148
2168
  }
2149
2169
  ),
2150
- /* @__PURE__ */ jsx7(
2151
- El,
2152
- {
2153
- style: divRefStyle,
2154
- className: divRefClassName,
2155
- ...props,
2156
- ref
2157
- }
2158
- )
2170
+ cssParserDom
2159
2171
  ] });
2160
2172
  }
2161
2173
  function CSSSpatialComponentBase(inProps, ref) {
@@ -3273,8 +3285,12 @@ function renderCSSModel3DNotInSpatialDiv(inProps, refIn) {
3273
3285
  const { className, style = {}, ...props } = inProps;
3274
3286
  const cssParserDomStyle = {
3275
3287
  ...style,
3276
- width: 0,
3277
- height: 0,
3288
+ // width: 0,
3289
+ // height: 0,
3290
+ left: -1e4,
3291
+ top: -1e4,
3292
+ opacity: 0,
3293
+ pointerEvents: "none",
3278
3294
  padding: 0,
3279
3295
  position: "absolute"
3280
3296
  };
@@ -3362,8 +3378,12 @@ function renderCSSModel3DPortalInstance(spatialId, inProps) {
3362
3378
  }, [ref.current]);
3363
3379
  const cssParserDomStyle = {
3364
3380
  ...style,
3365
- width: 0,
3366
- height: 0,
3381
+ // width: 0,
3382
+ // height: 0,
3383
+ left: -1e4,
3384
+ top: -1e4,
3385
+ opacity: 0,
3386
+ pointerEvents: "none",
3367
3387
  padding: 0,
3368
3388
  position: "absolute"
3369
3389
  };
@@ -3826,7 +3846,7 @@ function spatialPolyfill() {
3826
3846
  }
3827
3847
 
3828
3848
  // src/index.ts
3829
- var version = "1.0.2";
3849
+ var version = "1.0.4";
3830
3850
  export {
3831
3851
  CSSSpatialDiv,
3832
3852
  CSSSpatialPrimitive,