@nrk/core-scroll
Advanced tools
@@ -323,14 +323,14 @@ 'use strict'; | ||
| var CoreScoll = | ||
| var CoreScroll = | ||
| /*#__PURE__*/ | ||
| function (_HTMLElement) { | ||
| _inherits(CoreScoll, _HTMLElement); | ||
| _inherits(CoreScroll, _HTMLElement); | ||
| function CoreScoll() { | ||
| _classCallCheck(this, CoreScoll); | ||
| function CoreScroll() { | ||
| _classCallCheck(this, CoreScroll); | ||
| return _possibleConstructorReturn(this, _getPrototypeOf(CoreScoll).apply(this, arguments)); | ||
| return _possibleConstructorReturn(this, _getPrototypeOf(CoreScroll).apply(this, arguments)); | ||
| } | ||
| _createClass(CoreScoll, [{ | ||
| _createClass(CoreScroll, [{ | ||
| key: "connectedCallback", | ||
@@ -465,3 +465,3 @@ value: function connectedCallback() { | ||
| return CoreScoll; | ||
| return CoreScroll; | ||
| }(_wrapNativeSuper(HTMLElement)); | ||
@@ -550,2 +550,2 @@ | ||
| module.exports = CoreScoll; | ||
| module.exports = CoreScroll; |
+1
-1
@@ -16,3 +16,3 @@ import { IS_BROWSER, addStyle, closest, dispatchEvent, throttle, getUUID, queryAll } from '../utils' | ||
| export default class CoreScoll extends HTMLElement { | ||
| export default class CoreScroll extends HTMLElement { | ||
| connectedCallback () { | ||
@@ -19,0 +19,0 @@ // Hide scrollbar in WebKit and default to display block |
@@ -329,14 +329,14 @@ (function (global, factory) { | ||
| var CoreScoll = | ||
| var CoreScroll = | ||
| /*#__PURE__*/ | ||
| function (_HTMLElement) { | ||
| _inherits(CoreScoll, _HTMLElement); | ||
| _inherits(CoreScroll, _HTMLElement); | ||
| function CoreScoll() { | ||
| _classCallCheck(this, CoreScoll); | ||
| function CoreScroll() { | ||
| _classCallCheck(this, CoreScroll); | ||
| return _possibleConstructorReturn(this, _getPrototypeOf(CoreScoll).apply(this, arguments)); | ||
| return _possibleConstructorReturn(this, _getPrototypeOf(CoreScroll).apply(this, arguments)); | ||
| } | ||
| _createClass(CoreScoll, [{ | ||
| _createClass(CoreScroll, [{ | ||
| key: "connectedCallback", | ||
@@ -471,3 +471,3 @@ value: function connectedCallback() { | ||
| return CoreScoll; | ||
| return CoreScroll; | ||
| }(_wrapNativeSuper(HTMLElement)); | ||
@@ -556,3 +556,3 @@ | ||
| var version = "4.1.1"; | ||
| var version = "4.1.2"; | ||
@@ -697,3 +697,3 @@ /** | ||
| var coreScroll = customElementToReact(CoreScoll, { | ||
| var coreScroll = customElementToReact(CoreScroll, { | ||
| customEvents: ['scroll.change', 'scroll.click'], | ||
@@ -700,0 +700,0 @@ suffix: version |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"core-scroll.jsx.js","sources":["../utils.js","core-scroll.js","../../node_modules/@nrk/custom-element-to-react/lib/custom-element-to-react.mjs","core-scroll.jsx"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined'\nexport const IS_ANDROID = IS_BROWSER && /(android)/i.test(navigator.userAgent) // Bad, but needed\nexport const IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform))\n\n// Mock HTMLElement for Node\nif (!IS_BROWSER && !global.HTMLElement) {\n global.HTMLElement = class {}\n}\n\n/**\n* addEvent\n* @param {String} nodeName An unique ID of the event to bind - ensurnes single instance\n* @param {String} type The type of event to bind\n* @param {Function} handler The function to call on event\n* @param {Boolean|Object} options useCapture or options object for addEventListener. Defaults to false\n*/\nexport function addEvent (nodeName, type, handler, options = false, key) {\n if (!IS_BROWSER || window[key = `event-${nodeName}-${type}`]) return // Ensure single instance\n const node = (type === 'resize' || type === 'load') ? window : document\n node.addEventListener(window[key] = type, (event) => (event.nodeName = nodeName) && handler(event), options)\n}\n\n/**\n* addStyle\n* @param {String} nodeName An unique ID of the event to bind - ensurnes single instance\n* @param {String} css The css to inject\n*/\nexport function addStyle (nodeName, css) {\n const key = `style-${nodeName.toLowerCase()}`\n const min = css.replace(/\\/\\*[^!][^*]*\\*\\//g, '').replace(/\\s*(^|[:;,{}]|$)\\s*/g, '$1')\n document.getElementById(key) || document.head.insertAdjacentHTML('afterbegin', `<style id=\"${key}\">${min}</style>`)\n}\n\n/**\n* escapeHTML\n* @param {String} str A string with potential html tokens\n* @return {String} Escaped HTML string according to OWASP recommendation\n*/\nconst ESCAPE_MAP = { '&': '&', '<': '<', '>': '>', '\"': '"', '/': '/', '\\'': ''' }\nexport function escapeHTML (str) {\n return String(str || '').replace(/[&<>\"'/]/g, (char) => ESCAPE_MAP[char])\n}\n\n/**\n* closest\n* @param {Element} element Element to traverse up from\n* @param {String} selector A selector to search for matching parents or element itself\n* @return {Element|null} Element which is the closest ancestor matching selector\n*/\nexport const closest = (() => {\n const proto = typeof window === 'undefined' ? {} : window.Element.prototype\n const match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector\n return proto.closest ? (el, css) => el.closest(css) : (el, css) => {\n for (;el; el = el.parentElement) if (match.call(el, css)) return el\n return null\n }\n})()\n\n/**\n* dispatchEvent - with infinite loop prevention\n* @param {Element} elem The target object\n* @param {String} name The source object(s)\n* @param {Object} detail Detail object (bubbles and cancelable is set to true)\n* @return {Boolean} Whether the event was canceled\n*/\nexport function dispatchEvent (element, name, detail = {}) {\n const ignore = `prevent_recursive_dispatch_maximum_callstack${name}`\n let event\n\n if (element[ignore]) return true // We are already processing this event, so skip sending a new one\n else element[ignore] = true // Add name to dispatching ignore\n\n if (typeof window.CustomEvent === 'function') {\n event = new window.CustomEvent(name, { bubbles: true, cancelable: true, detail })\n } else {\n event = document.createEvent('CustomEvent')\n event.initCustomEvent(name, true, true, detail)\n }\n // IE reports incorrect event.defaultPrevented\n // but correct return value on element.dispatchEvent\n const result = element.dispatchEvent(event)\n element[ignore] = null // Remove name from dispatching ignore\n\n return result // Follow W3C standard for return value\n}\n\n/**\n* getUUID\n* @return {String} A generated unique ID\n*/\nexport function getUUID () {\n return Date.now().toString(36) + Math.random().toString(36).slice(2, 5)\n}\n\n/**\n * throttle\n * @param {Function} callback The new throttled function\n * @param {Number} ms The threshold of milliseconds between each callback\n */\nexport function throttle (callback, ms) {\n let timer\n return function (...args) {\n if (!timer) {\n timer = setTimeout(function () {\n callback.apply(this, args)\n timer = null\n }, ms)\n }\n }\n}\n\n/**\n * toggleAttribute (Ponyfill for IE and Edge, fixes #299)\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute\n * @param {Element} el Single DOM Element\n * @param {String} name The name of the attribute to be toggled\n * @param {Boolean} force Force attribute to be added or removed regardless of previous state\n */\nexport function toggleAttribute (el, name, force = !this.hasAttribute(name)) {\n if (!force === el.hasAttribute(name)) el[force ? 'setAttribute' : 'removeAttribute'](name, '')\n return force\n}\n\n/**\n* queryAll\n* @param {String|NodeList|Array|Element} elements A CSS selector string, nodeList, element array, or single element\n* @param {Element} context Node to look for elements within\n* @return {Element[]} Array of elements\n*/\nexport function queryAll (elements, context = document) {\n if (elements) {\n if (elements.nodeType) return [elements]\n if (typeof elements === 'string') return [].slice.call(context.querySelectorAll(elements))\n if (elements.length) return [].slice.call(elements)\n }\n return []\n}\n","import { IS_BROWSER, addStyle, closest, dispatchEvent, throttle, getUUID, queryAll } from '../utils'\n\nconst DRAG = {}\nconst MOVE = { up: { y: -1, prop: 'top' }, down: { y: 1, prop: 'bottom' }, left: { x: -1 }, right: { x: 1 } }\nconst MOVE_SIGNIFICANT = 10\nconst NEEDS_MOUSEDOWN = '[contenteditable=\"true\"],input,select,textarea'\nconst EVENT_PASSIVE = ((has = false) => {\n try { window.addEventListener('test', null, { get passive () { has = { passive: true } } }) } catch (e) {}\n return has\n})()\n\n// https://css-tricks.com/introduction-reduced-motion-media-query/\nconst requestJumps = IS_BROWSER && window.matchMedia && window.matchMedia('(prefers-reduced-motion)').matches\nconst requestFrame = IS_BROWSER && (window.requestAnimationFrame || window.setTimeout)\n\nexport default class CoreScoll extends HTMLElement {\n connectedCallback () {\n // Hide scrollbar in WebKit and default to display block\n addStyle(this.nodeName, `\n ${this.nodeName}{display:block}\n ${this.nodeName}::-webkit-scrollbar{display:none}\n `)\n\n this.style.overflow = 'scroll' // Ensure visible scrollbars\n this.style.willChange = 'scroll-position' // Enhance performance\n this.style.webkitOverflowScrolling = 'touch' // Momentum scroll on iOS\n\n // Calculate sizes for hiding, must be after setting overflow:scroll\n const barWidth = this.offsetWidth - this.clientWidth\n const barHeight = this.offsetHeight - this.clientHeight\n\n // Also ensure height does not grow higher than parent element\n this.style.marginRight = `-${barWidth}px`\n this.style.marginBottom = `-${barHeight}px`\n this.style.maxHeight = `calc(100% + ${barHeight}px)`\n this._throttledEvent = throttle(this.handleEvent.bind(this), 500)\n\n this.addEventListener('mousedown', this)\n this.addEventListener('wheel', this, EVENT_PASSIVE)\n this.addEventListener('scroll', this._throttledEvent, EVENT_PASSIVE)\n window.addEventListener('resize', this._throttledEvent, EVENT_PASSIVE)\n window.addEventListener('load', this) // Update state when we are sure all CSS is loaded\n document.addEventListener('click', this)\n setTimeout(() => this.handleEvent()) // Initialize buttons after children is parsed\n }\n\n disconnectedCallback () {\n this._throttledEvent = null // Garbage collection\n this.removeEventListener('mousedown', this)\n this.removeEventListener('wheel', this, EVENT_PASSIVE)\n this.removeEventListener('scroll', this._throttledEvent, EVENT_PASSIVE)\n window.removeEventListener('resize', this._throttledEvent, EVENT_PASSIVE)\n window.removeEventListener('load', this)\n document.removeEventListener('click', this)\n }\n\n handleEvent (event = {}) {\n if (event.defaultPrevented) return\n if (event.type === 'wheel') DRAG.animate = false // Stop momentum animation onWheel\n else if (event.type === 'mousedown') onMousedown.call(this, event)\n else if (event.type === 'click') {\n const btn = this.id && closest(event.target, `[for=\"${this.id}\"]`)\n if (btn && dispatchEvent(this, 'scroll.click', { move: btn.value })) this.scroll(btn.value)\n } else {\n const scroll = { left: this.scrollLeft, up: this.scrollTop, right: this.scrollRight, down: this.scrollBottom }\n const cursor = (scroll.left || scroll.right || scroll.up || scroll.down) ? 'grab' : ''\n\n queryAll(this.id && `[for=\"${this.id}\"]`).forEach((el) => (el.disabled = !scroll[el.value]))\n dispatchEvent(this, 'scroll.change')\n\n if (!event.type) { // Do not change cursor while dragging\n this.style.cursor = `-webkit-${cursor}`\n this.style.cursor = cursor\n }\n }\n }\n\n scroll (point) {\n const { x, y } = parsePoint(this, point)\n const uuid = DRAG.animate = getUUID() // Giving the animation an ID to workaround IE timeout issues\n const friction = this.friction\n let moveX = requestJumps ? 1 : x - this.scrollLeft\n let moveY = requestJumps ? 1 : y - this.scrollTop\n\n const move = () => {\n if (DRAG.animate === uuid && (Math.round(moveX) || Math.round(moveY))) {\n this.scrollLeft = x - Math.round(moveX *= friction)\n this.scrollTop = y - Math.round(moveY *= friction)\n requestFrame(move)\n }\n }\n move()\n }\n\n get items () { return queryAll(this.getAttribute('items') || this.children, this) }\n\n // Ensure falsy values becomes ''\n set items (val) { this.setAttribute('items', val || '') }\n\n get scrollRight () { return this.scrollWidth - this.clientWidth - this.scrollLeft }\n\n get scrollBottom () { return this.scrollHeight - this.clientHeight - this.scrollTop }\n\n // Avoid friction 1 (infinite)\n get friction () { return Math.min(0.99, this.getAttribute('friction')) || 0.8 }\n\n set friction (val) { this.setAttribute('friction', val) }\n}\n\nfunction onMousedown (event) {\n if (closest(event.target, NEEDS_MOUSEDOWN)) return\n event.preventDefault() // Prevent text selection and enable nesting\n\n DRAG.pageX = event.pageX\n DRAG.pageY = event.pageY\n DRAG.diffSumX = 0\n DRAG.diffSumY = 0\n DRAG.animate = DRAG.diffX = DRAG.diffY = 0 // Reset\n DRAG.scrollX = this.scrollLeft\n DRAG.scrollY = this.scrollTop\n DRAG.target = this\n\n document.body.style.cursor = this.style.cursor = '-webkit-grabbing'\n document.body.style.cursor = this.style.cursor = 'grabbing'\n document.addEventListener('mousemove', onMousemove)\n document.addEventListener('mouseup', onMouseup)\n}\n\nfunction onMousemove (event) {\n DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX)\n DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY)\n DRAG.diffSumX += DRAG.diffX\n DRAG.diffSumY += DRAG.diffY\n DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX\n DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY\n\n // Prevent links when we know there has been significant movement\n if (Math.max(Math.abs(DRAG.diffSumX), Math.abs(DRAG.diffSumY)) > MOVE_SIGNIFICANT) {\n DRAG.target.style.pointerEvents = 'none'\n }\n}\n\nfunction onMouseup (event) {\n const momentum = Math.abs(DRAG.diffX || DRAG.diffY) > MOVE_SIGNIFICANT ? 20 : 0\n document.removeEventListener('mousemove', onMousemove)\n document.removeEventListener('mouseup', onMouseup)\n document.body.style.cursor = ''\n\n if (momentum) {\n DRAG.target.scroll({\n x: DRAG.scrollX + DRAG.diffX * momentum,\n y: DRAG.scrollY + DRAG.diffY * momentum\n })\n }\n DRAG.target.style.pointerEvents = '' // Allow events again\n DRAG.target.style.cursor = '-webkit-grab'\n DRAG.target.style.cursor = 'grab'\n DRAG.target = null // Prevent memory leak\n}\n\nfunction parsePoint (self, move) {\n const point = typeof move === 'object' ? move : { move }\n if (typeof point.x !== 'number') point.x = self.scrollLeft\n if (typeof point.y !== 'number') point.y = self.scrollTop\n if ((point.move = MOVE[point.move])) {\n const axis = point.move.x ? 'x' : 'y'\n const start = point.move.x ? 'left' : 'top'\n const bounds = self.getBoundingClientRect()\n const scroll = bounds[start] - self[point.move.x ? 'scrollLeft' : 'scrollTop']\n const edge = bounds[start] + bounds[point.move.x ? 'width' : 'height'] * point.move[axis]\n\n self.items.every((el) => { // Use .every as this loop stops on return false\n const rect = el.getBoundingClientRect()\n const marg = el.ownerDocument.defaultView.getComputedStyle(el)[`margin-${start}`]\n\n point[axis] = rect[start] - parseInt(marg, 10) - scroll // Update point to child axis coordinate\n return rect[point.move.prop || move] < edge\n })\n }\n return {\n x: Math.max(0, Math.min(point.x, self.scrollWidth - self.clientWidth)),\n y: Math.max(0, Math.min(point.y, self.scrollHeight - self.clientHeight))\n }\n}\n","import React from 'react';\n\n/**\n* closest\n* @param {Element} element Element to traverse up from\n* @param {String} selector A selector to search for matching parents or element itself\n* @return {Element|null} Element which is the closest ancestor matching selector\n*/\nvar closest = (function () {\n var proto = typeof window === 'undefined' ? {} : window.Element.prototype;\n var match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector;\n return proto.closest ? function (el, css) { return el.closest(css); } : function (el, css) {\n for (;el; el = el.parentElement) { if (match.call(el, css)) { return el } }\n return null\n }\n})();\n\n/**\n* customElementToReact\n* @param {Class|Function} elem A custom element definition.\n* @param {Array} attr Props and events\n* @return {Object} A React component\n*/\nfunction customElementToReact (elementClass, options) {\n if ( options === void 0 ) options = {};\n\n var name = elementClass.name || String(elementClass).match(/function ([^(]+)/)[1]; // String match for IE11\n var dashCase = name.replace(/.[A-Z]/g, function (ref) {\n var a = ref[0];\n var b = ref[1];\n\n return (a + \"-\" + b);\n }); // NameName -> name-name\n var customProps = options.props || [];\n var customEvents = options.customEvents || [];\n var skipProps = customProps.concat('forwardRef'); // Keep a copy with forwardRef added\n var tagName = (dashCase + \"-\" + (options.suffix || 'react')).replace(/\\W+/g, '-').toLowerCase();\n\n return /*@__PURE__*/(function (superclass) {\n function anonymous (props) {\n var this$1 = this;\n\n superclass.call(this, props);\n this.ref = function (el) {\n // Support callback ref https://reactjs.org/docs/refs-and-the-dom.html#callback-refs\n if (typeof this$1.props.forwardRef === 'function') { this$1.props.forwardRef(el); }\n else if (this$1.props.forwardRef) { this$1.props.forwardRef.current = el; }\n return (this$1.el = el)\n };\n customEvents.forEach(function (eventName) {\n var on = \"on\" + (eventName.replace(/(^|\\.)./g, function (m) { return m.slice(-1).toUpperCase(); })); // input.filter => onInputFilter\n this$1[eventName] = function (event) { return this$1.props[on] && closest(event.target, this$1.el.nodeName) === this$1.el && this$1.props[on](event); };\n skipProps.push(on); // Skip props that are customEvents\n });\n }\n\n if ( superclass ) anonymous.__proto__ = superclass;\n anonymous.prototype = Object.create( superclass && superclass.prototype );\n anonymous.prototype.constructor = anonymous;\n\n anonymous.prototype.componentDidMount = function componentDidMount () {\n var this$1 = this;\n\n // Do not run connectedCallback before after React componentDidMount, to allow React hydration to run first\n if (!window.customElements.get(tagName)) { window.customElements.define(tagName, elementClass); }\n\n customProps.forEach(function (key) { return (key in this$1.props) && (this$1.el[key] = this$1.props[key]); });\n customEvents.forEach(function (key) { return this$1.el.addEventListener(key, this$1[key]); });\n };\n\n anonymous.prototype.componentDidUpdate = function componentDidUpdate (prev) {\n var this$1 = this;\n\n customProps.forEach(function (key) { return prev[key] !== this$1.props[key] && (this$1.el[key] = this$1.props[key]); });\n };\n\n anonymous.prototype.componentWillUnmount = function componentWillUnmount () {\n var this$1 = this;\n\n customEvents.forEach(function (eventName) { return this$1.el.removeEventListener(eventName, this$1[eventName]); });\n };\n\n anonymous.prototype.render = function render () {\n var this$1 = this;\n\n // Convert React props to CustomElement props https://github.com/facebook/react/issues/12810\n return React.createElement(tagName, Object.keys(this.props).reduce(function (thisProps, key) {\n if (skipProps.indexOf(key) === -1) { // Do not render customEvents and custom props as attributes\n if (key === 'className') { thisProps.class = this$1.props[key]; } // Fixes className for custom elements\n else if (this$1.props[key] === true) { thisProps[key] = ''; } // Fixes boolean attributes\n else if (this$1.props[key] !== false) { thisProps[key] = this$1.props[key]; } // Pass only truthy, non-function props\n }\n return thisProps\n }, { ref: this.ref }))\n };\n\n return anonymous;\n }(React.Component))\n}\n\nexport default customElementToReact;\n","import CoreScroll from './core-scroll.js'\nimport { version } from './package.json'\nimport customElementToReact from '@nrk/custom-element-to-react'\n\nexport default customElementToReact(CoreScroll, {\n customEvents: ['scroll.change', 'scroll.click'],\n suffix: version\n})\n"],"names":["IS_BROWSER","window","IS_ANDROID","test","navigator","userAgent","IS_IOS","String","platform","global","HTMLElement","addStyle","nodeName","css","key","toLowerCase","min","replace","document","getElementById","head","insertAdjacentHTML","closest","proto","Element","prototype","match","matches","msMatchesSelector","webkitMatchesSelector","el","parentElement","call","dispatchEvent","element","name","detail","ignore","event","CustomEvent","bubbles","cancelable","createEvent","initCustomEvent","result","getUUID","Date","now","toString","Math","random","slice","throttle","callback","ms","timer","args","setTimeout","apply","queryAll","elements","context","nodeType","querySelectorAll","length","DRAG","MOVE","up","y","prop","down","left","x","right","MOVE_SIGNIFICANT","NEEDS_MOUSEDOWN","EVENT_PASSIVE","has","addEventListener","passive","e","requestJumps","matchMedia","requestFrame","requestAnimationFrame","CoreScoll","style","overflow","willChange","webkitOverflowScrolling","barWidth","offsetWidth","clientWidth","barHeight","offsetHeight","clientHeight","marginRight","marginBottom","maxHeight","_throttledEvent","handleEvent","bind","removeEventListener","defaultPrevented","type","animate","onMousedown","btn","id","target","move","value","scroll","scrollLeft","scrollTop","scrollRight","scrollBottom","cursor","forEach","disabled","point","parsePoint","uuid","friction","moveX","moveY","round","getAttribute","children","val","setAttribute","scrollWidth","scrollHeight","preventDefault","pageX","pageY","diffSumX","diffSumY","diffX","diffY","scrollX","scrollY","body","onMousemove","onMouseup","max","abs","pointerEvents","momentum","self","axis","start","bounds","getBoundingClientRect","edge","items","every","rect","marg","ownerDocument","defaultView","getComputedStyle","parseInt","customElementToReact","elementClass","options","dashCase","ref","a","b","customProps","props","customEvents","skipProps","concat","tagName","suffix","superclass","anonymous","this$1","forwardRef","current","eventName","on","m","toUpperCase","push","__proto__","Object","create","constructor","componentDidMount","customElements","get","define","componentDidUpdate","prev","componentWillUnmount","render","React","createElement","keys","reduce","thisProps","indexOf","Component","CoreScroll","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAO,IAAMA,UAAU,GAAG,OAAOC,MAAP,KAAkB,WAArC;AACP,EAAO,IAAMC,UAAU,GAAGF,UAAU,IAAI,aAAaG,IAAb,CAAkBC,SAAS,CAACC,SAA5B,CAAjC;;AACP,EAAO,IAAMC,MAAM,GAAGN,UAAU,IAAI,mBAAmB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KAAjB,EAAwB+B,MAAxB,CAA+B,UAAUC,SAAV,EAAqB7L,GAArB,EAA0B;EAC3F,cAAI+J,SAAS,CAAC+B,OAAV,CAAkB9L,GAAlB,MAA2B,CAAC,CAAhC,EAAmC;EAAE;EACnC,gBAAIA,GAAG,KAAK,WAAZ,EAAyB;EAAE6L,cAAAA,SAAS,SAAT,GAAkBxB,MAAM,CAACR,KAAP,CAAa7J,GAAb,CAAlB;EAAsC,aAAjE;EAAA,iBACK,IAAIqK,MAAM,CAACR,KAAP,CAAa7J,GAAb,MAAsB,IAA1B,EAAgC;EAAE6L,gBAAAA,SAAS,CAAC7L,GAAD,CAAT,GAAiB,EAAjB;EAAsB,eAAxD;EAAA,mBACA,IAAIqK,MAAM,CAACR,KAAP,CAAa7J,GAAb,MAAsB,KAA1B,EAAiC;EAAE6L,kBAAAA,SAAS,CAAC7L,GAAD,CAAT,GAAiBqK,MAAM,CAACR,KAAP,CAAa7J,GAAb,CAAjB;EAAqC,iBAH5C;;EAIlC;;EACD,iBAAO6L,SAAP;EACD,SAPmC,EAOjC;EAAEpC,UAAAA,GAAG,EAAE,KAAKA;EAAZ,SAPiC,CAA7B,CAAP;EAQD,OAZD;;EAcA,aAAOW,SAAP;EACD,KA3DoB,CA2DnBqB,KAAK,CAACM,SA3Da;EAArB;EA4DD;;AC9FD,mBAAe1C,oBAAoB,CAAC2C,SAAD,EAAa;EAC9ClC,EAAAA,YAAY,EAAE,CAAC,eAAD,EAAkB,cAAlB,CADgC;EAE9CI,EAAAA,MAAM,EAAE+B;EAFsC,CAAb,CAAnC;;;;;;;;"} | ||
| {"version":3,"file":"core-scroll.jsx.js","sources":["../utils.js","core-scroll.js","../../node_modules/@nrk/custom-element-to-react/lib/custom-element-to-react.mjs","core-scroll.jsx"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined'\nexport const IS_ANDROID = IS_BROWSER && /(android)/i.test(navigator.userAgent) // Bad, but needed\nexport const IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform))\n\n// Mock HTMLElement for Node\nif (!IS_BROWSER && !global.HTMLElement) {\n global.HTMLElement = class {}\n}\n\n/**\n* addEvent\n* @param {String} nodeName An unique ID of the event to bind - ensurnes single instance\n* @param {String} type The type of event to bind\n* @param {Function} handler The function to call on event\n* @param {Boolean|Object} options useCapture or options object for addEventListener. Defaults to false\n*/\nexport function addEvent (nodeName, type, handler, options = false, key) {\n if (!IS_BROWSER || window[key = `event-${nodeName}-${type}`]) return // Ensure single instance\n const node = (type === 'resize' || type === 'load') ? window : document\n node.addEventListener(window[key] = type, (event) => (event.nodeName = nodeName) && handler(event), options)\n}\n\n/**\n* addStyle\n* @param {String} nodeName An unique ID of the event to bind - ensurnes single instance\n* @param {String} css The css to inject\n*/\nexport function addStyle (nodeName, css) {\n const key = `style-${nodeName.toLowerCase()}`\n const min = css.replace(/\\/\\*[^!][^*]*\\*\\//g, '').replace(/\\s*(^|[:;,{}]|$)\\s*/g, '$1')\n document.getElementById(key) || document.head.insertAdjacentHTML('afterbegin', `<style id=\"${key}\">${min}</style>`)\n}\n\n/**\n* escapeHTML\n* @param {String} str A string with potential html tokens\n* @return {String} Escaped HTML string according to OWASP recommendation\n*/\nconst ESCAPE_MAP = { '&': '&', '<': '<', '>': '>', '\"': '"', '/': '/', '\\'': ''' }\nexport function escapeHTML (str) {\n return String(str || '').replace(/[&<>\"'/]/g, (char) => ESCAPE_MAP[char])\n}\n\n/**\n* closest\n* @param {Element} element Element to traverse up from\n* @param {String} selector A selector to search for matching parents or element itself\n* @return {Element|null} Element which is the closest ancestor matching selector\n*/\nexport const closest = (() => {\n const proto = typeof window === 'undefined' ? {} : window.Element.prototype\n const match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector\n return proto.closest ? (el, css) => el.closest(css) : (el, css) => {\n for (;el; el = el.parentElement) if (match.call(el, css)) return el\n return null\n }\n})()\n\n/**\n* dispatchEvent - with infinite loop prevention\n* @param {Element} elem The target object\n* @param {String} name The source object(s)\n* @param {Object} detail Detail object (bubbles and cancelable is set to true)\n* @return {Boolean} Whether the event was canceled\n*/\nexport function dispatchEvent (element, name, detail = {}) {\n const ignore = `prevent_recursive_dispatch_maximum_callstack${name}`\n let event\n\n if (element[ignore]) return true // We are already processing this event, so skip sending a new one\n else element[ignore] = true // Add name to dispatching ignore\n\n if (typeof window.CustomEvent === 'function') {\n event = new window.CustomEvent(name, { bubbles: true, cancelable: true, detail })\n } else {\n event = document.createEvent('CustomEvent')\n event.initCustomEvent(name, true, true, detail)\n }\n // IE reports incorrect event.defaultPrevented\n // but correct return value on element.dispatchEvent\n const result = element.dispatchEvent(event)\n element[ignore] = null // Remove name from dispatching ignore\n\n return result // Follow W3C standard for return value\n}\n\n/**\n* getUUID\n* @return {String} A generated unique ID\n*/\nexport function getUUID () {\n return Date.now().toString(36) + Math.random().toString(36).slice(2, 5)\n}\n\n/**\n * throttle\n * @param {Function} callback The new throttled function\n * @param {Number} ms The threshold of milliseconds between each callback\n */\nexport function throttle (callback, ms) {\n let timer\n return function (...args) {\n if (!timer) {\n timer = setTimeout(function () {\n callback.apply(this, args)\n timer = null\n }, ms)\n }\n }\n}\n\n/**\n * toggleAttribute (Ponyfill for IE and Edge, fixes #299)\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute\n * @param {Element} el Single DOM Element\n * @param {String} name The name of the attribute to be toggled\n * @param {Boolean} force Force attribute to be added or removed regardless of previous state\n */\nexport function toggleAttribute (el, name, force = !this.hasAttribute(name)) {\n if (!force === el.hasAttribute(name)) el[force ? 'setAttribute' : 'removeAttribute'](name, '')\n return force\n}\n\n/**\n* queryAll\n* @param {String|NodeList|Array|Element} elements A CSS selector string, nodeList, element array, or single element\n* @param {Element} context Node to look for elements within\n* @return {Element[]} Array of elements\n*/\nexport function queryAll (elements, context = document) {\n if (elements) {\n if (elements.nodeType) return [elements]\n if (typeof elements === 'string') return [].slice.call(context.querySelectorAll(elements))\n if (elements.length) return [].slice.call(elements)\n }\n return []\n}\n","import { IS_BROWSER, addStyle, closest, dispatchEvent, throttle, getUUID, queryAll } from '../utils'\n\nconst DRAG = {}\nconst MOVE = { up: { y: -1, prop: 'top' }, down: { y: 1, prop: 'bottom' }, left: { x: -1 }, right: { x: 1 } }\nconst MOVE_SIGNIFICANT = 10\nconst NEEDS_MOUSEDOWN = '[contenteditable=\"true\"],input,select,textarea'\nconst EVENT_PASSIVE = ((has = false) => {\n try { window.addEventListener('test', null, { get passive () { has = { passive: true } } }) } catch (e) {}\n return has\n})()\n\n// https://css-tricks.com/introduction-reduced-motion-media-query/\nconst requestJumps = IS_BROWSER && window.matchMedia && window.matchMedia('(prefers-reduced-motion)').matches\nconst requestFrame = IS_BROWSER && (window.requestAnimationFrame || window.setTimeout)\n\nexport default class CoreScroll extends HTMLElement {\n connectedCallback () {\n // Hide scrollbar in WebKit and default to display block\n addStyle(this.nodeName, `\n ${this.nodeName}{display:block}\n ${this.nodeName}::-webkit-scrollbar{display:none}\n `)\n\n this.style.overflow = 'scroll' // Ensure visible scrollbars\n this.style.willChange = 'scroll-position' // Enhance performance\n this.style.webkitOverflowScrolling = 'touch' // Momentum scroll on iOS\n\n // Calculate sizes for hiding, must be after setting overflow:scroll\n const barWidth = this.offsetWidth - this.clientWidth\n const barHeight = this.offsetHeight - this.clientHeight\n\n // Also ensure height does not grow higher than parent element\n this.style.marginRight = `-${barWidth}px`\n this.style.marginBottom = `-${barHeight}px`\n this.style.maxHeight = `calc(100% + ${barHeight}px)`\n this._throttledEvent = throttle(this.handleEvent.bind(this), 500)\n\n this.addEventListener('mousedown', this)\n this.addEventListener('wheel', this, EVENT_PASSIVE)\n this.addEventListener('scroll', this._throttledEvent, EVENT_PASSIVE)\n window.addEventListener('resize', this._throttledEvent, EVENT_PASSIVE)\n window.addEventListener('load', this) // Update state when we are sure all CSS is loaded\n document.addEventListener('click', this)\n setTimeout(() => this.handleEvent()) // Initialize buttons after children is parsed\n }\n\n disconnectedCallback () {\n this._throttledEvent = null // Garbage collection\n this.removeEventListener('mousedown', this)\n this.removeEventListener('wheel', this, EVENT_PASSIVE)\n this.removeEventListener('scroll', this._throttledEvent, EVENT_PASSIVE)\n window.removeEventListener('resize', this._throttledEvent, EVENT_PASSIVE)\n window.removeEventListener('load', this)\n document.removeEventListener('click', this)\n }\n\n handleEvent (event = {}) {\n if (event.defaultPrevented) return\n if (event.type === 'wheel') DRAG.animate = false // Stop momentum animation onWheel\n else if (event.type === 'mousedown') onMousedown.call(this, event)\n else if (event.type === 'click') {\n const btn = this.id && closest(event.target, `[for=\"${this.id}\"]`)\n if (btn && dispatchEvent(this, 'scroll.click', { move: btn.value })) this.scroll(btn.value)\n } else {\n const scroll = { left: this.scrollLeft, up: this.scrollTop, right: this.scrollRight, down: this.scrollBottom }\n const cursor = (scroll.left || scroll.right || scroll.up || scroll.down) ? 'grab' : ''\n\n queryAll(this.id && `[for=\"${this.id}\"]`).forEach((el) => (el.disabled = !scroll[el.value]))\n dispatchEvent(this, 'scroll.change')\n\n if (!event.type) { // Do not change cursor while dragging\n this.style.cursor = `-webkit-${cursor}`\n this.style.cursor = cursor\n }\n }\n }\n\n scroll (point) {\n const { x, y } = parsePoint(this, point)\n const uuid = DRAG.animate = getUUID() // Giving the animation an ID to workaround IE timeout issues\n const friction = this.friction\n let moveX = requestJumps ? 1 : x - this.scrollLeft\n let moveY = requestJumps ? 1 : y - this.scrollTop\n\n const move = () => {\n if (DRAG.animate === uuid && (Math.round(moveX) || Math.round(moveY))) {\n this.scrollLeft = x - Math.round(moveX *= friction)\n this.scrollTop = y - Math.round(moveY *= friction)\n requestFrame(move)\n }\n }\n move()\n }\n\n get items () { return queryAll(this.getAttribute('items') || this.children, this) }\n\n // Ensure falsy values becomes ''\n set items (val) { this.setAttribute('items', val || '') }\n\n get scrollRight () { return this.scrollWidth - this.clientWidth - this.scrollLeft }\n\n get scrollBottom () { return this.scrollHeight - this.clientHeight - this.scrollTop }\n\n // Avoid friction 1 (infinite)\n get friction () { return Math.min(0.99, this.getAttribute('friction')) || 0.8 }\n\n set friction (val) { this.setAttribute('friction', val) }\n}\n\nfunction onMousedown (event) {\n if (closest(event.target, NEEDS_MOUSEDOWN)) return\n event.preventDefault() // Prevent text selection and enable nesting\n\n DRAG.pageX = event.pageX\n DRAG.pageY = event.pageY\n DRAG.diffSumX = 0\n DRAG.diffSumY = 0\n DRAG.animate = DRAG.diffX = DRAG.diffY = 0 // Reset\n DRAG.scrollX = this.scrollLeft\n DRAG.scrollY = this.scrollTop\n DRAG.target = this\n\n document.body.style.cursor = this.style.cursor = '-webkit-grabbing'\n document.body.style.cursor = this.style.cursor = 'grabbing'\n document.addEventListener('mousemove', onMousemove)\n document.addEventListener('mouseup', onMouseup)\n}\n\nfunction onMousemove (event) {\n DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX)\n DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY)\n DRAG.diffSumX += DRAG.diffX\n DRAG.diffSumY += DRAG.diffY\n DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX\n DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY\n\n // Prevent links when we know there has been significant movement\n if (Math.max(Math.abs(DRAG.diffSumX), Math.abs(DRAG.diffSumY)) > MOVE_SIGNIFICANT) {\n DRAG.target.style.pointerEvents = 'none'\n }\n}\n\nfunction onMouseup (event) {\n const momentum = Math.abs(DRAG.diffX || DRAG.diffY) > MOVE_SIGNIFICANT ? 20 : 0\n document.removeEventListener('mousemove', onMousemove)\n document.removeEventListener('mouseup', onMouseup)\n document.body.style.cursor = ''\n\n if (momentum) {\n DRAG.target.scroll({\n x: DRAG.scrollX + DRAG.diffX * momentum,\n y: DRAG.scrollY + DRAG.diffY * momentum\n })\n }\n DRAG.target.style.pointerEvents = '' // Allow events again\n DRAG.target.style.cursor = '-webkit-grab'\n DRAG.target.style.cursor = 'grab'\n DRAG.target = null // Prevent memory leak\n}\n\nfunction parsePoint (self, move) {\n const point = typeof move === 'object' ? move : { move }\n if (typeof point.x !== 'number') point.x = self.scrollLeft\n if (typeof point.y !== 'number') point.y = self.scrollTop\n if ((point.move = MOVE[point.move])) {\n const axis = point.move.x ? 'x' : 'y'\n const start = point.move.x ? 'left' : 'top'\n const bounds = self.getBoundingClientRect()\n const scroll = bounds[start] - self[point.move.x ? 'scrollLeft' : 'scrollTop']\n const edge = bounds[start] + bounds[point.move.x ? 'width' : 'height'] * point.move[axis]\n\n self.items.every((el) => { // Use .every as this loop stops on return false\n const rect = el.getBoundingClientRect()\n const marg = el.ownerDocument.defaultView.getComputedStyle(el)[`margin-${start}`]\n\n point[axis] = rect[start] - parseInt(marg, 10) - scroll // Update point to child axis coordinate\n return rect[point.move.prop || move] < edge\n })\n }\n return {\n x: Math.max(0, Math.min(point.x, self.scrollWidth - self.clientWidth)),\n y: Math.max(0, Math.min(point.y, self.scrollHeight - self.clientHeight))\n }\n}\n","import React from 'react';\n\n/**\n* closest\n* @param {Element} element Element to traverse up from\n* @param {String} selector A selector to search for matching parents or element itself\n* @return {Element|null} Element which is the closest ancestor matching selector\n*/\nvar closest = (function () {\n var proto = typeof window === 'undefined' ? {} : window.Element.prototype;\n var match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector;\n return proto.closest ? function (el, css) { return el.closest(css); } : function (el, css) {\n for (;el; el = el.parentElement) { if (match.call(el, css)) { return el } }\n return null\n }\n})();\n\n/**\n* customElementToReact\n* @param {Class|Function} elem A custom element definition.\n* @param {Array} attr Props and events\n* @return {Object} A React component\n*/\nfunction customElementToReact (elementClass, options) {\n if ( options === void 0 ) options = {};\n\n var name = elementClass.name || String(elementClass).match(/function ([^(]+)/)[1]; // String match for IE11\n var dashCase = name.replace(/.[A-Z]/g, function (ref) {\n var a = ref[0];\n var b = ref[1];\n\n return (a + \"-\" + b);\n }); // NameName -> name-name\n var customProps = options.props || [];\n var customEvents = options.customEvents || [];\n var skipProps = customProps.concat('forwardRef'); // Keep a copy with forwardRef added\n var tagName = (dashCase + \"-\" + (options.suffix || 'react')).replace(/\\W+/g, '-').toLowerCase();\n\n return /*@__PURE__*/(function (superclass) {\n function anonymous (props) {\n var this$1 = this;\n\n superclass.call(this, props);\n this.ref = function (el) {\n // Support callback ref https://reactjs.org/docs/refs-and-the-dom.html#callback-refs\n if (typeof this$1.props.forwardRef === 'function') { this$1.props.forwardRef(el); }\n else if (this$1.props.forwardRef) { this$1.props.forwardRef.current = el; }\n return (this$1.el = el)\n };\n customEvents.forEach(function (eventName) {\n var on = \"on\" + (eventName.replace(/(^|\\.)./g, function (m) { return m.slice(-1).toUpperCase(); })); // input.filter => onInputFilter\n this$1[eventName] = function (event) { return this$1.props[on] && closest(event.target, this$1.el.nodeName) === this$1.el && this$1.props[on](event); };\n skipProps.push(on); // Skip props that are customEvents\n });\n }\n\n if ( superclass ) anonymous.__proto__ = superclass;\n anonymous.prototype = Object.create( superclass && superclass.prototype );\n anonymous.prototype.constructor = anonymous;\n\n anonymous.prototype.componentDidMount = function componentDidMount () {\n var this$1 = this;\n\n // Do not run connectedCallback before after React componentDidMount, to allow React hydration to run first\n if (!window.customElements.get(tagName)) { window.customElements.define(tagName, elementClass); }\n\n customProps.forEach(function (key) { return (key in this$1.props) && (this$1.el[key] = this$1.props[key]); });\n customEvents.forEach(function (key) { return this$1.el.addEventListener(key, this$1[key]); });\n };\n\n anonymous.prototype.componentDidUpdate = function componentDidUpdate (prev) {\n var this$1 = this;\n\n customProps.forEach(function (key) { return prev[key] !== this$1.props[key] && (this$1.el[key] = this$1.props[key]); });\n };\n\n anonymous.prototype.componentWillUnmount = function componentWillUnmount () {\n var this$1 = this;\n\n customEvents.forEach(function (eventName) { return this$1.el.removeEventListener(eventName, this$1[eventName]); });\n };\n\n anonymous.prototype.render = function render () {\n var this$1 = this;\n\n // Convert React props to CustomElement props https://github.com/facebook/react/issues/12810\n return React.createElement(tagName, Object.keys(this.props).reduce(function (thisProps, key) {\n if (skipProps.indexOf(key) === -1) { // Do not render customEvents and custom props as attributes\n if (key === 'className') { thisProps.class = this$1.props[key]; } // Fixes className for custom elements\n else if (this$1.props[key] === true) { thisProps[key] = ''; } // Fixes boolean attributes\n else if (this$1.props[key] !== false) { thisProps[key] = this$1.props[key]; } // Pass only truthy, non-function props\n }\n return thisProps\n }, { ref: this.ref }))\n };\n\n return anonymous;\n }(React.Component))\n}\n\nexport default customElementToReact;\n","import CoreScroll from './core-scroll.js'\nimport { version } from './package.json'\nimport customElementToReact from '@nrk/custom-element-to-react'\n\nexport default customElementToReact(CoreScroll, {\n customEvents: ['scroll.change', 'scroll.click'],\n suffix: version\n})\n"],"names":["IS_BROWSER","window","IS_ANDROID","test","navigator","userAgent","IS_IOS","String","platform","global","HTMLElement","addStyle","nodeName","css","key","toLowerCase","min","replace","document","getElementById","head","insertAdjacentHTML","closest","proto","Element","prototype","match","matches","msMatchesSelector","webkitMatchesSelector","el","parentElement","call","dispatchEvent","element","name","detail","ignore","event","CustomEvent","bubbles","cancelable","createEvent","initCustomEvent","result","getUUID","Date","now","toString","Math","random","slice","throttle","callback","ms","timer","args","setTimeout","apply","queryAll","elements","context","nodeType","querySelectorAll","length","DRAG","MOVE","up","y","prop","down","left","x","right","MOVE_SIGNIFICANT","NEEDS_MOUSEDOWN","EVENT_PASSIVE","has","addEventListener","passive","e","requestJumps","matchMedia","requestFrame","requestAnimationFrame","CoreScroll","style","overflow","willChange","webkitOverflowScrolling","barWidth","offsetWidth","clientWidth","barHeight","offsetHeight","clientHeight","marginRight","marginBottom","maxHeight","_throttledEvent","handleEvent","bind","removeEventListener","defaultPrevented","type","animate","onMousedown","btn","id","target","move","value","scroll","scrollLeft","scrollTop","scrollRight","scrollBottom","cursor","forEach","disabled","point","parsePoint","uuid","friction","moveX","moveY","round","getAttribute","children","val","setAttribute","scrollWidth","scrollHeight","preventDefault","pageX","pageY","diffSumX","diffSumY","diffX","diffY","scrollX","scrollY","body","onMousemove","onMouseup","max","abs","pointerEvents","momentum","self","axis","start","bounds","getBoundingClientRect","edge","items","every","rect","marg","ownerDocument","defaultView","getComputedStyle","parseInt","customElementToReact","elementClass","options","dashCase","ref","a","b","customProps","props","customEvents","skipProps","concat","tagName","suffix","superclass","anonymous","this$1","forwardRef","current","eventName","on","m","toUpperCase","push","__proto__","Object","create","constructor","componentDidMount","customElements","get","define","componentDidUpdate","prev","componentWillUnmount","render","React","createElement","keys","reduce","thisProps","indexOf","Component","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAO,IAAMA,UAAU,GAAG,OAAOC,MAAP,KAAkB,WAArC;AACP,EAAO,IAAMC,UAAU,GAAGF,UAAU,IAAI,aAAaG,IAAb,CAAkBC,SAAS,CAACC,SAA5B,CAAjC;;AACP,EAAO,IAAMC,MAAM,GAAGN,UAAU,IAAI,mBAAmBG,IAAnB,CAAwBI,MAAM,CAACH,SAAS,CAACI,QAAX,CAA9B,CAA7B;;EAGP,IAAI,CAACR,UAAD,IAAe,CAACS,MAAM,CAACC,WAA3B,EAAwC;EACtCD,EAAAA,MAAM,CAACC,WAAP;EAAA;EAAA;EAAA;EAAA;EAAA;;EAAA;EAAA;EACD;AAED,EAaA;;;;;;AAKA,EAAO,SAASC,QAAT,CAAmBC,QAAnB,EAA6BC,GAA7B,EAAkC;EACvC,MAAMC,GAAG,mBAAYF,QAAQ,CAACG,WAAT,EAAZ,CAAT;EACA,MAAMC,GAAG,GAAGH,GAAG,CAACI,OAAJ,CAAY,oBAAZ,EAAkC,EAAlC,EAAsCA,OAAtC,CAA8C,sBAA9C,EAAsE,IAAtE,CAAZ;EACAC,EAAAA,QAAQ,CAACC,cAAT,CAAwBL,GAAxB,KAAgCI,QAAQ,CAACE,IAAT,CAAcC,kBAAd,CAAiC,YAAjC,wBAA6DP,GAA7D,gBAAqEE,GAArE,cAAhC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;EAIlC;;EACD,iBAAO6L,SAAP;EACD,SAPmC,EAOjC;EAAEpC,UAAAA,GAAG,EAAE,KAAKA;EAAZ,SAPiC,CAA7B,CAAP;EAQD,OAZD;;EAcA,aAAOW,SAAP;EACD,KA3DoB,CA2DnBqB,KAAK,CAACM,SA3Da;EAArB;EA4DD;;AC9FD,mBAAe1C,oBAAoB,CAAC9E,UAAD,EAAa;EAC9CuF,EAAAA,YAAY,EAAE,CAAC,eAAD,EAAkB,cAAlB,CADgC;EAE9CI,EAAAA,MAAM,EAAE8B;EAFsC,CAAb,CAAnC;;;;;;;;"} |
@@ -1,3 +0,3 @@ | ||
| /*! @nrk/core-scroll v4.1.1 - 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 r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(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 s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t,e,n){return(i=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&&c(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 i(t,arguments,s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(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(){r(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;t=t.parentElement)if(n.call(t,e))return t;return null});function h(t,e){var n,o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[i])return!0;t[i]=!0,"function"==typeof window.CustomEvent?n=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,o);var r=t.dispatchEvent(n);return t[i]=null,r}function p(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document;if(t){if(t.nodeType)return[t];if("string"==typeof t)return[].slice.call(e.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(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];try{window.addEventListener("test",null,{get passive(){t={passive:!0}}})}catch(t){}return t}(),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(t){function e(){return r(this,e),f(this,s(e).apply(this,arguments))}var n,o,i;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&&c(t,e)}(e,a(HTMLElement)),n=e,(o=[{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(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!t.defaultPrevented)if("wheel"===t.type)m.animate=!1;else if("mousedown"===t.type)(function(t){if(d(t.target,'[contenteditable="true"],input,select,textarea'))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,t);else if("click"===t.type){var e=this.id&&d(t.target,'[for="'.concat(this.id,'"]'));e&&h(this,"scroll.click",{move:e.value})&&this.scroll(e.value)}else{var n={left:this.scrollLeft,up:this.scrollTop,right:this.scrollRight,down:this.scrollBottom},o=n.left||n.right||n.up||n.down?"grab":"";p(this.id&&'[for="'.concat(this.id,'"]')).forEach(function(t){return t.disabled=!n[t.value]}),h(this,"scroll.change"),t.type||(this.style.cursor="-webkit-".concat(o),this.style.cursor=o)}}},{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)}}])&&l(n.prototype,o),i&&l(n,i),e}()}),window.customElements.define("core-scroll",coreScroll); | ||
| /*! @nrk/core-scroll v4.1.2 - 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;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); | ||
| //# sourceMappingURL=core-scroll.min.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"core-scroll.min.js","sources":["../utils.js","core-scroll.js"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined'\nexport const IS_ANDROID = IS_BROWSER && /(android)/i.test(navigator.userAgent) // Bad, but needed\nexport const IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform))\n\n// Mock HTMLElement for Node\nif (!IS_BROWSER && !global.HTMLElement) {\n global.HTMLElement = class {}\n}\n\n/**\n* addEvent\n* @param {String} nodeName An unique ID of the event to bind - ensurnes single instance\n* @param {String} type The type of event to bind\n* @param {Function} handler The function to call on event\n* @param {Boolean|Object} options useCapture or options object for addEventListener. Defaults to false\n*/\nexport function addEvent (nodeName, type, handler, options = false, key) {\n if (!IS_BROWSER || window[key = `event-${nodeName}-${type}`]) return // Ensure single instance\n const node = (type === 'resize' || type === 'load') ? window : document\n node.addEventListener(window[key] = type, (event) => (event.nodeName = nodeName) && handler(event), options)\n}\n\n/**\n* addStyle\n* @param {String} nodeName An unique ID of the event to bind - ensurnes single instance\n* @param {String} css The css to inject\n*/\nexport function addStyle (nodeName, css) {\n const key = `style-${nodeName.toLowerCase()}`\n const min = css.replace(/\\/\\*[^!][^*]*\\*\\//g, '').replace(/\\s*(^|[:;,{}]|$)\\s*/g, '$1')\n document.getElementById(key) || document.head.insertAdjacentHTML('afterbegin', `<style id=\"${key}\">${min}</style>`)\n}\n\n/**\n* escapeHTML\n* @param {String} str A string with potential html tokens\n* @return {String} Escaped HTML string according to OWASP recommendation\n*/\nconst ESCAPE_MAP = { '&': '&', '<': '<', '>': '>', '\"': '"', '/': '/', '\\'': ''' }\nexport function escapeHTML (str) {\n return String(str || '').replace(/[&<>\"'/]/g, (char) => ESCAPE_MAP[char])\n}\n\n/**\n* closest\n* @param {Element} element Element to traverse up from\n* @param {String} selector A selector to search for matching parents or element itself\n* @return {Element|null} Element which is the closest ancestor matching selector\n*/\nexport const closest = (() => {\n const proto = typeof window === 'undefined' ? {} : window.Element.prototype\n const match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector\n return proto.closest ? (el, css) => el.closest(css) : (el, css) => {\n for (;el; el = el.parentElement) if (match.call(el, css)) return el\n return null\n }\n})()\n\n/**\n* dispatchEvent - with infinite loop prevention\n* @param {Element} elem The target object\n* @param {String} name The source object(s)\n* @param {Object} detail Detail object (bubbles and cancelable is set to true)\n* @return {Boolean} Whether the event was canceled\n*/\nexport function dispatchEvent (element, name, detail = {}) {\n const ignore = `prevent_recursive_dispatch_maximum_callstack${name}`\n let event\n\n if (element[ignore]) return true // We are already processing this event, so skip sending a new one\n else element[ignore] = true // Add name to dispatching ignore\n\n if (typeof window.CustomEvent === 'function') {\n event = new window.CustomEvent(name, { bubbles: true, cancelable: true, detail })\n } else {\n event = document.createEvent('CustomEvent')\n event.initCustomEvent(name, true, true, detail)\n }\n // IE reports incorrect event.defaultPrevented\n // but correct return value on element.dispatchEvent\n const result = element.dispatchEvent(event)\n element[ignore] = null // Remove name from dispatching ignore\n\n return result // Follow W3C standard for return value\n}\n\n/**\n* getUUID\n* @return {String} A generated unique ID\n*/\nexport function getUUID () {\n return Date.now().toString(36) + Math.random().toString(36).slice(2, 5)\n}\n\n/**\n * throttle\n * @param {Function} callback The new throttled function\n * @param {Number} ms The threshold of milliseconds between each callback\n */\nexport function throttle (callback, ms) {\n let timer\n return function (...args) {\n if (!timer) {\n timer = setTimeout(function () {\n callback.apply(this, args)\n timer = null\n }, ms)\n }\n }\n}\n\n/**\n * toggleAttribute (Ponyfill for IE and Edge, fixes #299)\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute\n * @param {Element} el Single DOM Element\n * @param {String} name The name of the attribute to be toggled\n * @param {Boolean} force Force attribute to be added or removed regardless of previous state\n */\nexport function toggleAttribute (el, name, force = !this.hasAttribute(name)) {\n if (!force === el.hasAttribute(name)) el[force ? 'setAttribute' : 'removeAttribute'](name, '')\n return force\n}\n\n/**\n* queryAll\n* @param {String|NodeList|Array|Element} elements A CSS selector string, nodeList, element array, or single element\n* @param {Element} context Node to look for elements within\n* @return {Element[]} Array of elements\n*/\nexport function queryAll (elements, context = document) {\n if (elements) {\n if (elements.nodeType) return [elements]\n if (typeof elements === 'string') return [].slice.call(context.querySelectorAll(elements))\n if (elements.length) return [].slice.call(elements)\n }\n return []\n}\n","import { IS_BROWSER, addStyle, closest, dispatchEvent, throttle, getUUID, queryAll } from '../utils'\n\nconst DRAG = {}\nconst MOVE = { up: { y: -1, prop: 'top' }, down: { y: 1, prop: 'bottom' }, left: { x: -1 }, right: { x: 1 } }\nconst MOVE_SIGNIFICANT = 10\nconst NEEDS_MOUSEDOWN = '[contenteditable=\"true\"],input,select,textarea'\nconst EVENT_PASSIVE = ((has = false) => {\n try { window.addEventListener('test', null, { get passive () { has = { passive: true } } }) } catch (e) {}\n return has\n})()\n\n// https://css-tricks.com/introduction-reduced-motion-media-query/\nconst requestJumps = IS_BROWSER && window.matchMedia && window.matchMedia('(prefers-reduced-motion)').matches\nconst requestFrame = IS_BROWSER && (window.requestAnimationFrame || window.setTimeout)\n\nexport default class CoreScoll extends HTMLElement {\n connectedCallback () {\n // Hide scrollbar in WebKit and default to display block\n addStyle(this.nodeName, `\n ${this.nodeName}{display:block}\n ${this.nodeName}::-webkit-scrollbar{display:none}\n `)\n\n this.style.overflow = 'scroll' // Ensure visible scrollbars\n this.style.willChange = 'scroll-position' // Enhance performance\n this.style.webkitOverflowScrolling = 'touch' // Momentum scroll on iOS\n\n // Calculate sizes for hiding, must be after setting overflow:scroll\n const barWidth = this.offsetWidth - this.clientWidth\n const barHeight = this.offsetHeight - this.clientHeight\n\n // Also ensure height does not grow higher than parent element\n this.style.marginRight = `-${barWidth}px`\n this.style.marginBottom = `-${barHeight}px`\n this.style.maxHeight = `calc(100% + ${barHeight}px)`\n this._throttledEvent = throttle(this.handleEvent.bind(this), 500)\n\n this.addEventListener('mousedown', this)\n this.addEventListener('wheel', this, EVENT_PASSIVE)\n this.addEventListener('scroll', this._throttledEvent, EVENT_PASSIVE)\n window.addEventListener('resize', this._throttledEvent, EVENT_PASSIVE)\n window.addEventListener('load', this) // Update state when we are sure all CSS is loaded\n document.addEventListener('click', this)\n setTimeout(() => this.handleEvent()) // Initialize buttons after children is parsed\n }\n\n disconnectedCallback () {\n this._throttledEvent = null // Garbage collection\n this.removeEventListener('mousedown', this)\n this.removeEventListener('wheel', this, EVENT_PASSIVE)\n this.removeEventListener('scroll', this._throttledEvent, EVENT_PASSIVE)\n window.removeEventListener('resize', this._throttledEvent, EVENT_PASSIVE)\n window.removeEventListener('load', this)\n document.removeEventListener('click', this)\n }\n\n handleEvent (event = {}) {\n if (event.defaultPrevented) return\n if (event.type === 'wheel') DRAG.animate = false // Stop momentum animation onWheel\n else if (event.type === 'mousedown') onMousedown.call(this, event)\n else if (event.type === 'click') {\n const btn = this.id && closest(event.target, `[for=\"${this.id}\"]`)\n if (btn && dispatchEvent(this, 'scroll.click', { move: btn.value })) this.scroll(btn.value)\n } else {\n const scroll = { left: this.scrollLeft, up: this.scrollTop, right: this.scrollRight, down: this.scrollBottom }\n const cursor = (scroll.left || scroll.right || scroll.up || scroll.down) ? 'grab' : ''\n\n queryAll(this.id && `[for=\"${this.id}\"]`).forEach((el) => (el.disabled = !scroll[el.value]))\n dispatchEvent(this, 'scroll.change')\n\n if (!event.type) { // Do not change cursor while dragging\n this.style.cursor = `-webkit-${cursor}`\n this.style.cursor = cursor\n }\n }\n }\n\n scroll (point) {\n const { x, y } = parsePoint(this, point)\n const uuid = DRAG.animate = getUUID() // Giving the animation an ID to workaround IE timeout issues\n const friction = this.friction\n let moveX = requestJumps ? 1 : x - this.scrollLeft\n let moveY = requestJumps ? 1 : y - this.scrollTop\n\n const move = () => {\n if (DRAG.animate === uuid && (Math.round(moveX) || Math.round(moveY))) {\n this.scrollLeft = x - Math.round(moveX *= friction)\n this.scrollTop = y - Math.round(moveY *= friction)\n requestFrame(move)\n }\n }\n move()\n }\n\n get items () { return queryAll(this.getAttribute('items') || this.children, this) }\n\n // Ensure falsy values becomes ''\n set items (val) { this.setAttribute('items', val || '') }\n\n get scrollRight () { return this.scrollWidth - this.clientWidth - this.scrollLeft }\n\n get scrollBottom () { return this.scrollHeight - this.clientHeight - this.scrollTop }\n\n // Avoid friction 1 (infinite)\n get friction () { return Math.min(0.99, this.getAttribute('friction')) || 0.8 }\n\n set friction (val) { this.setAttribute('friction', val) }\n}\n\nfunction onMousedown (event) {\n if (closest(event.target, NEEDS_MOUSEDOWN)) return\n event.preventDefault() // Prevent text selection and enable nesting\n\n DRAG.pageX = event.pageX\n DRAG.pageY = event.pageY\n DRAG.diffSumX = 0\n DRAG.diffSumY = 0\n DRAG.animate = DRAG.diffX = DRAG.diffY = 0 // Reset\n DRAG.scrollX = this.scrollLeft\n DRAG.scrollY = this.scrollTop\n DRAG.target = this\n\n document.body.style.cursor = this.style.cursor = '-webkit-grabbing'\n document.body.style.cursor = this.style.cursor = 'grabbing'\n document.addEventListener('mousemove', onMousemove)\n document.addEventListener('mouseup', onMouseup)\n}\n\nfunction onMousemove (event) {\n DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX)\n DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY)\n DRAG.diffSumX += DRAG.diffX\n DRAG.diffSumY += DRAG.diffY\n DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX\n DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY\n\n // Prevent links when we know there has been significant movement\n if (Math.max(Math.abs(DRAG.diffSumX), Math.abs(DRAG.diffSumY)) > MOVE_SIGNIFICANT) {\n DRAG.target.style.pointerEvents = 'none'\n }\n}\n\nfunction onMouseup (event) {\n const momentum = Math.abs(DRAG.diffX || DRAG.diffY) > MOVE_SIGNIFICANT ? 20 : 0\n document.removeEventListener('mousemove', onMousemove)\n document.removeEventListener('mouseup', onMouseup)\n document.body.style.cursor = ''\n\n if (momentum) {\n DRAG.target.scroll({\n x: DRAG.scrollX + DRAG.diffX * momentum,\n y: DRAG.scrollY + DRAG.diffY * momentum\n })\n }\n DRAG.target.style.pointerEvents = '' // Allow events again\n DRAG.target.style.cursor = '-webkit-grab'\n DRAG.target.style.cursor = 'grab'\n DRAG.target = null // Prevent memory leak\n}\n\nfunction parsePoint (self, move) {\n const point = typeof move === 'object' ? move : { move }\n if (typeof point.x !== 'number') point.x = self.scrollLeft\n if (typeof point.y !== 'number') point.y = self.scrollTop\n if ((point.move = MOVE[point.move])) {\n const axis = point.move.x ? 'x' : 'y'\n const start = point.move.x ? 'left' : 'top'\n const bounds = self.getBoundingClientRect()\n const scroll = bounds[start] - self[point.move.x ? 'scrollLeft' : 'scrollTop']\n const edge = bounds[start] + bounds[point.move.x ? 'width' : 'height'] * point.move[axis]\n\n self.items.every((el) => { // Use .every as this loop stops on return false\n const rect = el.getBoundingClientRect()\n const marg = el.ownerDocument.defaultView.getComputedStyle(el)[`margin-${start}`]\n\n point[axis] = rect[start] - parseInt(marg, 10) - scroll // Update point to child axis coordinate\n return rect[point.move.prop || move] < edge\n })\n }\n return {\n x: Math.max(0, Math.min(point.x, self.scrollWidth - self.clientWidth)),\n y: Math.max(0, Math.min(point.y, self.scrollHeight - self.clientHeight))\n }\n}\n"],"names":["IS_BROWSER","window","test","navigator","userAgent","String","platform","global","HTMLElement","proto","match","closest","Element","prototype","matches","msMatchesSelector","webkitMatchesSelector","el","css","parentElement","call","dispatchEvent","element","name","event","detail","ignore","CustomEvent","bubbles","cancelable","document","createEvent","initCustomEvent","result","queryAll","elements","context","nodeType","slice","querySelectorAll","length","DRAG","MOVE","up","y","prop","down","left","x","right","MOVE_SIGNIFICANT","EVENT_PASSIVE","has","addEventListener","passive","e","requestJumps","matchMedia","requestFrame","requestAnimationFrame","setTimeout","onMousemove","diffX","pageX","diffY","pageY","diffSumX","diffSumY","target","scrollLeft","scrollX","scrollTop","scrollY","Math","max","abs","style","pointerEvents","onMouseup","momentum","removeEventListener","body","cursor","scroll","nodeName","key","min","this","toLowerCase","replace","getElementById","head","insertAdjacentHTML","overflow","willChange","webkitOverflowScrolling","callback","ms","timer","barWidth","offsetWidth","clientWidth","barHeight","offsetHeight","clientHeight","marginRight","marginBottom","maxHeight","_throttledEvent","handleEvent","bind","args","apply","_this","defaultPrevented","type","animate","preventDefault","btn","id","move","value","scrollRight","scrollBottom","forEach","disabled","point","self","_typeof","axis","start","bounds","getBoundingClientRect","edge","items","every","rect","marg","ownerDocument","defaultView","getComputedStyle","parseInt","scrollWidth","scrollHeight","parsePoint","uuid","Date","now","toString","random","friction","moveX","moveY","round","_this2","getAttribute","children","val","setAttribute"],"mappings":";0+DAAO,IAAMA,EAA+B,oBAAXC,OACPD,GAAc,aAAaE,KAAKC,UAAUC,WAC9CJ,GAAc,mBAAmBE,KAAKG,OAAOF,UAAUG,WAGxEN,GAAeO,OAAOC,cACzBD,OAAOC,0DA2CF,IACCC,EACAC,EAFKC,GACLF,EAA0B,oBAAXR,OAAyB,GAAKA,OAAOW,QAAQC,UAC5DH,EAAQD,EAAMK,SAAWL,EAAMM,mBAAqBN,EAAMO,sBACzDP,EAAME,QAAU,SAACM,EAAIC,UAAQD,EAAGN,QAAQO,IAAO,SAACD,EAAIC,QACnDD,EAAIA,EAAKA,EAAGE,iBAAmBT,EAAMU,KAAKH,EAAIC,GAAM,OAAOD,SAC1D,OAWJ,SAASI,EAAeC,EAASC,OAElCC,EAFwCC,yDAAS,GAC/CC,wDAAwDH,MAG1DD,EAAQI,GAAS,OAAO,EACvBJ,EAAQI,IAAU,EAEW,mBAAvBzB,OAAO0B,YAChBH,EAAQ,IAAIvB,OAAO0B,YAAYJ,EAAM,CAAEK,SAAS,EAAMC,YAAY,EAAMJ,OAAAA,KAExED,EAAQM,SAASC,YAAY,gBACvBC,gBAAgBT,GAAM,GAAM,EAAME,OAIpCQ,EAASX,EAAQD,cAAcG,UACrCF,EAAQI,GAAU,KAEXO,EA8CF,SAASC,EAAUC,OAAUC,yDAAUN,YACxCK,EAAU,IACRA,EAASE,SAAU,MAAO,CAACF,MACP,iBAAbA,EAAuB,MAAO,GAAGG,MAAMlB,KAAKgB,EAAQG,iBAAiBJ,OAC5EA,EAASK,OAAQ,MAAO,GAAGF,MAAMlB,KAAKe,SAErC,GCrIT,IAAMM,EAAO,GACPC,EAAO,CAAEC,GAAI,CAAEC,G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IZ,EAAI2C,KAAKhB,WAE3B,SAAPiD,IACA/E,EAAK2E,UAAY6B,IAASxE,KAAKgF,MAAMF,IAAU9E,KAAKgF,MAAMD,MAC5DE,EAAKrF,WAAarB,EAAIyB,KAAKgF,MAAMF,GAASD,GAC1CI,EAAKnF,UAAY3B,EAAI6B,KAAKgF,MAAMD,GAASF,GACzC5F,EAAa8D,IAGjBA,wCAGoBtF,EAASqD,KAAKoE,aAAa,UAAYpE,KAAKqE,SAAUrE,oBAGjEsE,QAAYC,aAAa,QAASD,GAAO,+CAExBtE,KAAKuD,YAAcvD,KAAKc,YAAcd,KAAKlB,uDAE1CkB,KAAKwD,aAAexD,KAAKiB,aAAejB,KAAKhB,kDAGjDE,KAAKa,IAAI,IAAMC,KAAKoE,aAAa,cAAgB,iBAE5DE,QAAYC,aAAa,WAAYD"} | ||
| {"version":3,"file":"core-scroll.min.js","sources":["../utils.js","core-scroll.js"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined'\nexport const IS_ANDROID = IS_BROWSER && /(android)/i.test(navigator.userAgent) // Bad, but needed\nexport const IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform))\n\n// Mock HTMLElement for Node\nif (!IS_BROWSER && !global.HTMLElement) {\n global.HTMLElement = class {}\n}\n\n/**\n* addEvent\n* @param {String} nodeName An unique ID of the event to bind - ensurnes single instance\n* @param {String} type The type of event to bind\n* @param {Function} handler The function to call on event\n* @param {Boolean|Object} options useCapture or options object for addEventListener. Defaults to false\n*/\nexport function addEvent (nodeName, type, handler, options = false, key) {\n if (!IS_BROWSER || window[key = `event-${nodeName}-${type}`]) return // Ensure single instance\n const node = (type === 'resize' || type === 'load') ? window : document\n node.addEventListener(window[key] = type, (event) => (event.nodeName = nodeName) && handler(event), options)\n}\n\n/**\n* addStyle\n* @param {String} nodeName An unique ID of the event to bind - ensurnes single instance\n* @param {String} css The css to inject\n*/\nexport function addStyle (nodeName, css) {\n const key = `style-${nodeName.toLowerCase()}`\n const min = css.replace(/\\/\\*[^!][^*]*\\*\\//g, '').replace(/\\s*(^|[:;,{}]|$)\\s*/g, '$1')\n document.getElementById(key) || document.head.insertAdjacentHTML('afterbegin', `<style id=\"${key}\">${min}</style>`)\n}\n\n/**\n* escapeHTML\n* @param {String} str A string with potential html tokens\n* @return {String} Escaped HTML string according to OWASP recommendation\n*/\nconst ESCAPE_MAP = { '&': '&', '<': '<', '>': '>', '\"': '"', '/': '/', '\\'': ''' }\nexport function escapeHTML (str) {\n return String(str || '').replace(/[&<>\"'/]/g, (char) => ESCAPE_MAP[char])\n}\n\n/**\n* closest\n* @param {Element} element Element to traverse up from\n* @param {String} selector A selector to search for matching parents or element itself\n* @return {Element|null} Element which is the closest ancestor matching selector\n*/\nexport const closest = (() => {\n const proto = typeof window === 'undefined' ? {} : window.Element.prototype\n const match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector\n return proto.closest ? (el, css) => el.closest(css) : (el, css) => {\n for (;el; el = el.parentElement) if (match.call(el, css)) return el\n return null\n }\n})()\n\n/**\n* dispatchEvent - with infinite loop prevention\n* @param {Element} elem The target object\n* @param {String} name The source object(s)\n* @param {Object} detail Detail object (bubbles and cancelable is set to true)\n* @return {Boolean} Whether the event was canceled\n*/\nexport function dispatchEvent (element, name, detail = {}) {\n const ignore = `prevent_recursive_dispatch_maximum_callstack${name}`\n let event\n\n if (element[ignore]) return true // We are already processing this event, so skip sending a new one\n else element[ignore] = true // Add name to dispatching ignore\n\n if (typeof window.CustomEvent === 'function') {\n event = new window.CustomEvent(name, { bubbles: true, cancelable: true, detail })\n } else {\n event = document.createEvent('CustomEvent')\n event.initCustomEvent(name, true, true, detail)\n }\n // IE reports incorrect event.defaultPrevented\n // but correct return value on element.dispatchEvent\n const result = element.dispatchEvent(event)\n element[ignore] = null // Remove name from dispatching ignore\n\n return result // Follow W3C standard for return value\n}\n\n/**\n* getUUID\n* @return {String} A generated unique ID\n*/\nexport function getUUID () {\n return Date.now().toString(36) + Math.random().toString(36).slice(2, 5)\n}\n\n/**\n * throttle\n * @param {Function} callback The new throttled function\n * @param {Number} ms The threshold of milliseconds between each callback\n */\nexport function throttle (callback, ms) {\n let timer\n return function (...args) {\n if (!timer) {\n timer = setTimeout(function () {\n callback.apply(this, args)\n timer = null\n }, ms)\n }\n }\n}\n\n/**\n * toggleAttribute (Ponyfill for IE and Edge, fixes #299)\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute\n * @param {Element} el Single DOM Element\n * @param {String} name The name of the attribute to be toggled\n * @param {Boolean} force Force attribute to be added or removed regardless of previous state\n */\nexport function toggleAttribute (el, name, force = !this.hasAttribute(name)) {\n if (!force === el.hasAttribute(name)) el[force ? 'setAttribute' : 'removeAttribute'](name, '')\n return force\n}\n\n/**\n* queryAll\n* @param {String|NodeList|Array|Element} elements A CSS selector string, nodeList, element array, or single element\n* @param {Element} context Node to look for elements within\n* @return {Element[]} Array of elements\n*/\nexport function queryAll (elements, context = document) {\n if (elements) {\n if (elements.nodeType) return [elements]\n if (typeof elements === 'string') return [].slice.call(context.querySelectorAll(elements))\n if (elements.length) return [].slice.call(elements)\n }\n return []\n}\n","import { IS_BROWSER, addStyle, closest, dispatchEvent, throttle, getUUID, queryAll } from '../utils'\n\nconst DRAG = {}\nconst MOVE = { up: { y: -1, prop: 'top' }, down: { y: 1, prop: 'bottom' }, left: { x: -1 }, right: { x: 1 } }\nconst MOVE_SIGNIFICANT = 10\nconst NEEDS_MOUSEDOWN = '[contenteditable=\"true\"],input,select,textarea'\nconst EVENT_PASSIVE = ((has = false) => {\n try { window.addEventListener('test', null, { get passive () { has = { passive: true } } }) } catch (e) {}\n return has\n})()\n\n// https://css-tricks.com/introduction-reduced-motion-media-query/\nconst requestJumps = IS_BROWSER && window.matchMedia && window.matchMedia('(prefers-reduced-motion)').matches\nconst requestFrame = IS_BROWSER && (window.requestAnimationFrame || window.setTimeout)\n\nexport default class CoreScroll extends HTMLElement {\n connectedCallback () {\n // Hide scrollbar in WebKit and default to display block\n addStyle(this.nodeName, `\n ${this.nodeName}{display:block}\n ${this.nodeName}::-webkit-scrollbar{display:none}\n `)\n\n this.style.overflow = 'scroll' // Ensure visible scrollbars\n this.style.willChange = 'scroll-position' // Enhance performance\n this.style.webkitOverflowScrolling = 'touch' // Momentum scroll on iOS\n\n // Calculate sizes for hiding, must be after setting overflow:scroll\n const barWidth = this.offsetWidth - this.clientWidth\n const barHeight = this.offsetHeight - this.clientHeight\n\n // Also ensure height does not grow higher than parent element\n this.style.marginRight = `-${barWidth}px`\n this.style.marginBottom = `-${barHeight}px`\n this.style.maxHeight = `calc(100% + ${barHeight}px)`\n this._throttledEvent = throttle(this.handleEvent.bind(this), 500)\n\n this.addEventListener('mousedown', this)\n this.addEventListener('wheel', this, EVENT_PASSIVE)\n this.addEventListener('scroll', this._throttledEvent, EVENT_PASSIVE)\n window.addEventListener('resize', this._throttledEvent, EVENT_PASSIVE)\n window.addEventListener('load', this) // Update state when we are sure all CSS is loaded\n document.addEventListener('click', this)\n setTimeout(() => this.handleEvent()) // Initialize buttons after children is parsed\n }\n\n disconnectedCallback () {\n this._throttledEvent = null // Garbage collection\n this.removeEventListener('mousedown', this)\n this.removeEventListener('wheel', this, EVENT_PASSIVE)\n this.removeEventListener('scroll', this._throttledEvent, EVENT_PASSIVE)\n window.removeEventListener('resize', this._throttledEvent, EVENT_PASSIVE)\n window.removeEventListener('load', this)\n document.removeEventListener('click', this)\n }\n\n handleEvent (event = {}) {\n if (event.defaultPrevented) return\n if (event.type === 'wheel') DRAG.animate = false // Stop momentum animation onWheel\n else if (event.type === 'mousedown') onMousedown.call(this, event)\n else if (event.type === 'click') {\n const btn = this.id && closest(event.target, `[for=\"${this.id}\"]`)\n if (btn && dispatchEvent(this, 'scroll.click', { move: btn.value })) this.scroll(btn.value)\n } else {\n const scroll = { left: this.scrollLeft, up: this.scrollTop, right: this.scrollRight, down: this.scrollBottom }\n const cursor = (scroll.left || scroll.right || scroll.up || scroll.down) ? 'grab' : ''\n\n queryAll(this.id && `[for=\"${this.id}\"]`).forEach((el) => (el.disabled = !scroll[el.value]))\n dispatchEvent(this, 'scroll.change')\n\n if (!event.type) { // Do not change cursor while dragging\n this.style.cursor = `-webkit-${cursor}`\n this.style.cursor = cursor\n }\n }\n }\n\n scroll (point) {\n const { x, y } = parsePoint(this, point)\n const uuid = DRAG.animate = getUUID() // Giving the animation an ID to workaround IE timeout issues\n const friction = this.friction\n let moveX = requestJumps ? 1 : x - this.scrollLeft\n let moveY = requestJumps ? 1 : y - this.scrollTop\n\n const move = () => {\n if (DRAG.animate === uuid && (Math.round(moveX) || Math.round(moveY))) {\n this.scrollLeft = x - Math.round(moveX *= friction)\n this.scrollTop = y - Math.round(moveY *= friction)\n requestFrame(move)\n }\n }\n move()\n }\n\n get items () { return queryAll(this.getAttribute('items') || this.children, this) }\n\n // Ensure falsy values becomes ''\n set items (val) { this.setAttribute('items', val || '') }\n\n get scrollRight () { return this.scrollWidth - this.clientWidth - this.scrollLeft }\n\n get scrollBottom () { return this.scrollHeight - this.clientHeight - this.scrollTop }\n\n // Avoid friction 1 (infinite)\n get friction () { return Math.min(0.99, this.getAttribute('friction')) || 0.8 }\n\n set friction (val) { this.setAttribute('friction', val) }\n}\n\nfunction onMousedown (event) {\n if (closest(event.target, NEEDS_MOUSEDOWN)) return\n event.preventDefault() // Prevent text selection and enable nesting\n\n DRAG.pageX = event.pageX\n DRAG.pageY = event.pageY\n DRAG.diffSumX = 0\n DRAG.diffSumY = 0\n DRAG.animate = DRAG.diffX = DRAG.diffY = 0 // Reset\n DRAG.scrollX = this.scrollLeft\n DRAG.scrollY = this.scrollTop\n DRAG.target = this\n\n document.body.style.cursor = this.style.cursor = '-webkit-grabbing'\n document.body.style.cursor = this.style.cursor = 'grabbing'\n document.addEventListener('mousemove', onMousemove)\n document.addEventListener('mouseup', onMouseup)\n}\n\nfunction onMousemove (event) {\n DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX)\n DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY)\n DRAG.diffSumX += DRAG.diffX\n DRAG.diffSumY += DRAG.diffY\n DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX\n DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY\n\n // Prevent links when we know there has been significant movement\n if (Math.max(Math.abs(DRAG.diffSumX), Math.abs(DRAG.diffSumY)) > MOVE_SIGNIFICANT) {\n DRAG.target.style.pointerEvents = 'none'\n }\n}\n\nfunction onMouseup (event) {\n const momentum = Math.abs(DRAG.diffX || DRAG.diffY) > MOVE_SIGNIFICANT ? 20 : 0\n document.removeEventListener('mousemove', onMousemove)\n document.removeEventListener('mouseup', onMouseup)\n document.body.style.cursor = ''\n\n if (momentum) {\n DRAG.target.scroll({\n x: DRAG.scrollX + DRAG.diffX * momentum,\n y: DRAG.scrollY + DRAG.diffY * momentum\n })\n }\n DRAG.target.style.pointerEvents = '' // Allow events again\n DRAG.target.style.cursor = '-webkit-grab'\n DRAG.target.style.cursor = 'grab'\n DRAG.target = null // Prevent memory leak\n}\n\nfunction parsePoint (self, move) {\n const point = typeof move === 'object' ? move : { move }\n if (typeof point.x !== 'number') point.x = self.scrollLeft\n if (typeof point.y !== 'number') point.y = self.scrollTop\n if ((point.move = MOVE[point.move])) {\n const axis = point.move.x ? 'x' : 'y'\n const start = point.move.x ? 'left' : 'top'\n const bounds = self.getBoundingClientRect()\n const scroll = bounds[start] - self[point.move.x ? 'scrollLeft' : 'scrollTop']\n const edge = bounds[start] + bounds[point.move.x ? 'width' : 'height'] * point.move[axis]\n\n self.items.every((el) => { // Use .every as this loop stops on return false\n const rect = el.getBoundingClientRect()\n const marg = el.ownerDocument.defaultView.getComputedStyle(el)[`margin-${start}`]\n\n point[axis] = rect[start] - parseInt(marg, 10) - scroll // Update point to child axis coordinate\n return rect[point.move.prop || move] < edge\n })\n }\n return {\n x: Math.max(0, Math.min(point.x, self.scrollWidth - self.clientWidth)),\n y: Math.max(0, Math.min(point.y, self.scrollHeight - self.clientHeight))\n }\n}\n"],"names":["IS_BROWSER","window","test","navigator","userAgent","String","platform","global","HTMLElement","proto","match","closest","Element","prototype","matches","msMatchesSelector","webkitMatchesSelector","el","css","parentElement","call","dispatchEvent","element","name","event","detail","ignore","CustomEvent","bubbles","cancelable","document","createEvent","initCustomEvent","result","queryAll","elements","context","nodeType","slice","querySelectorAll","length","DRAG","MOVE","up","y","prop","down","left","x","right","MOVE_SIGNIFICANT","EVENT_PASSIVE","has","addEventListener","passive","e","requestJumps","matchMedia","requestFrame","requestAnimationFrame","setTimeout","onMousemove","diffX","pageX","diffY","pageY","diffSumX","diffSumY","target","scrollLeft","scrollX","scrollTop","scrollY","Math","max","abs","style","pointerEvents","onMouseup","momentum","removeEventListener","body","cursor","scroll","nodeName","key","toLowerCase","min","replace","getElementById","head","insertAdjacentHTML","addStyle","this","overflow","willChange","webkitOverflowScrolling","barWidth","offsetWidth","clientWidth","barHeight","offsetHeight","clientHeight","marginRight","marginBottom","maxHeight","_throttledEvent","callback","ms","timer","args","apply","throttle","handleEvent","bind","_this","defaultPrevented","type","animate","preventDefault","btn","id","move","value","scrollRight","scrollBottom","forEach","disabled","point","self","_typeof","axis","start","bounds","getBoundingClientRect","edge","items","every","rect","marg","ownerDocument","defaultView","getComputedStyle","parseInt","scrollWidth","scrollHeight","parsePoint","uuid","Date","now","toString","random","friction","moveX","moveY","round","_this2","getAttribute","children","val","setAttribute"],"mappings":";q/DAAO,IAAMA,EAA+B,oBAAXC,OACPD,GAAc,aAAaE,KAAKC,UAAUC,WAC9CJ,GAAc,mBAAmBE,KAAKG,OAAOF,UAAUG,WAGxEN,GAAeO,OAAOC,cACzBD,OAAOC,0DA2CF,IACCC,EACAC,EAFKC,GACLF,EAA0B,oBAAXR,OAAyB,GAAKA,OAAOW,QAAQC,UAC5DH,EAAQD,EAAMK,SAAWL,EAAMM,mBAAqBN,EAAMO,sBACzDP,EAAME,QAAU,SAACM,EAAIC,UAAQD,EAAGN,QAAQO,IAAO,SAAC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AAYC,aAAa,WAAYD"} |
+26
-28
@@ -1,32 +0,30 @@ | ||
| import test from 'ava' | ||
| import fs from 'fs' | ||
| import path from 'path' | ||
| import puppeteer from 'puppeteer' | ||
| async function withPage (t, run) { | ||
| const browser = await puppeteer.launch() | ||
| const page = await browser.newPage() | ||
| page.on('console', msg => console.log(msg._text)) | ||
| await page.addScriptTag({ path: path.join(__dirname, 'core-scroll.min.js') }) | ||
| try { | ||
| await run(t, page) | ||
| } finally { | ||
| await page.close() | ||
| await browser.close() | ||
| } | ||
| } | ||
| const coreScroll = fs.readFileSync(path.resolve(__dirname, 'core-scroll.min.js'), 'utf-8') | ||
| const customElements = fs.readFileSync(require.resolve('@webcomponents/custom-elements'), 'utf-8') | ||
| test('sets up properties', withPage, async (t, page) => { | ||
| await page.setContent(` | ||
| <button for="scroller" value="down">Down</button> | ||
| <core-scroll id="scroller"> | ||
| <div>This is overflowing content</div> | ||
| <div>This is overflowing content</div> | ||
| <div>This is overflowing content</div> | ||
| </core-scroll> | ||
| `) | ||
| t.is(await page.$eval('core-scroll', el => el.style.overflow), 'scroll') | ||
| t.is(await page.$eval('core-scroll', el => el.style.webkitOverflowScrolling), 'touch') | ||
| t.is(await page.$eval('core-scroll', el => el.style.maxHeight), 'calc(100% + 0px)') | ||
| t.is(await page.$eval('core-scroll', el => el.style.marginRight), '0px') | ||
| t.is(await page.$eval('core-scroll', el => el.style.marginBottom), '0px') | ||
| describe('core-scroll', () => { | ||
| beforeEach(async () => { | ||
| await browser.refresh() | ||
| await browser.executeScript(customElements) | ||
| await browser.executeScript(coreScroll) | ||
| }) | ||
| it('sets up properties', async () => { | ||
| await browser.executeScript(() => { | ||
| document.body.innerHTML = ` | ||
| <button for="scroller" value="down">Down</button> | ||
| <core-scroll id="scroller"> | ||
| <div>This is overflowing content</div> | ||
| <div>This is overflowing content</div> | ||
| <div>This is overflowing content</div> | ||
| </core-scroll> | ||
| ` | ||
| }) | ||
| await expect($('core-scroll').getCssValue('overflow')).toEqual('scroll') | ||
| await expect($('core-scroll').getCssValue('max-height')).toEqual('100%') | ||
| await expect($('core-scroll').getCssValue('margin-right')).toEqual('0px') | ||
| await expect($('core-scroll').getCssValue('margin-bottom')).toEqual('0px') | ||
| }) | ||
| }) |
+9
-9
@@ -327,14 +327,14 @@ 'use strict'; | ||
| var CoreScoll = | ||
| var CoreScroll = | ||
| /*#__PURE__*/ | ||
| function (_HTMLElement) { | ||
| _inherits(CoreScoll, _HTMLElement); | ||
| _inherits(CoreScroll, _HTMLElement); | ||
| function CoreScoll() { | ||
| _classCallCheck(this, CoreScoll); | ||
| function CoreScroll() { | ||
| _classCallCheck(this, CoreScroll); | ||
| return _possibleConstructorReturn(this, _getPrototypeOf(CoreScoll).apply(this, arguments)); | ||
| return _possibleConstructorReturn(this, _getPrototypeOf(CoreScroll).apply(this, arguments)); | ||
| } | ||
| _createClass(CoreScoll, [{ | ||
| _createClass(CoreScroll, [{ | ||
| key: "connectedCallback", | ||
@@ -469,3 +469,3 @@ value: function connectedCallback() { | ||
| return CoreScoll; | ||
| return CoreScroll; | ||
| }(_wrapNativeSuper(HTMLElement)); | ||
@@ -554,3 +554,3 @@ | ||
| var version = "4.1.1"; | ||
| var version = "4.1.2"; | ||
@@ -695,3 +695,3 @@ /** | ||
| var coreScroll = customElementToReact(CoreScoll, { | ||
| var coreScroll = customElementToReact(CoreScroll, { | ||
| customEvents: ['scroll.change', 'scroll.click'], | ||
@@ -698,0 +698,0 @@ suffix: version |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "author": "NRK <opensource@nrk.no> (https://www.nrk.no/)", | ||
| "version": "4.1.1", | ||
| "version": "4.1.2", | ||
| "license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "core-scroll.cjs.js", |
+1
-1
@@ -245,3 +245,3 @@ # Core Scroll | ||
| // Example check if the event.target is the correct @nrk/core-scoll | ||
| // Example check if the event.target is the correct @nrk/core-scroll | ||
| if (event.target.id === 'ID-OF-MY-CORE-SCROLL-HERE') { | ||
@@ -248,0 +248,0 @@ // Do Something |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
0
-100%151144
-0.01%1861
-0.16%2
100%