@thednp/shorty 1.0.2 → 2.0.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -202
- package/dist/shorty.cjs.js +1592 -0
- package/dist/shorty.cjs.js.map +7 -0
- package/dist/shorty.cjs.min.js +3 -0
- package/dist/shorty.cjs.min.js.map +7 -0
- package/dist/shorty.es5.js +1593 -0
- package/dist/shorty.es5.js.map +7 -0
- package/dist/shorty.es5.min.js +4 -0
- package/dist/shorty.es5.min.js.map +7 -0
- package/dist/shorty.js +1494 -2550
- package/dist/shorty.js.map +7 -0
- package/dist/shorty.min.js +3 -2
- package/dist/shorty.min.js.map +7 -0
- package/package.json +30 -30
- package/src/attr/getAttribute.js +2 -9
- package/src/attr/getAttribute.js.map +1 -0
- package/src/attr/getAttribute.ts +10 -0
- package/src/attr/getAttributeNS.js +2 -10
- package/src/attr/getAttributeNS.js.map +1 -0
- package/src/attr/getAttributeNS.ts +11 -0
- package/src/attr/hasAttribute.js +2 -9
- package/src/attr/hasAttribute.js.map +1 -0
- package/src/attr/hasAttribute.ts +9 -0
- package/src/attr/hasAttributeNS.js +2 -10
- package/src/attr/hasAttributeNS.js.map +1 -0
- package/src/attr/hasAttributeNS.ts +11 -0
- package/src/attr/removeAttribute.js +2 -9
- package/src/attr/removeAttribute.js.map +1 -0
- package/src/attr/removeAttribute.ts +8 -0
- package/src/attr/removeAttributeNS.js +2 -10
- package/src/attr/removeAttributeNS.js.map +1 -0
- package/src/attr/removeAttributeNS.ts +10 -0
- package/src/attr/setAttribute.js +2 -10
- package/src/attr/setAttribute.js.map +1 -0
- package/src/attr/setAttribute.ts +10 -0
- package/src/attr/setAttributeNS.js +2 -11
- package/src/attr/setAttributeNS.js.map +1 -0
- package/src/attr/setAttributeNS.ts +11 -0
- package/src/blocks/documentBody.js +2 -5
- package/src/blocks/documentBody.js.map +1 -0
- package/src/blocks/documentBody.ts +5 -0
- package/src/blocks/documentElement.js +2 -5
- package/src/blocks/documentElement.js.map +1 -0
- package/src/blocks/documentElement.ts +5 -0
- package/src/blocks/documentHead.js +2 -5
- package/src/blocks/documentHead.js.map +1 -0
- package/src/blocks/documentHead.ts +5 -0
- package/src/boolean/isApple.js +7 -13
- package/src/boolean/isApple.js.map +1 -0
- package/src/boolean/isApple.ts +14 -0
- package/src/boolean/isFirefox.js +3 -10
- package/src/boolean/isFirefox.js.map +1 -0
- package/src/boolean/isFirefox.ts +9 -0
- package/src/boolean/isMobile.js +12 -20
- package/src/boolean/isMobile.js.map +1 -0
- package/src/boolean/isMobile.ts +19 -0
- package/src/boolean/support3DTransform.js +3 -9
- package/src/boolean/support3DTransform.js.map +1 -0
- package/src/boolean/support3DTransform.ts +10 -0
- package/src/boolean/supportAnimation.js +3 -9
- package/src/boolean/supportAnimation.js.map +1 -0
- package/src/boolean/supportAnimation.ts +8 -0
- package/src/boolean/supportPassive.js +18 -28
- package/src/boolean/supportPassive.js.map +1 -0
- package/src/boolean/supportPassive.ts +28 -0
- package/src/boolean/supportTouch.js +2 -7
- package/src/boolean/supportTouch.js.map +1 -0
- package/src/boolean/supportTouch.ts +7 -0
- package/src/boolean/supportTransform.js +3 -9
- package/src/boolean/supportTransform.js.map +1 -0
- package/src/boolean/supportTransform.ts +8 -0
- package/src/boolean/supportTransition.js +3 -9
- package/src/boolean/supportTransition.js.map +1 -0
- package/src/boolean/supportTransition.ts +8 -0
- package/src/class/addClass.js +4 -10
- package/src/class/addClass.js.map +1 -0
- package/src/class/addClass.ts +11 -0
- package/src/class/hasClass.js +4 -10
- package/src/class/hasClass.js.map +1 -0
- package/src/class/hasClass.ts +11 -0
- package/src/class/removeClass.js +4 -10
- package/src/class/removeClass.js.map +1 -0
- package/src/class/removeClass.ts +11 -0
- package/src/event/off.js +4 -9
- package/src/event/off.js.map +1 -0
- package/src/event/off.ts +12 -0
- package/src/event/on.js +4 -9
- package/src/event/on.js.map +1 -0
- package/src/event/on.ts +12 -0
- package/src/event/one.js +12 -23
- package/src/event/one.js.map +1 -0
- package/src/event/one.ts +25 -0
- package/src/get/getBoundingClientRect.js +22 -37
- package/src/get/getBoundingClientRect.js.map +1 -0
- package/src/get/getBoundingClientRect.ts +38 -0
- package/src/get/getDocument.js +13 -16
- package/src/get/getDocument.js.map +1 -0
- package/src/get/getDocument.ts +23 -0
- package/src/get/getDocumentBody.js +5 -10
- package/src/get/getDocumentBody.js.map +1 -0
- package/src/get/getDocumentBody.ts +13 -0
- package/src/get/getDocumentElement.js +5 -11
- package/src/get/getDocumentElement.js.map +1 -0
- package/src/get/getDocumentElement.ts +13 -0
- package/src/get/getDocumentHead.js +5 -10
- package/src/get/getDocumentHead.js.map +1 -0
- package/src/get/getDocumentHead.ts +12 -0
- package/src/get/getElementAnimationDelay.js +11 -21
- package/src/get/getElementAnimationDelay.js.map +1 -0
- package/src/get/getElementAnimationDelay.ts +22 -0
- package/src/get/getElementAnimationDuration.js +11 -20
- package/src/get/getElementAnimationDuration.js.map +1 -0
- package/src/get/getElementAnimationDuration.ts +22 -0
- package/src/get/getElementStyle.js +7 -20
- package/src/get/getElementStyle.js.map +1 -0
- package/src/get/getElementStyle.ts +24 -0
- package/src/get/getElementTransitionDelay.js +11 -20
- package/src/get/getElementTransitionDelay.js.map +1 -0
- package/src/get/getElementTransitionDelay.ts +22 -0
- package/src/get/getElementTransitionDuration.js +11 -20
- package/src/get/getElementTransitionDuration.js.map +1 -0
- package/src/get/getElementTransitionDuration.ts +22 -0
- package/src/get/getNodeScroll.js +8 -16
- package/src/get/getNodeScroll.js.map +1 -0
- package/src/get/getNodeScroll.ts +20 -0
- package/src/get/getParentNode.js +14 -23
- package/src/get/getParentNode.js.map +1 -0
- package/src/get/getParentNode.ts +27 -0
- package/src/get/getRectRelativeToOffsetParent.js +20 -32
- package/src/get/getRectRelativeToOffsetParent.js.map +1 -0
- package/src/get/getRectRelativeToOffsetParent.ts +39 -0
- package/src/get/getUID.js +31 -34
- package/src/get/getUID.js.map +1 -0
- package/src/get/getUID.ts +42 -0
- package/src/get/getWindow.js +12 -29
- package/src/get/getWindow.js.map +1 -0
- package/src/get/getWindow.ts +22 -0
- package/src/index.js +416 -475
- package/src/index.js.map +1 -0
- package/src/index.ts +448 -0
- package/src/interface/boundingClientRect.js +1 -0
- package/src/interface/boundingClientRect.js.map +1 -0
- package/src/interface/boundingClientRect.ts +10 -0
- package/src/interface/css4Declaration.js +1 -0
- package/src/interface/css4Declaration.js.map +1 -0
- package/src/interface/css4Declaration.ts +3 -0
- package/src/interface/customElement.js +1 -0
- package/src/interface/customElement.js.map +1 -0
- package/src/interface/customElement.ts +8 -0
- package/src/interface/navigatorUA.js +1 -0
- package/src/interface/navigatorUA.js.map +1 -0
- package/src/interface/navigatorUA.ts +15 -0
- package/src/interface/offsetRect.js +1 -0
- package/src/interface/offsetRect.js.map +1 -0
- package/src/interface/offsetRect.ts +6 -0
- package/src/interface/originalEvent.js +1 -0
- package/src/interface/originalEvent.js.map +1 -0
- package/src/interface/originalEvent.ts +3 -0
- package/src/is/isArray.js +2 -8
- package/src/is/isArray.js.map +1 -0
- package/src/is/isArray.ts +9 -0
- package/src/is/isCanvas.js +2 -0
- package/src/is/isCanvas.js.map +1 -0
- package/src/is/isCanvas.ts +11 -0
- package/src/is/isCustomElement.js +2 -8
- package/src/is/isCustomElement.js.map +1 -0
- package/src/is/isCustomElement.ts +12 -0
- package/src/is/isDocument.js +2 -10
- package/src/is/isDocument.js.map +1 -0
- package/src/is/isDocument.ts +10 -0
- package/src/is/isElement.js +2 -22
- package/src/is/isElement.js.map +1 -0
- package/src/is/isElement.ts +22 -0
- package/src/is/isElementInScrollRange.js +11 -20
- package/src/is/isElementInScrollRange.js.map +1 -0
- package/src/is/isElementInScrollRange.ts +20 -0
- package/src/is/isElementInViewport.js +11 -26
- package/src/is/isElementInViewport.js.map +1 -0
- package/src/is/isElementInViewport.ts +20 -0
- package/src/is/isElementsArray.js +4 -12
- package/src/is/isElementsArray.js.map +1 -0
- package/src/is/isElementsArray.ts +13 -0
- package/src/is/isFunction.js +2 -8
- package/src/is/isFunction.js.map +1 -0
- package/src/is/isFunction.ts +10 -0
- package/src/is/isHTMLCollection.js +2 -8
- package/src/is/isHTMLCollection.js.map +1 -0
- package/src/is/isHTMLCollection.ts +10 -0
- package/src/is/isHTMLElement.js +2 -9
- package/src/is/isHTMLElement.js.map +1 -0
- package/src/is/isHTMLElement.ts +10 -0
- package/src/is/isHTMLImageElement.js +2 -8
- package/src/is/isHTMLImageElement.js.map +1 -0
- package/src/is/isHTMLImageElement.ts +9 -0
- package/src/is/isMap.js +2 -0
- package/src/is/isMap.js.map +1 -0
- package/src/is/isMap.ts +8 -0
- package/src/is/isMedia.js +5 -14
- package/src/is/isMedia.js.map +1 -0
- package/src/is/isMedia.ts +18 -0
- package/src/is/isNode.js +2 -9
- package/src/is/isNode.js.map +1 -0
- package/src/is/isNode.ts +11 -0
- package/src/is/isNodeList.js +2 -9
- package/src/is/isNodeList.js.map +1 -0
- package/src/is/isNodeList.ts +11 -0
- package/src/is/isNumber.js +2 -8
- package/src/is/isNumber.js.map +1 -0
- package/src/is/isNumber.ts +9 -0
- package/src/is/isObject.js +2 -0
- package/src/is/isObject.js.map +1 -0
- package/src/is/isObject.ts +9 -0
- package/src/is/isRTL.js +3 -9
- package/src/is/isRTL.js.map +1 -0
- package/src/is/isRTL.ts +10 -0
- package/src/is/isSVGElement.js +2 -11
- package/src/is/isSVGElement.js.map +1 -0
- package/src/is/isSVGElement.ts +11 -0
- package/src/is/isScaledElement.js +9 -17
- package/src/is/isScaledElement.js.map +1 -0
- package/src/is/isScaledElement.ts +16 -0
- package/src/is/isShadowRoot.js +2 -9
- package/src/is/isShadowRoot.js.map +1 -0
- package/src/is/isShadowRoot.ts +10 -0
- package/src/is/isString.js +2 -8
- package/src/is/isString.js.map +1 -0
- package/src/is/isString.ts +9 -0
- package/src/is/isTableElement.js +2 -11
- package/src/is/isTableElement.js.map +1 -0
- package/src/is/isTableElement.ts +12 -0
- package/src/is/isWeakMap.js +2 -0
- package/src/is/isWeakMap.js.map +1 -0
- package/src/is/isWeakMap.ts +9 -0
- package/src/is/isWindow.js +2 -9
- package/src/is/isWindow.js.map +1 -0
- package/src/is/isWindow.ts +10 -0
- package/src/misc/ArrayFrom.js +2 -8
- package/src/misc/ArrayFrom.js.map +1 -0
- package/src/misc/ArrayFrom.ts +11 -0
- package/src/misc/Float32ArrayFrom.js +2 -7
- package/src/misc/Float32ArrayFrom.js.map +1 -0
- package/src/misc/Float32ArrayFrom.ts +9 -0
- package/src/misc/Float64ArrayFrom.js +2 -7
- package/src/misc/Float64ArrayFrom.js.map +1 -0
- package/src/misc/Float64ArrayFrom.ts +9 -0
- package/src/misc/ObjectAssign.js +2 -7
- package/src/misc/ObjectAssign.js.map +1 -0
- package/src/misc/ObjectAssign.ts +11 -0
- package/src/misc/ObjectEntries.js +2 -7
- package/src/misc/ObjectEntries.js.map +1 -0
- package/src/misc/ObjectEntries.ts +8 -0
- package/src/misc/ObjectKeys.js +2 -7
- package/src/misc/ObjectKeys.js.map +1 -0
- package/src/misc/ObjectKeys.ts +8 -0
- package/src/misc/ObjectValues.js +2 -7
- package/src/misc/ObjectValues.js.map +1 -0
- package/src/misc/ObjectValues.ts +8 -0
- package/src/misc/OriginalEvent.js +13 -19
- package/src/misc/OriginalEvent.js.map +1 -0
- package/src/misc/OriginalEvent.ts +24 -0
- package/src/misc/createElement.js +24 -27
- package/src/misc/createElement.js.map +1 -0
- package/src/misc/createElement.ts +39 -0
- package/src/misc/createElementNS.js +24 -30
- package/src/misc/createElementNS.js.map +1 -0
- package/src/misc/createElementNS.ts +44 -0
- package/src/misc/data.js +35 -78
- package/src/misc/data.js.map +1 -0
- package/src/misc/data.ts +81 -0
- package/src/misc/dispatchEvent.js +2 -8
- package/src/misc/dispatchEvent.js.map +1 -0
- package/src/misc/dispatchEvent.ts +9 -0
- package/src/misc/distinct.js +2 -10
- package/src/misc/distinct.js.map +1 -0
- package/src/misc/distinct.ts +17 -0
- package/src/misc/emulateAnimationEnd.js +28 -40
- package/src/misc/emulateAnimationEnd.js.map +1 -0
- package/src/misc/emulateAnimationEnd.ts +39 -0
- package/src/misc/emulateTransitionEnd.js +28 -40
- package/src/misc/emulateTransitionEnd.js.map +1 -0
- package/src/misc/emulateTransitionEnd.ts +39 -0
- package/src/misc/focus.js +2 -7
- package/src/misc/focus.js.map +1 -0
- package/src/misc/focus.ts +9 -0
- package/src/misc/noop.js +2 -3
- package/src/misc/noop.js.map +1 -0
- package/src/misc/noop.ts +4 -0
- package/src/misc/normalizeOptions.js +33 -49
- package/src/misc/normalizeOptions.js.map +1 -0
- package/src/misc/normalizeOptions.ts +55 -0
- package/src/misc/normalizeValue.js +16 -34
- package/src/misc/normalizeValue.js.map +1 -0
- package/src/misc/normalizeValue.ts +30 -0
- package/src/misc/passiveHandler.js +2 -7
- package/src/misc/passiveHandler.js.map +1 -0
- package/src/misc/passiveHandler.ts +6 -0
- package/src/misc/reflow.js +2 -8
- package/src/misc/reflow.js.map +1 -0
- package/src/misc/reflow.ts +9 -0
- package/src/misc/setElementStyle.js +15 -19
- package/src/misc/setElementStyle.js.map +1 -0
- package/src/misc/setElementStyle.ts +21 -0
- package/src/misc/timer.js +50 -75
- package/src/misc/timer.js.map +1 -0
- package/src/misc/timer.ts +81 -0
- package/src/misc/toLowerCase.js +2 -8
- package/src/misc/toLowerCase.js.map +1 -0
- package/src/misc/toLowerCase.ts +9 -0
- package/src/misc/toUpperCase.js +2 -8
- package/src/misc/toUpperCase.js.map +1 -0
- package/src/misc/toUpperCase.ts +9 -0
- package/src/selectors/closest.js +7 -16
- package/src/selectors/closest.js.map +1 -0
- package/src/selectors/closest.ts +20 -0
- package/src/selectors/getCustomElements.js +7 -16
- package/src/selectors/getCustomElements.js.map +1 -0
- package/src/selectors/getCustomElements.ts +19 -0
- package/src/selectors/getElementById.js +5 -14
- package/src/selectors/getElementById.js.map +1 -0
- package/src/selectors/getElementById.ts +16 -0
- package/src/selectors/getElementsByClassName.js +7 -15
- package/src/selectors/getElementsByClassName.js.map +1 -0
- package/src/selectors/getElementsByClassName.ts +22 -0
- package/src/selectors/getElementsByTagName.js +7 -15
- package/src/selectors/getElementsByTagName.js.map +1 -0
- package/src/selectors/getElementsByTagName.ts +20 -0
- package/src/selectors/matches.js +2 -10
- package/src/selectors/matches.js.map +1 -0
- package/src/selectors/matches.ts +10 -0
- package/src/selectors/querySelector.js +10 -19
- package/src/selectors/querySelector.js.map +1 -0
- package/src/selectors/querySelector.ts +21 -0
- package/src/selectors/querySelectorAll.js +7 -14
- package/src/selectors/querySelectorAll.js.map +1 -0
- package/src/selectors/querySelectorAll.ts +16 -0
- package/src/strings/DOMContentLoadedEvent.js +2 -6
- package/src/strings/DOMContentLoadedEvent.js.map +1 -0
- package/src/strings/DOMContentLoadedEvent.ts +5 -0
- package/src/strings/DOMMouseScrollEvent.js +2 -6
- package/src/strings/DOMMouseScrollEvent.js.map +1 -0
- package/src/strings/DOMMouseScrollEvent.ts +5 -0
- package/src/strings/abortEvent.js +2 -6
- package/src/strings/abortEvent.js.map +1 -0
- package/src/strings/abortEvent.ts +5 -0
- package/src/strings/addEventListener.js +2 -6
- package/src/strings/addEventListener.js.map +1 -0
- package/src/strings/addEventListener.ts +5 -0
- package/src/strings/animationDelay.js +2 -6
- package/src/strings/animationDelay.js.map +1 -0
- package/src/strings/animationDelay.ts +5 -0
- package/src/strings/animationDuration.js +2 -6
- package/src/strings/animationDuration.js.map +1 -0
- package/src/strings/animationDuration.ts +5 -0
- package/src/strings/animationEndEvent.js +2 -6
- package/src/strings/animationEndEvent.js.map +1 -0
- package/src/strings/animationEndEvent.ts +5 -0
- package/src/strings/animationName.js +2 -6
- package/src/strings/animationName.js.map +1 -0
- package/src/strings/animationName.ts +5 -0
- package/src/strings/ariaChecked.js +2 -6
- package/src/strings/ariaChecked.js.map +1 -0
- package/src/strings/ariaChecked.ts +5 -0
- package/src/strings/ariaDescribedBy.js +2 -6
- package/src/strings/ariaDescribedBy.js.map +1 -0
- package/src/strings/ariaDescribedBy.ts +5 -0
- package/src/strings/ariaDescription.js +2 -6
- package/src/strings/ariaDescription.js.map +1 -0
- package/src/strings/ariaDescription.ts +5 -0
- package/src/strings/ariaExpanded.js +2 -6
- package/src/strings/ariaExpanded.js.map +1 -0
- package/src/strings/ariaExpanded.ts +5 -0
- package/src/strings/ariaHasPopup.js +2 -6
- package/src/strings/ariaHasPopup.js.map +1 -0
- package/src/strings/ariaHasPopup.ts +5 -0
- package/src/strings/ariaHidden.js +2 -6
- package/src/strings/ariaHidden.js.map +1 -0
- package/src/strings/ariaHidden.ts +5 -0
- package/src/strings/ariaLabel.js +2 -6
- package/src/strings/ariaLabel.js.map +1 -0
- package/src/strings/ariaLabel.ts +5 -0
- package/src/strings/ariaLabelledBy.js +2 -6
- package/src/strings/ariaLabelledBy.js.map +1 -0
- package/src/strings/ariaLabelledBy.ts +5 -0
- package/src/strings/ariaModal.js +2 -6
- package/src/strings/ariaModal.js.map +1 -0
- package/src/strings/ariaModal.ts +5 -0
- package/src/strings/ariaPressed.js +2 -6
- package/src/strings/ariaPressed.js.map +1 -0
- package/src/strings/ariaPressed.ts +5 -0
- package/src/strings/ariaSelected.js +2 -6
- package/src/strings/ariaSelected.js.map +1 -0
- package/src/strings/ariaSelected.ts +5 -0
- package/src/strings/ariaValueMax.js +2 -6
- package/src/strings/ariaValueMax.js.map +1 -0
- package/src/strings/ariaValueMax.ts +5 -0
- package/src/strings/ariaValueMin.js +2 -6
- package/src/strings/ariaValueMin.js.map +1 -0
- package/src/strings/ariaValueMin.ts +5 -0
- package/src/strings/ariaValueNow.js +2 -6
- package/src/strings/ariaValueNow.js.map +1 -0
- package/src/strings/ariaValueNow.ts +5 -0
- package/src/strings/ariaValueText.js +2 -6
- package/src/strings/ariaValueText.js.map +1 -0
- package/src/strings/ariaValueText.ts +5 -0
- package/src/strings/beforeunloadEvent.js +2 -6
- package/src/strings/beforeunloadEvent.js.map +1 -0
- package/src/strings/beforeunloadEvent.ts +5 -0
- package/src/strings/bezierEasings.js +28 -33
- package/src/strings/bezierEasings.js.map +1 -0
- package/src/strings/bezierEasings.ts +32 -0
- package/src/strings/blurEvent.js +2 -6
- package/src/strings/blurEvent.js.map +1 -0
- package/src/strings/blurEvent.ts +5 -0
- package/src/strings/changeEvent.js +2 -6
- package/src/strings/changeEvent.js.map +1 -0
- package/src/strings/changeEvent.ts +5 -0
- package/src/strings/contextmenuEvent.js +2 -6
- package/src/strings/contextmenuEvent.js.map +1 -0
- package/src/strings/contextmenuEvent.ts +5 -0
- package/src/strings/errorEvent.js +2 -6
- package/src/strings/errorEvent.js.map +1 -0
- package/src/strings/errorEvent.ts +5 -0
- package/src/strings/focusEvent.js +2 -6
- package/src/strings/focusEvent.js.map +1 -0
- package/src/strings/focusEvent.ts +5 -0
- package/src/strings/focusEvents.js +2 -6
- package/src/strings/focusEvents.js.map +1 -0
- package/src/strings/focusEvents.ts +5 -0
- package/src/strings/focusinEvent.js +2 -6
- package/src/strings/focusinEvent.js.map +1 -0
- package/src/strings/focusinEvent.ts +5 -0
- package/src/strings/focusoutEvent.js +2 -6
- package/src/strings/focusoutEvent.js.map +1 -0
- package/src/strings/focusoutEvent.ts +5 -0
- package/src/strings/gesturechangeEvent.js +2 -6
- package/src/strings/gesturechangeEvent.js.map +1 -0
- package/src/strings/gesturechangeEvent.ts +5 -0
- package/src/strings/gestureendEvent.js +2 -6
- package/src/strings/gestureendEvent.js.map +1 -0
- package/src/strings/gestureendEvent.ts +5 -0
- package/src/strings/gesturestartEvent.js +2 -6
- package/src/strings/gesturestartEvent.js.map +1 -0
- package/src/strings/gesturestartEvent.ts +5 -0
- package/src/strings/keyAlt.js +2 -7
- package/src/strings/keyAlt.js.map +1 -0
- package/src/strings/keyAlt.ts +7 -0
- package/src/strings/keyArrowDown.js +2 -7
- package/src/strings/keyArrowDown.js.map +1 -0
- package/src/strings/keyArrowDown.ts +7 -0
- package/src/strings/keyArrowLeft.js +2 -7
- package/src/strings/keyArrowLeft.js.map +1 -0
- package/src/strings/keyArrowLeft.ts +7 -0
- package/src/strings/keyArrowRight.js +2 -7
- package/src/strings/keyArrowRight.js.map +1 -0
- package/src/strings/keyArrowRight.ts +7 -0
- package/src/strings/keyArrowUp.js +2 -7
- package/src/strings/keyArrowUp.js.map +1 -0
- package/src/strings/keyArrowUp.ts +7 -0
- package/src/strings/keyBackspace.js +2 -7
- package/src/strings/keyBackspace.js.map +1 -0
- package/src/strings/keyBackspace.ts +7 -0
- package/src/strings/keyCapsLock.js +2 -7
- package/src/strings/keyCapsLock.js.map +1 -0
- package/src/strings/keyCapsLock.ts +7 -0
- package/src/strings/keyControl.js +2 -7
- package/src/strings/keyControl.js.map +1 -0
- package/src/strings/keyControl.ts +7 -0
- package/src/strings/keyDelete.js +2 -7
- package/src/strings/keyDelete.js.map +1 -0
- package/src/strings/keyDelete.ts +7 -0
- package/src/strings/keyEnter.js +2 -7
- package/src/strings/keyEnter.js.map +1 -0
- package/src/strings/keyEnter.ts +7 -0
- package/src/strings/keyEscape.js +2 -7
- package/src/strings/keyEscape.js.map +1 -0
- package/src/strings/keyEscape.ts +7 -0
- package/src/strings/keyInsert.js +2 -7
- package/src/strings/keyInsert.js.map +1 -0
- package/src/strings/keyInsert.ts +7 -0
- package/src/strings/keyMeta.js +2 -7
- package/src/strings/keyMeta.js.map +1 -0
- package/src/strings/keyMeta.ts +7 -0
- package/src/strings/keyPause.js +2 -7
- package/src/strings/keyPause.js.map +1 -0
- package/src/strings/keyPause.ts +7 -0
- package/src/strings/keyScrollLock.js +2 -7
- package/src/strings/keyScrollLock.js.map +1 -0
- package/src/strings/keyScrollLock.ts +7 -0
- package/src/strings/keyShift.js +2 -7
- package/src/strings/keyShift.js.map +1 -0
- package/src/strings/keyShift.ts +7 -0
- package/src/strings/keySpace.js +2 -7
- package/src/strings/keySpace.js.map +1 -0
- package/src/strings/keySpace.ts +7 -0
- package/src/strings/keyTab.js +2 -7
- package/src/strings/keyTab.js.map +1 -0
- package/src/strings/keyTab.ts +7 -0
- package/src/strings/keyboardEventKeys.js +22 -27
- package/src/strings/keyboardEventKeys.js.map +1 -0
- package/src/strings/keyboardEventKeys.ts +26 -0
- package/src/strings/keydownEvent.js +2 -6
- package/src/strings/keydownEvent.js.map +1 -0
- package/src/strings/keydownEvent.ts +5 -0
- package/src/strings/keypressEvent.js +2 -6
- package/src/strings/keypressEvent.js.map +1 -0
- package/src/strings/keypressEvent.ts +5 -0
- package/src/strings/keyupEvent.js +2 -6
- package/src/strings/keyupEvent.js.map +1 -0
- package/src/strings/keyupEvent.ts +5 -0
- package/src/strings/loadEvent.js +2 -6
- package/src/strings/loadEvent.js.map +1 -0
- package/src/strings/loadEvent.ts +5 -0
- package/src/strings/loadstartEvent.js +2 -6
- package/src/strings/loadstartEvent.js.map +1 -0
- package/src/strings/loadstartEvent.ts +5 -0
- package/src/strings/mouseClickEvents.js +2 -6
- package/src/strings/mouseClickEvents.js.map +1 -0
- package/src/strings/mouseClickEvents.ts +5 -0
- package/src/strings/mouseHoverEvents.js +4 -7
- package/src/strings/mouseHoverEvents.js.map +1 -0
- package/src/strings/mouseHoverEvents.ts +8 -0
- package/src/strings/mouseSwipeEvents.js +7 -8
- package/src/strings/mouseSwipeEvents.js.map +1 -0
- package/src/strings/mouseSwipeEvents.ts +10 -0
- package/src/strings/mouseclickEvent.js +2 -6
- package/src/strings/mouseclickEvent.js.map +1 -0
- package/src/strings/mouseclickEvent.ts +5 -0
- package/src/strings/mousedblclickEvent.js +2 -6
- package/src/strings/mousedblclickEvent.js.map +1 -0
- package/src/strings/mousedblclickEvent.ts +5 -0
- package/src/strings/mousedownEvent.js +2 -6
- package/src/strings/mousedownEvent.js.map +1 -0
- package/src/strings/mousedownEvent.ts +5 -0
- package/src/strings/mouseenterEvent.js +2 -6
- package/src/strings/mouseenterEvent.js.map +1 -0
- package/src/strings/mouseenterEvent.ts +5 -0
- package/src/strings/mousehoverEvent.js +2 -6
- package/src/strings/mousehoverEvent.js.map +1 -0
- package/src/strings/mousehoverEvent.ts +5 -0
- package/src/strings/mouseinEvent.js +2 -6
- package/src/strings/mouseinEvent.js.map +1 -0
- package/src/strings/mouseinEvent.ts +5 -0
- package/src/strings/mouseleaveEvent.js +2 -6
- package/src/strings/mouseleaveEvent.js.map +1 -0
- package/src/strings/mouseleaveEvent.ts +5 -0
- package/src/strings/mousemoveEvent.js +2 -6
- package/src/strings/mousemoveEvent.js.map +1 -0
- package/src/strings/mousemoveEvent.ts +5 -0
- package/src/strings/mouseoutEvent.js +2 -6
- package/src/strings/mouseoutEvent.js.map +1 -0
- package/src/strings/mouseoutEvent.ts +5 -0
- package/src/strings/mouseoverEvent.js +2 -6
- package/src/strings/mouseoverEvent.js.map +1 -0
- package/src/strings/mouseoverEvent.ts +5 -0
- package/src/strings/mouseupEvent.js +2 -6
- package/src/strings/mouseupEvent.js.map +1 -0
- package/src/strings/mouseupEvent.ts +5 -0
- package/src/strings/mousewheelEvent.js +2 -6
- package/src/strings/mousewheelEvent.js.map +1 -0
- package/src/strings/mousewheelEvent.ts +5 -0
- package/src/strings/moveEvent.js +2 -6
- package/src/strings/moveEvent.js.map +1 -0
- package/src/strings/moveEvent.ts +5 -0
- package/src/strings/nativeEvents.js +103 -108
- package/src/strings/nativeEvents.js.map +1 -0
- package/src/strings/nativeEvents.ts +108 -0
- package/src/strings/offsetHeight.js +2 -6
- package/src/strings/offsetHeight.js.map +1 -0
- package/src/strings/offsetHeight.ts +5 -0
- package/src/strings/offsetWidth.js +2 -6
- package/src/strings/offsetWidth.js.map +1 -0
- package/src/strings/offsetWidth.ts +5 -0
- package/src/strings/orientationchangeEvent.js +2 -6
- package/src/strings/orientationchangeEvent.js.map +1 -0
- package/src/strings/orientationchangeEvent.ts +5 -0
- package/src/strings/pointercancelEvent.js +2 -6
- package/src/strings/pointercancelEvent.js.map +1 -0
- package/src/strings/pointercancelEvent.ts +5 -0
- package/src/strings/pointerdownEvent.js +2 -6
- package/src/strings/pointerdownEvent.js.map +1 -0
- package/src/strings/pointerdownEvent.ts +5 -0
- package/src/strings/pointerleaveEvent.js +2 -6
- package/src/strings/pointerleaveEvent.js.map +1 -0
- package/src/strings/pointerleaveEvent.ts +5 -0
- package/src/strings/pointermoveEvent.js +2 -6
- package/src/strings/pointermoveEvent.js.map +1 -0
- package/src/strings/pointermoveEvent.ts +5 -0
- package/src/strings/pointerupEvent.js +2 -6
- package/src/strings/pointerupEvent.js.map +1 -0
- package/src/strings/pointerupEvent.ts +5 -0
- package/src/strings/readystatechangeEvent.js +2 -6
- package/src/strings/readystatechangeEvent.js.map +1 -0
- package/src/strings/readystatechangeEvent.ts +5 -0
- package/src/strings/removeEventListener.js +2 -6
- package/src/strings/removeEventListener.js.map +1 -0
- package/src/strings/removeEventListener.ts +5 -0
- package/src/strings/resetEvent.js +2 -6
- package/src/strings/resetEvent.js.map +1 -0
- package/src/strings/resetEvent.ts +5 -0
- package/src/strings/resizeEvent.js +2 -6
- package/src/strings/resizeEvent.js.map +1 -0
- package/src/strings/resizeEvent.ts +5 -0
- package/src/strings/scrollEvent.js +2 -6
- package/src/strings/scrollEvent.js.map +1 -0
- package/src/strings/scrollEvent.ts +5 -0
- package/src/strings/scrollHeight.js +2 -6
- package/src/strings/scrollHeight.js.map +1 -0
- package/src/strings/scrollHeight.ts +5 -0
- package/src/strings/scrollWidth.js +2 -6
- package/src/strings/scrollWidth.js.map +1 -0
- package/src/strings/scrollWidth.ts +5 -0
- package/src/strings/selectEvent.js +2 -6
- package/src/strings/selectEvent.js.map +1 -0
- package/src/strings/selectEvent.ts +5 -0
- package/src/strings/selectendEvent.js +2 -6
- package/src/strings/selectendEvent.js.map +1 -0
- package/src/strings/selectendEvent.ts +5 -0
- package/src/strings/selectstartEvent.js +2 -6
- package/src/strings/selectstartEvent.js.map +1 -0
- package/src/strings/selectstartEvent.ts +5 -0
- package/src/strings/submitEvent.js +2 -6
- package/src/strings/submitEvent.js.map +1 -0
- package/src/strings/submitEvent.ts +5 -0
- package/src/strings/tabindex.js +2 -0
- package/src/strings/tabindex.js.map +1 -0
- package/src/strings/tabindex.ts +5 -0
- package/src/strings/touchEvents.js +7 -8
- package/src/strings/touchEvents.js.map +1 -0
- package/src/strings/touchEvents.ts +10 -0
- package/src/strings/touchcancelEvent.js +2 -6
- package/src/strings/touchcancelEvent.js.map +1 -0
- package/src/strings/touchcancelEvent.ts +5 -0
- package/src/strings/touchendEvent.js +2 -6
- package/src/strings/touchendEvent.js.map +1 -0
- package/src/strings/touchendEvent.ts +5 -0
- package/src/strings/touchmoveEvent.js +2 -6
- package/src/strings/touchmoveEvent.js.map +1 -0
- package/src/strings/touchmoveEvent.ts +5 -0
- package/src/strings/touchstartEvent.js +2 -6
- package/src/strings/touchstartEvent.js.map +1 -0
- package/src/strings/touchstartEvent.ts +5 -0
- package/src/strings/transitionDelay.js +2 -6
- package/src/strings/transitionDelay.js.map +1 -0
- package/src/strings/transitionDelay.ts +5 -0
- package/src/strings/transitionDuration.js +2 -6
- package/src/strings/transitionDuration.js.map +1 -0
- package/src/strings/transitionDuration.ts +5 -0
- package/src/strings/transitionEndEvent.js +2 -6
- package/src/strings/transitionEndEvent.js.map +1 -0
- package/src/strings/transitionEndEvent.ts +5 -0
- package/src/strings/transitionProperty.js +2 -7
- package/src/strings/transitionProperty.js.map +1 -0
- package/src/strings/transitionProperty.ts +5 -0
- package/src/strings/unloadEvent.js +2 -6
- package/src/strings/unloadEvent.js.map +1 -0
- package/src/strings/unloadEvent.ts +5 -0
- package/src/strings/userAgent.js +3 -7
- package/src/strings/userAgent.js.map +1 -0
- package/src/strings/userAgent.ts +7 -0
- package/src/strings/userAgentData.js +3 -7
- package/src/strings/userAgentData.js.map +1 -0
- package/src/strings/userAgentData.ts +9 -0
- package/src/types.js +1 -0
- package/src/types.js.map +1 -0
- package/src/types.ts +1 -0
- package/types/attr/getAttribute.d.ts +2 -0
- package/types/attr/getAttributeNS.d.ts +2 -0
- package/types/attr/hasAttribute.d.ts +2 -0
- package/types/attr/hasAttributeNS.d.ts +2 -0
- package/types/attr/removeAttribute.d.ts +2 -0
- package/types/attr/removeAttributeNS.d.ts +2 -0
- package/types/attr/setAttribute.d.ts +2 -0
- package/types/attr/setAttributeNS.d.ts +2 -0
- package/types/blocks/documentBody.d.ts +2 -0
- package/types/blocks/documentElement.d.ts +2 -0
- package/types/blocks/documentHead.d.ts +2 -0
- package/types/boolean/isApple.d.ts +2 -0
- package/types/boolean/isFirefox.d.ts +2 -0
- package/types/boolean/isMobile.d.ts +2 -0
- package/types/boolean/support3DTransform.d.ts +2 -0
- package/types/boolean/supportAnimation.d.ts +2 -0
- package/types/boolean/supportPassive.d.ts +2 -0
- package/types/boolean/supportTouch.d.ts +2 -0
- package/types/boolean/supportTransform.d.ts +2 -0
- package/types/boolean/supportTransition.d.ts +2 -0
- package/types/class/addClass.d.ts +2 -0
- package/types/class/hasClass.d.ts +2 -0
- package/types/class/removeClass.d.ts +2 -0
- package/types/event/off.d.ts +1 -0
- package/types/event/on.d.ts +1 -0
- package/types/event/one.d.ts +2 -0
- package/types/get/getBoundingClientRect.d.ts +3 -0
- package/types/get/getDocument.d.ts +2 -0
- package/types/get/getDocumentBody.d.ts +2 -0
- package/types/get/getDocumentElement.d.ts +2 -0
- package/types/get/getDocumentHead.d.ts +2 -0
- package/types/get/getElementAnimationDelay.d.ts +2 -0
- package/types/get/getElementAnimationDuration.d.ts +2 -0
- package/types/get/getElementStyle.d.ts +2 -0
- package/types/get/getElementTransitionDelay.d.ts +2 -0
- package/types/get/getElementTransitionDuration.d.ts +2 -0
- package/types/get/getNodeScroll.d.ts +5 -0
- package/types/get/getParentNode.d.ts +2 -0
- package/types/get/getRectRelativeToOffsetParent.d.ts +6 -0
- package/types/get/getUID.d.ts +2 -0
- package/types/get/getWindow.d.ts +2 -0
- package/types/index.d.ts +351 -256
- package/types/interface/boundingClientRect.d.ts +10 -0
- package/types/interface/css4Declaration.d.ts +3 -0
- package/types/interface/customElement.d.ts +8 -0
- package/types/interface/navigatorUA.d.ts +12 -0
- package/types/interface/offsetRect.d.ts +6 -0
- package/types/interface/originalEvent.d.ts +3 -0
- package/types/is/isArray.d.ts +2 -0
- package/types/is/isCanvas.d.ts +2 -0
- package/types/is/isCustomElement.d.ts +3 -0
- package/types/is/isDocument.d.ts +2 -0
- package/types/is/isElement.d.ts +2 -0
- package/types/is/isElementInScrollRange.d.ts +2 -0
- package/types/is/isElementInViewport.d.ts +2 -0
- package/types/is/isElementsArray.d.ts +2 -0
- package/types/is/isFunction.d.ts +2 -0
- package/types/is/isHTMLCollection.d.ts +2 -0
- package/types/is/isHTMLElement.d.ts +2 -0
- package/types/is/isHTMLImageElement.d.ts +2 -0
- package/types/is/isMap.d.ts +2 -0
- package/types/is/isMedia.d.ts +2 -0
- package/types/is/isNode.d.ts +2 -0
- package/types/is/isNodeList.d.ts +2 -0
- package/types/is/isNumber.d.ts +2 -0
- package/types/is/isObject.d.ts +2 -0
- package/types/is/isRTL.d.ts +2 -0
- package/types/is/isSVGElement.d.ts +2 -0
- package/types/is/isScaledElement.d.ts +1 -0
- package/types/is/isShadowRoot.d.ts +2 -0
- package/types/is/isString.d.ts +2 -0
- package/types/is/isTableElement.d.ts +2 -0
- package/types/is/isWeakMap.d.ts +2 -0
- package/types/is/isWindow.d.ts +2 -0
- package/types/misc/ArrayFrom.d.ts +2 -0
- package/types/misc/Float32ArrayFrom.d.ts +2 -0
- package/types/misc/Float64ArrayFrom.d.ts +2 -0
- package/types/misc/ObjectAssign.d.ts +2 -0
- package/types/misc/ObjectEntries.d.ts +2 -0
- package/types/misc/ObjectKeys.d.ts +2 -0
- package/types/misc/ObjectValues.d.ts +2 -0
- package/types/misc/OriginalEvent.d.ts +3 -0
- package/types/misc/createElement.d.ts +2 -0
- package/types/misc/createElementNS.d.ts +2 -0
- package/types/misc/data.d.ts +10 -0
- package/types/misc/dispatchEvent.d.ts +2 -0
- package/types/misc/distinct.d.ts +2 -0
- package/types/misc/emulateAnimationEnd.d.ts +2 -0
- package/types/misc/emulateTransitionEnd.d.ts +2 -0
- package/types/misc/focus.d.ts +2 -0
- package/types/misc/noop.d.ts +2 -0
- package/types/misc/normalizeOptions.d.ts +5 -0
- package/types/misc/normalizeValue.d.ts +3 -0
- package/types/misc/passiveHandler.d.ts +2 -0
- package/types/misc/reflow.d.ts +2 -0
- package/types/misc/setElementStyle.d.ts +3 -0
- package/types/misc/timer.d.ts +6 -0
- package/types/misc/toLowerCase.d.ts +2 -0
- package/types/misc/toUpperCase.d.ts +2 -0
- package/types/selectors/closest.d.ts +2 -0
- package/types/selectors/getCustomElements.d.ts +3 -0
- package/types/selectors/getElementById.d.ts +2 -0
- package/types/selectors/getElementsByClassName.d.ts +2 -0
- package/types/selectors/getElementsByTagName.d.ts +2 -0
- package/types/selectors/matches.d.ts +2 -0
- package/types/selectors/querySelector.d.ts +2 -0
- package/types/selectors/querySelectorAll.d.ts +2 -0
- package/types/strings/DOMContentLoadedEvent.d.ts +2 -0
- package/types/strings/DOMMouseScrollEvent.d.ts +2 -0
- package/types/strings/abortEvent.d.ts +2 -0
- package/types/strings/addEventListener.d.ts +2 -0
- package/types/strings/animationDelay.d.ts +2 -0
- package/types/strings/animationDuration.d.ts +2 -0
- package/types/strings/animationEndEvent.d.ts +2 -0
- package/types/strings/animationName.d.ts +2 -0
- package/types/strings/ariaChecked.d.ts +2 -0
- package/types/strings/ariaDescribedBy.d.ts +2 -0
- package/types/strings/ariaDescription.d.ts +2 -0
- package/types/strings/ariaExpanded.d.ts +2 -0
- package/types/strings/ariaHasPopup.d.ts +2 -0
- package/types/strings/ariaHidden.d.ts +2 -0
- package/types/strings/ariaLabel.d.ts +2 -0
- package/types/strings/ariaLabelledBy.d.ts +2 -0
- package/types/strings/ariaModal.d.ts +2 -0
- package/types/strings/ariaPressed.d.ts +2 -0
- package/types/strings/ariaSelected.d.ts +2 -0
- package/types/strings/ariaValueMax.d.ts +2 -0
- package/types/strings/ariaValueMin.d.ts +2 -0
- package/types/strings/ariaValueNow.d.ts +2 -0
- package/types/strings/ariaValueText.d.ts +2 -0
- package/types/strings/beforeunloadEvent.d.ts +2 -0
- package/types/strings/bezierEasings.d.ts +28 -0
- package/types/strings/blurEvent.d.ts +2 -0
- package/types/strings/changeEvent.d.ts +2 -0
- package/types/strings/contextmenuEvent.d.ts +2 -0
- package/types/strings/errorEvent.d.ts +2 -0
- package/types/strings/focusEvent.d.ts +2 -0
- package/types/strings/focusEvents.d.ts +5 -0
- package/types/strings/focusinEvent.d.ts +2 -0
- package/types/strings/focusoutEvent.d.ts +2 -0
- package/types/strings/gesturechangeEvent.d.ts +2 -0
- package/types/strings/gestureendEvent.d.ts +2 -0
- package/types/strings/gesturestartEvent.d.ts +2 -0
- package/types/strings/keyAlt.d.ts +2 -0
- package/types/strings/keyArrowDown.d.ts +2 -0
- package/types/strings/keyArrowLeft.d.ts +2 -0
- package/types/strings/keyArrowRight.d.ts +2 -0
- package/types/strings/keyArrowUp.d.ts +2 -0
- package/types/strings/keyBackspace.d.ts +2 -0
- package/types/strings/keyCapsLock.d.ts +2 -0
- package/types/strings/keyControl.d.ts +2 -0
- package/types/strings/keyDelete.d.ts +2 -0
- package/types/strings/keyEnter.d.ts +2 -0
- package/types/strings/keyEscape.d.ts +2 -0
- package/types/strings/keyInsert.d.ts +2 -0
- package/types/strings/keyMeta.d.ts +2 -0
- package/types/strings/keyPause.d.ts +2 -0
- package/types/strings/keyScrollLock.d.ts +2 -0
- package/types/strings/keyShift.d.ts +2 -0
- package/types/strings/keySpace.d.ts +2 -0
- package/types/strings/keyTab.d.ts +2 -0
- package/types/strings/keyboardEventKeys.d.ts +22 -0
- package/types/strings/keydownEvent.d.ts +2 -0
- package/types/strings/keypressEvent.d.ts +2 -0
- package/types/strings/keyupEvent.d.ts +2 -0
- package/types/strings/loadEvent.d.ts +2 -0
- package/types/strings/loadstartEvent.d.ts +2 -0
- package/types/strings/mouseClickEvents.d.ts +5 -0
- package/types/strings/mouseHoverEvents.d.ts +2 -0
- package/types/strings/mouseSwipeEvents.d.ts +7 -0
- package/types/strings/mouseclickEvent.d.ts +2 -0
- package/types/strings/mousedblclickEvent.d.ts +2 -0
- package/types/strings/mousedownEvent.d.ts +2 -0
- package/types/strings/mouseenterEvent.d.ts +2 -0
- package/types/strings/mousehoverEvent.d.ts +2 -0
- package/types/strings/mouseinEvent.d.ts +2 -0
- package/types/strings/mouseleaveEvent.d.ts +2 -0
- package/types/strings/mousemoveEvent.d.ts +2 -0
- package/types/strings/mouseoutEvent.d.ts +2 -0
- package/types/strings/mouseoverEvent.d.ts +2 -0
- package/types/strings/mouseupEvent.d.ts +2 -0
- package/types/strings/mousewheelEvent.d.ts +2 -0
- package/types/strings/moveEvent.d.ts +2 -0
- package/types/strings/nativeEvents.d.ts +53 -0
- package/types/strings/offsetHeight.d.ts +2 -0
- package/types/strings/offsetWidth.d.ts +2 -0
- package/types/strings/orientationchangeEvent.d.ts +2 -0
- package/types/strings/pointercancelEvent.d.ts +2 -0
- package/types/strings/pointerdownEvent.d.ts +2 -0
- package/types/strings/pointerleaveEvent.d.ts +2 -0
- package/types/strings/pointermoveEvent.d.ts +2 -0
- package/types/strings/pointerupEvent.d.ts +2 -0
- package/types/strings/readystatechangeEvent.d.ts +2 -0
- package/types/strings/removeEventListener.d.ts +2 -0
- package/types/strings/resetEvent.d.ts +2 -0
- package/types/strings/resizeEvent.d.ts +2 -0
- package/types/strings/scrollEvent.d.ts +2 -0
- package/types/strings/scrollHeight.d.ts +2 -0
- package/types/strings/scrollWidth.d.ts +2 -0
- package/types/strings/selectEvent.d.ts +2 -0
- package/types/strings/selectendEvent.d.ts +2 -0
- package/types/strings/selectstartEvent.d.ts +2 -0
- package/types/strings/submitEvent.d.ts +2 -0
- package/types/strings/tabindex.d.ts +2 -0
- package/types/strings/touchEvents.d.ts +7 -0
- package/types/strings/touchcancelEvent.d.ts +2 -0
- package/types/strings/touchendEvent.d.ts +2 -0
- package/types/strings/touchmoveEvent.d.ts +2 -0
- package/types/strings/touchstartEvent.d.ts +2 -0
- package/types/strings/transitionDelay.d.ts +2 -0
- package/types/strings/transitionDuration.d.ts +2 -0
- package/types/strings/transitionEndEvent.d.ts +2 -0
- package/types/strings/transitionProperty.d.ts +2 -0
- package/types/strings/unloadEvent.d.ts +2 -0
- package/types/strings/userAgent.d.ts +2 -0
- package/types/strings/userAgentData.d.ts +3 -0
- package/types/types.d.ts +1 -0
- package/dist/shorty.esm.js +0 -2594
- package/dist/shorty.esm.min.js +0 -2
- package/src/get/getElementAnimationDelayLegacy.js +0 -21
- package/src/get/getElementAnimationDurationLegacy.js +0 -21
- package/src/get/getElementTransitionDelayLegacy.js +0 -21
- package/src/get/getElementTransitionDurationLegacy.js +0 -21
- package/src/misc/emulateAnimationEndLegacy.js +0 -41
- package/src/misc/emulateTransitionEndLegacy.js +0 -41
- package/src/misc/passiveHandlerLegacy.js +0 -10
- package/src/misc/version.js +0 -8
- package/src/selectors/matchesLegacy.js +0 -23
- package/src/strings/animationDelayLegacy.js +0 -9
- package/src/strings/animationDurationLegacy.js +0 -9
- package/src/strings/animationEndEventLegacy.js +0 -9
- package/src/strings/animationNameLegacy.js +0 -9
- package/src/strings/transitionDelayLegacy.js +0 -9
- package/src/strings/transitionDurationLegacy.js +0 -9
- package/src/strings/transitionEndEventLegacy.js +0 -9
- package/src/strings/transitionPropertyLegacy.js +0 -12
- package/types/module/shorty.ts +0 -247
- package/types/shorty.d.ts +0 -2305
package/dist/shorty.esm.js
DELETED
|
@@ -1,2594 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Shorty v1.0.2 (https://github.com/thednp/shorty)
|
|
3
|
-
* Copyright 2019-2022 © dnp_theme
|
|
4
|
-
* Licensed under MIT (https://github.com/thednp/shorty/blob/master/LICENSE)
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* A global namespace for aria-checked.
|
|
8
|
-
* @type {string}
|
|
9
|
-
*/
|
|
10
|
-
const ariaChecked = 'aria-checked';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A global namespace for aria-description.
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
const ariaDescription = 'aria-description';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A global namespace for aria-describedby.
|
|
20
|
-
* @type {string}
|
|
21
|
-
*/
|
|
22
|
-
const ariaDescribedBy = 'aria-describedby';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* A global namespace for aria-expanded.
|
|
26
|
-
* @type {string}
|
|
27
|
-
*/
|
|
28
|
-
const ariaExpanded = 'aria-expanded';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A global namespace for aria-haspopup.
|
|
32
|
-
* @type {string}
|
|
33
|
-
*/
|
|
34
|
-
const ariaHasPopup = 'aria-haspopup';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* A global namespace for aria-hidden.
|
|
38
|
-
* @type {string}
|
|
39
|
-
*/
|
|
40
|
-
const ariaHidden = 'aria-hidden';
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* A global namespace for aria-label.
|
|
44
|
-
* @type {string}
|
|
45
|
-
*/
|
|
46
|
-
const ariaLabel = 'aria-label';
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* A global namespace for aria-labelledby.
|
|
50
|
-
* @type {string}
|
|
51
|
-
*/
|
|
52
|
-
const ariaLabelledBy = 'aria-labelledby';
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* A global namespace for aria-modal.
|
|
56
|
-
* @type {string}
|
|
57
|
-
*/
|
|
58
|
-
const ariaModal = 'aria-modal';
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* A global namespace for aria-pressed.
|
|
62
|
-
* @type {string}
|
|
63
|
-
*/
|
|
64
|
-
const ariaPressed = 'aria-pressed';
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* A global namespace for aria-selected.
|
|
68
|
-
* @type {string}
|
|
69
|
-
*/
|
|
70
|
-
const ariaSelected = 'aria-selected';
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* A global namespace for aria-valuemin.
|
|
74
|
-
* @type {string}
|
|
75
|
-
*/
|
|
76
|
-
const ariaValueMin = 'aria-valuemin';
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* A global namespace for aria-valuemax.
|
|
80
|
-
* @type {string}
|
|
81
|
-
*/
|
|
82
|
-
const ariaValueMax = 'aria-valuemax';
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* A global namespace for aria-valuenow.
|
|
86
|
-
* @type {string}
|
|
87
|
-
*/
|
|
88
|
-
const ariaValueNow = 'aria-valuenow';
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* A global namespace for aria-valuetext.
|
|
92
|
-
* @type {string}
|
|
93
|
-
*/
|
|
94
|
-
const ariaValueText = 'aria-valuetext';
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* A global namespace for `abort` event.
|
|
98
|
-
* @type {string}
|
|
99
|
-
*/
|
|
100
|
-
const abortEvent = 'abort';
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* A global namespace for `beforeunload` event.
|
|
104
|
-
* @type {string}
|
|
105
|
-
*/
|
|
106
|
-
const beforeunloadEvent = 'beforeunload';
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* A global namespace for `blur` event.
|
|
110
|
-
* @type {string}
|
|
111
|
-
*/
|
|
112
|
-
const blurEvent = 'blur';
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* A global namespace for `change` event.
|
|
116
|
-
* @type {string}
|
|
117
|
-
*/
|
|
118
|
-
const changeEvent = 'change';
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* A global namespace for `contextmenu` event.
|
|
122
|
-
* @type {string}
|
|
123
|
-
*/
|
|
124
|
-
const contextmenuEvent = 'contextmenu';
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* A global namespace for `DOMContentLoaded` event.
|
|
128
|
-
* @type {string}
|
|
129
|
-
*/
|
|
130
|
-
const DOMContentLoadedEvent = 'DOMContentLoaded';
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* A global namespace for `DOMMouseScroll` event.
|
|
134
|
-
* @type {string}
|
|
135
|
-
*/
|
|
136
|
-
const DOMMouseScrollEvent = 'DOMMouseScroll';
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* A global namespace for `error` event.
|
|
140
|
-
* @type {string}
|
|
141
|
-
*/
|
|
142
|
-
const errorEvent = 'error';
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* A global namespace for `focus` event.
|
|
146
|
-
* @type {string}
|
|
147
|
-
*/
|
|
148
|
-
const focusEvent = 'focus';
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* A global namespace for `focusin` event.
|
|
152
|
-
* @type {string}
|
|
153
|
-
*/
|
|
154
|
-
const focusinEvent = 'focusin';
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* A global namespace for `focusout` event.
|
|
158
|
-
* @type {string}
|
|
159
|
-
*/
|
|
160
|
-
const focusoutEvent = 'focusout';
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* A global namespace for `gesturechange` event.
|
|
164
|
-
* @type {string}
|
|
165
|
-
*/
|
|
166
|
-
const gesturechangeEvent = 'gesturechange';
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* A global namespace for `gestureend` event.
|
|
170
|
-
* @type {string}
|
|
171
|
-
*/
|
|
172
|
-
const gestureendEvent = 'gestureend';
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* A global namespace for `gesturestart` event.
|
|
176
|
-
* @type {string}
|
|
177
|
-
*/
|
|
178
|
-
const gesturestartEvent = 'gesturestart';
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* A global namespace for `keydown` event.
|
|
182
|
-
* @type {string}
|
|
183
|
-
*/
|
|
184
|
-
const keydownEvent = 'keydown';
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* A global namespace for `keypress` event.
|
|
188
|
-
* @type {string}
|
|
189
|
-
*/
|
|
190
|
-
const keypressEvent = 'keypress';
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* A global namespace for `keyup` event.
|
|
194
|
-
* @type {string}
|
|
195
|
-
*/
|
|
196
|
-
const keyupEvent = 'keyup';
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* A global namespace for `load` event.
|
|
200
|
-
* @type {string}
|
|
201
|
-
*/
|
|
202
|
-
const loadEvent = 'load';
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* A global namespace for `click` event.
|
|
206
|
-
* @type {string}
|
|
207
|
-
*/
|
|
208
|
-
const mouseclickEvent = 'click';
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* A global namespace for `dblclick` event.
|
|
212
|
-
* @type {string}
|
|
213
|
-
*/
|
|
214
|
-
const mousedblclickEvent = 'dblclick';
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* A global namespace for `mousedown` event.
|
|
218
|
-
* @type {string}
|
|
219
|
-
*/
|
|
220
|
-
const mousedownEvent = 'mousedown';
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* A global namespace for `mouseup` event.
|
|
224
|
-
* @type {string}
|
|
225
|
-
*/
|
|
226
|
-
const mouseupEvent = 'mouseup';
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* A global namespace for `hover` event.
|
|
230
|
-
* @type {string}
|
|
231
|
-
*/
|
|
232
|
-
const mousehoverEvent = 'hover';
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* A global namespace for `mouseenter` event.
|
|
236
|
-
* @type {string}
|
|
237
|
-
*/
|
|
238
|
-
const mouseenterEvent = 'mouseenter';
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* A global namespace for `mouseleave` event.
|
|
242
|
-
* @type {string}
|
|
243
|
-
*/
|
|
244
|
-
const mouseleaveEvent = 'mouseleave';
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* A global namespace for `mousein` event.
|
|
248
|
-
* @type {string}
|
|
249
|
-
*/
|
|
250
|
-
const mouseinEvent = 'mousein';
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* A global namespace for `mouseout` event.
|
|
254
|
-
* @type {string}
|
|
255
|
-
*/
|
|
256
|
-
const mouseoutEvent = 'mouseout';
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* A global namespace for `mouseover` event.
|
|
260
|
-
* @type {string}
|
|
261
|
-
*/
|
|
262
|
-
const mouseoverEvent = 'mouseover';
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* A global namespace for `mousemove` event.
|
|
266
|
-
* @type {string}
|
|
267
|
-
*/
|
|
268
|
-
const mousemoveEvent = 'mousemove';
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* A global namespace for `mousewheel` event.
|
|
272
|
-
* @type {string}
|
|
273
|
-
*/
|
|
274
|
-
const mousewheelEvent = 'mousewheel';
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* A global namespace for `move` event.
|
|
278
|
-
* @type {string}
|
|
279
|
-
*/
|
|
280
|
-
const moveEvent = 'move';
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* A global namespace for `orientationchange` event.
|
|
284
|
-
* @type {string}
|
|
285
|
-
*/
|
|
286
|
-
const orientationchangeEvent = 'orientationchange';
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* A global namespace for `pointercancel` event.
|
|
290
|
-
* @type {string}
|
|
291
|
-
*/
|
|
292
|
-
const pointercancelEvent = 'pointercancel';
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* A global namespace for `pointerdown` event.
|
|
296
|
-
* @type {string}
|
|
297
|
-
*/
|
|
298
|
-
const pointerdownEvent = 'pointerdown';
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* A global namespace for `pointerleave` event.
|
|
302
|
-
* @type {string}
|
|
303
|
-
*/
|
|
304
|
-
const pointerleaveEvent = 'pointerleave';
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* A global namespace for `pointermove` event.
|
|
308
|
-
* @type {string}
|
|
309
|
-
*/
|
|
310
|
-
const pointermoveEvent = 'pointermove';
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* A global namespace for `pointerup` event.
|
|
314
|
-
* @type {string}
|
|
315
|
-
*/
|
|
316
|
-
const pointerupEvent = 'pointerup';
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* A global namespace for `readystatechange` event.
|
|
320
|
-
* @type {string}
|
|
321
|
-
*/
|
|
322
|
-
const readystatechangeEvent = 'readystatechange';
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* A global namespace for `reset` event.
|
|
326
|
-
* @type {string}
|
|
327
|
-
*/
|
|
328
|
-
const resetEvent = 'reset';
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* A global namespace for `resize` event.
|
|
332
|
-
* @type {string}
|
|
333
|
-
*/
|
|
334
|
-
const resizeEvent = 'resize';
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* A global namespace for `select` event.
|
|
338
|
-
* @type {string}
|
|
339
|
-
*/
|
|
340
|
-
const selectEvent = 'select';
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* A global namespace for the `selectend` event.
|
|
344
|
-
* @type {string}
|
|
345
|
-
*/
|
|
346
|
-
const selectendEvent = 'selectend';
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* A global namespace for the `selectstart` event.
|
|
350
|
-
* @type {string}
|
|
351
|
-
*/
|
|
352
|
-
const selectstartEvent = 'selectstart';
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* A global namespace for `scroll` event.
|
|
356
|
-
* @type {string}
|
|
357
|
-
*/
|
|
358
|
-
const scrollEvent = 'scroll';
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* A global namespace for `submit` event.
|
|
362
|
-
* @type {string}
|
|
363
|
-
*/
|
|
364
|
-
const submitEvent = 'submit';
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* A global namespace for `touchstart` event.
|
|
368
|
-
* @type {string}
|
|
369
|
-
*/
|
|
370
|
-
const touchstartEvent = 'touchstart';
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* A global namespace for `touchmove` event.
|
|
374
|
-
* @type {string}
|
|
375
|
-
*/
|
|
376
|
-
const touchmoveEvent = 'touchmove';
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* A global namespace for `touchcancel` event.
|
|
380
|
-
* @type {string}
|
|
381
|
-
*/
|
|
382
|
-
const touchcancelEvent = 'touchcancel';
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* A global namespace for `touchend` event.
|
|
386
|
-
* @type {string}
|
|
387
|
-
*/
|
|
388
|
-
const touchendEvent = 'touchend';
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* A global namespace for `unload` event.
|
|
392
|
-
* @type {string}
|
|
393
|
-
*/
|
|
394
|
-
const unloadEvent = 'unload';
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* A global namespace for all browser native events.
|
|
398
|
-
*/
|
|
399
|
-
const nativeEvents = {
|
|
400
|
-
DOMContentLoaded: DOMContentLoadedEvent,
|
|
401
|
-
DOMMouseScroll: DOMMouseScrollEvent,
|
|
402
|
-
abort: abortEvent,
|
|
403
|
-
beforeunload: beforeunloadEvent,
|
|
404
|
-
blur: blurEvent,
|
|
405
|
-
change: changeEvent,
|
|
406
|
-
click: mouseclickEvent,
|
|
407
|
-
contextmenu: contextmenuEvent,
|
|
408
|
-
dblclick: mousedblclickEvent,
|
|
409
|
-
error: errorEvent,
|
|
410
|
-
focus: focusEvent,
|
|
411
|
-
focusin: focusinEvent,
|
|
412
|
-
focusout: focusoutEvent,
|
|
413
|
-
gesturechange: gesturechangeEvent,
|
|
414
|
-
gestureend: gestureendEvent,
|
|
415
|
-
gesturestart: gesturestartEvent,
|
|
416
|
-
hover: mousehoverEvent,
|
|
417
|
-
keydown: keydownEvent,
|
|
418
|
-
keypress: keypressEvent,
|
|
419
|
-
keyup: keyupEvent,
|
|
420
|
-
load: loadEvent,
|
|
421
|
-
mousedown: mousedownEvent,
|
|
422
|
-
mousemove: mousemoveEvent,
|
|
423
|
-
mousein: mouseinEvent,
|
|
424
|
-
mouseout: mouseoutEvent,
|
|
425
|
-
mouseenter: mouseenterEvent,
|
|
426
|
-
mouseleave: mouseleaveEvent,
|
|
427
|
-
mouseover: mouseoverEvent,
|
|
428
|
-
mouseup: mouseupEvent,
|
|
429
|
-
mousewheel: mousewheelEvent,
|
|
430
|
-
move: moveEvent,
|
|
431
|
-
orientationchange: orientationchangeEvent,
|
|
432
|
-
pointercancel: pointercancelEvent,
|
|
433
|
-
pointerdown: pointerdownEvent,
|
|
434
|
-
pointerleave: pointerleaveEvent,
|
|
435
|
-
pointermove: pointermoveEvent,
|
|
436
|
-
pointerup: pointerupEvent,
|
|
437
|
-
readystatechange: readystatechangeEvent,
|
|
438
|
-
reset: resetEvent,
|
|
439
|
-
resize: resizeEvent,
|
|
440
|
-
scroll: scrollEvent,
|
|
441
|
-
select: selectEvent,
|
|
442
|
-
selectend: selectendEvent,
|
|
443
|
-
selectstart: selectstartEvent,
|
|
444
|
-
submit: submitEvent,
|
|
445
|
-
touchcancel: touchcancelEvent,
|
|
446
|
-
touchend: touchendEvent,
|
|
447
|
-
touchmove: touchmoveEvent,
|
|
448
|
-
touchstart: touchstartEvent,
|
|
449
|
-
unload: unloadEvent,
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* A global namespace for `loadstart` event.
|
|
454
|
-
* @type {string}
|
|
455
|
-
*/
|
|
456
|
-
const loadstartEvent = 'loadstart';
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* A global namespace for mouse events equivalent to touch events.
|
|
460
|
-
* @type {Record<string, string>}
|
|
461
|
-
*/
|
|
462
|
-
const mouseSwipeEvents = {
|
|
463
|
-
start: 'mousedown', end: 'mouseup', move: 'mousemove', cancel: 'mouseleave',
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* A global namespace for mouse click events.
|
|
468
|
-
* @type {Record<string, string>}
|
|
469
|
-
*/
|
|
470
|
-
const mouseClickEvents = { down: 'mousedown', up: 'mouseup' };
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* A global namespace for mouse hover events.
|
|
474
|
-
* @type {[string, string]}
|
|
475
|
-
*/
|
|
476
|
-
const mouseHoverEvents = ('onmouseleave' in document) ? ['mouseenter', 'mouseleave']
|
|
477
|
-
: /* istanbul ignore next */['mouseover', 'mouseout'];
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* A global namespace for touch events.
|
|
481
|
-
* @type {Record<string, string>}
|
|
482
|
-
*/
|
|
483
|
-
const touchEvents = {
|
|
484
|
-
start: 'touchstart', end: 'touchend', move: 'touchmove', cancel: 'touchcancel',
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* A global namespace for focus event names.
|
|
489
|
-
* @type {{in: string, out: string}}
|
|
490
|
-
*/
|
|
491
|
-
const focusEvents = { in: 'focusin', out: 'focusout' };
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* A global namespace for keyboard event keys.
|
|
495
|
-
* @type {Record<string, string>}
|
|
496
|
-
*/
|
|
497
|
-
const keyboardEventKeys = {
|
|
498
|
-
Backspace: 'Backspace', // 8
|
|
499
|
-
Tab: 'Tab', // 9
|
|
500
|
-
Enter: 'Enter', // 13
|
|
501
|
-
Shift: 'Shift', // 16
|
|
502
|
-
Control: 'Control', // 17
|
|
503
|
-
Alt: 'Alt', // 18
|
|
504
|
-
Pause: 'Pause', // 19
|
|
505
|
-
CapsLock: 'CapsLock', // 20
|
|
506
|
-
Escape: 'Escape', // 27
|
|
507
|
-
Scape: 'Space', // 32
|
|
508
|
-
ArrowLeft: 'ArrowLeft', // 37
|
|
509
|
-
ArrowUp: 'ArrowUp', // 38
|
|
510
|
-
ArrowRight: 'ArrowRight', // 39
|
|
511
|
-
ArrowDown: 'ArrowDown', // 40
|
|
512
|
-
Insert: 'Insert', // 45
|
|
513
|
-
Delete: 'Delete', // 46
|
|
514
|
-
Meta: 'Meta', // 91 windows key
|
|
515
|
-
ContextMenu: 'ContextMenu', // 93
|
|
516
|
-
ScrollLock: 'ScrollLock', // 145
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* A global namespace for `Alt` key.
|
|
521
|
-
* @type {string} e.which = 18
|
|
522
|
-
*/
|
|
523
|
-
const keyAlt = 'Alt';
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* A global namespace for `ArrowDown` key.
|
|
527
|
-
* @type {string} e.which = 40 equivalent
|
|
528
|
-
*/
|
|
529
|
-
const keyArrowDown = 'ArrowDown';
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* A global namespace for `ArrowUp` key.
|
|
533
|
-
* @type {string} e.which = 38 equivalent
|
|
534
|
-
*/
|
|
535
|
-
const keyArrowUp = 'ArrowUp';
|
|
536
|
-
|
|
537
|
-
/**
|
|
538
|
-
* A global namespace for `ArrowLeft` key.
|
|
539
|
-
* @type {string} e.which = 37 equivalent
|
|
540
|
-
*/
|
|
541
|
-
const keyArrowLeft = 'ArrowLeft';
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* A global namespace for `ArrowRight` key.
|
|
545
|
-
* @type {string} e.which = 39 equivalent
|
|
546
|
-
*/
|
|
547
|
-
const keyArrowRight = 'ArrowRight';
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* A global namespace for `Backspace` key.
|
|
551
|
-
* @type {string} e.which === 8 equivalent
|
|
552
|
-
*/
|
|
553
|
-
const keyBackspace = 'Backspace';
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* A global namespace for `CapsLock` key.
|
|
557
|
-
* @type {string} e.which = 20 equivalent
|
|
558
|
-
*/
|
|
559
|
-
const keyCapsLock = 'CapsLock';
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* A global namespace for `Control` key.
|
|
563
|
-
* @type {string} e.which = 17
|
|
564
|
-
*/
|
|
565
|
-
const keyControl = 'Control';
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* A global namespace for `Delete` key.
|
|
569
|
-
* @type {string} e.which = 46 equivalent
|
|
570
|
-
*/
|
|
571
|
-
const keyDelete = 'Delete';
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* A global namespace for `Enter` key.
|
|
575
|
-
* @type {string} e.which = 13 equivalent
|
|
576
|
-
*/
|
|
577
|
-
const keyEnter = 'Enter';
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* A global namespace for `Escape` key.
|
|
581
|
-
* @type {string} e.which = 27 equivalent
|
|
582
|
-
*/
|
|
583
|
-
const keyEscape = 'Escape';
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* A global namespace for `Insert` key.
|
|
587
|
-
* @type {string} e.which = 45 equivalent
|
|
588
|
-
*/
|
|
589
|
-
const keyInsert = 'Insert';
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* A global namespace for `Meta` key.
|
|
593
|
-
* @type {string} e.which = 93 equivalent
|
|
594
|
-
*/
|
|
595
|
-
const keyMeta = 'Meta';
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* A global namespace for `Pause` key.
|
|
599
|
-
* @type {string} e.which = 19
|
|
600
|
-
*/
|
|
601
|
-
const keyPause = 'Pause';
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* A global namespace for `ScrollLock` key.
|
|
605
|
-
* @type {string} e.which = 145 equivalent
|
|
606
|
-
*/
|
|
607
|
-
const keyScrollLock = 'ScrollLock';
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* A global namespace for `Shift` key.
|
|
611
|
-
* @type {string} e.which = 16
|
|
612
|
-
*/
|
|
613
|
-
const keyShift = 'Shift';
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* A global namespace for `Space` key.
|
|
617
|
-
* @type {string} e.which = 32 equivalent
|
|
618
|
-
*/
|
|
619
|
-
const keySpace = 'Space';
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* A global namespace for `Tab` key.
|
|
623
|
-
* @type {string} e.which = 9 equivalent
|
|
624
|
-
*/
|
|
625
|
-
const keyTab = 'Tab';
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* A global namespace for 'animationDuration' string.
|
|
629
|
-
* @type {string}
|
|
630
|
-
*/
|
|
631
|
-
const animationDuration$1 = 'animationDuration';
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* A global namespace for `document.head`.
|
|
635
|
-
*/
|
|
636
|
-
const { head: documentHead } = document;
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* A global namespace for 'animationDuration' string.
|
|
640
|
-
* @type {string}
|
|
641
|
-
*/
|
|
642
|
-
const animationDuration = 'webkitAnimation' in documentHead.style ? 'webkitAnimationDuration'
|
|
643
|
-
: /* istanbul ignore next */'animationDuration';
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* A global namespace for 'animationDelay' string.
|
|
647
|
-
* @type {string}
|
|
648
|
-
*/
|
|
649
|
-
const animationDelay$1 = 'animationDelay';
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* A global namespace for 'animationDelay' string.
|
|
653
|
-
* @type {string}
|
|
654
|
-
*/
|
|
655
|
-
const animationDelay = 'webkitAnimation' in documentHead.style ? 'webkitAnimationDelay'
|
|
656
|
-
: /* istanbul ignore next */'animationDelay';
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* A global namespace for 'animationName' string.
|
|
660
|
-
* @type {string}
|
|
661
|
-
*/
|
|
662
|
-
const animationName$1 = 'animationName';
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* A global namespace for 'animationName' string.
|
|
666
|
-
* @type {string}
|
|
667
|
-
*/
|
|
668
|
-
const animationName = 'webkitAnimation' in documentHead.style ? 'webkitAnimationName'
|
|
669
|
-
: /* istanbul ignore next */'animationName';
|
|
670
|
-
|
|
671
|
-
/**
|
|
672
|
-
* A global namespace for 'animationend' string.
|
|
673
|
-
* @type {string}
|
|
674
|
-
*/
|
|
675
|
-
const animationEndEvent$1 = 'animationend';
|
|
676
|
-
|
|
677
|
-
/**
|
|
678
|
-
* A global namespace for 'animationend' string.
|
|
679
|
-
* @type {string}
|
|
680
|
-
*/
|
|
681
|
-
const animationEndEvent = 'webkitAnimation' in documentHead.style ? 'webkitAnimationEnd'
|
|
682
|
-
: /* istanbul ignore next */'animationend';
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* A global namespace for 'transitionDuration' string.
|
|
686
|
-
* @type {string}
|
|
687
|
-
*/
|
|
688
|
-
const transitionDuration$1 = 'transitionDuration';
|
|
689
|
-
|
|
690
|
-
/**
|
|
691
|
-
* A global namespace for 'transitionDuration' string.
|
|
692
|
-
* @type {string}
|
|
693
|
-
*/
|
|
694
|
-
const transitionDuration = 'webkitTransition' in documentHead.style ? 'webkitTransitionDuration'
|
|
695
|
-
: /* istanbul ignore next */'transitionDuration';
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* A global namespace for 'transitionDelay' string.
|
|
699
|
-
* @type {string}
|
|
700
|
-
*/
|
|
701
|
-
const transitionDelay$1 = 'transitionDelay';
|
|
702
|
-
|
|
703
|
-
/**
|
|
704
|
-
* A global namespace for 'transitionDelay' string.
|
|
705
|
-
* @type {string}
|
|
706
|
-
*/
|
|
707
|
-
const transitionDelay = 'webkitTransition' in documentHead.style ? 'webkitTransitionDelay'
|
|
708
|
-
: /* istanbul ignore next */'transitionDelay';
|
|
709
|
-
|
|
710
|
-
/**
|
|
711
|
-
* A global namespace for 'transitionend' string.
|
|
712
|
-
* @type {string}
|
|
713
|
-
*/
|
|
714
|
-
const transitionEndEvent$1 = 'transitionend';
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* A global namespace for 'transitionend' string.
|
|
718
|
-
* @type {string}
|
|
719
|
-
*/
|
|
720
|
-
const transitionEndEvent = 'webkitTransition' in documentHead.style ? 'webkitTransitionEnd'
|
|
721
|
-
: /* istanbul ignore next */'transitionend';
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* A global namespace for `transitionProperty` string for modern browsers.
|
|
725
|
-
*
|
|
726
|
-
* @type {string}
|
|
727
|
-
*/
|
|
728
|
-
const transitionProperty$1 = 'transitionProperty';
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* A global namespace for:
|
|
732
|
-
* * `transitionProperty` string for modern brosers,
|
|
733
|
-
* * `webkitTransition` for legacy Chrome / Safari browsers
|
|
734
|
-
*
|
|
735
|
-
* @type {string}
|
|
736
|
-
*/
|
|
737
|
-
const transitionProperty = 'webkitTransition' in documentHead.style ? 'webkitTransitionProperty'
|
|
738
|
-
: /* istanbul ignore next */'transitionProperty';
|
|
739
|
-
|
|
740
|
-
/**
|
|
741
|
-
* A global namespace for 'addEventListener' string.
|
|
742
|
-
* @type {string}
|
|
743
|
-
*/
|
|
744
|
-
const addEventListener = 'addEventListener';
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* A global namespace for 'removeEventListener' string.
|
|
748
|
-
* @type {string}
|
|
749
|
-
*/
|
|
750
|
-
const removeEventListener = 'removeEventListener';
|
|
751
|
-
|
|
752
|
-
/**
|
|
753
|
-
* A global namespace for predefined
|
|
754
|
-
* CSS3 'cubic-bezier()' easing functions.
|
|
755
|
-
* @type {Record<string, string>}
|
|
756
|
-
*/
|
|
757
|
-
const bezierEasings = {
|
|
758
|
-
linear: 'linear',
|
|
759
|
-
easingSinusoidalIn: 'cubic-bezier(0.47,0,0.745,0.715)',
|
|
760
|
-
easingSinusoidalOut: 'cubic-bezier(0.39,0.575,0.565,1)',
|
|
761
|
-
easingSinusoidalInOut: 'cubic-bezier(0.445,0.05,0.55,0.95)',
|
|
762
|
-
easingQuadraticIn: 'cubic-bezier(0.550,0.085,0.680,0.530)',
|
|
763
|
-
easingQuadraticOut: 'cubic-bezier(0.250,0.460,0.450,0.940)',
|
|
764
|
-
easingQuadraticInOut: 'cubic-bezier(0.455,0.030,0.515,0.955)',
|
|
765
|
-
easingCubicIn: 'cubic-bezier(0.55,0.055,0.675,0.19)',
|
|
766
|
-
easingCubicOut: 'cubic-bezier(0.215,0.61,0.355,1)',
|
|
767
|
-
easingCubicInOut: 'cubic-bezier(0.645,0.045,0.355,1)',
|
|
768
|
-
easingQuarticIn: 'cubic-bezier(0.895,0.03,0.685,0.22)',
|
|
769
|
-
easingQuarticOut: 'cubic-bezier(0.165,0.84,0.44,1)',
|
|
770
|
-
easingQuarticInOut: 'cubic-bezier(0.77,0,0.175,1)',
|
|
771
|
-
easingQuinticIn: 'cubic-bezier(0.755,0.05,0.855,0.06)',
|
|
772
|
-
easingQuinticOut: 'cubic-bezier(0.23,1,0.32,1)',
|
|
773
|
-
easingQuinticInOut: 'cubic-bezier(0.86,0,0.07,1)',
|
|
774
|
-
easingExponentialIn: 'cubic-bezier(0.95,0.05,0.795,0.035)',
|
|
775
|
-
easingExponentialOut: 'cubic-bezier(0.19,1,0.22,1)',
|
|
776
|
-
easingExponentialInOut: 'cubic-bezier(1,0,0,1)',
|
|
777
|
-
easingCircularIn: 'cubic-bezier(0.6,0.04,0.98,0.335)',
|
|
778
|
-
easingCircularOut: 'cubic-bezier(0.075,0.82,0.165,1)',
|
|
779
|
-
easingCircularInOut: 'cubic-bezier(0.785,0.135,0.15,0.86)',
|
|
780
|
-
easingBackIn: 'cubic-bezier(0.6,-0.28,0.735,0.045)',
|
|
781
|
-
easingBackOut: 'cubic-bezier(0.175,0.885,0.32,1.275)',
|
|
782
|
-
easingBackInOut: 'cubic-bezier(0.68,-0.55,0.265,1.55)',
|
|
783
|
-
};
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
* A global namespace for `offsetHeight` property.
|
|
787
|
-
* @type {string}
|
|
788
|
-
*/
|
|
789
|
-
const offsetHeight = 'offsetHeight';
|
|
790
|
-
|
|
791
|
-
/**
|
|
792
|
-
* A global namespace for `offsetWidth` property.
|
|
793
|
-
* @type {string}
|
|
794
|
-
*/
|
|
795
|
-
const offsetWidth = 'offsetWidth';
|
|
796
|
-
|
|
797
|
-
/**
|
|
798
|
-
* A global namespace for `scrollHeight` property.
|
|
799
|
-
* @type {string}
|
|
800
|
-
*/
|
|
801
|
-
const scrollHeight = 'scrollHeight';
|
|
802
|
-
|
|
803
|
-
/**
|
|
804
|
-
* A global namespace for `scrollWidth` property.
|
|
805
|
-
* @type {string}
|
|
806
|
-
*/
|
|
807
|
-
const scrollWidth = 'scrollWidth';
|
|
808
|
-
|
|
809
|
-
const { userAgentData: uaDATA } = navigator;
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* A global namespace for `userAgentData` object.
|
|
813
|
-
*/
|
|
814
|
-
const userAgentData = uaDATA;
|
|
815
|
-
|
|
816
|
-
const { userAgent: userAgentString } = navigator;
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* A global namespace for `navigator.userAgent` string.
|
|
820
|
-
*/
|
|
821
|
-
const userAgent = userAgentString;
|
|
822
|
-
|
|
823
|
-
const mobileBrands = /iPhone|iPad|iPod|Android/i;
|
|
824
|
-
let isMobileCheck = false;
|
|
825
|
-
|
|
826
|
-
/* istanbul ignore else */
|
|
827
|
-
if (userAgentData) {
|
|
828
|
-
isMobileCheck = userAgentData.brands.some((x) => mobileBrands.test(x.brand));
|
|
829
|
-
} else {
|
|
830
|
-
isMobileCheck = mobileBrands.test(userAgent);
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* A global `boolean` for mobile detection.
|
|
835
|
-
* @type {boolean}
|
|
836
|
-
*/
|
|
837
|
-
const isMobile = isMobileCheck;
|
|
838
|
-
|
|
839
|
-
const appleBrands = /(iPhone|iPod|iPad)/;
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* A global `boolean` for Apple browsers.
|
|
843
|
-
* @type {boolean}
|
|
844
|
-
*/
|
|
845
|
-
const isApple = userAgentData ? userAgentData.brands.some((x) => appleBrands.test(x.brand))
|
|
846
|
-
: /* istanbul ignore next */appleBrands.test(userAgent);
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* A global boolean for Gecko browsers. When writing this file,
|
|
850
|
-
* Gecko was not supporting `userAgentData`.
|
|
851
|
-
* @type {boolean}
|
|
852
|
-
*/
|
|
853
|
-
const isFirefox = userAgent ? userAgent.includes('Firefox')
|
|
854
|
-
: /* istanbul ignore next */false;
|
|
855
|
-
|
|
856
|
-
/**
|
|
857
|
-
* A global `boolean` for CSS3 3D transform support.
|
|
858
|
-
* @type {boolean}
|
|
859
|
-
*/
|
|
860
|
-
const support3DTransform = 'webkitPerspective' in documentHead.style
|
|
861
|
-
|| /* istanbul ignore next */'perspective' in documentHead.style;
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* Add eventListener to an `HTMLElement` | `Document` target.
|
|
865
|
-
*
|
|
866
|
-
* @type {SHORTY.OnOff<EventTarget>}
|
|
867
|
-
*/
|
|
868
|
-
function on(element, eventName, listener, options) {
|
|
869
|
-
const ops = options || false;
|
|
870
|
-
element.addEventListener(eventName, listener, ops);
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
/**
|
|
874
|
-
* Remove eventListener from an `HTMLElement` | `Document` | `Window` target.
|
|
875
|
-
*
|
|
876
|
-
* @type {SHORTY.OnOff<EventTarget>}
|
|
877
|
-
*/
|
|
878
|
-
function off(element, eventName, listener, options) {
|
|
879
|
-
const ops = options || false;
|
|
880
|
-
element.removeEventListener(eventName, listener, ops);
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* Add an `eventListener` to an `HTMLElement` | `Document` | `Window`
|
|
885
|
-
* target and remove it once callback is called.
|
|
886
|
-
*
|
|
887
|
-
* @type {SHORTY.OnOff<EventTarget>}
|
|
888
|
-
*/
|
|
889
|
-
function one(element, eventName, listener, options) {
|
|
890
|
-
/**
|
|
891
|
-
* Wrap the listener for easy on -> off
|
|
892
|
-
* @type {EventListener}
|
|
893
|
-
*/
|
|
894
|
-
const handlerWrapper = (e) => {
|
|
895
|
-
/* istanbul ignore else */
|
|
896
|
-
if (e.target === element) {
|
|
897
|
-
listener.apply(element, [e]);
|
|
898
|
-
off(element, eventName, handlerWrapper, options);
|
|
899
|
-
}
|
|
900
|
-
};
|
|
901
|
-
on(element, eventName, handlerWrapper, options);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
/**
|
|
905
|
-
* A global `boolean` for passive events support,
|
|
906
|
-
* in general event options are not suited for scroll prevention.
|
|
907
|
-
*
|
|
908
|
-
* @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
|
|
909
|
-
* @type {boolean}
|
|
910
|
-
*/
|
|
911
|
-
const supportPassive = (() => {
|
|
912
|
-
let result = false;
|
|
913
|
-
try {
|
|
914
|
-
const opts = Object.defineProperty({}, 'passive', {
|
|
915
|
-
get() {
|
|
916
|
-
result = true;
|
|
917
|
-
return result;
|
|
918
|
-
},
|
|
919
|
-
});
|
|
920
|
-
one(document, DOMContentLoadedEvent, () => {}, opts);
|
|
921
|
-
} catch (e) {
|
|
922
|
-
// throw Error('Passive events are not supported');
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
return result;
|
|
926
|
-
})();
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
* A global `boolean` for CSS3 transform support.
|
|
930
|
-
* @type {boolean}
|
|
931
|
-
*/
|
|
932
|
-
const supportTransform = 'webkitTransform' in documentHead.style
|
|
933
|
-
|| /* istanbul ignore next */'transform' in documentHead.style;
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* A global `boolean` for touch events support.
|
|
937
|
-
* @type {boolean}
|
|
938
|
-
*/
|
|
939
|
-
const supportTouch = 'ontouchstart' in window
|
|
940
|
-
|| /* istanbul ignore next */'msMaxTouchPoints' in navigator;
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* A global `boolean` for CSS3 animation support.
|
|
944
|
-
* @type {boolean}
|
|
945
|
-
*/
|
|
946
|
-
const supportAnimation = 'webkitAnimation' in documentHead.style
|
|
947
|
-
|| /* istanbul ignore next */'animation' in documentHead.style;
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* A global `boolean` for CSS3 transition support.
|
|
951
|
-
* @type {boolean}
|
|
952
|
-
*/
|
|
953
|
-
const supportTransition = 'webkitTransition' in documentHead.style
|
|
954
|
-
|| /* istanbul ignore next */'transition' in documentHead.style;
|
|
955
|
-
|
|
956
|
-
/**
|
|
957
|
-
* Shortcut for `HTMLElement.getAttribute()` method.
|
|
958
|
-
* @param {HTMLElement} element target element
|
|
959
|
-
* @param {string} attribute attribute name
|
|
960
|
-
* @returns {string?} attribute value
|
|
961
|
-
*/
|
|
962
|
-
const getAttribute = (element, attribute) => element.getAttribute(attribute);
|
|
963
|
-
|
|
964
|
-
/**
|
|
965
|
-
* Shortcut for `HTMLElement.getAttributeNS()` method.
|
|
966
|
-
* @param {string} ns attribute namespace
|
|
967
|
-
* @param {HTMLElement} element target element
|
|
968
|
-
* @param {string} attribute attribute name
|
|
969
|
-
* @returns {string?} attribute value
|
|
970
|
-
*/
|
|
971
|
-
const getAttributeNS = (ns, element, attribute) => element.getAttributeNS(ns, attribute);
|
|
972
|
-
|
|
973
|
-
/**
|
|
974
|
-
* Shortcut for `HTMLElement.hasAttribute()` method.
|
|
975
|
-
* @param {HTMLElement} element target element
|
|
976
|
-
* @param {string} attribute attribute name
|
|
977
|
-
* @returns {boolean} the query result
|
|
978
|
-
*/
|
|
979
|
-
const hasAttribute = (element, attribute) => element.hasAttribute(attribute);
|
|
980
|
-
|
|
981
|
-
/**
|
|
982
|
-
* Shortcut for `HTMLElement.hasAttributeNS()` method.
|
|
983
|
-
* @param {string} ns attribute namespace
|
|
984
|
-
* @param {HTMLElement} element target element
|
|
985
|
-
* @param {string} att attribute name
|
|
986
|
-
* @returns {boolean} the query result
|
|
987
|
-
*/
|
|
988
|
-
const hasAttributeNS = (ns, element, att) => element.hasAttributeNS(ns, att);
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Shortcut for `HTMLElement.setAttribute()` method.
|
|
992
|
-
* @param {HTMLElement} element target element
|
|
993
|
-
* @param {string} attribute attribute name
|
|
994
|
-
* @param {string} value attribute value
|
|
995
|
-
* @returns {void}
|
|
996
|
-
*/
|
|
997
|
-
const setAttribute = (element, attribute, value) => element.setAttribute(attribute, value);
|
|
998
|
-
|
|
999
|
-
/**
|
|
1000
|
-
* Shortcut for `SVGElement.setAttributeNS()` method.
|
|
1001
|
-
* @param {string} ns attribute namespace
|
|
1002
|
-
* @param {HTMLElement} element target element
|
|
1003
|
-
* @param {string} att attribute name
|
|
1004
|
-
* @param {string} value attribute value
|
|
1005
|
-
* @returns {void}
|
|
1006
|
-
*/
|
|
1007
|
-
const setAttributeNS = (ns, element, att, value) => element.setAttributeNS(ns, att, value);
|
|
1008
|
-
|
|
1009
|
-
/**
|
|
1010
|
-
* Shortcut for `HTMLElement.removeAttribute()` method.
|
|
1011
|
-
* @param {HTMLElement} element target element
|
|
1012
|
-
* @param {string} attribute attribute name
|
|
1013
|
-
* @returns {void}
|
|
1014
|
-
*/
|
|
1015
|
-
const removeAttribute = (element, attribute) => element.removeAttribute(attribute);
|
|
1016
|
-
|
|
1017
|
-
/**
|
|
1018
|
-
* Shortcut for `HTMLElement.removeAttributeNS()` method.
|
|
1019
|
-
* @param {string} ns attribute namespace
|
|
1020
|
-
* @param {HTMLElement} element target element
|
|
1021
|
-
* @param {string} att attribute name
|
|
1022
|
-
* @returns {void}
|
|
1023
|
-
*/
|
|
1024
|
-
const removeAttributeNS = (ns, element, att) => element.removeAttributeNS(ns, att);
|
|
1025
|
-
|
|
1026
|
-
/**
|
|
1027
|
-
* Add class to `HTMLElement.classList`.
|
|
1028
|
-
*
|
|
1029
|
-
* @param {HTMLElement} element target
|
|
1030
|
-
* @param {string} classNAME to add
|
|
1031
|
-
* @returns {void}
|
|
1032
|
-
*/
|
|
1033
|
-
function addClass(element, classNAME) {
|
|
1034
|
-
element.classList.add(classNAME);
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
/**
|
|
1038
|
-
* Remove class from `HTMLElement.classList`.
|
|
1039
|
-
*
|
|
1040
|
-
* @param {HTMLElement} element target
|
|
1041
|
-
* @param {string} classNAME to remove
|
|
1042
|
-
* @returns {void}
|
|
1043
|
-
*/
|
|
1044
|
-
function removeClass(element, classNAME) {
|
|
1045
|
-
element.classList.remove(classNAME);
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
/**
|
|
1049
|
-
* Check class in `HTMLElement.classList`.
|
|
1050
|
-
*
|
|
1051
|
-
* @param {HTMLElement} element target
|
|
1052
|
-
* @param {string} classNAME to check
|
|
1053
|
-
* @returns {boolean}
|
|
1054
|
-
*/
|
|
1055
|
-
function hasClass(element, classNAME) {
|
|
1056
|
-
return element.classList.contains(classNAME);
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* Shortcut for `Array.from()` static method.
|
|
1061
|
-
*
|
|
1062
|
-
* @param {any[] | HTMLCollection | NodeList | Map<any, any>} arr array-like iterable object
|
|
1063
|
-
* @returns {Array<any>}
|
|
1064
|
-
*/
|
|
1065
|
-
const ArrayFrom = (arr) => Array.from(arr);
|
|
1066
|
-
|
|
1067
|
-
/**
|
|
1068
|
-
* Checks if an element is an `HTMLElement`.
|
|
1069
|
-
* @see https://dom.spec.whatwg.org/#node
|
|
1070
|
-
*
|
|
1071
|
-
* @param {any} element the target object
|
|
1072
|
-
* @returns {boolean} the query result
|
|
1073
|
-
*/
|
|
1074
|
-
const isHTMLElement = (element) => (element && element.nodeType === 1) || false;
|
|
1075
|
-
|
|
1076
|
-
/** @type {Map<string, Map<HTMLElement, Record<string, any>>>} */
|
|
1077
|
-
const componentData = new Map();
|
|
1078
|
-
/**
|
|
1079
|
-
* An interface for web components background data.
|
|
1080
|
-
* @see https://github.com/thednp/bootstrap.native/blob/master/src/components/base-component.js
|
|
1081
|
-
*/
|
|
1082
|
-
const Data = {
|
|
1083
|
-
/**
|
|
1084
|
-
* Sets web components data.
|
|
1085
|
-
* @param {HTMLElement} element target element
|
|
1086
|
-
* @param {string} component the component's name or a unique key
|
|
1087
|
-
* @param {Record<string, any>} instance the component instance
|
|
1088
|
-
*/
|
|
1089
|
-
set: (element, component, instance) => {
|
|
1090
|
-
if (!isHTMLElement(element)) return;
|
|
1091
|
-
|
|
1092
|
-
/* istanbul ignore else */
|
|
1093
|
-
if (!componentData.has(component)) {
|
|
1094
|
-
componentData.set(component, new Map());
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
const instanceMap = componentData.get(component);
|
|
1098
|
-
// not undefined, but defined right above
|
|
1099
|
-
instanceMap.set(element, instance);
|
|
1100
|
-
},
|
|
1101
|
-
|
|
1102
|
-
/**
|
|
1103
|
-
* Returns all instances for specified component.
|
|
1104
|
-
* @param {string} component the component's name or a unique key
|
|
1105
|
-
* @returns {Map<HTMLElement, Record<string, any>>?} all the component instances
|
|
1106
|
-
*/
|
|
1107
|
-
getAllFor: (component) => {
|
|
1108
|
-
const instanceMap = componentData.get(component);
|
|
1109
|
-
|
|
1110
|
-
return instanceMap || null;
|
|
1111
|
-
},
|
|
1112
|
-
|
|
1113
|
-
/**
|
|
1114
|
-
* Returns the instance associated with the target.
|
|
1115
|
-
* @param {HTMLElement} element target element
|
|
1116
|
-
* @param {string} component the component's name or a unique key
|
|
1117
|
-
* @returns {Record<string, any>?} the instance
|
|
1118
|
-
*/
|
|
1119
|
-
get: (element, component) => {
|
|
1120
|
-
if (!isHTMLElement(element) || !component) return null;
|
|
1121
|
-
const allForC = Data.getAllFor(component);
|
|
1122
|
-
const instance = element && allForC && allForC.get(element);
|
|
1123
|
-
|
|
1124
|
-
return instance || null;
|
|
1125
|
-
},
|
|
1126
|
-
|
|
1127
|
-
/**
|
|
1128
|
-
* Removes web components data.
|
|
1129
|
-
* @param {HTMLElement} element target element
|
|
1130
|
-
* @param {string} component the component's name or a unique key
|
|
1131
|
-
*/
|
|
1132
|
-
remove: (element, component) => {
|
|
1133
|
-
const instanceMap = componentData.get(component);
|
|
1134
|
-
if (!instanceMap || !isHTMLElement(element)) return;
|
|
1135
|
-
|
|
1136
|
-
instanceMap.delete(element);
|
|
1137
|
-
|
|
1138
|
-
/* istanbul ignore else */
|
|
1139
|
-
if (instanceMap.size === 0) {
|
|
1140
|
-
componentData.delete(component);
|
|
1141
|
-
}
|
|
1142
|
-
},
|
|
1143
|
-
};
|
|
1144
|
-
|
|
1145
|
-
/**
|
|
1146
|
-
* An alias for `Data.get()`.
|
|
1147
|
-
* @type {SHORTY.getInstance<any>}
|
|
1148
|
-
*/
|
|
1149
|
-
const getInstance = (target, component) => Data.get(target, component);
|
|
1150
|
-
|
|
1151
|
-
/**
|
|
1152
|
-
* Checks if an object is a `Document`.
|
|
1153
|
-
* @see https://dom.spec.whatwg.org/#node
|
|
1154
|
-
*
|
|
1155
|
-
* @param {any} object the target object
|
|
1156
|
-
* @returns {boolean} the query result
|
|
1157
|
-
*/
|
|
1158
|
-
const isDocument = (object) => (object && object.nodeType === 9) || false;
|
|
1159
|
-
|
|
1160
|
-
/**
|
|
1161
|
-
* Checks if an object is a `Node`.
|
|
1162
|
-
*
|
|
1163
|
-
* @param {any} node the target object
|
|
1164
|
-
* @returns {boolean} the query result
|
|
1165
|
-
*/
|
|
1166
|
-
const isNode = (element) => (element && [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
|
1167
|
-
.some((x) => +element.nodeType === x)) || false;
|
|
1168
|
-
|
|
1169
|
-
/**
|
|
1170
|
-
* Check if a target object is `Window`.
|
|
1171
|
-
* => equivalent to `object instanceof Window`
|
|
1172
|
-
*
|
|
1173
|
-
* @param {any} object the target object
|
|
1174
|
-
* @returns {boolean} the query result
|
|
1175
|
-
*/
|
|
1176
|
-
const isWindow = (object) => (object && object.constructor.name === 'Window') || false;
|
|
1177
|
-
|
|
1178
|
-
/**
|
|
1179
|
-
* Returns the `document` or the `#document` element.
|
|
1180
|
-
* @see https://github.com/floating-ui/floating-ui
|
|
1181
|
-
* @param {(ParentNode | Window)=} node
|
|
1182
|
-
* @returns {Document}
|
|
1183
|
-
*/
|
|
1184
|
-
function getDocument(node) {
|
|
1185
|
-
if (isDocument(node)) return node;
|
|
1186
|
-
if (isNode(node)) return node.ownerDocument;
|
|
1187
|
-
if (isWindow(node)) return node.document;
|
|
1188
|
-
return window.document;
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
/**
|
|
1192
|
-
* Shortcut for `Object.assign()` static method.
|
|
1193
|
-
* @param {Record<string, any>} obj a target object
|
|
1194
|
-
* @param {Record<string, any>} source a source object
|
|
1195
|
-
*/
|
|
1196
|
-
const ObjectAssign = (obj, source) => Object.assign(obj, source);
|
|
1197
|
-
|
|
1198
|
-
/**
|
|
1199
|
-
* This is a shortie for `document.createElement` method
|
|
1200
|
-
* which allows you to create a new `HTMLElement` for a given `tagName`
|
|
1201
|
-
* or based on an object with specific non-readonly attributes:
|
|
1202
|
-
* `id`, `className`, `textContent`, `style`, etc.
|
|
1203
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
|
|
1204
|
-
*
|
|
1205
|
-
* @param {Record<string, string> | string} param `tagName` or object
|
|
1206
|
-
* @return {HTMLElement} a new `HTMLElement` or `Element`
|
|
1207
|
-
*/
|
|
1208
|
-
function createElement(param) {
|
|
1209
|
-
if (!param) return null;
|
|
1210
|
-
|
|
1211
|
-
if (typeof param === 'string') {
|
|
1212
|
-
return getDocument().createElement(param);
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
const { tagName } = param;
|
|
1216
|
-
const attr = { ...param };
|
|
1217
|
-
const newElement = createElement(tagName);
|
|
1218
|
-
delete attr.tagName;
|
|
1219
|
-
ObjectAssign(newElement, attr);
|
|
1220
|
-
return newElement;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
/**
|
|
1224
|
-
* Shortcut for `Object.entries()` static method.
|
|
1225
|
-
* @param {Record<string, any>} obj a target object
|
|
1226
|
-
* @returns {[string, any][]}
|
|
1227
|
-
*/
|
|
1228
|
-
const ObjectEntries = (obj) => Object.entries(obj);
|
|
1229
|
-
|
|
1230
|
-
/**
|
|
1231
|
-
* This is a shortie for `document.createElementNS` method
|
|
1232
|
-
* which allows you to create a new `HTMLElement` for a given `tagName`
|
|
1233
|
-
* or based on an object with specific non-readonly attributes:
|
|
1234
|
-
* `id`, `className`, `textContent`, `style`, etc.
|
|
1235
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS
|
|
1236
|
-
*
|
|
1237
|
-
* @param {string} namespace `namespaceURI` to associate with the new `HTMLElement`
|
|
1238
|
-
* @param {Record<string, string> | string} param `tagName` or object
|
|
1239
|
-
* @return {HTMLElement} a new `HTMLElement` or `Element`
|
|
1240
|
-
*/
|
|
1241
|
-
function createElementNS(namespace, param) {
|
|
1242
|
-
if (!namespace && !param) return null;
|
|
1243
|
-
if (typeof param === 'string') {
|
|
1244
|
-
return getDocument().createElementNS(namespace, param);
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
const { tagName } = param;
|
|
1248
|
-
const attr = { ...param };
|
|
1249
|
-
const newElement = createElementNS(namespace, tagName);
|
|
1250
|
-
delete attr.tagName;
|
|
1251
|
-
ObjectEntries(attr).forEach(([key, value]) => {
|
|
1252
|
-
setAttribute(newElement, key, value);
|
|
1253
|
-
});
|
|
1254
|
-
return newElement;
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
/**
|
|
1258
|
-
* Shortcut for the `Element.dispatchEvent(Event)` method.
|
|
1259
|
-
*
|
|
1260
|
-
* @param {HTMLElement} element is the target
|
|
1261
|
-
* @param {Event} event is the `Event` object
|
|
1262
|
-
*/
|
|
1263
|
-
const dispatchEvent = (element, event) => element.dispatchEvent(event);
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
* JavaScript `Array` distinct.
|
|
1267
|
-
* @see https://codeburst.io/javascript-array-distinct-5edc93501dc4
|
|
1268
|
-
* @param {any} value
|
|
1269
|
-
* @param {number} index
|
|
1270
|
-
* @param {any} self
|
|
1271
|
-
* @returns {boolean}
|
|
1272
|
-
*/
|
|
1273
|
-
const distinct = (value, index, self) => self.indexOf(value) === index;
|
|
1274
|
-
|
|
1275
|
-
/**
|
|
1276
|
-
* Shortcut for `window.getComputedStyle(element).propertyName`
|
|
1277
|
-
* static method.
|
|
1278
|
-
*
|
|
1279
|
-
* * If `element` parameter is not an `HTMLElement`, `getComputedStyle`
|
|
1280
|
-
* throws a `ReferenceError`.
|
|
1281
|
-
*
|
|
1282
|
-
* @param {HTMLElement} element target
|
|
1283
|
-
* @param {string} property the css property
|
|
1284
|
-
* @return {string} the css property value
|
|
1285
|
-
*/
|
|
1286
|
-
function getElementStyle(element, property) {
|
|
1287
|
-
const computedStyle = getComputedStyle(element);
|
|
1288
|
-
|
|
1289
|
-
// must use camelcase strings,
|
|
1290
|
-
// or non-camelcase strings with `getPropertyValue`
|
|
1291
|
-
return property.includes('--')
|
|
1292
|
-
? computedStyle.getPropertyValue(property)
|
|
1293
|
-
: computedStyle[property];
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
/**
|
|
1297
|
-
* Utility to get the computed `animationDelay`
|
|
1298
|
-
* from Element in miliseconds.
|
|
1299
|
-
*
|
|
1300
|
-
* @param {HTMLElement} element target
|
|
1301
|
-
* @return {number} the value in miliseconds
|
|
1302
|
-
*/
|
|
1303
|
-
function getElementAnimationDelay$1(element) {
|
|
1304
|
-
const propertyValue = getElementStyle(element, animationName$1);
|
|
1305
|
-
const durationValue = getElementStyle(element, animationDelay$1);
|
|
1306
|
-
const durationScale = durationValue.includes('ms') ? /* istanbul ignore next */1 : 1000;
|
|
1307
|
-
const duration = propertyValue && propertyValue !== 'none'
|
|
1308
|
-
? parseFloat(durationValue) * durationScale : 0;
|
|
1309
|
-
|
|
1310
|
-
/* istanbul ignore next */
|
|
1311
|
-
return !Number.isNaN(duration) ? duration : 0;
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
/**
|
|
1315
|
-
* Utility to get the computed `animationDuration`
|
|
1316
|
-
* from `HTMLElement` in miliseconds.
|
|
1317
|
-
*
|
|
1318
|
-
* @param {HTMLElement} element target
|
|
1319
|
-
* @return {number} the value in miliseconds
|
|
1320
|
-
*/
|
|
1321
|
-
function getElementAnimationDuration$1(element) {
|
|
1322
|
-
const propertyValue = getElementStyle(element, animationName$1);
|
|
1323
|
-
const durationValue = getElementStyle(element, animationDuration$1);
|
|
1324
|
-
const durationScale = durationValue.includes('ms') ? /* istanbul ignore next */1 : 1000;
|
|
1325
|
-
const duration = propertyValue && propertyValue !== 'none'
|
|
1326
|
-
? parseFloat(durationValue) * durationScale : 0;
|
|
1327
|
-
|
|
1328
|
-
return !Number.isNaN(duration) ? duration : /* istanbul ignore next */0;
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
/**
|
|
1332
|
-
* Utility to make sure callbacks are consistently
|
|
1333
|
-
* called when animation ends.
|
|
1334
|
-
*
|
|
1335
|
-
* @param {HTMLElement} element target
|
|
1336
|
-
* @param {EventListener} handler `animationend` callback
|
|
1337
|
-
*/
|
|
1338
|
-
function emulateAnimationEnd$1(element, handler) {
|
|
1339
|
-
let called = 0;
|
|
1340
|
-
const endEvent = new Event(animationEndEvent$1);
|
|
1341
|
-
const duration = getElementAnimationDuration$1(element);
|
|
1342
|
-
const delay = getElementAnimationDelay$1(element);
|
|
1343
|
-
|
|
1344
|
-
if (duration) {
|
|
1345
|
-
/**
|
|
1346
|
-
* Wrap the handler in on -> off callback
|
|
1347
|
-
* @type {EventListener}
|
|
1348
|
-
*/
|
|
1349
|
-
const animationEndWrapper = (e) => {
|
|
1350
|
-
/* istanbul ignore else */
|
|
1351
|
-
if (e.target === element) {
|
|
1352
|
-
handler.apply(element, [e]);
|
|
1353
|
-
element.removeEventListener(animationEndEvent$1, animationEndWrapper);
|
|
1354
|
-
called = 1;
|
|
1355
|
-
}
|
|
1356
|
-
};
|
|
1357
|
-
element.addEventListener(animationEndEvent$1, animationEndWrapper);
|
|
1358
|
-
setTimeout(() => {
|
|
1359
|
-
/* istanbul ignore next */
|
|
1360
|
-
if (!called) dispatchEvent(element, endEvent);
|
|
1361
|
-
}, duration + delay + 17);
|
|
1362
|
-
} else {
|
|
1363
|
-
handler.apply(element, [endEvent]);
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
/**
|
|
1368
|
-
* Utility to get the computed `animationDelay`
|
|
1369
|
-
* from Element in miliseconds.
|
|
1370
|
-
*
|
|
1371
|
-
* @param {HTMLElement} element target
|
|
1372
|
-
* @return {number} the value in miliseconds
|
|
1373
|
-
*/
|
|
1374
|
-
function getElementAnimationDelay(element) {
|
|
1375
|
-
const propertyValue = getElementStyle(element, animationName);
|
|
1376
|
-
const durationValue = getElementStyle(element, animationDelay);
|
|
1377
|
-
const durationScale = durationValue.includes('ms') ? /* istanbul ignore next */1 : 1000;
|
|
1378
|
-
const duration = supportAnimation && propertyValue && propertyValue !== 'none'
|
|
1379
|
-
? parseFloat(durationValue) * durationScale : 0;
|
|
1380
|
-
|
|
1381
|
-
return !Number.isNaN(duration) ? duration : /* istanbul ignore next */0;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
/**
|
|
1385
|
-
* Utility to get the computed `animationDuration`
|
|
1386
|
-
* from `HTMLElement` in miliseconds.
|
|
1387
|
-
*
|
|
1388
|
-
* @param {HTMLElement} element target
|
|
1389
|
-
* @return {number} the value in miliseconds
|
|
1390
|
-
*/
|
|
1391
|
-
function getElementAnimationDuration(element) {
|
|
1392
|
-
const propertyValue = getElementStyle(element, animationName);
|
|
1393
|
-
const durationValue = getElementStyle(element, animationDuration);
|
|
1394
|
-
const durationScale = durationValue.includes('ms') ? /* istanbul ignore next */1 : 1000;
|
|
1395
|
-
const duration = supportAnimation && propertyValue && propertyValue !== 'none'
|
|
1396
|
-
? parseFloat(durationValue) * durationScale : 0;
|
|
1397
|
-
|
|
1398
|
-
return !Number.isNaN(duration) ? duration : /* istanbul ignore next */0;
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
/**
|
|
1402
|
-
* Utility to make sure callbacks are consistently
|
|
1403
|
-
* called when animation ends.
|
|
1404
|
-
*
|
|
1405
|
-
* @param {HTMLElement} element target
|
|
1406
|
-
* @param {EventListener} handler `animationend` callback
|
|
1407
|
-
*/
|
|
1408
|
-
function emulateAnimationEnd(element, handler) {
|
|
1409
|
-
let called = 0;
|
|
1410
|
-
const endEvent = new Event(animationEndEvent);
|
|
1411
|
-
const duration = getElementAnimationDuration(element);
|
|
1412
|
-
const delay = getElementAnimationDelay(element);
|
|
1413
|
-
|
|
1414
|
-
if (supportAnimation && duration) {
|
|
1415
|
-
/**
|
|
1416
|
-
* Wrap the handler in on -> off callback
|
|
1417
|
-
* @param {Event} e Event object
|
|
1418
|
-
*/
|
|
1419
|
-
const animationEndWrapper = (e) => {
|
|
1420
|
-
/* istanbul ignore else */
|
|
1421
|
-
if (e.target === element) {
|
|
1422
|
-
handler.apply(element, [e]);
|
|
1423
|
-
element.removeEventListener(animationEndEvent, animationEndWrapper);
|
|
1424
|
-
called = 1;
|
|
1425
|
-
}
|
|
1426
|
-
};
|
|
1427
|
-
element.addEventListener(animationEndEvent, animationEndWrapper);
|
|
1428
|
-
setTimeout(() => {
|
|
1429
|
-
/* istanbul ignore next */
|
|
1430
|
-
if (!called) dispatchEvent(element, endEvent);
|
|
1431
|
-
}, duration + delay + 17);
|
|
1432
|
-
} else {
|
|
1433
|
-
handler.apply(element, [endEvent]);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
/**
|
|
1438
|
-
* Utility to get the computed `transitionDelay`
|
|
1439
|
-
* from Element in miliseconds.
|
|
1440
|
-
*
|
|
1441
|
-
* @param {HTMLElement} element target
|
|
1442
|
-
* @return {number} the value in miliseconds
|
|
1443
|
-
*/
|
|
1444
|
-
function getElementTransitionDelay$1(element) {
|
|
1445
|
-
const propertyValue = getElementStyle(element, transitionProperty$1);
|
|
1446
|
-
const delayValue = getElementStyle(element, transitionDelay$1);
|
|
1447
|
-
const delayScale = delayValue.includes('ms') ? /* istanbul ignore next */1 : 1000;
|
|
1448
|
-
const duration = propertyValue && propertyValue !== 'none'
|
|
1449
|
-
? parseFloat(delayValue) * delayScale : 0;
|
|
1450
|
-
|
|
1451
|
-
return !Number.isNaN(duration) ? duration : /* istanbul ignore next */0;
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
/**
|
|
1455
|
-
* Utility to get the computed `transitionDuration`
|
|
1456
|
-
* from Element in miliseconds.
|
|
1457
|
-
*
|
|
1458
|
-
* @param {HTMLElement} element target
|
|
1459
|
-
* @return {number} the value in miliseconds
|
|
1460
|
-
*/
|
|
1461
|
-
function getElementTransitionDuration$1(element) {
|
|
1462
|
-
const propertyValue = getElementStyle(element, transitionProperty$1);
|
|
1463
|
-
const durationValue = getElementStyle(element, transitionDuration$1);
|
|
1464
|
-
const durationScale = durationValue.includes('ms') ? /* istanbul ignore next */1 : 1000;
|
|
1465
|
-
const duration = propertyValue && propertyValue !== 'none'
|
|
1466
|
-
? parseFloat(durationValue) * durationScale : 0;
|
|
1467
|
-
|
|
1468
|
-
return !Number.isNaN(duration) ? duration : /* istanbul ignore next */0;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
/**
|
|
1472
|
-
* Utility to make sure callbacks are consistently
|
|
1473
|
-
* called when transition ends.
|
|
1474
|
-
*
|
|
1475
|
-
* @param {HTMLElement} element target
|
|
1476
|
-
* @param {EventListener} handler `transitionend` callback
|
|
1477
|
-
*/
|
|
1478
|
-
function emulateTransitionEnd$1(element, handler) {
|
|
1479
|
-
let called = 0;
|
|
1480
|
-
const endEvent = new Event(transitionEndEvent$1);
|
|
1481
|
-
const duration = getElementTransitionDuration$1(element);
|
|
1482
|
-
const delay = getElementTransitionDelay$1(element);
|
|
1483
|
-
|
|
1484
|
-
if (duration) {
|
|
1485
|
-
/**
|
|
1486
|
-
* Wrap the handler in on -> off callback
|
|
1487
|
-
* @type {EventListener} e Event object
|
|
1488
|
-
*/
|
|
1489
|
-
const transitionEndWrapper = (e) => {
|
|
1490
|
-
/* istanbul ignore else */
|
|
1491
|
-
if (e.target === element) {
|
|
1492
|
-
handler.apply(element, [e]);
|
|
1493
|
-
element.removeEventListener(transitionEndEvent$1, transitionEndWrapper);
|
|
1494
|
-
called = 1;
|
|
1495
|
-
}
|
|
1496
|
-
};
|
|
1497
|
-
element.addEventListener(transitionEndEvent$1, transitionEndWrapper);
|
|
1498
|
-
setTimeout(() => {
|
|
1499
|
-
/* istanbul ignore next */
|
|
1500
|
-
if (!called) dispatchEvent(element, endEvent);
|
|
1501
|
-
}, duration + delay + 17);
|
|
1502
|
-
} else {
|
|
1503
|
-
handler.apply(element, [endEvent]);
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
/**
|
|
1508
|
-
* Utility to get the computed `transitionDelay`
|
|
1509
|
-
* from Element in miliseconds.
|
|
1510
|
-
*
|
|
1511
|
-
* @param {HTMLElement} element target
|
|
1512
|
-
* @return {number} the value in miliseconds
|
|
1513
|
-
*/
|
|
1514
|
-
function getElementTransitionDelay(element) {
|
|
1515
|
-
const propertyValue = getElementStyle(element, transitionProperty);
|
|
1516
|
-
const delayValue = getElementStyle(element, transitionDelay);
|
|
1517
|
-
const delayScale = delayValue.includes('ms') ? /* istanbul ignore next */1 : 1000;
|
|
1518
|
-
const duration = supportTransition && propertyValue && propertyValue !== 'none'
|
|
1519
|
-
? parseFloat(delayValue) * delayScale : 0;
|
|
1520
|
-
|
|
1521
|
-
return !Number.isNaN(duration) ? duration : /* istanbul ignore next */0;
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
/**
|
|
1525
|
-
* Utility to get the computed `transitionDuration`
|
|
1526
|
-
* from Element in miliseconds.
|
|
1527
|
-
*
|
|
1528
|
-
* @param {HTMLElement} element target
|
|
1529
|
-
* @return {number} the value in miliseconds
|
|
1530
|
-
*/
|
|
1531
|
-
function getElementTransitionDuration(element) {
|
|
1532
|
-
const propertyValue = getElementStyle(element, transitionProperty);
|
|
1533
|
-
const durationValue = getElementStyle(element, transitionDuration);
|
|
1534
|
-
const durationScale = durationValue.includes('ms') ? /* istanbul ignore next */1 : 1000;
|
|
1535
|
-
const duration = supportTransition && propertyValue && propertyValue !== 'none'
|
|
1536
|
-
? parseFloat(durationValue) * durationScale : 0;
|
|
1537
|
-
|
|
1538
|
-
return !Number.isNaN(duration) ? duration : /* istanbul ignore next */0;
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
/**
|
|
1542
|
-
* Utility to make sure callbacks are consistently
|
|
1543
|
-
* called when transition ends.
|
|
1544
|
-
*
|
|
1545
|
-
* @param {HTMLElement} element target
|
|
1546
|
-
* @param {EventListener} handler `transitionend` callback
|
|
1547
|
-
*/
|
|
1548
|
-
function emulateTransitionEnd(element, handler) {
|
|
1549
|
-
let called = 0;
|
|
1550
|
-
const endEvent = new Event(transitionEndEvent);
|
|
1551
|
-
const duration = getElementTransitionDuration(element);
|
|
1552
|
-
const delay = getElementTransitionDelay(element);
|
|
1553
|
-
|
|
1554
|
-
if (supportTransition && duration) {
|
|
1555
|
-
/**
|
|
1556
|
-
* Wrap the handler in on -> off callback
|
|
1557
|
-
* @param {Event} e Event object
|
|
1558
|
-
*/
|
|
1559
|
-
const transitionEndWrapper = (e) => {
|
|
1560
|
-
/* istanbul ignore else */
|
|
1561
|
-
if (e.target === element) {
|
|
1562
|
-
handler.apply(element, [e]);
|
|
1563
|
-
element.removeEventListener(transitionEndEvent, transitionEndWrapper);
|
|
1564
|
-
called = 1;
|
|
1565
|
-
}
|
|
1566
|
-
};
|
|
1567
|
-
element.addEventListener(transitionEndEvent, transitionEndWrapper);
|
|
1568
|
-
setTimeout(() => {
|
|
1569
|
-
/* istanbul ignore next */
|
|
1570
|
-
if (!called) dispatchEvent(element, endEvent);
|
|
1571
|
-
}, duration + delay + 17);
|
|
1572
|
-
} else {
|
|
1573
|
-
handler.apply(element, [endEvent]);
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
/**
|
|
1578
|
-
* Shortcut for `Float32Array.from()` static method.
|
|
1579
|
-
* @param {any[] | HTMLCollection | NodeList} arr array-like iterable object
|
|
1580
|
-
* @returns {Float32Array}
|
|
1581
|
-
*/
|
|
1582
|
-
const Float32ArrayFrom = (arr) => Float32Array.from(Array.from(arr));
|
|
1583
|
-
|
|
1584
|
-
/**
|
|
1585
|
-
* Shortcut for `Float64Array.from()` static method.
|
|
1586
|
-
* @param {any[] | HTMLCollection | NodeList} arr array-like iterable object
|
|
1587
|
-
* @returns {Float64Array}
|
|
1588
|
-
*/
|
|
1589
|
-
const Float64ArrayFrom = (arr) => Float64Array.from(Array.from(arr));
|
|
1590
|
-
|
|
1591
|
-
/**
|
|
1592
|
-
* Utility to focus an `HTMLElement` target.
|
|
1593
|
-
*
|
|
1594
|
-
* @param {HTMLElement} element is the target
|
|
1595
|
-
*/
|
|
1596
|
-
const focus = (element) => element.focus();
|
|
1597
|
-
|
|
1598
|
-
/** A generic function with empty body. */
|
|
1599
|
-
const noop = () => {};
|
|
1600
|
-
|
|
1601
|
-
/**
|
|
1602
|
-
* The raw value or a given component option.
|
|
1603
|
-
*
|
|
1604
|
-
* @typedef {string | HTMLElement | Function | number | boolean | null} niceValue
|
|
1605
|
-
*/
|
|
1606
|
-
|
|
1607
|
-
/**
|
|
1608
|
-
* Utility to normalize component options
|
|
1609
|
-
*
|
|
1610
|
-
* @param {any} value the input value
|
|
1611
|
-
* @return {niceValue} the normalized value
|
|
1612
|
-
*/
|
|
1613
|
-
function normalizeValue(value) {
|
|
1614
|
-
if (['true', true].includes(value)) { // boolean
|
|
1615
|
-
// if ('true' === value) { // boolean
|
|
1616
|
-
return true;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
if (['false', false].includes(value)) { // boolean
|
|
1620
|
-
// if ('false' === value) { // boolean
|
|
1621
|
-
return false;
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
if (value === '' || value === 'null') { // null
|
|
1625
|
-
return null;
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
if (value !== '' && !Number.isNaN(+value)) { // number
|
|
1629
|
-
return +value;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
// string / function / HTMLElement / object
|
|
1633
|
-
return value;
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
/**
|
|
1637
|
-
* Shortcut for `Object.keys()` static method.
|
|
1638
|
-
* @param {Record<string, any>} obj a target object
|
|
1639
|
-
* @returns {string[]}
|
|
1640
|
-
*/
|
|
1641
|
-
const ObjectKeys = (obj) => Object.keys(obj);
|
|
1642
|
-
|
|
1643
|
-
/**
|
|
1644
|
-
* Shortcut for `String.toLowerCase()`.
|
|
1645
|
-
*
|
|
1646
|
-
* @param {string} source input string
|
|
1647
|
-
* @returns {string} lowercase output string
|
|
1648
|
-
*/
|
|
1649
|
-
const toLowerCase = (source) => source.toLowerCase();
|
|
1650
|
-
|
|
1651
|
-
/**
|
|
1652
|
-
* Utility to normalize component options.
|
|
1653
|
-
*
|
|
1654
|
-
* @param {HTMLElement} element target
|
|
1655
|
-
* @param {Record<string, any>} defaultOps component default options
|
|
1656
|
-
* @param {Record<string, any>} inputOps component instance options
|
|
1657
|
-
* @param {string=} ns component namespace
|
|
1658
|
-
* @return {Record<string, any>} normalized component options object
|
|
1659
|
-
*/
|
|
1660
|
-
function normalizeOptions(element, defaultOps, inputOps, ns) {
|
|
1661
|
-
const data = { ...element.dataset };
|
|
1662
|
-
/** @type {Record<string, any>} */
|
|
1663
|
-
const normalOps = {};
|
|
1664
|
-
/** @type {Record<string, any>} */
|
|
1665
|
-
const dataOps = {};
|
|
1666
|
-
const title = 'title';
|
|
1667
|
-
|
|
1668
|
-
ObjectKeys(data).forEach((k) => {
|
|
1669
|
-
const key = ns && k.includes(ns)
|
|
1670
|
-
? k.replace(ns, '').replace(/[A-Z]/, (match) => toLowerCase(match))
|
|
1671
|
-
: k;
|
|
1672
|
-
|
|
1673
|
-
dataOps[key] = normalizeValue(data[k]);
|
|
1674
|
-
});
|
|
1675
|
-
|
|
1676
|
-
ObjectKeys(inputOps).forEach((k) => {
|
|
1677
|
-
inputOps[k] = normalizeValue(inputOps[k]);
|
|
1678
|
-
});
|
|
1679
|
-
|
|
1680
|
-
ObjectKeys(defaultOps).forEach((k) => {
|
|
1681
|
-
/* istanbul ignore else */
|
|
1682
|
-
if (k in inputOps) {
|
|
1683
|
-
normalOps[k] = inputOps[k];
|
|
1684
|
-
} else if (k in dataOps) {
|
|
1685
|
-
normalOps[k] = dataOps[k];
|
|
1686
|
-
} else {
|
|
1687
|
-
normalOps[k] = k === title
|
|
1688
|
-
? getAttribute(element, title)
|
|
1689
|
-
: defaultOps[k];
|
|
1690
|
-
}
|
|
1691
|
-
});
|
|
1692
|
-
|
|
1693
|
-
return normalOps;
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
/**
|
|
1697
|
-
* Shortcut for `Object.values()` static method.
|
|
1698
|
-
* @param {Record<string, any>} obj a target object
|
|
1699
|
-
* @returns {any[]}
|
|
1700
|
-
*/
|
|
1701
|
-
const ObjectValues = (obj) => Object.values(obj);
|
|
1702
|
-
|
|
1703
|
-
/**
|
|
1704
|
-
* Returns a namespaced `CustomEvent` specific to each component.
|
|
1705
|
-
* @param {string} EventType Event.type
|
|
1706
|
-
* @param {Record<string, any>=} config Event.options | Event.properties
|
|
1707
|
-
* @returns {SHORTY.OriginalEvent} a new namespaced event
|
|
1708
|
-
*/
|
|
1709
|
-
function OriginalEvent(EventType, config) {
|
|
1710
|
-
const OriginalCustomEvent = new CustomEvent(EventType, {
|
|
1711
|
-
cancelable: true, bubbles: true,
|
|
1712
|
-
});
|
|
1713
|
-
|
|
1714
|
-
/* istanbul ignore else */
|
|
1715
|
-
if (config instanceof Object) {
|
|
1716
|
-
ObjectAssign(OriginalCustomEvent, config);
|
|
1717
|
-
}
|
|
1718
|
-
return OriginalCustomEvent;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
/**
|
|
1722
|
-
* A global namespace for most scroll event listeners.
|
|
1723
|
-
* @type {Partial<AddEventListenerOptions>}
|
|
1724
|
-
*/
|
|
1725
|
-
const passiveHandler$1 = { passive: true };
|
|
1726
|
-
|
|
1727
|
-
/**
|
|
1728
|
-
* A global namespace for most scroll event listeners in legacy browsers.
|
|
1729
|
-
* @type {Partial<AddEventListenerOptions> | boolean}
|
|
1730
|
-
*/
|
|
1731
|
-
const passiveHandler = supportPassive ? { passive: true }
|
|
1732
|
-
: /* istanbul ignore next */false;
|
|
1733
|
-
|
|
1734
|
-
/**
|
|
1735
|
-
* Utility to force re-paint of an `HTMLElement` target.
|
|
1736
|
-
*
|
|
1737
|
-
* @param {HTMLElement} element is the target
|
|
1738
|
-
* @return {number} the `Element.offsetHeight` value
|
|
1739
|
-
*/
|
|
1740
|
-
const reflow = (element) => element.offsetHeight;
|
|
1741
|
-
|
|
1742
|
-
/**
|
|
1743
|
-
* Shortcut for multiple uses of `HTMLElement.style.propertyName` method.
|
|
1744
|
-
* @param {HTMLElement} element target element
|
|
1745
|
-
* @param {Partial<CSSStyleDeclaration>} styles attribute value
|
|
1746
|
-
*/
|
|
1747
|
-
const setElementStyle = (element, styles) => {
|
|
1748
|
-
ObjectEntries(styles).forEach(([key, value]) => {
|
|
1749
|
-
if (key.includes('--')) {
|
|
1750
|
-
element.style.setProperty(key, value);
|
|
1751
|
-
} else {
|
|
1752
|
-
const propObject = {}; propObject[key] = value;
|
|
1753
|
-
ObjectAssign(element.style, propObject);
|
|
1754
|
-
}
|
|
1755
|
-
});
|
|
1756
|
-
};
|
|
1757
|
-
|
|
1758
|
-
/** @type {Map<HTMLElement, any>} */
|
|
1759
|
-
const TimeCache = new Map();
|
|
1760
|
-
/**
|
|
1761
|
-
* An interface for one or more `TimerHandler`s per `Element`.
|
|
1762
|
-
* @see https://github.com/thednp/navbar.js/
|
|
1763
|
-
*/
|
|
1764
|
-
const Timer = {
|
|
1765
|
-
/**
|
|
1766
|
-
* Sets a new timeout timer for an element, or element -> key association.
|
|
1767
|
-
* @param {HTMLElement} element target element
|
|
1768
|
-
* @param {ReturnType<TimerHandler>} callback the callback
|
|
1769
|
-
* @param {number} delay the execution delay
|
|
1770
|
-
* @param {string=} key a unique key
|
|
1771
|
-
*/
|
|
1772
|
-
set: (element, callback, delay, key) => {
|
|
1773
|
-
if (!isHTMLElement(element)) return;
|
|
1774
|
-
|
|
1775
|
-
/* istanbul ignore else */
|
|
1776
|
-
if (key && key.length) {
|
|
1777
|
-
/* istanbul ignore else */
|
|
1778
|
-
if (!TimeCache.has(element)) {
|
|
1779
|
-
TimeCache.set(element, new Map());
|
|
1780
|
-
}
|
|
1781
|
-
const keyTimers = TimeCache.get(element);
|
|
1782
|
-
keyTimers.set(key, setTimeout(callback, delay));
|
|
1783
|
-
} else {
|
|
1784
|
-
TimeCache.set(element, setTimeout(callback, delay));
|
|
1785
|
-
}
|
|
1786
|
-
},
|
|
1787
|
-
|
|
1788
|
-
/**
|
|
1789
|
-
* Returns the timer associated with the target.
|
|
1790
|
-
* @param {HTMLElement} element target element
|
|
1791
|
-
* @param {string=} key a unique
|
|
1792
|
-
* @returns {number?} the timer
|
|
1793
|
-
*/
|
|
1794
|
-
get: (element, key) => {
|
|
1795
|
-
if (!isHTMLElement(element)) return null;
|
|
1796
|
-
const keyTimers = TimeCache.get(element);
|
|
1797
|
-
|
|
1798
|
-
if (key && key.length && keyTimers && keyTimers.get) {
|
|
1799
|
-
return keyTimers.get(key) || /* istanbul ignore next */null;
|
|
1800
|
-
}
|
|
1801
|
-
return keyTimers || null;
|
|
1802
|
-
},
|
|
1803
|
-
|
|
1804
|
-
/**
|
|
1805
|
-
* Clears the element's timer.
|
|
1806
|
-
* @param {HTMLElement} element target element
|
|
1807
|
-
* @param {string=} key a unique key
|
|
1808
|
-
*/
|
|
1809
|
-
clear: (element, key) => {
|
|
1810
|
-
if (!isHTMLElement(element)) return;
|
|
1811
|
-
|
|
1812
|
-
if (key && key.length) {
|
|
1813
|
-
const keyTimers = TimeCache.get(element);
|
|
1814
|
-
/* istanbul ignore else */
|
|
1815
|
-
if (keyTimers && keyTimers.get) {
|
|
1816
|
-
clearTimeout(keyTimers.get(key));
|
|
1817
|
-
keyTimers.delete(key);
|
|
1818
|
-
/* istanbul ignore else */
|
|
1819
|
-
if (keyTimers.size === 0) {
|
|
1820
|
-
TimeCache.delete(element);
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
} else {
|
|
1824
|
-
clearTimeout(TimeCache.get(element));
|
|
1825
|
-
TimeCache.delete(element);
|
|
1826
|
-
}
|
|
1827
|
-
},
|
|
1828
|
-
};
|
|
1829
|
-
|
|
1830
|
-
/**
|
|
1831
|
-
* Shortcut for `String.toUpperCase()`.
|
|
1832
|
-
*
|
|
1833
|
-
* @param {string} source input string
|
|
1834
|
-
* @returns {string} uppercase output string
|
|
1835
|
-
*/
|
|
1836
|
-
const toUpperCase = (source) => source.toUpperCase();
|
|
1837
|
-
|
|
1838
|
-
/**
|
|
1839
|
-
* Returns the bounding client rect of a target `HTMLElement`.
|
|
1840
|
-
*
|
|
1841
|
-
* @see https://github.com/floating-ui/floating-ui
|
|
1842
|
-
*
|
|
1843
|
-
* @param {HTMLElement} element event.target
|
|
1844
|
-
* @param {boolean=} includeScale when *true*, the target scale is also computed
|
|
1845
|
-
* @returns {SHORTY.BoundingClientRect} the bounding client rect object
|
|
1846
|
-
*/
|
|
1847
|
-
function getBoundingClientRect(element, includeScale) {
|
|
1848
|
-
const {
|
|
1849
|
-
width, height, top, right, bottom, left,
|
|
1850
|
-
} = element.getBoundingClientRect();
|
|
1851
|
-
let scaleX = 1;
|
|
1852
|
-
let scaleY = 1;
|
|
1853
|
-
|
|
1854
|
-
if (includeScale && isHTMLElement(element)) {
|
|
1855
|
-
const { offsetWidth, offsetHeight } = element;
|
|
1856
|
-
scaleX = offsetWidth > 0 ? Math.round(width) / offsetWidth
|
|
1857
|
-
: /* istanbul ignore next */1;
|
|
1858
|
-
scaleY = offsetHeight > 0 ? Math.round(height) / offsetHeight
|
|
1859
|
-
: /* istanbul ignore next */1;
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
return {
|
|
1863
|
-
width: width / scaleX,
|
|
1864
|
-
height: height / scaleY,
|
|
1865
|
-
top: top / scaleY,
|
|
1866
|
-
right: right / scaleX,
|
|
1867
|
-
bottom: bottom / scaleY,
|
|
1868
|
-
left: left / scaleX,
|
|
1869
|
-
x: left / scaleX,
|
|
1870
|
-
y: top / scaleY,
|
|
1871
|
-
};
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
/**
|
|
1875
|
-
* Returns the `document.body` or the `<body>` element.
|
|
1876
|
-
*
|
|
1877
|
-
* @param {(ParentNode | Window)=} node
|
|
1878
|
-
* @returns {HTMLBodyElement}
|
|
1879
|
-
*/
|
|
1880
|
-
function getDocumentBody(node) {
|
|
1881
|
-
return getDocument(node).body;
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
/**
|
|
1885
|
-
* Returns the `document.documentElement` or the `<html>` element.
|
|
1886
|
-
*
|
|
1887
|
-
* @param {(ParentNode | Window)=} node
|
|
1888
|
-
* @returns {HTMLHtmlElement}
|
|
1889
|
-
*/
|
|
1890
|
-
function getDocumentElement(node) {
|
|
1891
|
-
return getDocument(node).documentElement;
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
/**
|
|
1895
|
-
* Returns the `document.head` or the `<head>` element.
|
|
1896
|
-
*
|
|
1897
|
-
* @param {(ParentNode | Window)=} node
|
|
1898
|
-
* @returns {HTMLHeadElement}
|
|
1899
|
-
*/
|
|
1900
|
-
function getDocumentHead(node) {
|
|
1901
|
-
return getDocument(node).head;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
/**
|
|
1905
|
-
* Returns an `{x,y}` object with the target
|
|
1906
|
-
* `HTMLElement` / `Node` scroll position.
|
|
1907
|
-
*
|
|
1908
|
-
* @see https://github.com/floating-ui/floating-ui
|
|
1909
|
-
*
|
|
1910
|
-
* @param {HTMLElement | Window} element target node / element
|
|
1911
|
-
* @returns {{x: number, y: number}} the scroll tuple
|
|
1912
|
-
*/
|
|
1913
|
-
function getNodeScroll(element) {
|
|
1914
|
-
const isWin = 'scrollX' in element;
|
|
1915
|
-
const x = isWin ? element.scrollX : element.scrollLeft;
|
|
1916
|
-
const y = isWin ? element.scrollY : element.scrollTop;
|
|
1917
|
-
|
|
1918
|
-
return { x, y };
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
|
-
/**
|
|
1922
|
-
* Check if target is a `ShadowRoot`.
|
|
1923
|
-
*
|
|
1924
|
-
* @param {any} element target
|
|
1925
|
-
* @returns {boolean} the query result
|
|
1926
|
-
*/
|
|
1927
|
-
const isShadowRoot = (element) => (element && element.constructor.name === 'ShadowRoot')
|
|
1928
|
-
|| false;
|
|
1929
|
-
|
|
1930
|
-
/**
|
|
1931
|
-
* Returns the `parentNode` also going through `ShadowRoot`.
|
|
1932
|
-
* @see https://github.com/floating-ui/floating-ui
|
|
1933
|
-
*
|
|
1934
|
-
* @param {Node} node the target node
|
|
1935
|
-
* @returns {Node} the apropriate parent node
|
|
1936
|
-
*/
|
|
1937
|
-
function getParentNode(node) {
|
|
1938
|
-
if (node.nodeName === 'HTML') {
|
|
1939
|
-
return node;
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
1943
|
-
return (
|
|
1944
|
-
node.assignedSlot // step into the shadow DOM of the parent of a slotted node
|
|
1945
|
-
|| node.parentNode // DOM Element detected
|
|
1946
|
-
|| (isShadowRoot(node) && node.host) // ShadowRoot detected
|
|
1947
|
-
|| getDocumentElement(node) // fallback
|
|
1948
|
-
);
|
|
1949
|
-
}
|
|
1950
|
-
|
|
1951
|
-
/**
|
|
1952
|
-
* Checks if a target `HTMLElement` is affected by scale.
|
|
1953
|
-
* @see https://github.com/floating-ui/floating-ui
|
|
1954
|
-
*
|
|
1955
|
-
* @param {HTMLElement} element target
|
|
1956
|
-
* @returns {boolean} the query result
|
|
1957
|
-
*/
|
|
1958
|
-
function isScaledElement(element) {
|
|
1959
|
-
if (!element || !isHTMLElement(element)) return false;
|
|
1960
|
-
const { width, height } = getBoundingClientRect(element);
|
|
1961
|
-
const { offsetWidth, offsetHeight } = element;
|
|
1962
|
-
return Math.round(width) !== offsetWidth
|
|
1963
|
-
|| Math.round(height) !== offsetHeight;
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
/**
|
|
1967
|
-
* Returns the rect relative to an offset parent.
|
|
1968
|
-
* @see https://github.com/floating-ui/floating-ui
|
|
1969
|
-
*
|
|
1970
|
-
* @param {HTMLElement} element target
|
|
1971
|
-
* @param {ParentNode | Window} offsetParent the container / offset parent
|
|
1972
|
-
* @param {{x: number, y: number}} scroll the offsetParent scroll position
|
|
1973
|
-
* @returns {SHORTY.OffsetRect}
|
|
1974
|
-
*/
|
|
1975
|
-
function getRectRelativeToOffsetParent(element, offsetParent, scroll) {
|
|
1976
|
-
const isParentAnElement = isHTMLElement(offsetParent);
|
|
1977
|
-
const rect = getBoundingClientRect(element, isParentAnElement && isScaledElement(offsetParent));
|
|
1978
|
-
const offsets = { x: 0, y: 0 };
|
|
1979
|
-
|
|
1980
|
-
/* istanbul ignore next */
|
|
1981
|
-
if (isParentAnElement) {
|
|
1982
|
-
const offsetRect = getBoundingClientRect(offsetParent, true);
|
|
1983
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1984
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
return {
|
|
1988
|
-
x: rect.left + scroll.x - offsets.x,
|
|
1989
|
-
y: rect.top + scroll.y - offsets.y,
|
|
1990
|
-
width: rect.width,
|
|
1991
|
-
height: rect.height,
|
|
1992
|
-
};
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
let elementUID = 0;
|
|
1996
|
-
let elementMapUID = 0;
|
|
1997
|
-
const elementIDMap = new Map();
|
|
1998
|
-
|
|
1999
|
-
/**
|
|
2000
|
-
* Returns a unique identifier for popover, tooltip, scrollspy.
|
|
2001
|
-
*
|
|
2002
|
-
* @param {HTMLElement} element target element
|
|
2003
|
-
* @param {string=} key predefined key
|
|
2004
|
-
* @returns {number} an existing or new unique ID
|
|
2005
|
-
*/
|
|
2006
|
-
function getUID(element, key) {
|
|
2007
|
-
let result = key ? elementUID : elementMapUID;
|
|
2008
|
-
|
|
2009
|
-
if (key) {
|
|
2010
|
-
const elID = getUID(element);
|
|
2011
|
-
const elMap = elementIDMap.get(elID) || new Map();
|
|
2012
|
-
if (!elementIDMap.has(elID)) {
|
|
2013
|
-
elementIDMap.set(elID, elMap);
|
|
2014
|
-
}
|
|
2015
|
-
if (!elMap.has(key)) {
|
|
2016
|
-
elMap.set(key, result);
|
|
2017
|
-
elementUID += 1;
|
|
2018
|
-
} else result = elMap.get(key);
|
|
2019
|
-
} else {
|
|
2020
|
-
const elkey = element.id || element;
|
|
2021
|
-
|
|
2022
|
-
if (!elementIDMap.has(elkey)) {
|
|
2023
|
-
elementIDMap.set(elkey, result);
|
|
2024
|
-
elementMapUID += 1;
|
|
2025
|
-
} else result = elementIDMap.get(elkey);
|
|
2026
|
-
}
|
|
2027
|
-
return result;
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
/**
|
|
2031
|
-
* Returns the `Window` object of a target node.
|
|
2032
|
-
* @see https://github.com/floating-ui/floating-ui
|
|
2033
|
-
*
|
|
2034
|
-
* @param {(Node | Window)=} node target node
|
|
2035
|
-
* @returns {Window} the `Window` object
|
|
2036
|
-
*/
|
|
2037
|
-
function getWindow(node) {
|
|
2038
|
-
// node is undefined | NULL
|
|
2039
|
-
if (!node) {
|
|
2040
|
-
return window;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
// node instanceof Document
|
|
2044
|
-
if (isDocument(node)) {
|
|
2045
|
-
return node.defaultView;
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
// node instanceof Node
|
|
2049
|
-
if (isNode(node)) {
|
|
2050
|
-
return node.ownerDocument.defaultView;
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
|
-
// node is instanceof Window
|
|
2054
|
-
return node;
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
/**
|
|
2058
|
-
* Shortcut for `Array.isArray()` static method.
|
|
2059
|
-
*
|
|
2060
|
-
* @param {any} arr array-like iterable object
|
|
2061
|
-
* @returns {boolean} the query result
|
|
2062
|
-
*/
|
|
2063
|
-
const isArray = (arr) => Array.isArray(arr);
|
|
2064
|
-
|
|
2065
|
-
/**
|
|
2066
|
-
* Checks if an object is a `CustomElement`.
|
|
2067
|
-
*
|
|
2068
|
-
* @param {any} element the target object
|
|
2069
|
-
* @returns {boolean} the query result
|
|
2070
|
-
*/
|
|
2071
|
-
const isCustomElement = (element) => (element && !!element.shadowRoot) || false;
|
|
2072
|
-
|
|
2073
|
-
/**
|
|
2074
|
-
* Checks if an object is an `Element`.
|
|
2075
|
-
* @see https://dom.spec.whatwg.org/#node
|
|
2076
|
-
* ELEMENT_NODE = 1;
|
|
2077
|
-
* ATTRIBUTE_NODE = 2;
|
|
2078
|
-
* TEXT_NODE = 3;
|
|
2079
|
-
* CDATA_SECTION_NODE = 4;
|
|
2080
|
-
* ENTITY_REFERENCE_NODE = 5; // legacy
|
|
2081
|
-
* ENTITY_NODE = 6; // legacy
|
|
2082
|
-
* PROCESSING_INSTRUCTION_NODE = 7;
|
|
2083
|
-
* COMMENT_NODE = 8;
|
|
2084
|
-
* DOCUMENT_NODE = 9;
|
|
2085
|
-
* DOCUMENT_TYPE_NODE = 10;
|
|
2086
|
-
* DOCUMENT_FRAGMENT_NODE = 11;
|
|
2087
|
-
*
|
|
2088
|
-
* @param {any} element the target object
|
|
2089
|
-
* @returns {boolean} the query result
|
|
2090
|
-
*/
|
|
2091
|
-
const isElement = (element) => (element && [1, 2, 3, 4, 5, 6, 7, 8]
|
|
2092
|
-
.some((x) => element.nodeType === x)) || false;
|
|
2093
|
-
|
|
2094
|
-
/**
|
|
2095
|
-
* Utility to determine if an `HTMLElement`
|
|
2096
|
-
* is partially visible in viewport.
|
|
2097
|
-
*
|
|
2098
|
-
* @param {HTMLElement} element target
|
|
2099
|
-
* @return {boolean} the query result
|
|
2100
|
-
*/
|
|
2101
|
-
const isElementInScrollRange = (element) => {
|
|
2102
|
-
if (!element || !isNode(element)) return false;
|
|
2103
|
-
|
|
2104
|
-
const { top, bottom } = getBoundingClientRect(element);
|
|
2105
|
-
const { clientHeight } = getDocumentElement(element);
|
|
2106
|
-
return top <= clientHeight && bottom >= 0;
|
|
2107
|
-
};
|
|
2108
|
-
|
|
2109
|
-
/**
|
|
2110
|
-
* Utility to determine if an `HTMLElement`
|
|
2111
|
-
* is fully visible in the viewport.
|
|
2112
|
-
*
|
|
2113
|
-
* @param {HTMLElement} element target
|
|
2114
|
-
* @return {boolean} the query result
|
|
2115
|
-
*/
|
|
2116
|
-
const isElementInViewport = (element) => {
|
|
2117
|
-
if (!element || !isNode(element)) return false;
|
|
2118
|
-
|
|
2119
|
-
const { clientWidth, clientHeight } = getDocumentElement(element);
|
|
2120
|
-
const {
|
|
2121
|
-
top, left, bottom, right,
|
|
2122
|
-
} = getBoundingClientRect(element, true);
|
|
2123
|
-
|
|
2124
|
-
return (
|
|
2125
|
-
top >= 0 && left >= 0
|
|
2126
|
-
&& bottom <= clientHeight
|
|
2127
|
-
&& right <= clientWidth
|
|
2128
|
-
);
|
|
2129
|
-
};
|
|
2130
|
-
|
|
2131
|
-
/**
|
|
2132
|
-
* Checks if an object is an `Array` in which all items are `Element`.
|
|
2133
|
-
*
|
|
2134
|
-
* @param {any} object the target object
|
|
2135
|
-
* @returns {boolean} the query result
|
|
2136
|
-
*/
|
|
2137
|
-
const isElementsArray = (object) => Array.isArray(object)
|
|
2138
|
-
&& object.every(isHTMLElement);
|
|
2139
|
-
|
|
2140
|
-
/**
|
|
2141
|
-
* Checks if an object is a `Function`.
|
|
2142
|
-
*
|
|
2143
|
-
* @param {any} fn the target object
|
|
2144
|
-
* @returns {boolean} the query result
|
|
2145
|
-
*/
|
|
2146
|
-
const isFunction = (fn) => (fn && fn.constructor.name === 'Function') || false;
|
|
2147
|
-
|
|
2148
|
-
/**
|
|
2149
|
-
* Checks if an object is an `HTMLCollection`.
|
|
2150
|
-
*
|
|
2151
|
-
* @param {any} object the target object
|
|
2152
|
-
* @returns {boolean} the query result
|
|
2153
|
-
*/
|
|
2154
|
-
const isHTMLCollection = (object) => (object && object.constructor.name === 'HTMLCollection') || false;
|
|
2155
|
-
|
|
2156
|
-
/**
|
|
2157
|
-
* Check if a target element is an `<img>`.
|
|
2158
|
-
* @param {any} element the target element
|
|
2159
|
-
* @returns {boolean} the query result
|
|
2160
|
-
*/
|
|
2161
|
-
const isHTMLImageElement = (element) => (element && element.tagName === 'IMG') || false;
|
|
2162
|
-
|
|
2163
|
-
/**
|
|
2164
|
-
* Checks if an element is an `<svg>` (or any type of SVG element),
|
|
2165
|
-
* `<img>` or `<video>`.
|
|
2166
|
-
*
|
|
2167
|
-
* *Tooltip* / *Popover* works different with media elements.
|
|
2168
|
-
* @param {any} element the target element
|
|
2169
|
-
* @returns {boolean} the query result
|
|
2170
|
-
*/
|
|
2171
|
-
|
|
2172
|
-
const isMedia = (element) => (
|
|
2173
|
-
element
|
|
2174
|
-
&& element.nodeType === 1
|
|
2175
|
-
&& ['SVG', 'Image', 'Video'].some((s) => element.constructor.name.includes(s))) || false;
|
|
2176
|
-
|
|
2177
|
-
/**
|
|
2178
|
-
* Checks if an object is a `NodeList`.
|
|
2179
|
-
* => equivalent to `object instanceof NodeList`
|
|
2180
|
-
*
|
|
2181
|
-
* @param {any} object the target object
|
|
2182
|
-
* @returns {boolean} the query result
|
|
2183
|
-
*/
|
|
2184
|
-
const isNodeList = (object) => (object && object.constructor.name === 'NodeList') || false;
|
|
2185
|
-
|
|
2186
|
-
/**
|
|
2187
|
-
* Shortcut for `typeof SOMETHING === "number"`.
|
|
2188
|
-
*
|
|
2189
|
-
* @param {any} num input value
|
|
2190
|
-
* @returns {boolean} the query result
|
|
2191
|
-
*/
|
|
2192
|
-
const isNumber = (num) => typeof num === 'number';
|
|
2193
|
-
|
|
2194
|
-
/**
|
|
2195
|
-
* Checks if a page is Right To Left.
|
|
2196
|
-
* @param {HTMLElement=} node the target
|
|
2197
|
-
* @returns {boolean} the query result
|
|
2198
|
-
*/
|
|
2199
|
-
const isRTL = (node) => getDocumentElement(node).dir === 'rtl';
|
|
2200
|
-
|
|
2201
|
-
/**
|
|
2202
|
-
* Shortcut for `typeof SOMETHING === "string"`.
|
|
2203
|
-
*
|
|
2204
|
-
* @param {any} str input value
|
|
2205
|
-
* @returns {boolean} the query result
|
|
2206
|
-
*/
|
|
2207
|
-
const isString = (str) => typeof str === 'string';
|
|
2208
|
-
|
|
2209
|
-
/**
|
|
2210
|
-
* Check if an element is an `<svg>` or any other SVG element.
|
|
2211
|
-
* @param {any} element the target element
|
|
2212
|
-
* @returns {boolean} the query result
|
|
2213
|
-
*/
|
|
2214
|
-
const isSVGElement = (element) => (element && element instanceof getWindow(element).SVGElement)
|
|
2215
|
-
|| false;
|
|
2216
|
-
|
|
2217
|
-
/**
|
|
2218
|
-
* Check if a target element is a `<table>`, `<td>` or `<th>`.
|
|
2219
|
-
* This specific check is important for determining
|
|
2220
|
-
* the `offsetParent` of a given element.
|
|
2221
|
-
*
|
|
2222
|
-
* @param {any} element the target element
|
|
2223
|
-
* @returns {boolean} the query result
|
|
2224
|
-
*/
|
|
2225
|
-
const isTableElement = (element) => (element && ['TABLE', 'TD', 'TH'].includes(element.tagName))
|
|
2226
|
-
|| false;
|
|
2227
|
-
|
|
2228
|
-
/**
|
|
2229
|
-
* Shortcut for `HTMLElement.closest` method which also works
|
|
2230
|
-
* with children of `ShadowRoot`. The order of the parameters
|
|
2231
|
-
* is intentional since they're both required.
|
|
2232
|
-
*
|
|
2233
|
-
* @see https://stackoverflow.com/q/54520554/803358
|
|
2234
|
-
*
|
|
2235
|
-
* @param {HTMLElement} element Element to look into
|
|
2236
|
-
* @param {string} selector the selector name
|
|
2237
|
-
* @return {HTMLElement?} the query result
|
|
2238
|
-
*/
|
|
2239
|
-
function closest(element, selector) {
|
|
2240
|
-
return element ? (element.closest(selector)
|
|
2241
|
-
// break out of `ShadowRoot`
|
|
2242
|
-
|| closest(element.getRootNode().host, selector)) : null;
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
/**
|
|
2246
|
-
* Utility to check if target is typeof `HTMLElement`, `Element`, `Node`
|
|
2247
|
-
* or find one that matches a selector.
|
|
2248
|
-
*
|
|
2249
|
-
* @param {Node | string} selector the input selector or target element
|
|
2250
|
-
* @param {ParentNode=} parent optional node to look into
|
|
2251
|
-
* @return {HTMLElement?} the `HTMLElement` or `querySelector` result
|
|
2252
|
-
*/
|
|
2253
|
-
function querySelector(selector, parent) {
|
|
2254
|
-
if (isNode(selector)) {
|
|
2255
|
-
return selector;
|
|
2256
|
-
}
|
|
2257
|
-
const lookUp = isNode(parent) ? parent : getDocument();
|
|
2258
|
-
|
|
2259
|
-
return lookUp.querySelector(selector);
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
/**
|
|
2263
|
-
* Shortcut for `HTMLElement.getElementsByTagName` method. Some `Node` elements
|
|
2264
|
-
* like `ShadowRoot` do not support `getElementsByTagName`.
|
|
2265
|
-
*
|
|
2266
|
-
* @param {string} selector the tag name
|
|
2267
|
-
* @param {ParentNode=} parent optional Element to look into
|
|
2268
|
-
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection'
|
|
2269
|
-
*/
|
|
2270
|
-
function getElementsByTagName(selector, parent) {
|
|
2271
|
-
const lookUp = isNode(parent) ? parent : getDocument();
|
|
2272
|
-
return lookUp.getElementsByTagName(selector);
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
/**
|
|
2276
|
-
* Returns an `Array` of `Node` elements that are registered as
|
|
2277
|
-
* `CustomElement`.
|
|
2278
|
-
* @see https://stackoverflow.com/questions/27334365/how-to-get-list-of-registered-custom-elements
|
|
2279
|
-
*
|
|
2280
|
-
* @param {ParentNode=} parent parent to look into
|
|
2281
|
-
* @returns {Array<HTMLElement>} the query result
|
|
2282
|
-
*/
|
|
2283
|
-
function getCustomElements(parent) {
|
|
2284
|
-
const collection = getElementsByTagName('*', parent);
|
|
2285
|
-
|
|
2286
|
-
return [...collection].filter(isCustomElement);
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
/**
|
|
2290
|
-
* Returns an `Element` that matches the id in the document.
|
|
2291
|
-
* Within multiple <iframe> elements, a `parent` parameter
|
|
2292
|
-
* would decisively locate the correct element.
|
|
2293
|
-
*
|
|
2294
|
-
* @param {string} id
|
|
2295
|
-
* @param {ParentNode=} context
|
|
2296
|
-
* @returns {HTMLElement?}
|
|
2297
|
-
*/
|
|
2298
|
-
function getElementById(id, context) {
|
|
2299
|
-
return getDocument(context).getElementById(id);
|
|
2300
|
-
}
|
|
2301
|
-
|
|
2302
|
-
/**
|
|
2303
|
-
* A shortcut for `(document|Element).querySelectorAll`.
|
|
2304
|
-
*
|
|
2305
|
-
* @param {string} selector the input selector
|
|
2306
|
-
* @param {ParentNode=} parent optional node to look into
|
|
2307
|
-
* @return {NodeListOf<HTMLElement>} the query result
|
|
2308
|
-
*/
|
|
2309
|
-
function querySelectorAll(selector, parent) {
|
|
2310
|
-
const lookUp = isNode(parent) ? parent : getDocument();
|
|
2311
|
-
return lookUp.querySelectorAll(selector);
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
/**
|
|
2315
|
-
* Shortcut for `HTMLElement.getElementsByClassName` method. Some `Node` elements
|
|
2316
|
-
* like `ShadowRoot` do not support `getElementsByClassName`.
|
|
2317
|
-
*
|
|
2318
|
-
* @param {string} selector the class name
|
|
2319
|
-
* @param {ParentNode=} parent optional Element to look into
|
|
2320
|
-
* @return {HTMLCollectionOf<HTMLElement>} the 'HTMLCollection'
|
|
2321
|
-
*/
|
|
2322
|
-
function getElementsByClassName(selector, parent) {
|
|
2323
|
-
const lookUp = isNode(parent) ? parent : getDocument();
|
|
2324
|
-
return lookUp.getElementsByClassName(selector);
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
/**
|
|
2328
|
-
* Check if element matches a CSS selector.
|
|
2329
|
-
*
|
|
2330
|
-
* @param {HTMLElement} target
|
|
2331
|
-
* @param {string} selector
|
|
2332
|
-
* @returns {boolean}
|
|
2333
|
-
*/
|
|
2334
|
-
function matches$1(target, selector) {
|
|
2335
|
-
return target.matches(selector);
|
|
2336
|
-
}
|
|
2337
|
-
|
|
2338
|
-
const ElementProto = Element.prototype;
|
|
2339
|
-
|
|
2340
|
-
const matchesFn = ElementProto.matches
|
|
2341
|
-
|| /* istanbul ignore next */ ElementProto.matchesSelector
|
|
2342
|
-
|| /* istanbul ignore next */ ElementProto.webkitMatchesSelector
|
|
2343
|
-
|| /* istanbul ignore next */ ElementProto.mozMatchesSelector
|
|
2344
|
-
|| /* istanbul ignore next */ ElementProto.msMatchesSelector
|
|
2345
|
-
|| /* istanbul ignore next */ ElementProto.oMatchesSelector
|
|
2346
|
-
|| /* istanbul ignore next */ function matchesNotSupported() {
|
|
2347
|
-
return false;
|
|
2348
|
-
};
|
|
2349
|
-
|
|
2350
|
-
/**
|
|
2351
|
-
* Check if element matches a CSS selector,
|
|
2352
|
-
* supporting a range of legacy browsers.
|
|
2353
|
-
*
|
|
2354
|
-
* @param {HTMLElement} target
|
|
2355
|
-
* @param {string} selector
|
|
2356
|
-
* @returns {boolean}
|
|
2357
|
-
*/
|
|
2358
|
-
function matches(target, selector) {
|
|
2359
|
-
return matchesFn.call(target, selector);
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
var version = "1.0.2";
|
|
2363
|
-
|
|
2364
|
-
/**
|
|
2365
|
-
* A global namespace for library version.
|
|
2366
|
-
* @type {string}
|
|
2367
|
-
*/
|
|
2368
|
-
const Version = version;
|
|
2369
|
-
|
|
2370
|
-
/** @typedef {import('../types/index')} */
|
|
2371
|
-
|
|
2372
|
-
const SHORTY = {
|
|
2373
|
-
ariaChecked,
|
|
2374
|
-
ariaDescription,
|
|
2375
|
-
ariaDescribedBy,
|
|
2376
|
-
ariaExpanded,
|
|
2377
|
-
ariaHidden,
|
|
2378
|
-
ariaHasPopup,
|
|
2379
|
-
ariaLabel,
|
|
2380
|
-
ariaLabelledBy,
|
|
2381
|
-
ariaModal,
|
|
2382
|
-
ariaPressed,
|
|
2383
|
-
ariaSelected,
|
|
2384
|
-
ariaValueMin,
|
|
2385
|
-
ariaValueMax,
|
|
2386
|
-
ariaValueNow,
|
|
2387
|
-
ariaValueText,
|
|
2388
|
-
nativeEvents,
|
|
2389
|
-
abortEvent,
|
|
2390
|
-
blurEvent,
|
|
2391
|
-
moveEvent,
|
|
2392
|
-
changeEvent,
|
|
2393
|
-
errorEvent,
|
|
2394
|
-
resetEvent,
|
|
2395
|
-
resizeEvent,
|
|
2396
|
-
scrollEvent,
|
|
2397
|
-
submitEvent,
|
|
2398
|
-
loadEvent,
|
|
2399
|
-
loadstartEvent,
|
|
2400
|
-
unloadEvent,
|
|
2401
|
-
readystatechangeEvent,
|
|
2402
|
-
beforeunloadEvent,
|
|
2403
|
-
orientationchangeEvent,
|
|
2404
|
-
contextmenuEvent,
|
|
2405
|
-
DOMContentLoadedEvent,
|
|
2406
|
-
DOMMouseScrollEvent,
|
|
2407
|
-
selectEvent,
|
|
2408
|
-
selectendEvent,
|
|
2409
|
-
selectstartEvent,
|
|
2410
|
-
mouseClickEvents,
|
|
2411
|
-
mouseclickEvent,
|
|
2412
|
-
mousedblclickEvent,
|
|
2413
|
-
mousedownEvent,
|
|
2414
|
-
mouseupEvent,
|
|
2415
|
-
mousehoverEvent,
|
|
2416
|
-
mouseHoverEvents,
|
|
2417
|
-
mouseenterEvent,
|
|
2418
|
-
mouseleaveEvent,
|
|
2419
|
-
mouseinEvent,
|
|
2420
|
-
mouseoutEvent,
|
|
2421
|
-
mouseoverEvent,
|
|
2422
|
-
mousemoveEvent,
|
|
2423
|
-
mousewheelEvent,
|
|
2424
|
-
mouseSwipeEvents,
|
|
2425
|
-
touchEvents,
|
|
2426
|
-
touchstartEvent,
|
|
2427
|
-
touchmoveEvent,
|
|
2428
|
-
touchcancelEvent,
|
|
2429
|
-
touchendEvent,
|
|
2430
|
-
pointercancelEvent,
|
|
2431
|
-
pointerdownEvent,
|
|
2432
|
-
pointerleaveEvent,
|
|
2433
|
-
pointermoveEvent,
|
|
2434
|
-
pointerupEvent,
|
|
2435
|
-
focusEvents,
|
|
2436
|
-
focusEvent,
|
|
2437
|
-
focusinEvent,
|
|
2438
|
-
focusoutEvent,
|
|
2439
|
-
gesturechangeEvent,
|
|
2440
|
-
gestureendEvent,
|
|
2441
|
-
gesturestartEvent,
|
|
2442
|
-
bezierEasings,
|
|
2443
|
-
animationDuration: animationDuration$1,
|
|
2444
|
-
animationDurationLegacy: animationDuration,
|
|
2445
|
-
animationDelay: animationDelay$1,
|
|
2446
|
-
animationDelayLegacy: animationDelay,
|
|
2447
|
-
animationName: animationName$1,
|
|
2448
|
-
animationNameLegacy: animationName,
|
|
2449
|
-
animationEndEvent: animationEndEvent$1,
|
|
2450
|
-
animationEndEventLegacy: animationEndEvent,
|
|
2451
|
-
transitionDuration: transitionDuration$1,
|
|
2452
|
-
transitionDurationLegacy: transitionDuration,
|
|
2453
|
-
transitionDelay: transitionDelay$1,
|
|
2454
|
-
transitionDelayLegacy: transitionDelay,
|
|
2455
|
-
transitionEndEvent: transitionEndEvent$1,
|
|
2456
|
-
transitionEndEventLegacy: transitionEndEvent,
|
|
2457
|
-
transitionProperty: transitionProperty$1,
|
|
2458
|
-
transitionPropertyLegacy: transitionProperty,
|
|
2459
|
-
isMobile,
|
|
2460
|
-
isApple,
|
|
2461
|
-
isFirefox,
|
|
2462
|
-
support3DTransform,
|
|
2463
|
-
supportPassive,
|
|
2464
|
-
supportTransform,
|
|
2465
|
-
supportTouch,
|
|
2466
|
-
supportAnimation,
|
|
2467
|
-
supportTransition,
|
|
2468
|
-
addEventListener,
|
|
2469
|
-
removeEventListener,
|
|
2470
|
-
keyboardEventKeys,
|
|
2471
|
-
keydownEvent,
|
|
2472
|
-
keypressEvent,
|
|
2473
|
-
keyupEvent,
|
|
2474
|
-
keyAlt,
|
|
2475
|
-
keyArrowDown,
|
|
2476
|
-
keyArrowLeft,
|
|
2477
|
-
keyArrowRight,
|
|
2478
|
-
keyArrowUp,
|
|
2479
|
-
keyBackspace,
|
|
2480
|
-
keyCapsLock,
|
|
2481
|
-
keyControl,
|
|
2482
|
-
keyDelete,
|
|
2483
|
-
keyEnter,
|
|
2484
|
-
keyEscape,
|
|
2485
|
-
keyInsert,
|
|
2486
|
-
keyMeta,
|
|
2487
|
-
keyPause,
|
|
2488
|
-
keyScrollLock,
|
|
2489
|
-
keyShift,
|
|
2490
|
-
keySpace,
|
|
2491
|
-
keyTab,
|
|
2492
|
-
offsetHeight,
|
|
2493
|
-
offsetWidth,
|
|
2494
|
-
scrollHeight,
|
|
2495
|
-
scrollWidth,
|
|
2496
|
-
userAgentData,
|
|
2497
|
-
userAgent,
|
|
2498
|
-
addClass,
|
|
2499
|
-
removeClass,
|
|
2500
|
-
hasClass,
|
|
2501
|
-
on,
|
|
2502
|
-
off,
|
|
2503
|
-
one,
|
|
2504
|
-
dispatchEvent,
|
|
2505
|
-
distinct,
|
|
2506
|
-
Data,
|
|
2507
|
-
getInstance,
|
|
2508
|
-
createElement,
|
|
2509
|
-
createElementNS,
|
|
2510
|
-
toUpperCase,
|
|
2511
|
-
toLowerCase,
|
|
2512
|
-
Timer,
|
|
2513
|
-
emulateAnimationEnd: emulateAnimationEnd$1,
|
|
2514
|
-
emulateAnimationEndLegacy: emulateAnimationEnd,
|
|
2515
|
-
emulateTransitionEnd: emulateTransitionEnd$1,
|
|
2516
|
-
emulateTransitionEndLegacy: emulateTransitionEnd,
|
|
2517
|
-
isElementInScrollRange,
|
|
2518
|
-
isElementInViewport,
|
|
2519
|
-
passiveHandler: passiveHandler$1,
|
|
2520
|
-
passiveHandlerLegacy: passiveHandler,
|
|
2521
|
-
getElementAnimationDuration: getElementAnimationDuration$1,
|
|
2522
|
-
getElementAnimationDurationLegacy: getElementAnimationDuration,
|
|
2523
|
-
getElementAnimationDelay: getElementAnimationDelay$1,
|
|
2524
|
-
getElementAnimationDelayLegacy: getElementAnimationDelay,
|
|
2525
|
-
getElementTransitionDuration: getElementTransitionDuration$1,
|
|
2526
|
-
getElementTransitionDurationLegacy: getElementTransitionDuration,
|
|
2527
|
-
getElementTransitionDelay: getElementTransitionDelay$1,
|
|
2528
|
-
getElementTransitionDelayLegacy: getElementTransitionDelay,
|
|
2529
|
-
getNodeScroll,
|
|
2530
|
-
getParentNode,
|
|
2531
|
-
getRectRelativeToOffsetParent,
|
|
2532
|
-
getWindow,
|
|
2533
|
-
isArray,
|
|
2534
|
-
isString,
|
|
2535
|
-
isCustomElement,
|
|
2536
|
-
isElement,
|
|
2537
|
-
isNode,
|
|
2538
|
-
isNumber,
|
|
2539
|
-
isHTMLElement,
|
|
2540
|
-
isHTMLImageElement,
|
|
2541
|
-
isSVGElement,
|
|
2542
|
-
isNodeList,
|
|
2543
|
-
isHTMLCollection,
|
|
2544
|
-
isScaledElement,
|
|
2545
|
-
isTableElement,
|
|
2546
|
-
isShadowRoot,
|
|
2547
|
-
isDocument,
|
|
2548
|
-
isElementsArray,
|
|
2549
|
-
isFunction,
|
|
2550
|
-
isWindow,
|
|
2551
|
-
isMedia,
|
|
2552
|
-
isRTL,
|
|
2553
|
-
closest,
|
|
2554
|
-
querySelector,
|
|
2555
|
-
getCustomElements,
|
|
2556
|
-
getElementById,
|
|
2557
|
-
querySelectorAll,
|
|
2558
|
-
getElementsByClassName,
|
|
2559
|
-
getElementsByTagName,
|
|
2560
|
-
matches: matches$1,
|
|
2561
|
-
matchesLegacy: matches,
|
|
2562
|
-
normalizeValue,
|
|
2563
|
-
normalizeOptions,
|
|
2564
|
-
reflow,
|
|
2565
|
-
noop,
|
|
2566
|
-
focus,
|
|
2567
|
-
getUID,
|
|
2568
|
-
ArrayFrom,
|
|
2569
|
-
Float32ArrayFrom,
|
|
2570
|
-
Float64ArrayFrom,
|
|
2571
|
-
ObjectAssign,
|
|
2572
|
-
ObjectEntries,
|
|
2573
|
-
ObjectKeys,
|
|
2574
|
-
ObjectValues,
|
|
2575
|
-
OriginalEvent,
|
|
2576
|
-
getBoundingClientRect,
|
|
2577
|
-
getDocument,
|
|
2578
|
-
getDocumentBody,
|
|
2579
|
-
getDocumentElement,
|
|
2580
|
-
getDocumentHead,
|
|
2581
|
-
getElementStyle,
|
|
2582
|
-
setElementStyle,
|
|
2583
|
-
hasAttribute,
|
|
2584
|
-
hasAttributeNS,
|
|
2585
|
-
getAttribute,
|
|
2586
|
-
getAttributeNS,
|
|
2587
|
-
setAttribute,
|
|
2588
|
-
setAttributeNS,
|
|
2589
|
-
removeAttribute,
|
|
2590
|
-
removeAttributeNS,
|
|
2591
|
-
Version,
|
|
2592
|
-
};
|
|
2593
|
-
|
|
2594
|
-
export { SHORTY as default };
|