@eodash/eodash 5.0.0-alpha.1.13 → 5.0.0-alpha.1.15

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.
package/core/eodash.js CHANGED
@@ -1,9 +1,5 @@
1
1
  import { reactive } from "vue";
2
- import { currentUrl, mapInstance } from './store/States';
3
- /**
4
- * @type {Function | null}
5
- */
6
- let handleMoveEnd = null;
2
+ import { currentUrl } from "./store/States";
7
3
 
8
4
  /**
9
5
  * Reactive Edoash Instance Object. provided globally in the app,
@@ -11,127 +7,95 @@ let handleMoveEnd = null;
11
7
  * @type {import("./types").Eodash}
12
8
  */
13
9
  const eodash = reactive({
14
- id: 'demo',
15
- stacEndpoint: 'https://eurodatacube.github.io/eodash-catalog/RACE/catalog.json',
10
+ id: "demo",
11
+ stacEndpoint: "https://esa-eodash.github.io/RACE-catalog/RACE/catalog.json",
16
12
  routes: [],
17
13
  brand: {
18
- name: 'Demo',
14
+ name: "Demo",
19
15
  font: {
20
- family: 'Poppins'
16
+ family: "Poppins",
21
17
  },
22
18
  theme: {
23
19
  colors: {
24
- primary: '#004170',
25
- secondary: '#00417044',
20
+ primary: "#004170",
21
+ secondary: "#00417044",
26
22
  surface: "#f0f0f0f0",
27
- }
23
+ },
28
24
  },
29
- meta: {}
25
+ meta: {},
26
+ footerText: "Demo configuration of eodash client",
30
27
  },
31
28
  template: {
32
- background: {
29
+ loading: {
33
30
  id: Symbol(),
31
+ type: "web-component",
34
32
  widget: {
35
- link: 'https://cdn.skypack.dev/@eox/map',
33
+ //https://uiball.com/ldrs/
34
+ link: "https://cdn.jsdelivr.net/npm/ldrs/dist/auto/mirage.js",
35
+ tagName: "l-mirage",
36
36
  properties: {
37
- class: "fill-height fill-width overflow-none",
38
- center: [15, 48],
39
- layers: [{ type: "Tile", source: { type: "OSM" } }],
40
- },
41
- tagName: 'eox-map',
42
- onMounted(el, _, router) {
43
- /** @type {any} */(el).zoom = router.currentRoute.value.query['z'];
44
-
45
- mapInstance.value = /** @type {any} */(el).map;
46
-
47
- mapInstance.value?.on('moveend', handleMoveEnd =
48
- /** @param {any} evt */(evt) => {
49
- router.push({
50
- query: {
51
- z: `${evt.map.getView().getZoom()}`
52
- }
53
- });
54
- });
55
- },
56
- onUnmounted(_el, _store, _router) {
57
- //@ts-expect-error
58
- mapInstance.value?.un('moveend', handleMoveEnd);
37
+ class: "align-self-center justify-self-center",
38
+ size: "120",
39
+ speed: "2.5",
40
+ color: "#004170"
59
41
  }
42
+ }
43
+ },
44
+ background: {
45
+ id: Symbol(),
46
+ type: "internal",
47
+ widget: {
48
+ name: "EodashMap",
60
49
  },
61
- type: 'web-component'
62
50
  },
63
51
  widgets: [
64
52
  {
65
53
  id: Symbol(),
66
- title: 'Tools',
67
- layout: { "x": 0, "y": 0, "w": 3, "h": 12 },
54
+ type: "internal",
55
+ title: "itemfilter",
56
+ layout: { x: 0, y: 0, w: 3, h: 12 },
57
+ slidable: false,
68
58
  widget: {
69
- link: 'https://cdn.skypack.dev/@eox/itemfilter',
59
+ name: "EodashItemFilter",
60
+ },
61
+ },
62
+ {
63
+ id: Symbol(),
64
+ type: "internal",
65
+ title: "datepicker",
66
+ layout: { x: 5, y: 11, w: 2, h: 1 },
67
+ slidable: false,
68
+ widget: {
69
+ name: "EodashDatePicker",
70
70
  properties: {
71
- config: {
72
- titleProperty: "title",
73
- filterProperties: [
74
- {
75
- keys: ["title", "themes"],
76
- title: "Search",
77
- type: "text",
78
- expanded: true,
79
- },
80
- {
81
- key: "themes",
82
- title: "Theme",
83
- type: "multiselect",
84
- featured: true
85
- },
86
- ],
87
- aggregateResults: "themes",
88
- enableHighlighting: true,
89
- }
90
- },
91
- onMounted: async function (el, store, _) {
92
- /**
93
- * @typedef {object} Item
94
- * @property {string} href
95
- * */
96
-
97
- /** @type {any} */(el).apply(store?.stac);
98
- /** @type {any} */(el).config.onSelect =
99
- /**
100
- * @param {Item} item
101
- * */
102
- async (item) => {
103
- console.log(item);
104
- await store.loadSelectedSTAC(item.href);
105
- };
71
+ inline: true,
106
72
  },
107
- tagName: 'eox-itemfilter'
108
73
  },
109
- type: 'web-component'
110
74
  },
111
75
  {
112
76
  id: Symbol(),
113
- title: 'Information',
114
- layout: { "x": 9, "y": 0, "w": 3, "h": 12 },
77
+ title: "Information",
78
+ layout: { x: 9, y: 0, w: 3, h: 12 },
115
79
  widget: {
116
- link: async () => await import('@eox/stacinfo'),
80
+ link: async () => await import("@eox/stacinfo"),
117
81
  properties: {
118
82
  for: currentUrl,
119
83
  allowHtml: "true",
120
- styleOverride: "#properties li > .value {font-weight: normal !important;}",
84
+ styleOverride:
85
+ "#properties li > .value {font-weight: normal !important;}",
121
86
  header: "[]",
122
87
 
123
88
  subheader: "[]",
124
89
  properties: '["description"]',
125
90
  featured: "[]",
126
- footer: "[]"
91
+ footer: "[]",
127
92
  },
128
- tagName: 'eox-stacinfo'
93
+ tagName: "eox-stacinfo",
129
94
  },
130
- type: 'web-component'
95
+ type: "web-component",
131
96
  },
132
- ]
133
- }
97
+ ],
98
+ },
134
99
  });
