@y14e/disclosure 1.3.17 → 1.3.18

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
@@ -10,14 +10,14 @@ npm i @y14e/disclosure
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import Disclosure from '@y14e/disclosure@1.3.17';
13
+ import Disclosure from '@y14e/disclosure@1.3.18';
14
14
 
15
15
  // CDNs
16
- import Disclosure from 'https://esm.sh/@y14e/disclosure@1.3.17';
16
+ import Disclosure from 'https://esm.sh/@y14e/disclosure@1.3.18';
17
17
  // or
18
- import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@1.3.17/+esm';
18
+ import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@1.3.18/+esm';
19
19
  // or
20
- import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@1.3.17';
20
+ import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@1.3.18';
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -294,8 +294,14 @@ function createRovingTabIndex(container, options = {}) {
294
294
  return () => {
295
295
  };
296
296
  }
297
- const roving = new RovingTabIndex(container, options);
298
- return () => roving.destroy();
297
+ try {
298
+ const roving = new RovingTabIndex(container, options);
299
+ return () => roving.destroy();
300
+ } catch (error) {
301
+ error instanceof Error && console.warn(error.message || error);
302
+ return () => {
303
+ };
304
+ }
299
305
  }
300
306
  var RovingTabIndex = class _RovingTabIndex {
301
307
  static #initialized = /* @__PURE__ */ new Set();
@@ -377,7 +383,7 @@ var RovingTabIndex = class _RovingTabIndex {
377
383
  }
378
384
  this.#controller = new AbortController();
379
385
  const { signal } = this.#controller;
380
- this.#container.addEventListener("focusin", this.#onFocusIn, {
386
+ document.addEventListener("focusin", this.#onFocusIn, {
381
387
  capture: true,
382
388
  signal
383
389
  });
@@ -715,7 +721,7 @@ var Disclosure = class _Disclosure {
715
721
  if (!binding) {
716
722
  return;
717
723
  }
718
- const { content, timer } = binding;
724
+ const { content } = binding;
719
725
  const startSize = details.open ? content.offsetHeight : 0;
720
726
  binding.animation?.cancel();
721
727
  if (isOpen) {
@@ -723,11 +729,7 @@ var Disclosure = class _Disclosure {
723
729
  }
724
730
  const endSize = isOpen ? content.scrollHeight : 0;
725
731
  binding.animation?.cancel();
726
- timer && cancelAnimationFrame(timer);
727
- binding.timer = requestAnimationFrame(() => {
728
- binding.timer = void 0;
729
- details.toggleAttribute("data-disclosure-open", isOpen);
730
- });
732
+ details.toggleAttribute("data-disclosure-open", isOpen);
731
733
  content.style.setProperty("overflow", "clip");
732
734
  const { duration, easing } = this.#settings.animation;
733
735
  const animation = content.animate(
@@ -787,7 +789,7 @@ var Disclosure = class _Disclosure {
787
789
  }
788
790
  };
789
791
  function createBinding(details, summary, content) {
790
- return { details, summary, content, timer: void 0, animation: null };
792
+ return { details, summary, content, animation: null };
791
793
  }
792
794
  function isFocusable2(element) {
793
795
  return element.tabIndex >= 0;
@@ -806,7 +808,7 @@ function waitAnimationFinish(animation) {
806
808
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
807
809
  * Using the <details> and <summary> element.
808
810
  *
809
- * @version 1.3.17
811
+ * @version 1.3.18
810
812
  * @author Yusuke Kamiyamane
811
813
  * @license MIT
812
814
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -844,7 +846,7 @@ power-focusable/dist/index.js:
844
846
  * Lightweight roving tabindex utility with fully focus management.
845
847
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
846
848
  *
847
- * @version 3.0.12
849
+ * @version 3.0.14
848
850
  * @author Yusuke Kamiyamane
849
851
  * @license MIT
850
852
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -292,8 +292,14 @@ function createRovingTabIndex(container, options = {}) {
292
292
  return () => {
293
293
  };
294
294
  }
295
- const roving = new RovingTabIndex(container, options);
296
- return () => roving.destroy();
295
+ try {
296
+ const roving = new RovingTabIndex(container, options);
297
+ return () => roving.destroy();
298
+ } catch (error) {
299
+ error instanceof Error && console.warn(error.message || error);
300
+ return () => {
301
+ };
302
+ }
297
303
  }
298
304
  var RovingTabIndex = class _RovingTabIndex {
299
305
  static #initialized = /* @__PURE__ */ new Set();
@@ -375,7 +381,7 @@ var RovingTabIndex = class _RovingTabIndex {
375
381
  }
376
382
  this.#controller = new AbortController();
377
383
  const { signal } = this.#controller;
378
- this.#container.addEventListener("focusin", this.#onFocusIn, {
384
+ document.addEventListener("focusin", this.#onFocusIn, {
379
385
  capture: true,
380
386
  signal
381
387
  });
@@ -713,7 +719,7 @@ var Disclosure = class _Disclosure {
713
719
  if (!binding) {
714
720
  return;
715
721
  }
716
- const { content, timer } = binding;
722
+ const { content } = binding;
717
723
  const startSize = details.open ? content.offsetHeight : 0;
718
724
  binding.animation?.cancel();
719
725
  if (isOpen) {
@@ -721,11 +727,7 @@ var Disclosure = class _Disclosure {
721
727
  }
722
728
  const endSize = isOpen ? content.scrollHeight : 0;
723
729
  binding.animation?.cancel();
724
- timer && cancelAnimationFrame(timer);
725
- binding.timer = requestAnimationFrame(() => {
726
- binding.timer = void 0;
727
- details.toggleAttribute("data-disclosure-open", isOpen);
728
- });
730
+ details.toggleAttribute("data-disclosure-open", isOpen);
729
731
  content.style.setProperty("overflow", "clip");
730
732
  const { duration, easing } = this.#settings.animation;
731
733
  const animation = content.animate(
@@ -785,7 +787,7 @@ var Disclosure = class _Disclosure {
785
787
  }
786
788
  };
787
789
  function createBinding(details, summary, content) {
788
- return { details, summary, content, timer: void 0, animation: null };
790
+ return { details, summary, content, animation: null };
789
791
  }
790
792
  function isFocusable2(element) {
791
793
  return element.tabIndex >= 0;
@@ -804,7 +806,7 @@ function waitAnimationFinish(animation) {
804
806
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
805
807
  * Using the <details> and <summary> element.
806
808
  *
807
- * @version 1.3.17
809
+ * @version 1.3.18
808
810
  * @author Yusuke Kamiyamane
809
811
  * @license MIT
810
812
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -842,7 +844,7 @@ power-focusable/dist/index.js:
842
844
  * Lightweight roving tabindex utility with fully focus management.
843
845
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
844
846
  *
845
- * @version 3.0.12
847
+ * @version 3.0.14
846
848
  * @author Yusuke Kamiyamane
847
849
  * @license MIT
848
850
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -191,7 +191,7 @@ var Disclosure = class _Disclosure {
191
191
  if (!binding) {
192
192
  return;
193
193
  }
194
- const { content, timer } = binding;
194
+ const { content } = binding;
195
195
  const startSize = details.open ? content.offsetHeight : 0;
196
196
  binding.animation?.cancel();
197
197
  if (isOpen) {
@@ -199,11 +199,7 @@ var Disclosure = class _Disclosure {
199
199
  }
200
200
  const endSize = isOpen ? content.scrollHeight : 0;
201
201
  binding.animation?.cancel();
202
- timer && cancelAnimationFrame(timer);
203
- binding.timer = requestAnimationFrame(() => {
204
- binding.timer = void 0;
205
- details.toggleAttribute("data-disclosure-open", isOpen);
206
- });
202
+ details.toggleAttribute("data-disclosure-open", isOpen);
207
203
  content.style.setProperty("overflow", "clip");
208
204
  const { duration, easing } = this.#settings.animation;
209
205
  const animation = content.animate(
@@ -263,7 +259,7 @@ var Disclosure = class _Disclosure {
263
259
  }
264
260
  };
265
261
  function createBinding(details, summary, content) {
266
- return { details, summary, content, timer: void 0, animation: null };
262
+ return { details, summary, content, animation: null };
267
263
  }
268
264
  function isFocusable(element) {
269
265
  return element.tabIndex >= 0;
@@ -282,7 +278,7 @@ function waitAnimationFinish(animation) {
282
278
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
283
279
  * Using the <details> and <summary> element.
284
280
  *
285
- * @version 1.3.17
281
+ * @version 1.3.18
286
282
  * @author Yusuke Kamiyamane
287
283
  * @license MIT
288
284
  * @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 1.3.17
6
+ * @version 1.3.18
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 1.3.17
6
+ * @version 1.3.18
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -189,7 +189,7 @@ var Disclosure = class _Disclosure {
189
189
  if (!binding) {
190
190
  return;
191
191
  }
192
- const { content, timer } = binding;
192
+ const { content } = binding;
193
193
  const startSize = details.open ? content.offsetHeight : 0;
194
194
  binding.animation?.cancel();
195
195
  if (isOpen) {
@@ -197,11 +197,7 @@ var Disclosure = class _Disclosure {
197
197
  }
198
198
  const endSize = isOpen ? content.scrollHeight : 0;
199
199
  binding.animation?.cancel();
200
- timer && cancelAnimationFrame(timer);
201
- binding.timer = requestAnimationFrame(() => {
202
- binding.timer = void 0;
203
- details.toggleAttribute("data-disclosure-open", isOpen);
204
- });
200
+ details.toggleAttribute("data-disclosure-open", isOpen);
205
201
  content.style.setProperty("overflow", "clip");
206
202
  const { duration, easing } = this.#settings.animation;
207
203
  const animation = content.animate(
@@ -261,7 +257,7 @@ var Disclosure = class _Disclosure {
261
257
  }
262
258
  };
263
259
  function createBinding(details, summary, content) {
264
- return { details, summary, content, timer: void 0, animation: null };
260
+ return { details, summary, content, animation: null };
265
261
  }
266
262
  function isFocusable(element) {
267
263
  return element.tabIndex >= 0;
@@ -280,7 +276,7 @@ function waitAnimationFinish(animation) {
280
276
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
281
277
  * Using the <details> and <summary> element.
282
278
  *
283
- * @version 1.3.17
279
+ * @version 1.3.18
284
280
  * @author Yusuke Kamiyamane
285
281
  * @license MIT
286
282
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/disclosure",
3
- "version": "1.3.17",
3
+ "version": "1.3.18",
4
4
  "description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -53,6 +53,6 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@y14e/attributes-utils": "^1.1.2",
56
- "@y14e/roving-tabindex": "^3.0.12"
56
+ "@y14e/roving-tabindex": "^3.0.14"
57
57
  }
58
58
  }