@geotrekce/geotrek-rando-widget 0.0.3 → 0.0.6

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 (80) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/grw-app.cjs.entry.js +111 -0
  3. package/dist/cjs/{grw-app_10.cjs.entry.js → grw-filter_6.cjs.entry.js} +284 -446
  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/{index-c6f73e30.js → index-c2c4531d.js} +46 -1
  7. package/dist/cjs/length-d315d156.js +34 -0
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/cjs/store-fd04a216.js +211 -0
  10. package/dist/collection/collection-manifest.json +1 -0
  11. package/dist/collection/components/grw-app/grw-app.css +69 -5
  12. package/dist/collection/components/grw-app/grw-app.js +76 -28
  13. package/dist/collection/components/grw-filter/grw-filter.css +29 -0
  14. package/dist/collection/components/grw-filter/grw-filter.js +132 -0
  15. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +5 -4
  16. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +1 -1
  17. package/dist/collection/components/grw-map/grw-map.css +19 -1
  18. package/dist/collection/components/grw-map/grw-map.js +101 -40
  19. package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +5 -4
  20. package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +1 -1
  21. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +27 -3
  22. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +17 -3
  23. package/dist/collection/components/grw-trek-card/grw-trek-card.css +66 -32
  24. package/dist/collection/components/grw-trek-card/grw-trek-card.js +34 -10
  25. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +134 -4
  26. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +95 -6
  27. package/dist/collection/components/grw-treks-list/grw-treks-list.css +16 -3
  28. package/dist/collection/components/grw-treks-list/grw-treks-list.js +33 -6
  29. package/dist/collection/store/grw-trek-provider.js +32 -10
  30. package/dist/collection/store/grw-treks-provider.js +14 -4
  31. package/dist/collection/store/store.js +10 -1
  32. package/dist/collection/stories/App.js +8 -10
  33. package/dist/collection/stories/App.stories.js +4 -3
  34. package/dist/collection/stories/TrekMap.stories.js +3 -2
  35. package/dist/collection/stories/TreksList.js +8 -8
  36. package/dist/collection/stories/TreksMap.stories.js +3 -2
  37. package/dist/components/grw-app.js +66 -9
  38. package/dist/components/grw-filter.d.ts +11 -0
  39. package/dist/components/grw-filter.js +6 -0
  40. package/dist/components/grw-filter2.js +95 -0
  41. package/dist/components/grw-information-desk-detail2.js +2 -2
  42. package/dist/components/grw-map2.js +102 -41
  43. package/dist/components/grw-poi-detail2.js +2 -2
  44. package/dist/components/grw-sensitive-area-detail2.js +7 -2
  45. package/dist/components/grw-trek-card2.js +10 -5
  46. package/dist/components/grw-trek-detail2.js +25 -4
  47. package/dist/components/grw-trek-provider2.js +32 -10
  48. package/dist/components/grw-treks-list2.js +15 -7
  49. package/dist/components/grw-treks-provider2.js +14 -4
  50. package/dist/components/store.js +10 -1
  51. package/dist/esm/geotrek-rando-widget.js +2 -2
  52. package/dist/esm/grw-app.entry.js +107 -0
  53. package/dist/esm/{grw-app_10.entry.js → grw-filter_6.entry.js} +246 -404
  54. package/dist/esm/grw-information-desk-detail_3.entry.js +46 -0
  55. package/dist/esm/grw-trek-card.entry.js +43 -0
  56. package/dist/esm/{index-7aa9e822.js → index-192d910f.js} +47 -2
  57. package/dist/esm/length-d82189db.js +27 -0
  58. package/dist/esm/loader.js +2 -2
  59. package/dist/esm/store-b2c76c0c.js +208 -0
  60. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  61. package/dist/geotrek-rando-widget/p-1b2ba86d.entry.js +1 -0
  62. package/dist/geotrek-rando-widget/p-5f17d340.entry.js +1 -0
  63. package/dist/geotrek-rando-widget/p-6716c635.entry.js +1 -0
  64. package/dist/geotrek-rando-widget/p-6dce5e6c.js +2 -0
  65. package/dist/geotrek-rando-widget/p-7715153d.entry.js +1 -0
  66. package/dist/geotrek-rando-widget/p-e6710c64.js +1 -0
  67. package/dist/geotrek-rando-widget/p-f3f7d6be.js +1 -0
  68. package/dist/types/components/grw-app/grw-app.d.ts +9 -2
  69. package/dist/types/components/grw-filter/grw-filter.d.ts +9 -0
  70. package/dist/types/components/grw-map/grw-map.d.ts +3 -1
  71. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +6 -4
  72. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +9 -4
  73. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +1 -0
  74. package/dist/types/components.d.ts +23 -2
  75. package/dist/types/store/store.d.ts +22 -3
  76. package/dist/types/types/types.d.ts +74 -1
  77. package/package.json +5 -4
  78. package/readme.md +4 -5
  79. package/dist/geotrek-rando-widget/p-332ba9ab.js +0 -2
  80. package/dist/geotrek-rando-widget/p-73bc92fe.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-c6f73e30.js');
3
+ const index = require('./index-c2c4531d.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["grw-app_10.cjs",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"appName":[1,"app-name"],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[8],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showMap":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"treksToDisplay":[32]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}],[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}],[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}]]]], options);
18
+ return index.bootstrapLazy([["grw-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);
19
19
  });
@@ -0,0 +1,111 @@
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 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>`;
9
+
10
+ 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%}";
11
+
12
+ const GrwApp = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ this.showTrek = false;
16
+ this.showTreksMap = false;
17
+ this.showTrekMap = false;
18
+ this.showFilters = false;
19
+ this.isLargeView = false;
20
+ this.language = 'fr';
21
+ this.colorPrimary = '#6b0030';
22
+ this.colorPrimaryShade = '#4a0021';
23
+ this.colorPrimaryTint = '#974c6e';
24
+ this.colorTrekLine = '#6b0030';
25
+ this.colorDepartureIcon = '#006b3b';
26
+ this.colorArrivalIcon = '#85003b';
27
+ this.colorSensitiveArea = '#4974a5';
28
+ this.colorPoiIcon = '#974c6e';
29
+ this.handlePopStateBind = this.handlePopState.bind(this);
30
+ this.largeViewSize = 1024;
31
+ }
32
+ onTrekCardPress(event) {
33
+ this.currentTrekId = event.detail;
34
+ this.showTrek = !this.showTrek;
35
+ const url = new URL(window.location.toString());
36
+ url.searchParams.set('trek', this.currentTrekId.toString());
37
+ window.history.pushState({}, '', url);
38
+ }
39
+ onWindowResize() {
40
+ this.handleView();
41
+ }
42
+ watchPropHandler() {
43
+ window.dispatchEvent(new window.Event('resize'));
44
+ }
45
+ componentDidLoad() {
46
+ this.handleView();
47
+ window.addEventListener('popstate', this.handlePopStateBind, false);
48
+ const url = new URL(window.location.toString());
49
+ const trekParam = url.searchParams.get('trek');
50
+ if (trekParam) {
51
+ window.history.replaceState({ isInitialHistoryWithTrek: true }, '', url);
52
+ this.currentTrekId = Number(trekParam);
53
+ this.showTrek = !this.showTrek;
54
+ }
55
+ }
56
+ onTrekDetailsClose() {
57
+ this.currentTrekId = null;
58
+ this.showTrek = !this.showTrek;
59
+ }
60
+ handleView() {
61
+ this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
62
+ this.showTreksMap = this.isLargeView;
63
+ this.showTrekMap = this.isLargeView;
64
+ }
65
+ handleFilters() {
66
+ this.showFilters = !this.showFilters;
67
+ }
68
+ handleBackButton() {
69
+ if (window.history.state.isInitialHistoryWithTrek) {
70
+ this.onTrekDetailsClose();
71
+ const url = new URL(window.location.toString());
72
+ url.searchParams.delete('trek');
73
+ window.history.pushState({}, '', url);
74
+ }
75
+ else {
76
+ window.history.back();
77
+ }
78
+ }
79
+ handlePopState() {
80
+ const url = new URL(window.location.toString());
81
+ const trekParam = url.searchParams.get('trek');
82
+ if (trekParam) {
83
+ this.currentTrekId = Number(trekParam);
84
+ this.showTrek = !this.showTrek;
85
+ }
86
+ else {
87
+ this.onTrekDetailsClose();
88
+ }
89
+ }
90
+ handleShowMap() {
91
+ if (this.currentTrekId) {
92
+ this.showTrekMap = !this.showTrekMap;
93
+ }
94
+ else {
95
+ this.showTreksMap = !this.showTreksMap;
96
+ }
97
+ }
98
+ disconnectedCallback() {
99
+ window.removeEventListener('popstate', this.handlePopStateBind);
100
+ }
101
+ render() {
102
+ return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } }, index.h("grw-treks-provider", { api: this.api, language: this.language, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }), this.showTrek && this.currentTrekId && index.h("grw-trek-provider", { api: store.state.api, language: this.language, "trek-id": this.currentTrekId }), index.h("div", { class: "app-container" }, index.h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? (index.h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (index.h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")), !this.showTrek && this.showFilters && (index.h("div", { class: "options-container" }, index.h("div", { class: "filters-container" }, index.h("div", { class: "current-treks-length" }, `${store.state.currentTreks.length} résultat${store.state.currentTreks.length > 1 ? 's' : ''}`), index.h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"), index.h("div", null, index.h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })), index.h("div", { class: "filter-margin-top" }, index.h("grw-filter", { filterName: "Difficult\u00E9", filterType: "difficulties", filterNameProperty: "label" })), index.h("div", { class: "filter-margin-top" }, index.h("grw-filter", { filterName: "Dur\u00E9e", filterType: "durations", filterNameProperty: "name" }))), index.h("div", { onClick: () => this.handleFilters(), class: "back-filters-container" }))), index.h("div", { class: "attribution-container" }, index.h("a", { target: "_blank", href: "https://geotrek.fr" }, "GEOTREK"))), index.h("div", { class: "content-container" }, index.h("div", { class: this.isLargeView ? 'large-view-app-treks-list-container' : 'app-treks-list-container', style: { display: this.showTrek ? 'none' : 'flex', position: this.showTrek ? 'absolute' : 'relative' } }, index.h("grw-treks-list", { "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !store.state.currentTrek && (index.h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, index.h("span", { class: "loader" }))), store.state.currentTrek && (index.h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, index.h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), index.h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: (this.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 })), index.h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, index.h("div", { onClick: () => this.handleShowMap() }, this.showTreksMap || this.showTrekMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
103
+ }
104
+ get element() { return index.getElement(this); }
105
+ static get watchers() { return {
106
+ "isLargeView": ["watchPropHandler"]
107
+ }; }
108
+ };
109
+ GrwApp.style = grwAppCss;
110
+
111
+ exports.grw_app = GrwApp;