@creative-web-solution/front-library 7.0.6 → 7.1.2

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 (141) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/DOM/Class.ts +10 -12
  3. package/DOM/DocumentSize.ts +3 -1
  4. package/DOM/Filter.ts +0 -2
  5. package/DOM/Index.ts +1 -3
  6. package/DOM/Manipulation.ts +0 -3
  7. package/DOM/Matrix.ts +12 -12
  8. package/DOM/Offset.ts +4 -5
  9. package/DOM/OuterSize.ts +12 -12
  10. package/DOM/PageToDOM.ts +2 -2
  11. package/DOM/Position.ts +3 -3
  12. package/DOM/Size.ts +3 -7
  13. package/DOM/StrToDOM.ts +0 -1
  14. package/DOM/Styles.ts +3 -12
  15. package/DOM/Traversing.ts +0 -6
  16. package/DOM/WindowScroll.ts +3 -1
  17. package/DOM/WindowSize.ts +3 -1
  18. package/DOM/Wrap.ts +0 -1
  19. package/Events/DeviceOrientation.ts +27 -31
  20. package/Events/EventsManager.ts +10 -25
  21. package/Events/Gesture.ts +36 -37
  22. package/Events/HistoryController.ts +11 -17
  23. package/Events/ImageLoad.ts +35 -19
  24. package/Events/IntersectObserver.ts +15 -19
  25. package/Events/KeyboardHandler.ts +10 -8
  26. package/Events/MediaQueriesEvents.ts +53 -51
  27. package/Events/OnAnimationEnd.ts +5 -6
  28. package/Events/OnTransitionEnd.ts +3 -3
  29. package/Events/PubSub.ts +5 -8
  30. package/Events/TouchHover.ts +18 -21
  31. package/Events/WindowEvents.ts +26 -30
  32. package/Helpers/Colors.ts +7 -23
  33. package/Helpers/Cookie.ts +5 -12
  34. package/Helpers/Coordinates.ts +0 -7
  35. package/Helpers/Debounce.ts +3 -7
  36. package/Helpers/Defer.ts +1 -1
  37. package/Helpers/GetValue.ts +0 -2
  38. package/Helpers/Insert.ts +0 -1
  39. package/Helpers/Sequential.ts +0 -2
  40. package/Helpers/Slice.ts +0 -3
  41. package/Helpers/Throttle.ts +0 -1
  42. package/Helpers/TransitionHelpers.ts +95 -0
  43. package/Helpers/Type.ts +1 -14
  44. package/Helpers/Unique.ts +3 -3
  45. package/Helpers/UrlParser.ts +14 -23
  46. package/Helpers/Wait.ts +1 -1
  47. package/Modules/Accordion/Tab.ts +19 -17
  48. package/Modules/Accordion/index.ts +27 -19
  49. package/Modules/Autocomplete.ts +95 -101
  50. package/Modules/DragSlider.ts +72 -63
  51. package/Modules/GlobalState.ts +60 -53
  52. package/Modules/LoadGMap.ts +4 -7
  53. package/Modules/Notifications/Notification.ts +28 -32
  54. package/Modules/Notifications/index.ts +43 -36
  55. package/Modules/Popin/Popin.ts +100 -110
  56. package/Modules/Popin/PopinAccessibility.ts +8 -8
  57. package/Modules/Popin/PopinBackground.ts +12 -12
  58. package/Modules/Popin/PopinController.ts +24 -30
  59. package/Modules/Popin/Tools.ts +18 -19
  60. package/Modules/QuickTemplate.ts +4 -6
  61. package/Modules/ScrollSnap.ts +110 -104
  62. package/Modules/SkinCheckbox.ts +52 -38
  63. package/Modules/SkinFile.ts +63 -53
  64. package/Modules/SkinRadio.ts +63 -43
  65. package/Modules/SkinSelect.ts +117 -101
  66. package/Modules/Slider/Slide.ts +49 -52
  67. package/Modules/Slider/Slider.ts +100 -136
  68. package/Modules/Slider/SliderControls.ts +60 -59
  69. package/Modules/Tabs/Tab.ts +28 -24
  70. package/Modules/Tabs/index.ts +36 -26
  71. package/Modules/Validator/Date.ts +2 -1
  72. package/Modules/Validator/Equals.ts +1 -1
  73. package/Modules/Validator/Internal/Input.ts +366 -0
  74. package/Modules/Validator/Internal/InputValidator.ts +99 -0
  75. package/Modules/Validator/Internal/ValidatorFunctionsController.ts +58 -0
  76. package/Modules/Validator/Max.ts +1 -1
  77. package/Modules/Validator/Min.ts +1 -1
  78. package/Modules/Validator/MultiRequired.ts +5 -5
  79. package/Modules/Validator/Number.ts +1 -0
  80. package/Modules/Validator/Pattern.ts +1 -1
  81. package/Modules/Validator/Recaptcha.ts +1 -0
  82. package/Modules/Validator/Required.ts +3 -2
  83. package/Modules/Validator/ServerCheck.ts +23 -15
  84. package/Modules/Validator/Tools/GetQueryFromForm.ts +1 -6
  85. package/Modules/Validator/Tools/IsDate.ts +2 -3
  86. package/Modules/Validator/Tools/IsEmail.ts +2 -5
  87. package/Modules/Validator/Tools/IsEmpty.ts +0 -2
  88. package/Modules/Validator/Tools/IsNumber.ts +0 -2
  89. package/Modules/Validator/Tools/IsUrl.ts +1 -3
  90. package/Modules/Validator/Tools/Label.ts +5 -15
  91. package/Modules/Validator/Tools/RadioButton.ts +4 -10
  92. package/Modules/Validator/Url.ts +1 -0
  93. package/Modules/Validator/index.ts +36 -36
  94. package/Modules/YouTubePlayer.ts +18 -16
  95. package/README.md +1 -1
  96. package/Types/Accordion.d.ts +41 -0
  97. package/Types/Autocomplete.d.ts +94 -0
  98. package/Types/DOM.d.ts +69 -0
  99. package/Types/DragSlider.d.ts +56 -0
  100. package/Types/EventsHelpers.d.ts +390 -0
  101. package/Types/GLImageTransition.d.ts +47 -43
  102. package/Types/GlobalState.d.ts +9 -0
  103. package/Types/Helpers.d.ts +63 -0
  104. package/Types/Notifications.d.ts +48 -44
  105. package/Types/Popin.d.ts +113 -0
  106. package/Types/ScrollSnap.d.ts +66 -0
  107. package/Types/SkinCheckbox.d.ts +35 -0
  108. package/Types/SkinFile.d.ts +45 -0
  109. package/Types/SkinRadio.d.ts +37 -0
  110. package/Types/SkinSelect.d.ts +72 -0
  111. package/Types/Slider.d.ts +106 -0
  112. package/Types/Tabs.d.ts +33 -0
  113. package/Types/Validator.d.ts +99 -0
  114. package/Types/YouTubePlayer.d.ts +27 -0
  115. package/Types/index.d.ts +22 -21
  116. package/WebGL/GLImageTransition/GLImageTransition.ts +83 -80
  117. package/WebGL/GLImageTransition/Presets/Cellular.ts +11 -11
  118. package/WebGL/GLImageTransition/Presets/Fade.ts +2 -3
  119. package/WebGL/GLImageTransition/Presets/HorizontalMovingGrid.ts +9 -9
  120. package/WebGL/GLImageTransition/Presets/PresetSample.ts +11 -9
  121. package/WebGL/GLImageTransition/Presets/Solarisation.ts +7 -12
  122. package/package.json +1 -1
  123. package/Modules/Template.ts +0 -209
  124. package/Types/AccordionTypes.d.ts +0 -29
  125. package/Types/AutocompleteTypes.d.ts +0 -85
  126. package/Types/DOMTypes.d.ts +0 -62
  127. package/Types/DragSliderTypes.d.ts +0 -52
  128. package/Types/EventsHelpersTypes.d.ts +0 -370
  129. package/Types/GlobalStateTypes.d.ts +0 -5
  130. package/Types/HelpersTypes.d.ts +0 -23
  131. package/Types/MediaPreloaderTypes.d.ts +0 -12
  132. package/Types/PopinTypes.d.ts +0 -83
  133. package/Types/ScrollSnapTypes.d.ts +0 -62
  134. package/Types/SkinCheckboxTypes.d.ts +0 -23
  135. package/Types/SkinFileTypes.d.ts +0 -34
  136. package/Types/SkinRadioTypes.d.ts +0 -24
  137. package/Types/SkinSelectTypes.d.ts +0 -48
  138. package/Types/SliderTypes.d.ts +0 -97
  139. package/Types/TabsTypes.d.ts +0 -22
  140. package/Types/ValidatorTypes.d.ts +0 -61
  141. package/Types/YouTubePlayerTypes.d.ts +0 -23
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * Handle device orientation change
3
3
  *
