@eodash/eodash 5.0.0-alpha.2.8 → 5.0.0-processing

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 (138) hide show
  1. package/README.md +1 -1
  2. package/core/client/App.vue +13 -1
  3. package/core/client/asWebComponent.js +13 -3
  4. package/core/client/components/DashboardLayout.vue +6 -2
  5. package/core/client/composables/DefineEodash.js +1 -1
  6. package/core/client/composables/EodashMap.js +349 -0
  7. package/core/client/composables/EodashProcess.js +575 -0
  8. package/core/client/composables/index.js +107 -24
  9. package/core/client/eodash.js +83 -10
  10. package/core/client/plugins/axios.js +8 -0
  11. package/core/client/plugins/index.js +2 -1
  12. package/core/client/store/Actions.js +63 -12
  13. package/core/client/store/States.js +19 -0
  14. package/core/client/store/stac.js +98 -8
  15. package/core/client/types.d.ts +25 -18
  16. package/core/client/utils/createLayers.js +313 -0
  17. package/core/client/utils/eodashSTAC.js +320 -170
  18. package/core/client/utils/helpers.js +369 -9
  19. package/core/client/utils/keys.js +2 -0
  20. package/core/client/utils/states.js +17 -0
  21. package/core/client/views/Dashboard.vue +17 -46
  22. package/core/client/vite-env.d.ts +1 -9
  23. package/dist/client/DashboardLayout-CVMJ4l8M.js +87 -0
  24. package/dist/client/DynamicWebComponent-Cv8n457T.js +88 -0
  25. package/dist/client/EodashDatePicker-VVkiPmpc.js +394 -0
  26. package/dist/client/EodashItemFilter-CugWNQ86.js +194 -0
  27. package/dist/client/EodashLayerControl-53WghA8G.js +110 -0
  28. package/dist/client/EodashMap-CQnOePpy.js +486 -0
  29. package/dist/client/EodashMapBtns-uaRwFtfB.js +66 -0
  30. package/dist/client/EodashProcess-cF0unIy8.js +1477 -0
  31. package/dist/client/ExportState-BT8MLAW7.js +644 -0
  32. package/dist/client/Footer-C6GUG84G.js +141 -0
  33. package/dist/client/Header-D2dtCWp8.js +437 -0
  34. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  35. package/dist/client/MobileLayout-BAo8Wr8T.js +1210 -0
  36. package/dist/client/PopUp-Bm01q7Ko.js +389 -0
  37. package/dist/client/VImg-B8AbetCE.js +384 -0
  38. package/dist/client/VMain-DnGlQUyr.js +43 -0
  39. package/dist/client/VOverlay-B8Qj7LRG.js +1453 -0
  40. package/dist/client/WidgetsContainer-CwXRRLS1.js +83 -0
  41. package/dist/client/asWebComponent-DUUoR7MZ.js +11621 -0
  42. package/dist/client/eo-dash.js +2 -6
  43. package/dist/client/forwardRefs-CZJhEAKW.js +245 -0
  44. package/dist/client/index-DlIO7sJ3.js +199 -0
  45. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  46. package/dist/client/style.css +2 -2
  47. package/dist/client/transition-BiR8wMn1.js +37 -0
  48. package/dist/node/cli.js +4 -4
  49. package/dist/node/types.d.ts +2 -0
  50. package/dist/types/core/client/App.vue.d.ts +7 -0
  51. package/dist/types/core/client/asWebComponent.d.ts +9 -0
  52. package/dist/types/core/client/components/DashboardLayout.vue.d.ts +2 -0
  53. package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +18 -0
  54. package/dist/types/core/client/components/ErrorAlert.vue.d.ts +2 -0
  55. package/dist/types/core/client/components/Footer.vue.d.ts +2 -0
  56. package/dist/types/core/client/components/Header.vue.d.ts +2 -0
  57. package/dist/types/core/client/components/IframeWrapper.vue.d.ts +7 -0
  58. package/dist/types/core/client/components/Loading.vue.d.ts +2 -0
  59. package/dist/types/core/client/components/MobileLayout.vue.d.ts +2 -0
  60. package/dist/types/core/client/composables/DefineEodash.d.ts +2 -0
  61. package/dist/types/core/client/composables/DefineTemplate.d.ts +15 -0
  62. package/dist/types/core/client/composables/DefineWidgets.d.ts +14 -0
  63. package/dist/types/core/client/composables/EodashMap.d.ts +5 -0
  64. package/dist/types/core/client/composables/index.d.ts +30 -0
  65. package/dist/types/core/client/eodash.d.ts +8 -0
  66. package/dist/types/core/client/main.d.ts +2 -0
  67. package/dist/types/core/client/plugins/axios.d.ts +2 -0
  68. package/dist/types/core/client/plugins/index.d.ts +3 -0
  69. package/dist/types/core/client/plugins/vuetify.d.ts +82 -0
  70. package/dist/types/core/client/render.d.ts +1 -0
  71. package/dist/types/core/client/store/Actions.d.ts +12 -0
  72. package/dist/types/core/client/store/States.d.ts +22 -0
  73. package/dist/types/core/client/store/index.d.ts +2 -0
  74. package/dist/types/core/client/store/stac.d.ts +25 -0
  75. package/dist/types/core/client/types.d.ts +279 -0
  76. package/dist/types/core/client/utils/createLayers.d.ts +45 -0
  77. package/dist/types/core/client/utils/eodashSTAC.d.ts +82 -0
  78. package/dist/types/core/client/utils/helpers.d.ts +84 -0
  79. package/dist/types/core/client/utils/index.d.ts +2 -0
  80. package/dist/types/core/client/utils/keys.d.ts +6 -0
  81. package/dist/types/core/client/utils/states.d.ts +14 -0
  82. package/dist/types/core/client/views/Dashboard.vue.d.ts +9 -0
  83. package/dist/types/widgets/EodashDatePicker.vue.d.ts +7 -0
  84. package/dist/types/widgets/EodashItemFilter.vue.d.ts +42 -0
  85. package/dist/types/widgets/EodashLayerControl.vue.d.ts +11 -0
  86. package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +9 -0
  87. package/dist/types/widgets/EodashMap.vue.d.ts +7 -0
  88. package/dist/types/widgets/EodashMapBtns.vue.d.ts +11 -0
  89. package/dist/types/widgets/EodashStacInfo.vue.d.ts +21 -0
  90. package/dist/types/widgets/EodashTools.vue.d.ts +15 -0
  91. package/dist/types/widgets/ExportState.vue.d.ts +7 -0
  92. package/dist/types/widgets/PopUp.vue.d.ts +22 -0
  93. package/dist/types/widgets/WidgetsContainer.vue.d.ts +7 -0
  94. package/package.json +58 -37
  95. package/widgets/EodashDatePicker.vue +128 -100
  96. package/widgets/EodashItemFilter.vue +149 -47
  97. package/widgets/EodashLayerControl.vue +98 -0
  98. package/widgets/EodashMap.vue +98 -122
  99. package/widgets/EodashMapBtns.vue +24 -7
  100. package/widgets/EodashProcess.vue +151 -0
  101. package/widgets/ExportState.vue +15 -11
  102. package/core/client/SuspensedDashboard.ce.vue +0 -105
  103. package/dist/client/DashboardLayout-CKOExc7r.js +0 -156
  104. package/dist/client/DynamicWebComponent-m1Zbbw6n.js +0 -57
  105. package/dist/client/EodashDatePicker-CGdJRGZJ.js +0 -252
  106. package/dist/client/EodashItemFilter-BjM_LHaE.js +0 -63
  107. package/dist/client/EodashMap-61UMC8sv.js +0 -86917
  108. package/dist/client/EodashMapBtns-DVITfAFx.js +0 -36
  109. package/dist/client/ExportState-DhpK09GR.js +0 -558
  110. package/dist/client/Footer-CIwjaddz.js +0 -115
  111. package/dist/client/Header-BcM-pZFi.js +0 -350
  112. package/dist/client/IframeWrapper-CAe6HPqe.js +0 -19
  113. package/dist/client/MobileLayout-DcZOQX8r.js +0 -945
  114. package/dist/client/PopUp-DCaITceG.js +0 -300
  115. package/dist/client/VImg-C-I_7puM.js +0 -291
  116. package/dist/client/VMain-Cd3P0YTG.js +0 -39
  117. package/dist/client/VOverlay-AcvFgk39.js +0 -967
  118. package/dist/client/WidgetsContainer-B0-q0EMO.js +0 -129
  119. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  120. package/dist/client/asWebComponent-zuKR9I1w.js +0 -20361
  121. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  122. package/dist/client/decoder-CP4lv0Kb-DdKalImK.js +0 -10
  123. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  124. package/dist/client/eodashSTAC-DGB50vNk.js +0 -2788
  125. package/dist/client/eox-itemfilter-TaBxgqq_.js +0 -7565
  126. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  127. package/dist/client/forwardRefs-BnxE4iKQ.js +0 -185
  128. package/dist/client/index-hSIi5Ygk.js +0 -153
  129. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  130. package/dist/client/lerc-DzVumYtB-cTUap6k_.js +0 -1027
  131. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  132. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  133. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  134. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  135. package/dist/client/ssrBoot-D3KF5Thc.js +0 -17
  136. package/dist/client/transition-D3a4tiJv.js +0 -34
  137. package/dist/client/webfontloader-qotgY98I.js +0 -435
  138. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
