@yamada-ui/utils 1.0.8 → 1.1.0-dev-20240406104355

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.
@@ -12,7 +12,5 @@ declare const isEmpty: (value: any) => boolean;
12
12
  declare const isFunction: <T extends Function = Function>(value: any) => value is T;
13
13
  declare const isUnit: (value: any) => boolean;
14
14
  declare const cast: <T>(value: any) => T;
15
- declare const toCamelCase: (value: string & {}) => string;
16
- declare const toKebabCase: (value: string & {}) => string;
17
15
 
18
- export { cast, isArray, isEmpty, isFunction, isNotNumber, isNull, isNumber, isNumeric, isObject, isString, isUndefined, isUnit, toCamelCase, toKebabCase };
16
+ export { cast, isArray, isEmpty, isFunction, isNotNumber, isNull, isNumber, isNumeric, isObject, isString, isUndefined, isUnit };
@@ -12,7 +12,5 @@ declare const isEmpty: (value: any) => boolean;
12
12
  declare const isFunction: <T extends Function = Function>(value: any) => value is T;
13
13
  declare const isUnit: (value: any) => boolean;
14
14
  declare const cast: <T>(value: any) => T;
15
- declare const toCamelCase: (value: string & {}) => string;
16
- declare const toKebabCase: (value: string & {}) => string;
17
15
 
18
- export { cast, isArray, isEmpty, isFunction, isNotNumber, isNull, isNumber, isNumeric, isObject, isString, isUndefined, isUnit, toCamelCase, toKebabCase };
16
+ export { cast, isArray, isEmpty, isFunction, isNotNumber, isNull, isNumber, isNumeric, isObject, isString, isUndefined, isUnit };
package/dist/assertion.js CHANGED
@@ -31,9 +31,7 @@ __export(assertion_exports, {
31
31
  isObject: () => isObject,
32
32
  isString: () => isString,
33
33
  isUndefined: () => isUndefined,
34
- isUnit: () => isUnit,
35
- toCamelCase: () => toCamelCase,
36
- toKebabCase: () => toKebabCase
34
+ isUnit: () => isUnit
37
35
  });
38
36
  module.exports = __toCommonJS(assertion_exports);
39
37
  var isNumber = (value) => typeof value === "number";
@@ -48,8 +46,6 @@ var isEmpty = (value) => !isArray(value) || !value.length || value.every((v) =>
48
46
  var isFunction = (value) => typeof value === "function";
49
47
  var isUnit = (value) => /[0-9].*[px|rem|em|%|vw|vh]$/.test(value);
50
48
  var cast = (value) => value;
51
- var toCamelCase = (value) => value.toLowerCase().replace(/-(.)/g, (_, group1) => group1.toUpperCase()).replace(/^(.)/, (_, group1) => group1.toUpperCase());
52
- var toKebabCase = (value) => value.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, "");
53
49
  // Annotate the CommonJS export names for ESM import in node:
54
50
  0 && (module.exports = {
55
51
  cast,
@@ -63,8 +59,6 @@ var toKebabCase = (value) => value.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$
63
59
  isObject,
64
60
  isString,
65
61
  isUndefined,
66
- isUnit,
67
- toCamelCase,
68
- toKebabCase
62
+ isUnit
69
63
  });
70
64
  //# sourceMappingURL=assertion.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/assertion.ts"],"sourcesContent":["import type { Dict } from \".\"\n\nexport const isNumber = (value: any): value is number =>\n typeof value === \"number\"\n\nexport const isNotNumber = (value: any): boolean =>\n typeof value !== \"number\" || Number.isNaN(value) || !Number.isFinite(value)\n\nexport const isNumeric = (value: any): boolean =>\n value != null &&\n parseFloat(value.toString()) - parseFloat(value.toString()) + 1 >= 0\n\nexport const isString = (value: any): value is string =>\n Object.prototype.toString.call(value) === \"[object String]\"\n\nexport const isUndefined = (value: any): value is undefined =>\n typeof value === \"undefined\" && value === undefined\n\nexport const isNull = (value: any): value is null => value === null\n\nexport const isObject = <T extends Dict>(value: any): value is T =>\n value !== null &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n !isArray(value)\n\nexport const isArray = <T extends any[]>(value: any): value is T =>\n Array.isArray(value)\n\nexport const isEmpty = (value: any): boolean =>\n !isArray(value) || !value.length || value.every((v) => v == null)\n\nexport const isFunction = <T extends Function = Function>(\n value: any,\n): value is T => typeof value === \"function\"\n\nexport const isUnit = (value: any): boolean =>\n /[0-9].*[px|rem|em|%|vw|vh]$/.test(value)\n\nexport const cast = <T>(value: any) => value as T\n\nexport const toCamelCase = (value: string & {}) =>\n value\n .toLowerCase()\n .replace(/-(.)/g, (_, group1) => group1.toUpperCase())\n .replace(/^(.)/, (_, group1) => group1.toUpperCase())\n\nexport const toKebabCase = (value: string & {}) =>\n value\n .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, \"$1-$2\")\n .toLowerCase()\n .replace(/^-/, \"\")\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU;AAEZ,IAAM,cAAc,CAAC,UAC1B,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,KAAK,CAAC,OAAO,SAAS,KAAK;AAErE,IAAM,YAAY,CAAC,UACxB,SAAS,QACT,WAAW,MAAM,SAAS,CAAC,IAAI,WAAW,MAAM,SAAS,CAAC,IAAI,KAAK;AAE9D,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AAErC,IAAM,cAAc,CAAC,UAC1B,OAAO,UAAU,eAAe,UAAU;AAErC,IAAM,SAAS,CAAC,UAA8B,UAAU;AAExD,IAAM,WAAW,CAAiB,UACvC,UAAU,SACT,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C,CAAC,QAAQ,KAAK;AAET,IAAM,UAAU,CAAkB,UACvC,MAAM,QAAQ,KAAK;AAEd,IAAM,UAAU,CAAC,UACtB,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,UAAU,MAAM,MAAM,CAAC,MAAM,KAAK,IAAI;AAE3D,IAAM,aAAa,CACxB,UACe,OAAO,UAAU;AAE3B,IAAM,SAAS,CAAC,UACrB,8BAA8B,KAAK,KAAK;AAEnC,IAAM,OAAO,CAAI,UAAe;AAEhC,IAAM,cAAc,CAAC,UAC1B,MACG,YAAY,EACZ,QAAQ,SAAS,CAAC,GAAG,WAAW,OAAO,YAAY,CAAC,EACpD,QAAQ,QAAQ,CAAC,GAAG,WAAW,OAAO,YAAY,CAAC;AAEjD,IAAM,cAAc,CAAC,UAC1B,MACG,QAAQ,gCAAgC,OAAO,EAC/C,YAAY,EACZ,QAAQ,MAAM,EAAE;","names":[]}
1
+ {"version":3,"sources":["../src/assertion.ts"],"sourcesContent":["import type { Dict } from \".\"\n\nexport const isNumber = (value: any): value is number =>\n typeof value === \"number\"\n\nexport const isNotNumber = (value: any): boolean =>\n typeof value !== \"number\" || Number.isNaN(value) || !Number.isFinite(value)\n\nexport const isNumeric = (value: any): boolean =>\n value != null &&\n parseFloat(value.toString()) - parseFloat(value.toString()) + 1 >= 0\n\nexport const isString = (value: any): value is string =>\n Object.prototype.toString.call(value) === \"[object String]\"\n\nexport const isUndefined = (value: any): value is undefined =>\n typeof value === \"undefined\" && value === undefined\n\nexport const isNull = (value: any): value is null => value === null\n\nexport const isObject = <T extends Dict>(value: any): value is T =>\n value !== null &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n !isArray(value)\n\nexport const isArray = <T extends any[]>(value: any): value is T =>\n Array.isArray(value)\n\nexport const isEmpty = (value: any): boolean =>\n !isArray(value) || !value.length || value.every((v) => v == null)\n\nexport const isFunction = <T extends Function = Function>(\n value: any,\n): value is T => typeof value === \"function\"\n\nexport const isUnit = (value: any): boolean =>\n /[0-9].*[px|rem|em|%|vw|vh]$/.test(value)\n\nexport const cast = <T>(value: any) => value as T\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU;AAEZ,IAAM,cAAc,CAAC,UAC1B,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,KAAK,CAAC,OAAO,SAAS,KAAK;AAErE,IAAM,YAAY,CAAC,UACxB,SAAS,QACT,WAAW,MAAM,SAAS,CAAC,IAAI,WAAW,MAAM,SAAS,CAAC,IAAI,KAAK;AAE9D,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AAErC,IAAM,cAAc,CAAC,UAC1B,OAAO,UAAU,eAAe,UAAU;AAErC,IAAM,SAAS,CAAC,UAA8B,UAAU;AAExD,IAAM,WAAW,CAAiB,UACvC,UAAU,SACT,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C,CAAC,QAAQ,KAAK;AAET,IAAM,UAAU,CAAkB,UACvC,MAAM,QAAQ,KAAK;AAEd,IAAM,UAAU,CAAC,UACtB,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,UAAU,MAAM,MAAM,CAAC,MAAM,KAAK,IAAI;AAE3D,IAAM,aAAa,CACxB,UACe,OAAO,UAAU;AAE3B,IAAM,SAAS,CAAC,UACrB,8BAA8B,KAAK,KAAK;AAEnC,IAAM,OAAO,CAAI,UAAe;","names":[]}
@@ -10,10 +10,8 @@ import {
10
10
  isObject,
11
11
  isString,
12
12
  isUndefined,
13
- isUnit,
14
- toCamelCase,
15
- toKebabCase
16
- } from "./chunk-M3Z42EEZ.mjs";
13
+ isUnit
14
+ } from "./chunk-6DMBHPNQ.mjs";
17
15
  export {
18
16
  cast,
19
17
  isArray,
@@ -26,8 +24,6 @@ export {
26
24
  isObject,
27
25
  isString,
28
26
  isUndefined,
29
- isUnit,
30
- toCamelCase,
31
- toKebabCase
27
+ isUnit
32
28
  };
33
29
  //# sourceMappingURL=assertion.mjs.map
@@ -11,8 +11,6 @@ var isEmpty = (value) => !isArray(value) || !value.length || value.every((v) =>
11
11
  var isFunction = (value) => typeof value === "function";
12
12
  var isUnit = (value) => /[0-9].*[px|rem|em|%|vw|vh]$/.test(value);
13
13
  var cast = (value) => value;
14
- var toCamelCase = (value) => value.toLowerCase().replace(/-(.)/g, (_, group1) => group1.toUpperCase()).replace(/^(.)/, (_, group1) => group1.toUpperCase());
15
- var toKebabCase = (value) => value.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, "");
16
14
 
17
15
  export {
18
16
  isNumber,
@@ -26,8 +24,6 @@ export {
26
24
  isEmpty,
27
25
  isFunction,
28
26
  isUnit,
29
- cast,
30
- toCamelCase,
31
- toKebabCase
27
+ cast
32
28
  };
33
- //# sourceMappingURL=chunk-M3Z42EEZ.mjs.map
29
+ //# sourceMappingURL=chunk-6DMBHPNQ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/assertion.ts"],"sourcesContent":["import type { Dict } from \".\"\n\nexport const isNumber = (value: any): value is number =>\n typeof value === \"number\"\n\nexport const isNotNumber = (value: any): boolean =>\n typeof value !== \"number\" || Number.isNaN(value) || !Number.isFinite(value)\n\nexport const isNumeric = (value: any): boolean =>\n value != null &&\n parseFloat(value.toString()) - parseFloat(value.toString()) + 1 >= 0\n\nexport const isString = (value: any): value is string =>\n Object.prototype.toString.call(value) === \"[object String]\"\n\nexport const isUndefined = (value: any): value is undefined =>\n typeof value === \"undefined\" && value === undefined\n\nexport const isNull = (value: any): value is null => value === null\n\nexport const isObject = <T extends Dict>(value: any): value is T =>\n value !== null &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n !isArray(value)\n\nexport const isArray = <T extends any[]>(value: any): value is T =>\n Array.isArray(value)\n\nexport const isEmpty = (value: any): boolean =>\n !isArray(value) || !value.length || value.every((v) => v == null)\n\nexport const isFunction = <T extends Function = Function>(\n value: any,\n): value is T => typeof value === \"function\"\n\nexport const isUnit = (value: any): boolean =>\n /[0-9].*[px|rem|em|%|vw|vh]$/.test(value)\n\nexport const cast = <T>(value: any) => value as T\n\nexport const toCamelCase = (value: string & {}) =>\n value\n .toLowerCase()\n .replace(/-(.)/g, (_, group1) => group1.toUpperCase())\n .replace(/^(.)/, (_, group1) => group1.toUpperCase())\n\nexport const toKebabCase = (value: string & {}) =>\n value\n .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, \"$1-$2\")\n .toLowerCase()\n .replace(/^-/, \"\")\n"],"mappings":";AAEO,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU;AAEZ,IAAM,cAAc,CAAC,UAC1B,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,KAAK,CAAC,OAAO,SAAS,KAAK;AAErE,IAAM,YAAY,CAAC,UACxB,SAAS,QACT,WAAW,MAAM,SAAS,CAAC,IAAI,WAAW,MAAM,SAAS,CAAC,IAAI,KAAK;AAE9D,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AAErC,IAAM,cAAc,CAAC,UAC1B,OAAO,UAAU,eAAe,UAAU;AAErC,IAAM,SAAS,CAAC,UAA8B,UAAU;AAExD,IAAM,WAAW,CAAiB,UACvC,UAAU,SACT,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C,CAAC,QAAQ,KAAK;AAET,IAAM,UAAU,CAAkB,UACvC,MAAM,QAAQ,KAAK;AAEd,IAAM,UAAU,CAAC,UACtB,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,UAAU,MAAM,MAAM,CAAC,MAAM,KAAK,IAAI;AAE3D,IAAM,aAAa,CACxB,UACe,OAAO,UAAU;AAE3B,IAAM,SAAS,CAAC,UACrB,8BAA8B,KAAK,KAAK;AAEnC,IAAM,OAAO,CAAI,UAAe;AAEhC,IAAM,cAAc,CAAC,UAC1B,MACG,YAAY,EACZ,QAAQ,SAAS,CAAC,GAAG,WAAW,OAAO,YAAY,CAAC,EACpD,QAAQ,QAAQ,CAAC,GAAG,WAAW,OAAO,YAAY,CAAC;AAEjD,IAAM,cAAc,CAAC,UAC1B,MACG,QAAQ,gCAAgC,OAAO,EAC/C,YAAY,EACZ,QAAQ,MAAM,EAAE;","names":[]}
1
+ {"version":3,"sources":["../src/assertion.ts"],"sourcesContent":["import type { Dict } from \".\"\n\nexport const isNumber = (value: any): value is number =>\n typeof value === \"number\"\n\nexport const isNotNumber = (value: any): boolean =>\n typeof value !== \"number\" || Number.isNaN(value) || !Number.isFinite(value)\n\nexport const isNumeric = (value: any): boolean =>\n value != null &&\n parseFloat(value.toString()) - parseFloat(value.toString()) + 1 >= 0\n\nexport const isString = (value: any): value is string =>\n Object.prototype.toString.call(value) === \"[object String]\"\n\nexport const isUndefined = (value: any): value is undefined =>\n typeof value === \"undefined\" && value === undefined\n\nexport const isNull = (value: any): value is null => value === null\n\nexport const isObject = <T extends Dict>(value: any): value is T =>\n value !== null &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n !isArray(value)\n\nexport const isArray = <T extends any[]>(value: any): value is T =>\n Array.isArray(value)\n\nexport const isEmpty = (value: any): boolean =>\n !isArray(value) || !value.length || value.every((v) => v == null)\n\nexport const isFunction = <T extends Function = Function>(\n value: any,\n): value is T => typeof value === \"function\"\n\nexport const isUnit = (value: any): boolean =>\n /[0-9].*[px|rem|em|%|vw|vh]$/.test(value)\n\nexport const cast = <T>(value: any) => value as T\n"],"mappings":";AAEO,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU;AAEZ,IAAM,cAAc,CAAC,UAC1B,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,KAAK,CAAC,OAAO,SAAS,KAAK;AAErE,IAAM,YAAY,CAAC,UACxB,SAAS,QACT,WAAW,MAAM,SAAS,CAAC,IAAI,WAAW,MAAM,SAAS,CAAC,IAAI,KAAK;AAE9D,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AAErC,IAAM,cAAc,CAAC,UAC1B,OAAO,UAAU,eAAe,UAAU;AAErC,IAAM,SAAS,CAAC,UAA8B,UAAU;AAExD,IAAM,WAAW,CAAiB,UACvC,UAAU,SACT,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C,CAAC,QAAQ,KAAK;AAET,IAAM,UAAU,CAAkB,UACvC,MAAM,QAAQ,KAAK;AAEd,IAAM,UAAU,CAAC,UACtB,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,UAAU,MAAM,MAAM,CAAC,MAAM,KAAK,IAAI;AAE3D,IAAM,aAAa,CACxB,UACe,OAAO,UAAU;AAE3B,IAAM,SAAS,CAAC,UACrB,8BAA8B,KAAK,KAAK;AAEnC,IAAM,OAAO,CAAI,UAAe;","names":[]}
@@ -5,7 +5,7 @@ import {
5
5
  isObject,
6
6
  isString,
7
7
  isUndefined
8
- } from "./chunk-M3Z42EEZ.mjs";
8
+ } from "./chunk-6DMBHPNQ.mjs";
9
9
 
10
10
  // src/function.ts
11
11
  var noop = () => {
@@ -302,7 +302,7 @@ var isActiveElement = (el) => {
302
302
 
303
303
  // src/color.ts
304
304
  import * as c from "color2k";
305
- var hues = [
305
+ var tones = [
306
306
  50,
307
307
  100,
308
308
  200,
@@ -317,7 +317,7 @@ var hues = [
317
317
  ];
318
318
  var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral";
319
319
  var isAccessible = (colorScheme) => colorScheme === "yellow" || colorScheme === "cyan" || colorScheme === "lime";
320
- var getColor = (color, fallback) => (theme = {}, colorMode) => {
320
+ var getColor = (color, fallback = "#000000") => (theme = {}, colorMode) => {
321
321
  var _a, _b, _c;
322
322
  const [token, hue] = color.split(".");
323
323
  const [, relatedToken] = (_c = Object.entries((_b = (_a = theme.semantics) == null ? void 0 : _a.colorSchemes) != null ? _b : {}).find(
@@ -333,7 +333,11 @@ var getColor = (color, fallback) => (theme = {}, colorMode) => {
333
333
  return c.toHex(String(hex));
334
334
  }
335
335
  } catch {
336
- return fallback != null ? fallback : "#000000";
336
+ try {
337
+ return c.toHex(fallback);
338
+ } catch {
339
+ return "#000000";
340
+ }
337
341
  }
338
342
  };
339
343
  var lightenColor = (color, amount) => (theme, colorMode) => {
@@ -356,25 +360,6 @@ var transparentizeColor = (color, alpha) => (theme, colorMode) => {
356
360
  const raw = getColor(color, color)(theme, colorMode);
357
361
  return c.transparentize(raw, 1 - alpha);
358
362
  };
359
- var toneColor = (color, hue, lCoef = 0.94, dCoef = 0.86) => (theme, colorMode) => {
360
- if (hue < 50 || 950 < hue)
361
- return color;
362
- let raw = color;
363
- if (theme && colorMode)
364
- getColor(color, color)(theme, colorMode);
365
- const coef = hue < 500 ? lCoef : dCoef;
366
- const amount = (500 - hue) * 1e-3 * coef;
367
- return c.toHex(c.lighten(raw, amount));
368
- };
369
- var toneColors = (color, lCoef = 0.94, dCoef = 0.86) => {
370
- const colors = {};
371
- hues.forEach((hue) => {
372
- const coef = hue < 500 ? lCoef : dCoef;
373
- const amount = (500 - hue) * 1e-3 * coef;
374
- colors[hue] = c.toHex(c.lighten(color, amount));
375
- });
376
- return colors;
377
- };
378
363
  var randomColor = ({
379
364
  string,
380
365
  colors
@@ -774,7 +759,7 @@ export {
774
759
  getOwnerDocument,
775
760
  getActiveElement,
776
761
  isActiveElement,
777
- hues,
762
+ tones,
778
763
  isGray,
779
764
  isAccessible,
780
765
  getColor,
@@ -783,8 +768,6 @@ export {
783
768
  tintColor,
784
769
  shadeColor,
785
770
  transparentizeColor,
786
- toneColor,
787
- toneColors,
788
771
  randomColor,
789
772
  isTone,
790
773
  isLight,
@@ -801,4 +784,4 @@ export {
801
784
  hsvTo,
802
785
  sameColor
803
786
  };
804
- //# sourceMappingURL=chunk-GQUZJX6C.mjs.map
787
+ //# sourceMappingURL=chunk-7NFIWFDA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/function.ts","../src/react.tsx","../src/dom.ts","../src/color.ts","../src/object.ts"],"sourcesContent":["import { isFunction } from \".\"\n\nexport const noop = () => {}\n\nexport const runIfFunc = <T, U extends Array<any>>(\n valOrFunc: T | ((...funcArgs: U) => T),\n ...args: U\n): T => (isFunction(valOrFunc) ? valOrFunc(...args) : valOrFunc)\n\nexport const handlerAll =\n <T extends (event: any) => void>(...funcs: (T | undefined)[]) =>\n (event: (T extends (...args: infer R) => any ? R : never)[0]) => {\n funcs.some((func) => {\n func?.(event)\n\n return event?.defaultPrevented\n })\n }\n\nexport const funcAll =\n <T extends (...args: any[]) => any>(...funcs: (T | undefined)[]) =>\n (arg: (T extends (...args: infer R) => any ? R : never)[0]) =>\n funcs.forEach((func) => func?.(arg))\n","import * as React from \"react\"\nimport type { Merge } from \".\"\nimport { isNumber, isString } from \".\"\n\ntype DOMElement = Element & HTMLOrSVGElement\n\nexport type DOMAttributes<Y = DOMElement> = React.HTMLAttributes<Y> &\n React.AriaAttributes &\n React.DOMAttributes<Y> & {\n id?: string\n role?: React.AriaRole\n tabIndex?: number\n style?: React.CSSProperties\n }\n\nexport type PropGetter<Y = undefined, M = DOMAttributes> = (\n props?: Merge<DOMAttributes, Y>,\n ref?: React.Ref<any>,\n) => M & React.RefAttributes<any>\n\nexport type RequiredPropGetter<Y = undefined, M = DOMAttributes> = (\n props: Merge<DOMAttributes, Y>,\n ref?: React.Ref<any>,\n) => M & React.RefAttributes<any>\n\nexport type MaybeRenderProp<Y> =\n | React.ReactNode\n | ((props: Y) => React.ReactNode)\n\ntype Options<ContextType extends any = any> = {\n strict?: boolean\n errorMessage?: string\n name?: string\n defaultValue?: ContextType\n}\n\ntype CreateContextReturn<T> = [React.Provider<T>, () => T, React.Context<T>]\n\nexport const createContext = <ContextType extends any = any>({\n strict = true,\n errorMessage = \"useContext: `context` is undefined. Seems you forgot to wrap component within the Provider\",\n name,\n defaultValue,\n}: Options<ContextType> = {}) => {\n const Context = React.createContext<ContextType | undefined>(defaultValue)\n\n Context.displayName = name\n\n const useContext = () => {\n const context = React.useContext(Context)\n\n if (!context && strict) {\n const error = new Error(errorMessage)\n error.name = \"ContextError\"\n Error.captureStackTrace?.(error, useContext)\n throw error\n }\n\n return context\n }\n\n return [\n Context.Provider,\n useContext,\n Context,\n ] as CreateContextReturn<ContextType>\n}\n\nexport const useSafeLayoutEffect = Boolean(globalThis?.document)\n ? React.useLayoutEffect\n : React.useEffect\n\nexport const useUnmountEffect = (callback: () => void) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n React.useEffect(() => () => callback(), [])\n\nexport type UseIsMountedProps = {\n rerender?: boolean\n delay?: number\n}\n\nexport const useIsMounted = ({\n rerender = false,\n delay = 0,\n}: UseIsMountedProps = {}): [() => boolean, boolean] => {\n const isMountedRef = React.useRef(false)\n const [isMounted, setIsMounted] = React.useState(false)\n\n useSafeLayoutEffect(() => {\n isMountedRef.current = true\n\n let timeoutId: any = null\n\n if (rerender) {\n if (delay > 0) {\n timeoutId = setTimeout(() => setIsMounted(true), delay)\n } else {\n setIsMounted(true)\n }\n }\n\n return () => {\n isMountedRef.current = false\n\n if (rerender) setIsMounted(false)\n\n if (timeoutId) clearTimeout(timeoutId)\n }\n }, [delay, rerender])\n\n return [React.useCallback(() => isMountedRef.current, []), isMounted]\n}\n\nexport type UseIsMountedReturn = ReturnType<typeof useIsMounted>\n\nexport const getValidChildren = (\n children: React.ReactNode,\n): React.ReactElement[] =>\n React.Children.toArray(children).filter((child) =>\n React.isValidElement(child),\n ) as React.ReactElement[]\n\nexport const isValidElement = (child: any): child is React.ReactNode =>\n React.isValidElement(child) || isString(child) || isNumber(child)\n\nexport const findChildren = (\n children: React.ReactElement<\n any,\n string | React.JSXElementConstructor<any>\n >[],\n ...types: React.JSXElementConstructor<any>[]\n): [React.ReactElement | undefined, ...React.ReactElement[]] =>\n (children.find((child) => types.some((type) => child.type === type))\n ? children.sort((a, b) =>\n types.some((type) => a.type === type)\n ? -1\n : types.some((type) => b.type === type)\n ? 1\n : 0,\n )\n : [undefined, ...children]) as [\n React.ReactElement | undefined,\n ...React.ReactElement[],\n ]\n\nexport const includesChildren = (\n children: React.ReactElement<\n any,\n string | React.JSXElementConstructor<any>\n >[],\n ...types: React.JSXElementConstructor<any>[]\n): boolean =>\n children.some((child) => {\n if (types.some((type) => child.type === type)) return true\n\n const children = getValidChildren(child.props.children)\n\n return children.length ? includesChildren(children, ...types) : false\n })\n\nexport const omitChildren = (\n children: React.ReactElement<\n any,\n string | React.JSXElementConstructor<any>\n >[],\n ...types: React.JSXElementConstructor<any>[]\n): React.ReactElement[] =>\n children.filter((child) => types.every((type) => child.type !== type))\n\nexport const pickChildren = (\n children: React.ReactElement<\n any,\n string | React.JSXElementConstructor<any>\n >[],\n ...types: React.JSXElementConstructor<any>[]\n): React.ReactElement[] =>\n children.filter((child) => types.every((type) => child.type === type))\n\nexport const cx = (...classNames: (string | undefined)[]) =>\n classNames.filter(Boolean).join(\" \")\n\ntype ReactRef<T> = React.Ref<T> | React.MutableRefObject<T> | React.LegacyRef<T>\n\nexport const isRefObject = (val: any): val is { current: any } =>\n \"current\" in val\n\nexport const assignRef = <T extends any = any>(\n ref: ReactRef<T> | undefined,\n value: T,\n) => {\n if (ref == null) return\n\n if (typeof ref === \"function\") {\n ref(value)\n\n return\n }\n\n try {\n // @ts-ignore\n ref.current = value\n } catch (error) {\n throw new Error(`Cannot assign value '${value}' to ref '${ref}'`)\n }\n}\n\nexport const mergeRefs =\n <T extends any = any>(...refs: (ReactRef<T> | null | undefined)[]) =>\n (node: T | null) => {\n refs.forEach((ref) => {\n assignRef(ref, node)\n })\n }\n\nexport const useMergeRefs = <T extends any = any>(\n ...refs: (ReactRef<T> | undefined)[]\n) => React.useMemo(() => mergeRefs(...refs), [refs])\n\nexport const useCallbackRef = <T extends (...args: any[]) => any>(\n callback: T | undefined,\n deps: React.DependencyList = [],\n) => {\n const callbackRef = React.useRef(callback)\n\n React.useEffect(() => {\n callbackRef.current = callback\n })\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(\n ((...args) => callbackRef.current?.(...args)) as T,\n deps,\n )\n}\n\n/**\n * `useUpdateEffect` is a custom hook that skips side effects on the initial render, and only runs them when the dependency array changes.\n *\n * @see Docs https://yamada-ui.com/hooks/use-update-effect\n */\nexport const useUpdateEffect = (\n callback: React.EffectCallback,\n deps: React.DependencyList,\n) => {\n const renderCycleRef = React.useRef(false)\n const effectCycleRef = React.useRef(false)\n\n React.useEffect(() => {\n const mounted = renderCycleRef.current\n const run = mounted && effectCycleRef.current\n\n if (run) return callback()\n\n effectCycleRef.current = true\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps)\n\n React.useEffect(() => {\n renderCycleRef.current = true\n\n return () => {\n renderCycleRef.current = false\n }\n }, [])\n}\n\nexport type FunctionReturningPromise = (...args: any[]) => Promise<any>\n\n/**\n * `useAsync` is a custom hook that executes an asynchronous function and tracks its state.\n *\n * @see Docs https://yamada-ui.com/hooks/use-async\n */\nexport const useAsync = <T extends FunctionReturningPromise>(\n func: T,\n deps: React.DependencyList = [],\n) => {\n const [state, callback] = useAsyncFunc(func, deps, { loading: true })\n\n React.useEffect(() => {\n callback()\n }, [callback])\n\n return state\n}\n\nexport type AsyncState<T> =\n | {\n loading: boolean\n error?: undefined\n value?: undefined\n }\n | {\n loading: true\n error?: Error | undefined\n value?: T\n }\n | {\n loading: false\n error: Error\n value?: undefined\n }\n | {\n loading: false\n error?: undefined\n value: T\n }\n\nexport type PromiseType<P extends Promise<any>> =\n P extends Promise<infer T> ? T : never\n\ntype StateFromFunctionReturningPromise<T extends FunctionReturningPromise> =\n AsyncState<PromiseType<ReturnType<T>>>\n\nexport type AsyncFnReturn<\n T extends FunctionReturningPromise = FunctionReturningPromise,\n> = [StateFromFunctionReturningPromise<T>, T]\n\nexport const useAsyncFunc = <T extends FunctionReturningPromise>(\n func: T,\n deps: React.DependencyList = [],\n initialState: StateFromFunctionReturningPromise<T> = { loading: false },\n): AsyncFnReturn<T> => {\n const lastCallId = React.useRef(0)\n const [isMounted] = useIsMounted()\n const [state, setState] =\n React.useState<StateFromFunctionReturningPromise<T>>(initialState)\n\n const callback = React.useCallback(\n (...args: Parameters<T>): ReturnType<T> => {\n const callId = ++lastCallId.current\n\n if (!state.loading)\n setState((prevState) => ({ ...prevState, loading: true }))\n\n return func(...args).then(\n (value) => {\n if (isMounted() && callId === lastCallId.current)\n setState({ value, loading: false })\n\n return value\n },\n (error) => {\n if (isMounted() && callId === lastCallId.current)\n setState({ error, loading: false })\n\n return error\n },\n ) as ReturnType<T>\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n deps,\n )\n\n return [state, callback as unknown as T]\n}\n\nexport type AsyncStateRetry<T> = AsyncState<T> & {\n retry(): void\n}\n\nexport const useAsyncRetry = <T,>(\n func: () => Promise<T>,\n deps: React.DependencyList = [],\n) => {\n const [attempt, setAttempt] = React.useState<number>(0)\n const state = useAsync(func, [...deps, attempt])\n\n const stateLoading = state.loading\n\n const retry = React.useCallback(() => {\n if (stateLoading) return\n\n setAttempt((currentAttempt) => currentAttempt + 1)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [...deps, stateLoading])\n\n return { ...state, retry }\n}\n\nexport const createId = (prefix: string) => `${prefix}-${new Date().getTime()}`\n","import type React from \"react\"\nimport { isNumber, isUndefined } from \".\"\n\nexport const createdDom = (): boolean =>\n !!(\n typeof window !== \"undefined\" &&\n window.document &&\n window.document.createElement\n )\n\nexport const getPlatform = (): string =>\n (navigator as any).userAgentData?.platform ?? navigator.platform\n\nexport const vendor = (v: RegExp): boolean =>\n createdDom() && v.test(navigator.vendor)\nexport const platform = (v: RegExp): boolean =>\n createdDom() && v.test(getPlatform())\n\nexport const isMac = (): boolean => platform(/^mac/i)\nexport const isApple = (): boolean => platform(/mac|iphone|ipad|ipod/i)\nexport const isSafari = (): boolean => isApple() && vendor(/apple/i)\n\nexport const isElement = (el: any): el is Element =>\n el != null &&\n typeof el == \"object\" &&\n \"nodeType\" in el &&\n el.nodeType === Node.ELEMENT_NODE\n\nexport const isHTMLElement = (el: any): el is HTMLElement => {\n if (!isElement(el)) return false\n\n const win = el.ownerDocument.defaultView ?? window\n\n return el instanceof win.HTMLElement\n}\n\nexport const isHidden = (el: HTMLElement): boolean => {\n if (el.parentElement && isHidden(el.parentElement)) return true\n\n return el.hidden\n}\n\nexport const isDisabled = (el: HTMLElement): boolean =>\n Boolean(el.getAttribute(\"disabled\")) === true ||\n Boolean(el.getAttribute(\"data-disabled\")) === true ||\n Boolean(el.getAttribute(\"aria-disabled\")) === true\n\nconst isVisible = (el: HTMLElement) => el.offsetWidth > 0 && el.offsetHeight > 0\n\nexport const hasTabIndex = (el: HTMLElement): boolean =>\n el.hasAttribute(\"tabindex\")\n\nexport const isContentEditable = (el: HTMLElement): boolean => {\n const value = el.getAttribute(\"contenteditable\")\n\n return value !== \"false\" && value != null\n}\n\nexport const isContains = (\n parent: HTMLElement | null,\n child: HTMLElement | null,\n): boolean | undefined => {\n return parent === child || parent?.contains(child)\n}\n\nexport const getPx = (value: string | number | undefined): number => {\n if (isNumber(value)) return value\n\n if (isUndefined(value)) return 0\n\n if (value.includes(\"px\")) return parseFloat(value)\n\n const isBrowser = createdDom()\n let fontSize = 16\n\n if (isBrowser) {\n const style = window.getComputedStyle(document.documentElement)\n\n fontSize = parseFloat(style.fontSize)\n }\n\n return parseFloat(value) * fontSize\n}\n\nexport const getEventRelatedTarget = (\n ev: React.FocusEvent | React.MouseEvent,\n) =>\n (ev.relatedTarget ??\n ev.currentTarget.ownerDocument.activeElement) as HTMLElement | null\n\ntype Booleanish = boolean | \"true\" | \"false\"\n\nexport const dataAttr = (condition: boolean | undefined) =>\n (condition ? \"\" : undefined) as Booleanish\n\nexport const ariaAttr = (\n condition: boolean | undefined,\n): boolean | undefined => (condition ? true : undefined)\n\nexport type FocusableElement = {\n focus: (options?: FocusOptions) => void\n}\n\nconst focusableElList = [\n \"input:not(:disabled):not([disabled])\",\n \"select:not(:disabled):not([disabled])\",\n \"textarea:not(:disabled):not([disabled])\",\n \"embed\",\n \"iframe\",\n \"object\",\n \"a[href]\",\n \"area[href]\",\n \"button:not(:disabled):not([disabled])\",\n \"[tabindex]\",\n \"audio[controls]\",\n \"video[controls]\",\n \"*[tabindex]:not([aria-disabled])\",\n \"*[contenteditable]\",\n]\n\nconst focusableElSelector: string = focusableElList.join()\n\nexport const getAllFocusable = <T extends HTMLElement>(container: T): T[] => {\n const focusableEls: T[] = Array.from(\n container.querySelectorAll<T>(focusableElSelector),\n )\n\n focusableEls.unshift(container)\n\n return focusableEls.filter((el) => isFocusable(el) && isVisible(el))\n}\n\nexport const isFocusable = (el: HTMLElement): boolean => {\n if (!isHTMLElement(el) || isHidden(el) || isDisabled(el)) {\n return false\n }\n\n const { localName } = el\n const focusableTags = [\"input\", \"select\", \"textarea\", \"button\"]\n\n if (focusableTags.indexOf(localName) >= 0) return true\n\n const others = {\n a: () => el.hasAttribute(\"href\"),\n audio: () => el.hasAttribute(\"controls\"),\n video: () => el.hasAttribute(\"controls\"),\n }\n\n if (localName in others) return others[localName as keyof typeof others]()\n\n if (isContentEditable(el)) return true\n\n return hasTabIndex(el)\n}\n\nexport const hasNegativeTabIndex = (el: HTMLElement): boolean =>\n hasTabIndex(el) && el.tabIndex === -1\n\nexport const isTabbable = (el?: HTMLElement | null): boolean =>\n el ? isHTMLElement(el) && isFocusable(el) && !hasNegativeTabIndex(el) : false\n\nexport const getOwnerWindow = (\n node?: Element | null,\n): Window & typeof globalThis => getOwnerDocument(node)?.defaultView ?? window\n\nexport const getOwnerDocument = (el?: Element | null): Document =>\n isElement(el) ? el.ownerDocument : document\n\nexport const getActiveElement = (el?: HTMLElement): HTMLElement =>\n getOwnerDocument(el).activeElement as HTMLElement\n\nexport const isActiveElement = (el: HTMLElement) => {\n return getActiveElement(el) === el\n}\n","import * as c from \"color2k\"\nimport type { Dict } from \".\"\nimport { getMemoizedObject as get, isArray, isNumber } from \".\"\n\ntype ColorMode = \"light\" | \"dark\"\n\nexport type ColorFormat = \"hex\" | \"hexa\" | \"rgba\" | \"rgb\" | \"hsl\" | \"hsla\"\n\nexport const tones = [\n 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950,\n] as const\n\nexport const isGray = (colorScheme: string) =>\n colorScheme === \"gray\" || colorScheme === \"neutral\"\n\nexport const isAccessible = (colorScheme: string) =>\n colorScheme === \"yellow\" || colorScheme === \"cyan\" || colorScheme === \"lime\"\n\nexport const getColor =\n (color: string, fallback: string = \"#000000\") =>\n (theme: Dict = {}, colorMode?: ColorMode) => {\n const [token, hue] = color.split(\".\")\n\n const [, relatedToken] =\n Object.entries<string>(theme.semantics?.colorSchemes ?? {}).find(\n ([semanticToken]) => token === semanticToken,\n ) ?? []\n\n if (relatedToken) color = `${relatedToken}.${hue}`\n\n const hex = get<\n string | number | [string | number, string | number] | undefined\n >(theme, `colors.${color}`, color)\n\n try {\n if (isArray(hex)) {\n return c.toHex(String(colorMode !== \"dark\" ? hex[0] : hex[1]))\n } else {\n return c.toHex(String(hex))\n }\n } catch {\n try {\n return c.toHex(fallback)\n } catch {\n return \"#000000\"\n }\n }\n }\n\nexport const lightenColor =\n (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => {\n const raw = getColor(color, color)(theme, colorMode)\n\n return c.toHex(c.lighten(raw, amount / 100))\n }\n\nexport const darkenColor =\n (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => {\n const raw = getColor(color, color)(theme, colorMode)\n\n return c.toHex(c.darken(raw, amount / 100))\n }\n\nexport const tintColor =\n (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => {\n const raw = getColor(color, color)(theme, colorMode)\n\n return c.toHex(c.mix(raw, \"#fff\", amount / 100))\n }\n\nexport const shadeColor =\n (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => {\n const raw = getColor(color, color)(theme, colorMode)\n\n return c.toHex(c.mix(raw, \"#000\", amount / 100))\n }\n\nexport const transparentizeColor =\n (color: string, alpha: number) => (theme?: Dict, colorMode?: ColorMode) => {\n const raw = getColor(color, color)(theme, colorMode)\n\n return c.transparentize(raw, 1 - alpha)\n }\n\nexport const randomColor = ({\n string,\n colors,\n}: { string?: string; colors?: string[] } = {}) => {\n const fallback = randomHex()\n\n if (string && colors) return randomColorFromList(string, colors)\n\n if (string && !colors) return randomColorFromString(string)\n\n if (colors && !string) return randomFromList(colors)\n\n return fallback\n}\n\nconst randomHex = () =>\n `#${Math.floor(Math.random() * 0xffffff)\n .toString(16)\n .padEnd(6, \"0\")}`\n\nconst randomColorFromString = (str: string) => {\n let hash = 0\n\n if (str.length === 0) return hash.toString()\n\n for (let i = 0; i < str.length; i += 1) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash)\n hash = hash & hash\n }\n\n let color = \"#\"\n\n for (let j = 0; j < 3; j += 1) {\n const value = (hash >> (j * 8)) & 255\n\n color += `00${value.toString(16)}`.substr(-2)\n }\n\n return color\n}\n\nconst randomColorFromList = (str: string, list: string[]) => {\n let index = 0\n\n if (str.length === 0) return list[0]\n\n for (let i = 0; i < str.length; i += 1) {\n index = str.charCodeAt(i) + ((index << 5) - index)\n\n index = index & index\n }\n\n index = ((index % list.length) + list.length) % list.length\n\n return list[index]\n}\n\nconst randomFromList = (list: string[]) =>\n list[Math.floor(Math.random() * list.length)]\n\nconst getBrightness = (color: string) => {\n const [r, g, b] = c.parseToRgba(color)\n\n return (r * 299 + g * 587 + b * 114) / 1000\n}\n\nexport const isTone =\n (color: string) => (theme?: Dict, colorMode?: ColorMode) => {\n const raw = theme ? getColor(color)(theme, colorMode) : color\n\n const brightness = getBrightness(raw)\n\n const isDark = brightness < 128\n\n return isDark ? \"dark\" : \"light\"\n }\n\nexport const isLight =\n (color: string) => (theme?: Dict, colorMode?: ColorMode) =>\n isTone(color)(theme, colorMode) === \"dark\"\n\nexport const isDark =\n (color: string) => (theme?: Dict, colorMode?: ColorMode) =>\n isTone(color)(theme, colorMode) === \"light\"\n\nexport const convertColor =\n (color: string, fallback?: string) =>\n (format: ColorFormat): string | undefined => {\n try {\n const isAlpha = format.endsWith(\"a\")\n\n if (/^[0-9a-fA-F]{6}$/.test(color)) color = \"#\" + color\n\n if (format.startsWith(\"hex\")) {\n let hexa = c.toHex(color)\n\n if (isAlpha) {\n if (hexa.length === 7) hexa += \"ff\"\n } else {\n hexa = hexa.replace(/(?<=^#([0-9a-fA-F]{6}))[0-9a-fA-F]{2}$/, \"\")\n }\n\n return hexa\n } else if (format.startsWith(\"hsl\")) {\n let hsla = c.toHsla(color)\n\n if (!isAlpha) {\n hsla = hsla.replace(/hsla/, \"hsl\")\n hsla = hsla.replace(/,\\s*\\d+(\\.\\d+)?\\)$/, \")\")\n }\n\n return hsla\n } else {\n let rgba = c.toRgba(color)\n\n if (!isAlpha) {\n rgba = rgba.replace(/rgba/, \"rgb\")\n rgba = rgba.replace(/,\\s*\\d+(\\.\\d+)?\\)$/, \")\")\n }\n\n return rgba\n }\n } catch {\n if (fallback) return convertColor(fallback)(format)\n }\n }\n\nexport const calcFormat = (color: string): ColorFormat => {\n if (color.startsWith(\"hsl\")) {\n return color.startsWith(\"hsla\") ? \"hsla\" : \"hsl\"\n } else if (color.startsWith(\"rgb\")) {\n return color.startsWith(\"rgba\") ? \"rgba\" : \"rgb\"\n } else {\n return color.length === 9 ? \"hexa\" : \"hex\"\n }\n}\n\nexport const getAlpha = (color: string) => c.parseToRgba(color)[3]\n\nexport const alphaToHex = (a: number) => {\n if (0 > a) a = 0\n if (1 < a) a = 1\n\n return Math.round(a * 255)\n .toString(16)\n .padStart(2, \"0\")\n}\n\nexport const parseToRgba = (color: string, fallback?: string) => {\n try {\n if (/^[0-9a-fA-F]{6}$/.test(color)) color = \"#\" + color\n\n return c.parseToRgba(color)\n } catch {\n if (fallback) return c.parseToRgba(fallback)\n }\n}\n\nexport const parseToHsla = (color: string, fallback?: string) => {\n try {\n if (/^[0-9a-fA-F]{6}$/.test(color)) color = \"#\" + color\n\n return c.parseToHsla(color)\n } catch {\n if (fallback) return c.parseToHsla(fallback)\n }\n}\n\nexport const parseToHsv = (\n color: string,\n fallback?: string,\n): [number, number, number, number] => {\n let [r, g, b, a] = parseToRgba(color, fallback) ?? [255, 255, 255, 1]\n\n r = r / 255\n g = g / 255\n b = b / 255\n\n const [min, max] = [Math.min(r, g, b), Math.max(r, g, b)]\n const delta = max - min\n\n let [h, v, s] = [0, max, max == 0 ? 0 : delta / max]\n\n switch (min) {\n case max:\n h = 0\n break\n\n case r:\n h = 60 * ((b - g) / delta) + 180\n break\n\n case g:\n h = 60 * ((r - b) / delta) + 300\n break\n\n case b:\n h = 60 * ((g - r) / delta) + 60\n break\n }\n\n return [h, s, v, a]\n}\n\nexport const rgbaTo =\n ([r, g, b, a]: [number, number, number, number], fallback?: string) =>\n (format: ColorFormat = \"hex\") =>\n convertColor(c.rgba(r, g, b, a), fallback)(format)\n\nexport const hslaTo =\n ([h, s, l, a]: [number, number, number, number], fallback?: string) =>\n (format: ColorFormat = \"hex\") =>\n convertColor(c.hsla(h, s, l, a), fallback)(format)\n\nexport const hsvTo =\n ([h, s, v, a]: [number, number, number, number?], fallback?: string) =>\n (format: ColorFormat = \"hex\"): string | undefined => {\n h = h / 60\n\n let rgb: [number, number, number] = [v, v, v]\n\n let i = Math.floor(h)\n let f = h - i\n let p = v * (1 - s)\n let q = v * (1 - s * f)\n let t = v * (1 - s * (1 - f))\n\n switch (i) {\n case 0:\n case 6:\n rgb = [v, t, p]\n break\n\n case 1:\n rgb = [q, v, p]\n break\n\n case 2:\n rgb = [p, v, t]\n break\n\n case 3:\n rgb = [p, q, v]\n break\n\n case 4:\n rgb = [t, p, v]\n break\n\n case 5:\n rgb = [v, p, q]\n break\n }\n\n let color = `rgb(${rgb.map((v) => Math.round(v * 255)).join(\", \")})`\n\n if (isNumber(a)) color = color.replace(/\\)$/, `, ${a})`)\n\n return convertColor(color, fallback)(format)\n }\n\nexport const sameColor = (\n color: string | undefined,\n comparison: string | undefined,\n) => {\n if (!color) return false\n if (!comparison) return false\n\n const a = parseToRgba(color) ?? []\n const b = parseToRgba(comparison) ?? []\n\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]\n}\n","import type { Dict } from \".\"\nimport { isObject, isArray, isFunction } from \".\"\n\nexport const omitObject = <T extends Dict, K extends keyof T>(\n obj: T,\n keys: K[],\n): Omit<T, K> => {\n const result: Dict = {}\n\n Object.keys(obj).forEach((key) => {\n if (keys.includes(key as K)) return\n\n result[key] = obj[key]\n })\n\n return result as Omit<T, K>\n}\n\nexport const pickObject = <T extends Dict, K extends keyof T>(\n obj: T,\n keys: K[],\n): { [P in K]: T[P] } => {\n const result = {} as { [P in K]: T[P] }\n\n keys.forEach((key) => {\n if (key in obj) result[key] = obj[key]\n })\n\n return result\n}\n\nexport const splitObject = <T extends Dict, K extends keyof T>(\n obj: T,\n keys: K[],\n) => {\n const picked: Dict = {}\n const omitted: Dict = {}\n\n for (const [key, value] of Object.entries(obj)) {\n if (keys.includes(key as T[K])) {\n picked[key] = value\n } else {\n omitted[key] = value\n }\n }\n\n return [picked, omitted] as [{ [P in K]: T[P] }, Omit<T, K>]\n}\n\nexport const filterObject = <T extends Dict, K extends Dict>(\n obj: T,\n func: (key: keyof T, value: T[keyof T], obj: T) => boolean,\n): K => {\n const result: Dict = {}\n\n Object.entries(obj).forEach(([key, value]) => {\n const shouldPass = func(key, value, obj)\n\n if (shouldPass) result[key] = value\n })\n\n return result as K\n}\n\nexport const filterUndefined = <T extends Dict>(obj: T): T =>\n filterObject(obj, (_, val) => val !== null && val !== undefined)\n\nexport const merge = <T extends Dict>(\n target: any,\n source: any,\n mergeArray: boolean = false,\n): T => {\n let result = Object.assign({}, target)\n\n if (isObject(source)) {\n if (isObject(target)) {\n for (const [sourceKey, sourceValue] of Object.entries(source)) {\n const targetValue: any = target[sourceKey]\n\n if (mergeArray && isArray(sourceValue) && isArray(targetValue)) {\n result[sourceKey] = targetValue.concat(...sourceValue)\n } else if (\n !isFunction(sourceValue) &&\n isObject(sourceValue) &&\n target.hasOwnProperty(sourceKey)\n ) {\n result[sourceKey] = merge(targetValue, sourceValue, mergeArray)\n } else {\n Object.assign(result, { [sourceKey]: sourceValue })\n }\n }\n } else {\n result = source\n }\n }\n\n return result as T\n}\n\nexport const flattenObject = <T extends Dict>(\n obj: any,\n maxDepth: number = Infinity,\n omitKeys: string[] = [],\n): T => {\n if ((!isObject(obj) && !isArray(obj)) || !maxDepth) return obj\n\n return Object.entries(obj).reduce((result, [key, value]) => {\n if (\n isObject(value) &&\n !Object.keys(value).some((key) => omitKeys.includes(key))\n ) {\n Object.entries(flattenObject(value, maxDepth - 1, omitKeys)).forEach(\n ([childKey, childValue]) => {\n result[`${key}.${childKey}`] = childValue\n },\n )\n } else {\n result[key] = value\n }\n\n return result\n }, {} as any) as T\n}\n\nexport const objectFromEntries = <T extends Dict>(entries: any[][]): T =>\n entries.reduce((result, [key, value]) => {\n result[key] = value\n\n return result\n }, {} as any) as T\n\nexport const keysFormObject = <T extends Dict>(obj: T): (keyof T)[] =>\n Object.keys(obj)\n\nexport const replaceObject = <T extends any>(\n objOrArray: T,\n callBack: (value: any) => any,\n): T => {\n if (isArray(objOrArray)) {\n return objOrArray.map(callBack) as T\n } else if (isObject(objOrArray)) {\n return Object.entries(objOrArray).reduce((obj, [key, value]) => {\n obj[key] = callBack(value)\n\n return obj\n }, {} as Dict) as T\n } else {\n return callBack(objOrArray)\n }\n}\n\nexport const getObject = (\n obj: Dict,\n path: string | number,\n fallback?: any,\n i?: number,\n) => {\n const k = typeof path === \"string\" ? path.split(\".\") : [path]\n\n for (i = 0; i < k.length; i += 1) {\n if (!obj) break\n\n obj = obj[k[i]]\n }\n\n return obj === undefined ? fallback : obj\n}\n\nexport const memoizeObject = (func: typeof getObject) => {\n const cache = new WeakMap()\n\n const memoizedFunc = <T extends unknown = any>(\n obj: Dict,\n path: string | number,\n fallback?: any,\n i?: number,\n ): T => {\n if (typeof obj === \"undefined\") return func(obj, path, fallback)\n\n if (!cache.has(obj)) cache.set(obj, new Map())\n\n const map = cache.get(obj)\n\n if (map.has(path)) return map.get(path)\n\n const value = func(obj, path, fallback, i)\n\n map.set(path, value)\n\n return value as T\n }\n\n return memoizedFunc\n}\n\nexport const getMemoizedObject = memoizeObject(getObject)\n\nexport const assignAfter = (target: Record<string, any>, ...sources: any[]) => {\n if (target == null)\n throw new TypeError(\"Cannot convert undefined or null to object\")\n\n const result: Record<string, unknown> = { ...target }\n\n for (const nextSource of sources) {\n if (nextSource == null) continue\n\n for (const nextKey in nextSource) {\n if (!Object.prototype.hasOwnProperty.call(nextSource, nextKey)) continue\n\n if (nextKey in result) delete result[nextKey]\n\n result[nextKey] = nextSource[nextKey]\n }\n }\n\n return result\n}\n"],"mappings":";;;;;;;;;;AAEO,IAAM,OAAO,MAAM;AAAC;AAEpB,IAAM,YAAY,CACvB,cACG,SACI,WAAW,SAAS,IAAI,UAAU,GAAG,IAAI,IAAI;AAE/C,IAAM,aACX,IAAoC,UACpC,CAAC,UAAgE;AAC/D,QAAM,KAAK,CAAC,SAAS;AACnB,iCAAO;AAEP,WAAO,+BAAO;AAAA,EAChB,CAAC;AACH;AAEK,IAAM,UACX,IAAuC,UACvC,CAAC,QACC,MAAM,QAAQ,CAAC,SAAS,6BAAO,IAAI;;;ACtBvC,YAAY,WAAW;AAsChB,IAAMA,iBAAgB,CAAgC;AAAA,EAC3D,SAAS;AAAA,EACT,eAAe;AAAA,EACf;AAAA,EACA;AACF,IAA0B,CAAC,MAAM;AAC/B,QAAM,UAAgB,oBAAuC,YAAY;AAEzE,UAAQ,cAAc;AAEtB,QAAMC,cAAa,MAAM;AAhD3B;AAiDI,UAAM,UAAgB,iBAAW,OAAO;AAExC,QAAI,CAAC,WAAW,QAAQ;AACtB,YAAM,QAAQ,IAAI,MAAM,YAAY;AACpC,YAAM,OAAO;AACb,kBAAM,sBAAN,+BAA0B,OAAOA;AACjC,YAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,IACRA;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,QAAQ,yCAAY,QAAQ,IACrD,wBACA;AAEH,IAAM,mBAAmB,CAAC;AAAA;AAAA,EAEzB,gBAAU,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC;AAAA;AAOrC,IAAM,eAAe,CAAC;AAAA,EAC3B,WAAW;AAAA,EACX,QAAQ;AACV,IAAuB,CAAC,MAAgC;AACtD,QAAM,eAAqB,aAAO,KAA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AAI;AAAG,aAAO,IAAI,IAAI,IAAI;AAEtC,UAAM,QAAQ,KAAK,KAAK,MAAM,UAAU,CAAC;AAEzC,QAAI,IAAI,MAAM,KAAK;AAEnB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,IAAM,oBAAoB,cAAc,SAAS;AAEjD,IAAM,cAAc,CAAC,WAAgC,YAAmB;AAC7E,MAAI,UAAU;AACZ,UAAM,IAAI,UAAU,4CAA4C;AAElE,QAAM,SAAkC,EAAE,GAAG,OAAO;AAEpD,aAAW,cAAc,SAAS;AAChC,QAAI,cAAc;AAAM;AAExB,eAAW,WAAW,YAAY;AAChC,UAAI,CAAC,OAAO,UAAU,eAAe,KAAK,YAAY,OAAO;AAAG;AAEhE,UAAI,WAAW;AAAQ,eAAO,OAAO,OAAO;AAE5C,aAAO,OAAO,IAAI,WAAW,OAAO;AAAA,IACtC;AAAA,EACF;AAEA,SAAO;AACT;","names":["createContext","useContext","isValidElement","children","isDark","hsla","rgba","parseToRgba","parseToHsla","v","key"]}
@@ -0,0 +1,50 @@
1
+ // src/string.ts
2
+ var escape = (value, replaceValue = "") => value.replace(/\s+/g, replaceValue);
3
+ var antonym = (value) => {
4
+ switch (value) {
5
+ case "top":
6
+ return "bottom";
7
+ case "bottom":
8
+ return "top";
9
+ case "left":
10
+ return "right";
11
+ case "right":
12
+ return "left";
13
+ case "start":
14
+ return "end";
15
+ case "end":
16
+ return "start";
17
+ case "x":
18
+ return "y";
19
+ case "y":
20
+ return "x";
21
+ case "enter":
22
+ return "exit";
23
+ case "exit":
24
+ return "enter";
25
+ case "vertical":
26
+ return "horizontal";
27
+ case "horizontal":
28
+ return "vertical";
29
+ case "up":
30
+ return "down";
31
+ case "down":
32
+ return "up";
33
+ case "block":
34
+ return "inline";
35
+ case "inline":
36
+ return "block";
37
+ default:
38
+ return value;
39
+ }
40
+ };
41
+ var toCamelCase = (value) => value.toLowerCase().replace(/-(.)/g, (_, group1) => group1.toUpperCase()).replace(/^(.)/, (_, group1) => group1.toUpperCase());
42
+ var toKebabCase = (value) => value.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, "");
43
+
44
+ export {
45
+ escape,
46
+ antonym,
47
+ toCamelCase,
48
+ toKebabCase
49
+ };
50
+ //# sourceMappingURL=chunk-WRCRDOPY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/string.ts"],"sourcesContent":["import type { StringLiteral } from \"./index.types\"\n\nexport const escape = (value: string, replaceValue: string = \"\"): string =>\n value.replace(/\\s+/g, replaceValue)\n\nexport const antonym = (value: string): string => {\n switch (value) {\n case \"top\":\n return \"bottom\"\n\n case \"bottom\":\n return \"top\"\n\n case \"left\":\n return \"right\"\n\n case \"right\":\n return \"left\"\n\n case \"start\":\n return \"end\"\n\n case \"end\":\n return \"start\"\n\n case \"x\":\n return \"y\"\n\n case \"y\":\n return \"x\"\n\n case \"enter\":\n return \"exit\"\n\n case \"exit\":\n return \"enter\"\n\n case \"vertical\":\n return \"horizontal\"\n\n case \"horizontal\":\n return \"vertical\"\n\n case \"up\":\n return \"down\"\n\n case \"down\":\n return \"up\"\n\n case \"block\":\n return \"inline\"\n\n case \"inline\":\n return \"block\"\n\n default:\n return value\n }\n}\n\nexport const toCamelCase = (value: StringLiteral): string =>\n value\n .toLowerCase()\n .replace(/-(.)/g, (_, group1) => group1.toUpperCase())\n .replace(/^(.)/, (_, group1) => group1.toUpperCase())\n\nexport const toKebabCase = (value: StringLiteral): string =>\n value\n .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, \"$1-$2\")\n .toLowerCase()\n .replace(/^-/, \"\")\n"],"mappings":";AAEO,IAAM,SAAS,CAAC,OAAe,eAAuB,OAC3D,MAAM,QAAQ,QAAQ,YAAY;AAE7B,IAAM,UAAU,CAAC,UAA0B;AAChD,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET;AACE,aAAO;AAAA,EACX;AACF;AAEO,IAAM,cAAc,CAAC,UAC1B,MACG,YAAY,EACZ,QAAQ,SAAS,CAAC,GAAG,WAAW,OAAO,YAAY,CAAC,EACpD,QAAQ,QAAQ,CAAC,GAAG,WAAW,OAAO,YAAY,CAAC;AAEjD,IAAM,cAAc,CAAC,UAC1B,MACG,QAAQ,gCAAgC,OAAO,EAC/C,YAAY,EACZ,QAAQ,MAAM,EAAE;","names":[]}
package/dist/color.d.mts CHANGED
@@ -2,7 +2,7 @@ import { Dict } from './index.types.mjs';
2
2
 
3
3
  type ColorMode = "light" | "dark";
4
4
  type ColorFormat = "hex" | "hexa" | "rgba" | "rgb" | "hsl" | "hsla";
5
- declare const hues: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
5
+ declare const tones: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
6
6
  declare const isGray: (colorScheme: string) => boolean;
7
7
  declare const isAccessible: (colorScheme: string) => boolean;
8
8
  declare const getColor: (color: string, fallback?: string) => (theme?: Dict, colorMode?: ColorMode) => string;
@@ -11,8 +11,6 @@ declare const darkenColor: (color: string, amount: number) => (theme?: Dict, col
11
11
  declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => string;
12
12
  declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => string;
13
13
  declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: ColorMode) => string;
14
- declare const toneColor: (color: string, hue: (typeof hues)[number], lCoef?: number, dCoef?: number) => (theme?: Dict, colorMode?: ColorMode) => string;
15
- declare const toneColors: (color: string, lCoef?: number, dCoef?: number) => Record<string, string>;
16
14
  declare const randomColor: ({ string, colors, }?: {
17
15
  string?: string | undefined;
18
16
  colors?: string[] | undefined;
@@ -32,4 +30,4 @@ declare const hslaTo: ([h, s, l, a]: [number, number, number, number], fallback?
32
30
  declare const hsvTo: ([h, s, v, a]: [number, number, number, number?], fallback?: string) => (format?: ColorFormat) => string | undefined;
33
31
  declare const sameColor: (color: string | undefined, comparison: string | undefined) => boolean;
34
32
 
35
- export { type ColorFormat, alphaToHex, calcFormat, convertColor, darkenColor, getAlpha, getColor, hslaTo, hsvTo, hues, isAccessible, isDark, isGray, isLight, isTone, lightenColor, parseToHsla, parseToHsv, parseToRgba, randomColor, rgbaTo, sameColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor };
33
+ export { type ColorFormat, alphaToHex, calcFormat, convertColor, darkenColor, getAlpha, getColor, hslaTo, hsvTo, isAccessible, isDark, isGray, isLight, isTone, lightenColor, parseToHsla, parseToHsv, parseToRgba, randomColor, rgbaTo, sameColor, shadeColor, tintColor, tones, transparentizeColor };
package/dist/color.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Dict } from './index.types.js';
2
2
 
3
3
  type ColorMode = "light" | "dark";
4
4
  type ColorFormat = "hex" | "hexa" | "rgba" | "rgb" | "hsl" | "hsla";
5
- declare const hues: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
5
+ declare const tones: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
6
6
  declare const isGray: (colorScheme: string) => boolean;
7
7
  declare const isAccessible: (colorScheme: string) => boolean;
8
8
  declare const getColor: (color: string, fallback?: string) => (theme?: Dict, colorMode?: ColorMode) => string;
@@ -11,8 +11,6 @@ declare const darkenColor: (color: string, amount: number) => (theme?: Dict, col
11
11
  declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => string;
12
12
  declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: ColorMode) => string;
13
13
  declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: ColorMode) => string;
14
- declare const toneColor: (color: string, hue: (typeof hues)[number], lCoef?: number, dCoef?: number) => (theme?: Dict, colorMode?: ColorMode) => string;
15
- declare const toneColors: (color: string, lCoef?: number, dCoef?: number) => Record<string, string>;
16
14
  declare const randomColor: ({ string, colors, }?: {
17
15
  string?: string | undefined;
18
16
  colors?: string[] | undefined;
@@ -32,4 +30,4 @@ declare const hslaTo: ([h, s, l, a]: [number, number, number, number], fallback?
32
30
  declare const hsvTo: ([h, s, v, a]: [number, number, number, number?], fallback?: string) => (format?: ColorFormat) => string | undefined;
33
31
  declare const sameColor: (color: string | undefined, comparison: string | undefined) => boolean;
34
32
 
35
- export { type ColorFormat, alphaToHex, calcFormat, convertColor, darkenColor, getAlpha, getColor, hslaTo, hsvTo, hues, isAccessible, isDark, isGray, isLight, isTone, lightenColor, parseToHsla, parseToHsv, parseToRgba, randomColor, rgbaTo, sameColor, shadeColor, tintColor, toneColor, toneColors, transparentizeColor };
33
+ export { type ColorFormat, alphaToHex, calcFormat, convertColor, darkenColor, getAlpha, getColor, hslaTo, hsvTo, isAccessible, isDark, isGray, isLight, isTone, lightenColor, parseToHsla, parseToHsv, parseToRgba, randomColor, rgbaTo, sameColor, shadeColor, tintColor, tones, transparentizeColor };
package/dist/color.js CHANGED
@@ -38,7 +38,6 @@ __export(color_exports, {
38
38
  getColor: () => getColor,
39
39
  hslaTo: () => hslaTo,
40
40
  hsvTo: () => hsvTo,
41
- hues: () => hues,
42
41
  isAccessible: () => isAccessible,
43
42
  isDark: () => isDark,
44
43
  isGray: () => isGray,
@@ -53,8 +52,7 @@ __export(color_exports, {
53
52
  sameColor: () => sameColor,
54
53
  shadeColor: () => shadeColor,
55
54
  tintColor: () => tintColor,
56
- toneColor: () => toneColor,
57
- toneColors: () => toneColors,
55
+ tones: () => tones,
58
56
  transparentizeColor: () => transparentizeColor
59
57
  });
60
58
  module.exports = __toCommonJS(color_exports);
@@ -93,7 +91,7 @@ var memoizeObject = (func) => {
93
91
  var getMemoizedObject = memoizeObject(getObject);
94
92
 
95
93
  // src/color.ts
96
- var hues = [
94
+ var tones = [
97
95
  50,
98
96
  100,
99
97
  200,
@@ -108,7 +106,7 @@ var hues = [
108
106
  ];
109
107
  var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "neutral";
110
108
  var isAccessible = (colorScheme) => colorScheme === "yellow" || colorScheme === "cyan" || colorScheme === "lime";
111
- var getColor = (color, fallback) => (theme = {}, colorMode) => {
109
+ var getColor = (color, fallback = "#000000") => (theme = {}, colorMode) => {
112
110
  var _a, _b, _c;
113
111
  const [token, hue] = color.split(".");
114
112
  const [, relatedToken] = (_c = Object.entries((_b = (_a = theme.semantics) == null ? void 0 : _a.colorSchemes) != null ? _b : {}).find(
@@ -124,7 +122,11 @@ var getColor = (color, fallback) => (theme = {}, colorMode) => {
124
122
  return c.toHex(String(hex));
125
123
  }
126
124
  } catch {
127
- return fallback != null ? fallback : "#000000";
125
+ try {
126
+ return c.toHex(fallback);
127
+ } catch {
128
+ return "#000000";
129
+ }
128
130
  }
129
131
  };
130
132
  var lightenColor = (color, amount) => (theme, colorMode) => {
@@ -147,25 +149,6 @@ var transparentizeColor = (color, alpha) => (theme, colorMode) => {
147
149
  const raw = getColor(color, color)(theme, colorMode);
148
150
  return c.transparentize(raw, 1 - alpha);
149
151
  };
150
- var toneColor = (color, hue, lCoef = 0.94, dCoef = 0.86) => (theme, colorMode) => {
151
- if (hue < 50 || 950 < hue)
152
- return color;
153
- let raw = color;
154
- if (theme && colorMode)
155
- getColor(color, color)(theme, colorMode);
156
- const coef = hue < 500 ? lCoef : dCoef;
157
- const amount = (500 - hue) * 1e-3 * coef;
158
- return c.toHex(c.lighten(raw, amount));
159
- };
160
- var toneColors = (color, lCoef = 0.94, dCoef = 0.86) => {
161
- const colors = {};
162
- hues.forEach((hue) => {
163
- const coef = hue < 500 ? lCoef : dCoef;
164
- const amount = (500 - hue) * 1e-3 * coef;
165
- colors[hue] = c.toHex(c.lighten(color, amount));
166
- });
167
- return colors;
168
- };
169
152
  var randomColor = ({
170
153
  string,
171
154
  colors
@@ -371,7 +354,6 @@ var sameColor = (color, comparison) => {
371
354
  getColor,
372
355
  hslaTo,
373
356
  hsvTo,
374
- hues,
375
357
  isAccessible,
376
358
  isDark,
377
359
  isGray,
@@ -386,8 +368,7 @@ var sameColor = (color, comparison) => {
386
368
  sameColor,
387
369
  shadeColor,
388
370
  tintColor,
389
- toneColor,
390
- toneColors,
371
+ tones,
391
372
  transparentizeColor
392
373
  });
393
374
  //# sourceMappingURL=color.js.map