@lotte-innovate/ui-component-test 0.2.67 → 0.2.68

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,30 +23,28 @@ export var useDarkMode = function (isRAxes) {
23
23
  y: { grid: { color: slateDarkA[8] } },
24
24
  };
25
25
  }
26
- var _a = useState(false), isDarkMode = _a[0], setIsDarkMode = _a[1];
26
+ var _a = useState(checkDarkMode()), isDarkMode = _a[0], setIsDarkMode = _a[1];
27
27
  var _b = useState({
28
28
  linescale: {},
29
29
  }), defaultOptions = _b[0], setDefaultOptions = _b[1];
30
+ function checkDarkMode() {
31
+ return document.body.classList.contains('dark');
32
+ }
30
33
  useEffect(function () {
31
- var _a, _b;
32
- setIsDarkMode((_a = document === null || document === void 0 ? void 0 : document.body) === null || _a === void 0 ? void 0 : _a.classList.contains('dark'));
33
- setDefaultOptions({
34
- linescale: !((_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.classList.contains('dark')) ? lightmode : darkmode,
35
- });
34
+ setIsDarkMode(checkDarkMode());
35
+ setDefaultOptions({ linescale: !checkDarkMode() ? lightmode : darkmode });
36
36
  var mutationObserver = new MutationObserver(function (mutations) {
37
37
  mutations.forEach(function (mutation) {
38
38
  if (mutation.attributeName === 'class') {
39
- setIsDarkMode(document === null || document === void 0 ? void 0 : document.body.classList.contains('dark'));
40
- setDefaultOptions({
41
- linescale: !(document === null || document === void 0 ? void 0 : document.body.classList.contains('dark')) ? lightmode : darkmode,
42
- });
39
+ setIsDarkMode(checkDarkMode());
40
+ setDefaultOptions({ linescale: !checkDarkMode() ? lightmode : darkmode });
43
41
  }
44
42
  });
45
43
  });
46
- document && mutationObserver.observe(document === null || document === void 0 ? void 0 : document.body, { attributes: true });
44
+ mutationObserver.observe(document.body, { attributes: true });
47
45
  return function () {
48
46
  mutationObserver.disconnect();
49
47
  };
50
- }, [darkmode, lightmode, setIsDarkMode]);
48
+ }, []);
51
49
  return [isDarkMode, defaultOptions];
52
50
  };
