@eodash/eodash 5.0.0-alpha.2.1 → 5.0.0-alpha.2.4
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/README.md +10 -1
- package/core/client/App.vue +27 -0
- package/core/client/SuspensedDashboard.ce.vue +91 -0
- package/core/client/components/DashboardLayout.vue +36 -0
- package/core/client/components/ErrorAlert.vue +19 -0
- package/core/{components → client/components}/Loading.vue +12 -1
- package/core/{components → client/components}/MobileLayout.vue +19 -11
- package/core/{composables → client/composables}/DefineWidgets.js +11 -5
- package/core/{composables → client/composables}/index.js +16 -13
- package/core/{eodash.js → client/eodash.js} +0 -2
- package/core/{plugins → client/plugins}/vuetify.js +9 -3
- package/core/{store → client/store}/stac.js +6 -2
- package/core/{types.d.ts → client/types.d.ts} +11 -25
- package/core/{views → client/views}/Dashboard.vue +35 -6
- package/dist/client/DashboardLayout-ZaSRMD1M.js +149 -0
- package/dist/{DynamicWebComponent-BrHVTesn.js → client/DynamicWebComponent-C4Hotc4H.js} +12 -12
- package/dist/client/EodashDatePicker-C4kKjxKy.js +1653 -0
- package/dist/{EodashItemFilter-BLAGx2UD.js → client/EodashItemFilter-cBHC0YEM.js} +2 -2
- package/dist/{EodashMap-Bxl_aqY2.js → client/EodashMap-CGrQjZ1P.js} +2490 -2496
- package/dist/client/Footer-pS636dEP.js +118 -0
- package/dist/{Header-DC50S6GR.js → client/Header-DQuaLdjl.js} +225 -229
- package/dist/{IframeWrapper-Dd9zrX9s.js → client/IframeWrapper-Cg3GMmfW.js} +1 -1
- package/dist/client/MobileLayout-BLXFBWI_.js +987 -0
- package/dist/client/VMain-BHYlmRic.js +39 -0
- package/dist/{WidgetsContainer-DxfCu0I3.js → client/WidgetsContainer-dje9QSk0.js} +18 -18
- package/dist/client/asWebComponent-Bvb3xkxI.js +13311 -0
- package/dist/{decoder-kAoyGIq9-BBR5CgzS.js → client/decoder-HRvnjnEI-BQ2rajuJ.js} +1 -1
- package/dist/client/eo-dash.js +6 -0
- package/dist/{eox-map-BJ9SIixs.js → client/eox-map-C3DL31fp.js} +1882 -1809
- package/dist/client/eox-stacinfo-l7ALSV90.js +13969 -0
- package/dist/{index-DTkOfh2g.js → client/index-CaDDfJYE.js} +75 -43
- package/dist/client/index-DlNICb3T.js +34 -0
- package/dist/{lerc-C9VL9kri-cIdbW0sg.js → client/lerc-_E46UbWQ-Beu35ovS.js} +1 -1
- package/dist/{ssrBoot-D-b4-M19.js → client/ssrBoot-Dd7m-btU.js} +3 -3
- package/dist/client/style.css +5 -0
- package/dist/node/cli.js +20 -0
- package/dist/node/main.js +2 -0
- package/{bin → dist/node}/types.d.ts +3 -2
- package/package.json +22 -20
- package/widgets/EodashDatePicker.vue +1 -0
- package/widgets/EodashItemFilter.vue +1 -1
- package/widgets/WidgetsContainer.vue +7 -5
- package/bin/app.js +0 -22
- package/bin/cli.js +0 -62
- package/bin/main.js +0 -9
- package/bin/serverConfig.js +0 -165
- package/bin/utils.js +0 -103
- package/core/App.vue +0 -19
- package/core/SuspensedDashboard.ce.vue +0 -65
- package/core/components/DashboardLayout.vue +0 -44
- package/dist/DashboardLayout-Dp8AnYD9.js +0 -141
- package/dist/EodashDatePicker-D_udZ26j.js +0 -1645
- package/dist/Footer-AohCH8U7.js +0 -118
- package/dist/MobileLayout-CgToA7Gp.js +0 -523
- package/dist/VBtn-Bz7ruRUg.js +0 -1106
- package/dist/VMain-BHfWJU2j.js +0 -35
- package/dist/asWebComponent-C8rb3b1D.js +0 -11323
- package/dist/color-DpYEub1f.js +0 -115
- package/dist/dimensions-CJaGeSrj.js +0 -53
- package/dist/eo-dash.js +0 -6
- package/dist/eox-stacinfo-B-YrT7Ug.js +0 -13698
- package/dist/index-Sa2Vg_gx.js +0 -65
- package/dist/style.css +0 -5
- /package/core/{asWebComponent.d.ts → client/asWebComponent.d.ts} +0 -0
- /package/core/{asWebComponent.js → client/asWebComponent.js} +0 -0
- /package/core/{components → client/components}/DynamicWebComponent.vue +0 -0
- /package/core/{components → client/components}/Footer.vue +0 -0
- /package/core/{components → client/components}/Header.vue +0 -0
- /package/core/{components → client/components}/IframeWrapper.vue +0 -0
- /package/core/{composables → client/composables}/DefineEodash.js +0 -0
- /package/core/{main.js → client/main.js} +0 -0
- /package/core/{plugins → client/plugins}/index.js +0 -0
- /package/core/{render.js → client/render.js} +0 -0
- /package/core/{store → client/store}/Actions.js +0 -0
- /package/core/{store → client/store}/States.js +0 -0
- /package/core/{store → client/store}/index.js +0 -0
- /package/core/{utils → client/utils}/eodashSTAC.js +0 -0
- /package/core/{utils → client/utils}/helpers.js +0 -0
- /package/core/{utils → client/utils}/index.js +0 -0
- /package/core/{utils → client/utils}/keys.js +0 -0
- /package/core/{vite-env.d.ts → client/vite-env.d.ts} +0 -0
- /package/dist/{.gitkeep → client/.gitkeep} +0 -0
- /package/dist/{_commonjsHelpers-DaMA6jEr.js → client/_commonjsHelpers-DaMA6jEr.js} +0 -0
- /package/dist/{basedecoder-Qm25PwVp-CHo5Pomv.js → client/basedecoder-Qm25PwVp-CHo5Pomv.js} +0 -0
- /package/dist/{deflate-Be2Arps5-hDqMz3RA.js → client/deflate-Be2Arps5-hDqMz3RA.js} +0 -0
- /package/dist/{eox-itemfilter-DcQkRD2l.js → client/eox-itemfilter-DcQkRD2l.js} +0 -0
- /package/dist/{forwardRefs-Bxeu9Obx.js → client/forwardRefs-Bxeu9Obx.js} +0 -0
- /package/dist/{jpeg-DNfUpLwy-Fjan-04T.js → client/jpeg-DNfUpLwy-Fjan-04T.js} +0 -0
- /package/dist/{lzw-BOMhmEDy-Dboc93VO.js → client/lzw-BOMhmEDy-Dboc93VO.js} +0 -0
- /package/dist/{packbits-DaUD6MLm-Bu1PoTGa.js → client/packbits-DaUD6MLm-Bu1PoTGa.js} +0 -0
- /package/dist/{pako.esm-C3kYPGGQ-BMki8cQY.js → client/pako.esm-C3kYPGGQ-BMki8cQY.js} +0 -0
- /package/dist/{raw-CcGKjn8q-DFOt-i8n.js → client/raw-CcGKjn8q-DFOt-i8n.js} +0 -0
- /package/dist/{webfontloader-CyOFAuFB.js → client/webfontloader-CyOFAuFB.js} +0 -0
- /package/dist/{webimage-D2c098k3-DLj1LQxB.js → client/webimage-D2c098k3-DLj1LQxB.js} +0 -0
package/dist/node/cli.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createLogger as P,defineConfig as C,searchForWorkspaceRoot as x,createServer as k,preview as S,build as F}from"vite";import{readFileSync as E,existsSync as u}from"fs";import t from"path";import{Command as U}from"commander";import{readFile as W,writeFile as I,rm as $,cp as N}from"fs/promises";import O from"@vitejs/plugin-vue";import T,{transformAssetUrls as A}from"vite-plugin-vuetify";const s=v(process.cwd()),b=new U("eodash"),H=JSON.parse(E(t.join(s,"package.json"),"utf-8"));b.version(H.version,"-v, --version","output the current version").option("--publicDir <path>","path to statically served assets folder").option("--no-publicDir","stop serving static assets").option("--outDir <path>","minified output folder").option("-e, --entryPoint <path>","file exporting `createEodash`").option("-w, --widgets <path>","folder that contains vue components as internal widgets").option("--cacheDir <path>","cache folder").option("-r, --runtime <path>","file exporting eodash client runtime config").option("-b, --base <path>","base public path").option("-p, --port <port>","serving port").option("-o, --open","open default browser when the server starts").option("-c, --config <path>","path to eodash server and build configuration file").option("--host [IP address]","specify which IP addresses the server should listen on").option("-l, --lib","builds eodash as a web component library").option("--no-lib","builds eodash as an SPA").option("--no-host","do not expose server to the network").parse(process.argv);const o=await z(b.opts(),process.argv?.[2]),c=v(),L=o.publicDir?t.resolve(s,o.publicDir):t.join(s,"./public"),h=t.join(s,"/src"),l=o.runtime?t.resolve(s,o.runtime):t.join(h,"./runtime.js"),w=o.entryPoint?t.resolve(s,o.entryPoint):t.join(h,"/main.js"),g=o.widgets?t.resolve(s,o.widgets):t.join(h,"widgets"),j=t.join(s,"/.eodash"),f=o.outDir?t.resolve(s,o.outDir):t.join(j,"/dist"),R=o.cacheDir?t.resolve(s,o.cacheDir):t.join(j,"cache"),m=P(void 0,{prefix:"[eodash]"});async function z(e,n){let a=e.config?t.resolve(s,e.config):t.join(s,"eodash.config.js"),i={};return u(a)?i=await import(a).then(r=>r.default instanceof Function?r.default():r.default).catch(r=>{console.error(r)}):a=null,{base:e.base??i?.base,port:Number(e.port??i?.[n]?.port),host:e.host??i?.[n]?.host,open:e.open??i?.[n]?.open,cacheDir:e.cacheDir??i?.cacheDir,entryPoint:e.entryPoint??i?.entryPoint,outDir:e.outDir??i?.outDir,publicDir:e.publicDir??i?.publicDir,runtime:e.runtime??i?.runtime,widgets:e.widgets??i?.widgets,lib:e.lib??i?.lib}}function v(e=import.meta.dirname){if(e.split("/").length)return u(t.resolve(e,"package.json"))?e:v(t.resolve(e,".."));throw new Error("no package root found")}const y=`
|
|
3
|
+
<!DOCTYPE html>
|
|
4
|
+
<html lang="en">
|
|
5
|
+
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="UTF-8" />
|
|
8
|
+
<link rel="icon" href="/favicon.ico" />
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
|
+
<title>Welcome to Eodash v5</title>
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
${o.lib?`<eo-dash style="height:100dvh;"/>
|
|
15
|
+
<script type="module" src="${t.resolve(`/@fs/${c}`,"core/client/asWebComponent.js")}"><\/script>
|
|
16
|
+
`:` <div id="app"/>
|
|
17
|
+
<script type="module" src="${t.resolve(`/@fs/${c}`,"core/client/render.js")}"><\/script>
|
|
18
|
+
`}
|
|
19
|
+
</body>
|
|
20
|
+
</html>`,D=C(async({mode:e,command:n})=>({base:o.base??"",cacheDir:R,plugins:[O({customElement:o.lib,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),T({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:J}],customLogger:m,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":w,"user:widgets":g},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:o.port??3e3,open:o.open,fs:{allow:[x(process.cwd())]},host:o.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs"],noDiscovery:!0}:{},publicDir:o.publicDir===!1?!1:L,build:{lib:o.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:f,emptyOutDir:!0,rollupOptions:o.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function J(e){e.watcher.add([w,l,t.join(g,"**/*.vue")]);let n="";const a=m.info;return m.info=(i,r)=>{if(i.includes("core")){const d=i.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(i,r)},e.watcher.on("change",async i=>{n=i,i===l&&e.hot.send({type:"full-reload",path:i})}),()=>{e.middlewares.use(async(i,r,d)=>{if(i.originalUrl==="/@fs/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await W(l).then(p=>{r.write(p)}),r.end();return}if(i.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(i.url,y,i.originalUrl);r.end(p);return}d()})}}const M=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},Y=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await N(l,t.join(f,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(o.lib)await e();else{const n=t.join(c,"/index.html");await I(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function B(){(await S({root:s,base:o.base??"",preview:{port:isNaN(o.port)?8080:o.port,open:o.open,host:o.host},build:{outDir:f}})).printUrls()}const G=process.argv?.[2];(async()=>{switch(G){case"dev":await M();break;case"build":await Y();break;case"preview":await B();break;default:console.error("command not found");break}})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Eodash CLI configuration
|
|
3
3
|
* @group CLI
|
|
4
4
|
*/
|
|
5
5
|
export interface EodashConfig {
|
|
@@ -40,6 +40,7 @@ export interface EodashConfig {
|
|
|
40
40
|
* File exporting eodash client runtime config
|
|
41
41
|
*/
|
|
42
42
|
runtime?: string
|
|
43
|
+
/** set a custom path for importing user defined internal widgets */
|
|
43
44
|
widgets?: string
|
|
44
45
|
/** builds eodash as a web component library */
|
|
45
46
|
lib?: boolean
|
|
@@ -49,4 +50,4 @@ export interface EodashConfig {
|
|
|
49
50
|
* without the need for JSDOC for `eodash.config.js`:
|
|
50
51
|
* @group CLI
|
|
51
52
|
*/
|
|
52
|
-
export declare const
|
|
53
|
+
export declare const defineConfig: (config: EodashConfig) => EodashConfig
|
package/package.json
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eodash/eodash",
|
|
3
|
-
"version": "5.0.0-alpha.2.
|
|
3
|
+
"version": "5.0.0-alpha.2.4",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"types": "./core/types.d.ts",
|
|
5
|
+
"types": "./core/client/types.d.ts",
|
|
6
6
|
"files": [
|
|
7
|
-
"core",
|
|
8
|
-
"bin",
|
|
7
|
+
"core/client",
|
|
9
8
|
"widgets",
|
|
10
9
|
"dist"
|
|
11
10
|
],
|
|
12
11
|
"exports": {
|
|
13
12
|
".": {
|
|
14
|
-
"types": "./core/types.d.ts",
|
|
15
|
-
"default": "./core/main.js"
|
|
16
|
-
},
|
|
17
|
-
"./config": {
|
|
18
|
-
"types": "./bin/types.d.ts",
|
|
19
|
-
"default": "./bin/main.js"
|
|
13
|
+
"types": "./core/client/types.d.ts",
|
|
14
|
+
"default": "./core/client/main.js"
|
|
20
15
|
},
|
|
21
16
|
"./webcomponent": {
|
|
22
|
-
"types": "./core/asWebComponent.d.ts",
|
|
23
|
-
"default": "./dist/eo-dash.js"
|
|
17
|
+
"types": "./core/client/asWebComponent.d.ts",
|
|
18
|
+
"default": "./dist/client/eo-dash.js"
|
|
24
19
|
},
|
|
25
|
-
"./webcomponent.css": "./dist/style.css"
|
|
20
|
+
"./webcomponent.css": "./dist/client/style.css",
|
|
21
|
+
"./config": {
|
|
22
|
+
"types": "./dist/node/types.d.ts",
|
|
23
|
+
"default": "./dist/node/main.js"
|
|
24
|
+
}
|
|
26
25
|
},
|
|
27
|
-
"browser": "./core/main.js",
|
|
26
|
+
"browser": "./core/client/main.js",
|
|
28
27
|
"scripts": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
28
|
+
"prepare": "rollup -c",
|
|
29
|
+
"prepack": "npm run build:lib",
|
|
30
|
+
"dev": "npx eodash dev --entryPoint core/client/eodash.js",
|
|
31
|
+
"build": "npx eodash build --entryPoint core/client/eodash.js",
|
|
32
|
+
"build:lib": "npx eodash build --entryPoint core/client/eodash.js --lib --outDir dist/client",
|
|
33
|
+
"build:cli": "rollup -c",
|
|
32
34
|
"check": "vue-tsc --noEmit --skipLibCheck && eslint .",
|
|
33
35
|
"check:lint": "eslint .",
|
|
34
36
|
"check:types": "vue-tsc --noEmit --skipLibCheck",
|
|
@@ -49,7 +51,7 @@
|
|
|
49
51
|
"@eox/layout": "^0.1.0",
|
|
50
52
|
"@eox/map": "^1.4.0",
|
|
51
53
|
"@eox/stacinfo": "^0.3.0",
|
|
52
|
-
"@mdi/
|
|
54
|
+
"@mdi/js": "^7.4.47",
|
|
53
55
|
"@vitejs/plugin-vue": "^5.0.0",
|
|
54
56
|
"animated-details": "gist:2912bb049fa906671807415eb0e87188",
|
|
55
57
|
"axios": "^1.6.2",
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
"vite": "^5.1.5",
|
|
63
65
|
"vite-plugin-vuetify": "^2.0.0",
|
|
64
66
|
"vue": "^3.2.0",
|
|
65
|
-
"vuetify": "^3.5
|
|
67
|
+
"vuetify": "^3.6.5",
|
|
66
68
|
"webfontloader": "^1.6.28"
|
|
67
69
|
},
|
|
68
70
|
"devDependencies": {
|
|
@@ -89,6 +91,6 @@
|
|
|
89
91
|
"vue-tsc": "^1.2.0"
|
|
90
92
|
},
|
|
91
93
|
"bin": {
|
|
92
|
-
"eodash": "./
|
|
94
|
+
"eodash": "./dist/node/cli.js"
|
|
93
95
|
}
|
|
94
96
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
type="date" bg-color="surface" color="primary" density="comfortable" label="Select Date" v-model="currentDate"
|
|
7
7
|
variant="plain" hide-details />
|
|
8
8
|
</div>
|
|
9
|
+
|
|
9
10
|
<v-date-picker v-else ref="datePicker" :width="width" :height="height" hide-header v-model="currentDate"
|
|
10
11
|
color="primary" bg-color="surface" location="center" class="overflow-auto fill-height fill-width"
|
|
11
12
|
position="relative" show-adjacent-months></v-date-picker>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
<script setup>
|
|
11
11
|
import { useDefineWidgets } from '@/composables/DefineWidgets';
|
|
12
|
-
import { onMounted } from 'vue';
|
|
12
|
+
import { nextTick, onMounted } from 'vue';
|
|
13
13
|
import { ref } from 'vue';
|
|
14
14
|
import { useLayout } from 'vuetify/lib/framework.mjs';
|
|
15
15
|
import 'animated-details'
|
|
@@ -38,9 +38,11 @@ const widgetHeight = ref('')
|
|
|
38
38
|
const summariesHeights = ref(0)
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const { mainRect } = useLayout()
|
|
42
|
+
onMounted(async () => {
|
|
43
|
+
await nextTick(() => {
|
|
44
|
+
summariesHeights.value = summaryEls.value.reduce((acc, el) => acc += el.clientHeight, 0)
|
|
45
|
+
widgetHeight.value = ((detailsEls.value[0].parentElement?.scrollHeight ?? 0) - summariesHeights.value - mainRect.value['top']) + 'px'
|
|
46
|
+
})
|
|
45
47
|
})
|
|
46
48
|
</script>
|
package/bin/app.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { buildApp, createDevServer, previewApp } from './cli.js'
|
|
4
|
-
|
|
5
|
-
const command = process.argv?.[2];
|
|
6
|
-
(async () => {
|
|
7
|
-
switch (command) {
|
|
8
|
-
case "dev":
|
|
9
|
-
await createDevServer();
|
|
10
|
-
break;
|
|
11
|
-
case "build":
|
|
12
|
-
await buildApp();
|
|
13
|
-
break;
|
|
14
|
-
case "preview":
|
|
15
|
-
await previewApp();
|
|
16
|
-
break;
|
|
17
|
-
|
|
18
|
-
default:
|
|
19
|
-
console.error('command not found')
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
})();
|
package/bin/cli.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { build, createServer, preview } from "vite"
|
|
4
|
-
import {
|
|
5
|
-
rootPath, appPath, buildTargetPath,
|
|
6
|
-
userConfig, runtimeConfigPath,
|
|
7
|
-
} from "./utils.js";
|
|
8
|
-
import { writeFile, rm, cp } from "fs/promises";
|
|
9
|
-
import { indexHtml, serverConfig } from "./serverConfig.js";
|
|
10
|
-
import path from "path";
|
|
11
|
-
import { existsSync } from "fs";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export const createDevServer = async () => {
|
|
15
|
-
const server = await createServer(await serverConfig({ mode: 'development', command: 'serve' }))
|
|
16
|
-
await server.listen()
|
|
17
|
-
server.printUrls()
|
|
18
|
-
server.bindCLIShortcuts({ print: true })
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const buildApp = async () => {
|
|
22
|
-
/** @param {"production"|"lib"} mode */
|
|
23
|
-
const viteBuild = async (mode) => {
|
|
24
|
-
const config = await serverConfig({ mode, command: 'build' });
|
|
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
|
-
}
|
|
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
|
-
})
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export async function previewApp() {
|
|
49
|
-
const previewServer = await preview({
|
|
50
|
-
root: rootPath,
|
|
51
|
-
base: userConfig.base ?? '',
|
|
52
|
-
preview: {
|
|
53
|
-
port: isNaN(userConfig.port) ? 8080 : userConfig.port,
|
|
54
|
-
open: userConfig.open,
|
|
55
|
-
host: userConfig.host
|
|
56
|
-
},
|
|
57
|
-
build: {
|
|
58
|
-
outDir: buildTargetPath,
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
previewServer.printUrls()
|
|
62
|
-
}
|
package/bin/main.js
DELETED
package/bin/serverConfig.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import vue from '@vitejs/plugin-vue';
|
|
4
|
-
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
|
|
5
|
-
import { fileURLToPath, URL } from 'url';
|
|
6
|
-
import {
|
|
7
|
-
runtimeConfigPath,
|
|
8
|
-
appPath, entryPath,
|
|
9
|
-
cachePath, publicPath, userConfig,
|
|
10
|
-
buildTargetPath,
|
|
11
|
-
logger,
|
|
12
|
-
rootPath,
|
|
13
|
-
internalWidgetsPath
|
|
14
|
-
} from "./utils.js";
|
|
15
|
-
import { readFile } from "fs/promises";
|
|
16
|
-
import { defineConfig, searchForWorkspaceRoot } from "vite"
|
|
17
|
-
import { existsSync } from 'fs';
|
|
18
|
-
import path from "path";
|
|
19
|
-
|
|
20
|
-
export const indexHtml = `
|
|
21
|
-
<!DOCTYPE html>
|
|
22
|
-
<html lang="en">
|
|
23
|
-
|
|
24
|
-
<head>
|
|
25
|
-
<meta charset="UTF-8" />
|
|
26
|
-
<link rel="icon" href="/favicon.ico" />
|
|
27
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
28
|
-
<title>Welcome to Eodash v5</title>
|
|
29
|
-
</head>
|
|
30
|
-
|
|
31
|
-
<body>
|
|
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
|
-
`}
|
|
37
|
-
</body>
|
|
38
|
-
</html>`
|
|
39
|
-
|
|
40
|
-
//@ts-expect-error
|
|
41
|
-
export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(defineConfig(async ({ mode, command }) => {
|
|
42
|
-
return {
|
|
43
|
-
base: userConfig.base ?? '',
|
|
44
|
-
cacheDir: cachePath,
|
|
45
|
-
plugins: [
|
|
46
|
-
vue({
|
|
47
|
-
customElement: userConfig.lib,
|
|
48
|
-
template: {
|
|
49
|
-
transformAssetUrls,
|
|
50
|
-
compilerOptions: {
|
|
51
|
-
isCustomElement: (tag) => !tag.includes('v-') && tag.includes('-')
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
}),
|
|
55
|
-
// https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin#readme
|
|
56
|
-
vuetify({
|
|
57
|
-
autoImport: true,
|
|
58
|
-
}),
|
|
59
|
-
(mode === "development" && {
|
|
60
|
-
name: "inject-html",
|
|
61
|
-
configureServer
|
|
62
|
-
})
|
|
63
|
-
],
|
|
64
|
-
customLogger: logger,
|
|
65
|
-
define: { 'process.env': {} },
|
|
66
|
-
resolve: {
|
|
67
|
-
alias: {
|
|
68
|
-
'@': fileURLToPath(new URL('../core', import.meta.url)),
|
|
69
|
-
'^': fileURLToPath(new URL('../widgets', import.meta.url)),
|
|
70
|
-
"user:config": entryPath,
|
|
71
|
-
"user:widgets": internalWidgetsPath
|
|
72
|
-
},
|
|
73
|
-
extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
|
|
74
|
-
},
|
|
75
|
-
server: {
|
|
76
|
-
warmup: {
|
|
77
|
-
clientFiles: [path.join(appPath, "core/**")]
|
|
78
|
-
},
|
|
79
|
-
port: userConfig.port ?? 3000,
|
|
80
|
-
open: userConfig.open,
|
|
81
|
-
fs: {
|
|
82
|
-
allow: [searchForWorkspaceRoot(process.cwd())]
|
|
83
|
-
},
|
|
84
|
-
host: userConfig.host
|
|
85
|
-
},
|
|
86
|
-
root: fileURLToPath(new URL('..', import.meta.url)),
|
|
87
|
-
optimizeDeps: mode === "development" ? {
|
|
88
|
-
include: ["webfontloader", "vuetify", "vue", "pinia", "stac-js", "urijs"],
|
|
89
|
-
noDiscovery: true,
|
|
90
|
-
} : {},
|
|
91
|
-
/** @type {string|false} */
|
|
92
|
-
publicDir: userConfig.publicDir === false ? false : publicPath,
|
|
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
|
-
},
|
|
100
|
-
outDir: buildTargetPath,
|
|
101
|
-
emptyOutDir: true,
|
|
102
|
-
rollupOptions: command == 'build' ? {
|
|
103
|
-
input: fileURLToPath(new URL(mode === 'lib' ? '../core/asWebComponent.js' : '../index.html', import.meta.url)),
|
|
104
|
-
} : undefined,
|
|
105
|
-
target: "esnext"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}));
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @type {import("vite").ServerHook}
|
|
114
|
-
*/
|
|
115
|
-
async function configureServer(server) {
|
|
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
|
-
}
|
|
130
|
-
|
|
131
|
-
server.watcher.on('change', async (path) => {
|
|
132
|
-
updatedPath = path
|
|
133
|
-
if (path === runtimeConfigPath) {
|
|
134
|
-
server.hot.send({
|
|
135
|
-
type: 'full-reload',
|
|
136
|
-
path: path
|
|
137
|
-
})
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
return () => {
|
|
142
|
-
server.middlewares.use(async (req, res, next) => {
|
|
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()
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (req.url?.endsWith('.html')) {
|
|
156
|
-
res.statusCode = 200
|
|
157
|
-
res.setHeader('Content-Type', 'text/html')
|
|
158
|
-
const html = await server.transformIndexHtml(req.url, indexHtml, req.originalUrl)
|
|
159
|
-
res.end(html)
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
next()
|
|
163
|
-
})
|
|
164
|
-
}
|
|
165
|
-
}
|
package/bin/utils.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { existsSync, readFileSync } from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
import { searchForWorkspaceRoot, createLogger } from 'vite';
|
|
7
|
-
import { Command } from 'commander';
|
|
8
|
-
|
|
9
|
-
export const rootPath = searchForWorkspaceRoot(process.cwd());
|
|
10
|
-
const cli = new Command('eodash')
|
|
11
|
-
|
|
12
|
-
const pkg = JSON.parse(
|
|
13
|
-
readFileSync(
|
|
14
|
-
path.join(rootPath, 'package.json')
|
|
15
|
-
, 'utf-8')
|
|
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
|
-
*/
|
|
34
|
-
cli.version(pkg.version, '-v, --version', 'output the current version')
|
|
35
|
-
.option('--publicDir <path>', 'path to statically served assets folder')
|
|
36
|
-
.option('--no-publicDir', 'stop serving static assets')
|
|
37
|
-
.option('--outDir <path>', 'minified output folder')
|
|
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')
|
|
42
|
-
.option('-b, --base <path>', 'base public path')
|
|
43
|
-
.option('-p, --port <port>', 'serving port')
|
|
44
|
-
.option('-o, --open', 'open default browser when the server starts')
|
|
45
|
-
.option('-c, --config <path>', 'path to eodash server and build configuration file')
|
|
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')
|
|
50
|
-
.parse(process.argv)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export const userConfig = await getUserConfig(cli.opts(), process.argv?.[2])
|
|
54
|
-
|
|
55
|
-
export const appPath = fileURLToPath(new URL("..", import.meta.url)),
|
|
56
|
-
publicPath = userConfig.publicDir ? path.resolve(rootPath, userConfig.publicDir) : path.join(rootPath, './public'),
|
|
57
|
-
srcPath = path.join(rootPath, "/src"),
|
|
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"),
|
|
61
|
-
dotEodashPath = path.join(rootPath, "/.eodash"),
|
|
62
|
-
buildTargetPath = userConfig.outDir ? path.resolve(rootPath, userConfig.outDir) : path.join(dotEodashPath, '/dist'),
|
|
63
|
-
cachePath = userConfig.cacheDir ? path.resolve(rootPath, userConfig.cacheDir) : path.join(dotEodashPath, 'cache');
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
}
|
|
103
|
-
}
|
package/core/App.vue
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-app>
|
|
3
|
-
<Suspense>
|
|
4
|
-
<!-- main content -->
|
|
5
|
-
<Dashboard />
|
|
6
|
-
|
|
7
|
-
<!-- loading state -->
|
|
8
|
-
<template #fallback>
|
|
9
|
-
<Loading />
|
|
10
|
-
</template>
|
|
11
|
-
</Suspense>
|
|
12
|
-
</v-app>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup>
|
|
16
|
-
import Loading from '@/components/Loading.vue';
|
|
17
|
-
import Dashboard from '@/views/Dashboard.vue';
|
|
18
|
-
|
|
19
|
-
</script>
|
|
@@ -1,65 +0,0 @@
|
|
|
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>
|