@y14e/disclosure 2.0.5 → 2.0.7

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 CHANGED
@@ -10,14 +10,14 @@ npm i @y14e/disclosure
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import Disclosure from "@y14e/disclosure";
13
+ import { Disclosure } from "@y14e/disclosure";
14
14
 
15
15
  // CDNs
16
- import Disclosure from "https://esm.sh/@y14e/disclosure@2.0.5";
16
+ import { Disclosure } from "https://esm.sh/@y14e/disclosure@2.0.7";
17
17
  // or
18
- import Disclosure from "https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.5/+esm";
18
+ import { Disclosure } from "https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.7/+esm";
19
19
  // or
20
- import Disclosure from "https://esm.unpkg.com/@y14e/disclosure@2.0.5";
20
+ import { Disclosure } from "https://esm.unpkg.com/@y14e/disclosure@2.0.7";
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -47,7 +47,7 @@ interface DisclosureOptions {
47
47
  Override the global default settings applied to all disclosure instances.
48
48
 
49
49
  ```ts
50
- import Disclosure from "@y14e/disclosure";
50
+ import { Disclosure } from "@y14e/disclosure";
51
51
 
52
52
  Disclosure.defaults = {
53
53
  animation: {
@@ -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 addTokenToAttribute(element, name, token, options = {}) {
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 snapshots2 = /* @__PURE__ */ new WeakMap();
55
- function restoreAttributes2(element_or_elements) {
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 = snapshots2.get(element);
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
- snapshots2.delete(element);
36
+ snapshots.delete(element);
65
37
  }
66
38
  }
67
- function saveAttributes2(element_or_elements, name_or_names) {
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 = snapshots2.get(element);
42
+ let snapshot = snapshots.get(element);
71
43
  if (!snapshot) {
72
44
  snapshot = /* @__PURE__ */ new Map();
73
- snapshots2.set(element, snapshot);
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
- restoreAttributes2(focusable);
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
- restoreAttributes2(focusable);
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
- saveAttributes2(focusable, "tabindex");
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
- saveAttributes2(focusable, "aria-keyshortcuts");
582
- addTokenToAttribute(focusable, "aria-keyshortcuts", char, {
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.5
870
+ * @version 2.0.7
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.0
882
+ * @version 2.0.2
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.23
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.20
908
+ * @version 3.1.22
948
909
  * @author Yusuke Kamiyamane
949
910
  * @license MIT
950
911
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -952,4 +913,4 @@ power-focusable/dist/index.js:
952
913
  *)
953
914
  */
954
915
 
955
- module.exports = Disclosure;
916
+ exports.Disclosure = Disclosure;
@@ -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 addTokenToAttribute(element, name, token, options = {}) {
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 snapshots2 = /* @__PURE__ */ new WeakMap();
53
- function restoreAttributes2(element_or_elements) {
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 = snapshots2.get(element);
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
- snapshots2.delete(element);
34
+ snapshots.delete(element);
63
35
  }
64
36
  }
65
- function saveAttributes2(element_or_elements, name_or_names) {
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 = snapshots2.get(element);
40
+ let snapshot = snapshots.get(element);
69
41
  if (!snapshot) {
70
42
  snapshot = /* @__PURE__ */ new Map();
71
- snapshots2.set(element, snapshot);
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
- restoreAttributes2(focusable);
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
- restoreAttributes2(focusable);
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
- saveAttributes2(focusable, "tabindex");
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
- saveAttributes2(focusable, "aria-keyshortcuts");
580
- addTokenToAttribute(focusable, "aria-keyshortcuts", char, {
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.5
868
+ * @version 2.0.7
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.0
880
+ * @version 2.0.2
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.23
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.20
906
+ * @version 3.1.22
946
907
  * @author Yusuke Kamiyamane
947
908
  * @license MIT
948
909
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -950,4 +911,4 @@ power-focusable/dist/index.js:
950
911
  *)
951
912
  */
952
913
 
953
- export { Disclosure as default };
914
+ export { Disclosure };
package/dist/index.cjs CHANGED
@@ -303,11 +303,11 @@ 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.5
306
+ * @version 2.0.7
307
307
  * @author Yusuke Kamiyamane
308
308
  * @license MIT
309
309
  * @copyright Copyright (c) Yusuke Kamiyamane
310
310
  * @see {@link https://github.com/y14e/disclosure}
311
311
  */
312
312
 
313
- module.exports = Disclosure;
313
+ exports.Disclosure = Disclosure;
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
4
4
  * Using the <details> and <summary> element.
5
5
  *
6
- * @version 2.0.5
6
+ * @version 2.0.7
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -25,4 +25,4 @@ declare class Disclosure {
25
25
  expand(details: HTMLDetailsElement): void;
26
26
  }
27
27
 
28
- export { type DisclosureOptions, Disclosure as default };
28
+ export { Disclosure, type DisclosureOptions };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
4
4
  * Using the <details> and <summary> element.
5
5
  *
6
- * @version 2.0.5
6
+ * @version 2.0.7
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -25,4 +25,4 @@ declare class Disclosure {
25
25
  expand(details: HTMLDetailsElement): void;
26
26
  }
27
27
 
28
- export { type DisclosureOptions, Disclosure as default };
28
+ export { Disclosure, type DisclosureOptions };
package/dist/index.js CHANGED
@@ -281,11 +281,11 @@ 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.5
284
+ * @version 2.0.7
285
285
  * @author Yusuke Kamiyamane
286
286
  * @license MIT
287
287
  * @copyright Copyright (c) Yusuke Kamiyamane
288
288
  * @see {@link https://github.com/y14e/disclosure}
289
289
  */
290
290
 
291
- export { Disclosure as default };
291
+ export { Disclosure };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/disclosure",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -50,8 +50,11 @@
50
50
  "engines": {
51
51
  "node": ">=18"
52
52
  },
53
+ "allowScripts": {
54
+ "esbuild": true
55
+ },
53
56
  "dependencies": {
54
- "@y14e/attribute-util": "^2.0.0",
55
- "@y14e/roving-tabindex": "^3.1.20"
57
+ "@y14e/attribute-util": "^2.0.2",
58
+ "@y14e/roving-tabindex": "^3.1.22"
56
59
  }
57
60
  }