geoblacklight 4.4.1 → 5.0.0.pre.alpha.11

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 (577) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build-demo-app.yml +153 -0
  3. data/.github/workflows/prune-containers.yml +19 -0
  4. data/.github/workflows/ruby.yml +54 -52
  5. data/.gitignore +2 -2
  6. data/CONTRIBUTING.md +62 -44
  7. data/Gemfile +3 -28
  8. data/Rakefile +42 -67
  9. data/app/assets/images/blacklight/logo.svg +31 -1
  10. data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +1 -2
  11. data/app/assets/stylesheets/geoblacklight/modules/_base.scss +1 -1
  12. data/app/assets/stylesheets/geoblacklight/modules/_blacklight_overrides.scss +24 -26
  13. data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +13 -0
  14. data/app/assets/stylesheets/geoblacklight/modules/home.scss +2 -17
  15. data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +48 -23
  16. data/app/assets/stylesheets/geoblacklight/modules/index_maps.scss +1 -15
  17. data/app/assets/stylesheets/geoblacklight/modules/item.scss +13 -11
  18. data/app/assets/stylesheets/geoblacklight/modules/layer_opacity.scss +3 -3
  19. data/app/assets/stylesheets/geoblacklight/modules/leaflet.scss +4 -0
  20. data/app/assets/stylesheets/geoblacklight/modules/modal.scss +0 -15
  21. data/app/assets/stylesheets/geoblacklight/modules/results.scss +10 -19
  22. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +2 -2
  23. data/app/components/blacklight/icons/american_geographical_society_library_uwm_libraries_component.rb +46 -0
  24. data/app/components/blacklight/icons/arizona_component.rb +24 -0
  25. data/app/components/blacklight/icons/arrow_circle_down_component.rb +23 -0
  26. data/app/components/blacklight/icons/baruch_cuny_component.rb +23 -0
  27. data/app/components/blacklight/icons/book_component.rb +23 -0
  28. data/app/components/blacklight/icons/bookmark_component.rb +23 -0
  29. data/app/components/blacklight/icons/cd_rom_component.rb +23 -0
  30. data/app/components/blacklight/icons/child_item_component.rb +23 -0
  31. data/app/components/blacklight/icons/circle_info_solid_component.rb +23 -0
  32. data/app/components/blacklight/icons/citation_component.rb +23 -0
  33. data/app/components/blacklight/icons/collection_component.rb +23 -0
  34. data/app/components/blacklight/icons/collections_component.rb +24 -0
  35. data/app/components/blacklight/icons/columbia_component.rb +23 -0
  36. data/app/components/blacklight/icons/cornell_component.rb +25 -0
  37. data/app/components/blacklight/icons/datasets_component.rb +27 -0
  38. data/app/components/blacklight/icons/dvd_rom_component.rb +23 -0
  39. data/app/components/blacklight/icons/email_component.rb +23 -0
  40. data/app/components/blacklight/icons/esri_globe_component.rb +51 -0
  41. data/app/components/blacklight/icons/fire_solid_component.rb +23 -0
  42. data/app/components/blacklight/icons/george_mason_component.rb +24 -0
  43. data/app/components/blacklight/icons/globe_component.rb +23 -0
  44. data/app/components/blacklight/icons/harvard_component.rb +23 -0
  45. data/app/components/blacklight/icons/home_component.rb +23 -0
  46. data/app/components/blacklight/icons/iiif_drag_drop_component.rb +31 -0
  47. data/app/components/blacklight/icons/image_component.rb +23 -0
  48. data/app/components/blacklight/icons/imagery_component.rb +24 -0
  49. data/app/components/blacklight/icons/indiana_component.rb +23 -0
  50. data/app/components/blacklight/icons/leaf_component.rb +23 -0
  51. data/app/components/blacklight/icons/lewis_clark_component.rb +25 -0
  52. data/app/components/blacklight/icons/lightbulb_solid_component.rb +23 -0
  53. data/app/components/blacklight/icons/line_component.rb +24 -0
  54. data/app/components/blacklight/icons/map_component.rb +23 -0
  55. data/app/components/blacklight/icons/map_marker_component.rb +23 -0
  56. data/app/components/blacklight/icons/maps_component.rb +24 -0
  57. data/app/components/blacklight/icons/massgis_component.rb +23 -0
  58. data/app/components/blacklight/icons/metadata_component.rb +23 -0
  59. data/app/components/blacklight/icons/michigan_state_university_component.rb +25 -0
  60. data/app/components/blacklight/icons/mit_component.rb +23 -0
  61. data/app/components/blacklight/icons/mixed_component.rb +25 -0
  62. data/app/components/blacklight/icons/multilinestring_component.rb +26 -0
  63. data/app/components/blacklight/icons/multipoint_component.rb +23 -0
  64. data/app/components/blacklight/icons/multipolygon_component.rb +26 -0
  65. data/app/components/blacklight/icons/northwestern_university_component.rb +24 -0
  66. data/app/components/blacklight/icons/nyu_component.rb +26 -0
  67. data/app/components/blacklight/icons/pagelines_brands_component.rb +23 -0
  68. data/app/components/blacklight/icons/paper_map_component.rb +23 -0
  69. data/app/components/blacklight/icons/parent_item_component.rb +23 -0
  70. data/app/components/blacklight/icons/pennsylvania_state_university_component.rb +25 -0
  71. data/app/components/blacklight/icons/point_component.rb +23 -0
  72. data/app/components/blacklight/icons/polygon_component.rb +24 -0
  73. data/app/components/blacklight/icons/polyline_component.rb +26 -0
  74. data/app/components/blacklight/icons/princeton_component.rb +23 -0
  75. data/app/components/blacklight/icons/public_component.rb +23 -0
  76. data/app/components/blacklight/icons/purdue_university_component.rb +25 -0
  77. data/app/components/blacklight/icons/raster_component.rb +23 -0
  78. data/app/components/blacklight/icons/restricted_component.rb +23 -0
  79. data/app/components/blacklight/icons/rutgers_component.rb +25 -0
  80. data/app/components/blacklight/icons/sms_component.rb +23 -0
  81. data/app/components/blacklight/icons/stanford_component.rb +23 -0
  82. data/app/components/blacklight/icons/table_component.rb +23 -0
  83. data/app/components/blacklight/icons/tags_component.rb +23 -0
  84. data/app/components/blacklight/icons/texas_component.rb +23 -0
  85. data/app/components/blacklight/icons/the_ohio_state_university_component.rb +26 -0
  86. data/app/components/blacklight/icons/triangle_exclamation_solid_component.rb +23 -0
  87. data/app/components/blacklight/icons/tufts_component.rb +23 -0
  88. data/app/components/blacklight/icons/ucla_component.rb +23 -0
  89. data/app/components/blacklight/icons/university_of_california_berkeley_component.rb +24 -0
  90. data/app/components/blacklight/icons/university_of_chicago_component.rb +25 -0
  91. data/app/components/blacklight/icons/university_of_colorado_boulder_component.rb +26 -0
  92. data/app/components/blacklight/icons/university_of_illinois_urbana_champaign_component.rb +25 -0
  93. data/app/components/blacklight/icons/university_of_iowa_component.rb +24 -0
  94. data/app/components/blacklight/icons/university_of_maryland_component.rb +24 -0
  95. data/app/components/blacklight/icons/university_of_michigan_component.rb +24 -0
  96. data/app/components/blacklight/icons/university_of_minnesota_component.rb +24 -0
  97. data/app/components/blacklight/icons/university_of_nebraska_lincoln_component.rb +27 -0
  98. data/app/components/blacklight/icons/university_of_wisconsin_madison_component.rb +24 -0
  99. data/app/components/blacklight/icons/uva_component.rb +23 -0
  100. data/app/components/blacklight/icons/web_services_component.rb +23 -0
  101. data/app/components/blacklight/icons/websites_component.rb +24 -0
  102. data/app/components/geoblacklight/arcgis_component.html.erb +3 -0
  103. data/app/components/geoblacklight/arcgis_component.rb +25 -0
  104. data/app/components/geoblacklight/attribute_table_component.html.erb +17 -0
  105. data/app/components/geoblacklight/attribute_table_component.rb +17 -0
  106. data/app/components/geoblacklight/data_dictionary_download_component.html.erb +3 -0
  107. data/app/components/geoblacklight/data_dictionary_download_component.rb +16 -0
  108. data/app/components/geoblacklight/display_note_component.rb +1 -1
  109. data/app/components/geoblacklight/document/citation_component.html.erb +1 -0
  110. data/app/components/geoblacklight/document/citation_component.rb +19 -0
  111. data/app/components/geoblacklight/document/sidebar_component.html.erb +12 -0
  112. data/app/components/geoblacklight/document/sidebar_component.rb +8 -0
  113. data/app/components/geoblacklight/document_component.html.erb +43 -0
  114. data/app/components/geoblacklight/document_component.rb +6 -0
  115. data/app/components/geoblacklight/download_links_component.html.erb +31 -0
  116. data/app/components/geoblacklight/download_links_component.rb +80 -0
  117. data/app/components/geoblacklight/header_component.html.erb +14 -0
  118. data/app/components/geoblacklight/header_component.rb +9 -0
  119. data/app/components/geoblacklight/header_icons_component.html.erb +3 -0
  120. data/app/components/geoblacklight/header_icons_component.rb +29 -0
  121. data/app/components/geoblacklight/iiif_drag_drop_component.html.erb +3 -0
  122. data/app/components/geoblacklight/iiif_drag_drop_component.rb +16 -0
  123. data/app/components/geoblacklight/index_map_inspect_component.rb +15 -0
  124. data/app/components/geoblacklight/index_map_legend_component.html.erb +14 -0
  125. data/app/components/geoblacklight/index_map_legend_component.rb +17 -0
  126. data/app/components/geoblacklight/item_map_viewer_component.html.erb +1 -0
  127. data/app/components/geoblacklight/item_map_viewer_component.rb +87 -0
  128. data/app/components/geoblacklight/location_leaflet_map_component.html.erb +1 -0
  129. data/app/components/geoblacklight/location_leaflet_map_component.rb +49 -0
  130. data/app/components/geoblacklight/login_link_component.html.erb +5 -0
  131. data/app/components/geoblacklight/login_link_component.rb +17 -0
  132. data/app/components/geoblacklight/relations_component.html.erb +23 -0
  133. data/app/components/geoblacklight/relations_component.rb +25 -0
  134. data/app/components/geoblacklight/search_result_component.html.erb +44 -0
  135. data/app/{presenters/geoblacklight/document_presenter.rb → components/geoblacklight/search_result_component.rb} +9 -6
  136. data/app/components/geoblacklight/static_map_component.html.erb +9 -0
  137. data/app/components/geoblacklight/static_map_component.rb +36 -0
  138. data/app/components/geoblacklight/viewer_help_text_component.html.erb +1 -0
  139. data/app/components/geoblacklight/viewer_help_text_component.rb +46 -0
  140. data/app/components/geoblacklight/web_services_component.html.erb +1 -0
  141. data/app/components/geoblacklight/web_services_component.rb +26 -0
  142. data/app/{views/catalog/_web_services_default.html.erb → components/geoblacklight/web_services_default_component.html.erb} +3 -5
  143. data/app/components/geoblacklight/web_services_default_component.rb +11 -0
  144. data/app/components/geoblacklight/web_services_link_component.html.erb +3 -0
  145. data/app/components/geoblacklight/web_services_link_component.rb +22 -0
  146. data/app/{views/catalog/_web_services_wfs.html.erb → components/geoblacklight/web_services_wfs_component.html.erb} +4 -7
  147. data/app/components/geoblacklight/web_services_wfs_component.rb +12 -0
  148. data/app/components/geoblacklight/web_services_wms_component.html.erb +10 -0
  149. data/app/components/geoblacklight/web_services_wms_component.rb +12 -0
  150. data/app/controllers/download_controller.rb +10 -26
  151. data/app/helpers/geoblacklight_helper.rb +10 -194
  152. data/app/javascript/geoblacklight/controllers/clipboard_controller.js +11 -0
  153. data/app/javascript/geoblacklight/controllers/clover_viewer_controller.js +47 -0
  154. data/app/javascript/geoblacklight/controllers/downloads_controller.js +56 -0
  155. data/app/javascript/geoblacklight/controllers/leaflet_viewer_controller.js +217 -0
  156. data/app/javascript/geoblacklight/controllers/oembed_viewer_controller.js +18 -0
  157. data/app/javascript/geoblacklight/controllers/openlayers_viewer_controller.js +63 -0
  158. data/app/javascript/geoblacklight/controllers/search_results_controller.js +50 -0
  159. data/app/javascript/geoblacklight/core.js +69 -0
  160. data/app/javascript/geoblacklight/index.js +29 -0
  161. data/app/javascript/geoblacklight/initializers/metadata_download.js +54 -0
  162. data/app/javascript/geoblacklight/initializers/popovers.js +11 -0
  163. data/app/javascript/geoblacklight/initializers/relations.js +40 -0
  164. data/app/javascript/geoblacklight/initializers/tooltips.js +55 -0
  165. data/app/javascript/geoblacklight/initializers/truncation.js +45 -0
  166. data/app/javascript/geoblacklight/leaflet/basemaps.js +74 -0
  167. data/app/javascript/geoblacklight/leaflet/constants.js +18 -0
  168. data/app/javascript/geoblacklight/leaflet/controls/geosearch.js +160 -0
  169. data/app/javascript/geoblacklight/leaflet/controls/layer_opacity.js +120 -0
  170. data/app/javascript/geoblacklight/leaflet/inspection.js +195 -0
  171. data/app/javascript/geoblacklight/leaflet/layer_index_map.js +120 -0
  172. data/app/javascript/geoblacklight/leaflet/layer_wmts.js +59 -0
  173. data/app/javascript/geoblacklight/leaflet/layers.js +153 -0
  174. data/app/javascript/geoblacklight/leaflet/utils.js +83 -0
  175. data/app/javascript/geoblacklight/openlayers/basemaps.js +47 -0
  176. data/app/javascript/geoblacklight/openlayers/layers.js +44 -0
  177. data/app/models/concerns/geoblacklight/solr_document/citation.rb +20 -8
  178. data/app/models/concerns/geoblacklight/solr_document.rb +22 -30
  179. data/app/presenters/geoblacklight/bbox_item_presenter.rb +1 -1
  180. data/app/views/catalog/_citation.html.erb +16 -33
  181. data/app/views/catalog/_document_split.html.erb +18 -3
  182. data/app/views/catalog/_home_text.html.erb +2 -2
  183. data/app/views/catalog/_metadata.html.erb +1 -1
  184. data/app/views/catalog/index.html.erb +8 -4
  185. data/app/views/catalog/metadata/_markup.html.erb +1 -1
  186. data/app/views/catalog/metadata.html.erb +14 -13
  187. data/app/views/catalog/web_services.html.erb +19 -28
  188. data/app/views/relation/index.html.erb +2 -12
  189. data/app/views/relation/index.json.jbuilder +1 -1
  190. data/compose.yml +14 -0
  191. data/config/importmap.rb +20 -0
  192. data/config/locales/geoblacklight.en.yml +15 -24
  193. data/geoblacklight.gemspec +7 -7
  194. data/lib/generators/geoblacklight/assets/importmap_generator.rb +87 -0
  195. data/lib/generators/geoblacklight/assets/vite_generator.rb +90 -0
  196. data/lib/generators/geoblacklight/assets_generator.rb +12 -37
  197. data/lib/generators/geoblacklight/install_generator.rb +11 -49
  198. data/lib/generators/geoblacklight/templates/assets/_customizations.scss +13 -19
  199. data/lib/generators/geoblacklight/templates/assets/application.js +17 -0
  200. data/lib/generators/geoblacklight/templates/assets/application.scss +9 -4
  201. data/lib/generators/geoblacklight/templates/assets/geoblacklight.scss +11 -0
  202. data/lib/generators/geoblacklight/templates/base.html.erb +9 -12
  203. data/lib/generators/geoblacklight/templates/catalog_controller.rb +7 -15
  204. data/lib/generators/geoblacklight/templates/demo-app/Dockerfile +31 -0
  205. data/lib/generators/geoblacklight/templates/demo-app/compose.yml +26 -0
  206. data/lib/generators/geoblacklight/templates/demo-app/start-server.sh +21 -0
  207. data/lib/generators/geoblacklight/templates/package.json +7 -1
  208. data/lib/generators/geoblacklight/templates/settings.yml +45 -40
  209. data/lib/generators/geoblacklight/templates/vite.config.ts +22 -7
  210. data/lib/geoblacklight/bounding_box.rb +16 -0
  211. data/lib/geoblacklight/constants.rb +0 -1
  212. data/lib/geoblacklight/download/csv_download.rb +22 -0
  213. data/lib/geoblacklight/download/geojson_download.rb +1 -1
  214. data/lib/geoblacklight/download/geotiff_download.rb +1 -1
  215. data/lib/geoblacklight/download/kmz_download.rb +1 -1
  216. data/lib/geoblacklight/download/shapefile_download.rb +1 -1
  217. data/lib/geoblacklight/download.rb +1 -1
  218. data/lib/geoblacklight/engine.rb +15 -6
  219. data/lib/geoblacklight/item_viewer.rb +1 -1
  220. data/lib/geoblacklight/metadata/base.rb +2 -1
  221. data/lib/geoblacklight/references.rb +27 -8
  222. data/lib/geoblacklight/routes/downloadable.rb +0 -1
  223. data/lib/geoblacklight/routes.rb +0 -3
  224. data/lib/geoblacklight/version.rb +1 -1
  225. data/lib/geoblacklight/wms_layer/feature_info_response.rb +9 -6
  226. data/lib/geoblacklight.rb +6 -30
  227. data/lib/tasks/geoblacklight.rake +24 -60
  228. data/package.json +24 -17
  229. data/solr/conf/schema.xml +15 -13
  230. data/solr/conf/solrconfig.xml +6 -4
  231. data/spec/components/blacklight/icons/american_geographical_society_library_uwm_libraries_component_spec.rb +15 -0
  232. data/spec/components/blacklight/icons/arizona_component_spec.rb +15 -0
  233. data/spec/components/blacklight/icons/arrow_circle_down_component_spec.rb +15 -0
  234. data/spec/components/blacklight/icons/baruch_cuny_component_spec.rb +15 -0
  235. data/spec/components/blacklight/icons/book_component_spec.rb +15 -0
  236. data/spec/components/blacklight/icons/bookmark_component_spec.rb +15 -0
  237. data/spec/components/blacklight/icons/cd_rom_component_spec.rb +15 -0
  238. data/spec/components/blacklight/icons/child_item_component_spec.rb +15 -0
  239. data/spec/components/blacklight/icons/circle_info_solid_component_spec.rb +15 -0
  240. data/spec/components/blacklight/icons/citation_component_spec.rb +15 -0
  241. data/spec/components/blacklight/icons/collection_component_spec.rb +15 -0
  242. data/spec/components/blacklight/icons/collections_component_spec.rb +15 -0
  243. data/spec/components/blacklight/icons/columbia_component_spec.rb +15 -0
  244. data/spec/components/blacklight/icons/cornell_component_spec.rb +15 -0
  245. data/spec/components/blacklight/icons/datasets_component_spec.rb +15 -0
  246. data/spec/components/blacklight/icons/dvd_rom_component_spec.rb +15 -0
  247. data/spec/components/blacklight/icons/email_component_spec.rb +15 -0
  248. data/spec/components/blacklight/icons/esri_globe_component_spec.rb +15 -0
  249. data/spec/components/blacklight/icons/fire_solid_component_spec.rb +15 -0
  250. data/spec/components/blacklight/icons/george_mason_component_spec.rb +15 -0
  251. data/spec/components/blacklight/icons/globe_component_spec.rb +15 -0
  252. data/spec/components/blacklight/icons/harvard_component_spec.rb +15 -0
  253. data/spec/components/blacklight/icons/home_component_spec.rb +15 -0
  254. data/spec/components/blacklight/icons/iiif_drag_drop_component_spec.rb +15 -0
  255. data/spec/components/blacklight/icons/image_component_spec.rb +15 -0
  256. data/spec/components/blacklight/icons/imagery_component_spec.rb +15 -0
  257. data/spec/components/blacklight/icons/indiana_component_spec.rb +15 -0
  258. data/spec/components/blacklight/icons/leaf_component_spec.rb +15 -0
  259. data/spec/components/blacklight/icons/lewis_clark_component_spec.rb +15 -0
  260. data/spec/components/blacklight/icons/lightbulb_solid_component_spec.rb +15 -0
  261. data/spec/components/blacklight/icons/line_component_spec.rb +15 -0
  262. data/spec/components/blacklight/icons/map_component_spec.rb +15 -0
  263. data/spec/components/blacklight/icons/map_marker_component_spec.rb +15 -0
  264. data/spec/components/blacklight/icons/maps_component_spec.rb +15 -0
  265. data/spec/components/blacklight/icons/massgis_component_spec.rb +15 -0
  266. data/spec/components/blacklight/icons/metadata_component_spec.rb +15 -0
  267. data/spec/components/blacklight/icons/michigan_state_university_component_spec.rb +15 -0
  268. data/spec/components/blacklight/icons/mit_component_spec.rb +15 -0
  269. data/spec/components/blacklight/icons/mixed_component_spec.rb +15 -0
  270. data/spec/components/blacklight/icons/multilinestring_component_spec.rb +15 -0
  271. data/spec/components/blacklight/icons/multipoint_component_spec.rb +15 -0
  272. data/spec/components/blacklight/icons/multipolygon_component_spec.rb +15 -0
  273. data/spec/components/blacklight/icons/northwestern_university_component_spec.rb +15 -0
  274. data/spec/components/blacklight/icons/nyu_component_spec.rb +15 -0
  275. data/spec/components/blacklight/icons/pagelines_brands_component_spec.rb +15 -0
  276. data/spec/components/blacklight/icons/paper_map_component_spec.rb +15 -0
  277. data/spec/components/blacklight/icons/parent_item_component_spec.rb +15 -0
  278. data/spec/components/blacklight/icons/pennsylvania_state_university_component_spec.rb +15 -0
  279. data/spec/components/blacklight/icons/point_component_spec.rb +15 -0
  280. data/spec/components/blacklight/icons/polygon_component_spec.rb +15 -0
  281. data/spec/components/blacklight/icons/polyline_component_spec.rb +15 -0
  282. data/spec/components/blacklight/icons/princeton_component_spec.rb +15 -0
  283. data/spec/components/blacklight/icons/public_component_spec.rb +15 -0
  284. data/spec/components/blacklight/icons/purdue_university_component_spec.rb +15 -0
  285. data/spec/components/blacklight/icons/raster_component_spec.rb +15 -0
  286. data/spec/components/blacklight/icons/restricted_component_spec.rb +15 -0
  287. data/spec/components/blacklight/icons/rutgers_component_spec.rb +15 -0
  288. data/spec/components/blacklight/icons/sms_component_spec.rb +15 -0
  289. data/spec/components/blacklight/icons/stanford_component_spec.rb +15 -0
  290. data/spec/components/blacklight/icons/table_component_spec.rb +15 -0
  291. data/spec/components/blacklight/icons/tags_component_spec.rb +15 -0
  292. data/spec/components/blacklight/icons/texas_component_spec.rb +15 -0
  293. data/spec/components/blacklight/icons/the_ohio_state_university_component_spec.rb +15 -0
  294. data/spec/components/blacklight/icons/triangle_exclamation_solid_component_spec.rb +15 -0
  295. data/spec/components/blacklight/icons/tufts_component_spec.rb +15 -0
  296. data/spec/components/blacklight/icons/ucla_component_spec.rb +15 -0
  297. data/spec/components/blacklight/icons/university_of_california_berkeley_component_spec.rb +15 -0
  298. data/spec/components/blacklight/icons/university_of_chicago_component_spec.rb +15 -0
  299. data/spec/components/blacklight/icons/university_of_colorado_boulder_component_spec.rb +15 -0
  300. data/spec/components/blacklight/icons/university_of_illinois_urbana_champaign_component_spec.rb +15 -0
  301. data/spec/components/blacklight/icons/university_of_iowa_component_spec.rb +15 -0
  302. data/spec/components/blacklight/icons/university_of_maryland_component_spec.rb +15 -0
  303. data/spec/components/blacklight/icons/university_of_michigan_component_spec.rb +15 -0
  304. data/spec/components/blacklight/icons/university_of_minnesota_component_spec.rb +15 -0
  305. data/spec/components/blacklight/icons/university_of_nebraska_lincoln_component_spec.rb +15 -0
  306. data/spec/components/blacklight/icons/university_of_wisconsin_madison_component_spec.rb +15 -0
  307. data/spec/components/blacklight/icons/uva_component_spec.rb +15 -0
  308. data/spec/components/blacklight/icons/web_services_component_spec.rb +15 -0
  309. data/spec/components/blacklight/icons/websites_component_spec.rb +15 -0
  310. data/spec/components/geoblacklight/arcgis_component_spec.rb +31 -0
  311. data/spec/components/geoblacklight/attribute_table_component_spec.rb +37 -0
  312. data/spec/components/geoblacklight/citation_component_spec.rb +37 -0
  313. data/spec/components/geoblacklight/document_component_spec.rb +92 -0
  314. data/spec/components/geoblacklight/download_links_component_spec.rb +102 -0
  315. data/spec/components/geoblacklight/header_icons_component_spec.rb +56 -0
  316. data/spec/components/geoblacklight/iiif_drag_drop_component_spec.rb +30 -0
  317. data/spec/components/geoblacklight/index_map_legend_component_spec.rb +42 -0
  318. data/spec/components/geoblacklight/item_map_viewer_component_spec.rb +36 -0
  319. data/spec/components/geoblacklight/login_link_component_spec.rb +33 -0
  320. data/spec/{lib/geoblacklight/document_presenter_spec.rb → components/geoblacklight/search_result_component_spec.rb} +19 -11
  321. data/spec/components/geoblacklight/static_map_component_spec.rb +22 -0
  322. data/spec/components/geoblacklight/viewer_help_text_component_spec.rb +28 -0
  323. data/spec/components/geoblacklight/web_services_component_spec.rb +45 -0
  324. data/spec/controllers/download_controller_spec.rb +12 -35
  325. data/spec/features/axe_spec.rb +66 -0
  326. data/spec/features/bookmarks_spec.rb +1 -1
  327. data/spec/features/citations_spec.rb +7 -3
  328. data/spec/features/download_layer_spec.rb +24 -39
  329. data/spec/features/esri_viewer_spec.rb +1 -1
  330. data/spec/features/exports_spec.rb +0 -15
  331. data/spec/features/{full_screen_controll_spec.rb → full_screen_control_spec.rb} +6 -6
  332. data/spec/features/home_page_spec.rb +12 -7
  333. data/spec/features/iiif_viewer_spec.rb +1 -1
  334. data/spec/features/index_map_spec.rb +16 -9
  335. data/spec/features/{split_view.html.erb_spec.rb → index_view_spec.rb} +15 -13
  336. data/spec/features/layer_inspection_spec.rb +2 -2
  337. data/spec/features/layer_preview_spec.rb +1 -1
  338. data/spec/features/missing_metadata_spec.rb +5 -5
  339. data/spec/features/oembed_spec.rb +2 -2
  340. data/spec/features/saved_searches_spec.rb +4 -1
  341. data/spec/features/search_results_complex_geometry_spec.rb +2 -2
  342. data/spec/features/search_results_icons_spec.rb +3 -3
  343. data/spec/features/search_results_map_spec.rb +4 -36
  344. data/spec/features/search_results_overlap_ratio_spec.rb +1 -1
  345. data/spec/features/show_page_download_spec.rb +0 -8
  346. data/spec/features/tilejson_spec.rb +2 -2
  347. data/spec/features/web_services_modal_spec.rb +57 -39
  348. data/spec/features/wmts_spec.rb +4 -4
  349. data/spec/fixtures/solr_documents/README.md +2 -1
  350. data/spec/fixtures/solr_documents/complex-geom.json +61 -0
  351. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +45 -24
  352. data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
  353. data/spec/fixtures/solr_documents/multiple-downloads.json +1 -0
  354. data/spec/helpers/geoblacklight_helper_spec.rb +8 -173
  355. data/spec/lib/geoblacklight/download/csv_download_spec.rb +21 -0
  356. data/spec/lib/geoblacklight/reference_spec.rb +17 -19
  357. data/spec/lib/geoblacklight/references_spec.rb +31 -17
  358. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +8 -6
  359. data/spec/lib/geoblacklight/wms_layer_spec.rb +14 -0
  360. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +1 -1
  361. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +1 -21
  362. data/spec/spec_helper.rb +2 -28
  363. data/spec/test_app_templates/lib/generators/test_app_generator.rb +4 -12
  364. data/template.rb +13 -11
  365. data/test/leaflet/layers.test.js +17 -0
  366. data/vite.config.ts +34 -23
  367. metadata +304 -256
  368. data/.hound.yml +0 -8
  369. data/.jshintignore +0 -2
  370. data/.jshintrc +0 -67
  371. data/.solr_wrapper +0 -6
  372. data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +0 -26
  373. data/app/assets/images/blacklight/arizona.svg +0 -4
  374. data/app/assets/images/blacklight/arrow-circle-down.svg +0 -3
  375. data/app/assets/images/blacklight/baruch-cuny.svg +0 -3
  376. data/app/assets/images/blacklight/book.svg +0 -3
  377. data/app/assets/images/blacklight/bookmark.svg +0 -3
  378. data/app/assets/images/blacklight/cd-rom.svg +0 -3
  379. data/app/assets/images/blacklight/chicago.svg +0 -4
  380. data/app/assets/images/blacklight/child-item.svg +0 -3
  381. data/app/assets/images/blacklight/circle-info-solid.svg +0 -1
  382. data/app/assets/images/blacklight/citation.svg +0 -3
  383. data/app/assets/images/blacklight/collection.svg +0 -3
  384. data/app/assets/images/blacklight/collections.svg +0 -4
  385. data/app/assets/images/blacklight/columbia.svg +0 -3
  386. data/app/assets/images/blacklight/cornell.svg +0 -5
  387. data/app/assets/images/blacklight/datasets.svg +0 -7
  388. data/app/assets/images/blacklight/dvd-rom.svg +0 -3
  389. data/app/assets/images/blacklight/email.svg +0 -3
  390. data/app/assets/images/blacklight/esri-globe.svg +0 -31
  391. data/app/assets/images/blacklight/fire-solid.svg +0 -1
  392. data/app/assets/images/blacklight/geoblacklight-icons.json +0 -3312
  393. data/app/assets/images/blacklight/george-mason.svg +0 -4
  394. data/app/assets/images/blacklight/globe.svg +0 -3
  395. data/app/assets/images/blacklight/harvard.svg +0 -3
  396. data/app/assets/images/blacklight/home.svg +0 -3
  397. data/app/assets/images/blacklight/illinois.svg +0 -4
  398. data/app/assets/images/blacklight/image.svg +0 -3
  399. data/app/assets/images/blacklight/imagery.svg +0 -4
  400. data/app/assets/images/blacklight/indiana.svg +0 -3
  401. data/app/assets/images/blacklight/iowa.svg +0 -3
  402. data/app/assets/images/blacklight/leaf.svg +0 -3
  403. data/app/assets/images/blacklight/lewis-clark.svg +0 -5
  404. data/app/assets/images/blacklight/lightbulb-solid.svg +0 -1
  405. data/app/assets/images/blacklight/line.svg +0 -4
  406. data/app/assets/images/blacklight/map-marker.svg +0 -3
  407. data/app/assets/images/blacklight/map.svg +0 -3
  408. data/app/assets/images/blacklight/maps.svg +0 -4
  409. data/app/assets/images/blacklight/maryland.svg +0 -3
  410. data/app/assets/images/blacklight/massgis.svg +0 -3
  411. data/app/assets/images/blacklight/metadata.svg +0 -3
  412. data/app/assets/images/blacklight/michigan-state-university.svg +0 -5
  413. data/app/assets/images/blacklight/michigan-state.svg +0 -4
  414. data/app/assets/images/blacklight/michigan.svg +0 -3
  415. data/app/assets/images/blacklight/minnesota.svg +0 -3
  416. data/app/assets/images/blacklight/mit.svg +0 -3
  417. data/app/assets/images/blacklight/mixed.svg +0 -5
  418. data/app/assets/images/blacklight/multilinestring.svg +0 -6
  419. data/app/assets/images/blacklight/multipoint.svg +0 -3
  420. data/app/assets/images/blacklight/multipolygon.svg +0 -6
  421. data/app/assets/images/blacklight/nebraska.svg +0 -4
  422. data/app/assets/images/blacklight/northwestern-university.svg +0 -5
  423. data/app/assets/images/blacklight/nyu.svg +0 -6
  424. data/app/assets/images/blacklight/ohio-state.svg +0 -5
  425. data/app/assets/images/blacklight/pagelines-brands.svg +0 -3
  426. data/app/assets/images/blacklight/paper-map.svg +0 -3
  427. data/app/assets/images/blacklight/parent-item.svg +0 -3
  428. data/app/assets/images/blacklight/penn-state.svg +0 -4
  429. data/app/assets/images/blacklight/pennsylvania-state-university.svg +0 -5
  430. data/app/assets/images/blacklight/point.svg +0 -3
  431. data/app/assets/images/blacklight/polygon.svg +0 -4
  432. data/app/assets/images/blacklight/polyline.svg +0 -6
  433. data/app/assets/images/blacklight/princeton.svg +0 -3
  434. data/app/assets/images/blacklight/public.svg +0 -3
  435. data/app/assets/images/blacklight/purdue-university.svg +0 -5
  436. data/app/assets/images/blacklight/purdue.svg +0 -4
  437. data/app/assets/images/blacklight/raster.svg +0 -3
  438. data/app/assets/images/blacklight/restricted.svg +0 -3
  439. data/app/assets/images/blacklight/rutgers.svg +0 -5
  440. data/app/assets/images/blacklight/sms.svg +0 -3
  441. data/app/assets/images/blacklight/stanford.svg +0 -3
  442. data/app/assets/images/blacklight/table.svg +0 -3
  443. data/app/assets/images/blacklight/tags.svg +0 -3
  444. data/app/assets/images/blacklight/texas.svg +0 -3
  445. data/app/assets/images/blacklight/the-ohio-state-university.svg +0 -6
  446. data/app/assets/images/blacklight/triangle-exclamation-solid.svg +0 -1
  447. data/app/assets/images/blacklight/tufts.svg +0 -3
  448. data/app/assets/images/blacklight/ucla.svg +0 -3
  449. data/app/assets/images/blacklight/university-of-california-berkeley.svg +0 -4
  450. data/app/assets/images/blacklight/university-of-chicago.svg +0 -5
  451. data/app/assets/images/blacklight/university-of-colorado-boulder.svg +0 -6
  452. data/app/assets/images/blacklight/university-of-illinois-urbana-champaign.svg +0 -5
  453. data/app/assets/images/blacklight/university-of-iowa.svg +0 -4
  454. data/app/assets/images/blacklight/university-of-maryland.svg +0 -4
  455. data/app/assets/images/blacklight/university-of-michigan.svg +0 -4
  456. data/app/assets/images/blacklight/university-of-minnesota.svg +0 -4
  457. data/app/assets/images/blacklight/university-of-nebraska-lincoln.svg +0 -7
  458. data/app/assets/images/blacklight/university-of-wisconsin-madison.svg +0 -4
  459. data/app/assets/images/blacklight/uva.svg +0 -3
  460. data/app/assets/images/blacklight/web_services.svg +0 -3
  461. data/app/assets/images/blacklight/websites.svg +0 -4
  462. data/app/assets/images/blacklight/wisconsin.svg +0 -3
  463. data/app/assets/javascripts/geoblacklight/basemaps.js +0 -85
  464. data/app/assets/javascripts/geoblacklight/controls/fullscreen.js +0 -8
  465. data/app/assets/javascripts/geoblacklight/controls/opacity.js +0 -6
  466. data/app/assets/javascripts/geoblacklight/controls.js +0 -1
  467. data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +0 -61
  468. data/app/assets/javascripts/geoblacklight/downloaders/hgl_downloader.js +0 -32
  469. data/app/assets/javascripts/geoblacklight/downloaders.js +0 -1
  470. data/app/assets/javascripts/geoblacklight/geoblacklight.js +0 -60
  471. data/app/assets/javascripts/geoblacklight/modules/bookmarks.js +0 -43
  472. data/app/assets/javascripts/geoblacklight/modules/download.js +0 -11
  473. data/app/assets/javascripts/geoblacklight/modules/geosearch.js +0 -133
  474. data/app/assets/javascripts/geoblacklight/modules/help_text.js +0 -7
  475. data/app/assets/javascripts/geoblacklight/modules/home.js +0 -16
  476. data/app/assets/javascripts/geoblacklight/modules/item.js +0 -32
  477. data/app/assets/javascripts/geoblacklight/modules/layer_opacity.js +0 -68
  478. data/app/assets/javascripts/geoblacklight/modules/metadata.js +0 -15
  479. data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +0 -58
  480. data/app/assets/javascripts/geoblacklight/modules/relations.js +0 -14
  481. data/app/assets/javascripts/geoblacklight/modules/results.js +0 -81
  482. data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +0 -31
  483. data/app/assets/javascripts/geoblacklight/modules/util.js +0 -48
  484. data/app/assets/javascripts/geoblacklight/modules.js +0 -1
  485. data/app/assets/javascripts/geoblacklight/templates/index_map_download.hbs +0 -19
  486. data/app/assets/javascripts/geoblacklight/templates/index_map_info.hbs +0 -61
  487. data/app/assets/javascripts/geoblacklight/viewers/cog.js +0 -5
  488. data/app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js +0 -85
  489. data/app/assets/javascripts/geoblacklight/viewers/esri/feature_layer.js +0 -76
  490. data/app/assets/javascripts/geoblacklight/viewers/esri/image_map_layer.js +0 -14
  491. data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +0 -50
  492. data/app/assets/javascripts/geoblacklight/viewers/esri.js +0 -78
  493. data/app/assets/javascripts/geoblacklight/viewers/iiif.js +0 -25
  494. data/app/assets/javascripts/geoblacklight/viewers/index_map.js +0 -71
  495. data/app/assets/javascripts/geoblacklight/viewers/map.js +0 -77
  496. data/app/assets/javascripts/geoblacklight/viewers/oembed.js +0 -13
  497. data/app/assets/javascripts/geoblacklight/viewers/pmtiles.js +0 -5
  498. data/app/assets/javascripts/geoblacklight/viewers/tilejson.js +0 -33
  499. data/app/assets/javascripts/geoblacklight/viewers/tms.js +0 -10
  500. data/app/assets/javascripts/geoblacklight/viewers/viewer.js +0 -68
  501. data/app/assets/javascripts/geoblacklight/viewers/wms.js +0 -74
  502. data/app/assets/javascripts/geoblacklight/viewers/wmts.js +0 -85
  503. data/app/assets/javascripts/geoblacklight/viewers/xyz.js +0 -10
  504. data/app/assets/javascripts/geoblacklight/viewers.js +0 -1
  505. data/app/assets/stylesheets/geoblacklight/modules/mixins.scss +0 -5
  506. data/app/helpers/arcgis_helper.rb +0 -14
  507. data/app/helpers/blacklight_helper.rb +0 -11
  508. data/app/helpers/carto_helper.rb +0 -31
  509. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +0 -18
  510. data/app/javascript/clover/clover_initializer.js +0 -29
  511. data/app/javascript/index.js +0 -7
  512. data/app/javascript/openlayers/basemaps.js +0 -47
  513. data/app/javascript/openlayers/ol_initializer.js +0 -106
  514. data/app/javascript/stylesheets/openlayers.css +0 -1
  515. data/app/models/concerns/geoblacklight/solr_document/carto.rb +0 -17
  516. data/app/views/catalog/_arcgis.html.erb +0 -4
  517. data/app/views/catalog/_carto.html.erb +0 -4
  518. data/app/views/catalog/_data_dictionary.html.erb +0 -5
  519. data/app/views/catalog/_downloads_collapse.html.erb +0 -27
  520. data/app/views/catalog/_header_icons.html.erb +0 -3
  521. data/app/views/catalog/_index_split_default.html.erb +0 -30
  522. data/app/views/catalog/_results_pagination.html.erb +0 -12
  523. data/app/views/catalog/_show_default_attribute_table.html.erb +0 -19
  524. data/app/views/catalog/_show_default_display_note.html.erb +0 -7
  525. data/app/views/catalog/_show_default_viewer_container.html.erb +0 -28
  526. data/app/views/catalog/_show_downloads.html.erb +0 -23
  527. data/app/views/catalog/_show_header_default.html.erb +0 -4
  528. data/app/views/catalog/_show_sidebar.html.erb +0 -16
  529. data/app/views/catalog/_show_sidebar_static_map.html.erb +0 -10
  530. data/app/views/catalog/_show_web_services.html.erb +0 -11
  531. data/app/views/catalog/_web_services.html.erb +0 -9
  532. data/app/views/catalog/_web_services_wms.html.erb +0 -13
  533. data/app/views/download/hgl.html.erb +0 -27
  534. data/app/views/relation/_relations.html.erb +0 -15
  535. data/app/views/shared/_header_navbar.html.erb +0 -46
  536. data/babel.config.json +0 -4
  537. data/jest.config.js +0 -25
  538. data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +0 -1
  539. data/lib/generators/geoblacklight/templates/assets/_geoblacklight.scss +0 -1
  540. data/lib/generators/geoblacklight/templates/assets/geoblacklight.js +0 -9
  541. data/lib/generators/geoblacklight/templates/clover.js +0 -5
  542. data/lib/generators/geoblacklight/templates/ol.js +0 -6
  543. data/lib/generators/geoblacklight/templates/package-test.json +0 -10
  544. data/lib/generators/geoblacklight/templates/settings.gbl_v1.yml +0 -195
  545. data/lib/geoblacklight/download/hgl_download.rb +0 -20
  546. data/lib/geoblacklight/view_helper_override.rb +0 -16
  547. data/setupJest.js +0 -14
  548. data/spec/helpers/arcgis_helper_spec.rb +0 -16
  549. data/spec/helpers/carto_helper_spec.rb +0 -13
  550. data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +0 -27
  551. data/spec/javascripts/util_spec.js +0 -10
  552. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +0 -62
  553. data/spec/lib/geoblacklight/view_helper_override_spec.rb +0 -29
  554. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +0 -43
  555. data/spec/test_app_templates/Gemfile.extra +0 -2
  556. data/spec/views/catalog/_document_split.html.erb_spec.rb +0 -7
  557. data/spec/views/catalog/_index_split.html.erb_spec.rb +0 -7
  558. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +0 -11
  559. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +0 -43
  560. data/spec/views/catalog/_show_tools.html.erb_spec.rb +0 -38
  561. data/vendor/assets/images/fullscreen.png +0 -0
  562. data/vendor/assets/images/fullscreen@2x.png +0 -0
  563. data/vendor/assets/images/layers-2x.png +0 -0
  564. data/vendor/assets/images/layers.png +0 -0
  565. data/vendor/assets/images/marker-icon-2x.png +0 -0
  566. data/vendor/assets/images/marker-icon.png +0 -0
  567. data/vendor/assets/images/marker-shadow.png +0 -0
  568. data/vendor/assets/javascripts/Leaflet.fullscreen.js +0 -152
  569. data/vendor/assets/javascripts/esri-leaflet.js +0 -12
  570. data/vendor/assets/javascripts/esri-leaflet.js.map +0 -1
  571. data/vendor/assets/javascripts/leaflet-iiif.js +0 -323
  572. data/vendor/assets/javascripts/leaflet-src.js.erb +0 -14126
  573. data/vendor/assets/javascripts/leaflet-src.js.map +0 -1
  574. data/vendor/assets/javascripts/native.history.js +0 -1
  575. data/vendor/assets/stylesheets/leaflet.css +0 -640
  576. data/vendor/assets/stylesheets/leaflet.fullscreen.css +0 -40
  577. /data/app/{views/catalog/_show_default_viewer_information.html.erb → components/geoblacklight/index_map_inspect_component.html.erb} +0 -0
