@y14e/disclosure-css 2.0.3 → 2.0.5

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
@@ -13,11 +13,11 @@ npm i @y14e/disclosure-css
13
13
  import Disclosure from "@y14e/disclosure-css";
14
14
 
15
15
  // CDNs
16
- import Disclosure from "https://esm.sh/@y14e/disclosure-css@2.0.3";
16
+ import Disclosure from "https://esm.sh/@y14e/disclosure-css@2.0.5";
17
17
  // or
18
- import Disclosure from "https://cdn.jsdelivr.net/npm/@y14e/disclosure-css@2.0.3/+esm";
18
+ import Disclosure from "https://cdn.jsdelivr.net/npm/@y14e/disclosure-css@2.0.5/+esm";
19
19
  // or
20
- import Disclosure from "https://esm.unpkg.com/@y14e/disclosure-css@2.0.3";
20
+ import Disclosure from "https://esm.unpkg.com/@y14e/disclosure-css@2.0.5";
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -1,37 +1,9 @@
1
1
  'use strict';
2
2
 
3
- // node_modules/@y14e/attributes-utils/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
3
+ // node_modules/@y14e/attribute-util/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
  }
@@ -776,7 +748,7 @@ var Disclosure = class _Disclosure {
776
748
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
777
749
  * Using the <details> and <summary> element.
778
750
  *
779
- * @version 2.0.3
751
+ * @version 2.0.5
780
752
  * @author Yusuke Kamiyamane
781
753
  * @license MIT
782
754
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -784,26 +756,15 @@ var Disclosure = class _Disclosure {
784
756
  */
785
757
  /*! Bundled license information:
786
758
 
787
- @y14e/attributes-utils/dist/index.js:
788
- (**
789
- * Attributes Utils
790
- *
791
- * @version 2.0.0
792
- * @author Yusuke Kamiyamane
793
- * @license MIT
794
- * @copyright Copyright (c) Yusuke Kamiyamane
795
- * @see {@link https://github.com/y14e/attributes-utils}
796
- *)
797
-
798
- @y14e/attributes-utils/dist/index.js:
759
+ @y14e/attribute-util/dist/index.js:
799
760
  (**
800
- * Attributes Utils
761
+ * Attribute Util
801
762
  *
802
- * @version 1.1.7
763
+ * @version 2.0.1
803
764
  * @author Yusuke Kamiyamane
804
765
  * @license MIT
805
766
  * @copyright Copyright (c) Yusuke Kamiyamane
806
- * @see {@link https://github.com/y14e/attributes-utils}
767
+ * @see {@link https://github.com/y14e/attribute-util}
807
768
  *)
808
769
 
809
770
  power-focusable/dist/index.js:
@@ -812,7 +773,7 @@ power-focusable/dist/index.js:
812
773
  * High-precision focus management utility with full composed tree support.
813
774
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
814
775
  *
815
- * @version 4.3.23
776
+ * @version 4.3.25
816
777
  * @author Yusuke Kamiyamane
817
778
  * @license MIT
818
779
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -825,7 +786,7 @@ power-focusable/dist/index.js:
825
786
  * Lightweight roving tabindex utility with fully focus management.
826
787
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
827
788
  *
828
- * @version 3.1.20
789
+ * @version 3.1.22
829
790
  * @author Yusuke Kamiyamane
830
791
  * @license MIT
831
792
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1,35 +1,7 @@
1
- // node_modules/@y14e/attributes-utils/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
1
+ // node_modules/@y14e/attribute-util/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
  }
@@ -774,7 +746,7 @@ var Disclosure = class _Disclosure {
774
746
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
775
747
  * Using the <details> and <summary> element.
776
748
  *
777
- * @version 2.0.3
749
+ * @version 2.0.5
778
750
  * @author Yusuke Kamiyamane
779
751
  * @license MIT
780
752
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -782,26 +754,15 @@ var Disclosure = class _Disclosure {
782
754
  */
783
755
  /*! Bundled license information:
784
756
 
785
- @y14e/attributes-utils/dist/index.js:
786
- (**
787
- * Attributes Utils
788
- *
789
- * @version 2.0.0
790
- * @author Yusuke Kamiyamane
791
- * @license MIT
792
- * @copyright Copyright (c) Yusuke Kamiyamane
793
- * @see {@link https://github.com/y14e/attributes-utils}
794
- *)
795
-
796
- @y14e/attributes-utils/dist/index.js:
757
+ @y14e/attribute-util/dist/index.js:
797
758
  (**
798
- * Attributes Utils
759
+ * Attribute Util
799
760
  *
800
- * @version 1.1.7
761
+ * @version 2.0.1
801
762
  * @author Yusuke Kamiyamane
802
763
  * @license MIT
803
764
  * @copyright Copyright (c) Yusuke Kamiyamane
804
- * @see {@link https://github.com/y14e/attributes-utils}
765
+ * @see {@link https://github.com/y14e/attribute-util}
805
766
  *)
806
767
 
807
768
  power-focusable/dist/index.js:
@@ -810,7 +771,7 @@ power-focusable/dist/index.js:
810
771
  * High-precision focus management utility with full composed tree support.
811
772
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
812
773
  *
813
- * @version 4.3.23
774
+ * @version 4.3.25
814
775
  * @author Yusuke Kamiyamane
815
776
  * @license MIT
816
777
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -823,7 +784,7 @@ power-focusable/dist/index.js:
823
784
  * Lightweight roving tabindex utility with fully focus management.
824
785
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
825
786
  *
826
- * @version 3.1.20
787
+ * @version 3.1.22
827
788
  * @author Yusuke Kamiyamane
828
789
  * @license MIT
829
790
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -1,8 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var attributesUtils = require('@y14e/attributes-utils');
3
+ var util = require('@y14e/attribute-util');
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 util__namespace = /*#__PURE__*/_interopNamespace(util);
25
+
6
26
  // src/index.ts
7
27
  var Disclosure = class _Disclosure {
8
28
  static defaults = {};
@@ -88,7 +108,7 @@ var Disclosure = class _Disclosure {
88
108
  this.#cleanupRovingTabIndex?.();
89
109
  this.#cleanupRovingTabIndex = null;
90
110
  this.#detailsElements.length = 0;
91
- attributesUtils.restoreAttributes(this.#summaryElements);
111
+ util__namespace.restoreAttributes(this.#summaryElements);
92
112
  this.#summaryElements.length = 0;
93
113
  this.#contentElements.length = 0;
94
114
  this.#rootElement.removeAttribute("data-disclosure-initialized");
@@ -104,7 +124,7 @@ var Disclosure = class _Disclosure {
104
124
  this.#toggle(details, true);
105
125
  }
106
126
  #initialize() {
107
- attributesUtils.saveAttributes(this.#summaryElements, [
127
+ util__namespace.saveAttributes(this.#summaryElements, [
108
128
  "aria-disabled",
109
129
  "style",
110
130
  "tabindex"
@@ -164,7 +184,7 @@ var Disclosure = class _Disclosure {
164
184
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
165
185
  * Using the <details> and <summary> element.
166
186
  *
167
- * @version 2.0.3
187
+ * @version 2.0.5
168
188
  * @author Yusuke Kamiyamane
169
189
  * @license MIT
170
190
  * @copyright Copyright (c) Yusuke Kamiyamane
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.3
6
+ * @version 2.0.5
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
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.3
6
+ * @version 2.0.5
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { restoreAttributes, saveAttributes } from '@y14e/attributes-utils';
1
+ import * as util from '@y14e/attribute-util';
2
2
  import { createRovingTabIndex } from '@y14e/roving-tabindex';
3
3
 
4
4
  // src/index.ts
@@ -86,7 +86,7 @@ var Disclosure = class _Disclosure {
86
86
  this.#cleanupRovingTabIndex?.();
87
87
  this.#cleanupRovingTabIndex = null;
88
88
  this.#detailsElements.length = 0;
89
- restoreAttributes(this.#summaryElements);
89
+ util.restoreAttributes(this.#summaryElements);
90
90
  this.#summaryElements.length = 0;
91
91
  this.#contentElements.length = 0;
92
92
  this.#rootElement.removeAttribute("data-disclosure-initialized");
@@ -102,7 +102,7 @@ var Disclosure = class _Disclosure {
102
102
  this.#toggle(details, true);
103
103
  }
104
104
  #initialize() {
105
- saveAttributes(this.#summaryElements, [
105
+ util.saveAttributes(this.#summaryElements, [
106
106
  "aria-disabled",
107
107
  "style",
108
108
  "tabindex"
@@ -162,7 +162,7 @@ var Disclosure = class _Disclosure {
162
162
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
163
163
  * Using the <details> and <summary> element.
164
164
  *
165
- * @version 2.0.3
165
+ * @version 2.0.5
166
166
  * @author Yusuke Kamiyamane
167
167
  * @license MIT
168
168
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/disclosure-css",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
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/attributes-utils": "^2.0.0",
55
- "@y14e/roving-tabindex": "^3.1.20"
54
+ "@y14e/attribute-util": "^2.0.1",
55
+ "@y14e/roving-tabindex": "^3.1.22"
56
56
  }
57
57
  }