solid-tiny-utils 0.5.0 → 0.7.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.
Files changed (46) hide show
  1. package/dist/{chunk-AKFEDWEF.js → chunk-6OVLJ45M.js} +5 -5
  2. package/dist/chunk-ACZGS7DG.js +72 -0
  3. package/dist/chunk-KFLH3AZ6.js +40 -0
  4. package/dist/{chunk-DKZ3RJJI.js → chunk-KM4Q6THD.js} +5 -1
  5. package/dist/{chunk-GHJDTAVH.js → chunk-LEWF7QAQ.js} +4 -4
  6. package/dist/chunk-PD6VHMH6.js +26 -0
  7. package/dist/chunk-S7U3LZNS.js +23 -0
  8. package/dist/{chunk-IQGRRDJZ.js → chunk-TGWWPUWD.js} +1 -1
  9. package/dist/chunk-U5LQ2AS5.js +0 -0
  10. package/dist/{chunk-DV7LISIY.js → chunk-WJHRONQU.js} +1 -1
  11. package/dist/color/hex-rgb.d.ts +36 -0
  12. package/dist/color/hex-rgb.js +15 -0
  13. package/dist/color/index.d.ts +3 -0
  14. package/dist/color/index.js +30 -0
  15. package/dist/color/oklch-rgb.d.ts +49 -0
  16. package/dist/color/oklch-rgb.js +15 -0
  17. package/dist/color/validation.d.ts +26 -0
  18. package/dist/color/validation.js +18 -0
  19. package/dist/dom/css.d.ts +2 -1
  20. package/dist/dom/css.js +6 -3
  21. package/dist/dom/index.d.ts +1 -1
  22. package/dist/dom/index.js +6 -3
  23. package/dist/event/create-click-outside.js +7 -6
  24. package/dist/event/create-event-listener.js +7 -6
  25. package/dist/event/create-intersection-observer.js +6 -5
  26. package/dist/event/create-visibility-observer.js +6 -5
  27. package/dist/event/index.js +14 -13
  28. package/dist/event/make-event-listener.js +6 -5
  29. package/dist/fn/create-debounce.js +5 -4
  30. package/dist/fn/create-loop-exec.js +5 -4
  31. package/dist/fn/create-throttle.js +5 -4
  32. package/dist/fn/index.js +5 -4
  33. package/dist/index.d.ts +5 -1
  34. package/dist/index.js +56 -21
  35. package/dist/reactive/access.js +3 -2
  36. package/dist/reactive/create-debounce-watch.js +5 -4
  37. package/dist/reactive/index.js +7 -6
  38. package/dist/types/index.js +1 -1
  39. package/dist/utils/index.d.ts +1 -0
  40. package/dist/utils/index.js +15 -3
  41. package/dist/utils/number.d.ts +113 -0
  42. package/dist/utils/number.js +14 -0
  43. package/package.json +12 -12
  44. package/dist/{chunk-MEZ7CXEG.js → chunk-BLX3XSA6.js} +0 -0
  45. package/dist/{chunk-D3JAYNG6.js → chunk-QPEF6LHH.js} +3 -3
  46. package/dist/{chunk-WWEM5VJO.js → chunk-TDJLPDJF.js} +3 -3
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  makeEventListener
3
- } from "./chunk-IQGRRDJZ.js";
3
+ } from "./chunk-TGWWPUWD.js";
4
4
  import {
5
5
  noop
6
- } from "./chunk-D3JAYNG6.js";
7
- import {
8
- createWatch
9
- } from "./chunk-4L6FK7MF.js";
6
+ } from "./chunk-QPEF6LHH.js";
10
7
  import {
11
8
  access
12
9
  } from "./chunk-YK5QQQ43.js";
10
+ import {
11
+ createWatch
12
+ } from "./chunk-4L6FK7MF.js";
13
13
  import {
14
14
  clearArray
15
15
  } from "./chunk-BT47ISVC.js";
@@ -0,0 +1,72 @@
1
+ import {
2
+ clamp,
3
+ max
4
+ } from "./chunk-PD6VHMH6.js";
5
+
6
+ // src/color/oklch-rgb.ts
7
+ var PI_180 = Math.PI / 180;
8
+ var INV_PI_180 = 180 / Math.PI;
9
+ var linearToSRGB = (x) => x <= 31308e-7 ? 12.92 * x : 1.055 * x ** (1 / 2.4) - 0.055;
10
+ var sRGBToLinear = (x) => x <= 0.04045 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
11
+ function normalizeHue(hue) {
12
+ return (hue % 360 + 360) % 360;
13
+ }
14
+ function oklchToRgb(oklch) {
15
+ const { l, c, h } = oklch;
16
+ const clampedL = clamp(l, 0, 1);
17
+ const clampedC = max(0, c);
18
+ const normalizedH = normalizeHue(h);
19
+ const a_ = clampedC * Math.cos(normalizedH * PI_180);
20
+ const b_ = clampedC * Math.sin(normalizedH * PI_180);
21
+ const L = clampedL;
22
+ const A = a_;
23
+ const B = b_;
24
+ const l_ = L + 0.3963377774 * A + 0.2158037573 * B;
25
+ const m_ = L - 0.1055613458 * A - 0.0638541728 * B;
26
+ const s_ = L - 0.0894841775 * A - 1.291485548 * B;
27
+ const l3 = l_ ** 3;
28
+ const m3 = m_ ** 3;
29
+ const s3 = s_ ** 3;
30
+ let r = 4.0767416621 * l3 - 3.3077115913 * m3 + 0.2309699292 * s3;
31
+ let g = -1.2684380046 * l3 + 2.6097574011 * m3 - 0.3413193965 * s3;
32
+ let b = -0.0041960863 * l3 - 0.7034186147 * m3 + 1.707614701 * s3;
33
+ r = linearToSRGB(r);
34
+ g = linearToSRGB(g);
35
+ b = linearToSRGB(b);
36
+ return {
37
+ r: Math.round(clamp(r) * 255),
38
+ g: Math.round(clamp(g) * 255),
39
+ b: Math.round(clamp(b) * 255)
40
+ };
41
+ }
42
+ function rgbToOklch(rgb) {
43
+ const r = clamp(rgb.r, 0, 255);
44
+ const g = clamp(rgb.g, 0, 255);
45
+ const b = clamp(rgb.b, 0, 255);
46
+ const rLinear = sRGBToLinear(r / 255);
47
+ const gLinear = sRGBToLinear(g / 255);
48
+ const bLinear = sRGBToLinear(b / 255);
49
+ const l_ = Math.cbrt(
50
+ 0.4122214708 * rLinear + 0.5363325363 * gLinear + 0.0514459929 * bLinear
51
+ );
52
+ const m_ = Math.cbrt(
53
+ 0.2119034982 * rLinear + 0.6806995451 * gLinear + 0.1073969566 * bLinear
54
+ );
55
+ const s_ = Math.cbrt(
56
+ 0.0883024619 * rLinear + 0.2817188376 * gLinear + 0.6299787005 * bLinear
57
+ );
58
+ const L = 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_;
59
+ const A = 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_;
60
+ const B = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_;
61
+ const c = Math.sqrt(A * A + B * B);
62
+ let h = Math.atan2(B, A) * INV_PI_180;
63
+ if (h < 0) {
64
+ h += 360;
65
+ }
66
+ return { l: L, c, h };
67
+ }
68
+
69
+ export {
70
+ oklchToRgb,
71
+ rgbToOklch
72
+ };
@@ -0,0 +1,40 @@
1
+ import {
2
+ isArray
3
+ } from "./chunk-6G7GFZV2.js";
4
+ import {
5
+ clamp,
6
+ toHex
7
+ } from "./chunk-PD6VHMH6.js";
8
+
9
+ // src/color/hex-rgb.ts
10
+ var HEX_PREFIX_REGEX = /^#/;
11
+ var HEX_VALIDATION_REGEX = /^[0-9a-fA-F]{6}$/;
12
+ function hexToRgb(hex) {
13
+ if (!hex || typeof hex !== "string") {
14
+ return null;
15
+ }
16
+ let value = hex.trim().replace(HEX_PREFIX_REGEX, "");
17
+ if (value.length === 3) {
18
+ value = value.split("").map((c) => c + c).join("");
19
+ }
20
+ if (!HEX_VALIDATION_REGEX.test(value)) {
21
+ return null;
22
+ }
23
+ const r = Number.parseInt(value.slice(0, 2), 16);
24
+ const g = Number.parseInt(value.slice(2, 4), 16);
25
+ const b = Number.parseInt(value.slice(4, 6), 16);
26
+ return { r, g, b };
27
+ }
28
+ function rgbToHex(rgb) {
29
+ const c = (v) => Math.round(clamp(v, 0, 255));
30
+ const rgb_ = isArray(rgb) ? rgb : [rgb.r, rgb.g, rgb.b];
31
+ const r = c(rgb_[0]);
32
+ const g = c(rgb_[1]);
33
+ const b = c(rgb_[2]);
34
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
35
+ }
36
+
37
+ export {
38
+ hexToRgb,
39
+ rgbToHex
40
+ };
@@ -38,9 +38,13 @@ function combineStyle(a, b) {
38
38
  const bb = typeof b === "string" ? stringStyleToObject(b) : b;
39
39
  return { ...a, ...bb };
40
40
  }
