@yamada-ui/utils
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -6,2 +6,3 @@ import { Dict } from './index.types.js'; | ||
declare const isGray: (colorScheme: string) => boolean; | ||
declare const isAccessible: (colorScheme: string) => boolean; | ||
declare const getColor: (color: string, fallback?: string) => (theme?: Dict, colorMode?: ColorMode) => string; | ||
@@ -13,4 +14,4 @@ declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => string; | ||
declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: ColorMode) => string; | ||
declare const toneColor: (color: string, hue: (typeof hues)[number]) => (theme?: Dict, colorMode?: ColorMode) => string; | ||
declare const toneColors: (color: string) => Record<string, string>; | ||
declare const toneColor: (color: string, hue: (typeof hues)[number], lCoef?: number, dCoef?: number) => (theme?: Dict, colorMode?: ColorMode) => string; | ||
declare const toneColors: (color: string, lCoef?: number, dCoef?: number) => Record<string, string>; | ||
declare const randomColor: ({ string, colors, }?: { | ||
@@ -24,2 +25,2 @@ string?: string | undefined; | ||
export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor }; | ||
export { darkenColor, getColor, hues, isAccessible, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor }; |
@@ -26,2 +26,3 @@ "use strict"; | ||
hues: () => hues, | ||
isAccessible: () => isAccessible, | ||
isDark: () => isDark, | ||
@@ -74,3 +75,2 @@ isGray: () => isGray, | ||
// src/color.ts | ||
var coef = 0.75; | ||
var hues = [ | ||
@@ -90,2 +90,3 @@ 50, | ||
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral"; | ||
var isAccessible = (colorScheme) => colorScheme === "yellow" || colorScheme === "cyan" || colorScheme === "lime"; | ||
var getColor = (color, fallback) => (theme = {}, colorMode) => { | ||
@@ -120,3 +121,3 @@ var _a, _b, _c; | ||
const raw = getColor(color, color)(theme, colorMode); | ||
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount)); | ||
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount / 100)); | ||
}; | ||
@@ -131,3 +132,3 @@ var shadeColor = (color, amount) => (theme, colorMode) => { | ||
}; | ||
var toneColor = (color, hue) => (theme, colorMode) => { | ||
var toneColor = (color, hue, lCoef = 0.94, dCoef = 0.86) => (theme, colorMode) => { | ||
if (hue < 50 || 950 < hue) | ||
@@ -138,8 +139,10 @@ return color; | ||
getColor(color, color)(theme, colorMode); | ||
const coef = hue < 500 ? lCoef : dCoef; | ||
const amount = (500 - hue) * 1e-3 * coef; | ||
return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount)); | ||
}; | ||
var toneColors = (color) => { | ||
var toneColors = (color, lCoef = 0.94, dCoef = 0.86) => { | ||
const colors = {}; | ||
hues.forEach((hue) => { | ||
const coef = hue < 500 ? lCoef : dCoef; | ||
const amount = (500 - hue) * 1e-3 * coef; | ||
@@ -208,2 +211,3 @@ colors[hue] = (0, import_color2k.toHex)((0, import_color2k.lighten)(color, amount)); | ||
hues, | ||
isAccessible, | ||
isDark, | ||
@@ -210,0 +214,0 @@ isGray, |
@@ -5,7 +5,7 @@ export { Dict, Length, Merge, Path, Primitive, StringLiteral, Union } from './index.types.js'; | ||
export { funcAll, handlerAll, noop, runIfFunc } from './function.js'; | ||
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 } from './react.js'; | ||
export { AsyncFnReturn, AsyncState, AsyncStateRetry, DOMAttributes, FunctionReturningPromise, MaybeRenderProp, PromiseType, PropGetter, RequiredPropGetter, assignRef, createContext, createId, cx, findChildren, getValidChildren, includesChildren, isRefObject, isValidElement, mergeRefs, omitChildren, pickChildren, useAsync, useAsyncFunc, useAsyncRetry, useCallbackRef, useIsMounted, useMergeRefs, useSafeLayoutEffect, useUnmountEffect, useUpdateEffect } from './react.js'; | ||
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 } from './dom.js'; | ||
export { escape } from './string.js'; | ||
export { Operand, calc } from './calc.js'; | ||
export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor } from './color.js'; | ||
export { darkenColor, getColor, hues, isAccessible, 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'; |
@@ -43,2 +43,3 @@ "use strict"; | ||
createContext: () => createContext2, | ||
createId: () => createId, | ||
createdDom: () => createdDom, | ||
@@ -72,2 +73,3 @@ cx: () => cx, | ||
includesChildren: () => includesChildren, | ||
isAccessible: () => isAccessible, | ||
isActiveElement: () => isActiveElement, | ||
@@ -460,2 +462,3 @@ isApple: () => isApple, | ||
}; | ||
var createId = (prefix) => `${prefix}-${(/* @__PURE__ */ new Date()).getTime()}`; | ||
@@ -590,3 +593,2 @@ // src/dom.ts | ||
var import_color2k = require("color2k"); | ||
var coef = 0.75; | ||
var hues = [ | ||
@@ -606,2 +608,3 @@ 50, | ||
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral"; | ||
var isAccessible = (colorScheme) => colorScheme === "yellow" || colorScheme === "cyan" || colorScheme === "lime"; | ||
var getColor = (color, fallback) => (theme = {}, colorMode) => { | ||
@@ -636,3 +639,3 @@ var _a, _b, _c; | ||
const raw = getColor(color, color)(theme, colorMode); | ||
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount)); | ||
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount / 100)); | ||
}; | ||
@@ -647,3 +650,3 @@ var shadeColor = (color, amount) => (theme, colorMode) => { | ||
}; | ||
var toneColor = (color, hue) => (theme, colorMode) => { | ||
var toneColor = (color, hue, lCoef = 0.94, dCoef = 0.86) => (theme, colorMode) => { | ||
if (hue < 50 || 950 < hue) | ||
@@ -654,8 +657,10 @@ return color; | ||
getColor(color, color)(theme, colorMode); | ||
const coef = hue < 500 ? lCoef : dCoef; | ||
const amount = (500 - hue) * 1e-3 * coef; | ||
return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount)); | ||
}; | ||
var toneColors = (color) => { | ||
var toneColors = (color, lCoef = 0.94, dCoef = 0.86) => { | ||
const colors = {}; | ||
hues.forEach((hue) => { | ||
const coef = hue < 500 ? lCoef : dCoef; | ||
const amount = (500 - hue) * 1e-3 * coef; | ||
@@ -805,2 +810,3 @@ colors[hue] = (0, import_color2k.toHex)((0, import_color2k.lighten)(color, amount)); | ||
createContext, | ||
createId, | ||
createdDom, | ||
@@ -834,2 +840,3 @@ cx, | ||
includesChildren, | ||
isAccessible, | ||
isActiveElement, | ||
@@ -836,0 +843,0 @@ isApple, |
@@ -90,3 +90,4 @@ import * as React from 'react'; | ||
}; | ||
declare const createId: (prefix: string) => string; | ||
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 }; | ||
export { type AsyncFnReturn, type AsyncState, type AsyncStateRetry, type DOMAttributes, type FunctionReturningPromise, type MaybeRenderProp, type PromiseType, type PropGetter, type RequiredPropGetter, assignRef, createContext, createId, cx, findChildren, getValidChildren, includesChildren, isRefObject, isValidElement, mergeRefs, omitChildren, pickChildren, useAsync, useAsyncFunc, useAsyncRetry, useCallbackRef, useIsMounted, useMergeRefs, useSafeLayoutEffect, useUnmountEffect, useUpdateEffect }; |
@@ -35,2 +35,3 @@ "use strict"; | ||
createContext: () => createContext2, | ||
createId: () => createId, | ||
cx: () => cx, | ||
@@ -213,2 +214,3 @@ findChildren: () => findChildren, | ||
}; | ||
var createId = (prefix) => `${prefix}-${(/* @__PURE__ */ new Date()).getTime()}`; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -218,2 +220,3 @@ 0 && (module.exports = { | ||
createContext, | ||
createId, | ||
cx, | ||
@@ -220,0 +223,0 @@ findChildren, |
{ | ||
"name": "@yamada-ui/utils", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Yamada UI utils", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -27,3 +27,3 @@ # @yamada-ui/utils | ||
## Licence | ||
## License | ||
@@ -30,0 +30,0 @@ This package is licensed under the terms of the |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139893
3655