@thednp/shorty 2.0.0-alpha16 → 2.0.0-alpha18
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/.eslintrc.cjs +0 -0
- package/.lgtm.yml +0 -0
- package/.prettierrc.json +0 -0
- package/LICENSE +0 -0
- package/README.md +4 -4
- package/cypress/e2e/att.cy.ts +0 -0
- package/cypress/e2e/boolean.cy.ts +0 -0
- package/cypress/e2e/class.cy.ts +0 -0
- package/cypress/e2e/event.cy.ts +0 -0
- package/cypress/e2e/get.cy.ts +0 -0
- package/cypress/e2e/is.cy.ts +0 -0
- package/cypress/e2e/misc.cy.ts +0 -0
- package/cypress/e2e/selectors.cy.ts +0 -0
- package/cypress/fixtures/custom-elem.js +0 -0
- package/cypress/plugins/esbuild-istanbul.ts +0 -0
- package/cypress/plugins/tsCompile.ts +0 -0
- package/cypress/support/commands.ts +0 -0
- package/cypress/support/e2e.ts +0 -0
- package/cypress/support/index.js +0 -0
- package/cypress/test.html +0 -0
- package/cypress.config.ts +0 -0
- package/dist/shorty.cjs +1 -1
- package/dist/shorty.cjs.map +1 -1
- package/dist/shorty.d.ts +200 -4
- package/dist/shorty.js +1 -1
- package/dist/shorty.js.map +1 -1
- package/dist/shorty.mjs +191 -179
- package/dist/shorty.mjs.map +1 -1
- package/dts.config.ts +0 -0
- package/package.json +71 -66
- package/src/attr/getAttribute.ts +0 -0
- package/src/attr/getAttributeNS.ts +0 -0
- package/src/attr/hasAttribute.ts +0 -0
- package/src/attr/hasAttributeNS.ts +0 -0
- package/src/attr/removeAttribute.ts +0 -0
- package/src/attr/removeAttributeNS.ts +0 -0
- package/src/attr/setAttribute.ts +0 -0
- package/src/attr/setAttributeNS.ts +0 -0
- package/src/blocks/documentBody.ts +0 -0
- package/src/blocks/documentElement.ts +0 -0
- package/src/blocks/documentHead.ts +0 -0
- package/src/boolean/isApple.ts +0 -0
- package/src/boolean/isFirefox.ts +0 -0
- package/src/boolean/isMobile.ts +0 -0
- package/src/boolean/support3DTransform.ts +0 -0
- package/src/boolean/supportAnimation.ts +0 -0
- package/src/boolean/supportPassive.ts +0 -0
- package/src/boolean/supportTouch.ts +0 -0
- package/src/boolean/supportTransform.ts +0 -0
- package/src/boolean/supportTransition.ts +0 -0
- package/src/class/addClass.ts +0 -0
- package/src/class/hasClass.ts +0 -0
- package/src/class/removeClass.ts +0 -0
- package/src/event/off.ts +6 -4
- package/src/event/on.ts +6 -4
- package/src/event/one.ts +26 -8
- package/src/get/getBoundingClientRect.ts +0 -0
- package/src/get/getDocument.ts +0 -0
- package/src/get/getDocumentBody.ts +0 -0
- package/src/get/getDocumentElement.ts +0 -0
- package/src/get/getDocumentHead.ts +0 -0
- package/src/get/getElementAnimationDelay.ts +0 -0
- package/src/get/getElementAnimationDuration.ts +0 -0
- package/src/get/getElementStyle.ts +0 -0
- package/src/get/getElementTransitionDelay.ts +0 -0
- package/src/get/getElementTransitionDuration.ts +0 -0
- package/src/get/getNodeScroll.ts +0 -0
- package/src/get/getParentNode.ts +0 -0
- package/src/get/getRectRelativeToOffsetParent.ts +0 -0
- package/src/get/getUID.ts +0 -0
- package/src/get/getWindow.ts +0 -0
- package/src/index.ts +4 -0
- package/src/interface/boundingClientRect.d.ts +0 -0
- package/src/interface/css4Declaration.d.ts +0 -0
- package/src/interface/customElement.d.ts +0 -0
- package/src/interface/event.d.ts +337 -0
- package/src/interface/navigatorUA.d.ts +0 -0
- package/src/interface/offsetRect.d.ts +0 -0
- package/src/interface/originalEvent.d.ts +0 -0
- package/src/is/isArray.ts +0 -0
- package/src/is/isCanvas.ts +0 -0
- package/src/is/isCustomElement.ts +0 -0
- package/src/is/isDocument.ts +0 -0
- package/src/is/isElement.ts +0 -0
- package/src/is/isElementInScrollRange.ts +0 -0
- package/src/is/isElementInViewport.ts +0 -0
- package/src/is/isElementsArray.ts +0 -0
- package/src/is/isFunction.ts +0 -0
- package/src/is/isHTMLCollection.ts +0 -0
- package/src/is/isHTMLElement.ts +0 -0
- package/src/is/isHTMLImageElement.ts +0 -0
- package/src/is/isJSON.ts +0 -0
- package/src/is/isMap.ts +0 -0
- package/src/is/isMedia.ts +0 -0
- package/src/is/isNode.ts +0 -0
- package/src/is/isNodeList.ts +0 -0
- package/src/is/isNumber.ts +0 -0
- package/src/is/isObject.ts +0 -0
- package/src/is/isRTL.ts +0 -0
- package/src/is/isSVGElement.ts +0 -0
- package/src/is/isScaledElement.ts +0 -0
- package/src/is/isShadowRoot.ts +0 -0
- package/src/is/isString.ts +0 -0
- package/src/is/isTableElement.ts +0 -0
- package/src/is/isWeakMap.ts +0 -0
- package/src/is/isWindow.ts +0 -0
- package/src/misc/ArrayFrom.ts +0 -0
- package/src/misc/Float32ArrayFrom.ts +0 -0
- package/src/misc/Float64ArrayFrom.ts +0 -0
- package/src/misc/ObjectAssign.ts +0 -0
- package/src/misc/ObjectEntries.ts +0 -0
- package/src/misc/ObjectFromEntries.ts +11 -0
- package/src/misc/ObjectHasOwn.ts +0 -0
- package/src/misc/ObjectKeys.ts +0 -0
- package/src/misc/ObjectValues.ts +0 -0
- package/src/misc/createCustomEvent.ts +0 -0
- package/src/misc/createElement.ts +0 -0
- package/src/misc/createElementNS.ts +0 -0
- package/src/misc/data.ts +0 -0
- package/src/misc/dispatchEvent.ts +0 -0
- package/src/misc/distinct.ts +0 -0
- package/src/misc/emulateAnimationEnd.ts +0 -0
- package/src/misc/emulateTransitionEnd.ts +0 -0
- package/src/misc/focus.ts +0 -0
- package/src/misc/getInstance.ts +0 -0
- package/src/misc/noop.ts +0 -0
- package/src/misc/normalizeOptions.ts +0 -0
- package/src/misc/normalizeValue.ts +0 -0
- package/src/misc/passiveHandler.ts +0 -0
- package/src/misc/reflow.ts +0 -0
- package/src/misc/setElementStyle.ts +0 -0
- package/src/misc/timer.ts +0 -0
- package/src/misc/toLowerCase.ts +0 -0
- package/src/misc/toUpperCase.ts +0 -0
- package/src/selectors/closest.ts +0 -0
- package/src/selectors/getCustomElements.ts +0 -0
- package/src/selectors/getElementById.ts +0 -0
- package/src/selectors/getElementsByClassName.ts +0 -0
- package/src/selectors/getElementsByTagName.ts +0 -0
- package/src/selectors/matches.ts +0 -0
- package/src/selectors/querySelector.ts +0 -0
- package/src/selectors/querySelectorAll.ts +0 -0
- package/src/strings/DOMContentLoadedEvent.ts +0 -0
- package/src/strings/DOMMouseScrollEvent.ts +0 -0
- package/src/strings/abortEvent.ts +0 -0
- package/src/strings/addEventListener.ts +0 -0
- package/src/strings/animationDelay.ts +0 -0
- package/src/strings/animationDuration.ts +0 -0
- package/src/strings/animationEndEvent.ts +0 -0
- package/src/strings/animationName.ts +0 -0
- package/src/strings/ariaChecked.ts +0 -0
- package/src/strings/ariaDescribedBy.ts +0 -0
- package/src/strings/ariaDescription.ts +0 -0
- package/src/strings/ariaExpanded.ts +0 -0
- package/src/strings/ariaHasPopup.ts +0 -0
- package/src/strings/ariaHidden.ts +0 -0
- package/src/strings/ariaLabel.ts +0 -0
- package/src/strings/ariaLabelledBy.ts +0 -0
- package/src/strings/ariaModal.ts +0 -0
- package/src/strings/ariaPressed.ts +0 -0
- package/src/strings/ariaSelected.ts +0 -0
- package/src/strings/ariaValueMax.ts +0 -0
- package/src/strings/ariaValueMin.ts +0 -0
- package/src/strings/ariaValueNow.ts +0 -0
- package/src/strings/ariaValueText.ts +0 -0
- package/src/strings/beforeunloadEvent.ts +0 -0
- package/src/strings/bezierEasings.ts +0 -0
- package/src/strings/blurEvent.ts +0 -0
- package/src/strings/changeEvent.ts +0 -0
- package/src/strings/contextmenuEvent.ts +0 -0
- package/src/strings/dragEvent.ts +0 -0
- package/src/strings/dragendEvent.ts +0 -0
- package/src/strings/dragenterEvent.ts +0 -0
- package/src/strings/dragleaveEvent.ts +0 -0
- package/src/strings/dragoverEvent.ts +0 -0
- package/src/strings/dragstartEvent.ts +0 -0
- package/src/strings/errorEvent.ts +0 -0
- package/src/strings/focusEvent.ts +0 -0
- package/src/strings/focusEvents.ts +0 -0
- package/src/strings/focusinEvent.ts +0 -0
- package/src/strings/focusoutEvent.ts +0 -0
- package/src/strings/gesturechangeEvent.ts +0 -0
- package/src/strings/gestureendEvent.ts +0 -0
- package/src/strings/gesturestartEvent.ts +0 -0
- package/src/strings/keyAlt.ts +0 -0
- package/src/strings/keyArrowDown.ts +0 -0
- package/src/strings/keyArrowLeft.ts +0 -0
- package/src/strings/keyArrowRight.ts +0 -0
- package/src/strings/keyArrowUp.ts +0 -0
- package/src/strings/keyBackspace.ts +0 -0
- package/src/strings/keyCapsLock.ts +0 -0
- package/src/strings/keyControl.ts +0 -0
- package/src/strings/keyDelete.ts +0 -0
- package/src/strings/keyEnter.ts +0 -0
- package/src/strings/keyEscape.ts +0 -0
- package/src/strings/keyInsert.ts +0 -0
- package/src/strings/keyMeta.ts +0 -0
- package/src/strings/keyNumpadEnter.ts +7 -0
- package/src/strings/keyPause.ts +0 -0
- package/src/strings/keyScrollLock.ts +0 -0
- package/src/strings/keyShift.ts +0 -0
- package/src/strings/keySpace.ts +0 -0
- package/src/strings/keyTab.ts +0 -0
- package/src/strings/keyboardEventKeys.ts +0 -0
- package/src/strings/keydownEvent.ts +0 -0
- package/src/strings/keypressEvent.ts +0 -0
- package/src/strings/keyupEvent.ts +0 -0
- package/src/strings/loadEvent.ts +0 -0
- package/src/strings/loadstartEvent.ts +0 -0
- package/src/strings/mouseClickEvents.ts +0 -0
- package/src/strings/mouseHoverEvents.ts +0 -0
- package/src/strings/mouseSwipeEvents.ts +0 -0
- package/src/strings/mouseclickEvent.ts +0 -0
- package/src/strings/mousedblclickEvent.ts +0 -0
- package/src/strings/mousedownEvent.ts +0 -0
- package/src/strings/mouseenterEvent.ts +0 -0
- package/src/strings/mousehoverEvent.ts +0 -0
- package/src/strings/mouseinEvent.ts +0 -0
- package/src/strings/mouseleaveEvent.ts +0 -0
- package/src/strings/mousemoveEvent.ts +0 -0
- package/src/strings/mouseoutEvent.ts +0 -0
- package/src/strings/mouseoverEvent.ts +0 -0
- package/src/strings/mouseupEvent.ts +0 -0
- package/src/strings/mousewheelEvent.ts +0 -0
- package/src/strings/moveEvent.ts +0 -0
- package/src/strings/nativeEvents.ts +0 -0
- package/src/strings/offsetHeight.ts +0 -0
- package/src/strings/offsetWidth.ts +0 -0
- package/src/strings/orientationchangeEvent.ts +0 -0
- package/src/strings/pointercancelEvent.ts +0 -0
- package/src/strings/pointerdownEvent.ts +0 -0
- package/src/strings/pointerleaveEvent.ts +0 -0
- package/src/strings/pointermoveEvent.ts +0 -0
- package/src/strings/pointerupEvent.ts +0 -0
- package/src/strings/readystatechangeEvent.ts +0 -0
- package/src/strings/removeEventListener.ts +0 -0
- package/src/strings/resetEvent.ts +0 -0
- package/src/strings/resizeEvent.ts +0 -0
- package/src/strings/scrollEvent.ts +0 -0
- package/src/strings/scrollHeight.ts +0 -0
- package/src/strings/scrollWidth.ts +0 -0
- package/src/strings/selectEvent.ts +0 -0
- package/src/strings/selectendEvent.ts +0 -0
- package/src/strings/selectstartEvent.ts +0 -0
- package/src/strings/submitEvent.ts +0 -0
- package/src/strings/tabindex.ts +0 -0
- package/src/strings/touchEvents.ts +0 -0
- package/src/strings/touchcancelEvent.ts +0 -0
- package/src/strings/touchendEvent.ts +0 -0
- package/src/strings/touchmoveEvent.ts +0 -0
- package/src/strings/touchstartEvent.ts +0 -0
- package/src/strings/transitionDelay.ts +0 -0
- package/src/strings/transitionDuration.ts +0 -0
- package/src/strings/transitionEndEvent.ts +0 -0
- package/src/strings/transitionProperty.ts +0 -0
- package/src/strings/unloadEvent.ts +0 -0
- package/src/strings/userAgent.ts +0 -0
- package/src/strings/userAgentData.ts +0 -0
- package/tsconfig.json +1 -1
- package/vite.config.ts +0 -0
package/dts.config.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,66 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@thednp/shorty",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "TypeScript shorties for the web",
|
|
5
|
-
"source": "./src/index.ts",
|
|
6
|
-
"main": "./dist/shorty.js",
|
|
7
|
-
"module": "./dist/shorty.mjs",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/shorty.d.ts",
|
|
11
|
-
"require": "./dist/shorty.cjs",
|
|
12
|
-
"import": "./dist/shorty.mjs"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"typescript"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@thednp/shorty",
|
|
3
|
+
"version": "2.0.0alpha18",
|
|
4
|
+
"description": "TypeScript shorties for the web",
|
|
5
|
+
"source": "./src/index.ts",
|
|
6
|
+
"main": "./dist/shorty.js",
|
|
7
|
+
"module": "./dist/shorty.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/shorty.d.ts",
|
|
11
|
+
"require": "./dist/shorty.cjs",
|
|
12
|
+
"import": "./dist/shorty.mjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/thednp/shorty.git"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"shorty",
|
|
25
|
+
"javascript",
|
|
26
|
+
"typescript"
|
|
27
|
+
],
|
|
28
|
+
"author": "thednp",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/thednp/shorty/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/thednp/shorty",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
|
|
36
|
+
"@cypress/code-coverage": "^3.12.0",
|
|
37
|
+
"@types/istanbul-lib-instrument": "^1.7.4",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
39
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
40
|
+
"cypress": "^12.17.4",
|
|
41
|
+
"dts-bundle-generator": "^8.0.1",
|
|
42
|
+
"eslint": "^8.48.0",
|
|
43
|
+
"eslint-plugin-jsdoc": "^46.5.1",
|
|
44
|
+
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
45
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
46
|
+
"istanbul-lib-coverage": "^3.2.0",
|
|
47
|
+
"istanbul-lib-instrument": "^5.2.1",
|
|
48
|
+
"nyc": "^15.1.0",
|
|
49
|
+
"prettier": "^2.8.8",
|
|
50
|
+
"rimraf": "^5.0.1",
|
|
51
|
+
"typescript": "^5.2.2",
|
|
52
|
+
"vite": "^4.4.9"
|
|
53
|
+
},
|
|
54
|
+
"packageManager": "pnpm@8.6.12",
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=16",
|
|
57
|
+
"pnpm": ">=8.6.0"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"pre-test": "pnpm clean-coverage",
|
|
61
|
+
"test": "pnpm pre-test && npx cypress run",
|
|
62
|
+
"clean-coverage": "rimraf coverage .nyc_output",
|
|
63
|
+
"cypress": "pnpm pre-test && npx cypress open",
|
|
64
|
+
"coverage:report": "nyc report --reporter=lcov --reporter=json --reporter=text --reporter=json-summary",
|
|
65
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
66
|
+
"lint:ts": "eslint -c .eslintrc.cjs --ext .ts src",
|
|
67
|
+
"fix:ts": "eslint -c .eslintrc.cjs --ext .ts src --fix",
|
|
68
|
+
"build": "pnpm lint:ts && vite build && pnpm dts",
|
|
69
|
+
"dts": "dts-bundle-generator --config ./dts.config.ts"
|
|
70
|
+
}
|
|
71
|
+
}
|
package/src/attr/getAttribute.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/src/attr/hasAttribute.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/attr/setAttribute.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/boolean/isApple.ts
CHANGED
|
File without changes
|
package/src/boolean/isFirefox.ts
CHANGED
|
File without changes
|
package/src/boolean/isMobile.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/class/addClass.ts
CHANGED
|
File without changes
|
package/src/class/hasClass.ts
CHANGED
|
File without changes
|
package/src/class/removeClass.ts
CHANGED
|
File without changes
|
package/src/event/off.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { NativeEventTypes, PossibleEventTarget, SupportedEventHandler } from '../interface/event';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Remove eventListener from an `EventTarget` object.
|
|
3
5
|
*/
|
|
4
|
-
const off = (
|
|
5
|
-
element:
|
|
6
|
-
eventName:
|
|
7
|
-
listener:
|
|
6
|
+
const off = <T extends PossibleEventTarget>(
|
|
7
|
+
element: T,
|
|
8
|
+
eventName: NativeEventTypes,
|
|
9
|
+
listener: EventListenerObject & SupportedEventHandler<T>,
|
|
8
10
|
options?: AddEventListenerOptions,
|
|
9
11
|
) => {
|
|
10
12
|
const ops = options || false;
|
package/src/event/on.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { NativeEventTypes, PossibleEventTarget, SupportedEventHandler } from '../interface/event';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Add eventListener to an `EventTarget` object.
|
|
3
5
|
*/
|
|
4
|
-
const on = (
|
|
5
|
-
element:
|
|
6
|
-
eventName:
|
|
7
|
-
listener:
|
|
6
|
+
const on = <T extends PossibleEventTarget>(
|
|
7
|
+
element: T,
|
|
8
|
+
eventName: NativeEventTypes,
|
|
9
|
+
listener: EventListenerObject & SupportedEventHandler<T>,
|
|
8
10
|
options?: AddEventListenerOptions,
|
|
9
11
|
) => {
|
|
10
12
|
const ops = options || false;
|
package/src/event/one.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EventHandler,
|
|
3
|
+
NativeEvent,
|
|
4
|
+
NativeEventTypes,
|
|
5
|
+
PossibleEventTarget,
|
|
6
|
+
SupportedEventHandler,
|
|
7
|
+
} from '../interface/event';
|
|
8
|
+
|
|
1
9
|
import on from './on';
|
|
2
10
|
import off from './off';
|
|
3
11
|
|
|
@@ -5,21 +13,31 @@ import off from './off';
|
|
|
5
13
|
* Add an `eventListener` to an `EventTarget`
|
|
6
14
|
* element and remove it once callback is called.
|
|
7
15
|
*/
|
|
8
|
-
const one = (
|
|
9
|
-
element:
|
|
10
|
-
eventName:
|
|
11
|
-
listener:
|
|
16
|
+
const one = <T extends PossibleEventTarget>(
|
|
17
|
+
element: T,
|
|
18
|
+
eventName: NativeEventTypes,
|
|
19
|
+
listener: SupportedEventHandler<T>,
|
|
12
20
|
options?: AddEventListenerOptions,
|
|
13
21
|
) => {
|
|
14
22
|
/** Wrap the listener for easy on -> off */
|
|
15
|
-
const handlerWrapper = (e:
|
|
23
|
+
const handlerWrapper = (e: NativeEvent): void => {
|
|
16
24
|
/* istanbul ignore else */
|
|
17
25
|
if (e.target === element || e.currentTarget === element) {
|
|
18
|
-
listener.apply(element, [e]);
|
|
19
|
-
off(
|
|
26
|
+
(listener as EventHandler<typeof e>).apply(element, [e]);
|
|
27
|
+
off(
|
|
28
|
+
element,
|
|
29
|
+
eventName,
|
|
30
|
+
handlerWrapper as unknown as EventListenerObject & SupportedEventHandler<T>,
|
|
31
|
+
options,
|
|
32
|
+
);
|
|
20
33
|
}
|
|
21
34
|
};
|
|
22
|
-
on(
|
|
35
|
+
on(
|
|
36
|
+
element,
|
|
37
|
+
eventName,
|
|
38
|
+
handlerWrapper as unknown as EventListenerObject & SupportedEventHandler<T>,
|
|
39
|
+
options,
|
|
40
|
+
);
|
|
23
41
|
};
|
|
24
42
|
|
|
25
43
|
export default one;
|
|
File without changes
|
package/src/get/getDocument.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/get/getNodeScroll.ts
CHANGED
|
File without changes
|
package/src/get/getParentNode.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/src/get/getUID.ts
CHANGED
|
File without changes
|
package/src/get/getWindow.ts
CHANGED
|
File without changes
|
package/src/index.ts
CHANGED
|
@@ -96,6 +96,7 @@ import keyCapsLock from './strings/keyCapsLock';
|
|
|
96
96
|
import keyControl from './strings/keyControl';
|
|
97
97
|
import keyDelete from './strings/keyDelete';
|
|
98
98
|
import keyEnter from './strings/keyEnter';
|
|
99
|
+
import keyNumpadEnter from './strings/keyNumpadEnter';
|
|
99
100
|
import keyEscape from './strings/keyEscape';
|
|
100
101
|
import keyInsert from './strings/keyInsert';
|
|
101
102
|
import keyMeta from './strings/keyMeta';
|
|
@@ -185,6 +186,7 @@ import ObjectEntries from './misc/ObjectEntries';
|
|
|
185
186
|
import ObjectHasOwn from './misc/ObjectHasOwn';
|
|
186
187
|
import ObjectKeys from './misc/ObjectKeys';
|
|
187
188
|
import ObjectValues from './misc/ObjectValues';
|
|
189
|
+
import ObjectFromEntries from './misc/ObjectFromEntries';
|
|
188
190
|
import createCustomEvent from './misc/createCustomEvent';
|
|
189
191
|
import passiveHandler from './misc/passiveHandler';
|
|
190
192
|
import reflow from './misc/reflow';
|
|
@@ -361,6 +363,7 @@ export {
|
|
|
361
363
|
keyControl,
|
|
362
364
|
keyDelete,
|
|
363
365
|
keyEnter,
|
|
366
|
+
keyNumpadEnter,
|
|
364
367
|
keyEscape,
|
|
365
368
|
keyInsert,
|
|
366
369
|
keyMeta,
|
|
@@ -455,6 +458,7 @@ export {
|
|
|
455
458
|
ObjectEntries,
|
|
456
459
|
ObjectKeys,
|
|
457
460
|
ObjectValues,
|
|
461
|
+
ObjectFromEntries,
|
|
458
462
|
getBoundingClientRect,
|
|
459
463
|
getDocument,
|
|
460
464
|
getDocumentBody,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|