@eodash/eodash 5.0.0-alpha.1.9 → 5.0.0-alpha.2.1
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/LICENSE +21 -0
- package/README.md +1 -1
- package/bin/cli.js +15 -8
- package/bin/main.js +9 -0
- package/bin/serverConfig.js +58 -29
- package/bin/types.d.ts +52 -0
- package/bin/utils.js +70 -20
- package/core/App.vue +10 -12
- package/core/SuspensedDashboard.ce.vue +65 -0
- package/core/asWebComponent.d.ts +18 -0
- package/core/asWebComponent.js +12 -0
- package/core/components/DashboardLayout.vue +11 -25
- package/core/components/DynamicWebComponent.vue +6 -6
- package/core/components/Footer.vue +11 -12
- package/core/components/Header.vue +5 -29
- package/core/components/Loading.vue +27 -0
- package/core/components/MobileLayout.vue +34 -63
- package/core/composables/DefineEodash.js +57 -0
- package/core/composables/DefineWidgets.js +26 -15
- package/core/composables/index.js +139 -67
- package/core/eodash.js +100 -0
- package/core/main.js +2 -4
- package/core/plugins/index.js +3 -12
- package/core/plugins/vuetify.js +5 -2
- package/core/store/Actions.js +0 -28
- package/core/store/States.js +12 -3
- package/core/store/stac.js +7 -5
- package/core/types.d.ts +149 -124
- package/core/utils/eodashSTAC.js +164 -0
- package/core/utils/helpers.js +40 -0
- package/core/utils/index.js +28 -0
- package/core/utils/keys.js +6 -0
- package/core/views/Dashboard.vue +33 -23
- package/core/vite-env.d.ts +16 -2
- package/dist/.gitkeep +0 -0
- package/dist/DashboardLayout-Dp8AnYD9.js +141 -0
- package/dist/DynamicWebComponent-BrHVTesn.js +57 -0
- package/dist/EodashDatePicker-D_udZ26j.js +1645 -0
- package/dist/EodashItemFilter-BLAGx2UD.js +51 -0
- package/dist/EodashMap-Bxl_aqY2.js +53405 -0
- package/dist/Footer-AohCH8U7.js +118 -0
- package/dist/Header-DC50S6GR.js +609 -0
- package/dist/IframeWrapper-Dd9zrX9s.js +19 -0
- package/dist/MobileLayout-CgToA7Gp.js +523 -0
- package/dist/VBtn-Bz7ruRUg.js +1106 -0
- package/dist/VMain-BHfWJU2j.js +35 -0
- package/dist/WidgetsContainer-DxfCu0I3.js +122 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/asWebComponent-C8rb3b1D.js +11323 -0
- package/dist/basedecoder-Qm25PwVp-CHo5Pomv.js +89 -0
- package/dist/color-DpYEub1f.js +115 -0
- package/dist/decoder-kAoyGIq9-BBR5CgzS.js +10 -0
- package/dist/deflate-Be2Arps5-hDqMz3RA.js +10 -0
- package/dist/dimensions-CJaGeSrj.js +53 -0
- package/dist/eo-dash.js +6 -0
- package/dist/eox-itemfilter-DcQkRD2l.js +7537 -0
- package/dist/eox-map-BJ9SIixs.js +36205 -0
- package/dist/eox-stacinfo-B-YrT7Ug.js +13698 -0
- package/dist/forwardRefs-Bxeu9Obx.js +142 -0
- package/dist/index-DTkOfh2g.js +152 -0
- package/dist/index-Sa2Vg_gx.js +65 -0
- package/dist/jpeg-DNfUpLwy-Fjan-04T.js +515 -0
- package/dist/lerc-C9VL9kri-cIdbW0sg.js +1029 -0
- package/dist/lzw-BOMhmEDy-Dboc93VO.js +84 -0
- package/dist/packbits-DaUD6MLm-Bu1PoTGa.js +24 -0
- package/dist/pako.esm-C3kYPGGQ-BMki8cQY.js +1087 -0
- package/dist/raw-CcGKjn8q-DFOt-i8n.js +9 -0
- package/dist/ssrBoot-D-b4-M19.js +17 -0
- package/dist/style.css +5 -0
- package/dist/webfontloader-CyOFAuFB.js +471 -0
- package/dist/webimage-D2c098k3-DLj1LQxB.js +19 -0
- package/package.json +40 -12
- package/widgets/EodashDatePicker.vue +56 -0
- package/widgets/EodashItemFilter.vue +60 -0
- package/widgets/EodashMap.vue +82 -0
- package/widgets/WidgetsContainer.vue +1 -1
- package/core/composables/DefineConfig.js +0 -45
- package/core/eodashConfig.js +0 -136
- package/core/plugins/router.js +0 -20
- package/core/store/Keys.js +0 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 EOX IT Services GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ npm run preview
|
|
|
20
20
|
.
|
|
21
21
|
├── core # Main source code that hosts the microfrontends and renders the dashboard
|
|
22
22
|
├── docs # Documentation files
|
|
23
|
-
├── widgets #
|
|
23
|
+
├── widgets # Vue componenets as internal widgets.
|
|
24
24
|
├── public # Statically served directory
|
|
25
25
|
└── README.md
|
|
26
26
|
|
package/bin/cli.js
CHANGED
|
@@ -19,9 +19,9 @@ export const createDevServer = async () => {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const buildApp = async () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const config = await serverConfig({ mode
|
|
22
|
+
/** @param {"production"|"lib"} mode */
|
|
23
|
+
const viteBuild = async (mode) => {
|
|
24
|
+
const config = await serverConfig({ mode, command: 'build' });
|
|
25
25
|
await build(config)
|
|
26
26
|
|
|
27
27
|
if (existsSync(runtimeConfigPath)) {
|
|
@@ -30,11 +30,18 @@ export const buildApp = async () => {
|
|
|
30
30
|
console.error(e)
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
}
|
|
34
|
+
if (userConfig.lib) {
|
|
35
|
+
await viteBuild("lib")
|
|
36
|
+
} else {
|
|
37
|
+
const htmlPath = path.join(appPath, '/index.html')
|
|
38
|
+
await writeFile(htmlPath, indexHtml).then(async () => {
|
|
39
|
+
await viteBuild("production")
|
|
40
|
+
await rm(htmlPath).catch(() => {
|
|
41
|
+
console.error('failed to remove index.html')
|
|
42
|
+
})
|
|
36
43
|
})
|
|
37
|
-
}
|
|
44
|
+
}
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
|
|
@@ -43,7 +50,7 @@ export async function previewApp() {
|
|
|
43
50
|
root: rootPath,
|
|
44
51
|
base: userConfig.base ?? '',
|
|
45
52
|
preview: {
|
|
46
|
-
port: userConfig.port
|
|
53
|
+
port: isNaN(userConfig.port) ? 8080 : userConfig.port,
|
|
47
54
|
open: userConfig.open,
|
|
48
55
|
host: userConfig.host
|
|
49
56
|
},
|
package/bin/main.js
ADDED
package/bin/serverConfig.js
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import vue from '@vitejs/plugin-vue';
|
|
4
4
|
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
|
|
5
|
-
import virtual, { updateVirtualModule } from 'vite-plugin-virtual'
|
|
6
5
|
import { fileURLToPath, URL } from 'url';
|
|
7
6
|
import {
|
|
8
7
|
runtimeConfigPath,
|
|
9
|
-
appPath,
|
|
8
|
+
appPath, entryPath,
|
|
10
9
|
cachePath, publicPath, userConfig,
|
|
11
|
-
buildTargetPath
|
|
10
|
+
buildTargetPath,
|
|
11
|
+
logger,
|
|
12
|
+
rootPath,
|
|
13
|
+
internalWidgetsPath
|
|
12
14
|
} from "./utils.js";
|
|
13
15
|
import { readFile } from "fs/promises";
|
|
14
16
|
import { defineConfig, searchForWorkspaceRoot } from "vite"
|
|
15
|
-
import { getUserModules } from './utils.js';
|
|
16
17
|
import { existsSync } from 'fs';
|
|
17
18
|
import path from "path";
|
|
18
19
|
|
|
@@ -28,21 +29,22 @@ export const indexHtml = `
|
|
|
28
29
|
</head>
|
|
29
30
|
|
|
30
31
|
<body>
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
${userConfig.lib ? `<eo-dash style="height:100dvh;"/>
|
|
33
|
+
<script type="module" src="${path.resolve(`/@fs/${appPath}`, `core/asWebComponent.js`)}"></script>
|
|
34
|
+
`: ` <div id="app"/>
|
|
35
|
+
<script type="module" src="${path.resolve(`/@fs/${appPath}`, `core/render.js`)}"></script>
|
|
36
|
+
`}
|
|
33
37
|
</body>
|
|
34
38
|
</html>`
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
* @type {import('vite').Plugin | null}
|
|
38
|
-
*/
|
|
39
|
-
let virtualPlugin = null;
|
|
40
|
+
//@ts-expect-error
|
|
40
41
|
export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(defineConfig(async ({ mode, command }) => {
|
|
41
42
|
return {
|
|
42
43
|
base: userConfig.base ?? '',
|
|
43
44
|
cacheDir: cachePath,
|
|
44
45
|
plugins: [
|
|
45
46
|
vue({
|
|
47
|
+
customElement: userConfig.lib,
|
|
46
48
|
template: {
|
|
47
49
|
transformAssetUrls,
|
|
48
50
|
compilerOptions: {
|
|
@@ -57,18 +59,23 @@ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(def
|
|
|
57
59
|
(mode === "development" && {
|
|
58
60
|
name: "inject-html",
|
|
59
61
|
configureServer
|
|
60
|
-
})
|
|
61
|
-
virtualPlugin = virtual(await getUserModules())
|
|
62
|
+
})
|
|
62
63
|
],
|
|
64
|
+
customLogger: logger,
|
|
63
65
|
define: { 'process.env': {} },
|
|
64
66
|
resolve: {
|
|
65
67
|
alias: {
|
|
66
68
|
'@': fileURLToPath(new URL('../core', import.meta.url)),
|
|
67
69
|
'^': fileURLToPath(new URL('../widgets', import.meta.url)),
|
|
70
|
+
"user:config": entryPath,
|
|
71
|
+
"user:widgets": internalWidgetsPath
|
|
68
72
|
},
|
|
69
73
|
extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
|
|
70
74
|
},
|
|
71
75
|
server: {
|
|
76
|
+
warmup: {
|
|
77
|
+
clientFiles: [path.join(appPath, "core/**")]
|
|
78
|
+
},
|
|
72
79
|
port: userConfig.port ?? 3000,
|
|
73
80
|
open: userConfig.open,
|
|
74
81
|
fs: {
|
|
@@ -78,17 +85,23 @@ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(def
|
|
|
78
85
|
},
|
|
79
86
|
root: fileURLToPath(new URL('..', import.meta.url)),
|
|
80
87
|
optimizeDeps: mode === "development" ? {
|
|
81
|
-
include: ["webfontloader", "vuetify", "vue", "pinia"],
|
|
88
|
+
include: ["webfontloader", "vuetify", "vue", "pinia", "stac-js", "urijs"],
|
|
82
89
|
noDiscovery: true,
|
|
83
90
|
} : {},
|
|
84
91
|
/** @type {string|false} */
|
|
85
92
|
publicDir: userConfig.publicDir === false ? false : publicPath,
|
|
86
93
|
build: {
|
|
94
|
+
lib: (mode === 'lib' && command === 'build') && {
|
|
95
|
+
entry: path.join(appPath, "core/asWebComponent.js"),
|
|
96
|
+
fileName: "eo-dash",
|
|
97
|
+
formats: ["es"],
|
|
98
|
+
name: "@eodash/eodash"
|
|
99
|
+
},
|
|
87
100
|
outDir: buildTargetPath,
|
|
88
101
|
emptyOutDir: true,
|
|
89
|
-
rollupOptions: {
|
|
90
|
-
input: fileURLToPath(new URL(
|
|
91
|
-
},
|
|
102
|
+
rollupOptions: command == 'build' ? {
|
|
103
|
+
input: fileURLToPath(new URL(mode === 'lib' ? '../core/asWebComponent.js' : '../index.html', import.meta.url)),
|
|
104
|
+
} : undefined,
|
|
92
105
|
target: "esnext"
|
|
93
106
|
}
|
|
94
107
|
}
|
|
@@ -100,26 +113,42 @@ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(def
|
|
|
100
113
|
* @type {import("vite").ServerHook}
|
|
101
114
|
*/
|
|
102
115
|
async function configureServer(server) {
|
|
103
|
-
server.watcher.add([
|
|
116
|
+
server.watcher.add([entryPath, runtimeConfigPath, path.join(internalWidgetsPath, "**/*.vue")])
|
|
117
|
+
|
|
118
|
+
let updatedPath = ''
|
|
119
|
+
const loggerInfo = logger.info
|
|
120
|
+
logger.info = (msg, options) => {
|
|
121
|
+
if (msg.includes('core')) {
|
|
122
|
+
const removedPath = msg.split('/')[0].split(" ")
|
|
123
|
+
removedPath.pop()
|
|
124
|
+
const updatedMsg = removedPath.join(" ") + " " + updatedPath.replace(rootPath, "")
|
|
125
|
+
|
|
126
|
+
return loggerInfo(updatedMsg, options)
|
|
127
|
+
}
|
|
128
|
+
return loggerInfo(msg, options)
|
|
129
|
+
}
|
|
104
130
|
|
|
105
131
|
server.watcher.on('change', async (path) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
132
|
+
updatedPath = path
|
|
133
|
+
if (path === runtimeConfigPath) {
|
|
134
|
+
server.hot.send({
|
|
135
|
+
type: 'full-reload',
|
|
136
|
+
path: path
|
|
137
|
+
})
|
|
111
138
|
}
|
|
112
139
|
})
|
|
113
140
|
|
|
114
141
|
return () => {
|
|
115
142
|
server.middlewares.use(async (req, res, next) => {
|
|
116
|
-
if (req.originalUrl === '/@fs/config.js'
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
143
|
+
if (req.originalUrl === '/@fs/config.js') {
|
|
144
|
+
res.statusCode = 200
|
|
145
|
+
res.setHeader('Content-Type', 'text/javascript')
|
|
146
|
+
if (existsSync(runtimeConfigPath)) {
|
|
147
|
+
await readFile(runtimeConfigPath).then(runtimeConfig => {
|
|
148
|
+
res.write(runtimeConfig)
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
res.end()
|
|
123
152
|
return
|
|
124
153
|
}
|
|
125
154
|
|
package/bin/types.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extending [Vite's](https://vitejs.dev/) config to configure eodash's server, build and setup.
|
|
3
|
+
* @group CLI
|
|
4
|
+
*/
|
|
5
|
+
export interface EodashConfig {
|
|
6
|
+
dev?: {
|
|
7
|
+
/** serving port */
|
|
8
|
+
port?: string | number
|
|
9
|
+
host?: string | boolean
|
|
10
|
+
/** open default browser when the server starts */
|
|
11
|
+
open?: boolean
|
|
12
|
+
}
|
|
13
|
+
preview?: {
|
|
14
|
+
/** serving port */
|
|
15
|
+
port?: string | number
|
|
16
|
+
host?: string | boolean
|
|
17
|
+
/** open default browser when the server starts */
|
|
18
|
+
open?: boolean
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base public path
|
|
22
|
+
*/
|
|
23
|
+
base?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Build target folder path
|
|
26
|
+
*/
|
|
27
|
+
outDir?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Path to statically served assets folder, can be set to `false`
|
|
30
|
+
* to disable serving assets statically
|
|
31
|
+
**/
|
|
32
|
+
publicDir?: string | false;
|
|
33
|
+
/**
|
|
34
|
+
* Cache folder
|
|
35
|
+
*/
|
|
36
|
+
cacheDir?: string
|
|
37
|
+
/** Specifies main entry file, exporting `createEodash`*/
|
|
38
|
+
entryPoint?: string
|
|
39
|
+
/**
|
|
40
|
+
* File exporting eodash client runtime config
|
|
41
|
+
*/
|
|
42
|
+
runtime?: string
|
|
43
|
+
widgets?: string
|
|
44
|
+
/** builds eodash as a web component library */
|
|
45
|
+
lib?: boolean
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* helper function that provides intellisense
|
|
49
|
+
* without the need for JSDOC for `eodash.config.js`:
|
|
50
|
+
* @group CLI
|
|
51
|
+
*/
|
|
52
|
+
export declare const definConfig: (config: EodashConfig) => EodashConfig
|
package/bin/utils.js
CHANGED
|
@@ -1,53 +1,103 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { readFile } from 'fs/promises';
|
|
4
3
|
import { existsSync, readFileSync } from 'fs';
|
|
5
4
|
import path from 'path';
|
|
6
5
|
import { fileURLToPath } from 'url';
|
|
7
|
-
import { searchForWorkspaceRoot } from 'vite';
|
|
6
|
+
import { searchForWorkspaceRoot, createLogger } from 'vite';
|
|
8
7
|
import { Command } from 'commander';
|
|
8
|
+
|
|
9
|
+
export const rootPath = searchForWorkspaceRoot(process.cwd());
|
|
9
10
|
const cli = new Command('eodash')
|
|
10
11
|
|
|
11
12
|
const pkg = JSON.parse(
|
|
12
13
|
readFileSync(
|
|
13
|
-
|
|
14
|
+
path.join(rootPath, 'package.json')
|
|
14
15
|
, 'utf-8')
|
|
15
16
|
);
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* CLI flags object
|
|
20
|
+
* @typedef {Object} Options
|
|
21
|
+
* @property {string | false} publicDir
|
|
22
|
+
* @property {string} outDir
|
|
23
|
+
* @property {string} entryPoint
|
|
24
|
+
* @property {string} widgets
|
|
25
|
+
* @property {string} cacheDir
|
|
26
|
+
* @property {string} runtime
|
|
27
|
+
* @property {string} base
|
|
28
|
+
* @property {string | number} port
|
|
29
|
+
* @property {boolean} open
|
|
30
|
+
* @property {boolean | string} host
|
|
31
|
+
* @property {string} config
|
|
32
|
+
* @property {boolean} lib
|
|
33
|
+
*/
|
|
17
34
|
cli.version(pkg.version, '-v, --version', 'output the current version')
|
|
18
35
|
.option('--publicDir <path>', 'path to statically served assets folder')
|
|
19
36
|
.option('--no-publicDir', 'stop serving static assets')
|
|
20
37
|
.option('--outDir <path>', 'minified output folder')
|
|
21
|
-
.option('-e, --entryPoint <path>', 'file exporting `
|
|
22
|
-
.option('-
|
|
23
|
-
.option('
|
|
38
|
+
.option('-e, --entryPoint <path>', 'file exporting `createEodash`')
|
|
39
|
+
.option('-w, --widgets <path>', 'folder that contains vue components as internal widgets')
|
|
40
|
+
.option('--cacheDir <path>', 'cache folder')
|
|
41
|
+
.option('-r, --runtime <path>', 'file exporting eodash client runtime config')
|
|
24
42
|
.option('-b, --base <path>', 'base public path')
|
|
25
43
|
.option('-p, --port <port>', 'serving port')
|
|
26
44
|
.option('-o, --open', 'open default browser when the server starts')
|
|
45
|
+
.option('-c, --config <path>', 'path to eodash server and build configuration file')
|
|
27
46
|
.option('--host [IP address]', 'specify which IP addresses the server should listen on')
|
|
47
|
+
.option('-l, --lib', 'builds eodash as a web component library')
|
|
48
|
+
.option('--no-lib', 'builds eodash as an SPA')
|
|
49
|
+
.option('--no-host', 'do not expose server to the network')
|
|
28
50
|
.parse(process.argv)
|
|
29
51
|
|
|
30
52
|
|
|
31
|
-
export const userConfig = cli.opts()
|
|
53
|
+
export const userConfig = await getUserConfig(cli.opts(), process.argv?.[2])
|
|
54
|
+
|
|
32
55
|
export const appPath = fileURLToPath(new URL("..", import.meta.url)),
|
|
33
|
-
rootPath = searchForWorkspaceRoot(process.cwd()),
|
|
34
56
|
publicPath = userConfig.publicDir ? path.resolve(rootPath, userConfig.publicDir) : path.join(rootPath, './public'),
|
|
35
57
|
srcPath = path.join(rootPath, "/src"),
|
|
36
|
-
runtimeConfigPath = userConfig.runtime ? path.resolve(rootPath, userConfig.runtime) : path.join(srcPath, "./
|
|
37
|
-
|
|
58
|
+
runtimeConfigPath = userConfig.runtime ? path.resolve(rootPath, userConfig.runtime) : path.join(srcPath, "./runtime.js"),
|
|
59
|
+
entryPath = userConfig.entryPoint ? path.resolve(rootPath, userConfig.entryPoint) : path.join(srcPath, "/main.js"),
|
|
60
|
+
internalWidgetsPath = userConfig.widgets ? path.resolve(rootPath, userConfig.widgets) : path.join(srcPath, "widgets"),
|
|
38
61
|
dotEodashPath = path.join(rootPath, "/.eodash"),
|
|
39
62
|
buildTargetPath = userConfig.outDir ? path.resolve(rootPath, userConfig.outDir) : path.join(dotEodashPath, '/dist'),
|
|
40
63
|
cachePath = userConfig.cacheDir ? path.resolve(rootPath, userConfig.cacheDir) : path.join(dotEodashPath, 'cache');
|
|
41
64
|
|
|
42
65
|
|
|
43
|
-
export const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
66
|
+
export const logger = createLogger()
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param {Options} options
|
|
70
|
+
* @param {string | undefined} command
|
|
71
|
+
*/
|
|
72
|
+
async function getUserConfig(options, command) {
|
|
73
|
+
let eodashCLiConfigFile = options.config ? path.resolve(rootPath, options.config) : path.join(rootPath, 'eodash.config.js');
|
|
74
|
+
/** @type {import("./types").EodashConfig} */
|
|
75
|
+
let config = {};
|
|
76
|
+
if (existsSync(eodashCLiConfigFile)) {
|
|
77
|
+
config = await import(eodashCLiConfigFile).then(config => {
|
|
78
|
+
if (config.default instanceof Function) {
|
|
79
|
+
return config.default()
|
|
80
|
+
} else {
|
|
81
|
+
return config.default
|
|
82
|
+
}
|
|
83
|
+
}).catch(err => {
|
|
84
|
+
console.error(err);
|
|
85
|
+
})
|
|
86
|
+
} else {
|
|
87
|
+
eodashCLiConfigFile = null
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
base: options.base ?? config?.base,
|
|
92
|
+
port: Number(options.port ?? config?.[command]?.port),
|
|
93
|
+
host: options.host ?? config?.[/**@type {"dev"|"preview"} */(command)]?.host,
|
|
94
|
+
open: options.open ?? config?.[/**@type {"dev"|"preview"} */(command)]?.open,
|
|
95
|
+
cacheDir: options.cacheDir ?? config?.cacheDir,
|
|
96
|
+
entryPoint: options.entryPoint ?? config?.entryPoint,
|
|
97
|
+
outDir: options.outDir ?? config?.outDir,
|
|
98
|
+
publicDir: options.publicDir ?? config?.publicDir,
|
|
99
|
+
runtime: options.runtime ?? config?.runtime,
|
|
100
|
+
widgets: options.widgets ?? config?.widgets,
|
|
101
|
+
lib: options.lib ?? config?.lib
|
|
102
|
+
}
|
|
53
103
|
}
|
package/core/App.vue
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-app>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<!-- main content -->
|
|
7
|
-
<component :is="Component"></component>
|
|
3
|
+
<Suspense>
|
|
4
|
+
<!-- main content -->
|
|
5
|
+
<Dashboard />
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</template>
|
|
13
|
-
</Suspense>
|
|
7
|
+
<!-- loading state -->
|
|
8
|
+
<template #fallback>
|
|
9
|
+
<Loading />
|
|
14
10
|
</template>
|
|
15
|
-
</
|
|
11
|
+
</Suspense>
|
|
16
12
|
</v-app>
|
|
17
13
|
</template>
|
|
18
14
|
|
|
19
15
|
<script setup>
|
|
20
|
-
|
|
16
|
+
import Loading from '@/components/Loading.vue';
|
|
17
|
+
import Dashboard from '@/views/Dashboard.vue';
|
|
18
|
+
|
|
21
19
|
</script>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-app>
|
|
3
|
+
<Suspense>
|
|
4
|
+
<Dashboard :on-template-mount="setStylesFromHead" :config="config" />
|
|
5
|
+
<template #fallback>
|
|
6
|
+
<div style="height: 100dvh; display: flex; align-items: center; justify-content: center;">
|
|
7
|
+
<Loading />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
</Suspense>
|
|
11
|
+
</v-app>
|
|
12
|
+
</template>
|
|
13
|
+
<script setup>
|
|
14
|
+
import Dashboard from '@/views/Dashboard.vue';
|
|
15
|
+
import { createApp, getCurrentInstance } from "vue"
|
|
16
|
+
import { registerPlugins } from '@/plugins';
|
|
17
|
+
import { eodashKey } from '@/utils/keys';
|
|
18
|
+
import Loading from '@/components/Loading.vue';
|
|
19
|
+
|
|
20
|
+
defineProps({
|
|
21
|
+
config: {
|
|
22
|
+
type: String,
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
const app = createApp({})
|
|
26
|
+
registerPlugins(app)
|
|
27
|
+
|
|
28
|
+
const inst = getCurrentInstance()
|
|
29
|
+
//@ts-expect-error
|
|
30
|
+
Object.assign(inst.appContext, app._context)
|
|
31
|
+
//@ts-expect-error
|
|
32
|
+
Object.assign(inst.provides, app._context.provides)
|
|
33
|
+
|
|
34
|
+
function setStylesFromHead() {
|
|
35
|
+
const eodashComponent = document.querySelector('eo-dash')
|
|
36
|
+
const styleSheet = new CSSStyleSheet()
|
|
37
|
+
const head = document.querySelector('head')
|
|
38
|
+
let stylesStr = ''
|
|
39
|
+
|
|
40
|
+
Array.from(head?.children ?? []).forEach((child) => {
|
|
41
|
+
if (child.getAttribute('type') === 'text/css') {
|
|
42
|
+
stylesStr += `\n ${child.innerHTML}`
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (child.tagName == 'LINK' && child.getAttribute('rel')?.includes('stylesheet')) {
|
|
47
|
+
eodashComponent?.shadowRoot?.appendChild(child.cloneNode(true))
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
stylesStr += `\n * {
|
|
52
|
+
font-family:${
|
|
53
|
+
//@ts-expect-error
|
|
54
|
+
/** @type {import("@/types").Eodash} */ (inst.provides[eodashKey])?.brand.font?.family ?? 'Roboto'}
|
|
55
|
+
}
|
|
56
|
+
${//@ts-expect-error
|
|
57
|
+
/** @type {import("@/types").Eodash} */ (inst.provides[eodashKey]).brand.noLayout ?
|
|
58
|
+
`div.v-application__wrap {
|
|
59
|
+
min-height: fit-content;
|
|
60
|
+
}`: ""}
|
|
61
|
+
`
|
|
62
|
+
styleSheet.replaceSync(stylesStr.replaceAll(":root", ":host"))
|
|
63
|
+
eodashComponent?.shadowRoot?.adoptedStyleSheets.push(styleSheet)
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @group WebComponent */
|
|
2
|
+
type EodashConstructor = import("vue").VueElementConstructor<import("vue").ExtractPropTypes<{ config: string }>>
|
|
3
|
+
/**
|
|
4
|
+
* Eodash Web Component constructor
|
|
5
|
+
* @group WebComponent
|
|
6
|
+
*/
|
|
7
|
+
export declare const Eodash: EodashConstructor
|
|
8
|
+
/**
|
|
9
|
+
* Registers `eo-dash` as Custom Element in the window
|
|
10
|
+
* @group WebComponent
|
|
11
|
+
*/
|
|
12
|
+
export declare function register(): void
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Eodash store @see EodashStore
|
|
16
|
+
* @group WebComponent
|
|
17
|
+
*/
|
|
18
|
+
export declare const store: import("./types").EodashStore
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import SuspensedDashboard from './SuspensedDashboard.ce.vue';
|
|
2
|
+
import { defineCustomElement } from 'vue'
|
|
3
|
+
/** @type {import("./asWebComponent").EodashConstructor} */
|
|
4
|
+
export const Eodash = defineCustomElement(SuspensedDashboard)
|
|
5
|
+
|
|
6
|
+
export function register() {
|
|
7
|
+
customElements.define('eo-dash', Eodash)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { default as store } from '@/store'
|
|
11
|
+
|
|
12
|
+
register()
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-main>
|
|
3
|
-
<eox-layout :gap="
|
|
4
|
-
<eox-layout-item
|
|
5
|
-
<component :is="bgWidget.component" v-bind="bgWidget.props" />
|
|
3
|
+
<eox-layout :gap="eodash.template.gap ?? 2">
|
|
4
|
+
<eox-layout-item style="z-index: 0;" x="0" y="0" h="12" w="12">
|
|
5
|
+
<component id="bg-widget" :is="bgWidget.component" v-bind="bgWidget.props" />
|
|
6
6
|
</eox-layout-item>
|
|
7
|
-
<eox-layout-item v-for="(config, idx) in widgetsConfig" ref="itemEls" :key="idx"
|
|
7
|
+
<eox-layout-item v-for="(config, idx) in widgetsConfig" ref="itemEls" :key="idx"
|
|
8
|
+
style="position: relative; overflow: visible; z-index: 1; border-radius: 0px; background: rgb(var(--v-theme-surface))"
|
|
8
9
|
:x="config.layout.x" :y="config.layout.y" :h="config.layout.h" :w="config.layout.w">
|
|
9
10
|
|
|
10
|
-
<v-btn position="absolute" variant="tonal" :style="slideBtns[idx].style"
|
|
11
|
-
@click="slideInOut(idx)">
|
|
11
|
+
<v-btn v-if="slideBtns[idx].enabled" position="absolute" variant="tonal" :style="slideBtns[idx].style"
|
|
12
|
+
class="slide-btn" @click="slideInOut(idx)">
|
|
12
13
|
<v-icon :icon="slideBtns[idx].active ? slideBtns[idx].icon.in : slideBtns[idx].icon.out" />
|
|
13
14
|
</v-btn>
|
|
14
15
|
<component :key="importedWidgets[idx].value.id" :is="importedWidgets[idx].value.component"
|
|
@@ -19,18 +20,18 @@
|
|
|
19
20
|
</v-main>
|
|
20
21
|
</template>
|
|
21
22
|
<script setup>
|
|
22
|
-
import {
|
|
23
|
+
import { eodashKey } from '@/utils/keys';
|
|
23
24
|
import { inject } from 'vue';
|
|
24
25
|
import { useDefineWidgets } from '@/composables/DefineWidgets'
|
|
25
26
|
import { useSlidePanels } from '@/composables'
|
|
26
27
|
import { ref } from 'vue';
|
|
27
28
|
import '@eox/layout'
|
|
28
29
|
|
|
29
|
-
const
|
|
30
|
+
const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey))
|
|
30
31
|
|
|
31
|
-
const [bgWidget] = useDefineWidgets([
|
|
32
|
+
const [bgWidget] = useDefineWidgets([eodash.template?.background])
|
|
32
33
|
|
|
33
|
-
const widgetsConfig =
|
|
34
|
+
const widgetsConfig = eodash.template?.widgets
|
|
34
35
|
|
|
35
36
|
const importedWidgets = useDefineWidgets(widgetsConfig)
|
|
36
37
|
/**
|
|
@@ -41,18 +42,3 @@ const itemEls = ref([])
|
|
|
41
42
|
|
|
42
43
|
const { slideBtns, slideInOut } = useSlidePanels(itemEls, widgetsConfig)
|
|
43
44
|
</script>
|
|
44
|
-
<style scoped>
|
|
45
|
-
eox-layout-item {
|
|
46
|
-
background: rgb(var(--v-theme-surface))
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.bg-widget {
|
|
50
|
-
z-index: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.custom-widget {
|
|
54
|
-
position: relative;
|
|
55
|
-
overflow: visible;
|
|
56
|
-
z-index: 1;
|
|
57
|
-
}
|
|
58
|
-
</style>
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
onMounted as whenMounted
|
|
12
12
|
} from 'vue';
|
|
13
13
|
import { ref } from 'vue';
|
|
14
|
-
import { useRouter } from 'vue-router';
|
|
15
14
|
|
|
16
15
|
const props = /** @type {import("@/types").WebComponentProps} */(defineProps({
|
|
17
16
|
link: {
|
|
@@ -52,17 +51,18 @@ if (!defined && props.constructorProp) {
|
|
|
52
51
|
const store = useSTAcStore()
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* @typedef {HTMLElement &
|
|
55
|
+
* Record<string|number|symbol,unknown>} CustomElement
|
|
56
|
+
* @type {import('vue').Ref<CustomElement|null>}
|
|
57
57
|
*/
|
|
58
58
|
const elementRef = ref(null)
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
|
|
61
61
|
whenMounted(() => {
|
|
62
|
-
props.onMounted?.(elementRef.value, store
|
|
62
|
+
props.onMounted?.(elementRef.value, store)
|
|
63
63
|
})
|
|
64
64
|
|
|
65
65
|
whenUnMounted(() => {
|
|
66
|
-
props.onUnmounted?.(elementRef.value, store
|
|
66
|
+
props.onUnmounted?.(elementRef.value, store)
|
|
67
67
|
})
|
|
68
68
|
</script>
|