geoblacklight 4.2.0 → 4.4.0.rc1

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/.gitignore +1 -0
  4. data/app/assets/images/blacklight/geoblacklight-icons.json +558 -279
  5. data/app/assets/images/blacklight/northwestern-university.svg +5 -0
  6. data/app/javascript/index.js +7 -0
  7. data/app/{frontend → javascript}/openlayers/ol_initializer.js +1 -1
  8. data/app/javascript/stylesheets/openlayers.css +1 -0
  9. data/config/locales/geoblacklight.en.yml +2 -1
  10. data/geoblacklight.gemspec +1 -1
  11. data/lib/generators/geoblacklight/install_generator.rb +21 -2
  12. data/{app/frontend/entrypoints → lib/generators/geoblacklight/templates}/clover.js +1 -1
  13. data/lib/generators/geoblacklight/templates/ol.js +6 -0
  14. data/lib/generators/geoblacklight/templates/package-test.json +10 -0
  15. data/lib/generators/geoblacklight/templates/package.json +10 -0
  16. data/lib/generators/geoblacklight/templates/vite.config.ts +8 -0
  17. data/lib/generators/geoblacklight/templates/vite.json +1 -1
  18. data/lib/geoblacklight/engine.rb +0 -24
  19. data/lib/geoblacklight/version.rb +1 -1
  20. data/package.json +25 -5
  21. data/spec/features/full_screen_controll_spec.rb +1 -1
  22. data/spec/test_app_templates/lib/generators/test_app_generator.rb +21 -1
  23. data/vite.config.ts +20 -4
  24. metadata +16 -14
  25. data/app/frontend/entrypoints/application.js +0 -28
  26. data/app/frontend/entrypoints/ol.js +0 -5
  27. data/app/frontend/stylesheets/openlayers.css +0 -1
  28. data/app/helpers/geoblacklight/application_helper.rb +0 -8
  29. data/config/vite.json +0 -14
  30. /data/app/{frontend → javascript}/clover/clover_initializer.js +0 -0
  31. /data/app/{frontend → javascript}/openlayers/basemaps.js +0 -0
@@ -0,0 +1,5 @@
1
+ <!-- Generated by IcoMoon.io -->
2
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="33" height="32" viewBox="0 0 33 32">
3
+ <title>northwestern-university</title>
4
+ <path fill="#6c757d" d="M21.118 0.238v2.258l3.79 0.953 0.749 0.93v18.088l-18.984-22.468h-5.583v1.691l3.087 3.472v23.455l-4.176 1.169v1.974h11.972v-1.986l-3.711-0.987-0.76-0.942v-18.86l19.325 23.013h2.235v-28.437l4.199-1.271v-2.054z"></path>
5
+ </svg>
@@ -0,0 +1,7 @@
1
+ import OlInitializer from './openlayers/ol_initializer'
2
+ import CloverInitializer from './clover/clover_initializer'
3
+
4
+ export {
5
+ OlInitializer,
6
+ CloverInitializer
7
+ }
@@ -1,4 +1,4 @@
1
- import '@/stylesheets/openlayers.css'
1
+ import '../stylesheets/openlayers.css'
2
2
  import { Map, View } from 'ol'
3
3
  import TileLayer from 'ol/layer/Tile'
4
4
  import VectorTile from 'ol/layer/VectorTile'
@@ -0,0 +1 @@
1
+ @import "../../../node_modules/ol/ol.css";
@@ -166,7 +166,8 @@ en:
166
166
  multilinestring: Multi-line string
167
167
  multipoint: Multi-point
168
168
  multipolygon: Multi-polygon
169
- nebraska: University of Nebraska
169
+ nebraska: University of Nebraska-Lincoln
170
+ northwestern-university: Northwestern University
170
171
  nyu: New York University
171
172
  ohio-state: The Ohio State University
172
173
  penn-state: Penn State University
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "faraday", "~> 2.0"
24
24
  spec.add_dependency "coderay"
25
25
  spec.add_dependency "deprecation"
26
- spec.add_dependency "geo_combine", "~> 0.8"
26
+ spec.add_dependency "geo_combine", "~> 0.9"
27
27
  spec.add_dependency "mime-types"
28
28
  spec.add_dependency "handlebars_assets"
29
29
  spec.add_dependency "rgeo-geojson"
@@ -5,9 +5,10 @@ require "rails/generators"
5
5
  module Geoblacklight
6
6
  class Install < Rails::Generators::Base
7
7
  source_root File.expand_path("../templates", __FILE__)
8
-
9
8
  desc "Install Geoblacklight"
10
9
 
10
+ class_option :test, type: :boolean, default: false, aliases: "-t", desc: "Indicates that app will be installed in a test environment"
11
+
11
12
  def allow_geoblacklight_params
12
13
  gbl_params = <<-PARAMS
13
14
  before_action :allow_geoblacklight_params
@@ -116,9 +117,21 @@ module Geoblacklight
116
117
  copy_file "base.html.erb", "app/views/layouts/blacklight/base.html.erb"
117
118
  end
118
119
 
119
- # Vite - Copy config file
120
+ def copy_package_json
121
+ if options[:test]
122
+ # If building engine cart test app, use specific package.json so the
123
+ # locally built frontend javascript is used instead of the npm package.
124
+ copy_file "package-test.json", "package.json"
125
+ else
126
+ copy_file "package.json", "package.json"
127
+ end
128
+ end
129
+
130
+ # Vite - Config files
120
131
  def copy_config_vite_json
121
132
  copy_file "vite.json", "config/vite.json"
133
+ copy_file "vite.config.ts", "vite.config.ts"
134
+ run "yarn install"
122
135
  end
123
136
 
124
137
  # Run bundle with vite install
@@ -128,5 +141,11 @@ module Geoblacklight
128
141
  run "bundle exec vite install"
129
142
  end
130
143
  end
144
+
145
+ # Vite - Copy over the Vite entrypoints
146
+ def copy_vite_entrypoints
147
+ copy_file "clover.js", "app/javascript/entrypoints/clover.js"
148
+ copy_file "ol.js", "app/javascript/entrypoints/ol.js"
149
+ end
131
150
  end
132
151
  end
@@ -1,4 +1,4 @@
1
- import CloverInitializer from '@/clover/clover_initializer'
1
+ import { CloverInitializer } from '@geoblacklight/frontend'
2
2
 
