@y14e/disclosure 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/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.10";
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.10/+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.10";
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,33 @@ 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 animation = merged.animation;
843
+ const duration = animation.duration;
844
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
845
+ const duration2 = this.#defaults.animation.duration;
846
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
847
+ animation.duration = duration2;
848
+ }
849
+ if (duration < 0) {
850
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
851
+ animation.duration = 0;
852
+ }
853
+ if (!CSS.supports("animation-timing-function", animation.easing)) {
854
+ const easing = this.#defaults.animation.easing;
855
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
856
+ animation.easing = easing;
857
+ }
858
+ if (typeof merged.collapsible !== "boolean") {
859
+ const collapsible = this.#defaults.collapsible;
860
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
861
+ merged.collapsible = collapsible;
862
+ }
863
+ return merged;
850
864
  }
851
865
  async #waitAnimationsFinish() {
852
866
  const promises = [];
@@ -867,7 +881,7 @@ function waitAnimationFinish(animation) {
867
881
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
868
882
  * Using the <details> and <summary> element.
869
883
  *
870
- * @version 2.0.9
884
+ * @version 2.0.10
871
885
  * @author Yusuke Kamiyamane
872
886
  * @license MIT
873
887
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -892,7 +906,7 @@ power-focusable/dist/index.js:
892
906
  * High-precision focus management utility with full composed tree support.
893
907
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
894
908
  *
895
- * @version 4.3.26
909
+ * @version 4.3.28
896
910
  * @author Yusuke Kamiyamane
897
911
  * @license MIT
898
912
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -905,7 +919,7 @@ power-focusable/dist/index.js:
905
919
  * Lightweight roving tabindex utility with fully focus management.
906
920
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
907
921
  *
908
- * @version 3.1.23
922
+ * @version 3.1.25
909
923
  * @author Yusuke Kamiyamane
910
924
  * @license MIT
911
925
  * @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,33 @@ 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 animation = merged.animation;
841
+ const duration = animation.duration;
842
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
843
+ const duration2 = this.#defaults.animation.duration;
844
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
845
+ animation.duration = duration2;
846
+ }
847
+ if (duration < 0) {
848
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
849
+ animation.duration = 0;
850
+ }
851
+ if (!CSS.supports("animation-timing-function", animation.easing)) {
852
+ const easing = this.#defaults.animation.easing;
853
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
854
+ animation.easing = easing;
855
+ }
856
+ if (typeof merged.collapsible !== "boolean") {
857
+ const collapsible = this.#defaults.collapsible;
858
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
859
+ merged.collapsible = collapsible;
860
+ }
861
+ return merged;
848
862
  }
849
863
  async #waitAnimationsFinish() {
850
864
  const promises = [];
@@ -865,7 +879,7 @@ function waitAnimationFinish(animation) {
865
879
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
866
880
  * Using the <details> and <summary> element.
867
881
  *
868
- * @version 2.0.9
882
+ * @version 2.0.10
869
883
  * @author Yusuke Kamiyamane
870
884
  * @license MIT
871
885
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -890,7 +904,7 @@ power-focusable/dist/index.js:
890
904
  * High-precision focus management utility with full composed tree support.
891
905
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
892
906
  *
893
- * @version 4.3.26
907
+ * @version 4.3.28
894
908
  * @author Yusuke Kamiyamane
895
909
  * @license MIT
896
910
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -903,7 +917,7 @@ power-focusable/dist/index.js:
903
917
  * Lightweight roving tabindex utility with fully focus management.
904
918
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
905
919
  *
906
- * @version 3.1.23
920
+ * @version 3.1.25
907
921
  * @author Yusuke Kamiyamane
908
922
  * @license MIT
909
923
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -278,11 +278,33 @@ 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 animation = merged.animation;
287
+ const duration = animation.duration;
288
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
289
+ const duration2 = this.#defaults.animation.duration;
290
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
291
+ animation.duration = duration2;
292
+ }
293
+ if (duration < 0) {
294
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
295
+ animation.duration = 0;
296
+ }
297
+ if (!CSS.supports("animation-timing-function", animation.easing)) {
298
+ const easing = this.#defaults.animation.easing;
299
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
300
+ animation.easing = easing;
301
+ }
302
+ if (typeof merged.collapsible !== "boolean") {
303
+ const collapsible = this.#defaults.collapsible;
304
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
305
+ merged.collapsible = collapsible;
306
+ }
307
+ return merged;
286
308
  }
287
309
  async #waitAnimationsFinish() {
288
310
  const promises = [];
@@ -303,7 +325,7 @@ function waitAnimationFinish(animation) {
303
325
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
304
326
  * Using the <details> and <summary> element.
305
327
  *
306
- * @version 2.0.9
328
+ * @version 2.0.10
307
329
  * @author Yusuke Kamiyamane
308
330
  * @license MIT
309
331
  * @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.10
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.10
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -256,11 +256,33 @@ 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 animation = merged.animation;
265
+ const duration = animation.duration;
266
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
267
+ const duration2 = this.#defaults.animation.duration;
268
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
269
+ animation.duration = duration2;
270
+ }
271
+ if (duration < 0) {
272
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
273
+ animation.duration = 0;
274
+ }
275
+ if (!CSS.supports("animation-timing-function", animation.easing)) {
276
+ const easing = this.#defaults.animation.easing;
277
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
278
+ animation.easing = easing;
279
+ }
280
+ if (typeof merged.collapsible !== "boolean") {
281
+ const collapsible = this.#defaults.collapsible;
282
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
283
+ merged.collapsible = collapsible;
284
+ }
285
+ return merged;
264
286
  }
265
287
  async #waitAnimationsFinish() {
266
288
  const promises = [];
@@ -281,7 +303,7 @@ function waitAnimationFinish(animation) {
281
303
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
282
304
  * Using the <details> and <summary> element.
283
305
  *
284
- * @version 2.0.9
306
+ * @version 2.0.10
285
307
  * @author Yusuke Kamiyamane
286
308
  * @license MIT
287
309
  * @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.10",
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
  }