@zag-js/color-picker 1.41.0 → 2.0.0-next.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/color-picker.anatomy.d.mts +2 -2
- package/dist/color-picker.anatomy.d.ts +2 -2
- package/dist/color-picker.anatomy.js +1 -0
- package/dist/color-picker.anatomy.mjs +1 -0
- package/dist/color-picker.connect.d.mts +1 -0
- package/dist/color-picker.connect.d.ts +1 -0
- package/dist/color-picker.connect.js +78 -42
- package/dist/color-picker.connect.mjs +79 -43
- package/dist/color-picker.dom.js +23 -22
- package/dist/color-picker.dom.mjs +23 -22
- package/dist/color-picker.machine.d.mts +1 -0
- package/dist/color-picker.machine.d.ts +1 -0
- package/dist/color-picker.machine.js +40 -17
- package/dist/color-picker.machine.mjs +40 -17
- package/dist/color-picker.props.d.mts +1 -0
- package/dist/color-picker.props.d.ts +1 -0
- package/dist/color-picker.types.d.mts +32 -1
- package/dist/color-picker.types.d.ts +32 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/utils/get-area-format.d.mts +6 -0
- package/dist/utils/get-area-format.d.ts +6 -0
- package/dist/utils/get-area-format.js +37 -0
- package/dist/utils/get-area-format.mjs +12 -0
- package/dist/utils/get-channel-display-color.js +7 -0
- package/dist/utils/get-channel-display-color.mjs +7 -0
- package/dist/utils/get-channel-input-value.d.mts +1 -0
- package/dist/utils/get-channel-input-value.d.ts +1 -0
- package/dist/utils/get-channel-input-value.js +39 -8
- package/dist/utils/get-channel-input-value.mjs +39 -8
- package/dist/utils/get-gamut-overlay-path.d.mts +33 -0
- package/dist/utils/get-gamut-overlay-path.d.ts +33 -0
- package/dist/utils/get-gamut-overlay-path.js +81 -0
- package/dist/utils/get-gamut-overlay-path.mjs +55 -0
- package/dist/utils/get-gamut-overlay-path.test.d.mts +2 -0
- package/dist/utils/get-gamut-overlay-path.test.d.ts +2 -0
- package/dist/utils/get-gamut-overlay-path.test.js +35 -0
- package/dist/utils/get-gamut-overlay-path.test.mjs +33 -0
- package/dist/utils/get-slider-background.d.mts +1 -0
- package/dist/utils/get-slider-background.d.ts +1 -0
- package/dist/utils/get-slider-background.js +16 -1
- package/dist/utils/get-slider-background.mjs +16 -1
- package/dist/utils/is-srgb-gamut.d.mts +6 -0
- package/dist/utils/is-srgb-gamut.d.ts +6 -0
- package/dist/utils/is-srgb-gamut.js +33 -0
- package/dist/utils/is-srgb-gamut.mjs +8 -0
- package/package.json +9 -9
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Color, ColorChannel, ColorFormat } from '@zag-js/color-utils';
|
|
2
|
+
|
|
3
|
+
interface GamutOverlayOptions {
|
|
4
|
+
xChannel: ColorChannel;
|
|
5
|
+
yChannel: ColorChannel;
|
|
6
|
+
}
|
|
7
|
+
interface GamutOverlayData {
|
|
8
|
+
path: string;
|
|
9
|
+
labelPosition: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
interface GamutOverlayComputeOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Device pixel ratio; higher values sample more rows along brightness (Chrome DevTools–style).
|
|
17
|
+
* Default `1` when not passed (callers may pass `globalThis.devicePixelRatio` in browsers).
|
|
18
|
+
*/
|
|
19
|
+
pixelRatio?: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Computes an SVG path (0–100 user units) tracing the sRGB gamut boundary
|
|
23
|
+
* over the HSB color area when in a wide-gamut output format (oklch/oklab).
|
|
24
|
+
*
|
|
25
|
+
* Approach (matching Chrome DevTools): treat the HSV area as Display P3 gamut,
|
|
26
|
+
* then for each brightness row, sweep saturation left→right to find where
|
|
27
|
+
* the P3 color exits the sRGB gamut.
|
|
28
|
+
*/
|
|
29
|
+
declare function getGamutOverlayData(areaValue: Color, axes: GamutOverlayOptions, format: ColorFormat, options?: GamutOverlayComputeOptions): GamutOverlayData | null;
|
|
30
|
+
/** Visible boundary rows scale with DPR (analogous to Chrome `step = 1 / devicePixelRatio` in px space). */
|
|
31
|
+
declare function gamutOverlayRowCount(pixelRatio: number): number;
|
|
32
|
+
|
|
33
|
+
export { type GamutOverlayComputeOptions, type GamutOverlayData, gamutOverlayRowCount, getGamutOverlayData };
|
|
@@ -0,0 +1,81 @@
|
|
|
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/utils/get-gamut-overlay-path.ts
|
|
21
|
+
var get_gamut_overlay_path_exports = {};
|
|
22
|
+
__export(get_gamut_overlay_path_exports, {
|
|
23
|
+
gamutOverlayRowCount: () => gamutOverlayRowCount,
|
|
24
|
+
getGamutOverlayData: () => getGamutOverlayData
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(get_gamut_overlay_path_exports);
|
|
27
|
+
var import_color_utils = require("@zag-js/color-utils");
|
|
28
|
+
function getGamutOverlayData(areaValue, axes, format, options) {
|
|
29
|
+
if (format !== "oklch" && format !== "oklab") return null;
|
|
30
|
+
if (axes.xChannel !== "saturation" || axes.yChannel !== "brightness") return null;
|
|
31
|
+
const hue = areaValue.getChannelValue("hue");
|
|
32
|
+
const pixelRatio = options?.pixelRatio ?? 1;
|
|
33
|
+
return buildDisplayP3GamutPath(hue, pixelRatio);
|
|
34
|
+
}
|
|
35
|
+
function gamutOverlayRowCount(pixelRatio) {
|
|
36
|
+
const pr = Math.max(1, pixelRatio);
|
|
37
|
+
return Math.min(200, Math.max(32, Math.round(80 * pr)));
|
|
38
|
+
}
|
|
39
|
+
function buildDisplayP3GamutPath(hue, pixelRatio) {
|
|
40
|
+
const steps = gamutOverlayRowCount(pixelRatio);
|
|
41
|
+
const points = [];
|
|
42
|
+
for (let i = 0; i <= steps; i++) {
|
|
43
|
+
const brightness = i / steps;
|
|
44
|
+
if (brightness < 0.01) continue;
|
|
45
|
+
let lo = 0;
|
|
46
|
+
let hi = 1;
|
|
47
|
+
for (let j = 0; j < 20; j++) {
|
|
48
|
+
const mid = (lo + hi) / 2;
|
|
49
|
+
if ((0, import_color_utils.isDisplayP3HsvInSrgbGamut)(hue, mid, brightness)) {
|
|
50
|
+
lo = mid;
|
|
51
|
+
} else {
|
|
52
|
+
hi = mid;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const xp = Math.min(lo * 100, 100);
|
|
56
|
+
const yp = 100 - brightness * 100;
|
|
57
|
+
points.push({ x: xp, y: yp });
|
|
58
|
+
}
|
|
59
|
+
if (points.length < 2) return null;
|
|
60
|
+
const cmds = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`);
|
|
61
|
+
const labelY = 96;
|
|
62
|
+
let labelX = points[0].x;
|
|
63
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
64
|
+
const a = points[i], b = points[i + 1];
|
|
65
|
+
if (a.y >= labelY && b.y <= labelY || a.y <= labelY && b.y >= labelY) {
|
|
66
|
+
const t = (labelY - a.y) / (b.y - a.y);
|
|
67
|
+
labelX = a.x + t * (b.x - a.x);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (points[0].y < labelY) labelX = points[0].x;
|
|
72
|
+
return {
|
|
73
|
+
path: cmds.join(" "),
|
|
74
|
+
labelPosition: { x: Math.min(labelX - 16, 99), y: labelY }
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
gamutOverlayRowCount,
|
|
80
|
+
getGamutOverlayData
|
|
81
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/utils/get-gamut-overlay-path.ts
|
|
2
|
+
import { isDisplayP3HsvInSrgbGamut } from "@zag-js/color-utils";
|
|
3
|
+
function getGamutOverlayData(areaValue, axes, format, options) {
|
|
4
|
+
if (format !== "oklch" && format !== "oklab") return null;
|
|
5
|
+
if (axes.xChannel !== "saturation" || axes.yChannel !== "brightness") return null;
|
|
6
|
+
const hue = areaValue.getChannelValue("hue");
|
|
7
|
+
const pixelRatio = options?.pixelRatio ?? 1;
|
|
8
|
+
return buildDisplayP3GamutPath(hue, pixelRatio);
|
|
9
|
+
}
|
|
10
|
+
function gamutOverlayRowCount(pixelRatio) {
|
|
11
|
+
const pr = Math.max(1, pixelRatio);
|
|
12
|
+
return Math.min(200, Math.max(32, Math.round(80 * pr)));
|
|
13
|
+
}
|
|
14
|
+
function buildDisplayP3GamutPath(hue, pixelRatio) {
|
|
15
|
+
const steps = gamutOverlayRowCount(pixelRatio);
|
|
16
|
+
const points = [];
|
|
17
|
+
for (let i = 0; i <= steps; i++) {
|
|
18
|
+
const brightness = i / steps;
|
|
19
|
+
if (brightness < 0.01) continue;
|
|
20
|
+
let lo = 0;
|
|
21
|
+
let hi = 1;
|
|
22
|
+
for (let j = 0; j < 20; j++) {
|
|
23
|
+
const mid = (lo + hi) / 2;
|
|
24
|
+
if (isDisplayP3HsvInSrgbGamut(hue, mid, brightness)) {
|
|
25
|
+
lo = mid;
|
|
26
|
+
} else {
|
|
27
|
+
hi = mid;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const xp = Math.min(lo * 100, 100);
|
|
31
|
+
const yp = 100 - brightness * 100;
|
|
32
|
+
points.push({ x: xp, y: yp });
|
|
33
|
+
}
|
|
34
|
+
if (points.length < 2) return null;
|
|
35
|
+
const cmds = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`);
|
|
36
|
+
const labelY = 96;
|
|
37
|
+
let labelX = points[0].x;
|
|
38
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
39
|
+
const a = points[i], b = points[i + 1];
|
|
40
|
+
if (a.y >= labelY && b.y <= labelY || a.y <= labelY && b.y >= labelY) {
|
|
41
|
+
const t = (labelY - a.y) / (b.y - a.y);
|
|
42
|
+
labelX = a.x + t * (b.x - a.x);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (points[0].y < labelY) labelX = points[0].x;
|
|
47
|
+
return {
|
|
48
|
+
path: cmds.join(" "),
|
|
49
|
+
labelPosition: { x: Math.min(labelX - 16, 99), y: labelY }
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
gamutOverlayRowCount,
|
|
54
|
+
getGamutOverlayData
|
|
55
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// src/utils/get-gamut-overlay-path.test.ts
|
|
4
|
+
var import_vitest = require("vitest.js");
|
|
5
|
+
var import_color_utils = require("@zag-js/color-utils");
|
|
6
|
+
var import_get_gamut_overlay_path = require("./get-gamut-overlay-path.js");
|
|
7
|
+
(0, import_vitest.describe)("get-gamut-overlay-path", () => {
|
|
8
|
+
const hsba = (0, import_color_utils.parseColor)("hsba(0, 100%, 100%, 1)");
|
|
9
|
+
(0, import_vitest.test)("wrong area axes returns null", () => {
|
|
10
|
+
(0, import_vitest.expect)(
|
|
11
|
+
(0, import_get_gamut_overlay_path.getGamutOverlayData)(hsba, { xChannel: "hue", yChannel: "saturation" }, "oklch", { pixelRatio: 1 })
|
|
12
|
+
).toBeNull();
|
|
13
|
+
});
|
|
14
|
+
(0, import_vitest.test)("non-wide format returns null", () => {
|
|
15
|
+
(0, import_vitest.expect)((0, import_get_gamut_overlay_path.getGamutOverlayData)(hsba, { xChannel: "saturation", yChannel: "brightness" }, "hsla")).toBeNull();
|
|
16
|
+
});
|
|
17
|
+
(0, import_vitest.test)("higher pixelRatio increases row count and path complexity", () => {
|
|
18
|
+
const low = (0, import_get_gamut_overlay_path.getGamutOverlayData)(hsba, { xChannel: "saturation", yChannel: "brightness" }, "oklch", {
|
|
19
|
+
pixelRatio: 1
|
|
20
|
+
});
|
|
21
|
+
const high = (0, import_get_gamut_overlay_path.getGamutOverlayData)(hsba, { xChannel: "saturation", yChannel: "brightness" }, "oklch", {
|
|
22
|
+
pixelRatio: 2
|
|
23
|
+
});
|
|
24
|
+
(0, import_vitest.expect)(low).not.toBeNull();
|
|
25
|
+
(0, import_vitest.expect)(high).not.toBeNull();
|
|
26
|
+
(0, import_vitest.expect)((0, import_get_gamut_overlay_path.gamutOverlayRowCount)(2)).toBeGreaterThan((0, import_get_gamut_overlay_path.gamutOverlayRowCount)(1));
|
|
27
|
+
(0, import_vitest.expect)(high.path.length).toBeGreaterThan(low.path.length);
|
|
28
|
+
});
|
|
29
|
+
(0, import_vitest.test)("gamutOverlayRowCount scales with DPR and caps at 200", () => {
|
|
30
|
+
(0, import_vitest.expect)((0, import_get_gamut_overlay_path.gamutOverlayRowCount)(1)).toBe(80);
|
|
31
|
+
(0, import_vitest.expect)((0, import_get_gamut_overlay_path.gamutOverlayRowCount)(2)).toBe(160);
|
|
32
|
+
(0, import_vitest.expect)((0, import_get_gamut_overlay_path.gamutOverlayRowCount)(100)).toBe(200);
|
|
33
|
+
(0, import_vitest.expect)((0, import_get_gamut_overlay_path.gamutOverlayRowCount)(0.5)).toBe(80);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/utils/get-gamut-overlay-path.test.ts
|
|
2
|
+
import { describe, expect, test } from "vitest.mjs";
|
|
3
|
+
import { parseColor } from "@zag-js/color-utils";
|
|
4
|
+
import { gamutOverlayRowCount, getGamutOverlayData } from "./get-gamut-overlay-path.mjs";
|
|
5
|
+
describe("get-gamut-overlay-path", () => {
|
|
6
|
+
const hsba = parseColor("hsba(0, 100%, 100%, 1)");
|
|
7
|
+
test("wrong area axes returns null", () => {
|
|
8
|
+
expect(
|
|
9
|
+
getGamutOverlayData(hsba, { xChannel: "hue", yChannel: "saturation" }, "oklch", { pixelRatio: 1 })
|
|
10
|
+
).toBeNull();
|
|
11
|
+
});
|
|
12
|
+
test("non-wide format returns null", () => {
|
|
13
|
+
expect(getGamutOverlayData(hsba, { xChannel: "saturation", yChannel: "brightness" }, "hsla")).toBeNull();
|
|
14
|
+
});
|
|
15
|
+
test("higher pixelRatio increases row count and path complexity", () => {
|
|
16
|
+
const low = getGamutOverlayData(hsba, { xChannel: "saturation", yChannel: "brightness" }, "oklch", {
|
|
17
|
+
pixelRatio: 1
|
|
18
|
+
});
|
|
19
|
+
const high = getGamutOverlayData(hsba, { xChannel: "saturation", yChannel: "brightness" }, "oklch", {
|
|
20
|
+
pixelRatio: 2
|
|
21
|
+
});
|
|
22
|
+
expect(low).not.toBeNull();
|
|
23
|
+
expect(high).not.toBeNull();
|
|
24
|
+
expect(gamutOverlayRowCount(2)).toBeGreaterThan(gamutOverlayRowCount(1));
|
|
25
|
+
expect(high.path.length).toBeGreaterThan(low.path.length);
|
|
26
|
+
});
|
|
27
|
+
test("gamutOverlayRowCount scales with DPR and caps at 200", () => {
|
|
28
|
+
expect(gamutOverlayRowCount(1)).toBe(80);
|
|
29
|
+
expect(gamutOverlayRowCount(2)).toBe(160);
|
|
30
|
+
expect(gamutOverlayRowCount(100)).toBe(200);
|
|
31
|
+
expect(gamutOverlayRowCount(0.5)).toBe(80);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -36,8 +36,14 @@ var getSliderBackground = (props) => {
|
|
|
36
36
|
const { channel, value, dir, orientation } = props;
|
|
37
37
|
const bgDirection = getSliderBackgroundDirection(orientation, dir);
|
|
38
38
|
const { minValue, maxValue } = value.getChannelRange(channel);
|
|
39
|
+
const fmt = value.getFormat();
|
|
39
40
|
switch (channel) {
|
|
40
41
|
case "hue":
|
|
42
|
+
if (fmt === "oklch") {
|
|
43
|
+
const L = value.getChannelValue("lightness");
|
|
44
|
+
const C = value.getChannelValue("chroma");
|
|
45
|
+
return `linear-gradient(to ${bgDirection} in oklch increasing hue, oklch(${L} ${C} 0), oklch(${L} ${C} 360))`;
|
|
46
|
+
}
|
|
41
47
|
return `linear-gradient(to ${bgDirection}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;
|
|
42
48
|
case "lightness": {
|
|
43
49
|
let start = value.withChannelValue(channel, minValue).toString("css");
|
|
@@ -50,9 +56,18 @@ var getSliderBackground = (props) => {
|
|
|
50
56
|
case "red":
|
|
51
57
|
case "green":
|
|
52
58
|
case "blue":
|
|
53
|
-
case "alpha":
|
|
59
|
+
case "alpha":
|
|
60
|
+
case "a":
|
|
61
|
+
case "b":
|
|
62
|
+
case "chroma": {
|
|
54
63
|
let start = value.withChannelValue(channel, minValue).toString("css");
|
|
55
64
|
let end = value.withChannelValue(channel, maxValue).toString("css");
|
|
65
|
+
if (fmt === "oklab" && (channel === "a" || channel === "b")) {
|
|
66
|
+
return `linear-gradient(to ${bgDirection} in oklab, ${start}, ${end})`;
|
|
67
|
+
}
|
|
68
|
+
if (fmt === "oklch" && channel === "chroma") {
|
|
69
|
+
return `linear-gradient(to ${bgDirection} in oklch, ${start}, ${end})`;
|
|
70
|
+
}
|
|
56
71
|
return `linear-gradient(to ${bgDirection}, ${start}, ${end})`;
|
|
57
72
|
}
|
|
58
73
|
default:
|
|
@@ -12,8 +12,14 @@ var getSliderBackground = (props) => {
|
|
|
12
12
|
const { channel, value, dir, orientation } = props;
|
|
13
13
|
const bgDirection = getSliderBackgroundDirection(orientation, dir);
|
|
14
14
|
const { minValue, maxValue } = value.getChannelRange(channel);
|
|
15
|
+
const fmt = value.getFormat();
|
|
15
16
|
switch (channel) {
|
|
16
17
|
case "hue":
|
|
18
|
+
if (fmt === "oklch") {
|
|
19
|
+
const L = value.getChannelValue("lightness");
|
|
20
|
+
const C = value.getChannelValue("chroma");
|
|
21
|
+
return `linear-gradient(to ${bgDirection} in oklch increasing hue, oklch(${L} ${C} 0), oklch(${L} ${C} 360))`;
|
|
22
|
+
}
|
|
17
23
|
return `linear-gradient(to ${bgDirection}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;
|
|
18
24
|
case "lightness": {
|
|
19
25
|
let start = value.withChannelValue(channel, minValue).toString("css");
|
|
@@ -26,9 +32,18 @@ var getSliderBackground = (props) => {
|
|
|
26
32
|
case "red":
|
|
27
33
|
case "green":
|
|
28
34
|
case "blue":
|
|
29
|
-
case "alpha":
|
|
35
|
+
case "alpha":
|
|
36
|
+
case "a":
|
|
37
|
+
case "b":
|
|
38
|
+
case "chroma": {
|
|
30
39
|
let start = value.withChannelValue(channel, minValue).toString("css");
|
|
31
40
|
let end = value.withChannelValue(channel, maxValue).toString("css");
|
|
41
|
+
if (fmt === "oklab" && (channel === "a" || channel === "b")) {
|
|
42
|
+
return `linear-gradient(to ${bgDirection} in oklab, ${start}, ${end})`;
|
|
43
|
+
}
|
|
44
|
+
if (fmt === "oklch" && channel === "chroma") {
|
|
45
|
+
return `linear-gradient(to ${bgDirection} in oklch, ${start}, ${end})`;
|
|
46
|
+
}
|
|
32
47
|
return `linear-gradient(to ${bgDirection}, ${start}, ${end})`;
|
|
33
48
|
}
|
|
34
49
|
default:
|
|
@@ -0,0 +1,33 @@
|
|
|
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/utils/is-srgb-gamut.ts
|
|
21
|
+
var is_srgb_gamut_exports = {};
|
|
22
|
+
__export(is_srgb_gamut_exports, {
|
|
23
|
+
isSrgbGamutColor: () => isSrgbGamutColor
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(is_srgb_gamut_exports);
|
|
26
|
+
var import_color_utils = require("@zag-js/color-utils");
|
|
27
|
+
function isSrgbGamutColor(color) {
|
|
28
|
+
return (0, import_color_utils.isInSrgbGamut)(color);
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
isSrgbGamutColor
|
|
33
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/color-picker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.0",
|
|
4
4
|
"description": "Core logic for the color-picker widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@zag-js/
|
|
31
|
-
"@zag-js/
|
|
32
|
-
"@zag-js/
|
|
33
|
-
"@zag-js/
|
|
34
|
-
"@zag-js/
|
|
35
|
-
"@zag-js/color-utils": "
|
|
36
|
-
"@zag-js/popper": "
|
|
37
|
-
"@zag-js/types": "
|
|
30
|
+
"@zag-js/core": "2.0.0-next.0",
|
|
31
|
+
"@zag-js/anatomy": "2.0.0-next.0",
|
|
32
|
+
"@zag-js/dom-query": "2.0.0-next.0",
|
|
33
|
+
"@zag-js/dismissable": "2.0.0-next.0",
|
|
34
|
+
"@zag-js/utils": "2.0.0-next.0",
|
|
35
|
+
"@zag-js/color-utils": "2.0.0-next.0",
|
|
36
|
+
"@zag-js/popper": "2.0.0-next.0",
|
|
37
|
+
"@zag-js/types": "2.0.0-next.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"clean-package": "2.2.0"
|