@thednp/shorty 1.0.0

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 (234) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +340 -0
  3. package/dist/shorty.esm.js +2540 -0
  4. package/dist/shorty.esm.min.js +2 -0
  5. package/dist/shorty.js +2563 -0
  6. package/dist/shorty.min.js +2 -0
  7. package/package.json +59 -0
  8. package/src/attr/getAttribute.js +9 -0
  9. package/src/attr/getAttributeNS.js +10 -0
  10. package/src/attr/hasAttribute.js +9 -0
  11. package/src/attr/hasAttributeNS.js +10 -0
  12. package/src/attr/removeAttribute.js +9 -0
  13. package/src/attr/removeAttributeNS.js +10 -0
  14. package/src/attr/setAttribute.js +10 -0
  15. package/src/attr/setAttributeNS.js +11 -0
  16. package/src/blocks/documentBody.js +5 -0
  17. package/src/blocks/documentElement.js +5 -0
  18. package/src/blocks/documentHead.js +5 -0
  19. package/src/boolean/isApple.js +13 -0
  20. package/src/boolean/isFirefox.js +9 -0
  21. package/src/boolean/isMobile.js +20 -0
  22. package/src/boolean/support3DTransform.js +8 -0
  23. package/src/boolean/supportAnimation.js +8 -0
  24. package/src/boolean/supportPassive.js +28 -0
  25. package/src/boolean/supportTouch.js +6 -0
  26. package/src/boolean/supportTransform.js +8 -0
  27. package/src/boolean/supportTransition.js +8 -0
  28. package/src/class/addClass.js +10 -0
  29. package/src/class/hasClass.js +10 -0
  30. package/src/class/removeClass.js +10 -0
  31. package/src/event/off.js +13 -0
  32. package/src/event/on.js +13 -0
  33. package/src/event/one.js +26 -0
  34. package/src/get/getBoundingClientRect.js +33 -0
  35. package/src/get/getDocument.js +11 -0
  36. package/src/get/getDocumentBody.js +10 -0
  37. package/src/get/getDocumentElement.js +11 -0
  38. package/src/get/getDocumentHead.js +10 -0
  39. package/src/get/getElementAnimationDelay.js +21 -0
  40. package/src/get/getElementAnimationDelayLegacy.js +21 -0
  41. package/src/get/getElementAnimationDuration.js +20 -0
  42. package/src/get/getElementAnimationDurationLegacy.js +21 -0
  43. package/src/get/getElementStyle.js +18 -0
  44. package/src/get/getElementTransitionDelay.js +21 -0
  45. package/src/get/getElementTransitionDelayLegacy.js +21 -0
  46. package/src/get/getElementTransitionDuration.js +20 -0
  47. package/src/get/getElementTransitionDurationLegacy.js +21 -0
  48. package/src/get/getNodeScroll.js +16 -0
  49. package/src/get/getParentNode.js +24 -0
  50. package/src/get/getRectRelativeToOffsetParent.js +30 -0
  51. package/src/get/getUID.js +34 -0
  52. package/src/get/getWindow.js +20 -0
  53. package/src/index.js +475 -0
  54. package/src/is/isArray.js +9 -0
  55. package/src/is/isCustomElement.js +8 -0
  56. package/src/is/isDocument.js +9 -0
  57. package/src/is/isElement.js +9 -0
  58. package/src/is/isElementInScrollRange.js +18 -0
  59. package/src/is/isElementInViewport.js +22 -0
  60. package/src/is/isElementsArray.js +10 -0
  61. package/src/is/isFunction.js +9 -0
  62. package/src/is/isHTMLCollection.js +8 -0
  63. package/src/is/isHTMLElement.js +8 -0
  64. package/src/is/isHTMLImageElement.js +8 -0
  65. package/src/is/isMedia.js +12 -0
  66. package/src/is/isNode.js +8 -0
  67. package/src/is/isNodeList.js +8 -0
  68. package/src/is/isRTL.js +9 -0
  69. package/src/is/isSVGElement.js +8 -0
  70. package/src/is/isScaledElement.js +15 -0
  71. package/src/is/isShadowRoot.js +12 -0
  72. package/src/is/isString.js +8 -0
  73. package/src/is/isTableElement.js +7 -0
  74. package/src/is/isWindow.js +9 -0
  75. package/src/misc/ArrayFrom.js +8 -0
  76. package/src/misc/Float32ArrayFrom.js +7 -0
  77. package/src/misc/Float64ArrayFrom.js +7 -0
  78. package/src/misc/ObjectAssign.js +7 -0
  79. package/src/misc/ObjectKeys.js +7 -0
  80. package/src/misc/ObjectValues.js +7 -0
  81. package/src/misc/OriginalEvent.js +18 -0
  82. package/src/misc/createElement.js +25 -0
  83. package/src/misc/createElementNS.js +26 -0
  84. package/src/misc/data.js +78 -0
  85. package/src/misc/dispatchEvent.js +8 -0
  86. package/src/misc/distinct.js +10 -0
  87. package/src/misc/emulateAnimationEnd.js +37 -0
  88. package/src/misc/emulateAnimationEndLegacy.js +38 -0
  89. package/src/misc/emulateTransitionEnd.js +37 -0
  90. package/src/misc/emulateTransitionEndLegacy.js +38 -0
  91. package/src/misc/focus.js +8 -0
  92. package/src/misc/noop.js +3 -0
  93. package/src/misc/normalizeOptions.js +49 -0
  94. package/src/misc/normalizeValue.js +32 -0
  95. package/src/misc/passiveHandler.js +7 -0
  96. package/src/misc/passiveHandlerLegacy.js +9 -0
  97. package/src/misc/reflow.js +9 -0
  98. package/src/misc/setElementStyle.js +10 -0
  99. package/src/misc/timer.js +78 -0
  100. package/src/misc/toLowerCase.js +8 -0
  101. package/src/misc/toUpperCase.js +8 -0
  102. package/src/misc/tryWrapper.js +11 -0
  103. package/src/misc/version.js +9 -0
  104. package/src/selectors/closest.js +16 -0
  105. package/src/selectors/documentAll.js +8 -0
  106. package/src/selectors/elementNodes.js +5 -0
  107. package/src/selectors/getCustomElements.js +18 -0
  108. package/src/selectors/getElementById.js +11 -0
  109. package/src/selectors/getElementsByClassName.js +15 -0
  110. package/src/selectors/getElementsByTagName.js +15 -0
  111. package/src/selectors/matches.js +10 -0
  112. package/src/selectors/matchesLegacy.js +23 -0
  113. package/src/selectors/parentNodes.js +5 -0
  114. package/src/selectors/querySelector.js +15 -0
  115. package/src/selectors/querySelectorAll.js +14 -0
  116. package/src/strings/DOMContentLoadedEvent.js +6 -0
  117. package/src/strings/DOMMouseScrollEvent.js +6 -0
  118. package/src/strings/abortEvent.js +6 -0
  119. package/src/strings/addEventListener.js +6 -0
  120. package/src/strings/animationDelay.js +6 -0
  121. package/src/strings/animationDelayLegacy.js +8 -0
  122. package/src/strings/animationDuration.js +6 -0
  123. package/src/strings/animationDurationLegacy.js +8 -0
  124. package/src/strings/animationEndEvent.js +6 -0
  125. package/src/strings/animationEndEventLegacy.js +8 -0
  126. package/src/strings/animationName.js +6 -0
  127. package/src/strings/animationNameLegacy.js +8 -0
  128. package/src/strings/ariaChecked.js +6 -0
  129. package/src/strings/ariaDescribedBy.js +6 -0
  130. package/src/strings/ariaDescription.js +6 -0
  131. package/src/strings/ariaExpanded.js +6 -0
  132. package/src/strings/ariaHasPopup.js +6 -0
  133. package/src/strings/ariaHidden.js +6 -0
  134. package/src/strings/ariaLabel.js +6 -0
  135. package/src/strings/ariaLabelledBy.js +6 -0
  136. package/src/strings/ariaModal.js +6 -0
  137. package/src/strings/ariaPressed.js +6 -0
  138. package/src/strings/ariaSelected.js +6 -0
  139. package/src/strings/ariaValueMax.js +6 -0
  140. package/src/strings/ariaValueMin.js +6 -0
  141. package/src/strings/ariaValueNow.js +6 -0
  142. package/src/strings/ariaValueText.js +6 -0
  143. package/src/strings/beforeunloadEvent.js +6 -0
  144. package/src/strings/bezierEasings.js +33 -0
  145. package/src/strings/blurEvent.js +6 -0
  146. package/src/strings/changeEvent.js +6 -0
  147. package/src/strings/contextmenuEvent.js +6 -0
  148. package/src/strings/errorEvent.js +6 -0
  149. package/src/strings/focusEvent.js +6 -0
  150. package/src/strings/focusEvents.js +6 -0
  151. package/src/strings/focusinEvent.js +6 -0
  152. package/src/strings/focusoutEvent.js +6 -0
  153. package/src/strings/gesturechangeEvent.js +6 -0
  154. package/src/strings/gestureendEvent.js +6 -0
  155. package/src/strings/gesturestartEvent.js +6 -0
  156. package/src/strings/keyAlt.js +7 -0
  157. package/src/strings/keyArrowDown.js +7 -0
  158. package/src/strings/keyArrowLeft.js +7 -0
  159. package/src/strings/keyArrowRight.js +7 -0
  160. package/src/strings/keyArrowUp.js +7 -0
  161. package/src/strings/keyBackspace.js +7 -0
  162. package/src/strings/keyCapsLock.js +7 -0
  163. package/src/strings/keyControl.js +7 -0
  164. package/src/strings/keyDelete.js +7 -0
  165. package/src/strings/keyEnter.js +7 -0
  166. package/src/strings/keyEscape.js +7 -0
  167. package/src/strings/keyInsert.js +7 -0
  168. package/src/strings/keyMeta.js +7 -0
  169. package/src/strings/keyPause.js +7 -0
  170. package/src/strings/keyScrollLock.js +7 -0
  171. package/src/strings/keyShift.js +7 -0
  172. package/src/strings/keySpace.js +7 -0
  173. package/src/strings/keyTab.js +7 -0
  174. package/src/strings/keyboardEventKeys.js +27 -0
  175. package/src/strings/keydownEvent.js +6 -0
  176. package/src/strings/keypressEvent.js +6 -0
  177. package/src/strings/keyupEvent.js +6 -0
  178. package/src/strings/loadEvent.js +6 -0
  179. package/src/strings/loadstartEvent.js +6 -0
  180. package/src/strings/mouseClickEvents.js +6 -0
  181. package/src/strings/mouseHoverEvents.js +6 -0
  182. package/src/strings/mouseSwipeEvents.js +8 -0
  183. package/src/strings/mouseclickEvent.js +6 -0
  184. package/src/strings/mousedblclickEvent.js +6 -0
  185. package/src/strings/mousedownEvent.js +6 -0
  186. package/src/strings/mouseenterEvent.js +6 -0
  187. package/src/strings/mousehoverEvent.js +6 -0
  188. package/src/strings/mouseinEvent.js +6 -0
  189. package/src/strings/mouseleaveEvent.js +6 -0
  190. package/src/strings/mousemoveEvent.js +6 -0
  191. package/src/strings/mouseoutEvent.js +6 -0
  192. package/src/strings/mouseoverEvent.js +6 -0
  193. package/src/strings/mouseupEvent.js +6 -0
  194. package/src/strings/mousewheelEvent.js +6 -0
  195. package/src/strings/moveEvent.js +6 -0
  196. package/src/strings/nativeEvents.js +108 -0
  197. package/src/strings/offsetHeight.js +6 -0
  198. package/src/strings/offsetWidth.js +6 -0
  199. package/src/strings/orientationchangeEvent.js +6 -0
  200. package/src/strings/pointercancelEvent.js +6 -0
  201. package/src/strings/pointerdownEvent.js +6 -0
  202. package/src/strings/pointerleaveEvent.js +6 -0
  203. package/src/strings/pointermoveEvent.js +6 -0
  204. package/src/strings/pointerupEvent.js +6 -0
  205. package/src/strings/readystatechangeEvent.js +6 -0
  206. package/src/strings/removeEventListener.js +6 -0
  207. package/src/strings/resetEvent.js +6 -0
  208. package/src/strings/resizeEvent.js +6 -0
  209. package/src/strings/scrollEvent.js +6 -0
  210. package/src/strings/scrollHeight.js +6 -0
  211. package/src/strings/scrollWidth.js +6 -0
  212. package/src/strings/selectEvent.js +6 -0
  213. package/src/strings/selectendEvent.js +6 -0
  214. package/src/strings/selectstartEvent.js +6 -0
  215. package/src/strings/submitEvent.js +6 -0
  216. package/src/strings/touchEvents.js +8 -0
  217. package/src/strings/touchcancelEvent.js +6 -0
  218. package/src/strings/touchendEvent.js +6 -0
  219. package/src/strings/touchmoveEvent.js +6 -0
  220. package/src/strings/touchstartEvent.js +6 -0
  221. package/src/strings/transitionDelay.js +6 -0
  222. package/src/strings/transitionDelayLegacy.js +8 -0
  223. package/src/strings/transitionDuration.js +6 -0
  224. package/src/strings/transitionDurationLegacy.js +8 -0
  225. package/src/strings/transitionEndEvent.js +6 -0
  226. package/src/strings/transitionEndEventLegacy.js +8 -0
  227. package/src/strings/transitionProperty.js +7 -0
  228. package/src/strings/transitionPropertyLegacy.js +12 -0
  229. package/src/strings/unloadEvent.js +6 -0
  230. package/src/strings/userAgent.js +7 -0
  231. package/src/strings/userAgentData.js +8 -0
  232. package/types/index.d.ts +252 -0
  233. package/types/module/shorty.ts +249 -0
  234. package/types/shorty.d.ts +2317 -0
@@ -0,0 +1,2540 @@
1
+ /*!
2
+ * Shorty v1.0.0 (https://github.com/thednp/shorty)
3
+ * Copyright 2019-2022 © dnp_theme
4
+ * Licensed under MIT (https://github.com/thednp/shorty/blob/master/LICENSE)
5
+ */
6
+ /**
7
+ * A global namespace for aria-checked.
8
+ * @type {string}
9
+ */
10
+ const ariaChecked = 'aria-checked';
11
+
12
+ /**
13
+ * A global namespace for aria-description.
14
+ * @type {string}
15
+ */
16
+ const ariaDescription = 'aria-description';
17
+
18
+ /**
19
+ * A global namespace for aria-describedby.
20
+ * @type {string}
21
+ */
22
+ const ariaDescribedBy = 'aria-describedby';
23
+
24
+ /**
25
+ * A global namespace for aria-expanded.
26
+ * @type {string}
27
+ */
28
+ const ariaExpanded = 'aria-expanded';
29
+
30
+ /**
31
+ * A global namespace for aria-haspopup.
32
+ * @type {string}
33
+ */
34
+ const ariaHasPopup = 'aria-haspopup';
35
+
36
+ /**
37
+ * A global namespace for aria-hidden.
38
+ * @type {string}
39
+ */
40
+ const ariaHidden = 'aria-hidden';
41
+
42
+ /**
43
+ * A global namespace for aria-label.
44
+ * @type {string}
45
+ */
46
+ const ariaLabel = 'aria-label';
47
+
48
+ /**
49
+ * A global namespace for aria-labelledby.
50
+ * @type {string}
51
+ */
52
+ const ariaLabelledBy = 'aria-labelledby';
53
+
54
+ /**
55
+ * A global namespace for aria-modal.
56
+ * @type {string}
57
+ */
58
+ const ariaModal = 'aria-modal';
59
+
60
+ /**
61
+ * A global namespace for aria-pressed.
62
+ * @type {string}
63
+ */
64
+ const ariaPressed = 'aria-pressed';
65
+
66
+ /**
67
+ * A global namespace for aria-selected.
68
+ * @type {string}
69
+ */
70
+ const ariaSelected = 'aria-selected';
71
+
72
+ /**
73
+ * A global namespace for aria-valuemin.
74
+ * @type {string}
75
+ */
76
+ const ariaValueMin = 'aria-valuemin';
77
+
78
+ /**
79
+ * A global namespace for aria-valuemax.
80
+ * @type {string}
81
+ */
82
+ const ariaValueMax = 'aria-valuemax';
83
+
84
+ /**
85
+ * A global namespace for aria-valuenow.
86
+ * @type {string}
87
+ */
88
+ const ariaValueNow = 'aria-valuenow';
89
+
90
+ /**
91
+ * A global namespace for aria-valuetext.
92
+ * @type {string}
93
+ */
94
+ const ariaValueText = 'aria-valuetext';
95
+
96
+ /**
97
+ * A global namespace for `abort` event.
98
+ * @type {string}
99
+ */
100
+ const abortEvent = 'abort';
101
+
102
+ /**
103
+ * A global namespace for `beforeunload` event.
104
+ * @type {string}
105
+ */
106
+ const beforeunloadEvent = 'beforeunload';
107
+
108
+ /**
109
+ * A global namespace for `blur` event.
110
+ * @type {string}
111
+ */
112
+ const blurEvent = 'blur';
113
+
114
+ /**
115
+ * A global namespace for `change` event.
116
+ * @type {string}
117
+ */
118
+ const changeEvent = 'change';
119
+
120
+ /**
121
+ * A global namespace for `contextmenu` event.
122
+ * @type {string}
123
+ */
124
+ const contextmenuEvent = 'contextmenu';
125
+
126
+ /**
127
+ * A global namespace for `DOMContentLoaded` event.
128
+ * @type {string}
129
+ */
130
+ const DOMContentLoadedEvent = 'DOMContentLoaded';
131
+
132
+ /**
133
+ * A global namespace for `DOMMouseScroll` event.
134
+ * @type {string}
135
+ */
136
+ const DOMMouseScrollEvent = 'DOMMouseScroll';
137
+
138
+ /**
139
+ * A global namespace for `error` event.
140
+ * @type {string}
141
+ */
142
+ const errorEvent = 'error';
143
+
144
+ /**
145
+ * A global namespace for `focus` event.
146
+ * @type {string}
147
+ */
148
+ const focusEvent = 'focus';
149
+
150
+ /**
151
+ * A global namespace for `focusin` event.
152
+ * @type {string}
153
+ */
154
+ const focusinEvent = 'focusin';
155
+
156
+ /**
157
+ * A global namespace for `focusout` event.
158
+ * @type {string}
159
+ */
160
+ const focusoutEvent = 'focusout';
161
+
162
+ /**
163
+ * A global namespace for `gesturechange` event.
164
+ * @type {string}
165
+ */
166
+ const gesturechangeEvent = 'gesturechange';
167
+
168
+ /**
169
+ * A global namespace for `gestureend` event.
170
+ * @type {string}
171
+ */
172
+ const gestureendEvent = 'gestureend';
173
+
174
+ /**
175
+ * A global namespace for `gesturestart` event.
176
+ * @type {string}
177
+ */
178
+ const gesturestartEvent = 'gesturestart';
179
+
180
+ /**
181
+ * A global namespace for `keydown` event.
182
+ * @type {string}
183
+ */
184
+ const keydownEvent = 'keydown';
185
+
186
+ /**
187
+ * A global namespace for `keypress` event.
188
+ * @type {string}
189
+ */
190
+ const keypressEvent = 'keypress';
191
+
192
+ /**
193
+ * A global namespace for `keyup` event.
194
+ * @type {string}
195
+ */
196
+ const keyupEvent = 'keyup';
197
+
198
+ /**
199
+ * A global namespace for `load` event.
200
+ * @type {string}
201
+ */
202
+ const loadEvent = 'load';
203
+
204
+ /**
205
+ * A global namespace for `click` event.
206
+ * @type {string}
207
+ */
208
+ const mouseclickEvent = 'click';
209
+
210
+ /**
211
+ * A global namespace for `dblclick` event.
212
+ * @type {string}
213
+ */
214
+ const mousedblclickEvent = 'dblclick';
215
+
216
+ /**
217
+ * A global namespace for `mousedown` event.
218
+ * @type {string}
219
+ */
220
+ const mousedownEvent = 'mousedown';
221
+
222
+ /**
223
+ * A global namespace for `mouseup` event.
224
+ * @type {string}
225
+ */
226
+ const mouseupEvent = 'mouseup';
227
+
228
+ /**
229
+ * A global namespace for `hover` event.
230
+ * @type {string}
231
+ */
232
+ const mousehoverEvent = 'hover';
233
+
234
+ /**
235
+ * A global namespace for `mouseenter` event.
236
+ * @type {string}
237
+ */
238
+ const mouseenterEvent = 'mouseenter';
239
+
240
+ /**
241
+ * A global namespace for `mouseleave` event.
242
+ * @type {string}
243
+ */
244
+ const mouseleaveEvent = 'mouseleave';
245
+
246
+ /**
247
+ * A global namespace for `mousein` event.
248
+ * @type {string}
249
+ */
250
+ const mouseinEvent = 'mousein';
251
+
252
+ /**
253
+ * A global namespace for `mouseout` event.
254
+ * @type {string}
255
+ */
256
+ const mouseoutEvent = 'mouseout';
257
+
258
+ /**
259
+ * A global namespace for `mouseover` event.
260
+ * @type {string}
261
+ */
262
+ const mouseoverEvent = 'mouseover';
263
+
264
+ /**
265
+ * A global namespace for `mousemove` event.
266
+ * @type {string}
267
+ */
268
+ const mousemoveEvent = 'mousemove';
269
+
270
+ /**
271
+ * A global namespace for `mousewheel` event.
272
+ * @type {string}
273
+ */
274
+ const mousewheelEvent = 'mousewheel';
275
+
276
+ /**
277
+ * A global namespace for `move` event.
278
+ * @type {string}
279
+ */
280
+ const moveEvent = 'move';
281
+
282
+ /**
283
+ * A global namespace for `orientationchange` event.
284
+ * @type {string}
285
+ */
286
+ const orientationchangeEvent = 'orientationchange';
287
+
288
+ /**
289
+ * A global namespace for `pointercancel` event.
290
+ * @type {string}
291
+ */
292
+ const pointercancelEvent = 'pointercancel';
293
+
294
+ /**
295
+ * A global namespace for `pointerdown` event.
296
+ * @type {string}
297
+ */
298
+ const pointerdownEvent = 'pointerdown';
299
+
300
+ /**
301
+ * A global namespace for `pointerleave` event.
302
+ * @type {string}
303
+ */
304
+ const pointerleaveEvent = 'pointerleave';
305
+
306
+ /**
307
+ * A global namespace for `pointermove` event.
308
+ * @type {string}
309
+ */
310
+ const pointermoveEvent = 'pointermove';
311
+
312
+ /**
313
+ * A global namespace for `pointerup` event.
314
+ * @type {string}
315
+ */
316
+ const pointerupEvent = 'pointerup';
317
+
318
+ /**
319
+ * A global namespace for `readystatechange` event.
320
+ * @type {string}
321
+ */
322
+ const readystatechangeEvent = 'readystatechange';
323
+
324
+ /**
325
+ * A global namespace for `reset` event.
326
+ * @type {string}
327
+ */
328
+ const resetEvent = 'reset';
329
+
330
+ /**
331
+ * A global namespace for `resize` event.
332
+ * @type {string}
333
+ */
334
+ const resizeEvent = 'resize';
335
+
336
+ /**
337
+ * A global namespace for `select` event.
338
+ * @type {string}
339
+ */
340
+ const selectEvent = 'select';
341
+
342
+ /**
343
+ * A global namespace for the `selectend` event.
344
+ * @type {string}
345
+ */
346
+ const selectendEvent = 'selectend';
347
+
348
+ /**
349
+ * A global namespace for the `selectstart` event.
350
+ * @type {string}
351
+ */
352
+ const selectstartEvent = 'selectstart';
353
+
354
+ /**
355
+ * A global namespace for `scroll` event.
356
+ * @type {string}
357
+ */
358
+ const scrollEvent = 'scroll';
359
+
360
+ /**
361
+ * A global namespace for `submit` event.
362
+ * @type {string}
363
+ */
364
+ const submitEvent = 'submit';
365
+
366
+ /**
367
+ * A global namespace for `touchstart` event.
368
+ * @type {string}
369
+ */
370
+ const touchstartEvent = 'touchstart';
371
+
372
+ /**
373
+ * A global namespace for `touchmove` event.
374
+ * @type {string}
375
+ */
376
+ const touchmoveEvent = 'touchmove';
377
+
378
+ /**
379
+ * A global namespace for `touchcancel` event.
380
+ * @type {string}
381
+ */
382
+ const touchcancelEvent = 'touchcancel';
383
+
384
+ /**
385
+ * A global namespace for `touchend` event.
386
+ * @type {string}
387
+ */
388
+ const touchendEvent = 'touchend';
389
+
390
+ /**
391
+ * A global namespace for `unload` event.
392
+ * @type {string}
393
+ */
394
+ const unloadEvent = 'unload';
395
+
396
+ /**
397
+ * A global namespace for all browser native events.
398
+ */
399
+ const nativeEvents = {
400
+ DOMContentLoaded: DOMContentLoadedEvent,
401
+ DOMMouseScroll: DOMMouseScrollEvent,
402
+ abort: abortEvent,
403
+ beforeunload: beforeunloadEvent,
404
+ blur: blurEvent,
405
+ change: changeEvent,
406
+ click: mouseclickEvent,
407
+ contextmenu: contextmenuEvent,
408
+ dblclick: mousedblclickEvent,
409
+ error: errorEvent,
410
+ focus: focusEvent,
411
+ focusin: focusinEvent,
412
+ focusout: focusoutEvent,
413
+ gesturechange: gesturechangeEvent,
414
+ gestureend: gestureendEvent,
415
+ gesturestart: gesturestartEvent,
416
+ hover: mousehoverEvent,
417
+ keydown: keydownEvent,
418
+ keypress: keypressEvent,
419
+ keyup: keyupEvent,
420
+ load: loadEvent,
421
+ mousedown: mousedownEvent,
422
+ mousemove: mousemoveEvent,
423
+ mousein: mouseinEvent,
424
+ mouseout: mouseoutEvent,
425
+ mouseenter: mouseenterEvent,
426
+ mouseleave: mouseleaveEvent,
427
+ mouseover: mouseoverEvent,
428
+ mouseup: mouseupEvent,
429
+ mousewheel: mousewheelEvent,
430
+ move: moveEvent,
431
+ orientationchange: orientationchangeEvent,
432
+ pointercancel: pointercancelEvent,
433
+ pointerdown: pointerdownEvent,
434
+ pointerleave: pointerleaveEvent,
435
+ pointermove: pointermoveEvent,
436
+ pointerup: pointerupEvent,
437
+ readystatechange: readystatechangeEvent,
438
+ reset: resetEvent,
439
+ resize: resizeEvent,
440
+ scroll: scrollEvent,
441
+ select: selectEvent,
442
+ selectend: selectendEvent,
443
+ selectstart: selectstartEvent,
444
+ submit: submitEvent,
445
+ touchcancel: touchcancelEvent,
446
+ touchend: touchendEvent,
447
+ touchmove: touchmoveEvent,
448
+ touchstart: touchstartEvent,
449
+ unload: unloadEvent,
450
+ };
451
+
452
+ /**
453
+ * A global namespace for `loadstart` event.
454
+ * @type {string}
455
+ */
456
+ const loadstartEvent = 'loadstart';
457
+
458
+ /**
459
+ * A global namespace for mouse events equivalent to touch events.
460
+ * @type {Record<string, string>}
461
+ */
462
+ const mouseSwipeEvents = {
463
+ start: 'mousedown', end: 'mouseup', move: 'mousemove', cancel: 'mouseleave',
464
+ };
465
+
466
+ /**
467
+ * A global namespace for mouse click events.
468
+ * @type {Record<string, string>}
469
+ */
470
+ const mouseClickEvents = { down: 'mousedown', up: 'mouseup' };
471
+
472
+ /**
473
+ * A global namespace for mouse hover events.
474
+ * @type {[string, string]}
475
+ */
476
+ const mouseHoverEvents = ('onmouseleave' in document) ? ['mouseenter', 'mouseleave'] : ['mouseover', 'mouseout'];
477
+
478
+ /**
479
+ * A global namespace for touch events.
480
+ * @type {Record<string, string>}
481
+ */
482
+ const touchEvents = {
483
+ start: 'touchstart', end: 'touchend', move: 'touchmove', cancel: 'touchcancel',
484
+ };
485
+
486
+ /**
487
+ * A global namespace for focus event names.
488
+ * @type {{in: string, out: string}}
489
+ */
490
+ const focusEvents = { in: 'focusin', out: 'focusout' };
491
+
492
+ /**
493
+ * A global namespace for keyboard event keys.
494
+ * @type {Record<string, string>}
495
+ */
496
+ const keyboardEventKeys = {
497
+ Backspace: 'Backspace', // 8
498
+ Tab: 'Tab', // 9
499
+ Enter: 'Enter', // 13
500
+ Shift: 'Shift', // 16
501
+ Control: 'Control', // 17
502
+ Alt: 'Alt', // 18
503
+ Pause: 'Pause', // 19
504
+ CapsLock: 'CapsLock', // 20
505
+ Escape: 'Escape', // 27
506
+ Scape: 'Space', // 32
507
+ ArrowLeft: 'ArrowLeft', // 37
508
+ ArrowUp: 'ArrowUp', // 38
509
+ ArrowRight: 'ArrowRight', // 39
510
+ ArrowDown: 'ArrowDown', // 40
511
+ Insert: 'Insert', // 45
512
+ Delete: 'Delete', // 46
513
+ Meta: 'Meta', // 91 windows key
514
+ ContextMenu: 'ContextMenu', // 93
515
+ ScrollLock: 'ScrollLock', // 145
516
+ };
517
+
518
+ /**
519
+ * A global namespace for `Alt` key.
520
+ * @type {string} e.which = 18
521
+ */
522
+ const keyAlt = 'Alt';
523
+
524
+ /**
525
+ * A global namespace for `ArrowDown` key.
526
+ * @type {string} e.which = 40 equivalent
527
+ */
528
+ const keyArrowDown = 'ArrowDown';
529
+
530
+ /**
531
+ * A global namespace for `ArrowUp` key.
532
+ * @type {string} e.which = 38 equivalent
533
+ */
534
+ const keyArrowUp = 'ArrowUp';
535
+
536
+ /**
537
+ * A global namespace for `ArrowLeft` key.
538
+ * @type {string} e.which = 37 equivalent
539
+ */
540
+ const keyArrowLeft = 'ArrowLeft';
541
+
542
+ /**
543
+ * A global namespace for `ArrowRight` key.
544
+ * @type {string} e.which = 39 equivalent
545
+ */
546
+ const keyArrowRight = 'ArrowRight';
547
+
548
+ /**
549
+ * A global namespace for `Backspace` key.
550
+ * @type {string} e.which === 8 equivalent
551
+ */
552
+ const keyBackspace = 'Backspace';
553
+
554
+ /**
555
+ * A global namespace for `CapsLock` key.
556
+ * @type {string} e.which = 20 equivalent
557
+ */
558
+ const keyCapsLock = 'CapsLock';
559
+
560
+ /**
561
+ * A global namespace for `Control` key.
562
+ * @type {string} e.which = 17
563
+ */
564
+ const keyControl = 'Control';
565
+
566
+ /**
567
+ * A global namespace for `Delete` key.
568
+ * @type {string} e.which = 46 equivalent
569
+ */
570
+ const keyDelete = 'Delete';
571
+
572
+ /**
573
+ * A global namespace for `Enter` key.
574
+ * @type {string} e.which = 13 equivalent
575
+ */
576
+ const keyEnter = 'Enter';
577
+
578
+ /**
579
+ * A global namespace for `Escape` key.
580
+ * @type {string} e.which = 27 equivalent
581
+ */
582
+ const keyEscape = 'Escape';
583
+
584
+ /**
585
+ * A global namespace for `Insert` key.
586
+ * @type {string} e.which = 45 equivalent
587
+ */
588
+ const keyInsert = 'Insert';
589
+
590
+ /**
591
+ * A global namespace for `Meta` key.
592
+ * @type {string} e.which = 93 equivalent
593
+ */
594
+ const keyMeta = 'Meta';
595
+
596
+ /**
597
+ * A global namespace for `Pause` key.
598
+ * @type {string} e.which = 19
599
+ */
600
+ const keyPause = 'Pause';
601
+
602
+ /**
603
+ * A global namespace for `ScrollLock` key.
604
+ * @type {string} e.which = 145 equivalent
605
+ */
606
+ const keyScrollLock = 'ScrollLock';
607
+
608
+ /**
609
+ * A global namespace for `Shift` key.
610
+ * @type {string} e.which = 16
611
+ */
612
+ const keyShift = 'Shift';
613
+
614
+ /**
615
+ * A global namespace for `Space` key.
616
+ * @type {string} e.which = 32 equivalent
617
+ */
618
+ const keySpace = 'Space';
619
+
620
+ /**
621
+ * A global namespace for `Tab` key.
622
+ * @type {string} e.which = 9 equivalent
623
+ */
624
+ const keyTab = 'Tab';
625
+
626
+ /**
627
+ * A global namespace for 'animationDuration' string.
628
+ * @type {string}
629
+ */
630
+ const animationDuration$1 = 'animationDuration';
631
+
632
+ /**
633
+ * A global namespace for `document.head`.
634
+ */
635
+ const { head: documentHead } = document;
636
+
637
+ /**
638
+ * A global namespace for 'animationDuration' string.
639
+ * @type {string}
640
+ */
641
+ const animationDuration = 'webkitAnimation' in documentHead.style ? 'webkitAnimationDuration' : 'animationDuration';
642
+
643
+ /**
644
+ * A global namespace for 'animationDelay' string.
645
+ * @type {string}
646
+ */
647
+ const animationDelay$1 = 'animationDelay';
648
+
649
+ /**
650
+ * A global namespace for 'animationDelay' string.
651
+ * @type {string}
652
+ */
653
+ const animationDelay = 'webkitAnimation' in documentHead.style ? 'webkitAnimationDelay' : 'animationDelay';
654
+
655
+ /**
656
+ * A global namespace for 'animationName' string.
657
+ * @type {string}
658
+ */
659
+ const animationName$1 = 'animationName';
660
+
661
+ /**
662
+ * A global namespace for 'animationName' string.
663
+ * @type {string}
664
+ */
665
+ const animationName = 'webkitAnimation' in documentHead.style ? 'webkitAnimationName' : 'animationName';
666
+
667
+ /**
668
+ * A global namespace for 'animationend' string.
669
+ * @type {string}
670
+ */
671
+ const animationEndEvent$1 = 'animationend';
672
+
673
+ /**
674
+ * A global namespace for 'animationend' string.
675
+ * @type {string}
676
+ */
677
+ const animationEndEvent = 'webkitAnimation' in documentHead.style ? 'webkitAnimationEnd' : 'animationend';
678
+
679
+ /**
680
+ * A global namespace for 'transitionDuration' string.
681
+ * @type {string}
682
+ */
683
+ const transitionDuration$1 = 'transitionDuration';
684
+
685
+ /**
686
+ * A global namespace for 'transitionDuration' string.
687
+ * @type {string}
688
+ */
689
+ const transitionDuration = 'webkitTransition' in documentHead.style ? 'webkitTransitionDuration' : 'transitionDuration';
690
+
691
+ /**
692
+ * A global namespace for 'transitionDelay' string.
693
+ * @type {string}
694
+ */
695
+ const transitionDelay$1 = 'transitionDelay';
696
+
697
+ /**
698
+ * A global namespace for 'transitionDelay' string.
699
+ * @type {string}
700
+ */
701
+ const transitionDelay = 'webkitTransition' in documentHead.style ? 'webkitTransitionDelay' : 'transitionDelay';
702
+
703
+ /**
704
+ * A global namespace for 'transitionend' string.
705
+ * @type {string}
706
+ */
707
+ const transitionEndEvent$1 = 'transitionend';
708
+
709
+ /**
710
+ * A global namespace for 'transitionend' string.
711
+ * @type {string}
712
+ */
713
+ const transitionEndEvent = 'webkitTransition' in documentHead.style ? 'webkitTransitionEnd' : 'transitionend';
714
+
715
+ /**
716
+ * A global namespace for `transitionProperty` string for modern browsers.
717
+ *
718
+ * @type {string}
719
+ */
720
+ const transitionProperty$1 = 'transitionProperty';
721
+
722
+ /**
723
+ * A global namespace for:
724
+ * * `transitionProperty` string for modern brosers,
725
+ * * `webkitTransition` for legacy Chrome / Safari browsers
726
+ *
727
+ * @type {string}
728
+ */
729
+ const transitionProperty = 'webkitTransition' in documentHead.style ? 'webkitTransitionProperty' : 'transitionProperty';
730
+
731
+ /**
732
+ * A global namespace for 'addEventListener' string.
733
+ * @type {string}
734
+ */
735
+ const addEventListener = 'addEventListener';
736
+
737
+ /**
738
+ * A global namespace for 'removeEventListener' string.
739
+ * @type {string}
740
+ */
741
+ const removeEventListener = 'removeEventListener';
742
+
743
+ /**
744
+ * A global namespace for predefined
745
+ * CSS3 'cubic-bezier()' easing functions.
746
+ * @type {Record<string, string>}
747
+ */
748
+ const bezierEasings = {
749
+ linear: 'linear',
750
+ easingSinusoidalIn: 'cubic-bezier(0.47,0,0.745,0.715)',
751
+ easingSinusoidalOut: 'cubic-bezier(0.39,0.575,0.565,1)',
752
+ easingSinusoidalInOut: 'cubic-bezier(0.445,0.05,0.55,0.95)',
753
+ easingQuadraticIn: 'cubic-bezier(0.550,0.085,0.680,0.530)',
754
+ easingQuadraticOut: 'cubic-bezier(0.250,0.460,0.450,0.940)',
755
+ easingQuadraticInOut: 'cubic-bezier(0.455,0.030,0.515,0.955)',
756
+ easingCubicIn: 'cubic-bezier(0.55,0.055,0.675,0.19)',
757
+ easingCubicOut: 'cubic-bezier(0.215,0.61,0.355,1)',
758
+ easingCubicInOut: 'cubic-bezier(0.645,0.045,0.355,1)',
759
+ easingQuarticIn: 'cubic-bezier(0.895,0.03,0.685,0.22)',
760
+ easingQuarticOut: 'cubic-bezier(0.165,0.84,0.44,1)',
761
+ easingQuarticInOut: 'cubic-bezier(0.77,0,0.175,1)',
762
+ easingQuinticIn: 'cubic-bezier(0.755,0.05,0.855,0.06)',
763
+ easingQuinticOut: 'cubic-bezier(0.23,1,0.32,1)',
764
+ easingQuinticInOut: 'cubic-bezier(0.86,0,0.07,1)',
765
+ easingExponentialIn: 'cubic-bezier(0.95,0.05,0.795,0.035)',
766
+ easingExponentialOut: 'cubic-bezier(0.19,1,0.22,1)',
767
+ easingExponentialInOut: 'cubic-bezier(1,0,0,1)',
768
+ easingCircularIn: 'cubic-bezier(0.6,0.04,0.98,0.335)',
769
+ easingCircularOut: 'cubic-bezier(0.075,0.82,0.165,1)',
770
+ easingCircularInOut: 'cubic-bezier(0.785,0.135,0.15,0.86)',
771
+ easingBackIn: 'cubic-bezier(0.6,-0.28,0.735,0.045)',
772
+ easingBackOut: 'cubic-bezier(0.175,0.885,0.32,1.275)',
773
+ easingBackInOut: 'cubic-bezier(0.68,-0.55,0.265,1.55)',
774
+ };
775
+
776
+ /**
777
+ * A global namespace for `offsetHeight` property.
778
+ * @type {string}
779
+ */
780
+ const offsetHeight = 'offsetHeight';
781
+
782
+ /**
783
+ * A global namespace for `offsetWidth` property.
784
+ * @type {string}
785
+ */
786
+ const offsetWidth = 'offsetWidth';
787
+
788
+ /**
789
+ * A global namespace for `scrollHeight` property.
790
+ * @type {string}
791
+ */
792
+ const scrollHeight = 'scrollHeight';
793
+
794
+ /**
795
+ * A global namespace for `scrollWidth` property.
796
+ * @type {string}
797
+ */
798
+ const scrollWidth = 'scrollWidth';
799
+
800
+ // @ts-ignore
801
+ const { userAgentData: uaDATA } = navigator;
802
+
803
+ /**
804
+ * A global namespace for `userAgentData` object.
805
+ */
806
+ const userAgentData = uaDATA;
807
+
808
+ const { userAgent: userAgentString } = navigator;
809
+
810
+ /**
811
+ * A global namespace for `navigator.userAgent` string.
812
+ */
813
+ const userAgent = userAgentString;
814
+
815
+ const mobileBrands = /iPhone|iPad|iPod|Android/i;
816
+ let isMobileCheck = false;
817
+
818
+ if (userAgentData) {
819
+ isMobileCheck = userAgentData.brands
820
+ .some((/** @type {Record<String, any>} */x) => mobileBrands.test(x.brand));
821
+ } else {
822
+ isMobileCheck = mobileBrands.test(userAgent);
823
+ }
824
+
825
+ /**
826
+ * A global `boolean` for mobile detection.
827
+ * @type {boolean}
828
+ */
829
+ const isMobile = isMobileCheck;
830
+
831
+ const appleBrands = /(iPhone|iPod|iPad)/;
832
+
833
+ /**
834
+ * A global `boolean` for Apple browsers.
835
+ * @type {boolean}
836
+ */
837
+ const isApple = !userAgentData ? appleBrands.test(userAgent)
838
+ : userAgentData.brands.some((/** @type {Record<string, any>} */x) => appleBrands.test(x.brand));
839
+
840
+ /**
841
+ * A global boolean for Gecko browsers. When writing this file,
842
+ * Gecko was not supporting `userAgentData`.
843
+ * @type {boolean}
844
+ */
845
+ const isFirefox = userAgent ? userAgent.includes('Firefox') : false;
846
+
847
+ /**
848
+ * A global `boolean` for CSS3 3D transform support.
849
+ * @type {boolean}
850
+ */
851
+ const support3DTransform = 'webkitPerspective' in documentHead.style || 'perspective' in documentHead.style;
852
+
853
+ /**
854
+ * Add eventListener to an `Element` | `HTMLElement` | `Document` target.
855
+ *
856
+ * @param {HTMLElement | Element | Document | Window} element event.target
857
+ * @param {string} eventName event.type
858
+ * @param {EventListener} listener callback
859
+ * @param {(EventListenerOptions | boolean)=} options other event options
860
+ * @returns {void}
861
+ */
862
+ function on(element, eventName, listener, options) {
863
+ const ops = options || false;
864
+ element.addEventListener(eventName, listener, ops);
865
+ }
866
+
867
+ /**
868
+ * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target.
869
+ *
870
+ * @param {HTMLElement | Element | Document | Window} element event.target
871
+ * @param {string} eventName event.type
872
+ * @param {EventListener} listener callback
873
+ * @param {(EventListenerOptions | boolean)=} options other event options
874
+ * @returns {void}
875
+ */
876
+ function off(element, eventName, listener, options) {
877
+ const ops = options || false;
878
+ element.removeEventListener(eventName, listener, ops);
879
+ }
880
+
881
+ /**
882
+ * Add an `eventListener` to an `Element` | `HTMLElement` | `Document` | `Window`
883
+ * target and remove it once callback is called.
884
+ *
885
+ * @param {HTMLElement | Element | Document | Window} element event.target
886
+ * @param {string} eventName event.type
887
+ * @param {EventListener} listener callback
888
+ * @param {(EventListenerOptions | boolean)=} options other event options
889
+ * @returns {void}
890
+ */
891
+ function one(element, eventName, listener, options) {
892
+ /**
893
+ * Wrap the listener for easy on -> off
894
+ * @type {EventListener}
895
+ */
896
+ const handlerWrapper = (e) => {
897
+ if (e.target === element) {
898
+ listener.apply(element, [e]);
899
+ off(element, eventName, handlerWrapper, options);
900
+ }
901
+ };
902
+ on(element, eventName, handlerWrapper, options);
903
+ }
904
+
905
+ /**
906
+ * A global `boolean` for passive events support,
907
+ * in general event options are not suited for scroll prevention.
908
+ *
909
+ * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
910
+ * @type {boolean}
911
+ */
912
+ const supportPassive = (() => {
913
+ let result = false;
914
+ try {
915
+ const opts = Object.defineProperty({}, 'passive', {
916
+ get() {
917
+ result = true;
918
+ return result;
919
+ },
920
+ });
921
+ one(document, DOMContentLoadedEvent, () => {}, opts);
922
+ } catch (e) {
923
+ throw Error('Passive events are not supported');
924
+ }
925
+
926
+ return result;
927
+ })();
928
+
929
+ /**
930
+ * A global `boolean` for CSS3 transform support.
931
+ * @type {boolean}
932
+ */
933
+ const supportTransform = 'webkitTransform' in documentHead.style || 'transform' in documentHead.style;
934
+
935
+ /**
936
+ * A global `boolean` for touch events support.
937
+ * @type {boolean}
938
+ */
939
+ const supportTouch = 'ontouchstart' in window || 'msMaxTouchPoints' in navigator;
940
+
941
+ /**
942
+ * A global `boolean` for CSS3 animation support.
943
+ * @type {boolean}
944
+ */
945
+ const supportAnimation = 'webkitAnimation' in documentHead.style || 'animation' in documentHead.style;
946
+
947
+ /**
948
+ * A global `boolean` for CSS3 transition support.
949
+ * @type {boolean}
950
+ */
951
+ const supportTransition = 'webkitTransition' in documentHead.style || 'transition' in documentHead.style;
952
+
953
+ /**
954
+ * Shortcut for `HTMLElement.getAttribute()` method.
955
+ * @param {HTMLElement | Element} element target element
956
+ * @param {string} attribute attribute name
957
+ * @returns {string?} attribute value
958
+ */
959
+ const getAttribute = (element, attribute) => element.getAttribute(attribute);
960
+
961
+ /**
962
+ * Shortcut for `HTMLElement.getAttributeNS()` method.
963
+ * @param {string} ns attribute namespace
964
+ * @param {HTMLElement | Element} element target element
965
+ * @param {string} attribute attribute name
966
+ * @returns {string?} attribute value
967
+ */
968
+ const getAttributeNS = (ns, element, attribute) => element.getAttributeNS(ns, attribute);
969
+
970
+ /**
971
+ * Shortcut for `HTMLElement.hasAttribute()` method.
972
+ * @param {HTMLElement | Element} element target element
973
+ * @param {string} attribute attribute name
974
+ * @returns {boolean} the query result
975
+ */
976
+ const hasAttribute = (element, attribute) => element.hasAttribute(attribute);
977
+
978
+ /**
979
+ * Shortcut for `HTMLElement.hasAttributeNS()` method.
980
+ * @param {string} ns attribute namespace
981
+ * @param {HTMLElement | Element} element target element
982
+ * @param {string} att attribute name
983
+ * @returns {boolean} the query result
984
+ */
985
+ const hasAttributeNS = (ns, element, att) => element.hasAttributeNS(ns, att);
986
+
987
+ /**
988
+ * Shortcut for `HTMLElement.setAttribute()` method.
989
+ * @param {HTMLElement | Element} element target element
990
+ * @param {string} attribute attribute name
991
+ * @param {string} value attribute value
992
+ * @returns {void}
993
+ */
994
+ const setAttribute = (element, attribute, value) => element.setAttribute(attribute, value);
995
+
996
+ /**
997
+ * Shortcut for `SVGElement.setAttributeNS()` method.
998
+ * @param {string} ns attribute namespace
999
+ * @param {HTMLElement | Element} element target element
1000
+ * @param {string} att attribute name
1001
+ * @param {string} value attribute value
1002
+ * @returns {void}
1003
+ */
1004
+ const setAttributeNS = (ns, element, att, value) => element.setAttributeNS(ns, att, value);
1005
+
1006
+ /**
1007
+ * Shortcut for `HTMLElement.removeAttribute()` method.
1008
+ * @param {HTMLElement | Element} element target element
1009
+ * @param {string} attribute attribute name
1010
+ * @returns {void}
1011
+ */
1012
+ const removeAttribute = (element, attribute) => element.removeAttribute(attribute);
1013
+
1014
+ /**
1015
+ * Shortcut for `HTMLElement.removeAttributeNS()` method.
1016
+ * @param {string} ns attribute namespace
1017
+ * @param {HTMLElement | Element} element target element
1018
+ * @param {string} att attribute name
1019
+ * @returns {void}
1020
+ */
1021
+ const removeAttributeNS = (ns, element, att) => element.removeAttributeNS(ns, att);
1022
+
1023
+ /**
1024
+ * Add class to `HTMLElement.classList`.
1025
+ *
1026
+ * @param {HTMLElement | Element} element target
1027
+ * @param {string} classNAME to add
1028
+ * @returns {void}
1029
+ */
1030
+ function addClass(element, classNAME) {
1031
+ element.classList.add(classNAME);
1032
+ }
1033
+
1034
+ /**
1035
+ * Remove class from `HTMLElement.classList`.
1036
+ *
1037
+ * @param {HTMLElement | Element} element target
1038
+ * @param {string} classNAME to remove
1039
+ * @returns {void}
1040
+ */
1041
+ function removeClass(element, classNAME) {
1042
+ element.classList.remove(classNAME);
1043
+ }
1044
+
1045
+ /**
1046
+ * Check class in `HTMLElement.classList`.
1047
+ *
1048
+ * @param {HTMLElement | Element} element target
1049
+ * @param {string} classNAME to check
1050
+ * @returns {boolean}
1051
+ */
1052
+ function hasClass(element, classNAME) {
1053
+ return element.classList.contains(classNAME);
1054
+ }
1055
+
1056
+ /**
1057
+ * Shortcut for `Array.from()` static method.
1058
+ *
1059
+ * @param {any[] | HTMLCollection | NodeList | Map<any, any>} arr array-like iterable object
1060
+ * @returns {Array<any>}
1061
+ */
1062
+ const ArrayFrom = (arr) => Array.from(arr);
1063
+
1064
+ /**
1065
+ * Returns the `document` or the `#document` element.
1066
+ * @see https://github.com/floating-ui/floating-ui
1067
+ * @param {(Node | HTMLElement | Element | globalThis)=} node
1068
+ * @returns {Document}
1069
+ */
1070
+ function getDocument(node) {
1071
+ if (node instanceof HTMLElement) return node.ownerDocument;
1072
+ if (node instanceof Window) return node.document;
1073
+ return window.document;
1074
+ }
1075
+
1076
+ /**
1077
+ * Utility to check if target is typeof `HTMLElement`, `Element`, `Node`
1078
+ * or find one that matches a selector.
1079
+ *
1080
+ * @param {HTMLElement | Element | string} selector the input selector or target element
1081
+ * @param {(HTMLElement | Element | Document)=} parent optional node to look into
1082
+ * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result
1083
+ */
1084
+ function querySelector(selector, parent) {
1085
+ const method = 'querySelector';
1086
+ const lookUp = parent && parent[method] ? parent : getDocument();
1087
+ return selector[method] ? selector : lookUp[method](selector);
1088
+ }
1089
+
1090
+ /** @type {Map<string, Map<HTMLElement | Element, Record<string, any>>>} */
1091
+ const componentData = new Map();
1092
+ /**
1093
+ * An interface for web components background data.
1094
+ * @see https://github.com/thednp/bootstrap.native/blob/master/src/components/base-component.js
1095
+ */
1096
+ const Data = {
1097
+ /**
1098
+ * Sets web components data.
1099
+ * @param {HTMLElement | Element | string} target target element
1100
+ * @param {string} component the component's name or a unique key
1101
+ * @param {Record<string, any>} instance the component instance
1102
+ */
1103
+ set: (target, component, instance) => {
1104
+ const element = querySelector(target);
1105
+ if (!element) return;
1106
+
1107
+ if (!componentData.has(component)) {
1108
+ componentData.set(component, new Map());
1109
+ }
1110
+
1111
+ const instanceMap = componentData.get(component);
1112
+ // @ts-ignore - not undefined, but defined right above
1113
+ instanceMap.set(element, instance);
1114
+ },
1115
+
1116
+ /**
1117
+ * Returns all instances for specified component.
1118
+ * @param {string} component the component's name or a unique key
1119
+ * @returns {Map<HTMLElement | Element, Record<string, any>>?} all the component instances
1120
+ */
1121
+ getAllFor: (component) => {
1122
+ const instanceMap = componentData.get(component);
1123
+
1124
+ return instanceMap || null;
1125
+ },
1126
+
1127
+ /**
1128
+ * Returns the instance associated with the target.
1129
+ * @param {HTMLElement | Element | string} target target element
1130
+ * @param {string} component the component's name or a unique key
1131
+ * @returns {Record<string, any>?} the instance
1132
+ */
1133
+ get: (target, component) => {
1134
+ const element = querySelector(target);
1135
+ const allForC = Data.getAllFor(component);
1136
+ const instance = element && allForC && allForC.get(element);
1137
+
1138
+ return instance || null;
1139
+ },
1140
+
1141
+ /**
1142
+ * Removes web components data.
1143
+ * @param {HTMLElement | Element | string} target target element
1144
+ * @param {string} component the component's name or a unique key
1145
+ */
1146
+ remove: (target, component) => {
1147
+ const element = querySelector(target);
1148
+ const instanceMap = componentData.get(component);
1149
+ if (!instanceMap || !element) return;
1150
+
1151
+ instanceMap.delete(element);
1152
+
1153
+ if (instanceMap.size === 0) {
1154
+ componentData.delete(component);
1155
+ }
1156
+ },
1157
+ };
1158
+
1159
+ /**
1160
+ * An alias for `Data.get()`.
1161
+ * @type {SHORTER.getInstance<any>}
1162
+ */
1163
+ const getInstance = (target, component) => Data.get(target, component);
1164
+
1165
+ /**
1166
+ * Shortcut for `Object.assign()` static method.
1167
+ * @param {Record<string, any>} obj a target object
1168
+ * @param {Record<string, any>} source a source object
1169
+ */
1170
+ const ObjectAssign = (obj, source) => Object.assign(obj, source);
1171
+
1172
+ /**
1173
+ * This is a shortie for `document.createElement` method
1174
+ * which allows you to create a new `HTMLElement` for a given `tagName`
1175
+ * or based on an object with specific non-readonly attributes:
1176
+ * `id`, `className`, `textContent`, `style`, etc.
1177
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
1178
+ *
1179
+ * @param {Record<string, string> | string} param `tagName` or object
1180
+ * @return {HTMLElement | Element} a new `HTMLElement` or `Element`
1181
+ */
1182
+ function createElement(param) {
1183
+ if (typeof param === 'string') {
1184
+ return getDocument().createElement(param);
1185
+ }
1186
+
1187
+ const { tagName } = param;
1188
+ const attr = { ...param };
1189
+ const newElement = createElement(tagName);
1190
+ delete attr.tagName;
1191
+ ObjectAssign(newElement, attr);
1192
+ return newElement;
1193
+ }
1194
+
1195
+ /**
1196
+ * This is a shortie for `document.createElementNS` method
1197
+ * which allows you to create a new `HTMLElement` for a given `tagName`
1198
+ * or based on an object with specific non-readonly attributes:
1199
+ * `id`, `className`, `textContent`, `style`, etc.
1200
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS
1201
+ *
1202
+ * @param {string} namespace `namespaceURI` to associate with the new `HTMLElement`
1203
+ * @param {Record<string, string> | string} param `tagName` or object
1204
+ * @return {HTMLElement | Element} a new `HTMLElement` or `Element`
1205
+ */
1206
+ function createElementNS(namespace, param) {
1207
+ if (typeof param === 'string') {
1208
+ return getDocument().createElementNS(namespace, param);
1209
+ }
1210
+
1211
+ const { tagName } = param;
1212
+ const attr = { ...param };
1213
+ const newElement = createElementNS(namespace, tagName);
1214
+ delete attr.tagName;
1215
+ ObjectAssign(newElement, attr);
1216
+ return newElement;
1217
+ }
1218
+
1219
+ /**
1220
+ * Shortcut for the `Element.dispatchEvent(Event)` method.
1221
+ *
1222
+ * @param {HTMLElement | Element} element is the target
1223
+ * @param {Event} event is the `Event` object
1224
+ */
1225
+ const dispatchEvent = (element, event) => element.dispatchEvent(event);
1226
+
1227
+ /**
1228
+ * JavaScript `Array` distinct.
1229
+ * @see https://codeburst.io/javascript-array-distinct-5edc93501dc4
1230
+ * @param {any} value
1231
+ * @param {number} index
1232
+ * @param {any} self
1233
+ * @returns {boolean}
1234
+ */
1235
+ const distinct = (value, index, self) => self.indexOf(value) === index;
1236
+
1237
+ /**
1238
+ * Shortcut for `window.getComputedStyle(element).propertyName`
1239
+ * static method.
1240
+ *
1241
+ * * If `element` parameter is not an `HTMLElement`, `getComputedStyle`
1242
+ * throws a `ReferenceError`.
1243
+ *
1244
+ * @param {HTMLElement | Element} element target
1245
+ * @param {string} property the css property
1246
+ * @return {string} the css property value
1247
+ */
1248
+ function getElementStyle(element, property) {
1249
+ const computedStyle = getComputedStyle(element);
1250
+
1251
+ // @ts-ignore -- must use camelcase strings,
1252
+ // or non-camelcase strings with `getPropertyValue`
1253
+ return property in computedStyle ? computedStyle[property] : '';
1254
+ }
1255
+
1256
+ /**
1257
+ * Utility to get the computed `animationDelay`
1258
+ * from Element in miliseconds.
1259
+ *
1260
+ * @param {HTMLElement | Element} element target
1261
+ * @return {number} the value in miliseconds
1262
+ */
1263
+ function getElementAnimationDelay$1(element) {
1264
+ const propertyValue = getElementStyle(element, animationName$1);
1265
+ const durationValue = getElementStyle(element, animationDelay$1);
1266
+
1267
+ const durationScale = durationValue.includes('ms') ? 1 : 1000;
1268
+ const duration = propertyValue && propertyValue !== 'none'
1269
+ ? parseFloat(durationValue) * durationScale : 0;
1270
+
1271
+ return !Number.isNaN(duration) ? duration : 0;
1272
+ }
1273
+
1274
+ /**
1275
+ * Utility to get the computed `animationDuration`
1276
+ * from `HTMLElement` in miliseconds.
1277
+ *
1278
+ * @param {HTMLElement | Element} element target
1279
+ * @return {number} the value in miliseconds
1280
+ */
1281
+ function getElementAnimationDuration$1(element) {
1282
+ const propertyValue = getElementStyle(element, animationName$1);
1283
+ const durationValue = getElementStyle(element, animationDuration$1);
1284
+ const durationScale = durationValue.includes('ms') ? 1 : 1000;
1285
+ const duration = propertyValue && propertyValue !== 'none'
1286
+ ? parseFloat(durationValue) * durationScale : 0;
1287
+
1288
+ return !Number.isNaN(duration) ? duration : 0;
1289
+ }
1290
+
1291
+ /**
1292
+ * Utility to make sure callbacks are consistently
1293
+ * called when animation ends.
1294
+ *
1295
+ * @param {HTMLElement | Element} element target
1296
+ * @param {EventListener} handler `animationend` callback
1297
+ */
1298
+ function emulateAnimationEnd$1(element, handler) {
1299
+ let called = 0;
1300
+ const endEvent = new Event(animationEndEvent$1);
1301
+ const duration = getElementAnimationDuration$1(element);
1302
+ const delay = getElementAnimationDelay$1(element);
1303
+
1304
+ if (duration) {
1305
+ /**
1306
+ * Wrap the handler in on -> off callback
1307
+ * @type {EventListener}
1308
+ */
1309
+ const animationEndWrapper = (e) => {
1310
+ if (e.target === element) {
1311
+ handler.apply(element, [e]);
1312
+ element.removeEventListener(animationEndEvent$1, animationEndWrapper);
1313
+ called = 1;
1314
+ }
1315
+ };
1316
+ element.addEventListener(animationEndEvent$1, animationEndWrapper);
1317
+ setTimeout(() => {
1318
+ if (!called) element.dispatchEvent(endEvent);
1319
+ }, duration + delay + 17);
1320
+ } else {
1321
+ handler.apply(element, [endEvent]);
1322
+ }
1323
+ }
1324
+
1325
+ /**
1326
+ * Utility to get the computed `animationDelay`
1327
+ * from Element in miliseconds.
1328
+ *
1329
+ * @param {HTMLElement | Element} element target
1330
+ * @return {number} the value in miliseconds
1331
+ */
1332
+ function getElementAnimationDelay(element) {
1333
+ const propertyValue = getElementStyle(element, animationName);
1334
+ const durationValue = getElementStyle(element, animationDelay);
1335
+ const durationScale = durationValue.includes('ms') ? 1 : 1000;
1336
+ const duration = supportAnimation && propertyValue && propertyValue !== 'none'
1337
+ ? parseFloat(durationValue) * durationScale : 0;
1338
+
1339
+ return !Number.isNaN(duration) ? duration : 0;
1340
+ }
1341
+
1342
+ /**
1343
+ * Utility to get the computed `animationDuration`
1344
+ * from `HTMLElement` in miliseconds.
1345
+ *
1346
+ * @param {HTMLElement | Element} element target
1347
+ * @return {number} the value in miliseconds
1348
+ */
1349
+ function getElementAnimationDuration(element) {
1350
+ const propertyValue = getElementStyle(element, animationName);
1351
+ const durationValue = getElementStyle(element, animationDuration);
1352
+ const durationScale = durationValue.includes('ms') ? 1 : 1000;
1353
+ const duration = supportAnimation && propertyValue && propertyValue !== 'none'
1354
+ ? parseFloat(durationValue) * durationScale : 0;
1355
+
1356
+ return !Number.isNaN(duration) ? duration : 0;
1357
+ }
1358
+
1359
+ /**
1360
+ * Utility to make sure callbacks are consistently
1361
+ * called when animation ends.
1362
+ *
1363
+ * @param {HTMLElement | Element} element target
1364
+ * @param {EventListener} handler `animationend` callback
1365
+ */
1366
+ function emulateAnimationEnd(element, handler) {
1367
+ let called = 0;
1368
+ const endEvent = new Event(animationEndEvent);
1369
+ const duration = getElementAnimationDuration(element);
1370
+ const delay = getElementAnimationDelay(element);
1371
+
1372
+ if (supportAnimation && duration) {
1373
+ /**
1374
+ * Wrap the handler in on -> off callback
1375
+ * @param {Event} e Event object
1376
+ */
1377
+ const animationEndWrapper = (e) => {
1378
+ if (e.target === element) {
1379
+ handler.apply(element, [e]);
1380
+ element.removeEventListener(animationEndEvent, animationEndWrapper);
1381
+ called = 1;
1382
+ }
1383
+ };
1384
+ element.addEventListener(animationEndEvent, animationEndWrapper);
1385
+ setTimeout(() => {
1386
+ if (!called) element.dispatchEvent(endEvent);
1387
+ }, duration + delay + 17);
1388
+ } else {
1389
+ handler.apply(element, [endEvent]);
1390
+ }
1391
+ }
1392
+
1393
+ /**
1394
+ * Utility to get the computed `transitionDelay`
1395
+ * from Element in miliseconds.
1396
+ *
1397
+ * @param {HTMLElement | Element} element target
1398
+ * @return {number} the value in miliseconds
1399
+ */
1400
+ function getElementTransitionDelay$1(element) {
1401
+ const propertyValue = getElementStyle(element, transitionProperty$1);
1402
+ const delayValue = getElementStyle(element, transitionDelay$1);
1403
+
1404
+ const delayScale = delayValue.includes('ms') ? 1 : 1000;
1405
+ const duration = propertyValue && propertyValue !== 'none'
1406
+ ? parseFloat(delayValue) * delayScale : 0;
1407
+
1408
+ return !Number.isNaN(duration) ? duration : 0;
1409
+ }
1410
+
1411
+ /**
1412
+ * Utility to get the computed `transitionDuration`
1413
+ * from Element in miliseconds.
1414
+ *
1415
+ * @param {HTMLElement | Element} element target
1416
+ * @return {number} the value in miliseconds
1417
+ */
1418
+ function getElementTransitionDuration$1(element) {
1419
+ const propertyValue = getElementStyle(element, transitionProperty$1);
1420
+ const durationValue = getElementStyle(element, transitionDuration$1);
1421
+ const durationScale = durationValue.includes('ms') ? 1 : 1000;
1422
+ const duration = propertyValue && propertyValue !== 'none'
1423
+ ? parseFloat(durationValue) * durationScale : 0;
1424
+
1425
+ return !Number.isNaN(duration) ? duration : 0;
1426
+ }
1427
+
1428
+ /**
1429
+ * Utility to make sure callbacks are consistently
1430
+ * called when transition ends.
1431
+ *
1432
+ * @param {HTMLElement | Element} element target
1433
+ * @param {EventListener} handler `transitionend` callback
1434
+ */
1435
+ function emulateTransitionEnd$1(element, handler) {
1436
+ let called = 0;
1437
+ const endEvent = new Event(transitionEndEvent$1);
1438
+ const duration = getElementTransitionDuration$1(element);
1439
+ const delay = getElementTransitionDelay$1(element);
1440
+
1441
+ if (duration) {
1442
+ /**
1443
+ * Wrap the handler in on -> off callback
1444
+ * @type {EventListener} e Event object
1445
+ */
1446
+ const transitionEndWrapper = (e) => {
1447
+ if (e.target === element) {
1448
+ handler.apply(element, [e]);
1449
+ element.removeEventListener(transitionEndEvent$1, transitionEndWrapper);
1450
+ called = 1;
1451
+ }
1452
+ };
1453
+ element.addEventListener(transitionEndEvent$1, transitionEndWrapper);
1454
+ setTimeout(() => {
1455
+ if (!called) element.dispatchEvent(endEvent);
1456
+ }, duration + delay + 17);
1457
+ } else {
1458
+ handler.apply(element, [endEvent]);
1459
+ }
1460
+ }
1461
+
1462
+ /**
1463
+ * Utility to get the computed `transitionDelay`
1464
+ * from Element in miliseconds.
1465
+ *
1466
+ * @param {HTMLElement | Element} element target
1467
+ * @return {number} the value in miliseconds
1468
+ */
1469
+ function getElementTransitionDelay(element) {
1470
+ const propertyValue = getElementStyle(element, transitionProperty);
1471
+ const delayValue = getElementStyle(element, transitionDelay);
1472
+ const delayScale = delayValue.includes('ms') ? 1 : 1000;
1473
+ const duration = supportTransition && propertyValue && propertyValue !== 'none'
1474
+ ? parseFloat(delayValue) * delayScale : 0;
1475
+
1476
+ return !Number.isNaN(duration) ? duration : 0;
1477
+ }
1478
+
1479
+ /**
1480
+ * Utility to get the computed `transitionDuration`
1481
+ * from Element in miliseconds.
1482
+ *
1483
+ * @param {HTMLElement | Element} element target
1484
+ * @return {number} the value in miliseconds
1485
+ */
1486
+ function getElementTransitionDuration(element) {
1487
+ const propertyValue = getElementStyle(element, transitionProperty);
1488
+ const durationValue = getElementStyle(element, transitionDuration);
1489
+ const durationScale = durationValue.includes('ms') ? 1 : 1000;
1490
+ const duration = supportTransition && propertyValue && propertyValue !== 'none'
1491
+ ? parseFloat(durationValue) * durationScale : 0;
1492
+
1493
+ return !Number.isNaN(duration) ? duration : 0;
1494
+ }
1495
+
1496
+ /**
1497
+ * Utility to make sure callbacks are consistently
1498
+ * called when transition ends.
1499
+ *
1500
+ * @param {HTMLElement | Element} element target
1501
+ * @param {EventListener} handler `transitionend` callback
1502
+ */
1503
+ function emulateTransitionEnd(element, handler) {
1504
+ let called = 0;
1505
+ const endEvent = new Event(transitionEndEvent);
1506
+ const duration = getElementTransitionDuration(element);
1507
+ const delay = getElementTransitionDelay(element);
1508
+
1509
+ if (supportTransition && duration) {
1510
+ /**
1511
+ * Wrap the handler in on -> off callback
1512
+ * @param {Event} e Event object
1513
+ */
1514
+ const transitionEndWrapper = (e) => {
1515
+ if (e.target === element) {
1516
+ handler.apply(element, [e]);
1517
+ element.removeEventListener(transitionEndEvent, transitionEndWrapper);
1518
+ called = 1;
1519
+ }
1520
+ };
1521
+ element.addEventListener(transitionEndEvent, transitionEndWrapper);
1522
+ setTimeout(() => {
1523
+ if (!called) element.dispatchEvent(endEvent);
1524
+ }, duration + delay + 17);
1525
+ } else {
1526
+ handler.apply(element, [endEvent]);
1527
+ }
1528
+ }
1529
+
1530
+ /**
1531
+ * Shortcut for `Float32Array.from()` static method.
1532
+ * @param {any[] | HTMLCollection | NodeList} arr array-like iterable object
1533
+ * @returns {Float32Array}
1534
+ */
1535
+ const Float32ArrayFrom = (arr) => Float32Array.from(Array.from(arr));
1536
+
1537
+ /**
1538
+ * Shortcut for `Float64Array.from()` static method.
1539
+ * @param {any[] | HTMLCollection | NodeList} arr array-like iterable object
1540
+ * @returns {Float64Array}
1541
+ */
1542
+ const Float64ArrayFrom = (arr) => Float64Array.from(Array.from(arr));
1543
+
1544
+ /**
1545
+ * Utility to focus an `HTMLElement` target.
1546
+ *
1547
+ * @param {HTMLElement | Element} element is the target
1548
+ */
1549
+ // @ts-ignore -- `Element`s resulted from querySelector can focus too
1550
+ const focus = (element) => element.focus();
1551
+
1552
+ /** A generic function with empty body. */
1553
+ const noop = () => {};
1554
+
1555
+ /**
1556
+ * The raw value or a given component option.
1557
+ *
1558
+ * @typedef {string | HTMLElement | Function | number | boolean | null} niceValue
1559
+ */
1560
+
1561
+ /**
1562
+ * Utility to normalize component options
1563
+ *
1564
+ * @param {any} value the input value
1565
+ * @return {niceValue} the normalized value
1566
+ */
1567
+ function normalizeValue(value) {
1568
+ if (value === 'true') { // boolean
1569
+ return true;
1570
+ }
1571
+
1572
+ if (value === 'false') { // boolean
1573
+ return false;
1574
+ }
1575
+
1576
+ if (!Number.isNaN(+value)) { // number
1577
+ return +value;
1578
+ }
1579
+
1580
+ if (value === '' || value === 'null') { // null
1581
+ return null;
1582
+ }
1583
+
1584
+ // string / function / HTMLElement / object
1585
+ return value;
1586
+ }
1587
+
1588
+ /**
1589
+ * Shortcut for `Object.keys()` static method.
1590
+ * @param {Record<string, any>} obj a target object
1591
+ * @returns {string[]}
1592
+ */
1593
+ const ObjectKeys = (obj) => Object.keys(obj);
1594
+
1595
+ /**
1596
+ * Shortcut for `String.toLowerCase()`.
1597
+ *
1598
+ * @param {string} source input string
1599
+ * @returns {string} lowercase output string
1600
+ */
1601
+ const toLowerCase = (source) => source.toLowerCase();
1602
+
1603
+ /**
1604
+ * Utility to normalize component options.
1605
+ *
1606
+ * @param {HTMLElement | Element} element target
1607
+ * @param {Record<string, any>} defaultOps component default options
1608
+ * @param {Record<string, any>} inputOps component instance options
1609
+ * @param {string=} ns component namespace
1610
+ * @return {Record<string, any>} normalized component options object
1611
+ */
1612
+ function normalizeOptions(element, defaultOps, inputOps, ns) {
1613
+ // @ts-ignore -- our targets are always `HTMLElement`
1614
+ const data = { ...element.dataset };
1615
+ /** @type {Record<string, any>} */
1616
+ const normalOps = {};
1617
+ /** @type {Record<string, any>} */
1618
+ const dataOps = {};
1619
+ const title = 'title';
1620
+
1621
+ ObjectKeys(data).forEach((k) => {
1622
+ const key = ns && k.includes(ns)
1623
+ ? k.replace(ns, '').replace(/[A-Z]/, (match) => toLowerCase(match))
1624
+ : k;
1625
+
1626
+ dataOps[key] = normalizeValue(data[k]);
1627
+ });
1628
+
1629
+ ObjectKeys(inputOps).forEach((k) => {
1630
+ inputOps[k] = normalizeValue(inputOps[k]);
1631
+ });
1632
+
1633
+ ObjectKeys(defaultOps).forEach((k) => {
1634
+ if (k in inputOps) {
1635
+ normalOps[k] = inputOps[k];
1636
+ } else if (k in dataOps) {
1637
+ normalOps[k] = dataOps[k];
1638
+ } else {
1639
+ normalOps[k] = k === title
1640
+ ? getAttribute(element, title)
1641
+ : defaultOps[k];
1642
+ }
1643
+ });
1644
+
1645
+ return normalOps;
1646
+ }
1647
+
1648
+ /**
1649
+ * Shortcut for `Object.values()` static method.
1650
+ * @param {Record<string, any>} obj a target object
1651
+ * @returns {any[]}
1652
+ */
1653
+ const ObjectValues = (obj) => Object.values(obj);
1654
+
1655
+ /**
1656
+ * Returns a namespaced `CustomEvent` specific to each component.
1657
+ * @param {string} EventType Event.type
1658
+ * @param {Record<string, any>=} config Event.options | Event.properties
1659
+ * @returns {SHORTER.OriginalEvent} a new namespaced event
1660
+ */
1661
+ function OriginalEvent(EventType, config) {
1662
+ const OriginalCustomEvent = new CustomEvent(EventType, {
1663
+ cancelable: true, bubbles: true,
1664
+ });
1665
+
1666
+ if (config instanceof Object) {
1667
+ ObjectAssign(OriginalCustomEvent, config);
1668
+ }
1669
+ return OriginalCustomEvent;
1670
+ }
1671
+
1672
+ /**
1673
+ * A global namespace for most scroll event listeners.
1674
+ * @type {Partial<AddEventListenerOptions>}
1675
+ */
1676
+ const passiveHandler$1 = { passive: true };
1677
+
1678
+ /**
1679
+ * A global namespace for most scroll event listeners in legacy browsers.
1680
+ * @type {Partial<AddEventListenerOptions> | boolean}
1681
+ */
1682
+ const passiveHandler = supportPassive ? { passive: true } : false;
1683
+
1684
+ /**
1685
+ * Utility to force re-paint of an `HTMLElement` target.
1686
+ *
1687
+ * @param {HTMLElement | Element} element is the target
1688
+ * @return {number} the `Element.offsetHeight` value
1689
+ */
1690
+ // @ts-ignore
1691
+ const reflow = (element) => element.offsetHeight;
1692
+
1693
+ /**
1694
+ * Shortcut for multiple uses of `HTMLElement.style.propertyName` method.
1695
+ * @param {HTMLElement | Element} element target element
1696
+ * @param {Partial<CSSStyleDeclaration>} styles attribute value
1697
+ */
1698
+ // @ts-ignore
1699
+ const setElementStyle = (element, styles) => { ObjectAssign(element.style, styles); };
1700
+
1701
+ /** @type {Map<HTMLElement | Element, any>} */
1702
+ const TimeCache = new Map();
1703
+ /**
1704
+ * An interface for one or more `TimerHandler`s per `Element`.
1705
+ * @see https://github.com/thednp/navbar.js/
1706
+ */
1707
+ const Timer = {
1708
+ /**
1709
+ * Sets a new timeout timer for an element, or element -> key association.
1710
+ * @param {HTMLElement | Element | string} target target element
1711
+ * @param {ReturnType<TimerHandler>} callback the callback
1712
+ * @param {number} delay the execution delay
1713
+ * @param {string=} key a unique key
1714
+ */
1715
+ set: (target, callback, delay, key) => {
1716
+ const element = querySelector(target);
1717
+
1718
+ if (!element) return;
1719
+
1720
+ if (key && key.length) {
1721
+ if (!TimeCache.has(element)) {
1722
+ TimeCache.set(element, new Map());
1723
+ }
1724
+ const keyTimers = TimeCache.get(element);
1725
+ keyTimers.set(key, setTimeout(callback, delay));
1726
+ } else {
1727
+ TimeCache.set(element, setTimeout(callback, delay));
1728
+ }
1729
+ },
1730
+
1731
+ /**
1732
+ * Returns the timer associated with the target.
1733
+ * @param {HTMLElement | Element | string} target target element
1734
+ * @param {string=} key a unique
1735
+ * @returns {number?} the timer
1736
+ */
1737
+ get: (target, key) => {
1738
+ const element = querySelector(target);
1739
+
1740
+ if (!element) return null;
1741
+ const keyTimers = TimeCache.get(element);
1742
+
1743
+ if (key && key.length && keyTimers && keyTimers.get) {
1744
+ return keyTimers.get(key) || null;
1745
+ }
1746
+ return keyTimers || null;
1747
+ },
1748
+
1749
+ /**
1750
+ * Clears the element's timer.
1751
+ * @param {HTMLElement | Element | string} target target element
1752
+ * @param {string=} key a unique key
1753
+ */
1754
+ clear: (target, key) => {
1755
+ const element = querySelector(target);
1756
+
1757
+ if (!element) return;
1758
+
1759
+ if (key && key.length) {
1760
+ const keyTimers = TimeCache.get(element);
1761
+
1762
+ if (keyTimers && keyTimers.get) {
1763
+ clearTimeout(keyTimers.get(key));
1764
+ keyTimers.delete(key);
1765
+ if (keyTimers.size === 0) {
1766
+ TimeCache.delete(element);
1767
+ }
1768
+ }
1769
+ } else {
1770
+ clearTimeout(TimeCache.get(element));
1771
+ TimeCache.delete(element);
1772
+ }
1773
+ },
1774
+ };
1775
+
1776
+ /**
1777
+ * Shortcut for `String.toUpperCase()`.
1778
+ *
1779
+ * @param {string} source input string
1780
+ * @returns {string} uppercase output string
1781
+ */
1782
+ const toUpperCase = (source) => source.toUpperCase();
1783
+
1784
+ /**
1785
+ * Utility to wrap a callback in a try() catch(e)
1786
+ *
1787
+ * @param {Function} fn callback
1788
+ * @param {string} origin callback context description
1789
+ */
1790
+ function tryWrapper(fn, origin) {
1791
+ try { fn(); } catch (e) {
1792
+ throw TypeError(`${origin} ${e}`);
1793
+ }
1794
+ }
1795
+
1796
+ /**
1797
+ * Returns the bounding client rect of a target `HTMLElement`.
1798
+ *
1799
+ * @see https://github.com/floating-ui/floating-ui
1800
+ *
1801
+ * @param {HTMLElement | Element} element event.target
1802
+ * @param {boolean=} includeScale when *true*, the target scale is also computed
1803
+ * @returns {SHORTER.BoundingClientRect} the bounding client rect object
1804
+ */
1805
+ function getBoundingClientRect(element, includeScale) {
1806
+ const {
1807
+ width, height, top, right, bottom, left,
1808
+ } = element.getBoundingClientRect();
1809
+ let scaleX = 1;
1810
+ let scaleY = 1;
1811
+
1812
+ if (includeScale && element instanceof HTMLElement) {
1813
+ const { offsetWidth, offsetHeight } = element;
1814
+ scaleX = offsetWidth > 0 ? Math.round(width) / offsetWidth || 1 : 1;
1815
+ scaleY = offsetHeight > 0 ? Math.round(height) / offsetHeight || 1 : 1;
1816
+ }
1817
+
1818
+ return {
1819
+ width: width / scaleX,
1820
+ height: height / scaleY,
1821
+ top: top / scaleY,
1822
+ right: right / scaleX,
1823
+ bottom: bottom / scaleY,
1824
+ left: left / scaleX,
1825
+ x: left / scaleX,
1826
+ y: top / scaleY,
1827
+ };
1828
+ }
1829
+
1830
+ /**
1831
+ * Returns the `document.body` or the `<body>` element.
1832
+ *
1833
+ * @param {(Node | HTMLElement | Element | globalThis)=} node
1834
+ * @returns {HTMLElement | HTMLBodyElement}
1835
+ */
1836
+ function getDocumentBody(node) {
1837
+ return getDocument(node).body;
1838
+ }
1839
+
1840
+ /**
1841
+ * Returns the `document.documentElement` or the `<html>` element.
1842
+ *
1843
+ * @param {(Node | HTMLElement | Element | globalThis)=} node
1844
+ * @returns {HTMLElement | HTMLHtmlElement}
1845
+ */
1846
+ function getDocumentElement(node) {
1847
+ return getDocument(node).documentElement;
1848
+ }
1849
+
1850
+ /**
1851
+ * Returns the `document.head` or the `<head>` element.
1852
+ *
1853
+ * @param {(Node | HTMLElement | Element | globalThis)=} node
1854
+ * @returns {HTMLElement | HTMLHeadElement}
1855
+ */
1856
+ function getDocumentHead(node) {
1857
+ return getDocument(node).head;
1858
+ }
1859
+
1860
+ /**
1861
+ * Returns an `{x,y}` object with the target
1862
+ * `HTMLElement` / `Node` scroll position.
1863
+ *
1864
+ * @see https://github.com/floating-ui/floating-ui
1865
+ *
1866
+ * @param {HTMLElement | Element | Window} element target node / element
1867
+ * @returns {{x: number, y: number}} the scroll tuple
1868
+ */
1869
+ function getNodeScroll(element) {
1870
+ const isWin = 'scrollX' in element;
1871
+ const x = isWin ? element.scrollX : element.scrollLeft;
1872
+ const y = isWin ? element.scrollY : element.scrollTop;
1873
+
1874
+ return { x, y };
1875
+ }
1876
+
1877
+ /**
1878
+ * Returns the `Window` object of a target node.
1879
+ * @see https://github.com/floating-ui/floating-ui
1880
+ *
1881
+ * @param {(Node | HTMLElement | Element | Window)=} node target node
1882
+ * @returns {globalThis}
1883
+ */
1884
+ function getWindow(node) {
1885
+ if (node == null) {
1886
+ return window;
1887
+ }
1888
+
1889
+ if (!(node instanceof Window)) {
1890
+ const { ownerDocument } = node;
1891
+ return ownerDocument ? ownerDocument.defaultView || window : window;
1892
+ }
1893
+
1894
+ // @ts-ignore
1895
+ return node;
1896
+ }
1897
+
1898
+ /**
1899
+ * Check if target is a `ShadowRoot`.
1900
+ *
1901
+ * @param {any} element target
1902
+ * @returns {boolean} the query result
1903
+ */
1904
+ const isShadowRoot = (element) => {
1905
+ const OwnElement = getWindow(element).ShadowRoot;
1906
+ return element instanceof OwnElement || element instanceof ShadowRoot;
1907
+ };
1908
+
1909
+ /**
1910
+ * Returns the `parentNode` also going through `ShadowRoot`.
1911
+ * @see https://github.com/floating-ui/floating-ui
1912
+ *
1913
+ * @param {Node | HTMLElement | Element} node the target node
1914
+ * @returns {Node | HTMLElement | Element} the apropriate parent node
1915
+ */
1916
+ function getParentNode(node) {
1917
+ if (node.nodeName === 'HTML') {
1918
+ return node;
1919
+ }
1920
+
1921
+ // this is a quicker (but less type safe) way to save quite some bytes from the bundle
1922
+ return (
1923
+ // @ts-ignore
1924
+ node.assignedSlot // step into the shadow DOM of the parent of a slotted node
1925
+ || node.parentNode // @ts-ignore DOM Element detected
1926
+ || (isShadowRoot(node) ? node.host : null) // ShadowRoot detected
1927
+ || getDocumentElement(node) // fallback
1928
+ );
1929
+ }
1930
+
1931
+ /**
1932
+ * Checks if a target `HTMLElement` is affected by scale.
1933
+ * @see https://github.com/floating-ui/floating-ui
1934
+ *
1935
+ * @param {HTMLElement} element target
1936
+ * @returns {boolean} the query result
1937
+ */
1938
+ function isScaledElement(element) {
1939
+ const { width, height } = getBoundingClientRect(element);
1940
+ const { offsetWidth, offsetHeight } = element;
1941
+ return Math.round(width) !== offsetWidth
1942
+ || Math.round(height) !== offsetHeight;
1943
+ }
1944
+
1945
+ /**
1946
+ * Returns the rect relative to an offset parent.
1947
+ * @see https://github.com/floating-ui/floating-ui
1948
+ *
1949
+ * @param {HTMLElement | Element} element target
1950
+ * @param {HTMLElement | Element | Window} offsetParent the container / offset parent
1951
+ * @param {{x: number, y: number}} scroll
1952
+ * @returns {SHORTER.OffsetRect}
1953
+ */
1954
+ function getRectRelativeToOffsetParent(element, offsetParent, scroll) {
1955
+ const isParentAnElement = offsetParent instanceof HTMLElement;
1956
+ const rect = getBoundingClientRect(element, isParentAnElement && isScaledElement(offsetParent));
1957
+ const offsets = { x: 0, y: 0 };
1958
+
1959
+ if (isParentAnElement) {
1960
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1961
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1962
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1963
+ }
1964
+
1965
+ return {
1966
+ x: rect.left + scroll.x - offsets.x,
1967
+ y: rect.top + scroll.y - offsets.y,
1968
+ width: rect.width,
1969
+ height: rect.height,
1970
+ };
1971
+ }
1972
+
1973
+ let elementUID = 0;
1974
+ let elementMapUID = 0;
1975
+ const elementIDMap = new Map();
1976
+
1977
+ /**
1978
+ * Returns a unique identifier for popover, tooltip, scrollspy.
1979
+ *
1980
+ * @param {HTMLElement | Element} element target element
1981
+ * @param {string=} key predefined key
1982
+ * @returns {number} an existing or new unique ID
1983
+ */
1984
+ function getUID(element, key) {
1985
+ let result = key ? elementUID : elementMapUID;
1986
+
1987
+ if (key) {
1988
+ const elID = getUID(element);
1989
+ const elMap = elementIDMap.get(elID) || new Map();
1990
+ if (!elementIDMap.has(elID)) {
1991
+ elementIDMap.set(elID, elMap);
1992
+ }
1993
+ if (!elMap.has(key)) {
1994
+ elMap.set(key, result);
1995
+ elementUID += 1;
1996
+ } else result = elMap.get(key);
1997
+ } else {
1998
+ const elkey = element.id || element;
1999
+
2000
+ if (!elementIDMap.has(elkey)) {
2001
+ elementIDMap.set(elkey, result);
2002
+ elementMapUID += 1;
2003
+ } else result = elementIDMap.get(elkey);
2004
+ }
2005
+ return result;
2006
+ }
2007
+
2008
+ /**
2009
+ * Shortcut for `Array.isArray()` static method.
2010
+ *
2011
+ * @param {any} arr array-like iterable object
2012
+ * @returns {boolean} the query result
2013
+ */
2014
+ const isArray = (arr) => Array.isArray(arr);
2015
+
2016
+ /**
2017
+ * Checks if an object is a `Document`.
2018
+ *
2019
+ * @param {any} element the target object
2020
+ * @returns {boolean} the query result
2021
+ */
2022
+ const isDocument = (element) => element instanceof Document;
2023
+
2024
+ /**
2025
+ * Checks if an object is a `CustomElement`.
2026
+ *
2027
+ * @param {any} element the target object
2028
+ * @returns {boolean} the query result
2029
+ */
2030
+ const isCustomElement = (element) => element && !!element.shadowRoot;
2031
+
2032
+ /**
2033
+ * Checks if an object is an `Element`.
2034
+ *
2035
+ * @param {any} element the target object
2036
+ * @returns {boolean} the query result
2037
+ */
2038
+ const isElement = (element) => element instanceof Element;
2039
+
2040
+ /**
2041
+ * Utility to determine if an `HTMLElement`
2042
+ * is partially visible in viewport.
2043
+ *
2044
+ * @param {HTMLElement | Element} element target
2045
+ * @return {boolean} the query result
2046
+ */
2047
+ const isElementInScrollRange = (element) => {
2048
+ const { top, bottom } = getBoundingClientRect(element);
2049
+ const { clientHeight } = getDocumentElement(element);
2050
+ // checks bottom && top
2051
+ return top <= clientHeight && bottom >= 0;
2052
+ };
2053
+
2054
+ /**
2055
+ * Utility to determine if an `HTMLElement`
2056
+ * is fully visible in the viewport.
2057
+ *
2058
+ * @param {HTMLElement | Element} element target
2059
+ * @return {boolean} the query result
2060
+ */
2061
+ const isElementInViewport = (element) => {
2062
+ const {
2063
+ top, left, bottom, right,
2064
+ } = getBoundingClientRect(element, true);
2065
+ const { clientWidth, clientHeight } = getDocumentElement(element);
2066
+ return (
2067
+ top >= 0 && left >= 0
2068
+ && bottom <= clientHeight
2069
+ && right <= clientWidth
2070
+ );
2071
+ };
2072
+
2073
+ /**
2074
+ * Checks if an object is an `Array` in which all items are `Element`.
2075
+ *
2076
+ * @param {any} object the target object
2077
+ * @returns {boolean} the query result
2078
+ */
2079
+ const isElementsArray = (object) => Array.isArray(object)
2080
+ && object.every((el) => [HTMLElement, Element].some((x) => el instanceof x));
2081
+
2082
+ /**
2083
+ * Checks if an object is an `HTMLCollection`.
2084
+ *
2085
+ * @param {any} object the target object
2086
+ * @returns {boolean} the query result
2087
+ */
2088
+ const isHTMLCollection = (object) => object instanceof HTMLCollection;
2089
+
2090
+ /**
2091
+ * Checks if an element is an `HTMLElement`.
2092
+ *
2093
+ * @param {any} element the target object
2094
+ * @returns {boolean} the query result
2095
+ */
2096
+ const isHTMLElement = (element) => element instanceof HTMLElement;
2097
+
2098
+ /**
2099
+ * Check if a target element is an `<img>`.
2100
+ * @param {any} element the target element
2101
+ * @returns {boolean} the query result
2102
+ */
2103
+ const isHTMLImageElement = (element) => element instanceof HTMLImageElement;
2104
+
2105
+ /**
2106
+ * Checks if an element is an `<svg>` (or any type of SVG element),
2107
+ * `<img>` or `<video>`.
2108
+ *
2109
+ * *Tooltip* / *Popover* works different with media elements.
2110
+ * @param {any} element the target element
2111
+ * @returns {boolean} the query result
2112
+ */
2113
+ const isMedia = (element) => element
2114
+ && [SVGElement, HTMLImageElement, HTMLVideoElement]
2115
+ .some((mediaType) => element instanceof mediaType);
2116
+
2117
+ /**
2118
+ * Checks if an object is a `Node`.
2119
+ *
2120
+ * @param {any} node the target object
2121
+ * @returns {boolean} the query result
2122
+ */
2123
+ const isNode = (node) => node instanceof Node;
2124
+
2125
+ /**
2126
+ * Checks if an object is a `NodeList`.
2127
+ *
2128
+ * @param {any} object the target object
2129
+ * @returns {boolean} the query result
2130
+ */
2131
+ const isNodeList = (object) => object instanceof NodeList;
2132
+
2133
+ /**
2134
+ * Checks if a page is Right To Left.
2135
+ * @param {(HTMLElement | Element)=} node the target
2136
+ * @returns {boolean} the query result
2137
+ */
2138
+ const isRTL = (node) => getDocumentElement(node).dir === 'rtl';
2139
+
2140
+ /**
2141
+ * Shortcut for `typeof SOMETHING === string` static method.
2142
+ *
2143
+ * @param {any} str array-like iterable object
2144
+ * @returns {boolean} the query result
2145
+ */
2146
+ const isString = (str) => typeof str === 'string';
2147
+
2148
+ /**
2149
+ * Check if an element is an `<svg>` or any other SVG element.
2150
+ * @param {any} element the target element
2151
+ * @returns {boolean} the query result
2152
+ */
2153
+ const isSVGElement = (element) => element instanceof SVGElement;
2154
+
2155
+ /**
2156
+ * Check if a target element is a `<table>`, `<td>` or `<th>`.
2157
+ * @param {any} element the target element
2158
+ * @returns {boolean} the query result
2159
+ */
2160
+ const isTableElement = (element) => ['TABLE', 'TD', 'TH'].includes(element.tagName);
2161
+
2162
+ /**
2163
+ * Check if a target node is `window`.
2164
+ *
2165
+ * @param {any} node the target node
2166
+ * @returns {boolean} the query result
2167
+ */
2168
+ function isWindow(node) {
2169
+ return node instanceof Window;
2170
+ }
2171
+
2172
+ /**
2173
+ * Shortcut for `HTMLElement.closest` method which also works
2174
+ * with children of `ShadowRoot`. The order of the parameters
2175
+ * is intentional since they're both required.
2176
+ *
2177
+ * @see https://stackoverflow.com/q/54520554/803358
2178
+ *
2179
+ * @param {HTMLElement | Element} element Element to look into
2180
+ * @param {string} selector the selector name
2181
+ * @return {(HTMLElement | Element)?} the query result
2182
+ */
2183
+ function closest(element, selector) {
2184
+ return element ? (element.closest(selector)
2185
+ // @ts-ignore -- break out of `ShadowRoot`
2186
+ || closest(element.getRootNode().host, selector)) : null;
2187
+ }
2188
+
2189
+ /**
2190
+ * Shortcut for `HTMLElement.getElementsByTagName` method. Some `Node` elements
2191
+ * like `ShadowRoot` do not support `getElementsByTagName`.
2192
+ *
2193
+ * @param {string} selector the tag name
2194
+ * @param {(HTMLElement | Element | Document)=} parent optional Element to look into
2195
+ * @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection'
2196
+ */
2197
+ function getElementsByTagName(selector, parent) {
2198
+ const method = 'getElementsByTagName';
2199
+ const lookUp = parent && parent[method] ? parent : getDocument();
2200
+ return lookUp[method](selector);
2201
+ }
2202
+
2203
+ /**
2204
+ * An `HTMLCollection` with all document elements,
2205
+ * which is the equivalent of `document.all`.
2206
+ */
2207
+ const documentAll = getElementsByTagName('*');
2208
+
2209
+ /**
2210
+ * A global array with `Element` | `HTMLElement`.
2211
+ */
2212
+ const elementNodes = [Element, HTMLElement];
2213
+
2214
+ /**
2215
+ * A global array of possible `ParentNode`.
2216
+ */
2217
+ const parentNodes = [Document, Element, HTMLElement];
2218
+
2219
+ /**
2220
+ * Returns an `Array` of `Node` elements that are registered as
2221
+ * `CustomElement`.
2222
+ * @see https://stackoverflow.com/questions/27334365/how-to-get-list-of-registered-custom-elements
2223
+ *
2224
+ * @param {(HTMLElement | Element | Node | Document)=} parent parent to look into
2225
+ * @returns {Array<HTMLElement | Element>} the query result
2226
+ */
2227
+ function getCustomElements(parent) {
2228
+ const collection = parent && parentNodes.some((x) => parent instanceof x)
2229
+ ? getElementsByTagName('*', parent) : documentAll;
2230
+ return [...collection].filter(isCustomElement);
2231
+ }
2232
+
2233
+ /**
2234
+ * Returns an `Element` that matches the id in the document.
2235
+ *
2236
+ * @param {string} id
2237
+ * @returns {(HTMLElement | Element)?}
2238
+ */
2239
+ function getElementById(id) {
2240
+ return getDocument().getElementById(id);
2241
+ }
2242
+
2243
+ /**
2244
+ * A shortcut for `(document|Element).querySelectorAll`.
2245
+ *
2246
+ * @param {string} selector the input selector
2247
+ * @param {(HTMLElement | Element | Document | Node)=} parent optional node to look into
2248
+ * @return {NodeListOf<HTMLElement | Element>} the query result
2249
+ */
2250
+ function querySelectorAll(selector, parent) {
2251
+ const method = 'querySelectorAll';
2252
+ const lookUp = parent && parent[method] ? parent : getDocument();
2253
+ return lookUp[method](selector);
2254
+ }
2255
+
2256
+ /**
2257
+ * Shortcut for `HTMLElement.getElementsByClassName` method. Some `Node` elements
2258
+ * like `ShadowRoot` do not support `getElementsByClassName`.
2259
+ *
2260
+ * @param {string} selector the class name
2261
+ * @param {(HTMLElement | Element | Document)=} parent optional Element to look into
2262
+ * @return {HTMLCollectionOf<HTMLElement | Element>} the 'HTMLCollection'
2263
+ */
2264
+ function getElementsByClassName(selector, parent) {
2265
+ const method = 'getElementsByClassName';
2266
+ const lookUp = parent && parent[method] ? parent : getDocument();
2267
+ return lookUp[method](selector);
2268
+ }
2269
+
2270
+ /**
2271
+ * Check if element matches a CSS selector.
2272
+ *
2273
+ * @param {HTMLElement | Element} target
2274
+ * @param {string} selector
2275
+ * @returns {boolean}
2276
+ */
2277
+ function matches$1(target, selector) {
2278
+ return target.matches(selector);
2279
+ }
2280
+
2281
+ // @ts-nocheck
2282
+ const ElementProto = Element.prototype;
2283
+ const matchesFn = ElementProto.matches
2284
+ || ElementProto.matchesSelector
2285
+ || ElementProto.webkitMatchesSelector
2286
+ || ElementProto.mozMatchesSelector
2287
+ || ElementProto.msMatchesSelector
2288
+ || ElementProto.oMatchesSelector
2289
+ || function matchesNotSupported() {
2290
+ return false;
2291
+ };
2292
+
2293
+ /**
2294
+ * Check if element matches a CSS selector,
2295
+ * supporting a range of legacy browsers.
2296
+ *
2297
+ * @param {HTMLElement | Element} target
2298
+ * @param {string} selector
2299
+ * @returns {boolean}
2300
+ */
2301
+ function matches(target, selector) {
2302
+ return matchesFn.call(target, selector);
2303
+ }
2304
+
2305
+ var version = "1.0.0";
2306
+
2307
+ // @ts-ignore
2308
+
2309
+ /**
2310
+ * A global namespace for library version.
2311
+ * @type {string}
2312
+ */
2313
+ const Version = version;
2314
+
2315
+ // strings
2316
+
2317
+ const SHORTER = {
2318
+ ariaChecked,
2319
+ ariaDescription,
2320
+ ariaDescribedBy,
2321
+ ariaExpanded,
2322
+ ariaHidden,
2323
+ ariaHasPopup,
2324
+ ariaLabel,
2325
+ ariaLabelledBy,
2326
+ ariaModal,
2327
+ ariaPressed,
2328
+ ariaSelected,
2329
+ ariaValueMin,
2330
+ ariaValueMax,
2331
+ ariaValueNow,
2332
+ ariaValueText,
2333
+ nativeEvents,
2334
+ abortEvent,
2335
+ blurEvent,
2336
+ moveEvent,
2337
+ changeEvent,
2338
+ errorEvent,
2339
+ resetEvent,
2340
+ resizeEvent,
2341
+ scrollEvent,
2342
+ submitEvent,
2343
+ loadEvent,
2344
+ loadstartEvent,
2345
+ unloadEvent,
2346
+ readystatechangeEvent,
2347
+ beforeunloadEvent,
2348
+ orientationchangeEvent,
2349
+ contextmenuEvent,
2350
+ DOMContentLoadedEvent,
2351
+ DOMMouseScrollEvent,
2352
+ selectEvent,
2353
+ selectendEvent,
2354
+ selectstartEvent,
2355
+ mouseClickEvents,
2356
+ mouseclickEvent,
2357
+ mousedblclickEvent,
2358
+ mousedownEvent,
2359
+ mouseupEvent,
2360
+ mousehoverEvent,
2361
+ mouseHoverEvents,
2362
+ mouseenterEvent,
2363
+ mouseleaveEvent,
2364
+ mouseinEvent,
2365
+ mouseoutEvent,
2366
+ mouseoverEvent,
2367
+ mousemoveEvent,
2368
+ mousewheelEvent,
2369
+ mouseSwipeEvents,
2370
+ touchEvents,
2371
+ touchstartEvent,
2372
+ touchmoveEvent,
2373
+ touchcancelEvent,
2374
+ touchendEvent,
2375
+ pointercancelEvent,
2376
+ pointerdownEvent,
2377
+ pointerleaveEvent,
2378
+ pointermoveEvent,
2379
+ pointerupEvent,
2380
+ focusEvents,
2381
+ focusEvent,
2382
+ focusinEvent,
2383
+ focusoutEvent,
2384
+ gesturechangeEvent,
2385
+ gestureendEvent,
2386
+ gesturestartEvent,
2387
+ bezierEasings,
2388
+ animationDuration: animationDuration$1,
2389
+ animationDurationLegacy: animationDuration,
2390
+ animationDelay: animationDelay$1,
2391
+ animationDelayLegacy: animationDelay,
2392
+ animationName: animationName$1,
2393
+ animationNameLegacy: animationName,
2394
+ animationEndEvent: animationEndEvent$1,
2395
+ animationEndEventLegacy: animationEndEvent,
2396
+ transitionDuration: transitionDuration$1,
2397
+ transitionDurationLegacy: transitionDuration,
2398
+ transitionDelay: transitionDelay$1,
2399
+ transitionDelayLegacy: transitionDelay,
2400
+ transitionEndEvent: transitionEndEvent$1,
2401
+ transitionEndEventLegacy: transitionEndEvent,
2402
+ transitionProperty: transitionProperty$1,
2403
+ transitionPropertyLegacy: transitionProperty,
2404
+ isMobile,
2405
+ isApple,
2406
+ isFirefox,
2407
+ support3DTransform,
2408
+ supportPassive,
2409
+ supportTransform,
2410
+ supportTouch,
2411
+ supportAnimation,
2412
+ supportTransition,
2413
+ addEventListener,
2414
+ removeEventListener,
2415
+ keyboardEventKeys,
2416
+ keydownEvent,
2417
+ keypressEvent,
2418
+ keyupEvent,
2419
+ keyAlt,
2420
+ keyArrowDown,
2421
+ keyArrowLeft,
2422
+ keyArrowRight,
2423
+ keyArrowUp,
2424
+ keyBackspace,
2425
+ keyCapsLock,
2426
+ keyControl,
2427
+ keyDelete,
2428
+ keyEnter,
2429
+ keyEscape,
2430
+ keyInsert,
2431
+ keyMeta,
2432
+ keyPause,
2433
+ keyScrollLock,
2434
+ keyShift,
2435
+ keySpace,
2436
+ keyTab,
2437
+ offsetHeight,
2438
+ offsetWidth,
2439
+ scrollHeight,
2440
+ scrollWidth,
2441
+ userAgentData,
2442
+ userAgent,
2443
+ addClass,
2444
+ removeClass,
2445
+ hasClass,
2446
+ on,
2447
+ off,
2448
+ one,
2449
+ dispatchEvent,
2450
+ distinct,
2451
+ Data,
2452
+ getInstance,
2453
+ createElement,
2454
+ createElementNS,
2455
+ toUpperCase,
2456
+ toLowerCase,
2457
+ Timer,
2458
+ emulateAnimationEnd: emulateAnimationEnd$1,
2459
+ emulateAnimationEndLegacy: emulateAnimationEnd,
2460
+ emulateTransitionEnd: emulateTransitionEnd$1,
2461
+ emulateTransitionEndLegacy: emulateTransitionEnd,
2462
+ isElementInScrollRange,
2463
+ isElementInViewport,
2464
+ passiveHandler: passiveHandler$1,
2465
+ passiveHandlerLegacy: passiveHandler,
2466
+ getElementAnimationDuration: getElementAnimationDuration$1,
2467
+ getElementAnimationDurationLegacy: getElementAnimationDuration,
2468
+ getElementAnimationDelay: getElementAnimationDelay$1,
2469
+ getElementAnimationDelayLegacy: getElementAnimationDelay,
2470
+ getElementTransitionDuration: getElementTransitionDuration$1,
2471
+ getElementTransitionDurationLegacy: getElementTransitionDuration,
2472
+ getElementTransitionDelay: getElementTransitionDelay$1,
2473
+ getElementTransitionDelayLegacy: getElementTransitionDelay,
2474
+ getNodeScroll,
2475
+ getParentNode,
2476
+ getRectRelativeToOffsetParent,
2477
+ getWindow,
2478
+ isArray,
2479
+ isString,
2480
+ isCustomElement,
2481
+ isElement,
2482
+ isNode,
2483
+ isHTMLElement,
2484
+ isHTMLImageElement,
2485
+ isSVGElement,
2486
+ isNodeList,
2487
+ isHTMLCollection,
2488
+ isScaledElement,
2489
+ isTableElement,
2490
+ isShadowRoot,
2491
+ isDocument,
2492
+ isElementsArray,
2493
+ isWindow,
2494
+ isMedia,
2495
+ isRTL,
2496
+ elementNodes,
2497
+ parentNodes,
2498
+ closest,
2499
+ documentAll,
2500
+ querySelector,
2501
+ getCustomElements,
2502
+ getElementById,
2503
+ querySelectorAll,
2504
+ getElementsByClassName,
2505
+ getElementsByTagName,
2506
+ matches: matches$1,
2507
+ matchesLegacy: matches,
2508
+ normalizeValue,
2509
+ normalizeOptions,
2510
+ tryWrapper,
2511
+ reflow,
2512
+ noop,
2513
+ focus,
2514
+ getUID,
2515
+ ArrayFrom,
2516
+ Float32ArrayFrom,
2517
+ Float64ArrayFrom,
2518
+ ObjectAssign,
2519
+ ObjectKeys,
2520
+ ObjectValues,
2521
+ OriginalEvent,
2522
+ getBoundingClientRect,
2523
+ getDocument,
2524
+ getDocumentBody,
2525
+ getDocumentElement,
2526
+ getDocumentHead,
2527
+ getElementStyle,
2528
+ setElementStyle,
2529
+ hasAttribute,
2530
+ hasAttributeNS,
2531
+ getAttribute,
2532
+ getAttributeNS,
2533
+ setAttribute,
2534
+ setAttributeNS,
2535
+ removeAttribute,
2536
+ removeAttributeNS,
2537
+ Version,
2538
+ };
2539
+
2540
+ export { SHORTER as default };