shorter-js
Advanced tools
Comparing version 0.3.0-alpha1 to 0.3.0-alpha10
/*! | ||
* shorter-js v0.3.0alpha1 (https://github.com/thednp/shorter-js) | ||
* shorter-js v0.3.0alpha10 (https://github.com/thednp/shorter-js) | ||
* Copyright 2019-2022 © dnp_theme | ||
@@ -660,3 +660,6 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
/** | ||
* A global namespace for 'transitionProperty' string. | ||
* A global namespace for: | ||
* * `transitionProperty` string for Firefox, | ||
* * `transition` property for all other browsers. | ||
* | ||
* @type {string} | ||
@@ -667,3 +670,6 @@ */ | ||
/** | ||
* A global namespace for 'transitionProperty' string. | ||
* A global namespace for: | ||
* * `transitionProperty` string for Firefox, | ||
* * `webkitTransition` for older Chrome / Safari browsers, | ||
* * `transition` property for all other browsers. | ||
* @type {string} | ||
@@ -742,21 +748,29 @@ */ | ||
// @ts-ignore | ||
const { userAgentData: userAgentDATA } = navigator; | ||
/** | ||
* A global namespace for `userAgentData` event. | ||
* @type {string} | ||
*/ | ||
const userAgentData = 'userAgentData'; | ||
const userAgentData = userAgentDATA; | ||
const { userAgent: userAgentString } = navigator; | ||
/** | ||
* A global namespace for `navigator.userAgent` string. | ||
*/ | ||
const userAgent = userAgentString; | ||
const mobileBrands = /iPhone|iPad|iPod|Android/i; | ||
let isMobileCheck = false; | ||
// @ts-ignore | ||
if (navigator[userAgentData]) { | ||
// @ts-ignore | ||
isMobileCheck = navigator[userAgentData].brands.some((x) => mobileBrands.test(x.brand)); | ||
if (userAgentData) { | ||
isMobileCheck = userAgentData.brands | ||
.some((/** @type {Record<String, any>} */x) => mobileBrands.test(x.brand)); | ||
} else { | ||
isMobileCheck = mobileBrands.test(navigator.userAgent); | ||
isMobileCheck = mobileBrands.test(userAgent); | ||
} | ||
/** | ||
* A global namespace for mobile detection. | ||
* A global `boolean` for mobile detection. | ||
* @type {boolean} | ||
@@ -766,24 +780,32 @@ */ | ||
/** @type {Record<string, any>} */ | ||
// @ts-ignore | ||
const agentData = navigator[userAgentData]; | ||
const appleBrands = /(iPhone|iPod|iPad)/; | ||
/** | ||
* A global boolean for Apple browsers. | ||
* A global `boolean` for Apple browsers. | ||
* @type {boolean} | ||
*/ | ||
const isApple = !agentData ? appleBrands.test(navigator.userAgent) | ||
: agentData.brands.some((/** @type {Record<string, any>} */x) => appleBrands.test(x.brand)); | ||
const isApple = !userAgentData ? appleBrands.test(userAgent) | ||
: userAgentData.brands.some((/** @type {Record<string, any>} */x) => appleBrands.test(x.brand)); | ||
/** | ||
* A global boolean for Gecko browsers. When writing this file, | ||
* Gecko was not supporting `userAgentData`. | ||
*/ | ||
const isFirefox = userAgent ? userAgent.includes('Firefox') : false; | ||
/** | ||
* A global namespace for `document.head`. | ||
*/ | ||
const { head: documentHead } = document; | ||
/** | ||
* A global `boolean` for CSS3 3D transform support. | ||
* @type {boolean} | ||
*/ | ||
const support3DTransform = 'webkitPerspective' in document.head.style || 'perspective' in document.head.style; | ||
const support3DTransform = 'webkitPerspective' in documentHead.style || 'perspective' in documentHead.style; | ||
/** | ||
* Add eventListener to an `HTMLElement` | `Document` target. | ||
* Add eventListener to an `Element` | `HTMLElement` | `Document` target. | ||
* | ||
* @param {HTMLElement | Document} element event.target | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -799,5 +821,5 @@ * @param {EventListener} handler callback | ||
/** | ||
* Remove eventListener from an `HTMLElement` | `Document` target. | ||
* Remove eventListener from an `Element` | `HTMLElement` | `Document` target. | ||
* | ||
* @param {HTMLElement | Document} element event.target | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -813,6 +835,6 @@ * @param {EventListener} handler callback | ||
/** | ||
* Add an `eventListener` to an `HTMLElement` | `Document` target | ||
* Add an `eventListener` to an `Element` | `HTMLElement` | `Document` target | ||
* and remove it once callback is called. | ||
* | ||
* @param {HTMLElement | Document} element event.target | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -837,3 +859,6 @@ * @param {EventListener} handler callback | ||
/** | ||
* A global namespace for passive events support. | ||
* A global `boolean` for passive events support, | ||
* in general event options are not suited for scroll prevention. | ||
* | ||
* @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection | ||
* @type {boolean} | ||
@@ -859,9 +884,9 @@ */ | ||
/** | ||
* A global namespace for CSS3 transform support. | ||
* A global `boolean` for CSS3 transform support. | ||
* @type {boolean} | ||
*/ | ||
const supportTransform = 'webkitTransform' in document.head.style || 'transform' in document.head.style; | ||
const supportTransform = 'webkitTransform' in documentHead.style || 'transform' in documentHead.style; | ||
/** | ||
* A global namespace for touch events support. | ||
* A global `boolean` for touch events support. | ||
* @type {boolean} | ||
@@ -875,14 +900,76 @@ */ | ||
*/ | ||
const supportAnimation = 'webkitAnimation' in document.head.style || 'animation' in document.head.style; | ||
const supportAnimation = 'webkitAnimation' in documentHead.style || 'animation' in documentHead.style; | ||
/** | ||
* A global namespace for CSS3 transition support. | ||
* A global `boolean` for CSS3 transition support. | ||
* @type {boolean} | ||
*/ | ||
const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; | ||
const supportTransition = 'webkitTransition' in documentHead.style || 'transition' in documentHead.style; | ||
/** | ||
* Shortcut for `HTMLElement.getAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {string} attribute attribute name | ||
*/ | ||
const getAttribute = (element, attribute) => element.getAttribute(attribute); | ||
/** | ||
* Shortcut for `SVGElement.getAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {string} attribute attribute name | ||
* @param {string=} ns attribute namespace | ||
*/ | ||
const getAttributeNS = (element, attribute, ns) => element.getAttributeNS(ns || null, attribute); | ||
/** | ||
* Shortcut for `HTMLElement.hasAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {string} attribute attribute name | ||
*/ | ||
const hasAttribute = (element, attribute) => element.hasAttribute(attribute); | ||
/** | ||
* Shortcut for `SVGElement.hasAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {string} att attribute name | ||
* @param {string=} ns attribute namespace | ||
*/ | ||
const hasAttributeNS = (element, att, ns) => element.hasAttributeNS(ns || null, att); | ||
/** | ||
* Shortcut for `HTMLElement.setAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {string} attribute attribute name | ||
* @param {string} value attribute value | ||
*/ | ||
const setAttribute = (element, attribute, value) => element.setAttribute(attribute, value); | ||
/** | ||
* Shortcut for `SVGElement.setAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {string} att attribute name | ||
* @param {string} value attribute value | ||
* @param {string=} ns attribute namespace | ||
*/ | ||
const setAttributeNS = (element, att, value, ns) => element.setAttributeNS(ns || null, att, value); | ||
/** | ||
* Shortcut for `HTMLElement.removeAttribute()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {string} attribute attribute name | ||
*/ | ||
const removeAttribute = (element, attribute) => element.removeAttribute(attribute); | ||
/** | ||
* Shortcut for `HTMLElement.removeAttributeNS()` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {string} att attribute name | ||
* @param {string=} ns attribute namespace | ||
*/ | ||
const removeAttributeNS = (element, att, ns) => element.removeAttributeNS(ns || null, att); | ||
/** | ||
* Add class to `HTMLElement.classList`. | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {string} classNAME to add | ||
@@ -897,3 +984,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {string} classNAME to remove | ||
@@ -908,3 +995,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {string} classNAME to check | ||
@@ -918,101 +1005,72 @@ * @return {boolean} | ||
/** | ||
* Checks if an element is an `HTMLElement`. | ||
* Shortcut for `Array.from()` static method. | ||
* | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
* @param {any[] | HTMLCollection | NodeList | Map<any, any>} arr array-like iterable object | ||
* @returns {Array<any>} | ||
*/ | ||
const isHTMLElement = (element) => element && element instanceof HTMLElement; | ||
const ArrayFrom = (arr) => Array.from(arr); | ||
/** | ||
* Utility to check if target is typeof `HTMLElement` | ||
* or find one that matches a selector. | ||
* Check if a target node is `window`. | ||
* | ||
* @param {HTMLElement | string} selector the input selector or target element | ||
* @param {HTMLElement=} parent optional `HTMLElement` to look into | ||
* @return {HTMLElement?} the `HTMLElement` or `querySelector` result | ||
* @param {any} node the target node | ||
* @returns {boolean} the query result | ||
*/ | ||
function querySelector(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
return typeof selector === 'object' ? selector : lookUp.querySelector(selector); | ||
function isWindow(node) { | ||
return node instanceof Window; | ||
} | ||
/** @type {Map<HTMLElement, any>} */ | ||
const TimeCache = new Map(); | ||
/** | ||
* An interface for one or more `TimerHandler`s per `Element`. | ||
* @see https://github.com/thednp/navbar.js/ | ||
* Checks if an object is a `Node`. | ||
* | ||
* @param {any} node the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const Timer = { | ||
/** | ||
* Sets a new timeout timer for an element, or element -> key association. | ||
* @param {HTMLElement | string} target target element | ||
* @param {ReturnType<TimerHandler>} callback the callback | ||
* @param {number} delay the execution delay | ||
* @param {string=} key a unique | ||
*/ | ||
set: (target, callback, delay, key) => { | ||
const element = querySelector(target); | ||
const isNode = (node) => node instanceof Node; | ||
if (!element) return; | ||
/** | ||
* Returns the `document` or the `#document` element. | ||
* @see https://github.com/floating-ui/floating-ui | ||
* @param {(Node | SHORTER.ElementNodes | Window)=} node | ||
* @returns {Document} | ||
*/ | ||
function getDocument(node) { | ||
// @ts-ignore -- `isNode` checks that | ||
if (isNode(node)) return node.ownerDocument; | ||
// @ts-ignore -- `isWindow` checks that too | ||
if (isWindow(node)) return node.document; | ||
return window.document; | ||
} | ||
if (key && key.length) { | ||
if (!TimeCache.has(element)) { | ||
TimeCache.set(element, new Map()); | ||
} | ||
const keyTimers = TimeCache.get(element); | ||
keyTimers.set(key, setTimeout(callback, delay)); | ||
} else { | ||
TimeCache.set(element, setTimeout(callback, delay)); | ||
} | ||
}, | ||
/** | ||
* A global array of possible `ParentNode`. | ||
*/ | ||
const parentNodes = [Document, Node, Element, HTMLElement]; | ||
/** | ||
* Returns the timer associated with the target. | ||
* @param {HTMLElement | string} target target element | ||
* @param {string=} key a unique | ||
* @returns {ReturnType<TimerHandler>?} the timer | ||
*/ | ||
get: (target, key) => { | ||
const element = querySelector(target); | ||
/** | ||
* A global array with `Element` | `HTMLElement`. | ||
*/ | ||
const elementNodes = [Element, HTMLElement]; | ||
if (!element) return null; | ||
/** | ||
* Utility to check if target is typeof `HTMLElement`, `Element`, `Node` | ||
* or find one that matches a selector. | ||
* | ||
* @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 | ||
*/ | ||
function querySelector(selector, parent) { | ||
const selectorIsString = typeof selector === 'string'; | ||
const lookUp = parent && parentNodes.some((x) => parent instanceof x) | ||
? parent : getDocument(); | ||
if (key && key.length) { | ||
if (!TimeCache.has(element)) { | ||
TimeCache.set(element, new Map()); | ||
} | ||
const keyTimers = TimeCache.get(element); | ||
if (keyTimers.has(key)) { | ||
return keyTimers.get(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
return TimeCache.get(element); | ||
} | ||
return null; | ||
}, | ||
if (!selectorIsString && [...elementNodes].some((x) => selector instanceof x)) { | ||
return selector; | ||
} | ||
// @ts-ignore -- `ShadowRoot` is also a node | ||
return selectorIsString ? lookUp.querySelector(selector) : null; | ||
} | ||
/** | ||
* Clears the element's timer. | ||
* @param {HTMLElement} target target element | ||
* @param {string=} key a unique | ||
*/ | ||
clear: (target, key) => { | ||
const element = querySelector(target); | ||
const timers = element && TimeCache.get(element); | ||
if (!timers) return; | ||
if (key && key.length) { | ||
if (timers.has(key)) { | ||
clearTimeout(timers.get(key)); | ||
timers.delete(key); | ||
} | ||
} else { | ||
clearTimeout(timers); | ||
TimeCache.delete(element); | ||
} | ||
}, | ||
}; | ||
/** @type {Map<string, Map<HTMLElement, SHORTER.Component>>} */ | ||
/** @type {Map<string, Map<SHORTER.ElementNodes, SHORTER.Component>>} */ | ||
const componentData = new Map(); | ||
@@ -1026,3 +1084,3 @@ /** | ||
* Sets web components data. | ||
* @param {HTMLElement | string} target target element | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
@@ -1047,3 +1105,3 @@ * @param {SHORTER.Component} instance the component instance | ||
* @param {string} component the component's name or a unique key | ||
* @returns {Map<HTMLElement, SHORTER.Component> | null} all the component instances | ||
* @returns {Map<SHORTER.ElementNodes, SHORTER.Component>?} all the component instances | ||
*/ | ||
@@ -1053,4 +1111,3 @@ getAllFor: (component) => { | ||
if (instanceMap) return instanceMap; | ||
return null; | ||
return instanceMap || null; | ||
}, | ||
@@ -1060,5 +1117,5 @@ | ||
* Returns the instance associated with the target. | ||
* @param {HTMLElement | string} target target element | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
* @returns {SHORTER.Component | null} the instance | ||
* @returns {SHORTER.Component?} the instance | ||
*/ | ||
@@ -1070,4 +1127,3 @@ get: (target, component) => { | ||
if (instance) return instance; | ||
return null; | ||
return instance || null; | ||
}, | ||
@@ -1077,3 +1133,3 @@ | ||
* Removes web components data. | ||
* @param {HTMLElement | string} target target element | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
@@ -1101,2 +1157,12 @@ */ | ||
/** | ||
* JavaScript `Array` distinct. | ||
* @see https://codeburst.io/javascript-array-distinct-5edc93501dc4 | ||
* @param {*} value | ||
* @param {number} index | ||
* @param {*} self | ||
* @returns {boolean} | ||
*/ | ||
const distinct = (value, index, self) => self.indexOf(value) === index; | ||
/** | ||
* Shortcut for `window.getComputedStyle(element).propertyName` | ||
@@ -1108,4 +1174,4 @@ * static method. | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {string=} property the css property | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {string} property the css property | ||
* @return {string} the css property value | ||
@@ -1116,5 +1182,5 @@ */ | ||
return property && property in computedStyle | ||
? computedStyle.getPropertyValue(property) | ||
: ''; | ||
// @ts-ignore -- must use camelcase strings, | ||
// or non-camelcase strings with `getPropertyValue` | ||
return property in computedStyle ? computedStyle[property] : ''; | ||
} | ||
@@ -1126,3 +1192,3 @@ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1145,3 +1211,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1163,3 +1229,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {EventListener} handler `animationend` callback | ||
@@ -1198,3 +1264,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1216,3 +1282,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1234,3 +1300,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {EventListener} handler `animationend` callback | ||
@@ -1269,3 +1335,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1288,3 +1354,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1306,3 +1372,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {EventListener} handler `transitionend` callback | ||
@@ -1341,3 +1407,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1359,3 +1425,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @return {number} the value in miliseconds | ||
@@ -1377,3 +1443,3 @@ */ | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {EventListener} handler `transitionend` callback | ||
@@ -1408,10 +1474,25 @@ */ | ||
// general event options | ||
/** | ||
* Shortcut for `Float32Array.from()` static method. | ||
* @param {any[] | HTMLCollection | NodeList} arr array-like iterable object | ||
* @returns {Float32Array} | ||
*/ | ||
const Float32ArrayFrom = (arr) => Float32Array.from(Array.from(arr)); | ||
/** | ||
* A global namespace for most scroll event listeners. | ||
* Shortcut for `Float64Array.from()` static method. | ||
* @param {any[] | HTMLCollection | NodeList} arr array-like iterable object | ||
* @returns {Float64Array} | ||
*/ | ||
const passiveHandler = supportPassive ? { passive: true } : false; | ||
const Float64ArrayFrom = (arr) => Float64Array.from(Array.from(arr)); | ||
/** | ||
* Utility to focus an `HTMLElement` target. | ||
* | ||
* @param {SHORTER.ElementNodes} element is the target | ||
*/ | ||
// @ts-ignore -- `Element`s resulted from querySelector can focus too | ||
const focus = (element) => element.focus(); | ||
/** | ||
* The raw value or a given component option. | ||
@@ -1457,5 +1538,5 @@ * | ||
/** | ||
* Utility to normalize component options | ||
* Utility to normalize component options. | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {Record<string, any>} defaultOps component default options | ||
@@ -1467,2 +1548,3 @@ * @param {Record<string, any>} inputOps component instance options | ||
function normalizeOptions(element, defaultOps, inputOps, ns) { | ||
// @ts-ignore -- our targets are always `HTMLElement` | ||
const data = { ...element.dataset }; | ||
@@ -1500,2 +1582,121 @@ /** @type {Record<string, any>} */ | ||
/** | ||
* Shortcut for `Object.assign()` static method. | ||
* @param {Record<string, any>} obj a target object | ||
* @param {Record<string, any>} source a source object | ||
*/ | ||
const ObjectAssign = (obj, source) => Object.assign(obj, source); | ||
/** | ||
* Shortcut for `Object.values()` static method. | ||
* @param {Record<string, any>} obj a target object | ||
* @returns {any[]} | ||
*/ | ||
const ObjectValues = (obj) => Object.values(obj); | ||
/** | ||
* A global namespace for most scroll event listeners. | ||
*/ | ||
const passiveHandler$1 = { passive: true }; | ||
/** | ||
* A global namespace for most scroll event listeners in legacy browsers. | ||
*/ | ||
const passiveHandler = supportPassive ? { passive: true } : false; | ||
/** | ||
* Utility to force re-paint of an `HTMLElement` target. | ||
* | ||
* @param {SHORTER.ElementNodes} element is the target | ||
* @return {number} the `Element.offsetHeight` value | ||
*/ | ||
// @ts-ignore | ||
const reflow = (element) => element.offsetHeight; | ||
/** | ||
* Shortcut for multiple uses of `HTMLElement.style.propertyName` method. | ||
* @param {SHORTER.ElementNodes} element target element | ||
* @param {Partial<CSSStyleDeclaration>} styles attribute value | ||
*/ | ||
// @ts-ignore | ||
const setElementStyle = (element, styles) => { ObjectAssign(element.style, styles); }; | ||
/** @type {Map<SHORTER.ElementNodes, any>} */ | ||
const TimeCache = new Map(); | ||
/** | ||
* An interface for one or more `TimerHandler`s per `Element`. | ||
* @see https://github.com/thednp/navbar.js/ | ||
*/ | ||
const Timer = { | ||
/** | ||
* Sets a new timeout timer for an element, or element -> key association. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {ReturnType<TimerHandler>} callback the callback | ||
* @param {number} delay the execution delay | ||
* @param {string=} key a unique | ||
*/ | ||
set: (target, callback, delay, key) => { | ||
const element = querySelector(target); | ||
if (!element) return; | ||
if (key && key.length) { | ||
if (!TimeCache.has(element)) { | ||
TimeCache.set(element, new Map()); | ||
} | ||
const keyTimers = TimeCache.get(element); | ||
keyTimers.set(key, setTimeout(callback, delay)); | ||
} else { | ||
TimeCache.set(element, setTimeout(callback, delay)); | ||
} | ||
}, | ||
/** | ||
* Returns the timer associated with the target. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string=} key a unique | ||
* @returns {ReturnType<TimerHandler>?} the timer | ||
*/ | ||
get: (target, key) => { | ||
const element = querySelector(target); | ||
if (!element) return null; | ||
if (key && key.length) { | ||
if (!TimeCache.has(element)) { | ||
TimeCache.set(element, new Map()); | ||
} | ||
const keyTimers = TimeCache.get(element); | ||
if (keyTimers.has(key)) { | ||
return keyTimers.get(key); | ||
} | ||
} else if (TimeCache.has(element)) { | ||
return TimeCache.get(element); | ||
} | ||
return null; | ||
}, | ||
/** | ||
* Clears the element's timer. | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string=} key a unique key | ||
*/ | ||
clear: (target, key) => { | ||
const element = querySelector(target); | ||
const timers = element && TimeCache.get(element); | ||
if (!timers) return; | ||
if (key && key.length) { | ||
if (timers.has(key)) { | ||
clearTimeout(timers.get(key)); | ||
timers.delete(key); | ||
} | ||
} else { | ||
clearTimeout(timers); | ||
TimeCache.delete(element); | ||
} | ||
}, | ||
}; | ||
/** | ||
* Utility to wrap a callback in a try() catch(e) | ||
@@ -1513,82 +1714,211 @@ * | ||
/** | ||
* Utility to force re-paint of an `HTMLElement` target. | ||
* Returns the bounding client rect of a target `HTMLElement`. | ||
* | ||
* @param {HTMLElement} element is the target | ||
* @return {number} the `Element.offsetHeight` value | ||
* @see https://github.com/floating-ui/floating-ui | ||
* | ||
* @param {SHORTER.ElementNodes} element event.target | ||
* @param {boolean=} includeScale when *true*, the target scale is also computed | ||
* @returns {SHORTER.BoundingClientRect} the bounding client rect object | ||
*/ | ||
const reflow = (element) => element.offsetHeight; | ||
function getBoundingClientRect(element, includeScale) { | ||
const { | ||
width, height, top, right, bottom, left, | ||
} = element.getBoundingClientRect(); | ||
let scaleX = 1; | ||
let scaleY = 1; | ||
if (includeScale && element instanceof HTMLElement) { | ||
const { offsetWidth, offsetHeight } = element; | ||
scaleX = offsetWidth > 0 ? Math.round(width) / offsetWidth || 1 : 1; | ||
scaleY = offsetHeight > 0 ? Math.round(height) / offsetHeight || 1 : 1; | ||
} | ||
return { | ||
width: width / scaleX, | ||
height: height / scaleY, | ||
top: top / scaleY, | ||
right: right / scaleX, | ||
bottom: bottom / scaleY, | ||
left: left / scaleX, | ||
x: left / scaleX, | ||
y: top / scaleY, | ||
}; | ||
} | ||
/** | ||
* Utility to focus an `HTMLElement` target. | ||
* Returns the `document.body` or the `<body>` element. | ||
* | ||
* @param {HTMLElement} element is the target | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @returns {HTMLElement | HTMLBodyElement} | ||
*/ | ||
const focus = (element) => element.focus(); | ||
function getDocumentBody(node) { | ||
return getDocument(node).body; | ||
} | ||
/** | ||
* Shortcut for `Array.from()` static method. | ||
* Returns the `document.documentElement` or the `<html>` element. | ||
* | ||
* @param {any[] | HTMLCollection | NodeList} arr array-like iterable object | ||
* @returns {Array<any>} | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @returns {HTMLElement | HTMLHtmlElement} | ||
*/ | ||
const ArrayFrom = (arr) => Array.from(arr); | ||
function getDocumentElement(node) { | ||
return getDocument(node).documentElement; | ||
} | ||
/** | ||
* Shortcut for `Float32Array.from()` static method. | ||
* @param {any[] | HTMLCollection | NodeList} arr array-like iterable object | ||
* @returns {Float32Array} | ||
* Returns the `document.head` or the `<head>` element. | ||
* | ||
* @param {(Node | SHORTER.ElementNodes)=} node | ||
* @returns {HTMLElement | HTMLHeadElement} | ||
*/ | ||
const Float32ArrayFrom = (arr) => Float32Array.from(Array.from(arr)); | ||
function getDocumentHead(node) { | ||
return getDocument(node).head; | ||
} | ||
/** | ||
* Shortcut for `Float64Array.from()` static method. | ||
* @param {any[] | HTMLCollection | NodeList} arr array-like iterable object | ||
* @returns {Float64Array} | ||
* Returns an `{x,y}` object with the target | ||
* `HTMLElement` / `Node` scroll position. | ||
* | ||
* @see https://github.com/floating-ui/floating-ui | ||
* | ||
* @param {HTMLElement | Window} element target node / element | ||
* @returns {{x: number, y: number}} the scroll tuple | ||
*/ | ||
const Float64ArrayFrom = (arr) => Float64Array.from(Array.from(arr)); | ||
function getNodeScroll(element) { | ||
const isWin = 'scrollX' in element; | ||
const x = isWin ? element.scrollX : element.scrollLeft; | ||
const y = isWin ? element.scrollY : element.scrollTop; | ||
return { x, y }; | ||
} | ||
/** | ||
* Shortcut for `Object.assign()` static method. | ||
* @param {Record<string, any>} obj a target object | ||
* @param {Record<string, any>} source a source object | ||
* Returns the `Window` object of a target node. | ||
* @see https://github.com/floating-ui/floating-ui | ||
* | ||
* @param {(Node | SHORTER.ElementNodes | Window)=} node target node | ||
* @returns {globalThis} | ||
*/ | ||
const ObjectAssign = (obj, source) => Object.assign(obj, source); | ||
function getWindow(node) { | ||
if (node == null) { | ||
return window; | ||
} | ||
if (!(node instanceof Window)) { | ||
const { ownerDocument } = node; | ||
return ownerDocument ? ownerDocument.defaultView || window : window; | ||
} | ||
// @ts-ignore | ||
return node; | ||
} | ||
/** | ||
* Shortcut for `Object.values()` static method. | ||
* @param {Record<string, any>} obj a target object | ||
* @returns {any[]} | ||
* Check if target is a `ShadowRoot`. | ||
* | ||
* @param {any} element target | ||
* @returns {boolean} the query result | ||
*/ | ||
const ObjectValues = (obj) => Object.values(obj); | ||
const isShadowRoot = (element) => { | ||
const OwnElement = getWindow(element).ShadowRoot; | ||
return element instanceof OwnElement || element instanceof ShadowRoot; | ||
}; | ||
/** | ||
* Shortcut for `HTMLElement.getAttribute()` method. | ||
* @param {HTMLElement} element target element | ||
* @param {string} attribute attribute name | ||
* Returns the `parentNode` also going through `ShadowRoot`. | ||
* @see https://github.com/floating-ui/floating-ui | ||
* | ||
* @param {Node | SHORTER.ElementNodes} node the target node | ||
* @returns {Node | SHORTER.ElementNodes} the apropriate parent node | ||
*/ | ||
const getAttribute = (element, attribute) => element.getAttribute(attribute); | ||
function getParentNode(node) { | ||
if (node.nodeName === 'HTML') { | ||
return node; | ||
} | ||
// this is a quicker (but less type safe) way to save quite some bytes from the bundle | ||
return ( | ||
// @ts-ignore | ||
node.assignedSlot // step into the shadow DOM of the parent of a slotted node | ||
|| node.parentNode // @ts-ignore DOM Element detected | ||
|| (isShadowRoot(node) ? node.host : null) // ShadowRoot detected | ||
|| getDocumentElement(node) // fallback | ||
); | ||
} | ||
/** | ||
* Shortcut for `HTMLElement.setAttribute()` method. | ||
* @param {HTMLElement} element target element | ||
* @param {string} attribute attribute name | ||
* @param {string} value attribute value | ||
* Checks if a target `HTMLElement` is affected by scale. | ||
* @see https://github.com/floating-ui/floating-ui | ||
* | ||
* @param {HTMLElement} element target | ||
* @returns {boolean} the query result | ||
*/ | ||
const setAttribute = (element, attribute, value) => element.setAttribute(attribute, value); | ||
function isScaledElement(element) { | ||
const { width, height } = getBoundingClientRect(element); | ||
const { offsetWidth, offsetHeight } = element; | ||
return Math.round(width) !== offsetWidth | ||
|| Math.round(height) !== offsetHeight; | ||
} | ||
/** | ||
* Shortcut for `HTMLElement.removeAttribute()` method. | ||
* @param {HTMLElement} element target element | ||
* @param {string} attribute attribute name | ||
* Returns the rect relative to an offset parent. | ||
* @see https://github.com/floating-ui/floating-ui | ||
* | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {SHORTER.ElementNodes | Window} offsetParent the container / offset parent | ||
* @param {{x: number, y: number}} scroll | ||
* @returns {SHORTER.OffsetRect} | ||
*/ | ||
const removeAttribute = (element, attribute) => element.removeAttribute(attribute); | ||
function getRectRelativeToOffsetParent(element, offsetParent, scroll) { | ||
const isParentAnElement = offsetParent instanceof HTMLElement; | ||
const rect = getBoundingClientRect(element, isParentAnElement && isScaledElement(offsetParent)); | ||
const offsets = { x: 0, y: 0 }; | ||
if (isParentAnElement) { | ||
const offsetRect = getBoundingClientRect(offsetParent, true); | ||
offsets.x = offsetRect.x + offsetParent.clientLeft; | ||
offsets.y = offsetRect.y + offsetParent.clientTop; | ||
} | ||
return { | ||
x: rect.left + scroll.x - offsets.x, | ||
y: rect.top + scroll.y - offsets.y, | ||
width: rect.width, | ||
height: rect.height, | ||
}; | ||
} | ||
/** | ||
* Shortcut for `HTMLElement.style.propertyName` method. | ||
* @param {HTMLElement} element target element | ||
* @param {Partial<CSSStyleDeclaration>} styles attribute value | ||
* Shortcut for `Array.isArray()` static method. | ||
* | ||
* @param {any} arr array-like iterable object | ||
* @returns {boolean} the query result | ||
*/ | ||
const setElementStyle = (element, styles) => ObjectAssign(element.style, styles); | ||
const isArray = (arr) => Array.isArray(arr); | ||
/** | ||
* Checks if an object is a `Document`. | ||
* | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isDocument = (element) => element instanceof Document; | ||
/** | ||
* Checks if an object is a `CustomElement`. | ||
* | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isCustomElement = (element) => element && !!element.shadowRoot; | ||
/** | ||
* Checks if an object is an `Element`. | ||
* | ||
* @param {any} element the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isElement = (element) => element instanceof Element; | ||
/** | ||
* Utility to determine if an `HTMLElement` | ||
@@ -1598,9 +1928,10 @@ * is partially visible in viewport. | ||
* @param {HTMLElement} element target | ||
* @return {boolean} Boolean | ||
* @return {boolean} the query result | ||
*/ | ||
function isElementInScrollRange(element) { | ||
const bcr = element.getBoundingClientRect(); | ||
const viewportHeight = window.innerHeight || document.documentElement.clientHeight; | ||
return bcr.top <= viewportHeight && bcr.bottom >= 0; // bottom && top | ||
} | ||
const isElementInScrollRange = (element) => { | ||
const { top, bottom } = getBoundingClientRect(element); | ||
const { clientHeight } = getDocumentElement(element); | ||
// checks bottom && top | ||
return top <= clientHeight && bottom >= 0; | ||
}; | ||
@@ -1612,16 +1943,52 @@ /** | ||
* @param {HTMLElement} element target | ||
* @return {boolean} Boolean | ||
* @return {boolean} the query result | ||
*/ | ||
function isElementInViewport(element) { | ||
const bcr = element.getBoundingClientRect(); | ||
const isElementInViewport = (element) => { | ||
const { | ||
top, left, bottom, right, | ||
} = getBoundingClientRect(element, true); | ||
const { clientWidth, clientHeight } = getDocumentElement(element); | ||
return ( | ||
bcr.top >= 0 | ||
&& bcr.left >= 0 | ||
&& bcr.bottom <= (window.innerHeight || document.documentElement.clientHeight) | ||
&& bcr.right <= (window.innerWidth || document.documentElement.clientWidth) | ||
top >= 0 && left >= 0 | ||
&& bottom <= clientHeight | ||
&& right <= clientWidth | ||
); | ||
} | ||
}; | ||
/** | ||
* Checks if an element is an `<svg>`, `<img>` or `<video>`. | ||
* 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`. | ||
* | ||
* @param {any} object the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isElementsArray = (object) => Array.isArray(object) | ||
&& object.every((el) => isHTMLElement(el)); | ||
/** | ||
* Checks if an object is an `HTMLCollection`. | ||
* | ||
* @param {any} object the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isHTMLCollection = (object) => object instanceof HTMLCollection; | ||
/** | ||
* Check if a target element is an `<img>`. | ||
* @param {any} element the target element | ||
* @returns {boolean} the query result | ||
*/ | ||
const isHTMLImageElement = (element) => element instanceof HTMLImageElement; | ||
/** | ||
* Checks if an element is an `<svg>` (or any type of SVG element), | ||
* `<img>` or `<video>`. | ||
* | ||
* *Tooltip* / *Popover* works different with media elements. | ||
@@ -1636,55 +2003,69 @@ * @param {any} element the target element | ||
/** | ||
* Checks if a page is Right To Left. | ||
* Checks if an object is a `NodeList`. | ||
* | ||
* @param {any} object the target object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isRTL = () => document.documentElement.dir === 'rtl'; | ||
const isNodeList = (object) => object instanceof NodeList; | ||
/** | ||
* Shortcut for `typeof` static method. | ||
* | ||
* @param {any} str array-like iterable object | ||
* Checks if a page is Right To Left. | ||
* @param {SHORTER.ElementNodes=} node the target | ||
* @returns {boolean} the query result | ||
*/ | ||
const isString = (str) => str && typeof str === 'string'; | ||
const isRTL = (node) => getDocumentElement(node).dir === 'rtl'; | ||
/** | ||
* Shortcut for `Array.isArray()` static method. | ||
* Shortcut for `typeof SOMETHING === string` static method. | ||
* | ||
* @param {any} arr array-like iterable object | ||
* @param {any} str array-like iterable object | ||
* @returns {boolean} the query result | ||
*/ | ||
const isArray = (arr) => Array.isArray(arr); | ||
const isString = (str) => typeof str === 'string'; | ||
/** | ||
* Checks if an object is an `Element`. | ||
* | ||
* @param {any} element the target object | ||
* Check if an element is an `<svg>` or any other SVG element. | ||
* @param {any} element the target element | ||
* @returns {boolean} the query result | ||
*/ | ||
const isElement = (element) => element && element instanceof Element; | ||
const isSVGElement = (element) => element instanceof SVGElement; | ||
/** | ||
* Checks if an object is an `HTMLCollection`. | ||
* | ||
* @param {any} object the target object | ||
* Check if a target element is a `<table>`, `<td>` or `<th>`. | ||
* @param {any} element the target element | ||
* @returns {boolean} the query result | ||
*/ | ||
const isHTMLCollection = (object) => object instanceof HTMLCollection; | ||
const isTableElement = (element) => ['TABLE', 'TD', 'TH'].includes(element.tagName); | ||
/** | ||
* Checks if an object is a `NodeList`. | ||
* Shortcut for `HTMLElement.closest` method which also works | ||
* with children of `ShadowRoot`. The order of the parameters | ||
* is intentional since they're both required. | ||
* | ||
* @param {any} object the target object | ||
* @returns {boolean} the query result | ||
* @see https://stackoverflow.com/q/54520554/803358 | ||
* | ||
* @param {SHORTER.ElementNodes} element Element to look into | ||
* @param {string} selector the selector name | ||
* @return {SHORTER.ElementNodes?} the query result | ||
*/ | ||
const isNodeList = (object) => object instanceof NodeList; | ||
function closest(element, selector) { | ||
return (element && element.closest(selector)) | ||
// @ts-ignore -- break out of `ShadowRoot` | ||
|| closest(element.getRootNode().host, selector); | ||
} | ||
/** | ||
* Checks if an object is an `Array` in which all items are `Element`. | ||
* Returns an `Array` of `Node` elements that are registered as | ||
* `CustomElement`. | ||
* @see https://stackoverflow.com/questions/27334365/how-to-get-list-of-registered-custom-elements | ||
* | ||
* @param {any} object the target object | ||
* @returns {boolean} the query result | ||
* @param {(SHORTER.ParentNodes)=} parent parent to look into | ||
* @returns {SHORTER.ElementNodes[]} the query result | ||
*/ | ||
const isElementsArray = (object) => Array.isArray(object) | ||
&& object.every((el) => isHTMLElement(el)); | ||
function getCustomElements(parent) { | ||
const lookUp = parent && parentNodes.some((x) => parent instanceof x) | ||
? parent : getDocument(); | ||
// @ts-ignore -- look inside `shadowRoot` node too | ||
return [...lookUp.querySelectorAll('*')].filter(isCustomElement); | ||
} | ||
@@ -1695,7 +2076,9 @@ /** | ||
* @param {string} selector the input selector | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {NodeListOf<HTMLElement>} the query result | ||
* @param {(SHORTER.ParentNodes)=} parent optional node to look into | ||
* @return {NodeListOf<SHORTER.ElementNodes>} the query result | ||
*/ | ||
function querySelectorAll(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
const lookUp = parent && parentNodes | ||
.some((x) => parent instanceof x) ? parent : getDocument(); | ||
// @ts-ignore -- `ShadowRoot` is also a node | ||
return lookUp.querySelectorAll(selector); | ||
@@ -1705,11 +2088,12 @@ } | ||
/** | ||
* Shortcut for `HTMLElement.getElementsByTagName` method. | ||
* Shortcut for `HTMLElement.getElementsByTagName` method. Some `Node` elements | ||
* like `ShadowRoot` do not support `getElementsByTagName`. | ||
* | ||
* @param {string} selector the tag name | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
* @param {(SHORTER.ElementNodes | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<SHORTER.ElementNodes>} the 'HTMLCollection' | ||
*/ | ||
function getElementsByTagName(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
// @ts-ignore | ||
const lookUp = parent && parentNodes | ||
.some((x) => parent instanceof x) ? parent : getDocument(); | ||
return lookUp.getElementsByTagName(selector); | ||
@@ -1719,15 +2103,16 @@ } | ||
/** | ||
* Shortcut for `HTMLElement.getElementsByClassName` method. | ||
* Shortcut for `HTMLElement.getElementsByClassName` method. Some `Node` elements | ||
* like `ShadowRoot` do not support `getElementsByClassName`. | ||
* | ||
* @param {string} selector the class name | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
* @param {(SHORTER.ElementNodes | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<SHORTER.ElementNodes>} the 'HTMLCollection' | ||
*/ | ||
function getElementsByClassName(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
// @ts-ignore | ||
const lookUp = parent && parentNodes.some((x) => parent instanceof x) | ||
? parent : getDocument(); | ||
return lookUp.getElementsByClassName(selector); | ||
} | ||
var version = "0.3.0alpha1"; | ||
var version = "0.3.0alpha10"; | ||
@@ -1825,2 +2210,3 @@ // @ts-ignore | ||
isApple, | ||
isFirefox, | ||
support3DTransform, | ||
@@ -1861,2 +2247,3 @@ supportPassive, | ||
userAgentData, | ||
userAgent, | ||
addClass, | ||
@@ -1868,2 +2255,3 @@ removeClass, | ||
one, | ||
distinct, | ||
Data, | ||
@@ -1878,3 +2266,4 @@ Timer, | ||
isElementInViewport, | ||
passiveHandler, | ||
passiveHandler: passiveHandler$1, | ||
passiveHandlerLegacy: passiveHandler, | ||
getElementAnimationDuration: getElementAnimationDuration$1, | ||
@@ -1888,12 +2277,29 @@ getElementAnimationDurationLegacy: getElementAnimationDuration, | ||
getElementTransitionDelayLegacy: getElementTransitionDelay, | ||
getNodeScroll, | ||
getParentNode, | ||
getRectRelativeToOffsetParent, | ||
getWindow, | ||
isArray, | ||
isString, | ||
isCustomElement, | ||
isElement, | ||
isNode, | ||
isHTMLElement, | ||
isHTMLImageElement, | ||
isSVGElement, | ||
isNodeList, | ||
isHTMLCollection, | ||
isScaledElement, | ||
isTableElement, | ||
isShadowRoot, | ||
isDocument, | ||
isElementsArray, | ||
isWindow, | ||
isMedia, | ||
isRTL, | ||
elementNodes, | ||
parentNodes, | ||
closest, | ||
querySelector, | ||
getCustomElements, | ||
querySelectorAll, | ||
@@ -1913,7 +2319,17 @@ getElementsByClassName, | ||
ObjectValues, | ||
getBoundingClientRect, | ||
getDocument, | ||
getDocumentBody, | ||
getDocumentElement, | ||
getDocumentHead, | ||
getElementStyle, | ||
setElementStyle, | ||
hasAttribute, | ||
hasAttributeNS, | ||
getAttribute, | ||
getAttributeNS, | ||
setAttribute, | ||
setAttributeNS, | ||
removeAttribute, | ||
removeAttributeNS, | ||
Version, | ||
@@ -1920,0 +2336,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.3.0alpha1 | dnp_theme © 2022 | MIT-License | ||
const e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",n="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",o="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",r="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",s="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",c="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",u=/iPhone|iPad|iPod|Android/i;let l=!1;l=navigator.userAgentData?navigator.userAgentData.brands.some(e=>u.test(e.brand)):u.test(navigator.userAgent);const m=l,d=navigator.userAgentData,g=/(iPhone|iPod|iPad)/,v=d?d.brands.some(e=>g.test(e.brand)):g.test(navigator.userAgent),E="webkitPerspective"in document.head.style||"perspective"in document.head.style;function p(e,t,n,i){const o=i||!1;e.addEventListener(t,n,o)}function y(e,t,n,i){const o=i||!1;e.removeEventListener(t,n,o)}function b(e,t,n,i){p(e,t,(function o(a){a.target===e&&(n.apply(e,[a]),y(e,t,o,i))}),i)}const h=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});b(document,"DOMContentLoaded",()=>{},t)}catch(e){throw Error("Passive events are not supported")}return e})(),f="webkitTransform"in document.head.style||"transform"in document.head.style,w="ontouchstart"in window||"msMaxTouchPoints"in navigator,k="webkitAnimation"in document.head.style||"animation"in document.head.style,A="webkitTransition"in document.head.style||"transition"in document.head.style;const L=e=>e&&e instanceof HTMLElement;function D(e,t){const n=t&&L(t)?t:document;return"object"==typeof e?e:n.querySelector(e)}const T=new Map,N={set:(e,t,n,i)=>{const o=D(e);if(o)if(i&&i.length){T.has(o)||T.set(o,new Map);T.get(o).set(i,setTimeout(t,n))}else T.set(o,setTimeout(t,n))},get:(e,t)=>{const n=D(e);if(!n)return null;if(t&&t.length){T.has(n)||T.set(n,new Map);const e=T.get(n);if(e.has(t))return e.get(t)}else if(T.has(n))return T.get(n);return null},clear:(e,t)=>{const n=D(e),i=n&&T.get(n);i&&(t&&t.length?i.has(t)&&(clearTimeout(i.get(t)),i.delete(t)):(clearTimeout(i),T.delete(n)))}},C=new Map,z={set:(e,t,n)=>{const i=D(e);if(!i)return;C.has(t)||C.set(t,new Map);C.get(t).set(i,n)},getAllFor:e=>{const t=C.get(e);return t||null},get:(e,t)=>{const n=D(e),i=z.getAllFor(t),o=n&&i&&i.get(n);return o||null},remove:(e,t)=>{const n=D(e),i=C.get(t);i&&n&&(i.delete(n),0===i.size&&C.delete(t))}};function M(e,t){const n=getComputedStyle(e);return t&&t in n?n.getPropertyValue(t):""}function O(e){const t=M(e,"animationName"),n=M(e,"animationDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function S(e){const t=M(e,"animationName"),n=M(e,"animationDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function I(e){const t=M(e,i),o=M(e,n),a=o.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(o)*a:0;return Number.isNaN(r)?0:r}function P(e){const n=M(e,i),o=M(e,t),a=o.includes("ms")?1:1e3,r=k&&n&&"none"!==n?parseFloat(o)*a:0;return Number.isNaN(r)?0:r}function H(e){const t=M(e,"transitionProperty"),n=M(e,"transitionDelay"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function F(e){const t=M(e,"transitionProperty"),n=M(e,"transitionDuration"),i=n.includes("ms")?1:1e3,o=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function B(e){const t=M(e,c),n=M(e,r),i=n.includes("ms")?1:1e3,o=A&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function x(e){const t=M(e,c),n=M(e,a),i=n.includes("ms")?1:1e3,o=A&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(o)?0:o}function Q(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const j=e=>Object.keys(e);const R=(e,t)=>Object.assign(e,t);const V={ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:t,animationDelay:"animationDelay",animationDelayLegacy:n,animationName:"animationName",animationNameLegacy:i,animationEndEvent:"animationend",animationEndEventLegacy:o,transitionDuration:"transitionDuration",transitionDurationLegacy:a,transitionDelay:"transitionDelay",transitionDelayLegacy:r,transitionEndEvent:"transitionend",transitionEndEventLegacy:s,transitionProperty:"transitionProperty",transitionPropertyLegacy:c,isMobile:m,isApple:v,support3DTransform:E,supportPassive:h,supportTransform:f,supportTouch:w,supportAnimation:k,supportTransition:A,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:"userAgentData",addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:p,off:y,one:b,Data:z,Timer:N,getInstance:(e,t)=>z.get(e,t),emulateAnimationEnd:function(e,t){let n=0;const i=new Event("animationend"),o=S(e),a=O(e);if(o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener("animationend",r),n=1)};e.addEventListener("animationend",r),setTimeout(()=>{n||e.dispatchEvent(i)},o+a+17)}else t.apply(e,[i])},emulateAnimationEndLegacy:function(e,t){let n=0;const i=new Event(o),a=P(e),r=I(e);if(k&&a){const s=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener(o,s),n=1)};e.addEventListener(o,s),setTimeout(()=>{n||e.dispatchEvent(i)},a+r+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){let n=0;const i=new Event("transitionend"),o=F(e),a=H(e);if(o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener("transitionend",r),n=1)};e.addEventListener("transitionend",r),setTimeout(()=>{n||e.dispatchEvent(i)},o+a+17)}else t.apply(e,[i])},emulateTransitionEndLegacy:function(e,t){let n=0;const i=new Event(s),o=x(e),a=B(e);if(A&&o){const r=i=>{i.target===e&&(t.apply(e,[i]),e.removeEventListener(s,r),n=1)};e.addEventListener(s,r),setTimeout(()=>{n||e.dispatchEvent(i)},o+a+17)}else t.apply(e,[i])},isElementInScrollRange:function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},isElementInViewport:function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!h&&{passive:!0},getElementAnimationDuration:S,getElementAnimationDurationLegacy:P,getElementAnimationDelay:O,getElementAnimationDelayLegacy:I,getElementTransitionDuration:F,getElementTransitionDurationLegacy:x,getElementTransitionDelay:H,getElementTransitionDelayLegacy:B,isArray:e=>Array.isArray(e),isString:e=>e&&"string"==typeof e,isElement:e=>e&&e instanceof Element,isHTMLElement:L,isNodeList:e=>e instanceof NodeList,isHTMLCollection:e=>e instanceof HTMLCollection,isElementsArray:e=>Array.isArray(e)&&e.every(e=>L(e)),isMedia:e=>e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(t=>e instanceof t),isRTL:()=>"rtl"===document.documentElement.dir,querySelector:D,querySelectorAll:function(e,t){return(t&&L(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&L(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&L(t)?t:document).getElementsByTagName(e)},normalizeValue:Q,normalizeOptions:function(e,t,n,i){const o={...e.dataset},a={},r={};return j(o).forEach(e=>{const t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;r[t]=Q(o[e])}),j(n).forEach(e=>{n[e]=Q(n[e])}),j(t).forEach(e=>{a[e]=e in n?n[e]:e in r?r[e]:t[e]}),a},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(`${t} ${e}`)}},reflow:e=>e.offsetHeight,focus:e=>e.focus(),ArrayFrom:e=>Array.from(e),Float32ArrayFrom:e=>Float32Array.from(Array.from(e)),Float64ArrayFrom:e=>Float64Array.from(Array.from(e)),ObjectAssign:R,ObjectKeys:j,ObjectValues:e=>Object.values(e),getElementStyle:M,setElementStyle:(e,t)=>R(e.style,t),getAttribute:(e,t)=>e.getAttribute(t),setAttribute:(e,t,n)=>e.setAttribute(t,n),removeAttribute:(e,t)=>e.removeAttribute(t),Version:"0.3.0alpha1"};export{V as default}; | ||
// shorter-js v0.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}; |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.3.0alpha1 | dnp_theme © 2022 | MIT-License | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SHORTER=t()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimation"in document.head.style?"webkitAnimationDuration":"animationDuration",n="webkitAnimation"in document.head.style?"webkitAnimationDelay":"animationDelay",i="webkitAnimation"in document.head.style?"webkitAnimationName":"animationName",r="webkitAnimation"in document.head.style?"webkitAnimationEnd":"animationend",o="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",s="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty",c=/iPhone|iPad|iPod|Android/i,l=navigator.userAgentData?navigator.userAgentData.brands.some((function(e){return c.test(e.brand)})):c.test(navigator.userAgent),m=navigator.userAgentData,d=/(iPhone|iPod|iPad)/,v=m?m.brands.some((function(e){return d.test(e.brand)})):d.test(navigator.userAgent),f="webkitPerspective"in document.head.style||"perspective"in document.head.style;function g(e,t,n,i){var r=i||!1;e.addEventListener(t,n,r)}function p(e,t,n,i){var r=i||!1;e.removeEventListener(t,n,r)}function y(e,t,n,i){g(e,t,(function r(o){o.target===e&&(n.apply(e,[o]),p(e,t,r,i))}),i)}var E=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});y(document,"DOMContentLoaded",(function(){}),t)}catch(e){throw Error("Passive events are not supported")}return e}(),b="webkitTransform"in document.head.style||"transform"in document.head.style,h="ontouchstart"in window||"msMaxTouchPoints"in navigator,w="webkitAnimation"in document.head.style||"animation"in document.head.style,k="webkitTransition"in document.head.style||"transition"in document.head.style;var A=function(e){return e&&e instanceof HTMLElement};function L(e,t){var n=t&&A(t)?t:document;return"object"==typeof e?e:n.querySelector(e)}var D=new Map,T={set:function(e,t,n,i){var r=L(e);r&&(i&&i.length?(D.has(r)||D.set(r,new Map),D.get(r).set(i,setTimeout(t,n))):D.set(r,setTimeout(t,n)))},get:function(e,t){var n=L(e);if(!n)return null;if(t&&t.length){D.has(n)||D.set(n,new Map);var i=D.get(n);if(i.has(t))return i.get(t)}else if(D.has(n))return D.get(n);return null},clear:function(e,t){var n=L(e),i=n&&D.get(n);i&&(t&&t.length?i.has(t)&&(clearTimeout(i.get(t)),i.delete(t)):(clearTimeout(i),D.delete(n)))}},N=new Map,C={set:function(e,t,n){var i=L(e);i&&(N.has(t)||N.set(t,new Map),N.get(t).set(i,n))},getAllFor:function(e){var t=N.get(e);return t||null},get:function(e,t){var n=L(e),i=C.getAllFor(t),r=n&&i&&i.get(n);return r||null},remove:function(e,t){var n=L(e),i=N.get(t);i&&n&&(i.delete(n),0===i.size&&N.delete(t))}};function O(e,t){var n=getComputedStyle(e);return t&&t in n?n.getPropertyValue(t):""}function z(e){var t=O(e,"animationName"),n=O(e,"animationDelay"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function M(e){var t=O(e,"animationName"),n=O(e,"animationDuration"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function S(e){var t=O(e,i),r=O(e,n),o=r.includes("ms")?1:1e3,a=w&&t&&"none"!==t?parseFloat(r)*o:0;return Number.isNaN(a)?0:a}function I(e){var n=O(e,i),r=O(e,t),o=r.includes("ms")?1:1e3,a=w&&n&&"none"!==n?parseFloat(r)*o:0;return Number.isNaN(a)?0:a}function P(e){var t=O(e,"transitionProperty"),n=O(e,"transitionDelay"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function H(e){var t=O(e,"transitionProperty"),n=O(e,"transitionDuration"),i=n.includes("ms")?1:1e3,r=t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function F(e){var t=O(e,s),n=O(e,a),i=n.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function B(e){var t=O(e,s),n=O(e,o),i=n.includes("ms")?1:1e3,r=k&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(r)?0:r}function x(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}var j=function(e){return Object.keys(e)};var R=function(e,t){return Object.assign(e,t)};return{ariaChecked:"aria-checked",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",nativeEvents:["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointercancel","pointerdown","pointerleave","pointermove","pointerup","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:e,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:t,animationDelay:"animationDelay",animationDelayLegacy:n,animationName:"animationName",animationNameLegacy:i,animationEndEvent:"animationend",animationEndEventLegacy:r,transitionDuration:"transitionDuration",transitionDurationLegacy:o,transitionDelay:"transitionDelay",transitionDelayLegacy:a,transitionEndEvent:"transitionend",transitionEndEventLegacy:u,transitionProperty:"transitionProperty",transitionPropertyLegacy:s,isMobile:l,isApple:v,support3DTransform:f,supportPassive:E,supportTransform:b,supportTouch:h,supportAnimation:w,supportTransition:k,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:"userAgentData",addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:g,off:p,one:y,Data:C,Timer:T,getInstance:function(e,t){return C.get(e,t)},emulateAnimationEnd:function(e,t){var n=0,i=new Event("animationend"),r=M(e),o=z(e);if(r){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener("animationend",a),n=1)};e.addEventListener("animationend",a),setTimeout((function(){n||e.dispatchEvent(i)}),r+o+17)}else t.apply(e,[i])},emulateAnimationEndLegacy:function(e,t){var n=0,i=new Event(r),o=I(e),a=S(e);if(w&&o){var u=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(r,u),n=1)};e.addEventListener(r,u),setTimeout((function(){n||e.dispatchEvent(i)}),o+a+17)}else t.apply(e,[i])},emulateTransitionEnd:function(e,t){var n=0,i=new Event("transitionend"),r=H(e),o=P(e);if(r){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener("transitionend",a),n=1)};e.addEventListener("transitionend",a),setTimeout((function(){n||e.dispatchEvent(i)}),r+o+17)}else t.apply(e,[i])},emulateTransitionEndLegacy:function(e,t){var n=0,i=new Event(u),r=B(e),o=F(e);if(k&&r){var a=function(i){i.target===e&&(t.apply(e,[i]),e.removeEventListener(u,a),n=1)};e.addEventListener(u,a),setTimeout((function(){n||e.dispatchEvent(i)}),r+o+17)}else t.apply(e,[i])},isElementInScrollRange:function(e){var t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},isElementInViewport:function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!E&&{passive:!0},getElementAnimationDuration:M,getElementAnimationDurationLegacy:I,getElementAnimationDelay:z,getElementAnimationDelayLegacy:S,getElementTransitionDuration:H,getElementTransitionDurationLegacy:B,getElementTransitionDelay:P,getElementTransitionDelayLegacy:F,isArray:function(e){return Array.isArray(e)},isString:function(e){return e&&"string"==typeof e},isElement:function(e){return e&&e instanceof Element},isHTMLElement:A,isNodeList:function(e){return e instanceof NodeList},isHTMLCollection:function(e){return e instanceof HTMLCollection},isElementsArray:function(e){return Array.isArray(e)&&e.every((function(e){return A(e)}))},isMedia:function(e){return e&&[SVGElement,HTMLImageElement,HTMLVideoElement].some((function(t){return e instanceof t}))},isRTL:function(){return"rtl"===document.documentElement.dir},querySelector:L,querySelectorAll:function(e,t){return(t&&A(t)?t:document).querySelectorAll(e)},getElementsByClassName:function(e,t){return(t&&A(t)?t:document).getElementsByClassName(e)},getElementsByTagName:function(e,t){return(t&&A(t)?t:document).getElementsByTagName(e)},normalizeValue:x,normalizeOptions:function(e,t,n,i){var r=Object.assign({},e.dataset),o={},a={};return j(r).forEach((function(e){var t=i&&e.includes(i)?e.replace(i,"").replace(/[A-Z]/,(function(e){return e.toLowerCase()})):e;a[t]=x(r[e])})),j(n).forEach((function(e){n[e]=x(n[e])})),j(t).forEach((function(e){o[e]=e in n?n[e]:e in a?a[e]:t[e]})),o},tryWrapper:function(e,t){try{e()}catch(e){throw TypeError(t+" "+e)}},reflow:function(e){return e.offsetHeight},focus:function(e){return e.focus()},ArrayFrom:function(e){return Array.from(e)},Float32ArrayFrom:function(e){return Float32Array.from(Array.from(e))},Float64ArrayFrom:function(e){return Float64Array.from(Array.from(e))},ObjectAssign:R,ObjectKeys:j,ObjectValues:function(e){return Object.values(e)},getElementStyle:O,setElementStyle:function(e,t){return R(e.style,t)},getAttribute:function(e,t){return e.getAttribute(t)},setAttribute:function(e,t,n){return e.setAttribute(t,n)},removeAttribute:function(e,t){return e.removeAttribute(t)},Version:"0.3.0alpha1"}})); | ||
// 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"}})); |
{ | ||
"name": "shorter-js", | ||
"version": "0.3.0alpha1", | ||
"version": "0.3.0alpha10", | ||
"description": "A small ES6+ library with various JavaScript tools useful for creating light libraries.", | ||
@@ -5,0 +5,0 @@ "main": "dist/shorter-js.min.js", |
import userAgentData from '../strings/userAgentData'; | ||
import userAgent from '../strings/userAgent'; | ||
/** @type {Record<string, any>} */ | ||
// @ts-ignore | ||
const agentData = navigator[userAgentData]; | ||
const appleBrands = /(iPhone|iPod|iPad)/; | ||
/** | ||
* A global boolean for Apple browsers. | ||
* A global `boolean` for Apple browsers. | ||
* @type {boolean} | ||
*/ | ||
const isApple = !agentData ? appleBrands.test(navigator.userAgent) | ||
: agentData.brands.some((/** @type {Record<string, any>} */x) => appleBrands.test(x.brand)); | ||
const isApple = !userAgentData ? appleBrands.test(userAgent) | ||
: userAgentData.brands.some((/** @type {Record<string, any>} */x) => appleBrands.test(x.brand)); | ||
export default isApple; |
import userAgentData from '../strings/userAgentData'; | ||
import userAgent from '../strings/userAgent'; | ||
@@ -6,12 +7,11 @@ const mobileBrands = /iPhone|iPad|iPod|Android/i; | ||
// @ts-ignore | ||
if (navigator[userAgentData]) { | ||
// @ts-ignore | ||
isMobileCheck = navigator[userAgentData].brands.some((x) => mobileBrands.test(x.brand)); | ||
if (userAgentData) { | ||
isMobileCheck = userAgentData.brands | ||
.some((/** @type {Record<String, any>} */x) => mobileBrands.test(x.brand)); | ||
} else { | ||
isMobileCheck = mobileBrands.test(navigator.userAgent); | ||
isMobileCheck = mobileBrands.test(userAgent); | ||
} | ||
/** | ||
* A global namespace for mobile detection. | ||
* A global `boolean` for mobile detection. | ||
* @type {boolean} | ||
@@ -18,0 +18,0 @@ */ |
@@ -0,1 +1,3 @@ | ||
import documentHead from '../blocks/documentHead'; | ||
/** | ||
@@ -5,3 +7,3 @@ * A global `boolean` for CSS3 3D transform support. | ||
*/ | ||
const support3DTransform = 'webkitPerspective' in document.head.style || 'perspective' in document.head.style; | ||
const support3DTransform = 'webkitPerspective' in documentHead.style || 'perspective' in documentHead.style; | ||
export default support3DTransform; |
@@ -0,1 +1,3 @@ | ||
import documentHead from '../blocks/documentHead'; | ||
/** | ||
@@ -5,3 +7,3 @@ * A global `boolean` for CSS3 animation support. | ||
*/ | ||
const supportAnimation = 'webkitAnimation' in document.head.style || 'animation' in document.head.style; | ||
const supportAnimation = 'webkitAnimation' in documentHead.style || 'animation' in documentHead.style; | ||
export default supportAnimation; |
@@ -5,3 +5,6 @@ import DOMContentLoadedEvent from '../strings/DOMContentLoadedEvent'; | ||
/** | ||
* A global namespace for passive events support. | ||
* A global `boolean` for passive events support, | ||
* in general event options are not suited for scroll prevention. | ||
* | ||
* @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection | ||
* @type {boolean} | ||
@@ -8,0 +11,0 @@ */ |
/** | ||
* A global namespace for touch events support. | ||
* A global `boolean` for touch events support. | ||
* @type {boolean} | ||
@@ -4,0 +4,0 @@ */ |
@@ -0,6 +1,8 @@ | ||
import documentHead from '../blocks/documentHead'; | ||
/** | ||
* A global namespace for CSS3 transform support. | ||
* A global `boolean` for CSS3 transform support. | ||
* @type {boolean} | ||
*/ | ||
const supportTransform = 'webkitTransform' in document.head.style || 'transform' in document.head.style; | ||
const supportTransform = 'webkitTransform' in documentHead.style || 'transform' in documentHead.style; | ||
export default supportTransform; |
@@ -0,6 +1,8 @@ | ||
import documentHead from '../blocks/documentHead'; | ||
/** | ||
* A global namespace for CSS3 transition support. | ||
* A global `boolean` for CSS3 transition support. | ||
* @type {boolean} | ||
*/ | ||
const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; | ||
const supportTransition = 'webkitTransition' in documentHead.style || 'transition' in documentHead.style; | ||
export default supportTransition; |
/** | ||
* Add class to `HTMLElement.classList`. | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {string} classNAME to add | ||
@@ -6,0 +6,0 @@ */ |
/** | ||
* Check class in `HTMLElement.classList`. | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {string} classNAME to check | ||
@@ -6,0 +6,0 @@ * @return {boolean} |
/** | ||
* Remove class from `HTMLElement.classList`. | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {HTMLElement | Element} element target | ||
* @param {string} classNAME to remove | ||
@@ -6,0 +6,0 @@ */ |
/** | ||
* Remove eventListener from an `HTMLElement` | `Document` target. | ||
* Remove eventListener from an `Element` | `HTMLElement` | `Document` target. | ||
* | ||
* @param {HTMLElement | Document} element event.target | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -6,0 +6,0 @@ * @param {EventListener} handler callback |
/** | ||
* Add eventListener to an `HTMLElement` | `Document` target. | ||
* Add eventListener to an `Element` | `HTMLElement` | `Document` target. | ||
* | ||
* @param {HTMLElement | Document} element event.target | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -6,0 +6,0 @@ * @param {EventListener} handler callback |
@@ -5,6 +5,6 @@ import on from './on'; | ||
/** | ||
* Add an `eventListener` to an `HTMLElement` | `Document` target | ||
* Add an `eventListener` to an `Element` | `HTMLElement` | `Document` target | ||
* and remove it once callback is called. | ||
* | ||
* @param {HTMLElement | Document} element event.target | ||
* @param {SHORTER.ElementNodes | Document} element event.target | ||
* @param {string} eventName event.type | ||
@@ -11,0 +11,0 @@ * @param {EventListener} handler callback |
133
src/index.js
@@ -122,2 +122,3 @@ // strings | ||
import userAgentData from './strings/userAgentData'; | ||
import userAgent from './strings/userAgent'; | ||
@@ -127,2 +128,3 @@ // boolean | ||
import isApple from './boolean/isApple'; | ||
import isFirefox from './boolean/isFirefox'; | ||
import support3DTransform from './boolean/support3DTransform'; | ||
@@ -135,2 +137,12 @@ import supportPassive from './boolean/supportPassive'; | ||
// attributes | ||
import getAttribute from './attr/getAttribute'; | ||
import getAttributeNS from './attr/getAttributeNS'; | ||
import hasAttribute from './attr/hasAttribute'; | ||
import hasAttributeNS from './attr/hasAttributeNS'; | ||
import setAttribute from './attr/setAttribute'; | ||
import setAttributeNS from './attr/setAttributeNS'; | ||
import removeAttribute from './attr/removeAttribute'; | ||
import removeAttributeNS from './attr/removeAttributeNS'; | ||
// class | ||
@@ -147,4 +159,5 @@ import addClass from './class/addClass'; | ||
// misc | ||
import Timer from './misc/timer'; | ||
import ArrayFrom from './misc/ArrayFrom'; | ||
import Data, { getInstance } from './misc/data'; | ||
import distinct from './misc/distinct'; | ||
import emulateAnimationEnd from './misc/emulateAnimationEnd'; | ||
@@ -154,44 +167,65 @@ import emulateAnimationEndLegacy from './misc/emulateAnimationEndLegacy'; | ||
import emulateTransitionEndLegacy from './misc/emulateTransitionEndLegacy'; | ||
import passiveHandler from './misc/passiveHandler'; | ||
import getElementAnimationDuration from './misc/getElementAnimationDuration'; | ||
import getElementAnimationDurationLegacy from './misc/getElementAnimationDurationLegacy'; | ||
import getElementAnimationDelay from './misc/getElementAnimationDelay'; | ||
import getElementAnimationDelayLegacy from './misc/getElementAnimationDelayLegacy'; | ||
import getElementTransitionDuration from './misc/getElementTransitionDuration'; | ||
import getElementTransitionDurationLegacy from './misc/getElementTransitionDurationLegacy'; | ||
import getElementTransitionDelay from './misc/getElementTransitionDelay'; | ||
import getElementTransitionDelayLegacy from './misc/getElementTransitionDelayLegacy'; | ||
import normalizeValue from './misc/normalizeValue'; | ||
import normalizeOptions from './misc/normalizeOptions'; | ||
import tryWrapper from './misc/tryWrapper'; | ||
import reflow from './misc/reflow'; | ||
import focus from './misc/focus'; | ||
import ArrayFrom from './misc/ArrayFrom'; | ||
import Float32ArrayFrom from './misc/Float32ArrayFrom'; | ||
import Float64ArrayFrom from './misc/Float64ArrayFrom'; | ||
import focus from './misc/focus'; | ||
import normalizeOptions from './misc/normalizeOptions'; | ||
import normalizeValue from './misc/normalizeValue'; | ||
import ObjectAssign from './misc/ObjectAssign'; | ||
import ObjectKeys from './misc/ObjectKeys'; | ||
import ObjectValues from './misc/ObjectValues'; | ||
import passiveHandler from './misc/passiveHandler'; | ||
import passiveHandlerLegacy from './misc/passiveHandlerLegacy'; | ||
import reflow from './misc/reflow'; | ||
import setElementStyle from './misc/setElementStyle'; | ||
import Timer from './misc/timer'; | ||
import tryWrapper from './misc/tryWrapper'; | ||
import getAttribute from './manipulate/getAttribute'; | ||
import setAttribute from './manipulate/setAttribute'; | ||
import removeAttribute from './manipulate/removeAttribute'; | ||
import getElementStyle from './manipulate/getElementStyle'; | ||
import setElementStyle from './manipulate/setElementStyle'; | ||
// get | ||
import getBoundingClientRect from './get/getBoundingClientRect'; | ||
import getDocument from './get/getDocument'; | ||
import getDocumentBody from './get/getDocumentBody'; | ||
import getDocumentElement from './get/getDocumentElement'; | ||
import getDocumentHead from './get/getDocumentHead'; | ||
import getElementAnimationDuration from './get/getElementAnimationDuration'; | ||
import getElementAnimationDurationLegacy from './get/getElementAnimationDurationLegacy'; | ||
import getElementAnimationDelayLegacy from './get/getElementAnimationDelayLegacy'; | ||
import getElementAnimationDelay from './get/getElementAnimationDelay'; | ||
import getElementStyle from './get/getElementStyle'; | ||
import getElementTransitionDuration from './get/getElementTransitionDuration'; | ||
import getElementTransitionDurationLegacy from './get/getElementTransitionDurationLegacy'; | ||
import getElementTransitionDelay from './get/getElementTransitionDelay'; | ||
import getElementTransitionDelayLegacy from './get/getElementTransitionDelayLegacy'; | ||
import getNodeScroll from './get/getNodeScroll'; | ||
import getParentNode from './get/getParentNode'; | ||
import getRectRelativeToOffsetParent from './get/getRectRelativeToOffsetParent'; | ||
import getWindow from './get/getWindow'; | ||
import isElementInScrollRange from './misc/isElementInScrollRange'; | ||
import isElementInViewport from './misc/isElementInViewport'; | ||
import isMedia from './misc/isMedia'; | ||
import isRTL from './misc/isRTL'; | ||
import isString from './misc/isString'; | ||
import isArray from './misc/isArray'; | ||
import isElement from './misc/isElement'; | ||
import isHTMLElement from './misc/isHTMLElement'; | ||
import isHTMLCollection from './misc/isHTMLCollection'; | ||
import isNodeList from './misc/isNodeList'; | ||
import isElementsArray from './misc/isElementsArray'; | ||
// is | ||
import isArray from './is/isArray'; | ||
import isDocument from './is/isDocument'; | ||
import isCustomElement from './is/isCustomElement'; | ||
import isElement from './is/isElement'; | ||
import isElementInScrollRange from './is/isElementInScrollRange'; | ||
import isElementInViewport from './is/isElementInViewport'; | ||
import isElementsArray from './is/isElementsArray'; | ||
import isHTMLCollection from './is/isHTMLCollection'; | ||
import isHTMLElement from './is/isHTMLElement'; | ||
import isHTMLImageElement from './is/isHTMLImageElement'; | ||
import isMedia from './is/isMedia'; | ||
import isNode from './is/isNode'; | ||
import isNodeList from './is/isNodeList'; | ||
import isRTL from './is/isRTL'; | ||
import isScaledElement from './is/isScaledElement'; | ||
import isShadowRoot from './is/isShadowRoot'; | ||
import isString from './is/isString'; | ||
import isSVGElement from './is/isSVGElement'; | ||
import isTableElement from './is/isTableElement'; | ||
import isWindow from './is/isWindow'; | ||
// selectors | ||
import elementNodes from './selectors/elementNodes'; | ||
import parentNodes from './selectors/parentNodes'; | ||
import closest from './selectors/closest'; | ||
import querySelector from './selectors/querySelector'; | ||
import getCustomElements from './selectors/getCustomElements'; | ||
import querySelectorAll from './selectors/querySelectorAll'; | ||
@@ -284,2 +318,3 @@ import getElementsByTagName from './selectors/getElementsByTagName'; | ||
isApple, | ||
isFirefox, | ||
support3DTransform, | ||
@@ -320,2 +355,3 @@ supportPassive, | ||
userAgentData, | ||
userAgent, | ||
addClass, | ||
@@ -327,2 +363,3 @@ removeClass, | ||
one, | ||
distinct, | ||
Data, | ||
@@ -338,2 +375,3 @@ Timer, | ||
passiveHandler, | ||
passiveHandlerLegacy, | ||
getElementAnimationDuration, | ||
@@ -347,12 +385,29 @@ getElementAnimationDurationLegacy, | ||
getElementTransitionDelayLegacy, | ||
getNodeScroll, | ||
getParentNode, | ||
getRectRelativeToOffsetParent, | ||
getWindow, | ||
isArray, | ||
isString, | ||
isCustomElement, | ||
isElement, | ||
isNode, | ||
isHTMLElement, | ||
isHTMLImageElement, | ||
isSVGElement, | ||
isNodeList, | ||
isHTMLCollection, | ||
isScaledElement, | ||
isTableElement, | ||
isShadowRoot, | ||
isDocument, | ||
isElementsArray, | ||
isWindow, | ||
isMedia, | ||
isRTL, | ||
elementNodes, | ||
parentNodes, | ||
closest, | ||
querySelector, | ||
getCustomElements, | ||
querySelectorAll, | ||
@@ -372,7 +427,17 @@ getElementsByClassName, | ||
ObjectValues, | ||
getBoundingClientRect, | ||
getDocument, | ||
getDocumentBody, | ||
getDocumentElement, | ||
getDocumentHead, | ||
getElementStyle, | ||
setElementStyle, | ||
hasAttribute, | ||
hasAttributeNS, | ||
getAttribute, | ||
getAttributeNS, | ||
setAttribute, | ||
setAttributeNS, | ||
removeAttribute, | ||
removeAttributeNS, | ||
Version, | ||
@@ -379,0 +444,0 @@ }; |
/** | ||
* Shortcut for `Array.from()` static method. | ||
* | ||
* @param {any[] | HTMLCollection | NodeList} arr array-like iterable object | ||
* @param {any[] | HTMLCollection | NodeList | Map<any, any>} arr array-like iterable object | ||
* @returns {Array<any>} | ||
@@ -6,0 +6,0 @@ */ |
import querySelector from '../selectors/querySelector'; | ||
/** @type {Map<string, Map<HTMLElement, SHORTER.Component>>} */ | ||
/** @type {Map<string, Map<SHORTER.ElementNodes, SHORTER.Component>>} */ | ||
const componentData = new Map(); | ||
@@ -12,3 +12,3 @@ /** | ||
* Sets web components data. | ||
* @param {HTMLElement | string} target target element | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
@@ -33,3 +33,3 @@ * @param {SHORTER.Component} instance the component instance | ||
* @param {string} component the component's name or a unique key | ||
* @returns {Map<HTMLElement, SHORTER.Component> | null} all the component instances | ||
* @returns {Map<SHORTER.ElementNodes, SHORTER.Component>?} all the component instances | ||
*/ | ||
@@ -39,4 +39,3 @@ getAllFor: (component) => { | ||
if (instanceMap) return instanceMap; | ||
return null; | ||
return instanceMap || null; | ||
}, | ||
@@ -46,5 +45,5 @@ | ||
* Returns the instance associated with the target. | ||
* @param {HTMLElement | string} target target element | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
* @returns {SHORTER.Component | null} the instance | ||
* @returns {SHORTER.Component?} the instance | ||
*/ | ||
@@ -56,4 +55,3 @@ get: (target, component) => { | ||
if (instance) return instance; | ||
return null; | ||
return instance || null; | ||
}, | ||
@@ -63,3 +61,3 @@ | ||
* Removes web components data. | ||
* @param {HTMLElement | string} target target element | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string} component the component's name or a unique key | ||
@@ -66,0 +64,0 @@ */ |
import animationEndEvent from '../strings/animationEndEvent'; | ||
import getElementAnimationDelay from './getElementAnimationDelay'; | ||
import getElementAnimationDuration from './getElementAnimationDuration'; | ||
import getElementAnimationDelay from '../get/getElementAnimationDelay'; | ||
import getElementAnimationDuration from '../get/getElementAnimationDuration'; | ||
@@ -9,3 +9,3 @@ /** | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {EventListener} handler `animationend` callback | ||
@@ -12,0 +12,0 @@ */ |
import supportAnimation from '../boolean/supportAnimation'; | ||
import animationEndEvent from '../strings/animationEndEventLegacy'; | ||
import getElementAnimationDelay from './getElementAnimationDelayLegacy'; | ||
import getElementAnimationDuration from './getElementAnimationDurationLegacy'; | ||
import getElementAnimationDelay from '../get/getElementAnimationDelayLegacy'; | ||
import getElementAnimationDuration from '../get/getElementAnimationDurationLegacy'; | ||
@@ -10,3 +10,3 @@ /** | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {EventListener} handler `animationend` callback | ||
@@ -13,0 +13,0 @@ */ |
import transitionEndEvent from '../strings/transitionEndEvent'; | ||
import getElementTransitionDelay from './getElementTransitionDelay'; | ||
import getElementTransitionDuration from './getElementTransitionDuration'; | ||
import getElementTransitionDelay from '../get/getElementTransitionDelay'; | ||
import getElementTransitionDuration from '../get/getElementTransitionDuration'; | ||
@@ -9,3 +9,3 @@ /** | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {EventListener} handler `transitionend` callback | ||
@@ -12,0 +12,0 @@ */ |
import supportTransition from '../boolean/supportTransition'; | ||
import transitionEndEvent from '../strings/transitionEndEventLegacy'; | ||
import getElementTransitionDelay from './getElementTransitionDelayLegacy'; | ||
import getElementTransitionDuration from './getElementTransitionDurationLegacy'; | ||
import getElementTransitionDelay from '../get/getElementTransitionDelayLegacy'; | ||
import getElementTransitionDuration from '../get/getElementTransitionDurationLegacy'; | ||
@@ -10,3 +10,3 @@ /** | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {EventListener} handler `transitionend` callback | ||
@@ -13,0 +13,0 @@ */ |
/** | ||
* Utility to focus an `HTMLElement` target. | ||
* | ||
* @param {HTMLElement} element is the target | ||
* @param {SHORTER.ElementNodes} element is the target | ||
*/ | ||
// @ts-ignore -- `Element`s resulted from querySelector can focus too | ||
const focus = (element) => element.focus(); | ||
export default focus; |
@@ -5,5 +5,5 @@ import normalizeValue from './normalizeValue'; | ||
/** | ||
* Utility to normalize component options | ||
* Utility to normalize component options. | ||
* | ||
* @param {HTMLElement} element target | ||
* @param {SHORTER.ElementNodes} element target | ||
* @param {Record<string, any>} defaultOps component default options | ||
@@ -15,2 +15,3 @@ * @param {Record<string, any>} inputOps component instance options | ||
export default function normalizeOptions(element, defaultOps, inputOps, ns) { | ||
// @ts-ignore -- our targets are always `HTMLElement` | ||
const data = { ...element.dataset }; | ||
@@ -17,0 +18,0 @@ /** @type {Record<string, any>} */ |
@@ -1,11 +0,6 @@ | ||
// general event options | ||
// not suited for scroll prevention | ||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection | ||
import supportPassive from '../boolean/supportPassive'; | ||
/** | ||
* A global namespace for most scroll event listeners. | ||
*/ | ||
const passiveHandler = supportPassive ? { passive: true } : false; | ||
const passiveHandler = { passive: true }; | ||
export default passiveHandler; |
/** | ||
* Utility to force re-paint of an `HTMLElement` target. | ||
* | ||
* @param {HTMLElement} element is the target | ||
* @param {SHORTER.ElementNodes} element is the target | ||
* @return {number} the `Element.offsetHeight` value | ||
*/ | ||
// @ts-ignore | ||
const reflow = (element) => element.offsetHeight; | ||
export default reflow; |
import querySelector from '../selectors/querySelector'; | ||
/** @type {Map<HTMLElement, any>} */ | ||
/** @type {Map<SHORTER.ElementNodes, any>} */ | ||
const TimeCache = new Map(); | ||
@@ -12,3 +12,3 @@ /** | ||
* Sets a new timeout timer for an element, or element -> key association. | ||
* @param {HTMLElement | string} target target element | ||
* @param {SHORTER.ElementNodes | 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 {HTMLElement | string} target target element | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string=} key a unique | ||
@@ -62,4 +62,4 @@ * @returns {ReturnType<TimerHandler>?} the timer | ||
* Clears the element's timer. | ||
* @param {HTMLElement} target target element | ||
* @param {string=} key a unique | ||
* @param {SHORTER.ElementNodes | string} target target element | ||
* @param {string=} key a unique key | ||
*/ | ||
@@ -66,0 +66,0 @@ clear: (target, key) => { |
/** | ||
* Shortcut for `HTMLElement.closest` method. | ||
* Shortcut for `HTMLElement.closest` method which also works | ||
* with children of `ShadowRoot`. The order of the parameters | ||
* is intentional since they're both required. | ||
* | ||
* @param {HTMLElement} element optional Element to look into | ||
* @see https://stackoverflow.com/q/54520554/803358 | ||
* | ||
* @param {SHORTER.ElementNodes} element Element to look into | ||
* @param {string} selector the selector name | ||
* @return {HTMLElement?} the query result | ||
* @return {SHORTER.ElementNodes?} the query result | ||
*/ | ||
export default function closest(element, selector) { | ||
if (element && selector) return element.closest(selector); | ||
return null; | ||
return (element && element.closest(selector)) | ||
// @ts-ignore -- break out of `ShadowRoot` | ||
|| closest(element.getRootNode().host, selector); | ||
} |
@@ -1,14 +0,16 @@ | ||
import isHTMLElement from '../misc/isHTMLElement'; | ||
import getDocument from '../get/getDocument'; | ||
import parentNodes from './parentNodes'; | ||
/** | ||
* Shortcut for `HTMLElement.getElementsByClassName` method. | ||
* Shortcut for `HTMLElement.getElementsByClassName` method. Some `Node` elements | ||
* like `ShadowRoot` do not support `getElementsByClassName`. | ||
* | ||
* @param {string} selector the class name | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
* @param {(SHORTER.ElementNodes | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<SHORTER.ElementNodes>} the 'HTMLCollection' | ||
*/ | ||
export default function getElementsByClassName(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
// @ts-ignore | ||
const lookUp = parent && parentNodes.some((x) => parent instanceof x) | ||
? parent : getDocument(); | ||
return lookUp.getElementsByClassName(selector); | ||
} |
@@ -1,14 +0,16 @@ | ||
import isHTMLElement from '../misc/isHTMLElement'; | ||
import getDocument from '../get/getDocument'; | ||
import parentNodes from './parentNodes'; | ||
/** | ||
* Shortcut for `HTMLElement.getElementsByTagName` method. | ||
* Shortcut for `HTMLElement.getElementsByTagName` method. Some `Node` elements | ||
* like `ShadowRoot` do not support `getElementsByTagName`. | ||
* | ||
* @param {string} selector the tag name | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection' | ||
* @param {(SHORTER.ElementNodes | Document)=} parent optional Element to look into | ||
* @return {HTMLCollectionOf<SHORTER.ElementNodes>} the 'HTMLCollection' | ||
*/ | ||
export default function getElementsByTagName(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
// @ts-ignore | ||
const lookUp = parent && parentNodes | ||
.some((x) => parent instanceof x) ? parent : getDocument(); | ||
return lookUp.getElementsByTagName(selector); | ||
} |
@@ -1,14 +0,23 @@ | ||
import isHTMLElement from '../misc/isHTMLElement'; | ||
import getDocument from '../get/getDocument'; | ||
import parentNodes from './parentNodes'; | ||
import elementNodes from './elementNodes'; | ||
/** | ||
* Utility to check if target is typeof `HTMLElement` | ||
* Utility to check if target is typeof `HTMLElement`, `Element`, `Node` | ||
* or find one that matches a selector. | ||
* | ||
* @param {HTMLElement | string} selector the input selector or target element | ||
* @param {HTMLElement=} parent optional `HTMLElement` to look into | ||
* @return {HTMLElement?} the `HTMLElement` or `querySelector` result | ||
* @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 | ||
*/ | ||
export default function querySelector(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
return typeof selector === 'object' ? selector : lookUp.querySelector(selector); | ||
const selectorIsString = typeof selector === 'string'; | ||
const lookUp = parent && parentNodes.some((x) => parent instanceof x) | ||
? parent : getDocument(); | ||
if (!selectorIsString && [...elementNodes].some((x) => selector instanceof x)) { | ||
return selector; | ||
} | ||
// @ts-ignore -- `ShadowRoot` is also a node | ||
return selectorIsString ? lookUp.querySelector(selector) : null; | ||
} |
@@ -1,2 +0,3 @@ | ||
import isHTMLElement from '../misc/isHTMLElement'; | ||
import getDocument from '../get/getDocument'; | ||
import parentNodes from './parentNodes'; | ||
@@ -7,8 +8,10 @@ /** | ||
* @param {string} selector the input selector | ||
* @param {HTMLElement=} parent optional Element to look into | ||
* @return {NodeListOf<HTMLElement>} the query result | ||
* @param {(SHORTER.ParentNodes)=} parent optional node to look into | ||
* @return {NodeListOf<SHORTER.ElementNodes>} the query result | ||
*/ | ||
export default function querySelectorAll(selector, parent) { | ||
const lookUp = parent && isHTMLElement(parent) ? parent : document; | ||
const lookUp = parent && parentNodes | ||
.some((x) => parent instanceof x) ? parent : getDocument(); | ||
// @ts-ignore -- `ShadowRoot` is also a node | ||
return lookUp.querySelectorAll(selector); | ||
} |
/** | ||
* A global namespace for 'transitionProperty' string. | ||
* A global namespace for: | ||
* * `transitionProperty` string for Firefox, | ||
* * `transition` property for all other browsers. | ||
* | ||
* @type {string} | ||
@@ -4,0 +7,0 @@ */ |
/** | ||
* A global namespace for 'transitionProperty' string. | ||
* A global namespace for: | ||
* * `transitionProperty` string for Firefox, | ||
* * `webkitTransition` for older Chrome / Safari browsers, | ||
* * `transition` property for all other browsers. | ||
* @type {string} | ||
*/ | ||
const transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty'; | ||
export default transitionProperty; |
@@ -0,6 +1,8 @@ | ||
// @ts-ignore | ||
const { userAgentData: userAgentDATA } = navigator; | ||
/** | ||
* A global namespace for `userAgentData` event. | ||
* @type {string} | ||
*/ | ||
const userAgentData = 'userAgentData'; | ||
const userAgentData = userAgentDATA; | ||
export default userAgentData; |
export as namespace SHORTER; | ||
import './shorter'; | ||
export { default as ariaChecked } from "shorter-js/src/strings/ariaChecked"; | ||
export { default as ariaDescribedBy } from "shorter-js/src/strings/ariaDescribedBy"; | ||
export { default as ariaExpanded } from "shorter-js/src/strings/ariaExpanded"; | ||
export { default as ariaHidden } from "shorter-js/src/strings/ariaHidden"; | ||
export { default as ariaLabel } from "shorter-js/src/strings/ariaLabel"; | ||
export { default as ariaLabelledBy } from "shorter-js/src/strings/ariaLabelledBy"; | ||
export { default as ariaModal } from "shorter-js/src/strings/ariaModal"; | ||
export { default as ariaPressed } from "shorter-js/src/strings/ariaPressed"; | ||
export { default as ariaSelected } from "shorter-js/src/strings/ariaSelected"; | ||
export { default as nativeEvents } from "shorter-js/src/strings/nativeEvents"; | ||
export { default as abortEvent } from "shorter-js/src/strings/abortEvent"; | ||
export { default as blurEvent } from "shorter-js/src/strings/blurEvent"; | ||
export { default as moveEvent } from "shorter-js/src/strings/moveEvent"; | ||
export { default as changeEvent } from "shorter-js/src/strings/changeEvent"; | ||
export { default as errorEvent } from "shorter-js/src/strings/errorEvent"; | ||
export { default as resetEvent } from "shorter-js/src/strings/resetEvent"; | ||
export { default as resizeEvent } from "shorter-js/src/strings/resizeEvent"; | ||
export { default as scrollEvent } from "shorter-js/src/strings/scrollEvent"; | ||
export { default as submitEvent } from "shorter-js/src/strings/submitEvent"; | ||
export { default as loadEvent } from "shorter-js/src/strings/loadEvent"; | ||
export { default as unloadEvent } from "shorter-js/src/strings/unloadEvent"; | ||
export { default as readystatechangeEvent } from "shorter-js/src/strings/readystatechangeEvent"; | ||
export { default as beforeunloadEvent } from "shorter-js/src/strings/beforeunloadEvent"; | ||
export { default as orientationchangeEvent } from "shorter-js/src/strings/orientationchangeEvent"; | ||
export { default as contextmenuEvent } from "shorter-js/src/strings/contextmenuEvent"; | ||
export { default as DOMContentLoadedEvent } from "shorter-js/src/strings/DOMContentLoadedEvent"; | ||
export { default as DOMMouseScrollEvent } from "shorter-js/src/strings/DOMMouseScrollEvent"; | ||
export { default as selectEvent } from "shorter-js/src/strings/selectEvent"; | ||
export { default as selectendEvent } from "shorter-js/src/strings/selectendEvent"; | ||
export { default as selectstartEvent } from "shorter-js/src/strings/selectstartEvent"; | ||
export { default as mouseSwipeEvents } from "shorter-js/src/strings/mouseSwipeEvents"; | ||
export { default as mouseClickEvents } from "shorter-js/src/strings/mouseClickEvents"; | ||
export { default as mouseclickEvent } from "shorter-js/src/strings/mouseclickEvent"; | ||
export { default as mousedblclickEvent } from "shorter-js/src/strings/mousedblclickEvent"; | ||
export { default as mousedownEvent } from "shorter-js/src/strings/mousedownEvent"; | ||
export { default as mouseupEvent } from "shorter-js/src/strings/mouseupEvent"; | ||
export { default as mousehoverEvent } from "shorter-js/src/strings/mousehoverEvent"; | ||
export { default as mouseHoverEvents } from "shorter-js/src/strings/mouseHoverEvents"; | ||
export { default as mouseenterEvent } from "shorter-js/src/strings/mouseenterEvent"; | ||
export { default as mouseleaveEvent } from "shorter-js/src/strings/mouseleaveEvent"; | ||
export { default as mouseinEvent } from "shorter-js/src/strings/mouseinEvent"; | ||
export { default as mouseoutEvent } from "shorter-js/src/strings/mouseoutEvent"; | ||
export { default as mousemoveEvent } from "shorter-js/src/strings/mousemoveEvent"; | ||
export { default as mousewheelEvent } from "shorter-js/src/strings/mousewheelEvent"; | ||
export { default as touchEvents } from "shorter-js/src/strings/touchEvents"; | ||
export { default as touchstartEvent } from "shorter-js/src/strings/touchstartEvent"; | ||
export { default as touchmoveEvent } from "shorter-js/src/strings/touchmoveEvent"; | ||
export { default as touchcancelEvent } from "shorter-js/src/strings/touchcancelEvent"; | ||
export { default as touchendEvent } from "shorter-js/src/strings/touchendEvent"; | ||
export { default as pointercancelEvent } from "shorter-js/src/strings/pointercancelEvent"; | ||
export { default as pointerdownEvent } from "shorter-js/src/strings/pointerdownEvent"; | ||
export { default as pointerleaveEvent } from "shorter-js/src/strings/pointerleaveEvent"; | ||
export { default as pointermoveEvent } from "shorter-js/src/strings/pointermoveEvent"; | ||
export { default as pointerupEvent } from "shorter-js/src/strings/pointerupEvent"; | ||
export { default as focusEvents } from "shorter-js/src/strings/focusEvents"; | ||
export { default as focusEvent } from "shorter-js/src/strings/focusEvent"; | ||
export { default as focusinEvent } from "shorter-js/src/strings/focusinEvent"; | ||
export { default as focusoutEvent } from "shorter-js/src/strings/focusoutEvent"; | ||
export { default as gesturechangeEvent } from "shorter-js/src/strings/gesturechangeEvent"; | ||
export { default as gestureendEvent } from "shorter-js/src/strings/gestureendEvent"; | ||
export { default as gesturestartEvent } from "shorter-js/src/strings/gesturestartEvent"; | ||
export { default as keyboardEventKeys } from "shorter-js/src/strings/keyboardEventKeys"; | ||
export { default as keydownEvent } from "shorter-js/src/strings/keydownEvent"; | ||
export { default as keyupEvent } from "shorter-js/src/strings/keyupEvent"; | ||
export { default as keypressEvent } from "shorter-js/src/strings/keypressEvent"; | ||
export { default as keyAlt } from "shorter-js/src/strings/keyAlt"; | ||
export { default as keyArrowDown } from "shorter-js/src/strings/keyArrowDown"; | ||
export { default as keyArrowUp } from "shorter-js/src/strings/keyArrowUp"; | ||
export { default as keyArrowLeft } from "shorter-js/src/strings/keyArrowLeft"; | ||
export { default as keyArrowRight } from "shorter-js/src/strings/keyArrowRight"; | ||
export { default as keyBackspace } from "shorter-js/src/strings/keyBackspace"; | ||
export { default as keyCapsLock } from "shorter-js/src/strings/keyCapsLock"; | ||
export { default as keyControl } from "shorter-js/src/strings/keyControl"; | ||
export { default as keyDelete } from "shorter-js/src/strings/keyDelete"; | ||
export { default as keyEnter } from "shorter-js/src/strings/keyEnter"; | ||
export { default as keyEscape } from "shorter-js/src/strings/keyEscape"; | ||
export { default as keyInsert } from "shorter-js/src/strings/keyInsert"; | ||
export { default as keyMeta } from "shorter-js/src/strings/keyMeta"; | ||
export { default as keyPause } from "shorter-js/src/strings/keyPause"; | ||
export { default as keyScrollLock } from "shorter-js/src/strings/keyScrollLock"; | ||
export { default as keyShift } from "shorter-js/src/strings/keyShift"; | ||
export { default as keySpace } from "shorter-js/src/strings/keySpace"; | ||
export { default as keyTab } from "shorter-js/src/strings/keyTab"; | ||
export { default as animationDuration } from "shorter-js/src/strings/animationDuration"; | ||
export { default as animationDurationLegacy } from "shorter-js/src/strings/animationDurationLegacy"; | ||
export { default as animationDelay } from "shorter-js/src/strings/animationDelay"; | ||
export { default as animationDelayLegacy } from "shorter-js/src/strings/animationDelayLegacy"; | ||
export { default as animationName } from "shorter-js/src/strings/animationName"; | ||
export { default as animationNameLegacy } from "shorter-js/src/strings/animationNameLegacy"; | ||
export { default as animationEndEvent } from "shorter-js/src/strings/animationEndEvent"; | ||
export { default as animationEndEventLegacy } from "shorter-js/src/strings/animationEndEventLegacy"; | ||
export { default as transitionDuration } from "shorter-js/src/strings/transitionDuration"; | ||
export { default as transitionDurationLegacy } from "shorter-js/src/strings/transitionDurationLegacy"; | ||
export { default as transitionDelay } from "shorter-js/src/strings/transitionDelay"; | ||
export { default as transitionDelayLegacy } from "shorter-js/src/strings/transitionDelayLegacy"; | ||
export { default as transitionEndEvent } from "shorter-js/src/strings/transitionEndEvent"; | ||
export { default as transitionEndEventLegacy } from "shorter-js/src/strings/transitionEndEventLegacy"; | ||
export { default as transitionProperty } from "shorter-js/src/strings/transitionProperty"; | ||
export { default as transitionPropertyLegacy } from "shorter-js/src/strings/transitionPropertyLegacy"; | ||
export { default as addEventListener } from "shorter-js/src/strings/addEventListener"; | ||
export { default as removeEventListener } from "shorter-js/src/strings/removeEventListener"; | ||
export { default as bezierEasings } from "shorter-js/src/strings/bezierEasings"; | ||
export { default as offsetHeight } from "shorter-js/src/strings/offsetHeight"; | ||
export { default as offsetWidth } from "shorter-js/src/strings/offsetWidth"; | ||
export { default as scrollHeight } from "shorter-js/src/strings/scrollHeight"; | ||
export { default as scrollWidth } from "shorter-js/src/strings/scrollWidth"; | ||
export { default as isMobile } from "shorter-js/src/boolean/isMobile"; | ||
export { default as isApple } from "shorter-js/src/boolean/isApple"; | ||
export { default as support3DTransform } from "shorter-js/src/boolean/support3DTransform"; | ||
export { default as supportPassive } from "shorter-js/src/boolean/supportPassive"; | ||
export { default as supportTransform } from "shorter-js/src/boolean/supportTransform"; | ||
export { default as supportTouch } from "shorter-js/src/boolean/supportTouch"; | ||
export { default as supportAnimation } from "shorter-js/src/boolean/supportAnimation"; | ||
export { default as supportTransition } from "shorter-js/src/boolean/supportTransition"; | ||
export { default as addClass } from "shorter-js/src/class/addClass"; | ||
export { default as removeClass } from "shorter-js/src/class/removeClass"; | ||
export { default as hasClass } from "shorter-js/src/class/hasClass"; | ||
export { default as on } from "shorter-js/src/event/on"; | ||
export { default as off } from "shorter-js/src/event/off"; | ||
export { default as one } from "shorter-js/src/event/one"; | ||
export { default as Data } from "shorter-js/src/misc/data"; | ||
export { default as Timer } from "shorter-js/src/misc/timer"; | ||
export { default as emulateAnimationEnd } from "shorter-js/src/misc/emulateAnimationEnd"; | ||
export { default as emulateAnimationEndLegacy } from "shorter-js/src/misc/emulateAnimationEndLegacy"; | ||
export { default as emulateTransitionEnd } from "shorter-js/src/misc/emulateTransitionEnd"; | ||
export { default as emulateTransitionEndLegacy } from "shorter-js/src/misc/emulateTransitionEndLegacy"; | ||
export { default as isElementInScrollRange } from "shorter-js/src/misc/isElementInScrollRange"; | ||
export { default as isElementInViewport } from "shorter-js/src/misc/isElementInViewport"; | ||
export { default as isMedia } from "shorter-js/src/misc/isMedia"; | ||
export { default as isRTL } from "shorter-js/src/misc/isRTL"; | ||
export { default as passiveHandler } from "shorter-js/src/misc/passiveHandler"; | ||
export { default as getElementAnimationDuration } from "shorter-js/src/misc/getElementAnimationDuration"; | ||
export { default as getElementAnimationDurationLegacy } from "shorter-js/src/misc/getElementAnimationDurationLegacy"; | ||
export { default as getElementAnimationDelay } from "shorter-js/src/misc/getElementAnimationDelay"; | ||
export { default as getElementAnimationDelayLegacy } from "shorter-js/src/misc/getElementAnimationDelayLegacy"; | ||
export { default as getElementTransitionDuration } from "shorter-js/src/misc/getElementTransitionDuration"; | ||
export { default as getElementTransitionDurationLegacy } from "shorter-js/src/misc/getElementTransitionDurationLegacy"; | ||
export { default as getElementTransitionDelay } from "shorter-js/src/misc/getElementTransitionDelay"; | ||
export { default as getElementTransitionDelayLegacy } from "shorter-js/src/misc/getElementTransitionDelayLegacy"; | ||
export { default as normalizeValue } from "shorter-js/src/misc/normalizeValue"; | ||
export { default as normalizeOptions } from "shorter-js/src/misc/normalizeOptions"; | ||
export { default as tryWrapper } from "shorter-js/src/misc/tryWrapper"; | ||
export { default as reflow } from "shorter-js/src/misc/reflow"; | ||
export { default as focus } from "shorter-js/src/misc/focus"; | ||
export { default as ArrayFrom } from "shorter-js/src/misc/ArrayFrom"; | ||
export { default as Float32ArrayFrom } from "shorter-js/src/misc/Float32ArrayFrom"; | ||
export { default as Float64ArrayFrom } from "shorter-js/src/misc/Float64ArrayFrom"; | ||
export { default as ObjectKeys } from "shorter-js/src/misc/ObjectKeys"; | ||
export { default as ObjectValues } from "shorter-js/src/misc/ObjectValues"; | ||
export { default as ObjectAssign } from "shorter-js/src/misc/ObjectAssign"; | ||
export { default as getAttribute } from "shorter-js/src/manipulate/getAttribute"; | ||
export { default as setAttribute } from "shorter-js/src/manipulate/setAttribute"; | ||
export { default as removeAttribute } from "shorter-js/src/manipulate/removeAttribute"; | ||
export { default as getElementStyle } from "shorter-js/src/manipulate/getElementStyle"; | ||
export { default as setElementStyle } from "shorter-js/src/manipulate/setElementStyle"; | ||
export { default as isArray } from "shorter-js/src/misc/isArray"; | ||
export { default as isString } from "shorter-js/src/misc/isString"; | ||
export { default as isElement } from "shorter-js/src/misc/isElement"; | ||
export { default as isNodeList } from "shorter-js/src/misc/isNodeList"; | ||
export { default as isHTMLElement } from "shorter-js/src/misc/isHTMLElement"; | ||
export { default as isHTMLCollection } from "shorter-js/src/misc/isHTMLCollection"; | ||
export { default as isElementsArray } from "shorter-js/src/misc/isElementsArray"; | ||
export { default as closest } from "shorter-js/src/selectors/closest"; | ||
export { default as querySelector } from "shorter-js/src/selectors/querySelector"; | ||
export { default as querySelectorAll } from "shorter-js/src/selectors/querySelectorAll"; | ||
export { default as getElementsByTagName } from "shorter-js/src/selectors/getElementsByTagName"; | ||
export { default as getElementsByClassName } from "shorter-js/src/selectors/getElementsByClassName"; | ||
export { default as Version } from "shorter-js/src/misc/version"; | ||
export { default as ariaChecked } from 'shorter-js/src/strings/ariaChecked'; | ||
export { default as ariaDescribedBy } from 'shorter-js/src/strings/ariaDescribedBy'; | ||
export { default as ariaExpanded } from 'shorter-js/src/strings/ariaExpanded'; | ||
export { default as ariaHidden } from 'shorter-js/src/strings/ariaHidden'; | ||
export { default as ariaLabel } from 'shorter-js/src/strings/ariaLabel'; | ||
export { default as ariaLabelledBy } from 'shorter-js/src/strings/ariaLabelledBy'; | ||
export { default as ariaModal } from 'shorter-js/src/strings/ariaModal'; | ||
export { default as ariaPressed } from 'shorter-js/src/strings/ariaPressed'; | ||
export { default as ariaSelected } from 'shorter-js/src/strings/ariaSelected'; | ||
export { default as nativeEvents } from 'shorter-js/src/strings/nativeEvents'; | ||
export { default as abortEvent } from 'shorter-js/src/strings/abortEvent'; | ||
export { default as blurEvent } from 'shorter-js/src/strings/blurEvent'; | ||
export { default as moveEvent } from 'shorter-js/src/strings/moveEvent'; | ||
export { default as changeEvent } from 'shorter-js/src/strings/changeEvent'; | ||
export { default as errorEvent } from 'shorter-js/src/strings/errorEvent'; | ||
export { default as resetEvent } from 'shorter-js/src/strings/resetEvent'; | ||
export { default as resizeEvent } from 'shorter-js/src/strings/resizeEvent'; | ||
export { default as scrollEvent } from 'shorter-js/src/strings/scrollEvent'; | ||
export { default as submitEvent } from 'shorter-js/src/strings/submitEvent'; | ||
export { default as loadEvent } from 'shorter-js/src/strings/loadEvent'; | ||
export { default as unloadEvent } from 'shorter-js/src/strings/unloadEvent'; | ||
export { default as readystatechangeEvent } from 'shorter-js/src/strings/readystatechangeEvent'; | ||
export { default as beforeunloadEvent } from 'shorter-js/src/strings/beforeunloadEvent'; | ||
export { default as orientationchangeEvent } from 'shorter-js/src/strings/orientationchangeEvent'; | ||
export { default as contextmenuEvent } from 'shorter-js/src/strings/contextmenuEvent'; | ||
export { default as DOMContentLoadedEvent } from 'shorter-js/src/strings/DOMContentLoadedEvent'; | ||
export { default as DOMMouseScrollEvent } from 'shorter-js/src/strings/DOMMouseScrollEvent'; | ||
export { default as selectEvent } from 'shorter-js/src/strings/selectEvent'; | ||
export { default as selectendEvent } from 'shorter-js/src/strings/selectendEvent'; | ||
export { default as selectstartEvent } from 'shorter-js/src/strings/selectstartEvent'; | ||
export { default as mouseSwipeEvents } from 'shorter-js/src/strings/mouseSwipeEvents'; | ||
export { default as mouseClickEvents } from 'shorter-js/src/strings/mouseClickEvents'; | ||
export { default as mouseclickEvent } from 'shorter-js/src/strings/mouseclickEvent'; | ||
export { default as mousedblclickEvent } from 'shorter-js/src/strings/mousedblclickEvent'; | ||
export { default as mousedownEvent } from 'shorter-js/src/strings/mousedownEvent'; | ||
export { default as mouseupEvent } from 'shorter-js/src/strings/mouseupEvent'; | ||
export { default as mousehoverEvent } from 'shorter-js/src/strings/mousehoverEvent'; | ||
export { default as mouseHoverEvents } from 'shorter-js/src/strings/mouseHoverEvents'; | ||
export { default as mouseenterEvent } from 'shorter-js/src/strings/mouseenterEvent'; | ||
export { default as mouseleaveEvent } from 'shorter-js/src/strings/mouseleaveEvent'; | ||
export { default as mouseinEvent } from 'shorter-js/src/strings/mouseinEvent'; | ||
export { default as mouseoutEvent } from 'shorter-js/src/strings/mouseoutEvent'; | ||
export { default as mousemoveEvent } from 'shorter-js/src/strings/mousemoveEvent'; | ||
export { default as mousewheelEvent } from 'shorter-js/src/strings/mousewheelEvent'; | ||
export { default as touchEvents } from 'shorter-js/src/strings/touchEvents'; | ||
export { default as touchstartEvent } from 'shorter-js/src/strings/touchstartEvent'; | ||
export { default as touchmoveEvent } from 'shorter-js/src/strings/touchmoveEvent'; | ||
export { default as touchcancelEvent } from 'shorter-js/src/strings/touchcancelEvent'; | ||
export { default as touchendEvent } from 'shorter-js/src/strings/touchendEvent'; | ||
export { default as pointercancelEvent } from 'shorter-js/src/strings/pointercancelEvent'; | ||
export { default as pointerdownEvent } from 'shorter-js/src/strings/pointerdownEvent'; | ||
export { default as pointerleaveEvent } from 'shorter-js/src/strings/pointerleaveEvent'; | ||
export { default as pointermoveEvent } from 'shorter-js/src/strings/pointermoveEvent'; | ||
export { default as pointerupEvent } from 'shorter-js/src/strings/pointerupEvent'; | ||
export { default as focusEvents } from 'shorter-js/src/strings/focusEvents'; | ||
export { default as focusEvent } from 'shorter-js/src/strings/focusEvent'; | ||
export { default as focusinEvent } from 'shorter-js/src/strings/focusinEvent'; | ||
export { default as focusoutEvent } from 'shorter-js/src/strings/focusoutEvent'; | ||
export { default as gesturechangeEvent } from 'shorter-js/src/strings/gesturechangeEvent'; | ||
export { default as gestureendEvent } from 'shorter-js/src/strings/gestureendEvent'; | ||
export { default as gesturestartEvent } from 'shorter-js/src/strings/gesturestartEvent'; | ||
export { default as keyboardEventKeys } from 'shorter-js/src/strings/keyboardEventKeys'; | ||
export { default as keydownEvent } from 'shorter-js/src/strings/keydownEvent'; | ||
export { default as keyupEvent } from 'shorter-js/src/strings/keyupEvent'; | ||
export { default as keypressEvent } from 'shorter-js/src/strings/keypressEvent'; | ||
export { default as keyAlt } from 'shorter-js/src/strings/keyAlt'; | ||
export { default as keyArrowDown } from 'shorter-js/src/strings/keyArrowDown'; | ||
export { default as keyArrowUp } from 'shorter-js/src/strings/keyArrowUp'; | ||
export { default as keyArrowLeft } from 'shorter-js/src/strings/keyArrowLeft'; | ||
export { default as keyArrowRight } from 'shorter-js/src/strings/keyArrowRight'; | ||
export { default as keyBackspace } from 'shorter-js/src/strings/keyBackspace'; | ||
export { default as keyCapsLock } from 'shorter-js/src/strings/keyCapsLock'; | ||
export { default as keyControl } from 'shorter-js/src/strings/keyControl'; | ||
export { default as keyDelete } from 'shorter-js/src/strings/keyDelete'; | ||
export { default as keyEnter } from 'shorter-js/src/strings/keyEnter'; | ||
export { default as keyEscape } from 'shorter-js/src/strings/keyEscape'; | ||
export { default as keyInsert } from 'shorter-js/src/strings/keyInsert'; | ||
export { default as keyMeta } from 'shorter-js/src/strings/keyMeta'; | ||
export { default as keyPause } from 'shorter-js/src/strings/keyPause'; | ||
export { default as keyScrollLock } from 'shorter-js/src/strings/keyScrollLock'; | ||
export { default as keyShift } from 'shorter-js/src/strings/keyShift'; | ||
export { default as keySpace } from 'shorter-js/src/strings/keySpace'; | ||
export { default as keyTab } from 'shorter-js/src/strings/keyTab'; | ||
export { default as animationDuration } from 'shorter-js/src/strings/animationDuration'; | ||
export { default as animationDurationLegacy } from 'shorter-js/src/strings/animationDurationLegacy'; | ||
export { default as animationDelay } from 'shorter-js/src/strings/animationDelay'; | ||
export { default as animationDelayLegacy } from 'shorter-js/src/strings/animationDelayLegacy'; | ||
export { default as animationName } from 'shorter-js/src/strings/animationName'; | ||
export { default as animationNameLegacy } from 'shorter-js/src/strings/animationNameLegacy'; | ||
export { default as animationEndEvent } from 'shorter-js/src/strings/animationEndEvent'; | ||
export { default as animationEndEventLegacy } from 'shorter-js/src/strings/animationEndEventLegacy'; | ||
export { default as transitionDuration } from 'shorter-js/src/strings/transitionDuration'; | ||
export { default as transitionDurationLegacy } from 'shorter-js/src/strings/transitionDurationLegacy'; | ||
export { default as transitionDelay } from 'shorter-js/src/strings/transitionDelay'; | ||
export { default as transitionDelayLegacy } from 'shorter-js/src/strings/transitionDelayLegacy'; | ||
export { default as transitionEndEvent } from 'shorter-js/src/strings/transitionEndEvent'; | ||
export { default as transitionEndEventLegacy } from 'shorter-js/src/strings/transitionEndEventLegacy'; | ||
export { default as transitionProperty } from 'shorter-js/src/strings/transitionProperty'; | ||
export { default as transitionPropertyLegacy } from 'shorter-js/src/strings/transitionPropertyLegacy'; | ||
export { default as addEventListener } from 'shorter-js/src/strings/addEventListener'; | ||
export { default as removeEventListener } from 'shorter-js/src/strings/removeEventListener'; | ||
export { default as bezierEasings } from 'shorter-js/src/strings/bezierEasings'; | ||
export { default as offsetHeight } from 'shorter-js/src/strings/offsetHeight'; | ||
export { default as offsetWidth } from 'shorter-js/src/strings/offsetWidth'; | ||
export { default as scrollHeight } from 'shorter-js/src/strings/scrollHeight'; | ||
export { default as scrollWidth } from 'shorter-js/src/strings/scrollWidth'; | ||
export { default as userAgentData } from 'shorter-js/src/strings/userAgentData'; | ||
export { default as userAgent } from 'shorter-js/src/strings/userAgent'; | ||
export { default as isApple } from 'shorter-js/src/boolean/isApple'; | ||
export { default as isFirefox } from 'shorter-js/src/boolean/isFirefox'; | ||
export { default as isMobile } from 'shorter-js/src/boolean/isMobile'; | ||
export { default as support3DTransform } from 'shorter-js/src/boolean/support3DTransform'; | ||
export { default as supportAnimation } from 'shorter-js/src/boolean/supportAnimation'; | ||
export { default as supportPassive } from 'shorter-js/src/boolean/supportPassive'; | ||
export { default as supportTouch } from 'shorter-js/src/boolean/supportTouch'; | ||
export { default as supportTransform } from 'shorter-js/src/boolean/supportTransform'; | ||
export { default as supportTransition } from 'shorter-js/src/boolean/supportTransition'; | ||
export { default as getAttribute } from 'shorter-js/src/attr/getAttribute'; | ||
export { default as getAttributeNS } from 'shorter-js/src/attr/getAttributeNS'; | ||
export { default as setAttribute } from 'shorter-js/src/attr/setAttribute'; | ||
export { default as setAttributeNS } from 'shorter-js/src/attr/setAttributeNS'; | ||
export { default as removeAttribute } from 'shorter-js/src/attr/removeAttribute'; | ||
export { default as removeAttributeNS } from 'shorter-js/src/attr/removeAttributeNS'; | ||
export { default as getBoundingClientRect } from 'shorter-js/src/get/getBoundingClientRect'; | ||
export { default as getDocument } from 'shorter-js/src/get/getDocument'; | ||
export { default as getDocumentBody } from 'shorter-js/src/get/getDocumentBody'; | ||
export { default as getDocumentElement } from 'shorter-js/src/get/getDocumentElement'; | ||
export { default as getDocumentHead } from 'shorter-js/src/get/getDocumentHead'; | ||
export { default as getElementAnimationDuration } from 'shorter-js/src/get/getElementAnimationDuration'; | ||
export { default as getElementAnimationDurationLegacy } from 'shorter-js/src/get/getElementAnimationDurationLegacy'; | ||
export { default as getElementAnimationDelay } from 'shorter-js/src/get/getElementAnimationDelay'; | ||
export { default as getElementAnimationDelayLegacy } from 'shorter-js/src/get/getElementAnimationDelayLegacy'; | ||
export { default as getElementStyle } from 'shorter-js/src/get/getElementStyle'; | ||
export { default as getElementTransitionDuration } from 'shorter-js/src/get/getElementTransitionDuration'; | ||
export { default as getElementTransitionDurationLegacy } from 'shorter-js/src/get/getElementTransitionDurationLegacy'; | ||
export { default as getElementTransitionDelay } from 'shorter-js/src/get/getElementTransitionDelay'; | ||
export { default as getElementTransitionDelayLegacy } from 'shorter-js/src/get/getElementTransitionDelayLegacy'; | ||
export { default as getNodeScroll } from 'shorter-js/src/get/getNodeScroll'; | ||
export { default as getParentNode } from 'shorter-js/src/get/getParentNode'; | ||
export { default as getRectRelativeToOffsetParent } from 'shorter-js/src/get/getRectRelativeToOffsetParent'; | ||
export { default as getWindow } from 'shorter-js/src/get/getWindow'; | ||
export { default as addClass } from 'shorter-js/src/class/addClass'; | ||
export { default as removeClass } from 'shorter-js/src/class/removeClass'; | ||
export { default as hasClass } from 'shorter-js/src/class/hasClass'; | ||
export { default as on } from 'shorter-js/src/event/on'; | ||
export { default as off } from 'shorter-js/src/event/off'; | ||
export { default as one } from 'shorter-js/src/event/one'; | ||
export { default as Data } from 'shorter-js/src/misc/data'; | ||
export { default as distinct } from 'shorter-js/src/misc/distinct'; | ||
export { default as Timer } from 'shorter-js/src/misc/timer'; | ||
export { default as emulateAnimationEnd } from 'shorter-js/src/misc/emulateAnimationEnd'; | ||
export { default as emulateAnimationEndLegacy } from 'shorter-js/src/misc/emulateAnimationEndLegacy'; | ||
export { default as emulateTransitionEnd } from 'shorter-js/src/misc/emulateTransitionEnd'; | ||
export { default as emulateTransitionEndLegacy } from 'shorter-js/src/misc/emulateTransitionEndLegacy'; | ||
export { default as passiveHandler } from 'shorter-js/src/misc/passiveHandler'; | ||
export { default as setElementStyle } from 'shorter-js/src/misc/setElementStyle'; | ||
export { default as normalizeValue } from 'shorter-js/src/misc/normalizeValue'; | ||
export { default as normalizeOptions } from 'shorter-js/src/misc/normalizeOptions'; | ||
export { default as tryWrapper } from 'shorter-js/src/misc/tryWrapper'; | ||
export { default as reflow } from 'shorter-js/src/misc/reflow'; | ||
export { default as focus } from 'shorter-js/src/misc/focus'; | ||
export { default as ArrayFrom } from 'shorter-js/src/misc/ArrayFrom'; | ||
export { default as Float32ArrayFrom } from 'shorter-js/src/misc/Float32ArrayFrom'; | ||
export { default as Float64ArrayFrom } from 'shorter-js/src/misc/Float64ArrayFrom'; | ||
export { default as ObjectKeys } from 'shorter-js/src/misc/ObjectKeys'; | ||
export { default as ObjectValues } from 'shorter-js/src/misc/ObjectValues'; | ||
export { default as ObjectAssign } from 'shorter-js/src/misc/ObjectAssign'; | ||
export { default as isArray } from 'shorter-js/src/is/isArray'; | ||
export { default as isDocument } from 'shorter-js/src/is/isDocument'; | ||
export { default as isElement } from 'shorter-js/src/is/isElement'; | ||
export { default as isCustomElement } from 'shorter-js/src/is/isCustomElement'; | ||
export { default as isElementInScrollRange } from 'shorter-js/src/is/isElementInScrollRange'; | ||
export { default as isElementInViewport } from 'shorter-js/src/is/isElementInViewport'; | ||
export { default as isElementsArray } from 'shorter-js/src/is/isElementsArray'; | ||
export { default as isHTMLCollection } from 'shorter-js/src/is/isHTMLCollection'; | ||
export { default as isHTMLElement } from 'shorter-js/src/is/isHTMLElement'; | ||
export { default as isHTMLImageElement } from 'shorter-js/src/is/isHTMLImageElement'; | ||
export { default as isMedia } from 'shorter-js/src/is/isMedia'; | ||
export { default as isNode } from 'shorter-js/src/is/isNode'; | ||
export { default as isNodeList } from 'shorter-js/src/is/isNodeList'; | ||
export { default as isRTL } from 'shorter-js/src/is/isRTL'; | ||
export { default as isScaledElement } from 'shorter-js/src/is/isScaledElement'; | ||
export { default as isShadowRoot } from 'shorter-js/src/is/isShadowRoot'; | ||
export { default as isString } from 'shorter-js/src/is/isString'; | ||
export { default as isSVGElement } from 'shorter-js/src/is/isSVGElement'; | ||
export { default as isTableElement } from 'shorter-js/src/is/isTableElement'; | ||
export { default as isWindow } from 'shorter-js/src/is/isWindow'; | ||
export { default as parentNodes } from 'shorter-js/src/selectors/parentNodes'; | ||
export { default as elementNodes } from 'shorter-js/src/selectors/elementNodes'; | ||
export { default as closest } from 'shorter-js/src/selectors/closest'; | ||
export { default as getCustomElements } from 'shorter-js/src/selectors/getCustomElements'; | ||
export { default as querySelector } from 'shorter-js/src/selectors/querySelector'; | ||
export { default as querySelectorAll } from 'shorter-js/src/selectors/querySelectorAll'; | ||
export { default as getElementsByTagName } from 'shorter-js/src/selectors/getElementsByTagName'; | ||
export { default as getElementsByClassName } from 'shorter-js/src/selectors/getElementsByClassName'; | ||
export { default as Version } from 'shorter-js/src/misc/version'; | ||
export { | ||
Component, | ||
getInstance, | ||
} from './module/types' | ||
export type Component = Record<string, any>; | ||
export type getInstance<T> = (target: ElementNodes | string, component: string) => T | null; | ||
export interface BoundingClientRect { | ||
width: number, | ||
height: number, | ||
top: number, | ||
left: number, | ||
right: number, | ||
bottom: number, | ||
x: number, | ||
y: number, | ||
} | ||
export interface OffsetRect { | ||
width: number, | ||
height: number, | ||
x: number, | ||
y: number, | ||
} | ||
export type ElementNodes = HTMLElement | Element; | ||
export type ParentNodes = Document | ElementNodes | Node; // ShadowRoot is a Node too |
// strings | ||
export { default as ariaChecked } from "../../src/strings/ariaChecked"; | ||
export { default as ariaDescribedBy } from "../../src/strings/ariaDescribedBy"; | ||
export { default as ariaExpanded } from "../../src/strings/ariaExpanded"; | ||
export { default as ariaHidden } from "../../src/strings/ariaHidden"; | ||
export { default as ariaLabel } from "../../src/strings/ariaLabel"; | ||
export { default as ariaLabelledBy } from "../../src/strings/ariaLabelledBy"; | ||
export { default as ariaModal } from "../../src/strings/ariaModal"; | ||
export { default as ariaPressed } from "../../src/strings/ariaPressed"; | ||
export { default as ariaSelected } from "../../src/strings/ariaSelected"; | ||
export { default as ariaChecked } from '../../src/strings/ariaChecked'; | ||
export { default as ariaDescribedBy } from '../../src/strings/ariaDescribedBy'; | ||
export { default as ariaExpanded } from '../../src/strings/ariaExpanded'; | ||
export { default as ariaHidden } from '../../src/strings/ariaHidden'; | ||
export { default as ariaLabel } from '../../src/strings/ariaLabel'; | ||
export { default as ariaLabelledBy } from '../../src/strings/ariaLabelledBy'; | ||
export { default as ariaModal } from '../../src/strings/ariaModal'; | ||
export { default as ariaPressed } from '../../src/strings/ariaPressed'; | ||
export { default as ariaSelected } from '../../src/strings/ariaSelected'; | ||
export { default as nativeEvents } from "../../src/strings/nativeEvents"; | ||
export { default as abortEvent } from "../../src/strings/abortEvent"; | ||
export { default as blurEvent } from "../../src/strings/blurEvent"; | ||
export { default as moveEvent } from "../../src/strings/moveEvent"; | ||
export { default as changeEvent } from "../../src/strings/changeEvent"; | ||
export { default as errorEvent } from "../../src/strings/errorEvent"; | ||
export { default as resetEvent } from "../../src/strings/resetEvent"; | ||
export { default as resizeEvent } from "../../src/strings/resizeEvent"; | ||
export { default as scrollEvent } from "../../src/strings/scrollEvent"; | ||
export { default as submitEvent } from "../../src/strings/submitEvent"; | ||
export { default as loadEvent } from "../../src/strings/loadEvent"; | ||
export { default as unloadEvent } from "../../src/strings/unloadEvent"; | ||
export { default as readystatechangeEvent } from "../../src/strings/readystatechangeEvent"; | ||
export { default as beforeunloadEvent } from "../../src/strings/beforeunloadEvent"; | ||
export { default as orientationchangeEvent } from "../../src/strings/orientationchangeEvent"; | ||
export { default as contextmenuEvent } from "../../src/strings/contextmenuEvent"; | ||
export { default as DOMContentLoadedEvent } from "../../src/strings/DOMContentLoadedEvent"; | ||
export { default as DOMMouseScrollEvent } from "../../src/strings/DOMMouseScrollEvent"; | ||
export { default as nativeEvents } from '../../src/strings/nativeEvents'; | ||
export { default as abortEvent } from '../../src/strings/abortEvent'; | ||
export { default as blurEvent } from '../../src/strings/blurEvent'; | ||
export { default as moveEvent } from '../../src/strings/moveEvent'; | ||
export { default as changeEvent } from '../../src/strings/changeEvent'; | ||
export { default as errorEvent } from '../../src/strings/errorEvent'; | ||
export { default as resetEvent } from '../../src/strings/resetEvent'; | ||
export { default as resizeEvent } from '../../src/strings/resizeEvent'; | ||
export { default as scrollEvent } from '../../src/strings/scrollEvent'; | ||
export { default as submitEvent } from '../../src/strings/submitEvent'; | ||
export { default as loadEvent } from '../../src/strings/loadEvent'; | ||
export { default as unloadEvent } from '../../src/strings/unloadEvent'; | ||
export { default as readystatechangeEvent } from '../../src/strings/readystatechangeEvent'; | ||
export { default as beforeunloadEvent } from '../../src/strings/beforeunloadEvent'; | ||
export { default as orientationchangeEvent } from '../../src/strings/orientationchangeEvent'; | ||
export { default as contextmenuEvent } from '../../src/strings/contextmenuEvent'; | ||
export { default as DOMContentLoadedEvent } from '../../src/strings/DOMContentLoadedEvent'; | ||
export { default as DOMMouseScrollEvent } from '../../src/strings/DOMMouseScrollEvent'; | ||
export { default as selectEvent } from "../../src/strings/selectEvent"; | ||
export { default as selectendEvent } from "../../src/strings/selectendEvent"; | ||
export { default as selectstartEvent } from "../../src/strings/selectstartEvent"; | ||
export { default as selectEvent } from '../../src/strings/selectEvent'; | ||
export { default as selectendEvent } from '../../src/strings/selectendEvent'; | ||
export { default as selectstartEvent } from '../../src/strings/selectstartEvent'; | ||
export { default as mouseSwipeEvents } from "../../src/strings/mouseSwipeEvents"; | ||
export { default as mouseClickEvents } from "../../src/strings/mouseClickEvents"; | ||
export { default as mouseclickEvent } from "../../src/strings/mouseclickEvent"; | ||
export { default as mousedblclickEvent } from "../../src/strings/mousedblclickEvent"; | ||
export { default as mousedownEvent } from "../../src/strings/mousedownEvent"; | ||
export { default as mouseupEvent } from "../../src/strings/mouseupEvent"; | ||
export { default as mousehoverEvent } from "../../src/strings/mousehoverEvent"; | ||
export { default as mouseHoverEvents } from "../../src/strings/mouseHoverEvents"; | ||
export { default as mouseenterEvent } from "../../src/strings/mouseenterEvent"; | ||
export { default as mouseleaveEvent } from "../../src/strings/mouseleaveEvent"; | ||
export { default as mouseinEvent } from "../../src/strings/mouseinEvent"; | ||
export { default as mouseoutEvent } from "../../src/strings/mouseoutEvent"; | ||
export { default as mousemoveEvent } from "../../src/strings/mousemoveEvent"; | ||
export { default as mousewheelEvent } from "../../src/strings/mousewheelEvent"; | ||
export { default as mouseSwipeEvents } from '../../src/strings/mouseSwipeEvents'; | ||
export { default as mouseClickEvents } from '../../src/strings/mouseClickEvents'; | ||
export { default as mouseclickEvent } from '../../src/strings/mouseclickEvent'; | ||
export { default as mousedblclickEvent } from '../../src/strings/mousedblclickEvent'; | ||
export { default as mousedownEvent } from '../../src/strings/mousedownEvent'; | ||
export { default as mouseupEvent } from '../../src/strings/mouseupEvent'; | ||
export { default as mousehoverEvent } from '../../src/strings/mousehoverEvent'; | ||
export { default as mouseHoverEvents } from '../../src/strings/mouseHoverEvents'; | ||
export { default as mouseenterEvent } from '../../src/strings/mouseenterEvent'; | ||
export { default as mouseleaveEvent } from '../../src/strings/mouseleaveEvent'; | ||
export { default as mouseinEvent } from '../../src/strings/mouseinEvent'; | ||
export { default as mouseoutEvent } from '../../src/strings/mouseoutEvent'; | ||
export { default as mousemoveEvent } from '../../src/strings/mousemoveEvent'; | ||
export { default as mousewheelEvent } from '../../src/strings/mousewheelEvent'; | ||
export { default as touchEvents } from "../../src/strings/touchEvents"; | ||
export { default as touchstartEvent } from "../../src/strings/touchstartEvent"; | ||
export { default as touchmoveEvent } from "../../src/strings/touchmoveEvent"; | ||
export { default as touchcancelEvent } from "../../src/strings/touchcancelEvent"; | ||
export { default as touchendEvent } from "../../src/strings/touchendEvent"; | ||
export { default as touchEvents } from '../../src/strings/touchEvents'; | ||
export { default as touchstartEvent } from '../../src/strings/touchstartEvent'; | ||
export { default as touchmoveEvent } from '../../src/strings/touchmoveEvent'; | ||
export { default as touchcancelEvent } from '../../src/strings/touchcancelEvent'; | ||
export { default as touchendEvent } from '../../src/strings/touchendEvent'; | ||
export { default as pointercancelEvent } from "../../src/strings/pointercancelEvent"; | ||
export { default as pointerdownEvent } from "../../src/strings/pointerdownEvent"; | ||
export { default as pointerleaveEvent } from "../../src/strings/pointerleaveEvent"; | ||
export { default as pointermoveEvent } from "../../src/strings/pointermoveEvent"; | ||
export { default as pointerupEvent } from "../../src/strings/pointerupEvent"; | ||
export { default as pointercancelEvent } from '../../src/strings/pointercancelEvent'; | ||
export { default as pointerdownEvent } from '../../src/strings/pointerdownEvent'; | ||
export { default as pointerleaveEvent } from '../../src/strings/pointerleaveEvent'; | ||
export { default as pointermoveEvent } from '../../src/strings/pointermoveEvent'; | ||
export { default as pointerupEvent } from '../../src/strings/pointerupEvent'; | ||
export { default as focusEvents } from "../../src/strings/focusEvents"; | ||
export { default as focusEvent } from "../../src/strings/focusEvent"; | ||
export { default as focusinEvent } from "../../src/strings/focusinEvent"; | ||
export { default as focusoutEvent } from "../../src/strings/focusoutEvent"; | ||
export { default as focusEvents } from '../../src/strings/focusEvents'; | ||
export { default as focusEvent } from '../../src/strings/focusEvent'; | ||
export { default as focusinEvent } from '../../src/strings/focusinEvent'; | ||
export { default as focusoutEvent } from '../../src/strings/focusoutEvent'; | ||
export { default as gesturechangeEvent } from "../../src/strings/gesturechangeEvent"; | ||
export { default as gestureendEvent } from "../../src/strings/gestureendEvent"; | ||
export { default as gesturestartEvent } from "../../src/strings/gesturestartEvent"; | ||
export { default as gesturechangeEvent } from '../../src/strings/gesturechangeEvent'; | ||
export { default as gestureendEvent } from '../../src/strings/gestureendEvent'; | ||
export { default as gesturestartEvent } from '../../src/strings/gesturestartEvent'; | ||
export { default as keyboardEventKeys } from "../../src/strings/keyboardEventKeys"; | ||
export { default as keydownEvent } from "../../src/strings/keydownEvent"; | ||
export { default as keyupEvent } from "../../src/strings/keyupEvent"; | ||
export { default as keypressEvent } from "../../src/strings/keypressEvent"; | ||
export { default as keyAlt } from "../../src/strings/keyAlt"; | ||
export { default as keyArrowDown } from "../../src/strings/keyArrowDown"; | ||
export { default as keyArrowUp } from "../../src/strings/keyArrowUp"; | ||
export { default as keyArrowLeft } from "../../src/strings/keyArrowLeft"; | ||
export { default as keyArrowRight } from "../../src/strings/keyArrowRight"; | ||
export { default as keyBackspace } from "../../src/strings/keyBackspace"; | ||
export { default as keyCapsLock } from "../../src/strings/keyCapsLock"; | ||
export { default as keyControl } from "../../src/strings/keyControl"; | ||
export { default as keyDelete } from "../../src/strings/keyDelete"; | ||
export { default as keyEnter } from "../../src/strings/keyEnter"; | ||
export { default as keyEscape } from "../../src/strings/keyEscape"; | ||
export { default as keyInsert } from "../../src/strings/keyInsert"; | ||
export { default as keyMeta } from "../../src/strings/keyMeta"; | ||
export { default as keyPause } from "../../src/strings/keyPause"; | ||
export { default as keyScrollLock } from "../../src/strings/keyScrollLock"; | ||
export { default as keyShift } from "../../src/strings/keyShift"; | ||
export { default as keySpace } from "../../src/strings/keySpace"; | ||
export { default as keyTab } from "../../src/strings/keyTab"; | ||
export { default as keyboardEventKeys } from '../../src/strings/keyboardEventKeys'; | ||
export { default as keydownEvent } from '../../src/strings/keydownEvent'; | ||
export { default as keyupEvent } from '../../src/strings/keyupEvent'; | ||
export { default as keypressEvent } from '../../src/strings/keypressEvent'; | ||
export { default as keyAlt } from '../../src/strings/keyAlt'; | ||
export { default as keyArrowDown } from '../../src/strings/keyArrowDown'; | ||
export { default as keyArrowUp } from '../../src/strings/keyArrowUp'; | ||
export { default as keyArrowLeft } from '../../src/strings/keyArrowLeft'; | ||
export { default as keyArrowRight } from '../../src/strings/keyArrowRight'; | ||
export { default as keyBackspace } from '../../src/strings/keyBackspace'; | ||
export { default as keyCapsLock } from '../../src/strings/keyCapsLock'; | ||
export { default as keyControl } from '../../src/strings/keyControl'; | ||
export { default as keyDelete } from '../../src/strings/keyDelete'; | ||
export { default as keyEnter } from '../../src/strings/keyEnter'; | ||
export { default as keyEscape } from '../../src/strings/keyEscape'; | ||
export { default as keyInsert } from '../../src/strings/keyInsert'; | ||
export { default as keyMeta } from '../../src/strings/keyMeta'; | ||
export { default as keyPause } from '../../src/strings/keyPause'; | ||
export { default as keyScrollLock } from '../../src/strings/keyScrollLock'; | ||
export { default as keyShift } from '../../src/strings/keyShift'; | ||
export { default as keySpace } from '../../src/strings/keySpace'; | ||
export { default as keyTab } from '../../src/strings/keyTab'; | ||
export { default as animationDuration } from "../../src/strings/animationDuration"; | ||
export { default as animationDurationLegacy } from "../../src/strings/animationDurationLegacy"; | ||
export { default as animationDelay } from "../../src/strings/animationDelay"; | ||
export { default as animationDelayLegacy } from "../../src/strings/animationDelayLegacy"; | ||
export { default as animationName } from "../../src/strings/animationName"; | ||
export { default as animationNameLegacy } from "../../src/strings/animationNameLegacy"; | ||
export { default as animationEndEvent } from "../../src/strings/animationEndEvent"; | ||
export { default as animationEndEventLegacy } from "../../src/strings/animationEndEventLegacy"; | ||
export { default as transitionDuration } from "../../src/strings/transitionDuration"; | ||
export { default as transitionDurationLegacy } from "../../src/strings/transitionDurationLegacy"; | ||
export { default as transitionDelay } from "../../src/strings/transitionDelay"; | ||
export { default as transitionDelayLegacy } from "../../src/strings/transitionDelayLegacy"; | ||
export { default as transitionEndEvent } from "../../src/strings/transitionEndEvent"; | ||
export { default as transitionEndEventLegacy } from "../../src/strings/transitionEndEventLegacy"; | ||
export { default as transitionProperty } from "../../src/strings/transitionProperty"; | ||
export { default as transitionPropertyLegacy } from "../../src/strings/transitionPropertyLegacy"; | ||
export { default as animationDuration } from '../../src/strings/animationDuration'; | ||
export { default as animationDurationLegacy } from '../../src/strings/animationDurationLegacy'; | ||
export { default as animationDelay } from '../../src/strings/animationDelay'; | ||
export { default as animationDelayLegacy } from '../../src/strings/animationDelayLegacy'; | ||
export { default as animationName } from '../../src/strings/animationName'; | ||
export { default as animationNameLegacy } from '../../src/strings/animationNameLegacy'; | ||
export { default as animationEndEvent } from '../../src/strings/animationEndEvent'; | ||
export { default as animationEndEventLegacy } from '../../src/strings/animationEndEventLegacy'; | ||
export { default as transitionDuration } from '../../src/strings/transitionDuration'; | ||
export { default as transitionDurationLegacy } from '../../src/strings/transitionDurationLegacy'; | ||
export { default as transitionDelay } from '../../src/strings/transitionDelay'; | ||
export { default as transitionDelayLegacy } from '../../src/strings/transitionDelayLegacy'; | ||
export { default as transitionEndEvent } from '../../src/strings/transitionEndEvent'; | ||
export { default as transitionEndEventLegacy } from '../../src/strings/transitionEndEventLegacy'; | ||
export { default as transitionProperty } from '../../src/strings/transitionProperty'; | ||
export { default as transitionPropertyLegacy } from '../../src/strings/transitionPropertyLegacy'; | ||
export { default as addEventListener } from "../../src/strings/addEventListener"; | ||
export { default as removeEventListener } from "../../src/strings/removeEventListener"; | ||
export { default as addEventListener } from '../../src/strings/addEventListener'; | ||
export { default as removeEventListener } from '../../src/strings/removeEventListener'; | ||
export { default as bezierEasings } from "../../src/strings/bezierEasings"; | ||
export { default as bezierEasings } from '../../src/strings/bezierEasings'; | ||
export { default as offsetHeight } from "../../src/strings/offsetHeight"; | ||
export { default as offsetWidth } from "../../src/strings/offsetWidth"; | ||
export { default as scrollHeight } from "../../src/strings/scrollHeight"; | ||
export { default as scrollWidth } from "../../src/strings/scrollWidth"; | ||
export { default as offsetHeight } from '../../src/strings/offsetHeight'; | ||
export { default as offsetWidth } from '../../src/strings/offsetWidth'; | ||
export { default as scrollHeight } from '../../src/strings/scrollHeight'; | ||
export { default as scrollWidth } from '../../src/strings/scrollWidth'; | ||
export { default as userAgentData } from '../../src/strings/userAgentData'; | ||
export { default as userAgent } from '../../src/strings/userAgent'; | ||
// boolean | ||
export { default as isMobile } from "../../src/boolean/isMobile"; | ||
export { default as isApple } from "../../src/boolean/isApple"; | ||
export { default as support3DTransform } from "../../src/boolean/support3DTransform"; | ||
export { default as supportPassive } from "../../src/boolean/supportPassive"; | ||
export { default as supportTransform } from "../../src/boolean/supportTransform"; | ||
export { default as supportTouch } from "../../src/boolean/supportTouch"; | ||
export { default as supportAnimation } from "../../src/boolean/supportAnimation"; | ||
export { default as supportTransition } from "../../src/boolean/supportTransition"; | ||
export { default as isApple } from '../../src/boolean/isApple'; | ||
export { default as isFirefox } from '../../src/boolean/isFirefox'; | ||
export { default as isMobile } from '../../src/boolean/isMobile'; | ||
export { default as support3DTransform } from '../../src/boolean/support3DTransform'; | ||
export { default as supportAnimation } from '../../src/boolean/supportAnimation'; | ||
export { default as supportPassive } from '../../src/boolean/supportPassive'; | ||
export { default as supportTouch } from '../../src/boolean/supportTouch'; | ||
export { default as supportTransform } from '../../src/boolean/supportTransform'; | ||
export { default as supportTransition } from '../../src/boolean/supportTransition'; | ||
// attributes | ||
export { default as getAttribute } from '../../src/attr/getAttribute'; | ||
export { default as getAttributeNS } from '../../src/attr/getAttributeNS'; | ||
export { default as setAttribute } from '../../src/attr/setAttribute'; | ||
export { default as setAttributeNS } from '../../src/attr/setAttributeNS'; | ||
export { default as removeAttribute } from '../../src/attr/removeAttribute'; | ||
export { default as removeAttributeNS } from '../../src/attr/removeAttributeNS'; | ||
// get | ||
export { default as getBoundingClientRect } from '../../src/get/getBoundingClientRect'; | ||
export { default as getDocument } from '../../src/get/getDocument'; | ||
export { default as getDocumentBody } from '../../src/get/getDocumentBody'; | ||
export { default as getDocumentElement } from '../../src/get/getDocumentElement'; | ||
export { default as getDocumentHead } from '../../src/get/getDocumentHead'; | ||
export { default as getElementAnimationDuration } from '../../src/get/getElementAnimationDuration'; | ||
export { default as getElementAnimationDurationLegacy } from '../../src/get/getElementAnimationDurationLegacy'; | ||
export { default as getElementAnimationDelay } from '../../src/get/getElementAnimationDelay'; | ||
export { default as getElementAnimationDelayLegacy } from '../../src/get/getElementAnimationDelayLegacy'; | ||
export { default as getElementStyle } from '../../src/get/getElementStyle'; | ||
export { default as getElementTransitionDuration } from '../../src/get/getElementTransitionDuration'; | ||
export { default as getElementTransitionDurationLegacy } from '../../src/get/getElementTransitionDurationLegacy'; | ||
export { default as getElementTransitionDelay } from '../../src/get/getElementTransitionDelay'; | ||
export { default as getElementTransitionDelayLegacy } from '../../src/get/getElementTransitionDelayLegacy'; | ||
export { default as getNodeScroll } from '../../src/get/getNodeScroll'; | ||
export { default as getParentNode } from '../../src/get/getParentNode'; | ||
export { default as getRectRelativeToOffsetParent } from '../../src/get/getRectRelativeToOffsetParent'; | ||
export { default as getWindow } from '../../src/get/getWindow'; | ||
// class | ||
export { default as addClass } from "../../src/class/addClass"; | ||
export { default as removeClass } from "../../src/class/removeClass"; | ||
export { default as hasClass } from "../../src/class/hasClass"; | ||
export { default as addClass } from '../../src/class/addClass'; | ||
export { default as removeClass } from '../../src/class/removeClass'; | ||
export { default as hasClass } from '../../src/class/hasClass'; | ||
// event | ||
export { default as on } from "../../src/event/on"; | ||
export { default as off } from "../../src/event/off"; | ||
export { default as one } from "../../src/event/one"; | ||
export { default as on } from '../../src/event/on'; | ||
export { default as off } from '../../src/event/off'; | ||
export { default as one } from '../../src/event/one'; | ||
// misc | ||
export { default as Data, getInstance } from "../../src/misc/data"; | ||
export { default as Timer } from "../../src/misc/timer"; | ||
export { default as emulateAnimationEnd } from "../../src/misc/emulateAnimationEnd"; | ||
export { default as emulateAnimationEndLegacy } from "../../src/misc/emulateAnimationEndLegacy"; | ||
export { default as emulateTransitionEnd } from "../../src/misc/emulateTransitionEnd"; | ||
export { default as emulateTransitionEndLegacy } from "../../src/misc/emulateTransitionEndLegacy"; | ||
export { default as isElementInScrollRange } from "../../src/misc/isElementInScrollRange"; | ||
export { default as isElementInViewport } from "../../src/misc/isElementInViewport"; | ||
export { default as isMedia } from "../../src/misc/isMedia"; | ||
export { default as isRTL } from "../../src/misc/isRTL"; | ||
export { default as passiveHandler } from "../../src/misc/passiveHandler"; | ||
export { default as getElementAnimationDuration } from "../../src/misc/getElementAnimationDuration"; | ||
export { default as getElementAnimationDurationLegacy } from "../../src/misc/getElementAnimationDurationLegacy"; | ||
export { default as getElementAnimationDelay } from "../../src/misc/getElementAnimationDelay"; | ||
export { default as getElementAnimationDelayLegacy } from "../../src/misc/getElementAnimationDelayLegacy"; | ||
export { default as getElementTransitionDuration } from "../../src/misc/getElementTransitionDuration"; | ||
export { default as getElementTransitionDurationLegacy } from "../../src/misc/getElementTransitionDurationLegacy"; | ||
export { default as getElementTransitionDelay } from "../../src/misc/getElementTransitionDelay"; | ||
export { default as getElementTransitionDelayLegacy } from "../../src/misc/getElementTransitionDelayLegacy"; | ||
export { default as normalizeValue } from "../../src/misc/normalizeValue"; | ||
export { default as normalizeOptions } from "../../src/misc/normalizeOptions"; | ||
export { default as tryWrapper } from "../../src/misc/tryWrapper"; | ||
export { default as reflow } from "../../src/misc/reflow"; | ||
export { default as focus } from "../../src/misc/focus"; | ||
export { default as Data, getInstance } from '../../src/misc/data'; | ||
export { default as Timer } from '../../src/misc/timer'; | ||
export { default as distinct } from '../../src/misc/distinct'; | ||
export { default as emulateAnimationEnd } from '../../src/misc/emulateAnimationEnd'; | ||
export { default as emulateAnimationEndLegacy } from '../../src/misc/emulateAnimationEndLegacy'; | ||
export { default as emulateTransitionEnd } from '../../src/misc/emulateTransitionEnd'; | ||
export { default as emulateTransitionEndLegacy } from '../../src/misc/emulateTransitionEndLegacy'; | ||
export { default as passiveHandler } from '../../src/misc/passiveHandler'; | ||
export { default as passiveHandlerLegacy } from '../../src/misc/passiveHandlerLegacy'; | ||
export { default as setElementStyle } from '../../src/misc/setElementStyle'; | ||
export { default as normalizeValue } from '../../src/misc/normalizeValue'; | ||
export { default as normalizeOptions } from '../../src/misc/normalizeOptions'; | ||
export { default as tryWrapper } from '../../src/misc/tryWrapper'; | ||
export { default as reflow } from '../../src/misc/reflow'; | ||
export { default as focus } from '../../src/misc/focus'; | ||
export { default as ArrayFrom } from '../../src/misc/ArrayFrom'; | ||
@@ -174,22 +199,34 @@ export { default as Float32ArrayFrom } from '../../src/misc/Float32ArrayFrom'; | ||
export { default as getAttribute } from '../../src/manipulate/getAttribute'; | ||
export { default as setAttribute } from '../../src/manipulate/setAttribute'; | ||
export { default as removeAttribute } from '../../src/manipulate/removeAttribute'; | ||
export { default as getElementStyle } from '../../src/manipulate/getElementStyle'; | ||
export { default as setElementStyle } from '../../src/manipulate/setElementStyle'; | ||
// is | ||
export { default as isArray } from '../../src/is/isArray'; | ||
export { default as isDocument } from '../../src/is/isDocument'; | ||
export { default as isCustomElement } from '../../src/is/isCustomElement'; | ||
export { default as isElement } from '../../src/is/isElement'; | ||
export { default as isElementInScrollRange } from '../../src/is/isElementInScrollRange'; | ||
export { default as isElementInViewport } from '../../src/is/isElementInViewport'; | ||
export { default as isElementsArray } from '../../src/is/isElementsArray'; | ||
export { default as isHTMLCollection } from '../../src/is/isHTMLCollection'; | ||
export { default as isHTMLElement } from '../../src/is/isHTMLElement'; | ||
export { default as isHTMLImageElement } from '../../src/is/isHTMLImageElement'; | ||
export { default as isMedia } from '../../src/is/isMedia'; | ||
export { default as isNode } from '../../src/is/isNode'; | ||
export { default as isNodeList } from '../../src/is/isNodeList'; | ||
export { default as isRTL } from '../../src/is/isRTL'; | ||
export { default as isScaledElement } from '../../src/is/isScaledElement'; | ||
export { default as isShadowRoot } from '../../src/is/isShadowRoot'; | ||
export { default as isString } from '../../src/is/isString'; | ||
export { default as isSVGElement } from '../../src/is/isSVGElement'; | ||
export { default as isTableElement } from '../../src/is/isTableElement'; | ||
export { default as isWindow } from '../../src/is/isWindow'; | ||
export { default as isArray } from "../../src/misc/isArray"; | ||
export { default as isString } from "../../src/misc/isString"; | ||
export { default as isElement } from "../../src/misc/isElement"; | ||
export { default as isNodeList } from "../../src/misc/isNodeList"; | ||
export { default as isHTMLElement } from "../../src/misc/isHTMLElement"; | ||
export { default as isHTMLCollection } from "../../src/misc/isHTMLCollection"; | ||
export { default as isElementsArray } from "../../src/misc/isElementsArray"; | ||
// selectors | ||
export { default as elementNodes } from '../../src/selectors/elementNodes'; | ||
export { default as parentNodes } from '../../src/selectors/parentNodes'; | ||
export { default as closest } from '../../src/selectors/closest'; | ||
export { default as getCustomElements } from '../../src/selectors/getCustomElements'; | ||
export { default as querySelector } from '../../src/selectors/querySelector'; | ||
export { default as querySelectorAll } from '../../src/selectors/querySelectorAll'; | ||
export { default as getElementsByTagName } from '../../src/selectors/getElementsByTagName'; | ||
export { default as getElementsByClassName } from '../../src/selectors/getElementsByClassName'; | ||
export { default as closest } from "../../src/selectors/closest"; | ||
export { default as querySelector } from "../../src/selectors/querySelector"; | ||
export { default as querySelectorAll } from "../../src/selectors/querySelectorAll"; | ||
export { default as getElementsByTagName } from "../../src/selectors/getElementsByTagName"; | ||
export { default as getElementsByClassName } from "../../src/selectors/getElementsByClassName"; | ||
export { default as Version } from "../../src/misc/version"; | ||
export { default as Version } from '../../src/misc/version'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
360294
214
9105