@webspatial/core-sdk 1.0.5 → 1.1.0
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/CHANGELOG.md +6 -0
- package/dist/iife/index.global.js +3 -3
- package/dist/iife/index.global.js.map +1 -1
- package/dist/index.js +26 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/platform-adapter/android/AndroidPlatform.ts +2 -2
- package/src/reality/entity/SpatialEntity.ts +4 -0
- package/src/scene-polyfill.ts +25 -5
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
(function(){
|
|
3
3
|
if(typeof window === 'undefined') return;
|
|
4
4
|
if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
|
|
5
|
-
window.__webspatialsdk__['core-sdk-version'] = "1.0
|
|
5
|
+
window.__webspatialsdk__['core-sdk-version'] = "1.1.0"
|
|
6
6
|
})()
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
@@ -181,10 +181,10 @@ var init_AndroidPlatform = __esm({
|
|
|
181
181
|
await new Promise((resolve) => setTimeout(resolve, 16));
|
|
182
182
|
}
|
|
183
183
|
windowProxy?.open("about:blank", "_self");
|
|
184
|
-
while (!windowProxy?.
|
|
184
|
+
while (!windowProxy?.__SpatialId) {
|
|
185
185
|
await new Promise((resolve) => setTimeout(resolve, 16));
|
|
186
186
|
}
|
|
187
|
-
let spatialId = windowProxy?.
|
|
187
|
+
let spatialId = windowProxy?.__SpatialId;
|
|
188
188
|
creatingElementCount--;
|
|
189
189
|
return Promise.resolve(
|
|
190
190
|
CommandResultSuccess({ windowProxy, id: spatialId })
|
|
@@ -997,14 +997,29 @@ var SceneManager = class _SceneManager {
|
|
|
997
997
|
if (name === void 0 || !this.configMap[name]) return void 0;
|
|
998
998
|
return this.configMap[name];
|
|
999
999
|
}
|
|
1000
|
+
// Ensure URL is absolute; only convert when a relative path is provided
|
|
1001
|
+
// - Keep external and special schemes untouched (http, https, data, blob, about, file, mailto, etc.)
|
|
1002
|
+
// - Handle protocol-relative URLs (//example.com/path)
|
|
1003
|
+
// - Resolve relative paths against document.baseURI (respects <base href>)
|
|
1004
|
+
ensureAbsoluteUrl(raw) {
|
|
1005
|
+
if (!raw) return raw;
|
|
1006
|
+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(raw)) {
|
|
1007
|
+
return raw;
|
|
1008
|
+
}
|
|
1009
|
+
if (raw.startsWith("//")) {
|
|
1010
|
+
return `${window.location.protocol}${raw}`;
|
|
1011
|
+
}
|
|
1012
|
+
try {
|
|
1013
|
+
return new URL(raw, document.baseURI).toString();
|
|
1014
|
+
} catch {
|
|
1015
|
+
return raw;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1000
1018
|
open = (url, target, features) => {
|
|
1001
1019
|
if (url?.startsWith(INTERNAL_SCHEMA_PREFIX)) {
|
|
1002
1020
|
return this.originalOpen(url, target, features);
|
|
1003
1021
|
}
|
|
1004
|
-
|
|
1005
|
-
if (!url?.startsWith(prefix)) {
|
|
1006
|
-
url = prefix + url;
|
|
1007
|
-
}
|
|
1022
|
+
url = this.ensureAbsoluteUrl(url);
|
|
1008
1023
|
if (target === "_self" || target === "_parent" || target === "_top") {
|
|
1009
1024
|
const newWindow = this.originalOpen(url, target, features);
|
|
1010
1025
|
return newWindow;
|
|
@@ -1811,6 +1826,9 @@ var SpatialEntity = class _SpatialEntity extends SpatialObject {
|
|
|
1811
1826
|
}
|
|
1812
1827
|
};
|
|
1813
1828
|
dispatchEvent(evt) {
|
|
1829
|
+
if (!evt.__origin) {
|
|
1830
|
+
Object.defineProperty(evt, "__origin", { value: this, enumerable: false });
|
|
1831
|
+
}
|
|
1814
1832
|
this.events[evt.type]?.(evt);
|
|
1815
1833
|
if (evt.bubbles && !evt.cancelBubble) {
|
|
1816
1834
|
if (this.parent && this.parent instanceof _SpatialEntity) {
|
|
@@ -2217,7 +2235,7 @@ var Spatial = class {
|
|
|
2217
2235
|
* @returns Client SDK version string in format "x.x.x"
|
|
2218
2236
|
*/
|
|
2219
2237
|
getClientVersion() {
|
|
2220
|
-
return "1.0
|
|
2238
|
+
return "1.1.0";
|
|
2221
2239
|
}
|
|
2222
2240
|
};
|
|
2223
2241
|
|