@y14e/accordion 2.0.8 → 2.0.9
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 +7 -68
- package/dist/index.bundle.js +7 -68
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
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.0.
|
|
16
|
+
import { Accordion } from "https://esm.sh/@y14e/accordion@2.0.9";
|
|
17
17
|
// or
|
|
18
|
-
import { Accordion } from "https://cdn.jsdelivr.net/npm/@y14e/accordion@2.0.
|
|
18
|
+
import { Accordion } from "https://cdn.jsdelivr.net/npm/@y14e/accordion@2.0.9/+esm";
|
|
19
19
|
// or
|
|
20
|
-
import { Accordion } from "https://esm.unpkg.com/@y14e/accordion@2.0.
|
|
20
|
+
import { Accordion } from "https://esm.unpkg.com/@y14e/accordion@2.0.9";
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -368,56 +368,6 @@ var Button = class {
|
|
|
368
368
|
};
|
|
369
369
|
};
|
|
370
370
|
|
|
371
|
-
// node_modules/@y14e/attribute-util/dist/index.js
|
|
372
|
-
var DEFAULT_PARSER2 = (value) => value.split(/\s+/);
|
|
373
|
-
var DEFAULT_SERIALIZER2 = (tokens) => tokens.join(" ");
|
|
374
|
-
function addAttributeToken2(element, name, token, options = {}) {
|
|
375
|
-
const value = element.getAttribute(name)?.trim();
|
|
376
|
-
const {
|
|
377
|
-
caseInsensitive = false,
|
|
378
|
-
parse = DEFAULT_PARSER2,
|
|
379
|
-
serialize = DEFAULT_SERIALIZER2
|
|
380
|
-
} = options;
|
|
381
|
-
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
382
|
-
if (caseInsensitive) {
|
|
383
|
-
const lower = token.toLowerCase();
|
|
384
|
-
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
385
|
-
tokens.push(token);
|
|
386
|
-
element.setAttribute(name, serialize(tokens));
|
|
387
|
-
}
|
|
388
|
-
} else {
|
|
389
|
-
const set = new Set(tokens);
|
|
390
|
-
set.add(token);
|
|
391
|
-
element.setAttribute(name, serialize([...set]));
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
var snapshots2 = /* @__PURE__ */ new WeakMap();
|
|
395
|
-
function restoreAttributes2(element_or_elements) {
|
|
396
|
-
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
397
|
-
const snapshot = snapshots2.get(element);
|
|
398
|
-
if (!snapshot) {
|
|
399
|
-
continue;
|
|
400
|
-
}
|
|
401
|
-
for (const [name, value] of snapshot.entries()) {
|
|
402
|
-
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
403
|
-
}
|
|
404
|
-
snapshots2.delete(element);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
function saveAttributes2(element_or_elements, name_or_names) {
|
|
408
|
-
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
409
|
-
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
410
|
-
let snapshot = snapshots2.get(element);
|
|
411
|
-
if (!snapshot) {
|
|
412
|
-
snapshot = /* @__PURE__ */ new Map();
|
|
413
|
-
snapshots2.set(element, snapshot);
|
|
414
|
-
}
|
|
415
|
-
names.forEach((name) => {
|
|
416
|
-
snapshot.set(name, element.getAttribute(name));
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
|
|
421
371
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
422
372
|
function createRovingTabIndex(container, options = {}) {
|
|
423
373
|
if (!(container instanceof Element)) {
|
|
@@ -509,7 +459,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
509
459
|
this.#controller = null;
|
|
510
460
|
this.#focusables.forEach((focusable) => {
|
|
511
461
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
512
|
-
|
|
462
|
+
restoreAttributes(focusable);
|
|
513
463
|
});
|
|
514
464
|
this.#focusables.clear();
|
|
515
465
|
this.#focusablesByFirstChar.clear();
|
|
@@ -614,7 +564,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
614
564
|
for (const focusable of this.#focusables) {
|
|
615
565
|
if (!current.has(focusable)) {
|
|
616
566
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
617
|
-
|
|
567
|
+
restoreAttributes(focusable);
|
|
618
568
|
this.#focusables.delete(focusable);
|
|
619
569
|
for (const [key, focusables] of this.#focusablesByFirstChar) {
|
|
620
570
|
const index = focusables.indexOf(focusable);
|
|
@@ -636,7 +586,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
636
586
|
this.#focusables.add(focusable);
|
|
637
587
|
_RovingTabIndex.#initialized.add(focusable);
|
|
638
588
|
if (!navigationOnly) {
|
|
639
|
-
|
|
589
|
+
saveAttributes(focusable, "tabindex");
|
|
640
590
|
focusable.setAttribute("tabindex", "-1");
|
|
641
591
|
}
|
|
642
592
|
if (!typeahead) {
|
|
@@ -649,8 +599,8 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
649
599
|
);
|
|
650
600
|
if (char) {
|
|
651
601
|
keys.add(char);
|
|
652
|
-
|
|
653
|
-
|
|
602
|
+
saveAttributes(focusable, "aria-keyshortcuts");
|
|
603
|
+
addAttributeToken(focusable, "aria-keyshortcuts", char, {
|
|
654
604
|
caseInsensitive: true
|
|
655
605
|
});
|
|
656
606
|
}
|
|
@@ -967,7 +917,7 @@ function waitAnimationFinish(animation) {
|
|
|
967
917
|
* Accordion
|
|
968
918
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
969
919
|
*
|
|
970
|
-
* @version 2.0.
|
|
920
|
+
* @version 2.0.9
|
|
971
921
|
* @author Yusuke Kamiyamane
|
|
972
922
|
* @license MIT
|
|
973
923
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1010,24 +960,13 @@ power-focusable/dist/index.js:
|
|
|
1010
960
|
* @see {@link https://github.com/y14e/button}
|
|
1011
961
|
*)
|
|
1012
962
|
|
|
1013
|
-
@y14e/attribute-util/dist/index.js:
|
|
1014
|
-
(**
|
|
1015
|
-
* Attribute Util
|
|
1016
|
-
*
|
|
1017
|
-
* @version 2.0.3
|
|
1018
|
-
* @author Yusuke Kamiyamane
|
|
1019
|
-
* @license MIT
|
|
1020
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1021
|
-
* @see {@link https://github.com/y14e/attribute-util}
|
|
1022
|
-
*)
|
|
1023
|
-
|
|
1024
963
|
@y14e/roving-tabindex/dist/index.js:
|
|
1025
964
|
(**
|
|
1026
965
|
* Roving Tabindex
|
|
1027
966
|
* Lightweight roving tabindex utility with fully focus management.
|
|
1028
967
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1029
968
|
*
|
|
1030
|
-
* @version 3.1.
|
|
969
|
+
* @version 3.1.23
|
|
1031
970
|
* @author Yusuke Kamiyamane
|
|
1032
971
|
* @license MIT
|
|
1033
972
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -366,56 +366,6 @@ var Button = class {
|
|
|
366
366
|
};
|
|
367
367
|
};
|
|
368
368
|
|
|
369
|
-
// node_modules/@y14e/attribute-util/dist/index.js
|
|
370
|
-
var DEFAULT_PARSER2 = (value) => value.split(/\s+/);
|
|
371
|
-
var DEFAULT_SERIALIZER2 = (tokens) => tokens.join(" ");
|
|
372
|
-
function addAttributeToken2(element, name, token, options = {}) {
|
|
373
|
-
const value = element.getAttribute(name)?.trim();
|
|
374
|
-
const {
|
|
375
|
-
caseInsensitive = false,
|
|
376
|
-
parse = DEFAULT_PARSER2,
|
|
377
|
-
serialize = DEFAULT_SERIALIZER2
|
|
378
|
-
} = options;
|
|
379
|
-
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
380
|
-
if (caseInsensitive) {
|
|
381
|
-
const lower = token.toLowerCase();
|
|
382
|
-
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
383
|
-
tokens.push(token);
|
|
384
|
-
element.setAttribute(name, serialize(tokens));
|
|
385
|
-
}
|
|
386
|
-
} else {
|
|
387
|
-
const set = new Set(tokens);
|
|
388
|
-
set.add(token);
|
|
389
|
-
element.setAttribute(name, serialize([...set]));
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
var snapshots2 = /* @__PURE__ */ new WeakMap();
|
|
393
|
-
function restoreAttributes2(element_or_elements) {
|
|
394
|
-
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
395
|
-
const snapshot = snapshots2.get(element);
|
|
396
|
-
if (!snapshot) {
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
for (const [name, value] of snapshot.entries()) {
|
|
400
|
-
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
401
|
-
}
|
|
402
|
-
snapshots2.delete(element);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function saveAttributes2(element_or_elements, name_or_names) {
|
|
406
|
-
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
407
|
-
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
408
|
-
let snapshot = snapshots2.get(element);
|
|
409
|
-
if (!snapshot) {
|
|
410
|
-
snapshot = /* @__PURE__ */ new Map();
|
|
411
|
-
snapshots2.set(element, snapshot);
|
|
412
|
-
}
|
|
413
|
-
names.forEach((name) => {
|
|
414
|
-
snapshot.set(name, element.getAttribute(name));
|
|
415
|
-
});
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
|
|
419
369
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
420
370
|
function createRovingTabIndex(container, options = {}) {
|
|
421
371
|
if (!(container instanceof Element)) {
|
|
@@ -507,7 +457,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
507
457
|
this.#controller = null;
|
|
508
458
|
this.#focusables.forEach((focusable) => {
|
|
509
459
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
510
|
-
|
|
460
|
+
restoreAttributes(focusable);
|
|
511
461
|
});
|
|
512
462
|
this.#focusables.clear();
|
|
513
463
|
this.#focusablesByFirstChar.clear();
|
|
@@ -612,7 +562,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
612
562
|
for (const focusable of this.#focusables) {
|
|
613
563
|
if (!current.has(focusable)) {
|
|
614
564
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
615
|
-
|
|
565
|
+
restoreAttributes(focusable);
|
|
616
566
|
this.#focusables.delete(focusable);
|
|
617
567
|
for (const [key, focusables] of this.#focusablesByFirstChar) {
|
|
618
568
|
const index = focusables.indexOf(focusable);
|
|
@@ -634,7 +584,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
634
584
|
this.#focusables.add(focusable);
|
|
635
585
|
_RovingTabIndex.#initialized.add(focusable);
|
|
636
586
|
if (!navigationOnly) {
|
|
637
|
-
|
|
587
|
+
saveAttributes(focusable, "tabindex");
|
|
638
588
|
focusable.setAttribute("tabindex", "-1");
|
|
639
589
|
}
|
|
640
590
|
if (!typeahead) {
|
|
@@ -647,8 +597,8 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
647
597
|
);
|
|
648
598
|
if (char) {
|
|
649
599
|
keys.add(char);
|
|
650
|
-
|
|
651
|
-
|
|
600
|
+
saveAttributes(focusable, "aria-keyshortcuts");
|
|
601
|
+
addAttributeToken(focusable, "aria-keyshortcuts", char, {
|
|
652
602
|
caseInsensitive: true
|
|
653
603
|
});
|
|
654
604
|
}
|
|
@@ -965,7 +915,7 @@ function waitAnimationFinish(animation) {
|
|
|
965
915
|
* Accordion
|
|
966
916
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
967
917
|
*
|
|
968
|
-
* @version 2.0.
|
|
918
|
+
* @version 2.0.9
|
|
969
919
|
* @author Yusuke Kamiyamane
|
|
970
920
|
* @license MIT
|
|
971
921
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1008,24 +958,13 @@ power-focusable/dist/index.js:
|
|
|
1008
958
|
* @see {@link https://github.com/y14e/button}
|
|
1009
959
|
*)
|
|
1010
960
|
|
|
1011
|
-
@y14e/attribute-util/dist/index.js:
|
|
1012
|
-
(**
|
|
1013
|
-
* Attribute Util
|
|
1014
|
-
*
|
|
1015
|
-
* @version 2.0.3
|
|
1016
|
-
* @author Yusuke Kamiyamane
|
|
1017
|
-
* @license MIT
|
|
1018
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1019
|
-
* @see {@link https://github.com/y14e/attribute-util}
|
|
1020
|
-
*)
|
|
1021
|
-
|
|
1022
961
|
@y14e/roving-tabindex/dist/index.js:
|
|
1023
962
|
(**
|
|
1024
963
|
* Roving Tabindex
|
|
1025
964
|
* Lightweight roving tabindex utility with fully focus management.
|
|
1026
965
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1027
966
|
*
|
|
1028
|
-
* @version 3.1.
|
|
967
|
+
* @version 3.1.23
|
|
1029
968
|
* @author Yusuke Kamiyamane
|
|
1030
969
|
* @license MIT
|
|
1031
970
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -305,7 +305,7 @@ function waitAnimationFinish(animation) {
|
|
|
305
305
|
* Accordion
|
|
306
306
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
307
307
|
*
|
|
308
|
-
* @version 2.0.
|
|
308
|
+
* @version 2.0.9
|
|
309
309
|
* @author Yusuke Kamiyamane
|
|
310
310
|
* @license MIT
|
|
311
311
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -283,7 +283,7 @@ function waitAnimationFinish(animation) {
|
|
|
283
283
|
* Accordion
|
|
284
284
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
285
285
|
*
|
|
286
|
-
* @version 2.0.
|
|
286
|
+
* @version 2.0.9
|
|
287
287
|
* @author Yusuke Kamiyamane
|
|
288
288
|
* @license MIT
|
|
289
289
|
* @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.9",
|
|
4
4
|
"description": "WAI-ARIA compliant accordion pattern implementation in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@y14e/attribute-utils": "^2.0.5",
|
|
58
58
|
"@y14e/button": "^1.0.8",
|
|
59
|
-
"@y14e/roving-tabindex": "^3.1.
|
|
59
|
+
"@y14e/roving-tabindex": "^3.1.23"
|
|
60
60
|
}
|
|
61
61
|
}
|