41
+ function combineClass(defaultClass, ...otherClass) {
42
+ return [defaultClass, ...otherClass].filter(Boolean).join(" ");
43
+ }
41
44
 
42
45
  export {
43
46
  mountStyle,
44
47
  stringStyleToObject,
45
- combineStyle
48
+ combineStyle,
49
+ combineClass
46
50
  };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  noop
3
- } from "./chunk-D3JAYNG6.js";
4
- import {
5
- createWatch
6
- } from "./chunk-4L6FK7MF.js";
3
+ } from "./chunk-QPEF6LHH.js";
7
4
  import {
8
5
  access
9
6
  } from "./chunk-YK5QQQ43.js";
7
+ import {
8
+ createWatch
9
+ } from "./chunk-4L6FK7MF.js";
10
10
  import {
11
11
  clearArray
12
12
  } from "./chunk-BT47ISVC.js";
@@ -0,0 +1,26 @@
1
+ // src/utils/number.ts
2
+ function min(...numbers) {
3
+ return Math.min(...numbers);
4
+ }
5
+ function max(...numbers) {
6
+ return Math.max(...numbers);
7
+ }
8
+ function clamp(x, minimum = 0, maximum = 1) {
9
+ return min(maximum, max(minimum, x));
10
+ }
11
+ function inRange(x, minimum = 0, maximum = 1, inclusivity = "[]") {
12
+ const minCheck = inclusivity[0] === "[" ? x >= minimum : x > minimum;
13
+ const maxCheck = inclusivity[1] === "]" ? x <= maximum : x < maximum;
14
+ return minCheck && maxCheck;
15
+ }
16
+ function toHex(x, pad = 2) {
17
+ return x.toString(16).padStart(pad, "0");
18
+ }
19
+
20
+ export {
21
+ min,
22
+ max,
23
+ clamp,
24
+ inRange,
25
+ toHex
26
+ };
@@ -0,0 +1,23 @@
1
+ import {
2
+ hexToRgb
3
+ } from "./chunk-KFLH3AZ6.js";
4
+ import {
5
+ inRange
6
+ } from "./chunk-PD6VHMH6.js";
7
+
8
+ // src/color/validation.ts
9
+ function isValidRGB(rgb) {
10
+ return Object.values(rgb).every((x) => inRange(x, 0, 255));
11
+ }
12
+ function isValidOKLCH(oklch) {
13
+ return inRange(oklch.l) && oklch.c >= 0 && inRange(oklch.h, 0, 360);
14
+ }
15
+ function isValidHex(hex) {
16
+ return hexToRgb(hex) !== null;
17
+ }
18
+
19
+ export {
20
+ isValidRGB,
21
+ isValidOKLCH,
22
+ isValidHex
23
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  noop
3
- } from "./chunk-D3JAYNG6.js";
3
+ } from "./chunk-QPEF6LHH.js";
4
4
  import {
5
5
  clearArray
6
6
  } from "./chunk-BT47ISVC.js";
File without changes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  makeEventListener
3
- } from "./chunk-IQGRRDJZ.js";
3
+ } from "./chunk-TGWWPUWD.js";
4
4
  import {
5
5
  access
6
6
  } from "./chunk-YK5QQQ43.js";
