@eodash/eodash 5.0.0-rc.3 → 5.1.0

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 (155) hide show
  1. package/README.md +1 -0
  2. package/core/client/App.vue +8 -2
  3. package/core/client/asWebComponent.js +5 -5
  4. package/core/client/components/DashboardLayout.vue +42 -25
  5. package/core/client/components/EodashOverlay.vue +1 -1
  6. package/core/client/components/ErrorAlert.vue +2 -2
  7. package/core/client/components/Footer.vue +4 -4
  8. package/core/client/components/Header.vue +3 -3
  9. package/core/client/components/MobileLayout.vue +9 -10
  10. package/core/client/composables/DefineEodash.js +38 -43
  11. package/core/client/composables/DefineTemplate.js +4 -2
  12. package/core/client/composables/DefineWidgets.js +14 -8
  13. package/core/client/composables/index.js +273 -23
  14. package/core/client/eodashSTAC/EodashCollection.js +80 -47
  15. package/core/client/eodashSTAC/helpers.js +136 -27
  16. package/core/client/eodashSTAC/parquet.js +145 -0
  17. package/core/client/eodashSTAC/triggers.js +6 -3
  18. package/core/client/plugins/index.js +4 -3
  19. package/core/client/plugins/vuetify.js +3 -0
  20. package/core/client/store/actions.js +21 -4
  21. package/core/client/store/stac.js +93 -56
  22. package/core/client/store/states.js +15 -5
  23. package/core/client/types.ts +59 -43
  24. package/core/client/utils/index.js +79 -0
  25. package/core/client/utils/keys.js +2 -2
  26. package/core/client/utils/states.js +30 -5
  27. package/core/client/views/Dashboard.vue +36 -32
  28. package/core/client/vite-env.d.ts +7 -0
  29. package/dist/client/{DashboardLayout-t_PavJPO.js → DashboardLayout-ByVs1DrY.js} +23 -12
  30. package/dist/client/{DynamicWebComponent-y07rVJch.js → DynamicWebComponent-C3W7HSQm.js} +1 -1
  31. package/dist/client/{EodashDatePicker-CcOfyzGD.js → EodashDatePicker-BIAf1sMT.js} +59 -32
  32. package/dist/client/{EodashItemFilter-B9HCvIMi.js → EodashItemFilter-DPznh8UB.js} +20 -10
  33. package/dist/client/{EodashLayerControl-KStn7Nb_.js → EodashLayerControl-Bhxjw4V2.js} +29 -16
  34. package/dist/client/EodashLayoutSwitcher-C5qTEffW.js +61 -0
  35. package/dist/client/EodashMapBtns-WoGq8MuV.js +173 -0
  36. package/dist/client/{EodashStacInfo-C_hDy6Pd.js → EodashStacInfo-CSvvF2jI.js} +3 -18
  37. package/dist/client/{EodashTools-BXflvRf8.js → EodashTools-Cv1SXQ5y.js} +13 -13
  38. package/dist/client/{ExportState-C0QRemK1.js → ExportState-D-iuwaad.js} +58 -52
  39. package/dist/client/{Footer-7VGyGUAs.js → Footer-CyF0zRAk.js} +15 -13
  40. package/dist/client/{Header-BQJnXHYq.js → Header-CgD8jDKU.js} +33 -28
  41. package/dist/client/{MobileLayout-b8nQ-Vyl.js → MobileLayout-EKQ_kpSh.js} +69 -60
  42. package/dist/client/{PopUp-DgNrh9Df.js → PopUp-BsYLvWch.js} +19 -10
  43. package/dist/client/ProcessList-C2xsLU2_.js +191 -0
  44. package/dist/client/{VImg-D4eT3IQ1.js → VImg-OHe8YTs2.js} +24 -24
  45. package/dist/client/{VMain-C3hN2-H3.js → VMain-PryTLU4a.js} +7 -7
  46. package/dist/client/{VOverlay-tAeNygaA.js → VOverlay-yUn7p-Uf.js} +64 -27
  47. package/dist/client/{VTooltip-B0Q3iHMZ.js → VTooltip-DZ0fjpB3.js} +13 -10
  48. package/dist/client/{WidgetsContainer-CtDHfCYf.js → WidgetsContainer-B9LBadcC.js} +1 -1
  49. package/dist/client/asWebComponent-By_7_JjS.js +19193 -0
  50. package/dist/client/async-DkSu_u2K.js +740 -0
  51. package/dist/client/eo-dash.js +1 -1
  52. package/dist/client/{forwardRefs-CIFAqXaZ.js → forwardRefs-BXxrv98s.js} +31 -4
  53. package/dist/client/handling-CgmFXkW6.js +1212 -0
  54. package/dist/client/helpers-Dy0Q13tP.js +4534 -0
  55. package/dist/client/{index-DvcUndod.js → index-BuhOHXKv.js} +2 -4
  56. package/dist/client/{index-BQ16n4Sk.js → index-Ch_HchK3.js} +39 -32
  57. package/dist/client/{index-Cv7HBz49.js → index-Dqj4tbx2.js} +2 -2
  58. package/dist/client/index-skjhlH8u.js +376 -0
  59. package/dist/client/{ssrBoot-BP7SYRyC.js → ssrBoot-Zgc_Ttvi.js} +2 -2
  60. package/dist/client/templates.js +850 -0
  61. package/dist/client/transition-C98Yn4Vo.js +40 -0
  62. package/dist/node/cli.js +16 -6
  63. package/dist/node/types.d.ts +1 -1
  64. package/dist/types/core/client/App.vue.d.ts +2 -2
  65. package/dist/types/core/client/asWebComponent.d.ts +1 -1
  66. package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +1 -3
  67. package/dist/types/core/client/components/Footer.vue.d.ts +1 -105
  68. package/dist/types/core/client/components/IframeWrapper.vue.d.ts +1 -1
  69. package/dist/types/core/client/components/MobileLayout.vue.d.ts +1 -324
  70. package/dist/types/core/client/composables/DefineEodash.d.ts +2 -2
  71. package/dist/types/core/client/composables/DefineTemplate.d.ts +1 -1
  72. package/dist/types/core/client/composables/DefineWidgets.d.ts +4 -4
  73. package/dist/types/core/client/composables/index.d.ts +24 -2
  74. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +9 -6
  75. package/dist/types/core/client/eodashSTAC/helpers.d.ts +20 -5
  76. package/dist/types/core/client/eodashSTAC/parquet.d.ts +2 -0
  77. package/dist/types/core/client/plugins/vuetify.d.ts +7 -4
  78. package/dist/types/core/client/store/actions.d.ts +3 -2
  79. package/dist/types/core/client/store/stac.d.ts +16 -13
  80. package/dist/types/core/client/store/states.d.ts +14 -4
  81. package/dist/types/core/client/types.d.ts +45 -30
  82. package/dist/types/core/client/utils/index.d.ts +2 -0
  83. package/dist/types/core/client/utils/keys.d.ts +4 -4
  84. package/dist/types/core/client/utils/states.d.ts +59 -47
  85. package/dist/types/core/client/views/Dashboard.vue.d.ts +2 -2
  86. package/dist/types/templates/baseConfig.d.ts +4 -0
  87. package/dist/types/templates/compare.d.ts +210 -0
  88. package/dist/types/templates/expert.d.ts +151 -0
  89. package/dist/types/templates/index.d.ts +6 -0
  90. package/dist/types/templates/light.d.ts +145 -0
  91. package/dist/types/widgets/EodashDatePicker.vue.d.ts +1 -458
  92. package/dist/types/widgets/EodashItemFilter.vue.d.ts +3 -3
  93. package/dist/types/widgets/EodashLayerControl.vue.d.ts +14 -7
  94. package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +1 -3
  95. package/dist/types/widgets/EodashMap/index.vue.d.ts +1 -4
  96. package/dist/types/widgets/EodashMapBtns.vue.d.ts +8 -8
  97. package/dist/types/widgets/EodashProcess/ProcessList.vue.d.ts +8 -1
  98. package/dist/types/widgets/EodashProcess/index.vue.d.ts +8 -4
  99. package/dist/types/widgets/EodashProcess/methods/async.d.ts +18 -18
  100. package/dist/types/widgets/EodashProcess/methods/composables.d.ts +3 -2
  101. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/index.d.ts +1 -0
  102. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.d.ts +6 -0
  103. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.d.ts +4 -0
  104. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.d.ts +5 -0
  105. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/index.d.ts +1 -0
  106. package/dist/types/widgets/EodashProcess/methods/handling.d.ts +12 -5
  107. package/dist/types/widgets/EodashProcess/methods/outputs.d.ts +72 -41
  108. package/dist/types/widgets/EodashProcess/methods/utils.d.ts +41 -21
  109. package/dist/types/widgets/EodashProcess/states.d.ts +11 -0
  110. package/dist/types/widgets/EodashProcess/types.d.ts +41 -0
  111. package/dist/types/widgets/EodashStacInfo.vue.d.ts +14 -14
  112. package/dist/types/widgets/EodashTools.vue.d.ts +3 -3
  113. package/dist/types/widgets/ExportState.vue.d.ts +1 -1
  114. package/dist/types/widgets/PopUp.vue.d.ts +11 -16
  115. package/dist/types/widgets/WidgetsContainer.vue.d.ts +3 -6
  116. package/package.json +53 -45
  117. package/templates/baseConfig.js +68 -0
  118. package/templates/compare.js +162 -0
  119. package/templates/expert.js +123 -0
  120. package/templates/index.js +8 -0
  121. package/templates/light.js +130 -0
  122. package/widgets/EodashDatePicker.vue +80 -31
  123. package/widgets/EodashItemFilter.vue +26 -11
  124. package/widgets/EodashLayerControl.vue +20 -11
  125. package/widgets/EodashLayoutSwitcher.vue +6 -3
  126. package/widgets/EodashMap/index.vue +3 -8
  127. package/widgets/EodashMap/methods/create-layers-config.js +4 -3
  128. package/widgets/EodashMap/methods/index.js +33 -23
  129. package/widgets/EodashMapBtns.vue +83 -41
  130. package/widgets/EodashProcess/ProcessList.vue +34 -10
  131. package/widgets/EodashProcess/index.vue +55 -20
  132. package/widgets/EodashProcess/methods/async.js +77 -59
  133. package/widgets/EodashProcess/methods/composables.js +21 -14
  134. package/widgets/EodashProcess/methods/custom-endpoints/chart/index.js +35 -0
  135. package/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.js +275 -0
  136. package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +116 -0
  137. package/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.js +94 -0
  138. package/widgets/EodashProcess/methods/custom-endpoints/layers/index.js +33 -0
  139. package/widgets/EodashProcess/methods/handling.js +127 -80
  140. package/widgets/EodashProcess/methods/outputs.js +376 -125
  141. package/widgets/EodashProcess/methods/utils.js +398 -10
  142. package/widgets/EodashProcess/states.js +13 -0
  143. package/widgets/EodashProcess/types.ts +46 -0
  144. package/widgets/EodashStacInfo.vue +2 -17
  145. package/widgets/EodashTools.vue +13 -13
  146. package/widgets/WidgetsContainer.vue +1 -1
  147. package/core/client/eodash.js +0 -454
  148. package/dist/client/EodashLayoutSwitcher-DqeFO3RN.js +0 -52
  149. package/dist/client/EodashMapBtns-5BF27qJB.js +0 -131
  150. package/dist/client/ProcessList-C62SOVO6.js +0 -484
  151. package/dist/client/asWebComponent-BJ2NWunV.js +0 -12479
  152. package/dist/client/eo-dash.css +0 -5
  153. package/dist/client/index-Da5xXX6Q.js +0 -780
  154. package/dist/client/transition-Cdb4K27U.js +0 -37
  155. package/dist/types/core/client/eodash.d.ts +0 -8
package/README.md CHANGED
@@ -43,6 +43,7 @@ npm run build -- --lib
43
43
  .
44
44
  ├── core # CLI & Client source code
45
45
  ├── docs # Documentation files
46
+ ├── templates # Base configurations and eodash templates
46
47
  ├── tests # CLI & Client component tests folder
47
48
  ├── widgets # Vue components as internal widgets.
48
49
  ├── public # Statically served directory
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-app>
2
+ <v-app class="fill-height">
3
3
  <Suspense>
4
4
  <Dashboard :is-web-component="isWebComponent" :config="config" />
5
5
 
@@ -13,11 +13,12 @@
13
13
  <script setup>
14
14
  import Dashboard from "@/views/Dashboard.vue";
15
15
  import ErrorAlert from "./components/ErrorAlert.vue";
16
+ import { provideEodashInstance, useAdoptStyles } from "@/composables";
16
17
  import { onErrorCaptured, ref } from "vue";
17
18
 
18
19
  defineProps({
19
20
  config: {
20
- type: String,
21
+ type: [String, Function],
21
22
  required: false,
22
23
  default: undefined,
23
24
  },
@@ -35,4 +36,9 @@ onErrorCaptured((e, inst, info) => {
35
36
  info: ${info}.
36
37
  `;
37
38
  });
39
+ provideEodashInstance();
40
+ if (isWebComponent) {
41
+ // Adopt styles into the shadowRoot when running as web component
42
+ useAdoptStyles();
43
+ }
38
44
  </script>
@@ -5,17 +5,17 @@ import { registerPlugins } from "./plugins";
5
5
  * @type {import("vue").VueElementConstructor<
6
6
  * import("vue").ExtractPropTypes<{ config: string }>>}
7
7
  * */
8
- export const EodashConstructor = defineCustomElement(App, {
9
- shadowRoot: false,
8
+ const EodashConstructor = defineCustomElement(App, {
9
+ //styles will be imported here using vite-plugin-vue-custom-element-style-injector
10
+ shadowRoot: !import.meta.env.DEV,
10
11
  configureApp(app) {
11
12
  registerPlugins(app);
12
13
  },
13
14
  });
14
-
15
- export function register() {
15
+ function register() {
16
16
  customElements.define("eo-dash", EodashConstructor);
17
17
  }
18
18
 
19
19
  export { default as store } from "@/store";
20
-
20
+ export { register, EodashConstructor };
21
21
  register();
@@ -1,10 +1,15 @@
1
1
  <template>
2
2
  <v-main>
3
- <eox-layout :gap="gap" :style="`padding: ${gap}px`">
3
+ <eox-layout
4
+ :mediaBreakpoints="[0, 960, 1920]"
5
+ :gap="gap"
6
+ class="layout-container"
7
+ :style="layoutStyle"
8
+ >
4
9
  <eox-layout-item
5
10
  v-if="bgWidget?.component"
6
11
  :key="bgWidget.id"
7
- class="bg-panel bg-surface"
12
+ class="bg-panel"
8
13
  :style="`margin: -${gap + 1}px;`"
9
14
  x="0"
10
15
  y="0"
@@ -25,18 +30,20 @@
25
30
  :id="importedWidget.value.id.toString()"
26
31
  v-if="importedWidget.value.component"
27
32
  :key="importedWidget.value.id"
28
- class="panel bg-surface"
33
+ class="panel"
29
34
  :h="importedWidget.value.layout.h"
30
35
  :w="importedWidget.value.layout.w"
31
36
  :x="importedWidget.value.layout.x"
32
37
  :y="importedWidget.value.layout.y"
33
38
  >
34
39
  <Suspense>
35
- <component
36
- :key="importedWidget.value.id"
37
- :is="importedWidget.value.component"
38
- v-bind="importedWidget.value.props"
39
- />
40
+ <div class="bg-surface pointer">
41
+ <component
42
+ :key="importedWidget.value.id"
43
+ :is="importedWidget.value.component"
44
+ v-bind="importedWidget.value.props"
45
+ />
46
+ </div>
40
47
  </Suspense>
41
48
  </eox-layout-item>
42
49
  </Transition>
@@ -49,12 +56,22 @@ import "@eox/layout";
49
56
  import { useDefineTemplate } from "@/composables/DefineTemplate";
50
57
 
51
58
  const { bgWidget, importedWidgets, gap } = useDefineTemplate();
59
+
60
+ const layoutStyle = {
61
+ padding: gap.value + "px",
62
+ overflow: "hidden !important",
63
+ };
52
64
  </script>
53
65
  <style scoped>
54
66
  .panel {
55
67
  position: relative;
56
- overflow: visible;
68
+ overflow: auto;
57
69
  z-index: 1;
70
+ pointer-events: none;
71
+ }
72
+
73
+ .pointer {
74
+ pointer-events: all;
58
75
  }
59
76
 
60
77
  .bg-panel {
@@ -71,30 +88,30 @@ const { bgWidget, importedWidgets, gap } = useDefineTemplate();
71
88
  .fade-leave-to {
72
89
  opacity: 0;
73
90
  }
74
- :deep(.bg-surface) {
75
- backdrop-filter: blur(9.5px) !important;
91
+ .bg-surface,
92
+ .bg-primary {
93
+ backdrop-filter: blur(10px) !important;
94
+ border-radius: 8px;
95
+ border: none;
96
+ box-shadow:
97
+ 0px 0px 1px rgba(24, 39, 75, 0.22),
98
+ 0px 6px 12px -6px rgba(24, 39, 75, 0.12),
99
+ 0px 8px 24px -4px rgba(24, 39, 75, 0.08);
100
+ max-height: 100%;
101
+ overflow: auto;
102
+ scrollbar-color: rgba(var(--v-theme-on-surface), 0.2) transparent;
103
+ scrollbar-width: thin;
104
+ }
105
+ .bg-surface {
76
106
  background-color: rgba(
77
107
  var(--v-theme-surface),
78
108
  var(--v-surface-opacity, 0.8)
79
109
  ) !important;
80
- border-radius: 4px;
81
- border-style: solid;
82
- border-width: 1px;
83
- border-color: rgb(var(--v-theme-surface));
84
- scrollbar-color: rgba(var(--v-theme-on-surface), 0.2) transparent;
85
- scrollbar-width: thin;
86
110
  }
87
- :deep(.bg-primary) {
88
- backdrop-filter: blur(9.5px) !important;
111
+ .bg-primary {
89
112
  background-color: rgba(
90
113
  var(--v-theme-primary),
91
114
  var(--v-primary-opacity, 0.8)
92
115
  ) !important;
93
- border-radius: 4px;
94
- border-style: solid;
95
- border-width: 1px;
96
- border-color: rgb(var(--v-theme-primary));
97
- scrollbar-color: rgba(var(--v-theme-on-primary), 0.2) transparent;
98
- scrollbar-width: thin;
99
116
  }
100
117
  </style>
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
  </template>
14
14
  <script setup>
15
- import { useTheme } from "vuetify/lib/framework.mjs";
15
+ import { useTheme } from "vuetify";
16
16
  import pkgJson from "../../../package.json";
17
17
  const { computedThemes } = useTheme();
18
18
 
@@ -25,9 +25,9 @@ import { mdiClose, mdiAlertCircle } from "@mdi/js";
25
25
  import { inject } from "vue";
26
26
 
27
27
  const error = defineModel({ type: String, required: true });
28
- const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
28
+ const eodash = inject(eodashKey);
29
29
  const errorMessage =
30
- eodash.brand.errorMessage ?? "something went wrong, please try again later";
30
+ eodash?.brand?.errorMessage ?? "something went wrong, please try again later";
31
31
  </script>
32
32
  <style scoped>
33
33
  .alert {
@@ -7,7 +7,7 @@
7
7
  class="d-flex justify-end"
8
8
  >
9
9
  <p class="pt-0 footer-text">
10
- {{ eodash.brand.footerText ?? "" }}
10
+ {{ eodash?.brand.footerText ?? "" }}
11
11
  </p>
12
12
  </v-footer>
13
13
  </template>
@@ -15,17 +15,17 @@
15
15
  import { eodashKey } from "@/utils/keys";
16
16
  import { ref } from "vue";
17
17
  import { inject } from "vue";
18
- import { useDisplay } from "vuetify/lib/framework.mjs";
18
+ import { useDisplay } from "vuetify";
19
19
 
20
20
  /**
21
21
  * Footer template ref
22
22
  *
23
23
  * @type {import("vue").Ref<
24
- * import("vuetify/lib/components/index.mjs").VFooter | null
24
+ * import("vuetify/components").VFooter | null
25
25
  * >}
26
26
  */
27
27
  const footer = ref(null);
28
- const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
28
+ const eodash = inject(eodashKey);
29
29
 
30
30
  const { mdAndDown } = useDisplay();
31
31
  </script>
@@ -1,16 +1,16 @@
1
1
  <template>
2
2
  <v-app-bar color="primary">
3
3
  <v-app-bar-title class="header">{{ title }}</v-app-bar-title>
4
- <v-img class="mx-12 logo" :src="eodash.brand?.logo" />
4
+ <v-img class="mx-12 logo" :src="eodash?.brand?.logo" />
5
5
  </v-app-bar>
6
6
  </template>
7
7
  <script setup>
8
8
  import { eodashKey } from "@/utils/keys";
9
9
  import { inject } from "vue";
10
10
 
11
- const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
11
+ const eodash = inject(eodashKey);
12
12
 
13
- const title = eodash.brand?.name;
13
+ const title = eodash?.brand?.name;
14
14
  </script>
15
15
  <style scoped>
16
16
  .logo {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-main class="overflow-hidden main">
2
+ <v-main class="overflow-hidden">
3
3
  <Suspense suspensible>
4
4
  <component
5
5
  id="bg-widget"
@@ -23,7 +23,10 @@
23
23
  >
24
24
  </div>
25
25
  <Suspense suspensible>
26
- <div class="component-container" v-show="activeIdx === idx">
26
+ <div
27
+ class="d-flex flex-column justify-center component-container"
28
+ v-show="activeIdx === idx"
29
+ >
27
30
  <component
28
31
  :key="importedWidget.value.id"
29
32
  :is="importedWidget.value.component"
@@ -70,22 +73,18 @@ onMounted(() => {
70
73
  mainRectTopPx.value = mainRect.value.top + "px";
71
74
  mainRectBtmPx.value = (mainRect.value.bottom || 48) + "px";
72
75
  tabsHeightFromBtm.value =
73
- mainRect.value.bottom + (tabs.value?.$el?.clientHeight ?? 0) + "px";
76
+ mainRect.value.bottom + (tabs.value?.$el?.clientHeight ?? 48) + "px";
74
77
  });
75
78
  </script>
76
79
  <style scoped>
77
- .main {
78
- height: 91dvh;
79
- }
80
-
81
80
  .panel {
82
- top: v-bind("mainRectTopPx");
83
81
  bottom: v-bind("tabsHeightFromBtm");
82
+ top: v-bind("mainRectTopPx");
84
83
  position: absolute;
85
84
  overflow: hidden;
86
85
  width: 100%;
87
86
  left: 0;
88
- z-index: 1;
87
+ z-index: 3;
89
88
  }
90
89
 
91
90
  .component-container {
@@ -103,7 +102,7 @@ onMounted(() => {
103
102
  z-index: 10;
104
103
  }
105
104
  :deep(.bg-surface) {
106
- backdrop-filter: blur(9.5px) !important;
105
+ backdrop-filter: blur(10px) !important;
107
106
  background-color: rgba(
108
107
  var(--v-theme-surface),
109
108
  var(--v-surface-opacity, 0.8)
@@ -1,72 +1,67 @@
1
1
  import store from "@/store";
2
2
  import { eodashKey } from "@/utils/keys";
3
- import { inject } from "vue";
3
+ import { inject, reactive } from "vue";
4
4
 
5
5
  /**
6
6
  * Handles importing user defined instance of Eodash
7
7
  *
8
8
  * @async
9
- * @param {string | undefined} runtimeConfig
10
- * @returns {Promise<import("@/types").Eodash>}
9
+ * @param {string | undefined| (()=> Promise<import("@/types").Eodash>) | Function} runtimeConfig
10
+ * @returns {Promise<import("@/types").Eodash | null | undefined>}
11
11
  * @see {@linkplain '@/eodash.js'}
12
12
  */
13
13
  export const useEodashRuntime = async (runtimeConfig) => {
14
+ let eodashConfig;
14
15
  const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
15
- /** @param {import("@/types").Eodash} config */
16
- const assignInstance = (config) => {
17
- if ("template" in config) {
18
- //@ts-expect-error to do
19
- delete eodash.templates;
20
- //@ts-expect-error to do
21
- eodash.template = config.template;
22
- } else if ("templates" in config) {
23
- //@ts-expect-error to do
24
- delete eodash.template;
25
- //@ts-expect-error to do
26
- eodash.templates = config.templates;
27
- }
28
- /** @type {(keyof import("@/types").Eodash)[]} */ (
29
- Object.keys(eodash)
30
- ).forEach((key) => {
31
- //@ts-expect-error to do
32
- eodash[key] = config[key];
33
- });
34
- };
35
16
 
36
17
  if (runtimeConfig) {
37
- assignInstance(
38
- (
39
- await import(
40
- /* @vite-ignore */ new URL(runtimeConfig, import.meta.url).href
41
- )
42
- ).default,
43
- );
44
- return eodash;
18
+ eodashConfig =
19
+ typeof runtimeConfig === "function"
20
+ ? await runtimeConfig()
21
+ : await import(
22
+ /* @vite-ignore */ new URL(runtimeConfig, import.meta.url).href
23
+ ).then(async (m) => await m["default"]);
24
+ if (!eodashConfig) {
25
+ throw new Error(
26
+ "No dashboard configuration defined in the runtime config:" +
27
+ runtimeConfig,
28
+ );
29
+ }
30
+ Object.assign(eodash, eodashConfig);
31
+ return reactive(eodashConfig);
45
32
  }
46
33
 
34
+ async function importUserConfig() {
35
+ /* global __userConfigExist__:readonly */
36
+ // injected by vite
37
+ if (__userConfigExist__) {
38
+ return import("user:config").then(async (m) => await m["default"]);
39
+ }
40
+ }
47
41
  try {
48
42
  const configJs = "/config.js";
49
- assignInstance(
50
- (await import(/* @vite-ignore */ new URL(configJs, import.meta.url).href))
51
- .default,
52
- );
43
+ eodashConfig = await import(
44
+ /* @vite-ignore */ new URL(configJs, import.meta.url).href
45
+ ).then(async (m) => await m["default"]);
46
+ if (!eodashConfig) {
47
+ eodashConfig = await importUserConfig();
48
+ }
53
49
  } catch {
54
50
  try {
55
- assignInstance(
56
- await import("user:config").then(async (m) => await m["default"]),
57
- );
51
+ eodashConfig = await importUserConfig();
58
52
  } catch {
59
53
  console.error("no dashboard configuration defined");
54
+ eodashConfig = null;
60
55
  }
61
56
  }
62
- return eodash;
57
+ Object.assign(eodash, eodashConfig);
58
+ return reactive(eodash);
63
59
  };
64
60
 
65
61
  /**
66
- * @param {((
67
- * store: typeof import("@/store").default,
68
- * ) => (Promise<import("@/types").Eodash> | import("@/types").Eodash))
69
- * | import("@/types").Eodash} config
62
+ * @template {import("@/types").Eodash} T
63
+ * @param {T | ((store: typeof import("@/store").default) => Promise<T>)} config
64
+ * @returns {Promise<T>}
70
65
  */
71
66
  export const createEodash = async (config) => {
72
67
  if (config instanceof Function) {
@@ -15,7 +15,7 @@ import log from "loglevel";
15
15
  **/
16
16
 
17
17
  const useTemplate = () => {
18
- const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
18
+ const eodash = inject(eodashKey);
19
19
 
20
20
  /** @type {DefinedTemplate} */
21
21
  const definedTemplate = shallowReactive({
@@ -24,7 +24,9 @@ const useTemplate = () => {
24
24
  loading: shallowRef(null),
25
25
  gap: ref(16),
26
26
  });
27
-
27
+ if (!eodash) {
28
+ return definedTemplate;
29
+ }
28
30
  if ("template" in eodash) {
29
31
  [definedTemplate.bgWidget] = useDefineWidgets([eodash.template.background]);
30
32
  [definedTemplate.loading] = useDefineWidgets([eodash.template.loading]);
@@ -8,7 +8,7 @@ import { storeToRefs } from "pinia";
8
8
  * props: Record<string, unknown>;
9
9
  * title: string;
10
10
  * id: string | number | symbol;
11
- * layout: { x: number; y: number; h: number; w: number };
11
+ * layout: { x: number | string; y: number | string; h: number | string; w: number | string };
12
12
  * }} DefinedWidget
13
13
  */
14
14
 
@@ -69,19 +69,19 @@ export const useDefineWidgets = (widgetConfigs) => {
69
69
  });
70
70
 
71
71
  if ("defineWidget" in (config ?? {})) {
72
- const { selectedStac } = storeToRefs(useSTAcStore());
72
+ const { selectedStac, selectedCompareStac } = storeToRefs(useSTAcStore());
73
73
  watch(
74
- selectedStac,
75
- (updatedStac) => {
74
+ [selectedStac, selectedCompareStac],
75
+ ([updatedStac, updatedCompareStac]) => {
76
76
  let definedConfig =
77
77
  /** @type {import("@/types").FunctionalWidget} */ (
78
78
  config
79
- )?.defineWidget(updatedStac);
79
+ )?.defineWidget(updatedStac, updatedCompareStac);
80
80
  if (definedConfig) {
81
81
  definedConfig = reactive(definedConfig);
82
82
  }
83
83
  definedWidget.value =
84
- definedWidget.value.id === definedConfig?.id
84
+ definedConfig && definedWidget.value.id === definedConfig.id
85
85
  ? definedWidget.value
86
86
  : getWidgetDefinition(definedConfig);
87
87
  },
@@ -103,7 +103,9 @@ export const useDefineWidgets = (widgetConfigs) => {
103
103
  * @param {import("@/types").StaticWidget
104
104
  * | Omit<import("@/types").StaticWidget, "layout">
105
105
  * | undefined
106
- * | null} [config]
106
+ * | null
107
+ * | false
108
+ * } [config]
107
109
  * @returns {DefinedWidget}
108
110
  */
109
111
  const getWidgetDefinition = (config) => {
@@ -115,7 +117,11 @@ const getWidgetDefinition = (config) => {
115
117
  id: Symbol(),
116
118
  layout: reactive({ x: 0, y: 0, h: 0, w: 0 }),
117
119
  };
118
- switch (config?.type) {
120
+ if (!config) {
121
+ return importedWidget;
122
+ }
123
+
124
+ switch (config.type) {
119
125
  case "internal":
120
126
  importedWidget.component = defineAsyncComponent({
121
127
  loader: () => {