@thednp/shorty 1.0.3 → 2.0.0-alpha3
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 +190 -199
- package/dist/shorty.cjs.js +1606 -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 +1607 -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 +1509 -2556
- 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 +36 -31
- package/src/attr/getAttribute.js +3 -9
- package/src/attr/getAttribute.js.map +1 -0
- package/src/attr/getAttribute.ts +10 -0
- package/src/attr/getAttributeNS.js +3 -10
- package/src/attr/getAttributeNS.js.map +1 -0
- package/src/attr/getAttributeNS.ts +11 -0
- package/src/attr/hasAttribute.js +3 -9
- package/src/attr/hasAttribute.js.map +1 -0
- package/src/attr/hasAttribute.ts +9 -0
- package/src/attr/hasAttributeNS.js +3 -10
- package/src/attr/hasAttributeNS.js.map +1 -0
- package/src/attr/hasAttributeNS.ts +11 -0
- package/src/attr/removeAttribute.js +3 -9
- package/src/attr/removeAttribute.js.map +1 -0
- package/src/attr/removeAttribute.ts +8 -0
- package/src/attr/removeAttributeNS.js +3 -10
- package/src/attr/removeAttributeNS.js.map +1 -0
- package/src/attr/removeAttributeNS.ts +10 -0
- package/src/attr/setAttribute.js +3 -10
- package/src/attr/setAttribute.js.map +1 -0
- package/src/attr/setAttribute.ts +10 -0
- package/src/attr/setAttributeNS.js +3 -11
- package/src/attr/setAttributeNS.js.map +1 -0
- package/src/attr/setAttributeNS.ts +11 -0
- package/src/blocks/documentBody.js +3 -5
- package/src/blocks/documentBody.js.map +1 -0
- package/src/blocks/documentBody.ts +5 -0
- package/src/blocks/documentElement.js +3 -5
- package/src/blocks/documentElement.js.map +1 -0
- package/src/blocks/documentElement.ts +5 -0
- package/src/blocks/documentHead.js +3 -5
- package/src/blocks/documentHead.js.map +1 -0
- package/src/blocks/documentHead.ts +5 -0
- package/src/boolean/isApple.js +8 -13
- package/src/boolean/isApple.js.map +1 -0
- package/src/boolean/isApple.ts +14 -0
- package/src/boolean/isFirefox.js +4 -10
- package/src/boolean/isFirefox.js.map +1 -0
- package/src/boolean/isFirefox.ts +9 -0
- package/src/boolean/isMobile.js +13 -20
- package/src/boolean/isMobile.js.map +1 -0
- package/src/boolean/isMobile.ts +19 -0
- package/src/boolean/support3DTransform.js +4 -9
- package/src/boolean/support3DTransform.js.map +1 -0
- package/src/boolean/support3DTransform.ts +10 -0
- package/src/boolean/supportAnimation.js +4 -9
- package/src/boolean/supportAnimation.js.map +1 -0
- package/src/boolean/supportAnimation.ts +8 -0
- package/src/boolean/supportPassive.js +19 -29
- package/src/boolean/supportPassive.js.map +1 -0
- package/src/boolean/supportPassive.ts +28 -0
- package/src/boolean/supportTouch.js +3 -7
- package/src/boolean/supportTouch.js.map +1 -0
- package/src/boolean/supportTouch.ts +7 -0
- package/src/boolean/supportTransform.js +4 -9
- package/src/boolean/supportTransform.js.map +1 -0
- package/src/boolean/supportTransform.ts +8 -0
- package/src/boolean/supportTransition.js +4 -9
- package/src/boolean/supportTransition.js.map +1 -0
- package/src/boolean/supportTransition.ts +8 -0
- package/src/class/addClass.js +5 -10
- package/src/class/addClass.js.map +1 -0
- package/src/class/addClass.ts +11 -0
- package/src/class/hasClass.js +5 -10
- package/src/class/hasClass.js.map +1 -0
- package/src/class/hasClass.ts +11 -0
- package/src/class/removeClass.js +5 -10
- package/src/class/removeClass.js.map +1 -0
- package/src/class/removeClass.ts +11 -0
- package/src/event/off.js +5 -9
- package/src/event/off.js.map +1 -0
- package/src/event/off.ts +12 -0
- package/src/event/on.js +5 -9
- package/src/event/on.js.map +1 -0
- package/src/event/on.ts +12 -0
- package/src/event/one.js +13 -23
- package/src/event/one.js.map +1 -0
- package/src/event/one.ts +25 -0
- package/src/get/getBoundingClientRect.js +23 -37
- package/src/get/getBoundingClientRect.js.map +1 -0
- package/src/get/getBoundingClientRect.ts +38 -0
- package/src/get/getDocument.js +14 -20
- package/src/get/getDocument.js.map +1 -0
- package/src/get/getDocument.ts +23 -0
- package/src/get/getDocumentBody.js +6 -10
- package/src/get/getDocumentBody.js.map +1 -0
- package/src/get/getDocumentBody.ts +13 -0
- package/src/get/getDocumentElement.js +6 -11
- package/src/get/getDocumentElement.js.map +1 -0
- package/src/get/getDocumentElement.ts +13 -0
- package/src/get/getDocumentHead.js +6 -10
- package/src/get/getDocumentHead.js.map +1 -0
- package/src/get/getDocumentHead.ts +12 -0
- package/src/get/getElementAnimationDelay.js +12 -21
- package/src/get/getElementAnimationDelay.js.map +1 -0
- package/src/get/getElementAnimationDelay.ts +22 -0
- package/src/get/getElementAnimationDuration.js +12 -20
- package/src/get/getElementAnimationDuration.js.map +1 -0
- package/src/get/getElementAnimationDuration.ts +22 -0
- package/src/get/getElementStyle.js +8 -20
- package/src/get/getElementStyle.js.map +1 -0
- package/src/get/getElementStyle.ts +24 -0
- package/src/get/getElementTransitionDelay.js +12 -20
- package/src/get/getElementTransitionDelay.js.map +1 -0
- package/src/get/getElementTransitionDelay.ts +22 -0
- package/src/get/getElementTransitionDuration.js +12 -20
- package/src/get/getElementTransitionDuration.js.map +1 -0
- package/src/get/getElementTransitionDuration.ts +22 -0
- package/src/get/getNodeScroll.js +9 -16
- package/src/get/getNodeScroll.js.map +1 -0
- package/src/get/getNodeScroll.ts +20 -0
- package/src/get/getParentNode.js +15 -23
- package/src/get/getParentNode.js.map +1 -0
- package/src/get/getParentNode.ts +27 -0
- package/src/get/getRectRelativeToOffsetParent.js +21 -32
- package/src/get/getRectRelativeToOffsetParent.js.map +1 -0
- package/src/get/getRectRelativeToOffsetParent.ts +39 -0
- package/src/get/getUID.js +32 -34
- package/src/get/getUID.js.map +1 -0
- package/src/get/getUID.ts +42 -0
- package/src/get/getWindow.js +13 -20
- package/src/get/getWindow.js.map +1 -0
- package/src/get/getWindow.ts +22 -0
- package/src/index.js +419 -477
- package/src/index.js.map +1 -0
- package/src/index.ts +450 -0
- package/src/interface/boundingClientRect.js +2 -0
- package/src/interface/boundingClientRect.js.map +1 -0
- package/src/interface/boundingClientRect.ts +10 -0
- package/src/interface/css4Declaration.js +2 -0
- package/src/interface/css4Declaration.js.map +1 -0
- package/src/interface/css4Declaration.ts +3 -0
- package/src/interface/customElement.js +2 -0
- package/src/interface/customElement.js.map +1 -0
- package/src/interface/customElement.ts +8 -0
- package/src/interface/navigatorUA.js +2 -0
- package/src/interface/navigatorUA.js.map +1 -0
- package/src/interface/navigatorUA.ts +15 -0
- package/src/interface/offsetRect.js +2 -0
- package/src/interface/offsetRect.js.map +1 -0
- package/src/interface/offsetRect.ts +6 -0
- package/src/interface/originalEvent.js +2 -0
- package/src/interface/originalEvent.js.map +1 -0
- package/src/interface/originalEvent.ts +3 -0
- package/src/is/isArray.js +3 -8
- package/src/is/isArray.js.map +1 -0
- package/src/is/isArray.ts +9 -0
- package/src/is/isCanvas.js +3 -0
- package/src/is/isCanvas.js.map +1 -0
- package/src/is/isCanvas.ts +11 -0
- package/src/is/isCustomElement.js +3 -8
- package/src/is/isCustomElement.js.map +1 -0
- package/src/is/isCustomElement.ts +12 -0
- package/src/is/isDocument.js +3 -10
- package/src/is/isDocument.js.map +1 -0
- package/src/is/isDocument.ts +10 -0
- package/src/is/isElement.js +3 -22
- package/src/is/isElement.js.map +1 -0
- package/src/is/isElement.ts +22 -0
- package/src/is/isElementInScrollRange.js +12 -20
- package/src/is/isElementInScrollRange.js.map +1 -0
- package/src/is/isElementInScrollRange.ts +20 -0
- package/src/is/isElementInViewport.js +12 -26
- package/src/is/isElementInViewport.js.map +1 -0
- package/src/is/isElementInViewport.ts +20 -0
- package/src/is/isElementsArray.js +5 -12
- package/src/is/isElementsArray.js.map +1 -0
- package/src/is/isElementsArray.ts +13 -0
- package/src/is/isFunction.js +3 -8
- package/src/is/isFunction.js.map +1 -0
- package/src/is/isFunction.ts +10 -0
- package/src/is/isHTMLCollection.js +3 -8
- package/src/is/isHTMLCollection.js.map +1 -0
- package/src/is/isHTMLCollection.ts +10 -0
- package/src/is/isHTMLElement.js +3 -9
- package/src/is/isHTMLElement.js.map +1 -0
- package/src/is/isHTMLElement.ts +10 -0
- package/src/is/isHTMLImageElement.js +3 -8
- package/src/is/isHTMLImageElement.js.map +1 -0
- package/src/is/isHTMLImageElement.ts +9 -0
- package/src/is/isJSON.js +14 -0
- package/src/is/isJSON.js.map +1 -0
- package/src/is/isJSON.ts +20 -0
- package/src/is/isMap.js +3 -0
- package/src/is/isMap.js.map +1 -0
- package/src/is/isMap.ts +8 -0
- package/src/is/isMedia.js +6 -14
- package/src/is/isMedia.js.map +1 -0
- package/src/is/isMedia.ts +18 -0
- package/src/is/isNode.js +3 -9
- package/src/is/isNode.js.map +1 -0
- package/src/is/isNode.ts +11 -0
- package/src/is/isNodeList.js +3 -9
- package/src/is/isNodeList.js.map +1 -0
- package/src/is/isNodeList.ts +11 -0
- package/src/is/isNumber.js +3 -8
- package/src/is/isNumber.js.map +1 -0
- package/src/is/isNumber.ts +9 -0
- package/src/is/isObject.js +3 -8
- package/src/is/isObject.js.map +1 -0
- package/src/is/isObject.ts +9 -0
- package/src/is/isRTL.js +4 -9
- package/src/is/isRTL.js.map +1 -0
- package/src/is/isRTL.ts +10 -0
- package/src/is/isSVGElement.js +3 -11
- package/src/is/isSVGElement.js.map +1 -0
- package/src/is/isSVGElement.ts +11 -0
- package/src/is/isScaledElement.js +10 -17
- package/src/is/isScaledElement.js.map +1 -0
- package/src/is/isScaledElement.ts +16 -0
- package/src/is/isShadowRoot.js +3 -9
- package/src/is/isShadowRoot.js.map +1 -0
- package/src/is/isShadowRoot.ts +10 -0
- package/src/is/isString.js +3 -8
- package/src/is/isString.js.map +1 -0
- package/src/is/isString.ts +9 -0
- package/src/is/isTableElement.js +3 -11
- package/src/is/isTableElement.js.map +1 -0
- package/src/is/isTableElement.ts +12 -0
- package/src/is/isWeakMap.js +3 -0
- package/src/is/isWeakMap.js.map +1 -0
- package/src/is/isWeakMap.ts +9 -0
- package/src/is/isWindow.js +3 -9
- package/src/is/isWindow.js.map +1 -0
- package/src/is/isWindow.ts +10 -0
- package/src/misc/ArrayFrom.js +3 -8
- package/src/misc/ArrayFrom.js.map +1 -0
- package/src/misc/ArrayFrom.ts +11 -0
- package/src/misc/Float32ArrayFrom.js +3 -7
- package/src/misc/Float32ArrayFrom.js.map +1 -0
- package/src/misc/Float32ArrayFrom.ts +9 -0
- package/src/misc/Float64ArrayFrom.js +3 -7
- package/src/misc/Float64ArrayFrom.js.map +1 -0
- package/src/misc/Float64ArrayFrom.ts +9 -0
- package/src/misc/ObjectAssign.js +3 -7
- package/src/misc/ObjectAssign.js.map +1 -0
- package/src/misc/ObjectAssign.ts +11 -0
- package/src/misc/ObjectEntries.js +3 -7
- package/src/misc/ObjectEntries.js.map +1 -0
- package/src/misc/ObjectEntries.ts +8 -0
- package/src/misc/ObjectKeys.js +3 -7
- package/src/misc/ObjectKeys.js.map +1 -0
- package/src/misc/ObjectKeys.ts +8 -0
- package/src/misc/ObjectValues.js +3 -7
- package/src/misc/ObjectValues.js.map +1 -0
- package/src/misc/ObjectValues.ts +8 -0
- package/src/misc/OriginalEvent.js +14 -20
- package/src/misc/OriginalEvent.js.map +1 -0
- package/src/misc/OriginalEvent.ts +24 -0
- package/src/misc/createElement.js +25 -27
- package/src/misc/createElement.js.map +1 -0
- package/src/misc/createElement.ts +39 -0
- package/src/misc/createElementNS.js +25 -30
- package/src/misc/createElementNS.js.map +1 -0
- package/src/misc/createElementNS.ts +44 -0
- package/src/misc/data.js +36 -78
- package/src/misc/data.js.map +1 -0
- package/src/misc/data.ts +82 -0
- package/src/misc/dispatchEvent.js +3 -8
- package/src/misc/dispatchEvent.js.map +1 -0
- package/src/misc/dispatchEvent.ts +9 -0
- package/src/misc/distinct.js +3 -10
- package/src/misc/distinct.js.map +1 -0
- package/src/misc/distinct.ts +17 -0
- package/src/misc/emulateAnimationEnd.js +29 -40
- package/src/misc/emulateAnimationEnd.js.map +1 -0
- package/src/misc/emulateAnimationEnd.ts +39 -0
- package/src/misc/emulateTransitionEnd.js +29 -40
- package/src/misc/emulateTransitionEnd.js.map +1 -0
- package/src/misc/emulateTransitionEnd.ts +39 -0
- package/src/misc/focus.js +3 -7
- package/src/misc/focus.js.map +1 -0
- package/src/misc/focus.ts +9 -0
- package/src/misc/noop.js +3 -3
- package/src/misc/noop.js.map +1 -0
- package/src/misc/noop.ts +4 -0
- package/src/misc/normalizeOptions.js +34 -49
- package/src/misc/normalizeOptions.js.map +1 -0
- package/src/misc/normalizeOptions.ts +55 -0
- package/src/misc/normalizeValue.js +17 -34
- package/src/misc/normalizeValue.js.map +1 -0
- package/src/misc/normalizeValue.ts +30 -0
- package/src/misc/passiveHandler.js +3 -7
- package/src/misc/passiveHandler.js.map +1 -0
- package/src/misc/passiveHandler.ts +6 -0
- package/src/misc/reflow.js +3 -8
- package/src/misc/reflow.js.map +1 -0
- package/src/misc/reflow.ts +9 -0
- package/src/misc/setElementStyle.js +16 -19
- package/src/misc/setElementStyle.js.map +1 -0
- package/src/misc/setElementStyle.ts +21 -0
- package/src/misc/timer.js +51 -75
- package/src/misc/timer.js.map +1 -0
- package/src/misc/timer.ts +81 -0
- package/src/misc/toLowerCase.js +3 -8
- package/src/misc/toLowerCase.js.map +1 -0
- package/src/misc/toLowerCase.ts +9 -0
- package/src/misc/toUpperCase.js +3 -8
- package/src/misc/toUpperCase.js.map +1 -0
- package/src/misc/toUpperCase.ts +9 -0
- package/src/selectors/closest.js +8 -16
- package/src/selectors/closest.js.map +1 -0
- package/src/selectors/closest.ts +20 -0
- package/src/selectors/getCustomElements.js +8 -16
- package/src/selectors/getCustomElements.js.map +1 -0
- package/src/selectors/getCustomElements.ts +19 -0
- package/src/selectors/getElementById.js +6 -14
- package/src/selectors/getElementById.js.map +1 -0
- package/src/selectors/getElementById.ts +16 -0
- package/src/selectors/getElementsByClassName.js +8 -15
- package/src/selectors/getElementsByClassName.js.map +1 -0
- package/src/selectors/getElementsByClassName.ts +22 -0
- package/src/selectors/getElementsByTagName.js +8 -15
- package/src/selectors/getElementsByTagName.js.map +1 -0
- package/src/selectors/getElementsByTagName.ts +20 -0
- package/src/selectors/matches.js +3 -10
- package/src/selectors/matches.js.map +1 -0
- package/src/selectors/matches.ts +10 -0
- package/src/selectors/querySelector.js +11 -19
- package/src/selectors/querySelector.js.map +1 -0
- package/src/selectors/querySelector.ts +21 -0
- package/src/selectors/querySelectorAll.js +8 -14
- package/src/selectors/querySelectorAll.js.map +1 -0
- package/src/selectors/querySelectorAll.ts +16 -0
- package/src/strings/DOMContentLoadedEvent.js +3 -6
- package/src/strings/DOMContentLoadedEvent.js.map +1 -0
- package/src/strings/DOMContentLoadedEvent.ts +5 -0
- package/src/strings/DOMMouseScrollEvent.js +3 -6
- package/src/strings/DOMMouseScrollEvent.js.map +1 -0
- package/src/strings/DOMMouseScrollEvent.ts +5 -0
- package/src/strings/abortEvent.js +3 -6
- package/src/strings/abortEvent.js.map +1 -0
- package/src/strings/abortEvent.ts +5 -0
- package/src/strings/addEventListener.js +3 -6
- package/src/strings/addEventListener.js.map +1 -0
- package/src/strings/addEventListener.ts +5 -0
- package/src/strings/animationDelay.js +3 -6
- package/src/strings/animationDelay.js.map +1 -0
- package/src/strings/animationDelay.ts +5 -0
- package/src/strings/animationDuration.js +3 -6
- package/src/strings/animationDuration.js.map +1 -0
- package/src/strings/animationDuration.ts +5 -0
- package/src/strings/animationEndEvent.js +3 -6
- package/src/strings/animationEndEvent.js.map +1 -0
- package/src/strings/animationEndEvent.ts +5 -0
- package/src/strings/animationName.js +3 -6
- package/src/strings/animationName.js.map +1 -0
- package/src/strings/animationName.ts +5 -0
- package/src/strings/ariaChecked.js +3 -6
- package/src/strings/ariaChecked.js.map +1 -0
- package/src/strings/ariaChecked.ts +5 -0
- package/src/strings/ariaDescribedBy.js +3 -6
- package/src/strings/ariaDescribedBy.js.map +1 -0
- package/src/strings/ariaDescribedBy.ts +5 -0
- package/src/strings/ariaDescription.js +3 -6
- package/src/strings/ariaDescription.js.map +1 -0
- package/src/strings/ariaDescription.ts +5 -0
- package/src/strings/ariaExpanded.js +3 -6
- package/src/strings/ariaExpanded.js.map +1 -0
- package/src/strings/ariaExpanded.ts +5 -0
- package/src/strings/ariaHasPopup.js +3 -6
- package/src/strings/ariaHasPopup.js.map +1 -0
- package/src/strings/ariaHasPopup.ts +5 -0
- package/src/strings/ariaHidden.js +3 -6
- package/src/strings/ariaHidden.js.map +1 -0
- package/src/strings/ariaHidden.ts +5 -0
- package/src/strings/ariaLabel.js +3 -6
- package/src/strings/ariaLabel.js.map +1 -0
- package/src/strings/ariaLabel.ts +5 -0
- package/src/strings/ariaLabelledBy.js +3 -6
- package/src/strings/ariaLabelledBy.js.map +1 -0
- package/src/strings/ariaLabelledBy.ts +5 -0
- package/src/strings/ariaModal.js +3 -6
- package/src/strings/ariaModal.js.map +1 -0
- package/src/strings/ariaModal.ts +5 -0
- package/src/strings/ariaPressed.js +3 -6
- package/src/strings/ariaPressed.js.map +1 -0
- package/src/strings/ariaPressed.ts +5 -0
- package/src/strings/ariaSelected.js +3 -6
- package/src/strings/ariaSelected.js.map +1 -0
- package/src/strings/ariaSelected.ts +5 -0
- package/src/strings/ariaValueMax.js +3 -6
- package/src/strings/ariaValueMax.js.map +1 -0
- package/src/strings/ariaValueMax.ts +5 -0
- package/src/strings/ariaValueMin.js +3 -6
- package/src/strings/ariaValueMin.js.map +1 -0
- package/src/strings/ariaValueMin.ts +5 -0
- package/src/strings/ariaValueNow.js +3 -6
- package/src/strings/ariaValueNow.js.map +1 -0
- package/src/strings/ariaValueNow.ts +5 -0
- package/src/strings/ariaValueText.js +3 -6
- package/src/strings/ariaValueText.js.map +1 -0
- package/src/strings/ariaValueText.ts +5 -0
- package/src/strings/beforeunloadEvent.js +3 -6
- package/src/strings/beforeunloadEvent.js.map +1 -0
- package/src/strings/beforeunloadEvent.ts +5 -0
- package/src/strings/bezierEasings.js +29 -33
- package/src/strings/bezierEasings.js.map +1 -0
- package/src/strings/bezierEasings.ts +32 -0
- package/src/strings/blurEvent.js +3 -6
- package/src/strings/blurEvent.js.map +1 -0
- package/src/strings/blurEvent.ts +5 -0
- package/src/strings/changeEvent.js +3 -6
- package/src/strings/changeEvent.js.map +1 -0
- package/src/strings/changeEvent.ts +5 -0
- package/src/strings/contextmenuEvent.js +3 -6
- package/src/strings/contextmenuEvent.js.map +1 -0
- package/src/strings/contextmenuEvent.ts +5 -0
- package/src/strings/errorEvent.js +3 -6
- package/src/strings/errorEvent.js.map +1 -0
- package/src/strings/errorEvent.ts +5 -0
- package/src/strings/focusEvent.js +3 -6
- package/src/strings/focusEvent.js.map +1 -0
- package/src/strings/focusEvent.ts +5 -0
- package/src/strings/focusEvents.js +3 -6
- package/src/strings/focusEvents.js.map +1 -0
- package/src/strings/focusEvents.ts +5 -0
- package/src/strings/focusinEvent.js +3 -6
- package/src/strings/focusinEvent.js.map +1 -0
- package/src/strings/focusinEvent.ts +5 -0
- package/src/strings/focusoutEvent.js +3 -6
- package/src/strings/focusoutEvent.js.map +1 -0
- package/src/strings/focusoutEvent.ts +5 -0
- package/src/strings/gesturechangeEvent.js +3 -6
- package/src/strings/gesturechangeEvent.js.map +1 -0
- package/src/strings/gesturechangeEvent.ts +5 -0
- package/src/strings/gestureendEvent.js +3 -6
- package/src/strings/gestureendEvent.js.map +1 -0
- package/src/strings/gestureendEvent.ts +5 -0
- package/src/strings/gesturestartEvent.js +3 -6
- package/src/strings/gesturestartEvent.js.map +1 -0
- package/src/strings/gesturestartEvent.ts +5 -0
- package/src/strings/keyAlt.js +3 -7
- package/src/strings/keyAlt.js.map +1 -0
- package/src/strings/keyAlt.ts +7 -0
- package/src/strings/keyArrowDown.js +3 -7
- package/src/strings/keyArrowDown.js.map +1 -0
- package/src/strings/keyArrowDown.ts +7 -0
- package/src/strings/keyArrowLeft.js +3 -7
- package/src/strings/keyArrowLeft.js.map +1 -0
- package/src/strings/keyArrowLeft.ts +7 -0
- package/src/strings/keyArrowRight.js +3 -7
- package/src/strings/keyArrowRight.js.map +1 -0
- package/src/strings/keyArrowRight.ts +7 -0
- package/src/strings/keyArrowUp.js +3 -7
- package/src/strings/keyArrowUp.js.map +1 -0
- package/src/strings/keyArrowUp.ts +7 -0
- package/src/strings/keyBackspace.js +3 -7
- package/src/strings/keyBackspace.js.map +1 -0
- package/src/strings/keyBackspace.ts +7 -0
- package/src/strings/keyCapsLock.js +3 -7
- package/src/strings/keyCapsLock.js.map +1 -0
- package/src/strings/keyCapsLock.ts +7 -0
- package/src/strings/keyControl.js +3 -7
- package/src/strings/keyControl.js.map +1 -0
- package/src/strings/keyControl.ts +7 -0
- package/src/strings/keyDelete.js +3 -7
- package/src/strings/keyDelete.js.map +1 -0
- package/src/strings/keyDelete.ts +7 -0
- package/src/strings/keyEnter.js +3 -7
- package/src/strings/keyEnter.js.map +1 -0
- package/src/strings/keyEnter.ts +7 -0
- package/src/strings/keyEscape.js +3 -7
- package/src/strings/keyEscape.js.map +1 -0
- package/src/strings/keyEscape.ts +7 -0
- package/src/strings/keyInsert.js +3 -7
- package/src/strings/keyInsert.js.map +1 -0
- package/src/strings/keyInsert.ts +7 -0
- package/src/strings/keyMeta.js +3 -7
- package/src/strings/keyMeta.js.map +1 -0
- package/src/strings/keyMeta.ts +7 -0
- package/src/strings/keyPause.js +3 -7
- package/src/strings/keyPause.js.map +1 -0
- package/src/strings/keyPause.ts +7 -0
- package/src/strings/keyScrollLock.js +3 -7
- package/src/strings/keyScrollLock.js.map +1 -0
- package/src/strings/keyScrollLock.ts +7 -0
- package/src/strings/keyShift.js +3 -7
- package/src/strings/keyShift.js.map +1 -0
- package/src/strings/keyShift.ts +7 -0
- package/src/strings/keySpace.js +3 -7
- package/src/strings/keySpace.js.map +1 -0
- package/src/strings/keySpace.ts +7 -0
- package/src/strings/keyTab.js +3 -7
- package/src/strings/keyTab.js.map +1 -0
- package/src/strings/keyTab.ts +7 -0
- package/src/strings/keyboardEventKeys.js +23 -27
- package/src/strings/keyboardEventKeys.js.map +1 -0
- package/src/strings/keyboardEventKeys.ts +26 -0
- package/src/strings/keydownEvent.js +3 -6
- package/src/strings/keydownEvent.js.map +1 -0
- package/src/strings/keydownEvent.ts +5 -0
- package/src/strings/keypressEvent.js +3 -6
- package/src/strings/keypressEvent.js.map +1 -0
- package/src/strings/keypressEvent.ts +5 -0
- package/src/strings/keyupEvent.js +3 -6
- package/src/strings/keyupEvent.js.map +1 -0
- package/src/strings/keyupEvent.ts +5 -0
- package/src/strings/loadEvent.js +3 -6
- package/src/strings/loadEvent.js.map +1 -0
- package/src/strings/loadEvent.ts +5 -0
- package/src/strings/loadstartEvent.js +3 -6
- package/src/strings/loadstartEvent.js.map +1 -0
- package/src/strings/loadstartEvent.ts +5 -0
- package/src/strings/mouseClickEvents.js +3 -6
- package/src/strings/mouseClickEvents.js.map +1 -0
- package/src/strings/mouseClickEvents.ts +5 -0
- package/src/strings/mouseHoverEvents.js +5 -7
- package/src/strings/mouseHoverEvents.js.map +1 -0
- package/src/strings/mouseHoverEvents.ts +8 -0
- package/src/strings/mouseSwipeEvents.js +8 -8
- package/src/strings/mouseSwipeEvents.js.map +1 -0
- package/src/strings/mouseSwipeEvents.ts +10 -0
- package/src/strings/mouseclickEvent.js +3 -6
- package/src/strings/mouseclickEvent.js.map +1 -0
- package/src/strings/mouseclickEvent.ts +5 -0
- package/src/strings/mousedblclickEvent.js +3 -6
- package/src/strings/mousedblclickEvent.js.map +1 -0
- package/src/strings/mousedblclickEvent.ts +5 -0
- package/src/strings/mousedownEvent.js +3 -6
- package/src/strings/mousedownEvent.js.map +1 -0
- package/src/strings/mousedownEvent.ts +5 -0
- package/src/strings/mouseenterEvent.js +3 -6
- package/src/strings/mouseenterEvent.js.map +1 -0
- package/src/strings/mouseenterEvent.ts +5 -0
- package/src/strings/mousehoverEvent.js +3 -6
- package/src/strings/mousehoverEvent.js.map +1 -0
- package/src/strings/mousehoverEvent.ts +5 -0
- package/src/strings/mouseinEvent.js +3 -6
- package/src/strings/mouseinEvent.js.map +1 -0
- package/src/strings/mouseinEvent.ts +5 -0
- package/src/strings/mouseleaveEvent.js +3 -6
- package/src/strings/mouseleaveEvent.js.map +1 -0
- package/src/strings/mouseleaveEvent.ts +5 -0
- package/src/strings/mousemoveEvent.js +3 -6
- package/src/strings/mousemoveEvent.js.map +1 -0
- package/src/strings/mousemoveEvent.ts +5 -0
- package/src/strings/mouseoutEvent.js +3 -6
- package/src/strings/mouseoutEvent.js.map +1 -0
- package/src/strings/mouseoutEvent.ts +5 -0
- package/src/strings/mouseoverEvent.js +3 -6
- package/src/strings/mouseoverEvent.js.map +1 -0
- package/src/strings/mouseoverEvent.ts +5 -0
- package/src/strings/mouseupEvent.js +3 -6
- package/src/strings/mouseupEvent.js.map +1 -0
- package/src/strings/mouseupEvent.ts +5 -0
- package/src/strings/mousewheelEvent.js +3 -6
- package/src/strings/mousewheelEvent.js.map +1 -0
- package/src/strings/mousewheelEvent.ts +5 -0
- package/src/strings/moveEvent.js +3 -6
- package/src/strings/moveEvent.js.map +1 -0
- package/src/strings/moveEvent.ts +5 -0
- package/src/strings/nativeEvents.js +104 -108
- package/src/strings/nativeEvents.js.map +1 -0
- package/src/strings/nativeEvents.ts +108 -0
- package/src/strings/offsetHeight.js +3 -6
- package/src/strings/offsetHeight.js.map +1 -0
- package/src/strings/offsetHeight.ts +5 -0
- package/src/strings/offsetWidth.js +3 -6
- package/src/strings/offsetWidth.js.map +1 -0
- package/src/strings/offsetWidth.ts +5 -0
- package/src/strings/orientationchangeEvent.js +3 -6
- package/src/strings/orientationchangeEvent.js.map +1 -0
- package/src/strings/orientationchangeEvent.ts +5 -0
- package/src/strings/pointercancelEvent.js +3 -6
- package/src/strings/pointercancelEvent.js.map +1 -0
- package/src/strings/pointercancelEvent.ts +5 -0
- package/src/strings/pointerdownEvent.js +3 -6
- package/src/strings/pointerdownEvent.js.map +1 -0
- package/src/strings/pointerdownEvent.ts +5 -0
- package/src/strings/pointerleaveEvent.js +3 -6
- package/src/strings/pointerleaveEvent.js.map +1 -0
- package/src/strings/pointerleaveEvent.ts +5 -0
- package/src/strings/pointermoveEvent.js +3 -6
- package/src/strings/pointermoveEvent.js.map +1 -0
- package/src/strings/pointermoveEvent.ts +5 -0
- package/src/strings/pointerupEvent.js +3 -6
- package/src/strings/pointerupEvent.js.map +1 -0
- package/src/strings/pointerupEvent.ts +5 -0
- package/src/strings/readystatechangeEvent.js +3 -6
- package/src/strings/readystatechangeEvent.js.map +1 -0
- package/src/strings/readystatechangeEvent.ts +5 -0
- package/src/strings/removeEventListener.js +3 -6
- package/src/strings/removeEventListener.js.map +1 -0
- package/src/strings/removeEventListener.ts +5 -0
- package/src/strings/resetEvent.js +3 -6
- package/src/strings/resetEvent.js.map +1 -0
- package/src/strings/resetEvent.ts +5 -0
- package/src/strings/resizeEvent.js +3 -6
- package/src/strings/resizeEvent.js.map +1 -0
- package/src/strings/resizeEvent.ts +5 -0
- package/src/strings/scrollEvent.js +3 -6
- package/src/strings/scrollEvent.js.map +1 -0
- package/src/strings/scrollEvent.ts +5 -0
- package/src/strings/scrollHeight.js +3 -6
- package/src/strings/scrollHeight.js.map +1 -0
- package/src/strings/scrollHeight.ts +5 -0
- package/src/strings/scrollWidth.js +3 -6
- package/src/strings/scrollWidth.js.map +1 -0
- package/src/strings/scrollWidth.ts +5 -0
- package/src/strings/selectEvent.js +3 -6
- package/src/strings/selectEvent.js.map +1 -0
- package/src/strings/selectEvent.ts +5 -0
- package/src/strings/selectendEvent.js +3 -6
- package/src/strings/selectendEvent.js.map +1 -0
- package/src/strings/selectendEvent.ts +5 -0
- package/src/strings/selectstartEvent.js +3 -6
- package/src/strings/selectstartEvent.js.map +1 -0
- package/src/strings/selectstartEvent.ts +5 -0
- package/src/strings/submitEvent.js +3 -6
- package/src/strings/submitEvent.js.map +1 -0
- package/src/strings/submitEvent.ts +5 -0
- package/src/strings/tabindex.js +3 -0
- package/src/strings/tabindex.js.map +1 -0
- package/src/strings/tabindex.ts +5 -0
- package/src/strings/touchEvents.js +8 -8
- package/src/strings/touchEvents.js.map +1 -0
- package/src/strings/touchEvents.ts +10 -0
- package/src/strings/touchcancelEvent.js +3 -6
- package/src/strings/touchcancelEvent.js.map +1 -0
- package/src/strings/touchcancelEvent.ts +5 -0
- package/src/strings/touchendEvent.js +3 -6
- package/src/strings/touchendEvent.js.map +1 -0
- package/src/strings/touchendEvent.ts +5 -0
- package/src/strings/touchmoveEvent.js +3 -6
- package/src/strings/touchmoveEvent.js.map +1 -0
- package/src/strings/touchmoveEvent.ts +5 -0
- package/src/strings/touchstartEvent.js +3 -6
- package/src/strings/touchstartEvent.js.map +1 -0
- package/src/strings/touchstartEvent.ts +5 -0
- package/src/strings/transitionDelay.js +3 -6
- package/src/strings/transitionDelay.js.map +1 -0
- package/src/strings/transitionDelay.ts +5 -0
- package/src/strings/transitionDuration.js +3 -6
- package/src/strings/transitionDuration.js.map +1 -0
- package/src/strings/transitionDuration.ts +5 -0
- package/src/strings/transitionEndEvent.js +3 -6
- package/src/strings/transitionEndEvent.js.map +1 -0
- package/src/strings/transitionEndEvent.ts +5 -0
- package/src/strings/transitionProperty.js +3 -7
- package/src/strings/transitionProperty.js.map +1 -0
- package/src/strings/transitionProperty.ts +5 -0
- package/src/strings/unloadEvent.js +3 -6
- package/src/strings/unloadEvent.js.map +1 -0
- package/src/strings/unloadEvent.ts +5 -0
- package/src/strings/userAgent.js +4 -7
- package/src/strings/userAgent.js.map +1 -0
- package/src/strings/userAgent.ts +7 -0
- package/src/strings/userAgentData.js +4 -7
- package/src/strings/userAgentData.js.map +1 -0
- package/src/strings/userAgentData.ts +9 -0
- package/src/types.js +2 -0
- package/src/types.js.map +1 -0
- package/src/types.ts +9 -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 +346 -257
- 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/isJSON.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 -2599
- 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 -248
- package/types/shorty.d.ts +0 -2316
package/README.md
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
# shorty
|
|
2
|
+
|
|
2
3
|
[](https://coveralls.io/github/thednp/shorty)
|
|
3
4
|
[](https://github.com/thednp/shorty/actions/workflows/ci.yml)
|
|
4
5
|
[](https://www.npmjs.com/package/@thednp/shorty)
|
|
5
6
|
[](http://npm-stat.com/charts.html?package=@thednp/shorty)
|
|
6
7
|
[](https://www.jsdelivr.com/package/npm/@thednp/shorty)
|
|
7
|
-

|
|
9
|
+

|
|
11
10
|
|
|
11
|
+
A small TypeScript library with various tools, all ESLint valid and featuring everything useful for creating light libraries or web components. If there is anything that is consistently repeating itself, **shorty** can help you save up to 50% of the code required, with little to no performance cost.
|
|
12
12
|
|
|
13
13
|
**shorty** is featured in [ColorPicker](https://github.com/thednp/color-picker), [KUTE.js](https://github.com/thednp/kute.js), [BSN](https://github.com/thednp/bootstrap.native), [Navbar.js](https://github.com/thednp/navbar.js) and other libraries.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
- The purpose of the library is to speed up the development workflow, minimize the size of larger libraries by providing a shorter syntax for most used JavaScript API methods, most used strings or other helpful utilities.
|
|
16
|
+
- Another excellent use for the library is for its selectors in a testing environment where you need to check the `instanceof` for various objects.
|
|
17
|
+
- While the library comes with a working build in the `dist` folder, that is mainly for build consistency testing. You can make use of "tree shaking" to import one or anything your code needs.
|
|
18
|
+
- On that note, all shorties are organized in folders inside the `src` root folder, the structure is key to understanding the purpose of each type of shortie, whether we have `boolean` for various basic browser detection or browser feature support, `attr` for all things _Element_ attributes or `strings` for most common and most used _Element.prototype_ methods.
|
|
19
19
|
|
|
20
20
|
# npm
|
|
21
|
+
|
|
21
22
|
```
|
|
22
23
|
npm install @thednp/shorty
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
# ES6+ Base usage
|
|
26
|
+
# TypeScript / ES6+ Base usage
|
|
27
|
+
|
|
26
28
|
```js
|
|
27
29
|
// import the tool you need
|
|
28
|
-
import { supportTransform } from
|
|
30
|
+
import { supportTransform } from "@thednp/shorty";
|
|
29
31
|
|
|
30
32
|
// use the tool in your ES6/ES7 sources
|
|
31
33
|
if (supportTransform) {
|
|
@@ -34,160 +36,155 @@ if (supportTransform) {
|
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
# attr
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
|
|
40
|
+
- **_getAttribute_** - returns the value of a specified _Element_ attribute;
|
|
41
|
+
- **_getAttributeNS_** - returns the value of a specified namespaced _Element_ attribute (eg: namespaced SVG attributes);
|
|
42
|
+
- **_hasAttribute_** - check if element has a specified attribute;
|
|
43
|
+
- **_hasAttributeNS_** - check if element has a specified namespaced attribute;
|
|
44
|
+
- **_removeAttribute_** - removes a specified attribute from an element;
|
|
45
|
+
- **_removeAttributeNS_** - removes a specified namespaced attribute from an element;
|
|
46
|
+
- **_setAttribute_** - set a new attribute value for a given element;
|
|
47
|
+
- **_setAttributeNS_** - set a new namespaced attribute value for a given element;
|
|
48
|
+
|
|
49
|
+
```js
|
|
47
50
|
// EXAMPLES
|
|
48
|
-
import { getAttribute, hasAttribute, setAttribute } from
|
|
51
|
+
import { getAttribute, hasAttribute, setAttribute } from "@thednp/shorty";
|
|
49
52
|
|
|
50
53
|
// check target has certain attribute
|
|
51
|
-
if (!hasAttribute(myTarget,
|
|
52
|
-
setAttribute(myTarget,
|
|
54
|
+
if (!hasAttribute(myTarget, "attribute-name")) {
|
|
55
|
+
setAttribute(myTarget, "attribute-name", "new-value");
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
// get attribute value
|
|
56
|
-
const currentAttrValue = getAttribute(myTarget,
|
|
59
|
+
const currentAttrValue = getAttribute(myTarget, "attribute-name");
|
|
57
60
|
```
|
|
58
61
|
|
|
59
|
-
|
|
60
62
|
# blocks
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
- **_documentBody_** - a shortie for `document.body`;
|
|
65
|
+
- **_documentElement_** - a shortie for `document.documentElement`;
|
|
66
|
+
- **_documentHead_** - a shortie for `document.head`;
|
|
64
67
|
|
|
65
68
|
# boolean
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
|
|
70
|
+
- **_isApple_** - checks and preserves a `boolean` value for the client browser is either Apple **Safari** browser or not;
|
|
71
|
+
- **_isFirefox_** - checks and preserves a `boolean` value for the client browser is either **Firefox** or not;
|
|
72
|
+
- **_isMobile_** - checks and preserves a `boolean` value for the client browser is either a Mobile device or not;
|
|
73
|
+
- **_support3DTransform_** - checks and preserves a `boolean` value for the client browser capability for webKit `perspective`;
|
|
74
|
+
- **_supportTouch_** - checks and preserves a `boolean` value for the client browser capability for `touch` events;
|
|
75
|
+
- **_supportPassive_** - checks and preserves a `boolean` value for the client browser capability for `passive` event option;
|
|
76
|
+
- **_supportTransform_** - checks and preserves a `boolean` value for the client browser capability for webKit `transform`;
|
|
77
|
+
- **_supportAnimation_** - checks and preserves a `boolean` value for the client browser capability for webKit keyframe `animation`;
|
|
78
|
+
- **_supportTransition_** - checks and preserves a `boolean` value for the client browser capability for webKit `transition`;
|
|
79
|
+
|
|
80
|
+
```js
|
|
77
81
|
// EXAMPLES
|
|
78
|
-
import { support3DTransform } from
|
|
82
|
+
import { support3DTransform } from "@thednp/shorty";
|
|
79
83
|
|
|
80
84
|
// filter myAction to supported browsers
|
|
81
85
|
if (support3DTransform) {
|
|
82
86
|
// do something with modern browsers
|
|
83
87
|
}
|
|
84
88
|
```
|
|
85
|
-
|
|
89
|
+
|
|
86
90
|
# class
|
|
87
|
-
* ***addClass*** - add a class to a target *Element*;
|
|
88
|
-
* ***removeClass*** - remove a class from a target *Element*;
|
|
89
|
-
* ***hasClass*** - checks the existence of a class for a target *Element*;
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
- **_addClass_** - add a class to a target _Element_;
|
|
93
|
+
- **_removeClass_** - remove a class from a target _Element_;
|
|
94
|
+
- **_hasClass_** - checks the existence of a class for a target _Element_;
|
|
95
|
+
|
|
96
|
+
```js
|
|
92
97
|
// EXAMPLES
|
|
93
|
-
import { addClass, removeClass, hasClass } from
|
|
98
|
+
import { addClass, removeClass, hasClass } from "@thednp/shorty";
|
|
94
99
|
|
|
95
100
|
// add a class
|
|
96
|
-
addClass(targetElement,
|
|
101
|
+
addClass(targetElement, "className");
|
|
97
102
|
|
|
98
103
|
// remove a class
|
|
99
|
-
removeClass(targetElement,
|
|
104
|
+
removeClass(targetElement, "className");
|
|
100
105
|
|
|
101
106
|
// check for a class
|
|
102
|
-
if (hasClass(targetElement,
|
|
107
|
+
if (hasClass(targetElement, "className")) {
|
|
103
108
|
// do something about that
|
|
104
109
|
}
|
|
105
110
|
```
|
|
106
111
|
|
|
107
112
|
# event
|
|
108
|
-
* ***on*** - attach an event listener to a specific target *Element*;
|
|
109
|
-
* ***off*** - detach an event listener from a specific target *Element*;
|
|
110
|
-
* ***one*** - attach an event listener to a specific target *Element*, and detach when complete;
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
- **_on_** - attach an event listener to a specific target _Element_;
|
|
115
|
+
- **_off_** - detach an event listener from a specific target _Element_;
|
|
116
|
+
- **_one_** - attach an event listener to a specific target _Element_, and detach when complete;
|
|
117
|
+
|
|
118
|
+
```js
|
|
113
119
|
// EXAMPLES
|
|
114
|
-
import { on, off, one, passiveHandler } from
|
|
120
|
+
import { on, off, one, passiveHandler } from "@thednp/shorty";
|
|
115
121
|
|
|
116
122
|
// attach a passive mousedown eventHandler
|
|
117
|
-
on(targetElement,
|
|
123
|
+
on(targetElement, "click", eventHandler, passiveHandler);
|
|
118
124
|
|
|
119
125
|
// detach a passive mouseup eventHandler
|
|
120
|
-
off(targetElement,
|
|
126
|
+
off(targetElement, "mouseup", eventHandler, passiveHandler);
|
|
121
127
|
|
|
122
128
|
// attach a single instance passive touchstart eventHandler
|
|
123
|
-
one(targetElement,
|
|
129
|
+
one(targetElement, "touchstart", eventHandler, passiveHandler);
|
|
124
130
|
```
|
|
125
131
|
|
|
126
|
-
For a more advanced method to handle event listeners, I recommend using the [event-listener
|
|
127
|
-
|
|
132
|
+
For a more advanced method to handle event listeners, I recommend using the [event-listener](github.com/thednp/event-listener).
|
|
128
133
|
|
|
129
134
|
# get
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
* ***getWindow*** - returns the containing `Window` for a given *Element* or just any *Window*;
|
|
149
|
-
|
|
150
|
-
```js
|
|
135
|
+
|
|
136
|
+
- **_getBoundingClientRect_** - returns the bounding client rectangle of a given _Element_;
|
|
137
|
+
- **_getDocument_** - returns the containing `#Document` for a given _Element_ or just any _Document_, useful when working with *iframe*s;
|
|
138
|
+
- **_getDocumentBody_** - returns the containing `<body>` for a given _Element_ or just any;
|
|
139
|
+
- **_getDocumentElement_** - returns the containing `<html>` for a given _Element_ or just any;
|
|
140
|
+
- **_getDocumentHead_** - returns the containing `<head>` for a given _Element_ or just any;
|
|
141
|
+
- **_getElementAnimationDelay_** - returns the `animationDelay` property of an `animation` property;
|
|
142
|
+
- **_getElementAnimationDuration_** - returns the `animationDuration` property of a `animation` property;
|
|
143
|
+
- **_getElementTransitionDelay_** - returns the `transitionDelay` property of a `transition` property;
|
|
144
|
+
- **_getElementTransitionDuration_** - returns the `transitionDuration` property of a `transition` property;
|
|
145
|
+
- **_getElementStyle_** - returns the _Element_ computed style for a given property;
|
|
146
|
+
- **_getNodeScroll_** - returns the _Element_ / _Window_ current `{ x, y }` scroll position;
|
|
147
|
+
- **_getParentNode_** - returns parent of a given _Element_;
|
|
148
|
+
- **_getRectRelativeToOffsetParent_** - returns the bounding client rectangle of a given _Element_ relative to a given `offsetParent`;
|
|
149
|
+
- **_getUID_** - a nice utility that creates a unique ID for a given _Element_ and returns it;
|
|
150
|
+
- **_getWindow_** - returns the containing `Window` for a given _Element_ or just any _Window_;
|
|
151
|
+
|
|
152
|
+
```js
|
|
151
153
|
// EXAMPLES
|
|
152
|
-
import {
|
|
153
|
-
getElementAnimationDuration,
|
|
154
|
-
getElementAnimationDurationLegacy,
|
|
155
|
-
} from '@thednp/shorty'
|
|
154
|
+
import { getElementAnimationDuration } from "@thednp/shorty";
|
|
156
155
|
|
|
157
156
|
// store the transition duration for target element on a modern browser
|
|
158
157
|
const duration = getElementAnimationDuration(target);
|
|
159
|
-
|
|
160
|
-
// or do the same with legacy browser fallback
|
|
161
|
-
const duration = getElementAnimationDurationLegacy(target);
|
|
162
158
|
```
|
|
163
159
|
|
|
164
160
|
# is
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
161
|
+
|
|
162
|
+
- **_isArray_** - check if a given value is an `Array`;
|
|
163
|
+
- **_isCustomElement_** - check if a given value is a `CustomElement` instance;
|
|
164
|
+
- **_isDocument_** - check if a given value is a `Document` instance;
|
|
165
|
+
- **_isElement_** - check if a given value is an `Element` instance;
|
|
166
|
+
- **_isElementInScrollRange_** - check if a given `Element` is partially visible in the viewport;
|
|
167
|
+
- **_isElementInViewport_** - check if a given `Element` is fully visible in the viewport;
|
|
168
|
+
- **_isElementsArray_** - check if a given value is an `Array` with `Element` instances;
|
|
169
|
+
- **_isFunction_** - check if a given value is a `Function` instance;
|
|
170
|
+
- **_isHTMLCollection_** - check if a given value is an `HTMLCollection` instance;
|
|
171
|
+
- **_isHTMLElement_** - check if a given value is an `HTMLElement` instance;
|
|
172
|
+
- **_isHTMLImageElement_** - check if a given value is an `HTMLImageElement` instance;
|
|
173
|
+
- **_isMedia_** - check if a given value is an `SVGElement`, `HTMLImageElement` or `HTMLVideoElement` instance;
|
|
174
|
+
- **_isNode_** - check if a given value is a `Node` instance;
|
|
175
|
+
- **_isNodeList_** - check if a given value is a `NodeList` instance;
|
|
176
|
+
- **_isNumber_** - check if a given value is string;
|
|
177
|
+
- **_isRTL_** - check if a given node is contained in a `<html dir="rtl">`;
|
|
178
|
+
- **_isScaledElement_** - check if a given _Element_ is affected by scale;
|
|
179
|
+
- **_isShadowRoot_** - check if a given _Node_ is a `ShadowRoot` instance;
|
|
180
|
+
- **_isString_** - check if a given value is string;
|
|
181
|
+
- **_isSVGElement_** - check if a given value is `SVGElement` instance;
|
|
182
|
+
- **_isTableElement_** - check if a given value is `<table>`, `<td>` or `<th>` _Element_;
|
|
183
|
+
- **_isWindow_** - check if a given value is a `Window` instance;
|
|
184
|
+
|
|
185
|
+
```js
|
|
189
186
|
// EXAMPLES
|
|
190
|
-
import { isArray,
|
|
187
|
+
import { isArray, isHTMLElement, isElementsArray } from "@thednp/shorty";
|
|
191
188
|
|
|
192
189
|
// check if a value is an `Array` of `Element` instances
|
|
193
190
|
if (isArray(myValue) && myValue.every(isHTMLElement)) {
|
|
@@ -201,40 +198,38 @@ if (isElementsArray(myValue)) {
|
|
|
201
198
|
```
|
|
202
199
|
|
|
203
200
|
# misc
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
201
|
+
|
|
202
|
+
- **_ArrayFrom_** - a shortie for `Array.from()` method;
|
|
203
|
+
- **_Data_** - a small utility to store web components data that makes use of the native `Map`;
|
|
204
|
+
- **_dispatchEvent_** - a shortie for `Element.dispatchEvent()` method;
|
|
205
|
+
- **_distinct_** - a shortie you can use to filter duplicate values in an `Array`;
|
|
206
|
+
- **_emulateAnimationEnd_** - utility to execute a callback function when `animationend` event is triggered, or execute the callback right after for legacy browsers;
|
|
207
|
+
- **_emulateAnimationEndLegacy_** - for legacy browsers;
|
|
208
|
+
- **_emulateTransitionEnd_** - utility to execute a callback function when `transitionend` event is triggered, or execute the callback right after for legacy browsers;
|
|
209
|
+
- **_emulateTransitionEndLegacy_** - for legacy browsers;
|
|
210
|
+
- **_Float32ArrayFrom_** - a shortie for `Float32Array.from()` method;
|
|
211
|
+
- **_Float64ArrayFrom_** - a shortie for `Float64Array.from()` method;
|
|
212
|
+
- **_focus_** - a shortie for `Element.focus()` method;
|
|
213
|
+
- **_noop_** - is your regular `() => {}` NOOP;
|
|
214
|
+
- **_normalizeOptions_** - a cool utility to normalize and crosscheck JavaScript options and their DATA API counterparts for various web components; supports namespaced options like `data-NAMESPACE-option="value"`; priority: JavaScript options > DATA API options > default options
|
|
215
|
+
- **_ObjectAssign_** - a shortie for `Object.assign()` method;
|
|
216
|
+
- **_ObjectEntries_** - a shortie for `Object.entries()` method;
|
|
217
|
+
- **_ObjectKeys_** - a shortie for `Object.keys()` method;
|
|
218
|
+
- **_ObjectValues_** - a shortie for `Object.values()` method;
|
|
219
|
+
- **_OriginalEvent_** - a small utility that returns a synthetic `CustomEvent` with the added `relatedTarget` and other properties;
|
|
220
|
+
- **_passiveHandler_** - a constant that preserves a standard listener `options` with `passive: true` event option used;
|
|
221
|
+
- **_passiveHandlerLegacy_** - for legacy browsers;
|
|
222
|
+
- **_reflow_** - a small utility that force repaint of a given _Element_ by "checking" its `offsetHeight` value, also because using just `element.offsetHeight;` won't validate on ESLint;
|
|
223
|
+
- **_setElementStyle_** - a small utility that allows you to set multiple CSS properties at once for a given _Element_ target;
|
|
224
|
+
- **_Timer_** - a small but powerful utility that makes `setTimeout` have a meaning;
|
|
225
|
+
- **_toLowerCase_** - a shortie for `String.toLowerCase()` method;
|
|
226
|
+
- **_toUpperCase_** - a shortie for `String.toUpperCase()` method;
|
|
227
|
+
|
|
228
|
+
The **_Data_** and **_Timer_** utilities have their own specifics, you might want to check the [wiki](https://github.com/thednp/shorty/wiki).
|
|
229
|
+
|
|
230
|
+
```js
|
|
233
231
|
// EXAMPLES
|
|
234
|
-
import {
|
|
235
|
-
emulateTransitionEnd,
|
|
236
|
-
distinct,
|
|
237
|
-
} from '@thednp/shorty';
|
|
232
|
+
import { emulateTransitionEnd, distinct } from "@thednp/shorty";
|
|
238
233
|
|
|
239
234
|
// execute a callback when transitionend is triggered for the target
|
|
240
235
|
emulateTransitionEnd(targetElement, callback);
|
|
@@ -249,60 +244,54 @@ const array3 = [...array1, ...array2].filter(distinct);
|
|
|
249
244
|
```
|
|
250
245
|
|
|
251
246
|
# selectors
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
247
|
+
|
|
248
|
+
- **_closest_** - a shortie for `Element.closest()` method;
|
|
249
|
+
- **_getCustomElements_** - returns an `Array` with all registered `CustomElement`;
|
|
250
|
+
- **_getElementById_** - a shortie for `document.getElementById()` method;
|
|
251
|
+
- **_getElementsByClassName_** - a shortie for `Element.getElementsByClassName()` method;
|
|
252
|
+
- **_getElementsByTagName_** - a shortie for `Element.getElementsByTagName()` method;
|
|
253
|
+
- **_matches_** - a shortie for `Element.matches()` method;
|
|
254
|
+
- **_matchesLegacy_** - for legacy browsers;
|
|
255
|
+
- **_querySelector_** - a simple utility to check if a given value is an _Element_ or a selector string, and if a selector string find the FIRST _Element_ and return it;
|
|
256
|
+
- **_querySelectorAll_** - a simple utility to check if a certain item is an _Element_ or a selector string, and if a selector string find the FIRST _Element_ and return it;
|
|
257
|
+
|
|
258
|
+
```js
|
|
263
259
|
// EXAMPLES
|
|
264
|
-
import { querySelector, querySelectorAll, documentAll, matches } from
|
|
260
|
+
import { querySelector, querySelectorAll, documentAll, matches } from "@thednp/shorty";
|
|
265
261
|
|
|
266
262
|
// get first element that matches a certain selector
|
|
267
|
-
const element = querySelector(
|
|
263
|
+
const element = querySelector(".my-class-name");
|
|
268
264
|
|
|
269
265
|
// get all elements that matches same selector
|
|
270
|
-
const elements = querySelectorAll(
|
|
266
|
+
const elements = querySelectorAll(".my-class-name");
|
|
271
267
|
|
|
272
268
|
// now do the same as the above, but differently
|
|
273
|
-
const elements = [...documentAll].filter((x) => matches(x,
|
|
269
|
+
const elements = [...documentAll].filter((x) => matches(x, ".my-class-name"));
|
|
274
270
|
```
|
|
275
271
|
|
|
276
272
|
# strings
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
* ***transitionDelayLegacy*** - for legacy browsers fallback;
|
|
294
|
-
* ***transitionEndEvent*** - preserves the `transitionend` event name for modern browsers;
|
|
295
|
-
* ***transitionEndEventLegacy*** - for legacy browsers fallback;
|
|
296
|
-
* ***transitionProperty*** - preserves the `transitionProperty` property name for modern browsers;
|
|
297
|
-
* ***transitionPropertyLegacy*** - for legacy browsers fallback;
|
|
298
|
-
* ***addEventListener*** - preserves the `addEventListener` method name;
|
|
299
|
-
* ***removeEventListener*** - preserves the `removeEventListener` method name;
|
|
273
|
+
|
|
274
|
+
- **_bezierEasings_** - an _Object_ comprised or a set of valid CSS `transition-timing-function` based on Cubic Bezier; EG: `cubic-bezier(0.215,0.61,0.355,1)` for `bezierEasings.easingCubicOut`;
|
|
275
|
+
- **_mouseSwipeEvents_** - preserves the pointer events from mouse actions: start: `mousedown`, end: `mouseup`, move: `mousemove`, cancel: `mouseout`;
|
|
276
|
+
- **_mouseClickEvents_** - preserves the pointer events from mouse actions: down: `mousedown`, up: `mouseup`;
|
|
277
|
+
- **_mouseHoverEvents_** - preserve browser specific mouse hover events: `mouseenter` and `mouseleave` OR `mouseover` and `mouseout`;
|
|
278
|
+
- **_touchEvents_** - preserves the pointer events from touch actions: start: `touchstart`, end: `touchend`, move: `touchmove`, cancel: `touchcancel`;
|
|
279
|
+
- **_animationDuration_** - preserves the `animationDuration` property for modern browsers;
|
|
280
|
+
- **_animationDelay_** - preserves the `animationDelay` property for modern browsers;
|
|
281
|
+
- **_animationEndEvent_** - preserves the `animationEndEvent` event for modern browsers;
|
|
282
|
+
- **_animationName_** - preserves the `animationName` property name for modern browsers;
|
|
283
|
+
- **_transitionDuration_** - preserves the `transitionDuration` property name for modern browsers;
|
|
284
|
+
- **_transitionDelay_** - preserves the `transitionDelay` property name for modern browsers;
|
|
285
|
+
- **_transitionEndEvent_** - preserves the `transitionend` event name for modern browsers;
|
|
286
|
+
- **_transitionProperty_** - preserves the `transitionProperty` property name for modern browsers;
|
|
287
|
+
- **_addEventListener_** - preserves the `addEventListener` method name;
|
|
288
|
+
- **_removeEventListener_** - preserves the `removeEventListener` method name;
|
|
300
289
|
|
|
301
290
|
There are lots more string constants available which include native event names, browser strings, keyboard key codes or ARIA specific attribute names. Be sure to check the `src/strings` folder for a complete list.
|
|
302
291
|
|
|
303
|
-
```js
|
|
292
|
+
```js
|
|
304
293
|
// EXAMPLES
|
|
305
|
-
import {on, off, one, mouseClickEvents, touchEvents, passiveHandler} from
|
|
294
|
+
import { on, off, one, mouseClickEvents, touchEvents, passiveHandler } from "@thednp/shorty";
|
|
306
295
|
|
|
307
296
|
// attach a passive mousedown eventHandler
|
|
308
297
|
on(targetElement, mouseClickEvents.down, eventHandler, passiveHandler);
|
|
@@ -315,32 +304,34 @@ one(targetElement, touchEvents.start, eventHandler, passiveHandler);
|
|
|
315
304
|
```
|
|
316
305
|
|
|
317
306
|
# Advanced Use
|
|
318
|
-
|
|
307
|
+
|
|
308
|
+
Here's a simple example to showcase the benefit of using **_shorty_**.
|
|
319
309
|
|
|
320
310
|
```js
|
|
321
311
|
// This is your typical day to day scripting
|
|
322
|
-
const target = document.getElementById(
|
|
312
|
+
const target = document.getElementById("my-element");
|
|
323
313
|
|
|
324
|
-
target.addEventListener(
|
|
325
|
-
target.classList.add(
|
|
326
|
-
})
|
|
314
|
+
target.addEventListener("click", function (e) {
|
|
315
|
+
target.classList.add("my-className");
|
|
316
|
+
});
|
|
327
317
|
```
|
|
328
318
|
|
|
329
319
|
Now make it all shorty. You might want to import shorties directly from their location, something we like to call "tree shaking".
|
|
320
|
+
|
|
330
321
|
```js
|
|
331
322
|
// Example
|
|
332
|
-
import on from
|
|
333
|
-
import addClass from
|
|
334
|
-
import getElementById from
|
|
335
|
-
import mouseclickEvent from
|
|
323
|
+
import on from "@thednp/shorty/src/event/on";
|
|
324
|
+
import addClass from "@thednp/shorty/src/class/addClass";
|
|
325
|
+
import getElementById from "@thednp/shorty/src/selectors/getElementById";
|
|
326
|
+
import mouseclickEvent from "@thednp/shorty/src/strings/mouseclickEvent";
|
|
336
327
|
|
|
337
|
-
const target = getElementById(
|
|
328
|
+
const target = getElementById("my-element");
|
|
338
329
|
|
|
339
|
-
on(target, mouseclickEvent, function(e) {
|
|
340
|
-
addClass(target,
|
|
341
|
-
})
|
|
330
|
+
on(target, mouseclickEvent, function (e) {
|
|
331
|
+
addClass(target, "my-className");
|
|
332
|
+
});
|
|
342
333
|
```
|
|
343
334
|
|
|
344
|
-
|
|
345
335
|
# License
|
|
336
|
+
|
|
346
337
|
**shorty** is released under the [MIT License](https://github.com/thednp/shorty/blob/master/LICENSE)
|