@geotrekce/geotrek-rando-widget 0.0.2 → 0.0.3

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 (71) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +1 -1
  2. package/dist/cjs/{grw-app_7.cjs.entry.js → grw-app_10.cjs.entry.js} +275 -47
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +3 -0
  5. package/dist/collection/components/grw-app/grw-app.css +1 -0
  6. package/dist/collection/components/grw-app/grw-app.js +82 -6
  7. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +30 -0
  8. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +53 -0
  9. package/dist/collection/components/grw-map/grw-map.css +81 -0
  10. package/dist/collection/components/grw-map/grw-map.js +255 -31
  11. package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +30 -0
  12. package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +41 -0
  13. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +16 -0
  14. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +38 -0
  15. package/dist/collection/components/grw-trek-card/grw-trek-card.css +3 -0
  16. package/dist/collection/components/grw-trek-card/grw-trek-card.js +4 -4
  17. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +35 -0
  18. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +40 -6
  19. package/dist/collection/components/grw-treks-list/grw-treks-list.css +1 -0
  20. package/dist/collection/components/grw-treks-list/grw-treks-list.js +2 -2
  21. package/dist/collection/store/grw-trek-provider.js +11 -5
  22. package/dist/collection/store/grw-treks-provider.js +3 -3
  23. package/dist/collection/store/store.js +3 -0
  24. package/dist/collection/stories/App.js +14 -6
  25. package/dist/collection/stories/App.stories.js +10 -6
  26. package/dist/collection/stories/TrekCard.js +2 -1
  27. package/dist/collection/stories/TrekCard.stories.js +4 -3
  28. package/dist/collection/stories/TrekDetail.js +3 -1
  29. package/dist/collection/stories/TrekDetail.stories.js +5 -3
  30. package/dist/collection/stories/TrekMap.js +6 -4
  31. package/dist/collection/stories/TrekMap.stories.js +7 -5
  32. package/dist/collection/stories/TreksList.js +2 -1
  33. package/dist/collection/stories/TreksList.stories.js +4 -3
  34. package/dist/collection/stories/TreksMap.stories.js +3 -3
  35. package/dist/collection/utils/utils.js +2 -2
  36. package/dist/components/grw-app.js +31 -5
  37. package/dist/components/grw-information-desk-detail.d.ts +11 -0
  38. package/dist/components/grw-information-desk-detail.js +6 -0
  39. package/dist/components/grw-information-desk-detail2.js +34 -0
  40. package/dist/components/grw-map2.js +203 -28
  41. package/dist/components/grw-poi-detail.d.ts +11 -0
  42. package/dist/components/grw-poi-detail.js +6 -0
  43. package/dist/components/grw-poi-detail2.js +32 -0
  44. package/dist/components/grw-sensitive-area-detail.d.ts +11 -0
  45. package/dist/components/grw-sensitive-area-detail.js +6 -0
  46. package/dist/components/grw-sensitive-area-detail2.js +32 -0
  47. package/dist/components/grw-trek-card2.js +3 -3
  48. package/dist/components/grw-trek-detail2.js +25 -5
  49. package/dist/components/grw-trek-provider2.js +11 -5
  50. package/dist/components/grw-treks-list2.js +2 -2
  51. package/dist/components/grw-treks-provider2.js +3 -3
  52. package/dist/components/length.js +2 -2
  53. package/dist/components/store.js +3 -0
  54. package/dist/esm/geotrek-rando-widget.js +1 -1
  55. package/dist/esm/{grw-app_7.entry.js → grw-app_10.entry.js} +273 -48
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/geotrek-rando-widget/geotrek-rando-widget.css +1 -1
  58. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  59. package/dist/geotrek-rando-widget/p-73bc92fe.entry.js +1 -0
  60. package/dist/types/components/grw-app/grw-app.d.ts +4 -0
  61. package/dist/types/components/grw-information-desk-detail/grw-information-desk-detail.d.ts +5 -0
  62. package/dist/types/components/grw-map/grw-map.d.ts +13 -4
  63. package/dist/types/components/grw-poi-detail/grw-poi-detail.d.ts +5 -0
  64. package/dist/types/components/grw-sensitive-area-detail/grw-sensitive-area-detail.d.ts +5 -0
  65. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +1 -0
  66. package/dist/types/components.d.ts +65 -1
  67. package/dist/types/store/store.d.ts +7 -1
  68. package/dist/types/types/types.d.ts +46 -3
  69. package/package.json +5 -7
  70. package/readme.md +20 -1
  71. package/dist/geotrek-rando-widget/p-b7c66d2d.entry.js +0 -1
@@ -11,16 +11,22 @@ const GrwTrekProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
11
11
  componentWillLoad() {
12
12
  state.api = this.api;
13
13
  return Promise.all([
14
- fetch(`${this.api}trek_difficulty/?language=${this.language}`),
15
- fetch(`${this.api}trek_route/?language=${this.language}`),
16
- fetch(`${this.api}trek_practice/?language=${this.language}`),
17
- fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,route,geometry`),
14
+ fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
15
+ fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
16
+ fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
17
+ fetch(`${this.api}sensitivearea/?language=${this.language}&trek=${this.trekId}&fields=id,geometry,name,description`).catch(() => new Response('[]')),
18
+ 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`),
19
+ 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`),
20
+ fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,route,geometry,gpx,kml,pdf,parking_location`),
18
21
  ])
19
22
  .then(responses => Promise.all(responses.map(response => response.json())))
20
- .then(([difficulties, routes, practices, trek]) => {
23
+ .then(([difficulties, routes, practices, sensitiveAreas, pois, informationDesks, trek]) => {
21
24
  state.difficulties = difficulties.results;
22
25
  state.routes = routes.results;
23
26
  state.practices = practices.results;
27
+ state.currentSensitiveAreas = sensitiveAreas.results;
28
+ state.currentPois = pois.results;
29
+ state.currentInformationDesks = informationDesks.results;
24
30
  state.currentTrek = trek;
25
31
  });
26
32
  }
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal
2
2
  import { o as onChange, s as state } from './store.js';
3
3
  import { d as defineCustomElement$1 } from './grw-trek-card2.js';
4
4
 
5
- const grwTreksListCss = ":host{display:flex;flex-wrap:wrap;justify-content:space-around;height:100%;max-height:100vh;overflow-y:auto}grw-trek-card{margin:6px}";
5
+ const grwTreksListCss = ":host{font-family:\"Roboto\";display:flex;flex-wrap:wrap;justify-content:space-around;height:100%;max-height:100vh;overflow-y:auto}grw-trek-card{margin:6px}";
6
6
 
7
7
  const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
8
  constructor() {
@@ -11,7 +11,7 @@ const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11
11
  this.__attachShadow();
12
12
  this.treksToDisplay = [];
13
13
  this.colorPrimary = '#6b0030';
14
- this.colorPrimaryTint = '#d2b2c0';
14
+ this.colorPrimaryTint = '#974c6e';
15
15
  this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
16
16
  this.step = 10;
17
17
  }
@@ -21,9 +21,9 @@ const GrwTreksProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
21
21
  this.practices && (treksRequest += `&practices=${this.practices}`);
22
22
  treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,route,departure_geom&page_size=999`;
23
23
  return Promise.all([
24
- fetch(`${this.api}trek_difficulty/?language=${this.language}`),
25
- fetch(`${this.api}trek_route/?language=${this.language}`),
26
- fetch(`${this.api}trek_practice/?language=${this.language}`),
24
+ fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
25
+ fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
26
+ fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
27
27
  fetch(treksRequest),
28
28
  ])
29
29
  .then(responses => Promise.all(responses.map(response => response.json())))
@@ -12,10 +12,10 @@ function formatDuration(duration) {
12
12
  return formattedDuration;
13
13
  }
14
14
  function formatLength(length) {
15
- return `${Math.round(length / 1000)} km`;
15
+ return `${Math.round(length / 1000)}km`;
16
16
  }
17
17
  function formatAscent(ascent) {
18
- return `${ascent} m`;
18
+ return `${ascent}m`;
19
19
  }
20
20
 
21
21
  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>`;
@@ -190,7 +190,10 @@ const { state, onChange } = createStore({
190
190
  difficulties: [],
191
191
  routes: [],
192
192
  practices: [],
193
+ currentSensitiveAreas: null,
194
+ currentPois: null,
193
195
  currentTrek: null,
196
+ currentInformationDesks: null,
194
197
  });
195
198
 
196
199
  export { onChange as o, state as s };
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["grw-app_7",[[1,"grw-app",{"api":[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"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"showTrek":[32],"showMap":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[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],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"mapIsReady":[32]}],[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[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-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}]]]], options);
16
+ return bootstrapLazy([["grw-app_10",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"appName":[1,"app-name"],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[8],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showMap":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"treksToDisplay":[32]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}],[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}],[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32]}]]]], options);
17
17
  });