@geotrekce/geotrek-rando-widget 0.0.4 → 0.0.7

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 (61) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +1 -1
  2. package/dist/cjs/grw-app.cjs.entry.js +111 -0
  3. package/dist/cjs/{grw-app_11.cjs.entry.js → grw-filter_6.cjs.entry.js} +197 -455
  4. package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +52 -0
  5. package/dist/cjs/grw-trek-card.cjs.entry.js +47 -0
  6. package/dist/cjs/length-d315d156.js +34 -0
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/store-fd04a216.js +211 -0
  9. package/dist/collection/components/grw-app/grw-app.js +54 -25
  10. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +5 -4
  11. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +1 -1
  12. package/dist/collection/components/grw-map/grw-map.css +19 -1
  13. package/dist/collection/components/grw-map/grw-map.js +65 -10
  14. package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +5 -4
  15. package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +1 -1
  16. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +27 -3
  17. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +17 -3
  18. package/dist/collection/components/grw-trek-card/grw-trek-card.js +1 -1
  19. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +134 -4
  20. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +101 -6
  21. package/dist/collection/components/grw-treks-list/grw-treks-list.js +8 -3
  22. package/dist/collection/store/grw-trek-provider.js +24 -9
  23. package/dist/collection/store/grw-treks-provider.js +12 -6
  24. package/dist/collection/store/store.js +7 -1
  25. package/dist/components/grw-app.js +52 -6
  26. package/dist/components/grw-information-desk-detail2.js +2 -2
  27. package/dist/components/grw-map2.js +66 -11
  28. package/dist/components/grw-poi-detail2.js +2 -2
  29. package/dist/components/grw-sensitive-area-detail2.js +7 -2
  30. package/dist/components/grw-trek-detail2.js +31 -4
  31. package/dist/components/grw-trek-provider2.js +24 -9
  32. package/dist/components/grw-treks-list2.js +8 -3
  33. package/dist/components/grw-treks-provider2.js +12 -6
  34. package/dist/components/store.js +7 -1
  35. package/dist/esm/geotrek-rando-widget.js +2 -2
  36. package/dist/esm/grw-app.entry.js +107 -0
  37. package/dist/esm/{grw-app_11.entry.js → grw-filter_6.entry.js} +138 -391
  38. package/dist/esm/grw-information-desk-detail_3.entry.js +46 -0
  39. package/dist/esm/grw-trek-card.entry.js +43 -0
  40. package/dist/esm/{index-fe16e7b6.js → index-192d910f.js} +1 -1
  41. package/dist/esm/length-d82189db.js +27 -0
  42. package/dist/esm/loader.js +2 -2
  43. package/dist/esm/store-b2c76c0c.js +208 -0
  44. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  45. package/dist/geotrek-rando-widget/p-1b2ba86d.entry.js +1 -0
  46. package/dist/geotrek-rando-widget/p-4361afd2.entry.js +1 -0
  47. package/dist/geotrek-rando-widget/p-5f17d340.entry.js +1 -0
  48. package/dist/geotrek-rando-widget/{p-8c206aec.js → p-6dce5e6c.js} +1 -1
  49. package/dist/geotrek-rando-widget/p-7715153d.entry.js +1 -0
  50. package/dist/geotrek-rando-widget/p-e6710c64.js +1 -0
  51. package/dist/geotrek-rando-widget/p-f3f7d6be.js +1 -0
  52. package/dist/types/components/grw-app/grw-app.d.ts +7 -2
  53. package/dist/types/components/grw-map/grw-map.d.ts +3 -1
  54. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +9 -4
  55. package/dist/types/components.d.ts +0 -2
  56. package/dist/types/store/grw-trek-provider.d.ts +2 -0
  57. package/dist/types/store/grw-treks-provider.d.ts +3 -0
  58. package/dist/types/store/store.d.ts +16 -3
  59. package/dist/types/types/types.d.ts +51 -1
  60. package/package.json +5 -4
  61. package/dist/geotrek-rando-widget/p-ed8706fb.entry.js +0 -1
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-c2c4531d.js');
6
+ const store = require('./store-fd04a216.js');
7
+
8
+ const grwInformationDeskDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-sub-container{display:flex;flex-direction:column}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.information-desk-description{font-size:16px}";
9
+
10
+ const GrwInformationDeskDetail = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ }
14
+ render() {
15
+ return (index.h(index.Host, null, this.informationDesk.photo_url && (index.h("div", { class: "information-desk-img" }, index.h("img", { src: this.informationDesk.photo_url, loading: "lazy" }))), index.h("div", { class: "information-desk-sub-container" }, this.informationDesk.name && index.h("div", { class: "information-desk-name" }, this.informationDesk.name), this.informationDesk.description && index.h("div", { class: "information-desk-description", innerHTML: this.informationDesk.description }), this.informationDesk.postal_code ||
16
+ this.informationDesk.municipality ||
17
+ (this.informationDesk.street && (index.h("div", null, this.informationDesk.postal_code, ` ${this.informationDesk.municipality}`, ` ${this.informationDesk.street}`))), this.informationDesk.phone && (index.h("div", null, index.h("a", { href: `tel:${this.informationDesk.phone}` }, this.informationDesk.phone))), this.informationDesk.email && (index.h("div", null, index.h("a", { href: `mailto:${this.informationDesk.email}` }, this.informationDesk.email))), this.informationDesk.website && (index.h("div", null, index.h("a", { href: `${this.informationDesk.website}` }, this.informationDesk.website))))));
18
+ }
19
+ };
20
+ GrwInformationDeskDetail.style = grwInformationDeskDetailCss;
21
+
22
+ const grwPoiDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.poi-img{width:180px}.poi-img img{width:180px;border-radius:8px}.poi-sub-container{display:flex;flex-direction:column}.poi-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.poi-description{font-size:16px}";
23
+
24
+ const GrwPoiDetail = class {
25
+ constructor(hostRef) {
26
+ index.registerInstance(this, hostRef);
27
+ }
28
+ render() {
29
+ return (index.h(index.Host, null, this.poi.attachments && this.poi.attachments[0] && this.poi.attachments[0].thumbnail && (index.h("div", { class: "poi-img" }, index.h("img", { src: this.poi.attachments[0].thumbnail, loading: "lazy" }))), index.h("div", { class: "poi-sub-container" }, index.h("div", { class: "poi-name" }, this.poi.name), index.h("div", { class: "poi-description", innerHTML: this.poi.description }))));
30
+ }
31
+ };
32
+ GrwPoiDetail.style = grwPoiDetailCss;
33
+
34
+ const grwSensitiveAreaDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.sensitive-area-title{color:var(--color-primary);font-size:24px;padding:12px 0px;font-weight:bold}.sensitive-area-description{font-size:16px}.sensitive-area-period-container .sensitive-area-period-title,.sensitive-area-period-container .sensitive-area-practice-title,.sensitive-area-period-container .sensitive-area-contact-title,.sensitive-area-practice-container .sensitive-area-period-title,.sensitive-area-practice-container .sensitive-area-practice-title,.sensitive-area-practice-container .sensitive-area-contact-title,.sensitive-area-contact-container .sensitive-area-period-title,.sensitive-area-contact-container .sensitive-area-practice-title,.sensitive-area-contact-container .sensitive-area-contact-title{color:var(--color-primary);font-size:24px;padding:12px 0px}.sensitive-area-period-container .sensitive-area-period-values,.sensitive-area-period-container .sensitive-area-practice-values,.sensitive-area-practice-container .sensitive-area-period-values,.sensitive-area-practice-container .sensitive-area-practice-values,.sensitive-area-contact-container .sensitive-area-period-values,.sensitive-area-contact-container .sensitive-area-practice-values{display:flex}";
35
+
36
+ const GrwSensitiveAreaDetail = class {
37
+ constructor(hostRef) {
38
+ index.registerInstance(this, hostRef);
39
+ }
40
+ render() {
41
+ return (index.h(index.Host, null, index.h("div", { class: "sensitive-area-title" }, this.sensitiveArea.name), index.h("div", { class: "sensitive-area-description", innerHTML: this.sensitiveArea.description }), this.sensitiveArea.practices && this.sensitiveArea.practices.length > 0 && (index.h("div", { class: "sensitive-area-practice-container" }, index.h("div", { class: "sensitive-area-practice-title" }, "Domaines d'activit\u00E9s concern\u00E9s :"), index.h("div", { class: "sensitive-area-practice-values" }, this.sensitiveArea.practices.map((practice, index$1) => (index.h("div", { innerHTML: `${store.state.practices.find(statePractice => statePractice.id === practice).name.toUpperCase()}${index$1 + 1 !== this.sensitiveArea.practices.length ? ' - ' : ''}` })))))), this.sensitiveArea.period && this.sensitiveArea.period.length > 0 && (index.h("div", { class: "sensitive-area-period-container" }, index.h("div", { class: "sensitive-area-period-title" }, "P\u00E9riodes de sensibilit\u00E9"), index.h("div", { class: "sensitive-area-period-values" }, this.sensitiveArea.period.map((month, index$1) => {
42
+ if (month) {
43
+ return (index.h("div", { innerHTML: `${new Date(0, index$1 + 1, 0).toLocaleDateString('fr', { month: 'long' }).toUpperCase()}${this.sensitiveArea.period.slice(index$1 + 1).find(month => month) ? ' - ' : ''}` }));
44
+ }
45
+ })))), index.h("div", { class: "sensitive-area-contact-container" }, index.h("div", { class: "sensitive-area-contact-title" }, "Contact"), index.h("div", { innerHTML: this.sensitiveArea.contact, class: "sensitive-area-contact-value" }))));
46
+ }
47
+ };
48
+ GrwSensitiveAreaDetail.style = grwSensitiveAreaDetailCss;
49
+
50
+ exports.grw_information_desk_detail = GrwInformationDeskDetail;
51
+ exports.grw_poi_detail = GrwPoiDetail;
52
+ exports.grw_sensitive_area_detail = GrwSensitiveAreaDetail;
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-c2c4531d.js');
6
+ const store = require('./store-fd04a216.js');
7
+ const length = require('./length-d315d156.js');
8
+
9
+ const grwTrekCardCss = ".trek-card-container,.trek-card-large-view-container{font-family:\"Roboto\";border-radius:8px;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25);cursor:pointer}.trek-card-container .image,.trek-card-large-view-container .image{object-fit:cover}.trek-card-container .sub-container,.trek-card-large-view-container .sub-container{display:flex;flex-direction:column;justify-content:center;padding:12px}.trek-card-container .sub-container .name,.trek-card-large-view-container .sub-container .name{color:var(--color-primary);font-size:24px;font-weight:bold;margin-bottom:8px}.trek-card-container .sub-container .departure,.trek-card-large-view-container .sub-container .departure{color:rgba(0, 0, 0, 0.7);font-size:16px;margin:4px 0px}.trek-card-container .sub-container .themes-container,.trek-card-large-view-container .sub-container .themes-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .themes-container .theme,.trek-card-large-view-container .sub-container .themes-container .theme{background-color:var(--color-primary-tint);color:#ffffff;border-radius:8px;padding:8px;margin:0px 8px 8px 0px}.trek-card-container .sub-container .icons-labels-container,.trek-card-large-view-container .sub-container .icons-labels-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .icons-labels-container .row,.trek-card-large-view-container .sub-container .icons-labels-container .row{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-card-container .sub-container .icons-labels-container .row:not(:last-child),.trek-card-large-view-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:12px}.trek-card-container .sub-container .icons-labels-container .row .icon-label,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label{display:flex;align-items:center;width:50%}.trek-card-container .sub-container .icons-labels-container .row .icon-label:nth-child(2),.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label:nth-child(2){margin:0px 4px}.trek-card-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg{width:24px;height:auto;margin-right:8px}.trek-card-container .sub-container .icons-labels-container .row .practice img,.trek-card-large-view-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}.trek-card-container{width:350px;height:auto}.trek-card-container .image{width:100%}.trek-card-large-view-container{height:auto;display:flex;flex-direction:row}.trek-card-large-view-container .image{width:250px}";
10
+
11
+ const GrwTrekCard = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.trekCardPress = index.createEvent(this, "trekCardPress", 7);
15
+ this.colorPrimary = '#6b0030';
16
+ this.colorPrimaryTint = '#974c6e';
17
+ this.isLargeView = false;
18
+ }
19
+ componentWillLoad() {
20
+ this.currentTrek = this.trek ? this.trek : store.state.currentTrek;
21
+ if (this.currentTrek) {
22
+ this.difficulty = store.state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
23
+ this.route = store.state.routes.find(route => route.id === this.currentTrek.route);
24
+ this.practice = store.state.practices.find(practice => practice.id === this.currentTrek.practice);
25
+ this.themes = store.state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
26
+ }
27
+ store.onChange('currentTrek', () => {
28
+ this.currentTrek = this.trek ? this.trek : store.state.currentTrek;
29
+ if (this.currentTrek) {
30
+ this.difficulty = store.state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
31
+ this.route = store.state.routes.find(route => route.id === this.currentTrek.route);
32
+ this.practice = store.state.practices.find(practice => practice.id === this.currentTrek.practice);
33
+ this.themes = store.state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
34
+ }
35
+ });
36
+ }
37
+ render() {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h;
39
+ return (index.h(index.Host, { onClick: () => this.trekCardPress.emit(this.currentTrek.id), style: { 'width': this.isLargeView ? '100%' : 'auto', '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (index.h("div", { class: this.isLargeView ? 'trek-card-large-view-container' : 'trek-card-container' }, this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (index.h("img", { class: "image", src: `${this.currentTrek.attachments[0].thumbnail}`, loading: "lazy" })), index.h("div", { class: "sub-container" }, index.h("div", { class: "departure" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.departure), index.h("div", { class: "name" }, (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.name), index.h("div", { class: "themes-container" }, this.themes.map(theme => (index.h("div", { class: "theme" }, theme.label)))), index.h("div", { class: "icons-labels-container" }, index.h("div", { class: "row" }, index.h("div", { class: "icon-label difficulty" }, ((_c = this.difficulty) === null || _c === void 0 ? void 0 : _c.pictogram) && index.h("img", { src: this.difficulty.pictogram }), (_d = this.difficulty) === null || _d === void 0 ? void 0 :
40
+ _d.label), index.h("div", { class: "icon-label duration" }, index.h("div", { class: "svg-icon", innerHTML: length.durationImage }), length.formatDuration(this.currentTrek.duration))), index.h("div", { class: "row" }, index.h("div", { class: "icon-label length" }, index.h("div", { class: "svg-icon", innerHTML: length.lengthImage }), length.formatLength(this.currentTrek.length_2d)), index.h("div", { class: "icon-label ascent" }, index.h("div", { class: "svg-icon", innerHTML: length.ascentImage }), length.formatAscent(this.currentTrek.ascent))), index.h("div", { class: "row" }, index.h("div", { class: "icon-label route" }, ((_e = this.route) === null || _e === void 0 ? void 0 : _e.pictogram) && index.h("img", { src: this.route.pictogram }), (_f = this.route) === null || _f === void 0 ? void 0 :
41
+ _f.route), index.h("div", { class: "icon-label practice" }, ((_g = this.practice) === null || _g === void 0 ? void 0 : _g.pictogram) && index.h("img", { src: this.practice.pictogram }), (_h = this.practice) === null || _h === void 0 ? void 0 :
42
+ _h.name))))))));
43
+ }
44
+ };
45
+ GrwTrekCard.style = grwTrekCardCss;
46
+
47
+ exports.grw_trek_card = GrwTrekCard;
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ function formatDuration(duration) {
4
+ let formattedDuration;
5
+ if (duration < 24) {
6
+ formattedDuration = `${Math.floor(duration)}h`;
7
+ if (duration % 1 > 0) {
8
+ formattedDuration += `${Math.round(60 * (duration % 1))}min`;
9
+ }
10
+ }
11
+ else {
12
+ formattedDuration = `${duration / 24}j`;
13
+ }
14
+ return formattedDuration;
15
+ }
16
+ function formatLength(length) {
17
+ return `${Math.round(length / 1000)}km`;
18
+ }
19
+ function formatAscent(ascent) {
20
+ return `${ascent}m`;
21
+ }
22
+
23
+ const ascentImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><polyline points="352 144 464 144 464 256" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><path d="M48,368,169.37,246.63a32,32,0,0,1,45.26,0l50.74,50.74a32,32,0,0,0,45.26,0L448,160" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>`;
24
+
25
+ const durationImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M145.61,464H366.39c19.8,0,35.55-16.29,33.42-35.06C386.06,308,304,310,304,256s83.11-51,95.8-172.94c2-18.78-13.61-35.06-33.41-35.06H145.61c-19.8,0-35.37,16.28-33.41,35.06C124.89,205,208,201,208,256s-82.06,52-95.8,172.94C110.06,447.71,125.81,464,145.61,464Z" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><path d="M343.3,432H169.13c-15.6,0-20-18-9.06-29.16C186.55,376,240,356.78,240,326V224c0-19.85-38-35-61.51-67.2-3.88-5.31-3.49-12.8,6.37-12.8H327.59c8.41,0,10.23,7.43,6.4,12.75C310.82,189,272,204.05,272,224V326c0,30.53,55.71,47,80.4,76.87C362.35,414.91,358.87,432,343.3,432Z"/></svg>`;
26
+
27
+ 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>`;
28
+
29
+ exports.ascentImage = ascentImage;
30
+ exports.durationImage = durationImage;
31
+ exports.formatAscent = formatAscent;
32
+ exports.formatDuration = formatDuration;
33
+ exports.formatLength = formatLength;
34
+ exports.lengthImage = lengthImage;
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["grw-app_11.cjs",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"appName":[1,"app-name"],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[8],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}],[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}],[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]]], options);
17
+ return index.bootstrapLazy([["grw-trek-card.cjs",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3.cjs",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6.cjs",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app.cjs",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[8],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -0,0 +1,211 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-c2c4531d.js');
4
+
5
+ const appendToMap = (map, propName, value) => {
6
+ const items = map.get(propName);
7
+ if (!items) {
8
+ map.set(propName, [value]);
9
+ }
10
+ else if (!items.includes(value)) {
11
+ items.push(value);
12
+ }
13
+ };
14
+ const debounce = (fn, ms) => {
15
+ let timeoutId;
16
+ return (...args) => {
17
+ if (timeoutId) {
18
+ clearTimeout(timeoutId);
19
+ }
20
+ timeoutId = setTimeout(() => {
21
+ timeoutId = 0;
22
+ fn(...args);
23
+ }, ms);
24
+ };
25
+ };
26
+
27
+ /**
28
+ * Check if a possible element isConnected.
29
+ * The property might not be there, so we check for it.
30
+ *
31
+ * We want it to return true if isConnected is not a property,
32
+ * otherwise we would remove these elements and would not update.
33
+ *
34
+ * Better leak in Edge than to be useless.
35
+ */
36
+ const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
37
+ const cleanupElements = debounce((map) => {
38
+ for (let key of map.keys()) {
39
+ map.set(key, map.get(key).filter(isConnected));
40
+ }
41
+ }, 2000);
42
+ const stencilSubscription = () => {
43
+ if (typeof index.getRenderingRef !== 'function') {
44
+ // If we are not in a stencil project, we do nothing.
45
+ // This function is not really exported by @stencil/core.
46
+ return {};
47
+ }
48
+ const elmsToUpdate = new Map();
49
+ return {
50
+ dispose: () => elmsToUpdate.clear(),
51
+ get: (propName) => {
52
+ const elm = index.getRenderingRef();
53
+ if (elm) {
54
+ appendToMap(elmsToUpdate, propName, elm);
55
+ }
56
+ },
57
+ set: (propName) => {
58
+ const elements = elmsToUpdate.get(propName);
59
+ if (elements) {
60
+ elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
61
+ }
62
+ cleanupElements(elmsToUpdate);
63
+ },
64
+ reset: () => {
65
+ elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
66
+ cleanupElements(elmsToUpdate);
67
+ },
68
+ };
69
+ };
70
+
71
+ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
72
+ let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
73
+ const handlers = {
74
+ dispose: [],
75
+ get: [],
76
+ set: [],
77
+ reset: [],
78
+ };
79
+ const reset = () => {
80
+ states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
81
+ handlers.reset.forEach((cb) => cb());
82
+ };
83
+ const dispose = () => {
84
+ // Call first dispose as resetting the state would
85
+ // cause less updates ;)
86
+ handlers.dispose.forEach((cb) => cb());
87
+ reset();
88
+ };
89
+ const get = (propName) => {
90
+ handlers.get.forEach((cb) => cb(propName));
91
+ return states.get(propName);
92
+ };
93
+ const set = (propName, value) => {
94
+ const oldValue = states.get(propName);
95
+ if (shouldUpdate(value, oldValue, propName)) {
96
+ states.set(propName, value);
97
+ handlers.set.forEach((cb) => cb(propName, value, oldValue));
98
+ }
99
+ };
100
+ const state = (typeof Proxy === 'undefined'
101
+ ? {}
102
+ : new Proxy(defaultState, {
103
+ get(_, propName) {
104
+ return get(propName);
105
+ },
106
+ ownKeys(_) {
107
+ return Array.from(states.keys());
108
+ },
109
+ getOwnPropertyDescriptor() {
110
+ return {
111
+ enumerable: true,
112
+ configurable: true,
113
+ };
114
+ },
115
+ has(_, propName) {
116
+ return states.has(propName);
117
+ },
118
+ set(_, propName, value) {
119
+ set(propName, value);
120
+ return true;
121
+ },
122
+ }));
123
+ const on = (eventName, callback) => {
124
+ handlers[eventName].push(callback);
125
+ return () => {
126
+ removeFromArray(handlers[eventName], callback);
127
+ };
128
+ };
129
+ const onChange = (propName, cb) => {
130
+ const unSet = on('set', (key, newValue) => {
131
+ if (key === propName) {
132
+ cb(newValue);
133
+ }
134
+ });
135
+ const unReset = on('reset', () => cb(defaultState[propName]));
136
+ return () => {
137
+ unSet();
138
+ unReset();
139
+ };
140
+ };
141
+ const use = (...subscriptions) => {
142
+ const unsubs = subscriptions.reduce((unsubs, subscription) => {
143
+ if (subscription.set) {
144
+ unsubs.push(on('set', subscription.set));
145
+ }
146
+ if (subscription.get) {
147
+ unsubs.push(on('get', subscription.get));
148
+ }
149
+ if (subscription.reset) {
150
+ unsubs.push(on('reset', subscription.reset));
151
+ }
152
+ if (subscription.dispose) {
153
+ unsubs.push(on('dispose', subscription.dispose));
154
+ }
155
+ return unsubs;
156
+ }, []);
157
+ return () => unsubs.forEach((unsub) => unsub());
158
+ };
159
+ const forceUpdate = (key) => {
160
+ const oldValue = states.get(key);
161
+ handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
162
+ };
163
+ return {
164
+ state,
165
+ get,
166
+ set,
167
+ on,
168
+ onChange,
169
+ use,
170
+ dispose,
171
+ reset,
172
+ forceUpdate,
173
+ };
174
+ };
175
+ const removeFromArray = (array, item) => {
176
+ const index = array.indexOf(item);
177
+ if (index >= 0) {
178
+ array[index] = array[array.length - 1];
179
+ array.length--;
180
+ }
181
+ };
182
+
183
+ const createStore = (defaultState, shouldUpdate) => {
184
+ const map = createObservableMap(defaultState, shouldUpdate);
185
+ map.use(stencilSubscription());
186
+ return map;
187
+ };
188
+
189
+ const { state, onChange } = createStore({
190
+ api: '',
191
+ treks: [],
192
+ currentTreks: [],
193
+ treksWithinBounds: [],
194
+ currentMapTreksBounds: null,
195
+ difficulties: [],
196
+ routes: [],
197
+ practices: [],
198
+ themes: [],
199
+ durations: [],
200
+ currentSensitiveAreas: null,
201
+ labels: null,
202
+ sources: null,
203
+ accessibilities: null,
204
+ accessibilitiesLevel: null,
205
+ currentTrek: null,
206
+ currentPois: null,
207
+ currentInformationDesks: null,
208
+ });
209
+
210
+ exports.onChange = onChange;
211
+ exports.state = state;
@@ -4,11 +4,11 @@ import arrowBackImage from '../../assets/arrow-back.svg';
4
4
  export class GrwApp {
5
5
  constructor() {
6
6
  this.showTrek = false;
7
- this.showMap = false;
7
+ this.showTreksMap = false;
8
+ this.showTrekMap = false;
8
9
  this.showFilters = false;
9
10
  this.isLargeView = false;
10
11
  this.language = 'fr';
11
- this.appName = 'Geotrek Rando Widget';
12
12
  this.colorPrimary = '#6b0030';
13
13
  this.colorPrimaryShade = '#4a0021';
14
14
  this.colorPrimaryTint = '#974c6e';
@@ -17,11 +17,15 @@ export class GrwApp {
17
17
  this.colorArrivalIcon = '#85003b';
18
18
  this.colorSensitiveArea = '#4974a5';
19
19
  this.colorPoiIcon = '#974c6e';
20
+ this.handlePopStateBind = this.handlePopState.bind(this);
20
21
  this.largeViewSize = 1024;
21
22
  }
22
23
  onTrekCardPress(event) {
23
24
  this.currentTrekId = event.detail;
24
25
  this.showTrek = !this.showTrek;
26
+ const url = new URL(window.location.toString());
27
+ url.searchParams.set('trek', this.currentTrekId.toString());
28
+ window.history.pushState({}, '', url);
25
29
  }
26
30
  onWindowResize() {
27
31
  this.handleView();
@@ -31,6 +35,14 @@ export class GrwApp {
31
35
  }
32
36
  componentDidLoad() {
33
37
  this.handleView();
38
+ window.addEventListener('popstate', this.handlePopStateBind, false);
39
+ const url = new URL(window.location.toString());
40
+ const trekParam = url.searchParams.get('trek');
41
+ if (trekParam) {
42
+ window.history.replaceState({ isInitialHistoryWithTrek: true }, '', url);
43
+ this.currentTrekId = Number(trekParam);
44
+ this.showTrek = !this.showTrek;
45
+ }
34
46
  }
35
47
  onTrekDetailsClose() {
36
48
  this.currentTrekId = null;
@@ -38,18 +50,52 @@ export class GrwApp {
38
50
  }
39
51
  handleView() {
40
52
  this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
41
- this.showMap = this.isLargeView;
53
+ this.showTreksMap = this.isLargeView;
54
+ this.showTrekMap = this.isLargeView;
42
55
  }
43
56
  handleFilters() {
44
57
  this.showFilters = !this.showFilters;
45
58
  }
59
+ handleBackButton() {
60
+ if (window.history.state.isInitialHistoryWithTrek) {
61
+ this.onTrekDetailsClose();
62
+ const url = new URL(window.location.toString());
63
+ url.searchParams.delete('trek');
64
+ window.history.pushState({}, '', url);
65
+ }
66
+ else {
67
+ window.history.back();
68
+ }
69
+ }
70
+ handlePopState() {
71
+ const url = new URL(window.location.toString());
72
+ const trekParam = url.searchParams.get('trek');
73
+ if (trekParam) {
74
+ this.currentTrekId = Number(trekParam);
75
+ this.showTrek = !this.showTrek;
76
+ }
77
+ else {
78
+ this.onTrekDetailsClose();
79
+ }
80
+ }
81
+ handleShowMap() {
82
+ if (this.currentTrekId) {
83
+ this.showTrekMap = !this.showTrekMap;
84
+ }
85
+ else {
86
+ this.showTreksMap = !this.showTreksMap;
87
+ }
88
+ }
89
+ disconnectedCallback() {
90
+ window.removeEventListener('popstate', this.handlePopStateBind);
91
+ }
46
92
  render() {
47
93
  return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } },
48
94
  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 }),
49
95
  this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }),
50
96
  h("div", { class: "app-container" },
51
97
  h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' },
52
- this.showTrek ? (h("div", { onClick: () => this.onTrekDetailsClose(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")),
98
+ this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")),
53
99
  !this.showTrek && this.showFilters && (h("div", { class: "options-container" },
54
100
  h("div", { class: "filters-container" },
55
101
  h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`),