@@ -0,0 +1,50 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+ import { geoJSONToBounds } from "geoblacklight/leaflet/utils";
3
+ import { DEFAULT_BOUNDS } from "geoblacklight/leaflet/constants";
4
+
5
+ export default class SearchResultsController extends Controller {
6
+ static targets = ["result"];
7
+ static outlets = ["leaflet-viewer"];
8
+
9
+ // Fit the map to the combined bounding box of all search results
10
+ // If a bounding box query is already active, do not override it
11
+ fitResultBounds() {
12
+ if (new URL(window.location).searchParams.get("bbox")) return;
13
+ this.leafletViewerOutlet.fitBounds(this.getMaximalBounds());
14
+ }
15
+
16
+ // Get the bounding box of a search result from its data attributes
17
+ getResultBounds(resultElement) {
18
+ const geomElement = resultElement.querySelector("[data-geom]");
19
+ if (geomElement && geomElement.dataset.geom) {
20
+ return geoJSONToBounds(JSON.parse(geomElement.dataset.geom));
21
+ }
22
+ }
23
+
24
+ // Find the combined bounding box of all search results
25
+ getMaximalBounds() {
26
+ const bounds = this.resultTargets.map(this.getResultBounds);
27
+ const nonNullBounds = bounds.filter((b) => b);
28
+
29
+ if (nonNullBounds.length > 0) {
30
+ return nonNullBounds.reduce((max, b) => max.extend(b));
31
+ }
32
+
33
+ return DEFAULT_BOUNDS;
34
+ }
35
+
36
+ // Preview the selected search result's bounding box on the map
37
+ previewResultOnMap(event) {
38
+ const geomElement = event.target.querySelector("[data-geom]");
39
+ if (geomElement && geomElement.dataset.geom !== "") {
40
+ const geom = JSON.parse(geomElement.dataset.geom);
41
+ const bbox = geoJSONToBounds(geom);
42
+ this.leafletViewerOutlet.addBoundsOverlay(bbox);
43
+ }
44
+ }
45
+
46
+ // Remove the previewed bounding box
47
+ clearPreview() {
48
+ this.leafletViewerOutlet.removeBoundsOverlay();
49
+ }
50
+ }
@@ -0,0 +1,69 @@
1
+ // Initializers
2
+ import initializePopovers from "geoblacklight/initializers/popovers";
3
+ import initializeRelations from "geoblacklight/initializers/relations";
4
+ import initializeTooltips from "geoblacklight/initializers/tooltips";
5
+ import initializeTruncation from "geoblacklight/initializers/truncation";
6
+ import initializeMetadataDownload from "geoblacklight/initializers/metadata_download";
7
+
8
+ // Stimulus controllers
9
+ import ClipboardController from "geoblacklight/controllers/clipboard_controller";
10
+ import CloverViewerController from "geoblacklight/controllers/clover_viewer_controller";
11
+ import DownloadsController from "geoblacklight/controllers/downloads_controller";
12
+ import LeafletViewerController from "geoblacklight/controllers/leaflet_viewer_controller";
13
+ import OembedViewerController from "geoblacklight/controllers/oembed_viewer_controller";
14
+ import OpenlayersViewerController from "geoblacklight/controllers/openlayers_viewer_controller";
15
+ import SearchResultsController from "geoblacklight/controllers/search_results_controller";
16
+
17
+ // Inspired by Blacklight's javascript/blacklight/core.js
18
+ const Geoblacklight = (function () {
19
+ const callbacks = [];
20
+ return {
21
+ // Hook: pass a callback to add it to the activation stack
22
+ onLoad: function (callback) {
23
+ callbacks.push(callback);
24
+ },
25
+
26
+ // Activate all stored callbacks
27
+ activate: function (event) {
28
+ callbacks.forEach((callback) => {
29
+ callback(event);
30
+ });
31
+ },
32
+
33
+ // Define hooks that will trigger the activation of the Geoblacklight JS
34
+ listeners: function () {
35
+ if (typeof Turbo !== "undefined")
36
+ return ["turbo:load", "turbo:frame-load"];
37
+ else return ["DOMContentLoaded"];
38
+ },
39
+ };
40
+ })();
41
+
42
+ // Add event listeners that call activate() for each event type
43
+ Geoblacklight.listeners().forEach((listener) =>
44
+ document.addEventListener(listener, (event) => Geoblacklight.activate(event))
45
+ );
46
+
47
+ // Register our initializers
48
+ Geoblacklight.onLoad(initializePopovers);
49
+ Geoblacklight.onLoad(initializeRelations);
50
+ Geoblacklight.onLoad(initializeTooltips);
51
+ Geoblacklight.onLoad(initializeTruncation);
52
+ Geoblacklight.onLoad(initializeMetadataDownload);
53
+
54
+ // Register our Stimulus controllers
55
+ if (typeof Stimulus !== "undefined") {
56
+ Stimulus.register("openlayers-viewer", OpenlayersViewerController);
57
+ Stimulus.register("clover-viewer", CloverViewerController);
58
+ Stimulus.register("oembed-viewer", OembedViewerController);
59
+ Stimulus.register("leaflet-viewer", LeafletViewerController);
60
+ Stimulus.register("search-results", SearchResultsController);
61
+ Stimulus.register("downloads", DownloadsController);
62
+ Stimulus.register("clipboard", ClipboardController);
63
+ } else {
64
+ console.error(
65
+ "Couldn't find Stimulus. Check installation instructions at https://github.com/hotwired/stimulus-rails."
66
+ );
67
+ }
68
+
69
+ export default Geoblacklight;
@@ -0,0 +1,29 @@
1
+ // Stimulus controllers
2
+ import OpenlayersViewerController from "geoblacklight/controllers/openlayers_viewer_controller";
3
+ import CloverViewerController from "geoblacklight/controllers/clover_viewer_controller";
4
+ import OembedViewerController from "geoblacklight/controllers/oembed_viewer_controller";
5
+ import LeafletViewerController from "geoblacklight/controllers/leaflet_viewer_controller";
6
+ import SearchResultsController from "geoblacklight/controllers/search_results_controller";
7
+ import DownloadsController from "geoblacklight/controllers/downloads_controller";
8
+ import ClipboardController from "geoblacklight/controllers/clipboard_controller";
9
+
10
+ // GBL core
11
+ import Core from "geoblacklight/core";
12
+
13
+ // Other modules
14
+ import openLayersBasemaps from "geoblacklight/openlayers/basemaps";
15
+ import leafletBasemaps from "geoblacklight/leaflet/basemaps";
16
+
17
+ export default {
18
+ OpenlayersViewerController,
19
+ CloverViewerController,
20
+ OembedViewerController,
21
+ LeafletViewerController,
22
+ SearchResultsController,
23
+ DownloadsController,
24
+ ClipboardController,
25
+ openLayersBasemaps,
26
+ leafletBasemaps,
27
+ Core,
28
+ onLoad: Core.onLoad,
29
+ };
@@ -0,0 +1,54 @@
1
+ export class GeoBlacklightMetadataDownloadButton {
2
+ constructor(el, i, options = {}) {
3
+ this.options = options;
4
+ this.el = typeof el === "string" ? document.querySelector(el) : el;
5
+ this.download = document.querySelector(
6
+ this.options.target || this.el.getAttribute("data-ref-download")
7
+ );
8
+ // On initialization only do this for the first one.
9
+ if (i === 0) {
10
+ this.setRefUrl();
11
+ }
12
+ this.configureHandler();
13
+ }
14
+
15
+ configureHandler() {
16
+ this.el.addEventListener("click", () => this.setRefUrl());
17
+ }
18
+
19
+ setRefUrl() {
20
+ const refUrl = this.el.getAttribute("data-ref-endpoint");
21
+ if (!refUrl) {
22
+ this.download.style.display = "none";
23
+ } else {
24
+ this.download.style.display = "";
25
+ this.download.setAttribute("href", refUrl);
26
+ }
27
+ }
28
+ }
29
+
30
+ export default function initializeMetadataDownload() {
31
+ const modal = document.getElementById("blacklight-modal");
32
+
33
+ modal.addEventListener("focus", (e) => {
34
+ if (!Array.from(e.target.classList).includes('show')){
35
+ return;
36
+ }
37
+ e.target.querySelectorAll(".metadata-body").forEach((el) => {
38
+ el.closest(".modal-content").classList.add("metadata-modal");
39
+ });
40
+
41
+ e.target.querySelectorAll(".pill-metadata").forEach((element, i) => {
42
+ new GeoBlacklightMetadataDownloadButton(element, i);
43
+ });
44
+ });
45
+
46
+ modal.addEventListener("blur", (e) => {
47
+ if (Array.from(e.target.classList).includes('show')){
48
+ return;
49
+ }
50
+ e.target.querySelectorAll(".metadata-body").forEach((el) => {
51
+ el.closest(".modal-content").classList.remove("metadata-modal");
52
+ });
53
+ });
54
+ }
@@ -0,0 +1,11 @@
1
+ import { Popover } from 'bootstrap';
2
+
3
+ // Initialize popovers
4
+ export default function initializePopovers() {
5
+ const popoverElements = document.querySelectorAll('[data-bs-toggle="popover"]'); // Bootstrap 5 uses 'data-bs-toggle'
6
+ popoverElements.forEach((element) => {
7
+ const popover = new Popover(element, {
8
+ trigger: "hover",
9
+ });
10
+ });
11
+ }
@@ -0,0 +1,40 @@
1
+ const fadeIn = (element, duration) => {
2
+ element.style.opacity = 0;
3
+ element.style.display = "block";
4
+
5
+ let start = null;
6
+ function step(timestamp) {
7
+ if (!start) start = timestamp;
8
+ const progress = timestamp - start;
9
+ element.style.opacity = Math.min(progress / duration, 1);
10
+ if (progress < duration) {
11
+ window.requestAnimationFrame(step);
12
+ }
13
+ }
14
+
15
+ window.requestAnimationFrame(step);
16
+ };
17
+
18
+ // Set up the relations widgets by querying the relations endpoint
19
+ export default function initializeRelations() {
20
+ document.querySelectorAll('[data-relations="true"]').forEach((element) => {
21
+ const attributes = element.dataset;
22
+ const relationUrl = `${attributes.url}/relations`;
23
+
24
+ fetch(relationUrl, { headers: { "X-Requested-With": "XMLHttpRequest" } })
25
+ .then((response) => {
26
+ if (!response.ok) {
27
+ throw new Error("Network response was not ok");
28
+ }
29
+ return response.text();
30
+ })
31
+ .then((data) => {
32
+ const div = document.createElement("div");
33
+ div.innerHTML = data;
34
+ element.appendChild(div);
35
+ div.style.display = "none";
36
+ fadeIn(div, 200);
37
+ })
38
+ .catch((error) => console.error("Error:", error));
39
+ });
40
+ }
@@ -0,0 +1,55 @@
1
+ import { Tooltip } from "bootstrap";
2
+
3
+ export default function initializeTooltips() {
4
+ document.body.addEventListener(
5
+ "mouseenter",
6
+ (event) => {
7
+ if (event.target.closest(".blacklight-icons.svg_tooltip svg")) {
8
+ const svgElement = event.target.closest(
9
+ ".blacklight-icons.svg_tooltip svg"
10
+ );
11
+ const svgTitleElement = svgElement.querySelector("title");
12
+ const titleText = svgTitleElement ? svgTitleElement.textContent : "";
13
+
14
+ if (titleText !== undefined && titleText !== "") {
15
+ // Initialize Bootstrap tooltip with native JavaScript
16
+ const tooltip = new Tooltip(svgElement, {
17
+ placement: "bottom",
18
+ title: titleText,
19
+ });
20
+ tooltip.show();
21
+
22
+ // Store the original title in the data-original-title attribute
23
+ // and remove the title element to prevent it from interfering with Bootstrap's tooltip.
24
+ svgElement.setAttribute("data-original-title", titleText);
25
+ svgTitleElement.remove();
26
+ }
27
+ }
28
+ },
29
+ true
30
+ ); // Use capture to ensure the event is caught as it bubbles up
31
+
32
+ document.body.addEventListener(
33
+ "mouseleave",
34
+ (event) => {
35
+ if (event.target.closest(".blacklight-icons.svg_tooltip svg")) {
36
+ const svgElement = event.target.closest(
37
+ ".blacklight-icons.svg_tooltip svg"
38
+ );
39
+ const originalTitle = svgElement.getAttribute("data-original-title");
40
+
41
+ if (originalTitle !== undefined && originalTitle !== "") {
42
+ // Restore the SVG title element from data-original-title
43
+ const newTitleElement = document.createElement("title");
44
+ newTitleElement.textContent = originalTitle;
45
+ svgElement.prepend(newTitleElement);
46
+ svgElement.setAttribute("data-original-title", "");
47
+ }
48
+ }
49
+
50
+ // Remove tooltips
51
+ document.querySelectorAll(".tooltip").forEach((elem) => elem.remove());
52
+ },
53
+ true
54
+ ); // Use capture to ensure the event is caught as it bubbles up
55
+ }
@@ -0,0 +1,45 @@
1
+ // Truncate and expand/collapse abstracts (descriptions) on show page
2
+
3
+ // Class that handles adding a button to expand/collapse a description
4
+ // Uses bootstrap's built-in collapse functionality; CSS is used to do the truncation
5
+ class Truncator {
6
+ constructor(element, { lines, id }) {
7
+ // if the element is already small enough, don't truncate it
8
+ const minHeight = lines * parseFloat(window.getComputedStyle(element).fontSize);
9
+ if (element.getBoundingClientRect().height < minHeight) return;
10
+
11
+ // set a unique ID for the element if it doesn't have one
12
+ this.element = element;
13
+ this.element.id ||= id;
14
+
15
+ // add the button
16
+ this.button = document.createElement("button");
17
+ this.button.classList.add("btn", "btn-link", "p-0", "border-0");
18
+ this.button.dataset.bsToggle = "collapse";
19
+ this.button.dataset.bsTarget = `#${this.element.id}`;
20
+ this.button.setAttribute("aria-expanded", "false");
21
+ this.button.setAttribute("aria-controls", this.element.id);
22
+ this.button.textContent = "Read more";
23
+ this.button.addEventListener("click", this.toggle.bind(this));
24
+ element.parentNode.insertBefore(this.button, element.nextSibling);
25
+
26
+ // start collapsed
27
+ this.element.classList.add("collapse");
28
+ }
29
+
30
+ toggle() {
31
+ if (this.button.textContent == "Read more") this.button.textContent = "Close";
32
+ else this.button.textContent = "Read more";
33
+ }
34
+ }
35
+
36
+ // Initialize truncation for all elements with class "truncate-abstract"
37
+ // Ensure they have unique IDs because bootstrap requires this
38
+ export default function initializeTruncation() {
39
+ document.querySelectorAll(".truncate-abstract").forEach((element, i) => {
40
+ new Truncator(element, {
41
+ lines: 12,
42
+ id: `truncate-${i}`,
43
+ });
44
+ });
45
+ }
@@ -0,0 +1,74 @@
1
+ export default {
2
+ darkMatter: {
3
+ url: "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{retina}.png",
4
+ attribution:
5
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
6
+ maxZoom: 18,
7
+ worldCopyJump: true,
8
+ retina: "@2x",
9
+ },
10
+ positron: {
11
+ url: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{retina}.png",
12
+ attribution:
13
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
14
+ maxZoom: 18,
15
+ worldCopyJump: true,
16
+ retina: "@2x",
17
+ },
18
+ positronLite: {
19
+ url: "https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{retina}.png",
20
+ attribution:
21
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
22
+ maxZoom: 18,
23
+ worldCopyJump: true,
24
+ retina: "@2x",
25
+ },
26
+ worldAntique: {
27
+ url: "https://cartocdn_{s}.global.ssl.fastly.net/base-antique/{z}/{x}/{y}{retina}.png",
28
+ attribution:
29
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
30
+ maxZoom: 18,
31
+ worldCopyJump: true,
32
+ retina: "@2x",
33
+ },
34
+ worldEco: {
35
+ url: "https://cartocdn_{s}.global.ssl.fastly.net/base-eco/{z}/{x}/{y}{retina}.png",
36
+ attribution:
37
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
38
+ maxZoom: 18,
39
+ worldCopyJump: true,
40
+ retina: "@2x",
41
+ },
42
+ flatBlue: {
43
+ url: "https://cartocdn_{s}.global.ssl.fastly.net/base-flatblue/{z}/{x}/{y}{retina}.png",
44
+ attribution:
45
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
46
+ maxZoom: 18,
47
+ worldCopyJump: true,
48
+ retina: "@2x",
49
+ },
50
+ midnightCommander: {
51
+ url: "https://cartocdn_{s}.global.ssl.fastly.net/base-midnight/{z}/{x}/{y}{retina}.png",
52
+ attribution:
53
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
54
+ maxZoom: 18,
55
+ worldCopyJump: true,
56
+ retina: "@2x",
57
+ },
58
+ openstreetmapHot: {
59
+ url: "https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",
60
+ attribution:
61
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>',
62
+ maxZoom: 19,
63
+ worldCopyJump: true,
64
+ retina: "@2x",
65
+ },
66
+ openstreetmapStandard: {
67
+ url: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
68
+ attribution:
69
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
70
+ maxZoom: 19,
71
+ worldCopyJump: true,
72
+ retina: "@2x",
73
+ },
74
+ };
@@ -0,0 +1,18 @@
1
+ import { LatLngBounds } from "leaflet";
2
+
3
+ export const DEFAULT_BOUNDS = new LatLngBounds([
4
+ [-30, -100],
5
+ [30, 100],
6
+ ]);
7
+
8
+ export const DEFAULT_OPACITY = 0.75;
9
+
10
+ export const DEFAULT_BASEMAP = "positron";
11
+
12
+ export const DEFAULT_GEOM_OVERLAY_OPTIONS = {
13
+ color: '#3388ff',
14
+ dashArray: "5 5",
15
+ weight: 2,
16
+ opacity: 1,
17
+ fillOpacity: 0
18
+ }
@@ -0,0 +1,160 @@
1
+ import { DomUtil, Control, Handler, setOptions } from "leaflet";
2
+ import { debounce, boundsToBbox } from "geoblacklight/leaflet/utils";
3
+
4
+ export const geosearchDefaultOptions = {
5
+ dynamic: true,
6
+ delay: 800,
7
+ };
8
+
9
+ export default class GeoSearchControl extends Control {
10
+ constructor(options) {
11
+ const _options = { ...geosearchDefaultOptions, ...options };
12
+ super(_options);
13
+ setOptions(this, _options);
14
+ }
15
+
16
+ onAdd(map) {
17
+ this.map = map;
18
+ this.map.options.geoSearchControl = this;
19
+
20
+ // Create the buttons
21
+ this.staticButton = this.createStaticButton();
22
+ this.dynamicButton = this.createDynamicButton();
23
+
24
+ // Add the buttons to the viewer
25
+ const container = DomUtil.create("div");
26
+ container.className = "leaflet-control search-control";
27
+ container.appendChild(this.staticButton);
28
+ container.appendChild(this.dynamicButton);
29
+
30
+ // Show the appropriate button
31
+ if (this.options.dynamic) this.dynamicButton.style.display = "block";
32
+ else this.staticButton.style.display = "block";
33
+
34
+ // Set up the dynamic search function with debounce
35
+ this.dynamicSearcher = debounce(() => {
36
+ if (this.options.dynamic) {
37
+ this.applySearch();
38
+ }
39
+ }, this.options.delay);
40
+
41
+ // Add the event handler
42
+ this.map.addHandler("geosearch", GeoSearchHandler);
43
+
44
+ return container;
45
+ }
46
+
47
+ // Button to search when clicked; contains an icon
48
+ createStaticButton() {
49
+ const staticButtonNode = DomUtil.create("a");
50
+ staticButtonNode.setAttribute("id", "gbl-static-button");
51
+ staticButtonNode.setAttribute("href", "#");
52
+ staticButtonNode.setAttribute("style", "display:none;");
53
+ staticButtonNode.className = "btn btn-primary";
54
+ staticButtonNode.textContent = "Search here";
55
+ staticButtonNode.addEventListener("click", this.staticSearch.bind(this));
56
+ return staticButtonNode;
57
+ }
58
+
59
+ // Button to search when the map is moved; contains a checkbox
60
+ createDynamicButton() {
61
+ const dynamicButtonNode = DomUtil.create("label");
62
+ dynamicButtonNode.setAttribute("id", "gbl-dynamic-button");
63
+ dynamicButtonNode.textContent = " Search when I move the map";
64
+ dynamicButtonNode.setAttribute("style", "display:none;");
65
+ const input = DomUtil.create("input");
66
+ input.setAttribute("type", "checkbox");
67
+ input.checked = true;
68
+ dynamicButtonNode.insertBefore(input, dynamicButtonNode.firstChild);
69
+ dynamicButtonNode.addEventListener(
70
+ "input",
71
+ this.toggleDynamicSearch.bind(this)
72
+ );
73
+ return dynamicButtonNode;
74
+ }
75
+
76
+ // Hide the static button, show the dynamic button, and apply the search
77
+ staticSearch() {
78
+ this.staticButton.style.display = "none";
79
+ if (this.options.dynamic) {
80
+ this.dynamicButton.style.display = "block";
81
+ }
82
+ // Do full page reload for staticSearch button
83
+ this.applySearch({ turbo: false });
84
+ }
85
+
86
+ // Update the URL with the current bounding box and go back to page 1
87
+ applySearch(opts={turbo: true}) {
88
+ // Delete any existing page and bbox parameters
89
+ const params = new URL(window.location).searchParams;
90
+ params.delete("page");
91
+ params.delete("bbox");
92
+
93
+ // Calculate the bounding box from the current map bounds
94
+ const bbox = boundsToBbox(this._map.getBounds());
95
+ params.set("bbox", bbox.join(" "));
96
+
97
+ // Make the new target URL using the configured base URL
98
+ const newUrl = new URL(this.options.baseUrl)
99
+ newUrl.search = params.toString()
100
+
101
+ // If Turbo Drive is active, do the new page navigation without a full page reload
102
+ if (window.Turbo && opts.turbo) window.Turbo.visit(newUrl);
103
+
104
+ // Otherwise fall back to the traditional full page reload
105
+ else window.location.href = newUrl;
106
+ }
107
+
108
+ // Toggle the dynamic search option
109
+ toggleDynamicSearch() {
110
+ this.options.dynamic = !this.options.dynamic;
111
+ }
112
+
113
+ // Hide the dynamic button and show the static button
114
+ hideDynamicButton() {
115
+ this.dynamicButton.style.display = "none";
116
+ this.staticButton.style.display = "block";
117
+ }
118
+ }
119
+
120
+ class GeoSearchHandler extends Handler {
121
+ constructor(map) {
122
+ super(map);
123
+ this.map = map;
124
+ this.control = map.options.geoSearchControl;
125
+ this.wasResized = false;
126
+ }
127
+
128
+ // Bind event handlers to the map
129
+ addHooks() {
130
+ this.map.on("resize", this.handleResize.bind(this));
131
+ this.map.on("dragend", this.handleDragEnd.bind(this));
132
+ this.map.on("dragstart", this.handleDragStart.bind(this));
133
+ this.map.on("zoomstart", this.handleDragEnd.bind(this));
134
+ this.map.on("zoomend", this.handleDragStart.bind(this));
135
+ }
136
+
137
+ // Remove event handlers from the map
138
+ removeHooks() {
139
+ this.map.off("resize");
140
+ this.map.off("dragend");
141
+ this.map.off("dragstart");
142
+ this.map.off("zoomend");
143
+ this.map.off("zoomstart");
144
+ }
145
+
146
+ handleResize() {
147
+ this.wasResized = true;
148
+ }
149
+
150
+ handleDragEnd() {
151
+ if (this.wasResized) this.wasResized = false;
152
+ else this.control.dynamicSearcher.apply(this.control);
153
+ }
154
+
155
+ handleDragStart() {
156
+ if (!this.control.options.dynamic) {
157
+ this.control.hideDynamicButton();
158
+ }
159
+ }
160
+ }