@eodash/eodash 5.0.0-alpha.2.16 → 5.0.0-alpha.2.18

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.
Files changed (49) hide show
  1. package/core/client/App.vue +2 -0
  2. package/core/client/composables/EodashMap.js +207 -103
  3. package/core/client/composables/index.js +13 -2
  4. package/core/client/eodash.js +8 -3
  5. package/core/client/plugins/axios.js +8 -0
  6. package/core/client/plugins/index.js +2 -1
  7. package/core/client/store/Actions.js +2 -1
  8. package/core/client/store/States.js +4 -0
  9. package/core/client/store/stac.js +11 -8
  10. package/core/client/utils/createLayers.js +83 -46
  11. package/core/client/utils/eodashSTAC.js +69 -19
  12. package/core/client/utils/helpers.js +108 -35
  13. package/core/client/vite-env.d.ts +1 -0
  14. package/dist/client/{DashboardLayout-CCtyOil0.js → DashboardLayout-Dk6lzKZA.js} +2 -2
  15. package/dist/client/{DynamicWebComponent-But2r1Sj.js → DynamicWebComponent-BkMCGU7a.js} +2 -2
  16. package/dist/client/EodashDatePicker-D27wn0jP.js +276 -0
  17. package/dist/client/EodashItemFilter-DS1mOc2p.js +7651 -0
  18. package/dist/client/{EodashLayerControl-BhZL4pYM.js → EodashLayerControl-BqGA6jbV.js} +5604 -5428
  19. package/dist/client/{EodashMap-C5tOgVOv.js → EodashMap-BnVrfBnA.js} +9083 -9032
  20. package/dist/client/{EodashMapBtns-CdDfVQj0.js → EodashMapBtns-rv-U1nI_.js} +2 -2
  21. package/dist/client/{ExportState-CKCCN_VI.js → ExportState-C3Z1ET5c.js} +138 -131
  22. package/dist/client/{Footer-B9yVgyzx.js → Footer-BBkNiqPm.js} +63 -63
  23. package/dist/client/{Header-CPIlUEOq.js → Header-BQKHLO5P.js} +70 -70
  24. package/dist/client/{IframeWrapper-DRw1kHJm.js → IframeWrapper-BX4e2uxq.js} +1 -1
  25. package/dist/client/{MobileLayout-CPxVee5U.js → MobileLayout-C2aqobN5.js} +43 -41
  26. package/dist/client/{PopUp-Dca-gx9a.js → PopUp-DG3zrW12.js} +15 -15
  27. package/dist/client/{VImg-PHLA1nP1.js → VImg-BLpHACcB.js} +33 -31
  28. package/dist/client/VMain-DOyRcpub.js +38 -0
  29. package/dist/client/VOverlay-DAiInZQP.js +973 -0
  30. package/dist/client/{WidgetsContainer-jxk3kw-d.js → WidgetsContainer-BqoX7R5Z.js} +3 -3
  31. package/dist/client/{asWebComponent-3OsFQJVx.js → asWebComponent-tNU8_fkz.js} +10199 -9314
  32. package/dist/client/eo-dash.js +1 -1
  33. package/dist/client/{forwardRefs-BxZaq9ml.js → forwardRefs-BexjzXbg.js} +1 -1
  34. package/dist/client/{index-Vul961Xy.js → index-F73os72i.js} +23 -23
  35. package/dist/client/{lerc-B4lXefGh-BESXOHWk.js → lerc-B4lXefGh-DhdntrgS.js} +1 -1
  36. package/dist/client/{ssrBoot-BFMBrCqY.js → ssrBoot-C71RpKe4.js} +1 -1
  37. package/dist/client/style.css +2 -2
  38. package/dist/client/{transition-U5aFjJtV.js → transition-DNdd2Y-1.js} +1 -1
  39. package/dist/client/{webfontloader-D_JbBwHu.js → webfontloader-C7dpDL7m.js} +1 -1
  40. package/dist/node/cli.js +1 -1
  41. package/package.json +26 -24
  42. package/widgets/EodashDatePicker.vue +112 -88
  43. package/widgets/EodashLayerControl.vue +3 -1
  44. package/widgets/EodashMap.vue +62 -54
  45. package/widgets/ExportState.vue +4 -2
  46. package/dist/client/EodashDatePicker-jeYiWflv.js +0 -247
  47. package/dist/client/EodashItemFilter-BFlfWeE_.js +0 -10125
  48. package/dist/client/VMain-Ck81LJfb.js +0 -39
  49. package/dist/client/VOverlay-CL4hiJB8.js +0 -972
