@geogirafe/lib-geoportal 0.4.0-1168862803

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 (199) hide show
  1. package/CONTRIBUTING.md +101 -0
  2. package/LICENSE +201 -0
  3. package/README.md +180 -0
  4. package/base/GirafeDraggableElement.d.ts +21 -0
  5. package/base/GirafeDraggableElement.js +148 -0
  6. package/base/GirafeHTMLElement.d.ts +52 -0
  7. package/base/GirafeHTMLElement.js +166 -0
  8. package/base/GirafeResizableElement.d.ts +21 -0
  9. package/base/GirafeResizableElement.js +265 -0
  10. package/base/GirafeSingleton.d.ts +10 -0
  11. package/base/GirafeSingleton.js +44 -0
  12. package/base/main.d.ts +4 -0
  13. package/base/main.js +4 -0
  14. package/buildtools/lib-inline.js +17 -0
  15. package/buildtools/tools.js +94 -0
  16. package/buildtools/vite-inline-templates-plugin.js +18 -0
  17. package/buildtools/vite-restart-plugin.js +14 -0
  18. package/components/about/component.d.ts +16 -0
  19. package/components/about/component.js +166 -0
  20. package/components/about/images/logo.png +0 -0
  21. package/components/basemap/component.d.ts +16 -0
  22. package/components/basemap/component.js +84 -0
  23. package/components/button/component.d.ts +23 -0
  24. package/components/button/component.js +338 -0
  25. package/components/colorswitcher/component.d.ts +24 -0
  26. package/components/colorswitcher/component.js +205 -0
  27. package/components/coordinate/component.d.ts +14 -0
  28. package/components/coordinate/component.js +88 -0
  29. package/components/globe/component.d.ts +11 -0
  30. package/components/globe/component.js +59 -0
  31. package/components/help/component.d.ts +20 -0
  32. package/components/help/component.js +230 -0
  33. package/components/help/images/arrow_black.png +0 -0
  34. package/components/help/images/arrow_black.webp +0 -0
  35. package/components/help/images/arrow_white.png +0 -0
  36. package/components/help/images/arrow_white.webp +0 -0
  37. package/components/language/component.d.ts +15 -0
  38. package/components/language/component.js +87 -0
  39. package/components/main.d.ts +24 -0
  40. package/components/main.js +24 -0
  41. package/components/map/component.d.ts +116 -0
  42. package/components/map/component.js +1002 -0
  43. package/components/map/tools/localfilemanager.d.ts +29 -0
  44. package/components/map/tools/localfilemanager.js +153 -0
  45. package/components/map/tools/osmmanager.d.ts +12 -0
  46. package/components/map/tools/osmmanager.js +41 -0
  47. package/components/map/tools/swipemanager.d.ts +29 -0
  48. package/components/map/tools/swipemanager.js +170 -0
  49. package/components/map/tools/vectortilesmanager.d.ts +12 -0
  50. package/components/map/tools/vectortilesmanager.js +40 -0
  51. package/components/map/tools/viewmanager.d.ts +30 -0
  52. package/components/map/tools/viewmanager.js +186 -0
  53. package/components/map/tools/wmsmanager.d.ts +34 -0
  54. package/components/map/tools/wmsmanager.js +284 -0
  55. package/components/map/tools/wmtsmanager.d.ts +20 -0
  56. package/components/map/tools/wmtsmanager.js +146 -0
  57. package/components/menubutton/component.d.ts +22 -0
  58. package/components/menubutton/component.js +313 -0
  59. package/components/navigation/Bookmark.d.ts +7 -0
  60. package/components/navigation/Bookmark.js +27 -0
  61. package/components/navigation/navbookmarks/component.d.ts +12 -0
  62. package/components/navigation/navbookmarks/component.js +101 -0
  63. package/components/navigation/navhelper/component.d.ts +21 -0
  64. package/components/navigation/navhelper/component.js +205 -0
  65. package/components/print/component.d.ts +194 -0
  66. package/components/print/component.js +876 -0
  67. package/components/print/tools/printMaskLayer.d.ts +19 -0
  68. package/components/print/tools/printMaskLayer.js +99 -0
  69. package/components/print/tools/printMaskManager.d.ts +33 -0
  70. package/components/print/tools/printMaskManager.js +86 -0
  71. package/components/projection/component.d.ts +15 -0
  72. package/components/projection/component.js +90 -0
  73. package/components/querybuilder/component.d.ts +21 -0
  74. package/components/querybuilder/component.js +226 -0
  75. package/components/querybuilder/tools/filterhelper.d.ts +16 -0
  76. package/components/querybuilder/tools/filterhelper.js +74 -0
  77. package/components/redlining/component.d.ts +28 -0
  78. package/components/redlining/component.js +456 -0
  79. package/components/scale/component.d.ts +14 -0
  80. package/components/scale/component.js +120 -0
  81. package/components/search/component.d.ts +28 -0
  82. package/components/search/component.js +296 -0
  83. package/components/selectiongrid/component.d.ts +21 -0
  84. package/components/selectiongrid/component.js +417 -0
  85. package/components/selectionwindow/component.d.ts +17 -0
  86. package/components/selectionwindow/component.js +207 -0
  87. package/components/themes/component.d.ts +16 -0
  88. package/components/themes/component.js +163 -0
  89. package/components/treeview/component.d.ts +23 -0
  90. package/components/treeview/component.js +322 -0
  91. package/components/treeviewgroup/component.d.ts +20 -0
  92. package/components/treeviewgroup/component.js +240 -0
  93. package/components/treeviewitem/component.d.ts +26 -0
  94. package/components/treeviewitem/component.js +469 -0
  95. package/components/videorecord/component.d.ts +15 -0
  96. package/components/videorecord/component.js +135 -0
  97. package/decs.d.ts +4 -0
  98. package/main.lib.d.ts +7 -0
  99. package/main.lib.js +1 -0
  100. package/models/basemap.d.ts +12 -0
  101. package/models/basemap.js +35 -0
  102. package/models/events.d.ts +6 -0
  103. package/models/events.js +7 -0
  104. package/models/gmf.d.ts +62 -0
  105. package/models/gmf.js +4 -0
  106. package/models/layers/baselayer.d.ts +23 -0
  107. package/models/layers/baselayer.js +66 -0
  108. package/models/layers/grouplayer.d.ts +20 -0
  109. package/models/layers/grouplayer.js +51 -0
  110. package/models/layers/ilayerwithfilter.d.ts +5 -0
  111. package/models/layers/ilayerwithfilter.js +1 -0
  112. package/models/layers/ilayerwithlegend.d.ts +5 -0
  113. package/models/layers/ilayerwithlegend.js +1 -0
  114. package/models/layers/layer.d.ts +20 -0
  115. package/models/layers/layer.js +49 -0
  116. package/models/layers/layerlocalfile.d.ts +21 -0
  117. package/models/layers/layerlocalfile.js +62 -0
  118. package/models/layers/layerosm.d.ts +12 -0
  119. package/models/layers/layerosm.js +26 -0
  120. package/models/layers/layervectortiles.d.ts +16 -0
  121. package/models/layers/layervectortiles.js +35 -0
  122. package/models/layers/layerwms.d.ts +34 -0
  123. package/models/layers/layerwms.js +159 -0
  124. package/models/layers/layerwmts.d.ts +17 -0
  125. package/models/layers/layerwmts.js +44 -0
  126. package/models/main.d.ts +12 -0
  127. package/models/main.js +12 -0
  128. package/models/searchresult.d.ts +12 -0
  129. package/models/searchresult.js +31 -0
  130. package/models/serverwfs.d.ts +13 -0
  131. package/models/serverwfs.js +47 -0
  132. package/models/theme.d.ts +18 -0
  133. package/models/theme.js +48 -0
  134. package/package.json +121 -0
  135. package/public/about.json +1 -0
  136. package/public/android-chrome-192x192.png +0 -0
  137. package/public/android-chrome-512x512.png +0 -0
  138. package/public/apple-touch-icon.png +0 -0
  139. package/public/favicon-16x16.png +0 -0
  140. package/public/favicon-32x32.png +0 -0
  141. package/public/favicon.ico +0 -0
  142. package/public/images/girafe.png +0 -0
  143. package/public/images/logo.png +0 -0
  144. package/public/images/logo_black.png +0 -0
  145. package/public/images/logo_black_small.png +0 -0
  146. package/public/images/logo_black_small.webp +0 -0
  147. package/public/images/logo_small.png +0 -0
  148. package/public/images/logo_small.webp +0 -0
  149. package/public/lib/fontawesome/css/all.min.css +6 -0
  150. package/public/lib/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  151. package/public/lib/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  152. package/public/lib/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  153. package/public/lib/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  154. package/public/lib/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  155. package/public/lib/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  156. package/public/lib/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
  157. package/public/lib/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
  158. package/public/site.webmanifest +19 -0
  159. package/tools/configuration/configmanager.d.ts +9 -0
  160. package/tools/configuration/configmanager.js +45 -0
  161. package/tools/configuration/configmanager.spec.d.ts +1 -0
  162. package/tools/configuration/configmanager.spec.js +60 -0
  163. package/tools/configuration/girafeconfig.d.ts +97 -0
  164. package/tools/configuration/girafeconfig.js +237 -0
  165. package/tools/geoconsts.d.ts +7 -0
  166. package/tools/geoconsts.js +36 -0
  167. package/tools/geometrytools.d.ts +1 -0
  168. package/tools/geometrytools.js +5 -0
  169. package/tools/i18nmanager.d.ts +36 -0
  170. package/tools/i18nmanager.js +98 -0
  171. package/tools/layermanager.d.ts +29 -0
  172. package/tools/layermanager.js +240 -0
  173. package/tools/main.d.ts +13 -0
  174. package/tools/main.js +13 -0
  175. package/tools/messagemanager.d.ts +13 -0
  176. package/tools/messagemanager.js +29 -0
  177. package/tools/olUtils.d.ts +5 -0
  178. package/tools/olUtils.js +7 -0
  179. package/tools/state/mapposition.d.ts +9 -0
  180. package/tools/state/mapposition.js +38 -0
  181. package/tools/state/redliningfeature.d.ts +18 -0
  182. package/tools/state/redliningfeature.js +50 -0
  183. package/tools/state/state.d.ts +84 -0
  184. package/tools/state/state.js +190 -0
  185. package/tools/state/statemanager.d.ts +25 -0
  186. package/tools/state/statemanager.js +199 -0
  187. package/tools/state/statemanager.spec.d.ts +1 -0
  188. package/tools/state/statemanager.spec.js +364 -0
  189. package/tools/tests/mockhelper.d.ts +24 -0
  190. package/tools/tests/mockhelper.js +37 -0
  191. package/tools/tests/testhelper.d.ts +4 -0
  192. package/tools/tests/testhelper.js +26 -0
  193. package/tools/themesmanager.d.ts +44 -0
  194. package/tools/themesmanager.js +263 -0
  195. package/tools/urlmanager.d.ts +4 -0
  196. package/tools/urlmanager.js +8 -0
  197. package/tools/wfsmanager.d.ts +27 -0
  198. package/tools/wfsmanager.js +263 -0
  199. package/typings/uhtml.d.ts +34 -0
