@creative-web-solution/front-library 7.0.7 → 7.1.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 (141) hide show
  1. package/CHANGELOG.md +15 -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 +2 -3
  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 +8 -6
  43. package/Helpers/Type.ts +1 -14
  44. package/Helpers/Unique.ts +3 -3
  45. package/Helpers/UrlParser.ts +13 -22
  46. package/Helpers/Wait.ts +1 -1
  47. package/Modules/Accordion/Tab.ts +18 -16
  48. package/Modules/Accordion/index.ts +24 -16
  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 +11 -11
  58. package/Modules/Popin/PopinController.ts +23 -29
  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 +51 -37
  63. package/Modules/SkinFile.ts +62 -52
  64. package/Modules/SkinRadio.ts +62 -42
  65. package/Modules/SkinSelect.ts +116 -100
  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 +27 -23
  70. package/Modules/Tabs/index.ts +35 -25
  71. package/Modules/Validator/Date.ts +2 -1
  72. package/Modules/Validator/Equals.ts +1 -1
  73. package/Modules/Validator/Internal/Input.ts +370 -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 +36 -0
  97. package/Types/Autocomplete.d.ts +95 -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 +30 -0
  104. package/Types/Notifications.d.ts +48 -44
  105. package/Types/Popin.d.ts +95 -0
  106. package/Types/ScrollSnap.d.ts +66 -0
  107. package/Types/SkinCheckbox.d.ts +26 -0
  108. package/Types/SkinFile.d.ts +38 -0
  109. package/Types/SkinRadio.d.ts +28 -0
  110. package/Types/SkinSelect.d.ts +59 -0
  111. package/Types/Slider.d.ts +106 -0
  112. package/Types/Tabs.d.ts +26 -0
  113. package/Types/Validator.d.ts +72 -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
