@webspatial/react-sdk 0.0.2 → 0.0.3
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/jsx/jsx-dev-runtime.js +35 -35
- package/dist/jsx/jsx-dev-runtime.js.map +4 -4
- package/dist/jsx/jsx-runtime.js +35 -35
- package/dist/jsx/jsx-runtime.js.map +4 -4
- package/npm/index.js +3 -3
- package/npm/plugin/shared.js +2 -2
- package/npm/plugin/vite.js +7 -7
- package/package.json +3 -3
|
@@ -31,9 +31,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
));
|
|
32
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
|
|
34
|
-
// dist/cjs/
|
|
35
|
-
var
|
|
36
|
-
"dist/cjs/
|
|
34
|
+
// dist/cjs/default/index.js
|
|
35
|
+
var require_default = __commonJS({
|
|
36
|
+
"dist/cjs/default/index.js"(exports, module2) {
|
|
37
37
|
"use strict";
|
|
38
38
|
var __create2 = Object.create;
|
|
39
39
|
var __defProp2 = Object.defineProperty;
|
|
@@ -221,14 +221,13 @@ var require_web = __commonJS({
|
|
|
221
221
|
"tspan"
|
|
222
222
|
];
|
|
223
223
|
var import_react10 = require("react");
|
|
224
|
-
var
|
|
225
|
-
var Spatial = {};
|
|
224
|
+
var import_core_sdk = require("@webspatial/core-sdk");
|
|
226
225
|
var spatial = null;
|
|
227
226
|
var _currentSession = null;
|
|
228
227
|
function getSession3() {
|
|
229
|
-
if (
|
|
228
|
+
if (false) return null;
|
|
230
229
|
if (!spatial) {
|
|
231
|
-
spatial = new Spatial();
|
|
230
|
+
spatial = new import_core_sdk.Spatial();
|
|
232
231
|
}
|
|
233
232
|
if (!spatial.isSupported()) {
|
|
234
233
|
return null;
|
|
@@ -242,7 +241,7 @@ var require_web = __commonJS({
|
|
|
242
241
|
__name(getSession3, "getSession");
|
|
243
242
|
__name2(getSession3, "getSession");
|
|
244
243
|
async function getStat() {
|
|
245
|
-
if (
|
|
244
|
+
if (false) return;
|
|
246
245
|
const statsInfo = await getSession3()._getStats();
|
|
247
246
|
return statsInfo;
|
|
248
247
|
}
|
|
@@ -305,7 +304,7 @@ var require_web = __commonJS({
|
|
|
305
304
|
__name(inspectRootWindowContainer, "inspectRootWindowContainer");
|
|
306
305
|
__name2(inspectRootWindowContainer, "inspectRootWindowContainer");
|
|
307
306
|
function enableDebugTool() {
|
|
308
|
-
if (
|
|
307
|
+
if (false) return;
|
|
309
308
|
const session = getSession3();
|
|
310
309
|
Object.assign(window, {
|
|
311
310
|
session,
|
|
@@ -543,7 +542,7 @@ var require_web = __commonJS({
|
|
|
543
542
|
this.entity?._setName(debugName);
|
|
544
543
|
}
|
|
545
544
|
async initInternal(url) {
|
|
546
|
-
if (
|
|
545
|
+
if (false) return;
|
|
547
546
|
this.entity = await getSession3().createEntity();
|
|
548
547
|
this.webview = await getSession3().createWindowComponent();
|
|
549
548
|
await this.webview.loadURL(url);
|
|
@@ -556,7 +555,7 @@ var require_web = __commonJS({
|
|
|
556
555
|
await this.entity.setParent(ent);
|
|
557
556
|
}
|
|
558
557
|
async initInternalFromWindow(parentSpatialWindowManager) {
|
|
559
|
-
if (
|
|
558
|
+
if (false) return;
|
|
560
559
|
var w = await getSession3().createWindowContext();
|
|
561
560
|
this.window = w;
|
|
562
561
|
this.entity = await getSession3().createEntity();
|
|
@@ -1980,7 +1979,7 @@ var require_web = __commonJS({
|
|
|
1980
1979
|
__name2(renderInPortalInstance, "renderInPortalInstance");
|
|
1981
1980
|
function CSSSpatialComponentBase(inProps, ref) {
|
|
1982
1981
|
const { [CSSSpatialID]: cssSpatialID, ...props } = inProps;
|
|
1983
|
-
const isWebEnv =
|
|
1982
|
+
const isWebEnv = !getSession3();
|
|
1984
1983
|
if (isWebEnv) {
|
|
1985
1984
|
return renderInWebEnv(props, ref);
|
|
1986
1985
|
} else {
|
|
@@ -2072,6 +2071,7 @@ var require_web = __commonJS({
|
|
|
2072
2071
|
});
|
|
2073
2072
|
}, "createSpatialPrimitive2"), "createSpatialPrimitive"))(CSSSpatialPrimitive);
|
|
2074
2073
|
var CSSSpatialDiv = CSSSpatialPrimitive.div;
|
|
2074
|
+
var import_core_sdk2 = require("@webspatial/core-sdk");
|
|
2075
2075
|
var import_react21 = require("react");
|
|
2076
2076
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2077
2077
|
var runAsync = /* @__PURE__ */ __name2((fn) => {
|
|
@@ -2095,12 +2095,12 @@ var require_web = __commonJS({
|
|
|
2095
2095
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: divRef, ...props, children: "WebSpatial is not supported in this browser" });
|
|
2096
2096
|
}
|
|
2097
2097
|
(0, import_react21.useEffect)(() => {
|
|
2098
|
-
if (
|
|
2098
|
+
if (false) return;
|
|
2099
2099
|
activePromise.current = runAsync(async () => {
|
|
2100
2100
|
if (activePromise.current) {
|
|
2101
2101
|
await activePromise.current;
|
|
2102
2102
|
}
|
|
2103
|
-
let sh = new SpatialHelper(getSession3());
|
|
2103
|
+
let sh = new import_core_sdk2.SpatialHelper(getSession3());
|
|
2104
2104
|
let x = await sh.dom.attachSpatialView(divRef.current);
|
|
2105
2105
|
spatialEntity.current = x.entity;
|
|
2106
2106
|
if (props.onViewLoad) {
|
|
@@ -2108,7 +2108,7 @@ var require_web = __commonJS({
|
|
|
2108
2108
|
}
|
|
2109
2109
|
});
|
|
2110
2110
|
return () => {
|
|
2111
|
-
if (
|
|
2111
|
+
if (false) return;
|
|
2112
2112
|
runAsync(async () => {
|
|
2113
2113
|
await activePromise.current;
|
|
2114
2114
|
spatialEntity.current?.destroy();
|
|
@@ -2221,7 +2221,7 @@ var require_web = __commonJS({
|
|
|
2221
2221
|
return this.initPromise;
|
|
2222
2222
|
}
|
|
2223
2223
|
async initInternal(modelUrl, onSuccess, onFailure) {
|
|
2224
|
-
if (
|
|
2224
|
+
if (false) return;
|
|
2225
2225
|
var session = getSession3();
|
|
2226
2226
|
if (!session) {
|
|
2227
2227
|
return;
|
|
@@ -3426,9 +3426,9 @@ var require_web = __commonJS({
|
|
|
3426
3426
|
}
|
|
3427
3427
|
});
|
|
3428
3428
|
|
|
3429
|
-
// dist/cjs/
|
|
3430
|
-
var
|
|
3431
|
-
"dist/cjs/
|
|
3429
|
+
// dist/cjs/web/index.js
|
|
3430
|
+
var require_web = __commonJS({
|
|
3431
|
+
"dist/cjs/web/index.js"(exports, module2) {
|
|
3432
3432
|
"use strict";
|
|
3433
3433
|
var __create2 = Object.create;
|
|
3434
3434
|
var __defProp2 = Object.defineProperty;
|
|
@@ -3616,13 +3616,14 @@ var require_default = __commonJS({
|
|
|
3616
3616
|
"tspan"
|
|
3617
3617
|
];
|
|
3618
3618
|
var import_react10 = require("react");
|
|
3619
|
-
var
|
|
3619
|
+
var SpatialHelper = {};
|
|
3620
|
+
var Spatial = {};
|
|
3620
3621
|
var spatial = null;
|
|
3621
3622
|
var _currentSession = null;
|
|
3622
3623
|
function getSession3() {
|
|
3623
|
-
if (
|
|
3624
|
+
if (true) return null;
|
|
3624
3625
|
if (!spatial) {
|
|
3625
|
-
spatial = new
|
|
3626
|
+
spatial = new Spatial();
|
|
3626
3627
|
}
|
|
3627
3628
|
if (!spatial.isSupported()) {
|
|
3628
3629
|
return null;
|
|
@@ -3636,7 +3637,7 @@ var require_default = __commonJS({
|
|
|
3636
3637
|
__name(getSession3, "getSession");
|
|
3637
3638
|
__name2(getSession3, "getSession");
|
|
3638
3639
|
async function getStat() {
|
|
3639
|
-
if (
|
|
3640
|
+
if (true) return;
|
|
3640
3641
|
const statsInfo = await getSession3()._getStats();
|
|
3641
3642
|
return statsInfo;
|
|
3642
3643
|
}
|
|
@@ -3699,7 +3700,7 @@ var require_default = __commonJS({
|
|
|
3699
3700
|
__name(inspectRootWindowContainer, "inspectRootWindowContainer");
|
|
3700
3701
|
__name2(inspectRootWindowContainer, "inspectRootWindowContainer");
|
|
3701
3702
|
function enableDebugTool() {
|
|
3702
|
-
if (
|
|
3703
|
+
if (true) return;
|
|
3703
3704
|
const session = getSession3();
|
|
3704
3705
|
Object.assign(window, {
|
|
3705
3706
|
session,
|
|
@@ -3937,7 +3938,7 @@ var require_default = __commonJS({
|
|
|
3937
3938
|
this.entity?._setName(debugName);
|
|
3938
3939
|
}
|
|
3939
3940
|
async initInternal(url) {
|
|
3940
|
-
if (
|
|
3941
|
+
if (true) return;
|
|
3941
3942
|
this.entity = await getSession3().createEntity();
|
|
3942
3943
|
this.webview = await getSession3().createWindowComponent();
|
|
3943
3944
|
await this.webview.loadURL(url);
|
|
@@ -3950,7 +3951,7 @@ var require_default = __commonJS({
|
|
|
3950
3951
|
await this.entity.setParent(ent);
|
|
3951
3952
|
}
|
|
3952
3953
|
async initInternalFromWindow(parentSpatialWindowManager) {
|
|
3953
|
-
if (
|
|
3954
|
+
if (true) return;
|
|
3954
3955
|
var w = await getSession3().createWindowContext();
|
|
3955
3956
|
this.window = w;
|
|
3956
3957
|
this.entity = await getSession3().createEntity();
|
|
@@ -5374,7 +5375,7 @@ var require_default = __commonJS({
|
|
|
5374
5375
|
__name2(renderInPortalInstance, "renderInPortalInstance");
|
|
5375
5376
|
function CSSSpatialComponentBase(inProps, ref) {
|
|
5376
5377
|
const { [CSSSpatialID]: cssSpatialID, ...props } = inProps;
|
|
5377
|
-
const isWebEnv =
|
|
5378
|
+
const isWebEnv = true;
|
|
5378
5379
|
if (isWebEnv) {
|
|
5379
5380
|
return renderInWebEnv(props, ref);
|
|
5380
5381
|
} else {
|
|
@@ -5466,7 +5467,6 @@ var require_default = __commonJS({
|
|
|
5466
5467
|
});
|
|
5467
5468
|
}, "createSpatialPrimitive2"), "createSpatialPrimitive"))(CSSSpatialPrimitive);
|
|
5468
5469
|
var CSSSpatialDiv = CSSSpatialPrimitive.div;
|
|
5469
|
-
var import_core_sdk2 = require("@webspatial/core-sdk");
|
|
5470
5470
|
var import_react21 = require("react");
|
|
5471
5471
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5472
5472
|
var runAsync = /* @__PURE__ */ __name2((fn) => {
|
|
@@ -5490,12 +5490,12 @@ var require_default = __commonJS({
|
|
|
5490
5490
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: divRef, ...props, children: "WebSpatial is not supported in this browser" });
|
|
5491
5491
|
}
|
|
5492
5492
|
(0, import_react21.useEffect)(() => {
|
|
5493
|
-
if (
|
|
5493
|
+
if (true) return;
|
|
5494
5494
|
activePromise.current = runAsync(async () => {
|
|
5495
5495
|
if (activePromise.current) {
|
|
5496
5496
|
await activePromise.current;
|
|
5497
5497
|
}
|
|
5498
|
-
let sh = new
|
|
5498
|
+
let sh = new SpatialHelper(getSession3());
|
|
5499
5499
|
let x = await sh.dom.attachSpatialView(divRef.current);
|
|
5500
5500
|
spatialEntity.current = x.entity;
|
|
5501
5501
|
if (props.onViewLoad) {
|
|
@@ -5503,7 +5503,7 @@ var require_default = __commonJS({
|
|
|
5503
5503
|
}
|
|
5504
5504
|
});
|
|
5505
5505
|
return () => {
|
|
5506
|
-
if (
|
|
5506
|
+
if (true) return;
|
|
5507
5507
|
runAsync(async () => {
|
|
5508
5508
|
await activePromise.current;
|
|
5509
5509
|
spatialEntity.current?.destroy();
|
|
@@ -5616,7 +5616,7 @@ var require_default = __commonJS({
|
|
|
5616
5616
|
return this.initPromise;
|
|
5617
5617
|
}
|
|
5618
5618
|
async initInternal(modelUrl, onSuccess, onFailure) {
|
|
5619
|
-
if (
|
|
5619
|
+
if (true) return;
|
|
5620
5620
|
var session = getSession3();
|
|
5621
5621
|
if (!session) {
|
|
5622
5622
|
return;
|
|
@@ -6825,10 +6825,10 @@ var require_default = __commonJS({
|
|
|
6825
6825
|
var require_npm = __commonJS({
|
|
6826
6826
|
"npm/index.js"(exports, module2) {
|
|
6827
6827
|
"use strict";
|
|
6828
|
-
if (process.env.XR_ENV === "
|
|
6829
|
-
module2.exports = require_web();
|
|
6830
|
-
} else {
|
|
6828
|
+
if (process.env.XR_ENV === "avp") {
|
|
6831
6829
|
module2.exports = require_default();
|
|
6830
|
+
} else {
|
|
6831
|
+
module2.exports = require_web();
|
|
6832
6832
|
}
|
|
6833
6833
|
}
|
|
6834
6834
|
});
|