@y14e/disclosure 2.2.1 → 2.2.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.
@@ -743,7 +743,9 @@ var Disclosure = class _Disclosure {
743
743
  resolveOptions4(defaults, _Disclosure.defaults),
744
744
  options
745
745
  );
746
- matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
746
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
747
+ this.#settings.animation.duration = 0;
748
+ }
747
749
  const NOT_NESTED = ":not(:scope summary + * *)";
748
750
  this.#detailsElements = [
749
751
  ...this.#rootElement.querySelectorAll(
@@ -779,9 +781,9 @@ var Disclosure = class _Disclosure {
779
781
  return;
780
782
  }
781
783
  const binding = this.#createBinding(details, summary, content);
782
- this.#bindings.set(details, binding);
783
- this.#bindings.set(summary, binding);
784
- this.#bindings.set(content, binding);
784
+ [details, summary, content].forEach((element) => {
785
+ this.#bindings.set(element, binding);
786
+ });
785
787
  });
786
788
  this.#initialize();
787
789
  }
@@ -741,7 +741,9 @@ var Disclosure = class _Disclosure {
741
741
  resolveOptions4(defaults, _Disclosure.defaults),
742
742
  options
743
743
  );
744
- matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
744
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
745
+ this.#settings.animation.duration = 0;
746
+ }
745
747
  const NOT_NESTED = ":not(:scope summary + * *)";
746
748
  this.#detailsElements = [
747
749
  ...this.#rootElement.querySelectorAll(
@@ -777,9 +779,9 @@ var Disclosure = class _Disclosure {
777
779
  return;
778
780
  }
779
781
  const binding = this.#createBinding(details, summary, content);
780
- this.#bindings.set(details, binding);
781
- this.#bindings.set(summary, binding);
782
- this.#bindings.set(content, binding);
782
+ [details, summary, content].forEach((element) => {
783
+ this.#bindings.set(element, binding);
784
+ });
783
785
  });
784
786
  this.#initialize();
785
787
  }
package/dist/index.cjs CHANGED
@@ -73,7 +73,9 @@ var Disclosure = class _Disclosure {
73
73
  resolveOptions(defaults, _Disclosure.defaults),
74
74
  options
75
75
  );
76
- matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
76
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
77
+ this.#settings.animation.duration = 0;
78
+ }
77
79
  const NOT_NESTED = ":not(:scope summary + * *)";
78
80
  this.#detailsElements = [
79
81
  ...this.#rootElement.querySelectorAll(
@@ -109,9 +111,9 @@ var Disclosure = class _Disclosure {
109
111
  return;
110
112
  }
111
113
  const binding = this.#createBinding(details, summary, content);
112
- this.#bindings.set(details, binding);
113
- this.#bindings.set(summary, binding);
114
- this.#bindings.set(content, binding);
114
+ [details, summary, content].forEach((element) => {
115
+ this.#bindings.set(element, binding);
116
+ });
115
117
  });
116
118
  this.#initialize();
117
119
  }
package/dist/index.js CHANGED
@@ -71,7 +71,9 @@ var Disclosure = class _Disclosure {
71
71
  resolveOptions(defaults, _Disclosure.defaults),
72
72
  options
73
73
  );
74
- matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
74
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
75
+ this.#settings.animation.duration = 0;
76
+ }
75
77
  const NOT_NESTED = ":not(:scope summary + * *)";
76
78
  this.#detailsElements = [
77
79
  ...this.#rootElement.querySelectorAll(
@@ -107,9 +109,9 @@ var Disclosure = class _Disclosure {
107
109
  return;
108
110
  }
109
111
  const binding = this.#createBinding(details, summary, content);
110
- this.#bindings.set(details, binding);
111
- this.#bindings.set(summary, binding);
112
- this.#bindings.set(content, binding);
112
+ [details, summary, content].forEach((element) => {
113
+ this.#bindings.set(element, binding);
114
+ });
113
115
  });
114
116
  this.#initialize();
115
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/disclosure",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
5
5
  "keywords": [
6
6
  "a11y",