@y14e/accordion 2.1.6 → 2.1.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 +3 -3
- package/dist/index.bundle.cjs +9 -68
- package/dist/index.bundle.js +9 -68
- package/dist/index.cjs +6 -16
- package/dist/index.d.cts +0 -10
- package/dist/index.d.ts +0 -10
- package/dist/index.js +6 -16
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ npm i @y14e/accordion
|
|
|
13
13
|
import { Accordion } from '@y14e/accordion';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import { Accordion } from 'https://esm.sh/@y14e/accordion@2.1.
|
|
16
|
+
import { Accordion } from 'https://esm.sh/@y14e/accordion@2.1.8';
|
|
17
17
|
// or
|
|
18
|
-
import { Accordion } from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@2.1.
|
|
18
|
+
import { Accordion } from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@2.1.8/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import { Accordion } from 'https://esm.unpkg.com/@y14e/accordion@2.1.
|
|
20
|
+
import { Accordion } from 'https://esm.unpkg.com/@y14e/accordion@2.1.8';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -395,6 +395,7 @@ var Button = class {
|
|
|
395
395
|
};
|
|
396
396
|
|
|
397
397
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
398
|
+
var DIRECTIONS = ["both", "grid", "horizontal", "vertical"];
|
|
398
399
|
function createRovingTabIndex(container, options = {}) {
|
|
399
400
|
if (!(container instanceof Element)) {
|
|
400
401
|
console.warn("Invalid container element");
|
|
@@ -604,7 +605,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
604
605
|
return (element) => !selector || [...this.#container.querySelectorAll(selector)].includes(element);
|
|
605
606
|
}
|
|
606
607
|
#getCellCoords(cell) {
|
|
607
|
-
const {
|
|
608
|
+
const { left, top, width, height } = cell.getBoundingClientRect();
|
|
608
609
|
return {
|
|
609
610
|
x: left + width / 2,
|
|
610
611
|
y: top + height / 2
|
|
@@ -684,7 +685,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
684
685
|
wrap = false
|
|
685
686
|
} = options;
|
|
686
687
|
direction = direction.toLowerCase();
|
|
687
|
-
if (!
|
|
688
|
+
if (!DIRECTIONS.includes(direction)) {
|
|
688
689
|
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
689
690
|
direction = "both";
|
|
690
691
|
}
|
|
@@ -1009,16 +1010,16 @@ var Accordion = class _Accordion {
|
|
|
1009
1010
|
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
1010
1011
|
merged.collapsible = collapsible;
|
|
1011
1012
|
}
|
|
1012
|
-
for (const [
|
|
1013
|
+
for (const [name, value] of Object.entries(defaults.selector)) {
|
|
1013
1014
|
const { selector } = merged;
|
|
1014
|
-
const
|
|
1015
|
+
const n = name;
|
|
1015
1016
|
try {
|
|
1016
|
-
document.querySelector(selector[
|
|
1017
|
+
document.querySelector(selector[n]);
|
|
1017
1018
|
} catch {
|
|
1018
1019
|
console.warn(
|
|
1019
|
-
`Invalid ${
|
|
1020
|
+
`Invalid ${n.replace(/[A-Z]/g, (c) => ` ${c.toLowerCase()}`)} selector. Fallback: '${value}'.`
|
|
1020
1021
|
);
|
|
1021
|
-
selector[
|
|
1022
|
+
selector[n] = value;
|
|
1022
1023
|
}
|
|
1023
1024
|
}
|
|
1024
1025
|
return merged;
|
|
@@ -1033,69 +1034,9 @@ var Accordion = class _Accordion {
|
|
|
1033
1034
|
}
|
|
1034
1035
|
};
|
|
1035
1036
|
function waitAnimationFinish(animation) {
|
|
1036
|
-
return ["
|
|
1037
|
+
return ["finished", "idle"].includes(animation.playState) ? Promise.resolve() : new Promise(
|
|
1037
1038
|
(resolve) => animation.addEventListener("finish", () => resolve(), { once: true })
|
|
1038
1039
|
);
|
|
1039
1040
|
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Accordion
|
|
1042
|
-
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
1043
|
-
*
|
|
1044
|
-
* @version 2.1.6
|
|
1045
|
-
* @author Yusuke Kamiyamane
|
|
1046
|
-
* @license MIT
|
|
1047
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1048
|
-
* @see {@link https://github.com/y14e/accordion}
|
|
1049
|
-
*/
|
|
1050
|
-
/*! Bundled license information:
|
|
1051
|
-
|
|
1052
|
-
@y14e/attribute-utils/dist/index.js:
|
|
1053
|
-
(**
|
|
1054
|
-
* Attribute Utils
|
|
1055
|
-
*
|
|
1056
|
-
* @version 2.0.12
|
|
1057
|
-
* @author Yusuke Kamiyamane
|
|
1058
|
-
* @license MIT
|
|
1059
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1060
|
-
* @see {@link https://github.com/y14e/attribute-utils}
|
|
1061
|
-
*)
|
|
1062
|
-
|
|
1063
|
-
power-focusable/dist/index.js:
|
|
1064
|
-
(**
|
|
1065
|
-
* Power Focusable
|
|
1066
|
-
* High-precision focus management utility with full composed tree support.
|
|
1067
|
-
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
1068
|
-
*
|
|
1069
|
-
* @version 4.4.2
|
|
1070
|
-
* @author Yusuke Kamiyamane
|
|
1071
|
-
* @license MIT
|
|
1072
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1073
|
-
* @see {@link https://github.com/y14e/power-focusable}
|
|
1074
|
-
*)
|
|
1075
|
-
|
|
1076
|
-
@y14e/button/dist/index.js:
|
|
1077
|
-
(**
|
|
1078
|
-
* Button
|
|
1079
|
-
*
|
|
1080
|
-
* @version 1.0.8
|
|
1081
|
-
* @author Yusuke Kamiyamane
|
|
1082
|
-
* @license MIT
|
|
1083
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1084
|
-
* @see {@link https://github.com/y14e/button}
|
|
1085
|
-
*)
|
|
1086
|
-
|
|
1087
|
-
@y14e/roving-tabindex/dist/index.js:
|
|
1088
|
-
(**
|
|
1089
|
-
* Roving Tabindex
|
|
1090
|
-
* Lightweight roving tabindex utility with fully focus management.
|
|
1091
|
-
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1092
|
-
*
|
|
1093
|
-
* @version 3.3.1
|
|
1094
|
-
* @author Yusuke Kamiyamane
|
|
1095
|
-
* @license MIT
|
|
1096
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1097
|
-
* @see {@link https://github.com/y14e/roving-tabindex}
|
|
1098
|
-
*)
|
|
1099
|
-
*/
|
|
1100
1041
|
|
|
1101
1042
|
exports.Accordion = Accordion;
|
package/dist/index.bundle.js
CHANGED
|
@@ -393,6 +393,7 @@ var Button = class {
|
|
|
393
393
|
};
|
|
394
394
|
|
|
395
395
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
396
|
+
var DIRECTIONS = ["both", "grid", "horizontal", "vertical"];
|
|
396
397
|
function createRovingTabIndex(container, options = {}) {
|
|
397
398
|
if (!(container instanceof Element)) {
|
|
398
399
|
console.warn("Invalid container element");
|
|
@@ -602,7 +603,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
602
603
|
return (element) => !selector || [...this.#container.querySelectorAll(selector)].includes(element);
|
|
603
604
|
}
|
|
604
605
|
#getCellCoords(cell) {
|
|
605
|
-
const {
|
|
606
|
+
const { left, top, width, height } = cell.getBoundingClientRect();
|
|
606
607
|
return {
|
|
607
608
|
x: left + width / 2,
|
|
608
609
|
y: top + height / 2
|
|
@@ -682,7 +683,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
682
683
|
wrap = false
|
|
683
684
|
} = options;
|
|
684
685
|
direction = direction.toLowerCase();
|
|
685
|
-
if (!
|
|
686
|
+
if (!DIRECTIONS.includes(direction)) {
|
|
686
687
|
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
687
688
|
direction = "both";
|
|
688
689
|
}
|
|
@@ -1007,16 +1008,16 @@ var Accordion = class _Accordion {
|
|
|
1007
1008
|
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
1008
1009
|
merged.collapsible = collapsible;
|
|
1009
1010
|
}
|
|
1010
|
-
for (const [
|
|
1011
|
+
for (const [name, value] of Object.entries(defaults.selector)) {
|
|
1011
1012
|
const { selector } = merged;
|
|
1012
|
-
const
|
|
1013
|
+
const n = name;
|
|
1013
1014
|
try {
|
|
1014
|
-
document.querySelector(selector[
|
|
1015
|
+
document.querySelector(selector[n]);
|
|
1015
1016
|
} catch {
|
|
1016
1017
|
console.warn(
|
|
1017
|
-
`Invalid ${
|
|
1018
|
+
`Invalid ${n.replace(/[A-Z]/g, (c) => ` ${c.toLowerCase()}`)} selector. Fallback: '${value}'.`
|
|
1018
1019
|
);
|
|
1019
|
-
selector[
|
|
1020
|
+
selector[n] = value;
|
|
1020
1021
|
}
|
|
1021
1022
|
}
|
|
1022
1023
|
return merged;
|
|
@@ -1031,69 +1032,9 @@ var Accordion = class _Accordion {
|
|
|
1031
1032
|
}
|
|
1032
1033
|
};
|
|
1033
1034
|
function waitAnimationFinish(animation) {
|
|
1034
|
-
return ["
|
|
1035
|
+
return ["finished", "idle"].includes(animation.playState) ? Promise.resolve() : new Promise(
|
|
1035
1036
|
(resolve) => animation.addEventListener("finish", () => resolve(), { once: true })
|
|
1036
1037
|
);
|
|
1037
1038
|
}
|
|
1038
|
-
/**
|
|
1039
|
-
* Accordion
|
|
1040
|
-
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
1041
|
-
*
|
|
1042
|
-
* @version 2.1.6
|
|
1043
|
-
* @author Yusuke Kamiyamane
|
|
1044
|
-
* @license MIT
|
|
1045
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1046
|
-
* @see {@link https://github.com/y14e/accordion}
|
|
1047
|
-
*/
|
|
1048
|
-
/*! Bundled license information:
|
|
1049
|
-
|
|
1050
|
-
@y14e/attribute-utils/dist/index.js:
|
|
1051
|
-
(**
|
|
1052
|
-
* Attribute Utils
|
|
1053
|
-
*
|
|
1054
|
-
* @version 2.0.12
|
|
1055
|
-
* @author Yusuke Kamiyamane
|
|
1056
|
-
* @license MIT
|
|
1057
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1058
|
-
* @see {@link https://github.com/y14e/attribute-utils}
|
|
1059
|
-
*)
|
|
1060
|
-
|
|
1061
|
-
power-focusable/dist/index.js:
|
|
1062
|
-
(**
|
|
1063
|
-
* Power Focusable
|
|
1064
|
-
* High-precision focus management utility with full composed tree support.
|
|
1065
|
-
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
1066
|
-
*
|
|
1067
|
-
* @version 4.4.2
|
|
1068
|
-
* @author Yusuke Kamiyamane
|
|
1069
|
-
* @license MIT
|
|
1070
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1071
|
-
* @see {@link https://github.com/y14e/power-focusable}
|
|
1072
|
-
*)
|
|
1073
|
-
|
|
1074
|
-
@y14e/button/dist/index.js:
|
|
1075
|
-
(**
|
|
1076
|
-
* Button
|
|
1077
|
-
*
|
|
1078
|
-
* @version 1.0.8
|
|
1079
|
-
* @author Yusuke Kamiyamane
|
|
1080
|
-
* @license MIT
|
|
1081
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1082
|
-
* @see {@link https://github.com/y14e/button}
|
|
1083
|
-
*)
|
|
1084
|
-
|
|
1085
|
-
@y14e/roving-tabindex/dist/index.js:
|
|
1086
|
-
(**
|
|
1087
|
-
* Roving Tabindex
|
|
1088
|
-
* Lightweight roving tabindex utility with fully focus management.
|
|
1089
|
-
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1090
|
-
*
|
|
1091
|
-
* @version 3.3.1
|
|
1092
|
-
* @author Yusuke Kamiyamane
|
|
1093
|
-
* @license MIT
|
|
1094
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1095
|
-
* @see {@link https://github.com/y14e/roving-tabindex}
|
|
1096
|
-
*)
|
|
1097
|
-
*/
|
|
1098
1039
|
|
|
1099
1040
|
export { Accordion };
|
package/dist/index.cjs
CHANGED
|
@@ -285,16 +285,16 @@ var Accordion = class _Accordion {
|
|
|
285
285
|
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
286
286
|
merged.collapsible = collapsible;
|
|
287
287
|
}
|
|
288
|
-
for (const [
|
|
288
|
+
for (const [name, value] of Object.entries(defaults.selector)) {
|
|
289
289
|
const { selector } = merged;
|
|
290
|
-
const
|
|
290
|
+
const n = name;
|
|
291
291
|
try {
|
|
292
|
-
document.querySelector(selector[
|
|
292
|
+
document.querySelector(selector[n]);
|
|
293
293
|
} catch {
|
|
294
294
|
console.warn(
|
|
295
|
-
`Invalid ${
|
|
295
|
+
`Invalid ${n.replace(/[A-Z]/g, (c) => ` ${c.toLowerCase()}`)} selector. Fallback: '${value}'.`
|
|
296
296
|
);
|
|
297
|
-
selector[
|
|
297
|
+
selector[n] = value;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
return merged;
|
|
@@ -309,19 +309,9 @@ var Accordion = class _Accordion {
|
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
function waitAnimationFinish(animation) {
|
|
312
|
-
return ["
|
|
312
|
+
return ["finished", "idle"].includes(animation.playState) ? Promise.resolve() : new Promise(
|
|
313
313
|
(resolve) => animation.addEventListener("finish", () => resolve(), { once: true })
|
|
314
314
|
);
|
|
315
315
|
}
|
|
316
|
-
/**
|
|
317
|
-
* Accordion
|
|
318
|
-
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
319
|
-
*
|
|
320
|
-
* @version 2.1.6
|
|
321
|
-
* @author Yusuke Kamiyamane
|
|
322
|
-
* @license MIT
|
|
323
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
324
|
-
* @see {@link https://github.com/y14e/accordion}
|
|
325
|
-
*/
|
|
326
316
|
|
|
327
317
|
exports.Accordion = Accordion;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accordion
|
|
3
|
-
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
4
|
-
*
|
|
5
|
-
* @version 2.1.6
|
|
6
|
-
* @author Yusuke Kamiyamane
|
|
7
|
-
* @license MIT
|
|
8
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
9
|
-
* @see {@link https://github.com/y14e/accordion}
|
|
10
|
-
*/
|
|
11
1
|
interface AccordionOptions {
|
|
12
2
|
animation: {
|
|
13
3
|
duration: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accordion
|
|
3
|
-
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
4
|
-
*
|
|
5
|
-
* @version 2.1.6
|
|
6
|
-
* @author Yusuke Kamiyamane
|
|
7
|
-
* @license MIT
|
|
8
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
9
|
-
* @see {@link https://github.com/y14e/accordion}
|
|
10
|
-
*/
|
|
11
1
|
interface AccordionOptions {
|
|
12
2
|
animation: {
|
|
13
3
|
duration: number;
|
package/dist/index.js
CHANGED
|
@@ -283,16 +283,16 @@ var Accordion = class _Accordion {
|
|
|
283
283
|
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
284
284
|
merged.collapsible = collapsible;
|
|
285
285
|
}
|
|
286
|
-
for (const [
|
|
286
|
+
for (const [name, value] of Object.entries(defaults.selector)) {
|
|
287
287
|
const { selector } = merged;
|
|
288
|
-
const
|
|
288
|
+
const n = name;
|
|
289
289
|
try {
|
|
290
|
-
document.querySelector(selector[
|
|
290
|
+
document.querySelector(selector[n]);
|
|
291
291
|
} catch {
|
|
292
292
|
console.warn(
|
|
293
|
-
`Invalid ${
|
|
293
|
+
`Invalid ${n.replace(/[A-Z]/g, (c) => ` ${c.toLowerCase()}`)} selector. Fallback: '${value}'.`
|
|
294
294
|
);
|
|
295
|
-
selector[
|
|
295
|
+
selector[n] = value;
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
return merged;
|
|
@@ -307,19 +307,9 @@ var Accordion = class _Accordion {
|
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
309
|
function waitAnimationFinish(animation) {
|
|
310
|
-
return ["
|
|
310
|
+
return ["finished", "idle"].includes(animation.playState) ? Promise.resolve() : new Promise(
|
|
311
311
|
(resolve) => animation.addEventListener("finish", () => resolve(), { once: true })
|
|
312
312
|
);
|
|
313
313
|
}
|
|
314
|
-
/**
|
|
315
|
-
* Accordion
|
|
316
|
-
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
317
|
-
*
|
|
318
|
-
* @version 2.1.6
|
|
319
|
-
* @author Yusuke Kamiyamane
|
|
320
|
-
* @license MIT
|
|
321
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
322
|
-
* @see {@link https://github.com/y14e/accordion}
|
|
323
|
-
*/
|
|
324
314
|
|
|
325
315
|
export { Accordion };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/accordion",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
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.
|
|
58
|
-
"@y14e/button": "^1.0.
|
|
59
|
-
"@y14e/roving-tabindex": "^3.3.
|
|
57
|
+
"@y14e/attribute-utils": "^2.0.13",
|
|
58
|
+
"@y14e/button": "^1.0.9",
|
|
59
|
+
"@y14e/roving-tabindex": "^3.3.4"
|
|
60
60
|
}
|
|
61
61
|
}
|