@geotrekce/geotrek-rando-widget 0.0.10 → 0.0.13

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 (92) hide show
  1. package/dist/cjs/css-shim-6f592941.js +6 -0
  2. package/dist/cjs/dom-d5e52c7e.js +75 -0
  3. package/dist/cjs/geotrek-rando-widget.cjs.js +73 -6
  4. package/dist/cjs/grw-app.cjs.entry.js +14 -12
  5. package/dist/cjs/grw-filter_6.cjs.entry.js +17 -13
  6. package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +11 -6
  7. package/dist/cjs/grw-trek-card.cjs.entry.js +3 -3
  8. package/dist/cjs/{index-4c76daa3.js → index-66d58516.js} +90 -7
  9. package/dist/cjs/loader.cjs.js +16 -2
  10. package/dist/cjs/shadow-css-cf936b02.js +389 -0
  11. package/dist/cjs/{store-b4c3c507.js → store-d301af22.js} +13 -5
  12. package/dist/collection/collection-manifest.json +1 -1
  13. package/dist/collection/components/grw-app/grw-app.js +12 -10
  14. package/dist/collection/components/grw-map/grw-map.js +4 -3
  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.js +6 -1
  17. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +1 -1
  18. package/dist/collection/store/grw-trek-provider.js +6 -3
  19. package/dist/collection/store/store.js +1 -0
  20. package/dist/components/grw-app.js +12 -10
  21. package/dist/components/grw-filter2.js +1 -1
  22. package/dist/components/grw-information-desk-detail2.js +1 -1
  23. package/dist/components/grw-map2.js +5 -4
  24. package/dist/components/grw-poi-detail2.js +1 -1
  25. package/dist/components/grw-sensitive-area-detail2.js +7 -2
  26. package/dist/components/grw-trek-card2.js +1 -1
  27. package/dist/components/grw-trek-detail2.js +2 -2
  28. package/dist/components/grw-trek-provider2.js +6 -3
  29. package/dist/components/grw-treks-list2.js +1 -1
  30. package/dist/components/index.d.ts +11 -5
  31. package/dist/components/index.js +11 -0
  32. package/dist/components/store.js +12 -4
  33. package/dist/esm/css-shim-2d0a698c.js +4 -0
  34. package/dist/esm/dom-9794f747.js +73 -0
  35. package/dist/esm/geotrek-rando-widget.js +73 -6
  36. package/dist/esm/grw-app.entry.js +14 -12
  37. package/dist/esm/grw-filter_6.entry.js +17 -13
  38. package/dist/esm/grw-information-desk-detail_3.entry.js +11 -6
  39. package/dist/esm/grw-trek-card.entry.js +3 -3
  40. package/dist/esm/{index-ee473772.js → index-899307bb.js} +86 -8
  41. package/dist/esm/loader.js +16 -2
  42. package/dist/esm/shadow-css-4cd4480f.js +387 -0
  43. package/dist/esm/{store-a5f523fd.js → store-70461a28.js} +13 -5
  44. package/dist/esm-es5/css-shim-2d0a698c.js +1 -0
  45. package/dist/esm-es5/dom-9794f747.js +21 -0
  46. package/dist/esm-es5/geotrek-rando-widget.js +1 -0
  47. package/dist/esm-es5/grw-app.entry.js +1 -0
  48. package/dist/esm-es5/grw-filter_6.entry.js +6 -0
  49. package/dist/esm-es5/grw-information-desk-detail_3.entry.js +1 -0
  50. package/dist/esm-es5/grw-trek-card.entry.js +1 -0
  51. package/dist/esm-es5/index-899307bb.js +2 -0
  52. package/dist/esm-es5/index.js +0 -0
  53. package/dist/esm-es5/length-d82189db.js +1 -0
  54. package/dist/esm-es5/loader.js +1 -0
  55. package/dist/esm-es5/shadow-css-4cd4480f.js +12 -0
  56. package/dist/esm-es5/store-70461a28.js +1 -0
  57. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  58. package/dist/geotrek-rando-widget/geotrek-rando-widget.js +133 -0
  59. package/dist/geotrek-rando-widget/p-067c02c4.system.js +1 -0
  60. package/dist/geotrek-rando-widget/p-0c5b047c.js +1 -0
  61. package/dist/geotrek-rando-widget/p-18038011.js +1 -0
  62. package/dist/geotrek-rando-widget/p-2712caa8.system.entry.js +6 -0
  63. package/dist/geotrek-rando-widget/p-2bd0278f.system.entry.js +1 -0
  64. package/dist/geotrek-rando-widget/p-32d97a4f.system.js +1 -0
  65. package/dist/geotrek-rando-widget/p-3ed52659.entry.js +1 -0
  66. package/dist/geotrek-rando-widget/p-4690907e.js +2 -0
  67. package/dist/geotrek-rando-widget/p-48d5dde7.entry.js +1 -0
  68. package/dist/geotrek-rando-widget/p-4eaf20b7.js +12 -0
  69. package/dist/geotrek-rando-widget/p-50ea2036.system.js +1 -0
  70. package/dist/geotrek-rando-widget/p-533fc2bb.entry.js +1 -0
  71. package/dist/geotrek-rando-widget/p-82ca029f.system.js +1 -0
  72. package/dist/geotrek-rando-widget/p-8f9914f4.system.js +2 -0
  73. package/dist/geotrek-rando-widget/p-a99db140.system.js +1 -0
  74. package/dist/geotrek-rando-widget/p-b1530d9c.system.js +13 -0
  75. package/dist/geotrek-rando-widget/p-c8c96517.system.js +21 -0
  76. package/dist/geotrek-rando-widget/p-d1582cff.js +19 -0
  77. package/dist/geotrek-rando-widget/p-e1431f36.system.entry.js +1 -0
  78. package/dist/geotrek-rando-widget/p-e38f4ff4.system.entry.js +1 -0
  79. package/dist/geotrek-rando-widget/p-f5d98aae.entry.js +1 -0
  80. package/dist/index.js +1 -1
  81. package/dist/types/components/grw-app/grw-app.d.ts +1 -0
  82. package/dist/types/store/grw-trek-provider.d.ts +0 -1
  83. package/dist/types/store/store.d.ts +3 -1
  84. package/dist/types/types/types.d.ts +6 -5
  85. package/loader/index.js +1 -1
  86. package/package.json +12 -12
  87. package/dist/geotrek-rando-widget/p-0510e16b.entry.js +0 -1
  88. package/dist/geotrek-rando-widget/p-22562f4d.js +0 -1
  89. package/dist/geotrek-rando-widget/p-34fbbb97.entry.js +0 -1
  90. package/dist/geotrek-rando-widget/p-500436f1.entry.js +0 -1
  91. package/dist/geotrek-rando-widget/p-94f0db4d.entry.js +0 -1
  92. package/dist/geotrek-rando-widget/p-b62909db.js +0 -2
