@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
@@ -1,143 +1,134 @@
1
- import {
2
- __publicField
3
- } from "./chunk-QZ7TP4HQ.mjs";
4
-
5
- // src/hsl-color.ts
6
- import { clampValue, mod, toFixedNumber } from "@zag-js/utils";
7
1
  import { Color } from "./color.mjs";
8
2
  import { HSBColor } from "./hsb-color.mjs";
9
3
  import { RGBColor } from "./rgb-color.mjs";
10
- var HSL_REGEX = /hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
11
- var _HSLColor = class _HSLColor extends Color {
12
- constructor(hue, saturation, lightness, alpha) {
13
- super();
14
- __publicField(this, "hue", hue);
15
- __publicField(this, "saturation", saturation);
16
- __publicField(this, "lightness", lightness);
17
- __publicField(this, "alpha", alpha);
18
- }
19
- static parse(value) {
20
- let m;
21
- if (m = value.match(HSL_REGEX)) {
22
- const [h, s, l, a] = (m[1] ?? m[2]).split(",").map((n) => Number(n.trim().replace("%", "")));
23
- return new _HSLColor(mod(h, 360), clampValue(s, 0, 100), clampValue(l, 0, 100), clampValue(a ?? 1, 0, 1));
24
- }
25
- }
26
- toString(format = "css") {
27
- switch (format) {
28
- case "hex":
29
- return this.toRGB().toString("hex");
30
- case "hexa":
31
- return this.toRGB().toString("hexa");
32
- case "hsl":
33
- return `hsl(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.lightness, 2)}%)`;
34
- case "css":
35
- case "hsla":
36
- return `hsla(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
37
- case "hsb":
38
- return this.toHSB().toString("hsb");
39
- case "rgb":
40
- return this.toRGB().toString("rgb");
41
- default:
42
- return this.toFormat(format).toString(format);
43
- }
44
- }
45
- toFormat(format) {
46
- switch (format) {
47
- case "hsla":
48
- return this;
49
- case "hsba":
50
- return this.toHSB();
51
- case "rgba":
52
- return this.toRGB();
53
- default:
54
- throw new Error("Unsupported color conversion: hsl -> " + format);
55
- }
56
- }
57
- /**
58
- * Converts a HSL color to HSB.
59
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.
60
- * @returns An HSBColor object.
61
- */
62
- toHSB() {
63
- let saturation = this.saturation / 100;
64
- let lightness = this.lightness / 100;
65
- let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
66
- saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
67
- return new HSBColor(
68
- toFixedNumber(this.hue, 2),
69
- toFixedNumber(saturation * 100, 2),
70
- toFixedNumber(brightness * 100, 2),
71
- toFixedNumber(this.alpha, 2)
72
- );
73
- }
74
- /**
75
- * Converts a HSL color to RGB.
76
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.
77
- * @returns An RGBColor object.
78
- */
79
- toRGB() {
80
- let hue = this.hue;
81
- let saturation = this.saturation / 100;
82
- let lightness = this.lightness / 100;
83
- let a = saturation * Math.min(lightness, 1 - lightness);
84
- let fn = (n, k = (n + hue / 30) % 12) => lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
85
- return new RGBColor(
86
- Math.round(fn(0) * 255),
87
- Math.round(fn(8) * 255),
88
- Math.round(fn(4) * 255),
89
- toFixedNumber(this.alpha, 2)
90
- );
91
- }
92
- clone() {
93
- return new _HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
94
- }
95
- getChannelFormatOptions(channel) {
96
- switch (channel) {
97
- case "hue":
98
- return { style: "unit", unit: "degree", unitDisplay: "narrow" };
99
- case "saturation":
100
- case "lightness":
101
- case "alpha":
102
- return { style: "percent" };
103
- default:
104
- throw new Error("Unknown color channel: " + channel);
105
- }
106
- }
107
- formatChannelValue(channel, locale) {
108
- let options = this.getChannelFormatOptions(channel);
109
- let value = this.getChannelValue(channel);
110
- if (channel === "saturation" || channel === "lightness") {
111
- value /= 100;
112
- }
113
- return new Intl.NumberFormat(locale, options).format(value);
114
- }
115
- getChannelRange(channel) {
116
- switch (channel) {
117
- case "hue":
118
- return { minValue: 0, maxValue: 360, step: 1, pageSize: 15 };
119
- case "saturation":
120
- case "lightness":
121
- return { minValue: 0, maxValue: 100, step: 1, pageSize: 10 };
122
- case "alpha":
123
- return { minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1 };
124
- default:
125
- throw new Error("Unknown color channel: " + channel);
126
- }
127
- }
128
- toJSON() {
129
- return { h: this.hue, s: this.saturation, l: this.lightness, a: this.alpha };
130
- }
131
- getFormat() {
132
- return "hsla";
133
- }
134
- getChannels() {
135
- return _HSLColor.colorChannels;
136
- }
137
- };
138
- __publicField(_HSLColor, "colorChannels", ["hue", "saturation", "lightness"]);
139
- var HSLColor = _HSLColor;
140
- export {
141
- HSLColor,
142
- HSL_REGEX
4
+ import _defineProperty from "./_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs";
5
+ import { clampValue, mod, toFixedNumber } from "@zag-js/utils";
6
+ // src/hsl-color.ts
7
+ const HSL_REGEX = /hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
8
+ var HSLColor = class HSLColor extends Color {
9
+ constructor(hue, saturation, lightness, alpha) {
10
+ super();
11
+ this.hue = hue;
12
+ this.saturation = saturation;
13
+ this.lightness = lightness;
14
+ this.alpha = alpha;
15
+ }
16
+ static parse(value) {
17
+ let m;
18
+ if (m = value.match(HSL_REGEX)) {
19
+ const [h, s, l, a] = (m[1] ?? m[2]).split(",").map((n) => Number(n.trim().replace("%", "")));
20
+ return new HSLColor(mod(h, 360), clampValue(s, 0, 100), clampValue(l, 0, 100), clampValue(a ?? 1, 0, 1));
21
+ }
22
+ }
23
+ toString(format = "css") {
24
+ switch (format) {
25
+ case "hex": return this.toRGB().toString("hex");
26
+ case "hexa": return this.toRGB().toString("hexa");
27
+ case "hsl": return `hsl(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.lightness, 2)}%)`;
28
+ case "css":
29
+ case "hsla": return `hsla(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
30
+ case "hsb": return this.toHSB().toString("hsb");
31
+ case "rgb": return this.toRGB().toString("rgb");
32
+ default: return this.toFormat(format).toString(format);
33
+ }
34
+ }
35
+ toFormat(format) {
36
+ switch (format) {
37
+ case "hsla": return this;
38
+ case "hsba": return this.toHSB();
39
+ case "rgba": return this.toRGB();
40
+ default: throw new Error("Unsupported color conversion: hsl -> " + format);
41
+ }
42
+ }
43
+ /**
44
+ * Converts a HSL color to HSB.
45
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.
46
+ * @returns An HSBColor object.
47
+ */
48
+ toHSB() {
49
+ let saturation = this.saturation / 100;
50
+ let lightness = this.lightness / 100;
51
+ let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
52
+ saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
53
+ return new HSBColor(toFixedNumber(this.hue, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(brightness * 100, 2), toFixedNumber(this.alpha, 2));
54
+ }
55
+ /**
56
+ * Converts a HSL color to RGB.
57
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.
58
+ * @returns An RGBColor object.
59
+ */
60
+ toRGB() {
61
+ let hue = this.hue;
62
+ let saturation = this.saturation / 100;
63
+ let lightness = this.lightness / 100;
64
+ let a = saturation * Math.min(lightness, 1 - lightness);
65
+ let fn = (n, k = (n + hue / 30) % 12) => lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
66
+ return new RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), toFixedNumber(this.alpha, 2));
67
+ }
68
+ clone() {
69
+ return new HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
70
+ }
71
+ getChannelFormatOptions(channel) {
72
+ switch (channel) {
73
+ case "hue": return {
74
+ style: "unit",
75
+ unit: "degree",
76
+ unitDisplay: "narrow"
77
+ };
78
+ case "saturation":
79
+ case "lightness":
80
+ case "alpha": return { style: "percent" };
81
+ default: throw new Error("Unknown color channel: " + channel);
82
+ }
83
+ }
84
+ formatChannelValue(channel, locale) {
85
+ let options = this.getChannelFormatOptions(channel);
86
+ let value = this.getChannelValue(channel);
87
+ if (channel === "saturation" || channel === "lightness") value /= 100;
88
+ return new Intl.NumberFormat(locale, options).format(value);
89
+ }
90
+ getChannelRange(channel) {
91
+ switch (channel) {
92
+ case "hue": return {
93
+ minValue: 0,
94
+ maxValue: 360,
95
+ step: 1,
96
+ pageSize: 15
97
+ };
98
+ case "saturation":
99
+ case "lightness": return {
100
+ minValue: 0,
101
+ maxValue: 100,
102
+ step: 1,
103
+ pageSize: 10
104
+ };
105
+ case "alpha": return {
106
+ minValue: 0,
107
+ maxValue: 1,
108
+ step: .01,
109
+ pageSize: .1
110
+ };
111
+ default: throw new Error("Unknown color channel: " + channel);
112
+ }
113
+ }
114
+ toJSON() {
115
+ return {
116
+ h: this.hue,
117
+ s: this.saturation,
118
+ l: this.lightness,
119
+ a: this.alpha
120
+ };
121
+ }
122
+ getFormat() {
123
+ return "hsla";
124
+ }
125
+ getChannels() {
126
+ return HSLColor.colorChannels;
127
+ }
143
128
  };
