@webspatial/react-sdk 0.0.3 → 0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"CSSSpatialComponent.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/CSSSpatialDiv/CSSSpatialComponent.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,0BAA0B,EAE3B,MAAM,0BAA0B,CAAA;AAkPjC,eAAO,MAAM,mBAAmB,uHAAyC,CAAA"}
1
+ {"version":3,"file":"CSSSpatialComponent.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/CSSSpatialDiv/CSSSpatialComponent.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,0BAA0B,EAE3B,MAAM,0BAA0B,CAAA;AAqPjC,eAAO,MAAM,mBAAmB,uHAAyC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSpatialStyle.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/CSSSpatialDiv/useSpatialStyle.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAsHlE,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;;kBAST,sBAAsB;;;;EAoG3C"}
1
+ {"version":3,"file":"useSpatialStyle.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/CSSSpatialDiv/useSpatialStyle.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAuHlE,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;;kBAST,sBAAsB;;;;EAoG3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"CSSModel3DNotInSpatialDiv.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/Model3D/CSSModel3DNotInSpatialDiv.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE1D,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,eAAe,2CAgDvB"}
1
+ {"version":3,"file":"CSSModel3DNotInSpatialDiv.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/Model3D/CSSModel3DNotInSpatialDiv.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE1D,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,eAAe,2CAiDvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"CSSModel3DPortalInstance.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/Model3D/CSSModel3DPortalInstance.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAMzC,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,eAAe,2CA4CzB"}
1
+ {"version":3,"file":"CSSModel3DPortalInstance.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/Model3D/CSSModel3DPortalInstance.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAMzC,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,eAAe,2CA6CzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"PortalInstance.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/SpatialReactComponent/PortalInstance.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAEb,SAAS,EAMV,MAAM,OAAO,CAAA;AAad,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAInC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,UAAU,mBAAmB;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAEvC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAA;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CACpB;AAoYD,wBAAgB,cAAc,CAAC,OAAO,EAAE,mBAAmB,2CA+F1D;yBA/Fe,cAAc"}
1
+ {"version":3,"file":"PortalInstance.d.ts","sourceRoot":"","sources":["../../../../../src/spatial-react-components/SpatialReactComponent/PortalInstance.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAEb,SAAS,EAMV,MAAM,OAAO,CAAA;AAad,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAInC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,UAAU,mBAAmB;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAEvC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAA;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CACpB;AAqYD,wBAAgB,cAAc,CAAC,OAAO,EAAE,mBAAmB,2CAkG1D;yBAlGe,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"injectSceneHook.d.ts","sourceRoot":"","sources":["../../src/jsx/injectSceneHook.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,kBAyBpC"}
1
+ {"version":3,"file":"injectSceneHook.d.ts","sourceRoot":"","sources":["../../src/jsx/injectSceneHook.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,kBAoCpC"}
@@ -899,7 +899,7 @@ var require_default = __commonJS({
899
899
  }
900
900
  __name(syncDefaultSpatialStyle, "syncDefaultSpatialStyle");
901
901
  __name2(syncDefaultSpatialStyle, "syncDefaultSpatialStyle");
902
- function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, cornerRadiusFromStyle, opacity) {
902
+ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, cornerRadiusFromStyle, opacity, stylePosition) {
903
903
  let { allowScroll, scrollWithParent, style, spatialStyle = {} } = props;
904
904
  let {
905
905
  position = { x: 0, y: 0, z: 1 },
@@ -909,7 +909,6 @@ var require_default = __commonJS({
909
909
  cornerRadius = cornerRadiusFromStyle,
910
910
  zIndex = 0
911
911
  } = spatialStyle;
912
- let stylePosition = style?.position;
913
912
  let styleOverflow = style?.overflow;
914
913
  const visible = (0, import_react8.useMemo)(() => {
915
914
  return spatialStyle.visible !== false && domRect.width > 0 && domRect.height > 0;
@@ -1142,7 +1141,8 @@ var require_default = __commonJS({
1142
1141
  domRect,
1143
1142
  anchor,
1144
1143
  cornerRadius,
1145
- opacity
1144
+ opacity,
1145
+ inheritedPortalStyle.position
1146
1146
  );
1147
1147
  const JSXPortalInstance = renderJSXPortalInstance(
1148
1148
  props,
@@ -1151,7 +1151,7 @@ var require_default = __commonJS({
1151
1151
  inheritedPortalStyle,
1152
1152
  className
1153
1153
  );
1154
- const needRenderPlaceHolder = isSubPortal && inheritedPortalStyle.position !== "absolute";
1154
+ const needRenderPlaceHolder = isSubPortal && inheritedPortalStyle.position !== "absolute" && inheritedPortalStyle.position !== "fixed";
1155
1155
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SpatialWindowManagerContext.Provider, { value: spatialWindowManager, children: [
1156
1156
  needRenderPlaceHolder && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1157
1157
  "div",
@@ -1440,7 +1440,7 @@ var require_default = __commonJS({
1440
1440
  __name(parseTransform, "parseTransform");
1441
1441
  __name2(parseTransform, "parseTransform");
1442
1442
  function parseBack(computedStyle) {
1443
- let useBackProperty = computedStyle.position === "absolute" || computedStyle.position === "relative";
1443
+ let useBackProperty = computedStyle.position === "absolute" || computedStyle.position === "relative" || computedStyle.position === "fixed";
1444
1444
  if (!useBackProperty) return new import_Matrix4.Matrix4();
1445
1445
  let backProperty = computedStyle.getPropertyValue(SpatialCustomVars.back);
1446
1446
  let back = void 0;
@@ -1863,6 +1863,7 @@ var require_default = __commonJS({
1863
1863
  ...style,
1864
1864
  width: 0,
1865
1865
  height: 0,
1866
+ padding: 0,
1866
1867
  transition: "none"
1867
1868
  };
1868
1869
  const spatialDivStyle = {
@@ -1892,7 +1893,8 @@ var require_default = __commonJS({
1892
1893
  style: divRefStyle,
1893
1894
  className: divRefClassName,
1894
1895
  ...props,
1895
- ref
1896
+ ref,
1897
+ "data-cssparser": true
1896
1898
  }
1897
1899
  )
1898
1900
  ] });
@@ -1940,6 +1942,7 @@ var require_default = __commonJS({
1940
1942
  ...style,
1941
1943
  width: 0,
1942
1944
  height: 0,
1945
+ padding: 0,
1943
1946
  transition: "none"
1944
1947
  };
1945
1948
  const spatialDivStyle = {
@@ -3033,7 +3036,8 @@ var require_default = __commonJS({
3033
3036
  const cssParserDomStyle = {
3034
3037
  ...style,
3035
3038
  width: 0,
3036
- height: 0
3039
+ height: 0,
3040
+ padding: 0
3037
3041
  };
3038
3042
  const { ref: cssParserDomRef, spatialStyle, ready } = useSpatialStyle();
3039
3043
  const ref = useHijackSpatialDivRef(
@@ -3120,7 +3124,8 @@ var require_default = __commonJS({
3120
3124
  const cssParserDomStyle = {
3121
3125
  ...style,
3122
3126
  width: 0,
3123
- height: 0
3127
+ height: 0,
3128
+ padding: 0
3124
3129
  };
3125
3130
  const model3DStyle = {
3126
3131
  ...style,
@@ -4295,7 +4300,7 @@ var require_web = __commonJS({
4295
4300
  }
4296
4301
  __name(syncDefaultSpatialStyle, "syncDefaultSpatialStyle");
4297
4302
  __name2(syncDefaultSpatialStyle, "syncDefaultSpatialStyle");
4298
- function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, cornerRadiusFromStyle, opacity) {
4303
+ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, cornerRadiusFromStyle, opacity, stylePosition) {
4299
4304
  let { allowScroll, scrollWithParent, style, spatialStyle = {} } = props;
4300
4305
  let {
4301
4306
  position = { x: 0, y: 0, z: 1 },
@@ -4305,7 +4310,6 @@ var require_web = __commonJS({
4305
4310
  cornerRadius = cornerRadiusFromStyle,
4306
4311
  zIndex = 0
4307
4312
  } = spatialStyle;
4308
- let stylePosition = style?.position;
4309
4313
  let styleOverflow = style?.overflow;
4310
4314
  const visible = (0, import_react8.useMemo)(() => {
4311
4315
  return spatialStyle.visible !== false && domRect.width > 0 && domRect.height > 0;
@@ -4538,7 +4542,8 @@ var require_web = __commonJS({
4538
4542
  domRect,
4539
4543
  anchor,
4540
4544
  cornerRadius,
4541
- opacity
4545
+ opacity,
4546
+ inheritedPortalStyle.position
4542
4547
  );
4543
4548
  const JSXPortalInstance = renderJSXPortalInstance(
4544
4549
  props,
@@ -4547,7 +4552,7 @@ var require_web = __commonJS({
4547
4552
  inheritedPortalStyle,
4548
4553
  className
4549
4554
  );
4550
- const needRenderPlaceHolder = isSubPortal && inheritedPortalStyle.position !== "absolute";
4555
+ const needRenderPlaceHolder = isSubPortal && inheritedPortalStyle.position !== "absolute" && inheritedPortalStyle.position !== "fixed";
4551
4556
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SpatialWindowManagerContext.Provider, { value: spatialWindowManager, children: [
4552
4557
  needRenderPlaceHolder && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4553
4558
  "div",
@@ -4836,7 +4841,7 @@ var require_web = __commonJS({
4836
4841
  __name(parseTransform, "parseTransform");
4837
4842
  __name2(parseTransform, "parseTransform");
4838
4843
  function parseBack(computedStyle) {
4839
- let useBackProperty = computedStyle.position === "absolute" || computedStyle.position === "relative";
4844
+ let useBackProperty = computedStyle.position === "absolute" || computedStyle.position === "relative" || computedStyle.position === "fixed";
4840
4845
  if (!useBackProperty) return new import_Matrix4.Matrix4();
4841
4846
  let backProperty = computedStyle.getPropertyValue(SpatialCustomVars.back);
4842
4847
  let back = void 0;
@@ -5259,6 +5264,7 @@ var require_web = __commonJS({
5259
5264
  ...style,
5260
5265
  width: 0,
5261
5266
  height: 0,
5267
+ padding: 0,
5262
5268
  transition: "none"
5263
5269
  };
5264
5270
  const spatialDivStyle = {
@@ -5288,7 +5294,8 @@ var require_web = __commonJS({
5288
5294
  style: divRefStyle,
5289
5295
  className: divRefClassName,
5290
5296
  ...props,
5291
- ref
5297
+ ref,
5298
+ "data-cssparser": true
5292
5299
  }
5293
5300
  )
5294
5301
  ] });
@@ -5336,6 +5343,7 @@ var require_web = __commonJS({
5336
5343
  ...style,
5337
5344
  width: 0,
5338
5345
  height: 0,
5346
+ padding: 0,
5339
5347
  transition: "none"
5340
5348
  };
5341
5349
  const spatialDivStyle = {
@@ -6428,7 +6436,8 @@ var require_web = __commonJS({
6428
6436
  const cssParserDomStyle = {
6429
6437
  ...style,
6430
6438
  width: 0,
6431
- height: 0
6439
+ height: 0,
6440
+ padding: 0
6432
6441
  };
6433
6442
  const { ref: cssParserDomRef, spatialStyle, ready } = useSpatialStyle();
6434
6443
  const ref = useHijackSpatialDivRef(
@@ -6515,7 +6524,8 @@ var require_web = __commonJS({
6515
6524
  const cssParserDomStyle = {
6516
6525
  ...style,
6517
6526
  width: 0,
6518
- height: 0
6527
+ height: 0,
6528
+ padding: 0
6519
6529
  };
6520
6530
  const model3DStyle = {
6521
6531
  ...style,
@@ -6851,7 +6861,15 @@ async function injectSceneHook() {
6851
6861
  if (!window.opener) return;
6852
6862
  if (window._SceneHookOff) return;
6853
6863
  await (0, import_react_sdk.getSession)()?.setLoading("show");
6854
- document.addEventListener("DOMContentLoaded", async () => {
6864
+ function onContentLoaded(callback) {
6865
+ if (document.readyState === "interactive" || document.readyState === "complete") {
6866
+ callback();
6867
+ } else {
6868
+ document.addEventListener("DOMContentLoaded", callback);
6869
+ }
6870
+ }
6871
+ __name(onContentLoaded, "onContentLoaded");
6872
+ onContentLoaded(async () => {
6855
6873
  let cfg = import_react_sdk.defaultSceneConfig;
6856
6874
  if (typeof window.xrCurrentSceneDefaults === "function") {
6857
6875
  try {