Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@yamada-ui/core

Package Overview
Dependencies
Maintainers
1
Versions
936
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yamada-ui/core - npm Package Compare versions

Comparing version 0.0.0-dev-20230905053419 to 0.0.0-dev-20230909035251

82

dist/index.js

@@ -1651,20 +1651,15 @@ "use strict";

var ColorModeProvider = ({
value,
colorMode: defaultColorMode,
colorModeManager: colorModeManager2 = localStorage3,
config: {
initialColorMode,
useSystemColorMode,
disableTransitionOnChange
} = {
initialColorMode: "light",
useSystemColorMode: true
},
config: { initialColorMode = "light", disableTransitionOnChange = true } = {},
children
}) => {
const defaultColorMode = initialColorMode === "dark" ? "dark" : "light";
const [colorMode, setColorMode] = (0, import_react5.useState)(
() => getColorMode(colorModeManager2, defaultColorMode)
() => getColorMode(colorModeManager2, initialColorMode)
);
const [resolvedColorMode, setResolvedColorMode] = (0, import_react5.useState)(() => getColorMode(colorModeManager2));
const resolvedValue = initialColorMode === "system" && !colorMode ? resolvedColorMode : colorMode;
const [systemColorMode, setSystemColorMode] = (0, import_react5.useState)(
void 0
);
const defaultResolvedColorMode = initialColorMode === "dark" ? "dark" : "light";
const resolvedColorMode = colorMode === "system" ? systemColorMode ? systemColorMode : defaultResolvedColorMode : colorMode;
const { getSystemColorMode, setClassName, setDataset, addListener } = (0, import_react5.useMemo)(

@@ -1675,43 +1670,50 @@ () => getColorModeUtils({ isPreventTransition: disableTransitionOnChange }),

const changeColorMode = (0, import_react5.useCallback)(
(value2) => {
const resolved = value2 === "system" ? getSystemColorMode() : value2;
setColorMode(resolved);
(colorMode2) => {
const resolved = colorMode2 === "system" ? getSystemColorMode() : colorMode2;
setColorMode(colorMode2);
setClassName(resolved === "dark");
setDataset(resolved);
colorModeManager2.set(resolved);
colorModeManager2.set(colorMode2);
},
[colorModeManager2, getSystemColorMode, setClassName, setDataset]
);
const changeSystemColorMode = (0, import_react5.useCallback)(
(systemColorMode2) => {
setSystemColorMode(systemColorMode2);
if (colorMode !== "system")
return;
setClassName(systemColorMode2 === "dark");
setDataset(systemColorMode2);
},
[colorMode, setClassName, setDataset]
);
const toggleColorMode = (0, import_react5.useCallback)(() => {
changeColorMode(resolvedValue === "dark" ? "light" : "dark");
}, [changeColorMode, resolvedValue]);
changeColorMode(resolvedColorMode === "dark" ? "light" : "dark");
}, [changeColorMode, resolvedColorMode]);
(0, import_utils10.useSafeLayoutEffect)(() => {
if (initialColorMode === "system")
setResolvedColorMode(getSystemColorMode());
}, []);
setSystemColorMode(getSystemColorMode());
}, [initialColorMode, addListener, changeColorMode]);
(0, import_react5.useEffect)(() => {
const managerValue = colorModeManager2.get();
if (managerValue) {
if (managerValue)
changeColorMode(managerValue);
return;
}
if (initialColorMode === "system") {
changeColorMode("system");
return;
}
changeColorMode(defaultColorMode);
}, [changeColorMode, colorModeManager2, defaultColorMode, initialColorMode]);
}, [changeColorMode, colorModeManager2]);
(0, import_react5.useEffect)(() => {
if (!useSystemColorMode)
return;
return addListener(changeColorMode);
}, [useSystemColorMode, addListener, changeColorMode]);
return addListener(changeSystemColorMode);
}, [addListener, changeSystemColorMode]);
const context = (0, import_react5.useMemo)(
() => ({
colorMode: value != null ? value : resolvedValue,
changeColorMode: value ? import_utils10.noop : changeColorMode,
toggleColorMode: value ? import_utils10.noop : toggleColorMode,
forced: value !== void 0
colorMode: defaultColorMode != null ? defaultColorMode : resolvedColorMode,
internalColorMode: colorMode,
changeColorMode: defaultColorMode ? import_utils10.noop : changeColorMode,
toggleColorMode: defaultColorMode ? import_utils10.noop : toggleColorMode,
forced: defaultColorMode !== void 0
}),
[value, resolvedValue, changeColorMode, toggleColorMode]
[
defaultColorMode,
resolvedColorMode,
colorMode,
changeColorMode,
toggleColorMode
]
);

@@ -1718,0 +1720,0 @@ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ColorModeContext.Provider, { value: context, children });

{
"name": "@yamada-ui/core",
"version": "0.0.0-dev-20230905053419",
"version": "0.0.0-dev-20230909035251",
"description": "Yamada UI core",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc