@lotte-innovate/ui-component-test 0.0.136 → 0.0.138

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ export var useDarkMode = function (isRAxes) {
23
23
  y: { grid: { color: slateDarkA[8] } },
24
24
  };
25
25
  }
26
- var _a = useState(checkDarkMode()), isDarkMode = _a[0], setIsDarkMode = _a[1];
26
+ var _a = useState(false), isDarkMode = _a[0], setIsDarkMode = _a[1];
27
27
  var _b = useState({
28
28
  linescale: {},
29
29
  }), defaultOptions = _b[0], setDefaultOptions = _b[1];
@@ -33,17 +33,22 @@ export var useDarkMode = function (isRAxes) {
33
33
  return document.body.classList.contains('dark');
34
34
  }
35
35
  useEffect(function () {
36
- setIsDarkMode(checkDarkMode());
37
- setDefaultOptions({ linescale: !checkDarkMode() ? lightmode : darkmode });
36
+ var _a, _b;
37
+ setIsDarkMode((_a = document === null || document === void 0 ? void 0 : document.body) === null || _a === void 0 ? void 0 : _a.classList.contains('dark'));
38
+ setDefaultOptions({
39
+ linescale: !((_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.classList.contains('dark')) ? lightmode : darkmode,
40
+ });
38
41
  var mutationObserver = new MutationObserver(function (mutations) {
39
42
  mutations.forEach(function (mutation) {
40
43
  if (mutation.attributeName === 'class') {
41
- setIsDarkMode(checkDarkMode());
42
- setDefaultOptions({ linescale: !checkDarkMode() ? lightmode : darkmode });
44
+ setIsDarkMode(document === null || document === void 0 ? void 0 : document.body.classList.contains('dark'));
45
+ setDefaultOptions({
46
+ linescale: !(document === null || document === void 0 ? void 0 : document.body.classList.contains('dark')) ? lightmode : darkmode,
47
+ });
43
48
  }
44
49
  });
45
50
  });
46
- mutationObserver.observe(document.body, { attributes: true });
51
+ document && mutationObserver.observe(document === null || document === void 0 ? void 0 : document.body, { attributes: true });
47
52
  return function () {
48
53
  mutationObserver.disconnect();
49
54
  };
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{slateA as r,slateDarkA as o}from"../color/alpha.mjs";import{useState as c,useEffect as n}from"react";var t=function(t){void 0===t&&(t=!1);var i={},e={};!0===t?(i={r:{grid:{color:r[8]}}},e={r:{grid:{color:o[8]},ticks:{backdropColor:"rgba(0, 0, 0, 0)"}}}):(i={x:{grid:{color:r[8]}},y:{grid:{color:r[8]}}},e={x:{grid:{color:o[8]}},y:{grid:{color:o[8]}}});var a=c(m()),l=a[0],u=a[1],d=c({linescale:{}}),s=d[0],f=d[1];function m(){return document?document.body.classList.contains("dark"):null}return n((function(){u(m()),f({linescale:m()?e:i});var r=new MutationObserver((function(r){r.forEach((function(r){"class"===r.attributeName&&(u(m()),f({linescale:m()?e:i}))}))}));return r.observe(document.body,{attributes:!0}),function(){r.disconnect()}}),[e,i,u]),[l,s]};export{t as useDarkMode};
2
+ import{slateA as o,slateDarkA as n}from"../color/alpha.mjs";import{useState as d,useEffect as c}from"react";var t=function(t){void 0===t&&(t=!1);var i={},r={};!0===t?(i={r:{grid:{color:o[8]}}},r={r:{grid:{color:n[8]},ticks:{backdropColor:"rgba(0, 0, 0, 0)"}}}):(i={x:{grid:{color:o[8]}},y:{grid:{color:o[8]}}},r={x:{grid:{color:n[8]}},y:{grid:{color:n[8]}}});var e=d(!1),l=e[0],u=e[1],a=d({linescale:{}}),s=a[0],m=a[1];return c((function(){var o,n;u(null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.classList.contains("dark")),m({linescale:(null===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.classList.contains("dark"))?r:i});var d=new MutationObserver((function(o){o.forEach((function(o){"class"===o.attributeName&&(u(null===document||void 0===document?void 0:document.body.classList.contains("dark")),m({linescale:(null===document||void 0===document?void 0:document.body.classList.contains("dark"))?r:i}))}))}));return document&&d.observe(null===document||void 0===document?void 0:document.body,{attributes:!0}),function(){d.disconnect()}}),[r,i,u]),[l,s]};export{t as useDarkMode};
3
3
  //# sourceMappingURL=useDarkMode.mjs.map