openseadragon 1.0.12 → 1.0.13
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/.github/workflows/ruby.yml +2 -2
 - data/app/assets/javascripts/openseadragon-rails/index.esm.js +74 -0
 - data/app/assets/javascripts/openseadragon-rails/index.esm.js.map +1 -0
 - data/app/assets/javascripts/openseadragon-rails/index.js +80 -0
 - data/app/assets/javascripts/openseadragon-rails/index.js.map +1 -0
 - data/app/javascript/openseadragon-rails/index.js +0 -1
 - data/app/javascript/openseadragon-rails/jquery.js +2 -0
 - data/app/javascript/openseadragon-rails/rails.js +2 -0
 - data/lib/openseadragon/version.rb +1 -1
 - data/package.json +11 -3
 - data/rollup.config.js +34 -0
 - metadata +7 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b4fc8f7211a57499f019e214970cbc95bf7386396dc28bc7ac64038acfeb6464
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2b0539e28179ab329dfbfdb24cbbcd6a65212e0a449d14033528a4d7822df751
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 897f64693c7132f82b82cb19f8e06f9a2569451bbce1e2ef93719f9e9e272bd53ed2eb5c933b2af80103d8358b465d56b95ee148c7b381a493c6b2da2e4eaf89
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0f4321f01d2c48fb0298dcac8712d4035ddb1d1768142350ca3c495bcf5adb1e516da5fa0bdc6670b128572e03d25955db7e69f26223bac2d73edb8ef4d09d3b
         
     | 
    
        data/.github/workflows/ruby.yml
    CHANGED
    
    
| 
         @@ -0,0 +1,74 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import OpenSeadragon from 'openseadragon';
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 4 
     | 
    
         
            +
              let __osd_counter = 0;
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              function generateOsdId() {
         
     | 
| 
      
 7 
     | 
    
         
            +
                __osd_counter++;
         
     | 
| 
      
 8 
     | 
    
         
            +
                return "Openseadragon" + __osd_counter;
         
     | 
| 
      
 9 
     | 
    
         
            +
              }
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              function openseadragon() {
         
     | 
| 
      
 12 
     | 
    
         
            +
                this.forEach(function(picture) {
         
     | 
| 
      
 13 
     | 
    
         
            +
                  // Ensure the element is an HTMLElement
         
     | 
| 
      
 14 
     | 
    
         
            +
                  if (!(picture instanceof HTMLElement)) return;
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  picture.classList.add('openseadragon-viewer');
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  // Set ID if it doesn't exist
         
     | 
| 
      
 19 
     | 
    
         
            +
                  if (!picture.id) {
         
     | 
| 
      
 20 
     | 
    
         
            +
                    picture.id = generateOsdId();
         
     | 
| 
      
 21 
     | 
    
         
            +
                  }
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  // Retrieve openseadragon data attribute as JSON
         
     | 
| 
      
 24 
     | 
    
         
            +
                  const collectionOptions = picture.dataset.openseadragon
         
     | 
| 
      
 25 
     | 
    
         
            +
                    ? JSON.parse(picture.dataset.openseadragon)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    : {};
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  // Find all <source> elements with media="openseadragon"
         
     | 
| 
      
 29 
     | 
    
         
            +
                  const sources = Array.from(picture.querySelectorAll('source[media="openseadragon"]'));
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  const tileSources = sources.map(source => {
         
     | 
| 
      
 32 
     | 
    
         
            +
                    const osdData = source.dataset.openseadragon;
         
     | 
| 
      
 33 
     | 
    
         
            +
                    return osdData ? JSON.parse(osdData) : source.getAttribute('src');
         
     | 
| 
      
 34 
     | 
    
         
            +
                  });
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  // Preserve height of the picture
         
     | 
| 
      
 37 
     | 
    
         
            +
                  const height = window.getComputedStyle(picture).height;
         
     | 
| 
      
 38 
     | 
    
         
            +
                  picture.style.height = height;
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  // Initialize OpenSeadragon
         
     | 
| 
      
 41 
     | 
    
         
            +
                  picture.osdViewer = OpenSeadragon({
         
     | 
| 
      
 42 
     | 
    
         
            +
                    id: picture.id,
         
     | 
| 
      
 43 
     | 
    
         
            +
                    ...collectionOptions,
         
     | 
| 
      
 44 
     | 
    
         
            +
                    tileSources: tileSources
         
     | 
| 
      
 45 
     | 
    
         
            +
                  });
         
     | 
| 
      
 46 
     | 
    
         
            +
                });
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                return this;
         
     | 
| 
      
 49 
     | 
    
         
            +
              }
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              // Attach the function to NodeList and HTMLElement prototypes for convenience
         
     | 
| 
      
 52 
     | 
    
         
            +
              NodeList.prototype.openseadragon = openseadragon;
         
     | 
| 
      
 53 
     | 
    
         
            +
              HTMLCollection.prototype.openseadragon = openseadragon;
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
              // For a single HTMLElement
         
     | 
| 
      
 56 
     | 
    
         
            +
              HTMLElement.prototype.openseadragon = function() {
         
     | 
| 
      
 57 
     | 
    
         
            +
                return openseadragon.call([this]);
         
     | 
| 
      
 58 
     | 
    
         
            +
              };
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            })();
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 63 
     | 
    
         
            +
              function initOpenSeadragon() {
         
     | 
| 
      
 64 
     | 
    
         
            +
                document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();
         
     | 
| 
      
 65 
     | 
    
         
            +
              }
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              if (typeof Turbo !== 'undefined') {
         
     | 
| 
      
 68 
     | 
    
         
            +
                addEventListener("turbo:load", () => initOpenSeadragon());
         
     | 
| 
      
 69 
     | 
    
         
            +
                addEventListener("turbo:frame-load", () => initOpenSeadragon());
         
     | 
| 
      
 70 
     | 
    
         
            +
              } else {
         
     | 
| 
      
 71 
     | 
    
         
            +
                addEventListener('load', () => initOpenSeadragon());
         
     | 
| 
      
 72 
     | 
    
         
            +
              }
         
     | 
| 
      
 73 
     | 
    
         
            +
            })();
         
     | 
