@eodash/eodash 5.0.0-alpha.1.5 → 5.0.0-alpha.1.7

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/bin/cli.js CHANGED
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { build, createServer, preview } from "vite"
4
- import { execPath, appPath, buildTargetPath } from "./utils.js";
4
+ import { rootPath, appPath, buildTargetPath, appPublicPath } from "./utils.js";
5
5
  import { writeFile, rm, cp } from "fs/promises";
6
6
  import { update } from "./update.js";
7
7
  import { indexHtml, serverConfig } from "./serverConfig.js";
8
8
  import path from "path";
9
+ import { existsSync } from "fs";
9
10
 
10
11
 
11
12
 
12
13
  export const createDevServer = async () => {
13
- const server = await createServer(serverConfig({ mode: 'development', command: 'serve' }))
14
+ const server = await createServer(await serverConfig({ mode: 'development', command: 'serve' }))
14
15
  await server.listen()
15
16
  server.printUrls()
16
17
  server.bindCLIShortcuts({ print: true })
@@ -20,7 +21,7 @@ export const buildApp = async (baseFlag) => {
20
21
  const htmlPath = path.join(appPath, '/index.html')
21
22
  await writeFile(htmlPath, indexHtml).then(async () => {
22
23
  await update()
23
- const config = serverConfig({ mode: 'production', command: 'build' })
24
+ const config = await serverConfig({ mode: 'production', command: 'build' });
24
25
  if (baseFlag !== null) {
25
26
  config.base = baseFlag
26
27
  }
@@ -28,13 +29,15 @@ export const buildApp = async (baseFlag) => {
28
29
  await rm(htmlPath).catch(() => {
29
30
  console.error('failed to remove index.html')
30
31
  })
31
- // TODO: Do we really need to delete the public path? Creating issues
32
- // when building on template instance
33
- // await rm(path.join(appPath, './public'), { recursive: true }).catch()
32
+ if (appPath.includes('node_modules') && existsSync(appPublicPath)) {
33
+ await rm(appPublicPath, { recursive: true }).catch((e) => {
34
+ console.error(e)
35
+ })
36
+ }
34
37
  })
35
38
 
36
39
  if (appPath.includes('node_modules')) {
37
- await cp(appPath + 'dist', buildTargetPath, { recursive: true }).then(() => {
40
+ await cp(path.join(appPath, 'dist'), buildTargetPath, { recursive: true }).then(() => {
38
41
  console.info('dashboard built successfully')
39
42
  }).catch((e) => {
40
43
  console.error(e)
@@ -45,7 +48,7 @@ export const buildApp = async (baseFlag) => {
45
48
 
46
49
  export async function previewApp() {
47
50
  const previewServer = await preview({
48
- root: execPath,
51
+ root: rootPath,
49
52
  preview: {
50
53
  port: 8080,
51
54
  open: true,
@@ -1,18 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { defineConfig, searchForWorkspaceRoot } from "vite"
4
- // Plugins
3
+
4
+
5
5
  import vue from '@vitejs/plugin-vue';
6
6
  import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
7
-
8
- // Utilities
7
+ import virtual, { updateVirtualModule } from 'vite-plugin-virtual'
9
8
  import { fileURLToPath, URL } from 'url';
10
- import { configPath, appPath, dotEodashPath, execPath } from "./utils.js";
9
+ import {
10
+ runtimeConfigPath,
11
+ appPath, compiletimeConfigPath,
12
+ appPublicPath, cachePath, rootPublicPath
13
+ } from "./utils.js";
11
14
  import { readFile } from "fs/promises";
12
- import { existsSync } from "fs";
15
+ import { defineConfig, searchForWorkspaceRoot } from "vite"
16
+ import { getUserModules } from './utils.js';
17
+ import { existsSync } from 'fs';
13
18
  import path from "path";
14
19
 
15
-
16
20
  export const indexHtml = `
17
21
  <!DOCTYPE html>
18
22
  <html lang="en">
@@ -26,14 +30,18 @@ export const indexHtml = `
26
30
 
27
31
  <body>
28
32
  <div id="app"></div>
29
- <script type="module" src="${path.resolve(`/@fs/${appPath}/core/main.js`)}"></script>
33
+ <script type="module" src="${path.resolve(`/@fs/${appPath}/core/render.js`)}"></script>
30
34
  </body>
31
35
  </html>`
32
36
 
33
- export const serverConfig = defineConfig(({ mode, command }) => {
37
+ /**
38
+ * @type {import('vite').Plugin | null}
39
+ */
40
+ let virtualPlugin = null;
41
+ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(defineConfig(async ({ mode, command }) => {
34
42
  return {
35
43
  base: '',
36
- cacheDir: dotEodashPath + '/cache',
44
+ cacheDir: cachePath,
37
45
  plugins: [
38
46
  vue({
39
47
  template: {
@@ -47,10 +55,11 @@ export const serverConfig = defineConfig(({ mode, command }) => {
47
55
  vuetify({
48
56
  autoImport: true,
49
57
  }),
50
- {
51
- name: "inject-files",
52
- configureServer: mode === "development" ? configureServer : undefined
53
- }
58
+ (mode === "development" && {
59
+ name: "inject-html",
60
+ configureServer
61
+ }),
62
+ virtualPlugin = virtual(await getUserModules())
54
63
  ],
55
64
  define: { 'process.env': {} },
56
65
  resolve: {
@@ -71,7 +80,7 @@ export const serverConfig = defineConfig(({ mode, command }) => {
71
80
  include: ["webfontloader", "vuetify", "vue", "pinia"],
72
81
  noDiscovery: true,
73
82
  } : {},
74
- publicDir: command === 'build' ? path.join(appPath, './public') : path.join(execPath, '/public'),
83
+ publicDir: command === 'build' ? appPublicPath : rootPublicPath,
75
84
  build: {
76
85
  outDir: 'dist',
77
86
  rollupOptions: {
@@ -80,7 +89,7 @@ export const serverConfig = defineConfig(({ mode, command }) => {
80
89
  target: "esnext"
81
90
  }
82
91
  }
83
- });
92
+ }));
84
93
 
85
94
 
86
95
 
@@ -88,32 +97,33 @@ export const serverConfig = defineConfig(({ mode, command }) => {
88
97
  * @type {import("vite").ServerHook}
89
98
  */
90
99
  async function configureServer(server) {
91
- if (existsSync(configPath)) {
92
- server.watcher.add(configPath)
93
- }
100
+ server.watcher.add([compiletimeConfigPath, runtimeConfigPath])
94
101
 
95
102
  server.watcher.on('change', async (path) => {
96
- if (path == configPath) {
97
- server.hot.send('config:update')
103
+ if (path == runtimeConfigPath) {
104
+ server.hot.send('reload')
105
+ } else if (!path.includes('node_modules') && path.includes('.eodash')) {
106
+ updateVirtualModule(virtualPlugin, 'user:config',
107
+ await getUserModules().then(modules => modules['user:config']))
98
108
  }
99
109
  })
110
+
100
111
  return () => {
101
112
  server.middlewares.use(async (req, res, next) => {
102
- if (req.originalUrl === '/@fs/config.js' && existsSync(configPath)) {
103
- await readFile(configPath).then(config => {
113
+ if (req.originalUrl === '/@fs/config.js' && existsSync(runtimeConfigPath)) {
114
+ await readFile(runtimeConfigPath).then(runtimeConfig => {
104
115
  res.statusCode = 200
105
116
  res.setHeader('Content-Type', 'text/javascript')
106
- res.write(config)
117
+ res.write(runtimeConfig)
107
118
  res.end()
108
- }).catch()
119
+ })
109
120
  return
110
121
  }
111
122
 
112
- const url = req.url
113
- if (url?.endsWith('.html')) {
123
+ if (req.url?.endsWith('.html')) {
114
124
  res.statusCode = 200
115
125
  res.setHeader('Content-Type', 'text/html')
116
- const html = await server.transformIndexHtml(url, indexHtml, req.originalUrl)
126
+ const html = await server.transformIndexHtml(req.url, indexHtml, req.originalUrl)
117
127
  res.end(html)
118
128
  return
119
129
  }
package/bin/update.js CHANGED
@@ -1,15 +1,17 @@
1
1
  import { cp } from "fs/promises";
2
- import { execPath, appPath, configPath } from "./utils.js";
2
+ import { rootPublicPath, appPath, runtimeConfigPath, appPublicPath } from "./utils.js";
3
3
  import { existsSync } from "fs";
4
4
  import path from "path";
5
5
 
6
6
  export async function update() {
7
- if (existsSync(configPath)) {
8
- await cp(path.join(execPath, "/public"), path.join(appPath, "/public"), { recursive: true }).catch(err => {
7
+ if (rootPublicPath !== appPublicPath) {
8
+ await cp(rootPublicPath, appPublicPath, { recursive: true }).catch(err => {
9
9
  console.error(err)
10
10
  })
11
- await cp(configPath, path.join(appPath, '/public/config.js')).catch((e) => {
12
- console.error(e)
13
- })
14
- } else console.error('no config file was found');
11
+ if (existsSync(runtimeConfigPath)) {
12
+ await cp(runtimeConfigPath, path.join(appPath, '/public/config.js')).catch((e) => {
13
+ console.error(e)
14
+ })
15
+ }
16
+ }
15
17
  }
package/bin/utils.js CHANGED
@@ -1,12 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { readFile } from 'fs/promises';
4
+ import { existsSync } from 'fs';
3
5
  import path from 'path';
4
6
  import { fileURLToPath } from 'url';
7
+ import { searchForWorkspaceRoot } from 'vite';
5
8
 
6
9
  // global paths
7
- export const appPath = fileURLToPath(new URL("..", import.meta.url));
8
- export const execPath = fileURLToPath(new URL(process.cwd(), import.meta.url));
9
- export const dotEodashPath = path.join(execPath, "/.eodash");
10
- export const configPath = path.join(dotEodashPath, "/config.js");
11
- export const buildTargetPath = path.join(dotEodashPath, '/dist')
10
+ export const appPath = fileURLToPath(new URL("..", import.meta.url)),
11
+ appPublicPath = path.join(appPath, './public'),
12
+ rootPath = searchForWorkspaceRoot(process.cwd()),
13
+ rootPublicPath = path.join(rootPath, './public'),
14
+ srcPath = path.join(rootPath, "/src"),
15
+ runtimeConfigPath = path.join(srcPath, "./config.runtime.js"),
16
+ compiletimeConfigPath = path.join(srcPath, "/config.js"),
17
+ dotEodashPath = path.join(rootPath, "/.eodash"),
18
+ buildTargetPath = path.join(dotEodashPath, '/dist'),
19
+ cachePath = path.join(dotEodashPath, 'cache');
12
20
 
21
+
22
+
23
+ export const getUserModules = async () => {
24
+ /** @type {Record<string,string>} */
25
+ let userModules = {}
26
+ const indexJs = await readFile(compiletimeConfigPath, 'utf-8').catch(() => {
27
+ if (!existsSync(runtimeConfigPath)) {
28
+ console.error(new Error("no eodash configuration found"))
29
+ }
30
+ })
31
+ userModules['user:config'] = typeof indexJs === 'string' ? indexJs : ''
32
+ return userModules
33
+ }
@@ -3,6 +3,7 @@
3
3
  <component :is="tagName" v-bind="properties" ref="elementRef" />
4
4
  </span>
5
5
  </template>
6
+
6
7
  <script async setup>
7
8
  import { useSTAcStore } from '@/store/stac';
8
9
  import {
@@ -12,9 +13,9 @@ import {
12
13
  import { ref } from 'vue';
13
14
  import { useRouter } from 'vue-router';
14
15
 
15
- const props = defineProps({
16
+ const props = /** @type {WebComponentProps} */(defineProps({
16
17
  link: {
17
- type: String,
18
+ type: [String, Function],
18
19
  required: true
19
20
  },
20
21
  constructorProp: String,
@@ -30,21 +31,11 @@ const props = defineProps({
30
31
  },
31
32
  onMounted: Function,
32
33
  onUnmounted: Function
33
- })
34
+ }))
34
35
 
35
- const modulesMap = {
36
- '@eox/itemfilter': async () => await import('@eox/itemfilter'),
37
- '@eox/stacinfo': async () => await import('@eox/stacinfo'),
38
- '@eox/map': async () => await import('@eox/map'),
39
- '@eox/chart': async () => await import('@eox/chart'),
40
- '@eox/jsonform': async () => await import('@eox/jsonform'),
41
- '@eox/layercontrol': async () => await import('@eox/layercontrol'),
42
- '@eox/timecontrol': async () => await import('@eox/timecontrol')
43
- };
44
36
 
45
- const getWebComponent = async () => props.link in modulesMap ?
46
- await modulesMap[/** @type {keyof typeof modulesMap} */(props.link)]()
47
- : await import( /* @vite-ignore */props.link)
37
+ const getWebComponent = async () => typeof props.link === 'string' ?
38
+ await import( /* @vite-ignore */props.link) : await props.link()
48
39
 
49
40
  const imported = await getWebComponent().catch(e => {
50
41
  console.error(e)
@@ -68,16 +59,10 @@ const elementRef = ref(null)
68
59
  const router = useRouter()
69
60
 
70
61
  whenMounted(() => {
71
- if (props.onMounted && elementRef.value) {
72
- /** @type {DynamicWebComponentProps} */
73
- (props).onMounted(elementRef.value, store, router)
74
- }
62
+ props.onMounted?.(elementRef.value, store, router)
75
63
  })
76
64
 
77
65
  whenUnMounted(() => {
78
- if (props.onUnmounted && elementRef.value) {
79
- /** @type {DynamicWebComponentProps} */
80
- (props).onUnmounted(elementRef.value, store, router)
81
- }
66
+ props.onUnmounted?.(elementRef.value, store, router)
82
67
  })
83
68
  </script>
@@ -1,5 +1,6 @@
1
1
  import { eodashConfigKey } from "@/store/Keys"
2
2
  import { inject } from "vue"
3
+ import store from '@/store'
3
4
 
4
5
  /**
5
6
  * Sets user defined configuration on runtime.
@@ -9,17 +10,35 @@ import { inject } from "vue"
9
10
  * @see {@linkplain '@/eodashConfig.js'}
10
11
  */
11
12
  export const useEodashRuntimeConfig = async () => {
12
- const eodashConfig = inject(eodashConfigKey)
13
+ const eodashConfig = /** @type {EodashConfig} */(inject(eodashConfigKey))
14
+ /**
15
+ * @param {EodashConfig} updatedConfig
16
+ */
17
+ const assignConfig = (updatedConfig) => {
18
+ /** @type {(keyof EodashConfig)[]} */(Object.keys(eodashConfig))
19
+ .forEach((key) => {
20
+ //@ts-expect-error
21
+ eodashConfig[key] = updatedConfig[key]
22
+ })
23
+ }
13
24
 
14
25
  try {
15
- const config = (await import( /* @vite-ignore */new URL('/config.js', import.meta.url).href)).default
16
-
17
- Object.keys(eodashConfig).forEach(key => {
18
- eodashConfig[key] = config[key]
19
- })
20
- } catch (e) {
21
- console.error(e)
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")).default)
32
+ } catch {
33
+ console.error('no dashboard configuration assigned')
34
+ }
22
35
  }
23
-
24
36
  return eodashConfig
25
37
  }
38
+
39
+ /**
40
+ * @param {(store:EodashStore)=>EodashConfig} configCallback
41
+ */
42
+ export const defineCompiletimeConfig = (configCallback) => {
43
+ return configCallback(store)
44
+ }
@@ -112,7 +112,7 @@ const eodashConfig = reactive({
112
112
  title: 'Information',
113
113
  layout: { "x": 9, "y": 0, "w": 3, "h": 12 },
114
114
  widget: {
115
- link: '@eox/stacinfo',
115
+ link: async () => await import('@eox/stacinfo'),
116
116
  properties: {
117
117
  for: currentUrl,
118
118
  allowHtml: "true",
package/core/main.js CHANGED
@@ -1,15 +1,4 @@
1
1
  // Plugins
2
- import { registerPlugins } from '@/plugins';
2
+ import { defineCompiletimeConfig } from '@/composables/DefineConfig';
3
3
 
4
- // Components
5
- import App from './App.vue';
6
-
7
- // Composables
8
- import { createApp } from 'vue';
9
-
10
-
11
- const app = createApp(App);
12
-
13
- registerPlugins(app);
14
-
15
- app.mount('#app');
4
+ export { defineCompiletimeConfig as defineConfig }
@@ -13,7 +13,7 @@ const routes = [
13
13
  ];
14
14
 
15
15
  const router = createRouter({
16
- history: createWebHistory(process.env.BASE_URL),
16
+ history: createWebHistory(import.meta.env.BASE_URL),
17
17
  routes,
18
18
  });
19
19
 
package/core/render.js ADDED
@@ -0,0 +1,13 @@
1
+ import { registerPlugins } from '@/plugins';
2
+ // Components
3
+ import App from './App.vue';
4
+
5
+ // Composables
6
+ import { createApp } from 'vue';
7
+
8
+
9
+ const app = createApp(App);
10
+
11
+ registerPlugins(app);
12
+
13
+ app.mount('#app');
@@ -7,6 +7,6 @@ export const currentUrl = ref('');
7
7
 
8
8
  /**
9
9
  * ol map object. Updated by the config file.
10
- * @type {import("vue").Ref<import('ol').Map | null>}
10
+ * @type {import("vue").Ref<import('openlayers').Map | null>}
11
11
  */
12
12
  export const mapInstance = ref(null);
package/core/types.d.ts CHANGED
@@ -1,16 +1,15 @@
1
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";
4
5
 
5
6
  declare global {
6
7
  /**
7
- * Specification of web components imported from an external URL
8
+ * Web Component configuration
8
9
  */
9
- interface ExternalWebComponentProps {
10
+ interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
10
11
  /** Web component definition file URL*/
11
- link: string
12
- /** Indicates if the widget is a node module */
13
- // node_module?: false
12
+ link: T extends 'runtime' ? string : (string | (() => Promise));
14
13
  /** Exported Constructor, needs to be provided if the web component is not registered by the `link` provided */
15
14
  constructorProp?: string
16
15
  /** Custom tag name */
@@ -22,44 +21,15 @@ declare global {
22
21
  * @param el - web component
23
22
  * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
24
23
  */
25
- onMounted?: (el: Element, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
24
+ onMounted?: (el: Element | null, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
26
25
  /**
27
26
  * Function that is triggered when the web component is unmounted from the DOM.
28
27
  * @param el - web component
29
28
  * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
30
29
  */
31
- onUnmounted?: (el: Element, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
30
+ onUnmounted?: (el: Element | null, store: ReturnType<typeof useSTAcStore>, router: Router) => (Promise<void> | void)
32
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
34
  /** @ignore */
65
35
  interface WidgetsContainerProps {
@@ -73,7 +43,7 @@ declare global {
73
43
  * Installed node_module web components import should be mapped in `/core/modulesMap.ts`,
74
44
  * then setting `widget.link`:`(import-map-key)` and `node_module`:`true`
75
45
  */
76
- interface WebComponentConfig {
46
+ interface WebComponentConfig<T extends ExecutionTime = "compiletime"> {
77
47
  /**
78
48
  * Unique Identifier, triggers rerender when using `defineWidget`
79
49
  **/
@@ -103,7 +73,7 @@ declare global {
103
73
  */
104
74
  h: number
105
75
  }
106
- widget: ExternalWebComponentProps // | NodeModuleWebComponentProps
76
+ widget: WebComponentProps<T>
107
77
  /**
108
78
  * Widget type
109
79
  */
@@ -205,13 +175,13 @@ declare global {
205
175
  */
206
176
  type: 'iframe'
207
177
  }
208
- interface FunctionalWidget {
178
+ interface FunctionalWidget<T extends ExecutionTime = "compiletime"> {
209
179
  /**
210
180
  * Provides a functional definition of the widget,
211
181
  * gets triggered whenever a stac object is selected.
212
182
  * @param selectedSTAC - currently selected stac object
213
183
  */
214
- defineWidget: (selectedSTAC: StacCatalog | StacCollection | StacItem | null) => Omit<StaticWidget, 'layout'>
184
+ defineWidget: (selectedSTAC: StacCatalog | StacCollection | StacItem | null) => Omit<StaticWidget<T>, 'layout'>
215
185
  layout: {
216
186
  /**
217
187
  * Horizontal start position. Integer (1 - 12)
@@ -231,17 +201,17 @@ declare global {
231
201
  h: number
232
202
  }
233
203
  }
234
- type StaticWidget = WebComponentConfig | InternalComponentConfig | IFrameConfig
235
- type WidgetConfig = StaticWidget | FunctionalWidget
204
+ type StaticWidget<T extends ExecutionTime = "compiletime"> = WebComponentConfig<T> | InternalComponentConfig | IFrameConfig
205
+ type WidgetConfig<T extends ExecutionTime = "compiletime"> = StaticWidget<T> | FunctionalWidget<T>
236
206
 
237
207
 
238
- type BackgroundWidgetConfig = Omit<WebComponentConfig, 'layout' | 'title'> | Omit<InternalComponentConfig, 'layout' | 'title'> | Omit<IFrameConfig, 'layout' | 'title'> | Omit<FunctionalWidget, 'layout'>
208
+ type BackgroundWidgetConfig<T extends ExecutionTime = "compiletime"> = Omit<WebComponentConfig<T>, 'layout' | 'title'> | Omit<InternalComponentConfig, 'layout' | 'title'> | Omit<IFrameConfig, 'layout' | 'title'> | Omit<FunctionalWidget, 'layout'>
239
209
  /**
240
210
  * Dashboard rendered widgets configuration specification.
241
211
  * 3 types of widgets are supported: `"iframe"`, `"internal"`, and `"web-component"`.
242
212
  * A specific configuration should be provided based on the type of the widget.
243
213
  */
244
- interface TemplateConfig {
214
+ interface TemplateConfig<T extends ExecutionTime = "compiletime"> {
245
215
  /**
246
216
  * Gap between widgets
247
217
  */
@@ -250,23 +220,23 @@ declare global {
250
220
  * Widget rendered as the dashboard background.
251
221
  * Has the same specifications of [WidgetConfig](../readme#widgetconfig) without the `title` and `layout` properties
252
222
  */
253
- background?: BackgroundWidgetConfig
223
+ background?: BackgroundWidgetConfig<T>
254
224
  /**
255
225
  * Array of widgets that will be rendered as dashboard panels.
256
226
  */
257
- widgets: WidgetConfig[]
227
+ widgets: WidgetConfig<T>[]
258
228
  }
259
229
 
260
230
  type ExternalURL = `${'https://' | 'http://'}${string}`;
261
231
  type InternalRoute = `/${string}`
262
232
  type StacEndpoint = `${'https://' | 'http://'}${string}/catalog.json`
263
233
 
264
-
234
+ type ExecutionTime = "runtime" | "compiletime";
265
235
 
266
236
  /**
267
237
  * Eodash configuration specification.
268
238
  */
269
- interface EodashConfig {
239
+ interface EodashConfig<T extends ExecutionTime = "compiletime"> {
270
240
  /**
271
241
  * Configuration ID that defines the route of the dashboard.
272
242
  * Rendered dashboard can be accessed on route `/dashboard/config-id`
@@ -327,7 +297,7 @@ declare global {
327
297
  /**
328
298
  * Rendered widgets configuration
329
299
  */
330
- template: TemplateConfig
300
+ template: TemplateConfig<T>
331
301
  }
332
302
  /////////
333
303
 
@@ -360,3 +330,4 @@ declare global {
360
330
  ///////
361
331
  }
362
332
  export type { EodashConfig, EodashStore }
333
+ export declare const defineConfig: typeof defineCompiletimeConfig
@@ -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">
@@ -29,3 +29,7 @@ declare module '@eox/timecontrol' {
29
29
  declare module '@eox/jsonform' {
30
30
  export const EOxJSONForm: CustomElementConstructor
31
31
  }
32
+ declare module 'user:config' {
33
+ const config: EodashConfig;
34
+ export default config
35
+ }
package/package.json CHANGED
@@ -1,14 +1,20 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.1.5",
3
+ "version": "5.0.0-alpha.1.7",
4
4
  "type": "module",
5
- "types": "core/types.d.ts",
5
+ "types": "./core/types.d.ts",
6
6
  "files": [
7
7
  "core",
8
8
  "bin",
9
9
  "widgets"
10
10
  ],
11
- "browser": "./dist/index.html",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./core/types.d.ts",
14
+ "default": "./core/main.js"
15
+ }
16
+ },
17
+ "browser": "./core/main.js",
12
18
  "scripts": {
13
19
  "dev": "npx eodash dev",
14
20
  "build": "npx eodash build",
@@ -20,15 +26,8 @@
20
26
  "docs:generate": "typedoc --plugin typedoc-plugin-markdown core/store/Types.ts --tsconfig tsconfig.json --out docs --readme none"
21
27
  },
22
28
  "dependencies": {
23
- "@eox/chart": "^2.0.0-beta2",
24
- "@eox/drawtools": "^0.6.1",
25
- "@eox/itemfilter": "^0.12.1",
26
- "@eox/jsonform": "^0.2.1",
27
- "@eox/layercontrol": "^0.15.1",
28
29
  "@eox/layout": "^0.1.0",
29
- "@eox/map": "^1.1.0",
30
30
  "@eox/stacinfo": "^0.3.0",
31
- "@eox/timecontrol": "^0.3.0",
32
31
  "@mdi/font": "7.0.96",
33
32
  "@vitejs/plugin-vue": "^5.0.0",
34
33
  "animated-details": "gist:2912bb049fa906671807415eb0e87188",
@@ -37,6 +36,7 @@
37
36
  "pinia": "^2.0.0",
38
37
  "roboto-fontface": "*",
39
38
  "vite": "^5.1.5",
39
+ "vite-plugin-virtual": "^0.3.0",
40
40
  "vite-plugin-vuetify": "^2.0.0",
41
41
  "vue": "^3.2.0",
42
42
  "vue-router": "^4.0.0",