@y14e/tabs 1.5.7 → 1.5.8

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/README.md CHANGED
@@ -10,14 +10,14 @@ npm i @y14e/tabs
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import Tabs from '@y14e/tabs@1.5.7';
13
+ import Tabs from '@y14e/tabs@1.5.8';
14
14
 
15
15
  // CDNs
16
- import Tabs from 'https://esm.sh/@y14e/tabs@1.5.7';
16
+ import Tabs from 'https://esm.sh/@y14e/tabs@1.5.8';
17
17
  // or
18
- import Tabs from 'https://cdn.jsdelivr.net/npm/@y14e/tabs@1.5.7/+esm';
18
+ import Tabs from 'https://cdn.jsdelivr.net/npm/@y14e/tabs@1.5.8/+esm';
19
19
  // or
20
- import Tabs from 'https://esm.unpkg.com/@y14e/tabs@1.5.7';
20
+ import Tabs from 'https://esm.unpkg.com/@y14e/tabs@1.5.8';
21
21
  ```
22
22
 
23
23
  ## Usage
package/dist/index.cjs CHANGED
@@ -436,7 +436,13 @@ function createRovingTabIndex(container, options = {}) {
436
436
  console.warn("Invalid wrap option. Fallback: false.");
437
437
  wrap = false;
438
438
  }
439
- const settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
439
+ const settings = {
440
+ navigationOnly,
441
+ noMemory,
442
+ noStart,
443
+ typeahead,
444
+ wrap
445
+ };
440
446
  direction && Object.assign(settings, { direction });
441
447
  selector && Object.assign(settings, { selector });
442
448
  const roving = new RovingTabIndex(container, settings);
@@ -524,7 +530,6 @@ var RovingTabIndex = class {
524
530
  return;
525
531
  }
526
532
  event.preventDefault();
527
- event.stopPropagation();
528
533
  const currentIndex = current.indexOf(active);
529
534
  let rawIndex;
530
535
  let newIndex = currentIndex;
@@ -677,7 +682,6 @@ var Tabs = class _Tabs {
677
682
  #animationController = null;
678
683
  #cleanupsRovingTabIndex = [];
679
684
  #animation = null;
680
- #animationId = 0;
681
685
  #buttons = [];
682
686
  #indicators = [];
683
687
  #isDestroyed = false;
@@ -807,10 +811,9 @@ var Tabs = class _Tabs {
807
811
  p.setAttribute("hidden", isFocusable2(tab2) ? "until-found" : "");
808
812
  }
809
813
  });
810
- const animationId = ++this.#animationId;
811
814
  this.#animation?.cancel();
812
815
  const { duration, easing } = this.#settings.animation.content;
813
- this.#animation = this.#contentElement.animate(
816
+ const animation = this.#contentElement.animate(
814
817
  {
815
818
  blockSize: [
816
819
  `${size}px`,
@@ -822,8 +825,9 @@ var Tabs = class _Tabs {
822
825
  easing
823
826
  }
824
827
  );
828
+ this.#animation = animation;
825
829
  const cleanup = () => {
826
- if (animationId === this.#animationId) {
830
+ if (animation === this.#animation) {
827
831
  this.#animation = null;
828
832
  }
829
833
  };
@@ -836,10 +840,11 @@ var Tabs = class _Tabs {
836
840
  this.#animation.addEventListener(
837
841
  "finish",
838
842
  () => {
839
- if (animationId === this.#animationId) {
840
- this.#onAnimationFinish();
841
- cleanup();
843
+ if (this.#animation !== animation) {
844
+ return;
842
845
  }
846
+ this.#onAnimationFinish();
847
+ cleanup();
843
848
  },
844
849
  {
845
850
  once: true,
@@ -854,7 +859,7 @@ var Tabs = class _Tabs {
854
859
  const opacity = getComputedStyle(p).getPropertyValue("opacity");
855
860
  binding.animation?.cancel();
856
861
  const isSelected = p === panel;
857
- const animation = p.animate(
862
+ const animation2 = p.animate(
858
863
  {
859
864
  opacity: fade ? isSelected ? [opacity, opacity, "1"] : [opacity, "0", "0"] : isSelected ? [opacity, "1"] : [opacity, "0"]
860
865
  },
@@ -863,16 +868,16 @@ var Tabs = class _Tabs {
863
868
  easing: "ease"
864
869
  }
865
870
  );
866
- binding.animation = animation;
871
+ binding.animation = animation2;
867
872
  const cleanup2 = () => {
868
- if (binding.animation === animation) {
873
+ if (binding.animation === animation2) {
869
874
  binding.animation = null;
870
875
  }
871
876
  };
872
877
  this.#animationController = new AbortController();
873
878
  const { signal: signal2 } = this.#animationController;
874
- animation.addEventListener("cancel", cleanup2, { once: true, signal: signal2 });
875
- animation.addEventListener("finish", cleanup2, { once: true, signal: signal2 });
879
+ animation2.addEventListener("cancel", cleanup2, { once: true, signal: signal2 });
880
+ animation2.addEventListener("finish", cleanup2, { once: true, signal: signal2 });
876
881
  });
877
882
  }
878
883
  async destroy(force = false) {
@@ -1164,7 +1169,7 @@ function isFocusable2(element) {
1164
1169
  * Tabs
1165
1170
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
1166
1171
  *
1167
- * @version 1.5.7
1172
+ * @version 1.5.8
1168
1173
  * @author Yusuke Kamiyamane
1169
1174
  * @license MIT
1170
1175
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1200,7 +1205,7 @@ function isFocusable2(element) {
1200
1205
  * Lightweight roving tabindex utility with fully focus management.
1201
1206
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
1202
1207
  *
1203
- * @version 2.2.0
1208
+ * @version 3.0.0
1204
1209
  * @author Yusuke Kamiyamane
1205
1210
  * @license MIT
1206
1211
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Tabs
3
3
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
4
4
  *
5
- * @version 1.5.7
5
+ * @version 1.5.8
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Tabs
3
3
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
4
4
  *
5
- * @version 1.5.7
5
+ * @version 1.5.8
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -434,7 +434,13 @@ function createRovingTabIndex(container, options = {}) {
434
434
  console.warn("Invalid wrap option. Fallback: false.");
435
435
  wrap = false;
436
436
  }
437
- const settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
437
+ const settings = {
438
+ navigationOnly,
439
+ noMemory,
440
+ noStart,
441
+ typeahead,
442
+ wrap
443
+ };
438
444
  direction && Object.assign(settings, { direction });
439
445
  selector && Object.assign(settings, { selector });
440
446
  const roving = new RovingTabIndex(container, settings);
@@ -522,7 +528,6 @@ var RovingTabIndex = class {
522
528
  return;
523
529
  }
524
530
  event.preventDefault();
525
- event.stopPropagation();
526
531
  const currentIndex = current.indexOf(active);
527
532
  let rawIndex;
528
533
  let newIndex = currentIndex;
@@ -675,7 +680,6 @@ var Tabs = class _Tabs {
675
680
  #animationController = null;
676
681
  #cleanupsRovingTabIndex = [];
677
682
  #animation = null;
678
- #animationId = 0;
679
683
  #buttons = [];
680
684
  #indicators = [];
681
685
  #isDestroyed = false;
@@ -805,10 +809,9 @@ var Tabs = class _Tabs {
805
809
  p.setAttribute("hidden", isFocusable2(tab2) ? "until-found" : "");
806
810
  }
807
811
  });
808
- const animationId = ++this.#animationId;
809
812
  this.#animation?.cancel();
810
813
  const { duration, easing } = this.#settings.animation.content;
811
- this.#animation = this.#contentElement.animate(
814
+ const animation = this.#contentElement.animate(
812
815
  {
813
816
  blockSize: [
814
817
  `${size}px`,
@@ -820,8 +823,9 @@ var Tabs = class _Tabs {
820
823
  easing
821
824
  }
822
825
  );
826
+ this.#animation = animation;
823
827
  const cleanup = () => {
824
- if (animationId === this.#animationId) {
828
+ if (animation === this.#animation) {
825
829
  this.#animation = null;
826
830
  }
827
831
  };
@@ -834,10 +838,11 @@ var Tabs = class _Tabs {
834
838
  this.#animation.addEventListener(
835
839
  "finish",
836
840
  () => {
837
- if (animationId === this.#animationId) {
838
- this.#onAnimationFinish();
839
- cleanup();
841
+ if (this.#animation !== animation) {
842
+ return;
840
843
  }
844
+ this.#onAnimationFinish();
845
+ cleanup();
841
846
  },
842
847
  {
843
848
  once: true,
@@ -852,7 +857,7 @@ var Tabs = class _Tabs {
852
857
  const opacity = getComputedStyle(p).getPropertyValue("opacity");
853
858
  binding.animation?.cancel();
854
859
  const isSelected = p === panel;
855
- const animation = p.animate(
860
+ const animation2 = p.animate(
856
861
  {
857
862
  opacity: fade ? isSelected ? [opacity, opacity, "1"] : [opacity, "0", "0"] : isSelected ? [opacity, "1"] : [opacity, "0"]
858
863
  },
@@ -861,16 +866,16 @@ var Tabs = class _Tabs {
861
866
  easing: "ease"
862
867
  }
863
868
  );
864
- binding.animation = animation;
869
+ binding.animation = animation2;
865
870
  const cleanup2 = () => {
866
- if (binding.animation === animation) {
871
+ if (binding.animation === animation2) {
867
872
  binding.animation = null;
868
873
  }
869
874
  };
870
875
  this.#animationController = new AbortController();
871
876
  const { signal: signal2 } = this.#animationController;
872
- animation.addEventListener("cancel", cleanup2, { once: true, signal: signal2 });
873
- animation.addEventListener("finish", cleanup2, { once: true, signal: signal2 });
877
+ animation2.addEventListener("cancel", cleanup2, { once: true, signal: signal2 });
878
+ animation2.addEventListener("finish", cleanup2, { once: true, signal: signal2 });
874
879
  });
875
880
  }
876
881
  async destroy(force = false) {
@@ -1162,7 +1167,7 @@ function isFocusable2(element) {
1162
1167
  * Tabs
1163
1168
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
1164
1169
  *
1165
- * @version 1.5.7
1170
+ * @version 1.5.8
1166
1171
  * @author Yusuke Kamiyamane
1167
1172
  * @license MIT
1168
1173
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1198,7 +1203,7 @@ function isFocusable2(element) {
1198
1203
  * Lightweight roving tabindex utility with fully focus management.
1199
1204
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
1200
1205
  *
1201
- * @version 2.2.0
1206
+ * @version 3.0.0
1202
1207
  * @author Yusuke Kamiyamane
1203
1208
  * @license MIT
1204
1209
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/tabs",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "WAI-ARIA compliant tabs pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@y14e/attributes-utils": "^1.1.1",
46
46
  "@y14e/button": "^1.0.0",
47
- "@y14e/roving-tabindex": "^2.2.0",
47
+ "@y14e/roving-tabindex": "^3.0.0",
48
48
  "bun-types": "latest",
49
49
  "tsup": "^8.0.0",
50
50
  "typescript": "^5.6.0",