@@ -0,0 +1,36 @@
1
+ import { RGB } from './oklch-rgb.js';
2
+
3
+ /**
4
+ * Converts a hex color string to RGB color values.
5
+ *
6
+ * Supports both 3-digit (#rgb) and 6-digit (#rrggbb) hex formats.
7
+ * The hash symbol (#) is optional.
8
+ *
9
+ * @param hex - Hex color string (e.g., "#ffcc00", "ffcc00", "#fc0", "fc0")
10
+ * @returns RGB object with r, g, b values (0-255), or null if invalid
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * hexToRgb("#ffcc00") // => { r: 255, g: 204, b: 0 }
15
+ * hexToRgb("fc0") // => { r: 255, g: 204, b: 0 }
16
+ * hexToRgb("#invalid") // => null
17
+ * ```
18
+ */
19
+ declare function hexToRgb(hex: string): RGB | null;
20
+ /**
21
+ * Converts RGB color values to a hex color string.
22
+ *
23
+ * RGB values are automatically clamped to the 0-255 range.
24
+ *
25
+ * @param rgb - RGB object with r, g, b values
26
+ * @returns Hex color string with # prefix (e.g., "#ffcc00")
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * rgbToHex({ r: 255, g: 204, b: 0 }) // => "#ffcc00"
31
+ * rgbToHex({ r: 300, g: -10, b: 128 }) // => "#ff0080" (clamped values)
32
+ * ```
33
+ */
34
+ declare function rgbToHex(rgb: RGB | [number, number, number]): string;
35
+
36
+ export { hexToRgb, rgbToHex };
@@ -0,0 +1,15 @@
1
+ import {
2
+ hexToRgb,
3
+ rgbToHex
4
+ } from "../chunk-KFLH3AZ6.js";
5
+ import "../chunk-U5LQ2AS5.js";
6
+ import "../chunk-QQVSG76Z.js";
7
+ import "../chunk-Y4GYGFIT.js";
8
+ import "../chunk-BT47ISVC.js";
9
+ import "../chunk-KKFGUHFR.js";
10
+ import "../chunk-6G7GFZV2.js";
11
+ import "../chunk-PD6VHMH6.js";
12
+ export {
13
+ hexToRgb,
14
+ rgbToHex
15
+ };
@@ -0,0 +1,3 @@
1
+ export { hexToRgb, rgbToHex } from './hex-rgb.js';
2
+ export { OKLCH, RGB, oklchToRgb, rgbToOklch } from './oklch-rgb.js';
3
+ export { isValidHex, isValidOKLCH, isValidRGB } from './validation.js';
@@ -0,0 +1,30 @@
1
+ import "../chunk-BLX3XSA6.js";
2
+ import {
3
+ oklchToRgb,
4
+ rgbToOklch
5
+ } from "../chunk-ACZGS7DG.js";
6
+ import {
7
+ isValidHex,
8
+ isValidOKLCH,
9
+ isValidRGB
10
+ } from "../chunk-S7U3LZNS.js";
11
+ import {
12
+ hexToRgb,
13
+ rgbToHex
14
+ } from "../chunk-KFLH3AZ6.js";
15
+ import "../chunk-U5LQ2AS5.js";
16
+ import "../chunk-QQVSG76Z.js";
17
+ import "../chunk-Y4GYGFIT.js";
18
+ import "../chunk-BT47ISVC.js";
19
+ import "../chunk-KKFGUHFR.js";
20
+ import "../chunk-6G7GFZV2.js";
21
+ import "../chunk-PD6VHMH6.js";
22
+ export {
23
+ hexToRgb,
24
+ isValidHex,
25
+ isValidOKLCH,
26
+ isValidRGB,
27
+ oklchToRgb,
28
+ rgbToHex,
29
+ rgbToOklch
30
+ };
@@ -0,0 +1,49 @@
1
+ interface RGB {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ }
6
+ interface OKLCH {
7
+ l: number;
8
+ c: number;
9
+ h: number;
10
+ }
11
+ /**
12
+ * Converts OKLCH color to RGB color space.
13
+ *
14
+ * OKLCH is a perceptually uniform color space based on OKLab.
15
+ * Input values are automatically clamped to valid ranges.
16
+ *
17
+ * @param oklch - The OKLCH color to convert
18
+ * @param oklch.l - Lightness (0-1, will be clamped)
19
+ * @param oklch.c - Chroma (≥0, will be clamped)
20
+ * @param oklch.h - Hue in degrees (will be normalized to 0-360)
21
+ * @returns RGB color with values 0-255
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const rgb = oklchToRgb({ l: 0.7, c: 0.1, h: 200 });
26
+ * // => { r: 64, g: 177, b: 183 }
27
+ * ```
28
+ */
29
+ declare function oklchToRgb(oklch: OKLCH): RGB;
30
+ /**
31
+ * Converts RGB color to OKLCH color space.
32
+ *
33
+ * RGB values are automatically clamped to 0-255 range.
34
+ *
35
+ * @param rgb - The RGB color to convert
36
+ * @param rgb.r - Red component (0-255, will be clamped)
37
+ * @param rgb.g - Green component (0-255, will be clamped)
38
+ * @param rgb.b - Blue component (0-255, will be clamped)
39
+ * @returns OKLCH color with l∈[0,1], c≥0, h∈[0,360)
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const oklch = rgbToOklch({ r: 64, g: 177, b: 183 });
44
+ * // => { l: 0.7, c: 0.1, h: 200 }
45
+ * ```
46
+ */
47
+ declare function rgbToOklch(rgb: RGB): OKLCH;
48
+
49
+ export { type OKLCH, type RGB, oklchToRgb, rgbToOklch };
@@ -0,0 +1,15 @@
1
+ import {
2
+ oklchToRgb,
3
+ rgbToOklch
4
+ } from "../chunk-ACZGS7DG.js";
5
+ import "../chunk-U5LQ2AS5.js";
6
+ import "../chunk-QQVSG76Z.js";
7
+ import "../chunk-Y4GYGFIT.js";
8
+ import "../chunk-BT47ISVC.js";
9
+ import "../chunk-KKFGUHFR.js";
10
+ import "../chunk-6G7GFZV2.js";
11
+ import "../chunk-PD6VHMH6.js";
12
+ export {
13
+ oklchToRgb,
14
+ rgbToOklch
15
+ };
@@ -0,0 +1,26 @@
1
+ import { RGB, OKLCH } from './oklch-rgb.js';
2
+
3
+ /**
4
+ * Checks if RGB values are in valid range (0-255)
5
+ */
6
+ declare function isValidRGB(rgb: RGB): boolean;
7
+ /**
8
+ * Checks if OKLCH values are in valid ranges
9
+ */
10
+ declare function isValidOKLCH(oklch: OKLCH): boolean;
11
+ /**
12
+ * Checks if a string is a valid hex color format.
13
+ *
14
+ * @param hex - String to validate
15
+ * @returns `true` if the string is a valid hex color, `false` otherwise
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * isValidHex("#ffcc00") // => true
20
+ * isValidHex("fc0") // => true
21
+ * isValidHex("#invalid") // => false
22
+ * ```
23
+ */
24
+ declare function isValidHex(hex: string): boolean;
25
+
26
+ export { isValidHex, isValidOKLCH, isValidRGB };
@@ -0,0 +1,18 @@
1
+ import {
2
+ isValidHex,
3
+ isValidOKLCH,
4
+ isValidRGB
5
+ } from "../chunk-S7U3LZNS.js";
6
+ import "../chunk-KFLH3AZ6.js";
7
+ import "../chunk-U5LQ2AS5.js";
8
+ import "../chunk-QQVSG76Z.js";
9
+ import "../chunk-Y4GYGFIT.js";
10
+ import "../chunk-BT47ISVC.js";
11
+ import "../chunk-KKFGUHFR.js";
12
+ import "../chunk-6G7GFZV2.js";
13
+ import "../chunk-PD6VHMH6.js";
14
+ export {
15
+ isValidHex,
16
+ isValidOKLCH,
17
+ isValidRGB
18
+ };
package/dist/dom/css.d.ts CHANGED
@@ -13,5 +13,6 @@ import { JSX } from 'solid-js/jsx-runtime';
13
13
  declare function mountStyle(style: string, id: string, refresh?: boolean): void;
