@y14e/disclosure-css 1.3.3 → 1.3.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 +13 -13
- package/dist/index.cjs +15 -20
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ npm i @y14e/disclosure-css
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// npm
|
|
13
|
-
import Disclosure from '@y14e/disclosure-css@1.3.
|
|
13
|
+
import Disclosure from '@y14e/disclosure-css@1.3.5';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import Disclosure from 'https://esm.sh/@y14e/disclosure-css@1.3.
|
|
16
|
+
import Disclosure from 'https://esm.sh/@y14e/disclosure-css@1.3.5';
|
|
17
17
|
// or
|
|
18
|
-
import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure-css@1.3.
|
|
18
|
+
import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure-css@1.3.5/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure-css@1.3.
|
|
20
|
+
import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure-css@1.3.5';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
@@ -30,15 +30,6 @@ new Disclosure(root);
|
|
|
30
30
|
|
|
31
31
|
## 📦 APIs
|
|
32
32
|
|
|
33
|
-
### `open`
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
disclosure.open(details);
|
|
37
|
-
// => void
|
|
38
|
-
//
|
|
39
|
-
// details: HTMLDetailsElement
|
|
40
|
-
```
|
|
41
|
-
|
|
42
33
|
### `close`
|
|
43
34
|
|
|
44
35
|
```ts
|
|
@@ -57,6 +48,15 @@ disclosure.destroy();
|
|
|
57
48
|
// => void
|
|
58
49
|
```
|
|
59
50
|
|
|
51
|
+
### `open`
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
disclosure.open(details);
|
|
55
|
+
// => void
|
|
56
|
+
//
|
|
57
|
+
// details: HTMLDetailsElement
|
|
58
|
+
```
|
|
59
|
+
|
|
60
60
|
## Demo
|
|
61
61
|
|
|
62
62
|
- https://y14e.github.io/disclosure-css/
|
package/dist/index.cjs
CHANGED
|
@@ -600,16 +600,6 @@ var Disclosure = class {
|
|
|
600
600
|
});
|
|
601
601
|
this.#initialize();
|
|
602
602
|
}
|
|
603
|
-
open(details) {
|
|
604
|
-
if (this.#isDestroyed) {
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
608
|
-
console.warn("Invalid <details> element");
|
|
609
|
-
return;
|
|
610
|
-
}
|
|
611
|
-
this.#toggle(details, true);
|
|
612
|
-
}
|
|
613
603
|
close(details) {
|
|
614
604
|
if (this.#isDestroyed) {
|
|
615
605
|
return;
|
|
@@ -633,21 +623,26 @@ var Disclosure = class {
|
|
|
633
623
|
this.#contentElements.length = 0;
|
|
634
624
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
635
625
|
}
|
|
626
|
+
open(details) {
|
|
627
|
+
if (this.#isDestroyed) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
631
|
+
console.warn("Invalid <details> element");
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
this.#toggle(details, true);
|
|
635
|
+
}
|
|
636
636
|
#initialize() {
|
|
637
637
|
saveAttributes(this.#summaryElements, [
|
|
638
638
|
"aria-disabled",
|
|
639
639
|
"style",
|
|
640
640
|
"tabindex"
|
|
641
641
|
]);
|
|
642
|
-
this.#summaryElements.forEach((summary) => {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
if (!isFocusable2(summary)) {
|
|
647
|
-
summary.setAttribute("aria-disabled", "true");
|
|
648
|
-
summary.setAttribute("tabindex", "-1");
|
|
649
|
-
summary.style.setProperty("pointer-events", "none");
|
|
650
|
-
}
|
|
642
|
+
this.#summaryElements.filter((summary) => !isFocusable2(summary)).forEach((summary) => {
|
|
643
|
+
summary.setAttribute("aria-disabled", "true");
|
|
644
|
+
summary.setAttribute("tabindex", "-1");
|
|
645
|
+
summary.style.setProperty("pointer-events", "none");
|
|
651
646
|
});
|
|
652
647
|
this.#cleanupRovingTabIndex = createRovingTabIndex(this.#rootElement, {
|
|
653
648
|
direction: "vertical",
|
|
@@ -674,7 +669,7 @@ function isFocusable2(element) {
|
|
|
674
669
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
675
670
|
* Using the <details> and <summary> element.
|
|
676
671
|
*
|
|
677
|
-
* @version 1.3.
|
|
672
|
+
* @version 1.3.5
|
|
678
673
|
* @author Yusuke Kamiyamane
|
|
679
674
|
* @license MIT
|
|
680
675
|
* @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.5
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
declare class Disclosure {
|
|
13
13
|
#private;
|
|
14
14
|
constructor(root: HTMLElement);
|
|
15
|
-
open(details: HTMLDetailsElement): void;
|
|
16
15
|
close(details: HTMLDetailsElement): void;
|
|
17
16
|
destroy(): void;
|
|
17
|
+
open(details: HTMLDetailsElement): void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export { 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.5
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
declare class Disclosure {
|
|
13
13
|
#private;
|
|
14
14
|
constructor(root: HTMLElement);
|
|
15
|
-
open(details: HTMLDetailsElement): void;
|
|
16
15
|
close(details: HTMLDetailsElement): void;
|
|
17
16
|
destroy(): void;
|
|
17
|
+
open(details: HTMLDetailsElement): void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export { Disclosure as default };
|
package/dist/index.js
CHANGED
|
@@ -598,16 +598,6 @@ var Disclosure = class {
|
|
|
598
598
|
});
|
|
599
599
|
this.#initialize();
|
|
600
600
|
}
|
|
601
|
-
open(details) {
|
|
602
|
-
if (this.#isDestroyed) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
606
|
-
console.warn("Invalid <details> element");
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
this.#toggle(details, true);
|
|
610
|
-
}
|
|
611
601
|
close(details) {
|
|
612
602
|
if (this.#isDestroyed) {
|
|
613
603
|
return;
|
|
@@ -631,21 +621,26 @@ var Disclosure = class {
|
|
|
631
621
|
this.#contentElements.length = 0;
|
|
632
622
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
633
623
|
}
|
|
624
|
+
open(details) {
|
|
625
|
+
if (this.#isDestroyed) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
if (!(details instanceof HTMLDetailsElement) || !this.#bindings.has(details)) {
|
|
629
|
+
console.warn("Invalid <details> element");
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
this.#toggle(details, true);
|
|
633
|
+
}
|
|
634
634
|
#initialize() {
|
|
635
635
|
saveAttributes(this.#summaryElements, [
|
|
636
636
|
"aria-disabled",
|
|
637
637
|
"style",
|
|
638
638
|
"tabindex"
|
|
639
639
|
]);
|
|
640
|
-
this.#summaryElements.forEach((summary) => {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
if (!isFocusable2(summary)) {
|
|
645
|
-
summary.setAttribute("aria-disabled", "true");
|
|
646
|
-
summary.setAttribute("tabindex", "-1");
|
|
647
|
-
summary.style.setProperty("pointer-events", "none");
|
|
648
|
-
}
|
|
640
|
+
this.#summaryElements.filter((summary) => !isFocusable2(summary)).forEach((summary) => {
|
|
641
|
+
summary.setAttribute("aria-disabled", "true");
|
|
642
|
+
summary.setAttribute("tabindex", "-1");
|
|
643
|
+
summary.style.setProperty("pointer-events", "none");
|
|
649
644
|
});
|
|
650
645
|
this.#cleanupRovingTabIndex = createRovingTabIndex(this.#rootElement, {
|
|
651
646
|
direction: "vertical",
|
|
@@ -672,7 +667,7 @@ function isFocusable2(element) {
|
|
|
672
667
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
673
668
|
* Using the <details> and <summary> element.
|
|
674
669
|
*
|
|
675
|
-
* @version 1.3.
|
|
670
|
+
* @version 1.3.5
|
|
676
671
|
* @author Yusuke Kamiyamane
|
|
677
672
|
* @license MIT
|
|
678
673
|
* @copyright Copyright (c) Yusuke Kamiyamane
|