@react-stately/color 3.0.0-beta.7 → 3.0.0-beta.8
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/main.js +402 -244
- package/dist/main.js.map +1 -1
- package/dist/module.js +395 -239
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +55 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/Color.ts +16 -8
- package/src/index.ts +2 -1
- package/src/useColorAreaState.ts +217 -0
- package/src/useColorFieldState.ts +7 -4
- package/src/useColorSliderState.ts +6 -11
- package/src/useColorWheelState.ts +20 -21
package/dist/module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {clamp as $
|
|
2
|
-
import {MessageDictionary as $
|
|
3
|
-
import {NumberFormatter as $
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {clamp as $cBgAy$clamp, toFixedNumber as $cBgAy$toFixedNumber, useControlledState as $cBgAy$useControlledState, snapValueToStep as $cBgAy$snapValueToStep} from "@react-stately/utils";
|
|
2
|
+
import {MessageDictionary as $cBgAy$MessageDictionary} from "@internationalized/message";
|
|
3
|
+
import {NumberFormatter as $cBgAy$NumberFormatter} from "@internationalized/number";
|
|
4
|
+
import {useRef as $cBgAy$useRef, useMemo as $cBgAy$useMemo, useState as $cBgAy$useState} from "react";
|
|
5
|
+
import {useSliderState as $cBgAy$useSliderState} from "@react-stately/slider";
|
|
6
6
|
|
|
7
7
|
function $parcel$interopDefault(a) {
|
|
8
8
|
return a && a.__esModule ? a.default : a;
|
|
@@ -10,194 +10,195 @@ function $parcel$interopDefault(a) {
|
|
|
10
10
|
function $parcel$export(e, n, v, s) {
|
|
11
11
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
12
|
}
|
|
13
|
-
var $ed27c69866ff45f2$exports = {};
|
|
14
13
|
|
|
15
|
-
$
|
|
14
|
+
var $7a451c0c6841e6b9$exports = {};
|
|
15
|
+
var $2d805fd52bb48883$exports = {};
|
|
16
|
+
$2d805fd52bb48883$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
|
|
16
17
|
|
|
17
|
-
var $0374a82a32e1c8c8$exports = {};
|
|
18
|
-
var $f79cd856a93a8555$exports = {};
|
|
19
|
-
$f79cd856a93a8555$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
|
|
20
18
|
|
|
19
|
+
var $6c28468dc1df643c$exports = {};
|
|
20
|
+
$6c28468dc1df643c$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
|
|
21
21
|
|
|
22
|
-
var $0392c206ed1a088c$exports = {};
|
|
23
|
-
$0392c206ed1a088c$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
|
|
24
22
|
|
|
23
|
+
var $807554f8230db0ed$exports = {};
|
|
24
|
+
$807554f8230db0ed$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
|
|
25
25
|
|
|
26
|
-
var $7d0d490f8015f125$exports = {};
|
|
27
|
-
$7d0d490f8015f125$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
|
|
28
26
|
|
|
27
|
+
var $7097f64386f1761c$exports = {};
|
|
28
|
+
$7097f64386f1761c$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
|
|
29
29
|
|
|
30
|
-
var $d10fb5e7ed22c57f$exports = {};
|
|
31
|
-
$d10fb5e7ed22c57f$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
|
|
32
30
|
|
|
31
|
+
var $bdd847d8beb08799$exports = {};
|
|
32
|
+
$bdd847d8beb08799$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
|
|
33
33
|
|
|
34
|
-
var $d66a4b557c1b4b94$exports = {};
|
|
35
|
-
$d66a4b557c1b4b94$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
|
|
36
34
|
|
|
35
|
+
var $a53e00b683950971$exports = {};
|
|
36
|
+
$a53e00b683950971$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
|
|
37
37
|
|
|
38
|
-
var $9b0efe1614275e13$exports = {};
|
|
39
|
-
$9b0efe1614275e13$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
|
|
40
38
|
|
|
39
|
+
var $21cdd87e84f28d89$exports = {};
|
|
40
|
+
$21cdd87e84f28d89$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
|
|
41
41
|
|
|
42
|
-
var $c150b1de62e68b51$exports = {};
|
|
43
|
-
$c150b1de62e68b51$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
|
|
44
42
|
|
|
43
|
+
var $92fee9698e4d675a$exports = {};
|
|
44
|
+
$92fee9698e4d675a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
|
|
45
45
|
|
|
46
|
-
var $92da1a3ab873f3f3$exports = {};
|
|
47
|
-
$92da1a3ab873f3f3$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
|
|
48
46
|
|
|
47
|
+
var $7ea012e91a5ad3ee$exports = {};
|
|
48
|
+
$7ea012e91a5ad3ee$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
|
|
49
49
|
|
|
50
|
-
var $e39eccb2d120b0b3$exports = {};
|
|
51
|
-
$e39eccb2d120b0b3$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
|
|
52
50
|
|
|
51
|
+
var $8460c13bb2d75345$exports = {};
|
|
52
|
+
$8460c13bb2d75345$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
|
|
53
53
|
|
|
54
|
-
var $56489bc0134adb6a$exports = {};
|
|
55
|
-
$56489bc0134adb6a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
|
|
56
54
|
|
|
55
|
+
var $2a2d5dc14e680587$exports = {};
|
|
56
|
+
$2a2d5dc14e680587$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
|
|
57
57
|
|
|
58
|
-
var $aa6a5ed9d5efeb69$exports = {};
|
|
59
|
-
$aa6a5ed9d5efeb69$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
|
|
60
58
|
|
|
59
|
+
var $9a3f292371bb0589$exports = {};
|
|
60
|
+
$9a3f292371bb0589$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
|
|
61
61
|
|
|
62
|
-
var $51bf015ed0c73b08$exports = {};
|
|
63
|
-
$51bf015ed0c73b08$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
|
|
64
62
|
|
|
63
|
+
var $4742231a685fa068$exports = {};
|
|
64
|
+
$4742231a685fa068$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
|
|
65
65
|
|
|
66
|
-
var $861b4dcde21e078b$exports = {};
|
|
67
|
-
$861b4dcde21e078b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
|
|
68
66
|
|
|
67
|
+
var $05e247fd2960981e$exports = {};
|
|
68
|
+
$05e247fd2960981e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Kék\",\"brightness\":\"Fényesség\",\"green\":\"Zöld\",\"hue\":\"Színárnyalat\",\"lightness\":\"Világosság\",\"red\":\"Piros\",\"saturation\":\"Telítettség\"}");
|
|
69
69
|
|
|
70
|
-
var $8b004b0c6d72513e$exports = {};
|
|
71
|
-
$8b004b0c6d72513e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Kék\",\"brightness\":\"Fényesség\",\"green\":\"Zöld\",\"hue\":\"Színárnyalat\",\"lightness\":\"Világosság\",\"red\":\"Piros\",\"saturation\":\"Telítettség\"}");
|
|
72
70
|
|
|
71
|
+
var $a67524a79ccbe190$exports = {};
|
|
72
|
+
$a67524a79ccbe190$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
|
|
73
73
|
|
|
74
|
-
var $3eb66eb9579408ce$exports = {};
|
|
75
|
-
$3eb66eb9579408ce$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
|
|
76
74
|
|
|
75
|
+
var $a9eefe9d6c8cb7d5$exports = {};
|
|
76
|
+
$a9eefe9d6c8cb7d5$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
|
|
77
77
|
|
|
78
|
-
var $e8a554e99056d6bd$exports = {};
|
|
79
|
-
$e8a554e99056d6bd$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
|
|
80
78
|
|
|
79
|
+
var $4a6b836d4f1bfaba$exports = {};
|
|
80
|
+
$4a6b836d4f1bfaba$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
|
|
81
81
|
|
|
82
|
-
var $c63f256bb8c038c2$exports = {};
|
|
83
|
-
$c63f256bb8c038c2$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
|
|
84
82
|
|
|
83
|
+
var $c950e4b1c482abde$exports = {};
|
|
84
|
+
$c950e4b1c482abde$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
|
|
85
85
|
|
|
86
|
-
var $68505ef47b1ac6a7$exports = {};
|
|
87
|
-
$68505ef47b1ac6a7$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
|
|
88
86
|
|
|
87
|
+
var $d10d6b60dc50b438$exports = {};
|
|
88
|
+
$d10d6b60dc50b438$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
|
|
89
89
|
|
|
90
|
-
var $24cb133f20e85c27$exports = {};
|
|
91
|
-
$24cb133f20e85c27$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
|
|
92
90
|
|
|
91
|
+
var $371a732b2494f452$exports = {};
|
|
92
|
+
$371a732b2494f452$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
|
|
93
93
|
|
|
94
|
-
var $64f2745d4ddb954d$exports = {};
|
|
95
|
-
$64f2745d4ddb954d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
|
|
96
94
|
|
|
95
|
+
var $6d042cae6243464b$exports = {};
|
|
96
|
+
$6d042cae6243464b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
|
|
97
97
|
|
|
98
|
-
var $dcb8f13db15acdb8$exports = {};
|
|
99
|
-
$dcb8f13db15acdb8$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
|
|
100
98
|
|
|
99
|
+
var $d9ab5c2611e0bcd3$exports = {};
|
|
100
|
+
$d9ab5c2611e0bcd3$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
|
|
101
101
|
|
|
102
|
-
var $0ef596f59415b4bb$exports = {};
|
|
103
|
-
$0ef596f59415b4bb$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
|
|
104
102
|
|
|
103
|
+
var $73f77c9902e29ca6$exports = {};
|
|
104
|
+
$73f77c9902e29ca6$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
|
|
105
105
|
|
|
106
|
-
var $bbb5b83ca182b9e7$exports = {};
|
|
107
|
-
$bbb5b83ca182b9e7$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
|
|
108
106
|
|
|
107
|
+
var $4f461eb266a95c10$exports = {};
|
|
108
|
+
$4f461eb266a95c10$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
|
|
109
109
|
|
|
110
|
-
var $564e95b406d0dc84$exports = {};
|
|
111
|
-
$564e95b406d0dc84$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
|
|
112
110
|
|
|
111
|
+
var $dc46bea2f2597899$exports = {};
|
|
112
|
+
$dc46bea2f2597899$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
|
|
113
113
|
|
|
114
|
-
var $7eb3ecd9dc0320ab$exports = {};
|
|
115
|
-
$7eb3ecd9dc0320ab$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
|
|
116
114
|
|
|
115
|
+
var $622bbd6719cc95af$exports = {};
|
|
116
|
+
$622bbd6719cc95af$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
|
|
117
117
|
|
|
118
|
-
var $6752101738952fdb$exports = {};
|
|
119
|
-
$6752101738952fdb$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
|
|
120
118
|
|
|
119
|
+
var $4da03c1ecd9a9c7d$exports = {};
|
|
120
|
+
$4da03c1ecd9a9c7d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
|
|
121
121
|
|
|
122
|
-
var $27ed00b951516a4d$exports = {};
|
|
123
|
-
$27ed00b951516a4d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
|
|
124
122
|
|
|
123
|
+
var $edb6b2fe456ed4e8$exports = {};
|
|
124
|
+
$edb6b2fe456ed4e8$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
|
|
125
125
|
|
|
126
|
-
var $c0aa93444ae4b0ca$exports = {};
|
|
127
|
-
$c0aa93444ae4b0ca$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
|
|
128
126
|
|
|
127
|
+
var $264cd81c52b30815$exports = {};
|
|
128
|
+
$264cd81c52b30815$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
|
|
129
129
|
|
|
130
|
-
var $6809c66d997aaacf$exports = {};
|
|
131
|
-
$6809c66d997aaacf$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
|
|
132
130
|
|
|
131
|
+
var $6f80afde0270dda7$exports = {};
|
|
132
|
+
$6f80afde0270dda7$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
|
|
133
133
|
|
|
134
|
-
var $77839a6d0a465311$exports = {};
|
|
135
|
-
$77839a6d0a465311$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
|
|
136
134
|
|
|
135
|
+
var $23a92651c6957668$exports = {};
|
|
136
|
+
$23a92651c6957668$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mavi\",\"brightness\":\"Parlaklık\",\"green\":\"Yeşil\",\"hue\":\"Ton\",\"lightness\":\"Canlılık\",\"red\":\"Kırmızı\",\"saturation\":\"Doygunluk\"}");
|
|
137
137
|
|
|
138
|
-
var $5eb08cf4653400f5$exports = {};
|
|
139
|
-
$5eb08cf4653400f5$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mavi\",\"brightness\":\"Parlaklık\",\"green\":\"Yeşil\",\"hue\":\"Ton\",\"lightness\":\"Canlılık\",\"red\":\"Kırmızı\",\"saturation\":\"Doygunluk\"}");
|
|
140
138
|
|
|
139
|
+
var $0f9b1074d04f4954$exports = {};
|
|
140
|
+
$0f9b1074d04f4954$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
|
|
141
141
|
|
|
142
|
-
var $96079736d8339dc2$exports = {};
|
|
143
|
-
$96079736d8339dc2$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
|
|
144
142
|
|
|
143
|
+
var $a9cedf75b94e4916$exports = {};
|
|
144
|
+
$a9cedf75b94e4916$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
|
|
145
145
|
|
|
146
|
-
var $a1df1831dafc647a$exports = {};
|
|
147
|
-
$a1df1831dafc647a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
|
|
148
146
|
|
|
147
|
+
var $37cff576474bc8d4$exports = {};
|
|
148
|
+
$37cff576474bc8d4$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
|
|
149
149
|
|
|
150
|
-
var $28a02b1bdcc0138a$exports = {};
|
|
151
|
-
$28a02b1bdcc0138a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
|
|
152
150
|
|
|
153
|
-
|
|
154
|
-
$
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"pt-
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"zh-
|
|
188
|
-
"zh-TW": $28a02b1bdcc0138a$exports
|
|
151
|
+
$7a451c0c6841e6b9$exports = {
|
|
152
|
+
"ar-AE": $2d805fd52bb48883$exports,
|
|
153
|
+
"bg-BG": $6c28468dc1df643c$exports,
|
|
154
|
+
"cs-CZ": $807554f8230db0ed$exports,
|
|
155
|
+
"da-DK": $7097f64386f1761c$exports,
|
|
156
|
+
"de-DE": $bdd847d8beb08799$exports,
|
|
157
|
+
"el-GR": $a53e00b683950971$exports,
|
|
158
|
+
"en-US": $21cdd87e84f28d89$exports,
|
|
159
|
+
"es-ES": $92fee9698e4d675a$exports,
|
|
160
|
+
"et-EE": $7ea012e91a5ad3ee$exports,
|
|
161
|
+
"fi-FI": $8460c13bb2d75345$exports,
|
|
162
|
+
"fr-FR": $2a2d5dc14e680587$exports,
|
|
163
|
+
"he-IL": $9a3f292371bb0589$exports,
|
|
164
|
+
"hr-HR": $4742231a685fa068$exports,
|
|
165
|
+
"hu-HU": $05e247fd2960981e$exports,
|
|
166
|
+
"it-IT": $a67524a79ccbe190$exports,
|
|
167
|
+
"ja-JP": $a9eefe9d6c8cb7d5$exports,
|
|
168
|
+
"ko-KR": $4a6b836d4f1bfaba$exports,
|
|
169
|
+
"lt-LT": $c950e4b1c482abde$exports,
|
|
170
|
+
"lv-LV": $d10d6b60dc50b438$exports,
|
|
171
|
+
"nb-NO": $371a732b2494f452$exports,
|
|
172
|
+
"nl-NL": $6d042cae6243464b$exports,
|
|
173
|
+
"pl-PL": $d9ab5c2611e0bcd3$exports,
|
|
174
|
+
"pt-BR": $73f77c9902e29ca6$exports,
|
|
175
|
+
"pt-PT": $4f461eb266a95c10$exports,
|
|
176
|
+
"ro-RO": $dc46bea2f2597899$exports,
|
|
177
|
+
"ru-RU": $622bbd6719cc95af$exports,
|
|
178
|
+
"sk-SK": $4da03c1ecd9a9c7d$exports,
|
|
179
|
+
"sl-SI": $edb6b2fe456ed4e8$exports,
|
|
180
|
+
"sr-SP": $264cd81c52b30815$exports,
|
|
181
|
+
"sv-SE": $6f80afde0270dda7$exports,
|
|
182
|
+
"tr-TR": $23a92651c6957668$exports,
|
|
183
|
+
"uk-UA": $0f9b1074d04f4954$exports,
|
|
184
|
+
"zh-CN": $a9cedf75b94e4916$exports,
|
|
185
|
+
"zh-TW": $37cff576474bc8d4$exports
|
|
189
186
|
};
|
|
190
187
|
|
|
191
188
|
|
|
192
189
|
|
|
193
190
|
|
|
194
|
-
const $
|
|
195
|
-
function $
|
|
196
|
-
let res = $
|
|
191
|
+
const $799cddbef784668f$var$messages = new $cBgAy$MessageDictionary((/*@__PURE__*/$parcel$interopDefault($7a451c0c6841e6b9$exports)));
|
|
192
|
+
function $799cddbef784668f$export$6e865ea70d7724f(value) {
|
|
193
|
+
let res = $799cddbef784668f$var$RGBColor.parse(value) || $799cddbef784668f$var$HSBColor.parse(value) || $799cddbef784668f$var$HSLColor.parse(value);
|
|
197
194
|
if (res) return res;
|
|
198
195
|
throw new Error('Invalid color value: ' + value);
|
|
199
196
|
}
|
|
200
|
-
|
|
197
|
+
function $799cddbef784668f$export$4cde5df63f53f473(v) {
|
|
198
|
+
if (typeof v === 'string') return $799cddbef784668f$export$6e865ea70d7724f(v);
|
|
199
|
+
else return v;
|
|
200
|
+
}
|
|
201
|
+
class $799cddbef784668f$var$Color {
|
|
201
202
|
toHexInt() {
|
|
202
203
|
return this.toFormat('rgb').toHexInt();
|
|
203
204
|
}
|
|
@@ -214,36 +215,36 @@ class $ed27c69866ff45f2$var$Color {
|
|
|
214
215
|
throw new Error('Unsupported color channel: ' + channel);
|
|
215
216
|
}
|
|
216
217
|
getChannelName(channel, locale) {
|
|
217
|
-
return $
|
|
218
|
+
return $799cddbef784668f$var$messages.getStringForLocale(channel, locale);
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
|
-
const $
|
|
221
|
+
const $799cddbef784668f$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i;
|
|
221
222
|
// X = <negative/positive number with/without decimal places>
|
|
222
223
|
// before/after a comma, 0 or more whitespaces are allowed
|
|
223
224
|
// - rgb(X, X, X)
|
|
224
225
|
// - rgba(X, X, X, X)
|
|
225
|
-
const $
|
|
226
|
-
class $
|
|
226
|
+
const $799cddbef784668f$var$RGB_REGEX = /rgb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?)\)|rgba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d(.\d+)?)\)/;
|
|
227
|
+
class $799cddbef784668f$var$RGBColor extends $799cddbef784668f$var$Color {
|
|
227
228
|
static parse(value) {
|
|
228
229
|
let m;
|
|
229
|
-
if (m = value.match($
|
|
230
|
+
if (m = value.match($799cddbef784668f$var$HEX_REGEX)) {
|
|
230
231
|
if (m[1]) {
|
|
231
232
|
let r = parseInt(m[1][0] + m[1][0], 16);
|
|
232
233
|
let g = parseInt(m[1][1] + m[1][1], 16);
|
|
233
234
|
let b = parseInt(m[1][2] + m[1][2], 16);
|
|
234
|
-
return new $
|
|
235
|
+
return new $799cddbef784668f$var$RGBColor(r, g, b, 1);
|
|
235
236
|
} else if (m[2]) {
|
|
236
237
|
let r = parseInt(m[2][0] + m[2][1], 16);
|
|
237
238
|
let g = parseInt(m[2][2] + m[2][3], 16);
|
|
238
239
|
let b = parseInt(m[2][4] + m[2][5], 16);
|
|
239
|
-
return new $
|
|
240
|
+
return new $799cddbef784668f$var$RGBColor(r, g, b, 1);
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
|
-
if (m = value.match($
|
|
243
|
+
if (m = value.match($799cddbef784668f$var$RGB_REGEX)) {
|
|
243
244
|
var ref;
|
|
244
245
|
const [r, g, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim())
|
|
245
246
|
);
|
|
246
|
-
return new $
|
|
247
|
+
return new $799cddbef784668f$var$RGBColor($cBgAy$clamp(r, 0, 255), $cBgAy$clamp(g, 0, 255), $cBgAy$clamp(b, 0, 255), $cBgAy$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
toString(format) {
|
|
@@ -308,7 +309,7 @@ class $ed27c69866ff45f2$var$RGBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
308
309
|
}
|
|
309
310
|
hue /= 6;
|
|
310
311
|
}
|
|
311
|
-
return new $
|
|
312
|
+
return new $799cddbef784668f$var$HSBColor($cBgAy$toFixedNumber(hue * 360, 2), $cBgAy$toFixedNumber(saturation * 100, 2), $cBgAy$toFixedNumber(brightness * 100, 2), this.alpha);
|
|
312
313
|
}
|
|
313
314
|
/**
|
|
314
315
|
* Converts an RGB color value to HSL.
|
|
@@ -340,10 +341,10 @@ class $ed27c69866ff45f2$var$RGBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
340
341
|
}
|
|
341
342
|
hue /= 6;
|
|
342
343
|
}
|
|
343
|
-
return new $
|
|
344
|
+
return new $799cddbef784668f$var$HSLColor($cBgAy$toFixedNumber(hue * 360, 2), $cBgAy$toFixedNumber(saturation * 100, 2), $cBgAy$toFixedNumber(lightness * 100, 2), this.alpha);
|
|
344
345
|
}
|
|
345
346
|
clone() {
|
|
346
|
-
return new $
|
|
347
|
+
return new $799cddbef784668f$var$RGBColor(this.red, this.green, this.blue, this.alpha);
|
|
347
348
|
}
|
|
348
349
|
getChannelRange(channel) {
|
|
349
350
|
switch(channel){
|
|
@@ -353,13 +354,15 @@ class $ed27c69866ff45f2$var$RGBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
353
354
|
return {
|
|
354
355
|
minValue: 0,
|
|
355
356
|
maxValue: 255,
|
|
356
|
-
step: 1
|
|
357
|
+
step: 1,
|
|
358
|
+
pageSize: 17
|
|
357
359
|
};
|
|
358
360
|
case 'alpha':
|
|
359
361
|
return {
|
|
360
362
|
minValue: 0,
|
|
361
363
|
maxValue: 1,
|
|
362
|
-
step: 0.01
|
|
364
|
+
step: 0.01,
|
|
365
|
+
pageSize: 0.1
|
|
363
366
|
};
|
|
364
367
|
default:
|
|
365
368
|
throw new Error('Unknown color channel: ' + channel);
|
|
@@ -384,7 +387,7 @@ class $ed27c69866ff45f2$var$RGBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
384
387
|
default:
|
|
385
388
|
throw new Error('Unknown color channel: ' + channel);
|
|
386
389
|
}
|
|
387
|
-
return new $
|
|
390
|
+
return new $cBgAy$NumberFormatter(locale, options).format(value);
|
|
388
391
|
}
|
|
389
392
|
getColorSpace() {
|
|
390
393
|
return 'rgb';
|
|
@@ -401,15 +404,15 @@ class $ed27c69866ff45f2$var$RGBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
401
404
|
// before/after a comma, 0 or more whitespaces are allowed
|
|
402
405
|
// - hsb(X, X%, X%)
|
|
403
406
|
// - hsba(X, X%, X%, X)
|
|
404
|
-
const $
|
|
405
|
-
class $
|
|
407
|
+
const $799cddbef784668f$var$HSB_REGEX = /hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
|
|
408
|
+
class $799cddbef784668f$var$HSBColor extends $799cddbef784668f$var$Color {
|
|
406
409
|
static parse(value) {
|
|
407
410
|
let m;
|
|
408
|
-
if (m = value.match($
|
|
411
|
+
if (m = value.match($799cddbef784668f$var$HSB_REGEX)) {
|
|
409
412
|
var ref;
|
|
410
413
|
const [h, s, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
|
|
411
414
|
);
|
|
412
|
-
return new $
|
|
415
|
+
return new $799cddbef784668f$var$HSBColor($799cddbef784668f$var$mod(h, 360), $cBgAy$clamp(s, 0, 100), $cBgAy$clamp(b, 0, 100), $cBgAy$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
|
|
413
416
|
}
|
|
414
417
|
}
|
|
415
418
|
toString(format) {
|
|
@@ -421,9 +424,9 @@ class $ed27c69866ff45f2$var$HSBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
421
424
|
case 'hexa':
|
|
422
425
|
return this.toRGB().toString('hexa');
|
|
423
426
|
case 'hsb':
|
|
424
|
-
return `hsb(${this.hue}, ${$
|
|
427
|
+
return `hsb(${this.hue}, ${$cBgAy$toFixedNumber(this.saturation, 2)}%, ${$cBgAy$toFixedNumber(this.brightness, 2)}%)`;
|
|
425
428
|
case 'hsba':
|
|
426
|
-
return `hsba(${this.hue}, ${$
|
|
429
|
+
return `hsba(${this.hue}, ${$cBgAy$toFixedNumber(this.saturation, 2)}%, ${$cBgAy$toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;
|
|
427
430
|
default:
|
|
428
431
|
return this.toFormat(format).toString(format);
|
|
429
432
|
}
|
|
@@ -452,7 +455,7 @@ class $ed27c69866ff45f2$var$HSBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
452
455
|
let brightness = this.brightness / 100;
|
|
453
456
|
let lightness = brightness * (1 - saturation / 2);
|
|
454
457
|
saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
|
|
455
|
-
return new $
|
|
458
|
+
return new $799cddbef784668f$var$HSLColor($cBgAy$toFixedNumber(this.hue, 2), $cBgAy$toFixedNumber(saturation * 100, 2), $cBgAy$toFixedNumber(lightness * 100, 2), this.alpha);
|
|
456
459
|
}
|
|
457
460
|
/**
|
|
458
461
|
* Converts a HSV color value to RGB.
|
|
@@ -464,10 +467,10 @@ class $ed27c69866ff45f2$var$HSBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
464
467
|
let brightness = this.brightness / 100;
|
|
465
468
|
let fn = (n, k = (n + hue / 60) % 6)=>brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0)
|
|
466
469
|
;
|
|
467
|
-
return new $
|
|
470
|
+
return new $799cddbef784668f$var$RGBColor(Math.round(fn(5) * 255), Math.round(fn(3) * 255), Math.round(fn(1) * 255), this.alpha);
|
|
468
471
|
}
|
|
469
472
|
clone() {
|
|
470
|
-
return new $
|
|
473
|
+
return new $799cddbef784668f$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
|
|
471
474
|
}
|
|
472
475
|
getChannelRange(channel) {
|
|
473
476
|
switch(channel){
|
|
@@ -475,20 +478,23 @@ class $ed27c69866ff45f2$var$HSBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
475
478
|
return {
|
|
476
479
|
minValue: 0,
|
|
477
480
|
maxValue: 360,
|
|
478
|
-
step: 1
|
|
481
|
+
step: 1,
|
|
482
|
+
pageSize: 15
|
|
479
483
|
};
|
|
480
484
|
case 'saturation':
|
|
481
485
|
case 'brightness':
|
|
482
486
|
return {
|
|
483
487
|
minValue: 0,
|
|
484
488
|
maxValue: 100,
|
|
485
|
-
step: 1
|
|
489
|
+
step: 1,
|
|
490
|
+
pageSize: 10
|
|
486
491
|
};
|
|
487
492
|
case 'alpha':
|
|
488
493
|
return {
|
|
489
494
|
minValue: 0,
|
|
490
495
|
maxValue: 1,
|
|
491
|
-
step: 0.01
|
|
496
|
+
step: 0.01,
|
|
497
|
+
pageSize: 0.1
|
|
492
498
|
};
|
|
493
499
|
default:
|
|
494
500
|
throw new Error('Unknown color channel: ' + channel);
|
|
@@ -520,7 +526,7 @@ class $ed27c69866ff45f2$var$HSBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
520
526
|
default:
|
|
521
527
|
throw new Error('Unknown color channel: ' + channel);
|
|
522
528
|
}
|
|
523
|
-
return new $
|
|
529
|
+
return new $cBgAy$NumberFormatter(locale, options).format(value);
|
|
524
530
|
}
|
|
525
531
|
getColorSpace() {
|
|
526
532
|
return 'hsb';
|
|
@@ -537,18 +543,18 @@ class $ed27c69866ff45f2$var$HSBColor extends $ed27c69866ff45f2$var$Color {
|
|
|
537
543
|
// before/after a comma, 0 or more whitespaces are allowed
|
|
538
544
|
// - hsl(X, X%, X%)
|
|
539
545
|
// - hsla(X, X%, X%, X)
|
|
540
|
-
const $
|
|
541
|
-
function $
|
|
546
|
+
const $799cddbef784668f$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+)?)\)/;
|
|
547
|
+
function $799cddbef784668f$var$mod(n, m) {
|
|
542
548
|
return (n % m + m) % m;
|
|
543
549
|
}
|
|
544
|
-
class $
|
|
550
|
+
class $799cddbef784668f$var$HSLColor extends $799cddbef784668f$var$Color {
|
|
545
551
|
static parse(value) {
|
|
546
552
|
let m;
|
|
547
|
-
if (m = value.match($
|
|
553
|
+
if (m = value.match($799cddbef784668f$var$HSL_REGEX)) {
|
|
548
554
|
var ref;
|
|
549
555
|
const [h, s, l, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
|
|
550
556
|
);
|
|
551
|
-
return new $
|
|
557
|
+
return new $799cddbef784668f$var$HSLColor($799cddbef784668f$var$mod(h, 360), $cBgAy$clamp(s, 0, 100), $cBgAy$clamp(l, 0, 100), $cBgAy$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
|
|
552
558
|
}
|
|
553
559
|
}
|
|
554
560
|
toString(format) {
|
|
@@ -558,10 +564,10 @@ class $ed27c69866ff45f2$var$HSLColor extends $ed27c69866ff45f2$var$Color {
|
|
|
558
564
|
case 'hexa':
|
|
559
565
|
return this.toRGB().toString('hexa');
|
|
560
566
|
case 'hsl':
|
|
561
|
-
return `hsl(${this.hue}, ${$
|
|
567
|
+
return `hsl(${this.hue}, ${$cBgAy$toFixedNumber(this.saturation, 2)}%, ${$cBgAy$toFixedNumber(this.lightness, 2)}%)`;
|
|
562
568
|
case 'css':
|
|
563
569
|
case 'hsla':
|
|
564
|
-
return `hsla(${this.hue}, ${$
|
|
570
|
+
return `hsla(${this.hue}, ${$cBgAy$toFixedNumber(this.saturation, 2)}%, ${$cBgAy$toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
|
|
565
571
|
default:
|
|
566
572
|
return this.toFormat(format).toString(format);
|
|
567
573
|
}
|
|
@@ -590,7 +596,7 @@ class $ed27c69866ff45f2$var$HSLColor extends $ed27c69866ff45f2$var$Color {
|
|
|
590
596
|
let lightness = this.lightness / 100;
|
|
591
597
|
let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
|
|
592
598
|
saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
|
|
593
|
-
return new $
|
|
599
|
+
return new $799cddbef784668f$var$HSBColor($cBgAy$toFixedNumber(this.hue, 2), $cBgAy$toFixedNumber(saturation * 100, 2), $cBgAy$toFixedNumber(brightness * 100, 2), this.alpha);
|
|
594
600
|
}
|
|
595
601
|
/**
|
|
596
602
|
* Converts a HSL color to RGB.
|
|
@@ -603,10 +609,10 @@ class $ed27c69866ff45f2$var$HSLColor extends $ed27c69866ff45f2$var$Color {
|
|
|
603
609
|
let a = saturation * Math.min(lightness, 1 - lightness);
|
|
604
610
|
let fn = (n, k = (n + hue / 30) % 12)=>lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
|
|
605
611
|
;
|
|
606
|
-
return new $
|
|
612
|
+
return new $799cddbef784668f$var$RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), this.alpha);
|
|
607
613
|
}
|
|
608
614
|
clone() {
|
|
609
|
-
return new $
|
|
615
|
+
return new $799cddbef784668f$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
|
|
610
616
|
}
|
|
611
617
|
getChannelRange(channel) {
|
|
612
618
|
switch(channel){
|
|
@@ -614,20 +620,23 @@ class $ed27c69866ff45f2$var$HSLColor extends $ed27c69866ff45f2$var$Color {
|
|
|
614
620
|
return {
|
|
615
621
|
minValue: 0,
|
|
616
622
|
maxValue: 360,
|
|
617
|
-
step: 1
|
|
623
|
+
step: 1,
|
|
624
|
+
pageSize: 15
|
|
618
625
|
};
|
|
619
626
|
case 'saturation':
|
|
620
627
|
case 'lightness':
|
|
621
628
|
return {
|
|
622
629
|
minValue: 0,
|
|
623
630
|
maxValue: 100,
|
|
624
|
-
step: 1
|
|
631
|
+
step: 1,
|
|
632
|
+
pageSize: 10
|
|
625
633
|
};
|
|
626
634
|
case 'alpha':
|
|
627
635
|
return {
|
|
628
636
|
minValue: 0,
|
|
629
637
|
maxValue: 1,
|
|
630
|
-
step: 0.01
|
|
638
|
+
step: 0.01,
|
|
639
|
+
pageSize: 0.1
|
|
631
640
|
};
|
|
632
641
|
default:
|
|
633
642
|
throw new Error('Unknown color channel: ' + channel);
|
|
@@ -659,7 +668,7 @@ class $ed27c69866ff45f2$var$HSLColor extends $ed27c69866ff45f2$var$Color {
|
|
|
659
668
|
default:
|
|
660
669
|
throw new Error('Unknown color channel: ' + channel);
|
|
661
670
|
}
|
|
662
|
-
return new $
|
|
671
|
+
return new $cBgAy$NumberFormatter(locale, options).format(value);
|
|
663
672
|
}
|
|
664
673
|
getColorSpace() {
|
|
665
674
|
return 'hsl';
|
|
@@ -674,21 +683,164 @@ class $ed27c69866ff45f2$var$HSLColor extends $ed27c69866ff45f2$var$Color {
|
|
|
674
683
|
}
|
|
675
684
|
|
|
676
685
|
|
|
677
|
-
var $
|
|
686
|
+
var $6e14a98a7f67141d$exports = {};
|
|
678
687
|
|
|
679
|
-
$parcel$export($
|
|
688
|
+
$parcel$export($6e14a98a7f67141d$exports, "useColorAreaState", () => $6e14a98a7f67141d$export$6df7f0e2cabc7eef);
|
|
680
689
|
|
|
681
690
|
|
|
682
691
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
692
|
+
const $6e14a98a7f67141d$var$DEFAULT_COLOR = $799cddbef784668f$export$6e865ea70d7724f('#ffffff');
|
|
693
|
+
const $6e14a98a7f67141d$var$RGBSet = new Set([
|
|
694
|
+
'red',
|
|
695
|
+
'green',
|
|
696
|
+
'blue'
|
|
697
|
+
]);
|
|
698
|
+
let $6e14a98a7f67141d$var$difference = (a, b)=>new Set([
|
|
699
|
+
...a
|
|
700
|
+
].filter((x)=>!b.has(x)
|
|
701
|
+
))
|
|
702
|
+
;
|
|
703
|
+
function $6e14a98a7f67141d$export$6df7f0e2cabc7eef(props) {
|
|
704
|
+
let { value: value1 , defaultValue: defaultValue , xChannel: xChannel , yChannel: yChannel , onChange: onChange , onChangeEnd: onChangeEnd } = props;
|
|
705
|
+
if (!value1 && !defaultValue) defaultValue = $6e14a98a7f67141d$var$DEFAULT_COLOR;
|
|
706
|
+
let [color, setColor] = $cBgAy$useControlledState(value1 && $799cddbef784668f$export$4cde5df63f53f473(value1), defaultValue && $799cddbef784668f$export$4cde5df63f53f473(defaultValue), onChange);
|
|
707
|
+
let valueRef = $cBgAy$useRef(color);
|
|
708
|
+
valueRef.current = color;
|
|
709
|
+
let channels = $cBgAy$useMemo(()=>{
|
|
710
|
+
if (!xChannel) switch(yChannel){
|
|
711
|
+
case 'red':
|
|
712
|
+
case 'green':
|
|
713
|
+
xChannel = 'blue';
|
|
714
|
+
break;
|
|
715
|
+
case 'blue':
|
|
716
|
+
xChannel = 'red';
|
|
717
|
+
break;
|
|
718
|
+
default:
|
|
719
|
+
xChannel = 'blue';
|
|
720
|
+
yChannel = 'green';
|
|
721
|
+
}
|
|
722
|
+
else if (!yChannel) switch(xChannel){
|
|
723
|
+
case 'red':
|
|
724
|
+
yChannel = 'green';
|
|
725
|
+
break;
|
|
726
|
+
case 'blue':
|
|
727
|
+
yChannel = 'red';
|
|
728
|
+
break;
|
|
729
|
+
default:
|
|
730
|
+
xChannel = 'blue';
|
|
731
|
+
yChannel = 'green';
|
|
732
|
+
}
|
|
733
|
+
let xyChannels = new Set([
|
|
734
|
+
xChannel,
|
|
735
|
+
yChannel
|
|
736
|
+
]);
|
|
737
|
+
let zChannel = $6e14a98a7f67141d$var$difference($6e14a98a7f67141d$var$RGBSet, xyChannels).values().next().value;
|
|
738
|
+
return {
|
|
739
|
+
xChannel: xChannel,
|
|
740
|
+
yChannel: yChannel,
|
|
741
|
+
zChannel: zChannel
|
|
742
|
+
};
|
|
743
|
+
}, [
|
|
744
|
+
xChannel,
|
|
745
|
+
yChannel
|
|
746
|
+
]);
|
|
747
|
+
let xChannelRange = color.getChannelRange(channels.xChannel);
|
|
748
|
+
let yChannelRange = color.getChannelRange(channels.yChannel);
|
|
749
|
+
let { minValue: minValueX1 , maxValue: maxValueX1 , step: stepX , pageSize: pageSizeX } = xChannelRange;
|
|
750
|
+
let { minValue: minValueY1 , maxValue: maxValueY1 , step: stepY , pageSize: pageSizeY } = yChannelRange;
|
|
751
|
+
let [isDragging1, setDragging] = $cBgAy$useState(false);
|
|
752
|
+
let isDraggingRef = $cBgAy$useRef(false).current;
|
|
753
|
+
let xValue = color.getChannelValue(channels.xChannel);
|
|
754
|
+
let yValue = color.getChannelValue(channels.yChannel);
|
|
755
|
+
let setXValue = (v)=>{
|
|
756
|
+
if (v === xValue) return;
|
|
757
|
+
valueRef.current = color.withChannelValue(channels.xChannel, v);
|
|
758
|
+
setColor(valueRef.current);
|
|
759
|
+
};
|
|
760
|
+
let setYValue = (v)=>{
|
|
761
|
+
if (v === yValue) return;
|
|
762
|
+
valueRef.current = color.withChannelValue(channels.yChannel, v);
|
|
763
|
+
setColor(valueRef.current);
|
|
764
|
+
};
|
|
765
|
+
return {
|
|
766
|
+
channels: channels,
|
|
767
|
+
xChannelStep: stepX,
|
|
768
|
+
yChannelStep: stepY,
|
|
769
|
+
xChannelPageStep: pageSizeX,
|
|
770
|
+
yChannelPageStep: pageSizeY,
|
|
771
|
+
value: color,
|
|
772
|
+
setValue (value) {
|
|
773
|
+
let c = $799cddbef784668f$export$4cde5df63f53f473(value);
|
|
774
|
+
valueRef.current = c;
|
|
775
|
+
setColor(c);
|
|
776
|
+
},
|
|
777
|
+
xValue: xValue,
|
|
778
|
+
setXValue: setXValue,
|
|
779
|
+
yValue: yValue,
|
|
780
|
+
setYValue: setYValue,
|
|
781
|
+
setColorFromPoint (x, y) {
|
|
782
|
+
let { minValue: minValueX , maxValue: maxValueX } = color.getChannelRange(channels.xChannel);
|
|
783
|
+
let { minValue: minValueY , maxValue: maxValueY } = color.getChannelRange(channels.yChannel);
|
|
784
|
+
let newXValue = minValueX + $cBgAy$clamp(x, 0, 1) * (maxValueX - minValueX);
|
|
785
|
+
let newYValue = minValueY + (1 - $cBgAy$clamp(y, 0, 1)) * (maxValueY - minValueY);
|
|
786
|
+
let newColor;
|
|
787
|
+
if (newXValue !== xValue) {
|
|
788
|
+
// Round new value to multiple of step, clamp value between min and max
|
|
789
|
+
newXValue = $cBgAy$snapValueToStep(newXValue, minValueX, maxValueX, stepX);
|
|
790
|
+
newColor = color.withChannelValue(channels.xChannel, newXValue);
|
|
791
|
+
}
|
|
792
|
+
if (newYValue !== yValue) {
|
|
793
|
+
// Round new value to multiple of step, clamp value between min and max
|
|
794
|
+
newYValue = $cBgAy$snapValueToStep(newYValue, minValueY, maxValueY, stepY);
|
|
795
|
+
newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
|
|
796
|
+
}
|
|
797
|
+
if (newColor) setColor(newColor);
|
|
798
|
+
},
|
|
799
|
+
getThumbPosition () {
|
|
800
|
+
let x = (xValue - minValueX1) / (maxValueX1 - minValueX1);
|
|
801
|
+
let y = 1 - (yValue - minValueY1) / (maxValueY1 - minValueY1);
|
|
802
|
+
return {
|
|
803
|
+
x: x,
|
|
804
|
+
y: y
|
|
805
|
+
};
|
|
806
|
+
},
|
|
807
|
+
incrementX (stepSize) {
|
|
808
|
+
setXValue(xValue + stepSize > maxValueX1 ? maxValueX1 : $cBgAy$snapValueToStep(xValue + stepSize, minValueX1, maxValueX1, stepX));
|
|
809
|
+
},
|
|
810
|
+
incrementY (stepSize) {
|
|
811
|
+
setYValue(yValue + stepSize > maxValueY1 ? maxValueY1 : $cBgAy$snapValueToStep(yValue + stepSize, minValueY1, maxValueY1, stepY));
|
|
812
|
+
},
|
|
813
|
+
decrementX (stepSize) {
|
|
814
|
+
setXValue($cBgAy$snapValueToStep(xValue - stepSize, minValueX1, maxValueX1, stepX));
|
|
815
|
+
},
|
|
816
|
+
decrementY (stepSize) {
|
|
817
|
+
setYValue($cBgAy$snapValueToStep(yValue - stepSize, minValueY1, maxValueY1, stepY));
|
|
818
|
+
},
|
|
819
|
+
setDragging (isDragging) {
|
|
820
|
+
let wasDragging = isDraggingRef;
|
|
821
|
+
isDraggingRef = isDragging;
|
|
822
|
+
if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
|
|
823
|
+
setDragging(isDragging);
|
|
824
|
+
},
|
|
825
|
+
isDragging: isDragging1,
|
|
826
|
+
getDisplayColor () {
|
|
827
|
+
return color.withChannelValue('alpha', 1);
|
|
828
|
+
}
|
|
829
|
+
};
|
|
686
830
|
}
|
|
687
|
-
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
var $25a25ac0d1624665$exports = {};
|
|
834
|
+
|
|
835
|
+
$parcel$export($25a25ac0d1624665$exports, "useColorSliderState", () => $25a25ac0d1624665$export$57bc203e1c9c6d44);
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
function $25a25ac0d1624665$export$57bc203e1c9c6d44(props) {
|
|
688
840
|
let { channel: channel , value: value1 , defaultValue: defaultValue , onChange: onChange , locale: locale , ...otherProps } = props;
|
|
689
841
|
if (value1 == null && defaultValue == null) throw new Error('useColorSliderState requires a value or defaultValue');
|
|
690
|
-
let [color, setColor] = $
|
|
691
|
-
let sliderState = $
|
|
842
|
+
let [color, setColor] = $cBgAy$useControlledState(value1 && $799cddbef784668f$export$4cde5df63f53f473(value1), defaultValue && $799cddbef784668f$export$4cde5df63f53f473(defaultValue), onChange);
|
|
843
|
+
let sliderState = $cBgAy$useSliderState({
|
|
692
844
|
...color.getChannelRange(channel),
|
|
693
845
|
...otherProps,
|
|
694
846
|
// Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
|
|
@@ -700,20 +852,21 @@ function $3d60b153dd2f1b1b$export$57bc203e1c9c6d44(props) {
|
|
|
700
852
|
setColor(color.withChannelValue(channel, v));
|
|
701
853
|
},
|
|
702
854
|
onChangeEnd ([v]) {
|
|
703
|
-
// onChange will have already been called with the right value, this is just to trigger
|
|
855
|
+
// onChange will have already been called with the right value, this is just to trigger onChangeEnd
|
|
704
856
|
if (props.onChangeEnd) props.onChangeEnd(color.withChannelValue(channel, v));
|
|
705
857
|
}
|
|
706
858
|
});
|
|
859
|
+
let { step: step , pageSize: pageSize } = color.getChannelRange(channel);
|
|
707
860
|
return {
|
|
708
861
|
...sliderState,
|
|
709
862
|
value: color,
|
|
710
863
|
setValue (value) {
|
|
711
|
-
setColor($
|
|
864
|
+
setColor($799cddbef784668f$export$4cde5df63f53f473(value));
|
|
712
865
|
},
|
|
713
866
|
getDisplayColor () {
|
|
714
867
|
switch(channel){
|
|
715
868
|
case 'hue':
|
|
716
|
-
return $
|
|
869
|
+
return $799cddbef784668f$export$6e865ea70d7724f(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
|
|
717
870
|
case 'lightness':
|
|
718
871
|
case 'brightness':
|
|
719
872
|
case 'saturation':
|
|
@@ -729,42 +882,40 @@ function $3d60b153dd2f1b1b$export$57bc203e1c9c6d44(props) {
|
|
|
729
882
|
},
|
|
730
883
|
getThumbValueLabel () {
|
|
731
884
|
return color.formatChannelValue(channel, locale);
|
|
732
|
-
}
|
|
885
|
+
},
|
|
886
|
+
step: step,
|
|
887
|
+
pageSize: pageSize
|
|
733
888
|
};
|
|
734
889
|
}
|
|
735
890
|
|
|
736
891
|
|
|
737
|
-
var $
|
|
892
|
+
var $ee4262c74a467b07$exports = {};
|
|
738
893
|
|
|
739
|
-
$parcel$export($
|
|
894
|
+
$parcel$export($ee4262c74a467b07$exports, "useColorWheelState", () => $ee4262c74a467b07$export$f4301076d9336137);
|
|
740
895
|
|
|
741
896
|
|
|
742
897
|
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
else return v;
|
|
746
|
-
}
|
|
747
|
-
const $2b492d761166c9cc$var$DEFAULT_COLOR = $ed27c69866ff45f2$export$6e865ea70d7724f('hsl(0, 100%, 50%)');
|
|
748
|
-
function $2b492d761166c9cc$var$roundToStep(value, step) {
|
|
898
|
+
const $ee4262c74a467b07$var$DEFAULT_COLOR = $799cddbef784668f$export$6e865ea70d7724f('hsl(0, 100%, 50%)');
|
|
899
|
+
function $ee4262c74a467b07$var$roundToStep(value, step) {
|
|
749
900
|
return Math.round(value / step) * step;
|
|
750
901
|
}
|
|
751
|
-
function $
|
|
902
|
+
function $ee4262c74a467b07$var$mod(n, m) {
|
|
752
903
|
return (n % m + m) % m;
|
|
753
904
|
}
|
|
754
|
-
function $
|
|
905
|
+
function $ee4262c74a467b07$var$roundDown(v) {
|
|
755
906
|
let r = Math.floor(v);
|
|
756
907
|
if (r === v) return v - 1;
|
|
757
908
|
else return r;
|
|
758
909
|
}
|
|
759
|
-
function $
|
|
910
|
+
function $ee4262c74a467b07$var$degToRad(deg) {
|
|
760
911
|
return deg * Math.PI / 180;
|
|
761
912
|
}
|
|
762
|
-
function $
|
|
913
|
+
function $ee4262c74a467b07$var$radToDeg(rad) {
|
|
763
914
|
return rad * 180 / Math.PI;
|
|
764
915
|
}
|
|
765
916
|
// 0deg = 3 o'clock. increases clockwise
|
|
766
|
-
function $
|
|
767
|
-
let rad = $
|
|
917
|
+
function $ee4262c74a467b07$var$angleToCartesian(angle, radius) {
|
|
918
|
+
let rad = $ee4262c74a467b07$var$degToRad(360 - angle + 90);
|
|
768
919
|
let x = Math.sin(rad) * radius;
|
|
769
920
|
let y = Math.cos(rad) * radius;
|
|
770
921
|
return {
|
|
@@ -772,23 +923,25 @@ function $2b492d761166c9cc$var$angleToCartesian(angle, radius) {
|
|
|
772
923
|
y: y
|
|
773
924
|
};
|
|
774
925
|
}
|
|
775
|
-
function $
|
|
776
|
-
let deg = $
|
|
926
|
+
function $ee4262c74a467b07$var$cartesianToAngle(x, y, radius) {
|
|
927
|
+
let deg = $ee4262c74a467b07$var$radToDeg(Math.atan2(y / radius, x / radius));
|
|
777
928
|
return (deg + 360) % 360;
|
|
778
929
|
}
|
|
779
|
-
function $
|
|
780
|
-
let { defaultValue: defaultValue , onChange: onChange , onChangeEnd: onChangeEnd
|
|
781
|
-
if (!props.value && !defaultValue) defaultValue = $
|
|
782
|
-
let [value, setValue] = $
|
|
783
|
-
let valueRef = $
|
|
930
|
+
function $ee4262c74a467b07$export$f4301076d9336137(props) {
|
|
931
|
+
let { defaultValue: defaultValue , onChange: onChange , onChangeEnd: onChangeEnd } = props;
|
|
932
|
+
if (!props.value && !defaultValue) defaultValue = $ee4262c74a467b07$var$DEFAULT_COLOR;
|
|
933
|
+
let [value, setValue] = $cBgAy$useControlledState($799cddbef784668f$export$4cde5df63f53f473(props.value), $799cddbef784668f$export$4cde5df63f53f473(defaultValue), onChange);
|
|
934
|
+
let valueRef = $cBgAy$useRef(value);
|
|
784
935
|
valueRef.current = value;
|
|
785
|
-
let
|
|
786
|
-
let
|
|
936
|
+
let channelRange = value.getChannelRange('hue');
|
|
937
|
+
let { minValue: minValueX , maxValue: maxValueX , step: step , pageSize: pageStep } = channelRange;
|
|
938
|
+
let [isDragging1, setDragging] = $cBgAy$useState(false);
|
|
939
|
+
let isDraggingRef = $cBgAy$useRef(false).current;
|
|
787
940
|
let hue = value.getChannelValue('hue');
|
|
788
941
|
function setHue(v) {
|
|
789
942
|
if (v > 360) // Make sure you can always get back to 0.
|
|
790
943
|
v = 0;
|
|
791
|
-
v = $
|
|
944
|
+
v = $ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(v, 360), step);
|
|
792
945
|
if (hue !== v) {
|
|
793
946
|
let color = value.withChannelValue('hue', v);
|
|
794
947
|
valueRef.current = color;
|
|
@@ -797,31 +950,34 @@ function $2b492d761166c9cc$export$f4301076d9336137(props) {
|
|
|
797
950
|
}
|
|
798
951
|
return {
|
|
799
952
|
value: value,
|
|
953
|
+
step: step,
|
|
954
|
+
pageStep: pageStep,
|
|
800
955
|
setValue (v) {
|
|
801
|
-
let color = $
|
|
956
|
+
let color = $799cddbef784668f$export$4cde5df63f53f473(v);
|
|
802
957
|
valueRef.current = color;
|
|
803
958
|
setValue(color);
|
|
804
959
|
},
|
|
805
960
|
hue: hue,
|
|
806
961
|
setHue: setHue,
|
|
807
962
|
setHueFromPoint (x, y, radius) {
|
|
808
|
-
setHue($
|
|
963
|
+
setHue($ee4262c74a467b07$var$cartesianToAngle(x, y, radius));
|
|
809
964
|
},
|
|
810
965
|
getThumbPosition (radius) {
|
|
811
|
-
return $
|
|
966
|
+
return $ee4262c74a467b07$var$angleToCartesian(value.getChannelValue('hue'), radius);
|
|
812
967
|
},
|
|
813
|
-
increment (
|
|
814
|
-
let
|
|
815
|
-
|
|
816
|
-
newValue
|
|
817
|
-
|
|
968
|
+
increment (stepSize = 1) {
|
|
969
|
+
let s = Math.max(stepSize, step);
|
|
970
|
+
let newValue = hue + s;
|
|
971
|
+
if (newValue >= maxValueX) // Make sure you can always get back to 0.
|
|
972
|
+
newValue = minValueX;
|
|
973
|
+
setHue($ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(newValue, 360), s));
|
|
818
974
|
},
|
|
819
|
-
decrement (
|
|
820
|
-
let s = Math.max(
|
|
975
|
+
decrement (stepSize = 1) {
|
|
976
|
+
let s = Math.max(stepSize, step);
|
|
821
977
|
if (hue === 0) // We can't just subtract step because this might be the case:
|
|
822
978
|
// |(previous step) - 0| < step size
|
|
823
|
-
setHue($
|
|
824
|
-
else setHue(hue - s);
|
|
979
|
+
setHue($ee4262c74a467b07$var$roundDown(360 / s) * s);
|
|
980
|
+
else setHue($ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(hue - s, 360), s));
|
|
825
981
|
},
|
|
826
982
|
setDragging (isDragging) {
|
|
827
983
|
let wasDragging = isDraggingRef;
|
|
@@ -837,16 +993,16 @@ function $2b492d761166c9cc$export$f4301076d9336137(props) {
|
|
|
837
993
|
}
|
|
838
994
|
|
|
839
995
|
|
|
840
|
-
var $
|
|
996
|
+
var $b335ada08155d9c0$exports = {};
|
|
841
997
|
|
|
842
|
-
$parcel$export($
|
|
998
|
+
$parcel$export($b335ada08155d9c0$exports, "useColorFieldState", () => $b335ada08155d9c0$export$d52a01683abdfcd6);
|
|
843
999
|
|
|
844
1000
|
|
|
845
1001
|
|
|
846
|
-
function $
|
|
847
|
-
return $
|
|
1002
|
+
function $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(value) {
|
|
1003
|
+
return $cBgAy$useMemo(()=>{
|
|
848
1004
|
if (typeof value === 'string') try {
|
|
849
|
-
return $
|
|
1005
|
+
return $799cddbef784668f$export$6e865ea70d7724f(value);
|
|
850
1006
|
} catch (err) {
|
|
851
1007
|
return undefined;
|
|
852
1008
|
}
|
|
@@ -859,16 +1015,17 @@ function $9de9e313fa61a4b6$export$5aadd9c0606af5c2(value) {
|
|
|
859
1015
|
|
|
860
1016
|
|
|
861
1017
|
|
|
862
|
-
const $
|
|
863
|
-
const $
|
|
864
|
-
const $
|
|
865
|
-
const $
|
|
866
|
-
function $
|
|
867
|
-
let {
|
|
868
|
-
let
|
|
869
|
-
let
|
|
870
|
-
let
|
|
871
|
-
let [
|
|
1018
|
+
const $b335ada08155d9c0$var$MIN_COLOR = $799cddbef784668f$export$6e865ea70d7724f('#000000');
|
|
1019
|
+
const $b335ada08155d9c0$var$MAX_COLOR = $799cddbef784668f$export$6e865ea70d7724f('#FFFFFF');
|
|
1020
|
+
const $b335ada08155d9c0$var$MIN_COLOR_INT = $b335ada08155d9c0$var$MIN_COLOR.toHexInt();
|
|
1021
|
+
const $b335ada08155d9c0$var$MAX_COLOR_INT = $b335ada08155d9c0$var$MAX_COLOR.toHexInt();
|
|
1022
|
+
function $b335ada08155d9c0$export$d52a01683abdfcd6(props) {
|
|
1023
|
+
let { value: value1 , defaultValue: defaultValue , onChange: onChange } = props;
|
|
1024
|
+
let { step: step } = $b335ada08155d9c0$var$MIN_COLOR.getChannelRange('red');
|
|
1025
|
+
let initialValue = $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(value1);
|
|
1026
|
+
let initialDefaultValue = $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(defaultValue);
|
|
1027
|
+
let [colorValue, setColorValue] = $cBgAy$useControlledState(initialValue, initialDefaultValue, onChange);
|
|
1028
|
+
let [inputValue, setInputValue] = $cBgAy$useState(()=>(value1 || defaultValue) && colorValue ? colorValue.toString('hex') : ''
|
|
872
1029
|
);
|
|
873
1030
|
let safelySetColorValue = (newColor)=>{
|
|
874
1031
|
if (!colorValue || !newColor) {
|
|
@@ -880,25 +1037,24 @@ function $8c33114d2dc9460c$export$d52a01683abdfcd6(props) {
|
|
|
880
1037
|
return;
|
|
881
1038
|
}
|
|
882
1039
|
};
|
|
883
|
-
$
|
|
1040
|
+
let prevValue = $cBgAy$useRef(colorValue);
|
|
1041
|
+
if (prevValue.current !== colorValue) {
|
|
884
1042
|
setInputValue(colorValue ? colorValue.toString('hex') : '');
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
]);
|
|
889
|
-
let parsedValue = $8sEfR$useMemo(()=>{
|
|
1043
|
+
prevValue.current = colorValue;
|
|
1044
|
+
}
|
|
1045
|
+
let parsedValue = $cBgAy$useMemo(()=>{
|
|
890
1046
|
let color;
|
|
891
1047
|
try {
|
|
892
|
-
color = $
|
|
1048
|
+
color = $799cddbef784668f$export$6e865ea70d7724f(inputValue.startsWith('#') ? inputValue : `#${inputValue}`);
|
|
893
1049
|
} catch (err) {
|
|
894
1050
|
color = null;
|
|
895
1051
|
}
|
|
896
1052
|
return color;
|
|
897
1053
|
}, [
|
|
898
|
-
$
|
|
1054
|
+
$799cddbef784668f$export$6e865ea70d7724f,
|
|
899
1055
|
inputValue
|
|
900
1056
|
]);
|
|
901
|
-
let parsed = $
|
|
1057
|
+
let parsed = $cBgAy$useRef(null);
|
|
902
1058
|
parsed.current = parsedValue;
|
|
903
1059
|
let commit = ()=>{
|
|
904
1060
|
// Set to empty state if input value is empty
|
|
@@ -919,7 +1075,7 @@ function $8c33114d2dc9460c$export$d52a01683abdfcd6(props) {
|
|
|
919
1075
|
setInputValue(newColorValue);
|
|
920
1076
|
};
|
|
921
1077
|
let increment = ()=>{
|
|
922
|
-
let newValue = $
|
|
1078
|
+
let newValue = $b335ada08155d9c0$var$addColorValue(parsed.current, step);
|
|
923
1079
|
// if we've arrived at the same value that was previously in the state, the
|
|
924
1080
|
// input value should be updated to match
|
|
925
1081
|
// ex type 4, press increment, highlight the number in the input, type 4 again, press increment
|
|
@@ -928,7 +1084,7 @@ function $8c33114d2dc9460c$export$d52a01683abdfcd6(props) {
|
|
|
928
1084
|
safelySetColorValue(newValue);
|
|
929
1085
|
};
|
|
930
1086
|
let decrement = ()=>{
|
|
931
|
-
let newValue = $
|
|
1087
|
+
let newValue = $b335ada08155d9c0$var$addColorValue(parsed.current, -step);
|
|
932
1088
|
// if we've arrived at the same value that was previously in the state, the
|
|
933
1089
|
// input value should be updated to match
|
|
934
1090
|
// ex type 4, press increment, highlight the number in the input, type 4 again, press increment
|
|
@@ -936,9 +1092,9 @@ function $8c33114d2dc9460c$export$d52a01683abdfcd6(props) {
|
|
|
936
1092
|
if (newValue === colorValue) setInputValue(newValue.toString('hex'));
|
|
937
1093
|
safelySetColorValue(newValue);
|
|
938
1094
|
};
|
|
939
|
-
let incrementToMax = ()=>safelySetColorValue($
|
|
1095
|
+
let incrementToMax = ()=>safelySetColorValue($b335ada08155d9c0$var$MAX_COLOR)
|
|
940
1096
|
;
|
|
941
|
-
let decrementToMin = ()=>safelySetColorValue($
|
|
1097
|
+
let decrementToMin = ()=>safelySetColorValue($b335ada08155d9c0$var$MIN_COLOR)
|
|
942
1098
|
;
|
|
943
1099
|
let validate = (value)=>{
|
|
944
1100
|
var ref;
|
|
@@ -956,13 +1112,13 @@ function $8c33114d2dc9460c$export$d52a01683abdfcd6(props) {
|
|
|
956
1112
|
decrementToMin: decrementToMin
|
|
957
1113
|
};
|
|
958
1114
|
}
|
|
959
|
-
function $
|
|
960
|
-
let newColor = color ? color : $
|
|
1115
|
+
function $b335ada08155d9c0$var$addColorValue(color, step) {
|
|
1116
|
+
let newColor = color ? color : $b335ada08155d9c0$var$MIN_COLOR;
|
|
961
1117
|
let colorInt = newColor.toHexInt();
|
|
962
|
-
let clampInt = Math.min(Math.max(colorInt + step, $
|
|
1118
|
+
let clampInt = Math.min(Math.max(colorInt + step, $b335ada08155d9c0$var$MIN_COLOR_INT), $b335ada08155d9c0$var$MAX_COLOR_INT);
|
|
963
1119
|
if (clampInt !== colorInt) {
|
|
964
1120
|
let newColorString = `#${clampInt.toString(16).padStart(6, '0').toUpperCase()}`;
|
|
965
|
-
newColor = $
|
|
1121
|
+
newColor = $799cddbef784668f$export$6e865ea70d7724f(newColorString);
|
|
966
1122
|
}
|
|
967
1123
|
return newColor;
|
|
968
1124
|
}
|
|
@@ -970,5 +1126,5 @@ function $8c33114d2dc9460c$var$addColorValue(color, step) {
|
|
|
970
1126
|
|
|
971
1127
|
|
|
972
1128
|
|
|
973
|
-
export {$
|
|
1129
|
+
export {$799cddbef784668f$export$6e865ea70d7724f as parseColor, $6e14a98a7f67141d$export$6df7f0e2cabc7eef as useColorAreaState, $25a25ac0d1624665$export$57bc203e1c9c6d44 as useColorSliderState, $ee4262c74a467b07$export$f4301076d9336137 as useColorWheelState, $b335ada08155d9c0$export$d52a01683abdfcd6 as useColorFieldState};
|
|
974
1130
|
//# sourceMappingURL=module.js.map
|