@geotrekce/geotrek-rando-widget 0.0.8 → 0.0.11

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 (29) hide show
  1. package/dist/cjs/grw-app.cjs.entry.js +1 -1
  2. package/dist/cjs/grw-filter_6.cjs.entry.js +35 -11
  3. package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +1 -1
  4. package/dist/cjs/grw-trek-card.cjs.entry.js +1 -1
  5. package/dist/cjs/{store-b4c3c507.js → store-4d75c7a8.js} +1 -0
  6. package/dist/collection/components/grw-map/grw-map.js +10 -5
  7. package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +1 -1
  8. package/dist/collection/components/grw-treks-list/grw-treks-list.js +18 -3
  9. package/dist/collection/store/grw-trek-provider.js +6 -2
  10. package/dist/collection/store/store.js +1 -0
  11. package/dist/components/grw-map2.js +10 -5
  12. package/dist/components/grw-trek-provider2.js +6 -2
  13. package/dist/components/grw-treks-list2.js +18 -3
  14. package/dist/components/store.js +1 -0
  15. package/dist/esm/grw-app.entry.js +1 -1
  16. package/dist/esm/grw-filter_6.entry.js +35 -11
  17. package/dist/esm/grw-information-desk-detail_3.entry.js +1 -1
  18. package/dist/esm/grw-trek-card.entry.js +1 -1
  19. package/dist/esm/{store-a5f523fd.js → store-ab2dacd4.js} +1 -0
  20. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  21. package/dist/geotrek-rando-widget/{p-94f0db4d.entry.js → p-7694955c.entry.js} +1 -1
  22. package/dist/geotrek-rando-widget/{p-9a25f817.entry.js → p-84bb45be.entry.js} +1 -1
  23. package/dist/geotrek-rando-widget/{p-500436f1.entry.js → p-973a44cb.entry.js} +1 -1
  24. package/dist/geotrek-rando-widget/{p-0510e16b.entry.js → p-ee0db5c4.entry.js} +1 -1
  25. package/dist/geotrek-rando-widget/{p-22562f4d.js → p-fb36dda2.js} +1 -1
  26. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +2 -0
  27. package/dist/types/store/store.d.ts +3 -1
  28. package/dist/types/types/types.d.ts +6 -5
  29. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-ee473772.js';
2
- import { s as state, o as onChange } from './store-a5f523fd.js';
2
+ import { s as state, o as onChange } from './store-ab2dacd4.js';
3
3
  import { d as durationImage, f as formatDuration, l as lengthImage, a as formatLength, b as ascentImage, c as formatAscent } from './length-d82189db.js';
4
4
 
5
5
  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)}";
@@ -14250,9 +14250,11 @@ const GrwMap = class {
14250
14250
  }
14251
14251
  onChange('currentTreks', () => {
14252
14252
  if (state.currentTrek) {
14253
+ this.removeTreks();
14253
14254
  this.addTrek();
14254
14255
  }
14255
14256
  else if (state.currentTreks) {
14257
+ this.removeTrek();
14256
14258
  this.addTreks();
14257
14259
  }
14258
14260
  });
@@ -14262,8 +14264,8 @@ const GrwMap = class {
14262
14264
  this.addTrek();
14263
14265
  }
14264
14266
  else {
14265
- this.addTreks();
14266
14267
  this.removeTrek();
14268
+ this.addTreks();
14267
14269
  }
14268
14270
  });
14269
14271
  }
@@ -14351,9 +14353,12 @@ const GrwMap = class {
14351
14353
  }
14352
14354
  }
14353
14355
  handleTreksWithinBounds() {
14354
- state.treksWithinBounds = state.currentTreks.filter(trek => this.map.getBounds().contains(leafletSrc.latLng(trek.departure_geom[1], trek.departure_geom[0])));
14356
+ if (!state.currentMapTreksBounds || state.currentMapTreksBounds.toBBoxString() !== this.map.getBounds().toBBoxString()) {
14357
+ state.treksWithinBounds = state.currentTreks.filter(trek => this.map.getBounds().contains(leafletSrc.latLng(trek.departure_geom[1], trek.departure_geom[0])));
14358
+ }
14355
14359
  }
14356
14360
  addTrek() {
14361
+ var _a;
14357
14362
  const currentTrekFeature = {
14358
14363
  type: 'Feature',
14359
14364
  geometry: state.currentTrek.geometry,
@@ -14476,14 +14481,14 @@ const GrwMap = class {
14476
14481
  for (const currentPoi of state.currentPois) {
14477
14482
  currentPoisFeatureCollection.features.push({
14478
14483
  type: 'Feature',
14479
- properties: { name: currentPoi.name, type_pictogram: currentPoi.type_pictogram },
14484
+ properties: { name: currentPoi.name, type_pictogram: (_a = state.poiTypes.find(poiType => poiType.id === currentPoi.type)) === null || _a === void 0 ? void 0 : _a.pictogram },
14480
14485
  geometry: currentPoi.geometry,
14481
14486
  });
14482
14487
  }
14483
14488
  this.currentPoisLayer = leafletSrc.geoJSON(currentPoisFeatureCollection, {
14484
14489
  pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
14485
14490
  icon: leafletSrc.divIcon({
14486
- html: geoJsonPoint.properties.type_pictogram && `<img src=${geoJsonPoint.properties.type_pictogram} />`,
14491
+ html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
14487
14492
  className: 'poi-icon',
14488
14493
  iconSize: 48,
14489
14494
  }),
@@ -14517,7 +14522,7 @@ const GrwMap = class {
14517
14522
  this.currentInformationDesksLayer = leafletSrc.geoJSON(currentInformationDesksFeatureCollection, {
14518
14523
  pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
14519
14524
  icon: leafletSrc.divIcon({
14520
- html: geoJsonPoint.properties.type_pictogram && `<img src=${geoJsonPoint.properties.type_pictogram} />`,
14525
+ html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
14521
14526
  className: 'information-desks-icon',
14522
14527
  iconSize: 48,
14523
14528
  }),
@@ -14692,12 +14697,15 @@ const GrwTrekProvider = class {
14692
14697
  fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
14693
14698
  fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
14694
14699
  fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
14695
- 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`, { signal: this.signal }),
14700
+ fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,geometry&page_size=999`, {
14701
+ signal: this.signal,
14702
+ }),
14703
+ fetch(`${this.api}poi_type/?language=${this.language}&fields=id,pictogram`, { signal: this.signal }),
14696
14704
  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`, { signal: this.signal }),
14697
14705
  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,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`, { signal: this.signal }),
14698
14706
  ])
14699
14707
  .then(responses => Promise.all(responses.map(response => response.json())))
14700
- .then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
14708
+ .then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, poiTypes, informationDesks, trek]) => {
14701
14709
  state.trekNetworkError = false;
14702
14710
  if (difficulties) {
14703
14711
  state.difficulties = difficulties.results;
@@ -14721,6 +14729,7 @@ const GrwTrekProvider = class {
14721
14729
  state.accessibilitiesLevel = accessibilitiesLevel.results;
14722
14730
  }
14723
14731
  state.currentPois = pois.results;
14732
+ state.poiTypes = poiTypes.results;
14724
14733
  state.currentInformationDesks = informationDesks.results;
14725
14734
  state.currentTrek = trek;
14726
14735
  })
@@ -14749,19 +14758,22 @@ const GrwTreksList = class {
14749
14758
  this.isLargeView = false;
14750
14759
  this.step = 10;
14751
14760
  this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
14761
+ this.shouldAddInfiniteScrollEvent = true;
14752
14762
  }
14753
14763
  connectedCallback() {
14754
- this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14764
+ this.handleInfiniteScrollEvent(true);
14755
14765
  if (state.currentTreks) {
14756
14766
  this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
14757
14767
  }
14758
14768
  onChange('currentTreks', () => {
14769
+ this.handleInfiniteScrollEvent(true);
14759
14770
  this.element.scroll({ top: 0 });
14760
14771
  if (state.currentTreks) {
14761
14772
  this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
14762
14773
  }
14763
14774
  });
14764
14775
  onChange('treksWithinBounds', () => {
14776
+ this.handleInfiniteScrollEvent(true);
14765
14777
  this.element.scroll({ top: 0 });
14766
14778
  if (state.treksWithinBounds) {
14767
14779
  this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
@@ -14774,12 +14786,24 @@ const GrwTreksList = class {
14774
14786
  this.treksToDisplay = state.treksWithinBounds.slice(0, this.treksToDisplay.length + this.step >= state.treksWithinBounds.length ? state.treksWithinBounds.length : this.treksToDisplay.length + this.step);
14775
14787
  }
14776
14788
  else {
14777
- this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
14789
+ this.handleInfiniteScrollEvent(false);
14790
+ }
14791
+ }
14792
+ }
14793
+ handleInfiniteScrollEvent(shouldAddInfiniteScrollEvent) {
14794
+ if (shouldAddInfiniteScrollEvent) {
14795
+ if (this.shouldAddInfiniteScrollEvent) {
14796
+ this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14797
+ this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
14778
14798
  }
14779
14799
  }
14800
+ else {
14801
+ this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
14802
+ this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
14803
+ }
14780
14804
  }
14781
14805
  disconnectedCallback() {
14782
- this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
14806
+ this.handleInfiniteScrollEvent(false);
14783
14807
  }
14784
14808
  render() {
14785
14809
  return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, 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 })))));
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-ee473772.js';
2
- import { s as state } from './store-a5f523fd.js';
2
+ import { s as state } from './store-ab2dacd4.js';
3
3
 
