@nobertdev/react-confirm-dialog 1.1.3 → 1.1.4

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/dist/index.js CHANGED
@@ -416,15 +416,15 @@ function usePrefersDark() {
416
416
  return window.matchMedia("(prefers-color-scheme: dark)").matches;
417
417
  });
418
418
  (0, import_react3.useEffect)(() => {
419
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
419
420
  const observer = new MutationObserver(() => {
420
421
  const domDark = detectDarkFromDOM();
421
- if (domDark !== null) setDark(domDark);
422
+ setDark(domDark != null ? domDark : mq.matches);
422
423
  });
423
424
  observer.observe(document.documentElement, {
424
425
  attributes: true,
425
426
  attributeFilter: ["class", "data-theme", "data-mode"]
426
427
  });
427
- const mq = window.matchMedia("(prefers-color-scheme: dark)");
428
428
  const mqHandler = (e) => {
429
429
  if (detectDarkFromDOM() === null) setDark(e.matches);
430
430
  };
package/dist/index.mjs CHANGED
@@ -392,15 +392,15 @@ function usePrefersDark() {
392
392
  return window.matchMedia("(prefers-color-scheme: dark)").matches;
393
393
  });
394
394
  useEffect2(() => {
395
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
395
396
  const observer = new MutationObserver(() => {
396
397
  const domDark = detectDarkFromDOM();
397
- if (domDark !== null) setDark(domDark);
398
+ setDark(domDark != null ? domDark : mq.matches);
398
399
  });
399
400
  observer.observe(document.documentElement, {
400
401
  attributes: true,
401
402
  attributeFilter: ["class", "data-theme", "data-mode"]
402
403
  });
403
- const mq = window.matchMedia("(prefers-color-scheme: dark)");
404
404
  const mqHandler = (e) => {
405
405
  if (detectDarkFromDOM() === null) setDark(e.matches);
406
406
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nobertdev/react-confirm-dialog",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "A lightweight, fully customizable confirmation dialog hook (useConfirm()) that replaces window.confirm() with beautiful async modals. Zero dependencies.",
5
5
  "keywords": [
6
6
  "react",