@geotrekce/geotrek-rando-widget 0.0.7 → 0.0.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 (59) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/grw-app.cjs.entry.js +14 -5
  3. package/dist/cjs/grw-filter_6.cjs.entry.js +92 -47
  4. package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +2 -2
  5. package/dist/cjs/grw-trek-card.cjs.entry.js +3 -3
  6. package/dist/cjs/{index-c2c4531d.js → index-4c76daa3.js} +8 -3
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/{store-fd04a216.js → store-b4c3c507.js} +6 -4
  9. package/dist/collection/components/grw-app/grw-app.css +17 -11
  10. package/dist/collection/components/grw-app/grw-app.js +21 -9
  11. package/dist/collection/components/grw-filter/grw-filter.js +11 -12
  12. package/dist/collection/components/grw-map/grw-map.js +28 -17
  13. package/dist/collection/components/grw-trek-card/grw-trek-card.js +1 -1
  14. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +4 -2
  15. package/dist/collection/components/grw-treks-list/grw-treks-list.css +0 -12
  16. package/dist/collection/components/grw-treks-list/grw-treks-list.js +32 -10
  17. package/dist/collection/store/grw-trek-provider.js +8 -2
  18. package/dist/collection/store/grw-treks-provider.js +6 -3
  19. package/dist/collection/store/store.js +5 -3
  20. package/dist/components/grw-app.js +14 -5
  21. package/dist/components/grw-filter2.js +11 -12
  22. package/dist/components/grw-map2.js +28 -17
  23. package/dist/components/grw-trek-card2.js +1 -1
  24. package/dist/components/grw-trek-detail2.js +4 -2
  25. package/dist/components/grw-trek-provider2.js +8 -2
  26. package/dist/components/grw-treks-list2.js +34 -10
  27. package/dist/components/grw-treks-provider2.js +6 -3
  28. package/dist/components/store.js +5 -3
  29. package/dist/esm/geotrek-rando-widget.js +2 -2
  30. package/dist/esm/grw-app.entry.js +14 -5
  31. package/dist/esm/grw-filter_6.entry.js +92 -47
  32. package/dist/esm/grw-information-desk-detail_3.entry.js +2 -2
  33. package/dist/esm/grw-trek-card.entry.js +3 -3
  34. package/dist/esm/{index-192d910f.js → index-ee473772.js} +8 -3
  35. package/dist/esm/loader.js +2 -2
  36. package/dist/esm/{store-b2c76c0c.js → store-a5f523fd.js} +6 -4
  37. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  38. package/dist/geotrek-rando-widget/{p-7715153d.entry.js → p-0510e16b.entry.js} +1 -1
  39. package/dist/geotrek-rando-widget/p-22562f4d.js +1 -0
  40. package/dist/geotrek-rando-widget/p-34fbbb97.entry.js +1 -0
  41. package/dist/geotrek-rando-widget/{p-1b2ba86d.entry.js → p-500436f1.entry.js} +1 -1
  42. package/dist/geotrek-rando-widget/p-94f0db4d.entry.js +1 -0
  43. package/dist/geotrek-rando-widget/p-b62909db.js +2 -0
  44. package/dist/types/components/grw-app/grw-app.d.ts +2 -2
  45. package/dist/types/components/grw-filter/grw-filter.d.ts +1 -1
  46. package/dist/types/components/grw-map/grw-map.d.ts +1 -1
  47. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +1 -1
  48. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +1 -1
  49. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +5 -2
  50. package/dist/types/components.d.ts +2 -2
  51. package/dist/types/store/grw-trek-provider.d.ts +2 -1
  52. package/dist/types/store/grw-treks-provider.d.ts +1 -1
  53. package/dist/types/store/store.d.ts +4 -0
  54. package/package.json +1 -1
  55. package/readme.md +4 -0
  56. package/dist/geotrek-rando-widget/p-4361afd2.entry.js +0 -1
  57. package/dist/geotrek-rando-widget/p-5f17d340.entry.js +0 -1
  58. package/dist/geotrek-rando-widget/p-6dce5e6c.js +0 -2
  59. package/dist/geotrek-rando-widget/p-e6710c64.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-c2c4531d.js');
