@geotrekce/geotrek-rando-widget 0.0.3 → 0.0.4

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 (51) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/{grw-app_10.cjs.entry.js → grw-app_11.cjs.entry.js} +172 -58
  3. package/dist/cjs/{index-c6f73e30.js → index-c2c4531d.js} +46 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -0
  6. package/dist/collection/components/grw-app/grw-app.css +69 -5
  7. package/dist/collection/components/grw-app/grw-app.js +24 -5
  8. package/dist/collection/components/grw-filter/grw-filter.css +29 -0
  9. package/dist/collection/components/grw-filter/grw-filter.js +132 -0
  10. package/dist/collection/components/grw-map/grw-map.js +37 -31
  11. package/dist/collection/components/grw-trek-card/grw-trek-card.css +66 -32
  12. package/dist/collection/components/grw-trek-card/grw-trek-card.js +34 -10
  13. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +1 -1
  14. package/dist/collection/components/grw-treks-list/grw-treks-list.css +16 -3
  15. package/dist/collection/components/grw-treks-list/grw-treks-list.js +27 -5
  16. package/dist/collection/store/grw-trek-provider.js +24 -10
  17. package/dist/collection/store/grw-treks-provider.js +12 -3
  18. package/dist/collection/store/store.js +3 -0
  19. package/dist/collection/stories/App.js +8 -10
  20. package/dist/collection/stories/App.stories.js +4 -3
  21. package/dist/collection/stories/TrekMap.stories.js +3 -2
  22. package/dist/collection/stories/TreksList.js +8 -8
  23. package/dist/collection/stories/TreksMap.stories.js +3 -2
  24. package/dist/components/grw-app.js +15 -4
  25. package/dist/components/grw-filter.d.ts +11 -0
  26. package/dist/components/grw-filter.js +6 -0
  27. package/dist/components/grw-filter2.js +95 -0
  28. package/dist/components/grw-map2.js +37 -31
  29. package/dist/components/grw-trek-card2.js +10 -5
  30. package/dist/components/grw-trek-provider2.js +24 -10
  31. package/dist/components/grw-treks-list2.js +9 -6
  32. package/dist/components/grw-treks-provider2.js +12 -3
  33. package/dist/components/store.js +3 -0
  34. package/dist/esm/geotrek-rando-widget.js +2 -2
  35. package/dist/esm/{grw-app_10.entry.js → grw-app_11.entry.js} +172 -59
  36. package/dist/esm/{index-7aa9e822.js → index-fe16e7b6.js} +46 -1
  37. package/dist/esm/loader.js +2 -2
  38. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  39. package/dist/geotrek-rando-widget/p-8c206aec.js +2 -0
  40. package/dist/geotrek-rando-widget/p-ed8706fb.entry.js +1 -0
  41. package/dist/types/components/grw-app/grw-app.d.ts +2 -0
  42. package/dist/types/components/grw-filter/grw-filter.d.ts +9 -0
  43. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +6 -4
  44. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +1 -0
  45. package/dist/types/components.d.ts +23 -0
  46. package/dist/types/store/store.d.ts +7 -1
  47. package/dist/types/types/types.d.ts +23 -0
  48. package/package.json +1 -1
  49. package/readme.md +4 -5
  50. package/dist/geotrek-rando-widget/p-332ba9ab.js +0 -2
  51. package/dist/geotrek-rando-widget/p-73bc92fe.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-c6f73e30.js');
