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