@y14e/accordion 2.0.14 → 2.0.15
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 +7 -7
- package/dist/index.bundle.cjs +36 -59
- package/dist/index.bundle.js +36 -59
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ npm i @y14e/accordion
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// npm
|
|
13
|
-
import { Accordion } from
|
|
13
|
+
import { Accordion } from '@y14e/accordion';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import { Accordion } from
|
|
16
|
+
import { Accordion } from 'https://esm.sh/@y14e/accordion@2.0.15';
|
|
17
17
|
// or
|
|
18
|
-
import { Accordion } from
|
|
18
|
+
import { Accordion } from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@2.0.15/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import { Accordion } from
|
|
20
|
+
import { Accordion } from 'https://esm.unpkg.com/@y14e/accordion@2.0.15';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
@@ -51,15 +51,15 @@ interface AccordionOptions {
|
|
|
51
51
|
Override the global default settings applied to all accordion instances.
|
|
52
52
|
|
|
53
53
|
```ts
|
|
54
|
-
import { Accordion } from
|
|
54
|
+
import { Accordion } from '@y14e/accordion';
|
|
55
55
|
|
|
56
56
|
Accordion.defaults = {
|
|
57
57
|
animation: {
|
|
58
58
|
duration: 1000,
|
|
59
59
|
},
|
|
60
60
|
selector: {
|
|
61
|
-
content:
|
|
62
|
-
trigger:
|
|
61
|
+
content: '.content',
|
|
62
|
+
trigger: '.trigger',
|
|
63
63
|
},
|
|
64
64
|
};
|
|
65
65
|
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -37,16 +37,16 @@ function restoreAttributes(element_or_elements) {
|
|
|
37
37
|
}
|
|
38
38
|
function saveAttributes(element_or_elements, name_or_names) {
|
|
39
39
|
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
40
|
-
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements])
|
|
40
|
+
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
41
41
|
let snapshot = snapshots.get(element);
|
|
42
42
|
if (!snapshot) {
|
|
43
43
|
snapshot = /* @__PURE__ */ new Map();
|
|
44
44
|
snapshots.set(element, snapshot);
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
for (const name of names) {
|
|
47
47
|
snapshot.set(name, element.getAttribute(name));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
50
|
}
|
|
51
51
|
function isValid(element, name, token) {
|
|
52
52
|
if (!(element instanceof Element)) {
|
|
@@ -91,7 +91,7 @@ function resolveOptions(options) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// node_modules/power-focusable/dist/index.js
|
|
94
|
-
var FOCUSABLE_SELECTOR =
|
|
94
|
+
var FOCUSABLE_SELECTOR = ':is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])';
|
|
95
95
|
var FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX = FOCUSABLE_SELECTOR.replace(
|
|
96
96
|
/(,\s*)?\[tabindex="-1"\]/g,
|
|
97
97
|
""
|
|
@@ -117,29 +117,19 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
117
117
|
}) || include?.(node)) {
|
|
118
118
|
candidates[candidates.length] = node;
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
for (let i = 0, l = children2.length; i < l; i++) {
|
|
122
|
-
const child = children2[i];
|
|
123
|
-
child && traverse2(child);
|
|
124
|
-
}
|
|
120
|
+
(composed ? getComposedChildren(node) : getChildren(node)).map(traverse2);
|
|
125
121
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
child && traverse2(child);
|
|
130
|
-
}
|
|
122
|
+
(composed ? getComposedChildren(container) : getChildren(container)).map(
|
|
123
|
+
traverse2
|
|
124
|
+
);
|
|
131
125
|
} else {
|
|
132
|
-
const
|
|
126
|
+
for (const match of container.querySelectorAll(
|
|
133
127
|
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
const matched = matches[i];
|
|
137
|
-
if (matched && isFocusable(matched, {
|
|
128
|
+
)) {
|
|
129
|
+
match && isFocusable(match, {
|
|
138
130
|
skipNegativeTabIndexCheck,
|
|
139
131
|
skipVisibilityCheck
|
|
140
|
-
}))
|
|
141
|
-
candidates[candidates.length] = matched;
|
|
142
|
-
}
|
|
132
|
+
}) && candidates.push(match);
|
|
143
133
|
}
|
|
144
134
|
}
|
|
145
135
|
return normalizeRadioGroup(
|
|
@@ -206,8 +196,7 @@ function isDisabledDeep(element) {
|
|
|
206
196
|
}
|
|
207
197
|
function normalizeRadioGroup(elements) {
|
|
208
198
|
let map = null;
|
|
209
|
-
for (
|
|
210
|
-
const element = elements[i];
|
|
199
|
+
for (const element of elements) {
|
|
211
200
|
if (!(element instanceof HTMLInputElement)) {
|
|
212
201
|
continue;
|
|
213
202
|
}
|
|
@@ -257,23 +246,10 @@ function normalizeRadioGroup(elements) {
|
|
|
257
246
|
function sortByTabIndex(elements) {
|
|
258
247
|
const ordered = [];
|
|
259
248
|
const natural = [];
|
|
260
|
-
for (
|
|
261
|
-
|
|
262
|
-
if (element) {
|
|
263
|
-
const target = getTabIndex(element) > 0 ? ordered : natural;
|
|
264
|
-
target[target.length] = element;
|
|
265
|
-
}
|
|
249
|
+
for (const element of elements) {
|
|
250
|
+
(getTabIndex(element) > 0 ? ordered : natural).push(element);
|
|
266
251
|
}
|
|
267
|
-
ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b));
|
|
268
|
-
let count = 0;
|
|
269
|
-
const sorted = new Array(ordered.length + natural.length);
|
|
270
|
-
for (let i = 0, l = ordered.length; i < l; i++) {
|
|
271
|
-
sorted[count++] = ordered[i];
|
|
272
|
-
}
|
|
273
|
-
for (let i = 0, l = natural.length; i < l; i++) {
|
|
274
|
-
sorted[count++] = natural[i];
|
|
275
|
-
}
|
|
276
|
-
return sorted;
|
|
252
|
+
return ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b)).concat(natural);
|
|
277
253
|
}
|
|
278
254
|
function getComposedChildren(node) {
|
|
279
255
|
if (node instanceof ShadowRoot) {
|
|
@@ -463,10 +439,10 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
463
439
|
this.#isDestroyed = true;
|
|
464
440
|
this.#controller?.abort();
|
|
465
441
|
this.#controller = null;
|
|
466
|
-
this.#focusables
|
|
442
|
+
for (const focusable of this.#focusables) {
|
|
467
443
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
468
444
|
restoreAttributes(focusable);
|
|
469
|
-
}
|
|
445
|
+
}
|
|
470
446
|
this.#focusables.clear();
|
|
471
447
|
this.#focusablesByFirstChar.clear();
|
|
472
448
|
}
|
|
@@ -610,17 +586,17 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
610
586
|
caseInsensitive: true
|
|
611
587
|
});
|
|
612
588
|
}
|
|
613
|
-
|
|
589
|
+
for (const key of keys) {
|
|
614
590
|
const focusables = this.#focusablesByFirstChar.get(key) ?? [];
|
|
615
591
|
focusables.push(focusable);
|
|
616
592
|
this.#focusablesByFirstChar.set(key, focusables);
|
|
617
|
-
}
|
|
593
|
+
}
|
|
618
594
|
}
|
|
619
595
|
if (!navigationOnly) {
|
|
620
596
|
if (active && this.#focusables.has(active)) {
|
|
621
|
-
this.#focusables
|
|
597
|
+
for (const focusable of this.#focusables) {
|
|
622
598
|
focusable.setAttribute("tabindex", focusable === active ? "0" : "-1");
|
|
623
|
-
}
|
|
599
|
+
}
|
|
624
600
|
} else {
|
|
625
601
|
[...this.#focusables].forEach((focusable, i) => {
|
|
626
602
|
focusable.setAttribute("tabindex", i || noStart ? "-1" : "0");
|
|
@@ -650,6 +626,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
650
626
|
typeahead = false,
|
|
651
627
|
wrap = false
|
|
652
628
|
} = options;
|
|
629
|
+
direction = direction.toLowerCase();
|
|
653
630
|
if (!["both", "horizontal", "vertical"].includes(direction)) {
|
|
654
631
|
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
655
632
|
direction = "both";
|
|
@@ -780,15 +757,15 @@ var Accordion = class _Accordion {
|
|
|
780
757
|
this.#eventController = null;
|
|
781
758
|
this.#cleanupRovingTabIndex?.();
|
|
782
759
|
this.#cleanupRovingTabIndex = null;
|
|
783
|
-
this.#buttons
|
|
760
|
+
for (const button of this.#buttons) {
|
|
784
761
|
button.destroy();
|
|
785
|
-
}
|
|
762
|
+
}
|
|
786
763
|
this.#buttons.length = 0;
|
|
787
764
|
!force && await this.#waitAnimationsFinish();
|
|
788
|
-
this.#contentElements
|
|
765
|
+
for (const content of this.#contentElements) {
|
|
789
766
|
force && this.#bindings.get(content)?.animation?.finish();
|
|
790
767
|
this.#onContentAnimationFinish(content);
|
|
791
|
-
}
|
|
768
|
+
}
|
|
792
769
|
this.#animationController?.abort();
|
|
793
770
|
this.#animationController = null;
|
|
794
771
|
restoreAttributes([
|
|
@@ -873,9 +850,9 @@ var Accordion = class _Accordion {
|
|
|
873
850
|
return;
|
|
874
851
|
}
|
|
875
852
|
trigger.ariaExpanded === "false" && content.setAttribute("hidden", "until-found");
|
|
876
|
-
["block-size", "overflow"]
|
|
853
|
+
for (const name of ["block-size", "overflow"]) {
|
|
877
854
|
content.style.removeProperty(name);
|
|
878
|
-
}
|
|
855
|
+
}
|
|
879
856
|
}
|
|
880
857
|
#onContentBeforeMatch = (event) => {
|
|
881
858
|
const content = event.currentTarget;
|
|
@@ -1002,10 +979,10 @@ var Accordion = class _Accordion {
|
|
|
1002
979
|
}
|
|
1003
980
|
async #waitAnimationsFinish() {
|
|
1004
981
|
const promises = [];
|
|
1005
|
-
this.#contentElements
|
|
982
|
+
for (const content of this.#contentElements) {
|
|
1006
983
|
const animation = this.#bindings.get(content)?.animation;
|
|
1007
984
|
animation && promises.push(waitAnimationFinish(animation));
|
|
1008
|
-
}
|
|
985
|
+
}
|
|
1009
986
|
await Promise.allSettled(promises);
|
|
1010
987
|
}
|
|
1011
988
|
};
|
|
@@ -1018,7 +995,7 @@ function waitAnimationFinish(animation) {
|
|
|
1018
995
|
* Accordion
|
|
1019
996
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
1020
997
|
*
|
|
1021
|
-
* @version 2.0.
|
|
998
|
+
* @version 2.0.15
|
|
1022
999
|
* @author Yusuke Kamiyamane
|
|
1023
1000
|
* @license MIT
|
|
1024
1001
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1030,7 +1007,7 @@ function waitAnimationFinish(animation) {
|
|
|
1030
1007
|
(**
|
|
1031
1008
|
* Attribute Utils
|
|
1032
1009
|
*
|
|
1033
|
-
* @version 2.0.
|
|
1010
|
+
* @version 2.0.10
|
|
1034
1011
|
* @author Yusuke Kamiyamane
|
|
1035
1012
|
* @license MIT
|
|
1036
1013
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1043,7 +1020,7 @@ power-focusable/dist/index.js:
|
|
|
1043
1020
|
* High-precision focus management utility with full composed tree support.
|
|
1044
1021
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
1045
1022
|
*
|
|
1046
|
-
* @version 4.3.
|
|
1023
|
+
* @version 4.3.30
|
|
1047
1024
|
* @author Yusuke Kamiyamane
|
|
1048
1025
|
* @license MIT
|
|
1049
1026
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1067,7 +1044,7 @@ power-focusable/dist/index.js:
|
|
|
1067
1044
|
* Lightweight roving tabindex utility with fully focus management.
|
|
1068
1045
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1069
1046
|
*
|
|
1070
|
-
* @version 3.1.
|
|
1047
|
+
* @version 3.1.28
|
|
1071
1048
|
* @author Yusuke Kamiyamane
|
|
1072
1049
|
* @license MIT
|
|
1073
1050
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -35,16 +35,16 @@ function restoreAttributes(element_or_elements) {
|
|
|
35
35
|
}
|
|
36
36
|
function saveAttributes(element_or_elements, name_or_names) {
|
|
37
37
|
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
38
|
-
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements])
|
|
38
|
+
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
39
39
|
let snapshot = snapshots.get(element);
|
|
40
40
|
if (!snapshot) {
|
|
41
41
|
snapshot = /* @__PURE__ */ new Map();
|
|
42
42
|
snapshots.set(element, snapshot);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
for (const name of names) {
|
|
45
45
|
snapshot.set(name, element.getAttribute(name));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
49
|
function isValid(element, name, token) {
|
|
50
50
|
if (!(element instanceof Element)) {
|
|
@@ -89,7 +89,7 @@ function resolveOptions(options) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// node_modules/power-focusable/dist/index.js
|
|
92
|
-
var FOCUSABLE_SELECTOR =
|
|
92
|
+
var FOCUSABLE_SELECTOR = ':is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])';
|
|
93
93
|
var FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX = FOCUSABLE_SELECTOR.replace(
|
|
94
94
|
/(,\s*)?\[tabindex="-1"\]/g,
|
|
95
95
|
""
|
|
@@ -115,29 +115,19 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
115
115
|
}) || include?.(node)) {
|
|
116
116
|
candidates[candidates.length] = node;
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
for (let i = 0, l = children2.length; i < l; i++) {
|
|
120
|
-
const child = children2[i];
|
|
121
|
-
child && traverse2(child);
|
|
122
|
-
}
|
|
118
|
+
(composed ? getComposedChildren(node) : getChildren(node)).map(traverse2);
|
|
123
119
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
child && traverse2(child);
|
|
128
|
-
}
|
|
120
|
+
(composed ? getComposedChildren(container) : getChildren(container)).map(
|
|
121
|
+
traverse2
|
|
122
|
+
);
|
|
129
123
|
} else {
|
|
130
|
-
const
|
|
124
|
+
for (const match of container.querySelectorAll(
|
|
131
125
|
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
const matched = matches[i];
|
|
135
|
-
if (matched && isFocusable(matched, {
|
|
126
|
+
)) {
|
|
127
|
+
match && isFocusable(match, {
|
|
136
128
|
skipNegativeTabIndexCheck,
|
|
137
129
|
skipVisibilityCheck
|
|
138
|
-
}))
|
|
139
|
-
candidates[candidates.length] = matched;
|
|
140
|
-
}
|
|
130
|
+
}) && candidates.push(match);
|
|
141
131
|
}
|
|
142
132
|
}
|
|
143
133
|
return normalizeRadioGroup(
|
|
@@ -204,8 +194,7 @@ function isDisabledDeep(element) {
|
|
|
204
194
|
}
|
|
205
195
|
function normalizeRadioGroup(elements) {
|
|
206
196
|
let map = null;
|
|
207
|
-
for (
|
|
208
|
-
const element = elements[i];
|
|
197
|
+
for (const element of elements) {
|
|
209
198
|
if (!(element instanceof HTMLInputElement)) {
|
|
210
199
|
continue;
|
|
211
200
|
}
|
|
@@ -255,23 +244,10 @@ function normalizeRadioGroup(elements) {
|
|
|
255
244
|
function sortByTabIndex(elements) {
|
|
256
245
|
const ordered = [];
|
|
257
246
|
const natural = [];
|
|
258
|
-
for (
|
|
259
|
-
|
|
260
|
-
if (element) {
|
|
261
|
-
const target = getTabIndex(element) > 0 ? ordered : natural;
|
|
262
|
-
target[target.length] = element;
|
|
263
|
-
}
|
|
247
|
+
for (const element of elements) {
|
|
248
|
+
(getTabIndex(element) > 0 ? ordered : natural).push(element);
|
|
264
249
|
}
|
|
265
|
-
ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b));
|
|
266
|
-
let count = 0;
|
|
267
|
-
const sorted = new Array(ordered.length + natural.length);
|
|
268
|
-
for (let i = 0, l = ordered.length; i < l; i++) {
|
|
269
|
-
sorted[count++] = ordered[i];
|
|
270
|
-
}
|
|
271
|
-
for (let i = 0, l = natural.length; i < l; i++) {
|
|
272
|
-
sorted[count++] = natural[i];
|
|
273
|
-
}
|
|
274
|
-
return sorted;
|
|
250
|
+
return ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b)).concat(natural);
|
|
275
251
|
}
|
|
276
252
|
function getComposedChildren(node) {
|
|
277
253
|
if (node instanceof ShadowRoot) {
|
|
@@ -461,10 +437,10 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
461
437
|
this.#isDestroyed = true;
|
|
462
438
|
this.#controller?.abort();
|
|
463
439
|
this.#controller = null;
|
|
464
|
-
this.#focusables
|
|
440
|
+
for (const focusable of this.#focusables) {
|
|
465
441
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
466
442
|
restoreAttributes(focusable);
|
|
467
|
-
}
|
|
443
|
+
}
|
|
468
444
|
this.#focusables.clear();
|
|
469
445
|
this.#focusablesByFirstChar.clear();
|
|
470
446
|
}
|
|
@@ -608,17 +584,17 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
608
584
|
caseInsensitive: true
|
|
609
585
|
});
|
|
610
586
|
}
|
|
611
|
-
|
|
587
|
+
for (const key of keys) {
|
|
612
588
|
const focusables = this.#focusablesByFirstChar.get(key) ?? [];
|
|
613
589
|
focusables.push(focusable);
|
|
614
590
|
this.#focusablesByFirstChar.set(key, focusables);
|
|
615
|
-
}
|
|
591
|
+
}
|
|
616
592
|
}
|
|
617
593
|
if (!navigationOnly) {
|
|
618
594
|
if (active && this.#focusables.has(active)) {
|
|
619
|
-
this.#focusables
|
|
595
|
+
for (const focusable of this.#focusables) {
|
|
620
596
|
focusable.setAttribute("tabindex", focusable === active ? "0" : "-1");
|
|
621
|
-
}
|
|
597
|
+
}
|
|
622
598
|
} else {
|
|
623
599
|
[...this.#focusables].forEach((focusable, i) => {
|
|
624
600
|
focusable.setAttribute("tabindex", i || noStart ? "-1" : "0");
|
|
@@ -648,6 +624,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
648
624
|
typeahead = false,
|
|
649
625
|
wrap = false
|
|
650
626
|
} = options;
|
|
627
|
+
direction = direction.toLowerCase();
|
|
651
628
|
if (!["both", "horizontal", "vertical"].includes(direction)) {
|
|
652
629
|
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
653
630
|
direction = "both";
|
|
@@ -778,15 +755,15 @@ var Accordion = class _Accordion {
|
|
|
778
755
|
this.#eventController = null;
|
|
779
756
|
this.#cleanupRovingTabIndex?.();
|
|
780
757
|
this.#cleanupRovingTabIndex = null;
|
|
781
|
-
this.#buttons
|
|
758
|
+
for (const button of this.#buttons) {
|
|
782
759
|
button.destroy();
|
|
783
|
-
}
|
|
760
|
+
}
|
|
784
761
|
this.#buttons.length = 0;
|
|
785
762
|
!force && await this.#waitAnimationsFinish();
|
|
786
|
-
this.#contentElements
|
|
763
|
+
for (const content of this.#contentElements) {
|
|
787
764
|
force && this.#bindings.get(content)?.animation?.finish();
|
|
788
765
|
this.#onContentAnimationFinish(content);
|
|
789
|
-
}
|
|
766
|
+
}
|
|
790
767
|
this.#animationController?.abort();
|
|
791
768
|
this.#animationController = null;
|
|
792
769
|
restoreAttributes([
|
|
@@ -871,9 +848,9 @@ var Accordion = class _Accordion {
|
|
|
871
848
|
return;
|
|
872
849
|
}
|
|
873
850
|
trigger.ariaExpanded === "false" && content.setAttribute("hidden", "until-found");
|
|
874
|
-
["block-size", "overflow"]
|
|
851
|
+
for (const name of ["block-size", "overflow"]) {
|
|
875
852
|
content.style.removeProperty(name);
|
|
876
|
-
}
|
|
853
|
+
}
|
|
877
854
|
}
|
|
878
855
|
#onContentBeforeMatch = (event) => {
|
|
879
856
|
const content = event.currentTarget;
|
|
@@ -1000,10 +977,10 @@ var Accordion = class _Accordion {
|
|
|
1000
977
|
}
|
|
1001
978
|
async #waitAnimationsFinish() {
|
|
1002
979
|
const promises = [];
|
|
1003
|
-
this.#contentElements
|
|
980
|
+
for (const content of this.#contentElements) {
|
|
1004
981
|
const animation = this.#bindings.get(content)?.animation;
|
|
1005
982
|
animation && promises.push(waitAnimationFinish(animation));
|
|
1006
|
-
}
|
|
983
|
+
}
|
|
1007
984
|
await Promise.allSettled(promises);
|
|
1008
985
|
}
|
|
1009
986
|
};
|
|
@@ -1016,7 +993,7 @@ function waitAnimationFinish(animation) {
|
|
|
1016
993
|
* Accordion
|
|
1017
994
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
1018
995
|
*
|
|
1019
|
-
* @version 2.0.
|
|
996
|
+
* @version 2.0.15
|
|
1020
997
|
* @author Yusuke Kamiyamane
|
|
1021
998
|
* @license MIT
|
|
1022
999
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1028,7 +1005,7 @@ function waitAnimationFinish(animation) {
|
|
|
1028
1005
|
(**
|
|
1029
1006
|
* Attribute Utils
|
|
1030
1007
|
*
|
|
1031
|
-
* @version 2.0.
|
|
1008
|
+
* @version 2.0.10
|
|
1032
1009
|
* @author Yusuke Kamiyamane
|
|
1033
1010
|
* @license MIT
|
|
1034
1011
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1041,7 +1018,7 @@ power-focusable/dist/index.js:
|
|
|
1041
1018
|
* High-precision focus management utility with full composed tree support.
|
|
1042
1019
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
1043
1020
|
*
|
|
1044
|
-
* @version 4.3.
|
|
1021
|
+
* @version 4.3.30
|
|
1045
1022
|
* @author Yusuke Kamiyamane
|
|
1046
1023
|
* @license MIT
|
|
1047
1024
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1065,7 +1042,7 @@ power-focusable/dist/index.js:
|
|
|
1065
1042
|
* Lightweight roving tabindex utility with fully focus management.
|
|
1066
1043
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1067
1044
|
*
|
|
1068
|
-
* @version 3.1.
|
|
1045
|
+
* @version 3.1.28
|
|
1069
1046
|
* @author Yusuke Kamiyamane
|
|
1070
1047
|
* @license MIT
|
|
1071
1048
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -110,15 +110,15 @@ var Accordion = class _Accordion {
|
|
|
110
110
|
this.#eventController = null;
|
|
111
111
|
this.#cleanupRovingTabIndex?.();
|
|
112
112
|
this.#cleanupRovingTabIndex = null;
|
|
113
|
-
this.#buttons
|
|
113
|
+
for (const button of this.#buttons) {
|
|
114
114
|
button.destroy();
|
|
115
|
-
}
|
|
115
|
+
}
|
|
116
116
|
this.#buttons.length = 0;
|
|
117
117
|
!force && await this.#waitAnimationsFinish();
|
|
118
|
-
this.#contentElements
|
|
118
|
+
for (const content of this.#contentElements) {
|
|
119
119
|
force && this.#bindings.get(content)?.animation?.finish();
|
|
120
120
|
this.#onContentAnimationFinish(content);
|
|
121
|
-
}
|
|
121
|
+
}
|
|
122
122
|
this.#animationController?.abort();
|
|
123
123
|
this.#animationController = null;
|
|
124
124
|
utils__namespace.restoreAttributes([
|
|
@@ -203,9 +203,9 @@ var Accordion = class _Accordion {
|
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
205
|
trigger.ariaExpanded === "false" && content.setAttribute("hidden", "until-found");
|
|
206
|
-
["block-size", "overflow"]
|
|
206
|
+
for (const name of ["block-size", "overflow"]) {
|
|
207
207
|
content.style.removeProperty(name);
|
|
208
|
-
}
|
|
208
|
+
}
|
|
209
209
|
}
|
|
210
210
|
#onContentBeforeMatch = (event) => {
|
|
211
211
|
const content = event.currentTarget;
|
|
@@ -332,10 +332,10 @@ var Accordion = class _Accordion {
|
|
|
332
332
|
}
|
|
333
333
|
async #waitAnimationsFinish() {
|
|
334
334
|
const promises = [];
|
|
335
|
-
this.#contentElements
|
|
335
|
+
for (const content of this.#contentElements) {
|
|
336
336
|
const animation = this.#bindings.get(content)?.animation;
|
|
337
337
|
animation && promises.push(waitAnimationFinish(animation));
|
|
338
|
-
}
|
|
338
|
+
}
|
|
339
339
|
await Promise.allSettled(promises);
|
|
340
340
|
}
|
|
341
341
|
};
|
|
@@ -348,7 +348,7 @@ function waitAnimationFinish(animation) {
|
|
|
348
348
|
* Accordion
|
|
349
349
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
350
350
|
*
|
|
351
|
-
* @version 2.0.
|
|
351
|
+
* @version 2.0.15
|
|
352
352
|
* @author Yusuke Kamiyamane
|
|
353
353
|
* @license MIT
|
|
354
354
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -88,15 +88,15 @@ var Accordion = class _Accordion {
|
|
|
88
88
|
this.#eventController = null;
|
|
89
89
|
this.#cleanupRovingTabIndex?.();
|
|
90
90
|
this.#cleanupRovingTabIndex = null;
|
|
91
|
-
this.#buttons
|
|
91
|
+
for (const button of this.#buttons) {
|
|
92
92
|
button.destroy();
|
|
93
|
-
}
|
|
93
|
+
}
|
|
94
94
|
this.#buttons.length = 0;
|
|
95
95
|
!force && await this.#waitAnimationsFinish();
|
|
96
|
-
this.#contentElements
|
|
96
|
+
for (const content of this.#contentElements) {
|
|
97
97
|
force && this.#bindings.get(content)?.animation?.finish();
|
|
98
98
|
this.#onContentAnimationFinish(content);
|
|
99
|
-
}
|
|
99
|
+
}
|
|
100
100
|
this.#animationController?.abort();
|
|
101
101
|
this.#animationController = null;
|
|
102
102
|
utils.restoreAttributes([
|
|
@@ -181,9 +181,9 @@ var Accordion = class _Accordion {
|
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
trigger.ariaExpanded === "false" && content.setAttribute("hidden", "until-found");
|
|
184
|
-
["block-size", "overflow"]
|
|
184
|
+
for (const name of ["block-size", "overflow"]) {
|
|
185
185
|
content.style.removeProperty(name);
|
|
186
|
-
}
|
|
186
|
+
}
|
|
187
187
|
}
|
|
188
188
|
#onContentBeforeMatch = (event) => {
|
|
189
189
|
const content = event.currentTarget;
|
|
@@ -310,10 +310,10 @@ var Accordion = class _Accordion {
|
|
|
310
310
|
}
|
|
311
311
|
async #waitAnimationsFinish() {
|
|
312
312
|
const promises = [];
|
|
313
|
-
this.#contentElements
|
|
313
|
+
for (const content of this.#contentElements) {
|
|
314
314
|
const animation = this.#bindings.get(content)?.animation;
|
|
315
315
|
animation && promises.push(waitAnimationFinish(animation));
|
|
316
|
-
}
|
|
316
|
+
}
|
|
317
317
|
await Promise.allSettled(promises);
|
|
318
318
|
}
|
|
319
319
|
};
|
|
@@ -326,7 +326,7 @@ function waitAnimationFinish(animation) {
|
|
|
326
326
|
* Accordion
|
|
327
327
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
328
328
|
*
|
|
329
|
-
* @version 2.0.
|
|
329
|
+
* @version 2.0.15
|
|
330
330
|
* @author Yusuke Kamiyamane
|
|
331
331
|
* @license MIT
|
|
332
332
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/accordion",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "WAI-ARIA compliant accordion pattern implementation in TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"a11y",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"esbuild": true
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@y14e/attribute-utils": "^2.0.
|
|
57
|
+
"@y14e/attribute-utils": "^2.0.10",
|
|
58
58
|
"@y14e/button": "^1.0.8",
|
|
59
|
-
"@y14e/roving-tabindex": "^3.1.
|
|
59
|
+
"@y14e/roving-tabindex": "^3.1.28"
|
|
60
60
|
}
|
|
61
61
|
}
|