@y14e/accordion 2.0.11 → 2.0.13

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/accordion
13
13
  import { Accordion } from "@y14e/accordion";
14
14
 
15
15
  // CDNs
16
- import { Accordion } from "https://esm.sh/@y14e/accordion@2.0.11";
16
+ import { Accordion } from "https://esm.sh/@y14e/accordion@2.0.13";
17
17
  // or
18
- import { Accordion } from "https://cdn.jsdelivr.net/npm/@y14e/accordion@2.0.11/+esm";
18
+ import { Accordion } from "https://cdn.jsdelivr.net/npm/@y14e/accordion@2.0.13/+esm";
19
19
  // or
20
- import { Accordion } from "https://esm.unpkg.com/@y14e/accordion@2.0.11";
20
+ import { Accordion } from "https://esm.unpkg.com/@y14e/accordion@2.0.13";
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -661,8 +661,8 @@ var Accordion = class _Accordion {
661
661
  return;
662
662
  }
663
663
  this.#rootElement = root;
664
- this.#defaults = this.#mergeOptions(this.#defaults, _Accordion.defaults);
665
- this.#settings = this.#mergeOptions(this.#defaults, options);
664
+ this.#defaults = this.#resolveOptions(this.#defaults, _Accordion.defaults);
665
+ this.#settings = this.#resolveOptions(this.#defaults, options);
666
666
  matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
667
667
  const { trigger, content } = this.#settings.selector;
668
668
  const NOT_NESTED = `:not(:scope ${content} *)`;
@@ -886,7 +886,7 @@ var Accordion = class _Accordion {
886
886
  #isFocusable(element) {
887
887
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
888
888
  }
