@y14e/accordion 1.4.3 → 1.4.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
@@ -10,14 +10,14 @@ npm i @y14e/accordion
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import Accordion from '@y14e/accordion@1.4.3';
13
+ import Accordion from '@y14e/accordion@1.4.5';
14
14
 
15
15
  // CDNs
16
- import Accordion from 'https://esm.sh/@y14e/accordion@1.4.3';
16
+ import Accordion from 'https://esm.sh/@y14e/accordion@1.4.5';
17
17
  // or
18
- import Accordion from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@1.4.3/+esm';
18
+ import Accordion from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@1.4.5/+esm';
19
19
  // or
20
- import Accordion from 'https://esm.unpkg.com/@y14e/accordion@1.4.3';
20
+ import Accordion from 'https://esm.unpkg.com/@y14e/accordion@1.4.5';
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -68,15 +68,6 @@ new Accordion(root);
68
68
 
69
69
  ## 📦 APIs
70
70
 
71
- ### `open`
72
-
73
- ```ts
74
- accordion.open(trigger);
75
- // => void
76
- //
77
- // trigger: HTMLElement
78
- ```
79
-
80
71
  ### `close`
81
72
 
82
73
  ```ts
@@ -97,6 +88,15 @@ accordion.destroy(force);
97
88
  // force (optional): If true, skips waiting for animations to finish.
98
89
  ```
99
90
 
91
+ ### `open`
92
+
93
+ ```ts
94
+ accordion.open(trigger);
95
+ // => void
96
+ //
97
+ // trigger: HTMLElement
98
+ ```
99
+
100
100
  ## Demo
101
101
 
102
102
  https://y14e.github.io/accordion/
package/dist/index.cjs CHANGED
@@ -683,16 +683,6 @@ var Accordion = class _Accordion {
683
683
  });
684
684
  this.#initialize();
685
685
  }
686
- open(trigger) {
687
- if (this.#isDestroyed) {
688
- return;
689
- }
690
- if (!(trigger instanceof HTMLElement) || !this.#bindings.has(trigger)) {
691
- console.warn("Invalid trigger element");
692
- return;
693
- }
694
- this.#toggle(trigger, true);
695
- }
696
686
  close(trigger) {
697
687
  if (this.#isDestroyed) {
698
688
  return;
@@ -728,6 +718,16 @@ var Accordion = class _Accordion {
728
718
  this.#contentElements.length = 0;
729
719
  this.#rootElement.removeAttribute("data-accordion-initialized");
730
720
  }
721
+ open(trigger) {
722
+ if (this.#isDestroyed) {
723
+ return;
724
+ }
725
+ if (!(trigger instanceof HTMLElement) || !this.#bindings.has(trigger)) {
726
+ console.warn("Invalid trigger element");
727
+ return;
728
+ }
729
+ this.#toggle(trigger, true);
730
+ }
731
731
  #initialize() {
732
732
  saveAttributes(this.#triggerElements, [
733
733
  "aria-controls",
@@ -802,9 +802,7 @@ var Accordion = class _Accordion {
802
802
  const opened = this.#triggerElements.find(
803
803
  (t) => t !== trigger && t.getAttribute("data-accordion-name") === name && t.ariaExpanded === "true"
804
804
  );
805
- if (opened) {
806
- this.#toggle(opened, false, isMatch);
807
- }
805
+ opened && this.#toggle(opened, false, isMatch);
808
806
  }
809
807
  trigger.setAttribute(
810
808
  "aria-label",
@@ -894,7 +892,7 @@ function waitAnimationFinish(animation) {
894
892
  * Accordion
895
893
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
896
894
  *
897
- * @version 1.4.3
895
+ * @version 1.4.5
898
896
  * @author Yusuke Kamiyamane
899
897
  * @license MIT
900
898
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Accordion
3
3
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
4
4
  *
5
- * @version 1.4.3
5
+ * @version 1.4.5
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -22,9 +22,9 @@ declare class Accordion {
22
22
  #private;
23
23
  static defaults: AccordionOptions;
24
24
  constructor(root: HTMLElement, options?: AccordionOptions);
25
- open(trigger: HTMLElement): void;
26
25
  close(trigger: HTMLElement): void;
27
26
  destroy(force?: boolean): Promise<void>;
27
+ open(trigger: HTMLElement): void;
28
28
  }
29
29
 
30
30
  export { type AccordionOptions, Accordion as default };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Accordion
3
3
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
4
4
  *
5
- * @version 1.4.3
5
+ * @version 1.4.5
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -22,9 +22,9 @@ declare class Accordion {
22
22
  #private;
23
23
  static defaults: AccordionOptions;
24
24
  constructor(root: HTMLElement, options?: AccordionOptions);
25
- open(trigger: HTMLElement): void;
26
25
  close(trigger: HTMLElement): void;
27
26
  destroy(force?: boolean): Promise<void>;
27
+ open(trigger: HTMLElement): void;
28
28
  }
29
29
 
30
30
  export { type AccordionOptions, Accordion as default };
package/dist/index.js CHANGED
@@ -681,16 +681,6 @@ var Accordion = class _Accordion {
681
681
  });
682
682
  this.#initialize();
683
683
  }
684
- open(trigger) {
685
- if (this.#isDestroyed) {
686
- return;
687
- }
688
- if (!(trigger instanceof HTMLElement) || !this.#bindings.has(trigger)) {
689
- console.warn("Invalid trigger element");
690
- return;
691
- }
692
- this.#toggle(trigger, true);
693
- }
694
684
  close(trigger) {
695
685
  if (this.#isDestroyed) {
696
686
  return;
@@ -726,6 +716,16 @@ var Accordion = class _Accordion {
726
716
  this.#contentElements.length = 0;
727
717
  this.#rootElement.removeAttribute("data-accordion-initialized");
728
718
  }
719
+ open(trigger) {
720
+ if (this.#isDestroyed) {
721
+ return;
722
+ }
723
+ if (!(trigger instanceof HTMLElement) || !this.#bindings.has(trigger)) {
724
+ console.warn("Invalid trigger element");
725
+ return;
726
+ }
727
+ this.#toggle(trigger, true);
728
+ }
729
729
  #initialize() {
730
730
  saveAttributes(this.#triggerElements, [
731
731
  "aria-controls",
@@ -800,9 +800,7 @@ var Accordion = class _Accordion {
800
800
  const opened = this.#triggerElements.find(
801
801
  (t) => t !== trigger && t.getAttribute("data-accordion-name") === name && t.ariaExpanded === "true"
802
802
  );
803
- if (opened) {
804
- this.#toggle(opened, false, isMatch);
805
- }
803
+ opened && this.#toggle(opened, false, isMatch);
806
804
  }
807
805
  trigger.setAttribute(
808
806
  "aria-label",
@@ -892,7 +890,7 @@ function waitAnimationFinish(animation) {
892
890
  * Accordion
893
891
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
894
892
  *
895
- * @version 1.4.3
893
+ * @version 1.4.5
896
894
  * @author Yusuke Kamiyamane
897
895
  * @license MIT
898
896
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/accordion",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "WAI-ARIA compliant accordion pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",