@zag-js/color-utils 1.47.0 → 1.48.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 (50) hide show
  1. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.js +11 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs +11 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.mjs +13 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.js +8 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.mjs +8 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.js +15 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.mjs +10 -0
  9. package/dist/area-gradient.d.mts +9 -11
  10. package/dist/area-gradient.d.ts +9 -11
  11. package/dist/area-gradient.js +53 -84
  12. package/dist/area-gradient.mjs +49 -71
  13. package/dist/color-format-gradient.d.mts +58 -60
  14. package/dist/color-format-gradient.d.ts +58 -60
  15. package/dist/color-format-gradient.js +93 -154
  16. package/dist/color-format-gradient.mjs +81 -123
  17. package/dist/color.d.mts +20 -23
  18. package/dist/color.d.ts +20 -23
  19. package/dist/color.js +57 -83
  20. package/dist/color.mjs +53 -60
  21. package/dist/hsb-color.d.mts +32 -35
  22. package/dist/hsb-color.d.ts +32 -35
  23. package/dist/hsb-color.js +135 -163
  24. package/dist/hsb-color.mjs +129 -138
  25. package/dist/hsl-color.d.mts +33 -36
  26. package/dist/hsl-color.d.ts +33 -36
  27. package/dist/hsl-color.js +137 -165
  28. package/dist/hsl-color.mjs +130 -139
  29. package/dist/index.d.mts +5 -4
  30. package/dist/index.d.ts +5 -4
  31. package/dist/index.js +10 -37
  32. package/dist/index.mjs +1 -9
  33. package/dist/native-color.d.mts +1 -3
  34. package/dist/native-color.d.ts +1 -3
  35. package/dist/native-color.js +16 -39
  36. package/dist/native-color.mjs +12 -16
  37. package/dist/parse-color.d.mts +3 -6
  38. package/dist/parse-color.d.ts +3 -6
  39. package/dist/parse-color.js +21 -47
  40. package/dist/parse-color.mjs +13 -20
  41. package/dist/rgb-color.d.mts +33 -36
  42. package/dist/rgb-color.d.ts +33 -36
  43. package/dist/rgb-color.js +174 -211
  44. package/dist/rgb-color.mjs +168 -186
  45. package/dist/types.d.mts +82 -84
  46. package/dist/types.d.ts +82 -84
  47. package/dist/types.js +4 -18
  48. package/dist/types.mjs +1 -0
  49. package/package.json +4 -4
  50. package/dist/chunk-QZ7TP4HQ.mjs +0 -7
package/dist/types.d.ts CHANGED
@@ -1,87 +1,85 @@
1
- type ColorHexFormat = "hex" | "hexa";
2
- type ColorFormat = "rgba" | "hsla" | "hsba";
3
- type ColorStringFormat = ColorHexFormat | ColorFormat | "rgb" | "hsl" | "hsb" | "css";
4
- type ColorChannel = "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha";
5
- interface Color2DAxes {
6
- xChannel: ColorChannel;
7
- yChannel: ColorChannel;
1
+ export type ColorHexFormat = "hex" | "hexa";
2
+ export type ColorFormat = "rgba" | "hsla" | "hsba";
3
+ export type ColorStringFormat = ColorHexFormat | ColorFormat | "rgb" | "hsl" | "hsb" | "css";
4
+ export type ColorChannel = "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha";
5
+ export interface Color2DAxes {
6
+ xChannel: ColorChannel;
7
+ yChannel: ColorChannel;
8
8
  }
9
- interface ColorAxes extends Color2DAxes {
10
- zChannel: ColorChannel;
9
+ export interface ColorAxes extends Color2DAxes {
10
+ zChannel: ColorChannel;
11
11
  }
12
- interface ColorChannelRange {
13
- /** The minimum value of the color channel. */
14
- minValue: number;
15
- /** The maximum value of the color channel. */
16
- maxValue: number;
17
- /** The step value of the color channel, used when incrementing and decrementing. */
18
- step: number;
19
- /** The page step value of the color channel, used when incrementing and decrementing. */
20
- pageSize: number;
12
+ export interface ColorChannelRange {
13
+ /** The minimum value of the color channel. */
14
+ minValue: number;
15
+ /** The maximum value of the color channel. */
16
+ maxValue: number;
17
+ /** The step value of the color channel, used when incrementing and decrementing. */
18
+ step: number;
19
+ /** The page step value of the color channel, used when incrementing and decrementing. */
20
+ pageSize: number;
21
21
  }
22
- interface ColorType {
23
- /** Converts the color to the given color format, and returns a new Color object. */
24
- toFormat(format: ColorFormat): ColorType;
25
- /** Converts the color to a JSON object. */
26
- toJSON(): Record<string, number>;
27
- /** Converts the color to a string in the given format. Defaults to CSS format. */
28
- toString(format?: ColorStringFormat): string;
29
- /** Converts the color to hex, and returns an integer representation. */
30
- toHexInt(): number;
31
- /**
32
- * Returns the numeric value for a given channel.
33
- * Throws an error if the channel is unsupported in the current color format.
34
- */
35
- getChannelValue(channel: ColorChannel): number;
36
- /**
37
- * Sets the numeric value for a given channel, and returns a new Color object.
38
- * Throws an error if the channel is unsupported in the current color format.
39
- */
40
- withChannelValue(channel: ColorChannel, value: number): ColorType;
41
- /**
42
- * Returns the formatted value for a given channel.
43
- */
44
- formatChannelValue(channel: ColorChannel, locale: string): string;
45
- /**
46
- * Returns the minimum, maximum, and step values for a given channel.
47
- */
48
- getChannelRange(channel: ColorChannel): ColorChannelRange;
49
- /**
50
- * Returns the color space, 'rgb', 'hsb' or 'hsl', for the current color.
51
- */
52
- getFormat(): ColorFormat;
53
- /**
54
- * Returns the color space axes, xChannel, yChannel, zChannel.
55
- */
56
- getColorAxes(xyChannels: Color2DAxes): ColorAxes;
57
- /**
58
- * Returns an array of the color channels within the current color space space.
59
- */
60
- getChannels(): [ColorChannel, ColorChannel, ColorChannel];
61
- /**
62
- * Returns a new Color object with the same values as the current color.
63
- */
64
- clone(): ColorType;
65
- /**
66
- * Whether the color is equal to another color.
67
- */
68
- isEqual(color: ColorType): boolean;
69
- /**
70
- * Increments the color channel by the given step size, and returns a new Color object.
71
- */
72
- incrementChannel(channel: ColorChannel, stepSize: number): ColorType;
73
- /**
74
- * Decrements the color channel by the given step size, and returns a new Color object.
75
- */
76
- decrementChannel(channel: ColorChannel, stepSize: number): ColorType;
77
- /**
78
- * Returns the color channel value as a percentage of the channel range.
79
- */
80
- getChannelValuePercent(channel: ColorChannel, value?: number): number;
81
- /**
82
- * Returns the color channel value for a given percentage of the channel range.
83
- */
84
- getChannelPercentValue(channel: ColorChannel, percent: number): number;
85
- }
86
-
87
- export type { Color2DAxes, ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorHexFormat, ColorStringFormat, ColorType };
22
+ export interface ColorType {
23
+ /** Converts the color to the given color format, and returns a new Color object. */
24
+ toFormat(format: ColorFormat): ColorType;
25
+ /** Converts the color to a JSON object. */
26
+ toJSON(): Record<string, number>;
27
+ /** Converts the color to a string in the given format. Defaults to CSS format. */
28
+ toString(format?: ColorStringFormat): string;
29
+ /** Converts the color to hex, and returns an integer representation. */
30
+ toHexInt(): number;
31
+ /**
32
+ * Returns the numeric value for a given channel.
33
+ * Throws an error if the channel is unsupported in the current color format.
34
+ */
35
+ getChannelValue(channel: ColorChannel): number;
36
+ /**
37
+ * Sets the numeric value for a given channel, and returns a new Color object.
38
+ * Throws an error if the channel is unsupported in the current color format.
39
+ */
40
+ withChannelValue(channel: ColorChannel, value: number): ColorType;
41
+ /**
42
+ * Returns the formatted value for a given channel.
43
+ */
44
+ formatChannelValue(channel: ColorChannel, locale: string): string;
45
+ /**
46
+ * Returns the minimum, maximum, and step values for a given channel.
47
+ */
48
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
49
+ /**
50
+ * Returns the color space, 'rgb', 'hsb' or 'hsl', for the current color.
51
+ */
52
+ getFormat(): ColorFormat;
53
+ /**
54
+ * Returns the color space axes, xChannel, yChannel, zChannel.
55
+ */
56
+ getColorAxes(xyChannels: Color2DAxes): ColorAxes;
57
+ /**
58
+ * Returns an array of the color channels within the current color space space.
59
+ */
60
+ getChannels(): [ColorChannel, ColorChannel, ColorChannel];
61
+ /**
62
+ * Returns a new Color object with the same values as the current color.
63
+ */
64
+ clone(): ColorType;
65
+ /**
66
+ * Whether the color is equal to another color.
67
+ */
68
+ isEqual(color: ColorType): boolean;
69
+ /**
70
+ * Increments the color channel by the given step size, and returns a new Color object.
71
+ */
72
+ incrementChannel(channel: ColorChannel, stepSize: number): ColorType;
73
+ /**
74
+ * Decrements the color channel by the given step size, and returns a new Color object.
75
+ */
76
+ decrementChannel(channel: ColorChannel, stepSize: number): ColorType;
77
+ /**
78
+ * Returns the color channel value as a percentage of the channel range.
79
+ */
80
+ getChannelValuePercent(channel: ColorChannel, value?: number): number;
81
+ /**
82
+ * Returns the color channel value for a given percentage of the channel range.
83
+ */
84
+ getChannelPercentValue(channel: ColorChannel, percent: number): number;
85
+ }
package/dist/types.js CHANGED
@@ -1,18 +1,4 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/types.ts
17
- var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
package/dist/types.mjs CHANGED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/color-utils",
3
- "version": "1.47.0",
3
+ "version": "1.48.0",
4
4
  "description": "Color utilities for zag.js",
5
5
  "keywords": [
6
6
  "js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "clean-package": "../../../clean-package.config.json",
29
29
  "dependencies": {
30
- "@zag-js/utils": "1.47.0"
30
+ "@zag-js/utils": "1.48.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "clean-package": "2.2.0"
@@ -48,8 +48,8 @@
48
48
  "./package.json": "./package.json"
49
49
  },
50
50
  "scripts": {
51
- "build": "tsup",
52
- "lint": "eslint src",
51
+ "build": "tsdown",
52
+ "lint": "oxlint src",
53
53
  "typecheck": "tsc --noEmit"
54
54
  }
55
55
  }
@@ -1,7 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
-
5
- export {
6
- __publicField
7
- };