@eodash/eodash 5.0.0-alpha.2.4 → 5.0.0-alpha.2.6

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 (80) hide show
  1. package/README.md +31 -7
  2. package/core/client/App.vue +6 -7
  3. package/core/client/SuspensedDashboard.ce.vue +59 -45
  4. package/core/client/asWebComponent.d.ts +10 -5
  5. package/core/client/asWebComponent.js +6 -6
  6. package/core/client/components/DashboardLayout.vue +63 -21
  7. package/core/client/components/DynamicWebComponent.vue +44 -44
  8. package/core/client/components/ErrorAlert.vue +24 -7
  9. package/core/client/components/Footer.vue +34 -15
  10. package/core/client/components/Header.vue +10 -5
  11. package/core/client/components/IframeWrapper.vue +4 -4
  12. package/core/client/components/Loading.vue +17 -18
  13. package/core/client/components/MobileLayout.vue +82 -29
  14. package/core/client/composables/DefineEodash.js +38 -28
  15. package/core/client/composables/DefineWidgets.js +105 -79
  16. package/core/client/composables/index.js +43 -141
  17. package/core/client/eodash.js +46 -39
  18. package/core/client/main.js +2 -2
  19. package/core/client/plugins/index.js +11 -9
  20. package/core/client/plugins/vuetify.js +9 -10
  21. package/core/client/render.js +4 -5
  22. package/core/client/store/States.js +8 -13
  23. package/core/client/store/index.js +14 -11
  24. package/core/client/store/stac.js +51 -37
  25. package/core/client/types.d.ts +173 -248
  26. package/core/client/utils/eodashSTAC.js +151 -66
  27. package/core/client/utils/helpers.js +18 -20
  28. package/core/client/utils/index.js +25 -14
  29. package/core/client/utils/keys.js +2 -2
  30. package/core/client/views/Dashboard.vue +70 -42
  31. package/core/client/vite-env.d.ts +19 -17
  32. package/dist/client/DashboardLayout-BuDcv6LM.js +156 -0
  33. package/dist/client/{DynamicWebComponent-C4Hotc4H.js → DynamicWebComponent-BEP4rVce.js} +7 -7
  34. package/dist/client/EodashDatePicker-oFb1zt5E.js +1211 -0
  35. package/dist/client/EodashItemFilter-BElmgrST.js +63 -0
  36. package/dist/client/{EodashMap-CGrQjZ1P.js → EodashMap-DXyOgcEd.js} +11333 -14025
  37. package/dist/client/Footer-CoPx6UXQ.js +115 -0
  38. package/dist/client/Header-C-zX31Ys.js +635 -0
  39. package/dist/client/{IframeWrapper-Cg3GMmfW.js → IframeWrapper-2w2ye0zM.js} +4 -4
  40. package/dist/client/MobileLayout-C9OVcP12.js +945 -0
  41. package/dist/client/{VMain-BHYlmRic.js → VMain-Dm43jd43.js} +8 -8
  42. package/dist/client/{WidgetsContainer-dje9QSk0.js → WidgetsContainer-BS87sLqk.js} +12 -5
  43. package/dist/client/asWebComponent-CpQUVi2N.js +20135 -0
  44. package/dist/client/{basedecoder-Qm25PwVp-CHo5Pomv.js → basedecoder-DHcBySSe-BmCFNFnw.js} +5 -6
  45. package/dist/client/{decoder-HRvnjnEI-BQ2rajuJ.js → decoder-CP4lv0Kb-BHrv68IA.js} +1 -1
  46. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +10 -0
  47. package/dist/client/eo-dash.js +3 -3
  48. package/dist/client/eodashSTAC-Q7kbX1Gy.js +2788 -0
  49. package/dist/client/{eox-itemfilter-DcQkRD2l.js → eox-itemfilter-TaBxgqq_.js} +1002 -974
  50. package/dist/client/{eox-map-C3DL31fp.js → eox-map-L7abwKTR.js} +5677 -5695
  51. package/dist/client/forwardRefs-BVFQ82G4.js +183 -0
  52. package/dist/client/{index-CaDDfJYE.js → index-dOzyv_xR.js} +43 -74
  53. package/dist/client/{jpeg-DNfUpLwy-Fjan-04T.js → jpeg-BAgeD1d3-oeHbFPUL.js} +5 -6
  54. package/dist/client/{lerc-_E46UbWQ-Beu35ovS.js → lerc-DzVumYtB-rm1Xco54.js} +5 -7
  55. package/dist/client/{lzw-BOMhmEDy-Dboc93VO.js → lzw-LAGDNbSC-DkP96qO9.js} +1 -1
  56. package/dist/client/{packbits-DaUD6MLm-Bu1PoTGa.js → packbits-BlDR4Kj5-C66n1-zr.js} +1 -1
  57. package/dist/client/{pako.esm-C3kYPGGQ-BMki8cQY.js → pako.esm-CB1uQYY0-DB0PYm1P.js} +6 -12
  58. package/dist/client/{raw-CcGKjn8q-DFOt-i8n.js → raw-CMGvRjfu-BRi6E4i1.js} +1 -1
  59. package/dist/client/{ssrBoot-Dd7m-btU.js → ssrBoot-L9KejErM.js} +3 -3
  60. package/dist/client/style.css +2 -2
  61. package/dist/client/transition-DCePIwYR.js +34 -0
  62. package/dist/client/{webfontloader-CyOFAuFB.js → webfontloader-qotgY98I.js} +56 -92
  63. package/dist/client/{webimage-D2c098k3-DLj1LQxB.js → webimage-BM_pbLN3-L2cGWK5l.js} +1 -1
  64. package/dist/node/cli.js +3 -3
  65. package/dist/node/types.d.ts +32 -38
  66. package/package.json +13 -14
  67. package/widgets/EodashDatePicker.vue +145 -41
  68. package/widgets/EodashItemFilter.vue +41 -22
  69. package/widgets/EodashMap.vue +87 -20
  70. package/widgets/WidgetsContainer.vue +45 -27
  71. package/dist/client/DashboardLayout-ZaSRMD1M.js +0 -149
  72. package/dist/client/EodashDatePicker-C4kKjxKy.js +0 -1653
  73. package/dist/client/EodashItemFilter-cBHC0YEM.js +0 -51
  74. package/dist/client/Footer-pS636dEP.js +0 -118
  75. package/dist/client/Header-DQuaLdjl.js +0 -605
  76. package/dist/client/MobileLayout-BLXFBWI_.js +0 -987
  77. package/dist/client/asWebComponent-Bvb3xkxI.js +0 -13311
  78. package/dist/client/deflate-Be2Arps5-hDqMz3RA.js +0 -10
  79. package/dist/client/forwardRefs-Bxeu9Obx.js +0 -142
  80. package/dist/client/index-DlNICb3T.js +0 -34
@@ -1,18 +1,19 @@
1
1
  // functions of this folder can only be consumed inside setup stores,
2
2
  // setup functions or vue composition api components
3
3
 
4
- import { reactive } from "vue";
5
4
  import { currentUrl, indicator, mapPosition } from "@/store/States";
6
5
  import eodash from "@/eodash";
7
6
  import { useTheme } from "vuetify/lib/framework.mjs";
8
7
  import { onMounted, watch } from "vue";
9
- import { mdiChevronDoubleDown, mdiChevronDoubleLeft, mdiChevronDoubleRight, mdiChevronDoubleUp } from "@mdi/js"
8
+ import { useSTAcStore } from "@/store/stac";
10
9
 
11
10
  /**
12
11
  * Creates an absolute URL from a relative link and assignes it to `currentUrl`
13
- * @param {string} [rel = '']
14
- * @param {string} [base = eodash.stacEndpoint] - base URL, default value is the root stac catalog
15
- * @returns {import('vue').Ref<string>} - returns `currentUrl`
12
+ *
13
+ * @param {string} [rel=''] Default is `''`
14
+ * @param {string} [base=eodash.stacEndpoint] - Base URL, default value is the
15
+ * root stac catalog. Default is `eodash.stacEndpoint`
16
+ * @returns {import("vue").Ref<string>} - Returns `currentUrl`
16
17
  * @see {@link '@/store/States.js'}
17
18
  */
18
19
  export const useAbsoluteUrl = (rel = "", base = eodash.stacEndpoint) => {
@@ -36,126 +37,18 @@ export const useAbsoluteUrl = (rel = "", base = eodash.stacEndpoint) => {
36
37
  };
37
38
 
38
39
  /**
39
- * Adds slide in and out functionality to Elements
40
- * @param {import('vue').Ref<HTMLElement[]|null>} elements - elements to add the functionality to
41
- * @param {import("@/types").Widget[]} configs
42
- */
43
- export const useSlidePanels = (elements, configs) => {
44
- /**
45
- * Sliding direction
46
- */
47
- const slideDirs = configs.map((m) =>
48
- m.layout.x == 0
49
- ? "left"
50
- : m.layout.x == 12 - m.layout.w
51
- ? "right"
52
- : m.layout.y < 6
53
- ? "up"
54
- : "down"
55
- );
56
-
57
- /**
58
- * Array of sliding button's style and icons
59
- */
60
- const slideBtns = slideDirs.map((dir, _idx) => {
61
- const btn = reactive({
62
- style: {},
63
- icon: { in: "", out: "" },
64
- active: false,
65
- enabled: true,
66
- });
67
-
68
- // temp removal of `slidable` from the widgets API
69
- // if (configs[idx].slidable === false) {
70
- // btn.enabled = false;
71
- // return btn;
72
- // }
73
-
74
- switch (dir) {
75
- case "left":
76
- btn.style = { top: "50%", right: "-11%" };
77
- btn.icon.in = mdiChevronDoubleRight
78
- btn.icon.out = mdiChevronDoubleLeft
79
-
80
- break;
81
- case "right":
82
- btn.style = { top: "50%", left: "-11%" };
83
- btn.icon.in = mdiChevronDoubleLeft
84
- btn.icon.out = mdiChevronDoubleRight
85
-
86
- break;
87
- case "up":
88
- btn.style = { right: "50%", bottom: "-17%" };
89
- btn.icon.in = mdiChevronDoubleDown
90
- btn.icon.out = mdiChevronDoubleUp
91
-
92
- break;
93
- case "down":
94
- btn.style = { right: "50%", top: "-17%" };
95
- btn.icon.in = mdiChevronDoubleUp
96
- btn.icon.out = mdiChevronDoubleDown
97
- break;
98
-
99
- default:
100
- console.error("sliding error");
101
- break;
102
- }
103
- return btn;
104
- });
105
-
106
- /**
107
- * Transforms the element's position based on the direction
108
- * @param {number} idx - index of the pressed element
109
- */
110
- const slideInOut = (idx) => {
111
- const parentStyle = /** @type {CSSStyleDeclaration} */ (
112
- elements.value?.[idx].style
113
- );
114
- if (parentStyle?.transform.length) {
115
- slideBtns[idx].active = false;
116
- parentStyle.transform = "";
117
- } else {
118
- slideBtns[idx].active = true;
119
- parentStyle.transition = "transform 0.3s ease-in-out";
120
- switch (slideDirs[idx]) {
121
- case "left":
122
- parentStyle.transform = "translateX(-100%)";
123
- break;
124
- case "right":
125
- parentStyle.transform = "translateX(100%)";
126
- break;
127
- case "up":
128
- parentStyle.transform = `translateY(-${(configs[idx].layout.y / configs[idx].layout.h) * 100 + 100
129
- }%)`;
130
- break;
131
- case "down":
132
- parentStyle.transform = `translateY(${(Math.max(0, 12 - configs[idx].layout.y - configs[idx].layout.h) /
133
- configs[idx].layout.h) *
134
- 100 +
135
- 100
136
- }%)`;
137
- break;
138
-
139
- default:
140
- console.error("sliding error");
141
- break;
142
- }
143
- }
144
- };
145
- return { slideBtns, slideInOut };
146
- };
147
-
148
- /**
149
- * Updates an existing Vuetify theme.
150
- * updates only the values provided in the `ThemeDefinition`
40
+ * Updates an existing Vuetify theme. updates only the values provided in the
41
+ * `ThemeDefinition`
42
+ *
151
43
  * @param {string} themeName - Name of the theme to be updated
152
- * @param {import('vuetify').ThemeDefinition} [themeDefinition = {}] - New defintion to be updated to
153
- * @returns {import('vuetify').ThemeInstance}
44
+ * @param {import("vuetify").ThemeDefinition} [themeDefinition={}] - New
45
+ * defintion to be updated to. Default is `{}`
46
+ * @returns {import("vuetify").ThemeInstance}
154
47
  */
155
48
  export const useUpdateTheme = (themeName, themeDefinition = {}) => {
156
49
  const theme = useTheme();
157
50
 
158
- /** @type {Array<keyof import('vuetify').ThemeDefinition>} */ (
51
+ /** @type {(keyof import("vuetify").ThemeDefinition)[]} */ (
159
52
  Object.keys(themeDefinition)
160
53
  ).forEach((key) => {
161
54
  if (key === "dark") {
@@ -163,7 +56,7 @@ export const useUpdateTheme = (themeName, themeDefinition = {}) => {
163
56
  themeDefinition[key]
164
57
  );
165
58
  } else {
166
- //@ts-expect-error
59
+ //@ts-expect-error to do
167
60
  theme.themes.value[themeName][key] = {
168
61
  ...theme.themes.value[themeName][key],
169
62
  ...themeDefinition[key],
@@ -173,50 +66,59 @@ export const useUpdateTheme = (themeName, themeDefinition = {}) => {
173
66
  return theme;
174
67
  };
175
68
 
176
- /**
177
- * Composable that syncs store and URLSearchParameters
178
- */
69
+ /** Composable that syncs store and URLSearchParameters */
179
70
 
180
71
  export const useURLSearchParametersSync = () => {
181
- onMounted(() => {
72
+ onMounted(async () => {
182
73
  // Analyze currently set url params when first loaded and set them in the store
183
- if ('URLSearchParams' in window) {
74
+ if ("URLSearchParams" in window) {
184
75
  const searchParams = new URLSearchParams(window.location.search);
185
- let x, y, z;
186
- searchParams.forEach((value, key) => {
76
+ /** @type {number | undefined} */
77
+ let x,
78
+ /** @type {number | undefined} */
79
+ y,
80
+ /** @type {number | undefined} */
81
+ z;
82
+ searchParams.forEach(async (value, key) => {
187
83
  if (key === "indicator") {
188
- indicator.value = value;
84
+ const { loadSelectedSTAC, stac } = useSTAcStore();
85
+ const match = stac?.find((link) => link.id == value);
86
+ if (match) {
87
+ await loadSelectedSTAC(match.href);
88
+ }
189
89
  }
190
90
  if (key === "x") {
191
- x = value;
91
+ x = Number(value);
192
92
  }
193
93
  if (key === "y") {
194
- y = value;
94
+ y = Number(value);
195
95
  }
196
96
  if (key === "z") {
197
- z = value;
97
+ z = Number(value);
198
98
  }
199
- })
200
- if (x !== undefined && y !== undefined && z !== undefined) {
99
+ });
100
+ if (x && y && z) {
201
101
  mapPosition.value = [x, y, z];
202
102
  }
203
103
  }
204
104
  watch(
205
105
  [indicator, mapPosition],
206
106
  ([updatedIndicator, updatedMapPosition]) => {
207
- if ('URLSearchParams' in window) {
107
+ if ("URLSearchParams" in window) {
208
108
  const searchParams = new URLSearchParams(window.location.search);
209
109
  if (updatedIndicator !== "") {
210
110
  searchParams.set("indicator", updatedIndicator);
211
111
  }
212
112
  if (updatedMapPosition && updatedMapPosition.length === 3) {
213
- searchParams.set("x", updatedMapPosition[0]?.toFixed(4) ?? '');
214
- searchParams.set("y", updatedMapPosition[1]?.toFixed(4) ?? '');
215
- searchParams.set("z", updatedMapPosition[2]?.toFixed(4) ?? '');
113
+ searchParams.set("x", updatedMapPosition[0]?.toFixed(4) ?? "");
114
+ searchParams.set("y", updatedMapPosition[1]?.toFixed(4) ?? "");
115
+ searchParams.set("z", updatedMapPosition[2]?.toFixed(4) ?? "");
216
116
  }
217
- const newRelativePathQuery = window.location.pathname + '?' + searchParams.toString();
218
- history.pushState(null, '', newRelativePathQuery);
117
+ const newRelativePathQuery =
118
+ window.location.pathname + "?" + searchParams.toString();
119
+ history.pushState(null, "", newRelativePathQuery);
219
120
  }
220
- })
121
+ },
122
+ );
221
123
  });
222
124
  };
@@ -2,19 +2,17 @@ import { reactive } from "vue";
2
2
  import { currentUrl } from "./store/States";
3
3
 
4
4
  /**
5
- * Reactive Edoash Instance Object. provided globally in the app,
6
- * and used as an intermediate object to make user defined instances config reactive.
5
+ * Reactive Edoash Instance Object. provided globally in the app, and used as an
6
+ * intermediate object to make user defined instances config reactive.
7
+ *
7
8
  * @type {import("./types").Eodash}
8
9
  */
9
10
  export const eodash = reactive({
10
11
  id: "demo",
11
- stacEndpoint: "https://esa-eodash.github.io/RACE-catalog/RACE/catalog.json",
12
+ stacEndpoint: "https://gtif-cerulean.github.io/catalog/cerulean/catalog.json",
12
13
  brand: {
13
14
  noLayout: true,
14
15
  name: "Demo",
15
- font: {
16
- family: "Roboto",
17
- },
18
16
  theme: {
19
17
  colors: {
20
18
  primary: "#fff",
@@ -36,9 +34,9 @@ export const eodash = reactive({
36
34
  class: "align-self-center justify-self-center",
37
35
  size: "120",
38
36
  speed: "2.5",
39
- color: "#004170"
40
- }
41
- }
37
+ color: "#004170",
38
+ },
39
+ },
42
40
  },
43
41
  background: {
44
42
  id: Symbol(),
@@ -51,45 +49,54 @@ export const eodash = reactive({
51
49
  {
52
50
  id: Symbol(),
53
51
  type: "internal",
54
- title: "itemfilter",
55
- layout: { x: 0, y: 0, w: 3, h: 12 },
52
+ title: "Indicators",
53
+ layout: { x: 0, y: 0, w: 2, h: 12 },
56
54
  widget: {
57
55
  name: "EodashItemFilter",
58
56
  },
59
57
  },
60
58
  {
61
- id: Symbol(),
62
- type: "internal",
63
- title: "datepicker",
64
- layout: { x: 5, y: 11, w: 2, h: 1 },
65
- widget: {
66
- name: "EodashDatePicker",
67
- properties: {
68
- inline: true,
69
- },
59
+ defineWidget: (selectedSTAC) => {
60
+ return selectedSTAC
61
+ ? {
62
+ id: "Information",
63
+ title: "Information",
64
+ layout: { x: 9, y: 0, w: 3, h: 12 },
65
+ type: "web-component",
66
+ widget: {
67
+ link: async () => await import("@eox/stacinfo"),
68
+ properties: {
69
+ for: currentUrl,
70
+ allowHtml: "true",
71
+ styleOverride:
72
+ "#properties li > .value {font-weight: normal !important;}",
73
+ header: "[]",
74
+
75
+ subheader: "[]",
76
+ properties: '["description"]',
77
+ featured: "[]",
78
+ footer: "[]",
79
+ },
80
+ tagName: "eox-stacinfo",
81
+ },
82
+ }
83
+ : null;
70
84
  },
71
85
  },
72
86
  {
73
- id: Symbol(),
74
- title: "Information",
75
- layout: { x: 9, y: 0, w: 3, h: 12 },
76
- widget: {
77
- link: async () => await import("@eox/stacinfo"),
78
- properties: {
79
- for: currentUrl,
80
- allowHtml: "true",
81
- styleOverride:
82
- "#properties li > .value {font-weight: normal !important;}",
83
- header: "[]",
84
-
85
- subheader: "[]",
86
- properties: '["description"]',
87
- featured: "[]",
88
- footer: "[]",
89
- },
90
- tagName: "eox-stacinfo",
87
+ defineWidget: (selectedSTAC) => {
88
+ return selectedSTAC
89
+ ? {
90
+ id: "Datepicker",
91
+ type: "internal",
92
+ layout: { x: 5, y: 10, w: 1, h: 1 },
93
+ title: "Datepicker",
94
+ widget: {
95
+ name: "EodashDatePicker",
96
+ },
97
+ }
98
+ : null;
91
99
  },
92
- type: "web-component",
93
100
  },
94
101
  ],
95
102
  },
@@ -1,2 +1,2 @@
1
- export { createEodash } from '@/composables/DefineEodash';
2
- export { default as store } from "@/store"
1
+ export { createEodash } from "@/composables/DefineEodash";
2
+ export { default as store } from "@/store";
@@ -1,18 +1,20 @@
1
- import vuetify from './vuetify';
2
- import { createPinia } from 'pinia';
3
- import eodash from '@/eodash';
4
- import { eodashKey } from '@/utils/keys';
5
- import store from '../store';
1
+ import vuetify from "./vuetify";
2
+ import { createPinia } from "pinia";
3
+ import eodash from "@/eodash";
4
+ import VCalendar from "v-calendar";
5
+ import { eodashKey } from "@/utils/keys";
6
+ import store from "../store";
6
7
 
7
8
  export const pinia = createPinia();
8
9
 
9
- /**
10
- * @param {import('vue').App} app
11
- */
10
+ /** @param {import("vue").App} app */
12
11
  export function registerPlugins(app) {
13
12
  window.eodashStore = store;
14
13
 
15
- app.use(vuetify)
14
+ app
15
+ .use(vuetify)
16
16
  .use(pinia)
17
+ // Use plugin with optional defaults
18
+ .use(VCalendar, {})
17
19
  .provide(eodashKey, eodash);
18
20
  }
@@ -1,15 +1,14 @@
1
1
  /**
2
- * plugins/vuetify.ts
2
+ * Plugins/vuetify.ts
3
3
  *
4
4
  * Framework documentation: https://vuetifyjs.com`
5
5
  */
6
6
 
7
7
  // Styles
8
- import 'vuetify/styles';
8
+ import "vuetify/styles";
9
9
 
10
-
11
- import { createVuetify } from 'vuetify';
12
- import { mdiChevronLeft, mdiChevronRight, mdiMenuDown } from "@mdi/js"
10
+ import { createVuetify } from "vuetify";
11
+ import { mdiChevronLeft, mdiChevronRight, mdiMenuDown } from "@mdi/js";
13
12
 
14
13
  const vuetify = createVuetify({
15
14
  icons: {
@@ -17,7 +16,7 @@ const vuetify = createVuetify({
17
16
  // mapping v-date-picker and v-tabs default icons to `@mdi/js`
18
17
  next: [mdiChevronRight],
19
18
  prev: [mdiChevronLeft],
20
- subgroup: [mdiMenuDown]
19
+ subgroup: [mdiMenuDown],
21
20
  },
22
21
  },
23
22
  theme: {
@@ -25,12 +24,12 @@ const vuetify = createVuetify({
25
24
  dashboardTheme: {},
26
25
  light: {
27
26
  colors: {
28
- primary: '#1867C0',
29
- secondary: '#5CBBF6',
27
+ primary: "#1867C0",
28
+ secondary: "#5CBBF6",
30
29
  },
31
30
  },
32
31
  },
33
32
  },
34
- })
33
+ });
35
34
 
36
- export default vuetify
35
+ export default vuetify;
@@ -1,13 +1,12 @@
1
- import { registerPlugins } from '@/plugins';
1
+ import { registerPlugins } from "@/plugins";
2
2
  // Components
3
- import App from './App.vue';
3
+ import App from "./App.vue";
4
4
 
5
5
  // Composables
6
- import { createApp } from 'vue';
7
-
6
+ import { createApp } from "vue";
8
7
 
9
8
  const app = createApp(App);
10
9
 
11
10
  registerPlugins(app);
12
11
 
13
- app.mount('#app');
12
+ app.mount("#app");
@@ -1,21 +1,16 @@
1
1
  import { ref } from "vue";
2
2
 
3
- /**
4
- * currently selected STAC endpoint
5
- */
6
- export const currentUrl = ref('');
7
- /**
8
- * currently selected datetime
9
- */
3
+ /** Currently selected STAC endpoint */
4
+ export const currentUrl = ref("");
5
+ /** Currently selected datetime */
10
6
  export const datetime = ref(new Date().toISOString());
11
7
 
12
- /**
13
- * Currently selected indicator
14
- */
15
- export const indicator = ref("")
8
+ /** Currently selected indicator */
9
+ export const indicator = ref("");
16
10
 
17
11
  /**
18
12
  * Current map position
19
- * @type {import("vue").Ref<(number|undefined)[]>}
13
+ *
14
+ * @type {import("vue").Ref<(number | undefined)[]>}
20
15
  */
21
- export const mapPosition = ref([])
16
+ export const mapPosition = ref([]);
@@ -1,17 +1,20 @@
1
1
  //export all actions, states, and pinia stores
2
2
 
3
- const storesImport = import.meta.glob('../store/**.js', { eager: true })
3
+ const storesImport = import.meta.glob("../store/**.js", { eager: true });
4
4
 
5
- const store = /** @type {import("@/types").EodashStore} */((() => {
6
- const stores = {}
7
- for (const [filePath, importedstore] of Object.entries(storesImport)) {
8
- const storeType = filePath.split('/').at(-1)?.slice(0, -3).toLowerCase() ?? ''
9
- if (!['keys'].includes(storeType)) {
10
- //@ts-expect-error
11
- stores[storeType] = importedstore;
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
+ }
12
15
  }
13
- }
14
- return stores;
15
- })());
16
+ return stores;
17
+ })()
18
+ );
16
19
 
17
20
  export default store;
@@ -1,66 +1,80 @@
1
- import { defineStore } from 'pinia';
2
- import { inject, ref } from 'vue';
3
- import axios from 'axios';
4
- import { useAbsoluteUrl } from '@/composables/index';
5
- import { eodashKey } from '@/utils/keys';
6
- import { indicator } from '@/store/States';
1
+ import { defineStore } from "pinia";
2
+ import { inject, ref } from "vue";
3
+ import axios from "axios";
4
+ import { useAbsoluteUrl } from "@/composables/index";
5
+ import { eodashKey } from "@/utils/keys";
6
+ import { indicator } from "@/store/States";
7
7
 
8
- export const useSTAcStore = defineStore('stac', () => {
8
+ export const useSTAcStore = defineStore("stac", () => {
9
9
  /**
10
- * links of the root STAC catalog
11
- * @type {import("vue").Ref<import('stac-ts').StacLink[]|null>}
10
+ * Links of the root STAC catalog
11
+ *
12
+ * @type {import("vue").Ref<import("stac-ts").StacLink[] | null>}
12
13
  */
13
14
  const stac = ref(null);
14
15
 
15
16
  /**
16
- * selected STAC object.
17
- * @type {import('vue').Ref<import('stac-ts').StacCatalog |
18
- * import('stac-ts').StacCollection |import('stac-ts').StacItem
19
- * | null>}
17
+ * Selected STAC object.
18
+ *
19
+ * @type {import("vue").Ref<
20
+ * | import("stac-ts").StacCatalog
21
+ * | import("stac-ts").StacCollection
22
+ * | import("stac-ts").StacItem
23
+ * | null
24
+ * >}
20
25
  */
21
26
  const selectedStac = ref(null);
22
27
 
23
-
24
- const eodash = /** @type {import("@/types").Eodash} */(inject(eodashKey));
28
+ const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
25
29
 
26
30
  /**
27
- * fetches root stac catalog and assign it to `stac`
31
+ * Fetches root stac catalog and assign it to `stac`
32
+ *
28
33
  * @async
29
- * @param {import("@/types").StacEndpoint} [url = eodash.stacEndpoint]
34
+ * @param {import("@/types").StacEndpoint} [url=eodash.stacEndpoint] Default
35
+ * is `eodash.stacEndpoint`
30
36
  * @returns {Promise<void>}
31
37
  * @see {@link stac}
32
38
  */
33
39
  async function loadSTAC(url = eodash.stacEndpoint) {
34
- await axios.get(url).then(resp => {
35
- const links = /** @type {import('stac-ts').StacCatalog} */(resp.data).links.map(link => {
36
- if (!link.title) {
37
- link.title = `${link.rel} ${link.href}`
38
- }
39
- return link
40
+ await axios
41
+ .get(url)
42
+ .then((resp) => {
43
+ const links = /** @type {import("stac-ts").StacCatalog} */ (
44
+ resp.data
45
+ ).links.map((link) => {
46
+ if (!link.title) {
47
+ link.title = `${link.rel} ${link.href}`;
48
+ }
49
+ return link;
50
+ });
51
+ stac.value = links;
40
52
  })
41
- stac.value = links;
42
- }).catch(err => {
43
- throw new Error("error loading assigned STAC endpoint", err)
44
- });
53
+ .catch((err) => {
54
+ throw new Error("error loading assigned STAC endpoint", err);
55
+ });
45
56
  }
46
57
 
47
58
  /**
48
- * fetches selected stac object and assign it to `selectedStac`
59
+ * Fetches selected stac object and assign it to `selectedStac`
60
+ *
49
61
  * @async
50
- * @param {string} relativePath - stac link href
62
+ * @param {string} relativePath - Stac link href
51
63
  * @returns {Promise<void>}
52
64
  * @see {@link selectedStac}
53
65
  */
54
- async function loadSelectedSTAC(relativePath = '') {
55
-
66
+ async function loadSelectedSTAC(relativePath = "") {
56
67
  const absoluteUrl = useAbsoluteUrl(relativePath);
57
68
 
58
- await axios.get(absoluteUrl.value).then(resp => {
59
- selectedStac.value = resp.data;
60
- indicator.value = selectedStac.value?.id ?? "";
61
- }).catch(err => {
62
- throw new Error("error loading the selected STAC", err)
63
- });
69
+ await axios
70
+ .get(absoluteUrl.value)
71
+ .then((resp) => {
72
+ selectedStac.value = resp.data;
73
+ indicator.value = selectedStac.value?.id ?? "";
74
+ })
75
+ .catch((err) => {
76
+ throw new Error("error loading the selected STAC", err);
77
+ });
64
78
  }
65
79
 
66
80
  return { stac, loadSTAC, loadSelectedSTAC, selectedStac };