14
14
  declare function stringStyleToObject(style: string): JSX.CSSProperties;
15
15
  declare function combineStyle(a: JSX.CSSProperties, b: JSX.CSSProperties | string | undefined): JSX.CSSProperties | string;
16
+ declare function combineClass(defaultClass: string, ...otherClass: string[]): string;
16
17
 
17
- export { combineStyle, mountStyle, stringStyleToObject };
18
+ export { combineClass, combineStyle, mountStyle, stringStyleToObject };
package/dist/dom/css.js CHANGED
@@ -1,15 +1,18 @@
1
1
  import {
2
+ combineClass,
2
3
  combineStyle,
3
4
  mountStyle,
4
5
  stringStyleToObject
5
- } from "../chunk-DKZ3RJJI.js";
6
- import "../chunk-MEZ7CXEG.js";
6
+ } from "../chunk-KM4Q6THD.js";
7
+ import "../chunk-U5LQ2AS5.js";
7
8
  import "../chunk-QQVSG76Z.js";
8
9
  import "../chunk-Y4GYGFIT.js";
9
10
  import "../chunk-BT47ISVC.js";
10
- import "../chunk-6G7GFZV2.js";
11
11
  import "../chunk-KKFGUHFR.js";
12
+ import "../chunk-6G7GFZV2.js";
13
+ import "../chunk-PD6VHMH6.js";
12
14
  export {
15
+ combineClass,
13
16
  combineStyle,
14
17
  mountStyle,
15
18
  stringStyleToObject
@@ -1,2 +1,2 @@
1
- export { combineStyle, mountStyle, stringStyleToObject } from './css.js';
1
+ export { combineClass, combineStyle, mountStyle, stringStyleToObject } from './css.js';
2
2
  import 'solid-js/jsx-runtime';
package/dist/dom/index.js CHANGED
@@ -1,16 +1,19 @@
1
1
  import "../chunk-FFBJP5FE.js";
2
2
  import {
3
+ combineClass,
3
4
  combineStyle,
4
5
  mountStyle,
5
6
  stringStyleToObject
6
- } from "../chunk-DKZ3RJJI.js";
7
- import "../chunk-MEZ7CXEG.js";
7
+ } from "../chunk-KM4Q6THD.js";
8
+ import "../chunk-U5LQ2AS5.js";
8
9
  import "../chunk-QQVSG76Z.js";
9
10
  import "../chunk-Y4GYGFIT.js";
10
11
  import "../chunk-BT47ISVC.js";
11
- import "../chunk-6G7GFZV2.js";
12
12
  import "../chunk-KKFGUHFR.js";
13
+ import "../chunk-6G7GFZV2.js";
14
+ import "../chunk-PD6VHMH6.js";
13
15
  export {
16
+ combineClass,
14
17
  combineStyle,
15
18
  mountStyle,
16
19
  stringStyleToObject
@@ -1,16 +1,17 @@
1
1
  import {
2
2
  createClickOutside
3
- } from "../chunk-DV7LISIY.js";
4
- import "../chunk-IQGRRDJZ.js";
5
- import "../chunk-D3JAYNG6.js";
6
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-WJHRONQU.js";
4
+ import "../chunk-TGWWPUWD.js";
5
+ import "../chunk-QPEF6LHH.js";
7
6
  import "../chunk-YK5QQQ43.js";
8
- import "../chunk-MEZ7CXEG.js";
7
+ import "../chunk-4L6FK7MF.js";
8
+ import "../chunk-U5LQ2AS5.js";
9
9
  import "../chunk-QQVSG76Z.js";
10
10
  import "../chunk-Y4GYGFIT.js";
11
11
  import "../chunk-BT47ISVC.js";
12
- import "../chunk-6G7GFZV2.js";
13
12
  import "../chunk-KKFGUHFR.js";
13
+ import "../chunk-6G7GFZV2.js";
14
+ import "../chunk-PD6VHMH6.js";
14
15
  export {
15
16
  createClickOutside
16
17
  };
@@ -1,16 +1,17 @@
1
1
  import {
2
2
  createEventListener
3
- } from "../chunk-AKFEDWEF.js";
4
- import "../chunk-IQGRRDJZ.js";
5
- import "../chunk-D3JAYNG6.js";
6
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-6OVLJ45M.js";
4
+ import "../chunk-TGWWPUWD.js";
5
+ import "../chunk-QPEF6LHH.js";
7
6
  import "../chunk-YK5QQQ43.js";
8
- import "../chunk-MEZ7CXEG.js";
7
+ import "../chunk-4L6FK7MF.js";
8
+ import "../chunk-U5LQ2AS5.js";
9
9
  import "../chunk-QQVSG76Z.js";
10
10
  import "../chunk-Y4GYGFIT.js";
11
11
  import "../chunk-BT47ISVC.js";
12
- import "../chunk-6G7GFZV2.js";
13
12
  import "../chunk-KKFGUHFR.js";
13
+ import "../chunk-6G7GFZV2.js";
14
+ import "../chunk-PD6VHMH6.js";
14
15
  export {
15
16
  createEventListener
16
17
  };
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  createIntersectionObserver
3
- } from "../chunk-GHJDTAVH.js";
4
- import "../chunk-D3JAYNG6.js";
5
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-LEWF7QAQ.js";
4
+ import "../chunk-QPEF6LHH.js";
6
5
  import "../chunk-YK5QQQ43.js";
7
- import "../chunk-MEZ7CXEG.js";
6
+ import "../chunk-4L6FK7MF.js";
7
+ import "../chunk-U5LQ2AS5.js";
8
8
  import "../chunk-QQVSG76Z.js";
9
9
  import "../chunk-Y4GYGFIT.js";
10
10
  import "../chunk-BT47ISVC.js";
11
- import "../chunk-6G7GFZV2.js";
12
11
  import "../chunk-KKFGUHFR.js";
12
+ import "../chunk-6G7GFZV2.js";
13
+ import "../chunk-PD6VHMH6.js";
13
14
  export {
14
15
  createIntersectionObserver
15
16
  };
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  createVisibilityObserver
3
- } from "../chunk-WWEM5VJO.js";
4
- import "../chunk-D3JAYNG6.js";
5
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-TDJLPDJF.js";
4
+ import "../chunk-QPEF6LHH.js";
6
5
  import "../chunk-YK5QQQ43.js";