@@ -1,16 +1,16 @@
1
- /** @param {import("stac-ts").StacLink[]} links */
1
+ import { changeMapProjection, registerProjection } from "@/store/Actions";
2
+ import { availableMapProjection } from "@/store/States";
3
+ import { toAbsolute } from "stac-js/src/http.js";
4
+ import axios from "@/plugins/axios";
5
+ import log from "loglevel";
6
+
7
+ /** @param {import("stac-ts").StacLink[]} [links] */
2
8
  export function generateFeatures(links) {
3
9
  /**
4
- * @type {{
5
- * type: string;
6
- * geometry: {
7
- * type: string;
8
- * coordinates: [number, number];
9
- * };
10
- * }[]}
10
+ * @type {import("geojson").Feature[]}
11
11
  */
12
12
  const features = [];
13
- links.forEach((element) => {
13
+ links?.forEach((element) => {
14
14
  if (element.rel === "item" && "latlng" in element) {
15
15
  const [lat, lon] = /** @type {string} */ (element.latlng)
16
16
  .split(",")
@@ -21,6 +21,7 @@ export function generateFeatures(links) {
21
21
  type: "Point",
22
22
  coordinates: [lon, lat],
23
23
  },
24
+ properties: { id: element.id },
24
25
  });
25
26
  }
26
27
  });
@@ -36,3 +37,362 @@ export function generateFeatures(links) {
36
37
  };
37
38
  return geojsonObject;
38
39
  }
