@eodash/eodash 5.0.0-alpha.2.3 → 5.0.0-alpha.2.5

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.
Files changed (91) hide show
  1. package/README.md +14 -5
  2. package/core/{SuspensedDashboard.ce.vue → client/SuspensedDashboard.ce.vue} +30 -16
  3. package/core/client/components/DashboardLayout.vue +59 -0
  4. package/core/{components → client/components}/ErrorAlert.vue +6 -1
  5. package/core/{components → client/components}/Footer.vue +6 -1
  6. package/core/{components → client/components}/Header.vue +6 -1
  7. package/core/{components → client/components}/IframeWrapper.vue +1 -1
  8. package/core/{components → client/components}/MobileLayout.vue +41 -10
  9. package/core/{composables → client/composables}/DefineEodash.js +2 -1
  10. package/core/{composables → client/composables}/DefineWidgets.js +14 -8
  11. package/core/{composables → client/composables}/index.js +18 -119
  12. package/core/{eodash.js → client/eodash.js} +38 -36
  13. package/core/{plugins → client/plugins}/index.js +3 -0
  14. package/core/{plugins → client/plugins}/vuetify.js +1 -1
  15. package/core/{types.d.ts → client/types.d.ts} +42 -85
  16. package/core/{utils → client/utils}/eodashSTAC.js +29 -25
  17. package/core/client/utils/index.js +32 -0
  18. package/core/{views → client/views}/Dashboard.vue +39 -10
  19. package/dist/client/DashboardLayout-BYROtP-7.js +156 -0
  20. package/dist/{DynamicWebComponent-CgDh2csQ.js → client/DynamicWebComponent-BQhxFPM0.js} +6 -6
  21. package/dist/client/EodashDatePicker-CFltnt5d.js +1194 -0
  22. package/dist/client/EodashItemFilter-DIBDAHcc.js +65 -0
  23. package/dist/{EodashMap-CyR-Ldpk.js → client/EodashMap-C6jJ2Lb_.js} +14337 -15676
  24. package/dist/client/Footer-BVIZms1S.js +115 -0
  25. package/dist/client/Header-TsTL1d2R.js +633 -0
  26. package/dist/{IframeWrapper-Csep3rMg.js → client/IframeWrapper-XKChM78a.js} +4 -4
  27. package/dist/client/MobileLayout-BlGcMQra.js +957 -0
  28. package/dist/{VMain-COrg6UtF.js → client/VMain-C9XV5Lyg.js} +8 -8
  29. package/dist/{WidgetsContainer-XA6_dKOm.js → client/WidgetsContainer-BQXHnZpa.js} +8 -8
  30. package/dist/client/asWebComponent-CbdGxelK.js +20188 -0
  31. package/dist/{decoder-kAoyGIq9-DjQanfeo.js → client/decoder-HRvnjnEI-CHAYOWhz.js} +1 -1
  32. package/dist/client/eo-dash.js +6 -0
  33. package/dist/{eox-map-BJ9SIixs.js → client/eox-map-C3DL31fp.js} +1882 -1809
  34. package/dist/client/eox-stacinfo-l7ALSV90.js +13969 -0
  35. package/dist/client/forwardRefs-CyCJOFsz.js +192 -0
  36. package/dist/client/http-ZWiLaAeR.js +1337 -0
  37. package/dist/{index-Cskxla5D.js → client/index-CabQjjQg.js} +43 -74
  38. package/dist/{lerc-C9VL9kri-O4muG-MO.js → client/lerc-_E46UbWQ-TxBH4OeK.js} +1 -1
  39. package/dist/{ssrBoot-DCCAW5xY.js → client/ssrBoot-DWJ-z4I-.js} +3 -3
  40. package/dist/{style.css → client/style.css} +2 -2
  41. package/dist/client/transition-BlLt41wg.js +34 -0
  42. package/dist/node/cli.js +20 -0
  43. package/dist/node/main.js +2 -0
  44. package/{bin → dist/node}/types.d.ts +2 -2
  45. package/package.json +22 -21
  46. package/widgets/EodashDatePicker.vue +89 -36
  47. package/widgets/EodashItemFilter.vue +30 -14
  48. package/bin/app.js +0 -22
  49. package/bin/cli.js +0 -62
  50. package/bin/main.js +0 -9
  51. package/bin/serverConfig.js +0 -165
  52. package/bin/utils.js +0 -103
  53. package/core/components/DashboardLayout.vue +0 -36
  54. package/core/utils/index.js +0 -28
  55. package/dist/DashboardLayout-lzEvtalW.js +0 -148
  56. package/dist/EodashDatePicker-bIyNUYaG.js +0 -1653
  57. package/dist/EodashItemFilter-CpgyrJRX.js +0 -51
  58. package/dist/Footer-C2sIHSym.js +0 -118
  59. package/dist/Header-DFz2BUnp.js +0 -605
  60. package/dist/MobileLayout-CXNJL_q6.js +0 -984
  61. package/dist/asWebComponent-fqvymeM-.js +0 -13092
  62. package/dist/eo-dash.js +0 -6
  63. package/dist/eox-stacinfo-B-YrT7Ug.js +0 -13698
  64. package/dist/forwardRefs-Bxeu9Obx.js +0 -142
  65. package/dist/index-Zv5eTiB6.js +0 -34
  66. /package/core/{App.vue → client/App.vue} +0 -0
  67. /package/core/{asWebComponent.d.ts → client/asWebComponent.d.ts} +0 -0
  68. /package/core/{asWebComponent.js → client/asWebComponent.js} +0 -0
  69. /package/core/{components → client/components}/DynamicWebComponent.vue +0 -0
  70. /package/core/{components → client/components}/Loading.vue +0 -0
  71. /package/core/{main.js → client/main.js} +0 -0
  72. /package/core/{render.js → client/render.js} +0 -0
  73. /package/core/{store → client/store}/Actions.js +0 -0
  74. /package/core/{store → client/store}/States.js +0 -0
  75. /package/core/{store → client/store}/index.js +0 -0
  76. /package/core/{store → client/store}/stac.js +0 -0
  77. /package/core/{utils → client/utils}/helpers.js +0 -0
  78. /package/core/{utils → client/utils}/keys.js +0 -0
  79. /package/core/{vite-env.d.ts → client/vite-env.d.ts} +0 -0
  80. /package/dist/{.gitkeep → client/.gitkeep} +0 -0
  81. /package/dist/{_commonjsHelpers-DaMA6jEr.js → client/_commonjsHelpers-DaMA6jEr.js} +0 -0
  82. /package/dist/{basedecoder-Qm25PwVp-CHo5Pomv.js → client/basedecoder-Qm25PwVp-CHo5Pomv.js} +0 -0
  83. /package/dist/{deflate-Be2Arps5-hDqMz3RA.js → client/deflate-Be2Arps5-hDqMz3RA.js} +0 -0
  84. /package/dist/{eox-itemfilter-DcQkRD2l.js → client/eox-itemfilter-DcQkRD2l.js} +0 -0
  85. /package/dist/{jpeg-DNfUpLwy-Fjan-04T.js → client/jpeg-DNfUpLwy-Fjan-04T.js} +0 -0
  86. /package/dist/{lzw-BOMhmEDy-Dboc93VO.js → client/lzw-BOMhmEDy-Dboc93VO.js} +0 -0
  87. /package/dist/{packbits-DaUD6MLm-Bu1PoTGa.js → client/packbits-DaUD6MLm-Bu1PoTGa.js} +0 -0
  88. /package/dist/{pako.esm-C3kYPGGQ-BMki8cQY.js → client/pako.esm-C3kYPGGQ-BMki8cQY.js} +0 -0
  89. /package/dist/{raw-CcGKjn8q-DFOt-i8n.js → client/raw-CcGKjn8q-DFOt-i8n.js} +0 -0
  90. /package/dist/{webfontloader-CyOFAuFB.js → client/webfontloader-CyOFAuFB.js} +0 -0
  91. /package/dist/{webimage-D2c098k3-DLj1LQxB.js → client/webimage-D2c098k3-DLj1LQxB.js} +0 -0
@@ -0,0 +1,34 @@
1
+ import { p as m, aw as d, d as l, av as u, ab as b } from "./asWebComponent-CbdGxelK.js";
2
+ const j = m({
3
+ transition: {
4
+ type: [Boolean, String, Object],
5
+ default: "fade-transition",
6
+ validator: (o) => o !== !0
7
+ }
8
+ }, "transition"), T = (o, s) => {
9
+ let {
10
+ slots: e
11
+ } = s;
12
+ const {
13
+ transition: t,
14
+ disabled: n,
15
+ group: r,
16
+ ...a
17
+ } = o, {
18
+ component: i = r ? u : b,
19
+ ...p
20
+ } = typeof t == "object" ? t : {};
21
+ return d(i, l(typeof t == "string" ? {
22
+ name: n ? "" : t
23
+ } : p, typeof t == "string" ? {} : Object.fromEntries(Object.entries({
24
+ disabled: n,
25
+ group: r
26
+ }).filter((c) => {
27
+ let [y, f] = c;
28
+ return f !== void 0;
29
+ })), a), e);
30
+ };
31
+ export {
32
+ T as M,
33
+ j as m
34
+ };
@@ -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 U,existsSync as u}from"fs";import t from"path";import{Command as E}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 E("eodash"),H=JSON.parse(U(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 i=await z(b.opts(),process.argv?.[2]),c=v(),L=i.publicDir?t.resolve(s,i.publicDir):t.join(s,"./public"),h=t.join(s,"/src"),l=i.runtime?t.resolve(s,i.runtime):t.join(h,"./runtime.js"),g=i.entryPoint?t.resolve(s,i.entryPoint):t.join(h,"/main.js"),w=i.widgets?t.resolve(s,i.widgets):t.join(h,"widgets"),j=t.join(s,"/.eodash"),f=i.outDir?t.resolve(s,i.outDir):t.join(j,"/dist"),R=i.cacheDir?t.resolve(s,i.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"),o={};return u(a)?o=await import(a).then(r=>r.default instanceof Function?r.default():r.default).catch(r=>{console.error(r)}):a=null,{base:e.base??o?.base,port:Number(e.port??o?.[n]?.port),host:e.host??o?.[n]?.host,open:e.open??o?.[n]?.open,cacheDir:e.cacheDir??o?.cacheDir,entryPoint:e.entryPoint??o?.entryPoint,outDir:e.outDir??o?.outDir,publicDir:e.publicDir??o?.publicDir,runtime:e.runtime??o?.runtime,widgets:e.widgets??o?.widgets,lib:e.lib??o?.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
+ ${i.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:i.base??"",cacheDir:R,plugins:[O({customElement:!1,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":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:L,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:f,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function J(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=m.info;return m.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/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(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.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(i.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:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.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}})();
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ const e=n=>n;export{e as defineConfig};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Extending [Vite's](https://vitejs.dev/) config to configure eodash's server, build and setup.
2
+ * Eodash CLI configuration
3
3
  * @group CLI
4
4
  */
5
5
  export interface EodashConfig {
@@ -50,4 +50,4 @@ export interface EodashConfig {
50
50
  * without the need for JSDOC for `eodash.config.js`:
51
51
  * @group CLI
52
52
  */
53
- export declare const definConfig: (config: EodashConfig) => EodashConfig
53
+ export declare const defineConfig: (config: EodashConfig) => EodashConfig
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.2.3",
3
+ "version": "5.0.0-alpha.2.5",
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
- "dev": "npx eodash dev --entryPoint core/eodash.js",
30
- "build": "npx eodash build --entryPoint core/eodash.js",
31
- "build:lib": "npx eodash build --entryPoint core/eodash.js --lib --outDir dist",
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
- "check:lint": "eslint .",
34
- "check:types": "vue-tsc --noEmit --skipLibCheck",
35
35
  "preview": "npx eodash preview",
36
36
  "lint": "eslint . --fix",
37
37
  "cypress": "cypress open --component ",
@@ -59,6 +59,7 @@
59
59
  "sass": "^1.60.0",
60
60
  "stac-js": "^0.0.9",
61
61
  "stac-ts": "^1.0.3",
62
+ "v-calendar": "^3.1.2",
62
63
  "vite": "^5.1.5",
63
64
  "vite-plugin-vuetify": "^2.0.0",
64
65
  "vue": "^3.2.0",
@@ -89,6 +90,6 @@
89
90
  "vue-tsc": "^1.2.0"
90
91
  },
91
92
  "bin": {
92
- "eodash": "./bin/app.js"
93
+ "eodash": "./dist/node/cli.js"
93
94
  }
94
- }
95
+ }
@@ -1,36 +1,68 @@
1
1
  <template>
2
- <span class="fill-height fill-width align-center justify-center">
3
- <div v-if="inline" class="fill-height fill-width">
4
-
5
- <v-text-field ref="inlineDatePicker" base-color="primary" class="fill-height fill-width pa-2 align-center"
6
- type="date" bg-color="surface" color="primary" density="comfortable" label="Select Date" v-model="currentDate"
7
- variant="plain" hide-details />
8
- </div>
9
-
10
- <v-date-picker v-else ref="datePicker" :width="width" :height="height" hide-header v-model="currentDate"
11
- color="primary" bg-color="surface" location="center" class="overflow-auto fill-height fill-width"
12
- position="relative" show-adjacent-months></v-date-picker>
13
- </span>
2
+ <VCDatePicker v-model="currentDate" :masks="masks" :attributes="attributes">
3
+ <template #default="{ inputValue, inputEvents }">
4
+ <div class="flex rounded-lg border border-gray-300 dark:border-gray-600" style="margin: 2px;">
5
+ <input :value="inputValue" v-on="inputEvents" style="margin: 1px;"
6
+ class="flex-grow px-1 py-1 bg-white dark:bg-gray-700" />
7
+ </div>
8
+ </template>
9
+ </VCDatePicker>
10
+ <v-row align="center" justify="center" style="margin-top: 6px;">
11
+ <v-btn density="compact" v-tooltip:bottom="'Set date to latest available dataset'" @click="jumpDate">
12
+ <v-icon :icon="[mdiRayStartArrow]" />
13
+ </v-btn>
14
+ </v-row>
14
15
  </template>
16
+
15
17
  <script setup>
16
- import { computed, ref, onMounted } from "vue";
17
- import { datetime } from "@/store/States"
18
+ import { DatePicker as VCDatePicker } from 'v-calendar';
19
+ import 'v-calendar/style.css';
20
+ import { computed, ref, onMounted, watch, inject } from "vue";
21
+ import { eodashKey } from "@/utils/keys";
22
+ import { toAbsolute } from "stac-js/src/http.js";
23
+ import { storeToRefs } from "pinia";
24
+ import { useSTAcStore } from '@/store/stac';
25
+ import { datetime } from "@/store/States";
26
+ import { mdiRayStartArrow } from '@mdi/js';
18
27
 
19
- const props = defineProps({
20
- inline: {
21
- type: Boolean
28
+ function jumpDate() {
29
+ if (attributes.value && attributes.value.length > 0) {
30
+ // We have potentially multiple collections we need to iterate (currently only one)
31
+ let latestDateMS = 0;
32
+ attributes.value.forEach((coll) => {
33
+ if (coll?.dates) {
34
+ coll.dates.forEach((d) => {
35
+ // TODO: we need to handle time ranges and other options here
36
+ if (d instanceof Date && d.getTime() > latestDateMS) {
37
+ latestDateMS = d.getTime();
38
+ }
39
+ })
40
+ }
41
+ })
42
+ if (latestDateMS !== 0) {
43
+ currentDate.value = new Date(latestDateMS);
44
+ }
22
45
  }
23
- })
46
+ }
47
+
48
+ const eodashConfig = /** @type {import("@/types").Eodash} */ inject(eodashKey);
49
+
50
+ const masks = ref({
51
+ input: 'YYYY-MM-DD',
52
+ });
53
+
54
+ /**
55
+ * Attributes displayed on datepicker
56
+ * @type {import("vue").Ref<(import('v-calendar/dist/types/src/utils/attribute').AttributeConfig|undefined)[]>}
57
+ */
58
+ const attributes = ref([]);
24
59
 
25
60
  const currentDate = computed({
26
61
  get() {
27
- return props.inline ? datetime.value.split("T")[0] : new Date(datetime.value) ?? new Date()
62
+ return new Date(datetime.value) ?? new Date()
28
63
  },
29
64
  /** @param {Date | string} updatedDate */
30
65
  set(updatedDate) {
31
- if (props.inline) {
32
- updatedDate = new Date(updatedDate);
33
- }
34
66
  //@ts-expect-error
35
67
  if (updatedDate instanceof Date && !isNaN(updatedDate)) {
36
68
  datetime.value = new Date(updatedDate.getTime() - updatedDate.getTimezoneOffset() * 60000).toISOString()
@@ -39,19 +71,40 @@ const currentDate = computed({
39
71
  }
40
72
  }
41
73
  });
42
-
43
- /**
44
- * @type {import("vue").Ref<import("vuetify/components").VDatePicker | null>}
45
- **/
46
- const datePicker = ref(null)
47
- /** @type {import("vue").Ref<string|undefined>} */
48
- const width = ref()
49
- /** @type {import("vue").Ref<string|undefined>} */
50
- const height = ref()
74
+ /** @type {import("@/types").WebComponentProps["onMounted"]} */
51
75
  onMounted(() => {
52
- /** @type {HTMLElement} */
53
- const parentEl = datePicker.value?.$el.parentElement?.parentElement
54
- width.value = parentEl?.clientWidth ? parentEl.clientWidth + "px" : undefined
55
- height.value = parentEl?.clientHeight ? parentEl.clientHeight + "px" : undefined
56
- })
76
+ const { selectedStac } = storeToRefs(useSTAcStore());
77
+ watch(
78
+ [selectedStac],
79
+ async ([updatedStac]) => {
80
+ if (updatedStac) {
81
+ const parentCollUrl = toAbsolute(
82
+ `./${updatedStac.id}/collection.json`,
83
+ eodashConfig.stacEndpoint
84
+ );
85
+ const childCollUrl = toAbsolute(
86
+ updatedStac.links[1].href,
87
+ parentCollUrl
88
+ );
89
+
90
+ const stacCollection = await (await fetch(childCollUrl)).json();
91
+ const dates = stacCollection.links
92
+ .filter(
93
+ (/** @type {{ rel: string; datetime: string; }} */ item) => (
94
+ item.rel === 'item' && 'datetime' in item
95
+ )
96
+ )
97
+ .map((/** @type {{ datetime: string; }} */ it) => new Date(it.datetime));
98
+ attributes.value = [
99
+ {
100
+ bar: true,
101
+ dates,
102
+ }
103
+ ];
104
+ }
105
+ },
106
+ { immediate: true }
107
+ );
108
+ });
109
+
57
110
  </script>
@@ -3,7 +3,6 @@
3
3
  </template>
4
4
  <script setup>
5
5
  import DynamicWebComponent from "@/components/DynamicWebComponent.vue";
6
- import { indicator } from "@/store/States";
7
6
 
8
7
  const link = () => import("@eox/itemfilter");
9
8
 
@@ -15,22 +14,48 @@ const properties = {
15
14
  keys: ["title", "themes"],
16
15
  title: "Search",
17
16
  type: "text",
18
- expanded: true,
17
+ // expanded: true,
19
18
  },
20
19
  {
21
20
  key: "themes",
22
- title: "Theme",
21
+ title: "Theme Filter",
23
22
  type: "multiselect",
24
- featured: true,
23
+ // featured: true,
24
+ // expanded: true
25
25
  },
26
26
  ],
27
27
  aggregateResults: "themes",
28
28
  enableHighlighting: true,
29
+ expandMultipleFilters: false,
30
+ expandMultipleResults: false,
29
31
  },
30
32
  };
31
33
 
32
- /** @type {import("../core/types").WebComponentProps["onMounted"]}*/
34
+ /** @type {import("@/types").WebComponentProps["onMounted"]}*/
33
35
  const onMounted = (el, store) => {
36
+ /** @type {any} */ (el).style.height = "100%";
37
+
38
+ const style = document.createElement("style");
39
+ style.innerHTML = `
40
+ section {
41
+ margin: 0 !important;
42
+ }
43
+ section button#filter-reset {
44
+ padding: 0 8px;
45
+ top: 8px;
46
+ right: 8px;
47
+ }
48
+ `;
49
+ el?.shadowRoot?.appendChild(style);
50
+
51
+ const filterstitle = document.createElement("div");
52
+ filterstitle.setAttribute("slot", "filterstitle");
53
+ filterstitle.innerHTML = `<h4 style="margin: 14px 8px">Indicators</h4>`;
54
+ /** @type {any} */ (el).appendChild(filterstitle);
55
+ const resultstitle = document.createElement("div");
56
+ resultstitle.setAttribute("slot", "resultstitle");
57
+ /** @type {any} */ (el).appendChild(resultstitle);
58
+
34
59
  /**
35
60
  * @typedef {object} Item
36
61
  * @property {string} href
@@ -39,15 +64,6 @@ const onMounted = (el, store) => {
39
64
  // Only list child elements in list
40
65
  store.stac?.filter((item) => item.rel === "child")
41
66
  );
42
- // Check if selected indicator was already set in store
43
- if (indicator && indicator.value !== "") {
44
- const match = store.stac?.find((item) => item.id === indicator.value);
45
- if (match) {
46
- //@ts-expect-error
47
- (el).selectedResult = match;
48
- store.loadSelectedSTAC(match.href);
49
- }
50
- }
51
67
  /** @type {any} */ (el).config.onSelect =
52
68
  /**
53
69
  * @param {Item} item
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
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * @param {import('./types').EodashConfig} config
5
- */
6
- export const defineConfig = (config) => {
7
- return config
8
- }
9
-
@@ -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
- }