@zag-js/color-picker 1.43.0 → 2.0.0-next.1
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 +130 -58
- package/dist/color-picker.connect.mjs +139 -60
- 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 +43 -16
- package/dist/color-picker.machine.mjs +43 -16
- 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 +115 -3
- package/dist/color-picker.types.d.ts +115 -3
- 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.d.mts +2 -1
- package/dist/utils/get-channel-display-color.d.ts +2 -1
- 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
|
@@ -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.1",
|
|
4
4
|
"description": "Core logic for the color-picker widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@zag-js/core": "
|
|
34
|
-
"@zag-js/anatomy": "
|
|
35
|
-
"@zag-js/dom-query": "
|
|
36
|
-
"@zag-js/dismissable": "
|
|
37
|
-
"@zag-js/utils": "
|
|
38
|
-
"@zag-js/color-utils": "
|
|
39
|
-
"@zag-js/popper": "
|
|
40
|
-
"@zag-js/types": "
|
|
33
|
+
"@zag-js/core": "2.0.0-next.1",
|
|
34
|
+
"@zag-js/anatomy": "2.0.0-next.1",
|
|
35
|
+
"@zag-js/dom-query": "2.0.0-next.1",
|
|
36
|
+
"@zag-js/dismissable": "2.0.0-next.1",
|
|
37
|
+
"@zag-js/utils": "2.0.0-next.1",
|
|
38
|
+
"@zag-js/color-utils": "2.0.0-next.1",
|
|
39
|
+
"@zag-js/popper": "2.0.0-next.1",
|
|
40
|
+
"@zag-js/types": "2.0.0-next.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"clean-package": "2.2.0"
|