shorter-js
Advanced tools
Comparing version 0.2.22 to 0.2.23
/*! | ||
* shorter-js v0.2.22 (https://github.com/thednp/shorter-js) | ||
* shorter-js v0.2.23 (https://github.com/thednp/shorter-js) | ||
* Copyright 2019-2021 © dnp_theme | ||
@@ -877,2 +877,75 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
const TimeCache = new Map(); | ||
const Timer = { | ||
/** | ||
* Sets a new timeout timer for an element, or element -> key association. | ||
* @param {Element | string} target target element | ||
* @param {ReturnType<TimerHandler>} callback the callback | ||
* @param {number} delay the execution delay | ||
* @param {string=} key a unique | ||
*/ | ||
set: (target, callback, delay, key) => { | ||
const element = querySelector(target); | ||
if (!isElement(element)) return; | ||
if (typeof key === 'string' && key.length) { | ||
if (!TimeCache.has(element)) { | ||
TimeCache.set(element, new Map()); | ||
} | ||
const keyTimers = TimeCache.get(element); | ||
keyTimers.set(key, setTimeout(callback, delay)); | ||
} else { | ||
TimeCache.set(element, setTimeout(callback, delay)); | ||
} | ||
}, | ||
/** | ||
* Returns the timer associated with the target. | ||
* @param {Element | string} target target element | ||
* @param {string=} key a unique | ||
* @returns {Map<Element, TimerHandler>?} the timer | ||
*/ | ||
get: (target, key) => { | ||
const element = querySelector(target); | ||
if (!isElement(element)) return null; | ||
if (typeof key === 'string' && key.length) { | ||
if (!TimeCache.has(element)) { | ||
TimeCache.set(element, new Map()); | ||
} | ||
const keyTimers = TimeCache.get(element); | ||
if (keyTimers.has(key)) { | ||
return keyTimers.get(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
return TimeCache.get(element); | ||
} | ||
return null; | ||
}, | ||
/** | ||
* Clears the element's timer. | ||
* @param {Element} target target element | ||
* @param {string=} key a unique | ||
*/ | ||
clear: (target, key) => { | ||
const element = querySelector(target); | ||
if (!isElement(element) || !TimeCache.has(element)) return; | ||
if (typeof key === 'string' && key.length) { | ||
const keyTimers = TimeCache.get(element); | ||
if (keyTimers && keyTimers.has(key)) { | ||
clearTimeout(keyTimers.get(key)); | ||
keyTimers.delete(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
clearTimeout(TimeCache.get(element)); | ||
TimeCache.delete(element); | ||
} | ||
}, | ||
}; | ||
const componentData = new Map(); | ||
@@ -1434,3 +1507,3 @@ /** | ||
var version = "0.2.22"; | ||
var version = "0.2.23"; | ||
@@ -1561,2 +1634,3 @@ // @ts-ignore | ||
Data, | ||
Timer, | ||
getInstance, | ||
@@ -1563,0 +1637,0 @@ emulateAnimationEnd, |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.2.22 | dnp_theme © 2021 | MIT-License | ||
const e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",n="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",o="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",i="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",r="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",s="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",u=/iPhone|iPad|iPod|Android/i;let l=!1;l=navigator.userAgentData?navigator.userAgentData.brands.some(e=>u.test(e.brand)):u.test(navigator.userAgent);const m=l,{userAgentData:d}=navigator,v=/(iPhone|iPod|iPad)/,b=d?d.brands.some(e=>v.test(e.brand)):v.test(navigator.userAgent),E="webkitPerspective"in document.head.style||"perspective"in document.head.style,p=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,t)}),t)}catch(e){throw Error("Passive events are not supported")}return e})(),g="webkitTransform"in document.head.style||"transform"in document.head.style,y="ontouchstart"in window||"msMaxTouchPoints"in navigator,h="webkitAnimation"in document.head.style||"animation"in document.head.style,f="webkitTransition"in document.head.style||"transition"in document.head.style;function k(e,t,n,o){const i=o||!1;e.addEventListener(t,n,i)}function w(e,t,n,o){const i=o||!1;e.removeEventListener(t,n,i)}function A(e){return e instanceof Element}function L(e,t){const n=t&&A(t)?t:document;return A(e)?e:n.querySelector(e)}const C=new Map,D={set:(e,t,n)=>{const o=L(e);if(!A(o))return;C.has(t)||C.set(t,new Map);C.get(t).set(o,n)},getAllFor:e=>C.has(e)?C.get(e):null,get:(e,t)=>{const n=L(e),o=D.getAllFor(t);return o&&A(n)&&o.has(n)?o.get(n):null},remove:(e,t)=>{if(!C.has(t))return;const n=C.get(t);n.delete(e),0===n.size&&C.delete(t)}};function T(e){const t=getComputedStyle(e),i=t[o],r=t[n],a=r.includes("ms")?1:1e3,s=h&&i&&"none"!==i?parseFloat(r)*a:0;return Number.isNaN(s)?0:s}function O(e){const n=getComputedStyle(e),i=n[o],r=n[t],a=r.includes("ms")?1:1e3,s=h&&i&&"none"!==i?parseFloat(r)*a:0;return Number.isNaN(s)?0:s}function S(e){const t=getComputedStyle(e),n=t[c],o=t[a],i=o.includes("ms")?1:1e3,r=f&&n&&"none"!==n?parseFloat(o)*i:0;return Number.isNaN(r)?0:r}function z(e){const t=getComputedStyle(e),n=t[c],o=t[r],i=o.includes("ms")?1:1e3,a=f&&n&&"none"!==n?parseFloat(o)*i:0;return Number.isNaN(a)?0:a}function M(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const I=e=>Object.keys(e);const N={ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",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:t,animationDelay:n,animationName:o,animationEndEvent:i,transitionDuration:r,transitionDelay:a,transitionEndEvent:s,transitionProperty:c,isMobile:m,isApple:b,support3DTransform:E,supportPassive:p,supportTransform:g,supportTouch:y,supportAnimation:h,supportTransition:f,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:k,off:w,one:function(e,t,n,o){k(e,t,(function i(r){r.target===e&&(n.apply(e,[r]),w(e,t,i,o))}),o)},Data:D,getInstance:(e,t)=>D.get(e,t),emulateAnimationEnd:function(e,t){let n=0;const o=new Event(i),r=O(e),a=T(e);if(r){const s=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(i,s),n=1)};e.addEventListener(i,s),setTimeout(()=>{n||e.dispatchEvent(o)},r+a+17)}else t.apply(e,[o])},emulateTransitionEnd:function(e,t){let n=0;const o=new Event(s),i=z(e),r=S(e);if(i){const a=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(s,a),n=1)};e.addEventListener(s,a),setTimeout(()=>{n||e.dispatchEvent(o)},i+r+17)}else t.apply(e,[o])},isElementInScrollRange:function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},isElementInViewport:function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!p&&{passive:!0},getElementAnimationDuration:O,getElementAnimationDelay:T,getElementTransitionDuration:z,getElementTransitionDelay:S,isArray:e=>Array.isArray(e),isElement:A,isHTMLElement:function(e){return e instanceof HTMLElement},isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isElementsArray:function(e){return Array.isArray(e)&&e.every(e=>A(e))},isMedia:function(e){return[SVGElement,HTMLImageElement,HTMLVideoElement].some(t=>e instanceof t)},isRTL:()=>"rtl"===document.documentElement.dir,queryElement:function(e,t){return L(e,t)},querySelector:L,querySelectorAll:function(e,t){return(t&&A(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&A(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&A(t)?t:document).getElementsByTagName(e)},normalizeValue:M,normalizeOptions:function(e,t,n,o){const i={...e.dataset},r={},a={};return I(i).forEach(e=>{const t=o&&e.includes(o)?e.replace(o,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;a[t]=M(i[e])}),I(n).forEach(e=>{n[e]=M(n[e])}),I(t).forEach(e=>{r[e]=e in n?n[e]:e in a?a[e]:t[e]}),r},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(`${t} ${e}`)}},reflow:function(e){return e.offsetHeight},ArrayFrom:e=>Array.from(e),Float32ArrayFrom:e=>{const t=Array.from(e);return Float32Array.from(t)},Float64ArrayFrom:e=>{const t=Array.from(e);return Float64Array.from(t)},ObjectAssign:(e,t)=>Object.assign(e,t),ObjectKeys:I,ObjectValues:e=>Object.values(e),getElementStyle:function(e,t){const n=getComputedStyle(e);return t&&t in n?n[t]:n},getAttribute:(e,t)=>e.getAttribute(t),setAttribute:(e,t,n)=>e.setAttribute(t,n),removeAttribute:(e,t)=>e.removeAttribute(t),Version:"0.2.22"};export default N; | ||
// shorter-js v0.2.23 | dnp_theme © 2021 | MIT-License | ||
const e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",n="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",o="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",i="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",r="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",s="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",u="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",c=/iPhone|iPad|iPod|Android/i;let l=!1;l=navigator.userAgentData?navigator.userAgentData.brands.some(e=>c.test(e.brand)):c.test(navigator.userAgent);const m=l,{userAgentData:d}=navigator,v=/(iPhone|iPod|iPad)/,b=d?d.brands.some(e=>v.test(e.brand)):v.test(navigator.userAgent),g="webkitPerspective"in document.head.style||"perspective"in document.head.style,p=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,t)}),t)}catch(e){throw Error("Passive events are not supported")}return e})(),E="webkitTransform"in document.head.style||"transform"in document.head.style,y="ontouchstart"in window||"msMaxTouchPoints"in navigator,h="webkitAnimation"in document.head.style||"animation"in document.head.style,f="webkitTransition"in document.head.style||"transition"in document.head.style;function w(e,t,n,o){const i=o||!1;e.addEventListener(t,n,i)}function k(e,t,n,o){const i=o||!1;e.removeEventListener(t,n,i)}function A(e){return e instanceof Element}function L(e,t){const n=t&&A(t)?t:document;return A(e)?e:n.querySelector(e)}const T=new Map,C={set:(e,t,n,o)=>{const i=L(e);if(A(i))if("string"==typeof o&&o.length){T.has(i)||T.set(i,new Map);T.get(i).set(o,setTimeout(t,n))}else T.set(i,setTimeout(t,n))},get:(e,t)=>{const n=L(e);if(!A(n))return null;if("string"==typeof t&&t.length){T.has(n)||T.set(n,new Map);const e=T.get(n);if(e.has(t))return e.get(t)}else if(T.has(n))return T.get(n);return null},clear:(e,t)=>{const n=L(e);if(A(n)&&T.has(n))if("string"==typeof t&&t.length){const e=T.get(n);e&&e.has(t)&&(clearTimeout(e.get(t)),e.delete(t))}else T.has(n)&&(clearTimeout(T.get(n)),T.delete(n))}},D=new Map,M={set:(e,t,n)=>{const o=L(e);if(!A(o))return;D.has(t)||D.set(t,new Map);D.get(t).set(o,n)},getAllFor:e=>D.has(e)?D.get(e):null,get:(e,t)=>{const n=L(e),o=M.getAllFor(t);return o&&A(n)&&o.has(n)?o.get(n):null},remove:(e,t)=>{if(!D.has(t))return;const n=D.get(t);n.delete(e),0===n.size&&D.delete(t)}};function O(e){const t=getComputedStyle(e),i=t[o],r=t[n],a=r.includes("ms")?1:1e3,s=h&&i&&"none"!==i?parseFloat(r)*a:0;return Number.isNaN(s)?0:s}function S(e){const n=getComputedStyle(e),i=n[o],r=n[t],a=r.includes("ms")?1:1e3,s=h&&i&&"none"!==i?parseFloat(r)*a:0;return Number.isNaN(s)?0:s}function z(e){const t=getComputedStyle(e),n=t[u],o=t[a],i=o.includes("ms")?1:1e3,r=f&&n&&"none"!==n?parseFloat(o)*i:0;return Number.isNaN(r)?0:r}function I(e){const t=getComputedStyle(e),n=t[u],o=t[r],i=o.includes("ms")?1:1e3,a=f&&n&&"none"!==n?parseFloat(o)*i:0;return Number.isNaN(a)?0:a}function N(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const P=e=>Object.keys(e);const H={ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",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:t,animationDelay:n,animationName:o,animationEndEvent:i,transitionDuration:r,transitionDelay:a,transitionEndEvent:s,transitionProperty:u,isMobile:m,isApple:b,support3DTransform:g,supportPassive:p,supportTransform:E,supportTouch:y,supportAnimation:h,supportTransition:f,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:w,off:k,one:function(e,t,n,o){w(e,t,(function i(r){r.target===e&&(n.apply(e,[r]),k(e,t,i,o))}),o)},Data:M,Timer:C,getInstance:(e,t)=>M.get(e,t),emulateAnimationEnd:function(e,t){let n=0;const o=new Event(i),r=S(e),a=O(e);if(r){const s=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(i,s),n=1)};e.addEventListener(i,s),setTimeout(()=>{n||e.dispatchEvent(o)},r+a+17)}else t.apply(e,[o])},emulateTransitionEnd:function(e,t){let n=0;const o=new Event(s),i=I(e),r=z(e);if(i){const a=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(s,a),n=1)};e.addEventListener(s,a),setTimeout(()=>{n||e.dispatchEvent(o)},i+r+17)}else t.apply(e,[o])},isElementInScrollRange:function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},isElementInViewport:function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!p&&{passive:!0},getElementAnimationDuration:S,getElementAnimationDelay:O,getElementTransitionDuration:I,getElementTransitionDelay:z,isArray:e=>Array.isArray(e),isElement:A,isHTMLElement:function(e){return e instanceof HTMLElement},isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isElementsArray:function(e){return Array.isArray(e)&&e.every(e=>A(e))},isMedia:function(e){return[SVGElement,HTMLImageElement,HTMLVideoElement].some(t=>e instanceof t)},isRTL:()=>"rtl"===document.documentElement.dir,queryElement:function(e,t){return L(e,t)},querySelector:L,querySelectorAll:function(e,t){return(t&&A(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&A(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&A(t)?t:document).getElementsByTagName(e)},normalizeValue:N,normalizeOptions:function(e,t,n,o){const i={...e.dataset},r={},a={};return P(i).forEach(e=>{const t=o&&e.includes(o)?e.replace(o,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;a[t]=N(i[e])}),P(n).forEach(e=>{n[e]=N(n[e])}),P(t).forEach(e=>{r[e]=e in n?n[e]:e in a?a[e]:t[e]}),r},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(`${t} ${e}`)}},reflow:function(e){return e.offsetHeight},ArrayFrom:e=>Array.from(e),Float32ArrayFrom:e=>{const t=Array.from(e);return Float32Array.from(t)},Float64ArrayFrom:e=>{const t=Array.from(e);return Float64Array.from(t)},ObjectAssign:(e,t)=>Object.assign(e,t),ObjectKeys:P,ObjectValues:e=>Object.values(e),getElementStyle:function(e,t){const n=getComputedStyle(e);return t&&t in n?n[t]:n},getAttribute:(e,t)=>e.getAttribute(t),setAttribute:(e,t,n)=>e.setAttribute(t,n),removeAttribute:(e,t)=>e.removeAttribute(t),Version:"0.2.23"};export default H; |
/*! | ||
* shorter-js v0.2.22 (https://github.com/thednp/shorter-js) | ||
* shorter-js v0.2.23 (https://github.com/thednp/shorter-js) | ||
* Copyright 2019-2021 © dnp_theme | ||
@@ -882,2 +882,75 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
var TimeCache = new Map(); | ||
var Timer = { | ||
/** | ||
* Sets a new timeout timer for an element, or element -> key association. | ||
* @param {Element | string} target target element | ||
* @param {ReturnType<TimerHandler>} callback the callback | ||
* @param {number} delay the execution delay | ||
* @param {string=} key a unique | ||
*/ | ||
set: function (target, callback, delay, key) { | ||
var element = querySelector(target); | ||
if (!isElement(element)) { return; } | ||
if (typeof key === 'string' && key.length) { | ||
if (!TimeCache.has(element)) { | ||
TimeCache.set(element, new Map()); | ||
} | ||
var keyTimers = TimeCache.get(element); | ||
keyTimers.set(key, setTimeout(callback, delay)); | ||
} else { | ||
TimeCache.set(element, setTimeout(callback, delay)); | ||
} | ||
}, | ||
/** | ||
* Returns the timer associated with the target. | ||
* @param {Element | string} target target element | ||
* @param {string=} key a unique | ||
* @returns {Map<Element, TimerHandler>?} the timer | ||
*/ | ||
get: function (target, key) { | ||
var element = querySelector(target); | ||
if (!isElement(element)) { return null; } | ||
if (typeof key === 'string' && key.length) { | ||
if (!TimeCache.has(element)) { | ||
TimeCache.set(element, new Map()); | ||
} | ||
var keyTimers = TimeCache.get(element); | ||
if (keyTimers.has(key)) { | ||
return keyTimers.get(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
return TimeCache.get(element); | ||
} | ||
return null; | ||
}, | ||
/** | ||
* Clears the element's timer. | ||
* @param {Element} target target element | ||
* @param {string=} key a unique | ||
*/ | ||
clear: function (target, key) { | ||
var element = querySelector(target); | ||
if (!isElement(element) || !TimeCache.has(element)) { return; } | ||
if (typeof key === 'string' && key.length) { | ||
var keyTimers = TimeCache.get(element); | ||
if (keyTimers && keyTimers.has(key)) { | ||
clearTimeout(keyTimers.get(key)); | ||
keyTimers.delete(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
clearTimeout(TimeCache.get(element)); | ||
TimeCache.delete(element); | ||
} | ||
}, | ||
}; | ||
var componentData = new Map(); | ||
@@ -1439,3 +1512,3 @@ /** | ||
var version = "0.2.22"; | ||
var version = "0.2.23"; | ||
@@ -1566,2 +1639,3 @@ // @ts-ignore | ||
Data: Data, | ||
Timer: Timer, | ||
getInstance: getInstance, | ||
@@ -1568,0 +1642,0 @@ emulateAnimationEnd: emulateAnimationEnd, |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.2.22 | dnp_theme © 2021 | MIT-License | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).SHORTER=t()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",n="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",o="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",r="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",s="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",c=/iPhone|iPad|iPod|Android/i,l=navigator.userAgentData?navigator.userAgentData.brands.some((function(e){return c.test(e.brand)})):c.test(navigator.userAgent),d=navigator.userAgentData,m=/(iPhone|iPod|iPad)/,v=d?d.brands.some((function(e){return m.test(e.brand)})):m.test(navigator.userAgent),f="webkitPerspective"in document.head.style||"perspective"in document.head.style,b=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,t)}),t)}catch(e){throw Error("Passive events are not supported")}return e}(),E="webkitTransform"in document.head.style||"transform"in document.head.style,p="ontouchstart"in window||"msMaxTouchPoints"in navigator,g="webkitAnimation"in document.head.style||"animation"in document.head.style,y="webkitTransition"in document.head.style||"transition"in document.head.style;function h(e,t,n,i){var o=i||!1;e.addEventListener(t,n,o)}function k(e,t,n,i){var o=i||!1;e.removeEventListener(t,n,o)}function w(e){return e instanceof Element}function A(e,t){var n=t&&w(t)?t:document;return w(e)?e:n.querySelector(e)}var L=new Map,C={set:function(e,t,n){var i=A(e);w(i)&&(L.has(t)||L.set(t,new Map),L.get(t).set(i,n))},getAllFor:function(e){return L.has(e)?L.get(e):null},get:function(e,t){var n=A(e),i=C.getAllFor(t);return i&&w(n)&&i.has(n)?i.get(n):null},remove:function(e,t){if(L.has(t)){var n=L.get(t);n.delete(e),0===n.size&&L.delete(t)}}};function D(e){var t=getComputedStyle(e),o=t[i],r=t[n],a=r.includes("ms")?1:1e3,u=g&&o&&"none"!==o?parseFloat(r)*a:0;return Number.isNaN(u)?0:u}function T(e){var n=getComputedStyle(e),o=n[i],r=n[t],a=r.includes("ms")?1:1e3,u=g&&o&&"none"!==o?parseFloat(r)*a:0;return Number.isNaN(u)?0:u}function O(e){var t=getComputedStyle(e),n=t[s],i=t[a],o=i.includes("ms")?1:1e3,r=y&&n&&"none"!==n?parseFloat(i)*o:0;return Number.isNaN(r)?0:r}function S(e){var t=getComputedStyle(e),n=t[s],i=t[r],o=i.includes("ms")?1:1e3,a=y&&n&&"none"!==n?parseFloat(i)*o:0;return Number.isNaN(a)?0:a}function z(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}var M=function(e){return Object.keys(e)};return{ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",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:t,animationDelay:n,animationName:i,animationEndEvent:o,transitionDuration:r,transitionDelay:a,transitionEndEvent:u,transitionProperty:s,isMobile:l,isApple:v,support3DTransform:f,supportPassive:b,supportTransform:E,supportTouch:p,supportAnimation:g,supportTransition:y,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:h,off:k,one:function(e,t,n,i){h(e,t,(function o(r){r.target===e&&(n.apply(e,[r]),k(e,t,o,i))}),i)},Data:C,getInstance:function(e,t){return C.get(e,t)},emulateAnimationEnd:function(e,t){var n=0,i=new Event(o),r=T(e),a=D(e);if(r){var u=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(o,u),n=1)};e.addEventListener(o,u),setTimeout((function(){n||e.dispatchEvent(i)}),r+a+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){var n=0,i=new Event(u),o=S(e),r=O(e);if(o){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(u,a),n=1)};e.addEventListener(u,a),setTimeout((function(){n||e.dispatchEvent(i)}),o+r+17)}else t.apply(e,[i])},isElementInScrollRange:function(e){var t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},isElementInViewport:function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!b&&{passive:!0},getElementAnimationDuration:T,getElementAnimationDelay:D,getElementTransitionDuration:S,getElementTransitionDelay:O,isArray:function(e){return Array.isArray(e)},isElement:w,isHTMLElement:function(e){return e instanceof HTMLElement},isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isElementsArray:function(e){return Array.isArray(e)&&e.every((function(e){return w(e)}))},isMedia:function(e){return[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(t){return e instanceof t}))},isRTL:function(){return"rtl"===document.documentElement.dir},queryElement:function(e,t){return A(e,t)},querySelector:A,querySelectorAll:function(e,t){return(t&&w(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&w(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&w(t)?t:document).getElementsByTagName(e)},normalizeValue:z,normalizeOptions:function(e,t,n,i){var o=Object.assign({},e.dataset),r={},a={};return M(o).forEach((function(e){var t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;a[t]=z(o[e])})),M(n).forEach((function(e){n[e]=z(n[e])})),M(t).forEach((function(e){r[e]=e in n?n[e]:e in a?a[e]:t[e]})),r},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(t+" "+e)}},reflow:function(e){return e.offsetHeight},ArrayFrom:function(e){return Array.from(e)},Float32ArrayFrom:function(e){var t=Array.from(e);return Float32Array.from(t)},Float64ArrayFrom:function(e){var t=Array.from(e);return Float64Array.from(t)},ObjectAssign:function(e,t){return Object.assign(e,t)},ObjectKeys:M,ObjectValues:function(e){return Object.values(e)},getElementStyle:function(e,t){var n=getComputedStyle(e);return t&&t in n?n[t]:n},getAttribute:function(e,t){return e.getAttribute(t)},setAttribute:function(e,t,n){return e.setAttribute(t,n)},removeAttribute:function(e,t){return e.removeAttribute(t)},Version:"0.2.22"}})); | ||
// shorter-js v0.2.23 | dnp_theme © 2021 | MIT-License | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).SHORTER=t()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",n="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",r="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",o="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",s="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",c=/iPhone|iPad|iPod|Android/i,l=navigator.userAgentData?navigator.userAgentData.brands.some((function(e){return c.test(e.brand)})):c.test(navigator.userAgent),m=navigator.userAgentData,d=/(iPhone|iPod|iPad)/,v=m?m.brands.some((function(e){return d.test(e.brand)})):d.test(navigator.userAgent),f="webkitPerspective"in document.head.style||"perspective"in document.head.style,b=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,t)}),t)}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,E="webkitAnimation"in document.head.style||"animation"in document.head.style,y="webkitTransition"in document.head.style||"transition"in document.head.style;function h(e,t,n,i){var r=i||!1;e.addEventListener(t,n,r)}function w(e,t,n,i){var r=i||!1;e.removeEventListener(t,n,r)}function k(e){return e instanceof Element}function A(e,t){var n=t&&k(t)?t:document;return k(e)?e:n.querySelector(e)}var L=new Map,T={set:function(e,t,n,i){var r=A(e);k(r)&&("string"==typeof i&&i.length?(L.has(r)||L.set(r,new Map),L.get(r).set(i,setTimeout(t,n))):L.set(r,setTimeout(t,n)))},get:function(e,t){var n=A(e);if(!k(n))return null;if("string"==typeof t&&t.length){L.has(n)||L.set(n,new Map);var i=L.get(n);if(i.has(t))return i.get(t)}else if(L.has(n))return L.get(n);return null},clear:function(e,t){var n=A(e);if(k(n)&&L.has(n))if("string"==typeof t&&t.length){var i=L.get(n);i&&i.has(t)&&(clearTimeout(i.get(t)),i.delete(t))}else L.has(n)&&(clearTimeout(L.get(n)),L.delete(n))}},C=new Map,D={set:function(e,t,n){var i=A(e);k(i)&&(C.has(t)||C.set(t,new Map),C.get(t).set(i,n))},getAllFor:function(e){return C.has(e)?C.get(e):null},get:function(e,t){var n=A(e),i=D.getAllFor(t);return i&&k(n)&&i.has(n)?i.get(n):null},remove:function(e,t){if(C.has(t)){var n=C.get(t);n.delete(e),0===n.size&&C.delete(t)}}};function O(e){var t=getComputedStyle(e),r=t[i],o=t[n],a=o.includes("ms")?1:1e3,u=E&&r&&"none"!==r?parseFloat(o)*a:0;return Number.isNaN(u)?0:u}function S(e){var n=getComputedStyle(e),r=n[i],o=n[t],a=o.includes("ms")?1:1e3,u=E&&r&&"none"!==r?parseFloat(o)*a:0;return Number.isNaN(u)?0:u}function M(e){var t=getComputedStyle(e),n=t[s],i=t[a],r=i.includes("ms")?1:1e3,o=y&&n&&"none"!==n?parseFloat(i)*r:0;return Number.isNaN(o)?0:o}function z(e){var t=getComputedStyle(e),n=t[s],i=t[o],r=i.includes("ms")?1:1e3,a=y&&n&&"none"!==n?parseFloat(i)*r:0;return Number.isNaN(a)?0:a}function I(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}var N=function(e){return Object.keys(e)};return{ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",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:t,animationDelay:n,animationName:i,animationEndEvent:r,transitionDuration:o,transitionDelay:a,transitionEndEvent:u,transitionProperty:s,isMobile:l,isApple:v,support3DTransform:f,supportPassive:b,supportTransform:p,supportTouch:g,supportAnimation:E,supportTransition:y,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:h,off:w,one:function(e,t,n,i){h(e,t,(function r(o){o.target===e&&(n.apply(e,[o]),w(e,t,r,i))}),i)},Data:D,Timer:T,getInstance:function(e,t){return D.get(e,t)},emulateAnimationEnd:function(e,t){var n=0,i=new Event(r),o=S(e),a=O(e);if(o){var u=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(r,u),n=1)};e.addEventListener(r,u),setTimeout((function(){n||e.dispatchEvent(i)}),o+a+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){var n=0,i=new Event(u),r=z(e),o=M(e);if(r){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(u,a),n=1)};e.addEventListener(u,a),setTimeout((function(){n||e.dispatchEvent(i)}),r+o+17)}else t.apply(e,[i])},isElementInScrollRange:function(e){var t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},isElementInViewport:function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!b&&{passive:!0},getElementAnimationDuration:S,getElementAnimationDelay:O,getElementTransitionDuration:z,getElementTransitionDelay:M,isArray:function(e){return Array.isArray(e)},isElement:k,isHTMLElement:function(e){return e instanceof HTMLElement},isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isElementsArray:function(e){return Array.isArray(e)&&e.every((function(e){return k(e)}))},isMedia:function(e){return[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(t){return e instanceof t}))},isRTL:function(){return"rtl"===document.documentElement.dir},queryElement:function(e,t){return A(e,t)},querySelector:A,querySelectorAll:function(e,t){return(t&&k(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&k(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&k(t)?t:document).getElementsByTagName(e)},normalizeValue:I,normalizeOptions:function(e,t,n,i){var r=Object.assign({},e.dataset),o={},a={};return N(r).forEach((function(e){var t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;a[t]=I(r[e])})),N(n).forEach((function(e){n[e]=I(n[e])})),N(t).forEach((function(e){o[e]=e in n?n[e]:e in a?a[e]:t[e]})),o},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(t+" "+e)}},reflow:function(e){return e.offsetHeight},ArrayFrom:function(e){return Array.from(e)},Float32ArrayFrom:function(e){var t=Array.from(e);return Float32Array.from(t)},Float64ArrayFrom:function(e){var t=Array.from(e);return Float64Array.from(t)},ObjectAssign:function(e,t){return Object.assign(e,t)},ObjectKeys:N,ObjectValues:function(e){return Object.values(e)},getElementStyle:function(e,t){var n=getComputedStyle(e);return t&&t in n?n[t]:n},getAttribute:function(e,t){return e.getAttribute(t)},setAttribute:function(e,t,n){return e.setAttribute(t,n)},removeAttribute:function(e,t){return e.removeAttribute(t)},Version:"0.2.23"}})); |
{ | ||
"name": "shorter-js", | ||
"version": "0.2.22", | ||
"version": "0.2.23", | ||
"description": "A small ES6+ library with various JavaScript tools useful for creating light libraries.", | ||
@@ -5,0 +5,0 @@ "main": "dist/shorter-js.min.js", |
@@ -133,2 +133,3 @@ // strings | ||
// misc | ||
import Timer from './misc/timer'; | ||
import Data, { getInstance } from './misc/data'; | ||
@@ -292,2 +293,3 @@ import emulateAnimationEnd from './misc/emulateAnimationEnd'; | ||
Data, | ||
Timer, | ||
getInstance, | ||
@@ -294,0 +296,0 @@ emulateAnimationEnd, |
@@ -117,2 +117,3 @@ export as namespace SHORTER; | ||
export { default as Data, getInstance } from "shorter-js/src/misc/data"; | ||
export { default as Timer } from "shorter-js/src/misc/timer"; | ||
export { default as emulateAnimationEnd } from "shorter-js/src/misc/emulateAnimationEnd"; | ||
@@ -119,0 +120,0 @@ export { default as emulateTransitionEnd } from "shorter-js/src/misc/emulateTransitionEnd"; |
@@ -134,2 +134,3 @@ // strings | ||
export { default as Data, getInstance } from "../../src/misc/data"; | ||
export { default as Timer } from "../../src/misc/timer"; | ||
export { default as emulateAnimationEnd } from "../../src/misc/emulateAnimationEnd"; | ||
@@ -136,0 +137,0 @@ export { default as emulateTransitionEnd } from "../../src/misc/emulateTransitionEnd"; |
@@ -945,2 +945,10 @@ declare module "shorter-js/src/strings/ariaChecked" { | ||
} | ||
declare module "shorter-js/src/misc/timer" { | ||
export default Timer; | ||
namespace Timer { | ||
function set(target: string | Element, callback: any, delay: number, key?: string | undefined): void; | ||
function get(target: string | Element, key?: string | undefined): Map<Element, TimerHandler> | null; | ||
function clear(target: Element, key?: string | undefined): void; | ||
} | ||
} | ||
declare module "shorter-js/src/misc/getElementAnimationDelay" { | ||
@@ -1409,2 +1417,3 @@ /** | ||
export { default as Data, getInstance } from "shorter-js/src/misc/data"; | ||
export { default as Timer } from "shorter-js/src/misc/timer"; | ||
export { default as emulateAnimationEnd } from "shorter-js/src/misc/emulateAnimationEnd"; | ||
@@ -1411,0 +1420,0 @@ export { default as emulateTransitionEnd } from "shorter-js/src/misc/emulateTransitionEnd"; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252906
163
6609