@@ -1,4 +1,4 @@
1
- import { p as m, az as b, d, bo as l, ab as u } from "./asWebComponent-3OsFQJVx.js";
1
+ import { p as m, az as b, d, bp as l, ab as u } from "./asWebComponent-tNU8_fkz.js";
2
2
  const j = m({
3
3
  transition: {
4
4
  type: [Boolean, String, Object],
@@ -1,4 +1,4 @@
1
- import { av as Ft } from "./asWebComponent-3OsFQJVx.js";
1
+ import { av as Ft } from "./asWebComponent-tNU8_fkz.js";
2
2
  var ot = { exports: {} };
3
3
  (function(O) {
4
4
  (function() {
package/dist/node/cli.js CHANGED
@@ -17,4 +17,4 @@ ${i.lib?`<eo-dash style="height:100dvh;"/>
17
17
  <script type="module" src="${t.resolve(`/@fs/${c}`,"core/client/render.js")}"><\/script>
18
18
  `}
19
19
  </body>
20
- </html>`,D=C(({mode:e,command:n})=>({base:i.base??"",cacheDir:z,plugins:[N({customElement:!1,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),O({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:M}],customLogger:v,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:R,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:f,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function M(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=v.info;return v.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await I(l).then(p=>{r.write(p)}),r.end();return}if(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.originalUrl);r.end(p);return}d()})}}const Y=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},B=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await L(l,t.join(f,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(i.lib)await e();else{const n=t.join(c,"/index.html");await T(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function G(){(await S({root:s,base:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.host},build:{outDir:f}})).printUrls()}const K=process.argv?.[2];(async()=>{switch(K){case"dev":await Y();break;case"build":await B();break;case"preview":await G();break;default:console.error("command not found");break}})();
20
+ </html>`,D=C(({mode:e,command:n})=>({base:i.base??"",cacheDir:z,plugins:[N({customElement:!1,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),O({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:M}],customLogger:v,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs","loglevel"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:R,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:f,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function M(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=v.info;return v.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await I(l).then(p=>{r.write(p)}),r.end();return}if(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.originalUrl);r.end(p);return}d()})}}const Y=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},B=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await L(l,t.join(f,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(i.lib)await e();else{const n=t.join(c,"/index.html");await T(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function G(){(await S({root:s,base:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.host},build:{outDir:f}})).printUrls()}const K=process.argv?.[2];(async()=>{switch(K){case"dev":await Y();break;case"build":await B();break;case"preview":await G();break;default:console.error("command not found");break}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.2.16",
3
+ "version": "5.0.0-alpha.2.18",
4
4
  "type": "module",
5
5
  "types": "./core/client/types.d.ts",
6
6
  "files": [
@@ -47,49 +47,51 @@
47
47
  "docs:generate": "typedoc --options typedoc.config.json"
48
48
  },
49
49
  "dependencies": {
50
- "@eox/itemfilter": "^1.0.1",
50
+ "@eox/itemfilter": "^1.1.0",
51
51
  "@eox/jsonform": "^0.8.2",
52
- "@eox/layercontrol": "^0.18.2-dev.1722439716.0",
52
+ "@eox/layercontrol": "^0.20.1-dev.1726221051.0",
53
53
  "@eox/layout": "^0.1.0",
54
- "@eox/map": "1.12.1-dev.1723130201.0",
54
+ "@eox/map": "^1.13.0",
55
55
  "@eox/stacinfo": "^0.3.3",
56
- "@eox/timecontrol": "^0.6.1",
56
+ "@eox/timecontrol": "^0.7.3-dev.1726219233.0",
57
57
  "@mdi/js": "^7.4.47",
58
- "@vitejs/plugin-vue": "^5.0.5",
58
+ "@vitejs/plugin-vue": "^5.1.2",
59
59
  "animated-details": "gist:2912bb049fa906671807415eb0e87188",
60
- "axios": "^1.7.2",
60
+ "axios": "^1.7.4",
61
+ "axios-cache-interceptor": "^1.5.3",
61
62
  "commander": "^12.1.0",
62
- "core-js": "^3.37.1",
63
- "pinia": "^2.1.7",
64
- "sass": "^1.77.7",
63
+ "core-js": "^3.38.1",
64
+ "loglevel": "^1.9.1",
65
+ "pinia": "^2.2.2",
66
+ "sass": "^1.77.8",
65
67
  "stac-js": "^0.0.9",
66
68
  "stac-ts": "^1.0.3",
67
69
  "v-calendar": "^3.1.2",
68
- "vite": "^5.3.3",
69
- "vite-plugin-vuetify": "^2.0.3",
70
- "vue": "^3.2.0",
71
- "vuetify": "^3.6.12",
70
+ "vite": "^5.4.2",
71
+ "vite-plugin-vuetify": "^2.0.4",
72
+ "vue": "3.4.38",
73
+ "vuetify": "^3.7.0",
72
74
  "webfontloader": "^1.6.28"
73
75
  },
74
76
  "devDependencies": {
75
- "@babel/types": "^7.24.7",
77
+ "@babel/types": "^7.25.4",
76
78
  "@eox/eslint-config": "^2.0.0",
77
- "@pinia/testing": "^0.1.3",
78
- "@types/node": "latest",
79
+ "@pinia/testing": "^0.1.5",
80
+ "@types/node": "^22.5.0",
79
81
  "@types/openlayers": "^4.6.23",
80
82
  "@types/webfontloader": "^1.6.38",
81
- "cypress": "^13.13.0",
82
- "eslint": "^9.6.0",
83
+ "cypress": "^13.13.3",
84
+ "eslint": "^9.9.0",
83
85
  "eslint-plugin-vue": "^9.27.0",
84
- "prettier": "^3.3.2",
86
+ "prettier": "^3.3.3",
85
87
  "terminate": "^2.8.0",
86
- "typedoc": "^0.26.4",
87
- "typedoc-plugin-markdown": "^4.2.0",
88
+ "typedoc": "^0.26.6",
89
+ "typedoc-plugin-markdown": "^4.2.5",
88
90
  "typedoc-plugin-vue": "^1.2.0",
89
91
  "typedoc-vitepress-theme": "^1.0.1",
90
- "typescript": "^5.5.3",
92
+ "typescript": "^5.5.4",
91
93
  "unplugin-fonts": "^1.1.1",
92
- "vitepress": "^1.3.0",
94
+ "vitepress": "^1.3.3",
93
95
  "vitest": "^1.6.0",
94
96
  "vue-tsc": "2.0.22"
95
97
  },
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <VCDatePicker v-model="currentDate" :masks="masks" :attributes="attributes">
2
+ <VCDatePicker
3
+ v-model.number="currentDate"
4
+ :masks="masks"
5
+ :attributes="attributes"
6
+ >
3
7
  <template #default="{ inputValue, inputEvents }">
4
8
  <div
5
9
  class="flex rounded-lg border border-gray-300 dark:border-gray-600"
@@ -13,6 +17,11 @@
13
17
  />
14
18
  </div>
15
19
  </template>
20
+ <template #footer v-if="hintText">
21
+ <div class="w-full px-4 pb-3" style="font-size: 12px">
22
+ <span v-html="hintText" />
23
+ </div>
24
+ </template>
16
25
  </VCDatePicker>
17
26
  <v-row align="center" justify="center" style="margin-top: 6px">
18
27
  <v-btn
@@ -33,49 +42,49 @@
33
42
  </v-btn>
34
43
  </v-row>
35
44
  </template>
45
+ <style>
46
+ .vc-day-content {
47
+ color: #5e5e5e;
48
+ font-weight: normal;
49
+ }
50
+ </style>
36
51
 
37
52
  <script setup>
38
53
  import { DatePicker as VCDatePicker } from "v-calendar";
39
54
  import "v-calendar/style.css";
40
- import { computed, ref, onMounted, watch, reactive } from "vue";
55
+ import { watch, reactive, ref, customRef } from "vue";
41
56
  import { storeToRefs } from "pinia";
42
57
  import { useSTAcStore } from "@/store/stac";
43
58
  import { datetime } from "@/store/States";
44
59
  import { mdiRayStartArrow, mdiRayEndArrow } from "@mdi/js";
45
60
  import { eodashCollections } from "@/utils/states";
61
+ import log from "loglevel";
46
62
 
47
- /**
48
- * @param {boolean} reverse
49
- */
50
- function jumpDate(reverse) {
51
- if (attributes.length) {
52
- // We have potentially multiple collections we need to iterate (currently only one)
53
- let latestDateMS = reverse ? Infinity : -Infinity;
54
- attributes.forEach((coll) => {
55
- if (coll?.dates) {
56
- coll.dates.forEach((d) => {
57
- // TODO: we need to handle time ranges and other options here
58
- if (d instanceof Date) {
59
- if (
60
- (!reverse && d.getTime() > latestDateMS) ||
61
- (reverse && d.getTime() < latestDateMS)
62
- ) {
63
- latestDateMS = d.getTime();
64
- }
65
- }
66
- });
67
- }
68
- });
69
- if (latestDateMS !== 0) {
70
- currentDate.value = new Date(latestDateMS);
71
- }
72
- }
73
- }
63
+ // holds the number value of the datetime
64
+ const currentDate = customRef((track, trigger) => ({
65
+ get() {
66
+ track();
67
+ return new Date(datetime.value).getTime();
68
+ },
69
+ /** @param {number} num */
70
+ set(num) {
71
+ trigger();
72
+ log.debug("Datepicker setting currentDate", datetime.value);
73
+ datetime.value = new Date(num).toISOString();
74
+ },
75
+ }));
74
76
 
75
77
  const masks = ref({
76
78
  input: "YYYY-MM-DD",
77
79
  });
78
80
 
81
+ defineProps({
82
+ hintText: {
83
+ type: String,
84
+ default: null,
85
+ },
86
+ });
87
+
79
88
  /**
80
89
  * Attributes displayed on datepicker
81
90
  *
@@ -88,67 +97,82 @@ const masks = ref({
88
97
  */
89
98
  const attributes = reactive([]);
90
99
 
91
- const currentDate = computed({
92
- get() {
93
- return datetime.value ? new Date(datetime.value) : new Date();
94
- },
95
- /** @param {Date | string} updatedDate */
96
- set(updatedDate) {
97
- if (updatedDate instanceof Date && !isNaN(updatedDate.getTime())) {
98
- datetime.value = new Date(
99
- updatedDate.getTime() - updatedDate.getTimezoneOffset() * 60000,
100
- ).toISOString();
101
- } else {
102
- datetime.value = new Date().toISOString();
103
- }
104
- },
105
- });
100
+ const { selectedStac } = storeToRefs(useSTAcStore());
106
101
 
107
- onMounted(() => {
108
- const { selectedStac } = storeToRefs(useSTAcStore());
109
- watch(
110
- [selectedStac],
111
- async ([updatedStac]) => {
112
- if (updatedStac) {
113
- const wongPalette = [
114
- "#009E73",
115
- "#0072B2",
116
- "#E69F00",
117
- "#CC79A7",
118
- "#56B4E9",
119
- "#D55E00",
120
- ];
102
+ watch(
103
+ selectedStac,
104
+ async (updatedStac, previousStac) => {
105
+ if (updatedStac && previousStac?.id !== updatedStac.id) {
106
+ log.debug("Datepicker selected STAC change triggered");
107
+ const wongPalette = [
108
+ "#009E73",
109
+ "#0072B2",
110
+ "#E69F00",
111
+ "#CC79A7",
112
+ "#56B4E9",
113
+ "#D55E00",
114
+ ];
115
+ // remove old values
116
+ attributes.splice(0, attributes.length);
121
117
 
122
- // remove old values
123
- attributes.length = 0;
124
- for (let idx = 0; idx < eodashCollections.length; idx++) {
125
- const dates = [
126
- ...new Set(
127
- eodashCollections[idx]
128
- .getItems()
129
- ?.map((it) => new Date(/** @type {string} */ (it.datetime))),
130
- ),
131
- ];
132
- attributes.push({
133
- key: "id-" + idx.toString() + Math.random().toString(16).slice(2),
134
- bar: {
135
- style: {
136
- backgroundColor: wongPalette[idx % wongPalette.length],
137
- },
118
+ for (let idx = 0; idx < eodashCollections.length; idx++) {
119
+ log.debug("Retrieving dates", eodashCollections[idx]);
120
+ await eodashCollections[idx].fetchCollection();
121
+ const dates = [
122
+ ...new Set(
123
+ eodashCollections[idx].getItems()?.reduce((valid, it) => {
124
+ const parsed = Date.parse(/** @type {string} */ (it.datetime));
125
+ if (parsed) {
126
+ valid.push(new Date(parsed));
127
+ }
128
+ return valid;
129
+ }, /** @type {Date[]} */ ([])),
130
+ ),
131
+ ];
132
+ attributes.push({
133
+ key: "id-" + idx.toString() + Math.random().toString(16).slice(2),
134
+ bar: {
135
+ style: {
136
+ backgroundColor: wongPalette[idx % wongPalette.length],
137
+ },
138
+ },
139
+ dates,
140
+ content: {
141
+ style: {
142
+ color: "#000000",
143
+ "font-weight": "bold",
138
144
  },
139
- dates,
140
- });
141
- }
142
- // We try to set the current time selection
143
- // to latest extent date
144
- // @ts-expect-error it seems the temporal extent is not defined in type
145
- const interval = updatedStac?.extent?.temporal?.interval;
146
- if (interval && interval.length > 0 && interval[0].length > 1) {
147
- currentDate.value = new Date(interval[0][1]);
148
- }
145
+ },
146
+ });
149
147
  }
150
- },
151
- { immediate: true },
152
- );
153
- });
148
+ }
149
+ },
150
+ { immediate: true },
151
+ );
152
+
153
+ /**
154
+ * @param {boolean} reverse
155
+ */
156
+ function jumpDate(reverse) {
157
+ if (attributes.length) {
158
+ let latestDateMS = reverse ? Infinity : -Infinity;
159
+ attributes.forEach((coll) => {
160
+ if (coll?.dates) {
161
+ coll.dates.forEach((d) => {
162
+ // TODO: we need to handle time ranges and other options here
163
+ if (d instanceof Date) {
164
+ const mathFun = reverse ? "min" : "max";
165
+ latestDateMS = Math[mathFun](latestDateMS, d.getTime());
166
+ }
167
+ });
168
+ }
169
+ });
170
+ currentDate.value =
171
+ latestDateMS === -Infinity
172
+ ? Date.now()
173
+ : latestDateMS === Infinity
174
+ ? 0
175
+ : latestDateMS;
176
+ }
177
+ }
154
178
  </script>
@@ -1,10 +1,12 @@
1
1
  <template>
2
- <span class="d-flex flex-column fill-height overflow-auto pa-4">
2
+ <span class="d-flex flex-column fill-height overflow-auto">
3
3
  <eox-layercontrol
4
4
  v-if="mapElement"
5
5
  :for="mapElement"
6
+ .tools="['datetime', 'info', 'config', 'opacity']"
6
7
  @datetime:updated="debouncedHandleDateTime"
7
8
  class="fill-height"
9
+ disableTabs="true"
8
10
  ref="eoxLayercontrol"
9
11
  />
10
12
  </span>
@@ -1,39 +1,33 @@
1
1
  <template>
2
2
  <eox-map-compare
3
3
  class="fill-height fill-width overflow-none"
4
- :enabled="showCompare"
4
+ .enabled="showCompare"
5
5
  >
6
6
  <eox-map
7
7
  class="fill-height fill-width overflow-none"
8
8
  slot="first"
9
9
  ref="eoxMap"
10
- :sync="compareMap"
10
+ .config="eoxMapConfig"
11
11
  id="main"
12
- :config="eoxMapConfig"
12
+ .layers="eoxMapLayers"
13
13
  />
14
14
  <eox-map
15
15
  class="fill-height fill-width overflow-none"
16
16
  id="compare"
17
17
  slot="second"
18
18
  ref="compareMap"
19
- :config="eoxCompareMapConfig"
19
+ .config="eoxCompareMapConfig"
20
+ .layers="eoxMapCompareLayers"
20
21
  />
21
22
  </eox-map-compare>
22
23
  </template>
23
24
  <script setup>
24
- import { computed, onMounted, reactive, ref } from "vue";
25
- import {
26
- currentUrl,
27
- currentCompareUrl,
28
- datetime,
29
- mapEl,
30
- mapPosition,
31
- mapCompareEl,
32
- } from "@/store/States";
33
- import { storeToRefs } from "pinia";
34
- import { useSTAcStore } from "@/store/stac";
35
25
  import "@eox/map";
36
26
  import "@eox/map/dist/eox-map-advanced-layers-and-sources.js";
27
+ import { computed, onMounted, ref } from "vue";
28
+ import { datetime, mapEl, mapPosition, mapCompareEl } from "@/store/States";
29
+ import { storeToRefs } from "pinia";
30
+ import { useSTAcStore } from "@/store/stac";
37
31
  import { eodashCollections, eodashCompareCollections } from "@/utils/states";
38
32
  import { useHandleMapMoveEnd, useInitMap } from "@/composables/EodashMap";
39
33
 
@@ -44,38 +38,48 @@ const props = defineProps({
44
38
  },
45
39
  });
46
40
 
41
+ /** @type {import("vue").Ref<Record<string,any>[]>} */
42
+ const eoxMapLayers = ref([
43
+ {
44
+ type: "Tile",
45
+ source: { type: "OSM" },
46
+ properties: {
47
+ id: "osm",
48
+ title: "Background",
49
+ },
50
+ },
51
+ ]);
52
+
53
+ /** @type {import("vue").Ref<Record<string,any>[]>} */
54
+ const eoxMapCompareLayers = ref([
55
+ {
56
+ type: "Tile",
57
+ source: { type: "OSM" },
58
+ properties: {
59
+ id: "osm",
60
+ title: "Background",
61
+ },
62
+ },
63
+ ]);
64
+
47
65
  /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
48
66
  const eoxMap = ref(null);
49
67
  /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
50
68
  const compareMap = ref(null);
51
69
 
52
- const eoxMapConfig = reactive({
70
+ const eoxMapConfig = {
53
71
  /** @type {(number|undefined)[] | undefined} */
54
72
  center: [15, 48],
55
73
  /** @type {number | undefined} */
56
74
  zoom: 4,
57
- // TODO: we should probably introduce some way of defining
58
- layers: [
59
- {
60
- type: "Tile",
61
- properties: {
62
- id: "osm",
63
- title: "Background",
64
- },
65
- source: {
66
- type: "OSM",
67
- },
68
- },
69
- ],
70
- });
75
+ };
71
76
 
72
- const eoxCompareMapConfig = reactive({
77
+ const eoxCompareMapConfig = {
73
78
  /** @type {(number|undefined)[] | undefined} */
74
79
  center: [15, 48],
75
80
  /** @type {number | undefined} */
76
81
  zoom: 4,
77
- layers: [],
78
- });
82
+ };
79
83
 
80
84
  // Check if selected indicator was already set in store
81
85
  if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
@@ -84,38 +88,42 @@ if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
84
88
  eoxMapConfig.center = [mapPosition.value?.[0], mapPosition.value[1]];
85
89
  eoxMapConfig.zoom = mapPosition.value[2];
86
90
  }
91
+ const { selectedCompareStac } = storeToRefs(useSTAcStore());
87
92
  const showCompare = computed(() =>
88
93
  props.enableCompare && !!selectedCompareStac.value ? "" : "first",
89
94
  );
90
95
 
91
96
  useHandleMapMoveEnd(eoxMap, mapPosition);
92
97
 
93
- const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
94
-
95
- if (props.enableCompare) {
96
- useInitMap(
97
- compareMap,
98
- //@ts-expect-error todo selectedStac as collection
99
- selectedCompareStac,
100
- eodashCompareCollections,
101
- currentCompareUrl,
102
- datetime,
103
- );
104
- }
105
- useInitMap(
106
- eoxMap,
107
- //@ts-expect-error todo selectedStac as collection
108
- selectedStac,
109
- eodashCollections,
110
- currentUrl,
111
- datetime,
112
- );
113
-
114
98
  onMounted(() => {
99
+ const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
115
100
  // assign map Element state to eox map
116
101
  mapEl.value = eoxMap.value;
102
+
117
103
  if (props.enableCompare) {
118
104
  mapCompareEl.value = compareMap.value;
119
105
  }
106
+
107
+ if (props.enableCompare) {
108
+ useInitMap(
109
+ compareMap,
110
+ //@ts-expect-error todo selectedStac as collection
111
+ selectedCompareStac,
112
+ eodashCompareCollections,
113
+ datetime,
114
+ eoxMapCompareLayers,
115
+ eoxMap,
116
+ );
117
+ }
118
+
119
+ useInitMap(
120
+ eoxMap,
121
+ //@ts-expect-error todo selectedStac as collection
122
+ selectedStac,
123
+ eodashCollections,
124
+ datetime,
125
+ eoxMapLayers,
126
+ compareMap,
127
+ );
120
128
  });
121
129
  </script>
@@ -7,8 +7,8 @@
7
7
 
8
8
  <v-card-text class="py-5 overflow-auto" style="height: 400px">
9
9
  <p class="text-body-2">
10
- Copy and paste this code into the map layers field of the storytelling
11
- editor:
10
+ Copy and paste this code into the map <b>layers field</b> of the
11
+ storytelling editor:
12
12
  </p>
13
13
  <div class="pa-3 code-block">
14
14
  {{ removeUnneededProperties(getLayers()) }}
@@ -110,5 +110,7 @@ const mapEntryCode = computed(() => {
110
110
  background-color: #ddd;
111
111
  font-family: monospace;
112
112
  font-size: small;
113
+ max-height: 200px;
114
+ overflow-y: auto;
113
115
  }
114
116
  </style>