@yamada-ui/utils 0.2.1 → 0.3.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/{chunk-ANJGKDOC.mjs → chunk-OL4TBQN7.mjs} +32 -12
- package/dist/color.d.mts +4 -3
- package/dist/color.d.ts +4 -3
- package/dist/color.js +33 -12
- package/dist/color.mjs +3 -1
- package/dist/function.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -12
- package/dist/index.mjs +3 -1
- package/dist/index.types.d.mts +1 -4
- package/dist/index.types.d.ts +1 -4
- package/dist/object.mjs +1 -1
- package/dist/react.mjs +1 -1
- package/package.json +1 -1
|
@@ -180,13 +180,32 @@ import {
|
|
|
180
180
|
darken,
|
|
181
181
|
lighten
|
|
182
182
|
} from "color2k";
|
|
183
|
+
var hues = [
|
|
184
|
+
50,
|
|
185
|
+
100,
|
|
186
|
+
200,
|
|
187
|
+
300,
|
|
188
|
+
400,
|
|
189
|
+
500,
|
|
190
|
+
600,
|
|
191
|
+
700,
|
|
192
|
+
800,
|
|
193
|
+
900,
|
|
194
|
+
950
|
|
195
|
+
];
|
|
183
196
|
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "zinc" || colorScheme === "neutral" || colorScheme === "stone";
|
|
184
|
-
var getColor = (color, fallback) => (theme, colorMode) => {
|
|
197
|
+
var getColor = (color, fallback) => (theme = {}, colorMode) => {
|
|
198
|
+
var _a, _b, _c;
|
|
199
|
+
const [token, hue] = color.split(".");
|
|
200
|
+
const [, relatedToken] = (_c = Object.entries((_b = (_a = theme.semantics) == null ? void 0 : _a.colorSchemes) != null ? _b : {}).find(
|
|
201
|
+
([semanticToken]) => token === semanticToken
|
|
202
|
+
)) != null ? _c : [];
|
|
203
|
+
if (relatedToken)
|
|
204
|
+
color = `${relatedToken}.${hue}`;
|
|
185
205
|
const hex = getMemoizedObject(theme, `colors.${color}`, color);
|
|
186
206
|
try {
|
|
187
207
|
if (isArray(hex)) {
|
|
188
|
-
|
|
189
|
-
return toHex(String(colorMode !== "dark" ? lightHex : darkHex));
|
|
208
|
+
return toHex(String(colorMode !== "dark" ? hex[0] : hex[1]));
|
|
190
209
|
} else {
|
|
191
210
|
return toHex(String(hex));
|
|
192
211
|
}
|
|
@@ -195,30 +214,30 @@ var getColor = (color, fallback) => (theme, colorMode) => {
|
|
|
195
214
|
}
|
|
196
215
|
};
|
|
197
216
|
var lightenColor = (color, amount) => (theme, colorMode) => {
|
|
198
|
-
const raw =
|
|
217
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
199
218
|
return toHex(lighten(raw, amount / 100));
|
|
200
219
|
};
|
|
201
220
|
var darkenColor = (color, amount) => (theme, colorMode) => {
|
|
202
|
-
const raw =
|
|
221
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
203
222
|
return toHex(darken(raw, amount / 100));
|
|
204
223
|
};
|
|
205
224
|
var tintColor = (color, amount) => (theme, colorMode) => {
|
|
206
|
-
const raw =
|
|
225
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
207
226
|
return toHex(mix(raw, "#fff", amount));
|
|
208
227
|
};
|
|
209
228
|
var shadeColor = (color, amount) => (theme, colorMode) => {
|
|
210
|
-
const raw =
|
|
229
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
211
230
|
return toHex(mix(raw, "#000", amount / 100));
|
|
212
231
|
};
|
|
213
232
|
var transparentizeColor = (color, alpha) => (theme, colorMode) => {
|
|
214
|
-
const raw =
|
|
233
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
215
234
|
return transparentize(raw, 1 - alpha);
|
|
216
235
|
};
|
|
217
|
-
var toneColor = (color,
|
|
218
|
-
const raw =
|
|
219
|
-
if (
|
|
236
|
+
var toneColor = (color, hue) => (theme, colorMode) => {
|
|
237
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
238
|
+
if (hue < 50 || 950 < hue)
|
|
220
239
|
return color;
|
|
221
|
-
let n = (
|
|
240
|
+
let n = (hue - 500) / 10;
|
|
222
241
|
const isLighten = n <= 0;
|
|
223
242
|
if (isLighten)
|
|
224
243
|
n *= -1;
|
|
@@ -457,6 +476,7 @@ export {
|
|
|
457
476
|
useAsync,
|
|
458
477
|
useAsyncFunc,
|
|
459
478
|
useAsyncRetry,
|
|
479
|
+
hues,
|
|
460
480
|
isGray,
|
|
461
481
|
getColor,
|
|
462
482
|
lightenColor,
|
package/dist/color.d.mts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Dict } from './index.types.mjs';
|
|
2
2
|
|
|
3
|
+
declare const hues: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
3
4
|
declare const isGray: (colorScheme: string) => boolean;
|
|
4
|
-
declare const getColor: (color: string, fallback?: string) => (theme
|
|
5
|
+
declare const getColor: (color: string, fallback?: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
5
6
|
declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
6
7
|
declare const darkenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
7
8
|
declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
8
9
|
declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
9
10
|
declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
10
|
-
declare const toneColor: (color: string,
|
|
11
|
+
declare const toneColor: (color: string, hue: (typeof hues)[number]) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
11
12
|
declare const randomColor: ({ string, colors, }?: {
|
|
12
13
|
string?: string | undefined;
|
|
13
14
|
colors?: string[] | undefined;
|
|
@@ -16,4 +17,4 @@ declare const isTone: (color: string) => (theme?: Dict, colorMode?: 'light' | 'd
|
|
|
16
17
|
declare const isLight: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
|
|
17
18
|
declare const isDark: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
|
|
18
19
|
|
|
19
|
-
export { darkenColor, getColor, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
|
|
20
|
+
export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
|
package/dist/color.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Dict } from './index.types.js';
|
|
2
2
|
|
|
3
|
+
declare const hues: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
3
4
|
declare const isGray: (colorScheme: string) => boolean;
|
|
4
|
-
declare const getColor: (color: string, fallback?: string) => (theme
|
|
5
|
+
declare const getColor: (color: string, fallback?: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
5
6
|
declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
6
7
|
declare const darkenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
7
8
|
declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
8
9
|
declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
9
10
|
declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
10
|
-
declare const toneColor: (color: string,
|
|
11
|
+
declare const toneColor: (color: string, hue: (typeof hues)[number]) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
11
12
|
declare const randomColor: ({ string, colors, }?: {
|
|
12
13
|
string?: string | undefined;
|
|
13
14
|
colors?: string[] | undefined;
|
|
@@ -16,4 +17,4 @@ declare const isTone: (color: string) => (theme?: Dict, colorMode?: 'light' | 'd
|
|
|
16
17
|
declare const isLight: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
|
|
17
18
|
declare const isDark: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
|
|
18
19
|
|
|
19
|
-
export { darkenColor, getColor, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
|
|
20
|
+
export { darkenColor, getColor, hues, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
|
package/dist/color.js
CHANGED
|
@@ -22,6 +22,7 @@ var color_exports = {};
|
|
|
22
22
|
__export(color_exports, {
|
|
23
23
|
darkenColor: () => darkenColor,
|
|
24
24
|
getColor: () => getColor,
|
|
25
|
+
hues: () => hues,
|
|
25
26
|
isDark: () => isDark,
|
|
26
27
|
isGray: () => isGray,
|
|
27
28
|
isLight: () => isLight,
|
|
@@ -69,13 +70,32 @@ var memoizeObject = (func) => {
|
|
|
69
70
|
var getMemoizedObject = memoizeObject(getObject);
|
|
70
71
|
|
|
71
72
|
// src/color.ts
|
|
73
|
+
var hues = [
|
|
74
|
+
50,
|
|
75
|
+
100,
|
|
76
|
+
200,
|
|
77
|
+
300,
|
|
78
|
+
400,
|
|
79
|
+
500,
|
|
80
|
+
600,
|
|
81
|
+
700,
|
|
82
|
+
800,
|
|
83
|
+
900,
|
|
84
|
+
950
|
|
85
|
+
];
|
|
72
86
|
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "zinc" || colorScheme === "neutral" || colorScheme === "stone";
|
|
73
|
-
var getColor = (color, fallback) => (theme, colorMode) => {
|
|
87
|
+
var getColor = (color, fallback) => (theme = {}, colorMode) => {
|
|
88
|
+
var _a, _b, _c;
|
|
89
|
+
const [token, hue] = color.split(".");
|
|
90
|
+
const [, relatedToken] = (_c = Object.entries((_b = (_a = theme.semantics) == null ? void 0 : _a.colorSchemes) != null ? _b : {}).find(
|
|
91
|
+
([semanticToken]) => token === semanticToken
|
|
92
|
+
)) != null ? _c : [];
|
|
93
|
+
if (relatedToken)
|
|
94
|
+
color = `${relatedToken}.${hue}`;
|
|
74
95
|
const hex = getMemoizedObject(theme, `colors.${color}`, color);
|
|
75
96
|
try {
|
|
76
97
|
if (isArray(hex)) {
|
|
77
|
-
|
|
78
|
-
return (0, import_color2k.toHex)(String(colorMode !== "dark" ? lightHex : darkHex));
|
|
98
|
+
return (0, import_color2k.toHex)(String(colorMode !== "dark" ? hex[0] : hex[1]));
|
|
79
99
|
} else {
|
|
80
100
|
return (0, import_color2k.toHex)(String(hex));
|
|
81
101
|
}
|
|
@@ -84,30 +104,30 @@ var getColor = (color, fallback) => (theme, colorMode) => {
|
|
|
84
104
|
}
|
|
85
105
|
};
|
|
86
106
|
var lightenColor = (color, amount) => (theme, colorMode) => {
|
|
87
|
-
const raw =
|
|
107
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
88
108
|
return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount / 100));
|
|
89
109
|
};
|
|
90
110
|
var darkenColor = (color, amount) => (theme, colorMode) => {
|
|
91
|
-
const raw =
|
|
111
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
92
112
|
return (0, import_color2k.toHex)((0, import_color2k.darken)(raw, amount / 100));
|
|
93
113
|
};
|
|
94
114
|
var tintColor = (color, amount) => (theme, colorMode) => {
|
|
95
|
-
const raw =
|
|
115
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
96
116
|
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount));
|
|
97
117
|
};
|
|
98
118
|
var shadeColor = (color, amount) => (theme, colorMode) => {
|
|
99
|
-
const raw =
|
|
119
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
100
120
|
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#000", amount / 100));
|
|
101
121
|
};
|
|
102
122
|
var transparentizeColor = (color, alpha) => (theme, colorMode) => {
|
|
103
|
-
const raw =
|
|
123
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
104
124
|
return (0, import_color2k.transparentize)(raw, 1 - alpha);
|
|
105
125
|
};
|
|
106
|
-
var toneColor = (color,
|
|
107
|
-
const raw =
|
|
108
|
-
if (
|
|
126
|
+
var toneColor = (color, hue) => (theme, colorMode) => {
|
|
127
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
128
|
+
if (hue < 50 || 950 < hue)
|
|
109
129
|
return color;
|
|
110
|
-
let n = (
|
|
130
|
+
let n = (hue - 500) / 10;
|
|
111
131
|
const isLighten = n <= 0;
|
|
112
132
|
if (isLighten)
|
|
113
133
|
n *= -1;
|
|
@@ -172,6 +192,7 @@ var isDark = (color) => (theme, colorMode) => isTone(color)(theme, colorMode) ==
|
|
|
172
192
|
0 && (module.exports = {
|
|
173
193
|
darkenColor,
|
|
174
194
|
getColor,
|
|
195
|
+
hues,
|
|
175
196
|
isDark,
|
|
176
197
|
isGray,
|
|
177
198
|
isLight,
|
package/dist/color.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
darkenColor,
|
|
3
3
|
getColor,
|
|
4
|
+
hues,
|
|
4
5
|
isDark,
|
|
5
6
|
isGray,
|
|
6
7
|
isLight,
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
tintColor,
|
|
12
13
|
toneColor,
|
|
13
14
|
transparentizeColor
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OL4TBQN7.mjs";
|
|
15
16
|
import "./chunk-SLJ4M7XC.mjs";
|
|
16
17
|
import "./chunk-VYMGBE25.mjs";
|
|
17
18
|
import "./chunk-BZAW2D6U.mjs";
|
|
@@ -23,6 +24,7 @@ import "./chunk-G7Q2EDJF.mjs";
|
|
|
23
24
|
export {
|
|
24
25
|
darkenColor,
|
|
25
26
|
getColor,
|
|
27
|
+
hues,
|
|
26
28
|
isDark,
|
|
27
29
|
isGray,
|
|
28
30
|
isLight,
|
package/dist/function.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Dict,
|
|
1
|
+
export { Dict, Length, Path, 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, 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, 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,
|
|
1
|
+
export { Dict, Length, Path, 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, 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, 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
|
@@ -66,6 +66,7 @@ __export(src_exports, {
|
|
|
66
66
|
handlerAll: () => handlerAll,
|
|
67
67
|
hasNegativeTabIndex: () => hasNegativeTabIndex,
|
|
68
68
|
hasTabIndex: () => hasTabIndex,
|
|
69
|
+
hues: () => hues,
|
|
69
70
|
includesChildren: () => includesChildren,
|
|
70
71
|
isActiveElement: () => isActiveElement,
|
|
71
72
|
isApple: () => isApple,
|
|
@@ -583,13 +584,32 @@ var calc = Object.assign(
|
|
|
583
584
|
|
|
584
585
|
// src/color.ts
|
|
585
586
|
var import_color2k = require("color2k");
|
|
587
|
+
var hues = [
|
|
588
|
+
50,
|
|
589
|
+
100,
|
|
590
|
+
200,
|
|
591
|
+
300,
|
|
592
|
+
400,
|
|
593
|
+
500,
|
|
594
|
+
600,
|
|
595
|
+
700,
|
|
596
|
+
800,
|
|
597
|
+
900,
|
|
598
|
+
950
|
|
599
|
+
];
|
|
586
600
|
var isGray = (colorScheme) => colorScheme === "gray" || colorScheme === "zinc" || colorScheme === "neutral" || colorScheme === "stone";
|
|
587
|
-
var getColor = (color, fallback) => (theme, colorMode) => {
|
|
601
|
+
var getColor = (color, fallback) => (theme = {}, colorMode) => {
|
|
602
|
+
var _a, _b, _c;
|
|
603
|
+
const [token, hue] = color.split(".");
|
|
604
|
+
const [, relatedToken] = (_c = Object.entries((_b = (_a = theme.semantics) == null ? void 0 : _a.colorSchemes) != null ? _b : {}).find(
|
|
605
|
+
([semanticToken]) => token === semanticToken
|
|
606
|
+
)) != null ? _c : [];
|
|
607
|
+
if (relatedToken)
|
|
608
|
+
color = `${relatedToken}.${hue}`;
|
|
588
609
|
const hex = getMemoizedObject(theme, `colors.${color}`, color);
|
|
589
610
|
try {
|
|
590
611
|
if (isArray(hex)) {
|
|
591
|
-
|
|
592
|
-
return (0, import_color2k.toHex)(String(colorMode !== "dark" ? lightHex : darkHex));
|
|
612
|
+
return (0, import_color2k.toHex)(String(colorMode !== "dark" ? hex[0] : hex[1]));
|
|
593
613
|
} else {
|
|
594
614
|
return (0, import_color2k.toHex)(String(hex));
|
|
595
615
|
}
|
|
@@ -598,30 +618,30 @@ var getColor = (color, fallback) => (theme, colorMode) => {
|
|
|
598
618
|
}
|
|
599
619
|
};
|
|
600
620
|
var lightenColor = (color, amount) => (theme, colorMode) => {
|
|
601
|
-
const raw =
|
|
621
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
602
622
|
return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount / 100));
|
|
603
623
|
};
|
|
604
624
|
var darkenColor = (color, amount) => (theme, colorMode) => {
|
|
605
|
-
const raw =
|
|
625
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
606
626
|
return (0, import_color2k.toHex)((0, import_color2k.darken)(raw, amount / 100));
|
|
607
627
|
};
|
|
608
628
|
var tintColor = (color, amount) => (theme, colorMode) => {
|
|
609
|
-
const raw =
|
|
629
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
610
630
|
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount));
|
|
611
631
|
};
|
|
612
632
|
var shadeColor = (color, amount) => (theme, colorMode) => {
|
|
613
|
-
const raw =
|
|
633
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
614
634
|
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#000", amount / 100));
|
|
615
635
|
};
|
|
616
636
|
var transparentizeColor = (color, alpha) => (theme, colorMode) => {
|
|
617
|
-
const raw =
|
|
637
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
618
638
|
return (0, import_color2k.transparentize)(raw, 1 - alpha);
|
|
619
639
|
};
|
|
620
|
-
var toneColor = (color,
|
|
621
|
-
const raw =
|
|
622
|
-
if (
|
|
640
|
+
var toneColor = (color, hue) => (theme, colorMode) => {
|
|
641
|
+
const raw = getColor(color, color)(theme, colorMode);
|
|
642
|
+
if (hue < 50 || 950 < hue)
|
|
623
643
|
return color;
|
|
624
|
-
let n = (
|
|
644
|
+
let n = (hue - 500) / 10;
|
|
625
645
|
const isLighten = n <= 0;
|
|
626
646
|
if (isLighten)
|
|
627
647
|
n *= -1;
|
|
@@ -794,6 +814,7 @@ var addPointerEvent = (target, type, cb, options) => addDomEvent(target, type, w
|
|
|
794
814
|
handlerAll,
|
|
795
815
|
hasNegativeTabIndex,
|
|
796
816
|
hasTabIndex,
|
|
817
|
+
hues,
|
|
797
818
|
includesChildren,
|
|
798
819
|
isActiveElement,
|
|
799
820
|
isApple,
|
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getObject,
|
|
15
15
|
getValidChildren,
|
|
16
16
|
handlerAll,
|
|
17
|
+
hues,
|
|
17
18
|
includesChildren,
|
|
18
19
|
isDark,
|
|
19
20
|
isGray,
|
|
@@ -49,7 +50,7 @@ import {
|
|
|
49
50
|
useSafeLayoutEffect,
|
|
50
51
|
useUnmountEffect,
|
|
51
52
|
useUpdateEffect
|
|
52
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-OL4TBQN7.mjs";
|
|
53
54
|
import "./chunk-SLJ4M7XC.mjs";
|
|
54
55
|
import {
|
|
55
56
|
clampNumber,
|
|
@@ -157,6 +158,7 @@ export {
|
|
|
157
158
|
handlerAll,
|
|
158
159
|
hasNegativeTabIndex,
|
|
159
160
|
hasTabIndex,
|
|
161
|
+
hues,
|
|
160
162
|
includesChildren,
|
|
161
163
|
isActiveElement,
|
|
162
164
|
isApple,
|
package/dist/index.types.d.mts
CHANGED
|
@@ -7,8 +7,5 @@ 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 DynamicRecord<T> = {
|
|
11
|
-
[K in keyof T]-?: T[K] extends Primitive ? string | number : DynamicRecord<T[K]>;
|
|
12
|
-
};
|
|
13
10
|
|
|
14
|
-
export { Dict,
|
|
11
|
+
export { Dict, Length, Path, StringLiteral, Union };
|
package/dist/index.types.d.ts
CHANGED
|
@@ -7,8 +7,5 @@ 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 DynamicRecord<T> = {
|
|
11
|
-
[K in keyof T]-?: T[K] extends Primitive ? string | number : DynamicRecord<T[K]>;
|
|
12
|
-
};
|
|
13
10
|
|
|
14
|
-
export { Dict,
|
|
11
|
+
export { Dict, Length, Path, StringLiteral, Union };
|
package/dist/object.mjs
CHANGED
package/dist/react.mjs
CHANGED