@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.
@@ -1,10 +1,10 @@
1
- var d = Object.defineProperty;
2
- var c = (s, t, e) => t in s ? d(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var l = (s, t, e) => (c(s, typeof t != "symbol" ? t + "" : t, e), e);
4
- const p = new MessageChannel(), o = p.port1;
5
- class g {
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
- l(this, "iframe");
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 m = (s) => s ? new Promise((t) => {
35
- var n, r;
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
- (r = (n = import.meta) == null ? void 0 : n.url) != null && r.includes("localhost") ? "http://localhost:5173/index.html" : "https://www.unpkg.com/@eox/chart/dist/index.html"
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 i;
44
- a || ((i = e.contentWindow) == null || i.postMessage("init", "*", [p.port2]), a = !0, t(new g(e)));
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
- m as createChart
52
+ D as createChart
49
53
  };
@@ -1 +1 @@
1
- (function(n,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(n=typeof globalThis<"u"?globalThis:n||self,t(n.Interface={}))})(this,function(n){"use strict";var u=Object.defineProperty;var f=(n,t,o)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var c=(n,t,o)=>(f(n,typeof t!="symbol"?t+"":t,o),o);const t=new MessageChannel,o=t.port1;class l{constructor(e){c(this,"iframe");this.iframe=e}setData(e){o.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){o.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){o.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){o.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){o.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const s=Date.now();o.onmessage=r=>{r.data.ts===s&&e(r.data.body)},o.postMessage({ts:s,type:"getFoo",body:"hello world"})})}}const p=a=>a?new Promise(e=>{var i;const s=document.createElement("iframe");s.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",s.setAttribute("src",(i=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&&i.includes("localhost")?"http://localhost:5173/index.html":"https://www.unpkg.com/@eox/chart/dist/index.html"),s.setAttribute("id","EOxChart"),a==null||a.appendChild(s);let r=!1;s.onload=()=>{var d;r||((d=s.contentWindow)==null||d.postMessage("init","*",[t.port2]),r=!0,e(new l(s)))}}):(console.error("no div selected"),null);n.createChart=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/chart",
3
- "version": "2.0.0-alpha7",
3
+ "version": "2.0.0-alpha7b",
4
4
  "dependencies": {
5
5
  "chart.js": "^4.2.1",
6
6
  "chartjs-adapter-luxon": "^1.3.1",
@@ -1,10 +1,10 @@
1
- var d = Object.defineProperty;
2
- var c = (s, t, e) => t in s ? d(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var l = (s, t, e) => (c(s, typeof t != "symbol" ? t + "" : t, e), e);
4
- const p = new MessageChannel(), o = p.port1;
5
- class g {
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
- l(this, "iframe");
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 m = (s) => s ? new Promise((t) => {
35
- var n, r;
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
- (r = (n = import.meta) == null ? void 0 : n.url) != null && r.includes("localhost") ? "http://localhost:5173/index.html" : "https://www.unpkg.com/@eox/chart/dist/index.html"
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 i;
44
- a || ((i = e.contentWindow) == null || i.postMessage("init", "*", [p.port2]), a = !0, t(new g(e)));
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
- m as createChart
52
+ D as createChart
49
53
  };
@@ -1 +1 @@
1
- (function(n,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(n=typeof globalThis<"u"?globalThis:n||self,t(n.Interface={}))})(this,function(n){"use strict";var u=Object.defineProperty;var f=(n,t,o)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var c=(n,t,o)=>(f(n,typeof t!="symbol"?t+"":t,o),o);const t=new MessageChannel,o=t.port1;class l{constructor(e){c(this,"iframe");this.iframe=e}setData(e){o.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){o.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){o.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){o.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){o.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const s=Date.now();o.onmessage=r=>{r.data.ts===s&&e(r.data.body)},o.postMessage({ts:s,type:"getFoo",body:"hello world"})})}}const p=a=>a?new Promise(e=>{var i;const s=document.createElement("iframe");s.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",s.setAttribute("src",(i=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&&i.includes("localhost")?"http://localhost:5173/index.html":"https://www.unpkg.com/@eox/chart/dist/index.html"),s.setAttribute("id","EOxChart"),a==null||a.appendChild(s);let r=!1;s.onload=()=>{var d;r||((d=s.contentWindow)==null||d.postMessage("init","*",[t.port2]),r=!0,e(new l(s)))}}):(console.error("no div selected"),null);n.createChart=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
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
- : "https://www.unpkg.com/@eox/chart/dist/index.html"
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