Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nrk/core-scroll

Package Overview
Dependencies
Maintainers
133
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nrk/core-scroll - npm Package Compare versions

Comparing version 4.1.3 to 4.1.4

14

core-scroll.cjs.js
'use strict';
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {

@@ -160,5 +162,3 @@ _typeof = function (obj) {

if (!IS_BROWSER && !global.HTMLElement) {
global.HTMLElement =
/*#__PURE__*/
function () {
global.HTMLElement = /*#__PURE__*/function () {
function _class() {

@@ -328,5 +328,3 @@ _classCallCheck(this, _class);

var CoreScroll =
/*#__PURE__*/
function (_HTMLElement) {
var CoreScroll = /*#__PURE__*/function (_HTMLElement) {
_inherits(CoreScroll, _HTMLElement);

@@ -471,6 +469,8 @@

return CoreScroll;
}(_wrapNativeSuper(HTMLElement));
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
function onMousedown(event) {
if (closest(event.target, NEEDS_MOUSEDOWN)) return;
if (event.button !== 0) return; // Only react to left clicking
event.preventDefault(); // Prevent text selection and enable nesting

@@ -477,0 +477,0 @@

@@ -112,2 +112,3 @@ import { IS_BROWSER, addStyle, closest, dispatchEvent, throttle, getUUID, queryAll } from '../utils'

if (closest(event.target, NEEDS_MOUSEDOWN)) return
if (event.button !== 0) return // Only react to left clicking
event.preventDefault() // Prevent text selection and enable nesting

@@ -114,0 +115,0 @@

@@ -7,5 +7,7 @@ (function (global, factory) {

React = React && React.hasOwnProperty('default') ? React['default'] : React;
React = React && Object.prototype.hasOwnProperty.call(React, 'default') ? React['default'] : React;
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {

@@ -167,5 +169,3 @@ _typeof = function (obj) {

if (!IS_BROWSER && !global.HTMLElement) {
global.HTMLElement =
/*#__PURE__*/
function () {
global.HTMLElement = /*#__PURE__*/function () {
function _class() {

@@ -335,5 +335,3 @@ _classCallCheck(this, _class);

var CoreScroll =
/*#__PURE__*/
function (_HTMLElement) {
var CoreScroll = /*#__PURE__*/function (_HTMLElement) {
_inherits(CoreScroll, _HTMLElement);

@@ -478,6 +476,8 @@

return CoreScroll;
}(_wrapNativeSuper(HTMLElement));
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
function onMousedown(event) {
if (closest(event.target, NEEDS_MOUSEDOWN)) return;
if (event.button !== 0) return; // Only react to left clicking
event.preventDefault(); // Prevent text selection and enable nesting

@@ -562,3 +562,3 @@

var version = "4.1.3";
var version = "4.1.4";

@@ -618,5 +618,3 @@ /**

var tagName = (dashCase + "-" + (options.suffix || 'react')).replace(/\W+/g, '-').toLowerCase();
return (
/*@__PURE__*/
function (superclass) {
return (/*@__PURE__*/function (superclass) {
function anonymous(props) {

@@ -623,0 +621,0 @@ var this$1 = this;

@@ -1,3 +0,3 @@

/*! @nrk/core-scroll v4.1.3 - Copyright (c) 2017-2019 NRK */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).coreScroll=e()}(this,function(){"use strict";function u(t){return(u="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 e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t,e,n){return(c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&r(i,n.prototype),i}).apply(null,arguments)}function l(t){var n="function"==typeof Map?new Map:void 0;return(l=function(t){if(null===t||!function(t){return-1!==Function.toString.call(t).indexOf("[native code]")}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return c(t,arguments,i(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r(e,t)})(t)}function n(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var t="undefined"!=typeof window;t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform));t||global.HTMLElement||(global.HTMLElement=function(){return function t(){e(this,t)}}());var s,a,f=(s="undefined"==typeof window?{}:window.Element.prototype,a=s.matches||s.msMatchesSelector||s.webkitMatchesSelector,s.closest?function(t,e){return t.closest(e)}:function(t,e){for(t.correspondingUseElement&&(t=t.correspondingUseElement);t;t=t.parentElement)if(a.call(t,e))return t;return null});function d(t,e,n){var o,i=2<arguments.length&&void 0!==n?n:{},r="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?o=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:i}):(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i);var c=t.dispatchEvent(o);return t[r]=null,c}function h(t,e){var n=1<arguments.length&&void 0!==e?e:document;if(t){if(t.nodeType)return[t];if("string"==typeof t)return[].slice.call(n.querySelectorAll(t));if(t.length)return[].slice.call(t)}return[]}var p={},m={up:{y:-1,prop:"top"},down:{y:1,prop:"bottom"},left:{x:-1},right:{x:1}},v=10,y=function(t){var e=0<arguments.length&&void 0!==t&&t;try{window.addEventListener("test",null,{get passive(){e={passive:!0}}})}catch(t){}return e}(),g=t&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion)").matches,b=t&&(window.requestAnimationFrame||window.setTimeout);function w(t){p.diffX=p.pageX-(p.pageX=t.pageX),p.diffY=p.pageY-(p.pageY=t.pageY),p.diffSumX+=p.diffX,p.diffSumY+=p.diffY,p.target.scrollLeft=p.scrollX+=p.diffX,p.target.scrollTop=p.scrollY+=p.diffY,Math.max(Math.abs(p.diffSumX),Math.abs(p.diffSumY))>v&&(p.target.style.pointerEvents="none")}function E(t){var e=Math.abs(p.diffX||p.diffY)>v?20:0;document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",E),document.body.style.cursor="",e&&p.target.scroll({x:p.scrollX+p.diffX*e,y:p.scrollY+p.diffY*e}),p.target.style.pointerEvents="",p.target.style.cursor="-webkit-grab",p.target.style.cursor="grab",p.target=null}return function(){function t(){return e(this,t),n(this,i(t).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}(t,l(HTMLElement)),function(t,e,n){e&&o(t.prototype,e),n&&o(t,n)}(t,[{key:"connectedCallback",value:function(){var t=this;!function(t,e){var n="style-".concat(t.toLowerCase()),o=e.replace(/\/\*[^!][^*]*\*\//g,"").replace(/\s*(^|[:;,{}]|$)\s*/g,"$1");document.getElementById(n)||document.head.insertAdjacentHTML("afterbegin",'<style id="'.concat(n,'">').concat(o,"</style>"))}(this.nodeName,"\n ".concat(this.nodeName,"{display:block}\n ").concat(this.nodeName,"::-webkit-scrollbar{display:none}\n ")),this.style.overflow="scroll",this.style.willChange="scroll-position",this.style.webkitOverflowScrolling="touch";var e=this.offsetWidth-this.clientWidth,n=this.offsetHeight-this.clientHeight;this.style.marginRight="-".concat(e,"px"),this.style.marginBottom="-".concat(n,"px"),this.style.maxHeight="calc(100% + ".concat(n,"px)"),this._throttledEvent=function(o,i){var r;return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];r=r||setTimeout(function(){o.apply(this,e),r=null},i)}}(this.handleEvent.bind(this),500),this.addEventListener("mousedown",this),this.addEventListener("wheel",this,y),this.addEventListener("scroll",this._throttledEvent,y),window.addEventListener("resize",this._throttledEvent,y),window.addEventListener("load",this),document.addEventListener("click",this),setTimeout(function(){return t.handleEvent()})}},{key:"disconnectedCallback",value:function(){this._throttledEvent=null,this.removeEventListener("mousedown",this),this.removeEventListener("wheel",this,y),this.removeEventListener("scroll",this._throttledEvent,y),window.removeEventListener("resize",this._throttledEvent,y),window.removeEventListener("load",this),document.removeEventListener("click",this)}},{key:"handleEvent",value:function(t){var e=0<arguments.length&&void 0!==t?t:{};if(!e.defaultPrevented)if("wheel"===e.type)p.animate=!1;else if("mousedown"===e.type)(function(t){if(f(t.target,'[contenteditable="true"],input,select,textarea'))return;t.preventDefault(),p.pageX=t.pageX,p.pageY=t.pageY,p.diffSumX=0,p.diffSumY=0,p.animate=p.diffX=p.diffY=0,p.scrollX=this.scrollLeft,p.scrollY=this.scrollTop,p.target=this,document.body.style.cursor=this.style.cursor="-webkit-grabbing",document.body.style.cursor=this.style.cursor="grabbing",document.addEventListener("mousemove",w),document.addEventListener("mouseup",E)}).call(this,e);else if("click"===e.type){var n=this.id&&f(e.target,'[for="'.concat(this.id,'"]'));n&&d(this,"scroll.click",{move:n.value})&&this.scroll(n.value)}else{var o={left:this.scrollLeft,up:this.scrollTop,right:this.scrollRight,down:this.scrollBottom},i=o.left||o.right||o.up||o.down?"grab":"";h(this.id&&'[for="'.concat(this.id,'"]')).forEach(function(t){return t.disabled=!o[t.value]}),d(this,"scroll.change"),e.type||(this.style.cursor="-webkit-".concat(i),this.style.cursor=i)}}},{key:"scroll",value:function(t){var e=this,n=function(t,o){var i="object"===u(o)?o:{move:o};"number"!=typeof i.x&&(i.x=t.scrollLeft);"number"!=typeof i.y&&(i.y=t.scrollTop);if(i.move=m[i.move]){var r=i.move.x?"x":"y",c=i.move.x?"left":"top",e=t.getBoundingClientRect(),l=e[c]-t[i.move.x?"scrollLeft":"scrollTop"],s=e[c]+e[i.move.x?"width":"height"]*i.move[r];t.items.every(function(t){var e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView.getComputedStyle(t)["margin-".concat(c)];return i[r]=e[c]-parseInt(n,10)-l,e[i.move.prop||o]<s})}return{x:Math.max(0,Math.min(i.x,t.scrollWidth-t.clientWidth)),y:Math.max(0,Math.min(i.y,t.scrollHeight-t.clientHeight))}}(this,t),o=n.x,i=n.y,r=p.animate=Date.now().toString(36)+Math.random().toString(36).slice(2,5),c=this.friction,l=g?1:o-this.scrollLeft,s=g?1:i-this.scrollTop;!function t(){p.animate===r&&(Math.round(l)||Math.round(s))&&(e.scrollLeft=o-Math.round(l*=c),e.scrollTop=i-Math.round(s*=c),b(t))}()}},{key:"items",get:function(){return h(this.getAttribute("items")||this.children,this)},set:function(t){this.setAttribute("items",t||"")}},{key:"scrollRight",get:function(){return this.scrollWidth-this.clientWidth-this.scrollLeft}},{key:"scrollBottom",get:function(){return this.scrollHeight-this.clientHeight-this.scrollTop}},{key:"friction",get:function(){return Math.min(.99,this.getAttribute("friction"))||.8},set:function(t){this.setAttribute("friction",t)}}]),t}()}),window.customElements.define("core-scroll",coreScroll);
/*! @nrk/core-scroll v4.1.4 - Copyright (c) 2017-2020 NRK */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).coreScroll=e()}(this,function(){"use strict";function u(t){return(u="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 i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t,e,n){return(c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&s(i,n.prototype),i}).apply(null,arguments)}function a(t){var o="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;var e;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==o){if(o.has(t))return o.get(t);o.set(t,n)}function n(){return c(t,arguments,l(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,t)})(t)}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var t="undefined"!=typeof window;t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform));t||global.HTMLElement||(global.HTMLElement=function(){return function t(){i(this,t)}}());var e,n,d=(e="undefined"==typeof window?{}:window.Element.prototype,n=e.matches||e.msMatchesSelector||e.webkitMatchesSelector,e.closest?function(t,e){return t.closest(e)}:function(t,e){for(t.correspondingUseElement&&(t=t.correspondingUseElement);t;t=t.parentElement)if(n.call(t,e))return t;return null});function h(t,e,n){var o,i=2<arguments.length&&void 0!==n?n:{},r="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?o=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:i}):(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i);var l=t.dispatchEvent(o);return t[r]=null,l}function p(t,e){var n=1<arguments.length&&void 0!==e?e:document;if(t){if(t.nodeType)return[t];if("string"==typeof t)return[].slice.call(n.querySelectorAll(t));if(t.length)return[].slice.call(t)}return[]}var m={},v={up:{y:-1,prop:"top"},down:{y:1,prop:"bottom"},left:{x:-1},right:{x:1}},o=10,y=function(t){var e=0<arguments.length&&void 0!==t&&t;try{window.addEventListener("test",null,{get passive(){e={passive:!0}}})}catch(t){}return e}(),g=t&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion)").matches,b=t&&(window.requestAnimationFrame||window.setTimeout);function w(t){m.diffX=m.pageX-(m.pageX=t.pageX),m.diffY=m.pageY-(m.pageY=t.pageY),m.diffSumX+=m.diffX,m.diffSumY+=m.diffY,m.target.scrollLeft=m.scrollX+=m.diffX,m.target.scrollTop=m.scrollY+=m.diffY,Math.max(Math.abs(m.diffSumX),Math.abs(m.diffSumY))>o&&(m.target.style.pointerEvents="none")}function E(t){var e=Math.abs(m.diffX||m.diffY)>o?20:0;document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",E),document.body.style.cursor="",e&&m.target.scroll({x:m.scrollX+m.diffX*e,y:m.scrollY+m.diffY*e}),m.target.style.pointerEvents="",m.target.style.cursor="-webkit-grab",m.target.style.cursor="grab",m.target=null}return function(){function t(){return i(this,t),f(this,l(t).apply(this,arguments))}var e,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(t,a(HTMLElement)),e=t,(n=[{key:"connectedCallback",value:function(){var t,e,n,o,i=this;t=this.nodeName,e="\n ".concat(this.nodeName,"{display:block}\n ").concat(this.nodeName,"::-webkit-scrollbar{display:none}\n "),n="style-".concat(t.toLowerCase()),o=e.replace(/\/\*[^!][^*]*\*\//g,"").replace(/\s*(^|[:;,{}]|$)\s*/g,"$1"),document.getElementById(n)||document.head.insertAdjacentHTML("afterbegin",'<style id="'.concat(n,'">').concat(o,"</style>")),this.style.overflow="scroll",this.style.willChange="scroll-position",this.style.webkitOverflowScrolling="touch";var r,l,s,c=this.offsetWidth-this.clientWidth,u=this.offsetHeight-this.clientHeight;this.style.marginRight="-".concat(c,"px"),this.style.marginBottom="-".concat(u,"px"),this.style.maxHeight="calc(100% + ".concat(u,"px)"),this._throttledEvent=(r=this.handleEvent.bind(this),l=500,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];s=s||setTimeout(function(){r.apply(this,e),s=null},l)}),this.addEventListener("mousedown",this),this.addEventListener("wheel",this,y),this.addEventListener("scroll",this._throttledEvent,y),window.addEventListener("resize",this._throttledEvent,y),window.addEventListener("load",this),document.addEventListener("click",this),setTimeout(function(){return i.handleEvent()})}},{key:"disconnectedCallback",value:function(){this._throttledEvent=null,this.removeEventListener("mousedown",this),this.removeEventListener("wheel",this,y),this.removeEventListener("scroll",this._throttledEvent,y),window.removeEventListener("resize",this._throttledEvent,y),window.removeEventListener("load",this),document.removeEventListener("click",this)}},{key:"handleEvent",value:function(t){var e=0<arguments.length&&void 0!==t?t:{};if(!e.defaultPrevented)if("wheel"===e.type)m.animate=!1;else if("mousedown"===e.type)(function(t){if(d(t.target,'[contenteditable="true"],input,select,textarea'))return;if(0!==t.button)return;t.preventDefault(),m.pageX=t.pageX,m.pageY=t.pageY,m.diffSumX=0,m.diffSumY=0,m.animate=m.diffX=m.diffY=0,m.scrollX=this.scrollLeft,m.scrollY=this.scrollTop,m.target=this,document.body.style.cursor=this.style.cursor="-webkit-grabbing",document.body.style.cursor=this.style.cursor="grabbing",document.addEventListener("mousemove",w),document.addEventListener("mouseup",E)}).call(this,e);else if("click"===e.type){var n=this.id&&d(e.target,'[for="'.concat(this.id,'"]'));n&&h(this,"scroll.click",{move:n.value})&&this.scroll(n.value)}else{var o={left:this.scrollLeft,up:this.scrollTop,right:this.scrollRight,down:this.scrollBottom},i=o.left||o.right||o.up||o.down?"grab":"";p(this.id&&'[for="'.concat(this.id,'"]')).forEach(function(t){return t.disabled=!o[t.value]}),h(this,"scroll.change"),e.type||(this.style.cursor="-webkit-".concat(i),this.style.cursor=i)}}},{key:"scroll",value:function(t){var e=this,n=function(t,o){var i="object"===u(o)?o:{move:o};"number"!=typeof i.x&&(i.x=t.scrollLeft);"number"!=typeof i.y&&(i.y=t.scrollTop);if(i.move=v[i.move]){var r=i.move.x?"x":"y",l=i.move.x?"left":"top",e=t.getBoundingClientRect(),s=e[l]-t[i.move.x?"scrollLeft":"scrollTop"],c=e[l]+e[i.move.x?"width":"height"]*i.move[r];t.items.every(function(t){var e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView.getComputedStyle(t)["margin-".concat(l)];return i[r]=e[l]-parseInt(n,10)-s,e[i.move.prop||o]<c})}return{x:Math.max(0,Math.min(i.x,t.scrollWidth-t.clientWidth)),y:Math.max(0,Math.min(i.y,t.scrollHeight-t.clientHeight))}}(this,t),o=n.x,i=n.y,r=m.animate=Date.now().toString(36)+Math.random().toString(36).slice(2,5),l=this.friction,s=g?1:o-this.scrollLeft,c=g?1:i-this.scrollTop;!function t(){m.animate===r&&(Math.round(s)||Math.round(c))&&(e.scrollLeft=o-Math.round(s*=l),e.scrollTop=i-Math.round(c*=l),b(t))}()}},{key:"items",get:function(){return p(this.getAttribute("items")||this.children,this)},set:function(t){this.setAttribute("items",t||"")}},{key:"scrollRight",get:function(){return this.scrollWidth-this.clientWidth-this.scrollLeft}},{key:"scrollBottom",get:function(){return this.scrollHeight-this.clientHeight-this.scrollTop}},{key:"friction",get:function(){return Math.min(.99,this.getAttribute("friction"))||.8},set:function(t){this.setAttribute("friction",t)}}])&&r(e.prototype,n),o&&r(e,o),t}()}),window.customElements.define("core-scroll",coreScroll);
//# sourceMappingURL=core-scroll.min.js.map

@@ -8,7 +8,43 @@ 'use strict';

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
var coreScroll = fs.readFileSync(path.resolve(__dirname, 'core-scroll.min.js'), 'utf-8');
var customElements = fs.readFileSync(require.resolve('@webcomponents/custom-elements'), 'utf-8');
describe('core-scroll', function () {
beforeEach(function _callee() {
return regeneratorRuntime.async(function _callee$(_context) {
beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {

@@ -18,11 +54,11 @@ switch (_context.prev = _context.next) {

_context.next = 2;
return regeneratorRuntime.awrap(browser.refresh());
return browser.refresh();
case 2:
_context.next = 4;
return regeneratorRuntime.awrap(browser.executeScript(customElements));
return browser.executeScript(customElements);
case 4:
_context.next = 6;
return regeneratorRuntime.awrap(browser.executeScript(coreScroll));
return browser.executeScript(coreScroll);

@@ -34,6 +70,6 @@ case 6:

}
});
});
it('sets up properties', function _callee2() {
return regeneratorRuntime.async(function _callee2$(_context2) {
}, _callee);
})));
it('sets up properties', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {

@@ -43,9 +79,9 @@ switch (_context2.prev = _context2.next) {

_context2.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <button for=\"scroller\" value=\"down\">Down</button>\n <core-scroll id=\"scroller\">\n <div>This is overflowing content</div>\n <div>This is overflowing content</div>\n <div>This is overflowing content</div>\n </core-scroll>\n ";
}));
});
case 2:
_context2.next = 4;
return regeneratorRuntime.awrap(expect($('core-scroll').getCssValue('overflow')).toEqual('scroll'));
return expect($('core-scroll').getCssValue('overflow')).toEqual('scroll');

@@ -57,4 +93,4 @@ case 4:

}
});
});
}, _callee2);
})));
});

@@ -8,2 +8,4 @@ 'use strict';

function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {

@@ -165,5 +167,3 @@ _typeof = function (obj) {

if (!IS_BROWSER && !global.HTMLElement) {
global.HTMLElement =
/*#__PURE__*/
function () {
global.HTMLElement = /*#__PURE__*/function () {
function _class() {

@@ -333,5 +333,3 @@ _classCallCheck(this, _class);

var CoreScroll =
/*#__PURE__*/
function (_HTMLElement) {
var CoreScroll = /*#__PURE__*/function (_HTMLElement) {
_inherits(CoreScroll, _HTMLElement);

@@ -476,6 +474,8 @@

return CoreScroll;
}(_wrapNativeSuper(HTMLElement));
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
function onMousedown(event) {
if (closest(event.target, NEEDS_MOUSEDOWN)) return;
if (event.button !== 0) return; // Only react to left clicking
event.preventDefault(); // Prevent text selection and enable nesting

@@ -560,3 +560,3 @@

var version = "4.1.3";
var version = "4.1.4";

@@ -616,5 +616,3 @@ /**

var tagName = (dashCase + "-" + (options.suffix || 'react')).replace(/\W+/g, '-').toLowerCase();
return (
/*@__PURE__*/
function (superclass) {
return (/*@__PURE__*/function (superclass) {
function anonymous(props) {

@@ -621,0 +619,0 @@ var this$1 = this;

@@ -5,3 +5,3 @@ {

"author": "NRK <opensource@nrk.no> (https://www.nrk.no/)",
"version": "4.1.3",
"version": "4.1.4",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "core-scroll.cjs.js",

@@ -87,4 +87,4 @@ # Core Scroll

this.setState({
left: target.scrollLeft && (() => target.scroll('left')),
right: target.scrollRight && (() => target.scroll('right'))
left: target.scrollLeft ? () => target.scroll('left') : null,
right: target.scrollRight ? () => target.scroll('right') : null
})

@@ -91,0 +91,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc