@thednp/shorty 2.0.7 → 2.0.8
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 +54 -26
- package/dist/shorty.cjs +1 -1
- package/dist/shorty.cjs.map +1 -1
- package/dist/shorty.d.ts +235 -138
- package/dist/shorty.js +1 -1
- package/dist/shorty.js.map +1 -1
- package/dist/shorty.mjs +536 -600
- package/dist/shorty.mjs.map +1 -1
- package/package.json +9 -8
- package/.eslintrc.cjs +0 -224
- package/.lgtm.yml +0 -8
- package/.prettierrc.json +0 -15
- package/src/attr/getAttribute.ts +0 -11
- package/src/attr/getAttributeNS.ts +0 -12
- package/src/attr/hasAttribute.ts +0 -11
- package/src/attr/hasAttributeNS.ts +0 -15
- package/src/attr/removeAttribute.ts +0 -10
- package/src/attr/removeAttributeNS.ts +0 -14
- package/src/attr/setAttribute.ts +0 -11
- package/src/attr/setAttributeNS.ts +0 -16
- package/src/blocks/documentBody.ts +0 -5
- package/src/blocks/documentElement.ts +0 -5
- package/src/blocks/documentHead.ts +0 -5
- package/src/boolean/isApple.ts +0 -15
- package/src/boolean/isFirefox.ts +0 -9
- package/src/boolean/isMobile.ts +0 -14
- package/src/boolean/support3DTransform.ts +0 -7
- package/src/boolean/supportAnimation.ts +0 -7
- package/src/boolean/supportPassive.ts +0 -29
- package/src/boolean/supportTouch.ts +0 -9
- package/src/boolean/supportTransform.ts +0 -7
- package/src/boolean/supportTransition.ts +0 -7
- package/src/class/addClass.ts +0 -11
- package/src/class/hasClass.ts +0 -11
- package/src/class/removeClass.ts +0 -11
- package/src/event/off.ts +0 -18
- package/src/event/on.ts +0 -18
- package/src/event/one.ts +0 -26
- package/src/get/getBoundingClientRect.ts +0 -44
- package/src/get/getDocument.ts +0 -24
- package/src/get/getDocumentBody.ts +0 -13
- package/src/get/getDocumentElement.ts +0 -13
- package/src/get/getDocumentHead.ts +0 -14
- package/src/get/getElementAnimationDelay.ts +0 -25
- package/src/get/getElementAnimationDuration.ts +0 -25
- package/src/get/getElementStyle.ts +0 -25
- package/src/get/getElementTransitionDelay.ts +0 -25
- package/src/get/getElementTransitionDuration.ts +0 -25
- package/src/get/getNodeScroll.ts +0 -22
- package/src/get/getParentNode.ts +0 -28
- package/src/get/getRectRelativeToOffsetParent.ts +0 -43
- package/src/get/getUID.ts +0 -42
- package/src/get/getWindow.ts +0 -23
- package/src/index.ts +0 -571
- package/src/interface/boundingClientRect.d.ts +0 -10
- package/src/interface/css4Declaration.d.ts +0 -4
- package/src/interface/customElement.d.ts +0 -8
- package/src/interface/event.d.ts +0 -255
- package/src/interface/fn.ts +0 -1
- package/src/interface/navigatorUA.d.ts +0 -15
- package/src/interface/offsetRect.d.ts +0 -6
- package/src/interface/originalEvent.d.ts +0 -4
- package/src/is/isArray.ts +0 -10
- package/src/is/isCanvas.ts +0 -13
- package/src/is/isCustomElement.ts +0 -15
- package/src/is/isDocument.ts +0 -14
- package/src/is/isElement.ts +0 -28
- package/src/is/isElementInScrollRange.ts +0 -20
- package/src/is/isElementInViewport.ts +0 -21
- package/src/is/isElementsArray.ts +0 -13
- package/src/is/isFunction.ts +0 -12
- package/src/is/isHTMLCollection.ts +0 -12
- package/src/is/isHTMLElement.ts +0 -13
- package/src/is/isHTMLImageElement.ts +0 -12
- package/src/is/isJSON.ts +0 -20
- package/src/is/isMap.ts +0 -11
- package/src/is/isMedia.ts +0 -26
- package/src/is/isNode.ts +0 -19
- package/src/is/isNodeList.ts +0 -13
- package/src/is/isNumber.ts +0 -10
- package/src/is/isObject.ts +0 -10
- package/src/is/isRTL.ts +0 -11
- package/src/is/isSVGElement.ts +0 -13
- package/src/is/isScaledElement.ts +0 -20
- package/src/is/isShadowRoot.ts +0 -12
- package/src/is/isString.ts +0 -10
- package/src/is/isTableElement.ts +0 -17
- package/src/is/isWeakMap.ts +0 -11
- package/src/is/isWindow.ts +0 -13
- package/src/misc/ArrayFrom.ts +0 -11
- package/src/misc/Float32ArrayFrom.ts +0 -11
- package/src/misc/Float64ArrayFrom.ts +0 -11
- package/src/misc/ObjectAssign.ts +0 -54
- package/src/misc/ObjectEntries.ts +0 -11
- package/src/misc/ObjectFromEntries.ts +0 -11
- package/src/misc/ObjectHasOwn.ts +0 -18
- package/src/misc/ObjectKeys.ts +0 -11
- package/src/misc/ObjectValues.ts +0 -12
- package/src/misc/createCustomEvent.ts +0 -31
- package/src/misc/createElement.ts +0 -36
- package/src/misc/createElementNS.ts +0 -40
- package/src/misc/data.ts +0 -80
- package/src/misc/dispatchEvent.ts +0 -10
- package/src/misc/distinct.ts +0 -19
- package/src/misc/emulateAnimationEnd.ts +0 -43
- package/src/misc/emulateTransitionEnd.ts +0 -42
- package/src/misc/focus.ts +0 -10
- package/src/misc/focusTrap.ts +0 -67
- package/src/misc/getInstance.ts +0 -9
- package/src/misc/noop.ts +0 -6
- package/src/misc/normalizeOptions.ts +0 -58
- package/src/misc/normalizeValue.ts +0 -32
- package/src/misc/passiveHandler.ts +0 -6
- package/src/misc/reflow.ts +0 -9
- package/src/misc/setElementStyle.ts +0 -26
- package/src/misc/timer.ts +0 -91
- package/src/misc/toLowerCase.ts +0 -9
- package/src/misc/toUpperCase.ts +0 -9
- package/src/selectors/closest.ts +0 -23
- package/src/selectors/getCustomElements.ts +0 -19
- package/src/selectors/getElementById.ts +0 -16
- package/src/selectors/getElementsByClassName.ts +0 -22
- package/src/selectors/getElementsByTagName.ts +0 -22
- package/src/selectors/matches.ts +0 -11
- package/src/selectors/querySelector.ts +0 -25
- package/src/selectors/querySelectorAll.ts +0 -19
- package/src/strings/DOMContentLoadedEvent.ts +0 -5
- package/src/strings/DOMMouseScrollEvent.ts +0 -5
- package/src/strings/abortEvent.ts +0 -5
- package/src/strings/addEventListener.ts +0 -5
- package/src/strings/animationDelay.ts +0 -5
- package/src/strings/animationDuration.ts +0 -5
- package/src/strings/animationEndEvent.ts +0 -5
- package/src/strings/animationName.ts +0 -5
- package/src/strings/ariaChecked.ts +0 -5
- package/src/strings/ariaDescribedBy.ts +0 -5
- package/src/strings/ariaDescription.ts +0 -5
- package/src/strings/ariaExpanded.ts +0 -5
- package/src/strings/ariaHasPopup.ts +0 -5
- package/src/strings/ariaHidden.ts +0 -5
- package/src/strings/ariaLabel.ts +0 -5
- package/src/strings/ariaLabelledBy.ts +0 -5
- package/src/strings/ariaModal.ts +0 -5
- package/src/strings/ariaPressed.ts +0 -5
- package/src/strings/ariaSelected.ts +0 -5
- package/src/strings/ariaValueMax.ts +0 -5
- package/src/strings/ariaValueMin.ts +0 -5
- package/src/strings/ariaValueNow.ts +0 -5
- package/src/strings/ariaValueText.ts +0 -5
- package/src/strings/beforeunloadEvent.ts +0 -5
- package/src/strings/bezierEasings.ts +0 -32
- package/src/strings/blurEvent.ts +0 -5
- package/src/strings/changeEvent.ts +0 -5
- package/src/strings/contextmenuEvent.ts +0 -5
- package/src/strings/dragEvent.ts +0 -5
- package/src/strings/dragendEvent.ts +0 -5
- package/src/strings/dragenterEvent.ts +0 -5
- package/src/strings/dragleaveEvent.ts +0 -5
- package/src/strings/dragoverEvent.ts +0 -5
- package/src/strings/dragstartEvent.ts +0 -5
- package/src/strings/errorEvent.ts +0 -5
- package/src/strings/focusEvent.ts +0 -5
- package/src/strings/focusEvents.ts +0 -5
- package/src/strings/focusableSelector.ts +0 -4
- package/src/strings/focusinEvent.ts +0 -5
- package/src/strings/focusoutEvent.ts +0 -5
- package/src/strings/gesturechangeEvent.ts +0 -5
- package/src/strings/gestureendEvent.ts +0 -5
- package/src/strings/gesturestartEvent.ts +0 -5
- package/src/strings/keyAlt.ts +0 -7
- package/src/strings/keyArrowDown.ts +0 -7
- package/src/strings/keyArrowLeft.ts +0 -7
- package/src/strings/keyArrowRight.ts +0 -7
- package/src/strings/keyArrowUp.ts +0 -7
- package/src/strings/keyBackspace.ts +0 -7
- package/src/strings/keyCapsLock.ts +0 -7
- package/src/strings/keyControl.ts +0 -7
- package/src/strings/keyDelete.ts +0 -7
- package/src/strings/keyEnter.ts +0 -7
- package/src/strings/keyEscape.ts +0 -7
- package/src/strings/keyInsert.ts +0 -7
- package/src/strings/keyMeta.ts +0 -7
- package/src/strings/keyNumpadEnter.ts +0 -7
- package/src/strings/keyPause.ts +0 -7
- package/src/strings/keyScrollLock.ts +0 -7
- package/src/strings/keyShift.ts +0 -7
- package/src/strings/keySpace.ts +0 -7
- package/src/strings/keyTab.ts +0 -7
- package/src/strings/keyboardEventKeys.ts +0 -26
- package/src/strings/keydownEvent.ts +0 -5
- package/src/strings/keypressEvent.ts +0 -5
- package/src/strings/keyupEvent.ts +0 -5
- package/src/strings/loadEvent.ts +0 -5
- package/src/strings/loadstartEvent.ts +0 -5
- package/src/strings/mouseClickEvents.ts +0 -5
- package/src/strings/mouseHoverEvents.ts +0 -7
- package/src/strings/mouseSwipeEvents.ts +0 -10
- package/src/strings/mouseclickEvent.ts +0 -5
- package/src/strings/mousedblclickEvent.ts +0 -5
- package/src/strings/mousedownEvent.ts +0 -5
- package/src/strings/mouseenterEvent.ts +0 -5
- package/src/strings/mousehoverEvent.ts +0 -5
- package/src/strings/mouseinEvent.ts +0 -5
- package/src/strings/mouseleaveEvent.ts +0 -5
- package/src/strings/mousemoveEvent.ts +0 -5
- package/src/strings/mouseoutEvent.ts +0 -5
- package/src/strings/mouseoverEvent.ts +0 -5
- package/src/strings/mouseupEvent.ts +0 -5
- package/src/strings/mousewheelEvent.ts +0 -5
- package/src/strings/moveEvent.ts +0 -5
- package/src/strings/nativeEvents.ts +0 -108
- package/src/strings/offsetHeight.ts +0 -5
- package/src/strings/offsetWidth.ts +0 -5
- package/src/strings/orientationchangeEvent.ts +0 -5
- package/src/strings/pointercancelEvent.ts +0 -5
- package/src/strings/pointerdownEvent.ts +0 -5
- package/src/strings/pointerleaveEvent.ts +0 -5
- package/src/strings/pointermoveEvent.ts +0 -5
- package/src/strings/pointerupEvent.ts +0 -5
- package/src/strings/readystatechangeEvent.ts +0 -5
- package/src/strings/removeEventListener.ts +0 -5
- package/src/strings/resetEvent.ts +0 -5
- package/src/strings/resizeEvent.ts +0 -5
- package/src/strings/scrollEvent.ts +0 -5
- package/src/strings/scrollHeight.ts +0 -5
- package/src/strings/scrollWidth.ts +0 -5
- package/src/strings/selectEvent.ts +0 -5
- package/src/strings/selectendEvent.ts +0 -5
- package/src/strings/selectstartEvent.ts +0 -5
- package/src/strings/submitEvent.ts +0 -5
- package/src/strings/tabindex.ts +0 -5
- package/src/strings/touchEvents.ts +0 -10
- package/src/strings/touchcancelEvent.ts +0 -5
- package/src/strings/touchendEvent.ts +0 -5
- package/src/strings/touchmoveEvent.ts +0 -5
- package/src/strings/touchstartEvent.ts +0 -5
- package/src/strings/transitionDelay.ts +0 -5
- package/src/strings/transitionDuration.ts +0 -5
- package/src/strings/transitionEndEvent.ts +0 -5
- package/src/strings/transitionProperty.ts +0 -5
- package/src/strings/unloadEvent.ts +0 -5
- package/src/strings/userAgent.ts +0 -7
- package/src/strings/userAgentData.ts +0 -8
- package/test/att.test.ts +0 -43
- package/test/boolean.test.ts +0 -30
- package/test/class.test.ts +0 -26
- package/test/event.test.ts +0 -39
- package/test/fixtures/custom-elem.js +0 -18
- package/test/fixtures/getExampleDom.ts +0 -52
- package/test/fixtures/style.css +0 -18
- package/test/get.test.ts +0 -150
- package/test/is.test.ts +0 -240
- package/test/misc.test.ts +0 -400
- package/test/selectors.test.ts +0 -90
- package/tsconfig.json +0 -36
- package/vite.config.mts +0 -45
- package/vitest.config-ui.mts +0 -26
- package/vitest.config.mts +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thednp/shorty",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "TypeScript shorties for the web",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./dist/shorty.js",
|
|
@@ -32,15 +32,16 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/thednp/shorty",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/node": "^20.17.
|
|
36
|
-
"@vitest/browser": "^2.1.
|
|
37
|
-
"@vitest/coverage-istanbul": "^2.1.
|
|
38
|
-
"@vitest/ui": "^2.1.
|
|
39
|
-
"playwright": "^1.
|
|
35
|
+
"@types/node": "^20.17.6",
|
|
36
|
+
"@vitest/browser": "^2.1.5",
|
|
37
|
+
"@vitest/coverage-istanbul": "^2.1.5",
|
|
38
|
+
"@vitest/ui": "^2.1.5",
|
|
39
|
+
"playwright": "^1.49.0",
|
|
40
40
|
"typescript": "^5.6.3",
|
|
41
|
-
"vite": "^5.4.
|
|
41
|
+
"vite": "^5.4.11",
|
|
42
42
|
"vite-plugin-dts": "^4.3.0",
|
|
43
|
-
"
|
|
43
|
+
"vite-plugin-strip-comments": "^0.0.3",
|
|
44
|
+
"vitest": "^2.1.5"
|
|
44
45
|
},
|
|
45
46
|
"engines": {
|
|
46
47
|
"node": ">=16",
|
package/.eslintrc.cjs
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es6": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"plugin:@typescript-eslint/recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
9
|
-
],
|
|
10
|
-
"parser": "@typescript-eslint/parser",
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"project": "tsconfig.json",
|
|
13
|
-
"sourceType": "module"
|
|
14
|
-
},
|
|
15
|
-
"plugins": [
|
|
16
|
-
"eslint-plugin-jsdoc",
|
|
17
|
-
"eslint-plugin-prefer-arrow",
|
|
18
|
-
// "eslint-plugin-react",
|
|
19
|
-
"@typescript-eslint",
|
|
20
|
-
"prettier"
|
|
21
|
-
],
|
|
22
|
-
"root": true,
|
|
23
|
-
"rules": {
|
|
24
|
-
"prettier/prettier": "error",
|
|
25
|
-
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
26
|
-
"@typescript-eslint/array-type": [
|
|
27
|
-
"error",
|
|
28
|
-
{
|
|
29
|
-
"default": "array"
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
"@typescript-eslint/ban-types": [
|
|
33
|
-
"error",
|
|
34
|
-
{
|
|
35
|
-
"types": {
|
|
36
|
-
"Object": {
|
|
37
|
-
"message": "Avoid using the `Object` type. Did you mean `object`?"
|
|
38
|
-
},
|
|
39
|
-
"Function": {
|
|
40
|
-
"message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
|
|
41
|
-
},
|
|
42
|
-
"Boolean": {
|
|
43
|
-
"message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
|
|
44
|
-
},
|
|
45
|
-
"Number": {
|
|
46
|
-
"message": "Avoid using the `Number` type. Did you mean `number`?"
|
|
47
|
-
},
|
|
48
|
-
"String": {
|
|
49
|
-
"message": "Avoid using the `String` type. Did you mean `string`?"
|
|
50
|
-
},
|
|
51
|
-
"Symbol": {
|
|
52
|
-
"message": "Avoid using the `Symbol` type. Did you mean `symbol`?"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
"@typescript-eslint/consistent-type-assertions": "error",
|
|
58
|
-
"@typescript-eslint/dot-notation": "error",
|
|
59
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
60
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
61
|
-
"@typescript-eslint/indent": "off",
|
|
62
|
-
"@typescript-eslint/member-delimiter-style": [
|
|
63
|
-
"off",
|
|
64
|
-
{
|
|
65
|
-
"multiline": {
|
|
66
|
-
"delimiter": "none",
|
|
67
|
-
"requireLast": true
|
|
68
|
-
},
|
|
69
|
-
"singleline": {
|
|
70
|
-
"delimiter": "semi",
|
|
71
|
-
"requireLast": false
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
"@typescript-eslint/naming-convention": "off", // error
|
|
76
|
-
"@typescript-eslint/no-empty-function": "error",
|
|
77
|
-
"@typescript-eslint/no-empty-interface": "error",
|
|
78
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
79
|
-
"@typescript-eslint/no-misused-new": "error",
|
|
80
|
-
"@typescript-eslint/no-namespace": "error",
|
|
81
|
-
"@typescript-eslint/no-parameter-properties": "off",
|
|
82
|
-
"@typescript-eslint/no-shadow": [
|
|
83
|
-
"error",
|
|
84
|
-
{
|
|
85
|
-
"hoist": "all"
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
"@typescript-eslint/no-unused-expressions": "error",
|
|
89
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
90
|
-
"@typescript-eslint/no-var-requires": "error",
|
|
91
|
-
"@typescript-eslint/prefer-for-of": "error",
|
|
92
|
-
"@typescript-eslint/prefer-function-type": "error",
|
|
93
|
-
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
94
|
-
"@typescript-eslint/quotes": "off",
|
|
95
|
-
"@typescript-eslint/semi": [
|
|
96
|
-
"off",
|
|
97
|
-
null
|
|
98
|
-
],
|
|
99
|
-
"@typescript-eslint/triple-slash-reference": [
|
|
100
|
-
"error",
|
|
101
|
-
{
|
|
102
|
-
"path": "always",
|
|
103
|
-
"types": "prefer-import",
|
|
104
|
-
"lib": "always"
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
"@typescript-eslint/type-annotation-spacing": "off",
|
|
108
|
-
"@typescript-eslint/typedef": "off",
|
|
109
|
-
"@typescript-eslint/unified-signatures": "error",
|
|
110
|
-
"arrow-parens": [
|
|
111
|
-
"off",
|
|
112
|
-
"always"
|
|
113
|
-
],
|
|
114
|
-
"brace-style": [
|
|
115
|
-
"off",
|
|
116
|
-
"off"
|
|
117
|
-
],
|
|
118
|
-
"comma-dangle": "off",
|
|
119
|
-
"complexity": "off",
|
|
120
|
-
"constructor-super": "error",
|
|
121
|
-
"dot-notation": "off",
|
|
122
|
-
"eol-last": "off",
|
|
123
|
-
"eqeqeq": [
|
|
124
|
-
"error",
|
|
125
|
-
"smart"
|
|
126
|
-
],
|
|
127
|
-
"guard-for-in": "error",
|
|
128
|
-
"id-denylist": [
|
|
129
|
-
"error",
|
|
130
|
-
"any",
|
|
131
|
-
"Number",
|
|
132
|
-
"number",
|
|
133
|
-
"String",
|
|
134
|
-
"string",
|
|
135
|
-
"Boolean",
|
|
136
|
-
"boolean",
|
|
137
|
-
"Undefined",
|
|
138
|
-
"undefined"
|
|
139
|
-
],
|
|
140
|
-
"id-match": "error",
|
|
141
|
-
"indent": "off",
|
|
142
|
-
"jsdoc/check-alignment": "error",
|
|
143
|
-
"jsdoc/check-indentation": "error",
|
|
144
|
-
// "jsdoc/newline-after-description": "error",
|
|
145
|
-
"linebreak-style": "off",
|
|
146
|
-
"max-classes-per-file": [
|
|
147
|
-
"error",
|
|
148
|
-
1
|
|
149
|
-
],
|
|
150
|
-
"max-len": "off",
|
|
151
|
-
"new-parens": "off",
|
|
152
|
-
"newline-per-chained-call": "off",
|
|
153
|
-
"no-bitwise": "error",
|
|
154
|
-
"no-caller": "error",
|
|
155
|
-
"no-cond-assign": "error",
|
|
156
|
-
"no-console": "error",
|
|
157
|
-
"no-debugger": "error",
|
|
158
|
-
"no-empty": "error",
|
|
159
|
-
"no-empty-function": "off",
|
|
160
|
-
"no-eval": "error",
|
|
161
|
-
"no-extra-semi": "off",
|
|
162
|
-
"no-fallthrough": "off",
|
|
163
|
-
"no-invalid-this": "off",
|
|
164
|
-
"no-irregular-whitespace": "off",
|
|
165
|
-
"no-multiple-empty-lines": "off",
|
|
166
|
-
"no-new-wrappers": "error",
|
|
167
|
-
"no-shadow": "off",
|
|
168
|
-
"no-throw-literal": "error",
|
|
169
|
-
"no-trailing-spaces": "off",
|
|
170
|
-
"no-undef-init": "error",
|
|
171
|
-
"no-underscore-dangle": "off",
|
|
172
|
-
"no-unsafe-finally": "error",
|
|
173
|
-
"no-unused-expressions": "off",
|
|
174
|
-
"no-unused-labels": "error",
|
|
175
|
-
"no-use-before-define": "off",
|
|
176
|
-
"no-var": "error",
|
|
177
|
-
"object-shorthand": "error",
|
|
178
|
-
"one-var": [
|
|
179
|
-
"error",
|
|
180
|
-
"never"
|
|
181
|
-
],
|
|
182
|
-
"padded-blocks": [
|
|
183
|
-
"off",
|
|
184
|
-
{
|
|
185
|
-
"blocks": "never"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"allowSingleLineBlocks": true
|
|
189
|
-
}
|
|
190
|
-
],
|
|
191
|
-
"prefer-arrow/prefer-arrow-functions": "error",
|
|
192
|
-
"prefer-const": "error",
|
|
193
|
-
"quote-props": "off",
|
|
194
|
-
"quotes": "off",
|
|
195
|
-
"radix": "error",
|
|
196
|
-
// "react/jsx-curly-spacing": "off",
|
|
197
|
-
// "react/jsx-equals-spacing": "off",
|
|
198
|
-
// "react/jsx-tag-spacing": [
|
|
199
|
-
// "off",
|
|
200
|
-
// {
|
|
201
|
-
// "afterOpening": "allow",
|
|
202
|
-
// "closingSlash": "allow"
|
|
203
|
-
// }
|
|
204
|
-
// ],
|
|
205
|
-
// "react/jsx-wrap-multilines": "off",
|
|
206
|
-
"semi": "off",
|
|
207
|
-
"space-before-function-paren": "off",
|
|
208
|
-
"space-in-parens": [
|
|
209
|
-
"off",
|
|
210
|
-
"never"
|
|
211
|
-
],
|
|
212
|
-
"spaced-comment": [
|
|
213
|
-
"error",
|
|
214
|
-
"always",
|
|
215
|
-
{
|
|
216
|
-
"markers": [
|
|
217
|
-
"/"
|
|
218
|
-
]
|
|
219
|
-
}
|
|
220
|
-
],
|
|
221
|
-
"use-isnan": "error",
|
|
222
|
-
"valid-typeof": "off"
|
|
223
|
-
}
|
|
224
|
-
};
|
package/.lgtm.yml
DELETED
package/.prettierrc.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"arrowParens": "avoid",
|
|
3
|
-
"bracketSpacing": true,
|
|
4
|
-
"endOfLine": "lf",
|
|
5
|
-
"bracketSameLine": false,
|
|
6
|
-
"jsxSingleQuote": false,
|
|
7
|
-
"printWidth": 100,
|
|
8
|
-
"proseWrap": "preserve",
|
|
9
|
-
"quoteProps": "as-needed",
|
|
10
|
-
"semi": true,
|
|
11
|
-
"singleQuote": true,
|
|
12
|
-
"tabWidth": 2,
|
|
13
|
-
"trailingComma": "all",
|
|
14
|
-
"useTabs": false
|
|
15
|
-
}
|
package/src/attr/getAttribute.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcut for `HTMLElement.getAttribute()` method.
|
|
3
|
-
*
|
|
4
|
-
* @param element target element
|
|
5
|
-
* @param att attribute name
|
|
6
|
-
* @returns attribute value
|
|
7
|
-
*/
|
|
8
|
-
const getAttribute = (element: HTMLElement, att: string): string | null =>
|
|
9
|
-
element.getAttribute(att);
|
|
10
|
-
|
|
11
|
-
export default getAttribute;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcut for `HTMLElement.getAttributeNS()` method.
|
|
3
|
-
*
|
|
4
|
-
* @param ns attribute namespace
|
|
5
|
-
* @param element target element
|
|
6
|
-
* @param att attribute name
|
|
7
|
-
* @returns attribute value
|
|
8
|
-
*/
|
|
9
|
-
const getAttributeNS = (ns: string, element: HTMLElement, att: string) =>
|
|
10
|
-
element.getAttributeNS(ns, att);
|
|
11
|
-
|
|
12
|
-
export default getAttributeNS;
|
package/src/attr/hasAttribute.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcut for `HTMLElement.hasAttribute()` method.
|
|
3
|
-
*
|
|
4
|
-
* @param element target element
|
|
5
|
-
* @param att attribute name
|
|
6
|
-
* @returns the query result
|
|
7
|
-
*/
|
|
8
|
-
const hasAttribute = (element: HTMLElement, att: string): boolean =>
|
|
9
|
-
element.hasAttribute(att);
|
|
10
|
-
|
|
11
|
-
export default hasAttribute;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcut for `HTMLElement.hasAttributeNS()` method.
|
|
3
|
-
*
|
|
4
|
-
* @param ns attribute namespace
|
|
5
|
-
* @param element target element
|
|
6
|
-
* @param att attribute name
|
|
7
|
-
* @returns the query result
|
|
8
|
-
*/
|
|
9
|
-
const hasAttributeNS = (
|
|
10
|
-
ns: string,
|
|
11
|
-
element: HTMLElement,
|
|
12
|
-
att: string,
|
|
13
|
-
): boolean => element.hasAttributeNS(ns, att);
|
|
14
|
-
|
|
15
|
-
export default hasAttributeNS;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcut for `HTMLElement.removeAttribute()` method.
|
|
3
|
-
*
|
|
4
|
-
* @param element target element
|
|
5
|
-
* @param att attribute name
|
|
6
|
-
*/
|
|
7
|
-
const removeAttribute = (element: HTMLElement, att: string): void =>
|
|
8
|
-
element.removeAttribute(att);
|
|
9
|
-
|
|
10
|
-
export default removeAttribute;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcut for `HTMLElement.removeAttributeNS()` method.
|
|
3
|
-
*
|
|
4
|
-
* @param ns attribute namespace
|
|
5
|
-
* @param element target element
|
|
6
|
-
* @param att attribute name
|
|
7
|
-
*/
|
|
8
|
-
const removeAttributeNS = (
|
|
9
|
-
ns: string,
|
|
10
|
-
element: HTMLElement,
|
|
11
|
-
att: string,
|
|
12
|
-
): void => element.removeAttributeNS(ns, att);
|
|
13
|
-
|
|
14
|
-
export default removeAttributeNS;
|
package/src/attr/setAttribute.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcut for `HTMLElement.setAttribute()` method.
|
|
3
|
-
*
|
|
4
|
-
* @param element target element
|
|
5
|
-
* @param att attribute name
|
|
6
|
-
* @param value attribute value
|
|
7
|
-
*/
|
|
8
|
-
const setAttribute = (element: HTMLElement, att: string, value: string) =>
|
|
9
|
-
element.setAttribute(att, value);
|
|
10
|
-
|
|
11
|
-
export default setAttribute;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcut for `SVGElement.setAttributeNS()` method.
|
|
3
|
-
*
|
|
4
|
-
* @param ns attribute namespace
|
|
5
|
-
* @param element target element
|
|
6
|
-
* @param att attribute name
|
|
7
|
-
* @param value attribute value
|
|
8
|
-
*/
|
|
9
|
-
const setAttributeNS = (
|
|
10
|
-
ns: string,
|
|
11
|
-
element: HTMLElement,
|
|
12
|
-
att: string,
|
|
13
|
-
value: string,
|
|
14
|
-
): void => element.setAttributeNS(ns, att, value);
|
|
15
|
-
|
|
16
|
-
export default setAttributeNS;
|
package/src/boolean/isApple.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { NavigatorUA } from "../interface/navigatorUA";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A global `boolean` getter for Apple browsers.
|
|
5
|
-
*/
|
|
6
|
-
const isApple = () => {
|
|
7
|
-
const appleBrands = /(iPhone|iPod|iPad)/;
|
|
8
|
-
return (navigator as NavigatorUA)?.userAgentData?.brands.some((x) =>
|
|
9
|
-
appleBrands.test(x.brand)
|
|
10
|
-
) || /* istanbul ignore next @preserve */
|
|
11
|
-
appleBrands.test(
|
|
12
|
-
navigator?.userAgent,
|
|
13
|
-
) || false;
|
|
14
|
-
};
|
|
15
|
-
export default isApple;
|
package/src/boolean/isFirefox.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A global boolean for Gecko browsers. When writing this file,
|
|
3
|
-
* Gecko was not supporting `userAgentData`.
|
|
4
|
-
*/
|
|
5
|
-
const isFirefox = () =>
|
|
6
|
-
navigator?.userAgent?.includes("Firefox") ||
|
|
7
|
-
/* istanbul ignore next @preserve */ false;
|
|
8
|
-
|
|
9
|
-
export default isFirefox;
|
package/src/boolean/isMobile.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { NavigatorUA } from "../interface/navigatorUA";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A global `boolean` for mobile detection.
|
|
5
|
-
*/
|
|
6
|
-
const isMobile = () => {
|
|
7
|
-
const mobileBrands = /iPhone|iPad|iPod|Android/i;
|
|
8
|
-
|
|
9
|
-
return (navigator as NavigatorUA)?.userAgentData?.brands.some((x) =>
|
|
10
|
-
mobileBrands.test(x.brand)
|
|
11
|
-
) ||
|
|
12
|
-
mobileBrands.test(navigator?.userAgent) || false;
|
|
13
|
-
};
|
|
14
|
-
export default isMobile;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import noop from "../misc/noop";
|
|
2
|
-
import one from "../event/one";
|
|
3
|
-
import DOMContentLoadedEvent from "../strings/DOMContentLoadedEvent";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A global `boolean` for passive events support,
|
|
7
|
-
* in general event options are not suited for scroll prevention.
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
|
|
10
|
-
*/
|
|
11
|
-
const supportPassive = () => {
|
|
12
|
-
let result = false;
|
|
13
|
-
try {
|
|
14
|
-
const opts = Object.defineProperty({}, "passive", {
|
|
15
|
-
get: () => {
|
|
16
|
-
result = true;
|
|
17
|
-
return result;
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
// istanbul ignore next @preserve
|
|
21
|
-
one(document, DOMContentLoadedEvent, noop, opts);
|
|
22
|
-
} catch (_e) {
|
|
23
|
-
// throw Error('Passive events are not supported');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default supportPassive;
|
package/src/class/addClass.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Add one or more CSS classes to `HTMLElement.classList`.
|
|
3
|
-
*
|
|
4
|
-
* @param element target
|
|
5
|
-
* @param classNAME to add
|
|
6
|
-
*/
|
|
7
|
-
const addClass = (element: HTMLElement, ...classNAME: string[]): void => {
|
|
8
|
-
element.classList.add(...classNAME);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default addClass;
|
package/src/class/hasClass.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check class in `HTMLElement.classList`.
|
|
3
|
-
*
|
|
4
|
-
* @param element target
|
|
5
|
-
* @param classNAME to check
|
|
6
|
-
*/
|
|
7
|
-
const hasClass = (element: HTMLElement, classNAME: string): boolean => {
|
|
8
|
-
return element.classList.contains(classNAME);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default hasClass;
|
package/src/class/removeClass.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove one or more classes from `HTMLElement.classList`.
|
|
3
|
-
*
|
|
4
|
-
* @param element target
|
|
5
|
-
* @param classNAME to remove
|
|
6
|
-
*/
|
|
7
|
-
const removeClass = (element: HTMLElement, ...classNAME: string[]): void => {
|
|
8
|
-
element.classList.remove(...classNAME);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default removeClass;
|
package/src/event/off.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove eventListener from an `EventTarget` object.
|
|
3
|
-
*/
|
|
4
|
-
const off = <T extends EventTarget, L = EventListener>(
|
|
5
|
-
element: T,
|
|
6
|
-
eventName: string,
|
|
7
|
-
listener: L,
|
|
8
|
-
options?: AddEventListenerOptions,
|
|
9
|
-
) => {
|
|
10
|
-
const ops = options || false;
|
|
11
|
-
element.removeEventListener(
|
|
12
|
-
eventName,
|
|
13
|
-
listener as EventListenerOrEventListenerObject,
|
|
14
|
-
ops,
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default off;
|
package/src/event/on.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Add eventListener to an `EventTarget` object.
|
|
3
|
-
*/
|
|
4
|
-
const on = <T extends EventTarget, L = EventListener>(
|
|
5
|
-
element: T,
|
|
6
|
-
eventName: string,
|
|
7
|
-
listener: L,
|
|
8
|
-
options?: AddEventListenerOptions,
|
|
9
|
-
) => {
|
|
10
|
-
const ops = options || false;
|
|
11
|
-
element.addEventListener(
|
|
12
|
-
eventName,
|
|
13
|
-
listener as EventListenerOrEventListenerObject,
|
|
14
|
-
ops,
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default on;
|
package/src/event/one.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import on from "./on";
|
|
2
|
-
import off from "./off";
|
|
3
|
-
import { NativeEventHandler } from "../interface/event";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Add an `eventListener` to an `EventTarget`
|
|
7
|
-
* element and remove it once callback is called.
|
|
8
|
-
*/
|
|
9
|
-
const one = <T extends EventTarget, L = EventListener>(
|
|
10
|
-
element: T,
|
|
11
|
-
eventName: string,
|
|
12
|
-
listener: L,
|
|
13
|
-
options?: AddEventListenerOptions,
|
|
14
|
-
) => {
|
|
15
|
-
/** Wrap the listener for easy on -> off */
|
|
16
|
-
const handlerWrapper: NativeEventHandler<T> = (e) => {
|
|
17
|
-
// istanbul ignore else @preserve
|
|
18
|
-
if (e.target === element || e.currentTarget === element) {
|
|
19
|
-
(listener as NativeEventHandler<T>).apply(element, [e]);
|
|
20
|
-
off(element, eventName, handlerWrapper, options);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
on(element, eventName, handlerWrapper, options);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default one;
|