@eodash/eodash 5.0.0-alpha.2.9 → 5.0.0-rc

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 (113) hide show
  1. package/README.md +1 -1
  2. package/core/client/App.vue +13 -1
  3. package/core/client/asWebComponent.js +13 -4
  4. package/core/client/components/DashboardLayout.vue +36 -14
  5. package/core/client/components/Loading.vue +6 -9
  6. package/core/client/components/MobileLayout.vue +16 -14
  7. package/core/client/composables/DefineEodash.js +14 -4
  8. package/core/client/composables/DefineTemplate.js +67 -0
  9. package/core/client/composables/DefineWidgets.js +3 -2
  10. package/core/client/composables/EodashMap.js +360 -0
  11. package/core/client/composables/EodashProcess.js +574 -0
  12. package/core/client/composables/index.js +136 -28
  13. package/core/client/eodash.js +395 -80
  14. package/core/client/eodashSTAC/EodashCollection.js +432 -0
  15. package/core/client/eodashSTAC/createLayers.js +315 -0
  16. package/core/client/eodashSTAC/helpers.js +375 -0
  17. package/core/client/eodashSTAC/triggers.js +43 -0
  18. package/core/client/plugins/axios.js +8 -0
  19. package/core/client/plugins/index.js +2 -1
  20. package/core/client/plugins/vuetify.js +2 -1
  21. package/core/client/store/actions.js +79 -0
  22. package/core/client/store/index.js +4 -18
  23. package/core/client/store/stac.js +99 -9
  24. package/core/client/store/states.js +37 -0
  25. package/core/client/{types.d.ts → types.ts} +66 -20
  26. package/core/client/utils/keys.js +2 -0
  27. package/core/client/utils/states.js +22 -0
  28. package/core/client/views/Dashboard.vue +22 -49
  29. package/core/client/vite-env.d.ts +2 -10
  30. package/dist/client/DashboardLayout-232tRmjz.js +84 -0
  31. package/dist/client/DynamicWebComponent-Cl4LqHU6.js +88 -0
  32. package/dist/client/EodashDatePicker-Pok6bZwU.js +306 -0
  33. package/dist/client/EodashItemFilter-16eMMjTV.js +151 -0
  34. package/dist/client/EodashLayerControl-De7IlCm_.js +120 -0
  35. package/dist/client/EodashLayoutSwitcher-C-3-jjn5.js +52 -0
  36. package/dist/client/EodashMap-CMvbfI6-.js +549 -0
  37. package/dist/client/EodashMapBtns-BeknGDtc.js +107 -0
  38. package/dist/client/EodashProcess-BwKAa9Ee.js +1476 -0
  39. package/dist/client/EodashStacInfo-_BfonNUG.js +85 -0
  40. package/dist/client/EodashTools-PD3XPYuR.js +103 -0
  41. package/dist/client/ExportState-DOrT7M15.js +644 -0
  42. package/dist/client/Footer-CCigxYBo.js +141 -0
  43. package/dist/client/Header-C2cdx4gb.js +437 -0
  44. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  45. package/dist/client/MobileLayout-BdiFjHg7.js +1207 -0
  46. package/dist/client/PopUp--_xn1Cms.js +410 -0
  47. package/dist/client/VImg-9xu2l99m.js +384 -0
  48. package/dist/client/VMain-BUs3kDTd.js +43 -0
  49. package/dist/client/VOverlay-D89omJis.js +1453 -0
  50. package/dist/client/VTooltip-CDu3bErh.js +86 -0
  51. package/dist/client/WidgetsContainer-aFG9yFT6.js +83 -0
  52. package/dist/client/asWebComponent-BRGyP_j5.js +11943 -0
  53. package/dist/client/{style.css → eo-dash.css} +2 -2
  54. package/dist/client/eo-dash.js +2 -6
  55. package/dist/client/forwardRefs-CYrR6bMw.js +245 -0
  56. package/dist/client/index-BZwk0V42.js +199 -0
  57. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  58. package/dist/client/transition-DG9nRSW4.js +37 -0
  59. package/dist/node/cli.js +4 -4
  60. package/dist/node/types.d.ts +2 -0
  61. package/package.json +73 -38
  62. package/widgets/EodashDatePicker.vue +176 -134
  63. package/widgets/EodashItemFilter.vue +79 -38
  64. package/widgets/EodashLayerControl.vue +111 -0
  65. package/widgets/EodashLayoutSwitcher.vue +36 -0
  66. package/widgets/EodashMap.vue +108 -133
  67. package/widgets/EodashMapBtns.vue +62 -8
  68. package/widgets/EodashProcess.vue +143 -0
  69. package/widgets/EodashStacInfo.vue +82 -0
  70. package/widgets/EodashTools.vue +83 -0
  71. package/widgets/ExportState.vue +17 -13
  72. package/widgets/PopUp.vue +24 -2
  73. package/core/client/SuspensedDashboard.ce.vue +0 -105
  74. package/core/client/asWebComponent.d.ts +0 -23
  75. package/core/client/store/Actions.js +0 -14
  76. package/core/client/store/States.js +0 -16
  77. package/core/client/utils/eodashSTAC.js +0 -249
  78. package/core/client/utils/helpers.js +0 -38
  79. package/dist/client/DashboardLayout-D0ZF6V2S.js +0 -156
  80. package/dist/client/DynamicWebComponent-CPsMSBHi.js +0 -57
  81. package/dist/client/EodashDatePicker-CBQP7u2X.js +0 -252
  82. package/dist/client/EodashItemFilter-DL2ScI-5.js +0 -7671
  83. package/dist/client/EodashMap-CkKoQlmR.js +0 -86917
  84. package/dist/client/EodashMapBtns-yuO2QmiR.js +0 -36
  85. package/dist/client/ExportState-CCzOhppU.js +0 -558
  86. package/dist/client/Footer-BPAND0yG.js +0 -115
  87. package/dist/client/Header-DLhebNvG.js +0 -350
  88. package/dist/client/IframeWrapper-1GEMHlsW.js +0 -19
  89. package/dist/client/MobileLayout-mGkOYRhu.js +0 -945
  90. package/dist/client/PopUp-1d2bBFjw.js +0 -300
  91. package/dist/client/VImg-DxHcztfM.js +0 -291
  92. package/dist/client/VMain-BLX5vRRn.js +0 -39
  93. package/dist/client/VOverlay-CvrYEmLu.js +0 -967
  94. package/dist/client/WidgetsContainer-CmYjvGm7.js +0 -129
  95. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  96. package/dist/client/asWebComponent-B91uK0U7.js +0 -20361
  97. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  98. package/dist/client/decoder-CP4lv0Kb-B6yqkcfC.js +0 -10
  99. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  100. package/dist/client/eodashSTAC-DBjqe_Ho.js +0 -2788
  101. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  102. package/dist/client/forwardRefs-BJJiadQP.js +0 -185
  103. package/dist/client/index-Q-bHLjxx.js +0 -153
  104. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  105. package/dist/client/lerc-DzVumYtB-P-KXC0TO.js +0 -1027
  106. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  107. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  108. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  109. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  110. package/dist/client/ssrBoot-yo11mybw.js +0 -17
  111. package/dist/client/transition-CSJhuYGK.js +0 -34
  112. package/dist/client/webfontloader-qotgY98I.js +0 -435
  113. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
