@bolt/components-smooth-scroll
Advanced tools
Comparing version 0.1.0-alpha.0 to 0.1.0-alpha.2
@@ -1,2 +0,2 @@ | ||
!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/scripts/",t(t.s=0)}([function(e,t,n){"use strict";var o=new(function(e){return e&&e.__esModule?e:{default:e}}(n(1)).default);document.querySelectorAll('a[href*="#"]').forEach(function(e){var t=e,n={ignore:"[data-scroll-ignore]",header:".js-bolt-smooth-scroll-offset",speed:500,offset:0,easing:"easeInOutCubic",before:function(){},after:function(){}},r=t.getAttribute("href");r=r.replace("#","");var i=document.getElementById(r);i&&t.addEventListener("click",function(){o.animateScroll(i,t,n)})})},function(e,t,n){"use strict";(function(n){var o,r;"function"==typeof Symbol&&Symbol.iterator;/*! smooth-scroll v12.1.5 | (c) 2017 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ | ||
!function(n,i){void 0!==(r=function(){return i(n)}.apply(t,o=[]))&&(e.exports=r)}(void 0!==n?n:"undefined"!=typeof window?window:void 0,function(e){var t="querySelector"in document&&"addEventListener"in e&&"requestAnimationFrame"in e&&"closest"in e.Element.prototype,n={ignore:"[data-scroll-ignore]",header:null,speed:500,offset:0,easing:"easeInOutCubic",customEasing:null,before:function(){},after:function(){}},o=function(){for(var e={},t=0,n=arguments.length;t<n;t++){var o=arguments[t];!function(t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}(o)}return e},r=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,i="",a=n.charCodeAt(0);++r<o;){if(0===(t=n.charCodeAt(r)))throw new InvalidCharacterError("Invalid character: the input contains U+0000.");i+=t>=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===a?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+i},i=function(t){return t?function(t){return parseInt(e.getComputedStyle(t).height,10)}(t)+t.offsetTop:0};return function(a,u){var c,l,s,f,d,m,h,p={};p.cancelScroll=function(){cancelAnimationFrame(h)},p.animateScroll=function(t,r,a){var u=o(c||n,a||{}),l="[object Number]"===Object.prototype.toString.call(t),s=l||!t.tagName?null:t;if(l||s){var m=e.pageYOffset;u.header&&!f&&(f=document.querySelector(u.header)),d||(d=i(f));var h,g,y,v=l?t:function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0)}(s,d,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),b=v-m,S=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),E=0,O=function(n,o){var i=e.pageYOffset;if(n==o||i==o||(m<o&&e.innerHeight+i)>=S)return p.cancelScroll(),function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))}(t,o,l),u.after(t,r),h=null,!0},w=function t(n){h||(h=n),g=(E+=n-h)/parseInt(u.speed,10),y=m+b*function(e,t){var n;return"easeInQuad"===e.easing&&(n=t*t),"easeOutQuad"===e.easing&&(n=t*(2-t)),"easeInOutQuad"===e.easing&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e.easing&&(n=t*t*t),"easeOutCubic"===e.easing&&(n=--t*t*t+1),"easeInOutCubic"===e.easing&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e.easing&&(n=t*t*t*t),"easeOutQuart"===e.easing&&(n=1- --t*t*t*t),"easeInOutQuart"===e.easing&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e.easing&&(n=t*t*t*t*t),"easeOutQuint"===e.easing&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e.easing&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),e.customEasing&&(n=e.customEasing(t)),n||t}(u,g=g>1?1:g),e.scrollTo(0,Math.floor(y)),O(y,v)||(e.requestAnimationFrame(t),h=n)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(t,r),p.cancelScroll(),e.requestAnimationFrame(w)}};var g=function(e){l&&(l.id=l.getAttribute("data-scroll-id"),p.animateScroll(l,s),l=null,s=null)},y=function(t){if(!("matchMedia"in e&&e.matchMedia("(prefers-reduced-motion)").matches)&&0===t.button&&!t.metaKey&&!t.ctrlKey&&(s=t.target.closest(a))&&"a"===s.tagName.toLowerCase()&&!t.target.closest(c.ignore)&&s.hostname===e.location.hostname&&s.pathname===e.location.pathname&&/#/.test(s.href)){var n;try{n=r(decodeURIComponent(s.hash))}catch(e){n=r(s.hash)}if("#"===n){t.preventDefault();var o=(l=document.body).id?l.id:"smooth-scroll-top";return l.setAttribute("data-scroll-id",o),l.id="",void(e.location.hash.substring(1)===o?g():e.location.hash=o)}(l=document.querySelector(n))&&(l.setAttribute("data-scroll-id",l.id),l.id="",s.hash===e.location.hash&&(t.preventDefault(),g()))}},v=function(e){m||(m=setTimeout(function(){m=null,d=i(f)},66))};return p.destroy=function(){c&&(document.removeEventListener("click",y,!1),e.removeEventListener("resize",v,!1),p.cancelScroll(),c=null,l=null,s=null,f=null,d=null,m=null,h=null)},p.init=function(r){t&&(p.destroy(),c=o(n,r||{}),f=c.header?document.querySelector(c.header):null,d=i(f),document.addEventListener("click",y,!1),e.addEventListener("hashchange",g,!1),f&&e.addEventListener("resize",v,!1))},p.init(u),p}})}).call(t,n(2))},function(e,t,n){"use strict";var o,r="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};o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":r(window))&&(o=window)}e.exports=o}]); | ||
!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/scripts/",t(t.s=0)}([function(e,t,n){"use strict";var o=new(function(e){return e&&e.__esModule?e:{default:e}}(n(1)).default);document.querySelectorAll('a[href*="#"]').forEach(function(e){var t=e,n={ignore:"[data-scroll-ignore]",header:".js-bolt-smooth-scroll-offset",speed:500,offset:0,easing:"easeInOutCubic",before:function(){},after:function(){}},r=t.getAttribute("href");r=r.replace("#","");var i=document.getElementById(r);i&&t.addEventListener("click",function(){o.animateScroll(i,t,n)})})},function(e,t,n){"use strict";(function(n){var o;"function"==typeof Symbol&&Symbol.iterator;/*! smooth-scroll v12.1.5 | (c) 2017 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ | ||
!function(n,r){void 0===(o=function(){return r(n)}.apply(t,[]))||(e.exports=o)}(void 0!==n?n:"undefined"!=typeof window?window:void 0,function(e){var t="querySelector"in document&&"addEventListener"in e&&"requestAnimationFrame"in e&&"closest"in e.Element.prototype,n={ignore:"[data-scroll-ignore]",header:null,speed:500,offset:0,easing:"easeInOutCubic",customEasing:null,before:function(){},after:function(){}},o=function(){for(var e={},t=0,n=arguments.length;t<n;t++){var o=arguments[t];!function(t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}(o)}return e},r=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,i="",a=n.charCodeAt(0);++r<o;){if(0===(t=n.charCodeAt(r)))throw new InvalidCharacterError("Invalid character: the input contains U+0000.");i+=t>=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===a?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+i},i=function(t){return t?function(t){return parseInt(e.getComputedStyle(t).height,10)}(t)+t.offsetTop:0};return function(a,u){var c,l,s,f,d,m,h,p={};p.cancelScroll=function(){cancelAnimationFrame(h)},p.animateScroll=function(t,r,a){var u=o(c||n,a||{}),l="[object Number]"===Object.prototype.toString.call(t),s=l||!t.tagName?null:t;if(l||s){var m=e.pageYOffset;u.header&&!f&&(f=document.querySelector(u.header)),d||(d=i(f));var h,g,y,v=l?t:function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0)}(s,d,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),b=v-m,S=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),E=0,O=function(n,o){var i=e.pageYOffset;if(n==o||i==o||(m<o&&e.innerHeight+i)>=S)return p.cancelScroll(),function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))}(t,o,l),u.after(t,r),h=null,!0},w=function t(n){h||(h=n),g=(E+=n-h)/parseInt(u.speed,10),y=m+b*function(e,t){var n;return"easeInQuad"===e.easing&&(n=t*t),"easeOutQuad"===e.easing&&(n=t*(2-t)),"easeInOutQuad"===e.easing&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e.easing&&(n=t*t*t),"easeOutCubic"===e.easing&&(n=--t*t*t+1),"easeInOutCubic"===e.easing&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e.easing&&(n=t*t*t*t),"easeOutQuart"===e.easing&&(n=1- --t*t*t*t),"easeInOutQuart"===e.easing&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e.easing&&(n=t*t*t*t*t),"easeOutQuint"===e.easing&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e.easing&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),e.customEasing&&(n=e.customEasing(t)),n||t}(u,g=g>1?1:g),e.scrollTo(0,Math.floor(y)),O(y,v)||(e.requestAnimationFrame(t),h=n)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(t,r),p.cancelScroll(),e.requestAnimationFrame(w)}};var g=function(e){l&&(l.id=l.getAttribute("data-scroll-id"),p.animateScroll(l,s),l=null,s=null)},y=function(t){if(!("matchMedia"in e&&e.matchMedia("(prefers-reduced-motion)").matches)&&0===t.button&&!t.metaKey&&!t.ctrlKey&&(s=t.target.closest(a))&&"a"===s.tagName.toLowerCase()&&!t.target.closest(c.ignore)&&s.hostname===e.location.hostname&&s.pathname===e.location.pathname&&/#/.test(s.href)){var n;try{n=r(decodeURIComponent(s.hash))}catch(e){n=r(s.hash)}if("#"===n){t.preventDefault();var o=(l=document.body).id?l.id:"smooth-scroll-top";return l.setAttribute("data-scroll-id",o),l.id="",void(e.location.hash.substring(1)===o?g():e.location.hash=o)}(l=document.querySelector(n))&&(l.setAttribute("data-scroll-id",l.id),l.id="",s.hash===e.location.hash&&(t.preventDefault(),g()))}},v=function(e){m||(m=setTimeout(function(){m=null,d=i(f)},66))};return p.destroy=function(){c&&(document.removeEventListener("click",y,!1),e.removeEventListener("resize",v,!1),p.cancelScroll(),c=null,l=null,s=null,f=null,d=null,m=null,h=null)},p.init=function(r){t&&(p.destroy(),c=o(n,r||{}),f=c.header?document.querySelector(c.header):null,d=i(f),document.addEventListener("click",y,!1),e.addEventListener("hashchange",g,!1),f&&e.addEventListener("resize",v,!1))},p.init(u),p}})}).call(t,n(2))},function(e,t,n){"use strict";var o,r="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};o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":r(window))&&(o=window)}e.exports=o}]); |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "0.1.0-alpha.0", | ||
"version": "0.1.0-alpha.2", | ||
"maintainers": [ | ||
@@ -43,3 +43,3 @@ { | ||
"devDependencies": { | ||
"@bolt/build-webpack": "^0.5.0-alpha.0" | ||
"@bolt/build-webpack": "^0.5.0-alpha.2" | ||
}, | ||
@@ -46,0 +46,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10146