4
- * @param options
5
- *
6
4
  * @example
5
+ * ```ts
7
6
  * let ori = new DeviceOrientation({
8
- * onOrientationChange: orientationName => {
7
+ * onOrientationChange: orientationName = {
9
8
  * console.log(orientationName)
10
9
  * }
11
10
  * })
@@ -15,12 +14,13 @@
15
14
  *
16
15
  * // Remove event binding
17
16
  * ori.off()
17
+ * ```
18
18
  */
19
19
  export default class DeviceOrientation {
20
20
 
21
- #orientationName: DeviceOrientationType = '';
21
+ #orientationName: FLib.Events.DeviceOrientation.Type = '';
22
22
 
23
- #ORIENTATION_CONVERTION_TABLE: { [ keys: string ]: DeviceOrientationType } = {
23
+ #ORIENTATION_CONVERTION_TABLE: Record<string, FLib.Events.DeviceOrientation.Type> = {
24
24
  "landscape-primary": "landscape-primary",
25
25
  "landscapePrimary": "landscape-primary",
26
26
  "portrait-primary": "portrait-primary",
@@ -38,19 +38,19 @@ export default class DeviceOrientation {
38
38
  ? 'moz'
39
39
  : 'msOrientation' in window.screen ? 'ms' : null;
40
40
 
41
- #options: DeviceOrientationOptionsType;
41
+ #options: FLib.Events.DeviceOrientation.Options;
42
42
 
43
- get orientation(): DeviceOrientationType {
43
+ get orientation(): FLib.Events.DeviceOrientation.Type {
44
44
  return this.#orientationName
45
45
  }
46
46
 
47
47
 
48
- constructor( options: DeviceOrientationOptionsType ) {
48
+ constructor( options: FLib.Events.DeviceOrientation.Options ) {
49
49
  this.#options = options;
50
50
 
51
51
  if ( !this.#PREFIX ) {
52
- window.addEventListener( 'orientationchange', this.checkWindowOrientation );
53
- this.checkWindowOrientation();
52
+ window.addEventListener( 'orientationchange', this.#checkWindowOrientation );
53
+ this.#checkWindowOrientation();
54
54
  return;
55
55
  }
56
56
 
@@ -61,27 +61,27 @@ export default class DeviceOrientation {
61
61
  ) {
62
62
  window.screen.orientation.addEventListener(
63
63
  'change',
64
- this.checkScreenOrientation
64
+ this.#checkScreenOrientation
65
65
  );
66
- this.checkScreenOrientation();
66
+ this.#checkScreenOrientation();
67
67
  }
68
68
  else {
69
69
  // @ts-expect-error
70
70
  window.screen.addEventListener(
71
71
  `${ this.#PREFIX }orientationchange`,
72
- this.checkScreenOrientation
72
+ this.#checkScreenOrientation
73
73
  );
74
- this.checkScreenOrientation();
74
+ this.#checkScreenOrientation();
75
75
  }
76
76
  }
77
77
 
78
78
 
79
- private getOrientationProperty(): string {
79
+ #getOrientationProperty = (): string => {
80
80
  return this.#PREFIX + ( this.#PREFIX === '' ? 'o' : 'O' ) + 'rientation'
81
81
  }
82
82
 
83
83
 
84
- private processOrientation( type: DeviceOrientationType ): void {
84
+ #processOrientation = ( type: FLib.Events.DeviceOrientation.Type ): void => {
85
85
  this.#orientationName = type;
86
86
 
87
87
  if ( type && this.#options.onOrientationChange ) {
@@ -90,8 +90,8 @@ export default class DeviceOrientation {
90
90
  }
91
91
 
92
92
 
93
- private checkWindowOrientation = (): void => {
94
- let type: DeviceOrientationType = '';
93
+ #checkWindowOrientation = (): void => {
94
+ let type: FLib.Events.DeviceOrientation.Type = '';
95
95
 
96
96
  const orientation: number | string = window.orientation;
97
97
 
@@ -108,14 +108,14 @@ export default class DeviceOrientation {
108
108
  type = "portrait-secondary";
109
109
  }
110
110
 
111
- this.processOrientation( type );
111
+ this.#processOrientation( type );
112
112
  }
113
113
 
114
114
 
115
- private checkScreenOrientation(): void {
116
- let type: DeviceOrientationType;
115
+ #checkScreenOrientation = (): void => {
116
+ let type: FLib.Events.DeviceOrientation.Type;
117
117
 
118
- const orientation = window.screen[ this.getOrientationProperty() ];
118
+ const orientation = window.screen[ this.#getOrientationProperty() ];
119
119
 
120
120
  if ( typeof orientation === 'undefined' ) {
121
121
  return;
@@ -128,30 +128,26 @@ export default class DeviceOrientation {
128
128
  type = this.#ORIENTATION_CONVERTION_TABLE[ orientation ];
129
129
  }
130
130
 
131
- this.processOrientation( type );
131
+ this.#processOrientation( type );
132
132
  }
133
133
 
134
134
 
135
135
  /**
136
136
  * Return the current normalized orientation
137
- *
138
- * @return {String} landscape-primary, portrait-primary, landscape-secondary, portrait-secondary
139
137
  */
140
- getOrientation(): DeviceOrientationType {
138
+ getOrientation(): FLib.Events.DeviceOrientation.Type {
141
139
  return this.#orientationName;
142
140
  }
143
141
 
144
142
 
145
143
  /**
146
144
  * Remove all binding
147
- *
148
- * @returns {DeviceOrientation}
149
145
  */
150
146
  off(): this {
151
147
  if ( !this.#PREFIX ) {
152
148
  window.removeEventListener(
153
149
  'orientationchange',
154
- this.checkWindowOrientation
150
+ this.#checkWindowOrientation
155
151
  );
156
152
  return this;
157
153
  }
@@ -162,14 +158,14 @@ export default class DeviceOrientation {
162
158
  ) {
163
159
  window.screen.orientation.removeEventListener(
164
160
  'change',
165
- this.checkScreenOrientation
161
+ this.#checkScreenOrientation
166
162
  );
167
163
  }
168
164
  else {
169
165
  // @ts-expect-error
170
166
  window.screen.removeEventListener(
171
167
  `${ this.#PREFIX }orientationchange`,
172
- this.checkScreenOrientation
168
+ this.#checkScreenOrientation
173
169
  );
174
170
  }
175
171
 
@@ -3,8 +3,8 @@ import { slice } from '../Helpers/Slice';
3
3
 
4
4
  let passiveSupported = false,
5
5
  createEvt,
6
- DOMRegistry: DataRegistryType[] = [],
7
- ObjectRegistry: DataRegistryType[] = [];
6
+ DOMRegistry: FLib.Events.EventsManager.DataRegistry[] = [],
7
+ ObjectRegistry: FLib.Events.EventsManager.DataRegistry[] = [];
8
8
 
9
9
 
10
10
  (function () {
@@ -84,7 +84,7 @@ function getDelegation( $element: Node, selector: string, callback: ( e: Event,
84
84
  }
85
85
 
86
86
 
87
- function exists( $element: Node, eventName: string, options: OnOptionsType) {
87
+ function exists( $element: Node, eventName: string, options: FLib.Events.EventsManager.OnOptions) {
88
88
  return ( $element instanceof Element ? DOMRegistry : ObjectRegistry ).find( item => {
89
89
  return item.$element === $element &&
90
90
  item.eventName === eventName &&
@@ -110,20 +110,14 @@ function _useNativeDOMEvents( $element ) {
110
110
 
111
111
  /**
112
112
  * Indicate if the browser natively support passive event
113
- *
114
- * @name handlePassiveEvents
115
- * @type {Boolean}
116
113
  */
117
114
  export const handlePassiveEvents: boolean = passiveSupported;
118
115
 
119
116
 
120
117
  /**
121
118
  * Add an event listener
122
- *
123
- * @param $elements
124
- * @param options
125
119
  */
126
- export const on = function( $elements: any, options: OnOptionsType ): void {
120
+ export const on = function( $elements: any, options: FLib.Events.EventsManager.OnOptions ): void {
127
121
  let eventOptions;
128
122
 
129
123
  const $ELEM_ARRAY = normalizeElements( $elements );
@@ -152,7 +146,7 @@ export const on = function( $elements: any, options: OnOptionsType ): void {
152
146
  const useNativeDOMEvents = _useNativeDOMEvents( $element );
153
147
  const cbFunction = options._internalCallback || options.callback;
154
148
 
155
- const data: DataRegistryType = {
149
+ const data: FLib.Events.EventsManager.DataRegistry = {
156
150
  $element,
157
151
  eventName,
158
152
  options
@@ -179,11 +173,8 @@ export const on = function( $elements: any, options: OnOptionsType ): void {
179
173
 
180
174
  /**
181
175
  * Add an event listener fired only one time
182
- *
183
- * @param $elements
184
- * @param options
185
176
  */
186
- export const one = function( $elements: any, options: OnOptionsType ): void {
177
+ export const one = function( $elements: any, options: FLib.Events.EventsManager.OnOptions ): void {
187
178
 
188
179
  function _internalCallback( this: any, e ) {
189
180
  off( $elements || this, options );
@@ -199,19 +190,16 @@ export const one = function( $elements: any, options: OnOptionsType ): void {
199
190
 
200
191
  /**
201
192
  * Remove an event
202
- *
203
- * @param $elements
204
- * @param options
205
193
  */
206
- export const off = function( $elements: any, options: OffOptionsType ): void {
194
+ export const off = function( $elements: any, options: FLib.Events.EventsManager.OffOptions ): void {
207
195
 
208
196
  const $ELEM_ARRAY = normalizeElements( $elements );
209
197
 
210
198
  options.eventsName.split( ' ' ).forEach( eventName => {
211
199
  $ELEM_ARRAY.forEach( $element => {
212
200
  const useNativeDOMEvents = _useNativeDOMEvents( $element );
213
- const removedItem: DataRegistryType[] = [];
214
- let registry: DataRegistryType[] = useNativeDOMEvents ? DOMRegistry : ObjectRegistry;
201
+ const removedItem: FLib.Events.EventsManager.DataRegistry[] = [];
202
+ let registry: FLib.Events.EventsManager.DataRegistry[] = useNativeDOMEvents ? DOMRegistry : ObjectRegistry;
215
203
 
216
204
  registry.forEach( item => {
217
205
  const callback = item.delegate || item.options._internalCallback || item.options.callback;
@@ -241,11 +229,8 @@ export const off = function( $elements: any, options: OffOptionsType ): void {
241
229
 
242
230
  /**
243
231
  * Fire an event
244
- *
245
- * @param $elements
246
- * @param options
247
232
  */
248
- export const fire = function( $elements: any, options: FireOptionsType ): void {
233
+ export const fire = function( $elements: any, options: FLib.Events.EventsManager.FireOptions ): void {
249
234
  const $ELEM_ARRAY = normalizeElements( $elements );
250
235
 
251
236
  options.eventsName.split(' ').forEach( eventName => {
package/Events/Gesture.ts CHANGED
@@ -2,7 +2,7 @@ import { on, off } from './EventsManager';
2
2
  import { extend } from '../Helpers/Extend';
3
3
 
4
4
 
5
- const defaultOptions: GestureOptionsType = {
5
+ const defaultOptions: FLib.Events.Gesture.Options = {
6
6
  "threshold": 20,
7
7
  "useTouch": true,
8
8
  "velocityMax": -1,
@@ -34,7 +34,7 @@ const MIN_DELTA_FOR_DIRECTION_CHANGE = 5; // px
34
34
 
35
35
 
36
36
  const EVENTS_NAME = ( function() {
37
- let start, move, end, mode: GestureModeType;
37
+ let start, move, end, mode: FLib.Events.Gesture.Mode;
38
38
 
39
39
  const click = 'click';
40
40
  mode = 'click';
@@ -114,7 +114,7 @@ function getPos( e ) {
114
114
  }
115
115
 
116
116
 
117
- function bindEvent( $elem: Node, eventsName: string, callback, options: GestureOptionsType, selector?: string ) {
117
+ function bindEvent( $elem: Node, eventsName: string, callback, options: FLib.Events.Gesture.Options, selector?: string ) {
118
118
  let eventOptions;
119
119
 
120
120
  // Fix passive event on chrome 54+
@@ -145,7 +145,7 @@ function unbindEvent( $elem: Node, eventsName: string, callback ) {
145
145
  }
146
146
 
147
147
 
148
- function eventsHelper( e, eventName: string, options: GestureOptionsType, $currentTargetElement: Node ) {
148
+ function eventsHelper( e, eventName: string, options: FLib.Events.Gesture.Options, $currentTargetElement: Node ) {
149
149
  const preventDefault = options[ `prevent${eventName}` ];
150
150
  const stopPropagation = options[ `stopPropagation${eventName}` ];
151
151
 
@@ -191,15 +191,15 @@ class GestureManager {
191
191
  #lastDirections;
192
192
  #$currentTargetElement;
193
193
  #$element;
194
- #velocityArray: VelocityType[] = [];
195
- #options: GestureOptionsType;
194
+ #velocityArray: FLib.Events.Gesture.Velocity[] = [];
195
+ #options: FLib.Events.Gesture.Options;
196
196
 
197
197
  get $element() {
198
198
  return this.#$element;
199
199
  }
200
200
 
201
201
 
202
- constructor( $element: Node, options: GestureOptionsType ) {
202
+ constructor( $element: Node, options: FLib.Events.Gesture.Options ) {
203
203
  this.#$element = $element;
204
204
  this.#options = options;
205
205
 
@@ -224,7 +224,7 @@ class GestureManager {
224
224
  );
225
225
  }
226
226
 
227
- private cancelAll() {
227
+ #cancelAll = () => {
228
228
  this.#isAllCancelled = true;
229
229
  this.#isTapCancelled = true;
230
230
  unbindEvent( document.body, EVENTS_NAME.move, this.#onMove );
@@ -232,7 +232,7 @@ class GestureManager {
232
232
  }
233
233
 
234
234
 
235
- private init() {
235
+ #init = () => {
236
236
  this.#isAllCancelled = false;
237
237
  this.#isTapCancelled = false;
238
238
  this.#isTapEventFired = false;
@@ -262,7 +262,7 @@ class GestureManager {
262
262
 
263
263
 
264
264
  // Swipe are called only one time
265
- private handleSwipe = ( e ): void => {
265
+ #handleSwipe = ( e ): void => {
266
266
  if ( Math.abs( this.#deltaX ) >= (this.#options.threshold as number) ) {
267
267
  this.#isTapCancelled = true;
268
268
 
@@ -299,7 +299,7 @@ class GestureManager {
299
299
 
300
300
 
301
301
  // Called along with touchmove
302
- private handleMove = ( e ): void => {
302
+ #handleMove = ( e ): void => {
303
303
  const moveOnX =
304
304
  Math.abs( this.#currentX - this.#lastX ) > Math.abs( this.#currentY - this.#lastY );
305
305
 
@@ -327,7 +327,7 @@ class GestureManager {
327
327
  }
328
328
 
329
329
 
330
- private handleVelocity( mustReset: boolean ) {
330
+ #handleVelocity = ( mustReset: boolean ) => {
331
331
  this.#velocityVars.startPosX = this.#velocityVars.endPosX;
332
332
  this.#velocityVars.startPosY = this.#velocityVars.endPosY;
333
333
  this.#velocityVars.endPosX = this.#currentX;
@@ -359,7 +359,7 @@ class GestureManager {
359
359
  }
360
360
 
361
361
 
362
- private fuzzyEquals( angle: number, targetAngle: number ) {
362
+ #fuzzyEquals = ( angle: number, targetAngle: number ) => {
363
363
  return (
364
364
  angle >= targetAngle - (this.#options.angleThreshold as number) &&
365
365
  angle <= targetAngle + (this.#options.angleThreshold as number)
@@ -367,9 +367,9 @@ class GestureManager {
367
367
  }
368
368
 
369
369
 
370
- private getVelocityData(): GestureVelocityType {
370
+ #getVelocityData = (): FLib.Events.Gesture.VelocityReturnType => {
371
371
  let angle,
372
- direction: GestureDirectionType = 'none';
372
+ direction: FLib.Events.Gesture.Direction = 'none';
373
373
 
374
374
  const currentTime = new Date().valueOf();
375
375
 
@@ -405,11 +405,11 @@ class GestureManager {
405
405
  direction = 'down-right';
406
406
  angle = 360 - angle;
407
407
 
408
- if ( this.fuzzyEquals( angle, 360 ) ) {
408
+ if ( this.#fuzzyEquals( angle, 360 ) ) {
409
409
  direction = 'right';
410
410
  angle = 0;
411
411
  }
412
- else if ( this.fuzzyEquals( angle, 270 ) ) {
412
+ else if ( this.#fuzzyEquals( angle, 270 ) ) {
413
413
  direction = 'down';
414
414
  angle = 270;
415
415
  }
@@ -417,11 +417,11 @@ class GestureManager {
417
417
  else if ( deltaPosX > 0 && deltaPosY < 0 ) {
418
418
  direction = 'up-right';
419
419
 
420
- if ( this.fuzzyEquals( angle, 360 ) ) {
420
+ if ( this.#fuzzyEquals( angle, 360 ) ) {
421
421
  direction = 'right';
422
422
  angle = 0;
423
423
  }
424
- else if ( this.fuzzyEquals( angle, 90 ) ) {
424
+ else if ( this.#fuzzyEquals( angle, 90 ) ) {
425
425
  direction = 'up';
426
426
  angle = 90;
427
427
  }
@@ -430,11 +430,11 @@ class GestureManager {
430
430
  direction = 'down-left';
431
431
  angle = angle + 180;
432
432
 
433
- if ( this.fuzzyEquals( angle, 180 ) ) {
433
+ if ( this.#fuzzyEquals( angle, 180 ) ) {
434
434
  direction = 'left';
435
435
  angle = 180;
436
436
  }
437
- else if ( this.fuzzyEquals( angle, 270 ) ) {
437
+ else if ( this.#fuzzyEquals( angle, 270 ) ) {
438
438
  direction = 'down';
439
439
  angle = 270;
440
440
  }
@@ -443,11 +443,11 @@ class GestureManager {
443
443
  direction = 'up-left';
444
444
  angle = 180 - angle;
445
445
 
446
- if ( this.fuzzyEquals( angle, 180 ) ) {
446
+ if ( this.#fuzzyEquals( angle, 180 ) ) {
447
447
  direction = 'left';
448
448
  angle = 180;
449
449
  }
450
- else if ( this.fuzzyEquals( angle, 90 ) ) {
450
+ else if ( this.#fuzzyEquals( angle, 90 ) ) {
451
451
  direction = 'up';
452
452
  angle = 90;
453
453
  }
@@ -477,7 +477,7 @@ class GestureManager {
477
477
  // Multitouch not handle for now
478
478
  if ( e.touches && e.touches.length > 1 ) {
479
479
  this.#$currentTargetElement = null;
480
- this.cancelAll();
480
+ this.#cancelAll();
481
481
  return;
482
482
  }
483
483
 
@@ -489,7 +489,7 @@ class GestureManager {
489
489
  this.#options.start.call( this.#$currentTargetElement, e, this.#$currentTargetElement, touchCoords, 'start' );
490
490
  }
491
491
 
492
- this.init();
492
+ this.#init();
493
493
 
494
494
  if ( touchCoords.pageX > -1 ) {
495
495
  this.#currentX = this.#startX = this.#lastX = touchCoords.pageX;
@@ -522,7 +522,7 @@ class GestureManager {
522
522
  }
523
523
 
524
524
  if ( e.touches && e.touches.length > 1 ) {
525
- return this.cancelAll();
525
+ return this.#cancelAll();
526
526
  }
527
527
 
528
528
  const touchCoords = getPos(e);
@@ -579,13 +579,13 @@ class GestureManager {
579
579
  this.#lastTouchMoveTime = new Date().valueOf();
580
580
 
581
581
  if ( this.#options.swipe ) {
582
- this.handleVelocity( hasDirectionChanged );
582
+ this.#handleVelocity( hasDirectionChanged );
583
583
  }
584
584
 
585
585
  this.#lastDirections = currentDirections;
586
586
 
587
- this.handleSwipe( e );
588
- this.handleMove( e );
587
+ this.#handleSwipe( e );
588
+ this.#handleMove( e );
589
589
  }
590
590
 
591
591
 
@@ -604,7 +604,7 @@ class GestureManager {
604
604
  }
605
605
 
606
606
  if ( this.#options.swipe ) {
607
- const velocityData = this.getVelocityData();
607
+ const velocityData = this.#getVelocityData();
608
608
 
609
609
  if ( velocityData.averageVelocity >= 0 ) {
610
610
  this.#options.swipe.call( this.#$currentTargetElement, e, this.#$currentTargetElement, velocityData, 'swipe' );
@@ -637,13 +637,13 @@ class GestureManager {
637
637
  }
638
638
 
639
639
  unbindEvent( this.#$element, EVENTS_NAME.click, this.#onClick );
640
- };
640
+ }
641
641
  }
642
642
 
643
643
 
644
644
  /* -------------------- API */
645
645
 
646
- function addManager( $element: Node, handlerName: string | Symbol, options: GestureOptionsType ): GestureManagerType {
646
+ function addManager( $element: Node, handlerName: string | symbol, options: FLib.Events.Gesture.Options ): FLib.Events.Gesture.Manager {
647
647
  let handler = gestureList.get( handlerName );
648
648
 
649
649
  if ( !handler ) {
@@ -662,7 +662,7 @@ function addManager( $element: Node, handlerName: string | Symbol, options: Gest
662
662
  }
663
663
 
664
664
 
665
- function removeManager( $element: Node, handlerName: string | Symbol ): void {
665
+ function removeManager( $element: Node, handlerName: string | symbol ): void {
666
666
  let idx = 0;
667
667
  const handler = gestureList.get( handlerName );
668
668
 
@@ -690,7 +690,6 @@ function removeManager( $element: Node, handlerName: string | Symbol ): void {
690
690
  *
691
691
  * @param $elements - DOM element or DOMList element
692
692
  * @param handlerName - Name of the handler used to retrieve it and unbind events with gestureOff
693
- * @param userOptions
694
693
  *
695
694
  * @see
696
695
  * For more details, see extra/events.md
@@ -706,14 +705,14 @@ function removeManager( $element: Node, handlerName: string | Symbol ): void {
706
705
  *
707
706
  * @returns The handler (or array of handlers) to unbind events
708
707
  */
709
- export function gesture( $elements: GestureElementsType, handlerName: string | Symbol, userOptions: GestureOptionsType ): GestureManagerType | GestureManagerType[] {
708
+ export function gesture( $elements: FLib.Events.Gesture.Elements, handlerName: string | symbol, userOptions: FLib.Events.Gesture.Options ): FLib.Events.Gesture.Manager | FLib.Events.Gesture.Manager[] {
710
709
  const options = extend( defaultOptions, userOptions );
711
710
 
712
711
  if (
713
712
  typeof ($elements as NodeList).length === 'number' &&
714
713
  ($elements as HTMLElement).tagName !== 'FORM'
715
714
  ) {
716
- const managers: GestureManagerType[] = [];
715
+ const managers: FLib.Events.Gesture.Manager[] = [];
717
716
 
718
717
  ($elements as NodeList).forEach($element => {
719
718
  managers.push( addManager( $element, handlerName, options ) );
@@ -736,7 +735,7 @@ export function gesture( $elements: GestureElementsType, handlerName: string | S
736
735
  * @example
737
736
  * gestureOff( $element, 'handlerName' );
738
737
  */
739
- export function gestureOff( $elements: GestureElementsType, handlerName: string | Symbol ): void {
738
+ export function gestureOff( $elements: FLib.Events.Gesture.Elements, handlerName: string | symbol ): void {
740
739
  if (
741
740
  typeof ($elements as NodeList).length === 'number' &&
742
741
  ($elements as HTMLElement).tagName !== 'FORM'
@@ -7,10 +7,11 @@ import { slice } from '../Helpers/Slice';
7
7
  * Manage history pushState and popstate event
8
8
  *
9
9
  * @example
10
+ * ```ts
10
11
  * let h = new HistoryController( 'The default page title' )
11
12
  *
12
13
  * // Push a new state in the history
13
- * h.pushState( {data: 1}, 'The page title', '/path/page.html' )
14
+ * h.pushState({ data: 1 }, 'The page title', '/path/page.html' )
14
15
  *
15
16
  * // Return the current page state
16
17
  * h.getState()
@@ -19,10 +20,11 @@ import { slice } from '../Helpers/Slice';
19
20
  * h.updateAnchor( anchor )
20
21
  *
21
22
  * // Register an handler for popState
22
- * h.register( handler ) => ( url, state )
23
+ * h.register( handler ) =&gt; ( url, state )
23
24
  *
24
25
  * // remove a registered handler for popState
25
26
  * h.remove( handler )
27
+ * ```
26
28
  *
27
29
  * @param defaultTitle - Default page title
28
30
  */
@@ -30,16 +32,16 @@ export default class HistoryController {
30
32
  #defaultTitle: string;
31
33
  #hasPushstate: boolean;
32
34
  #hasPopStateEvent: boolean;
33
- #currentState: HistoryStateObjectType;
35
+ #currentState: FLib.Events.History.StateObject;
34
36
  #registeredFunctionList: (( url: UrlParser, state: any ) => void)[];
35
37
 
36
38
 
37
- get state(): HistoryStateObjectType {
39
+ get state(): FLib.Events.History.StateObject {
38
40
  return this.#currentState;
39
41
  }
40
42
 
41
43
 
42
- constructor( defaultTitle: string = '' ) {
44
+ constructor( defaultTitle = '' ) {
43
45
 
44
46
  this.#hasPushstate = !!window.history.pushState;
45
47
  this.#hasPopStateEvent = 'onpopstate' in window;
@@ -67,7 +69,7 @@ export default class HistoryController {
67
69
 
68
70
 
69
71
  // Call each registered function for popstate event
70
- private callRegisteredFunction( url: UrlParser, state: any ): void {
72
+ #callRegisteredFunction = ( url: UrlParser, state: any ): void => {
71
73
  if ( !this.#registeredFunctionList.length ) {
72
74
  return;
73
75
  }
@@ -90,7 +92,7 @@ export default class HistoryController {
90
92
  "title": ""
91
93
  };
92
94
 
93
- this.callRegisteredFunction( this.#currentState.url, state );
95
+ this.#callRegisteredFunction( this.#currentState.url, state );
94
96
  }
95
97
 
96
98
 
@@ -98,8 +100,6 @@ export default class HistoryController {
98
100
  * Push a new state in the history
99
101
  *
100
102
  * @param state - Native browser state object
101
- * @param title
102
- * @param url
103
103
  */
104
104
  pushState( state: any, title: string, url: string | UrlParser ): this {
105
105
  if ( !this.#hasPushstate ) {
@@ -131,8 +131,6 @@ export default class HistoryController {
131
131
 
132
132
  /**
133
133
  * Update the anchor of the current url
134
- *
135
- * @param anchor
136
134
  */
137
135
  updateAnchor( anchor: string ): this {
138
136
  if ( !this.#hasPushstate ) {
@@ -159,10 +157,8 @@ export default class HistoryController {
159
157
 
160
158
  /**
161
159
  * Register an handler for popState
162
- *
163
- * @param handler
164
160
  */
165
- register( handler: HistoryCallbackType ): this {
161
+ register( handler: FLib.Events.History.Callback ): this {
166
162
  this.#registeredFunctionList.push( handler );
167
163
 
168
164
  return this;
@@ -171,10 +167,8 @@ export default class HistoryController {
171
167
 
172
168
  /**
173
169
  * Remove a registered handler for popState
174
- *
175
- * @param handler
176
170
  */
177
- remove( handler: HistoryCallbackType ): this {
171
+ remove( handler: FLib.Events.History.Callback ): this {
178
172
  slice( this.#registeredFunctionList, handler );
179
173
 
180
174
  return this;