Socket
Socket
Sign inDemoInstall

@yamada-ui/utils

Package Overview
Dependencies
Maintainers
1
Versions
382
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yamada-ui/utils - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0

dist/chunk-RJN7NAQE.mjs

2

dist/calc.d.ts

@@ -17,2 +17,2 @@ type Operand = string | number;

export { Operand, calc };
export { type Operand, calc };
import { Dict } from './index.types.js';
type ColorMode = 'light' | 'dark';
type ColorMode = "light" | "dark";
declare const hues: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];

@@ -13,2 +13,3 @@ declare const isGray: (colorScheme: string) => boolean;

declare const toneColor: (color: string, hue: (typeof hues)[number]) => (theme?: Dict, colorMode?: ColorMode) => string;
declare const toneColors: (color: string) => Record<string, string>;
declare const randomColor: ({ string, colors, }?: {

@@ -22,2 +23,2 @@ string?: string | undefined;

export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor };

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

toneColor: () => toneColor,
toneColors: () => toneColors,
transparentizeColor: () => transparentizeColor

@@ -57,5 +58,4 @@ });

const memoizedFunc = (obj, path, fallback, i) => {
if (typeof obj === "undefined") {
if (typeof obj === "undefined")
return func(obj, path, fallback);
}
if (!cache.has(obj))

@@ -75,2 +75,3 @@ cache.set(obj, /* @__PURE__ */ new Map());

// src/color.ts
var coef = 0.75;
var hues = [

@@ -89,3 +90,3 @@ 50,

];
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "zinc" || colorScheme === "neutral" || colorScheme === "stone";
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral";
var getColor = (color, fallback) => (theme = {}, colorMode) => {

@@ -131,13 +132,18 @@ var _a, _b, _c;

var toneColor = (color, hue) => (theme, colorMode) => {
const raw = getColor(color, color)(theme, colorMode);
if (hue < 50 || 950 < hue)
return color;
let n = (hue - 500) / 10;
const isLighten = n <= 0;
if (isLighten)
n *= -1;
if (n !== 0)
n = n - 5 * (isLighten ? 1 : -1);
return (0, import_color2k.toHex)(isLighten ? (0, import_color2k.lighten)(raw, n / 100) : (0, import_color2k.mix)(raw, "#000", n / 100));
let raw = color;
if (theme && colorMode)
getColor(color, color)(theme, colorMode);
const amount = (500 - hue) * 1e-3 * coef;
return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount));
};
var toneColors = (color) => {
const colors = {};
hues.forEach((hue) => {
const amount = (500 - hue) * 1e-3 * coef;
colors[hue] = (0, import_color2k.toHex)((0, import_color2k.lighten)(color, amount));
});
return colors;
};
var randomColor = ({

@@ -210,3 +216,4 @@ string,

toneColor,
toneColors,
transparentizeColor
});

@@ -18,3 +18,3 @@ import React__default from 'react';

declare const getEventRelatedTarget: (ev: React__default.FocusEvent | React__default.MouseEvent) => HTMLElement | null;
type Booleanish = boolean | 'true' | 'false';
type Booleanish = boolean | "true" | "false";
declare const dataAttr: (condition: boolean | undefined) => Booleanish;

@@ -34,2 +34,2 @@ declare const ariaAttr: (condition: boolean | undefined) => boolean | undefined;

export { FocusableElement, ariaAttr, createdDom, dataAttr, getActiveElement, getAllFocusable, getEventRelatedTarget, getOwnerDocument, getOwnerWindow, getPlatform, hasNegativeTabIndex, hasTabIndex, isActiveElement, isApple, isContains, isContentEditable, isDisabled, isElement, isFocusable, isHTMLElement, isHidden, isMac, isSafari, isTabbable, platform, vendor };
export { type FocusableElement, ariaAttr, createdDom, dataAttr, getActiveElement, getAllFocusable, getEventRelatedTarget, getOwnerDocument, getOwnerWindow, getPlatform, hasNegativeTabIndex, hasTabIndex, isActiveElement, isApple, isContains, isContentEditable, isDisabled, isElement, isFocusable, isHTMLElement, isHidden, isMac, isSafari, isTabbable, platform, vendor };
type AnyPointerEvent = MouseEvent | TouchEvent | PointerEvent;
type PointType = 'page' | 'client';
type PointType = "page" | "client";
type Point = {

@@ -30,2 +30,2 @@ x: number;

export { AnyPointerEvent, MixedEventListener, Point, PointType, PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch };
export { type AnyPointerEvent, type MixedEventListener, type Point, type PointType, type PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch };

@@ -9,3 +9,3 @@ export { Dict, Length, Merge, Path, Primitive, StringLiteral, Union } from './index.types.js';

export { Operand, calc } from './calc.js';
export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor } from './color.js';
export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor } from './color.js';
export { filterEmpty } from './array.js';

