blacklight-oembed 1.3.0 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca622e6493231613d2e1e8709cd59bdd5b092102e8add584aa8729cc62dafd92
4
- data.tar.gz: 71350e1b92d7bda34dbd15a9da041c6320d1fe722920e29d72517f3e58774fc5
3
+ metadata.gz: 9dd1000e07ba6fd737d35bc9523688050ac88f02c17d9b11d843f5fd26537413
4
+ data.tar.gz: 222e686b52915f68c6aa471b658ec23dffcfb186abe6cf266ec65ee4210e1d42
5
5
  SHA512:
6
- metadata.gz: e275f3324443f7120656aba199c6da9ee87d175ac00248122a3b75938a1152a22cdc371c30e31fc38f1ab548c376d17b795d5dc62c2ee73065937a23fe460d4a
7
- data.tar.gz: 6b5d7d3b20aaa33894e1e30830032e25565e78004af528e09f6ee7ba60f0652a255e7d60125840f79354563a79b13d865755ce8980a96f7beedad136669c2c9d
6
+ metadata.gz: 82ba4038c2ed1082fb19582a874b311924b0b85ab4127cee0667e89134d3636221889e1670a3b104af045992cf9fb1e115aab179ae01f31d3469e08ce637993c
7
+ data.tar.gz: 37bb62f22038526d2fcba2d88a800527a63b4df6db432cab1e66bea0bb5d53d2624a13acbcad92a82f0ddfa62b23f1746913353c0821febda524de9a737c3f58
@@ -2,9 +2,9 @@ name: CI
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ main ]
5
+ branches: [main]
6
6
  pull_request:
7
- branches: [ main ]
7
+ branches: [main]
8
8
 
9
9
  jobs:
10
10
  test:
@@ -12,32 +12,34 @@ jobs:
12
12
  name: test (ruby ${{ matrix.ruby }} / rails ${{ matrix.rails_version }} / blacklight ${{ matrix.blacklight_version }} ${{ matrix.additional_name }})
13
13
  strategy:
14
14
  matrix:
15
- ruby: ['3.3']
16
- rails_version: ['7.1.4', '7.2.1']
17
- blacklight_version: ['~> 7.0']
18
- additional_name: ['']
19
- legacy_config: ['']
15
+ ruby: ["3.3"]
16
+ rails_version: ["7.1.5.1", "7.2.2.1", "8.0.1"]
17
+ blacklight_version: ["~> 8.0"]
18
+ additional_engine_cart_rails_options: ["--css bootstrap"]
19
+ additional_name: [""]
20
+ legacy_config: [""]
20
21
  include:
21
- - ruby: '3.3'
22
- rails_version: '7.2.1'
23
- blacklight_version: '~> 8.0'
24
- additional_name: ''
25
- - ruby: '3.3'
26
- rails_version: '7.2.1'
27
- blacklight_version: '~> 8.0'
28
- additional_name: 'with legacy partial config'
29
- legacy_config: 'true'
22
+ - ruby: "3.3"
23
+ rails_version: "7.2.2.1"
24
+ blacklight_version: "~> 7.0"
25
+ additional_name: ""
26
+ - ruby: "3.3"
27
+ rails_version: "7.2.2.1"
28
+ blacklight_version: "~> 8.0"
29
+ additional_name: "with legacy partial config"
30
+ legacy_config: "true"
30
31
  env:
31
32
  RAILS_VERSION: ${{ matrix.rails_version }}
32
33
  BLACKLIGHT_VERSION: ${{ matrix.blacklight_version }}
33
34
  CI_TEST_LEGACY_CONFIGURATION: ${{ matrix.legacy_config }}
35
+ ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test ${{ matrix.additional_engine_cart_rails_options }}"
34
36
  steps:
35
- - uses: actions/checkout@v2
36
- - name: Set up Ruby ${{ matrix.ruby }}
37
- uses: ruby/setup-ruby@v1
38
- with:
39
- ruby-version: ${{ matrix.ruby }}
40
- - name: Install dependencies with Rails ${{ matrix.rails_version }}
41
- run: bundle install
42
- - name: Run tests
43
- run: bundle exec rake
37
+ - uses: actions/checkout@v2
38
+ - name: Set up Ruby ${{ matrix.ruby }}
39
+ uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: ${{ matrix.ruby }}
42
+ - name: Install dependencies with Rails ${{ matrix.rails_version }}
43
+ run: bundle install
44
+ - name: Run tests
45
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -16,3 +16,6 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .internal_test_app
19
+
20
+ node_modules
21
+ package-lock.json
@@ -0,0 +1 @@
1
+ //= link_tree ../../javascript .js
@@ -0,0 +1,34 @@
1
+ function oEmbed(elements) {
2
+ if (!elements) return;
3
+
4
+ // Ensure elements is an array-like collection
5
+ elements = elements instanceof NodeList ? Array.from(elements) : [elements];
6
+
7
+ elements.forEach(function(embedViewer) {
8
+ const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute
9
+
10
+ if (!embedURL) return;
11
+
12
+ // Fetch JSON data from the embed URL
13
+ fetch(embedURL)
14
+ .then(response => {
15
+ if (!response.ok) {
16
+ throw new Error('Network response was not ok');
17
+ }
18
+ return response.json();
19
+ })
20
+ .then(data => {
21
+ if (data === null) {
22
+ return;
23
+ }
24
+ // Set the inner HTML of the element
25
+ embedViewer.innerHTML = data.html;
26
+ })
27
+ .catch(error => {
28
+ console.error('Error fetching embed data:', error);
29
+ });
30
+ });
31
+ }
32
+
33
+ export { oEmbed as default };
34
+ //# sourceMappingURL=oembed.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oembed.esm.js","sources":["../../../javascript/blacklight-oembed/oembed.js"],"sourcesContent":["export default function oEmbed(elements) {\n if (!elements) return;\n\n // Ensure elements is an array-like collection\n elements = elements instanceof NodeList ? Array.from(elements) : [elements];\n\n elements.forEach(function(embedViewer) {\n const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute\n\n if (!embedURL) return;\n\n // Fetch JSON data from the embed URL\n fetch(embedURL)\n .then(response => {\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n return response.json();\n })\n .then(data => {\n if (data === null) {\n return;\n }\n // Set the inner HTML of the element\n embedViewer.innerHTML = data.html;\n })\n .catch(error => {\n console.error('Error fetching embed data:', error);\n });\n });\n}\n"],"names":[],"mappings":"AAAe,SAAS,MAAM,CAAC,QAAQ,EAAE;AACzC,EAAE,IAAI,CAAC,QAAQ,EAAE;;AAEjB;AACA,EAAE,QAAQ,GAAG,QAAQ,YAAY,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;;AAE7E,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,WAAW,EAAE;AACzC,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAElD,IAAI,IAAI,CAAC,QAAQ,EAAE;;AAEnB;AACA,IAAI,KAAK,CAAC,QAAQ;AAClB,OAAO,IAAI,CAAC,QAAQ,IAAI;AACxB,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;AAC1B,UAAU,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC;AACxD;AACA,QAAQ,OAAO,QAAQ,CAAC,IAAI,EAAE;AAC9B,OAAO;AACP,OAAO,IAAI,CAAC,IAAI,IAAI;AACpB,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;AAC3B,UAAU;AACV;AACA;AACA,QAAQ,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI;AACzC,OAAO;AACP,OAAO,KAAK,CAAC,KAAK,IAAI;AACtB,QAAQ,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC;AAC1D,OAAO,CAAC;AACR,GAAG,CAAC;AACJ;;;;"}
@@ -1,31 +1,42 @@
1
- export default function oEmbed(elements) {
2
- if (!elements) return;
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.oembed = factory());
5
+ })(this, (function () { 'use strict';
3
6
 
4
- // Ensure elements is an array-like collection
5
- elements = elements instanceof NodeList ? Array.from(elements) : [elements];
7
+ function oEmbed(elements) {
8
+ if (!elements) return;
6
9
 
7
- elements.forEach(function(embedViewer) {
8
- const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute
10
+ // Ensure elements is an array-like collection
11
+ elements = elements instanceof NodeList ? Array.from(elements) : [elements];
9
12
 
10
- if (!embedURL) return;
13
+ elements.forEach(function(embedViewer) {
14
+ const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute
11
15
 
12
- // Fetch JSON data from the embed URL
13
- fetch(embedURL)
14
- .then(response => {
15
- if (!response.ok) {
16
- throw new Error('Network response was not ok');
17
- }
18
- return response.json();
19
- })
20
- .then(data => {
21
- if (data === null) {
22
- return;
23
- }
24
- // Set the inner HTML of the element
25
- embedViewer.innerHTML = data.html;
26
- })
27
- .catch(error => {
28
- console.error('Error fetching embed data:', error);
29
- });
30
- });
31
- }
16
+ if (!embedURL) return;
17
+
18
+ // Fetch JSON data from the embed URL
19
+ fetch(embedURL)
20
+ .then(response => {
21
+ if (!response.ok) {
22
+ throw new Error('Network response was not ok');
23
+ }
24
+ return response.json();
25
+ })
26
+ .then(data => {
27
+ if (data === null) {
28
+ return;
29
+ }
30
+ // Set the inner HTML of the element
31
+ embedViewer.innerHTML = data.html;
32
+ })
33
+ .catch(error => {
34
+ console.error('Error fetching embed data:', error);
35
+ });
36
+ });
37
+ }
38
+
39
+ return oEmbed;
40
+
41
+ }));
42
+ //# sourceMappingURL=oembed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oembed.js","sources":["../../../javascript/blacklight-oembed/oembed.js"],"sourcesContent":["export default function oEmbed(elements) {\n if (!elements) return;\n\n // Ensure elements is an array-like collection\n elements = elements instanceof NodeList ? Array.from(elements) : [elements];\n\n elements.forEach(function(embedViewer) {\n const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute\n\n if (!embedURL) return;\n\n // Fetch JSON data from the embed URL\n fetch(embedURL)\n .then(response => {\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n return response.json();\n })\n .then(data => {\n if (data === null) {\n return;\n }\n // Set the inner HTML of the element\n embedViewer.innerHTML = data.html;\n })\n .catch(error => {\n console.error('Error fetching embed data:', error);\n });\n });\n}\n"],"names":[],"mappings":";;;;;;EAAe,SAAS,MAAM,CAAC,QAAQ,EAAE;EACzC,EAAE,IAAI,CAAC,QAAQ,EAAE;;EAEjB;EACA,EAAE,QAAQ,GAAG,QAAQ,YAAY,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;;EAE7E,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,WAAW,EAAE;EACzC,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;;EAElD,IAAI,IAAI,CAAC,QAAQ,EAAE;;EAEnB;EACA,IAAI,KAAK,CAAC,QAAQ;EAClB,OAAO,IAAI,CAAC,QAAQ,IAAI;EACxB,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;EAC1B,UAAU,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC;EACxD;EACA,QAAQ,OAAO,QAAQ,CAAC,IAAI,EAAE;EAC9B,OAAO;EACP,OAAO,IAAI,CAAC,IAAI,IAAI;EACpB,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;EAC3B,UAAU;EACV;EACA;EACA,QAAQ,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI;EACzC,OAAO;EACP,OAAO,KAAK,CAAC,KAAK,IAAI;EACtB,QAAQ,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC;EAC1D,OAAO,CAAC;EACR,GAAG,CAAC;EACJ;;;;;;;;"}
@@ -0,0 +1,31 @@
1
+ export default function oEmbed(elements) {
2
+ if (!elements) return;
3
+
4
+ // Ensure elements is an array-like collection
5
+ elements = elements instanceof NodeList ? Array.from(elements) : [elements];
6
+
7
+ elements.forEach(function(embedViewer) {
8
+ const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute
9
+
10
+ if (!embedURL) return;
11
+
12
+ // Fetch JSON data from the embed URL
13
+ fetch(embedURL)
14
+ .then(response => {
15
+ if (!response.ok) {
16
+ throw new Error('Network response was not ok');
17
+ }
18
+ return response.json();
19
+ })
20
+ .then(data => {
21
+ if (data === null) {
22
+ return;
23
+ }
24
+ // Set the inner HTML of the element
25
+ embedViewer.innerHTML = data.html;
26
+ })
27
+ .catch(error => {
28
+ console.error('Error fetching embed data:', error);
29
+ });
30
+ });
31
+ }
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ pin_all_from File.expand_path("../app/javascript/blacklight-oembed", __dir__), under: "blacklight-oembed"
@@ -10,6 +10,11 @@ module Blacklight
10
10
  # Allows an adopter to pass additional parameters through to an OEmbed
