@y14e/disclosure 1.3.12 → 1.3.14
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 +4 -4
- package/dist/index.cjs +16 -14
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -14
- package/package.json +2 -2
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.
|
|
13
|
+
import Disclosure from '@y14e/disclosure@1.3.14';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import Disclosure from 'https://esm.sh/@y14e/disclosure@1.3.
|
|
16
|
+
import Disclosure from 'https://esm.sh/@y14e/disclosure@1.3.14';
|
|
17
17
|
// or
|
|
18
|
-
import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@1.3.
|
|
18
|
+
import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@1.3.14/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@1.3.
|
|
20
|
+
import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@1.3.14';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.cjs
CHANGED
|
@@ -400,10 +400,11 @@ var RovingTabIndex = class {
|
|
|
400
400
|
}
|
|
401
401
|
#onFocusIn = (event) => {
|
|
402
402
|
const { target } = event;
|
|
403
|
-
if (target instanceof Element) {
|
|
404
|
-
|
|
405
|
-
this.#options.noMemory && !isFocusable22 ? this.#update(null) : isFocusable22 && this.#update(target);
|
|
403
|
+
if (!(target instanceof Element)) {
|
|
404
|
+
return;
|
|
406
405
|
}
|
|
406
|
+
const isFocusable22 = this.#focusables.has(target);
|
|
407
|
+
this.#options.noMemory && !isFocusable22 ? this.#update(null) : isFocusable22 && this.#update(target);
|
|
407
408
|
};
|
|
408
409
|
#onKeyDown = (event) => {
|
|
409
410
|
if (!event.composedPath().includes(this.#container)) {
|
|
@@ -623,11 +624,11 @@ var Disclosure = class _Disclosure {
|
|
|
623
624
|
if (this.#isDestroyed) {
|
|
624
625
|
return;
|
|
625
626
|
}
|
|
626
|
-
if (details instanceof HTMLDetailsElement
|
|
627
|
-
this.#toggle(details, false);
|
|
628
|
-
} else {
|
|
627
|
+
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
629
628
|
console.warn("Invalid <details> element");
|
|
629
|
+
return;
|
|
630
630
|
}
|
|
631
|
+
this.#toggle(details, false);
|
|
631
632
|
}
|
|
632
633
|
async destroy(force = false) {
|
|
633
634
|
if (this.#isDestroyed) {
|
|
@@ -664,11 +665,11 @@ var Disclosure = class _Disclosure {
|
|
|
664
665
|
if (this.#isDestroyed) {
|
|
665
666
|
return;
|
|
666
667
|
}
|
|
667
|
-
if (details instanceof HTMLDetailsElement
|
|
668
|
-
this.#toggle(details, true);
|
|
669
|
-
} else {
|
|
668
|
+
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
670
669
|
console.warn("Invalid <details> element");
|
|
670
|
+
return;
|
|
671
671
|
}
|
|
672
|
+
this.#toggle(details, true);
|
|
672
673
|
}
|
|
673
674
|
#initialize() {
|
|
674
675
|
saveAttributes(this.#summaryElements, [
|
|
@@ -713,10 +714,11 @@ var Disclosure = class _Disclosure {
|
|
|
713
714
|
return;
|
|
714
715
|
}
|
|
715
716
|
const binding = this.#bindings.get(summary);
|
|
716
|
-
if (binding) {
|
|
717
|
-
|
|
718
|
-
this.#toggle(details, !details.hasAttribute("data-disclosure-open"));
|
|
717
|
+
if (!binding) {
|
|
718
|
+
return;
|
|
719
719
|
}
|
|
720
|
+
const { details } = binding;
|
|
721
|
+
this.#toggle(details, !details.hasAttribute("data-disclosure-open"));
|
|
720
722
|
};
|
|
721
723
|
#toggle(details, isOpen) {
|
|
722
724
|
if (details.hasAttribute("data-disclosure-open") === isOpen) {
|
|
@@ -825,7 +827,7 @@ function waitAnimationFinish(animation) {
|
|
|
825
827
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
826
828
|
* Using the <details> and <summary> element.
|
|
827
829
|
*
|
|
828
|
-
* @version 1.3.
|
|
830
|
+
* @version 1.3.14
|
|
829
831
|
* @author Yusuke Kamiyamane
|
|
830
832
|
* @license MIT
|
|
831
833
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -850,7 +852,7 @@ function waitAnimationFinish(animation) {
|
|
|
850
852
|
* Lightweight roving tabindex utility with fully focus management.
|
|
851
853
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
852
854
|
*
|
|
853
|
-
* @version 3.0.
|
|
855
|
+
* @version 3.0.5
|
|
854
856
|
* @author Yusuke Kamiyamane
|
|
855
857
|
* @license MIT
|
|
856
858
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -398,10 +398,11 @@ var RovingTabIndex = class {
|
|
|
398
398
|
}
|
|
399
399
|
#onFocusIn = (event) => {
|
|
400
400
|
const { target } = event;
|
|
401
|
-
if (target instanceof Element) {
|
|
402
|
-
|
|
403
|
-
this.#options.noMemory && !isFocusable22 ? this.#update(null) : isFocusable22 && this.#update(target);
|
|
401
|
+
if (!(target instanceof Element)) {
|
|
402
|
+
return;
|
|
404
403
|
}
|
|
404
|
+
const isFocusable22 = this.#focusables.has(target);
|
|
405
|
+
this.#options.noMemory && !isFocusable22 ? this.#update(null) : isFocusable22 && this.#update(target);
|
|
405
406
|
};
|
|
406
407
|
#onKeyDown = (event) => {
|
|
407
408
|
if (!event.composedPath().includes(this.#container)) {
|
|
@@ -621,11 +622,11 @@ var Disclosure = class _Disclosure {
|
|
|
621
622
|
if (this.#isDestroyed) {
|
|
622
623
|
return;
|
|
623
624
|
}
|
|
624
|
-
if (details instanceof HTMLDetailsElement
|
|
625
|
-
this.#toggle(details, false);
|
|
626
|
-
} else {
|
|
625
|
+
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
627
626
|
console.warn("Invalid <details> element");
|
|
627
|
+
return;
|
|
628
628
|
}
|
|
629
|
+
this.#toggle(details, false);
|
|
629
630
|
}
|
|
630
631
|
async destroy(force = false) {
|
|
631
632
|
if (this.#isDestroyed) {
|
|
@@ -662,11 +663,11 @@ var Disclosure = class _Disclosure {
|
|
|
662
663
|
if (this.#isDestroyed) {
|
|
663
664
|
return;
|
|
664
665
|
}
|
|
665
|
-
if (details instanceof HTMLDetailsElement
|
|
666
|
-
this.#toggle(details, true);
|
|
667
|
-
} else {
|
|
666
|
+
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
668
667
|
console.warn("Invalid <details> element");
|
|
668
|
+
return;
|
|
669
669
|
}
|
|
670
|
+
this.#toggle(details, true);
|
|
670
671
|
}
|
|
671
672
|
#initialize() {
|
|
672
673
|
saveAttributes(this.#summaryElements, [
|
|
@@ -711,10 +712,11 @@ var Disclosure = class _Disclosure {
|
|
|
711
712
|
return;
|
|
712
713
|
}
|
|
713
714
|
const binding = this.#bindings.get(summary);
|
|
714
|
-
if (binding) {
|
|
715
|
-
|
|
716
|
-
this.#toggle(details, !details.hasAttribute("data-disclosure-open"));
|
|
715
|
+
if (!binding) {
|
|
716
|
+
return;
|
|
717
717
|
}
|
|
718
|
+
const { details } = binding;
|
|
719
|
+
this.#toggle(details, !details.hasAttribute("data-disclosure-open"));
|
|
718
720
|
};
|
|
719
721
|
#toggle(details, isOpen) {
|
|
720
722
|
if (details.hasAttribute("data-disclosure-open") === isOpen) {
|
|
@@ -823,7 +825,7 @@ function waitAnimationFinish(animation) {
|
|
|
823
825
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
824
826
|
* Using the <details> and <summary> element.
|
|
825
827
|
*
|
|
826
|
-
* @version 1.3.
|
|
828
|
+
* @version 1.3.14
|
|
827
829
|
* @author Yusuke Kamiyamane
|
|
828
830
|
* @license MIT
|
|
829
831
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -848,7 +850,7 @@ function waitAnimationFinish(animation) {
|
|
|
848
850
|
* Lightweight roving tabindex utility with fully focus management.
|
|
849
851
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
850
852
|
*
|
|
851
|
-
* @version 3.0.
|
|
853
|
+
* @version 3.0.5
|
|
852
854
|
* @author Yusuke Kamiyamane
|
|
853
855
|
* @license MIT
|
|
854
856
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/disclosure",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.14",
|
|
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.2",
|
|
47
|
-
"@y14e/roving-tabindex": "^3.0.
|
|
47
|
+
"@y14e/roving-tabindex": "^3.0.5",
|
|
48
48
|
"bun-types": "latest",
|
|
49
49
|
"tsup": "^8.0.0",
|
|
50
50
|
"typescript": "^5.6.0",
|