@creative-web-solution/front-library 7.0.7 → 7.1.3

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 +29 -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 +12 -18
  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 +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
@@ -9,33 +9,27 @@ import { rClass } from '../DOM/Class';
9
9
  import { position } from '../DOM/Position';
10
10
  import { height } from '../DOM/Size';
11
11
  import { outerHeight } from '../DOM/OuterSize';
12
- import template from './Template';
12
+ import quickTemplate from './QuickTemplate';
13
13
 
14
14
 
15
- const defaultOptions: SkinSelectOptionsType = {
15
+ const defaultOptions: FLib.SkinSelect.Options = {
16
16
  "full": false,
17
17
  "extraClass": [],
18
18
  "className": "select-skin",
19
19
  "itemClassName": "select-itm",
20
20
  "selectWrapClassName": "select",
21
21
  "layerClassName": "select-layer",
22
+ "listClassName": "select-list",
22
23
  "hoverItemClass": "hover",
23
24
  "openedListClass": "show",
24
25
  "activeOptionClass": "on",
25
26
  "disabledClass": "disabled",
26
27
  "invalidClass": "invalid",
27
28
  "loadingClass": "loading",
28
- "listTpl": [
29
- '<div class="select-layer">',
30
- '<ul class="select-list">',
31
- '<% for ( var i = 0, len = list.length; i < len; ++i ) { %>',
32
- '<li class="select-itm<%= list[ i ].selected ? " on" : "" %>" data-value="<%= list[ i ].value %>">',
33
- '<%= list[ i ].text %>',
34
- '</li>',
35
- '<% } %>',
36
- '</ul>',
37
- '</div>'
38
- ].join('')
29
+ "listTpl": {
30
+ "wrapper": "<div class=\"{{ layerClassName }}\"><ul class=\"{{ listClassName }}\">{{ items }}</ul></div>",
31
+ "item": "<li class=\"{{ itemClassName }}{{ onClass }}\" data-value=\"{{ value }}\">{{ text }}</li>"
32
+ }
39
33
  };
40
34
 
41
35
 
@@ -43,20 +37,20 @@ const defaultOptions: SkinSelectOptionsType = {
43
37
  * Skin an HTML select element. If options.full is set to true, also skin the options list.
44
38
  * You can access the skin API in the __skinAPI property of the $select HTMLElement or its wrapper.
45
39
  */
46
- export default class SkinSelect {
47
- #$select: CustomSelectType;
40
+ export default class SkinSelect implements FLib.SkinSelect.SkinSelect {
41
+ #$select: FLib.SkinSelect.CustomSelect;
48
42
  #loading!: boolean;
49
- #options!: SkinSelectOptionsType;
43
+ #options!: FLib.SkinSelect.Options;
50
44
  #extraClass!: string;
51
- #$parent!: CustomSelectParentType;
45
+ #$parent!: FLib.SkinSelect.CustomSelectParent;
52
46
  #$title!: HTMLElement;
53
47
  #isListOpened!: boolean;
54
48
  #$options!: NodeList;
55
- #$lastOption!: HTMLElement | null;
49
+ #$lastOption!: HTMLElement | null;
56
50
  #focusedItemIndex!: number;
57
51
  #$layer!: HTMLElement;
58
52
 
59
- constructor( $select: HTMLSelectElement, userOptions?: SkinSelectOptionsType ) {
53
+ constructor( $select: HTMLSelectElement, userOptions?: Partial<FLib.SkinSelect.Options> ) {
60
54
 
61
55
  this.#$select = $select;
62
56
 
@@ -77,7 +71,7 @@ export default class SkinSelect {
77
71
  this.#$parent = $select.parentNode as HTMLElement;
78
72
 
79
73
  // Create skin
80
- if ( !hClass( this.#$parent, this.#options.className! ) ) {
74
+ if ( !hClass( this.#$parent, this.#options.className ) ) {
81
75
  this.#$parent = wrap(
82
76
  this.#$select,
83
77
  `<span class="${ this.#options.className } ${ this.#extraClass }"></span>`
@@ -89,7 +83,7 @@ export default class SkinSelect {
89
83
 
90
84
  if ( !$TITLE ) {
91
85
  this.#$title = document.createElement( 'SPAN' );
92
- aClass( this.#$title, this.#options.selectWrapClassName! );
86
+ aClass( this.#$title, this.#options.selectWrapClassName );
93
87
  this.#$parent.appendChild( this.#$title );
94
88
  }
95
89
  else {
@@ -137,8 +131,8 @@ export default class SkinSelect {
137
131
  }
138
132
 
139
133
 
140
- #closeList = () => {
141
- this.#$parent.classList.remove( this.#options.openedListClass! );
134
+ #closeList = (): void => {
135
+ this.#$parent.classList.remove( this.#options.openedListClass );
142
136
 
143
137
  off( document.body, {
144
138
  "eventsName": "click",
@@ -147,12 +141,11 @@ export default class SkinSelect {
147
141
 
148
142
  this.#isListOpened = false;
149
143
 
150
- this.removeItemFocus();
151
-
144
+ this.#removeItemFocus();
152
145
  }
153
146
 
154
147
 
155
- #openList = () => {
148
+ #openList = (): void => {
156
149
  if ( this.#$select.disabled || this.#loading ) {
157
150
  return;
158
151
  }
@@ -162,7 +155,7 @@ export default class SkinSelect {
162
155
  return;
163
156
  }
164
157
 
165
- this.#$parent.classList.add( this.#options.openedListClass! );
158
+ this.#$parent.classList.add( this.#options.openedListClass );
166
159
 
167
160
  window.requestAnimationFrame( () => {
168
161
  on( document.body, {
@@ -177,14 +170,14 @@ export default class SkinSelect {
177
170
  this.#focusedItemIndex = this.#focusedItemIndex > -1 ? this.#focusedItemIndex : 0;
178
171
  }
179
172
 
180
- this.focusItem( this.#focusedItemIndex );
173
+ this.#focusItem( this.#focusedItemIndex );
181
174
  }
182
175
 
183
176
  this.#isListOpened = true;
184
177
  }
185
178
 
186
179
 
187
- private enableDisable( fnName: string, disabled: boolean ) {
180
+ #enableDisable = ( fnName: string, disabled: boolean ): void => {
188
181
  this.#$select.disabled = disabled;
189
182
  this.#$parent.classList[ fnName ]( this.#options.disabledClass );
190
183
  }
@@ -193,20 +186,24 @@ export default class SkinSelect {
193
186
  /**
194
187
  * Force the select to be enable
195
188
  */
196
- enable() {
197
- this.enableDisable( 'remove', false );
189
+ enable(): this {
190
+ this.#enableDisable( 'remove', false );
191
+
192
+ return this
198
193
  }
199
194
 
200
195
 
201
196
  /**
202
197
  * Force the select to be disable
203
198
  */
204
- disable() {
205
- this.enableDisable( 'add', true );
199
+ disable(): this {
200
+ this.#enableDisable( 'add', true );
201
+
202
+ return this
206
203
  }
207
204
 
208
205
 
209
- private loadingStatus( fnName: string, isLoading: boolean ) {
206
+ #loadingStatus = ( fnName: string, isLoading: boolean ): void => {
210
207
  this.#loading = isLoading;
211
208
  this.#$parent.classList[ fnName ]( this.#options.loadingClass );
212
209
  }
@@ -215,20 +212,24 @@ export default class SkinSelect {
215
212
  /**
216
213
  * Add the loading css class to the main element
217
214
  */
218
- setLoading() {
219
- this.loadingStatus( 'add', true );
215
+ setLoading(): this {
216
+ this.#loadingStatus( 'add', true );
217
+
218
+ return this;
220
219
  }
221
220
 
222
221
 
223
222
  /**
224
223
  * Remove the loading css class to the main element
225
224
  */
226
- unsetLoading() {
227
- this.loadingStatus( 'remove', false );
225
+ unsetLoading(): this {
226
+ this.#loadingStatus( 'remove', false );
227
+
228
+ return this;
228
229
  }
229
230
 
230
231
 
231
- private validInvalid( fnName: string ) {
232
+ #validInvalid = ( fnName: string ): void => {
232
233
  this.#$parent.classList[ fnName ]( this.#options.invalidClass );
233
234
  }
234
235
 
@@ -236,52 +237,55 @@ export default class SkinSelect {
236
237
  /**
237
238
  * Force the state of the select to invalid
238
239
  */
239
- setInvalid() {
240
- this.validInvalid( 'add' );
241
- };
240
+ setInvalid(): this {
241
+ this.#validInvalid( 'add' );
242
+
243
+ return this;
244
+ }
242
245
 
243
246
 
244
247
  /**
245
248
  * Force the state of the select to valid
246
249
  */
247
- setValid() {
248
- this.validInvalid( 'remove' );
249
- };
250
+ setValid(): this {
251
+ this.#validInvalid( 'remove' );
252
+
253
+ return this;
254
+ }
250
255
 
251
256
 
252
257
  /**
253
258
  * Force the update of title with the currently selected element text
254
259
  */
255
- updateTitle() {
256
- let title;
260
+ updateTitle(): this {
257
261
 
258
262
  if ( this.#$select.selectedIndex < 0 ) {
259
263
  this.#$title.innerHTML = '';
260
264
  this.#closeList();
261
- return;
265
+ return this;
262
266
  }
263
267
 
264
- title = this.#$select.options[ this.#$select.selectedIndex ].text;
268
+ const title = this.#$select.options[ this.#$select.selectedIndex ].text;
265
269
 
266
270
  this.#$title.innerHTML = title;
267
271
 
268
272
  this.#closeList();
273
+
274
+ return this;
269
275
  }
270
276
 
271
277
 
272
278
  /**
273
279
  * Select an option
274
- *
275
- * @param {HTMLElement|Number} optionOrIndex
276
280
  */
277
- select( optionOrIndex: HTMLElement | number ) {
278
- let _index, option, isParameterANumber;
281
+ select( optionOrIndex: HTMLElement | number ): this {
282
+ let _index, option;
279
283
 
280
284
  if ( this.#$select.disabled || this.#loading ) {
281
- return;
285
+ return this;
282
286
  }
283
287
 
284
- isParameterANumber = isNumber( optionOrIndex );
288
+ const isParameterANumber = isNumber( optionOrIndex );
285
289
 
286
290
  if ( isParameterANumber ) {
287
291
  _index = optionOrIndex;
@@ -291,7 +295,7 @@ export default class SkinSelect {
291
295
  }
292
296
 
293
297
  if ( _index < 0 || _index > this.#$select.options.length ) {
294
- return;
298
+ return this;
295
299
  }
296
300
 
297
301
  this.#$select.options[ _index ].selected = true;
@@ -300,7 +304,7 @@ export default class SkinSelect {
300
304
  option = this.#$parent.querySelectorAll( `.${ this.#options.itemClassName }` )[ _index ];
301
305
 
302
306
  if ( this.#$lastOption ) {
303
- this.#$lastOption.classList.remove( this.#options.activeOptionClass! );
307
+ this.#$lastOption.classList.remove( this.#options.activeOptionClass );
304
308
  }
305
309
 
306
310
  if ( option ) {
@@ -312,15 +316,17 @@ export default class SkinSelect {
312
316
  fire( this.#$select, {
313
317
  "eventsName": "change"
314
318
  } );
319
+
320
+ return this;
315
321
  }
316
322
 
317
323
 
318
- private setSelectOptions( data: SkinSelectOptionArrayType[] ) {
319
- let normalizedData, hasSelectedOption;
324
+ #setSelectOptions = ( data: FLib.SkinSelect.OptionArray[] ): void => {
325
+ let hasSelectedOption;
320
326
 
321
327
  this.#$select.options.length = 0;
322
328
 
323
- normalizedData = data.map( dt => {
329
+ const normalizedData = data.map( dt => {
324
330
  if ( dt.selected ) {
325
331
  hasSelectedOption = true;
326
332
  }
@@ -347,24 +353,23 @@ export default class SkinSelect {
347
353
  /**
348
354
  * Update the options list. If optionsArray is not set, only update the html of the skinned options list.
349
355
  *
350
- * @param optionsArray
351
- *
352
356
  * @example
357
+ * ```ts
353
358
  * selectAPI.updateOptions( [{"text": "Option 1", "value": "value 1", "selected": true}, ...] )
359
+ * ```
354
360
  */
355
- updateOptions( optionsArray?: SkinSelectOptionArrayType[] ) {
356
- let htmlList;
361
+ updateOptions( optionsArray?: FLib.SkinSelect.OptionArray[] ): this {
357
362
 
358
363
  this.#$lastOption = null;
359
364
  this.#focusedItemIndex = -1;
360
365
 
361
366
  if ( optionsArray ) {
362
- this.setSelectOptions( optionsArray );
367
+ this.#setSelectOptions( optionsArray );
363
368
  this.updateTitle();
364
369
  }
365
370
 
366
371
  if ( !this.#options.full ) {
367
- return;
372
+ return this;
368
373
  }
369
374
 
370
375
  this.#$select.style.display = 'none';
@@ -375,31 +380,46 @@ export default class SkinSelect {
375
380
  this.#$layer.parentNode.removeChild( this.#$layer );
376
381
  }
377
382
 
378
- htmlList = template( this.#options.listTpl!, { "list": this.#$select.options } );
379
- this.#$parent.appendChild( strToDOM( htmlList ) );
383
+ // let htmlList = template( this.#options.listTpl, { "list": this.#$select.options } );
384
+ const HTML_LIST: string[] = [];
385
+
386
+ for ( const opt of Array.from( this.#$select.options ) ) {
387
+ HTML_LIST.push( quickTemplate( this.#options.listTpl.item, {
388
+ "onClass": opt.selected ? " on" : "",
389
+ "text": opt.text,
390
+ "value": opt.value
391
+ } ) );
392
+ }
393
+
394
+ this.#$parent.appendChild( strToDOM( quickTemplate( this.#options.listTpl.wrapper, {
395
+ "items": HTML_LIST.join( '' )
396
+ } ) ) );
397
+
380
398
 
381
399
  this.#$layer = this.#$parent.querySelector( `.${ this.#options.layerClassName }` ) as HTMLElement;
382
400
  this.#$options = this.#$layer.querySelectorAll( 'li' );
383
401
 
384
402
  this.#$lastOption = this.#$parent.querySelector( `li.${ this.#options.activeOptionClass }` );
403
+
404
+ return this;
385
405
  }
386
406
 
387
407
 
388
- #changeHandler = () => {
408
+ #changeHandler = (): void => {
389
409
  this.updateTitle();
390
410
  }
391
411
 
392
412
 
393
413
  // Handle click on the skinned ul>li list
394
- #fakeOptionsClickHandler = ( e ) => {
395
- if ( !e.target.matches( '.' + this.#options.itemClassName ) ) {
414
+ #fakeOptionsClickHandler = ( e: MouseEvent ): void => {
415
+ if ( !(e.target as HTMLElement).matches( '.' + this.#options.itemClassName ) ) {
396
416
  return;
397
417
  }
398
- this.select( e.target );
418
+ this.select( e.target as HTMLElement );
399
419
  }
400
420
 
401
421
 
402
- private focusItem( index ) {
422
+ #focusItem = ( index: number ): void => {
403
423
  if ( index < 0 ) {
404
424
  index = this.#$options.length - 1;
405
425
  }
@@ -410,24 +430,24 @@ export default class SkinSelect {
410
430
  return;
411
431
  }
412
432
 
413
- this.removeItemFocus();
433
+ this.#removeItemFocus();
414
434
 
415
- aClass( this.#$options[ index ], this.#options.hoverItemClass! );
416
- this.updateListScroll( this.#$options[ index ] );
435
+ aClass( this.#$options[ index ], this.#options.hoverItemClass );
436
+ this.#updateListScroll( this.#$options[ index ] as HTMLElement );
417
437
 
418
438
  this.#focusedItemIndex = index;
419
439
  }
420
440
 
421
441
 
422
- private removeItemFocus() {
442
+ #removeItemFocus = (): void => {
423
443
  if ( this.#focusedItemIndex !== null && this.#$options && this.#$options[ this.#focusedItemIndex ] ) {
424
- rClass( this.#$options[ this.#focusedItemIndex ], this.#options.hoverItemClass! );
444
+ rClass( this.#$options[ this.#focusedItemIndex ], this.#options.hoverItemClass );
425
445
  this.#focusedItemIndex = -1;
426
446
  }
427
447
  }
428
448
 
429
449
 
430
- private updateListScroll( $item ) {
450
+ #updateListScroll = ( $item: HTMLElement ): void => {
431
451
  let itemPos, itemHeight, layerScrollTop, layerHeight;
432
452
 
433
453
  if ( this.#$layer ) {
@@ -446,7 +466,7 @@ export default class SkinSelect {
446
466
  }
447
467
 
448
468
 
449
- #onKeydown = ( e ) => {
469
+ #onKeydown = ( e: KeyboardEvent ): void => {
450
470
  switch ( e.keyCode ) {
451
471
  case 38: // UP
452
472
  case 40: // DOWN
@@ -458,17 +478,17 @@ export default class SkinSelect {
458
478
  }
459
479
 
460
480
 
461
- #onKeyup = ( e ) => {
481
+ #onKeyup = ( e: KeyboardEvent ): void => {
462
482
  switch ( e.keyCode ) {
463
483
  case 38: // UP
464
- this.focusItem( this.#focusedItemIndex - 1 );
484
+ this.#focusItem( this.#focusedItemIndex - 1 );
465
485
  break;
466
486
  case 40: // DOWN
467
487
  if ( !this.#isListOpened ) {
468
488
  this.#openList();
469
489
  break;
470
490
  }
471
- this.focusItem( this.#focusedItemIndex + 1 );
491
+ this.#focusItem( this.#focusedItemIndex + 1 );
472
492
  break;
473
493
 
474
494
  case 13: // ENTER
@@ -493,31 +513,29 @@ export default class SkinSelect {
493
513
  * Skin a select DOM element
494
514
  *
495
515
  * @example
516
+ * ```ts
496
517
  * // Call with default options:
497
518
  * skinSelect( $select, {
498
519
  * "full": false,
499
- * "extraClass": ['otherClassName'],
520
+ * "extraClass": [],
500
521
  * "className": "select-skin",
501
522
  * "itemClassName": "select-itm",
502
523
  * "selectWrapClassName": "select",
524
+ * "layerClassName": "select-layer",
525
+ * "listClassName": "select-list",
526
+ * "hoverItemClass": "hover",
503
527
  * "openedListClass": "show",
504
528
  * "activeOptionClass": "on",
505
529
  * "disabledClass": "disabled",
530
+ * "invalidClass": "invalid",
506
531
  * "loadingClass": "loading",
507
- * "listTpl": [
508
- * '<div class="select-layer">',
509
- * '<ul class="select-list">',
510
- * '<% for ( var i = 0, len = list.length; i < len; ++i ) { %>',
511
- * '<li class="select-itm<%= list[ i ].selected ? " on" : "" %>" data-value="<%= list[ i ].value %>">',
512
- * '<%= list[ i ].text %>',
513
- * '</li>',
514
- * '<% } %>',
515
- * '</ul>',
516
- * '</div>'
517
- * ].join( '' )
518
- * } );
532
+ * "listTpl": {
533
+ * "wrapper": "<div class=\"{{ layerClassName }}\"><ul class=\"{{ listClassName }}\">{{ items }}</ul></div>",
534
+ * "item": "<li class=\"{{ itemClassName }}{{ onClass }}\" data-value=\"{{ value }}\">{{ text }}</li>"
535
+ * }
536
+ * ```
519
537
  */
520
- export function skinSelect( $select: HTMLSelectElement, options: SkinSelectOptionsType ): SkinSelect {
538
+ export function skinSelect( $select: HTMLSelectElement, options: Partial<FLib.SkinSelect.Options> ): SkinSelect {
521
539
  return new SkinSelect( $select, options );
522
540
  }
523
541
 
@@ -528,13 +546,11 @@ export function skinSelect( $select: HTMLSelectElement, options: SkinSelectOptio
528
546
  * @example
529
547
  * // See skinSelect for example of options
530
548
  * skinSelectAll( $wrapper, options )
531
- *
532
- * @returns {SkinSelect[]}
533
549
  */
534
- export function skinSelectAll( $wrapper: HTMLElement, userOptions: SkinSelectAllOptionsType = {} ): SkinSelect[] {
550
+ export function skinSelectAll( $wrapper: HTMLElement, userOptions: Partial<FLib.SkinSelect.AllOptions> = {} ): SkinSelect[] {
535
551
  const skinList: SkinSelect[] = [];
536
552
 
537
- const defaultOptions: SkinSelectAllOptionsType = {
553
+ const defaultOptions: Partial<FLib.SkinSelect.AllOptions> = {
538
554
  "full": false,
539
555
  "extraClass": []
540
556
  };