@y14e/accordion 2.0.16 → 2.1.1

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.16';
16
+ import { Accordion } from 'https://esm.sh/@y14e/accordion@2.1.1';
17
17
  // or
18
- import { Accordion } from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@2.0.16/+esm';
18
+ import { Accordion } from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@2.1.1/+esm';
19
19
  // or
20
- import { Accordion } from 'https://esm.unpkg.com/@y14e/accordion@2.0.16';
20
+ import { Accordion } from 'https://esm.unpkg.com/@y14e/accordion@2.1.1';
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -759,10 +759,7 @@ var Accordion = class _Accordion {
759
759
  }
760
760
  this.#animationController?.abort();
761
761
  this.#animationController = null;
762
- restoreAttributes([
763
- ...this.#triggerElements,
764
- ...this.#contentElements
765
- ]);
762
+ restoreAttributes([...this.#triggerElements, ...this.#contentElements]);
766
763
  this.#triggerElements.length = 0;
767
764
  this.#contentElements.length = 0;
768
765
  this.#rootElement.removeAttribute("data-accordion-initialized");
@@ -785,11 +782,7 @@ var Accordion = class _Accordion {
785
782
  "style",
786
783
  "tabindex"
787
784
  ]);
788
- saveAttributes(this.#contentElements, [
789
- "aria-labelledby",
790
- "id",
791
- "role"
792
- ]);
785
+ saveAttributes(this.#contentElements, ["aria-labelledby", "id", "role"]);
793
786
  this.#eventController = new AbortController();
794
787
  const { signal } = this.#eventController;
795
788
  this.#triggerElements.forEach((trigger2, i) => {
@@ -986,7 +979,7 @@ function waitAnimationFinish(animation) {
986
979
  * Accordion
987
980
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
988
981
  *
989
- * @version 2.0.16
982
+ * @version 2.1.0
990
983
  * @author Yusuke Kamiyamane
991
984
  * @license MIT
992
985
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -757,10 +757,7 @@ var Accordion = class _Accordion {
757
757
  }
758
758
  this.#animationController?.abort();
759
759
  this.#animationController = null;
760
- restoreAttributes([
761
- ...this.#triggerElements,
762
- ...this.#contentElements
763
- ]);
760
+ restoreAttributes([...this.#triggerElements, ...this.#contentElements]);
764
761
  this.#triggerElements.length = 0;
765
762
  this.#contentElements.length = 0;
766
763
  this.#rootElement.removeAttribute("data-accordion-initialized");
@@ -783,11 +780,7 @@ var Accordion = class _Accordion {
783
780
  "style",
784
781
  "tabindex"
785
782
  ]);
786
- saveAttributes(this.#contentElements, [
787
- "aria-labelledby",
788
- "id",
789
- "role"
790
- ]);
783
+ saveAttributes(this.#contentElements, ["aria-labelledby", "id", "role"]);
791
784
  this.#eventController = new AbortController();
792
785
  const { signal } = this.#eventController;
793
786
  this.#triggerElements.forEach((trigger2, i) => {
@@ -984,7 +977,7 @@ function waitAnimationFinish(animation) {
984
977
  * Accordion
985
978
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
986
979
  *
987
- * @version 2.0.16
980
+ * @version 2.1.0
988
981
  * @author Yusuke Kamiyamane
989
982
  * @license MIT
990
983
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -1,29 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('@y14e/attribute-utils');
3
+ var attributeUtils = require('@y14e/attribute-utils');
4
4
  var button = require('@y14e/button');
5
5
  var rovingTabindex = require('@y14e/roving-tabindex');
6
6
 
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n.default = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var utils__namespace = /*#__PURE__*/_interopNamespace(utils);
26
-
27
7
  // src/index.ts
28
8
  var Accordion = class _Accordion {
29
9
  static defaults = {};
@@ -121,10 +101,7 @@ var Accordion = class _Accordion {
121
101
  }
122
102
  this.#animationController?.abort();
123
103
  this.#animationController = null;
124
- utils__namespace.restoreAttributes([
125
- ...this.#triggerElements,
126
- ...this.#contentElements
127
- ]);
104
+ attributeUtils.restoreAttributes([...this.#triggerElements, ...this.#contentElements]);
128
105
  this.#triggerElements.length = 0;
129
106
  this.#contentElements.length = 0;
130
107
  this.#rootElement.removeAttribute("data-accordion-initialized");
@@ -140,18 +117,14 @@ var Accordion = class _Accordion {
140
117
  this.#toggle(trigger, true);
141
118
  }
142
119
  #initialize() {
143
- utils__namespace.saveAttributes(this.#triggerElements, [
120
+ attributeUtils.saveAttributes(this.#triggerElements, [
144
121
  "aria-controls",
145
122
  "aria-disabled",
146
123
  "id",
147
124
  "style",
148
125
  "tabindex"
149
126
  ]);
150
- utils__namespace.saveAttributes(this.#contentElements, [
151
- "aria-labelledby",
152
- "id",
153
- "role"
154
- ]);
127
+ attributeUtils.saveAttributes(this.#contentElements, ["aria-labelledby", "id", "role"]);
155
128
  this.#eventController = new AbortController();
156
129
  const { signal } = this.#eventController;
157
130
  this.#triggerElements.forEach((trigger2, i) => {
@@ -161,7 +134,7 @@ var Accordion = class _Accordion {
161
134
  return;
162
135
  }
163
136
  content2.id ||= `accordion-content-${id}`;
164
- utils__namespace.addAttributeToken(trigger2, "aria-controls", content2.id);
137
+ attributeUtils.addAttributeToken(trigger2, "aria-controls", content2.id);
165
138
  trigger2.setAttribute(
166
139
  "aria-expanded",
167
140
  String(trigger2.ariaExpanded === "true")
@@ -173,7 +146,7 @@ var Accordion = class _Accordion {
173
146
  trigger2.style.setProperty("pointer-events", "none");
174
147
  }
175
148
  trigger2.addEventListener("click", this.#onTriggerClick, { signal });
176
- utils__namespace.addAttributeToken(content2, "aria-labelledby", trigger2.id);
149
+ attributeUtils.addAttributeToken(content2, "aria-labelledby", trigger2.id);
177
150
  content2.setAttribute("role", "region");
178
151
  content2.addEventListener("beforematch", this.#onContentBeforeMatch, {
179
152
  signal
@@ -348,7 +321,7 @@ function waitAnimationFinish(animation) {
348
321
  * Accordion
349
322
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
350
323
  *
351
- * @version 2.0.16
324
+ * @version 2.1.0
352
325
  * @author Yusuke Kamiyamane
353
326
  * @license MIT
354
327
  * @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.16
5
+ * @version 2.1.0
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.16
5
+ * @version 2.1.0
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 * as utils from '@y14e/attribute-utils';
1
+ import { restoreAttributes, saveAttributes, addAttributeToken } from '@y14e/attribute-utils';
2
2
  import { Button } from '@y14e/button';
3
3
  import { createRovingTabIndex } from '@y14e/roving-tabindex';
4
4
 
@@ -99,10 +99,7 @@ var Accordion = class _Accordion {
99
99
  }
100
100
  this.#animationController?.abort();
101
101
  this.#animationController = null;
102
- utils.restoreAttributes([
103
- ...this.#triggerElements,
104
- ...this.#contentElements
105
- ]);
102
+ restoreAttributes([...this.#triggerElements, ...this.#contentElements]);
106
103
  this.#triggerElements.length = 0;
107
104
  this.#contentElements.length = 0;
108
105
  this.#rootElement.removeAttribute("data-accordion-initialized");
@@ -118,18 +115,14 @@ var Accordion = class _Accordion {
118
115
  this.#toggle(trigger, true);
119
116
  }
120
117
  #initialize() {
121
- utils.saveAttributes(this.#triggerElements, [
118
+ saveAttributes(this.#triggerElements, [
122
119
  "aria-controls",
123
120
  "aria-disabled",
124
121
  "id",
125
122
  "style",
126
123
  "tabindex"
127
124
  ]);
128
- utils.saveAttributes(this.#contentElements, [
129
- "aria-labelledby",
130
- "id",
131
- "role"
132
- ]);
125
+ saveAttributes(this.#contentElements, ["aria-labelledby", "id", "role"]);
133
126
  this.#eventController = new AbortController();
134
127
  const { signal } = this.#eventController;
135
128
  this.#triggerElements.forEach((trigger2, i) => {
@@ -139,7 +132,7 @@ var Accordion = class _Accordion {
139
132
  return;
140
133
  }
141
134
  content2.id ||= `accordion-content-${id}`;
142
- utils.addAttributeToken(trigger2, "aria-controls", content2.id);
135
+ addAttributeToken(trigger2, "aria-controls", content2.id);
143
136
  trigger2.setAttribute(
144
137
  "aria-expanded",
145
138
  String(trigger2.ariaExpanded === "true")
@@ -151,7 +144,7 @@ var Accordion = class _Accordion {
151
144
  trigger2.style.setProperty("pointer-events", "none");
152
145
  }
153
146
  trigger2.addEventListener("click", this.#onTriggerClick, { signal });
154
- utils.addAttributeToken(content2, "aria-labelledby", trigger2.id);
147
+ addAttributeToken(content2, "aria-labelledby", trigger2.id);
155
148
  content2.setAttribute("role", "region");
156
149
  content2.addEventListener("beforematch", this.#onContentBeforeMatch, {
157
150
  signal
@@ -326,7 +319,7 @@ function waitAnimationFinish(animation) {
326
319
  * Accordion
327
320
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
328
321
  *
329
- * @version 2.0.16
322
+ * @version 2.1.0
330
323
  * @author Yusuke Kamiyamane
331
324
  * @license MIT
332
325
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/accordion",
3
- "version": "2.0.16",
3
+ "version": "2.1.1",
4
4
  "description": "WAI-ARIA compliant accordion pattern implementation in TypeScript",
5
5
  "keywords": [
6
6
  "a11y",