| 
      
 74 
     | 
    
         
            +
            //# sourceMappingURL=index.esm.js.map
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"index.esm.js","sources":["../../../javascript/openseadragon-rails/dom.js","../../../javascript/openseadragon-rails/rails.js"],"sourcesContent":["import OpenSeadragon from 'openseadragon'\n\n(function() {\n  let __osd_counter = 0;\n\n  function generateOsdId() {\n    __osd_counter++;\n    return \"Openseadragon\" + __osd_counter;\n  }\n\n  function openseadragon() {\n    this.forEach(function(picture) {\n      // Ensure the element is an HTMLElement\n      if (!(picture instanceof HTMLElement)) return;\n\n      picture.classList.add('openseadragon-viewer');\n\n      // Set ID if it doesn't exist\n      if (!picture.id) {\n        picture.id = generateOsdId();\n      }\n\n      // Retrieve openseadragon data attribute as JSON\n      const collectionOptions = picture.dataset.openseadragon\n        ? JSON.parse(picture.dataset.openseadragon)\n        : {};\n\n      // Find all <source> elements with media=\"openseadragon\"\n      const sources = Array.from(picture.querySelectorAll('source[media=\"openseadragon\"]'));\n\n      const tileSources = sources.map(source => {\n        const osdData = source.dataset.openseadragon;\n        return osdData ? JSON.parse(osdData) : source.getAttribute('src');\n      });\n\n      // Preserve height of the picture\n      const height = window.getComputedStyle(picture).height;\n      picture.style.height = height;\n\n      // Initialize OpenSeadragon\n      picture.osdViewer = OpenSeadragon({\n        id: picture.id,\n        ...collectionOptions,\n        tileSources: tileSources\n      });\n    });\n\n    return this;\n  }\n\n  // Attach the function to NodeList and HTMLElement prototypes for convenience\n  NodeList.prototype.openseadragon = openseadragon;\n  HTMLCollection.prototype.openseadragon = openseadragon;\n\n  // For a single HTMLElement\n  HTMLElement.prototype.openseadragon = function() {\n    return openseadragon.call([this]);\n  };\n\n})();\n","import './dom'\n\n(function() {\n  function initOpenSeadragon() {\n    document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();\n  }\n\n  if (typeof Turbo !== 'undefined') {\n    addEventListener(\"turbo:load\", () => initOpenSeadragon())\n    addEventListener(\"turbo:frame-load\", () => initOpenSeadragon())\n  } else {\n    addEventListener('load', () => initOpenSeadragon())\n  }\n})();\n"],"names":[],"mappings":";;AAEA,CAAC,WAAW;AACZ,EAAE,IAAI,aAAa,GAAG,CAAC;;AAEvB,EAAE,SAAS,aAAa,GAAG;AAC3B,IAAI,aAAa,EA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I;AACf;;AAEA;AACA,EAAE,QAAQ,CAAC,SAAS,CAAC,aAAa,GAAG,aAAa;AAClD,EAAE,cAAc,CAAC,SAAS,CAAC,aAAa,GAAG,aAAa;;AAExD;AACA,EAAE,WAAW,CAAC,SAAS,CAAC,aAAa,GAAG,WAAW;AACnD,IAAI,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AACrC,GAAG;;AAEH,CAAC,GAAG;;ACzDJ,CAAC,WAAW;AACZ,EAAE,SAAS,iBAAiB,GAAG;AAC/B,IAAI,QAAQ,CAAC,gBAAgB,CAAC,iEAAiE,CAAC,CAAC,aAAa,EAAE;AAChH;;AAEA,EAAE,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;AACpC,IAAI,gBAAgB,CAAC,YAAY,EAAE,MAAM,iBAAiB,EAAE;AAC5D,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,iBAAiB,EAAE;AAClE,GAAG,MAAM;AACT,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE;AACtD;AACA,CAAC,GAAG"}
         
     | 
| 
         @@ -0,0 +1,80 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            (function (global, factory) {
         
     | 
| 
      
 2 
     | 
    
         
            +
              typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('openseadragon')) :
         
     | 
| 
      
 3 
     | 
    
         
            +
              typeof define === 'function' && define.amd ? define(['openseadragon'], factory) :
         
     | 
| 
      
 4 
     | 
    
         
            +
              (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.OpenSeadragon));
         
     | 