3
3
  document.addEventListener('DOMContentLoaded', () => {
4
4
  new CloverInitializer().run()
@@ -0,0 +1,6 @@
1
+ import '@geoblacklight/frontend/dist/style.css'
2
+ import { OlInitializer } from '@geoblacklight/frontend'
3
+
4
+ document.addEventListener('DOMContentLoaded', () => {
5
+ new OlInitializer().run()
6
+ })
@@ -0,0 +1,10 @@
1
+ {
2
+ "devDependencies": {
3
+ "vite": "^5.1.5",
4
+ "vite-plugin-ruby": "^5.0.0",
5
+ "vite-plugin-rails": "^0.5.0"
6
+ },
7
+ "scripts": {
8
+ "postinstall": "yarn link @geoblacklight/frontend"
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "dependencies": {
3
+ "@geoblacklight/frontend": "^4.4"
4
+ },
5
+ "devDependencies": {
6
+ "vite": "^5.1.5",
7
+ "vite-plugin-ruby": "^5.0.0",
8
+ "vite-plugin-rails": "^0.5.0"
9
+ }
10
+ }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vite'
2
+ import rails from 'vite-plugin-rails'
3
+
4
+ export default defineConfig({
5
+ plugins: [
6
+ rails(),
7
+ ]
8
+ })
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "all": {
3
- "sourceCodeDir": "app/frontend",
3
+ "sourceCodeDir": "app/javascript",
4
4
  "watchAdditionalPaths": []
5
5
  },
6
6
  "development": {
@@ -8,33 +8,9 @@ require "geoblacklight/version"
8
8
  require "nokogiri"
9
9
  require "mime/types"
10
10
  require "handlebars_assets"
11
- require "vite_ruby"
12
11
 
13
12
  module Geoblacklight
14
13
  class Engine < ::Rails::Engine
15
- delegate :vite_ruby, to: :class
16
-
17
- def self.vite_ruby
18
- @vite_ruby ||= ViteRuby.new(root: root)
19
- end
20
-
21
- # Expose compiled assets via Rack::Static when running in the host app.
22
- config.app_middleware.use(Rack::Static,
23
- urls: ["/#{vite_ruby.config.public_output_dir}"],
24
- root: root.join(vite_ruby.config.public_dir))
25
-
26
- initializer "vite_rails_engine.proxy" do |app|
27
- if vite_ruby.run_proxy?
28
- app.middleware.insert_before 0, ViteRuby::DevServerProxy, ssl_verify_none: true, vite_ruby: vite_ruby
29
- end
30
- end
31
-
32
- initializer "vite_rails_engine.logger" do
33
- config.after_initialize do
34
- vite_ruby.logger = Rails.logger
35
- end
36
- end
37
-
38
14
  # GeoblacklightHelper is needed by all helpers, so we inject it
39
15
  # into action view base here.
40
16
  initializer "geoblacklight.helpers" do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geoblacklight
4
- VERSION = "4.2.0"
4
+ VERSION = "4.4.0.rc1"
5
5
  end
data/package.json CHANGED
@@ -1,8 +1,29 @@
1
1
  {
2
- "name": "geoblacklight",
3
- "version": "4.0.0",
4
- "private": true,
2
+ "name": "@geoblacklight/frontend",
3
+ "type": "module",
4
+ "version": "4.4.6",
5
5
  "license": "Apache-2.0",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "build": "vite build",
12
+ "watch": "vite build --watch"
13
+ },
14
+ "files": ["dist"],
15
+ "main": "./dist/frontend.js",
16
+ "module": "./dist/frontend.umd.cjs",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/frontend.js",
20
+ "require": "./dist/frontend.umd.cjs"
21
+ },
22
+ "./dist/style.css": {
23
+ "import": "./dist/style.css",
24
+ "require": "./dist/style.css"
25
+ }
26
+ },
6
27
  "dependencies": {
7
28
  "@samvera/clover-iiif": "^2.3.2",
8
29
  "ol": "8.1.0",
@@ -10,7 +31,6 @@
10
31
  "react": "^18.2.0"
11
32
  },
12
33
  "devDependencies": {
13
- "vite": "^5.0.0",
14
- "vite-plugin-ruby": "^5.0.0"
34
+ "vite": "^5.0.0"
15
35
  }
16
36
  }
@@ -17,6 +17,6 @@ end
17
17
  feature "Clover IIIF fullscreen control", js: true do
18
18
  scenario "IIIF layer should have full screen control" do
19
19
  visit solr_document_path("princeton-sx61dn82p")
20
- expect(page).to have_css("#fullPage")
20
+ expect(page).to have_button("Toggle full page")
21
21
  end
22
22
  end
@@ -7,19 +7,39 @@ class TestAppGenerator < Rails::Generators::Base
7
7
 
8
8
  def add_gems
9
9
  gem "blacklight"
10
+
11
+ # In CI, Javascript and Webpacker are removed when generating Rails 6.x
12
+ # applications to enable Vite. Disabling javascript during test app
13
+ # generation removes Turbolinks. This gem is required and needs to be
14
+ # re-added.
15
+ if ENV["RAILS_VERSION"] && Gem::Version.new(ENV["RAILS_VERSION"]) < Gem::Version.new("7.0")
16
+ gem "turbolinks"
17
+ end
18
+
10
19
  Bundler.with_clean_env do
11
20
  run "bundle install"
12
21
  end
13
22
  end
14
23
 
24
+ def build_frontend
25
+ run "yarn install && yarn build"
26
+ end
27
+
28
+ # Ensure local frontend build is linked so internal test app
29
+ # can use local javascript instead of npm package.
30
+ def link_frontend
31
+ run "yarn link"
32
+ end
33
+
15
34
  def run_blacklight_generator
16
35
  say_status("warning", "GENERATING BL", :yellow)
17
36
 
18
37
  generate "blacklight:install", "--devise"
19
38
  end
20
39
 
40
+ # Install geoblacklight with the `test` option
21
41
  def install_engine
22
- generate "geoblacklight:install", "-f"
42
+ generate "geoblacklight:install", "-f --test"
23
43
  end
24
44
 
25
45
  # Symlink fixture document directories so the test app doesn't have to be
data/vite.config.ts CHANGED
@@ -1,8 +1,24 @@
1
+ import { resolve } from 'path'
1
2
  import { defineConfig } from 'vite'
2
- import RubyPlugin from 'vite-plugin-ruby'
3
+ import { exec } from 'child_process'
3
4
 
4
5
  export default defineConfig({
5
- plugins: [
6
- RubyPlugin(),
7
- ],
6
+ build: {
7
+ manifest: true,
8
+ minify: true,
9
+ reportCompressedSize: true,
10
+ lib: {
11
+ entry: resolve(__dirname, 'app/javascript/index.js'),
12
+ name: '@geoblacklight/frontend',
13
+ fileName: 'frontend'
14
+ }
15
+ },
16
+ "plugins": [
17
+ {
18
+ name: 'clobber internal test app vite files and cache',
19
+ buildEnd: async() => {
20
+ exec("cd .internal_test_app && bundle exec vite clobber")
21
+ }
22
+ }
23
+ ]
8
24
  })
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.4.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-02-09 00:00:00.000000000 Z
14
+ date: 2024-04-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -109,14 +109,14 @@ dependencies:
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '0.8'
112
+ version: '0.9'
113
113
  type: :runtime
114
114
  prerelease: false
115
115
  version_requirements: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - "~>"
118
118
  - !ruby/object:Gem::Version
119
- version: '0.8'
119
+ version: '0.9'
120
120
  - !ruby/object:Gem::Dependency
121
121
  name: mime-types
122
122
  requirement: !ruby/object:Gem::Requirement
@@ -435,6 +435,7 @@ files:
435
435
  - app/assets/images/blacklight/multipoint.svg
436
436
  - app/assets/images/blacklight/multipolygon.svg
437
437
  - app/assets/images/blacklight/nebraska.svg
438
+ - app/assets/images/blacklight/northwestern-university.svg
438
439
  - app/assets/images/blacklight/nyu.svg
439
440
  - app/assets/images/blacklight/ohio-state.svg
440
441
  - app/assets/images/blacklight/pagelines-brands.svg
@@ -549,19 +550,16 @@ files:
549
550
  - app/controllers/download_controller.rb
550
551
  - app/controllers/relation_controller.rb
551
552
  - app/controllers/wms_controller.rb
552
- - app/frontend/clover/clover_initializer.js
553
- - app/frontend/entrypoints/application.js
554
- - app/frontend/entrypoints/clover.js
555
- - app/frontend/entrypoints/ol.js
556
- - app/frontend/openlayers/basemaps.js
557
- - app/frontend/openlayers/ol_initializer.js
558
- - app/frontend/stylesheets/openlayers.css
559
553
  - app/helpers/arcgis_helper.rb
560
554
  - app/helpers/blacklight_helper.rb
561
555
  - app/helpers/carto_helper.rb
562
- - app/helpers/geoblacklight/application_helper.rb
563
556
  - app/helpers/geoblacklight/geoblacklight_helper_behavior.rb
564
557
  - app/helpers/geoblacklight_helper.rb
558
+ - app/javascript/clover/clover_initializer.js
559
+ - app/javascript/index.js
560
+ - app/javascript/openlayers/basemaps.js
561
+ - app/javascript/openlayers/ol_initializer.js
562
+ - app/javascript/stylesheets/openlayers.css
565
563
  - app/models/concerns/geoblacklight/bbox_filter_field.rb
566
564
  - app/models/concerns/geoblacklight/bbox_filter_query.rb
567
565
  - app/models/concerns/geoblacklight/solr_document.rb
@@ -614,7 +612,6 @@ files:
614
612
  - config/initializers/new_gbl_settings_defaults_4.1.yml
615
613
  - config/initializers/rails_config.rb
616
614
  - config/locales/geoblacklight.en.yml
617
- - config/vite.json
618
615
  - geoblacklight.gemspec
619
616
  - jest.config.js
620
617
  - lib/generators/geoblacklight/assets_generator.rb
@@ -626,8 +623,13 @@ files:
626
623
  - lib/generators/geoblacklight/templates/assets/geoblacklight.js
627
624
  - lib/generators/geoblacklight/templates/base.html.erb
628
625
  - lib/generators/geoblacklight/templates/catalog_controller.rb
626
+ - lib/generators/geoblacklight/templates/clover.js
627
+ - lib/generators/geoblacklight/templates/ol.js
628
+ - lib/generators/geoblacklight/templates/package-test.json
629
+ - lib/generators/geoblacklight/templates/package.json
629
630
  - lib/generators/geoblacklight/templates/settings.gbl_v1.yml
630
631
  - lib/generators/geoblacklight/templates/settings.yml
632
+ - lib/generators/geoblacklight/templates/vite.config.ts
631
633
  - lib/generators/geoblacklight/templates/vite.json
632
634
  - lib/geoblacklight.rb
633
635
  - lib/geoblacklight/bounding_box.rb
@@ -905,7 +907,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
905
907
  - !ruby/object:Gem::Version
906
908
  version: 2.5.2
907
909
  requirements: []
908
- rubygems_version: 3.4.21
910
+ rubygems_version: 3.4.10
909
911
  signing_key:
910
912
  specification_version: 4
911
913
  summary: A discovery platform for geospatial holdings
@@ -1,28 +0,0 @@
1
- // To see this message, add the following to the `<head>` section in your
2
- // views/layouts/application.html.erb
3
- //
4
- // <%= vite_client_tag %>
5
- // <%= vite_javascript_tag 'application' %>
6
- console.log('Vite ⚡️ Rails')
7
-
8
- // If using a TypeScript entrypoint file:
9
- // <%= vite_typescript_tag 'application' %>
10
- //
11
- // If you want to use .jsx or .tsx, add the extension:
12
- // <%= vite_javascript_tag 'application.jsx' %>
13
-
14
- console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify.app/guide/rails')
15
-
16
- // Example: Load Rails libraries in Vite.
17
- //
18
- // import * as Turbo from '@hotwired/turbo'
19
- // Turbo.start()
20
- //
21
- // import ActiveStorage from '@rails/activestorage'
22
- // ActiveStorage.start()
23
- //
24
- // // Import all channels.
25
- // const channels = import.meta.globEager('./**/*_channel.js')
26
-
27
- // Example: Import a stylesheet in app/frontend/index.css
28
- // import '~/index.css'
@@ -1,5 +0,0 @@
1
- import OlInitializer from '@/openlayers/ol_initializer'
2
-
3
- document.addEventListener('DOMContentLoaded', () => {
4
- new OlInitializer().run()
5
- })
@@ -1 +0,0 @@
1
- @import "node_modules/ol/ol.css";
@@ -1,8 +0,0 @@
1
- module Geoblacklight
2
- module ApplicationHelper
3
- # Override: Returns the engine assets manifest.
4
- def vite_manifest
5
- Geoblacklight::Engine.vite_ruby.manifest
6
- end
7
- end
8
- end
data/config/vite.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "all": {
3
- "sourceCodeDir": "app/frontend",
4
- "publicOutputDir": "geoblacklight-vite",
5
- "watchAdditionalPaths": []
6
- },
7
- "development": {
8
- "autoBuild": true,
9
- "port": 3037
10
- },
11
- "test": {
12
- "autoBuild": true
13
- }
14
- }