@eox/chart 2.0.0-beta1 → 2.0.0-beta2

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.
@@ -0,0 +1,108 @@
1
+ var f = Object.defineProperty;
2
+ var x = (s, t, e) => t in s ? f(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var h = (s, t, e) => (x(s, typeof t != "symbol" ? t + "" : t, e), e);
4
+ const b = "@eox/chart", w = "2.0.0-alpha8", v = {
5
+ "chart.js": "^4.2.1",
6
+ "chartjs-adapter-luxon": "^1.3.1",
7
+ "chartjs-chart-error-bars": "^4.1.2"
8
+ }, D = {
9
+ "@eox/eslint-config": "^1.0.0",
10
+ "@types/luxon": "^3.2.0",
11
+ "@typescript-eslint/eslint-plugin": "^5.50.0",
12
+ "@typescript-eslint/parser": "^5.50.0",
13
+ cypress: "^12.6.0",
14
+ "cypress-vite": "^1.3.0",
15
+ "eslint-plugin-cypress": "^2.12.1",
16
+ "eslint-plugin-typescript": "^0.14.0",
17
+ install: "^0.13.0",
18
+ luxon: "^3.3.0",
19
+ npm: "^9.6.3",
20
+ "p-retry": "^5.1.2",
21
+ "pre-commit": "^1.2.2",
22
+ "start-server-and-test": "^1.15.2",
23
+ typescript: "^4.9.3",
24
+ vite: "^4.0.0"
25
+ }, M = {
26
+ npm: ">=8.0.0",
27
+ node: ">=18.0.0"
28
+ }, j = [
29
+ "dist",
30
+ "scripts",
31
+ "src",
32
+ "typings"
33
+ ], S = "./dist/interface.mjs", C = {
34
+ start: "vite",
35
+ build: "tsc && vite build --config vite.config.interface.ts && vite build --config vite.config.map.ts",
36
+ watch: "node scripts/watch.mjs",
37
+ preview: "vite preview",
38
+ format: "prettier --write .",
39
+ lint: "eslint --ext .js,.ts .",
40
+ "lint:fix": "eslint --ext .js,.ts . --fix",
41
+ cypress: "start-server-and-test start 5173 'cypress open'",
42
+ test: "start-server-and-test start 5173 'cypress run'"
43
+ }, E = {
44
+ name: b,
45
+ version: w,
46
+ dependencies: v,
47
+ devDependencies: D,
48
+ engines: M,
49
+ files: j,
50
+ main: S,
51
+ scripts: C,
52
+ "pre-commit": [
53
+ "format",
54
+ "lint:fix"
55
+ ]
56
+ }, u = new MessageChannel(), n = u.port1;
57
+ class k {
58
+ constructor(t) {
59
+ h(this, "iframe");
60
+ this.iframe = t;
61
+ }
62
+ setData(t) {
63
+ n.postMessage({ type: "setData", body: { data: t } });
64
+ }
65
+ setSignalsData(t) {
66
+ n.postMessage({ type: "setSignalsData", body: { data: t } });
67
+ }
68
+ setSignalsEndpoint(t) {
69
+ n.postMessage({ type: "setSignalsEndpoint", body: { options: t } });
70
+ }
71
+ setSignalsGeometry(t) {
72
+ n.postMessage({ type: "setSignalsGeometry", body: { geometry: t } });
73
+ }
74
+ setOptions(t) {
75
+ n.postMessage({ type: "setOptions", body: { options: t } });
76
+ }
77
+ getFoo() {
78
+ return new Promise((t) => {
79
+ const e = Date.now();
80
+ n.onmessage = (o) => {
81
+ o.data.ts === e && t(o.data.body);
82
+ }, n.postMessage({ ts: e, type: "getFoo", body: "hello world" });
83
+ });
84
+ }
85
+ }
86
+ const $ = (s) => s ? new Promise((t) => {
87
+ var a, c, p, l;
88
+ const e = document.createElement("iframe");
89
+ if (e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
90
+ "src",
91
+ (c = (a = import.meta) == null ? void 0 : a.url) != null && c.includes("localhost") ? "http://localhost:5173/index.html" : "about:blank"
92
+ ), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), !((l = (p = import.meta) == null ? void 0 : p.url) != null && l.includes("localhost"))) {
93
+ const r = `https://www.unpkg.com/@eox/chart@${E.version}/dist`;
94
+ fetch(`${r}/index.html`).then((i) => i.text()).then((i) => {
95
+ var d, m, g;
96
+ const y = i.replace("./assets/", `${r}/assets/`);
97
+ (d = e.contentDocument) == null || d.open(), (m = e.contentDocument) == null || m.write(y), (g = e.contentDocument) == null || g.close();
98
+ });
99
+ }
100
+ let o = !1;
101
+ e.onload = () => {
102
+ var r;
103
+ o || ((r = e.contentWindow) == null || r.postMessage("init", "*", [u.port2]), o = !0, t(new k(e)));
104
+ };
105
+ }) : (console.error("no div selected"), null);
106
+ export {
107
+ $ as createChart
108
+ };
@@ -0,0 +1 @@
1
+ (function(n,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n.Interface={}))})(this,function(n){"use strict";var v=Object.defineProperty;var S=(n,s,o)=>s in n?v(n,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[s]=o;var y=(n,s,o)=>(S(n,typeof s!="symbol"?s+"":s,o),o);const g={name:"@eox/chart",version:"2.0.0-alpha8",dependencies:{"chart.js":"^4.2.1","chartjs-adapter-luxon":"^1.3.1","chartjs-chart-error-bars":"^4.1.2"},devDependencies:{"@eox/eslint-config":"^1.0.0","@types/luxon":"^3.2.0","@typescript-eslint/eslint-plugin":"^5.50.0","@typescript-eslint/parser":"^5.50.0",cypress:"^12.6.0","cypress-vite":"^1.3.0","eslint-plugin-cypress":"^2.12.1","eslint-plugin-typescript":"^0.14.0",install:"^0.13.0",luxon:"^3.3.0",npm:"^9.6.3","p-retry":"^5.1.2","pre-commit":"^1.2.2","start-server-and-test":"^1.15.2",typescript:"^4.9.3",vite:"^4.0.0"},engines:{npm:">=8.0.0",node:">=18.0.0"},files:["dist","scripts","src","typings"],main:"./dist/interface.mjs",scripts:{start:"vite",build:"tsc && vite build --config vite.config.interface.ts && vite build --config vite.config.map.ts",watch:"node scripts/watch.mjs",preview:"vite preview",format:"prettier --write .",lint:"eslint --ext .js,.ts .","lint:fix":"eslint --ext .js,.ts . --fix",cypress:"start-server-and-test start 5173 'cypress open'",test:"start-server-and-test start 5173 'cypress run'"},"pre-commit":["format","lint:fix"]},d=new MessageChannel,i=d.port1;class b{constructor(e){y(this,"iframe");this.iframe=e}setData(e){i.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){i.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){i.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){i.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){i.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const t=Date.now();i.onmessage=c=>{c.data.ts===t&&e(c.data.body)},i.postMessage({ts:t,type:"getFoo",body:"hello world"})})}}const w=r=>r?new Promise(e=>{var l,u;const t=document.createElement("iframe");if(t.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",t.setAttribute("src",(l=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&&l.includes("localhost")?"http://localhost:5173/index.html":"about:blank"),t.setAttribute("id","EOxChart"),r==null||r.appendChild(t),!((u=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&&u.includes("localhost"))){const a=`https://www.unpkg.com/@eox/chart@${g.version}/dist`;fetch(`${a}/index.html`).then(p=>p.text()).then(p=>{var f,m,h;const x=p.replace("./assets/",`${a}/assets/`);(f=t.contentDocument)==null||f.open(),(m=t.contentDocument)==null||m.write(x),(h=t.contentDocument)==null||h.close()})}let c=!1;t.onload=()=>{var a;c||((a=t.contentWindow)==null||a.postMessage("init","*",[d.port2]),c=!0,e(new b(t)))}}):(console.error("no div selected"),null);n.createChart=w,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/chart",
3
- "version": "2.0.0-beta1",
3
+ "version": "2.0.0-beta2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "chart.js": "^4.2.1",
@@ -0,0 +1,37 @@
1
+ import { EOxChart } from "../src/main";
2
+
3
+ describe("SH Display", () => {
4
+ beforeEach(() => {
5
+ cy.visit("/elements/chart/test/general.html");
6
+ });
7
+ it("configures signals endpoint for chart to retrieve data", () => {
8
+ cy.get("eox-chart").should(($el) => {
9
+ const eoxChart = <EOxChart>$el[0];
10
+
11
+ const options = {
12
+ endpoint:
13
+ "https://xcube-geodb.brockmann-consult.de/gtif/f0ad1e25-98fa-4b82-9228-815ab24f5dd1",
14
+ source: "GTIF",
15
+ table: "no2_data",
16
+ timeParameter: "date",
17
+ features: [["no2_ec_station_ppbv"]],
18
+ colors: [
19
+ "#ff0029",
20
+ "#377eb8",
21
+ "#66a61e",
22
+ "#984ea3",
23
+ "#00d2d5",
24
+ "#ff7f00",
25
+ "#af8d00",
26
+ ],
27
+ active: ["no2_ec_station_ppbv"],
28
+ timeInterval: {
29
+ months: 3,
30
+ },
31
+ startTime: "2022-01-01",
32
+ endTime: "2022-03-30",
33
+ };
34
+ eoxChart.setGeoDBEndpoint(options);
35
+ });
36
+ });
37
+ });
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { EOxChart } from "../src/main";
3
2
 
4
3
  describe("SH Display", () => {
@@ -43,26 +42,6 @@ describe("SH Display", () => {
43
42
  containedSignals: ["prec"],
44
43
  },
45
44
  ],
46
- additionalYAxis: [
47
- {
48
- id: "add1",
49
- containedSignals: ["modis_ndwi"],
50
- },
51
- {
52
- id: "add2",
53
- containedSignals: ["modis_savi"],
54
- },
55
- ],
56
- additionalYAxis: [
57
- {
58
- id: "add1",
59
- containedSignals: ["modis_ndwi"],
60
- },
61
- {
62
- id: "add2",
63
- containedSignals: ["modis_savi"],
64
- },
65
- ],
66
45
  colors: [
67
46
  "#ff0029",
68
47
  "#377eb8",