@y14e/tabs 1.5.6 → 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 +4 -4
- package/dist/index.cjs +67 -38
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +67 -38
- package/package.json +3 -3
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
@@ -13,11 +13,10 @@ function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
|
13
13
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
14
14
|
if (caseInsensitive) {
|
|
15
15
|
const lower = token.toLowerCase();
|
|
16
|
-
if (tokens.
|
|
17
|
-
|
|
16
|
+
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
17
|
+
tokens.push(token);
|
|
18
|
+
element.setAttribute(attribute, serialize(tokens));
|
|
18
19
|
}
|
|
19
|
-
tokens.push(token);
|
|
20
|
-
element.setAttribute(attribute, serialize(tokens));
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
22
|
const set = new Set(tokens);
|
|
@@ -119,11 +118,10 @@ function addTokenToAttribute2(element, attribute, token, options = {}) {
|
|
|
119
118
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
120
119
|
if (caseInsensitive) {
|
|
121
120
|
const lower = token.toLowerCase();
|
|
122
|
-
if (tokens.
|
|
123
|
-
|
|
121
|
+
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
122
|
+
tokens.push(token);
|
|
123
|
+
element.setAttribute(attribute, serialize(tokens));
|
|
124
124
|
}
|
|
125
|
-
tokens.push(token);
|
|
126
|
-
element.setAttribute(attribute, serialize(tokens));
|
|
127
125
|
return;
|
|
128
126
|
}
|
|
129
127
|
const set = new Set(tokens);
|
|
@@ -402,6 +400,8 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
402
400
|
let {
|
|
403
401
|
direction,
|
|
404
402
|
navigationOnly = false,
|
|
403
|
+
noMemory = false,
|
|
404
|
+
noStart = false,
|
|
405
405
|
selector,
|
|
406
406
|
typeahead = false,
|
|
407
407
|
wrap = false
|
|
@@ -414,6 +414,14 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
414
414
|
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
415
415
|
navigationOnly = false;
|
|
416
416
|
}
|
|
417
|
+
if (typeof noMemory !== "boolean") {
|
|
418
|
+
console.warn("Invalid noMemory option. Fallback: false.");
|
|
419
|
+
noMemory = false;
|
|
420
|
+
}
|
|
421
|
+
if (typeof noStart !== "boolean") {
|
|
422
|
+
console.warn("Invalid noStart option. Fallback: false.");
|
|
423
|
+
noStart = false;
|
|
424
|
+
}
|
|
417
425
|
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
418
426
|
console.warn(
|
|
419
427
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
@@ -428,13 +436,15 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
428
436
|
console.warn("Invalid wrap option. Fallback: false.");
|
|
429
437
|
wrap = false;
|
|
430
438
|
}
|
|
431
|
-
const settings = {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
439
|
+
const settings = {
|
|
440
|
+
navigationOnly,
|
|
441
|
+
noMemory,
|
|
442
|
+
noStart,
|
|
443
|
+
typeahead,
|
|
444
|
+
wrap
|
|
445
|
+
};
|
|
446
|
+
direction && Object.assign(settings, { direction });
|
|
447
|
+
selector && Object.assign(settings, { selector });
|
|
438
448
|
const roving = new RovingTabIndex(container, settings);
|
|
439
449
|
return () => roving.destroy();
|
|
440
450
|
}
|
|
@@ -467,12 +477,29 @@ var RovingTabIndex = class {
|
|
|
467
477
|
#initialize() {
|
|
468
478
|
this.#update(document.activeElement);
|
|
469
479
|
this.#controller = new AbortController();
|
|
480
|
+
const { signal } = this.#controller;
|
|
481
|
+
document.addEventListener("focusin", this.#onFocusIn, {
|
|
482
|
+
capture: true,
|
|
483
|
+
signal
|
|
484
|
+
});
|
|
470
485
|
document.addEventListener("keydown", this.#onKeyDown, {
|
|
471
486
|
capture: true,
|
|
472
|
-
signal
|
|
487
|
+
signal
|
|
473
488
|
});
|
|
474
489
|
this.#container.setAttribute("data-roving-tabindex-initialized", "");
|
|
475
490
|
}
|
|
491
|
+
#onFocusIn = (event) => {
|
|
492
|
+
const { target } = event;
|
|
493
|
+
if (!(target instanceof Element)) {
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
const isFocusable22 = this.#focusables.has(target);
|
|
497
|
+
if (this.#options.noMemory && !isFocusable22) {
|
|
498
|
+
this.#update(null);
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
isFocusable22 && this.#update(target);
|
|
502
|
+
};
|
|
476
503
|
#onKeyDown = (event) => {
|
|
477
504
|
if (!event.composedPath().includes(this.#container)) {
|
|
478
505
|
return;
|
|
@@ -503,7 +530,6 @@ var RovingTabIndex = class {
|
|
|
503
530
|
return;
|
|
504
531
|
}
|
|
505
532
|
event.preventDefault();
|
|
506
|
-
event.stopPropagation();
|
|
507
533
|
const currentIndex = current.indexOf(active);
|
|
508
534
|
let rawIndex;
|
|
509
535
|
let newIndex = currentIndex;
|
|
@@ -534,11 +560,7 @@ var RovingTabIndex = class {
|
|
|
534
560
|
}
|
|
535
561
|
}
|
|
536
562
|
const focusable = target.at(newIndex);
|
|
537
|
-
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
540
|
-
this.#update(focusable);
|
|
541
|
-
focusElement(focusable);
|
|
563
|
+
focusable && focusElement(focusable);
|
|
542
564
|
};
|
|
543
565
|
#update(active) {
|
|
544
566
|
const current = new Set(this.#getFocusables());
|
|
@@ -553,7 +575,7 @@ var RovingTabIndex = class {
|
|
|
553
575
|
index >= 0 && focusables.splice(index, 1);
|
|
554
576
|
});
|
|
555
577
|
}
|
|
556
|
-
const { navigationOnly } = this.#options;
|
|
578
|
+
const { navigationOnly, noStart, typeahead } = this.#options;
|
|
557
579
|
for (const focusable of current) {
|
|
558
580
|
if (this.#focusables.has(focusable)) {
|
|
559
581
|
continue;
|
|
@@ -563,7 +585,7 @@ var RovingTabIndex = class {
|
|
|
563
585
|
saveAttributes2([focusable], ["tabindex"]);
|
|
564
586
|
focusable.setAttribute("tabindex", "-1");
|
|
565
587
|
}
|
|
566
|
-
if (!
|
|
588
|
+
if (!typeahead) {
|
|
567
589
|
continue;
|
|
568
590
|
}
|
|
569
591
|
const value = focusable.ariaKeyShortcuts?.trim();
|
|
@@ -594,7 +616,7 @@ var RovingTabIndex = class {
|
|
|
594
616
|
return;
|
|
595
617
|
}
|
|
596
618
|
[...this.#focusables].forEach((focusable, i) => {
|
|
597
|
-
focusable.setAttribute("tabindex", i ? "-1" : "0");
|
|
619
|
+
focusable.setAttribute("tabindex", i || noStart ? "-1" : "0");
|
|
598
620
|
});
|
|
599
621
|
}
|
|
600
622
|
#createSelectorFilter() {
|
|
@@ -605,7 +627,8 @@ var RovingTabIndex = class {
|
|
|
605
627
|
return getFocusables(this.#container, {
|
|
606
628
|
composed: true,
|
|
607
629
|
filter: this.#selectorFilter,
|
|
608
|
-
skipNegativeTabIndexCheck: !this.#options.navigationOnly
|
|
630
|
+
skipNegativeTabIndexCheck: !this.#options.navigationOnly,
|
|
631
|
+
skipVisibilityCheck: true
|
|
609
632
|
});
|
|
610
633
|
}
|
|
611
634
|
};
|
|
@@ -790,7 +813,7 @@ var Tabs = class _Tabs {
|
|
|
790
813
|
});
|
|
791
814
|
this.#animation?.cancel();
|
|
792
815
|
const { duration, easing } = this.#settings.animation.content;
|
|
793
|
-
|
|
816
|
+
const animation = this.#contentElement.animate(
|
|
794
817
|
{
|
|
795
818
|
blockSize: [
|
|
796
819
|
`${size}px`,
|
|
@@ -802,8 +825,11 @@ var Tabs = class _Tabs {
|
|
|
802
825
|
easing
|
|
803
826
|
}
|
|
804
827
|
);
|
|
828
|
+
this.#animation = animation;
|
|
805
829
|
const cleanup = () => {
|
|
806
|
-
this.#animation
|
|
830
|
+
if (animation === this.#animation) {
|
|
831
|
+
this.#animation = null;
|
|
832
|
+
}
|
|
807
833
|
};
|
|
808
834
|
this.#animationController = new AbortController();
|
|
809
835
|
const { signal } = this.#animationController;
|
|
@@ -814,6 +840,9 @@ var Tabs = class _Tabs {
|
|
|
814
840
|
this.#animation.addEventListener(
|
|
815
841
|
"finish",
|
|
816
842
|
() => {
|
|
843
|
+
if (this.#animation !== animation) {
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
817
846
|
this.#onAnimationFinish();
|
|
818
847
|
cleanup();
|
|
819
848
|
},
|
|
@@ -830,7 +859,7 @@ var Tabs = class _Tabs {
|
|
|
830
859
|
const opacity = getComputedStyle(p).getPropertyValue("opacity");
|
|
831
860
|
binding.animation?.cancel();
|
|
832
861
|
const isSelected = p === panel;
|
|
833
|
-
const
|
|
862
|
+
const animation2 = p.animate(
|
|
834
863
|
{
|
|
835
864
|
opacity: fade ? isSelected ? [opacity, opacity, "1"] : [opacity, "0", "0"] : isSelected ? [opacity, "1"] : [opacity, "0"]
|
|
836
865
|
},
|
|
@@ -839,16 +868,16 @@ var Tabs = class _Tabs {
|
|
|
839
868
|
easing: "ease"
|
|
840
869
|
}
|
|
841
870
|
);
|
|
842
|
-
binding.animation =
|
|
871
|
+
binding.animation = animation2;
|
|
843
872
|
const cleanup2 = () => {
|
|
844
|
-
if (binding.animation ===
|
|
873
|
+
if (binding.animation === animation2) {
|
|
845
874
|
binding.animation = null;
|
|
846
875
|
}
|
|
847
876
|
};
|
|
848
877
|
this.#animationController = new AbortController();
|
|
849
878
|
const { signal: signal2 } = this.#animationController;
|
|
850
|
-
|
|
851
|
-
|
|
879
|
+
animation2.addEventListener("cancel", cleanup2, { once: true, signal: signal2 });
|
|
880
|
+
animation2.addEventListener("finish", cleanup2, { once: true, signal: signal2 });
|
|
852
881
|
});
|
|
853
882
|
}
|
|
854
883
|
async destroy(force = false) {
|
|
@@ -1140,7 +1169,7 @@ function isFocusable2(element) {
|
|
|
1140
1169
|
* Tabs
|
|
1141
1170
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
1142
1171
|
*
|
|
1143
|
-
* @version 1.5.
|
|
1172
|
+
* @version 1.5.8
|
|
1144
1173
|
* @author Yusuke Kamiyamane
|
|
1145
1174
|
* @license MIT
|
|
1146
1175
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1152,7 +1181,7 @@ function isFocusable2(element) {
|
|
|
1152
1181
|
(**
|
|
1153
1182
|
* Attributes Utils
|
|
1154
1183
|
*
|
|
1155
|
-
* @version 1.1.
|
|
1184
|
+
* @version 1.1.1
|
|
1156
1185
|
* @author Yusuke Kamiyamane
|
|
1157
1186
|
* @license MIT
|
|
1158
1187
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1176,7 +1205,7 @@ function isFocusable2(element) {
|
|
|
1176
1205
|
* Lightweight roving tabindex utility with fully focus management.
|
|
1177
1206
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1178
1207
|
*
|
|
1179
|
-
* @version
|
|
1208
|
+
* @version 3.0.0
|
|
1180
1209
|
* @author Yusuke Kamiyamane
|
|
1181
1210
|
* @license MIT
|
|
1182
1211
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1188,7 +1217,7 @@ function isFocusable2(element) {
|
|
|
1188
1217
|
(**
|
|
1189
1218
|
* Attributes Utils
|
|
1190
1219
|
*
|
|
1191
|
-
* @version 1.1.
|
|
1220
|
+
* @version 1.1.1
|
|
1192
1221
|
* @author Yusuke Kamiyamane
|
|
1193
1222
|
* @license MIT
|
|
1194
1223
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1201,7 +1230,7 @@ function isFocusable2(element) {
|
|
|
1201
1230
|
* High-precision focus management utility with full composed tree support.
|
|
1202
1231
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
1203
1232
|
*
|
|
1204
|
-
* @version 4.3.
|
|
1233
|
+
* @version 4.3.2
|
|
1205
1234
|
* @author Yusuke Kamiyamane
|
|
1206
1235
|
* @license MIT
|
|
1207
1236
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -11,11 +11,10 @@ function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
|
11
11
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
12
12
|
if (caseInsensitive) {
|
|
13
13
|
const lower = token.toLowerCase();
|
|
14
|
-
if (tokens.
|
|
15
|
-
|
|
14
|
+
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
15
|
+
tokens.push(token);
|
|
16
|
+
element.setAttribute(attribute, serialize(tokens));
|
|
16
17
|
}
|
|
17
|
-
tokens.push(token);
|
|
18
|
-
element.setAttribute(attribute, serialize(tokens));
|
|
19
18
|
return;
|
|
20
19
|
}
|
|
21
20
|
const set = new Set(tokens);
|
|
@@ -117,11 +116,10 @@ function addTokenToAttribute2(element, attribute, token, options = {}) {
|
|
|
117
116
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
118
117
|
if (caseInsensitive) {
|
|
119
118
|
const lower = token.toLowerCase();
|
|
120
|
-
if (tokens.
|
|
121
|
-
|
|
119
|
+
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
120
|
+
tokens.push(token);
|
|
121
|
+
element.setAttribute(attribute, serialize(tokens));
|
|
122
122
|
}
|
|
123
|
-
tokens.push(token);
|
|
124
|
-
element.setAttribute(attribute, serialize(tokens));
|
|
125
123
|
return;
|
|
126
124
|
}
|
|
127
125
|
const set = new Set(tokens);
|
|
@@ -400,6 +398,8 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
400
398
|
let {
|
|
401
399
|
direction,
|
|
402
400
|
navigationOnly = false,
|
|
401
|
+
noMemory = false,
|
|
402
|
+
noStart = false,
|
|
403
403
|
selector,
|
|
404
404
|
typeahead = false,
|
|
405
405
|
wrap = false
|
|
@@ -412,6 +412,14 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
412
412
|
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
413
413
|
navigationOnly = false;
|
|
414
414
|
}
|
|
415
|
+
if (typeof noMemory !== "boolean") {
|
|
416
|
+
console.warn("Invalid noMemory option. Fallback: false.");
|
|
417
|
+
noMemory = false;
|
|
418
|
+
}
|
|
419
|
+
if (typeof noStart !== "boolean") {
|
|
420
|
+
console.warn("Invalid noStart option. Fallback: false.");
|
|
421
|
+
noStart = false;
|
|
422
|
+
}
|
|
415
423
|
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
416
424
|
console.warn(
|
|
417
425
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
@@ -426,13 +434,15 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
426
434
|
console.warn("Invalid wrap option. Fallback: false.");
|
|
427
435
|
wrap = false;
|
|
428
436
|
}
|
|
429
|
-
const settings = {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
437
|
+
const settings = {
|
|
438
|
+
navigationOnly,
|
|
439
|
+
noMemory,
|
|
440
|
+
noStart,
|
|
441
|
+
typeahead,
|
|
442
|
+
wrap
|
|
443
|
+
};
|
|
444
|
+
direction && Object.assign(settings, { direction });
|
|
445
|
+
selector && Object.assign(settings, { selector });
|
|
436
446
|
const roving = new RovingTabIndex(container, settings);
|
|
437
447
|
return () => roving.destroy();
|
|
438
448
|
}
|
|
@@ -465,12 +475,29 @@ var RovingTabIndex = class {
|
|
|
465
475
|
#initialize() {
|
|
466
476
|
this.#update(document.activeElement);
|
|
467
477
|
this.#controller = new AbortController();
|
|
478
|
+
const { signal } = this.#controller;
|
|
479
|
+
document.addEventListener("focusin", this.#onFocusIn, {
|
|
480
|
+
capture: true,
|
|
481
|
+
signal
|
|
482
|
+
});
|
|
468
483
|
document.addEventListener("keydown", this.#onKeyDown, {
|
|
469
484
|
capture: true,
|
|
470
|
-
signal
|
|
485
|
+
signal
|
|
471
486
|
});
|
|
472
487
|
this.#container.setAttribute("data-roving-tabindex-initialized", "");
|
|
473
488
|
}
|
|
489
|
+
#onFocusIn = (event) => {
|
|
490
|
+
const { target } = event;
|
|
491
|
+
if (!(target instanceof Element)) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const isFocusable22 = this.#focusables.has(target);
|
|
495
|
+
if (this.#options.noMemory && !isFocusable22) {
|
|
496
|
+
this.#update(null);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
isFocusable22 && this.#update(target);
|
|
500
|
+
};
|
|
474
501
|
#onKeyDown = (event) => {
|
|
475
502
|
if (!event.composedPath().includes(this.#container)) {
|
|
476
503
|
return;
|
|
@@ -501,7 +528,6 @@ var RovingTabIndex = class {
|
|
|
501
528
|
return;
|
|
502
529
|
}
|
|
503
530
|
event.preventDefault();
|
|
504
|
-
event.stopPropagation();
|
|
505
531
|
const currentIndex = current.indexOf(active);
|
|
506
532
|
let rawIndex;
|
|
507
533
|
let newIndex = currentIndex;
|
|
@@ -532,11 +558,7 @@ var RovingTabIndex = class {
|
|
|
532
558
|
}
|
|
533
559
|
}
|
|
534
560
|
const focusable = target.at(newIndex);
|
|
535
|
-
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
this.#update(focusable);
|
|
539
|
-
focusElement(focusable);
|
|
561
|
+
focusable && focusElement(focusable);
|
|
540
562
|
};
|
|
541
563
|
#update(active) {
|
|
542
564
|
const current = new Set(this.#getFocusables());
|
|
@@ -551,7 +573,7 @@ var RovingTabIndex = class {
|
|
|
551
573
|
index >= 0 && focusables.splice(index, 1);
|
|
552
574
|
});
|
|
553
575
|
}
|
|
554
|
-
const { navigationOnly } = this.#options;
|
|
576
|
+
const { navigationOnly, noStart, typeahead } = this.#options;
|
|
555
577
|
for (const focusable of current) {
|
|
556
578
|
if (this.#focusables.has(focusable)) {
|
|
557
579
|
continue;
|
|
@@ -561,7 +583,7 @@ var RovingTabIndex = class {
|
|
|
561
583
|
saveAttributes2([focusable], ["tabindex"]);
|
|
562
584
|
focusable.setAttribute("tabindex", "-1");
|
|
563
585
|
}
|
|
564
|
-
if (!
|
|
586
|
+
if (!typeahead) {
|
|
565
587
|
continue;
|
|
566
588
|
}
|
|
567
589
|
const value = focusable.ariaKeyShortcuts?.trim();
|
|
@@ -592,7 +614,7 @@ var RovingTabIndex = class {
|
|
|
592
614
|
return;
|
|
593
615
|
}
|
|
594
616
|
[...this.#focusables].forEach((focusable, i) => {
|
|
595
|
-
focusable.setAttribute("tabindex", i ? "-1" : "0");
|
|
617
|
+
focusable.setAttribute("tabindex", i || noStart ? "-1" : "0");
|
|
596
618
|
});
|
|
597
619
|
}
|
|
598
620
|
#createSelectorFilter() {
|
|
@@ -603,7 +625,8 @@ var RovingTabIndex = class {
|
|
|
603
625
|
return getFocusables(this.#container, {
|
|
604
626
|
composed: true,
|
|
605
627
|
filter: this.#selectorFilter,
|
|
606
|
-
skipNegativeTabIndexCheck: !this.#options.navigationOnly
|
|
628
|
+
skipNegativeTabIndexCheck: !this.#options.navigationOnly,
|
|
629
|
+
skipVisibilityCheck: true
|
|
607
630
|
});
|
|
608
631
|
}
|
|
609
632
|
};
|
|
@@ -788,7 +811,7 @@ var Tabs = class _Tabs {
|
|
|
788
811
|
});
|
|
789
812
|
this.#animation?.cancel();
|
|
790
813
|
const { duration, easing } = this.#settings.animation.content;
|
|
791
|
-
|
|
814
|
+
const animation = this.#contentElement.animate(
|
|
792
815
|
{
|
|
793
816
|
blockSize: [
|
|
794
817
|
`${size}px`,
|
|
@@ -800,8 +823,11 @@ var Tabs = class _Tabs {
|
|
|
800
823
|
easing
|
|
801
824
|
}
|
|
802
825
|
);
|
|
826
|
+
this.#animation = animation;
|
|
803
827
|
const cleanup = () => {
|
|
804
|
-
this.#animation
|
|
828
|
+
if (animation === this.#animation) {
|
|
829
|
+
this.#animation = null;
|
|
830
|
+
}
|
|
805
831
|
};
|
|
806
832
|
this.#animationController = new AbortController();
|
|
807
833
|
const { signal } = this.#animationController;
|
|
@@ -812,6 +838,9 @@ var Tabs = class _Tabs {
|
|
|
812
838
|
this.#animation.addEventListener(
|
|
813
839
|
"finish",
|
|
814
840
|
() => {
|
|
841
|
+
if (this.#animation !== animation) {
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
815
844
|
this.#onAnimationFinish();
|
|
816
845
|
cleanup();
|
|
817
846
|
},
|
|
@@ -828,7 +857,7 @@ var Tabs = class _Tabs {
|
|
|
828
857
|
const opacity = getComputedStyle(p).getPropertyValue("opacity");
|
|
829
858
|
binding.animation?.cancel();
|
|
830
859
|
const isSelected = p === panel;
|
|
831
|
-
const
|
|
860
|
+
const animation2 = p.animate(
|
|
832
861
|
{
|
|
833
862
|
opacity: fade ? isSelected ? [opacity, opacity, "1"] : [opacity, "0", "0"] : isSelected ? [opacity, "1"] : [opacity, "0"]
|
|
834
863
|
},
|
|
@@ -837,16 +866,16 @@ var Tabs = class _Tabs {
|
|
|
837
866
|
easing: "ease"
|
|
838
867
|
}
|
|
839
868
|
);
|
|
840
|
-
binding.animation =
|
|
869
|
+
binding.animation = animation2;
|
|
841
870
|
const cleanup2 = () => {
|
|
842
|
-
if (binding.animation ===
|
|
871
|
+
if (binding.animation === animation2) {
|
|
843
872
|
binding.animation = null;
|
|
844
873
|
}
|
|
845
874
|
};
|
|
846
875
|
this.#animationController = new AbortController();
|
|
847
876
|
const { signal: signal2 } = this.#animationController;
|
|
848
|
-
|
|
849
|
-
|
|
877
|
+
animation2.addEventListener("cancel", cleanup2, { once: true, signal: signal2 });
|
|
878
|
+
animation2.addEventListener("finish", cleanup2, { once: true, signal: signal2 });
|
|
850
879
|
});
|
|
851
880
|
}
|
|
852
881
|
async destroy(force = false) {
|
|
@@ -1138,7 +1167,7 @@ function isFocusable2(element) {
|
|
|
1138
1167
|
* Tabs
|
|
1139
1168
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
1140
1169
|
*
|
|
1141
|
-
* @version 1.5.
|
|
1170
|
+
* @version 1.5.8
|
|
1142
1171
|
* @author Yusuke Kamiyamane
|
|
1143
1172
|
* @license MIT
|
|
1144
1173
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1150,7 +1179,7 @@ function isFocusable2(element) {
|
|
|
1150
1179
|
(**
|
|
1151
1180
|
* Attributes Utils
|
|
1152
1181
|
*
|
|
1153
|
-
* @version 1.1.
|
|
1182
|
+
* @version 1.1.1
|
|
1154
1183
|
* @author Yusuke Kamiyamane
|
|
1155
1184
|
* @license MIT
|
|
1156
1185
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1174,7 +1203,7 @@ function isFocusable2(element) {
|
|
|
1174
1203
|
* Lightweight roving tabindex utility with fully focus management.
|
|
1175
1204
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1176
1205
|
*
|
|
1177
|
-
* @version
|
|
1206
|
+
* @version 3.0.0
|
|
1178
1207
|
* @author Yusuke Kamiyamane
|
|
1179
1208
|
* @license MIT
|
|
1180
1209
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1186,7 +1215,7 @@ function isFocusable2(element) {
|
|
|
1186
1215
|
(**
|
|
1187
1216
|
* Attributes Utils
|
|
1188
1217
|
*
|
|
1189
|
-
* @version 1.1.
|
|
1218
|
+
* @version 1.1.1
|
|
1190
1219
|
* @author Yusuke Kamiyamane
|
|
1191
1220
|
* @license MIT
|
|
1192
1221
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1199,7 +1228,7 @@ function isFocusable2(element) {
|
|
|
1199
1228
|
* High-precision focus management utility with full composed tree support.
|
|
1200
1229
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
1201
1230
|
*
|
|
1202
|
-
* @version 4.3.
|
|
1231
|
+
* @version 4.3.2
|
|
1203
1232
|
* @author Yusuke Kamiyamane
|
|
1204
1233
|
* @license MIT
|
|
1205
1234
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/tabs",
|
|
3
|
-
"version": "1.5.
|
|
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",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/y14e/tabs#readme",
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@y14e/attributes-utils": "^1.1.
|
|
45
|
+
"@y14e/attributes-utils": "^1.1.1",
|
|
46
46
|
"@y14e/button": "^1.0.0",
|
|
47
|
-
"@y14e/roving-tabindex": "^
|
|
47
|
+
"@y14e/roving-tabindex": "^3.0.0",
|
|
48
48
|
"bun-types": "latest",
|
|
49
49
|
"tsup": "^8.0.0",
|
|
50
50
|
"typescript": "^5.6.0",
|