@eodash/eodash 5.6.1 → 5.7.1

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 (133) hide show
  1. package/core/client/components/DashboardLayout.vue +1 -1
  2. package/core/client/components/EodashOverlay.vue +27 -4
  3. package/core/client/composables/DefineEodash.js +0 -1
  4. package/core/client/composables/DefineWidgets.js +3 -1
  5. package/core/client/composables/index.js +6 -2
  6. package/core/client/eodashSTAC/EodashCollection.js +79 -45
  7. package/core/client/eodashSTAC/cql.js +64 -0
  8. package/core/client/eodashSTAC/createLayers.js +192 -125
  9. package/core/client/eodashSTAC/helpers.js +423 -97
  10. package/core/client/eodashSTAC/mosaic.js +416 -0
  11. package/core/client/plugins/axios.js +31 -1
  12. package/core/client/store/actions.js +1 -1
  13. package/core/client/store/stac.js +25 -4
  14. package/core/client/store/states.js +20 -2
  15. package/core/client/types.ts +155 -29
  16. package/core/client/utils/bands-editor/exampleSchema.json +50 -50
  17. package/core/client/utils/index.js +4 -0
  18. package/core/client/utils/states.js +10 -0
  19. package/dist/client/{DashboardLayout-CqMb7OXc.js → DashboardLayout-ePbdvUTE.js} +5 -5
  20. package/dist/client/{DynamicWebComponent-DqKqTf7l.js → DynamicWebComponent-g5SdRbjY.js} +1 -1
  21. package/dist/client/{EodashChart-PkUQfH0k.js → EodashChart-ChrkA5oS.js} +7 -6
  22. package/dist/client/{EodashDatePicker-DLJGdTtX.js → EodashDatePicker-CY1TrsDo.js} +3 -3
  23. package/dist/client/{EodashItemFilter-Dk8KjFcX.js → EodashItemFilter-DzshHDlS.js} +2 -1
  24. package/dist/client/{EodashLayerControl-CC1Cogrn.js → EodashLayerControl-DMCeMkSd.js} +70 -22
  25. package/dist/client/{EodashLayoutSwitcher-5WZYd6rr.js → EodashLayoutSwitcher-iJ8mX1rF.js} +3 -3
  26. package/dist/client/EodashMapBtns-C7Cr7q5Y.js +592 -0
  27. package/dist/client/EodashStacInfo-K7-iuXa7.js +169 -0
  28. package/dist/client/{EodashTools-CGZtTh45.js → EodashTools-BEK7e7JM.js} +4 -4
  29. package/dist/client/{ExportState-Ce0ZnrX_.js → ExportState-CqIzfMYQ.js} +6 -168
  30. package/dist/client/{Footer-CnZqEiop.js → Footer-1P0cmBOZ.js} +1 -1
  31. package/dist/client/{Header-Dr5PBIm8.js → Header-CkkBaBNh.js} +2 -2
  32. package/dist/client/MobileLayout-BPf49kDU.js +118 -0
  33. package/dist/client/{PopUp-DjvE_71e.js → PopUp-DPZq5SWI.js} +4 -168
  34. package/dist/client/{ProcessList-kf3olI7W.js → ProcessList-DuI6WpS1.js} +5 -5
  35. package/dist/client/VDivider-Bj9LG_JV.js +168 -0
  36. package/dist/client/{VImg-Bj6uWt6j.js → VImg-Ddv5OyMz.js} +2 -2
  37. package/dist/client/{VMain-Cm0UmKGi.js → VMain-7yqk_qC3.js} +1 -1
  38. package/dist/client/{VTooltip-DbBu-ky3.js → VTooltip-2hAJyEoa.js} +2 -2
  39. package/dist/client/{WidgetsContainer-CfLnd44U.js → WidgetsContainer-2DOrlwCB.js} +1 -1
  40. package/dist/client/{asWebComponent-DfULAbpq.js → asWebComponent-BlFN2lkB.js} +493 -335
  41. package/dist/client/{async-CIbKXEEe.js → async-B2H8ZwUK.js} +21 -10
  42. package/dist/client/create-layers-config-u_vn5hPk.js +182 -0
  43. package/dist/client/dialog-transition-BrMkMiNa.js +170 -0
  44. package/dist/client/eo-dash.js +1 -1
  45. package/dist/client/{forwardRefs-yj3VWOK5.js → forwardRefs-DAlror6d.js} +8 -87
  46. package/dist/client/{handling-s8xt2JwF.js → handling-B6I1V5eG.js} +123 -85
  47. package/dist/client/{helpers-DAVGYl_f.js → helpers-CBqIUSXJ.js} +3034 -1649
  48. package/dist/client/index-BWq1ZKaV.js +3168 -0
  49. package/dist/client/{index-CYz6dT7K.js → index-CJ9UI3ln.js} +2 -2
  50. package/dist/client/index-DXLz4sFR.js +442 -0
  51. package/dist/client/{index-4TrjfJ32.js → index-DhKU6KqM.js} +230 -231
  52. package/dist/client/{index-Bu8BMA9q.js → index-DjQlbWbJ.js} +70 -83
  53. package/dist/client/material-symbols-outlined.woff2 +0 -0
  54. package/dist/client/material-symbols-rounded.woff2 +0 -0
  55. package/dist/client/material-symbols-sharp.woff2 +0 -0
  56. package/dist/client/material-symbols-subset.woff2 +0 -0
  57. package/dist/client/mosaic-BFYLEwyx.js +455 -0
  58. package/dist/client/templates.js +250 -119
  59. package/dist/client/{transition-DaOsiD4u.js → transition-D_W6Wn9v.js} +1 -1
  60. package/dist/node/cli.js +5 -5
  61. package/dist/node/types.d.ts +4 -0
  62. package/dist/types/core/client/composables/DefineEodash.d.ts +1 -1
  63. package/dist/types/core/client/composables/index.d.ts +1 -3
  64. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +62 -31
  65. package/dist/types/core/client/eodashSTAC/cql.d.ts +15 -0
  66. package/dist/types/core/client/eodashSTAC/createLayers.d.ts +44 -25
  67. package/dist/types/core/client/eodashSTAC/helpers.d.ts +78 -18
  68. package/dist/types/core/client/eodashSTAC/mosaic.d.ts +56 -0
  69. package/dist/types/core/client/store/stac.d.ts +31 -7
  70. package/dist/types/core/client/store/states.d.ts +24 -2
  71. package/dist/types/core/client/types.d.ts +131 -25
  72. package/dist/types/core/client/utils/states.d.ts +12 -0
  73. package/dist/types/templates/baseConfig.d.ts +1 -88
  74. package/dist/types/templates/compare.d.ts +32 -3
  75. package/dist/types/templates/expert.d.ts +18 -0
  76. package/dist/types/templates/explore.d.ts +9 -1
  77. package/dist/types/templates/lite.d.ts +11 -0
  78. package/dist/types/widgets/EodashChart.vue.d.ts +5 -3
  79. package/dist/types/widgets/EodashItemCatalog/index.vue.d.ts +129 -2
  80. package/dist/types/widgets/EodashItemCatalog/methods/filters.d.ts +28 -6
  81. package/dist/types/widgets/EodashItemCatalog/methods/handlers.d.ts +17 -4
  82. package/dist/types/widgets/EodashItemCatalog/methods/map.d.ts +16 -4
  83. package/dist/types/widgets/EodashLayerControl.vue.d.ts +36 -17
  84. package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +23 -10
  85. package/dist/types/widgets/EodashMap/index.vue.d.ts +91 -35
  86. package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +1 -8
  87. package/dist/types/widgets/EodashMap/methods/index.d.ts +5 -1
  88. package/dist/types/widgets/EodashMap/methods/use-map-loading.d.ts +1 -0
  89. package/dist/types/widgets/EodashProcess/index.vue.d.ts +5 -3
  90. package/dist/types/widgets/EodashProcess/methods/composables.d.ts +1 -1
  91. package/dist/types/widgets/EodashProcess/methods/handling.d.ts +13 -8
  92. package/dist/types/widgets/EodashProcess/states.d.ts +1 -1
  93. package/dist/types/widgets/EodashStacInfo.vue.d.ts +20 -0
  94. package/dist/types/widgets/EodashTimeSlider/index.vue.d.ts +54 -0
  95. package/dist/types/widgets/EodashTimeSlider/methods/index.d.ts +34 -0
  96. package/dist/types/widgets/EodashTimeSlider/types.d.ts +52 -0
  97. package/dist/types/widgets/EodashTools.vue.d.ts +5 -5
  98. package/package.json +46 -46
  99. package/templates/baseConfig.js +36 -6
  100. package/templates/compare.js +62 -7
  101. package/templates/expert.js +23 -0
  102. package/templates/explore.js +11 -5
  103. package/templates/lite.js +14 -0
  104. package/widgets/EodashChart.vue +1 -0
  105. package/widgets/EodashItemCatalog/index.vue +363 -35
  106. package/widgets/EodashItemCatalog/methods/filters.js +134 -70
  107. package/widgets/EodashItemCatalog/methods/handlers.js +113 -19
  108. package/widgets/EodashItemCatalog/methods/map.js +142 -28
  109. package/widgets/EodashLayerControl.vue +64 -14
  110. package/widgets/EodashMap/EodashMapBtns.vue +153 -47
  111. package/widgets/EodashMap/index.vue +101 -105
  112. package/widgets/EodashMap/methods/btns.js +37 -5
  113. package/widgets/EodashMap/methods/create-layers-config.js +18 -16
  114. package/widgets/EodashMap/methods/index.js +89 -8
  115. package/widgets/EodashMap/methods/use-map-loading.js +52 -0
  116. package/widgets/EodashProcess/index.vue +2 -1
  117. package/widgets/EodashProcess/methods/async.js +19 -8
  118. package/widgets/EodashProcess/methods/composables.js +63 -77
  119. package/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.js +9 -5
  120. package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +7 -4
  121. package/widgets/EodashProcess/methods/handling.js +105 -72
  122. package/widgets/EodashProcess/states.js +1 -1
  123. package/widgets/EodashStacInfo.vue +64 -2
  124. package/widgets/EodashTimeSlider/index.vue +208 -0
  125. package/widgets/EodashTimeSlider/methods/index.js +236 -0
  126. package/widgets/EodashTimeSlider/types.ts +54 -0
  127. package/dist/client/EodashMapBtns-BHrSDNoC.js +0 -435
  128. package/dist/client/EodashStacInfo-B90wobPc.js +0 -107
  129. package/dist/client/EodashTimeSlider-5vm7F3ju.js +0 -53
  130. package/dist/client/MobileLayout-DyMjaeif.js +0 -118
  131. package/dist/client/index-CugS__t5.js +0 -570
  132. package/dist/types/widgets/EodashTimeSlider.vue.d.ts +0 -15
  133. package/widgets/EodashTimeSlider.vue +0 -40
@@ -0,0 +1,236 @@
1
+ import { createLayersConfig } from "^/EodashMap/methods/create-layers-config";
2
+ import { eodashCollections } from "@/utils/states";
3
+ import axios from "@/plugins/axios";
4
+ import { mapEl } from "@/store/states";
5
+ import { removeLayers, sanitizeBbox } from "@/eodashSTAC/helpers";
6
+ import { getLayers } from "@/store/actions";
7
+ import { buildCqlFilter } from "@/eodashSTAC/cql";
8
+
9
+ /**
10
+ * @param {string} stacEndpoint
11
+ * @param {[string, string]} selectedRange
12
+ * @param {import("../types").TimelineExportEventDetail["selectedRangeItems"]} selectedRangeItems
13
+ * @param {import("vue").Ref<import("stac-ts").StacCollection|null>} selectedStac
14
+ * @param {import("@/types").ItemFilterFilters} filters
15
+ */
16
+ export async function createAnimationLayers(
17
+ stacEndpoint,
18
+ selectedRange,
19
+ selectedRangeItems,
20
+ selectedStac,
21
+ filters,
22
+ ) {
23
+ if (eodashCollections[0].isAPI) {
24
+ return await createAPILayers(
25
+ stacEndpoint,
26
+ { min: selectedRange[0], max: selectedRange[1] },
27
+ mapEl.value?.lonLatExtent,
28
+ selectedStac,
29
+ filters,
30
+ );
31
+ }
32
+ const { collections: hiddenCollections, layers: hiddenLayers } =
33
+ getHiddenLayers([...getLayers()]);
34
+
35
+ return await Promise.all(
36
+ Object.values(selectedRangeItems).flatMap(async (itemSet) => {
37
+ /** @type {Array<{ layers: Record<string, any>[]; date: string }>} */
38
+ const mapLayersArr = [];
39
+ for (const dateItem of itemSet) {
40
+ await createLayersConfig(
41
+ selectedStac.value,
42
+ eodashCollections.filter(
43
+ (collection) =>
44
+ !hiddenCollections.includes(collection.collectionStac?.id ?? ""),
45
+ ),
46
+ dateItem.originalDate,
47
+ ).then((layers) => {
48
+ //@ts-expect-error createLayersConfig is not typed strictly
49
+ layers = removeLayers(layers, hiddenLayers);
50
+ //@ts-expect-error createLayersConfig is not typed strictly
51
+ layers = restoreLayersVisibility(layers);
52
+ layers = anonimizeLayersCORS(layers);
53
+ mapLayersArr.push({
54
+ layers,
55
+ date: dateItem.originalDate,
56
+ });
57
+ });
58
+ }
59
+ return mapLayersArr;
60
+ }),
61
+ ).then((results) => results.flat());
62
+ }
63
+ /**
64
+ *
65
+ * @param {string} stacEndpoint
66
+ * @param {{min: string, max: string}} date
67
+ * @param {number[] | undefined} bbox
68
+ * @param {import("vue").Ref<import("stac-ts").StacCollection|null>} selectedStac
69
+ * @param {import("@/types").ItemFilterFilters} filters
70
+ * @return {Promise<Array<{ layers: Record<string, any>[]; date: string }>>}
71
+ */
72
+ async function createAPILayers(
73
+ stacEndpoint,
74
+ date = { min: "", max: "" },
75
+ bbox,
76
+ selectedStac,
77
+ filters,
78
+ ) {
79
+ if (!bbox) {
80
+ return [];
81
+ }
82
+ const url = new URL(stacEndpoint + "/search");
83
+ url.searchParams.set("limit", "100");
84
+ url.searchParams.set("collections", selectedStac.value?.id ?? "");
85
+ url.searchParams.set(
86
+ "datetime",
87
+ `${new Date(date.min).toISOString()}/${new Date(date.max).toISOString()}`,
88
+ );
89
+ url.searchParams.set("bbox", sanitizeBbox(bbox).join(","));
90
+
91
+ const stacFilter = buildCqlFilter(filters);
92
+ if (stacFilter) {
93
+ url.searchParams.set("filter", stacFilter);
94
+ }
95
+
96
+ /** @type {import("stac-ts").StacItem[]} */
97
+ const items = await axios
98
+ .get(url.href)
99
+ .then((res) => res.data.features)
100
+ .catch((err) => {
101
+ console.error("[eodash] Error fetching items for animation:", err);
102
+ return [];
103
+ });
104
+ if (!items || !items.length) {
105
+ console.warn("[eodash] No items found for animation.");
106
+ return [];
107
+ }
108
+ const { collections: hiddenCollections, layers: hiddenLayers } =
109
+ getHiddenLayers([...getLayers()]);
110
+ return await Promise.all(
111
+ items.map(async (item) => {
112
+ /** @type {Array<{ layers: Record<string, any>[]; date: string }>} */
113
+ const mapLayersArr = [];
114
+ await createLayersConfig(
115
+ selectedStac.value,
116
+ eodashCollections.filter(
117
+ (collection) =>
118
+ !hiddenCollections.includes(collection.collectionStac?.id ?? ""),
119
+ ),
120
+ item,
121
+ ).then((layers) => {
122
+ //@ts-expect-error createLayersConfig is not typed strictly
123
+ layers = removeLayers(layers, hiddenLayers);
124
+ //@ts-expect-error createLayersConfig is not typed strictly
125
+ layers = restoreLayersVisibility(layers);
126
+ layers = anonimizeLayersCORS(layers);
127
+ mapLayersArr.push({
128
+ layers,
129
+ date: /** @type {string} */ (item.properties.datetime),
130
+ });
131
+ return mapLayersArr;
132
+ });
133
+ return mapLayersArr;
134
+ }),
135
+ ).then((results) => results.flat());
136
+ }
137
+ /**
138
+ *
139
+ * @param {Record<string, any>[]} layers
140
+ * @returns {Record<string, any>[]}
141
+ */
142
+ export function anonimizeLayersCORS(layers) {
143
+ return layers.map((layer) => {
144
+ if (layer.type === "Group") {
145
+ layer.layers = anonimizeLayersCORS(layer.layers);
146
+ return layer;
147
+ }
148
+ if (layer.source) {
149
+ layer.source.crossOrigin = "anonymous";
150
+ }
151
+ return layer;
152
+ });
153
+ }
154
+ /**
155
+ * returns the list of layers that has visibility hidden
156
+ * @param {import("@eox/map").EoxLayer[]} layers
157
+ * @returns {{ collections: string[]; layers: string[] }}
158
+ */
159
+ export function getHiddenLayers(layers) {
160
+ /** @type {{ collections: string[]; layers: string[] }} */
161
+ const result = { collections: [], layers: [] };
162
+
163
+ for (const layer of layers) {
164
+ // check inner layers if it's a group layer first
165
+ if (layer.type === "Group" && Array.isArray(layer.layers)) {
166
+ const childResult = getHiddenLayers(layer.layers);
167
+ for (const col of childResult.collections) {
168
+ if (!result.collections.includes(col)) {
169
+ result.collections.push(col);
170
+ }
171
+ }
172
+ for (const lyr of childResult.layers) {
173
+ if (!result.layers.includes(lyr)) {
174
+ result.layers.push(lyr);
175
+ }
176
+ }
177
+ }
178
+
179
+ if (!layer.properties?.id) {
180
+ continue;
181
+ }
182
+
183
+ const olLayer = mapEl.value?.getLayerById(layer.properties?.id);
184
+ if (!olLayer) {
185
+ continue;
186
+ }
187
+
188
+ if (olLayer.getVisible() === false) {
189
+ const refId = layer.properties.id;
190
+ if (refId) {
191
+ if (refId.includes(";:;")) {
192
+ // Check if this looks like a typical eodash collection ID with separator
193
+ const parts = refId.split(";:;");
194
+ if (parts.length > 2) {
195
+ const prefix = parts[0];
196
+ if (!result.collections.includes(prefix)) {
197
+ result.collections.push(prefix);
198
+ }
199
+ } else {
200
+ // It has a separator but might just be a base layer like `layerId;:;EPSG`
201
+ if (!result.layers.includes(refId)) {
202
+ result.layers.push(refId);
203
+ }
204
+ }
205
+ } else {
206
+ if (!result.layers.includes(refId)) {
207
+ result.layers.push(refId);
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
+ return result;
215
+ }
216
+
217
+ /**
218
+ * Iterates through a list of layers and updates layer.properties.visible to true
219
+ * if it is set to false
220
+ * @param {import("@eox/map").EoxLayer[]} layers
221
+ * @returns {import("@eox/map").EoxLayer[]}
222
+ */
223
+ export function restoreLayersVisibility(layers) {
224
+ for (const layer of layers) {
225
+ if (layer.properties && layer.properties.visible === false) {
226
+ layer.properties.visible = true;
227
+ }
228
+
229
+ if (layer.type === "Group" && Array.isArray(layer.layers)) {
230
+ restoreLayersVisibility(layer.layers);
231
+ }
232
+ }
233
+ return layers;
234
+ }
235
+
236
+ export { useScheduleMosaicUpdate } from "@/eodashSTAC/mosaic";
@@ -0,0 +1,54 @@
1
+ import type { ItemFilterFilters } from "@/types";
2
+
3
+ export interface TimelineSelectionEventDetail {
4
+ date: [string, string];
5
+ instances: {
6
+ // this is inaccurate, the type should include all possible sources and layers,
7
+ layer: import("ol/layer/Layer").default;
8
+ source: import("ol/source/Source").default;
9
+ };
10
+ filters: ItemFilterFilters;
11
+ selectedItems: {
12
+ [layerId: string]: SelectedItem[];
13
+ };
14
+ }
15
+ export interface SelectedItem {
16
+ className: string;
17
+ date: string;
18
+ group: string;
19
+ // unique UUID for this item, generated by the timeline component
20
+ id: string;
21
+ itemId: string;
22
+ local: string;
23
+ originalDate: string;
24
+ property: string;
25
+ start: string;
26
+ type: string;
27
+ utc: string;
28
+ }
29
+
30
+ export interface TimelineExportEventDetail {
31
+ eoxMapConfig: {
32
+ layers: Record<string, any>[];
33
+ zoom: number;
34
+ center: [number, number];
35
+ };
36
+ filters: ItemFilterFilters;
37
+ instances: {
38
+ layer: import("ol/layer/Layer").default;
39
+ source: import("ol/source/Source").default;
40
+ };
41
+ selectedRangeItems: {
42
+ [layerId: string]: SelectedItem[];
43
+ };
44
+ generate: (args: {
45
+ mapLayers: Array<{ layers: Record<string, any>[]; date: string }>;
46
+ center?: [number, number];
47
+ zoom?: number;
48
+ }) => Promise<void>;
49
+ }
50
+
51
+ export interface ItemFilterEventDetail {
52
+ result: Record<string, any>;
53
+ filters: ItemFilterFilters;
54
+ }