3
+ const index = require('./index-c2c4531d.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-app_10.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],"appName":[1,"app-name"],"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],"showMap":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"treksToDisplay":[32]}],[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]}],[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}],[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}]]]], options);
18
+ return index.bootstrapLazy([["grw-app_11.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],"appName":[1,"app-name"],"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],"showMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[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]}],[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}],[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]}]]]], options);
19
19
  });
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-c6f73e30.js');
5
+ const index = require('./index-c2c4531d.js');
6
6
 
7
7
  const appendToMap = (map, propName, value) => {
8
8
  const items = map.get(propName);
@@ -191,9 +191,12 @@ const createStore = (defaultState, shouldUpdate) => {
191
191
  const { state, onChange } = createStore({
192
192
  api: '',
193
193
  treks: [],
194
+ currentTreks: [],
194
195
  difficulties: [],
195
196
  routes: [],
196
197
  practices: [],
198
+ themes: [],
199
+ durations: [],
197
200
  currentSensitiveAreas: null,
198
201
  currentPois: null,
199
202
  currentTrek: null,
@@ -202,13 +205,14 @@ const { state, onChange } = createStore({
202
205
 
203
206
  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>`;
204
207
 
205
- 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 .title,.large-view-header-container .title{color:#ffffff;margin-left:24px}.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}.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%}";
208
+ 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%}";
206
209
 
207
210
  const GrwApp = class {
208
211
  constructor(hostRef) {
209
212
  index.registerInstance(this, hostRef);
210
213
  this.showTrek = false;
211
214
  this.showMap = false;
215
+ this.showFilters = false;
212
216
  this.isLargeView = false;
213
217
  this.language = 'fr';
214
218
  this.appName = 'Geotrek Rando Widget';
@@ -220,7 +224,7 @@ const GrwApp = class {
220
224
  this.colorArrivalIcon = '#85003b';
221
225
  this.colorSensitiveArea = '#4974a5';
222
226
  this.colorPoiIcon = '#974c6e';
223
- this.largeViewSize = 664;
227
+ this.largeViewSize = 1024;
224
228
  }
225
229
  onTrekCardPress(event) {
226
230
  this.currentTrekId = event.detail;
@@ -243,8 +247,11 @@ const GrwApp = class {
243
247
  this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
244
248
  this.showMap = this.isLargeView;
245
249
  }
250
+ handleFilters() {
251
+ this.showFilters = !this.showFilters;
252
+ }
246
253
  render() {
247
- return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, 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: 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.onTrekDetailsClose(), class: "arrow-back-icon", innerHTML: arrowBackImage }) : index.h("div", { class: "title" }, this.appName)), 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", { "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !state.currentTrek && (index.h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, index.h("span", { class: "loader" }))), 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.showMap ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "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.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
254
+ 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: 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.onTrekDetailsClose(), 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" }, `${state.currentTreks.length} résultat${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 && !state.currentTrek && (index.h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, index.h("span", { class: "loader" }))), 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.showMap ? '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.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
248
255
  }
249
256
  get element() { return index.getElement(this); }
250
257
  static get watchers() { return {
@@ -253,6 +260,78 @@ const GrwApp = class {
253
260
  };
254
261
  GrwApp.style = grwAppCss;
255
262
 
263
+ 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)}";
264
+
265
+ const GrwFilter = class {
266
+ constructor(hostRef) {
267
+ index.registerInstance(this, hostRef);
268
+ this.filters = [
269
+ { property: 'practices', trekProperty: 'practice', type: 'include' },
270
+ { property: 'difficulties', trekProperty: 'difficulty', type: 'include' },
271
+ { property: 'durations', trekProperty: 'duration', type: 'interval' },
272
+ ];
273
+ }
274
+ handleFilter(_event, filterToHandle) {
275
+ const filterFromState = [...state[this.filterType]];
276
+ filterFromState.find(currentFilter => currentFilter.id === filterToHandle.id).selected = !filterFromState.find(currentFilter => currentFilter.id === filterToHandle.id)
277
+ .selected;
278
+ state[this.filterType] = filterFromState;
279
+ let isUsingFilter = false;
280
+ let filtersTreks = [];
281
+ for (const filter of this.filters) {
282
+ const currentFiltersId = state[filter.property].filter(currentFilter => currentFilter.selected).map(currentFilter => currentFilter.id);
283
+ if (currentFiltersId.length > 0) {
284
+ if (filtersTreks.length > 0) {
285
+ if (filter.type === 'include') {
286
+ filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
287
+ }
288
+ else if (filter.type === 'interval') {
289
+ let minValue;
290
+ let maxValue;
291
+ for (const currentFilterId of currentFiltersId) {
292
+ const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
293
+ if (isNaN(minValue) || currentFilter.minValue < minValue) {
294
+ minValue = currentFilter.minValue;
295
+ }
296
+ if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
297
+ maxValue = currentFilter.maxValue;
298
+ }
299
+ }
300
+ filtersTreks = [...filtersTreks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
301
+ }
302
+ }
303
+ else {
304
+ if (!isUsingFilter) {
305
+ isUsingFilter = true;
306
+ }
307
+ if (filter.type === 'include') {
308
+ filtersTreks = [...state.treks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
309
+ }
310
+ else if (filter.type === 'interval') {
311
+ let minValue;
312
+ let maxValue;
313
+ for (const currentFilterId of currentFiltersId) {
314
+ const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
315
+ if (isNaN(minValue) || currentFilter.minValue < minValue) {
316
+ minValue = currentFilter.minValue;
317
+ }
318
+ if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
319
+ maxValue = currentFilter.maxValue;
320
+ }
321
+ }
322
+ filtersTreks = [...state.treks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
323
+ }
324
+ }
325
+ }
326
+ }
327
+ state.currentTreks = isUsingFilter ? filtersTreks : state.treks;
328
+ }
329
+ render() {
330
+ return (index.h(index.Host, null, index.h("div", { class: "filter-name" }, this.filterName), index.h("div", { class: "filter-button-container" }, state[this.filterType].map(currentFilter => (index.h("div", { onClick: event => this.handleFilter(event, currentFilter), class: currentFilter.selected ? 'selected-filter-button' : 'filter-button' }, currentFilter[this.filterNameProperty]))))));
331
+ }
332
+ };
333
+ GrwFilter.style = grwFilterCss;
334
+
256
335
  const grwInformationDeskDetailCss = ":host{display:flex;flex-direction:column;padding:0px 8px 8px 8px}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-right-container{display:flex;flex-direction:column;padding:8px}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:0px 0px 8px 0px}.information-desk-description{font-size:16px}";
257
336
 
258
337
  const GrwInformationDeskDetail = class {
@@ -14441,11 +14520,11 @@ const GrwMap = class {
14441
14520
  else if (state.currentTrek) {
14442
14521
  this.addTreks();
14443
14522
  }
14444
- onChange('treks', () => {
14523
+ onChange('currentTreks', () => {
14445
14524
  if (state.currentTrek) {
14446
14525
  this.addTrek();
14447
14526
  }
14448
- else if (state.treks) {
14527
+ else if (state.currentTreks) {
14449
14528
  this.addTreks();
14450
14529
  }
14451
14530
  });
@@ -14467,7 +14546,7 @@ const GrwMap = class {
14467
14546
  type: 'FeatureCollection',
14468
14547
  features: [],
14469
14548
  };
14470
- for (const trek of state.treks) {
14549
+ for (const trek of state.currentTreks) {
14471
14550
  trekscurrentDepartureCoordinates.push(trek.departure_geom);
14472
14551
  treksFeatureCollection.features.push({
14473
14552
  type: 'Feature',
@@ -14476,7 +14555,7 @@ const GrwMap = class {
14476
14555
  id: trek.id,
14477
14556
  name: trek.name,
14478
14557
  practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
14479
- imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].url,
14558
+ imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
14480
14559
  },
14481
14560
  });
14482
14561
  }
@@ -14485,34 +14564,40 @@ const GrwMap = class {
14485
14564
  this.currentBounds = bounds;
14486
14565
  this.map.fitBounds(this.currentBounds);
14487
14566
  }
14488
- this.treksLayer = leafletSrc.geoJSON(treksFeatureCollection, {
14489
- pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
14490
- icon: leafletSrc.divIcon({
14491
- html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
14492
- className: 'trek-marker',
14493
- iconSize: 48,
14567
+ if (!this.treksLayer) {
14568
+ this.treksLayer = leafletSrc.geoJSON(treksFeatureCollection, {
14569
+ pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
14570
+ icon: leafletSrc.divIcon({
14571
+ html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
14572
+ className: 'trek-marker',
14573
+ iconSize: 48,
14574
+ }),
14575
+ autoPanOnFocus: false,
14494
14576
  }),
14495
- autoPanOnFocus: false,
14496
- }),
14497
- onEachFeature: (geoJsonPoint, layer) => {
14498
- layer.once('click', () => {
14499
- const trekDeparturePopup = leafletSrc.DomUtil.create('div');
14500
- trekDeparturePopup.className = 'trek-departure-popup';
14501
- trekDeparturePopup.onclick = () => this.trekCardPress.emit(geoJsonPoint.properties.id);
14502
- const trekName = leafletSrc.DomUtil.create('div');
14503
- trekName.innerHTML = geoJsonPoint.properties.name;
14504
- trekName.className = 'trek-name';
14505
- if (geoJsonPoint.properties.imgSrc) {
14506
- trekName.className += ' trek-name-margin-top';
14507
- const trekImg = leafletSrc.DomUtil.create('img');
14508
- trekImg.src = geoJsonPoint.properties.imgSrc;
14509
- trekDeparturePopup.appendChild(trekImg);
14510
- }
14511
- trekDeparturePopup.appendChild(trekName);
14512
- layer.bindPopup(trekDeparturePopup, { interactive: true, autoPan: false, closeButton: false }).openPopup();
14513
- });
14514
- },
14515
- }).addTo(this.map);
14577
+ onEachFeature: (geoJsonPoint, layer) => {
14578
+ layer.once('click', () => {
14579
+ const trekDeparturePopup = leafletSrc.DomUtil.create('div');
14580
+ trekDeparturePopup.className = 'trek-departure-popup';
14581
+ trekDeparturePopup.onclick = () => this.trekCardPress.emit(geoJsonPoint.properties.id);
14582
+ const trekName = leafletSrc.DomUtil.create('div');
14583
+ trekName.innerHTML = geoJsonPoint.properties.name;
14584
+ trekName.className = 'trek-name';
14585
+ if (geoJsonPoint.properties.imgSrc) {
14586
+ trekName.className += ' trek-name-margin-top';
14587
+ const trekImg = leafletSrc.DomUtil.create('img');
14588
+ trekImg.src = geoJsonPoint.properties.imgSrc;
14589
+ trekDeparturePopup.appendChild(trekImg);
14590
+ }
14591
+ trekDeparturePopup.appendChild(trekName);
14592
+ layer.bindPopup(trekDeparturePopup, { interactive: true, autoPan: false, closeButton: false }).openPopup();
14593
+ });
14594
+ },
14595
+ }).addTo(this.map);
14596
+ }
14597
+ else {
14598
+ this.treksLayer.clearLayers();
14599
+ this.treksLayer.addData(treksFeatureCollection);
14600
+ }
14516
14601
  !this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
14517
14602
  }
14518
14603
  removeTreks() {
@@ -14785,7 +14870,7 @@ const durationImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" heigh
14785
14870
 
14786
14871
  const lengthImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><polyline points="304 96 416 96 416 208" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><line x1="405.77" y1="106.2" x2="111.98" y2="400.02" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><polyline points="208 416 96 416 96 304" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>`;
14787
14872
 
14788
- const grwTrekCardCss = ".trek-card-container{font-family:\"Roboto\";width:350px;height:auto;border-radius:8px;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25);cursor:pointer}.trek-card-container .image{border-radius:8px 8px 0px 0px;width:100%;height:auto;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25)}.trek-card-container .sub-container{padding:12px}.trek-card-container .sub-container .name{color:var(--color-primary);font-size:24px;font-weight:bold;margin-bottom:12px}.trek-card-container .sub-container .description{max-height:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:12px}.trek-card-container .sub-container .description p{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0}.trek-card-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{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-card-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:12px}.trek-card-container .sub-container .icons-labels-container .row .icon-label{display:flex;justify-content:center;align-items:center;width:33.3333333333%}.trek-card-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{width:24px;height:auto;margin-right:24px}.trek-card-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}";
14873
+ 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}";
14789
14874
 
14790
14875
  const GrwTrekCard = class {
14791
14876
  constructor(hostRef) {
@@ -14793,6 +14878,7 @@ const GrwTrekCard = class {
14793
14878
  this.trekCardPress = index.createEvent(this, "trekCardPress", 7);
14794
14879
  this.colorPrimary = '#6b0030';
14795
14880
  this.colorPrimaryTint = '#974c6e';
14881
+ this.isLargeView = false;
14796
14882
  }
14797
14883
  componentWillLoad() {
14798
14884
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -14800,6 +14886,7 @@ const GrwTrekCard = class {
14800
14886
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
14801
14887
  this.route = state.routes.find(route => route.id === this.currentTrek.route);
14802
14888
  this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
14889
+ this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
14803
14890
  }
14804
14891
  onChange('currentTrek', () => {
14805
14892
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -14807,14 +14894,15 @@ const GrwTrekCard = class {
14807
14894
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
14808
14895
  this.route = state.routes.find(route => route.id === this.currentTrek.route);
14809
14896
  this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
14897
+ this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
14810
14898
  }
14811
14899
  });
14812
14900
  }
14813
14901
  render() {
14814
14902
  var _a, _b, _c, _d, _e, _f, _g, _h;
14815
- return (index.h(index.Host, { onClick: () => this.trekCardPress.emit(this.currentTrek.id), style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (index.h("div", { class: "trek-card-container" }, 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: "name" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.name), index.h("div", { class: "description", innerHTML: (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.description_teaser }), index.h("div", { class: "icons-labels-container" }, index.h("div", { class: "row" }, index.h("div", { class: "icon-label difficulty" }, ((_c = this.difficulty) === null || _c === void 0 ? void 0 : _c.pictogram) && index.h("img", { src: this.difficulty.pictogram }), (_d = this.difficulty) === null || _d === void 0 ? void 0 :
14816
- _d.label), index.h("div", { class: "icon-label duration" }, index.h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration(this.currentTrek.duration)), index.h("div", { class: "icon-label route" }, ((_e = this.route) === null || _e === void 0 ? void 0 : _e.pictogram) && index.h("img", { src: this.route.pictogram }), (_f = this.route) === null || _f === void 0 ? void 0 :
14817
- _f.route)), index.h("div", { class: "row" }, index.h("div", { class: "icon-label length" }, index.h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), index.h("div", { class: "icon-label ascent" }, index.h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent)), index.h("div", { class: "icon-label practice" }, ((_g = this.practice) === null || _g === void 0 ? void 0 : _g.pictogram) && index.h("img", { src: this.practice.pictogram }), (_h = this.practice) === null || _h === void 0 ? void 0 :
14903
+ return (index.h(index.Host, { onClick: () => this.trekCardPress.emit(this.currentTrek.id), style: { 'width': this.isLargeView ? '100%' : 'auto', '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (index.h("div", { class: this.isLargeView ? 'trek-card-large-view-container' : 'trek-card-container' }, 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: "departure" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.departure), index.h("div", { class: "name" }, (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.name), index.h("div", { class: "themes-container" }, this.themes.map(theme => (index.h("div", { class: "theme" }, theme.label)))), index.h("div", { class: "icons-labels-container" }, index.h("div", { class: "row" }, index.h("div", { class: "icon-label difficulty" }, ((_c = this.difficulty) === null || _c === void 0 ? void 0 : _c.pictogram) && index.h("img", { src: this.difficulty.pictogram }), (_d = this.difficulty) === null || _d === void 0 ? void 0 :
14904
+ _d.label), index.h("div", { class: "icon-label duration" }, index.h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration(this.currentTrek.duration))), index.h("div", { class: "row" }, index.h("div", { class: "icon-label length" }, index.h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), index.h("div", { class: "icon-label ascent" }, index.h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent))), index.h("div", { class: "row" }, index.h("div", { class: "icon-label route" }, ((_e = this.route) === null || _e === void 0 ? void 0 : _e.pictogram) && index.h("img", { src: this.route.pictogram }), (_f = this.route) === null || _f === void 0 ? void 0 :
14905
+ _f.route), index.h("div", { class: "icon-label practice" }, ((_g = this.practice) === null || _g === void 0 ? void 0 : _g.pictogram) && index.h("img", { src: this.practice.pictogram }), (_h = this.practice) === null || _h === void 0 ? void 0 :
14818
14906
  _h.name))))))));
14819
14907
  }
14820
14908
  };
@@ -14862,21 +14950,35 @@ const GrwTrekProvider = class {
14862
14950
  }
14863
14951
  componentWillLoad() {
14864
14952
  state.api = this.api;
14953
+ const requests = [];
14954
+ requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
14955
+ requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`) : new Response('null'));
14956
+ requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`) : new Response('null'));
14957
+ requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
14865
14958
  return Promise.all([
14866
- fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
14867
- fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
14868
- fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
14869
- fetch(`${this.api}sensitivearea/?language=${this.language}&trek=${this.trekId}&fields=id,geometry,name,description`).catch(() => new Response('[]')),
14959
+ ...requests,
14960
+ fetch(`${this.api}sensitivearea/?language=${this.language}&trek=${this.trekId}&fields=id,geometry,name,description`).catch(() => new Response('null')),
14870
14961
  fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`),
14871
14962
  fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`),
14872
- fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,route,geometry,gpx,kml,pdf,parking_location`),
14963
+ fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure`),
14873
14964
  ])
14874
14965
  .then(responses => Promise.all(responses.map(response => response.json())))
14875
- .then(([difficulties, routes, practices, sensitiveAreas, pois, informationDesks, trek]) => {
14876
- state.difficulties = difficulties.results;
14877
- state.routes = routes.results;
14878
- state.practices = practices.results;
14879
- state.currentSensitiveAreas = sensitiveAreas.results;
14966
+ .then(([difficulties, routes, practices, themes, sensitiveAreas, pois, informationDesks, trek]) => {
14967
+ if (difficulties) {
14968
+ state.difficulties = difficulties.results;
14969
+ }
14970
+ if (routes) {
14971
+ state.routes = routes.results;
14972
+ }
14973
+ if (practices) {
14974
+ state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
14975
+ }
14976
+ if (themes) {
14977
+ state.themes = themes.results;
14978
+ }
14979
+ if (sensitiveAreas) {
14980
+ state.currentSensitiveAreas = sensitiveAreas.results;
14981
+ }
14880
14982
  state.currentPois = pois.results;
14881
14983
  state.currentInformationDesks = informationDesks.results;
14882
14984
  state.currentTrek = trek;
@@ -14890,7 +14992,7 @@ const GrwTrekProvider = class {
14890
14992
  }
14891
14993
  };
14892
14994
 
14893
- const grwTreksListCss = ":host{font-family:\"Roboto\";display:flex;flex-wrap:wrap;justify-content:space-around;height:100%;max-height:100vh;overflow-y:auto}grw-trek-card{margin:6px}";
14995
+ 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}";
14894
14996
 
14895
14997
  const GrwTreksList = class {
14896
14998
  constructor(hostRef) {
@@ -14898,19 +15000,21 @@ const GrwTreksList = class {
14898
15000
  this.treksToDisplay = [];
14899
15001
  this.colorPrimary = '#6b0030';
14900
15002
  this.colorPrimaryTint = '#974c6e';
15003
+ this.isLargeView = false;
14901
15004
  this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
14902
15005
  this.step = 10;
14903
15006
  }
14904
15007
  componentWillLoad() {
14905
- this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14906
- onChange('treks', () => {
14907
- this.treksToDisplay = state.treks.slice(0, this.step);
15008
+ onChange('currentTreks', () => {
15009
+ this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
15010
+ this.element.scroll({ top: 0 });
15011
+ this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
14908
15012
  });
14909
15013
  }
14910
15014
  handleInfiniteScroll(event) {
14911
15015
  if (event.composedPath()[0].scrollTop + event.composedPath()[0].scrollHeight / 2 >= event.composedPath()[0].scrollHeight) {
14912
15016
  if (this.treksToDisplay.length < state.treks.length) {
14913
- this.treksToDisplay = state.treks.slice(0, this.treksToDisplay.length + this.step >= state.treks.length ? state.treks.length : this.treksToDisplay.length + this.step);
15017
+ this.treksToDisplay = state.currentTreks.slice(0, this.treksToDisplay.length + this.step >= state.currentTreks.length ? state.currentTreks.length : this.treksToDisplay.length + this.step);
14914
15018
  }
14915
15019
  else {
14916
15020
  this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
@@ -14918,7 +15022,7 @@ const GrwTreksList = class {
14918
15022
  }
14919
15023
  }
14920
15024
  render() {
14921
- return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.treksToDisplay.map(trek => (index.h("grw-trek-card", { trek: trek, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })))));
15025
+ return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, index.h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.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 }))))));
14922
15026
  }
14923
15027
  get element() { return index.getElement(this); }
14924
15028
  };
@@ -14940,19 +15044,28 @@ const GrwTreksProvider = class {
14940
15044
  this.portals && (treksRequest += `&portals=${this.portals}`);
14941
15045
  this.routes && (treksRequest += `&routes=${this.routes}`);
14942
15046
  this.practices && (treksRequest += `&practices=${this.practices}`);
14943
- treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,route,departure_geom&page_size=999`;
15047
+ treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
14944
15048
  return Promise.all([
14945
15049
  fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
14946
15050
  fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
14947
15051
  fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
15052
+ fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`),
14948
15053
  fetch(treksRequest),
14949
15054
  ])
14950
15055
  .then(responses => Promise.all(responses.map(response => response.json())))
14951
- .then(([difficulties, routes, practices, treks]) => {
15056
+ .then(([difficulties, routes, practices, themes, treks]) => {
14952
15057
  state.difficulties = difficulties.results;
14953
15058
  state.routes = routes.results;
14954
- state.practices = practices.results;
15059
+ state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
15060
+ state.themes = themes.results;
15061
+ state.durations = [
15062
+ { id: 1, name: '0 - 1h', minValue: 0, maxValue: 1, selected: false },
15063
+ { id: 2, name: '1 - 2h', minValue: 1, maxValue: 2, selected: false },
15064
+ { id: 3, name: '2 - 5h', minValue: 2, maxValue: 5, selected: false },
15065
+ { id: 4, name: '5 - 10h', minValue: 5, maxValue: 10, selected: false },
15066
+ ];
14955
15067
  state.treks = treks.results;
15068
+ state.currentTreks = treks.results;
14956
15069
  });
14957
15070
  }
14958
15071
  render() {
@@ -14961,6 +15074,7 @@ const GrwTreksProvider = class {
14961
15074
  };
14962
15075
 
14963
15076
  exports.grw_app = GrwApp;
15077
+ exports.grw_filter = GrwFilter;
14964
15078
  exports.grw_information_desk_detail = GrwInformationDeskDetail;
14965
15079
  exports.grw_map = GrwMap;
14966
15080
  exports.grw_poi_detail = GrwPoiDetail;
@@ -189,6 +189,7 @@ const isComplexType = (o) => {
189
189
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
190
190
  const h = (nodeName, vnodeData, ...children) => {
191
191
  let child = null;
192
+ let key = null;
192
193
  let simple = false;
193
194
  let lastSimple = false;
194
195
  const vNodeChildren = [];
@@ -216,6 +217,10 @@ const h = (nodeName, vnodeData, ...children) => {
216
217
  };
217
218
  walk(children);
218
219
  if (vnodeData) {
220
+ // normalize class / classname attributes
221
+ if (vnodeData.key) {
222
+ key = vnodeData.key;
223
+ }
219
224
  {
220
225
  const classData = vnodeData.className || vnodeData.class;
221
226
  if (classData) {
@@ -233,6 +238,9 @@ const h = (nodeName, vnodeData, ...children) => {
233
238
  if (vNodeChildren.length > 0) {
234
239
  vnode.$children$ = vNodeChildren;
235
240
  }
241
+ {
242
+ vnode.$key$ = key;
243
+ }
236
244
  return vnode;
237
245
  };
238
246
  const newVNode = (tag, text) => {
@@ -246,6 +254,9 @@ const newVNode = (tag, text) => {
246
254
  {
247
255
  vnode.$attrs$ = null;
248
256
  }
257
+ {
258
+ vnode.$key$ = null;
259
+ }
249
260
  return vnode;
250
261
  };
251
262
  const Host = {};
@@ -294,6 +305,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
294
305
  }
295
306
  }
296
307
  }
308
+ else if (memberName === 'key')
309
+ ;
297
310
  else if ((!isProp ) &&
298
311
  memberName[0] === 'o' &&
299
312
  memberName[1] === 'n') {
@@ -458,6 +471,8 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
458
471
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
459
472
  let oldStartIdx = 0;
460
473
  let newStartIdx = 0;
474
+ let idxInOld = 0;
475
+ let i = 0;
461
476
  let oldEndIdx = oldCh.length - 1;
462
477
  let oldStartVnode = oldCh[0];
463
478
  let oldEndVnode = oldCh[oldEndIdx];
@@ -465,6 +480,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
465
480
  let newStartVnode = newCh[0];
466
481
  let newEndVnode = newCh[newEndIdx];
467
482
  let node;
483
+ let elmToMove;
468
484
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
469
485
  if (oldStartVnode == null) {
470
486
  // Vnode might have been moved left
@@ -502,7 +518,29 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
502
518
  newStartVnode = newCh[++newStartIdx];
503
519
  }
504
520
  else {
521
+ // createKeyToOldIdx
522
+ idxInOld = -1;
505
523
  {
524
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
525
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
526
+ idxInOld = i;
527
+ break;
528
+ }
529
+ }
530
+ }
531
+ if (idxInOld >= 0) {
532
+ elmToMove = oldCh[idxInOld];
533
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
534
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
535
+ }
536
+ else {
537
+ patch(elmToMove, newStartVnode);
538
+ oldCh[idxInOld] = undefined;
539
+ node = elmToMove.$elm$;
540
+ }
541
+ newStartVnode = newCh[++newStartIdx];
542
+ }
543
+ else {
506
544
  // new element
507
545
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
508
546
  newStartVnode = newCh[++newStartIdx];
@@ -525,7 +563,9 @@ const isSameVnode = (vnode1, vnode2) => {
525
563
  // compare if two vnode to see if they're "technically" the same
526
564
  // need to have the same element tag, and same key to be the same
527
565
  if (vnode1.$tag$ === vnode2.$tag$) {
528
- return true;
566
+ {
567
+ return vnode1.$key$ === vnode2.$key$;
568
+ }
529
569
  }
530
570
  return false;
531
571
  };
@@ -815,6 +855,11 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
815
855
  const parsePropertyValue = (propValue, propType) => {
816
856
  // ensure this value is of the correct prop type
817
857
  if (propValue != null && !isComplexType(propValue)) {
858
+ if (propType & 4 /* Boolean */) {
859
+ // per the HTML spec, any string value means it is a boolean true value
860
+ // but we'll cheat here and say that the string "false" is the boolean false
861
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
862
+ }
818
863
  if (propType & 2 /* Number */) {
819
864
  // force it to be a number
820
865
  return parseFloat(propValue);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-c6f73e30.js');
5
+ const index = require('./index-c2c4531d.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-app_10.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],"appName":[1,"app-name"],"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],"showMap":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"treksToDisplay":[32]}],[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]}],[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}],[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}]]]], options);
17
+ return index.bootstrapLazy([["grw-app_11.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],"appName":[1,"app-name"],"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],"showMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[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]}],[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}],[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]}]]]], options);
18
18
  });
19
19
  };
20
20