11
11
  # service. Examples of this could include `:canvas_index`, or `:max_width`
12
12
  config.additional_params = []
13
+
14
+ initializer 'blacklight_oembed.importmap', before: 'importmap' do |app|
15
+ app.config.assets.paths << Engine.root.join("app/javascript")
16
+ app.config.importmap.paths << Engine.root.join('config/importmap.rb') if app.config.respond_to?(:importmap)
17
+ end
13
18
  end
14
19
  end
15
20
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Oembed
3
- VERSION = '1.3.0'
3
+ VERSION = '1.4.1'
4
4
  end
5
5
  end
@@ -18,6 +18,10 @@ module BlacklightOembed
18
18
  copy_file "oembed_providers.rb", "config/initializers/oembed_providers.rb"
19
19
  end
20
20
 
21
+ def appease_sprockets4
22
+ append_to_file 'app/assets/config/manifest.js', "\n//= link blacklight-oembed/oembed.js"
23
+ end
24
+
21
25
  def configuration
22
26
  inject_into_file 'app/controllers/catalog_controller.rb', after: 'configure_blacklight do |config|' do
23
27
  if ENV['CI_TEST_LEGACY_CONFIGURATION'].present? || Gem::Version.new(Blacklight::VERSION) < Gem::Version.new('8.0')
