@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.
Files changed (258) hide show
  1. package/README.md +54 -26
  2. package/dist/shorty.cjs +1 -1
  3. package/dist/shorty.cjs.map +1 -1
  4. package/dist/shorty.d.ts +235 -138
  5. package/dist/shorty.js +1 -1
  6. package/dist/shorty.js.map +1 -1
  7. package/dist/shorty.mjs +536 -600
  8. package/dist/shorty.mjs.map +1 -1
  9. package/package.json +9 -8
  10. package/.eslintrc.cjs +0 -224
  11. package/.lgtm.yml +0 -8
  12. package/.prettierrc.json +0 -15
  13. package/src/attr/getAttribute.ts +0 -11
  14. package/src/attr/getAttributeNS.ts +0 -12
  15. package/src/attr/hasAttribute.ts +0 -11
  16. package/src/attr/hasAttributeNS.ts +0 -15
  17. package/src/attr/removeAttribute.ts +0 -10
  18. package/src/attr/removeAttributeNS.ts +0 -14
  19. package/src/attr/setAttribute.ts +0 -11
  20. package/src/attr/setAttributeNS.ts +0 -16
  21. package/src/blocks/documentBody.ts +0 -5
  22. package/src/blocks/documentElement.ts +0 -5
  23. package/src/blocks/documentHead.ts +0 -5
  24. package/src/boolean/isApple.ts +0 -15
  25. package/src/boolean/isFirefox.ts +0 -9
  26. package/src/boolean/isMobile.ts +0 -14
  27. package/src/boolean/support3DTransform.ts +0 -7
  28. package/src/boolean/supportAnimation.ts +0 -7
  29. package/src/boolean/supportPassive.ts +0 -29
  30. package/src/boolean/supportTouch.ts +0 -9
  31. package/src/boolean/supportTransform.ts +0 -7
  32. package/src/boolean/supportTransition.ts +0 -7
  33. package/src/class/addClass.ts +0 -11
  34. package/src/class/hasClass.ts +0 -11
  35. package/src/class/removeClass.ts +0 -11
  36. package/src/event/off.ts +0 -18
  37. package/src/event/on.ts +0 -18
  38. package/src/event/one.ts +0 -26
  39. package/src/get/getBoundingClientRect.ts +0 -44
  40. package/src/get/getDocument.ts +0 -24
  41. package/src/get/getDocumentBody.ts +0 -13
  42. package/src/get/getDocumentElement.ts +0 -13
  43. package/src/get/getDocumentHead.ts +0 -14
  44. package/src/get/getElementAnimationDelay.ts +0 -25
  45. package/src/get/getElementAnimationDuration.ts +0 -25
  46. package/src/get/getElementStyle.ts +0 -25
  47. package/src/get/getElementTransitionDelay.ts +0 -25
  48. package/src/get/getElementTransitionDuration.ts +0 -25
  49. package/src/get/getNodeScroll.ts +0 -22
  50. package/src/get/getParentNode.ts +0 -28
  51. package/src/get/getRectRelativeToOffsetParent.ts +0 -43
  52. package/src/get/getUID.ts +0 -42
  53. package/src/get/getWindow.ts +0 -23
  54. package/src/index.ts +0 -571
  55. package/src/interface/boundingClientRect.d.ts +0 -10
  56. package/src/interface/css4Declaration.d.ts +0 -4
  57. package/src/interface/customElement.d.ts +0 -8
  58. package/src/interface/event.d.ts +0 -255
  59. package/src/interface/fn.ts +0 -1
  60. package/src/interface/navigatorUA.d.ts +0 -15
  61. package/src/interface/offsetRect.d.ts +0 -6
  62. package/src/interface/originalEvent.d.ts +0 -4
  63. package/src/is/isArray.ts +0 -10
  64. package/src/is/isCanvas.ts +0 -13
  65. package/src/is/isCustomElement.ts +0 -15
  66. package/src/is/isDocument.ts +0 -14
  67. package/src/is/isElement.ts +0 -28
  68. package/src/is/isElementInScrollRange.ts +0 -20
  69. package/src/is/isElementInViewport.ts +0 -21
  70. package/src/is/isElementsArray.ts +0 -13
  71. package/src/is/isFunction.ts +0 -12
  72. package/src/is/isHTMLCollection.ts +0 -12
  73. package/src/is/isHTMLElement.ts +0 -13
  74. package/src/is/isHTMLImageElement.ts +0 -12
  75. package/src/is/isJSON.ts +0 -20
  76. package/src/is/isMap.ts +0 -11
  77. package/src/is/isMedia.ts +0 -26
  78. package/src/is/isNode.ts +0 -19
  79. package/src/is/isNodeList.ts +0 -13
  80. package/src/is/isNumber.ts +0 -10
  81. package/src/is/isObject.ts +0 -10
  82. package/src/is/isRTL.ts +0 -11
  83. package/src/is/isSVGElement.ts +0 -13
  84. package/src/is/isScaledElement.ts +0 -20
  85. package/src/is/isShadowRoot.ts +0 -12
  86. package/src/is/isString.ts +0 -10
  87. package/src/is/isTableElement.ts +0 -17
  88. package/src/is/isWeakMap.ts +0 -11
  89. package/src/is/isWindow.ts +0 -13
  90. package/src/misc/ArrayFrom.ts +0 -11
  91. package/src/misc/Float32ArrayFrom.ts +0 -11
  92. package/src/misc/Float64ArrayFrom.ts +0 -11
  93. package/src/misc/ObjectAssign.ts +0 -54
  94. package/src/misc/ObjectEntries.ts +0 -11
  95. package/src/misc/ObjectFromEntries.ts +0 -11
  96. package/src/misc/ObjectHasOwn.ts +0 -18
  97. package/src/misc/ObjectKeys.ts +0 -11
  98. package/src/misc/ObjectValues.ts +0 -12
  99. package/src/misc/createCustomEvent.ts +0 -31
  100. package/src/misc/createElement.ts +0 -36
  101. package/src/misc/createElementNS.ts +0 -40
  102. package/src/misc/data.ts +0 -80
  103. package/src/misc/dispatchEvent.ts +0 -10
  104. package/src/misc/distinct.ts +0 -19
  105. package/src/misc/emulateAnimationEnd.ts +0 -43
  106. package/src/misc/emulateTransitionEnd.ts +0 -42
  107. package/src/misc/focus.ts +0 -10
  108. package/src/misc/focusTrap.ts +0 -67
  109. package/src/misc/getInstance.ts +0 -9
  110. package/src/misc/noop.ts +0 -6
  111. package/src/misc/normalizeOptions.ts +0 -58
  112. package/src/misc/normalizeValue.ts +0 -32
  113. package/src/misc/passiveHandler.ts +0 -6
  114. package/src/misc/reflow.ts +0 -9
  115. package/src/misc/setElementStyle.ts +0 -26
  116. package/src/misc/timer.ts +0 -91
  117. package/src/misc/toLowerCase.ts +0 -9
  118. package/src/misc/toUpperCase.ts +0 -9
  119. package/src/selectors/closest.ts +0 -23
  120. package/src/selectors/getCustomElements.ts +0 -19
  121. package/src/selectors/getElementById.ts +0 -16
  122. package/src/selectors/getElementsByClassName.ts +0 -22
  123. package/src/selectors/getElementsByTagName.ts +0 -22
  124. package/src/selectors/matches.ts +0 -11
  125. package/src/selectors/querySelector.ts +0 -25
  126. package/src/selectors/querySelectorAll.ts +0 -19
  127. package/src/strings/DOMContentLoadedEvent.ts +0 -5
  128. package/src/strings/DOMMouseScrollEvent.ts +0 -5
  129. package/src/strings/abortEvent.ts +0 -5
  130. package/src/strings/addEventListener.ts +0 -5
  131. package/src/strings/animationDelay.ts +0 -5
  132. package/src/strings/animationDuration.ts +0 -5
  133. package/src/strings/animationEndEvent.ts +0 -5
  134. package/src/strings/animationName.ts +0 -5
  135. package/src/strings/ariaChecked.ts +0 -5
  136. package/src/strings/ariaDescribedBy.ts +0 -5
  137. package/src/strings/ariaDescription.ts +0 -5
  138. package/src/strings/ariaExpanded.ts +0 -5
  139. package/src/strings/ariaHasPopup.ts +0 -5
  140. package/src/strings/ariaHidden.ts +0 -5
  141. package/src/strings/ariaLabel.ts +0 -5
  142. package/src/strings/ariaLabelledBy.ts +0 -5
  143. package/src/strings/ariaModal.ts +0 -5
  144. package/src/strings/ariaPressed.ts +0 -5
  145. package/src/strings/ariaSelected.ts +0 -5
  146. package/src/strings/ariaValueMax.ts +0 -5
  147. package/src/strings/ariaValueMin.ts +0 -5
  148. package/src/strings/ariaValueNow.ts +0 -5
  149. package/src/strings/ariaValueText.ts +0 -5
  150. package/src/strings/beforeunloadEvent.ts +0 -5
  151. package/src/strings/bezierEasings.ts +0 -32
  152. package/src/strings/blurEvent.ts +0 -5
  153. package/src/strings/changeEvent.ts +0 -5
  154. package/src/strings/contextmenuEvent.ts +0 -5
  155. package/src/strings/dragEvent.ts +0 -5
  156. package/src/strings/dragendEvent.ts +0 -5
  157. package/src/strings/dragenterEvent.ts +0 -5
  158. package/src/strings/dragleaveEvent.ts +0 -5
  159. package/src/strings/dragoverEvent.ts +0 -5
  160. package/src/strings/dragstartEvent.ts +0 -5
  161. package/src/strings/errorEvent.ts +0 -5
  162. package/src/strings/focusEvent.ts +0 -5
  163. package/src/strings/focusEvents.ts +0 -5
  164. package/src/strings/focusableSelector.ts +0 -4
  165. package/src/strings/focusinEvent.ts +0 -5
  166. package/src/strings/focusoutEvent.ts +0 -5
  167. package/src/strings/gesturechangeEvent.ts +0 -5
  168. package/src/strings/gestureendEvent.ts +0 -5
  169. package/src/strings/gesturestartEvent.ts +0 -5
  170. package/src/strings/keyAlt.ts +0 -7
  171. package/src/strings/keyArrowDown.ts +0 -7
  172. package/src/strings/keyArrowLeft.ts +0 -7
  173. package/src/strings/keyArrowRight.ts +0 -7
  174. package/src/strings/keyArrowUp.ts +0 -7
  175. package/src/strings/keyBackspace.ts +0 -7
  176. package/src/strings/keyCapsLock.ts +0 -7
  177. package/src/strings/keyControl.ts +0 -7
  178. package/src/strings/keyDelete.ts +0 -7
  179. package/src/strings/keyEnter.ts +0 -7
  180. package/src/strings/keyEscape.ts +0 -7
  181. package/src/strings/keyInsert.ts +0 -7
  182. package/src/strings/keyMeta.ts +0 -7
  183. package/src/strings/keyNumpadEnter.ts +0 -7
  184. package/src/strings/keyPause.ts +0 -7
  185. package/src/strings/keyScrollLock.ts +0 -7
  186. package/src/strings/keyShift.ts +0 -7
  187. package/src/strings/keySpace.ts +0 -7
  188. package/src/strings/keyTab.ts +0 -7
  189. package/src/strings/keyboardEventKeys.ts +0 -26
  190. package/src/strings/keydownEvent.ts +0 -5
  191. package/src/strings/keypressEvent.ts +0 -5
  192. package/src/strings/keyupEvent.ts +0 -5
  193. package/src/strings/loadEvent.ts +0 -5
  194. package/src/strings/loadstartEvent.ts +0 -5
  195. package/src/strings/mouseClickEvents.ts +0 -5
  196. package/src/strings/mouseHoverEvents.ts +0 -7
  197. package/src/strings/mouseSwipeEvents.ts +0 -10
  198. package/src/strings/mouseclickEvent.ts +0 -5
  199. package/src/strings/mousedblclickEvent.ts +0 -5
  200. package/src/strings/mousedownEvent.ts +0 -5
  201. package/src/strings/mouseenterEvent.ts +0 -5
  202. package/src/strings/mousehoverEvent.ts +0 -5
  203. package/src/strings/mouseinEvent.ts +0 -5
  204. package/src/strings/mouseleaveEvent.ts +0 -5
  205. package/src/strings/mousemoveEvent.ts +0 -5
  206. package/src/strings/mouseoutEvent.ts +0 -5
  207. package/src/strings/mouseoverEvent.ts +0 -5
  208. package/src/strings/mouseupEvent.ts +0 -5
  209. package/src/strings/mousewheelEvent.ts +0 -5
  210. package/src/strings/moveEvent.ts +0 -5
  211. package/src/strings/nativeEvents.ts +0 -108
  212. package/src/strings/offsetHeight.ts +0 -5
  213. package/src/strings/offsetWidth.ts +0 -5
  214. package/src/strings/orientationchangeEvent.ts +0 -5
  215. package/src/strings/pointercancelEvent.ts +0 -5
  216. package/src/strings/pointerdownEvent.ts +0 -5
  217. package/src/strings/pointerleaveEvent.ts +0 -5
  218. package/src/strings/pointermoveEvent.ts +0 -5
  219. package/src/strings/pointerupEvent.ts +0 -5
  220. package/src/strings/readystatechangeEvent.ts +0 -5
  221. package/src/strings/removeEventListener.ts +0 -5
  222. package/src/strings/resetEvent.ts +0 -5
  223. package/src/strings/resizeEvent.ts +0 -5
  224. package/src/strings/scrollEvent.ts +0 -5
  225. package/src/strings/scrollHeight.ts +0 -5
  226. package/src/strings/scrollWidth.ts +0 -5
  227. package/src/strings/selectEvent.ts +0 -5
  228. package/src/strings/selectendEvent.ts +0 -5
  229. package/src/strings/selectstartEvent.ts +0 -5
  230. package/src/strings/submitEvent.ts +0 -5
  231. package/src/strings/tabindex.ts +0 -5
  232. package/src/strings/touchEvents.ts +0 -10
  233. package/src/strings/touchcancelEvent.ts +0 -5
  234. package/src/strings/touchendEvent.ts +0 -5
  235. package/src/strings/touchmoveEvent.ts +0 -5
  236. package/src/strings/touchstartEvent.ts +0 -5
  237. package/src/strings/transitionDelay.ts +0 -5
  238. package/src/strings/transitionDuration.ts +0 -5
  239. package/src/strings/transitionEndEvent.ts +0 -5
  240. package/src/strings/transitionProperty.ts +0 -5
  241. package/src/strings/unloadEvent.ts +0 -5
  242. package/src/strings/userAgent.ts +0 -7
  243. package/src/strings/userAgentData.ts +0 -8
  244. package/test/att.test.ts +0 -43
  245. package/test/boolean.test.ts +0 -30
  246. package/test/class.test.ts +0 -26
  247. package/test/event.test.ts +0 -39
  248. package/test/fixtures/custom-elem.js +0 -18
  249. package/test/fixtures/getExampleDom.ts +0 -52
  250. package/test/fixtures/style.css +0 -18
  251. package/test/get.test.ts +0 -150
  252. package/test/is.test.ts +0 -240
  253. package/test/misc.test.ts +0 -400
  254. package/test/selectors.test.ts +0 -90
  255. package/tsconfig.json +0 -36
  256. package/vite.config.mts +0 -45
  257. package/vitest.config-ui.mts +0 -26
  258. 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.7",
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.1",
36
- "@vitest/browser": "^2.1.4",
37
- "@vitest/coverage-istanbul": "^2.1.4",
38
- "@vitest/ui": "^2.1.4",
39
- "playwright": "^1.48.2",
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.10",
41
+ "vite": "^5.4.11",
42
42
  "vite-plugin-dts": "^4.3.0",
