@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
@@ -16,24 +16,26 @@ const defaultOptions = {
16
16
  * You can access the skin API in the __skinAPI property of the $radio HTMLElement or its wrapper.
17
17
  *
18
18
  * @example
19
+ * ```ts
19
20
  * // Call with default options:
20
21
  * skinRadio( $radio, {
21
- * "wrap": "<span class=\"rb-skin\"></span>",
22
+ * "wrap": "&lt;span class=\"rb-skin\"&gt;&lt;/span&gt;",
22
23
  * "invalidClass": "invalid",
23
24
  * "disabledClass": "disabled",
24
25
  * "checkedClass": "checked"
25
26
  * } );
27
+ * ```
26
28
  */
27
29
  export default class SkinRadioButton {
28
- #$radio!: CustomRadioButtonType;
29
- #options!: SkinRadioOptionsType;
30
- #$parent!: CustomRadioButtonParentType;
31
- #$rdGroup!: NodeList;
30
+ #$radio!: FLib.SkinRadio.CustomRadioButton;
31
+ #options!: FLib.SkinRadio.Options;
32
+ #$parent!: FLib.SkinRadio.CustomRadioButtonParent;
33
+ #$rdGroup!: NodeListOf<FLib.SkinRadio.CustomRadioButton>;
32
34
 
33
- constructor( $radio: HTMLInputElement, userOptions?: SkinRadioOptionsType ) {
35
+ constructor( $radio: HTMLInputElement, userOptions?: Partial<FLib.SkinRadio.Options> ) {
34
36
 
35
37
  // Already skinned
36
- if ( ($radio as CustomRadioButtonType).__skinAPI ) {
38
+ if ( ($radio as FLib.SkinRadio.CustomRadioButton).__skinAPI ) {
37
39
  return;
38
40
  }
39
41
 
@@ -45,20 +47,20 @@ export default class SkinRadioButton {
45
47
 
46
48
  // Store all radio with same name
47
49
 
48
- if ( !this.#$radio.__$rdGroup ) {
49
- this.#$rdGroup = document.querySelectorAll( `input[type="radio"][name="${ rdName }"]` );
50
+ if ( !this.#$radio.__$radioGroup ) {
51
+ this.#$rdGroup = document.querySelectorAll( `input[type="radio"][name="${ rdName }"]` ) as NodeListOf<FLib.SkinRadio.CustomRadioButton>;
50
52
 
51
53
  this.#$rdGroup.forEach( $r => {
52
- ($r as CustomRadioButtonType).__$rdGroup = this.#$rdGroup;
54
+ ($r as FLib.SkinRadio.CustomRadioButton).__$radioGroup = this.#$rdGroup;
53
55
  } );
54
56
  }
55
57
  else {
56
- this.#$rdGroup = this.#$radio.__$rdGroup;
58
+ this.#$rdGroup = this.#$radio.__$radioGroup;
57
59
  }
58
60
 
59
61
 
60
- wrap( this.#$radio, this.#options.wrap! );
61
- this.#$parent = this.#$radio.parentNode as CustomRadioButtonParentType;
62
+ wrap( this.#$radio, this.#options.wrap );
63
+ this.#$parent = this.#$radio.parentNode as FLib.SkinRadio.CustomRadioButtonParent;
62
64
 
63
65
  this.#$parent.__skinAPI = this.#$radio.__skinAPI = this;
64
66
 
@@ -68,22 +70,22 @@ export default class SkinRadioButton {
68
70
 
69
71
  this.#$radio.addEventListener( 'click', this.#changeHandler );
70
72
 
71
- this.update( this.#$radio );
73
+ this.#update( this.#$radio );
72
74
 
73
75
  }
74
76
 
75
77
 
76
- private update( $rd ) {
78
+ #update = ( $rd: FLib.SkinRadio.CustomRadioButton ): void => {
77
79
  $rd.__skinAPI[ $rd.checked ? 'check' : 'uncheck' ]();
78
80
  }
79
81
 
80
82
 
81
- #changeHandler = () => {
82
- this.#$rdGroup.forEach( $rd => this.update( $rd ) );
83
+ #changeHandler = (): void => {
84
+ this.#$rdGroup.forEach( $rd => this.#update( $rd ) );
83
85
  }
84
86
 
85
87
 
86
- private enableDisable( fnName: string, disabled: boolean ) {
88
+ #enableDisable = ( fnName: string, disabled: boolean ): void => {
87
89
  this.#$rdGroup.forEach( ( $r: Node ) => {
88
90
  ($r as HTMLInputElement).disabled = disabled;
89
91
  ($r.parentNode as HTMLElement).classList[ fnName ]( this.#options.disabledClass );
@@ -91,7 +93,7 @@ export default class SkinRadioButton {
91
93
  }
92
94
 
93
95
 
94
- private validInvalid( fnName: string ) {
96
+ #validInvalid = ( fnName: string ): void => {
95
97
  this.#$rdGroup.forEach( ( $r: Node ) => {
96
98
  ($r.parentNode as HTMLElement).classList[ fnName ]( this.#options.invalidClass );
97
99
  } );
@@ -101,53 +103,65 @@ export default class SkinRadioButton {
101
103
  /**
102
104
  * Force the radio button to be check
103
105
  */
104
- check() {
106
+ check(): this {
105
107
  this.#$rdGroup.forEach( ( $r: Node ) => {
106
108
  ($r as HTMLInputElement).checked = $r === this.#$radio;
107
- ($r.parentNode as HTMLElement).classList[ $r === this.#$radio ? 'add' : 'remove' ]( this.#options.checkedClass! );
109
+ ($r.parentNode as HTMLElement).classList[ $r === this.#$radio ? 'add' : 'remove' ]( this.#options.checkedClass );
108
110
  } );
109
- };
111
+
112
+ return this;
113
+ }
110
114
 
111
115
 
112
116
  /**
113
117
  * Force the radio button to be uncheck
114
118
  */
115
- uncheck() {
119
+ uncheck(): this {
116
120
  this.#$radio.checked = false;
117
- this.#$parent.classList.remove( this.#options.checkedClass! );
118
- };
121
+ this.#$parent.classList.remove( this.#options.checkedClass );
122
+
123
+ return this;
124
+ }
119
125
 
120
126
 
121
127
  /**
122
128
  * Force the radio button to be enable
123
129
  */
124
- enable() {
125
- this.enableDisable( 'remove', false );
126
- };
130
+ enable(): this {
131
+ this.#enableDisable( 'remove', false );
132
+
133
+ return this;
134
+ }
127
135
 
128
136
 
129
137
  /**
130
138
  * Force the radio button to be disable
131
139
  */
132
- disable() {
133
- this.enableDisable( 'add', true );
134
- };
140
+ disable(): this {
141
+ this.#enableDisable( 'add', true );
142
+
143
+ return this;
144
+ }
135
145
 
136
146
 
137
147
  /**
138
148
  * Force the state of the radio button to invalid
139
149
  */
140
- setInvalid() {
141
- this.validInvalid( 'add' );
142
- };
150
+ setInvalid(): this {
151
+ this.#validInvalid( 'add' );
152
+
153
+ return this;
154
+ }
143
155
 
144
156
 
145
157
  /**
146
158
  * Force the state of the radio button to valid
147
159
  */
148
- setValid() {
149
- this.validInvalid( 'remove' );
150
- };
160
+ setValid(): this {
161
+ this.#validInvalid( 'remove' );
162
+
163
+ return this;
164
+ }
151
165
  }
152
166
 
153
167
 
@@ -155,15 +169,17 @@ export default class SkinRadioButton {
155
169
  * Skin a radio input
156
170
  *
157
171
  * @example
172
+ * ```ts
158
173
  * // Call with default options:
159
174
  * skinRadio( $radio, {
160
- * "wrap": "<span class=\"rb-skin\"></span>",
175
+ * "wrap": "&lt;span class=\"rb-skin\"&gt;&lt;/span&gt;",
161
176
  * "invalidClass": "invalid",
162
177
  * "disabledClass": "disabled",
163
178
  * "checkedClass": "checked"
164
179
  * } );
180
+ * ```
165
181
  */
166
- export function skinRadio( $radio: HTMLInputElement, options: SkinRadioOptionsType ): SkinRadioButton {
182
+ export function skinRadio( $radio: HTMLInputElement, options: Partial<FLib.SkinRadio.Options> ): SkinRadioButton {
167
183
  return new SkinRadioButton( $radio, options );
168
184
  }
169
185
 
@@ -172,16 +188,18 @@ export function skinRadio( $radio: HTMLInputElement, options: SkinRadioOptionsTy
172
188
  * Select all radio input in a $wrapper
173
189
  *
174
190
  * @example
191
+ * ```ts
175
192
  * // Call with default options:
176
193
  * skinRadioAll( $wrapper, {
177
- * "wrap": "<span class=\"rb-skin\"></span>",
194
+ * "wrap": "&lt;span class=\"rb-skin\"&gt;&lt;/span&gt;",
178
195
  * "selector": "input[type=\"radio\"]",
179
196
  * "invalidClass": "invalid",
180
197
  * "disabledClass": "disabled",
181
198
  * "checkedClass": "checked"
182
199
  * } );
200
+ * ```
183
201
  */
184
- export function skinRadioAll( $wrapper: HTMLElement, options: SkinRadioAllOptionsType = {} ): SkinRadioButton[] {
202
+ export function skinRadioAll( $wrapper: HTMLElement, options: Partial<FLib.SkinRadio.AllOptions> = {} ): SkinRadioButton[] {
185
203
 
186
204
  const $radioButtons = $wrapper.querySelectorAll( options.selector || 'input[type="radio"]' );
187
205
  const skinList: SkinRadioButton[] = [];
@@ -196,6 +214,7 @@ export function skinRadioAll( $wrapper: HTMLElement, options: SkinRadioAllOption
196
214
  * Select all radio input of the same group (same name)
197
215
  *
198
216
  * @example
217
+ * ```ts
199
218
  * // Call with default options:
200
219
  * skinRadioGroup( $radio, {
201
220
  * "wrap": "<span class=\"rb-skin\"></span>",
@@ -203,8 +222,9 @@ export function skinRadioAll( $wrapper: HTMLElement, options: SkinRadioAllOption
203
222
  * "disabledClass": "disabled",
204
223
  * "checkedClass": "checked"
205
224
  * } );
225
+ * ```
206
226
  */
207
- export function skinRadioGroup( $radioButtonOrInputName: HTMLInputElement | string, options: SkinRadioOptionsType ): SkinRadioButton[] {
227
+ export function skinRadioGroup( $radioButtonOrInputName: HTMLInputElement | string, options: FLib.SkinRadio.Options ): SkinRadioButton[] {
208
228
 
209
229
  const inputName = isString( $radioButtonOrInputName ) ? $radioButtonOrInputName : ($radioButtonOrInputName as HTMLInputElement).getAttribute( 'name' );
210
230