@y14e/disclosure 2.0.5 → 2.0.6
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 +17 -56
- package/dist/index.bundle.js +17 -56
- 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 +3 -3
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ npm i @y14e/disclosure
|
|
|
13
13
|
import Disclosure from "@y14e/disclosure";
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import Disclosure from "https://esm.sh/@y14e/disclosure@2.0.
|
|
16
|
+
import Disclosure from "https://esm.sh/@y14e/disclosure@2.0.6";
|
|
17
17
|
// or
|
|
18
|
-
import Disclosure from "https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.
|
|
18
|
+
import Disclosure from "https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.6/+esm";
|
|
19
19
|
// or
|
|
20
|
-
import Disclosure from "https://esm.unpkg.com/@y14e/disclosure@2.0.
|
|
20
|
+
import Disclosure from "https://esm.unpkg.com/@y14e/disclosure@2.0.6";
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -1,37 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// node_modules/@y14e/attribute-util/dist/index.js
|
|
4
|
-
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
5
|
-
function restoreAttributes(element_or_elements) {
|
|
6
|
-
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
7
|
-
const snapshot = snapshots.get(element);
|
|
8
|
-
if (!snapshot) {
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
for (const [name, value] of snapshot.entries()) {
|
|
12
|
-
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
13
|
-
}
|
|
14
|
-
snapshots.delete(element);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function saveAttributes(element_or_elements, name_or_names) {
|
|
18
|
-
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
19
|
-
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
20
|
-
let snapshot = snapshots.get(element);
|
|
21
|
-
if (!snapshot) {
|
|
22
|
-
snapshot = /* @__PURE__ */ new Map();
|
|
23
|
-
snapshots.set(element, snapshot);
|
|
24
|
-
}
|
|
25
|
-
names.forEach((name) => {
|
|
26
|
-
snapshot.set(name, element.getAttribute(name));
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// node_modules/@y14e/roving-tabindex/node_modules/@y14e/attributes-utils/dist/index.js
|
|
32
4
|
var DEFAULT_PARSER = (value) => value.split(/\s+/);
|
|
33
5
|
var DEFAULT_SERIALIZER = (tokens) => tokens.join(" ");
|
|
34
|
-
function
|
|
6
|
+
function addAttributeToken(element, name, token, options = {}) {
|
|
35
7
|
const value = element.getAttribute(name)?.trim();
|
|
36
8
|
const {
|
|
37
9
|
caseInsensitive = false,
|
|
@@ -51,26 +23,26 @@ function addTokenToAttribute(element, name, token, options = {}) {
|
|
|
51
23
|
element.setAttribute(name, serialize([...set]));
|
|
52
24
|
}
|
|
53
25
|
}
|
|
54
|
-
var
|
|
55
|
-
function
|
|
26
|
+
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
27
|
+
function restoreAttributes(element_or_elements) {
|
|
56
28
|
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
57
|
-
const snapshot =
|
|
29
|
+
const snapshot = snapshots.get(element);
|
|
58
30
|
if (!snapshot) {
|
|
59
31
|
continue;
|
|
60
32
|
}
|
|
61
33
|
for (const [name, value] of snapshot.entries()) {
|
|
62
34
|
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
63
35
|
}
|
|
64
|
-
|
|
36
|
+
snapshots.delete(element);
|
|
65
37
|
}
|
|
66
38
|
}
|
|
67
|
-
function
|
|
39
|
+
function saveAttributes(element_or_elements, name_or_names) {
|
|
68
40
|
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
69
41
|
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
70
|
-
let snapshot =
|
|
42
|
+
let snapshot = snapshots.get(element);
|
|
71
43
|
if (!snapshot) {
|
|
72
44
|
snapshot = /* @__PURE__ */ new Map();
|
|
73
|
-
|
|
45
|
+
snapshots.set(element, snapshot);
|
|
74
46
|
}
|
|
75
47
|
names.forEach((name) => {
|
|
76
48
|
snapshot.set(name, element.getAttribute(name));
|
|
@@ -438,7 +410,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
438
410
|
this.#controller = null;
|
|
439
411
|
this.#focusables.forEach((focusable) => {
|
|
440
412
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
441
|
-
|
|
413
|
+
restoreAttributes(focusable);
|
|
442
414
|
});
|
|
443
415
|
this.#focusables.clear();
|
|
444
416
|
this.#focusablesByFirstChar.clear();
|
|
@@ -543,7 +515,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
543
515
|
for (const focusable of this.#focusables) {
|
|
544
516
|
if (!current.has(focusable)) {
|
|
545
517
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
546
|
-
|
|
518
|
+
restoreAttributes(focusable);
|
|
547
519
|
this.#focusables.delete(focusable);
|
|
548
520
|
for (const [key, focusables] of this.#focusablesByFirstChar) {
|
|
549
521
|
const index = focusables.indexOf(focusable);
|
|
@@ -565,7 +537,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
565
537
|
this.#focusables.add(focusable);
|
|
566
538
|
_RovingTabIndex.#initialized.add(focusable);
|
|
567
539
|
if (!navigationOnly) {
|
|
568
|
-
|
|
540
|
+
saveAttributes(focusable, "tabindex");
|
|
569
541
|
focusable.setAttribute("tabindex", "-1");
|
|
570
542
|
}
|
|
571
543
|
if (!typeahead) {
|
|
@@ -578,8 +550,8 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
578
550
|
);
|
|
579
551
|
if (char) {
|
|
580
552
|
keys.add(char);
|
|
581
|
-
|
|
582
|
-
|
|
553
|
+
saveAttributes(focusable, "aria-keyshortcuts");
|
|
554
|
+
addAttributeToken(focusable, "aria-keyshortcuts", char, {
|
|
583
555
|
caseInsensitive: true
|
|
584
556
|
});
|
|
585
557
|
}
|
|
@@ -895,7 +867,7 @@ function waitAnimationFinish(animation) {
|
|
|
895
867
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
896
868
|
* Using the <details> and <summary> element.
|
|
897
869
|
*
|
|
898
|
-
* @version 2.0.
|
|
870
|
+
* @version 2.0.6
|
|
899
871
|
* @author Yusuke Kamiyamane
|
|
900
872
|
* @license MIT
|
|
901
873
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -907,31 +879,20 @@ function waitAnimationFinish(animation) {
|
|
|
907
879
|
(**
|
|
908
880
|
* Attribute Util
|
|
909
881
|
*
|
|
910
|
-
* @version 2.0.
|
|
882
|
+
* @version 2.0.1
|
|
911
883
|
* @author Yusuke Kamiyamane
|
|
912
884
|
* @license MIT
|
|
913
885
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
914
886
|
* @see {@link https://github.com/y14e/attribute-util}
|
|
915
887
|
*)
|
|
916
888
|
|
|
917
|
-
@y14e/attributes-utils/dist/index.js:
|
|
918
|
-
(**
|
|
919
|
-
* Attributes Utils
|
|
920
|
-
*
|
|
921
|
-
* @version 1.1.7
|
|
922
|
-
* @author Yusuke Kamiyamane
|
|
923
|
-
* @license MIT
|
|
924
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
925
|
-
* @see {@link https://github.com/y14e/attributes-utils}
|
|
926
|
-
*)
|
|
927
|
-
|
|
928
889
|
power-focusable/dist/index.js:
|
|
929
890
|
(**
|
|
930
891
|
* Power Focusable
|
|
931
892
|
* High-precision focus management utility with full composed tree support.
|
|
932
893
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
933
894
|
*
|
|
934
|
-
* @version 4.3.
|
|
895
|
+
* @version 4.3.25
|
|
935
896
|
* @author Yusuke Kamiyamane
|
|
936
897
|
* @license MIT
|
|
937
898
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -944,7 +905,7 @@ power-focusable/dist/index.js:
|
|
|
944
905
|
* Lightweight roving tabindex utility with fully focus management.
|
|
945
906
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
946
907
|
*
|
|
947
|
-
* @version 3.1.
|
|
908
|
+
* @version 3.1.22
|
|
948
909
|
* @author Yusuke Kamiyamane
|
|
949
910
|
* @license MIT
|
|
950
911
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
// node_modules/@y14e/attribute-util/dist/index.js
|
|
2
|
-
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
3
|
-
function restoreAttributes(element_or_elements) {
|
|
4
|
-
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
5
|
-
const snapshot = snapshots.get(element);
|
|
6
|
-
if (!snapshot) {
|
|
7
|
-
continue;
|
|
8
|
-
}
|
|
9
|
-
for (const [name, value] of snapshot.entries()) {
|
|
10
|
-
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
11
|
-
}
|
|
12
|
-
snapshots.delete(element);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function saveAttributes(element_or_elements, name_or_names) {
|
|
16
|
-
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
17
|
-
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
18
|
-
let snapshot = snapshots.get(element);
|
|
19
|
-
if (!snapshot) {
|
|
20
|
-
snapshot = /* @__PURE__ */ new Map();
|
|
21
|
-
snapshots.set(element, snapshot);
|
|
22
|
-
}
|
|
23
|
-
names.forEach((name) => {
|
|
24
|
-
snapshot.set(name, element.getAttribute(name));
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// node_modules/@y14e/roving-tabindex/node_modules/@y14e/attributes-utils/dist/index.js
|
|
30
2
|
var DEFAULT_PARSER = (value) => value.split(/\s+/);
|
|
31
3
|
var DEFAULT_SERIALIZER = (tokens) => tokens.join(" ");
|
|
32
|
-
function
|
|
4
|
+
function addAttributeToken(element, name, token, options = {}) {
|
|
33
5
|
const value = element.getAttribute(name)?.trim();
|
|
34
6
|
const {
|
|
35
7
|
caseInsensitive = false,
|
|
@@ -49,26 +21,26 @@ function addTokenToAttribute(element, name, token, options = {}) {
|
|
|
49
21
|
element.setAttribute(name, serialize([...set]));
|
|
50
22
|
}
|
|
51
23
|
}
|
|
52
|
-
var
|
|
53
|
-
function
|
|
24
|
+
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
25
|
+
function restoreAttributes(element_or_elements) {
|
|
54
26
|
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
55
|
-
const snapshot =
|
|
27
|
+
const snapshot = snapshots.get(element);
|
|
56
28
|
if (!snapshot) {
|
|
57
29
|
continue;
|
|
58
30
|
}
|
|
59
31
|
for (const [name, value] of snapshot.entries()) {
|
|
60
32
|
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
61
33
|
}
|
|
62
|
-
|
|
34
|
+
snapshots.delete(element);
|
|
63
35
|
}
|
|
64
36
|
}
|
|
65
|
-
function
|
|
37
|
+
function saveAttributes(element_or_elements, name_or_names) {
|
|
66
38
|
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
67
39
|
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
68
|
-
let snapshot =
|
|
40
|
+
let snapshot = snapshots.get(element);
|
|
69
41
|
if (!snapshot) {
|
|
70
42
|
snapshot = /* @__PURE__ */ new Map();
|
|
71
|
-
|
|
43
|
+
snapshots.set(element, snapshot);
|
|
72
44
|
}
|
|
73
45
|
names.forEach((name) => {
|
|
74
46
|
snapshot.set(name, element.getAttribute(name));
|
|
@@ -436,7 +408,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
436
408
|
this.#controller = null;
|
|
437
409
|
this.#focusables.forEach((focusable) => {
|
|
438
410
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
439
|
-
|
|
411
|
+
restoreAttributes(focusable);
|
|
440
412
|
});
|
|
441
413
|
this.#focusables.clear();
|
|
442
414
|
this.#focusablesByFirstChar.clear();
|
|
@@ -541,7 +513,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
541
513
|
for (const focusable of this.#focusables) {
|
|
542
514
|
if (!current.has(focusable)) {
|
|
543
515
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
544
|
-
|
|
516
|
+
restoreAttributes(focusable);
|
|
545
517
|
this.#focusables.delete(focusable);
|
|
546
518
|
for (const [key, focusables] of this.#focusablesByFirstChar) {
|
|
547
519
|
const index = focusables.indexOf(focusable);
|
|
@@ -563,7 +535,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
563
535
|
this.#focusables.add(focusable);
|
|
564
536
|
_RovingTabIndex.#initialized.add(focusable);
|
|
565
537
|
if (!navigationOnly) {
|
|
566
|
-
|
|
538
|
+
saveAttributes(focusable, "tabindex");
|
|
567
539
|
focusable.setAttribute("tabindex", "-1");
|
|
568
540
|
}
|
|
569
541
|
if (!typeahead) {
|
|
@@ -576,8 +548,8 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
576
548
|
);
|
|
577
549
|
if (char) {
|
|
578
550
|
keys.add(char);
|
|
579
|
-
|
|
580
|
-
|
|
551
|
+
saveAttributes(focusable, "aria-keyshortcuts");
|
|
552
|
+
addAttributeToken(focusable, "aria-keyshortcuts", char, {
|
|
581
553
|
caseInsensitive: true
|
|
582
554
|
});
|
|
583
555
|
}
|
|
@@ -893,7 +865,7 @@ function waitAnimationFinish(animation) {
|
|
|
893
865
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
894
866
|
* Using the <details> and <summary> element.
|
|
895
867
|
*
|
|
896
|
-
* @version 2.0.
|
|
868
|
+
* @version 2.0.6
|
|
897
869
|
* @author Yusuke Kamiyamane
|
|
898
870
|
* @license MIT
|
|
899
871
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -905,31 +877,20 @@ function waitAnimationFinish(animation) {
|
|
|
905
877
|
(**
|
|
906
878
|
* Attribute Util
|
|
907
879
|
*
|
|
908
|
-
* @version 2.0.
|
|
880
|
+
* @version 2.0.1
|
|
909
881
|
* @author Yusuke Kamiyamane
|
|
910
882
|
* @license MIT
|
|
911
883
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
912
884
|
* @see {@link https://github.com/y14e/attribute-util}
|
|
913
885
|
*)
|
|
914
886
|
|
|
915
|
-
@y14e/attributes-utils/dist/index.js:
|
|
916
|
-
(**
|
|
917
|
-
* Attributes Utils
|
|
918
|
-
*
|
|
919
|
-
* @version 1.1.7
|
|
920
|
-
* @author Yusuke Kamiyamane
|
|
921
|
-
* @license MIT
|
|
922
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
923
|
-
* @see {@link https://github.com/y14e/attributes-utils}
|
|
924
|
-
*)
|
|
925
|
-
|
|
926
887
|
power-focusable/dist/index.js:
|
|
927
888
|
(**
|
|
928
889
|
* Power Focusable
|
|
929
890
|
* High-precision focus management utility with full composed tree support.
|
|
930
891
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
931
892
|
*
|
|
932
|
-
* @version 4.3.
|
|
893
|
+
* @version 4.3.25
|
|
933
894
|
* @author Yusuke Kamiyamane
|
|
934
895
|
* @license MIT
|
|
935
896
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -942,7 +903,7 @@ power-focusable/dist/index.js:
|
|
|
942
903
|
* Lightweight roving tabindex utility with fully focus management.
|
|
943
904
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
944
905
|
*
|
|
945
|
-
* @version 3.1.
|
|
906
|
+
* @version 3.1.22
|
|
946
907
|
* @author Yusuke Kamiyamane
|
|
947
908
|
* @license MIT
|
|
948
909
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -303,7 +303,7 @@ function waitAnimationFinish(animation) {
|
|
|
303
303
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
304
304
|
* Using the <details> and <summary> element.
|
|
305
305
|
*
|
|
306
|
-
* @version 2.0.
|
|
306
|
+
* @version 2.0.6
|
|
307
307
|
* @author Yusuke Kamiyamane
|
|
308
308
|
* @license MIT
|
|
309
309
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -281,7 +281,7 @@ function waitAnimationFinish(animation) {
|
|
|
281
281
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
282
282
|
* Using the <details> and <summary> element.
|
|
283
283
|
*
|
|
284
|
-
* @version 2.0.
|
|
284
|
+
* @version 2.0.6
|
|
285
285
|
* @author Yusuke Kamiyamane
|
|
286
286
|
* @license MIT
|
|
287
287
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/disclosure",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"node": ">=18"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@y14e/attribute-util": "^2.0.
|
|
55
|
-
"@y14e/roving-tabindex": "^3.1.
|
|
54
|
+
"@y14e/attribute-util": "^2.0.1",
|
|
55
|
+
"@y14e/roving-tabindex": "^3.1.22"
|
|
56
56
|
}
|
|
57
57
|
}
|