@y14e/disclosure 2.0.15 → 2.1.0
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 +35 -44
- package/dist/index.bundle.js +35 -44
- package/dist/index.cjs +5 -25
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- 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.1.0';
|
|
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.1.0/+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.1.0';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// node_modules/@y14e/attribute-utils/dist/index.js
|
|
4
|
-
var DEFAULT_PARSER = (
|
|
5
|
-
var DEFAULT_SERIALIZER = (
|
|
4
|
+
var DEFAULT_PARSER = (v) => v.split(/\s+/);
|
|
5
|
+
var DEFAULT_SERIALIZER = (t) => t.join(" ");
|
|
6
6
|
function addAttributeToken(element, name, token, options = {}) {
|
|
7
7
|
if (!isValid(element, name, token)) {
|
|
8
8
|
return;
|
|
@@ -12,7 +12,7 @@ function addAttributeToken(element, name, token, options = {}) {
|
|
|
12
12
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
13
13
|
if (caseInsensitive) {
|
|
14
14
|
const lower = token.toLowerCase();
|
|
15
|
-
if (tokens.every((
|
|
15
|
+
if (tokens.every((t) => t.toLowerCase() !== lower)) {
|
|
16
16
|
tokens.push(token);
|
|
17
17
|
element.setAttribute(name, serialize(tokens));
|
|
18
18
|
}
|
|
@@ -115,11 +115,11 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
115
115
|
skipNegativeTabIndexCheck,
|
|
116
116
|
skipVisibilityCheck
|
|
117
117
|
}) || include?.(node)) {
|
|
118
|
-
candidates
|
|
118
|
+
candidates.push(node);
|
|
119
119
|
}
|
|
120
|
-
(composed ? getComposedChildren(node) :
|
|
120
|
+
(composed ? getComposedChildren(node) : [...node.children]).map(traverse2);
|
|
121
121
|
};
|
|
122
|
-
(composed ? getComposedChildren(container) :
|
|
122
|
+
(composed ? getComposedChildren(container) : [...container.children]).map(
|
|
123
123
|
traverse2
|
|
124
124
|
);
|
|
125
125
|
} else {
|
|
@@ -207,31 +207,31 @@ function normalizeRadioGroup(elements) {
|
|
|
207
207
|
map = /* @__PURE__ */ new Map();
|
|
208
208
|
}
|
|
209
209
|
const root = element.getRootNode();
|
|
210
|
-
let
|
|
211
|
-
if (!
|
|
212
|
-
|
|
213
|
-
map.set(root,
|
|
210
|
+
let groups = map.get(root);
|
|
211
|
+
if (!groups) {
|
|
212
|
+
groups = /* @__PURE__ */ new Map();
|
|
213
|
+
map.set(root, groups);
|
|
214
214
|
}
|
|
215
|
-
let
|
|
216
|
-
if (!
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
let group = groups.get(element.form);
|
|
216
|
+
if (!group) {
|
|
217
|
+
group = /* @__PURE__ */ new Map();
|
|
218
|
+
groups.set(element.form, group);
|
|
219
219
|
}
|
|
220
|
-
let
|
|
221
|
-
if (!
|
|
222
|
-
|
|
223
|
-
|
|
220
|
+
let radios = group.get(element.name);
|
|
221
|
+
if (!radios) {
|
|
222
|
+
radios = [];
|
|
223
|
+
group.set(element.name, radios);
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
radios.push(element);
|
|
226
226
|
}
|
|
227
227
|
if (!map) {
|
|
228
228
|
return elements;
|
|
229
229
|
}
|
|
230
230
|
const placeholder = /* @__PURE__ */ new Set();
|
|
231
|
-
for (const
|
|
232
|
-
for (const
|
|
233
|
-
for (const
|
|
234
|
-
const radio =
|
|
231
|
+
for (const groups of map.values()) {
|
|
232
|
+
for (const group of groups.values()) {
|
|
233
|
+
for (const radios of group.values()) {
|
|
234
|
+
const radio = radios.find((r) => r.checked) ?? radios[0];
|
|
235
235
|
radio && placeholder.add(radio);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
@@ -253,7 +253,7 @@ function sortByTabIndex(elements) {
|
|
|
253
253
|
}
|
|
254
254
|
function getComposedChildren(node) {
|
|
255
255
|
if (node instanceof ShadowRoot) {
|
|
256
|
-
return
|
|
256
|
+
return [...node.children];
|
|
257
257
|
}
|
|
258
258
|
if (!(node instanceof Element)) {
|
|
259
259
|
return [];
|
|
@@ -265,9 +265,9 @@ function getComposedChildren(node) {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
if (node instanceof HTMLElement && node.shadowRoot?.mode === "open") {
|
|
268
|
-
return
|
|
268
|
+
return [...node.shadowRoot.children];
|
|
269
269
|
}
|
|
270
|
-
return
|
|
270
|
+
return [...node.children];
|
|
271
271
|
}
|
|
272
272
|
function focusElement(element) {
|
|
273
273
|
"focus" in element && typeof element.focus === "function" && element.focus();
|
|
@@ -279,13 +279,6 @@ function getActiveElement() {
|
|
|
279
279
|
}
|
|
280
280
|
return current;
|
|
281
281
|
}
|
|
282
|
-
function getChildren(node) {
|
|
283
|
-
const elements = [];
|
|
284
|
-
for (let child = node.firstElementChild; child; child = child.nextElementSibling) {
|
|
285
|
-
elements[elements.length] = child;
|
|
286
|
-
}
|
|
287
|
-
return elements;
|
|
288
|
-
}
|
|
289
282
|
function getTabIndex(element) {
|
|
290
283
|
return "tabIndex" in element ? Number(element.tabIndex) : 0;
|
|
291
284
|
}
|
|
@@ -443,7 +436,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
443
436
|
}
|
|
444
437
|
}
|
|
445
438
|
const candidates = this.#getFocusables().filter(
|
|
446
|
-
(
|
|
439
|
+
(f) => this.#focusables.has(f)
|
|
447
440
|
);
|
|
448
441
|
const active = getActiveElement();
|
|
449
442
|
if (!(active instanceof Element)) {
|
|
@@ -480,11 +473,9 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
480
473
|
const focusablesByFirstChar = new Set(
|
|
481
474
|
this.#focusablesByFirstChar.get(key.toUpperCase()) ?? []
|
|
482
475
|
);
|
|
483
|
-
focusables = candidates.filter(
|
|
484
|
-
(candidate) => focusablesByFirstChar.has(candidate)
|
|
485
|
-
);
|
|
476
|
+
focusables = candidates.filter((c) => focusablesByFirstChar.has(c));
|
|
486
477
|
const afterIndex = focusables.findIndex(
|
|
487
|
-
(
|
|
478
|
+
(f) => candidates.indexOf(f) > activeIndex
|
|
488
479
|
);
|
|
489
480
|
newIndex = afterIndex >= 0 ? afterIndex : 0;
|
|
490
481
|
}
|
|
@@ -528,7 +519,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
528
519
|
const char = focusable.textContent?.trim()?.at(0)?.toUpperCase();
|
|
529
520
|
const value = focusable.ariaKeyShortcuts?.trim();
|
|
530
521
|
const keys = new Set(
|
|
531
|
-
value ? value.split(/\s+/).filter((
|
|
522
|
+
value ? value.split(/\s+/).filter((k) => /^\S$/i.test(k)).map((k) => k.toUpperCase()) : []
|
|
532
523
|
);
|
|
533
524
|
if (char) {
|
|
534
525
|
keys.add(char);
|
|
@@ -819,7 +810,7 @@ var Disclosure = class _Disclosure {
|
|
|
819
810
|
return;
|
|
820
811
|
}
|
|
821
812
|
if (!isExpand && !isProgrammatic && !this.#settings.collapsible && this.#detailsElements.filter(
|
|
822
|
-
(
|
|
813
|
+
(d) => d.hasAttribute("data-disclosure-open")
|
|
823
814
|
).length <= 1) {
|
|
824
815
|
return;
|
|
825
816
|
}
|
|
@@ -926,7 +917,7 @@ function waitAnimationFinish(animation) {
|
|
|
926
917
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
927
918
|
* Using the <details> and <summary> element.
|
|
928
919
|
*
|
|
929
|
-
* @version 2.0
|
|
920
|
+
* @version 2.1.0
|
|
930
921
|
* @author Yusuke Kamiyamane
|
|
931
922
|
* @license MIT
|
|
932
923
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -938,7 +929,7 @@ function waitAnimationFinish(animation) {
|
|
|
938
929
|
(**
|
|
939
930
|
* Attribute Utils
|
|
940
931
|
*
|
|
941
|
-
* @version 2.0.
|
|
932
|
+
* @version 2.0.12
|
|
942
933
|
* @author Yusuke Kamiyamane
|
|
943
934
|
* @license MIT
|
|
944
935
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -951,7 +942,7 @@ power-focusable/dist/index.js:
|
|
|
951
942
|
* High-precision focus management utility with full composed tree support.
|
|
952
943
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
953
944
|
*
|
|
954
|
-
* @version 4.3.
|
|
945
|
+
* @version 4.3.33
|
|
955
946
|
* @author Yusuke Kamiyamane
|
|
956
947
|
* @license MIT
|
|
957
948
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -964,7 +955,7 @@ power-focusable/dist/index.js:
|
|
|
964
955
|
* Lightweight roving tabindex utility with fully focus management.
|
|
965
956
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
966
957
|
*
|
|
967
|
-
* @version 3.1.
|
|
958
|
+
* @version 3.1.31
|
|
968
959
|
* @author Yusuke Kamiyamane
|
|
969
960
|
* @license MIT
|
|
970
961
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// node_modules/@y14e/attribute-utils/dist/index.js
|
|
2
|
-
var DEFAULT_PARSER = (
|
|
3
|
-
var DEFAULT_SERIALIZER = (
|
|
2
|
+
var DEFAULT_PARSER = (v) => v.split(/\s+/);
|
|
3
|
+
var DEFAULT_SERIALIZER = (t) => t.join(" ");
|
|
4
4
|
function addAttributeToken(element, name, token, options = {}) {
|
|
5
5
|
if (!isValid(element, name, token)) {
|
|
6
6
|
return;
|
|
@@ -10,7 +10,7 @@ function addAttributeToken(element, name, token, options = {}) {
|
|
|
10
10
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
11
11
|
if (caseInsensitive) {
|
|
12
12
|
const lower = token.toLowerCase();
|
|
13
|
-
if (tokens.every((
|
|
13
|
+
if (tokens.every((t) => t.toLowerCase() !== lower)) {
|
|
14
14
|
tokens.push(token);
|
|
15
15
|
element.setAttribute(name, serialize(tokens));
|
|
16
16
|
}
|
|
@@ -113,11 +113,11 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
113
113
|
skipNegativeTabIndexCheck,
|
|
114
114
|
skipVisibilityCheck
|
|
115
115
|
}) || include?.(node)) {
|
|
116
|
-
candidates
|
|
116
|
+
candidates.push(node);
|
|
117
117
|
}
|
|
118
|
-
(composed ? getComposedChildren(node) :
|
|
118
|
+
(composed ? getComposedChildren(node) : [...node.children]).map(traverse2);
|
|
119
119
|
};
|
|
120
|
-
(composed ? getComposedChildren(container) :
|
|
120
|
+
(composed ? getComposedChildren(container) : [...container.children]).map(
|
|
121
121
|
traverse2
|
|
122
122
|
);
|
|
123
123
|
} else {
|
|
@@ -205,31 +205,31 @@ function normalizeRadioGroup(elements) {
|
|
|
205
205
|
map = /* @__PURE__ */ new Map();
|
|
206
206
|
}
|
|
207
207
|
const root = element.getRootNode();
|
|
208
|
-
let
|
|
209
|
-
if (!
|
|
210
|
-
|
|
211
|
-
map.set(root,
|
|
208
|
+
let groups = map.get(root);
|
|
209
|
+
if (!groups) {
|
|
210
|
+
groups = /* @__PURE__ */ new Map();
|
|
211
|
+
map.set(root, groups);
|
|
212
212
|
}
|
|
213
|
-
let
|
|
214
|
-
if (!
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
let group = groups.get(element.form);
|
|
214
|
+
if (!group) {
|
|
215
|
+
group = /* @__PURE__ */ new Map();
|
|
216
|
+
groups.set(element.form, group);
|
|
217
217
|
}
|
|
218
|
-
let
|
|
219
|
-
if (!
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
let radios = group.get(element.name);
|
|
219
|
+
if (!radios) {
|
|
220
|
+
radios = [];
|
|
221
|
+
group.set(element.name, radios);
|
|
222
222
|
}
|
|
223
|
-
|
|
223
|
+
radios.push(element);
|
|
224
224
|
}
|
|
225
225
|
if (!map) {
|
|
226
226
|
return elements;
|
|
227
227
|
}
|
|
228
228
|
const placeholder = /* @__PURE__ */ new Set();
|
|
229
|
-
for (const
|
|
230
|
-
for (const
|
|
231
|
-
for (const
|
|
232
|
-
const radio =
|
|
229
|
+
for (const groups of map.values()) {
|
|
230
|
+
for (const group of groups.values()) {
|
|
231
|
+
for (const radios of group.values()) {
|
|
232
|
+
const radio = radios.find((r) => r.checked) ?? radios[0];
|
|
233
233
|
radio && placeholder.add(radio);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
@@ -251,7 +251,7 @@ function sortByTabIndex(elements) {
|
|
|
251
251
|
}
|
|
252
252
|
function getComposedChildren(node) {
|
|
253
253
|
if (node instanceof ShadowRoot) {
|
|
254
|
-
return
|
|
254
|
+
return [...node.children];
|
|
255
255
|
}
|
|
256
256
|
if (!(node instanceof Element)) {
|
|
257
257
|
return [];
|
|
@@ -263,9 +263,9 @@ function getComposedChildren(node) {
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
if (node instanceof HTMLElement && node.shadowRoot?.mode === "open") {
|
|
266
|
-
return
|
|
266
|
+
return [...node.shadowRoot.children];
|
|
267
267
|
}
|
|
268
|
-
return
|
|
268
|
+
return [...node.children];
|
|
269
269
|
}
|
|
270
270
|
function focusElement(element) {
|
|
271
271
|
"focus" in element && typeof element.focus === "function" && element.focus();
|
|
@@ -277,13 +277,6 @@ function getActiveElement() {
|
|
|
277
277
|
}
|
|
278
278
|
return current;
|
|
279
279
|
}
|
|
280
|
-
function getChildren(node) {
|
|
281
|
-
const elements = [];
|
|
282
|
-
for (let child = node.firstElementChild; child; child = child.nextElementSibling) {
|
|
283
|
-
elements[elements.length] = child;
|
|
284
|
-
}
|
|
285
|
-
return elements;
|
|
286
|
-
}
|
|
287
280
|
function getTabIndex(element) {
|
|
288
281
|
return "tabIndex" in element ? Number(element.tabIndex) : 0;
|
|
289
282
|
}
|
|
@@ -441,7 +434,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
441
434
|
}
|
|
442
435
|
}
|
|
443
436
|
const candidates = this.#getFocusables().filter(
|
|
444
|
-
(
|
|
437
|
+
(f) => this.#focusables.has(f)
|
|
445
438
|
);
|
|
446
439
|
const active = getActiveElement();
|
|
447
440
|
if (!(active instanceof Element)) {
|
|
@@ -478,11 +471,9 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
478
471
|
const focusablesByFirstChar = new Set(
|
|
479
472
|
this.#focusablesByFirstChar.get(key.toUpperCase()) ?? []
|
|
480
473
|
);
|
|
481
|
-
focusables = candidates.filter(
|
|
482
|
-
(candidate) => focusablesByFirstChar.has(candidate)
|
|
483
|
-
);
|
|
474
|
+
focusables = candidates.filter((c) => focusablesByFirstChar.has(c));
|
|
484
475
|
const afterIndex = focusables.findIndex(
|
|
485
|
-
(
|
|
476
|
+
(f) => candidates.indexOf(f) > activeIndex
|
|
486
477
|
);
|
|
487
478
|
newIndex = afterIndex >= 0 ? afterIndex : 0;
|
|
488
479
|
}
|
|
@@ -526,7 +517,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
526
517
|
const char = focusable.textContent?.trim()?.at(0)?.toUpperCase();
|
|
527
518
|
const value = focusable.ariaKeyShortcuts?.trim();
|
|
528
519
|
const keys = new Set(
|
|
529
|
-
value ? value.split(/\s+/).filter((
|
|
520
|
+
value ? value.split(/\s+/).filter((k) => /^\S$/i.test(k)).map((k) => k.toUpperCase()) : []
|
|
530
521
|
);
|
|
531
522
|
if (char) {
|
|
532
523
|
keys.add(char);
|
|
@@ -817,7 +808,7 @@ var Disclosure = class _Disclosure {
|
|
|
817
808
|
return;
|
|
818
809
|
}
|
|
819
810
|
if (!isExpand && !isProgrammatic && !this.#settings.collapsible && this.#detailsElements.filter(
|
|
820
|
-
(
|
|
811
|
+
(d) => d.hasAttribute("data-disclosure-open")
|
|
821
812
|
).length <= 1) {
|
|
822
813
|
return;
|
|
823
814
|
}
|
|
@@ -924,7 +915,7 @@ function waitAnimationFinish(animation) {
|
|
|
924
915
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
925
916
|
* Using the <details> and <summary> element.
|
|
926
917
|
*
|
|
927
|
-
* @version 2.0
|
|
918
|
+
* @version 2.1.0
|
|
928
919
|
* @author Yusuke Kamiyamane
|
|
929
920
|
* @license MIT
|
|
930
921
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -936,7 +927,7 @@ function waitAnimationFinish(animation) {
|
|
|
936
927
|
(**
|
|
937
928
|
* Attribute Utils
|
|
938
929
|
*
|
|
939
|
-
* @version 2.0.
|
|
930
|
+
* @version 2.0.12
|
|
940
931
|
* @author Yusuke Kamiyamane
|
|
941
932
|
* @license MIT
|
|
942
933
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -949,7 +940,7 @@ power-focusable/dist/index.js:
|
|
|
949
940
|
* High-precision focus management utility with full composed tree support.
|
|
950
941
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
951
942
|
*
|
|
952
|
-
* @version 4.3.
|
|
943
|
+
* @version 4.3.33
|
|
953
944
|
* @author Yusuke Kamiyamane
|
|
954
945
|
* @license MIT
|
|
955
946
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -962,7 +953,7 @@ power-focusable/dist/index.js:
|
|
|
962
953
|
* Lightweight roving tabindex utility with fully focus management.
|
|
963
954
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
964
955
|
*
|
|
965
|
-
* @version 3.1.
|
|
956
|
+
* @version 3.1.31
|
|
966
957
|
* @author Yusuke Kamiyamane
|
|
967
958
|
* @license MIT
|
|
968
959
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var attributeUtils = require('@y14e/attribute-utils');
|
|
4
4
|
var rovingTabindex = require('@y14e/roving-tabindex');
|
|
5
5
|
|
|
6
|
-
function _interopNamespace(e) {
|
|
7
|
-
if (e && e.__esModule) return e;
|
|
8
|
-
var n = Object.create(null);
|
|
9
|
-
if (e) {
|
|
10
|
-
Object.keys(e).forEach(function (k) {
|
|
11
|
-
if (k !== 'default') {
|
|
12
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return e[k]; }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
n.default = e;
|
|
21
|
-
return Object.freeze(n);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var utils__namespace = /*#__PURE__*/_interopNamespace(utils);
|
|
25
|
-
|
|
26
6
|
// src/index.ts
|
|
27
7
|
var Disclosure = class _Disclosure {
|
|
28
8
|
static defaults = {};
|
|
@@ -133,7 +113,7 @@ var Disclosure = class _Disclosure {
|
|
|
133
113
|
}
|
|
134
114
|
}
|
|
135
115
|
this.#detailsElements.length = 0;
|
|
136
|
-
|
|
116
|
+
attributeUtils.restoreAttributes(this.#summaryElements);
|
|
137
117
|
this.#summaryElements.length = 0;
|
|
138
118
|
this.#contentElements.length = 0;
|
|
139
119
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
@@ -149,7 +129,7 @@ var Disclosure = class _Disclosure {
|
|
|
149
129
|
this.#toggle(details, true);
|
|
150
130
|
}
|
|
151
131
|
#initialize() {
|
|
152
|
-
|
|
132
|
+
attributeUtils.saveAttributes(this.#summaryElements, [
|
|
153
133
|
"aria-disabled",
|
|
154
134
|
"style",
|
|
155
135
|
"tabindex"
|
|
@@ -220,7 +200,7 @@ var Disclosure = class _Disclosure {
|
|
|
220
200
|
return;
|
|
221
201
|
}
|
|
222
202
|
if (!isExpand && !isProgrammatic && !this.#settings.collapsible && this.#detailsElements.filter(
|
|
223
|
-
(
|
|
203
|
+
(d) => d.hasAttribute("data-disclosure-open")
|
|
224
204
|
).length <= 1) {
|
|
225
205
|
return;
|
|
226
206
|
}
|
|
@@ -327,7 +307,7 @@ function waitAnimationFinish(animation) {
|
|
|
327
307
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
328
308
|
* Using the <details> and <summary> element.
|
|
329
309
|
*
|
|
330
|
-
* @version 2.0
|
|
310
|
+
* @version 2.1.0
|
|
331
311
|
* @author Yusuke Kamiyamane
|
|
332
312
|
* @license MIT
|
|
333
313
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { restoreAttributes, saveAttributes } from '@y14e/attribute-utils';
|
|
2
2
|
import { createRovingTabIndex } from '@y14e/roving-tabindex';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
@@ -111,7 +111,7 @@ var Disclosure = class _Disclosure {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
this.#detailsElements.length = 0;
|
|
114
|
-
|
|
114
|
+
restoreAttributes(this.#summaryElements);
|
|
115
115
|
this.#summaryElements.length = 0;
|
|
116
116
|
this.#contentElements.length = 0;
|
|
117
117
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
@@ -127,7 +127,7 @@ var Disclosure = class _Disclosure {
|
|
|
127
127
|
this.#toggle(details, true);
|
|
128
128
|
}
|
|
129
129
|
#initialize() {
|
|
130
|
-
|
|
130
|
+
saveAttributes(this.#summaryElements, [
|
|
131
131
|
"aria-disabled",
|
|
132
132
|
"style",
|
|
133
133
|
"tabindex"
|
|
@@ -198,7 +198,7 @@ var Disclosure = class _Disclosure {
|
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
200
|
if (!isExpand && !isProgrammatic && !this.#settings.collapsible && this.#detailsElements.filter(
|
|
201
|
-
(
|
|
201
|
+
(d) => d.hasAttribute("data-disclosure-open")
|
|
202
202
|
).length <= 1) {
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
@@ -305,7 +305,7 @@ function waitAnimationFinish(animation) {
|
|
|
305
305
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
306
306
|
* Using the <details> and <summary> element.
|
|
307
307
|
*
|
|
308
|
-
* @version 2.0
|
|
308
|
+
* @version 2.1.0
|
|
309
309
|
* @author Yusuke Kamiyamane
|
|
310
310
|
* @license MIT
|
|
311
311
|
* @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.1.0",
|
|
4
4
|
"description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"a11y",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"esbuild": true
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@y14e/attribute-utils": "^2.0.
|
|
58
|
-
"@y14e/roving-tabindex": "^3.1.
|
|
57
|
+
"@y14e/attribute-utils": "^2.0.12",
|
|
58
|
+
"@y14e/roving-tabindex": "^3.1.31"
|
|
59
59
|
}
|
|
60
60
|
}
|