7
- import "../chunk-MEZ7CXEG.js";
6
+ import "../chunk-4L6FK7MF.js";
7
+ import "../chunk-U5LQ2AS5.js";
8
8
  import "../chunk-QQVSG76Z.js";
9
9
  import "../chunk-Y4GYGFIT.js";
10
10
  import "../chunk-BT47ISVC.js";
11
- import "../chunk-6G7GFZV2.js";
12
11
  import "../chunk-KKFGUHFR.js";
12
+ import "../chunk-6G7GFZV2.js";
13
+ import "../chunk-PD6VHMH6.js";
13
14
  export {
14
15
  createVisibilityObserver
15
16
  };
@@ -1,28 +1,29 @@
1
1
  import "../chunk-LUFOWTRW.js";
2
- import {
3
- createClickOutside
4
- } from "../chunk-DV7LISIY.js";
5
2
  import {
6
3
  createEventListener
7
- } from "../chunk-AKFEDWEF.js";
8
- import {
9
- makeEventListener
10
- } from "../chunk-IQGRRDJZ.js";
4
+ } from "../chunk-6OVLJ45M.js";
11
5
  import {
12
6
  createIntersectionObserver
13
- } from "../chunk-GHJDTAVH.js";
7
+ } from "../chunk-LEWF7QAQ.js";
14
8
  import {
15
9
  createVisibilityObserver
16
- } from "../chunk-WWEM5VJO.js";
17
- import "../chunk-D3JAYNG6.js";
18
- import "../chunk-4L6FK7MF.js";
10
+ } from "../chunk-TDJLPDJF.js";
11
+ import {
12
+ createClickOutside
13
+ } from "../chunk-WJHRONQU.js";
14
+ import {
15
+ makeEventListener
16
+ } from "../chunk-TGWWPUWD.js";
17
+ import "../chunk-QPEF6LHH.js";
19
18
  import "../chunk-YK5QQQ43.js";
20
- import "../chunk-MEZ7CXEG.js";
19
+ import "../chunk-4L6FK7MF.js";
20
+ import "../chunk-U5LQ2AS5.js";
21
21
  import "../chunk-QQVSG76Z.js";
22
22
  import "../chunk-Y4GYGFIT.js";
23
23
  import "../chunk-BT47ISVC.js";
24
- import "../chunk-6G7GFZV2.js";
25
24
  import "../chunk-KKFGUHFR.js";
25
+ import "../chunk-6G7GFZV2.js";
26
+ import "../chunk-PD6VHMH6.js";
26
27
  export {
27
28
  createClickOutside,
28
29
  createEventListener,
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  makeEventListener
3
- } from "../chunk-IQGRRDJZ.js";
4
- import "../chunk-D3JAYNG6.js";
5
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-TGWWPUWD.js";
4
+ import "../chunk-QPEF6LHH.js";
6
5
  import "../chunk-YK5QQQ43.js";
7
- import "../chunk-MEZ7CXEG.js";
6
+ import "../chunk-4L6FK7MF.js";
7
+ import "../chunk-U5LQ2AS5.js";
8
8
  import "../chunk-QQVSG76Z.js";
9
9
  import "../chunk-Y4GYGFIT.js";
10
10
  import "../chunk-BT47ISVC.js";
11
- import "../chunk-6G7GFZV2.js";
12
11
  import "../chunk-KKFGUHFR.js";
12
+ import "../chunk-6G7GFZV2.js";
13
+ import "../chunk-PD6VHMH6.js";
13
14
  export {
14
15
  makeEventListener
15
16
  };
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  createDebounce
3
- } from "../chunk-D3JAYNG6.js";
4
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-QPEF6LHH.js";
5
4
  import "../chunk-YK5QQQ43.js";
6
- import "../chunk-MEZ7CXEG.js";
5
+ import "../chunk-4L6FK7MF.js";
6
+ import "../chunk-U5LQ2AS5.js";
7
7
  import "../chunk-QQVSG76Z.js";
8
8
  import "../chunk-Y4GYGFIT.js";
9
9
  import "../chunk-BT47ISVC.js";
10
- import "../chunk-6G7GFZV2.js";
11
10
  import "../chunk-KKFGUHFR.js";
11
+ import "../chunk-6G7GFZV2.js";
12
+ import "../chunk-PD6VHMH6.js";
12
13
  export {
13
14
  createDebounce
14
15
  };
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  createLoopExec
3
- } from "../chunk-D3JAYNG6.js";
4
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-QPEF6LHH.js";
5
4
  import "../chunk-YK5QQQ43.js";
6
- import "../chunk-MEZ7CXEG.js";
5
+ import "../chunk-4L6FK7MF.js";
6
+ import "../chunk-U5LQ2AS5.js";
7
7
  import "../chunk-QQVSG76Z.js";
8
8
  import "../chunk-Y4GYGFIT.js";
9
9
  import "../chunk-BT47ISVC.js";
10
- import "../chunk-6G7GFZV2.js";
11
10
  import "../chunk-KKFGUHFR.js";
11
+ import "../chunk-6G7GFZV2.js";
12
+ import "../chunk-PD6VHMH6.js";
12
13
  export {
13
14
  createLoopExec
14
15
  };
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  createThrottle
3
- } from "../chunk-D3JAYNG6.js";
4
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-QPEF6LHH.js";
5
4
  import "../chunk-YK5QQQ43.js";
6
- import "../chunk-MEZ7CXEG.js";
5
+ import "../chunk-4L6FK7MF.js";
6
+ import "../chunk-U5LQ2AS5.js";
7
7
  import "../chunk-QQVSG76Z.js";
8
8
  import "../chunk-Y4GYGFIT.js";
9
9
  import "../chunk-BT47ISVC.js";
10
- import "../chunk-6G7GFZV2.js";
11
10
  import "../chunk-KKFGUHFR.js";
11
+ import "../chunk-6G7GFZV2.js";
12
+ import "../chunk-PD6VHMH6.js";
12
13
  export {
13
14
  createThrottle
14
15
  };
package/dist/fn/index.js CHANGED
@@ -3,15 +3,16 @@ import {
3
3
  createLoopExec,
4
4
  createThrottle,
5
5
  noop
6
- } from "../chunk-D3JAYNG6.js";
7
- import "../chunk-4L6FK7MF.js";
6
+ } from "../chunk-QPEF6LHH.js";
8
7
  import "../chunk-YK5QQQ43.js";
9
- import "../chunk-MEZ7CXEG.js";
8
+ import "../chunk-4L6FK7MF.js";
9
+ import "../chunk-U5LQ2AS5.js";
10
10
  import "../chunk-QQVSG76Z.js";
11
11
  import "../chunk-Y4GYGFIT.js";
12
12
  import "../chunk-BT47ISVC.js";
13
- import "../chunk-6G7GFZV2.js";
14
13
  import "../chunk-KKFGUHFR.js";
14
+ import "../chunk-6G7GFZV2.js";
15
+ import "../chunk-PD6VHMH6.js";
15
16
  export {
16
17
  createDebounce,
17
18
  createLoopExec,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- export { combineStyle, mountStyle, stringStyleToObject } from './dom/css.js';
1
+ export { hexToRgb, rgbToHex } from './color/hex-rgb.js';
2
+ export { OKLCH, RGB, oklchToRgb, rgbToOklch } from './color/oklch-rgb.js';
3
+ export { isValidHex, isValidOKLCH, isValidRGB } from './color/validation.js';
4
+ export { combineClass, combineStyle, mountStyle, stringStyleToObject } from './dom/css.js';
2
5
  export { createClickOutside } from './event/create-click-outside.js';
3
6
  export { createEventListener } from './event/create-event-listener.js';
4
7
  export { createIntersectionObserver } from './event/create-intersection-observer.js';
@@ -14,6 +17,7 @@ export { MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise } from '
14
17
  export { clearArray, iterate, list, range } from './utils/array.js';
15
18
  export { sleep } from './utils/async.js';
16
19
  export { isArray, isClient, isDate, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol } from './utils/is.js';
20
+ export { clamp, inRange, max, min, toHex } from './utils/number.js';
17
21
  export { draw, random, shuffle, uid } from './utils/random.js';
18
22
  export { camel, capitalize, dash, pascal, snake, template, title, trim } from './utils/str.js';
19
23
  export { createDebounce } from './fn/create-debounce.js';
package/dist/index.js CHANGED
@@ -1,46 +1,61 @@
1
1
  import "./chunk-SK6Y2YH6.js";
2
- import "./chunk-AZAXMGEB.js";
3
2
  import "./chunk-EZML2DEC.js";
4
3
  import "./chunk-YXRZ2KMJ.js";
5
4
  import {
6
5
  dataIf
7
6
  } from "./chunk-II6INKPZ.js";
7
+ import "./chunk-AZAXMGEB.js";
8
+ import "./chunk-LUFOWTRW.js";
9
+ import {
10
+ createEventListener
11
+ } from "./chunk-6OVLJ45M.js";
12
+ import {
13
+ createIntersectionObserver
14
+ } from "./chunk-LEWF7QAQ.js";
15
+ import {
16
+ createVisibilityObserver
17
+ } from "./chunk-TDJLPDJF.js";
18
+ import "./chunk-BLX3XSA6.js";
19
+ import {
20
+ oklchToRgb,
21
+ rgbToOklch
22
+ } from "./chunk-ACZGS7DG.js";
23
+ import {
24
+ isValidHex,
25
+ isValidOKLCH,
26
+ isValidRGB
27
+ } from "./chunk-S7U3LZNS.js";
28
+ import {
29
+ hexToRgb,
30
+ rgbToHex
31
+ } from "./chunk-KFLH3AZ6.js";
8
32
  import "./chunk-FFBJP5FE.js";
9
33
  import {
34
+ combineClass,
10
35
  combineStyle,
11
36
  mountStyle,
12
37
  stringStyleToObject
13
- } from "./chunk-DKZ3RJJI.js";
14
- import "./chunk-LUFOWTRW.js";
38
+ } from "./chunk-KM4Q6THD.js";
15
39
  import {
16
40
  createClickOutside
17
- } from "./chunk-DV7LISIY.js";
18
- import {
19
- createEventListener
20
- } from "./chunk-AKFEDWEF.js";
41
+ } from "./chunk-WJHRONQU.js";
21
42
  import {
22
43
  makeEventListener
23
- } from "./chunk-IQGRRDJZ.js";
24
- import {
25
- createIntersectionObserver
26
- } from "./chunk-GHJDTAVH.js";
27
- import {
28
- createVisibilityObserver
29
- } from "./chunk-WWEM5VJO.js";
44
+ } from "./chunk-TGWWPUWD.js";
30
45
  import {
31
46
  createDebounce,
32
47
  createDebouncedWatch,
33
48
  createLoopExec,
34
49
  createThrottle,
35
50
  noop
36
- } from "./chunk-D3JAYNG6.js";
37
- import {
38
- createWatch
39
- } from "./chunk-4L6FK7MF.js";
51
+ } from "./chunk-QPEF6LHH.js";
40
52
  import {
41
53
  access
42
54
  } from "./chunk-YK5QQQ43.js";
43
- import "./chunk-MEZ7CXEG.js";
55
+ import {
56
+ createWatch
57
+ } from "./chunk-4L6FK7MF.js";
58
+ import "./chunk-U5LQ2AS5.js";
44
59
  import {
45
60
  draw,
46
61
  random,
@@ -63,6 +78,9 @@ import {
63
78
  list,
64
79
  range
65
80
  } from "./chunk-BT47ISVC.js";
81
+ import {
82
+ sleep
83
+ } from "./chunk-KKFGUHFR.js";
66
84
  import {
67
85
  isArray,
68
86
  isClient,
@@ -79,13 +97,19 @@ import {
79
97
  isSymbol
80
98
  } from "./chunk-6G7GFZV2.js";
81
99
  import {
82
- sleep
83
- } from "./chunk-KKFGUHFR.js";
100
+ clamp,
101
+ inRange,
102
+ max,
103
+ min,
104
+ toHex
105
+ } from "./chunk-PD6VHMH6.js";
84
106
  export {
85
107
  access,
86
108
  camel,
87
109
  capitalize,
110
+ clamp,
88
111
  clearArray,
112
+ combineClass,
89
113
  combineStyle,
90
114
  createClickOutside,
91
115
  createDebounce,
@@ -99,6 +123,8 @@ export {
99
123
  dash,
100
124
  dataIf,
101
125
  draw,
126
+ hexToRgb,
127
+ inRange,
102
128
  isArray,
103
129
  isClient,
104
130
  isDate,
@@ -112,20 +138,29 @@ export {
112
138
  isPromise,
113
139
  isString,
114
140
  isSymbol,
141
+ isValidHex,
142
+ isValidOKLCH,
143
+ isValidRGB,
115
144
  iterate,
116
145
  list,
117
146
  makeEventListener,
147
+ max,
148
+ min,
118
149
  mountStyle,
119
150
  noop,
151
+ oklchToRgb,
120
152
  pascal,
121
153
  random,
122
154
  range,
155
+ rgbToHex,
156
+ rgbToOklch,
123
157
  shuffle,
124
158
  sleep,
125
159
  snake,
126
160
  stringStyleToObject,
127
161
  template,
128
162
  title,
163
+ toHex,
129
164
  trim,
130
165
  uid
131
166
  };
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  access
3
3
  } from "../chunk-YK5QQQ43.js";
4
- import "../chunk-MEZ7CXEG.js";
4
+ import "../chunk-U5LQ2AS5.js";
5
5
  import "../chunk-QQVSG76Z.js";
6
6
  import "../chunk-Y4GYGFIT.js";
7
7
  import "../chunk-BT47ISVC.js";
8
- import "../chunk-6G7GFZV2.js";
9
8
  import "../chunk-KKFGUHFR.js";
9
+ import "../chunk-6G7GFZV2.js";
10
+ import "../chunk-PD6VHMH6.js";
10
11
  export {
11
12
  access
12
13
  };
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  createDebouncedWatch
3
- } from "../chunk-D3JAYNG6.js";
4
- import "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-QPEF6LHH.js";
5
4
  import "../chunk-YK5QQQ43.js";
6
- import "../chunk-MEZ7CXEG.js";
5
+ import "../chunk-4L6FK7MF.js";
6
+ import "../chunk-U5LQ2AS5.js";
7
7
  import "../chunk-QQVSG76Z.js";
8
8
  import "../chunk-Y4GYGFIT.js";
9
9
  import "../chunk-BT47ISVC.js";
10
- import "../chunk-6G7GFZV2.js";
11
10
  import "../chunk-KKFGUHFR.js";
11
+ import "../chunk-6G7GFZV2.js";
12
+ import "../chunk-PD6VHMH6.js";
12
13
  export {
13
14
  createDebouncedWatch
14
15
  };
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  createDebouncedWatch
3
- } from "../chunk-D3JAYNG6.js";
4
- import {
5
- createWatch
6
- } from "../chunk-4L6FK7MF.js";
3
+ } from "../chunk-QPEF6LHH.js";
7
4
  import {
8
5
  access
9
6
  } from "../chunk-YK5QQQ43.js";
