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

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 (91) hide show
  1. package/README.md +14 -5
  2. package/core/{SuspensedDashboard.ce.vue → client/SuspensedDashboard.ce.vue} +30 -16
  3. package/core/client/components/DashboardLayout.vue +59 -0
  4. package/core/{components → client/components}/ErrorAlert.vue +6 -1
  5. package/core/{components → client/components}/Footer.vue +6 -1
  6. package/core/{components → client/components}/Header.vue +6 -1
  7. package/core/{components → client/components}/IframeWrapper.vue +1 -1
  8. package/core/{components → client/components}/MobileLayout.vue +41 -10
  9. package/core/{composables → client/composables}/DefineEodash.js +2 -1
  10. package/core/{composables → client/composables}/DefineWidgets.js +14 -8
  11. package/core/{composables → client/composables}/index.js +18 -119
  12. package/core/{eodash.js → client/eodash.js} +38 -36
  13. package/core/{plugins → client/plugins}/index.js +3 -0
  14. package/core/{plugins → client/plugins}/vuetify.js +1 -1
  15. package/core/{types.d.ts → client/types.d.ts} +42 -85
  16. package/core/{utils → client/utils}/eodashSTAC.js +29 -25
  17. package/core/client/utils/index.js +32 -0
  18. package/core/{views → client/views}/Dashboard.vue +39 -10
  19. package/dist/client/DashboardLayout-BYROtP-7.js +156 -0
  20. package/dist/{DynamicWebComponent-CgDh2csQ.js → client/DynamicWebComponent-BQhxFPM0.js} +6 -6
  21. package/dist/client/EodashDatePicker-CFltnt5d.js +1194 -0
  22. package/dist/client/EodashItemFilter-DIBDAHcc.js +65 -0
  23. package/dist/{EodashMap-CyR-Ldpk.js → client/EodashMap-C6jJ2Lb_.js} +14337 -15676
  24. package/dist/client/Footer-BVIZms1S.js +115 -0
  25. package/dist/client/Header-TsTL1d2R.js +633 -0
  26. package/dist/{IframeWrapper-Csep3rMg.js → client/IframeWrapper-XKChM78a.js} +4 -4
  27. package/dist/client/MobileLayout-BlGcMQra.js +957 -0
  28. package/dist/{VMain-COrg6UtF.js → client/VMain-C9XV5Lyg.js} +8 -8
  29. package/dist/{WidgetsContainer-XA6_dKOm.js → client/WidgetsContainer-BQXHnZpa.js} +8 -8
  30. package/dist/client/asWebComponent-CbdGxelK.js +20188 -0
  31. package/dist/{decoder-kAoyGIq9-DjQanfeo.js → client/decoder-HRvnjnEI-CHAYOWhz.js} +1 -1
  32. package/dist/client/eo-dash.js +6 -0
  33. package/dist/{eox-map-BJ9SIixs.js → client/eox-map-C3DL31fp.js} +1882 -1809
  34. package/dist/client/eox-stacinfo-l7ALSV90.js +13969 -0
  35. package/dist/client/forwardRefs-CyCJOFsz.js +192 -0
  36. package/dist/client/http-ZWiLaAeR.js +1337 -0
  37. package/dist/{index-Cskxla5D.js → client/index-CabQjjQg.js} +43 -74
  38. package/dist/{lerc-C9VL9kri-O4muG-MO.js → client/lerc-_E46UbWQ-TxBH4OeK.js} +1 -1
  39. package/dist/{ssrBoot-DCCAW5xY.js → client/ssrBoot-DWJ-z4I-.js} +3 -3
  40. package/dist/{style.css → client/style.css} +2 -2
  41. package/dist/client/transition-BlLt41wg.js +34 -0
  42. package/dist/node/cli.js +20 -0
  43. package/dist/node/main.js +2 -0
  44. package/{bin → dist/node}/types.d.ts +2 -2
  45. package/package.json +22 -21
  46. package/widgets/EodashDatePicker.vue +89 -36
  47. package/widgets/EodashItemFilter.vue +30 -14
  48. package/bin/app.js +0 -22
  49. package/bin/cli.js +0 -62
  50. package/bin/main.js +0 -9
  51. package/bin/serverConfig.js +0 -165
  52. package/bin/utils.js +0 -103
  53. package/core/components/DashboardLayout.vue +0 -36
  54. package/core/utils/index.js +0 -28
  55. package/dist/DashboardLayout-lzEvtalW.js +0 -148
  56. package/dist/EodashDatePicker-bIyNUYaG.js +0 -1653
  57. package/dist/EodashItemFilter-CpgyrJRX.js +0 -51
  58. package/dist/Footer-C2sIHSym.js +0 -118
  59. package/dist/Header-DFz2BUnp.js +0 -605
  60. package/dist/MobileLayout-CXNJL_q6.js +0 -984
  61. package/dist/asWebComponent-fqvymeM-.js +0 -13092
  62. package/dist/eo-dash.js +0 -6
  63. package/dist/eox-stacinfo-B-YrT7Ug.js +0 -13698
  64. package/dist/forwardRefs-Bxeu9Obx.js +0 -142
  65. package/dist/index-Zv5eTiB6.js +0 -34
  66. /package/core/{App.vue → client/App.vue} +0 -0
  67. /package/core/{asWebComponent.d.ts → client/asWebComponent.d.ts} +0 -0
  68. /package/core/{asWebComponent.js → client/asWebComponent.js} +0 -0
  69. /package/core/{components → client/components}/DynamicWebComponent.vue +0 -0
  70. /package/core/{components → client/components}/Loading.vue +0 -0
  71. /package/core/{main.js → client/main.js} +0 -0
  72. /package/core/{render.js → client/render.js} +0 -0
  73. /package/core/{store → client/store}/Actions.js +0 -0
  74. /package/core/{store → client/store}/States.js +0 -0
  75. /package/core/{store → client/store}/index.js +0 -0
  76. /package/core/{store → client/store}/stac.js +0 -0
  77. /package/core/{utils → client/utils}/helpers.js +0 -0
  78. /package/core/{utils → client/utils}/keys.js +0 -0
  79. /package/core/{vite-env.d.ts → client/vite-env.d.ts} +0 -0
  80. /package/dist/{.gitkeep → client/.gitkeep} +0 -0
  81. /package/dist/{_commonjsHelpers-DaMA6jEr.js → client/_commonjsHelpers-DaMA6jEr.js} +0 -0
  82. /package/dist/{basedecoder-Qm25PwVp-CHo5Pomv.js → client/basedecoder-Qm25PwVp-CHo5Pomv.js} +0 -0
  83. /package/dist/{deflate-Be2Arps5-hDqMz3RA.js → client/deflate-Be2Arps5-hDqMz3RA.js} +0 -0
  84. /package/dist/{eox-itemfilter-DcQkRD2l.js → client/eox-itemfilter-DcQkRD2l.js} +0 -0
  85. /package/dist/{jpeg-DNfUpLwy-Fjan-04T.js → client/jpeg-DNfUpLwy-Fjan-04T.js} +0 -0
  86. /package/dist/{lzw-BOMhmEDy-Dboc93VO.js → client/lzw-BOMhmEDy-Dboc93VO.js} +0 -0
  87. /package/dist/{packbits-DaUD6MLm-Bu1PoTGa.js → client/packbits-DaUD6MLm-Bu1PoTGa.js} +0 -0
  88. /package/dist/{pako.esm-C3kYPGGQ-BMki8cQY.js → client/pako.esm-C3kYPGGQ-BMki8cQY.js} +0 -0
  89. /package/dist/{raw-CcGKjn8q-DFOt-i8n.js → client/raw-CcGKjn8q-DFOt-i8n.js} +0 -0
  90. /package/dist/{webfontloader-CyOFAuFB.js → client/webfontloader-CyOFAuFB.js} +0 -0
  91. /package/dist/{webimage-D2c098k3-DLj1LQxB.js → client/webimage-D2c098k3-DLj1LQxB.js} +0 -0
package/README.md CHANGED
@@ -1,13 +1,19 @@
1
+ # @eodash/eodash [![Version](https://badgen.net/npm/v/@eodash/eodash)](https://www.npmjs.com/package/@eodash/eodash)
2
+
3
+ A package for creating earth observation dashboards. To learn more about eodash ecosystem visit [eodash.org](https://eodash.org)
4
+ ## Usage
5
+ Checkout the [documentation](https://eodash.github.io/eodash/get-started.html) for a detailed guide.
6
+
1
7
  ## Get Started
2
8
  Install all the required dependecies after cloning or downloading the repository using Node v18 or higher:
3
9
  ```bash
4
10
  npm run install
5
11
  ```
6
- Run the dev server and the app will open your default browser window to the landing page:
12
+ Run the dev server:
7
13
  ```bash
8
14
  npm run dev
9
15
  ```
10
- To compile and minify for production:
16
+ To compile and minify a demo instance:
11
17
  ```bash
12
18
  npm run build
13
19
  ```
@@ -15,13 +21,16 @@ To preview the compiled production files :
15
21
  ```bash
16
22
  npm run preview
17
23
  ```
24
+ To compile and minify a demo instance as a web component library:
25
+ ```bash
26
+ npm run build -- --lib
27
+ ```
18
28
 
19
29
  ## Folder Structure
20
30
  .
21
- ├── bin # CLI source code
22
- ├── core # Client source code that hosts the microfrontends and renders the dashboard
31
+ ├── core # CLI & Client source code
23
32
  ├── docs # Documentation files
24
- ├── tests # CLI and component tests folder
33
+ ├── tests # CLI & Client component tests folder
25
34
  ├── widgets # Vue componenets as internal widgets.
26
35
  ├── public # Statically served directory
27
36
  └── README.md
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-app>
2
+ <v-app ref="vAppRef">
3
3
  <Suspense>
4
4
  <Dashboard :on-template-mount="setStylesFromHead" :config="config" />
5
5
 
@@ -20,7 +20,10 @@ defineProps({
20
20
  config: {
21
21
  type: String,
22
22
  }
23
- })
23
+ });
24
+
25
+ /** @type { import("vue").Ref<import("vuetify/components").VApp| null > } */
26
+ const vAppRef = ref(null)
24
27
  const app = createApp({})
25
28
  registerPlugins(app)
26
29
 
@@ -30,8 +33,9 @@ Object.assign(inst.appContext, app._context)
30
33
  //@ts-expect-error
31
34
  Object.assign(inst.provides, app._context.provides)
32
35
 
33
- function setStylesFromHead() {
34
- const eodashComponent = document.querySelector('eo-dash')
36
+ /** @param {import("vue").Ref<HTMLElement | import("vue").ComponentPublicInstance>[]} [hiddenElements] */
37
+ function setStylesFromHead(hiddenElements) {
38
+ const eodashShadowRoot = vAppRef.value?.$el.getRootNode()
35
39
  const styleSheet = new CSSStyleSheet()
36
40
  const head = document.querySelector('head')
37
41
  let stylesStr = ''
@@ -43,23 +47,33 @@ function setStylesFromHead() {
43
47
  }
44
48
 
45
49
  if (child.tagName == 'LINK' && child.getAttribute('rel')?.includes('stylesheet')) {
46
- eodashComponent?.shadowRoot?.appendChild(child.cloneNode(true))
50
+ eodashShadowRoot?.appendChild(child.cloneNode(true))
47
51
  }
48
52
  });
49
53
 
50
- stylesStr += `\n * {
51
- font-family:${
52
- //@ts-expect-error
53
- /** @type {import("@/types").Eodash} */ (inst.provides[eodashKey])?.brand.font?.family ?? 'Roboto'}
54
- }
55
- ${//@ts-expect-error
56
- /** @type {import("@/types").Eodash} */ (inst.provides[eodashKey]).brand.noLayout ?
54
+ stylesStr += `\n
55
+ ${//@ts-expect-error
56
+ /** @type {import("@/types").Eodash} */ (inst.provides[eodashKey]).brand.noLayout ?
57
57
  `div.v-application__wrap {
58
- min-height: fit-content;
59
- }`: ""}
60
- `
58
+ min-height: fit-content;
59
+ }`: ""}
60
+ `
61
61
  styleSheet.replaceSync(stylesStr.replaceAll(":root", ":host"))
62
- eodashComponent?.shadowRoot?.adoptedStyleSheets.push(styleSheet)
62
+ eodashShadowRoot?.adoptedStyleSheets.push(styleSheet);
63
+
64
+ //@ts-expect-error
65
+ if (hiddenElements && !(/** @type {import("@/types").Eodash} */ (inst.provides[eodashKey])?.brand.noLayout)) {
66
+ hiddenElements.forEach(element => {
67
+ if (element.value) {
68
+ if (element.value instanceof HTMLElement) {
69
+ element.value.style.opacity = "1"
70
+ } else {
71
+ /** @type {HTMLElement} */
72
+ (element.value.$el).style.opacity = "1"
73
+ }
74
+ }
75
+ })
76
+ }
63
77
  }
64
78
 
65
79
  const error = ref('')
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <v-main>
3
+ <eox-layout :gap="eodash.template.gap ?? 2">
4
+ <eox-layout-item v-if="bgWidget.component" class="bg-panel" x="0" y="0" h="12" w="12">
5
+ <Suspense suspensible>
6
+ <component id="bg-widget" :is="bgWidget.component" v-bind="bgWidget.props" />
7
+ </Suspense>
8
+ </eox-layout-item>
9
+ <template v-for="(importedWidget, idx) in importedWidgets" :key="idx">
10
+ <Transition name="fade">
11
+ <eox-layout-item v-if="importedWidget.value.component" :key="importedWidget.value.id" class="panel"
12
+ :h="importedWidget.value.layout.h" :w="importedWidget.value.layout.w" :x="importedWidget.value.layout.x"
13
+ :y="importedWidget.value.layout.y">
14
+ <Suspense suspensible>
15
+ <component :key="importedWidget.value.id" :is="importedWidget.value.component"
16
+ v-bind="importedWidget.value.props" />
17
+ </Suspense>
18
+ </eox-layout-item>
19
+ </Transition>
20
+ </template>
21
+ </eox-layout>
22
+ </v-main>
23
+ </template>
24
+ <script setup>
25
+ import { eodashKey } from '@/utils/keys';
26
+ import { inject } from 'vue';
27
+ import { useDefineWidgets } from '@/composables/DefineWidgets'
28
+ import '@eox/layout'
29
+
30
+ const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey))
31
+
32
+ const [bgWidget] = useDefineWidgets([eodash.template?.background])
33
+
34
+ const importedWidgets = useDefineWidgets(eodash.template?.widgets)
35
+ </script>
36
+ <style scoped>
37
+ .panel {
38
+ position: relative;
39
+ overflow: visible;
40
+ z-index: 1;
41
+ border-radius: 0px;
42
+ background: rgb(var(--v-theme-surface))
43
+ }
44
+
45
+ .bg-panel {
46
+ z-index: 0;
47
+
48
+ }
49
+
50
+ .fade-enter-active,
51
+ .fade-leave-active {
52
+ transition: opacity 0.25s ease;
53
+ }
54
+
55
+ .fade-enter-from,
56
+ .fade-leave-to {
57
+ opacity: 0;
58
+ }
59
+ </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
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]">
3
+ variant="elevated" :icon="[mdiAlertCircle]" class="alert" closable :close-icon="[mdiClose]">
4
4
  {{ errorMessage }}
5
5
  <details is="animated-details">
6
6
  <summary> Error </summary>
@@ -17,3 +17,8 @@ const error = defineModel({ type: String, required: true })
17
17
  const eodash = /** @type {import("@/types").Eodash} */(inject(eodashKey))
18
18
  const errorMessage = eodash.brand.errorMessage ?? 'something went wrong, please try again later'
19
19
  </script>
20
+ <style scoped>
21
+ .alert {
22
+ z-index: 10000;
23
+ }
24
+ </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <v-footer ref="footer" :height="mdAndDown ? '48px' : 'auto'" color="secondary" app
3
3
  class="d-flex justify-space-between">
4
- <p class="pt-0" style="font-size: 0.8rem;">
4
+ <p class="pt-0 footer-text">
5
5
  {{ eodash.brand.footerText ?? "" }}
6
6
  </p>
7
7
  <div>
@@ -29,3 +29,8 @@ const { mdAndDown } = useDisplay()
29
29
  const eoxLogo = `<svg width="100%" height="100%" viewBox="0 0 355 85" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><g id="ink_ext_XXXXXX"><path id="path5076" d="M152.986,40.52l-0.75,-0.019l-0.737,-0.056l-0.725,-0.093l-0.713,-0.127l-0.7,-0.162l-0.7,-0.196l-0.675,-0.228l-0.65,-0.261l-0.65,-0.292l-0.625,-0.319l-0.612,-0.352l-0.588,-0.377l-0.562,-0.407l-0.55,-0.431l-0.538,-0.457l-0.5,-0.481l-0.487,-0.505l-0.45,-0.528l-0.438,-0.55l-0.4,-0.57l-0.375,-0.59l-0.35,-0.609l-0.325,-0.627l-0.287,-0.645l-0.263,-0.66l-0.225,-0.676l-0.2,-0.69l-0.162,-0.704l-0.125,-0.717l-0.1,-0.728l-0.05,-0.739l-0.025,-0.748c0,-8.023 6.512,-14.532 14.537,-14.532c8.038,0 14.538,6.509 14.538,14.532c0,8.036 -6.5,14.544 -14.538,14.544Z" style="fill:none;"/><path id="path5078" d="M165.748,-0.002c-42.009,0 -76.06,18.985 -76.06,42.402c0,13.268 10.921,25.102 28.021,32.875c-8.081,-5.487 -13.403,-12.973 -14.584,-21.859c-2.685,-20.186 16.83,-40.82 45.148,-49.615c-14.687,6.665 -24.923,21.427 -24.923,38.599c0,23.218 18.648,42.046 41.773,42.383c-0.037,0.005 -0.087,0.015 -0.137,0.02c0.263,0 0.512,0.009 0.762,0.009c42.013,0 76.076,-18.984 76.076,-42.412c0,-13.261 -10.937,-25.097 -28.037,-32.871l0.75,0.522l0.736,0.531l0.713,0.543l0.7,0.555l0.687,0.566l0.664,0.578l0.649,0.588l0.625,0.6l0.613,0.609l0.588,0.621l0.574,0.631l0.562,0.643l0.538,0.652l0.513,0.662l0.5,0.672l0.475,0.684l0.449,0.693l0.438,0.703l0.425,0.713l0.387,0.723l0.375,0.73l0.352,0.74l0.336,0.75l0.3,0.76l0.287,0.77l0.264,0.777l0.25,0.787l0.211,0.795l0.188,0.805l0.175,0.812l0.151,0.82l0.125,0.831c2.675,20.19 -16.838,40.825 -45.151,49.619c14.688,-6.665 24.926,-21.426 24.926,-38.614c0,-23.202 -18.65,-42.026 -41.775,-42.367c0.05,-0.005 0.1,-0.015 0.15,-0.025c-0.262,0 -0.526,-0.01 -0.789,-0.01Zm-13.248,11.314c7.817,0 14.25,6.433 14.25,14.25c0,0.001 0,0.001 0,0.001c0,7.817 -6.433,14.249 -14.25,14.249c-7.817,0 -14.25,-6.432 -14.25,-14.249c0,-0.001 0,-0.001 0,-0.001c0,-7.817 6.433,-14.25 14.25,-14.25Z" style="fill:#fff;fill-rule:nonzero;"/><path id="path5080" d="M213.786,9.529l0.75,0.521l0.738,0.532l0.712,0.544l0.7,0.555l0.688,0.566l0.662,0.577l0.65,0.588l0.625,0.6l0.613,0.61l0.587,0.62l0.575,0.631l0.563,0.643l0.537,0.652l0.513,0.663l0.5,0.672l0.475,0.684l0.45,0.692l0.437,0.703l0.425,0.712l0.388,0.723l0.375,0.731l0.35,0.741l0.337,0.75l0.3,0.76l0.288,0.769l0.262,0.777l0.25,0.786l0.213,0.797l0.187,0.804l0.175,0.812l0.15,0.821l0.125,0.83c2.675,20.19 -16.837,40.825 -45.15,49.619c14.688,-6.665 24.925,-21.426 24.925,-38.614c0,-23.202 -18.65,-42.025 -41.775,-42.367c0.05,-0.005 0.1,-0.015 0.15,-0.025c-0.262,0 -0.525,-0.01 -0.787,-0.01c-42.01,0 -76.062,18.985 -76.062,42.402c0,13.268 10.922,25.103 28.022,32.876c-8.081,-5.487 -13.403,-12.973 -14.584,-21.859c-2.685,-20.187 16.831,-40.82 45.149,-49.615c-14.688,6.665 -24.925,21.426 -24.925,38.598c0,23.218 18.65,42.046 41.775,42.383c-0.038,0.005 -0.088,0.015 -0.138,0.02c0.263,0 0.513,0.01 0.763,0.01c42.012,-0.001 76.075,-18.985 76.075,-42.413c0,-13.261 -10.938,-25.097 -28.038,-32.871Z" style="fill:none;"/><path id="path5082" d="M354.323,82.586l-41.999,-42.002l38.524,-38.515l-29.913,0l-23.562,23.559l-23.563,-23.559l-29.924,0l38.525,38.515l-42,42.002l29.913,0l27.049,-27.046l27.05,27.046l29.9,0" style="fill:#fff;fill-rule:nonzero;"/><path id="path5084" d="M354.323,82.586l-41.999,-42.002l38.524,-38.515l-29.913,0l-23.562,23.559l-23.563,-23.559l-29.924,0l38.525,38.515l-42,42.002l29.913,0l27.049,-27.046l27.05,27.046l29.9,0Z" style="fill:none;"/><path id="path5086" d="M0,2.069l75.033,0l0,16.489l-51.629,0l0,14.931l40.258,0l0,16.495l-40.258,0l0,16.05l53.124,0l0,16.488l-76.528,0l0,-80.453" style="fill:#fff;fill-rule:nonzero;"/><path id="path5088" d="M0,2.069l75.033,0l0,16.489l-51.629,0l0,14.931l40.258,0l0,16.495l-40.258,0l0,16.05l53.124,0l0,16.488l-76.528,0l0,-80.453Z" style="fill:none;"/></g></svg>`
30
30
  const base64Logo = window.btoa(eoxLogo)
31
31
  </script>
32
+ <style scoped>
33
+ .footer-text {
34
+ font-size: 0.8rem;
35
+ }
36
+ </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <v-app-bar color="primary">
3
3
  <v-app-bar-title>{{ title }}</v-app-bar-title>
4
- <v-img class="mx-12" style="max-width: 140px;" :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>
@@ -12,3 +12,8 @@ const eodash = /** @type {import("@/types").Eodash} */(inject(eodashKey))
12
12
 
13
13
  const title = eodash.brand?.name
14
14
  </script>
15
+ <style scoped>
16
+ .logo {
17
+ max-width: 140px;
18
+ }
19
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <iframe :src="src" style="width: 100%; height: 100%"></iframe>
2
+ <iframe :src="src" class="fill-height fill-width"></iframe>
3
3
  </template>
4
4
  <script setup>
5
5
  defineProps({
@@ -1,17 +1,14 @@
1
1
  <template>
2
- <v-main class="overflow-hidden" style="height: 91dvh;">
2
+ <v-main class="overflow-hidden main">
3
3
  <Suspense suspensible>
4
4
  <component id="bg-widget" v-if="bgWidget.component" :is="bgWidget.component" v-bind="bgWidget.props"></component>
5
5
  </Suspense>
6
6
 
7
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="{
9
- bottom: tabsHeightFromBtm, position: 'absolute', overflow: 'hidden',
10
- width: '100%', left: 0, top: mainRect.top + 'px', zIndex: 1, background: 'rgb(var(--v-theme-surface))'
11
- }">
12
- <v-btn icon variant="text" style="height: 5%;position: relative;" @click="activeIdx = -1">&#x2715;</v-btn>
8
+ <div v-if="importedWidget.value.component" v-show="activeIdx === idx" id="overlay" class="pa-2 panel">
9
+ <v-btn icon variant="text" class="close-btn" @click="activeIdx = -1">&#x2715;</v-btn>
13
10
  <Suspense suspensible>
14
- <div style="height: 90% !important;" v-show="activeIdx === idx">
11
+ <div class="component-container" v-show="activeIdx === idx">
15
12
  <component :key="importedWidget.value.id" :is="importedWidget.value.component"
16
13
  v-bind="importedWidget.value.props" />
17
14
  </div>
@@ -19,9 +16,7 @@
19
16
  </div>
20
17
  </template>
21
18
 
22
- <v-tabs ref="tabs" align-tabs="center" bg-color="surface"
23
- :style="{ position: 'relative', bottom: (mainRect.bottom || 48) + 'px', zIndex: 10 }" show-arrows
24
- v-model="activeIdx">
19
+ <v-tabs ref="tabs" align-tabs="center" bg-color="surface" class="tabs" show-arrows v-model="activeIdx">
25
20
  <template v-for="(importedWidget, idx) in importedWidgets" :key="idx">
26
21
  <v-tab v-if="importedWidget.value.component" :value="idx">
27
22
  {{ importedWidget.value.title }}
@@ -51,7 +46,43 @@ const activeIdx = ref(-1)
51
46
  /** @type {import("vue").Ref<import("vuetify/components").VTabs|null>} */
52
47
  const tabs = ref(null)
53
48
  const tabsHeightFromBtm = ref('')
49
+ const mainRectTopPx = ref('')
50
+ const mainRectBtmPx = ref('')
51
+
54
52
  onMounted(() => {
53
+ mainRectTopPx.value = mainRect.value.top + 'px';
54
+ mainRectBtmPx.value = (mainRect.value.bottom || 48) + 'px';
55
55
  tabsHeightFromBtm.value = mainRect.value.bottom + (/** @type {HTMLElement} */(tabs.value?.$el)?.clientHeight ?? 0) + "px"
56
56
  })
57
57
  </script>
58
+ <style scoped>
59
+ .main {
60
+ height: 91dvh;
61
+ }
62
+
63
+ .panel {
64
+ top: v-bind("mainRectTopPx");
65
+ bottom: v-bind("tabsHeightFromBtm");
66
+ position: absolute;
67
+ overflow: hidden;
68
+ width: 100%;
69
+ left: 0;
70
+ z-index: 1;
71
+ background: rgb(var(--v-theme-surface));
72
+ }
73
+
74
+ .component-container {
75
+ height: 90%;
76
+ }
77
+
78
+ .close-btn {
79
+ height: 5%;
80
+ position: relative;
81
+ }
82
+
83
+ .tabs {
84
+ bottom: v-bind("mainRectBtmPx");
85
+ position: relative;
86
+ z-index: 10;
87
+ }
88
+ </style>
@@ -31,8 +31,9 @@ export const useEodashRuntime = async (runtimeConfig) => {
31
31
  }
32
32
 
33
33
  try {
34
+ const configJs = '/config.js'
34
35
  assignInstance(
35
- (await import( /* @vite-ignore */new URL('/config.js', import.meta.url).href)).default
36
+ (await import( /* @vite-ignore */new URL(configJs, import.meta.url).href)).default
36
37
  )
37
38
  } catch {
38
39
  try {
@@ -1,14 +1,14 @@
1
1
  import { defineAsyncComponent, reactive, shallowRef, watch } from 'vue'
2
2
  import { useSTAcStore } from '@/store/stac'
3
3
  import { storeToRefs } from 'pinia'
4
- import Loading from '@/components/Loading.vue';
5
4
 
6
5
  /**
7
6
  * @typedef {{
8
- * component:import('vue').Component | null;
7
+ * component: import('vue').Component | null;
9
8
  * props: Record<string, unknown>;
10
- * title :string;
11
- * id:string|number|symbol;
9
+ * title: string;
10
+ * id: string | number | symbol;
11
+ * layout: { x: number; y: number; h: number; w: number }
12
12
  * }} DefinedWidget
13
13
  */
14
14
 
@@ -55,6 +55,7 @@ export const useDefineWidgets = (widgetConfigs) => {
55
55
  props: {},
56
56
  title: '',
57
57
  id: Symbol(),
58
+ layout: { x: 0, y: 0, h: 0, w: 0 }
58
59
  })
59
60
 
60
61
  if ('defineWidget' in (config ?? {})) {
@@ -78,7 +79,7 @@ export const useDefineWidgets = (widgetConfigs) => {
78
79
 
79
80
  /**
80
81
  * Converts a static widget configuration to a defined imported widget
81
- * @param {import("@/types").StaticWidget| Omit<import("@/types").StaticWidget, "layout">| undefined | null} config
82
+ * @param {import("@/types").StaticWidget| Omit<import("@/types").StaticWidget, "layout">| undefined | null} [config]
82
83
  * @returns {DefinedWidget}
83
84
  **/
84
85
  const getWidgetDefinition = (config) => {
@@ -90,13 +91,13 @@ const getWidgetDefinition = (config) => {
90
91
  props: {},
91
92
  title: '',
92
93
  id: Symbol(),
94
+ layout: reactive({ x: 0, y: 0, h: 0, w: 0 })
93
95
  }
94
96
  switch (config?.type) {
95
97
  case 'internal':
96
98
  importedWidget.component = defineAsyncComponent({
97
99
  loader: internalWidgets[/** @type {import("@/types").InternalComponentWidget} **/(config)?.widget.name],
98
100
  suspensible: true,
99
- loadingComponent: Loading
100
101
  })
101
102
  importedWidget.props = reactive(/** @type {import("@/types").InternalComponentWidget} **/(config)?.widget.properties ?? {})
102
103
 
@@ -106,7 +107,6 @@ const getWidgetDefinition = (config) => {
106
107
  importedWidget.component = defineAsyncComponent({
107
108
  loader: () => import('@/components/DynamicWebComponent.vue'),
108
109
  suspensible: true,
109
- loadingComponent: Loading
110
110
  })
111
111
  importedWidget.props = reactive(config.widget)
112
112
 
@@ -115,7 +115,6 @@ const getWidgetDefinition = (config) => {
115
115
  importedWidget.component = defineAsyncComponent({
116
116
  loader: () => import('@/components/IframeWrapper.vue'),
117
117
  suspensible: true,
118
- loadingComponent: Loading
119
118
  })
120
119
  importedWidget.props = reactive(config.widget)
121
120
  break;
@@ -130,6 +129,13 @@ const getWidgetDefinition = (config) => {
130
129
  }
131
130
  importedWidget.title = config?.title ?? ''
132
131
  importedWidget.id = config?.id ?? importedWidget.id
132
+
133
+ if ("layout" in config) {
134
+ importedWidget.layout.x = config.layout.x
135
+ importedWidget.layout.y = config.layout.y
136
+ importedWidget.layout.h = config.layout.h
137
+ importedWidget.layout.w = config.layout.w
138
+ }
133
139
  return importedWidget
134
140
  }
135
141
 
@@ -1,12 +1,11 @@
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`
@@ -35,116 +34,6 @@ export const useAbsoluteUrl = (rel = "", base = eodash.stacEndpoint) => {
35
34
  return currentUrl;
36
35
  };
37
36
 
38
- /**
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
37
  /**
149
38
  * Updates an existing Vuetify theme.
150
39
  * updates only the values provided in the `ThemeDefinition`
@@ -178,25 +67,35 @@ export const useUpdateTheme = (themeName, themeDefinition = {}) => {
178
67
  */
179
68
 
180
69
  export const useURLSearchParametersSync = () => {
181
- onMounted(() => {
70
+ onMounted(async () => {
182
71
  // Analyze currently set url params when first loaded and set them in the store
183
72
  if ('URLSearchParams' in window) {
184
73
  const searchParams = new URLSearchParams(window.location.search);
185
- let x, y, z;
186
- searchParams.forEach((value, key) => {
74
+ /** @type {number} */
75
+ let x,
76
+ /** @type {number} */
77
+ y,
78
+ /** @type {number} */
79
+ z;
80
+ searchParams.forEach(async (value, key) => {
187
81
  if (key === "indicator") {
188
- indicator.value = value;
82
+ const { loadSelectedSTAC, stac } = useSTAcStore()
83
+ const match = stac?.find(link => link.id == value)
84
+ if (match) {
85
+ await loadSelectedSTAC(match.href)
86
+ }
189
87
  }
190
88
  if (key === "x") {
191
- x = value;
89
+ x = Number(value);
192
90
  }
193
91
  if (key === "y") {
194
- y = value;
92
+ y = Number(value);
195
93
  }
196
94
  if (key === "z") {
197
- z = value;
95
+ z = Number(value);
198
96
  }
199
97
  })
98
+ //@ts-expect-error
200
99
  if (x !== undefined && y !== undefined && z !== undefined) {
201
100
  mapPosition.value = [x, y, z];
202
101
  }