@@ -54,7 +54,7 @@ const defaultOptions = {
54
54
  export default class Slider {
55
55
 
56
56
  #$slider: HTMLElement;
57
- #$slides: NodeList;
57
+ #$slides: NodeListOf<HTMLElement>;
58
58
  #$list: HTMLElement;
59
59
  #slidesList: Slide[];
60
60
  #nbSlides: number;
@@ -64,60 +64,60 @@ export default class Slider {
64
64
  #STATE_MOVING = 'moving';
65
65
  #state = this.#STATE_IDLE;
66
66
  #EASE_NONE = Linear.easeNone;
67
- #options: SliderOptionsType;
67
+ #options: FLib.Slider.Options;
68
68
 
69
69
 
70
70
  /**
71
71
  * The DOM element of the slider
72
72
  */
73
- get $slider() {
73
+ get $slider(): HTMLElement {
74
74
  return this.#$slider;
75
75
  }
76
76
 
77
77
  /**
78
78
  * Wrapper of the slides
79
79
  */
80
- get $list() {
80
+ get $list(): HTMLElement {
81
81
  return this.#$list;
82
82
  }
83
83
 
84
84
  /**
85
85
  * All slides (DOM elements)
86
86
  */
87
- get $slides() {
87
+ get $slides(): NodeListOf<HTMLElement> {
88
88
  return this.#$slides;
89
89
  }
90
90
 
91
91
  /**
92
92
  * All slides (DOM elements)
93
93
  */
94
- get slides() {
94
+ get slides(): any[] {
95
95
  return this.#slidesList.map( slide => slide.getSlideProperties() );
96
96
  }
97
97
 
98
98
  /**
99
99
  * Number of slides
100
100
  */
101
- get slideCount() {
101
+ get slideCount(): number {
102
102
  return this.#nbSlides;
103
103
  }
104
104
 
105
105
  /**
106
106
  * Number of pages (can have several slides by page)
107
107
  */
108
- get pageCount() {
108
+ get pageCount(): number {
109
109
  return this.#nbPages;
110
110
  }
111
111
 
112
112
  /**
113
113
  * Number of bullet needed in a pager
114
114
  */
115
- get bulletCount() {
115
+ get bulletCount(): number {
116
116
  return this.#options.moveByPage ? this.#nbPages : this.#nbSlides;
117
117
  }
118
118
 
119
119
 
120
- constructor( $slider, userOptions: SliderOptionsType = {} ) {
120
+ constructor( $slider: HTMLElement, userOptions: Partial<FLib.Slider.Options> = {} ) {
121
121
 
122
122
  this.#options = extend( defaultOptions, userOptions );
123
123
 
@@ -126,8 +126,8 @@ export default class Slider {
126
126
  }
127
127
 
128
128
  this.#$slider = $slider;
129
- this.#$list = $slider.querySelector( this.#options.listSelector );
130
- this.#$slides = this.#$list.querySelectorAll( this.#options.itemsSelector! );
129
+ this.#$list = $slider.querySelector( this.#options.listSelector ) as HTMLElement;
130
+ this.#$slides = this.#$list.querySelectorAll( this.#options.itemsSelector );
131
131
  this.#nbSlides = this.#$slides.length;
132
132
 
133
133
  this.#slidesList = [];
@@ -141,14 +141,14 @@ export default class Slider {
141
141
 
142
142
  for ( let index = 0, len = this.#$slides.length; index < len; ++index ) {
143
143
  const $slide = this.#$slides[ index ];
144
- let slide = new Slide( {
145
- "nbSlideVisibleBefore": this.#options.nbSlideVisibleBefore!,
146
- "nbSlideVisibleAfter": this.#options.nbSlideVisibleAfter!,
147
- "slidePerPage": this.#options.slidePerPage!,
148
- "moveByPage": this.#options.moveByPage!,
144
+ const slide = new Slide( {
145
+ "nbSlideVisibleBefore": this.#options.nbSlideVisibleBefore,
146
+ "nbSlideVisibleAfter": this.#options.nbSlideVisibleAfter,
147
+ "slidePerPage": this.#options.slidePerPage,
148
+ "moveByPage": this.#options.moveByPage,
149
149
  "nbSlides": this.#nbSlides,
150
150
  "nbPages": this.#nbPages,
151
- "speed": this.#options.speed!,
151
+ "speed": this.#options.speed,
152
152
  "$slide": $slide as HTMLElement,
153
153
  index,
154
154
  "_setStyle": this.#options._setStyle,
@@ -164,12 +164,12 @@ export default class Slider {
164
164
  this.#slidesList.push( slide );
165
165
  }
166
166
 
167
- aClass( $slider, this.#options.activeClass! );
167
+ aClass( $slider, this.#options.activeClass );
168
168
 
169
- this.init();
169
+ this.#init();
170
170
 
171
171
  wait().then( () => {
172
- let data = {
172
+ const data = {
173
173
  "currentSlide": this.#currentSlide.getSlideProperties()
174
174
  };
175
175
 
@@ -177,13 +177,6 @@ export default class Slider {
177
177
  this.#options.onStart( data );
178
178
  }
179
179
 
180
- /**
181
- * On the initialization of the slider
182
- *
183
- * @event Slider#start
184
- * @type {Object}
185
- * @property {SlideEventData_Params} data - Only currentSlide property
186
- */
187
180
  fire( this, {
188
181
  "eventsName": SLIDER_EVENT_START,
189
182
  "detail": data
@@ -193,14 +186,14 @@ export default class Slider {
193
186
  }
194
187
 
195
188
 
196
- private getNextSlideIndex( index: number, step = 1 ): number {
189
+ #getNextSlideIndex = ( index: number, step = 1 ): number => {
197
190
  index = index + step;
198
191
 
199
192
  if ( this.#options.loop && index >= this.#nbSlides ) {
200
193
  index = 0;
201
194
  }
202
195
  else if (
203
- !this.#options.loop && !this.#options.moveByPage && index > this.#nbSlides - this.#options.slidePerPage! ||
196
+ !this.#options.loop && !this.#options.moveByPage && index > this.#nbSlides - this.#options.slidePerPage ||
204
197
  index >= this.#nbSlides
205
198
  ) {
206
199
  return -1;
@@ -210,7 +203,7 @@ export default class Slider {
210
203
  }
211
204
 
212
205
 
213
- private getPreviousSlideIndex( index: number, step = 1 ): number {
206
+ #getPreviousSlideIndex = ( index: number, step = 1 ): number => {
214
207
  index = index - step;
215
208
 
216
209
  if ( index < 0 && this.#options.loop ) {
@@ -218,7 +211,7 @@ export default class Slider {
218
211
  index = this.#nbSlides - 1;
219
212
  }
220
213
  else {
221
- index = ( this.#nbPages - 1 ) * this.#options.slidePerPage!;
214
+ index = ( this.#nbPages - 1 ) * this.#options.slidePerPage;
222
215
  }
223
216
  }
224
217
  else if ( index < 0 ) {
@@ -229,8 +222,8 @@ export default class Slider {
229
222
  }
230
223
 
231
224
 
232
- private getNextSlide( index: number, step = 1 ): Slide | undefined {
233
- index = this.getNextSlideIndex( index, step );
225
+ #getNextSlide = ( index: number, step = 1 ): Slide | undefined => {
226
+ index = this.#getNextSlideIndex( index, step );
234
227
 
235
228
  if ( index < 0 ) {
236
229
  return;
@@ -240,8 +233,8 @@ export default class Slider {
240
233
  }
241
234
 
242
235
 
243
- private getPreviousSlide( index: number, step = 1 ): Slide | undefined {
244
- index = this.getPreviousSlideIndex( index, step );
236
+ #getPreviousSlide = ( index: number, step = 1 ): Slide | undefined => {
237
+ index = this.#getPreviousSlideIndex( index, step );
245
238
 
246
239
  if ( index < 0 ) {
247
240
  return;
@@ -251,22 +244,22 @@ export default class Slider {
251
244
  }
252
245
 
253
246
 
254
- private reorderSlidesWithLoop( activeSlide: Slide, direction: SlideDirectionType ) {
247
+ #reorderSlidesWithLoop = ( activeSlide: Slide, direction: FLib.Slider.SlideDirection ): void => {
255
248
  let slide, nbSlideAfter, nbSlideBefore;
256
249
 
257
250
  slide = activeSlide;
258
251
 
259
252
  if ( direction === DIRECTION_NEXT ) {
260
- nbSlideAfter = Math.floor( ( this.#nbSlides - this.#options.slidePerPage! ) / 2 );
261
- nbSlideBefore = this.#nbSlides - this.#options.slidePerPage! - nbSlideAfter;
253
+ nbSlideAfter = Math.floor( ( this.#nbSlides - this.#options.slidePerPage ) / 2 );
254
+ nbSlideBefore = this.#nbSlides - this.#options.slidePerPage - nbSlideAfter;
262
255
  }
263
256
  else {
264
- nbSlideBefore = Math.floor( ( this.#nbSlides - this.#options.slidePerPage! ) / 2 );
265
- nbSlideAfter = this.#nbSlides - this.#options.slidePerPage! - nbSlideBefore;
257
+ nbSlideBefore = Math.floor( ( this.#nbSlides - this.#options.slidePerPage ) / 2 );
258
+ nbSlideAfter = this.#nbSlides - this.#options.slidePerPage - nbSlideBefore;
266
259
  }
267
260
 
268
261
  for ( let indexBefore = 0; indexBefore < nbSlideBefore; ++indexBefore ) {
269
- slide = this.getPreviousSlide( slide.index );
262
+ slide = this.#getPreviousSlide( slide.index );
270
263
  slide.setOffsetToGo( -indexBefore - 1 );
271
264
  }
272
265
 
@@ -275,29 +268,29 @@ export default class Slider {
275
268
 
276
269
  for (
277
270
  let indexVisible = 1;
278
- indexVisible < this.#options.slidePerPage!;
271
+ indexVisible < this.#options.slidePerPage;
279
272
  ++indexVisible
280
273
  ) {
281
- slide = this.getNextSlide( slide.index );
274
+ slide = this.#getNextSlide( slide.index );
282
275
  slide.setOffsetToGo( indexVisible );
283
276
  }
284
277
 
285
278
  for ( let indexAfter = 0; indexAfter < nbSlideAfter; ++indexAfter ) {
286
- slide = this.getNextSlide( slide.index );
287
- slide.setOffsetToGo( this.#options.slidePerPage! + indexAfter );
279
+ slide = this.#getNextSlide( slide.index );
280
+ slide.setOffsetToGo( this.#options.slidePerPage + indexAfter );
288
281
  }
289
282
  }
290
283
 
291
284
 
292
- private reorderSlidesWithoutLoop( activeSlide: Slide ) {
285
+ #reorderSlidesWithoutLoop = ( activeSlide: Slide ): void => {
293
286
  for ( let i = 0; i < this.#nbSlides; ++i ) {
294
- let slide = this.#slidesList[ i ];
287
+ const slide = this.#slidesList[ i ];
295
288
 
296
289
  if ( i === activeSlide.index ) {
297
290
  slide.setOffsetToGo( 0 );
298
291
  }
299
- else if ( i < activeSlide.index - this.#options.nbSlideVisibleBefore! ) {
300
- slide.setOffsetToGo (-this.#options.nbSlideVisibleBefore! - 1 );
292
+ else if ( i < activeSlide.index - this.#options.nbSlideVisibleBefore ) {
293
+ slide.setOffsetToGo (-this.#options.nbSlideVisibleBefore - 1 );
301
294
  }
302
295
  else if (
303
296
  i >
@@ -306,7 +299,7 @@ export default class Slider {
306
299
  this.#options.slidePerPage
307
300
  ) {
308
301
  slide.setOffsetToGo(
309
- this.#options.nbSlideVisibleAfter! + this.#options.slidePerPage!
302
+ this.#options.nbSlideVisibleAfter + this.#options.slidePerPage
310
303
  );
311
304
  } else {
312
305
  slide.setOffsetToGo( i - activeSlide.index );
@@ -315,23 +308,21 @@ export default class Slider {
315
308
  }
316
309
 
317
310
 
318
- private reorderSlides( activeSlide: Slide, direction: SlideDirectionType ) {
311
+ #reorderSlides = ( activeSlide: Slide, direction: FLib.Slider.SlideDirection ): void => {
319
312
  if ( this.#options.loop ) {
320
- this.reorderSlidesWithLoop( activeSlide, direction );
313
+ this.#reorderSlidesWithLoop( activeSlide, direction );
321
314
  }
322
315
  else {
323
- this.reorderSlidesWithoutLoop( activeSlide );
316
+ this.#reorderSlidesWithoutLoop( activeSlide );
324
317
  }
325
318
  }
326
319
 
327
320
 
328
- private moveSlides( nextActiveSlide: Slide, direction: SlideDirectionType, easing, $button: HTMLElement ): Promise<void> {
329
- let promArray, callbackData;
330
-
321
+ #moveSlides = ( nextActiveSlide: Slide, direction: FLib.Slider.SlideDirection, easing, $button?: HTMLElement ): Promise<void> => {
331
322
  this.#state = this.#STATE_MOVING;
332
- promArray = [];
323
+ const promArray: Promise<any>[] = [];
333
324
 
334
- callbackData = {
325
+ const callbackData: FLib.Slider.CallbackParam = {
335
326
  "targetSlide": nextActiveSlide.getSlideProperties(),
336
327
  "currentSlide": this.#currentSlide.getSlideProperties(),
337
328
  "direction": direction
@@ -348,10 +339,6 @@ export default class Slider {
348
339
 
349
340
  /**
350
341
  * Before each slide move. If moving for 3 slides, it will be called 3 times.
351
- *
352
- * @event Slider#beforeEach
353
- * @type {Object}
354
- * @property {SlideEventData_Params} data
355
342
  */
356
343
  fire( this, {
357
344
  "eventsName": SLIDER_EVENT_BEFORE_EACH,
@@ -359,7 +346,7 @@ export default class Slider {
359
346
  } );
360
347
 
361
348
 
362
- this.reorderSlides( nextActiveSlide, direction );
349
+ this.#reorderSlides( nextActiveSlide, direction );
363
350
 
364
351
  // All init first
365
352
  this.#slidesList.forEach( slide => {
@@ -378,10 +365,6 @@ export default class Slider {
378
365
 
379
366
  /**
380
367
  * After each slide move. If moving for 3 slides, it will be called 3 times.
381
- *
382
- * @event Slider#afterEach
383
- * @type {Object}
384
- * @property {SlideEventData_Params} data
385
368
  */
386
369
  fire( this, {
387
370
  "eventsName": SLIDER_EVENT_AFTER_EACH,
@@ -393,8 +376,8 @@ export default class Slider {
393
376
  }
394
377
 
395
378
 
396
- private init() {
397
- this.reorderSlides( this.#currentSlide, DIRECTION_NEXT );
379
+ #init = (): void => {
380
+ this.#reorderSlides( this.#currentSlide, DIRECTION_NEXT );
398
381
 
399
382
  this.#slidesList.forEach( ( slide ) => {
400
383
  slide.init();
@@ -402,39 +385,33 @@ export default class Slider {
402
385
  }
403
386
 
404
387
 
405
- private goPrevious( easing, $button: HTMLElement ): Promise<void> {
406
- let previousSlide;
407
-
408
- previousSlide = this.getPreviousSlide( this.#currentSlide.index );
388
+ #goPrevious = ( easing, $button?: HTMLElement ): Promise<void> => {
389
+ const previousSlide = this.#getPreviousSlide( this.#currentSlide.index );
409
390
 
410
391
  if ( !previousSlide ) {
411
392
  return Promise.resolve();
412
393
  }
413
394
 
414
- return this.moveSlides( previousSlide, DIRECTION_PREVIOUS, easing, $button );
395
+ return this.#moveSlides( previousSlide, DIRECTION_PREVIOUS, easing, $button );
415
396
  }
416
397
 
417
398
 
418
- private goNext( easing, $button: HTMLElement ): Promise<void> {
419
- let nextSlide;
420
-
421
- nextSlide = this.getNextSlide( this.#currentSlide.index );
399
+ #goNext = ( easing, $button?: HTMLElement ): Promise<void> => {
400
+ const nextSlide = this.#getNextSlide( this.#currentSlide.index );
422
401
 
423
402
  if ( !nextSlide ) {
424
403
  return Promise.resolve();
425
404
  }
426
405
 
427
- return this.moveSlides( nextSlide, DIRECTION_NEXT, easing, $button );
406
+ return this.#moveSlides( nextSlide, DIRECTION_NEXT, easing, $button );
428
407
  }
429
408
 
430
409
 
431
- private getShortestWayAndDirection( index: number, askedDirection?: SlideDirectionType ) {
432
- let setupOpt, indexOfFirstPage, indexOfLastPage, currentPageIndex;
433
-
434
- setupOpt = {};
435
- indexOfFirstPage = 0;
436
- indexOfLastPage = this.#nbSlides - 1;
437
- currentPageIndex = this.#currentSlide.index;
410
+ #getShortestWayAndDirection = ( index: number, askedDirection?: FLib.Slider.SlideDirection ): Record<string, any> => {
411
+ const setupOpt: Record<string, any> = {};
412
+ const indexOfFirstPage = 0;
413
+ const indexOfLastPage = this.#nbSlides - 1;
414
+ const currentPageIndex = this.#currentSlide.index;
438
415
 
439
416
  // Store the natural direction
440
417
  setupOpt.direction =
@@ -505,9 +482,9 @@ export default class Slider {
505
482
  }
506
483
 
507
484
 
508
- private updateHeight( currentSlide: Slide, nextSlide: Slide, duration: number ): Promise<void> {
485
+ #updateHeight = ( currentSlide: Slide, nextSlide: Slide, duration: number ): Promise<void> => {
509
486
  return new Promise( resolve => {
510
- this.#options._tweenFromTo!(
487
+ this.#options._tweenFromTo(
511
488
  this.#$list,
512
489
  {
513
490
  "height": currentSlide.getHeight()
@@ -522,22 +499,15 @@ export default class Slider {
522
499
  }
523
500
 
524
501
 
525
- private cleanListHeight() {
526
- this.#options._setStyle!( this.#$list, {
502
+ #cleanListHeight = (): void => {
503
+ this.#options._setStyle( this.#$list, {
527
504
  "clearProps": "height"
528
505
  } );
529
506
  }
530
507
 
531
508
 
532
- private moveTo( index: number, askedDirection?: SlideDirectionType, $button?: HTMLElement ): Promise<void> {
533
- let wayAndDirection,
534
- prom,
535
- fun,
536
- easing,
537
- lastCurrentSlide,
538
- nextSlide,
539
- promArray,
540
- callbackData;
509
+ #moveTo = ( index: number, askedDirection?: FLib.Slider.SlideDirection, $button?: HTMLElement ): Promise<void> => {
510
+ let prom;
541
511
 
542
512
  if (
543
513
  this.#state !== this.#STATE_IDLE ||
@@ -548,19 +518,19 @@ export default class Slider {
548
518
  return Promise.resolve();
549
519
  }
550
520
 
551
- nextSlide = this.#slidesList[ index ];
552
- promArray = [];
521
+ const nextSlide = this.#slidesList[ index ];
522
+ const promArray: Promise<any>[] = [];
553
523
 
554
- wayAndDirection = this.getShortestWayAndDirection( index, askedDirection );
555
- fun =
524
+ const wayAndDirection = this.#getShortestWayAndDirection( index, askedDirection );
525
+ const fun =
556
526
  wayAndDirection.direction === DIRECTION_PREVIOUS
557
- ? this.goPrevious.bind( this )
558
- : this.goNext.bind( this );
527
+ ? this.#goPrevious.bind( this )
528
+ : this.#goNext.bind( this );
559
529
 
560
- easing = this.#EASE_NONE;
561
- lastCurrentSlide = this.#currentSlide;
530
+ const easing = this.#EASE_NONE;
531
+ const lastCurrentSlide = this.#currentSlide;
562
532
 
563
- callbackData = {
533
+ const callbackData: FLib.Slider.CallbackParam = {
564
534
  "targetSlide": nextSlide.getSlideProperties(),
565
535
  "currentSlide": lastCurrentSlide.getSlideProperties(),
566
536
  "direction": wayAndDirection.direction
@@ -596,10 +566,10 @@ export default class Slider {
596
566
 
597
567
  if ( this.#options.smoothHeight ) {
598
568
  promArray.push(
599
- this.updateHeight(
569
+ this.#updateHeight(
600
570
  this.#currentSlide,
601
571
  nextSlide,
602
- this.#options.speed! * wayAndDirection.nbStepsMin
572
+ this.#options.speed * wayAndDirection.nbStepsMin
603
573
  )
604
574
  );
605
575
  }
@@ -608,7 +578,7 @@ export default class Slider {
608
578
 
609
579
  return Promise.all( promArray ).then(() => {
610
580
  if ( this.#options.smoothHeight ) {
611
- this.cleanListHeight();
581
+ this.#cleanListHeight();
612
582
  }
613
583
 
614
584
  if ( this.#options.onAfter ) {
@@ -631,13 +601,11 @@ export default class Slider {
631
601
  * @param $button - Internal use only
632
602
  */
633
603
  next( $button?: HTMLElement ) : Promise<void>{
634
- let nextSlideIndex;
635
-
636
604
  if ( this.#state !== this.#STATE_IDLE || ( !this.#options.loop && this.#currentSlide.isLast ) ) {
637
605
  return Promise.resolve();
638
606
  }
639
607
 
640
- nextSlideIndex = this.getNextSlideIndex(
608
+ const nextSlideIndex = this.#getNextSlideIndex(
641
609
  this.#currentSlide.index,
642
610
  this.#options.moveByPage ? this.#options.slidePerPage : 1
643
611
  );
@@ -646,22 +614,21 @@ export default class Slider {
646
614
  return Promise.resolve();
647
615
  }
648
616
 
649
- return this.moveTo( nextSlideIndex, DIRECTION_NEXT, $button );
617
+ return this.#moveTo( nextSlideIndex, DIRECTION_NEXT, $button );
650
618
  }
651
619
 
652
620
 
653
621
  /**
654
622
  * Go to the previous slide or page
655
- * @param $button Internal use only
623
+ *
624
+ * @param $button - Internal use only
656
625
  */
657
626
  previous( $button?: HTMLElement ): Promise<void> {
658
- let previousSlideIndex;
659
-
660
627
  if ( this.#state !== this.#STATE_IDLE || ( !this.#options.loop && this.#currentSlide.isFirst ) ) {
661
628
  return Promise.resolve();
662
629
  }
663
630
 
664
- previousSlideIndex = this.getPreviousSlideIndex(
631
+ const previousSlideIndex = this.#getPreviousSlideIndex(
665
632
  this.#currentSlide.index,
666
633
  this.#options.moveByPage ? this.#options.slidePerPage : 1
667
634
  );
@@ -670,20 +637,19 @@ export default class Slider {
670
637
  return Promise.resolve();
671
638
  }
672
639
 
673
- return this.moveTo( previousSlideIndex, DIRECTION_PREVIOUS, $button );
640
+ return this.#moveTo( previousSlideIndex, DIRECTION_PREVIOUS, $button );
674
641
  }
675
642
 
676
643
 
677
644
  /**
678
645
  * Go to the asked slide or page
679
646
  *
680
- * @param page
681
- * @param $button Internal use only
647
+ * @param $button - Internal use only
682
648
  */
683
649
  goTo( page: number, $button?: HTMLElement ): Promise<void> {
684
- let index = this.#options.moveByPage ? page * this.#options.slidePerPage! : page;
650
+ const index = this.#options.moveByPage ? page * this.#options.slidePerPage : page;
685
651
 
686
- return this.moveTo( index, undefined, $button );
652
+ return this.#moveTo( index, undefined, $button );
687
653
  }
688
654
 
689
655
 
@@ -691,10 +657,10 @@ export default class Slider {
691
657
  * Check if the slider is enable or not
692
658
  */
693
659
  isEnabled(): boolean {
694
- let nbSlidesVisible =
695
- this.#options.nbSlideVisibleBefore! +
696
- this.#options.nbSlideVisibleAfter! +
697
- this.#options.slidePerPage!;
660
+ const nbSlidesVisible =
661
+ this.#options.nbSlideVisibleBefore +
662
+ this.#options.nbSlideVisibleAfter +
663
+ this.#options.slidePerPage;
698
664
  return (
699
665
  this.#nbSlides > nbSlidesVisible ||
700
666
  ( !this.#options.loop && this.#nbSlides === nbSlidesVisible )
@@ -705,12 +671,12 @@ export default class Slider {
705
671
  /**
706
672
  * Remove all events, css class or inline styles
707
673
  */
708
- destroy() {
674
+ destroy(): void {
709
675
  if ( this.isEnabled() ) {
710
676
  this.#slidesList.forEach( slide => {
711
677
  slide.destroy();
712
678
  } );
713
- rClass( this.#$slider, this.#options.activeClass! );
679
+ rClass( this.#$slider, this.#options.activeClass );
714
680
  }
715
681
  }
716
682
 
@@ -725,10 +691,8 @@ export default class Slider {
725
691
 
726
692
  /**
727
693
  * Get a slide in function of an index
728
- *
729
- * @param index
730
694
  */
731
- getSlide( index ): Slide {
695
+ getSlide( index: number ): Slide {
732
696
  return this.#slidesList[ index ];
733
697
  }
734
698
 
@@ -740,7 +704,7 @@ export default class Slider {
740
704
  * @param nb - Number of slide after the target
741
705
  */
742
706
  getTheNthChildAfter( index: number, nb: number ): Slide | undefined {
743
- return this.getNextSlide( index, nb );
707
+ return this.#getNextSlide( index, nb );
744
708
  }
745
709
 
746
710
 
@@ -751,6 +715,6 @@ export default class Slider {
751
715
  * @param nb - Number of slide before the target
752
716
  */
753
717
  getTheNthChildBefore( index: number, nb: number ): Slide | undefined {
754
- return this.getPreviousSlide( index, nb );
718
+ return this.#getPreviousSlide( index, nb );
755
719
  }
756
720
  }