| 
      
 5 
     | 
    
         
            +
            })(this, (function (OpenSeadragon) { 'use strict';
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              (function() {
         
     | 
| 
      
 8 
     | 
    
         
            +
                let __osd_counter = 0;
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                function generateOsdId() {
         
     | 
| 
      
 11 
     | 
    
         
            +
                  __osd_counter++;
         
     | 
| 
      
 12 
     | 
    
         
            +
                  return "Openseadragon" + __osd_counter;
         
     | 
| 
      
 13 
     | 
    
         
            +
                }
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                function openseadragon() {
         
     | 
| 
      
 16 
     | 
    
         
            +
                  this.forEach(function(picture) {
         
     | 
| 
      
 17 
     | 
    
         
            +
                    // Ensure the element is an HTMLElement
         
     | 
| 
      
 18 
     | 
    
         
            +
                    if (!(picture instanceof HTMLElement)) return;
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                    picture.classList.add('openseadragon-viewer');
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                    // Set ID if it doesn't exist
         
     | 
| 
      
 23 
     | 
    
         
            +
                    if (!picture.id) {
         
     | 
| 
      
 24 
     | 
    
         
            +
                      picture.id = generateOsdId();
         
     | 
| 
      
 25 
     | 
    
         
            +
                    }
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                    // Retrieve openseadragon data attribute as JSON
         
     | 
| 
      
 28 
     | 
    
         
            +
                    const collectionOptions = picture.dataset.openseadragon
         
     | 
| 
      
 29 
     | 
    
         
            +
                      ? JSON.parse(picture.dataset.openseadragon)
         
     | 
| 
      
 30 
     | 
    
         
            +
                      : {};
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    // Find all <source> elements with media="openseadragon"
         
     | 
| 
      
 33 
     | 
    
         
            +
                    const sources = Array.from(picture.querySelectorAll('source[media="openseadragon"]'));
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                    const tileSources = sources.map(source => {
         
     | 
| 
      
 36 
     | 
    
         
            +
                      const osdData = source.dataset.openseadragon;
         
     | 
| 
      
 37 
     | 
    
         
            +
                      return osdData ? JSON.parse(osdData) : source.getAttribute('src');
         
     | 
| 
      
 38 
     | 
    
         
            +
                    });
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                    // Preserve height of the picture
         
     | 
| 
      
 41 
     | 
    
         
            +
                    const height = window.getComputedStyle(picture).height;
         
     | 
| 
      
 42 
     | 
    
         
            +
                    picture.style.height = height;
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    // Initialize OpenSeadragon
         
     | 
| 
      
 45 
     | 
    
         
            +
                    picture.osdViewer = OpenSeadragon({
         
     | 
| 
      
 46 
     | 
    
         
            +
                      id: picture.id,
         
     | 
| 
      
 47 
     | 
    
         
            +
                      ...collectionOptions,
         
     | 
| 
      
 48 
     | 
    
         
            +
                      tileSources: tileSources
         
     | 
| 
      
 49 
     | 
    
         
            +
                    });
         
     | 
| 
      
 50 
     | 
    
         
            +
                  });
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                  return this;
         
     | 
| 
      
 53 
     | 
    
         
            +
                }
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                // Attach the function to NodeList and HTMLElement prototypes for convenience
         
     | 
| 
      
 56 
     | 
    
         
            +
                NodeList.prototype.openseadragon = openseadragon;
         
     | 
| 
      
 57 
     | 
    
         
            +
                HTMLCollection.prototype.openseadragon = openseadragon;
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                // For a single HTMLElement
         
     | 
| 
      
 60 
     | 
    
         
            +
                HTMLElement.prototype.openseadragon = function() {
         
     | 
| 
      
 61 
     | 
    
         
            +
                  return openseadragon.call([this]);
         
     | 
| 
      
 62 
     | 
    
         
            +
                };
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
              })();
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              (function() {
         
     | 
| 
      
 67 
     | 
    
         
            +
                function initOpenSeadragon() {
         
     | 
| 
      
 68 
     | 
    
         
            +
                  document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();
         
     | 
| 
      
 69 
     | 
    
         
            +
                }
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                if (typeof Turbo !== 'undefined') {
         
     | 
| 
      
 72 
     | 
    
         
            +
                  addEventListener("turbo:load", () => initOpenSeadragon());
         
     | 
| 
      
 73 
     | 
    
         
            +
                  addEventListener("turbo:frame-load", () => initOpenSeadragon());
         
     | 
| 
      
 74 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 75 
     | 
    
         
            +
                  addEventListener('load', () => initOpenSeadragon());
         
     | 
| 
      
 76 
     | 
    
         
            +
                }
         
     | 
| 
      
 77 
     | 
    
         
            +
              })();
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            }));
         
     | 
| 
      
 80 
     | 
    
         
            +
            //# sourceMappingURL=index.js.map
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"index.js","sources":["../../../javascript/openseadragon-rails/dom.js","../../../javascript/openseadragon-rails/rails.js"],"sourcesContent":["import OpenSeadragon from 'openseadragon'\n\n(function() {\n  let __osd_counter = 0;\n\n  function generateOsdId() {\n    __osd_counter++;\n    return \"Openseadragon\" + __osd_counter;\n  }\n\n  function openseadragon() {\n    this.forEach(function(picture) {\n      // Ensure the element is an HTMLElement\n      if (!(picture instanceof HTMLElement)) return;\n\n      picture.classList.add('openseadragon-viewer');\n\n      // Set ID if it doesn't exist\n      if (!picture.id) {\n        picture.id = generateOsdId();\n      }\n\n      // Retrieve openseadragon data attribute as JSON\n      const collectionOptions = picture.dataset.openseadragon\n        ? JSON.parse(picture.dataset.openseadragon)\n        : {};\n\n      // Find all <source> elements with media=\"openseadragon\"\n      const sources = Array.from(picture.querySelectorAll('source[media=\"openseadragon\"]'));\n\n      const tileSources = sources.map(source => {\n        const osdData = source.dataset.openseadragon;\n        return osdData ? JSON.parse(osdData) : source.getAttribute('src');\n      });\n\n      // Preserve height of the picture\n      const height = window.getComputedStyle(picture).height;\n      picture.style.height = height;\n\n      // Initialize OpenSeadragon\n      picture.osdViewer = OpenSeadragon({\n        id: picture.id,\n        ...collectionOptions,\n        tileSources: tileSources\n      });\n    });\n\n    return this;\n  }\n\n  // Attach the function to NodeList and HTMLElement prototypes for convenience\n  NodeList.prototype.openseadragon = openseadragon;\n  HTMLCollection.prototype.openseadragon = openseadragon;\n\n  // For a single HTMLElement\n  HTMLElement.prototype.openseadragon = function() {\n    return openseadragon.call([this]);\n  };\n\n})();\n","import './dom'\n\n(function() {\n  function initOpenSeadragon() {\n    document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();\n  }\n\n  if (typeof Turbo !== 'undefined') {\n    addEventListener(\"turbo:load\", () => initOpenSeadragon())\n    addEventListener(\"turbo:frame-load\", () => initOpenSeadragon())\n  } else {\n    addEventListener('load', () => initOpenSeadragon())\n  }\n})();\n"],"names":[],"mappings":";;;;;;EAEA,CAAC,WAAW;EACZ,EAAE,IAAI,aAAa,GAAG,CAAC;;EAEvB,EAAE,SAAS,aAAa,GAAG;EAC3B,IAAI,aAAa,EAAE;EACnB,IAAI,OAAO,eAAe,GAAG,aAAa;EAC1C;;EAEA,EAAE,SAAS,aAAa,GAAG;EAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,OAAO,EAAE;EACnC;EACA,MAAM,IAAI,EAAE,OAAO,YAAY,WAAW,CAAC,EAAE;;EAE7C,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,sBAAsB,CAAC;;EAEnD;EACA,MAAM,IAAI,CAAC,OAAO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C,WAAW;EACZ,EAAE,SAAS,iBAAiB,GAAG;EAC/B,IAAI,QAAQ,CAAC,gBAAgB,CAAC,iEAAiE,CAAC,CAAC,aAAa,EAAE;EAChH;;EAEA,EAAE,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;EACpC,IAAI,gBAAgB,CAAC,YAAY,EAAE,MAAM,iBAAiB,EAAE;EAC5D,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,iBAAiB,EAAE;EAClE,GAAG,MAAM;EACT,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE;EACtD;EACA,CAAC,GAAG;;;;;;"}
         
     | 
    
        data/package.json
    CHANGED
    
    | 
         @@ -1,20 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "openseadragon-rails",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "1.0. 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "1.0.13",
         
     | 
| 
       4 
4 
     | 
    
         
             
              "description": "Openseadragon support for Rails apps",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "exports": {
         
     | 
| 
       6 
6 
     | 
    
         
             
                ".": "./app/javascript/openseadragon-rails/index.js",
         
     | 
| 
       7 
7 
     | 
    
         
             
                "./*": "./app/javascript/openseadragon-rails/*.js"
         
     | 
| 
       8 
8 
     | 
    
         
             
              },
         
     | 
