Browse Source

Autoplay plugin for Carousel; Bugfixes

pull/88/head
Jānis Skarnelis 3 years ago
parent
commit
9db687e1d2
  1. 2
      dist/carousel.autoplay.esm.js
  2. 2
      dist/carousel.autoplay.umd.js
  3. 2
      dist/carousel.esm.js
  4. 2
      dist/carousel.umd.js
  5. 2
      dist/fancybox.css
  6. 2
      dist/fancybox.esm.js
  7. 2
      dist/fancybox.umd.js
  8. 2
      dist/panzoom.controls.esm.js
  9. 2
      dist/panzoom.controls.umd.js
  10. 2
      dist/panzoom.css
  11. 2
      dist/panzoom.esm.js
  12. 2
      dist/panzoom.umd.js
  13. 117
      package-lock.json
  14. 4
      package.json
  15. 2
      rollup.config.js
  16. 2
      src/Carousel/Carousel.js
  17. 99
      src/Carousel/plugins/Autoplay/Autoplay.js
  18. 4
      src/Fancybox/Fancybox.js
  19. 2
      src/Fancybox/plugins/Image/Image.scss
  20. 13
      src/Panzoom/Panzoom.js
  21. 8
      src/Panzoom/plugins/Controls/Controls.js
  22. 2
      src/Panzoom/scss/base.scss

2
dist/carousel.autoplay.esm.js

@ -0,0 +1,2 @@
// @fancyapps/ui/Carousel.Autoplay v4.0.0-beta.1
class t{constructor(t){this.carousel=t,this.state="ready";for(const t of["onReady","onSettle","onMouseEnter","onMouseLeave"])this[t]=this[t].bind(this);this.events={ready:this.onReady,settle:this.onSettle}}onReady(){this.start()}onSettle(){"play"===this.state&&this.set()}onMouseEnter(){"play"===this.state&&(this.state="pause",this.clear())}onMouseLeave(){"pause"===this.state&&(this.state="play",this.set())}set(){this.clear(),this.timer=setTimeout((()=>{"play"===this.state&&this.carousel.slideTo(this.carousel.pageIndex+1)}),this.carousel.option("Autoplay.timeout"))}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null)}start(){this.set(),this.state="play",this.carousel.option("Autoplay.hoverPause")&&(this.carousel.$container.addEventListener("mouseenter",this.onMouseEnter,!1),this.carousel.$container.addEventListener("mouseleave",this.onMouseLeave,!1))}stop(){this.clear(),this.state="ready",this.carousel.$container.removeEventListener("mouseenter",this.onMouseEnter,!1),this.carousel.$container.removeEventListener("mouseleave",this.onMouseLeave,!1)}attach(){this.carousel.on(this.events)}detach(){this.stop(),this.carousel.off(this.events),this.carousel=null}}var e;t.defaults={timeout:3e3,hoverPause:!0},"undefined"!=typeof Carousel&&("object"==typeof(e=Carousel.Plugins)&&null!==e&&e.constructor===Object&&"[object Object]"===Object.prototype.toString.call(e))&&(Carousel.Plugins.Autoplay=t);export{t as Autoplay};

2
dist/carousel.autoplay.umd.js