@@ -70,9 +116,9 @@ export class GrwApp {
70
116
  h("span", { class: "loader" }))),
71
117
  state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' },
72
118
  h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))),
73
- 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 })),
119
+ h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: (this.showTreksMap && !this.showTrek) || (this.showTrekMap && this.showTrek) ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint, "color-trek-line": this.colorTrekLine, "color-departure-icon": this.colorDepartureIcon, "color-arrival-icon": this.colorArrivalIcon, "color-sensitive-area": this.colorSensitiveArea, "color-poi-icon": this.colorPoiIcon })),
74
120
  h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } },
75
- h("div", { onClick: () => (this.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
121
+ h("div", { onClick: () => this.handleShowMap() }, this.showTreksMap || this.showTrekMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
76
122
  }
77
123
  static get is() { return "grw-app"; }
78
124
  static get encapsulation() { return "shadow"; }
@@ -254,24 +300,6 @@ export class GrwApp {
254
300
  "attribute": "practices",
255
301
  "reflect": false
256
302
  },
257
- "appName": {
258
- "type": "string",
259
- "mutable": false,
260
- "complexType": {
261
- "original": "string",
262
- "resolved": "string",
263
- "references": {}
264
- },
265
- "required": false,
266
- "optional": false,
267
- "docs": {
268
- "tags": [],
269
- "text": ""
270
- },
271
- "attribute": "app-name",
272
- "reflect": false,
273
- "defaultValue": "'Geotrek Rando Widget'"
274
- },
275
303
  "urlLayer": {
276
304
  "type": "string",
277
305
  "mutable": false,
@@ -487,7 +515,8 @@ export class GrwApp {
487
515
  }; }
488
516
  static get states() { return {
489
517
  "showTrek": {},
490
- "showMap": {},
518
+ "showTreksMap": {},
519
+ "showTrekMap": {},
491
520
  "showFilters": {},
492
521
  "isLargeView": {},
493
522
  "currentTrekId": {}
@@ -1,7 +1,9 @@
1
1
  :host {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- padding: 0px 8px 8px 8px;
4
+ }
5
+ :host a {
6
+ color: var(--color-primary);
5
7
  }
6
8
 
7
9
  .information-desk-img {
@@ -12,17 +14,16 @@
12
14
  border-radius: 8px;
13
15
  }
14
16
 
15
- .information-desk-right-container {
17
+ .information-desk-sub-container {
16
18
  display: flex;
17
19
  flex-direction: column;
18
- padding: 8px;
19
20
  }
20
21
 
21
22
  .information-desk-name {
22
23
  color: var(--color-primary);
23
24
  font-size: 24px;
24
25
  font-weight: bold;
25
- padding: 0px 0px 8px 0px;
26
+ padding: 12px 0px;
26
27
  }
27
28
 
28
29
  .information-desk-description {
@@ -4,7 +4,7 @@ export class GrwInformationDeskDetail {
4
4
  return (h(Host, null,
5
5
  this.informationDesk.photo_url && (h("div", { class: "information-desk-img" },
6
6
  h("img", { src: this.informationDesk.photo_url, loading: "lazy" }))),
7
- h("div", { class: "information-desk-right-container" },
7
+ h("div", { class: "information-desk-sub-container" },
8
8
  this.informationDesk.name && h("div", { class: "information-desk-name" }, this.informationDesk.name),
9
9
  this.informationDesk.description && h("div", { class: "information-desk-description", innerHTML: this.informationDesk.description }),
10
10
  this.informationDesk.postal_code ||
@@ -750,8 +750,13 @@ grw-map {
750
750
 
751
751
  .poi-tooltip .poi-name,
752
752
  .poi-tooltip .information-desks-name,
753
+ .poi-tooltip .sensitive-area-name,
753
754
  .information-desks-tooltip .poi-name,
754
- .information-desks-tooltip .information-desks-name {
755
+ .information-desks-tooltip .information-desks-name,
756
+ .information-desks-tooltip .sensitive-area-name,
757
+ .sensitive-area-tooltip .poi-name,
758
+ .sensitive-area-tooltip .information-desks-name,
759
+ .sensitive-area-tooltip .sensitive-area-name {
755
760
  color: var(--color-primary);
756
761
  font-weight: bold;
757
762
  font-size: 12px;
@@ -800,4 +805,17 @@ grw-map {
800
805
  height: 48px;
801
806
  font-size: 24px;
802
807
  color: #ffffff;
808
+ }
809
+
810
+ .point-reference-icon {
811
+ background-color: #ff0000;
812
+ border: 1px solid #ffffff;
813
+ border-radius: 50%;
814
+ display: flex;
815
+ justify-content: center;
816
+ align-items: center;
817
+ width: 24px;
818
+ height: 24px;
819
+ font-size: 18px;
820
+ color: #ffffff;
803
821
  }