@webspatial/react-sdk 0.1.16 → 0.1.17
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/README.md +16 -0
- package/dist/default/index.d.ts +1 -0
- package/dist/default/index.js +17 -12
- package/dist/default/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.d.ts +2 -0
- 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.d.ts +1 -0
- package/dist/web/index.js +17 -12
- package/dist/web/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -53,6 +53,7 @@ declare module 'react' {
|
|
|
53
53
|
'--xr-background-material'?: string;
|
|
54
54
|
'--xr-back'?: number | string;
|
|
55
55
|
'--xr-z-index'?: number | string;
|
|
56
|
+
enableXr?: boolean;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
declare global {
|
|
@@ -66,6 +67,7 @@ declare global {
|
|
|
66
67
|
'--xr-background-material'?: string;
|
|
67
68
|
'--xr-back'?: number | string;
|
|
68
69
|
'--xr-z-index'?: number | string;
|
|
70
|
+
enableXr?: boolean;
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -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'] = "0.1.
|
|
5
|
+
window.__webspatialsdk__['react-sdk-version'] = "0.1.17"
|
|
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'] = "0.1.
|
|
5
|
+
window.__webspatialsdk__['react-sdk-version'] = "0.1.17"
|
|
6
6
|
window.__webspatialsdk__['XR_ENV'] = "web"
|
|
7
7
|
})()
|
|
8
8
|
|
package/dist/jsx/jsx-runtime.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'] = "0.1.
|
|
5
|
+
window.__webspatialsdk__['react-sdk-version'] = "0.1.17"
|
|
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'] = "0.1.
|
|
5
|
+
window.__webspatialsdk__['react-sdk-version'] = "0.1.17"
|
|
6
6
|
window.__webspatialsdk__['XR_ENV'] = "web"
|
|
7
7
|
})()
|
|
8
8
|
|
package/dist/web/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import React__default, { ReactNode, CSSProperties, ElementType, ForwardedRef } f
|
|
|
3
3
|
import { BackgroundMaterialType, CornerRadius, SpatialEntity, Vec3, SpatialSession, WindowContainerOptions as WindowContainerOptions$1 } from '@webspatial/core-sdk';
|
|
4
4
|
import { ModelViewerElement } from '@google/model-viewer';
|
|
5
5
|
import { WindowContainerOptions } from '@webspatial/core-sdk/';
|
|
6
|
+
export { WindowContainerOptions } from '@webspatial/core-sdk/';
|
|
6
7
|
|
|
7
8
|
type vecType = {
|
|
8
9
|
x: number;
|
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'] = "0.1.
|
|
5
|
+
window.__webspatialsdk__['react-sdk-version'] = "0.1.17"
|
|
6
6
|
window.__webspatialsdk__['XR_ENV'] = "web"
|
|
7
7
|
})()
|
|
8
8
|
|
|
@@ -1580,15 +1580,18 @@ function parseTransform(computedStyle) {
|
|
|
1580
1580
|
const idxOfMatrix = transform.indexOf(matrixFlagString);
|
|
1581
1581
|
if (idxOfMatrix !== -1) {
|
|
1582
1582
|
const transformDataArray = transform.substring(matrixFlagString.length, transform.length - 1).split(",").map((item) => parseFloat(item));
|
|
1583
|
-
return parse2dMatrix(transformDataArray);
|
|
1583
|
+
return { transformExist: true, matrix: parse2dMatrix(transformDataArray) };
|
|
1584
1584
|
} else {
|
|
1585
1585
|
const matrix3dFlagString = "matrix3d(";
|
|
1586
1586
|
const idxOfMatrix3d = transform.indexOf(matrix3dFlagString);
|
|
1587
1587
|
if (idxOfMatrix3d !== -1) {
|
|
1588
1588
|
const transform3dDataArray = transform.substring(matrix3dFlagString.length, transform.length - 1).split(",").map((item) => parseFloat(item));
|
|
1589
|
-
return
|
|
1589
|
+
return {
|
|
1590
|
+
transformExist: true,
|
|
1591
|
+
matrix: parse3dMatrix(transform3dDataArray)
|
|
1592
|
+
};
|
|
1590
1593
|
} else {
|
|
1591
|
-
return new Matrix4();
|
|
1594
|
+
return { transformExist: false, matrix: new Matrix4() };
|
|
1592
1595
|
}
|
|
1593
1596
|
}
|
|
1594
1597
|
}
|
|
@@ -1615,7 +1618,7 @@ function parseXRZIndex(computedStyle) {
|
|
|
1615
1618
|
function parseSpatialStyle(node) {
|
|
1616
1619
|
const computedStyle = getComputedStyle(node);
|
|
1617
1620
|
const mat4ForBack = parseBack(computedStyle);
|
|
1618
|
-
const mat4ForTransform = parseTransform(computedStyle);
|
|
1621
|
+
const { transformExist, matrix: mat4ForTransform } = parseTransform(computedStyle);
|
|
1619
1622
|
const resultMatrix = new Matrix4();
|
|
1620
1623
|
resultMatrix.multiplyMatrices(mat4ForBack, mat4ForTransform);
|
|
1621
1624
|
const position = new Vector3();
|
|
@@ -1640,7 +1643,8 @@ function parseSpatialStyle(node) {
|
|
|
1640
1643
|
material: {
|
|
1641
1644
|
type: backgroundMaterialType || "none"
|
|
1642
1645
|
},
|
|
1643
|
-
visible
|
|
1646
|
+
visible,
|
|
1647
|
+
transformExist
|
|
1644
1648
|
};
|
|
1645
1649
|
}
|
|
1646
1650
|
function useSpatialStyle() {
|
|
@@ -1653,7 +1657,8 @@ function useSpatialStyle() {
|
|
|
1653
1657
|
material: {
|
|
1654
1658
|
type: "none"
|
|
1655
1659
|
},
|
|
1656
|
-
visible: true
|
|
1660
|
+
visible: true,
|
|
1661
|
+
transformExist: false
|
|
1657
1662
|
});
|
|
1658
1663
|
const [ready, setReady] = useState3(false);
|
|
1659
1664
|
const checkSpatialStyleUpdate = useCallback2(() => {
|
|
@@ -2043,7 +2048,7 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
|
|
|
2043
2048
|
};
|
|
2044
2049
|
const spatialDivStyle = {
|
|
2045
2050
|
...style,
|
|
2046
|
-
transform: "none"
|
|
2051
|
+
transform: spatialStyle.transformExist ? "translateZ(0)" : "none"
|
|
2047
2052
|
};
|
|
2048
2053
|
const El = inProps.component || "div";
|
|
2049
2054
|
const spatialDivRef = useHijackSpatialDivRef(refIn, ref);
|
|
@@ -2117,7 +2122,7 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
|
|
|
2117
2122
|
};
|
|
2118
2123
|
const spatialDivStyle = {
|
|
2119
2124
|
...style,
|
|
2120
|
-
transform: "none"
|
|
2125
|
+
transform: spatialStyle.transformExist ? "translateZ(0)" : "none"
|
|
2121
2126
|
};
|
|
2122
2127
|
const El = inProps.component || "div";
|
|
2123
2128
|
const divRefClassName = className + " " + InjectClassName;
|
|
@@ -3281,7 +3286,7 @@ function renderCSSModel3DNotInSpatialDiv(inProps, refIn) {
|
|
|
3281
3286
|
const visible = spatialStyle.visible;
|
|
3282
3287
|
const model3DStyle = {
|
|
3283
3288
|
...style,
|
|
3284
|
-
transform: "none"
|
|
3289
|
+
transform: spatialStyle.transformExist ? "translateZ(0)" : "none"
|
|
3285
3290
|
};
|
|
3286
3291
|
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
3287
3292
|
ready && /* @__PURE__ */ jsx13(
|
|
@@ -3359,7 +3364,7 @@ function renderCSSModel3DPortalInstance(spatialId, inProps) {
|
|
|
3359
3364
|
};
|
|
3360
3365
|
const model3DStyle = {
|
|
3361
3366
|
...style,
|
|
3362
|
-
transform: "none"
|
|
3367
|
+
transform: spatialStyle.transformExist ? "translateZ(0)" : "none"
|
|
3363
3368
|
};
|
|
3364
3369
|
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
3365
3370
|
ready && /* @__PURE__ */ jsx15(
|
|
@@ -3800,7 +3805,7 @@ function spatialPolyfill() {
|
|
|
3800
3805
|
}
|
|
3801
3806
|
|
|
3802
3807
|
// src/index.ts
|
|
3803
|
-
var version = "0.1.
|
|
3808
|
+
var version = "0.1.17";
|
|
3804
3809
|
export {
|
|
3805
3810
|
CSSSpatialDiv,
|
|
3806
3811
|
CSSSpatialPrimitive,
|