@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,4 +1,4 @@
1
- import { g as getRenderingRef, f as forceUpdate, r as registerInstance, h, H as Host, a as getElement, c as createEvent } from './index-7aa9e822.js';
1
+ import { g as getRenderingRef, f as forceUpdate, r as registerInstance, h, H as Host, a as getElement, c as createEvent } from './index-fe16e7b6.js';
2
2
 
3
3
  const appendToMap = (map, propName, value) => {
4
4
  const items = map.get(propName);
@@ -187,9 +187,12 @@ const createStore = (defaultState, shouldUpdate) => {
187
187
  const { state, onChange } = createStore({
188
188
  api: '',
189
189
  treks: [],
190
+ currentTreks: [],
190
191
  difficulties: [],
191
192
  routes: [],
192
193
  practices: [],
194
+ themes: [],
195
+ durations: [],
193
196
  currentSensitiveAreas: null,
194
197
  currentPois: null,
195
198
  currentTrek: null,
@@ -198,13 +201,14 @@ const { state, onChange } = createStore({
198
201
 
199
202
  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>`;
200
203
 
201
- 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%}";
204
+ 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%}";
202
205
 
203
206
  const GrwApp = class {
204
207
  constructor(hostRef) {
205
208
  registerInstance(this, hostRef);
206
209
  this.showTrek = false;
207
210
  this.showMap = false;
211
+ this.showFilters = false;
208
212
  this.isLargeView = false;
209
213
  this.language = 'fr';
210
214
  this.appName = 'Geotrek Rando Widget';
@@ -216,7 +220,7 @@ const GrwApp = class {
216
220
  this.colorArrivalIcon = '#85003b';
217
221
  this.colorSensitiveArea = '#4974a5';
218
222
  this.colorPoiIcon = '#974c6e';
219
- this.largeViewSize = 664;
223
+ this.largeViewSize = 1024;
220
224
  }
221
225
  onTrekCardPress(event) {
222
226
  this.currentTrekId = event.detail;
@@ -239,8 +243,11 @@ const GrwApp = class {
239
243
  this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
240
244
  this.showMap = this.isLargeView;
241
245
  }
246
+ handleFilters() {
247
+ this.showFilters = !this.showFilters;
248
+ }
242
249
  render() {
243
- return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, 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 && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }), h("div", { class: "app-container" }, h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? h("div", { onClick: () => this.onTrekDetailsClose(), class: "arrow-back-icon", innerHTML: arrowBackImage }) : h("div", { class: "title" }, this.appName)), h("div", { class: "content-container" }, 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' } }, h("grw-treks-list", { "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, h("span", { class: "loader" }))), state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), 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 })), h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, h("div", { onClick: () => (this.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
250
+ return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } }, 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 && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }), h("div", { class: "app-container" }, h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? (h("div", { onClick: () => this.onTrekDetailsClose(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")), !this.showTrek && this.showFilters && (h("div", { class: "options-container" }, h("div", { class: "filters-container" }, h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`), h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"), h("div", null, h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })), h("div", { class: "filter-margin-top" }, h("grw-filter", { filterName: "Difficult\u00E9", filterType: "difficulties", filterNameProperty: "label" })), h("div", { class: "filter-margin-top" }, h("grw-filter", { filterName: "Dur\u00E9e", filterType: "durations", filterNameProperty: "name" }))), h("div", { onClick: () => this.handleFilters(), class: "back-filters-container" }))), h("div", { class: "attribution-container" }, h("a", { target: "_blank", href: "https://geotrek.fr" }, "GEOTREK"))), h("div", { class: "content-container" }, 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' } }, h("grw-treks-list", { "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, h("span", { class: "loader" }))), state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), 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 })), h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, h("div", { onClick: () => (this.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
244
251
  }
245
252
  get element() { return getElement(this); }
246
253
  static get watchers() { return {
@@ -249,6 +256,78 @@ const GrwApp = class {
249
256
  };
250
257
  GrwApp.style = grwAppCss;
251
258
 
259
+ 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)}";
260
+
261
+ const GrwFilter = class {
262
+ constructor(hostRef) {
263
+ registerInstance(this, hostRef);
264
+ this.filters = [
265
+ { property: 'practices', trekProperty: 'practice', type: 'include' },
266
+ { property: 'difficulties', trekProperty: 'difficulty', type: 'include' },
267
+ { property: 'durations', trekProperty: 'duration', type: 'interval' },
268
+ ];
269
+ }
270
+ handleFilter(_event, filterToHandle) {
271
+ const filterFromState = [...state[this.filterType]];
272
+ filterFromState.find(currentFilter => currentFilter.id === filterToHandle.id).selected = !filterFromState.find(currentFilter => currentFilter.id === filterToHandle.id)
273
+ .selected;
274
+ state[this.filterType] = filterFromState;
275
+ let isUsingFilter = false;
276
+ let filtersTreks = [];
277
+ for (const filter of this.filters) {
278
+ const currentFiltersId = state[filter.property].filter(currentFilter => currentFilter.selected).map(currentFilter => currentFilter.id);
279
+ if (currentFiltersId.length > 0) {
280
+ if (filtersTreks.length > 0) {
281
+ if (filter.type === 'include') {
282
+ filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
283
+ }
284
+ else if (filter.type === 'interval') {
285
+ let minValue;
286
+ let maxValue;
287
+ for (const currentFilterId of currentFiltersId) {
288
+ const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
289
+ if (isNaN(minValue) || currentFilter.minValue < minValue) {
290
+ minValue = currentFilter.minValue;
291
+ }
292
+ if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
293
+ maxValue = currentFilter.maxValue;
294
+ }
295
+ }
296
+ filtersTreks = [...filtersTreks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
297
+ }
298
+ }
299
+ else {
300
+ if (!isUsingFilter) {
301
+ isUsingFilter = true;
302
+ }
303
+ if (filter.type === 'include') {
304
+ filtersTreks = [...state.treks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
305
+ }
306
+ else if (filter.type === 'interval') {
307
+ let minValue;
308
+ let maxValue;
309
+ for (const currentFilterId of currentFiltersId) {
310
+ const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
311
+ if (isNaN(minValue) || currentFilter.minValue < minValue) {
312
+ minValue = currentFilter.minValue;
313
+ }
314
+ if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
315
+ maxValue = currentFilter.maxValue;
316
+ }
317
+ }
318
+ filtersTreks = [...state.treks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
319
+ }
320
+ }
321
+ }
322
+ }
323
+ state.currentTreks = isUsingFilter ? filtersTreks : state.treks;
324
+ }
325
+ render() {
326
+ return (h(Host, null, h("div", { class: "filter-name" }, this.filterName), h("div", { class: "filter-button-container" }, state[this.filterType].map(currentFilter => (h("div", { onClick: event => this.handleFilter(event, currentFilter), class: currentFilter.selected ? 'selected-filter-button' : 'filter-button' }, currentFilter[this.filterNameProperty]))))));
327
+ }
328
+ };
329
+ GrwFilter.style = grwFilterCss;
330
+
252
331
  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}";
253
332
 
254
333
  const GrwInformationDeskDetail = class {
@@ -14437,11 +14516,11 @@ const GrwMap = class {
14437
14516
  else if (state.currentTrek) {
14438
14517
  this.addTreks();
14439
14518
  }
14440
- onChange('treks', () => {
14519
+ onChange('currentTreks', () => {
14441
14520
  if (state.currentTrek) {
14442
14521
  this.addTrek();
14443
14522
  }
14444
- else if (state.treks) {
14523
+ else if (state.currentTreks) {
14445
14524
  this.addTreks();
14446
14525
  }
14447
14526
  });
@@ -14463,7 +14542,7 @@ const GrwMap = class {
14463
14542
  type: 'FeatureCollection',
14464
14543
  features: [],
14465
14544
  };
14466
- for (const trek of state.treks) {
14545
+ for (const trek of state.currentTreks) {
14467
14546
  trekscurrentDepartureCoordinates.push(trek.departure_geom);
14468
14547
  treksFeatureCollection.features.push({
14469
14548
  type: 'Feature',
@@ -14472,7 +14551,7 @@ const GrwMap = class {
14472
14551
  id: trek.id,
14473
14552
  name: trek.name,
14474
14553
  practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
14475
- imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].url,
14554
+ imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
14476
14555
  },
14477
14556
  });
14478
14557
  }
@@ -14481,34 +14560,40 @@ const GrwMap = class {
14481
14560
  this.currentBounds = bounds;
14482
14561
  this.map.fitBounds(this.currentBounds);
14483
14562
  }
14484
- this.treksLayer = leafletSrc.geoJSON(treksFeatureCollection, {
14485
- pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
14486
- icon: leafletSrc.divIcon({
14487
- html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
14488
- className: 'trek-marker',
14489
- iconSize: 48,
14563
+ if (!this.treksLayer) {
14564
+ this.treksLayer = leafletSrc.geoJSON(treksFeatureCollection, {
14565
+ pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
14566
+ icon: leafletSrc.divIcon({
14567
+ html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
14568
+ className: 'trek-marker',
14569
+ iconSize: 48,
14570
+ }),
14571
+ autoPanOnFocus: false,
14490
14572
  }),
14491
- autoPanOnFocus: false,
14492
- }),
14493
- onEachFeature: (geoJsonPoint, layer) => {
14494
- layer.once('click', () => {
14495
- const trekDeparturePopup = leafletSrc.DomUtil.create('div');
14496
- trekDeparturePopup.className = 'trek-departure-popup';
14497
- trekDeparturePopup.onclick = () => this.trekCardPress.emit(geoJsonPoint.properties.id);
14498
- const trekName = leafletSrc.DomUtil.create('div');
14499
- trekName.innerHTML = geoJsonPoint.properties.name;
14500
- trekName.className = 'trek-name';
14501
- if (geoJsonPoint.properties.imgSrc) {
14502
- trekName.className += ' trek-name-margin-top';
14503
- const trekImg = leafletSrc.DomUtil.create('img');
14504
- trekImg.src = geoJsonPoint.properties.imgSrc;
14505
- trekDeparturePopup.appendChild(trekImg);
14506
- }
14507
- trekDeparturePopup.appendChild(trekName);
14508
- layer.bindPopup(trekDeparturePopup, { interactive: true, autoPan: false, closeButton: false }).openPopup();
14509
- });
14510
- },
14511
- }).addTo(this.map);
14573
+ onEachFeature: (geoJsonPoint, layer) => {
14574
+ layer.once('click', () => {
14575
+ const trekDeparturePopup = leafletSrc.DomUtil.create('div');
14576
+ trekDeparturePopup.className = 'trek-departure-popup';
14577
+ trekDeparturePopup.onclick = () => this.trekCardPress.emit(geoJsonPoint.properties.id);
14578
+ const trekName = leafletSrc.DomUtil.create('div');
14579
+ trekName.innerHTML = geoJsonPoint.properties.name;
14580
+ trekName.className = 'trek-name';
14581
+ if (geoJsonPoint.properties.imgSrc) {
14582
+ trekName.className += ' trek-name-margin-top';
14583
+ const trekImg = leafletSrc.DomUtil.create('img');
14584
+ trekImg.src = geoJsonPoint.properties.imgSrc;
14585
+ trekDeparturePopup.appendChild(trekImg);
14586
+ }
14587
+ trekDeparturePopup.appendChild(trekName);
14588
+ layer.bindPopup(trekDeparturePopup, { interactive: true, autoPan: false, closeButton: false }).openPopup();
14589
+ });
14590
+ },
14591
+ }).addTo(this.map);
14592
+ }
14593
+ else {
14594
+ this.treksLayer.clearLayers();
14595
+ this.treksLayer.addData(treksFeatureCollection);
14596
+ }
14512
14597
  !this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
14513
14598
  }
14514
14599
  removeTreks() {
@@ -14781,7 +14866,7 @@ const durationImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" heigh
14781
14866
 
14782
14867
  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>`;
14783
14868
 
14784
- 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)}";
14869
+ 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}";
14785
14870
 
14786
14871
  const GrwTrekCard = class {
14787
14872
  constructor(hostRef) {
@@ -14789,6 +14874,7 @@ const GrwTrekCard = class {
14789
14874
  this.trekCardPress = createEvent(this, "trekCardPress", 7);
14790
14875
  this.colorPrimary = '#6b0030';
14791
14876
  this.colorPrimaryTint = '#974c6e';
14877
+ this.isLargeView = false;
14792
14878
  }
14793
14879
  componentWillLoad() {
14794
14880
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -14796,6 +14882,7 @@ const GrwTrekCard = class {
14796
14882
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
14797
14883
  this.route = state.routes.find(route => route.id === this.currentTrek.route);
14798
14884
  this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
14885
+ this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
14799
14886
  }
14800
14887
  onChange('currentTrek', () => {
14801
14888
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -14803,14 +14890,15 @@ const GrwTrekCard = class {
14803
14890
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
14804
14891
  this.route = state.routes.find(route => route.id === this.currentTrek.route);
14805
14892
  this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
14893
+ this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
14806
14894
  }
14807
14895
  });
14808
14896
  }
14809
14897
  render() {
14810
14898
  var _a, _b, _c, _d, _e, _f, _g, _h;
14811
- return (h(Host, { onClick: () => this.trekCardPress.emit(this.currentTrek.id), style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: "trek-card-container" }, this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (h("img", { class: "image", src: `${this.currentTrek.attachments[0].thumbnail}`, loading: "lazy" })), h("div", { class: "sub-container" }, h("div", { class: "name" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.name), h("div", { class: "description", innerHTML: (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.description_teaser }), h("div", { class: "icons-labels-container" }, h("div", { class: "row" }, h("div", { class: "icon-label difficulty" }, ((_c = this.difficulty) === null || _c === void 0 ? void 0 : _c.pictogram) && h("img", { src: this.difficulty.pictogram }), (_d = this.difficulty) === null || _d === void 0 ? void 0 :
14812
- _d.label), h("div", { class: "icon-label duration" }, h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration(this.currentTrek.duration)), h("div", { class: "icon-label route" }, ((_e = this.route) === null || _e === void 0 ? void 0 : _e.pictogram) && h("img", { src: this.route.pictogram }), (_f = this.route) === null || _f === void 0 ? void 0 :
14813
- _f.route)), h("div", { class: "row" }, h("div", { class: "icon-label length" }, h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), h("div", { class: "icon-label ascent" }, h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent)), h("div", { class: "icon-label practice" }, ((_g = this.practice) === null || _g === void 0 ? void 0 : _g.pictogram) && h("img", { src: this.practice.pictogram }), (_h = this.practice) === null || _h === void 0 ? void 0 :
14899
+ return (h(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 && (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 && (h("img", { class: "image", src: `${this.currentTrek.attachments[0].thumbnail}`, loading: "lazy" })), h("div", { class: "sub-container" }, h("div", { class: "departure" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.departure), h("div", { class: "name" }, (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.name), h("div", { class: "themes-container" }, this.themes.map(theme => (h("div", { class: "theme" }, theme.label)))), h("div", { class: "icons-labels-container" }, h("div", { class: "row" }, h("div", { class: "icon-label difficulty" }, ((_c = this.difficulty) === null || _c === void 0 ? void 0 : _c.pictogram) && h("img", { src: this.difficulty.pictogram }), (_d = this.difficulty) === null || _d === void 0 ? void 0 :
14900
+ _d.label), h("div", { class: "icon-label duration" }, h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration(this.currentTrek.duration))), h("div", { class: "row" }, h("div", { class: "icon-label length" }, h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), h("div", { class: "icon-label ascent" }, h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent))), h("div", { class: "row" }, h("div", { class: "icon-label route" }, ((_e = this.route) === null || _e === void 0 ? void 0 : _e.pictogram) && h("img", { src: this.route.pictogram }), (_f = this.route) === null || _f === void 0 ? void 0 :
14901
+ _f.route), h("div", { class: "icon-label practice" }, ((_g = this.practice) === null || _g === void 0 ? void 0 : _g.pictogram) && h("img", { src: this.practice.pictogram }), (_h = this.practice) === null || _h === void 0 ? void 0 :
14814
14902
  _h.name))))))));
14815
14903
  }
14816
14904
  };
@@ -14858,21 +14946,35 @@ const GrwTrekProvider = class {
14858
14946
  }
14859
14947
  componentWillLoad() {
14860
14948
  state.api = this.api;
14949
+ const requests = [];
14950
+ requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
14951
+ requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`) : new Response('null'));
14952
+ requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`) : new Response('null'));
14953
+ requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
14861
14954
  return Promise.all([
14862
- fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
14863
- fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
14864
- fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
14865
- fetch(`${this.api}sensitivearea/?language=${this.language}&trek=${this.trekId}&fields=id,geometry,name,description`).catch(() => new Response('[]')),
14955
+ ...requests,
14956
+ fetch(`${this.api}sensitivearea/?language=${this.language}&trek=${this.trekId}&fields=id,geometry,name,description`).catch(() => new Response('null')),
14866
14957
  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`),
14867
14958
  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`),
14868
- 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`),
14959
+ 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`),
14869
14960
  ])
14870
14961
  .then(responses => Promise.all(responses.map(response => response.json())))
14871
- .then(([difficulties, routes, practices, sensitiveAreas, pois, informationDesks, trek]) => {
14872
- state.difficulties = difficulties.results;
14873
- state.routes = routes.results;
14874
- state.practices = practices.results;
14875
- state.currentSensitiveAreas = sensitiveAreas.results;
14962
+ .then(([difficulties, routes, practices, themes, sensitiveAreas, pois, informationDesks, trek]) => {
14963
+ if (difficulties) {
14964
+ state.difficulties = difficulties.results;
14965
+ }
14966
+ if (routes) {
14967
+ state.routes = routes.results;
14968
+ }
14969
+ if (practices) {
14970
+ state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
14971
+ }
14972
+ if (themes) {
14973
+ state.themes = themes.results;
14974
+ }
14975
+ if (sensitiveAreas) {
14976
+ state.currentSensitiveAreas = sensitiveAreas.results;
14977
+ }
14876
14978
  state.currentPois = pois.results;
14877
14979
  state.currentInformationDesks = informationDesks.results;
14878
14980
  state.currentTrek = trek;
@@ -14886,7 +14988,7 @@ const GrwTrekProvider = class {
14886
14988
  }
14887
14989
  };
14888
14990
 
14889
- 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}";
14991
+ 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}";
14890
14992
 
14891
14993
  const GrwTreksList = class {
14892
14994
  constructor(hostRef) {
@@ -14894,19 +14996,21 @@ const GrwTreksList = class {
14894
14996
  this.treksToDisplay = [];
14895
14997
  this.colorPrimary = '#6b0030';
14896
14998
  this.colorPrimaryTint = '#974c6e';
14999
+ this.isLargeView = false;
14897
15000
  this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
14898
15001
  this.step = 10;
14899
15002
  }
14900
15003
  componentWillLoad() {
14901
- this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14902
- onChange('treks', () => {
14903
- this.treksToDisplay = state.treks.slice(0, this.step);
15004
+ onChange('currentTreks', () => {
15005
+ this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
15006
+ this.element.scroll({ top: 0 });
15007
+ this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
14904
15008
  });
14905
15009
  }
14906
15010
  handleInfiniteScroll(event) {
14907
15011
  if (event.composedPath()[0].scrollTop + event.composedPath()[0].scrollHeight / 2 >= event.composedPath()[0].scrollHeight) {
14908
15012
  if (this.treksToDisplay.length < state.treks.length) {
14909
- this.treksToDisplay = state.treks.slice(0, this.treksToDisplay.length + this.step >= state.treks.length ? state.treks.length : this.treksToDisplay.length + this.step);
15013
+ this.treksToDisplay = state.currentTreks.slice(0, this.treksToDisplay.length + this.step >= state.currentTreks.length ? state.currentTreks.length : this.treksToDisplay.length + this.step);
14910
15014
  }
14911
15015
  else {
14912
15016
  this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
@@ -14914,7 +15018,7 @@ const GrwTreksList = class {
14914
15018
  }
14915
15019
  }
14916
15020
  render() {
14917
- return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.treksToDisplay.map(trek => (h("grw-trek-card", { trek: trek, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })))));
15021
+ return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`), h("div", { class: "current-treks-container" }, this.treksToDisplay.map(trek => (h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint }))))));
14918
15022
  }