@@ -0,0 +1,101 @@
1
+ # Contribution guidelines
2
+
3
+ If you're reading this, you're probably thinking of contributing to GeoGirafe, and we're delighted!
4
+
5
+ In this document, you will find some essential information to help and guide you in your contributions.
6
+ You'll also find a few rules to follow so that you can contribute effectively to the project.
7
+
8
+ ## Before contributing
9
+
10
+ Generally speaking, the GeoGirafe project is open to contributions of any kind.
11
+ There is no need for discussion if you contribute just a simple and quite obvious bugfix. So... just do it!
12
+
13
+ But for complexer changes or if you want to extent the functionalities, please **first open an issue to discuss your contribution before starting the work**. Let us know that you plan to contribute **before** you do any coding. Use mailing list or developer chat. Just avoid future disappointments and **let us know** early.
14
+
15
+ This will also avoid conflicts with others also working on the same subject.
16
+
17
+ ## Licensing
18
+
19
+ Licensing is very important to open source projects. It helps ensure the software continues to be available under the terms that the author desired.
20
+
21
+ Please ensure you agree with the license of the project before contributing.
22
+
23
+ ## Effectively contributing
24
+
25
+ ### 1. Activate the pre-commit hooks
26
+
27
+ To enforce a consistent style of the code in the whole application, we have decided to use [prettier](https://prettier.io/).
28
+ If you commit regularly, prettier should be integrated in the git pre-commit hooks.
29
+ This can be done with the following command:
30
+
31
+ ```
32
+ git config core.hookspath buildtools/git-hooks
33
+ ```
34
+
35
+ ### 2. Create a Branch and a Merge-Request
36
+
37
+ The first of all thing is to create a branch for your contribution.
38
+ Give it a intelligible name, and create an associated Merge-Request.
39
+
40
+ Add a description to the Merge-Request to explain with is it for, and mark it as _Draft_.
41
+
42
+ ### 3. Code, commit early, push often.
43
+
44
+ For your contribution, please be attentive to the following points:
45
+
46
+ - Readable code is better than comments. Choose good class, method and variable names.
47
+ - Clean up the code: please delete commented code from your final contribution.
48
+ - Keep functions small and modular. The function complexity will be checked by our Sonarcloud rules.
49
+ - Do not add any external dependency to the project before discussing it. We do not want GeoGirafe to fall in the Npm-Blackhole of dependencies and to become unmaintainable.
50
+ - Ensure you deliver a minimum documentation of your contribution.
51
+ - Manage errors cases properly: Promises must be awaited and end with a .catch().
52
+ - Please declare variables properly as var, let and const depending on the case.
53
+ - Minimize nested test conditions to avoid brain overload.
54
+ - Please avoid the usage of foEach() loops. Prefer "for" and "for-of" loops instead: they preserve context, and can be breaked.
55
+ - There is little reason to NOT commit/push frequently. It doesn’t hurt, and you'll get feedback from the pipelines early.
56
+
57
+ ### 4. Validate your Merge-Request
58
+
59
+ When you're done with the code, it's time to make a great Merge-Request !
60
+ Please:
61
+
62
+ - Verify there is not conflict that would prevent an merge of your code.
63
+ - Check the linting with `npm run lint`
64
+ - Verify that the pipelines passed successfully on your branch: https://gitlab.com/geogirafe/gg-viewer/-/pipelines
65
+ - Check the Sonarcloud reports directly on the Merge-Request, and fix the reported errors.
66
+ - Verify the accessibility of your contribution by using the Wave tools: https://wave.webaim.org/
67
+
68
+ When everything seems ok for you, you can remove the _Draft_ flag, and request a review from the GeoGirafe Team.
69
+
70
+ ### 5. Review and merge
71
+
72
+ Every contribution will be reviewed. Therefore, the contribution quality should be appropriate (see points 2 and 3).
73
+
74
+ Once the merge request has been reviewed and accepted, it will be merged. If some changes are needed on your Merge-Request, we'll get in touch with you.
75
+
76
+ ## Communication channels
77
+
78
+ You can contact us through the following channels:
79
+
80
+ - By opening an issue in this GitLab Repository
81
+ - By Email
82
+
83
+ ## Thank you!
84
+
85
+ > « We ourselves feel that what we are doing is just a drop in the ocean.
86
+ > But the ocean would be less because of that missing drop. »
87
+
88
+ A big thank to all the contributors of GeoGirafe, in alphabetical order:
89
+
90
+ - Arnaud Poncet-Montanges @ponceta (SIGIP)
91
+ - Ben Koch @beeekey (OpenGIS)
92
+ - Benjamin Gerber @ger-benjamin (Camptocamp SA)
93
+ - Clemens Rudert @crud3_r (OpenGIS)
94
+ - Corentin Junod @D0lpic (SITN Neuchâtel)
95
+ - Daniel Gnerre @gnerred (Cartoriviera)
96
+ - Dietmar Schneider @sdietmar (techplus)
97
+ - Guillaume Remy @remyguillaume (Basel-Stadt)
98
+ - Olivier Monod @monodo (Yverdon-les-bains)
99
+ - Pauline Fanguin @pfanguin (Cartolacote)
100
+ - Rémi Bovard @rbovard (Cartoriviera)
101
+ - Stéphane Malta e Sousa @maltaesousa (SITN Neuchâtel)
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 Guillaume Remy
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ [![Pipeline Status](https://gitlab.com/geogirafe/gg-viewer/badges/main/pipeline.svg)](https://gitlab.com/geogirafe/gg-viewer/-/pipelines)
2
+ [![Docker Pulls](https://img.shields.io/docker/pulls/geogirafe/viewer.svg)](https://hub.docker.com/r/geogirafe/viewer/)
3
+
4
+ ![GitLab Contributors](https://img.shields.io/gitlab/contributors/geogirafe/gg-viewer)
5
+ ![GitLab Issues](https://img.shields.io/gitlab/issues/open-raw/geogirafe/gg-viewer)
6
+ ![GitLab Merge Requests](https://img.shields.io/gitlab/merge-requests/open-raw/geogirafe/gg-viewer)
7
+ ![GitLab last commit](https://img.shields.io/gitlab/last-commit/geogirafe/gg-viewer)
8
+
9
+ ![GitLab License](https://img.shields.io/gitlab/license/geogirafe/gg-viewer)
10
+
11
+ # GeoGirafe
12
+
13
+ GeoGirafe is a flexible application to build online geoportals.
14
+ This repository contains the web-viewer part of the project.
15
+
16
+ **Please note that GeoGirafe is at its very beginning, can strongly evolve and is therefore not intended for the moment to be used by people other than developers or contributors.**
17
+
18
+ The project documentation can be found here: https://doc.geomapfish.dev.
19
+ The demo instances of GeoGirafe can be tested here: https://demo.geomapfish.dev.
20
+
21
+ ## Goal
22
+
23
+ The goal of GeoGirafe is to allow the easy implementation of a stable, efficient and secure geoportal. GeoGirafe is also meant to be easily extensible, by allowing users to integrate their own plugins.
24
+
25
+ As the main users of GeoGirafe do not necessarily have advanced skills in computer development, we wanted to have a learning curve as smooth as possible. This is why the project does not use the latest frameworks and favours readable code over code corresponding to certain arbitrary "quality" criteria. GeoGirafe is therefore based on web standards (Vanilla Web Components) and limits the number of dependencies to other libraries.
26
+
27
+ ## Development philosophy
28
+
29
+ GeoGirafe is developed according to the following principles:
30
+
31
+ - **KISS**: GeoGirafe is simple. It is developed with pure Vanilla-JavaScript. No complex framework like React or Angular is used. If you know JavaScript, you can understand how it works.
32
+
33
+ - **DevSecOps**: GeoGirafe is baking security in at every phase of the software lifecycle, in order to deliver a secure-by-design application. Quality, readability, reliability and security are checked by the SonarCloud platform during our continuous integration processes: [View SonarCloud Reports](https://sonarcloud.io/project/overview?id=geogirafe_gg-viewer)
34
+
35
+ - **Reactivity**: GeoGirafe is meant to be responsive, resilient, elastic and message driven according to the [Reactive Manifesto](https://www.reactivemanifesto.org).
36
+
37
+ - **Agility**: GeoGirafe is being developed according to the Agile methodology. We value individuals collaboration, and change responsiveness more than processes, tools and plans.
38
+
39
+ - **Accessibility**: GeoGirafe is doing its best to make web content more accessible to individuals with disabilities: [View Wave Report](https://wave.webaim.org/report#/https://demo.geomapfish.dev/mapbs/).
40
+
41
+ ## Architecture
42
+
43
+ Architectural choices made for the GeoGirafe project, including strategic objectives and technological choices, is explained in details here: https://doc.geomapfish.dev/docs/architecture.
44
+
45
+ # Getting Started
46
+
47
+ If you want to get started with GeoGirafe, the simplest way is to use the Docker Container : https://hub.docker.com/r/geogirafe/viewer.
48
+ This will allow you to get a running instance of GeoGirafe with minimum effort.
49
+ Please follow the small documentation in the Docker Hub Readme.
50
+
51
+ # Work with GeoGirafe
52
+
53
+ ## Development
54
+
55
+ First, install [Node-18](https://nodejs.org/en/download/).
56
+
57
+ Then, clone the Repository:
58
+
59
+ ```
60
+ git clone https://gitlab.com/geogirafe/gg-viewer.git
61
+ ```
62
+
63
+ Now you can build the application, and start the development server:
64
+
65
+ ```bash
66
+ npm install
67
+ npm start
68
+ ```
69
+
70
+ ## Debugging using VSCode
71
+
72
+ If you are using VSCode, there is a preconfigured debugging configuration in the `.vscode` directory.
73
+ After you've started the application in development mode, just press `F5`, and VSCode will attach to the running process. You will then be able to debug your code.
74
+
75
+ ## Configuration
76
+
77
+ The complete configuration of the application is done in the file `config.json`.
78
+ This configuration will be loaded dynamically when the application starts.
79
+ Therefore it is not necessary to rebuild the project when you modify this file.
80
+
81
+ The file `config.json` does not exists by default.
82
+ The simplest way to create one is to pick up an existing one in the _demo_ directory, and to adapt the content to your needs.
83
+
84
+ You can also preconfigure GeoGirafe for an existing demo configuration by using:
85
+
86
+ ### On Linux
87
+
88
+ ```bash
89
+ npm run configure-demo <environment>
90
+ ```
91
+
92
+ ### On Windows
93
+
94
+ ```bash
95
+ npm run configure-demo-win <environment>
96
+ ```
97
+
98
+ This will automatically copy the `config.yaml` file in the right place, and download the needed Mock objects.
99
+
100
+ > Please note that today, the GeoGirafe Viewer is using a backend based on GeoMapFish.
101
+ > The services you will have to use in your configuration must therefore be compliant with GeoMapFish.
102
+
103
+ ## Build for Production
104
+
105
+ ```bash
106
+ npm install
107
+ npm run build
108
+ ```
109
+
110
+ This will output a complete built GeoGirafe app which can be served by a Webserver
111
+ easily in the [dist/app](dist/app) folder.
112
+
113
+ You can try the built asset with (you need docker for this example!):
114
+
115
+ ```bash
116
+ docker run --rm -p 8088:80 -v $(pwd)/dist/app:/usr/share/nginx/html nginx:latest
117
+ ```
118
+
119
+ This will spin up an NGINX and you can access it on [localhost:8088](http://localhost:8088).
120
+
121
+ Press `CTRL+C` to stop the container.
122
+
123
+ ## Build the NPM Package
124
+
125
+ Make sure to have run the command `npm login` before at least once
126
+
127
+ ### Build the library
128
+
129
+ ```bash
130
+ npm install
131
+ npm run build-lib
132
+ ```
133
+
134
+ This will output (beside others) a transpiled version of GeoGirafe's library part into [dist/lib](dist/lib).
135
+
136
+ ### Publish Lib Package to [npmjs.com](https.//npmjs.com)
137
+
138
+ ```bash
139
+ npm run publish-lib --access public
140
+ ```
141
+
142
+ ### Using Docker
143
+
144
+ ```bash
145
+ docker run -v $PWD:/src node:18-slim bash -c "cd /src && npm install && npm run build"
146
+ ```
147
+
148
+ ## Deployment
149
+
150
+ The deployment can be done in 2 ways:
151
+
152
+ ### Using an existing WebServer
153
+
154
+ After the build, everything that needs to be deployed is in the `public` directory.
155
+ Copy the `public` directory content to any webserver, for example in the `htdocs` directory.
156
+
157
+ ### Using Docker
158
+
159
+ When the project has been built, you can build a docker image that will contains the application:
160
+
161
+ ```
162
+ docker build -t <your_name>/viewer -f buildtools/Dockerfile dist
163
+ ```
164
+
165
+ Then, you can start it:
166
+
167
+ ```
168
+ docker run -p 8080:80 -p 8443:443 <your_name>/viewer
169
+ ```
170
+
171
+ # Contributing
172
+
173
+ Merge-Requests are welcome.
174
+ For major changes, please open an issue first to discuss what you would like to change.
175
+ Contribution guidelines are available here: [CONTRIBUTING.md](CONTRIBUTING.md).
176
+ **Please read them before contributing.**
177
+
178
+ # License
179
+
180
+ Apache License, Version 2.0
@@ -0,0 +1,21 @@
1
+ import GirafeHTMLElement from './GirafeHTMLElement';
2
+ declare class GirafeDraggableElement extends GirafeHTMLElement {
3
+ button?: HTMLElement;
4
+ div?: HTMLElement;
5
+ header?: HTMLElement;
6
+ closeButton?: HTMLElement;
7
+ get host(): HTMLElement;
8
+ pos1: number;
9
+ pos2: number;
10
+ pos3: number;
11
+ pos4: number;
12
+ constructor(component: string);
13
+ makeDraggable(): void;
14
+ closeWindow(): void;
15
+ dragMouseDown(_this: GirafeDraggableElement, e: MouseEvent): void;
16
+ elementDrag(_this: GirafeDraggableElement, e: MouseEvent): void;
17
+ getBodyWidth(): number;
18
+ getBodyHeight(): number;
19
+ closeDragElement(): void;
20
+ }
21
+ export default GirafeDraggableElement;
@@ -0,0 +1,148 @@
1
+ import GirafeHTMLElement from './GirafeHTMLElement';
2
+ /*
3
+ Minimal template for a draggable object :
4
+ It must have 2 divs :
5
+ - One for the whole box (id="draggable")
6
+ - One for the header (id="header"). This is the div that will be used for dragging the while box
7
+
8
+ Example:
9
+
10
+ <div id="draggable">
11
+ <div id="header">
12
+ Click here to move
13
+ <div id="close">
14
+ <i class="fa-solid"></i>
15
+ </div>
16
+ </div>
17
+ <!-- PLACE CONTENT HERE -->
18
+ </div>
19
+
20
+ Then in order to make an component draggable,
21
+ the base method makeDraggable() must be called after rendering the template.
22
+
23
+ That's it, it should work.
24
+
25
+ */
26
+ class GirafeDraggableElement extends GirafeHTMLElement {
27
+ get host() {
28
+ return this.shadow.getRootNode().host;
29
+ }
30
+ constructor(component) {
31
+ super(component);
32
+ Object.defineProperty(this, "button", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: void 0
37
+ });
38
+ Object.defineProperty(this, "div", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: void 0
43
+ });
44
+ Object.defineProperty(this, "header", {
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true,
48
+ value: void 0
49
+ });
50
+ Object.defineProperty(this, "closeButton", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: void 0
55
+ });
56
+ Object.defineProperty(this, "pos1", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: 0
61
+ });
62
+ Object.defineProperty(this, "pos2", {
63
+ enumerable: true,
64
+ configurable: true,
65
+ writable: true,
66
+ value: 0
67
+ });
68
+ Object.defineProperty(this, "pos3", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: 0
73
+ });
74
+ Object.defineProperty(this, "pos4", {
75
+ enumerable: true,
76
+ configurable: true,
77
+ writable: true,
78
+ value: 0
79
+ });
80
+ }
81
+ makeDraggable() {
82
+ this.div = this.shadow.querySelector('#draggable');
83
+ this.header = this.shadow.querySelector('#header');
84
+ this.header.onmousedown = (e) => this.dragMouseDown(this, e);
85
+ this.closeButton = this.shadow.getElementById('close');
86
+ if (!this.isNullOrUndefined(this.closeButton)) {
87
+ this.closeButton.onclick = () => this.closeWindow();
88
+ }
89
+ }
90
+ closeWindow() {
91
+ throw new Error('This function must be overriden to close the associated window');
92
+ }
93
+ dragMouseDown(_this, e) {
94
+ e.preventDefault();
95
+ // get the mouse cursor position at startup:
96
+ _this.pos3 = e.clientX;
97
+ _this.pos4 = e.clientY;
98
+ document.onmouseup = () => _this.closeDragElement();
99
+ // call a function whenever the cursor moves:
100
+ document.onmousemove = (e) => _this.elementDrag(_this, e);
101
+ }
102
+ elementDrag(_this, e) {
103
+ e.preventDefault();
104
+ const hostRect = _this.host.getBoundingClientRect();
105
+ // Position left
106
+ const pos1 = _this.pos3 - e.clientX;
107
+ const newLeft = _this.host.offsetLeft - pos1;
108
+ const newRight = newLeft + hostRect.width;
109
+ if (newLeft < 0) {
110
+ _this.host.style.left = '0px';
111
+ }
112
+ else if (newRight > this.getBodyWidth()) {
113
+ _this.host.style.left = this.getBodyWidth() - hostRect.width + 'px';
114
+ }
115
+ else {
116
+ _this.pos1 = pos1;
117
+ _this.pos3 = e.clientX;
118
+ _this.host.style.left = newLeft + 'px';
119
+ }
120
+ // Position top
121
+ const pos2 = _this.pos4 - e.clientY;
122
+ const newTop = _this.host.offsetTop - pos2;
123
+ const newBottom = newTop + hostRect.height;
124
+ if (newTop < 0) {
125
+ _this.host.style.top = '0px';
126
+ }
127
+ else if (newBottom > this.getBodyHeight()) {
128
+ _this.host.style.top = this.getBodyHeight() - hostRect.height + 'px';
129
+ }
130
+ else {
131
+ _this.pos2 = pos2;
132
+ _this.pos4 = e.clientY;
133
+ _this.host.style.top = newTop + 'px';
134
+ }
135
+ }
136
+ getBodyWidth() {
137
+ return Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.documentElement.clientWidth);
138
+ }
139
+ getBodyHeight() {
140
+ return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.documentElement.clientHeight);
141
+ }
142
+ closeDragElement() {
143
+ // stop moving when mouse button is released:
144
+ document.onmouseup = null;
145
+ document.onmousemove = null;
146
+ }
147
+ }
148
+ export default GirafeDraggableElement;