Socket
Socket
Sign inDemoInstall

@semcore/utils

Package Overview
Dependencies
5
Maintainers
1
Versions
291
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.12.0 to 3.12.1

6

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

## [3.12.1] - 2020-04-03
### Fixed
- Теперь при передаче не правильного значения в функцию `color` возвращается пустая строка.
## [3.12.0] - 2020-04-02

@@ -7,0 +13,0 @@

7

lib/color.d.ts

@@ -1,4 +0,5 @@

declare function shade(color: string, percent: number): string;
declare function blend(colorOne: string, colorTwo: string, percent: number): string;
declare function shade(color?: string, percent?: number): string;
declare function blend(colorOne?: string, colorTwo?: string, percent?: number): string;
declare function opacity(color?: string, percent?: number): string;
declare function resolveColor(color?: string): string;
export { shade, blend, resolveColor as default };
export { shade, blend, opacity, resolveColor as default };

@@ -8,2 +8,3 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.blend = blend;
exports.opacity = opacity;
exports["default"] = resolveColor;

@@ -88,4 +89,6 @@

function shade(color, percent) {
// TODO error for color name, example 'aqua'
function shade(color) {
var percent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
if (!color) return ''; // TODO error for color name, example 'aqua'
if (color.length > 7) return shadeRGBColor(color, percent);

@@ -118,3 +121,6 @@ return shadeHexColor(color, percent);

function blend(colorOne, colorTwo, percent) {
function blend(colorOne, colorTwo) {
var percent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
if (!colorOne || !colorTwo) return '';
if (colorOne.length > 7) {

@@ -151,6 +157,10 @@ if (colorTwo.length > 7) {

function opacity(color) {
var percent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
if (!color || !color.startsWith('#')) return '';
return "rgba(".concat(hex2rgb(color).join(', '), ", ").concat(percent, ")");
}
function resolveColor(color) {
if (!color) {
return '';
}
if (!color) return '';

@@ -157,0 +167,0 @@ if (color in COLORS) {

@@ -12,3 +12,3 @@ /// <reference types="react" />

declare const I18nProvider: React.Provider<LocaleKeys>, I18nConsumer: React.Consumer<LocaleKeys>;
declare function getText(dictionaries: Dictionary, locale: LocaleKeys): (key: React.ReactText) => string;
declare function getText(dictionaries: Dictionary, locale: LocaleKeys): (key: string | number) => string;
interface IWithI18nInjectedProps {

@@ -30,4 +30,4 @@ getText: WithI18n['getText'];

}
declare const useI18n: (dictionary: Dictionary, locale?: LocaleKeys) => (key: React.ReactText) => string;
declare const useI18n: (dictionary: Dictionary, locale?: LocaleKeys) => (key: string | number) => string;
declare const _default: (options?: {}) => (WrappedComponent: any) => any;
export { _default as default, LocaleKeys, DictionaryItem, Dictionary, IWithI18nInjectedProps, IWithI18nProps, useI18n, I18nProvider, I18nConsumer };

@@ -24,3 +24,3 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

// @ts-ignore
var version = "3.12.0";
var version = "3.12.1";
sh = document.createElement('style');

@@ -27,0 +27,0 @@ sh.setAttribute('data-ui-v', version);

{
"name": "@semcore/utils",
"description": "SEMRush Utils Component",
"version": "3.12.0",
"version": "3.12.1",
"author": "Roman Lysov <r.lysov@semrush.com>",

@@ -11,2 +11,5 @@ "license": "MIT",

},
"devDependencies": {
"@semcore/core": "^0.0.1-4"
},
"dependencies": {

@@ -13,0 +16,0 @@ "@babel/runtime": "^7.9",

@@ -52,3 +52,4 @@ // @ts-ignore

export function shade(color: string, percent: number) {
export function shade(color?: string, percent: number = 1) {
if (!color) return '';
// TODO error for color name, example 'aqua'

@@ -96,3 +97,5 @@ if (color.length > 7) return shadeRGBColor(color, percent);

export function blend(colorOne: string, colorTwo: string, percent: number) {
export function blend(colorOne?: string, colorTwo?: string, percent: number = 1) {
if (!colorOne || !colorTwo) return '';
if (colorOne.length > 7) {

@@ -126,6 +129,9 @@ if (colorTwo.length > 7) {

export function opacity(color?: string, percent: number = 1) {
if (!color || !color.startsWith('#')) return '';
return `rgba(${hex2rgb(color).join(', ')}, ${percent})`;
}
export default function resolveColor(color?: string): string {
if (!color) {
return '';
}
if (!color) return '';
if (color in COLORS) {

@@ -132,0 +138,0 @@ return COLORS[color];

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc