@eodash/eodash 5.0.0-alpha.1.9 → 5.0.0-alpha.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/bin/cli.js +15 -8
  4. package/bin/main.js +9 -0
  5. package/bin/serverConfig.js +58 -29
  6. package/bin/types.d.ts +52 -0
  7. package/bin/utils.js +70 -20
  8. package/core/App.vue +10 -12
  9. package/core/SuspensedDashboard.ce.vue +65 -0
  10. package/core/asWebComponent.d.ts +18 -0
  11. package/core/asWebComponent.js +12 -0
  12. package/core/components/DashboardLayout.vue +11 -25
  13. package/core/components/DynamicWebComponent.vue +6 -6
  14. package/core/components/Footer.vue +11 -12
  15. package/core/components/Header.vue +5 -29
  16. package/core/components/Loading.vue +27 -0
  17. package/core/components/MobileLayout.vue +34 -63
  18. package/core/composables/DefineEodash.js +57 -0
  19. package/core/composables/DefineWidgets.js +26 -15
  20. package/core/composables/index.js +139 -67
  21. package/core/eodash.js +100 -0
  22. package/core/main.js +2 -4
  23. package/core/plugins/index.js +3 -12
  24. package/core/plugins/vuetify.js +5 -2
  25. package/core/store/Actions.js +0 -28
  26. package/core/store/States.js +12 -3
  27. package/core/store/stac.js +7 -5
  28. package/core/types.d.ts +149 -124
  29. package/core/utils/eodashSTAC.js +164 -0
  30. package/core/utils/helpers.js +40 -0
  31. package/core/utils/index.js +28 -0
  32. package/core/utils/keys.js +6 -0
  33. package/core/views/Dashboard.vue +33 -23
  34. package/core/vite-env.d.ts +16 -2
  35. package/dist/.gitkeep +0 -0
  36. package/dist/DashboardLayout-Dp8AnYD9.js +141 -0
  37. package/dist/DynamicWebComponent-BrHVTesn.js +57 -0
  38. package/dist/EodashDatePicker-D_udZ26j.js +1645 -0
  39. package/dist/EodashItemFilter-BLAGx2UD.js +51 -0
  40. package/dist/EodashMap-Bxl_aqY2.js +53405 -0
  41. package/dist/Footer-AohCH8U7.js +118 -0
  42. package/dist/Header-DC50S6GR.js +609 -0
  43. package/dist/IframeWrapper-Dd9zrX9s.js +19 -0
  44. package/dist/MobileLayout-CgToA7Gp.js +523 -0
  45. package/dist/VBtn-Bz7ruRUg.js +1106 -0
  46. package/dist/VMain-BHfWJU2j.js +35 -0
  47. package/dist/WidgetsContainer-DxfCu0I3.js +122 -0
  48. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  49. package/dist/asWebComponent-C8rb3b1D.js +11323 -0
  50. package/dist/basedecoder-Qm25PwVp-CHo5Pomv.js +89 -0
  51. package/dist/color-DpYEub1f.js +115 -0
  52. package/dist/decoder-kAoyGIq9-BBR5CgzS.js +10 -0
  53. package/dist/deflate-Be2Arps5-hDqMz3RA.js +10 -0
  54. package/dist/dimensions-CJaGeSrj.js +53 -0
  55. package/dist/eo-dash.js +6 -0
  56. package/dist/eox-itemfilter-DcQkRD2l.js +7537 -0
  57. package/dist/eox-map-BJ9SIixs.js +36205 -0
  58. package/dist/eox-stacinfo-B-YrT7Ug.js +13698 -0
  59. package/dist/forwardRefs-Bxeu9Obx.js +142 -0
  60. package/dist/index-DTkOfh2g.js +152 -0
  61. package/dist/index-Sa2Vg_gx.js +65 -0
  62. package/dist/jpeg-DNfUpLwy-Fjan-04T.js +515 -0
  63. package/dist/lerc-C9VL9kri-cIdbW0sg.js +1029 -0
  64. package/dist/lzw-BOMhmEDy-Dboc93VO.js +84 -0
  65. package/dist/packbits-DaUD6MLm-Bu1PoTGa.js +24 -0
  66. package/dist/pako.esm-C3kYPGGQ-BMki8cQY.js +1087 -0
  67. package/dist/raw-CcGKjn8q-DFOt-i8n.js +9 -0
  68. package/dist/ssrBoot-D-b4-M19.js +17 -0
  69. package/dist/style.css +5 -0
  70. package/dist/webfontloader-CyOFAuFB.js +471 -0
  71. package/dist/webimage-D2c098k3-DLj1LQxB.js +19 -0
  72. package/package.json +40 -12
  73. package/widgets/EodashDatePicker.vue +56 -0
  74. package/widgets/EodashItemFilter.vue +60 -0
  75. package/widgets/EodashMap.vue +82 -0
  76. package/widgets/WidgetsContainer.vue +1 -1
  77. package/core/composables/DefineConfig.js +0 -45
  78. package/core/eodashConfig.js +0 -136
  79. package/core/plugins/router.js +0 -20
  80. package/core/store/Keys.js +0 -6
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <DynamicWebComponent :link="link" tag-name="eox-itemfilter" :properties="properties" :on-mounted="onMounted" />
3
+ </template>
4
+ <script setup>
5
+ import DynamicWebComponent from "@/components/DynamicWebComponent.vue";
6
+ import { indicator } from "@/store/States";
7
+
8
+ const link = () => import("@eox/itemfilter");
9
+
10
+ const properties = {
11
+ config: {
12
+ titleProperty: "title",
13
+ filterProperties: [
14
+ {
15
+ keys: ["title", "themes"],
16
+ title: "Search",
17
+ type: "text",
18
+ expanded: true,
19
+ },
20
+ {
21
+ key: "themes",
22
+ title: "Theme",
23
+ type: "multiselect",
24
+ featured: true,
25
+ },
26
+ ],
27
+ aggregateResults: "themes",
28
+ enableHighlighting: true,
29
+ },
30
+ };
31
+
32
+ /** @type {import("../core/types").WebComponentProps["onMounted"]}*/
33
+ const onMounted = (el, store) => {
34
+ /**
35
+ * @typedef {object} Item
36
+ * @property {string} href
37
+ * */
38
+ /** @type {any} */ (el).apply(
39
+ // Only list child elements in list
40
+ store.stac?.filter((item) => item.rel === "child")
41
+ );
42
+ // Check if selected indicator was already set in store
43
+ if (indicator && indicator.value !== "") {
44
+ const match = store.stac?.find((item) => item.id === indicator.value);
45
+ if (match) {
46
+ //@ts-expect-error
47
+ (el).selectedResult = match;
48
+ store.loadSelectedSTAC(match.href);
49
+ }
50
+ }
51
+ /** @type {any} */ (el).config.onSelect =
52
+ /**
53
+ * @param {Item} item
54
+ * */
55
+ async (item) => {
56
+ console.log(item);
57
+ await store.loadSelectedSTAC(item.href);
58
+ };
59
+ };
60
+ </script>
@@ -0,0 +1,82 @@
1
+ <template>
2
+ <DynamicWebComponent :link="link" tag-name="eox-map" :properties="properties" :on-mounted="onMounted"
3
+ :on-unmounted="onUnmounted" />
4
+ </template>
5
+ <script setup>
6
+ import { inject, watch } from "vue";
7
+ import { toAbsolute } from "stac-js/src/http.js";
8
+ import { EodashCollection } from "@/utils/eodashSTAC";
9
+ import { eodashKey } from "@/utils/keys";
10
+ import { datetime, mapPosition } from "@/store/States";
11
+ import DynamicWebComponent from "@/components/DynamicWebComponent.vue";
12
+ import { storeToRefs } from "pinia";
13
+ import "@eox/map/dist/eox-map-advanced-layers-and-sources.js";
14
+
15
+ const eodashConfig = /** @type {import("@/types").Eodash} */ inject(eodashKey);
16
+
17
+ /** @type {Record<string,unknown>} */
18
+ const properties = {
19
+ class: "fill-height fill-width overflow-none",
20
+ center: [15, 48],
21
+ layers: [{ type: "Tile", source: { type: "OSM" } }],
22
+ };
23
+ // Check if selected indicator was already set in store
24
+ if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
25
+ // TODO: do further checks for invalid values?
26
+ properties.center = [mapPosition.value?.[0], mapPosition.value[1]];
27
+ properties.zoom = mapPosition.value[2];
28
+ }
29
+
30
+ const link = () => import("@eox/map");
31
+
32
+ /** @type {import("openlayers").EventsListenerFunctionType}*/
33
+ const handleMoveEnd = (evt) => {
34
+ const map = /** @type {import("openlayers").Map | undefined} */ (
35
+ /** @type {*} */ (evt).map
36
+ );
37
+ const [x, y] = map?.getView().getCenter() ?? [0, 0];
38
+ const z = map?.getView().getZoom();
39
+ if (!Number.isNaN(x) && !Number.isNaN(y) && !Number.isNaN(z)) {
40
+ mapPosition.value = [x, y, z];
41
+ }
42
+ };
43
+
44
+ /** @type {import("@/types").WebComponentProps["onMounted"]} */
45
+ const onMounted = (el, store) => {
46
+ /** @type {any} */
47
+ (el)?.map?.on("moveend", handleMoveEnd);
48
+
49
+ const { selectedStac } = storeToRefs(store);
50
+
51
+ watch(
52
+ [selectedStac, datetime],
53
+ async ([updatedStac, updatedTime]) => {
54
+ if (updatedStac) {
55
+ const parentCollUrl = toAbsolute(
56
+ `./${updatedStac.id}/collection.json`,
57
+ eodashConfig.stacEndpoint
58
+ );
59
+ const childCollUrl = toAbsolute(
60
+ updatedStac.links[1].href,
61
+ parentCollUrl
62
+ );
63
+ const eodash = new EodashCollection(childCollUrl);
64
+ if (updatedTime) {
65
+ /** @type {any} */ (el).layers = await eodash.createLayersJson(
66
+ new Date(updatedTime)
67
+ );
68
+ } else {
69
+ /** @type {any} */ (el).layers = await eodash.createLayersJson();
70
+ }
71
+ }
72
+ },
73
+ { immediate: true }
74
+ );
75
+ };
76
+
77
+ /** @type {import("@/types").WebComponentProps["onUnmounted"]} */
78
+ const onUnmounted = (el, _store) => {
79
+ /** @type {any} */
80
+ (el)?.map?.un("moveend", handleMoveEnd);
81
+ };
82
+ </script>
@@ -16,7 +16,7 @@ import 'animated-details'
16
16
 
