@webspatial/react-sdk 0.1.7 → 0.1.9
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 +21 -1
- package/dist/default/index.js.map +1 -1
- package/dist/web/index.js +21 -1
- package/dist/web/index.js.map +1 -1
- package/package.json +2 -2
package/dist/default/index.js
CHANGED
|
@@ -1658,6 +1658,15 @@ function useSpatialStyle() {
|
|
|
1658
1658
|
observer.disconnect();
|
|
1659
1659
|
};
|
|
1660
1660
|
}, []);
|
|
1661
|
+
useEffect6(() => {
|
|
1662
|
+
const headObserver = new MutationObserver((mutations) => {
|
|
1663
|
+
checkSpatialStyleUpdate();
|
|
1664
|
+
});
|
|
1665
|
+
headObserver.observe(document.head, { childList: true, subtree: true });
|
|
1666
|
+
return () => {
|
|
1667
|
+
headObserver.disconnect();
|
|
1668
|
+
};
|
|
1669
|
+
}, []);
|
|
1661
1670
|
useEffect6(() => {
|
|
1662
1671
|
if (!ref.current) {
|
|
1663
1672
|
return;
|
|
@@ -3368,6 +3377,15 @@ CSSModel3D.displayName = "CSSModel3D";
|
|
|
3368
3377
|
|
|
3369
3378
|
// src/spatial-react-components/Model/index.tsx
|
|
3370
3379
|
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3380
|
+
{
|
|
3381
|
+
const styleElement = document.createElement("style");
|
|
3382
|
+
styleElement.id = "__custom-class-model-webspatial";
|
|
3383
|
+
styleElement.innerHTML = `.__custom-class-model-webspatial { width: 300px; height: 300px; }`;
|
|
3384
|
+
if (document.getElementById("__custom-class-model-webspatial")) {
|
|
3385
|
+
console.warn("__custom-class-model-webspatial already exists");
|
|
3386
|
+
}
|
|
3387
|
+
document.head.prepend(styleElement);
|
|
3388
|
+
}
|
|
3371
3389
|
function renderInModel3D(inProps, ref, modelUrl, placeHolder) {
|
|
3372
3390
|
const { poster, ...props } = inProps;
|
|
3373
3391
|
return /* @__PURE__ */ jsxs6(CSSModel3D, { modelUrl, ...props, ref, children: [
|
|
@@ -3409,6 +3427,8 @@ function parseChildren(child) {
|
|
|
3409
3427
|
}
|
|
3410
3428
|
function ModelBase(inProps, ref) {
|
|
3411
3429
|
const { children, ...props } = inProps;
|
|
3430
|
+
props.className = "__custom-class-model-webspatial " + (props.className ? props.className : "");
|
|
3431
|
+
let className = props.className;
|
|
3412
3432
|
const { placeHolder, gltfSourceURL, usdzSourceURL } = useMemo9(
|
|
3413
3433
|
() => parseChildren(children),
|
|
3414
3434
|
[children]
|
|
@@ -3428,7 +3448,7 @@ function ModelBase(inProps, ref) {
|
|
|
3428
3448
|
}
|
|
3429
3449
|
}, []);
|
|
3430
3450
|
const myModelViewer = useRef12(null);
|
|
3431
|
-
const {
|
|
3451
|
+
const { style = {}, ...props2 } = inProps;
|
|
3432
3452
|
const isDragging = useRef12(false);
|
|
3433
3453
|
let [modelViewerExists, setModelViewerExists] = useState6(false);
|
|
3434
3454
|
useEffect16(() => {
|