@creative-web-solution/front-library 7.1.57 → 7.1.59

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 7.1.59
4
+
5
+ - [DragSlider]: Refresh elements on first interaction
6
+
7
+ ## 7.1.58
8
+
9
+ - [Popin]: Fix trap focus bug
10
+
3
11
  ## 7.1.57
4
12
 
5
13
  - [KeyboardHandler]: Handle onHome and onEnd callbak. Set onNext as RIGHT or DOWN and onPrevious as LEFT or UP.
@@ -75,7 +75,6 @@ export default class DragSlider {
75
75
  #itemMap = new Map<HTMLElement, FLib.DragSlider.Item>();
76
76
  #firstItem: FLib.DragSlider.Item | undefined;
77
77
  #currentSnapItem: FLib.DragSlider.Item | undefined;
78
- #hasAlreadyBeenDragged = false;
79
78
  #startDragCoords: FLib.Events.Gesture.Coords | undefined;
80
79
  #isInitialized = false;
81
80
  #visibleItems: FLib.DragSlider.Item[] = [];
@@ -83,6 +82,7 @@ export default class DragSlider {
83
82
  #debouncedOnResize;
84
83
  #minXPos: number = 0;
85
84
  #maxXPos: number = 0;
85
+ #interactedWithSliderOneTime: boolean = false;
86
86
 
87
87
  get count(): number {
88
88
  return this.#$items?.length ?? 0;
@@ -405,10 +405,7 @@ export default class DragSlider {
405
405
  $target: HTMLElement,
406
406
  coords: FLib.Events.Gesture.Coords
407
407
  ): void => {
408
- if (!this.#hasAlreadyBeenDragged) {
409
- this.#onResize();
410
- this.#hasAlreadyBeenDragged = true;
411
- }
408
+ this.#checkForFirstInteraction();
412
409
 
413
410
  if (!this.#isDraggingActive || !this.#$list) {
414
411
  return;
@@ -515,6 +512,8 @@ export default class DragSlider {
515
512
  };
516
513
 
517
514
  next(): Promise<any> {
515
+ this.#checkForFirstInteraction();
516
+
518
517
  const CURRENT_ITEM = this.#currentSnapItem as FLib.DragSlider.Item;
519
518
 
520
519
  if (
@@ -530,6 +529,8 @@ export default class DragSlider {
530
529
  }
531
530
 
532
531
  previous(): Promise<any> {
532
+ this.#checkForFirstInteraction();
533
+
533
534
  const CURRENT_ITEM = this.#currentSnapItem as FLib.DragSlider.Item;
534
535
 
535
536
  if (!this.#isDraggingActive || CURRENT_ITEM.isFirst) {
@@ -546,6 +547,8 @@ export default class DragSlider {
546
547
  return Promise.resolve();
547
548
  }
548
549
 
550
+ this.#checkForFirstInteraction();
551
+
549
552
  let $block;
550
553
 
551
554
  if (typeof blockOrIndex === "number") {
@@ -587,6 +590,14 @@ export default class DragSlider {
587
590
  .then(() => this.#updateAccessibilityFeature());
588
591
  }
589
592
 
593
+
594
+ #checkForFirstInteraction(): void {
595
+ if (!this.#interactedWithSliderOneTime) {
596
+ this.#interactedWithSliderOneTime = true;
597
+ this.#onResize();
598
+ }
599
+ }
600
+
590
601
  #updateAccessibilityFeature = (): void => {
591
602
  this.#visibleItems.length = 0;
592
603
  this.#hiddenItems.length = 0;
@@ -697,7 +708,7 @@ export default class DragSlider {
697
708
 
698
709
  destroy(): this {
699
710
  this.#isInitialized = false;
700
- this.#hasAlreadyBeenDragged = false;
711
+ this.#interactedWithSliderOneTime = false;
701
712
 
702
713
  if (!this.#$items?.length) {
703
714
  return this;
@@ -47,8 +47,8 @@ export default class PopinAccessibility {
47
47
 
48
48
  refresh(): void {
49
49
  this.#addSentinels();
50
- this.#handleFocusBackInDocument();
51
50
  this.#getFocusableElements();
51
+ this.#handleFocusBackInDocument();
52
52
  }
53
53
 
54
54
  #getFocusableElements(): void {
@@ -56,7 +56,7 @@ export default class PopinAccessibility {
56
56
  this.#$popin.querySelectorAll<HTMLElement>(
57
57
  FOCUSABLE_ELEMENTS_SELECTOR,
58
58
  ),
59
- ).filter(($element) => $element.offsetParent !== null);
59
+ ).filter(($element) => $element.offsetParent !== null && $element !== this.#$startSentinel && $element !== this.#$endSentinel);
60
60
  this.#$firstElement = this.#$elements[0] ?? this.#$popin;
61
61
  this.#$lastElement = this.#$elements[this.#$elements.length - 1];
62
62
  }
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Front Library
2
2
 
3
- @version: 7.1.57
3
+ @version: 7.1.59
4
4
 
5
5
 
6
6
  ## Use
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.57",
5
+ "version": "7.1.59",
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": [],