@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.
- package/dist/default/index.js +50 -30
- package/dist/default/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js +1 -1
- package/dist/jsx/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx/jsx-runtime.js +1 -1
- package/dist/jsx/jsx-runtime.web.js +1 -1
- package/dist/web/index.js +50 -30
- package/dist/web/index.js.map +1 -1
- package/package.json +2 -2
package/dist/default/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.
|
|
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(),
|
|
@@ -2013,8 +2017,12 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
|
|
|
2013
2017
|
const { ref, spatialStyle, ready } = useSpatialStyle();
|
|
2014
2018
|
const divRefStyle = {
|
|
2015
2019
|
...style,
|
|
2016
|
-
width: 0,
|
|
2017
|
-
height: 0,
|
|
2020
|
+
// width: 0,
|
|
2021
|
+
// height: 0,
|
|
2022
|
+
left: -1e4,
|
|
2023
|
+
top: -1e4,
|
|
2024
|
+
opacity: 0,
|
|
2025
|
+
pointerEvents: "none",
|
|
2018
2026
|
padding: 0,
|
|
2019
2027
|
transition: "none",
|
|
2020
2028
|
position: "absolute"
|
|
@@ -2026,6 +2034,19 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
|
|
|
2026
2034
|
const El = inProps.component || "div";
|
|
2027
2035
|
const spatialDivRef = useHijackSpatialDivRef(refIn, ref);
|
|
2028
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
|
+
);
|
|
2029
2050
|
return /* @__PURE__ */ jsxs3(CSSSpatialRootContext.Provider, { value: cssSpatialRootContextObject, children: [
|
|
2030
2051
|
ready && /* @__PURE__ */ jsx7(
|
|
2031
2052
|
SpatialReactComponent,
|
|
@@ -2040,16 +2061,7 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
|
|
|
2040
2061
|
ref: spatialDivRef
|
|
2041
2062
|
}
|
|
2042
2063
|
),
|
|
2043
|
-
|
|
2044
|
-
El,
|
|
2045
|
-
{
|
|
2046
|
-
style: divRefStyle,
|
|
2047
|
-
className: divRefClassName,
|
|
2048
|
-
...props,
|
|
2049
|
-
ref,
|
|
2050
|
-
"data-cssparser": true
|
|
2051
|
-
}
|
|
2052
|
-
)
|
|
2064
|
+
cssParserDom
|
|
2053
2065
|
] });
|
|
2054
2066
|
}
|
|
2055
2067
|
function renderInWebEnv(props, ref) {
|
|
@@ -2087,8 +2099,12 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
|
|
|
2087
2099
|
const { ref, spatialStyle, ready } = useSpatialStyle();
|
|
2088
2100
|
const divRefStyle = {
|
|
2089
2101
|
...style,
|
|
2090
|
-
width: 0,
|
|
2091
|
-
height: 0,
|
|
2102
|
+
// width: 0,
|
|
2103
|
+
// height: 0,
|
|
2104
|
+
left: -1e4,
|
|
2105
|
+
top: -1e4,
|
|
2106
|
+
opacity: 0,
|
|
2107
|
+
pointerEvents: "none",
|
|
2092
2108
|
padding: 0,
|
|
2093
2109
|
transition: "none",
|
|
2094
2110
|
position: "absolute"
|
|
@@ -2102,6 +2118,10 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
|
|
|
2102
2118
|
useEffect7(() => {
|
|
2103
2119
|
cssSpatialRootContextObject.setCSSParserRef(cssSpatialID, ref.current);
|
|
2104
2120
|
}, [ref.current]);
|
|
2121
|
+
const cssParserDom = createPortal2(
|
|
2122
|
+
/* @__PURE__ */ jsx7(El, { style: divRefStyle, className: divRefClassName, ...props, ref }),
|
|
2123
|
+
cssParserDivContainer
|
|
2124
|
+
);
|
|
2105
2125
|
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
2106
2126
|
ready && /* @__PURE__ */ jsx7(
|
|
2107
2127
|
SpatialReactComponent,
|
|
@@ -2115,15 +2135,7 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
|
|
|
2115
2135
|
debugShowStandardInstance
|
|
2116
2136
|
}
|
|
2117
2137
|
),
|
|
2118
|
-
|
|
2119
|
-
El,
|
|
2120
|
-
{
|
|
2121
|
-
style: divRefStyle,
|
|
2122
|
-
className: divRefClassName,
|
|
2123
|
-
...props,
|
|
2124
|
-
ref
|
|
2125
|
-
}
|
|
2126
|
-
)
|
|
2138
|
+
cssParserDom
|
|
2127
2139
|
] });
|
|
2128
2140
|
}
|
|
2129
2141
|
function CSSSpatialComponentBase(inProps, ref) {
|
|
@@ -3242,8 +3254,12 @@ function renderCSSModel3DNotInSpatialDiv(inProps, refIn) {
|
|
|
3242
3254
|
const { className, style = {}, ...props } = inProps;
|
|
3243
3255
|
const cssParserDomStyle = {
|
|
3244
3256
|
...style,
|
|
3245
|
-
width: 0,
|
|
3246
|
-
height: 0,
|
|
3257
|
+
// width: 0,
|
|
3258
|
+
// height: 0,
|
|
3259
|
+
left: -1e4,
|
|
3260
|
+
top: -1e4,
|
|
3261
|
+
opacity: 0,
|
|
3262
|
+
pointerEvents: "none",
|
|
3247
3263
|
padding: 0,
|
|
3248
3264
|
position: "absolute"
|
|
3249
3265
|
};
|
|
@@ -3331,8 +3347,12 @@ function renderCSSModel3DPortalInstance(spatialId, inProps) {
|
|
|
3331
3347
|
}, [ref.current]);
|
|
3332
3348
|
const cssParserDomStyle = {
|
|
3333
3349
|
...style,
|
|
3334
|
-
width: 0,
|
|
3335
|
-
height: 0,
|
|
3350
|
+
// width: 0,
|
|
3351
|
+
// height: 0,
|
|
3352
|
+
left: -1e4,
|
|
3353
|
+
top: -1e4,
|
|
3354
|
+
opacity: 0,
|
|
3355
|
+
pointerEvents: "none",
|
|
3336
3356
|
padding: 0,
|
|
3337
3357
|
position: "absolute"
|
|
3338
3358
|
};
|
|
@@ -3795,7 +3815,7 @@ function spatialPolyfill() {
|
|
|
3795
3815
|
}
|
|
3796
3816
|
|
|
3797
3817
|
// src/index.ts
|
|
3798
|
-
var version = "1.0.
|
|
3818
|
+
var version = "1.0.4";
|
|
3799
3819
|
export {
|
|
3800
3820
|
CSSSpatialDiv,
|
|
3801
3821
|
CSSSpatialPrimitive,
|