@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.
- package/dist/default/index.d.ts +7 -7
- package/dist/default/index.js +376 -336
- package/dist/default/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js +29 -63
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.js +29 -63
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/web/index.d.ts +7 -7
- package/dist/web/index.js +376 -336
- package/dist/web/index.js.map +1 -1
- package/npm/plugin/esbuild.js +2 -3
- package/package.json +8 -23
- package/dist/default/index.d.mts +0 -164
- package/dist/default/index.mjs +0 -3379
- package/dist/default/index.mjs.map +0 -1
- package/dist/jsx/jsx-dev-runtime.d.mts +0 -4
- package/dist/jsx/jsx-dev-runtime.mjs +0 -256
- package/dist/jsx/jsx-dev-runtime.mjs.map +0 -1
- package/dist/jsx/jsx-runtime-C06ExmCC.d.mts +0 -9
- package/dist/jsx/jsx-runtime.d.mts +0 -4
- package/dist/jsx/jsx-runtime.mjs +0 -256
- package/dist/jsx/jsx-runtime.mjs.map +0 -1
- package/dist/web/index.d.mts +0 -164
- package/dist/web/index.mjs +0 -3379
- package/dist/web/index.mjs.map +0 -1
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
// src/jsx/spatialPolyfill.ts
|
|
2
|
-
import { getSession as getSession2, parseCornerRadius, XRApp as XRApp2 } from "@webspatial/react-sdk";
|
|
3
|
-
|
|
4
|
-
// src/jsx/injectSceneHook.ts
|
|
5
|
-
import { defaultSceneConfig, XRApp, getSession } from "@webspatial/react-sdk";
|
|
6
|
-
async function injectSceneHook() {
|
|
7
|
-
if (!window.opener) return;
|
|
8
|
-
if (window._SceneHookOff) return;
|
|
9
|
-
await getSession()?.setLoading("show");
|
|
10
|
-
function onContentLoaded(callback) {
|
|
11
|
-
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
12
|
-
callback();
|
|
13
|
-
} else {
|
|
14
|
-
document.addEventListener("DOMContentLoaded", callback);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
onContentLoaded(async () => {
|
|
18
|
-
let cfg = defaultSceneConfig;
|
|
19
|
-
if (typeof window.xrCurrentSceneDefaults === "function") {
|
|
20
|
-
try {
|
|
21
|
-
cfg = await window.xrCurrentSceneDefaults?.();
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error(error);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
await new Promise((resolve, reject) => {
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
resolve(null);
|
|
29
|
-
}, 1e3);
|
|
30
|
-
});
|
|
31
|
-
await getSession()?.setLoading("hide");
|
|
32
|
-
await XRApp.getInstance().show(window, cfg);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// src/jsx/spatialPolyfill.ts
|
|
37
|
-
var isWebSpatialEnv = getSession2() !== null;
|
|
38
|
-
var SpatialGlobalCustomVars = {
|
|
39
|
-
backgroundMaterial: "--xr-background-material"
|
|
40
|
-
};
|
|
41
|
-
var htmlBackgroundMaterial = "";
|
|
42
|
-
function setCurrentWindowStyle(backgroundMaterial) {
|
|
43
|
-
if (backgroundMaterial !== htmlBackgroundMaterial) {
|
|
44
|
-
const session = getSession2();
|
|
45
|
-
session.getCurrentWindowComponent().setStyle({
|
|
46
|
-
material: { type: backgroundMaterial }
|
|
47
|
-
});
|
|
48
|
-
htmlBackgroundMaterial = backgroundMaterial;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function checkHtmlBackgroundMaterial() {
|
|
52
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
53
|
-
const backgroundMaterial = computedStyle.getPropertyValue(
|
|
54
|
-
SpatialGlobalCustomVars.backgroundMaterial
|
|
55
|
-
);
|
|
56
|
-
setCurrentWindowStyle(backgroundMaterial || "none");
|
|
57
|
-
}
|
|
58
|
-
var htmlCornerRadius = {
|
|
59
|
-
topLeading: 0,
|
|
60
|
-
bottomLeading: 0,
|
|
61
|
-
topTrailing: 0,
|
|
62
|
-
bottomTrailing: 0
|
|
63
|
-
};
|
|
64
|
-
function checkCornerRadius() {
|
|
65
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
66
|
-
const cornerRadius = parseCornerRadius(computedStyle);
|
|
67
|
-
setCornerRadius(cornerRadius);
|
|
68
|
-
}
|
|
69
|
-
function setCornerRadius(cornerRadius) {
|
|
70
|
-
if (htmlCornerRadius.topLeading !== cornerRadius.topLeading || htmlCornerRadius.bottomLeading !== cornerRadius.bottomLeading || htmlCornerRadius.topTrailing !== cornerRadius.topTrailing || htmlCornerRadius.bottomTrailing !== cornerRadius.bottomTrailing) {
|
|
71
|
-
const session = getSession2();
|
|
72
|
-
if (!session) return;
|
|
73
|
-
session.getCurrentWindowComponent().setStyle({
|
|
74
|
-
cornerRadius
|
|
75
|
-
});
|
|
76
|
-
htmlCornerRadius.topLeading = cornerRadius.topLeading;
|
|
77
|
-
htmlCornerRadius.bottomLeading = cornerRadius.bottomLeading;
|
|
78
|
-
htmlCornerRadius.topTrailing = cornerRadius.topTrailing;
|
|
79
|
-
htmlCornerRadius.bottomTrailing = cornerRadius.bottomTrailing;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function setOpacity(opacity) {
|
|
83
|
-
const session = getSession2();
|
|
84
|
-
if (!session) return;
|
|
85
|
-
session.getCurrentWindowComponent().setOpacity(opacity);
|
|
86
|
-
}
|
|
87
|
-
function checkOpacity() {
|
|
88
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
89
|
-
const opacity = parseFloat(computedStyle.getPropertyValue("opacity"));
|
|
90
|
-
setOpacity(opacity);
|
|
91
|
-
}
|
|
92
|
-
async function setHtmlVisible(visible) {
|
|
93
|
-
const session = getSession2();
|
|
94
|
-
if (!session) return;
|
|
95
|
-
const wc = session.getCurrentWindowComponent();
|
|
96
|
-
const ent = await wc.getEntity();
|
|
97
|
-
ent?.setVisible(visible);
|
|
98
|
-
}
|
|
99
|
-
function checkHtmlVisible() {
|
|
100
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
101
|
-
const visibility = computedStyle.getPropertyValue("visibility") !== "hidden";
|
|
102
|
-
const widthGtZero = parseFloat(computedStyle.getPropertyValue("width")) > 0;
|
|
103
|
-
setHtmlVisible(visibility && widthGtZero);
|
|
104
|
-
}
|
|
105
|
-
function hijackDocumentElementStyle() {
|
|
106
|
-
const rawDocumentStyle = document.documentElement.style;
|
|
107
|
-
const styleProxy = new Proxy(rawDocumentStyle, {
|
|
108
|
-
set: function(target, key, value) {
|
|
109
|
-
const ret = Reflect.set(target, key, value);
|
|
110
|
-
if (key === SpatialGlobalCustomVars.backgroundMaterial) {
|
|
111
|
-
setCurrentWindowStyle(value);
|
|
112
|
-
}
|
|
113
|
-
if (key === "border-radius" || key === "borderRadius" || key === "border-top-left-radius" || key === "borderTopLeftRadius" || key === "border-top-right-radius" || key === "borderTopRightRadius" || key === "border-bottom-left-radius" || key === "borderBottomLeftRadius" || key === "border-bottom-right-radius" || key === "borderBottomRightRadius") {
|
|
114
|
-
checkCornerRadius();
|
|
115
|
-
}
|
|
116
|
-
if (key === "opacity") {
|
|
117
|
-
checkOpacity();
|
|
118
|
-
}
|
|
119
|
-
if (key === "visibility" || key === "display") {
|
|
120
|
-
checkHtmlVisible();
|
|
121
|
-
}
|
|
122
|
-
return ret;
|
|
123
|
-
},
|
|
124
|
-
get: function(target, prop) {
|
|
125
|
-
if (typeof target[prop] === "function") {
|
|
126
|
-
return function(...args) {
|
|
127
|
-
if (prop === "setProperty") {
|
|
128
|
-
const [property, value] = args;
|
|
129
|
-
if (property === SpatialGlobalCustomVars.backgroundMaterial) {
|
|
130
|
-
setCurrentWindowStyle(value);
|
|
131
|
-
}
|
|
132
|
-
} else if (prop === "removeProperty") {
|
|
133
|
-
const [property] = args;
|
|
134
|
-
if (property === SpatialGlobalCustomVars.backgroundMaterial) {
|
|
135
|
-
setCurrentWindowStyle("none");
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return target[prop](
|
|
139
|
-
...args
|
|
140
|
-
);
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return Reflect.get(target, prop);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
Object.defineProperty(document.documentElement, "style", {
|
|
147
|
-
get: function() {
|
|
148
|
-
return styleProxy;
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
function monitorExternalStyleChange() {
|
|
153
|
-
const headObserver = new MutationObserver(function(mutationsList) {
|
|
154
|
-
for (const mutation of mutationsList) {
|
|
155
|
-
if (mutation.type === "childList") {
|
|
156
|
-
let needCheck = false;
|
|
157
|
-
mutation.addedNodes.forEach((node) => {
|
|
158
|
-
if (node.nodeName === "LINK" && node.rel === "stylesheet") {
|
|
159
|
-
needCheck = true;
|
|
160
|
-
}
|
|
161
|
-
if (node.nodeName === "STYLE") {
|
|
162
|
-
needCheck = true;
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
mutation.removedNodes.forEach((node) => {
|
|
166
|
-
if (node.nodeName === "LINK" && node.rel === "stylesheet") {
|
|
167
|
-
needCheck = true;
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
if (needCheck) {
|
|
171
|
-
checkCSSProperties();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
headObserver.observe(document.head, { childList: true, subtree: true });
|
|
177
|
-
}
|
|
178
|
-
function checkCSSProperties() {
|
|
179
|
-
checkHtmlBackgroundMaterial();
|
|
180
|
-
checkCornerRadius();
|
|
181
|
-
checkOpacity();
|
|
182
|
-
checkHtmlVisible();
|
|
183
|
-
window.addEventListener("resize", checkHtmlVisible);
|
|
184
|
-
}
|
|
185
|
-
function hijackGetComputedStyle() {
|
|
186
|
-
const rawFn = window.getComputedStyle.bind(window);
|
|
187
|
-
window.getComputedStyle = (element, pseudoElt) => {
|
|
188
|
-
if (element.__isSpatialDiv) {
|
|
189
|
-
return element.__getComputedStyle(rawFn, pseudoElt);
|
|
190
|
-
}
|
|
191
|
-
return rawFn(element, pseudoElt);
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function hijackWindowOpen() {
|
|
195
|
-
XRApp2.getInstance().init();
|
|
196
|
-
}
|
|
197
|
-
function spatialPolyfill() {
|
|
198
|
-
if (!isWebSpatialEnv) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
injectSceneHook();
|
|
202
|
-
hijackWindowOpen();
|
|
203
|
-
checkCSSProperties();
|
|
204
|
-
hijackGetComputedStyle();
|
|
205
|
-
hijackDocumentElementStyle();
|
|
206
|
-
monitorExternalStyleChange();
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// src/jsx/jsx-dev-runtime.ts
|
|
210
|
-
import { Fragment } from "react/jsx-runtime";
|
|
211
|
-
|
|
212
|
-
// src/jsx/jsx-shared.ts
|
|
213
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
214
|
-
import reactJSXRuntime from "react/jsx-runtime";
|
|
215
|
-
import { withCSSSpatial } from "@webspatial/react-sdk";
|
|
216
|
-
var attributeFlag = "enable-xr";
|
|
217
|
-
var styleFlag = "enableXr";
|
|
218
|
-
var classFlag = "__enableXr__";
|
|
219
|
-
function replaceToSpatialPrimitiveType(type, props) {
|
|
220
|
-
const propsObject = props;
|
|
221
|
-
if (attributeFlag in propsObject) {
|
|
222
|
-
delete propsObject[attributeFlag];
|
|
223
|
-
return withCSSSpatial(type);
|
|
224
|
-
}
|
|
225
|
-
if (propsObject && propsObject.style && styleFlag in propsObject.style) {
|
|
226
|
-
delete propsObject.style[styleFlag];
|
|
227
|
-
return withCSSSpatial(type);
|
|
228
|
-
}
|
|
229
|
-
if (propsObject && propsObject.className) {
|
|
230
|
-
const originalClassNames = propsObject.className.split(" ");
|
|
231
|
-
const idx = originalClassNames.indexOf(classFlag);
|
|
232
|
-
if (idx !== -1) {
|
|
233
|
-
originalClassNames.splice(idx, 1);
|
|
234
|
-
propsObject.className = originalClassNames.join(" ");
|
|
235
|
-
return withCSSSpatial(type);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return type;
|
|
239
|
-
}
|
|
240
|
-
function jsx(type, props, key) {
|
|
241
|
-
type = replaceToSpatialPrimitiveType(type, props);
|
|
242
|
-
return reactJSXRuntime.jsx(type, props, key);
|
|
243
|
-
}
|
|
244
|
-
function jsxDEV(type, props, key, isStatic, source, self) {
|
|
245
|
-
type = replaceToSpatialPrimitiveType(type, props);
|
|
246
|
-
return _jsxDEV(type, props, key, isStatic, source, self);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// src/jsx/jsx-dev-runtime.ts
|
|
250
|
-
spatialPolyfill();
|
|
251
|
-
export {
|
|
252
|
-
Fragment,
|
|
253
|
-
jsx,
|
|
254
|
-
jsxDEV
|
|
255
|
-
};
|
|
256
|
-
//# sourceMappingURL=jsx-dev-runtime.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/jsx/spatialPolyfill.ts","../../src/jsx/injectSceneHook.ts","../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-shared.ts"],"sourcesContent":["import { getSession, parseCornerRadius, XRApp } from '@webspatial/react-sdk'\nimport { injectSceneHook } from './injectSceneHook'\n\nconst isWebSpatialEnv = getSession() !== null\n\nconst SpatialGlobalCustomVars = {\n backgroundMaterial: '--xr-background-material',\n}\n\n// keep track of current html background material\nlet htmlBackgroundMaterial = ''\nfunction setCurrentWindowStyle(backgroundMaterial: string) {\n if (backgroundMaterial !== htmlBackgroundMaterial) {\n const session = getSession()!\n session.getCurrentWindowComponent().setStyle({\n material: { type: backgroundMaterial as any },\n })\n htmlBackgroundMaterial = backgroundMaterial\n }\n}\n\nfunction checkHtmlBackgroundMaterial() {\n const computedStyle = getComputedStyle(document.documentElement)\n\n const backgroundMaterial = computedStyle.getPropertyValue(\n SpatialGlobalCustomVars.backgroundMaterial,\n )\n\n setCurrentWindowStyle(backgroundMaterial || 'none')\n}\n\n// keep track of current corner radius\nlet htmlCornerRadius = {\n topLeading: 0,\n bottomLeading: 0,\n topTrailing: 0,\n bottomTrailing: 0,\n}\nfunction checkCornerRadius() {\n const computedStyle = getComputedStyle(document.documentElement)\n const cornerRadius = parseCornerRadius(computedStyle)\n setCornerRadius(cornerRadius)\n}\n\nfunction setCornerRadius(cornerRadius: any) {\n if (\n htmlCornerRadius.topLeading !== cornerRadius.topLeading ||\n htmlCornerRadius.bottomLeading !== cornerRadius.bottomLeading ||\n htmlCornerRadius.topTrailing !== cornerRadius.topTrailing ||\n htmlCornerRadius.bottomTrailing !== cornerRadius.bottomTrailing\n ) {\n const session = getSession()!\n if (!session) return\n session.getCurrentWindowComponent().setStyle({\n cornerRadius,\n })\n htmlCornerRadius.topLeading = cornerRadius.topLeading\n htmlCornerRadius.bottomLeading = cornerRadius.bottomLeading\n htmlCornerRadius.topTrailing = cornerRadius.topTrailing\n htmlCornerRadius.bottomTrailing = cornerRadius.bottomTrailing\n }\n}\n\nfunction setOpacity(opacity: number) {\n const session = getSession()!\n if (!session) return\n session.getCurrentWindowComponent().setOpacity(opacity)\n}\n\nfunction checkOpacity() {\n const computedStyle = getComputedStyle(document.documentElement)\n const opacity = parseFloat(computedStyle.getPropertyValue('opacity'))\n setOpacity(opacity)\n}\n\nasync function setHtmlVisible(visible: boolean) {\n const session = getSession()!\n if (!session) return\n const wc = session.getCurrentWindowComponent()\n const ent = await wc.getEntity()\n ent?.setVisible(visible)\n}\n\nfunction checkHtmlVisible() {\n const computedStyle = getComputedStyle(document.documentElement)\n const visibility = computedStyle.getPropertyValue('visibility') !== 'hidden'\n const widthGtZero = parseFloat(computedStyle.getPropertyValue('width')) > 0\n setHtmlVisible(visibility && widthGtZero)\n}\n\nfunction hijackDocumentElementStyle() {\n const rawDocumentStyle = document.documentElement.style\n const styleProxy = new Proxy(rawDocumentStyle, {\n set: function (target, key, value) {\n const ret = Reflect.set(target, key, value)\n\n if (key === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle(value)\n }\n\n if (\n key === 'border-radius' ||\n key === 'borderRadius' ||\n key === 'border-top-left-radius' ||\n key === 'borderTopLeftRadius' ||\n key === 'border-top-right-radius' ||\n key === 'borderTopRightRadius' ||\n key === 'border-bottom-left-radius' ||\n key === 'borderBottomLeftRadius' ||\n key === 'border-bottom-right-radius' ||\n key === 'borderBottomRightRadius'\n ) {\n checkCornerRadius()\n }\n\n if (key === 'opacity') {\n checkOpacity()\n }\n\n if (key === 'visibility' || key === 'display') {\n checkHtmlVisible()\n }\n\n return ret\n },\n get: function (target, prop: string) {\n if (typeof target[prop as keyof CSSStyleDeclaration] === 'function') {\n return function (this: any, ...args: any[]) {\n if (prop === 'setProperty') {\n const [property, value] = args\n if (property === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle(value)\n }\n } else if (prop === 'removeProperty') {\n const [property] = args\n if (property === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle('none')\n }\n }\n return (target[prop as keyof CSSStyleDeclaration] as Function)(\n ...args,\n )\n }\n }\n return Reflect.get(target, prop)\n },\n })\n Object.defineProperty(document.documentElement, 'style', {\n get: function () {\n return styleProxy\n },\n })\n}\n\nfunction monitorExternalStyleChange() {\n const headObserver = new MutationObserver(function (mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n let needCheck = false\n mutation.addedNodes.forEach(node => {\n if (\n node.nodeName === 'LINK' &&\n (node as HTMLLinkElement).rel === 'stylesheet'\n ) {\n needCheck = true\n }\n\n if (node.nodeName === 'STYLE') {\n needCheck = true\n }\n })\n\n mutation.removedNodes.forEach(node => {\n if (\n node.nodeName === 'LINK' &&\n (node as HTMLLinkElement).rel === 'stylesheet'\n ) {\n needCheck = true\n }\n })\n\n if (needCheck) {\n checkCSSProperties()\n }\n }\n }\n })\n\n headObserver.observe(document.head, { childList: true, subtree: true })\n}\n\nfunction checkCSSProperties() {\n checkHtmlBackgroundMaterial()\n checkCornerRadius()\n checkOpacity()\n checkHtmlVisible()\n window.addEventListener('resize', checkHtmlVisible)\n}\n\nfunction hijackGetComputedStyle() {\n const rawFn = window.getComputedStyle.bind(window)\n window.getComputedStyle = (element, pseudoElt) => {\n if ((element as any).__isSpatialDiv) {\n return (element as any).__getComputedStyle(rawFn, pseudoElt)\n }\n return rawFn(element, pseudoElt)\n }\n}\n\nfunction hijackWindowOpen() {\n XRApp.getInstance().init()\n}\n\nexport function spatialPolyfill() {\n if (!isWebSpatialEnv) {\n return\n }\n\n injectSceneHook()\n hijackWindowOpen()\n checkCSSProperties()\n hijackGetComputedStyle()\n hijackDocumentElementStyle()\n monitorExternalStyleChange()\n}\n","import { defaultSceneConfig, XRApp, getSession } from '@webspatial/react-sdk'\n\nexport async function injectSceneHook() {\n if (!window.opener) return\n if ((window as any)._SceneHookOff) return\n\n await getSession()?.setLoading('show')\n // see this flag, we have done create the root scene\n\n function onContentLoaded(callback: any) {\n if (\n document.readyState === 'interactive' ||\n document.readyState === 'complete'\n ) {\n callback()\n } else {\n document.addEventListener('DOMContentLoaded', callback)\n }\n }\n\n onContentLoaded(async () => {\n let cfg = defaultSceneConfig\n if (typeof (window as any).xrCurrentSceneDefaults === 'function') {\n try {\n cfg = await (window as any).xrCurrentSceneDefaults?.()\n } catch (error) {\n console.error(error)\n }\n }\n // fixme: this duration is too short so that hide and show is at racing, so add a little delay to avoid\n await new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve(null)\n }, 1000)\n })\n await getSession()?.setLoading('hide')\n await XRApp.getInstance().show(window, cfg)\n })\n}\n","import { spatialPolyfill } from './spatialPolyfill'\n\nspatialPolyfill()\n\nexport { Fragment } from 'react/jsx-runtime'\nexport { jsxDEV, jsx } from './jsx-shared'\n","import { jsxDEV as _jsxDEV, JSXSource } from 'react/jsx-dev-runtime'\nimport reactJSXRuntime from 'react/jsx-runtime'\n//@ts-ignore bypass ts check for external\nimport { withCSSSpatial } from '@webspatial/react-sdk'\nconst attributeFlag = 'enable-xr'\nconst styleFlag = 'enableXr'\nconst classFlag = '__enableXr__'\n\nexport function replaceToSpatialPrimitiveType(\n type: React.ElementType,\n props: unknown,\n) {\n const propsObject = props as Record<string, any>\n if (attributeFlag in propsObject) {\n delete propsObject[attributeFlag]\n return withCSSSpatial(type)\n }\n\n if (propsObject && propsObject.style && styleFlag in propsObject.style) {\n delete propsObject.style[styleFlag]\n return withCSSSpatial(type)\n }\n\n if (propsObject && propsObject.className) {\n const originalClassNames = propsObject.className.split(' ')\n const idx = originalClassNames.indexOf(classFlag)\n if (idx !== -1) {\n originalClassNames.splice(idx, 1)\n propsObject.className = originalClassNames.join(' ')\n return withCSSSpatial(type)\n }\n }\n\n return type\n}\n\nexport function jsxs(type: React.ElementType, props: unknown, key?: React.Key) {\n type = replaceToSpatialPrimitiveType(type, props)\n return reactJSXRuntime.jsxs(type, props, key)\n}\n\nexport function jsx(type: React.ElementType, props: unknown, key?: React.Key) {\n type = replaceToSpatialPrimitiveType(type, props)\n return reactJSXRuntime.jsx(type, props, key)\n}\n\nexport function jsxDEV(\n type: React.ElementType,\n props: unknown,\n key: React.Key,\n isStatic: boolean,\n source?: JSXSource,\n self?: unknown,\n) {\n type = replaceToSpatialPrimitiveType(type, props)\n return _jsxDEV(type, props, key, isStatic, source, self)\n}\n"],"mappings":";AAAA,SAAS,cAAAA,aAAY,mBAAmB,SAAAC,cAAa;;;ACArD,SAAS,oBAAoB,OAAO,kBAAkB;AAEtD,eAAsB,kBAAkB;AACtC,MAAI,CAAC,OAAO,OAAQ;AACpB,MAAK,OAAe,cAAe;AAEnC,QAAM,WAAW,GAAG,WAAW,MAAM;AAGrC,WAAS,gBAAgB,UAAe;AACtC,QACE,SAAS,eAAe,iBACxB,SAAS,eAAe,YACxB;AACA,eAAS;AAAA,IACX,O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YAAY,MAAM,SAAS;AAClC,WAAO,eAAe,IAAI;AAAA,EAC5B;AAEA,MAAI,eAAe,YAAY,WAAW;AACxC,UAAM,qBAAqB,YAAY,UAAU,MAAM,GAAG;AAC1D,UAAM,MAAM,mBAAmB,QAAQ,SAAS;AAChD,QAAI,QAAQ,IAAI;AACd,yBAAmB,OAAO,KAAK,CAAC;AAChC,kBAAY,YAAY,mBAAmB,KAAK,GAAG;AACnD,aAAO,eAAe,IAAI;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO;AACT;AAOO,SAAS,IAAI,MAAyB,OAAgB,KAAiB;AAC5E,SAAO,8BAA8B,MAAM,KAAK;AAChD,SAAO,gBAAgB,IAAI,MAAM,OAAO,GAAG;AAC7C;AAEO,SAAS,OACd,MACA,OACA,KACA,UACA,QACA,MACA;AACA,SAAO,8BAA8B,MAAM,KAAK;AAChD,SAAO,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,IAAI;AACzD;;;ADtDA,gBAAgB;","names":["getSession","XRApp","getSession","XRApp"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { JSXSource } from 'react/jsx-dev-runtime';
|
|
4
|
-
|
|
5
|
-
declare function jsxs(type: React.ElementType, props: unknown, key?: React.Key): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
|
|
6
|
-
declare function jsx(type: React.ElementType, props: unknown, key?: React.Key): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
|
|
7
|
-
declare function jsxDEV(type: React.ElementType, props: unknown, key: React.Key, isStatic: boolean, source?: JSXSource, self?: unknown): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
|
|
8
|
-
|
|
9
|
-
export { jsx as a, jsxs as b, jsxDEV as j };
|
package/dist/jsx/jsx-runtime.mjs
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
// src/jsx/spatialPolyfill.ts
|
|
2
|
-
import { getSession as getSession2, parseCornerRadius, XRApp as XRApp2 } from "@webspatial/react-sdk";
|
|
3
|
-
|
|
4
|
-
// src/jsx/injectSceneHook.ts
|
|
5
|
-
import { defaultSceneConfig, XRApp, getSession } from "@webspatial/react-sdk";
|
|
6
|
-
async function injectSceneHook() {
|
|
7
|
-
if (!window.opener) return;
|
|
8
|
-
if (window._SceneHookOff) return;
|
|
9
|
-
await getSession()?.setLoading("show");
|
|
10
|
-
function onContentLoaded(callback) {
|
|
11
|
-
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
12
|
-
callback();
|
|
13
|
-
} else {
|
|
14
|
-
document.addEventListener("DOMContentLoaded", callback);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
onContentLoaded(async () => {
|
|
18
|
-
let cfg = defaultSceneConfig;
|
|
19
|
-
if (typeof window.xrCurrentSceneDefaults === "function") {
|
|
20
|
-
try {
|
|
21
|
-
cfg = await window.xrCurrentSceneDefaults?.();
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error(error);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
await new Promise((resolve, reject) => {
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
resolve(null);
|
|
29
|
-
}, 1e3);
|
|
30
|
-
});
|
|
31
|
-
await getSession()?.setLoading("hide");
|
|
32
|
-
await XRApp.getInstance().show(window, cfg);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// src/jsx/spatialPolyfill.ts
|
|
37
|
-
var isWebSpatialEnv = getSession2() !== null;
|
|
38
|
-
var SpatialGlobalCustomVars = {
|
|
39
|
-
backgroundMaterial: "--xr-background-material"
|
|
40
|
-
};
|
|
41
|
-
var htmlBackgroundMaterial = "";
|
|
42
|
-
function setCurrentWindowStyle(backgroundMaterial) {
|
|
43
|
-
if (backgroundMaterial !== htmlBackgroundMaterial) {
|
|
44
|
-
const session = getSession2();
|
|
45
|
-
session.getCurrentWindowComponent().setStyle({
|
|
46
|
-
material: { type: backgroundMaterial }
|
|
47
|
-
});
|
|
48
|
-
htmlBackgroundMaterial = backgroundMaterial;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function checkHtmlBackgroundMaterial() {
|
|
52
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
53
|
-
const backgroundMaterial = computedStyle.getPropertyValue(
|
|
54
|
-
SpatialGlobalCustomVars.backgroundMaterial
|
|
55
|
-
);
|
|
56
|
-
setCurrentWindowStyle(backgroundMaterial || "none");
|
|
57
|
-
}
|
|
58
|
-
var htmlCornerRadius = {
|
|
59
|
-
topLeading: 0,
|
|
60
|
-
bottomLeading: 0,
|
|
61
|
-
topTrailing: 0,
|
|
62
|
-
bottomTrailing: 0
|
|
63
|
-
};
|
|
64
|
-
function checkCornerRadius() {
|
|
65
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
66
|
-
const cornerRadius = parseCornerRadius(computedStyle);
|
|
67
|
-
setCornerRadius(cornerRadius);
|
|
68
|
-
}
|
|
69
|
-
function setCornerRadius(cornerRadius) {
|
|
70
|
-
if (htmlCornerRadius.topLeading !== cornerRadius.topLeading || htmlCornerRadius.bottomLeading !== cornerRadius.bottomLeading || htmlCornerRadius.topTrailing !== cornerRadius.topTrailing || htmlCornerRadius.bottomTrailing !== cornerRadius.bottomTrailing) {
|
|
71
|
-
const session = getSession2();
|
|
72
|
-
if (!session) return;
|
|
73
|
-
session.getCurrentWindowComponent().setStyle({
|
|
74
|
-
cornerRadius
|
|
75
|
-
});
|
|
76
|
-
htmlCornerRadius.topLeading = cornerRadius.topLeading;
|
|
77
|
-
htmlCornerRadius.bottomLeading = cornerRadius.bottomLeading;
|
|
78
|
-
htmlCornerRadius.topTrailing = cornerRadius.topTrailing;
|
|
79
|
-
htmlCornerRadius.bottomTrailing = cornerRadius.bottomTrailing;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function setOpacity(opacity) {
|
|
83
|
-
const session = getSession2();
|
|
84
|
-
if (!session) return;
|
|
85
|
-
session.getCurrentWindowComponent().setOpacity(opacity);
|
|
86
|
-
}
|
|
87
|
-
function checkOpacity() {
|
|
88
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
89
|
-
const opacity = parseFloat(computedStyle.getPropertyValue("opacity"));
|
|
90
|
-
setOpacity(opacity);
|
|
91
|
-
}
|
|
92
|
-
async function setHtmlVisible(visible) {
|
|
93
|
-
const session = getSession2();
|
|
94
|
-
if (!session) return;
|
|
95
|
-
const wc = session.getCurrentWindowComponent();
|
|
96
|
-
const ent = await wc.getEntity();
|
|
97
|
-
ent?.setVisible(visible);
|
|
98
|
-
}
|
|
99
|
-
function checkHtmlVisible() {
|
|
100
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
101
|
-
const visibility = computedStyle.getPropertyValue("visibility") !== "hidden";
|
|
102
|
-
const widthGtZero = parseFloat(computedStyle.getPropertyValue("width")) > 0;
|
|
103
|
-
setHtmlVisible(visibility && widthGtZero);
|
|
104
|
-
}
|
|
105
|
-
function hijackDocumentElementStyle() {
|
|
106
|
-
const rawDocumentStyle = document.documentElement.style;
|
|
107
|
-
const styleProxy = new Proxy(rawDocumentStyle, {
|
|
108
|
-
set: function(target, key, value) {
|
|
109
|
-
const ret = Reflect.set(target, key, value);
|
|
110
|
-
if (key === SpatialGlobalCustomVars.backgroundMaterial) {
|
|
111
|
-
setCurrentWindowStyle(value);
|
|
112
|
-
}
|
|
113
|
-
if (key === "border-radius" || key === "borderRadius" || key === "border-top-left-radius" || key === "borderTopLeftRadius" || key === "border-top-right-radius" || key === "borderTopRightRadius" || key === "border-bottom-left-radius" || key === "borderBottomLeftRadius" || key === "border-bottom-right-radius" || key === "borderBottomRightRadius") {
|
|
114
|
-
checkCornerRadius();
|
|
115
|
-
}
|
|
116
|
-
if (key === "opacity") {
|
|
117
|
-
checkOpacity();
|
|
118
|
-
}
|
|
119
|
-
if (key === "visibility" || key === "display") {
|
|
120
|
-
checkHtmlVisible();
|
|
121
|
-
}
|
|
122
|
-
return ret;
|
|
123
|
-
},
|
|
124
|
-
get: function(target, prop) {
|
|
125
|
-
if (typeof target[prop] === "function") {
|
|
126
|
-
return function(...args) {
|
|
127
|
-
if (prop === "setProperty") {
|
|
128
|
-
const [property, value] = args;
|
|
129
|
-
if (property === SpatialGlobalCustomVars.backgroundMaterial) {
|
|
130
|
-
setCurrentWindowStyle(value);
|
|
131
|
-
}
|
|
132
|
-
} else if (prop === "removeProperty") {
|
|
133
|
-
const [property] = args;
|
|
134
|
-
if (property === SpatialGlobalCustomVars.backgroundMaterial) {
|
|
135
|
-
setCurrentWindowStyle("none");
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return target[prop](
|
|
139
|
-
...args
|
|
140
|
-
);
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return Reflect.get(target, prop);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
Object.defineProperty(document.documentElement, "style", {
|
|
147
|
-
get: function() {
|
|
148
|
-
return styleProxy;
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
function monitorExternalStyleChange() {
|
|
153
|
-
const headObserver = new MutationObserver(function(mutationsList) {
|
|
154
|
-
for (const mutation of mutationsList) {
|
|
155
|
-
if (mutation.type === "childList") {
|
|
156
|
-
let needCheck = false;
|
|
157
|
-
mutation.addedNodes.forEach((node) => {
|
|
158
|
-
if (node.nodeName === "LINK" && node.rel === "stylesheet") {
|
|
159
|
-
needCheck = true;
|
|
160
|
-
}
|
|
161
|
-
if (node.nodeName === "STYLE") {
|
|
162
|
-
needCheck = true;
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
mutation.removedNodes.forEach((node) => {
|
|
166
|
-
if (node.nodeName === "LINK" && node.rel === "stylesheet") {
|
|
167
|
-
needCheck = true;
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
if (needCheck) {
|
|
171
|
-
checkCSSProperties();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
headObserver.observe(document.head, { childList: true, subtree: true });
|
|
177
|
-
}
|
|
178
|
-
function checkCSSProperties() {
|
|
179
|
-
checkHtmlBackgroundMaterial();
|
|
180
|
-
checkCornerRadius();
|
|
181
|
-
checkOpacity();
|
|
182
|
-
checkHtmlVisible();
|
|
183
|
-
window.addEventListener("resize", checkHtmlVisible);
|
|
184
|
-
}
|
|
185
|
-
function hijackGetComputedStyle() {
|
|
186
|
-
const rawFn = window.getComputedStyle.bind(window);
|
|
187
|
-
window.getComputedStyle = (element, pseudoElt) => {
|
|
188
|
-
if (element.__isSpatialDiv) {
|
|
189
|
-
return element.__getComputedStyle(rawFn, pseudoElt);
|
|
190
|
-
}
|
|
191
|
-
return rawFn(element, pseudoElt);
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function hijackWindowOpen() {
|
|
195
|
-
XRApp2.getInstance().init();
|
|
196
|
-
}
|
|
197
|
-
function spatialPolyfill() {
|
|
198
|
-
if (!isWebSpatialEnv) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
injectSceneHook();
|
|
202
|
-
hijackWindowOpen();
|
|
203
|
-
checkCSSProperties();
|
|
204
|
-
hijackGetComputedStyle();
|
|
205
|
-
hijackDocumentElementStyle();
|
|
206
|
-
monitorExternalStyleChange();
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// src/jsx/jsx-runtime.ts
|
|
210
|
-
import { Fragment } from "react/jsx-runtime";
|
|
211
|
-
|
|
212
|
-
// src/jsx/jsx-shared.ts
|
|
213
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
214
|
-
import reactJSXRuntime from "react/jsx-runtime";
|
|
215
|
-
import { withCSSSpatial } from "@webspatial/react-sdk";
|
|
216
|
-
var attributeFlag = "enable-xr";
|
|
217
|
-
var styleFlag = "enableXr";
|
|
218
|
-
var classFlag = "__enableXr__";
|
|
219
|
-
function replaceToSpatialPrimitiveType(type, props) {
|
|
220
|
-
const propsObject = props;
|
|
221
|
-
if (attributeFlag in propsObject) {
|
|
222
|
-
delete propsObject[attributeFlag];
|
|
223
|
-
return withCSSSpatial(type);
|
|
224
|
-
}
|
|
225
|
-
if (propsObject && propsObject.style && styleFlag in propsObject.style) {
|
|
226
|
-
delete propsObject.style[styleFlag];
|
|
227
|
-
return withCSSSpatial(type);
|
|
228
|
-
}
|
|
229
|
-
if (propsObject && propsObject.className) {
|
|
230
|
-
const originalClassNames = propsObject.className.split(" ");
|
|
231
|
-
const idx = originalClassNames.indexOf(classFlag);
|
|
232
|
-
if (idx !== -1) {
|
|
233
|
-
originalClassNames.splice(idx, 1);
|
|
234
|
-
propsObject.className = originalClassNames.join(" ");
|
|
235
|
-
return withCSSSpatial(type);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return type;
|
|
239
|
-
}
|
|
240
|
-
function jsxs(type, props, key) {
|
|
241
|
-
type = replaceToSpatialPrimitiveType(type, props);
|
|
242
|
-
return reactJSXRuntime.jsxs(type, props, key);
|
|
243
|
-
}
|
|
244
|
-
function jsx(type, props, key) {
|
|
245
|
-
type = replaceToSpatialPrimitiveType(type, props);
|
|
246
|
-
return reactJSXRuntime.jsx(type, props, key);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// src/jsx/jsx-runtime.ts
|
|
250
|
-
spatialPolyfill();
|
|
251
|
-
export {
|
|
252
|
-
Fragment,
|
|
253
|
-
jsx,
|
|
254
|
-
jsxs
|
|
255
|
-
};
|
|
256
|
-
//# sourceMappingURL=jsx-runtime.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/jsx/spatialPolyfill.ts","../../src/jsx/injectSceneHook.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/jsx-shared.ts"],"sourcesContent":["import { getSession, parseCornerRadius, XRApp } from '@webspatial/react-sdk'\nimport { injectSceneHook } from './injectSceneHook'\n\nconst isWebSpatialEnv = getSession() !== null\n\nconst SpatialGlobalCustomVars = {\n backgroundMaterial: '--xr-background-material',\n}\n\n// keep track of current html background material\nlet htmlBackgroundMaterial = ''\nfunction setCurrentWindowStyle(backgroundMaterial: string) {\n if (backgroundMaterial !== htmlBackgroundMaterial) {\n const session = getSession()!\n session.getCurrentWindowComponent().setStyle({\n material: { type: backgroundMaterial as any },\n })\n htmlBackgroundMaterial = backgroundMaterial\n }\n}\n\nfunction checkHtmlBackgroundMaterial() {\n const computedStyle = getComputedStyle(document.documentElement)\n\n const backgroundMaterial = computedStyle.getPropertyValue(\n SpatialGlobalCustomVars.backgroundMaterial,\n )\n\n setCurrentWindowStyle(backgroundMaterial || 'none')\n}\n\n// keep track of current corner radius\nlet htmlCornerRadius = {\n topLeading: 0,\n bottomLeading: 0,\n topTrailing: 0,\n bottomTrailing: 0,\n}\nfunction checkCornerRadius() {\n const computedStyle = getComputedStyle(document.documentElement)\n const cornerRadius = parseCornerRadius(computedStyle)\n setCornerRadius(cornerRadius)\n}\n\nfunction setCornerRadius(cornerRadius: any) {\n if (\n htmlCornerRadius.topLeading !== cornerRadius.topLeading ||\n htmlCornerRadius.bottomLeading !== cornerRadius.bottomLeading ||\n htmlCornerRadius.topTrailing !== cornerRadius.topTrailing ||\n htmlCornerRadius.bottomTrailing !== cornerRadius.bottomTrailing\n ) {\n const session = getSession()!\n if (!session) return\n session.getCurrentWindowComponent().setStyle({\n cornerRadius,\n })\n htmlCornerRadius.topLeading = cornerRadius.topLeading\n htmlCornerRadius.bottomLeading = cornerRadius.bottomLeading\n htmlCornerRadius.topTrailing = cornerRadius.topTrailing\n htmlCornerRadius.bottomTrailing = cornerRadius.bottomTrailing\n }\n}\n\nfunction setOpacity(opacity: number) {\n const session = getSession()!\n if (!session) return\n session.getCurrentWindowComponent().setOpacity(opacity)\n}\n\nfunction checkOpacity() {\n const computedStyle = getComputedStyle(document.documentElement)\n const opacity = parseFloat(computedStyle.getPropertyValue('opacity'))\n setOpacity(opacity)\n}\n\nasync function setHtmlVisible(visible: boolean) {\n const session = getSession()!\n if (!session) return\n const wc = session.getCurrentWindowComponent()\n const ent = await wc.getEntity()\n ent?.setVisible(visible)\n}\n\nfunction checkHtmlVisible() {\n const computedStyle = getComputedStyle(document.documentElement)\n const visibility = computedStyle.getPropertyValue('visibility') !== 'hidden'\n const widthGtZero = parseFloat(computedStyle.getPropertyValue('width')) > 0\n setHtmlVisible(visibility && widthGtZero)\n}\n\nfunction hijackDocumentElementStyle() {\n const rawDocumentStyle = document.documentElement.style\n const styleProxy = new Proxy(rawDocumentStyle, {\n set: function (target, key, value) {\n const ret = Reflect.set(target, key, value)\n\n if (key === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle(value)\n }\n\n if (\n key === 'border-radius' ||\n key === 'borderRadius' ||\n key === 'border-top-left-radius' ||\n key === 'borderTopLeftRadius' ||\n key === 'border-top-right-radius' ||\n key === 'borderTopRightRadius' ||\n key === 'border-bottom-left-radius' ||\n key === 'borderBottomLeftRadius' ||\n key === 'border-bottom-right-radius' ||\n key === 'borderBottomRightRadius'\n ) {\n checkCornerRadius()\n }\n\n if (key === 'opacity') {\n checkOpacity()\n }\n\n if (key === 'visibility' || key === 'display') {\n checkHtmlVisible()\n }\n\n return ret\n },\n get: function (target, prop: string) {\n if (typeof target[prop as keyof CSSStyleDeclaration] === 'function') {\n return function (this: any, ...args: any[]) {\n if (prop === 'setProperty') {\n const [property, value] = args\n if (property === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle(value)\n }\n } else if (prop === 'removeProperty') {\n const [property] = args\n if (property === SpatialGlobalCustomVars.backgroundMaterial) {\n setCurrentWindowStyle('none')\n }\n }\n return (target[prop as keyof CSSStyleDeclaration] as Function)(\n ...args,\n )\n }\n }\n return Reflect.get(target, prop)\n },\n })\n Object.defineProperty(document.documentElement, 'style', {\n get: function () {\n return styleProxy\n },\n })\n}\n\nfunction monitorExternalStyleChange() {\n const headObserver = new MutationObserver(function (mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n let needCheck = false\n mutation.addedNodes.forEach(node => {\n if (\n node.nodeName === 'LINK' &&\n (node as HTMLLinkElement).rel === 'stylesheet'\n ) {\n needCheck = true\n }\n\n if (node.nodeName === 'STYLE') {\n needCheck = true\n }\n })\n\n mutation.removedNodes.forEach(node => {\n if (\n node.nodeName === 'LINK' &&\n (node as HTMLLinkElement).rel === 'stylesheet'\n ) {\n needCheck = true\n }\n })\n\n if (needCheck) {\n checkCSSProperties()\n }\n }\n }\n })\n\n headObserver.observe(document.head, { childList: true, subtree: true })\n}\n\nfunction checkCSSProperties() {\n checkHtmlBackgroundMaterial()\n checkCornerRadius()\n checkOpacity()\n checkHtmlVisible()\n window.addEventListener('resize', checkHtmlVisible)\n}\n\nfunction hijackGetComputedStyle() {\n const rawFn = window.getComputedStyle.bind(window)\n window.getComputedStyle = (element, pseudoElt) => {\n if ((element as any).__isSpatialDiv) {\n return (element as any).__getComputedStyle(rawFn, pseudoElt)\n }\n return rawFn(element, pseudoElt)\n }\n}\n\nfunction hijackWindowOpen() {\n XRApp.getInstance().init()\n}\n\nexport function spatialPolyfill() {\n if (!isWebSpatialEnv) {\n return\n }\n\n injectSceneHook()\n hijackWindowOpen()\n checkCSSProperties()\n hijackGetComputedStyle()\n hijackDocumentElementStyle()\n monitorExternalStyleChange()\n}\n","import { defaultSceneConfig, XRApp, getSession } from '@webspatial/react-sdk'\n\nexport async function injectSceneHook() {\n if (!window.opener) return\n if ((window as any)._SceneHookOff) return\n\n await getSession()?.setLoading('show')\n // see this flag, we have done create the root scene\n\n function onContentLoaded(callback: any) {\n if (\n document.readyState === 'interactive' ||\n document.readyState === 'complete'\n ) {\n callback()\n } else {\n document.addEventListener('DOMContentLoaded', callback)\n }\n }\n\n onContentLoaded(async () => {\n let cfg = defaultSceneConfig\n if (typeof (window as any).xrCurrentSceneDefaults === 'function') {\n try {\n cfg = await (window as any).xrCurrentSceneDefaults?.()\n } catch (error) {\n console.error(error)\n }\n }\n // fixme: this duration is too short so that hide and show is at racing, so add a little delay to avoid\n await new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve(null)\n }, 1000)\n })\n await getSession()?.setLoading('hide')\n await XRApp.getInstance().show(window, cfg)\n })\n}\n","import { spatialPolyfill } from './spatialPolyfill'\n\nspatialPolyfill()\n\nexport { Fragment } from 'react/jsx-runtime'\nexport { jsx, jsxs } from './jsx-shared'\n","import { jsxDEV as _jsxDEV, JSXSource } from 'react/jsx-dev-runtime'\nimport reactJSXRuntime from 'react/jsx-runtime'\n//@ts-ignore bypass ts check for external\nimport { withCSSSpatial } from '@webspatial/react-sdk'\nconst attributeFlag = 'enable-xr'\nconst styleFlag = 'enableXr'\nconst classFlag = '__enableXr__'\n\nexport function replaceToSpatialPrimitiveType(\n type: React.ElementType,\n props: unknown,\n) {\n const propsObject = props as Record<string, any>\n if (attributeFlag in propsObject) {\n delete propsObject[attributeFlag]\n return withCSSSpatial(type)\n }\n\n if (propsObject && propsObject.style && styleFlag in propsObject.style) {\n delete propsObject.style[styleFlag]\n return withCSSSpatial(type)\n }\n\n if (propsObject && propsObject.className) {\n const originalClassNames = propsObject.className.split(' ')\n const idx = originalClassNames.indexOf(classFlag)\n if (idx !== -1) {\n originalClassNames.splice(idx, 1)\n propsObject.className = originalClassNames.join(' ')\n return withCSSSpatial(type)\n }\n }\n\n return type\n}\n\nexport function jsxs(type: React.ElementType, props: unknown, key?: React.Key) {\n type = replaceToSpatialPrimitiveType(type, props)\n return reactJSXRuntime.jsxs(type, props, key)\n}\n\nexport function jsx(type: React.ElementType, props: unknown, key?: React.Key) {\n type = replaceToSpatialPrimitiveType(type, props)\n return reactJSXRuntime.jsx(type, props, key)\n}\n\nexport function jsxDEV(\n type: React.ElementType,\n props: unknown,\n key: React.Key,\n isStatic: boolean,\n source?: JSXSource,\n self?: unknown,\n) {\n type = replaceToSpatialPrimitiveType(type, props)\n return _jsxDEV(type, props, key, isStatic, source, self)\n}\n"],"mappings":";AAAA,SAA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