Socket
Socket
Sign inDemoInstall

shorter-js

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shorter-js - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

112

dist/shorter-js.esm.js
/*!
* shorter-js v0.2.4 (https://github.com/thednp/shorter-js)
* shorter-js v0.2.5 (https://github.com/thednp/shorter-js)
* Copyright 2019-2021 © dnp_theme

@@ -237,6 +237,6 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE)

*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -251,6 +251,6 @@ function on(element, eventName, handler, options) {

*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -266,6 +266,6 @@ function off(element, eventName, handler, options) {

*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -290,4 +290,4 @@ function one(element, eventName, handler, options) {

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -309,4 +309,4 @@ function getElementAnimationDelay(element) {

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -328,4 +328,4 @@ function getElementAnimationDuration(element) {

*
* @param {Element} element target
* @param {Function} handler `animationend` callback
* @param {HTMLElement} element target
* @param {function} handler `animationend` callback
*/

@@ -341,3 +341,4 @@ function emulateAnimationEnd(element, handler) {

* Wrap the handler in on -> off callback
* @param {object | Event} e Event object
* @param {object} e Event object
* @callback
*/

@@ -364,4 +365,4 @@ const animationEndWrapper = (e) => {

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -383,4 +384,4 @@ function getElementTransitionDelay(element) {

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -402,4 +403,4 @@ function getElementTransitionDuration(element) {

*
* @param {Element} element target
* @param {Function} handler `transitionend` callback
* @param {HTMLElement} element target
* @param {function} handler `transitionend` callback
*/

@@ -415,3 +416,4 @@ function emulateTransitionEnd(element, handler) {

* Wrap the handler in on -> off callback
* @param {object | Event} e Event object
* @param {object} e Event object
* @callback
*/

@@ -438,4 +440,4 @@ const transitionEndWrapper = (e) => {

*
* @param {Element} element target
* @return {Boolean} Boolean
* @param {HTMLElement} element target
* @return {boolean} Boolean
*/

@@ -452,4 +454,4 @@ function isElementInScrollRange(element) {

*
* @param {Element} element target
* @return {Boolean} Boolean
* @param {HTMLElement} element target
* @return {boolean} Boolean
*/

@@ -477,9 +479,9 @@ function isElementInViewport(element) {

*
* @param {string | Element} selector the input selector or target element
* @param {?Element} parent optional Element to look into
* @return {null | Element} the Element or result of the querySelector
* @param {HTMLElement | string} selector the input selector or target element
* @param {HTMLElement | null} parent optional Element to look into
* @return {HTMLElement | null} the Element or result of the querySelector
*/
function queryElement(selector, parent) {
const lookUp = parent && parent instanceof Element ? parent : document;
return selector instanceof Element ? selector : lookUp.querySelector(selector);
const lookUp = parent && parent instanceof HTMLElement ? parent : document;
return selector instanceof HTMLElement ? selector : lookUp.querySelector(selector);
}

@@ -490,37 +492,29 @@

*
* @typedef rawValue
* @type {string | Function | Element | Boolean | object}
* @typedef {string | Element | Function | number | boolean | null} niceValue
*/
/**
* The raw value or a given component option.
*
* @typedef niceValue
* @type {string | Function | Element | object | Number | Boolean}
*/
/**
* Utility to normalize component options
*
* @param {rawValue} value the input value
* @param {any} value the input value
* @return {niceValue} the normalized value
*/
function normalizeValue(value) {
if (value === 'true') {
if (value === 'true') { // boolean
return true;
}
if (value === 'false') {
if (value === 'false') { // boolean
return false;
}
if (!Number.isNaN(+value)) {
if (!Number.isNaN(+value)) { // number
return +value;
}
if (value === '' || value === 'null') {
if (value === '' || value === 'null') { // null
return null;
}
// string / function / Element / Object
// string / function / Element / object
return value;

@@ -532,3 +526,3 @@ }

*
* @param {Element} element target
* @param {HTMLElement} element target
* @param {object} defaultOps component default options

@@ -540,8 +534,7 @@ * @param {object} inputOps component instance options

function normalizeOptions(element, defaultOps, inputOps, ns) {
const { ...dataset } = element;
const normalOps = {};
const dataOps = {};
// @ts-ignore
const data = { ...element.dataset };
Object.keys(data)
Object.keys(dataset)
.forEach((k) => {

@@ -552,3 +545,3 @@ const key = k.includes(ns)

dataOps[key] = normalizeValue(data[k]);
dataOps[key] = normalizeValue(dataset[k]);
});

@@ -590,11 +583,10 @@

*
* @param {Element} element is the target
* @return {Number} the Element.offsetHeight value
* @param {HTMLElement} element is the target
* @return {number} the Element.offsetHeight value
*/
function reflow(element) {
// @ts-ignore
return element.offsetHeight;
}
var version = "0.2.4";
var version = "0.2.5";

@@ -601,0 +593,0 @@ // @ts-ignore

@@ -1,2 +0,2 @@

// shorter-js v0.2.4 | dnp_theme © 2021 | MIT-License
const e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",t="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",o="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",s="webkitTransition"in document.head.style?"webkitTransition":"transition",r="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c=/iPhone|iPad|iPod|Android/i;let m=!1;m=navigator.userAgentData?navigator.userAgentData.brands.some(e=>c.test(e.brand)):c.test(navigator.userAgent);const d=m,l="webkitPerspective"in document.head.style||"perspective"in document.head.style,b=(()=>{let e=!1;try{const n=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,n)}),n)}catch(e){throw Error("Passive events are not supported")}return e})(),p="webkitTransform"in document.head.style||"transform"in document.head.style,g="ontouchstart"in window||"msMaxTouchPoints"in navigator,v="webkitAnimation"in document.head.style||"animation"in document.head.style,E="webkitTransition"in document.head.style||"transition"in document.head.style;function f(e,n,t,i){const o=i||!1;e.addEventListener(n,t,o)}function y(e,n,t,i){const o=i||!1;e.removeEventListener(n,t,o)}function h(e){const n=getComputedStyle(e),i=n[o],a=n[t],s=a.includes("ms")?1:1e3,r=v&&i&&"none"!==i?parseFloat(a)*s:0;return Number.isNaN(r)?0:r}function w(e){const t=getComputedStyle(e),i=t[o],a=t[n],s=a.includes("ms")?1:1e3,r=v&&i&&"none"!==i?parseFloat(a)*s:0;return Number.isNaN(r)?0:r}function k(e){const n=getComputedStyle(e),t=n[s],i=n[r],o=i.includes("ms")?1:1e3,a=E&&t&&"none"!==t?parseFloat(i)*o:0;return Number.isNaN(a)?0:a}function z(e){const n=getComputedStyle(e),t=n[s],i=n[a],o=i.includes("ms")?1:1e3,r=E&&t&&"none"!==t?parseFloat(i)*o:0;return Number.isNaN(r)?0:r}function O(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const D={mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:e,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},focusEvents:{in:"focusin",out:"focusout"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:n,animationDelay:t,animationName:o,animationEndEvent:i,transitionDuration:a,transitionDelay:r,transitionEndEvent:u,transitionProperty:s,isMobile:d,support3DTransform:l,supportPassive:b,supportTransform:p,supportTouch:g,supportAnimation:v,supportTransition:E,addEventListener:"addEventListener",removeEventListener:"removeEventListener",addClass:function(e,n){e.classList.add(n)},removeClass:function(e,n){e.classList.remove(n)},hasClass:function(e,n){return e.classList.contains(n)},on:f,off:y,one:function(e,n,t,i){f(e,n,(function o(a){a.target===e&&(t.apply(e,[a]),y(e,n,o,i))}),i)},emulateAnimationEnd:function(e,n){let t=0;const o=new Event(i),a=w(e),s=h(e);if(a){const r=o=>{o.target===e&&(n.apply(e,[o]),e.removeEventListener(i,r),t=1)};e.addEventListener(i,r),setTimeout(()=>{t||e.dispatchEvent(o)},a+s+17)}else n.apply(e,[o])},emulateTransitionEnd:function(e,n){let t=0;const i=new Event(u),o=z(e),a=k(e);if(o){const s=i=>{i.target===e&&(n.apply(e,[i]),e.removeEventListener(u,s),t=1)};e.addEventListener(u,s),setTimeout(()=>{t||e.dispatchEvent(i)},o+a+17)}else n.apply(e,[i])},isElementInScrollRange:function(e){const n=e.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;return n.top<=t&&n.bottom>=0},isElementInViewport:function(e){const n=e.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!b&&{passive:!0},getElementAnimationDuration:w,getElementAnimationDelay:h,getElementTransitionDuration:z,getElementTransitionDelay:k,queryElement:function(e,n){const t=n&&n instanceof Element?n:document;return e instanceof Element?e:t.querySelector(e)},normalizeValue:O,normalizeOptions:function(e,n,t,i){const o={},a={},s={...e.dataset};return Object.keys(s).forEach(e=>{const n=e.includes(i)?e.replace(i,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;a[n]=O(s[e])}),Object.keys(t).forEach(e=>{t[e]=O(t[e])}),Object.keys(n).forEach(e=>{o[e]=e in t?t[e]:e in a?a[e]:n[e]}),o},tryWrapper:function(e,n){try{e()}catch(e){throw TypeError(`${n} ${e}`)}},reflow:function(e){return e.offsetHeight},Version:"0.2.4"};export default D;
// shorter-js v0.2.5 | dnp_theme © 2021 | MIT-License
const e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",t="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",o="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",s="webkitTransition"in document.head.style?"webkitTransition":"transition",r="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c=/iPhone|iPad|iPod|Android/i;let m=!1;m=navigator.userAgentData?navigator.userAgentData.brands.some(e=>c.test(e.brand)):c.test(navigator.userAgent);const d=m,l="webkitPerspective"in document.head.style||"perspective"in document.head.style,b=(()=>{let e=!1;try{const n=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,n)}),n)}catch(e){throw Error("Passive events are not supported")}return e})(),p="webkitTransform"in document.head.style||"transform"in document.head.style,g="ontouchstart"in window||"msMaxTouchPoints"in navigator,v="webkitAnimation"in document.head.style||"animation"in document.head.style,E="webkitTransition"in document.head.style||"transition"in document.head.style;function f(e,n,t,i){const o=i||!1;e.addEventListener(n,t,o)}function y(e,n,t,i){const o=i||!1;e.removeEventListener(n,t,o)}function h(e){const n=getComputedStyle(e),i=n[o],a=n[t],s=a.includes("ms")?1:1e3,r=v&&i&&"none"!==i?parseFloat(a)*s:0;return Number.isNaN(r)?0:r}function w(e){const t=getComputedStyle(e),i=t[o],a=t[n],s=a.includes("ms")?1:1e3,r=v&&i&&"none"!==i?parseFloat(a)*s:0;return Number.isNaN(r)?0:r}function k(e){const n=getComputedStyle(e),t=n[s],i=n[r],o=i.includes("ms")?1:1e3,a=E&&t&&"none"!==t?parseFloat(i)*o:0;return Number.isNaN(a)?0:a}function z(e){const n=getComputedStyle(e),t=n[s],i=n[a],o=i.includes("ms")?1:1e3,r=E&&t&&"none"!==t?parseFloat(i)*o:0;return Number.isNaN(r)?0:r}function O(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const T={mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:e,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},focusEvents:{in:"focusin",out:"focusout"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:n,animationDelay:t,animationName:o,animationEndEvent:i,transitionDuration:a,transitionDelay:r,transitionEndEvent:u,transitionProperty:s,isMobile:d,support3DTransform:l,supportPassive:b,supportTransform:p,supportTouch:g,supportAnimation:v,supportTransition:E,addEventListener:"addEventListener",removeEventListener:"removeEventListener",addClass:function(e,n){e.classList.add(n)},removeClass:function(e,n){e.classList.remove(n)},hasClass:function(e,n){return e.classList.contains(n)},on:f,off:y,one:function(e,n,t,i){f(e,n,(function o(a){a.target===e&&(t.apply(e,[a]),y(e,n,o,i))}),i)},emulateAnimationEnd:function(e,n){let t=0;const o=new Event(i),a=w(e),s=h(e);if(a){const r=o=>{o.target===e&&(n.apply(e,[o]),e.removeEventListener(i,r),t=1)};e.addEventListener(i,r),setTimeout(()=>{t||e.dispatchEvent(o)},a+s+17)}else n.apply(e,[o])},emulateTransitionEnd:function(e,n){let t=0;const i=new Event(u),o=z(e),a=k(e);if(o){const s=i=>{i.target===e&&(n.apply(e,[i]),e.removeEventListener(u,s),t=1)};e.addEventListener(u,s),setTimeout(()=>{t||e.dispatchEvent(i)},o+a+17)}else n.apply(e,[i])},isElementInScrollRange:function(e){const n=e.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;return n.top<=t&&n.bottom>=0},isElementInViewport:function(e){const n=e.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!b&&{passive:!0},getElementAnimationDuration:w,getElementAnimationDelay:h,getElementTransitionDuration:z,getElementTransitionDelay:k,queryElement:function(e,n){const t=n&&n instanceof HTMLElement?n:document;return e instanceof HTMLElement?e:t.querySelector(e)},normalizeValue:O,normalizeOptions:function(e,n,t,i){const{...o}=e,a={},s={};return Object.keys(o).forEach(e=>{const n=e.includes(i)?e.replace(i,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;s[n]=O(o[e])}),Object.keys(t).forEach(e=>{t[e]=O(t[e])}),Object.keys(n).forEach(e=>{a[e]=e in t?t[e]:e in s?s[e]:n[e]}),a},tryWrapper:function(e,n){try{e()}catch(e){throw TypeError(`${n} ${e}`)}},reflow:function(e){return e.offsetHeight},Version:"0.2.5"};export default T;
/*!
* shorter-js v0.2.4 (https://github.com/thednp/shorter-js)
* shorter-js v0.2.5 (https://github.com/thednp/shorter-js)
* Copyright 2019-2021 © dnp_theme

@@ -243,6 +243,6 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE)

*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -257,6 +257,6 @@ function on(element, eventName, handler, options) {

*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -272,6 +272,6 @@ function off(element, eventName, handler, options) {

*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -296,4 +296,4 @@ function one(element, eventName, handler, options) {

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -315,4 +315,4 @@ function getElementAnimationDelay(element) {

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -334,4 +334,4 @@ function getElementAnimationDuration(element) {

*
* @param {Element} element target
* @param {Function} handler `animationend` callback
* @param {HTMLElement} element target
* @param {function} handler `animationend` callback
*/

@@ -347,3 +347,4 @@ function emulateAnimationEnd(element, handler) {

* Wrap the handler in on -> off callback
* @param {object | Event} e Event object
* @param {object} e Event object
* @callback
*/

@@ -370,4 +371,4 @@ var animationEndWrapper = function (e) {

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -389,4 +390,4 @@ function getElementTransitionDelay(element) {

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -408,4 +409,4 @@ function getElementTransitionDuration(element) {

*
* @param {Element} element target
* @param {Function} handler `transitionend` callback
* @param {HTMLElement} element target
* @param {function} handler `transitionend` callback
*/

@@ -421,3 +422,4 @@ function emulateTransitionEnd(element, handler) {

* Wrap the handler in on -> off callback
* @param {object | Event} e Event object
* @param {object} e Event object
* @callback
*/

@@ -444,4 +446,4 @@ var transitionEndWrapper = function (e) {

*
* @param {Element} element target
* @return {Boolean} Boolean
* @param {HTMLElement} element target
* @return {boolean} Boolean
*/

@@ -458,4 +460,4 @@ function isElementInScrollRange(element) {

*
* @param {Element} element target
* @return {Boolean} Boolean
* @param {HTMLElement} element target
* @return {boolean} Boolean
*/

@@ -483,9 +485,9 @@ function isElementInViewport(element) {

*
* @param {string | Element} selector the input selector or target element
* @param {?Element} parent optional Element to look into
* @return {null | Element} the Element or result of the querySelector
* @param {HTMLElement | string} selector the input selector or target element
* @param {HTMLElement | null} parent optional Element to look into
* @return {HTMLElement | null} the Element or result of the querySelector
*/
function queryElement(selector, parent) {
var lookUp = parent && parent instanceof Element ? parent : document;
return selector instanceof Element ? selector : lookUp.querySelector(selector);
var lookUp = parent && parent instanceof HTMLElement ? parent : document;
return selector instanceof HTMLElement ? selector : lookUp.querySelector(selector);
}

@@ -496,44 +498,38 @@

*
* @typedef rawValue
* @type {string | Function | Element | Boolean | object}
* @typedef {string | Element | Function | number | boolean | null} niceValue
*/
/**
* The raw value or a given component option.
*
* @typedef niceValue
* @type {string | Function | Element | object | Number | Boolean}
*/
/**
* Utility to normalize component options
*
* @param {rawValue} value the input value
* @param {any} value the input value
* @return {niceValue} the normalized value
*/
function normalizeValue(value) {
if (value === 'true') {
if (value === 'true') { // boolean
return true;
}
if (value === 'false') {
if (value === 'false') { // boolean
return false;
}
if (!Number.isNaN(+value)) {
if (!Number.isNaN(+value)) { // number
return +value;
}
if (value === '' || value === 'null') {
if (value === '' || value === 'null') { // null
return null;
}
// string / function / Element / Object
// string / function / Element / object
return value;
}
function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }
/**
* Utility to normalize component options
*
* @param {Element} element target
* @param {HTMLElement} element target
* @param {object} defaultOps component default options

@@ -545,8 +541,8 @@ * @param {object} inputOps component instance options

function normalizeOptions(element, defaultOps, inputOps, ns) {
var rest = objectWithoutProperties( element, [] );
var dataset = rest;
var normalOps = {};
var dataOps = {};
// @ts-ignore
var data = Object.assign({}, element.dataset);
Object.keys(data)
Object.keys(dataset)
.forEach(function (k) {

@@ -557,3 +553,3 @@ var key = k.includes(ns)

dataOps[key] = normalizeValue(data[k]);
dataOps[key] = normalizeValue(dataset[k]);
});

@@ -595,11 +591,10 @@

*
* @param {Element} element is the target
* @return {Number} the Element.offsetHeight value
* @param {HTMLElement} element is the target
* @return {number} the Element.offsetHeight value
*/
function reflow(element) {
// @ts-ignore
return element.offsetHeight;
}
var version = "0.2.4";
var version = "0.2.5";

@@ -606,0 +601,0 @@ // @ts-ignore

@@ -1,2 +0,2 @@

// shorter-js v0.2.4 | dnp_theme © 2021 | MIT-License
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).SHORTER=n()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",t="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",a="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",o="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",r="webkitTransition"in document.head.style?"webkitTransition":"transition",u="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",s="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c=/iPhone|iPad|iPod|Android/i,d=navigator.userAgentData?navigator.userAgentData.brands.some((function(e){return c.test(e.brand)})):c.test(navigator.userAgent),m="webkitPerspective"in document.head.style||"perspective"in document.head.style,l=function(){var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return e=!0}});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,n)}),n)}catch(e){throw Error("Passive events are not supported")}return e}(),b="webkitTransform"in document.head.style||"transform"in document.head.style,v="ontouchstart"in window||"msMaxTouchPoints"in navigator,f="webkitAnimation"in document.head.style||"animation"in document.head.style,p="webkitTransition"in document.head.style||"transition"in document.head.style;function g(e,n,t,i){var a=i||!1;e.addEventListener(n,t,a)}function E(e,n,t,i){var a=i||!1;e.removeEventListener(n,t,a)}function y(e){var n=getComputedStyle(e),i=n[a],o=n[t],r=o.includes("ms")?1:1e3,u=f&&i&&"none"!==i?parseFloat(o)*r:0;return Number.isNaN(u)?0:u}function h(e){var t=getComputedStyle(e),i=t[a],o=t[n],r=o.includes("ms")?1:1e3,u=f&&i&&"none"!==i?parseFloat(o)*r:0;return Number.isNaN(u)?0:u}function w(e){var n=getComputedStyle(e),t=n[r],i=n[u],a=i.includes("ms")?1:1e3,o=p&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(o)?0:o}function k(e){var n=getComputedStyle(e),t=n[r],i=n[o],a=i.includes("ms")?1:1e3,u=p&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(u)?0:u}function z(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}return{mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:e,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},focusEvents:{in:"focusin",out:"focusout"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:n,animationDelay:t,animationName:a,animationEndEvent:i,transitionDuration:o,transitionDelay:u,transitionEndEvent:s,transitionProperty:r,isMobile:d,support3DTransform:m,supportPassive:l,supportTransform:b,supportTouch:v,supportAnimation:f,supportTransition:p,addEventListener:"addEventListener",removeEventListener:"removeEventListener",addClass:function(e,n){e.classList.add(n)},removeClass:function(e,n){e.classList.remove(n)},hasClass:function(e,n){return e.classList.contains(n)},on:g,off:E,one:function(e,n,t,i){g(e,n,(function a(o){o.target===e&&(t.apply(e,[o]),E(e,n,a,i))}),i)},emulateAnimationEnd:function(e,n){var t=0,a=new Event(i),o=h(e),r=y(e);if(o){var u=function(a){a.target===e&&(n.apply(e,[a]),e.removeEventListener(i,u),t=1)};e.addEventListener(i,u),setTimeout((function(){t||e.dispatchEvent(a)}),o+r+17)}else n.apply(e,[a])},emulateTransitionEnd:function(e,n){var t=0,i=new Event(s),a=k(e),o=w(e);if(a){var r=function(i){i.target===e&&(n.apply(e,[i]),e.removeEventListener(s,r),t=1)};e.addEventListener(s,r),setTimeout((function(){t||e.dispatchEvent(i)}),a+o+17)}else n.apply(e,[i])},isElementInScrollRange:function(e){var n=e.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;return n.top<=t&&n.bottom>=0},isElementInViewport:function(e){var n=e.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!l&&{passive:!0},getElementAnimationDuration:h,getElementAnimationDelay:y,getElementTransitionDuration:k,getElementTransitionDelay:w,queryElement:function(e,n){var t=n&&n instanceof Element?n:document;return e instanceof Element?e:t.querySelector(e)},normalizeValue:z,normalizeOptions:function(e,n,t,i){var a={},o={},r=Object.assign({},e.dataset);return Object.keys(r).forEach((function(e){var n=e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;o[n]=z(r[e])})),Object.keys(t).forEach((function(e){t[e]=z(t[e])})),Object.keys(n).forEach((function(e){a[e]=e in t?t[e]:e in o?o[e]:n[e]})),a},tryWrapper:function(e,n){try{e()}catch(e){throw TypeError(n+" "+e)}},reflow:function(e){return e.offsetHeight},Version:"0.2.4"}}));
// shorter-js v0.2.5 | dnp_theme © 2021 | MIT-License
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).SHORTER=n()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",t="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",o="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",r="webkitTransition"in document.head.style?"webkitTransition":"transition",u="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",s="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c=/iPhone|iPad|iPod|Android/i,d=navigator.userAgentData?navigator.userAgentData.brands.some((function(e){return c.test(e.brand)})):c.test(navigator.userAgent),m="webkitPerspective"in document.head.style||"perspective"in document.head.style,l=function(){var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return e=!0}});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,n)}),n)}catch(e){throw Error("Passive events are not supported")}return e}(),b="webkitTransform"in document.head.style||"transform"in document.head.style,v="ontouchstart"in window||"msMaxTouchPoints"in navigator,f="webkitAnimation"in document.head.style||"animation"in document.head.style,p="webkitTransition"in document.head.style||"transition"in document.head.style;function g(e,n,t,i){var o=i||!1;e.addEventListener(n,t,o)}function E(e,n,t,i){var o=i||!1;e.removeEventListener(n,t,o)}function y(e){var n=getComputedStyle(e),i=n[o],a=n[t],r=a.includes("ms")?1:1e3,u=f&&i&&"none"!==i?parseFloat(a)*r:0;return Number.isNaN(u)?0:u}function h(e){var t=getComputedStyle(e),i=t[o],a=t[n],r=a.includes("ms")?1:1e3,u=f&&i&&"none"!==i?parseFloat(a)*r:0;return Number.isNaN(u)?0:u}function w(e){var n=getComputedStyle(e),t=n[r],i=n[u],o=i.includes("ms")?1:1e3,a=p&&t&&"none"!==t?parseFloat(i)*o:0;return Number.isNaN(a)?0:a}function k(e){var n=getComputedStyle(e),t=n[r],i=n[a],o=i.includes("ms")?1:1e3,u=p&&t&&"none"!==t?parseFloat(i)*o:0;return Number.isNaN(u)?0:u}function z(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}return{mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:e,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},focusEvents:{in:"focusin",out:"focusout"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:n,animationDelay:t,animationName:o,animationEndEvent:i,transitionDuration:a,transitionDelay:u,transitionEndEvent:s,transitionProperty:r,isMobile:d,support3DTransform:m,supportPassive:l,supportTransform:b,supportTouch:v,supportAnimation:f,supportTransition:p,addEventListener:"addEventListener",removeEventListener:"removeEventListener",addClass:function(e,n){e.classList.add(n)},removeClass:function(e,n){e.classList.remove(n)},hasClass:function(e,n){return e.classList.contains(n)},on:g,off:E,one:function(e,n,t,i){g(e,n,(function o(a){a.target===e&&(t.apply(e,[a]),E(e,n,o,i))}),i)},emulateAnimationEnd:function(e,n){var t=0,o=new Event(i),a=h(e),r=y(e);if(a){var u=function(o){o.target===e&&(n.apply(e,[o]),e.removeEventListener(i,u),t=1)};e.addEventListener(i,u),setTimeout((function(){t||e.dispatchEvent(o)}),a+r+17)}else n.apply(e,[o])},emulateTransitionEnd:function(e,n){var t=0,i=new Event(s),o=k(e),a=w(e);if(o){var r=function(i){i.target===e&&(n.apply(e,[i]),e.removeEventListener(s,r),t=1)};e.addEventListener(s,r),setTimeout((function(){t||e.dispatchEvent(i)}),o+a+17)}else n.apply(e,[i])},isElementInScrollRange:function(e){var n=e.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;return n.top<=t&&n.bottom>=0},isElementInViewport:function(e){var n=e.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!l&&{passive:!0},getElementAnimationDuration:h,getElementAnimationDelay:y,getElementTransitionDuration:k,getElementTransitionDelay:w,queryElement:function(e,n){var t=n&&n instanceof HTMLElement?n:document;return e instanceof HTMLElement?e:t.querySelector(e)},normalizeValue:z,normalizeOptions:function(e,n,t,i){var o=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&-1===n.indexOf(i)&&(t[i]=e[i]);return t}(e,[]),a={},r={};return Object.keys(o).forEach((function(e){var n=e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;r[n]=z(o[e])})),Object.keys(t).forEach((function(e){t[e]=z(t[e])})),Object.keys(n).forEach((function(e){a[e]=e in t?t[e]:e in r?r[e]:n[e]})),a},tryWrapper:function(e,n){try{e()}catch(e){throw TypeError(n+" "+e)}},reflow:function(e){return e.offsetHeight},Version:"0.2.5"}}));
{
"name": "shorter-js",
"version": "0.2.4",
"version": "0.2.5",
"description": "A small ES6+ library with various JavaScript tools useful for creating light libraries.",

@@ -5,0 +5,0 @@ "main": "dist/shorter-js.min.js",

/**
* Remove eventListener from Element
*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -9,0 +9,0 @@ export default function off(element, eventName, handler, options) {

/**
* Add eventListener to Element
*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -9,0 +9,0 @@ export default function on(element, eventName, handler, options) {

@@ -8,6 +8,6 @@ import on from './on';

*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/

@@ -14,0 +14,0 @@ export default function one(element, eventName, handler, options) {

@@ -9,4 +9,4 @@ import animationEndEvent from '../strings/animationEndEvent';

*
* @param {Element} element target
* @param {Function} handler `animationend` callback
* @param {HTMLElement} element target
* @param {function} handler `animationend` callback
*/

@@ -22,3 +22,4 @@ export default function emulateAnimationEnd(element, handler) {

* Wrap the handler in on -> off callback
* @param {object | Event} e Event object
* @param {object} e Event object
* @callback
*/

@@ -25,0 +26,0 @@ const animationEndWrapper = (e) => {

@@ -9,4 +9,4 @@ import transitionEndEvent from '../strings/transitionEndEvent';

*
* @param {Element} element target
* @param {Function} handler `transitionend` callback
* @param {HTMLElement} element target
* @param {function} handler `transitionend` callback
*/

@@ -22,3 +22,4 @@ export default function emulateTransitionEnd(element, handler) {

* Wrap the handler in on -> off callback
* @param {object | Event} e Event object
* @param {object} e Event object
* @callback
*/

@@ -25,0 +26,0 @@ const transitionEndWrapper = (e) => {

@@ -9,4 +9,4 @@ import supportAnimation from '../boolean/supportAnimation';

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -13,0 +13,0 @@ export default function getElementAnimationDelay(element) {

@@ -9,4 +9,4 @@ import supportAnimation from '../boolean/supportAnimation';

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -13,0 +13,0 @@ export default function getElementAnimationDuration(element) {

@@ -9,4 +9,4 @@ import supportTransition from '../boolean/supportTransition';

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -13,0 +13,0 @@ export default function getElementTransitionDelay(element) {

@@ -9,4 +9,4 @@ import supportTransition from '../boolean/supportTransition';

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/

@@ -13,0 +13,0 @@ export default function getElementTransitionDuration(element) {

@@ -5,4 +5,4 @@ /**

*
* @param {Element} element target
* @return {Boolean} Boolean
* @param {HTMLElement} element target
* @return {boolean} Boolean
*/

@@ -9,0 +9,0 @@ export default function isElementInScrollRange(element) {

@@ -5,4 +5,4 @@ /**

*
* @param {Element} element target
* @return {Boolean} Boolean
* @param {HTMLElement} element target
* @return {boolean} Boolean
*/

@@ -9,0 +9,0 @@ export default function isElementInViewport(element) {

@@ -6,3 +6,3 @@ import normalizeValue from './normalizeValue';

*
* @param {Element} element target
* @param {HTMLElement} element target
* @param {object} defaultOps component default options

@@ -14,8 +14,7 @@ * @param {object} inputOps component instance options

export default function normalizeOptions(element, defaultOps, inputOps, ns) {
const { ...dataset } = element;
const normalOps = {};
const dataOps = {};
// @ts-ignore
const data = { ...element.dataset };
Object.keys(data)
Object.keys(dataset)
.forEach((k) => {

@@ -26,3 +25,3 @@ const key = k.includes(ns)

dataOps[key] = normalizeValue(data[k]);
dataOps[key] = normalizeValue(dataset[k]);
});

@@ -29,0 +28,0 @@

/**
* The raw value or a given component option.
*
* @typedef rawValue
* @type {string | Function | Element | Boolean | object}
* @typedef {string | Element | Function | number | boolean | null} niceValue
*/
/**
* The raw value or a given component option.
*
* @typedef niceValue
* @type {string | Function | Element | object | Number | Boolean}
*/
/**
* Utility to normalize component options
*
* @param {rawValue} value the input value
* @param {any} value the input value
* @return {niceValue} the normalized value
*/
export default function normalizeValue(value) {
if (value === 'true') {
if (value === 'true') { // boolean
return true;
}
if (value === 'false') {
if (value === 'false') { // boolean
return false;
}
if (!Number.isNaN(+value)) {
if (!Number.isNaN(+value)) { // number
return +value;
}
if (value === '' || value === 'null') {
if (value === '' || value === 'null') { // null
return null;
}
// string / function / Element / Object
// string / function / Element / object
return value;
}

@@ -5,9 +5,9 @@ /**

*
* @param {string | Element} selector the input selector or target element
* @param {?Element} parent optional Element to look into
* @return {null | Element} the Element or result of the querySelector
* @param {HTMLElement | string} selector the input selector or target element
* @param {HTMLElement | null} parent optional Element to look into
* @return {HTMLElement | null} the Element or result of the querySelector
*/
export default function queryElement(selector, parent) {
const lookUp = parent && parent instanceof Element ? parent : document;
return selector instanceof Element ? selector : lookUp.querySelector(selector);
const lookUp = parent && parent instanceof HTMLElement ? parent : document;
return selector instanceof HTMLElement ? selector : lookUp.querySelector(selector);
}
/**
* Utility to force re-paint of an Element
*
* @param {Element} element is the target
* @return {Number} the Element.offsetHeight value
* @param {HTMLElement} element is the target
* @return {number} the Element.offsetHeight value
*/
export default function reflow(element) {
// @ts-ignore
return element.offsetHeight;
}
/**
* Remove eventListener from Element
*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/
export default function off(element: Element, eventName: string, handler: object | Function, options: object | boolean | null): void;
export default function off(element: HTMLElement, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;
/**
* Add eventListener to Element
*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/
export default function on(element: Element, eventName: string, handler: object | Function, options: object | boolean | null): void;
export default function on(element: HTMLElement, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;

@@ -5,7 +5,7 @@ /**

*
* @param {Element} element event.target
* @param {String} eventName event.type
* @param {object | Function} handler callback
* @param {object | Boolean | null} options other event options
* @param {HTMLElement} element event.target
* @param {string} eventName event.type
* @param {EventListener} handler callback
* @param {EventListenerOptions | boolean | null} options other event options
*/
export default function one(element: Element, eventName: string, handler: object | Function, options: object | boolean | null): void;
export default function one(element: HTMLElement, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;

@@ -5,5 +5,5 @@ /**

*
* @param {Element} element target
* @param {Function} handler `animationend` callback
* @param {HTMLElement} element target
* @param {function} handler `animationend` callback
*/
export default function emulateAnimationEnd(element: Element, handler: Function): void;
export default function emulateAnimationEnd(element: HTMLElement, handler: Function): void;

@@ -5,5 +5,5 @@ /**

*
* @param {Element} element target
* @param {Function} handler `transitionend` callback
* @param {HTMLElement} element target
* @param {function} handler `transitionend` callback
*/
export default function emulateTransitionEnd(element: Element, handler: Function): void;
export default function emulateTransitionEnd(element: HTMLElement, handler: Function): void;

@@ -5,5 +5,5 @@ /**

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/
export default function getElementAnimationDelay(element: Element): number;
export default function getElementAnimationDelay(element: HTMLElement): number;

@@ -5,5 +5,5 @@ /**

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/
export default function getElementAnimationDuration(element: Element): number;
export default function getElementAnimationDuration(element: HTMLElement): number;

@@ -5,5 +5,5 @@ /**

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/
export default function getElementTransitionDelay(element: Element): number;
export default function getElementTransitionDelay(element: HTMLElement): number;

@@ -5,5 +5,5 @@ /**

*
* @param {Element} element target
* @return {Number} the value in miliseconds
* @param {HTMLElement} element target
* @return {number} the value in miliseconds
*/
export default function getElementTransitionDuration(element: Element): number;
export default function getElementTransitionDuration(element: HTMLElement): number;

@@ -5,5 +5,5 @@ /**

*
* @param {Element} element target
* @return {Boolean} Boolean
* @param {HTMLElement} element target
* @return {boolean} Boolean
*/
export default function isElementInScrollRange(element: Element): boolean;
export default function isElementInScrollRange(element: HTMLElement): boolean;

@@ -5,5 +5,5 @@ /**

*
* @param {Element} element target
* @return {Boolean} Boolean
* @param {HTMLElement} element target
* @return {boolean} Boolean
*/
export default function isElementInViewport(element: Element): boolean;
export default function isElementInViewport(element: HTMLElement): boolean;
/**
* Utility to normalize component options
*
* @param {Element} element target
* @param {HTMLElement} element target
* @param {object} defaultOps component default options

@@ -10,2 +10,2 @@ * @param {object} inputOps component instance options

*/
export default function normalizeOptions(element: Element, defaultOps: object, inputOps: object, ns: string): object;
export default function normalizeOptions(element: HTMLElement, defaultOps: object, inputOps: object, ns: string): object;
/**
* The raw value or a given component option.
*
* @typedef rawValue
* @type {string | Function | Element | Boolean | object}
* @typedef {string | Element | Function | number | boolean | null} niceValue
*/
/**
* The raw value or a given component option.
*
* @typedef niceValue
* @type {string | Function | Element | object | Number | Boolean}
*/
/**
* Utility to normalize component options
*
* @param {rawValue} value the input value
* @param {any} value the input value
* @return {niceValue} the normalized value
*/
export default function normalizeValue(value: rawValue): niceValue;
export default function normalizeValue(value: any): niceValue;
/**
* The raw value or a given component option.
*/
export type rawValue = string | Function | Element | boolean | object;
/**
* The raw value or a given component option.
*/
export type niceValue = string | Function | Element | object | number | boolean;
export type niceValue = string | Element | Function | number | boolean | null;

@@ -5,6 +5,6 @@ /**

*
* @param {string | Element} selector the input selector or target element
* @param {?Element} parent optional Element to look into
* @return {null | Element} the Element or result of the querySelector
* @param {HTMLElement | string} selector the input selector or target element
* @param {HTMLElement | null} parent optional Element to look into
* @return {HTMLElement | null} the Element or result of the querySelector
*/
export default function queryElement(selector: string | Element, parent: Element | null): null | Element;
export default function queryElement(selector: HTMLElement | string, parent: HTMLElement | null): HTMLElement | null;
/**
* Utility to force re-paint of an Element
*
* @param {Element} element is the target
* @return {Number} the Element.offsetHeight value
* @param {HTMLElement} element is the target
* @return {number} the Element.offsetHeight value
*/
export default function reflow(element: Element): number;
export default function reflow(element: HTMLElement): number;
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc