@eodash/eodash 5.0.0-rc.2 → 5.0.0-rc.2.2

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 (49) hide show
  1. package/core/client/components/DashboardLayout.vue +3 -2
  2. package/core/client/components/DynamicWebComponent.vue +10 -3
  3. package/core/client/components/Header.vue +1 -1
  4. package/core/client/components/MobileLayout.vue +1 -0
  5. package/core/client/composables/DefineTemplate.js +13 -2
  6. package/core/client/composables/DefineWidgets.js +9 -4
  7. package/core/client/composables/EodashMap.js +1 -1
  8. package/core/client/composables/EodashProcess.js +1 -1
  9. package/core/client/eodash.js +14 -4
  10. package/core/client/eodashSTAC/EodashCollection.js +9 -5
  11. package/core/client/eodashSTAC/helpers.js +6 -3
  12. package/core/client/eodashSTAC/triggers.js +8 -4
  13. package/core/client/types.ts +18 -13
  14. package/core/client/utils/index.js +112 -32
  15. package/core/client/views/Dashboard.vue +23 -6
  16. package/dist/client/{DashboardLayout-VrJIbhe8.js → DashboardLayout-ByVMURpM.js} +6 -6
  17. package/dist/client/{DynamicWebComponent-BCwpocDX.js → DynamicWebComponent-BRQQ5AXV.js} +11 -4
  18. package/dist/client/{EodashDatePicker-Bp5ec3BC.js → EodashDatePicker-DyLo_JUC.js} +3 -3
  19. package/dist/client/{EodashItemFilter-Cx0t-qeW.js → EodashItemFilter-BR572AaH.js} +1 -1
  20. package/dist/client/{EodashLayerControl-DERx00In.js → EodashLayerControl-C_mi-Hoo.js} +1 -1
  21. package/dist/client/{EodashLayoutSwitcher-DTS7otlk.js → EodashLayoutSwitcher-D4ooLbys.js} +2 -2
  22. package/dist/client/{EodashMap-C-I6puhb.js → EodashMap-CGFv4e85.js} +2 -2
  23. package/dist/client/{EodashMapBtns-CWgtJiG4.js → EodashMapBtns-_M7SW7Is.js} +4 -4
  24. package/dist/client/{EodashProcess-DWrTIyHT.js → EodashProcess-ZQAMi9Pc.js} +2 -2
  25. package/dist/client/{EodashStacInfo-Dvsk97Mz.js → EodashStacInfo-CwOCcsGl.js} +1 -1
  26. package/dist/client/{EodashTools-CdnjgTTl.js → EodashTools-C_X0RPIp.js} +4 -4
  27. package/dist/client/{ExportState-S4lcehm3.js → ExportState-DNUSRJSJ.js} +4 -4
  28. package/dist/client/{Footer-DlIEbXp-.js → Footer-FUp1Te0L.js} +1 -1
  29. package/dist/client/{Header-CTiEXLi0.js → Header-BcHAtFqr.js} +5 -5
  30. package/dist/client/{MobileLayout-DRgyQYFz.js → MobileLayout-CUHZFLDY.js} +11 -11
  31. package/dist/client/{PopUp-CzqV8BFZ.js → PopUp-CEmhdNIj.js} +3 -3
  32. package/dist/client/{VImg-Bn8bCvVM.js → VImg-Cdaw92OV.js} +2 -2
  33. package/dist/client/{VMain-2GOqWb6m.js → VMain-B7G2T3Zv.js} +1 -1
  34. package/dist/client/{VOverlay-BetC0LGI.js → VOverlay-Mf1pOmgW.js} +3 -3
  35. package/dist/client/{VTooltip-BWg0dxx5.js → VTooltip-9810qjB2.js} +3 -3
  36. package/dist/client/{WidgetsContainer-Cv466WUW.js → WidgetsContainer-GUwXMh9d.js} +1 -1
  37. package/dist/client/{asWebComponent-CLUhauLl.js → asWebComponent--e4yqM3f.js} +180 -67
  38. package/dist/client/eo-dash.css +2 -2
  39. package/dist/client/eo-dash.js +1 -1
  40. package/dist/client/{forwardRefs-CxSsJulB.js → forwardRefs-B9UH8QZK.js} +1 -1
  41. package/dist/client/{index-BMj56LY3.js → index-D-lbt2my.js} +1 -1
  42. package/dist/client/{transition-DidoPMgC.js → transition-CTjQmgIS.js} +1 -1
  43. package/dist/types/core/client/eodashSTAC/helpers.d.ts +15 -6
  44. package/dist/types/core/client/types.d.ts +15 -11
  45. package/dist/types/core/client/utils/index.d.ts +1 -1
  46. package/dist/types/widgets/EodashStacInfo.vue.d.ts +2 -2
  47. package/dist/types/widgets/PopUp.vue.d.ts +2 -2
  48. package/package.json +2 -1
  49. package/widgets/EodashDatePicker.vue +18 -0
