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

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/app.js CHANGED
@@ -4,15 +4,12 @@ import { buildApp, createDevServer, previewApp } from './cli.js'
4
4
 
5
5
  const command = process.argv?.[2];
6
6
  (async () => {
7
- const baseFlag = (
8
- process.argv.indexOf('--base') > -1 ? process.argv[process.argv.indexOf('--base')+1] : null
9
- );
10
7
  switch (command) {
11
8
  case "dev":
12
9
  await createDevServer();
13
10
  break;
14
11
  case "build":
15
- await buildApp(baseFlag);
12
+ await buildApp();
16
13
  break;
17
14
  case "preview":
18
15
  await previewApp();
package/bin/cli.js CHANGED
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { build, createServer, preview } from "vite"
4
- import { rootPath, appPath, buildTargetPath, appPublicPath } from "./utils.js";
4
+ import {
5
+ rootPath, appPath, buildTargetPath,
6
+ userConfig, runtimeConfigPath,
7
+ } from "./utils.js";
5
8
  import { writeFile, rm, cp } from "fs/promises";
6
- import { update } from "./update.js";
7
9
  import { indexHtml, serverConfig } from "./serverConfig.js";
8
10
  import path from "path";
9
11
  import { existsSync } from "fs";
10
12
 
11
13
 
12
-
13
14
  export const createDevServer = async () => {
14
15
  const server = await createServer(await serverConfig({ mode: 'development', command: 'serve' }))
15
16
  await server.listen()
@@ -17,44 +18,37 @@ export const createDevServer = async () => {
17
18
  server.bindCLIShortcuts({ print: true })
18
19
  }
19
20
 
20
- export const buildApp = async (baseFlag) => {
21
+ export const buildApp = async () => {
21
22
  const htmlPath = path.join(appPath, '/index.html')
22
23
  await writeFile(htmlPath, indexHtml).then(async () => {
23
- await update()
24
24
  const config = await serverConfig({ mode: 'production', command: 'build' });
25
- if (baseFlag !== null) {
26
- config.base = baseFlag
27
- }
28
25
  await build(config)
26
+
27
+ if (existsSync(runtimeConfigPath)) {
28
+ await cp(runtimeConfigPath, path.join(buildTargetPath, 'config.js'),
29
+ { recursive: true }).catch((e) => {
30
+ console.error(e)
31
+ })
32
+ }
33
+
29
34
  await rm(htmlPath).catch(() => {
30
35
  console.error('failed to remove index.html')
31
36
  })
32
- if (appPath.includes('node_modules') && existsSync(appPublicPath)) {
33
- await rm(appPublicPath, { recursive: true }).catch((e) => {
34
- console.error(e)
35
- })
36
- }
37
37
  })
38
-
39
- if (appPath.includes('node_modules')) {
40
- await cp(path.join(appPath, 'dist'), buildTargetPath, { recursive: true }).then(() => {
41
- console.info('dashboard built successfully')
42
- }).catch((e) => {
43
- console.error(e)
44
- })
45
- }
46
38
  }
47
39
 
48
40
 
49
41
  export async function previewApp() {
50
42
  const previewServer = await preview({
51
43
  root: rootPath,
44
+ base: userConfig.base ?? '',
52
45
  preview: {
53
- port: 8080,
54
- open: true,
46
+ port: userConfig.port ?? 8080,
47
+ open: userConfig.open,
48
+ host: userConfig.host
55
49
  },
56
50
  build: {
57
- outDir: buildTargetPath
51
+ outDir: buildTargetPath,
58
52
  }
59
53
  })
60
54
  previewServer.printUrls()
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
-
4
-
5
3
  import vue from '@vitejs/plugin-vue';
6
4
  import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
7
5
  import virtual, { updateVirtualModule } from 'vite-plugin-virtual'
@@ -9,7 +7,8 @@ import { fileURLToPath, URL } from 'url';
9
7
  import {
10
8
  runtimeConfigPath,
11
9
  appPath, compiletimeConfigPath,
12
- appPublicPath, cachePath, rootPublicPath
10
+ cachePath, publicPath, userConfig,
11
+ buildTargetPath
13
12
  } from "./utils.js";
14
13
  import { readFile } from "fs/promises";
15
14
  import { defineConfig, searchForWorkspaceRoot } from "vite"
@@ -40,7 +39,7 @@ export const indexHtml = `
40
39
  let virtualPlugin = null;
41
40
  export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(defineConfig(async ({ mode, command }) => {
42
41
  return {
43
- base: '',
42
+ base: userConfig.base ?? '',
44
43
  cacheDir: cachePath,
45
44
  plugins: [
46
45
  vue({
@@ -70,19 +69,23 @@ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(def
70
69
  extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
71
70
  },
72
71
  server: {
73
- port: 3000,
72
+ port: userConfig.port ?? 3000,
73
+ open: userConfig.open,
74
74
  fs: {
75
75
  allow: [searchForWorkspaceRoot(process.cwd())]
76
76
  },
77
+ host: userConfig.host
77
78
  },
78
79
  root: fileURLToPath(new URL('..', import.meta.url)),
79
80
  optimizeDeps: mode === "development" ? {
80
81
  include: ["webfontloader", "vuetify", "vue", "pinia"],
81
82
  noDiscovery: true,
82
83
  } : {},
83
- publicDir: command === 'build' ? appPublicPath : rootPublicPath,
84
+ /** @type {string|false} */
85
+ publicDir: userConfig.publicDir === false ? false : publicPath,
84
86
  build: {
85
- outDir: 'dist',
87
+ outDir: buildTargetPath,
88
+ emptyOutDir: true,
86
89
  rollupOptions: {
87
90
  input: fileURLToPath(new URL(command === 'build' ? '../index.html' : '../core/main.js', import.meta.url)),
88
91
  },
@@ -102,7 +105,7 @@ async function configureServer(server) {
102
105
  server.watcher.on('change', async (path) => {
103
106
  if (path == runtimeConfigPath) {
104
107
  server.hot.send('reload')
105
- } else if (!path.includes('node_modules') && path.includes('.eodash')) {
108
+ } else if (path === compiletimeConfigPath) {
106
109
  updateVirtualModule(virtualPlugin, 'user:config',
107
110
  await getUserModules().then(modules => modules['user:config']))
108
111
  }
package/bin/utils.js CHANGED
@@ -1,23 +1,43 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { readFile } from 'fs/promises';
4
- import { existsSync } from 'fs';
4
+ import { existsSync, readFileSync } from 'fs';
5
5
  import path from 'path';
6
6
  import { fileURLToPath } from 'url';
7
7
  import { searchForWorkspaceRoot } from 'vite';
8
+ import { Command } from 'commander';
9
+ const cli = new Command('eodash')
8
10
 
9
- // global paths
11
+ const pkg = JSON.parse(
12
+ readFileSync(
13
+ fileURLToPath(new URL('../package.json', import.meta.url))
14
+ , 'utf-8')
15
+ );
16
+
17
+ cli.version(pkg.version, '-v, --version', 'output the current version')
18
+ .option('--publicDir <path>', 'path to statically served assets folder')
19
+ .option('--no-publicDir', 'stop serving static assets')
20
+ .option('--outDir <path>', 'minified output folder')
21
+ .option('-e, --entryPoint <path>', 'file exporting `defineConfig`')
22
+ .option('-c, --cacheDir <path>', 'cache folder')
23
+ .option('-r, --runtime <path>', 'file exporting eodash runtime config')
24
+ .option('-b, --base <path>', 'base public path')
25
+ .option('-p, --port <port>', 'serving port')
26
+ .option('-o, --open', 'open default browser when the server starts')
27
+ .option('--host [IP address]', 'specify which IP addresses the server should listen on')
28
+ .parse(process.argv)
29
+
30
+
31
+ export const userConfig = cli.opts()
10
32
  export const appPath = fileURLToPath(new URL("..", import.meta.url)),
11
- appPublicPath = path.join(appPath, './public'),
12
33
  rootPath = searchForWorkspaceRoot(process.cwd()),
13
- rootPublicPath = path.join(rootPath, './public'),
34
+ publicPath = userConfig.publicDir ? path.resolve(rootPath, userConfig.publicDir) : path.join(rootPath, './public'),
14
35
  srcPath = path.join(rootPath, "/src"),
15
- runtimeConfigPath = path.join(srcPath, "./config.runtime.js"),
16
- compiletimeConfigPath = path.join(srcPath, "/config.js"),
36
+ runtimeConfigPath = userConfig.runtime ? path.resolve(rootPath, userConfig.runtime) : path.join(srcPath, "./config.runtime.js"),
37
+ compiletimeConfigPath = userConfig.entryPoint ? path.resolve(rootPath, userConfig.entryPoint) : path.join(srcPath, "/config.js"),
17
38
  dotEodashPath = path.join(rootPath, "/.eodash"),
18
- buildTargetPath = path.join(dotEodashPath, '/dist'),
19
- cachePath = path.join(dotEodashPath, 'cache');
20
-
39
+ buildTargetPath = userConfig.outDir ? path.resolve(rootPath, userConfig.outDir) : path.join(dotEodashPath, '/dist'),
40
+ cachePath = userConfig.cacheDir ? path.resolve(rootPath, userConfig.cacheDir) : path.join(dotEodashPath, 'cache');
21
41
 
22
42
 
23
43
  export const getUserModules = async () => {
@@ -18,7 +18,7 @@
18
18
  </eox-layout>
19
19
  </v-main>
20
20
  </template>
21
- <script setup >
21
+ <script setup>
22
22
  import { eodashConfigKey } from '@/store/Keys';
23
23
  import { inject } from 'vue';
24
24
  import { useDefineWidgets } from '@/composables/DefineWidgets'
@@ -26,7 +26,7 @@ import { useSlidePanels } from '@/composables'
26
26
  import { ref } from 'vue';
27
27
  import '@eox/layout'
28
28
 
29
- const eodashConfig = /** @type {EodashConfig} */ (inject(eodashConfigKey))
29
+ const eodashConfig = /** @type {import("@/types").EodashConfig} */ (inject(eodashConfigKey))
30
30
 
31
31
  const [bgWidget] = useDefineWidgets([eodashConfig.template?.background])
32
32
 
@@ -13,7 +13,7 @@ import {
13
13
  import { ref } from 'vue';
14
14
  import { useRouter } from 'vue-router';
15
15
 
16
- const props = /** @type {WebComponentProps} */(defineProps({
16
+ const props = /** @type {import("@/types").WebComponentProps} */(defineProps({
17
17
  link: {
18
18
  type: [String, Function],
19
19
  required: true
@@ -37,9 +37,9 @@ const props = /** @type {WebComponentProps} */(defineProps({
37
37
  const getWebComponent = async () => typeof props.link === 'string' ?
38
38
  await import( /* @vite-ignore */props.link) : await props.link()
39
39
 
40
- const imported = await getWebComponent().catch(e => {
40
+ const imported = !customElements.get(props.tagName) ? await getWebComponent().catch(e => {
41
41
  console.error(e)
42
- })
42
+ }) : null
43
43
 
44
44
  const defined = customElements.get(props.tagName)
45
45
 
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <v-footer ref="footer" :height="mdAndDown ? '48px' : 'auto'" color="secondary" app class="d-flex justify-space-between">
2
+ <v-footer ref="footer" :height="mdAndDown ? '48px' : 'auto'" color="secondary" app
3
+ class="d-flex justify-space-between">
3
4
  <p class="pt-0 footer-text">
4
5
  Phasellus feugiat arcu sapien, et iaculis ipsum elementum sit amet. Mauris cursus commodo interdum.
5
6
  </p>
@@ -19,7 +20,7 @@ import { useDisplay } from 'vuetify/lib/framework.mjs';
19
20
  * @type {import('vue').Ref<import('vuetify/lib/components/index.mjs').VFooter | null>}
20
21
  */
21
22
  const footer = ref(null)
22
- const eodashConfig = /** @type {EodashConfig} */(inject(eodashConfigKey))
23
+ const eodashConfig = /** @type {import("@/types").EodashConfig} */(inject(eodashConfigKey))
23
24
 
24
25
  const title = eodashConfig.brand?.shortName ?? eodashConfig.brand?.name
25
26
  const { mdAndDown } = useDisplay()
@@ -14,7 +14,7 @@ import { eodashConfigKey } from '@/store/Keys';
14
14
  import { inject } from 'vue';
15
15
  import { useRouter } from 'vue-router';
16
16
 
17
- const eodashConfig = /** @type {EodashConfig} */(inject(eodashConfigKey))
17
+ const eodashConfig = /** @type {import("@/types").EodashConfig} */(inject(eodashConfigKey))
18
18
 
19
19
  const title = eodashConfig.brand?.name
20
20
 
@@ -6,7 +6,8 @@
6
6
  <v-row no-gutters class="d-flex justify-center align-end">
7
7
  <v-col v-for="(importedWidget, idx) in importedWidgets" :key="idx" :cols="cols"
8
8
  class="flex-column fill-height fill-width elevation-1 align-start ma-0 justify-center">
9
- <span class="d-flex pa-2 justify-center ma-0 panel-header align-center fill-width" @click="handleSelection(idx)">
9
+ <span class="d-flex pa-2 justify-center ma-0 panel-header align-center fill-width"
10
+ @click="handleSelection(idx)">
10
11
  {{ importedWidget.value.title }}
11
12
  </span>
12
13
  <div v-show="activeIdx === idx" class="overlay align-self-end overflow-auto pa-2">
@@ -24,7 +25,7 @@ import { inject } from 'vue';
24
25
  import { useDefineWidgets } from '@/composables/DefineWidgets'
25
26
  import { ref } from 'vue';
26
27
 
27
- const eodashConfig = /** @type {EodashConfig} */(inject(eodashConfigKey));
28
+ const eodashConfig = /** @type {import("@/types").EodashConfig} */(inject(eodashConfigKey));
28
29
 
29
30
  //import widgets
30
31
  const widgetsConfig = eodashConfig.template.widgets
@@ -74,6 +75,4 @@ const handleSelection = (idx) => {
74
75
  .close-btn {
75
76
  justify-self: end;
76
77
  }
77
-
78
- //
79
78
  </style>
@@ -6,16 +6,16 @@ import store from '@/store'
6
6
  * Sets user defined configuration on runtime.
7
7
  * Consumes `/config.js` file from the base URL, and assign it to `eodashConfig`
8
8
  * @async
9
- * @returns {Promise<EodashConfig>}
9
+ * @returns {Promise<import("@/types").EodashConfig>}
10
10
  * @see {@linkplain '@/eodashConfig.js'}
11
11
  */
12
12
  export const useEodashRuntimeConfig = async () => {
13
- const eodashConfig = /** @type {EodashConfig} */(inject(eodashConfigKey))
13
+ const eodashConfig = /** @type {import("@/types").EodashConfig} */(inject(eodashConfigKey))
14
14
  /**
15
- * @param {EodashConfig} updatedConfig
15
+ * @param {import("@/types").EodashConfig} updatedConfig
16
16
  */
17
17
  const assignConfig = (updatedConfig) => {
18
- /** @type {(keyof EodashConfig)[]} */(Object.keys(eodashConfig))
18
+ /** @type {(keyof import("@/types").EodashConfig)[]} */(Object.keys(eodashConfig))
19
19
  .forEach((key) => {
20
20
  //@ts-expect-error
21
21
  eodashConfig[key] = updatedConfig[key]
@@ -28,7 +28,7 @@ export const useEodashRuntimeConfig = async () => {
28
28
  )
29
29
  } catch {
30
30
  try {
31
- assignConfig((await import("user:config")).default)
31
+ assignConfig(await import("user:config").then(async m => await m['default']))
32
32
  } catch {
33
33
  console.error('no dashboard configuration assigned')
34
34
  }
@@ -37,8 +37,9 @@ export const useEodashRuntimeConfig = async () => {
37
37
  }
38
38
 
39
39
  /**
40
- * @param {(store:EodashStore)=>EodashConfig} configCallback
40
+ * @param {(store:import("@/types").EodashStore)=> import("@/types").EodashConfig
41
+ * | Promise<import("@/types").EodashConfig>} configCallback
41
42
  */
42
- export const defineCompiletimeConfig = (configCallback) => {
43
- return configCallback(store)
43
+ export const defineCompiletimeConfig = async (configCallback) => {
44
+ return await configCallback(store)
44
45
  }
@@ -27,8 +27,8 @@ const internalWidgets = import.meta.glob('^/**/*.vue')
27
27
 
28
28
  /**
29
29
  * Composable that converts widgets Configurations to defined imported widgets
30
- * @param { (WidgetConfig | BackgroundWidgetConfig | undefined)[] |
31
- * WidgetsContainerProps['widgets'] | undefined} widgetConfigs
30
+ * @param { (import("@/types").WidgetConfig | import("@/types").BackgroundWidgetConfig | undefined)[] |
31
+ * import("@/types").WidgetsContainerProps['widgets'] | undefined} widgetConfigs
32
32
  * @returns {Array<ReactiveDefinedWidget>}
33
33
  **/
34
34
  export const useDefineWidgets = (widgetConfigs) => {
@@ -52,13 +52,13 @@ export const useDefineWidgets = (widgetConfigs) => {
52
52
  if ('defineWidget' in (config ?? {})) {
53
53
  const { selectedStac } = storeToRefs(useSTAcStore())
54
54
  watch(selectedStac, (updatedStac) => {
55
- const definedConfig = reactive(/** @type {FunctionalWidget} */
55
+ const definedConfig = reactive(/** @type {import("@/types").FunctionalWidget} */
56
56
  (config)?.defineWidget(updatedStac))
57
57
  definedWidget.value = definedWidget.value.id === definedConfig.id ?
58
58
  definedWidget.value : getWidgetDefinition(definedConfig);
59
59
  }, { immediate: true })
60
60
  } else {
61
- definedWidget.value = getWidgetDefinition(/** @type {StaticWidget} */(config))
61
+ definedWidget.value = getWidgetDefinition(/** @type {import("@/types").StaticWidget} */(config))
62
62
  }
63
63
  definedWidgets.push(definedWidget)
64
64
  }
@@ -68,7 +68,7 @@ export const useDefineWidgets = (widgetConfigs) => {
68
68
 
69
69
  /**
70
70
  * Converts a static widget configuration to a defined imported widget
71
- * @param {StaticWidget| Omit<StaticWidget, "layout">| undefined} config
71
+ * @param {import("@/types").StaticWidget| Omit<import("@/types").StaticWidget, "layout">| undefined} config
72
72
  * @returns {DefinedWidget}
73
73
  **/
74
74
  const getWidgetDefinition = (config) => {
@@ -84,10 +84,10 @@ const getWidgetDefinition = (config) => {
84
84
  switch (config?.type) {
85
85
  case 'internal':
86
86
  importedWidget.component = defineAsyncComponent({
87
- loader: internalWidgets[`/widgets/${/** @type {InternalComponentConfig} **/(config)?.widget.name}.vue`],
87
+ loader: internalWidgets[`/widgets/${/** @type {import("@/types").InternalComponentConfig} **/(config)?.widget.name}.vue`],
88
88
  suspensible: true
89
89
  })
90
- importedWidget.props = reactive(/** @type {InternalComponentConfig} **/(config)?.widget.props ?? {})
90
+ importedWidget.props = reactive(/** @type {import("@/types").InternalComponentConfig} **/(config)?.widget.props ?? {})
91
91
 
92
92
  break;
93
93
 
@@ -40,7 +40,7 @@ export const useAbsoluteUrl = (rel = '', base = eodashConfig.stacEndpoint) => {
40
40
  /**
41
41
  * Adds slide in and out functionality to Elements
42
42
  * @param {import('vue').Ref<HTMLElement[]|null>} elements - elements to add the functionality to
43
- * @param {WidgetConfig[]} configs
43
+ * @param {import("@/types").WidgetConfig[]} configs
44
44
  */
45
45
  export const useSlidePanels = (elements, configs) => {
46
46
 
@@ -8,7 +8,7 @@ let handleMoveEnd = null;
8
8
  /**
9
9
  * Reactive Edoash Config Object. provided globally in the app,
10
10
  * and used as an intermediate object to make user defined configurations reactive.
11
- * @type {EodashConfig}
11
+ * @type {import("./types").EodashConfig}
12
12
  */
13
13
  const eodashConfig = reactive({
14
14
  id: 'demo',
@@ -1,15 +1,9 @@
1
1
  //export all actions, states, and pinia stores
2
- /**
3
- * @template {keyof EodashStore} [K = keyof EodashStore]
4
- * @typedef {Record<K,EodashStore[K]>} EodashStoreImports
5
- */
6
2
 
7
- const storesImport = /**@type {EodashStoreImports} */(import.meta.glob('../store/**.js', { eager: true }))
8
- /**
9
- * @type {EodashStore}
10
- */
11
- const store = (() => {
12
- const stores = /** @type {EodashStore}*/({});
3
+ const storesImport = import.meta.glob('../store/**.js', { eager: true })
4
+
5
+ const store = /** @type {import("@/types").EodashStore} */((() => {
6
+ const stores = {}
13
7
  for (const [filePath, importedstore] of Object.entries(storesImport)) {
14
8
  const storeType = filePath.split('/').at(-1)?.slice(0, -3).toLowerCase() ?? ''
15
9
  if (!['keys'].includes(storeType)) {
@@ -18,6 +12,6 @@ const store = (() => {
18
12
  }
19
13
  }
20
14
  return stores;
21
- })();
15
+ })());
22
16
 
23
17
  export default store;
@@ -20,12 +20,12 @@ export const useSTAcStore = defineStore('stac', () => {
20
20
  const selectedStac = ref(null);
21
21
 
22
22
 
23
- const eodashConfig = /** @type {EodashConfig} */(inject(eodashConfigKey));
23
+ const eodashConfig = /** @type {import("@/types").EodashConfig} */(inject(eodashConfigKey));
24
24
 
25
25
  /**
26
26
  * fetches root stac catalog and assign it to `stac`
27
27
  * @async
28
- * @param {StacEndpoint} [url = eodashConfig.stacEndpoint]
28
+ * @param {import("@/types").StacEndpoint} [url = eodashConfig.stacEndpoint]
29
29
  * @returns {Promise<void>}
30
30
  * @see {@link stac}
31
31
  */
package/core/types.d.ts CHANGED
@@ -1,333 +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
- 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<WidgetConfig, 'layout'>[]
37
+ }
38
38
 
39
- // 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
40
55
  /**
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`
56
+ * Widget position and size.
45
57
  */
46
- interface WebComponentConfig<T extends ExecutionTime = "compiletime"> {
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 InternalComponentConfig {
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
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>
131
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 IFrameConfig {
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"> = WebComponentConfig<T> | InternalComponentConfig | IFrameConfig
205
+ export type WidgetConfig<T extends ExecutionTime = "compiletime"> = StaticWidget<T> | FunctionalWidget<T>
206
+
229
207
 
230
- type ExternalURL = `${'https://' | 'http://'}${string}`;
231
- type InternalRoute = `/${string}`
232
- 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
+ }
233
229
 
234
- type ExecutionTime = "runtime" | "compiletime";
230
+ export type ExternalURL = `${'https://' | 'http://'}${string}`;
231
+ export type InternalRoute = `/${string}`
232
+ export type StacEndpoint = `${'https://' | 'http://'}${string}/catalog.json`
235
233
 
234
+ export type ExecutionTime = "runtime" | "compiletime";
235
+
236
+ /**
237
+ * Eodash configuration specification.
238
+ */
239
+ export interface EodashConfig<T extends ExecutionTime = "compiletime"> {
236
240
  /**
237
- * Eodash configuration specification.
241
+ * Configuration ID that defines the route of the dashboard.
242
+ * Rendered dashboard can be accessed on route `/dashboard/config-id`
238
243
  */
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;
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<{
245
253
  /**
246
- * Root STAC catalog endpoint
254
+ * button title
247
255
  **/
248
- stacEndpoint: StacEndpoint
256
+ title: string,
249
257
  /**
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
- }>
258
+ * external URL or inner path to navigate to.
259
+ **/
260
+ to: ExternalURL | InternalRoute
261
+ }>
262
+ /**
263
+ * Brand specifications.
264
+ */
265
+ brand: {
262
266
  /**
263
- * 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.
264
269
  */
265
- brand: {
270
+ font?: {
266
271
  /**
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.
272
+ * Link to stylesheet that defines font-face.
269
273
  */
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
- }
274
+ link?: string;
280
275
  /**
281
- * Title that will be shown in the app header
276
+ * Font family. Use FVD notation to include families https://github.com/typekit/fvd
282
277
  */
283
- name: string;
284
- /**
285
- * Alias that will be shown in the app footer if specified.
286
- */
287
- shortName?: string
288
- /**
289
- * brand logo
290
- */
291
- logo?: string;
292
- /**
293
- * Dashboard theme as a custom vuetifyJs theme.
294
- */
295
- theme?: ThemeDefinition
278
+ family: string
296
279
  }
297
280
  /**
298
- * 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
290
+ */
291
+ logo?: string;
292
+ /**
293
+ * Dashboard theme as a custom vuetifyJs theme.
299
294
  */
300
- template: TemplateConfig<T>
295
+ theme?: ThemeDefinition
301
296
  }
302
- /////////
297
+ /**
298
+ * Rendered widgets configuration
299
+ */
300
+ template: TemplateConfig<T>
301
+ }
302
+ /////////
303
303
 
304
- /// eodash store types
305
- interface EodashStore {
304
+ /// eodash store types
305
+ export interface EodashStore {
306
+ /**
307
+ * Stateful Reactive variables
308
+ */
309
+ states: {
306
310
  /**
307
- * Stateful Reactive variables
311
+ * Currently selected STAC endpoint
308
312
  */
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
- };
313
+ currentUrl: Ref<string>
323
314
  /**
324
- * Pinia store definition used to navigate the root STAC catalog.
325
- */
326
- stac: {
327
- useSTAcStore: typeof useSTAcStore
328
- }
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
329
328
  }
330
- ///////
331
329
  }
332
- export type { EodashConfig, EodashStore }
333
- export declare const defineConfig: typeof defineCompiletimeConfig
330
+ ///////
331
+ export declare const defineConfig: (configCallback: (store: EodashStore) => EodashConfig | Promise<EodashConfig>) => EodashConfig
@@ -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;
15
+ const config: import("@/types").EodashConfig | Promise<import("@/types").EodashConfig>;
34
16
  export default config
35
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.1.7",
3
+ "version": "5.0.0-alpha.1.9",
4
4
  "type": "module",
5
5
  "types": "./core/types.d.ts",
6
6
  "files": [
@@ -32,17 +32,18 @@
32
32
  "@vitejs/plugin-vue": "^5.0.0",
33
33
  "animated-details": "gist:2912bb049fa906671807415eb0e87188",
34
34
  "axios": "^1.6.2",
35
+ "commander": "^12.0.0",
35
36
  "core-js": "^3.29.0",
36
37
  "pinia": "^2.0.0",
37
- "roboto-fontface": "*",
38
+ "sass": "^1.60.0",
39
+ "stac-ts": "^1.0.3",
38
40
  "vite": "^5.1.5",
39
41
  "vite-plugin-virtual": "^0.3.0",
40
42
  "vite-plugin-vuetify": "^2.0.0",
41
43
  "vue": "^3.2.0",
42
44
  "vue-router": "^4.0.0",
43
45
  "vuetify": "^3.5.1",
44
- "webfontloader": "^1.6.28",
45
- "sass": "^1.60.0"
46
+ "webfontloader": "^1.6.28"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@babel/types": "^7.21.4",
@@ -51,7 +52,6 @@
51
52
  "@vue/eslint-config-typescript": "^11.0.0",
52
53
  "eslint": "^8.56.0",
53
54
  "eslint-plugin-vue": "^9.19.2",
54
- "stac-ts": "^1.0.3",
55
55
  "typedoc": "^0.25.7",
56
56
  "typedoc-plugin-markdown": "^3.17.1",
57
57
  "typescript": "^5.0.0",
@@ -63,4 +63,4 @@
63
63
  "bin": {
64
64
  "eodash": "./bin/app.js"
65
65
  }
66
- }
66
+ }
@@ -16,7 +16,7 @@ import 'animated-details'
16
16
 
17
17
  const props = defineProps({
18
18
  widgets: {
19
- /** @type {import('vue').PropType<Omit<WidgetConfig,'layout'>[]>} */
19
+ /** @type {import('vue').PropType<Omit<import("@/types").WidgetConfig,'layout'>[]>} */
20
20
  type: Array,
21
21
  required: true,
22
22
  }
package/bin/update.js DELETED
@@ -1,17 +0,0 @@
1
- import { cp } from "fs/promises";
2
- import { rootPublicPath, appPath, runtimeConfigPath, appPublicPath } from "./utils.js";
3
- import { existsSync } from "fs";
4
- import path from "path";
5
-
6
- export async function update() {
7
- if (rootPublicPath !== appPublicPath) {
8
- await cp(rootPublicPath, appPublicPath, { recursive: true }).catch(err => {
9
- console.error(err)
10
- })
11
- if (existsSync(runtimeConfigPath)) {
12
- await cp(runtimeConfigPath, path.join(appPath, '/public/config.js')).catch((e) => {
13
- console.error(e)
14
- })
15
- }
16
- }
17
- }