shorter-js
Advanced tools
Comparing version 0.3.0-alpha10 to 0.3.0-alpha11
/*! | ||
* shorter-js v0.3.0alpha10 (https://github.com/thednp/shorter-js) | ||
* shorter-js v0.3.0alpha11 (https://github.com/thednp/shorter-js) | ||
* Copyright 2019-2022 © dnp_theme | ||
@@ -806,3 +806,3 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
* | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {HTMLElement | Element | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -820,3 +820,3 @@ * @param {EventListener} handler callback | ||
* | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {HTMLElement | Element | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -835,3 +835,3 @@ * @param {EventListener} handler callback | ||
* | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {HTMLElement | Element | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -905,3 +905,3 @@ * @param {EventListener} handler callback | ||
* Shortcut for `HTMLElement.getAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -913,3 +913,3 @@ */ | ||
* Shortcut for `SVGElement.getAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -922,3 +922,3 @@ * @param {string=} ns attribute namespace | ||
* Shortcut for `HTMLElement.hasAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -930,3 +930,3 @@ */ | ||
* Shortcut for `SVGElement.hasAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} att attribute name | ||
@@ -939,3 +939,3 @@ * @param {string=} ns attribute namespace | ||
* Shortcut for `HTMLElement.setAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -948,3 +948,3 @@ * @param {string} value attribute value | ||
* Shortcut for `SVGElement.setAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} att attribute name | ||
@@ -958,3 +958,3 @@ * @param {string} value attribute value | ||
* Shortcut for `HTMLElement.removeAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -966,3 +966,3 @@ */ | ||
* Shortcut for `HTMLElement.removeAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} att attribute name | ||
@@ -1033,3 +1033,3 @@ * @param {string=} ns attribute namespace | ||
* @see https://github.com/floating-ui/floating-ui | ||
* @param {(Node | SHORTER.ElementNodes | Window)=} node | ||
* @param {(Node | HTMLElement | Element | Window)=} node | ||
* @returns {Document} | ||
@@ -1059,5 +1059,5 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes | string} selector the input selector or target element | ||
* @param {SHORTER.ParentNodes=} parent optional node to look into | ||
* @return {SHORTER.ElementNodes?} the `HTMLElement` or `querySelector` result | ||
* @param {HTMLElement | Element | string} selector the input selector or target element | ||
* @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into | ||
* @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result | ||
*/ | ||
@@ -1076,3 +1076,3 @@ function querySelector(selector, parent) { | ||
/** @type {Map<string, Map<SHORTER.ElementNodes, SHORTER.Component>>} */ | ||
/** @type {Map<string, Map<HTMLElement | Element, Record<string, any>>>} */ | ||
const componentData = new Map(); | ||
@@ -1086,5 +1086,5 @@ /** | ||
* Sets web components data. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
* @param {SHORTER.Component} instance the component instance | ||
* @param {Record<string, any>} instance the component instance | ||
*/ | ||
@@ -1107,3 +1107,3 @@ set: (target, component, instance) => { | ||
* @param {string} component the component's name or a unique key | ||
* @returns {Map<SHORTER.ElementNodes, SHORTER.Component>?} all the component instances | ||
* @returns {Map<HTMLElement | Element, Record<string, any>>?} all the component instances | ||
*/ | ||
@@ -1118,5 +1118,5 @@ getAllFor: (component) => { | ||
* Returns the instance associated with the target. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
* @returns {SHORTER.Component?} the instance | ||
* @returns {Record<string, any>?} the instance | ||
*/ | ||
@@ -1133,3 +1133,3 @@ get: (target, component) => { | ||
* Removes web components data. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
@@ -1159,5 +1159,5 @@ */ | ||
* @see https://codeburst.io/javascript-array-distinct-5edc93501dc4 | ||
* @param {*} value | ||
* @param {any} value | ||
* @param {number} index | ||
* @param {*} self | ||
* @param {any} self | ||
* @returns {boolean} | ||
@@ -1174,3 +1174,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {string} property the css property | ||
@@ -1191,3 +1191,3 @@ * @return {string} the css property value | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1210,3 +1210,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1228,3 +1228,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {EventListener} handler `animationend` callback | ||
@@ -1263,3 +1263,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1281,3 +1281,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1299,3 +1299,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {EventListener} handler `animationend` callback | ||
@@ -1334,3 +1334,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1353,3 +1353,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1371,3 +1371,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {EventListener} handler `transitionend` callback | ||
@@ -1406,3 +1406,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1424,3 +1424,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1442,3 +1442,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {EventListener} handler `transitionend` callback | ||
@@ -1490,3 +1490,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element is the target | ||
* @param {HTMLElement | Element} element is the target | ||
*/ | ||
@@ -1539,3 +1539,3 @@ // @ts-ignore -- `Element`s resulted from querySelector can focus too | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {Record<string, any>} defaultOps component default options | ||
@@ -1606,3 +1606,3 @@ * @param {Record<string, any>} inputOps component instance options | ||
* | ||
* @param {SHORTER.ElementNodes} element is the target | ||
* @param {HTMLElement | Element} element is the target | ||
* @return {number} the `Element.offsetHeight` value | ||
@@ -1615,3 +1615,3 @@ */ | ||
* Shortcut for multiple uses of `HTMLElement.style.propertyName` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {Partial<CSSStyleDeclaration>} styles attribute value | ||
@@ -1622,3 +1622,3 @@ */ | ||
/** @type {Map<SHORTER.ElementNodes, any>} */ | ||
/** @type {Map<HTMLElement | Element, any>} */ | ||
const TimeCache = new Map(); | ||
@@ -1632,3 +1632,3 @@ /** | ||
* Sets a new timeout timer for an element, or element -> key association. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {ReturnType<TimerHandler>} callback the callback | ||
@@ -1656,3 +1656,3 @@ * @param {number} delay the execution delay | ||
* Returns the timer associated with the target. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string=} key a unique | ||
@@ -1682,3 +1682,3 @@ * @returns {ReturnType<TimerHandler>?} the timer | ||
* Clears the element's timer. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string=} key a unique key | ||
@@ -1721,3 +1721,3 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element event.target | ||
* @param {HTMLElement | Element} element event.target | ||
* @param {boolean=} includeScale when *true*, the target scale is also computed | ||
@@ -1754,3 +1754,3 @@ * @returns {SHORTER.BoundingClientRect} the bounding client rect object | ||
* | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @param {(Node | HTMLElement | Element)=} node | ||
* @returns {HTMLElement | HTMLBodyElement} | ||
@@ -1765,3 +1765,3 @@ */ | ||
* | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @param {(Node | HTMLElement | Element)=} node | ||
* @returns {HTMLElement | HTMLHtmlElement} | ||
@@ -1776,3 +1776,3 @@ */ | ||
* | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @param {(Node | HTMLElement | Element)=} node | ||
* @returns {HTMLElement | HTMLHeadElement} | ||
@@ -1790,3 +1790,3 @@ */ | ||
* | ||
* @param {HTMLElement | Window} element target node / element | ||
* @param {HTMLElement | Element | Window} element target node / element | ||
* @returns {{x: number, y: number}} the scroll tuple | ||
@@ -1806,3 +1806,3 @@ */ | ||
* | ||
* @param {(Node | SHORTER.ElementNodes | Window)=} node target node | ||
* @param {(Node | HTMLElement | Element | Window)=} node target node | ||
* @returns {globalThis} | ||
@@ -1839,4 +1839,4 @@ */ | ||
* | ||
* @param {Node | SHORTER.ElementNodes} node the target node | ||
* @returns {Node | SHORTER.ElementNodes} the apropriate parent node | ||
* @param {Node | HTMLElement | Element} node the target node | ||
* @returns {Node | HTMLElement | Element} the apropriate parent node | ||
*/ | ||
@@ -1876,4 +1876,4 @@ function getParentNode(node) { | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {SHORTER.ElementNodes | Window} offsetParent the container / offset parent | ||
* @param {HTMLElement | Element} element target | ||
* @param {HTMLElement | Element | Window} offsetParent the container / offset parent | ||
* @param {{x: number, y: number}} scroll | ||
@@ -1937,3 +1937,3 @@ * @returns {SHORTER.OffsetRect} | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {boolean} the query result | ||
@@ -1952,3 +1952,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {boolean} the query result | ||
@@ -1969,10 +1969,2 @@ */ | ||
/** | ||
* Checks if an element is an `HTMLElement`. | ||
* | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isHTMLElement = (element) => element instanceof HTMLElement; | ||
/** | ||
* Checks if an object is an `Array` in which all items are `Element`. | ||
@@ -1984,3 +1976,3 @@ * | ||
const isElementsArray = (object) => Array.isArray(object) | ||
&& object.every((el) => isHTMLElement(el)); | ||
&& object.every((el) => [HTMLElement, Element].some((x) => el instanceof x)); | ||
@@ -1996,2 +1988,10 @@ /** | ||
/** | ||
* Checks if an element is an `HTMLElement`. | ||
* | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isHTMLElement = (element) => element instanceof HTMLElement; | ||
/** | ||
* Check if a target element is an `<img>`. | ||
@@ -2025,3 +2025,3 @@ * @param {any} element the target element | ||
* Checks if a page is Right To Left. | ||
* @param {SHORTER.ElementNodes=} node the target | ||
* @param {(HTMLElement | Element)=} node the target | ||
* @returns {boolean} the query result | ||
@@ -2060,5 +2060,5 @@ */ | ||
* | ||
* @param {SHORTER.ElementNodes} element Element to look into | ||
* @param {HTMLElement | Element} element Element to look into | ||
* @param {string} selector the selector name | ||
* @return {SHORTER.ElementNodes?} the query result | ||
* @return {(HTMLElement | Element)?} the query result | ||
*/ | ||
@@ -2076,4 +2076,4 @@ function closest(element, selector) { | ||
* | ||
* @param {(SHORTER.ParentNodes)=} parent parent to look into | ||
* @returns {SHORTER.ElementNodes[]} the query result | ||
* @param {(HTMLElement | Element | Node | Document)=} parent parent to look into | ||
* @returns {(HTMLElement | Element)[]} the query result | ||
*/ | ||
@@ -2091,4 +2091,4 @@ function getCustomElements(parent) { | ||
* @param {string} selector the input selector | ||
* @param {(SHORTER.ParentNodes)=} parent optional node to look into | ||
* @return {NodeListOf<SHORTER.ElementNodes>} the query result | ||
* @param {(HTMLElement | Element | Document | Node)=} parent optional node to look into | ||
* @return {NodeListOf<HTMLElement | Element>} the query result | ||
*/ | ||
@@ -2107,4 +2107,4 @@ function querySelectorAll(selector, parent) { | ||
* @param {string} selector the tag name | ||
* @param {(SHORTER.ElementNodes | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<SHORTER.ElementNodes>} the 'HTMLCollection' | ||
* @param {(HTMLElement | Element | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection' | ||
*/ | ||
@@ -2122,4 +2122,4 @@ function getElementsByTagName(selector, parent) { | ||
* @param {string} selector the class name | ||
* @param {(SHORTER.ElementNodes | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<SHORTER.ElementNodes>} the 'HTMLCollection' | ||
* @param {(HTMLElement | Element | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection' | ||
*/ | ||
@@ -2132,3 +2132,3 @@ function getElementsByClassName(selector, parent) { | ||
var version = "0.3.0alpha10"; | ||
var version = "0.3.0alpha11"; | ||
@@ -2135,0 +2135,0 @@ // @ts-ignore |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.3.0alpha10 | 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",o="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",i="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",{userAgentData:u}=navigator,l=u,{userAgent:m}=navigator,d=m,g=/iPhone|iPad|iPod|Android/i;let f=!1;f=l?l.brands.some(e=>g.test(e.brand)):g.test(d);const E=f,y=/(iPhone|iPod|iPad)/,p=l?l.brands.some(e=>y.test(e.brand)):y.test(d),b=!!d&&d.includes("Firefox"),{head:v}=document,h="webkitPerspective"in v.style||"perspective"in v.style;function w(e,t,n,o){const i=o||!1;e.addEventListener(t,n,i)}function A(e,t,n,o){const i=o||!1;e.removeEventListener(t,n,i)}function k(e,t,n,o){w(e,t,(function i(a){a.target===e&&(n.apply(e,[a]),A(e,t,i,o))}),o)}const L=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});k(document,"DOMContentLoaded",()=>{},t)}catch(e){throw Error("Passive events are not supported")}return e})(),D="webkitTransform"in v.style||"transform"in v.style,N="ontouchstart"in window||"msMaxTouchPoints"in navigator,T="webkitAnimation"in v.style||"animation"in v.style,S="webkitTransition"in v.style||"transition"in v.style;function M(e){return e instanceof Window}const C=e=>e instanceof Node;function O(e){return C(e)?e.ownerDocument:M(e)?e.document:window.document}const z=[Document,Node,Element,HTMLElement],H=[Element,HTMLElement];function I(e,t){const n="string"==typeof e,o=t&&z.some(e=>t instanceof e)?t:O();return!n&&[...H].some(t=>e instanceof t)?e:n?o.querySelector(e):null}const P=new Map,x={set:(e,t,n)=>{const o=I(e);if(!o)return;P.has(t)||P.set(t,new Map);P.get(t).set(o,n)},getAllFor:e=>P.get(e)||null,get:(e,t)=>{const n=I(e),o=x.getAllFor(t);return n&&o&&o.get(n)||null},remove:(e,t)=>{const n=I(e),o=P.get(t);o&&n&&(o.delete(n),0===o.size&&P.delete(t))}};function F(e,t){const n=getComputedStyle(e);return t in n?n[t]:""}function B(e){const t=F(e,"animationName"),n=F(e,"animationDelay"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function R(e){const t=F(e,"animationName"),n=F(e,"animationDuration"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function W(e){const t=F(e,o),i=F(e,n),a=i.includes("ms")?1:1e3,r=T&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(r)?0:r}function Q(e){const n=F(e,o),i=F(e,t),a=i.includes("ms")?1:1e3,r=T&&n&&"none"!==n?parseFloat(i)*a:0;return Number.isNaN(r)?0:r}function V(e){const t=F(e,"transitionProperty"),n=F(e,"transitionDelay"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function j(e){const t=F(e,"transitionProperty"),n=F(e,"transitionDuration"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function q(e){const t=F(e,c),n=F(e,r),o=n.includes("ms")?1:1e3,i=S&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function U(e){const t=F(e,c),n=F(e,a),o=n.includes("ms")?1:1e3,i=S&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function G(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const K=e=>Object.keys(e);const X=(e,t)=>Object.assign(e,t),$=!!L&&{passive:!0},Y=new Map;function Z(e,t){const{width:n,height:o,top:i,right:a,bottom:r,left:s}=e.getBoundingClientRect();let c=1,u=1;if(t&&e instanceof HTMLElement){const{offsetWidth:t,offsetHeight:i}=e;c=t>0&&Math.round(n)/t||1,u=i>0&&Math.round(o)/i||1}return{width:n/c,height:o/u,top:i/u,right:a/c,bottom:r/u,left:s/c,x:s/c,y:i/u}}function J(e){return O(e).documentElement}function _(e){if(null==e)return window;if(!(e instanceof Window)){const{ownerDocument:t}=e;return t&&t.defaultView||window}return e}const ee=e=>e instanceof _(e).ShadowRoot||e instanceof ShadowRoot;function te(e){const{width:t,height:n}=Z(e),{offsetWidth:o,offsetHeight:i}=e;return Math.round(t)!==o||Math.round(n)!==i}const ne=e=>e&&!!e.shadowRoot,oe=e=>e instanceof HTMLElement;const ie={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:o,animationEndEvent:"animationend",animationEndEventLegacy:i,transitionDuration:"transitionDuration",transitionDurationLegacy:a,transitionDelay:"transitionDelay",transitionDelayLegacy:r,transitionEndEvent:"transitionend",transitionEndEventLegacy:s,transitionProperty:"transitionProperty",transitionPropertyLegacy:c,isMobile:E,isApple:p,isFirefox:b,support3DTransform:h,supportPassive:L,supportTransform:D,supportTouch:N,supportAnimation:T,supportTransition:S,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:l,userAgent:d,addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:w,off:A,one:k,distinct:(e,t,n)=>n.indexOf(e)===t,Data:x,Timer:{set:(e,t,n,o)=>{const i=I(e);if(i)if(o&&o.length){Y.has(i)||Y.set(i,new Map);Y.get(i).set(o,setTimeout(t,n))}else Y.set(i,setTimeout(t,n))},get:(e,t)=>{const n=I(e);if(!n)return null;if(t&&t.length){Y.has(n)||Y.set(n,new Map);const e=Y.get(n);if(e.has(t))return e.get(t)}else if(Y.has(n))return Y.get(n);return null},clear:(e,t)=>{const n=I(e),o=n&&Y.get(n);o&&(t&&t.length?o.has(t)&&(clearTimeout(o.get(t)),o.delete(t)):(clearTimeout(o),Y.delete(n)))}},getInstance:(e,t)=>x.get(e,t),emulateAnimationEnd:function(e,t){let n=0;const o=new Event("animationend"),i=R(e),a=B(e);if(i){const r=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener("animationend",r),n=1)};e.addEventListener("animationend",r),setTimeout(()=>{n||e.dispatchEvent(o)},i+a+17)}else t.apply(e,[o])},emulateAnimationEndLegacy:function(e,t){let n=0;const o=new Event(i),a=Q(e),r=W(e);if(T&&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 o=new Event("transitionend"),i=j(e),a=V(e);if(i){const r=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener("transitionend",r),n=1)};e.addEventListener("transitionend",r),setTimeout(()=>{n||e.dispatchEvent(o)},i+a+17)}else t.apply(e,[o])},emulateTransitionEndLegacy:function(e,t){let n=0;const o=new Event(s),i=U(e),a=q(e);if(S&&i){const r=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(s,r),n=1)};e.addEventListener(s,r),setTimeout(()=>{n||e.dispatchEvent(o)},i+a+17)}else t.apply(e,[o])},isElementInScrollRange:e=>{const{top:t,bottom:n}=Z(e),{clientHeight:o}=J(e);return t<=o&&n>=0},isElementInViewport:e=>{const{top:t,left:n,bottom:o,right:i}=Z(e,!0),{clientWidth:a,clientHeight:r}=J(e);return t>=0&&n>=0&&o<=r&&i<=a},passiveHandler:{passive:!0},passiveHandlerLegacy:$,getElementAnimationDuration:R,getElementAnimationDurationLegacy:Q,getElementAnimationDelay:B,getElementAnimationDelayLegacy:W,getElementTransitionDuration:j,getElementTransitionDurationLegacy:U,getElementTransitionDelay:V,getElementTransitionDelayLegacy:q,getNodeScroll:function(e){const t="scrollX"in e;return{x:t?e.scrollX:e.scrollLeft,y:t?e.scrollY:e.scrollTop}},getParentNode:function(e){return"HTML"===e.nodeName?e:e.assignedSlot||e.parentNode||(ee(e)?e.host:null)||J(e)},getRectRelativeToOffsetParent:function(e,t,n){const o=t instanceof HTMLElement,i=Z(e,o&&te(t)),a={x:0,y:0};if(o){const e=Z(t,!0);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}return{x:i.left+n.x-a.x,y:i.top+n.y-a.y,width:i.width,height:i.height}},getWindow:_,isArray:e=>Array.isArray(e),isString:e=>"string"==typeof e,isCustomElement:ne,isElement:e=>e instanceof Element,isNode:C,isHTMLElement:oe,isHTMLImageElement:e=>e instanceof HTMLImageElement,isSVGElement:e=>e instanceof SVGElement,isNodeList:e=>e instanceof NodeList,isHTMLCollection:e=>e instanceof HTMLCollection,isScaledElement:te,isTableElement:e=>["TABLE","TD","TH"].includes(e.tagName),isShadowRoot:ee,isDocument:e=>e instanceof Document,isElementsArray:e=>Array.isArray(e)&&e.every(e=>oe(e)),isWindow:M,isMedia:e=>e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(t=>e instanceof t),isRTL:e=>"rtl"===J(e).dir,elementNodes:H,parentNodes:z,closest:function e(t,n){return t&&t.closest(n)||e(t.getRootNode().host,n)},querySelector:I,getCustomElements:function(e){return[...(e&&z.some(t=>e instanceof t)?e:O()).querySelectorAll("*")].filter(ne)},querySelectorAll:function(e,t){return(t&&z.some(e=>t instanceof e)?t:O()).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&z.some(e=>t instanceof e)?t:O()).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&z.some(e=>t instanceof e)?t:O()).getElementsByTagName(e)},normalizeValue:G,normalizeOptions:function(e,t,n,o){const i={...e.dataset},a={},r={};return K(i).forEach(e=>{const t=o&&e.includes(o)?e.replace(o,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;r[t]=G(i[e])}),K(n).forEach(e=>{n[e]=G(n[e])}),K(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:X,ObjectKeys:K,ObjectValues:e=>Object.values(e),getBoundingClientRect:Z,getDocument:O,getDocumentBody:function(e){return O(e).body},getDocumentElement:J,getDocumentHead:function(e){return O(e).head},getElementStyle:F,setElementStyle:(e,t)=>{X(e.style,t)},hasAttribute:(e,t)=>e.hasAttribute(t),hasAttributeNS:(e,t,n)=>e.hasAttributeNS(n||null,t),getAttribute:(e,t)=>e.getAttribute(t),getAttributeNS:(e,t,n)=>e.getAttributeNS(n||null,t),setAttribute:(e,t,n)=>e.setAttribute(t,n),setAttributeNS:(e,t,n,o)=>e.setAttributeNS(o||null,t,n),removeAttribute:(e,t)=>e.removeAttribute(t),removeAttributeNS:(e,t,n)=>e.removeAttributeNS(n||null,t),Version:"0.3.0alpha10"};export{ie as default}; | ||
// shorter-js v0.3.0alpha11 | 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",o="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",i="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",{userAgentData:u}=navigator,l=u,{userAgent:m}=navigator,d=m,g=/iPhone|iPad|iPod|Android/i;let f=!1;f=l?l.brands.some(e=>g.test(e.brand)):g.test(d);const E=f,y=/(iPhone|iPod|iPad)/,p=l?l.brands.some(e=>y.test(e.brand)):y.test(d),b=!!d&&d.includes("Firefox"),{head:v}=document,h="webkitPerspective"in v.style||"perspective"in v.style;function w(e,t,n,o){const i=o||!1;e.addEventListener(t,n,i)}function A(e,t,n,o){const i=o||!1;e.removeEventListener(t,n,i)}function k(e,t,n,o){w(e,t,(function i(a){a.target===e&&(n.apply(e,[a]),A(e,t,i,o))}),o)}const L=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});k(document,"DOMContentLoaded",()=>{},t)}catch(e){throw Error("Passive events are not supported")}return e})(),D="webkitTransform"in v.style||"transform"in v.style,N="ontouchstart"in window||"msMaxTouchPoints"in navigator,T="webkitAnimation"in v.style||"animation"in v.style,S="webkitTransition"in v.style||"transition"in v.style;function M(e){return e instanceof Window}const C=e=>e instanceof Node;function O(e){return C(e)?e.ownerDocument:M(e)?e.document:window.document}const z=[Document,Node,Element,HTMLElement],H=[Element,HTMLElement];function I(e,t){const n="string"==typeof e,o=t&&z.some(e=>t instanceof e)?t:O();return!n&&[...H].some(t=>e instanceof t)?e:n?o.querySelector(e):null}const P=new Map,x={set:(e,t,n)=>{const o=I(e);if(!o)return;P.has(t)||P.set(t,new Map);P.get(t).set(o,n)},getAllFor:e=>P.get(e)||null,get:(e,t)=>{const n=I(e),o=x.getAllFor(t);return n&&o&&o.get(n)||null},remove:(e,t)=>{const n=I(e),o=P.get(t);o&&n&&(o.delete(n),0===o.size&&P.delete(t))}};function F(e,t){const n=getComputedStyle(e);return t in n?n[t]:""}function B(e){const t=F(e,"animationName"),n=F(e,"animationDelay"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function R(e){const t=F(e,"animationName"),n=F(e,"animationDuration"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function W(e){const t=F(e,o),i=F(e,n),a=i.includes("ms")?1:1e3,r=T&&t&&"none"!==t?parseFloat(i)*a:0;return Number.isNaN(r)?0:r}function Q(e){const n=F(e,o),i=F(e,t),a=i.includes("ms")?1:1e3,r=T&&n&&"none"!==n?parseFloat(i)*a:0;return Number.isNaN(r)?0:r}function V(e){const t=F(e,"transitionProperty"),n=F(e,"transitionDelay"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function j(e){const t=F(e,"transitionProperty"),n=F(e,"transitionDuration"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function q(e){const t=F(e,c),n=F(e,r),o=n.includes("ms")?1:1e3,i=S&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function U(e){const t=F(e,c),n=F(e,a),o=n.includes("ms")?1:1e3,i=S&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function G(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const K=e=>Object.keys(e);const X=(e,t)=>Object.assign(e,t),$=!!L&&{passive:!0},Y=new Map;function Z(e,t){const{width:n,height:o,top:i,right:a,bottom:r,left:s}=e.getBoundingClientRect();let c=1,u=1;if(t&&e instanceof HTMLElement){const{offsetWidth:t,offsetHeight:i}=e;c=t>0&&Math.round(n)/t||1,u=i>0&&Math.round(o)/i||1}return{width:n/c,height:o/u,top:i/u,right:a/c,bottom:r/u,left:s/c,x:s/c,y:i/u}}function J(e){return O(e).documentElement}function _(e){if(null==e)return window;if(!(e instanceof Window)){const{ownerDocument:t}=e;return t&&t.defaultView||window}return e}const ee=e=>e instanceof _(e).ShadowRoot||e instanceof ShadowRoot;function te(e){const{width:t,height:n}=Z(e),{offsetWidth:o,offsetHeight:i}=e;return Math.round(t)!==o||Math.round(n)!==i}const ne=e=>e&&!!e.shadowRoot;const oe={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:o,animationEndEvent:"animationend",animationEndEventLegacy:i,transitionDuration:"transitionDuration",transitionDurationLegacy:a,transitionDelay:"transitionDelay",transitionDelayLegacy:r,transitionEndEvent:"transitionend",transitionEndEventLegacy:s,transitionProperty:"transitionProperty",transitionPropertyLegacy:c,isMobile:E,isApple:p,isFirefox:b,support3DTransform:h,supportPassive:L,supportTransform:D,supportTouch:N,supportAnimation:T,supportTransition:S,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:l,userAgent:d,addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:w,off:A,one:k,distinct:(e,t,n)=>n.indexOf(e)===t,Data:x,Timer:{set:(e,t,n,o)=>{const i=I(e);if(i)if(o&&o.length){Y.has(i)||Y.set(i,new Map);Y.get(i).set(o,setTimeout(t,n))}else Y.set(i,setTimeout(t,n))},get:(e,t)=>{const n=I(e);if(!n)return null;if(t&&t.length){Y.has(n)||Y.set(n,new Map);const e=Y.get(n);if(e.has(t))return e.get(t)}else if(Y.has(n))return Y.get(n);return null},clear:(e,t)=>{const n=I(e),o=n&&Y.get(n);o&&(t&&t.length?o.has(t)&&(clearTimeout(o.get(t)),o.delete(t)):(clearTimeout(o),Y.delete(n)))}},getInstance:(e,t)=>x.get(e,t),emulateAnimationEnd:function(e,t){let n=0;const o=new Event("animationend"),i=R(e),a=B(e);if(i){const r=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener("animationend",r),n=1)};e.addEventListener("animationend",r),setTimeout(()=>{n||e.dispatchEvent(o)},i+a+17)}else t.apply(e,[o])},emulateAnimationEndLegacy:function(e,t){let n=0;const o=new Event(i),a=Q(e),r=W(e);if(T&&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 o=new Event("transitionend"),i=j(e),a=V(e);if(i){const r=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener("transitionend",r),n=1)};e.addEventListener("transitionend",r),setTimeout(()=>{n||e.dispatchEvent(o)},i+a+17)}else t.apply(e,[o])},emulateTransitionEndLegacy:function(e,t){let n=0;const o=new Event(s),i=U(e),a=q(e);if(S&&i){const r=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(s,r),n=1)};e.addEventListener(s,r),setTimeout(()=>{n||e.dispatchEvent(o)},i+a+17)}else t.apply(e,[o])},isElementInScrollRange:e=>{const{top:t,bottom:n}=Z(e),{clientHeight:o}=J(e);return t<=o&&n>=0},isElementInViewport:e=>{const{top:t,left:n,bottom:o,right:i}=Z(e,!0),{clientWidth:a,clientHeight:r}=J(e);return t>=0&&n>=0&&o<=r&&i<=a},passiveHandler:{passive:!0},passiveHandlerLegacy:$,getElementAnimationDuration:R,getElementAnimationDurationLegacy:Q,getElementAnimationDelay:B,getElementAnimationDelayLegacy:W,getElementTransitionDuration:j,getElementTransitionDurationLegacy:U,getElementTransitionDelay:V,getElementTransitionDelayLegacy:q,getNodeScroll:function(e){const t="scrollX"in e;return{x:t?e.scrollX:e.scrollLeft,y:t?e.scrollY:e.scrollTop}},getParentNode:function(e){return"HTML"===e.nodeName?e:e.assignedSlot||e.parentNode||(ee(e)?e.host:null)||J(e)},getRectRelativeToOffsetParent:function(e,t,n){const o=t instanceof HTMLElement,i=Z(e,o&&te(t)),a={x:0,y:0};if(o){const e=Z(t,!0);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}return{x:i.left+n.x-a.x,y:i.top+n.y-a.y,width:i.width,height:i.height}},getWindow:_,isArray:e=>Array.isArray(e),isString:e=>"string"==typeof e,isCustomElement:ne,isElement:e=>e instanceof Element,isNode:C,isHTMLElement:e=>e instanceof HTMLElement,isHTMLImageElement:e=>e instanceof HTMLImageElement,isSVGElement:e=>e instanceof SVGElement,isNodeList:e=>e instanceof NodeList,isHTMLCollection:e=>e instanceof HTMLCollection,isScaledElement:te,isTableElement:e=>["TABLE","TD","TH"].includes(e.tagName),isShadowRoot:ee,isDocument:e=>e instanceof Document,isElementsArray:e=>Array.isArray(e)&&e.every(e=>[HTMLElement,Element].some(t=>e instanceof t)),isWindow:M,isMedia:e=>e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(t=>e instanceof t),isRTL:e=>"rtl"===J(e).dir,elementNodes:H,parentNodes:z,closest:function e(t,n){return t&&t.closest(n)||e(t.getRootNode().host,n)},querySelector:I,getCustomElements:function(e){return[...(e&&z.some(t=>e instanceof t)?e:O()).querySelectorAll("*")].filter(ne)},querySelectorAll:function(e,t){return(t&&z.some(e=>t instanceof e)?t:O()).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&z.some(e=>t instanceof e)?t:O()).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&z.some(e=>t instanceof e)?t:O()).getElementsByTagName(e)},normalizeValue:G,normalizeOptions:function(e,t,n,o){const i={...e.dataset},a={},r={};return K(i).forEach(e=>{const t=o&&e.includes(o)?e.replace(o,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;r[t]=G(i[e])}),K(n).forEach(e=>{n[e]=G(n[e])}),K(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:X,ObjectKeys:K,ObjectValues:e=>Object.values(e),getBoundingClientRect:Z,getDocument:O,getDocumentBody:function(e){return O(e).body},getDocumentElement:J,getDocumentHead:function(e){return O(e).head},getElementStyle:F,setElementStyle:(e,t)=>{X(e.style,t)},hasAttribute:(e,t)=>e.hasAttribute(t),hasAttributeNS:(e,t,n)=>e.hasAttributeNS(n||null,t),getAttribute:(e,t)=>e.getAttribute(t),getAttributeNS:(e,t,n)=>e.getAttributeNS(n||null,t),setAttribute:(e,t,n)=>e.setAttribute(t,n),setAttributeNS:(e,t,n,o)=>e.setAttributeNS(o||null,t,n),removeAttribute:(e,t)=>e.removeAttribute(t),removeAttributeNS:(e,t,n)=>e.removeAttributeNS(n||null,t),Version:"0.3.0alpha11"};export{oe as default}; |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.3.0alpha10 | 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",o="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",r="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",s="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",c=navigator.userAgentData,l=navigator.userAgent,m=/iPhone|iPad|iPod|Android/i,d=c?c.brands.some((function(e){return m.test(e.brand)})):m.test(l),f=/(iPhone|iPod|iPad)/,v=c?c.brands.some((function(e){return f.test(e.brand)})):f.test(l),g=!!l&&l.includes("Firefox"),E=document.head,p="webkitPerspective"in E.style||"perspective"in E.style;function y(e,t,n,i){var o=i||!1;e.addEventListener(t,n,o)}function b(e,t,n,i){var o=i||!1;e.removeEventListener(t,n,o)}function h(e,t,n,i){y(e,t,(function o(r){r.target===e&&(n.apply(e,[r]),b(e,t,o,i))}),i)}var w=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});h(document,"DOMContentLoaded",(function(){}),t)}catch(e){throw Error("Passive events are not supported")}return e}(),A="webkitTransform"in E.style||"transform"in E.style,k="ontouchstart"in window||"msMaxTouchPoints"in navigator,L="webkitAnimation"in E.style||"animation"in E.style,D="webkitTransition"in E.style||"transition"in E.style;function T(e){return e instanceof Window}var N=function(e){return e instanceof Node};function S(e){return N(e)?e.ownerDocument:T(e)?e.document:window.document}var M=[Document,Node,Element,HTMLElement],C=[Element,HTMLElement];function O(e,t){var n="string"==typeof e,i=t&&M.some((function(e){return t instanceof e}))?t:S();return!n&&[].concat(C).some((function(t){return e instanceof t}))?e:n?i.querySelector(e):null}var z=new Map,H={set:function(e,t,n){var i=O(e);i&&(z.has(t)||z.set(t,new Map),z.get(t).set(i,n))},getAllFor:function(e){return z.get(e)||null},get:function(e,t){var n=O(e),i=H.getAllFor(t);return n&&i&&i.get(n)||null},remove:function(e,t){var n=O(e),i=z.get(t);i&&n&&(i.delete(n),0===i.size&&z.delete(t))}};function I(e,t){var n=getComputedStyle(e);return t in n?n[t]:""}function P(e){var t=I(e,"animationName"),n=I(e,"animationDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function x(e){var t=I(e,"animationName"),n=I(e,"animationDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function F(e){var t=I(e,i),o=I(e,n),r=o.includes("ms")?1:1e3,a=L&&t&&"none"!==t?parseFloat(o)*r:0;return Number.isNaN(a)?0:a}function B(e){var n=I(e,i),o=I(e,t),r=o.includes("ms")?1:1e3,a=L&&n&&"none"!==n?parseFloat(o)*r:0;return Number.isNaN(a)?0:a}function R(e){var t=I(e,"transitionProperty"),n=I(e,"transitionDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function W(e){var t=I(e,"transitionProperty"),n=I(e,"transitionDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function j(e){var t=I(e,s),n=I(e,a),i=n.includes("ms")?1:1e3,o=D&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function Q(e){var t=I(e,s),n=I(e,r),i=n.includes("ms")?1:1e3,o=D&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function V(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}var q=function(e){return Object.keys(e)};var U=function(e,t){return Object.assign(e,t)},G=!!w&&{passive:!0},K=new Map;function X(e,t){var n=e.getBoundingClientRect(),i=n.width,o=n.height,r=n.top,a=n.right,u=n.bottom,s=n.left,c=1,l=1;if(t&&e instanceof HTMLElement){var m=e.offsetWidth,d=e.offsetHeight;c=m>0&&Math.round(i)/m||1,l=d>0&&Math.round(o)/d||1}return{width:i/c,height:o/l,top:r/l,right:a/c,bottom:u/l,left:s/c,x:s/c,y:r/l}}function Y(e){return S(e).documentElement}function Z(e){if(null==e)return window;if(!(e instanceof Window)){var t=e.ownerDocument;return t&&t.defaultView||window}return e}var J=function(e){return e instanceof Z(e).ShadowRoot||e instanceof ShadowRoot};function $(e){var t=X(e),n=t.width,i=t.height,o=e.offsetWidth,r=e.offsetHeight;return Math.round(n)!==o||Math.round(i)!==r}var _=function(e){return e&&!!e.shadowRoot},ee=function(e){return e instanceof HTMLElement};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:o,transitionDuration:"transitionDuration",transitionDurationLegacy:r,transitionDelay:"transitionDelay",transitionDelayLegacy:a,transitionEndEvent:"transitionend",transitionEndEventLegacy:u,transitionProperty:"transitionProperty",transitionPropertyLegacy:s,isMobile:d,isApple:v,isFirefox:g,support3DTransform:p,supportPassive:w,supportTransform:A,supportTouch:k,supportAnimation:L,supportTransition:D,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:c,userAgent:l,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:y,off:b,one:h,distinct:function(e,t,n){return n.indexOf(e)===t},Data:H,Timer:{set:function(e,t,n,i){var o=O(e);o&&(i&&i.length?(K.has(o)||K.set(o,new Map),K.get(o).set(i,setTimeout(t,n))):K.set(o,setTimeout(t,n)))},get:function(e,t){var n=O(e);if(!n)return null;if(t&&t.length){K.has(n)||K.set(n,new Map);var i=K.get(n);if(i.has(t))return i.get(t)}else if(K.has(n))return K.get(n);return null},clear:function(e,t){var n=O(e),i=n&&K.get(n);i&&(t&&t.length?i.has(t)&&(clearTimeout(i.get(t)),i.delete(t)):(clearTimeout(i),K.delete(n)))}},getInstance:function(e,t){return H.get(e,t)},emulateAnimationEnd:function(e,t){var n=0,i=new Event("animationend"),o=x(e),r=P(e);if(o){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)}),o+r+17)}else t.apply(e,[i])},emulateAnimationEndLegacy:function(e,t){var n=0,i=new Event(o),r=B(e),a=F(e);if(L&&r){var u=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(o,u),n=1)};e.addEventListener(o,u),setTimeout((function(){n||e.dispatchEvent(i)}),r+a+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){var n=0,i=new Event("transitionend"),o=W(e),r=R(e);if(o){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)}),o+r+17)}else t.apply(e,[i])},emulateTransitionEndLegacy:function(e,t){var n=0,i=new Event(u),o=Q(e),r=j(e);if(D&&o){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(u,a),n=1)};e.addEventListener(u,a),setTimeout((function(){n||e.dispatchEvent(i)}),o+r+17)}else t.apply(e,[i])},isElementInScrollRange:function(e){var t=X(e),n=t.top,i=t.bottom;return n<=Y(e).clientHeight&&i>=0},isElementInViewport:function(e){var t=X(e,!0),n=t.top,i=t.left,o=t.bottom,r=t.right,a=Y(e),u=a.clientWidth,s=a.clientHeight;return n>=0&&i>=0&&o<=s&&r<=u},passiveHandler:{passive:!0},passiveHandlerLegacy:G,getElementAnimationDuration:x,getElementAnimationDurationLegacy:B,getElementAnimationDelay:P,getElementAnimationDelayLegacy:F,getElementTransitionDuration:W,getElementTransitionDurationLegacy:Q,getElementTransitionDelay:R,getElementTransitionDelayLegacy:j,getNodeScroll:function(e){var t="scrollX"in e;return{x:t?e.scrollX:e.scrollLeft,y:t?e.scrollY:e.scrollTop}},getParentNode:function(e){return"HTML"===e.nodeName?e:e.assignedSlot||e.parentNode||(J(e)?e.host:null)||Y(e)},getRectRelativeToOffsetParent:function(e,t,n){var i=t instanceof HTMLElement,o=X(e,i&&$(t)),r={x:0,y:0};if(i){var a=X(t,!0);r.x=a.x+t.clientLeft,r.y=a.y+t.clientTop}return{x:o.left+n.x-r.x,y:o.top+n.y-r.y,width:o.width,height:o.height}},getWindow:Z,isArray:function(e){return Array.isArray(e)},isString:function(e){return"string"==typeof e},isCustomElement:_,isElement:function(e){return e instanceof Element},isNode:N,isHTMLElement:ee,isHTMLImageElement:function(e){return e instanceof HTMLImageElement},isSVGElement:function(e){return e instanceof SVGElement},isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isScaledElement:$,isTableElement:function(e){return["TABLE","TD","TH"].includes(e.tagName)},isShadowRoot:J,isDocument:function(e){return e instanceof Document},isElementsArray:function(e){return Array.isArray(e)&&e.every((function(e){return ee(e)}))},isWindow:T,isMedia:function(e){return e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(t){return e instanceof t}))},isRTL:function(e){return"rtl"===Y(e).dir},elementNodes:C,parentNodes:M,closest:function e(t,n){return t&&t.closest(n)||e(t.getRootNode().host,n)},querySelector:O,getCustomElements:function(e){var t=e&&M.some((function(t){return e instanceof t}))?e:S();return[].concat(t.querySelectorAll("*")).filter(_)},querySelectorAll:function(e,t){return(t&&M.some((function(e){return t instanceof e}))?t:S()).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&M.some((function(e){return t instanceof e}))?t:S()).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&M.some((function(e){return t instanceof e}))?t:S()).getElementsByTagName(e)},normalizeValue:V,normalizeOptions:function(e,t,n,i){var o=Object.assign({},e.dataset),r={},a={};return q(o).forEach((function(e){var t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;a[t]=V(o[e])})),q(n).forEach((function(e){n[e]=V(n[e])})),q(t).forEach((function(e){r[e]=e in n?n[e]:e in a?a[e]:t[e]})),r},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(t+" "+e)}},reflow:function(e){return e.offsetHeight},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:U,ObjectKeys:q,ObjectValues:function(e){return Object.values(e)},getBoundingClientRect:X,getDocument:S,getDocumentBody:function(e){return S(e).body},getDocumentElement:Y,getDocumentHead:function(e){return S(e).head},getElementStyle:I,setElementStyle:function(e,t){U(e.style,t)},hasAttribute:function(e,t){return e.hasAttribute(t)},hasAttributeNS:function(e,t,n){return e.hasAttributeNS(n||null,t)},getAttribute:function(e,t){return e.getAttribute(t)},getAttributeNS:function(e,t,n){return e.getAttributeNS(n||null,t)},setAttribute:function(e,t,n){return e.setAttribute(t,n)},setAttributeNS:function(e,t,n,i){return e.setAttributeNS(i||null,t,n)},removeAttribute:function(e,t){return e.removeAttribute(t)},removeAttributeNS:function(e,t,n){return e.removeAttributeNS(n||null,t)},Version:"0.3.0alpha10"}})); | ||
// shorter-js v0.3.0alpha11 | 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",o="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",r="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",s="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",c=navigator.userAgentData,l=navigator.userAgent,m=/iPhone|iPad|iPod|Android/i,d=c?c.brands.some((function(e){return m.test(e.brand)})):m.test(l),f=/(iPhone|iPod|iPad)/,v=c?c.brands.some((function(e){return f.test(e.brand)})):f.test(l),g=!!l&&l.includes("Firefox"),E=document.head,p="webkitPerspective"in E.style||"perspective"in E.style;function y(e,t,n,i){var o=i||!1;e.addEventListener(t,n,o)}function b(e,t,n,i){var o=i||!1;e.removeEventListener(t,n,o)}function h(e,t,n,i){y(e,t,(function o(r){r.target===e&&(n.apply(e,[r]),b(e,t,o,i))}),i)}var w=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});h(document,"DOMContentLoaded",(function(){}),t)}catch(e){throw Error("Passive events are not supported")}return e}(),A="webkitTransform"in E.style||"transform"in E.style,k="ontouchstart"in window||"msMaxTouchPoints"in navigator,L="webkitAnimation"in E.style||"animation"in E.style,D="webkitTransition"in E.style||"transition"in E.style;function T(e){return e instanceof Window}var N=function(e){return e instanceof Node};function S(e){return N(e)?e.ownerDocument:T(e)?e.document:window.document}var M=[Document,Node,Element,HTMLElement],C=[Element,HTMLElement];function O(e,t){var n="string"==typeof e,i=t&&M.some((function(e){return t instanceof e}))?t:S();return!n&&[].concat(C).some((function(t){return e instanceof t}))?e:n?i.querySelector(e):null}var z=new Map,H={set:function(e,t,n){var i=O(e);i&&(z.has(t)||z.set(t,new Map),z.get(t).set(i,n))},getAllFor:function(e){return z.get(e)||null},get:function(e,t){var n=O(e),i=H.getAllFor(t);return n&&i&&i.get(n)||null},remove:function(e,t){var n=O(e),i=z.get(t);i&&n&&(i.delete(n),0===i.size&&z.delete(t))}};function I(e,t){var n=getComputedStyle(e);return t in n?n[t]:""}function P(e){var t=I(e,"animationName"),n=I(e,"animationDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function x(e){var t=I(e,"animationName"),n=I(e,"animationDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function F(e){var t=I(e,i),o=I(e,n),r=o.includes("ms")?1:1e3,a=L&&t&&"none"!==t?parseFloat(o)*r:0;return Number.isNaN(a)?0:a}function B(e){var n=I(e,i),o=I(e,t),r=o.includes("ms")?1:1e3,a=L&&n&&"none"!==n?parseFloat(o)*r:0;return Number.isNaN(a)?0:a}function R(e){var t=I(e,"transitionProperty"),n=I(e,"transitionDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function W(e){var t=I(e,"transitionProperty"),n=I(e,"transitionDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function j(e){var t=I(e,s),n=I(e,a),i=n.includes("ms")?1:1e3,o=D&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function Q(e){var t=I(e,s),n=I(e,r),i=n.includes("ms")?1:1e3,o=D&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function V(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}var q=function(e){return Object.keys(e)};var U=function(e,t){return Object.assign(e,t)},G=!!w&&{passive:!0},K=new Map;function X(e,t){var n=e.getBoundingClientRect(),i=n.width,o=n.height,r=n.top,a=n.right,u=n.bottom,s=n.left,c=1,l=1;if(t&&e instanceof HTMLElement){var m=e.offsetWidth,d=e.offsetHeight;c=m>0&&Math.round(i)/m||1,l=d>0&&Math.round(o)/d||1}return{width:i/c,height:o/l,top:r/l,right:a/c,bottom:u/l,left:s/c,x:s/c,y:r/l}}function Y(e){return S(e).documentElement}function Z(e){if(null==e)return window;if(!(e instanceof Window)){var t=e.ownerDocument;return t&&t.defaultView||window}return e}var J=function(e){return e instanceof Z(e).ShadowRoot||e instanceof ShadowRoot};function $(e){var t=X(e),n=t.width,i=t.height,o=e.offsetWidth,r=e.offsetHeight;return Math.round(n)!==o||Math.round(i)!==r}var _=function(e){return e&&!!e.shadowRoot};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:o,transitionDuration:"transitionDuration",transitionDurationLegacy:r,transitionDelay:"transitionDelay",transitionDelayLegacy:a,transitionEndEvent:"transitionend",transitionEndEventLegacy:u,transitionProperty:"transitionProperty",transitionPropertyLegacy:s,isMobile:d,isApple:v,isFirefox:g,support3DTransform:p,supportPassive:w,supportTransform:A,supportTouch:k,supportAnimation:L,supportTransition:D,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:c,userAgent:l,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:y,off:b,one:h,distinct:function(e,t,n){return n.indexOf(e)===t},Data:H,Timer:{set:function(e,t,n,i){var o=O(e);o&&(i&&i.length?(K.has(o)||K.set(o,new Map),K.get(o).set(i,setTimeout(t,n))):K.set(o,setTimeout(t,n)))},get:function(e,t){var n=O(e);if(!n)return null;if(t&&t.length){K.has(n)||K.set(n,new Map);var i=K.get(n);if(i.has(t))return i.get(t)}else if(K.has(n))return K.get(n);return null},clear:function(e,t){var n=O(e),i=n&&K.get(n);i&&(t&&t.length?i.has(t)&&(clearTimeout(i.get(t)),i.delete(t)):(clearTimeout(i),K.delete(n)))}},getInstance:function(e,t){return H.get(e,t)},emulateAnimationEnd:function(e,t){var n=0,i=new Event("animationend"),o=x(e),r=P(e);if(o){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)}),o+r+17)}else t.apply(e,[i])},emulateAnimationEndLegacy:function(e,t){var n=0,i=new Event(o),r=B(e),a=F(e);if(L&&r){var u=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(o,u),n=1)};e.addEventListener(o,u),setTimeout((function(){n||e.dispatchEvent(i)}),r+a+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){var n=0,i=new Event("transitionend"),o=W(e),r=R(e);if(o){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)}),o+r+17)}else t.apply(e,[i])},emulateTransitionEndLegacy:function(e,t){var n=0,i=new Event(u),o=Q(e),r=j(e);if(D&&o){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(u,a),n=1)};e.addEventListener(u,a),setTimeout((function(){n||e.dispatchEvent(i)}),o+r+17)}else t.apply(e,[i])},isElementInScrollRange:function(e){var t=X(e),n=t.top,i=t.bottom;return n<=Y(e).clientHeight&&i>=0},isElementInViewport:function(e){var t=X(e,!0),n=t.top,i=t.left,o=t.bottom,r=t.right,a=Y(e),u=a.clientWidth,s=a.clientHeight;return n>=0&&i>=0&&o<=s&&r<=u},passiveHandler:{passive:!0},passiveHandlerLegacy:G,getElementAnimationDuration:x,getElementAnimationDurationLegacy:B,getElementAnimationDelay:P,getElementAnimationDelayLegacy:F,getElementTransitionDuration:W,getElementTransitionDurationLegacy:Q,getElementTransitionDelay:R,getElementTransitionDelayLegacy:j,getNodeScroll:function(e){var t="scrollX"in e;return{x:t?e.scrollX:e.scrollLeft,y:t?e.scrollY:e.scrollTop}},getParentNode:function(e){return"HTML"===e.nodeName?e:e.assignedSlot||e.parentNode||(J(e)?e.host:null)||Y(e)},getRectRelativeToOffsetParent:function(e,t,n){var i=t instanceof HTMLElement,o=X(e,i&&$(t)),r={x:0,y:0};if(i){var a=X(t,!0);r.x=a.x+t.clientLeft,r.y=a.y+t.clientTop}return{x:o.left+n.x-r.x,y:o.top+n.y-r.y,width:o.width,height:o.height}},getWindow:Z,isArray:function(e){return Array.isArray(e)},isString:function(e){return"string"==typeof e},isCustomElement:_,isElement:function(e){return e instanceof Element},isNode:N,isHTMLElement:function(e){return e instanceof HTMLElement},isHTMLImageElement:function(e){return e instanceof HTMLImageElement},isSVGElement:function(e){return e instanceof SVGElement},isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isScaledElement:$,isTableElement:function(e){return["TABLE","TD","TH"].includes(e.tagName)},isShadowRoot:J,isDocument:function(e){return e instanceof Document},isElementsArray:function(e){return Array.isArray(e)&&e.every((function(e){return[HTMLElement,Element].some((function(t){return e instanceof t}))}))},isWindow:T,isMedia:function(e){return e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(t){return e instanceof t}))},isRTL:function(e){return"rtl"===Y(e).dir},elementNodes:C,parentNodes:M,closest:function e(t,n){return t&&t.closest(n)||e(t.getRootNode().host,n)},querySelector:O,getCustomElements:function(e){var t=e&&M.some((function(t){return e instanceof t}))?e:S();return[].concat(t.querySelectorAll("*")).filter(_)},querySelectorAll:function(e,t){return(t&&M.some((function(e){return t instanceof e}))?t:S()).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&M.some((function(e){return t instanceof e}))?t:S()).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&M.some((function(e){return t instanceof e}))?t:S()).getElementsByTagName(e)},normalizeValue:V,normalizeOptions:function(e,t,n,i){var o=Object.assign({},e.dataset),r={},a={};return q(o).forEach((function(e){var t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;a[t]=V(o[e])})),q(n).forEach((function(e){n[e]=V(n[e])})),q(t).forEach((function(e){r[e]=e in n?n[e]:e in a?a[e]:t[e]})),r},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(t+" "+e)}},reflow:function(e){return e.offsetHeight},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:U,ObjectKeys:q,ObjectValues:function(e){return Object.values(e)},getBoundingClientRect:X,getDocument:S,getDocumentBody:function(e){return S(e).body},getDocumentElement:Y,getDocumentHead:function(e){return S(e).head},getElementStyle:I,setElementStyle:function(e,t){U(e.style,t)},hasAttribute:function(e,t){return e.hasAttribute(t)},hasAttributeNS:function(e,t,n){return e.hasAttributeNS(n||null,t)},getAttribute:function(e,t){return e.getAttribute(t)},getAttributeNS:function(e,t,n){return e.getAttributeNS(n||null,t)},setAttribute:function(e,t,n){return e.setAttribute(t,n)},setAttributeNS:function(e,t,n,i){return e.setAttributeNS(i||null,t,n)},removeAttribute:function(e,t){return e.removeAttribute(t)},removeAttributeNS:function(e,t,n){return e.removeAttributeNS(n||null,t)},Version:"0.3.0alpha11"}})); |
{ | ||
"name": "shorter-js", | ||
"version": "0.3.0alpha10", | ||
"version": "0.3.0alpha11", | ||
"description": "A small ES6+ library with various JavaScript tools useful for creating light libraries.", | ||
@@ -5,0 +5,0 @@ "main": "dist/shorter-js.min.js", |
/** | ||
* Shortcut for `HTMLElement.getAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* Shortcut for `SVGElement.getAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -5,0 +5,0 @@ * @param {string=} ns attribute namespace |
/** | ||
* Shortcut for `HTMLElement.hasAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* Shortcut for `SVGElement.hasAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} att attribute name | ||
@@ -5,0 +5,0 @@ * @param {string=} ns attribute namespace |
/** | ||
* Shortcut for `HTMLElement.removeAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* Shortcut for `HTMLElement.removeAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} att attribute name | ||
@@ -5,0 +5,0 @@ * @param {string=} ns attribute namespace |
/** | ||
* Shortcut for `HTMLElement.setAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} attribute attribute name | ||
@@ -5,0 +5,0 @@ * @param {string} value attribute value |
/** | ||
* Shortcut for `SVGElement.setAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {string} att attribute name | ||
@@ -5,0 +5,0 @@ * @param {string} value attribute value |
/** | ||
* Remove eventListener from an `Element` | `HTMLElement` | `Document` target. | ||
* | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {HTMLElement | Element | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -6,0 +6,0 @@ * @param {EventListener} handler callback |
/** | ||
* Add eventListener to an `Element` | `HTMLElement` | `Document` target. | ||
* | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {HTMLElement | Element | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -6,0 +6,0 @@ * @param {EventListener} handler callback |
@@ -8,3 +8,3 @@ import on from './on'; | ||
* | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {HTMLElement | Element | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -11,0 +11,0 @@ * @param {EventListener} handler callback |
@@ -6,3 +6,3 @@ /** | ||
* | ||
* @param {SHORTER.ElementNodes} element event.target | ||
* @param {HTMLElement | Element} element event.target | ||
* @param {boolean=} includeScale when *true*, the target scale is also computed | ||
@@ -9,0 +9,0 @@ * @returns {SHORTER.BoundingClientRect} the bounding client rect object |
@@ -7,3 +7,3 @@ import isWindow from '../is/isWindow'; | ||
* @see https://github.com/floating-ui/floating-ui | ||
* @param {(Node | SHORTER.ElementNodes | Window)=} node | ||
* @param {(Node | HTMLElement | Element | Window)=} node | ||
* @returns {Document} | ||
@@ -10,0 +10,0 @@ */ |
@@ -5,3 +5,3 @@ import getDocument from './getDocument'; | ||
* | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @param {(Node | HTMLElement | Element)=} node | ||
* @returns {HTMLElement | HTMLBodyElement} | ||
@@ -8,0 +8,0 @@ */ |
@@ -6,3 +6,3 @@ import getDocument from './getDocument'; | ||
* | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @param {(Node | HTMLElement | Element)=} node | ||
* @returns {HTMLElement | HTMLHtmlElement} | ||
@@ -9,0 +9,0 @@ */ |
@@ -5,3 +5,3 @@ import getDocument from './getDocument'; | ||
* | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @param {(Node | HTMLElement | Element)=} node | ||
* @returns {HTMLElement | HTMLHeadElement} | ||
@@ -8,0 +8,0 @@ */ |
@@ -9,3 +9,3 @@ import animationDelay from '../strings/animationDelay'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -12,0 +12,0 @@ */ |
@@ -10,3 +10,3 @@ import supportAnimation from '../boolean/supportAnimation'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -13,0 +13,0 @@ */ |
@@ -9,3 +9,3 @@ import animationDuration from '../strings/animationDuration'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -12,0 +12,0 @@ */ |
@@ -10,3 +10,3 @@ import supportAnimation from '../boolean/supportAnimation'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -13,0 +13,0 @@ */ |
@@ -8,3 +8,3 @@ /** | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {string} property the css property | ||
@@ -11,0 +11,0 @@ * @return {string} the css property value |
@@ -9,3 +9,3 @@ import transitionDelay from '../strings/transitionDelay'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -12,0 +12,0 @@ */ |
@@ -10,3 +10,3 @@ import supportTransition from '../boolean/supportTransition'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -13,0 +13,0 @@ */ |
@@ -9,3 +9,3 @@ import transitionDuration from '../strings/transitionDuration'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -12,0 +12,0 @@ */ |
@@ -10,3 +10,3 @@ import supportTransition from '../boolean/supportTransition'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {number} the value in miliseconds | ||
@@ -13,0 +13,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
* | ||
* @param {HTMLElement | Window} element target node / element | ||
* @param {HTMLElement | Element | Window} element target node / element | ||
* @returns {{x: number, y: number}} the scroll tuple | ||
@@ -10,0 +10,0 @@ */ |
@@ -8,4 +8,4 @@ import getDocumentElement from './getDocumentElement'; | ||
* | ||
* @param {Node | SHORTER.ElementNodes} node the target node | ||
* @returns {Node | SHORTER.ElementNodes} the apropriate parent node | ||
* @param {Node | HTMLElement | Element} node the target node | ||
* @returns {Node | HTMLElement | Element} the apropriate parent node | ||
*/ | ||
@@ -12,0 +12,0 @@ export default function getParentNode(node) { |
@@ -8,4 +8,4 @@ import isScaledElement from '../is/isScaledElement'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {SHORTER.ElementNodes | Window} offsetParent the container / offset parent | ||
* @param {HTMLElement | Element} element target | ||
* @param {HTMLElement | Element | Window} offsetParent the container / offset parent | ||
* @param {{x: number, y: number}} scroll | ||
@@ -12,0 +12,0 @@ * @returns {SHORTER.OffsetRect} |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @param {(Node | SHORTER.ElementNodes | Window)=} node target node | ||
* @param {(Node | HTMLElement | Element | Window)=} node target node | ||
* @returns {globalThis} | ||
@@ -8,0 +8,0 @@ */ |
@@ -8,3 +8,3 @@ import getBoundingClientRect from '../get/getBoundingClientRect'; | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {boolean} the query result | ||
@@ -11,0 +11,0 @@ */ |
@@ -8,3 +8,3 @@ import getBoundingClientRect from '../get/getBoundingClientRect'; | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @return {boolean} the query result | ||
@@ -11,0 +11,0 @@ */ |
@@ -1,3 +0,1 @@ | ||
import isHTMLElement from './isHTMLElement'; | ||
/** | ||
@@ -10,4 +8,4 @@ * Checks if an object is an `Array` in which all items are `Element`. | ||
const isElementsArray = (object) => Array.isArray(object) | ||
&& object.every((el) => isHTMLElement(el)); | ||
&& object.every((el) => [HTMLElement, Element].some((x) => el instanceof x)); | ||
export default isElementsArray; |
@@ -5,3 +5,3 @@ import getDocumentElement from '../get/getDocumentElement'; | ||
* Checks if a page is Right To Left. | ||
* @param {SHORTER.ElementNodes=} node the target | ||
* @param {(HTMLElement | Element)=} node the target | ||
* @returns {boolean} the query result | ||
@@ -8,0 +8,0 @@ */ |
import querySelector from '../selectors/querySelector'; | ||
/** @type {Map<string, Map<SHORTER.ElementNodes, SHORTER.Component>>} */ | ||
/** @type {Map<string, Map<HTMLElement | Element, Record<string, any>>>} */ | ||
const componentData = new Map(); | ||
@@ -12,5 +12,5 @@ /** | ||
* Sets web components data. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
* @param {SHORTER.Component} instance the component instance | ||
* @param {Record<string, any>} instance the component instance | ||
*/ | ||
@@ -33,3 +33,3 @@ set: (target, component, instance) => { | ||
* @param {string} component the component's name or a unique key | ||
* @returns {Map<SHORTER.ElementNodes, SHORTER.Component>?} all the component instances | ||
* @returns {Map<HTMLElement | Element, Record<string, any>>?} all the component instances | ||
*/ | ||
@@ -44,5 +44,5 @@ getAllFor: (component) => { | ||
* Returns the instance associated with the target. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
* @returns {SHORTER.Component?} the instance | ||
* @returns {Record<string, any>?} the instance | ||
*/ | ||
@@ -59,3 +59,3 @@ get: (target, component) => { | ||
* Removes web components data. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
@@ -62,0 +62,0 @@ */ |
/** | ||
* JavaScript `Array` distinct. | ||
* @see https://codeburst.io/javascript-array-distinct-5edc93501dc4 | ||
* @param {*} value | ||
* @param {any} value | ||
* @param {number} index | ||
* @param {*} self | ||
* @param {any} self | ||
* @returns {boolean} | ||
@@ -8,0 +8,0 @@ */ |
@@ -9,3 +9,3 @@ import animationEndEvent from '../strings/animationEndEvent'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {EventListener} handler `animationend` callback | ||
@@ -12,0 +12,0 @@ */ |
@@ -10,3 +10,3 @@ import supportAnimation from '../boolean/supportAnimation'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {EventListener} handler `animationend` callback | ||
@@ -13,0 +13,0 @@ */ |
@@ -9,3 +9,3 @@ import transitionEndEvent from '../strings/transitionEndEvent'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {EventListener} handler `transitionend` callback | ||
@@ -12,0 +12,0 @@ */ |
@@ -10,3 +10,3 @@ import supportTransition from '../boolean/supportTransition'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {EventListener} handler `transitionend` callback | ||
@@ -13,0 +13,0 @@ */ |
/** | ||
* Utility to focus an `HTMLElement` target. | ||
* | ||
* @param {SHORTER.ElementNodes} element is the target | ||
* @param {HTMLElement | Element} element is the target | ||
*/ | ||
@@ -6,0 +6,0 @@ // @ts-ignore -- `Element`s resulted from querySelector can focus too |
@@ -7,3 +7,3 @@ import normalizeValue from './normalizeValue'; | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {Record<string, any>} defaultOps component default options | ||
@@ -10,0 +10,0 @@ * @param {Record<string, any>} inputOps component instance options |
/** | ||
* Utility to force re-paint of an `HTMLElement` target. | ||
* | ||
* @param {SHORTER.ElementNodes} element is the target | ||
* @param {HTMLElement | Element} element is the target | ||
* @return {number} the `Element.offsetHeight` value | ||
@@ -6,0 +6,0 @@ */ |
@@ -5,3 +5,3 @@ import ObjectAssign from './ObjectAssign'; | ||
* Shortcut for multiple uses of `HTMLElement.style.propertyName` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {HTMLElement | Element} element target element | ||
* @param {Partial<CSSStyleDeclaration>} styles attribute value | ||
@@ -8,0 +8,0 @@ */ |
import querySelector from '../selectors/querySelector'; | ||
/** @type {Map<SHORTER.ElementNodes, any>} */ | ||
/** @type {Map<HTMLElement | Element, any>} */ | ||
const TimeCache = new Map(); | ||
@@ -12,3 +12,3 @@ /** | ||
* Sets a new timeout timer for an element, or element -> key association. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {ReturnType<TimerHandler>} callback the callback | ||
@@ -36,3 +36,3 @@ * @param {number} delay the execution delay | ||
* Returns the timer associated with the target. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string=} key a unique | ||
@@ -62,3 +62,3 @@ * @returns {ReturnType<TimerHandler>?} the timer | ||
* Clears the element's timer. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {HTMLElement | Element | string} target target element | ||
* @param {string=} key a unique key | ||
@@ -65,0 +65,0 @@ */ |
@@ -8,5 +8,5 @@ /** | ||
* | ||
* @param {SHORTER.ElementNodes} element Element to look into | ||
* @param {HTMLElement | Element} element Element to look into | ||
* @param {string} selector the selector name | ||
* @return {SHORTER.ElementNodes?} the query result | ||
* @return {(HTMLElement | Element)?} the query result | ||
*/ | ||
@@ -13,0 +13,0 @@ export default function closest(element, selector) { |
@@ -10,4 +10,4 @@ import getDocument from '../get/getDocument'; | ||
* | ||
* @param {(SHORTER.ParentNodes)=} parent parent to look into | ||
* @returns {SHORTER.ElementNodes[]} the query result | ||
* @param {(HTMLElement | Element | Node | Document)=} parent parent to look into | ||
* @returns {(HTMLElement | Element)[]} the query result | ||
*/ | ||
@@ -14,0 +14,0 @@ export default function getCustomElements(parent) { |
@@ -9,4 +9,4 @@ import getDocument from '../get/getDocument'; | ||
* @param {string} selector the class name | ||
* @param {(SHORTER.ElementNodes | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<SHORTER.ElementNodes>} the 'HTMLCollection' | ||
* @param {(HTMLElement | Element | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection' | ||
*/ | ||
@@ -13,0 +13,0 @@ export default function getElementsByClassName(selector, parent) { |
@@ -9,4 +9,4 @@ import getDocument from '../get/getDocument'; | ||
* @param {string} selector the tag name | ||
* @param {(SHORTER.ElementNodes | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<SHORTER.ElementNodes>} the 'HTMLCollection' | ||
* @param {(HTMLElement | Element | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection' | ||
*/ | ||
@@ -13,0 +13,0 @@ export default function getElementsByTagName(selector, parent) { |
@@ -9,5 +9,5 @@ import getDocument from '../get/getDocument'; | ||
* | ||
* @param {SHORTER.ElementNodes | string} selector the input selector or target element | ||
* @param {SHORTER.ParentNodes=} parent optional node to look into | ||
* @return {SHORTER.ElementNodes?} the `HTMLElement` or `querySelector` result | ||
* @param {HTMLElement | Element | string} selector the input selector or target element | ||
* @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into | ||
* @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result | ||
*/ | ||
@@ -14,0 +14,0 @@ export default function querySelector(selector, parent) { |
@@ -8,4 +8,4 @@ import getDocument from '../get/getDocument'; | ||
* @param {string} selector the input selector | ||
* @param {(SHORTER.ParentNodes)=} parent optional node to look into | ||
* @return {NodeListOf<SHORTER.ElementNodes>} the query result | ||
* @param {(HTMLElement | Element | Document | Node)=} parent optional node to look into | ||
* @return {NodeListOf<HTMLElement | Element>} the query result | ||
*/ | ||
@@ -12,0 +12,0 @@ export default function querySelectorAll(selector, parent) { |
@@ -121,2 +121,4 @@ export as namespace SHORTER; | ||
export { default as supportTransition } from 'shorter-js/src/boolean/supportTransition'; | ||
export { default as hasAttribute } from 'shorter-js/src/attr/hasAttribute'; | ||
export { default as hasAttributeNS } from 'shorter-js/src/attr/hasAttributeNS'; | ||
export { default as getAttribute } from 'shorter-js/src/attr/getAttribute'; | ||
@@ -203,3 +205,3 @@ export { default as getAttributeNS } from 'shorter-js/src/attr/getAttributeNS'; | ||
export type Component = Record<string, any>; | ||
export type getInstance<T> = (target: ElementNodes | string, component: string) => T | null; | ||
export type getInstance<T> = (target: HTMLElement | Element | string, component: string) => T | null; | ||
@@ -225,2 +227,2 @@ export interface BoundingClientRect { | ||
export type ElementNodes = HTMLElement | Element; | ||
export type ParentNodes = Document | ElementNodes | Node; // ShadowRoot is a Node too | ||
export type ParentNodes = Document | HTMLElement | Element | Node; // ShadowRoot is a Node too |
@@ -136,2 +136,4 @@ // strings | ||
// attributes | ||
export { default as hasAttribute } from '../../src/attr/hasAttribute'; | ||
export { default as hasAttributeNS } from '../../src/attr/hasAttributeNS'; | ||
export { default as getAttribute } from '../../src/attr/getAttribute'; | ||
@@ -138,0 +140,0 @@ export { default as getAttributeNS } from '../../src/attr/getAttributeNS'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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
362568
9129