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

themestress

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

themestress - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

10

components/Button.js

@@ -89,8 +89,10 @@ "use strict";

}, function (_a) {
var theme = _a.theme, variant = _a.variant, fontColor = _a.fontColor;
var theme = _a.theme, v = _a.variant, fc = _a.fontColor, bg = _a.bgColor;
var color = theme.palette.primary.main;
if (variant === 'contained')
if (v === 'contained')
color = theme.palette.primary.on;
if (fontColor)
color = (0, themeUtils_1.colorFromTheme)(theme, fontColor);
if (bg && !fc)
color = (0, themeUtils_1.onColorFromTheme)(theme, bg);
if (fc)
color = (0, themeUtils_1.colorFromTheme)(theme, fc);
return color;

@@ -97,0 +99,0 @@ }, function (_a) {

34

core/themeUtils.js

@@ -14,3 +14,3 @@ "use strict";

/** Check if a string is an RGB string */
var isRgb = function (c) { return c.includes('rgb') && c.split(',').length === 3; };
var isRgb = function (c) { return c.includes('rgb'); };
/** Check if a string is a HEX string */

@@ -75,7 +75,11 @@ var isHex = function (c) { return c[0] === '#' && c.split('').length === 7; };

/** Call a function on every value in an object */
var objDeep = function (value, fn) {
Object.values(value).forEach(function (v) {
fn(v);
if (isObject(v))
objDeep(v, fn);
var objDeep = function (value, fn, ignoreKeys) {
if (ignoreKeys === void 0) { ignoreKeys = []; }
Object.entries(value).forEach(function (_a) {
var k = _a[0], v = _a[1];
if (!ignoreKeys.includes(k)) {
fn(v);
if (isObject(v))
objDeep(v, fn);
}
});

@@ -147,6 +151,6 @@ };

/** Generate the palette */
var createPalette = function (palette) {
var createPalette = function (initialPalette) {
// Generate "on" colors
var fn = function (value) {
if (!isObject(value) || value['main'] !== undefined)
var createOnColors = function (value) {
if (!isObject(value) || value['main'] === undefined)
return;

@@ -162,8 +166,8 @@ validateColorString(value['main']);

};
var _palette = Object.assign({}, palette);
objDeep(_palette, fn);
// Add any defaults
var palette = Object.assign({}, initialPalette);
objDeep(palette, createOnColors, []);
var defaultPalette = mergeDeep({}, corePalette);
mergeDeep(defaultPalette, palette['mode'] === 'dark' ? darks : lights);
var result = mergeDeep(defaultPalette, _palette);
objDeep(defaultPalette, createOnColors, []);
mergeDeep(defaultPalette, initialPalette.mode === 'dark' ? darks : lights);
var result = mergeDeep(defaultPalette, palette);
return result;

@@ -179,3 +183,3 @@ };

var result = mergeDeep(defaultTheme, theme);
result['palette'] = createPalette(result['palette']);
result.palette = createPalette(result.palette);
return result;

@@ -182,0 +186,0 @@ };

{
"name": "themestress",
"description": "A lightweight theme package.",
"version": "0.0.6",
"version": "0.0.7",
"main": "index.js",

@@ -6,0 +6,0 @@ "types": "index.d.ts",

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