10
- import "../chunk-MEZ7CXEG.js";
7
+ import {
8
+ createWatch
9
+ } from "../chunk-4L6FK7MF.js";
10
+ import "../chunk-U5LQ2AS5.js";
11
11
  import "../chunk-QQVSG76Z.js";
12
12
  import "../chunk-Y4GYGFIT.js";
13
13
  import "../chunk-BT47ISVC.js";
14
- import "../chunk-6G7GFZV2.js";
15
14
  import "../chunk-KKFGUHFR.js";
15
+ import "../chunk-6G7GFZV2.js";
16
+ import "../chunk-PD6VHMH6.js";
16
17
  export {
17
18
  access,
18
19
  createDebouncedWatch,
@@ -1,3 +1,3 @@
1
1
  import "../chunk-SK6Y2YH6.js";
2
- import "../chunk-AZAXMGEB.js";
3
2
  import "../chunk-EZML2DEC.js";
3
+ import "../chunk-AZAXMGEB.js";
@@ -1,5 +1,6 @@
1
1
  export { clearArray, iterate, list, range } from './array.js';
2
2
  export { sleep } from './async.js';
3
3
  export { isArray, isClient, isDate, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol } from './is.js';
4
+ export { clamp, inRange, max, min, toHex } from './number.js';
4
5
  export { draw, random, shuffle, uid } from './random.js';
5
6
  export { camel, capitalize, dash, pascal, snake, template, title, trim } from './str.js';
@@ -1,4 +1,4 @@
1
- import "../chunk-MEZ7CXEG.js";
1
+ import "../chunk-U5LQ2AS5.js";
2
2
  import {
3
3
  draw,
4
4
  random,
@@ -21,6 +21,9 @@ import {
21
21
  list,
22
22
  range
23
23
  } from "../chunk-BT47ISVC.js";
24
+ import {
25
+ sleep
26
+ } from "../chunk-KKFGUHFR.js";
24
27
  import {
25
28
  isArray,
26
29
  isClient,
@@ -37,14 +40,20 @@ import {
37
40
  isSymbol
38
41
  } from "../chunk-6G7GFZV2.js";
39
42
  import {
40
- sleep
41
- } from "../chunk-KKFGUHFR.js";
43
+ clamp,
44
+ inRange,
45
+ max,
46
+ min,
47
+ toHex
48
+ } from "../chunk-PD6VHMH6.js";
42
49
  export {
43
50
  camel,
44
51
  capitalize,
52
+ clamp,
45
53
  clearArray,
46
54
  dash,
47
55
  draw,
56
+ inRange,
48
57
  isArray,
49
58
  isClient,
50
59
  isDate,
@@ -60,6 +69,8 @@ export {
60
69
  isSymbol,
61
70
  iterate,
62
71
  list,
72
+ max,
73
+ min,
63
74
  pascal,
64
75
  random,
65
76
  range,
@@ -68,6 +79,7 @@ export {
68
79
  snake,
69
80
  template,
70
81
  title,
82
+ toHex,
71
83
  trim,
72
84
  uid
73
85
  };
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Returns the smallest of the given numbers.
3
+ *
4
+ * This is a convenience wrapper around `Math.min` that provides better type safety
5
+ * and consistency with other utility functions.
6
+ *
7
+ * @param numbers - The numbers to compare
8
+ * @returns The smallest number from the input
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * min(1, 2, 3) // => 1
13
+ * min(-5, 0, 10) // => -5
14
+ * min(3.14, 2.71, 1.41) // => 1.41
15
+ * ```
16
+ */
17
+ declare function min(...numbers: number[]): number;
18
+ /**
19
+ * Returns the largest of the given numbers.
20
+ *
21
+ * This is a convenience wrapper around `Math.max` that provides better type safety
22
+ * and consistency with other utility functions.
23
+ *
24
+ * @param numbers - The numbers to compare
25
+ * @returns The largest number from the input
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * max(1, 2, 3) // => 3
30
+ * max(-5, 0, 10) // => 10
31
+ * max(3.14, 2.71, 1.41) // => 3.14
32
+ * ```
33
+ */
34
+ declare function max(...numbers: number[]): number;
35
+ /**
36
+ * Clamps a number to within the specified bounds.
37
+ *
38
+ * If the number is less than the minimum, returns the minimum.
39
+ * If the number is greater than the maximum, returns the maximum.
40
+ * Otherwise, returns the number unchanged.
41
+ *
42
+ * @param x - The number to clamp
43
+ * @param minimum - The lower bound (inclusive)
44
+ * @param maximum - The upper bound (inclusive)
45
+ * @returns The clamped number
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * clamp(0.5) // => 0.5 (within default 0-1 range)
50
+ * clamp(-0.1) // => 0 (clamped to minimum)
51
+ * clamp(1.5) // => 1 (clamped to maximum)
52
+ * clamp(15, 10, 20) // => 15 (within range)
53
+ * clamp(5, 10, 20) // => 10 (clamped to minimum)
54
+ * clamp(25, 10, 20) // => 20 (clamped to maximum)
55
+ * ```
56
+ */
57
+ declare function clamp(x: number, minimum?: number, maximum?: number): number;
58
+ /**
59
+ * Checks if a number is within a specified range.
60
+ *
61
+ * Supports different inclusivity modes:
62
+ * - `'[]'` - Both bounds inclusive (default): `minimum ≤ x ≤ maximum`
63
+ * - `'()'` - Both bounds exclusive: `minimum < x < maximum`
64
+ * - `'[)'` - Lower inclusive, upper exclusive: `minimum ≤ x < maximum`
65
+ * - `'(]'` - Lower exclusive, upper inclusive: `minimum < x ≤ maximum`
66
+ *
67
+ * @param x - The number to check
68
+ * @param minimum - The lower bound of the range
69
+ * @param maximum - The upper bound of the range
70
+ * @param inclusivity - Specifies whether the bounds are inclusive or exclusive
71
+ * @returns `true` if the number is within the range, `false` otherwise
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * // Default inclusive range [0, 1]
76
+ * inRange(0.5) // => true
77
+ * inRange(0) // => true (inclusive)
78
+ * inRange(1) // => true (inclusive)
79
+ * inRange(-0.1) // => false
80
+ * inRange(1.1) // => false
81
+ *
82
+ * // Custom range [10, 20]
83
+ * inRange(15, 10, 20) // => true
84
+ * inRange(10, 10, 20) // => true (inclusive)
85
+ * inRange(20, 10, 20) // => true (inclusive)
86
+ *
87
+ * // Exclusive bounds (10, 20)
88
+ * inRange(15, 10, 20, '()') // => true
89
+ * inRange(10, 10, 20, '()') // => false (exclusive)
90
+ * inRange(20, 10, 20, '()') // => false (exclusive)
91
+ *
92
+ * // Mixed inclusivity [10, 20)
93
+ * inRange(10, 10, 20, '[)') // => true (lower inclusive)
94
+ * inRange(20, 10, 20, '[)') // => false (upper exclusive)
95
+ * ```
96
+ */
97
+ declare function inRange(x: number, minimum?: number, maximum?: number, inclusivity?: "()" | "[]" | "[)" | "(]"): boolean;
98
+ /**
99
+ * Converts a number to a hexadecimal string.
100
+ *
101
+ * @param x - The number to convert
102
+ * @param pad - The number of digits to pad the output with (default: 2)
103
+ * @returns The hexadecimal representation of the number
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * toHEX(255) // => "ff"
108
+ * toHEX(255, 4) // => "00ff"
109
+ * ```
110
+ */
111
+ declare function toHex(x: number, pad?: number): string;
112
+
113
+ export { clamp, inRange, max, min, toHex };
@@ -0,0 +1,14 @@
1
+ import {
2
+ clamp,
3
+ inRange,
4
+ max,
5
+ min,
6
+ toHex
7
+ } from "../chunk-PD6VHMH6.js";
8
+ export {
9
+ clamp,
10
+ inRange,
11
+ max,
12
+ min,
13
+ toHex
14
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-tiny-utils",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "A collection of tiny utilities for SolidJS applications",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -12,19 +12,21 @@
12
12
  "solid-js": "^1.9.7"
13
13
  },
14
14
  "devDependencies": {
15
- "@biomejs/biome": "2.2.0",
15
+ "@biomejs/biome": "2.2.2",
16
16
  "@solidjs/router": "^0.15.3",
17
17
  "@solidjs/testing-library": "^0.8.10",
18
18
  "@testing-library/jest-dom": "^6.6.4",
19
19
  "@testing-library/user-event": "^14.6.1",
20
+ "@types/culori": "^4.0.0",
20
21
  "@types/node": "^24.2.1",
21
22
  "@vitest/ui": "^3.2.4",
22
- "commit-and-tag-version": "^12.5.1",
23
+ "bumpp": "^10.2.3",
24
+ "culori": "^4.0.2",
23
25
  "husky": "^9.1.7",
24
26
  "jsdom": "^26.1.0",
25
27
  "tsup": "^8.5.0",
26
28
  "typescript": "^5.8.3",
27
- "ultracite": "5.2.2",
29
+ "ultracite": "5.3.3",
28
30
  "unocss": "^66.3.3",
29
31
  "vite": "^6.2.1",
30
32
  "vite-plugin-solid": "^2.11.0",
@@ -42,20 +44,18 @@
42
44
  "author": "",
43
45
  "license": "MIT",
44
46
  "dependencies": {
45
- "solid-tiny-context": "0.1.2"
47
+ "solid-tiny-context": "0.2.3"
46
48
  },
47
49
  "scripts": {
48
50
  "build": "tsup",
49
51
  "dev": "vite -c ./playground/vite.config.ts",
50
- "test": "vitest",
52
+ "test": "vitest --run",
51
53
  "clean": "rimraf dist node_modules pnpm-lock.yaml",
52
- "test:run": "vitest --run",
53
54
  "test:ui": "vitest --ui",
54
- "test:coverage": "vitest --coverage",
55
- "lint": "npx ultracite lint",
56
- "lint:fix": "npx ultracite format",
55
+ "lint": "pnpm dlx ultracite check",
56
+ "lint:fix": "pnpm dlx ultracite fix",
57
57
  "type-check": "tsc --noEmit --skipLibCheck",
58
- "release": "pnpm type-check && pnpm lint:fix && pnpm test:run && commit-and-tag-version -i CHANGELOG.md --same-file",
59
- "pub": "pnpm build && pnpm publish"
58
+ "bump": "pnpm type-check && pnpm lint:fix && pnpm test && pnpm bumpp --no-push",
59
+ "prepublish": "pnpm build"
60
60
  }
61
61
  }
File without changes
@@ -1,9 +1,9 @@
1
- import {
2
- createWatch
3
- } from "./chunk-4L6FK7MF.js";
4
1
  import {
5
2
  access
6
3
  } from "./chunk-YK5QQQ43.js";
4
+ import {
5
+ createWatch
6
+ } from "./chunk-4L6FK7MF.js";
7
7
  import {
8
8
  isNumber
9
9
  } from "./chunk-6G7GFZV2.js";
@@ -1,9 +1,9 @@
1
- import {
2
- createWatch
3
- } from "./chunk-4L6FK7MF.js";
4
1
  import {
5
2
  access
6
3
  } from "./chunk-YK5QQQ43.js";
4
+ import {
5
+ createWatch
6
+ } from "./chunk-4L6FK7MF.js";
7
7
  import {
8
8
  isObject
9
9
  } from "./chunk-6G7GFZV2.js";