geoblacklight 5.3.0 → 6.0.0.pre.alpha.1
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.
- checksums.yaml +4 -4
- data/.engine_cart.yml +14 -0
- data/.github/workflows/ruby.yml +24 -25
- data/.gitignore +0 -9
- data/.prettierignore +4 -0
- data/.prettierrc +5 -0
- data/CONTRIBUTING.md +2 -4
- data/Gemfile +4 -2
- data/README.md +4 -4
- data/Rakefile +0 -22
- data/app/assets/stylesheets/geoblacklight/global.css +7 -0
- data/app/assets/stylesheets/geoblacklight/home.css +22 -0
- data/app/assets/stylesheets/geoblacklight/index_maps.css +36 -0
- data/app/assets/stylesheets/geoblacklight/record.css +39 -0
- data/app/assets/stylesheets/geoblacklight/search.css +56 -0
- data/app/assets/stylesheets/geoblacklight/viewers.css +50 -0
- data/app/assets/stylesheets/geoblacklight.css +14 -0
- data/app/components/blacklight/icons/web_services_component.rb +3 -3
- data/app/components/geoblacklight/accordion_component.html.erb +3 -3
- data/app/components/geoblacklight/accordion_component.rb +4 -0
- data/app/components/geoblacklight/arcgis_component.html.erb +1 -1
- data/app/components/geoblacklight/arcgis_component.rb +1 -1
- data/app/components/geoblacklight/attribute_table_component.html.erb +3 -3
- data/app/components/geoblacklight/data_dictionary_download_component.html.erb +1 -1
- data/app/components/geoblacklight/display_note_component.html.erb +1 -1
- data/app/components/geoblacklight/display_note_component.rb +2 -1
- data/app/components/geoblacklight/document/citation_component.html.erb +1 -1
- data/app/components/geoblacklight/document/sidebar_component.html.erb +1 -1
- data/app/components/geoblacklight/document/sidebar_component.rb +0 -1
- data/app/components/geoblacklight/document_component.html.erb +1 -2
- data/app/components/geoblacklight/header_component.html.erb +4 -4
- data/app/components/geoblacklight/header_icons_component.rb +4 -2
- data/app/components/geoblacklight/homepage_feature_facet_component.html.erb +3 -7
- data/app/components/geoblacklight/homepage_feature_facet_component.rb +12 -3
- data/app/components/geoblacklight/iiif_drag_drop_component.html.erb +2 -2
- data/app/components/geoblacklight/iiif_drag_drop_component.rb +2 -2
- data/app/components/geoblacklight/index_map_inspect_component.html.erb +3 -3
- data/app/components/geoblacklight/index_map_legend_component.html.erb +7 -7
- data/app/components/geoblacklight/index_map_legend_component.rb +7 -0
- data/app/components/geoblacklight/item_map_viewer_component.rb +8 -4
- data/app/components/geoblacklight/location_leaflet_map_component.rb +28 -15
- data/app/components/geoblacklight/relations_component.html.erb +2 -2
- data/app/components/geoblacklight/search_result_component.html.erb +28 -26
- data/app/components/geoblacklight/search_result_component.rb +2 -2
- data/app/components/geoblacklight/static_map_component.rb +5 -4
- data/app/components/geoblacklight/viewer_help_text_component.html.erb +1 -1
- data/app/components/geoblacklight/viewer_help_text_component.rb +1 -1
- data/app/components/geoblacklight/web_services_component.html.erb +1 -1
- data/app/components/geoblacklight/web_services_component.rb +1 -1
- data/app/components/geoblacklight/web_services_default_component.html.erb +6 -6
- data/app/components/geoblacklight/web_services_link_component.rb +12 -9
- data/app/components/geoblacklight/web_services_wfs_component.html.erb +4 -4
- data/app/components/geoblacklight/web_services_wms_component.html.erb +4 -4
- data/app/controllers/download_controller.rb +0 -1
- data/app/controllers/wms_controller.rb +1 -1
- data/app/helpers/geoblacklight_helper.rb +0 -15
- data/app/javascript/geoblacklight/controllers/clipboard_controller.js +6 -6
- data/app/javascript/geoblacklight/controllers/downloads_controller.js +37 -29
- data/app/javascript/geoblacklight/controllers/leaflet_viewer_controller.js +108 -117
- data/app/javascript/geoblacklight/controllers/oembed_viewer_controller.js +5 -5
- data/app/javascript/geoblacklight/controllers/openlayers_viewer_controller.js +27 -30
- data/app/javascript/geoblacklight/controllers/search_results_controller.js +18 -18
- data/app/javascript/geoblacklight/core.js +35 -36
- data/app/javascript/geoblacklight/index.js +10 -10
- data/app/javascript/geoblacklight/initializers/metadata_download.js +23 -25
- data/app/javascript/geoblacklight/initializers/popovers.js +4 -4
- data/app/javascript/geoblacklight/initializers/relations.js +20 -20
- data/app/javascript/geoblacklight/initializers/tooltips.js +19 -23
- data/app/javascript/geoblacklight/initializers/truncation.js +18 -18
- data/app/javascript/geoblacklight/leaflet/basemaps.js +2 -3
- data/app/javascript/geoblacklight/leaflet/constants.js +7 -7
- data/app/javascript/geoblacklight/leaflet/controls/geosearch.js +80 -74
- data/app/javascript/geoblacklight/leaflet/controls/layer_opacity.js +74 -73
- data/app/javascript/geoblacklight/leaflet/controls/sidebar.js +31 -29
- data/app/javascript/geoblacklight/leaflet/controls/sleep.js +54 -51
- data/app/javascript/geoblacklight/leaflet/inspection.js +77 -68
- data/app/javascript/geoblacklight/leaflet/layer_index_map.js +74 -69
- data/app/javascript/geoblacklight/leaflet/layer_wmts.js +14 -16
- data/app/javascript/geoblacklight/leaflet/layers.js +59 -66
- data/app/javascript/geoblacklight/leaflet/utils.js +37 -43
- data/app/javascript/geoblacklight/openlayers/basemaps.js +35 -27
- data/app/javascript/geoblacklight/openlayers/inspection.js +23 -23
- data/app/javascript/geoblacklight/openlayers/layers.js +11 -11
- data/app/models/concerns/geoblacklight/bbox_filter_query.rb +7 -9
- data/app/models/concerns/geoblacklight/solr_document.rb +16 -39
- data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +3 -3
- data/app/views/catalog/_document_split.html.erb +3 -3
- data/app/views/catalog/_home_text.html.erb +22 -14
- data/app/views/catalog/_metadata.html.erb +1 -1
- data/app/views/catalog/_relations_container.html.erb +1 -1
- data/app/views/catalog/index.html.erb +0 -1
- data/app/views/catalog/metadata/_markup.html.erb +1 -2
- data/app/views/catalog/metadata/_missing.html.erb +2 -2
- data/app/views/catalog/web_services.html.erb +1 -1
- data/app/views/relation/index.html.erb +1 -1
- data/app/views/relation/index.json.jbuilder +1 -1
- data/config/initializers/rails_config.rb +0 -3
- data/config/locales/geoblacklight.en.yml +79 -78
- data/geoblacklight.gemspec +1 -2
- data/lib/generators/geoblacklight/assets_generator.rb +35 -26
- data/lib/generators/geoblacklight/install_generator.rb +6 -11
- data/lib/generators/geoblacklight/templates/assets/customizations.css +6 -0
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +97 -73
- data/lib/generators/geoblacklight/templates/settings.yml +97 -113
- data/lib/geoblacklight/configuration/default_settings_builder.rb +18 -0
- data/lib/geoblacklight/configuration/display_note_shown_config.rb +13 -0
- data/lib/geoblacklight/configuration/fields_config.rb +51 -0
- data/lib/geoblacklight/configuration/leaflet_config.rb +73 -0
- data/lib/geoblacklight/configuration/leaflet_layers_config.rb +21 -0
- data/lib/geoblacklight/configuration/leaflet_sleep_config.rb +20 -0
- data/lib/geoblacklight/configuration/legacy_settings_builder.rb +94 -0
- data/lib/geoblacklight/configuration.rb +148 -0
- data/lib/geoblacklight/download.rb +2 -2
- data/lib/geoblacklight/engine.rb +7 -5
- data/lib/geoblacklight/metadata/base.rb +0 -2
- data/lib/geoblacklight/metadata_transformer.rb +0 -2
- data/lib/geoblacklight/references.rb +5 -4
- data/lib/geoblacklight/relation/ancestors.rb +3 -2
- data/lib/geoblacklight/relation/descendants.rb +2 -1
- data/lib/geoblacklight/relation/relation_response.rb +4 -4
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight/wms_layer.rb +3 -3
- data/lib/geoblacklight.rb +7 -1
- data/package.json +10 -31
- data/schema/geoblacklight-schema-aardvark.json +1 -9
- data/schema/readme.md +3 -4
- data/solr/conf/_rest_managed.json +3 -2
- data/solr/conf/schema.xml +1 -1
- data/spec/components/geoblacklight/arcgis_component_spec.rb +6 -6
- data/spec/components/geoblacklight/attribute_table_component_spec.rb +6 -7
- data/spec/components/geoblacklight/citation_component_spec.rb +7 -4
- data/spec/components/geoblacklight/display_note_component_spec.rb +8 -8
- data/spec/components/geoblacklight/document_component_spec.rb +13 -13
- data/spec/components/geoblacklight/download_links_component_spec.rb +17 -14
- data/spec/components/geoblacklight/header_icons_component_spec.rb +6 -11
- data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +22 -30
- data/spec/components/geoblacklight/iiif_drag_drop_component_spec.rb +3 -3
- data/spec/components/geoblacklight/index_map_legend_component_spec.rb +5 -18
- data/spec/components/geoblacklight/item_map_viewer_component_spec.rb +5 -5
- data/spec/components/geoblacklight/login_link_component_spec.rb +4 -5
- data/spec/components/geoblacklight/search_result_component_spec.rb +2 -6
- data/spec/components/geoblacklight/static_map_component_spec.rb +2 -2
- data/spec/components/geoblacklight/viewer_help_text_component_spec.rb +4 -6
- data/spec/components/geoblacklight/web_services_component_spec.rb +11 -10
- data/spec/controllers/catalog_controller_spec.rb +7 -7
- data/spec/controllers/download_controller_spec.rb +1 -1
- data/spec/controllers/relation_controller_spec.rb +1 -1
- data/spec/controllers/wms_controller_spec.rb +1 -1
- data/spec/features/axe_spec.rb +4 -4
- data/spec/features/bookmarks_spec.rb +1 -1
- data/spec/features/citations_spec.rb +1 -1
- data/spec/features/configurable_basemap_spec.rb +1 -1
- data/spec/features/data_dictionary_download_spec.rb +1 -1
- data/spec/features/download_layer_spec.rb +1 -1
- data/spec/features/empty_search_spec.rb +1 -1
- data/spec/features/esri_viewer_spec.rb +1 -1
- data/spec/features/exports_spec.rb +1 -1
- data/spec/features/full_screen_control_spec.rb +3 -10
- data/spec/features/help_text_spec.rb +1 -1
- data/spec/features/home_page_spec.rb +1 -1
- data/spec/features/index_map_spec.rb +3 -3
- data/spec/features/index_view_spec.rb +7 -7
- data/spec/features/layer_inspection_spec.rb +1 -1
- data/spec/features/layer_opacity_spec.rb +1 -1
- data/spec/features/layer_preview_spec.rb +1 -1
- data/spec/features/layer_with_no_references_spec.rb +1 -1
- data/spec/features/linkified_attribute_table_spec.rb +1 -1
- data/spec/features/metadata_panel_spec.rb +1 -1
- data/spec/features/missing_metadata_spec.rb +1 -1
- data/spec/features/multiple_downloads_spec.rb +1 -1
- data/spec/features/oembed_spec.rb +1 -1
- data/spec/features/relations_spec.rb +2 -2
- data/spec/features/saved_searches_spec.rb +1 -1
- data/spec/features/search_bar_spec.rb +1 -1
- data/spec/features/search_results_complex_geometry_spec.rb +1 -1
- data/spec/features/search_results_icons_spec.rb +3 -4
- data/spec/features/search_results_map_spec.rb +1 -1
- data/spec/features/search_results_overlap_ratio_spec.rb +3 -3
- data/spec/features/search_spec.rb +1 -1
- data/spec/features/show_page_download_spec.rb +1 -1
- data/spec/features/show_page_metadata_spec.rb +2 -2
- data/spec/features/show_page_sidebar_static_map_spec.rb +1 -1
- data/spec/features/sms_spec.rb +1 -1
- data/spec/features/suppressed_records_spec.rb +1 -1
- data/spec/features/tilejson_spec.rb +1 -1
- data/spec/features/tms_spec.rb +1 -1
- data/spec/features/web_services_modal_spec.rb +1 -1
- data/spec/features/wmts_spec.rb +1 -1
- data/spec/features/xyz_spec.rb +1 -1
- data/spec/fixtures/manifests/tilejson.json +10 -19
- data/spec/fixtures/metadata/fgdc.html +1 -1
- data/spec/fixtures/metadata/iso.html +1 -1
- data/spec/fixtures/solr_documents/README.md +0 -1
- data/spec/fixtures/solr_documents/actual-papermap1.json +9 -28
- data/spec/fixtures/solr_documents/actual-point1.json +12 -39
- data/spec/fixtures/solr_documents/actual-polygon1.json +10 -30
- data/spec/fixtures/solr_documents/actual-raster1.json +14 -46
- data/spec/fixtures/solr_documents/all-relationships.json +12 -36
- data/spec/fixtures/solr_documents/b1g_iiif_manifest.json +33 -62
- data/spec/fixtures/solr_documents/b1g_wabash_child_15.json +13 -40
- data/spec/fixtures/solr_documents/b1g_wabash_child_16.json +13 -40
- data/spec/fixtures/solr_documents/b1g_wabash_child_17.json +13 -40
- data/spec/fixtures/solr_documents/b1g_wabash_child_18.json +13 -40
- data/spec/fixtures/solr_documents/b1g_wabash_parent.json +13 -40
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +13 -40
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +13 -40
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +14 -46
- data/spec/fixtures/solr_documents/bbox-spans-180.json +7 -21
- data/spec/fixtures/solr_documents/complex-geom.json +11 -37
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +12 -37
- data/spec/fixtures/solr_documents/display-note.json +11 -33
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +13 -39
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +13 -40
- data/spec/fixtures/solr_documents/esri-feature-layer.json +13 -39
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +13 -40
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +16 -54
- data/spec/fixtures/solr_documents/esri-wms-layer.json +12 -36
- data/spec/fixtures/solr_documents/harvard_raster.json +12 -37
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +9 -27
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +12 -41
- data/spec/fixtures/solr_documents/index-map-polygon.json +12 -41
- data/spec/fixtures/solr_documents/index-map-stanford.json +14 -45
- data/spec/fixtures/solr_documents/index-map-v1-complex.json +13 -38
- data/spec/fixtures/solr_documents/index_map_point.json +13 -42
- data/spec/fixtures/solr_documents/metadata_no_geom.json +4 -14
- data/spec/fixtures/solr_documents/metadata_no_provider.json +8 -25
- data/spec/fixtures/solr_documents/multiple-downloads.json +6 -18
- data/spec/fixtures/solr_documents/no_locn_geometry.json +4 -12
- data/spec/fixtures/solr_documents/no_spatial.json +4 -12
- data/spec/fixtures/solr_documents/oembed.json +8 -25
- data/spec/fixtures/solr_documents/princeton-child1.json +9 -29
- data/spec/fixtures/solr_documents/princeton-child2.json +9 -29
- data/spec/fixtures/solr_documents/princeton-child3.json +9 -29
- data/spec/fixtures/solr_documents/princeton-child4.json +9 -29
- data/spec/fixtures/solr_documents/princeton-parent.json +10 -33
- data/spec/fixtures/solr_documents/public_cog_princeton.json +9 -27
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +13 -43
- data/spec/fixtures/solr_documents/public_pmtiles_princeton.json +29 -39
- data/spec/fixtures/solr_documents/public_polygon_mit.json +9 -30
- data/spec/fixtures/solr_documents/restricted-line.json +14 -47
- data/spec/fixtures/solr_documents/the-related-record.json +4 -12
- data/spec/fixtures/solr_documents/tilejson.json +23 -46
- data/spec/fixtures/solr_documents/tms.json +7 -21
- data/spec/fixtures/solr_documents/umn_metro_result1.json +13 -41
- data/spec/fixtures/solr_documents/umn_state_result1.json +13 -39
- data/spec/fixtures/solr_documents/umn_state_result2.json +13 -39
- data/spec/fixtures/solr_documents/uva_slug_colon.json +10 -30
- data/spec/fixtures/solr_documents/wmts-multiple.json +23 -39
- data/spec/fixtures/solr_documents/wmts-single-layer.json +23 -46
- data/spec/fixtures/solr_documents/xyz.json +10 -33
- data/spec/helpers/geoblacklight_helper_spec.rb +5 -50
- data/spec/javascripts/geoblacklight_spec.js +10 -10
- data/spec/javascripts/metadata_download_button_spec.js +14 -13
- data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -1
- data/spec/lib/geoblacklight/configuration/default_settings_builder_spec.rb +9 -0
- data/spec/lib/geoblacklight/configuration_spec.rb +13 -0
- data/spec/lib/geoblacklight/download/csv_download_spec.rb +2 -2
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +2 -2
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +5 -2
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +2 -2
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +2 -2
- data/spec/lib/geoblacklight/download_spec.rb +15 -6
- data/spec/lib/geoblacklight/geometry_spec.rb +1 -1
- data/spec/lib/geoblacklight/item_viewer_spec.rb +2 -2
- data/spec/lib/geoblacklight/metadata/base_spec.rb +1 -1
- data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -1
- data/spec/lib/geoblacklight/metadata_spec.rb +1 -1
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +1 -1
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +1 -1
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +1 -1
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +1 -1
- data/spec/lib/geoblacklight/reference_spec.rb +1 -1
- data/spec/lib/geoblacklight/references_spec.rb +6 -4
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +10 -4
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +9 -4
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +12 -15
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +1 -1
- data/spec/lib/geoblacklight/wms_layer_spec.rb +1 -1
- data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +20 -11
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +1 -1
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -1
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -1
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +4 -39
- data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +2 -2
- data/spec/routing/catalog_routing_spec.rb +1 -1
- data/spec/spec_helper.rb +21 -10
- data/spec/tasks/geoblacklight_spec.rb +1 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +4 -3
- metadata +33 -184
- data/Procfile.dev +0 -3
- data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +0 -2
- data/app/assets/stylesheets/geoblacklight/modules/_base.scss +0 -31
- data/app/assets/stylesheets/geoblacklight/modules/_blacklight_overrides.scss +0 -40
- data/app/assets/stylesheets/geoblacklight/modules/_styles.scss +0 -9
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +0 -62
- data/app/assets/stylesheets/geoblacklight/modules/geosearch.scss +0 -23
- data/app/assets/stylesheets/geoblacklight/modules/home.scss +0 -13
- data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +0 -116
- data/app/assets/stylesheets/geoblacklight/modules/index_maps.scss +0 -61
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +0 -78
- data/app/assets/stylesheets/geoblacklight/modules/layer_opacity.scss +0 -87
- data/app/assets/stylesheets/geoblacklight/modules/leaflet.scss +0 -4
- data/app/assets/stylesheets/geoblacklight/modules/metadata.scss +0 -31
- data/app/assets/stylesheets/geoblacklight/modules/metadata_content.scss +0 -43
- data/app/assets/stylesheets/geoblacklight/modules/metadata_markup.scss +0 -9
- data/app/assets/stylesheets/geoblacklight/modules/metadata_missing.scss +0 -7
- data/app/assets/stylesheets/geoblacklight/modules/modal.scss +0 -5
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +0 -60
- data/app/assets/stylesheets/geoblacklight/modules/search_widgets.scss +0 -5
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +0 -42
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +0 -34
- data/app/assets/stylesheets/geoblacklight/modules/web_services.scss +0 -5
- data/app/components/blacklight/icons/american_geographical_society_library_uwm_libraries_component.rb +0 -46
- data/app/components/blacklight/icons/arizona_component.rb +0 -24
- data/app/components/blacklight/icons/baruch_cuny_component.rb +0 -23
- data/app/components/blacklight/icons/bookmark_component.rb +0 -23
- data/app/components/blacklight/icons/circle_info_solid_component.rb +0 -23
- data/app/components/blacklight/icons/columbia_component.rb +0 -23
- data/app/components/blacklight/icons/cornell_component.rb +0 -25
- data/app/components/blacklight/icons/george_mason_component.rb +0 -24
- data/app/components/blacklight/icons/harvard_component.rb +0 -23
- data/app/components/blacklight/icons/indiana_component.rb +0 -23
- data/app/components/blacklight/icons/lewis_clark_component.rb +0 -25
- data/app/components/blacklight/icons/massgis_component.rb +0 -23
- data/app/components/blacklight/icons/michigan_state_university_component.rb +0 -25
- data/app/components/blacklight/icons/mit_component.rb +0 -23
- data/app/components/blacklight/icons/northwestern_university_component.rb +0 -24
- data/app/components/blacklight/icons/nyu_component.rb +0 -26
- data/app/components/blacklight/icons/pennsylvania_state_university_component.rb +0 -25
- data/app/components/blacklight/icons/princeton_component.rb +0 -23
- data/app/components/blacklight/icons/purdue_university_component.rb +0 -25
- data/app/components/blacklight/icons/rutgers_component.rb +0 -25
- data/app/components/blacklight/icons/sms_component.rb +0 -23
- data/app/components/blacklight/icons/stanford_component.rb +0 -23
- data/app/components/blacklight/icons/texas_component.rb +0 -23
- data/app/components/blacklight/icons/the_ohio_state_university_component.rb +0 -26
- data/app/components/blacklight/icons/tufts_component.rb +0 -23
- data/app/components/blacklight/icons/ucla_component.rb +0 -23
- data/app/components/blacklight/icons/university_of_california_berkeley_component.rb +0 -24
- data/app/components/blacklight/icons/university_of_chicago_component.rb +0 -25
- data/app/components/blacklight/icons/university_of_colorado_boulder_component.rb +0 -26
- data/app/components/blacklight/icons/university_of_illinois_urbana_champaign_component.rb +0 -25
- data/app/components/blacklight/icons/university_of_iowa_component.rb +0 -24
- data/app/components/blacklight/icons/university_of_maryland_component.rb +0 -24
- data/app/components/blacklight/icons/university_of_michigan_component.rb +0 -24
- data/app/components/blacklight/icons/university_of_minnesota_component.rb +0 -24
- data/app/components/blacklight/icons/university_of_nebraska_lincoln_component.rb +0 -27
- data/app/components/blacklight/icons/university_of_wisconsin_madison_component.rb +0 -24
- data/app/components/blacklight/icons/uva_component.rb +0 -23
- data/app/components/geoblacklight/icon_facet_item_component.rb +0 -33
- data/app/components/geoblacklight/web_services_link_component.html.erb +0 -3
- data/bin/vite +0 -29
- data/config/initializers/new_gbl_settings_defaults_4.1.yml +0 -104
- data/lib/generators/geoblacklight/assets/importmap_generator.rb +0 -73
- data/lib/generators/geoblacklight/assets/vite_generator.rb +0 -89
- data/lib/generators/geoblacklight/templates/assets/_customizations.scss +0 -23
- data/lib/generators/geoblacklight/templates/assets/application.js +0 -17
- data/lib/generators/geoblacklight/templates/assets/application.scss +0 -9
- data/lib/generators/geoblacklight/templates/assets/geoblacklight.scss +0 -11
- data/lib/generators/geoblacklight/templates/base.html.erb +0 -46
- data/lib/generators/geoblacklight/templates/vite.config.ts +0 -23
- data/lib/generators/geoblacklight/templates/vite.json +0 -16
- data/schema/geoblacklight-schema-1.0.json +0 -214
- data/solr/conf/xslt/example.xsl +0 -132
- data/solr/conf/xslt/example_atom.xsl +0 -67
- data/solr/conf/xslt/example_rss.xsl +0 -66
- data/solr/conf/xslt/luke.xsl +0 -337
- data/spec/components/blacklight/icons/american_geographical_society_library_uwm_libraries_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/arizona_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/arrow_circle_down_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/baruch_cuny_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/book_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/bookmark_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/cd_rom_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/child_item_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/circle_info_solid_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/citation_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/collection_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/collections_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/columbia_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/cornell_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/datasets_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/dvd_rom_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/email_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/esri_globe_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/fire_solid_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/george_mason_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/globe_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/harvard_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/home_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/iiif_drag_drop_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/image_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/imagery_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/indiana_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/leaf_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/lewis_clark_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/lightbulb_solid_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/line_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/map_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/map_marker_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/maps_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/massgis_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/metadata_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/michigan_state_university_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/mit_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/mixed_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/multilinestring_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/multipoint_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/multipolygon_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/northwestern_university_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/nyu_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/pagelines_brands_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/paper_map_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/parent_item_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/pennsylvania_state_university_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/point_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/polygon_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/polyline_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/princeton_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/public_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/purdue_university_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/raster_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/restricted_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/rutgers_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/sms_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/stanford_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/table_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/tags_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/texas_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/the_ohio_state_university_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/triangle_exclamation_solid_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/tufts_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/ucla_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_california_berkeley_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_chicago_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_colorado_boulder_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_illinois_urbana_champaign_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_iowa_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_maryland_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_michigan_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_minnesota_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_nebraska_lincoln_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/university_of_wisconsin_madison_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/uva_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/web_services_component_spec.rb +0 -15
- data/spec/components/blacklight/icons/websites_component_spec.rb +0 -15
- data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +0 -18
- data/spec/config/initializers/rails_config_spec.rb +0 -16
- data/spec/fixtures/solr_documents/public_direct_download.json +0 -62
- data/spec/support/backport_test_helpers.rb +0 -47
- data/spec/support/view_component_capybara_test_helpers.rb +0 -8
- data/vite.config.ts +0 -32
- /data/app/assets/images/{blacklight → geoblacklight}/logo.svg +0 -0
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { DomUtil, DomEvent, Control } from "leaflet"
|
|
2
|
-
import { getLayerOpacity } from "geoblacklight/leaflet/utils"
|
|
1
|
+
import { DomUtil, DomEvent, Control } from "leaflet"
|
|
2
|
+
import { getLayerOpacity } from "geoblacklight/leaflet/utils"
|
|
3
3
|
|
|
4
4
|
export default class LayerOpacityControl extends Control {
|
|
5
5
|
constructor(layer, options = {}) {
|
|
6
|
-
super(options)
|
|
7
|
-
this.options.position = "topleft"
|
|
6
|
+
super(options)
|
|
7
|
+
this.options.position = "topleft"
|
|
8
8
|
var layers = [layer]
|
|
9
9
|
// Check if layer is actually a layer group
|
|
10
10
|
if (typeof layer.getLayers !== "undefined") {
|
|
11
|
-
layers = layer.getLayers()
|
|
12
|
-
layers = layers && layers[0] instanceof L.Layer ? layers : [layer]
|
|
11
|
+
layers = layer.getLayers()
|
|
12
|
+
layers = layers && layers[0] instanceof L.Layer ? layers : [layer]
|
|
13
13
|
} else {
|
|
14
|
-
this.layersOnLoad = Object.keys(layer).includes(
|
|
14
|
+
this.layersOnLoad = Object.keys(layer).includes("_layers")
|
|
15
15
|
}
|
|
16
|
-
this.options.layer = layers[0]
|
|
17
|
-
this.options.layers = this.layersOnLoad ? [] : layers
|
|
16
|
+
this.options.layer = layers[0]
|
|
17
|
+
this.options.layers = this.layersOnLoad ? [] : layers
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
onAdd(map) {
|
|
21
|
-
const container = DomUtil.create("div", "opacity-control unselectable")
|
|
22
|
-
const controlArea = DomUtil.create("div", "opacity-area", container)
|
|
23
|
-
const handle = DomUtil.create("div", "opacity-handle", container)
|
|
24
|
-
const handleArrowUp = DomUtil.create("div", "opacity-arrow-up", handle)
|
|
25
|
-
const handleText = DomUtil.create("div", "opacity-text", handle)
|
|
26
|
-
const handleArrowDown = DomUtil.create("div", "opacity-arrow-down", handle)
|
|
27
|
-
const bottom = DomUtil.create("div", "opacity-bottom", container)
|
|
21
|
+
const container = DomUtil.create("div", "opacity-control unselectable")
|
|
22
|
+
const controlArea = DomUtil.create("div", "opacity-area", container)
|
|
23
|
+
const handle = DomUtil.create("div", "opacity-handle", container)
|
|
24
|
+
const handleArrowUp = DomUtil.create("div", "opacity-arrow-up", handle)
|
|
25
|
+
const handleText = DomUtil.create("div", "opacity-text", handle)
|
|
26
|
+
const handleArrowDown = DomUtil.create("div", "opacity-arrow-down", handle)
|
|
27
|
+
const bottom = DomUtil.create("div", "opacity-bottom", container)
|
|
28
28
|
|
|
29
|
-
DomEvent.stopPropagation(container)
|
|
30
|
-
DomEvent.disableClickPropagation(container)
|
|
31
|
-
this.setListeners(handle, bottom, handleText, map)
|
|
29
|
+
DomEvent.stopPropagation(container)
|
|
30
|
+
DomEvent.disableClickPropagation(container)
|
|
31
|
+
this.setListeners(handle, bottom, handleText, map)
|
|
32
32
|
|
|
33
|
-
handle.setAttribute("tabindex", "0")
|
|
34
|
-
let opacity =
|
|
35
|
-
const opacityPercentage = parseInt(opacity * 100)
|
|
36
|
-
handle.style.zIndex = 4
|
|
37
|
-
handle.style.top = `calc(100% - ${opacityPercentage}% - 12px)
|
|
38
|
-
handleText.innerHTML = `${opacityPercentage}
|
|
39
|
-
return container
|
|
33
|
+
handle.setAttribute("tabindex", "0")
|
|
34
|
+
let opacity = getLayerOpacity(this.options.layer)
|
|
35
|
+
const opacityPercentage = parseInt(opacity * 100)
|
|
36
|
+
handle.style.zIndex = 4
|
|
37
|
+
handle.style.top = `calc(100% - ${opacityPercentage}% - 12px)`
|
|
38
|
+
handleText.innerHTML = `${opacityPercentage}%`
|
|
39
|
+
return container
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
updateMapOpacity(opacity) {
|
|
@@ -45,10 +45,10 @@ export default class LayerOpacityControl extends Control {
|
|
|
45
45
|
|
|
46
46
|
layerOpacity(layer, opacity) {
|
|
47
47
|
try {
|
|
48
|
-
layer.setStyle({
|
|
48
|
+
layer.setStyle({ fillOpacity: opacity, opacity: opacity })
|
|
49
49
|
} catch {
|
|
50
50
|
try {
|
|
51
|
-
layer.setOpacity(opacity)
|
|
51
|
+
layer.setOpacity(opacity)
|
|
52
52
|
} catch {
|
|
53
53
|
console.error("Couldn't set opacity for layer", layer)
|
|
54
54
|
}
|
|
@@ -56,65 +56,66 @@ export default class LayerOpacityControl extends Control {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
setListeners(handle, bottom, handleText, map) {
|
|
59
|
-
let start = false
|
|
60
|
-
let startTop
|
|
59
|
+
let start = false
|
|
60
|
+
let startTop
|
|
61
61
|
|
|
62
62
|
DomEvent.on(document, "mousemove", (e) => {
|
|
63
|
-
if (!start) return
|
|
64
|
-
const percentInverse =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.updateMapOpacity(1 - percentInverse / 100);
|
|
72
|
-
});
|
|
63
|
+
if (!start) return
|
|
64
|
+
const percentInverse = Math.max(0, Math.min(200, startTop + parseInt(e.clientY, 10) - start)) / 2
|
|
65
|
+
handle.style.top = `${percentInverse * 2 - 13}px`
|
|
66
|
+
handleText.innerHTML = `${Math.round((1 - percentInverse / 100) * 100)}%`
|
|
67
|
+
bottom.style.height = `${Math.max(0, (100 - percentInverse) * 2 - 13)}px`
|
|
68
|
+
bottom.style.top = `${Math.min(200, percentInverse * 2 + 13)}px`
|
|
69
|
+
this.updateMapOpacity(1 - percentInverse / 100)
|
|
70
|
+
})
|
|
73
71
|
|
|
74
72
|
DomEvent.on(handle, "mousedown", (e) => {
|
|
75
|
-
start = parseInt(e.clientY, 10)
|
|
76
|
-
startTop = handle.offsetTop - 12
|
|
77
|
-
return false
|
|
78
|
-
})
|
|
73
|
+
start = parseInt(e.clientY, 10)
|
|
74
|
+
startTop = handle.offsetTop - 12
|
|
75
|
+
return false
|
|
76
|
+
})
|
|
79
77
|
|
|
80
78
|
DomEvent.on(document, "mouseup", () => {
|
|
81
|
-
start = null
|
|
82
|
-
})
|
|
79
|
+
start = null
|
|
80
|
+
})
|
|
83
81
|
|
|
84
|
-
let _this = this
|
|
85
|
-
DomEvent.on(map,
|
|
86
|
-
if (e.layer.options.addToOpacitySlider || (_this.layersOnLoad && e.layer instanceof L.Layer)){
|
|
87
|
-
_this.options.layers.push(e.layer)
|
|
82
|
+
let _this = this
|
|
83
|
+
DomEvent.on(map, "layeradd", function (e) {
|
|
84
|
+
if (e.layer.options.addToOpacitySlider || (_this.layersOnLoad && e.layer instanceof L.Layer)) {
|
|
85
|
+
_this.options.layers.push(e.layer)
|
|
88
86
|
}
|
|
89
|
-
})
|
|
87
|
+
})
|
|
90
88
|
|
|
91
|
-
DomEvent.on(map,
|
|
92
|
-
if (e.layer.options.addToOpacitySlider){
|
|
93
|
-
const index = _this.options.layers.indexOf(e.layer)
|
|
94
|
-
if (index) {
|
|
89
|
+
DomEvent.on(map, "layerremove", function (e) {
|
|
90
|
+
if (e.layer.options.addToOpacitySlider) {
|
|
91
|
+
const index = _this.options.layers.indexOf(e.layer)
|
|
92
|
+
if (index) {
|
|
93
|
+
_this.options.layers.splice(index, 1)
|
|
94
|
+
}
|
|
95
95
|
}
|
|
96
|
-
})
|
|
96
|
+
})
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
newOpacity = opacity * 100 + step;
|
|
98
|
+
DomEvent.on(handle, "keydown", function (e) {
|
|
99
|
+
const opacity = _this.geoJSON ? _this.options.layer.style.fillOpacity : _this.options.layer.options.opacity
|
|
100
|
+
const step = 1
|
|
101
|
+
var newOpacity
|
|
102
|
+
if (e.key == "ArrowDown") {
|
|
103
|
+
newOpacity = opacity * 100 - step
|
|
104
|
+
} else if (e.key == "ArrowUp") {
|
|
105
|
+
newOpacity = opacity * 100 + step
|
|
107
106
|
} else {
|
|
108
|
-
return
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
e.preventDefault()
|
|
110
|
+
if (newOpacity > 100 || newOpacity < 0) {
|
|
111
|
+
return
|
|
109
112
|
}
|
|
110
|
-
e.preventDefault();
|
|
111
|
-
if (newOpacity > 100 || newOpacity < 0) { return; }
|
|
112
113
|
newOpacity = Math.round(newOpacity)
|
|
113
|
-
handle.style.top = `calc(100% - ${newOpacity}% - 12px)
|
|
114
|
-
handleText.innerHTML = newOpacity + "%"
|
|
115
|
-
bottom.style.height = newOpacity + "%"
|
|
116
|
-
bottom.style.top = `calc(100% - ${newOpacity}%)
|
|
114
|
+
handle.style.top = `calc(100% - ${newOpacity}% - 12px)`
|
|
115
|
+
handleText.innerHTML = newOpacity + "%"
|
|
116
|
+
bottom.style.height = newOpacity + "%"
|
|
117
|
+
bottom.style.top = `calc(100% - ${newOpacity}%)`
|
|
117
118
|
_this.updateMapOpacity(newOpacity / 100)
|
|
118
|
-
})
|
|
119
|
+
})
|
|
119
120
|
}
|
|
120
121
|
}
|
|
@@ -1,47 +1,49 @@
|
|
|
1
|
-
import { Control } from "leaflet"
|
|
1
|
+
import { Control } from "leaflet"
|
|
2
2
|
|
|
3
3
|
export default class sidebarControl extends Control {
|
|
4
4
|
constructor(options) {
|
|
5
|
-
const _options = { ...options }
|
|
6
|
-
super(_options)
|
|
5
|
+
const _options = { ...options }
|
|
6
|
+
super(_options)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
onAdd(map) {
|
|
10
|
-
var div = L.DomUtil.create(
|
|
11
|
-
div.setAttribute("tabindex", "0")
|
|
12
|
-
const sidebarContainer = this.options.sidebar
|
|
10
|
+
var div = L.DomUtil.create("div", "leaflet-sidebar")
|
|
11
|
+
div.setAttribute("tabindex", "0")
|
|
12
|
+
const sidebarContainer = this.options.sidebar
|
|
13
13
|
|
|
14
14
|
// Disable zoom when the mouse enters the sidebar
|
|
15
|
-
div.addEventListener(
|
|
16
|
-
map.scrollWheelZoom.disable()
|
|
17
|
-
})
|
|
15
|
+
div.addEventListener("mouseenter", function () {
|
|
16
|
+
map.scrollWheelZoom.disable()
|
|
17
|
+
})
|
|
18
18
|
|
|
19
|
-
div.addEventListener(
|
|
20
|
-
map.touchZoom.disable()
|
|
21
|
-
map.dragging.disable()
|
|
22
|
-
})
|
|
19
|
+
div.addEventListener("touchstart", function () {
|
|
20
|
+
map.touchZoom.disable()
|
|
21
|
+
map.dragging.disable()
|
|
22
|
+
})
|
|
23
23
|
|
|
24
24
|
// without this the map will try to find data about whatever is behind the sidebar
|
|
25
|
-
div.addEventListener(
|
|
26
|
-
event.stopPropagation()
|
|
27
|
-
})
|
|
25
|
+
div.addEventListener("click", function (event) {
|
|
26
|
+
event.stopPropagation()
|
|
27
|
+
})
|
|
28
28
|
|
|
29
29
|
// Enable zoom when the mouse leaves the sidebar
|
|
30
|
-
div.addEventListener(
|
|
31
|
-
map.touchZoom.enable()
|
|
32
|
-
map.dragging.enable()
|
|
33
|
-
})
|
|
30
|
+
div.addEventListener("touchend", function () {
|
|
31
|
+
map.touchZoom.enable()
|
|
32
|
+
map.dragging.enable()
|
|
33
|
+
})
|
|
34
34
|
|
|
35
35
|
// Enable zoom when the mouse leaes the sidebar
|
|
36
|
-
div.addEventListener(
|
|
37
|
-
map.scrollWheelZoom.enable()
|
|
38
|
-
})
|
|
36
|
+
div.addEventListener("mouseleave", function () {
|
|
37
|
+
map.scrollWheelZoom.enable()
|
|
38
|
+
})
|
|
39
39
|
|
|
40
|
-
if (!sidebarContainer) {
|
|
40
|
+
if (!sidebarContainer) {
|
|
41
|
+
return
|
|
42
|
+
}
|
|
41
43
|
// Make sure table height is same as map (with a little padding)
|
|
42
|
-
sidebarContainer.children[0].style.maxHeight = `${map._container.offsetHeight - 30}px
|
|
43
|
-
div.innerHTML = sidebarContainer.innerHTML
|
|
44
|
-
sidebarContainer.remove()
|
|
45
|
-
return div
|
|
44
|
+
sidebarContainer.children[0].style.maxHeight = `${map._container.offsetHeight - 30}px`
|
|
45
|
+
div.innerHTML = sidebarContainer.innerHTML
|
|
46
|
+
sidebarContainer.remove()
|
|
47
|
+
return div
|
|
46
48
|
}
|
|
47
|
-
}
|
|
49
|
+
}
|
|
@@ -1,98 +1,101 @@
|
|
|
1
|
-
import { DomUtil, DomEvent, Handler } from "leaflet"
|
|
1
|
+
import { DomUtil, DomEvent, Handler } from "leaflet"
|
|
2
2
|
|
|
3
3
|
export default class Sleep extends Handler {
|
|
4
4
|
addHooks() {
|
|
5
|
-
const container = DomUtil.create(
|
|
5
|
+
const container = DomUtil.create(
|
|
6
|
+
"div",
|
|
7
|
+
"wake-overlay w-100 h-100 position-absolute align-items-center justify-content-center",
|
|
8
|
+
this._map._container,
|
|
9
|
+
)
|
|
6
10
|
const button = DomUtil.create("button", "btn btn-primary wake-button", container)
|
|
7
11
|
|
|
8
|
-
button.innerHTML = this._map.options.
|
|
9
|
-
button.setAttribute("tabindex", "0")
|
|
10
|
-
button.style.zIndex = 2000
|
|
11
|
-
container.style.zIndex = 1999
|
|
12
|
-
const background = String(this._map.options.
|
|
13
|
-
container.style.background = background
|
|
14
|
-
this.container = container
|
|
15
|
-
if (this._map.options.
|
|
12
|
+
button.innerHTML = this._map.options.message
|
|
13
|
+
button.setAttribute("tabindex", "0")
|
|
14
|
+
button.style.zIndex = 2000
|
|
15
|
+
container.style.zIndex = 1999
|
|
16
|
+
const background = String(this._map.options.background)
|
|
17
|
+
container.style.background = background
|
|
18
|
+
this.container = container
|
|
19
|
+
if (this._map.options.margin_distance) {
|
|
16
20
|
this.updateBasedOnSize()
|
|
17
21
|
} else {
|
|
18
|
-
this.sleepMap()
|
|
22
|
+
this.sleepMap()
|
|
19
23
|
}
|
|
20
24
|
this.setListeners()
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
sleepMap() {
|
|
24
|
-
this._map.dragging.disable()
|
|
25
|
-
this._map.touchZoom.disable()
|
|
26
|
-
this._map.scrollWheelZoom.disable()
|
|
27
|
-
this._map.doubleClickZoom.disable()
|
|
28
|
-
this._map.boxZoom.disable()
|
|
29
|
-
this._map.keyboard.disable()
|
|
30
|
-
this.container.classList.add(
|
|
31
|
-
this.container.classList.remove(
|
|
28
|
+
this._map.dragging.disable()
|
|
29
|
+
this._map.touchZoom.disable()
|
|
30
|
+
this._map.scrollWheelZoom.disable()
|
|
31
|
+
this._map.doubleClickZoom.disable()
|
|
32
|
+
this._map.boxZoom.disable()
|
|
33
|
+
this._map.keyboard.disable()
|
|
34
|
+
this.container.classList.add("d-flex")
|
|
35
|
+
this.container.classList.remove("d-none")
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
wakeMap() {
|
|
35
|
-
this._map.dragging.enable()
|
|
36
|
-
this._map.touchZoom.enable()
|
|
37
|
-
this._map.scrollWheelZoom.enable()
|
|
38
|
-
this._map.doubleClickZoom.enable()
|
|
39
|
-
this._map.boxZoom.enable()
|
|
40
|
-
this._map.keyboard.enable()
|
|
41
|
-
this.container.classList.remove(
|
|
42
|
-
this.container.classList.add(
|
|
39
|
+
this._map.dragging.enable()
|
|
40
|
+
this._map.touchZoom.enable()
|
|
41
|
+
this._map.scrollWheelZoom.enable()
|
|
42
|
+
this._map.doubleClickZoom.enable()
|
|
43
|
+
this._map.boxZoom.enable()
|
|
44
|
+
this._map.keyboard.enable()
|
|
45
|
+
this.container.classList.remove("d-flex")
|
|
46
|
+
this.container.classList.add("d-none")
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
updateBasedOnSize() {
|
|
46
|
-
const rect = this._map._container.getBoundingClientRect()
|
|
50
|
+
const rect = this._map._container.getBoundingClientRect()
|
|
47
51
|
// sometimes the left/right side has larger margin, so we take an average
|
|
48
|
-
const calculation = (
|
|
49
|
-
if (calculation < this._map.options.
|
|
50
|
-
this.sleepMap()
|
|
52
|
+
const calculation = (window.innerWidth - rect.right + rect.left) / 2
|
|
53
|
+
if (calculation < this._map.options.margin_distance) {
|
|
54
|
+
this.sleepMap()
|
|
51
55
|
} else {
|
|
52
|
-
this.wakeMap()
|
|
56
|
+
this.wakeMap()
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
setListeners() {
|
|
57
|
-
const _this = this
|
|
58
|
-
let timer
|
|
59
|
-
let sleeptimer
|
|
61
|
+
const _this = this
|
|
62
|
+
let timer
|
|
63
|
+
let sleeptimer
|
|
60
64
|
|
|
61
|
-
if (_this._map.options.
|
|
65
|
+
if (_this._map.options.margin_distance) {
|
|
62
66
|
window.addEventListener("resize", (event) => {
|
|
63
|
-
_this.updateBasedOnSize()
|
|
67
|
+
_this.updateBasedOnSize()
|
|
64
68
|
})
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
DomEvent.on(_this.container, "click", (e) => {
|
|
68
72
|
_this.wakeMap()
|
|
69
|
-
})
|
|
73
|
+
})
|
|
70
74
|
|
|
71
75
|
DomEvent.on(_this.container, "focus", (e) => {
|
|
72
76
|
_this.wakeMap()
|
|
73
|
-
})
|
|
77
|
+
})
|
|
74
78
|
|
|
75
|
-
if (this._map.options.
|
|
79
|
+
if (this._map.options.hovertowake) {
|
|
76
80
|
DomEvent.on(this._map._container, "mouseenter", (e) => {
|
|
77
|
-
clearTimeout(sleeptimer)
|
|
81
|
+
clearTimeout(sleeptimer)
|
|
78
82
|
|
|
79
|
-
timer = setTimeout(function() {
|
|
83
|
+
timer = setTimeout(function () {
|
|
80
84
|
_this.wakeMap()
|
|
81
|
-
}, _this._map.options.
|
|
82
|
-
|
|
83
|
-
});
|
|
85
|
+
}, _this._map.options.waketime)
|
|
86
|
+
})
|
|
84
87
|
|
|
85
88
|
DomEvent.on(this._map._container, "mouseleave", (e) => {
|
|
86
|
-
clearTimeout(timer)
|
|
87
|
-
|
|
88
|
-
sleeptimer = setTimeout(function() {
|
|
89
|
+
clearTimeout(timer)
|
|
90
|
+
|
|
91
|
+
sleeptimer = setTimeout(function () {
|
|
89
92
|
_this.sleepMap()
|
|
90
|
-
}, _this._map.options.
|
|
91
|
-
})
|
|
93
|
+
}, _this._map.options.sleeptime)
|
|
94
|
+
})
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
DomEvent.on(this.container, "touchstart", (e) => {
|
|
95
98
|
_this.wakeMap()
|
|
96
|
-
})
|
|
99
|
+
})
|
|
97
100
|
}
|
|
98
101
|
}
|