@@ -12,0 +12,0 @@ export { clampNumber, countDecimal, percentToValue, roundNumberToStep, toPrecision, valueToPercent } from './number.js';

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

toneColor: () => toneColor,
toneColors: () => toneColors,
transparentizeColor: () => transparentizeColor,

@@ -262,5 +263,4 @@ useAsync: () => useAsync,

const memoizedFunc = (obj, path, fallback, i) => {
if (typeof obj === "undefined") {
if (typeof obj === "undefined")
return func(obj, path, fallback);
}
if (!cache.has(obj))

@@ -589,2 +589,3 @@ cache.set(obj, /* @__PURE__ */ new Map());

var import_color2k = require("color2k");
var coef = 0.75;
var hues = [

@@ -603,3 +604,3 @@ 50,

];
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "zinc" || colorScheme === "neutral" || colorScheme === "stone";
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral";
var getColor = (color, fallback) => (theme = {}, colorMode) => {

@@ -645,13 +646,18 @@ var _a, _b, _c;

var toneColor = (color, hue) => (theme, colorMode) => {
const raw = getColor(color, color)(theme, colorMode);
if (hue < 50 || 950 < hue)
return color;
let n = (hue - 500) / 10;
const isLighten = n <= 0;
if (isLighten)
n *= -1;
if (n !== 0)
n = n - 5 * (isLighten ? 1 : -1);
return (0, import_color2k.toHex)(isLighten ? (0, import_color2k.lighten)(raw, n / 100) : (0, import_color2k.mix)(raw, "#000", n / 100));
let raw = color;
if (theme && colorMode)
getColor(color, color)(theme, colorMode);
const amount = (500 - hue) * 1e-3 * coef;
return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount));
};
var toneColors = (color) => {
const colors = {};
hues.forEach((hue) => {
const amount = (500 - hue) * 1e-3 * coef;
colors[hue] = (0, import_color2k.toHex)((0, import_color2k.lighten)(color, amount));
});
return colors;
};
var randomColor = ({

@@ -880,2 +886,3 @@ string,

toneColor,
toneColors,
transparentizeColor,

@@ -882,0 +889,0 @@ useAsync,

@@ -14,2 +14,2 @@ type Primitive = null | undefined | string | number | boolean | symbol | bigint;

export { Dict, Length, Merge, Path, Primitive, StringLiteral, Union };
export type { Dict, Length, Merge, Path, Primitive, StringLiteral, Union };

@@ -150,5 +150,4 @@ "use strict";

const memoizedFunc = (obj, path, fallback, i) => {
if (typeof obj === "undefined") {
if (typeof obj === "undefined")
return func(obj, path, fallback);
}
if (!cache.has(obj))

@@ -155,0 +154,0 @@ cache.set(obj, /* @__PURE__ */ new Map());

@@ -91,2 +91,2 @@ import * as React from 'react';

export { AsyncFnReturn, AsyncState, AsyncStateRetry, DOMAttributes, FunctionReturningPromise, MaybeRenderProp, PromiseType, PropGetter, RequiredPropGetter, assignRef, createContext, cx, findChildren, getValidChildren, includesChildren, isRefObject, isValidElement, mergeRefs, omitChildren, pickChildren, useAsync, useAsyncFunc, useAsyncRetry, useCallbackRef, useIsMounted, useMergeRefs, useSafeLayoutEffect, useUnmountEffect, useUpdateEffect };
export { type AsyncFnReturn, type AsyncState, type AsyncStateRetry, type DOMAttributes, type FunctionReturningPromise, type MaybeRenderProp, type PromiseType, type PropGetter, type RequiredPropGetter, assignRef, createContext, cx, findChildren, getValidChildren, includesChildren, isRefObject, isValidElement, mergeRefs, omitChildren, pickChildren, useAsync, useAsyncFunc, useAsyncRetry, useCallbackRef, useIsMounted, useMergeRefs, useSafeLayoutEffect, useUnmountEffect, useUpdateEffect };
{
"name": "@yamada-ui/utils",
"version": "0.3.3",
"version": "0.4.0",
"description": "Yamada UI utils",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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