@y14e/disclosure 2.0.9 → 2.0.11

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/disclosure
13
13
  import { Disclosure } from "@y14e/disclosure";
14
14
 
15
15
  // CDNs
16
- import { Disclosure } from "https://esm.sh/@y14e/disclosure@2.0.9";
16
+ import { Disclosure } from "https://esm.sh/@y14e/disclosure@2.0.11";
17
17
  // or
18
- import { Disclosure } from "https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.9/+esm";
18
+ import { Disclosure } from "https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.11/+esm";
19
19
  // or
20
- import { Disclosure } from "https://esm.unpkg.com/@y14e/disclosure@2.0.9";
20
+ import { Disclosure } from "https://esm.unpkg.com/@y14e/disclosure@2.0.11";
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -366,17 +366,9 @@ var RovingTabIndex = class _RovingTabIndex {
366
366
  noStart = false;
367
367
  }
368
368
  if (selector !== "") {
369
- let hasError = false;
370
- if (typeof selector !== "string" || !selector.trim()) {
371
- hasError = true;
372
- } else {
373
- try {
374
- this.#container.querySelector(selector);
375
- } catch {
376
- hasError = true;
377
- }
378
- }
379
- if (hasError) {
369
+ try {
370
+ document.querySelector(selector);
371
+ } catch {
380
372
  console.warn("Invalid selector. Fallback: no selector string.");
381
373
  selector = "";
382
374
  }
@@ -842,11 +834,34 @@ var Disclosure = class _Disclosure {
842
834
  return element.tabIndex >= 0;
843
835
  }
844
836
  #mergeOptions(target, source) {
845
- return {
837
+ const merged = {
846
838
  ...target,
847
839
  ...source,
848
840
  animation: { ...target.animation, ...source.animation ?? {} }
849
841
  };
842
+ const mergedAnimation = merged.animation;
843
+ const duration = mergedAnimation.duration;
844
+ const defaultAnimation = this.#defaults.animation;
845
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
846
+ const duration2 = defaultAnimation.duration;
847
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
848
+ mergedAnimation.duration = duration2;
849
+ }
850
+ if (duration < 0) {
851
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
852
+ mergedAnimation.duration = 0;
853
+ }
854
+ if (!CSS.supports("animation-timing-function", mergedAnimation.easing)) {
855
+ const easing = defaultAnimation.easing;
856
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
857
+ mergedAnimation.easing = easing;
858
+ }
859
+ if (typeof merged.collapsible !== "boolean") {
860
+ const collapsible = this.#defaults.collapsible;
861
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
862
+ merged.collapsible = collapsible;
863
+ }
864
+ return merged;
850
865
  }
851
866
  async #waitAnimationsFinish() {
852
867
  const promises = [];
@@ -867,7 +882,7 @@ function waitAnimationFinish(animation) {
867
882
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
868
883
  * Using the <details> and <summary> element.
869
884
  *
870
- * @version 2.0.9
885
+ * @version 2.0.11
871
886
  * @author Yusuke Kamiyamane
872
887
  * @license MIT
873
888
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -892,7 +907,7 @@ power-focusable/dist/index.js:
892
907
  * High-precision focus management utility with full composed tree support.
893
908
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
894
909
  *
895
- * @version 4.3.26
910
+ * @version 4.3.28
896
911
  * @author Yusuke Kamiyamane
897
912
  * @license MIT
898
913
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -905,7 +920,7 @@ power-focusable/dist/index.js:
905
920
  * Lightweight roving tabindex utility with fully focus management.
906
921
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
907
922
  *
908
- * @version 3.1.23
923
+ * @version 3.1.25
909
924
  * @author Yusuke Kamiyamane
910
925
  * @license MIT
911
926
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -364,17 +364,9 @@ var RovingTabIndex = class _RovingTabIndex {
364
364
  noStart = false;
365
365
  }
366
366
  if (selector !== "") {
367
- let hasError = false;
368
- if (typeof selector !== "string" || !selector.trim()) {
369
- hasError = true;
370
- } else {
371
- try {
372
- this.#container.querySelector(selector);
373
- } catch {
374
- hasError = true;
375
- }
376
- }
377
- if (hasError) {
367
+ try {
368
+ document.querySelector(selector);
369
+ } catch {
378
370
  console.warn("Invalid selector. Fallback: no selector string.");
379
371
  selector = "";
380
372
  }
@@ -840,11 +832,34 @@ var Disclosure = class _Disclosure {
840
832
  return element.tabIndex >= 0;
841
833
  }
842
834
  #mergeOptions(target, source) {
843
- return {
835
+ const merged = {
844
836
  ...target,
845
837
  ...source,
846
838
  animation: { ...target.animation, ...source.animation ?? {} }
847
839
  };
840
+ const mergedAnimation = merged.animation;
841
+ const duration = mergedAnimation.duration;
842
+ const defaultAnimation = this.#defaults.animation;
843
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
844
+ const duration2 = defaultAnimation.duration;
845
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
846
+ mergedAnimation.duration = duration2;
847
+ }
848
+ if (duration < 0) {
849
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
850
+ mergedAnimation.duration = 0;
851
+ }
852
+ if (!CSS.supports("animation-timing-function", mergedAnimation.easing)) {
853
+ const easing = defaultAnimation.easing;
854
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
855
+ mergedAnimation.easing = easing;
856
+ }
857
+ if (typeof merged.collapsible !== "boolean") {
858
+ const collapsible = this.#defaults.collapsible;
859
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
860
+ merged.collapsible = collapsible;
861
+ }
862
+ return merged;
848
863
  }
849
864
  async #waitAnimationsFinish() {
850
865
  const promises = [];
@@ -865,7 +880,7 @@ function waitAnimationFinish(animation) {
865
880
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
866
881
  * Using the <details> and <summary> element.
867
882
  *
868
- * @version 2.0.9
883
+ * @version 2.0.11
869
884
  * @author Yusuke Kamiyamane
870
885
  * @license MIT
871
886
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -890,7 +905,7 @@ power-focusable/dist/index.js:
890
905
  * High-precision focus management utility with full composed tree support.
891
906
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
892
907
  *
893
- * @version 4.3.26
908
+ * @version 4.3.28
894
909
  * @author Yusuke Kamiyamane
895
910
  * @license MIT
896
911
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -903,7 +918,7 @@ power-focusable/dist/index.js:
903
918
  * Lightweight roving tabindex utility with fully focus management.
904
919
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
905
920
  *
906
- * @version 3.1.23
921
+ * @version 3.1.25
907
922
  * @author Yusuke Kamiyamane
908
923
  * @license MIT
909
924
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -278,11 +278,34 @@ var Disclosure = class _Disclosure {
278
278
  return element.tabIndex >= 0;
279
279
  }
280
280
  #mergeOptions(target, source) {
281
- return {
281
+ const merged = {
282
282
  ...target,
283
283
  ...source,
284
284
  animation: { ...target.animation, ...source.animation ?? {} }
285
285
  };
286
+ const mergedAnimation = merged.animation;
287
+ const duration = mergedAnimation.duration;
288
+ const defaultAnimation = this.#defaults.animation;
289
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
290
+ const duration2 = defaultAnimation.duration;
291
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
292
+ mergedAnimation.duration = duration2;
293
+ }
294
+ if (duration < 0) {
295
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
296
+ mergedAnimation.duration = 0;
297
+ }
298
+ if (!CSS.supports("animation-timing-function", mergedAnimation.easing)) {
299
+ const easing = defaultAnimation.easing;
300
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
301
+ mergedAnimation.easing = easing;
302
+ }
303
+ if (typeof merged.collapsible !== "boolean") {
304
+ const collapsible = this.#defaults.collapsible;
305
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
306
+ merged.collapsible = collapsible;
307
+ }
308
+ return merged;
286
309
  }
287
310
  async #waitAnimationsFinish() {
288
311
  const promises = [];
@@ -303,7 +326,7 @@ function waitAnimationFinish(animation) {
303
326
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
304
327
  * Using the <details> and <summary> element.
305
328
  *
306
- * @version 2.0.9
329
+ * @version 2.0.11
307
330
  * @author Yusuke Kamiyamane
308
331
  * @license MIT
309
332
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
4
4
  * Using the <details> and <summary> element.
5
5
  *
6
- * @version 2.0.9
6
+ * @version 2.0.11
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
4
4
  * Using the <details> and <summary> element.
5
5
  *
6
- * @version 2.0.9
6
+ * @version 2.0.11
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -256,11 +256,34 @@ var Disclosure = class _Disclosure {
256
256
  return element.tabIndex >= 0;
257
257
  }
258
258
  #mergeOptions(target, source) {
259
- return {
259
+ const merged = {
260
260
  ...target,
261
261
  ...source,
262
262
  animation: { ...target.animation, ...source.animation ?? {} }
263
263
  };
264
+ const mergedAnimation = merged.animation;
265
+ const duration = mergedAnimation.duration;
266
+ const defaultAnimation = this.#defaults.animation;
267
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
268
+ const duration2 = defaultAnimation.duration;
269
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
270
+ mergedAnimation.duration = duration2;
271
+ }
272
+ if (duration < 0) {
273
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
274
+ mergedAnimation.duration = 0;
275
+ }
276
+ if (!CSS.supports("animation-timing-function", mergedAnimation.easing)) {
277
+ const easing = defaultAnimation.easing;
278
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
279
+ mergedAnimation.easing = easing;
280
+ }
281
+ if (typeof merged.collapsible !== "boolean") {
282
+ const collapsible = this.#defaults.collapsible;
283
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
284
+ merged.collapsible = collapsible;
285
+ }
286
+ return merged;
264
287
  }
265
288
  async #waitAnimationsFinish() {
266
289
  const promises = [];
@@ -281,7 +304,7 @@ function waitAnimationFinish(animation) {
281
304
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
282
305
  * Using the <details> and <summary> element.
283
306
  *
284
- * @version 2.0.9
307
+ * @version 2.0.11
285
308
  * @author Yusuke Kamiyamane
286
309
  * @license MIT
287
310
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/disclosure",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -55,6 +55,6 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@y14e/attribute-utils": "^2.0.5",
58
- "@y14e/roving-tabindex": "^3.1.23"
58
+ "@y14e/roving-tabindex": "^3.1.25"
59
59
  }
60
60
  }