@panoramax/web-viewer 3.2.3-develop-d7e5a16d → 3.2.3-develop-6257391e

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 (221) hide show
  1. package/.gitlab-ci.yml +3 -0
  2. package/CHANGELOG.md +19 -0
  3. package/CODE_OF_CONDUCT.md +1 -1
  4. package/README.md +1 -1
  5. package/build/editor.html +10 -1
  6. package/build/index.css +2 -2
  7. package/build/index.css.map +1 -1
  8. package/build/index.html +1 -1
  9. package/build/index.js +1682 -5
  10. package/build/index.js.map +1 -1
  11. package/build/map.html +1 -1
  12. package/build/viewer.html +10 -1
  13. package/build/widgets.html +1 -0
  14. package/config/jest/mocks.js +172 -0
  15. package/config/paths.js +1 -0
  16. package/config/webpack.config.js +26 -0
  17. package/docs/03_URL_settings.md +3 -11
  18. package/docs/05_Compatibility.md +59 -76
  19. package/docs/09_Develop.md +30 -11
  20. package/docs/90_Releases.md +2 -2
  21. package/docs/images/class_diagram.drawio +28 -28
  22. package/docs/images/class_diagram.jpg +0 -0
  23. package/docs/index.md +112 -0
  24. package/docs/reference/components/core/Basic.md +153 -0
  25. package/docs/reference/components/core/CoverageMap.md +160 -0
  26. package/docs/reference/components/core/Editor.md +172 -0
  27. package/docs/reference/components/core/Viewer.md +288 -0
  28. package/docs/reference/components/layout/CorneredGrid.md +29 -0
  29. package/docs/reference/components/layout/Mini.md +45 -0
  30. package/docs/reference/components/menus/MapBackground.md +32 -0
  31. package/docs/reference/components/menus/MapFilters.md +15 -0
  32. package/docs/reference/components/menus/MapLayers.md +15 -0
  33. package/docs/reference/components/menus/MapLegend.md +15 -0
  34. package/docs/reference/components/menus/PictureLegend.md +15 -0
  35. package/docs/reference/components/menus/PictureMetadata.md +15 -0
  36. package/docs/reference/components/menus/PlayerOptions.md +15 -0
  37. package/docs/reference/components/menus/QualityScoreDoc.md +15 -0
  38. package/docs/reference/components/menus/ReportForm.md +15 -0
  39. package/docs/reference/components/menus/ShareMenu.md +15 -0
  40. package/docs/reference/components/ui/Button.md +39 -0
  41. package/docs/reference/components/ui/ButtonGroup.md +36 -0
  42. package/docs/reference/components/ui/CopyButton.md +35 -0
  43. package/docs/reference/components/ui/Grade.md +32 -0
  44. package/docs/reference/components/ui/LinkButton.md +44 -0
  45. package/docs/reference/components/ui/Loader.md +54 -0
  46. package/docs/reference/components/ui/Map.md +214 -0
  47. package/docs/reference/components/ui/MapMore.md +233 -0
  48. package/docs/reference/components/ui/Photo.md +369 -0
  49. package/docs/reference/components/ui/Popup.md +56 -0
  50. package/docs/reference/components/ui/QualityScore.md +45 -0
  51. package/docs/reference/components/ui/SearchBar.md +63 -0
  52. package/docs/reference/components/ui/TogglableGroup.md +39 -0
  53. package/docs/reference/components/ui/widgets/GeoSearch.md +32 -0
  54. package/docs/reference/components/ui/widgets/Legend.md +32 -0
  55. package/docs/reference/components/ui/widgets/MapFiltersButton.md +33 -0
  56. package/docs/reference/components/ui/widgets/MapLayersButton.md +15 -0
  57. package/docs/reference/components/ui/widgets/Player.md +32 -0
  58. package/docs/reference/components/ui/widgets/Share.md +15 -0
  59. package/docs/reference/components/ui/widgets/Zoom.md +15 -0
  60. package/docs/reference/utils/API.md +311 -0
  61. package/docs/reference/utils/InitParameters.md +67 -0
  62. package/docs/reference/utils/URLHandler.md +102 -0
  63. package/docs/reference.md +73 -0
  64. package/docs/shortcuts.md +11 -0
  65. package/docs/tutorials/aerial_imagery.md +19 -0
  66. package/docs/tutorials/authentication.md +10 -0
  67. package/docs/tutorials/custom_widgets.md +64 -0
  68. package/docs/tutorials/map_style.md +27 -0
  69. package/docs/tutorials/migrate_v4.md +122 -0
  70. package/docs/tutorials/synced_coverage.md +42 -0
  71. package/mkdocs.yml +60 -5
  72. package/package.json +10 -7
  73. package/public/editor.html +21 -29
  74. package/public/index.html +3 -3
  75. package/public/map.html +19 -18
  76. package/public/viewer.html +18 -24
  77. package/public/widgets.html +265 -0
  78. package/scripts/doc.js +77 -0
  79. package/src/components/core/Basic.css +44 -0
  80. package/src/components/core/Basic.js +258 -0
  81. package/src/components/core/CoverageMap.css +9 -0
  82. package/src/components/core/CoverageMap.js +105 -0
  83. package/src/components/core/Editor.css +23 -0
  84. package/src/components/core/Editor.js +354 -0
  85. package/src/components/core/Viewer.css +109 -0
  86. package/src/components/core/Viewer.js +707 -0
  87. package/src/components/core/index.js +11 -0
  88. package/src/components/index.js +13 -0
  89. package/src/components/layout/CorneredGrid.js +109 -0
  90. package/src/components/layout/Mini.js +117 -0
  91. package/src/components/layout/index.js +7 -0
  92. package/src/components/menus/MapBackground.js +106 -0
  93. package/src/components/menus/MapFilters.js +386 -0
  94. package/src/components/menus/MapLayers.js +143 -0
  95. package/src/components/menus/MapLegend.js +54 -0
  96. package/src/components/menus/PictureLegend.js +103 -0
  97. package/src/components/menus/PictureMetadata.js +188 -0
  98. package/src/components/menus/PlayerOptions.js +96 -0
  99. package/src/components/menus/QualityScoreDoc.js +36 -0
  100. package/src/components/menus/ReportForm.js +133 -0
  101. package/src/components/menus/Share.js +228 -0
  102. package/src/components/menus/index.js +15 -0
  103. package/src/components/styles.js +365 -0
  104. package/src/components/ui/Button.js +75 -0
  105. package/src/components/ui/ButtonGroup.css +49 -0
  106. package/src/components/ui/ButtonGroup.js +68 -0
  107. package/src/components/ui/CopyButton.js +71 -0
  108. package/src/components/ui/Grade.js +54 -0
  109. package/src/components/ui/LinkButton.js +68 -0
  110. package/src/components/ui/Loader.js +188 -0
  111. package/src/components/{Map.css → ui/Map.css} +5 -17
  112. package/src/components/{Map.js → ui/Map.js} +114 -138
  113. package/src/components/ui/MapMore.js +324 -0
  114. package/src/components/{Photo.css → ui/Photo.css} +6 -6
  115. package/src/components/{Photo.js → ui/Photo.js} +279 -90
  116. package/src/components/ui/Popup.js +145 -0
  117. package/src/components/ui/QualityScore.js +152 -0
  118. package/src/components/ui/SearchBar.js +363 -0
  119. package/src/components/ui/TogglableGroup.js +162 -0
  120. package/src/components/ui/index.js +20 -0
  121. package/src/components/ui/widgets/GeoSearch.css +21 -0
  122. package/src/components/ui/widgets/GeoSearch.js +139 -0
  123. package/src/components/ui/widgets/Legend.js +51 -0
  124. package/src/components/ui/widgets/MapFiltersButton.js +104 -0
  125. package/src/components/ui/widgets/MapLayersButton.js +79 -0
  126. package/src/components/ui/widgets/Player.css +7 -0
  127. package/src/components/ui/widgets/Player.js +148 -0
  128. package/src/components/ui/widgets/Share.js +30 -0
  129. package/src/components/ui/widgets/Zoom.js +82 -0
  130. package/src/components/ui/widgets/index.js +12 -0
  131. package/src/img/panoramax.svg +13 -0
  132. package/src/img/switch_big.svg +20 -10
  133. package/src/index.js +6 -9
  134. package/src/translations/da.json +1 -1
  135. package/src/translations/de.json +1 -1
  136. package/src/translations/en.json +5 -3
  137. package/src/translations/eo.json +1 -1
  138. package/src/translations/es.json +1 -1
  139. package/src/translations/fr.json +5 -3
  140. package/src/translations/hu.json +1 -1
  141. package/src/translations/it.json +1 -1
  142. package/src/translations/ja.json +1 -1
  143. package/src/translations/nl.json +1 -1
  144. package/src/translations/pl.json +1 -1
  145. package/src/translations/sv.json +1 -1
  146. package/src/translations/zh_Hant.json +1 -1
  147. package/src/utils/API.js +74 -42
  148. package/src/utils/InitParameters.js +354 -0
  149. package/src/utils/URLHandler.js +364 -0
  150. package/src/utils/geocoder.js +116 -0
  151. package/src/utils/{I18n.js → i18n.js} +3 -1
  152. package/src/utils/index.js +11 -0
  153. package/src/utils/{Map.js → map.js} +216 -80
  154. package/src/utils/picture.js +433 -0
  155. package/src/utils/utils.js +315 -0
  156. package/src/utils/widgets.js +93 -0
  157. package/tests/components/ui/CopyButton.test.js +52 -0
  158. package/tests/components/ui/Loader.test.js +54 -0
  159. package/tests/components/{Map.test.js → ui/Map.test.js} +19 -61
  160. package/tests/components/{Photo.test.js → ui/Photo.test.js} +89 -57
  161. package/tests/components/ui/Popup.test.js +24 -0
  162. package/tests/components/ui/QualityScore.test.js +17 -0
  163. package/tests/components/ui/SearchBar.test.js +107 -0
  164. package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +34 -0
  165. package/tests/components/ui/__snapshots__/Loader.test.js.snap +56 -0
  166. package/tests/components/{__snapshots__ → ui/__snapshots__}/Map.test.js.snap +11 -38
  167. package/tests/components/{__snapshots__ → ui/__snapshots__}/Photo.test.js.snap +57 -4
  168. package/tests/components/ui/__snapshots__/Popup.test.js.snap +29 -0
  169. package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +11 -0
  170. package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +65 -0
  171. package/tests/utils/API.test.js +1 -14
  172. package/tests/utils/InitParameters.test.js +485 -0
  173. package/tests/utils/URLHandler.test.js +350 -0
  174. package/tests/utils/__snapshots__/URLHandler.test.js.snap +21 -0
  175. package/tests/utils/__snapshots__/picture.test.js.snap +315 -0
  176. package/tests/utils/__snapshots__/widgets.test.js.snap +19 -0
  177. package/tests/utils/geocoder.test.js +37 -0
  178. package/tests/utils/{I18n.test.js → i18n.test.js} +1 -1
  179. package/tests/utils/map.test.js +67 -0
  180. package/tests/utils/picture.test.js +745 -0
  181. package/tests/utils/utils.test.js +288 -0
  182. package/tests/utils/widgets.test.js +90 -0
  183. package/docs/01_Start.md +0 -149
  184. package/docs/02_Usage.md +0 -831
  185. package/docs/04_Advanced_examples.md +0 -216
  186. package/src/Editor.css +0 -37
  187. package/src/Editor.js +0 -361
  188. package/src/StandaloneMap.js +0 -114
  189. package/src/Viewer.css +0 -203
  190. package/src/Viewer.js +0 -1246
  191. package/src/components/CoreView.css +0 -70
  192. package/src/components/CoreView.js +0 -175
  193. package/src/components/Loader.css +0 -74
  194. package/src/components/Loader.js +0 -120
  195. package/src/utils/Exif.js +0 -193
  196. package/src/utils/Utils.js +0 -631
  197. package/src/utils/Widgets.js +0 -562
  198. package/src/viewer/URLHash.js +0 -469
  199. package/src/viewer/Widgets.css +0 -880
  200. package/src/viewer/Widgets.js +0 -1470
  201. package/tests/Editor.test.js +0 -126
  202. package/tests/StandaloneMap.test.js +0 -45
  203. package/tests/Viewer.test.js +0 -366
  204. package/tests/__snapshots__/Editor.test.js.snap +0 -298
  205. package/tests/__snapshots__/StandaloneMap.test.js.snap +0 -30
  206. package/tests/__snapshots__/Viewer.test.js.snap +0 -195
  207. package/tests/components/CoreView.test.js +0 -92
  208. package/tests/components/Loader.test.js +0 -38
  209. package/tests/components/__snapshots__/Loader.test.js.snap +0 -15
  210. package/tests/utils/Exif.test.js +0 -124
  211. package/tests/utils/Map.test.js +0 -113
  212. package/tests/utils/Utils.test.js +0 -300
  213. package/tests/utils/Widgets.test.js +0 -107
  214. package/tests/utils/__snapshots__/Exif.test.js.snap +0 -43
  215. package/tests/utils/__snapshots__/Utils.test.js.snap +0 -41
  216. package/tests/utils/__snapshots__/Widgets.test.js.snap +0 -44
  217. package/tests/viewer/URLHash.test.js +0 -559
  218. package/tests/viewer/Widgets.test.js +0 -127
  219. package/tests/viewer/__snapshots__/URLHash.test.js.snap +0 -108
  220. package/tests/viewer/__snapshots__/Widgets.test.js.snap +0 -403
  221. /package/tests/utils/__snapshots__/{Map.test.js.snap → geocoder.test.js.snap} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "3.2.3-develop-d7e5a16d",
