@y14e/accordion 2.0.9 → 2.0.10

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.9";
16
+ import { Accordion } from "https://esm.sh/@y14e/accordion@2.0.10";
17
17
  // or
18
- import { Accordion } from "https://cdn.jsdelivr.net/npm/@y14e/accordion@2.0.9/+esm";
18
+ import { Accordion } from "https://cdn.jsdelivr.net/npm/@y14e/accordion@2.0.10/+esm";
19
19
  // or
20
- import { Accordion } from "https://esm.unpkg.com/@y14e/accordion@2.0.9";
20
+ import { Accordion } from "https://esm.unpkg.com/@y14e/accordion@2.0.10";
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -415,17 +415,9 @@ var RovingTabIndex = class _RovingTabIndex {
415
415
  noStart = false;
416
416
  }
417
417
  if (selector !== "") {
418
- let hasError = false;
419
- if (typeof selector !== "string" || !selector.trim()) {
420
- hasError = true;
421
- } else {
422
- try {
423
- this.#container.querySelector(selector);
424
- } catch {
425
- hasError = true;
426
- }
427
- }
428
- if (hasError) {
418
+ try {
419
+ document.querySelector(selector);
420
+ } catch {
429
421
  console.warn("Invalid selector. Fallback: no selector string.");
430
422
  selector = "";
431
423
  }
@@ -641,7 +633,10 @@ var Accordion = class _Accordion {
641
633
  static defaults = {};
642
634
  #rootElement;
643
635
  #defaults = {
644
- animation: { duration: 300, easing: "ease" },
636
+ animation: {
637
+ duration: 300,
638
+ easing: "ease"
639
+ },
645
640
  collapsible: true,
646
641
  selector: {
647
642
  content: "[data-accordion-content]",
@@ -892,12 +887,49 @@ var Accordion = class _Accordion {
892
887
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
893
888
  }
894
889
  #mergeOptions(target, source) {
895
- return {
890
+ const merged = {
896
891
  ...target,
897
892
  ...source,
898
893
  animation: { ...target.animation, ...source.animation ?? {} },
899
894
  selector: { ...target.selector, ...source.selector ?? {} }
900
895
  };
896
+ const animation = merged.animation;
897
+ const duration = animation.duration;
898
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
899
+ const duration2 = this.#defaults.animation.duration;
900
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
901
+ animation.duration = duration2;
902
+ }
903
+ if (duration < 0) {
904
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
905
+ animation.duration = 0;
906
+ }
907
+ if (!CSS.supports("animation-timing-function", animation.easing)) {
908
+ const easing = this.#defaults.animation.easing;
909
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
910
+ animation.easing = easing;
911
+ }
912
+ if (typeof merged.collapsible !== "boolean") {
913
+ const collapsible = this.#defaults.collapsible;
914
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
915
+ merged.collapsible = collapsible;
916
+ }
917
+ const selector = merged.selector;
918
+ try {
919
+ document.querySelector(selector.content);
920
+ } catch {
921
+ const content = this.#defaults.selector.content;
922
+ console.warn(`Invalid content selector. Fallback: '${content}'.`);
923
+ selector.content = content;
924
+ }
925
+ try {
926
+ document.querySelector(selector.trigger);
927
+ } catch {
928
+ const trigger = this.#defaults.selector.trigger;
929
+ console.warn(`Invalid trigger selector. Fallback: '${trigger}'.`);
930
+ selector.trigger = trigger;
931
+ }
932
+ return merged;
901
933
  }
902
934
  async #waitAnimationsFinish() {
903
935
  const promises = [];
@@ -917,7 +949,7 @@ function waitAnimationFinish(animation) {
917
949
  * Accordion
918
950
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
919
951
  *
920
- * @version 2.0.9
952
+ * @version 2.0.10
921
953
  * @author Yusuke Kamiyamane
922
954
  * @license MIT
923
955
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -942,7 +974,7 @@ power-focusable/dist/index.js:
942
974
  * High-precision focus management utility with full composed tree support.
943
975
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
944
976
  *
945
- * @version 4.3.26
977
+ * @version 4.3.28
946
978
  * @author Yusuke Kamiyamane
947
979
  * @license MIT
948
980
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -966,7 +998,7 @@ power-focusable/dist/index.js:
966
998
  * Lightweight roving tabindex utility with fully focus management.
967
999
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
968
1000
  *
969
- * @version 3.1.23
1001
+ * @version 3.1.25
970
1002
  * @author Yusuke Kamiyamane
971
1003
  * @license MIT
972
1004
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -413,17 +413,9 @@ var RovingTabIndex = class _RovingTabIndex {
413
413
  noStart = false;
414
414
  }
415
415
  if (selector !== "") {
416
- let hasError = false;
417
- if (typeof selector !== "string" || !selector.trim()) {
418
- hasError = true;
419
- } else {
420
- try {
421
- this.#container.querySelector(selector);
422
- } catch {
423
- hasError = true;
424
- }
425
- }
426
- if (hasError) {
416
+ try {
417
+ document.querySelector(selector);
418
+ } catch {
427
419
  console.warn("Invalid selector. Fallback: no selector string.");
428
420
  selector = "";
429
421
  }
@@ -639,7 +631,10 @@ var Accordion = class _Accordion {
639
631
  static defaults = {};
640
632
  #rootElement;
641
633
  #defaults = {
642
- animation: { duration: 300, easing: "ease" },
634
+ animation: {
635
+ duration: 300,
636
+ easing: "ease"
637
+ },
643
638
  collapsible: true,
644
639
  selector: {
645
640
  content: "[data-accordion-content]",
@@ -890,12 +885,49 @@ var Accordion = class _Accordion {
890
885
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
891
886
  }
892
887
  #mergeOptions(target, source) {
893
- return {
888
+ const merged = {
894
889
  ...target,
895
890
  ...source,
896
891
  animation: { ...target.animation, ...source.animation ?? {} },
897
892
  selector: { ...target.selector, ...source.selector ?? {} }
898
893
  };
894
+ const animation = merged.animation;
895
+ const duration = animation.duration;
896
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
897
+ const duration2 = this.#defaults.animation.duration;
898
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
899
+ animation.duration = duration2;
900
+ }
901
+ if (duration < 0) {
902
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
903
+ animation.duration = 0;
904
+ }
905
+ if (!CSS.supports("animation-timing-function", animation.easing)) {
906
+ const easing = this.#defaults.animation.easing;
907
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
908
+ animation.easing = easing;
909
+ }
910
+ if (typeof merged.collapsible !== "boolean") {
911
+ const collapsible = this.#defaults.collapsible;
912
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
913
+ merged.collapsible = collapsible;
914
+ }
915
+ const selector = merged.selector;
916
+ try {
917
+ document.querySelector(selector.content);
918
+ } catch {
919
+ const content = this.#defaults.selector.content;
920
+ console.warn(`Invalid content selector. Fallback: '${content}'.`);
921
+ selector.content = content;
922
+ }
923
+ try {
924
+ document.querySelector(selector.trigger);
925
+ } catch {
926
+ const trigger = this.#defaults.selector.trigger;
927
+ console.warn(`Invalid trigger selector. Fallback: '${trigger}'.`);
928
+ selector.trigger = trigger;
929
+ }
930
+ return merged;
899
931
  }
900
932
  async #waitAnimationsFinish() {
901
933
  const promises = [];
@@ -915,7 +947,7 @@ function waitAnimationFinish(animation) {
915
947
  * Accordion
916
948
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
917
949
  *
918
- * @version 2.0.9
950
+ * @version 2.0.10
919
951
  * @author Yusuke Kamiyamane
920
952
  * @license MIT
921
953
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -940,7 +972,7 @@ power-focusable/dist/index.js:
940
972
  * High-precision focus management utility with full composed tree support.
941
973
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
942
974
  *
943
- * @version 4.3.26
975
+ * @version 4.3.28
944
976
  * @author Yusuke Kamiyamane
945
977
  * @license MIT
946
978
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -964,7 +996,7 @@ power-focusable/dist/index.js:
964
996
  * Lightweight roving tabindex utility with fully focus management.
965
997
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
966
998
  *
967
- * @version 3.1.23
999
+ * @version 3.1.25
968
1000
  * @author Yusuke Kamiyamane
969
1001
  * @license MIT
970
1002
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -29,7 +29,10 @@ var Accordion = class _Accordion {
29
29
  static defaults = {};
30
30
  #rootElement;
31
31
  #defaults = {
32
- animation: { duration: 300, easing: "ease" },
32
+ animation: {
33
+ duration: 300,
34
+ easing: "ease"
35
+ },
33
36
  collapsible: true,
34
37
  selector: {
35
38
  content: "[data-accordion-content]",
@@ -280,12 +283,49 @@ var Accordion = class _Accordion {
280
283
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
281
284
  }
282
285
  #mergeOptions(target, source) {
283
- return {
286
+ const merged = {
284
287
  ...target,
285
288
  ...source,
286
289
  animation: { ...target.animation, ...source.animation ?? {} },
287
290
  selector: { ...target.selector, ...source.selector ?? {} }
288
291
  };
292
+ const animation = merged.animation;
293
+ const duration = animation.duration;
294
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
295
+ const duration2 = this.#defaults.animation.duration;
296
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
297
+ animation.duration = duration2;
298
+ }
299
+ if (duration < 0) {
300
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
301
+ animation.duration = 0;
302
+ }
303
+ if (!CSS.supports("animation-timing-function", animation.easing)) {
304
+ const easing = this.#defaults.animation.easing;
305
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
306
+ animation.easing = easing;
307
+ }
308
+ if (typeof merged.collapsible !== "boolean") {
309
+ const collapsible = this.#defaults.collapsible;
310
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
311
+ merged.collapsible = collapsible;
312
+ }
313
+ const selector = merged.selector;
314
+ try {
315
+ document.querySelector(selector.content);
316
+ } catch {
317
+ const content = this.#defaults.selector.content;
318
+ console.warn(`Invalid content selector. Fallback: '${content}'.`);
319
+ selector.content = content;
320
+ }
321
+ try {
322
+ document.querySelector(selector.trigger);
323
+ } catch {
324
+ const trigger = this.#defaults.selector.trigger;
325
+ console.warn(`Invalid trigger selector. Fallback: '${trigger}'.`);
326
+ selector.trigger = trigger;
327
+ }
328
+ return merged;
289
329
  }
290
330
  async #waitAnimationsFinish() {
291
331
  const promises = [];
@@ -305,7 +345,7 @@ function waitAnimationFinish(animation) {
305
345
  * Accordion
306
346
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
307
347
  *
308
- * @version 2.0.9
348
+ * @version 2.0.10
309
349
  * @author Yusuke Kamiyamane
310
350
  * @license MIT
311
351
  * @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.9
5
+ * @version 2.0.10
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.9
5
+ * @version 2.0.10
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -7,7 +7,10 @@ var Accordion = class _Accordion {
7
7
  static defaults = {};
8
8
  #rootElement;
9
9
  #defaults = {
10
- animation: { duration: 300, easing: "ease" },
10
+ animation: {
11
+ duration: 300,
12
+ easing: "ease"
13
+ },
11
14
  collapsible: true,
12
15
  selector: {
13
16
  content: "[data-accordion-content]",
@@ -258,12 +261,49 @@ var Accordion = class _Accordion {
258
261
  return !element.hasAttribute("disabled") && element.tabIndex >= 0;
259
262
  }
260
263
  #mergeOptions(target, source) {
261
- return {
264
+ const merged = {
262
265
  ...target,
263
266
  ...source,
264
267
  animation: { ...target.animation, ...source.animation ?? {} },
265
268
  selector: { ...target.selector, ...source.selector ?? {} }
266
269
  };
270
+ const animation = merged.animation;
271
+ const duration = animation.duration;
272
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
273
+ const duration2 = this.#defaults.animation.duration;
274
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
275
+ animation.duration = duration2;
276
+ }
277
+ if (duration < 0) {
278
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
279
+ animation.duration = 0;
280
+ }
281
+ if (!CSS.supports("animation-timing-function", animation.easing)) {
282
+ const easing = this.#defaults.animation.easing;
283
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
284
+ animation.easing = easing;
285
+ }
286
+ if (typeof merged.collapsible !== "boolean") {
287
+ const collapsible = this.#defaults.collapsible;
288
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
289
+ merged.collapsible = collapsible;
290
+ }
291
+ const selector = merged.selector;
292
+ try {
293
+ document.querySelector(selector.content);
294
+ } catch {
295
+ const content = this.#defaults.selector.content;
296
+ console.warn(`Invalid content selector. Fallback: '${content}'.`);
297
+ selector.content = content;
298
+ }
299
+ try {
300
+ document.querySelector(selector.trigger);
301
+ } catch {
302
+ const trigger = this.#defaults.selector.trigger;
303
+ console.warn(`Invalid trigger selector. Fallback: '${trigger}'.`);
304
+ selector.trigger = trigger;
305
+ }
306
+ return merged;
267
307
  }
268
308
  async #waitAnimationsFinish() {
269
309
  const promises = [];
@@ -283,7 +323,7 @@ function waitAnimationFinish(animation) {
283
323
  * Accordion
284
324
  * WAI-ARIA compliant accordion pattern implementation in TypeScript.
285
325
  *
286
- * @version 2.0.9
326
+ * @version 2.0.10
287
327
  * @author Yusuke Kamiyamane
288
328
  * @license MIT
289
329
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,11 +1,27 @@
1
1
  {
2
2
  "name": "@y14e/accordion",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "WAI-ARIA compliant accordion pattern implementation in TypeScript",
5
+ "keywords": [
6
+ "a11y",
7
+ "accessibility",
8
+ "accordion",
9
+ "collapsible",
10
+ "component",
11
+ "typescript",
12
+ "utility"
13
+ ],
14
+ "homepage": "https://github.com/y14e/accordion#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/y14e/accordion/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/y14e/accordion.git"
21
+ },
22
+ "license": "MIT",
23
+ "author": "Yusuke Kamiyamane",
5
24
  "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
25
  "exports": {
10
26
  ".": {
11
27
  "types": "./dist/index.d.ts",
@@ -13,6 +29,9 @@
13
29
  "require": "./dist/index.cjs"
14
30
  }
15
31
  },
32
+ "main": "./dist/index.cjs",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
16
35
  "files": [
17
36
  "dist",
18
37
  "LICENSE",
@@ -20,28 +39,9 @@
20
39
  ],
21
40
  "scripts": {
22
41
  "build": "tsup",
23
- "prepublishOnly": "npm run build",
24
- "lint": "tsc --noEmit"
25
- },
26
- "keywords": [
27
- "a11y",
28
- "accessibility",
29
- "accordion",
30
- "collapsible",
31
- "component",
32
- "typescript",
33
- "utility"
34
- ],
35
- "author": "Yusuke Kamiyamane",
36
- "license": "MIT",
37
- "repository": {
38
- "type": "git",
39
- "url": "git+https://github.com/y14e/accordion.git"
42
+ "lint": "tsc --noEmit",
43
+ "prepublishOnly": "npm run build"
40
44
  },
41
- "bugs": {
42
- "url": "https://github.com/y14e/accordion/issues"
43
- },
44
- "homepage": "https://github.com/y14e/accordion#readme",
45
45
  "devDependencies": {
46
46
  "bun-types": "latest",
47
47
  "tsup": "^8.0.0",
@@ -56,6 +56,6 @@
56
56
  "dependencies": {
57
57
  "@y14e/attribute-utils": "^2.0.5",
58
58
  "@y14e/button": "^1.0.8",
59
- "@y14e/roving-tabindex": "^3.1.23"
59
+ "@y14e/roving-tabindex": "^3.1.25"
60
60
  }
61
61
  }