shorter-js
Advanced tools
Comparing version 0.2.15 to 0.2.16
/*! | ||
* shorter-js v0.2.15 (https://github.com/thednp/shorter-js) | ||
* shorter-js v0.2.16 (https://github.com/thednp/shorter-js) | ||
* Copyright 2019-2021 © dnp_theme | ||
@@ -62,3 +62,3 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
* A global namespace for mouse click events. | ||
* @type {{down: string, up: string}} | ||
* @type {Record<string, string>} | ||
*/ | ||
@@ -68,2 +68,20 @@ const mouseClickEvents = { down: 'mousedown', up: 'mouseup' }; | ||
/** | ||
* A global namespace for `click` event. | ||
* @type {string} | ||
*/ | ||
const mouseclickEvent = 'click'; | ||
/** | ||
* A global namespace for `mousedown` event. | ||
* @type {string} | ||
*/ | ||
const mousedownEvent = 'mousedown'; | ||
/** | ||
* A global namespace for `mouseup` event. | ||
* @type {string} | ||
*/ | ||
const mouseupEvent = 'mouseup'; | ||
/** | ||
* A global namespace for mouse hover events. | ||
@@ -75,4 +93,16 @@ * @type {[string, string]} | ||
/** | ||
* A global namespace for `mouseenter` event. | ||
* @type {string} | ||
*/ | ||
const mouseenterEvent = 'mouseenter'; | ||
/** | ||
* A global namespace for `mouseleave` event. | ||
* @type {string} | ||
*/ | ||
const mouseleaveEvent = 'mouseleave'; | ||
/** | ||
* A global namespace for touch events. | ||
* @type {object} | ||
* @type {Record<string, string>} | ||
*/ | ||
@@ -84,2 +114,26 @@ const touchEvents = { | ||
/** | ||
* A global namespace for `touchstart` event. | ||
* @type {string} | ||
*/ | ||
const touchstartEvent = 'touchstart'; | ||
/** | ||
* A global namespace for `touchmove` event. | ||
* @type {string} | ||
*/ | ||
const touchmoveEvent = 'touchmove'; | ||
/** | ||
* A global namespace for `touchcancel` event. | ||
* @type {string} | ||
*/ | ||
const touchcancelEvent = 'touchcancel'; | ||
/** | ||
* A global namespace for `touchend` event. | ||
* @type {string} | ||
*/ | ||
const touchendEvent = 'touchend'; | ||
/** | ||
* A global namespace for focus event names. | ||
@@ -91,7 +145,19 @@ * @type {{in: string, out: string}} | ||
/** | ||
* A global namespace for mouse events equivalent with touch events. | ||
* @type {{start: string, end: string, move: string, cancel: string}} | ||
* A global namespace for `focusin` event. | ||
* @type {string} | ||
*/ | ||
const focusinEvent = 'focusin'; | ||
/** | ||
* A global namespace for `focusout` event. | ||
* @type {string} | ||
*/ | ||
const focusoutEvent = 'focusout'; | ||
/** | ||
* A global namespace for mouse events equivalent to touch events. | ||
* @type {Record<string, string>} | ||
*/ | ||
const mouseSwipeEvents = { | ||
start: 'mousedown', end: 'mouseup', move: 'mousemove', cancel: 'mouseout', | ||
start: 'mousedown', end: 'mouseup', move: 'mousemove', cancel: 'mouseleave', | ||
}; | ||
@@ -150,3 +216,3 @@ | ||
* CSS3 'cubic-bezier()' easing functions. | ||
* @type {object} | ||
* @type {Record<string, string>} | ||
*/ | ||
@@ -193,2 +259,130 @@ const bezierEasings = { | ||
/** | ||
* A global namespace for keyboard event keys. | ||
* @type {Record<string, string>} | ||
*/ | ||
const keyboardEventKeys = { | ||
Backspace: 'Backspace', // 8 | ||
Tab: 'Tab', // 9 | ||
Enter: 'Enter', // 13 | ||
Shift: 'Shift', // 16 | ||
Control: 'Control', // 17 | ||
Alt: 'Alt', // 18 | ||
Pause: 'Pause', // 19 | ||
CapsLock: 'CapsLock', // 20 | ||
Escape: 'Escape', // 27 | ||
Scape: 'Space', // 32 | ||
ArrowLeft: 'ArrowLeft', // 37 | ||
ArrowUp: 'ArrowUp', // 38 | ||
ArrowRight: 'ArrowRight', // 39 | ||
ArrowDown: 'ArrowDown', // 40 | ||
Insert: 'Insert', // 45 | ||
Delete: 'Delete', // 46 | ||
Meta: 'Meta', // 91 windows key | ||
ContextMenu: 'ContextMenu', // 93 | ||
ScrollLock: 'ScrollLock', // 145 | ||
}; | ||
/** | ||
* A global namespace for `Alt` key. | ||
* @type {string} e.which = 18 | ||
*/ | ||
const keyAlt = 'Alt'; | ||
/** | ||
* A global namespace for `ArrowDown` key. | ||
* @type {string} e.which = 40 equivalent | ||
*/ | ||
const keyArrowDown = 'ArrowDown'; | ||
/** | ||
* A global namespace for `ArrowUp` key. | ||
* @type {string} e.which = 38 equivalent | ||
*/ | ||
const keyArrowUp = 'ArrowUp'; | ||
/** | ||
* A global namespace for `ArrowLeft` key. | ||
* @type {string} e.which = 37 equivalent | ||
*/ | ||
const keyArrowLeft = 'ArrowLeft'; | ||
/** | ||
* A global namespace for `ArrowRight` key. | ||
* @type {string} e.which = 39 equivalent | ||
*/ | ||
const keyArrowRight = 'ArrowRight'; | ||
/** | ||
* A global namespace for `Backspace` key. | ||
* @type {string} e.which === 8 equivalent | ||
*/ | ||
const keyBackspace = 'Backspace'; | ||
/** | ||
* A global namespace for `CapsLock` key. | ||
* @type {string} e.which = 20 equivalent | ||
*/ | ||
const keyCapsLock = 'CapsLock'; | ||
/** | ||
* A global namespace for `Control` key. | ||
* @type {string} e.which = 17 | ||
*/ | ||
const keyControl = 'Control'; | ||
/** | ||
* A global namespace for `Delete` key. | ||
* @type {string} e.which = 46 equivalent | ||
*/ | ||
const keyDelete = 'Delete'; | ||
/** | ||
* A global namespace for `Enter` key. | ||
* @type {string} e.which = 13 equivalent | ||
*/ | ||
const keyEnter = 'Enter'; | ||
/** | ||
* A global namespace for `Insert` key. | ||
* @type {string} e.which = 45 equivalent | ||
*/ | ||
const keyInsert = 'Insert'; | ||
/** | ||
* A global namespace for `Meta` key. | ||
* @type {string} e.which = 93 equivalent | ||
*/ | ||
const keyMeta = 'Meta'; | ||
/** | ||
* A global namespace for `Pause` key. | ||
* @type {string} e.which = 19 | ||
*/ | ||
const keyPause = 'Pause'; | ||
/** | ||
* A global namespace for `ScrollLock` key. | ||
* @type {string} e.which = 145 equivalent | ||
*/ | ||
const keyScrollLock = 'ScrollLock'; | ||
/** | ||
* A global namespace for `Shift` key. | ||
* @type {string} e.which = 16 | ||
*/ | ||
const keyShift = 'Shift'; | ||
/** | ||
* A global namespace for `Space` key. | ||
* @type {string} e.which = 32 equivalent | ||
*/ | ||
const keySpace = 'Space'; | ||
/** | ||
* A global namespace for `Tab` key. | ||
* @type {string} e.which = 9 equivalent | ||
*/ | ||
const keyTab = 'Tab'; | ||
const mobileBrands = /iPhone|iPad|iPod|Android/i; | ||
@@ -356,5 +550,5 @@ const userAgentStr = 'userAgentData'; | ||
/** | ||
* Checks if an element is an `Element`. | ||
* Checks if an object is an `Element`. | ||
* | ||
* @param {any} element the target element | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
@@ -367,3 +561,3 @@ */ | ||
/** | ||
* Utility to check if target is typeof Element | ||
* Utility to check if target is typeof `Element` | ||
* or find one that matches a selector. | ||
@@ -377,3 +571,3 @@ * | ||
const lookUp = parent && isElement(parent) ? parent : document; | ||
// @ts-ignore | ||
// @ts-ignore -- `isElement` is just as good | ||
return isElement(selector) ? selector : lookUp.querySelector(selector); | ||
@@ -460,3 +654,3 @@ } | ||
/** | ||
* Utility to get the computed animationDelay | ||
* Utility to get the computed `animationDelay` | ||
* from Element in miliseconds. | ||
@@ -479,3 +673,3 @@ * | ||
/** | ||
* Utility to get the computed animationDuration | ||
* Utility to get the computed `animationDuration` | ||
* from Element in miliseconds. | ||
@@ -502,3 +696,3 @@ * | ||
* @param {Element} element target | ||
* @param {function} handler `animationend` callback | ||
* @param {EventListener} handler `animationend` callback | ||
*/ | ||
@@ -515,3 +709,2 @@ function emulateAnimationEnd(element, handler) { | ||
* @param {Event} e Event object | ||
* @callback | ||
*/ | ||
@@ -535,3 +728,3 @@ const animationEndWrapper = (e) => { | ||
/** | ||
* Utility to get the computed transitionDelay | ||
* Utility to get the computed `transitionDelay` | ||
* from Element in miliseconds. | ||
@@ -554,3 +747,3 @@ * | ||
/** | ||
* Utility to get the computed transitionDuration | ||
* Utility to get the computed `transitionDuration` | ||
* from Element in miliseconds. | ||
@@ -577,3 +770,3 @@ * | ||
* @param {Element} element target | ||
* @param {function} handler `transitionend` callback | ||
* @param {EventListener} handler `transitionend` callback | ||
*/ | ||
@@ -590,3 +783,2 @@ function emulateTransitionEnd(element, handler) { | ||
* @param {Event} e Event object | ||
* @callback | ||
*/ | ||
@@ -642,3 +834,3 @@ const transitionEndWrapper = (e) => { | ||
* | ||
* @param {any} element the target element | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
@@ -653,3 +845,3 @@ */ | ||
* *Tooltip* / *Popover* works different with media elements. | ||
* @param {Element} element the target element | ||
* @param {any} element the target element | ||
* @returns {boolean} the query result | ||
@@ -663,3 +855,3 @@ */ | ||
/** | ||
* Stores a global namespace for Right To Left pages. | ||
* Checks if a page is Right To Left. | ||
* @returns {boolean} the query result | ||
@@ -713,9 +905,9 @@ */ | ||
* @param {Element} element target | ||
* @param {object} defaultOps component default options | ||
* @param {object} inputOps component instance options | ||
* @param {string} ns component namespace | ||
* @return {object} normalized component options object | ||
* @param {Record<string, any>} defaultOps component default options | ||
* @param {Record<string, any>} inputOps component instance options | ||
* @param {string=} ns component namespace | ||
* @return {Record<string, any>} normalized component options object | ||
*/ | ||
function normalizeOptions(element, defaultOps, inputOps, ns) { | ||
// @ts-ignore | ||
// @ts-ignore -- usually our `Element` is `HTMLElement` as well | ||
const data = { ...element.dataset }; | ||
@@ -727,3 +919,3 @@ const normalOps = {}; | ||
.forEach((k) => { | ||
const key = k.includes(ns) | ||
const key = ns && k.includes(ns) | ||
? k.replace(ns, '').replace(/[A-Z]/, (match) => match.toLowerCase()) | ||
@@ -767,13 +959,13 @@ : k; | ||
/** | ||
* Utility to force re-paint of an Element | ||
* Utility to force re-paint of an `Element` target. | ||
* | ||
* @param {Element | HTMLElement} element is the target | ||
* @return {number} the Element.offsetHeight value | ||
* @return {number} the `Element.offsetHeight` value | ||
*/ | ||
function reflow(element) { | ||
// @ts-ignore | ||
// @ts-ignore -- our `Element` is always an `HTMLElement` | ||
return element.offsetHeight; | ||
} | ||
var version = "0.2.15"; | ||
var version = "0.2.16"; | ||
@@ -801,5 +993,16 @@ // @ts-ignore | ||
mouseClickEvents, | ||
mouseclickEvent, | ||
mousedownEvent, | ||
mouseupEvent, | ||
mouseHoverEvents, | ||
mouseenterEvent, | ||
mouseleaveEvent, | ||
touchEvents, | ||
touchstartEvent, | ||
touchmoveEvent, | ||
touchcancelEvent, | ||
touchendEvent, | ||
focusEvents, | ||
focusinEvent, | ||
focusoutEvent, | ||
mouseSwipeEvents, | ||
@@ -825,2 +1028,20 @@ bezierEasings, | ||
removeEventListener, | ||
keyboardEventKeys, | ||
keyAlt, | ||
keyArrowDown, | ||
keyArrowLeft, | ||
keyArrowRight, | ||
keyArrowUp, | ||
keyBackspace, | ||
keyCapsLock, | ||
keyControl, | ||
keyDelete, | ||
keyEnter, | ||
keyInsert, | ||
keyMeta, | ||
keyPause, | ||
keyScrollLock, | ||
keyShift, | ||
keySpace, | ||
keyTab, | ||
addClass, | ||
@@ -827,0 +1048,0 @@ removeClass, |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.2.15 | 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",a="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",o="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",r="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",s="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c=/iPhone|iPad|iPod|Android/i;let d=!1;d=navigator.userAgentData?navigator.userAgentData.brands.some(e=>c.test(e.brand)):c.test(navigator.userAgent);const l=d,{userAgentData:m}=navigator,b=/(iPhone|iPod|iPad)/,g=m?m.brands.some(e=>b.test(e.brand)):b.test(navigator.userAgent),p="webkitPerspective"in document.head.style||"perspective"in document.head.style,E=(()=>{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})(),v="webkitTransform"in document.head.style||"transform"in document.head.style,h="ontouchstart"in window||"msMaxTouchPoints"in navigator,f="webkitAnimation"in document.head.style||"animation"in document.head.style,y="webkitTransition"in document.head.style||"transition"in document.head.style;function w(e,n,t,i){const a=i||!1;e.addEventListener(n,t,a)}function k(e,n,t,i){const a=i||!1;e.removeEventListener(n,t,a)}function z(e){return e instanceof Element}function T(e,n){const t=n&&z(n)?n:document;return z(e)?e:t.querySelector(e)}const L=new Map,D={set:(e,n,t)=>{const i=T(e);if(!z(i))return;L.has(n)||L.set(n,new Map);L.get(n).set(i,t)},getAllFor:e=>L.has(e)?L.get(e):null,get:(e,n)=>{const t=T(e),i=D.getAllFor(n);return i&&z(t)&&i.has(t)?i.get(t):null},remove:(e,n)=>{if(!L.has(n))return;const t=L.get(n);t.delete(e),0===t.size&&L.delete(n)}};function A(e){const n=getComputedStyle(e),i=n[a],o=n[t],r=o.includes("ms")?1:1e3,s=f&&i&&"none"!==i?parseFloat(o)*r:0;return Number.isNaN(s)?0:s}function O(e){const t=getComputedStyle(e),i=t[a],o=t[n],r=o.includes("ms")?1:1e3,s=f&&i&&"none"!==i?parseFloat(o)*r:0;return Number.isNaN(s)?0:s}function C(e){const n=getComputedStyle(e),t=n[r],i=n[s],a=i.includes("ms")?1:1e3,o=y&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(o)?0:o}function I(e){const n=getComputedStyle(e),t=n[r],i=n[o],a=i.includes("ms")?1:1e3,s=y&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(s)?0:s}function N(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const P={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",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:e,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},focusEvents:{in:"focusin",out:"focusout"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:n,animationDelay:t,animationName:a,animationEndEvent:i,transitionDuration:o,transitionDelay:s,transitionEndEvent:u,transitionProperty:r,isMobile:l,isApple:g,support3DTransform:p,supportPassive:E,supportTransform:v,supportTouch:h,supportAnimation:f,supportTransition:y,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:w,off:k,one:function(e,n,t,i){w(e,n,(function a(o){o.target===e&&(t.apply(e,[o]),k(e,n,a,i))}),i)},Data:D,getInstance:(e,n)=>D.get(e,n),emulateAnimationEnd:function(e,n){let t=0;const a=new Event(i),o=O(e),r=A(e);if(o){const s=a=>{a.target===e&&(n.apply(e,[a]),e.removeEventListener(i,s),t=1)};e.addEventListener(i,s),setTimeout(()=>{t||e.dispatchEvent(a)},o+r+17)}else n.apply(e,[a])},emulateTransitionEnd:function(e,n){let t=0;const i=new Event(u),a=I(e),o=C(e);if(a){const r=i=>{i.target===e&&(n.apply(e,[i]),e.removeEventListener(u,r),t=1)};e.addEventListener(u,r),setTimeout(()=>{t||e.dispatchEvent(i)},a+o+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:!!E&&{passive:!0},getElementAnimationDuration:O,getElementAnimationDelay:A,getElementTransitionDuration:I,getElementTransitionDelay:C,isElement:z,isHTMLElement:function(e){return e instanceof HTMLElement},isMedia:function(e){return[SVGElement,HTMLImageElement,HTMLVideoElement].some(n=>e instanceof n)},isRTL:()=>"rtl"===document.documentElement.dir,queryElement:T,normalizeValue:N,normalizeOptions:function(e,n,t,i){const a={...e.dataset},o={},r={};return Object.keys(a).forEach(e=>{const n=e.includes(i)?e.replace(i,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;r[n]=N(a[e])}),Object.keys(t).forEach(e=>{t[e]=N(t[e])}),Object.keys(n).forEach(e=>{o[e]=e in t?t[e]:e in r?r[e]:n[e]}),o},tryWrapper:function(e,n){try{e()}catch(e){throw TypeError(`${n} ${e}`)}},reflow:function(e){return e.offsetHeight},Version:"0.2.15"};export default P; | ||
// shorter-js v0.2.16 | 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",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",s="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",c="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",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 d=l,{userAgentData:m}=navigator,b=/(iPhone|iPod|iPad)/,p=m?m.brands.some(e=>b.test(e.brand)):b.test(navigator.userAgent),E="webkitPerspective"in document.head.style||"perspective"in document.head.style,g=(()=>{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})(),v="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,w="webkitTransition"in document.head.style||"transition"in document.head.style;function f(e,t,n,i){const o=i||!1;e.addEventListener(t,n,o)}function k(e,t,n,i){const o=i||!1;e.removeEventListener(t,n,o)}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 D=new Map,C={set:(e,t,n)=>{const i=L(e);if(!A(i))return;D.has(t)||D.set(t,new Map);D.get(t).set(i,n)},getAllFor:e=>D.has(e)?D.get(e):null,get:(e,t)=>{const n=L(e),i=C.getAllFor(t);return i&&A(n)&&i.has(n)?i.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 T(e){const t=getComputedStyle(e),i=t[o],a=t[n],r=a.includes("ms")?1:1e3,s=h&&i&&"none"!==i?parseFloat(a)*r:0;return Number.isNaN(s)?0:s}function z(e){const n=getComputedStyle(e),i=n[o],a=n[t],r=a.includes("ms")?1:1e3,s=h&&i&&"none"!==i?parseFloat(a)*r:0;return Number.isNaN(s)?0:s}function I(e){const t=getComputedStyle(e),n=t[r],i=t[s],o=i.includes("ms")?1:1e3,a=w&&n&&"none"!==n?parseFloat(i)*o:0;return Number.isNaN(a)?0:a}function S(e){const t=getComputedStyle(e),n=t[r],i=t[a],o=i.includes("ms")?1:1e3,s=w&&n&&"none"!==n?parseFloat(i)*o:0;return Number.isNaN(s)?0:s}function O(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const P={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",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",focusEvents:{in:"focusin",out:"focusout"},focusinEvent:"focusin",focusoutEvent:"focusout",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},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:a,transitionDelay:s,transitionEndEvent:c,transitionProperty:r,isMobile:d,isApple:p,support3DTransform:E,supportPassive:g,supportTransform:v,supportTouch:y,supportAnimation:h,supportTransition:w,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"},keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",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:f,off:k,one:function(e,t,n,i){f(e,t,(function o(a){a.target===e&&(n.apply(e,[a]),k(e,t,o,i))}),i)},Data:C,getInstance:(e,t)=>C.get(e,t),emulateAnimationEnd:function(e,t){let n=0;const o=new Event(i),a=z(e),r=T(e);if(a){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)},a+r+17)}else t.apply(e,[o])},emulateTransitionEnd:function(e,t){let n=0;const i=new Event(c),o=S(e),a=I(e);if(o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener(c,r),n=1)};e.addEventListener(c,r),setTimeout(()=>{n||e.dispatchEvent(i)},o+a+17)}else t.apply(e,[i])},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:!!g&&{passive:!0},getElementAnimationDuration:z,getElementAnimationDelay:T,getElementTransitionDuration:S,getElementTransitionDelay:I,isElement:A,isHTMLElement:function(e){return e instanceof HTMLElement},isMedia:function(e){return[SVGElement,HTMLImageElement,HTMLVideoElement].some(t=>e instanceof t)},isRTL:()=>"rtl"===document.documentElement.dir,queryElement:L,normalizeValue:O,normalizeOptions:function(e,t,n,i){const o={...e.dataset},a={},r={};return Object.keys(o).forEach(e=>{const t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;r[t]=O(o[e])}),Object.keys(n).forEach(e=>{n[e]=O(n[e])}),Object.keys(t).forEach(e=>{a[e]=e in n?n[e]:e in r?r[e]:t[e]}),a},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(`${t} ${e}`)}},reflow:function(e){return e.offsetHeight},Version:"0.2.16"};export default P; |
/*! | ||
* shorter-js v0.2.15 (https://github.com/thednp/shorter-js) | ||
* shorter-js v0.2.16 (https://github.com/thednp/shorter-js) | ||
* Copyright 2019-2021 © dnp_theme | ||
@@ -68,3 +68,3 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
* A global namespace for mouse click events. | ||
* @type {{down: string, up: string}} | ||
* @type {Record<string, string>} | ||
*/ | ||
@@ -74,2 +74,20 @@ var mouseClickEvents = { down: 'mousedown', up: 'mouseup' }; | ||
/** | ||
* A global namespace for `click` event. | ||
* @type {string} | ||
*/ | ||
var mouseclickEvent = 'click'; | ||
/** | ||
* A global namespace for `mousedown` event. | ||
* @type {string} | ||
*/ | ||
var mousedownEvent = 'mousedown'; | ||
/** | ||
* A global namespace for `mouseup` event. | ||
* @type {string} | ||
*/ | ||
var mouseupEvent = 'mouseup'; | ||
/** | ||
* A global namespace for mouse hover events. | ||
@@ -81,4 +99,16 @@ * @type {[string, string]} | ||
/** | ||
* A global namespace for `mouseenter` event. | ||
* @type {string} | ||
*/ | ||
var mouseenterEvent = 'mouseenter'; | ||
/** | ||
* A global namespace for `mouseleave` event. | ||
* @type {string} | ||
*/ | ||
var mouseleaveEvent = 'mouseleave'; | ||
/** | ||
* A global namespace for touch events. | ||
* @type {object} | ||
* @type {Record<string, string>} | ||
*/ | ||
@@ -90,2 +120,26 @@ var touchEvents = { | ||
/** | ||
* A global namespace for `touchstart` event. | ||
* @type {string} | ||
*/ | ||
var touchstartEvent = 'touchstart'; | ||
/** | ||
* A global namespace for `touchmove` event. | ||
* @type {string} | ||
*/ | ||
var touchmoveEvent = 'touchmove'; | ||
/** | ||
* A global namespace for `touchcancel` event. | ||
* @type {string} | ||
*/ | ||
var touchcancelEvent = 'touchcancel'; | ||
/** | ||
* A global namespace for `touchend` event. | ||
* @type {string} | ||
*/ | ||
var touchendEvent = 'touchend'; | ||
/** | ||
* A global namespace for focus event names. | ||
@@ -97,7 +151,19 @@ * @type {{in: string, out: string}} | ||
/** | ||
* A global namespace for mouse events equivalent with touch events. | ||
* @type {{start: string, end: string, move: string, cancel: string}} | ||
* A global namespace for `focusin` event. | ||
* @type {string} | ||
*/ | ||
var focusinEvent = 'focusin'; | ||
/** | ||
* A global namespace for `focusout` event. | ||
* @type {string} | ||
*/ | ||
var focusoutEvent = 'focusout'; | ||
/** | ||
* A global namespace for mouse events equivalent to touch events. | ||
* @type {Record<string, string>} | ||
*/ | ||
var mouseSwipeEvents = { | ||
start: 'mousedown', end: 'mouseup', move: 'mousemove', cancel: 'mouseout', | ||
start: 'mousedown', end: 'mouseup', move: 'mousemove', cancel: 'mouseleave', | ||
}; | ||
@@ -156,3 +222,3 @@ | ||
* CSS3 'cubic-bezier()' easing functions. | ||
* @type {object} | ||
* @type {Record<string, string>} | ||
*/ | ||
@@ -199,2 +265,130 @@ var bezierEasings = { | ||
/** | ||
* A global namespace for keyboard event keys. | ||
* @type {Record<string, string>} | ||
*/ | ||
var keyboardEventKeys = { | ||
Backspace: 'Backspace', // 8 | ||
Tab: 'Tab', // 9 | ||
Enter: 'Enter', // 13 | ||
Shift: 'Shift', // 16 | ||
Control: 'Control', // 17 | ||
Alt: 'Alt', // 18 | ||
Pause: 'Pause', // 19 | ||
CapsLock: 'CapsLock', // 20 | ||
Escape: 'Escape', // 27 | ||
Scape: 'Space', // 32 | ||
ArrowLeft: 'ArrowLeft', // 37 | ||
ArrowUp: 'ArrowUp', // 38 | ||
ArrowRight: 'ArrowRight', // 39 | ||
ArrowDown: 'ArrowDown', // 40 | ||
Insert: 'Insert', // 45 | ||
Delete: 'Delete', // 46 | ||
Meta: 'Meta', // 91 windows key | ||
ContextMenu: 'ContextMenu', // 93 | ||
ScrollLock: 'ScrollLock', // 145 | ||
}; | ||
/** | ||
* A global namespace for `Alt` key. | ||
* @type {string} e.which = 18 | ||
*/ | ||
var keyAlt = 'Alt'; | ||
/** | ||
* A global namespace for `ArrowDown` key. | ||
* @type {string} e.which = 40 equivalent | ||
*/ | ||
var keyArrowDown = 'ArrowDown'; | ||
/** | ||
* A global namespace for `ArrowUp` key. | ||
* @type {string} e.which = 38 equivalent | ||
*/ | ||
var keyArrowUp = 'ArrowUp'; | ||
/** | ||
* A global namespace for `ArrowLeft` key. | ||
* @type {string} e.which = 37 equivalent | ||
*/ | ||
var keyArrowLeft = 'ArrowLeft'; | ||
/** | ||
* A global namespace for `ArrowRight` key. | ||
* @type {string} e.which = 39 equivalent | ||
*/ | ||
var keyArrowRight = 'ArrowRight'; | ||
/** | ||
* A global namespace for `Backspace` key. | ||
* @type {string} e.which === 8 equivalent | ||
*/ | ||
var keyBackspace = 'Backspace'; | ||
/** | ||
* A global namespace for `CapsLock` key. | ||
* @type {string} e.which = 20 equivalent | ||
*/ | ||
var keyCapsLock = 'CapsLock'; | ||
/** | ||
* A global namespace for `Control` key. | ||
* @type {string} e.which = 17 | ||
*/ | ||
var keyControl = 'Control'; | ||
/** | ||
* A global namespace for `Delete` key. | ||
* @type {string} e.which = 46 equivalent | ||
*/ | ||
var keyDelete = 'Delete'; | ||
/** | ||
* A global namespace for `Enter` key. | ||
* @type {string} e.which = 13 equivalent | ||
*/ | ||
var keyEnter = 'Enter'; | ||
/** | ||
* A global namespace for `Insert` key. | ||
* @type {string} e.which = 45 equivalent | ||
*/ | ||
var keyInsert = 'Insert'; | ||
/** | ||
* A global namespace for `Meta` key. | ||
* @type {string} e.which = 93 equivalent | ||
*/ | ||
var keyMeta = 'Meta'; | ||
/** | ||
* A global namespace for `Pause` key. | ||
* @type {string} e.which = 19 | ||
*/ | ||
var keyPause = 'Pause'; | ||
/** | ||
* A global namespace for `ScrollLock` key. | ||
* @type {string} e.which = 145 equivalent | ||
*/ | ||
var keyScrollLock = 'ScrollLock'; | ||
/** | ||
* A global namespace for `Shift` key. | ||
* @type {string} e.which = 16 | ||
*/ | ||
var keyShift = 'Shift'; | ||
/** | ||
* A global namespace for `Space` key. | ||
* @type {string} e.which = 32 equivalent | ||
*/ | ||
var keySpace = 'Space'; | ||
/** | ||
* A global namespace for `Tab` key. | ||
* @type {string} e.which = 9 equivalent | ||
*/ | ||
var keyTab = 'Tab'; | ||
var mobileBrands = /iPhone|iPad|iPod|Android/i; | ||
@@ -362,5 +556,5 @@ var userAgentStr = 'userAgentData'; | ||
/** | ||
* Checks if an element is an `Element`. | ||
* Checks if an object is an `Element`. | ||
* | ||
* @param {any} element the target element | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
@@ -373,3 +567,3 @@ */ | ||
/** | ||
* Utility to check if target is typeof Element | ||
* Utility to check if target is typeof `Element` | ||
* or find one that matches a selector. | ||
@@ -383,3 +577,3 @@ * | ||
var lookUp = parent && isElement(parent) ? parent : document; | ||
// @ts-ignore | ||
// @ts-ignore -- `isElement` is just as good | ||
return isElement(selector) ? selector : lookUp.querySelector(selector); | ||
@@ -466,3 +660,3 @@ } | ||
/** | ||
* Utility to get the computed animationDelay | ||
* Utility to get the computed `animationDelay` | ||
* from Element in miliseconds. | ||
@@ -485,3 +679,3 @@ * | ||
/** | ||
* Utility to get the computed animationDuration | ||
* Utility to get the computed `animationDuration` | ||
* from Element in miliseconds. | ||
@@ -508,3 +702,3 @@ * | ||
* @param {Element} element target | ||
* @param {function} handler `animationend` callback | ||
* @param {EventListener} handler `animationend` callback | ||
*/ | ||
@@ -521,3 +715,2 @@ function emulateAnimationEnd(element, handler) { | ||
* @param {Event} e Event object | ||
* @callback | ||
*/ | ||
@@ -541,3 +734,3 @@ var animationEndWrapper = function (e) { | ||
/** | ||
* Utility to get the computed transitionDelay | ||
* Utility to get the computed `transitionDelay` | ||
* from Element in miliseconds. | ||
@@ -560,3 +753,3 @@ * | ||
/** | ||
* Utility to get the computed transitionDuration | ||
* Utility to get the computed `transitionDuration` | ||
* from Element in miliseconds. | ||
@@ -583,3 +776,3 @@ * | ||
* @param {Element} element target | ||
* @param {function} handler `transitionend` callback | ||
* @param {EventListener} handler `transitionend` callback | ||
*/ | ||
@@ -596,3 +789,2 @@ function emulateTransitionEnd(element, handler) { | ||
* @param {Event} e Event object | ||
* @callback | ||
*/ | ||
@@ -648,3 +840,3 @@ var transitionEndWrapper = function (e) { | ||
* | ||
* @param {any} element the target element | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
@@ -659,3 +851,3 @@ */ | ||
* *Tooltip* / *Popover* works different with media elements. | ||
* @param {Element} element the target element | ||
* @param {any} element the target element | ||
* @returns {boolean} the query result | ||
@@ -669,3 +861,3 @@ */ | ||
/** | ||
* Stores a global namespace for Right To Left pages. | ||
* Checks if a page is Right To Left. | ||
* @returns {boolean} the query result | ||
@@ -719,9 +911,9 @@ */ | ||
* @param {Element} element target | ||
* @param {object} defaultOps component default options | ||
* @param {object} inputOps component instance options | ||
* @param {string} ns component namespace | ||
* @return {object} normalized component options object | ||
* @param {Record<string, any>} defaultOps component default options | ||
* @param {Record<string, any>} inputOps component instance options | ||
* @param {string=} ns component namespace | ||
* @return {Record<string, any>} normalized component options object | ||
*/ | ||
function normalizeOptions(element, defaultOps, inputOps, ns) { | ||
// @ts-ignore | ||
// @ts-ignore -- usually our `Element` is `HTMLElement` as well | ||
var data = Object.assign({}, element.dataset); | ||
@@ -733,3 +925,3 @@ var normalOps = {}; | ||
.forEach(function (k) { | ||
var key = k.includes(ns) | ||
var key = ns && k.includes(ns) | ||
? k.replace(ns, '').replace(/[A-Z]/, function (match) { return match.toLowerCase(); }) | ||
@@ -773,13 +965,13 @@ : k; | ||
/** | ||
* Utility to force re-paint of an Element | ||
* Utility to force re-paint of an `Element` target. | ||
* | ||
* @param {Element | HTMLElement} element is the target | ||
* @return {number} the Element.offsetHeight value | ||
* @return {number} the `Element.offsetHeight` value | ||
*/ | ||
function reflow(element) { | ||
// @ts-ignore | ||
// @ts-ignore -- our `Element` is always an `HTMLElement` | ||
return element.offsetHeight; | ||
} | ||
var version = "0.2.15"; | ||
var version = "0.2.16"; | ||
@@ -807,5 +999,16 @@ // @ts-ignore | ||
mouseClickEvents: mouseClickEvents, | ||
mouseclickEvent: mouseclickEvent, | ||
mousedownEvent: mousedownEvent, | ||
mouseupEvent: mouseupEvent, | ||
mouseHoverEvents: mouseHoverEvents, | ||
mouseenterEvent: mouseenterEvent, | ||
mouseleaveEvent: mouseleaveEvent, | ||
touchEvents: touchEvents, | ||
touchstartEvent: touchstartEvent, | ||
touchmoveEvent: touchmoveEvent, | ||
touchcancelEvent: touchcancelEvent, | ||
touchendEvent: touchendEvent, | ||
focusEvents: focusEvents, | ||
focusinEvent: focusinEvent, | ||
focusoutEvent: focusoutEvent, | ||
mouseSwipeEvents: mouseSwipeEvents, | ||
@@ -831,2 +1034,20 @@ bezierEasings: bezierEasings, | ||
removeEventListener: removeEventListener, | ||
keyboardEventKeys: keyboardEventKeys, | ||
keyAlt: keyAlt, | ||
keyArrowDown: keyArrowDown, | ||
keyArrowLeft: keyArrowLeft, | ||
keyArrowRight: keyArrowRight, | ||
keyArrowUp: keyArrowUp, | ||
keyBackspace: keyBackspace, | ||
keyCapsLock: keyCapsLock, | ||
keyControl: keyControl, | ||
keyDelete: keyDelete, | ||
keyEnter: keyEnter, | ||
keyInsert: keyInsert, | ||
keyMeta: keyMeta, | ||
keyPause: keyPause, | ||
keyScrollLock: keyScrollLock, | ||
keyShift: keyShift, | ||
keySpace: keySpace, | ||
keyTab: keyTab, | ||
addClass: addClass, | ||
@@ -833,0 +1054,0 @@ removeClass: removeClass, |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.2.15 | dnp_theme © 2021 | MIT-License | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).SHORTER=n()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",t="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",a="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",r="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",o="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),l=navigator.userAgentData,m=/(iPhone|iPod|iPad)/,b=l?l.brands.some((function(e){return m.test(e.brand)})):m.test(navigator.userAgent),f="webkitPerspective"in document.head.style||"perspective"in document.head.style,v=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}(),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,n,t,i){var a=i||!1;e.addEventListener(n,t,a)}function w(e,n,t,i){var a=i||!1;e.removeEventListener(n,t,a)}function k(e){return e instanceof Element}function z(e,n){var t=n&&k(n)?n:document;return k(e)?e:t.querySelector(e)}var T=new Map,L={set:function(e,n,t){var i=z(e);k(i)&&(T.has(n)||T.set(n,new Map),T.get(n).set(i,t))},getAllFor:function(e){return T.has(e)?T.get(e):null},get:function(e,n){var t=z(e),i=L.getAllFor(n);return i&&k(t)&&i.has(t)?i.get(t):null},remove:function(e,n){if(T.has(n)){var t=T.get(n);t.delete(e),0===t.size&&T.delete(n)}}};function O(e){var n=getComputedStyle(e),i=n[a],r=n[t],o=r.includes("ms")?1:1e3,u=E&&i&&"none"!==i?parseFloat(r)*o:0;return Number.isNaN(u)?0:u}function D(e){var t=getComputedStyle(e),i=t[a],r=t[n],o=r.includes("ms")?1:1e3,u=E&&i&&"none"!==i?parseFloat(r)*o:0;return Number.isNaN(u)?0:u}function A(e){var n=getComputedStyle(e),t=n[o],i=n[u],a=i.includes("ms")?1:1e3,r=y&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(r)?0:r}function C(e){var n=getComputedStyle(e),t=n[o],i=n[r],a=i.includes("ms")?1:1e3,u=y&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(u)?0:u}function I(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+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",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:e,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},focusEvents:{in:"focusin",out:"focusout"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:n,animationDelay:t,animationName:a,animationEndEvent:i,transitionDuration:r,transitionDelay:u,transitionEndEvent:s,transitionProperty:o,isMobile:d,isApple:b,support3DTransform:f,supportPassive:v,supportTransform:p,supportTouch:g,supportAnimation:E,supportTransition:y,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:h,off:w,one:function(e,n,t,i){h(e,n,(function a(r){r.target===e&&(t.apply(e,[r]),w(e,n,a,i))}),i)},Data:L,getInstance:function(e,n){return L.get(e,n)},emulateAnimationEnd:function(e,n){var t=0,a=new Event(i),r=D(e),o=O(e);if(r){var u=function(a){a.target===e&&(n.apply(e,[a]),e.removeEventListener(i,u),t=1)};e.addEventListener(i,u),setTimeout((function(){t||e.dispatchEvent(a)}),r+o+17)}else n.apply(e,[a])},emulateTransitionEnd:function(e,n){var t=0,i=new Event(s),a=C(e),r=A(e);if(a){var o=function(i){i.target===e&&(n.apply(e,[i]),e.removeEventListener(s,o),t=1)};e.addEventListener(s,o),setTimeout((function(){t||e.dispatchEvent(i)}),a+r+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:!!v&&{passive:!0},getElementAnimationDuration:D,getElementAnimationDelay:O,getElementTransitionDuration:C,getElementTransitionDelay:A,isElement:k,isHTMLElement:function(e){return e instanceof HTMLElement},isMedia:function(e){return[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(n){return e instanceof n}))},isRTL:function(){return"rtl"===document.documentElement.dir},queryElement:z,normalizeValue:I,normalizeOptions:function(e,n,t,i){var a=Object.assign({},e.dataset),r={},o={};return Object.keys(a).forEach((function(e){var n=e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;o[n]=I(a[e])})),Object.keys(t).forEach((function(e){t[e]=I(t[e])})),Object.keys(n).forEach((function(e){r[e]=e in t?t[e]:e in o?o[e]:n[e]})),r},tryWrapper:function(e,n){try{e()}catch(e){throw TypeError(n+" "+e)}},reflow:function(e){return e.offsetHeight},Version:"0.2.15"}})); | ||
// shorter-js v0.2.16 | dnp_theme © 2021 | MIT-License | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).SHORTER=n()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",t="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",a="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",o="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",r="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",u="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",s="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",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)/,b=d?d.brands.some((function(e){return m.test(e.brand)})):m.test(navigator.userAgent),v="webkitPerspective"in document.head.style||"perspective"in document.head.style,p=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}(),f="webkitTransform"in document.head.style||"transform"in document.head.style,E="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,n,t,i){var a=i||!1;e.addEventListener(n,t,a)}function w(e,n,t,i){var a=i||!1;e.removeEventListener(n,t,a)}function k(e){return e instanceof Element}function A(e,n){var t=n&&k(n)?n:document;return k(e)?e:t.querySelector(e)}var L=new Map,D={set:function(e,n,t){var i=A(e);k(i)&&(L.has(n)||L.set(n,new Map),L.get(n).set(i,t))},getAllFor:function(e){return L.has(e)?L.get(e):null},get:function(e,n){var t=A(e),i=D.getAllFor(n);return i&&k(t)&&i.has(t)?i.get(t):null},remove:function(e,n){if(L.has(n)){var t=L.get(n);t.delete(e),0===t.size&&L.delete(n)}}};function T(e){var n=getComputedStyle(e),i=n[a],o=n[t],r=o.includes("ms")?1:1e3,u=g&&i&&"none"!==i?parseFloat(o)*r:0;return Number.isNaN(u)?0:u}function C(e){var t=getComputedStyle(e),i=t[a],o=t[n],r=o.includes("ms")?1:1e3,u=g&&i&&"none"!==i?parseFloat(o)*r:0;return Number.isNaN(u)?0:u}function z(e){var n=getComputedStyle(e),t=n[r],i=n[u],a=i.includes("ms")?1:1e3,o=y&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(o)?0:o}function O(e){var n=getComputedStyle(e),t=n[r],i=n[o],a=i.includes("ms")?1:1e3,u=y&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(u)?0:u}function S(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+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",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",focusEvents:{in:"focusin",out:"focusout"},focusinEvent:"focusin",focusoutEvent:"focusout",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:n,animationDelay:t,animationName:a,animationEndEvent:i,transitionDuration:o,transitionDelay:u,transitionEndEvent:s,transitionProperty:r,isMobile:l,isApple:b,support3DTransform:v,supportPassive:p,supportTransform:f,supportTouch:E,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"},keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",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:h,off:w,one:function(e,n,t,i){h(e,n,(function a(o){o.target===e&&(t.apply(e,[o]),w(e,n,a,i))}),i)},Data:D,getInstance:function(e,n){return D.get(e,n)},emulateAnimationEnd:function(e,n){var t=0,a=new Event(i),o=C(e),r=T(e);if(o){var u=function(a){a.target===e&&(n.apply(e,[a]),e.removeEventListener(i,u),t=1)};e.addEventListener(i,u),setTimeout((function(){t||e.dispatchEvent(a)}),o+r+17)}else n.apply(e,[a])},emulateTransitionEnd:function(e,n){var t=0,i=new Event(s),a=O(e),o=z(e);if(a){var r=function(i){i.target===e&&(n.apply(e,[i]),e.removeEventListener(s,r),t=1)};e.addEventListener(s,r),setTimeout((function(){t||e.dispatchEvent(i)}),a+o+17)}else n.apply(e,[i])},isElementInScrollRange:function(e){var n=e.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;return n.top<=t&&n.bottom>=0},isElementInViewport:function(e){var n=e.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!p&&{passive:!0},getElementAnimationDuration:C,getElementAnimationDelay:T,getElementTransitionDuration:O,getElementTransitionDelay:z,isElement:k,isHTMLElement:function(e){return e instanceof HTMLElement},isMedia:function(e){return[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(n){return e instanceof n}))},isRTL:function(){return"rtl"===document.documentElement.dir},queryElement:A,normalizeValue:S,normalizeOptions:function(e,n,t,i){var a=Object.assign({},e.dataset),o={},r={};return Object.keys(a).forEach((function(e){var n=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;r[n]=S(a[e])})),Object.keys(t).forEach((function(e){t[e]=S(t[e])})),Object.keys(n).forEach((function(e){o[e]=e in t?t[e]:e in r?r[e]:n[e]})),o},tryWrapper:function(e,n){try{e()}catch(e){throw TypeError(n+" "+e)}},reflow:function(e){return e.offsetHeight},Version:"0.2.16"}})); |
{ | ||
"name": "shorter-js", | ||
"version": "0.2.15", | ||
"version": "0.2.16", | ||
"description": "A small ES6+ library with various JavaScript tools useful for creating light libraries.", | ||
@@ -5,0 +5,0 @@ "main": "dist/shorter-js.min.js", |
@@ -13,6 +13,18 @@ // strings FIRST | ||
import mouseClickEvents from './strings/mouseClickEvents'; | ||
import mouseclickEvent from './strings/mouseclickEvent'; | ||
import mousedownEvent from './strings/mousedownEvent'; | ||
import mouseupEvent from './strings/mouseupEvent'; | ||
import mouseHoverEvents from './strings/mouseHoverEvents'; | ||
import mouseenterEvent from './strings/mouseenterEvent'; | ||
import mouseleaveEvent from './strings/mouseleaveEvent'; | ||
import touchEvents from './strings/touchEvents'; | ||
import touchstartEvent from './strings/touchstartEvent'; | ||
import touchmoveEvent from './strings/touchmoveEvent'; | ||
import touchcancelEvent from './strings/touchcancelEvent'; | ||
import touchendEvent from './strings/touchendEvent'; | ||
import focusEvents from './strings/focusEvents'; | ||
import focusinEvent from './strings/focusinEvent'; | ||
import focusoutEvent from './strings/focusoutEvent'; | ||
import mouseSwipeEvents from './strings/mouseSwipeEvents'; | ||
import animationDuration from './strings/animationDuration'; | ||
@@ -30,2 +42,21 @@ import animationDelay from './strings/animationDelay'; | ||
import keyboardEventKeys from './strings/keyboardEventKeys'; | ||
import keyAlt from './strings/keyAlt'; | ||
import keyArrowDown from './strings/keyArrowDown'; | ||
import keyArrowUp from './strings/keyArrowUp'; | ||
import keyArrowLeft from './strings/keyArrowLeft'; | ||
import keyArrowRight from './strings/keyArrowRight'; | ||
import keyBackspace from './strings/keyBackspace'; | ||
import keyCapsLock from './strings/keyCapsLock'; | ||
import keyControl from './strings/keyControl'; | ||
import keyDelete from './strings/keyDelete'; | ||
import keyEnter from './strings/keyEnter'; | ||
import keyInsert from './strings/keyInsert'; | ||
import keyMeta from './strings/keyMeta'; | ||
import keyPause from './strings/keyPause'; | ||
import keyScrollLock from './strings/keyScrollLock'; | ||
import keyShift from './strings/keyShift'; | ||
import keySpace from './strings/keySpace'; | ||
import keyTab from './strings/keyTab'; | ||
// boolean | ||
@@ -85,5 +116,16 @@ import isMobile from './boolean/isMobile'; | ||
mouseClickEvents, | ||
mouseclickEvent, | ||
mousedownEvent, | ||
mouseupEvent, | ||
mouseHoverEvents, | ||
mouseenterEvent, | ||
mouseleaveEvent, | ||
touchEvents, | ||
touchstartEvent, | ||
touchmoveEvent, | ||
touchcancelEvent, | ||
touchendEvent, | ||
focusEvents, | ||
focusinEvent, | ||
focusoutEvent, | ||
mouseSwipeEvents, | ||
@@ -109,2 +151,20 @@ bezierEasings, | ||
removeEventListener, | ||
keyboardEventKeys, | ||
keyAlt, | ||
keyArrowDown, | ||
keyArrowLeft, | ||
keyArrowRight, | ||
keyArrowUp, | ||
keyBackspace, | ||
keyCapsLock, | ||
keyControl, | ||
keyDelete, | ||
keyEnter, | ||
keyInsert, | ||
keyMeta, | ||
keyPause, | ||
keyScrollLock, | ||
keyShift, | ||
keySpace, | ||
keyTab, | ||
addClass, | ||
@@ -111,0 +171,0 @@ removeClass, |
@@ -10,3 +10,3 @@ import animationEndEvent from '../strings/animationEndEvent'; | ||
* @param {Element} element target | ||
* @param {function} handler `animationend` callback | ||
* @param {EventListener} handler `animationend` callback | ||
*/ | ||
@@ -23,3 +23,2 @@ export default function emulateAnimationEnd(element, handler) { | ||
* @param {Event} e Event object | ||
* @callback | ||
*/ | ||
@@ -26,0 +25,0 @@ const animationEndWrapper = (e) => { |
@@ -10,3 +10,3 @@ import transitionEndEvent from '../strings/transitionEndEvent'; | ||
* @param {Element} element target | ||
* @param {function} handler `transitionend` callback | ||
* @param {EventListener} handler `transitionend` callback | ||
*/ | ||
@@ -23,3 +23,2 @@ export default function emulateTransitionEnd(element, handler) { | ||
* @param {Event} e Event object | ||
* @callback | ||
*/ | ||
@@ -26,0 +25,0 @@ const transitionEndWrapper = (e) => { |
@@ -6,3 +6,3 @@ import supportAnimation from '../boolean/supportAnimation'; | ||
/** | ||
* Utility to get the computed animationDelay | ||
* Utility to get the computed `animationDelay` | ||
* from Element in miliseconds. | ||
@@ -9,0 +9,0 @@ * |
@@ -6,3 +6,3 @@ import supportAnimation from '../boolean/supportAnimation'; | ||
/** | ||
* Utility to get the computed animationDuration | ||
* Utility to get the computed `animationDuration` | ||
* from Element in miliseconds. | ||
@@ -9,0 +9,0 @@ * |
@@ -6,3 +6,3 @@ import supportTransition from '../boolean/supportTransition'; | ||
/** | ||
* Utility to get the computed transitionDelay | ||
* Utility to get the computed `transitionDelay` | ||
* from Element in miliseconds. | ||
@@ -9,0 +9,0 @@ * |
@@ -6,3 +6,3 @@ import supportTransition from '../boolean/supportTransition'; | ||
/** | ||
* Utility to get the computed transitionDuration | ||
* Utility to get the computed `transitionDuration` | ||
* from Element in miliseconds. | ||
@@ -9,0 +9,0 @@ * |
/** | ||
* Checks if an element is an `Element`. | ||
* Checks if an object is an `Element`. | ||
* | ||
* @param {any} element the target element | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
@@ -6,0 +6,0 @@ */ |
/** | ||
* Checks if an element is an `HTMLElement`. | ||
* | ||
* @param {any} element the target element | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
@@ -6,0 +6,0 @@ */ |
/** | ||
* Checks if an element is an `<svg>`, `<img>` or `<video>`. | ||
* *Tooltip* / *Popover* works different with media elements. | ||
* @param {Element} element the target element | ||
* @param {any} element the target element | ||
* @returns {boolean} the query result | ||
@@ -6,0 +6,0 @@ */ |
/** | ||
* Stores a global namespace for Right To Left pages. | ||
* Checks if a page is Right To Left. | ||
* @returns {boolean} the query result | ||
@@ -4,0 +4,0 @@ */ |
@@ -7,9 +7,9 @@ import normalizeValue from './normalizeValue'; | ||
* @param {Element} element target | ||
* @param {object} defaultOps component default options | ||
* @param {object} inputOps component instance options | ||
* @param {string} ns component namespace | ||
* @return {object} normalized component options object | ||
* @param {Record<string, any>} defaultOps component default options | ||
* @param {Record<string, any>} inputOps component instance options | ||
* @param {string=} ns component namespace | ||
* @return {Record<string, any>} normalized component options object | ||
*/ | ||
export default function normalizeOptions(element, defaultOps, inputOps, ns) { | ||
// @ts-ignore | ||
// @ts-ignore -- usually our `Element` is `HTMLElement` as well | ||
const data = { ...element.dataset }; | ||
@@ -21,3 +21,3 @@ const normalOps = {}; | ||
.forEach((k) => { | ||
const key = k.includes(ns) | ||
const key = ns && k.includes(ns) | ||
? k.replace(ns, '').replace(/[A-Z]/, (match) => match.toLowerCase()) | ||
@@ -24,0 +24,0 @@ : k; |
import isElement from './isElement'; | ||
/** | ||
* Utility to check if target is typeof Element | ||
* Utility to check if target is typeof `Element` | ||
* or find one that matches a selector. | ||
@@ -13,4 +13,4 @@ * | ||
const lookUp = parent && isElement(parent) ? parent : document; | ||
// @ts-ignore | ||
// @ts-ignore -- `isElement` is just as good | ||
return isElement(selector) ? selector : lookUp.querySelector(selector); | ||
} |
/** | ||
* Utility to force re-paint of an Element | ||
* Utility to force re-paint of an `Element` target. | ||
* | ||
* @param {Element | HTMLElement} element is the target | ||
* @return {number} the Element.offsetHeight value | ||
* @return {number} the `Element.offsetHeight` value | ||
*/ | ||
export default function reflow(element) { | ||
// @ts-ignore | ||
// @ts-ignore -- our `Element` is always an `HTMLElement` | ||
return element.offsetHeight; | ||
} |
/** | ||
* A global namespace for predefined | ||
* CSS3 'cubic-bezier()' easing functions. | ||
* @type {object} | ||
* @type {Record<string, string>} | ||
*/ | ||
@@ -6,0 +6,0 @@ const bezierEasings = { |
/** | ||
* A global namespace for mouse click events. | ||
* @type {{down: string, up: string}} | ||
* @type {Record<string, string>} | ||
*/ | ||
const mouseClickEvents = { down: 'mousedown', up: 'mouseup' }; | ||
export default mouseClickEvents; |
/** | ||
* A global namespace for mouse events equivalent with touch events. | ||
* @type {{start: string, end: string, move: string, cancel: string}} | ||
* A global namespace for mouse events equivalent to touch events. | ||
* @type {Record<string, string>} | ||
*/ | ||
const mouseSwipeEvents = { | ||
start: 'mousedown', end: 'mouseup', move: 'mousemove', cancel: 'mouseout', | ||
start: 'mousedown', end: 'mouseup', move: 'mousemove', cancel: 'mouseleave', | ||
}; | ||
export default mouseSwipeEvents; |
/** | ||
* A global namespace for touch events. | ||
* @type {object} | ||
* @type {Record<string, string>} | ||
*/ | ||
@@ -5,0 +5,0 @@ const touchEvents = { |
export as namespace SHORTER; | ||
import './shorter'; | ||
export { default as ariaChecked } from "shorter-js/src/strings/ariaChecked"; | ||
export { default as ariaDescribedBy } from "shorter-js/src/strings/ariaDescribedBy"; | ||
export { default as ariaExpanded } from "shorter-js/src/strings/ariaExpanded"; | ||
export { default as ariaHidden } from "shorter-js/src/strings/ariaHidden"; | ||
export { default as ariaLabel } from "shorter-js/src/strings/ariaLabel"; | ||
export { default as ariaLabelledBy } from "shorter-js/src/strings/ariaLabelledBy"; | ||
export { default as ariaModal } from "shorter-js/src/strings/ariaModal"; | ||
export { default as ariaPressed } from "shorter-js/src/strings/ariaPressed"; | ||
export { default as ariaSelected } from "shorter-js/src/strings/ariaSelected"; | ||
export { default as mouseClickEvents } from "shorter-js/src/strings/mouseClickEvents"; | ||
export { default as mouseclickEvent } from "shorter-js/src/strings/mouseclickEvent"; | ||
export { default as mousedownEvent } from "shorter-js/src/strings/mousedownEvent"; | ||
export { default as mouseupEvent } from "shorter-js/src/strings/mouseupEvent"; | ||
export { default as mouseHoverEvents } from "shorter-js/src/strings/mouseHoverEvents"; | ||
export { default as mouseenterEvent } from "shorter-js/src/strings/mouseenterEvent"; | ||
export { default as mouseleaveEvent } from "shorter-js/src/strings/mouseleaveEvent"; | ||
export { default as touchEvents } from "shorter-js/src/strings/touchEvents"; | ||
export { default as touchstartEvent } from "shorter-js/src/strings/touchstartEvent"; | ||
export { default as touchmoveEvent } from "shorter-js/src/strings/touchmoveEvent"; | ||
export { default as touchcancelEvent } from "shorter-js/src/strings/touchcancelEvent"; | ||
export { default as touchendEvent } from "shorter-js/src/strings/touchendEvent"; | ||
export { default as focusEvents } from "shorter-js/src/strings/focusEvents"; | ||
export { default as focusinEvent } from "shorter-js/src/strings/focusinEvent"; | ||
export { default as focusoutEvent } from "shorter-js/src/strings/focusoutEvent"; | ||
export { default as mouseSwipeEvents } from "shorter-js/src/strings/mouseSwipeEvents"; | ||
export { default as bezierEasings } from "shorter-js/src/strings/bezierEasings"; | ||
export { default as animationDuration } from "shorter-js/src/strings/animationDuration"; | ||
@@ -18,2 +37,23 @@ export { default as animationDelay } from "shorter-js/src/strings/animationDelay"; | ||
export { default as transitionProperty } from "shorter-js/src/strings/transitionProperty"; | ||
export { default as bezierEasings } from "shorter-js/src/strings/bezierEasings"; | ||
export { default as addEventListener } from "shorter-js/src/strings/addEventListener"; | ||
export { default as removeEventListener } from "shorter-js/src/strings/removeEventListener"; | ||
export { default as keyboardEventKeys } from "shorter-js/src/strings/keyboardEventKeys"; | ||
export { default as keyAlt } from "shorter-js/src/strings/keyAlt"; | ||
export { default as keyArrowDown } from "shorter-js/src/strings/keyArrowDown"; | ||
export { default as keyArrowUp } from "shorter-js/src/strings/keyArrowUp"; | ||
export { default as keyArrowLeft } from "shorter-js/src/strings/keyArrowLeft"; | ||
export { default as keyArrowRight } from "shorter-js/src/strings/keyArrowRight"; | ||
export { default as keyBackspace } from "shorter-js/src/strings/keyBackspace"; | ||
export { default as keyCapsLock } from "shorter-js/src/strings/keyCapsLock"; | ||
export { default as keyControl } from "shorter-js/src/strings/keyControl"; | ||
export { default as keyDelete } from "shorter-js/src/strings/keyDelete"; | ||
export { default as keyEnter } from "shorter-js/src/strings/keyEnter"; | ||
export { default as keyInsert } from "shorter-js/src/strings/keyInsert"; | ||
export { default as keyMeta } from "shorter-js/src/strings/keyMeta"; | ||
export { default as keyPause } from "shorter-js/src/strings/keyPause"; | ||
export { default as keyScrollLock } from "shorter-js/src/strings/keyScrollLock"; | ||
export { default as keyShift } from "shorter-js/src/strings/keyShift"; | ||
export { default as keySpace } from "shorter-js/src/strings/keySpace"; | ||
export { default as keyTab } from "shorter-js/src/strings/keyTab"; | ||
export { default as isMobile } from "shorter-js/src/boolean/isMobile"; | ||
@@ -27,4 +67,2 @@ export { default as isApple } from "shorter-js/src/boolean/isApple"; | ||
export { default as supportTransition } from "shorter-js/src/boolean/supportTransition"; | ||
export { default as addEventListener } from "shorter-js/src/strings/addEventListener"; | ||
export { default as removeEventListener } from "shorter-js/src/strings/removeEventListener"; | ||
export { default as addClass } from "shorter-js/src/class/addClass"; | ||
@@ -39,4 +77,7 @@ export { default as removeClass } from "shorter-js/src/class/removeClass"; | ||
export { default as emulateTransitionEnd } from "shorter-js/src/misc/emulateTransitionEnd"; | ||
export { default as isElement } from "shorter-js/src/misc/isElement"; | ||
export { default as isElementInScrollRange } from "shorter-js/src/misc/isElementInScrollRange"; | ||
export { default as isElementInViewport } from "shorter-js/src/misc/isElementInViewport"; | ||
export { default as isHTMLElement } from "shorter-js/src/misc/isHTMLElement"; | ||
export { default as isMedia } from "shorter-js/src/misc/isMedia"; | ||
export { default as isRTL } from "shorter-js/src/misc/isRTL"; | ||
@@ -43,0 +84,0 @@ export { default as passiveHandler } from "shorter-js/src/misc/passiveHandler"; |
@@ -0,1 +1,2 @@ | ||
// strings | ||
export { default as ariaChecked } from "../../src/strings/ariaChecked"; | ||
@@ -10,8 +11,20 @@ export { default as ariaDescribedBy } from "../../src/strings/ariaDescribedBy"; | ||
export { default as ariaSelected } from "../../src/strings/ariaSelected"; | ||
export { default as mouseClickEvents } from "../../src/strings/mouseClickEvents"; | ||
export { default as mouseclickEvent } from "../../src/strings/mouseclickEvent" | ||
export { default as mousedownEvent } from "../../src/strings/mousedownEvent" | ||
export { default as mouseupEvent } from "../../src/strings/mouseupEvent" | ||
export { default as mouseHoverEvents } from "../../src/strings/mouseHoverEvents"; | ||
export { default as mouseenterEvent } from "../../src/strings/mouseenterEvent" | ||
export { default as mouseleaveEvent } from "../../src/strings/mouseleaveEvent" | ||
export { default as touchEvents } from "../../src/strings/touchEvents"; | ||
export { default as touchstartEvent } from "../../src/strings/touchstartEvent"; | ||
export { default as touchmoveEvent } from "../../src/strings/touchmoveEvent"; | ||
export { default as touchcancelEvent } from "../../src/strings/touchcancelEvent"; | ||
export { default as touchendEvent } from "../../src/strings/touchendEvent"; | ||
export { default as focusEvents } from "../../src/strings/focusEvents"; | ||
export { default as focusinEvent } from "../../src/strings/focusinEvent"; | ||
export { default as focusoutEvent } from "../../src/strings/focusoutEvent"; | ||
export { default as mouseSwipeEvents } from "../../src/strings/mouseSwipeEvents"; | ||
export { default as bezierEasings } from "../../src/strings/bezierEasings"; | ||
export { default as animationDuration } from "../../src/strings/animationDuration"; | ||
@@ -25,2 +38,26 @@ export { default as animationDelay } from "../../src/strings/animationDelay"; | ||
export { default as transitionProperty } from "../../src/strings/transitionProperty"; | ||
export { default as bezierEasings } from "../../src/strings/bezierEasings"; | ||
export { default as addEventListener } from "../../src/strings/addEventListener"; | ||
export { default as removeEventListener } from "../../src/strings/removeEventListener"; | ||
export { default as keyboardEventKeys } from "../../src/strings/keyboardEventKeys"; | ||
export { default as keyAlt } from "../../src/strings/keyAlt"; | ||
export { default as keyArrowDown } from "../../src/strings/keyArrowDown"; | ||
export { default as keyArrowUp } from "../../src/strings/keyArrowUp"; | ||
export { default as keyArrowLeft } from "../../src/strings/keyArrowLeft"; | ||
export { default as keyArrowRight } from "../../src/strings/keyArrowRight"; | ||
export { default as keyBackspace } from "../../src/strings/keyBackspace"; | ||
export { default as keyCapsLock } from "../../src/strings/keyCapsLock"; | ||
export { default as keyControl } from "../../src/strings/keyControl"; | ||
export { default as keyDelete } from "../../src/strings/keyDelete"; | ||
export { default as keyEnter } from "../../src/strings/keyEnter"; | ||
export { default as keyInsert } from "../../src/strings/keyInsert"; | ||
export { default as keyMeta } from "../../src/strings/keyMeta"; | ||
export { default as keyPause } from "../../src/strings/keyPause"; | ||
export { default as keyScrollLock } from "../../src/strings/keyScrollLock"; | ||
export { default as keyShift } from "../../src/strings/keyShift"; | ||
export { default as keySpace } from "../../src/strings/keySpace"; | ||
export { default as keyTab } from "../../src/strings/keyTab"; | ||
// boolean | ||
export { default as isMobile } from "../../src/boolean/isMobile"; | ||
@@ -34,10 +71,14 @@ export { default as isApple } from "../../src/boolean/isApple"; | ||
export { default as supportTransition } from "../../src/boolean/supportTransition"; | ||
export { default as addEventListener } from "../../src/strings/addEventListener"; | ||
export { default as removeEventListener } from "../../src/strings/removeEventListener"; | ||
// class | ||
export { default as addClass } from "../../src/class/addClass"; | ||
export { default as removeClass } from "../../src/class/removeClass"; | ||
export { default as hasClass } from "../../src/class/hasClass"; | ||
// event | ||
export { default as on } from "../../src/event/on"; | ||
export { default as off } from "../../src/event/off"; | ||
export { default as one } from "../../src/event/one"; | ||
// misc | ||
export { default as Data, getInstance } from "../../src/misc/data"; | ||
@@ -62,2 +103,3 @@ export { default as emulateAnimationEnd } from "../../src/misc/emulateAnimationEnd"; | ||
export { default as reflow } from "../../src/misc/reflow"; | ||
export { default as Version } from "../../src/misc/version"; |
@@ -84,2 +84,26 @@ declare module "shorter-js/src/strings/ariaChecked" { | ||
} | ||
declare module "shorter-js/src/strings/mouseclickEvent" { | ||
export default mouseclickEvent; | ||
/** | ||
* A global namespace for `click` event. | ||
* @type {string} | ||
*/ | ||
const mouseclickEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/mousedownEvent" { | ||
export default mousedownEvent; | ||
/** | ||
* A global namespace for `mousedown` event. | ||
* @type {string} | ||
*/ | ||
const mousedownEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/mouseupEvent" { | ||
export default mouseupEvent; | ||
/** | ||
* A global namespace for `mouseup` event. | ||
* @type {string} | ||
*/ | ||
const mouseupEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/mouseHoverEvents" { | ||
@@ -93,2 +117,18 @@ export default mouseHoverEvents; | ||
} | ||
declare module "shorter-js/src/strings/mouseenterEvent" { | ||
export default mouseenterEvent; | ||
/** | ||
* A global namespace for `mouseenter` event. | ||
* @type {string} | ||
*/ | ||
const mouseenterEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/mouseleaveEvent" { | ||
export default mouseleaveEvent; | ||
/** | ||
* A global namespace for `mouseleave` event. | ||
* @type {string} | ||
*/ | ||
const mouseleaveEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/touchEvents" { | ||
@@ -98,6 +138,38 @@ export default touchEvents; | ||
* A global namespace for touch events. | ||
* @type {object} | ||
* @type {Record<string, string>} | ||
*/ | ||
const touchEvents: object; | ||
const touchEvents: Record<string, string>; | ||
} | ||
declare module "shorter-js/src/strings/touchstartEvent" { | ||
export default touchstartEvent; | ||
/** | ||
* A global namespace for `touchstart` event. | ||
* @type {string} | ||
*/ | ||
const touchstartEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/touchmoveEvent" { | ||
export default touchmoveEvent; | ||
/** | ||
* A global namespace for `touchmove` event. | ||
* @type {string} | ||
*/ | ||
const touchmoveEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/touchcancelEvent" { | ||
export default touchcancelEvent; | ||
/** | ||
* A global namespace for `touchcancel` event. | ||
* @type {string} | ||
*/ | ||
const touchcancelEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/touchendEvent" { | ||
export default touchendEvent; | ||
/** | ||
* A global namespace for `touchend` event. | ||
* @type {string} | ||
*/ | ||
const touchendEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/focusEvents" { | ||
@@ -114,24 +186,26 @@ export default focusEvents; | ||
} | ||
declare module "shorter-js/src/strings/mouseSwipeEvents" { | ||
export default mouseSwipeEvents; | ||
declare module "shorter-js/src/strings/focusinEvent" { | ||
export default focusinEvent; | ||
/** | ||
* A global namespace for mouse events equivalent with touch events. | ||
* @type {{start: string, end: string, move: string, cancel: string}} | ||
* A global namespace for `focusin` event. | ||
* @type {string} | ||
*/ | ||
const mouseSwipeEvents: { | ||
start: string; | ||
end: string; | ||
move: string; | ||
cancel: string; | ||
}; | ||
const focusinEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/bezierEasings" { | ||
export default bezierEasings; | ||
declare module "shorter-js/src/strings/focusoutEvent" { | ||
export default focusoutEvent; | ||
/** | ||
* A global namespace for predefined | ||
* CSS3 'cubic-bezier()' easing functions. | ||
* @type {object} | ||
* A global namespace for `focusout` event. | ||
* @type {string} | ||
*/ | ||
const bezierEasings: object; | ||
const focusoutEvent: string; | ||
} | ||
declare module "shorter-js/src/strings/mouseSwipeEvents" { | ||
export default mouseSwipeEvents; | ||
/** | ||
* A global namespace for mouse events equivalent to touch events. | ||
* @type {Record<string, string>} | ||
*/ | ||
const mouseSwipeEvents: Record<string, string>; | ||
} | ||
declare module "shorter-js/src/strings/animationDuration" { | ||
@@ -201,18 +275,11 @@ export default animationDuration; | ||
} | ||
declare module "shorter-js/src/boolean/isMobile" { | ||
export default isMobile; | ||
declare module "shorter-js/src/strings/bezierEasings" { | ||
export default bezierEasings; | ||
/** | ||
* A global namespace for mobile detection. | ||
* @type {boolean} | ||
* A global namespace for predefined | ||
* CSS3 'cubic-bezier()' easing functions. | ||
* @type {Record<string, string>} | ||
*/ | ||
const isMobile: boolean; | ||
const bezierEasings: Record<string, string>; | ||
} | ||
declare module "shorter-js/src/boolean/support3DTransform" { | ||
export default support3DTransform; | ||
/** | ||
* A global namespace for CSS3 3D transform support. | ||
* @type {boolean} | ||
*/ | ||
const support3DTransform: boolean; | ||
} | ||
declare module "shorter-js/src/strings/addEventListener" { | ||
@@ -234,2 +301,170 @@ export default addEventListener; | ||
} | ||
declare module "shorter-js/src/strings/keyboardEventKeys" { | ||
export default keyboardEventKeys; | ||
/** | ||
* A global namespace for keyboard event keys. | ||
* @type {Record<string, string>} | ||
*/ | ||
const keyboardEventKeys: Record<string, string>; | ||
} | ||
declare module "shorter-js/src/strings/keyAlt" { | ||
export default keyAlt; | ||
/** | ||
* A global namespace for `Alt` key. | ||
* @type {string} e.which = 18 | ||
*/ | ||
const keyAlt: string; | ||
} | ||
declare module "shorter-js/src/strings/keyArrowDown" { | ||
export default keyArrowDown; | ||
/** | ||
* A global namespace for `ArrowDown` key. | ||
* @type {string} e.which = 40 equivalent | ||
*/ | ||
const keyArrowDown: string; | ||
} | ||
declare module "shorter-js/src/strings/keyArrowUp" { | ||
export default keyArrowUp; | ||
/** | ||
* A global namespace for `ArrowUp` key. | ||
* @type {string} e.which = 38 equivalent | ||
*/ | ||
const keyArrowUp: string; | ||
} | ||
declare module "shorter-js/src/strings/keyArrowLeft" { | ||
export default keyArrowLeft; | ||
/** | ||
* A global namespace for `ArrowLeft` key. | ||
* @type {string} e.which = 37 equivalent | ||
*/ | ||
const keyArrowLeft: string; | ||
} | ||
declare module "shorter-js/src/strings/keyArrowRight" { | ||
export default keyArrowRight; | ||
/** | ||
* A global namespace for `ArrowRight` key. | ||
* @type {string} e.which = 39 equivalent | ||
*/ | ||
const keyArrowRight: string; | ||
} | ||
declare module "shorter-js/src/strings/keyBackspace" { | ||
export default keyBackspace; | ||
/** | ||
* A global namespace for `Backspace` key. | ||
* @type {string} e.which === 8 equivalent | ||
*/ | ||
const keyBackspace: string; | ||
} | ||
declare module "shorter-js/src/strings/keyCapsLock" { | ||
export default keyCapsLock; | ||
/** | ||
* A global namespace for `CapsLock` key. | ||
* @type {string} e.which = 20 equivalent | ||
*/ | ||
const keyCapsLock: string; | ||
} | ||
declare module "shorter-js/src/strings/keyControl" { | ||
export default keyControl; | ||
/** | ||
* A global namespace for `Control` key. | ||
* @type {string} e.which = 17 | ||
*/ | ||
const keyControl: string; | ||
} | ||
declare module "shorter-js/src/strings/keyDelete" { | ||
export default keyDelete; | ||
/** | ||
* A global namespace for `Delete` key. | ||
* @type {string} e.which = 46 equivalent | ||
*/ | ||
const keyDelete: string; | ||
} | ||
declare module "shorter-js/src/strings/keyEnter" { | ||
export default keyEnter; | ||
/** | ||
* A global namespace for `Enter` key. | ||
* @type {string} e.which = 13 equivalent | ||
*/ | ||
const keyEnter: string; | ||
} | ||
declare module "shorter-js/src/strings/keyInsert" { | ||
export default keyInsert; | ||
/** | ||
* A global namespace for `Insert` key. | ||
* @type {string} e.which = 45 equivalent | ||
*/ | ||
const keyInsert: string; | ||
} | ||
declare module "shorter-js/src/strings/keyMeta" { | ||
export default keyMeta; | ||
/** | ||
* A global namespace for `Meta` key. | ||
* @type {string} e.which = 93 equivalent | ||
*/ | ||
const keyMeta: string; | ||
} | ||
declare module "shorter-js/src/strings/keyPause" { | ||
export default keyPause; | ||
/** | ||
* A global namespace for `Pause` key. | ||
* @type {string} e.which = 19 | ||
*/ | ||
const keyPause: string; | ||
} | ||
declare module "shorter-js/src/strings/keyScrollLock" { | ||
export default keyScrollLock; | ||
/** | ||
* A global namespace for `ScrollLock` key. | ||
* @type {string} e.which = 145 equivalent | ||
*/ | ||
const keyScrollLock: string; | ||
} | ||
declare module "shorter-js/src/strings/keyShift" { | ||
export default keyShift; | ||
/** | ||
* A global namespace for `Shift` key. | ||
* @type {string} e.which = 16 | ||
*/ | ||
const keyShift: string; | ||
} | ||
declare module "shorter-js/src/strings/keySpace" { | ||
export default keySpace; | ||
/** | ||
* A global namespace for `Space` key. | ||
* @type {string} e.which = 32 equivalent | ||
*/ | ||
const keySpace: string; | ||
} | ||
declare module "shorter-js/src/strings/keyTab" { | ||
export default keyTab; | ||
/** | ||
* A global namespace for `Tab` key. | ||
* @type {string} e.which = 9 equivalent | ||
*/ | ||
const keyTab: string; | ||
} | ||
declare module "shorter-js/src/boolean/isMobile" { | ||
export default isMobile; | ||
/** | ||
* A global namespace for mobile detection. | ||
* @type {boolean} | ||
*/ | ||
const isMobile: boolean; | ||
} | ||
declare module "shorter-js/src/boolean/isApple" { | ||
export default isApple; | ||
/** | ||
* A global namespace for Apple browsers. | ||
* @type {boolean} | ||
*/ | ||
const isApple: boolean; | ||
} | ||
declare module "shorter-js/src/boolean/support3DTransform" { | ||
export default support3DTransform; | ||
/** | ||
* A global namespace for CSS3 3D transform support. | ||
* @type {boolean} | ||
*/ | ||
const support3DTransform: boolean; | ||
} | ||
declare module "shorter-js/src/boolean/supportPassive" { | ||
@@ -339,5 +574,5 @@ export default supportPassive; | ||
/** | ||
* Checks if an element is an `Element`. | ||
* Checks if an object is an `Element`. | ||
* | ||
* @param {any} element the target element | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
@@ -349,3 +584,3 @@ */ | ||
/** | ||
* Utility to check if target is typeof Element | ||
* Utility to check if target is typeof `Element` | ||
* or find one that matches a selector. | ||
@@ -371,3 +606,3 @@ * | ||
/** | ||
* Utility to get the computed animationDelay | ||
* Utility to get the computed `animationDelay` | ||
* from Element in miliseconds. | ||
@@ -382,3 +617,3 @@ * | ||
/** | ||
* Utility to get the computed animationDuration | ||
* Utility to get the computed `animationDuration` | ||
* from Element in miliseconds. | ||
@@ -397,9 +632,9 @@ * | ||
* @param {Element} element target | ||
* @param {function} handler `animationend` callback | ||
* @param {EventListener} handler `animationend` callback | ||
*/ | ||
export default function emulateAnimationEnd(element: Element, handler: Function): void; | ||
export default function emulateAnimationEnd(element: Element, handler: EventListener): void; | ||
} | ||
declare module "shorter-js/src/misc/getElementTransitionDelay" { | ||
/** | ||
* Utility to get the computed transitionDelay | ||
* Utility to get the computed `transitionDelay` | ||
* from Element in miliseconds. | ||
@@ -414,3 +649,3 @@ * | ||
/** | ||
* Utility to get the computed transitionDuration | ||
* Utility to get the computed `transitionDuration` | ||
* from Element in miliseconds. | ||
@@ -429,10 +664,6 @@ * | ||
* @param {Element} element target | ||
* @param {function} handler `transitionend` callback | ||
* @param {EventListener} handler `transitionend` callback | ||
*/ | ||
export default function emulateTransitionEnd(element: Element, handler: Function): void; | ||
export default function emulateTransitionEnd(element: Element, handler: EventListener): void; | ||
} | ||
declare module "shorter-js/src/boolean/isApple" { | ||
export default isApple; | ||
const isApple: boolean; | ||
} | ||
declare module "shorter-js/src/misc/isElementInScrollRange" { | ||
@@ -462,3 +693,3 @@ /** | ||
* | ||
* @param {any} element the target element | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
@@ -472,6 +703,6 @@ */ | ||
* *Tooltip* / *Popover* works different with media elements. | ||
* @param {Element} element the target element | ||
* @param {any} element the target element | ||
* @returns {boolean} the query result | ||
*/ | ||
export default function isMedia(element: Element): boolean; | ||
export default function isMedia(element: any): boolean; | ||
} | ||
@@ -481,3 +712,3 @@ declare module "shorter-js/src/misc/isRTL" { | ||
/** | ||
* Stores a global namespace for Right To Left pages. | ||
* Checks if a page is Right To Left. | ||
* @returns {boolean} the query result | ||
@@ -519,8 +750,8 @@ */ | ||
* @param {Element} element target | ||
* @param {object} defaultOps component default options | ||
* @param {object} inputOps component instance options | ||
* @param {string} ns component namespace | ||
* @return {object} normalized component options object | ||
* @param {Record<string, any>} defaultOps component default options | ||
* @param {Record<string, any>} inputOps component instance options | ||
* @param {string=} ns component namespace | ||
* @return {Record<string, any>} normalized component options object | ||
*/ | ||
export default function normalizeOptions(element: Element, defaultOps: object, inputOps: object, ns: string): object; | ||
export default function normalizeOptions(element: Element, defaultOps: Record<string, any>, inputOps: Record<string, any>, ns?: string | undefined): Record<string, any>; | ||
} | ||
@@ -538,6 +769,6 @@ declare module "shorter-js/src/misc/tryWrapper" { | ||
/** | ||
* Utility to force re-paint of an Element | ||
* Utility to force re-paint of an `Element` target. | ||
* | ||
* @param {Element | HTMLElement} element is the target | ||
* @return {number} the Element.offsetHeight value | ||
* @return {number} the `Element.offsetHeight` value | ||
*/ | ||
@@ -565,7 +796,17 @@ export default function reflow(element: Element | HTMLElement): number; | ||
export { default as mouseClickEvents } from "shorter-js/src/strings/mouseClickEvents"; | ||
export { default as mouseclickEvent } from "shorter-js/src/strings/mouseclickEvent"; | ||
export { default as mousedownEvent } from "shorter-js/src/strings/mousedownEvent"; | ||
export { default as mouseupEvent } from "shorter-js/src/strings/mouseupEvent"; | ||
export { default as mouseHoverEvents } from "shorter-js/src/strings/mouseHoverEvents"; | ||
export { default as mouseenterEvent } from "shorter-js/src/strings/mouseenterEvent"; | ||
export { default as mouseleaveEvent } from "shorter-js/src/strings/mouseleaveEvent"; | ||
export { default as touchEvents } from "shorter-js/src/strings/touchEvents"; | ||
export { default as touchstartEvent } from "shorter-js/src/strings/touchstartEvent"; | ||
export { default as touchmoveEvent } from "shorter-js/src/strings/touchmoveEvent"; | ||
export { default as touchcancelEvent } from "shorter-js/src/strings/touchcancelEvent"; | ||
export { default as touchendEvent } from "shorter-js/src/strings/touchendEvent"; | ||
export { default as focusEvents } from "shorter-js/src/strings/focusEvents"; | ||
export { default as focusinEvent } from "shorter-js/src/strings/focusinEvent"; | ||
export { default as focusoutEvent } from "shorter-js/src/strings/focusoutEvent"; | ||
export { default as mouseSwipeEvents } from "shorter-js/src/strings/mouseSwipeEvents"; | ||
export { default as bezierEasings } from "shorter-js/src/strings/bezierEasings"; | ||
export { default as animationDuration } from "shorter-js/src/strings/animationDuration"; | ||
@@ -579,3 +820,25 @@ export { default as animationDelay } from "shorter-js/src/strings/animationDelay"; | ||
export { default as transitionProperty } from "shorter-js/src/strings/transitionProperty"; | ||
export { default as bezierEasings } from "shorter-js/src/strings/bezierEasings"; | ||
export { default as addEventListener } from "shorter-js/src/strings/addEventListener"; | ||
export { default as removeEventListener } from "shorter-js/src/strings/removeEventListener"; | ||
export { default as keyboardEventKeys } from "shorter-js/src/strings/keyboardEventKeys"; | ||
export { default as keyAlt } from "shorter-js/src/strings/keyAlt"; | ||
export { default as keyArrowDown } from "shorter-js/src/strings/keyArrowDown"; | ||
export { default as keyArrowUp } from "shorter-js/src/strings/keyArrowUp"; | ||
export { default as keyArrowLeft } from "shorter-js/src/strings/keyArrowLeft"; | ||
export { default as keyArrowRight } from "shorter-js/src/strings/keyArrowRight"; | ||
export { default as keyBackspace } from "shorter-js/src/strings/keyBackspace"; | ||
export { default as keyCapsLock } from "shorter-js/src/strings/keyCapsLock"; | ||
export { default as keyControl } from "shorter-js/src/strings/keyControl"; | ||
export { default as keyDelete } from "shorter-js/src/strings/keyDelete"; | ||
export { default as keyEnter } from "shorter-js/src/strings/keyEnter"; | ||
export { default as keyInsert } from "shorter-js/src/strings/keyInsert"; | ||
export { default as keyMeta } from "shorter-js/src/strings/keyMeta"; | ||
export { default as keyPause } from "shorter-js/src/strings/keyPause"; | ||
export { default as keyScrollLock } from "shorter-js/src/strings/keyScrollLock"; | ||
export { default as keyShift } from "shorter-js/src/strings/keyShift"; | ||
export { default as keySpace } from "shorter-js/src/strings/keySpace"; | ||
export { default as keyTab } from "shorter-js/src/strings/keyTab"; | ||
export { default as isMobile } from "shorter-js/src/boolean/isMobile"; | ||
export { default as isApple } from "shorter-js/src/boolean/isApple"; | ||
export { default as support3DTransform } from "shorter-js/src/boolean/support3DTransform"; | ||
@@ -587,4 +850,2 @@ export { default as supportPassive } from "shorter-js/src/boolean/supportPassive"; | ||
export { default as supportTransition } from "shorter-js/src/boolean/supportTransition"; | ||
export { default as addEventListener } from "shorter-js/src/strings/addEventListener"; | ||
export { default as removeEventListener } from "shorter-js/src/strings/removeEventListener"; | ||
export { default as addClass } from "shorter-js/src/class/addClass"; | ||
@@ -599,3 +860,2 @@ export { default as removeClass } from "shorter-js/src/class/removeClass"; | ||
export { default as emulateTransitionEnd } from "shorter-js/src/misc/emulateTransitionEnd"; | ||
export { default as isApple } from "shorter-js/src/boolean/isApple"; | ||
export { default as isElement } from "shorter-js/src/misc/isElement"; | ||
@@ -602,0 +862,0 @@ export { default as isElementInScrollRange } from "shorter-js/src/misc/isElementInScrollRange"; |
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
165137
100
4081