@@ -0,0 +1,43 @@
1
+ /*
2
+ * eodashSTAC helpers that utilizes the app states or actions
3
+ */
4
+ import { changeMapProjection, registerProjection } from "@/store/actions";
5
+ import log from "loglevel";
6
+ import { getProjectionCode } from "./helpers";
7
+ import { availableMapProjection } from "@/store/states";
8
+
9
+ /**
10
+ * checks if there's a projection on the Collection and
11
+ * updates {@link availableMapProjection}
12
+ * @param {import('stac-ts').StacCollection} [STAcCollection]
13
+ */
14
+ export const setMapProjFromCol = async (STAcCollection) => {
15
+ // if a projection exists on the collection level
16
+ log.debug("Checking for available map projection in indicator");
17
+ const projection =
18
+ /** @type {number | string | {name: string, def: string} | undefined} */
19
+ (
20
+ STAcCollection?.["eodash:mapProjection"] ||
21
+ STAcCollection?.["proj:epsg"] ||
22
+ STAcCollection?.["eodash:proj4_def"]
23
+ );
24
+ if (projection) {
25
+ log.debug("Projection found", projection);
26
+ await registerProjection(projection);
27
+ const projectionCode = getProjectionCode(projection);
28
+ if (availableMapProjection.value !== projectionCode) {
29
+ log.debug(
30
+ "Changing map projection",
31
+ availableMapProjection.value,
32
+ projectionCode,
33
+ );
34
+ await changeMapProjection(projection);
35
+ }
36
+ // set it for `EodashMapBtns`
37
+ availableMapProjection.value = /** @type {string} */ (projectionCode);
38
+ } else {
39
+ // reset to default projection
40
+ log.debug("Resetting projection to default EPSG:3857");
41
+ await changeMapProjection((availableMapProjection.value = ""));
42
+ }
43
+ };
@@ -0,0 +1,8 @@
1
+ import Axios from "axios";
2
+ import { setupCache } from "axios-cache-interceptor";
3
+
4
+ const instance = Axios.create();
5
+
6
+ export const axios = setupCache(instance, { cacheTakeover: false });
7
+
8
+ export default axios;
@@ -4,13 +4,14 @@ import eodash from "@/eodash";
4
4
  import VCalendar from "v-calendar";
5
5
  import { eodashKey } from "@/utils/keys";
6
6
  import store from "../store";
7
+ import log from "loglevel";
7
8
 
8
9
  export const pinia = createPinia();
9
10
 
10
11
  /** @param {import("vue").App} app */
11
12
  export function registerPlugins(app) {
12
13
  window.eodashStore = store;
13
-
14
+ window.setEodashLoglevel = log.setLevel;
14
15
  app
15
16
  .use(vuetify)
16
17
  .use(pinia)
@@ -8,7 +8,7 @@
8
8
  import "vuetify/styles";
9
9
 
10
10
  import { createVuetify } from "vuetify";
11
- import { mdiChevronLeft, mdiChevronRight, mdiMenuDown } from "@mdi/js";
11
+ import { mdiChevronLeft, mdiChevronRight, mdiMenuDown, mdiPlus } from "@mdi/js";
12
12
 
13
13
  const vuetify = createVuetify({
14
14
  icons: {
@@ -17,6 +17,7 @@ const vuetify = createVuetify({
17
17
  next: [mdiChevronRight],
18
18
  prev: [mdiChevronLeft],
19
19
  subgroup: [mdiMenuDown],
20
+ plus: [mdiPlus],
20
21
  },
21
22
  },
22
23
  theme: {
@@ -0,0 +1,79 @@
1
+ import {
2
+ mapEl,
3
+ mapCompareEl,
4
+ registeredProjections,
5
+ activeTemplate,
6
+ } from "@/store/states";
7
+ import { getProjectionCode } from "@/eodashSTAC/helpers";
8
+ import log from "loglevel";
9
+
10
+ /**
11
+ * Returns the current layers of {@link mapEl}
12
+ * @returns {Record<string,any>[]}
13
+ */
14
+ export const getLayers = () => mapEl.value?.layers.toReversed();
15
+
16
+ /**
17
+ * Returns the current layers of {@link mapCompareEl}
18
+ * @returns {Record<string,any>[]}
19
+ */
20
+ export const getCompareLayers = () => mapCompareEl.value?.layers.toReversed();
21
+
22
+ /**
23
+ * Register EPSG projection in `eox-map`
24
+ * @param {string|number|{name: string, def: string, extent?:number[]}} [projection]*/
25
+ export const registerProjection = async (projection) => {
26
+ let code = getProjectionCode(projection);
27
+ if (!code || registeredProjections.includes(code)) {
28
+ return;
29
+ }
30
+ log.debug("Unregistered projection found, registering it", code);
31
+ registeredProjections.push(code);
32
+ if (typeof projection === "object") {
33
+ // registering whole projection definition
34
+ await mapEl.value?.registerProjection(
35
+ code,
36
+ projection.def,
37
+ projection.extent,
38
+ );
39
+ // also registering for comparison map
40
+ await mapCompareEl.value?.registerProjection(
41
+ code,
42
+ projection.def,
43
+ projection.extent,
44
+ );
45
+ } else {
46
+ await mapEl.value?.registerProjectionFromCode(code);
47
+ // also registering for comparison map
48
+ await mapCompareEl.value?.registerProjectionFromCode(code);
49
+ }
50
+ };
51
+ /**
52
+ * Change `eox-map` projection from an `EPSG` projection
53
+ * @param {string|number|{name: string, def: string}} [projection]*/
54
+ export const changeMapProjection = async (projection) => {
55
+ let code = getProjectionCode(projection);
56
+
57
+ if (!code) {
58
+ mapEl.value?.setAttribute("projection", "EPSG:3857");
59
+ mapCompareEl.value?.setAttribute("projection", "EPSG:3857");
60
+ return;
61
+ }
62
+
63
+ if (!registeredProjections.includes(code)) {
64
+ await registerProjection(projection);
65
+ }
66
+
67
+ code = mapEl.value?.getAttribute("projection") === code ? "EPSG:3857" : code;
68
+ mapEl.value?.setAttribute("projection", code);
69
+ mapCompareEl.value?.setAttribute("projection", code);
70
+ };
71
+
72
+ /**
73
+ *
74
+ * @param {string} template
75
+ */
76
+ export const setActiveTemplate = (template) => {
77
+ activeTemplate.value = template;
78
+ log.debug("Setting active template to", template);
79
+ };
@@ -1,20 +1,6 @@
1
1
  //export all actions, states, and pinia stores
2
+ import { useSTAcStore } from "./stac";
3
+ import * as actions from "./actions";
4
+ import * as states from "./states";
2
5
 
3
- const storesImport = import.meta.glob("../store/**.js", { eager: true });
4
-
5
- const store = /** @type {import("@/types").EodashStore} */ (
6
- (() => {
7
- const stores = {};
8
- for (const [filePath, importedstore] of Object.entries(storesImport)) {
9
- const storeType =
10
- filePath.split("/").at(-1)?.slice(0, -3).toLowerCase() ?? "";
11
- if (!["keys"].includes(storeType)) {
12
- //@ts-expect-error `importedstore` cant be typed individually
13
- stores[storeType] = importedstore;
14
- }
15
- }
16
- return stores;
17
- })()
18
- );
19
-
20
- export default store;
6
+ export default { stac: { useSTAcStore }, actions, states };
@@ -1,9 +1,13 @@
1
1
  import { defineStore } from "pinia";
2
2
  import { inject, ref } from "vue";
3
- import axios from "axios";
4
- import { useAbsoluteUrl } from "@/composables/index";
3
+ import axios from "@/plugins/axios";
4
+ import { useAbsoluteUrl, useCompareAbsoluteUrl } from "@/composables/index";
5
5
  import { eodashKey } from "@/utils/keys";
6
- import { indicator } from "@/store/States";
6
+ import { indicator } from "@/store/states";
7
+ import { extractCollectionUrls } from "@/eodashSTAC/helpers";
8
+ import { eodashCollections, eodashCompareCollections } from "@/utils/states";
9
+ import { EodashCollection } from "@/eodashSTAC/EodashCollection";
10
+ import log from "loglevel";
7
11
 
8
12
  export const useSTAcStore = defineStore("stac", () => {
9
13
  /**
@@ -25,18 +29,30 @@ export const useSTAcStore = defineStore("stac", () => {
25
29
  */
26
30
  const selectedStac = ref(null);
27
31
 
32
+ /**
33
+ * Selected STAC object.
34
+ *
35
+ * @type {import("vue").Ref<
36
+ * | import("stac-ts").StacCatalog
37
+ * | import("stac-ts").StacCollection
38
+ * | import("stac-ts").StacItem
39
+ * | null
40
+ * >}
41
+ */
42
+ const selectedCompareStac = ref(null);
43
+
28
44
  const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
29
45
 
30
46
  /**
31
47
  * Fetches root stac catalog and assign it to `stac`
32
48
  *
33
- * @async
34
49
  * @param {import("@/types").StacEndpoint} [url=eodash.stacEndpoint] Default
35
50
  * is `eodash.stacEndpoint`
36
51
  * @returns {Promise<void>}
37
52
  * @see {@link stac}
38
53
  */
39
54
  async function loadSTAC(url = eodash.stacEndpoint) {
55
+ log.debug("Loading STAC endpoint", url);
40
56
  await axios
41
57
  .get(url)
42
58
  .then((resp) => {
@@ -48,6 +64,7 @@ export const useSTAcStore = defineStore("stac", () => {
48
64
  }
49
65
  return link;
50
66
  });
67
+ log.debug("Setting selected STAC", links);
51
68
  stac.value = links;
52
69
  })
53
70
  .catch((err) => {
@@ -58,7 +75,6 @@ export const useSTAcStore = defineStore("stac", () => {
58
75
  /**
59
76
  * Fetches selected stac object and assign it to `selectedStac`
60
77
  *
61
- * @async
62
78
  * @param {string} relativePath - Stac link href
63
79
  * @returns {Promise<void>}
64
80
  * @see {@link selectedStac}
@@ -68,14 +84,88 @@ export const useSTAcStore = defineStore("stac", () => {
68
84
 
69
85
  await axios
70
86
  .get(absoluteUrl.value)
71
- .then((resp) => {
72
- selectedStac.value = resp.data;
73
- indicator.value = selectedStac.value?.id ?? "";
87
+ .then(async (resp) => {
88
+ // init eodash collections
89
+ const collectionUrls = extractCollectionUrls(
90
+ resp.data,
91
+ absoluteUrl.value,
92
+ );
93
+
94
+ await Promise.all(
95
+ collectionUrls.map((cu) => {
96
+ const ec = new EodashCollection(cu);
97
+ ec.fetchCollection();
98
+ return ec;
99
+ }),
100
+ ).then((collections) => {
101
+ // empty array from old collections
102
+ eodashCollections.splice(0, eodashCollections.length);
103
+ // update eodashCollections
104
+ eodashCollections.push(...collections);
105
+
106
+ selectedStac.value = resp.data;
107
+ indicator.value = selectedStac.value?.id ?? "";
108
+ });
74
109
  })
75
110
  .catch((err) => {
76
111
  throw new Error("error loading the selected STAC", err);
77
112
  });
78
113
  }
79
114
 
80
- return { stac, loadSTAC, loadSelectedSTAC, selectedStac };
115
+ /**
116
+ * Fetches selected stac object and assign it to `selectedCompareStac`
117
+ *
118
+ * @param {string} relativePath - Stac link href
119
+ * @returns {Promise<void>}
120
+ * @see {@link selectedCompareStac}
121
+ */
122
+ async function loadSelectedCompareSTAC(relativePath = "") {
123
+ const absoluteUrl = useCompareAbsoluteUrl(relativePath);
124
+
125
+ await axios
126
+ .get(absoluteUrl.value)
127
+ .then(async (resp) => {
128
+ // init eodash collections
129
+ const collectionUrls = await extractCollectionUrls(
130
+ resp.data,
131
+ absoluteUrl.value,
132
+ );
133
+
134
+ await Promise.all(
135
+ collectionUrls.map((cu) => {
136
+ const ec = new EodashCollection(cu);
137
+ ec.fetchCollection();
138
+ return ec;
139
+ }),
140
+ ).then((collections) => {
141
+ // empty array from old collections
142
+ eodashCompareCollections.splice(0, eodashCompareCollections.length);
143
+ // update eodashCompareCollections
144
+ eodashCompareCollections.push(...collections);
145
+
146
+ selectedCompareStac.value = resp.data;
147
+ });
148
+ })
149
+ .catch((err) => {
150
+ throw new Error("error loading the selected comparison STAC", err);
151
+ });
152
+ }
153
+
154
+ /**
155
+ * Reset selected compare stac object
156
+ *
157
+ */
158
+ async function resetSelectedCompareSTAC() {
159
+ selectedCompareStac.value = null;
160
+ }
161
+
162
+ return {
163
+ stac,
164
+ loadSTAC,
165
+ loadSelectedSTAC,
166
+ loadSelectedCompareSTAC,
167
+ resetSelectedCompareSTAC,
168
+ selectedStac,
169
+ selectedCompareStac,
170
+ };
81
171
  });
@@ -0,0 +1,37 @@
1
+ /** setting default log level globally to warning */
2
+ import log from "loglevel";
3
+ log.setLevel(log.levels.WARN, true);
4
+
5
+ import { ref } from "vue";
6
+
7
+ /** Currently selected STAC endpoint */
8
+ export const currentUrl = ref("");
9
+
10
+ /** Currently selected compare STAC endpoint */
11
+ export const currentCompareUrl = ref("");
12
+
13
+ /** Currently selected datetime */
14
+ export const datetime = ref(new Date().toISOString());
15
+
16
+ /** Currently selected indicator */
17
+ export const indicator = ref("");
18
+
19
+ /**
20
+ * Current map position
21
+ *
22
+ * @type {import("vue").Ref<(number | undefined)[]>}
23
+ */
24
+ export const mapPosition = ref([]);
25
+
26
+ export const registeredProjections = ["EPSG:4326", "EPSG:3857"];
27
+
28
+ /** available projection to be rendered by `EodashMap` */
29
+ export const availableMapProjection = ref("EPSG:3857");
30
+
31
+ /** @type {import("vue").Ref<HTMLElement & Record<string,any> | null>} */
32
+ export const mapEl = ref(null);
33
+
34
+ /** @type {import("vue").Ref<HTMLElement & Record<string,any> | null>} */
35
+ export const mapCompareEl = ref(null);
36
+
37
+ export const activeTemplate = ref("");
@@ -32,7 +32,7 @@ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
32
32
  */
33
33
  onMounted?: (
34
34
  el: Element | null,
35
- store: ReturnType<typeof import("./store/stac").useSTAcStore>,
35
+ store: ReturnType<typeof import("./store/stac.js").useSTAcStore>,
36
36
  ) => Promise<void> | void;
37
37
  /**
38
38
  * Triggered when the web component is unmounted from the DOM.
@@ -43,7 +43,7 @@ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
43
43
  */
44
44
  onUnmounted?: (
45
45
  el: Element | null,
46
- store: ReturnType<typeof import("./store/stac").useSTAcStore>,
46
+ store: ReturnType<typeof import("./store/stac.js").useSTAcStore>,
47
47
  ) => Promise<void> | void;
48
48
  }
49
49
 
@@ -170,7 +170,7 @@ export type BackgroundWidget<T extends ExecutionTime = "compiletime"> =
170
170
  *
171
171
  * @group Eodash
172
172
  */
173
- export interface Template<T extends ExecutionTime = "compiletime"> {
173
+ export interface SingleTemplate<T extends ExecutionTime = "compiletime"> {
174
174
  /** Gap between widgets */
175
175
  gap?: number;
176
176
  /** Loading widget */
@@ -184,8 +184,13 @@ export interface Template<T extends ExecutionTime = "compiletime"> {
184
184
  widgets: Widget<T>[];
185
185
  }
186
186
 
187
+ export type MultiTemplates<T extends ExecutionTime = "compiletime"> = Record<
188
+ string,
189
+ SingleTemplate<T>
190
+ >;
191
+
187
192
  /** @ignore */
188
- export type StacEndpoint = `${"https://" | "http://"}${string}/catalog.json`;
193
+ export type StacEndpoint = `${string}/catalog.json`;
189
194
 
190
195
  /** @group Eodash */
191
196
  type ExecutionTime = "runtime" | "compiletime";
@@ -195,7 +200,7 @@ type ExecutionTime = "runtime" | "compiletime";
195
200
  *
196
201
  * @group Eodash
197
202
  */
198
- export interface Eodash<T extends ExecutionTime = "compiletime"> {
203
+ export type Eodash<T extends ExecutionTime = "compiletime"> = {
199
204
  /** Instance ID. */
200
205
  id?: string;
201
206
  /** Root STAC catalog endpoint */
@@ -228,9 +233,16 @@ export interface Eodash<T extends ExecutionTime = "compiletime"> {
228
233
  /** Text applied to the footer. */
229
234
  footerText?: string;
230
235
  };
231
- /** Template configuration */
232
- template: Template<T>;
233
- }
236
+ } & (
237
+ | {
238
+ /** Template configuration */
239
+ template: SingleTemplate<T>;
240
+ }
241
+ | {
242
+ /** Multiple templates configuration */
243
+ templates: MultiTemplates<T>;
244
+ }
245
+ );
234
246
  /////////
235
247
 
236
248
  /// eodash store types
@@ -244,29 +256,63 @@ export interface EodashStore {
244
256
  datetime: import("vue").Ref<string>;
245
257
  /** Currently selected indicator */
246
258
  indicator: import("vue").Ref<string>;
259
+
260
+ registeredProjections: `EPSG${number}`[];
261
+
262
+ /** available projection to be rendered by the Map */
263
+ availableMapProjection: import("vue").Ref<string>;
247
264
  };
248
265
  actions: {
249
- /** returns the layers of the `eox-map`
250
- * @param `eox-map` element selector
266
+ /**
267
+ * returns the layers of the `eox-map`
268
+ * @param [el] - `eox-map` element selector
251
269
  */
252
- getLayers: (el: string) => object[];
270
+ getLayers: (el?: string) => object[];
271
+
272
+ /**
273
+ * Register EPSG projection in `eox-map` and adds it to `availableMapProjection`
274
+ * */
275
+ registerProjection: (
276
+ code?: number | string | { name: string; def: string },
277
+ ) => Promise<void>;
278
+
279
+ /** Change `eox-map` projection from an EPSG code or a registered projection code */
280
+ changeMapProjection: (
281
+ code?: number | string | { name: string; def: string },
282
+ ) => Promise<void>;
253
283
  };
284
+
254
285
  /** Pinia store definition used to navigate the root STAC catalog. */
255
286
  stac: {
256
287
  useSTAcStore: typeof import("./store/stac.js").useSTAcStore;
257
288
  };
258
289
  }
259
290
  ///////
291
+
292
+ /** @group WebComponent */
293
+ type EodashConstructor = import("vue").VueElementConstructor<
294
+ import("vue").ExtractPropTypes<{ config: string }>
295
+ >;
260
296
  /**
261
- * The project's entry point should export this function as a default to
262
- * instantiate eodash
297
+ * Eodash Web Component constructor
263
298
  *
264
- * @param config
265
- * @group Eodash
299
+ * @group WebComponent
266
300
  */
267
- export declare const createEodash: (
268
- config: ((store: EodashStore) => Eodash | Promise<Eodash>) | Eodash,
269
- ) => Eodash | Promise<Eodash>;
301
+ export declare const Eodash: EodashConstructor;
302
+ /**
303
+ * Registers `eo-dash` as Custom Element in the window
304
+ *
305
+ * @group WebComponent
306
+ */
307
+ export declare function register(): void;
270
308
 
271
- /** @group EodashStore */
272
- export declare const store: EodashStore;
309
+ /**
310
+ * Eodash store @see EodashStore
311
+ *
312
+ * @group WebComponent
313
+ */
314
+ export declare const store: typeof import("@/store").default;
315
+
316
+ /////
317
+
318
+ export * from "./main.js";
@@ -4,3 +4,5 @@
4
4
  * @see {@link "@/plugins/index.js"}
5
5
  */
6
6
  export const eodashKey = Symbol("eodash");
7
+ /** @type {import("@vueuse/core").EventBusKey<"layers:updated"|"time:updated">} */
8
+ export const eoxLayersKey = Symbol("eoxMapLayers");
@@ -0,0 +1,22 @@
1
+ import { ref, shallowReactive } from "vue";
2
+
3
+ /**
4
+ * Array of eodash STAC Collections extracted from the current selected indicator.
5
+ * Updated in {@link file://./../store/stac.js `loadSelectedSTAC`} widget
6
+ *
7
+ * @type {import('../eodashSTAC/EodashCollection').EodashCollection[]}
8
+ * @private
9
+ */
10
+ export const eodashCollections = shallowReactive([]);
11
+
12
+ /**
13
+ * Array of eodash STAC Collections extracted from the current selected COMPARE indicator.
14
+ * Updated in {@link file://./../store/stac.js ` loadSelectedCompareSTAC`} widget
15
+ *
16
+ * @type {import('../eodashSTAC/EodashCollection').EodashCollection[]}
17
+ * @private
18
+ */
19
+ export const eodashCompareCollections = shallowReactive([]);
20
+
21
+ /** whether the map postion was set in URL params on first load */
22
+ export const posIsSetFromUrl = ref(false);
@@ -1,26 +1,23 @@
1
1
  <template>
2
- <HeaderComponent ref="headerRef" v-if="!eodash.brand.noLayout" />
2
+ <HeaderComponent v-if="!eodash.brand.noLayout" />
3
3
  <ErrorAlert v-model="error" />
4
4
  <Suspense>
5
- <TemplateComponent
6
- @vue:mounted="onTemplateMount?.(hiddenElements)"
7
- class="template"
8
- />
5
+ <TemplateComponent :style="{ height: templateHeight }" />
9
6
  <template #fallback>
10
7
  <div class="loading-container">
11
8
  <Loading />
12
9
  </div>
13
10
  </template>
14
11
  </Suspense>
15
- <FooterComponent ref="footerRef" v-if="!eodash.brand.noLayout" />
12
+ <FooterComponent v-if="!eodash.brand.noLayout" />
16
13
  </template>
17
14
 
18
15
  <script setup>
19
16
  import { useEodashRuntime } from "@/composables/DefineEodash";
20
17
  import { useURLSearchParametersSync, useUpdateTheme } from "@/composables";
21
18
  import { useSTAcStore } from "@/store/stac";
22
- import { defineAsyncComponent, onErrorCaptured, onMounted, ref } from "vue";
23
- import { useDisplay, useLayout } from "vuetify/lib/framework.mjs";
19
+ import { computed, defineAsyncComponent, onErrorCaptured, ref } from "vue";
20
+ import { useDisplay } from "vuetify/lib/framework.mjs";
24
21
  import { loadFont } from "@/utils";
25
22
  import Loading from "@/components/Loading.vue";
26
23
  import ErrorAlert from "@/components/ErrorAlert.vue";
@@ -29,8 +26,9 @@ const props = defineProps({
29
26
  config: {
30
27
  type: String,
31
28
  },
32
- onTemplateMount: {
33
- type: Function,
29
+ isWebComponent: {
30
+ type: Boolean,
31
+ default: false,
34
32
  },
35
33
  });
36
34
  const eodash = await useEodashRuntime(props.config);
@@ -43,16 +41,18 @@ theme.global.name.value = "dashboardTheme";
43
41
  await loadFont(
44
42
  eodash.brand?.font?.family,
45
43
  eodash.brand?.font?.link,
46
- !!props.onTemplateMount,
44
+ props.isWebComponent,
47
45
  );
48
46
 
49
47
  const { loadSTAC } = useSTAcStore();
50
48
  await loadSTAC();
51
49
 
52
50
  const { smAndDown } = useDisplay();
53
- const TemplateComponent = smAndDown.value
54
- ? defineAsyncComponent(() => import(`@/components/MobileLayout.vue`))
55
- : defineAsyncComponent(() => import(`@/components/DashboardLayout.vue`));
51
+ const TemplateComponent = computed(() =>
52
+ smAndDown.value
53
+ ? defineAsyncComponent(() => import(`@/components/MobileLayout.vue`))
54
+ : defineAsyncComponent(() => import(`@/components/DashboardLayout.vue`)),
55
+ );
56
56
 
57
57
  const HeaderComponent = defineAsyncComponent(
58
58
  () => import(`@/components/Header.vue`),
@@ -60,34 +60,8 @@ const HeaderComponent = defineAsyncComponent(
60
60
  const FooterComponent = defineAsyncComponent(
61
61
  () => import(`@/components/Footer.vue`),
62
62
  );
63
- const { mainRect } = useLayout();
64
- const templateHeight = eodash.brand.noLayout
65
- ? props.onTemplateMount
66
- ? "100%"
67
- : "90dvh"
68
- : `calc(100dvh - ${mainRect.value["top"] + mainRect.value["bottom"]}px)`;
69
-
70
- const headerRef = ref(null);
71
- /**
72
- * @type {import("vue").Ref<InstanceType<
73
- * typeof import("@/components/Footer.vue").default
74
- * > | null>}
75
- */
76
- const footerRef = ref(null);
77
-
78
- const hiddenElements = [headerRef, footerRef];
79
63
 
80
- onMounted(() => {
81
- if (props.onTemplateMount && !eodash.brand.noLayout) {
82
- hiddenElements.forEach((element) => {
83
- /** @type {HTMLElement} */
84
- (
85
- /** @type {import("vue").ComponentPublicInstance} */
86
- (element.value).$el
87
- ).style.opacity = "0";
88
- });
89
- }
90
- });
64
+ const templateHeight = props.isWebComponent ? "100%" : "100dvh";
91
65
 
92
66
  const error = ref("");
93
67
  onErrorCaptured((e, comp, info) => {
@@ -99,18 +73,17 @@ onErrorCaptured((e, comp, info) => {
99
73
  });
100
74
  </script>
101
75
  <style>
102
- html {
103
- overflow: hidden !important;
104
- }
105
-
106
- .template {
107
- height: v-bind("templateHeight");
108
- }
109
-
110
76
  .loading-container {
111
77
  height: 100dvh;
112
78
  display: flex;
113
79
  align-items: center;
114
80
  justify-content: center;
115
81
  }
82
+
83
+ div.v-application__wrap {
84
+ min-height: fit-content;
85
+ }
86
+ eo-dash {
87
+ overflow: hidden;
88
+ }
116
89
  </style>