@react-stately/color 3.0.0-beta.6 → 3.0.0-beta.7
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 +245 -240
- package/dist/main.js.map +1 -1
- package/dist/module.js +242 -237
- package/dist/module.js.map +1 -1
- package/package.json +8 -8
package/dist/module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {clamp as $
|
|
2
|
-
import {MessageDictionary as $
|
|
3
|
-
import {NumberFormatter as $
|
|
4
|
-
import {useSliderState as $
|
|
5
|
-
import {useRef as $
|
|
1
|
+
import {clamp as $8sEfR$clamp, toFixedNumber as $8sEfR$toFixedNumber, useControlledState as $8sEfR$useControlledState} from "@react-stately/utils";
|
|
2
|
+
import {MessageDictionary as $8sEfR$MessageDictionary} from "@internationalized/message";
|
|
3
|
+
import {NumberFormatter as $8sEfR$NumberFormatter} from "@internationalized/number";
|
|
4
|
+
import {useSliderState as $8sEfR$useSliderState} from "@react-stately/slider";
|
|
5
|
+
import {useRef as $8sEfR$useRef, useState as $8sEfR$useState, useEffect as $8sEfR$useEffect, useMemo as $8sEfR$useMemo} from "react";
|
|
6
6
|
|
|
7
7
|
function $parcel$interopDefault(a) {
|
|
8
8
|
return a && a.__esModule ? a.default : a;
|
|
@@ -10,194 +10,194 @@ 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 $
|
|
13
|
+
var $ed27c69866ff45f2$exports = {};
|
|
14
14
|
|
|
15
|
-
$parcel$export($
|
|
15
|
+
$parcel$export($ed27c69866ff45f2$exports, "parseColor", () => $ed27c69866ff45f2$export$6e865ea70d7724f);
|
|
16
16
|
|
|
17
|
-
var $
|
|
18
|
-
var $
|
|
19
|
-
$
|
|
17
|
+
var $0374a82a32e1c8c8$exports = {};
|
|
18
|
+
var $f79cd856a93a8555$exports = {};
|
|
19
|
+
$f79cd856a93a8555$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var $
|
|
23
|
-
$
|
|
22
|
+
var $0392c206ed1a088c$exports = {};
|
|
23
|
+
$0392c206ed1a088c$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var $
|
|
27
|
-
$
|
|
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
28
|
|
|
29
29
|
|
|
30
|
-
var $
|
|
31
|
-
$
|
|
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
32
|
|
|
33
33
|
|
|
34
|
-
var $
|
|
35
|
-
$
|
|
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
36
|
|
|
37
37
|
|
|
38
|
-
var $
|
|
39
|
-
$
|
|
38
|
+
var $9b0efe1614275e13$exports = {};
|
|
39
|
+
$9b0efe1614275e13$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var $
|
|
43
|
-
$
|
|
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
44
|
|
|
45
45
|
|
|
46
|
-
var $
|
|
47
|
-
$
|
|
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
48
|
|
|
49
49
|
|
|
50
|
-
var $
|
|
51
|
-
$
|
|
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
52
|
|
|
53
53
|
|
|
54
|
-
var $
|
|
55
|
-
$
|
|
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
56
|
|
|
57
57
|
|
|
58
|
-
var $
|
|
59
|
-
$
|
|
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
60
|
|
|
61
61
|
|
|
62
|
-
var $
|
|
63
|
-
$
|
|
62
|
+
var $51bf015ed0c73b08$exports = {};
|
|
63
|
+
$51bf015ed0c73b08$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
var $
|
|
67
|
-
$
|
|
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
68
|
|
|
69
69
|
|
|
70
|
-
var $
|
|
71
|
-
$
|
|
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
72
|
|
|
73
73
|
|
|
74
|
-
var $
|
|
75
|
-
$
|
|
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
76
|
|
|
77
77
|
|
|
78
|
-
var $
|
|
79
|
-
$
|
|
78
|
+
var $e8a554e99056d6bd$exports = {};
|
|
79
|
+
$e8a554e99056d6bd$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
var $
|
|
83
|
-
$
|
|
82
|
+
var $c63f256bb8c038c2$exports = {};
|
|
83
|
+
$c63f256bb8c038c2$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
var $
|
|
87
|
-
$
|
|
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
88
|
|
|
89
89
|
|
|
90
|
-
var $
|
|
91
|
-
$
|
|
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
92
|
|
|
93
93
|
|
|
94
|
-
var $
|
|
95
|
-
$
|
|
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
96
|
|
|
97
97
|
|
|
98
|
-
var $
|
|
99
|
-
$
|
|
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
100
|
|
|
101
101
|
|
|
102
|
-
var $
|
|
103
|
-
$
|
|
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
104
|
|
|
105
105
|
|
|
106
|
-
var $
|
|
107
|
-
$
|
|
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
108
|
|
|
109
109
|
|
|
110
|
-
var $
|
|
111
|
-
$
|
|
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
112
|
|
|
113
113
|
|
|
114
|
-
var $
|
|
115
|
-
$
|
|
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
116
|
|
|
117
117
|
|
|
118
|
-
var $
|
|
119
|
-
$
|
|
118
|
+
var $6752101738952fdb$exports = {};
|
|
119
|
+
$6752101738952fdb$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
var $
|
|
123
|
-
$
|
|
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
124
|
|
|
125
125
|
|
|
126
|
-
var $
|
|
127
|
-
$
|
|
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
128
|
|
|
129
129
|
|
|
130
|
-
var $
|
|
131
|
-
$
|
|
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
132
|
|
|
133
133
|
|
|
134
|
-
var $
|
|
135
|
-
$
|
|
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
136
|
|
|
137
137
|
|
|
138
|
-
var $
|
|
139
|
-
$
|
|
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
140
|
|
|
141
141
|
|
|
142
|
-
var $
|
|
143
|
-
$
|
|
142
|
+
var $96079736d8339dc2$exports = {};
|
|
143
|
+
$96079736d8339dc2$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
var $
|
|
147
|
-
$
|
|
146
|
+
var $a1df1831dafc647a$exports = {};
|
|
147
|
+
$a1df1831dafc647a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
var $
|
|
151
|
-
$
|
|
150
|
+
var $28a02b1bdcc0138a$exports = {};
|
|
151
|
+
$28a02b1bdcc0138a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
|
|
152
152
|
|
|
153
153
|
|
|
154
|
-
$
|
|
155
|
-
"ar-AE": $
|
|
156
|
-
"bg-BG": $
|
|
157
|
-
"cs-CZ": $
|
|
158
|
-
"da-DK": $
|
|
159
|
-
"de-DE": $
|
|
160
|
-
"el-GR": $
|
|
161
|
-
"en-US": $
|
|
162
|
-
"es-ES": $
|
|
163
|
-
"et-EE": $
|
|
164
|
-
"fi-FI": $
|
|
165
|
-
"fr-FR": $
|
|
166
|
-
"he-IL": $
|
|
167
|
-
"hr-HR": $
|
|
168
|
-
"hu-HU": $
|
|
169
|
-
"it-IT": $
|
|
170
|
-
"ja-JP": $
|
|
171
|
-
"ko-KR": $
|
|
172
|
-
"lt-LT": $
|
|
173
|
-
"lv-LV": $
|
|
174
|
-
"nb-NO": $
|
|
175
|
-
"nl-NL": $
|
|
176
|
-
"pl-PL": $
|
|
177
|
-
"pt-BR": $
|
|
178
|
-
"pt-PT": $
|
|
179
|
-
"ro-RO": $
|
|
180
|
-
"ru-RU": $
|
|
181
|
-
"sk-SK": $
|
|
182
|
-
"sl-SI": $
|
|
183
|
-
"sr-SP": $
|
|
184
|
-
"sv-SE": $
|
|
185
|
-
"tr-TR": $
|
|
186
|
-
"uk-UA": $
|
|
187
|
-
"zh-CN": $
|
|
188
|
-
"zh-TW": $
|
|
154
|
+
$0374a82a32e1c8c8$exports = {
|
|
155
|
+
"ar-AE": $f79cd856a93a8555$exports,
|
|
156
|
+
"bg-BG": $0392c206ed1a088c$exports,
|
|
157
|
+
"cs-CZ": $7d0d490f8015f125$exports,
|
|
158
|
+
"da-DK": $d10fb5e7ed22c57f$exports,
|
|
159
|
+
"de-DE": $d66a4b557c1b4b94$exports,
|
|
160
|
+
"el-GR": $9b0efe1614275e13$exports,
|
|
161
|
+
"en-US": $c150b1de62e68b51$exports,
|
|
162
|
+
"es-ES": $92da1a3ab873f3f3$exports,
|
|
163
|
+
"et-EE": $e39eccb2d120b0b3$exports,
|
|
164
|
+
"fi-FI": $56489bc0134adb6a$exports,
|
|
165
|
+
"fr-FR": $aa6a5ed9d5efeb69$exports,
|
|
166
|
+
"he-IL": $51bf015ed0c73b08$exports,
|
|
167
|
+
"hr-HR": $861b4dcde21e078b$exports,
|
|
168
|
+
"hu-HU": $8b004b0c6d72513e$exports,
|
|
169
|
+
"it-IT": $3eb66eb9579408ce$exports,
|
|
170
|
+
"ja-JP": $e8a554e99056d6bd$exports,
|
|
171
|
+
"ko-KR": $c63f256bb8c038c2$exports,
|
|
172
|
+
"lt-LT": $68505ef47b1ac6a7$exports,
|
|
173
|
+
"lv-LV": $24cb133f20e85c27$exports,
|
|
174
|
+
"nb-NO": $64f2745d4ddb954d$exports,
|
|
175
|
+
"nl-NL": $dcb8f13db15acdb8$exports,
|
|
176
|
+
"pl-PL": $0ef596f59415b4bb$exports,
|
|
177
|
+
"pt-BR": $bbb5b83ca182b9e7$exports,
|
|
178
|
+
"pt-PT": $564e95b406d0dc84$exports,
|
|
179
|
+
"ro-RO": $7eb3ecd9dc0320ab$exports,
|
|
180
|
+
"ru-RU": $6752101738952fdb$exports,
|
|
181
|
+
"sk-SK": $27ed00b951516a4d$exports,
|
|
182
|
+
"sl-SI": $c0aa93444ae4b0ca$exports,
|
|
183
|
+
"sr-SP": $6809c66d997aaacf$exports,
|
|
184
|
+
"sv-SE": $77839a6d0a465311$exports,
|
|
185
|
+
"tr-TR": $5eb08cf4653400f5$exports,
|
|
186
|
+
"uk-UA": $96079736d8339dc2$exports,
|
|
187
|
+
"zh-CN": $a1df1831dafc647a$exports,
|
|
188
|
+
"zh-TW": $28a02b1bdcc0138a$exports
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
|
|
192
192
|
|
|
193
193
|
|
|
194
|
-
const $
|
|
195
|
-
function $
|
|
196
|
-
let res = $
|
|
194
|
+
const $ed27c69866ff45f2$var$messages = new $8sEfR$MessageDictionary((/*@__PURE__*/$parcel$interopDefault($0374a82a32e1c8c8$exports)));
|
|
195
|
+
function $ed27c69866ff45f2$export$6e865ea70d7724f(value) {
|
|
196
|
+
let res = $ed27c69866ff45f2$var$RGBColor.parse(value) || $ed27c69866ff45f2$var$HSBColor.parse(value) || $ed27c69866ff45f2$var$HSLColor.parse(value);
|
|
197
197
|
if (res) return res;
|
|
198
198
|
throw new Error('Invalid color value: ' + value);
|
|
199
199
|
}
|
|
200
|
-
class $
|
|
200
|
+
class $ed27c69866ff45f2$var$Color {
|
|
201
201
|
toHexInt() {
|
|
202
202
|
return this.toFormat('rgb').toHexInt();
|
|
203
203
|
}
|
|
@@ -214,42 +214,36 @@ class $19b55adb42b5e1b3$var$Color {
|
|
|
214
214
|
throw new Error('Unsupported color channel: ' + channel);
|
|
215
215
|
}
|
|
216
216
|
getChannelName(channel, locale) {
|
|
217
|
-
return $
|
|
217
|
+
return $ed27c69866ff45f2$var$messages.getStringForLocale(channel, locale);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
const $
|
|
220
|
+
const $ed27c69866ff45f2$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i;
|
|
221
221
|
// X = <negative/positive number with/without decimal places>
|
|
222
222
|
// before/after a comma, 0 or more whitespaces are allowed
|
|
223
223
|
// - rgb(X, X, X)
|
|
224
224
|
// - rgba(X, X, X, X)
|
|
225
|
-
const $
|
|
226
|
-
class $
|
|
227
|
-
constructor(red, green, blue, alpha){
|
|
228
|
-
super();
|
|
229
|
-
this.red = red;
|
|
230
|
-
this.green = green;
|
|
231
|
-
this.blue = blue;
|
|
232
|
-
this.alpha = alpha;
|
|
233
|
-
}
|
|
225
|
+
const $ed27c69866ff45f2$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+)?)\)/;
|
|
226
|
+
class $ed27c69866ff45f2$var$RGBColor extends $ed27c69866ff45f2$var$Color {
|
|
234
227
|
static parse(value) {
|
|
235
228
|
let m;
|
|
236
|
-
if (m = value.match($
|
|
229
|
+
if (m = value.match($ed27c69866ff45f2$var$HEX_REGEX)) {
|
|
237
230
|
if (m[1]) {
|
|
238
231
|
let r = parseInt(m[1][0] + m[1][0], 16);
|
|
239
232
|
let g = parseInt(m[1][1] + m[1][1], 16);
|
|
240
233
|
let b = parseInt(m[1][2] + m[1][2], 16);
|
|
241
|
-
return new $
|
|
234
|
+
return new $ed27c69866ff45f2$var$RGBColor(r, g, b, 1);
|
|
242
235
|
} else if (m[2]) {
|
|
243
236
|
let r = parseInt(m[2][0] + m[2][1], 16);
|
|
244
237
|
let g = parseInt(m[2][2] + m[2][3], 16);
|
|
245
238
|
let b = parseInt(m[2][4] + m[2][5], 16);
|
|
246
|
-
return new $
|
|
239
|
+
return new $ed27c69866ff45f2$var$RGBColor(r, g, b, 1);
|
|
247
240
|
}
|
|
248
241
|
}
|
|
249
|
-
if (m = value.match($
|
|
250
|
-
|
|
242
|
+
if (m = value.match($ed27c69866ff45f2$var$RGB_REGEX)) {
|
|
243
|
+
var ref;
|
|
244
|
+
const [r, g, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim())
|
|
251
245
|
);
|
|
252
|
-
return new $
|
|
246
|
+
return new $ed27c69866ff45f2$var$RGBColor($8sEfR$clamp(r, 0, 255), $8sEfR$clamp(g, 0, 255), $8sEfR$clamp(b, 0, 255), $8sEfR$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
|
|
253
247
|
}
|
|
254
248
|
}
|
|
255
249
|
toString(format) {
|
|
@@ -314,7 +308,7 @@ class $19b55adb42b5e1b3$var$RGBColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
314
308
|
}
|
|
315
309
|
hue /= 6;
|
|
316
310
|
}
|
|
317
|
-
return new $
|
|
311
|
+
return new $ed27c69866ff45f2$var$HSBColor($8sEfR$toFixedNumber(hue * 360, 2), $8sEfR$toFixedNumber(saturation * 100, 2), $8sEfR$toFixedNumber(brightness * 100, 2), this.alpha);
|
|
318
312
|
}
|
|
319
313
|
/**
|
|
320
314
|
* Converts an RGB color value to HSL.
|
|
@@ -346,10 +340,10 @@ class $19b55adb42b5e1b3$var$RGBColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
346
340
|
}
|
|
347
341
|
hue /= 6;
|
|
348
342
|
}
|
|
349
|
-
return new $
|
|
343
|
+
return new $ed27c69866ff45f2$var$HSLColor($8sEfR$toFixedNumber(hue * 360, 2), $8sEfR$toFixedNumber(saturation * 100, 2), $8sEfR$toFixedNumber(lightness * 100, 2), this.alpha);
|
|
350
344
|
}
|
|
351
345
|
clone() {
|
|
352
|
-
return new $
|
|
346
|
+
return new $ed27c69866ff45f2$var$RGBColor(this.red, this.green, this.blue, this.alpha);
|
|
353
347
|
}
|
|
354
348
|
getChannelRange(channel) {
|
|
355
349
|
switch(channel){
|
|
@@ -390,31 +384,32 @@ class $19b55adb42b5e1b3$var$RGBColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
390
384
|
default:
|
|
391
385
|
throw new Error('Unknown color channel: ' + channel);
|
|
392
386
|
}
|
|
393
|
-
return new $
|
|
387
|
+
return new $8sEfR$NumberFormatter(locale, options).format(value);
|
|
394
388
|
}
|
|
395
389
|
getColorSpace() {
|
|
396
390
|
return 'rgb';
|
|
397
391
|
}
|
|
392
|
+
constructor(red, green, blue, alpha){
|
|
393
|
+
super();
|
|
394
|
+
this.red = red;
|
|
395
|
+
this.green = green;
|
|
396
|
+
this.blue = blue;
|
|
397
|
+
this.alpha = alpha;
|
|
398
|
+
}
|
|
398
399
|
}
|
|
399
400
|
// X = <negative/positive number with/without decimal places>
|
|
400
401
|
// before/after a comma, 0 or more whitespaces are allowed
|
|
401
402
|
// - hsb(X, X%, X%)
|
|
402
403
|
// - hsba(X, X%, X%, X)
|
|
403
|
-
const $
|
|
404
|
-
class $
|
|
405
|
-
constructor(hue, saturation, brightness, alpha){
|
|
406
|
-
super();
|
|
407
|
-
this.hue = hue;
|
|
408
|
-
this.saturation = saturation;
|
|
409
|
-
this.brightness = brightness;
|
|
410
|
-
this.alpha = alpha;
|
|
411
|
-
}
|
|
404
|
+
const $ed27c69866ff45f2$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+)?)\)/;
|
|
405
|
+
class $ed27c69866ff45f2$var$HSBColor extends $ed27c69866ff45f2$var$Color {
|
|
412
406
|
static parse(value) {
|
|
413
407
|
let m;
|
|
414
|
-
if (m = value.match($
|
|
415
|
-
|
|
408
|
+
if (m = value.match($ed27c69866ff45f2$var$HSB_REGEX)) {
|
|
409
|
+
var ref;
|
|
410
|
+
const [h, s, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
|
|
416
411
|
);
|
|
417
|
-
return new $
|
|
412
|
+
return new $ed27c69866ff45f2$var$HSBColor($ed27c69866ff45f2$var$mod(h, 360), $8sEfR$clamp(s, 0, 100), $8sEfR$clamp(b, 0, 100), $8sEfR$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
|
|
418
413
|
}
|
|
419
414
|
}
|
|
420
415
|
toString(format) {
|
|
@@ -426,9 +421,9 @@ class $19b55adb42b5e1b3$var$HSBColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
426
421
|
case 'hexa':
|
|
427
422
|
return this.toRGB().toString('hexa');
|
|
428
423
|
case 'hsb':
|
|
429
|
-
return `hsb(${this.hue}, ${$
|
|
424
|
+
return `hsb(${this.hue}, ${$8sEfR$toFixedNumber(this.saturation, 2)}%, ${$8sEfR$toFixedNumber(this.brightness, 2)}%)`;
|
|
430
425
|
case 'hsba':
|
|
431
|
-
return `hsba(${this.hue}, ${$
|
|
426
|
+
return `hsba(${this.hue}, ${$8sEfR$toFixedNumber(this.saturation, 2)}%, ${$8sEfR$toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;
|
|
432
427
|
default:
|
|
433
428
|
return this.toFormat(format).toString(format);
|
|
434
429
|
}
|
|
@@ -457,7 +452,7 @@ class $19b55adb42b5e1b3$var$HSBColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
457
452
|
let brightness = this.brightness / 100;
|
|
458
453
|
let lightness = brightness * (1 - saturation / 2);
|
|
459
454
|
saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
|
|
460
|
-
return new $
|
|
455
|
+
return new $ed27c69866ff45f2$var$HSLColor($8sEfR$toFixedNumber(this.hue, 2), $8sEfR$toFixedNumber(saturation * 100, 2), $8sEfR$toFixedNumber(lightness * 100, 2), this.alpha);
|
|
461
456
|
}
|
|
462
457
|
/**
|
|
463
458
|
* Converts a HSV color value to RGB.
|
|
@@ -469,10 +464,10 @@ class $19b55adb42b5e1b3$var$HSBColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
469
464
|
let brightness = this.brightness / 100;
|
|
470
465
|
let fn = (n, k = (n + hue / 60) % 6)=>brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0)
|
|
471
466
|
;
|
|
472
|
-
return new $
|
|
467
|
+
return new $ed27c69866ff45f2$var$RGBColor(Math.round(fn(5) * 255), Math.round(fn(3) * 255), Math.round(fn(1) * 255), this.alpha);
|
|
473
468
|
}
|
|
474
469
|
clone() {
|
|
475
|
-
return new $
|
|
470
|
+
return new $ed27c69866ff45f2$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
|
|
476
471
|
}
|
|
477
472
|
getChannelRange(channel) {
|
|
478
473
|
switch(channel){
|
|
@@ -525,34 +520,35 @@ class $19b55adb42b5e1b3$var$HSBColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
525
520
|
default:
|
|
526
521
|
throw new Error('Unknown color channel: ' + channel);
|
|
527
522
|
}
|
|
528
|
-
return new $
|
|
523
|
+
return new $8sEfR$NumberFormatter(locale, options).format(value);
|
|
529
524
|
}
|
|
530
525
|
getColorSpace() {
|
|
531
526
|
return 'hsb';
|
|
532
527
|
}
|
|
528
|
+
constructor(hue, saturation, brightness, alpha){
|
|
529
|
+
super();
|
|
530
|
+
this.hue = hue;
|
|
531
|
+
this.saturation = saturation;
|
|
532
|
+
this.brightness = brightness;
|
|
533
|
+
this.alpha = alpha;
|
|
534
|
+
}
|
|
533
535
|
}
|
|
534
536
|
// X = <negative/positive number with/without decimal places>
|
|
535
537
|
// before/after a comma, 0 or more whitespaces are allowed
|
|
536
538
|
// - hsl(X, X%, X%)
|
|
537
539
|
// - hsla(X, X%, X%, X)
|
|
538
|
-
const $
|
|
539
|
-
function $
|
|
540
|
+
const $ed27c69866ff45f2$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+)?)\)/;
|
|
541
|
+
function $ed27c69866ff45f2$var$mod(n, m) {
|
|
540
542
|
return (n % m + m) % m;
|
|
541
543
|
}
|
|
542
|
-
class $
|
|
543
|
-
constructor(hue, saturation, lightness, alpha){
|
|
544
|
-
super();
|
|
545
|
-
this.hue = hue;
|
|
546
|
-
this.saturation = saturation;
|
|
547
|
-
this.lightness = lightness;
|
|
548
|
-
this.alpha = alpha;
|
|
549
|
-
}
|
|
544
|
+
class $ed27c69866ff45f2$var$HSLColor extends $ed27c69866ff45f2$var$Color {
|
|
550
545
|
static parse(value) {
|
|
551
546
|
let m;
|
|
552
|
-
if (m = value.match($
|
|
553
|
-
|
|
547
|
+
if (m = value.match($ed27c69866ff45f2$var$HSL_REGEX)) {
|
|
548
|
+
var ref;
|
|
549
|
+
const [h, s, l, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
|
|
554
550
|
);
|
|
555
|
-
return new $
|
|
551
|
+
return new $ed27c69866ff45f2$var$HSLColor($ed27c69866ff45f2$var$mod(h, 360), $8sEfR$clamp(s, 0, 100), $8sEfR$clamp(l, 0, 100), $8sEfR$clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
|
|
556
552
|
}
|
|
557
553
|
}
|
|
558
554
|
toString(format) {
|
|
@@ -562,10 +558,10 @@ class $19b55adb42b5e1b3$var$HSLColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
562
558
|
case 'hexa':
|
|
563
559
|
return this.toRGB().toString('hexa');
|
|
564
560
|
case 'hsl':
|
|
565
|
-
return `hsl(${this.hue}, ${$
|
|
561
|
+
return `hsl(${this.hue}, ${$8sEfR$toFixedNumber(this.saturation, 2)}%, ${$8sEfR$toFixedNumber(this.lightness, 2)}%)`;
|
|
566
562
|
case 'css':
|
|
567
563
|
case 'hsla':
|
|
568
|
-
return `hsla(${this.hue}, ${$
|
|
564
|
+
return `hsla(${this.hue}, ${$8sEfR$toFixedNumber(this.saturation, 2)}%, ${$8sEfR$toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
|
|
569
565
|
default:
|
|
570
566
|
return this.toFormat(format).toString(format);
|
|
571
567
|
}
|
|
@@ -594,7 +590,7 @@ class $19b55adb42b5e1b3$var$HSLColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
594
590
|
let lightness = this.lightness / 100;
|
|
595
591
|
let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
|
|
596
592
|
saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
|
|
597
|
-
return new $
|
|
593
|
+
return new $ed27c69866ff45f2$var$HSBColor($8sEfR$toFixedNumber(this.hue, 2), $8sEfR$toFixedNumber(saturation * 100, 2), $8sEfR$toFixedNumber(brightness * 100, 2), this.alpha);
|
|
598
594
|
}
|
|
599
595
|
/**
|
|
600
596
|
* Converts a HSL color to RGB.
|
|
@@ -607,10 +603,10 @@ class $19b55adb42b5e1b3$var$HSLColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
607
603
|
let a = saturation * Math.min(lightness, 1 - lightness);
|
|
608
604
|
let fn = (n, k = (n + hue / 30) % 12)=>lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
|
|
609
605
|
;
|
|
610
|
-
return new $
|
|
606
|
+
return new $ed27c69866ff45f2$var$RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), this.alpha);
|
|
611
607
|
}
|
|
612
608
|
clone() {
|
|
613
|
-
return new $
|
|
609
|
+
return new $ed27c69866ff45f2$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
|
|
614
610
|
}
|
|
615
611
|
getChannelRange(channel) {
|
|
616
612
|
switch(channel){
|
|
@@ -663,29 +659,36 @@ class $19b55adb42b5e1b3$var$HSLColor extends $19b55adb42b5e1b3$var$Color {
|
|
|
663
659
|
default:
|
|
664
660
|
throw new Error('Unknown color channel: ' + channel);
|
|
665
661
|
}
|
|
666
|
-
return new $
|
|
662
|
+
return new $8sEfR$NumberFormatter(locale, options).format(value);
|
|
667
663
|
}
|
|
668
664
|
getColorSpace() {
|
|
669
665
|
return 'hsl';
|
|
670
666
|
}
|
|
667
|
+
constructor(hue, saturation, lightness, alpha){
|
|
668
|
+
super();
|
|
669
|
+
this.hue = hue;
|
|
670
|
+
this.saturation = saturation;
|
|
671
|
+
this.lightness = lightness;
|
|
672
|
+
this.alpha = alpha;
|
|
673
|
+
}
|
|
671
674
|
}
|
|
672
675
|
|
|
673
676
|
|
|
674
|
-
var $
|
|
677
|
+
var $3d60b153dd2f1b1b$exports = {};
|
|
675
678
|
|
|
676
|
-
$parcel$export($
|
|
679
|
+
$parcel$export($3d60b153dd2f1b1b$exports, "useColorSliderState", () => $3d60b153dd2f1b1b$export$57bc203e1c9c6d44);
|
|
677
680
|
|
|
678
681
|
|
|
679
682
|
|
|
680
|
-
function $
|
|
681
|
-
if (typeof v === 'string') return $
|
|
683
|
+
function $3d60b153dd2f1b1b$var$normalizeColor(v) {
|
|
684
|
+
if (typeof v === 'string') return $ed27c69866ff45f2$export$6e865ea70d7724f(v);
|
|
682
685
|
else return v;
|
|
683
686
|
}
|
|
684
|
-
function $
|
|
687
|
+
function $3d60b153dd2f1b1b$export$57bc203e1c9c6d44(props) {
|
|
685
688
|
let { channel: channel , value: value1 , defaultValue: defaultValue , onChange: onChange , locale: locale , ...otherProps } = props;
|
|
686
689
|
if (value1 == null && defaultValue == null) throw new Error('useColorSliderState requires a value or defaultValue');
|
|
687
|
-
let [color, setColor] = $
|
|
688
|
-
let sliderState = $
|
|
690
|
+
let [color, setColor] = $8sEfR$useControlledState(value1 && $3d60b153dd2f1b1b$var$normalizeColor(value1), defaultValue && $3d60b153dd2f1b1b$var$normalizeColor(defaultValue), onChange);
|
|
691
|
+
let sliderState = $8sEfR$useSliderState({
|
|
689
692
|
...color.getChannelRange(channel),
|
|
690
693
|
...otherProps,
|
|
691
694
|
// Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
|
|
@@ -705,12 +708,12 @@ function $86a06515e79ac54d$export$57bc203e1c9c6d44(props) {
|
|
|
705
708
|
...sliderState,
|
|
706
709
|
value: color,
|
|
707
710
|
setValue (value) {
|
|
708
|
-
setColor($
|
|
711
|
+
setColor($3d60b153dd2f1b1b$var$normalizeColor(value));
|
|
709
712
|
},
|
|
710
713
|
getDisplayColor () {
|
|
711
714
|
switch(channel){
|
|
712
715
|
case 'hue':
|
|
713
|
-
return $
|
|
716
|
+
return $ed27c69866ff45f2$export$6e865ea70d7724f(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
|
|
714
717
|
case 'lightness':
|
|
715
718
|
case 'brightness':
|
|
716
719
|
case 'saturation':
|
|
@@ -731,37 +734,37 @@ function $86a06515e79ac54d$export$57bc203e1c9c6d44(props) {
|
|
|
731
734
|
}
|
|
732
735
|
|
|
733
736
|
|
|
734
|
-
var $
|
|
737
|
+
var $2b492d761166c9cc$exports = {};
|
|
735
738
|
|
|
736
|
-
$parcel$export($
|
|
739
|
+
$parcel$export($2b492d761166c9cc$exports, "useColorWheelState", () => $2b492d761166c9cc$export$f4301076d9336137);
|
|
737
740
|
|
|
738
741
|
|
|
739
742
|
|
|
740
|
-
function $
|
|
741
|
-
if (typeof v === 'string') return $
|
|
743
|
+
function $2b492d761166c9cc$var$normalizeColor(v) {
|
|
744
|
+
if (typeof v === 'string') return $ed27c69866ff45f2$export$6e865ea70d7724f(v);
|
|
742
745
|
else return v;
|
|
743
746
|
}
|
|
744
|
-
const $
|
|
745
|
-
function $
|
|
747
|
+
const $2b492d761166c9cc$var$DEFAULT_COLOR = $ed27c69866ff45f2$export$6e865ea70d7724f('hsl(0, 100%, 50%)');
|
|
748
|
+
function $2b492d761166c9cc$var$roundToStep(value, step) {
|
|
746
749
|
return Math.round(value / step) * step;
|
|
747
750
|
}
|
|
748
|
-
function $
|
|
751
|
+
function $2b492d761166c9cc$var$mod(n, m) {
|
|
749
752
|
return (n % m + m) % m;
|
|
750
753
|
}
|
|
751
|
-
function $
|
|
754
|
+
function $2b492d761166c9cc$var$roundDown(v) {
|
|
752
755
|
let r = Math.floor(v);
|
|
753
756
|
if (r === v) return v - 1;
|
|
754
757
|
else return r;
|
|
755
758
|
}
|
|
756
|
-
function $
|
|
759
|
+
function $2b492d761166c9cc$var$degToRad(deg) {
|
|
757
760
|
return deg * Math.PI / 180;
|
|
758
761
|
}
|
|
759
|
-
function $
|
|
762
|
+
function $2b492d761166c9cc$var$radToDeg(rad) {
|
|
760
763
|
return rad * 180 / Math.PI;
|
|
761
764
|
}
|
|
762
765
|
// 0deg = 3 o'clock. increases clockwise
|
|
763
|
-
function $
|
|
764
|
-
let rad = $
|
|
766
|
+
function $2b492d761166c9cc$var$angleToCartesian(angle, radius) {
|
|
767
|
+
let rad = $2b492d761166c9cc$var$degToRad(360 - angle + 90);
|
|
765
768
|
let x = Math.sin(rad) * radius;
|
|
766
769
|
let y = Math.cos(rad) * radius;
|
|
767
770
|
return {
|
|
@@ -769,23 +772,23 @@ function $b42abd16499dffa8$var$angleToCartesian(angle, radius) {
|
|
|
769
772
|
y: y
|
|
770
773
|
};
|
|
771
774
|
}
|
|
772
|
-
function $
|
|
773
|
-
let deg = $
|
|
775
|
+
function $2b492d761166c9cc$var$cartesianToAngle(x, y, radius) {
|
|
776
|
+
let deg = $2b492d761166c9cc$var$radToDeg(Math.atan2(y / radius, x / radius));
|
|
774
777
|
return (deg + 360) % 360;
|
|
775
778
|
}
|
|
776
|
-
function $
|
|
779
|
+
function $2b492d761166c9cc$export$f4301076d9336137(props) {
|
|
777
780
|
let { defaultValue: defaultValue , onChange: onChange , onChangeEnd: onChangeEnd , step: step = 1 } = props;
|
|
778
|
-
if (!props.value && !defaultValue) defaultValue = $
|
|
779
|
-
let [value, setValue] = $
|
|
780
|
-
let valueRef = $
|
|
781
|
+
if (!props.value && !defaultValue) defaultValue = $2b492d761166c9cc$var$DEFAULT_COLOR;
|
|
782
|
+
let [value, setValue] = $8sEfR$useControlledState($2b492d761166c9cc$var$normalizeColor(props.value), $2b492d761166c9cc$var$normalizeColor(defaultValue), onChange);
|
|
783
|
+
let valueRef = $8sEfR$useRef(value);
|
|
781
784
|
valueRef.current = value;
|
|
782
|
-
let [isDragging1, setDragging] = $
|
|
783
|
-
let isDraggingRef = $
|
|
785
|
+
let [isDragging1, setDragging] = $8sEfR$useState(false);
|
|
786
|
+
let isDraggingRef = $8sEfR$useRef(false).current;
|
|
784
787
|
let hue = value.getChannelValue('hue');
|
|
785
788
|
function setHue(v) {
|
|
786
789
|
if (v > 360) // Make sure you can always get back to 0.
|
|
787
790
|
v = 0;
|
|
788
|
-
v = $
|
|
791
|
+
v = $2b492d761166c9cc$var$roundToStep($2b492d761166c9cc$var$mod(v, 360), step);
|
|
789
792
|
if (hue !== v) {
|
|
790
793
|
let color = value.withChannelValue('hue', v);
|
|
791
794
|
valueRef.current = color;
|
|
@@ -795,17 +798,17 @@ function $b42abd16499dffa8$export$f4301076d9336137(props) {
|
|
|
795
798
|
return {
|
|
796
799
|
value: value,
|
|
797
800
|
setValue (v) {
|
|
798
|
-
let color = $
|
|
801
|
+
let color = $2b492d761166c9cc$var$normalizeColor(v);
|
|
799
802
|
valueRef.current = color;
|
|
800
803
|
setValue(color);
|
|
801
804
|
},
|
|
802
805
|
hue: hue,
|
|
803
806
|
setHue: setHue,
|
|
804
807
|
setHueFromPoint (x, y, radius) {
|
|
805
|
-
setHue($
|
|
808
|
+
setHue($2b492d761166c9cc$var$cartesianToAngle(x, y, radius));
|
|
806
809
|
},
|
|
807
810
|
getThumbPosition (radius) {
|
|
808
|
-
return $
|
|
811
|
+
return $2b492d761166c9cc$var$angleToCartesian(value.getChannelValue('hue'), radius);
|
|
809
812
|
},
|
|
810
813
|
increment (minStepSize = 0) {
|
|
811
814
|
let newValue = hue + Math.max(minStepSize, step);
|
|
@@ -817,7 +820,7 @@ function $b42abd16499dffa8$export$f4301076d9336137(props) {
|
|
|
817
820
|
let s = Math.max(minStepSize, step);
|
|
818
821
|
if (hue === 0) // We can't just subtract step because this might be the case:
|
|
819
822
|
// |(previous step) - 0| < step size
|
|
820
|
-
setHue($
|
|
823
|
+
setHue($2b492d761166c9cc$var$roundDown(360 / s) * s);
|
|
821
824
|
else setHue(hue - s);
|
|
822
825
|
},
|
|
823
826
|
setDragging (isDragging) {
|
|
@@ -834,16 +837,16 @@ function $b42abd16499dffa8$export$f4301076d9336137(props) {
|
|
|
834
837
|
}
|
|
835
838
|
|
|
836
839
|
|
|
837
|
-
var $
|
|
840
|
+
var $8c33114d2dc9460c$exports = {};
|
|
838
841
|
|
|
839
|
-
$parcel$export($
|
|
842
|
+
$parcel$export($8c33114d2dc9460c$exports, "useColorFieldState", () => $8c33114d2dc9460c$export$d52a01683abdfcd6);
|
|
840
843
|
|
|
841
844
|
|
|
842
845
|
|
|
843
|
-
function $
|
|
844
|
-
return $
|
|
846
|
+
function $9de9e313fa61a4b6$export$5aadd9c0606af5c2(value) {
|
|
847
|
+
return $8sEfR$useMemo(()=>{
|
|
845
848
|
if (typeof value === 'string') try {
|
|
846
|
-
return $
|
|
849
|
+
return $ed27c69866ff45f2$export$6e865ea70d7724f(value);
|
|
847
850
|
} catch (err) {
|
|
848
851
|
return undefined;
|
|
849
852
|
}
|
|
@@ -856,16 +859,16 @@ function $0887d6d920adea87$export$5aadd9c0606af5c2(value) {
|
|
|
856
859
|
|
|
857
860
|
|
|
858
861
|
|
|
859
|
-
const $
|
|
860
|
-
const $
|
|
861
|
-
const $
|
|
862
|
-
const $
|
|
863
|
-
function $
|
|
862
|
+
const $8c33114d2dc9460c$var$MIN_COLOR = $ed27c69866ff45f2$export$6e865ea70d7724f('#000000');
|
|
863
|
+
const $8c33114d2dc9460c$var$MAX_COLOR = $ed27c69866ff45f2$export$6e865ea70d7724f('#FFFFFF');
|
|
864
|
+
const $8c33114d2dc9460c$var$MIN_COLOR_INT = $8c33114d2dc9460c$var$MIN_COLOR.toHexInt();
|
|
865
|
+
const $8c33114d2dc9460c$var$MAX_COLOR_INT = $8c33114d2dc9460c$var$MAX_COLOR.toHexInt();
|
|
866
|
+
function $8c33114d2dc9460c$export$d52a01683abdfcd6(props) {
|
|
864
867
|
let { step: step = 1 , value: value1 , defaultValue: defaultValue , onChange: onChange } = props;
|
|
865
|
-
let initialValue = $
|
|
866
|
-
let initialDefaultValue = $
|
|
867
|
-
let [colorValue, setColorValue] = $
|
|
868
|
-
let [inputValue, setInputValue] = $
|
|
868
|
+
let initialValue = $9de9e313fa61a4b6$export$5aadd9c0606af5c2(value1);
|
|
869
|
+
let initialDefaultValue = $9de9e313fa61a4b6$export$5aadd9c0606af5c2(defaultValue);
|
|
870
|
+
let [colorValue, setColorValue] = $8sEfR$useControlledState(initialValue, initialDefaultValue, onChange);
|
|
871
|
+
let [inputValue, setInputValue] = $8sEfR$useState(()=>(value1 || defaultValue) && colorValue ? colorValue.toString('hex') : ''
|
|
869
872
|
);
|
|
870
873
|
let safelySetColorValue = (newColor)=>{
|
|
871
874
|
if (!colorValue || !newColor) {
|
|
@@ -877,25 +880,25 @@ function $d47b7df9567aae8f$export$d52a01683abdfcd6(props) {
|
|
|
877
880
|
return;
|
|
878
881
|
}
|
|
879
882
|
};
|
|
880
|
-
$
|
|
883
|
+
$8sEfR$useEffect(()=>{
|
|
881
884
|
setInputValue(colorValue ? colorValue.toString('hex') : '');
|
|
882
885
|
}, [
|
|
883
886
|
colorValue,
|
|
884
887
|
setInputValue
|
|
885
888
|
]);
|
|
886
|
-
let parsedValue = $
|
|
889
|
+
let parsedValue = $8sEfR$useMemo(()=>{
|
|
887
890
|
let color;
|
|
888
891
|
try {
|
|
889
|
-
color = $
|
|
892
|
+
color = $ed27c69866ff45f2$export$6e865ea70d7724f(inputValue.startsWith('#') ? inputValue : `#${inputValue}`);
|
|
890
893
|
} catch (err) {
|
|
891
894
|
color = null;
|
|
892
895
|
}
|
|
893
896
|
return color;
|
|
894
897
|
}, [
|
|
895
|
-
$
|
|
898
|
+
$ed27c69866ff45f2$export$6e865ea70d7724f,
|
|
896
899
|
inputValue
|
|
897
900
|
]);
|
|
898
|
-
let parsed = $
|
|
901
|
+
let parsed = $8sEfR$useRef(null);
|
|
899
902
|
parsed.current = parsedValue;
|
|
900
903
|
let commit = ()=>{
|
|
901
904
|
// Set to empty state if input value is empty
|
|
@@ -916,7 +919,7 @@ function $d47b7df9567aae8f$export$d52a01683abdfcd6(props) {
|
|
|
916
919
|
setInputValue(newColorValue);
|
|
917
920
|
};
|
|
918
921
|
let increment = ()=>{
|
|
919
|
-
let newValue = $
|
|
922
|
+
let newValue = $8c33114d2dc9460c$var$addColorValue(parsed.current, step);
|
|
920
923
|
// if we've arrived at the same value that was previously in the state, the
|
|
921
924
|
// input value should be updated to match
|
|
922
925
|
// ex type 4, press increment, highlight the number in the input, type 4 again, press increment
|
|
@@ -925,7 +928,7 @@ function $d47b7df9567aae8f$export$d52a01683abdfcd6(props) {
|
|
|
925
928
|
safelySetColorValue(newValue);
|
|
926
929
|
};
|
|
927
930
|
let decrement = ()=>{
|
|
928
|
-
let newValue = $
|
|
931
|
+
let newValue = $8c33114d2dc9460c$var$addColorValue(parsed.current, -step);
|
|
929
932
|
// if we've arrived at the same value that was previously in the state, the
|
|
930
933
|
// input value should be updated to match
|
|
931
934
|
// ex type 4, press increment, highlight the number in the input, type 4 again, press increment
|
|
@@ -933,12 +936,14 @@ function $d47b7df9567aae8f$export$d52a01683abdfcd6(props) {
|
|
|
933
936
|
if (newValue === colorValue) setInputValue(newValue.toString('hex'));
|
|
934
937
|
safelySetColorValue(newValue);
|
|
935
938
|
};
|
|
936
|
-
let incrementToMax = ()=>safelySetColorValue($
|
|
939
|
+
let incrementToMax = ()=>safelySetColorValue($8c33114d2dc9460c$var$MAX_COLOR)
|
|
937
940
|
;
|
|
938
|
-
let decrementToMin = ()=>safelySetColorValue($
|
|
939
|
-
;
|
|
940
|
-
let validate = (value)=>value === '' || !!value.match(/^#?[0-9a-f]{0,6}$/i)?.[0]
|
|
941
|
+
let decrementToMin = ()=>safelySetColorValue($8c33114d2dc9460c$var$MIN_COLOR)
|
|
941
942
|
;
|
|
943
|
+
let validate = (value)=>{
|
|
944
|
+
var ref;
|
|
945
|
+
return value === '' || !!((ref = value.match(/^#?[0-9a-f]{0,6}$/i)) === null || ref === void 0 ? void 0 : ref[0]);
|
|
946
|
+
};
|
|
942
947
|
return {
|
|
943
948
|
validate: validate,
|
|
944
949
|
colorValue: colorValue,
|
|
@@ -951,13 +956,13 @@ function $d47b7df9567aae8f$export$d52a01683abdfcd6(props) {
|
|
|
951
956
|
decrementToMin: decrementToMin
|
|
952
957
|
};
|
|
953
958
|
}
|
|
954
|
-
function $
|
|
955
|
-
let newColor = color ? color : $
|
|
959
|
+
function $8c33114d2dc9460c$var$addColorValue(color, step) {
|
|
960
|
+
let newColor = color ? color : $8c33114d2dc9460c$var$MIN_COLOR;
|
|
956
961
|
let colorInt = newColor.toHexInt();
|
|
957
|
-
let clampInt = Math.min(Math.max(colorInt + step, $
|
|
962
|
+
let clampInt = Math.min(Math.max(colorInt + step, $8c33114d2dc9460c$var$MIN_COLOR_INT), $8c33114d2dc9460c$var$MAX_COLOR_INT);
|
|
958
963
|
if (clampInt !== colorInt) {
|
|
959
964
|
let newColorString = `#${clampInt.toString(16).padStart(6, '0').toUpperCase()}`;
|
|
960
|
-
newColor = $
|
|
965
|
+
newColor = $ed27c69866ff45f2$export$6e865ea70d7724f(newColorString);
|
|
961
966
|
}
|
|
962
967
|
return newColor;
|
|
963
968
|
}
|
|
@@ -965,5 +970,5 @@ function $d47b7df9567aae8f$var$addColorValue(color, step) {
|
|
|
965
970
|
|
|
966
971
|
|
|
967
972
|
|
|
968
|
-
export {$
|
|
973
|
+
export {$ed27c69866ff45f2$export$6e865ea70d7724f as parseColor, $3d60b153dd2f1b1b$export$57bc203e1c9c6d44 as useColorSliderState, $2b492d761166c9cc$export$f4301076d9336137 as useColorWheelState, $8c33114d2dc9460c$export$d52a01683abdfcd6 as useColorFieldState};
|
|
969
974
|
//# sourceMappingURL=module.js.map
|