@y14e/accordion 2.0.3 → 2.0.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/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.3
5
+ * @version 2.0.5
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.3
5
+ * @version 2.0.5
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { restoreAttributes, saveAttributes, addTokenToAttribute } from '@y14e/attributes-utils';
1
+ import * as util from '@y14e/attribute-util';
2
2
  import Button from '@y14e/button';
3
3
  import { createRovingTabIndex } from '@y14e/roving-tabindex';
4
4
 
@@ -96,7 +96,10 @@ var Accordion = class _Accordion {
96
96
  });
97
97
  this.#animationController?.abort();
98
98
  this.#animationController = null;
99
- restoreAttributes([...this.#triggerElements, ...this.#contentElements]);
99
+ util.restoreAttributes([
100
+ ...this.#triggerElements,
101
+ ...this.#contentElements
102
+ ]);
100
103
  this.#triggerElements.length = 0;
101
104
  this.#contentElements.length = 0;
102
105
  this.#rootElement.removeAttribute("data-accordion-initialized");
@@ -112,14 +115,18 @@ var Accordion = class _Accordion {
112
115
  this.#toggle(trigger, true);
113
116
  }
114
117
  #initialize() {
115
- saveAttributes(this.#triggerElements, [
118
+ util.saveAttributes(this.#triggerElements, [
116
119
  "aria-controls",
117
120
  "aria-disabled",
118
121
  "id",
119
122
  "style",
120
123
  "tabindex"
121
124
  ]);
122
- saveAttributes(this.#contentElements, ["aria-labelledby", "id", "role"]);
125
+ util.saveAttributes(this.#contentElements, [
126
+ "aria-labelledby",
127
+ "id",
128
+ "role"
129
+ ]);
123
130
  this.#eventController = new AbortController();
124
131
  const { signal } = this.#eventController;
125
132
  this.#triggerElements.forEach((trigger2, i) => {
@@ -129,7 +136,7 @@ var Accordion = class _Accordion {
129
136
  return;
130
137
  }
131
138
  content2.id ||= `accordion-content-${id}`;
132
- addTokenToAttribute(trigger2, "aria-controls", content2.id);
139
+ util.addAttributeToken(trigger2, "aria-controls", content2.id);
133
140
  trigger2.setAttribute(
134
141
  "aria-expanded",
135
142
  String(trigger2.ariaExpanded === "true")
@@ -141,7 +148,7 @@ var Accordion = class _Accordion {
141
148
  trigger2.style.setProperty("pointer-events", "none");
142
149
  }
143
150
  trigger2.addEventListener("click", this.#onTriggerClick, { signal });
144
- addTokenToAttribute(content2, "aria-labelledby", trigger2.id);
151
+ util.addAttributeToken(content2, "aria-labelledby", trigger2.id);
145
152
  content2.setAttribute("role", "region");
146
153
  content2.addEventListener("beforematch", this.#onContentBeforeMatch, {
147
154
  signal
@@ -245,7 +252,7 @@ var Accordion = class _Accordion {
245
252
  );
246
253
  }
247
254
  #createBinding(trigger, content) {
248
- return { trigger, content, animation: null };
255
+ return { animation: null, content, trigger };
249
256
  }
250
257
  #isFocusable(element) {
251
258
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
@@ -276,7 +283,7 @@ function waitAnimationFinish(animation) {
276
283
  * Accordion
277
284
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
278
285
  *
279
- * @version 2.0.3
286
+ * @version 2.0.5
280
287
  * @author Yusuke Kamiyamane
281
288
  * @license MIT
282
289
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/accordion",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "WAI-ARIA compliant accordion pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -51,8 +51,8 @@
51
51
  "node": ">=18"
52
52
  },
53
53
  "dependencies": {
54
- "@y14e/attributes-utils": "^1.1.3",
54
+ "@y14e/attribute-util": "^2.0.0",
55
55
  "@y14e/button": "^1.0.6",
56
- "@y14e/roving-tabindex": "^3.1.9"
56
+ "@y14e/roving-tabindex": "^3.1.20"
57
57
  }
58
58
  }