@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
@@ -5,21 +5,18 @@ import { wait } from '../Helpers/Wait';
5
5
 
6
6
  /**
7
7
  * Simulate hover (on touch) on mobile device. Touch a second time to follow the link.
8
- * @class
9
8
  *
10
- * @example new TouchHover( {
9
+ * @example
10
+ * ```ts
11
+ * new TouchHover( {
11
12
  * "cssClass": 'hover',
12
13
  * "selector": '.link',
13
14
  * "$wrapper": $myWrapper
14
15
  * } );
15
- *
16
- * @param {Object} options
17
- * @param {String} options.cssClass
18
- * @param {String} options.selector
19
- * @param {HTMLEvent} options.$wrapper
16
+ * ```
20
17
  */
21
18
  export default class TouchHover {
22
- #options: TouchHoverOptions ;
19
+ #options: FLib.Events.TouchHover.Options;
23
20
  #$lastElem: Element | null = null;
24
21
  #hasClickOutsideListener: boolean;
25
22
 
@@ -29,7 +26,7 @@ export default class TouchHover {
29
26
  #clickOutsideHandlerName = Symbol( 'touchhover2' );
30
27
 
31
28
 
32
- constructor( options: TouchHoverOptions ) {
29
+ constructor( options: FLib.Events.TouchHover.Options ) {
33
30
  this.#options = options;
34
31
  this.#hasClickOutsideListener = false;
35
32
  this.#options.$wrapper = this.#options.$wrapper || this.#$body;
@@ -40,7 +37,7 @@ export default class TouchHover {
40
37
 
41
38
  gesture( this.#options.$wrapper, this.#gestureHandlerName, {
42
39
  "selector": this.#options.selector,
43
- "end": this.toggleClass.bind( this ),
40
+ "end": this.#toggleClass.bind( this ),
44
41
  "preventClick": ( e, $target ) => {
45
42
  return $target[ this.#hasBeenTouchedOnce ];
46
43
  }
@@ -48,7 +45,7 @@ export default class TouchHover {
48
45
  }
49
46
 
50
47
 
51
- private onClickOutside( e, $target ) {
48
+ #onClickOutside = ( e: Event, $target: HTMLElement ): void => {
52
49
 
53
50
  if ( $target.closest( this.#options.selector ) ) {
54
51
  return;
@@ -58,20 +55,20 @@ export default class TouchHover {
58
55
 
59
56
  this.#hasClickOutsideListener = false;
60
57
 
61
- this.removeClass();
58
+ this.#removeClass();
62
59
  }
63
60
 
64
61
 
65
- private addClass( $target ) {
62
+ #addClass = ( $target: HTMLElement ): void => {
66
63
  $target[ this.#hasBeenTouchedOnce ] = true;
67
64
 
68
- aClass( $target, this.#options.cssClass );
65
+ aClass( $target as HTMLElement, this.#options.cssClass );
69
66
  this.#$lastElem = $target;
70
67
 
71
68
  if ( !this.#hasClickOutsideListener ) {
72
69
  wait().then( () => {
73
70
  gesture( this.#$body, this.#clickOutsideHandlerName, {
74
- "end": this.onClickOutside.bind( this )
71
+ "end": this.#onClickOutside.bind( this )
75
72
  } );
76
73
  } );
77
74
 
@@ -80,7 +77,7 @@ export default class TouchHover {
80
77
  }
81
78
 
82
79
 
83
- private removeClass() {
80
+ #removeClass = (): void => {
84
81
  if ( this.#$lastElem ) {
85
82
  rClass( this.#$lastElem, this.#options.cssClass );
86
83
 
@@ -90,24 +87,24 @@ export default class TouchHover {
90
87
  }
91
88
 
92
89
 
93
- private toggleClass( e, $target ) {
90
+ #toggleClass = ( e: Event, $target: HTMLElement ): void => {
94
91
  if ( $target !== this.#$lastElem ) {
95
- this.removeClass();
92
+ this.#removeClass();
96
93
  }
97
94
 
98
95
  if ( $target[ this.#hasBeenTouchedOnce ] ) {
99
- this.removeClass();
96
+ this.#removeClass();
100
97
  return;
101
98
  }
102
99
 
103
- this.addClass( $target );
100
+ this.#addClass( $target );
104
101
  }
105
102
 
106
103
 
107
104
  /**
108
105
  * Remove all binded events
109
106
  */
110
- destroy() {
107
+ destroy(): this {
111
108
  gestureOff( this.#options.$wrapper, this.#gestureHandlerName );
112
109
  gestureOff( this.#$body, this.#clickOutsideHandlerName );
113
110
 
@@ -5,17 +5,16 @@ import { windowSize } from '../DOM/WindowSize';
5
5
 
6
6
  /**
7
7
  * Window events handler
8
- * @class
9
8
  *
10
9
  * @example
11
- *
10
+ * ```ts
12
11
  * let w = new WindowEvents( window );
13
12
  *
14
- * or to change throttle delay :
13
+ * // or to change throttle delay :
15
14
  *
16
15
  * let w = new WindowEvents( window, 150 );
17
16
  *
18
- * let callback = ( { windowInfo, scrollInfo, documentInfo, viewportInfo }, type, event ) => {};
17
+ * let callback = ( { windowInfo, scrollInfo, documentInfo, viewportInfo }, type, event ) => {};
19
18
  *
20
19
  * w.register( callback, 'resize' ); // type = 'resize', 'scroll' or undefined for both
21
20
  * w.remove( callback, 'resize' );
@@ -34,6 +33,7 @@ import { windowSize } from '../DOM/WindowSize';
34
33
  * { width, height } = w.windowInfo;
35
34
  * { width, height } = w.documentInfo;
36
35
  * { top, left, bottom, right, width, height } = w.viewportInfo;
36
+ * ```
37
37
  */
38
38
  export default class WindowEvents {
39
39
 
@@ -52,21 +52,21 @@ export default class WindowEvents {
52
52
  /**
53
53
  * Get the last stored scroll position
54
54
  */
55
- get scrollInfo() {
55
+ get scrollInfo(): FLib.Events.WindowEvents.ScrollInfo {
56
56
  return this.#scrollInfo;
57
57
  }
58
58
 
59
59
  /**
60
60
  * Get the last stored window size
61
61
  */
62
- get windowInfo() {
62
+ get windowInfo(): FLib.Events.WindowEvents.WindowInfo {
63
63
  return this.#windowInfo;
64
64
  }
65
65
 
66
66
  /**
67
67
  * Get the last stored document size
68
68
  */
69
- get documentInfo() {
69
+ get documentInfo(): FLib.Events.WindowEvents.DocumentInfo {
70
70
  return this.#documentInfo;
71
71
  }
72
72
 
@@ -77,29 +77,29 @@ export default class WindowEvents {
77
77
  * The viewport is the displayed part of the document.<br>
78
78
  * So, its top and left are the scroll position and its width and height are the window size.<br>
79
79
  */
80
- get viewportInfo() {
80
+ get viewportInfo(): FLib.Events.WindowEvents.ViewportInfo {
81
81
  return this.#viewportInfo;
82
82
  }
83
83
 
84
84
 
85
85
  /**
86
86
  * @param $window - DOM object on which the events will be checked
87
- * @param [throttleDelay=-1] - Throttle delay in ms. If < 0, it use requestAnimationFrame
87
+ * @param throttleDelay - Throttle delay in ms. If &lt; 0, it use requestAnimationFrame
88
88
  */
89
- constructor( $window, throttleDelay = -1 ) {
89
+ constructor( $window: HTMLElement | Window, throttleDelay = -1 ) {
90
90
  this.#$window = $window;
91
91
  this.#throttleDelay = throttleDelay;
92
92
  }
93
93
 
94
94
 
95
95
  // Call each registered function for resize event
96
- private updateResize( originalEvent ) {
96
+ #updateResize = ( originalEvent?: Event ): void => {
97
97
  if ( !this.#resizeFunctionSet.size ) {
98
98
  return;
99
99
  }
100
100
 
101
101
  this.#resizeFunctionSet.forEach( fcn => {
102
- ( fcn as WindowEventsCallbackType )( {
102
+ ( fcn as FLib.Events.WindowEvents.Callback )( {
103
103
  "windowInfo": this.#windowInfo,
104
104
  "scrollInfo": this.#scrollInfo,
105
105
  "documentInfo": this.#documentInfo,
@@ -113,13 +113,13 @@ export default class WindowEvents {
113
113
 
114
114
 
115
115
  // Call each registered function for scroll event
116
- private updateScroll( originalEvent ) {
116
+ #updateScroll = ( originalEvent?: Event ): void => {
117
117
  if ( !this.#scrollFunctionSet.size ) {
118
118
  return;
119
119
  }
120
120
 
121
121
  this.#scrollFunctionSet.forEach( fcn => {
122
- ( fcn as WindowEventsCallbackType )( {
122
+ ( fcn as FLib.Events.WindowEvents.Callback )( {
123
123
  "windowInfo": this.#windowInfo,
124
124
  "scrollInfo": this.#scrollInfo,
125
125
  "documentInfo": this.#documentInfo,
@@ -132,7 +132,7 @@ export default class WindowEvents {
132
132
  }
133
133
 
134
134
 
135
- private updateValue( type?: WindowEventsType ) {
135
+ #updateValue = ( type?: FLib.Events.WindowEvents.Type ): void => {
136
136
  if ( type !== 'resize' ) {
137
137
  this.#scrollInfo = windowScroll();
138
138
  }
@@ -152,7 +152,7 @@ export default class WindowEvents {
152
152
  }
153
153
 
154
154
 
155
- #changeHandler = ( e: Event ) => {
155
+ #changeHandler = ( e: Event ): void => {
156
156
  if ( this.#tick ) {
157
157
  return;
158
158
  }
@@ -162,7 +162,7 @@ export default class WindowEvents {
162
162
  const FNC = ( ( ev: Event ) => {
163
163
  return () => {
164
164
  const TYPE = ev.type === 'scroll' ? 'scroll' : 'resize';
165
- this.updateValue( TYPE );
165
+ this.#updateValue( TYPE );
166
166
  this.refresh( TYPE, ev );
167
167
  this.#tick = false;
168
168
  }
@@ -180,10 +180,9 @@ export default class WindowEvents {
180
180
  /**
181
181
  * Register a function on a type of event
182
182
  *
183
- * @param callback
184
183
  * @param type - resize | scroll | undefined (both)
185
184
  */
186
- register( callback: WindowEventsCallbackType, type?: WindowEventsType ): this {
185
+ register( callback: FLib.Events.WindowEvents.Callback, type?: FLib.Events.WindowEvents.Type ): this {
187
186
  if ( type !== 'scroll' ) {
188
187
  this.#resizeFunctionSet.add( callback );
189
188
  }
@@ -195,7 +194,7 @@ export default class WindowEvents {
195
194
  if ( !this.#isActive && ( this.#resizeFunctionSet.size || this.#scrollFunctionSet.size ) ) {
196
195
  this.#$window.addEventListener( 'resize', this.#changeHandler );
197
196
  this.#$window.addEventListener( 'scroll', this.#changeHandler );
198
- this.updateValue();
197
+ this.#updateValue();
199
198
  this.#isActive = true;
200
199
  }
201
200
 
@@ -206,10 +205,9 @@ export default class WindowEvents {
206
205
  /**
207
206
  * Unregister a function for a type of event
208
207
  *
209
- * @param callback
210
208
  * @param type - resize | scroll | undefined (both)
211
209
  */
212
- remove( callback: WindowEventsCallbackType, type?: WindowEventsType ): this {
210
+ remove( callback: FLib.Events.WindowEvents.Callback, type?: FLib.Events.WindowEvents.Type ): this {
213
211
  if ( type !== 'scroll' ) {
214
212
  this.#resizeFunctionSet.delete( callback );
215
213
  }
@@ -234,8 +232,8 @@ export default class WindowEvents {
234
232
  *
235
233
  * @param type - resize | scroll | undefined (both)
236
234
  */
237
- update( type?: WindowEventsType ): this {
238
- this.updateValue( type );
235
+ update( type?: FLib.Events.WindowEvents.Type ): this {
236
+ this.#updateValue( type );
239
237
 
240
238
  return this;
241
239
  }
@@ -246,13 +244,13 @@ export default class WindowEvents {
246
244
  *
247
245
  * @param type - resize | scroll | undefined (both)
248
246
  */
249
- refresh( type?: WindowEventsType, _oe?: Event ): this {
247
+ refresh( type?: FLib.Events.WindowEvents.Type , _oe?: Event ): this {
250
248
  if ( type !== 'scroll' ) {
251
- this.updateResize( _oe );
249
+ this.#updateResize( _oe );
252
250
  }
253
251
 
254
252
  if ( type !== 'resize' ) {
255
- this.updateScroll( _oe );
253
+ this.#updateScroll( _oe );
256
254
  }
257
255
 
258
256
  return this;
@@ -261,10 +259,8 @@ export default class WindowEvents {
261
259
 
262
260
  /**
263
261
  * Call a function with the last stored positions and sizes
264
- *
265
- * @param callback
266
262
  */
267
- get( callback: WindowEventsCallbackType ): this {
263
+ get( callback: FLib.Events.WindowEvents.Callback ): this {
268
264
  callback({
269
265
  "windowInfo": this.#windowInfo,
270
266
  "scrollInfo": this.#scrollInfo,
package/Helpers/Colors.ts CHANGED
@@ -25,8 +25,6 @@ function toHexValue( c: number ): string {
25
25
  /**
26
26
  * Convert a rgba string to a hex string
27
27
  *
28
- * @param rgba
29
- *
30
28
  * @example
31
29
  * rgbaToHex( 'rgb(125 ,233, 105)' );
32
30
  *
@@ -41,8 +39,6 @@ export function rgbaToHex( rgba: string ): string {
41
39
  /**
42
40
  * Convert a hex string to a rgba string
43
41
  *
44
- * @param hex
45
- *
46
42
  * @example
47
43
  * hexToRgba( '#F5C' );
48
44
  *
@@ -57,8 +53,6 @@ export function hexToRgba( hex: string ): string {
57
53
  /**
58
54
  * Return true if the string is an rgb or rgba color
59
55
  *
60
- * @param rgba
61
- *
62
56
  * @example
63
57
  * isRGBA( 'rgb(125 ,233, 105)' );
64
58
  *
@@ -74,8 +68,6 @@ export function isRGBA( rgba: string ): boolean {
74
68
  /**
75
69
  * Return true if the string is an hexadecimal color
76
70
  *
77
- * @param hexColor
78
- *
79
71
  * @example
80
72
  * isHexColor( '#FFF' );
81
73
  *
@@ -93,15 +85,13 @@ export function isHexColor( hexColor: string ): boolean {
93
85
  /**
94
86
  * Split an rgb or rgba color
95
87
  *
96
- * @param rgba
97
- *
98
88
  * @example
99
89
  * splitRGBA( 'rgb(125 ,233, 105)' );
100
90
  *
101
91
  * @example
102
92
  * splitRGBA( 'rgba(125 ,233, 105, 0.75)' );
103
93
  */
104
- export function splitRGBA( rgba: string ): ColorType {
94
+ export function splitRGBA( rgba: string ): FLib.Helpers.Color.Color {
105
95
 
106
96
  const parts: number[] = rgba
107
97
  .replace( RGBA_CLEAN_1, '' )
@@ -133,8 +123,6 @@ export function splitRGBA( rgba: string ): ColorType {
133
123
  /**
134
124
  * Split an hexadecimal color
135
125
  *
136
- * @param hexColor
137
- *
138
126
  * @example
139
127
  * splitHexColor( '#F5A' );
140
128
  *
@@ -145,7 +133,7 @@ export function splitRGBA( rgba: string ): ColorType {
145
133
  * // With alpha
146
134
  * splitHexColor( '#FA58ACCC' );
147
135
  */
148
- export function splitHexColor( hexColor: string ): ColorType {
136
+ export function splitHexColor( hexColor: string ): FLib.Helpers.Color.Color {
149
137
  let alpha;
150
138
 
151
139
  hexColor = hexColor.slice( 1 );
@@ -185,12 +173,10 @@ export function splitHexColor( hexColor: string ): ColorType {
185
173
  /**
186
174
  * Format an object color to an hex color
187
175
  *
188
- * @param color
189
- *
190
176
  * @example
191
177
  * formatHexColor( color );
192
178
  */
193
- export function formatHexColor( color: ColorType ): string {
179
+ export function formatHexColor( color: FLib.Helpers.Color.Color ): string {
194
180
  return `#${ color.hr }${ color.hg }${ color.hb }${ color.a !== 1 ? color.ha : '' }`;
195
181
  }
196
182
 
@@ -198,13 +184,11 @@ export function formatHexColor( color: ColorType ): string {
198
184
  /**
199
185
  * Format an object color to an rgba color
200
186
  *
201
- * @param color
202
- *
203
187
  * @example
204
188
  * formatRGBAColor( color );
205
189
  *
206
190
  */
207
- export function formatRGBAColor( color: ColorType ): string {
191
+ export function formatRGBAColor( color: FLib.Helpers.Color.Color ): string {
208
192
  if ( color.a !== 1 ) {
209
193
  return `rgba(${ color.r },${ color.g },${ color.b },${ color.a })`;
210
194
  }
@@ -239,7 +223,7 @@ export function formatRGBAColor( color: ColorType ): string {
239
223
  * let blendedcolor1 = shadeBlend( color1, color2, 0.333 );
240
224
  * let blendedcolor34 = shadeBlend( color3, color4, -0.8 );
241
225
  */
242
- export function shadeBlend( color1: string, color2: string | null, percent: number, render: ColorRenderType = 'obj' ): ColorType | string {
226
+ export function shadeBlend( color1: string, color2: string | null, percent: number, render: FLib.Helpers.Color.RenderType = 'obj' ): FLib.Helpers.Color.Color | string {
243
227
  let color;
244
228
 
245
229
  const coef = Math.abs( percent );
@@ -282,7 +266,7 @@ export function shadeBlend( color1: string, color2: string | null, percent: numb
282
266
  * @param percent - Percent (between 0 and 1)
283
267
  * @param render - render type: obj, hex or rgba
284
268
  */
285
- export function lighten( color: string, percent: number, render: ColorRenderType = 'obj' ): ColorType | string {
269
+ export function lighten( color: string, percent: number, render: FLib.Helpers.Color.RenderType = 'obj' ): FLib.Helpers.Color.Color | string {
286
270
  return shadeBlend( color, null, Math.abs( percent ), render );
287
271
  }
288
272
 
@@ -294,6 +278,6 @@ export function lighten( color: string, percent: number, render: ColorRenderType
294
278
  * @param percent - Percent (between 0 and 1)
295
279
  * @param render - render type: obj, hex or rgba
296
280
  */
297
- export function darken( color: string, percent: number, render: ColorRenderType = 'obj' ): ColorType | string {
281
+ export function darken( color: string, percent: number, render: FLib.Helpers.Color.RenderType = 'obj' ): FLib.Helpers.Color.Color | string {
298
282
  return shadeBlend( color, null, percent > 0 ? percent * -1 : percent, render );
299
283
  }
package/Helpers/Cookie.ts CHANGED
@@ -1,4 +1,4 @@
1
- const defaultOptions: CookieOptionsType = {
1
+ const defaultOptions: FLib.Helpers.Cookie.Options = {
2
2
  "days": null,
3
3
  "secure": window.location.protocol.indexOf('https') > -1,
4
4
  "domain": window.location.hostname,
@@ -8,9 +8,9 @@ const defaultOptions: CookieOptionsType = {
8
8
 
9
9
  /**
10
10
  * Manage cookie
11
- * @class
12
11
  *
13
12
  * @example
13
+ * ```ts
14
14
  * cookie.create( 'cookieName', 'cookieValue' )
15
15
  * cookie.read( 'cookieName' )
16
16
  * cookie.delete( 'cookieName' )
@@ -22,20 +22,17 @@ const defaultOptions: CookieOptionsType = {
22
22
  * "domain": "test.com",
23
23
  * "path": "/myDir"
24
24
  * } );
25
+ * ```
25
26
  */
26
27
  class Cookie {
27
28
 
28
29
  /**
29
30
  * Create a cookie
30
- *
31
- * @param name
32
- * @param value
33
- * @param userOptions
34
31
  */
35
- create( name: string, value: string, userOptions?: CookieOptionsType ): this {
32
+ create( name: string, value: string, userOptions: Partial<FLib.Helpers.Cookie.Options> = {} ): this {
36
33
  let date;
37
34
 
38
- const { days, secure, domain, path } = Object.assign( defaultOptions, userOptions || {} );
35
+ const { days, secure, domain, path } = Object.assign( defaultOptions, userOptions );
39
36
 
40
37
  const cookieText: string[] = [];
41
38
 
@@ -65,8 +62,6 @@ class Cookie {
65
62
 
66
63
  /**
67
64
  * Read a cookie
68
- *
69
- * @param name
70
65
  */
71
66
  read( name: string ): string {
72
67
  let c;
@@ -89,8 +84,6 @@ class Cookie {
89
84
 
90
85
  /**
91
86
  * Delete a cookie
92
- *
93
- * @param name
94
87
  */
95
88
  delete( name: string ): this {
96
89
  this.create( name, '' );
@@ -5,13 +5,6 @@ function degToRad( angle: number ): number {
5
5
 
6
6
  /**
7
7
  * Compute the distance (in km) between 2 coordinates
8
- *
9
- * @param latitude1
10
- * @param longitude1
11
- * @param latitude2
12
- * @param longitude2
13
- *
14
- * @return The distance in kilometers between 2 points
15
8
  */
16
9
  export function distance( latitude1: number, longitude1: number, latitude2: number, longitude2: number ): number {
17
10
  let dist: number;
@@ -1,24 +1,20 @@
1
1
  /**
2
2
  * Debounce
3
3
  *
4
- * @param callback
5
- * @param threshold
6
- * @param immediate
7
- *
8
4
  * @example
9
5
  * debouncedFunction = debounce( myFunction, 200 )
10
6
  */
11
7
  export function debounce(
12
8
  callback: ( ...args: any[] ) => void,
13
9
  threshold = 100,
14
- immediate: boolean = false
10
+ immediate = false
15
11
  ): ( ...args: any[] ) => void {
16
- let timeout: ReturnType<typeof setTimeout> | undefined;
12
+ let timeout: ReturnType<typeof setTimeout> | undefined;
17
13
 
18
14
  return function<Type>( this: Type, ...args: any[] ) {
19
15
 
20
16
  const later = () => {
21
- timeout =  undefined;
17
+ timeout = undefined;
22
18
 
23
19
  if ( !immediate ) {
24
20
  callback.apply( this, args );
package/Helpers/Defer.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * // To reject:
11
11
  * dfd.reject()
12
12
  *
13
- * @returns {Promise} - a promise with a resolve and reject function
13
+ * @returns - a promise with a resolve and reject function
14
14
  */
15
15
  export function defer(): Promise<any> & { resolve: ( a?: any ) => void; reject: ( a?: any ) => void; } {
16
16
  let res: (a: any ) => void,
@@ -17,8 +17,6 @@ function cleanFieldsValue( value: any ): string {
17
17
  /**
18
18
  * Get the value of a form field (get from jQuery)
19
19
  *
20
- * @param $input
21
- *
22
20
  * @example value = getValue( $input )
23
21
  *
24
22
  * @returns The value of the form field
package/Helpers/Insert.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Insert a value or an object in a list. Doesn't change the original list.
3
3
  *
4
- * @param list
5
4
  * @param what - Something to insert
6
5
  * @param indexWhere - Index in the list
7
6
  *
@@ -4,8 +4,6 @@ import { isArray } from './Type';
4
4
  /**
5
5
  * Create a sequential list of promises (which resolves one after another)
6
6
  *
7
- * @param promisesArray
8
- *
9
7
  * @example
10
8
  * prom = sequence( arrayOfPromise )
11
9
  */
package/Helpers/Slice.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  /**
2
2
  * Remove an object from a list. Doesn't change the original list.
3
3
  *
4
- * @param list
5
- * @param what
6
- *
7
4
  * @example
8
5
  * modifiedArray = slice( list, obj )
9
6
  *
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Throttle
3
3
  *
4
- * @param callback
5
4
  * @param limit - In millisecond
6
5
  *
7
6
  * @example
@@ -40,18 +40,19 @@ function addWatcher( $element: HTMLElement, styleChange: ( $element: HTMLElement
40
40
  * @param styleChange - Change the style of $element inside this function by adding a class or set a style property
41
41
  * @param delay - Delay betwwen the add of the listener and call of styleChange.
42
42
  *
43
- * @description
44
- *
45
43
  * delay = 'idle' : window.requestIdleCallback
46
44
  * delay &lt; 0 : window.requestAnimationFrame
47
45
  * delay &gt;= 0 : setTimeout
48
46
  *
49
- * @example Watch for the end of the transition of the property "opacity" on the pseudo element ::after on $element
47
+ * @example
48
+ * ```ts
49
+ * // Watch for the end of the transition of the property "opacity" on the pseudo element ::after on $element
50
50
  *
51
51
  * const myWatcher = transitionWatcher( $elment, () =&gt; $element.classList.add('some-class'), {
52
52
  * "pseudoElement": "after",
53
53
  * "property": "opacity"
54
54
  * } );
55
+ * ```
55
56
  */
56
57
  export function transitionWatcher( $element: HTMLElement, styleChange: ( $element: HTMLElement ) => (Promise<void> | any ), options?: { delay: 'idle' | number, pseudoElement?: 'after' | 'before' | 'both', animationName?: string[] } ): Promise<HTMLElement> {
57
58
  return addWatcher( $element, styleChange, false, options );
@@ -62,18 +63,19 @@ export function transitionWatcher( $element: HTMLElement, styleChange: ( $elemen
62
63
  * @param animationStart - Start the animation of $element inside this function by adding a class or set a style property
63
64
  * @param delay - Delay betwwen the add of the listener and call of animationStart.
64
65
  *
65
- * @description
66
- *
67
66
  * delay = 'idle' : window.requestIdleCallback
68
67
  * delay &lt; 0 : window.requestAnimationFrame
69
68
  * delay &gt;= 0 : setTimeout
70
69
  *
71
- * @example Watch for the end of the animation "my-animation" on the pseudo element ::after on $element
70
+ * @example
71
+ * ```ts
72
+ * //Watch for the end of the animation "my-animation" on the pseudo element ::after on $element
72
73
  *
73
74
  * const myWatcher = animationWatcher( $elment, () =&gt; $element.classList.add('some-class'), {
74
75
  * "pseudoElement": "after",
75
76
  * "animationName": ["my-animation"]
76
77
  * } );
78
+ * ```
77
79
  */
78
80
  export function animationWatcher( $element: HTMLElement, animationStart: ( $element: HTMLElement ) => (Promise<void> | any ), options?: { delay: 'idle' | number, pseudoElement?: 'after' | 'before' | 'both', animationName?: string[] } ): Promise<HTMLElement> {
79
81
  return addWatcher( $element, animationStart, true, options );