@eodash/eodash 5.0.0-alpha.1.6 → 5.0.0-alpha.1.8

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/types.d.ts CHANGED
@@ -1,362 +1,331 @@
1
- import { useSTAcStore } from "@/store/stac"
1
+ import { useSTAcStore } from "./store/stac"
2
2
  import type { Router } from "vue-router";
3
3
  import type { StacCatalog, StacCollection, StacItem } from "stac-ts";
4
-
5
- declare global {
4
+ import type { Ref } from "vue"
5
+ import type { ThemeDefinition } from "vuetify/lib/index.mjs";
6
+ import type { Map } from "openlayers";
7
+ /**
8
+ * Web Component configuration
9
+ */
10
+ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
11
+ /** Web component definition file URL*/
12
+ link: T extends 'runtime' ? string : (string | (() => Promise<unknown>));
13
+ /** Exported Constructor, needs to be provided if the web component is not registered by the `link` provided */
14
+ constructorProp?: string
15
+ /** Custom tag name */
16
+ tagName: `${string}-${string}`
17
+ /** Object defining all the properties and attributes of the web component */
18
+ properties?: Record<string, any>
6
19
  /**
7
- * Specification of web components imported from an external URL
20
+ * Function that is triggered when the web component is mounted in the DOM.
21
+ * @param el - web component
22
+ * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
8
23
  */
9
- interface ExternalWebComponentProps {
10
- /** Web component definition file URL*/
11
- link: string
12
- /** Indicates if the widget is a node module */
13
- // node_module?: false
14
- /** Exported Constructor, needs to be provided if the web component is not registered by the `link` provided */
15
- constructorProp?: string
16
- /** Custom tag name */
17
- tagName: `${string}-${string}`
18
- /** Object defining all the properties and attributes of the web component */
19
- properties?: Record<string, any>
20
- /**
21
- * Function that is triggered when the web component is mounted in the DOM.
22
- * @param el - web component
23
- * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
24
- */
25
- onMounted?: (el: Element, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
26
- /**
27
- * Function that is triggered when the web component is unmounted from the DOM.
28
- * @param el - web component
29
- * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
30
- */
31
- onUnmounted?: (el: Element, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
32
- }
24
+ onMounted?: (el: Element | null, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
25
+ /**
26
+ * Function that is triggered when the web component is unmounted from the DOM.
27
+ * @param el - web component
28
+ * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
29
+ */
30
+ onUnmounted?: (el: Element | null, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
31
+ }
33
32
 
34
- // /**
35
- // * Specification of web components imported as a node_module.
36
- // */
37
- // export interface NodeModuleWebComponentProps {
38
- // /** Type of `modulesMap` key. Defined in `/core/modulesMap.ts`*/
39
- // link: keyof typeof modulesMap;
40
- // /** Indicates if the widget is a node module */
41
- // node_module: true;
42
- // /** Exported Constructor, needs to be provided if the web component is not registered */
43
- // constructorProp?: string
44
- // /** Custom tag name */
45
- // tagName: `${string}-${string}`
46
- // /** Object defining all the properties and attributes of the web component */
47
- // properties?: Record<string, any>
48
- // /**
49
- // * Function that is triggered when the web component is mounted in the DOM.
50
- // * @param el - web component
51
- // * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
52
- // */
53
- // onMounted?: (el: Element, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
54
- // /**
55
- // * Function that is triggered when the web component is unmounted from the DOM.
56
- // * @param el - web component
57
- // * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
58
- // */
59
- // onUnmounted?: (el: Element, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
60
- // }
61
- /** @ignore */
62
- type DynamicWebComponentProps = ExternalWebComponentProps // ExternalWebComponentProps | NodeModuleWebComponentProps
63
33
 
64
- /** @ignore */
65
- interface WidgetsContainerProps {
66
- widgets: Omit<WidgetConfig, 'layout'>[]
67
- }
34
+ /** @ignore */
35
+ export interface WidgetsContainerProps {
36
+ widgets: Omit<WidgetConfig, 'layout'>[]
37
+ }
68
38
 
69
- // eodash config types:
39
+ // eodash config types:
40
+ /**
41
+ * Widget type: `web-component` specification. The web component definition is imported using the `widget.link` property either from
42
+ * an external endpoint, or an installed node_module.
43
+ * Installed node_module web components import should be mapped in `/core/modulesMap.ts`,
44
+ * then setting `widget.link`:`(import-map-key)` and `node_module`:`true`
45
+ */
46
+ export interface WebComponentConfig<T extends ExecutionTime = "compiletime"> {
47
+ /**
48
+ * Unique Identifier, triggers rerender when using `defineWidget`
49
+ **/
50
+ id: number | string | symbol
51
+ /**
52
+ * Widget title
53
+ */
54
+ title: string
70
55
  /**
71
- * Widget type: `web-component` specification. The web component definition is imported using the `widget.link` property either from
72
- * an external endpoint, or an installed node_module.
73
- * Installed node_module web components import should be mapped in `/core/modulesMap.ts`,
74
- * then setting `widget.link`:`(import-map-key)` and `node_module`:`true`
56
+ * Widget position and size.
75
57
  */
76
- interface WebComponentConfig {
58
+ layout: {
77
59
  /**
78
- * Unique Identifier, triggers rerender when using `defineWidget`
79
- **/
80
- id: number | string | symbol
60
+ * Horizontal start position. Integer (1 - 12)
61
+ */
62
+ x: number
81
63
  /**
82
- * Widget title
64
+ * Vertical start position. Integer (1 - 12)
83
65
  */
84
- title: string
66
+ y: number
85
67
  /**
86
- * Widget position and size.
68
+ * Width. Integer (1 - 12)
87
69
  */
88
- layout: {
89
- /**
90
- * Horizontal start position. Integer (1 - 12)
91
- */
92
- x: number
93
- /**
94
- * Vertical start position. Integer (1 - 12)
95
- */
96
- y: number
97
- /**
98
- * Width. Integer (1 - 12)
99
- */
100
- w: number
101
- /**
102
- * Height. Integer (1 - 12)
103
- */
104
- h: number
105
- }
106
- widget: ExternalWebComponentProps // | NodeModuleWebComponentProps
70
+ w: number
107
71
  /**
108
- * Widget type
72
+ * Height. Integer (1 - 12)
109
73
  */
110
- type: 'web-component'
74
+ h: number
111
75
  }
76
+ widget: WebComponentProps<T>
77
+ /**
78
+ * Widget type
79
+ */
80
+ type: 'web-component'
81
+ }
112
82
 
83
+ /**
84
+ * Widget type: `internal` specification.
85
+ * Internal widgets are Vue components inside the `/widgets` directory.
86
+ */
87
+ export interface InternalComponentConfig {
88
+ /**
89
+ * Unique Identifier, triggers rerender when using `defineWidget`
90
+ **/
91
+ id: number | string | symbol
113
92
  /**
114
- * Widget type: `internal` specification.
115
- * Internal widgets are Vue components inside the `/widgets` directory.
93
+ * Widget title
116
94
  */
117
- interface InternalComponentConfig {
95
+ title: string
96
+ /**
97
+ * Widget position and size.
98
+ */
99
+ layout: {
118
100
  /**
119
- * Unique Identifier, triggers rerender when using `defineWidget`
120
- **/
121
- id: number | string | symbol
101
+ * Horizontal start position. Integer (1 - 12)
102
+ */
103
+ x: number
122
104
  /**
123
- * Widget title
105
+ * Vertical start position. Integer (1 - 12)
124
106
  */
125
- title: string
107
+ y: number
126
108
  /**
127
- * Widget position and size.
128
- */
129
- layout: {
130
- /**
131
- * Horizontal start position. Integer (1 - 12)
132
- */
133
- x: number
134
- /**
135
- * Vertical start position. Integer (1 - 12)
136
- */
137
- y: number
138
- /**
139
- * Width. Integer (1 - 12)
140
- */
141
- w: number
142
- /**
143
- * Height. Integer (1 - 12)
144
- */
145
- h: number
146
- }
147
- widget: {
148
- /**
149
- * Internal Vue Component file name without the extention .vue
150
- */
151
- name: string;
152
- /**
153
- * Specified Vue component props
154
- */
155
- props?: Record<string, unknown>
156
- }
109
+ * Width. Integer (1 - 12)
110
+ */
111
+ w: number
157
112
  /**
158
- * Widget type.
159
- */
160
- type: 'internal'
113
+ * Height. Integer (1 - 12)
114
+ */
115
+ h: number
116
+ }
117
+ widget: {
118
+ /**
119
+ * Internal Vue Component file name without the extention .vue
120
+ */
121
+ name: string;
122
+ /**
123
+ * Specified Vue component props
124
+ */
125
+ props?: Record<string, unknown>
161
126
  }
127
+ /**
128
+ * Widget type.
129
+ */
130
+ type: 'internal'
131
+ }
162
132
 
133
+ /**
134
+ * Widget type: `iframe` specification.
135
+ * Renders an external HTML file as a widget.
136
+ */
137
+ export interface IFrameConfig {
163
138
  /**
164
- * Widget type: `iframe` specification.
165
- * Renders an external HTML file as a widget.
166
- */
167
- interface IFrameConfig {
139
+ * Unique Identifier, triggers rerender when using `defineWidget`
140
+ **/
141
+ id: number | string | symbol
142
+ /**
143
+ * Widget title
144
+ */
145
+ title: string
146
+ /**
147
+ * Widget position and size.
148
+ */
149
+ layout: {
168
150
  /**
169
- * Unique Identifier, triggers rerender when using `defineWidget`
170
- **/
171
- id: number | string | symbol
151
+ * Horizontal start position. Integer (1 - 12)
152
+ */
153
+ x: number
172
154
  /**
173
- * Widget title
174
- */
175
- title: string
155
+ * Vertical start position. Integer (1 - 12)
156
+ */
157
+ y: number
176
158
  /**
177
- * Widget position and size.
178
- */
179
- layout: {
180
- /**
181
- * Horizontal start position. Integer (1 - 12)
182
- */
183
- x: number
184
- /**
185
- * Vertical start position. Integer (1 - 12)
186
- */
187
- y: number
188
- /**
189
- * Width. Integer (1 - 12)
190
- */
191
- w: number
192
- /**
193
- * Height. Integer (1 - 12)
194
- */
195
- h: number
196
- }
197
- widget: {
198
- /**
199
- * The URL of the page to embed
200
- */
201
- src: string
202
- }
159
+ * Width. Integer (1 - 12)
160
+ */
161
+ w: number
203
162
  /**
204
- * Widget type
205
- */
206
- type: 'iframe'
163
+ * Height. Integer (1 - 12)
164
+ */
165
+ h: number
207
166
  }
208
- interface FunctionalWidget {
167
+ widget: {
209
168
  /**
210
- * Provides a functional definition of the widget,
211
- * gets triggered whenever a stac object is selected.
212
- * @param selectedSTAC - currently selected stac object
169
+ * The URL of the page to embed
213
170
  */
214
- defineWidget: (selectedSTAC: StacCatalog | StacCollection | StacItem | null) => Omit<StaticWidget, 'layout'>
215
- layout: {
216
- /**
217
- * Horizontal start position. Integer (1 - 12)
218
- */
219
- x: number
220
- /**
221
- * Vertical start position. Integer (1 - 12)
222
- */
223
- y: number
224
- /**
225
- * Width. Integer (1 - 12)
226
- */
227
- w: number
228
- /**
229
- * Height. Integer (1 - 12)
230
- */
231
- h: number
232
- }
171
+ src: string
233
172
  }
234
- type StaticWidget = WebComponentConfig | InternalComponentConfig | IFrameConfig
235
- type WidgetConfig = StaticWidget | FunctionalWidget
236
-
237
-
238
- type BackgroundWidgetConfig = Omit<WebComponentConfig, 'layout' | 'title'> | Omit<InternalComponentConfig, 'layout' | 'title'> | Omit<IFrameConfig, 'layout' | 'title'> | Omit<FunctionalWidget, 'layout'>
239
173
  /**
240
- * Dashboard rendered widgets configuration specification.
241
- * 3 types of widgets are supported: `"iframe"`, `"internal"`, and `"web-component"`.
242
- * A specific configuration should be provided based on the type of the widget.
174
+ * Widget type
175
+ */
176
+ type: 'iframe'
177
+ }
178
+ export interface FunctionalWidget<T extends ExecutionTime = "compiletime"> {
179
+ /**
180
+ * Provides a functional definition of the widget,
181
+ * gets triggered whenever a stac object is selected.
182
+ * @param selectedSTAC - currently selected stac object
243
183
  */
244
- interface TemplateConfig {
184
+ defineWidget: (selectedSTAC: StacCatalog | StacCollection | StacItem | null) => Omit<StaticWidget<T>, 'layout'>
185
+ layout: {
245
186
  /**
246
- * Gap between widgets
187
+ * Horizontal start position. Integer (1 - 12)
247
188
  */
248
- gap?: number;
189
+ x: number
249
190
  /**
250
- * Widget rendered as the dashboard background.
251
- * Has the same specifications of [WidgetConfig](../readme#widgetconfig) without the `title` and `layout` properties
191
+ * Vertical start position. Integer (1 - 12)
252
192
  */
253
- background?: BackgroundWidgetConfig
193
+ y: number
254
194
  /**
255
- * Array of widgets that will be rendered as dashboard panels.
195
+ * Width. Integer (1 - 12)
256
196
  */
257
- widgets: WidgetConfig[]
197
+ w: number
198
+ /**
199
+ * Height. Integer (1 - 12)
200
+ */
201
+ h: number
258
202
  }
203
+ }
204
+ export type StaticWidget<T extends ExecutionTime = "compiletime"> = WebComponentConfig<T> | InternalComponentConfig | IFrameConfig
205
+ export type WidgetConfig<T extends ExecutionTime = "compiletime"> = StaticWidget<T> | FunctionalWidget<T>
206
+
259
207
 
260
- type ExternalURL = `${'https://' | 'http://'}${string}`;
261
- type InternalRoute = `/${string}`
262
- type StacEndpoint = `${'https://' | 'http://'}${string}/catalog.json`
208
+ export type BackgroundWidgetConfig<T extends ExecutionTime = "compiletime"> = Omit<WebComponentConfig<T>, 'layout' | 'title'> | Omit<InternalComponentConfig, 'layout' | 'title'> | Omit<IFrameConfig, 'layout' | 'title'> | Omit<FunctionalWidget, 'layout'>
209
+ /**
210
+ * Dashboard rendered widgets configuration specification.
211
+ * 3 types of widgets are supported: `"iframe"`, `"internal"`, and `"web-component"`.
212
+ * A specific configuration should be provided based on the type of the widget.
213
+ */
214
+ export interface TemplateConfig<T extends ExecutionTime = "compiletime"> {
215
+ /**
216
+ * Gap between widgets
217
+ */
218
+ gap?: number;
219
+ /**
220
+ * Widget rendered as the dashboard background.
221
+ * Has the same specifications of [WidgetConfig](../readme#widgetconfig) without the `title` and `layout` properties
222
+ */
223
+ background?: BackgroundWidgetConfig<T>
224
+ /**
225
+ * Array of widgets that will be rendered as dashboard panels.
226
+ */
227
+ widgets: WidgetConfig<T>[]
228
+ }
263
229
 
230
+ export type ExternalURL = `${'https://' | 'http://'}${string}`;
231
+ export type InternalRoute = `/${string}`
232
+ export type StacEndpoint = `${'https://' | 'http://'}${string}/catalog.json`
264
233
 
234
+ export type ExecutionTime = "runtime" | "compiletime";
265
235
 
236
+ /**
237
+ * Eodash configuration specification.
238
+ */
239
+ export interface EodashConfig<T extends ExecutionTime = "compiletime"> {
266
240
  /**
267
- * Eodash configuration specification.
241
+ * Configuration ID that defines the route of the dashboard.
242
+ * Rendered dashboard can be accessed on route `/dashboard/config-id`
268
243
  */
269
- interface EodashConfig {
270
- /**
271
- * Configuration ID that defines the route of the dashboard.
272
- * Rendered dashboard can be accessed on route `/dashboard/config-id`
273
- */
274
- id: string;
244
+ id: string;
245
+ /**
246
+ * Root STAC catalog endpoint
247
+ **/
248
+ stacEndpoint: StacEndpoint
249
+ /**
250
+ * Renderes to navigation buttons on the app header.
251
+ **/
252
+ routes?: Array<{
275
253
  /**
276
- * Root STAC catalog endpoint
254
+ * button title
277
255
  **/
278
- stacEndpoint: StacEndpoint
256
+ title: string,
279
257
  /**
280
- * Renderes to navigation buttons on the app header.
281
- **/
282
- routes?: Array<{
283
- /**
284
- * button title
285
- **/
286
- title: string,
287
- /**
288
- * external URL or inner path to navigate to.
289
- **/
290
- to: ExternalURL | InternalRoute
291
- }>
258
+ * external URL or inner path to navigate to.
259
+ **/
260
+ to: ExternalURL | InternalRoute
261
+ }>
262
+ /**
263
+ * Brand specifications.
264
+ */
265
+ brand: {
292
266
  /**
293
- * Brand specifications.
267
+ * Automatically fetches the specified font family from google fonts. if the `link` property is specified
268
+ * the font family will be fetched from the provided source instead.
294
269
  */
295
- brand: {
296
- /**
297
- * Automatically fetches the specified font family from google fonts. if the `link` property is specified
298
- * the font family will be fetched from the provided source instead.
299
- */
300
- font?: {
301
- /**
302
- * Link to stylesheet that defines font-face.
303
- */
304
- link?: string;
305
- /**
306
- * Font family. Use FVD notation to include families https://github.com/typekit/fvd
307
- */
308
- family: string
309
- }
310
- /**
311
- * Title that will be shown in the app header
312
- */
313
- name: string;
314
- /**
315
- * Alias that will be shown in the app footer if specified.
316
- */
317
- shortName?: string
270
+ font?: {
318
271
  /**
319
- * brand logo
272
+ * Link to stylesheet that defines font-face.
320
273
  */
321
- logo?: string;
274
+ link?: string;
322
275
  /**
323
- * Dashboard theme as a custom vuetifyJs theme.
276
+ * Font family. Use FVD notation to include families https://github.com/typekit/fvd
324
277
  */
325
- theme?: ThemeDefinition
278
+ family: string
326
279
  }
327
280
  /**
328
- * Rendered widgets configuration
281
+ * Title that will be shown in the app header
282
+ */
283
+ name: string;
284
+ /**
285
+ * Alias that will be shown in the app footer if specified.
286
+ */
287
+ shortName?: string
288
+ /**
289
+ * brand logo
329
290
  */
330
- template: TemplateConfig
291
+ logo?: string;
292
+ /**
293
+ * Dashboard theme as a custom vuetifyJs theme.
294
+ */
295
+ theme?: ThemeDefinition
331
296
  }
332
- /////////
297
+ /**
298
+ * Rendered widgets configuration
299
+ */
300
+ template: TemplateConfig<T>
301
+ }
302
+ /////////
333
303
 
334
- /// eodash store types
335
- interface EodashStore {
304
+ /// eodash store types
305
+ export interface EodashStore {
306
+ /**
307
+ * Stateful Reactive variables
308
+ */
309
+ states: {
336
310
  /**
337
- * Stateful Reactive variables
311
+ * Currently selected STAC endpoint
338
312
  */
339
- states: {
340
- /**
341
- * Currently selected STAC endpoint
342
- */
343
- currentUrl: Ref<string>
344
- /**
345
- * OpenLayers map instance
346
- */
347
- mapInstance: Ref<Map | null>
348
- }
349
- // consider removing the actions ?
350
- actions: {
351
- loadFont: (family?: string, link?: string) => Promise<string>;
352
- };
313
+ currentUrl: Ref<string>
353
314
  /**
354
- * Pinia store definition used to navigate the root STAC catalog.
355
- */
356
- stac: {
357
- useSTAcStore: typeof useSTAcStore
358
- }
315
+ * OpenLayers map instance
316
+ */
317
+ mapInstance: Ref<Map | null>
318
+ }
319
+ // consider removing the actions ?
320
+ actions: {
321
+ loadFont: (family?: string, link?: string) => Promise<string>;
322
+ };
323
+ /**
324
+ * Pinia store definition used to navigate the root STAC catalog.
325
+ */
326
+ stac: {
327
+ useSTAcStore: typeof useSTAcStore
359
328
  }
360
- ///////
361
329
  }
362
- export type { EodashConfig, EodashStore }
330
+ ///////
331
+ export declare const defineConfig: (configCallback: (store: EodashStore) => EodashConfig | Promise<EodashConfig>) => EodashConfig
@@ -35,11 +35,11 @@ const { mainRect } = useLayout()
35
35
  onUnmounted(() => {
36
36
  theme.global.name.value = 'light'
37
37
  })
38
- if (import.meta.hot) {
39
- import.meta.hot.on('config:update', () => {
40
- window.location.reload()
41
- })
42
- }
38
+
39
+ import.meta.hot?.on('reload', () => {
40
+ window.location.reload()
41
+ })
42
+
43
43
  </script>
44
44
 
45
45
  <style scoped lang="scss">
@@ -6,26 +6,12 @@ declare module '*.vue' {
6
6
  export default component
7
7
  }
8
8
  declare interface Window {
9
- eodashStore: EodashStore
10
- }
11
- declare module '@eox/itemfilter' {
12
- export const EOxItemFilter: CustomElementConstructor
9
+ eodashStore: import("@/types").EodashStore
13
10
  }
14
11
  declare module '@eox/stacinfo' {
15
12
  export const EOxStacInfo: CustomElementConstructor
16
13
  }
17
- declare module '@eox/map' {
18
- export const EOxMap: CustomElementConstructor
19
- }
20
- declare module '@eox/chart' {
21
- export const EOxChart: CustomElementConstructor
22
- }
23
- declare module '@eox/layercontrol' {
24
- export const EOxLayerControl: CustomElementConstructor
25
- }
26
- declare module '@eox/timecontrol' {
27
- export const EOxTimeControl: CustomElementConstructor
28
- }
29
- declare module '@eox/jsonform' {
30
- export const EOxJSONForm: CustomElementConstructor
14
+ declare module 'user:config' {
15
+ const config: import("@/types").EodashConfig | Promise<import("@/types").EodashConfig>;
16
+ export default config
31
17
  }