@geotrekce/geotrek-rando-widget 0.0.1

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 (103) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/geotrek-rando-widget.cjs.js +19 -0
  3. package/dist/cjs/grw-app_7.cjs.entry.js +14662 -0
  4. package/dist/cjs/index-31255e29.js +1262 -0
  5. package/dist/cjs/index.cjs.js +2 -0
  6. package/dist/cjs/loader.cjs.js +21 -0
  7. package/dist/collection/assets/arrow-back.svg +1 -0
  8. package/dist/collection/assets/ascent.svg +1 -0
  9. package/dist/collection/assets/departure-arrival.svg +1 -0
  10. package/dist/collection/assets/duration.svg +1 -0
  11. package/dist/collection/assets/length.svg +1 -0
  12. package/dist/collection/collection-manifest.json +18 -0
  13. package/dist/collection/components/grw-app/grw-app.css +112 -0
  14. package/dist/collection/components/grw-app/grw-app.js +156 -0
  15. package/dist/collection/components/grw-map/grw-map.css +686 -0
  16. package/dist/collection/components/grw-map/grw-map.js +187 -0
  17. package/dist/collection/components/grw-trek-card/grw-trek-card.css +66 -0
  18. package/dist/collection/components/grw-trek-card/grw-trek-card.js +90 -0
  19. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +58 -0
  20. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +74 -0
  21. package/dist/collection/components/grw-treks-list/grw-treks-list.css +21 -0
  22. package/dist/collection/components/grw-treks-list/grw-treks-list.js +38 -0
  23. package/dist/collection/index.js +1 -0
  24. package/dist/collection/store/grw-trek-provider.js +63 -0
  25. package/dist/collection/store/grw-treks-provider.js +65 -0
  26. package/dist/collection/store/store.js +11 -0
  27. package/dist/collection/stories/App.js +9 -0
  28. package/dist/collection/stories/App.stories.js +21 -0
  29. package/dist/collection/stories/TrekCard.js +7 -0
  30. package/dist/collection/stories/TrekCard.stories.js +18 -0
  31. package/dist/collection/stories/TrekDetail.js +7 -0
  32. package/dist/collection/stories/TrekDetail.stories.js +18 -0
  33. package/dist/collection/stories/TrekMap.js +11 -0
  34. package/dist/collection/stories/TrekMap.stories.js +21 -0
  35. package/dist/collection/stories/TreksList.js +6 -0
  36. package/dist/collection/stories/TreksList.stories.js +17 -0
  37. package/dist/collection/stories/TreksMap.js +7 -0
  38. package/dist/collection/stories/TreksMap.stories.js +17 -0
  39. package/dist/collection/types/types.js +1 -0
  40. package/dist/collection/utils/utils.js +19 -0
  41. package/dist/components/grw-app.d.ts +11 -0
  42. package/dist/components/grw-app.js +98 -0
  43. package/dist/components/grw-map.d.ts +11 -0
  44. package/dist/components/grw-map.js +6 -0
  45. package/dist/components/grw-map2.js +14288 -0
  46. package/dist/components/grw-trek-card.d.ts +11 -0
  47. package/dist/components/grw-trek-card.js +6 -0
  48. package/dist/components/grw-trek-card2.js +45 -0
  49. package/dist/components/grw-trek-detail.d.ts +11 -0
  50. package/dist/components/grw-trek-detail.js +6 -0
  51. package/dist/components/grw-trek-detail2.js +44 -0
  52. package/dist/components/grw-trek-provider.d.ts +11 -0
  53. package/dist/components/grw-trek-provider.js +6 -0
  54. package/dist/components/grw-trek-provider2.js +49 -0
  55. package/dist/components/grw-treks-list.d.ts +11 -0
  56. package/dist/components/grw-treks-list.js +6 -0
  57. package/dist/components/grw-treks-list2.js +57 -0
  58. package/dist/components/grw-treks-provider.d.ts +11 -0
  59. package/dist/components/grw-treks-provider.js +6 -0
  60. package/dist/components/grw-treks-provider2.js +51 -0
  61. package/dist/components/index.d.ts +26 -0
  62. package/dist/components/index.js +1 -0
  63. package/dist/components/length.js +27 -0
  64. package/dist/components/store.js +196 -0
  65. package/dist/esm/geotrek-rando-widget.js +17 -0
  66. package/dist/esm/grw-app_7.entry.js +14652 -0
  67. package/dist/esm/index-b36f38f5.js +1232 -0
  68. package/dist/esm/index.js +1 -0
  69. package/dist/esm/loader.js +17 -0
  70. package/dist/esm/polyfills/core-js.js +11 -0
  71. package/dist/esm/polyfills/css-shim.js +1 -0
  72. package/dist/esm/polyfills/dom.js +79 -0
  73. package/dist/esm/polyfills/es5-html-element.js +1 -0
  74. package/dist/esm/polyfills/index.js +34 -0
  75. package/dist/esm/polyfills/system.js +6 -0
  76. package/dist/geotrek-rando-widget/geotrek-rando-widget.css +1 -0
  77. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -0
  78. package/dist/geotrek-rando-widget/index.esm.js +0 -0
  79. package/dist/geotrek-rando-widget/p-f721481d.js +2 -0
  80. package/dist/geotrek-rando-widget/p-fe788eaa.entry.js +1 -0
  81. package/dist/index.cjs.js +1 -0
  82. package/dist/index.js +1 -0
  83. package/dist/types/components/grw-app/grw-app.d.ts +15 -0
  84. package/dist/types/components/grw-map/grw-map.d.ts +17 -0
  85. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +12 -0
  86. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +10 -0
  87. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +10 -0
  88. package/dist/types/components.d.ts +149 -0
  89. package/dist/types/index.d.ts +1 -0
  90. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  91. package/dist/types/store/grw-trek-provider.d.ts +7 -0
  92. package/dist/types/store/grw-treks-provider.d.ts +6 -0
  93. package/dist/types/store/store.d.ts +18 -0
  94. package/dist/types/types/types.d.ts +48 -0
  95. package/dist/types/utils/utils.d.ts +3 -0
  96. package/loader/cdn.js +3 -0
  97. package/loader/index.cjs.js +3 -0
  98. package/loader/index.d.ts +12 -0
  99. package/loader/index.es2017.js +3 -0
  100. package/loader/index.js +4 -0
  101. package/loader/package.json +10 -0
  102. package/package.json +57 -0
  103. package/readme.md +3 -0
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GrwTrekCard extends Components.GrwTrekCard, HTMLElement {}
4
+ export const GrwTrekCard: {
5
+ prototype: GrwTrekCard;
6
+ new (): GrwTrekCard;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { G as GrwTrekCard$1, d as defineCustomElement$1 } from './grw-trek-card2.js';
2
+
3
+ const GrwTrekCard = GrwTrekCard$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { GrwTrekCard, defineCustomElement };
@@ -0,0 +1,45 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { s as state } from './store.js';
3
+ import { d as durationImage, f as formatDuration, l as lengthImage, a as formatLength, b as ascentImage, c as formatAscent } from './length.js';
4
+
5
+ const grwTrekCardCss = ".trek-card-container{width:350px;height:auto;border-radius:8px;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25);cursor:pointer}.trek-card-container .image{width:100%;height:auto}.trek-card-container .sub-container{padding:12px}.trek-card-container .sub-container .name{color:var(--color-primary);font-size:24px;font-weight:bold;margin-bottom:12px}.trek-card-container .sub-container .description{max-height:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:12px}.trek-card-container .sub-container .description p{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0}.trek-card-container .sub-container .icons-labels-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .icons-labels-container .row{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-card-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:12px}.trek-card-container .sub-container .icons-labels-container .row .icon-label{display:flex;justify-content:center;align-items:center;width:33.3333333333%}.trek-card-container .sub-container .icons-labels-container .row .icon-label:nth-child(2){margin:0px 4px}.trek-card-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg{width:24px;height:auto;margin-right:24px}.trek-card-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}";
6
+
7
+ const GrwTrekCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ this.trekCardPress = createEvent(this, "trekCardPress", 7);
13
+ }
14
+ componentWillLoad() {
15
+ this.currentTrek = this.trek ? this.trek : state.currentTrek;
16
+ this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
17
+ this.route = state.routes.find(route => route.id === this.currentTrek.route);
18
+ this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
19
+ }
20
+ render() {
21
+ var _a, _b, _c, _d, _e, _f, _g, _h;
22
+ return (h(Host, { onClick: () => this.trekCardPress.emit(this.currentTrek.id) }, h("div", { class: "trek-card-container" }, this.currentTrek.attachments[0] && h("img", { class: "image", src: this.currentTrek.attachments[0].url, loading: "lazy" }), h("div", { class: "sub-container" }, h("div", { class: "name" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.name), h("div", { class: "description", innerHTML: (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.description_teaser }), h("div", { class: "icons-labels-container" }, h("div", { class: "row" }, h("div", { class: "icon-label difficulty" }, ((_c = this.difficulty) === null || _c === void 0 ? void 0 : _c.pictogram) && h("img", { src: this.difficulty.pictogram }), (_d = this.difficulty) === null || _d === void 0 ? void 0 :
23
+ _d.label), h("div", { class: "icon-label duration" }, h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration(this.currentTrek.duration)), h("div", { class: "icon-label route" }, ((_e = this.route) === null || _e === void 0 ? void 0 : _e.pictogram) && h("img", { src: this.route.pictogram }), (_f = this.route) === null || _f === void 0 ? void 0 :
24
+ _f.route)), h("div", { class: "row" }, h("div", { class: "icon-label length" }, h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), h("div", { class: "icon-label ascent" }, h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent)), h("div", { class: "icon-label practice" }, ((_g = this.practice) === null || _g === void 0 ? void 0 : _g.pictogram) && h("img", { src: this.practice.pictogram }), (_h = this.practice) === null || _h === void 0 ? void 0 :
25
+ _h.name)))))));
26
+ }
27
+ static get style() { return grwTrekCardCss; }
28
+ }, [1, "grw-trek-card", {
29
+ "trek": [16]
30
+ }]);
31
+ function defineCustomElement() {
32
+ if (typeof customElements === "undefined") {
33
+ return;
34
+ }
35
+ const components = ["grw-trek-card"];
36
+ components.forEach(tagName => { switch (tagName) {
37
+ case "grw-trek-card":
38
+ if (!customElements.get(tagName)) {
39
+ customElements.define(tagName, GrwTrekCard);
40
+ }
41
+ break;
42
+ } });
43
+ }
44
+
45
+ export { GrwTrekCard as G, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GrwTrekDetail extends Components.GrwTrekDetail, HTMLElement {}
4
+ export const GrwTrekDetail: {
5
+ prototype: GrwTrekDetail;
6
+ new (): GrwTrekDetail;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { G as GrwTrekDetail$1, d as defineCustomElement$1 } from './grw-trek-detail2.js';
2
+
3
+ const GrwTrekDetail = GrwTrekDetail$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { GrwTrekDetail, defineCustomElement };
@@ -0,0 +1,44 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { s as state } from './store.js';
3
+ import { d as durationImage, f as formatDuration, l as lengthImage, a as formatLength, b as ascentImage, c as formatAscent } from './length.js';
4
+
5
+ const grwTrekDetailCss = ".trek-detail-container{display:flex;flex-direction:column;max-height:calc(100vh - 64px);overflow-y:auto}.trek-detail-container .name{color:var(--color-primary);font-size:48px;font-weight:bold;padding:24px}.trek-detail-container .image{align-self:center;width:100%;max-width:700px;height:auto;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25)}.trek-detail-container .sub-container{padding:24px}.trek-detail-container .sub-container .icons-labels-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-detail-container .sub-container .icons-labels-container .row{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-detail-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:24px}.trek-detail-container .sub-container .icons-labels-container .row .icon-label{display:flex;justify-content:center;align-items:center;width:33.3333333333%}.trek-detail-container .sub-container .icons-labels-container .row .icon-label:nth-child(2){margin:0px 8px}.trek-detail-container .sub-container .icons-labels-container .row .icon-label img,.trek-detail-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg{width:24px;height:auto;margin-right:24px}.trek-detail-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}.trek-detail-container .description{padding:0px 24px 24px 24px}";
6
+
7
+ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ }
13
+ componentWillLoad() {
14
+ this.currentTrek = this.trek ? this.trek : state.currentTrek;
15
+ this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
16
+ this.route = state.routes.find(route => route.id === this.currentTrek.route);
17
+ this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
18
+ }
19
+ render() {
20
+ var _a, _b, _c, _d, _e, _f, _g;
21
+ return (h(Host, null, h("div", { class: "trek-detail-container" }, h("div", { class: "name" }, this.currentTrek.name), this.currentTrek.attachments[0] && h("img", { class: "image", src: this.currentTrek.attachments[0].url, loading: "lazy" }), h("div", { class: "sub-container" }, h("div", { class: "icons-labels-container" }, h("div", { class: "row" }, h("div", { class: "icon-label difficulty" }, ((_a = this.difficulty) === null || _a === void 0 ? void 0 : _a.pictogram) && h("img", { src: this.difficulty.pictogram }), (_b = this.difficulty) === null || _b === void 0 ? void 0 :
22
+ _b.label), h("div", { class: "icon-label duration" }, h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration((_c = this.currentTrek) === null || _c === void 0 ? void 0 : _c.duration)), h("div", { class: "icon-label route" }, ((_d = this.route) === null || _d === void 0 ? void 0 : _d.pictogram) && h("img", { src: this.route.pictogram }), (_e = this.route) === null || _e === void 0 ? void 0 :
23
+ _e.route)), h("div", { class: "row" }, h("div", { class: "icon-label length" }, h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), h("div", { class: "icon-label ascent" }, h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent)), h("div", { class: "icon-label practice" }, ((_f = this.practice) === null || _f === void 0 ? void 0 : _f.pictogram) && h("img", { src: this.practice.pictogram }), (_g = this.practice) === null || _g === void 0 ? void 0 :
24
+ _g.name)))), h("div", { class: "description", innerHTML: this.currentTrek.description ? this.currentTrek.description : this.currentTrek.description_teaser }))));
25
+ }
26
+ static get style() { return grwTrekDetailCss; }
27
+ }, [1, "grw-trek-detail", {
28
+ "trek": [16]
29
+ }]);
30
+ function defineCustomElement() {
31
+ if (typeof customElements === "undefined") {
32
+ return;
33
+ }
34
+ const components = ["grw-trek-detail"];
35
+ components.forEach(tagName => { switch (tagName) {
36
+ case "grw-trek-detail":
37
+ if (!customElements.get(tagName)) {
38
+ customElements.define(tagName, GrwTrekDetail);
39
+ }
40
+ break;
41
+ } });
42
+ }
43
+
44
+ export { GrwTrekDetail as G, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GrwTrekProvider extends Components.GrwTrekProvider, HTMLElement {}
4
+ export const GrwTrekProvider: {
5
+ prototype: GrwTrekProvider;
6
+ new (): GrwTrekProvider;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { G as GrwTrekProvider$1, d as defineCustomElement$1 } from './grw-trek-provider2.js';
2
+
3
+ const GrwTrekProvider = GrwTrekProvider$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { GrwTrekProvider, defineCustomElement };
@@ -0,0 +1,49 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { s as state } from './store.js';
3
+
4
+ const GrwTrekProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ this.__registerHost();
8
+ }
9
+ componentWillLoad() {
10
+ state.api = this.api;
11
+ return Promise.all([
12
+ fetch(`${this.api}trek/${this.trekId}/?language=fr&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,route,geometry`),
13
+ fetch(`${this.api}trek_difficulty/?language=fr`),
14
+ fetch(`${this.api}trek_route/?language=fr`),
15
+ fetch(`${this.api}trek_practice/?language=fr`),
16
+ ])
17
+ .then(responses => Promise.all(responses.map(response => response.json())))
18
+ .then(([trek, difficulties, routes, practices]) => {
19
+ state.currentTrek = trek;
20
+ state.difficulties = difficulties.results;
21
+ state.routes = routes.results;
22
+ state.practices = practices.results;
23
+ });
24
+ }
25
+ disconnectedCallback() {
26
+ state.currentTrek = null;
27
+ }
28
+ render() {
29
+ return h(Host, null);
30
+ }
31
+ }, [0, "grw-trek-provider", {
32
+ "api": [1],
33
+ "trekId": [1, "trek-id"]
34
+ }]);
35
+ function defineCustomElement() {
36
+ if (typeof customElements === "undefined") {
37
+ return;
38
+ }
39
+ const components = ["grw-trek-provider"];
40
+ components.forEach(tagName => { switch (tagName) {
41
+ case "grw-trek-provider":
42
+ if (!customElements.get(tagName)) {
43
+ customElements.define(tagName, GrwTrekProvider);
44
+ }
45
+ break;
46
+ } });
47
+ }
48
+
49
+ export { GrwTrekProvider as G, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GrwTreksList extends Components.GrwTreksList, HTMLElement {}
4
+ export const GrwTreksList: {
5
+ prototype: GrwTreksList;
6
+ new (): GrwTreksList;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { G as GrwTreksList$1, d as defineCustomElement$1 } from './grw-treks-list2.js';
2
+
3
+ const GrwTreksList = GrwTreksList$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { GrwTreksList, defineCustomElement };
@@ -0,0 +1,57 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { s as state } from './store.js';
3
+ import { d as defineCustomElement$1 } from './grw-trek-card2.js';
4
+
5
+ const grwTreksListCss = ":host{display:flex;flex-wrap:wrap;justify-content:center;max-height:calc(100vh - 64px);overflow-y:auto}@media (min-width: 664px){:host{justify-content:space-between}}@media (min-width: 996px){:host{justify-content:flex-start}}grw-trek-card{margin:6px}";
6
+
7
+ const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ this.treksToDisplay = [];
13
+ this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
14
+ this.step = 10;
15
+ }
16
+ componentWillLoad() {
17
+ this.treksToDisplay = state.treks.slice(0, this.step);
18
+ this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
19
+ }
20
+ handleInfiniteScroll(event) {
21
+ if (event.composedPath()[0].scrollTop + event.composedPath()[0].scrollHeight / 2 >= event.composedPath()[0].scrollHeight) {
22
+ if (this.treksToDisplay.length < state.treks.length) {
23
+ this.treksToDisplay = state.treks.slice(0, this.treksToDisplay.length + this.step >= state.treks.length ? state.treks.length : this.treksToDisplay.length + this.step);
24
+ }
25
+ else {
26
+ this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
27
+ }
28
+ }
29
+ }
30
+ render() {
31
+ return (h(Host, { class: "treks-list-container" }, this.treksToDisplay.map(trek => (h("grw-trek-card", { trek: trek })))));
32
+ }
33
+ get element() { return this; }
34
+ static get style() { return grwTreksListCss; }
35
+ }, [1, "grw-treks-list", {
36
+ "treksToDisplay": [32]
37
+ }]);
38
+ function defineCustomElement() {
39
+ if (typeof customElements === "undefined") {
40
+ return;
41
+ }
42
+ const components = ["grw-treks-list", "grw-trek-card"];
43
+ components.forEach(tagName => { switch (tagName) {
44
+ case "grw-treks-list":
45
+ if (!customElements.get(tagName)) {
46
+ customElements.define(tagName, GrwTreksList);
47
+ }
48
+ break;
49
+ case "grw-trek-card":
50
+ if (!customElements.get(tagName)) {
51
+ defineCustomElement$1();
52
+ }
53
+ break;
54
+ } });
55
+ }
56
+
57
+ export { GrwTreksList as G, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GrwTreksProvider extends Components.GrwTreksProvider, HTMLElement {}
4
+ export const GrwTreksProvider: {
5
+ prototype: GrwTreksProvider;
6
+ new (): GrwTreksProvider;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { G as GrwTreksProvider$1, d as defineCustomElement$1 } from './grw-treks-provider2.js';
2
+
3
+ const GrwTreksProvider = GrwTreksProvider$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { GrwTreksProvider, defineCustomElement };
@@ -0,0 +1,51 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { s as state } from './store.js';
3
+
4
+ const GrwTreksProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ this.__registerHost();
8
+ }
9
+ componentWillLoad() {
10
+ state.api = this.api;
11
+ let treksRequest = `${this.api}trek/?language=fr`;
12
+ if (this.portals) {
13
+ treksRequest += `&portals=${this.portals}`;
14
+ }
15
+ treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,route,departure_geom&page_size=999`;
16
+ return Promise.all([
17
+ fetch(treksRequest),
18
+ fetch(`${this.api}trek_difficulty/?language=fr`),
19
+ fetch(`${this.api}trek_route/?language=fr`),
20
+ fetch(`${this.api}trek_practice/?language=fr`),
21
+ ])
22
+ .then(responses => Promise.all(responses.map(response => response.json())))
23
+ .then(([treks, difficulties, routes, practices]) => {
24
+ state.treks = treks.results;
25
+ state.difficulties = difficulties.results;
26
+ state.routes = routes.results;
27
+ state.practices = practices.results;
28
+ });
29
+ }
30
+ render() {
31
+ return h(Host, null);
32
+ }
33
+ }, [0, "grw-treks-provider", {
34
+ "api": [1],
35
+ "portals": [1]
36
+ }]);
37
+ function defineCustomElement() {
38
+ if (typeof customElements === "undefined") {
39
+ return;
40
+ }
41
+ const components = ["grw-treks-provider"];
42
+ components.forEach(tagName => { switch (tagName) {
43
+ case "grw-treks-provider":
44
+ if (!customElements.get(tagName)) {
45
+ customElements.define(tagName, GrwTreksProvider);
46
+ }
47
+ break;
48
+ } });
49
+ }
50
+
51
+ export { GrwTreksProvider as G, defineCustomElement as d };
@@ -0,0 +1,26 @@
1
+ /* GeotrekRandoWidget custom elements */
2
+
3
+ import type { Components, JSX } from "../types/components";
4
+
5
+ /**
6
+ * Used to manually set the base path where assets can be found.
7
+ * If the script is used as "module", it's recommended to use "import.meta.url",
8
+ * such as "setAssetPath(import.meta.url)". Other options include
9
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
10
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
11
+ * But do note that this configuration depends on how your script is bundled, or lack of
12
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
13
+ * will have to ensure the static assets are copied to its build directory.
14
+ */
15
+ export declare const setAssetPath: (path: string) => void;
16
+
17
+ export interface SetPlatformOptions {
18
+ raf?: (c: FrameRequestCallback) => number;
19
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
20
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
21
+ }
22
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
23
+
24
+ export type { Components, JSX };
25
+
26
+ export * from '../types';
@@ -0,0 +1 @@
1
+ export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
@@ -0,0 +1,27 @@
1
+ function formatDuration(duration) {
2
+ let formattedDuration;
3
+ if (duration < 24) {
4
+ formattedDuration = `${Math.floor(duration)}h`;
5
+ if (duration % 1 > 0) {
6
+ formattedDuration += `${Math.round(60 * (duration % 1))}min`;
7
+ }
8
+ }
9
+ else {
10
+ formattedDuration = `${duration / 24}j`;
11
+ }
12
+ return formattedDuration;
13
+ }
14
+ function formatLength(length) {
15
+ return `${Math.round(length / 1000)} km`;
16
+ }
17
+ function formatAscent(ascent) {
18
+ return `${ascent} m`;
19
+ }
20
+
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>`;
22
+
23
+ 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>`;
24
+
25
+ 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>`;
26
+
27
+ export { formatLength as a, ascentImage as b, formatAscent as c, durationImage as d, formatDuration as f, lengthImage as l };
@@ -0,0 +1,196 @@
1
+ import { getRenderingRef, forceUpdate } from '@stencil/core/internal/client';
2
+
3
+ const appendToMap = (map, propName, value) => {
4
+ const items = map.get(propName);
5
+ if (!items) {
6
+ map.set(propName, [value]);
7
+ }
8
+ else if (!items.includes(value)) {
9
+ items.push(value);
10
+ }
11
+ };
12
+ const debounce = (fn, ms) => {
13
+ let timeoutId;
14
+ return (...args) => {
15
+ if (timeoutId) {
16
+ clearTimeout(timeoutId);
17
+ }
18
+ timeoutId = setTimeout(() => {
19
+ timeoutId = 0;
20
+ fn(...args);
21
+ }, ms);
22
+ };
23
+ };
24
+
25
+ /**
26
+ * Check if a possible element isConnected.
27
+ * The property might not be there, so we check for it.
28
+ *
29
+ * We want it to return true if isConnected is not a property,
30
+ * otherwise we would remove these elements and would not update.
31
+ *
32
+ * Better leak in Edge than to be useless.
33
+ */
34
+ const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
35
+ const cleanupElements = debounce((map) => {
36
+ for (let key of map.keys()) {
37
+ map.set(key, map.get(key).filter(isConnected));
38
+ }
39
+ }, 2000);
40
+ const stencilSubscription = () => {
41
+ if (typeof getRenderingRef !== 'function') {
42
+ // If we are not in a stencil project, we do nothing.
43
+ // This function is not really exported by @stencil/core.
44
+ return {};
45
+ }
46
+ const elmsToUpdate = new Map();
47
+ return {
48
+ dispose: () => elmsToUpdate.clear(),
49
+ get: (propName) => {
50
+ const elm = getRenderingRef();
51
+ if (elm) {
52
+ appendToMap(elmsToUpdate, propName, elm);
53
+ }
54
+ },
55
+ set: (propName) => {
56
+ const elements = elmsToUpdate.get(propName);
57
+ if (elements) {
58
+ elmsToUpdate.set(propName, elements.filter(forceUpdate));
59
+ }
60
+ cleanupElements(elmsToUpdate);
61
+ },
62
+ reset: () => {
63
+ elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
64
+ cleanupElements(elmsToUpdate);
65
+ },
66
+ };
67
+ };
68
+
69
+ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
70
+ let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
71
+ const handlers = {
72
+ dispose: [],
73
+ get: [],
74
+ set: [],
75
+ reset: [],
76
+ };
77
+ const reset = () => {
78
+ states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
79
+ handlers.reset.forEach((cb) => cb());
80
+ };
81
+ const dispose = () => {
82
+ // Call first dispose as resetting the state would
83
+ // cause less updates ;)
84
+ handlers.dispose.forEach((cb) => cb());
85
+ reset();
86
+ };
87
+ const get = (propName) => {
88
+ handlers.get.forEach((cb) => cb(propName));
89
+ return states.get(propName);
90
+ };
91
+ const set = (propName, value) => {
92
+ const oldValue = states.get(propName);
93
+ if (shouldUpdate(value, oldValue, propName)) {
94
+ states.set(propName, value);
95
+ handlers.set.forEach((cb) => cb(propName, value, oldValue));
96
+ }
97
+ };
98
+ const state = (typeof Proxy === 'undefined'
99
+ ? {}
100
+ : new Proxy(defaultState, {
101
+ get(_, propName) {
102
+ return get(propName);
103
+ },
104
+ ownKeys(_) {
105
+ return Array.from(states.keys());
106
+ },
107
+ getOwnPropertyDescriptor() {
108
+ return {
109
+ enumerable: true,
110
+ configurable: true,
111
+ };
112
+ },
113
+ has(_, propName) {
114
+ return states.has(propName);
115
+ },
116
+ set(_, propName, value) {
117
+ set(propName, value);
118
+ return true;
119
+ },
120
+ }));
121
+ const on = (eventName, callback) => {
122
+ handlers[eventName].push(callback);
123
+ return () => {
124
+ removeFromArray(handlers[eventName], callback);
125
+ };
126
+ };
127
+ const onChange = (propName, cb) => {
128
+ const unSet = on('set', (key, newValue) => {
129
+ if (key === propName) {
130
+ cb(newValue);
131
+ }
132
+ });
133
+ const unReset = on('reset', () => cb(defaultState[propName]));
134
+ return () => {
135
+ unSet();
136
+ unReset();
137
+ };
138
+ };
139
+ const use = (...subscriptions) => {
140
+ const unsubs = subscriptions.reduce((unsubs, subscription) => {
141
+ if (subscription.set) {
142
+ unsubs.push(on('set', subscription.set));
143
+ }
144
+ if (subscription.get) {
145
+ unsubs.push(on('get', subscription.get));
146
+ }
147
+ if (subscription.reset) {
148
+ unsubs.push(on('reset', subscription.reset));
149
+ }
150
+ if (subscription.dispose) {
151
+ unsubs.push(on('dispose', subscription.dispose));
152
+ }
153
+ return unsubs;
154
+ }, []);
155
+ return () => unsubs.forEach((unsub) => unsub());
156
+ };
157
+ const forceUpdate = (key) => {
158
+ const oldValue = states.get(key);
159
+ handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
160
+ };
161
+ return {
162
+ state,
163
+ get,
164
+ set,
165
+ on,
166
+ onChange,
167
+ use,
168
+ dispose,
169
+ reset,
170
+ forceUpdate,
171
+ };
172
+ };
173
+ const removeFromArray = (array, item) => {
174
+ const index = array.indexOf(item);
175
+ if (index >= 0) {
176
+ array[index] = array[array.length - 1];
177
+ array.length--;
178
+ }
179
+ };
180
+
181
+ const createStore = (defaultState, shouldUpdate) => {
182
+ const map = createObservableMap(defaultState, shouldUpdate);
183
+ map.use(stencilSubscription());
184
+ return map;
185
+ };
186
+
187
+ const { state, onChange } = createStore({
188
+ api: '',
189
+ treks: [],
190
+ difficulties: [],
191
+ routes: [],
192
+ practices: [],
193
+ currentTrek: null,
194
+ });
195
+
196
+ export { onChange as o, state as s };
@@ -0,0 +1,17 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-b36f38f5.js';
2
+
3
+ /*
4
+ Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
5
+ */
6
+ const patchBrowser = () => {
7
+ const importMeta = import.meta.url;
8
+ const opts = {};
9
+ if (importMeta !== '') {
10
+ opts.resourcesUrl = new URL('.', importMeta).href;
11
+ }
12
+ return promiseResolve(opts);
13
+ };
14
+
15
+ patchBrowser().then(options => {
16
+ return bootstrapLazy([["grw-app_7",[[1,"grw-app",{"api":[1],"portals":[1],"appName":[1,"app-name"],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"showTrek":[32],"showMap":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]],[1,"grw-treks-list",{"treksToDisplay":[32]}],[0,"grw-map",{"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"]}],[1,"grw-trek-detail",{"trek":[16]}],[0,"grw-trek-provider",{"api":[1],"trekId":[1,"trek-id"]}],[0,"grw-treks-provider",{"api":[1],"portals":[1]}],[1,"grw-trek-card",{"trek":[16]}]]]], options);
17
+ });