43
- "vitest": "^2.1.4"
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
@@ -1,8 +0,0 @@
1
- extraction:
2
- typescript:
3
- index:
4
- exclude:
5
- - coverage
6
- - cypress
7
- - experiments
8
- - node_modules
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
- }
@@ -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;
@@ -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;
@@ -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;
@@ -1,5 +0,0 @@
1
- /**
2
- * A global namespace for `document.body`.
3
- */
4
- const { body: documentBody } = document;
5
- export default documentBody;
@@ -1,5 +0,0 @@
1
- /**
2
- * A global namespace for `document.documentElement` or the `<HTML>`.
3
- */
4
- const { documentElement } = document;
5
- export default documentElement;
@@ -1,5 +0,0 @@
1
- /**
2
- * A global namespace for `document.head`.
3
- */
4
- const { head: documentHead } = document;
5
- export default documentHead;
@@ -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;
@@ -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;
@@ -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,7 +0,0 @@
1
- /**
2
- * A global `boolean` for CSS3 3D transform support.
3
- */
4
- const support3DTransform = () =>
5
- ["webkitPerspective", "perspective"].some((p) => p in document.head.style);
6
-
7
- export default support3DTransform;
@@ -1,7 +0,0 @@
1
- /**
2
- * A global `boolean` for CSS3 animation support.
3
- */
4
- const supportAnimation = () =>
5
- ["webkitAnimation", "animation"].some((p) => p in document.head.style);
6
-
7
- export default supportAnimation;
@@ -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;
@@ -1,9 +0,0 @@
1
- /**
2
- * A global `boolean` for touch events support.
3
- */
4
- const supportTouch = () =>
5
- "ontouchstart" in window ||
6
- /* istanbul ignore next @preserve */
7
- "msMaxTouchPoints" in navigator;
8
-
9
- export default supportTouch;
@@ -1,7 +0,0 @@
1
- /**
2
- * A global `boolean` for CSS3 transform support.
3
- */
4
- const supportTransform = () =>
5
- ["webkitTransform", "transform"].some((p) => p in document.head.style);
6
-
7
- export default supportTransform;
@@ -1,7 +0,0 @@
1
- /**
2
- * A global `boolean` for CSS3 transition support.
3
- */
4
- const supportTransition = () =>
5
- ["webkitTransition", "transition"].some((p) => p in document.head.style);
6
-
7
- export default supportTransition;
@@ -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;
@@ -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;
@@ -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;