17
17
  const props = defineProps({
18
18
  widgets: {
19
- /** @type {import('vue').PropType<Omit<import("@/types").WidgetConfig,'layout'>[]>} */
19
+ /** @type {import('vue').PropType<Omit<import("@/types").Widget,'layout'>[]>} */
20
20
  type: Array,
21
21
  required: true,
22
22
  }
@@ -1,45 +0,0 @@
1
- import { eodashConfigKey } from "@/store/Keys"
2
- import { inject } from "vue"
3
- import store from '@/store'
4
-
5
- /**
6
- * Sets user defined configuration on runtime.
7
- * Consumes `/config.js` file from the base URL, and assign it to `eodashConfig`
8
- * @async
9
- * @returns {Promise<import("@/types").EodashConfig>}
10
- * @see {@linkplain '@/eodashConfig.js'}
11
- */
12
- export const useEodashRuntimeConfig = async () => {
13
- const eodashConfig = /** @type {import("@/types").EodashConfig} */(inject(eodashConfigKey))
14
- /**
15
- * @param {import("@/types").EodashConfig} updatedConfig
16
- */
17
- const assignConfig = (updatedConfig) => {
18
- /** @type {(keyof import("@/types").EodashConfig)[]} */(Object.keys(eodashConfig))
19
- .forEach((key) => {
20
- //@ts-expect-error
21
- eodashConfig[key] = updatedConfig[key]
22
- })
23
- }
24
-
25
- try {
26
- assignConfig(
27
- (await import( /* @vite-ignore */new URL('/config.js', import.meta.url).href)).default
28
- )
29
- } catch {
30
- try {
31
- assignConfig(await import("user:config").then(async m => await m['default']))
32
- } catch {
33
- console.error('no dashboard configuration assigned')
34
- }
35
- }
36
- return eodashConfig
37
- }
38
-
39
- /**
40
- * @param {(store:import("@/types").EodashStore)=> import("@/types").EodashConfig
41
- * | Promise<import("@/types").EodashConfig>} configCallback
42
- */
43
- export const defineCompiletimeConfig = async (configCallback) => {
44
- return await configCallback(store)
45
- }
@@ -1,136 +0,0 @@
1
- import { reactive } from "vue";
2
- import { currentUrl, mapInstance } from './store/States';
3
- /**
4
- * @type {Function | null}
5
- */
6
- let handleMoveEnd = null;
7
-
8
- /**
9
- * Reactive Edoash Config Object. provided globally in the app,
10
- * and used as an intermediate object to make user defined configurations reactive.
11
- * @type {import("./types").EodashConfig}
12
- */
13
- const eodashConfig = reactive({
14
- id: 'demo',
15
- stacEndpoint: 'https://eurodatacube.github.io/eodash-catalog/RACE/catalog.json',
16
- routes: [],
17
- brand: {
18
- name: 'Demo',
19
- font: {
20
- family: 'Poppins'
21
- },
22
- theme: {
23
- colors: {
24
- primary: '#004170',
25
- secondary: '#00417044',
26
- surface: "#f0f0f0f0",
27
- }
28
- }
29
- },
30
- template: {
31
- background: {
32
- id: Symbol(),
33
- widget: {
34
- link: 'https://cdn.skypack.dev/@eox/map',
35
- properties: {
36
- class: "fill-height fill-width overflow-none",
37
- center: [15, 48],
38
- layers: [{ type: "Tile", source: { type: "OSM" } }],
39
- },
40
- tagName: 'eox-map',
41
- onMounted(el, _, router) {
42
- /** @type {any} */(el).zoom = router.currentRoute.value.query['z'];
43
-
44
- mapInstance.value = /** @type {any} */(el).map;
45
-
46
- mapInstance.value?.on('moveend', handleMoveEnd =
47
- /** @param {any} evt */(evt) => {
48
- router.push({
49
- query: {
50
- z: `${evt.map.getView().getZoom()}`
51
- }
52
- });
53
- });
54
- },
55
- onUnmounted(_el, _store, _router) {
56
- //@ts-expect-error
57
- mapInstance.value?.un('moveend', handleMoveEnd);
58
- }
59
- },
60
- type: 'web-component'
61
- },
62
- widgets: [
63
- {
64
- id: Symbol(),
65
- title: 'Tools',
66
- layout: { "x": 0, "y": 0, "w": 3, "h": 12 },
67
- widget: {
68
- link: 'https://cdn.skypack.dev/@eox/itemfilter',
69
- properties: {
70
- config: {
71
- titleProperty: "title",
72
- filterProperties: [
73
- {
74
- keys: ["title", "themes"],
75
- title: "Search",
76
- type: "text",
77
- expanded: true,
78
- },
79
- {
80
- key: "themes",
81
- title: "Theme",
82
- type: "multiselect",
83
- featured: true
84
- },
85
- ],
86
- aggregateResults: "themes",
87
- enableHighlighting: true,
88
- }
89
- },
90
- onMounted: async function (el, store, _) {
91
- /**
92
- * @typedef {object} Item
93
- * @property {string} href
94
- * */
95
-
96
- /** @type {any} */(el).apply(store?.stac);
97
- /** @type {any} */(el).config.onSelect =
98
- /**
99
- * @param {Item} item
100
- * */
101
- async (item) => {
102
- console.log(item);
103
- await store.loadSelectedSTAC(item.href);
104
- };
105
- },
106
- tagName: 'eox-itemfilter'
107
- },
108
- type: 'web-component'
109
- },
110
- {
111
- id: Symbol(),
112
- title: 'Information',
113
- layout: { "x": 9, "y": 0, "w": 3, "h": 12 },
114
- widget: {
115
- link: async () => await import('@eox/stacinfo'),
116
- properties: {
117
- for: currentUrl,
118
- allowHtml: "true",
119
- styleOverride: "#properties li > .value {font-weight: normal !important;}",
120
- header: "[]",
121
-
122
- subheader: "[]",
123
- properties: '["description"]',
124
- featured: "[]",
125
- footer: "[]"
126
- },
127
- tagName: 'eox-stacinfo'
128
- },
129
- type: 'web-component'
130
- },
131
- ]
132
- }
133
- });
134
-
135
-
136
- export default eodashConfig;
@@ -1,20 +0,0 @@
1
- import { createRouter, createWebHistory } from 'vue-router';
2
-
3
- const routes = [
4
- {
5
- path: '/',
6
- redirect: '/dashboard'
7
- },
8
- {
9
- path: '/dashboard',
10
- name: 'Dashboard',
11
- component: () => import('@/views/Dashboard.vue'),
12
- }
13
- ];
14
-
15
- const router = createRouter({
16
- history: createWebHistory(import.meta.env.BASE_URL),
17
- routes,
18
- });
19
-
20
- export default router;
@@ -1,6 +0,0 @@
1
- /**
2
- * `eodashConfig` injection key.
3
- * @type {Symbol}
4
- * @see {@link "@/plugins/index.js"}
5
- */
6
- export const eodashConfigKey = Symbol("eodashConfig");