@y14e/disclosure 1.3.5 → 1.3.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@1.3.5';
13
+ import Disclosure from '@y14e/disclosure@1.3.7';
14
14
 
15
15
  // CDNs
16
- import Disclosure from 'https://esm.sh/@y14e/disclosure@1.3.5';
16
+ import Disclosure from 'https://esm.sh/@y14e/disclosure@1.3.7';
17
17
  // or
18
- import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@1.3.5/+esm';
18
+ import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@1.3.7/+esm';
19
19
  // or
20
- import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@1.3.5';
20
+ import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@1.3.7';
21
21
  ```
22
22
 
23
23
  ## Usage
package/dist/index.cjs CHANGED
@@ -335,7 +335,7 @@ function createRovingTabIndex(container, options = {}) {
335
335
  console.warn("Invalid navigationOnly option. Fallback: false.");
336
336
  navigationOnly = false;
337
337
  }
338
- if (typeof selector !== "undefined" && typeof selector !== "string") {
338
+ if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
339
339
  console.warn(
340
340
  "Invalid selector. Fallback: all focusable elements (undefined)."
341
341
  );
@@ -350,10 +350,10 @@ function createRovingTabIndex(container, options = {}) {
350
350
  wrap = false;
351
351
  }
352
352
  const settings = { navigationOnly, typeahead, wrap };
353
- if (direction !== void 0) {
353
+ if (direction) {
354
354
  Object.assign(settings, { direction });
355
355
  }
356
- if (selector !== void 0) {
356
+ if (selector) {
357
357
  Object.assign(settings, { selector });
358
358
  }
359
359
  const roving = new RovingTabIndex(container, settings);
@@ -655,8 +655,9 @@ var Disclosure = class _Disclosure {
655
655
  this.#animationController?.abort();
656
656
  this.#animationController = null;
657
657
  this.#detailsElements.forEach((details) => {
658
- details.removeAttribute("data-disclosure-name");
659
- details.removeAttribute("data-disclosure-open");
658
+ ["name", "open"].forEach((name) => {
659
+ details.removeAttribute(`data-disclosure-${name}`);
660
+ });
660
661
  });
661
662
  this.#detailsElements.length = 0;
662
663
  restoreAttributes(this.#summaryElements);
@@ -665,6 +666,11 @@ var Disclosure = class _Disclosure {
665
666
  this.#rootElement.removeAttribute("data-disclosure-initialized");
666
667
  }
667
668
  #initialize() {
669
+ saveAttributes(this.#summaryElements, [
670
+ "aria-disabled",
671
+ "style",
672
+ "tabindex"
673
+ ]);
668
674
  this.#eventController = new AbortController();
669
675
  const { signal } = this.#eventController;
670
676
  this.#detailsElements.forEach((details, i) => {
@@ -681,7 +687,6 @@ var Disclosure = class _Disclosure {
681
687
  return;
682
688
  }
683
689
  if (!isFocusable2(summary)) {
684
- saveAttributes([summary], ["aria-disabled", "style", "tabindex"]);
685
690
  summary.setAttribute("aria-disabled", "true");
686
691
  summary.setAttribute("tabindex", "-1");
687
692
  summary.style.setProperty("pointer-events", "none");
@@ -781,9 +786,9 @@ var Disclosure = class _Disclosure {
781
786
  if (!details.hasAttribute("data-disclosure-open")) {
782
787
  details.open = false;
783
788
  }
784
- const { style } = content;
785
- style.removeProperty("block-size");
786
- style.removeProperty("overflow");
789
+ ["block-size", "overflow"].forEach((name2) => {
790
+ content.style.removeProperty(name2);
791
+ });
787
792
  }
788
793
  async #waitAnimationsFinish() {
789
794
  const promises = [];
@@ -814,7 +819,7 @@ function waitAnimationFinish(animation) {
814
819
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
815
820
  * Using the <details> and <summary> element.
816
821
  *
817
- * @version 1.3.5
822
+ * @version 1.3.7
818
823
  * @author Yusuke Kamiyamane
819
824
  * @license MIT
820
825
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -839,7 +844,7 @@ function waitAnimationFinish(animation) {
839
844
  * Lightweight roving tabindex utility with fully focus management.
840
845
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
841
846
  *
842
- * @version 2.0.3
847
+ * @version 2.0.4
843
848
  * @author Yusuke Kamiyamane
844
849
  * @license MIT
845
850
  * @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 1.3.5
6
+ * @version 1.3.7
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 1.3.5
6
+ * @version 1.3.7
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -333,7 +333,7 @@ function createRovingTabIndex(container, options = {}) {
333
333
  console.warn("Invalid navigationOnly option. Fallback: false.");
334
334
  navigationOnly = false;
335
335
  }
336
- if (typeof selector !== "undefined" && typeof selector !== "string") {
336
+ if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
337
337
  console.warn(
338
338
  "Invalid selector. Fallback: all focusable elements (undefined)."
339
339
  );
@@ -348,10 +348,10 @@ function createRovingTabIndex(container, options = {}) {
348
348
  wrap = false;
349
349
  }
350
350
  const settings = { navigationOnly, typeahead, wrap };
351
- if (direction !== void 0) {
351
+ if (direction) {
352
352
  Object.assign(settings, { direction });
353
353
  }
354
- if (selector !== void 0) {
354
+ if (selector) {
355
355
  Object.assign(settings, { selector });
356
356
  }
357
357
  const roving = new RovingTabIndex(container, settings);
@@ -653,8 +653,9 @@ var Disclosure = class _Disclosure {
653
653
  this.#animationController?.abort();
654
654
  this.#animationController = null;
655
655
  this.#detailsElements.forEach((details) => {
656
- details.removeAttribute("data-disclosure-name");
657
- details.removeAttribute("data-disclosure-open");
656
+ ["name", "open"].forEach((name) => {
657
+ details.removeAttribute(`data-disclosure-${name}`);
658
+ });
658
659
  });
659
660
  this.#detailsElements.length = 0;
660
661
  restoreAttributes(this.#summaryElements);
@@ -663,6 +664,11 @@ var Disclosure = class _Disclosure {
663
664
  this.#rootElement.removeAttribute("data-disclosure-initialized");
664
665
  }
665
666
  #initialize() {
667
+ saveAttributes(this.#summaryElements, [
668
+ "aria-disabled",
669
+ "style",
670
+ "tabindex"
671
+ ]);
666
672
  this.#eventController = new AbortController();
667
673
  const { signal } = this.#eventController;
668
674
  this.#detailsElements.forEach((details, i) => {
@@ -679,7 +685,6 @@ var Disclosure = class _Disclosure {
679
685
  return;
680
686
  }
681
687
  if (!isFocusable2(summary)) {
682
- saveAttributes([summary], ["aria-disabled", "style", "tabindex"]);
683
688
  summary.setAttribute("aria-disabled", "true");
684
689
  summary.setAttribute("tabindex", "-1");
685
690
  summary.style.setProperty("pointer-events", "none");
@@ -779,9 +784,9 @@ var Disclosure = class _Disclosure {
779
784
  if (!details.hasAttribute("data-disclosure-open")) {
780
785
  details.open = false;
781
786
  }
782
- const { style } = content;
783
- style.removeProperty("block-size");
784
- style.removeProperty("overflow");
787
+ ["block-size", "overflow"].forEach((name2) => {
788
+ content.style.removeProperty(name2);
789
+ });
785
790
  }
786
791
  async #waitAnimationsFinish() {
787
792
  const promises = [];
@@ -812,7 +817,7 @@ function waitAnimationFinish(animation) {
812
817
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
813
818
  * Using the <details> and <summary> element.
814
819
  *
815
- * @version 1.3.5
820
+ * @version 1.3.7
816
821
  * @author Yusuke Kamiyamane
817
822
  * @license MIT
818
823
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -837,7 +842,7 @@ function waitAnimationFinish(animation) {
837
842
  * Lightweight roving tabindex utility with fully focus management.
838
843
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
839
844
  *
840
- * @version 2.0.3
845
+ * @version 2.0.4
841
846
  * @author Yusuke Kamiyamane
842
847
  * @license MIT
843
848
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/disclosure",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -44,7 +44,7 @@
44
44
  "homepage": "https://github.com/y14e/disclosure#readme",
45
45
  "devDependencies": {
46
46
  "@y14e/attributes-utils": "^1.1.0",
47
- "@y14e/roving-tabindex": "^2.0.3",
47
+ "@y14e/roving-tabindex": "^2.0.4",
48
48
  "bun-types": "latest",
49
49
  "tsup": "^8.0.0",
50
50
  "typescript": "^5.6.0",