@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/bin/cli.js CHANGED
@@ -1,16 +1,18 @@
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 {
5
+ rootPath, appPath, buildTargetPath,
6
+ appPublicPath, rootPublicPath, 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
14
  export const createDevServer = async () => {
13
- const server = await createServer(serverConfig({ mode: 'development', command: 'serve' }))
15
+ const server = await createServer(await serverConfig({ mode: 'development', command: 'serve' }))
14
16
  await server.listen()
15
17
  server.printUrls()
16
18
  server.bindCLIShortcuts({ print: true })
@@ -19,33 +21,38 @@ export const createDevServer = async () => {
19
21
  export const buildApp = async (baseFlag) => {
20
22
  const htmlPath = path.join(appPath, '/index.html')
21
23
  await writeFile(htmlPath, indexHtml).then(async () => {
22
- await update()
23
- const config = serverConfig({ mode: 'production', command: 'build' })
24
+ if (rootPublicPath !== appPublicPath) {
25
+ await cp(rootPublicPath, appPublicPath, { recursive: true }).catch(err => {
26
+ console.error(err)
27
+ })
28
+ if (existsSync(runtimeConfigPath)) {
29
+ await cp(runtimeConfigPath, path.join(appPath, '/public/config.js')).catch((e) => {
30
+ console.error(e)
31
+ })
32
+ }
33
+ }
34
+
35
+ const config = await serverConfig({ mode: 'production', command: 'build' });
24
36
  if (baseFlag !== null) {
25
37
  config.base = baseFlag
26
38
  }
27
39
  await build(config)
40
+
28
41
  await rm(htmlPath).catch(() => {
29
42
  console.error('failed to remove index.html')
30
43
  })
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()
44
+ if (appPath.includes('node_modules') && existsSync(appPublicPath)) {
45
+ await rm(appPublicPath, { recursive: true }).catch((e) => {
46
+ console.error(e)
47
+ })
48
+ }
34
49
  })
35
-
36
- if (appPath.includes('node_modules')) {
37
- await cp(appPath + 'dist', buildTargetPath, { recursive: true }).then(() => {
38
- console.info('dashboard built successfully')
39
- }).catch((e) => {
40
- console.error(e)
41
- })
42
- }
43
50
  }
44
51
 
45
52
 
46
53
  export async function previewApp() {
47
54
  const previewServer = await preview({
48
- root: execPath,
55
+ root: rootPath,
49
56
  preview: {
50
57
  port: 8080,
51
58
  open: true,
@@ -1,18 +1,23 @@
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
+ buildTargetPath
14
+ } from "./utils.js";
11
15
  import { readFile } from "fs/promises";
12
- import { existsSync } from "fs";
16
+ import { defineConfig, searchForWorkspaceRoot } from "vite"
17
+ import { getUserModules } from './utils.js';
18
+ import { existsSync } from 'fs';
13
19
  import path from "path";
14
20
 
15
-
16
21
  export const indexHtml = `
17
22
  <!DOCTYPE html>
18
23
  <html lang="en">
@@ -26,14 +31,18 @@ export const indexHtml = `
26
31
 
27
32
  <body>
28
33
  <div id="app"></div>
29
- <script type="module" src="${path.resolve(`/@fs/${appPath}/core/main.js`)}"></script>
34
+ <script type="module" src="${path.resolve(`/@fs/${appPath}/core/render.js`)}"></script>
30
35
  </body>
31
36
  </html>`
32
37
 
33
- export const serverConfig = defineConfig(({ mode, command }) => {
38
+ /**
39
+ * @type {import('vite').Plugin | null}
40
+ */
41
+ let virtualPlugin = null;
42
+ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(defineConfig(async ({ mode, command }) => {
34
43
  return {
35
44
  base: '',
36
- cacheDir: dotEodashPath + '/cache',
45
+ cacheDir: cachePath,
37
46
  plugins: [
38
47
  vue({
39
48
  template: {
@@ -47,10 +56,11 @@ export const serverConfig = defineConfig(({ mode, command }) => {
47
56
  vuetify({
48
57
  autoImport: true,
49
58
  }),
50
- {
51
- name: "inject-files",
52
- configureServer: mode === "development" ? configureServer : undefined
53
- }
59
+ (mode === "development" && {
60
+ name: "inject-html",
61
+ configureServer
62
+ }),
63
+ virtualPlugin = virtual(await getUserModules())
54
64
  ],
55
65
  define: { 'process.env': {} },
56
66
  resolve: {
@@ -71,16 +81,17 @@ export const serverConfig = defineConfig(({ mode, command }) => {
71
81
  include: ["webfontloader", "vuetify", "vue", "pinia"],
72
82
  noDiscovery: true,
73
83
  } : {},
74
- publicDir: command === 'build' ? path.join(appPath, './public') : path.join(execPath, '/public'),
84
+ publicDir: command === 'build' ? appPublicPath : rootPublicPath,
75
85
  build: {
76
- outDir: 'dist',
86
+ outDir: buildTargetPath,
87
+ emptyOutDir: true,
77
88
  rollupOptions: {
78
89
  input: fileURLToPath(new URL(command === 'build' ? '../index.html' : '../core/main.js', import.meta.url)),
79
90
  },
80
91
  target: "esnext"
81
92
  }
82
93
  }
83
- });
94
+ }));
84
95
 
85
96
 
86
97
 
@@ -88,32 +99,33 @@ export const serverConfig = defineConfig(({ mode, command }) => {
88
99
  * @type {import("vite").ServerHook}
89
100
  */
90
101
  async function configureServer(server) {
91
- if (existsSync(configPath)) {
92
- server.watcher.add(configPath)
93
- }
102
+ server.watcher.add([compiletimeConfigPath, runtimeConfigPath])
94
103
 
95
104
  server.watcher.on('change', async (path) => {
96
- if (path == configPath) {
97
- server.hot.send('config:update')
105
+ if (path == runtimeConfigPath) {
106
+ server.hot.send('reload')
107
+ } else if (path === compiletimeConfigPath) {
108
+ updateVirtualModule(virtualPlugin, 'user:config',
109
+ await getUserModules().then(modules => modules['user:config']))
98
110
  }
99
111
  })
112
+
100
113
  return () => {
101
114
  server.middlewares.use(async (req, res, next) => {
102
- if (req.originalUrl === '/@fs/config.js' && existsSync(configPath)) {
103
- await readFile(configPath).then(config => {
115
+ if (req.originalUrl === '/@fs/config.js' && existsSync(runtimeConfigPath)) {
116
+ await readFile(runtimeConfigPath).then(runtimeConfig => {
104
117
  res.statusCode = 200
105
118
  res.setHeader('Content-Type', 'text/javascript')
106
- res.write(config)
119
+ res.write(runtimeConfig)
107
120
  res.end()
108
- }).catch()
121
+ })
109
122
  return
110
123
  }
111
124
 
112
- const url = req.url
113
- if (url?.endsWith('.html')) {
125
+ if (req.url?.endsWith('.html')) {
114
126
  res.statusCode = 200
115
127
  res.setHeader('Content-Type', 'text/html')
116
- const html = await server.transformIndexHtml(url, indexHtml, req.originalUrl)
128
+ const html = await server.transformIndexHtml(req.url, indexHtml, req.originalUrl)
117
129
  res.end(html)
118
130
  return
119
131
  }
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
+ }
@@ -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
 
@@ -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 {import("@/types").WebComponentProps} */(defineProps({
16
17
  link: {
17
- type: String,
18
+ type: [String, Function],
18
19
  required: true
19
20
  },
20
21
  constructorProp: String,
@@ -30,25 +31,15 @@ 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
- const imported = await getWebComponent().catch(e => {
40
+ const imported = !customElements.get(props.tagName) ? await getWebComponent().catch(e => {
50
41
  console.error(e)
51
- })
42
+ }) : null
52
43
 
53
44
  const defined = customElements.get(props.tagName)
54
45
 
@@ -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
  <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>
@@ -1,25 +1,45 @@
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.
6
7
  * Consumes `/config.js` file from the base URL, and assign it to `eodashConfig`
7
8
  * @async
8
- * @returns {Promise<EodashConfig>}
9
+ * @returns {Promise<import("@/types").EodashConfig>}
9
10
  * @see {@linkplain '@/eodashConfig.js'}
10
11
  */
11
12
  export const useEodashRuntimeConfig = async () => {
12
- const eodashConfig = inject(eodashConfigKey)
13
+ const eodashConfig = /** @type {import("@/types").EodashConfig} */(inject(eodashConfigKey))
14
+ /**
15
+ * @param {import("@/types").EodashConfig} updatedConfig
16
+ */
17
+ const assignConfig = (updatedConfig) => {
18
+ /** @type {(keyof import("@/types").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").then(async m => await m['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:import("@/types").EodashStore)=> import("@/types").EodashConfig
41
+ * | Promise<import("@/types").EodashConfig>} configCallback
42
+ */
43
+ export const defineCompiletimeConfig = async (configCallback) => {
44
+ return await configCallback(store)
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',
@@ -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 }
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);
@@ -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
  */