@yamada-ui/utils 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/calc.d.mts CHANGED
@@ -14,4 +14,4 @@ declare const calc: ((x: Operand) => Calc) & {
14
14
  negate: (value: Operand) => string;
15
15
  };
16
16
 
17
- export { Operand, calc };
17
+ export { type Operand, calc };
package/dist/calc.d.ts CHANGED
@@ -14,4 +14,4 @@ declare const calc: ((x: Operand) => Calc) & {
14
14
  negate: (value: Operand) => string;
15
15
  };
16
16
 
17
- export { Operand, calc };
17
+ export { type Operand, calc };
@@ -180,6 +180,7 @@ import {
180
180
  darken,
181
181
  lighten
182
182
  } from "color2k";
183
+ var coef = 0.75;
183
184
  var hues = [
184
185
  50,
185
186
  100,
@@ -193,7 +194,7 @@ var hues = [
193
194
  900,
194
195
  950
195
196
  ];
196
- var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "zinc" || colorScheme === "neutral" || colorScheme === "stone";
197
+ var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral";
197
198
  var getColor = (color, fallback) => (theme = {}, colorMode) => {
198
199
  var _a, _b, _c;
199
200
  const [token, hue] = color.split(".");
@@ -234,16 +235,21 @@ var transparentizeColor = (color, alpha) => (theme, colorMode) => {
234
235
  return transparentize(raw, 1 - alpha);
235
236
  };
236
237
  var toneColor = (color, hue) => (theme, colorMode) => {
237
- const raw = getColor(color, color)(theme, colorMode);
238
238
  if (hue < 50 || 950 < hue)
239
239
  return color;
240
- let n = (hue - 500) / 10;
241
- const isLighten = n <= 0;
242
- if (isLighten)
243
- n *= -1;
244
- if (n !== 0)
245
- n = n - 5 * (isLighten ? 1 : -1);
246
- return toHex(isLighten ? lighten(raw, n / 100) : mix(raw, "#000", n / 100));
240
+ let raw = color;
241
+ if (theme && colorMode)
242
+ getColor(color, color)(theme, colorMode);
243
+ const amount = (500 - hue) * 1e-3 * coef;
244
+ return toHex(lighten(raw, amount));
245
+ };
246
+ var toneColors = (color) => {
247
+ const colors = {};
248
+ hues.forEach((hue) => {
249
+ const amount = (500 - hue) * 1e-3 * coef;
250
+ colors[hue] = toHex(lighten(color, amount));
251
+ });
252
+ return colors;
247
253
  };
248
254
  var randomColor = ({
249
255
  string,
@@ -404,9 +410,8 @@ var getObject = (obj, path, fallback, i) => {
404
410
  var memoizeObject = (func) => {
405
411
  const cache = /* @__PURE__ */ new WeakMap();
406
412
  const memoizedFunc = (obj, path, fallback, i) => {
407
- if (typeof obj === "undefined") {
413
+ if (typeof obj === "undefined")
408
414
  return func(obj, path, fallback);
409
- }
410
415
  if (!cache.has(obj))
411
416
  cache.set(obj, /* @__PURE__ */ new Map());
412
417
  const map = cache.get(obj);
@@ -485,6 +490,7 @@ export {
485
490
  shadeColor,
486
491
  transparentizeColor,
487
492
  toneColor,
493
+ toneColors,
488
494
  randomColor,
489
495
  isTone,
490
496
  isLight,
package/dist/color.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Dict } from './index.types.mjs';
2
2
 
3
- type ColorMode = 'light' | 'dark';
3
+ type ColorMode = "light" | "dark";
4
4
  declare const hues: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
5
5
  declare const isGray: (colorScheme: string) => boolean;
6
6
  declare const getColor: (color: string, fallback?: string) => (theme?: Dict, colorMode?: ColorMode) => string;
@@ -10,6 +10,7 @@ declare const tintColor: (color: string, amount: number) => (theme?: Dict, color
10
10
  declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => string;
11
11
  declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: ColorMode) => string;
12
12
  declare const toneColor: (color: string, hue: (typeof hues)[number]) => (theme?: Dict, colorMode?: ColorMode) => string;
13
+ declare const toneColors: (color: string) => Record<string, string>;
13
14
  declare const randomColor: ({ string, colors, }?: {
14
15
  string?: string | undefined;
15
16
  colors?: string[] | undefined;
@@ -18,4 +19,4 @@ declare const isTone: (color: string) => (theme?: Dict, colorMode?: ColorMode) =
18
19
  declare const isLight: (color: string) => (theme?: Dict, colorMode?: ColorMode) => boolean;
19
20
  declare const isDark: (color: string) => (theme?: Dict, colorMode?: ColorMode) => boolean;
20
21
 
21
- export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
22
+ export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor };
package/dist/color.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Dict } from './index.types.js';
2
2
 
3
- type ColorMode = 'light' | 'dark';
3
+ type ColorMode = "light" | "dark";
4
4
  declare const hues: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
5
5
  declare const isGray: (colorScheme: string) => boolean;
6
6
  declare const getColor: (color: string, fallback?: string) => (theme?: Dict, colorMode?: ColorMode) => string;
@@ -10,6 +10,7 @@ declare const tintColor: (color: string, amount: number) => (theme?: Dict, color
10
10
  declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => string;
11
11
  declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: ColorMode) => string;
12
12
  declare const toneColor: (color: string, hue: (typeof hues)[number]) => (theme?: Dict, colorMode?: ColorMode) => string;
13
+ declare const toneColors: (color: string) => Record<string, string>;
13
14
  declare const randomColor: ({ string, colors, }?: {
14
15
  string?: string | undefined;
15
16
  colors?: string[] | undefined;
@@ -18,4 +19,4 @@ declare const isTone: (color: string) => (theme?: Dict, colorMode?: ColorMode) =
18
19
  declare const isLight: (color: string) => (theme?: Dict, colorMode?: ColorMode) => boolean;
19
20
  declare const isDark: (color: string) => (theme?: Dict, colorMode?: ColorMode) => boolean;
20
21
 
21
- export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
22
+ export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor };
package/dist/color.js CHANGED
@@ -32,6 +32,7 @@ __export(color_exports, {
32
32
  shadeColor: () => shadeColor,
33
33
  tintColor: () => tintColor,
34
34
  toneColor: () => toneColor,
35
+ toneColors: () => toneColors,
35
36
  transparentizeColor: () => transparentizeColor
36
37
  });
37
38
  module.exports = __toCommonJS(color_exports);
@@ -53,9 +54,8 @@ var getObject = (obj, path, fallback, i) => {
53
54
  var memoizeObject = (func) => {
54
55
  const cache = /* @__PURE__ */ new WeakMap();
55
56
  const memoizedFunc = (obj, path, fallback, i) => {
56
- if (typeof obj === "undefined") {
57
+ if (typeof obj === "undefined")
57
58
  return func(obj, path, fallback);
58
- }
59
59
  if (!cache.has(obj))
60
60
  cache.set(obj, /* @__PURE__ */ new Map());
61
61
  const map = cache.get(obj);
@@ -70,6 +70,7 @@ var memoizeObject = (func) => {
70
70
  var getMemoizedObject = memoizeObject(getObject);
71
71
 
72
72
  // src/color.ts
73
+ var coef = 0.75;
73
74
  var hues = [
74
75
  50,
75
76
  100,
@@ -83,7 +84,7 @@ var hues = [
83
84
  900,
84
85
  950
85
86
  ];
86
- var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "zinc" || colorScheme === "neutral" || colorScheme === "stone";
87
+ var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral";
87
88
  var getColor = (color, fallback) => (theme = {}, colorMode) => {
88
89
  var _a, _b, _c;
89
90
  const [token, hue] = color.split(".");
@@ -124,16 +125,21 @@ var transparentizeColor = (color, alpha) => (theme, colorMode) => {
124
125
  return (0, import_color2k.transparentize)(raw, 1 - alpha);
125
126
  };
126
127
  var toneColor = (color, hue) => (theme, colorMode) => {
127
- const raw = getColor(color, color)(theme, colorMode);
128
128
  if (hue < 50 || 950 < hue)
129
129
  return color;
130
- let n = (hue - 500) / 10;
131
- const isLighten = n <= 0;
132
- if (isLighten)
133
- n *= -1;
134
- if (n !== 0)
135
- n = n - 5 * (isLighten ? 1 : -1);
136
- return (0, import_color2k.toHex)(isLighten ? (0, import_color2k.lighten)(raw, n / 100) : (0, import_color2k.mix)(raw, "#000", n / 100));
130
+ let raw = color;
131
+ if (theme && colorMode)
132
+ getColor(color, color)(theme, colorMode);
133
+ const amount = (500 - hue) * 1e-3 * coef;
134
+ return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount));
135
+ };
136
+ var toneColors = (color) => {
137
+ const colors = {};
138
+ hues.forEach((hue) => {
139
+ const amount = (500 - hue) * 1e-3 * coef;
140
+ colors[hue] = (0, import_color2k.toHex)((0, import_color2k.lighten)(color, amount));
141
+ });
142
+ return colors;
137
143
  };
138
144
  var randomColor = ({
139
145
  string,
@@ -202,5 +208,6 @@ var isDark = (color) => (theme, colorMode) => isTone(color)(theme, colorMode) ==
202
208
  shadeColor,
203
209
  tintColor,
204
210
  toneColor,
211
+ toneColors,
205
212
  transparentizeColor
206
213
  });
package/dist/color.mjs CHANGED
@@ -11,8 +11,9 @@ import {
11
11
  shadeColor,
12
12
  tintColor,
13
13
  toneColor,
14
+ toneColors,
14
15
  transparentizeColor
15
- } from "./chunk-5OQGKXOK.mjs";
16
+ } from "./chunk-RJN7NAQE.mjs";
16
17
  import "./chunk-SLJ4M7XC.mjs";
17
18
  import "./chunk-VYMGBE25.mjs";
18
19
  import "./chunk-BZAW2D6U.mjs";
@@ -34,5 +35,6 @@ export {
34
35
  shadeColor,
35
36
  tintColor,
36
37
  toneColor,
38
+ toneColors,
37
39
  transparentizeColor
38
40
  };
package/dist/dom.d.mts CHANGED
@@ -15,7 +15,7 @@ declare const hasTabIndex: (el: HTMLElement) => boolean;
15
15
  declare const isContentEditable: (el: HTMLElement) => boolean;
16
16
  declare const isContains: (parent: HTMLElement | null, child: HTMLElement | null) => boolean | undefined;
17
17
  declare const getEventRelatedTarget: (ev: React__default.FocusEvent | React__default.MouseEvent) => HTMLElement | null;
18
- type Booleanish = boolean | 'true' | 'false';
18
+ type Booleanish = boolean | "true" | "false";
19
19
  declare const dataAttr: (condition: boolean | undefined) => Booleanish;
20
20
  declare const ariaAttr: (condition: boolean | undefined) => boolean | undefined;
21
21
  type FocusableElement = {
@@ -30,4 +30,4 @@ declare const getOwnerDocument: (el?: Element | null) => Document;
30
30
  declare const getActiveElement: (el?: HTMLElement) => HTMLElement;
31
31
  declare const isActiveElement: (el: HTMLElement) => boolean;
32
32
 
33
- 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 };
33
+ 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 };
package/dist/dom.d.ts CHANGED
@@ -15,7 +15,7 @@ declare const hasTabIndex: (el: HTMLElement) => boolean;
15
15
  declare const isContentEditable: (el: HTMLElement) => boolean;
16
16
  declare const isContains: (parent: HTMLElement | null, child: HTMLElement | null) => boolean | undefined;
17
17
  declare const getEventRelatedTarget: (ev: React__default.FocusEvent | React__default.MouseEvent) => HTMLElement | null;
18
- type Booleanish = boolean | 'true' | 'false';
18
+ type Booleanish = boolean | "true" | "false";
19
19
  declare const dataAttr: (condition: boolean | undefined) => Booleanish;
20
20
  declare const ariaAttr: (condition: boolean | undefined) => boolean | undefined;
21
21
  type FocusableElement = {
@@ -30,4 +30,4 @@ declare const getOwnerDocument: (el?: Element | null) => Document;
30
30
  declare const getActiveElement: (el?: HTMLElement) => HTMLElement;
31
31
  declare const isActiveElement: (el: HTMLElement) => boolean;
32
32
 
33
- 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 };
33
+ 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 };
package/dist/event.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  type AnyPointerEvent = MouseEvent | TouchEvent | PointerEvent;
2
- type PointType = 'page' | 'client';
2
+ type PointType = "page" | "client";
3
3
  type Point = {
4
4
  x: number;
5
5
  y: number;
@@ -27,4 +27,4 @@ declare const getEventPoint: (ev: AnyPointerEvent, type?: PointType) => {
27
27
  declare const addDomEvent: (target: EventTarget, type: string, cb: EventListener, options?: AddEventListenerOptions) => () => void;
28
28
  declare const addPointerEvent: (target: EventTarget, type: string, cb: MixedEventListener, options?: AddEventListenerOptions) => () => void;
29
29
 
30
- export { AnyPointerEvent, MixedEventListener, Point, PointType, PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch };
30
+ export { type AnyPointerEvent, type MixedEventListener, type Point, type PointType, type PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch };
package/dist/event.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  type AnyPointerEvent = MouseEvent | TouchEvent | PointerEvent;
2
- type PointType = 'page' | 'client';
2
+ type PointType = "page" | "client";
3
3
  type Point = {
4
4
  x: number;
5
5
  y: number;
@@ -27,4 +27,4 @@ declare const getEventPoint: (ev: AnyPointerEvent, type?: PointType) => {
27
27
  declare const addDomEvent: (target: EventTarget, type: string, cb: EventListener, options?: AddEventListenerOptions) => () => void;
28
28
  declare const addPointerEvent: (target: EventTarget, type: string, cb: MixedEventListener, options?: AddEventListenerOptions) => () => void;
29
29
 
30
- export { AnyPointerEvent, MixedEventListener, Point, PointType, PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch };
30
+ export { type AnyPointerEvent, type MixedEventListener, type Point, type PointType, type PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch };
package/dist/function.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  handlerAll,
4
4
  noop,
5
5
  runIfFunc
6
- } from "./chunk-5OQGKXOK.mjs";
6
+ } from "./chunk-RJN7NAQE.mjs";
7
7
  import "./chunk-SLJ4M7XC.mjs";
8
8
  import "./chunk-VYMGBE25.mjs";
9
9
  import "./chunk-BZAW2D6U.mjs";
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { Dict, Length, Path, Primitive, StringLiteral, Union } from './index.types.mjs';
1
+ export { Dict, Length, Merge, Path, Primitive, StringLiteral, Union } from './index.types.mjs';
2
2
  export { cast, isArray, isEmpty, isFunction, isNotNumber, isNull, isNumber, isNumeric, isObject, isString, isUndefined, isUnit } from './assertion.mjs';
3
3
  export { assignAfter, filterObject, filterUndefined, flattenObject, getMemoizedObject, getObject, keysFormObject, memoizeObject, merge, objectFromEntries, omitObject, pickObject, replaceObject, splitObject } from './object.mjs';
4
4
  export { funcAll, handlerAll, noop, runIfFunc } from './function.mjs';
@@ -6,7 +6,7 @@ export { AsyncFnReturn, AsyncState, AsyncStateRetry, DOMAttributes, FunctionRetu
6
6
  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.mjs';
7
7
  export { escape } from './string.mjs';
8
8
  export { Operand, calc } from './calc.mjs';
9
- export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor } from './color.mjs';
9
+ export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor } from './color.mjs';
10
10
  export { filterEmpty } from './array.mjs';
11
11
  export { clampNumber, countDecimal, percentToValue, roundNumberToStep, toPrecision, valueToPercent } from './number.mjs';
12
12
  export { AnyPointerEvent, MixedEventListener, Point, PointType, PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch } from './event.mjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Dict, Length, Path, Primitive, StringLiteral, Union } from './index.types.js';
1
+ export { Dict, Length, Merge, Path, Primitive, StringLiteral, Union } from './index.types.js';
2
2
  export { cast, isArray, isEmpty, isFunction, isNotNumber, isNull, isNumber, isNumeric, isObject, isString, isUndefined, isUnit } from './assertion.js';
3
3
  export { assignAfter, filterObject, filterUndefined, flattenObject, getMemoizedObject, getObject, keysFormObject, memoizeObject, merge, objectFromEntries, omitObject, pickObject, replaceObject, splitObject } from './object.js';
4
4
  export { funcAll, handlerAll, noop, runIfFunc } from './function.js';
@@ -6,7 +6,7 @@ export { AsyncFnReturn, AsyncState, AsyncStateRetry, DOMAttributes, FunctionRetu
6
6
  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';
7
7
  export { escape } from './string.js';
8
8
  export { Operand, calc } from './calc.js';
9
- export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor } from './color.js';
9
+ export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor } from './color.js';
10
10
  export { filterEmpty } from './array.js';
11
11
  export { clampNumber, countDecimal, percentToValue, roundNumberToStep, toPrecision, valueToPercent } from './number.js';
12
12
  export { AnyPointerEvent, MixedEventListener, Point, PointType, PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch } from './event.js';
package/dist/index.js CHANGED
@@ -124,6 +124,7 @@ __export(src_exports, {
124
124
  tintColor: () => tintColor,
125
125
  toPrecision: () => toPrecision,
126
126
  toneColor: () => toneColor,
127
+ toneColors: () => toneColors,
127
128
  transparentizeColor: () => transparentizeColor,
128
129
  useAsync: () => useAsync,
129
130
  useAsyncFunc: () => useAsyncFunc,
@@ -258,9 +259,8 @@ var getObject = (obj, path, fallback, i) => {
258
259
  var memoizeObject = (func) => {
259
260
  const cache = /* @__PURE__ */ new WeakMap();
260
261
  const memoizedFunc = (obj, path, fallback, i) => {
261
- if (typeof obj === "undefined") {
262
+ if (typeof obj === "undefined")
262
263
  return func(obj, path, fallback);
263
- }
264
264
  if (!cache.has(obj))
265
265
  cache.set(obj, /* @__PURE__ */ new Map());
266
266
  const map = cache.get(obj);
@@ -584,6 +584,7 @@ var calc = Object.assign(
584
584
 
585
585
  // src/color.ts
586
586
  var import_color2k = require("color2k");
587
+ var coef = 0.75;
587
588
  var hues = [
588
589
  50,
589
590
  100,
@@ -597,7 +598,7 @@ var hues = [
597
598
  900,
598
599
  950
599
600
  ];
600
- var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "zinc" || colorScheme === "neutral" || colorScheme === "stone";
601
+ var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral";
601
602
  var getColor = (color, fallback) => (theme = {}, colorMode) => {
602
603
  var _a, _b, _c;
603
604
  const [token, hue] = color.split(".");
@@ -638,16 +639,21 @@ var transparentizeColor = (color, alpha) => (theme, colorMode) => {
638
639
  return (0, import_color2k.transparentize)(raw, 1 - alpha);
639
640
  };
640
641
  var toneColor = (color, hue) => (theme, colorMode) => {
641
- const raw = getColor(color, color)(theme, colorMode);
642
642
  if (hue < 50 || 950 < hue)
643
643
  return color;
644
- let n = (hue - 500) / 10;
645
- const isLighten = n <= 0;
646
- if (isLighten)
647
- n *= -1;
648
- if (n !== 0)
649
- n = n - 5 * (isLighten ? 1 : -1);
650
- return (0, import_color2k.toHex)(isLighten ? (0, import_color2k.lighten)(raw, n / 100) : (0, import_color2k.mix)(raw, "#000", n / 100));
644
+ let raw = color;
645
+ if (theme && colorMode)
646
+ getColor(color, color)(theme, colorMode);
647
+ const amount = (500 - hue) * 1e-3 * coef;
648
+ return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount));
649
+ };
650
+ var toneColors = (color) => {
651
+ const colors = {};
652
+ hues.forEach((hue) => {
653
+ const amount = (500 - hue) * 1e-3 * coef;
654
+ colors[hue] = (0, import_color2k.toHex)((0, import_color2k.lighten)(color, amount));
655
+ });
656
+ return colors;
651
657
  };
652
658
  var randomColor = ({
653
659
  string,
@@ -872,6 +878,7 @@ var addPointerEvent = (target, type, cb, options) => addDomEvent(target, type, w
872
878
  tintColor,
873
879
  toPrecision,
874
880
  toneColor,
881
+ toneColors,
875
882
  transparentizeColor,
876
883
  useAsync,
877
884
  useAsyncFunc,
package/dist/index.mjs CHANGED
@@ -40,6 +40,7 @@ import {
40
40
  splitObject,
41
41
  tintColor,
42
42
  toneColor,
43
+ toneColors,
43
44
  transparentizeColor,
44
45
  useAsync,
45
46
  useAsyncFunc,
@@ -50,7 +51,7 @@ import {
50
51
  useSafeLayoutEffect,
51
52
  useUnmountEffect,
52
53
  useUpdateEffect
53
- } from "./chunk-5OQGKXOK.mjs";
54
+ } from "./chunk-RJN7NAQE.mjs";
54
55
  import "./chunk-SLJ4M7XC.mjs";
55
56
  import {
56
57
  clampNumber,
@@ -216,6 +217,7 @@ export {
216
217
  tintColor,
217
218
  toPrecision,
218
219
  toneColor,
220
+ toneColors,
219
221
  transparentizeColor,
220
222
  useAsync,
221
223
  useAsyncFunc,
@@ -7,5 +7,8 @@ type Dict<T = any> = Record<string, T>;
7
7
  type StringLiteral = string & {};
8
8
  type Union<T> = T | StringLiteral;
9
9
  type Length = string | 0 | number;
10
+ type Merge<T extends object> = {
11
+ [K in keyof T]: T[K];
12
+ };
10
13
 
11
- export { Dict, Length, Path, Primitive, StringLiteral, Union };
14
+ export type { Dict, Length, Merge, Path, Primitive, StringLiteral, Union };
@@ -7,5 +7,8 @@ type Dict<T = any> = Record<string, T>;
7
7
  type StringLiteral = string & {};
8
8
  type Union<T> = T | StringLiteral;
9
9
  type Length = string | 0 | number;
10
+ type Merge<T extends object> = {
11
+ [K in keyof T]: T[K];
12
+ };
10
13
 
11
- export { Dict, Length, Path, Primitive, StringLiteral, Union };
14
+ export type { Dict, Length, Merge, Path, Primitive, StringLiteral, Union };
package/dist/object.js CHANGED
@@ -147,9 +147,8 @@ var getObject = (obj, path, fallback, i) => {
147
147
  var memoizeObject = (func) => {
148
148
  const cache = /* @__PURE__ */ new WeakMap();
149
149
  const memoizedFunc = (obj, path, fallback, i) => {
150
- if (typeof obj === "undefined") {
150
+ if (typeof obj === "undefined")
151
151
  return func(obj, path, fallback);
152
- }
153
152
  if (!cache.has(obj))
154
153
  cache.set(obj, /* @__PURE__ */ new Map());
155
154
  const map = cache.get(obj);
package/dist/object.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  pickObject,
14
14
  replaceObject,
15
15
  splitObject
16
- } from "./chunk-5OQGKXOK.mjs";
16
+ } from "./chunk-RJN7NAQE.mjs";
17
17
  import "./chunk-SLJ4M7XC.mjs";
18
18
  import "./chunk-VYMGBE25.mjs";
19
19
  import "./chunk-BZAW2D6U.mjs";
package/dist/react.d.mts CHANGED
@@ -88,4 +88,4 @@ declare const useAsyncRetry: <T>(func: () => Promise<T>, deps?: React.Dependency
88
88
  value: T;
89
89
  };
90
90
 
91
- 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 };
91
+ 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 };
package/dist/react.d.ts CHANGED
@@ -88,4 +88,4 @@ declare const useAsyncRetry: <T>(func: () => Promise<T>, deps?: React.Dependency
88
88
  value: T;
89
89
  };
90
90
 
91
- 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 };
91
+ 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 };
package/dist/react.mjs CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  useSafeLayoutEffect,
20
20
  useUnmountEffect,
21
21
  useUpdateEffect
22
- } from "./chunk-5OQGKXOK.mjs";
22
+ } from "./chunk-RJN7NAQE.mjs";
23
23
  import "./chunk-SLJ4M7XC.mjs";
24
24
  import "./chunk-VYMGBE25.mjs";
25
25
  import "./chunk-BZAW2D6U.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/utils",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Yamada UI utils",
5
5
  "keywords": [
6
6
  "utils",