@y14e/disclosure 2.0.1 → 2.0.3

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
@@ -13,11 +13,11 @@ npm i @y14e/disclosure
13
13
  import Disclosure from '@y14e/disclosure';
14
14
 
15
15
  // CDNs
16
- import Disclosure from 'https://esm.sh/@y14e/disclosure@2.0.1';
16
+ import Disclosure from 'https://esm.sh/@y14e/disclosure@2.0.3';
17
17
  // or
18
- import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.1/+esm';
18
+ import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.3/+esm';
19
19
  // or
20
- import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@2.0.1';
20
+ import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@2.0.3';
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -28,18 +28,17 @@ new Disclosure(root, options);
28
28
  //
29
29
  // root: HTMLElement
30
30
  // options (optional): DisclosureOptions
31
-
32
31
  ```
33
32
 
34
33
  ## 🪄 Options
35
34
 
36
35
  ```ts
37
36
  interface DisclosureOptions {
38
- animation?: {
39
- duration?: number; // ms (default: 300)
40
- easing?: string; // <easing-function> (default: 'ease')
37
+ animation: {
38
+ duration: number; // ms (default: 300)
39
+ easing: string; // <easing-function> (default: 'ease')
41
40
  };
42
- collapsible?: boolean; // default: true
41
+ collapsible: boolean; // default: true
43
42
  }
44
43
  ```
45
44
 
@@ -594,12 +594,13 @@ var Disclosure = class _Disclosure {
594
594
  this.#detailsElements.forEach((details, i) => {
595
595
  const summary = this.#summaryElements[i];
596
596
  const content = this.#contentElements[i];
597
- if (summary && content) {
598
- const binding = this.#createBinding(details, summary, content);
599
- this.#bindings.set(details, binding);
600
- this.#bindings.set(summary, binding);
601
- this.#bindings.set(content, binding);
597
+ if (!summary || !content) {
598
+ return;
602
599
  }
600
+ const binding = this.#createBinding(details, summary, content);
601
+ this.#bindings.set(details, binding);
602
+ this.#bindings.set(summary, binding);
603
+ this.#bindings.set(content, binding);
603
604
  });
604
605
  this.#initialize();
605
606
  }
@@ -809,7 +810,7 @@ function waitAnimationFinish(animation) {
809
810
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
810
811
  * Using the <details> and <summary> element.
811
812
  *
812
- * @version 2.0.1
813
+ * @version 2.0.3
813
814
  * @author Yusuke Kamiyamane
814
815
  * @license MIT
815
816
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -834,7 +835,7 @@ power-focusable/dist/index.js:
834
835
  * High-precision focus management utility with full composed tree support.
835
836
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
836
837
  *
837
- * @version 4.3.8
838
+ * @version 4.3.10
838
839
  * @author Yusuke Kamiyamane
839
840
  * @license MIT
840
841
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -847,7 +848,7 @@ power-focusable/dist/index.js:
847
848
  * Lightweight roving tabindex utility with fully focus management.
848
849
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
849
850
  *
850
- * @version 3.1.6
851
+ * @version 3.1.9
851
852
  * @author Yusuke Kamiyamane
852
853
  * @license MIT
853
854
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -592,12 +592,13 @@ var Disclosure = class _Disclosure {
592
592
  this.#detailsElements.forEach((details, i) => {
593
593
  const summary = this.#summaryElements[i];
594
594
  const content = this.#contentElements[i];
595
- if (summary && content) {
596
- const binding = this.#createBinding(details, summary, content);
597
- this.#bindings.set(details, binding);
598
- this.#bindings.set(summary, binding);
599
- this.#bindings.set(content, binding);
595
+ if (!summary || !content) {
596
+ return;
600
597
  }
598
+ const binding = this.#createBinding(details, summary, content);
599
+ this.#bindings.set(details, binding);
600
+ this.#bindings.set(summary, binding);
601
+ this.#bindings.set(content, binding);
601
602
  });
602
603
  this.#initialize();
603
604
  }
@@ -807,7 +808,7 @@ function waitAnimationFinish(animation) {
807
808
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
808
809
  * Using the <details> and <summary> element.
809
810
  *
810
- * @version 2.0.1
811
+ * @version 2.0.3
811
812
  * @author Yusuke Kamiyamane
812
813
  * @license MIT
813
814
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -832,7 +833,7 @@ power-focusable/dist/index.js:
832
833
  * High-precision focus management utility with full composed tree support.
833
834
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
834
835
  *
835
- * @version 4.3.8
836
+ * @version 4.3.10
836
837
  * @author Yusuke Kamiyamane
837
838
  * @license MIT
838
839
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -845,7 +846,7 @@ power-focusable/dist/index.js:
845
846
  * Lightweight roving tabindex utility with fully focus management.
846
847
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
847
848
  *
848
- * @version 3.1.6
849
+ * @version 3.1.9
849
850
  * @author Yusuke Kamiyamane
850
851
  * @license MIT
851
852
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -67,12 +67,13 @@ var Disclosure = class _Disclosure {
67
67
  this.#detailsElements.forEach((details, i) => {
68
68
  const summary = this.#summaryElements[i];
69
69
  const content = this.#contentElements[i];
70
- if (summary && content) {
71
- const binding = this.#createBinding(details, summary, content);
72
- this.#bindings.set(details, binding);
73
- this.#bindings.set(summary, binding);
74
- this.#bindings.set(content, binding);
70
+ if (!summary || !content) {
71
+ return;
75
72
  }
73
+ const binding = this.#createBinding(details, summary, content);
74
+ this.#bindings.set(details, binding);
75
+ this.#bindings.set(summary, binding);
76
+ this.#bindings.set(content, binding);
76
77
  });
77
78
  this.#initialize();
78
79
  }
@@ -282,7 +283,7 @@ function waitAnimationFinish(animation) {
282
283
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
283
284
  * Using the <details> and <summary> element.
284
285
  *
285
- * @version 2.0.1
286
+ * @version 2.0.3
286
287
  * @author Yusuke Kamiyamane
287
288
  * @license MIT
288
289
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,23 +3,23 @@
3
3
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
4
4
  * Using the <details> and <summary> element.
5
5
  *
6
- * @version 2.0.1
6
+ * @version 2.0.3
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
10
10
  * @see {@link https://github.com/y14e/disclosure}
11
11
  */
12
12
  interface DisclosureOptions {
13
- readonly animation?: {
14
- readonly duration?: number;
15
- readonly easing?: string;
13
+ animation: {
14
+ duration: number;
15
+ easing: string;
16
16
  };
17
- readonly collapsible?: boolean;
17
+ collapsible: boolean;
18
18
  }
19
19
  declare class Disclosure {
20
20
  #private;
21
- static defaults: DisclosureOptions;
22
- constructor(root: HTMLElement, options?: DisclosureOptions);
21
+ static defaults: Partial<DisclosureOptions>;
22
+ constructor(root: HTMLElement, options?: Partial<DisclosureOptions>);
23
23
  collapse(details: HTMLDetailsElement): void;
24
24
  destroy(force?: boolean): Promise<void>;
25
25
  expand(details: HTMLDetailsElement): void;
package/dist/index.d.ts CHANGED
@@ -3,23 +3,23 @@
3
3
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
4
4
  * Using the <details> and <summary> element.
5
5
  *
6
- * @version 2.0.1
6
+ * @version 2.0.3
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
10
10
  * @see {@link https://github.com/y14e/disclosure}
11
11
  */
12
12
  interface DisclosureOptions {
13
- readonly animation?: {
14
- readonly duration?: number;
15
- readonly easing?: string;
13
+ animation: {
14
+ duration: number;
15
+ easing: string;
16
16
  };
17
- readonly collapsible?: boolean;
17
+ collapsible: boolean;
18
18
  }
19
19
  declare class Disclosure {
20
20
  #private;
21
- static defaults: DisclosureOptions;
22
- constructor(root: HTMLElement, options?: DisclosureOptions);
21
+ static defaults: Partial<DisclosureOptions>;
22
+ constructor(root: HTMLElement, options?: Partial<DisclosureOptions>);
23
23
  collapse(details: HTMLDetailsElement): void;
24
24
  destroy(force?: boolean): Promise<void>;
25
25
  expand(details: HTMLDetailsElement): void;
package/dist/index.js CHANGED
@@ -65,12 +65,13 @@ var Disclosure = class _Disclosure {
65
65
  this.#detailsElements.forEach((details, i) => {
66
66
  const summary = this.#summaryElements[i];
67
67
  const content = this.#contentElements[i];
68
- if (summary && content) {
69
- const binding = this.#createBinding(details, summary, content);
70
- this.#bindings.set(details, binding);
71
- this.#bindings.set(summary, binding);
72
- this.#bindings.set(content, binding);
68
+ if (!summary || !content) {
69
+ return;
73
70
  }
71
+ const binding = this.#createBinding(details, summary, content);
72
+ this.#bindings.set(details, binding);
73
+ this.#bindings.set(summary, binding);
74
+ this.#bindings.set(content, binding);
74
75
  });
75
76
  this.#initialize();
76
77
  }
@@ -280,7 +281,7 @@ function waitAnimationFinish(animation) {
280
281
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
281
282
  * Using the <details> and <summary> element.
282
283
  *
283
- * @version 2.0.1
284
+ * @version 2.0.3
284
285
  * @author Yusuke Kamiyamane
285
286
  * @license MIT
286
287
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/disclosure",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -45,14 +45,13 @@
45
45
  "devDependencies": {
46
46
  "bun-types": "latest",
47
47
  "tsup": "^8.0.0",
48
- "typescript": "^5.6.0",
49
- "utility-types": "^3.11.0"
48
+ "typescript": "^5.6.0"
50
49
  },
51
50
  "engines": {
52
51
  "node": ">=18"
53
52
  },
54
53
  "dependencies": {
55
54
  "@y14e/attributes-utils": "^1.1.3",
56
- "@y14e/roving-tabindex": "^3.1.6"
55
+ "@y14e/roving-tabindex": "^3.1.9"
57
56
  }
58
57
  }