@@ -0,0 +1,389 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ Stencil Client Platform v2.17.4 | MIT Licensed | https://stenciljs.com
5
+ */
6
+ /**
7
+ * @license
8
+ * Copyright Google Inc. All Rights Reserved.
9
+ *
10
+ * Use of this source code is governed by an MIT-style license that can be
11
+ * found in the LICENSE file at https://angular.io/license
12
+ *
13
+ * This file is a port of shadowCSS from webcomponents.js to TypeScript.
14
+ * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
15
+ * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
16
+ */
17
+ const safeSelector = (selector) => {
18
+ const placeholders = [];
19
+ let index = 0;
20
+ // Replaces attribute selectors with placeholders.
21
+ // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
22
+ selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
23
+ const replaceBy = `__ph-${index}__`;
24
+ placeholders.push(keep);
25
+ index++;
26
+ return replaceBy;
27
+ });
28
+ // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
29
+ // WS and "+" would otherwise be interpreted as selector separators.
30
+ const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
31
+ const replaceBy = `__ph-${index}__`;
32
+ placeholders.push(exp);
33
+ index++;
34
+ return pseudo + replaceBy;
35
+ });
36
+ const ss = {
37
+ content,
38
+ placeholders,
39
+ };
40
+ return ss;
41
+ };
42
+ const restoreSafeSelector = (placeholders, content) => {
43
+ return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
44
+ };
45
+ const _polyfillHost = '-shadowcsshost';
46
+ const _polyfillSlotted = '-shadowcssslotted';
47
+ // note: :host-context pre-processed to -shadowcsshostcontext.
48
+ const _polyfillHostContext = '-shadowcsscontext';
49
+ const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
50
+ const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
51
+ const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
52
+ const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim');
53
+ const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
54
+ const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
55
+ const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
56
+ const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
57
+ const _polyfillHostRe = /-shadowcsshost/gim;
58
+ const _colonHostRe = /:host/gim;
59
+ const _colonSlottedRe = /::slotted/gim;
60
+ const _colonHostContextRe = /:host-context/gim;
61
+ const _commentRe = /\/\*\s*[\s\S]*?\*\//g;
62
+ const stripComments = (input) => {
63
+ return input.replace(_commentRe, '');
64
+ };
65
+ const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
66
+ const extractCommentsWithHash = (input) => {
67
+ return input.match(_commentWithHashRe) || [];
68
+ };
69
+ const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
70
+ const _curlyRe = /([{}])/g;
71
+ const _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
72
+ const OPEN_CURLY = '{';
73
+ const CLOSE_CURLY = '}';
74
+ const BLOCK_PLACEHOLDER = '%BLOCK%';
75
+ const processRules = (input, ruleCallback) => {
76
+ const inputWithEscapedBlocks = escapeBlocks(input);
77
+ let nextBlockIndex = 0;
78
+ return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
79
+ const selector = m[2];
80
+ let content = '';
81
+ let suffix = m[4];
82
+ let contentPrefix = '';
83
+ if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
84
+ content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
85
+ suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
86
+ contentPrefix = '{';
87
+ }
88
+ const cssRule = {
89
+ selector,
90
+ content,
91
+ };
92
+ const rule = ruleCallback(cssRule);
93
+ return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
94
+ });
95
+ };
96
+ const escapeBlocks = (input) => {
97
+ const inputParts = input.split(_curlyRe);
98
+ const resultParts = [];
99
+ const escapedBlocks = [];
100
+ let bracketCount = 0;
101
+ let currentBlockParts = [];
102
+ for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
103
+ const part = inputParts[partIndex];
104
+ if (part === CLOSE_CURLY) {
105
+ bracketCount--;
106
+ }
107
+ if (bracketCount > 0) {
108
+ currentBlockParts.push(part);
109
+ }
110
+ else {
111
+ if (currentBlockParts.length > 0) {
112
+ escapedBlocks.push(currentBlockParts.join(''));
113
+ resultParts.push(BLOCK_PLACEHOLDER);
114
+ currentBlockParts = [];
115
+ }
116
+ resultParts.push(part);
117
+ }
118
+ if (part === OPEN_CURLY) {
119
+ bracketCount++;
120
+ }
121
+ }
122
+ if (currentBlockParts.length > 0) {
123
+ escapedBlocks.push(currentBlockParts.join(''));
124
+ resultParts.push(BLOCK_PLACEHOLDER);
125
+ }
126
+ const strEscapedBlocks = {
127
+ escapedString: resultParts.join(''),
128
+ blocks: escapedBlocks,
129
+ };
130
+ return strEscapedBlocks;
131
+ };
132
+ const insertPolyfillHostInCssText = (selector) => {
133
+ selector = selector
134
+ .replace(_colonHostContextRe, _polyfillHostContext)
135
+ .replace(_colonHostRe, _polyfillHost)
136
+ .replace(_colonSlottedRe, _polyfillSlotted);
137
+ return selector;
138
+ };
139
+ const convertColonRule = (cssText, regExp, partReplacer) => {
140
+ // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
141
+ return cssText.replace(regExp, (...m) => {
142
+ if (m[2]) {
143
+ const parts = m[2].split(',');
144
+ const r = [];
145
+ for (let i = 0; i < parts.length; i++) {
146
+ const p = parts[i].trim();
147
+ if (!p)
148
+ break;
149
+ r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
150
+ }
151
+ return r.join(',');
152
+ }
153
+ else {
154
+ return _polyfillHostNoCombinator + m[3];
155
+ }
156
+ });
157
+ };
158
+ const colonHostPartReplacer = (host, part, suffix) => {
159
+ return host + part.replace(_polyfillHost, '') + suffix;
160
+ };
161
+ const convertColonHost = (cssText) => {
162
+ return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
163
+ };
164
+ const colonHostContextPartReplacer = (host, part, suffix) => {
165
+ if (part.indexOf(_polyfillHost) > -1) {
166
+ return colonHostPartReplacer(host, part, suffix);
167
+ }
168
+ else {
169
+ return host + part + suffix + ', ' + part + ' ' + host + suffix;
170
+ }
171
+ };
172
+ const convertColonSlotted = (cssText, slotScopeId) => {
173
+ const slotClass = '.' + slotScopeId + ' > ';
174
+ const selectors = [];
175
+ cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
176
+ if (m[2]) {
177
+ const compound = m[2].trim();
178
+ const suffix = m[3];
179
+ const slottedSelector = slotClass + compound + suffix;
180
+ let prefixSelector = '';
181
+ for (let i = m[4] - 1; i >= 0; i--) {
182
+ const char = m[5][i];
183
+ if (char === '}' || char === ',') {
184
+ break;
185
+ }
186
+ prefixSelector = char + prefixSelector;
187
+ }
188
+ const orgSelector = prefixSelector + slottedSelector;
189
+ const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`;
190
+ if (orgSelector.trim() !== addedSelector.trim()) {
191
+ const updatedSelector = `${addedSelector}, ${orgSelector}`;
192
+ selectors.push({
193
+ orgSelector,
194
+ updatedSelector,
195
+ });
196
+ }
197
+ return slottedSelector;
198
+ }
199
+ else {
200
+ return _polyfillHostNoCombinator + m[3];
201
+ }
202
+ });
203
+ return {
204
+ selectors,
205
+ cssText,
206
+ };
207
+ };
208
+ const convertColonHostContext = (cssText) => {
209
+ return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
210
+ };
211
+ const convertShadowDOMSelectors = (cssText) => {
212
+ return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
213
+ };
214
+ const makeScopeMatcher = (scopeSelector) => {
215
+ const lre = /\[/g;
216
+ const rre = /\]/g;
217
+ scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
218
+ return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
219
+ };
220
+ const selectorNeedsScoping = (selector, scopeSelector) => {
221
+ const re = makeScopeMatcher(scopeSelector);
222
+ return !re.test(selector);
223
+ };
224
+ const injectScopingSelector = (selector, scopingSelector) => {
225
+ return selector.replace(_selectorPartsRe, (_, before = '', _colonGroup, colon = '', after = '') => {
226
+ return before + scopingSelector + colon + after;
227
+ });
228
+ };
229
+ const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => {
230
+ // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
231
+ _polyfillHostRe.lastIndex = 0;
232
+ if (_polyfillHostRe.test(selector)) {
233
+ const replaceBy = `.${hostSelector}`;
234
+ return selector
235
+ .replace(_polyfillHostNoCombinatorRe, (_, selector) => injectScopingSelector(selector, replaceBy))
236
+ .replace(_polyfillHostRe, replaceBy + ' ');
237
+ }
238
+ return scopeSelector + ' ' + selector;
239
+ };
240
+ const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => {
241
+ const isRe = /\[is=([^\]]*)\]/g;
242
+ scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
243
+ const className = '.' + scopeSelector;
244
+ const _scopeSelectorPart = (p) => {
245
+ let scopedP = p.trim();
246
+ if (!scopedP) {
247
+ return '';
248
+ }
249
+ if (p.indexOf(_polyfillHostNoCombinator) > -1) {
250
+ scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector);
251
+ }
252
+ else {
253
+ // remove :host since it should be unnecessary
254
+ const t = p.replace(_polyfillHostRe, '');
255
+ if (t.length > 0) {
256
+ scopedP = injectScopingSelector(t, className);
257
+ }
258
+ }
259
+ return scopedP;
260
+ };
261
+ const safeContent = safeSelector(selector);
262
+ selector = safeContent.content;
263
+ let scopedSelector = '';
264
+ let startIndex = 0;
265
+ let res;
266
+ const sep = /( |>|\+|~(?!=))\s*/g;
267
+ // If a selector appears before :host it should not be shimmed as it
268
+ // matches on ancestor elements and not on elements in the host's shadow
269
+ // `:host-context(div)` is transformed to
270
+ // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
271
+ // the `div` is not part of the component in the 2nd selectors and should not be scoped.
272
+ // Historically `component-tag:host` was matching the component so we also want to preserve
273
+ // this behavior to avoid breaking legacy apps (it should not match).
274
+ // The behavior should be:
275
+ // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
276
+ // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
277
+ // `:host-context(tag)`)
278
+ const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
279
+ // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
280
+ let shouldScope = !hasHost;
281
+ while ((res = sep.exec(selector)) !== null) {
282
+ const separator = res[1];
283
+ const part = selector.slice(startIndex, res.index).trim();
284
+ shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
285
+ const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
286
+ scopedSelector += `${scopedPart} ${separator} `;
287
+ startIndex = sep.lastIndex;
288
+ }
289
+ const part = selector.substring(startIndex);
290
+ shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
291
+ scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
292
+ // replace the placeholders with their original values
293
+ return restoreSafeSelector(safeContent.placeholders, scopedSelector);
294
+ };
295
+ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
296
+ return selector
297
+ .split(',')
298
+ .map((shallowPart) => {
299
+ if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) {
300
+ return shallowPart.trim();
301
+ }
302
+ if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
303
+ return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
304
+ }
305
+ else {
306
+ return shallowPart.trim();
307
+ }
308
+ })
309
+ .join(', ');
310
+ };
311
+ const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
312
+ return processRules(cssText, (rule) => {
313
+ let selector = rule.selector;
314
+ let content = rule.content;
315
+ if (rule.selector[0] !== '@') {
316
+ selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
317
+ }
318
+ else if (rule.selector.startsWith('@media') ||
319
+ rule.selector.startsWith('@supports') ||
320
+ rule.selector.startsWith('@page') ||
321
+ rule.selector.startsWith('@document')) {
322
+ content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);
323
+ }
324
+ const cssRule = {
325
+ selector: selector.replace(/\s{2,}/g, ' ').trim(),
326
+ content,
327
+ };
328
+ return cssRule;
329
+ });
330
+ };
331
+ const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => {
332
+ cssText = insertPolyfillHostInCssText(cssText);
333
+ cssText = convertColonHost(cssText);
334
+ cssText = convertColonHostContext(cssText);
335
+ const slotted = convertColonSlotted(cssText, slotScopeId);
336
+ cssText = slotted.cssText;
337
+ cssText = convertShadowDOMSelectors(cssText);
338
+ if (scopeId) {
339
+ cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);
340
+ }
341
+ cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
342
+ cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 ');
343
+ return {
344
+ cssText: cssText.trim(),
345
+ slottedSelectors: slotted.selectors,
346
+ };
347
+ };
348
+ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
349
+ const hostScopeId = scopeId + '-h';
350
+ const slotScopeId = scopeId + '-s';
351
+ const commentsWithHash = extractCommentsWithHash(cssText);
352
+ cssText = stripComments(cssText);
353
+ const orgSelectors = [];
354
+ if (commentOriginalSelector) {
355
+ const processCommentedSelector = (rule) => {
356
+ const placeholder = `/*!@___${orgSelectors.length}___*/`;
357
+ const comment = `/*!@${rule.selector}*/`;
358
+ orgSelectors.push({ placeholder, comment });
359
+ rule.selector = placeholder + rule.selector;
360
+ return rule;
361
+ };
362
+ cssText = processRules(cssText, (rule) => {
363
+ if (rule.selector[0] !== '@') {
364
+ return processCommentedSelector(rule);
365
+ }
366
+ else if (rule.selector.startsWith('@media') ||
367
+ rule.selector.startsWith('@supports') ||
368
+ rule.selector.startsWith('@page') ||
369
+ rule.selector.startsWith('@document')) {
370
+ rule.content = processRules(rule.content, processCommentedSelector);
371
+ return rule;
372
+ }
373
+ return rule;
374
+ });
375
+ }
376
+ const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId);
377
+ cssText = [scoped.cssText, ...commentsWithHash].join('\n');
378
+ if (commentOriginalSelector) {
379
+ orgSelectors.forEach(({ placeholder, comment }) => {
380
+ cssText = cssText.replace(placeholder, comment);
381
+ });
382
+ }
383
+ scoped.slottedSelectors.forEach((slottedSelector) => {
384
+ cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector);
385
+ });
386
+ return cssText;
387
+ };
388
+
389
+ exports.scopeCss = scopeCss;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-4c76daa3.js');
3
+ const index = require('./index-66d58516.js');
4
4
 
5
5
  const appendToMap = (map, propName, value) => {
6
6
  const items = map.get(propName);
@@ -68,8 +68,10 @@ const stencilSubscription = () => {
68
68
  };
69
69
  };
70
70
 
71
+ const unwrap = (val) => (typeof val === 'function' ? val() : val);
71
72
  const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
72
- let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
73
+ const unwrappedState = unwrap(defaultState);
74
+ let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
73
75
  const handlers = {
74
76
  dispose: [],
75
77
  get: [],
@@ -77,7 +79,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
77
79
  reset: [],
78
80
  };
79
81
  const reset = () => {
80
- states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
82
+ var _a;
83
+ // When resetting the state, the default state may be a function - unwrap it to invoke it.
84
+ // otherwise, the state won't be properly reset
85
+ states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
81
86
  handlers.reset.forEach((cb) => cb());
82
87
  };
83
88
  const dispose = () => {
@@ -99,7 +104,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
99
104
  };
100
105
  const state = (typeof Proxy === 'undefined'
101
106
  ? {}
102
- : new Proxy(defaultState, {
107
+ : new Proxy(unwrappedState, {
103
108
  get(_, propName) {
104
109
  return get(propName);
105
110
  },
@@ -132,7 +137,9 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
132
137
  cb(newValue);
133
138
  }
134
139
  });
135
- const unReset = on('reset', () => cb(defaultState[propName]));
140
+ // We need to unwrap the defaultState because it might be a function.
141
+ // Otherwise we might not be sending the right reset value.
142
+ const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
136
143
  return () => {
137
144
  unSet();
138
145
  unReset();
@@ -202,6 +209,7 @@ const { state, onChange } = createStore({
202
209
  sources: null,
203
210
  accessibilities: null,
204
211
  accessibilitiesLevel: null,
212
+ poiTypes: null,
205
213
  currentTrek: null,
206
214
  currentPois: null,
207
215
  currentInformationDesks: null,
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "compiler": {
16
16
  "name": "@stencil/core",
17
- "version": "2.16.1",
17
+ "version": "2.17.4",
18
18
  "typescriptVersion": "4.5.4"
19
19
  },
20
20
  "collections": [],
@@ -33,6 +33,15 @@ export class GrwApp {
33
33
  watchPropHandler() {
34
34
  window.dispatchEvent(new window.Event('resize'));
35
35
  }
36
+ componentWillLoad() {
37
+ const url = new URL(window.location.toString());
38
+ const trekParam = url.searchParams.get('trek');
39
+ if (trekParam) {
40
+ window.history.replaceState({ isInitialHistoryWithTrek: true }, '', url);
41
+ this.currentTrekId = Number(trekParam);
42
+ this.showTrek = !this.showTrek;
43
+ }
44
+ }
36
45
  componentDidLoad() {
37
46
  onChange('trekNetworkError', () => {
38
47
  if (state.trekNetworkError) {
@@ -42,15 +51,8 @@ export class GrwApp {
42
51
  this.onTrekDetailsClose();
43
52
  }
44
53
  });
45
- this.handleView();
46
54
  window.addEventListener('popstate', this.handlePopStateBind, false);
47
- const url = new URL(window.location.toString());
48
- const trekParam = url.searchParams.get('trek');
49
- if (trekParam) {
50
- window.history.replaceState({ isInitialHistoryWithTrek: true }, '', url);
51
- this.currentTrekId = Number(trekParam);
52
- this.showTrek = !this.showTrek;
53
- }
55
+ this.handleView();
54
56
  }
55
57
  onTrekDetailsClose() {
56
58
  state.currentTrek = null;
@@ -100,10 +102,10 @@ export class GrwApp {
100
102
  }
101
103
  render() {
102
104
  return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } },
103
- 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 }),
104
105
  !state.currentTreks && !state.currentTrek && (h("div", { class: "init-loader-container" },
105
106
  h("span", { class: "loader" }))),
106
- this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }),
107
+ !this.showTrek && !state.treks && (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 })),
108
+ this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: this.api, language: this.language, "trek-id": this.currentTrekId }),
107
109
  (state.currentTreks || state.currentTrek) && (h("div", { class: "app-container" },
108
110
  h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' },
109
111
  this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { class: "handle-filters-container" },
@@ -142,6 +142,7 @@ export class GrwMap {
142
142
  }
143
143
  }
144
144
  addTrek() {
145
+ var _a;
145
146
  const currentTrekFeature = {
146
147
  type: 'Feature',
147
148
  geometry: state.currentTrek.geometry,
@@ -264,14 +265,14 @@ export class GrwMap {
264
265
  for (const currentPoi of state.currentPois) {
265
266
  currentPoisFeatureCollection.features.push({
266
267
  type: 'Feature',
267
- properties: { name: currentPoi.name, type_pictogram: currentPoi.type_pictogram },
268
+ properties: { name: currentPoi.name, type_pictogram: (_a = state.poiTypes.find(poiType => poiType.id === currentPoi.type)) === null || _a === void 0 ? void 0 : _a.pictogram },
268
269
  geometry: currentPoi.geometry,
269
270
  });
270
271
  }
271
272
  this.currentPoisLayer = L.geoJSON(currentPoisFeatureCollection, {
272
273
  pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
273
274
  icon: L.divIcon({
274
- html: geoJsonPoint.properties.type_pictogram && `<img src=${geoJsonPoint.properties.type_pictogram} />`,
275
+ html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
275
276
  className: 'poi-icon',
276
277
  iconSize: 48,
277
278
  }),
@@ -305,7 +306,7 @@ export class GrwMap {
305
306
  this.currentInformationDesksLayer = L.geoJSON(currentInformationDesksFeatureCollection, {
306
307
  pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
307
308
  icon: L.divIcon({
308
- html: geoJsonPoint.properties.type_pictogram && `<img src=${geoJsonPoint.properties.type_pictogram} />`,
309
+ html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
309
310
  className: 'information-desks-icon',
310
311
  iconSize: 48,
311
312
  }),
@@ -22,7 +22,7 @@ export class GrwPoiDetail {
22
22
  "mutable": false,
23
23
  "complexType": {
24
24
  "original": "Poi",
25
- "resolved": "{ id: number; name: string; description: string; attachments: Attachments; type: any; type_label: any; type_pictogram: any; url: string; published: boolean; geometry: Geometry; }",
25
+ "resolved": "{ id: number; name: string; description: string; attachments: Attachments; type: number; geometry: Geometry; }",
26
26
  "references": {
27
27
  "Poi": {
28
28
  "location": "import",
@@ -7,7 +7,12 @@ export class GrwSensitiveAreaDetail {
7
7
  h("div", { class: "sensitive-area-description", innerHTML: this.sensitiveArea.description }),
8
8
  this.sensitiveArea.practices && this.sensitiveArea.practices.length > 0 && (h("div", { class: "sensitive-area-practice-container" },
9
9
  h("div", { class: "sensitive-area-practice-title" }, "Domaines d'activit\u00E9s concern\u00E9s :"),
10
- h("div", { class: "sensitive-area-practice-values" }, this.sensitiveArea.practices.map((practice, index) => (h("div", { innerHTML: `${state.practices.find(statePractice => statePractice.id === practice).name.toUpperCase()}${index + 1 !== this.sensitiveArea.practices.length ? ' -&nbsp;' : ''}` })))))),
10
+ h("div", { class: "sensitive-area-practice-values" }, this.sensitiveArea.practices.map((sensitiveAreaPractice, index) => {
11
+ const practice = state.practices.find(statePractice => statePractice.id === sensitiveAreaPractice);
12
+ if (practice) {
13
+ return h("div", { innerHTML: `${practice.name.toUpperCase()}${index + 1 !== this.sensitiveArea.practices.length ? ' -&nbsp;' : ''}` });
14
+ }
15
+ })))),
11
16
  this.sensitiveArea.period && this.sensitiveArea.period.length > 0 && (h("div", { class: "sensitive-area-period-container" },
12
17
  h("div", { class: "sensitive-area-period-title" }, "P\u00E9riodes de sensibilit\u00E9"),
13
18
  h("div", { class: "sensitive-area-period-values" }, this.sensitiveArea.period.map((month, index) => {
@@ -44,7 +44,7 @@ export class GrwTrekDetail {
44
44
  var _a, _b, _c, _d, _e, _f, _g;
45
45
  return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-shade': this.colorPrimaryShade, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: "trek-detail-container" },
46
46
  h("div", { class: "name" }, this.currentTrek.name),
47
- this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (h("img", { class: "image", src: this.currentTrek.attachments[0].thumbnail, loading: "lazy" })),
47
+ this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].url && (h("img", { class: "image", src: this.currentTrek.attachments[0].url, loading: "lazy" })),
48
48
  h("div", { class: "sub-container" },
49
49
  h("div", { class: "icons-labels-container" },
50
50
  h("div", { class: "row" },
@@ -3,7 +3,6 @@ import state from 'store/store';
3
3
  export class GrwTrekProvider {
4
4
  constructor() {
5
5
  this.language = 'fr';
6
- this.trekNetworkError = false;
7
6
  this.controller = new AbortController();
8
7
  this.signal = this.controller.signal;
9
8
  }
@@ -23,12 +22,15 @@ export class GrwTrekProvider {
23
22
  fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
24
23
  fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
25
24
  fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
26
- fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`, { signal: this.signal }),
25
+ fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,geometry&page_size=999`, {
26
+ signal: this.signal,
27
+ }),
28
+ fetch(`${this.api}poi_type/?language=${this.language}&fields=id,pictogram`, { signal: this.signal }),
27
29
  fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`, { signal: this.signal }),
28
30
  fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`, { signal: this.signal }),
29
31
  ])
30
32
  .then(responses => Promise.all(responses.map(response => response.json())))
31
- .then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
33
+ .then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, poiTypes, informationDesks, trek]) => {
32
34
  state.trekNetworkError = false;
33
35
  if (difficulties) {
34
36
  state.difficulties = difficulties.results;
@@ -52,6 +54,7 @@ export class GrwTrekProvider {
52
54
  state.accessibilitiesLevel = accessibilitiesLevel.results;
53
55
  }
54
56
  state.currentPois = pois.results;
57
+ state.poiTypes = poiTypes.results;
55
58
  state.currentInformationDesks = informationDesks.results;
56
59
  state.currentTrek = trek;
57
60
  })
@@ -15,6 +15,7 @@ const { state, onChange } = createStore({
15
15
  sources: null,
16
16
  accessibilities: null,
17
17
  accessibilitiesLevel: null,
18
+ poiTypes: null,
18
19
  currentTrek: null,
19
20
  currentPois: null,
20
21
  currentInformationDesks: null,