@creative-web-solution/front-library 7.1.25 → 7.1.27
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.
- package/CHANGELOG.md +16 -0
- package/Helpers/Insert.ts +9 -9
- package/Modules/DragSlider.ts +158 -75
- package/Modules/Popin/Popin.ts +5 -5
- package/Modules/Popin/Tools.ts +1 -0
- package/Modules/Slider/Slider.ts +5 -5
- package/Modules/YouTubePlayer.ts +7 -6
- package/README.md +1 -1
- package/Types/DragSlider.d.ts +9 -6
- package/Types/Global.d.ts +0 -20
- package/Types/Popin.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 7.1.27
|
|
4
|
+
|
|
5
|
+
* [Slider]: Remove gsap
|
|
6
|
+
* [DragSlider]
|
|
7
|
+
* Remove gsap
|
|
8
|
+
* Add accessibility feature
|
|
9
|
+
* Take last item margin in account
|
|
10
|
+
* Improvements
|
|
11
|
+
* [YouTubePlayer]: Update parameters doc
|
|
12
|
+
* [Popin]:
|
|
13
|
+
* Fix focus issue
|
|
14
|
+
* Handle background to be inside the popin
|
|
15
|
+
|
|
16
|
+
|
|
3
17
|
## 7.1.26
|
|
4
18
|
|
|
19
|
+
* Remove unused types
|
|
20
|
+
* Fix insert function
|
|
5
21
|
* Use $target instead of e.target in EventManager callbacks
|
|
6
22
|
|
|
7
23
|
|
package/Helpers/Insert.ts
CHANGED
|
@@ -9,24 +9,24 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @returns New modified array
|
|
11
11
|
*/
|
|
12
|
-
export function insert(
|
|
12
|
+
export function insert(list: any[], what: any, indexWhere: number): any[] {
|
|
13
13
|
const listLength = list.length;
|
|
14
14
|
|
|
15
|
-
if (
|
|
16
|
-
return
|
|
15
|
+
if (!listLength) {
|
|
16
|
+
return [what];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
if (
|
|
20
|
-
return [
|
|
19
|
+
if (indexWhere <= 0) {
|
|
20
|
+
return [what, ...list];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (
|
|
24
|
-
return [
|
|
23
|
+
if (indexWhere >= listLength) {
|
|
24
|
+
return [...list, what];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return [
|
|
28
|
-
...list.slice(
|
|
28
|
+
...list.slice(0, indexWhere),
|
|
29
29
|
what,
|
|
30
|
-
...list.slice(
|
|
30
|
+
...list.slice(indexWhere, list.length),
|
|
31
31
|
];
|
|
32
32
|
}
|
package/Modules/DragSlider.ts
CHANGED
|
@@ -13,40 +13,42 @@ const defaultOptions = {
|
|
|
13
13
|
swipeTresholdSize: 0.5,
|
|
14
14
|
lockedClass: 'is-locked',
|
|
15
15
|
_animReset: function($list) {
|
|
16
|
-
gsap.set( $list, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} );
|
|
16
|
+
// gsap.set( $list, {
|
|
17
|
+
// "x": 0,
|
|
18
|
+
// "y": 0,
|
|
19
|
+
// "z": 0
|
|
20
|
+
// } );
|
|
21
21
|
},
|
|
22
22
|
_animClear: function($list) {
|
|
23
|
-
gsap.set( $list, {
|
|
24
|
-
|
|
25
|
-
} );
|
|
23
|
+
// gsap.set( $list, {
|
|
24
|
+
// "clearProps": "all"
|
|
25
|
+
// } );
|
|
26
26
|
},
|
|
27
27
|
_animKill: function($list) {
|
|
28
|
-
gsap.killTweensOf( $list );
|
|
28
|
+
// gsap.killTweensOf( $list );
|
|
29
29
|
},
|
|
30
30
|
_animMoveItem: function($list, x, onUpdate) {
|
|
31
|
-
return gsap.to( $list, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} );
|
|
31
|
+
// return gsap.to( $list, {
|
|
32
|
+
// "duration": 0.3,
|
|
33
|
+
// "x": x,
|
|
34
|
+
// "y": 0,
|
|
35
|
+
// "z": 0,
|
|
36
|
+
// "onUpdate": function() {
|
|
37
|
+
// onUpdate(gsap.getProperty( this.targets()[ 0 ], 'x' ));
|
|
38
|
+
// }
|
|
39
|
+
// } );
|
|
40
40
|
},
|
|
41
41
|
_setCoordinates: function($list, x) {
|
|
42
|
-
gsap.set( $list, {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} );
|
|
42
|
+
// gsap.set( $list, {
|
|
43
|
+
// "x": x,
|
|
44
|
+
// "y": 0,
|
|
45
|
+
// "z": 0
|
|
46
|
+
// } );
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
const MINIMUM_MOVEMENT_TO_START_DRAG = 3; // px
|
|
51
|
+
|
|
50
52
|
/**
|
|
51
53
|
* DragSlider
|
|
52
54
|
*/
|
|
@@ -63,6 +65,7 @@ export default class DragSlider {
|
|
|
63
65
|
#$slider: HTMLElement;
|
|
64
66
|
#viewportInfo;
|
|
65
67
|
#siteOffsetLeft = 0;
|
|
68
|
+
#siteOffsetRight = 0;
|
|
66
69
|
#listDelta = 0;
|
|
67
70
|
#$viewport: HTMLElement | undefined;
|
|
68
71
|
#$items: NodeList | undefined;
|
|
@@ -74,6 +77,8 @@ export default class DragSlider {
|
|
|
74
77
|
#hasAlreadyBeenDragged = false;
|
|
75
78
|
#startDragCoords: FLib.Events.Gesture.Coords | undefined;
|
|
76
79
|
#isInitialized = false;
|
|
80
|
+
#visibleItems: FLib.DragSlider.Item[] = [];
|
|
81
|
+
#hiddenItems: FLib.DragSlider.Item[] = [];
|
|
77
82
|
#debouncedOnResize;
|
|
78
83
|
|
|
79
84
|
|
|
@@ -93,6 +98,14 @@ export default class DragSlider {
|
|
|
93
98
|
return this.#$items;
|
|
94
99
|
}
|
|
95
100
|
|
|
101
|
+
get visibleItems(): FLib.DragSlider.Item[] {
|
|
102
|
+
return this.#visibleItems;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
get hiddenItems(): FLib.DragSlider.Item[] {
|
|
106
|
+
return this.#hiddenItems;
|
|
107
|
+
}
|
|
108
|
+
|
|
96
109
|
|
|
97
110
|
constructor( $slider: HTMLElement, userOptions: Partial<FLib.DragSlider.Options> ) {
|
|
98
111
|
|
|
@@ -131,8 +144,9 @@ export default class DragSlider {
|
|
|
131
144
|
|
|
132
145
|
this.#viewportInfo = offset( this.#$viewport as HTMLElement );
|
|
133
146
|
this.#siteOffsetLeft = parseInt( prop( (this.#$items[ 0 ] as HTMLElement), 'marginLeft' ), 10 );
|
|
147
|
+
this.#siteOffsetRight = parseInt( prop( (this.#$items[ this.#$items.length - 1 ] as HTMLElement), 'marginRight' ), 10 );
|
|
134
148
|
|
|
135
|
-
this.#listDelta = this.#viewportInfo.width - this.#$list.scrollWidth;
|
|
149
|
+
this.#listDelta = this.#viewportInfo.width - this.#$list.scrollWidth - this.#siteOffsetLeft - this.#siteOffsetRight;
|
|
136
150
|
|
|
137
151
|
const prevIsDraggingActive = this.#isDraggingActive;
|
|
138
152
|
this.#isDraggingActive = this.#listDelta < 0;
|
|
@@ -152,37 +166,42 @@ export default class DragSlider {
|
|
|
152
166
|
this.#itemArray.length = 0;
|
|
153
167
|
const ABS_LIST_DELTA = Math.abs( this.#listDelta );
|
|
154
168
|
|
|
169
|
+
let flag = false;
|
|
170
|
+
|
|
155
171
|
for (let index = 0; index < this.#$items.length; ++index) {
|
|
156
172
|
const $ITEM = this.#$items[ index ] as HTMLElement;
|
|
157
173
|
const ITEM_OFFSET = offset( $ITEM, false, this.#$list );
|
|
174
|
+
const DATA = {
|
|
175
|
+
index,
|
|
176
|
+
"isFirst": index === 0,
|
|
177
|
+
"isLast": false,
|
|
178
|
+
"$item": $ITEM,
|
|
179
|
+
"info": ITEM_OFFSET
|
|
180
|
+
};
|
|
158
181
|
|
|
159
182
|
if (ITEM_OFFSET.left - this.#siteOffsetLeft <= ABS_LIST_DELTA) {
|
|
160
|
-
this.#itemArray.push(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
"isLast": false,
|
|
164
|
-
"$item": $ITEM,
|
|
165
|
-
"info": ITEM_OFFSET
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
this.#itemMap.set( $ITEM, this.#itemArray[ index ] );
|
|
183
|
+
this.#itemArray.push(DATA);
|
|
184
|
+
|
|
185
|
+
this.#itemMap.set( $ITEM, DATA );
|
|
169
186
|
continue;
|
|
170
187
|
}
|
|
171
188
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
189
|
+
DATA.isLast = true;
|
|
190
|
+
|
|
191
|
+
if (!flag) {
|
|
192
|
+
this.#itemArray.push(DATA);
|
|
193
|
+
// this.#itemArray.push({
|
|
194
|
+
// ...DATA,
|
|
195
|
+
// "info": {
|
|
196
|
+
// ...ITEM_OFFSET,
|
|
197
|
+
// "left": ABS_LIST_DELTA + this.#siteOffsetLeft,
|
|
198
|
+
// "x": ABS_LIST_DELTA + this.#siteOffsetLeft
|
|
199
|
+
// }
|
|
200
|
+
// });
|
|
201
|
+
}
|
|
202
|
+
flag = true;
|
|
184
203
|
|
|
185
|
-
|
|
204
|
+
this.#itemMap.set( $ITEM, DATA );
|
|
186
205
|
}
|
|
187
206
|
|
|
188
207
|
this.#firstItem = this.#itemMap.get( (this.#$items[ 0 ] as HTMLElement) ) as FLib.DragSlider.Item;
|
|
@@ -193,17 +212,19 @@ export default class DragSlider {
|
|
|
193
212
|
else {
|
|
194
213
|
this.#currentSnapItem = this.#itemArray[ this.#currentSnapItem.index ];
|
|
195
214
|
}
|
|
215
|
+
|
|
216
|
+
this.#updateAccessibilityFeature();
|
|
196
217
|
}
|
|
197
218
|
|
|
198
219
|
|
|
199
|
-
#snapToItemAnimation = ( snapItem: FLib.DragSlider.Item ): Promise<any>
|
|
220
|
+
#snapToItemAnimation = ( snapItem: FLib.DragSlider.Item ): Promise<any> => {
|
|
200
221
|
if (!snapItem) {
|
|
201
|
-
return;
|
|
222
|
+
return Promise.resolve();
|
|
202
223
|
}
|
|
203
224
|
|
|
204
225
|
let finalX;
|
|
205
226
|
|
|
206
|
-
finalX = -1 * snapItem.info.left
|
|
227
|
+
finalX = -1 * snapItem.info.left;
|
|
207
228
|
|
|
208
229
|
finalX = Math.max( Math.min( 0, finalX ), this.#listDelta );
|
|
209
230
|
|
|
@@ -225,11 +246,15 @@ export default class DragSlider {
|
|
|
225
246
|
"xPos": this.#deltaMove.x,
|
|
226
247
|
"moveMaxSize": this.#listDelta,
|
|
227
248
|
"isAtStart": IS_SNAP_TO_START,
|
|
228
|
-
"isAtEnd": IS_SNAP_TO_END
|
|
249
|
+
"isAtEnd": IS_SNAP_TO_END,
|
|
250
|
+
"visibleItems": this.#visibleItems,
|
|
251
|
+
"hiddenItems": this.#hiddenItems
|
|
229
252
|
} );
|
|
230
253
|
|
|
231
254
|
this.#currentSnapItem = snapItem;
|
|
232
255
|
|
|
256
|
+
finalX += this.#siteOffsetLeft;
|
|
257
|
+
|
|
233
258
|
return this.#options._animMoveItem( this.#$list, finalX, (newX) => {
|
|
234
259
|
this.#deltaMove.x = newX;
|
|
235
260
|
|
|
@@ -238,9 +263,11 @@ export default class DragSlider {
|
|
|
238
263
|
"xPos": this.#deltaMove.x,
|
|
239
264
|
"moveMaxSize": this.#listDelta,
|
|
240
265
|
"isAtStart": IS_SNAP_TO_START,
|
|
241
|
-
"isAtEnd": IS_SNAP_TO_END
|
|
266
|
+
"isAtEnd": IS_SNAP_TO_END,
|
|
267
|
+
"visibleItems": this.#visibleItems,
|
|
268
|
+
"hiddenItems": this.#hiddenItems
|
|
242
269
|
} );
|
|
243
|
-
} );
|
|
270
|
+
} ).then(() => this.#updateAccessibilityFeature());
|
|
244
271
|
}
|
|
245
272
|
|
|
246
273
|
|
|
@@ -329,7 +356,17 @@ export default class DragSlider {
|
|
|
329
356
|
return;
|
|
330
357
|
}
|
|
331
358
|
|
|
332
|
-
this.#snapToItemAnimation( snapItem.snapItem )
|
|
359
|
+
this.#snapToItemAnimation( snapItem.snapItem ).then(() => {
|
|
360
|
+
this.#options.onSnapEnd?.({
|
|
361
|
+
"item": this.#currentSnapItem,
|
|
362
|
+
"xPos": this.#deltaMove.x,
|
|
363
|
+
"moveMaxSize": this.#listDelta,
|
|
364
|
+
"isAtStart": this.#deltaMove.x === 0,
|
|
365
|
+
"isAtEnd": this.#deltaMove.x === this.#listDelta,
|
|
366
|
+
"visibleItems": this.#visibleItems,
|
|
367
|
+
"hiddenItems": this.#hiddenItems
|
|
368
|
+
})
|
|
369
|
+
});
|
|
333
370
|
}
|
|
334
371
|
|
|
335
372
|
|
|
@@ -348,7 +385,7 @@ export default class DragSlider {
|
|
|
348
385
|
this.#options._animKill( this.#$list );
|
|
349
386
|
|
|
350
387
|
this.#startDragCoords = coords;
|
|
351
|
-
this.#listDelta = this.#viewportInfo.width - this.#$list.scrollWidth;
|
|
388
|
+
this.#listDelta = this.#viewportInfo.width - this.#$list.scrollWidth - this.#siteOffsetLeft - this.#siteOffsetRight;
|
|
352
389
|
this.#deltaMove.newX = this.#deltaMove.x;
|
|
353
390
|
|
|
354
391
|
gesture( document.body, 'dragSlider', {
|
|
@@ -369,7 +406,9 @@ export default class DragSlider {
|
|
|
369
406
|
"xPos": this.#deltaMove.x,
|
|
370
407
|
"moveMaxSize": this.#listDelta,
|
|
371
408
|
"isAtStart": this.#deltaMove.x === 0,
|
|
372
|
-
"isAtEnd": this.#deltaMove.x === this.#listDelta
|
|
409
|
+
"isAtEnd": this.#deltaMove.x === this.#listDelta,
|
|
410
|
+
"visibleItems": this.#visibleItems,
|
|
411
|
+
"hiddenItems": this.#hiddenItems
|
|
373
412
|
} );
|
|
374
413
|
}
|
|
375
414
|
|
|
@@ -380,13 +419,17 @@ export default class DragSlider {
|
|
|
380
419
|
this.#deltaMove.deltaX = coords.pageX - ( this.#startDragCoords as FLib.Events.Gesture.Coords ).pageX;
|
|
381
420
|
this.#deltaMove.deltaY = coords.pageY - ( this.#startDragCoords as FLib.Events.Gesture.Coords ).pageY;
|
|
382
421
|
|
|
422
|
+
if (Math.abs(this.#deltaMove.deltaX) < MINIMUM_MOVEMENT_TO_START_DRAG) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
|
|
383
426
|
this.#deltaMove.newX = this.#deltaMove.deltaX + this.#deltaMove.x;
|
|
384
427
|
|
|
385
428
|
if ( this.#deltaMove.newX > 0 ) {
|
|
386
429
|
this.#deltaMove.newX = 0;
|
|
387
430
|
}
|
|
388
|
-
else if ( this.#deltaMove.newX < this.#listDelta ) {
|
|
389
|
-
this.#deltaMove.newX = this.#listDelta;
|
|
431
|
+
else if ( this.#deltaMove.newX < this.#listDelta + this.#siteOffsetRight ) {
|
|
432
|
+
this.#deltaMove.newX = this.#listDelta + this.#siteOffsetRight;
|
|
390
433
|
}
|
|
391
434
|
|
|
392
435
|
this.#options._setCoordinates(this.#$list, this.#deltaMove.newX);
|
|
@@ -396,20 +439,25 @@ export default class DragSlider {
|
|
|
396
439
|
"xPos": this.#deltaMove.newX,
|
|
397
440
|
"moveMaxSize": this.#listDelta,
|
|
398
441
|
"isAtStart": this.#deltaMove.newX === 0,
|
|
399
|
-
"isAtEnd": this.#deltaMove.newX === this.#listDelta
|
|
442
|
+
"isAtEnd": this.#deltaMove.newX === this.#listDelta,
|
|
443
|
+
"visibleItems": this.#visibleItems,
|
|
444
|
+
"hiddenItems": this.#hiddenItems
|
|
400
445
|
} );
|
|
401
446
|
}
|
|
402
447
|
|
|
403
448
|
|
|
404
449
|
#onStopDrag = (): void => {
|
|
405
450
|
gestureOff( document.body, 'dragSlider' );
|
|
406
|
-
|
|
407
451
|
this.#isDragging = false;
|
|
408
452
|
|
|
409
|
-
this.#deltaMove.x = this.#deltaMove.newX;
|
|
410
|
-
|
|
411
453
|
this.#activeLinkClick();
|
|
412
454
|
|
|
455
|
+
if (this.#deltaMove.x === this.#deltaMove.newX) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
this.#deltaMove.x = this.#deltaMove.newX;
|
|
460
|
+
|
|
413
461
|
this.#snapToItem();
|
|
414
462
|
|
|
415
463
|
this.#options.onStopDrag?.({
|
|
@@ -417,7 +465,9 @@ export default class DragSlider {
|
|
|
417
465
|
"xPos": this.#deltaMove.x,
|
|
418
466
|
"moveMaxSize": this.#listDelta,
|
|
419
467
|
"isAtStart": this.#deltaMove.x === 0,
|
|
420
|
-
"isAtEnd": this.#deltaMove.x === this.#listDelta
|
|
468
|
+
"isAtEnd": this.#deltaMove.x === this.#listDelta,
|
|
469
|
+
"visibleItems": this.#visibleItems,
|
|
470
|
+
"hiddenItems": this.#hiddenItems
|
|
421
471
|
} );
|
|
422
472
|
}
|
|
423
473
|
|
|
@@ -432,7 +482,9 @@ export default class DragSlider {
|
|
|
432
482
|
"xPos": this.#deltaMove.x,
|
|
433
483
|
"moveMaxSize": this.#listDelta,
|
|
434
484
|
"isAtStart": this.#deltaMove.x === 0,
|
|
435
|
-
"isAtEnd": this.#deltaMove.x === this.#listDelta
|
|
485
|
+
"isAtEnd": this.#deltaMove.x === this.#listDelta,
|
|
486
|
+
"visibleItems": this.#visibleItems,
|
|
487
|
+
"hiddenItems": this.#hiddenItems
|
|
436
488
|
} );
|
|
437
489
|
}
|
|
438
490
|
|
|
@@ -447,7 +499,9 @@ export default class DragSlider {
|
|
|
447
499
|
"xPos": this.#deltaMove.x,
|
|
448
500
|
"moveMaxSize": this.#listDelta,
|
|
449
501
|
"isAtStart": this.#deltaMove.x === 0,
|
|
450
|
-
"isAtEnd": this.#deltaMove.x === this.#listDelta
|
|
502
|
+
"isAtEnd": this.#deltaMove.x === this.#listDelta,
|
|
503
|
+
"visibleItems": this.#visibleItems,
|
|
504
|
+
"hiddenItems": this.#hiddenItems
|
|
451
505
|
} );
|
|
452
506
|
}
|
|
453
507
|
|
|
@@ -457,32 +511,32 @@ export default class DragSlider {
|
|
|
457
511
|
}
|
|
458
512
|
|
|
459
513
|
|
|
460
|
-
next(): Promise<any>
|
|
514
|
+
next(): Promise<any> {
|
|
461
515
|
const CURRENT_ITEM = this.#currentSnapItem as FLib.DragSlider.Item;
|
|
462
516
|
|
|
463
517
|
if ( !this.#isDraggingActive || !this.#itemArray[ CURRENT_ITEM.index + 1 ] ) {
|
|
464
|
-
return;
|
|
518
|
+
return Promise.resolve();
|
|
465
519
|
}
|
|
466
520
|
|
|
467
521
|
return this.#snapToItemAnimation( this.#itemArray[ CURRENT_ITEM.index + 1 ] );
|
|
468
522
|
}
|
|
469
523
|
|
|
470
524
|
|
|
471
|
-
previous(): Promise<any>
|
|
525
|
+
previous(): Promise<any> {
|
|
472
526
|
const CURRENT_ITEM = this.#currentSnapItem as FLib.DragSlider.Item;
|
|
473
527
|
|
|
474
528
|
if ( !this.#isDraggingActive || CURRENT_ITEM.isFirst ) {
|
|
475
|
-
return;
|
|
529
|
+
return Promise.resolve();
|
|
476
530
|
}
|
|
477
531
|
|
|
478
532
|
return this.#snapToItemAnimation( this.#itemArray[ CURRENT_ITEM.index - 1 ] );
|
|
479
533
|
}
|
|
480
534
|
|
|
481
535
|
|
|
482
|
-
goToItem( blockOrIndex: HTMLElement | number ): Promise<any>
|
|
536
|
+
goToItem( blockOrIndex: HTMLElement | number ): Promise<any> {
|
|
483
537
|
|
|
484
538
|
if ( !this.#isDraggingActive ) {
|
|
485
|
-
return;
|
|
539
|
+
return Promise.resolve();
|
|
486
540
|
}
|
|
487
541
|
|
|
488
542
|
let $block;
|
|
@@ -495,13 +549,13 @@ export default class DragSlider {
|
|
|
495
549
|
}
|
|
496
550
|
|
|
497
551
|
if ( !$block ) {
|
|
498
|
-
return;
|
|
552
|
+
return Promise.resolve();
|
|
499
553
|
}
|
|
500
554
|
|
|
501
555
|
const ITEM = this.#itemMap.get( $block );
|
|
502
556
|
|
|
503
557
|
if ( !ITEM ) {
|
|
504
|
-
return;
|
|
558
|
+
return Promise.resolve();
|
|
505
559
|
}
|
|
506
560
|
|
|
507
561
|
this.#currentSnapItem = ITEM;
|
|
@@ -511,7 +565,9 @@ export default class DragSlider {
|
|
|
511
565
|
"xPos": this.#deltaMove.x,
|
|
512
566
|
"moveMaxSize": this.#listDelta,
|
|
513
567
|
"isAtStart": this.#deltaMove.x === 0,
|
|
514
|
-
"isAtEnd": this.#deltaMove.x === this.#listDelta
|
|
568
|
+
"isAtEnd": this.#deltaMove.x === this.#listDelta,
|
|
569
|
+
"visibleItems": this.#visibleItems,
|
|
570
|
+
"hiddenItems": this.#hiddenItems
|
|
515
571
|
} );
|
|
516
572
|
|
|
517
573
|
return this.#options._animMoveItem(this.#$list, -1 * ITEM.info.left + this.#siteOffsetLeft, (x) => {
|
|
@@ -522,8 +578,33 @@ export default class DragSlider {
|
|
|
522
578
|
"xPos": this.#deltaMove.x,
|
|
523
579
|
"moveMaxSize": this.#listDelta,
|
|
524
580
|
"isAtStart": this.#deltaMove.x === 0,
|
|
525
|
-
"isAtEnd": this.#deltaMove.x === this.#listDelta
|
|
581
|
+
"isAtEnd": this.#deltaMove.x === this.#listDelta,
|
|
582
|
+
"visibleItems": this.#visibleItems,
|
|
583
|
+
"hiddenItems": this.#hiddenItems
|
|
526
584
|
} );
|
|
585
|
+
}).then(() => this.#updateAccessibilityFeature());
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
#updateAccessibilityFeature = (): void => {
|
|
589
|
+
this.#visibleItems.length = 0;
|
|
590
|
+
this.#hiddenItems.length = 0;
|
|
591
|
+
|
|
592
|
+
this.#itemMap.forEach(item => {
|
|
593
|
+
const hideElement1 = item.info.left + this.#deltaMove.x < 0;
|
|
594
|
+
const hideElement2 = item.info.left + item.info.width + this.#deltaMove.x > this.#viewportInfo.width;
|
|
595
|
+
|
|
596
|
+
if (hideElement1 || hideElement2) {
|
|
597
|
+
item.$item.setAttribute("tabindex", "-1");
|
|
598
|
+
item.$item.setAttribute("inert", "");
|
|
599
|
+
item.$item.setAttribute("aria-hidden", "true");
|
|
600
|
+
this.#hiddenItems.push(item);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
item.$item.removeAttribute("tabindex");
|
|
605
|
+
item.$item.removeAttribute("inert");
|
|
606
|
+
item.$item.setAttribute("aria-hidden", "false");
|
|
607
|
+
this.#visibleItems.push(item);
|
|
527
608
|
});
|
|
528
609
|
}
|
|
529
610
|
|
|
@@ -600,7 +681,9 @@ export default class DragSlider {
|
|
|
600
681
|
"xPos": this.#deltaMove.x,
|
|
601
682
|
"moveMaxSize": this.#listDelta,
|
|
602
683
|
"isAtStart": this.#deltaMove.x === 0,
|
|
603
|
-
"isAtEnd": this.#deltaMove.x === this.#listDelta
|
|
684
|
+
"isAtEnd": this.#deltaMove.x === this.#listDelta,
|
|
685
|
+
"visibleItems": this.#visibleItems,
|
|
686
|
+
"hiddenItems": this.#hiddenItems
|
|
604
687
|
} );
|
|
605
688
|
|
|
606
689
|
return this;
|
package/Modules/Popin/Popin.ts
CHANGED
|
@@ -37,7 +37,7 @@ export default class Popin {
|
|
|
37
37
|
#keyboardControls;
|
|
38
38
|
#options: FLib.Popin.Options;
|
|
39
39
|
#controllerOptions: FLib.Popin.ControllerOptions | undefined;
|
|
40
|
-
#backgroundLayer: PopinBackground;
|
|
40
|
+
#backgroundLayer: PopinBackground | undefined;
|
|
41
41
|
#tick;
|
|
42
42
|
#$popin: HTMLElement;
|
|
43
43
|
|
|
@@ -57,7 +57,7 @@ export default class Popin {
|
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
this.#options = extend( defaultOptions, userOptions );
|
|
60
|
-
this.#backgroundLayer = new PopinBackground( this, this.#options );
|
|
60
|
+
this.#backgroundLayer = this.#options.isBackgroundAside ? new PopinBackground( this, this.#options ) : undefined;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
|
|
@@ -195,9 +195,6 @@ export default class Popin {
|
|
|
195
195
|
|
|
196
196
|
return this.#showBackgroundLayer()
|
|
197
197
|
.then( () => {
|
|
198
|
-
if ( this.#isInlinePopin ) {
|
|
199
|
-
this.#addAccessibility();
|
|
200
|
-
}
|
|
201
198
|
return this.#animations.initOpenPopin( this.#$popin );
|
|
202
199
|
} )
|
|
203
200
|
.then( () => {
|
|
@@ -206,6 +203,9 @@ export default class Popin {
|
|
|
206
203
|
}
|
|
207
204
|
} )
|
|
208
205
|
.then( () => {
|
|
206
|
+
if ( this.#isInlinePopin ) {
|
|
207
|
+
this.#addAccessibility();
|
|
208
|
+
}
|
|
209
209
|
return this.#animations.openPopin( this.#$popin );
|
|
210
210
|
} )
|
|
211
211
|
.then( () => {
|
package/Modules/Popin/Tools.ts
CHANGED
package/Modules/Slider/Slider.ts
CHANGED
|
@@ -28,16 +28,16 @@ const defaultOptions = {
|
|
|
28
28
|
"activeClass": "active-slide",
|
|
29
29
|
"loop": true,
|
|
30
30
|
"_setStyle": ( $elem, styles ) => {
|
|
31
|
-
gsap.set( $elem, styles );
|
|
31
|
+
// gsap.set( $elem, styles );
|
|
32
32
|
},
|
|
33
33
|
"_tweenTo": ( $elem, styles ) => {
|
|
34
|
-
gsap.to( $elem, styles );
|
|
34
|
+
// gsap.to( $elem, styles );
|
|
35
35
|
},
|
|
36
36
|
"_tweenFromTo": ( $elem, init, styles ) => {
|
|
37
|
-
gsap.fromTo( $elem, init, styles );
|
|
37
|
+
// gsap.fromTo( $elem, init, styles );
|
|
38
38
|
},
|
|
39
39
|
"_killTweens": ( $elem ) => {
|
|
40
|
-
gsap.killTweensOf( $elem );
|
|
40
|
+
// gsap.killTweensOf( $elem );
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -63,7 +63,7 @@ export default class Slider {
|
|
|
63
63
|
#STATE_IDLE = 'idle';
|
|
64
64
|
#STATE_MOVING = 'moving';
|
|
65
65
|
#state = this.#STATE_IDLE;
|
|
66
|
-
#EASE_NONE =
|
|
66
|
+
#EASE_NONE = "none";
|
|
67
67
|
#options: FLib.Slider.Options;
|
|
68
68
|
|
|
69
69
|
|
package/Modules/YouTubePlayer.ts
CHANGED
|
@@ -10,7 +10,6 @@ const defaultOptions: Partial<FLib.YouTubePlayer.Options> = {
|
|
|
10
10
|
"autoplay": 0,
|
|
11
11
|
"controls": 2,
|
|
12
12
|
"autohide": 1,
|
|
13
|
-
"modestbranding": 1,
|
|
14
13
|
"showinfo": 0
|
|
15
14
|
}
|
|
16
15
|
};
|
|
@@ -35,11 +34,13 @@ const defaultOptions: Partial<FLib.YouTubePlayer.Options> = {
|
|
|
35
34
|
* }
|
|
36
35
|
* },
|
|
37
36
|
* "playerVars": {
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
37
|
+
* "enablejsapi": 1,
|
|
38
|
+
* "autoplay": 1,
|
|
39
|
+
* "controls": 2,
|
|
40
|
+
* "autohide": 1,
|
|
41
|
+
* "showinfo": 0,
|
|
42
|
+
* "origin": "my-domain.com",
|
|
43
|
+
* "playsinline": 1,
|
|
43
44
|
* // ... All available youtube player options
|
|
44
45
|
* }
|
|
45
46
|
* }
|
package/README.md
CHANGED
package/Types/DragSlider.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
declare namespace FLib {
|
|
2
2
|
namespace DragSlider {
|
|
3
3
|
type CallbackParam = {
|
|
4
|
-
item:
|
|
5
|
-
xPos:
|
|
6
|
-
moveMaxSize:
|
|
7
|
-
isAtStart:
|
|
8
|
-
isAtEnd:
|
|
4
|
+
item: any;
|
|
5
|
+
xPos: number;
|
|
6
|
+
moveMaxSize: number;
|
|
7
|
+
isAtStart: boolean;
|
|
8
|
+
isAtEnd: boolean;
|
|
9
|
+
visibleItems: Item[];
|
|
10
|
+
hiddenItems: Item[];
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
type Item = {
|
|
@@ -36,6 +38,7 @@ declare namespace FLib {
|
|
|
36
38
|
onDrag?: Callback;
|
|
37
39
|
onStopDrag?: Callback;
|
|
38
40
|
onSnap?: Callback;
|
|
41
|
+
onSnapEnd?: Callback;
|
|
39
42
|
onSnapUpdate?: Callback;
|
|
40
43
|
onMouseEnter?: Callback;
|
|
41
44
|
onMouseLeave?: Callback;
|
|
@@ -54,7 +57,7 @@ declare namespace FLib {
|
|
|
54
57
|
_animReset: ($list) => void;
|
|
55
58
|
_animClear: ($list) => void;
|
|
56
59
|
_animKill: ($list) => void;
|
|
57
|
-
_animMoveItem: ($list, x, onUpdate) => Promise<any
|
|
60
|
+
_animMoveItem: ($list, x, onUpdate) => Promise<any>;
|
|
58
61
|
_setCoordinates: ($list, x) => void;
|
|
59
62
|
}
|
|
60
63
|
}
|
package/Types/Global.d.ts
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
type RequestIdleCallbackHandle = any;
|
|
2
|
-
type RequestIdleCallbackOptions = {
|
|
3
|
-
timeout: number;
|
|
4
|
-
};
|
|
5
|
-
type RequestIdleCallbackDeadline = {
|
|
6
|
-
readonly didTimeout: boolean;
|
|
7
|
-
timeRemaining: ( () => number );
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
interface Window {
|
|
11
|
-
MSPointerEvent: any;
|
|
12
|
-
$$DEBUG$$: any;
|
|
13
|
-
requestIdleCallback: (
|
|
14
|
-
(
|
|
15
|
-
callback: (( deadline: RequestIdleCallbackDeadline ) => void ),
|
|
16
|
-
opts?: RequestIdleCallbackOptions,
|
|
17
|
-
) => RequestIdleCallbackHandle
|
|
18
|
-
);
|
|
19
|
-
cancelIdleCallback: (( handle: RequestIdleCallbackHandle ) => void );
|
|
20
|
-
}
|
package/Types/Popin.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ declare namespace FLib {
|
|
|
75
75
|
errorMessage: string;
|
|
76
76
|
/** @defaultValue true */
|
|
77
77
|
enableKeyboard: boolean;
|
|
78
|
+
/** @defaultValue true */
|
|
79
|
+
isBackgroundAside: boolean;
|
|
78
80
|
onOpen?: ( $popin: HTMLElement ) => void;
|
|
79
81
|
onClose?: ( $popin: HTMLElement ) => void;
|
|
80
82
|
onLoad: ( $popin: HTMLElement ) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@creative-web-solution/front-library",
|
|
3
3
|
"title": "Frontend library",
|
|
4
4
|
"description": "Frontend functions and modules",
|
|
5
|
-
"version": "7.1.
|
|
5
|
+
"version": "7.1.27",
|
|
6
6
|
"homepage": "https://github.com/creative-web-solution/front-library",
|
|
7
7
|
"author": "Creative Web Solution <contact@cws-studio.com> (https://www.cws-studio.com)",
|
|
8
8
|
"keywords": [],
|