129
+ _defineProperty(HSLColor, "colorChannels", [
130
+ "hue",
131
+ "saturation",
132
+ "lightness"
133
+ ]);
134
+ export { HSLColor, HSL_REGEX };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- export { getColorAreaGradient } from './area-gradient.mjs';
2
- export { Color } from './color.mjs';
3
- export { normalizeColor, parseColor } from './parse-color.mjs';
4
- export { ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorStringFormat, ColorType } from './types.mjs';
1
+ import { getColorAreaGradient } from "./area-gradient.mjs";
2
+ import { Color } from "./color.mjs";
3
+ import { normalizeColor, parseColor } from "./parse-color.mjs";
4
+ import { ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorStringFormat, ColorType } from "./types.mjs";
5
+ export { Color, type ColorAxes, type ColorChannel, type ColorChannelRange, type ColorFormat, type ColorStringFormat, type ColorType, getColorAreaGradient, normalizeColor, parseColor };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { getColorAreaGradient } from './area-gradient.js';
2
- export { Color } from './color.js';
3
- export { normalizeColor, parseColor } from './parse-color.js';
4
- export { ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorStringFormat, ColorType } from './types.js';
1
+ import { getColorAreaGradient } from "./area-gradient.js";
2
+ import { Color } from "./color.js";
3
+ import { normalizeColor, parseColor } from "./parse-color.js";
4
+ import { ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorStringFormat, ColorType } from "./types.js";
5
+ export { Color, type ColorAxes, type ColorChannel, type ColorChannelRange, type ColorFormat, type ColorStringFormat, type ColorType, getColorAreaGradient, normalizeColor, parseColor };
package/dist/index.js CHANGED
@@ -1,38 +1,11 @@
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Color: () => import_color.Color,
24
- getColorAreaGradient: () => import_area_gradient.getColorAreaGradient,
25
- normalizeColor: () => import_parse_color.normalizeColor,
26
- parseColor: () => import_parse_color.parseColor
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
- var import_area_gradient = require("./area-gradient.js");
30
- var import_color = require("./color.js");
31
- var import_parse_color = require("./parse-color.js");
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- Color,
35
- getColorAreaGradient,
36
- normalizeColor,
37
- parseColor
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
38
4
  });
5
+ const require_area_gradient = require("./area-gradient.js");
6
+ const require_color = require("./color.js");
7
+ const require_parse_color = require("./parse-color.js");
8
+ exports.Color = require_color.Color;
9
+ exports.getColorAreaGradient = require_area_gradient.getColorAreaGradient;
10
+ exports.normalizeColor = require_parse_color.normalizeColor;
11
+ exports.parseColor = require_parse_color.parseColor;
package/dist/index.mjs CHANGED
@@ -1,12 +1,4 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
- // src/index.ts
4
1
  import { getColorAreaGradient } from "./area-gradient.mjs";
5
2
  import { Color } from "./color.mjs";
6
3
  import { normalizeColor, parseColor } from "./parse-color.mjs";
7
- export {
8
- Color,
9
- getColorAreaGradient,
10
- normalizeColor,
11
- parseColor
12
- };
4
+ export { Color, getColorAreaGradient, normalizeColor, parseColor };
@@ -1,3 +1 @@
1
- declare const nativeColorMap: Map<string, string>;
2
-
3
- export { nativeColorMap };
1
+ export declare const nativeColorMap: Map<string, string>;
@@ -1,3 +1 @@
1
- declare const nativeColorMap: Map<string, string>;
2
-
3
- export { nativeColorMap };
1
+ export declare const nativeColorMap: Map<string, string>;
@@ -1,41 +1,18 @@
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/native-color.ts
21
- var native_color_exports = {};
22
- __export(native_color_exports, {
23
- nativeColorMap: () => nativeColorMap
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
24
4
  });
25
- module.exports = __toCommonJS(native_color_exports);
26
- var nativeColors = "aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffebcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkblue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkturquoise:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,ghostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:adff2f,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lightcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgrey:d3d3d3,lightgreen:90ee90,lightpink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslategray:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,magenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:ba55d3,mediumpurple:9370d8,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moccasin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff4500,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevioletred:d87093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b4513,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblue:6a5acd,slategray:708090,snow:fffafa,springgreen:00ff7f,steelblue:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32";
27
- var makeMap = (str) => {
28
- const map = /* @__PURE__ */ new Map();
29
- const list = str.split(",");
30
- for (let i = 0; i < list.length; i++) {
31
- const [key, val] = list[i].split(":");
32
- map.set(key, `#${val}`);
33
- if (key.includes("gray")) map.set(key.replace("gray", "grey"), `#${val}`);
34
- }
35
- return map;
5
+ // src/native-color.ts
6
+ const nativeColors = "aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffebcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkblue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkturquoise:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,ghostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:adff2f,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lightcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgrey:d3d3d3,lightgreen:90ee90,lightpink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslategray:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,magenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:ba55d3,mediumpurple:9370d8,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moccasin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff4500,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevioletred:d87093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b4513,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblue:6a5acd,slategray:708090,snow:fffafa,springgreen:00ff7f,steelblue:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32";
7
+ const makeMap = (str) => {
8
+ const map = /* @__PURE__ */ new Map();
9
+ const list = str.split(",");
10
+ for (let i = 0; i < list.length; i++) {
11
+ const [key, val] = list[i].split(":");
12
+ map.set(key, `#${val}`);
13
+ if (key.includes("gray")) map.set(key.replace("gray", "grey"), `#${val}`);
14
+ }
15
+ return map;
36
16
  };
37
- var nativeColorMap = makeMap(nativeColors);
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- nativeColorMap
41
- });
17
+ const nativeColorMap = makeMap(nativeColors);
18
+ exports.nativeColorMap = nativeColorMap;
@@ -1,18 +1,14 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
1
  // src/native-color.ts
4
- var nativeColors = "aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffebcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkblue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkturquoise:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,ghostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:adff2f,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lightcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgrey:d3d3d3,lightgreen:90ee90,lightpink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslategray:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,magenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:ba55d3,mediumpurple:9370d8,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moccasin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff4500,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevioletred:d87093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b4513,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblue:6a5acd,slategray:708090,snow:fffafa,springgreen:00ff7f,steelblue:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32";
5
- var makeMap = (str) => {
6
- const map = /* @__PURE__ */ new Map();
7
- const list = str.split(",");
8
- for (let i = 0; i < list.length; i++) {
9
- const [key, val] = list[i].split(":");
10
- map.set(key, `#${val}`);
11
- if (key.includes("gray")) map.set(key.replace("gray", "grey"), `#${val}`);
12
- }
13
- return map;
14
- };
15
- var nativeColorMap = makeMap(nativeColors);
16
- export {
17
- nativeColorMap
2
+ const nativeColors = "aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffebcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkblue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkturquoise:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,ghostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:adff2f,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lightcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgrey:d3d3d3,lightgreen:90ee90,lightpink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslategray:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,magenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:ba55d3,mediumpurple:9370d8,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moccasin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff4500,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevioletred:d87093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b4513,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblue:6a5acd,slategray:708090,snow:fffafa,springgreen:00ff7f,steelblue:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32";
3
+ const makeMap = (str) => {
4
+ const map = /* @__PURE__ */ new Map();
5
+ const list = str.split(",");
6
+ for (let i = 0; i < list.length; i++) {
7
+ const [key, val] = list[i].split(":");
8
+ map.set(key, `#${val}`);
9
+ if (key.includes("gray")) map.set(key.replace("gray", "grey"), `#${val}`);
10
+ }
11
+ return map;
18
12
  };
13
+ const nativeColorMap = makeMap(nativeColors);
14
+ export { nativeColorMap };
@@ -1,6 +1,3 @@
1
- import { ColorType } from './types.mjs';
2
-
3
- declare const parseColor: (value: string) => ColorType;
4
- declare const normalizeColor: (v: string | ColorType) => ColorType;
5
-
6
- export { normalizeColor, parseColor };
1
+ import { ColorType } from "./types.mjs";
2
+ export declare const parseColor: (value: string) => ColorType;
3
+ export declare const normalizeColor: (v: string | ColorType) => ColorType;
@@ -1,6 +1,3 @@
1
- import { ColorType } from './types.js';
2
-
3
- declare const parseColor: (value: string) => ColorType;
4
- declare const normalizeColor: (v: string | ColorType) => ColorType;
5
-
6
- export { normalizeColor, parseColor };
1
+ import { ColorType } from "./types.js";
2
+ export declare const parseColor: (value: string) => ColorType;
3
+ export declare const normalizeColor: (v: string | ColorType) => ColorType;
@@ -1,50 +1,24 @@
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/parse-color.ts
21
- var parse_color_exports = {};
22
- __export(parse_color_exports, {
23
- normalizeColor: () => normalizeColor,
24
- parseColor: () => parseColor
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
25
4
  });
26
- module.exports = __toCommonJS(parse_color_exports);
27
- var import_hsb_color = require("./hsb-color.js");
28
- var import_hsl_color = require("./hsl-color.js");
29
- var import_native_color = require("./native-color.js");
30
- var import_rgb_color = require("./rgb-color.js");
31
- var parseColor = (value) => {
32
- if (import_native_color.nativeColorMap.has(value)) {
33
- return parseColor(import_native_color.nativeColorMap.get(value));
34
- }
35
- const result = import_rgb_color.RGBColor.parse(value) || import_hsb_color.HSBColor.parse(value) || import_hsl_color.HSLColor.parse(value);
36
- if (!result) {
37
- const error = new Error("Invalid color value: " + value);
38
- Error.captureStackTrace?.(error, parseColor);
39
- throw error;
40
- }
41
- return result;
5
+ const require_hsb_color = require("./hsb-color.js");
6
+ const require_hsl_color = require("./hsl-color.js");
7
+ const require_native_color = require("./native-color.js");
8
+ const require_rgb_color = require("./rgb-color.js");
9
+ // src/parse-color.ts
10
+ const parseColor = (value) => {
11
+ if (require_native_color.nativeColorMap.has(value)) return parseColor(require_native_color.nativeColorMap.get(value));
12
+ const result = require_rgb_color.RGBColor.parse(value) || require_hsb_color.HSBColor.parse(value) || require_hsl_color.HSLColor.parse(value);
13
+ if (!result) {
14
+ const error = /* @__PURE__ */ new Error("Invalid color value: " + value);
15
+ Error.captureStackTrace?.(error, parseColor);
16
+ throw error;
17
+ }
18
+ return result;
42
19
  };
43
- var normalizeColor = (v) => {
44
- return typeof v === "string" ? parseColor(v) : v;
20
+ const normalizeColor = (v) => {
21
+ return typeof v === "string" ? parseColor(v) : v;
45
22
  };
46
- // Annotate the CommonJS export names for ESM import in node:
47
- 0 && (module.exports = {
48
- normalizeColor,
49
- parseColor
50
- });
23
+ exports.normalizeColor = normalizeColor;
24
+ exports.parseColor = parseColor;
@@ -1,26 +1,19 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
- // src/parse-color.ts
4
1
  import { HSBColor } from "./hsb-color.mjs";
5
2
  import { HSLColor } from "./hsl-color.mjs";
6
3
  import { nativeColorMap } from "./native-color.mjs";
7
4
  import { RGBColor } from "./rgb-color.mjs";
8
- var parseColor = (value) => {
9
- if (nativeColorMap.has(value)) {
10
- return parseColor(nativeColorMap.get(value));
11
- }
12
- const result = RGBColor.parse(value) || HSBColor.parse(value) || HSLColor.parse(value);
13
- if (!result) {
14
- const error = new Error("Invalid color value: " + value);
15
- Error.captureStackTrace?.(error, parseColor);
16
- throw error;
17
- }
18
- return result;
19
- };
20
- var normalizeColor = (v) => {
21
- return typeof v === "string" ? parseColor(v) : v;
5
+ // src/parse-color.ts
6
+ const parseColor = (value) => {
7
+ if (nativeColorMap.has(value)) return parseColor(nativeColorMap.get(value));
8
+ const result = RGBColor.parse(value) || HSBColor.parse(value) || HSLColor.parse(value);
9
+ if (!result) {
10
+ const error = /* @__PURE__ */ new Error("Invalid color value: " + value);
11
+ Error.captureStackTrace?.(error, parseColor);
12
+ throw error;
13
+ }
14
+ return result;
22
15
  };
23
- export {
24
- normalizeColor,
25
- parseColor
16
+ const normalizeColor = (v) => {
17
+ return typeof v === "string" ? parseColor(v) : v;
26
18
  };
19
+ export { normalizeColor, parseColor };