4
4
  const grwInformationDeskDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-sub-container{display:flex;flex-direction:column}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.information-desk-description{font-size:16px}";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-ee473772.js';
2
- import { s as state, o as onChange } from './store-a5f523fd.js';
2
+ import { s as state, o as onChange } from './store-ab2dacd4.js';
3
3
  import { d as durationImage, f as formatDuration, l as lengthImage, a as formatLength, b as ascentImage, c as formatAscent } from './length-d82189db.js';
4
4
 
5
5
  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}";
@@ -200,6 +200,7 @@ const { state, onChange } = createStore({
200
200
  sources: null,
201
201
  accessibilities: null,
202
202
  accessibilitiesLevel: null,
203
+ poiTypes: null,
203
204
  currentTrek: null,
204
205
  currentPois: null,
205
206
  currentInformationDesks: null,
@@ -1 +1 @@
1
- import{p as r,b as o}from"./p-b62909db.js";(()=>{const o=import.meta.url,e={};return""!==o&&(e.resourcesUrl=new URL(".",o).href),r(e)})().then((r=>o([["p-500436f1",[[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]}]]],["p-0510e16b",[[1,"grw-information-desk-detail",{informationDesk:[16]}],[1,"grw-poi-detail",{poi:[16]}],[1,"grw-sensitive-area-detail",{sensitiveArea:[16]}]]],["p-9a25f817",[[1,"grw-trek-detail",{trek:[16],colorPrimary:[1,"color-primary"],colorPrimaryShade:[1,"color-primary-shade"],colorPrimaryTint:[1,"color-primary-tint"],difficulty:[32],route:[32],practice:[32],themes:[32],labels:[32],sources:[32],accessibilities:[32],accessibilityLevel:[32],currentTrek:[32]}],[1,"grw-treks-list",{colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],isLargeView:[4,"is-large-view"],treksToDisplay:[32]}],[1,"grw-filter",{filterType:[1,"filter-type"],filterName:[1,"filter-name"],filterNameProperty:[1,"filter-name-property"]}],[0,"grw-map",{urlLayer:[1,"url-layer"],attribution:[1],center:[1],zoom:[2],colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],colorTrekLine:[1,"color-trek-line"],colorDepartureIcon:[1,"color-departure-icon"],colorArrivalIcon:[1,"color-arrival-icon"],colorSensitiveArea:[1,"color-sensitive-area"],colorPoiIcon:[1,"color-poi-icon"],mapIsReady:[32]}],[1,"grw-trek-provider",{language:[1],api:[1],trekId:[1,"trek-id"]}],[1,"grw-treks-provider",{language:[1],api:[1],inBbox:[1,"in-bbox"],cities:[1],districts:[1],structures:[1],themes:[1],portals:[1],routes:[1],practices:[1]}]]],["p-94f0db4d",[[1,"grw-app",{api:[1],language:[1],inBbox:[1,"in-bbox"],cities:[1],districts:[1],structures:[1],themes:[1],portals:[1],routes:[1],practices:[1],urlLayer:[1,"url-layer"],center:[1],zoom:[2],attribution:[1],colorPrimary:[1,"color-primary"],colorPrimaryShade:[1,"color-primary-shade"],colorPrimaryTint:[1,"color-primary-tint"],colorTrekLine:[1,"color-trek-line"],colorDepartureIcon:[1,"color-departure-icon"],colorArrivalIcon:[1,"color-arrival-icon"],colorSensitiveArea:[1,"color-sensitive-area"],colorPoiIcon:[1,"color-poi-icon"],showTrek:[32],showTreksMap:[32],showTrekMap:[32],showFilters:[32],isLargeView:[32],currentTrekId:[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]],r)));
1
+ import{p as r,b as e}from"./p-b62909db.js";(()=>{const e=import.meta.url,o={};return""!==e&&(o.resourcesUrl=new URL(".",e).href),r(o)})().then((r=>e([["p-973a44cb",[[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]}]]],["p-ee0db5c4",[[1,"grw-information-desk-detail",{informationDesk:[16]}],[1,"grw-poi-detail",{poi:[16]}],[1,"grw-sensitive-area-detail",{sensitiveArea:[16]}]]],["p-84bb45be",[[1,"grw-trek-detail",{trek:[16],colorPrimary:[1,"color-primary"],colorPrimaryShade:[1,"color-primary-shade"],colorPrimaryTint:[1,"color-primary-tint"],difficulty:[32],route:[32],practice:[32],themes:[32],labels:[32],sources:[32],accessibilities:[32],accessibilityLevel:[32],currentTrek:[32]}],[1,"grw-treks-list",{colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],isLargeView:[4,"is-large-view"],treksToDisplay:[32]}],[1,"grw-filter",{filterType:[1,"filter-type"],filterName:[1,"filter-name"],filterNameProperty:[1,"filter-name-property"]}],[0,"grw-map",{urlLayer:[1,"url-layer"],attribution:[1],center:[1],zoom:[2],colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],colorTrekLine:[1,"color-trek-line"],colorDepartureIcon:[1,"color-departure-icon"],colorArrivalIcon:[1,"color-arrival-icon"],colorSensitiveArea:[1,"color-sensitive-area"],colorPoiIcon:[1,"color-poi-icon"],mapIsReady:[32]}],[1,"grw-trek-provider",{language:[1],api:[1],trekId:[1,"trek-id"]}],[1,"grw-treks-provider",{language:[1],api:[1],inBbox:[1,"in-bbox"],cities:[1],districts:[1],structures:[1],themes:[1],portals:[1],routes:[1],practices:[1]}]]],["p-7694955c",[[1,"grw-app",{api:[1],language:[1],inBbox:[1,"in-bbox"],cities:[1],districts:[1],structures:[1],themes:[1],portals:[1],routes:[1],practices:[1],urlLayer:[1,"url-layer"],center:[1],zoom:[2],attribution:[1],colorPrimary:[1,"color-primary"],colorPrimaryShade:[1,"color-primary-shade"],colorPrimaryTint:[1,"color-primary-tint"],colorTrekLine:[1,"color-trek-line"],colorDepartureIcon:[1,"color-departure-icon"],colorArrivalIcon:[1,"color-arrival-icon"],colorSensitiveArea:[1,"color-sensitive-area"],colorPoiIcon:[1,"color-poi-icon"],showTrek:[32],showTreksMap:[32],showTrekMap:[32],showFilters:[32],isLargeView:[32],currentTrekId:[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]],r)));
@@ -1 +1 @@
1
- import{r as i,h as t,H as e,g as r}from"./p-b62909db.js";import{o,s as a}from"./p-22562f4d.js";const n=class{constructor(t){i(this,t),this.showTrek=!1,this.showTreksMap=!1,this.showTrekMap=!1,this.showFilters=!1,this.isLargeView=!1,this.language="fr",this.colorPrimary="#6b0030",this.colorPrimaryShade="#4a0021",this.colorPrimaryTint="#974c6e",this.colorTrekLine="#6b0030",this.colorDepartureIcon="#006b3b",this.colorArrivalIcon="#85003b",this.colorSensitiveArea="#4974a5",this.colorPoiIcon="#974c6e",this.largeViewSize=1024,this.handlePopStateBind=this.handlePopState.bind(this)}onTrekCardPress(i){this.currentTrekId=i.detail,this.showTrek=!this.showTrek;const t=new URL(window.location.toString());t.searchParams.set("trek",this.currentTrekId.toString()),window.history.pushState({},"",t)}onWindowResize(){this.handleView()}watchPropHandler(){window.dispatchEvent(new window.Event("resize"))}componentDidLoad(){o("trekNetworkError",(()=>{if(a.trekNetworkError){const i=new URL(window.location.toString());i.searchParams.delete("trek"),window.history.replaceState({},"",i),this.onTrekDetailsClose()}})),this.handleView(),window.addEventListener("popstate",this.handlePopStateBind,!1);const i=new URL(window.location.toString()),t=i.searchParams.get("trek");t&&(window.history.replaceState({isInitialHistoryWithTrek:!0},"",i),this.currentTrekId=Number(t),this.showTrek=!this.showTrek)}onTrekDetailsClose(){a.currentTrek=null,this.currentTrekId=null,this.showTrek=!this.showTrek}handleView(){this.isLargeView=this.element.getBoundingClientRect().width>=this.largeViewSize,this.showTreksMap=this.isLargeView,this.showTrekMap=this.isLargeView}handleFilters(){this.showFilters=!this.showFilters}handleBackButton(){if(window.history.state.isInitialHistoryWithTrek){this.onTrekDetailsClose();const i=new URL(window.location.toString());i.searchParams.delete("trek"),window.history.pushState({},"",i)}else window.history.back()}handlePopState(){const i=new URL(window.location.toString()).searchParams.get("trek");i?(this.currentTrekId=Number(i),this.showTrek=!this.showTrek):this.onTrekDetailsClose()}handleShowMap(){this.currentTrekId?this.showTrekMap=!this.showTrekMap:this.showTreksMap=!this.showTreksMap}disconnectedCallback(){window.removeEventListener("popstate",this.handlePopStateBind)}render(){return t(e,{style:{"--color-primary":this.colorPrimary,"--color-primary-tint":this.colorPrimaryTint,"--color-primary-shade":this.colorPrimaryShade}},t("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}),!a.currentTreks&&!a.currentTrek&&t("div",{class:"init-loader-container"},t("span",{class:"loader"})),this.showTrek&&this.currentTrekId&&t("grw-trek-provider",{api:a.api,language:this.language,"trek-id":this.currentTrekId}),(a.currentTreks||a.currentTrek)&&t("div",{class:"app-container"},t("div",{class:this.isLargeView?"large-view-header-container":"header-container"},this.showTrek?t("div",{onClick:()=>this.handleBackButton(),class:"arrow-back-icon",innerHTML:'<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>'}):t("div",{class:"handle-filters-container"},t("div",{onClick:()=>this.handleFilters(),class:"handle-filters-button"},"FILTRER"),a.treksWithinBounds&&t("div",{class:"current-treks-within-bounds-length"},`${a.treksWithinBounds.length} randonnée${a.treksWithinBounds.length>1?"s":""}`)),!this.showTrek&&this.showFilters&&t("div",{class:"options-container"},t("div",{class:"filters-container"},t("div",{onClick:()=>this.handleFilters(),class:"close-filters-button"},"X"),t("div",null,t("grw-filter",{filterName:"Pratique",filterType:"practices",filterNameProperty:"name"})),t("div",{class:"filter-margin-top"},t("grw-filter",{filterName:"Difficulté",filterType:"difficulties",filterNameProperty:"label"})),t("div",{class:"filter-margin-top"},t("grw-filter",{filterName:"Durée",filterType:"durations",filterNameProperty:"name"}))),t("div",{onClick:()=>this.handleFilters(),class:"back-filters-container"})),t("div",{class:"attribution-container"},t("a",{target:"_blank",href:"https://geotrek.fr"},"GEOTREK"))),t("div",{class:"content-container"},t("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"}},t("grw-treks-list",{"is-large-view":this.isLargeView,"color-primary":this.colorPrimary,"color-primary-tint":this.colorPrimaryTint})),this.showTrek&&!a.currentTrek&&t("div",{class:this.isLargeView?"large-view-loader-container":"loader-container"},t("span",{class:"loader"})),a.currentTrek&&t("div",{class:this.isLargeView?"large-view-app-trek-detail-container":"app-trek-detail-container"},t("grw-trek-detail",{"color-primary":this.colorPrimary,"color-primary-shade":this.colorPrimaryShade,"color-primary-tint":this.colorPrimaryTint})),t("grw-map",{class:this.isLargeView?"large-view-app-map-container":"app-map-container",style:{visibility:this.showTreksMap&&!this.showTrek||this.showTrekMap&&this.showTrek?"visible":"hidden"},"url-layer":this.urlLayer,center:this.center,zoom:this.zoom,attribution:this.attribution,"color-primary":this.colorPrimary,"color-primary-tint":this.colorPrimaryTint,"color-trek-line":this.colorTrekLine,"color-departure-icon":this.colorDepartureIcon,"color-arrival-icon":this.colorArrivalIcon,"color-sensitive-area":this.colorSensitiveArea,"color-poi-icon":this.colorPoiIcon})),t("div",{class:"map-visibility-button",style:{display:this.isLargeView?"none":"flex"}},t("div",{onClick:()=>this.handleShowMap()},this.showTrek?this.showTrekMap?"Voir la fiche":"Voir la carte":this.showTreksMap?"Voir la liste":"Voir la carte"))))}get element(){return r(this)}static get watchers(){return{isLargeView:["watchPropHandler"]}}};n.style='.app-container{position:relative;height:100%;max-height:100vh;font-family:"Roboto"}.header-container,.large-view-header-container{display:flex;flex-direction:row;align-items:center;background-color:var(--color-primary);height:64px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.header-container .handle-filters-container,.large-view-header-container .handle-filters-container{display:flex;align-items:center}.header-container .handle-filters-container .handle-filters-button,.large-view-header-container .handle-filters-container .handle-filters-button{user-select:none;cursor:pointer;color:var(--color-primary);background-color:#ffffff;margin-left:12px;border-radius:8px;padding:8px}.header-container .handle-filters-container .current-treks-within-bounds-length,.large-view-header-container .handle-filters-container .current-treks-within-bounds-length{margin-left:12px;color:#ffffff}.header-container .attribution-container,.large-view-header-container .attribution-container{position:absolute;right:24px}.header-container .attribution-container a,.large-view-header-container .attribution-container a{color:#ffffff;text-decoration:none}.options-container{height:calc(100% - 64px);position:absolute;width:100%;z-index:1100;top:64px}.filters-container{position:absolute;width:100%;background-color:#ffffff;padding:36px 0px;z-index:1100}.filters-container .close-filters-button{cursor:pointer;font-weight:bold;position:absolute;top:12px;right:12px;padding:12px;border-radius:12px;color:var(--color-primary);border:1px var(--color-primary) solid}.filters-container .close-filters-button:hover{background-color:var(--color-primary);color:#ffffff}.filters-container .filter-margin-top{margin-top:24px}.back-filters-container{background-color:rgba(0, 0, 0, 0.5);width:100%;height:calc(100% - 64px);position:absolute;z-index:1099;top:64px}.init-loader-container,.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.init-loader-container .loader,.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.init-loader-container,.loader-container{width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}';export{n as grw_app}
1
+ import{r as i,h as t,H as e,g as r}from"./p-b62909db.js";import{o,s as a}from"./p-fb36dda2.js";const n=class{constructor(t){i(this,t),this.showTrek=!1,this.showTreksMap=!1,this.showTrekMap=!1,this.showFilters=!1,this.isLargeView=!1,this.language="fr",this.colorPrimary="#6b0030",this.colorPrimaryShade="#4a0021",this.colorPrimaryTint="#974c6e",this.colorTrekLine="#6b0030",this.colorDepartureIcon="#006b3b",this.colorArrivalIcon="#85003b",this.colorSensitiveArea="#4974a5",this.colorPoiIcon="#974c6e",this.largeViewSize=1024,this.handlePopStateBind=this.handlePopState.bind(this)}onTrekCardPress(i){this.currentTrekId=i.detail,this.showTrek=!this.showTrek;const t=new URL(window.location.toString());t.searchParams.set("trek",this.currentTrekId.toString()),window.history.pushState({},"",t)}onWindowResize(){this.handleView()}watchPropHandler(){window.dispatchEvent(new window.Event("resize"))}componentDidLoad(){o("trekNetworkError",(()=>{if(a.trekNetworkError){const i=new URL(window.location.toString());i.searchParams.delete("trek"),window.history.replaceState({},"",i),this.onTrekDetailsClose()}})),this.handleView(),window.addEventListener("popstate",this.handlePopStateBind,!1);const i=new URL(window.location.toString()),t=i.searchParams.get("trek");t&&(window.history.replaceState({isInitialHistoryWithTrek:!0},"",i),this.currentTrekId=Number(t),this.showTrek=!this.showTrek)}onTrekDetailsClose(){a.currentTrek=null,this.currentTrekId=null,this.showTrek=!this.showTrek}handleView(){this.isLargeView=this.element.getBoundingClientRect().width>=this.largeViewSize,this.showTreksMap=this.isLargeView,this.showTrekMap=this.isLargeView}handleFilters(){this.showFilters=!this.showFilters}handleBackButton(){if(window.history.state.isInitialHistoryWithTrek){this.onTrekDetailsClose();const i=new URL(window.location.toString());i.searchParams.delete("trek"),window.history.pushState({},"",i)}else window.history.back()}handlePopState(){const i=new URL(window.location.toString()).searchParams.get("trek");i?(this.currentTrekId=Number(i),this.showTrek=!this.showTrek):this.onTrekDetailsClose()}handleShowMap(){this.currentTrekId?this.showTrekMap=!this.showTrekMap:this.showTreksMap=!this.showTreksMap}disconnectedCallback(){window.removeEventListener("popstate",this.handlePopStateBind)}render(){return t(e,{style:{"--color-primary":this.colorPrimary,"--color-primary-tint":this.colorPrimaryTint,"--color-primary-shade":this.colorPrimaryShade}},t("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}),!a.currentTreks&&!a.currentTrek&&t("div",{class:"init-loader-container"},t("span",{class:"loader"})),this.showTrek&&this.currentTrekId&&t("grw-trek-provider",{api:a.api,language:this.language,"trek-id":this.currentTrekId}),(a.currentTreks||a.currentTrek)&&t("div",{class:"app-container"},t("div",{class:this.isLargeView?"large-view-header-container":"header-container"},this.showTrek?t("div",{onClick:()=>this.handleBackButton(),class:"arrow-back-icon",innerHTML:'<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>'}):t("div",{class:"handle-filters-container"},t("div",{onClick:()=>this.handleFilters(),class:"handle-filters-button"},"FILTRER"),a.treksWithinBounds&&t("div",{class:"current-treks-within-bounds-length"},`${a.treksWithinBounds.length} randonnée${a.treksWithinBounds.length>1?"s":""}`)),!this.showTrek&&this.showFilters&&t("div",{class:"options-container"},t("div",{class:"filters-container"},t("div",{onClick:()=>this.handleFilters(),class:"close-filters-button"},"X"),t("div",null,t("grw-filter",{filterName:"Pratique",filterType:"practices",filterNameProperty:"name"})),t("div",{class:"filter-margin-top"},t("grw-filter",{filterName:"Difficulté",filterType:"difficulties",filterNameProperty:"label"})),t("div",{class:"filter-margin-top"},t("grw-filter",{filterName:"Durée",filterType:"durations",filterNameProperty:"name"}))),t("div",{onClick:()=>this.handleFilters(),class:"back-filters-container"})),t("div",{class:"attribution-container"},t("a",{target:"_blank",href:"https://geotrek.fr"},"GEOTREK"))),t("div",{class:"content-container"},t("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"}},t("grw-treks-list",{"is-large-view":this.isLargeView,"color-primary":this.colorPrimary,"color-primary-tint":this.colorPrimaryTint})),this.showTrek&&!a.currentTrek&&t("div",{class:this.isLargeView?"large-view-loader-container":"loader-container"},t("span",{class:"loader"})),a.currentTrek&&t("div",{class:this.isLargeView?"large-view-app-trek-detail-container":"app-trek-detail-container"},t("grw-trek-detail",{"color-primary":this.colorPrimary,"color-primary-shade":this.colorPrimaryShade,"color-primary-tint":this.colorPrimaryTint})),t("grw-map",{class:this.isLargeView?"large-view-app-map-container":"app-map-container",style:{visibility:this.showTreksMap&&!this.showTrek||this.showTrekMap&&this.showTrek?"visible":"hidden"},"url-layer":this.urlLayer,center:this.center,zoom:this.zoom,attribution:this.attribution,"color-primary":this.colorPrimary,"color-primary-tint":this.colorPrimaryTint,"color-trek-line":this.colorTrekLine,"color-departure-icon":this.colorDepartureIcon,"color-arrival-icon":this.colorArrivalIcon,"color-sensitive-area":this.colorSensitiveArea,"color-poi-icon":this.colorPoiIcon})),t("div",{class:"map-visibility-button",style:{display:this.isLargeView?"none":"flex"}},t("div",{onClick:()=>this.handleShowMap()},this.showTrek?this.showTrekMap?"Voir la fiche":"Voir la carte":this.showTreksMap?"Voir la liste":"Voir la carte"))))}get element(){return r(this)}static get watchers(){return{isLargeView:["watchPropHandler"]}}};n.style='.app-container{position:relative;height:100%;max-height:100vh;font-family:"Roboto"}.header-container,.large-view-header-container{display:flex;flex-direction:row;align-items:center;background-color:var(--color-primary);height:64px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.header-container .handle-filters-container,.large-view-header-container .handle-filters-container{display:flex;align-items:center}.header-container .handle-filters-container .handle-filters-button,.large-view-header-container .handle-filters-container .handle-filters-button{user-select:none;cursor:pointer;color:var(--color-primary);background-color:#ffffff;margin-left:12px;border-radius:8px;padding:8px}.header-container .handle-filters-container .current-treks-within-bounds-length,.large-view-header-container .handle-filters-container .current-treks-within-bounds-length{margin-left:12px;color:#ffffff}.header-container .attribution-container,.large-view-header-container .attribution-container{position:absolute;right:24px}.header-container .attribution-container a,.large-view-header-container .attribution-container a{color:#ffffff;text-decoration:none}.options-container{height:calc(100% - 64px);position:absolute;width:100%;z-index:1100;top:64px}.filters-container{position:absolute;width:100%;background-color:#ffffff;padding:36px 0px;z-index:1100}.filters-container .close-filters-button{cursor:pointer;font-weight:bold;position:absolute;top:12px;right:12px;padding:12px;border-radius:12px;color:var(--color-primary);border:1px var(--color-primary) solid}.filters-container .close-filters-button:hover{background-color:var(--color-primary);color:#ffffff}.filters-container .filter-margin-top{margin-top:24px}.back-filters-container{background-color:rgba(0, 0, 0, 0.5);width:100%;height:calc(100% - 64px);position:absolute;z-index:1099;top:64px}.init-loader-container,.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.init-loader-container .loader,.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.init-loader-container,.loader-container{width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}';export{n as grw_app}