@ -0,0 +1,2 @@
// @fancyapps/ui/Carousel.Autoplay v4.0.0-beta.1
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).window=e.window||{})}(this,(function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var n,s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.carousel=t,this.state="ready";for(var o=0,n=["onReady","onSettle","onMouseEnter","onMouseLeave"];o<n.length;o++){var s=n[o];this[s]=this[s].bind(this)}this.events={ready:this.onReady,settle:this.onSettle}}var t,n,s;return t=e,(n=[{key:"onReady",value:function(){this.start()}},{key:"onSettle",value:function(){"play"===this.state&&this.set()}},{key:"onMouseEnter",value:function(){"play"===this.state&&(this.state="pause",this.clear())}},{key:"onMouseLeave",value:function(){"pause"===this.state&&(this.state="play",this.set())}},{key:"set",value:function(){var e=this;this.clear(),this.timer=setTimeout((function(){"play"===e.state&&e.carousel.slideTo(e.carousel.pageIndex+1)}),this.carousel.option("Autoplay.timeout"))}},{key:"clear",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null)}},{key:"start",value:function(){this.set(),this.state="play",this.carousel.option("Autoplay.hoverPause")&&(this.carousel.$container.addEventListener("mouseenter",this.onMouseEnter,!1),this.carousel.$container.addEventListener("mouseleave",this.onMouseLeave,!1))}},{key:"stop",value:function(){this.clear(),this.state="ready",this.carousel.$container.removeEventListener("mouseenter",this.onMouseEnter,!1),this.carousel.$container.removeEventListener("mouseleave",this.onMouseLeave,!1)}},{key:"attach",value:function(){this.carousel.on(this.events)}},{key:"detach",value:function(){this.stop(),this.carousel.off(this.events),this.carousel=null}}])&&o(t.prototype,n),s&&o(t,s),e}();s.defaults={timeout:3e3,hoverPause:!0},"undefined"!=typeof Carousel&&("object"===t(n=Carousel.Plugins)&&null!==n&&n.constructor===Object&&"[object Object]"===Object.prototype.toString.call(n))&&(Carousel.Plugins.Autoplay=s),e.Autoplay=s}));

2
dist/carousel.esm.js

File diff suppressed because one or more lines are too long

2
dist/carousel.umd.js

File diff suppressed because one or more lines are too long

2
dist/fancybox.css

File diff suppressed because one or more lines are too long

2
dist/fancybox.esm.js

File diff suppressed because one or more lines are too long

2
dist/fancybox.umd.js

File diff suppressed because one or more lines are too long

2
dist/panzoom.controls.esm.js