889
- #mergeOptions(target, source) {
889
+ #resolveOptions(target, source) {
890
890
  const merged = {
891
891
  ...target,
892
892
  ...source,
@@ -895,7 +895,8 @@ var Accordion = class _Accordion {
895
895
  };
896
896
  const mergedAnimation = merged.animation;
897
897
  const duration = mergedAnimation.duration;
898
- const defaultAnimation = this.#defaults.animation;
898
+ const defaults = this.#defaults;
899
+ const defaultAnimation = defaults.animation;
899
900
  if (typeof duration !== "number" || Number.isNaN(duration)) {
900
901
  const duration2 = defaultAnimation.duration;
901
902
  console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
@@ -911,12 +912,12 @@ var Accordion = class _Accordion {
911
912
  mergedAnimation.easing = easing;
912
913
  }
913
914
  if (typeof merged.collapsible !== "boolean") {
914
- const collapsible = this.#defaults.collapsible;
915
+ const collapsible = defaults.collapsible;
915
916
  console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
916
917
  merged.collapsible = collapsible;
917
918
  }
918
919
  const mergedSelector = merged.selector;
919
- const defaultSelector = this.#defaults.selector;
920
+ const defaultSelector = defaults.selector;
920
921
  try {
921
922
  document.querySelector(mergedSelector.content);
922
923
  } catch {
@@ -951,7 +952,7 @@ function waitAnimationFinish(animation) {
951
952
  * Accordion
952
953
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
953
954
  *
954
- * @version 2.0.11
955
+ * @version 2.0.13
955
956
  * @author Yusuke Kamiyamane
956
957
  * @license MIT
957
958
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -659,8 +659,8 @@ var Accordion = class _Accordion {
659
659
  return;
660
660
  }
661
661
  this.#rootElement = root;
662
- this.#defaults = this.#mergeOptions(this.#defaults, _Accordion.defaults);
663
- this.#settings = this.#mergeOptions(this.#defaults, options);
662
+ this.#defaults = this.#resolveOptions(this.#defaults, _Accordion.defaults);
663
+ this.#settings = this.#resolveOptions(this.#defaults, options);
664
664
  matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
665
665
  const { trigger, content } = this.#settings.selector;
666
666
  const NOT_NESTED = `:not(:scope ${content} *)`;
@@ -884,7 +884,7 @@ var Accordion = class _Accordion {
884
884
  #isFocusable(element) {
885
885
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
886
886
  }
887
- #mergeOptions(target, source) {
887
+ #resolveOptions(target, source) {
888
888
  const merged = {
889
889
  ...target,
890
890
  ...source,
@@ -893,7 +893,8 @@ var Accordion = class _Accordion {
893
893
  };
894
894
  const mergedAnimation = merged.animation;
895
895
  const duration = mergedAnimation.duration;
896
- const defaultAnimation = this.#defaults.animation;
896
+ const defaults = this.#defaults;
897
+ const defaultAnimation = defaults.animation;
897
898
  if (typeof duration !== "number" || Number.isNaN(duration)) {
898
899
  const duration2 = defaultAnimation.duration;
899
900
  console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
@@ -909,12 +910,12 @@ var Accordion = class _Accordion {
909
910
  mergedAnimation.easing = easing;
910
911
  }
911
912
  if (typeof merged.collapsible !== "boolean") {
912
- const collapsible = this.#defaults.collapsible;
913
+ const collapsible = defaults.collapsible;
913
914
  console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
914
915
  merged.collapsible = collapsible;
915
916
  }
916
917
  const mergedSelector = merged.selector;
917
- const defaultSelector = this.#defaults.selector;
918
+ const defaultSelector = defaults.selector;
918
919
  try {
919
920
  document.querySelector(mergedSelector.content);
920
921
  } catch {
@@ -949,7 +950,7 @@ function waitAnimationFinish(animation) {
949
950
  * Accordion
950
951
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
951
952
  *
952
- * @version 2.0.11
953
+ * @version 2.0.13
953
954
  * @author Yusuke Kamiyamane
954
955
  * @license MIT
955
956
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -57,8 +57,8 @@ var Accordion = class _Accordion {
57
57
  return;
58
58
  }
59
59
  this.#rootElement = root;
60
- this.#defaults = this.#mergeOptions(this.#defaults, _Accordion.defaults);
61
- this.#settings = this.#mergeOptions(this.#defaults, options);
60
+ this.#defaults = this.#resolveOptions(this.#defaults, _Accordion.defaults);
61
+ this.#settings = this.#resolveOptions(this.#defaults, options);
62
62
  matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
63
63
  const { trigger, content } = this.#settings.selector;
64
64
  const NOT_NESTED = `:not(:scope ${content} *)`;
@@ -282,7 +282,7 @@ var Accordion = class _Accordion {
282
282
  #isFocusable(element) {
283
283
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
284
284
  }
285
- #mergeOptions(target, source) {
285
+ #resolveOptions(target, source) {
286
286
  const merged = {
287
287
  ...target,
288
288
  ...source,
@@ -291,7 +291,8 @@ var Accordion = class _Accordion {
291
291
  };
292
292
  const mergedAnimation = merged.animation;
293
293
  const duration = mergedAnimation.duration;
294
- const defaultAnimation = this.#defaults.animation;
294
+ const defaults = this.#defaults;
295
+ const defaultAnimation = defaults.animation;
295
296
  if (typeof duration !== "number" || Number.isNaN(duration)) {
296
297
  const duration2 = defaultAnimation.duration;
297
298
  console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
@@ -307,12 +308,12 @@ var Accordion = class _Accordion {
307
308
  mergedAnimation.easing = easing;
308
309
  }
309
310
  if (typeof merged.collapsible !== "boolean") {
310
- const collapsible = this.#defaults.collapsible;
311
+ const collapsible = defaults.collapsible;
311
312
  console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
312
313
  merged.collapsible = collapsible;
313
314
  }
314
315
  const mergedSelector = merged.selector;
315
- const defaultSelector = this.#defaults.selector;
316
+ const defaultSelector = defaults.selector;
316
317
  try {
317
318
  document.querySelector(mergedSelector.content);
318
319
  } catch {
@@ -347,7 +348,7 @@ function waitAnimationFinish(animation) {
347
348
  * Accordion
348
349
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
349
350
  *
350
- * @version 2.0.11
351
+ * @version 2.0.13
351
352
  * @author Yusuke Kamiyamane
352
353
  * @license MIT
353
354
  * @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 2.0.11
5
+ * @version 2.0.13
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
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 2.0.11
5
+ * @version 2.0.13
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -35,8 +35,8 @@ var Accordion = class _Accordion {
35
35
  return;
36
36
  }
37
37
  this.#rootElement = root;
38
- this.#defaults = this.#mergeOptions(this.#defaults, _Accordion.defaults);
39
- this.#settings = this.#mergeOptions(this.#defaults, options);
38
+ this.#defaults = this.#resolveOptions(this.#defaults, _Accordion.defaults);
39
+ this.#settings = this.#resolveOptions(this.#defaults, options);
40
40
  matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
41
41
  const { trigger, content } = this.#settings.selector;
42
42
  const NOT_NESTED = `:not(:scope ${content} *)`;
@@ -260,7 +260,7 @@ var Accordion = class _Accordion {
260
260
  #isFocusable(element) {
261
261
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
262
262
  }
263
- #mergeOptions(target, source) {
263
+ #resolveOptions(target, source) {
264
264
  const merged = {
265
265
  ...target,
266
266
  ...source,
@@ -269,7 +269,8 @@ var Accordion = class _Accordion {
269
269
  };
270
270
  const mergedAnimation = merged.animation;
271
271
  const duration = mergedAnimation.duration;
272
- const defaultAnimation = this.#defaults.animation;
272
+ const defaults = this.#defaults;
273
+ const defaultAnimation = defaults.animation;
273
274
  if (typeof duration !== "number" || Number.isNaN(duration)) {
274
275
  const duration2 = defaultAnimation.duration;
275
276
  console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
@@ -285,12 +286,12 @@ var Accordion = class _Accordion {
285
286
  mergedAnimation.easing = easing;
286
287
  }
287
288
  if (typeof merged.collapsible !== "boolean") {
288
- const collapsible = this.#defaults.collapsible;
289
+ const collapsible = defaults.collapsible;
289
290
  console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
290
291
  merged.collapsible = collapsible;
291
292
  }
292
293
  const mergedSelector = merged.selector;
293
- const defaultSelector = this.#defaults.selector;
294
+ const defaultSelector = defaults.selector;
294
295
  try {
295
296
  document.querySelector(mergedSelector.content);
296
297
  } catch {
@@ -325,7 +326,7 @@ function waitAnimationFinish(animation) {
325
326
  * Accordion
326
327
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
327
328
  *
328
- * @version 2.0.11
329
+ * @version 2.0.13
329
330
  * @author Yusuke Kamiyamane
330
331
  * @license MIT
331
332
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/accordion",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "WAI-ARIA compliant accordion pattern implementation in TypeScript",
5
5
  "keywords": [
6
6
  "a11y",