3
+ const index = require('./index-4c76daa3.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["grw-trek-card.cjs",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3.cjs",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6.cjs",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app.cjs",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[8],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
18
+ return index.bootstrapLazy([["grw-trek-card.cjs",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3.cjs",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6.cjs",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app.cjs",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[2],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
19
19
  });
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-c2c4531d.js');
6
- const store = require('./store-fd04a216.js');
5
+ const index = require('./index-4c76daa3.js');
6
+ const store = require('./store-b4c3c507.js');
7
7
 
8
8
  const arrowBackImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><polyline points="244 400 100 256 244 112" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/><line x1="120" y1="256" x2="412" y2="256" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/></svg>`;
9
9
 
10
- const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh;font-family:\"Roboto\"}.header-container,.large-view-header-container{display:flex;align-items:center;background-color:var(--color-primary);height:64px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.header-container .handle-filters-button,.large-view-header-container .handle-filters-button{user-select:none;cursor:pointer;color:var(--color-primary);background-color:#ffffff;margin-left:36px;border-radius:8px;padding:8px}.header-container .attribution-container,.large-view-header-container .attribution-container{position:absolute;right:24px}.header-container .attribution-container a,.large-view-header-container .attribution-container a{color:#ffffff;text-decoration:none}.options-container{height:calc(100% - 64px);position:absolute;width:100%;z-index:1100;top:64px}.filters-container{position:absolute;width:100%;background-color:#ffffff;padding:36px 0px;z-index:1100}.filters-container .close-filters-button{cursor:pointer;font-weight:bold;position:absolute;top:12px;right:12px;padding:12px;border-radius:12px;color:var(--color-primary);border:1px var(--color-primary) solid}.filters-container .close-filters-button:hover{background-color:var(--color-primary);color:#ffffff}.filters-container .filter-margin-top{margin-top:24px}.filters-container .current-treks-length{margin:0px 0px 32px 8px;color:var(--color-primary);font-size:24px;font-weight:bold}.back-filters-container{background-color:rgba(0, 0, 0, 0.5);width:100%;height:calc(100% - 64px);position:absolute;z-index:1099;top:64px}.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.loader-container{position:absolute;width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{position:relative;width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}";
10
+ const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh;font-family:\"Roboto\"}.header-container,.large-view-header-container{display:flex;flex-direction:row;align-items:center;background-color:var(--color-primary);height:64px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.header-container .handle-filters-container,.large-view-header-container .handle-filters-container{display:flex;align-items:center}.header-container .handle-filters-container .handle-filters-button,.large-view-header-container .handle-filters-container .handle-filters-button{user-select:none;cursor:pointer;color:var(--color-primary);background-color:#ffffff;margin-left:12px;border-radius:8px;padding:8px}.header-container .handle-filters-container .current-treks-within-bounds-length,.large-view-header-container .handle-filters-container .current-treks-within-bounds-length{margin-left:12px;color:#ffffff}.header-container .attribution-container,.large-view-header-container .attribution-container{position:absolute;right:24px}.header-container .attribution-container a,.large-view-header-container .attribution-container a{color:#ffffff;text-decoration:none}.options-container{height:calc(100% - 64px);position:absolute;width:100%;z-index:1100;top:64px}.filters-container{position:absolute;width:100%;background-color:#ffffff;padding:36px 0px;z-index:1100}.filters-container .close-filters-button{cursor:pointer;font-weight:bold;position:absolute;top:12px;right:12px;padding:12px;border-radius:12px;color:var(--color-primary);border:1px var(--color-primary) solid}.filters-container .close-filters-button:hover{background-color:var(--color-primary);color:#ffffff}.filters-container .filter-margin-top{margin-top:24px}.back-filters-container{background-color:rgba(0, 0, 0, 0.5);width:100%;height:calc(100% - 64px);position:absolute;z-index:1099;top:64px}.init-loader-container,.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.init-loader-container .loader,.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.init-loader-container,.loader-container{width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}";
11
11
 
12
12
  const GrwApp = class {
13
13
  constructor(hostRef) {
@@ -26,8 +26,8 @@ const GrwApp = class {
26
26
  this.colorArrivalIcon = '#85003b';
27
27
  this.colorSensitiveArea = '#4974a5';
28
28
  this.colorPoiIcon = '#974c6e';
29
- this.handlePopStateBind = this.handlePopState.bind(this);
30
29
  this.largeViewSize = 1024;
30
+ this.handlePopStateBind = this.handlePopState.bind(this);
31
31
  }
32
32
  onTrekCardPress(event) {
33
33
  this.currentTrekId = event.detail;
@@ -43,6 +43,14 @@ const GrwApp = class {
43
43
  window.dispatchEvent(new window.Event('resize'));
44
44
  }
45
45
  componentDidLoad() {
46
+ store.onChange('trekNetworkError', () => {
47
+ if (store.state.trekNetworkError) {
48
+ const urlRedirect = new URL(window.location.toString());
49
+ urlRedirect.searchParams.delete('trek');
50
+ window.history.replaceState({}, '', urlRedirect);
51
+ this.onTrekDetailsClose();
52
+ }
53
+ });
46
54
  this.handleView();
47
55
  window.addEventListener('popstate', this.handlePopStateBind, false);
48
56
  const url = new URL(window.location.toString());
@@ -54,6 +62,7 @@ const GrwApp = class {
54
62
  }
55
63
  }
56
64
  onTrekDetailsClose() {
65
+ store.state.currentTrek = null;
57
66
  this.currentTrekId = null;
58
67
  this.showTrek = !this.showTrek;
59
68
  }
@@ -99,7 +108,7 @@ const GrwApp = class {
99
108
  window.removeEventListener('popstate', this.handlePopStateBind);
100
109
  }
101
110
  render() {
102
- return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } }, index.h("grw-treks-provider", { api: this.api, language: this.language, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }), this.showTrek && this.currentTrekId && index.h("grw-trek-provider", { api: store.state.api, language: this.language, "trek-id": this.currentTrekId }), index.h("div", { class: "app-container" }, index.h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? (index.h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (index.h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")), !this.showTrek && this.showFilters && (index.h("div", { class: "options-container" }, index.h("div", { class: "filters-container" }, index.h("div", { class: "current-treks-length" }, `${store.state.currentTreks.length} résultat${store.state.currentTreks.length > 1 ? 's' : ''}`), index.h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"), index.h("div", null, index.h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })), index.h("div", { class: "filter-margin-top" }, index.h("grw-filter", { filterName: "Difficult\u00E9", filterType: "difficulties", filterNameProperty: "label" })), index.h("div", { class: "filter-margin-top" }, index.h("grw-filter", { filterName: "Dur\u00E9e", filterType: "durations", filterNameProperty: "name" }))), index.h("div", { onClick: () => this.handleFilters(), class: "back-filters-container" }))), index.h("div", { class: "attribution-container" }, index.h("a", { target: "_blank", href: "https://geotrek.fr" }, "GEOTREK"))), index.h("div", { class: "content-container" }, index.h("div", { class: this.isLargeView ? 'large-view-app-treks-list-container' : 'app-treks-list-container', style: { display: this.showTrek ? 'none' : 'flex', position: this.showTrek ? 'absolute' : 'relative' } }, index.h("grw-treks-list", { "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !store.state.currentTrek && (index.h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, index.h("span", { class: "loader" }))), store.state.currentTrek && (index.h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, index.h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), index.h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: (this.showTreksMap && !this.showTrek) || (this.showTrekMap && this.showTrek) ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint, "color-trek-line": this.colorTrekLine, "color-departure-icon": this.colorDepartureIcon, "color-arrival-icon": this.colorArrivalIcon, "color-sensitive-area": this.colorSensitiveArea, "color-poi-icon": this.colorPoiIcon })), index.h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, index.h("div", { onClick: () => this.handleShowMap() }, this.showTreksMap || this.showTrekMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
111
+ return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } }, index.h("grw-treks-provider", { api: this.api, language: this.language, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }), !store.state.currentTreks && !store.state.currentTrek && (index.h("div", { class: "init-loader-container" }, index.h("span", { class: "loader" }))), this.showTrek && this.currentTrekId && index.h("grw-trek-provider", { api: store.state.api, language: this.language, "trek-id": this.currentTrekId }), (store.state.currentTreks || store.state.currentTrek) && (index.h("div", { class: "app-container" }, index.h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? (index.h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (index.h("div", { class: "handle-filters-container" }, index.h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER"), store.state.treksWithinBounds && (index.h("div", { class: "current-treks-within-bounds-length" }, `${store.state.treksWithinBounds.length} randonnée${store.state.treksWithinBounds.length > 1 ? 's' : ''}`)))), !this.showTrek && this.showFilters && (index.h("div", { class: "options-container" }, index.h("div", { class: "filters-container" }, index.h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"), index.h("div", null, index.h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })), index.h("div", { class: "filter-margin-top" }, index.h("grw-filter", { filterName: "Difficult\u00E9", filterType: "difficulties", filterNameProperty: "label" })), index.h("div", { class: "filter-margin-top" }, index.h("grw-filter", { filterName: "Dur\u00E9e", filterType: "durations", filterNameProperty: "name" }))), index.h("div", { onClick: () => this.handleFilters(), class: "back-filters-container" }))), index.h("div", { class: "attribution-container" }, index.h("a", { target: "_blank", href: "https://geotrek.fr" }, "GEOTREK"))), index.h("div", { class: "content-container" }, index.h("div", { class: this.isLargeView ? 'large-view-app-treks-list-container' : 'app-treks-list-container', style: { display: this.showTrek ? 'none' : 'flex', position: this.showTrek ? 'absolute' : 'relative' } }, index.h("grw-treks-list", { "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !store.state.currentTrek && (index.h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, index.h("span", { class: "loader" }))), store.state.currentTrek && (index.h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, index.h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), index.h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: (this.showTreksMap && !this.showTrek) || (this.showTrekMap && this.showTrek) ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint, "color-trek-line": this.colorTrekLine, "color-departure-icon": this.colorDepartureIcon, "color-arrival-icon": this.colorArrivalIcon, "color-sensitive-area": this.colorSensitiveArea, "color-poi-icon": this.colorPoiIcon })), index.h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, index.h("div", { onClick: () => this.handleShowMap() }, this.showTrek ? (this.showTrekMap ? 'Voir la fiche' : 'Voir la carte') : this.showTreksMap ? 'Voir la liste' : 'Voir la carte'))))));
103
112
  }
104
113
  get element() { return index.getElement(this); }
105
114
  static get watchers() { return {
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-c2c4531d.js');
6
- const store = require('./store-fd04a216.js');
5
+ const index = require('./index-4c76daa3.js');
6
+ const store = require('./store-b4c3c507.js');
7
7
  const length = require('./length-d315d156.js');
8
8
 
9
9
  const grwFilterCss = ".filter-name{margin-left:8px;color:var(--color-primary);font-size:24px;font-weight:bold}.filter-button-container{display:flex;flex-direction:row;flex-wrap:wrap}.filter-button-container .filter-button,.filter-button-container .selected-filter-button{user-select:none;cursor:pointer;border:1px var(--color-primary) solid;border-radius:8px;margin:8px 0px 0px 8px;padding:8px}.filter-button-container .filter-button{color:var(--color-primary);background-color:#ffffff}.filter-button-container .selected-filter-button{color:#ffffff;background-color:var(--color-primary)}";
@@ -32,18 +32,17 @@ const GrwFilter = class {
32
32
  filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
33
33
  }
34
34
  else if (filter.type === 'interval') {
35
- let minValue;
36
- let maxValue;
37
- for (const currentFilterId of currentFiltersId) {
38
- const currentFilter = store.state[filter.property].find(property => property.id === currentFilterId);
39
- if (isNaN(minValue) || currentFilter.minValue < minValue) {
40
- minValue = currentFilter.minValue;
41
- }
42
- if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
43
- maxValue = currentFilter.maxValue;
44
- }
45
- }
46
- filtersTreks = [...filtersTreks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
35
+ filtersTreks = [
36
+ ...filtersTreks.filter(trek => {
37
+ for (const currentFilterId of currentFiltersId) {
38
+ const currentFilter = store.state[filter.property].find(property => property.id === currentFilterId);
39
+ if (trek[filter.trekProperty] >= currentFilter.minValue && trek[filter.trekProperty] <= currentFilter.maxValue) {
40
+ return true;
41
+ }
42
+ }
43
+ return false;
44
+ }),
45
+ ];
47
46
  }
48
47
  }
49
48
  else {
@@ -14237,7 +14236,7 @@ const GrwMap = class {
14237
14236
  this.colorPoiIcon = '#974c6e';
14238
14237
  this.handleTreksWithinBoundsBind = this.handleTreksWithinBounds.bind(this);
14239
14238
  }
14240
- componentDidLoad() {
14239
+ connectedCallback() {
14241
14240
  this.map = leafletSrc.map(this.element, {
14242
14241
  center: this.center.split(',').map(Number),
14243
14242
  zoom: this.zoom,
@@ -14250,14 +14249,16 @@ const GrwMap = class {
14250
14249
  if (store.state.currentTrek) {
14251
14250
  this.addTrek();
14252
14251
  }
14253
- else if (store.state.currentTrek) {
14252
+ else if (store.state.currentTreks) {
14254
14253
  this.addTreks();
14255
14254
  }
14256
14255
  store.onChange('currentTreks', () => {
14257
14256
  if (store.state.currentTrek) {
14257
+ this.removeTreks();
14258
14258
  this.addTrek();
14259
14259
  }
14260
14260
  else if (store.state.currentTreks) {
14261
+ this.removeTrek();
14261
14262
  this.addTreks();
14262
14263
  }
14263
14264
  });
@@ -14267,8 +14268,8 @@ const GrwMap = class {
14267
14268
  this.addTrek();
14268
14269
  }
14269
14270
  else {
14270
- this.addTreks();
14271
14271
  this.removeTrek();
14272
+ this.addTreks();
14272
14273
  }
14273
14274
  });
14274
14275
  }
@@ -14279,18 +14280,20 @@ const GrwMap = class {
14279
14280
  type: 'FeatureCollection',
14280
14281
  features: [],
14281
14282
  };
14282
- for (const trek of store.state.currentTreks) {
14283
- trekscurrentDepartureCoordinates.push(trek.departure_geom);
14284
- treksFeatureCollection.features.push({
14285
- type: 'Feature',
14286
- geometry: { type: 'Point', coordinates: trek.departure_geom },
14287
- properties: {
14288
- id: trek.id,
14289
- name: trek.name,
14290
- practice: (_a = store.state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
14291
- imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
14292
- },
14293
- });
14283
+ if (store.state.currentTreks) {
14284
+ for (const trek of store.state.currentTreks) {
14285
+ trekscurrentDepartureCoordinates.push(trek.departure_geom);
14286
+ treksFeatureCollection.features.push({
14287
+ type: 'Feature',
14288
+ geometry: { type: 'Point', coordinates: trek.departure_geom },
14289
+ properties: {
14290
+ id: trek.id,
14291
+ name: trek.name,
14292
+ practice: (_a = store.state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
14293
+ imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
14294
+ },
14295
+ });
14296
+ }
14294
14297
  }
14295
14298
  if (!this.treksLayer) {
14296
14299
  if (trekscurrentDepartureCoordinates.length > 0 && !store.state.currentMapTreksBounds) {
@@ -14298,7 +14301,9 @@ const GrwMap = class {
14298
14301
  this.map.fitBounds(bounds);
14299
14302
  }
14300
14303
  else {
14301
- this.map.fitBounds(store.state.currentMapTreksBounds);
14304
+ if (store.state.currentMapTreksBounds) {
14305
+ this.map.fitBounds(store.state.currentMapTreksBounds);
14306
+ }
14302
14307
  }
14303
14308
  this.treksLayer = leafletSrc.geoJSON(treksFeatureCollection, {
14304
14309
  pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
@@ -14334,6 +14339,9 @@ const GrwMap = class {
14334
14339
  const bounds = leafletSrc.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
14335
14340
  this.map.fitBounds(bounds);
14336
14341
  }
14342
+ else {
14343
+ this.map.fire('moveend');
14344
+ }
14337
14345
  this.treksLayer.clearLayers();
14338
14346
  this.treksLayer.addData(treksFeatureCollection);
14339
14347
  }
@@ -14349,7 +14357,9 @@ const GrwMap = class {
14349
14357
  }
14350
14358
  }
14351
14359
  handleTreksWithinBounds() {
14352
- store.state.treksWithinBounds = store.state.currentTreks.filter(trek => this.map.getBounds().contains(leafletSrc.latLng(trek.departure_geom[1], trek.departure_geom[0])));
14360
+ if (!store.state.currentMapTreksBounds || store.state.currentMapTreksBounds.toBBoxString() !== this.map.getBounds().toBBoxString()) {
14361
+ store.state.treksWithinBounds = store.state.currentTreks.filter(trek => this.map.getBounds().contains(leafletSrc.latLng(trek.departure_geom[1], trek.departure_geom[0])));
14362
+ }
14353
14363
  }
14354
14364
  addTrek() {
14355
14365
  const currentTrekFeature = {
@@ -14616,7 +14626,7 @@ const GrwTrekDetail = class {
14616
14626
  this.colorPrimaryShade = '#4a0021';
14617
14627
  this.colorPrimaryTint = '#974c6e';
14618
14628
  }
14619
- componentWillLoad() {
14629
+ connectedCallback() {
14620
14630
  this.currentTrek = this.trek ? this.trek : store.state.currentTrek;
14621
14631
  if (this.currentTrek) {
14622
14632
  this.difficulty = store.state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
@@ -14651,7 +14661,9 @@ const GrwTrekDetail = class {
14651
14661
  return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-shade': this.colorPrimaryShade, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (index.h("div", { class: "trek-detail-container" }, index.h("div", { class: "name" }, this.currentTrek.name), this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (index.h("img", { class: "image", src: this.currentTrek.attachments[0].thumbnail, loading: "lazy" })), index.h("div", { class: "sub-container" }, index.h("div", { class: "icons-labels-container" }, index.h("div", { class: "row" }, index.h("div", { class: "icon-label difficulty" }, ((_a = this.difficulty) === null || _a === void 0 ? void 0 : _a.pictogram) && index.h("img", { src: this.difficulty.pictogram }), (_b = this.difficulty) === null || _b === void 0 ? void 0 :
14652
14662
  _b.label), index.h("div", { class: "icon-label duration" }, index.h("div", { class: "svg-icon", innerHTML: length.durationImage }), length.formatDuration((_c = this.currentTrek) === null || _c === void 0 ? void 0 : _c.duration)), index.h("div", { class: "icon-label route" }, ((_d = this.route) === null || _d === void 0 ? void 0 : _d.pictogram) && index.h("img", { src: this.route.pictogram }), (_e = this.route) === null || _e === void 0 ? void 0 :
14653
14663
  _e.route)), index.h("div", { class: "row" }, index.h("div", { class: "icon-label length" }, index.h("div", { class: "svg-icon", innerHTML: length.lengthImage }), length.formatLength(this.currentTrek.length_2d)), index.h("div", { class: "icon-label ascent" }, index.h("div", { class: "svg-icon", innerHTML: length.ascentImage }), length.formatAscent(this.currentTrek.ascent)), index.h("div", { class: "icon-label practice" }, ((_f = this.practice) === null || _f === void 0 ? void 0 : _f.pictogram) && index.h("img", { src: this.practice.pictogram }), (_g = this.practice) === null || _g === void 0 ? void 0 :
14654
- _g.name)))), index.h("div", { class: "downloads-container" }, index.h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"), index.h("div", { class: "links-container" }, index.h("a", { href: `${this.currentTrek.gpx}` }, "GPX"), index.h("a", { href: `${this.currentTrek.kml}` }, "KML"), index.h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))), this.themes.length > 0 && (index.h("div", { class: "themes-container" }, this.themes.map(theme => (index.h("div", { class: "theme" }, theme.label))))), this.currentTrek.description_teaser && index.h("div", { class: "description-teaser", innerHTML: this.currentTrek.description_teaser }), this.currentTrek.ambiance && index.h("div", { class: "ambiance", innerHTML: this.currentTrek.ambiance }), this.currentTrek.description && (index.h("div", { class: "description-container" }, index.h("div", { class: "description-title" }, "Description"), index.h("div", { class: "description", innerHTML: this.currentTrek.description }))), this.currentTrek.departure && (index.h("div", { class: "departure-container" }, index.h("div", { class: "departure-title" }, "D\u00E9part :\u00A0"), index.h("div", { innerHTML: this.currentTrek.departure }))), this.currentTrek.arrival && (index.h("div", { class: "arrival-container" }, index.h("div", { class: "arrival-title" }, "Arriv\u00E9e :\u00A0"), index.h("div", { innerHTML: this.currentTrek.arrival }))), this.currentTrek.altimetric_profile && (index.h("div", { class: "altimetric-profile-container" }, index.h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"), index.h("img", { src: `${this.currentTrek.altimetric_profile}?format=svg` }))), this.currentTrek.access && (index.h("div", { class: "access-container" }, index.h("div", { class: "access-title" }, "Acc\u00E8s routier"), index.h("div", { class: "access", innerHTML: this.currentTrek.access }))), this.currentTrek.public_transport && (index.h("div", { class: "public-transport-container" }, index.h("div", { class: "public-transport-title" }, "Transport"), index.h("div", { class: "public-transport", innerHTML: this.currentTrek.public_transport }))), (this.currentTrek.advice || this.labels.length > 0) && (index.h("div", { class: "advice-container" }, index.h("div", { class: "advice-title" }, "Recommandations"), this.currentTrek.advice && index.h("div", { class: "advice", innerHTML: this.currentTrek.advice }), this.labels.map(label => (index.h("div", { class: "label-container" }, index.h("div", { class: "label-sub-container" }, label.pictogram && index.h("img", { src: label.pictogram }), index.h("div", { class: "label-name", innerHTML: label.name })), index.h("div", { class: "label-advice", innerHTML: label.advice })))))), this.currentTrek.advised_parking && (index.h("div", { class: "advised-parking-container" }, index.h("div", { class: "advised-parking-title" }, "Parking conseill\u00E9"), index.h("div", { class: "advised_parking", innerHTML: this.currentTrek.advised_parking }))), this.currentTrek.gear && (index.h("div", { class: "gear-container" }, index.h("div", { class: "gear-title" }, "\u00C9quipements"), index.h("div", { class: "gear", innerHTML: this.currentTrek.gear }))), store.state.currentSensitiveAreas && store.state.currentSensitiveAreas.length > 0 && (index.h("div", { class: "sensitive-areas-container" }, index.h("div", { class: "sensitive-areas-title" }, "Zones de sensibilit\u00E9 environnementale"), store.state.currentSensitiveAreas.map(sensitiveArea => (index.h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))), store.state.currentInformationDesks && store.state.currentInformationDesks.length > 0 && (index.h("div", { class: "information-desks-container" }, index.h("div", { class: "information-desks-title" }, "Lieux de renseignement"), store.state.currentInformationDesks.map(informationDesk => (index.h("grw-information-desk-detail", { informationDesk: informationDesk }))))), (this.currentTrek.disabled_infrastructure ||
14664
+ _g.name)))), index.h("div", { class: "downloads-container" }, index.h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"), index.h("div", { class: "links-container" }, index.h("a", { href: `${this.currentTrek.gpx}` }, "GPX"), index.h("a", { href: `${this.currentTrek.kml}` }, "KML"), index.h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))), this.themes.length > 0 && (index.h("div", { class: "themes-container" }, this.themes.map(theme => (index.h("div", { class: "theme" }, theme.label))))), this.currentTrek.description_teaser && index.h("div", { class: "description-teaser", innerHTML: this.currentTrek.description_teaser }), this.currentTrek.ambiance && index.h("div", { class: "ambiance", innerHTML: this.currentTrek.ambiance }), this.currentTrek.description && (index.h("div", { class: "description-container" }, index.h("div", { class: "description-title" }, "Description"), index.h("div", { class: "description", innerHTML: this.currentTrek.description }))), this.currentTrek.departure && (index.h("div", { class: "departure-container" }, index.h("div", { class: "departure-title" }, "D\u00E9part :\u00A0"), index.h("div", { innerHTML: this.currentTrek.departure }))), this.currentTrek.arrival && (index.h("div", { class: "arrival-container" }, index.h("div", { class: "arrival-title" }, "Arriv\u00E9e :\u00A0"), index.h("div", { innerHTML: this.currentTrek.arrival }))), this.currentTrek.altimetric_profile && (index.h("div", { class: "altimetric-profile-container" }, index.h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"), index.h("img", { src: this.currentTrek.altimetric_profile.endsWith('.json')
14665
+ ? this.currentTrek.altimetric_profile.replace('.json', '.svg')
14666
+ : `${this.currentTrek.altimetric_profile}?format=svg` }))), this.currentTrek.access && (index.h("div", { class: "access-container" }, index.h("div", { class: "access-title" }, "Acc\u00E8s routier"), index.h("div", { class: "access", innerHTML: this.currentTrek.access }))), this.currentTrek.public_transport && (index.h("div", { class: "public-transport-container" }, index.h("div", { class: "public-transport-title" }, "Transport"), index.h("div", { class: "public-transport", innerHTML: this.currentTrek.public_transport }))), (this.currentTrek.advice || this.labels.length > 0) && (index.h("div", { class: "advice-container" }, index.h("div", { class: "advice-title" }, "Recommandations"), this.currentTrek.advice && index.h("div", { class: "advice", innerHTML: this.currentTrek.advice }), this.labels.map(label => (index.h("div", { class: "label-container" }, index.h("div", { class: "label-sub-container" }, label.pictogram && index.h("img", { src: label.pictogram }), index.h("div", { class: "label-name", innerHTML: label.name })), index.h("div", { class: "label-advice", innerHTML: label.advice })))))), this.currentTrek.advised_parking && (index.h("div", { class: "advised-parking-container" }, index.h("div", { class: "advised-parking-title" }, "Parking conseill\u00E9"), index.h("div", { class: "advised_parking", innerHTML: this.currentTrek.advised_parking }))), this.currentTrek.gear && (index.h("div", { class: "gear-container" }, index.h("div", { class: "gear-title" }, "\u00C9quipements"), index.h("div", { class: "gear", innerHTML: this.currentTrek.gear }))), store.state.currentSensitiveAreas && store.state.currentSensitiveAreas.length > 0 && (index.h("div", { class: "sensitive-areas-container" }, index.h("div", { class: "sensitive-areas-title" }, "Zones de sensibilit\u00E9 environnementale"), store.state.currentSensitiveAreas.map(sensitiveArea => (index.h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))), store.state.currentInformationDesks && store.state.currentInformationDesks.length > 0 && (index.h("div", { class: "information-desks-container" }, index.h("div", { class: "information-desks-title" }, "Lieux de renseignement"), store.state.currentInformationDesks.map(informationDesk => (index.h("grw-information-desk-detail", { informationDesk: informationDesk }))))), (this.currentTrek.disabled_infrastructure ||
14655
14667
  (this.accessibilities && this.accessibilities.length > 0) ||
14656
14668
  this.currentTrek.accessibility_level ||
14657
14669
  this.currentTrek.accessibility_slope ||
@@ -14668,17 +14680,18 @@ const GrwTrekProvider = class {
14668
14680
  constructor(hostRef) {
14669
14681
  index.registerInstance(this, hostRef);
14670
14682
  this.language = 'fr';
14683
+ this.trekNetworkError = false;
14671
14684
  this.controller = new AbortController();
14672
14685
  this.signal = this.controller.signal;
14673
14686
  }
14674
- componentWillLoad() {
14687
+ connectedCallback() {
14675
14688
  store.state.api = this.api;
14676
14689
  const requests = [];
14677
14690
  requests.push(!store.state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
14678
14691
  requests.push(!store.state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }) : new Response('null'));
14679
14692
  requests.push(!store.state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }) : new Response('null'));
14680
14693
  requests.push(!store.state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
14681
- return Promise.all([
14694
+ Promise.all([
14682
14695
  ...requests,
14683
14696
  fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`, {
14684
14697
  signal: this.signal,
@@ -14693,6 +14706,7 @@ const GrwTrekProvider = class {
14693
14706
  ])
14694
14707
  .then(responses => Promise.all(responses.map(response => response.json())))
14695
14708
  .then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
14709
+ store.state.trekNetworkError = false;
14696
14710
  if (difficulties) {
14697
14711
  store.state.difficulties = difficulties.results;
14698
14712
  }
@@ -14717,18 +14731,22 @@ const GrwTrekProvider = class {
14717
14731
  store.state.currentPois = pois.results;
14718
14732
  store.state.currentInformationDesks = informationDesks.results;
14719
14733
  store.state.currentTrek = trek;
14734
+ })
14735
+ .catch(() => {
14736
+ store.state.trekNetworkError = true;
14720
14737
  });
14721
14738
  }
14722
14739
  disconnectedCallback() {
14723
14740
  this.controller.abort();
14724
14741
  store.state.currentTrek = null;
14742
+ store.state.trekNetworkError = false;
14725
14743
  }
14726
14744
  render() {
14727
14745
  return index.h(index.Host, null);
14728
14746
  }
14729
14747
  };
14730
14748
 
14731
- const grwTreksListCss = ":host{font-family:\"Roboto\";width:100%;height:100%;max-height:100vh;overflow-y:auto}.current-treks-length{width:100%;text-align:center;padding:32px 0px;color:var(--color-primary);font-size:24px;font-weight:bold}.current-treks-container{display:flex;flex-wrap:wrap;justify-content:space-around}grw-trek-card{margin:6px}";
14749
+ const grwTreksListCss = ":host{font-family:\"Roboto\";width:100%;height:100%;max-height:100vh;overflow-y:auto;display:flex;flex-wrap:wrap;justify-content:space-around}grw-trek-card{margin:6px}";
14732
14750
 
14733
14751
  const GrwTreksList = class {
14734
14752
  constructor(hostRef) {
@@ -14737,19 +14755,28 @@ const GrwTreksList = class {
14737
14755
  this.colorPrimary = '#6b0030';
14738
14756
  this.colorPrimaryTint = '#974c6e';
14739
14757
  this.isLargeView = false;
14740
- this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
14741
14758
  this.step = 10;
14759
+ this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
14760
+ this.shouldAddInfiniteScrollEvent = true;
14742
14761
  }
14743
- componentWillLoad() {
14762
+ connectedCallback() {
14763
+ this.handleInfiniteScrollEvent(true);
14764
+ if (store.state.currentTreks) {
14765
+ this.treksToDisplay = [...store.state.currentTreks.slice(0, this.step)];
14766
+ }
14744
14767
  store.onChange('currentTreks', () => {
14745
- this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14768
+ this.handleInfiniteScrollEvent(true);
14746
14769
  this.element.scroll({ top: 0 });
14747
- this.treksToDisplay = [...store.state.currentTreks.slice(0, this.step)];
14770
+ if (store.state.currentTreks) {
14771
+ this.treksToDisplay = [...store.state.currentTreks.slice(0, this.step)];
14772
+ }
14748
14773
  });
14749
14774
  store.onChange('treksWithinBounds', () => {
14750
- this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14775
+ this.handleInfiniteScrollEvent(true);
14751
14776
  this.element.scroll({ top: 0 });
14752
- this.treksToDisplay = [...store.state.treksWithinBounds.slice(0, this.step)];
14777
+ if (store.state.treksWithinBounds) {
14778
+ this.treksToDisplay = [...store.state.treksWithinBounds.slice(0, this.step)];
14779
+ }
14753
14780
  });
14754
14781
  }
14755
14782
  handleInfiniteScroll(event) {
@@ -14758,12 +14785,27 @@ const GrwTreksList = class {
14758
14785
  this.treksToDisplay = store.state.treksWithinBounds.slice(0, this.treksToDisplay.length + this.step >= store.state.treksWithinBounds.length ? store.state.treksWithinBounds.length : this.treksToDisplay.length + this.step);
14759
14786
  }
14760
14787
  else {
14761
- this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
14788
+ this.handleInfiniteScrollEvent(false);
14789
+ }
14790
+ }
14791
+ }
14792
+ handleInfiniteScrollEvent(shouldAddInfiniteScrollEvent) {
14793
+ if (shouldAddInfiniteScrollEvent) {
14794
+ if (this.shouldAddInfiniteScrollEvent) {
14795
+ this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14796
+ this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
14762
14797
  }
14763
14798
  }
14799
+ else {
14800
+ this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
14801
+ this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
14802
+ }
14803
+ }
14804
+ disconnectedCallback() {
14805
+ this.handleInfiniteScrollEvent(false);
14764
14806
  }
14765
14807
  render() {
14766
- return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, index.h("div", { class: "current-treks-length" }, `${store.state.treksWithinBounds.length} résultat${store.state.treksWithinBounds.length > 1 ? 's' : ''}`), index.h("div", { class: "current-treks-container" }, this.treksToDisplay.map(trek => (index.h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint }))))));
14808
+ return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.treksToDisplay.map(trek => (index.h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })))));
14767
14809
  }
14768
14810
  get element() { return index.getElement(this); }
14769
14811
  };
@@ -14776,7 +14818,7 @@ const GrwTreksProvider = class {
14776
14818
  this.controller = new AbortController();
14777
14819
  this.signal = this.controller.signal;
14778
14820
  }
14779
- componentWillLoad() {
14821
+ connectedCallback() {
14780
14822
  store.state.api = this.api;
14781
14823
  let treksRequest = `${this.api}trek/?language=${this.language}&published=true`;
14782
14824
  this.inBbox && (treksRequest += `&in_bbox=${this.inBbox}`);
@@ -14788,7 +14830,7 @@ const GrwTreksProvider = class {
14788
14830
  this.routes && (treksRequest += `&routes=${this.routes}`);
14789
14831
  this.practices && (treksRequest += `&practices=${this.practices}`);
14790
14832
  treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
14791
- return Promise.all([
14833
+ Promise.all([
14792
14834
  fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
14793
14835
  fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }),
14794
14836
  fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
@@ -14797,6 +14839,7 @@ const GrwTreksProvider = class {
14797
14839
  ])
14798
14840
  .then(responses => Promise.all(responses.map(response => response.json())))
14799
14841
  .then(([difficulties, routes, practices, themes, treks]) => {
14842
+ store.state.treksNetworkError = false;
14800
14843
  store.state.difficulties = difficulties.results;
14801
14844
  store.state.routes = routes.results;
14802
14845
  store.state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
@@ -14810,10 +14853,12 @@ const GrwTreksProvider = class {
14810
14853
  store.state.treks = treks.results;
14811
14854
  store.state.currentTreks = treks.results;
14812
14855
  store.state.treksWithinBounds = treks.results;
14813
- });
14856
+ })
14857
+ .catch(() => (store.state.treksNetworkError = true));
14814
14858
  }
14815
14859
  disconnectedCallback() {
14816
14860
  this.controller.abort();
14861
+ store.state.treksNetworkError = false;
14817
14862
  }
14818
14863
  render() {
14819
14864
  return index.h(index.Host, null);
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-c2c4531d.js');
6
- const store = require('./store-fd04a216.js');
5
+ const index = require('./index-4c76daa3.js');
6
+ const store = require('./store-b4c3c507.js');
7
7
 
8
8
  const grwInformationDeskDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-sub-container{display:flex;flex-direction:column}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.information-desk-description{font-size:16px}";
9
9
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-c2c4531d.js');
6
- const store = require('./store-fd04a216.js');
5
+ const index = require('./index-4c76daa3.js');
6
+ const store = require('./store-b4c3c507.js');
7
7
  const length = require('./length-d315d156.js');
8
8
 
9
9
  const grwTrekCardCss = ".trek-card-container,.trek-card-large-view-container{font-family:\"Roboto\";border-radius:8px;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25);cursor:pointer}.trek-card-container .image,.trek-card-large-view-container .image{object-fit:cover}.trek-card-container .sub-container,.trek-card-large-view-container .sub-container{display:flex;flex-direction:column;justify-content:center;padding:12px}.trek-card-container .sub-container .name,.trek-card-large-view-container .sub-container .name{color:var(--color-primary);font-size:24px;font-weight:bold;margin-bottom:8px}.trek-card-container .sub-container .departure,.trek-card-large-view-container .sub-container .departure{color:rgba(0, 0, 0, 0.7);font-size:16px;margin:4px 0px}.trek-card-container .sub-container .themes-container,.trek-card-large-view-container .sub-container .themes-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .themes-container .theme,.trek-card-large-view-container .sub-container .themes-container .theme{background-color:var(--color-primary-tint);color:#ffffff;border-radius:8px;padding:8px;margin:0px 8px 8px 0px}.trek-card-container .sub-container .icons-labels-container,.trek-card-large-view-container .sub-container .icons-labels-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .icons-labels-container .row,.trek-card-large-view-container .sub-container .icons-labels-container .row{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-card-container .sub-container .icons-labels-container .row:not(:last-child),.trek-card-large-view-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:12px}.trek-card-container .sub-container .icons-labels-container .row .icon-label,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label{display:flex;align-items:center;width:50%}.trek-card-container .sub-container .icons-labels-container .row .icon-label:nth-child(2),.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label:nth-child(2){margin:0px 4px}.trek-card-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg{width:24px;height:auto;margin-right:8px}.trek-card-container .sub-container .icons-labels-container .row .practice img,.trek-card-large-view-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}.trek-card-container{width:350px;height:auto}.trek-card-container .image{width:100%}.trek-card-large-view-container{height:auto;display:flex;flex-direction:row}.trek-card-large-view-container .image{width:250px}";
@@ -16,7 +16,7 @@ const GrwTrekCard = class {
16
16
  this.colorPrimaryTint = '#974c6e';
17
17
  this.isLargeView = false;
18
18
  }
19
- componentWillLoad() {
19
+ connectedCallback() {
20
20
  this.currentTrek = this.trek ? this.trek : store.state.currentTrek;
21
21
  if (this.currentTrek) {
22
22
  this.difficulty = store.state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
@@ -681,9 +681,6 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
681
681
  hostRef.$queuedListeners$ = null;
682
682
  }
683
683
  }
684
- {
685
- promise = safeCall(instance, 'componentWillLoad');
686
- }
687
684
  }
688
685
  endSchedule();
689
686
  return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
@@ -1061,6 +1058,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1061
1058
  hostRef.$flags$ |= 128 /* isWatchReady */;
1062
1059
  }
1063
1060
  endNewInstance();
1061
+ fireConnectedCallback(hostRef.$lazyInstance$);
1064
1062
  }
1065
1063
  if (Cstr.style) {
1066
1064
  // this component has styles but we haven't registered them yet
@@ -1089,6 +1087,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1089
1087
  schedule();
1090
1088
  }
1091
1089
  };