@@ -1,3 +1,3 @@
1
1
  "use client";
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};
2
+ import{slateA as r,slateDarkA as o}from"../color/alpha.mjs";import{useState as c,useEffect as t}from"react";var n=function(n){void 0===n&&(n=!1);var i={},e={};!0===n?(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(b()),l=a[0],s=a[1],d=c({linescale:{}}),u=d[0],f=d[1];function b(){return document.body.classList.contains("dark")}return t((function(){s(b()),f({linescale:b()?e:i});var r=new MutationObserver((function(r){r.forEach((function(r){"class"===r.attributeName&&(s(b()),f({linescale:b()?e:i}))}))}));return r.observe(document.body,{attributes:!0}),function(){r.disconnect()}}),[]),[l,u]};export{n as useDarkMode};
3
3
  //# sourceMappingURL=useDarkMode.mjs.map
@@ -4,8 +4,6 @@ export function useWindowSize() {
4
4
  var _a = useState(MIN_SIZE), size = _a[0], setSize = _a[1];
5
5
  useEffect(function () {
6
6
  function handleResize() {
7
- if (!window)
8
- return;
9
7
  var width = 130 + window.innerWidth * 0.15;
10
8
  width = Math.max(width, MIN_SIZE);
11
9
  width = Math.min(width, 300);
@@ -14,6 +12,6 @@ export function useWindowSize() {
14
12
  window.addEventListener('resize', handleResize);
15
13
  handleResize();
16
14
  return function () { return window.removeEventListener('resize', handleResize); };
17
- }, [window]);
15
+ }, []);
18
16
  return size;
19
17
  }
@@ -1,2 +1,2 @@
1
- import{useState as n,useEffect as e}from"react";function i(){var i=n(250),r=i[0],t=i[1];return e((function(){function n(){if(window){var n=130+.15*window.innerWidth;n=Math.max(n,250),n=Math.min(n,300),t(n)}}return window.addEventListener("resize",n),n(),function(){return window.removeEventListener("resize",n)}}),[window]),r}export{i as useWindowSize};
1
+ import{useState as n,useEffect as e}from"react";function r(){var r=n(250),t=r[0],i=r[1];return e((function(){function n(){var n=130+.15*window.innerWidth;n=Math.max(n,250),n=Math.min(n,300),i(n)}return window.addEventListener("resize",n),n(),function(){return window.removeEventListener("resize",n)}}),[]),t}export{r as useWindowSize};
2
2
  //# sourceMappingURL=useWindowSize.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWindowSize.mjs","sources":["../../lib/utils/useWindowSize.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nvar MIN_SIZE = 250;\nexport function useWindowSize() {\n var _a = useState(MIN_SIZE), size = _a[0], setSize = _a[1];\n useEffect(function () {\n function handleResize() {\n if (!window)\n return;\n var width = 130 + window.innerWidth * 0.15;\n width = Math.max(width, MIN_SIZE);\n width = Math.min(width, 300);\n setSize(width);\n }\n window.addEventListener('resize', handleResize);\n handleResize();\n return function () { return window.removeEventListener('resize', handleResize); };\n }, [window]);\n return size;\n}\n"],"names":["useWindowSize","_a","useState","size","setSize","useEffect","handleResize","window","width","innerWidth","Math","max","min","addEventListener","removeEventListener"],"mappings":"gDAEO,SAASA,IACZ,IAAIC,EAAKC,EAFE,KAEkBC,EAAOF,EAAG,GAAIG,EAAUH,EAAG,GAcxD,OAbAI,GAAU,WACN,SAASC,IACL,GAAKC,OAAL,CAEA,IAAIC,EAAQ,IAA0B,IAApBD,OAAOE,WACzBD,EAAQE,KAAKC,IAAIH,EARd,KASHA,EAAQE,KAAKE,IAAIJ,EAAO,KACxBJ,EAAQI,EAJG,CAKd,CAGD,OAFAD,OAAOM,iBAAiB,SAAUP,GAClCA,IACO,WAAc,OAAOC,OAAOO,oBAAoB,SAAUR,GACzE,GAAO,CAACC,SACGJ,CACX"}
1
+ {"version":3,"file":"useWindowSize.mjs","sources":["../../lib/utils/useWindowSize.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nvar MIN_SIZE = 250;\nexport function useWindowSize() {\n var _a = useState(MIN_SIZE), size = _a[0], setSize = _a[1];\n useEffect(function () {\n function handleResize() {\n var width = 130 + window.innerWidth * 0.15;\n width = Math.max(width, MIN_SIZE);\n width = Math.min(width, 300);\n setSize(width);\n }\n window.addEventListener('resize', handleResize);\n handleResize();\n return function () { return window.removeEventListener('resize', handleResize); };\n }, []);\n return size;\n}\n"],"names":["useWindowSize","_a","useState","size","setSize","useEffect","handleResize","width","window","innerWidth","Math","max","min","addEventListener","removeEventListener"],"mappings":"gDAEO,SAASA,IACZ,IAAIC,EAAKC,EAFE,KAEkBC,EAAOF,EAAG,GAAIG,EAAUH,EAAG,GAYxD,OAXAI,GAAU,WACN,SAASC,IACL,IAAIC,EAAQ,IAA0B,IAApBC,OAAOC,WACzBF,EAAQG,KAAKC,IAAIJ,EANd,KAOHA,EAAQG,KAAKE,IAAIL,EAAO,KACxBH,EAAQG,EACX,CAGD,OAFAC,OAAOK,iBAAiB,SAAUP,GAClCA,IACO,WAAc,OAAOE,OAAOM,oBAAoB,SAAUR,GACpE,GAAE,IACIH,CACX"}