@webspatial/react-sdk 0.0.10 → 0.0.11

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,56 +1,5 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- CSSSpatialDiv: () => CSSSpatialDiv,
34
- CSSSpatialPrimitive: () => CSSSpatialPrimitive,
35
- Model: () => Model,
36
- SpatialDiv: () => SpatialDiv,
37
- SpatialMonitor: () => SpatialMonitor,
38
- SpatialPrimitive: () => SpatialPrimitive,
39
- SpatialView: () => SpatialView,
40
- XRApp: () => XRApp,
41
- defaultSceneConfig: () => defaultSceneConfig,
42
- enableDebugTool: () => enableDebugTool,
43
- getSession: () => getSession,
44
- initScene: () => initScene,
45
- notifyUpdateStandInstanceLayout: () => notifyUpdateStandInstanceLayout,
46
- parseCornerRadius: () => parseCornerRadius,
47
- withCSSSpatial: () => withCSSSpatial,
48
- withSpatial: () => withSpatial
49
- });
50
- module.exports = __toCommonJS(index_exports);
51
-
52
1
  // src/spatial-react-components/SpatialPrimitive.tsx
53
- var import_react11 = require("react");
2
+ import { forwardRef as forwardRef3 } from "react";
54
3
 
55
4
  // src/spatial-react-components/primitives.ts
56
5
  var primitives = [
@@ -191,16 +140,16 @@ var primitives = [
191
140
  ];
192
141
 
193
142
  // src/spatial-react-components/SpatialReactComponent/SpatialReactComponent.tsx
194
- var import_react10 = require("react");
143
+ import { forwardRef as forwardRef2, useMemo as useMemo2, useContext as useContext4 } from "react";
195
144
 
196
145
  // src/utils/getSession.ts
197
- var import_core_sdk = require("@webspatial/core-sdk");
146
+ import { Spatial } from "@webspatial/core-sdk";
198
147
  var spatial = null;
199
148
  var _currentSession = null;
200
149
  function getSession() {
201
150
  if (false) return null;
202
151
  if (!spatial) {
203
- spatial = new import_core_sdk.Spatial();
152
+ spatial = new Spatial();
204
153
  }
205
154
  if (!spatial.isSupported()) {
206
155
  return null;
@@ -277,23 +226,29 @@ function enableDebugTool() {
277
226
  }
278
227
 
279
228
  // src/spatial-react-components/SpatialReactComponent/StandardInstance.tsx
280
- var import_react4 = require("react");
229
+ import {
230
+ useRef,
231
+ useLayoutEffect,
232
+ useEffect,
233
+ useContext,
234
+ forwardRef
235
+ } from "react";
281
236
 
282
237
  // src/spatial-react-components/hooks/useForceUpdate.ts
283
- var import_react = require("react");
238
+ import { useState } from "react";
284
239
  function useForceUpdate() {
285
- const [, setToggle] = (0, import_react.useState)(false);
240
+ const [, setToggle] = useState(false);
286
241
  return () => setToggle((toggle) => !toggle);
287
242
  }
288
243
 
289
244
  // src/spatial-react-components/SpatialReactComponent/SpatialIsStandardInstanceContext.ts
290
- var import_react2 = require("react");
291
- var SpatialIsStandardInstanceContext = (0, import_react2.createContext)(
245
+ import { createContext } from "react";
246
+ var SpatialIsStandardInstanceContext = createContext(
292
247
  null
293
248
  );
294
249
 
295
250
  // src/spatial-react-components/SpatialReactComponent/SpatialReactContext.ts
296
- var import_react3 = require("react");
251
+ import { createContext as createContext2 } from "react";
297
252
 
298
253
  // src/spatial-react-components/SpatialReactComponent/const.ts
299
254
  var SpatialID = "data-spatial-id";
@@ -403,18 +358,18 @@ var SpatialReactContextObject = class {
403
358
  }
404
359
  }
405
360
  };
406
- var SpatialReactContext = (0, import_react3.createContext)(null);
361
+ var SpatialReactContext = createContext2(null);
407
362
 
408
363
  // src/spatial-react-components/SpatialReactComponent/StandardInstance.tsx
409
- var import_jsx_runtime = require("react/jsx-runtime");
364
+ import { jsx } from "react/jsx-runtime";
410
365
  function useDetectDomRectChange() {
411
- const ref = (0, import_react4.useRef)(null);
366
+ const ref = useRef(null);
412
367
  const forceUpdate = useForceUpdate();
413
- const spatialReactContextObject = (0, import_react4.useContext)(SpatialReactContext);
414
- (0, import_react4.useLayoutEffect)(() => {
368
+ const spatialReactContextObject = useContext(SpatialReactContext);
369
+ useLayoutEffect(() => {
415
370
  ref.current && spatialReactContextObject?.notifyDomChange(ref.current);
416
371
  });
417
- (0, import_react4.useEffect)(() => {
372
+ useEffect(() => {
418
373
  if (!ref.current || !spatialReactContextObject) {
419
374
  console.warn(
420
375
  "Ref is not attached to the DOM or spatialReactContextObject is not available"
@@ -429,7 +384,7 @@ function useDetectDomRectChange() {
429
384
  window.removeEventListener("resize", handleResize);
430
385
  };
431
386
  }, [spatialReactContextObject]);
432
- (0, import_react4.useEffect)(() => {
387
+ useEffect(() => {
433
388
  if (!ref.current) {
434
389
  console.warn("Ref is not attached to the DOM");
435
390
  return;
@@ -442,7 +397,7 @@ function useDetectDomRectChange() {
442
397
  ro.disconnect();
443
398
  };
444
399
  }, []);
445
- (0, import_react4.useEffect)(() => {
400
+ useEffect(() => {
446
401
  if (!ref.current) {
447
402
  console.warn("Ref is not attached to the DOM");
448
403
  return;
@@ -460,7 +415,7 @@ function useDetectDomRectChange() {
460
415
  }, []);
461
416
  return ref;
462
417
  }
463
- var StandardInstance = (0, import_react4.forwardRef)(function(inProps, refIn) {
418
+ var StandardInstance = forwardRef(function(inProps, refIn) {
464
419
  const { El, style: inStyle, debugShowStandardInstance, ...props } = inProps;
465
420
  const extraStyle = {
466
421
  visibility: debugShowStandardInstance ? void 0 : "hidden",
@@ -486,16 +441,23 @@ var StandardInstance = (0, import_react4.forwardRef)(function(inProps, refIn) {
486
441
  return Reflect.set(target, prop, value, receiver);
487
442
  }
488
443
  });
489
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpatialIsStandardInstanceContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(El, { "data-standardinstance": true, ref: proxyRef, style, ...props }) });
444
+ return /* @__PURE__ */ jsx(SpatialIsStandardInstanceContext.Provider, { value: true, children: /* @__PURE__ */ jsx(El, { "data-standardinstance": true, ref: proxyRef, style, ...props }) });
490
445
  });
491
446
  StandardInstance.displayName = "StandardInstance";
492
447
 
493
448
  // src/spatial-react-components/SpatialReactComponent/PortalInstance.tsx
494
- var import_react8 = require("react");
495
- var import_react_dom = require("react-dom");
449
+ import {
450
+ useRef as useRef3,
451
+ useCallback,
452
+ useEffect as useEffect3,
453
+ useState as useState2,
454
+ useContext as useContext3,
455
+ useMemo
456
+ } from "react";
457
+ import { createPortal } from "react-dom";
496
458
 
497
459
  // src/spatial-react-components/SpatialReactComponent/usePortalContainer.tsx
498
- var import_react6 = require("react");
460
+ import { useContext as useContext2, useRef as useRef2, useEffect as useEffect2 } from "react";
499
461
 
500
462
  // src/spatial-react-components/SpatialReactComponent/SpatialWindowManager.ts
501
463
  var SpatialWindowManager = class {
@@ -586,16 +548,16 @@ var SpatialWindowManager = class {
586
548
  };
587
549
 
588
550
  // src/spatial-react-components/SpatialReactComponent/SpatialWindowManagerContext.ts
589
- var import_react5 = require("react");
590
- var SpatialWindowManagerContext = (0, import_react5.createContext)(null);
551
+ import { createContext as createContext3 } from "react";
552
+ var SpatialWindowManagerContext = createContext3(null);
591
553
 
592
554
  // src/spatial-react-components/SpatialReactComponent/usePortalContainer.tsx
593
555
  function usePortalContainer(options) {
594
- const isStandard = (0, import_react6.useContext)(SpatialIsStandardInstanceContext);
595
- const parentSpatialWindowManager = (0, import_react6.useContext)(SpatialWindowManagerContext);
556
+ const isStandard = useContext2(SpatialIsStandardInstanceContext);
557
+ const parentSpatialWindowManager = useContext2(SpatialWindowManagerContext);
596
558
  const forceUpdate = useForceUpdate();
597
- const spatialWindowManagerRef = (0, import_react6.useRef)();
598
- (0, import_react6.useEffect)(() => {
559
+ const spatialWindowManagerRef = useRef2();
560
+ useEffect2(() => {
599
561
  let isDestroyed = false;
600
562
  let spawnedResult;
601
563
  async function asyncCreatePortalContainer() {
@@ -739,8 +701,8 @@ function parseCornerRadius(computedStyle) {
739
701
  }
740
702
 
741
703
  // src/spatial-react-components/SpatialReactComponent/SpatialDebugNameContext.ts
742
- var import_react7 = require("react");
743
- var SpatialDebugNameContext = (0, import_react7.createContext)("");
704
+ import { createContext as createContext4 } from "react";
705
+ var SpatialDebugNameContext = createContext4("");
744
706
 
745
707
  // src/XRApp.ts
746
708
  var defaultSceneConfig = {
@@ -864,7 +826,7 @@ function initScene(name, callback) {
864
826
  }
865
827
 
866
828
  // src/spatial-react-components/SpatialReactComponent/PortalInstance.tsx
867
- var import_jsx_runtime2 = require("react/jsx-runtime");
829
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
868
830
  function renderJSXPortalInstance(inProps, elWidth, elHeight, inheritedPortalStyle, className) {
869
831
  const { El, style: inStyle = {}, className: _, ...props } = inProps;
870
832
  const extraStyle = {
@@ -890,7 +852,7 @@ function renderJSXPortalInstance(inProps, elWidth, elHeight, inheritedPortalStyl
890
852
  ...extraStyle,
891
853
  ...elWHStyle
892
854
  };
893
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(El, { style, className, ...props });
855
+ return /* @__PURE__ */ jsx2(El, { style, className, ...props });
894
856
  }
895
857
  function setOpenWindowStyle(openedWindow) {
896
858
  openedWindow.document.documentElement.style.cssText += document.documentElement.style.cssText;
@@ -977,7 +939,7 @@ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, corne
977
939
  zIndex = 0
978
940
  } = spatialStyle;
979
941
  let styleOverflow = style?.overflow;
980
- const visible = (0, import_react8.useMemo)(() => {
942
+ const visible = useMemo(() => {
981
943
  return spatialStyle.visible !== false && domRect.width > 0 && domRect.height > 0;
982
944
  }, [spatialStyle.visible, domRect.width, domRect.height]);
983
945
  if (position.x === void 0) position.x = 0;
@@ -1000,7 +962,7 @@ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, corne
1000
962
  } else {
1001
963
  Object.assign(cornerRadiusObject, cornerRadius);
1002
964
  }
1003
- (0, import_react8.useEffect)(() => {
965
+ useEffect3(() => {
1004
966
  if (spatialWindowManager && spatialWindowManager.webview) {
1005
967
  const webview = spatialWindowManager.webview;
1006
968
  (async function() {
@@ -1018,7 +980,7 @@ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, corne
1018
980
  cornerRadiusObject.topTrailing,
1019
981
  cornerRadiusObject.bottomTrailing
1020
982
  ]);
1021
- (0, import_react8.useEffect)(() => {
983
+ useEffect3(() => {
1022
984
  if (spatialWindowManager && spatialWindowManager.webview) {
1023
985
  const webview = spatialWindowManager.webview;
1024
986
  (async function() {
@@ -1034,7 +996,7 @@ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, corne
1034
996
  stylePosition,
1035
997
  styleOverflow
1036
998
  ]);
1037
- (0, import_react8.useEffect)(() => {
999
+ useEffect3(() => {
1038
1000
  if (spatialWindowManager) {
1039
1001
  ;
1040
1002
  (async function() {
@@ -1060,18 +1022,18 @@ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, corne
1060
1022
  anchor,
1061
1023
  zIndex
1062
1024
  ]);
1063
- (0, import_react8.useEffect)(() => {
1025
+ useEffect3(() => {
1064
1026
  if (spatialWindowManager && spatialWindowManager.webview) {
1065
1027
  const webview = spatialWindowManager.webview;
1066
1028
  webview.setOpacity(opacity);
1067
1029
  }
1068
1030
  }, [spatialWindowManager, opacity]);
1069
- (0, import_react8.useEffect)(() => {
1031
+ useEffect3(() => {
1070
1032
  if (spatialWindowManager) {
1071
1033
  spatialWindowManager.entity?.setVisible(visible);
1072
1034
  }
1073
1035
  }, [spatialWindowManager, visible]);
1074
- (0, import_react8.useEffect)(() => {
1036
+ useEffect3(() => {
1075
1037
  if (spatialWindowManager?.window && spatialWindowManager.webview) {
1076
1038
  ;
1077
1039
  (async function() {
@@ -1094,28 +1056,28 @@ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, corne
1094
1056
  }, [spatialWindowManager, domRect.width]);
1095
1057
  }
1096
1058
  function useSyncDomRect(spatialId) {
1097
- const [domRect, setDomRect] = (0, import_react8.useState)({
1059
+ const [domRect, setDomRect] = useState2({
1098
1060
  x: 0,
1099
1061
  y: 0,
1100
1062
  width: 0,
1101
1063
  height: 0
1102
1064
  });
1103
- const inheritedPortalStyleRef = (0, import_react8.useRef)({});
1104
- const anchorRef = (0, import_react8.useRef)({
1065
+ const inheritedPortalStyleRef = useRef3({});
1066
+ const anchorRef = useRef3({
1105
1067
  x: 0.5,
1106
1068
  y: 0.5,
1107
1069
  z: 0.5
1108
1070
  });
1109
- const cornerRadiusRef = (0, import_react8.useRef)({
1071
+ const cornerRadiusRef = useRef3({
1110
1072
  topLeading: 0,
1111
1073
  bottomLeading: 0,
1112
1074
  topTrailing: 0,
1113
1075
  bottomTrailing: 0
1114
1076
  });
1115
- const opacityRef = (0, import_react8.useRef)(1);
1116
- const spatialReactContextObject = (0, import_react8.useContext)(SpatialReactContext);
1117
- const inheritedPortalClassNameRef = (0, import_react8.useRef)("");
1118
- (0, import_react8.useEffect)(() => {
1077
+ const opacityRef = useRef3(1);
1078
+ const spatialReactContextObject = useContext3(SpatialReactContext);
1079
+ const inheritedPortalClassNameRef = useRef3("");
1080
+ useEffect3(() => {
1119
1081
  const syncDomRect = () => {
1120
1082
  const dom = spatialReactContextObject?.querySpatialDom(spatialId);
1121
1083
  if (!dom) {
@@ -1157,8 +1119,8 @@ function useSyncDomRect(spatialId) {
1157
1119
  }
1158
1120
  function PortalInstance(inProps) {
1159
1121
  const { allowScroll, scrollWithParent, spatialStyle, isSubPortal, ...props } = inProps;
1160
- const debugName = (0, import_react8.useContext)(SpatialDebugNameContext);
1161
- const onContainerSpawned = (0, import_react8.useCallback)(
1122
+ const debugName = useContext3(SpatialDebugNameContext);
1123
+ const onContainerSpawned = useCallback(
1162
1124
  async (spatialWindowManager2) => {
1163
1125
  const openWindow = spatialWindowManager2.window;
1164
1126
  setOpenWindowStyle(openWindow);
@@ -1173,7 +1135,7 @@ function PortalInstance(inProps) {
1173
1135
  },
1174
1136
  []
1175
1137
  );
1176
- const onContainerDestroyed = (0, import_react8.useCallback)(
1138
+ const onContainerDestroyed = useCallback(
1177
1139
  (spatialWindowManager2, spawnedResult) => {
1178
1140
  const { headObserver } = spawnedResult;
1179
1141
  headObserver.disconnect();
@@ -1215,8 +1177,8 @@ function PortalInstance(inProps) {
1215
1177
  className
1216
1178
  );
1217
1179
  const needRenderPlaceHolder = isSubPortal && inheritedPortalStyle.position !== "absolute" && inheritedPortalStyle.position !== "fixed";
1218
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(SpatialWindowManagerContext.Provider, { value: spatialWindowManager, children: [
1219
- needRenderPlaceHolder && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1180
+ return /* @__PURE__ */ jsxs(SpatialWindowManagerContext.Provider, { value: spatialWindowManager, children: [
1181
+ needRenderPlaceHolder && /* @__PURE__ */ jsx2(
1220
1182
  "div",
1221
1183
  {
1222
1184
  className,
@@ -1229,7 +1191,7 @@ function PortalInstance(inProps) {
1229
1191
  }
1230
1192
  }
1231
1193
  ),
1232
- spatialWindowManager && spatialWindowManager.window && (0, import_react_dom.createPortal)(
1194
+ spatialWindowManager && spatialWindowManager.window && createPortal(
1233
1195
  JSXPortalInstance,
1234
1196
  spatialWindowManager.window.document.body
1235
1197
  )
@@ -1238,11 +1200,11 @@ function PortalInstance(inProps) {
1238
1200
  PortalInstance.displayName = "PortalInstance";
1239
1201
 
1240
1202
  // src/spatial-react-components/SpatialReactComponent/SpatialLayerContext.ts
1241
- var import_react9 = require("react");
1242
- var SpatialLayerContext = (0, import_react9.createContext)(0);
1203
+ import { createContext as createContext5 } from "react";
1204
+ var SpatialLayerContext = createContext5(0);
1243
1205
 
1244
1206
  // src/spatial-react-components/SpatialReactComponent/SpatialReactComponent.tsx
1245
- var import_jsx_runtime3 = require("react/jsx-runtime");
1207
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1246
1208
  function parseProps(inProps) {
1247
1209
  const {
1248
1210
  debugShowStandardInstance,
@@ -1262,7 +1224,7 @@ function parseProps(inProps) {
1262
1224
  function renderWebReactComponent(inProps, ref) {
1263
1225
  const { componentDesc, props } = parseProps(inProps);
1264
1226
  const { El } = componentDesc;
1265
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(El, { ...props, ref });
1227
+ return /* @__PURE__ */ jsx3(El, { ...props, ref });
1266
1228
  }
1267
1229
  function renderSpatialReactComponent(inProps, ref) {
1268
1230
  const { componentDesc, spatialDesc, debugDesc, props } = parseProps(inProps);
@@ -1276,13 +1238,13 @@ function renderSpatialReactComponent(inProps, ref) {
1276
1238
  ...componentDesc,
1277
1239
  ...spatialDesc
1278
1240
  };
1279
- const spatialReactContextObject = (0, import_react10.useMemo)(
1241
+ const spatialReactContextObject = useMemo2(
1280
1242
  () => new SpatialReactContextObject(debugDesc.debugName),
1281
1243
  []
1282
1244
  );
1283
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(SpatialReactContext.Provider, { value: spatialReactContextObject, children: [
1284
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StandardInstance, { ...standardInstanceProps, ref }),
1285
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PortalInstance, { isSubPortal: false, ...portalInstanceProps })
1245
+ return /* @__PURE__ */ jsxs2(SpatialReactContext.Provider, { value: spatialReactContextObject, children: [
1246
+ /* @__PURE__ */ jsx3(StandardInstance, { ...standardInstanceProps, ref }),
1247
+ /* @__PURE__ */ jsx3(PortalInstance, { isSubPortal: false, ...portalInstanceProps })
1286
1248
  ] });
1287
1249
  }
1288
1250
  function renderSubPortalInstance(inProps) {
@@ -1292,14 +1254,14 @@ function renderSubPortalInstance(inProps) {
1292
1254
  ...componentDesc,
1293
1255
  ...spatialDesc
1294
1256
  };
1295
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PortalInstance, { isSubPortal: true, ...portalInstanceProps });
1257
+ return /* @__PURE__ */ jsx3(PortalInstance, { isSubPortal: true, ...portalInstanceProps });
1296
1258
  }
1297
1259
  function SpatialReactComponentRefactor(inProps, ref) {
1298
- const layer = (0, import_react10.useContext)(SpatialLayerContext) + 1;
1299
- const parentSpatialReactContextObject = (0, import_react10.useContext)(SpatialReactContext);
1260
+ const layer = useContext4(SpatialLayerContext) + 1;
1261
+ const parentSpatialReactContextObject = useContext4(SpatialReactContext);
1300
1262
  const isRootInstance = !parentSpatialReactContextObject;
1301
- const isInStandardInstance = !!(0, import_react10.useContext)(SpatialIsStandardInstanceContext);
1302
- const spatialID = (0, import_react10.useMemo)(() => {
1263
+ const isInStandardInstance = !!useContext4(SpatialIsStandardInstanceContext);
1264
+ const spatialID = useMemo2(() => {
1303
1265
  return isRootInstance ? layer.toString() : parentSpatialReactContextObject.getSpatialID(
1304
1266
  layer,
1305
1267
  isInStandardInstance,
@@ -1308,15 +1270,15 @@ function SpatialReactComponentRefactor(inProps, ref) {
1308
1270
  }, []);
1309
1271
  const props = { ...inProps, [SpatialID]: spatialID };
1310
1272
  const contentInLayer = renderContentInLayer(props, ref);
1311
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SpatialDebugNameContext.Provider, { value: inProps.debugName || "", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SpatialLayerContext.Provider, { value: layer, children: contentInLayer }) });
1273
+ return /* @__PURE__ */ jsx3(SpatialDebugNameContext.Provider, { value: inProps.debugName || "", children: /* @__PURE__ */ jsx3(SpatialLayerContext.Provider, { value: layer, children: contentInLayer }) });
1312
1274
  }
1313
1275
  function renderContentInLayer(inProps, ref) {
1314
- const isInStandardInstance = (0, import_react10.useContext)(SpatialIsStandardInstanceContext);
1276
+ const isInStandardInstance = useContext4(SpatialIsStandardInstanceContext);
1315
1277
  const isWebSpatialEnv = getSession() !== null;
1316
1278
  if (isInStandardInstance || !isWebSpatialEnv) {
1317
1279
  return renderWebReactComponent(inProps, ref);
1318
1280
  } else {
1319
- const parentSpatialReactContextObject = (0, import_react10.useContext)(SpatialReactContext);
1281
+ const parentSpatialReactContextObject = useContext4(SpatialReactContext);
1320
1282
  if (parentSpatialReactContextObject) {
1321
1283
  return renderSubPortalInstance(inProps);
1322
1284
  } else {
@@ -1324,20 +1286,20 @@ function renderContentInLayer(inProps, ref) {
1324
1286
  }
1325
1287
  }
1326
1288
  }
1327
- var SpatialReactComponent = (0, import_react10.forwardRef)(SpatialReactComponentRefactor);
1289
+ var SpatialReactComponent = forwardRef2(SpatialReactComponentRefactor);
1328
1290
  SpatialReactComponent.displayName = "SpatialReactComponent";
1329
1291
 
1330
1292
  // src/spatial-react-components/SpatialPrimitive.tsx
1331
- var import_jsx_runtime4 = require("react/jsx-runtime");
1293
+ import { jsx as jsx4 } from "react/jsx-runtime";
1332
1294
  var cachedWithSpatialType = /* @__PURE__ */ new Map();
1333
1295
  function withSpatial(Component) {
1334
1296
  if (cachedWithSpatialType.has(Component)) {
1335
1297
  return cachedWithSpatialType.get(Component);
1336
1298
  } else {
1337
- const WithSpatialComponent = (0, import_react11.forwardRef)(
1299
+ const WithSpatialComponent = forwardRef3(
1338
1300
  (givenProps, givenRef) => {
1339
1301
  const { component: ignoreComponent, ...props } = givenProps;
1340
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1302
+ return /* @__PURE__ */ jsx4(
1341
1303
  SpatialReactComponent,
1342
1304
  {
1343
1305
  component: Component,
@@ -1361,8 +1323,11 @@ var SpatialPrimitive = {};
1361
1323
  })(SpatialPrimitive);
1362
1324
  var SpatialDiv = SpatialPrimitive.div;
1363
1325
 
1364
- // src/spatial-react-components/hooks/useMonitorDomChange.tsx
1365
- var import_react12 = require("react");
1326
+ // src/spatial-react-components/SpatialMonitor/withSpatialMonitor.tsx
1327
+ import { forwardRef as forwardRef5 } from "react";
1328
+
1329
+ // src/spatial-react-components/SpatialMonitor/useMonitorDomChange.tsx
1330
+ import { useRef as useRef4, useEffect as useEffect4, useMemo as useMemo3 } from "react";
1366
1331
 
1367
1332
  // src/spatial-react-components/notifyUpdateStandInstanceLayout.ts
1368
1333
  function notifyUpdateStandInstanceLayout() {
@@ -1380,10 +1345,10 @@ function notifyDOMUpdate(mutationsList) {
1380
1345
  );
1381
1346
  }
1382
1347
 
1383
- // src/spatial-react-components/hooks/useMonitorDomChange.tsx
1384
- function useMonitorDomChange() {
1385
- const ref = (0, import_react12.useRef)(void 0);
1386
- (0, import_react12.useEffect)(() => {
1348
+ // src/spatial-react-components/SpatialMonitor/useMonitorDomChange.tsx
1349
+ function useMonitorDomChange(inRef) {
1350
+ const ref = useRef4(null);
1351
+ useEffect4(() => {
1387
1352
  const observer = new MutationObserver((mutationsList) => {
1388
1353
  notifyDOMUpdate(mutationsList);
1389
1354
  });
@@ -1398,13 +1363,30 @@ function useMonitorDomChange() {
1398
1363
  observer.disconnect();
1399
1364
  };
1400
1365
  }, []);
1401
- return ref;
1366
+ const proxyRef = useMemo3(
1367
+ () => new Proxy(ref, {
1368
+ set: function(target, key, value) {
1369
+ if (key === "current") {
1370
+ if (inRef) {
1371
+ if (typeof inRef === "function") {
1372
+ inRef(value);
1373
+ } else if (inRef) {
1374
+ inRef.current = value;
1375
+ }
1376
+ }
1377
+ }
1378
+ return Reflect.set(target, key, value);
1379
+ }
1380
+ }),
1381
+ []
1382
+ );
1383
+ return proxyRef;
1402
1384
  }
1403
1385
 
1404
- // src/spatial-react-components/hooks/useMonitorDocumentHeaderChange.tsx
1405
- var import_react13 = require("react");
1386
+ // src/spatial-react-components/SpatialMonitor/useMonitorDocumentHeaderChange.tsx
1387
+ import { useEffect as useEffect5 } from "react";
1406
1388
  function useMonitorDocumentHeaderChange() {
1407
- (0, import_react13.useEffect)(() => {
1389
+ useEffect5(() => {
1408
1390
  const observer = new MutationObserver((mutationsList) => {
1409
1391
  notifyUpdateStandInstanceLayout();
1410
1392
  });
@@ -1420,33 +1402,63 @@ function useMonitorDocumentHeaderChange() {
1420
1402
  }, []);
1421
1403
  }
1422
1404
 
1423
- // src/spatial-react-components/SpatialMonitor.tsx
1424
- var import_jsx_runtime5 = require("react/jsx-runtime");
1425
- function SpatialMonitor(props) {
1426
- const { children, ...otherProps } = props;
1427
- const ref = useMonitorDomChange();
1405
+ // src/spatial-react-components/SpatialMonitor/SpatialMonitor.tsx
1406
+ import { forwardRef as forwardRef4 } from "react";
1407
+ import { jsx as jsx5 } from "react/jsx-runtime";
1408
+ function SpatialMonitorBase(inProps, inRef) {
1409
+ const { El = "div", ...props } = inProps;
1410
+ const ref = useMonitorDomChange(inRef);
1428
1411
  useMonitorDocumentHeaderChange();
1429
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { ref, ...otherProps, children: [
1430
- " ",
1431
- children,
1432
- " "
1433
- ] });
1412
+ return /* @__PURE__ */ jsx5(El, { ...props, ref });
1413
+ }
1414
+ var SpatialMonitor = forwardRef4(SpatialMonitorBase);
1415
+
1416
+ // src/spatial-react-components/SpatialMonitor/withSpatialMonitor.tsx
1417
+ import { jsx as jsx6 } from "react/jsx-runtime";
1418
+ var cachedWithSpatialMonitorType = /* @__PURE__ */ new Map();
1419
+ function withSpatialMonitor(El) {
1420
+ if (cachedWithSpatialMonitorType.has(El)) {
1421
+ return cachedWithSpatialMonitorType.get(El);
1422
+ } else {
1423
+ const WithSpatialMonitorComponent = forwardRef5(
1424
+ (givenProps, givenRef) => {
1425
+ const {
1426
+ El: _,
1427
+ ...props
1428
+ } = givenProps;
1429
+ return /* @__PURE__ */ jsx6(SpatialMonitor, { El, ...props, ref: givenRef });
1430
+ }
1431
+ );
1432
+ WithSpatialMonitorComponent.displayName = `WithSpatialMonitor(${typeof El === "string" ? El : El.displayName || El.name})`;
1433
+ cachedWithSpatialMonitorType.set(El, WithSpatialMonitorComponent);
1434
+ cachedWithSpatialMonitorType.set(
1435
+ cachedWithSpatialMonitorType,
1436
+ cachedWithSpatialMonitorType
1437
+ );
1438
+ return WithSpatialMonitorComponent;
1439
+ }
1434
1440
  }
1435
1441
 
1436
1442
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialDiv.tsx
1437
- var import_react20 = require("react");
1443
+ import { forwardRef as forwardRef7 } from "react";
1438
1444
 
1439
1445
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialComponent.tsx
1440
- var import_react19 = require("react");
1446
+ import {
1447
+ forwardRef as forwardRef6,
1448
+ useContext as useContext5,
1449
+ useEffect as useEffect7,
1450
+ useMemo as useMemo4,
1451
+ useRef as useRef6
1452
+ } from "react";
1441
1453
 
1442
1454
  // src/spatial-react-components/CSSSpatialDiv/useSpatialStyle.ts
1443
- var import_react14 = require("react");
1444
- var import_lodash = __toESM(require("lodash.isequal"));
1455
+ import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef5, useState as useState3 } from "react";
1456
+ import isEqual from "lodash.isequal";
1445
1457
 
1446
1458
  // src/spatial-react-components/CSSSpatialDiv/math/index.ts
1447
- var import_Matrix4 = require("three/src/math/Matrix4.js");
1448
- var import_Vector3 = require("three/src/math/Vector3.js");
1449
- var import_Quaternion = require("three/src/math/Quaternion.js");
1459
+ import { Matrix4 } from "three/src/math/Matrix4.js";
1460
+ import { Vector3 } from "three/src/math/Vector3.js";
1461
+ import { Quaternion } from "three/src/math/Quaternion.js";
1450
1462
 
1451
1463
  // src/spatial-react-components/CSSSpatialDiv/const.ts
1452
1464
  var SpatialCustomVars = {
@@ -1458,7 +1470,7 @@ var BackgroundMaterialDefault = "none";
1458
1470
  // src/spatial-react-components/CSSSpatialDiv/useSpatialStyle.ts
1459
1471
  function parse2dMatrix(transformDataArray) {
1460
1472
  const [n11, n21, n12, n22, n13, n23] = transformDataArray;
1461
- const matrix4 = new import_Matrix4.Matrix4(
1473
+ const matrix4 = new Matrix4(
1462
1474
  n11,
1463
1475
  n12,
1464
1476
  0,
@@ -1479,7 +1491,7 @@ function parse2dMatrix(transformDataArray) {
1479
1491
  return matrix4;
1480
1492
  }
1481
1493
  function parse3dMatrix(transformDataArray) {
1482
- const matrix4 = new import_Matrix4.Matrix4().fromArray(transformDataArray);
1494
+ const matrix4 = new Matrix4().fromArray(transformDataArray);
1483
1495
  return matrix4;
1484
1496
  }
1485
1497
  function parseTransform(computedStyle) {
@@ -1496,30 +1508,28 @@ function parseTransform(computedStyle) {
1496
1508
  const transform3dDataArray = transform.substring(matrix3dFlagString.length, transform.length - 1).split(",").map((item) => parseFloat(item));
1497
1509
  return parse3dMatrix(transform3dDataArray);
1498
1510
  } else {
1499
- return new import_Matrix4.Matrix4();
1511
+ return new Matrix4();
1500
1512
  }
1501
1513
  }
1502
1514
  }
1503
1515
  function parseBack(computedStyle) {
1504
- let useBackProperty = computedStyle.position === "absolute" || computedStyle.position === "relative" || computedStyle.position === "fixed";
1505
- if (!useBackProperty) return new import_Matrix4.Matrix4();
1506
1516
  let backProperty = computedStyle.getPropertyValue(SpatialCustomVars.back);
1507
1517
  let back = void 0;
1508
1518
  try {
1509
1519
  back = parseFloat(backProperty);
1510
1520
  } catch (error) {
1511
1521
  }
1512
- return new import_Matrix4.Matrix4().makeTranslation(0, 0, back || 1);
1522
+ return new Matrix4().makeTranslation(0, 0, back || 1);
1513
1523
  }
1514
1524
  function parseSpatialStyle(node) {
1515
1525
  const computedStyle = getComputedStyle(node);
1516
1526
  const mat4ForBack = parseBack(computedStyle);
1517
1527
  const mat4ForTransform = parseTransform(computedStyle);
1518
- const resultMatrix = new import_Matrix4.Matrix4();
1528
+ const resultMatrix = new Matrix4();
1519
1529
  resultMatrix.multiplyMatrices(mat4ForBack, mat4ForTransform);
1520
- const position = new import_Vector3.Vector3();
1521
- const quaternion = new import_Quaternion.Quaternion();
1522
- const scale = new import_Vector3.Vector3();
1530
+ const position = new Vector3();
1531
+ const quaternion = new Quaternion();
1532
+ const scale = new Vector3();
1523
1533
  resultMatrix.decompose(position, quaternion, scale);
1524
1534
  const zIndex = parseFloat(computedStyle.getPropertyValue("z-index"));
1525
1535
  const visible = computedStyle.getPropertyValue("visibility") === "visible";
@@ -1543,8 +1553,8 @@ function parseSpatialStyle(node) {
1543
1553
  };
1544
1554
  }
1545
1555
  function useSpatialStyle() {
1546
- const ref = (0, import_react14.useRef)(null);
1547
- const [spatialStyle, setSpatialStyle] = (0, import_react14.useState)({
1556
+ const ref = useRef5(null);
1557
+ const [spatialStyle, setSpatialStyle] = useState3({
1548
1558
  position: { x: 0, y: 0, z: 1 },
1549
1559
  rotation: { x: 0, y: 0, z: 0, w: 1 },
1550
1560
  scale: { x: 1, y: 1, z: 1 },
@@ -1554,14 +1564,14 @@ function useSpatialStyle() {
1554
1564
  },
1555
1565
  visible: true
1556
1566
  });
1557
- const [ready, setReady] = (0, import_react14.useState)(false);
1558
- const checkSpatialStyleUpdate = (0, import_react14.useCallback)(() => {
1567
+ const [ready, setReady] = useState3(false);
1568
+ const checkSpatialStyleUpdate = useCallback2(() => {
1559
1569
  const nextSpatialStyle = parseSpatialStyle(ref.current);
1560
- if (!(0, import_lodash.default)(spatialStyle, nextSpatialStyle)) {
1570
+ if (!isEqual(spatialStyle, nextSpatialStyle)) {
1561
1571
  setSpatialStyle(nextSpatialStyle);
1562
1572
  }
1563
1573
  }, []);
1564
- (0, import_react14.useEffect)(() => {
1574
+ useEffect6(() => {
1565
1575
  if (!ref.current) {
1566
1576
  return;
1567
1577
  }
@@ -1569,7 +1579,7 @@ function useSpatialStyle() {
1569
1579
  setSpatialStyle(spatialStyle2);
1570
1580
  setReady(true);
1571
1581
  }, []);
1572
- (0, import_react14.useEffect)(() => {
1582
+ useEffect6(() => {
1573
1583
  if (!ref.current) {
1574
1584
  return;
1575
1585
  }
@@ -1588,7 +1598,7 @@ function useSpatialStyle() {
1588
1598
  observer.disconnect();
1589
1599
  };
1590
1600
  }, []);
1591
- (0, import_react14.useEffect)(() => {
1601
+ useEffect6(() => {
1592
1602
  if (!ref.current) {
1593
1603
  return;
1594
1604
  }
@@ -1630,11 +1640,11 @@ function useSpatialStyle() {
1630
1640
  }
1631
1641
 
1632
1642
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialDebugNameContext.ts
1633
- var import_react15 = require("react");
1634
- var CSSSpatialDebugNameContext = (0, import_react15.createContext)("");
1643
+ import { createContext as createContext6 } from "react";
1644
+ var CSSSpatialDebugNameContext = createContext6("");
1635
1645
 
1636
1646
  // src/spatial-react-components/CSSSpatialDiv/useHijackSpatialDivRef.ts
1637
- var import_react16 = require("react");
1647
+ import { useCallback as useCallback3 } from "react";
1638
1648
 
1639
1649
  // src/spatial-react-components/CSSSpatialDiv/injectClassStyle.ts
1640
1650
  var InjectClassName = "xr-css-spatial-default";
@@ -1678,7 +1688,7 @@ function makeOriginalKey(key) {
1678
1688
  }
1679
1689
  function useHijackSpatialDivRef(refIn, cssParserRef) {
1680
1690
  const ref = cssParserRef;
1681
- const spatialDivRef = (0, import_react16.useCallback)(
1691
+ const spatialDivRef = useCallback3(
1682
1692
  (domElement) => {
1683
1693
  if (domElement && refIn) {
1684
1694
  const domStyle = domElement.style;
@@ -1855,11 +1865,11 @@ function useHijackSpatialDivRef(refIn, cssParserRef) {
1855
1865
  }
1856
1866
 
1857
1867
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialLayerContext.ts
1858
- var import_react17 = require("react");
1859
- var CSSSpatialLayerContext = (0, import_react17.createContext)(0);
1868
+ import { createContext as createContext7 } from "react";
1869
+ var CSSSpatialLayerContext = createContext7(0);
1860
1870
 
1861
1871
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialRootContext.ts
1862
- var import_react18 = require("react");
1872
+ import { createContext as createContext8 } from "react";
1863
1873
  var CSSSpatialID = "CSSSpatialID";
1864
1874
  var CSSSpatialRootContextObject = class {
1865
1875
  prefix = "css";
@@ -1894,12 +1904,12 @@ var CSSSpatialRootContextObject = class {
1894
1904
  this.fns[cssSpatialID]?.(domElement);
1895
1905
  }
1896
1906
  };
1897
- var CSSSpatialRootContext = (0, import_react18.createContext)(null);
1907
+ var CSSSpatialRootContext = createContext8(null);
1898
1908
 
1899
1909
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialComponent.tsx
1900
- var import_jsx_runtime6 = require("react/jsx-runtime");
1910
+ import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
1901
1911
  function renderRootCSSSpatialComponent(inProps, refIn) {
1902
- const cssSpatialRootContextObject = (0, import_react19.useMemo)(
1912
+ const cssSpatialRootContextObject = useMemo4(
1903
1913
  () => new CSSSpatialRootContextObject(),
1904
1914
  []
1905
1915
  );
@@ -1917,7 +1927,8 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
1917
1927
  width: 0,
1918
1928
  height: 0,
1919
1929
  padding: 0,
1920
- transition: "none"
1930
+ transition: "none",
1931
+ position: "absolute"
1921
1932
  };
1922
1933
  const spatialDivStyle = {
1923
1934
  ...style,
@@ -1926,8 +1937,8 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
1926
1937
  const El = inProps.component || "div";
1927
1938
  const spatialDivRef = useHijackSpatialDivRef(refIn, ref);
1928
1939
  const divRefClassName = className + " " + InjectClassName;
1929
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(CSSSpatialRootContext.Provider, { value: cssSpatialRootContextObject, children: [
1930
- ready && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1940
+ return /* @__PURE__ */ jsxs3(CSSSpatialRootContext.Provider, { value: cssSpatialRootContextObject, children: [
1941
+ ready && /* @__PURE__ */ jsx7(
1931
1942
  SpatialReactComponent,
1932
1943
  {
1933
1944
  style: spatialDivStyle,
@@ -1940,7 +1951,7 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
1940
1951
  ref: spatialDivRef
1941
1952
  }
1942
1953
  ),
1943
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1954
+ /* @__PURE__ */ jsx7(
1944
1955
  El,
1945
1956
  {
1946
1957
  style: divRefStyle,
@@ -1953,7 +1964,7 @@ function renderRootCSSSpatialComponent(inProps, refIn) {
1953
1964
  ] });
1954
1965
  }
1955
1966
  function renderInWebEnv(props, ref) {
1956
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SpatialReactComponent, { ...props, ref });
1967
+ return /* @__PURE__ */ jsx7(SpatialReactComponent, { ...props, ref });
1957
1968
  }
1958
1969
  function renderInStandardInstance(cssSpatialRootContextObject, cssSpatialID, inProps, refIn) {
1959
1970
  const { style: inStyle = {}, ...props } = inProps;
@@ -1962,9 +1973,9 @@ function renderInStandardInstance(cssSpatialRootContextObject, cssSpatialID, inP
1962
1973
  transform: "none",
1963
1974
  visibility: "hidden"
1964
1975
  };
1965
- var cssParserRef = (0, import_react19.useRef)(null);
1976
+ var cssParserRef = useRef6(null);
1966
1977
  const spatialDivRef = useHijackSpatialDivRef(refIn, cssParserRef);
1967
- (0, import_react19.useEffect)(() => {
1978
+ useEffect7(() => {
1968
1979
  const onDomChangeAction = (dom) => {
1969
1980
  cssParserRef.current = dom;
1970
1981
  };
@@ -1973,7 +1984,7 @@ function renderInStandardInstance(cssSpatialRootContextObject, cssSpatialID, inP
1973
1984
  cssSpatialRootContextObject.offDomChange(cssSpatialID, onDomChangeAction);
1974
1985
  };
1975
1986
  }, []);
1976
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SpatialReactComponent, { style, ...props, ref: spatialDivRef });
1987
+ return /* @__PURE__ */ jsx7(SpatialReactComponent, { style, ...props, ref: spatialDivRef });
1977
1988
  }
1978
1989
  function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inProps) {
1979
1990
  const {
@@ -1990,7 +2001,8 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
1990
2001
  width: 0,
1991
2002
  height: 0,
1992
2003
  padding: 0,
1993
- transition: "none"
2004
+ transition: "none",
2005
+ position: "absolute"
1994
2006
  };
1995
2007
  const spatialDivStyle = {
1996
2008
  ...style,
@@ -1998,11 +2010,11 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
1998
2010
  };
1999
2011
  const El = inProps.component || "div";
2000
2012
  const divRefClassName = className + " " + InjectClassName;
2001
- (0, import_react19.useEffect)(() => {
2013
+ useEffect7(() => {
2002
2014
  cssSpatialRootContextObject.setCSSParserRef(cssSpatialID, ref.current);
2003
2015
  }, [ref.current]);
2004
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
2005
- ready && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2016
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
2017
+ ready && /* @__PURE__ */ jsx7(
2006
2018
  SpatialReactComponent,
2007
2019
  {
2008
2020
  style: spatialDivStyle,
@@ -2014,7 +2026,7 @@ function renderInPortalInstance(cssSpatialRootContextObject, cssSpatialID, inPro
2014
2026
  debugShowStandardInstance
2015
2027
  }
2016
2028
  ),
2017
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2029
+ /* @__PURE__ */ jsx7(
2018
2030
  El,
2019
2031
  {
2020
2032
  style: divRefStyle,
@@ -2031,9 +2043,9 @@ function CSSSpatialComponentBase(inProps, ref) {
2031
2043
  if (isWebEnv) {
2032
2044
  return renderInWebEnv(props, ref);
2033
2045
  } else {
2034
- const cssSpatialRootContextObject = (0, import_react19.useContext)(CSSSpatialRootContext);
2046
+ const cssSpatialRootContextObject = useContext5(CSSSpatialRootContext);
2035
2047
  if (cssSpatialRootContextObject) {
2036
- const isInStandardInstance = !!(0, import_react19.useContext)(
2048
+ const isInStandardInstance = !!useContext5(
2037
2049
  SpatialIsStandardInstanceContext
2038
2050
  );
2039
2051
  if (isInStandardInstance) {
@@ -2055,13 +2067,13 @@ function CSSSpatialComponentBase(inProps, ref) {
2055
2067
  }
2056
2068
  }
2057
2069
  }
2058
- var CSSSpatialComponentBaseWithRef = (0, import_react19.forwardRef)(CSSSpatialComponentBase);
2070
+ var CSSSpatialComponentBaseWithRef = forwardRef6(CSSSpatialComponentBase);
2059
2071
  function CSSSpatialComponentWithRef(inProps, ref) {
2060
- const layer = (0, import_react19.useContext)(CSSSpatialLayerContext) + 1;
2061
- const cssSpatialRootContextObject = (0, import_react19.useContext)(CSSSpatialRootContext);
2072
+ const layer = useContext5(CSSSpatialLayerContext) + 1;
2073
+ const cssSpatialRootContextObject = useContext5(CSSSpatialRootContext);
2062
2074
  const isRootInstance = !cssSpatialRootContextObject;
2063
- const isInStandardInstance = !!(0, import_react19.useContext)(SpatialIsStandardInstanceContext);
2064
- const cssSpatialID = (0, import_react19.useMemo)(() => {
2075
+ const isInStandardInstance = !!useContext5(SpatialIsStandardInstanceContext);
2076
+ const cssSpatialID = useMemo4(() => {
2065
2077
  return isRootInstance ? layer.toString() : cssSpatialRootContextObject.getSpatialID(
2066
2078
  layer,
2067
2079
  isInStandardInstance,
@@ -2069,18 +2081,18 @@ function CSSSpatialComponentWithRef(inProps, ref) {
2069
2081
  );
2070
2082
  }, []);
2071
2083
  const props = { ...inProps, [CSSSpatialID]: cssSpatialID };
2072
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CSSSpatialDebugNameContext.Provider, { value: inProps.debugName || "", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CSSSpatialLayerContext.Provider, { value: layer, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CSSSpatialComponentBaseWithRef, { ...props, ref }) }) });
2084
+ return /* @__PURE__ */ jsx7(CSSSpatialDebugNameContext.Provider, { value: inProps.debugName || "", children: /* @__PURE__ */ jsx7(CSSSpatialLayerContext.Provider, { value: layer, children: /* @__PURE__ */ jsx7(CSSSpatialComponentBaseWithRef, { ...props, ref }) }) });
2073
2085
  }
2074
- var CSSSpatialComponent = (0, import_react19.forwardRef)(CSSSpatialComponentWithRef);
2086
+ var CSSSpatialComponent = forwardRef6(CSSSpatialComponentWithRef);
2075
2087
 
2076
2088
  // src/spatial-react-components/CSSSpatialDiv/CSSSpatialDiv.tsx
2077
- var import_jsx_runtime7 = require("react/jsx-runtime");
2089
+ import { jsx as jsx8 } from "react/jsx-runtime";
2078
2090
  var cachedWithCSSSpatialType = /* @__PURE__ */ new Map();
2079
2091
  function withCSSSpatial(Component) {
2080
2092
  if (cachedWithCSSSpatialType.has(Component)) {
2081
2093
  return cachedWithCSSSpatialType.get(Component);
2082
2094
  } else {
2083
- const WithCSSSpatialComponent = (0, import_react20.forwardRef)(
2095
+ const WithCSSSpatialComponent = forwardRef7(
2084
2096
  (givenProps, givenRef) => {
2085
2097
  const {
2086
2098
  component: ignoreComponent,
@@ -2088,7 +2100,7 @@ function withCSSSpatial(Component) {
2088
2100
  ...props
2089
2101
  } = givenProps;
2090
2102
  const className = "xr-spatial-default " + origClassName;
2091
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2103
+ return /* @__PURE__ */ jsx8(
2092
2104
  CSSSpatialComponent,
2093
2105
  {
2094
2106
  component: Component,
@@ -2117,18 +2129,23 @@ var CSSSpatialPrimitive = {};
2117
2129
  var CSSSpatialDiv = CSSSpatialPrimitive.div;
2118
2130
 
2119
2131
  // src/spatial-react-components/SpatialView.tsx
2120
- var import_core_sdk2 = require("@webspatial/core-sdk");
2121
- var import_react21 = require("react");
2122
- var import_jsx_runtime8 = require("react/jsx-runtime");
2132
+ import { SpatialHelper } from "@webspatial/core-sdk";
2133
+ import {
2134
+ useRef as useRef7,
2135
+ useImperativeHandle,
2136
+ forwardRef as forwardRef8,
2137
+ useEffect as useEffect8
2138
+ } from "react";
2139
+ import { jsx as jsx9 } from "react/jsx-runtime";
2123
2140
  var runAsync = (fn) => {
2124
2141
  return fn();
2125
2142
  };
2126
- var SpatialViewEl = (0, import_react21.forwardRef)(
2143
+ var SpatialViewEl = forwardRef8(
2127
2144
  (props, ref) => {
2128
- const divRef = (0, import_react21.useRef)(null);
2129
- const spatialEntity = (0, import_react21.useRef)(null);
2130
- const activePromise = (0, import_react21.useRef)(null);
2131
- (0, import_react21.useImperativeHandle)(ref, () => ({
2145
+ const divRef = useRef7(null);
2146
+ const spatialEntity = useRef7(null);
2147
+ const activePromise = useRef7(null);
2148
+ useImperativeHandle(ref, () => ({
2132
2149
  ...divRef.current,
2133
2150
  getViewEntity: async () => {
2134
2151
  if (activePromise.current) {
@@ -2138,15 +2155,15 @@ var SpatialViewEl = (0, import_react21.forwardRef)(
2138
2155
  }
2139
2156
  }));
2140
2157
  if (getSession() == null) {
2141
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: divRef, ...props, children: "WebSpatial is not supported in this browser" });
2158
+ return /* @__PURE__ */ jsx9("div", { ref: divRef, ...props, children: "WebSpatial is not supported in this browser" });
2142
2159
  }
2143
- (0, import_react21.useEffect)(() => {
2160
+ useEffect8(() => {
2144
2161
  if (false) return;
2145
2162
  activePromise.current = runAsync(async () => {
2146
2163
  if (activePromise.current) {
2147
2164
  await activePromise.current;
2148
2165
  }
2149
- let sh = new import_core_sdk2.SpatialHelper(getSession());
2166
+ let sh = new SpatialHelper(getSession());
2150
2167
  let x = await sh.dom.attachSpatialView(divRef.current);
2151
2168
  spatialEntity.current = x.entity;
2152
2169
  if (props.onViewLoad) {
@@ -2165,22 +2182,29 @@ var SpatialViewEl = (0, import_react21.forwardRef)(
2165
2182
  };
2166
2183
  }, []);
2167
2184
  const { onViewLoad, onViewUnload, ...divProps } = props;
2168
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: divRef, ...divProps });
2185
+ return /* @__PURE__ */ jsx9("div", { ref: divRef, ...divProps });
2169
2186
  }
2170
2187
  );
2171
2188
  var SpatialView = SpatialViewEl;
2172
2189
 
2173
2190
  // src/spatial-react-components/Model/index.tsx
2174
- var import_react31 = require("react");
2191
+ import {
2192
+ forwardRef as forwardRef11,
2193
+ Children,
2194
+ useMemo as useMemo9,
2195
+ useRef as useRef12,
2196
+ useEffect as useEffect16,
2197
+ useState as useState6
2198
+ } from "react";
2175
2199
 
2176
2200
  // src/spatial-react-components/Model3D/Model3D.tsx
2177
- var import_react27 = require("react");
2201
+ import { forwardRef as forwardRef9, useContext as useContext8, useMemo as useMemo7 } from "react";
2178
2202
 
2179
2203
  // src/spatial-react-components/Model3D/useDetectLayoutDomUpdated.ts
2180
- var import_react22 = require("react");
2204
+ import { useRef as useRef8, useEffect as useEffect9 } from "react";
2181
2205
  function useDetectLayoutDomUpdated(onDomUpdated) {
2182
- const ref = (0, import_react22.useRef)(null);
2183
- (0, import_react22.useEffect)(() => {
2206
+ const ref = useRef8(null);
2207
+ useEffect9(() => {
2184
2208
  const handleResize = () => {
2185
2209
  onDomUpdated();
2186
2210
  };
@@ -2189,7 +2213,7 @@ function useDetectLayoutDomUpdated(onDomUpdated) {
2189
2213
  window.removeEventListener("resize", handleResize);
2190
2214
  };
2191
2215
  }, []);
2192
- (0, import_react22.useEffect)(() => {
2216
+ useEffect9(() => {
2193
2217
  if (!ref.current) {
2194
2218
  console.warn("Ref is not attached to the DOM");
2195
2219
  return;
@@ -2202,7 +2226,7 @@ function useDetectLayoutDomUpdated(onDomUpdated) {
2202
2226
  ro.disconnect();
2203
2227
  };
2204
2228
  }, []);
2205
- (0, import_react22.useEffect)(() => {
2229
+ useEffect9(() => {
2206
2230
  if (!ref.current) {
2207
2231
  console.warn("Ref is not attached to the DOM");
2208
2232
  return;
@@ -2223,7 +2247,7 @@ function useDetectLayoutDomUpdated(onDomUpdated) {
2223
2247
  }
2224
2248
 
2225
2249
  // src/spatial-react-components/Model3D/useModel3DNative.ts
2226
- var import_react23 = require("react");
2250
+ import { useRef as useRef9, useEffect as useEffect10, useState as useState4 } from "react";
2227
2251
 
2228
2252
  // src/spatial-react-components/Model3D/utils.ts
2229
2253
  function PopulatePartialSpatialTransformType(spatialTransform = {}) {
@@ -2446,12 +2470,12 @@ var Model3DNative = class {
2446
2470
 
2447
2471
  // src/spatial-react-components/Model3D/useModel3DNative.ts
2448
2472
  function useModel3DNative(modelUrl, parentEntity, eventHandlers = {}, onModel3DNativeReadyCb) {
2449
- let model3DNativeRef = (0, import_react23.useRef)(null);
2450
- const [phase, setPhase] = (0, import_react23.useState)(
2473
+ let model3DNativeRef = useRef9(null);
2474
+ const [phase, setPhase] = useState4(
2451
2475
  "loading"
2452
2476
  );
2453
- const [failureReason, setFailureReason] = (0, import_react23.useState)("");
2454
- (0, import_react23.useEffect)(() => {
2477
+ const [failureReason, setFailureReason] = useState4("");
2478
+ useEffect10(() => {
2455
2479
  let isDestroyed = false;
2456
2480
  const model3DContainer = new Model3DNative(parentEntity);
2457
2481
  model3DContainer.init(
@@ -2478,32 +2502,32 @@ function useModel3DNative(modelUrl, parentEntity, eventHandlers = {}, onModel3DN
2478
2502
  setPhase("loading");
2479
2503
  };
2480
2504
  }, [modelUrl]);
2481
- (0, import_react23.useEffect)(() => {
2505
+ useEffect10(() => {
2482
2506
  if (model3DNativeRef.current) {
2483
2507
  model3DNativeRef.current.onDragStart = eventHandlers.onDragStart;
2484
2508
  }
2485
2509
  }, [model3DNativeRef.current, eventHandlers.onDragStart]);
2486
- (0, import_react23.useEffect)(() => {
2510
+ useEffect10(() => {
2487
2511
  if (model3DNativeRef.current) {
2488
2512
  model3DNativeRef.current.onDrag = eventHandlers.onDrag;
2489
2513
  }
2490
2514
  }, [model3DNativeRef.current, eventHandlers.onDrag]);
2491
- (0, import_react23.useEffect)(() => {
2515
+ useEffect10(() => {
2492
2516
  if (model3DNativeRef.current) {
2493
2517
  model3DNativeRef.current.onDragEnd = eventHandlers.onDragEnd;
2494
2518
  }
2495
2519
  });
2496
- (0, import_react23.useEffect)(() => {
2520
+ useEffect10(() => {
2497
2521
  if (model3DNativeRef.current) {
2498
2522
  model3DNativeRef.current.onTap = eventHandlers.onTap;
2499
2523
  }
2500
2524
  }, [model3DNativeRef.current, eventHandlers.onTap]);
2501
- (0, import_react23.useEffect)(() => {
2525
+ useEffect10(() => {
2502
2526
  if (model3DNativeRef.current) {
2503
2527
  model3DNativeRef.current.onDoubleTap = eventHandlers.onDoubleTap;
2504
2528
  }
2505
2529
  }, [model3DNativeRef.current, eventHandlers.onDoubleTap]);
2506
- (0, import_react23.useEffect)(() => {
2530
+ useEffect10(() => {
2507
2531
  if (model3DNativeRef.current) {
2508
2532
  model3DNativeRef.current.onLongPress = eventHandlers.onLongPress;
2509
2533
  }
@@ -2512,8 +2536,8 @@ function useModel3DNative(modelUrl, parentEntity, eventHandlers = {}, onModel3DN
2512
2536
  }
2513
2537
 
2514
2538
  // src/spatial-react-components/Model3D/Model3DNotInSpatialDiv.tsx
2515
- var import_react24 = require("react");
2516
- var import_jsx_runtime9 = require("react/jsx-runtime");
2539
+ import { useCallback as useCallback4, useEffect as useEffect11, useMemo as useMemo5 } from "react";
2540
+ import { jsx as jsx10 } from "react/jsx-runtime";
2517
2541
  function renderModel3DNotInSpatialDiv(props, refIn) {
2518
2542
  const {
2519
2543
  className,
@@ -2534,7 +2558,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2534
2558
  onLongPress
2535
2559
  } = props;
2536
2560
  const theSpatialTransform = PopulatePartialSpatialTransformType(spatialTransform);
2537
- const onDomUpdated = (0, import_react24.useCallback)(() => {
2561
+ const onDomUpdated = useCallback4(() => {
2538
2562
  if (model3DNativeRef.current && layoutInstanceRef.current) {
2539
2563
  const model3DNative = model3DNativeRef.current;
2540
2564
  model3DNative.updateByDom(layoutInstanceRef.current, {
@@ -2553,7 +2577,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2553
2577
  theSpatialTransform.scale.y,
2554
2578
  theSpatialTransform.scale.z
2555
2579
  ]);
2556
- const onModel3DContainerReadyCb = (0, import_react24.useCallback)(() => {
2580
+ const onModel3DContainerReadyCb = useCallback4(() => {
2557
2581
  if (model3DNativeRef.current && layoutInstanceRef.current) {
2558
2582
  model3DNativeRef.current.updateByDom(layoutInstanceRef.current, {
2559
2583
  spatialTransform: theSpatialTransform
@@ -2571,7 +2595,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2571
2595
  theSpatialTransform.scale.y,
2572
2596
  theSpatialTransform.scale.z
2573
2597
  ]);
2574
- const onDragStartCb = (0, import_react24.useCallback)(
2598
+ const onDragStartCb = useCallback4(
2575
2599
  (spatialDragEvent) => {
2576
2600
  if (onDragStart) {
2577
2601
  const dragEvent = {
@@ -2583,7 +2607,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2583
2607
  },
2584
2608
  [onDragStart]
2585
2609
  );
2586
- const onDragCb = (0, import_react24.useCallback)(
2610
+ const onDragCb = useCallback4(
2587
2611
  (spatialDragEvent) => {
2588
2612
  if (onDrag) {
2589
2613
  const dragEvent = {
@@ -2595,7 +2619,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2595
2619
  },
2596
2620
  [onDrag]
2597
2621
  );
2598
- const onDragEndCb = (0, import_react24.useCallback)(
2622
+ const onDragEndCb = useCallback4(
2599
2623
  (spatialDragEvent) => {
2600
2624
  if (onDragEnd) {
2601
2625
  const dragEvent = {
@@ -2607,7 +2631,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2607
2631
  },
2608
2632
  [onDragEnd]
2609
2633
  );
2610
- const onTapCb = (0, import_react24.useCallback)(() => {
2634
+ const onTapCb = useCallback4(() => {
2611
2635
  if (onTap) {
2612
2636
  const event = {
2613
2637
  target: layoutInstanceRef.current
@@ -2615,7 +2639,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2615
2639
  onTap(event);
2616
2640
  }
2617
2641
  }, [onTap]);
2618
- const onDoubleTapCb = (0, import_react24.useCallback)(() => {
2642
+ const onDoubleTapCb = useCallback4(() => {
2619
2643
  if (onDoubleTap) {
2620
2644
  const event = {
2621
2645
  target: layoutInstanceRef.current
@@ -2623,7 +2647,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2623
2647
  onDoubleTap(event);
2624
2648
  }
2625
2649
  }, [onDoubleTap]);
2626
- const onLongPressCb = (0, import_react24.useCallback)(() => {
2650
+ const onLongPressCb = useCallback4(() => {
2627
2651
  if (onLongPress) {
2628
2652
  const event = {
2629
2653
  target: layoutInstanceRef.current
@@ -2645,7 +2669,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2645
2669
  },
2646
2670
  onModel3DContainerReadyCb
2647
2671
  );
2648
- const onSuccess = (0, import_react24.useCallback)(() => {
2672
+ const onSuccess = useCallback4(() => {
2649
2673
  ;
2650
2674
  layoutInstanceRef.current.ready = true;
2651
2675
  if (onLoad) {
@@ -2654,7 +2678,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2654
2678
  });
2655
2679
  }
2656
2680
  }, [onLoad]);
2657
- const onFailure = (0, import_react24.useCallback)(
2681
+ const onFailure = useCallback4(
2658
2682
  (_) => {
2659
2683
  const modelElement = layoutInstanceRef.current;
2660
2684
  modelElement.ready = false;
@@ -2666,19 +2690,19 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2666
2690
  },
2667
2691
  [onLoad]
2668
2692
  );
2669
- (0, import_react24.useEffect)(() => {
2693
+ useEffect11(() => {
2670
2694
  if (phase === "failure") {
2671
2695
  onFailure(failureReason);
2672
2696
  } else if (phase === "success") {
2673
2697
  onSuccess();
2674
2698
  }
2675
2699
  }, [phase]);
2676
- (0, import_react24.useEffect)(() => {
2700
+ useEffect11(() => {
2677
2701
  if (model3DNativeRef.current) {
2678
2702
  model3DNativeRef.current.setVisible(visible);
2679
2703
  }
2680
2704
  }, [model3DNativeRef.current, visible]);
2681
- (0, import_react24.useEffect)(() => {
2705
+ useEffect11(() => {
2682
2706
  if (model3DNativeRef.current && layoutInstanceRef.current) {
2683
2707
  model3DNativeRef.current.updateByDom(layoutInstanceRef.current, {
2684
2708
  spatialTransform: theSpatialTransform
@@ -2696,17 +2720,17 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2696
2720
  theSpatialTransform.scale.y,
2697
2721
  theSpatialTransform.scale.z
2698
2722
  ]);
2699
- (0, import_react24.useEffect)(() => {
2723
+ useEffect11(() => {
2700
2724
  if (model3DNativeRef.current) {
2701
2725
  model3DNativeRef.current.setContentMode(contentMode);
2702
2726
  }
2703
2727
  }, [model3DNativeRef.current, contentMode]);
2704
- (0, import_react24.useEffect)(() => {
2728
+ useEffect11(() => {
2705
2729
  if (model3DNativeRef.current) {
2706
2730
  model3DNativeRef.current.setResizable(resizable);
2707
2731
  }
2708
2732
  }, [model3DNativeRef.current, resizable]);
2709
- (0, import_react24.useEffect)(() => {
2733
+ useEffect11(() => {
2710
2734
  if (model3DNativeRef.current) {
2711
2735
  model3DNativeRef.current.setAspectRatio(aspectRatio);
2712
2736
  }
@@ -2716,7 +2740,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2716
2740
  visibility: phase === "failure" ? "visible" : "hidden",
2717
2741
  transform: ""
2718
2742
  };
2719
- const proxyRef = (0, import_react24.useMemo)(
2743
+ const proxyRef = useMemo5(
2720
2744
  () => new Proxy(layoutInstanceRef, {
2721
2745
  get(target, prop, receiver) {
2722
2746
  return Reflect.get(target, prop, receiver);
@@ -2741,7 +2765,7 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2741
2765
  }),
2742
2766
  [layoutInstanceRef, refIn]
2743
2767
  );
2744
- (0, import_react24.useEffect)(() => {
2768
+ useEffect11(() => {
2745
2769
  return () => {
2746
2770
  if (layoutInstanceRef.current) {
2747
2771
  const modelElement = layoutInstanceRef.current;
@@ -2750,17 +2774,17 @@ function renderModel3DNotInSpatialDiv(props, refIn) {
2750
2774
  }
2751
2775
  };
2752
2776
  }, [modelUrl]);
2753
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className, style: layoutDomStyle, ref: proxyRef, children: phase === "failure" && children });
2777
+ return /* @__PURE__ */ jsx10("div", { className, style: layoutDomStyle, ref: proxyRef, children: phase === "failure" && children });
2754
2778
  }
2755
2779
 
2756
2780
  // src/spatial-react-components/Model3D/Model3DStandardInstance.tsx
2757
- var import_jsx_runtime10 = require("react/jsx-runtime");
2781
+ import { jsx as jsx11 } from "react/jsx-runtime";
2758
2782
  function renderModel3DStandardInstance(spatialId, props, refIn) {
2759
2783
  const { className, style } = props;
2760
2784
  const extraProps = {
2761
2785
  [SpatialID]: spatialId
2762
2786
  };
2763
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2787
+ return /* @__PURE__ */ jsx11(
2764
2788
  "div",
2765
2789
  {
2766
2790
  "data-model3d-spatialid": spatialId,
@@ -2773,28 +2797,33 @@ function renderModel3DStandardInstance(spatialId, props, refIn) {
2773
2797
  }
2774
2798
 
2775
2799
  // src/spatial-react-components/Model3D/Model3DPortalInstance.tsx
2776
- var import_react26 = require("react");
2800
+ import {
2801
+ useCallback as useCallback5,
2802
+ useContext as useContext7,
2803
+ useEffect as useEffect13,
2804
+ useMemo as useMemo6
2805
+ } from "react";
2777
2806
 
2778
2807
  // src/spatial-react-components/Model3D/useSyncDomInfoFromStandardInstance.ts
2779
- var import_react25 = require("react");
2808
+ import { useRef as useRef10, useEffect as useEffect12, useState as useState5, useContext as useContext6 } from "react";
2780
2809
  function useSyncDomInfoFromStandardInstance(spatialId) {
2781
- const [domRect, setDomRect] = (0, import_react25.useState)({
2810
+ const [domRect, setDomRect] = useState5({
2782
2811
  x: 0,
2783
2812
  y: 0,
2784
2813
  width: 0,
2785
2814
  height: 0
2786
2815
  });
2787
- const inheritedPortalStyleRef = (0, import_react25.useRef)({});
2788
- const anchorRef = (0, import_react25.useRef)({
2816
+ const inheritedPortalStyleRef = useRef10({});
2817
+ const anchorRef = useRef10({
2789
2818
  x: 0.5,
2790
2819
  y: 0.5,
2791
2820
  z: 0.5
2792
2821
  });
2793
- const opacityRef = (0, import_react25.useRef)(1);
2794
- const spatialReactContextObject = (0, import_react25.useContext)(SpatialReactContext);
2795
- const inheritedPortalClassNameRef = (0, import_react25.useRef)("");
2796
- const modelRef = (0, import_react25.useRef)(null);
2797
- (0, import_react25.useEffect)(() => {
2822
+ const opacityRef = useRef10(1);
2823
+ const spatialReactContextObject = useContext6(SpatialReactContext);
2824
+ const inheritedPortalClassNameRef = useRef10("");
2825
+ const modelRef = useRef10(null);
2826
+ useEffect12(() => {
2798
2827
  const syncDomRect = () => {
2799
2828
  const dom = spatialReactContextObject?.querySpatialDom(spatialId);
2800
2829
  if (!dom) {
@@ -2835,7 +2864,7 @@ function useSyncDomInfoFromStandardInstance(spatialId) {
2835
2864
  }
2836
2865
 
2837
2866
  // src/spatial-react-components/Model3D/Model3DPortalInstance.tsx
2838
- var import_jsx_runtime11 = require("react/jsx-runtime");
2867
+ import { Fragment as Fragment2, jsx as jsx12 } from "react/jsx-runtime";
2839
2868
  function useModelEvents(props, modelRef) {
2840
2869
  const {
2841
2870
  onDragStart,
@@ -2845,7 +2874,7 @@ function useModelEvents(props, modelRef) {
2845
2874
  onDoubleTap,
2846
2875
  onLongPress
2847
2876
  } = props;
2848
- const onDragStartCb = (0, import_react26.useCallback)(
2877
+ const onDragStartCb = useCallback5(
2849
2878
  (spatialDragEvent) => {
2850
2879
  if (onDragStart) {
2851
2880
  const dragEvent = {
@@ -2857,7 +2886,7 @@ function useModelEvents(props, modelRef) {
2857
2886
  },
2858
2887
  [onDragStart]
2859
2888
  );
2860
- const onDragCb = (0, import_react26.useCallback)(
2889
+ const onDragCb = useCallback5(
2861
2890
  (spatialDragEvent) => {
2862
2891
  if (onDrag) {
2863
2892
  const dragEvent = {
@@ -2869,7 +2898,7 @@ function useModelEvents(props, modelRef) {
2869
2898
  },
2870
2899
  [onDrag]
2871
2900
  );
2872
- const onDragEndCb = (0, import_react26.useCallback)(
2901
+ const onDragEndCb = useCallback5(
2873
2902
  (spatialDragEvent) => {
2874
2903
  if (onDragEnd) {
2875
2904
  const dragEvent = {
@@ -2881,7 +2910,7 @@ function useModelEvents(props, modelRef) {
2881
2910
  },
2882
2911
  [onDragEnd]
2883
2912
  );
2884
- const onTapCb = (0, import_react26.useCallback)(() => {
2913
+ const onTapCb = useCallback5(() => {
2885
2914
  if (onTap) {
2886
2915
  const event = {
2887
2916
  target: modelRef.current
@@ -2889,7 +2918,7 @@ function useModelEvents(props, modelRef) {
2889
2918
  onTap(event);
2890
2919
  }
2891
2920
  }, [onTap]);
2892
- const onDoubleTapCb = (0, import_react26.useCallback)(() => {
2921
+ const onDoubleTapCb = useCallback5(() => {
2893
2922
  if (onDoubleTap) {
2894
2923
  const event = {
2895
2924
  target: modelRef.current
@@ -2897,7 +2926,7 @@ function useModelEvents(props, modelRef) {
2897
2926
  onDoubleTap(event);
2898
2927
  }
2899
2928
  }, [onDoubleTap]);
2900
- const onLongPressCb = (0, import_react26.useCallback)(() => {
2929
+ const onLongPressCb = useCallback5(() => {
2901
2930
  if (onLongPress) {
2902
2931
  const event = {
2903
2932
  target: modelRef.current
@@ -2926,7 +2955,7 @@ function renderModel3DPortalInstance(spatialId, props) {
2926
2955
  onLoad,
2927
2956
  children
2928
2957
  } = props;
2929
- const theSpatialTransform = (0, import_react26.useMemo)(() => {
2958
+ const theSpatialTransform = useMemo6(() => {
2930
2959
  return PopulatePartialSpatialTransformType(spatialTransform);
2931
2960
  }, [spatialTransform]);
2932
2961
  const {
@@ -2937,7 +2966,7 @@ function renderModel3DPortalInstance(spatialId, props) {
2937
2966
  opacity,
2938
2967
  className
2939
2968
  } = useSyncDomInfoFromStandardInstance(spatialId);
2940
- const parentSpatialWindowManager = (0, import_react26.useContext)(SpatialWindowManagerContext);
2969
+ const parentSpatialWindowManager = useContext7(SpatialWindowManagerContext);
2941
2970
  const eventHandlers = useModelEvents(
2942
2971
  props,
2943
2972
  modelRef
@@ -2947,7 +2976,7 @@ function renderModel3DPortalInstance(spatialId, props) {
2947
2976
  parentSpatialWindowManager.entity,
2948
2977
  eventHandlers
2949
2978
  );
2950
- (0, import_react26.useEffect)(() => {
2979
+ useEffect13(() => {
2951
2980
  if (model3DNativeRef.current) {
2952
2981
  model3DNativeRef.current.updateRectAndTransform(
2953
2982
  domRect,
@@ -2955,37 +2984,37 @@ function renderModel3DPortalInstance(spatialId, props) {
2955
2984
  );
2956
2985
  }
2957
2986
  }, [model3DNativeRef.current, domRect, theSpatialTransform]);
2958
- (0, import_react26.useEffect)(() => {
2987
+ useEffect13(() => {
2959
2988
  if (model3DNativeRef.current) {
2960
2989
  model3DNativeRef.current.setRotationAnchor(anchor);
2961
2990
  }
2962
2991
  }, [model3DNativeRef.current, anchor]);
2963
- (0, import_react26.useEffect)(() => {
2992
+ useEffect13(() => {
2964
2993
  if (model3DNativeRef.current) {
2965
2994
  model3DNativeRef.current.setVisible(visible);
2966
2995
  }
2967
2996
  }, [model3DNativeRef.current, visible]);
2968
- (0, import_react26.useEffect)(() => {
2997
+ useEffect13(() => {
2969
2998
  if (model3DNativeRef.current) {
2970
2999
  model3DNativeRef.current.setContentMode(contentMode);
2971
3000
  }
2972
3001
  }, [model3DNativeRef.current, contentMode]);
2973
- (0, import_react26.useEffect)(() => {
3002
+ useEffect13(() => {
2974
3003
  if (model3DNativeRef.current) {
2975
3004
  model3DNativeRef.current.setResizable(resizable);
2976
3005
  }
2977
3006
  }, [model3DNativeRef.current, resizable]);
2978
- (0, import_react26.useEffect)(() => {
3007
+ useEffect13(() => {
2979
3008
  if (model3DNativeRef.current) {
2980
3009
  model3DNativeRef.current.setAspectRatio(aspectRatio);
2981
3010
  }
2982
3011
  }, [model3DNativeRef.current, aspectRatio]);
2983
- (0, import_react26.useEffect)(() => {
3012
+ useEffect13(() => {
2984
3013
  if (model3DNativeRef.current) {
2985
3014
  model3DNativeRef.current.setOpacity(opacity);
2986
3015
  }
2987
3016
  }, [model3DNativeRef.current, opacity]);
2988
- const onSuccess = (0, import_react26.useCallback)(() => {
3017
+ const onSuccess = useCallback5(() => {
2989
3018
  ;
2990
3019
  modelRef.current.ready = true;
2991
3020
  if (onLoad) {
@@ -2994,7 +3023,7 @@ function renderModel3DPortalInstance(spatialId, props) {
2994
3023
  });
2995
3024
  }
2996
3025
  }, [onLoad]);
2997
- const onFailure = (0, import_react26.useCallback)(
3026
+ const onFailure = useCallback5(
2998
3027
  (_2) => {
2999
3028
  const modelElement = modelRef.current;
3000
3029
  modelElement.ready = false;
@@ -3006,14 +3035,14 @@ function renderModel3DPortalInstance(spatialId, props) {
3006
3035
  },
3007
3036
  [onLoad]
3008
3037
  );
3009
- (0, import_react26.useEffect)(() => {
3038
+ useEffect13(() => {
3010
3039
  if (phase === "failure") {
3011
3040
  onFailure(failureReason);
3012
3041
  } else if (phase === "success") {
3013
3042
  onSuccess();
3014
3043
  }
3015
3044
  }, [phase]);
3016
- (0, import_react26.useEffect)(() => {
3045
+ useEffect13(() => {
3017
3046
  return () => {
3018
3047
  const modelElement = modelRef.current;
3019
3048
  if (modelElement) {
@@ -3024,7 +3053,7 @@ function renderModel3DPortalInstance(spatialId, props) {
3024
3053
  }, [modelUrl]);
3025
3054
  const needRenderPlaceHolder = inheritedPortalStyle.position !== "absolute";
3026
3055
  if (!needRenderPlaceHolder && phase !== "failure") {
3027
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, {});
3056
+ return /* @__PURE__ */ jsx12(Fragment2, {});
3028
3057
  } else {
3029
3058
  const extraStyle = {
3030
3059
  visibility: "visible",
@@ -3044,7 +3073,7 @@ function renderModel3DPortalInstance(spatialId, props) {
3044
3073
  ...inheritedPortalStyle,
3045
3074
  ...extraStyle
3046
3075
  };
3047
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3076
+ return /* @__PURE__ */ jsx12(
3048
3077
  "div",
3049
3078
  {
3050
3079
  "data-model3d-spatialid": spatialId,
@@ -3058,12 +3087,12 @@ function renderModel3DPortalInstance(spatialId, props) {
3058
3087
 
3059
3088
  // src/spatial-react-components/Model3D/Model3D.tsx
3060
3089
  function Model3DBase(props, refIn) {
3061
- const parentSpatialReactContextObject = (0, import_react27.useContext)(SpatialReactContext);
3090
+ const parentSpatialReactContextObject = useContext8(SpatialReactContext);
3062
3091
  const isInSpatialDiv = !!parentSpatialReactContextObject;
3063
3092
  if (isInSpatialDiv) {
3064
- const layer = (0, import_react27.useContext)(SpatialLayerContext) + 1;
3065
- const isInStandardInstance = !!(0, import_react27.useContext)(SpatialIsStandardInstanceContext);
3066
- const spatialId = (0, import_react27.useMemo)(() => {
3093
+ const layer = useContext8(SpatialLayerContext) + 1;
3094
+ const isInStandardInstance = !!useContext8(SpatialIsStandardInstanceContext);
3095
+ const spatialId = useMemo7(() => {
3067
3096
  return parentSpatialReactContextObject.getSpatialID(
3068
3097
  layer,
3069
3098
  isInStandardInstance,
@@ -3079,21 +3108,22 @@ function Model3DBase(props, refIn) {
3079
3108
  return renderModel3DNotInSpatialDiv(props, refIn);
3080
3109
  }
3081
3110
  }
3082
- var Model3D = (0, import_react27.forwardRef)(Model3DBase);
3111
+ var Model3D = forwardRef9(Model3DBase);
3083
3112
  Model3D.displayName = "Model3D";
3084
3113
 
3085
3114
  // src/spatial-react-components/Model3D/CSSModel3D.tsx
3086
- var import_react30 = require("react");
3115
+ import { forwardRef as forwardRef10, useContext as useContext11, useMemo as useMemo8 } from "react";
3087
3116
 
3088
3117
  // src/spatial-react-components/Model3D/CSSModel3DNotInSpatialDiv.tsx
3089
- var import_jsx_runtime12 = require("react/jsx-runtime");
3118
+ import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
3090
3119
  function renderCSSModel3DNotInSpatialDiv(inProps, refIn) {
3091
3120
  const { className, style = {}, ...props } = inProps;
3092
3121
  const cssParserDomStyle = {
3093
3122
  ...style,
3094
3123
  width: 0,
3095
3124
  height: 0,
3096
- padding: 0
3125
+ padding: 0,
3126
+ position: "absolute"
3097
3127
  };
3098
3128
  const { ref: cssParserDomRef, spatialStyle, ready } = useSpatialStyle();
3099
3129
  const ref = useHijackSpatialDivRef(
@@ -3110,8 +3140,8 @@ function renderCSSModel3DNotInSpatialDiv(inProps, refIn) {
3110
3140
  ...style,
3111
3141
  transform: "none"
3112
3142
  };
3113
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3114
- ready && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3143
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3144
+ ready && /* @__PURE__ */ jsx13(
3115
3145
  Model3D,
3116
3146
  {
3117
3147
  className,
@@ -3122,7 +3152,7 @@ function renderCSSModel3DNotInSpatialDiv(inProps, refIn) {
3122
3152
  ...props
3123
3153
  }
3124
3154
  ),
3125
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3155
+ /* @__PURE__ */ jsx13(
3126
3156
  "div",
3127
3157
  {
3128
3158
  className,
@@ -3134,8 +3164,8 @@ function renderCSSModel3DNotInSpatialDiv(inProps, refIn) {
3134
3164
  }
3135
3165
 
3136
3166
  // src/spatial-react-components/Model3D/CSSModel3DStandardInstance.tsx
3137
- var import_react28 = require("react");
3138
- var import_jsx_runtime13 = require("react/jsx-runtime");
3167
+ import { useContext as useContext9, useEffect as useEffect14, useRef as useRef11 } from "react";
3168
+ import { jsx as jsx14 } from "react/jsx-runtime";
3139
3169
  function renderCSSModel3DStandardInstance(spatialId, inProps, refIn) {
3140
3170
  const { style: inStyle = {}, ...props } = inProps;
3141
3171
  const style = {
@@ -3143,13 +3173,13 @@ function renderCSSModel3DStandardInstance(spatialId, inProps, refIn) {
3143
3173
  transform: "none",
3144
3174
  visibility: "hidden"
3145
3175
  };
3146
- var cssParserRef = (0, import_react28.useRef)(null);
3176
+ var cssParserRef = useRef11(null);
3147
3177
  const ref = useHijackSpatialDivRef(
3148
3178
  refIn,
3149
3179
  cssParserRef
3150
3180
  );
3151
- const rootSpatialReactContextObject = (0, import_react28.useContext)(SpatialReactContext);
3152
- (0, import_react28.useEffect)(() => {
3181
+ const rootSpatialReactContextObject = useContext9(SpatialReactContext);
3182
+ useEffect14(() => {
3153
3183
  const onSubEvent = (dom) => {
3154
3184
  cssParserRef.current = dom;
3155
3185
  };
@@ -3158,15 +3188,15 @@ function renderCSSModel3DStandardInstance(spatialId, inProps, refIn) {
3158
3188
  rootSpatialReactContextObject.offSubDivEvent(spatialId);
3159
3189
  };
3160
3190
  }, []);
3161
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Model3D, { style, ...props, ref, visible: true });
3191
+ return /* @__PURE__ */ jsx14(Model3D, { style, ...props, ref, visible: true });
3162
3192
  }
3163
3193
 
3164
3194
  // src/spatial-react-components/Model3D/CSSModel3DPortalInstance.tsx
3165
- var import_react29 = require("react");
3166
- var import_jsx_runtime14 = require("react/jsx-runtime");
3195
+ import { useContext as useContext10, useEffect as useEffect15 } from "react";
3196
+ import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
3167
3197
  function renderCSSModel3DPortalInstance(spatialId, inProps) {
3168
3198
  const { className, style = {}, ...props } = inProps;
3169
- const rootSpatialReactContextObject = (0, import_react29.useContext)(SpatialReactContext);
3199
+ const rootSpatialReactContextObject = useContext10(SpatialReactContext);
3170
3200
  const { ref, spatialStyle, ready } = useSpatialStyle();
3171
3201
  const spatialTransform = {
3172
3202
  position: spatialStyle.position,
@@ -3174,21 +3204,22 @@ function renderCSSModel3DPortalInstance(spatialId, inProps) {
3174
3204
  scale: spatialStyle.scale
3175
3205
  };
3176
3206
  const visible = spatialStyle.visible;
3177
- (0, import_react29.useEffect)(() => {
3207
+ useEffect15(() => {
3178
3208
  rootSpatialReactContextObject.notifySubDivEvent(spatialId, ref.current);
3179
3209
  }, [ref.current]);
3180
3210
  const cssParserDomStyle = {
3181
3211
  ...style,
3182
3212
  width: 0,
3183
3213
  height: 0,
3184
- padding: 0
3214
+ padding: 0,
3215
+ position: "absolute"
3185
3216
  };
3186
3217
  const model3DStyle = {
3187
3218
  ...style,
3188
3219
  transform: "none"
3189
3220
  };
3190
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
3191
- ready && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3221
+ return /* @__PURE__ */ jsxs5(Fragment4, { children: [
3222
+ ready && /* @__PURE__ */ jsx15(
3192
3223
  Model3D,
3193
3224
  {
3194
3225
  className,
@@ -3198,18 +3229,18 @@ function renderCSSModel3DPortalInstance(spatialId, inProps) {
3198
3229
  ...props
3199
3230
  }
3200
3231
  ),
3201
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className, style: cssParserDomStyle, ref })
3232
+ /* @__PURE__ */ jsx15("div", { className, style: cssParserDomStyle, ref })
3202
3233
  ] });
3203
3234
  }
3204
3235
 
3205
3236
  // src/spatial-react-components/Model3D/CSSModel3D.tsx
3206
3237
  function CSSModel3DBase(props, refIn) {
3207
- const rootSpatialReactContextObject = (0, import_react30.useContext)(SpatialReactContext);
3238
+ const rootSpatialReactContextObject = useContext11(SpatialReactContext);
3208
3239
  const isInSpatialDiv = !!rootSpatialReactContextObject;
3209
3240
  if (isInSpatialDiv) {
3210
- const layer = (0, import_react30.useContext)(SpatialLayerContext) + 1;
3211
- const isInStandardInstance = !!(0, import_react30.useContext)(SpatialIsStandardInstanceContext);
3212
- const spatialId = (0, import_react30.useMemo)(() => {
3241
+ const layer = useContext11(SpatialLayerContext) + 1;
3242
+ const isInStandardInstance = !!useContext11(SpatialIsStandardInstanceContext);
3243
+ const spatialId = useMemo8(() => {
3213
3244
  return rootSpatialReactContextObject.getSubDivSpatialID(
3214
3245
  layer,
3215
3246
  isInStandardInstance,
@@ -3225,14 +3256,14 @@ function CSSModel3DBase(props, refIn) {
3225
3256
  return renderCSSModel3DNotInSpatialDiv(props, refIn);
3226
3257
  }
3227
3258
  }
3228
- var CSSModel3D = (0, import_react30.forwardRef)(CSSModel3DBase);
3259
+ var CSSModel3D = forwardRef10(CSSModel3DBase);
3229
3260
  CSSModel3D.displayName = "CSSModel3D";
3230
3261
 
3231
3262
  // src/spatial-react-components/Model/index.tsx
3232
- var import_jsx_runtime15 = require("react/jsx-runtime");
3263
+ import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
3233
3264
  function renderInModel3D(inProps, ref, modelUrl, placeHolder) {
3234
3265
  const { poster, ...props } = inProps;
3235
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(CSSModel3D, { modelUrl, ...props, ref, children: [
3266
+ return /* @__PURE__ */ jsxs6(CSSModel3D, { modelUrl, ...props, ref, children: [
3236
3267
  " ",
3237
3268
  placeHolder,
3238
3269
  " "
@@ -3242,7 +3273,7 @@ function parseChildren(child) {
3242
3273
  if (child === void 0) {
3243
3274
  throw new Error("children with <source> required ");
3244
3275
  }
3245
- const children = import_react31.Children.toArray(child);
3276
+ const children = Children.toArray(child);
3246
3277
  const sourceElements = children.filter(
3247
3278
  (node) => node.type === "source"
3248
3279
  );
@@ -3271,21 +3302,22 @@ function parseChildren(child) {
3271
3302
  }
3272
3303
  function ModelBase(inProps, ref) {
3273
3304
  const { children, ...props } = inProps;
3274
- const { placeHolder, gltfSourceURL, usdzSourceURL } = (0, import_react31.useMemo)(
3305
+ const { placeHolder, gltfSourceURL, usdzSourceURL } = useMemo9(
3275
3306
  () => parseChildren(children),
3276
3307
  [children]
3277
3308
  );
3278
3309
  const isWebEnv = !getSession();
3279
3310
  if (isWebEnv) {
3280
- const myModelViewer = (0, import_react31.useRef)(null);
3311
+ const myModelViewer = useRef12(null);
3281
3312
  const { className, style = {}, ...props2 } = inProps;
3282
- let [modelViewerExists, setModelViewerExists] = (0, import_react31.useState)(false);
3283
- (0, import_react31.useEffect)(() => {
3313
+ const isDragging = useRef12(false);
3314
+ let [modelViewerExists, setModelViewerExists] = useState6(false);
3315
+ useEffect16(() => {
3284
3316
  customElements.whenDefined("model-viewer").then(function() {
3285
3317
  setModelViewerExists(true);
3286
3318
  });
3287
3319
  }, []);
3288
- (0, import_react31.useEffect)(() => {
3320
+ useEffect16(() => {
3289
3321
  if (!modelViewerExists) {
3290
3322
  return;
3291
3323
  }
@@ -3306,6 +3338,7 @@ function ModelBase(inProps, ref) {
3306
3338
  }
3307
3339
  });
3308
3340
  myModelViewer.current.addEventListener("pointerdown", (event) => {
3341
+ isDragging.current = true;
3309
3342
  if (props2.onDragStart) {
3310
3343
  props2.onDragStart({
3311
3344
  eventType: "dragstart",
@@ -3316,6 +3349,9 @@ function ModelBase(inProps, ref) {
3316
3349
  }
3317
3350
  });
3318
3351
  myModelViewer.current.addEventListener("pointermove", (event) => {
3352
+ if (!isDragging.current) {
3353
+ return;
3354
+ }
3319
3355
  if (props2.onDrag) {
3320
3356
  props2.onDrag({
3321
3357
  eventType: "drag",
@@ -3326,6 +3362,10 @@ function ModelBase(inProps, ref) {
3326
3362
  }
3327
3363
  });
3328
3364
  myModelViewer.current.addEventListener("pointerup", (event) => {
3365
+ if (!isDragging.current) {
3366
+ return;
3367
+ }
3368
+ isDragging.current = false;
3329
3369
  if (props2.onDragEnd) {
3330
3370
  props2.onDragEnd({
3331
3371
  eventType: "dragend",
@@ -3336,7 +3376,7 @@ function ModelBase(inProps, ref) {
3336
3376
  }
3337
3377
  });
3338
3378
  }, [modelViewerExists]);
3339
- (0, import_react31.useEffect)(() => {
3379
+ useEffect16(() => {
3340
3380
  if (props2.contentMode !== void 0 && props2.contentMode !== "fit") {
3341
3381
  console.warn(
3342
3382
  "Model element contentMode != fit isn't supported on 2D screens"
@@ -3353,7 +3393,7 @@ function ModelBase(inProps, ref) {
3353
3393
  );
3354
3394
  }
3355
3395
  }, [props2.contentMode, props2.resizable, props2.aspectRatio]);
3356
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref, className, style, children: modelViewerExists ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3396
+ return /* @__PURE__ */ jsx16("div", { ref, className, style, children: modelViewerExists ? /* @__PURE__ */ jsx16(
3357
3397
  "model-viewer",
3358
3398
  {
3359
3399
  ref: myModelViewer,
@@ -3366,15 +3406,14 @@ function ModelBase(inProps, ref) {
3366
3406
  "touch-action": "pan-y",
3367
3407
  poster: props2.poster
3368
3408
  }
3369
- ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, {}) });
3409
+ ) : /* @__PURE__ */ jsx16(Fragment5, {}) });
3370
3410
  } else {
3371
3411
  return renderInModel3D(props, ref, usdzSourceURL, placeHolder);
3372
3412
  }
3373
3413
  }
3374
- var Model = (0, import_react31.forwardRef)(ModelBase);
3414
+ var Model = forwardRef11(ModelBase);
3375
3415
  Model.displayName = "Model";
3376
- // Annotate the CommonJS export names for ESM import in node:
3377
- 0 && (module.exports = {
3416
+ export {
3378
3417
  CSSSpatialDiv,
3379
3418
  CSSSpatialPrimitive,
3380
3419
  Model,
@@ -3390,6 +3429,7 @@ Model.displayName = "Model";
3390
3429
  notifyUpdateStandInstanceLayout,
3391
3430
  parseCornerRadius,
3392
3431
  withCSSSpatial,
3393
- withSpatial
3394
- });
3432
+ withSpatial,
3433
+ withSpatialMonitor
3434
+ };
3395
3435
  //# sourceMappingURL=index.js.map