@eodash/eodash 5.0.0-alpha.2 → 5.0.0-alpha.2.10

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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -3
  3. package/core/client/App.vue +26 -0
  4. package/core/client/SuspensedDashboard.ce.vue +105 -0
  5. package/core/client/asWebComponent.d.ts +23 -0
  6. package/core/client/asWebComponent.js +12 -0
  7. package/core/client/components/DashboardLayout.vue +77 -0
  8. package/core/client/components/DynamicWebComponent.vue +68 -0
  9. package/core/client/components/ErrorAlert.vue +36 -0
  10. package/core/{components → client/components}/Footer.vue +34 -15
  11. package/core/client/components/Header.vue +19 -0
  12. package/core/client/components/IframeWrapper.vue +11 -0
  13. package/core/client/components/Loading.vue +37 -0
  14. package/core/client/components/MobileLayout.vue +109 -0
  15. package/core/client/composables/DefineEodash.js +67 -0
  16. package/core/client/composables/DefineWidgets.js +161 -0
  17. package/core/client/composables/index.js +136 -0
  18. package/core/client/eodash.js +136 -0
  19. package/core/client/main.js +2 -0
  20. package/core/client/plugins/index.js +20 -0
  21. package/core/client/plugins/vuetify.js +35 -0
  22. package/core/client/render.js +12 -0
  23. package/core/client/store/Actions.js +62 -0
  24. package/core/client/store/States.js +21 -0
  25. package/core/client/store/index.js +20 -0
  26. package/core/client/store/stac.js +81 -0
  27. package/core/client/types.d.ts +287 -0
  28. package/core/client/utils/eodashSTAC.js +337 -0
  29. package/core/client/utils/helpers.js +172 -0
  30. package/core/client/utils/index.js +51 -0
  31. package/core/{utils → client/utils}/keys.js +2 -2
  32. package/core/client/views/Dashboard.vue +116 -0
  33. package/core/client/vite-env.d.ts +39 -0
  34. package/dist/client/DashboardLayout-C_3q8Y10.js +156 -0
  35. package/dist/{DynamicWebComponent-BDOQsEcj.js → client/DynamicWebComponent-IiTTLBt-.js} +11 -11
  36. package/dist/client/EodashDatePicker-DgC1lccp.js +252 -0
  37. package/dist/{eox-itemfilter-DcQkRD2l.js → client/EodashItemFilter-DoWZGe6r.js} +1515 -1381
  38. package/dist/client/EodashMap-C96D3LLv.js +114352 -0
  39. package/dist/client/EodashMapBtns-DDtzV94u.js +50 -0
  40. package/dist/client/ExportState-CduS2mFs.js +558 -0
  41. package/dist/client/Footer-DHQcutCv.js +115 -0
  42. package/dist/client/Header-DC0y7rLK.js +350 -0
  43. package/dist/{IframeWrapper-DYHQQRUh.js → client/IframeWrapper-BK-10FbS.js} +4 -4
  44. package/dist/client/MobileLayout-BpLoMY4i.js +945 -0
  45. package/dist/client/PopUp-CNMCWL0z.js +300 -0
  46. package/dist/client/VImg-DT7eb8V-.js +291 -0
  47. package/dist/client/VMain-OenWyy46.js +39 -0
  48. package/dist/client/VOverlay-x3UXpKhr.js +972 -0
  49. package/dist/{WidgetsContainer-D_PLP1qf.js → client/WidgetsContainer-qMUwtN0W.js} +26 -19
  50. package/dist/client/asWebComponent-DQrnLsI2.js +20404 -0
  51. package/dist/{basedecoder-Qm25PwVp-CHo5Pomv.js → client/basedecoder-DHcBySSe-BmCFNFnw.js} +5 -6
  52. package/dist/{decoder-kAoyGIq9-HAkjSTCt.js → client/decoder-Cth6J7EK-CtUoHA6r.js} +1 -1
  53. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +10 -0
  54. package/dist/client/eo-dash.js +6 -0
  55. package/dist/client/eox-jsonform-DCErgjhw.js +17515 -0
  56. package/dist/client/eox-layercontrol-D0Ht7Mag.js +21298 -0
  57. package/dist/client/eox-stacinfo-l7ALSV90.js +13969 -0
  58. package/dist/client/forwardRefs-CpNjL95t.js +185 -0
  59. package/dist/client/helpers-KCSgmfim.js +1417 -0
  60. package/dist/{index-8ch8xKfa.js → client/index-DopVrUzM.js} +21 -20
  61. package/dist/{jpeg-DNfUpLwy-Fjan-04T.js → client/jpeg-BAgeD1d3-oeHbFPUL.js} +5 -6
  62. package/dist/{lerc-C9VL9kri-DyVxBvsf.js → client/lerc-BgbQqdFI-D986ErVw.js} +37 -39
  63. package/dist/{lzw-BOMhmEDy-Dboc93VO.js → client/lzw-LAGDNbSC-DkP96qO9.js} +1 -1
  64. package/dist/{packbits-DaUD6MLm-Bu1PoTGa.js → client/packbits-BlDR4Kj5-C66n1-zr.js} +1 -1
  65. package/dist/{pako.esm-C3kYPGGQ-BMki8cQY.js → client/pako.esm-CB1uQYY0-DB0PYm1P.js} +6 -12
  66. package/dist/{raw-CcGKjn8q-DFOt-i8n.js → client/raw-CMGvRjfu-BRi6E4i1.js} +1 -1
  67. package/dist/{ssrBoot-Cm5pWM14.js → client/ssrBoot-DkjdOWvj.js} +1 -1
  68. package/dist/client/style.css +5 -0
  69. package/dist/client/transition-BtJHh7JK.js +34 -0
  70. package/dist/{webfontloader-CyOFAuFB.js → client/webfontloader-qotgY98I.js} +56 -92
  71. package/dist/{webimage-D2c098k3-DLj1LQxB.js → client/webimage-BM_pbLN3-L2cGWK5l.js} +1 -1
  72. package/dist/node/cli.js +20 -0
  73. package/dist/node/main.js +2 -0
  74. package/dist/node/types.d.ts +47 -0
  75. package/package.json +54 -51
  76. package/widgets/EodashDatePicker.vue +145 -40
  77. package/widgets/EodashItemFilter.vue +73 -38
  78. package/widgets/EodashMap.vue +210 -37
  79. package/widgets/EodashMapBtns.vue +50 -0
  80. package/widgets/ExportState.vue +112 -0
  81. package/widgets/PopUp.vue +40 -0
  82. package/widgets/WidgetsContainer.vue +47 -27
  83. package/bin/app.js +0 -22
  84. package/bin/cli.js +0 -62
  85. package/bin/main.js +0 -9
  86. package/bin/serverConfig.js +0 -165
  87. package/bin/types.d.ts +0 -52
  88. package/bin/utils.js +0 -103
  89. package/core/App.vue +0 -19
  90. package/core/SuspensedDashboard.ce.vue +0 -59
  91. package/core/asWebComponent.d.ts +0 -18
  92. package/core/asWebComponent.js +0 -12
  93. package/core/components/DashboardLayout.vue +0 -54
  94. package/core/components/DynamicWebComponent.vue +0 -68
  95. package/core/components/Header.vue +0 -14
  96. package/core/components/IframeWrapper.vue +0 -11
  97. package/core/components/Loading.vue +0 -27
  98. package/core/components/MobileLayout.vue +0 -49
  99. package/core/composables/DefineEodash.js +0 -57
  100. package/core/composables/DefineWidgets.js +0 -129
  101. package/core/composables/index.js +0 -219
  102. package/core/eodash.js +0 -100
  103. package/core/main.js +0 -2
  104. package/core/plugins/index.js +0 -18
  105. package/core/plugins/vuetify.js +0 -30
  106. package/core/render.js +0 -13
  107. package/core/store/Actions.js +0 -0
  108. package/core/store/States.js +0 -21
  109. package/core/store/index.js +0 -17
  110. package/core/store/stac.js +0 -63
  111. package/core/types.d.ts +0 -355
  112. package/core/utils/eodashSTAC.js +0 -164
  113. package/core/utils/helpers.js +0 -40
  114. package/core/utils/index.js +0 -28
  115. package/core/views/Dashboard.vue +0 -59
  116. package/core/vite-env.d.ts +0 -31
  117. package/dist/DashboardLayout-YLfAa8wH.js +0 -168
  118. package/dist/EodashDatePicker-DlehqSgz.js +0 -1645
  119. package/dist/EodashItemFilter-TSp7XRGy.js +0 -51
  120. package/dist/EodashMap-DInb9cfS.js +0 -53405
  121. package/dist/Footer-CIzHgJbK.js +0 -118
  122. package/dist/Header-C5PSB8Uc.js +0 -609
  123. package/dist/MobileLayout-DZmqrpub.js +0 -523
  124. package/dist/VBtn-CFPhsIX8.js +0 -1106
  125. package/dist/VMain-deI9jyIf.js +0 -35
  126. package/dist/asWebComponent-BKe6Spni.js +0 -11323
  127. package/dist/color-D72nEBIR.js +0 -115
  128. package/dist/deflate-Be2Arps5-hDqMz3RA.js +0 -10
  129. package/dist/dimensions-BZkmIizV.js +0 -53
  130. package/dist/eo-dash.js +0 -6
  131. package/dist/eox-map-BJ9SIixs.js +0 -36205
  132. package/dist/eox-stacinfo-B-YrT7Ug.js +0 -13698
  133. package/dist/forwardRefs-Bxeu9Obx.js +0 -142
  134. package/dist/index-DIt8GjSR.js +0 -65
  135. package/dist/style.css +0 -5
  136. /package/dist/{.gitkeep → client/.gitkeep} +0 -0
  137. /package/dist/{_commonjsHelpers-DaMA6jEr.js → client/_commonjsHelpers-DaMA6jEr.js} +0 -0
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <PopUp v-model="dialog">
3
+ <v-card>
4
+ <v-card-title class="bg-primary">
5
+ <h5 class="text-h5">Storytelling map configuration</h5>
6
+ </v-card-title>
7
+
8
+ <v-card-text class="py-5">
9
+ <p class="text-body-2">
10
+ Copy and paste this code into the map layers field of the storytelling
11
+ editor:
12
+ </p>
13
+ <div class="pa-3 code-block">
14
+ {{ getLayers() }}
15
+ </div>
16
+
17
+ <div style="position: absolute; bottom: 15px">
18
+ <v-expand-transition>
19
+ <div v-if="copySuccess" class="text-success mr-3">
20
+ <v-icon color="success" left :icon="[mdiClipboardCheckOutline]" />
21
+ <small>copied!</small>
22
+ </div>
23
+ </v-expand-transition>
24
+ </div>
25
+ <v-row class="d-flex pt-3 justify-end">
26
+ <v-col cols="6" class="flex-column align-center text-end">
27
+ <v-btn
28
+ v-for="btn in copyBtns"
29
+ class="text-body-2"
30
+ @click="btn.copyFn"
31
+ :key="btn.id"
32
+ small
33
+ variant="text"
34
+ :prepend-icon="[mdiContentCopy]"
35
+ >
36
+ copy as {{ btn.copyAs }}
37
+ </v-btn>
38
+ </v-col>
39
+ </v-row>
40
+ </v-card-text>
41
+
42
+ <v-divider></v-divider>
43
+
44
+ <v-card-actions>
45
+ <v-spacer></v-spacer>
46
+ <v-btn variant="text" @click="dialog = !dialog"> Close </v-btn>
47
+ </v-card-actions>
48
+ </v-card>
49
+ </PopUp>
50
+ </template>
51
+ <script setup>
52
+ import { mdiClipboardCheckOutline, mdiContentCopy } from "@mdi/js";
53
+ import PopUp from "./PopUp.vue";
54
+ import { copyToClipBoard } from "@/utils";
55
+ import { computed, ref } from "vue";
56
+ import { getLayers as getLayerAction } from "@/store/Actions";
57
+ import { mapPosition } from "@/store/States";
58
+
59
+ const dialog = defineModel({ type: Boolean, required: true, default: false });
60
+
61
+ const props = defineProps({
62
+ getLayers: {
63
+ type: Function,
64
+ default: getLayerAction,
65
+ },
66
+ });
67
+
68
+ const copySuccess = ref(false);
69
+
70
+ const copyBtns = [
71
+ {
72
+ id: Symbol(),
73
+ copyFn: async () => await copyToClipBoard(mapEntryCode.value, copySuccess),
74
+ copyAs: "simple map",
75
+ },
76
+ {
77
+ id: Symbol(),
78
+ copyFn: async () =>
79
+ await copyToClipBoard(JSON.stringify(props.getLayers()), copySuccess),
80
+ copyAs: "layers configuration",
81
+ },
82
+ {
83
+ id: Symbol(),
84
+ copyFn: async () => await copyToClipBoard(mapStepCode.value, copySuccess),
85
+ copyAs: "map tour section",
86
+ },
87
+ ];
88
+
89
+ const mapStepCode = computed(() => {
90
+ const [x, y, z] = mapPosition.value;
91
+ const preTag = "### <!--{ layers=";
92
+ const endTag = `zoom="${z}" center=[${[x, y]}] animationOptions={duration:500}}-->
93
+ #### Tour step title
94
+ Text describing the current step of the tour and why it is interesting what the map shows currently
95
+ `;
96
+ return `${preTag}'${JSON.stringify(props.getLayers())}' ${endTag}`;
97
+ });
98
+ const mapEntryCode = computed(() => {
99
+ const [x, y, z] = mapPosition.value;
100
+ const preTag =
101
+ '## Map Example <!--{as="eox-map" style="width: 100%; height: 500px;" layers=';
102
+ const endTag = `zoom="${z}" center=[${[x, y]}] }-->`;
103
+ return `${preTag}'${JSON.stringify(props.getLayers())}' ${endTag}`;
104
+ });
105
+ </script>
106
+ <style scoped>
107
+ .code-block {
108
+ background-color: #ddd;
109
+ font-family: monospace;
110
+ font-size: small;
111
+ }
112
+ </style>
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <span>
3
+ <v-dialog
4
+ max-width="500px"
5
+ max-height="500px"
6
+ absolute
7
+ scrollable
8
+ scroll-strategy="block"
9
+ close-on-back
10
+ v-model="dialog"
11
+ >
12
+ <v-sheet>
13
+ <component
14
+ v-if="widget"
15
+ :is="definedWidget.component"
16
+ :key="definedWidget.id"
17
+ v-bind="definedWidget.props"
18
+ />
19
+ <span v-if="$slots.default">
20
+ <slot />
21
+ </span>
22
+ </v-sheet>
23
+ </v-dialog>
24
+ </span>
25
+ </template>
26
+ <script setup>
27
+ import { useDefineWidgets } from "@/composables/DefineWidgets";
28
+
29
+ const dialog = defineModel({ type: Boolean, required: true, default: false });
30
+
31
+ const props = defineProps({
32
+ widget: {
33
+ /** @type {import("vue").PropType<import("@/types").Widget>} */
34
+ type: Object,
35
+ default: undefined,
36
+ },
37
+ });
38
+
39
+ const [definedWidget] = useDefineWidgets([props?.widget]);
40
+ </script>
@@ -1,6 +1,12 @@
1
1
  <template>
