Socket
Socket
Sign inDemoInstall

@chakra-ui/color-mode

Package Overview
Dependencies
4
Maintainers
3
Versions
363
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.10 to 2.1.11

dist/chunk-4DEUOPYU.mjs

98

dist/index.d.ts

@@ -1,92 +0,6 @@

import * as react from 'react';
declare type ColorMode = "light" | "dark";
declare type ColorModeWithSystem = ColorMode | "system" | undefined;
/**
* @deprecated use `ColorModeWithSystem` instead
*/
declare type ConfigColorMode = ColorModeWithSystem;
interface ColorModeOptions {
initialColorMode?: ColorModeWithSystem;
useSystemColorMode?: boolean;
disableTransitionOnChange?: boolean;
}
interface ColorModeContextType {
forced?: boolean;
colorMode: ColorMode;
toggleColorMode: () => void;
setColorMode: (value: any) => void;
}
declare type MaybeColorMode = ColorMode | undefined;
interface StorageManager {
type: "cookie" | "localStorage";
ssr?: boolean;
get(init?: ColorMode): MaybeColorMode;
set(value: ColorMode | "system"): void;
}
declare function createLocalStorageManager(key: string): StorageManager;
declare const localStorageManager: StorageManager;
declare function createCookieStorageManager(key: string, cookie?: string): StorageManager;
declare const cookieStorageManager: StorageManager;
declare const cookieStorageManagerSSR: (cookie: string) => StorageManager;
interface ColorModeProviderProps {
value?: ColorMode;
children?: React.ReactNode;
options?: ColorModeOptions;
colorModeManager?: StorageManager;
}
/**
* Provides context for the color mode based on config in `theme`
* Returns the color mode and function to toggle the color mode
*/
declare function ColorModeProvider(props: ColorModeProviderProps): JSX.Element;
declare namespace ColorModeProvider {
var displayName: string;
}
/**
* Locks the color mode to `dark`, without any way to change it.
*/
declare function DarkMode(props: React.PropsWithChildren<{}>): JSX.Element;
declare namespace DarkMode {
var displayName: string;
}
/**
* Locks the color mode to `light` without any way to change it.
*/
declare function LightMode(props: React.PropsWithChildren<{}>): JSX.Element;
declare namespace LightMode {
var displayName: string;
}
declare type ColorModeScriptProps = {
type?: "localStorage" | "cookie";
initialColorMode?: "light" | "dark" | "system";
storageKey?: string;
nonce?: string;
};
declare function getScriptSrc(props?: ColorModeScriptProps): string;
declare function ColorModeScript(props?: ColorModeScriptProps): JSX.Element;
declare const ColorModeContext: react.Context<ColorModeContextType>;
/**
* React hook that reads from `ColorModeProvider` context
* Returns the color mode and function to toggle it
*/
declare function useColorMode(): ColorModeContextType;
/**
* Change value based on color mode.
*
* @param light the light mode value
* @param dark the dark mode value
*
* @example
*
* ```js
* const Icon = useColorModeValue(MoonIcon, SunIcon)
* ```
*/
declare function useColorModeValue<TLight = unknown, TDark = unknown>(light: TLight, dark: TDark): TLight | TDark;
export { ColorMode, ColorModeContext, ColorModeContextType, ColorModeProvider, ColorModeProviderProps, ColorModeScript, ColorModeScriptProps, ColorModeWithSystem, ConfigColorMode, DarkMode, LightMode, cookieStorageManager, cookieStorageManagerSSR, createCookieStorageManager, createLocalStorageManager, getScriptSrc, localStorageManager, useColorMode, useColorModeValue };
export { ColorModeProvider, ColorModeProviderProps, DarkMode, LightMode } from './color-mode-provider.js';
export { cookieStorageManager, cookieStorageManagerSSR, createCookieStorageManager, createLocalStorageManager, localStorageManager } from './storage-manager.js';
export { ColorModeScript, ColorModeScriptProps, getScriptSrc } from './color-mode-script.js';
export { ColorModeContext, useColorMode, useColorModeValue } from './color-mode-context.js';
export { ColorMode, ColorModeContextType, ColorModeWithSystem, ConfigColorMode } from './color-mode-types.js';
import 'react';
{
"name": "@chakra-ui/color-mode",
"version": "2.1.10",
"version": "2.1.11",
"description": "React component and hooks for handling light and dark mode.",

@@ -22,3 +22,3 @@ "keywords": [

"license": "MIT",
"main": "dist/index.cjs.js",
"main": "dist/index.js",
"files": [

@@ -39,3 +39,3 @@ "dist"

"dependencies": {
"@chakra-ui/react-use-safe-layout-effect": "2.0.3"
"@chakra-ui/react-use-safe-layout-effect": "2.0.4"
},

@@ -46,13 +46,22 @@ "peerDependencies": {

"devDependencies": {
"@chakra-ui/utils": "2.0.12",
"react": "^18.0.0",
"clean-package": "2.1.1"
"clean-package": "2.1.1",
"@chakra-ui/utils": "2.0.13"
},
"module": "dist/index.esm.js",
"clean-package": "../../../clean-package.config.json",
"tsup": {
"clean": true,
"target": "es2019",
"format": [
"cjs",
"esm"
]
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.esm.js",
"require": "./dist/index.cjs.js",
"types": "./dist/index.d.ts"
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

@@ -62,8 +71,8 @@ "./package.json": "./package.json"

"scripts": {
"build": "JSX=1 tsup src/index.ts --dts",
"build": "tsup src --dts",
"dev": "pnpm build:fast -- --watch",
"clean": "rimraf dist .turbo",
"typecheck": "tsc --noEmit",
"build:fast": "JSX=1 tsup src/index.ts"
"build:fast": "tsup src"
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc