@eodash/eodash 5.0.0-alpha.2 → 5.0.0-alpha.2.3

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -1
  3. package/bin/serverConfig.js +1 -1
  4. package/bin/types.d.ts +1 -0
  5. package/bin/utils.js +1 -1
  6. package/core/App.vue +12 -4
  7. package/core/SuspensedDashboard.ce.vue +21 -7
  8. package/core/components/DashboardLayout.vue +12 -30
  9. package/core/components/ErrorAlert.vue +19 -0
  10. package/core/components/Loading.vue +12 -1
  11. package/core/components/MobileLayout.vue +19 -11
  12. package/core/composables/DefineWidgets.js +11 -5
  13. package/core/composables/index.js +16 -13
  14. package/core/eodash.js +0 -2
  15. package/core/plugins/vuetify.js +9 -3
  16. package/core/store/stac.js +6 -2
  17. package/core/types.d.ts +11 -24
  18. package/core/views/Dashboard.vue +14 -3
  19. package/dist/DashboardLayout-lzEvtalW.js +148 -0
  20. package/dist/{DynamicWebComponent-BDOQsEcj.js → DynamicWebComponent-CgDh2csQ.js} +12 -12
  21. package/dist/EodashDatePicker-bIyNUYaG.js +1653 -0
  22. package/dist/{EodashItemFilter-TSp7XRGy.js → EodashItemFilter-CpgyrJRX.js} +2 -2
  23. package/dist/{EodashMap-DInb9cfS.js → EodashMap-CyR-Ldpk.js} +4 -4
  24. package/dist/Footer-C2sIHSym.js +118 -0
  25. package/dist/{Header-C5PSB8Uc.js → Header-DFz2BUnp.js} +224 -228
  26. package/dist/{IframeWrapper-DYHQQRUh.js → IframeWrapper-Csep3rMg.js} +1 -1
  27. package/dist/MobileLayout-CXNJL_q6.js +984 -0
  28. package/dist/VMain-COrg6UtF.js +39 -0
  29. package/dist/{WidgetsContainer-D_PLP1qf.js → WidgetsContainer-XA6_dKOm.js} +18 -18
  30. package/dist/asWebComponent-fqvymeM-.js +13092 -0
  31. package/dist/{decoder-kAoyGIq9-HAkjSTCt.js → decoder-kAoyGIq9-DjQanfeo.js} +1 -1
  32. package/dist/eo-dash.js +2 -2
  33. package/dist/{index-8ch8xKfa.js → index-Cskxla5D.js} +76 -44
  34. package/dist/index-Zv5eTiB6.js +34 -0
  35. package/dist/{lerc-C9VL9kri-DyVxBvsf.js → lerc-C9VL9kri-O4muG-MO.js} +1 -1
  36. package/dist/{ssrBoot-Cm5pWM14.js → ssrBoot-DCCAW5xY.js} +3 -3
  37. package/dist/style.css +2 -2
  38. package/package.json +3 -3
  39. package/widgets/EodashDatePicker.vue +1 -0
  40. package/widgets/WidgetsContainer.vue +7 -5
  41. package/dist/DashboardLayout-YLfAa8wH.js +0 -168
  42. package/dist/EodashDatePicker-DlehqSgz.js +0 -1645
  43. package/dist/Footer-CIzHgJbK.js +0 -118
  44. package/dist/MobileLayout-DZmqrpub.js +0 -523
  45. package/dist/VBtn-CFPhsIX8.js +0 -1106
  46. package/dist/VMain-deI9jyIf.js +0 -35
  47. package/dist/asWebComponent-BKe6Spni.js +0 -11323
  48. package/dist/color-D72nEBIR.js +0 -115
  49. package/dist/dimensions-BZkmIizV.js +0 -53
  50. package/dist/index-DIt8GjSR.js +0 -65
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 EOX IT Services GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -18,9 +18,19 @@ npm run preview
18
18
 
19
19
  ## Folder Structure
20
20
  .
21
- ├── core # Main source code that hosts the microfrontends and renders the dashboard
21
+ ├── bin # CLI source code
22
+ ├── core # Client source code that hosts the microfrontends and renders the dashboard
22
23
  ├── docs # Documentation files
24
+ ├── tests # CLI and component tests folder
23
25
  ├── widgets # Vue componenets as internal widgets.
24
26
  ├── public # Statically served directory
25
27
  └── README.md
26
28
 
29
+
30
+ ## Writing commits
31
+ To ensure clear communication with the package consumers and enable machine-readable commits, we adhere to [The Conventional Commits](https://www.conventionalcommits.org/) specification that allows the generation of [semVer](https://semver.org) releases and associated change logs using [googleapis/release-please](https://github.com/googleapis/release-please).
32
+
33
+ The most important prefixes you should have in mind are:
34
+ * fix: which represents bug fixes, and correlates to a SemVer patch.
35
+ * feat: which represents a new feature, and correlates to a SemVer minor.
36
+ * feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
@@ -29,7 +29,7 @@ export const indexHtml = `
29
29
  </head>
30
30
 
31
31
  <body>
32
- ${userConfig.lib ? `<eo-dash/>
32
+ ${userConfig.lib ? `<eo-dash style="height:100dvh;"/>
33
33
  <script type="module" src="${path.resolve(`/@fs/${appPath}`, `core/asWebComponent.js`)}"></script>
34
34
  `: ` <div id="app"/>
35
35
  <script type="module" src="${path.resolve(`/@fs/${appPath}`, `core/render.js`)}"></script>
package/bin/types.d.ts CHANGED
@@ -40,6 +40,7 @@ export interface EodashConfig {
40
40
  * File exporting eodash client runtime config
41
41
  */
42
42
  runtime?: string
43
+ /** set a custom path for importing user defined internal widgets */
43
44
  widgets?: string
44
45
  /** builds eodash as a web component library */
45
46
  lib?: boolean
package/bin/utils.js CHANGED
@@ -63,7 +63,7 @@ export const appPath = fileURLToPath(new URL("..", import.meta.url)),
63
63
  cachePath = userConfig.cacheDir ? path.resolve(rootPath, userConfig.cacheDir) : path.join(dotEodashPath, 'cache');
64
64
 
65
65
 
66
- export const logger = createLogger()
66
+ export const logger = createLogger(undefined, { prefix: '[eodash]' })
67
67
 
68
68
  /**
69
69
  * @param {Options} options
package/core/App.vue CHANGED
@@ -1,19 +1,27 @@
1
1
  <template>
2
2
  <v-app>
3
3
  <Suspense>
4
- <!-- main content -->
4
+
5
5
  <Dashboard />
6
6
 
7
- <!-- loading state -->
8
7
  <template #fallback>
9
- <Loading />
8
+ <ErrorAlert v-model="error" />
10
9
  </template>
11
10
  </Suspense>
12
11
  </v-app>
13
12
  </template>
14
13
 
15
14
  <script setup>
16
- import Loading from '@/components/Loading.vue';
17
15
  import Dashboard from '@/views/Dashboard.vue';
16
+ import ErrorAlert from './components/ErrorAlert.vue';
17
+ import { onErrorCaptured, ref } from 'vue';
18
18
 
19
+ const error = ref('')
20
+ onErrorCaptured((e, inst, info) => {
21
+ error.value = `
22
+ ${e}.
23
+ component: ${inst?.$.type.name}.
24
+ info: ${info}.
25
+ `
26
+ })
19
27
  </script>
@@ -2,20 +2,19 @@
2
2
  <v-app>
3
3
  <Suspense>
4
4
  <Dashboard :on-template-mount="setStylesFromHead" :config="config" />
5
+
5
6
  <template #fallback>
6
- <div style="height: 100dvh; display: flex; align-items: center; justify-content: center;">
7
- <Loading />
8
- </div>
7
+ <ErrorAlert @vue:mounted="setStylesFromHead()" v-model="error" />
9
8
  </template>
10
9
  </Suspense>
11
10
  </v-app>
12
11
  </template>
13
12
  <script setup>
14
13
  import Dashboard from '@/views/Dashboard.vue';
15
- import { createApp, getCurrentInstance } from "vue"
14
+ import { createApp, getCurrentInstance, onErrorCaptured, ref } from "vue"
16
15
  import { registerPlugins } from '@/plugins';
17
16
  import { eodashKey } from '@/utils/keys';
18
- import Loading from '@/components/Loading.vue';
17
+ import ErrorAlert from '@/components/ErrorAlert.vue';
19
18
 
20
19
  defineProps({
21
20
  config: {
@@ -43,7 +42,7 @@ function setStylesFromHead() {
43
42
  return
44
43
  }
45
44
 
46
- if (child.tagName == 'LINK' && child.getAttribute('rel') === 'stylesheet') {
45
+ if (child.tagName == 'LINK' && child.getAttribute('rel')?.includes('stylesheet')) {
47
46
  eodashComponent?.shadowRoot?.appendChild(child.cloneNode(true))
48
47
  }
49
48
  });
@@ -52,8 +51,23 @@ function setStylesFromHead() {
52
51
  font-family:${
53
52
  //@ts-expect-error
54
53
  /** @type {import("@/types").Eodash} */ (inst.provides[eodashKey])?.brand.font?.family ?? 'Roboto'}
55
- }`
54
+ }
55
+ ${//@ts-expect-error
56
+ /** @type {import("@/types").Eodash} */ (inst.provides[eodashKey]).brand.noLayout ?
57
+ `div.v-application__wrap {
58
+ min-height: fit-content;
59
+ }`: ""}
60
+ `
56
61
  styleSheet.replaceSync(stylesStr.replaceAll(":root", ":host"))
57
62
  eodashComponent?.shadowRoot?.adoptedStyleSheets.push(styleSheet)
58
63
  }
64
+
65
+ const error = ref('')
66
+ onErrorCaptured((e, comp, info) => {
67
+ error.value = `
68
+ ${e}.
69
+ component: ${comp?.$.type.name}.
70
+ info: ${info}.
71
+ `
72
+ })
59
73
  </script>
@@ -1,31 +1,22 @@
1
1
  <template>
2
2
  <v-main>
3
3
  <eox-layout :gap="eodash.template.gap ?? 2">
4
- <eox-layout-item style="z-index: 0;" x="0" y="0" h="12" w="12">
5
- <Suspense>
4
+ <eox-layout-item v-if="bgWidget.component" style="z-index: 0;" x="0" y="0" h="12" w="12">
5
+ <Suspense suspensible>
6
6
  <component id="bg-widget" :is="bgWidget.component" v-bind="bgWidget.props" />
7
- <template #fallback>
8
- <Loading />
9
- </template>
10
7
  </Suspense>
11
8
  </eox-layout-item>
12
- <eox-layout-item v-for="(config, idx) in widgetsConfig" ref="itemEls" :key="idx"
13
- style="position: relative; overflow: visible; z-index: 1; border-radius: 0px; background: rgb(var(--v-theme-surface))"
14
- :x="config.layout.x" :y="config.layout.y" :h="config.layout.h" :w="config.layout.w">
9
+ <template v-for="(config, idx) in widgetsConfig" :key="idx">
10
+ <eox-layout-item v-if="importedWidgets[idx].value.component"
11
+ style="position: relative; overflow: visible; z-index: 1; border-radius: 0px; background: rgb(var(--v-theme-surface))"
12
+ :x="config.layout.x" :y="config.layout.y" :h="config.layout.h" :w="config.layout.w">
15
13
 
16
- <v-btn v-if="slideBtns[idx].enabled" position="absolute" variant="tonal" :style="slideBtns[idx].style"
17
- class="slide-btn" @click="slideInOut(idx)">
18
- <v-icon :icon="slideBtns[idx].active ? slideBtns[idx].icon.in : slideBtns[idx].icon.out" />
19
- </v-btn>
20
- <Suspense>
21
- <component :key="importedWidgets[idx].value.id" :is="importedWidgets[idx].value.component"
22
- v-bind="importedWidgets[idx].value.props" />
23
- <template #fallback>
24
- <Loading />
25
- </template>
26
- </Suspense>
27
-
28
- </eox-layout-item>
14
+ <Suspense suspensible>
15
+ <component :key="importedWidgets[idx].value.id" :is="importedWidgets[idx].value.component"
16
+ v-bind="importedWidgets[idx].value.props" />
17
+ </Suspense>
18
+ </eox-layout-item>
19
+ </template>
29
20
  </eox-layout>
30
21
  </v-main>
31
22
  </template>
@@ -33,8 +24,6 @@
33
24
  import { eodashKey } from '@/utils/keys';
34
25
  import { inject } from 'vue';
35
26
  import { useDefineWidgets } from '@/composables/DefineWidgets'
36
- import { useSlidePanels } from '@/composables'
37
- import { ref } from 'vue';
38
27
  import '@eox/layout'
39
28
 
40
29
  const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey))
@@ -44,11 +33,4 @@ const [bgWidget] = useDefineWidgets([eodash.template?.background])
44
33
  const widgetsConfig = eodash.template?.widgets
45
34
 
46
35
  const importedWidgets = useDefineWidgets(widgetsConfig)
47
- /**
48
- * Layout items template ref
49
- * @type {import('vue').Ref<HTMLElement[]>}
50
- */
51
- const itemEls = ref([])
52
-
53
- const { slideBtns, slideInOut } = useSlidePanels(itemEls, widgetsConfig)
54
36
  </script>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <v-alert v-if="error" translate="yes" location="start bottom" type="error" position="fixed" @click:close="error = ''"
3
+ variant="elevated" :icon="[mdiAlertCircle]" style="z-index: 10000;" closable :close-icon="[mdiClose]">
4
+ {{ errorMessage }}
5
+ <details is="animated-details">
6
+ <summary> Error </summary>
7
+ {{ error }}
8
+ </details>
9
+ </v-alert>
10
+ </template>
11
+ <script setup>
12
+ import { eodashKey } from "@/utils/keys";
13
+ import { mdiClose, mdiAlertCircle } from "@mdi/js"
14
+ import { inject } from "vue";
15
+
16
+ const error = defineModel({ type: String, required: true })
17
+ const eodash = /** @type {import("@/types").Eodash} */(inject(eodashKey))
18
+ const errorMessage = eodash.brand.errorMessage ?? 'something went wrong, please try again later'
19
+ </script>
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <v-row class="d-flex justify-center align-center ">
3
3
  <v-col class="flex-column justify-center align-center">
4
+ <ErrorAlert v-model="error" />
4
5
  <Suspense>
5
6
  <component v-if="loading.component" :is="loading.component" v-bind="loading.props"></component>
6
7
  <div v-else class="text-center">
@@ -16,12 +17,22 @@
16
17
  </v-row>
17
18
  </template>
18
19
  <script setup>
19
- import { inject } from 'vue';
20
+ import { inject, onErrorCaptured, ref } from 'vue';
20
21
  import { eodashKey } from '@/utils/keys';
21
22
  import { useDefineWidgets } from '@/composables/DefineWidgets';
23
+ import ErrorAlert from './ErrorAlert.vue';
22
24
 
23
25
  const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey))
24
26
 
25
27
  const [loading] = useDefineWidgets([eodash.template.loading])
26
28
 
29
+ const error = ref('')
30
+ onErrorCaptured((e, inst, info) => {
31
+ error.value = `
32
+ ${e}.
33
+ component: ${inst?.$.type.name}.
34
+ info: ${info}.
35
+ `
36
+ })
37
+
27
38
  </script>
@@ -1,24 +1,32 @@
1
1
  <template>
2
2
  <v-main class="overflow-hidden" style="height: 91dvh;">
3
+ <Suspense suspensible>
4
+ <component id="bg-widget" v-if="bgWidget.component" :is="bgWidget.component" v-bind="bgWidget.props"></component>
5
+ </Suspense>
3
6
 
4
- <component id="bg-widget" :is="bgWidget.component" v-bind="bgWidget.props"></component>
5
-
6
- <div v-show="activeIdx === idx" id="overlay" class="pa-2" v-for="(importedWidget, idx) in importedWidgets"
7
- :key="idx" :style="{
7
+ <template v-for="(importedWidget, idx) in importedWidgets" :key="idx">
8
+ <div v-if="importedWidget.value.component" v-show="activeIdx === idx" id="overlay" class="pa-2" :style="{
8
9
  bottom: tabsHeightFromBtm, position: 'absolute', overflow: 'hidden',
9
10
  width: '100%', left: 0, top: mainRect.top + 'px', zIndex: 1, background: 'rgb(var(--v-theme-surface))'
10
11
  }">
11
- <v-btn icon variant="text" style="height: 5%;position: relative;" @click="activeIdx = -1">&#x2715;</v-btn>
12
- <component style="height: 94% !important;" :key="importedWidget.value.id" :is="importedWidget.value.component"
13
- v-show="activeIdx === idx" v-bind="importedWidget.value.props" />
14
- </div>
12
+ <v-btn icon variant="text" style="height: 5%;position: relative;" @click="activeIdx = -1">&#x2715;</v-btn>
13
+ <Suspense suspensible>
14
+ <div style="height: 90% !important;" v-show="activeIdx === idx">
15
+ <component :key="importedWidget.value.id" :is="importedWidget.value.component"
16
+ v-bind="importedWidget.value.props" />
17
+ </div>
18
+ </Suspense>
19
+ </div>
20
+ </template>
15
21
 
16
22
  <v-tabs ref="tabs" align-tabs="center" bg-color="surface"
17
23
  :style="{ position: 'relative', bottom: (mainRect.bottom || 48) + 'px', zIndex: 10 }" show-arrows
18
24
  v-model="activeIdx">
19
- <v-tab v-for="(importedWidget, idx) in importedWidgets" :key="idx" :value="idx">
20
- {{ importedWidget.value.title }}
21
- </v-tab>
25
+ <template v-for="(importedWidget, idx) in importedWidgets" :key="idx">
26
+ <v-tab v-if="importedWidget.value.component" :value="idx">
27
+ {{ importedWidget.value.title }}
28
+ </v-tab>
29
+ </template>
22
30
  </v-tabs>
23
31
 
24
32
  </v-main>
@@ -60,9 +60,11 @@ export const useDefineWidgets = (widgetConfigs) => {
60
60
  if ('defineWidget' in (config ?? {})) {
61
61
  const { selectedStac } = storeToRefs(useSTAcStore())
62
62
  watch(selectedStac, (updatedStac) => {
63
- const definedConfig = reactive(/** @type {import("@/types").FunctionalWidget} */
64
- (config)?.defineWidget(updatedStac))
65
- definedWidget.value = definedWidget.value.id === definedConfig.id ?
63
+ let definedConfig = /** @type {import("@/types").FunctionalWidget} */(config)?.defineWidget(updatedStac)
64
+ if (definedConfig) {
65
+ definedConfig = reactive(definedConfig)
66
+ }
67
+ definedWidget.value = definedWidget.value.id === definedConfig?.id ?
66
68
  definedWidget.value : getWidgetDefinition(definedConfig);
67
69
  }, { immediate: true })
68
70
  } else {
@@ -76,7 +78,7 @@ export const useDefineWidgets = (widgetConfigs) => {
76
78
 
77
79
  /**
78
80
  * Converts a static widget configuration to a defined imported widget
79
- * @param {import("@/types").StaticWidget| Omit<import("@/types").StaticWidget, "layout">| undefined} config
81
+ * @param {import("@/types").StaticWidget| Omit<import("@/types").StaticWidget, "layout">| undefined | null} config
80
82
  * @returns {DefinedWidget}
81
83
  **/
82
84
  const getWidgetDefinition = (config) => {
@@ -119,7 +121,11 @@ const getWidgetDefinition = (config) => {
119
121
  break;
120
122
 
121
123
  default:
122
- console.error('Widget type not found')
124
+ if (!config) {
125
+ return importedWidget
126
+ } else {
127
+ console.error('Widget type not found')
128
+ }
123
129
  break;
124
130
  }
125
131
  importedWidget.title = config?.title ?? ''
@@ -6,6 +6,7 @@ import { currentUrl, indicator, mapPosition } from "@/store/States";
6
6
  import eodash from "@/eodash";
7
7
  import { useTheme } from "vuetify/lib/framework.mjs";
8
8
  import { onMounted, watch } from "vue";
9
+ import { mdiChevronDoubleDown, mdiChevronDoubleLeft, mdiChevronDoubleRight, mdiChevronDoubleUp } from "@mdi/js"
9
10
 
10
11
  /**
11
12
  * Creates an absolute URL from a relative link and assignes it to `currentUrl`
@@ -56,41 +57,43 @@ export const useSlidePanels = (elements, configs) => {
56
57
  /**
57
58
  * Array of sliding button's style and icons
58
59
  */
59
- const slideBtns = slideDirs.map((dir, idx) => {
60
+ const slideBtns = slideDirs.map((dir, _idx) => {
60
61
  const btn = reactive({
61
62
  style: {},
62
63
  icon: { in: "", out: "" },
63
64
  active: false,
64
65
  enabled: true,
65
66
  });
66
- if (configs[idx].slidable === false) {
67
- btn.enabled = false;
68
- return btn;
69
- }
67
+
68
+ // temp removal of `slidable` from the widgets API
69
+ // if (configs[idx].slidable === false) {
70
+ // btn.enabled = false;
71
+ // return btn;
72
+ // }
70
73
 
71
74
  switch (dir) {
72
75
  case "left":
73
76
  btn.style = { top: "50%", right: "-11%" };
74
- btn.icon.in = "mdi-chevron-double-right";
75
- btn.icon.out = "mdi-chevron-double-left";
77
+ btn.icon.in = mdiChevronDoubleRight
78
+ btn.icon.out = mdiChevronDoubleLeft
76
79
 
77
80
  break;
78
81
  case "right":
79
82
  btn.style = { top: "50%", left: "-11%" };
80
- btn.icon.in = "mdi-chevron-double-left";
81
- btn.icon.out = "mdi-chevron-double-right";
83
+ btn.icon.in = mdiChevronDoubleLeft
84
+ btn.icon.out = mdiChevronDoubleRight
82
85
 
83
86
  break;
84
87
  case "up":
85
88
  btn.style = { right: "50%", bottom: "-17%" };
86
- btn.icon.in = "mdi-chevron-double-down";
87
- btn.icon.out = "mdi-chevron-double-up";
89
+ btn.icon.in = mdiChevronDoubleDown
90
+ btn.icon.out = mdiChevronDoubleUp
88
91
 
89
92
  break;
90
93
  case "down":
91
94
  btn.style = { right: "50%", top: "-17%" };
92
- btn.icon.in = "mdi-chevron-double-up";
93
- btn.icon.out = "mdi-chevron-double-down";
95
+ btn.icon.in = mdiChevronDoubleUp
96
+ btn.icon.out = mdiChevronDoubleDown
94
97
  break;
95
98
 
96
99
  default:
package/core/eodash.js CHANGED
@@ -53,7 +53,6 @@ export const eodash = reactive({
53
53
  type: "internal",
54
54
  title: "itemfilter",
55
55
  layout: { x: 0, y: 0, w: 3, h: 12 },
56
- slidable: false,
57
56
  widget: {
58
57
  name: "EodashItemFilter",
59
58
  },
@@ -63,7 +62,6 @@ export const eodash = reactive({
63
62
  type: "internal",
64
63
  title: "datepicker",
65
64
  layout: { x: 5, y: 11, w: 2, h: 1 },
66
- slidable: false,
67
65
  widget: {
68
66
  name: "EodashDatePicker",
69
67
  properties: {
@@ -5,15 +5,21 @@
5
5
  */
6
6
 
7
7
  // Styles
8
- import '@mdi/font/css/materialdesignicons.css';
9
8
  import 'vuetify/styles';
10
9
 
11
10
 
12
11
  import { createVuetify } from 'vuetify';
13
- // import {} from "vuetify"
12
+ import { mdiChevronLeft, mdiChevronRight, mdiMenuDown } from "@mdi/js"
14
13
 
15
- // https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides
16
14
  const vuetify = createVuetify({
15
+ icons: {
16
+ aliases: {
17
+ // remapping v-date-picker and v-tabs default icons to `@mdi/js`
18
+ next: [mdiChevronRight],
19
+ prev: [mdiChevronLeft],
20
+ subgroup: [mdiMenuDown]
21
+ },
22
+ },
17
23
  theme: {
18
24
  themes: {
19
25
  dashboardTheme: {},
@@ -39,7 +39,9 @@ export const useSTAcStore = defineStore('stac', () => {
39
39
  return link
40
40
  })
41
41
  stac.value = links;
42
- }).catch(err => console.error(err));
42
+ }).catch(err => {
43
+ throw new Error("error loading assigned STAC endpoint", err)
44
+ });
43
45
  }
44
46
 
45
47
  /**
@@ -56,7 +58,9 @@ export const useSTAcStore = defineStore('stac', () => {
56
58
  await axios.get(absoluteUrl.value).then(resp => {
57
59
  selectedStac.value = resp.data;
58
60
  indicator.value = selectedStac.value?.id ?? "";
59
- }).catch(err => console.error(err));
61
+ }).catch(err => {
62
+ throw new Error("error loading the selected STAC", err)
63
+ });
60
64
  }
61
65
 
62
66
  return { stac, loadSTAC, loadSelectedSTAC, selectedStac };
package/core/types.d.ts CHANGED
@@ -23,7 +23,7 @@ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
23
23
  constructorProp?: string
24
24
  tagName: `${string}-${string}`
25
25
  /** Object defining all the properties and attributes of the web component */
26
- properties?: Record<string, any>
26
+ properties?: Record<string, unknown>
27
27
  /**
28
28
  * Triggered when the web component is mounted in the DOM.
29
29
  * @param el - web component
@@ -41,7 +41,7 @@ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
41
41
 
42
42
  /** @ignore */
43
43
  export interface WidgetsContainerProps {
44
- widgets: Omit<Widget, 'layout' | 'slidable'>[]
44
+ widgets: Omit<Widget, 'layout'>[]
45
45
  }
46
46
 
47
47
  // eodash types:
@@ -73,10 +73,6 @@ export interface WebComponentWidget<T extends ExecutionTime = "compiletime"> {
73
73
  */
74
74
  h: number
75
75
  },
76
- /**
77
- * Enable/Disable widget sliding.
78
- */
79
- slidable?: boolean
80
76
  widget: WebComponentProps<T>
81
77
  type: 'web-component'
82
78
  }
@@ -110,10 +106,6 @@ export interface InternalComponentWidget {
110
106
  */
111
107
  h: number
112
108
  }
113
- /**
114
- * Enable/Disable widget sliding.
115
- */
116
- slidable?: boolean
117
109
  widget: {
118
110
  /**
119
111
  * Internal Vue Components inside the [widgets](https://github.com/eodash/eodash/tree/main/widgets) folder. Referenced
@@ -159,10 +151,6 @@ export interface IFrameWidget {
159
151
  */
160
152
  h: number
161
153
  }
162
- /**
163
- * Enable/Disable widget sliding.
164
- */
165
- slidable?: boolean;
166
154
  widget: {
167
155
  /**
168
156
  * The URL of the page to embed
@@ -176,13 +164,13 @@ export interface IFrameWidget {
176
164
  */
177
165
  export interface FunctionalWidget<T extends ExecutionTime = "compiletime"> {
178
166
  /**
179
- * Provides a functional definition of the widget,
180
- * gets triggered whenever a STAC object is selected.
167
+ * Provides a functional definition of widgets,
168
+ * gets triggered whenever a STAC object is selected, and only renders the returned configuration
169
+ * if the `id` doesn't match the currently rendered `id`
181
170
  * @param selectedSTAC - Currently selected STAC object
182
171
  */
183
172
  defineWidget: (selectedSTAC: import("stac-ts").StacCatalog |
184
- import("stac-ts").StacCollection | import("stac-ts").StacItem
185
- | null) => Omit<StaticWidget<T>, 'layout' | 'slidable'>
173
+ import("stac-ts").StacCollection | import("stac-ts").StacItem | null) => Omit<StaticWidget<T>, 'layout' | 'slidable'> | undefined | null
186
174
  layout: {
187
175
  /**
188
176
  * Horizontal start position. Integer between 1 and 12
@@ -201,10 +189,6 @@ export interface FunctionalWidget<T extends ExecutionTime = "compiletime"> {
201
189
  */
202
190
  h: number
203
191
  }
204
- /**
205
- * Enable/Disable widget sliding.
206
- */
207
- slidable?: boolean
208
192
  }
209
193
  /**
210
194
  * @group Eodash
@@ -275,6 +259,8 @@ export interface Eodash<T extends ExecutionTime = "compiletime"> {
275
259
  brand: {
276
260
  /** Removes the dashboard layout */
277
261
  noLayout?: boolean
262
+ /** custom error message to alert the users if something crashes */
263
+ errorMessage?: string
278
264
  /**
279
265
  * Automatically fetches the specified font family from google fonts. if the [link](#font-link) property is specified
280
266
  * the font family will be fetched from the provided source instead.
@@ -348,8 +334,9 @@ export interface EodashStore {
348
334
  * the project's entry point should export this function as a default
349
335
  * to instantiate eodash
350
336
  * @group Eodash
351
- * @param configCallback
337
+ * @param config
352
338
  */
353
- export declare const createEodash: typeof import("./composables/DefineEodash").createEodash
339
+ export declare const createEodash: (config: ((store: EodashStore) => Eodash | Promise<Eodash>) | Eodash) => Eodash | Promise<Eodash>
340
+
354
341
  /** @group EodashStore */
355
342
  export declare const store: EodashStore
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <HeaderComponent v-if="!eodash.brand.noLayout" />
3
+ <ErrorAlert v-model="error" />
3
4
  <Suspense>
4
5
  <TemplateComponent @vue:mounted="onTemplateMount?.()"
5
- :style="`height: ${eodash.brand.noLayout ? '90dvh' : 'calc(100dvh - ' + mainRect['top'] + mainRect['bottom'] + 'px)'}`" />
6
+ :style="`height: ${eodash.brand.noLayout ? (onTemplateMount ? '100%' : '90dvh') : 'calc(100dvh - ' + mainRect['top'] + mainRect['bottom'] + 'px)'}`" />
6
7
  <template #fallback>
7
- <div v-if="onTemplateMount" style="height: 100dvh; display: flex; align-items: center; justify-content: center;">
8
+ <div style="height: 100dvh; display: flex; align-items: center; justify-content: center;">
8
9
  <Loading />
9
10
  </div>
10
11
  </template>
@@ -16,10 +17,11 @@
16
17
  import { useEodashRuntime } from "@/composables/DefineEodash";
17
18
  import { useURLSearchParametersSync, useUpdateTheme } from "@/composables";
18
19
  import { useSTAcStore } from '@/store/stac';
19
- import { defineAsyncComponent, onMounted } from "vue";
20
+ import { defineAsyncComponent, onErrorCaptured, onMounted, ref } from "vue";
20
21
  import { useDisplay, useLayout } from "vuetify/lib/framework.mjs";
21
22
  import { loadFont } from '@/utils'
22
23
  import Loading from "@/components/Loading.vue";
24
+ import ErrorAlert from "@/components/ErrorAlert.vue";
23
25
 
24
26
  const props = defineProps({
25
27
  config: {
@@ -56,4 +58,13 @@ onMounted(() => {
56
58
  htmlTag.style.overflow = 'hidden';
57
59
  })
58
60
 
61
+ const error = ref('')
62
+ onErrorCaptured((e, comp, info) => {
63
+ error.value = `
64
+ error: ${e}.
65
+ component: ${comp?.$.type.name}.
66
+ info: ${info}.
67
+ `
68
+ })
69
+
59
70
  </script>