@ -1,2 +1,2 @@
// @fancyapps/ui/Panzoom.Controls v4.0.0-beta.1
class t{constructor(t){this.panzoom=t,this.$container=null}addButton(t,o=!1){const n=document.createElement("button");return n.setAttribute("title",this.panzoom.localize(`{{CONTROLS.${t.toUpperCase()}}}`)),n.classList.add("panzoom__button"),n.classList.add(`panzoom__button--${t}`),n.innerHTML=this.panzoom.localize(this.panzoom.option(`Controls.tpl.${t}`,"")),o&&n.addEventListener("click",(o=>{o.stopPropagation(),this.panzoom[t]()})),this.$container.appendChild(n),n}createContainer(){if(this.$container||!this.panzoom.option("zoom"))return;const t=document.createElement("div");t.classList.add("panzoom__controls"),this.$container=this.panzoom.$container.appendChild(t);for(const t of this.panzoom.option("Controls.buttons",[]))this.addButton(t,!0)}removeContainer(){this.$container&&(this.$container.remove(),this.$container=null)}attach(){this.createContainer()}detach(){this.removeContainer()}}t.defaults={l10n:{ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out"},buttons:["zoomIn","zoomOut"],tpl:{zoomIn:'<svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 4V20M20 12L4 12" /></svg>',zoomOut:'<svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20 12H4" /></svg>'}};export{t as Controls};
class t{constructor(t){this.panzoom=t,this.$container=null}addButton(t,o=!1){const n=document.createElement("button");return n.setAttribute("title",this.panzoom.localize(`{{CONTROLS.${t.toUpperCase()}}}`)),n.classList.add("panzoom__button"),n.classList.add(`panzoom__button--${t}`),n.innerHTML=this.panzoom.localize(this.panzoom.option(`Controls.tpl.${t}`,"")),o&&n.addEventListener("click",(o=>{o.stopPropagation(),this.panzoom[t]()})),this.$container.appendChild(n),n}createContainer(){if(this.$container||!this.panzoom.option("zoom"))return;const t=document.createElement("div");t.classList.add("panzoom__controls"),this.$container=this.panzoom.$container.appendChild(t);for(const t of this.panzoom.option("Controls.buttons",[]))this.addButton(t,!0)}removeContainer(){this.$container&&(this.$container.remove(),this.$container=null)}attach(){this.createContainer()}detach(){this.removeContainer()}}var o;t.defaults={l10n:{ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out"},buttons:["zoomIn","zoomOut"],tpl:{zoomIn:'<svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 4V20M20 12L4 12" /></svg>',zoomOut:'<svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20 12H4" /></svg>'}},"undefined"!=typeof Panzoom&&("object"==typeof(o=Panzoom.Plugins)&&null!==o&&o.constructor===Object&&"[object Object]"===Object.prototype.toString.call(o))&&(Panzoom.Plugins.Controls=t);export{t as Controls};

2
dist/panzoom.controls.umd.js

@ -1,2 +1,2 @@
// @fancyapps/ui/Panzoom.Controls v4.0.0-beta.1
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function n(t,n){for(var o=0;o<n.length;o++){var e=n[o];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function o(t,n){(null==n||n>t.length)&&(n=t.length);for(var o=0,e=new Array(n);o<n;o++)e[o]=t[o];return e}function e(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,n){if(t){if("string"==typeof t)return o(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?o(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return c=t.done,t},e:function(t){l=!0,a=t},f:function(){try{c||null==e.return||e.return()}finally{if(l)throw a}}}}var r=function(){function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.panzoom=n,this.$container=null}var o,r,i;return o=t,(r=[{key:"addButton",value:function(t){var n=this,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=document.createElement("button");return e.setAttribute("title",this.panzoom.localize("{{CONTROLS.".concat(t.toUpperCase(),"}}"))),e.classList.add("panzoom__button"),e.classList.add("panzoom__button--".concat(t)),e.innerHTML=this.panzoom.localize(this.panzoom.option("Controls.tpl.".concat(t),"")),o&&e.addEventListener("click",(function(o){o.stopPropagation(),n.panzoom[t]()})),this.$container.appendChild(e),e}},{key:"createContainer",value:function(){if(!this.$container&&this.panzoom.option("zoom")){var t=document.createElement("div");t.classList.add("panzoom__controls"),this.$container=this.panzoom.$container.appendChild(t);var n,o=e(this.panzoom.option("Controls.buttons",[]));try{for(o.s();!(n=o.n()).done;){var r=n.value;this.addButton(r,!0)}}catch(t){o.e(t)}finally{o.f()}}}},{key:"removeContainer",value:function(){this.$container&&(this.$container.remove(),this.$container=null)}},{key:"attach",value:function(){this.createContainer()}},{key:"detach",value:function(){this.removeContainer()}}])&&n(o.prototype,r),i&&n(o,i),t}();r.defaults={l10n:{ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out"},buttons:["zoomIn","zoomOut"],tpl:{zoomIn:'<svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 4V20M20 12L4 12" /></svg>',zoomOut:'<svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20 12H4" /></svg>'}},t.Controls=r}));
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,n){for(var o=0;o<n.length;o++){var e=n[o];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function e(t,n){(null==n||n>t.length)&&(n=t.length);for(var o=0,e=new Array(n);o<n;o++)e[o]=t[o];return e}function r(t,n){var o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!o){if(Array.isArray(t)||(o=function(t,n){if(t){if("string"==typeof t)return e(t,n);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){o&&(t=o);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,l=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return c=t.done,t},e:function(t){l=!0,a=t},f:function(){try{c||null==o.return||o.return()}finally{if(l)throw a}}}}var i,a=function(){function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.panzoom=n,this.$container=null}var n,e,i;return n=t,(e=[{key:"addButton",value:function(t){var n=this,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=document.createElement("button");return e.setAttribute("title",this.panzoom.localize("{{CONTROLS.".concat(t.toUpperCase(),"}}"))),e.classList.add("panzoom__button"),e.classList.add("panzoom__button--".concat(t)),e.innerHTML=this.panzoom.localize(this.panzoom.option("Controls.tpl.".concat(t),"")),o&&e.addEventListener("click",(function(o){o.stopPropagation(),n.panzoom[t]()})),this.$container.appendChild(e),e}},{key:"createContainer",value:function(){if(!this.$container&&this.panzoom.option("zoom")){var t=document.createElement("div");t.classList.add("panzoom__controls"),this.$container=this.panzoom.$container.appendChild(t);var n,o=r(this.panzoom.option("Controls.buttons",[]));try{for(o.s();!(n=o.n()).done;){var e=n.value;this.addButton(e,!0)}}catch(t){o.e(t)}finally{o.f()}}}},{key:"removeContainer",value:function(){this.$container&&(this.$container.remove(),this.$container=null)}},{key:"attach",value:function(){this.createContainer()}},{key:"detach",value:function(){this.removeContainer()}}])&&o(n.prototype,e),i&&o(n,i),t}();a.defaults={l10n:{ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out"},buttons:["zoomIn","zoomOut"],tpl:{zoomIn:'<svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 4V20M20 12L4 12" /></svg>',zoomOut:'<svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20 12H4" /></svg>'}},"undefined"!=typeof Panzoom&&("object"===n(i=Panzoom.Plugins)&&null!==i&&i.constructor===Object&&"[object Object]"===Object.prototype.toString.call(i))&&(Panzoom.Plugins.Controls=a),t.Controls=a}));

2
dist/panzoom.css

@ -1 +1 @@
.panzoom{position:relative;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center}.panzoom__viewport{position:relative;width:100%;height:100%;min-height:1px;margin:auto}.panzoom__content{max-width:100%;max-height:100%;object-fit:contain;transform:translate3d(0, 0, 0) scale(1);transform-origin:0 0;transition:unset;touch-action:none;user-select:none}.is-draggable{cursor:move;cursor:grab}.is-dragging{cursor:grabbing}
.panzoom{position:relative;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center}.panzoom__viewport{position:relative;width:100%;height:100%;min-height:1px;margin:auto}.panzoom__content{max-width:100%;max-height:100%;object-fit:contain;transform:translate3d(0, 0, 0) scale(1);transform-origin:0 0;transition:none;touch-action:none;user-select:none}.is-draggable{cursor:move;cursor:grab}.is-dragging{cursor:grabbing}

2
dist/panzoom.esm.js

File diff suppressed because one or more lines are too long

2
dist/panzoom.umd.js

File diff suppressed because one or more lines are too long

117
package-lock.json

@ -15,7 +15,7 @@
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-replace": "^3.0.0",
"chai": "^4.3.4",
"core-js": "^3.16.1",
"core-js": "^3.16.2",
"husky": "^7.0.1",
"karma": "^6.3.4",
"karma-chai": "^0.1.0",
@ -33,7 +33,7 @@
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-terser": "^7.0.2",
"sass": "1.38.0",
"sharp": "^0.28.3"
"sharp": "^0.29.0"
}
},
"node_modules/@babel/code-frame": {
@ -2856,12 +2856,12 @@
}
},
"node_modules/color": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/color/-/color-4.0.1.tgz",
"integrity": "sha512-rpZjOKN5O7naJxkH2Rx1sZzzBgaiWECc6BYXjeCE6kF0kcASJYbUq02u7JqIHwCb/j3NhV+QhRL2683aICeGZA==",
"dev": true,
"dependencies": {
"color-convert": "^1.9.3",
"color-convert": "^2.0.1",
"color-string": "^1.6.0"
}
},
@ -2890,6 +2890,24 @@
"simple-swizzle": "^0.2.2"
}
},
"node_modules/color/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"node_modules/colorette": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz",
@ -3022,9 +3040,9 @@
}
},
"node_modules/core-js": {
"version": "3.16.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.16.1.tgz",
"integrity": "sha512-AAkP8i35EbefU+JddyWi12AWE9f2N/qr/pwnDtWz4nyUIBGMJPX99ANFFRSw6FefM374lDujdtLDyhN2A/btHw==",
"version": "3.16.2",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.16.2.tgz",
"integrity": "sha512-P0KPukO6OjMpjBtHSceAZEWlDD1M2Cpzpg6dBbrjFqFhBHe/BwhxaP820xKOjRn/lZRQirrCusIpLS/n2sgXLQ==",
"dev": true,
"hasInstallScript": true,
"funding": {
@ -6031,9 +6049,9 @@
}
},
"node_modules/node-addon-api": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz",
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.0.0.tgz",
"integrity": "sha512-ALmRVBFzfwldBfk3SbKfl6+PVMXiCPKZBEfsJqB/EjXAMAI+MfFrEHR+GMRBuI162DihZ1QjEZ8ieYKuRCJ8Hg==",
"dev": true
},
"node_modules/node-fetch": {
@ -6746,9 +6764,9 @@
}
},
"node_modules/prebuild-install": {
"version": "6.1.3",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.3.tgz",
"integrity": "sha512-iqqSR84tNYQUQHRXalSKdIaM8Ov1QxOVuBNWI7+BzZWv6Ih9k75wOnH1rGQ9WWTaaLkTpxWKIciOF0KyfM74+Q==",
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.4.tgz",
"integrity": "sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ==",
"dev": true,
"dependencies": {
"detect-libc": "^1.0.3",
@ -7621,23 +7639,23 @@
"dev": true
},
"node_modules/sharp": {
"version": "0.28.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.28.3.tgz",
"integrity": "sha512-21GEP45Rmr7q2qcmdnjDkNP04Ooh5v0laGS5FDpojOO84D1DJwUijLiSq8XNNM6e8aGXYtoYRh3sVNdm8NodMA==",
"version": "0.29.0",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.29.0.tgz",
"integrity": "sha512-mdN1Up0eN+SwyForPls59dWO0nx64J1XRQYy5ZiKSADAccGYCB10UAGJHSVG9VObzJdhHqrVJzQcq6gx8USyoA==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
"color": "^3.1.3",
"color": "^4.0.1",
"detect-libc": "^1.0.3",
"node-addon-api": "^3.2.0",
"prebuild-install": "^6.1.2",
"node-addon-api": "^4.0.0",
"prebuild-install": "^6.1.4",
"semver": "^7.3.5",
"simple-get": "^3.1.0",
"tar-fs": "^2.1.1",
"tunnel-agent": "^0.6.0"
},
"engines": {
"node": ">=10"
"node": ">=12.13.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
@ -11133,13 +11151,30 @@
"dev": true
},
"color": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/color/-/color-4.0.1.tgz",
"integrity": "sha512-rpZjOKN5O7naJxkH2Rx1sZzzBgaiWECc6BYXjeCE6kF0kcASJYbUq02u7JqIHwCb/j3NhV+QhRL2683aICeGZA==",
"dev": true,
"requires": {
"color-convert": "^1.9.3",
"color-convert": "^2.0.1",
"color-string": "^1.6.0"
},
"dependencies": {
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
}
}
},
"color-convert": {
@ -11283,9 +11318,9 @@
"dev": true
},
"core-js": {
"version": "3.16.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.16.1.tgz",
"integrity": "sha512-AAkP8i35EbefU+JddyWi12AWE9f2N/qr/pwnDtWz4nyUIBGMJPX99ANFFRSw6FefM374lDujdtLDyhN2A/btHw==",
"version": "3.16.2",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.16.2.tgz",
"integrity": "sha512-P0KPukO6OjMpjBtHSceAZEWlDD1M2Cpzpg6dBbrjFqFhBHe/BwhxaP820xKOjRn/lZRQirrCusIpLS/n2sgXLQ==",
"dev": true
},
"core-js-compat": {
@ -13604,9 +13639,9 @@
}
},
"node-addon-api": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz",
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.0.0.tgz",
"integrity": "sha512-ALmRVBFzfwldBfk3SbKfl6+PVMXiCPKZBEfsJqB/EjXAMAI+MfFrEHR+GMRBuI162DihZ1QjEZ8ieYKuRCJ8Hg==",
"dev": true
},
"node-fetch": {
@ -14133,9 +14168,9 @@
}
},
"prebuild-install": {
"version": "6.1.3",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.3.tgz",
"integrity": "sha512-iqqSR84tNYQUQHRXalSKdIaM8Ov1QxOVuBNWI7+BzZWv6Ih9k75wOnH1rGQ9WWTaaLkTpxWKIciOF0KyfM74+Q==",
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.4.tgz",
"integrity": "sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ==",
"dev": true,
"requires": {
"detect-libc": "^1.0.3",
@ -14830,15 +14865,15 @@
"dev": true
},
"sharp": {
"version": "0.28.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.28.3.tgz",
"integrity": "sha512-21GEP45Rmr7q2qcmdnjDkNP04Ooh5v0laGS5FDpojOO84D1DJwUijLiSq8XNNM6e8aGXYtoYRh3sVNdm8NodMA==",
"version": "0.29.0",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.29.0.tgz",
"integrity": "sha512-mdN1Up0eN+SwyForPls59dWO0nx64J1XRQYy5ZiKSADAccGYCB10UAGJHSVG9VObzJdhHqrVJzQcq6gx8USyoA==",
"dev": true,
"requires": {
"color": "^3.1.3",
"color": "^4.0.1",
"detect-libc": "^1.0.3",
"node-addon-api": "^3.2.0",
"prebuild-install": "^6.1.2",
"node-addon-api": "^4.0.0",
"prebuild-install": "^6.1.4",
"semver": "^7.3.5",
"simple-get": "^3.1.0",
"tar-fs": "^2.1.1",

4
package.json

@ -63,7 +63,7 @@
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-replace": "^3.0.0",
"chai": "^4.3.4",
"core-js": "^3.16.1",
"core-js": "^3.16.2",
"husky": "^7.0.1",
"karma": "^6.3.4",
"karma-chai": "^0.1.0",
@ -81,7 +81,7 @@
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-terser": "^7.0.2",
"sass": "1.38.0",
"sharp": "^0.28.3"
"sharp": "^0.29.0"
},
"browserslist": [
">0.2%",

2
rollup.config.js

@ -11,7 +11,7 @@ import filesize from "rollup-plugin-filesize";
import pkg from "./package.json";
const config = [];
const files = ["Panzoom", "Panzoom.Controls", "Carousel", "Fancybox"];
const files = ["Panzoom", "Panzoom.Controls", "Carousel", "Carousel.Autoplay", "Fancybox"];
for (const file_name of files) {
let input_file;

2
src/Carousel/Carousel.js

@ -487,6 +487,8 @@ export class Carousel extends Base {
to: 0,
};
}
this.Panzoom.handleCursor();
}
manageSlideVisiblity() {

99
src/Carousel/plugins/Autoplay/Autoplay.js

@ -0,0 +1,99 @@
import { isPlainObject } from "../../../shared/utils/isPlainObject.js";
const defaults = {
timeout: 3000,
hoverPause: true,
};
export class Autoplay {
constructor(carousel) {
this.carousel = carousel;
this.state = "ready";
for (const methodName of ["onReady", "onSettle", "onMouseEnter", "onMouseLeave"]) {
this[methodName] = this[methodName].bind(this);
}
this.events = {
ready: this.onReady,
settle: this.onSettle,
};
}
onReady() {
this.start();
}
onSettle() {
if (this.state === "play") {
this.set();
}
}
onMouseEnter() {
if (this.state === "play") {
this.state = "pause";
this.clear();
}
}
onMouseLeave() {
if (this.state === "pause") {
this.state = "play";
this.set();
}
}
set() {
this.clear();
this.timer = setTimeout(() => {
if (this.state === "play") {
this.carousel.slideTo(this.carousel.pageIndex + 1);
}
}, this.carousel.option("Autoplay.timeout"));
}
clear() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
}
start() {
this.set();
this.state = "play";
if (this.carousel.option("Autoplay.hoverPause")) {
this.carousel.$container.addEventListener("mouseenter", this.onMouseEnter, false);
this.carousel.$container.addEventListener("mouseleave", this.onMouseLeave, false);
}
}
stop() {
this.clear();
this.state = "ready";
this.carousel.$container.removeEventListener("mouseenter", this.onMouseEnter, false);
this.carousel.$container.removeEventListener("mouseleave", this.onMouseLeave, false);
}
attach() {
this.carousel.on(this.events);
}
detach() {
this.stop();
this.carousel.off(this.events);
this.carousel = null;
}
}
// Expose defaults
Autoplay.defaults = defaults;
if (typeof Carousel !== "undefined" && isPlainObject(Carousel.Plugins)) {
Carousel.Plugins.Autoplay = Autoplay;
}

4
src/Fancybox/Fancybox.js

@ -137,7 +137,9 @@ class Fancybox extends Base {
this.$container.setAttribute("aria-hidden", "false");
// Focus on the first focus element in this instance
this.focus();
if (this.option("trapFocus")) {
this.focus();
}
}
/**

2
src/Fancybox/plugins/Image/Image.scss

@ -2,7 +2,7 @@
transform-origin: 0 0;
touch-action: none;
user-select: none;
transition: unset;
transition: none;
}
.has-image {

13
src/Panzoom/Panzoom.js

@ -121,8 +121,6 @@ export class Panzoom extends Base {
this.trigger("ready");
if (this.option("centerOnStart") === false) {
this.handleCursor();
this.state = "ready";
} else {
this.panTo({
@ -669,12 +667,15 @@ export class Panzoom extends Base {
const containerRect = $viewport == $container ? viewportRect : $container.getBoundingClientRect();
this.viewport = { ...this.viewport, width: viewportRect.width, height: viewportRect.height };
let viewportWidth = Math.max($viewport.offsetWidth, round(viewportRect.width));
let viewportHeight = Math.max($viewport.offsetHeight, round(viewportRect.height));
var styles = window.getComputedStyle($viewport);
let viewportStyles = window.getComputedStyle($viewport);
viewportWidth -= parseFloat(viewportStyles.paddingLeft) + parseFloat(viewportStyles.paddingRight);
viewportHeight -= parseFloat(viewportStyles.paddingTop) + parseFloat(viewportStyles.paddingBottom);
this.viewport.width -= parseFloat(styles.paddingLeft) + parseFloat(styles.paddingRight);
this.viewport.height -= parseFloat(styles.paddingTop) + parseFloat(styles.paddingBottom);
this.viewport.width = viewportWidth;
this.viewport.height = viewportHeight;
if (contentIsZoomable) {
if (Math.abs(origWidth - contentRect.width) > 0.1 || Math.abs(origHeight - contentRect.height) > 0.1) {

8
src/Panzoom/plugins/Controls/Controls.js

@ -1,3 +1,5 @@
import { isPlainObject } from "../../../shared/utils/isPlainObject.js";
const defaults = {
l10n: {
ZOOMIN: "Zoom in",
@ -13,7 +15,7 @@ const defaults = {
},
};
class Controls {
export class Controls {
constructor(panzoom) {
this.panzoom = panzoom;
@ -90,4 +92,6 @@ class Controls {
// Expose defaults
Controls.defaults = defaults;
export { Controls };
if (typeof Panzoom !== "undefined" && isPlainObject(Panzoom.Plugins)) {
Panzoom.Plugins.Controls = Controls;
}

2
src/Panzoom/scss/base.scss

@ -27,7 +27,7 @@
transform: translate3d(0, 0, 0) scale(1);
transform-origin: 0 0;
transition: unset;
transition: none;
/* Disable default manipulations by a touchscreen user. For example, zooming features built into the browser */
touch-action: none;

Loading…
Cancel
Save