3
+ "version": "3.2.3-develop-6257391e",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -9,7 +9,7 @@
9
9
  "build": "node scripts/build.js",
10
10
  "test": "node scripts/test.js",
11
11
  "lint": "npx eslint --fix src/*.js src/**/*.js",
12
- "doc": "documentation build src -f md --markdown-toc-max-depth 2 -o ./docs/02_Usage.md",
12
+ "doc": "node scripts/doc.js",
13
13
  "coverage": "node scripts/test.js --coverage --watchAll=false",
14
14
  "trypublish": "npm publish || true"
15
15
  },
@@ -60,6 +60,7 @@
60
60
  "jest": "^27.4.3",
61
61
  "jest-resolve": "^29.4.1",
62
62
  "jest-watch-typeahead": "^2.1.1",
63
+ "jsdoc-to-markdown": "^9.1.1",
63
64
  "mini-css-extract-plugin": "^2.7.2",
64
65
  "postcss": "^8.4.21",
65
66
  "postcss-flexbugs-fixes": "^5.0.2",
@@ -96,9 +97,10 @@
96
97
  "@photo-sphere-viewer/gallery-plugin": "5.11.0-beta.1",
97
98
  "@photo-sphere-viewer/markers-plugin": "5.11.0-beta.1",
98
99
  "@photo-sphere-viewer/virtual-tour-plugin": "5.11.0-beta.1",