| 
       9 
     | 
    
         
            -
              "main": "app/ 
     | 
| 
      
 9 
     | 
    
         
            +
              "main": "app/assets/javascripts/openseadragon-rails/index.js",
         
     | 
| 
       10 
10 
     | 
    
         
             
              "module": "app/javascript/openseadragon-rails/index.js",
         
     | 
| 
       11 
11 
     | 
    
         
             
              "files": [
         
     | 
| 
       12 
12 
     | 
    
         
             
                "app/javascript/openseadragon-rails/*.js",
         
     | 
| 
      
 13 
     | 
    
         
            +
                "app/assets/javascripts/openseadragon-rails/*.js",
         
     | 
| 
       13 
14 
     | 
    
         
             
                "app/assets/stylesheets/openseadragon/*.css"
         
     | 
| 
       14 
15 
     | 
    
         
             
              ],
         
     | 
| 
       15 
16 
     | 
    
         
             
              "scripts": {
         
     | 
| 
       16 
     | 
    
         
            -
                "test": "echo \"Error: no test specified\" && exit 1"
         
     | 
| 
      
 17 
     | 
    
         
            +
                "test": "echo \"Error: no test specified\" && exit 1",
         
     | 
| 
      
 18 
     | 
    
         
            +
                "prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
         
     | 
| 
       17 
19 
     | 
    
         
             
              },
         
     | 
| 
      
 20 
     | 
    
         
            +
              "type": "module",
         
     | 
| 
       18 
21 
     | 
    
         
             
              "repository": {
         
     | 
| 
       19 
22 
     | 
    
         
             
                "type": "git",
         
     | 
| 
       20 
23 
     | 
    
         
             
                "url": "git+https://github.com/sul-dlss/openseadragon-rails.git"
         
     | 
| 
         @@ -27,5 +30,10 @@ 
     | 
|
| 
       27 
30 
     | 
    
         
             
              "homepage": "https://github.com/sul-dlss/openseadragon-rails#readme",
         
     | 
| 
       28 
31 
     | 
    
         
             
              "dependencies": {
         
     | 
| 
       29 
32 
     | 
    
         
             
                "openseadragon": "^5.0.1"
         
     | 
| 
      
 33 
     | 
    
         
            +
              },
         
     | 
| 
      
 34 
     | 
    
         
            +
              "devDependencies": {
         
     | 
| 
      
 35 
     | 
    
         
            +
                "@rollup/plugin-commonjs": "^28.0.2",
         
     | 
| 
      
 36 
     | 
    
         
            +
                "rollup": "^4.30.1",
         
     | 
| 
      
 37 
     | 
    
         
            +
                "rollup-plugin-includepaths": "^0.2.4"
         
     | 
| 
       30 
38 
     | 
    
         
             
              }
         
     | 
| 
       31 
39 
     | 
    
         
             
            }
         
     | 
    
        data/rollup.config.js
    ADDED
    
    | 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import includePaths from 'rollup-plugin-includepaths';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import commonjs from '@rollup/plugin-commonjs';
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            const BUNDLE = process.env.BUNDLE === 'true'
         
     | 
| 
      
 5 
     | 
    
         
            +
            const ESM = process.env.ESM === 'true'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            const fileDest = `index${ESM ? '.esm' : ''}`
         
     | 
| 
      
 8 
     | 
    
         
            +
            const external = [
         
     | 
| 
      
 9 
     | 
    
         
            +
              'openseadragon',
         
     | 
| 
      
 10 
     | 
    
         
            +
            ]
         
     | 
| 
      
 11 
     | 
    
         
            +
            const globals = {
         
     | 
| 
      
 12 
     | 
    
         
            +
              openseadragon: 'OpenSeadragon',
         
     | 
| 
      
 13 
     | 
    
         
            +
            }
         
     | 