data/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "blacklight-oembed",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "Oembed behavior for Blacklight",
5
5
  "main": "app/assets/javascripts/blacklight_oembed/oembed.js",
6
+ "type": "module",
6
7
  "files": [
7
8
  "app/assets/javascripts/blacklight_oembed/*.js"
8
9
  ],
9
10
  "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
11
+ "test": "echo \"Error: no test specified\" && exit 1",
12
+ "prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
11
13
  },
12
14
  "repository": {
13
15
  "type": "git",
@@ -19,5 +21,8 @@
19
21
  "url": "https://github.com/projectblacklight/blacklight-oembed/issues"
20
22
  },
21
23
  "homepage": "https://github.com/projectblacklight/blacklight-oembed#readme",
22
- "dependencies": {}
24
+ "dependencies": {
25
+ "rollup": "^4.30.1",
26
+ "rollup-plugin-includepaths": "^0.2.4"
27
+ }
23
28
  }
data/rollup.config.js ADDED
@@ -0,0 +1,27 @@
1
+ import includePaths from 'rollup-plugin-includepaths';
2
+
3
+
4
+ const BUNDLE = process.env.BUNDLE === 'true'
5
+ const ESM = process.env.ESM === 'true'
6
+
7
+ const fileDest = `oembed${ESM ? '.esm' : ''}`
8
+
9
+ let includePathOptions = {
10
+ include: {},
11
+ paths: ['app/javascript'],
12
+ external: [],
13
+ extensions: ['.js']
14
+ };
15
+
16
+ const rollupConfig = {
17
+ input: 'app/javascript/blacklight-oembed/oembed.js',
18
+ output: {
19
+ file: `app/assets/javascripts/blacklight_oembed/${fileDest}.js`,
20
+ format: ESM ? 'es' : 'umd',
21
+ generatedCode: { preset: 'es2015' },
22
+ name: ESM ? undefined : 'oembed'
23
+ },
24
+ plugins: [includePaths(includePathOptions)]
25
+ }
26
+
27
+ export default rollupConfig
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-oembed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-08 00:00:00.000000000 Z
11
+ date: 2025-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -212,14 +212,20 @@ files:
212
212
  - LICENSE
213
213
  - README.md
214
214
  - Rakefile
215
+ - app/assets/config/manifest.js
215
216
  - app/assets/javascripts/blacklight_oembed/jquery.oembed.js
217
+ - app/assets/javascripts/blacklight_oembed/oembed.esm.js
218
+ - app/assets/javascripts/blacklight_oembed/oembed.esm.js.map
216
219
  - app/assets/javascripts/blacklight_oembed/oembed.js
220
+ - app/assets/javascripts/blacklight_oembed/oembed.js.map
217
221
  - app/components/blacklight/oembed/document_oembed_component.html.erb
218
222
  - app/components/blacklight/oembed/document_oembed_component.rb
219
223
  - app/controllers/blacklight/oembed/embed_controller.rb
220
224
  - app/helpers/blacklight/oembed/oembed_helper.rb
225
+ - app/javascript/blacklight-oembed/oembed.js
221
226
  - app/views/catalog/_oembed_default.html.erb
222
227
  - blacklight-oembed.gemspec
228
+ - config/importmap.rb
223
229
  - config/jetty.yml
224
230
  - config/locales/blacklight-oembed.ar.yml
225
231
  - config/locales/blacklight-oembed.en.yml
@@ -232,6 +238,7 @@ files:
232
238
  - lib/generators/blacklight_oembed/templates/blacklight_oembed.js
233
239
  - lib/generators/blacklight_oembed/templates/oembed_providers.rb
234
240
  - package.json
241
+ - rollup.config.js
235
242
  - solr/conf/_rest_managed.json
236
243
  - solr/conf/admin-extra.html
237
244
  - solr/conf/elevate.xml