@smplrspace/smplr-loader 2.59.1 → 2.59.2-beta.2
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/generated/smplr.d.ts +1 -1
- package/dist/index.js +56 -34
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -4686,7 +4686,7 @@ declare interface Vector3Coord extends Vector2Coord {
|
|
|
4686
4686
|
z: number;
|
|
4687
4687
|
}
|
|
4688
4688
|
|
|
4689
|
-
export declare const version = "2.59.
|
|
4689
|
+
export declare const version = "2.59.2-beta.2";
|
|
4690
4690
|
|
|
4691
4691
|
declare interface ViewerDataLayerRenderState<Definition = DataLayer<UnknownData>> {
|
|
4692
4692
|
definition: Definition;
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,52 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r = /* @__PURE__ */ new Map(), d = (e, o) => new Promise((t, s) => {
|
|
2
|
+
e.addEventListener("load", () => {
|
|
3
|
+
t("ok");
|
|
4
|
+
}), e.addEventListener("error", () => {
|
|
5
|
+
s(`Failed to load the script from ${o}`);
|
|
6
|
+
});
|
|
7
|
+
}), a = (e) => {
|
|
2
8
|
try {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} catch (
|
|
10
|
-
|
|
9
|
+
if (window.smplr !== void 0 && document.querySelector(`script[src="${e}"]`) !== null)
|
|
10
|
+
return Promise.resolve("ok");
|
|
11
|
+
const o = document.createElement("script");
|
|
12
|
+
o.type = "text/javascript", o.async = !0, o.src = e;
|
|
13
|
+
const t = d(o, e);
|
|
14
|
+
return document.body.appendChild(o), t;
|
|
15
|
+
} catch (o) {
|
|
16
|
+
return Promise.reject(o);
|
|
11
17
|
}
|
|
12
|
-
}
|
|
13
|
-
r
|
|
18
|
+
}, p = (e) => {
|
|
19
|
+
const o = r.get(e);
|
|
20
|
+
if (o !== void 0)
|
|
21
|
+
return o;
|
|
22
|
+
const t = a(e).catch((s) => {
|
|
23
|
+
throw r.delete(e), s;
|
|
24
|
+
});
|
|
25
|
+
return r.set(e, t), t;
|
|
26
|
+
}, m = (e) => import(
|
|
27
|
+
e
|
|
14
28
|
/* @vite-ignore */
|
|
15
|
-
),
|
|
29
|
+
), l = /* @__PURE__ */ new Map(), i = (e) => new Promise((o, t) => {
|
|
16
30
|
try {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}),
|
|
21
|
-
const
|
|
22
|
-
console.error(
|
|
23
|
-
}), document.head.appendChild(
|
|
24
|
-
} catch (
|
|
25
|
-
console.error(
|
|
31
|
+
const s = document.createElement("link");
|
|
32
|
+
s.type = "text/css", s.href = e, s.rel = "stylesheet", s.addEventListener("load", () => {
|
|
33
|
+
o("ok");
|
|
34
|
+
}), s.addEventListener("error", () => {
|
|
35
|
+
const n = new Error(`Failed to load the stylesheet from ${e}`);
|
|
36
|
+
console.error(n), t(n);
|
|
37
|
+
}), document.head.appendChild(s);
|
|
38
|
+
} catch (s) {
|
|
39
|
+
console.error(s), t(s);
|
|
26
40
|
}
|
|
27
|
-
}),
|
|
41
|
+
}), h = (e) => {
|
|
42
|
+
const o = l.get(e);
|
|
43
|
+
if (o !== void 0)
|
|
44
|
+
return o;
|
|
45
|
+
const t = i(e).catch((s) => {
|
|
46
|
+
throw l.delete(e), s;
|
|
47
|
+
});
|
|
48
|
+
return l.set(e, t), t;
|
|
49
|
+
}, c = {
|
|
28
50
|
umd: {
|
|
29
51
|
prod: "https://app.smplrspace.com/lib/smplr.js",
|
|
30
52
|
dev: "https://dev.smplrspace.com/lib/smplr.js",
|
|
@@ -41,27 +63,27 @@ const c = (r) => new Promise((t, s) => {
|
|
|
41
63
|
local: "http://localhost:3000/lib/style.css"
|
|
42
64
|
}
|
|
43
65
|
};
|
|
44
|
-
async function
|
|
66
|
+
async function w(e = "esm", o = "prod") {
|
|
45
67
|
try {
|
|
46
|
-
|
|
68
|
+
h(c.css[o]);
|
|
47
69
|
} catch {
|
|
48
70
|
console.warn("oops");
|
|
49
71
|
}
|
|
50
72
|
try {
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
return console.log("loaded esm",
|
|
73
|
+
if (e === "esm") {
|
|
74
|
+
const t = await m(c.esm[o]);
|
|
75
|
+
return console.log("loaded esm", t.toString()), t;
|
|
54
76
|
} else {
|
|
55
|
-
await c
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
77
|
+
await p(c.umd[o]);
|
|
78
|
+
const t = window.smplr;
|
|
79
|
+
if (!t)
|
|
58
80
|
throw new Error("Failed to load smplr.js");
|
|
59
|
-
return console.log("loaded umd",
|
|
81
|
+
return console.log("loaded umd", t.toString()), t;
|
|
60
82
|
}
|
|
61
|
-
} catch (
|
|
62
|
-
throw console.error(
|
|
83
|
+
} catch (t) {
|
|
84
|
+
throw console.error(t), new Error("Failed to load smplr.js");
|
|
63
85
|
}
|
|
64
86
|
}
|
|
65
87
|
export {
|
|
66
|
-
|
|
88
|
+
w as loadSmplrJs
|
|
67
89
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(r
|
|
1
|
+
(function(l,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(l=typeof globalThis<"u"?globalThis:l||self,r(l.SmplrLoader={}))})(this,function(l){"use strict";const r=new Map,p=(e,o)=>new Promise((t,s)=>{e.addEventListener("load",()=>{t("ok")}),e.addEventListener("error",()=>{s(`Failed to load the script from ${o}`)})}),i=e=>{try{if(window.smplr!==void 0&&document.querySelector(`script[src="${e}"]`)!==null)return Promise.resolve("ok");const o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=e;const t=p(o,e);return document.body.appendChild(o),t}catch(o){return Promise.reject(o)}},a=e=>{const o=r.get(e);if(o!==void 0)return o;const t=i(e).catch(s=>{throw r.delete(e),s});return r.set(e,t),t},m=e=>import(e),n=new Map,h=e=>new Promise((o,t)=>{try{const s=document.createElement("link");s.type="text/css",s.href=e,s.rel="stylesheet",s.addEventListener("load",()=>{o("ok")}),s.addEventListener("error",()=>{const d=new Error(`Failed to load the stylesheet from ${e}`);console.error(d),t(d)}),document.head.appendChild(s)}catch(s){console.error(s),t(s)}}),u=e=>{const o=n.get(e);if(o!==void 0)return o;const t=h(e).catch(s=>{throw n.delete(e),s});return n.set(e,t),t},c={umd:{prod:"https://app.smplrspace.com/lib/smplr.js",dev:"https://dev.smplrspace.com/lib/smplr.js",local:"http://localhost:3000/lib/smplr.umd.js"},esm:{prod:"https://app.smplrspace.com/lib/smplr.mjs",dev:"https://dev.smplrspace.com/lib/smplr.mjs",local:"http://localhost:3000/lib/smplr.mjs"},css:{prod:"https://app.smplrspace.com/lib/smplr.css",dev:"https://dev.smplrspace.com/lib/smplr.css",local:"http://localhost:3000/lib/style.css"}};async function f(e="esm",o="prod"){try{u(c.css[o])}catch{console.warn("oops")}try{if(e==="esm"){const t=await m(c.esm[o]);return console.log("loaded esm",t.toString()),t}else{await a(c.umd[o]);const t=window.smplr;if(!t)throw new Error("Failed to load smplr.js");return console.log("loaded umd",t.toString()),t}}catch(t){throw console.error(t),new Error("Failed to load smplr.js")}}l.loadSmplrJs=f,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|