99
- "documentation": "^14.0.1",
100
+ "lit": "^3.2.1",
100
101
  "maplibre-gl": "^4.7.1",
101
- "pmtiles": "^3.2.0"
102
+ "pmtiles": "^3.2.0",
103
+ "query-selector-shadow-dom": "^1.0.1"
102
104
  },
103
105
  "eslintConfig": {
104
106
  "env": {
@@ -188,10 +190,11 @@
188
190
  "setupFiles": [
189
191
  "react-app-polyfill/jsdom"
190
192
  ],
191
- "setupFilesAfterEnv": [],
193
+ "setupFilesAfterEnv": [
194
+ "<rootDir>/config/jest/mocks.js"
195
+ ],
192
196
  "testMatch": [
193
- "<rootDir>/tests/**/__tests__/**/*.{js,jsx,ts,tsx}",
194
- "<rootDir>/tests/**/*.{spec,test}.{js,jsx,ts,tsx}"
197
+ "<rootDir>/tests/**/*.test.js"
195
198
  ],
196
199
  "testEnvironment": "jsdom",
197
200
  "transform": {
@@ -13,10 +13,7 @@
13
13
  }
14
14
  #editor.fullpage {
15
15
  position: fixed;
16
- top: 0;
17
- bottom: 0;
18
- left: 0;
19
- right: 0;
16
+ inset: 0;
20
17
  height: unset;
21
18
  width: unset;
22
19
  margin: 0;
@@ -27,30 +24,25 @@
27
24
  <noscript>
28
25
  You need to enable JavaScript to run this app.
29
26
  </noscript>
30
- <div id="editor" class="fullpage"></div>
31
- <script>
32
- var editor;
33
- window.onload = () => {
34
- editor = new Panoramax.Editor(
35
- "editor",
36
- "https://panoramax.openstreetmap.fr/api",
37
- {
38
- selectedSequence: "ecfe4b2c-0acd-4d3a-a10d-c3e6818755c8",
39
- selectedPicture: "329af5c6-4761-4a6d-9c1e-674fd6daa8b6",
40
- background: "aerial",
41
- raster: {
42
- type: "raster",
43
- tiles: [
44
- "https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM_0_21&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}"
45
- ],
46
- minzoom: 0,
47
- maxzoom: 21,
48
- attribution: "&copy; IGN",
49
- tileSize: 256
50
- }
51
- }
52
- );
53
- };
54
- </script>
27
+
28
+ <pnx-editor
29
+ id="editor"
30
+ class="fullpage"
31
+ endpoint="https://panoramax.openstreetmap.fr/api"
32
+ sequence="ecfe4b2c-0acd-4d3a-a10d-c3e6818755c8"
33
+ picture="329af5c6-4761-4a6d-9c1e-674fd6daa8b6"
34
+ background="aerial"
35
+ raster='{
36
+ "type": "raster",
37
+ "tiles": [
38
+ "https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM_0_21&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}"
39
+ ],
40
+ "minzoom": 0,
41
+ "maxzoom": 21,
42
+ "attribution": "&copy; IGN",
43
+ "tileSize": 256
44
+ }'
45
+ ></pnx-editor>
46
+
55
47
  </body>
56
48
  </html>
package/public/index.html CHANGED
@@ -34,7 +34,7 @@
34
34
  You need to enable JavaScript to run this app.
35
35
  </noscript>
36
36
  <h1>Panoramax JavaScript Client</h1>
37
- <p>Panoramax JS library offers different views to suit your needs.</p>
37
+ <p>Panoramax JS library offers different views to suit your needs.<br />You can also give a look at the <a href="./widgets.html">widgets test page</a>.</p>
38
38
 
39
39
  <div class="allViews">
40
40
  <div class="oneView">
@@ -44,8 +44,8 @@
44
44
  </div>
45
45
 
46
46
  <div class="oneView">
47
- <h2 id="map">Standalone Map</h2>
48
- <p>A map-only view, to locate sequences and pictures.<br /><a href="./map.html">Full page</a> | <a href="https://gitlab.com/panoramax/clients/web-viewer/-/blob/develop/docs/02_Usage.md#standalonemap">Docs</a></p>
47
+ <h2 id="map">Coverage Map</h2>
48
+ <p>A map-only view, to locate sequences and pictures.<br /><a href="./map.html">Full page</a> | <a href="https://gitlab.com/panoramax/clients/web-viewer/-/blob/develop/docs/02_Usage.md#CoverageMap">Docs</a></p>
49
49
  <iframe src="./map.html"></iframe>
50
50
  </div>
51
51
 
package/public/map.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
- <title>Panoramax Standalone Map</title>
6
+ <title>Panoramax Coverage Map</title>
7
7
  <style>
8
8
  #map {
9
9
  position: relative;
@@ -27,27 +27,28 @@
27
27
  <noscript>
28
28
  You need to enable JavaScript to run this app.
29
29
  </noscript>
30
- <div id="map" class="fullpage"></div>
30
+
31
+ <pnx-coverage-map
32
+ id="coverage"
33
+ class="fullpage"
34
+ endpoint="https://api.panoramax.xyz/api"
35
+ />
36
+
31
37
  <script>
32
- var map;
33
- window.onload = () => {
34
- map = new Panoramax.StandaloneMap(
35
- "map",
36
- "https://api.panoramax.xyz/api",
37
- );
38
+ // Retrieve component from DOM
39
+ var coverage = document.getElementById("coverage");
38
40
 
39
- map.addEventListener("ready", () => {
40
- // Show in console selected seq/pic
41
- map.addEventListener("select", e => {
42
- console.log("Selected sequence", e.detail.seqId, "picture", e.detail.picId);
43
- });
41
+ coverage.addEventListener("ready", () => {
42
+ // Listen to sequence hovered on map
43
+ coverage.map.on("sequence-hover", e => {
44
+ console.log("Hovered sequence", e.seqId);
45
+ });
44
46
 
45
- // Show in console hovered seq
46
- map.addEventListener("map:sequence-hover", e => {
47
- console.log("Hovered sequence", e.detail.seqId);
48
- });
47
+ // Listen to user clicks on map
48
+ coverage.addEventListener("select", e => {
49
+ console.log("Selected sequence", e.detail.seqId, "picture", e.detail.picId);
49
50
  });
50
- };
51
+ }, {once: true});
51
52
  </script>
52
53
  </body>
53
54
  </html>
@@ -27,9 +27,23 @@
27
27
  <noscript>
28
28
  You need to enable JavaScript to run this app.
29
29
  </noscript>
30
- <div id="viewer" class="fullpage"></div>
30
+
31
+ <pnx-viewer
32
+ id="viewer"
33
+ class="fullpage"
34
+ map='{"raster": {
35
+ "type": "raster",
36
+ "tiles": [
37
+ "https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM_0_21&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}"
38
+ ],
39
+ "minzoom": 0,
40
+ "maxzoom": 21,
41
+ "attribution": "&copy; IGN",
42
+ "tileSize": 256
43
+ }}'
44
+ />
45
+
31
46
  <script>
32
- var viewer;
33
47
  var servers = {
34
48
  meta: "https://api.panoramax.xyz/api",
35
49
  ign: "https://panoramax.ign.fr/api",
@@ -41,28 +55,8 @@
41
55
  var server = servers[urlParams.get("server") || "meta"];
42
56
 
43
57
  window.onload = () => {
44
- viewer = new Panoramax.Viewer(
45
- "viewer",
46
- server,
47
- {
48
- widgets: {
49
- iframeBaseURL: "https://api.panoramax.xyz/"
50
- },
51
- map: {
52
- startWide: true,
53
- raster: {
54
- type: "raster",
55
- tiles: [
56
- "https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM_0_21&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}"
57
- ],
58
- minzoom: 0,
59
- maxzoom: 21,
60
- attribution: "&copy; IGN",
61
- tileSize: 256
62
- }
63
- }
64
- }
65
- );
58
+ var viewer = document.getElementById("viewer");
59
+ viewer.setAttribute("endpoint", server);
66
60
  };
67
61
  </script>
68
62
  </body>
@@ -0,0 +1,265 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
+ <title>Panoramax Widgets</title>
7
+ <style>
8
+ body {
9
+ font-family: sans-serif;
10
+ padding-bottom: 100px;
11
+ }
12
+ h2 { text-align: center; }
13
+ .test-bench {
14
+ display: flex;
15
+ width: 100%;
16
+ max-width: 600px;
17
+ margin: 7px auto;
18
+ justify-content: space-between;
19
+ align-items: center;
20
+ }
21
+ .test-bench h3 { margin: 0; }
22
+ hr.test-sep {
23
+ width: 100%;
24
+ max-width: 600px;
25
+ }
26
+ </style>
27
+ </head>
28
+ <body>
29
+ <noscript>You need to enable JavaScript to run this app.</noscript>
30
+ <h1>Panoramax widgets</h1>
31
+ <p>Test page for common Panoramax viewer widgets</p>
32
+
33
+ <h2>Button</h2>
34
+ <div class="test-bench"><h3>Text + click</h3><pnx-button onclick="alert('Stuff')">Click to do stuff</pnx-button></div>
35
+ <div class="test-bench"><h3>Icon</h3><pnx-button>⚙️ Settings</pnx-button></div>
36
+ <div class="test-bench"><h3>Active</h3><pnx-button active="true">Settings</pnx-button></div>
37
+ <div class="test-bench">
38
+ <h3>CSS override</h3>
39
+ <div style="width: 50%; display: flex; gap: 5px; max-width: 300px">
40
+ <pnx-button style="width: 50%;">⚙️ Settings</pnx-button>
41
+ <pnx-button style="width: 50%;">🖨️ Print</pnx-button>
42
+ </div>
43
+ </div>
44
+ <hr class="test-sep" />
45
+ <div class="test-bench"><h3>Full</h3><pnx-button kind="full">⚙️ Settings</pnx-button></div>
46
+ <div class="test-bench"><h3>Full active</h3><pnx-button kind="full" active>⚙️ Settings</pnx-button></div>
47
+ <div class="test-bench"><h3>Full L</h3><pnx-button kind="full" size="l">⚙️</pnx-button></div>
48
+ <div class="test-bench"><h3>Full XXL</h3><pnx-button kind="full" size="xxl">⚙️</pnx-button></div>
49
+ <div class="test-bench"><h3>Outline</h3><pnx-button kind="outline">⚙️ Settings</pnx-button></div>
50
+ <div class="test-bench"><h3>Outline active</h3><pnx-button kind="outline" active>⚙️ Settings</pnx-button></div>
51
+ <div class="test-bench"><h3>Outline L</h3><pnx-button kind="outline" size="l">⚙️</pnx-button></div>
52
+ <div class="test-bench"><h3>Outline XXL</h3><pnx-button kind="outline" size="xxl">⚙️</pnx-button></div>
53
+ <div class="test-bench"><h3>Flat</h3><pnx-button kind="flat">⚙️ Settings</pnx-button></div>
54
+ <div class="test-bench"><h3>Flat active</h3><pnx-button kind="flat" active>⚙️ Settings</pnx-button></div>
55
+ <div class="test-bench"><h3>Flat L</h3><pnx-button kind="flat" size="l">⚙️</pnx-button></div>
56
+ <div class="test-bench"><h3>Flat XXL</h3><pnx-button kind="flat" size="xxl">⚙️</pnx-button></div>
57
+
58
+ <h2>Link Button</h2>
59
+ <div class="test-bench"><h3>None set</h3><pnx-link-button>Click for nothing</pnx-link-button></div>
60
+ <div class="test-bench"><h3>All set</h3><pnx-link-button target="_blank" href="https://panoramax.fr" title="Do stuff">Click to do stuff</pnx-link-button></div>
61
+
62
+ <h2>Copy button</h2>
63
+ <div class="test-bench"><h3>Default + text</h3><pnx-copy-button text="copypasta1"></pnx-copy-button></div>
64
+ <div class="test-bench"><h3>Custom + text</h3><pnx-copy-button text="copypasta2">🌐 Share URL</pnx-copy-button></div>
65
+ <div class="test-bench">
66
+ <h3>Default + input</h3>
67
+ <div style="display: flex; gap: 5px; align-items: center;">
68
+ <input type="text" value="copypasta3" id="copy-input-1" />
69
+ <pnx-copy-button input="copy-input-1"></pnx-copy-button>
70
+ </div>
71
+ </div>
72
+
73
+ <h2>Button Group</h2>
74
+ <div class="test-bench">
75
+ <h3>Full Row x2</h3>
76
+ <div>
77
+ <pnx-button-group dir="row">
78
+ <pnx-button>☹️</pnx-button>
79
+ <pnx-button>🙂</pnx-button>
80
+ </pnx-button-group>
81
+ </div>
82
+ </div>
83
+ <div class="test-bench">
84
+ <h3>Full Row x3</h3>
85
+ <div>
86
+ <pnx-button-group dir="row">
87
+ <pnx-button>☹️</pnx-button>
88
+ <pnx-button>😐</pnx-button>
89
+ <pnx-button>🙂</pnx-button>
90
+ </pnx-button-group>
91
+ </div>
92
+ </div>
93
+ <div class="test-bench">
94
+ <h3>Full Row mixed</h3>
95
+ <div>
96
+ <pnx-button-group dir="row">
97
+ <pnx-button>☹️</pnx-button>
98
+ <pnx-link-button>😐</pnx-link-button>
99
+ <pnx-copy-button>🙂</pnx-copy-button>
100
+ </pnx-button-group>
101
+ </div>
102
+ </div>
103
+ <div class="test-bench">
104
+ <h3>Full Column x2</h3>
105
+ <div>
106
+ <pnx-button-group dir="column">
107
+ <pnx-button>☹️</pnx-button>
108
+ <pnx-button>🙂</pnx-button>
109
+ </pnx-button-group>
110
+ </div>
111
+ </div>
112
+ <div class="test-bench">
113
+ <h3>Full Column x3</h3>
114
+ <div>
115
+ <pnx-button-group dir="column">
116
+ <pnx-button>☹️</pnx-button>
117
+ <pnx-button>😐</pnx-button>
118
+ <pnx-button>🙂</pnx-button>
119
+ </pnx-button-group>
120
+ </div>
121
+ </div>
122
+ <div class="test-bench">
123
+ <h3>Full Column mixed</h3>
124
+ <div>
125
+ <pnx-button-group dir="column">
126
+ <pnx-button>☹️</pnx-button>
127
+ <pnx-link-button>😐</pnx-link-button>
128
+ <pnx-copy-button>🙂</pnx-copy-button>
129
+ </pnx-button-group>
130
+ </div>
131
+ </div>
132
+ <hr class="test-sep" />
133
+ <div class="test-bench">
134
+ <h3>Outline Row x2</h3>
135
+ <div>
136
+ <pnx-button-group dir="row">
137
+ <pnx-button kind="outline">☹️</pnx-button>
138
+ <pnx-button kind="outline">🙂</pnx-button>
139
+ </pnx-button-group>
140
+ </div>
141
+ </div>
142
+ <div class="test-bench">
143
+ <h3>Outline Row x3</h3>
144
+ <div>
145
+ <pnx-button-group dir="row">
146
+ <pnx-button kind="outline">☹️</pnx-button>
147
+ <pnx-button kind="outline">😐</pnx-button>
148
+ <pnx-button kind="outline">🙂</pnx-button>
149
+ </pnx-button-group>
150
+ </div>
151
+ </div>
152
+ <div class="test-bench">
153
+ <h3>Outline Column x2</h3>
154
+ <div>
155
+ <pnx-button-group dir="column">
156
+ <pnx-button kind="outline">☹️</pnx-button>
157
+ <pnx-button kind="outline">🙂</pnx-button>
158
+ </pnx-button-group>
159
+ </div>
160
+ </div>
161
+ <div class="test-bench">
162
+ <h3>Outline Column x3</h3>
163
+ <div>
164
+ <pnx-button-group dir="column">
165
+ <pnx-button kind="outline">☹️</pnx-button>
166
+ <pnx-button kind="outline">😐</pnx-button>
167
+ <pnx-button kind="outline">🙂</pnx-button>
168
+ </pnx-button-group>
169
+ </div>
170
+ </div>
171
+ <hr class="test-sep" />
172
+ <div class="test-bench">
173
+ <h3>Flat Row x2</h3>
174
+ <div>
175
+ <pnx-button-group dir="row">
176
+ <pnx-button kind="flat">☹️</pnx-button>
177
+ <pnx-button kind="flat">🙂</pnx-button>
178
+ </pnx-button-group>
179
+ </div>
180
+ </div>
181
+ <div class="test-bench">
182
+ <h3>Flat Row x3</h3>
183
+ <div>
184
+ <pnx-button-group dir="row">
185
+ <pnx-button kind="flat">☹️</pnx-button>
186
+ <pnx-button kind="flat">😐</pnx-button>
187
+ <pnx-button kind="flat">🙂</pnx-button>
188
+ </pnx-button-group>
189
+ </div>
190
+ </div>
191
+ <div class="test-bench">
192
+ <h3>Flat Column x2</h3>
193
+ <div>
194
+ <pnx-button-group dir="column">
195
+ <pnx-button kind="flat">☹️</pnx-button>
196
+ <pnx-button kind="flat">🙂</pnx-button>
197
+ </pnx-button-group>
198
+ </div>
199
+ </div>
200
+ <div class="test-bench">
201
+ <h3>Flat Column x3</h3>
202
+ <div>
203
+ <pnx-button-group dir="column">
204
+ <pnx-button kind="flat">☹️</pnx-button>
205
+ <pnx-button kind="flat">😐</pnx-button>
206
+ <pnx-button kind="flat">🙂</pnx-button>
207
+ </pnx-button-group>
208
+ </div>
209
+ </div>
210
+ <hr class="test-sep" />
211
+ <div class="test-bench">
212
+ <h3>Row XL</h3>
213
+ <div>
214
+ <pnx-button-group size="xl" dir="row">
215
+ <pnx-button kind="flat">☹️</pnx-button>
216
+ <pnx-button kind="flat">😐</pnx-button>
217
+ <pnx-button kind="flat">🙂</pnx-button>
218
+ </pnx-button-group>
219
+ </div>
220
+ </div>
221
+ <div class="test-bench">
222
+ <h3>Column XL</h3>
223
+ <div>
224
+ <pnx-button-group size="xl" dir="column">
225
+ <pnx-button kind="flat">☹️</pnx-button>
226
+ <pnx-button kind="flat">😐</pnx-button>
227
+ <pnx-button kind="flat">🙂</pnx-button>
228
+ </pnx-button-group>
229
+ </div>
230
+ </div>
231
+
232
+ <h2>5-stars grade</h2>
233
+ <div class="test-bench"><h3>With a grade</h3><pnx-grade stars="5" /></div>
234
+ <div class="test-bench"><h3>Without a grade</h3><pnx-grade /></div>
235
+
236
+ <h2>Quality Score</h2>
237
+ <div class="test-bench"><h3>Classic no grade</h3><pnx-quality-score /></div>
238
+ <div class="test-bench"><h3>Classic 1/5</h3><pnx-quality-score grade="1" /></div>
239
+ <div class="test-bench"><h3>Classic 2/5</h3><pnx-quality-score grade="2" /></div>
240
+ <div class="test-bench"><h3>Classic 3/5</h3><pnx-quality-score grade="3" /></div>
241
+ <div class="test-bench"><h3>Classic 4/5</h3><pnx-quality-score grade="4" /></div>
242
+ <div class="test-bench"><h3>Classic 5/5</h3><pnx-quality-score grade="5" /></div>
243
+ <hr class="test-sep" />
244
+ <div class="test-bench"><h3>Input</h3><pnx-quality-score input="qs" /></div>
245
+ <div class="test-bench"><h3>Input 1/5</h3><pnx-quality-score input="qs" grade="1" /></div>
246
+ <div class="test-bench"><h3>Input 2/5</h3><pnx-quality-score input="qs" grade="2" /></div>
247
+ <div class="test-bench"><h3>Input 3/5</h3><pnx-quality-score input="qs" grade="3" /></div>
248
+ <div class="test-bench"><h3>Input 4/5</h3><pnx-quality-score input="qs" grade="4" /></div>
249
+ <div class="test-bench"><h3>Input 5/5</h3><pnx-quality-score input="qs" grade="5" /></div>
250
+ <div class="test-bench"><h3>Input many</h3><pnx-quality-score input="qs" grade="1,3,5" /></div>
251
+
252
+ <h2>Search bar</h2>
253
+ <div class="test-bench"><h3>Simple</h3><pnx-search-bar placeholder="Start your search"></pnx-search-bar></div>
254
+ <div class="test-bench"><h3>With pre</h3><pnx-search-bar placeholder="Look for a place"><span slot="pre">🗺️</span></pnx-search-bar></div>
255
+ <div class="test-bench">
256
+ <h3>Reduced</h3>
257
+ <pnx-search-bar reduceable reduced placeholder="Look for a place"></pnx-search-bar>
258
+ </div>
259
+ <hr class="test-sep" />
260
+ <div class="test-bench"><h3>Size md full</h3><pnx-search-bar size="md" placeholder="Look for a place"><span slot="pre">🗺️</span></pnx-search-bar></div>
261
+ <div class="test-bench"><h3>Size md reduced</h3><pnx-search-bar size="md" reduceable reduced placeholder="Look for a place"></pnx-search-bar></div>
262
+ <div class="test-bench"><h3>Size xxl full</h3><pnx-search-bar size="xxl" placeholder="Look for a place"><span slot="pre">🗺️</span></pnx-search-bar></div>
263
+ <div class="test-bench"><h3>Size xxl reduced</h3><pnx-search-bar size="xxl" reduceable reduced placeholder="Look for a place"></pnx-search-bar></div>
264
+ </body>
265
+ </html>
package/scripts/doc.js ADDED
@@ -0,0 +1,77 @@
1
+ /*
2
+ * Widely based on https://github.com/jsdoc2md/jsdoc-to-markdown/wiki/How-to-create-one-output-file-per-class
3
+ */
4
+
5
+ const jsdoc2md = require("jsdoc-to-markdown");
6
+ const fs = require("node:fs").promises;
7
+ const path = require("path");
8
+
9
+ const SRC_FOLDER = path.resolve(__dirname, "..", "src");
10
+ const OUTPUT_FOLDER = path.resolve(__dirname, "..", "docs", "reference");
11
+ const MD_LINK_RGX = /\[([^\]]+)\]\(#([^+)]+)\+?([^)]+)?\)/g;
12
+
13
+ // Remove all stuff in docs/reference/ folder
14
+ async function cleanupDocFolder(folder) {
15
+ await fs.rm(folder, {recursive: true, force: true});
16
+ }
17
+
18
+ // Create subfolders in docs/reference/ to match JS files folder tree
19
+ async function createSubFolders(fullFolder) {
20
+ const relPath = path.relative(SRC_FOLDER, fullFolder);
21
+ const docPath = path.join(OUTPUT_FOLDER, relPath);
22
+ await fs.mkdir(docPath, {recursive: true});
23
+ return docPath;
24
+ }
25
+
26
+ // Replace links in generated Markdown to go to relative file instead of same file
27
+ function cleanupMdLinks(clid, md) {
28
+ return md.replace(MD_LINK_RGX, (match, text, link, plus) => {
29
+ if(link == clid || link == `new_${clid}_new` || link.startsWith(clid+".")) { return match; }
30
+
31
+ const linkClassPath = link.split("+")[0].split(".").slice(1);
32
+ const currentClassPath = clid.split(".").slice(1);
33
+ const relPath = path.relative(
34
+ path.dirname(currentClassPath.join("/")+".md"),
35
+ linkClassPath.join("/")+".md"
36
+ );
37
+ return `[${text}](${relPath}/#${link}${plus ? "+"+plus : ""})`;
38
+ });
39
+ }
40
+
41
+ // Create MD file for a single JS file
42
+ async function writeDocs(templateData) {
43
+ const classes = templateData.filter(i => i.kind === "class" && i.name !== "exports");
44
+ for(let cl of classes) {
45
+ console.log("Generating doc for", cl.name);
46
+ const docPath = await createSubFolders(cl.meta.path);
47
+ const template = `{{#class name="${cl.name}"}}{{>docs}}{{/class}}`;
48
+ let output = await jsdoc2md.render({ data: templateData, template: template });
49
+ output = cleanupMdLinks(cl.id, output);
50
+ await fs.writeFile(path.resolve(docPath, `${cl.name}.md`), output);
51
+ }
52
+ }
53
+
54
+ // Recursive load of JS files
55
+ async function readSingleFolder(folder) {
56
+ console.log("Searching in folder", path.basename(folder));
57
+ let jsfiles = [];
58
+ const files = await fs.readdir(folder);
59
+ for(let file of files) {
60
+ const filepath = path.join(folder, file);
61
+ const stat = await fs.stat(filepath);
62
+
63
+ if(stat.isDirectory()) {
64
+ jsfiles = jsfiles.concat(await readSingleFolder(filepath));
65
+ }
66
+ else if(stat.isFile() && path.extname(filepath) === ".js") {
67
+ jsfiles.push(filepath);
68
+ }
69
+ }
70
+ return jsfiles;
71
+ }
72
+
73
+ // Main code execution
74
+ cleanupDocFolder(OUTPUT_FOLDER)
75
+ .then(() => readSingleFolder(SRC_FOLDER))
76
+ .then(files => jsdoc2md.getTemplateData({ files }))
77
+ .then(writeDocs);
@@ -0,0 +1,44 @@
1
+ /* Colors */
2
+ :root {
3
+ --white: #ffffff;
4
+ --black: #181818;
5
+ --black-pale: #1b1a17;
6
+ --red: #f70000;
7
+ --red-pale: #ff726f;
8
+ --grey: #f5f5f5;
9
+ --grey-pale: #cfd2cf;
10
+ --grey-semi-dark: #808080;
11
+ --grey-dark: #3e3e3e;
12
+ --blue: #2954e9;
13
+ --blue-dark: #0a1f69;
14
+ --blue-semi: #d7dffc;
15
+ --blue-pale: #f2f5ff;
16
+ --blue-geovisio: #34495e;
17
+ --beige: #f5f3ec;
18
+ --yellow: #fec868;
19
+ --orange: #ff6f00;
20
+ --orange-pale: #fffafa;
21
+ --green: #7ec636;
22
+ --green-pale: #f0ffee;
23
+ --widget-bg: var(--white);
24
+ --widget-bg-hover: var(--grey);
25
+ --widget-bg-active: var(--blue);
26
+ --widget-bg-inactive: var(--grey-pale);
27
+ --widget-bg-primary: var(--blue-semi);
28
+ --widget-bg-primary-hover: #e0e7ff;
29
+ --widget-border-div: var(--grey-pale);
30
+ --widget-border-btn: var(--blue);
31
+ --widget-font: var(--grey-dark);
32
+ --widget-font-active: var(--white);
33
+ --widget-font-direct: var(--blue);
34
+ }
35
+
36
+ /* Hidden elements on mobile */
37
+ @container (max-width: 576px) {
38
+ .pnx-mobile-hidden { display: none !important; }
39
+ }
40
+
41
+ /* Hidden elements on print */
42
+ @media print {
43
+ .pnx-print-hidden { display: none !important; }
44
+ }