@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
@@ -12,9 +12,6 @@ export const eodash = reactive({
12
12
  brand: {
13
13
  noLayout: true,
14
14
  name: "Demo",
15
- font: {
16
- family: "Roboto",
17
- },
18
15
  theme: {
19
16
  colors: {
20
17
  primary: "#fff",
@@ -51,46 +48,51 @@ export const eodash = reactive({
51
48
  {
52
49
  id: Symbol(),
53
50
  type: "internal",
54
- title: "itemfilter",
55
- layout: { x: 0, y: 0, w: 3, h: 12 },
51
+ title: "Indicators",
52
+ layout: { x: 0, y: 0, w: 2, h: 12 },
56
53
  widget: {
57
54
  name: "EodashItemFilter",
58
55
  },
59
56
  },
60
57
  {
61
- id: Symbol(),
62
- type: "internal",
63
- title: "datepicker",
64
- layout: { x: 5, y: 11, w: 2, h: 1 },
65
- widget: {
66
- name: "EodashDatePicker",
67
- properties: {
68
- inline: true,
69
- },
70
- },
71
- },
72
- {
73
- id: Symbol(),
74
- title: "Information",
75
- layout: { x: 9, y: 0, w: 3, h: 12 },
76
- widget: {
77
- link: async () => await import("@eox/stacinfo"),
78
- properties: {
79
- for: currentUrl,
80
- allowHtml: "true",
81
- styleOverride:
82
- "#properties li > .value {font-weight: normal !important;}",
83
- header: "[]",
58
+ defineWidget: (selectedSTAC) => {
59
+ return selectedSTAC ? {
60
+ id: "Information",
61
+ title: "Information",
62
+ layout: { x: 9, y: 0, w: 3, h: 12 },
63
+ type: "web-component",
64
+ widget: {
65
+ link: async () => await import("@eox/stacinfo"),
66
+ properties: {
67
+ for: currentUrl,
68
+ allowHtml: "true",
69
+ styleOverride:
70
+ "#properties li > .value {font-weight: normal !important;}",
71
+ header: "[]",
84
72
 
85
- subheader: "[]",
86
- properties: '["description"]',
87
- featured: "[]",
88
- footer: "[]",
89
- },
90
- tagName: "eox-stacinfo",
91
- },
92
- type: "web-component",
73
+ subheader: "[]",
74
+ properties: '["description"]',
75
+ featured: "[]",
76
+ footer: "[]",
77
+ },
78
+ tagName: "eox-stacinfo",
79
+ }
80
+ } : null
81
+ }
93
82
  },
83
+ {
84
+ defineWidget: (selectedSTAC) => {
85
+ return selectedSTAC ? {
86
+ id: "Datepicker",
87
+ type: "internal",
88
+ layout: { x: 5, y: 10, w: 1, h: 1 },
89
+ title: "Datepicker",
90
+ widget: {
91
+ name: "EodashDatePicker",
92
+ },
93
+ } : null
94
+ }
95
+ }
94
96
  ],
95
97
  },
96
98
  });
@@ -1,6 +1,7 @@
1
1
  import vuetify from './vuetify';
2
2
  import { createPinia } from 'pinia';
3
3
  import eodash from '@/eodash';
4
+ import VCalendar from 'v-calendar';
4
5
  import { eodashKey } from '@/utils/keys';
5
6
  import store from '../store';
6
7
 
@@ -14,5 +15,7 @@ export function registerPlugins(app) {
14
15
 
15
16
  app.use(vuetify)
16
17
  .use(pinia)
18
+ // Use plugin with optional defaults
19
+ .use(VCalendar, {})
17
20
  .provide(eodashKey, eodash);
18
21
  }
@@ -14,7 +14,7 @@ import { mdiChevronLeft, mdiChevronRight, mdiMenuDown } from "@mdi/js"
14
14
  const vuetify = createVuetify({
15
15
  icons: {
16
16
  aliases: {
17
- // remapping v-date-picker and v-tabs default icons to `@mdi/js`
17
+ // mapping v-date-picker and v-tabs default icons to `@mdi/js`
18
18
  next: [mdiChevronRight],
19
19
  prev: [mdiChevronLeft],
20
20
  subgroup: [mdiMenuDown]
@@ -27,13 +27,13 @@ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
27
27
  /**
28
28
  * Triggered when the web component is mounted in the DOM.
29
29
  * @param el - web component
30
- * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
30
+ * @param store - return value of the core STAC pinia store in `/core/client/store/stac.ts`
31
31
  */
32
32
  onMounted?: (el: Element | null, store: ReturnType<typeof import("./store/stac").useSTAcStore>) => (Promise<void> | void)
33
33
  /**
34
34
  * Triggered when the web component is unmounted from the DOM.
35
35
  * @param el - web component
36
- * @param store - return value of the core STAC pinia store in `/core/store/stac.ts`
36
+ * @param store - return value of the core STAC pinia store in `/core/client/store/stac.ts`
37
37
  */
38
38
  onUnmounted?: (el: Element | null, store: ReturnType<typeof import("./store/stac").useSTAcStore>) => (Promise<void> | void)
39
39
  }
@@ -45,6 +45,28 @@ export interface WidgetsContainerProps {
45
45
  }
46
46
 
47
47
  // eodash types:
48
+ /**
49
+ * properties of EOxLayoutItem used for setting
50
+ * the position and size of panels
51
+ */
52
+ export interface Layout {
53
+ /**
54
+ * Horizontal start position. Integer between 1 and 12
55
+ */
56
+ x: number
57
+ /**
58
+ * Vertical start position. Integer between 1 and 12
59
+ */
60
+ y: number
61
+ /**
62
+ * Width. Integer between 1 and 12
63
+ */
64
+ w: number
65
+ /**
66
+ * Height. Integer between 1 and 12
67
+ */
68
+ h: number
69
+ }
48
70
  /**
49
71
  * Widget type: `web-component` API
50
72
  * @group Eodash
@@ -55,24 +77,7 @@ export interface WebComponentWidget<T extends ExecutionTime = "compiletime"> {
55
77
  /**
56
78
  * Widget position and size.
57
79
  */
58
- layout: {
59
- /**
60
- * Horizontal start position. Integer between 1 and 12
61
- */
62
- x: number
63
- /**
64
- * Vertical start position. Integer between 1 and 12
65
- */
66
- y: number
67
- /**
68
- * Width. Integer between 1 and 12
69
- */
70
- w: number
71
- /**
72
- * Height. Integer between 1 and 12
73
- */
74
- h: number
75
- },
80
+ layout: Layout,
76
81
  widget: WebComponentProps<T>
77
82
  type: 'web-component'
78
83
  }
@@ -88,24 +93,7 @@ export interface InternalComponentWidget {
88
93
  /**
89
94
  * Widget position and size.
90
95
  */
91
- layout: {
92
- /**
93
- * Horizontal start position. Integer between 1 and 12
94
- */
95
- x: number
96
- /**
97
- * Vertical start position. Integer between 1 and 12
98
- */
99
- y: number
100
- /**
101
- * Width. Integer between 1 and 12
102
- */
103
- w: number
104
- /**
105
- * Height. Integer between 1 and 12
106
- */
107
- h: number
108
- }
96
+ layout: Layout
109
97
  widget: {
110
98
  /**
111
99
  * Internal Vue Components inside the [widgets](https://github.com/eodash/eodash/tree/main/widgets) folder. Referenced
@@ -133,24 +121,7 @@ export interface IFrameWidget {
133
121
  /**
134
122
  * Widget position and size.
135
123
  */
136
- layout: {
137
- /**
138
- * Horizontal start position. Integer between 1 and 12
139
- */
140
- x: number
141
- /**
142
- * Vertical start position. Integer between 1 and 12
143
- */
144
- y: number
145
- /**
146
- * Width. Integer between 1 and 12
147
- */
148
- w: number
149
- /**
150
- * Height. Integer between 1 and 12
151
- */
152
- h: number
153
- }
124
+ layout: Layout
154
125
  widget: {
155
126
  /**
156
127
  * The URL of the page to embed
@@ -170,32 +141,21 @@ export interface FunctionalWidget<T extends ExecutionTime = "compiletime"> {
170
141
  * @param selectedSTAC - Currently selected STAC object
171
142
  */
172
143
  defineWidget: (selectedSTAC: import("stac-ts").StacCatalog |
173
- import("stac-ts").StacCollection | import("stac-ts").StacItem | null) => Omit<StaticWidget<T>, 'layout' | 'slidable'> | undefined | null
174
- layout: {
175
- /**
176
- * Horizontal start position. Integer between 1 and 12
177
- */
178
- x: number
179
- /**
180
- * Vertical start position. Integer between 1 and 12
181
- */
182
- y: number
183
- /**
184
- * Width. Integer between 1 and 12
185
- */
186
- w: number
187
- /**
188
- * Height. Integer between 1 and 12
189
- */
190
- h: number
191
- }
144
+ import("stac-ts").StacCollection | import("stac-ts").StacItem | null) => StaticWidget<T> | undefined | null
192
145
  }
193
146
  /**
147
+ * There are 3 types of Widgets:
148
+ *
194
149
  * @group Eodash
195
150
  */
196
151
  export type StaticWidget<T extends ExecutionTime = "compiletime"> = WebComponentWidget<T> | InternalComponentWidget | IFrameWidget
197
152
  /**
198
- * @group Eodash
153
+ * widgets can be defined in 2 forms:
154
+ * 1. {@link StaticWidget} : This is defined as an object once, and is considered the default form.
155
+ * 2. {@link FunctionalWidget} : a special form which contains the {@link FunctionalWidget.defineWidget `defineWidget`} function that
156
+ * runs when {@link EodashStore.stac `loadSelectedSTAC`} function
157
+ * is triggered, and returns a value of a Static Widget or null or undefined.
158
+ * @group Eodash
199
159
  */
200
160
  export type Widget<T extends ExecutionTime = "compiletime"> = StaticWidget<T> | FunctionalWidget<T>
201
161
 
@@ -221,8 +181,7 @@ export interface Template<T extends ExecutionTime = "compiletime"> {
221
181
  loading?: BackgroundWidget<T>
222
182
  /**
223
183
  * Widget rendered as the dashboard background.
224
- * Has the same specifications of `Widget` without the `title` and `layout` properties
225
- * @see {@link Widget}
184
+ * Has the same specifications of {@link Widget} without the `title` and `layout` properties
226
185
  */
227
186
  background?: BackgroundWidget<T>
228
187
  /**
@@ -235,10 +194,9 @@ export interface Template<T extends ExecutionTime = "compiletime"> {
235
194
  export type StacEndpoint = `${'https://' | 'http://'}${string}/catalog.json`
236
195
 
237
196
  /**
238
- * @ignore
239
197
  * @group Eodash
240
198
  */
241
- export type ExecutionTime = "runtime" | "compiletime";
199
+ type ExecutionTime = "runtime" | "compiletime";
242
200
 
243
201
  /**
244
202
  * Eodash instance API
@@ -262,16 +220,15 @@ export interface Eodash<T extends ExecutionTime = "compiletime"> {
262
220
  /** custom error message to alert the users if something crashes */
263
221
  errorMessage?: string
264
222
  /**
265
- * Automatically fetches the specified font family from google fonts. if the [link](#font-link) property is specified
266
- * the font family will be fetched from the provided source instead.
223
+ * fetches the specified font family from the specified `link` property.
267
224
  */
268
225
  font?: {
269
226
  /**
270
227
  * Link to stylesheet that defines font-face. Could be either a relative or absolute URL.
271
228
  */
272
- link?: string;
229
+ link: string;
273
230
  /**
274
- * Font family. Use FVD notation to include families. see https://github.com/typekit/fvd
231
+ * Font family name.
275
232
  */
276
233
  family: string
277
234
  }
@@ -326,7 +283,7 @@ export interface EodashStore {
326
283
  * Pinia store definition used to navigate the root STAC catalog.
327
284
  */
328
285
  stac: {
329
- useSTAcStore: typeof import("./store/stac").useSTAcStore
286
+ useSTAcStore: typeof import("./store/stac.js").useSTAcStore
330
287
  }
331
288
  }
332
289
  ///////
@@ -1,13 +1,15 @@
1
1
  import { Collection, Item } from 'stac-js';
2
2
  import { toAbsolute } from 'stac-js/src/http.js';
3
3
  import { generateFeatures } from './helpers'
4
+ import axios from 'axios';
4
5
 
5
6
  export class EodashCollection {
6
- /** @type {string | undefined} */
7
- #collectionUrl = undefined;
8
- #collectionStac = undefined;
9
- /** @type {*} */
10
- selectedItem = null;
7
+ /** @type {string} */
8
+ #collectionUrl = '';
9
+ /** @type {import("stac-ts").StacCollection | undefined} */
10
+ #collectionStac;
11
+ /** @type {import("stac-ts").StacLink | undefined } */
12
+ selectedItem;
11
13
 
12
14
  /**
13
15
  * @param {string} collectionUrl
@@ -21,8 +23,12 @@ export class EodashCollection {
21
23
  * @async
22
24
  */
23
25
  createLayersJson = async (item = null) => {
24
- let stacItem, stac;
26
+ /** @type {import("stac-ts").StacLink | undefined} */
27
+ let stacItem,
28
+ /** @type {import("stac-ts").StacCollection | undefined} */
29
+ stac;
25
30
  // TODO get auxiliary layers from collection
31
+ /** @type {object[]} */
26
32
  let layersJson = [
27
33
  {
28
34
  type: 'Tile',
@@ -36,13 +42,12 @@ export class EodashCollection {
36
42
  ];
37
43
  // Load collectionstac if not yet initialized
38
44
  if (!this.#collectionStac) {
39
- //@ts-expect-error
40
- const response = await fetch(this.#collectionUrl);
41
- stac = await response.json();
45
+ const response = await axios.get(this.#collectionUrl);
46
+ stac = await response.data
42
47
  this.#collectionStac = new Collection(stac);
43
48
  }
44
49
 
45
- if(stac && stac.endpointtype === "GeoDB") {
50
+ if (stac && stac.endpointtype === "GeoDB") {
46
51
  // Special handling of point based data
47
52
  const allFeatures = generateFeatures(stac.links);
48
53
  layersJson.unshift({
@@ -68,11 +73,9 @@ export class EodashCollection {
68
73
  } else {
69
74
  if (item instanceof Date) {
70
75
  // if collectionStac not yet initialized we do it here
71
- stacItem = this.getItems().sort((a, b) => {
72
- //@ts-expect-error
73
- const distanceA = Math.abs(new Date(a.datetime) - item);
74
- //@ts-expect-error
75
- const distanceB = Math.abs(new Date(b.datetime) - item);
76
+ stacItem = this.getItems()?.sort((a, b) => {
77
+ const distanceA = Math.abs((new Date(/** @type {number} */(a.datetime))).getTime() - item.getTime());
78
+ const distanceB = Math.abs(new Date(/** @type {number} */(b.datetime)).getTime() - item.getTime());
76
79
  return distanceA - distanceB;
77
80
  })[0];
78
81
  this.selectedItem = stacItem;
@@ -85,19 +88,24 @@ export class EodashCollection {
85
88
  : this.#collectionUrl
86
89
  );
87
90
  stac = await response.json();
88
-
91
+
89
92
  if (!stacItem) {
90
93
  // no specific item was requested; render last item
91
94
  this.#collectionStac = new Collection(stac);
92
95
  const items = this.getItems();
93
- this.selectedItem = items[items.length - 1];
94
- layersJson = await this.createLayersJson(this.selectedItem);
96
+ this.selectedItem = items?.[items.length - 1];
97
+ if (this.selectedItem) {
98
+ layersJson = await this.createLayersJson(this.selectedItem);
99
+ } else {
100
+ if (import.meta.env.DEV) {
101
+ console.warn('[eodash] the selected collection does not include any items')
102
+ }
103
+ }
95
104
  return layersJson;
96
105
  } else {
97
106
  // specific item was requested
98
107
  const item = new Item(stac);
99
108
  this.selectedItem = item;
100
- //@ts-expect-error
101
109
  layersJson.unshift(this.buildJson(item));
102
110
  return layersJson;
103
111
  }
@@ -141,9 +149,7 @@ export class EodashCollection {
141
149
 
142
150
  getItems() {
143
151
  return (
144
- //@ts-expect-error
145
- // eslint-disable-next-line
146
- /** @type {import('stac-ts').StacLink[]}*/(this.#collectionStac?.links)
152
+ this.#collectionStac?.links
147
153
  .filter((i) => i.rel === 'item')
148
154
  // sort by `datetime`, where oldest is first in array
149
155
  .sort((a, b) => ( /** @type {number} */(a.datetime) < /** @type {number} */(b.datetime) ? -1 : 1))
@@ -152,9 +158,7 @@ export class EodashCollection {
152
158
 
153
159
  getDates() {
154
160
  return (
155
- //@ts-expect-error
156
- // eslint-disable-next-line
157
- /** @type {import('stac-ts').StacLink[]}*/ (this.#collectionStac?.links)
161
+ this.#collectionStac?.links
158
162
  .filter((i) => i.rel === 'item')
159
163
  // sort by `datetime`, where oldest is first in array
160
164
  .sort((a, b) => ( /** @type {number} */(a.datetime) < /** @type {number} */(b.datetime) ? -1 : 1))
@@ -0,0 +1,32 @@
1
+ /**
2
+ * loads font in the app using `webfontloader`
3
+ * @param {string} [family]
4
+ * @param {string} [link]
5
+ * @param {boolean} [isWebComponent]
6
+ * @returns {Promise<string>} - font family name
7
+ * @see {@link "https://github.com/typekit/webfontloader"}
8
+ */
9
+ export const loadFont = async (family = '', link = '', isWebComponent = false) => {
10
+ if (family && link) {
11
+ const WebFontLoader = (await import('webfontloader')).default;
12
+ WebFontLoader.load({
13
+ classes: false,
14
+ custom: {
15
+ // Use FVD notation to include families https://github.com/typekit/fvd
16
+ families: [family],
17
+ // Path to stylesheet that defines font-face
18
+ urls: [link],
19
+ },
20
+ fontactive(familyName, _fvd) {
21
+ const stylesheet = new CSSStyleSheet()
22
+ const styles = isWebComponent ? `eo-dash {font-family: ${familyName};}` : `* {font-family: ${familyName};}`
23
+ stylesheet.replaceSync(styles)
24
+ document.adoptedStyleSheets.push(stylesheet)
25
+ },
26
+ fontinactive(familyName, _fvd) {
27
+ throw new Error(`error loading font: ${familyName}`)
28
+ }
29
+ });
30
+ }
31
+ return family;
32
+ };
@@ -1,16 +1,15 @@
1
1
  <template>
2
- <HeaderComponent v-if="!eodash.brand.noLayout" />
2
+ <HeaderComponent ref="headerRef" v-if="!eodash.brand.noLayout" />
3
3
  <ErrorAlert v-model="error" />
4
4
  <Suspense>
5
- <TemplateComponent @vue:mounted="onTemplateMount?.()"
6
- :style="`height: ${eodash.brand.noLayout ? (onTemplateMount ? '100%' : '90dvh') : 'calc(100dvh - ' + mainRect['top'] + mainRect['bottom'] + 'px)'}`" />
5
+ <TemplateComponent @vue:mounted="onTemplateMount?.(hiddenElements)" class="template" />
7
6
  <template #fallback>
8
- <div style="height: 100dvh; display: flex; align-items: center; justify-content: center;">
7
+ <div class="loading-container">
9
8
  <Loading />
10
9
  </div>
11
10
  </template>
12
11
  </Suspense>
13
- <FooterComponent v-if="!eodash.brand.noLayout" />
12
+ <FooterComponent ref="footerRef" v-if="!eodash.brand.noLayout" />
14
13
  </template>
15
14
 
16
15
  <script setup>
@@ -31,7 +30,6 @@ const props = defineProps({
31
30
  type: Function
32
31
  }
33
32
  })
34
-
35
33
  const eodash = await useEodashRuntime(props.config)
36
34
 
37
35
  useURLSearchParametersSync();
@@ -39,7 +37,7 @@ useURLSearchParametersSync();
39
37
  const theme = useUpdateTheme('dashboardTheme', eodash.brand?.theme)
40
38
  theme.global.name.value = 'dashboardTheme'
41
39
 
42
- await loadFont(eodash.brand?.font?.family, eodash.brand?.font?.link)
40
+ await loadFont(eodash.brand?.font?.family, eodash.brand?.font?.link, !!props.onTemplateMount)
43
41
 
44
42
  const { loadSTAC } = useSTAcStore()
45
43
  await loadSTAC()
@@ -52,19 +50,50 @@ const TemplateComponent = smAndDown.value ?
52
50
  const HeaderComponent = defineAsyncComponent(() => import(`@/components/Header.vue`))
53
51
  const FooterComponent = defineAsyncComponent(() => import(`@/components/Footer.vue`))
54
52
  const { mainRect } = useLayout()
53
+ const templateHeight = eodash.brand.noLayout ? (props.onTemplateMount ? '100%' : '90dvh') :
54
+ `calc(100dvh - ${mainRect.value['top'] + mainRect.value['bottom']}px)`
55
+
56
+ const headerRef = ref(null);
57
+ /** @type {import("vue").Ref<InstanceType<typeof
58
+ * import("@/components/Footer.vue").default >|null>}
59
+ **/
60
+ const footerRef = ref(null);
61
+
62
+ const hiddenElements = [headerRef, footerRef]
55
63
 
56
64
  onMounted(() => {
57
- const htmlTag = /** @type {HTMLElement} */(document.querySelector('html'))
58
- htmlTag.style.overflow = 'hidden';
65
+ if (props.onTemplateMount && !eodash.brand.noLayout) {
66
+ hiddenElements.forEach(element => {
67
+ /** @type {HTMLElement} */
68
+ // @ts-expect-error
69
+ (element.value.$el).style.opacity = "0"
70
+ })
71
+ }
59
72
  })
60
73
 
61
74
  const error = ref('')
62
75
  onErrorCaptured((e, comp, info) => {
63
76
  error.value = `
64
- error: ${e}.
77
+ ${e}.
65
78
  component: ${comp?.$.type.name}.
66
79
  info: ${info}.
67
80
  `
68
81
  })
69
82
 
70
83
  </script>
84
+ <style>
85
+ html {
86
+ overflow: hidden !important;
87
+ }
88
+
89
+ .template {
90
+ height: v-bind("templateHeight")
91
+ }
92
+
93
+ .loading-container {
94
+ height: 100dvh;
95
+ display: flex;
96
+ align-items: center;
97
+ justify-content: center;
98
+ }
99
+ </style>