@@ -4,6 +4,7 @@ import { setupCache } from 'axios-cache-interceptor';
4
4
  import log from 'loglevel';
5
5
  import { mdiViewDashboardVariant, mdiViewDashboard, mdiAlertCircle, mdiClose, mdiChevronRight, mdiChevronLeft, mdiMenuDown, mdiPlus } from '@mdi/js';
6
6
  import { useEventBus, createSharedComposable } from '@vueuse/core';
7
+ import WebFontLoader from 'webfontloader';
7
8
  import { toAbsolute } from 'stac-js/src/http.js';
8
9
  import { Collection, Item } from 'stac-js';
9
10
  import VCalendar from 'v-calendar';
@@ -3783,6 +3784,16 @@ const eodash = reactive({
3783
3784
  brand: {
3784
3785
  noLayout: true,
3785
3786
  name: "Demo",
3787
+ font: {
3788
+ headers: {
3789
+ family: "Open Sans",
3790
+ link: "https://eox.at/fonts/opensans/opensans.css",
3791
+ },
3792
+ body: {
3793
+ family: "Sintony",
3794
+ link: "https://eox.at/fonts/sintony/sintony.css",
3795
+ },
3796
+ },
3786
3797
  theme: {
3787
3798
  colors: {
3788
3799
  primary: "#002742",
@@ -3827,7 +3838,7 @@ const eodash = reactive({
3827
3838
  },
3828
3839
  },
3829
3840
  background: {
3830
- id: Symbol(),
3841
+ id: "background-map",
3831
3842
  type: "internal",
3832
3843
  widget: {
3833
3844
  name: "EodashMap",
@@ -3949,7 +3960,7 @@ const eodash = reactive({
3949
3960
  },
3950
3961
  },
3951
3962
  background: {
3952
- id: Symbol(),
3963
+ id: "background-map",
3953
3964
  type: "internal",
3954
3965
  widget: {
3955
3966
  name: "EodashMap",
@@ -4015,7 +4026,7 @@ const eodash = reactive({
4015
4026
  ? {
4016
4027
  id: "Datepicker",
4017
4028
  type: "internal",
4018
- layout: { x: 5, y: 8, w: 2, h: 4 },
4029
+ layout: { x: 5, y: 11, w: 2, h: 1 },
4019
4030
  title: "Date",
4020
4031
  widget: {
4021
4032
  name: "EodashDatePicker",
@@ -4078,7 +4089,7 @@ const eodash = reactive({
4078
4089
  },
4079
4090
  },
4080
4091
  background: {
4081
- id: Symbol(),
4092
+ id: "background-map",
4082
4093
  type: "internal",
4083
4094
  widget: {
4084
4095
  name: "EodashMap",
@@ -7590,41 +7601,119 @@ const collectionsPalette = reactive([
7590
7601
  /**
7591
7602
  * Loads font in the app using `webfontloader`
7592
7603
  *
7593
- * @param {string} [family]
7594
- * @param {string} [link]
7595
- * @param {boolean} [isWebComponent]
7596
- * @returns {Promise<string>} - Font family name
7604
+ * @param {import("@/types").Eodash["brand"]["font"]} fontConfig
7605
+ * @param {boolean} isWebComponent
7606
+ * @returns {Promise<string[]>} - Font family name
7597
7607
  * @see {@link "https://github.com/typekit/webfontloader"}
7598
7608
  */
7599
- const loadFont = async (
7600
- family = "",
7601
- link = "",
7602
- isWebComponent = false,
7603
- ) => {
7604
- if (family && link) {
7605
- const WebFontLoader = (await import('webfontloader')).default;
7606
- WebFontLoader.load({
7607
- classes: false,
7608
- custom: {
7609
- // Use FVD notation to include families https://github.com/typekit/fvd
7610
- families: [family],
7611
- // Path to stylesheet that defines font-face
7612
- urls: [link],
7613
- },
7614
- fontactive(familyName, _fvd) {
7615
- const stylesheet = new CSSStyleSheet();
7616
- const styles = isWebComponent
7617
- ? `eo-dash {font-family: ${familyName};}`
7618
- : `* {font-family: ${familyName};}`;
7619
- stylesheet.replaceSync(styles);
7620
- document.adoptedStyleSheets.push(stylesheet);
7621
- },
7622
- fontinactive(familyName, _fvd) {
7623
- throw new Error(`error loading font: ${familyName}`);
7624
- },
7625
- });
7609
+ const loadFont = async (fontConfig, isWebComponent) => {
7610
+ if (!fontConfig) {
7611
+ return [];
7612
+ }
7613
+
7614
+ let headerFamily = "",
7615
+ bodyFamily = "",
7616
+ headerLink = "",
7617
+ bodyLink = "";
7618
+ if ("headers" in fontConfig) {
7619
+ headerFamily = fontConfig?.headers?.family;
7620
+ headerLink = fontConfig.headers.link ?? "";
7621
+ bodyFamily = fontConfig?.body?.family;
7622
+ bodyLink = fontConfig.body.link ?? "";
7623
+ } else {
7624
+ headerFamily = fontConfig.family;
7625
+ headerLink = fontConfig.link ?? "";
7626
+ bodyFamily = fontConfig?.family;
7627
+ bodyLink = fontConfig.link ?? "";
7628
+ }
7629
+ const families =
7630
+ headerFamily === bodyFamily ? [headerFamily] : [headerFamily, bodyFamily];
7631
+ const urls = [];
7632
+ if (bodyLink && headerLink) {
7633
+ if (bodyLink !== headerLink) {
7634
+ urls.push(bodyLink);
7635
+ urls.push(headerLink);
7636
+ } else {
7637
+ urls.push(bodyLink);
7638
+ }
7626
7639
  }
7627
- return family;
7640
+
7641
+ WebFontLoader.load({
7642
+ classes: false,
7643
+ custom: {
7644
+ // Use FVD notation to include families https://github.com/typekit/fvd
7645
+ families,
7646
+ // Path to stylesheet that defines font-face
7647
+ urls,
7648
+ },
7649
+ fontactive(familyName, _fvd) {
7650
+ const stylesheet = new CSSStyleSheet();
7651
+
7652
+ const bodyRule = `
7653
+ ${isWebComponent ? "eo-dash" : `:root`} {
7654
+ font-family: ${bodyFamily};
7655
+ --vc-font-family: ${bodyFamily};
7656
+ }
7657
+ eox-layercontrol,
7658
+ eox-map,
7659
+ eox-jsonform,
7660
+ eox-timecontrol,
7661
+ eox-itemfilter,
7662
+ eox-chart,
7663
+ eox-stacinfo{
7664
+ --eox-body-font-family: ${bodyFamily};
7665
+ font-family: ${bodyFamily}
7666
+ ;
7667
+ }
7668
+ *[class*="text-body"]{
7669
+ font-family: ${bodyFamily}
7670
+ }
7671
+ `;
7672
+
7673
+ const headersRule = `
7674
+ ${
7675
+ isWebComponent
7676
+ ? `
7677
+ eo-dash h1,
7678
+ eo-dash h2,
7679
+ eo-dash h3,
7680
+ eo-dash h4,
7681
+ eo-dash h5,
7682
+ eo-dash *[class*="header"]
7683
+ `
7684
+ : `
7685
+ h1,
7686
+ h2,
7687
+ h3,
7688
+ h4,
7689
+ h5,
7690
+ *[class*="header"]`
7691
+ } {
7692
+ font-family: ${headerFamily} !important;
7693
+ }
7694
+ eox-layercontrol,
7695
+ eox-map,
7696
+ eox-jsonform,
7697
+ eox-timecontrol,
7698
+ eox-itemfilter,
7699
+ eox-chart,
7700
+ eox-stacinfo {
7701
+ --eox-header-font-family: ${headerFamily};
7702
+ `;
7703
+ const isOne = headerFamily && headerFamily === bodyFamily;
7704
+ const styles = isOne
7705
+ ? bodyRule + "\n" + headersRule
7706
+ : familyName == bodyFamily
7707
+ ? bodyRule
7708
+ : headersRule;
7709
+ stylesheet.replaceSync(styles);
7710
+ document?.adoptedStyleSheets?.push(stylesheet);
7711
+ },
7712
+ fontinactive(familyName, _fvd) {
7713
+ throw new Error(`error loading font: ${familyName}`);
7714
+ },
7715
+ });
7716
+ return families;
7628
7717
  };
7629
7718
 
7630
7719
  /**
@@ -8029,10 +8118,14 @@ function getStyleVariablesState(collectionId, variables) {
8029
8118
  }
8030
8119
 
8031
8120
  const olLayer = mapElement.getLayerById(matchingLayer.properties?.id ?? "");
8032
- const oldVariablesState = /** @type {import("ol/layer").WebGLTile} */ (
8033
- olLayer
8034
- //@ts-expect-error todo
8035
- ).getStyle()?.variables;
8121
+ const oldVariablesState =
8122
+ /** @type {import("ol/layer").Vector} */ (
8123
+ olLayer
8124
+ //@ts-expect-error variables doesn't exist in non-flat style
8125
+ ).getStyle?.()?.variables ??
8126
+ //@ts-expect-error (styleVariables_ is a private property)
8127
+ /** @type {import("ol/layer").WebGLTile} */ (olLayer).styleVariables_;
8128
+
8036
8129
  if (!oldVariablesState) {
8037
8130
  return variables;
8038
8131
  }
@@ -8047,8 +8140,11 @@ function getStyleVariablesState(collectionId, variables) {
8047
8140
  return matchingKeys ? oldVariablesState : variables;
8048
8141
  }
8049
8142
 
8050
- /** @param {import("stac-ts").StacLink[]} [links] */
8051
- function generateFeatures(links) {
8143
+ /**
8144
+ * @param {import("stac-ts").StacLink[]} [links]
8145
+ * @param {Record<string,any>} [extraProperties]
8146
+ **/
8147
+ function generateFeatures(links, extraProperties = {}) {
8052
8148
  /**
8053
8149
  * @type {import("geojson").Feature[]}
8054
8150
  */
@@ -8064,7 +8160,7 @@ function generateFeatures(links) {
8064
8160
  type: "Point",
8065
8161
  coordinates: [lon, lat],
8066
8162
  },
8067
- properties: { id: element.id },
8163
+ properties: { ...element, ...extraProperties },
8068
8164
  });
8069
8165
  }
8070
8166
  });
@@ -9184,12 +9280,16 @@ class EodashCollection {
9184
9280
  continue;
9185
9281
  }
9186
9282
  const collectionFeatures = generateFeatures(
9187
- collection.#collectionStac?.links,
9283
+ JSON.parse(JSON.stringify(collection.#collectionStac?.links)),
9284
+ {
9285
+ collection_id: collection.#collectionStac?.id,
9286
+ geoDBID: collection.#collectionStac?.geoDBID,
9287
+ themes: collection.#collectionStac?.themes ?? [],
9288
+ },
9188
9289
  ).features;
9290
+
9189
9291
  if (collectionFeatures.length) {
9190
- allFeatures.push(
9191
- generateFeatures(collection.#collectionStac?.links).features,
9192
- );
9292
+ allFeatures.push(collectionFeatures);
9193
9293
  }
9194
9294
  }
9195
9295
  if (allFeatures.length) {
@@ -9207,7 +9307,7 @@ class EodashCollection {
9207
9307
  type: "Vector",
9208
9308
  properties: {
9209
9309
  id: "geodb-collection",
9210
- title: "GeoDB Collection",
9310
+ title: "Observation Points",
9211
9311
  },
9212
9312
  source: {
9213
9313
  type: "Vector",
@@ -11448,7 +11548,7 @@ const ErrorAlert = /*#__PURE__*/_export_sfc(_sfc_main$3, [['__scopeId',"data-v-a
11448
11548
  const internalWidgets = (() => {
11449
11549
  /** @type {Record<string, () => Promise<import("vue").Component>>} */
11450
11550
  const importMap = {
11451
- .../* #__PURE__ */ Object.assign({"/widgets/EodashDatePicker.vue": () => import('./EodashDatePicker-Bp5ec3BC.js'),"/widgets/EodashItemFilter.vue": () => import('./EodashItemFilter-Cx0t-qeW.js'),"/widgets/EodashLayerControl.vue": () => import('./EodashLayerControl-DERx00In.js'),"/widgets/EodashLayoutSwitcher.vue": () => import('./EodashLayoutSwitcher-DTS7otlk.js'),"/widgets/EodashMap.vue": () => import('./EodashMap-C-I6puhb.js'),"/widgets/EodashMapBtns.vue": () => import('./EodashMapBtns-CWgtJiG4.js'),"/widgets/EodashProcess.vue": () => import('./EodashProcess-DWrTIyHT.js'),"/widgets/EodashStacInfo.vue": () => import('./EodashStacInfo-Dvsk97Mz.js'),"/widgets/EodashTools.vue": () => import('./EodashTools-CdnjgTTl.js'),"/widgets/ExportState.vue": () => import('./ExportState-S4lcehm3.js'),"/widgets/PopUp.vue": () => import('./PopUp-CzqV8BFZ.js'),"/widgets/WidgetsContainer.vue": () => import('./WidgetsContainer-Cv466WUW.js')}),
11551
+ .../* #__PURE__ */ Object.assign({"/widgets/EodashDatePicker.vue": () => import('./EodashDatePicker-DyLo_JUC.js'),"/widgets/EodashItemFilter.vue": () => import('./EodashItemFilter-BR572AaH.js'),"/widgets/EodashLayerControl.vue": () => import('./EodashLayerControl-C_mi-Hoo.js'),"/widgets/EodashLayoutSwitcher.vue": () => import('./EodashLayoutSwitcher-D4ooLbys.js'),"/widgets/EodashMap.vue": () => import('./EodashMap-CGFv4e85.js'),"/widgets/EodashMapBtns.vue": () => import('./EodashMapBtns-_M7SW7Is.js'),"/widgets/EodashProcess.vue": () => import('./EodashProcess-ZQAMi9Pc.js'),"/widgets/EodashStacInfo.vue": () => import('./EodashStacInfo-CwOCcsGl.js'),"/widgets/EodashTools.vue": () => import('./EodashTools-C_X0RPIp.js'),"/widgets/ExportState.vue": () => import('./ExportState-DNUSRJSJ.js'),"/widgets/PopUp.vue": () => import('./PopUp-CEmhdNIj.js'),"/widgets/WidgetsContainer.vue": () => import('./WidgetsContainer-GUwXMh9d.js')}),
11452
11552
  .../* #__PURE__ */ Object.assign({}),
11453
11553
  };
11454
11554
  for (const key in importMap) {
@@ -11540,11 +11640,16 @@ const getWidgetDefinition = (config) => {
11540
11640
  switch (config?.type) {
11541
11641
  case "internal":
11542
11642
  importedWidget.component = defineAsyncComponent({
11543
- loader:
11544
- internalWidgets[
11643
+ loader: () => {
11644
+ const widgetName =
11545
11645
  /** @type {import("@/types").InternalComponentWidget} * */ (config)
11546
- ?.widget.name
11547
- ],
11646
+ ?.widget.name;
11647
+
11648
+ return (
11649
+ internalWidgets[widgetName]?.() ??
11650
+ Promise.reject(`Widget ${widgetName} not found`)
11651
+ );
11652
+ },
11548
11653
  suspensible: true,
11549
11654
  });
11550
11655
  importedWidget.props = reactive(
@@ -11556,7 +11661,7 @@ const getWidgetDefinition = (config) => {
11556
11661
 
11557
11662
  case "web-component":
11558
11663
  importedWidget.component = defineAsyncComponent({
11559
- loader: () => import('./DynamicWebComponent-BCwpocDX.js'),
11664
+ loader: () => import('./DynamicWebComponent-BRQQ5AXV.js'),
11560
11665
  suspensible: true,
11561
11666
  });
11562
11667
  importedWidget.props = reactive(config.widget);
@@ -11632,11 +11737,22 @@ const useTemplate = () => {
11632
11737
  }
11633
11738
 
11634
11739
  const templateConfig = eodash.templates[template];
11635
- [definedTemplate.bgWidget] = useDefineWidgets([
11740
+ const [importedBgWidget] = useDefineWidgets([
11636
11741
  templateConfig.background,
11637
11742
  ]);
11743
+ if (importedBgWidget.value.id !== definedTemplate.bgWidget.value?.id) {
11744
+ definedTemplate.bgWidget.value = importedBgWidget.value;
11745
+ }
11746
+
11747
+ const [importedLoadingWidget] = useDefineWidgets([
11748
+ templateConfig.loading,
11749
+ ]);
11638
11750
 
11639
- [definedTemplate.loading] = useDefineWidgets([templateConfig.loading]);
11751
+ if (
11752
+ importedLoadingWidget.value.id !== definedTemplate.loading.value?.id
11753
+ ) {
11754
+ definedTemplate.loading.value = importedLoadingWidget.value;
11755
+ }
11640
11756
 
11641
11757
  definedTemplate.importedWidgets = useDefineWidgets(
11642
11758
  templateConfig.widgets,
@@ -11959,6 +12075,9 @@ const _sfc_main$1 = {
11959
12075
  let __temp, __restore;
11960
12076
 
11961
12077
  const props = __props;
12078
+
12079
+ useURLSearchParametersSync();
12080
+
11962
12081
  const eodash = (
11963
12082
  ([__temp,__restore] = withAsyncContext(() => useEodashRuntime(props.config))),
11964
12083
  __temp = await __temp,
@@ -11966,18 +12085,12 @@ const eodash = (
11966
12085
  __temp
11967
12086
  );
11968
12087
 
11969
- useURLSearchParametersSync();
11970
-
11971
12088
  const theme = useUpdateTheme("dashboardTheme", {
11972
12089
  ...(eodash.brand?.theme ?? {}),
11973
12090
  });
11974
12091
  theme.global.name.value = "dashboardTheme";
11975
12092
  (
11976
- ([__temp,__restore] = withAsyncContext(() => loadFont(
11977
- eodash.brand?.font?.family,
11978
- eodash.brand?.font?.link,
11979
- props.isWebComponent,
11980
- ))),
12093
+ ([__temp,__restore] = withAsyncContext(() => loadFont(eodash.brand?.font, props.isWebComponent))),
11981
12094
  await __temp,
11982
12095
  __restore()
11983
12096
  );
@@ -11992,15 +12105,15 @@ const { loadSTAC } = useSTAcStore();
11992
12105
  const { smAndDown } = useDisplay();
11993
12106
  const TemplateComponent = computed(() =>
11994
12107
  smAndDown.value
11995
- ? defineAsyncComponent(() => import('./MobileLayout-DRgyQYFz.js'))
11996
- : defineAsyncComponent(() => import('./DashboardLayout-VrJIbhe8.js')),
12108
+ ? defineAsyncComponent(() => import('./MobileLayout-CUHZFLDY.js'))
12109
+ : defineAsyncComponent(() => import('./DashboardLayout-ByVMURpM.js')),
11997
12110
  );
11998
12111
 
11999
12112
  const HeaderComponent = defineAsyncComponent(
12000
- () => import('./Header-CTiEXLi0.js'),
12113
+ () => import('./Header-BcHAtFqr.js'),
12001
12114
  );
12002
12115
  const FooterComponent = defineAsyncComponent(
12003
- () => import('./Footer-DlIEbXp-.js'),
12116
+ () => import('./Footer-FUp1Te0L.js'),
12004
12117
  );
12005
12118
 
12006
12119
  const templateHeight = props.isWebComponent ? "100%" : "100dvh";