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