135
100
 
136
-
137
101
  export default eodash;
package/core/main.js CHANGED
@@ -1,4 +1,2 @@
1
- // Plugins
2
1
  export { createEodash } from '@/composables/DefineEodash';
3
-
4
-
2
+ export { default as store } from "@/store"
@@ -1,28 +0,0 @@
1
- /**
2
- * loads font in the app using `webfontloader`
3
- * @param {string} [family="Roboto"]
4
- * @param {string} [link]
5
- * @returns {Promise<string>} - font family name
6
- * @see {@link "https://github.com/typekit/webfontloader "}
7
- */
8
- export const loadFont = async (family = "Roboto", link) => {
9
- const WebFontLoader = (await import('webfontloader')).default;
10
- if (link) {
11
- WebFontLoader.load({
12
- custom: {
13
- // Use FVD notation to include families https://github.com/typekit/fvd
14
- families: [family],
15
- // Path to stylesheet that defines font-face
16
- urls: [link],
17
- },
18
- });
19
- }
20
- else {
21
- WebFontLoader.load({
22
- google: {
23
- families: [family]
24
- }
25
- });
26
- }
27
- return family;
28
- };
@@ -10,3 +10,13 @@ export const currentUrl = ref('');
10
10
  * @type {import("vue").Ref<import('openlayers').Map | null>}
11
11
  */
12
12
  export const mapInstance = ref(null);
13
+
14
+ /**
15
+ * currently selected datetime
16
+ */
17
+ export const datetime = ref(new Date().toISOString());
18
+
19
+ /**
20
+ * Currently selected indicator
21
+ */
22
+ export const indicator = ref("")
@@ -3,6 +3,7 @@ import { inject, ref } from 'vue';
3
3
  import axios from 'axios';
4
4
  import { useAbsoluteUrl } from '@/composables/index';
5
5
  import { eodashKey } from '@/store/Keys';
6
+ import { indicator } from '@/store/States';
6
7
 