40
+
41
+ /** @param { import("ol/layer/WebGLTile").Style & { jsonform?: Record<string,any> } & { legend?: Record<string,any> } } [style] */
42
+ export function extractLayerConfig(style) {
43
+ /** @type {Record<string,unknown> | undefined} */
44
+ let layerConfig = undefined;
45
+ if (style?.jsonform) {
46
+ layerConfig = { schema: style.jsonform, type: "style" };
47
+ style = { ...style };
48
+ delete style.jsonform;
49
+ if (style?.legend) {
50
+ layerConfig.legend = style.legend;
51
+ delete style.legend;
52
+ }
53
+ }
54
+ log.debug(
55
+ "extracted layerConfig",
56
+ JSON.parse(JSON.stringify({ layerConfig, style })),
57
+ );
58
+
59
+ return { layerConfig, style };
60
+ }
61
+
62
+ /**
63
+ * checks if there's a projection on the Collection and
64
+ * updates {@link availableMapProjection}
65
+ * @param {import('stac-ts').StacCollection} [STAcCollection]
66
+ */
67
+ export const setMapProjFromCol = async (STAcCollection) => {
68
+ // if a projection exists on the collection level
69
+ log.debug("Checking for available map projection in indicator");
70
+ const projection =
71
+ /** @type {number | string | {name: string, def: string} | undefined} */
72
+ (
73
+ STAcCollection?.["eodash:mapProjection"] ||
74
+ STAcCollection?.["proj:epsg"] ||
75
+ STAcCollection?.["eodash:proj4_def"]
76
+ );
77
+ if (projection) {
78
+ log.debug("Projection found", projection);
79
+ await registerProjection(projection);
80
+ const projectionCode = getProjectionCode(projection);
81
+ if (availableMapProjection.value !== projectionCode) {
82
+ log.debug(
83
+ "Changing map projection",
84
+ availableMapProjection.value,
85
+ projectionCode,
86
+ );
87
+ await changeMapProjection(projection);
88
+ }
89
+ // set it for `EodashMapBtns`
90
+ availableMapProjection.value = /** @type {string} */ (projectionCode);
91
+ } else {
92
+ // reset to default projection
93
+ log.debug("Resetting projection to default EPSG:3857");
94
+ await changeMapProjection((availableMapProjection.value = ""));
95
+ }
96
+ };
97
+
98
+ /**
99
+ * Function to extract collection urls from an indicator
100
+ * @param {import("stac-ts").StacCatalog
101
+ * | import("stac-ts").StacCollection
102
+ * | import("stac-ts").StacItem
103
+ * | null
104
+ * } stacObject
105
+ * @param {string} basepath
106
+ * @returns {string[]}
107
+ */
108
+ export function extractCollectionUrls(stacObject, basepath) {
109
+ const collectionUrls = [];
110
+ // Support for two structure types, flat and indicator, simplified here:
111
+ // Flat assumes Catalog-Collection-Item
112
+ // Indicator assumes Catalog-Collection-Collection-Item
113
+ // TODO: this is not the most stable test approach,
114
+ // we should discuss potential other approaches
115
+ if (stacObject?.links && stacObject?.links[1]?.rel === "item") {
116
+ collectionUrls.push(basepath);
117
+ } else if (stacObject?.links[1]?.rel === "child") {
118
+ // TODO: Iterate through all children to create collections
119
+ stacObject.links.forEach((link) => {
120
+ if (link.rel === "child") {
121
+ collectionUrls.push(toAbsolute(link.href, basepath));
122
+ }
123
+ });
124
+ }
125
+ return collectionUrls;
126
+ }
127
+
128
+ /**
129
+ * Assign extracted roles to layer properties
130
+ * @param {Record<string,any>} properties
131
+ * @param {import("stac-ts").StacLink | import("stac-ts").StacAsset} linkOrAsset
132
+ * */
133
+ export const extractRoles = (properties, linkOrAsset) => {
134
+ const roles = /** @type {string[]} */ (linkOrAsset.roles);
135
+ roles?.forEach((role) => {
136
+ if (role === "visible") {
137
+ properties.visible = true;
138
+ }
139
+ if (role === "overlay" || role === "baselayer") {
140
+ properties.group = role;
141
+ //remove all the properties and replace the random ID with baselayer
142
+ // provided ID
143
+ // const [_colId, _itemId, _isAsset, _random, proj] =
144
+ // properties.id.split(";:;");
145
+ // properties.id = ["", "", "", "", linkOrAsset.id, proj].join(";:;");
146
+ }
147
+
148
+ return properties;
149
+ });
150
+ };
151
+
152
+ /**
153
+ * @param {import("stac-ts").StacItem} item
154
+ * @param {string} itemUrl
155
+ **/
156
+ export const fetchStyle = async (item, itemUrl) => {
157
+ const styleLink = item.links.find((link) => link.rel.includes("style"));
158
+ if (styleLink) {
159
+ let url = "";
160
+ if (styleLink.href.startsWith("http")) {
161
+ url = styleLink.href;
162
+ } else {
163
+ url = toAbsolute(styleLink.href, itemUrl);
164
+ }
165
+
166
+ /** @type {import("ol/layer/WebGLTile").Style & {jsonform?:Record<string,any>}} */
167
+ const styleJson = await axios.get(url).then((resp) => resp.data);
168
+
169
+ log.debug("fetched styles JSON", JSON.parse(JSON.stringify(styleJson)));
170
+ return { ...styleJson };
171
+ }
172
+ };
173
+
174
+ /**
175
+ * Return projection code which is to be registered in `eox-map`
176
+ * @param {string|number|{name: string, def: string}} [projection]
177
+ * @returns {string}
178
+ */
179
+ export const getProjectionCode = (projection) => {
180
+ let code = projection;
181
+ switch (typeof projection) {
182
+ case "number":
183
+ code = `EPSG:${projection}`;
184
+ break;
185
+ case "string":
186
+ code = projection;
187
+ break;
188
+ case "object":
189
+ code = projection?.name;
190
+ }
191
+ return /** @type {string} */ (code);
192
+ };
193
+
194
+ /**
195
+ * @param {import("stac-ts").StacLink[]} [links]
196
+ * @param {string|null} [currentStep]
197
+ **/
198
+ export const extractLayerDatetime = (links, currentStep) => {
199
+ if (!currentStep || !links?.length) {
200
+ return undefined;
201
+ }
202
+
203
+ // check if links has a datetime value
204
+ const hasDatetime = links.some((l) => typeof l.datetime === "string");
205
+ if (!hasDatetime) {
206
+ return undefined;
207
+ }
208
+
209
+ /** @type {string[]} */
210
+ const controlValues = [];
211
+ try {
212
+ currentStep = new Date(currentStep).toISOString();
213
+
214
+ links.reduce((vals, link) => {
215
+ if (link.datetime && link.rel === "item") {
216
+ vals.push(
217
+ new Date(/** @type {string} */ (link.datetime)).toISOString(),
218
+ );
219
+ }
220
+ return vals;
221
+ }, controlValues);
222
+ } catch (e) {
223
+ console.warn("[eodash] not supported datetime format was provided", e);
224
+ return undefined;
225
+ }
226
+ // not enough controlValues
227
+ if (controlValues.length <= 1) {
228
+ return undefined;
229
+ }
230
+
231
+ // item datetime is not included in the item links datetime
232
+ if (!controlValues.includes(currentStep)) {
233
+ return undefined;
234
+ }
235
+
236
+ return {
237
+ controlValues,
238
+ currentStep,
239
+ slider: true,
240
+ disablePlay: true,
241
+ };
242
+ };
243
+
244
+ /**
245
+ * Find layer by ID
246
+ * @param {string} layer
247
+ * @param {Record<string, any>[]} layers
248
+ * @returns {Record<string,any> | undefined}
249
+ **/
250
+ export const findLayer = (layers, layer) => {
251
+ for (const lyr of layers) {
252
+ if (lyr.type === "Group") {
253
+ const found = findLayer(lyr.layers, layer);
254
+ if (!found) {
255
+ continue;
256
+ }
257
+ return found;
258
+ }
259
+ if (lyr.properties.id === layer) {
260
+ return lyr;
261
+ }
262
+ }
263
+ };
264
+
265
+ /**
266
+ * @param {Record<string,any>[]} currentLayers
267
+ * @param {Record<string,any>} oldLayer
268
+ * @param {Record<string,any>[]} newLayers
269
+ * @returns {Record<string,any>[] | undefined}
270
+ */
271
+ export const replaceLayer = (currentLayers, oldLayer, newLayers) => {
272
+ const oldLayerIdx = currentLayers.findIndex(
273
+ (l) => l.properties.id === oldLayer.properties.id,
274
+ );
275
+ if (oldLayerIdx !== -1) {
276
+ currentLayers.splice(oldLayerIdx, 1, ...newLayers);
277
+ return currentLayers;
278
+ }
279
+
280
+ for (const l of currentLayers) {
281
+ if (l.type === "Group") {
282
+ const updatedGroupLyrs = replaceLayer(l.layers, oldLayer, newLayers);
283
+ if (updatedGroupLyrs?.length) {
284
+ l.layers = updatedGroupLyrs;
285
+ return currentLayers;
286
+ }
287
+ }
288
+ }
289
+ };
290
+ /**
291
+ * @param {import('./eodashSTAC.js').EodashCollection[]} indicators
292
+ * @param {import('ol/layer').Layer} layer
293
+ */
294
+ export const getColFromLayer = async (indicators, layer) => {
295
+ // init cols
296
+ const collections = await Promise.all(
297
+ indicators.map((ind) => ind.fetchCollection()),
298
+ );
299
+ const [collectionId, itemId, ..._other] = layer.get("id").split(";:;");
300
+
301
+ const chosen = collections.find((col) => {
302
+ const isInd =
303
+ col.id === collectionId &&
304
+ col.links?.some(
305
+ (link) => link.rel === "item" && link.href.includes(itemId),
306
+ );
307
+ return isInd ?? false;
308
+ });
309
+ return indicators.find((ind) => ind.collectionStac?.id === chosen?.id);
310
+ };
311
+
312
+ /**
313
+ * generates layer specific ID, related functions are: {@link assignProjID} & {@link extractRoles}
314
+ * @param {string} collectionId
315
+ * @param {string} itemId
316
+ * @param {import('stac-ts').StacLink} link
317
+ * @param {string} projectionCode
318
+ *
319
+ */
320
+ export const createLayerID = (collectionId, itemId, link, projectionCode) => {
321
+ const linkId = link.id || link.title || link.href;
322
+ let lId = `${collectionId ?? ""};:;${itemId ?? ""};:;${linkId ?? ""};:;${projectionCode ?? ""}`;
323
+ // If we are looking at base layers and overlays we remove the collection and item part
324
+ // as we want to make sure tiles are not reloaded when switching layers
325
+ if (
326
+ link.roles &&
327
+ // @ts-expect-error it seems roles it not defined for links yet
328
+ link.roles.find((r) => ["baselayer", "overlay"].includes(r))
329
+ ) {
330
+ lId = `${linkId ?? ""};:;${projectionCode ?? ""}`;
331
+ }
332
+ log.debug("Generated Layer ID", lId);
333
+ return lId;
334
+ };
335
+
336
+ /**
337
+ * generates layer specific ID, related functions are: {@link assignProjID} & {@link extractRoles}
338
+ * @param {string} collectionId
339
+ * @param {string} itemId
340
+ * @param {number} index
341
+ *
342
+ */
343
+ export const createAssetID = (collectionId, itemId, index) => {
344
+ let lId = `${collectionId ?? ""};:;${itemId ?? ""};:;${index ?? ""}`;
345
+ log.debug("Generated Asset ID", lId);
346
+ return lId;
347
+ };
348
+
349
+ /**
350
+ *
351
+ * @param {import("stac-ts").StacItem} item
352
+ * @param {import("stac-ts").StacLink | import("stac-ts").StacAsset} linkOrAsset
353
+ * @param {string} id - {@link createLayerID} & {@link extractRoles}
354
+ * @param {{ properties:{id:string} & Record<string, any> }& Record<string,any>} layer
355
+ * @returns
356
+ */
357
+ export function assignProjID(item, linkOrAsset, id, layer) {
358
+ const indicatorProjection =
359
+ /** @type { string | undefined} */
360
+ (item?.["proj:epsg"]) ||
361
+ /** @type { {name?: string} | undefined} */
362
+ (item?.["eodash:mapProjection"])?.name ||
363
+ "EPSG:3857";
364
+
365
+ const idArr = id.split(";:;");
366
+
367
+ idArr.pop();
368
+ idArr.push(indicatorProjection);
369
+ const updatedID = idArr.join(";:;");
370
+ layer.properties.id = updatedID;
371
+
372
+ log.debug("Updating layer id", updatedID);
373
+
374
+ return updatedID;
375
+ }
376
+
377
+ /**
378
+ * creates a structured clone from the layers and
379
+ * removes all properties from the clone
380
+ * except the ID and title
381
+ *
382
+ * @param {Record<string,any>[]} layers
383
+ */
384
+ export const removeUnneededProperties = (layers) => {
385
+ const cloned = structuredClone(layers);
386
+ cloned.forEach((layer) => {
387
+ const id = layer.properties.id;
388
+ const title = layer.properties.title;
389
+ layer.properties = { id, title };
390
+ if (layer["interactions"]) {
391
+ delete layer["interactions"];
392
+ }
393
+ if (layer.type === "Group") {
394
+ layer.layers = removeUnneededProperties(layer.layers);
395
+ }
396
+ });
397
+ return cloned;
398
+ };
@@ -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,17 @@
1
+ import { 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
+ * @type {import('./eodashSTAC').EodashCollection[]}
7
+ * @private
8
+ */
9
+ export const eodashCollections = shallowReactive([]);
10
+
11
+ /**
12
+ * Array of eodash STAC Collections extracted from the current selected COMPARE indicator.
13
+ * Updated in {@link file://./../store/stac.js ` loadSelectedCompareSTAC`} widget
14
+ * @type {import('./eodashSTAC').EodashCollection[]}
15
+ * @private
16
+ */
17
+ export const eodashCompareCollections = shallowReactive([]);
@@ -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 { 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,7 +41,7 @@ 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();
@@ -60,34 +58,8 @@ const HeaderComponent = defineAsyncComponent(
60
58
  const FooterComponent = defineAsyncComponent(
61
59
  () => import(`@/components/Footer.vue`),
62
60
  );
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
61
 
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
-
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
- });
62
+ const templateHeight = props.isWebComponent ? "100%" : "100dvh";
91
63
 
92
64
  const error = ref("");
93
65
  onErrorCaptured((e, comp, info) => {
@@ -99,18 +71,17 @@ onErrorCaptured((e, comp, info) => {
99
71
  });
100
72
  </script>
101
73
  <style>
102
- html {
103
- overflow: hidden !important;
104
- }
105
-
106
- .template {
107
- height: v-bind("templateHeight");
108
- }
109
-
110
74
  .loading-container {
111
75
  height: 100dvh;
112
76
  display: flex;
113
77
  align-items: center;
114
78
  justify-content: center;
115
79
  }
80
+
81
+ div.v-application__wrap {
82
+ min-height: fit-content;
83
+ }
84
+ eo-dash {
85
+ overflow: hidden;
86
+ }
116
87
  </style>
@@ -7,15 +7,7 @@ declare module "*.vue" {
7
7
  }
8
8
  declare interface Window {
9
9
  eodashStore: import("@/types").EodashStore;
10
- }
11
- declare module "@eox/stacinfo" {
12
- export const EOxStacInfo: CustomElementConstructor;
13
- }
14
- declare module "@eox/map" {
15
- export const EOxMap: CustomElementConstructor;
16
- }
17
- declare module "@eox/itemfilter" {
18
- export const EOxItemFilter: CustomElementConstructor;
10
+ setEodashLoglevel: typeof import("loglevel").setLevel;
19
11
  }
20
12
  declare module "user:config" {
21
13
  const eodash: import("@/types").Eodash | Promise<import("@/types").Eodash>;
@@ -0,0 +1,87 @@
1
+ import { inject, openBlock, createBlock, withCtx, createElementVNode, unref, normalizeStyle, createElementBlock, Suspense, resolveDynamicComponent, mergeProps, createCommentVNode, Fragment, renderList, Transition } from 'vue';
2
+ import { _ as _export_sfc, F as eodashKey, G as useDefineWidgets } from './asWebComponent-DUUoR7MZ.js';
3
+ import '@eox/layout';
4
+ import { V as VMain } from './VMain-DnGlQUyr.js';
5
+
6
+ const _hoisted_1 = ["gap"];
7
+ const _hoisted_2 = ["h", "w", "x", "y"];
8
+
9
+
10
+ const _sfc_main = {
11
+ __name: 'DashboardLayout',
12
+ setup(__props) {
13
+
14
+ const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
15
+
16
+ const [bgWidget] = useDefineWidgets([eodash.template?.background]);
17
+
18
+ const importedWidgets = useDefineWidgets(eodash.template?.widgets);
19
+
20
+ return (_ctx, _cache) => {
21
+
22
+
23
+ return (openBlock(), createBlock(VMain, null, {
24
+ default: withCtx(() => [
25
+ createElementVNode("eox-layout", {
26
+ gap: unref(eodash).template.gap ?? 16,
27
+ style: normalizeStyle(`padding: ${unref(eodash).template.gap || 16}px`)
28
+ }, [
29
+ (unref(bgWidget).component)
30
+ ? (openBlock(), createElementBlock("eox-layout-item", {
31
+ key: 0,
32
+ class: "bg-panel bg-surface",
33
+ style: normalizeStyle(`margin: -${unref(eodash).template.gap ?? 16}px;`),
34
+ x: "0",
35
+ y: "0",
36
+ h: "12",
37
+ w: "12"
38
+ }, [
39
+ (openBlock(), createBlock(Suspense, { suspensible: "" }, {
40
+ default: withCtx(() => [
41
+ (openBlock(), createBlock(resolveDynamicComponent(unref(bgWidget).component), mergeProps({ id: "bg-widget" }, unref(bgWidget).props), null, 16 /* FULL_PROPS */))
42
+ ]),
43
+ _: 1 /* STABLE */
44
+ }))
45
+ ], 4 /* STYLE */))
46
+ : createCommentVNode("v-if", true),
47
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(importedWidgets), (importedWidget, idx) => {
48
+ return (openBlock(), createBlock(Transition, {
49
+ key: idx,
50
+ name: "fade"
51
+ }, {
52
+ default: withCtx(() => [
53
+ (importedWidget.value.component)
54
+ ? (openBlock(), createElementBlock("eox-layout-item", {
55
+ key: importedWidget.value.id,
56
+ class: "panel bg-surface",
57
+ h: importedWidget.value.layout.h,
58
+ w: importedWidget.value.layout.w,
59
+ x: importedWidget.value.layout.x,
60
+ y: importedWidget.value.layout.y
61
+ }, [
62
+ (openBlock(), createBlock(Suspense, { suspensible: "" }, {
63
+ default: withCtx(() => [
64
+ (openBlock(), createBlock(resolveDynamicComponent(importedWidget.value.component), mergeProps({
65
+ key: importedWidget.value.id,
66
+ ref_for: true
67
+ }, importedWidget.value.props), null, 16 /* FULL_PROPS */))
68
+ ]),
69
+ _: 2 /* DYNAMIC */
70
+ }, 1024 /* DYNAMIC_SLOTS */))
71
+ ], 8 /* PROPS */, _hoisted_2))
72
+ : createCommentVNode("v-if", true)
73
+ ]),
74
+ _: 2 /* DYNAMIC */
75
+ }, 1024 /* DYNAMIC_SLOTS */))
76
+ }), 128 /* KEYED_FRAGMENT */))
77
+ ], 12 /* STYLE, PROPS */, _hoisted_1)
78
+ ]),
79
+ _: 1 /* STABLE */
80
+ }))
81
+ }
82
+ }
83
+
84
+ };
85
+ const DashboardLayout = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-c4bc74b1"]]);
86
+
87
+ export { DashboardLayout as default };