Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
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.6 to 0.2.7

41

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

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

*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -251,3 +251,3 @@ * @param {EventListener} handler callback

*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -266,3 +266,3 @@ * @param {EventListener} handler callback

*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -290,3 +290,3 @@ * @param {EventListener} handler callback

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

@@ -309,3 +309,3 @@ */

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

@@ -328,3 +328,3 @@ */

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

@@ -364,3 +364,3 @@ */

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

@@ -383,3 +383,3 @@ */

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

@@ -402,3 +402,3 @@ */

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

@@ -438,3 +438,3 @@ */

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

@@ -452,3 +452,3 @@ */

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

@@ -477,9 +477,9 @@ */

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

@@ -523,3 +523,3 @@

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

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

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

@@ -588,0 +589,0 @@ // @ts-ignore

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

// shorter-js v0.2.6 | 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?"webkitTransitionProperty":"transitionProperty",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 y(e,n,t,i){const o=i||!1;e.addEventListener(n,t,o)}function f(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:y,off:f,one:function(e,n,t,i){y(e,n,(function o(a){a.target===e&&(t.apply(e,[a]),f(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.6"};export default T;
// shorter-js v0.2.7 | 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?"webkitTransitionProperty":"transitionProperty",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 y(e,n,t,i){const o=i||!1;e.addEventListener(n,t,o)}function f(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:y,off:f,one:function(e,n,t,i){y(e,n,(function o(a){a.target===e&&(t.apply(e,[a]),f(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}=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.7"};export default D;
/*!
* shorter-js v0.2.6 (https://github.com/thednp/shorter-js)
* shorter-js v0.2.7 (https://github.com/thednp/shorter-js)
* Copyright 2019-2021 © dnp_theme

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

*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -257,3 +257,3 @@ * @param {EventListener} handler callback

*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -272,3 +272,3 @@ * @param {EventListener} handler callback

*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -296,3 +296,3 @@ * @param {EventListener} handler callback

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

@@ -315,3 +315,3 @@ */

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

@@ -334,3 +334,3 @@ */

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

@@ -370,3 +370,3 @@ */

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

@@ -389,3 +389,3 @@ */

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

@@ -408,3 +408,3 @@ */

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

@@ -444,3 +444,3 @@ */

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

@@ -458,3 +458,3 @@ */

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

@@ -483,9 +483,9 @@ */

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

@@ -531,3 +531,3 @@

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

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

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

@@ -597,0 +598,0 @@ // @ts-ignore

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

// shorter-js v0.2.6 | 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?"webkitTransitionProperty":"transitionProperty",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 y(e,n,t,i){var o=i||!1;e.removeEventListener(n,t,o)}function E(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:y,one:function(e,n,t,i){g(e,n,(function o(a){a.target===e&&(t.apply(e,[a]),y(e,n,o,i))}),i)},emulateAnimationEnd:function(e,n){var t=0,o=new Event(i),a=h(e),r=E(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:E,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.6"}}));
// shorter-js v0.2.7 | 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?"webkitTransitionProperty":"transitionProperty",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 y(e,n,t,i){var o=i||!1;e.removeEventListener(n,t,o)}function E(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:y,one:function(e,n,t,i){g(e,n,(function o(a){a.target===e&&(t.apply(e,[a]),y(e,n,o,i))}),i)},emulateAnimationEnd:function(e,n){var t=0,o=new Event(i),a=h(e),r=E(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:E,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 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.7"}}));
{
"name": "shorter-js",
"version": "0.2.6",
"version": "0.2.7",
"description": "A small ES6+ library with various JavaScript tools useful for creating light libraries.",

@@ -19,3 +19,3 @@ "main": "dist/shorter-js.min.js",

"lint:js": "eslint src/ --config .eslintrc",
"build-ts": "tsc -d",
"build:ts": "tsc -d",
"build": "npm run lint:js && npm run umd && npm run umdmin && npm run esm && npm run esmmin",

@@ -22,0 +22,0 @@ "umd": "rollup --environment FORMAT:umd,MIN:false -c",

/**
* Remove eventListener from Element
*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -6,0 +6,0 @@ * @param {EventListener} handler callback

/**
* Add eventListener to Element
*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -6,0 +6,0 @@ * @param {EventListener} handler callback

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

*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -11,0 +11,0 @@ * @param {EventListener} handler callback

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

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

@@ -12,0 +12,0 @@ */

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

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

@@ -12,0 +12,0 @@ */

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

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

@@ -12,0 +12,0 @@ */

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

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

@@ -12,0 +12,0 @@ */

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

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

@@ -12,0 +12,0 @@ */

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

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

@@ -12,0 +12,0 @@ */

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

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

@@ -8,0 +8,0 @@ */

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

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

@@ -8,0 +8,0 @@ */

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

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

@@ -9,0 +9,0 @@ * @param {object} inputOps component instance options

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

*
* @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
* @param {Element | string} selector the input selector or target element
* @param {Element | null} parent optional Element to look into
* @return {Element | null} the Element or result of the querySelector
*/
export default function queryElement(selector, parent) {
const lookUp = parent && parent instanceof HTMLElement ? parent : document;
return selector instanceof HTMLElement ? selector : lookUp.querySelector(selector);
const lookUp = parent && parent instanceof Element ? parent : document;
return selector instanceof Element ? selector : lookUp.querySelector(selector);
}
/**
* Utility to force re-paint of an Element
*
* @param {HTMLElement} element is the target
* @param {Element | 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 {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -9,2 +9,2 @@ * @param {EventListener} handler callback

*/
export default function off(element: HTMLElement, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;
export default function off(element: Element, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;
/**
* Add eventListener to Element
*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -9,2 +9,2 @@ * @param {EventListener} handler callback

*/
export default function on(element: HTMLElement, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;
export default function on(element: Element, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;

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

*
* @param {HTMLElement} element event.target
* @param {Element} element event.target
* @param {string} eventName event.type

@@ -11,2 +11,2 @@ * @param {EventListener} handler callback

*/
export default function one(element: HTMLElement, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;
export default function one(element: Element, eventName: string, handler: EventListener, options: EventListenerOptions | boolean | null): void;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

*/
export default function normalizeOptions(element: HTMLElement, defaultOps: object, inputOps: object, ns: string): object;
export default function normalizeOptions(element: Element, defaultOps: object, inputOps: object, ns: string): object;

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

*
* @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
* @param {Element | string} selector the input selector or target element
* @param {Element | null} parent optional Element to look into
* @return {Element | null} the Element or result of the querySelector
*/
export default function queryElement(selector: HTMLElement | string, parent: HTMLElement | null): HTMLElement | null;
export default function queryElement(selector: Element | string, parent: Element | null): Element | null;
/**
* Utility to force re-paint of an Element
*
* @param {HTMLElement} element is the target
* @param {Element | HTMLElement} element is the target
* @return {number} the Element.offsetHeight value
*/
export default function reflow(element: HTMLElement): number;
export default function reflow(element: 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