shorter-js
Advanced tools
Comparing version 0.2.25-alpha2 to 0.3.0-alpha1
/*! | ||
* shorter-js v0.2.25alpha2 (https://github.com/thednp/shorter-js) | ||
* shorter-js v0.3.0alpha1 (https://github.com/thednp/shorter-js) | ||
* Copyright 2019-2022 © dnp_theme | ||
@@ -919,3 +919,3 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
* @param {HTMLElement | string} selector the input selector or target element | ||
* @param {(ParentNode | HTMLElement)=} parent optional `HTMLElement` to look into | ||
* @param {HTMLElement=} parent optional `HTMLElement` to look into | ||
* @return {HTMLElement?} the `HTMLElement` or `querySelector` result | ||
@@ -928,2 +928,3 @@ */ | ||
/** @type {Map<HTMLElement, any>} */ | ||
const TimeCache = new Map(); | ||
@@ -945,3 +946,3 @@ /** | ||
if (!isHTMLElement(element)) return; | ||
if (!element) return; | ||
@@ -963,3 +964,3 @@ if (key && key.length) { | ||
* @param {string=} key a unique | ||
* @returns {Map<Element, TimerHandler>?} the timer | ||
* @returns {ReturnType<TimerHandler>?} the timer | ||
*/ | ||
@@ -969,3 +970,3 @@ get: (target, key) => { | ||
if (!isHTMLElement(element)) return null; | ||
if (!element) return null; | ||
@@ -993,14 +994,13 @@ if (key && key.length) { | ||
const element = querySelector(target); | ||
const timers = element && TimeCache.get(element); | ||
if (!isHTMLElement(element) || !TimeCache.has(element)) return; | ||
if (!timers) return; | ||
if (key && key.length) { | ||
const keyTimers = TimeCache.get(element); | ||
if (keyTimers && keyTimers.has(key)) { | ||
clearTimeout(keyTimers.get(key)); | ||
keyTimers.delete(key); | ||
if (timers.has(key)) { | ||
clearTimeout(timers.get(key)); | ||
timers.delete(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
clearTimeout(TimeCache.get(element)); | ||
} else { | ||
clearTimeout(timers); | ||
TimeCache.delete(element); | ||
@@ -1026,3 +1026,3 @@ } | ||
const element = querySelector(target); | ||
if (!element || !isHTMLElement(element)) return; | ||
if (!element) return; | ||
@@ -1041,8 +1041,8 @@ if (!componentData.has(component)) { | ||
* @param {string} component the component's name or a unique key | ||
* @returns {Map<HTMLElement, SHORTER.Component> | null | undefined} all the component instances | ||
* @returns {Map<HTMLElement, SHORTER.Component> | null} all the component instances | ||
*/ | ||
getAllFor: (component) => { | ||
if (componentData.has(component)) { | ||
return componentData.get(component); | ||
} | ||
const instanceMap = componentData.get(component); | ||
if (instanceMap) return instanceMap; | ||
return null; | ||
@@ -1055,11 +1055,10 @@ }, | ||
* @param {string} component the component's name or a unique key | ||
* @returns {SHORTER.Component | null | undefined} the instance | ||
* @returns {SHORTER.Component | null} the instance | ||
*/ | ||
get: (target, component) => { | ||
const element = querySelector(target); | ||
const allForC = Data.getAllFor(component); | ||
const instance = element && allForC && allForC.get(element); | ||
const allForC = Data.getAllFor(component); | ||
if (allForC && element && isHTMLElement(element) && allForC.has(element)) { | ||
return allForC.get(element); | ||
} | ||
if (instance) return instance; | ||
return null; | ||
@@ -1494,2 +1493,9 @@ }, | ||
/** | ||
* Utility to focus an `HTMLElement` target. | ||
* | ||
* @param {HTMLElement} element is the target | ||
*/ | ||
const focus = (element) => element.focus(); | ||
/** | ||
* Shortcut for `Array.from()` static method. | ||
@@ -1655,20 +1661,6 @@ * | ||
/** | ||
* Utility to check if target is typeof `HTMLElement` | ||
* or find one that matches a selector. | ||
* | ||
* @deprecated | ||
* | ||
* @param {HTMLElement | string} selector the input selector or target element | ||
* @param {(ParentNode | HTMLElement)=} parent optional `HTMLElement` to look into | ||
* @return {HTMLElement?} the Element or `querySelector` result | ||
*/ | ||
function queryElement(selector, parent) { | ||
return querySelector(selector, parent); | ||
} | ||
/** | ||
* A shortcut for `(document|Element).querySelectorAll`. | ||
* | ||
* @param {string} selector the input selector | ||
* @param {(HTMLElement | ParentNode)=} parent optional Element to look into | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {NodeListOf<HTMLElement>} the query result | ||
@@ -1686,6 +1678,7 @@ */ | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<Element | HTMLElement>} the 'HTMLCollection' | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
*/ | ||
function getElementsByTagName(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
// @ts-ignore | ||
return lookUp.getElementsByTagName(selector); | ||
@@ -1698,11 +1691,12 @@ } | ||
* @param {string} selector the class name | ||
* @param {(HTMLElement)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection' | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
*/ | ||
function getElementsByClassName(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
// @ts-ignore | ||
return lookUp.getElementsByClassName(selector); | ||
} | ||
var version = "0.2.25alpha2"; | ||
var version = "0.3.0alpha1"; | ||
@@ -1868,3 +1862,2 @@ // @ts-ignore | ||
isRTL, | ||
queryElement, | ||
querySelector, | ||
@@ -1878,2 +1871,3 @@ querySelectorAll, | ||
reflow, | ||
focus, | ||
ArrayFrom, | ||
@@ -1880,0 +1874,0 @@ Float32ArrayFrom, |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.2.25alpha2 | dnp_theme © 2022 | 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?"webkitAnimationName":"animationName",o="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",r="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",s="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",u=/iPhone|iPad|iPod|Android/i;let l=!1;l=navigator.userAgentData?navigator.userAgentData.brands.some(e=>u.test(e.brand)):u.test(navigator.userAgent);const m=l,d=navigator.userAgentData,g=/(iPhone|iPod|iPad)/,v=d?d.brands.some(e=>g.test(e.brand)):g.test(navigator.userAgent),E="webkitPerspective"in document.head.style||"perspective"in document.head.style;function p(e,t,n,i){const o=i||!1;e.addEventListener(t,n,o)}function y(e,t,n,i){const o=i||!1;e.removeEventListener(t,n,o)}function b(e,t,n,i){p(e,t,(function o(a){a.target===e&&(n.apply(e,[a]),y(e,t,o,i))}),i)}const h=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});b(document,"DOMContentLoaded",()=>{},t)}catch(e){throw Error("Passive events are not supported")}return e})(),f="webkitTransform"in document.head.style||"transform"in document.head.style,w="ontouchstart"in window||"msMaxTouchPoints"in navigator,k="webkitAnimation"in document.head.style||"animation"in document.head.style,A="webkitTransition"in document.head.style||"transition"in document.head.style;const L=e=>e&&e instanceof HTMLElement;function D(e,t){const n=t&&L(t)?t:document;return"object"==typeof e?e:n.querySelector(e)}const T=new Map,N={set:(e,t,n,i)=>{const o=D(e);if(L(o))if(i&&i.length){T.has(o)||T.set(o,new Map);T.get(o).set(i,setTimeout(t,n))}else T.set(o,setTimeout(t,n))},get:(e,t)=>{const n=D(e);if(!L(n))return null;if(t&&t.length){T.has(n)||T.set(n,new Map);const e=T.get(n);if(e.has(t))return e.get(t)}else if(T.has(n))return T.get(n);return null},clear:(e,t)=>{const n=D(e);if(L(n)&&T.has(n))if(t&&t.length){const e=T.get(n);e&&e.has(t)&&(clearTimeout(e.get(t)),e.delete(t))}else T.has(n)&&(clearTimeout(T.get(n)),T.delete(n))}},C=new Map,z={set:(e,t,n)=>{const i=D(e);if(!i||!L(i))return;C.has(t)||C.set(t,new Map);C.get(t).set(i,n)},getAllFor:e=>C.has(e)?C.get(e):null,get:(e,t)=>{const n=D(e),i=z.getAllFor(t);return i&&n&&L(n)&&i.has(n)?i.get(n):null},remove:(e,t)=>{const n=D(e),i=C.get(t);i&&n&&(i.delete(n),0===i.size&&C.delete(t))}};function M(e,t){const n=getComputedStyle(e);return t&&t in n?n.getPropertyValue(t):""}function O(e){const t=M(e,"animationName"),n=M(e,"animationDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function S(e){const t=M(e,"animationName"),n=M(e,"animationDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function I(e){const t=M(e,i),o=M(e,n),a=o.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(o)*a:0;return Number.isNaN(r)?0:r}function P(e){const n=M(e,i),o=M(e,t),a=o.includes("ms")?1:1e3,r=k&&n&&"none"!==n?parseFloat(o)*a:0;return Number.isNaN(r)?0:r}function H(e){const t=M(e,"transitionProperty"),n=M(e,"transitionDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function F(e){const t=M(e,"transitionProperty"),n=M(e,"transitionDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function B(e){const t=M(e,c),n=M(e,r),i=n.includes("ms")?1:1e3,o=A&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function x(e){const t=M(e,c),n=M(e,a),i=n.includes("ms")?1:1e3,o=A&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function Q(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const j=e=>Object.keys(e);const R=(e,t)=>Object.assign(e,t);const V={ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:t,animationDelay:"animationDelay",animationDelayLegacy:n,animationName:"animationName",animationNameLegacy:i,animationEndEvent:"animationend",animationEndEventLegacy:o,transitionDuration:"transitionDuration",transitionDurationLegacy:a,transitionDelay:"transitionDelay",transitionDelayLegacy:r,transitionEndEvent:"transitionend",transitionEndEventLegacy:s,transitionProperty:"transitionProperty",transitionPropertyLegacy:c,isMobile:m,isApple:v,support3DTransform:E,supportPassive:h,supportTransform:f,supportTouch:w,supportAnimation:k,supportTransition:A,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:"userAgentData",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:p,off:y,one:b,Data:z,Timer:N,getInstance:(e,t)=>z.get(e,t),emulateAnimationEnd:function(e,t){let n=0;const i=new Event("animationend"),o=S(e),a=O(e);if(o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener("animationend",r),n=1)};e.addEventListener("animationend",r),setTimeout(()=>{n||e.dispatchEvent(i)},o+a+17)}else t.apply(e,[i])},emulateAnimationEndLegacy:function(e,t){let n=0;const i=new Event(o),a=P(e),r=I(e);if(k&&a){const s=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener(o,s),n=1)};e.addEventListener(o,s),setTimeout(()=>{n||e.dispatchEvent(i)},a+r+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){let n=0;const i=new Event("transitionend"),o=F(e),a=H(e);if(o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener("transitionend",r),n=1)};e.addEventListener("transitionend",r),setTimeout(()=>{n||e.dispatchEvent(i)},o+a+17)}else t.apply(e,[i])},emulateTransitionEndLegacy:function(e,t){let n=0;const i=new Event(s),o=x(e),a=B(e);if(A&&o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener(s,r),n=1)};e.addEventListener(s,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:!!h&&{passive:!0},getElementAnimationDuration:S,getElementAnimationDurationLegacy:P,getElementAnimationDelay:O,getElementAnimationDelayLegacy:I,getElementTransitionDuration:F,getElementTransitionDurationLegacy:x,getElementTransitionDelay:H,getElementTransitionDelayLegacy:B,isArray:e=>Array.isArray(e),isString:e=>e&&"string"==typeof e,isElement:e=>e&&e instanceof Element,isHTMLElement:L,isNodeList:e=>e instanceof NodeList,isHTMLCollection:e=>e instanceof HTMLCollection,isElementsArray:e=>Array.isArray(e)&&e.every(e=>L(e)),isMedia:e=>e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(t=>e instanceof t),isRTL:()=>"rtl"===document.documentElement.dir,queryElement:function(e,t){return D(e,t)},querySelector:D,querySelectorAll:function(e,t){return(t&&L(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&L(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&L(t)?t:document).getElementsByTagName(e)},normalizeValue:Q,normalizeOptions:function(e,t,n,i){const o={...e.dataset},a={},r={};return j(o).forEach(e=>{const t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;r[t]=Q(o[e])}),j(n).forEach(e=>{n[e]=Q(n[e])}),j(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:e=>e.offsetHeight,ArrayFrom:e=>Array.from(e),Float32ArrayFrom:e=>Float32Array.from(Array.from(e)),Float64ArrayFrom:e=>Float64Array.from(Array.from(e)),ObjectAssign:R,ObjectKeys:j,ObjectValues:e=>Object.values(e),getElementStyle:M,setElementStyle:(e,t)=>R(e.style,t),getAttribute:(e,t)=>e.getAttribute(t),setAttribute:(e,t,n)=>e.setAttribute(t,n),removeAttribute:(e,t)=>e.removeAttribute(t),Version:"0.2.25alpha2"};export{V as default}; | ||
// shorter-js v0.3.0alpha1 | dnp_theme © 2022 | 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?"webkitAnimationName":"animationName",o="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",r="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",s="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",u=/iPhone|iPad|iPod|Android/i;let l=!1;l=navigator.userAgentData?navigator.userAgentData.brands.some(e=>u.test(e.brand)):u.test(navigator.userAgent);const m=l,d=navigator.userAgentData,g=/(iPhone|iPod|iPad)/,v=d?d.brands.some(e=>g.test(e.brand)):g.test(navigator.userAgent),E="webkitPerspective"in document.head.style||"perspective"in document.head.style;function p(e,t,n,i){const o=i||!1;e.addEventListener(t,n,o)}function y(e,t,n,i){const o=i||!1;e.removeEventListener(t,n,o)}function b(e,t,n,i){p(e,t,(function o(a){a.target===e&&(n.apply(e,[a]),y(e,t,o,i))}),i)}const h=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});b(document,"DOMContentLoaded",()=>{},t)}catch(e){throw Error("Passive events are not supported")}return e})(),f="webkitTransform"in document.head.style||"transform"in document.head.style,w="ontouchstart"in window||"msMaxTouchPoints"in navigator,k="webkitAnimation"in document.head.style||"animation"in document.head.style,A="webkitTransition"in document.head.style||"transition"in document.head.style;const L=e=>e&&e instanceof HTMLElement;function D(e,t){const n=t&&L(t)?t:document;return"object"==typeof e?e:n.querySelector(e)}const T=new Map,N={set:(e,t,n,i)=>{const o=D(e);if(o)if(i&&i.length){T.has(o)||T.set(o,new Map);T.get(o).set(i,setTimeout(t,n))}else T.set(o,setTimeout(t,n))},get:(e,t)=>{const n=D(e);if(!n)return null;if(t&&t.length){T.has(n)||T.set(n,new Map);const e=T.get(n);if(e.has(t))return e.get(t)}else if(T.has(n))return T.get(n);return null},clear:(e,t)=>{const n=D(e),i=n&&T.get(n);i&&(t&&t.length?i.has(t)&&(clearTimeout(i.get(t)),i.delete(t)):(clearTimeout(i),T.delete(n)))}},C=new Map,z={set:(e,t,n)=>{const i=D(e);if(!i)return;C.has(t)||C.set(t,new Map);C.get(t).set(i,n)},getAllFor:e=>{const t=C.get(e);return t||null},get:(e,t)=>{const n=D(e),i=z.getAllFor(t),o=n&&i&&i.get(n);return o||null},remove:(e,t)=>{const n=D(e),i=C.get(t);i&&n&&(i.delete(n),0===i.size&&C.delete(t))}};function M(e,t){const n=getComputedStyle(e);return t&&t in n?n.getPropertyValue(t):""}function O(e){const t=M(e,"animationName"),n=M(e,"animationDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function S(e){const t=M(e,"animationName"),n=M(e,"animationDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function I(e){const t=M(e,i),o=M(e,n),a=o.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(o)*a:0;return Number.isNaN(r)?0:r}function P(e){const n=M(e,i),o=M(e,t),a=o.includes("ms")?1:1e3,r=k&&n&&"none"!==n?parseFloat(o)*a:0;return Number.isNaN(r)?0:r}function H(e){const t=M(e,"transitionProperty"),n=M(e,"transitionDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function F(e){const t=M(e,"transitionProperty"),n=M(e,"transitionDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function B(e){const t=M(e,c),n=M(e,r),i=n.includes("ms")?1:1e3,o=A&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function x(e){const t=M(e,c),n=M(e,a),i=n.includes("ms")?1:1e3,o=A&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function Q(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const j=e=>Object.keys(e);const R=(e,t)=>Object.assign(e,t);const V={ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:t,animationDelay:"animationDelay",animationDelayLegacy:n,animationName:"animationName",animationNameLegacy:i,animationEndEvent:"animationend",animationEndEventLegacy:o,transitionDuration:"transitionDuration",transitionDurationLegacy:a,transitionDelay:"transitionDelay",transitionDelayLegacy:r,transitionEndEvent:"transitionend",transitionEndEventLegacy:s,transitionProperty:"transitionProperty",transitionPropertyLegacy:c,isMobile:m,isApple:v,support3DTransform:E,supportPassive:h,supportTransform:f,supportTouch:w,supportAnimation:k,supportTransition:A,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:"userAgentData",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:p,off:y,one:b,Data:z,Timer:N,getInstance:(e,t)=>z.get(e,t),emulateAnimationEnd:function(e,t){let n=0;const i=new Event("animationend"),o=S(e),a=O(e);if(o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener("animationend",r),n=1)};e.addEventListener("animationend",r),setTimeout(()=>{n||e.dispatchEvent(i)},o+a+17)}else t.apply(e,[i])},emulateAnimationEndLegacy:function(e,t){let n=0;const i=new Event(o),a=P(e),r=I(e);if(k&&a){const s=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener(o,s),n=1)};e.addEventListener(o,s),setTimeout(()=>{n||e.dispatchEvent(i)},a+r+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){let n=0;const i=new Event("transitionend"),o=F(e),a=H(e);if(o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener("transitionend",r),n=1)};e.addEventListener("transitionend",r),setTimeout(()=>{n||e.dispatchEvent(i)},o+a+17)}else t.apply(e,[i])},emulateTransitionEndLegacy:function(e,t){let n=0;const i=new Event(s),o=x(e),a=B(e);if(A&&o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener(s,r),n=1)};e.addEventListener(s,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:!!h&&{passive:!0},getElementAnimationDuration:S,getElementAnimationDurationLegacy:P,getElementAnimationDelay:O,getElementAnimationDelayLegacy:I,getElementTransitionDuration:F,getElementTransitionDurationLegacy:x,getElementTransitionDelay:H,getElementTransitionDelayLegacy:B,isArray:e=>Array.isArray(e),isString:e=>e&&"string"==typeof e,isElement:e=>e&&e instanceof Element,isHTMLElement:L,isNodeList:e=>e instanceof NodeList,isHTMLCollection:e=>e instanceof HTMLCollection,isElementsArray:e=>Array.isArray(e)&&e.every(e=>L(e)),isMedia:e=>e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(t=>e instanceof t),isRTL:()=>"rtl"===document.documentElement.dir,querySelector:D,querySelectorAll:function(e,t){return(t&&L(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&L(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&L(t)?t:document).getElementsByTagName(e)},normalizeValue:Q,normalizeOptions:function(e,t,n,i){const o={...e.dataset},a={},r={};return j(o).forEach(e=>{const t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;r[t]=Q(o[e])}),j(n).forEach(e=>{n[e]=Q(n[e])}),j(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:e=>e.offsetHeight,focus:e=>e.focus(),ArrayFrom:e=>Array.from(e),Float32ArrayFrom:e=>Float32Array.from(Array.from(e)),Float64ArrayFrom:e=>Float64Array.from(Array.from(e)),ObjectAssign:R,ObjectKeys:j,ObjectValues:e=>Object.values(e),getElementStyle:M,setElementStyle:(e,t)=>R(e.style,t),getAttribute:(e,t)=>e.getAttribute(t),setAttribute:(e,t,n)=>e.setAttribute(t,n),removeAttribute:(e,t)=>e.removeAttribute(t),Version:"0.3.0alpha1"};export{V as default}; |
/*! | ||
* shorter-js v0.2.25alpha2 (https://github.com/thednp/shorter-js) | ||
* shorter-js v0.3.0alpha1 (https://github.com/thednp/shorter-js) | ||
* Copyright 2019-2022 © dnp_theme | ||
@@ -924,3 +924,3 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
* @param {HTMLElement | string} selector the input selector or target element | ||
* @param {(ParentNode | HTMLElement)=} parent optional `HTMLElement` to look into | ||
* @param {HTMLElement=} parent optional `HTMLElement` to look into | ||
* @return {HTMLElement?} the `HTMLElement` or `querySelector` result | ||
@@ -933,2 +933,3 @@ */ | ||
/** @type {Map<HTMLElement, any>} */ | ||
var TimeCache = new Map(); | ||
@@ -950,3 +951,3 @@ /** | ||
if (!isHTMLElement(element)) { return; } | ||
if (!element) { return; } | ||
@@ -968,3 +969,3 @@ if (key && key.length) { | ||
* @param {string=} key a unique | ||
* @returns {Map<Element, TimerHandler>?} the timer | ||
* @returns {ReturnType<TimerHandler>?} the timer | ||
*/ | ||
@@ -974,3 +975,3 @@ get: function (target, key) { | ||
if (!isHTMLElement(element)) { return null; } | ||
if (!element) { return null; } | ||
@@ -998,14 +999,13 @@ if (key && key.length) { | ||
var element = querySelector(target); | ||
var timers = element && TimeCache.get(element); | ||
if (!isHTMLElement(element) || !TimeCache.has(element)) { return; } | ||
if (!timers) { return; } | ||
if (key && key.length) { | ||
var keyTimers = TimeCache.get(element); | ||
if (keyTimers && keyTimers.has(key)) { | ||
clearTimeout(keyTimers.get(key)); | ||
keyTimers.delete(key); | ||
if (timers.has(key)) { | ||
clearTimeout(timers.get(key)); | ||
timers.delete(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
clearTimeout(TimeCache.get(element)); | ||
} else { | ||
clearTimeout(timers); | ||
TimeCache.delete(element); | ||
@@ -1031,3 +1031,3 @@ } | ||
var element = querySelector(target); | ||
if (!element || !isHTMLElement(element)) { return; } | ||
if (!element) { return; } | ||
@@ -1046,8 +1046,8 @@ if (!componentData.has(component)) { | ||
* @param {string} component the component's name or a unique key | ||
* @returns {Map<HTMLElement, SHORTER.Component> | null | undefined} all the component instances | ||
* @returns {Map<HTMLElement, SHORTER.Component> | null} all the component instances | ||
*/ | ||
getAllFor: function (component) { | ||
if (componentData.has(component)) { | ||
return componentData.get(component); | ||
} | ||
var instanceMap = componentData.get(component); | ||
if (instanceMap) { return instanceMap; } | ||
return null; | ||
@@ -1060,11 +1060,10 @@ }, | ||
* @param {string} component the component's name or a unique key | ||
* @returns {SHORTER.Component | null | undefined} the instance | ||
* @returns {SHORTER.Component | null} the instance | ||
*/ | ||
get: function (target, component) { | ||
var element = querySelector(target); | ||
var allForC = Data.getAllFor(component); | ||
var instance = element && allForC && allForC.get(element); | ||
var allForC = Data.getAllFor(component); | ||
if (allForC && element && isHTMLElement(element) && allForC.has(element)) { | ||
return allForC.get(element); | ||
} | ||
if (instance) { return instance; } | ||
return null; | ||
@@ -1499,2 +1498,9 @@ }, | ||
/** | ||
* Utility to focus an `HTMLElement` target. | ||
* | ||
* @param {HTMLElement} element is the target | ||
*/ | ||
var focus = function (element) { return element.focus(); }; | ||
/** | ||
* Shortcut for `Array.from()` static method. | ||
@@ -1660,20 +1666,6 @@ * | ||
/** | ||
* Utility to check if target is typeof `HTMLElement` | ||
* or find one that matches a selector. | ||
* | ||
* @deprecated | ||
* | ||
* @param {HTMLElement | string} selector the input selector or target element | ||
* @param {(ParentNode | HTMLElement)=} parent optional `HTMLElement` to look into | ||
* @return {HTMLElement?} the Element or `querySelector` result | ||
*/ | ||
function queryElement(selector, parent) { | ||
return querySelector(selector, parent); | ||
} | ||
/** | ||
* A shortcut for `(document|Element).querySelectorAll`. | ||
* | ||
* @param {string} selector the input selector | ||
* @param {(HTMLElement | ParentNode)=} parent optional Element to look into | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {NodeListOf<HTMLElement>} the query result | ||
@@ -1691,6 +1683,7 @@ */ | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<Element | HTMLElement>} the 'HTMLCollection' | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
*/ | ||
function getElementsByTagName(selector, parent) { | ||
var lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
// @ts-ignore | ||
return lookUp.getElementsByTagName(selector); | ||
@@ -1703,11 +1696,12 @@ } | ||
* @param {string} selector the class name | ||
* @param {(HTMLElement)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection' | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
*/ | ||
function getElementsByClassName(selector, parent) { | ||
var lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
// @ts-ignore | ||
return lookUp.getElementsByClassName(selector); | ||
} | ||
var version = "0.2.25alpha2"; | ||
var version = "0.3.0alpha1"; | ||
@@ -1873,3 +1867,2 @@ // @ts-ignore | ||
isRTL: isRTL, | ||
queryElement: queryElement, | ||
querySelector: querySelector, | ||
@@ -1883,2 +1876,3 @@ querySelectorAll: querySelectorAll, | ||
reflow: reflow, | ||
focus: focus, | ||
ArrayFrom: ArrayFrom, | ||
@@ -1885,0 +1879,0 @@ Float32ArrayFrom: Float32ArrayFrom, |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.2.25alpha2 | dnp_theme © 2022 | MIT-License | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SHORTER=t()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",n="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",r="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",o="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",s="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",c=/iPhone|iPad|iPod|Android/i,l=navigator.userAgentData?navigator.userAgentData.brands.some((function(e){return c.test(e.brand)})):c.test(navigator.userAgent),m=navigator.userAgentData,d=/(iPhone|iPod|iPad)/,v=m?m.brands.some((function(e){return d.test(e.brand)})):d.test(navigator.userAgent),f="webkitPerspective"in document.head.style||"perspective"in document.head.style;function g(e,t,n,i){var r=i||!1;e.addEventListener(t,n,r)}function p(e,t,n,i){var r=i||!1;e.removeEventListener(t,n,r)}function y(e,t,n,i){g(e,t,(function r(a){a.target===e&&(n.apply(e,[a]),p(e,t,r,i))}),i)}var E=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});y(document,"DOMContentLoaded",(function(){}),t)}catch(e){throw Error("Passive events are not supported")}return e}(),b="webkitTransform"in document.head.style||"transform"in document.head.style,h="ontouchstart"in window||"msMaxTouchPoints"in navigator,w="webkitAnimation"in document.head.style||"animation"in document.head.style,k="webkitTransition"in document.head.style||"transition"in document.head.style;var A=function(e){return e&&e instanceof HTMLElement};function L(e,t){var n=t&&A(t)?t:document;return"object"==typeof e?e:n.querySelector(e)}var D=new Map,T={set:function(e,t,n,i){var r=L(e);A(r)&&(i&&i.length?(D.has(r)||D.set(r,new Map),D.get(r).set(i,setTimeout(t,n))):D.set(r,setTimeout(t,n)))},get:function(e,t){var n=L(e);if(!A(n))return null;if(t&&t.length){D.has(n)||D.set(n,new Map);var i=D.get(n);if(i.has(t))return i.get(t)}else if(D.has(n))return D.get(n);return null},clear:function(e,t){var n=L(e);if(A(n)&&D.has(n))if(t&&t.length){var i=D.get(n);i&&i.has(t)&&(clearTimeout(i.get(t)),i.delete(t))}else D.has(n)&&(clearTimeout(D.get(n)),D.delete(n))}},N=new Map,C={set:function(e,t,n){var i=L(e);i&&A(i)&&(N.has(t)||N.set(t,new Map),N.get(t).set(i,n))},getAllFor:function(e){return N.has(e)?N.get(e):null},get:function(e,t){var n=L(e),i=C.getAllFor(t);return i&&n&&A(n)&&i.has(n)?i.get(n):null},remove:function(e,t){var n=L(e),i=N.get(t);i&&n&&(i.delete(n),0===i.size&&N.delete(t))}};function O(e,t){var n=getComputedStyle(e);return t&&t in n?n.getPropertyValue(t):""}function z(e){var t=O(e,"animationName"),n=O(e,"animationDelay"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function M(e){var t=O(e,"animationName"),n=O(e,"animationDuration"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function S(e){var t=O(e,i),r=O(e,n),a=r.includes("ms")?1:1e3,o=w&&t&&"none"!==t?parseFloat(r)*a:0;return Number.isNaN(o)?0:o}function I(e){var n=O(e,i),r=O(e,t),a=r.includes("ms")?1:1e3,o=w&&n&&"none"!==n?parseFloat(r)*a:0;return Number.isNaN(o)?0:o}function P(e){var t=O(e,"transitionProperty"),n=O(e,"transitionDelay"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function H(e){var t=O(e,"transitionProperty"),n=O(e,"transitionDuration"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function F(e){var t=O(e,s),n=O(e,o),i=n.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function B(e){var t=O(e,s),n=O(e,a),i=n.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function x(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}var j=function(e){return Object.keys(e)};var R=function(e,t){return Object.assign(e,t)};return{ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:t,animationDelay:"animationDelay",animationDelayLegacy:n,animationName:"animationName",animationNameLegacy:i,animationEndEvent:"animationend",animationEndEventLegacy:r,transitionDuration:"transitionDuration",transitionDurationLegacy:a,transitionDelay:"transitionDelay",transitionDelayLegacy:o,transitionEndEvent:"transitionend",transitionEndEventLegacy:u,transitionProperty:"transitionProperty",transitionPropertyLegacy:s,isMobile:l,isApple:v,support3DTransform:f,supportPassive:E,supportTransform:b,supportTouch:h,supportAnimation:w,supportTransition:k,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:"userAgentData",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:g,off:p,one:y,Data:C,Timer:T,getInstance:function(e,t){return C.get(e,t)},emulateAnimationEnd:function(e,t){var n=0,i=new Event("animationend"),r=M(e),a=z(e);if(r){var o=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener("animationend",o),n=1)};e.addEventListener("animationend",o),setTimeout((function(){n||e.dispatchEvent(i)}),r+a+17)}else t.apply(e,[i])},emulateAnimationEndLegacy:function(e,t){var n=0,i=new Event(r),a=I(e),o=S(e);if(w&&a){var u=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(r,u),n=1)};e.addEventListener(r,u),setTimeout((function(){n||e.dispatchEvent(i)}),a+o+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){var n=0,i=new Event("transitionend"),r=H(e),a=P(e);if(r){var o=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener("transitionend",o),n=1)};e.addEventListener("transitionend",o),setTimeout((function(){n||e.dispatchEvent(i)}),r+a+17)}else t.apply(e,[i])},emulateTransitionEndLegacy:function(e,t){var n=0,i=new Event(u),r=B(e),a=F(e);if(k&&r){var o=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(u,o),n=1)};e.addEventListener(u,o),setTimeout((function(){n||e.dispatchEvent(i)}),r+a+17)}else t.apply(e,[i])},isElementInScrollRange:function(e){var t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},isElementInViewport:function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!E&&{passive:!0},getElementAnimationDuration:M,getElementAnimationDurationLegacy:I,getElementAnimationDelay:z,getElementAnimationDelayLegacy:S,getElementTransitionDuration:H,getElementTransitionDurationLegacy:B,getElementTransitionDelay:P,getElementTransitionDelayLegacy:F,isArray:function(e){return Array.isArray(e)},isString:function(e){return e&&"string"==typeof e},isElement:function(e){return e&&e instanceof Element},isHTMLElement:A,isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isElementsArray:function(e){return Array.isArray(e)&&e.every((function(e){return A(e)}))},isMedia:function(e){return e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(t){return e instanceof t}))},isRTL:function(){return"rtl"===document.documentElement.dir},queryElement:function(e,t){return L(e,t)},querySelector:L,querySelectorAll:function(e,t){return(t&&A(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&A(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&A(t)?t:document).getElementsByTagName(e)},normalizeValue:x,normalizeOptions:function(e,t,n,i){var r=Object.assign({},e.dataset),a={},o={};return j(r).forEach((function(e){var t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;o[t]=x(r[e])})),j(n).forEach((function(e){n[e]=x(n[e])})),j(t).forEach((function(e){a[e]=e in n?n[e]:e in o?o[e]:t[e]})),a},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(t+" "+e)}},reflow:function(e){return e.offsetHeight},ArrayFrom:function(e){return Array.from(e)},Float32ArrayFrom:function(e){return Float32Array.from(Array.from(e))},Float64ArrayFrom:function(e){return Float64Array.from(Array.from(e))},ObjectAssign:R,ObjectKeys:j,ObjectValues:function(e){return Object.values(e)},getElementStyle:O,setElementStyle:function(e,t){return R(e.style,t)},getAttribute:function(e,t){return e.getAttribute(t)},setAttribute:function(e,t,n){return e.setAttribute(t,n)},removeAttribute:function(e,t){return e.removeAttribute(t)},Version:"0.2.25alpha2"}})); | ||
// shorter-js v0.3.0alpha1 | dnp_theme © 2022 | MIT-License | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SHORTER=t()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",n="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",r="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",o="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",s="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",c=/iPhone|iPad|iPod|Android/i,l=navigator.userAgentData?navigator.userAgentData.brands.some((function(e){return c.test(e.brand)})):c.test(navigator.userAgent),m=navigator.userAgentData,d=/(iPhone|iPod|iPad)/,v=m?m.brands.some((function(e){return d.test(e.brand)})):d.test(navigator.userAgent),f="webkitPerspective"in document.head.style||"perspective"in document.head.style;function g(e,t,n,i){var r=i||!1;e.addEventListener(t,n,r)}function p(e,t,n,i){var r=i||!1;e.removeEventListener(t,n,r)}function y(e,t,n,i){g(e,t,(function r(o){o.target===e&&(n.apply(e,[o]),p(e,t,r,i))}),i)}var E=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});y(document,"DOMContentLoaded",(function(){}),t)}catch(e){throw Error("Passive events are not supported")}return e}(),b="webkitTransform"in document.head.style||"transform"in document.head.style,h="ontouchstart"in window||"msMaxTouchPoints"in navigator,w="webkitAnimation"in document.head.style||"animation"in document.head.style,k="webkitTransition"in document.head.style||"transition"in document.head.style;var A=function(e){return e&&e instanceof HTMLElement};function L(e,t){var n=t&&A(t)?t:document;return"object"==typeof e?e:n.querySelector(e)}var D=new Map,T={set:function(e,t,n,i){var r=L(e);r&&(i&&i.length?(D.has(r)||D.set(r,new Map),D.get(r).set(i,setTimeout(t,n))):D.set(r,setTimeout(t,n)))},get:function(e,t){var n=L(e);if(!n)return null;if(t&&t.length){D.has(n)||D.set(n,new Map);var i=D.get(n);if(i.has(t))return i.get(t)}else if(D.has(n))return D.get(n);return null},clear:function(e,t){var n=L(e),i=n&&D.get(n);i&&(t&&t.length?i.has(t)&&(clearTimeout(i.get(t)),i.delete(t)):(clearTimeout(i),D.delete(n)))}},N=new Map,C={set:function(e,t,n){var i=L(e);i&&(N.has(t)||N.set(t,new Map),N.get(t).set(i,n))},getAllFor:function(e){var t=N.get(e);return t||null},get:function(e,t){var n=L(e),i=C.getAllFor(t),r=n&&i&&i.get(n);return r||null},remove:function(e,t){var n=L(e),i=N.get(t);i&&n&&(i.delete(n),0===i.size&&N.delete(t))}};function O(e,t){var n=getComputedStyle(e);return t&&t in n?n.getPropertyValue(t):""}function z(e){var t=O(e,"animationName"),n=O(e,"animationDelay"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function M(e){var t=O(e,"animationName"),n=O(e,"animationDuration"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function S(e){var t=O(e,i),r=O(e,n),o=r.includes("ms")?1:1e3,a=w&&t&&"none"!==t?parseFloat(r)*o:0;return Number.isNaN(a)?0:a}function I(e){var n=O(e,i),r=O(e,t),o=r.includes("ms")?1:1e3,a=w&&n&&"none"!==n?parseFloat(r)*o:0;return Number.isNaN(a)?0:a}function P(e){var t=O(e,"transitionProperty"),n=O(e,"transitionDelay"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function H(e){var t=O(e,"transitionProperty"),n=O(e,"transitionDuration"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function F(e){var t=O(e,s),n=O(e,a),i=n.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function B(e){var t=O(e,s),n=O(e,o),i=n.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function x(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}var j=function(e){return Object.keys(e)};var R=function(e,t){return Object.assign(e,t)};return{ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:t,animationDelay:"animationDelay",animationDelayLegacy:n,animationName:"animationName",animationNameLegacy:i,animationEndEvent:"animationend",animationEndEventLegacy:r,transitionDuration:"transitionDuration",transitionDurationLegacy:o,transitionDelay:"transitionDelay",transitionDelayLegacy:a,transitionEndEvent:"transitionend",transitionEndEventLegacy:u,transitionProperty:"transitionProperty",transitionPropertyLegacy:s,isMobile:l,isApple:v,support3DTransform:f,supportPassive:E,supportTransform:b,supportTouch:h,supportAnimation:w,supportTransition:k,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:"userAgentData",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:g,off:p,one:y,Data:C,Timer:T,getInstance:function(e,t){return C.get(e,t)},emulateAnimationEnd:function(e,t){var n=0,i=new Event("animationend"),r=M(e),o=z(e);if(r){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener("animationend",a),n=1)};e.addEventListener("animationend",a),setTimeout((function(){n||e.dispatchEvent(i)}),r+o+17)}else t.apply(e,[i])},emulateAnimationEndLegacy:function(e,t){var n=0,i=new Event(r),o=I(e),a=S(e);if(w&&o){var u=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(r,u),n=1)};e.addEventListener(r,u),setTimeout((function(){n||e.dispatchEvent(i)}),o+a+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){var n=0,i=new Event("transitionend"),r=H(e),o=P(e);if(r){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener("transitionend",a),n=1)};e.addEventListener("transitionend",a),setTimeout((function(){n||e.dispatchEvent(i)}),r+o+17)}else t.apply(e,[i])},emulateTransitionEndLegacy:function(e,t){var n=0,i=new Event(u),r=B(e),o=F(e);if(k&&r){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(u,a),n=1)};e.addEventListener(u,a),setTimeout((function(){n||e.dispatchEvent(i)}),r+o+17)}else t.apply(e,[i])},isElementInScrollRange:function(e){var t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},isElementInViewport:function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!E&&{passive:!0},getElementAnimationDuration:M,getElementAnimationDurationLegacy:I,getElementAnimationDelay:z,getElementAnimationDelayLegacy:S,getElementTransitionDuration:H,getElementTransitionDurationLegacy:B,getElementTransitionDelay:P,getElementTransitionDelayLegacy:F,isArray:function(e){return Array.isArray(e)},isString:function(e){return e&&"string"==typeof e},isElement:function(e){return e&&e instanceof Element},isHTMLElement:A,isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isElementsArray:function(e){return Array.isArray(e)&&e.every((function(e){return A(e)}))},isMedia:function(e){return e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(t){return e instanceof t}))},isRTL:function(){return"rtl"===document.documentElement.dir},querySelector:L,querySelectorAll:function(e,t){return(t&&A(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&A(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&A(t)?t:document).getElementsByTagName(e)},normalizeValue:x,normalizeOptions:function(e,t,n,i){var r=Object.assign({},e.dataset),o={},a={};return j(r).forEach((function(e){var t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;a[t]=x(r[e])})),j(n).forEach((function(e){n[e]=x(n[e])})),j(t).forEach((function(e){o[e]=e in n?n[e]:e in a?a[e]:t[e]})),o},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(t+" "+e)}},reflow:function(e){return e.offsetHeight},focus:function(e){return e.focus()},ArrayFrom:function(e){return Array.from(e)},Float32ArrayFrom:function(e){return Float32Array.from(Array.from(e))},Float64ArrayFrom:function(e){return Float64Array.from(Array.from(e))},ObjectAssign:R,ObjectKeys:j,ObjectValues:function(e){return Object.values(e)},getElementStyle:O,setElementStyle:function(e,t){return R(e.style,t)},getAttribute:function(e,t){return e.getAttribute(t)},setAttribute:function(e,t,n){return e.setAttribute(t,n)},removeAttribute:function(e,t){return e.removeAttribute(t)},Version:"0.3.0alpha1"}})); |
{ | ||
"name": "shorter-js", | ||
"version": "0.2.25alpha2", | ||
"version": "0.3.0alpha1", | ||
"description": "A small ES6+ library with various JavaScript tools useful for creating light libraries.", | ||
@@ -5,0 +5,0 @@ "main": "dist/shorter-js.min.js", |
@@ -164,2 +164,3 @@ // strings | ||
import reflow from './misc/reflow'; | ||
import focus from './misc/focus'; | ||
@@ -172,8 +173,8 @@ import ArrayFrom from './misc/ArrayFrom'; | ||
import ObjectValues from './misc/ObjectValues'; | ||
import getElementStyle from './misc/getElementStyle'; | ||
import getAttribute from './misc/getAttribute'; | ||
import setAttribute from './misc/setAttribute'; | ||
import removeAttribute from './misc/removeAttribute'; | ||
import setElementStyle from './misc/setElementStyle'; | ||
import getAttribute from './manipulate/getAttribute'; | ||
import setAttribute from './manipulate/setAttribute'; | ||
import removeAttribute from './manipulate/removeAttribute'; | ||
import getElementStyle from './manipulate/getElementStyle'; | ||
import setElementStyle from './manipulate/setElementStyle'; | ||
@@ -192,7 +193,6 @@ import isElementInScrollRange from './misc/isElementInScrollRange'; | ||
import querySelector from './misc/querySelector'; | ||
import queryElement from './misc/queryElement'; | ||
import querySelectorAll from './misc/querySelectorAll'; | ||
import getElementsByTagName from './misc/getElementsByTagName'; | ||
import getElementsByClassName from './misc/getElementsByClassName'; | ||
import querySelector from './selectors/querySelector'; | ||
import querySelectorAll from './selectors/querySelectorAll'; | ||
import getElementsByTagName from './selectors/getElementsByTagName'; | ||
import getElementsByClassName from './selectors/getElementsByClassName'; | ||
@@ -350,3 +350,2 @@ import Version from './misc/version'; | ||
isRTL, | ||
queryElement, | ||
querySelector, | ||
@@ -360,2 +359,3 @@ querySelectorAll, | ||
reflow, | ||
focus, | ||
ArrayFrom, | ||
@@ -362,0 +362,0 @@ Float32ArrayFrom, |
@@ -1,3 +0,2 @@ | ||
import querySelector from './querySelector'; | ||
import isHTMLElement from './isHTMLElement'; | ||
import querySelector from '../selectors/querySelector'; | ||
@@ -19,3 +18,3 @@ /** @type {Map<string, Map<HTMLElement, SHORTER.Component>>} */ | ||
const element = querySelector(target); | ||
if (!element || !isHTMLElement(element)) return; | ||
if (!element) return; | ||
@@ -34,8 +33,8 @@ if (!componentData.has(component)) { | ||
* @param {string} component the component's name or a unique key | ||
* @returns {Map<HTMLElement, SHORTER.Component> | null | undefined} all the component instances | ||
* @returns {Map<HTMLElement, SHORTER.Component> | null} all the component instances | ||
*/ | ||
getAllFor: (component) => { | ||
if (componentData.has(component)) { | ||
return componentData.get(component); | ||
} | ||
const instanceMap = componentData.get(component); | ||
if (instanceMap) return instanceMap; | ||
return null; | ||
@@ -48,11 +47,10 @@ }, | ||
* @param {string} component the component's name or a unique key | ||
* @returns {SHORTER.Component | null | undefined} the instance | ||
* @returns {SHORTER.Component | null} the instance | ||
*/ | ||
get: (target, component) => { | ||
const element = querySelector(target); | ||
const allForC = Data.getAllFor(component); | ||
const instance = element && allForC && allForC.get(element); | ||
const allForC = Data.getAllFor(component); | ||
if (allForC && element && isHTMLElement(element) && allForC.has(element)) { | ||
return allForC.get(element); | ||
} | ||
if (instance) return instance; | ||
return null; | ||
@@ -59,0 +57,0 @@ }, |
import animationDelay from '../strings/animationDelay'; | ||
import animationName from '../strings/animationName'; | ||
import getElementStyle from './getElementStyle'; | ||
import getElementStyle from '../manipulate/getElementStyle'; | ||
@@ -5,0 +5,0 @@ /** |
import supportAnimation from '../boolean/supportAnimation'; | ||
import animationDelay from '../strings/animationDelayLegacy'; | ||
import animationName from '../strings/animationNameLegacy'; | ||
import getElementStyle from './getElementStyle'; | ||
import getElementStyle from '../manipulate/getElementStyle'; | ||
@@ -6,0 +6,0 @@ /** |
import animationDuration from '../strings/animationDuration'; | ||
import animationName from '../strings/animationName'; | ||
import getElementStyle from './getElementStyle'; | ||
import getElementStyle from '../manipulate/getElementStyle'; | ||
@@ -5,0 +5,0 @@ /** |
import supportAnimation from '../boolean/supportAnimation'; | ||
import animationDuration from '../strings/animationDurationLegacy'; | ||
import animationName from '../strings/animationNameLegacy'; | ||
import getElementStyle from './getElementStyle'; | ||
import getElementStyle from '../manipulate/getElementStyle'; | ||
@@ -6,0 +6,0 @@ /** |
import transitionDelay from '../strings/transitionDelay'; | ||
import transitionProperty from '../strings/transitionProperty'; | ||
import getElementStyle from './getElementStyle'; | ||
import getElementStyle from '../manipulate/getElementStyle'; | ||
@@ -5,0 +5,0 @@ /** |
import supportTransition from '../boolean/supportTransition'; | ||
import transitionDelay from '../strings/transitionDelayLegacy'; | ||
import transitionProperty from '../strings/transitionPropertyLegacy'; | ||
import getElementStyle from './getElementStyle'; | ||
import getElementStyle from '../manipulate/getElementStyle'; | ||
@@ -6,0 +6,0 @@ /** |
import transitionDuration from '../strings/transitionDuration'; | ||
import transitionProperty from '../strings/transitionProperty'; | ||
import getElementStyle from './getElementStyle'; | ||
import getElementStyle from '../manipulate/getElementStyle'; | ||
@@ -5,0 +5,0 @@ /** |
import supportTransition from '../boolean/supportTransition'; | ||
import transitionDuration from '../strings/transitionDurationLegacy'; | ||
import transitionProperty from '../strings/transitionPropertyLegacy'; | ||
import getElementStyle from './getElementStyle'; | ||
import getElementStyle from '../manipulate/getElementStyle'; | ||
@@ -6,0 +6,0 @@ /** |
@@ -1,4 +0,4 @@ | ||
import isHTMLElement from './isHTMLElement'; | ||
import querySelector from './querySelector'; | ||
import querySelector from '../selectors/querySelector'; | ||
/** @type {Map<HTMLElement, any>} */ | ||
const TimeCache = new Map(); | ||
@@ -20,3 +20,3 @@ /** | ||
if (!isHTMLElement(element)) return; | ||
if (!element) return; | ||
@@ -38,3 +38,3 @@ if (key && key.length) { | ||
* @param {string=} key a unique | ||
* @returns {Map<Element, TimerHandler>?} the timer | ||
* @returns {ReturnType<TimerHandler>?} the timer | ||
*/ | ||
@@ -44,3 +44,3 @@ get: (target, key) => { | ||
if (!isHTMLElement(element)) return null; | ||
if (!element) return null; | ||
@@ -68,14 +68,13 @@ if (key && key.length) { | ||
const element = querySelector(target); | ||
const timers = element && TimeCache.get(element); | ||
if (!isHTMLElement(element) || !TimeCache.has(element)) return; | ||
if (!timers) return; | ||
if (key && key.length) { | ||
const keyTimers = TimeCache.get(element); | ||
if (keyTimers && keyTimers.has(key)) { | ||
clearTimeout(keyTimers.get(key)); | ||
keyTimers.delete(key); | ||
if (timers.has(key)) { | ||
clearTimeout(timers.get(key)); | ||
timers.delete(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
clearTimeout(TimeCache.get(element)); | ||
} else { | ||
clearTimeout(timers); | ||
TimeCache.delete(element); | ||
@@ -82,0 +81,0 @@ } |
@@ -154,7 +154,7 @@ export as namespace SHORTER; | ||
export { default as ObjectAssign } from "shorter-js/src/misc/ObjectAssign"; | ||
export { default as getAttribute } from "shorter-js/src/misc/getAttribute"; | ||
export { default as setAttribute } from "shorter-js/src/misc/setAttribute"; | ||
export { default as removeAttribute } from "shorter-js/src/misc/removeAttribute"; | ||
export { default as getElementStyle } from "shorter-js/src/misc/getElementStyle"; | ||
export { default as setElementStyle } from "shorter-js/src/misc/setElementStyle"; | ||
export { default as getAttribute } from "shorter-js/src/manipulate/getAttribute"; | ||
export { default as setAttribute } from "shorter-js/src/manipulate/setAttribute"; | ||
export { default as removeAttribute } from "shorter-js/src/manipulate/removeAttribute"; | ||
export { default as getElementStyle } from "shorter-js/src/manipulate/getElementStyle"; | ||
export { default as setElementStyle } from "shorter-js/src/manipulate/setElementStyle"; | ||
export { default as isArray } from "shorter-js/src/misc/isArray"; | ||
@@ -167,7 +167,7 @@ export { default as isString } from "shorter-js/src/misc/isString"; | ||
export { default as isElementsArray } from "shorter-js/src/misc/isElementsArray"; | ||
export { default as queryElement } from "shorter-js/src/misc/queryElement"; | ||
export { default as querySelector } from "shorter-js/src/misc/querySelector"; | ||
export { default as querySelectorAll } from "shorter-js/src/misc/querySelectorAll"; | ||
export { default as getElementsByTagName } from "shorter-js/src/misc/getElementsByTagName"; | ||
export { default as getElementsByClassName } from "shorter-js/src/misc/getElementsByClassName"; | ||
export { default as closest } from "shorter-js/src/selectors/closest"; | ||
export { default as querySelector } from "shorter-js/src/selectors/querySelector"; | ||
export { default as querySelectorAll } from "shorter-js/src/selectors/querySelectorAll"; | ||
export { default as getElementsByTagName } from "shorter-js/src/selectors/getElementsByTagName"; | ||
export { default as getElementsByClassName } from "shorter-js/src/selectors/getElementsByClassName"; | ||
export { default as Version } from "shorter-js/src/misc/version"; | ||
@@ -177,3 +177,3 @@ | ||
Component, | ||
getInstance | ||
getInstance, | ||
} from './module/types' |
@@ -174,9 +174,8 @@ // strings | ||
export { default as getAttribute } from '../../src/misc/getAttribute'; | ||
export { default as setAttribute } from '../../src/misc/setAttribute'; | ||
export { default as removeAttribute } from '../../src/misc/removeAttribute'; | ||
export { default as getAttribute } from '../../src/manipulate/getAttribute'; | ||
export { default as setAttribute } from '../../src/manipulate/setAttribute'; | ||
export { default as removeAttribute } from '../../src/manipulate/removeAttribute'; | ||
export { default as getElementStyle } from '../../src/manipulate/getElementStyle'; | ||
export { default as setElementStyle } from '../../src/manipulate/setElementStyle'; | ||
export { default as getElementStyle } from '../../src/misc/getElementStyle'; | ||
export { default as setElementStyle } from '../../src/misc/setElementStyle'; | ||
export { default as isArray } from "../../src/misc/isArray"; | ||
@@ -190,8 +189,8 @@ export { default as isString } from "../../src/misc/isString"; | ||
export { default as queryElement } from "../../src/misc/queryElement"; | ||
export { default as querySelector } from "../../src/misc/querySelector"; | ||
export { default as querySelectorAll } from "../../src/misc/querySelectorAll"; | ||
export { default as getElementsByTagName } from "../../src/misc/getElementsByTagName"; | ||
export { default as getElementsByClassName } from "../../src/misc/getElementsByClassName"; | ||
export { default as closest } from "../../src/selectors/closest"; | ||
export { default as querySelector } from "../../src/selectors/querySelector"; | ||
export { default as querySelectorAll } from "../../src/selectors/querySelectorAll"; | ||
export { default as getElementsByTagName } from "../../src/selectors/getElementsByTagName"; | ||
export { default as getElementsByClassName } from "../../src/selectors/getElementsByClassName"; | ||
export { default as Version } from "../../src/misc/version"; |
@@ -997,3 +997,3 @@ declare module "shorter-js/src/strings/ariaChecked" { | ||
} | ||
declare module "shorter-js/src/misc/querySelector" { | ||
declare module "shorter-js/src/selectors/querySelector" { | ||
/** | ||
@@ -1004,6 +1004,6 @@ * Utility to check if target is typeof `HTMLElement` | ||
* @param {HTMLElement | string} selector the input selector or target element | ||
* @param {(ParentNode | HTMLElement)=} parent optional `HTMLElement` to look into | ||
* @param {HTMLElement=} parent optional `HTMLElement` to look into | ||
* @return {HTMLElement?} the `HTMLElement` or `querySelector` result | ||
*/ | ||
export default function querySelector(selector: HTMLElement | string, parent?: (ParentNode | HTMLElement) | undefined): HTMLElement | null; | ||
export default function querySelector(selector: HTMLElement | string, parent?: HTMLElement | undefined): HTMLElement | null; | ||
} | ||
@@ -1019,4 +1019,4 @@ declare module "shorter-js/src/misc/data" { | ||
function set(target: string | HTMLElement, component: string, instance: SHORTER.Component): void; | ||
function getAllFor(component: string): Map<HTMLElement, SHORTER.Component> | null | undefined; | ||
function get(target: string | HTMLElement, component: string): SHORTER.Component | null | undefined; | ||
function getAllFor(component: string): Map<HTMLElement, SHORTER.Component> | null; | ||
function get(target: string | HTMLElement, component: string): SHORTER.Component | null; | ||
function remove(target: string | HTMLElement, component: string): void; | ||
@@ -1029,7 +1029,7 @@ } | ||
function set(target: string | HTMLElement, callback: any, delay: number, key?: string | undefined): void; | ||
function get(target: string | HTMLElement, key?: string | undefined): Map<Element, TimerHandler> | null; | ||
function get(target: string | HTMLElement, key?: string | undefined): any; | ||
function clear(target: HTMLElement, key?: string | undefined): void; | ||
} | ||
} | ||
declare module "shorter-js/src/misc/getElementStyle" { | ||
declare module "shorter-js/src/manipulate/getElementStyle" { | ||
/** | ||
@@ -1328,3 +1328,3 @@ * Shortcut for `window.getComputedStyle(element).propertyName` | ||
} | ||
declare module "shorter-js/src/misc/getAttribute" { | ||
declare module "shorter-js/src/manipulate/getAttribute" { | ||
export default getAttribute; | ||
@@ -1338,3 +1338,3 @@ /** | ||
} | ||
declare module "shorter-js/src/misc/setAttribute" { | ||
declare module "shorter-js/src/manipulate/setAttribute" { | ||
export default setAttribute; | ||
@@ -1349,3 +1349,3 @@ /** | ||
} | ||
declare module "shorter-js/src/misc/removeAttribute" { | ||
declare module "shorter-js/src/manipulate/removeAttribute" { | ||
export default removeAttribute; | ||
@@ -1359,3 +1359,3 @@ /** | ||
} | ||
declare module "shorter-js/src/misc/setElementStyle" { | ||
declare module "shorter-js/src/manipulate/setElementStyle" { | ||
export default setElementStyle; | ||
@@ -1429,16 +1429,13 @@ /** | ||
} | ||
declare module "shorter-js/src/misc/queryElement" { | ||
declare module "shorter-js/src/selectors/closest" { | ||
/** | ||
* Utility to check if target is typeof `HTMLElement` | ||
* or find one that matches a selector. | ||
* Shortcut for `HTMLElement.closest` method. | ||
* | ||
* @deprecated | ||
* | ||
* @param {HTMLElement | string} selector the input selector or target element | ||
* @param {(ParentNode | HTMLElement)=} parent optional `HTMLElement` to look into | ||
* @return {HTMLElement?} the Element or `querySelector` result | ||
* @param {HTMLElement} element optional Element to look into | ||
* @param {string} selector the selector name | ||
* @return {HTMLElement?} the query result | ||
*/ | ||
export default function queryElement(selector: HTMLElement | string, parent?: (ParentNode | HTMLElement) | undefined): HTMLElement | null; | ||
export default function closest(element: HTMLElement, selector: string): HTMLElement | null; | ||
} | ||
declare module "shorter-js/src/misc/querySelectorAll" { | ||
declare module "shorter-js/src/selectors/querySelectorAll" { | ||
/** | ||
@@ -1448,8 +1445,8 @@ * A shortcut for `(document|Element).querySelectorAll`. | ||
* @param {string} selector the input selector | ||
* @param {(HTMLElement | ParentNode)=} parent optional Element to look into | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {NodeListOf<HTMLElement>} the query result | ||
*/ | ||
export default function querySelectorAll(selector: string, parent?: (HTMLElement | ParentNode) | undefined): NodeListOf<HTMLElement>; | ||
export default function querySelectorAll(selector: string, parent?: HTMLElement | undefined): NodeListOf<HTMLElement>; | ||
} | ||
declare module "shorter-js/src/misc/getElementsByTagName" { | ||
declare module "shorter-js/src/selectors/getElementsByTagName" { | ||
/** | ||
@@ -1460,7 +1457,7 @@ * Shortcut for `HTMLElement.getElementsByTagName` method. | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<Element | HTMLElement>} the 'HTMLCollection' | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
*/ | ||
export default function getElementsByTagName(selector: string, parent?: HTMLElement | undefined): HTMLCollectionOf<Element | HTMLElement>; | ||
export default function getElementsByTagName(selector: string, parent?: HTMLElement | undefined): HTMLCollectionOf<HTMLElement>; | ||
} | ||
declare module "shorter-js/src/misc/getElementsByClassName" { | ||
declare module "shorter-js/src/selectors/getElementsByClassName" { | ||
/** | ||
@@ -1471,5 +1468,5 @@ * Shortcut for `HTMLElement.getElementsByClassName` method. | ||
* @param {(HTMLElement)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection' | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
*/ | ||
export default function getElementsByClassName(selector: string, parent?: (HTMLElement) | undefined): HTMLCollectionOf<HTMLElement | Element>; | ||
export default function getElementsByClassName(selector: string, parent?: (HTMLElement) | undefined): HTMLCollectionOf<HTMLElement>; | ||
} | ||
@@ -1635,7 +1632,7 @@ declare module "shorter-js/src/misc/version" { | ||
export { default as ObjectAssign } from "shorter-js/src/misc/ObjectAssign"; | ||
export { default as getAttribute } from "shorter-js/src/misc/getAttribute"; | ||
export { default as setAttribute } from "shorter-js/src/misc/setAttribute"; | ||
export { default as removeAttribute } from "shorter-js/src/misc/removeAttribute"; | ||
export { default as getElementStyle } from "shorter-js/src/misc/getElementStyle"; | ||
export { default as setElementStyle } from "shorter-js/src/misc/setElementStyle"; | ||
export { default as getAttribute } from "shorter-js/src/manipulate/getAttribute"; | ||
export { default as setAttribute } from "shorter-js/src/manipulate/setAttribute"; | ||
export { default as removeAttribute } from "shorter-js/src/manipulate/removeAttribute"; | ||
export { default as getElementStyle } from "shorter-js/src/manipulate/getElementStyle"; | ||
export { default as setElementStyle } from "shorter-js/src/manipulate/setElementStyle"; | ||
export { default as isArray } from "shorter-js/src/misc/isArray"; | ||
@@ -1648,8 +1645,8 @@ export { default as isString } from "shorter-js/src/misc/isString"; | ||
export { default as isElementsArray } from "shorter-js/src/misc/isElementsArray"; | ||
export { default as queryElement } from "shorter-js/src/misc/queryElement"; | ||
export { default as querySelector } from "shorter-js/src/misc/querySelector"; | ||
export { default as querySelectorAll } from "shorter-js/src/misc/querySelectorAll"; | ||
export { default as getElementsByTagName } from "shorter-js/src/misc/getElementsByTagName"; | ||
export { default as getElementsByClassName } from "shorter-js/src/misc/getElementsByClassName"; | ||
export { default as closest } from "shorter-js/src/selectors/closest"; | ||
export { default as querySelector } from "shorter-js/src/selectors/querySelector"; | ||
export { default as querySelectorAll } from "shorter-js/src/selectors/querySelectorAll"; | ||
export { default as getElementsByTagName } from "shorter-js/src/selectors/getElementsByTagName"; | ||
export { default as getElementsByClassName } from "shorter-js/src/selectors/getElementsByClassName"; | ||
export { default as Version } from "shorter-js/src/misc/version"; | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
291829
7438