@geotrekce/geotrek-rando-widget 0.0.5 → 0.0.8

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 (62) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/grw-app.cjs.entry.js +38 -11
  3. package/dist/cjs/grw-filter_6.cjs.entry.js +141 -71
  4. package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +3 -3
  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-972b8d2a.js → store-b4c3c507.js} +7 -3
  9. package/dist/collection/components/grw-app/grw-app.css +17 -11
  10. package/dist/collection/components/grw-app/grw-app.js +45 -15
  11. package/dist/collection/components/grw-filter/grw-filter.js +11 -12
  12. package/dist/collection/components/grw-map/grw-map.js +41 -22
  13. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +1 -0
  14. package/dist/collection/components/grw-trek-card/grw-trek-card.js +1 -1
  15. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +6 -0
  16. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +21 -5
  17. package/dist/collection/components/grw-treks-list/grw-treks-list.css +0 -12
  18. package/dist/collection/components/grw-treks-list/grw-treks-list.js +21 -9
  19. package/dist/collection/store/grw-trek-provider.js +28 -15
  20. package/dist/collection/store/grw-treks-provider.js +17 -8
  21. package/dist/collection/store/store.js +6 -2
  22. package/dist/components/grw-app.js +38 -11
  23. package/dist/components/grw-filter2.js +11 -12
  24. package/dist/components/grw-map2.js +41 -22
  25. package/dist/components/grw-sensitive-area-detail2.js +1 -1
  26. package/dist/components/grw-trek-card2.js +1 -1
  27. package/dist/components/grw-trek-detail2.js +20 -4
  28. package/dist/components/grw-trek-provider2.js +28 -15
  29. package/dist/components/grw-treks-list2.js +23 -9
  30. package/dist/components/grw-treks-provider2.js +17 -8
  31. package/dist/components/store.js +6 -2
  32. package/dist/esm/geotrek-rando-widget.js +2 -2
  33. package/dist/esm/grw-app.entry.js +38 -11
  34. package/dist/esm/grw-filter_6.entry.js +141 -71
  35. package/dist/esm/grw-information-desk-detail_3.entry.js +3 -3
  36. package/dist/esm/grw-trek-card.entry.js +3 -3
  37. package/dist/esm/{index-192d910f.js → index-ee473772.js} +8 -3
  38. package/dist/esm/loader.js +2 -2
  39. package/dist/esm/{store-5a42b5d8.js → store-a5f523fd.js} +7 -3
  40. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  41. package/dist/geotrek-rando-widget/{p-d3aa9819.entry.js → p-0510e16b.entry.js} +1 -1
  42. package/dist/geotrek-rando-widget/p-22562f4d.js +1 -0
  43. package/dist/geotrek-rando-widget/{p-2d9ae918.entry.js → p-500436f1.entry.js} +1 -1
  44. package/dist/geotrek-rando-widget/p-94f0db4d.entry.js +1 -0
  45. package/dist/geotrek-rando-widget/p-9a25f817.entry.js +1 -0
  46. package/dist/geotrek-rando-widget/p-b62909db.js +2 -0
  47. package/dist/types/components/grw-app/grw-app.d.ts +3 -3
  48. package/dist/types/components/grw-filter/grw-filter.d.ts +1 -1
  49. package/dist/types/components/grw-map/grw-map.d.ts +3 -2
  50. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +1 -1
  51. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +1 -1
  52. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +3 -2
  53. package/dist/types/components.d.ts +2 -2
  54. package/dist/types/store/grw-trek-provider.d.ts +4 -1
  55. package/dist/types/store/grw-treks-provider.d.ts +4 -1
  56. package/dist/types/store/store.d.ts +9 -0
  57. package/package.json +1 -1
  58. package/readme.md +4 -0
  59. package/dist/geotrek-rando-widget/p-206a52d9.entry.js +0 -1
  60. package/dist/geotrek-rando-widget/p-6dce5e6c.js +0 -2
  61. package/dist/geotrek-rando-widget/p-8cfa03c0.entry.js +0 -1
  62. package/dist/geotrek-rando-widget/p-e63213a9.js +0 -1
@@ -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-972b8d2a.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
 
@@ -31,7 +31,7 @@ const GrwPoiDetail = class {
31
31
  };
32
32
  GrwPoiDetail.style = grwPoiDetailCss;
33
33
 
34
- const grwSensitiveAreaDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.sensitive-area-title{color:var(--color-primary);font-size:24px;padding:12px 0px}.sensitive-area-description{font-size:16px}.sensitive-area-period-container .sensitive-area-period-title,.sensitive-area-period-container .sensitive-area-practice-title,.sensitive-area-period-container .sensitive-area-contact-title,.sensitive-area-practice-container .sensitive-area-period-title,.sensitive-area-practice-container .sensitive-area-practice-title,.sensitive-area-practice-container .sensitive-area-contact-title,.sensitive-area-contact-container .sensitive-area-period-title,.sensitive-area-contact-container .sensitive-area-practice-title,.sensitive-area-contact-container .sensitive-area-contact-title{color:var(--color-primary);font-size:24px;padding:12px 0px}.sensitive-area-period-container .sensitive-area-period-values,.sensitive-area-period-container .sensitive-area-practice-values,.sensitive-area-practice-container .sensitive-area-period-values,.sensitive-area-practice-container .sensitive-area-practice-values,.sensitive-area-contact-container .sensitive-area-period-values,.sensitive-area-contact-container .sensitive-area-practice-values{display:flex}";
34
+ const grwSensitiveAreaDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.sensitive-area-title{color:var(--color-primary);font-size:24px;padding:12px 0px;font-weight:bold}.sensitive-area-description{font-size:16px}.sensitive-area-period-container .sensitive-area-period-title,.sensitive-area-period-container .sensitive-area-practice-title,.sensitive-area-period-container .sensitive-area-contact-title,.sensitive-area-practice-container .sensitive-area-period-title,.sensitive-area-practice-container .sensitive-area-practice-title,.sensitive-area-practice-container .sensitive-area-contact-title,.sensitive-area-contact-container .sensitive-area-period-title,.sensitive-area-contact-container .sensitive-area-practice-title,.sensitive-area-contact-container .sensitive-area-contact-title{color:var(--color-primary);font-size:24px;padding:12px 0px}.sensitive-area-period-container .sensitive-area-period-values,.sensitive-area-period-container .sensitive-area-practice-values,.sensitive-area-practice-container .sensitive-area-period-values,.sensitive-area-practice-container .sensitive-area-practice-values,.sensitive-area-contact-container .sensitive-area-period-values,.sensitive-area-contact-container .sensitive-area-practice-values{display:flex}";
35
35
 
36
36
  const GrwSensitiveAreaDetail = class {
37
37
  constructor(hostRef) {
@@ -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-972b8d2a.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,8 +188,10 @@ const createStore = (defaultState, shouldUpdate) => {
188
188
 
189
189
  const { state, onChange } = createStore({
190
190
  api: '',
191
- treks: [],
192
- currentTreks: [],
191
+ treks: null,
192
+ currentTreks: null,
193
+ treksWithinBounds: null,
194
+ currentMapTreksBounds: null,
193
195
  difficulties: [],
194
196
  routes: [],
195
197
  practices: [],
@@ -203,6 +205,8 @@ const { state, onChange } = createStore({
203
205
  currentTrek: null,
204
206
  currentPois: null,
205
207
  currentInformationDesks: null,
208
+ treksNetworkError: false,
209
+ trekNetworkError: false,
206
210
  });
207
211
 
208
212
  exports.onChange = onChange;
@@ -8,6 +8,7 @@
8
8
  .header-container,
9
9
  .large-view-header-container {
10
10
  display: flex;
11
+ flex-direction: row;
11
12
  align-items: center;
12
13
  background-color: var(--color-primary);
13
14
  height: 64px;
@@ -24,16 +25,26 @@
24
25
  width: 48px;
25
26
  height: auto;
26
27
  }
27
- .header-container .handle-filters-button,
28
- .large-view-header-container .handle-filters-button {
28
+ .header-container .handle-filters-container,
29
+ .large-view-header-container .handle-filters-container {
30
+ display: flex;
31
+ align-items: center;
32
+ }
33
+ .header-container .handle-filters-container .handle-filters-button,
34
+ .large-view-header-container .handle-filters-container .handle-filters-button {
29
35
  user-select: none;
30
36
  cursor: pointer;
31
37
  color: var(--color-primary);
32
38
  background-color: #ffffff;
33
- margin-left: 36px;
39
+ margin-left: 12px;
34
40
  border-radius: 8px;
35
41
  padding: 8px;
36
42
  }
43
+ .header-container .handle-filters-container .current-treks-within-bounds-length,
44
+ .large-view-header-container .handle-filters-container .current-treks-within-bounds-length {
45
+ margin-left: 12px;
46
+ color: #ffffff;
47
+ }
37
48
  .header-container .attribution-container,
38
49
  .large-view-header-container .attribution-container {
39
50
  position: absolute;
@@ -78,12 +89,6 @@
78
89
  .filters-container .filter-margin-top {
79
90
  margin-top: 24px;
80
91
  }
81
- .filters-container .current-treks-length {
82
- margin: 0px 0px 32px 8px;
83
- color: var(--color-primary);
84
- font-size: 24px;
85
- font-weight: bold;
86
- }
87
92
 
88
93
  .back-filters-container {
89
94
  background-color: rgba(0, 0, 0, 0.5);
@@ -94,6 +99,7 @@
94
99
  top: 64px;
95
100
  }
96
101
 
102
+ .init-loader-container,
97
103
  .loader-container,
98
104
  .large-view-loader-container {
99
105
  display: flex;
@@ -101,6 +107,7 @@
101
107
  align-items: center;
102
108
  height: 100%;
103
109
  }
110
+ .init-loader-container .loader,
104
111
  .loader-container .loader,
105
112
  .large-view-loader-container .loader {
106
113
  width: 48px;
@@ -164,8 +171,8 @@
164
171
  font-size: 24px;
165
172
  }
166
173
 
174
+ .init-loader-container,
167
175
  .loader-container {
168
- position: absolute;
169
176
  width: 100%;
170
177
  }
171
178
 
@@ -185,7 +192,6 @@
185
192
  }
186
193
 
187
194
  .large-view-loader-container {
188
- position: relative;
189
195
  width: 50%;
190
196
  }
191
197
 
@@ -1,5 +1,5 @@
1
1
  import { Component, Host, h, Listen, State, Prop, Element, Watch } from '@stencil/core';
2
- import state from 'store/store';
2
+ import state, { onChange } from 'store/store';
3
3
  import arrowBackImage from '../../assets/arrow-back.svg';
4
4
  export class GrwApp {
5
5
  constructor() {
@@ -17,8 +17,8 @@ export class GrwApp {
17
17
  this.colorArrivalIcon = '#85003b';
18
18
  this.colorSensitiveArea = '#4974a5';
19
19
  this.colorPoiIcon = '#974c6e';
20
- this.handlePopStateBind = this.handlePopState.bind(this);
21
20
  this.largeViewSize = 1024;
21
+ this.handlePopStateBind = this.handlePopState.bind(this);
22
22
  }
23
23
  onTrekCardPress(event) {
24
24
  this.currentTrekId = event.detail;
@@ -34,11 +34,26 @@ export class GrwApp {
34
34
  window.dispatchEvent(new window.Event('resize'));
35
35
  }
36
36
  componentDidLoad() {
37
+ onChange('trekNetworkError', () => {
38
+ if (state.trekNetworkError) {
39
+ const urlRedirect = new URL(window.location.toString());
40
+ urlRedirect.searchParams.delete('trek');
41
+ window.history.replaceState({}, '', urlRedirect);
42
+ this.onTrekDetailsClose();
43
+ }
44
+ });
37
45
  this.handleView();
38
46
  window.addEventListener('popstate', this.handlePopStateBind, false);
47
+ const url = new URL(window.location.toString());
48
+ const trekParam = url.searchParams.get('trek');
49
+ if (trekParam) {
50
+ window.history.replaceState({ isInitialHistoryWithTrek: true }, '', url);
51
+ this.currentTrekId = Number(trekParam);
52
+ this.showTrek = !this.showTrek;
53
+ }
39
54
  }
40
55
  onTrekDetailsClose() {
41
- this.forwardTrekId = this.currentTrekId;
56
+ state.currentTrek = null;
42
57
  this.currentTrekId = null;
43
58
  this.showTrek = !this.showTrek;
44
59
  }
@@ -50,15 +65,27 @@ export class GrwApp {
50
65
  handleFilters() {
51
66
  this.showFilters = !this.showFilters;
52
67
  }
53
- handlePopState() {
54
- if (this.showTrek) {
68
+ handleBackButton() {
69
+ if (window.history.state.isInitialHistoryWithTrek) {
55
70
  this.onTrekDetailsClose();
71
+ const url = new URL(window.location.toString());
72
+ url.searchParams.delete('trek');
73
+ window.history.pushState({}, '', url);
74
+ }
75
+ else {
76
+ window.history.back();
56
77
  }
57
- else if (this.forwardTrekId) {
58
- this.currentTrekId = this.forwardTrekId;
59
- this.forwardTrekId = null;
78
+ }
79
+ handlePopState() {
80
+ const url = new URL(window.location.toString());
81
+ const trekParam = url.searchParams.get('trek');
82
+ if (trekParam) {
83
+ this.currentTrekId = Number(trekParam);
60
84
  this.showTrek = !this.showTrek;
61
85
  }
86
+ else {
87
+ this.onTrekDetailsClose();
88
+ }
62
89
  }
63
90
  handleShowMap() {
64
91
  if (this.currentTrekId) {
@@ -74,13 +101,16 @@ export class GrwApp {
74
101
  render() {
75
102
  return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } },
76
103
  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 }),
104
+ !state.currentTreks && !state.currentTrek && (h("div", { class: "init-loader-container" },
105
+ h("span", { class: "loader" }))),
77
106
  this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }),
78
- h("div", { class: "app-container" },
107
+ (state.currentTreks || state.currentTrek) && (h("div", { class: "app-container" },
79
108
  h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' },
80
- this.showTrek ? (h("div", { onClick: () => window.history.back(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")),
109
+ this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { class: "handle-filters-container" },
110
+ h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER"),
111
+ state.treksWithinBounds && (h("div", { class: "current-treks-within-bounds-length" }, `${state.treksWithinBounds.length} randonnée${state.treksWithinBounds.length > 1 ? 's' : ''}`)))),
81
112
  !this.showTrek && this.showFilters && (h("div", { class: "options-container" },
82
113
  h("div", { class: "filters-container" },
83
- h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`),
84
114
  h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"),
85
115
  h("div", null,
86
116
  h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })),
@@ -100,7 +130,7 @@ export class GrwApp {
100
130
  h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))),
101
131
  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 })),
102
132
  h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } },
103
- h("div", { onClick: () => this.handleShowMap() }, this.showTreksMap || this.showTrekMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
133
+ h("div", { onClick: () => this.handleShowMap() }, this.showTrek ? (this.showTrekMap ? 'Voir la fiche' : 'Voir la carte') : this.showTreksMap ? 'Voir la liste' : 'Voir la carte'))))));
104
134
  }
105
135
  static get is() { return "grw-app"; }
106
136
  static get encapsulation() { return "shadow"; }
@@ -317,11 +347,11 @@ export class GrwApp {
317
347
  "reflect": false
318
348
  },
319
349
  "zoom": {
320
- "type": "any",
350
+ "type": "number",
321
351
  "mutable": false,
322
352
  "complexType": {
323
- "original": "any",
324
- "resolved": "any",
353
+ "original": "number",
354
+ "resolved": "number",
325
355
  "references": {}
326
356
  },
327
357
  "required": false,
@@ -23,18 +23,17 @@ export class GrwFilter {
23
23
  filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
24
24
  }
25
25
  else if (filter.type === 'interval') {
26
- let minValue;
27
- let maxValue;
28
- for (const currentFilterId of currentFiltersId) {
29
- const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
30
- if (isNaN(minValue) || currentFilter.minValue < minValue) {
31
- minValue = currentFilter.minValue;
32
- }
33
- if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
34
- maxValue = currentFilter.maxValue;
35
- }
36
- }
37
- filtersTreks = [...filtersTreks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
26
+ filtersTreks = [
27
+ ...filtersTreks.filter(trek => {
28
+ for (const currentFilterId of currentFiltersId) {
29
+ const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
30
+ if (trek[filter.trekProperty] >= currentFilter.minValue && trek[filter.trekProperty] <= currentFilter.maxValue) {
31
+ return true;
32
+ }
33
+ }
34
+ return false;
35
+ }),
36
+ ];
38
37
  }
39
38
  }
40
39
  else {
@@ -14,8 +14,9 @@ export class GrwMap {
14
14
  this.colorArrivalIcon = '#85003b';
15
15
  this.colorSensitiveArea = ' #4974a5';
16
16
  this.colorPoiIcon = '#974c6e';
17
+ this.handleTreksWithinBoundsBind = this.handleTreksWithinBounds.bind(this);
17
18
  }
18
- componentDidLoad() {
19
+ connectedCallback() {
19
20
  this.map = L.map(this.element, {
20
21
  center: this.center.split(',').map(Number),
21
22
  zoom: this.zoom,
@@ -28,7 +29,7 @@ export class GrwMap {
28
29
  if (state.currentTrek) {
29
30
  this.addTrek();
30
31
  }
31
- else if (state.currentTrek) {
32
+ else if (state.currentTreks) {
32
33
  this.addTreks();
33
34
  }
34
35
  onChange('currentTreks', () => {
@@ -57,29 +58,35 @@ export class GrwMap {
57
58
  type: 'FeatureCollection',
58
59
  features: [],
59
60
  };
60
- for (const trek of state.currentTreks) {
61
- trekscurrentDepartureCoordinates.push(trek.departure_geom);
62
- treksFeatureCollection.features.push({
63
- type: 'Feature',
64
- geometry: { type: 'Point', coordinates: trek.departure_geom },
65
- properties: {
66
- id: trek.id,
67
- name: trek.name,
68
- practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
69
- imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
70
- },
71
- });
72
- }
73
- if (trekscurrentDepartureCoordinates.length > 0) {
74
- const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
75
- this.currentBounds = bounds;
76
- this.map.fitBounds(this.currentBounds);
61
+ if (state.currentTreks) {
62
+ for (const trek of state.currentTreks) {
63
+ trekscurrentDepartureCoordinates.push(trek.departure_geom);
64
+ treksFeatureCollection.features.push({
65
+ type: 'Feature',
66
+ geometry: { type: 'Point', coordinates: trek.departure_geom },
67
+ properties: {
68
+ id: trek.id,
69
+ name: trek.name,
70
+ practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
71
+ imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
72
+ },
73
+ });
74
+ }
77
75
  }
78
76
  if (!this.treksLayer) {
77
+ if (trekscurrentDepartureCoordinates.length > 0 && !state.currentMapTreksBounds) {
78
+ const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
79
+ this.map.fitBounds(bounds);
80
+ }
81
+ else {
82
+ if (state.currentMapTreksBounds) {
83
+ this.map.fitBounds(state.currentMapTreksBounds);
84
+ }
85
+ }
79
86
  this.treksLayer = L.geoJSON(treksFeatureCollection, {
80
87
  pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
81
88
  icon: L.divIcon({
82
- html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
89
+ html: geoJsonPoint.properties.practice ? `<img src=${geoJsonPoint.properties.practice} />` : `<img />`,
83
90
  className: 'trek-marker',
84
91
  iconSize: 48,
85
92
  }),
@@ -106,17 +113,30 @@ export class GrwMap {
106
113
  }).addTo(this.map);
107
114
  }
108
115
  else {
116
+ if (trekscurrentDepartureCoordinates.length > 0) {
117
+ const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
118
+ this.map.fitBounds(bounds);
119
+ }
120
+ else {
121
+ this.map.fire('moveend');
122
+ }
109
123
  this.treksLayer.clearLayers();
110
124
  this.treksLayer.addData(treksFeatureCollection);
111
125
  }
112
126
  !this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
127
+ this.map.on('moveend', this.handleTreksWithinBoundsBind);
113
128
  }
114
129
  removeTreks() {
115
130
  if (this.treksLayer) {
131
+ state.currentMapTreksBounds = this.map.getBounds();
116
132
  this.map.removeLayer(this.treksLayer);
117
133
  this.treksLayer = null;
134
+ this.map.off('moveend', this.handleTreksWithinBoundsBind);
118
135
  }
119
136
  }
137
+ handleTreksWithinBounds() {
138
+ state.treksWithinBounds = state.currentTreks.filter(trek => this.map.getBounds().contains(L.latLng(trek.departure_geom[1], trek.departure_geom[0])));
139
+ }
120
140
  addTrek() {
121
141
  const currentTrekFeature = {
122
142
  type: 'Feature',
@@ -130,8 +150,7 @@ export class GrwMap {
130
150
  interactive: false,
131
151
  }).addTo(this.map);
132
152
  const bounds = L.latLngBounds(state.currentTrek.geometry.coordinates.map(coordinate => [coordinate[1], coordinate[0]]));
133
- this.currentBounds = bounds;
134
- this.map.fitBounds(this.currentBounds);
153
+ this.map.fitBounds(bounds);
135
154
  const currentDepartureCoordinates = [state.currentTrek.geometry.coordinates.at(0)[0], state.currentTrek.geometry.coordinates.at(0)[1]];
136
155
  const currentArrivalCoordinates = [state.currentTrek.geometry.coordinates.at(-1)[0], state.currentTrek.geometry.coordinates.at(-1)[1]];
137
156
  const currentDepartureArrivalFeatureCollection = {
@@ -10,6 +10,7 @@
10
10
  color: var(--color-primary);
11
11
  font-size: 24px;
12
12
  padding: 12px 0px;
13
+ font-weight: bold;
13
14
  }
14
15
 
15
16
  .sensitive-area-description {
@@ -10,7 +10,7 @@ export class GrwTrekCard {
10
10
  this.colorPrimaryTint = '#974c6e';
11
11
  this.isLargeView = false;
12
12
  }
13
- componentWillLoad() {
13
+ connectedCallback() {
14
14
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
15
15
  if (this.currentTrek) {
16
16
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
@@ -1,3 +1,9 @@
1
+ grw-sensitive-area-detail,
2
+ grw-information-desk-detail,
3
+ grw-poi-detail {
4
+ margin-top: 12px;
5
+ }
6
+
1
7
  .trek-detail-container {
2
8
  font-family: "Roboto";
3
9
  display: flex;
@@ -10,7 +10,7 @@ export class GrwTrekDetail {
10
10
  this.colorPrimaryShade = '#4a0021';
11
11
  this.colorPrimaryTint = '#974c6e';
12
12
  }
13
- componentWillLoad() {
13
+ connectedCallback() {
14
14
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
15
15
  if (this.currentTrek) {
16
16
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
@@ -20,7 +20,9 @@ export class GrwTrekDetail {
20
20
  this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
21
21
  this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
22
22
  this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
23
- this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
23
+ if (state.accessibilitiesLevel) {
24
+ this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
25
+ }
24
26
  }
25
27
  onChange('currentTrek', () => {
26
28
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -31,6 +33,10 @@ export class GrwTrekDetail {
31
33
  this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
32
34
  this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
33
35
  this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
36
+ this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
37
+ if (state.accessibilitiesLevel) {
38
+ this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
39
+ }
34
40
  }
35
41
  });
36
42
  }
@@ -81,7 +87,9 @@ export class GrwTrekDetail {
81
87
  h("div", { innerHTML: this.currentTrek.arrival }))),
82
88
  this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" },
83
89
  h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"),
84
- h("img", { src: this.currentTrek.altimetric_profile }))),
90
+ h("img", { src: this.currentTrek.altimetric_profile.endsWith('.json')
91
+ ? this.currentTrek.altimetric_profile.replace('.json', '.svg')
92
+ : `${this.currentTrek.altimetric_profile}?format=svg` }))),
85
93
  this.currentTrek.access && (h("div", { class: "access-container" },
86
94
  h("div", { class: "access-title" }, "Acc\u00E8s routier"),
87
95
  h("div", { class: "access", innerHTML: this.currentTrek.access }))),
@@ -108,7 +116,15 @@ export class GrwTrekDetail {
108
116
  state.currentInformationDesks && state.currentInformationDesks.length > 0 && (h("div", { class: "information-desks-container" },
109
117
  h("div", { class: "information-desks-title" }, "Lieux de renseignement"),
110
118
  state.currentInformationDesks.map(informationDesk => (h("grw-information-desk-detail", { informationDesk: informationDesk }))))),
111
- h("div", { class: "accessibilities-container" },
119
+ (this.currentTrek.disabled_infrastructure ||
120
+ (this.accessibilities && this.accessibilities.length > 0) ||
121
+ this.currentTrek.accessibility_level ||
122
+ this.currentTrek.accessibility_slope ||
123
+ this.currentTrek.accessibility_width ||
124
+ this.currentTrek.accessibility_signage ||
125
+ this.currentTrek.accessibility_covering ||
126
+ this.currentTrek.accessibility_exposure ||
127
+ this.currentTrek.accessibility_advice) && (h("div", { class: "accessibilities-container" },
112
128
  h("div", { class: "accessibilities-title" }, "Accessibilit\u00E9"),
113
129
  this.currentTrek.disabled_infrastructure && h("div", { innerHTML: this.currentTrek.disabled_infrastructure }),
114
130
  h("div", { class: "accessibilities-content-container" }, this.accessibilities.map(accessibility => (h("div", { class: "accessibility-content-container" },
@@ -134,7 +150,7 @@ export class GrwTrekDetail {
134
150
  h("div", { innerHTML: this.currentTrek.accessibility_exposure }))),
135
151
  this.currentTrek.accessibility_advice && (h("div", { class: "accessibility-advice-container" },
136
152
  h("div", { class: "accessibility-advice-title" }, "Conseils"),
137
- h("div", { innerHTML: this.currentTrek.accessibility_advice })))),
153
+ h("div", { innerHTML: this.currentTrek.accessibility_advice }))))),
138
154
  state.currentPois && state.currentPois.length > 0 && (h("div", { class: "pois-container" },
139
155
  h("div", { class: "pois-title" }, "Points d'int\u00E9r\u00EAts"),
140
156
  state.currentPois.map(poi => (h("grw-poi-detail", { poi: poi }))))),
@@ -4,18 +4,6 @@
4
4
  height: 100%;
5
5
  max-height: 100vh;
6
6
  overflow-y: auto;
7
- }
8
-
9
- .current-treks-length {
10
- width: 100%;
11
- text-align: center;
12
- padding: 32px 0px;
13
- color: var(--color-primary);
14
- font-size: 24px;
15
- font-weight: bold;
16
- }
17
-
18
- .current-treks-container {
19
7
  display: flex;
20
8
  flex-wrap: wrap;
21
9
  justify-content: space-around;