@zag-js/color-picker 0.10.2 → 0.10.4
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.ts +3 -6
- package/dist/color-picker.anatomy.js +10 -33
- package/dist/color-picker.anatomy.mjs +19 -8
- package/dist/color-picker.connect.d.ts +4 -8
- package/dist/color-picker.connect.js +56 -436
- package/dist/color-picker.connect.mjs +368 -14
- package/dist/color-picker.dom.d.ts +27 -32
- package/dist/color-picker.dom.js +12 -34
- package/dist/color-picker.dom.mjs +33 -6
- package/dist/color-picker.machine.d.ts +3 -8
- package/dist/color-picker.machine.js +46 -163
- package/dist/color-picker.machine.mjs +335 -8
- package/dist/color-picker.types.d.ts +14 -16
- package/dist/index.d.ts +4 -8
- package/dist/index.js +8 -1085
- package/dist/index.mjs +3 -21
- package/dist/utils/generate-format-background.d.ts +9 -11
- package/dist/utils/generate-format-background.js +22 -53
- package/dist/utils/generate-format-background.mjs +120 -21
- package/dist/utils/get-channel-details.d.ts +3 -7
- package/dist/utils/get-channel-details.js +15 -37
- package/dist/utils/get-channel-details.mjs +53 -6
- package/dist/utils/get-channel-display-color.d.ts +3 -5
- package/dist/utils/get-channel-display-color.js +8 -30
- package/dist/utils/get-channel-display-color.mjs +22 -6
- package/dist/utils/get-channel-input-value.d.ts +5 -10
- package/dist/utils/get-channel-input-value.js +6 -30
- package/dist/utils/get-channel-input-value.mjs +21 -8
- package/dist/utils/get-color-area-gradient.d.ts +6 -10
- package/dist/utils/get-color-area-gradient.js +14 -158
- package/dist/utils/get-color-area-gradient.mjs +61 -7
- package/dist/utils/get-slider-background.d.ts +2 -8
- package/dist/utils/get-slider-background.js +6 -29
- package/dist/utils/get-slider-background.mjs +38 -5
- package/package.json +11 -16
- package/src/color-picker.connect.ts +1 -1
- package/src/color-picker.dom.ts +1 -1
- package/src/color-picker.types.ts +3 -1
- package/src/index.ts +2 -0
- package/src/utils/get-channel-details.ts +2 -2
- package/src/utils/get-channel-display-color.ts +1 -1
- package/src/utils/get-color-area-gradient.ts +1 -1
- package/dist/chunk-2ERX54SV.mjs +0 -25
- package/dist/chunk-3XH465XT.mjs +0 -42
- package/dist/chunk-5QSFKCT5.mjs +0 -393
- package/dist/chunk-75JXJMB5.mjs +0 -22
- package/dist/chunk-JNBNPPMF.mjs +0 -24
- package/dist/chunk-KLLIOTK6.mjs +0 -55
- package/dist/chunk-KO4TBUXB.mjs +0 -74
- package/dist/chunk-ML3WX6YS.mjs +0 -345
- package/dist/chunk-OY3B7NXA.mjs +0 -132
- package/dist/chunk-SPSDVZCT.mjs +0 -35
- package/dist/color-picker.types.js +0 -18
- package/dist/color-picker.types.mjs +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
} from
|
|
4
|
-
import "./chunk-JNBNPPMF.mjs";
|
|
5
|
-
import "./chunk-KO4TBUXB.mjs";
|
|
6
|
-
import "./chunk-3XH465XT.mjs";
|
|
7
|
-
import {
|
|
8
|
-
anatomy
|
|
9
|
-
} from "./chunk-75JXJMB5.mjs";
|
|
10
|
-
import {
|
|
11
|
-
machine
|
|
12
|
-
} from "./chunk-ML3WX6YS.mjs";
|
|
13
|
-
import "./chunk-2ERX54SV.mjs";
|
|
14
|
-
import "./chunk-SPSDVZCT.mjs";
|
|
15
|
-
import "./chunk-OY3B7NXA.mjs";
|
|
16
|
-
import "./chunk-KLLIOTK6.mjs";
|
|
17
|
-
export {
|
|
18
|
-
anatomy,
|
|
19
|
-
connect,
|
|
20
|
-
machine
|
|
21
|
-
};
|
|
1
|
+
export { anatomy } from './color-picker.anatomy.mjs';
|
|
2
|
+
export { connect } from './color-picker.connect.mjs';
|
|
3
|
+
export { machine } from './color-picker.machine.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const generateRGB_R: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
1
|
+
export declare const generateRGB_R: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
2
2
|
areaStyles: {
|
|
3
3
|
backgroundImage: string;
|
|
4
4
|
};
|
|
@@ -8,7 +8,7 @@ declare const generateRGB_R: (orientation: [string, string], dir: boolean, zValu
|
|
|
8
8
|
maskImage: string;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
declare const generateRGB_G: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
11
|
+
export declare const generateRGB_G: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
12
12
|
areaStyles: {
|
|
13
13
|
backgroundImage: string;
|
|
14
14
|
};
|
|
@@ -18,7 +18,7 @@ declare const generateRGB_G: (orientation: [string, string], dir: boolean, zValu
|
|
|
18
18
|
maskImage: string;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
declare const generateRGB_B: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
21
|
+
export declare const generateRGB_B: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
22
22
|
areaStyles: {
|
|
23
23
|
backgroundImage: string;
|
|
24
24
|
};
|
|
@@ -28,41 +28,39 @@ declare const generateRGB_B: (orientation: [string, string], dir: boolean, zValu
|
|
|
28
28
|
maskImage: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
declare const generateHSL_H: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
31
|
+
export declare const generateHSL_H: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
32
32
|
areaStyles: {};
|
|
33
33
|
areaGradientStyles: {
|
|
34
34
|
background: string;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
declare const generateHSL_S: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
37
|
+
export declare const generateHSL_S: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
38
38
|
areaStyles: {};
|
|
39
39
|
areaGradientStyles: {
|
|
40
40
|
background: string;
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
-
declare const generateHSL_L: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
43
|
+
export declare const generateHSL_L: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
44
44
|
areaStyles: {};
|
|
45
45
|
areaGradientStyles: {
|
|
46
46
|
backgroundImage: string;
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
declare const generateHSB_H: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
49
|
+
export declare const generateHSB_H: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
50
50
|
areaStyles: {};
|
|
51
51
|
areaGradientStyles: {
|
|
52
52
|
background: string;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
declare const generateHSB_S: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
55
|
+
export declare const generateHSB_S: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
56
56
|
areaStyles: {};
|
|
57
57
|
areaGradientStyles: {
|
|
58
58
|
background: string;
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
declare const generateHSB_B: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
61
|
+
export declare const generateHSB_B: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
62
62
|
areaStyles: {};
|
|
63
63
|
areaGradientStyles: {
|
|
64
64
|
background: string;
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
-
|
|
68
|
-
export { generateHSB_B, generateHSB_H, generateHSB_S, generateHSL_H, generateHSL_L, generateHSL_S, generateRGB_B, generateRGB_G, generateRGB_R };
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
generateHSB_B: () => generateHSB_B,
|
|
24
|
-
generateHSB_H: () => generateHSB_H,
|
|
25
|
-
generateHSB_S: () => generateHSB_S,
|
|
26
|
-
generateHSL_H: () => generateHSL_H,
|
|
27
|
-
generateHSL_L: () => generateHSL_L,
|
|
28
|
-
generateHSL_S: () => generateHSL_S,
|
|
29
|
-
generateRGB_B: () => generateRGB_B,
|
|
30
|
-
generateRGB_G: () => generateRGB_G,
|
|
31
|
-
generateRGB_R: () => generateRGB_R
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(generate_format_background_exports);
|
|
34
|
-
var generateRGB_R = (orientation, dir, zValue) => {
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const generateRGB_R = (orientation, dir, zValue) => {
|
|
35
6
|
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
36
7
|
const result = {
|
|
37
8
|
areaStyles: {
|
|
@@ -45,7 +16,7 @@ var generateRGB_R = (orientation, dir, zValue) => {
|
|
|
45
16
|
};
|
|
46
17
|
return result;
|
|
47
18
|
};
|
|
48
|
-
|
|
19
|
+
const generateRGB_G = (orientation, dir, zValue) => {
|
|
49
20
|
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
50
21
|
const result = {
|
|
51
22
|
areaStyles: {
|
|
@@ -59,7 +30,7 @@ var generateRGB_G = (orientation, dir, zValue) => {
|
|
|
59
30
|
};
|
|
60
31
|
return result;
|
|
61
32
|
};
|
|
62
|
-
|
|
33
|
+
const generateRGB_B = (orientation, dir, zValue) => {
|
|
63
34
|
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
64
35
|
const result = {
|
|
65
36
|
areaStyles: {
|
|
@@ -73,7 +44,7 @@ var generateRGB_B = (orientation, dir, zValue) => {
|
|
|
73
44
|
};
|
|
74
45
|
return result;
|
|
75
46
|
};
|
|
76
|
-
|
|
47
|
+
const generateHSL_H = (orientation, dir, zValue) => {
|
|
77
48
|
const result = {
|
|
78
49
|
areaStyles: {},
|
|
79
50
|
areaGradientStyles: {
|
|
@@ -86,7 +57,7 @@ var generateHSL_H = (orientation, dir, zValue) => {
|
|
|
86
57
|
};
|
|
87
58
|
return result;
|
|
88
59
|
};
|
|
89
|
-
|
|
60
|
+
const generateHSL_S = (orientation, dir, alphaValue) => {
|
|
90
61
|
const result = {
|
|
91
62
|
areaStyles: {},
|
|
92
63
|
areaGradientStyles: {
|
|
@@ -99,7 +70,7 @@ var generateHSL_S = (orientation, dir, alphaValue) => {
|
|
|
99
70
|
};
|
|
100
71
|
return result;
|
|
101
72
|
};
|
|
102
|
-
|
|
73
|
+
const generateHSL_L = (orientation, dir, zValue) => {
|
|
103
74
|
const result = {
|
|
104
75
|
areaStyles: {},
|
|
105
76
|
areaGradientStyles: {
|
|
@@ -111,7 +82,7 @@ var generateHSL_L = (orientation, dir, zValue) => {
|
|
|
111
82
|
};
|
|
112
83
|
return result;
|
|
113
84
|
};
|
|
114
|
-
|
|
85
|
+
const generateHSB_H = (orientation, dir, zValue) => {
|
|
115
86
|
const result = {
|
|
116
87
|
areaStyles: {},
|
|
117
88
|
areaGradientStyles: {
|
|
@@ -124,7 +95,7 @@ var generateHSB_H = (orientation, dir, zValue) => {
|
|
|
124
95
|
};
|
|
125
96
|
return result;
|
|
126
97
|
};
|
|
127
|
-
|
|
98
|
+
const generateHSB_S = (orientation, dir, alphaValue) => {
|
|
128
99
|
const result = {
|
|
129
100
|
areaStyles: {},
|
|
130
101
|
areaGradientStyles: {
|
|
@@ -137,7 +108,7 @@ var generateHSB_S = (orientation, dir, alphaValue) => {
|
|
|
137
108
|
};
|
|
138
109
|
return result;
|
|
139
110
|
};
|
|
140
|
-
|
|
111
|
+
const generateHSB_B = (orientation, dir, alphaValue) => {
|
|
141
112
|
const result = {
|
|
142
113
|
areaStyles: {},
|
|
143
114
|
areaGradientStyles: {
|
|
@@ -150,15 +121,13 @@ var generateHSB_B = (orientation, dir, alphaValue) => {
|
|
|
150
121
|
};
|
|
151
122
|
return result;
|
|
152
123
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
generateRGB_R
|
|
164
|
-
});
|
|
124
|
+
|
|
125
|
+
exports.generateHSB_B = generateHSB_B;
|
|
126
|
+
exports.generateHSB_H = generateHSB_H;
|
|
127
|
+
exports.generateHSB_S = generateHSB_S;
|
|
128
|
+
exports.generateHSL_H = generateHSL_H;
|
|
129
|
+
exports.generateHSL_L = generateHSL_L;
|
|
130
|
+
exports.generateHSL_S = generateHSL_S;
|
|
131
|
+
exports.generateRGB_B = generateRGB_B;
|
|
132
|
+
exports.generateRGB_G = generateRGB_G;
|
|
133
|
+
exports.generateRGB_R = generateRGB_R;
|
|
@@ -1,22 +1,121 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
generateHSB_H,
|
|
15
|
-
generateHSB_S,
|
|
16
|
-
generateHSL_H,
|
|
17
|
-
generateHSL_L,
|
|
18
|
-
generateHSL_S,
|
|
19
|
-
generateRGB_B,
|
|
20
|
-
generateRGB_G,
|
|
21
|
-
generateRGB_R
|
|
1
|
+
const generateRGB_R = (orientation, dir, zValue) => {
|
|
2
|
+
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
3
|
+
const result = {
|
|
4
|
+
areaStyles: {
|
|
5
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,0),rgb(${zValue},255,0))`
|
|
6
|
+
},
|
|
7
|
+
areaGradientStyles: {
|
|
8
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,255),rgb(${zValue},255,255))`,
|
|
9
|
+
WebkitMaskImage: maskImage,
|
|
10
|
+
maskImage
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return result;
|
|
22
14
|
};
|
|
15
|
+
const generateRGB_G = (orientation, dir, zValue) => {
|
|
16
|
+
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
17
|
+
const result = {
|
|
18
|
+
areaStyles: {
|
|
19
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},0),rgb(255,${zValue},0))`
|
|
20
|
+
},
|
|
21
|
+
areaGradientStyles: {
|
|
22
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},255),rgb(255,${zValue},255))`,
|
|
23
|
+
WebkitMaskImage: maskImage,
|
|
24
|
+
maskImage
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
const generateRGB_B = (orientation, dir, zValue) => {
|
|
30
|
+
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
31
|
+
const result = {
|
|
32
|
+
areaStyles: {
|
|
33
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,0,${zValue}),rgb(255,0,${zValue}))`
|
|
34
|
+
},
|
|
35
|
+
areaGradientStyles: {
|
|
36
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,255,${zValue}),rgb(255,255,${zValue}))`,
|
|
37
|
+
WebkitMaskImage: maskImage,
|
|
38
|
+
maskImage
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
const generateHSL_H = (orientation, dir, zValue) => {
|
|
44
|
+
const result = {
|
|
45
|
+
areaStyles: {},
|
|
46
|
+
areaGradientStyles: {
|
|
47
|
+
background: [
|
|
48
|
+
`linear-gradient(to ${orientation[Number(dir)]}, hsla(0,0%,0%,1) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,1) 100%)`,
|
|
49
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,50%),hsla(0,0%,50%,0))`,
|
|
50
|
+
`hsl(${zValue}, 100%, 50%)`
|
|
51
|
+
].join(",")
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
const generateHSL_S = (orientation, dir, alphaValue) => {
|
|
57
|
+
const result = {
|
|
58
|
+
areaStyles: {},
|
|
59
|
+
areaGradientStyles: {
|
|
60
|
+
background: [
|
|
61
|
+
`linear-gradient(to ${orientation[Number(!dir)]}, hsla(0,0%,0%,${alphaValue}) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,${alphaValue}) 100%)`,
|
|
62
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
63
|
+
"hsl(0, 0%, 50%)"
|
|
64
|
+
].join(",")
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return result;
|
|
68
|
+
};
|
|
69
|
+
const generateHSL_L = (orientation, dir, zValue) => {
|
|
70
|
+
const result = {
|
|
71
|
+
areaStyles: {},
|
|
72
|
+
areaGradientStyles: {
|
|
73
|
+
backgroundImage: [
|
|
74
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,${zValue}%),hsla(0,0%,${zValue}%,0))`,
|
|
75
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsl(0,100%,${zValue}%),hsl(60,100%,${zValue}%),hsl(120,100%,${zValue}%),hsl(180,100%,${zValue}%),hsl(240,100%,${zValue}%),hsl(300,100%,${zValue}%),hsl(360,100%,${zValue}%))`
|
|
76
|
+
].join(",")
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
const generateHSB_H = (orientation, dir, zValue) => {
|
|
82
|
+
const result = {
|
|
83
|
+
areaStyles: {},
|
|
84
|
+
areaGradientStyles: {
|
|
85
|
+
background: [
|
|
86
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsl(0,0%,0%),hsla(0,0%,0%,0))`,
|
|
87
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,100%),hsla(0,0%,100%,0))`,
|
|
88
|
+
`hsl(${zValue}, 100%, 50%)`
|
|
89
|
+
].join(",")
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
const generateHSB_S = (orientation, dir, alphaValue) => {
|
|
95
|
+
const result = {
|
|
96
|
+
areaStyles: {},
|
|
97
|
+
areaGradientStyles: {
|
|
98
|
+
background: [
|
|
99
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,0%,${alphaValue}),hsla(0,0%,0%,0))`,
|
|
100
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
101
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,0%),hsl(0,0%,100%))`
|
|
102
|
+
].join(",")
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return result;
|
|
106
|
+
};
|
|
107
|
+
const generateHSB_B = (orientation, dir, alphaValue) => {
|
|
108
|
+
const result = {
|
|
109
|
+
areaStyles: {},
|
|
110
|
+
areaGradientStyles: {
|
|
111
|
+
background: [
|
|
112
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,100%,${alphaValue}),hsla(0,0%,100%,0))`,
|
|
113
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
114
|
+
"#000"
|
|
115
|
+
].join(",")
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
return result;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export { generateHSB_B, generateHSB_H, generateHSB_S, generateHSL_H, generateHSL_L, generateHSL_S, generateRGB_B, generateRGB_G, generateRGB_R };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function getChannelDetails(color: Color, xChannel: ColorChannel, yChannel: ColorChannel): {
|
|
5
|
-
channels: _zag_js_color_utils.ColorAxes;
|
|
1
|
+
import { ColorAxes, Color, type ColorChannel } from '@zag-js/color-utils';
|
|
2
|
+
export declare function getChannelDetails(color: Color, xChannel: ColorChannel, yChannel: ColorChannel): {
|
|
3
|
+
channels: ColorAxes;
|
|
6
4
|
xChannelStep: number;
|
|
7
5
|
yChannelStep: number;
|
|
8
6
|
xChannelPageStep: number;
|
|
@@ -19,5 +17,3 @@ declare function getChannelDetails(color: Color, xChannel: ColorChannel, yChanne
|
|
|
19
17
|
decrementY(stepSize: number): number;
|
|
20
18
|
getColorFromPoint(x: number, y: number): Color | undefined;
|
|
21
19
|
};
|
|
22
|
-
|
|
23
|
-
export { getChannelDetails };
|
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const numericRange = require('@zag-js/numeric-range');
|
|
19
6
|
|
|
20
|
-
// src/utils/get-channel-details.ts
|
|
21
|
-
var get_channel_details_exports = {};
|
|
22
|
-
__export(get_channel_details_exports, {
|
|
23
|
-
getChannelDetails: () => getChannelDetails
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(get_channel_details_exports);
|
|
26
|
-
var import_numeric_range = require("@zag-js/numeric-range");
|
|
27
7
|
function getChannelDetails(color, xChannel, yChannel) {
|
|
28
8
|
const channels = color.getColorSpaceAxes({ xChannel, yChannel });
|
|
29
9
|
const xChannelRange = color.getChannelRange(channels.xChannel);
|
|
@@ -46,34 +26,32 @@ function getChannelDetails(color, xChannel, yChannel) {
|
|
|
46
26
|
return { x, y };
|
|
47
27
|
},
|
|
48
28
|
incrementX(stepSize) {
|
|
49
|
-
return xValue + stepSize > maxValueX ? maxValueX :
|
|
29
|
+
return xValue + stepSize > maxValueX ? maxValueX : numericRange.snapValueToStep(xValue + stepSize, minValueX, maxValueX, stepX);
|
|
50
30
|
},
|
|
51
31
|
incrementY(stepSize) {
|
|
52
|
-
return yValue + stepSize > maxValueY ? maxValueY :
|
|
32
|
+
return yValue + stepSize > maxValueY ? maxValueY : numericRange.snapValueToStep(yValue + stepSize, minValueY, maxValueY, stepY);
|
|
53
33
|
},
|
|
54
34
|
decrementX(stepSize) {
|
|
55
|
-
return
|
|
35
|
+
return numericRange.snapValueToStep(xValue - stepSize, minValueX, maxValueX, stepX);
|
|
56
36
|
},
|
|
57
37
|
decrementY(stepSize) {
|
|
58
|
-
return
|
|
38
|
+
return numericRange.snapValueToStep(yValue - stepSize, minValueY, maxValueY, stepY);
|
|
59
39
|
},
|
|
60
40
|
getColorFromPoint(x, y) {
|
|
61
|
-
let newXValue =
|
|
62
|
-
let newYValue =
|
|
41
|
+
let newXValue = numericRange.getPercentValue(x, minValueX, maxValueX, stepX);
|
|
42
|
+
let newYValue = numericRange.getPercentValue(1 - y, minValueY, maxValueY, stepY);
|
|
63
43
|
let newColor;
|
|
64
44
|
if (newXValue !== xValue) {
|
|
65
|
-
newXValue =
|
|
45
|
+
newXValue = numericRange.snapValueToStep(newXValue, minValueX, maxValueX, stepX);
|
|
66
46
|
newColor = color.withChannelValue(channels.xChannel, newXValue);
|
|
67
47
|
}
|
|
68
48
|
if (newYValue !== yValue) {
|
|
69
|
-
newYValue =
|
|
49
|
+
newYValue = numericRange.snapValueToStep(newYValue, minValueY, maxValueY, stepY);
|
|
70
50
|
newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
|
|
71
51
|
}
|
|
72
52
|
return newColor;
|
|
73
53
|
}
|
|
74
54
|
};
|
|
75
55
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
getChannelDetails
|
|
79
|
-
});
|
|
56
|
+
|
|
57
|
+
exports.getChannelDetails = getChannelDetails;
|
|
@@ -1,6 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { snapValueToStep, getPercentValue } from '@zag-js/numeric-range';
|
|
2
|
+
|
|
3
|
+
function getChannelDetails(color, xChannel, yChannel) {
|
|
4
|
+
const channels = color.getColorSpaceAxes({ xChannel, yChannel });
|
|
5
|
+
const xChannelRange = color.getChannelRange(channels.xChannel);
|
|
6
|
+
const yChannelRange = color.getChannelRange(channels.yChannel);
|
|
7
|
+
const { minValue: minValueX, maxValue: maxValueX, step: stepX, pageSize: pageSizeX } = xChannelRange;
|
|
8
|
+
const { minValue: minValueY, maxValue: maxValueY, step: stepY, pageSize: pageSizeY } = yChannelRange;
|
|
9
|
+
const xValue = color.getChannelValue(channels.xChannel);
|
|
10
|
+
const yValue = color.getChannelValue(channels.yChannel);
|
|
11
|
+
return {
|
|
12
|
+
channels,
|
|
13
|
+
xChannelStep: stepX,
|
|
14
|
+
yChannelStep: stepY,
|
|
15
|
+
xChannelPageStep: pageSizeX,
|
|
16
|
+
yChannelPageStep: pageSizeY,
|
|
17
|
+
xValue,
|
|
18
|
+
yValue,
|
|
19
|
+
getThumbPosition() {
|
|
20
|
+
let x = (xValue - minValueX) / (maxValueX - minValueX);
|
|
21
|
+
let y = 1 - (yValue - minValueY) / (maxValueY - minValueY);
|
|
22
|
+
return { x, y };
|
|
23
|
+
},
|
|
24
|
+
incrementX(stepSize) {
|
|
25
|
+
return xValue + stepSize > maxValueX ? maxValueX : snapValueToStep(xValue + stepSize, minValueX, maxValueX, stepX);
|
|
26
|
+
},
|
|
27
|
+
incrementY(stepSize) {
|
|
28
|
+
return yValue + stepSize > maxValueY ? maxValueY : snapValueToStep(yValue + stepSize, minValueY, maxValueY, stepY);
|
|
29
|
+
},
|
|
30
|
+
decrementX(stepSize) {
|
|
31
|
+
return snapValueToStep(xValue - stepSize, minValueX, maxValueX, stepX);
|
|
32
|
+
},
|
|
33
|
+
decrementY(stepSize) {
|
|
34
|
+
return snapValueToStep(yValue - stepSize, minValueY, maxValueY, stepY);
|
|
35
|
+
},
|
|
36
|
+
getColorFromPoint(x, y) {
|
|
37
|
+
let newXValue = getPercentValue(x, minValueX, maxValueX, stepX);
|
|
38
|
+
let newYValue = getPercentValue(1 - y, minValueY, maxValueY, stepY);
|
|
39
|
+
let newColor;
|
|
40
|
+
if (newXValue !== xValue) {
|
|
41
|
+
newXValue = snapValueToStep(newXValue, minValueX, maxValueX, stepX);
|
|
42
|
+
newColor = color.withChannelValue(channels.xChannel, newXValue);
|
|
43
|
+
}
|
|
44
|
+
if (newYValue !== yValue) {
|
|
45
|
+
newYValue = snapValueToStep(newYValue, minValueY, maxValueY, stepY);
|
|
46
|
+
newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
|
|
47
|
+
}
|
|
48
|
+
return newColor;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { getChannelDetails };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare function getChannelDisplayColor(color: Color, channel: ColorChannel):
|
|
4
|
-
|
|
5
|
-
export { getChannelDisplayColor };
|
|
1
|
+
import { ColorType } from '@zag-js/color-utils/src/types';
|
|
2
|
+
import { Color, type ColorChannel } from "@zag-js/color-utils";
|
|
3
|
+
export declare function getChannelDisplayColor(color: Color, channel: ColorChannel): ColorType;
|
|
@@ -1,33 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const colorUtils = require('@zag-js/color-utils');
|
|
19
6
|
|
|
20
|
-
// src/utils/get-channel-display-color.ts
|
|
21
|
-
var get_channel_display_color_exports = {};
|
|
22
|
-
__export(get_channel_display_color_exports, {
|
|
23
|
-
getChannelDisplayColor: () => getChannelDisplayColor
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(get_channel_display_color_exports);
|
|
26
|
-
var import_color_utils = require("@zag-js/color-utils");
|
|
27
7
|
function getChannelDisplayColor(color, channel) {
|
|
28
8
|
switch (channel) {
|
|
29
9
|
case "hue":
|
|
30
|
-
return
|
|
10
|
+
return colorUtils.parseColor(`hsl(${color.getChannelValue("hue")}, 100%, 50%)`);
|
|
31
11
|
case "lightness":
|
|
32
12
|
case "brightness":
|
|
33
13
|
case "saturation":
|
|
@@ -42,7 +22,5 @@ function getChannelDisplayColor(color, channel) {
|
|
|
42
22
|
throw new Error("Unknown color channel: " + channel);
|
|
43
23
|
}
|
|
44
24
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
getChannelDisplayColor
|
|
48
|
-
});
|
|
25
|
+
|
|
26
|
+
exports.getChannelDisplayColor = getChannelDisplayColor;
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
1
|
+
import { parseColor } from '@zag-js/color-utils';
|
|
2
|
+
|
|
3
|
+
function getChannelDisplayColor(color, channel) {
|
|
4
|
+
switch (channel) {
|
|
5
|
+
case "hue":
|
|
6
|
+
return parseColor(`hsl(${color.getChannelValue("hue")}, 100%, 50%)`);
|
|
7
|
+
case "lightness":
|
|
8
|
+
case "brightness":
|
|
9
|
+
case "saturation":
|
|
10
|
+
case "red":
|
|
11
|
+
case "green":
|
|
12
|
+
case "blue":
|
|
13
|
+
return color.withChannelValue("alpha", 1);
|
|
14
|
+
case "alpha": {
|
|
15
|
+
return color;
|
|
16
|
+
}
|
|
17
|
+
default:
|
|
18
|
+
throw new Error("Unknown color channel: " + channel);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { getChannelDisplayColor };
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Color } from
|
|
3
|
-
import { ExtendedColorChannel } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare function getChannelInputValue(color: Color, channel: ExtendedColorChannel): string;
|
|
8
|
-
declare function getChannelInputRange(color: Color, channel: ExtendedColorChannel): _zag_js_color_utils_src_types.ColorChannelRange | undefined;
|
|
9
|
-
|
|
10
|
-
export { getChannelInputRange, getChannelInputValue };
|
|
1
|
+
import { ColorChannelRange } from '@zag-js/color-utils/src/types';
|
|
2
|
+
import { Color } from "@zag-js/color-utils";
|
|
3
|
+
import { ExtendedColorChannel } from "../color-picker.types";
|
|
4
|
+
export declare function getChannelInputValue(color: Color, channel: ExtendedColorChannel): string;
|
|
5
|
+
export declare function getChannelInputRange(color: Color, channel: ExtendedColorChannel): ColorChannelRange | undefined;
|