@eodash/eodash 5.0.0-alpha.1.1 → 5.0.0-alpha.1.11

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,333 +1,349 @@
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
- import { defineCompiletimeConfig } from "./composables/DefineConfig";
5
-
6
- 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>
7
19
  /**
8
- * Web Component configuration
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`
9
23
  */
10
- interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
11
- /** Web component definition file URL*/
12
- link: T extends 'runtime' ? string : (string | (() => Promise));
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>
19
- /**
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`
23
- */
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
- }
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
+ }
32
32
 
33
33
 
34
- /** @ignore */
35
- interface WidgetsContainerProps {
36
- widgets: Omit<WidgetConfig, 'layout'>[]
37
- }
34
+ /** @ignore */
35
+ export interface WidgetsContainerProps {
36
+ widgets: Omit<Widget, 'layout'>[]
37
+ }
38
38
 
39
- // eodash config types:
39
+ // eodash 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 WebComponentWidget<T extends ExecutionTime = "compiletime"> {
47
+ /**
48
+ * Unique Identifier, triggers rerender when using `defineWidget`
49
+ **/
50
+ id: number | string | symbol
40
51
  /**
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`
52
+ * Widget title
45
53
  */
46
- interface WebComponentConfig<T extends ExecutionTime = "compiletime"> {
54
+ title: string
55
+ /**
56
+ * Widget position and size.
57
+ */
58
+ layout: {
47
59
  /**
48
- * Unique Identifier, triggers rerender when using `defineWidget`
49
- **/
50
- id: number | string | symbol
60
+ * Horizontal start position. Integer (1 - 12)
61
+ */
62
+ x: number
51
63
  /**
52
- * Widget title
64
+ * Vertical start position. Integer (1 - 12)
53
65
  */
54
- title: string
66
+ y: number
55
67
  /**
56
- * Widget position and size.
68
+ * Width. Integer (1 - 12)
57
69
  */
58
- layout: {
59
- /**
60
- * Horizontal start position. Integer (1 - 12)
61
- */
62
- x: number
63
- /**
64
- * Vertical start position. Integer (1 - 12)
65
- */
66
- y: number
67
- /**
68
- * Width. Integer (1 - 12)
69
- */
70
- w: number
71
- /**
72
- * Height. Integer (1 - 12)
73
- */
74
- h: number
75
- }
76
- widget: WebComponentProps<T>
70
+ w: number
77
71
  /**
78
- * Widget type
72
+ * Height. Integer (1 - 12)
79
73
  */
80
- type: 'web-component'
74
+ h: number
81
75
  }
76
+ widget: WebComponentProps<T>
77
+ /**
78
+ * Widget type
79
+ */
80
+ type: 'web-component'
81
+ }
82
82
 