1090
+ const fireConnectedCallback = (instance) => {
1091
+ {
1092
+ safeCall(instance, 'connectedCallback');
1093
+ }
1094
+ };
1092
1095
  const connectedCallback = (elm) => {
1093
1096
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1094
1097
  const hostRef = getHostRef(elm);
@@ -1132,6 +1135,8 @@ const connectedCallback = (elm) => {
1132
1135
  // reattach any event listeners to the host
1133
1136
  // since they would have been removed when disconnected
1134
1137
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1138
+ // fire off connectedCallback() on component instance
1139
+ fireConnectedCallback(hostRef.$lazyInstance$);
1135
1140
  }
1136
1141
  endConnected();
1137
1142
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-c2c4531d.js');
5
+ const index = require('./index-4c76daa3.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["grw-trek-card.cjs",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3.cjs",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6.cjs",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app.cjs",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[8],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
17
+ return index.bootstrapLazy([["grw-trek-card.cjs",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3.cjs",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6.cjs",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app.cjs",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[2],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-c2c4531d.js');
3
+ const index = require('./index-4c76daa3.js');
4
4
 
5
5
  const appendToMap = (map, propName, value) => {
6
6
  const items = map.get(propName);
@@ -188,9 +188,9 @@ const createStore = (defaultState, shouldUpdate) => {
188
188
 
189
189
  const { state, onChange } = createStore({
190
190
  api: '',
191
- treks: [],
192
- currentTreks: [],
193
- treksWithinBounds: [],
191
+ treks: null,
192
+ currentTreks: null,
193
+ treksWithinBounds: null,
194
194
  currentMapTreksBounds: null,
195
195
  difficulties: [],
196
196
  routes: [],
@@ -205,6 +205,8 @@ const { state, onChange } = createStore({
205
205
  currentTrek: null,
206
206
  currentPois: null,
207
207
  currentInformationDesks: null,
208
+ treksNetworkError: false,
209
+ trekNetworkError: false,
208
210
  });
209
211
 
210
212
  exports.onChange = onChange;