| 
      
 14 
     | 
    
         
            +
            let includePathOptions = {
         
     | 
| 
      
 15 
     | 
    
         
            +
              include: {},
         
     | 
| 
      
 16 
     | 
    
         
            +
              paths: ['app/javascript'],
         
     | 
| 
      
 17 
     | 
    
         
            +
              external: [],
         
     | 
| 
      
 18 
     | 
    
         
            +
              extensions: ['.js', '.es6']
         
     | 
| 
      
 19 
     | 
    
         
            +
            };
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            const rollupConfig = {
         
     | 
| 
      
 22 
     | 
    
         
            +
              input: 'app/javascript/openseadragon-rails/index.js',
         
     | 
| 
      
 23 
     | 
    
         
            +
              output: {
         
     | 
| 
      
 24 
     | 
    
         
            +
                file: `app/assets/javascripts/openseadragon-rails/${fileDest}.js`,
         
     | 
| 
      
 25 
     | 
    
         
            +
                format: ESM ? 'es' : 'umd',
         
     | 
| 
      
 26 
     | 
    
         
            +
                globals,
         
     | 
| 
      
 27 
     | 
    
         
            +
                generatedCode: { preset: 'es2015' },
         
     | 
| 
      
 28 
     | 
    
         
            +
                name: ESM ? undefined : 'OpenseadragonRails'
         
     | 
| 
      
 29 
     | 
    
         
            +
              },
         
     | 
| 
      
 30 
     | 
    
         
            +
              external,
         
     | 
| 
      
 31 
     | 
    
         
            +
              plugins: [includePaths(includePathOptions), commonjs()]
         
     | 
| 
      
 32 
     | 
    
         
            +
            }
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            export default rollupConfig
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: openseadragon
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.13
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Justin Coyne
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire:
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2025-01- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2025-01-08 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -127,6 +127,10 @@ files: 
     | 
|
| 
       127 
127 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       128 
128 
     | 
    
         
             
            - README.md
         
     | 
| 
       129 
129 
     | 
    
         
             
            - Rakefile
         
     | 
| 
      
 130 
     | 
    
         
            +
            - app/assets/javascripts/openseadragon-rails/index.esm.js
         
     | 
| 
      
 131 
     | 
    
         
            +
            - app/assets/javascripts/openseadragon-rails/index.esm.js.map
         
     | 
| 
      
 132 
     | 
    
         
            +
            - app/assets/javascripts/openseadragon-rails/index.js
         
     | 
| 
      
 133 
     | 
    
         
            +
            - app/assets/javascripts/openseadragon-rails/index.js.map
         
     | 
| 
       130 
134 
     | 
    
         
             
            - app/assets/javascripts/openseadragon.js
         
     | 
| 
       131 
135 
     | 
    
         
             
            - app/assets/stylesheets/openseadragon/openseadragon.css
         
     | 
| 
       132 
136 
     | 
    
         
             
            - app/helpers/openseadragon/openseadragon_helper.rb
         
     | 
| 
         @@ -145,6 +149,7 @@ files: 
     | 
|
| 
       145 
149 
     | 
    
         
             
            - lib/openseadragon/version.rb
         
     | 
| 
       146 
150 
     | 
    
         
             
            - openseadragon.gemspec
         
     | 
| 
       147 
151 
     | 
    
         
             
            - package.json
         
     | 
| 
      
 152 
     | 
    
         
            +
            - rollup.config.js
         
     | 
| 
       148 
153 
     | 
    
         
             
            - spec/helpers/openseadragon_helper_spec.rb
         
     | 
| 
       149 
154 
     | 
    
         
             
            - spec/models/openseadragon/image_spec.rb
         
     | 
| 
       150 
155 
     | 
    
         
             
            - spec/models/openseadragon/open_street_map.rb
         
     |