2
- <details is="animated-details" v-for="mod, idx in importedWidgets" ref="detailsEls" :key="idx" class="overflow-auto"
3
- exclusive>
2
+ <details
3
+ is="animated-details"
4
+ v-for="(mod, idx) in importedWidgets"
5
+ ref="detailsEls"
6
+ :key="idx"
7
+ class="overflow-auto"
8
+ exclusive
9
+ >
4
10
  <summary ref="summaryEls">{{ mod.value.title }}</summary>
5
11
  <span :style="{ height: widgetHeight }" class="d-flex flex-column">
6
12
  <component :is="mod.value.component" v-bind="mod.value.props" />
@@ -8,39 +14,53 @@
8
14
  </details>
9
15
  </template>
10
16
  <script setup>
11
- import { useDefineWidgets } from '@/composables/DefineWidgets';
12
- import { onMounted } from 'vue';
13
- import { ref } from 'vue';
14
- import { useLayout } from 'vuetify/lib/framework.mjs';
15
- import 'animated-details'
17
+ import { useDefineWidgets } from "@/composables/DefineWidgets";
18
+ import { nextTick, onMounted } from "vue";
19
+ import { ref } from "vue";
20
+ import { useLayout } from "vuetify/lib/framework.mjs";
21
+ import "animated-details";
16
22
 
17
23
  const props = defineProps({
18
24
  widgets: {
19
- /** @type {import('vue').PropType<Omit<import("@/types").Widget,'layout'>[]>} */
25
+ /**
26
+ * @type {import("vue").PropType<
27
+ * Omit<import("@/types").Widget, "layout">[]
28
+ * >}
29
+ */
20
30
  type: Array,
21
31
  required: true,
22
- }
23
- })
32
+ },
33
+ });
24
34
 
25
- const importedWidgets = useDefineWidgets(props.widgets)
35
+ const importedWidgets = useDefineWidgets(props.widgets);
26
36
 
27
37
  /**
28
- * details elements template ref
29
- * @type {import('vue').Ref<HTMLDetailsElement[]>}
30
- **/
31
- const detailsEls = ref([])
38
+ * Details elements template ref
39
+ *
40
+ * @type {import("vue").Ref<HTMLDetailsElement[]>}
41
+ */
42
+ const detailsEls = ref([]);
32
43
  /**
33
- * summary elements template ref
34
- * @type {import('vue').Ref<HTMLDetailsElement[]>}
35
- **/
36
- const summaryEls = ref([])
37
- const widgetHeight = ref('')
38
- const summariesHeights = ref(0)
44
+ * Summary elements template ref
45
+ *
46
+ * @type {import("vue").Ref<HTMLDetailsElement[]>}
47
+ */
48
+ const summaryEls = ref([]);
49
+ const widgetHeight = ref("");
50
+ const summariesHeights = ref(0);
39
51
 
40
-
41
- onMounted(() => {
42
- summariesHeights.value = summaryEls.value.reduce((acc, el) => acc += el.clientHeight, 0)
43
- const { mainRect } = useLayout()
44
- widgetHeight.value = ((detailsEls.value[0].parentElement?.scrollHeight ?? 0) - summariesHeights.value - mainRect.value['top']) + 'px'
45
- })
52
+ const { mainRect } = useLayout();
53
+ onMounted(async () => {
54
+ await nextTick(() => {
55
+ summariesHeights.value = summaryEls.value.reduce(
56
+ (acc, el) => (acc += el.clientHeight),
57
+ 0,
58
+ );
59
+ widgetHeight.value =
60
+ (detailsEls.value[0].parentElement?.scrollHeight ?? 0) -
61
+ summariesHeights.value -
62
+ mainRect.value["top"] +
63
+ "px";
64
+ });
65
+ });
46
66
  </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
@@ -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/>
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/types.d.ts DELETED
@@ -1,52 +0,0 @@
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 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>