7
8
  export const useSTAcStore = defineStore('stac', () => {
8
9
  /**
@@ -14,7 +15,7 @@ export const useSTAcStore = defineStore('stac', () => {
14
15
  /**
15
16
  * selected STAC object.
16
17
  * @type {import('vue').Ref<import('stac-ts').StacCatalog |
17
- * import('stac-ts').StacCollection |import('stac-ts').StacItem
18
+ * import('stac-ts').StacCollection |import('stac-ts').StacItem
18
19
  * | null>}
19
20
  */
20
21
  const selectedStac = ref(null);
@@ -54,6 +55,7 @@ export const useSTAcStore = defineStore('stac', () => {
54
55
 
55
56
  await axios.get(absoluteUrl.value).then(resp => {
56
57
  selectedStac.value = resp.data;
58
+ indicator.value = selectedStac.value?.id ?? "";
57
59
  }).catch(err => console.error(err));
58
60
  }
59
61
 
package/core/types.d.ts CHANGED
@@ -1,16 +1,9 @@
1
- import { useSTAcStore } from "./store/stac"
2
- import type { Router } from "vue-router";
3
- import type { StacCatalog, StacCollection, StacItem } from "stac-ts";
4
- import type { Ref } from "vue"
5
- import type { ThemeDefinition } from "vuetify/lib/index.mjs";
6
- import type { Map } from "openlayers";
7
-
8
1
  /**
9
2
  * @group Eodash
10
3
  */
11
4
  export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
12
5
  /**
13
- * Imports web component file, either using a URL or an import funtion.
6
+ * Imports web component file, either using a URL or an import function.
14
7
  * @example
15
8
  * importing `eox-itemfilter` web component, after installing `@eox/itemfilter` it can be
16
9
  * referenced:
@@ -36,19 +29,19 @@ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
36
29
  * @param el - web component
37
30
  * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
38
31
  */
39
- onMounted?: (el: Element | null, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
32
+ onMounted?: (el: Element | null, store: ReturnType<typeof import("./store/stac").useSTAcStore>, router: import("vue-router").Router) => (Promise<void> | void)
40
33
  /**
41
34
  * Triggered when the web component is unmounted from the DOM.
42
35
  * @param el - web component
43
36
  * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
44
37
  */
45
- onUnmounted?: (el: Element | null, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
38
+ onUnmounted?: (el: Element | null, store: ReturnType<typeof import("./store/stac").useSTAcStore>, router: import("vue-router").Router) => (Promise<void> | void)
46
39
  }
47
40
 
48
41
 
49
42
  /** @ignore */
50
43
  export interface WidgetsContainerProps {
51
- widgets: Omit<Widget, 'layout'>[]
44
+ widgets: Omit<Widget, 'layout' | 'slidable'>[]
52
45
  }
53
46
 
54
47
  // eodash types:
@@ -79,7 +72,11 @@ export interface WebComponentWidget<T extends ExecutionTime = "compiletime"> {
79
72
  * Height. Integer between 1 and 12
80
73
  */
81
74
  h: number
82
- }
75
+ },
76
+ /**
77
+ * Enable/Disable widget sliding.
78
+ */
79
+ slidable?: boolean
83
80
  widget: WebComponentProps<T>
84
81
  type: 'web-component'
85
82
  }
@@ -113,16 +110,20 @@ export interface InternalComponentWidget {
113
110
  */
114
111
  h: number
115
112
  }
113
+ /**
114
+ * Enable/Disable widget sliding.
115
+ */
116
+ slidable?: boolean
116
117
  widget: {
117
118
  /**
118
- * Internal Vue Components inside the [widgets](https://github.com/eodash/eodash/tree/main/widgets) folder can be referenced
119
- * using their name without the extention .vue
119
+ * Internal Vue Components inside the [widgets](https://github.com/eodash/eodash/tree/main/widgets) folder. Referenced
120
+ * using their name without the .vue extention
120
121
  */
121
122
  name: string;
122
123
  /**
123
124
  * Specified Vue component props
124
125
  */
125
- props?: Record<string, unknown>
126
+ properties?: Record<string, unknown>
126
127
  }
127
128
  type: 'internal'
128
129
  }
@@ -158,6 +159,10 @@ export interface IFrameWidget {
158
159
  */
159
160
  h: number
160
161
  }
162
+ /**
163
+ * Enable/Disable widget sliding.
164
+ */
165
+ slidable?: boolean;
161
166
  widget: {
162
167
  /**
163
168
  * The URL of the page to embed
@@ -172,10 +177,12 @@ export interface IFrameWidget {
172
177
  export interface FunctionalWidget<T extends ExecutionTime = "compiletime"> {
173
178
  /**
174
179
  * Provides a functional definition of the widget,
175
- * gets triggered whenever a stac object is selected.
176
- * @param selectedSTAC - currently selected stac object
180
+ * gets triggered whenever a STAC object is selected.
181
+ * @param selectedSTAC - Currently selected STAC object
177
182
  */
178
- defineWidget: (selectedSTAC: StacCatalog | StacCollection | StacItem | null) => Omit<StaticWidget<T>, 'layout'>
183
+ defineWidget: (selectedSTAC: import("stac-ts").StacCatalog |
184
+ import("stac-ts").StacCollection | import("stac-ts").StacItem
185
+ | null) => Omit<StaticWidget<T>, 'layout' | 'slidable'>
179
186
  layout: {
180
187
  /**
181
188
  * Horizontal start position. Integer between 1 and 12
@@ -194,6 +201,10 @@ export interface FunctionalWidget<T extends ExecutionTime = "compiletime"> {
194
201
  */
195
202
  h: number
196
203
  }
204
+ /**
205
+ * Enable/Disable widget sliding.
206
+ */
207
+ slidable?: boolean
197
208
  }
198
209
  /**
199
210
  * @group Eodash
@@ -208,7 +219,7 @@ export type Widget<T extends ExecutionTime = "compiletime"> = StaticWidget<T> |
208
219
  /**
209
220
  * @group Eodash
210
221
  */
211
- export type BackgroundWidget<T extends ExecutionTime = "compiletime"> = Omit<WebComponentWidget<T>, 'layout' | 'title'> | Omit<InternalComponentWidget, 'layout' | 'title'> | Omit<IFrameWidget, 'layout' | 'title'> | Omit<FunctionalWidget, 'layout'>
222
+ export type BackgroundWidget<T extends ExecutionTime = "compiletime"> = Omit<WebComponentWidget<T>, 'layout' | 'title' | 'slidable'> | Omit<InternalComponentWidget, 'layout' | 'title' | 'slidable'> | Omit<IFrameWidget, 'layout' | 'title' | 'slidable'> | Omit<FunctionalWidget<T>, 'layout' | 'slidable'>
212
223
  /**
213
224
  * Dashboard rendered widgets specification.
214
225
  * 3 types of widgets are supported: `"iframe"`, `"internal"`, and `"web-component"`.
@@ -220,9 +231,14 @@ export interface Template<T extends ExecutionTime = "compiletime"> {
220
231
  * Gap between widgets
221
232
  */
222
233
  gap?: number;
234
+ /**
235
+ * loading widget
236
+ */
237
+ loading?: BackgroundWidget<T>
223
238
  /**
224
239
  * Widget rendered as the dashboard background.
225
- * Has the same specifications of [Widget](../readme#widget) without the `title` and `layout` properties
240
+ * Has the same specifications of `Widget` without the `title` and `layout` properties
241
+ * @see {@link Widget}
226
242
  */
227
243
  background?: BackgroundWidget<T>
228
244
  /**
@@ -238,6 +254,7 @@ export type InternalRoute = `/${string}`
238
254
  export type StacEndpoint = `${'https://' | 'http://'}${string}/catalog.json`
239
255
 
240
256
  /**
257
+ * @ignore
241
258
  * @group Eodash
242
259
  */
243
260
  export type ExecutionTime = "runtime" | "compiletime";
@@ -256,7 +273,7 @@ export interface Eodash<T extends ExecutionTime = "compiletime"> {
256
273
  **/
257
274
  stacEndpoint: StacEndpoint
258
275
  /**
259
- * Renderes to navigation buttons on the app header.
276
+ * Renders navigation buttons on the app header.
260
277
  **/
261
278
  routes?: Array<{
262
279
  title: string,
@@ -272,7 +289,7 @@ export interface Eodash<T extends ExecutionTime = "compiletime"> {
272
289
  */
273
290
  font?: {
274
291
  /**
275
- * Link to stylesheet that defines font-face.
292
+ * Link to stylesheet that defines font-face. Could be either a relative or absolute URL.
276
293
  */
277
294
  link?: string;
278
295
  /**
@@ -285,19 +302,21 @@ export interface Eodash<T extends ExecutionTime = "compiletime"> {
285
302
  */
286
303
  name: string;
287
304
  /**
288
- * Alias that will be shown in the app footer if specified.
305
+ * Brand logo
289
306
  */
290
- shortName?: string
307
+ logo?: string;
291
308
  /**
292
- * brand logo
309
+ * Dashboard theme as a custom [vuetifyJs theme](https://vuetifyjs.com/en/features/theme/).
293
310
  */
294
- logo?: string;
311
+ theme?: import("vuetify/lib/index.mjs").ThemeDefinition
295
312
  /**
296
- * Dashboard theme as a custom vuetifyJs theme.
313
+ * meta tags configuration, using unhead's [useSeoMeta](https://unhead.unjs.io/usage/composables/use-seo-meta)
297
314
  */
298
- theme?: ThemeDefinition
299
-
300
- meta?: import("@unhead/vue").UseSeoMetaInput
315
+ meta?: import("@unhead/vue").UseSeoMetaInput;
316
+ /**
317
+ * Text applied to the footer.
318
+ */
319
+ footerText?: string;
301
320
  }
302
321
  /**
303
322
  * Template configuration
@@ -318,25 +337,31 @@ export interface EodashStore {
318
337
  /**
319
338
  * Currently selected STAC endpoint
320
339
  */
321
- currentUrl: Ref<string>
340
+ currentUrl: import("vue").Ref<string>
322
341
  /**
323
342
  * OpenLayers map instance
324
343
  */
325
- mapInstance: Ref<Map | null>
344
+ mapInstance: import("vue").Ref<import("openlayers").Map | null>
345
+ /**
346
+ * currently selected datetime
347
+ */
348
+ datetime: import("vue").Ref<string>
349
+ /**
350
+ * Currently selected indicator
351
+ */
352
+ indicator: import("vue").Ref<string>
326
353
  }
327
- actions: {
328
- loadFont: (family?: string, link?: string) => Promise<string>;
329
- };
354
+ actions: {};
330
355
  /**
331
356
  * Pinia store definition used to navigate the root STAC catalog.
332
357
  */
333
358
  stac: {
334
- useSTAcStore: typeof useSTAcStore
359
+ useSTAcStore: typeof import("./store/stac").useSTAcStore
335
360
  }
336
361
  }
337
362
  ///////
338
363
  /**
339
- * Eodash server, build and setup configuration
364
+ * Extending [Vite's](https://vitejs.dev/) config to configure eodash's server, build and setup.
340
365
  * @group EodashConfig
341
366
  */
342
367
  export interface EodashConfig {
@@ -355,32 +380,35 @@ export interface EodashConfig {
355
380
  open?: boolean
356
381
  }
357
382
  /**
358
- * base public path
383
+ * Base public path
359
384
  */
360
385
  base?: string;
361
386
  /**
362
- * build target folder path
387
+ * Build target folder path
363
388
  */
364
389
  outDir?: string;
365
- /** path to statically served assets folder, can be set to `false`
366
- * to disable serving assets statically
390
+ /**
391
+ * Path to statically served assets folder, can be set to `false`
392
+ * to disable serving assets statically
367
393
  **/
368
394
  publicDir?: string | false;
369
395
  /**
370
- * cache folder
396
+ * Cache folder
371
397
  */
372
398
  cacheDir?: string
373
- /** specifies main entry file, exporting `createEodash`*/
399
+ /** Specifies main entry file, exporting `createEodash`*/
374
400
  entryPoint?: string
375
401
  /**
376
- * file exporting eodash client runtime config
402
+ * File exporting eodash client runtime config
377
403
  */
378
404
  runtime?: string
405
+ widgets?: string
379
406
  }
380
407
  /**
381
- * project entry point should export this function as a default
408
+ * the project's entry point should export this function as a default
382
409
  * to instantiate eodash
383
410
  *
384
411
  * @param configCallback
385
412
  */
386
- export declare const createEodash: (configCallback: (store: EodashStore) => Eodash | Promise<Eodash>) => Eodash
413
+ export declare const createEodash: (configCallback: (store: EodashStore) => Eodash | Promise<Eodash>) => Promise<Eodash>
414
+ export declare const store: EodashStore