@eox/chart 2.0.0-alpha7 → 2.0.0-alpha7b
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/interface.mjs +17 -13
- package/dist/interface.umd.js +1 -1
- package/package.json +1 -1
- package/public/interface.mjs +17 -13
- package/public/interface.umd.js +1 -1
- package/src/interface.ts +13 -1
package/dist/interface.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
class
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var b = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var d = (s, t, e) => (b(s, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
const g = new MessageChannel(), o = g.port1;
|
|
5
|
+
class f {
|
|
6
6
|
constructor(t) {
|
|
7
|
-
|
|
7
|
+
d(this, "iframe");
|
|
8
8
|
this.iframe = t;
|
|
9
9
|
}
|
|
10
10
|
setData(t) {
|
|
@@ -31,19 +31,23 @@ class g {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
var
|
|
34
|
+
const D = (s) => s ? new Promise((t) => {
|
|
35
|
+
var r, l, c, i;
|
|
36
36
|
const e = document.createElement("iframe");
|
|
37
37
|
e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
|
|
38
38
|
"src",
|
|
39
|
-
(
|
|
40
|
-
), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e)
|
|
39
|
+
(l = (r = import.meta) == null ? void 0 : r.url) != null && l.includes("localhost") ? "http://localhost:5173/index.html" : "about:blank"
|
|
40
|
+
), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), (i = (c = import.meta) == null ? void 0 : c.url) != null && i.includes("localhost") || fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then((n) => n.text()).then((n) => {
|
|
41
|
+
var m, p, h;
|
|
42
|
+
const u = n.replace("./assets/", "https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");
|
|
43
|
+
(m = e.contentDocument) == null || m.open(), (p = e.contentDocument) == null || p.write(u), (h = e.contentDocument) == null || h.close();
|
|
44
|
+
});
|
|
41
45
|
let a = !1;
|
|
42
46
|
e.onload = () => {
|
|
43
|
-
var
|
|
44
|
-
a || ((
|
|
47
|
+
var n;
|
|
48
|
+
a || ((n = e.contentWindow) == null || n.postMessage("init", "*", [g.port2]), a = !0, t(new f(e)));
|
|
45
49
|
};
|
|
46
50
|
}) : (console.error("no div selected"), null);
|
|
47
51
|
export {
|
|
48
|
-
|
|
52
|
+
D as createChart
|
|
49
53
|
};
|
package/dist/interface.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.Interface={}))})(this,function(s){"use strict";var g=Object.defineProperty;var b=(s,t,n)=>t in s?g(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var f=(s,t,n)=>(b(s,typeof t!="symbol"?t+"":t,n),n);const t=new MessageChannel,n=t.port1;class m{constructor(e){f(this,"iframe");this.iframe=e}setData(e){n.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){n.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){n.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){n.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){n.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const o=Date.now();n.onmessage=i=>{i.data.ts===o&&e(i.data.body)},n.postMessage({ts:o,type:"getFoo",body:"hello world"})})}}const h=a=>a?new Promise(e=>{var c,d;const o=document.createElement("iframe");o.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",o.setAttribute("src",(c=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&c.includes("localhost")?"http://localhost:5173/index.html":"about:blank"),o.setAttribute("id","EOxChart"),a==null||a.appendChild(o),(d=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&d.includes("localhost")||fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then(r=>r.text()).then(r=>{var l,u,p;const y=r.replace("./assets/","https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");(l=o.contentDocument)==null||l.open(),(u=o.contentDocument)==null||u.write(y),(p=o.contentDocument)==null||p.close()});let i=!1;o.onload=()=>{var r;i||((r=o.contentWindow)==null||r.postMessage("init","*",[t.port2]),i=!0,e(new m(o)))}}):(console.error("no div selected"),null);s.createChart=h,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
package/public/interface.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
class
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var b = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var d = (s, t, e) => (b(s, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
const g = new MessageChannel(), o = g.port1;
|
|
5
|
+
class f {
|
|
6
6
|
constructor(t) {
|
|
7
|
-
|
|
7
|
+
d(this, "iframe");
|
|
8
8
|
this.iframe = t;
|
|
9
9
|
}
|
|
10
10
|
setData(t) {
|
|
@@ -31,19 +31,23 @@ class g {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
var
|
|
34
|
+
const D = (s) => s ? new Promise((t) => {
|
|
35
|
+
var r, l, c, i;
|
|
36
36
|
const e = document.createElement("iframe");
|
|
37
37
|
e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
|
|
38
38
|
"src",
|
|
39
|
-
(
|
|
40
|
-
), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e)
|
|
39
|
+
(l = (r = import.meta) == null ? void 0 : r.url) != null && l.includes("localhost") ? "http://localhost:5173/index.html" : "about:blank"
|
|
40
|
+
), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), (i = (c = import.meta) == null ? void 0 : c.url) != null && i.includes("localhost") || fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then((n) => n.text()).then((n) => {
|
|
41
|
+
var m, p, h;
|
|
42
|
+
const u = n.replace("./assets/", "https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");
|
|
43
|
+
(m = e.contentDocument) == null || m.open(), (p = e.contentDocument) == null || p.write(u), (h = e.contentDocument) == null || h.close();
|
|
44
|
+
});
|
|
41
45
|
let a = !1;
|
|
42
46
|
e.onload = () => {
|
|
43
|
-
var
|
|
44
|
-
a || ((
|
|
47
|
+
var n;
|
|
48
|
+
a || ((n = e.contentWindow) == null || n.postMessage("init", "*", [g.port2]), a = !0, t(new f(e)));
|
|
45
49
|
};
|
|
46
50
|
}) : (console.error("no div selected"), null);
|
|
47
51
|
export {
|
|
48
|
-
|
|
52
|
+
D as createChart
|
|
49
53
|
};
|
package/public/interface.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.Interface={}))})(this,function(s){"use strict";var g=Object.defineProperty;var b=(s,t,n)=>t in s?g(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var f=(s,t,n)=>(b(s,typeof t!="symbol"?t+"":t,n),n);const t=new MessageChannel,n=t.port1;class m{constructor(e){f(this,"iframe");this.iframe=e}setData(e){n.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){n.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){n.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){n.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){n.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const o=Date.now();n.onmessage=i=>{i.data.ts===o&&e(i.data.body)},n.postMessage({ts:o,type:"getFoo",body:"hello world"})})}}const h=a=>a?new Promise(e=>{var c,d;const o=document.createElement("iframe");o.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",o.setAttribute("src",(c=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&c.includes("localhost")?"http://localhost:5173/index.html":"about:blank"),o.setAttribute("id","EOxChart"),a==null||a.appendChild(o),(d=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&d.includes("localhost")||fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then(r=>r.text()).then(r=>{var l,u,p;const y=r.replace("./assets/","https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");(l=o.contentDocument)==null||l.open(),(u=o.contentDocument)==null||u.write(y),(p=o.contentDocument)==null||p.close()});let i=!1;o.onload=()=>{var r;i||((r=o.contentWindow)==null||r.postMessage("init","*",[t.port2]),i=!0,e(new m(o)))}}):(console.error("no div selected"),null);s.createChart=h,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/src/interface.ts
CHANGED
|
@@ -57,10 +57,22 @@ const createChart = (div: HTMLElement | null) => {
|
|
|
57
57
|
"src",
|
|
58
58
|
import.meta?.url?.includes("localhost")
|
|
59
59
|
? "http://localhost:5173/index.html"
|
|
60
|
-
: "
|
|
60
|
+
: "about:blank"
|
|
61
61
|
);
|
|
62
62
|
iframe.setAttribute("id", "EOxChart");
|
|
63
63
|
div?.appendChild(iframe);
|
|
64
|
+
if (!import.meta?.url?.includes("localhost")) {
|
|
65
|
+
fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html")
|
|
66
|
+
.then((response) => {
|
|
67
|
+
return response.text();
|
|
68
|
+
})
|
|
69
|
+
.then((text) => {
|
|
70
|
+
const html = text.replace('./assets/', 'https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/');
|
|
71
|
+
iframe.contentDocument?.open();
|
|
72
|
+
iframe.contentDocument?.write(html);
|
|
73
|
+
iframe.contentDocument?.close();
|
|
74
|
+
})
|
|
75
|
+
}
|
|
64
76
|
let iframeLoaded = false;
|
|
65
77
|
iframe.onload = () => {
|
|
66
78
|
// store if the iFrame has already loaded, since in Cypress hovering over the test triggers
|