@geops/rvf-mobility-web-component 0.1.64 → 0.1.65

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 (39) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/docutils.js +29 -19
  3. package/index.html +0 -1
  4. package/index.js +276 -235
  5. package/package.json +12 -12
  6. package/src/BaseLayer/BaseLayer.tsx +18 -2
  7. package/src/Copyright/Copyright.tsx +2 -2
  8. package/src/Copyright/index.tsx +1 -1
  9. package/src/LinesNetworkPlanLayerHighlight/LinesNetworkPlanLayerHighlight.tsx +1 -0
  10. package/src/Map/Map.tsx +27 -1
  11. package/src/MapLayout/MapLayout.tsx +1 -1
  12. package/src/MapLayout/index.tsx +1 -1
  13. package/src/MobilityMap/MobilityMap.tsx +5 -11
  14. package/src/MobilityMap/MobilityMapAttributes.ts +8 -5
  15. package/src/NotificationDetails/NotificationDetails.tsx +75 -57
  16. package/src/Permalink/Permalink.tsx +17 -6
  17. package/src/PermalinkInput/PermalinkInput.tsx +4 -1
  18. package/src/RealtimeLayer/index.tsx +1 -1
  19. package/src/RvfCopyright/RvfCopyright.tsx +32 -0
  20. package/src/RvfCopyright/index.tsx +1 -0
  21. package/src/RvfInputCopy/RvfInputCopy.tsx +18 -8
  22. package/src/RvfMapLayout/RvfMapLayout.tsx +198 -0
  23. package/src/RvfMapLayout/index.tsx +1 -0
  24. package/src/RvfMobilityMap/RvfMobilityMap.tsx +10 -580
  25. package/src/RvfRealtimeLayer/RvfRealtimeLayer.tsx +64 -0
  26. package/src/RvfRealtimeLayer/index.tsx +1 -0
  27. package/src/RvfStationsLayer/RvfStationsLayer.tsx +19 -0
  28. package/src/RvfStationsLayer/index.tsx +1 -0
  29. package/src/ShareMenu/ShareMenu.tsx +3 -1
  30. package/src/StationsLayer/index.tsx +1 -1
  31. package/src/ui/InputCopy/InputCopy.tsx +21 -10
  32. package/src/utils/constants.ts +1 -1
  33. package/src/utils/getUrlFromTemplate.test.ts +23 -0
  34. package/src/utils/getUrlFromTemplate.ts +47 -0
  35. package/src/utils/hooks/useI18n.tsx +2 -4
  36. package/src/utils/hooks/useInitialLayersVisiblity.tsx +27 -4
  37. package/src/utils/hooks/useInitialPermalink.tsx +31 -21
  38. package/src/utils/hooks/usePermalink.tsx +25 -0
  39. package/src/utils/translations.ts +4 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.65](https://github.com/geops/rvf-mobility-web-component/compare/v0.1.64...v0.1.65) (2025-10-14)
6
+
7
+
8
+ ### Features
9
+
10
+ * add lines attribute ([#28](https://github.com/geops/rvf-mobility-web-component/issues/28)) ([3475b21](https://github.com/geops/rvf-mobility-web-component/commit/3475b2121f02997219821ea79fff71d289b37878))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * active docu permalink ([821ea85](https://github.com/geops/rvf-mobility-web-component/commit/821ea85d97f0c5c6f1ae8ca1394fd8152c2bb70a))
16
+ * add a container ([fae18ad](https://github.com/geops/rvf-mobility-web-component/commit/fae18ad2cd72fac8ac566d5dbf20e2ae2e05c7cd))
17
+ * add missing file ([5bcca16](https://github.com/geops/rvf-mobility-web-component/commit/5bcca16dcaf6bbc0ba80734149ed07ee79ea55d8))
18
+ * always read url parameters when a permalink template is set ([5636bce](https://github.com/geops/rvf-mobility-web-component/commit/5636bceb97b669328bf1e009370e91435a51d991))
19
+ * fix inout copy rendering ([b3da415](https://github.com/geops/rvf-mobility-web-component/commit/b3da41560a4a49ec0dea11710f4324b591471128))
20
+ * fix input copy ([1201c0c](https://github.com/geops/rvf-mobility-web-component/commit/1201c0c478dfb0d175c914c57916d1ff6698bf71))
21
+ * highlight hidden by default ([6882da0](https://github.com/geops/rvf-mobility-web-component/commit/6882da08563820c133dd2c132e0990054d0b33b7))
22
+ * make the layers permalink params work ([cf961b2](https://github.com/geops/rvf-mobility-web-component/commit/cf961b2ec5edfc6424baae4d7f43fd8866f26083))
23
+ * make the layers permalink params work ([0559bc8](https://github.com/geops/rvf-mobility-web-component/commit/0559bc8e6dee0859abc53f9d2a6d7d2d04c186b8))
24
+ * move rvf customs code in other components ([0fff2d7](https://github.com/geops/rvf-mobility-web-component/commit/0fff2d7c260e876dffa042966892796f35776de0))
25
+ * preserve drawing buffer when necessary ([5e4f199](https://github.com/geops/rvf-mobility-web-component/commit/5e4f19975b3dcc50cbc66b483143efdaa72b8cf0))
26
+ * read properly the layers url param ([926ddfd](https://github.com/geops/rvf-mobility-web-component/commit/926ddfd4bd1a62502994cd8d7ad60f7714483b40))
27
+ * remove default zoom attribute ([b45821a](https://github.com/geops/rvf-mobility-web-component/commit/b45821ad08ac39bc55e46e15b229f33d117fc646))
28
+ * set width in pixels to keep always the same size ([29ff7c9](https://github.com/geops/rvf-mobility-web-component/commit/29ff7c9142a3243809ad70b2cf827ed137e96f31))
29
+
5
30
  ### [0.1.64](https://github.com/geops/rvf-mobility-web-component/compare/v0.1.63...v0.1.64) (2025-10-14)
6
31
 
7
32
 
package/docutils.js CHANGED
@@ -1,3 +1,5 @@
1
+ const activateAttrUrlParameters = true;
2
+
1
3
  function onLoad(wc, attributes, events, pkgSrc) {
2
4
  /* Show private attributes for dev purpose */
3
5
  const showPrivate =
@@ -59,7 +61,7 @@ function onLoad(wc, attributes, events, pkgSrc) {
59
61
  defaultValueByAttr,
60
62
  reloadAttrs,
61
63
  );
62
- console.log(attrsContent);
64
+
63
65
  if (attrsContent) {
64
66
  document.querySelector("#attributes").innerHTML = attrsContent;
65
67
  } else {
@@ -85,7 +87,7 @@ function onLoad(wc, attributes, events, pkgSrc) {
85
87
  pkgSrc,
86
88
  );
87
89
  });
88
- applyPermalinkParameters(wc);
90
+ applyPermalinkParameters(wc, attributes);
89
91
  evts.forEach((eventName) => {
90
92
  wc.addEventListener(eventName, (event) => {
91
93
  console.log(`${eventName} event`, event);
@@ -93,7 +95,7 @@ function onLoad(wc, attributes, events, pkgSrc) {
93
95
  });
94
96
  }
95
97
 
96
- function applyPermalinkParameters(wc) {
98
+ function applyPermalinkParameters(wc, attributes) {
97
99
  const params = new URLSearchParams(window.location.search);
98
100
 
99
101
  // Apply fullscreen mode
@@ -126,20 +128,26 @@ function applyPermalinkParameters(wc) {
126
128
  }
127
129
 
128
130
  // Apply all url parameters as attribute of the web component and fill the input fields.
129
- params.forEach((value, key) => {
130
- wc.setAttribute(key, value);
131
- const input = document.querySelector(`[name=${key}]`);
132
- if (input) {
133
- if (input.type === "checkbox") {
134
- input.checked = value !== "false";
135
- } else {
136
- input.value = value;
131
+ if (activateAttrUrlParameters) {
132
+ params.forEach((value, key) => {
133
+ if (!(key in attributes)) {
134
+ return;
137
135
  }
138
- }
139
- });
136
+ wc.setAttribute(key, value);
137
+
138
+ const input = document.querySelector(`[name=${key}]`);
139
+ if (input) {
140
+ if (input.type === "checkbox") {
141
+ input.checked = value !== "false";
142
+ } else {
143
+ input.value = value;
144
+ }
145
+ }
146
+ });
147
+ }
140
148
 
141
149
  // Get an apikey if there is none defined
142
- if (!wc.getAttribute("apikey")) {
150
+ if (!wc.getAttribute("apikey") && !attributes.apikey.defaultValue) {
143
151
  fetch("https://backend.developer.geops.io/publickey")
144
152
  .then((response) => {
145
153
  return response.json();
@@ -334,10 +342,12 @@ function onAttributeUpdate(wc, key, value, reloadAttrs) {
334
342
  window.location.reload();
335
343
  } else {
336
344
  wc.setAttribute(key, value);
337
- window.history.replaceState(
338
- {},
339
- "",
340
- `${window.location.pathname}?${params}`,
341
- );
345
+ if (activateAttrUrlParameters) {
346
+ window.history.replaceState(
347
+ {},
348
+ "",
349
+ `${window.location.pathname}?${params}`,
350
+ );
351
+ }
342
352
  }
343
353
  }
package/index.html CHANGED
@@ -48,7 +48,6 @@
48
48
  id="code"
49
49
  class="overflow-auto rounded bg-slate-800 p-4 text-slate-200"
50
50
  ></pre>
51
-
52
51
  <geops-mobility
53
52
  id="map"
54
53
  class="block h-128 w-full resize overflow-hidden rounded-[16px] border"