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