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

@chakra-ui/theme-utils

Package Overview
Dependencies
Maintainers
3
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/theme-utils - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

26

dist/index.cjs.js

@@ -26,2 +26,3 @@ "use strict";

__export(src_exports, {
extendBaseTheme: () => extendBaseTheme,
extendTheme: () => extendTheme,

@@ -45,12 +46,16 @@ mergeThemeOverride: () => mergeThemeOverride,

}
function extendTheme(...extensions) {
let overrides = [...extensions];
let baseTheme = extensions[extensions.length - 1];
if ((0, import_theme.isChakraTheme)(baseTheme) && overrides.length > 1) {
overrides = overrides.slice(0, overrides.length - 1);
} else {
baseTheme = import_theme.theme;
}
return pipe(...overrides.map((extension) => (prevTheme) => isFunction(extension) ? extension(prevTheme) : mergeThemeOverride(prevTheme, extension)))(baseTheme);
}
var createExtendTheme = (theme2) => {
return function extendTheme2(...extensions) {
let overrides = [...extensions];
let activeTheme = extensions[extensions.length - 1];
if ((0, import_theme.isChakraTheme)(activeTheme) && overrides.length > 1) {
overrides = overrides.slice(0, overrides.length - 1);
} else {
activeTheme = theme2;
}
return pipe(...overrides.map((extension) => (prevTheme) => isFunction(extension) ? extension(prevTheme) : mergeThemeOverride(prevTheme, extension)))(activeTheme);
};
};
var extendTheme = createExtendTheme(import_theme.theme);
var extendBaseTheme = createExtendTheme(import_theme.baseTheme);
function mergeThemeOverride(...overrides) {

@@ -169,2 +174,3 @@ return (0, import_lodash.default)({}, ...overrides, mergeThemeCustomizer);

0 && (module.exports = {
extendBaseTheme,
extendTheme,

@@ -171,0 +177,0 @@ mergeThemeOverride,

@@ -20,3 +20,4 @@ import { Theme, ChakraTheme, ComponentDefaultProps } from '@chakra-ui/theme';

declare type BaseThemeWithExtensions<BaseTheme extends ChakraTheme, Extensions extends readonly [...any]> = BaseTheme & (Extensions extends [infer L, ...infer R] ? L extends AnyFunction ? ReturnType<L> & BaseThemeWithExtensions<BaseTheme, R> : L & BaseThemeWithExtensions<BaseTheme, R> : Extensions);
declare function extendTheme(...extensions: Array<Record<string, any> | ((theme: Record<string, any>) => Record<string, any>)>): Record<string, any>;
declare const extendTheme: (...extensions: (Record<string, any> | ((theme: Record<string, any>) => Record<string, any>))[]) => Record<string, any>;
declare const extendBaseTheme: (...extensions: (Record<string, any> | ((theme: Record<string, any>) => Record<string, any>))[]) => Record<string, any>;
declare function mergeThemeOverride(...overrides: any[]): any;

@@ -44,2 +45,2 @@

export { BaseThemeWithExtensions, DeepPartial, ThemeExtension, ThemeOverride, extendTheme, mergeThemeOverride, withDefaultColorScheme, withDefaultProps, withDefaultSize, withDefaultVariant };
export { BaseThemeWithExtensions, DeepPartial, ThemeExtension, ThemeOverride, extendBaseTheme, extendTheme, mergeThemeOverride, withDefaultColorScheme, withDefaultProps, withDefaultSize, withDefaultVariant };
// src/extend-theme.ts
import { theme, isChakraTheme } from "@chakra-ui/theme";
import {
theme,
baseTheme,
isChakraTheme
} from "@chakra-ui/theme";
import mergeWith from "lodash.mergewith";

@@ -10,12 +14,16 @@ function isFunction(value) {

}
function extendTheme(...extensions) {
let overrides = [...extensions];
let baseTheme = extensions[extensions.length - 1];
if (isChakraTheme(baseTheme) && overrides.length > 1) {
overrides = overrides.slice(0, overrides.length - 1);
} else {
baseTheme = theme;
}
return pipe(...overrides.map((extension) => (prevTheme) => isFunction(extension) ? extension(prevTheme) : mergeThemeOverride(prevTheme, extension)))(baseTheme);
}
var createExtendTheme = (theme2) => {
return function extendTheme2(...extensions) {
let overrides = [...extensions];
let activeTheme = extensions[extensions.length - 1];
if (isChakraTheme(activeTheme) && overrides.length > 1) {
overrides = overrides.slice(0, overrides.length - 1);
} else {
activeTheme = theme2;
}
return pipe(...overrides.map((extension) => (prevTheme) => isFunction(extension) ? extension(prevTheme) : mergeThemeOverride(prevTheme, extension)))(activeTheme);
};
};
var extendTheme = createExtendTheme(theme);
var extendBaseTheme = createExtendTheme(baseTheme);
function mergeThemeOverride(...overrides) {

@@ -133,2 +141,3 @@ return mergeWith({}, ...overrides, mergeThemeCustomizer);

export {
extendBaseTheme,
extendTheme,

@@ -135,0 +144,0 @@ mergeThemeOverride,

{
"name": "@chakra-ui/theme-utils",
"version": "2.0.4",
"version": "2.0.5",
"description": "",

@@ -30,10 +30,10 @@ "keywords": [

"devDependencies": {
"@chakra-ui/shared-utils": "2.0.3",
"@types/lodash.mergewith": "4.6.6",
"clean-package": "2.1.1"
"clean-package": "2.1.1",
"@chakra-ui/shared-utils": "2.0.3"
},
"dependencies": {
"@chakra-ui/styled-system": "2.3.5",
"@chakra-ui/theme": "2.2.1",
"lodash.mergewith": "4.6.2"
"lodash.mergewith": "4.6.2",
"@chakra-ui/styled-system": "2.4.0",
"@chakra-ui/theme": "2.2.2"
},

@@ -40,0 +40,0 @@ "module": "dist/index.esm.js",

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