@yamada-ui/utils 0.1.5 → 0.2.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.
@@ -195,27 +195,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
195
195
  }
196
196
  };
197
197
  var lightenColor = (color, amount) => (theme, colorMode) => {
198
- const raw = getColor(color)(theme, colorMode);
198
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
199
199
  return toHex(lighten(raw, amount / 100));
200
200
  };
201
201
  var darkenColor = (color, amount) => (theme, colorMode) => {
202
- const raw = getColor(color)(theme, colorMode);
202
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
203
203
  return toHex(darken(raw, amount / 100));
204
204
  };
205
205
  var tintColor = (color, amount) => (theme, colorMode) => {
206
- const raw = getColor(color)(theme, colorMode);
206
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
207
207
  return toHex(mix(raw, "#fff", amount));
208
208
  };
209
209
  var shadeColor = (color, amount) => (theme, colorMode) => {
210
- const raw = getColor(color)(theme, colorMode);
210
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
211
211
  return toHex(mix(raw, "#000", amount / 100));
212
212
  };
213
213
  var transparentizeColor = (color, alpha) => (theme, colorMode) => {
214
- const raw = getColor(color)(theme, colorMode);
214
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
215
215
  return transparentize(raw, 1 - alpha);
216
216
  };
217
217
  var toneColor = (color, l) => (theme, colorMode) => {
218
- const raw = getColor(color)(theme, colorMode);
218
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
219
219
  if (l < 0 || 900 < l)
220
220
  return color;
221
221
  let n = (l - 500) / 10;
@@ -272,7 +272,7 @@ var getBrightness = (color) => {
272
272
  return (r * 299 + g * 587 + b * 114) / 1e3;
273
273
  };
274
274
  var isTone = (color) => (theme, colorMode) => {
275
- const raw = getColor(color)(theme, colorMode);
275
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
276
276
  const brightness = getBrightness(raw);
277
277
  const isDark2 = brightness < 128;
278
278
  return isDark2 ? "dark" : "light";
package/dist/color.d.mts CHANGED
@@ -1,19 +1,19 @@
1
1
  import { Dict } from './index.types.mjs';
2
2
 
3
3
  declare const isGray: (colorScheme: string) => boolean;
4
- declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
5
- declare const lightenColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
6
- declare const darkenColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
7
- declare const tintColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
8
- declare const shadeColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
9
- declare const transparentizeColor: (color: string, alpha: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
10
- declare const toneColor: (color: string, l: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
4
+ declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode?: 'light' | 'dark') => string;
5
+ declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
6
+ declare const darkenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
7
+ declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
8
+ declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
9
+ declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
10
+ declare const toneColor: (color: string, l: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
11
11
  declare const randomColor: ({ string, colors, }?: {
12
12
  string?: string | undefined;
13
13
  colors?: string[] | undefined;
14
14
  }) => string;
15
- declare const isTone: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => "light" | "dark";
16
- declare const isLight: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => boolean;
17
- declare const isDark: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => boolean;
15
+ declare const isTone: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => "light" | "dark";
16
+ declare const isLight: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
17
+ declare const isDark: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
18
18
 
19
19
  export { darkenColor, getColor, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
package/dist/color.d.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  import { Dict } from './index.types.js';
2
2
 
3
3
  declare const isGray: (colorScheme: string) => boolean;
4
- declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
5
- declare const lightenColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
6
- declare const darkenColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
7
- declare const tintColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
8
- declare const shadeColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
9
- declare const transparentizeColor: (color: string, alpha: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
10
- declare const toneColor: (color: string, l: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
4
+ declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode?: 'light' | 'dark') => string;
5
+ declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
6
+ declare const darkenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
7
+ declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
8
+ declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
9
+ declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
10
+ declare const toneColor: (color: string, l: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
11
11
  declare const randomColor: ({ string, colors, }?: {
12
12
  string?: string | undefined;
13
13
  colors?: string[] | undefined;
14
14
  }) => string;
15
- declare const isTone: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => "light" | "dark";
16
- declare const isLight: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => boolean;
17
- declare const isDark: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => boolean;
15
+ declare const isTone: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => "light" | "dark";
16
+ declare const isLight: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
17
+ declare const isDark: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
18
18
 
19
19
  export { darkenColor, getColor, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
package/dist/color.js CHANGED
@@ -84,27 +84,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
84
84
  }
85
85
  };
86
86
  var lightenColor = (color, amount) => (theme, colorMode) => {
87
- const raw = getColor(color)(theme, colorMode);
87
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
88
88
  return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount / 100));
89
89
  };
90
90
  var darkenColor = (color, amount) => (theme, colorMode) => {
91
- const raw = getColor(color)(theme, colorMode);
91
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
92
92
  return (0, import_color2k.toHex)((0, import_color2k.darken)(raw, amount / 100));
93
93
  };
94
94
  var tintColor = (color, amount) => (theme, colorMode) => {
95
- const raw = getColor(color)(theme, colorMode);
95
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
96
96
  return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount));
97
97
  };
98
98
  var shadeColor = (color, amount) => (theme, colorMode) => {
99
- const raw = getColor(color)(theme, colorMode);
99
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
100
100
  return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#000", amount / 100));
101
101
  };
102
102
  var transparentizeColor = (color, alpha) => (theme, colorMode) => {
103
- const raw = getColor(color)(theme, colorMode);
103
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
104
104
  return (0, import_color2k.transparentize)(raw, 1 - alpha);
105
105
  };
106
106
  var toneColor = (color, l) => (theme, colorMode) => {
107
- const raw = getColor(color)(theme, colorMode);
107
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
108
108
  if (l < 0 || 900 < l)
109
109
  return color;
110
110
  let n = (l - 500) / 10;
@@ -161,7 +161,7 @@ var getBrightness = (color) => {
161
161
  return (r * 299 + g * 587 + b * 114) / 1e3;
162
162
  };
163
163
  var isTone = (color) => (theme, colorMode) => {
164
- const raw = getColor(color)(theme, colorMode);
164
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
165
165
  const brightness = getBrightness(raw);
166
166
  const isDark2 = brightness < 128;
167
167
  return isDark2 ? "dark" : "light";
package/dist/color.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  tintColor,
12
12
  toneColor,
13
13
  transparentizeColor
14
- } from "./chunk-XIDDMDVR.mjs";
14
+ } from "./chunk-32BEUAHK.mjs";
15
15
  import "./chunk-SLJ4M7XC.mjs";
16
16
  import "./chunk-VYMGBE25.mjs";
17
17
  import "./chunk-BZAW2D6U.mjs";
package/dist/function.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  handlerAll,
4
4
  noop,
5
5
  runIfFunc
6
- } from "./chunk-XIDDMDVR.mjs";
6
+ } from "./chunk-32BEUAHK.mjs";
7
7
  import "./chunk-SLJ4M7XC.mjs";
8
8
  import "./chunk-VYMGBE25.mjs";
9
9
  import "./chunk-BZAW2D6U.mjs";
package/dist/index.js CHANGED
@@ -594,27 +594,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
594
594
  }
595
595
  };
596
596
  var lightenColor = (color, amount) => (theme, colorMode) => {
597
- const raw = getColor(color)(theme, colorMode);
597
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
598
598
  return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount / 100));
599
599
  };
600
600
  var darkenColor = (color, amount) => (theme, colorMode) => {
601
- const raw = getColor(color)(theme, colorMode);
601
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
602
602
  return (0, import_color2k.toHex)((0, import_color2k.darken)(raw, amount / 100));
603
603
  };
604
604
  var tintColor = (color, amount) => (theme, colorMode) => {
605
- const raw = getColor(color)(theme, colorMode);
605
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
606
606
  return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount));
607
607
  };
608
608
  var shadeColor = (color, amount) => (theme, colorMode) => {
609
- const raw = getColor(color)(theme, colorMode);
609
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
610
610
  return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#000", amount / 100));
611
611
  };
612
612
  var transparentizeColor = (color, alpha) => (theme, colorMode) => {
613
- const raw = getColor(color)(theme, colorMode);
613
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
614
614
  return (0, import_color2k.transparentize)(raw, 1 - alpha);
615
615
  };
616
616
  var toneColor = (color, l) => (theme, colorMode) => {
617
- const raw = getColor(color)(theme, colorMode);
617
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
618
618
  if (l < 0 || 900 < l)
619
619
  return color;
620
620
  let n = (l - 500) / 10;
@@ -671,7 +671,7 @@ var getBrightness = (color) => {
671
671
  return (r * 299 + g * 587 + b * 114) / 1e3;
672
672
  };
673
673
  var isTone = (color) => (theme, colorMode) => {
674
- const raw = getColor(color)(theme, colorMode);
674
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
675
675
  const brightness = getBrightness(raw);
676
676
  const isDark2 = brightness < 128;
677
677
  return isDark2 ? "dark" : "light";
package/dist/index.mjs CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  useSafeLayoutEffect,
50
50
  useUnmountEffect,
51
51
  useUpdateEffect
52
- } from "./chunk-XIDDMDVR.mjs";
52
+ } from "./chunk-32BEUAHK.mjs";
53
53
  import "./chunk-SLJ4M7XC.mjs";
54
54
  import {
55
55
  clampNumber,
package/dist/object.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  pickObject,
14
14
  replaceObject,
15
15
  splitObject
16
- } from "./chunk-XIDDMDVR.mjs";
16
+ } from "./chunk-32BEUAHK.mjs";
17
17
  import "./chunk-SLJ4M7XC.mjs";
18
18
  import "./chunk-VYMGBE25.mjs";
19
19
  import "./chunk-BZAW2D6U.mjs";
package/dist/react.mjs CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  useSafeLayoutEffect,
20
20
  useUnmountEffect,
21
21
  useUpdateEffect
22
- } from "./chunk-XIDDMDVR.mjs";
22
+ } from "./chunk-32BEUAHK.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.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Yamada UI utils",
5
5
  "keywords": [
6
6
  "utils",