@y14e/disclosure 1.3.6 → 1.3.8
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 +13 -13
- package/dist/index.cjs +17 -16
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -16
- package/package.json +1 -1
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.8';
|
|
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.8';
|
|
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.8/+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.8';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
@@ -60,15 +60,6 @@ new Disclosure(root);
|
|
|
60
60
|
|
|
61
61
|
## 📦 APIs
|
|
62
62
|
|
|
63
|
-
### `open`
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
disclosure.open(details);
|
|
67
|
-
// => void
|
|
68
|
-
//
|
|
69
|
-
// details: HTMLDetailsElement
|
|
70
|
-
```
|
|
71
|
-
|
|
72
63
|
### `close`
|
|
73
64
|
|
|
74
65
|
```ts
|
|
@@ -89,6 +80,15 @@ disclosure.destroy(force);
|
|
|
89
80
|
// force (optional): If true, skips waiting for animations to finish.
|
|
90
81
|
```
|
|
91
82
|
|
|
83
|
+
### `open`
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
disclosure.open(details);
|
|
87
|
+
// => void
|
|
88
|
+
//
|
|
89
|
+
// details: HTMLDetailsElement
|
|
90
|
+
```
|
|
91
|
+
|
|
92
92
|
## Demo
|
|
93
93
|
|
|
94
94
|
- https://y14e.github.io/disclosure/
|
package/dist/index.cjs
CHANGED
|
@@ -614,16 +614,6 @@ var Disclosure = class _Disclosure {
|
|
|
614
614
|
});
|
|
615
615
|
this.#initialize();
|
|
616
616
|
}
|
|
617
|
-
open(details) {
|
|
618
|
-
if (this.#isDestroyed) {
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
622
|
-
console.warn("Invalid <details> element");
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
this.#toggle(details, true);
|
|
626
|
-
}
|
|
627
617
|
close(details) {
|
|
628
618
|
if (this.#isDestroyed) {
|
|
629
619
|
return;
|
|
@@ -655,8 +645,9 @@ var Disclosure = class _Disclosure {
|
|
|
655
645
|
this.#animationController?.abort();
|
|
656
646
|
this.#animationController = null;
|
|
657
647
|
this.#detailsElements.forEach((details) => {
|
|
658
|
-
|
|
659
|
-
|
|
648
|
+
["name", "open"].forEach((name) => {
|
|
649
|
+
details.removeAttribute(`data-disclosure-${name}`);
|
|
650
|
+
});
|
|
660
651
|
});
|
|
661
652
|
this.#detailsElements.length = 0;
|
|
662
653
|
restoreAttributes(this.#summaryElements);
|
|
@@ -664,6 +655,16 @@ var Disclosure = class _Disclosure {
|
|
|
664
655
|
this.#contentElements.length = 0;
|
|
665
656
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
666
657
|
}
|
|
658
|
+
open(details) {
|
|
659
|
+
if (this.#isDestroyed) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
663
|
+
console.warn("Invalid <details> element");
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
this.#toggle(details, true);
|
|
667
|
+
}
|
|
667
668
|
#initialize() {
|
|
668
669
|
saveAttributes(this.#summaryElements, [
|
|
669
670
|
"aria-disabled",
|
|
@@ -785,9 +786,9 @@ var Disclosure = class _Disclosure {
|
|
|
785
786
|
if (!details.hasAttribute("data-disclosure-open")) {
|
|
786
787
|
details.open = false;
|
|
787
788
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
789
|
+
["block-size", "overflow"].forEach((name2) => {
|
|
790
|
+
content.style.removeProperty(name2);
|
|
791
|
+
});
|
|
791
792
|
}
|
|
792
793
|
async #waitAnimationsFinish() {
|
|
793
794
|
const promises = [];
|
|
@@ -818,7 +819,7 @@ function waitAnimationFinish(animation) {
|
|
|
818
819
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
819
820
|
* Using the <details> and <summary> element.
|
|
820
821
|
*
|
|
821
|
-
* @version 1.3.
|
|
822
|
+
* @version 1.3.8
|
|
822
823
|
* @author Yusuke Kamiyamane
|
|
823
824
|
* @license MIT
|
|
824
825
|
* @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.
|
|
6
|
+
* @version 1.3.8
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -19,9 +19,9 @@ declare class Disclosure {
|
|
|
19
19
|
#private;
|
|
20
20
|
static defaults: DisclosureOptions;
|
|
21
21
|
constructor(root: HTMLElement, options?: DisclosureOptions);
|
|
22
|
-
open(details: HTMLDetailsElement): void;
|
|
23
22
|
close(details: HTMLDetailsElement): void;
|
|
24
23
|
destroy(force?: boolean): Promise<void>;
|
|
24
|
+
open(details: HTMLDetailsElement): void;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export { type DisclosureOptions, Disclosure as default };
|
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.
|
|
6
|
+
* @version 1.3.8
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -19,9 +19,9 @@ declare class Disclosure {
|
|
|
19
19
|
#private;
|
|
20
20
|
static defaults: DisclosureOptions;
|
|
21
21
|
constructor(root: HTMLElement, options?: DisclosureOptions);
|
|
22
|
-
open(details: HTMLDetailsElement): void;
|
|
23
22
|
close(details: HTMLDetailsElement): void;
|
|
24
23
|
destroy(force?: boolean): Promise<void>;
|
|
24
|
+
open(details: HTMLDetailsElement): void;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export { type DisclosureOptions, Disclosure as default };
|
package/dist/index.js
CHANGED
|
@@ -612,16 +612,6 @@ var Disclosure = class _Disclosure {
|
|
|
612
612
|
});
|
|
613
613
|
this.#initialize();
|
|
614
614
|
}
|
|
615
|
-
open(details) {
|
|
616
|
-
if (this.#isDestroyed) {
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
620
|
-
console.warn("Invalid <details> element");
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
this.#toggle(details, true);
|
|
624
|
-
}
|
|
625
615
|
close(details) {
|
|
626
616
|
if (this.#isDestroyed) {
|
|
627
617
|
return;
|
|
@@ -653,8 +643,9 @@ var Disclosure = class _Disclosure {
|
|
|
653
643
|
this.#animationController?.abort();
|
|
654
644
|
this.#animationController = null;
|
|
655
645
|
this.#detailsElements.forEach((details) => {
|
|
656
|
-
|
|
657
|
-
|
|
646
|
+
["name", "open"].forEach((name) => {
|
|
647
|
+
details.removeAttribute(`data-disclosure-${name}`);
|
|
648
|
+
});
|
|
658
649
|
});
|
|
659
650
|
this.#detailsElements.length = 0;
|
|
660
651
|
restoreAttributes(this.#summaryElements);
|
|
@@ -662,6 +653,16 @@ var Disclosure = class _Disclosure {
|
|
|
662
653
|
this.#contentElements.length = 0;
|
|
663
654
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
664
655
|
}
|
|
656
|
+
open(details) {
|
|
657
|
+
if (this.#isDestroyed) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
661
|
+
console.warn("Invalid <details> element");
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
this.#toggle(details, true);
|
|
665
|
+
}
|
|
665
666
|
#initialize() {
|
|
666
667
|
saveAttributes(this.#summaryElements, [
|
|
667
668
|
"aria-disabled",
|
|
@@ -783,9 +784,9 @@ var Disclosure = class _Disclosure {
|
|
|
783
784
|
if (!details.hasAttribute("data-disclosure-open")) {
|
|
784
785
|
details.open = false;
|
|
785
786
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
787
|
+
["block-size", "overflow"].forEach((name2) => {
|
|
788
|
+
content.style.removeProperty(name2);
|
|
789
|
+
});
|
|
789
790
|
}
|
|
790
791
|
async #waitAnimationsFinish() {
|
|
791
792
|
const promises = [];
|
|
@@ -816,7 +817,7 @@ function waitAnimationFinish(animation) {
|
|
|
816
817
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
817
818
|
* Using the <details> and <summary> element.
|
|
818
819
|
*
|
|
819
|
-
* @version 1.3.
|
|
820
|
+
* @version 1.3.8
|
|
820
821
|
* @author Yusuke Kamiyamane
|
|
821
822
|
* @license MIT
|
|
822
823
|
* @copyright Copyright (c) Yusuke Kamiyamane
|