14919
15023
  get element() { return getElement(this); }
14920
15024
  };
@@ -14936,19 +15040,28 @@ const GrwTreksProvider = class {
14936
15040
  this.portals && (treksRequest += `&portals=${this.portals}`);
14937
15041
  this.routes && (treksRequest += `&routes=${this.routes}`);
14938
15042
  this.practices && (treksRequest += `&practices=${this.practices}`);
14939
- treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,route,departure_geom&page_size=999`;
15043
+ treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
14940
15044
  return Promise.all([
14941
15045
  fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
14942
15046
  fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
14943
15047
  fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
15048
+ fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`),
14944
15049
  fetch(treksRequest),
14945
15050
  ])
14946
15051
  .then(responses => Promise.all(responses.map(response => response.json())))
14947
- .then(([difficulties, routes, practices, treks]) => {
15052
+ .then(([difficulties, routes, practices, themes, treks]) => {
14948
15053
  state.difficulties = difficulties.results;
14949
15054
  state.routes = routes.results;
14950
- state.practices = practices.results;
15055
+ state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
15056
+ state.themes = themes.results;
15057
+ state.durations = [
15058
+ { id: 1, name: '0 - 1h', minValue: 0, maxValue: 1, selected: false },
15059
+ { id: 2, name: '1 - 2h', minValue: 1, maxValue: 2, selected: false },
15060
+ { id: 3, name: '2 - 5h', minValue: 2, maxValue: 5, selected: false },
15061
+ { id: 4, name: '5 - 10h', minValue: 5, maxValue: 10, selected: false },
15062
+ ];
14951
15063
  state.treks = treks.results;
15064
+ state.currentTreks = treks.results;
14952
15065
  });
14953
15066
  }
14954
15067
  render() {
@@ -14956,4 +15069,4 @@ const GrwTreksProvider = class {
14956
15069
  }
14957
15070
  };
14958
15071
 
14959
- export { GrwApp as grw_app, GrwInformationDeskDetail as grw_information_desk_detail, GrwMap as grw_map, GrwPoiDetail as grw_poi_detail, GrwSensitiveAreaDetail as grw_sensitive_area_detail, GrwTrekCard as grw_trek_card, GrwTrekDetail as grw_trek_detail, GrwTrekProvider as grw_trek_provider, GrwTreksList as grw_treks_list, GrwTreksProvider as grw_treks_provider };
15072
+ export { GrwApp as grw_app, GrwFilter as grw_filter, GrwInformationDeskDetail as grw_information_desk_detail, GrwMap as grw_map, GrwPoiDetail as grw_poi_detail, GrwSensitiveAreaDetail as grw_sensitive_area_detail, GrwTrekCard as grw_trek_card, GrwTrekDetail as grw_trek_detail, GrwTrekProvider as grw_trek_provider, GrwTreksList as grw_treks_list, GrwTreksProvider as grw_treks_provider };
@@ -167,6 +167,7 @@ const isComplexType = (o) => {
167
167
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
168
168
  const h = (nodeName, vnodeData, ...children) => {
169
169
  let child = null;
170
+ let key = null;
170
171
  let simple = false;
171
172
  let lastSimple = false;
172
173
  const vNodeChildren = [];
@@ -194,6 +195,10 @@ const h = (nodeName, vnodeData, ...children) => {
194
195
  };
195
196
  walk(children);
196
197
  if (vnodeData) {
198
+ // normalize class / classname attributes
199
+ if (vnodeData.key) {
200
+ key = vnodeData.key;
201
+ }
197
202
  {
198
203
  const classData = vnodeData.className || vnodeData.class;
199
204
  if (classData) {
@@ -211,6 +216,9 @@ const h = (nodeName, vnodeData, ...children) => {
211
216
  if (vNodeChildren.length > 0) {
212
217
  vnode.$children$ = vNodeChildren;
213
218
  }
219
+ {
220
+ vnode.$key$ = key;
221
+ }
214
222
  return vnode;
215
223
  };
216
224
  const newVNode = (tag, text) => {
@@ -224,6 +232,9 @@ const newVNode = (tag, text) => {
224
232
  {
225
233
  vnode.$attrs$ = null;
226
234
  }
235
+ {
236
+ vnode.$key$ = null;
237
+ }
227
238
  return vnode;
228
239
  };
229
240
  const Host = {};
@@ -272,6 +283,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
272
283
  }
273
284
  }
274
285
  }
286
+ else if (memberName === 'key')
287
+ ;
275
288
  else if ((!isProp ) &&
276
289
  memberName[0] === 'o' &&
277
290
  memberName[1] === 'n') {
@@ -436,6 +449,8 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
436
449
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
437
450
  let oldStartIdx = 0;
438
451
  let newStartIdx = 0;
452
+ let idxInOld = 0;
453
+ let i = 0;
439
454
  let oldEndIdx = oldCh.length - 1;
440
455
  let oldStartVnode = oldCh[0];
441
456
  let oldEndVnode = oldCh[oldEndIdx];
@@ -443,6 +458,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
443
458
  let newStartVnode = newCh[0];
444
459
  let newEndVnode = newCh[newEndIdx];
445
460
  let node;
461
+ let elmToMove;
446
462
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
447
463
  if (oldStartVnode == null) {
448
464
  // Vnode might have been moved left
@@ -480,7 +496,29 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
480
496
  newStartVnode = newCh[++newStartIdx];
481
497
  }
482
498
  else {
499
+ // createKeyToOldIdx
500
+ idxInOld = -1;
483
501
  {
502
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
503
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
504
+ idxInOld = i;
505
+ break;
506
+ }
507
+ }
508
+ }
509
+ if (idxInOld >= 0) {
510
+ elmToMove = oldCh[idxInOld];
511
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
512
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
513
+ }
514
+ else {
515
+ patch(elmToMove, newStartVnode);
516
+ oldCh[idxInOld] = undefined;
517
+ node = elmToMove.$elm$;
518
+ }
519
+ newStartVnode = newCh[++newStartIdx];
520
+ }
521
+ else {
484
522
  // new element
485
523
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
486
524
  newStartVnode = newCh[++newStartIdx];
@@ -503,7 +541,9 @@ const isSameVnode = (vnode1, vnode2) => {
503
541
  // compare if two vnode to see if they're "technically" the same
504
542
  // need to have the same element tag, and same key to be the same
505
543
  if (vnode1.$tag$ === vnode2.$tag$) {
506
- return true;
544
+ {
545
+ return vnode1.$key$ === vnode2.$key$;
546
+ }
507
547
  }
508
548
  return false;
509
549
  };
@@ -793,6 +833,11 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
793
833
  const parsePropertyValue = (propValue, propType) => {
794
834
  // ensure this value is of the correct prop type
795
835
  if (propValue != null && !isComplexType(propValue)) {
836
+ if (propType & 4 /* Boolean */) {
837
+ // per the HTML spec, any string value means it is a boolean true value
838
+ // but we'll cheat here and say that the string "false" is the boolean false
839
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
840
+ }
796
841
  if (propType & 2 /* Number */) {
797
842
  // force it to be a number
798
843
  return parseFloat(propValue);
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-7aa9e822.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-fe16e7b6.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["grw-app_10",[[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);
13
+ return bootstrapLazy([["grw-app_11",[[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);
14
14
  });
15
15
  };
16
16
 
@@ -1 +1 @@
1
- import{p as r,b as o}from"./p-332ba9ab.js";(()=>{const o=import.meta.url,i={};return""!==o&&(i.resourcesUrl=new URL(".",o).href),r(i)})().then((r=>o([["p-73bc92fe",[[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]}]]]],r)));
1
+ import{p as r,b as o}from"./p-8c206aec.js";(()=>{const o=import.meta.url,e={};return""!==o&&(e.resourcesUrl=new URL(".",o).href),r(e)})().then((r=>o([["p-ed8706fb",[[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]}]]]],r)));