83
+ /**
84
+ * Widget type: `internal` specification.
85
+ * Internal widgets are Vue components inside the `/widgets` directory.
86
+ */
87
+ export interface InternalComponentWidget {
88
+ /**
89
+ * Unique Identifier, triggers rerender when using `defineWidget`
90
+ **/
91
+ id: number | string | symbol
83
92
  /**
84
- * Widget type: `internal` specification.
85
- * Internal widgets are Vue components inside the `/widgets` directory.
93
+ * Widget title
86
94
  */
87
- interface InternalComponentConfig {
95
+ title: string
96
+ /**
97
+ * Widget position and size.
98
+ */
99
+ layout: {
88
100
  /**
89
- * Unique Identifier, triggers rerender when using `defineWidget`
90
- **/
91
- id: number | string | symbol
101
+ * Horizontal start position. Integer (1 - 12)
102
+ */
103
+ x: number
92
104
  /**
93
- * Widget title
105
+ * Vertical start position. Integer (1 - 12)
94
106
  */
95
- title: string
107
+ y: number
96
108
  /**
97
- * Widget position and size.
98
- */
99
- layout: {
100
- /**
101
- * Horizontal start position. Integer (1 - 12)
102
- */
103
- x: number
104
- /**
105
- * Vertical start position. Integer (1 - 12)
106
- */
107
- y: number
108
- /**
109
- * Width. Integer (1 - 12)
110
- */
111
- w: number
112
- /**
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>
126
- }
109
+ * Width. Integer (1 - 12)
110
+ */
111
+ w: number
127
112
  /**
128
- * Widget type.
129
- */
130
- type: 'internal'
113
+ * Height. Integer (1 - 12)
114
+ */
115
+ h: number
131
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>
126
+ }
127
+ /**
128
+ * Widget type.
129
+ */
130
+ type: 'internal'
131
+ }
132
132
 
133
+ /**
134
+ * Widget type: `iframe` specification.
135
+ * Renders an external HTML file as a widget.
136
+ */
137
+ export interface IFrameWidget {
133
138
  /**
134
- * Widget type: `iframe` specification.
135
- * Renders an external HTML file as a widget.
136
- */
137
- 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: {
138
150
  /**
139
- * Unique Identifier, triggers rerender when using `defineWidget`
140
- **/
141
- id: number | string | symbol
151
+ * Horizontal start position. Integer (1 - 12)
152
+ */
153
+ x: number
142
154
  /**
143
- * Widget title
144
- */
145
- title: string
155
+ * Vertical start position. Integer (1 - 12)
156
+ */
157
+ y: number
146
158
  /**
147
- * Widget position and size.
148
- */
149
- layout: {
150
- /**
151
- * Horizontal start position. Integer (1 - 12)
152
- */
153
- x: number
154
- /**
155
- * Vertical start position. Integer (1 - 12)
156
- */
157
- y: number
158
- /**
159
- * Width. Integer (1 - 12)
160
- */
161
- w: number
162
- /**
163
- * Height. Integer (1 - 12)
164
- */
165
- h: number
166
- }
167
- widget: {
168
- /**
169
- * The URL of the page to embed
170
- */
171
- src: string
172
- }
159
+ * Width. Integer (1 - 12)
160
+ */
161
+ w: number
173
162
  /**
174
- * Widget type
175
- */
176
- type: 'iframe'
163
+ * Height. Integer (1 - 12)
164
+ */
165
+ h: number
177
166
  }
178
- interface FunctionalWidget<T extends ExecutionTime = "compiletime"> {
167
+ widget: {
179
168
  /**
180
- * Provides a functional definition of the widget,
181
- * gets triggered whenever a stac object is selected.
182
- * @param selectedSTAC - currently selected stac object
169
+ * The URL of the page to embed
183
170
  */
184
- defineWidget: (selectedSTAC: StacCatalog | StacCollection | StacItem | null) => Omit<StaticWidget<T>, 'layout'>
185
- layout: {
186
- /**
187
- * Horizontal start position. Integer (1 - 12)
188
- */
189
- x: number
190
- /**
191
- * Vertical start position. Integer (1 - 12)
192
- */
193
- y: number
194
- /**
195
- * Width. Integer (1 - 12)
196
- */
197
- w: number
198
- /**
199
- * Height. Integer (1 - 12)
200
- */
201
- h: number
202
- }
171
+ src: string
203
172
  }
204
- type StaticWidget<T extends ExecutionTime = "compiletime"> = WebComponentConfig<T> | InternalComponentConfig | IFrameConfig
205
- type WidgetConfig<T extends ExecutionTime = "compiletime"> = StaticWidget<T> | FunctionalWidget<T>
206
-
207
-
208
- type BackgroundWidgetConfig<T extends ExecutionTime = "compiletime"> = Omit<WebComponentConfig<T>, 'layout' | 'title'> | Omit<InternalComponentConfig, 'layout' | 'title'> | Omit<IFrameConfig, 'layout' | 'title'> | Omit<FunctionalWidget, 'layout'>
209
173
  /**
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.
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
213
183
  */
214
- interface TemplateConfig<T extends ExecutionTime = "compiletime"> {
184
+ defineWidget: (selectedSTAC: StacCatalog | StacCollection | StacItem | null) => Omit<StaticWidget<T>, 'layout'>
185
+ layout: {
215
186
  /**
216
- * Gap between widgets
187
+ * Horizontal start position. Integer (1 - 12)
217
188
  */
218
- gap?: number;
189
+ x: number
219
190
  /**
220
- * Widget rendered as the dashboard background.
221
- * Has the same specifications of [WidgetConfig](../readme#widgetconfig) without the `title` and `layout` properties
191
+ * Vertical start position. Integer (1 - 12)
222
192
  */
223
- background?: BackgroundWidgetConfig<T>
193
+ y: number
224
194
  /**
225
- * Array of widgets that will be rendered as dashboard panels.
195
+ * Width. Integer (1 - 12)
226
196
  */
227
- widgets: WidgetConfig<T>[]
197
+ w: number
198
+ /**
199
+ * Height. Integer (1 - 12)
200
+ */
201
+ h: number
228
202
  }
203
+ }
204
+ export type StaticWidget<T extends ExecutionTime = "compiletime"> = WebComponentWidget<T> | InternalComponentWidget | IFrameWidget
205
+ export type Widget<T extends ExecutionTime = "compiletime"> = StaticWidget<T> | FunctionalWidget<T>
206
+
207
+
208
+ export type BackgroundWidget<T extends ExecutionTime = "compiletime"> = Omit<WebComponentWidget<T>, 'layout' | 'title'> | Omit<InternalComponentWidget, 'layout' | 'title'> | Omit<IFrameWidget, 'layout' | 'title'> | Omit<FunctionalWidget, 'layout'>
209
+ /**
210
+ * Dashboard rendered widgets specification.
211
+ * 3 types of widgets are supported: `"iframe"`, `"internal"`, and `"web-component"`.
212
+ * A specific object should be provided based on the type of the widget.
213
+ */
214
+ export interface Template<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 [Widget](../readme#widget) without the `title` and `layout` properties
222
+ */
223
+ background?: BackgroundWidget<T>
224
+ /**
225
+ * Array of widgets that will be rendered as dashboard panels.
226
+ */
227
+ widgets: Widget<T>[]
228
+ }
229
229
 
230
- type ExternalURL = `${'https://' | 'http://'}${string}`;
231
- type InternalRoute = `/${string}`
232
- type StacEndpoint = `${'https://' | 'http://'}${string}/catalog.json`
230
+ export type ExternalURL = `${'https://' | 'http://'}${string}`;
231
+ export type InternalRoute = `/${string}`
232
+ export type StacEndpoint = `${'https://' | 'http://'}${string}/catalog.json`
233
233
 
234
- type ExecutionTime = "runtime" | "compiletime";
234
+ export type ExecutionTime = "runtime" | "compiletime";
235
235
 
236
+ /**
237
+ * Eodash instance specification.
238
+ */
239
+ export interface Eodash<T extends ExecutionTime = "compiletime"> {
236
240
  /**
237
- * Eodash configuration specification.
241
+ * Instance ID.
238
242
  */
239
- interface EodashConfig<T extends ExecutionTime = "compiletime"> {
240
- /**
241
- * Configuration ID that defines the route of the dashboard.
242
- * Rendered dashboard can be accessed on route `/dashboard/config-id`
243
- */
244
- id: string;
243
+ id: string;
244
+ /**
245
+ * Root STAC catalog endpoint
246
+ **/
247
+ stacEndpoint: StacEndpoint
248
+ /**
249
+ * Renderes to navigation buttons on the app header.
250
+ **/
251
+ routes?: Array<{
245
252
  /**
246
- * Root STAC catalog endpoint
253
+ * button title
247
254
  **/
248
- stacEndpoint: StacEndpoint
255
+ title: string,
249
256
  /**
250
- * Renderes to navigation buttons on the app header.
251
- **/
252
- routes?: Array<{
253
- /**
254
- * button title
255
- **/
256
- title: string,
257
- /**
258
- * external URL or inner path to navigate to.
259
- **/
260
- to: ExternalURL | InternalRoute
261
- }>
257
+ * external URL or inner path to navigate to.
258
+ **/
259
+ to: ExternalURL | InternalRoute
260
+ }>
261
+ /**
262
+ * Brand specifications.
263
+ */
264
+ brand: {
262
265
  /**
263
- * Brand specifications.
266
+ * Automatically fetches the specified font family from google fonts. if the `link` property is specified
267
+ * the font family will be fetched from the provided source instead.
264
268
  */
265
- brand: {
266
- /**
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.
269
- */
270
- font?: {
271
- /**
272
- * Link to stylesheet that defines font-face.
273
- */
274
- link?: string;
275
- /**
276
- * Font family. Use FVD notation to include families https://github.com/typekit/fvd
277
- */
278
- family: string
279
- }
280
- /**
281
- * Title that will be shown in the app header
282
- */
283
- name: string;
269
+ font?: {
284
270
  /**
285
- * Alias that will be shown in the app footer if specified.
271
+ * Link to stylesheet that defines font-face.
286
272
  */
287
- shortName?: string
273
+ link?: string;
288
274
  /**
289
- * brand logo
275
+ * Font family. Use FVD notation to include families https://github.com/typekit/fvd
290
276
  */
291
- logo?: string;
292
- /**
293
- * Dashboard theme as a custom vuetifyJs theme.
294
- */
295
- theme?: ThemeDefinition
277
+ family: string
296
278
  }
297
279
  /**
298
- * Rendered widgets configuration
280
+ * Title that will be shown in the app header
299
281
  */
300
- template: TemplateConfig<T>
282
+ name: string;
283
+ /**
284
+ * Alias that will be shown in the app footer if specified.
285
+ */
286
+ shortName?: string
287
+ /**
288
+ * brand logo
289
+ */
290
+ logo?: string;
291
+ /**
292
+ * Dashboard theme as a custom vuetifyJs theme.
293
+ */
294
+ theme?: ThemeDefinition
301
295
  }
302
- /////////
296
+ /**
297
+ * Template configuration
298
+ */
299
+ template: Template<T>
300
+ }
301
+ /////////
303
302
 
304
- /// eodash store types
305
- interface EodashStore {
303
+ /// eodash store types
304
+ export interface EodashStore {
305
+ /**
306
+ * Stateful Reactive variables
307
+ */
308
+ states: {
306
309
  /**
307
- * Stateful Reactive variables
310
+ * Currently selected STAC endpoint
308
311
  */
309
- states: {
310
- /**
311
- * Currently selected STAC endpoint
312
- */
313
- currentUrl: Ref<string>
314
- /**
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
- };
312
+ currentUrl: Ref<string>
323
313
  /**
324
- * Pinia store definition used to navigate the root STAC catalog.
325
- */
326
- stac: {
327
- useSTAcStore: typeof useSTAcStore
328
- }
314
+ * OpenLayers map instance
315
+ */
316
+ mapInstance: Ref<Map | null>
317
+ }
318
+ // consider removing the actions ?
319
+ actions: {
320
+ loadFont: (family?: string, link?: string) => Promise<string>;
321
+ };
322
+ /**
323
+ * Pinia store definition used to navigate the root STAC catalog.
324
+ */
325
+ stac: {
326
+ useSTAcStore: typeof useSTAcStore
329
327
  }
330
- ///////
331
328
  }
332
- export type { EodashConfig, EodashStore }
333
- export declare const defineConfig: typeof defineCompiletimeConfig
329
+ ///////
330
+ export interface EodashConfig {
331
+ dev?: {
332
+ port?: string | number
333
+ host?: string | boolean
334
+ open?: boolean
335
+ }
336
+ preview?: {
337
+ port?: string | number
338
+ host?: string | boolean
339
+ open?: boolean
340
+ }
341
+ base?: string;
342
+ outDir?: string;
343
+ publicDir?: string | false;
344
+ cacheDir?: string
345
+ entryPoint?: string
346
+ runtime?: string
347
+ }
348
+
349
+ export declare const createEodash: (configCallback: (store: EodashStore) => Eodash | Promise<Eodash>) => Eodash
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script setup>
8
- import { useEodashRuntimeConfig } from "@/composables/DefineConfig";
8
+ import { useEodashRuntime } from "@/composables/DefineEodash";
9
9
  import { useUpdateTheme } from "@/composables";
10
10
  import { useSTAcStore } from '@/store/stac';
11
11
  import { defineAsyncComponent } from "vue";
@@ -14,7 +14,7 @@ import { loadFont } from '@/store/Actions'
14
14
  import { onUnmounted } from "vue";
15
15
 
16
16
 
17
- const eodashConfig = await useEodashRuntimeConfig()
17
+ const eodashConfig = await useEodashRuntime()
18
18
 
19
19
  const theme = useUpdateTheme('dashboardTheme', eodashConfig.brand?.theme)
20
20
  theme.global.name.value = 'dashboardTheme'
@@ -47,3 +47,4 @@ import.meta.hot?.on('reload', () => {
47
47
  font-family: v-bind('fontFamily');
48
48
  }
49
49
  </style>
50
+ @/composables/DefineEodash
@@ -6,30 +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
31
- }
32
14
  declare module 'user:config' {
33
- const config: EodashConfig;
34
- export default config
15
+ const eodash: import("@/types").Eodash | Promise<import("@/types").Eodash>;
16
+ export default eodash
35
17
  }