@react-stately/color 3.0.0-beta.5 → 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 CHANGED
@@ -1,1222 +1,1151 @@
1
- var {
2
- useRef,
3
- useState,
4
- useMemo,
5
- useEffect
6
- } = require("react");
7
-
8
- var {
9
- useSliderState
10
- } = require("@react-stately/slider");
1
+ var $4tN2K$reactstatelyutils = require("@react-stately/utils");
2
+ var $4tN2K$internationalizedmessage = require("@internationalized/message");
3
+ var $4tN2K$internationalizednumber = require("@internationalized/number");
4
+ var $4tN2K$react = require("react");
5
+ var $4tN2K$reactstatelyslider = require("@react-stately/slider");
6
+
7
+ function $parcel$export(e, n, v, s) {
8
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
+ }
10
+ function $parcel$exportWildcard(dest, source) {
11
+ Object.keys(source).forEach(function(key) {
12
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
13
+ return;
14
+ }
11
15
 
12
- var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
16
+ Object.defineProperty(dest, key, {
17
+ enumerable: true,
18
+ get: function get() {
19
+ return source[key];
20
+ }
21
+ });
22
+ });
13
23
 
14
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
24
+ return dest;
25
+ }
26
+ function $parcel$interopDefault(a) {
27
+ return a && a.__esModule ? a.default : a;
28
+ }
15
29
 
16
- var {
17
- NumberFormatter
18
- } = require("@internationalized/number");
30
+ $parcel$export(module.exports, "parseColor", () => $83fe1a57d631223b$export$6e865ea70d7724f);
19
31
 
20
- var {
21
- MessageDictionary
22
- } = require("@internationalized/message");
32
+ var $c0b600cf8eafdee9$exports = {};
33
+ var $b044e7150534af04$exports = {};
34
+ $b044e7150534af04$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
23
35
 
24
- var {
25
- clamp,
26
- toFixedNumber,
27
- useControlledState
28
- } = require("@react-stately/utils");
29
36
 
30
- var _babelRuntimeHelpersInteropRequireDefault = $parcel$interopDefault(require("@babel/runtime/helpers/interopRequireDefault"));
37
+ var $c8bf89547a4a9b3f$exports = {};
38
+ $c8bf89547a4a9b3f$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
31
39
 
32
- function $parcel$interopDefault(a) {
33
- return a && a.__esModule ? a.default : a;
34
- }
35
40
 
36
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ar-AE.json
37
- var $bfb76047ec406c0239c2b8064c9b3ca$exports = {};
38
- $bfb76047ec406c0239c2b8064c9b3ca$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
39
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/bg-BG.json
40
- var $daebde84800f5aeee9aa172172d5b6f$exports = {};
41
- $daebde84800f5aeee9aa172172d5b6f$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
42
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/cs-CZ.json
43
- var $a4cfde59be1b5dcb6fbb06fb09589d$exports = {};
44
- $a4cfde59be1b5dcb6fbb06fb09589d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
45
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/da-DK.json
46
- var $db43cffdd303de8bb2de21feafa35b91$exports = {};
47
- $db43cffdd303de8bb2de21feafa35b91$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
48
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/de-DE.json
49
- var $be2be3d81ee825501b843aad02cb$exports = {};
50
- $be2be3d81ee825501b843aad02cb$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
51
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/el-GR.json
52
- var $c2fbd942c20b23aa5adc2f3f98bd779$exports = {};
53
- $c2fbd942c20b23aa5adc2f3f98bd779$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
54
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/en-US.json
55
- var $abdeb3eeac24b96ea1b32ebcdc8bf175$exports = {};
56
- $abdeb3eeac24b96ea1b32ebcdc8bf175$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
57
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/es-ES.json
58
- var $b59ba9c40583ad49816c29f93cd734c9$exports = {};
59
- $b59ba9c40583ad49816c29f93cd734c9$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
60
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/et-EE.json
61
- var $c3d8ff3bd33905ba4a85bc554a90f3c6$exports = {};
62
- $c3d8ff3bd33905ba4a85bc554a90f3c6$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
63
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/fi-FI.json
64
- var $ccab754253a026877ee47cbc1cb03ca4$exports = {};
65
- $ccab754253a026877ee47cbc1cb03ca4$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
66
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/fr-FR.json
67
- var $ad0191b1c7bbd0c718e613a5db93445d$exports = {};
68
- $ad0191b1c7bbd0c718e613a5db93445d$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
69
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/he-IL.json
70
- var $b4ea486bd9841aabeecd5373b70dace5$exports = {};
71
- $b4ea486bd9841aabeecd5373b70dace5$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
72
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/hr-HR.json
73
- var $b99897eafdd92c74120ae6b4e0248b94$exports = {};
74
- $b99897eafdd92c74120ae6b4e0248b94$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
75
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/hu-HU.json
76
- var $a2609a148daf4c3ca1d5b0ce5ec6aa$exports = {};
77
- $a2609a148daf4c3ca1d5b0ce5ec6aa$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\"}");
78
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/it-IT.json
79
- var $da5b478c1fd01a35d72944d9cb71a34e$exports = {};
80
- $da5b478c1fd01a35d72944d9cb71a34e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
81
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ja-JP.json
82
- var $dc461c55c88305a012147cc9fb7$exports = {};
83
- $dc461c55c88305a012147cc9fb7$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
84
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ko-KR.json
85
- var $b4684c3a5d9d860ab05adffe33fceab3$exports = {};
86
- $b4684c3a5d9d860ab05adffe33fceab3$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
87
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/lt-LT.json
88
- var $be917ddab49d0b151b9f62b823bba50$exports = {};
89
- $be917ddab49d0b151b9f62b823bba50$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
90
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/lv-LV.json
91
- var $f17c13ae26a2d4d99928424c79$exports = {};
92
- $f17c13ae26a2d4d99928424c79$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
93
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/nb-NO.json
94
- var $e4b8847de3ab9d1344d713259cef878$exports = {};
95
- $e4b8847de3ab9d1344d713259cef878$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
96
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/nl-NL.json
97
- var $f077195d9918fb9d3561710aae4a62cc$exports = {};
98
- $f077195d9918fb9d3561710aae4a62cc$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
99
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pl-PL.json
100
- var $d24a27ab79addeeea85ff5eb95318b06$exports = {};
101
- $d24a27ab79addeeea85ff5eb95318b06$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
102
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pt-BR.json
103
- var $ceb70a725fde80d49dd1138e8ca9e306$exports = {};
104
- $ceb70a725fde80d49dd1138e8ca9e306$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
105
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pt-PT.json
106
- var $c6257abacc4cefb22bbd8081edc05$exports = {};
107
- $c6257abacc4cefb22bbd8081edc05$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
108
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ro-RO.json
109
- var $f25ae63965bcad80a86787e16972$exports = {};
110
- $f25ae63965bcad80a86787e16972$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
111
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ru-RU.json
112
- var $d131f7f35da9efbf3e5c4c90d88523$exports = {};
113
- $d131f7f35da9efbf3e5c4c90d88523$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
114
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sk-SK.json
115
- var $bc31c73edcf6a69405580806e86a1580$exports = {};
116
- $bc31c73edcf6a69405580806e86a1580$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
117
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sl-SI.json
118
- var $df72c407396964a6c780d567792cdd2$exports = {};
119
- $df72c407396964a6c780d567792cdd2$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
120
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sr-SP.json
121
- var $cad65e4825dd66e0bd6c1ff51bb48a91$exports = {};
122
- $cad65e4825dd66e0bd6c1ff51bb48a91$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
123
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sv-SE.json
124
- var $d7c0d1f1dc8ea1aa86708102c79a$exports = {};
125
- $d7c0d1f1dc8ea1aa86708102c79a$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
126
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/tr-TR.json
127
- var $a0d6a531d06c52db2f4cd7c96356300e$exports = {};
128
- $a0d6a531d06c52db2f4cd7c96356300e$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\"}");
129
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/uk-UA.json
130
- var $a70877667b8705b2c85173d23d$exports = {};
131
- $a70877667b8705b2c85173d23d$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
132
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/zh-CN.json
133
- var $c38ee15e302a37d9225987d335ad869e$exports = {};
134
- $c38ee15e302a37d9225987d335ad869e$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
135
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/zh-TW.json
136
- var $d2a1fa8d41cf433c2df57cdf8eba52a3$exports = {};
137
- $d2a1fa8d41cf433c2df57cdf8eba52a3$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
138
- // @ts-ignore
139
- const $b54655da051f787a04029ec3711$var$intlMessages = {
140
- "ar-AE": _babelRuntimeHelpersInteropRequireDefault($bfb76047ec406c0239c2b8064c9b3ca$exports).default,
141
- "bg-BG": _babelRuntimeHelpersInteropRequireDefault($daebde84800f5aeee9aa172172d5b6f$exports).default,
142
- "cs-CZ": _babelRuntimeHelpersInteropRequireDefault($a4cfde59be1b5dcb6fbb06fb09589d$exports).default,
143
- "da-DK": _babelRuntimeHelpersInteropRequireDefault($db43cffdd303de8bb2de21feafa35b91$exports).default,
144
- "de-DE": _babelRuntimeHelpersInteropRequireDefault($be2be3d81ee825501b843aad02cb$exports).default,
145
- "el-GR": _babelRuntimeHelpersInteropRequireDefault($c2fbd942c20b23aa5adc2f3f98bd779$exports).default,
146
- "en-US": _babelRuntimeHelpersInteropRequireDefault($abdeb3eeac24b96ea1b32ebcdc8bf175$exports).default,
147
- "es-ES": _babelRuntimeHelpersInteropRequireDefault($b59ba9c40583ad49816c29f93cd734c9$exports).default,
148
- "et-EE": _babelRuntimeHelpersInteropRequireDefault($c3d8ff3bd33905ba4a85bc554a90f3c6$exports).default,
149
- "fi-FI": _babelRuntimeHelpersInteropRequireDefault($ccab754253a026877ee47cbc1cb03ca4$exports).default,
150
- "fr-FR": _babelRuntimeHelpersInteropRequireDefault($ad0191b1c7bbd0c718e613a5db93445d$exports).default,
151
- "he-IL": _babelRuntimeHelpersInteropRequireDefault($b4ea486bd9841aabeecd5373b70dace5$exports).default,
152
- "hr-HR": _babelRuntimeHelpersInteropRequireDefault($b99897eafdd92c74120ae6b4e0248b94$exports).default,
153
- "hu-HU": _babelRuntimeHelpersInteropRequireDefault($a2609a148daf4c3ca1d5b0ce5ec6aa$exports).default,
154
- "it-IT": _babelRuntimeHelpersInteropRequireDefault($da5b478c1fd01a35d72944d9cb71a34e$exports).default,
155
- "ja-JP": _babelRuntimeHelpersInteropRequireDefault($dc461c55c88305a012147cc9fb7$exports).default,
156
- "ko-KR": _babelRuntimeHelpersInteropRequireDefault($b4684c3a5d9d860ab05adffe33fceab3$exports).default,
157
- "lt-LT": _babelRuntimeHelpersInteropRequireDefault($be917ddab49d0b151b9f62b823bba50$exports).default,
158
- "lv-LV": _babelRuntimeHelpersInteropRequireDefault($f17c13ae26a2d4d99928424c79$exports).default,
159
- "nb-NO": _babelRuntimeHelpersInteropRequireDefault($e4b8847de3ab9d1344d713259cef878$exports).default,
160
- "nl-NL": _babelRuntimeHelpersInteropRequireDefault($f077195d9918fb9d3561710aae4a62cc$exports).default,
161
- "pl-PL": _babelRuntimeHelpersInteropRequireDefault($d24a27ab79addeeea85ff5eb95318b06$exports).default,
162
- "pt-BR": _babelRuntimeHelpersInteropRequireDefault($ceb70a725fde80d49dd1138e8ca9e306$exports).default,
163
- "pt-PT": _babelRuntimeHelpersInteropRequireDefault($c6257abacc4cefb22bbd8081edc05$exports).default,
164
- "ro-RO": _babelRuntimeHelpersInteropRequireDefault($f25ae63965bcad80a86787e16972$exports).default,
165
- "ru-RU": _babelRuntimeHelpersInteropRequireDefault($d131f7f35da9efbf3e5c4c90d88523$exports).default,
166
- "sk-SK": _babelRuntimeHelpersInteropRequireDefault($bc31c73edcf6a69405580806e86a1580$exports).default,
167
- "sl-SI": _babelRuntimeHelpersInteropRequireDefault($df72c407396964a6c780d567792cdd2$exports).default,
168
- "sr-SP": _babelRuntimeHelpersInteropRequireDefault($cad65e4825dd66e0bd6c1ff51bb48a91$exports).default,
169
- "sv-SE": _babelRuntimeHelpersInteropRequireDefault($d7c0d1f1dc8ea1aa86708102c79a$exports).default,
170
- "tr-TR": _babelRuntimeHelpersInteropRequireDefault($a0d6a531d06c52db2f4cd7c96356300e$exports).default,
171
- "uk-UA": _babelRuntimeHelpersInteropRequireDefault($a70877667b8705b2c85173d23d$exports).default,
172
- "zh-CN": _babelRuntimeHelpersInteropRequireDefault($c38ee15e302a37d9225987d335ad869e$exports).default,
173
- "zh-TW": _babelRuntimeHelpersInteropRequireDefault($d2a1fa8d41cf433c2df57cdf8eba52a3$exports).default
174
- };
175
- const $b54655da051f787a04029ec3711$var$messages = new MessageDictionary($b54655da051f787a04029ec3711$var$intlMessages);
176
- /** Parses a color from a string value. Throws an error if the string could not be parsed. */
41
+ var $8365d8dfc7e4c985$exports = {};
42
+ $8365d8dfc7e4c985$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
177
43
 
178
- function parseColor(value) {
179
- let res = $b54655da051f787a04029ec3711$var$RGBColor.parse(value) || $b54655da051f787a04029ec3711$var$HSBColor.parse(value) || $b54655da051f787a04029ec3711$var$HSLColor.parse(value);
180
44
 
181
- if (res) {
182
- return res;
183
- }
45
+ var $8d95eeaa73699e56$exports = {};
46
+ $8d95eeaa73699e56$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
184
47
 
185
- throw new Error('Invalid color value: ' + value);
186
- }
187
48
 
188
- exports.parseColor = parseColor;
49
+ var $2dbbd166053d6d10$exports = {};
50
+ $2dbbd166053d6d10$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
189
51
 
190
- class $b54655da051f787a04029ec3711$var$Color {
191
- toHexInt() {
192
- return this.toFormat('rgb').toHexInt();
193
- }
194
52
 
195
- getChannelValue(channel) {
196
- if (channel in this) {
197
- return this[channel];
198
- }
53
+ var $1fcbdf9eaf6cc074$exports = {};
54
+ $1fcbdf9eaf6cc074$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
199
55
 
200
- throw new Error('Unsupported color channel: ' + channel);
201
- }
202
56
 
203
- withChannelValue(channel, value) {
204
- if (channel in this) {
205
- let x = this.clone();
206
- x[channel] = value;
207
- return x;
208
- }
57
+ var $42d54be461715959$exports = {};
58
+ $42d54be461715959$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
209
59
 
210
- throw new Error('Unsupported color channel: ' + channel);
211
- }
212
60
 
213
- getChannelName(channel, locale) {
214
- return $b54655da051f787a04029ec3711$var$messages.getStringForLocale(channel, locale);
215
- }
61
+ var $911646bd5662c33d$exports = {};
62
+ $911646bd5662c33d$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
216
63
 
217
- }
218
64
 
219
- const $b54655da051f787a04029ec3711$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i; // X = <negative/positive number with/without decimal places>
220
- // before/after a comma, 0 or more whitespaces are allowed
221
- // - rgb(X, X, X)
222
- // - rgba(X, X, X, X)
65
+ var $6e8998796901e680$exports = {};
66
+ $6e8998796901e680$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
223
67
 
224
- const $b54655da051f787a04029ec3711$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+)?)\)/;
225
-
226
- class $b54655da051f787a04029ec3711$var$RGBColor extends $b54655da051f787a04029ec3711$var$Color {
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
- }
234
-
235
- static parse(value) {
236
- let m;
237
-
238
- if (m = value.match($b54655da051f787a04029ec3711$var$HEX_REGEX)) {
239
- if (m[1]) {
240
- let r = parseInt(m[1][0] + m[1][0], 16);
241
- let g = parseInt(m[1][1] + m[1][1], 16);
242
- let b = parseInt(m[1][2] + m[1][2], 16);
243
- return new $b54655da051f787a04029ec3711$var$RGBColor(r, g, b, 1);
244
- } else if (m[2]) {
245
- let r = parseInt(m[2][0] + m[2][1], 16);
246
- let g = parseInt(m[2][2] + m[2][3], 16);
247
- let b = parseInt(m[2][4] + m[2][5], 16);
248
- return new $b54655da051f787a04029ec3711$var$RGBColor(r, g, b, 1);
249
- }
250
- }
251
68
 
252
- if (m = value.match($b54655da051f787a04029ec3711$var$RGB_REGEX)) {
253
- var _m$;
69
+ var $4503b4001036be6d$exports = {};
70
+ $4503b4001036be6d$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
254
71
 
255
- const [r, g, b, a] = ((_m$ = m[1]) != null ? _m$ : m[2]).split(',').map(n => Number(n.trim()));
256
- return new $b54655da051f787a04029ec3711$var$RGBColor(clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255), clamp(a != null ? a : 1, 0, 1));
257
- }
258
- }
259
72
 
260
- toString(format) {
261
- switch (format) {
262
- case 'hex':
263
- return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
73
+ var $721e7016769a7a7f$exports = {};
74
+ $721e7016769a7a7f$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
264
75
 
265
- case 'hexa':
266
- return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();
267
76
 
268
- case 'rgb':
269
- return "rgb(" + this.red + ", " + this.green + ", " + this.blue + ")";
77
+ var $dcc290e5792f9bab$exports = {};
78
+ $dcc290e5792f9bab$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
270
79
 
271
- case 'css':
272
- case 'rgba':
273
- return "rgba(" + this.red + ", " + this.green + ", " + this.blue + ", " + this.alpha + ")";
274
80
 
275
- default:
276
- return this.toFormat(format).toString(format);
277
- }
278
- }
279
-
280
- toFormat(format) {
281
- switch (format) {
282
- case 'hex':
283
- case 'hexa':
284
- case 'rgb':
285
- case 'rgba':
286
- return this;
287
-
288
- case 'hsb':
289
- case 'hsba':
290
- return this.toHSB();
291
-
292
- case 'hsl':
293
- case 'hsla':
294
- return this.toHSL();
295
-
296
- default:
297
- throw new Error('Unsupported color conversion: rgb -> ' + format);
298
- }
299
- }
81
+ var $d93d5aebdd12334c$exports = {};
82
+ $d93d5aebdd12334c$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
300
83
 
301
- toHexInt() {
302
- return this.red << 16 | this.green << 8 | this.blue;
303
- }
304
- /**
305
- * Converts an RGB color value to HSB.
306
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
307
- * @returns An HSBColor object.
308
- */
309
-
310
-
311
- toHSB() {
312
- const red = this.red / 255;
313
- const green = this.green / 255;
314
- const blue = this.blue / 255;
315
- const min = Math.min(red, green, blue);
316
- const brightness = Math.max(red, green, blue);
317
- const chroma = brightness - min;
318
- const saturation = brightness === 0 ? 0 : chroma / brightness;
319
- let hue = 0; // achromatic
320
-
321
- if (chroma !== 0) {
322
- switch (brightness) {
323
- case red:
324
- hue = (green - blue) / chroma + (green < blue ? 6 : 0);
325
- break;
326
-
327
- case green:
328
- hue = (blue - red) / chroma + 2;
329
- break;
330
-
331
- case blue:
332
- hue = (red - green) / chroma + 4;
333
- break;
334
- }
335
84
 
336
- hue /= 6;
337
- }
85
+ var $a3749e0ee87dbebc$exports = {};
86
+ $a3749e0ee87dbebc$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\"}");
338
87
 
339
- return new $b54655da051f787a04029ec3711$var$HSBColor(toFixedNumber(hue * 360, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(brightness * 100, 2), this.alpha);
340
- }
341
- /**
342
- * Converts an RGB color value to HSL.
343
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
344
- * @returns An HSLColor object.
345
- */
346
-
347
-
348
- toHSL() {
349
- const red = this.red / 255;
350
- const green = this.green / 255;
351
- const blue = this.blue / 255;
352
- const min = Math.min(red, green, blue);
353
- const max = Math.max(red, green, blue);
354
- const lightness = (max + min) / 2;
355
- const chroma = max - min;
356
- let hue;
357
- let saturation;
358
-
359
- if (chroma === 0) {
360
- hue = saturation = 0; // achromatic
361
- } else {
362
- saturation = chroma / (lightness < .5 ? max + min : 2 - max - min);
363
-
364
- switch (max) {
365
- case red:
366
- hue = (green - blue) / chroma + (green < blue ? 6 : 0);
367
- break;
368
-
369
- case green:
370
- hue = (blue - red) / chroma + 2;
371
- break;
372
-
373
- case blue:
374
- hue = (red - green) / chroma + 4;
375
- break;
376
- }
377
88
 
378
- hue /= 6;
379
- }
89
+ var $2fdb931b6c9652b9$exports = {};
90
+ $2fdb931b6c9652b9$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
380
91
 
381
- return new $b54655da051f787a04029ec3711$var$HSLColor(toFixedNumber(hue * 360, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(lightness * 100, 2), this.alpha);
382
- }
383
92
 
384
- clone() {
385
- return new $b54655da051f787a04029ec3711$var$RGBColor(this.red, this.green, this.blue, this.alpha);
386
- }
93
+ var $219c839b59015b4f$exports = {};
94
+ $219c839b59015b4f$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
387
95
 
388
- getChannelRange(channel) {
389
- switch (channel) {
390
- case 'red':
391
- case 'green':
392
- case 'blue':
393
- return {
394
- minValue: 0,
395
- maxValue: 255,
396
- step: 1
397
- };
398
96
 
399
- case 'alpha':
400
- return {
401
- minValue: 0,
402
- maxValue: 1,
403
- step: 0.01
404
- };
97
+ var $b7f67f414086d976$exports = {};
98
+ $b7f67f414086d976$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
405
99
 
406
- default:
407
- throw new Error('Unknown color channel: ' + channel);
408
- }
409
- }
410
-
411
- formatChannelValue(channel, locale) {
412
- let options;
413
- let value = this.getChannelValue(channel);
414
-
415
- switch (channel) {
416
- case 'red':
417
- case 'green':
418
- case 'blue':
419
- options = {
420
- style: 'decimal'
421
- };
422
- break;
423
100
 
424
- case 'alpha':
425
- options = {
426
- style: 'percent'
427
- };
428
- break;
101
+ var $f27b2ac7d517417c$exports = {};
102
+ $f27b2ac7d517417c$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
429
103
 
430
- default:
431
- throw new Error('Unknown color channel: ' + channel);
432
- }
433
104
 
434
- return new NumberFormatter(locale, options).format(value);
435
- }
105
+ var $e92168db3cbe2797$exports = {};
106
+ $e92168db3cbe2797$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
436
107
 
437
- getColorSpace() {
438
- return 'rgb';
439
- }
440
108
 
441
- } // X = <negative/positive number with/without decimal places>
442
- // before/after a comma, 0 or more whitespaces are allowed
443
- // - hsb(X, X%, X%)
444
- // - hsba(X, X%, X%, X)
109
+ var $44b012e02982e825$exports = {};
110
+ $44b012e02982e825$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
445
111
 
446
112
 
447
- const $b54655da051f787a04029ec3711$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+)?)\)/;
113
+ var $64fbd91459613d8b$exports = {};
114
+ $64fbd91459613d8b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
448
115
 
449
- class $b54655da051f787a04029ec3711$var$HSBColor extends $b54655da051f787a04029ec3711$var$Color {
450
- constructor(hue, saturation, brightness, alpha) {
451
- super();
452
- this.hue = hue;
453
- this.saturation = saturation;
454
- this.brightness = brightness;
455
- this.alpha = alpha;
456
- }
457
116
 
458
- static parse(value) {
459
- let m;
117
+ var $83fabdc4e0df6af9$exports = {};
118
+ $83fabdc4e0df6af9$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
460
119
 
461
- if (m = value.match($b54655da051f787a04029ec3711$var$HSB_REGEX)) {
462
- var _m$2;
463
120
 
464
- const [h, s, b, a] = ((_m$2 = m[1]) != null ? _m$2 : m[2]).split(',').map(n => Number(n.trim().replace('%', '')));
465
- return new $b54655da051f787a04029ec3711$var$HSBColor($b54655da051f787a04029ec3711$var$mod(h, 360), clamp(s, 0, 100), clamp(b, 0, 100), clamp(a != null ? a : 1, 0, 1));
466
- }
467
- }
121
+ var $30b915257fa66ccf$exports = {};
122
+ $30b915257fa66ccf$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
468
123
 
469
- toString(format) {
470
- switch (format) {
471
- case 'css':
472
- return this.toHSL().toString('css');
473
124
 
474
- case 'hex':
475
- return this.toRGB().toString('hex');
125
+ var $ce75e45ccbc92491$exports = {};
126
+ $ce75e45ccbc92491$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
476
127
 
477
- case 'hexa':
478
- return this.toRGB().toString('hexa');
479
128
 
480
- case 'hsb':
481
- return "hsb(" + this.hue + ", " + toFixedNumber(this.saturation, 2) + "%, " + toFixedNumber(this.brightness, 2) + "%)";
129
+ var $225440ee53a1fecd$exports = {};
130
+ $225440ee53a1fecd$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
482
131
 
483
- case 'hsba':
484
- return "hsba(" + this.hue + ", " + toFixedNumber(this.saturation, 2) + "%, " + toFixedNumber(this.brightness, 2) + "%, " + this.alpha + ")";
485
132
 
486
- default:
487
- return this.toFormat(format).toString(format);
488
- }
489
- }
133
+ var $cbc60c1dd4e689ff$exports = {};
134
+ $cbc60c1dd4e689ff$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
490
135
 
491
- toFormat(format) {
492
- switch (format) {
493
- case 'hsb':
494
- case 'hsba':
495
- return this;
496
136
 
497
- case 'hsl':
498
- case 'hsla':
499
- return this.toHSL();
137
+ var $8612080ab5efe0cf$exports = {};
138
+ $8612080ab5efe0cf$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
500
139
 
501
- case 'rgb':
502
- case 'rgba':
503
- return this.toRGB();
504
140
 
505
- default:
506
- throw new Error('Unsupported color conversion: hsb -> ' + format);
507
- }
508
- }
509
- /**
510
- * Converts a HSB color to HSL.
511
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
512
- * @returns An HSLColor object.
513
- */
141
+ var $99cc034ddd2b7d86$exports = {};
142
+ $99cc034ddd2b7d86$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
514
143
 
515
144
 
516
- toHSL() {
517
- let saturation = this.saturation / 100;
518
- let brightness = this.brightness / 100;
519
- let lightness = brightness * (1 - saturation / 2);
520
- saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
521
- return new $b54655da051f787a04029ec3711$var$HSLColor(toFixedNumber(this.hue, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(lightness * 100, 2), this.alpha);
522
- }
523
- /**
524
- * Converts a HSV color value to RGB.
525
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
526
- * @returns An RGBColor object.
527
- */
145
+ var $dc671800d61be83e$exports = {};
146
+ $dc671800d61be83e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
528
147
 
529
148
 
530
- toRGB() {
531
- let hue = this.hue;
532
- let saturation = this.saturation / 100;
533
- let brightness = this.brightness / 100;
149
+ var $0f4790e2f696e63f$exports = {};
150
+ $0f4790e2f696e63f$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
534
151
 
535
- let fn = function fn(n, k) {
536
- if (k === void 0) {
537
- k = (n + hue / 60) % 6;
538
- }
539
152
 
540
- return brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0);
541
- };
153
+ var $deb5f82eb1998a3c$exports = {};
154
+ $deb5f82eb1998a3c$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\"}");
542
155
 
543
- return new $b54655da051f787a04029ec3711$var$RGBColor(Math.round(fn(5) * 255), Math.round(fn(3) * 255), Math.round(fn(1) * 255), this.alpha);
544
- }
545
156
 
546
- clone() {
547
- return new $b54655da051f787a04029ec3711$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
548
- }
157
+ var $99530e1782ca02cc$exports = {};
158
+ $99530e1782ca02cc$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
549
159
 
550
- getChannelRange(channel) {
551
- switch (channel) {
552
- case 'hue':
553
- return {
554
- minValue: 0,
555
- maxValue: 360,
556
- step: 1
557
- };
558
160
 
559
- case 'saturation':
560
- case 'brightness':
561
- return {
562
- minValue: 0,
563
- maxValue: 100,
564
- step: 1
565
- };
161
+ var $a6e8f490b423d65e$exports = {};
162
+ $a6e8f490b423d65e$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
566
163
 
567
- case 'alpha':
568
- return {
569
- minValue: 0,
570
- maxValue: 1,
571
- step: 0.01
572
- };
573
164
 
574
- default:
575
- throw new Error('Unknown color channel: ' + channel);
576
- }
577
- }
578
-
579
- formatChannelValue(channel, locale) {
580
- let options;
581
- let value = this.getChannelValue(channel);
582
-
583
- switch (channel) {
584
- case 'hue':
585
- options = {
586
- style: 'unit',
587
- unit: 'degree',
588
- unitDisplay: 'narrow'
589
- };
590
- break;
165
+ var $eba443dcc93cab9a$exports = {};
166
+ $eba443dcc93cab9a$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
591
167
 
592
- case 'saturation':
593
- case 'brightness':
594
- options = {
595
- style: 'percent'
596
- };
597
- value /= 100;
598
- break;
599
168
 
600
- case 'alpha':
601
- options = {
602
- style: 'percent'
603
- };
604
- break;
169
+ $c0b600cf8eafdee9$exports = {
170
+ "ar-AE": $b044e7150534af04$exports,
171
+ "bg-BG": $c8bf89547a4a9b3f$exports,
172
+ "cs-CZ": $8365d8dfc7e4c985$exports,
173
+ "da-DK": $8d95eeaa73699e56$exports,
174
+ "de-DE": $2dbbd166053d6d10$exports,
175
+ "el-GR": $1fcbdf9eaf6cc074$exports,
176
+ "en-US": $42d54be461715959$exports,
177
+ "es-ES": $911646bd5662c33d$exports,
178
+ "et-EE": $6e8998796901e680$exports,
179
+ "fi-FI": $4503b4001036be6d$exports,
180
+ "fr-FR": $721e7016769a7a7f$exports,
181
+ "he-IL": $dcc290e5792f9bab$exports,
182
+ "hr-HR": $d93d5aebdd12334c$exports,
183
+ "hu-HU": $a3749e0ee87dbebc$exports,
184
+ "it-IT": $2fdb931b6c9652b9$exports,
185
+ "ja-JP": $219c839b59015b4f$exports,
186
+ "ko-KR": $b7f67f414086d976$exports,
187
+ "lt-LT": $f27b2ac7d517417c$exports,
188
+ "lv-LV": $e92168db3cbe2797$exports,
189
+ "nb-NO": $44b012e02982e825$exports,
190
+ "nl-NL": $64fbd91459613d8b$exports,
191
+ "pl-PL": $83fabdc4e0df6af9$exports,
192
+ "pt-BR": $30b915257fa66ccf$exports,
193
+ "pt-PT": $ce75e45ccbc92491$exports,
194
+ "ro-RO": $225440ee53a1fecd$exports,
195
+ "ru-RU": $cbc60c1dd4e689ff$exports,
196
+ "sk-SK": $8612080ab5efe0cf$exports,
197
+ "sl-SI": $99cc034ddd2b7d86$exports,
198
+ "sr-SP": $dc671800d61be83e$exports,
199
+ "sv-SE": $0f4790e2f696e63f$exports,
200
+ "tr-TR": $deb5f82eb1998a3c$exports,
201
+ "uk-UA": $99530e1782ca02cc$exports,
202
+ "zh-CN": $a6e8f490b423d65e$exports,
203
+ "zh-TW": $eba443dcc93cab9a$exports
204
+ };
605
205
 
606
- default:
607
- throw new Error('Unknown color channel: ' + channel);
608
- }
609
206
 
610
- return new NumberFormatter(locale, options).format(value);
611
- }
612
207
 
613
- getColorSpace() {
614
- return 'hsb';
615
- }
616
208
 
617
- } // X = <negative/positive number with/without decimal places>
209
+ const $83fe1a57d631223b$var$messages = new $4tN2K$internationalizedmessage.MessageDictionary((/*@__PURE__*/$parcel$interopDefault($c0b600cf8eafdee9$exports)));
210
+ function $83fe1a57d631223b$export$6e865ea70d7724f(value) {
211
+ let res = $83fe1a57d631223b$var$RGBColor.parse(value) || $83fe1a57d631223b$var$HSBColor.parse(value) || $83fe1a57d631223b$var$HSLColor.parse(value);
212
+ if (res) return res;
213
+ throw new Error('Invalid color value: ' + value);
214
+ }
215
+ function $83fe1a57d631223b$export$4cde5df63f53f473(v) {
216
+ if (typeof v === 'string') return $83fe1a57d631223b$export$6e865ea70d7724f(v);
217
+ else return v;
218
+ }
219
+ class $83fe1a57d631223b$var$Color {
220
+ toHexInt() {
221
+ return this.toFormat('rgb').toHexInt();
222
+ }
223
+ getChannelValue(channel) {
224
+ if (channel in this) return this[channel];
225
+ throw new Error('Unsupported color channel: ' + channel);
226
+ }
227
+ withChannelValue(channel, value) {
228
+ if (channel in this) {
229
+ let x = this.clone();
230
+ x[channel] = value;
231
+ return x;
232
+ }
233
+ throw new Error('Unsupported color channel: ' + channel);
234
+ }
235
+ getChannelName(channel, locale) {
236
+ return $83fe1a57d631223b$var$messages.getStringForLocale(channel, locale);
237
+ }
238
+ }
239
+ const $83fe1a57d631223b$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i;
240
+ // X = <negative/positive number with/without decimal places>
241
+ // before/after a comma, 0 or more whitespaces are allowed
242
+ // - rgb(X, X, X)
243
+ // - rgba(X, X, X, X)
244
+ const $83fe1a57d631223b$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+)?)\)/;
245
+ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
246
+ static parse(value) {
247
+ let m;
248
+ if (m = value.match($83fe1a57d631223b$var$HEX_REGEX)) {
249
+ if (m[1]) {
250
+ let r = parseInt(m[1][0] + m[1][0], 16);
251
+ let g = parseInt(m[1][1] + m[1][1], 16);
252
+ let b = parseInt(m[1][2] + m[1][2], 16);
253
+ return new $83fe1a57d631223b$var$RGBColor(r, g, b, 1);
254
+ } else if (m[2]) {
255
+ let r = parseInt(m[2][0] + m[2][1], 16);
256
+ let g = parseInt(m[2][2] + m[2][3], 16);
257
+ let b = parseInt(m[2][4] + m[2][5], 16);
258
+ return new $83fe1a57d631223b$var$RGBColor(r, g, b, 1);
259
+ }
260
+ }
261
+ if (m = value.match($83fe1a57d631223b$var$RGB_REGEX)) {
262
+ var ref;
263
+ const [r, g, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim())
264
+ );
265
+ return new $83fe1a57d631223b$var$RGBColor($4tN2K$reactstatelyutils.clamp(r, 0, 255), $4tN2K$reactstatelyutils.clamp(g, 0, 255), $4tN2K$reactstatelyutils.clamp(b, 0, 255), $4tN2K$reactstatelyutils.clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
266
+ }
267
+ }
268
+ toString(format) {
269
+ switch(format){
270
+ case 'hex':
271
+ return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
272
+ case 'hexa':
273
+ return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();
274
+ case 'rgb':
275
+ return `rgb(${this.red}, ${this.green}, ${this.blue})`;
276
+ case 'css':
277
+ case 'rgba':
278
+ return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
279
+ default:
280
+ return this.toFormat(format).toString(format);
281
+ }
282
+ }
283
+ toFormat(format) {
284
+ switch(format){
285
+ case 'hex':
286
+ case 'hexa':
287
+ case 'rgb':
288
+ case 'rgba':
289
+ return this;
290
+ case 'hsb':
291
+ case 'hsba':
292
+ return this.toHSB();
293
+ case 'hsl':
294
+ case 'hsla':
295
+ return this.toHSL();
296
+ default:
297
+ throw new Error('Unsupported color conversion: rgb -> ' + format);
298
+ }
299
+ }
300
+ toHexInt() {
301
+ return this.red << 16 | this.green << 8 | this.blue;
302
+ }
303
+ /**
304
+ * Converts an RGB color value to HSB.
305
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
306
+ * @returns An HSBColor object.
307
+ */ toHSB() {
308
+ const red = this.red / 255;
309
+ const green = this.green / 255;
310
+ const blue = this.blue / 255;
311
+ const min = Math.min(red, green, blue);
312
+ const brightness = Math.max(red, green, blue);
313
+ const chroma = brightness - min;
314
+ const saturation = brightness === 0 ? 0 : chroma / brightness;
315
+ let hue = 0; // achromatic
316
+ if (chroma !== 0) {
317
+ switch(brightness){
318
+ case red:
319
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
320
+ break;
321
+ case green:
322
+ hue = (blue - red) / chroma + 2;
323
+ break;
324
+ case blue:
325
+ hue = (red - green) / chroma + 4;
326
+ break;
327
+ }
328
+ hue /= 6;
329
+ }
330
+ return new $83fe1a57d631223b$var$HSBColor($4tN2K$reactstatelyutils.toFixedNumber(hue * 360, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(brightness * 100, 2), this.alpha);
331
+ }
332
+ /**
333
+ * Converts an RGB color value to HSL.
334
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
335
+ * @returns An HSLColor object.
336
+ */ toHSL() {
337
+ const red = this.red / 255;
338
+ const green = this.green / 255;
339
+ const blue = this.blue / 255;
340
+ const min = Math.min(red, green, blue);
341
+ const max = Math.max(red, green, blue);
342
+ const lightness = (max + min) / 2;
343
+ const chroma = max - min;
344
+ let hue;
345
+ let saturation;
346
+ if (chroma === 0) hue = saturation = 0; // achromatic
347
+ else {
348
+ saturation = chroma / (lightness < 0.5 ? max + min : 2 - max - min);
349
+ switch(max){
350
+ case red:
351
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
352
+ break;
353
+ case green:
354
+ hue = (blue - red) / chroma + 2;
355
+ break;
356
+ case blue:
357
+ hue = (red - green) / chroma + 4;
358
+ break;
359
+ }
360
+ hue /= 6;
361
+ }
362
+ return new $83fe1a57d631223b$var$HSLColor($4tN2K$reactstatelyutils.toFixedNumber(hue * 360, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(lightness * 100, 2), this.alpha);
363
+ }
364
+ clone() {
365
+ return new $83fe1a57d631223b$var$RGBColor(this.red, this.green, this.blue, this.alpha);
366
+ }
367
+ getChannelRange(channel) {
368
+ switch(channel){
369
+ case 'red':
370
+ case 'green':
371
+ case 'blue':
372
+ return {
373
+ minValue: 0,
374
+ maxValue: 255,
375
+ step: 1,
376
+ pageSize: 17
377
+ };
378
+ case 'alpha':
379
+ return {
380
+ minValue: 0,
381
+ maxValue: 1,
382
+ step: 0.01,
383
+ pageSize: 0.1
384
+ };
385
+ default:
386
+ throw new Error('Unknown color channel: ' + channel);
387
+ }
388
+ }
389
+ formatChannelValue(channel, locale) {
390
+ let options;
391
+ let value = this.getChannelValue(channel);
392
+ switch(channel){
393
+ case 'red':
394
+ case 'green':
395
+ case 'blue':
396
+ options = {
397
+ style: 'decimal'
398
+ };
399
+ break;
400
+ case 'alpha':
401
+ options = {
402
+ style: 'percent'
403
+ };
404
+ break;
405
+ default:
406
+ throw new Error('Unknown color channel: ' + channel);
407
+ }
408
+ return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
409
+ }
410
+ getColorSpace() {
411
+ return 'rgb';
412
+ }
413
+ constructor(red, green, blue, alpha){
414
+ super();
415
+ this.red = red;
416
+ this.green = green;
417
+ this.blue = blue;
418
+ this.alpha = alpha;
419
+ }
420
+ }
421
+ // X = <negative/positive number with/without decimal places>
422
+ // before/after a comma, 0 or more whitespaces are allowed
423
+ // - hsb(X, X%, X%)
424
+ // - hsba(X, X%, X%, X)
425
+ const $83fe1a57d631223b$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+)?)\)/;
426
+ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
427
+ static parse(value) {
428
+ let m;
429
+ if (m = value.match($83fe1a57d631223b$var$HSB_REGEX)) {
430
+ var ref;
431
+ const [h, s, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
432
+ );
433
+ return new $83fe1a57d631223b$var$HSBColor($83fe1a57d631223b$var$mod(h, 360), $4tN2K$reactstatelyutils.clamp(s, 0, 100), $4tN2K$reactstatelyutils.clamp(b, 0, 100), $4tN2K$reactstatelyutils.clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
434
+ }
435
+ }
436
+ toString(format) {
437
+ switch(format){
438
+ case 'css':
439
+ return this.toHSL().toString('css');
440
+ case 'hex':
441
+ return this.toRGB().toString('hex');
442
+ case 'hexa':
443
+ return this.toRGB().toString('hexa');
444
+ case 'hsb':
445
+ return `hsb(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.brightness, 2)}%)`;
446
+ case 'hsba':
447
+ return `hsba(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;
448
+ default:
449
+ return this.toFormat(format).toString(format);
450
+ }
451
+ }
452
+ toFormat(format) {
453
+ switch(format){
454
+ case 'hsb':
455
+ case 'hsba':
456
+ return this;
457
+ case 'hsl':
458
+ case 'hsla':
459
+ return this.toHSL();
460
+ case 'rgb':
461
+ case 'rgba':
462
+ return this.toRGB();
463
+ default:
464
+ throw new Error('Unsupported color conversion: hsb -> ' + format);
465
+ }
466
+ }
467
+ /**
468
+ * Converts a HSB color to HSL.
469
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
470
+ * @returns An HSLColor object.
471
+ */ toHSL() {
472
+ let saturation = this.saturation / 100;
473
+ let brightness = this.brightness / 100;
474
+ let lightness = brightness * (1 - saturation / 2);
475
+ saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
476
+ return new $83fe1a57d631223b$var$HSLColor($4tN2K$reactstatelyutils.toFixedNumber(this.hue, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(lightness * 100, 2), this.alpha);
477
+ }
478
+ /**
479
+ * Converts a HSV color value to RGB.
480
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
481
+ * @returns An RGBColor object.
482
+ */ toRGB() {
483
+ let hue = this.hue;
484
+ let saturation = this.saturation / 100;
485
+ let brightness = this.brightness / 100;
486
+ let fn = (n, k = (n + hue / 60) % 6)=>brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0)
487
+ ;
488
+ return new $83fe1a57d631223b$var$RGBColor(Math.round(fn(5) * 255), Math.round(fn(3) * 255), Math.round(fn(1) * 255), this.alpha);
489
+ }
490
+ clone() {
491
+ return new $83fe1a57d631223b$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
492
+ }
493
+ getChannelRange(channel) {
494
+ switch(channel){
495
+ case 'hue':
496
+ return {
497
+ minValue: 0,
498
+ maxValue: 360,
499
+ step: 1,
500
+ pageSize: 15
501
+ };
502
+ case 'saturation':
503
+ case 'brightness':
504
+ return {
505
+ minValue: 0,
506
+ maxValue: 100,
507
+ step: 1,
508
+ pageSize: 10
509
+ };
510
+ case 'alpha':
511
+ return {
512
+ minValue: 0,
513
+ maxValue: 1,
514
+ step: 0.01,
515
+ pageSize: 0.1
516
+ };
517
+ default:
518
+ throw new Error('Unknown color channel: ' + channel);
519
+ }
520
+ }
521
+ formatChannelValue(channel, locale) {
522
+ let options;
523
+ let value = this.getChannelValue(channel);
524
+ switch(channel){
525
+ case 'hue':
526
+ options = {
527
+ style: 'unit',
528
+ unit: 'degree',
529
+ unitDisplay: 'narrow'
530
+ };
531
+ break;
532
+ case 'saturation':
533
+ case 'brightness':
534
+ options = {
535
+ style: 'percent'
536
+ };
537
+ value /= 100;
538
+ break;
539
+ case 'alpha':
540
+ options = {
541
+ style: 'percent'
542
+ };
543
+ break;
544
+ default:
545
+ throw new Error('Unknown color channel: ' + channel);
546
+ }
547
+ return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
548
+ }
549
+ getColorSpace() {
550
+ return 'hsb';
551
+ }
552
+ constructor(hue, saturation, brightness, alpha){
553
+ super();
554
+ this.hue = hue;
555
+ this.saturation = saturation;
556
+ this.brightness = brightness;
557
+ this.alpha = alpha;
558
+ }
559
+ }
560
+ // X = <negative/positive number with/without decimal places>
618
561
  // before/after a comma, 0 or more whitespaces are allowed
619
562
  // - hsl(X, X%, X%)
620
563
  // - hsla(X, X%, X%, X)
621
-
622
-
623
- const $b54655da051f787a04029ec3711$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+)?)\)/;
624
-
625
- function $b54655da051f787a04029ec3711$var$mod(n, m) {
626
- return (n % m + m) % m;
564
+ const $83fe1a57d631223b$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+)?)\)/;
565
+ function $83fe1a57d631223b$var$mod(n, m) {
566
+ return (n % m + m) % m;
627
567
  }
628
-
629
- class $b54655da051f787a04029ec3711$var$HSLColor extends $b54655da051f787a04029ec3711$var$Color {
630
- constructor(hue, saturation, lightness, alpha) {
631
- super();
632
- this.hue = hue;
633
- this.saturation = saturation;
634
- this.lightness = lightness;
635
- this.alpha = alpha;
636
- }
637
-
638
- static parse(value) {
639
- let m;
640
-
641
- if (m = value.match($b54655da051f787a04029ec3711$var$HSL_REGEX)) {
642
- var _m$3;
643
-
644
- const [h, s, l, a] = ((_m$3 = m[1]) != null ? _m$3 : m[2]).split(',').map(n => Number(n.trim().replace('%', '')));
645
- return new $b54655da051f787a04029ec3711$var$HSLColor($b54655da051f787a04029ec3711$var$mod(h, 360), clamp(s, 0, 100), clamp(l, 0, 100), clamp(a != null ? a : 1, 0, 1));
568
+ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
569
+ static parse(value) {
570
+ let m;
571
+ if (m = value.match($83fe1a57d631223b$var$HSL_REGEX)) {
572
+ var ref;
573
+ const [h, s, l, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
574
+ );
575
+ return new $83fe1a57d631223b$var$HSLColor($83fe1a57d631223b$var$mod(h, 360), $4tN2K$reactstatelyutils.clamp(s, 0, 100), $4tN2K$reactstatelyutils.clamp(l, 0, 100), $4tN2K$reactstatelyutils.clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
576
+ }
646
577
  }
647
- }
648
-
649
- toString(format) {
650
- switch (format) {
651
- case 'hex':
652
- return this.toRGB().toString('hex');
653
-
654
- case 'hexa':
655
- return this.toRGB().toString('hexa');
656
-
657
- case 'hsl':
658
- return "hsl(" + this.hue + ", " + toFixedNumber(this.saturation, 2) + "%, " + toFixedNumber(this.lightness, 2) + "%)";
659
-
660
- case 'css':
661
- case 'hsla':
662
- return "hsla(" + this.hue + ", " + toFixedNumber(this.saturation, 2) + "%, " + toFixedNumber(this.lightness, 2) + "%, " + this.alpha + ")";
663
-
664
- default:
665
- return this.toFormat(format).toString(format);
578
+ toString(format) {
579
+ switch(format){
580
+ case 'hex':
581
+ return this.toRGB().toString('hex');
582
+ case 'hexa':
583
+ return this.toRGB().toString('hexa');
584
+ case 'hsl':
585
+ return `hsl(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.lightness, 2)}%)`;
586
+ case 'css':
587
+ case 'hsla':
588
+ return `hsla(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
589
+ default:
590
+ return this.toFormat(format).toString(format);
591
+ }
666
592
  }
667
- }
668
-
669
- toFormat(format) {
670
- switch (format) {
671
- case 'hsl':
672
- case 'hsla':
673
- return this;
674
-
675
- case 'hsb':
676
- case 'hsba':
677
- return this.toHSB();
678
-
679
- case 'rgb':
680
- case 'rgba':
681
- return this.toRGB();
682
-
683
- default:
684
- throw new Error('Unsupported color conversion: hsl -> ' + format);
593
+ toFormat(format) {
594
+ switch(format){
595
+ case 'hsl':
596
+ case 'hsla':
597
+ return this;
598
+ case 'hsb':
599
+ case 'hsba':
600
+ return this.toHSB();
601
+ case 'rgb':
602
+ case 'rgba':
603
+ return this.toRGB();
604
+ default:
605
+ throw new Error('Unsupported color conversion: hsl -> ' + format);
606
+ }
685
607
  }
686
- }
687
- /**
608
+ /**
688
609
  * Converts a HSL color to HSB.
689
610
  * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.
690
611
  * @returns An HSBColor object.
691
- */
692
-
693
-
694
- toHSB() {
695
- let saturation = this.saturation / 100;
696
- let lightness = this.lightness / 100;
697
- let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
698
- saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
699
- return new $b54655da051f787a04029ec3711$var$HSBColor(toFixedNumber(this.hue, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(brightness * 100, 2), this.alpha);
700
- }
701
- /**
612
+ */ toHSB() {
613
+ let saturation = this.saturation / 100;
614
+ let lightness = this.lightness / 100;
615
+ let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
616
+ saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
617
+ return new $83fe1a57d631223b$var$HSBColor($4tN2K$reactstatelyutils.toFixedNumber(this.hue, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(brightness * 100, 2), this.alpha);
618
+ }
619
+ /**
702
620
  * Converts a HSL color to RGB.
703
621
  * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.
704
622
  * @returns An RGBColor object.
705
- */
706
-
707
-
708
- toRGB() {
709
- let hue = this.hue;
710
- let saturation = this.saturation / 100;
711
- let lightness = this.lightness / 100;
712
- let a = saturation * Math.min(lightness, 1 - lightness);
713
-
714
- let fn = function fn(n, k) {
715
- if (k === void 0) {
716
- k = (n + hue / 30) % 12;
717
- }
718
-
719
- return lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
720
- };
721
-
722
- return new $b54655da051f787a04029ec3711$var$RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), this.alpha);
723
- }
724
-
725
- clone() {
726
- return new $b54655da051f787a04029ec3711$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
727
- }
728
-
729
- getChannelRange(channel) {
730
- switch (channel) {
731
- case 'hue':
732
- return {
733
- minValue: 0,
734
- maxValue: 360,
735
- step: 1
736
- };
623
+ */ toRGB() {
624
+ let hue = this.hue;
625
+ let saturation = this.saturation / 100;
626
+ let lightness = this.lightness / 100;
627
+ let a = saturation * Math.min(lightness, 1 - lightness);
628
+ let fn = (n, k = (n + hue / 30) % 12)=>lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
629
+ ;
630
+ return new $83fe1a57d631223b$var$RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), this.alpha);
631
+ }
632
+ clone() {
633
+ return new $83fe1a57d631223b$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
634
+ }
635
+ getChannelRange(channel) {
636
+ switch(channel){
637
+ case 'hue':
638
+ return {
639
+ minValue: 0,
640
+ maxValue: 360,
641
+ step: 1,
642
+ pageSize: 15
643
+ };
644
+ case 'saturation':
645
+ case 'lightness':
646
+ return {
647
+ minValue: 0,
648
+ maxValue: 100,
649
+ step: 1,
650
+ pageSize: 10
651
+ };
652
+ case 'alpha':
653
+ return {
654
+ minValue: 0,
655
+ maxValue: 1,
656
+ step: 0.01,
657
+ pageSize: 0.1
658
+ };
659
+ default:
660
+ throw new Error('Unknown color channel: ' + channel);
661
+ }
662
+ }
663
+ formatChannelValue(channel, locale) {
664
+ let options;
665
+ let value = this.getChannelValue(channel);
666
+ switch(channel){
667
+ case 'hue':
668
+ options = {
669
+ style: 'unit',
670
+ unit: 'degree',
671
+ unitDisplay: 'narrow'
672
+ };
673
+ break;
674
+ case 'saturation':
675
+ case 'lightness':
676
+ options = {
677
+ style: 'percent'
678
+ };
679
+ value /= 100;
680
+ break;
681
+ case 'alpha':
682
+ options = {
683
+ style: 'percent'
684
+ };
685
+ break;
686
+ default:
687
+ throw new Error('Unknown color channel: ' + channel);
688
+ }
689
+ return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
690
+ }
691
+ getColorSpace() {
692
+ return 'hsl';
693
+ }
694
+ constructor(hue, saturation, lightness, alpha){
695
+ super();
696
+ this.hue = hue;
697
+ this.saturation = saturation;
698
+ this.lightness = lightness;
699
+ this.alpha = alpha;
700
+ }
701
+ }
737
702
 
738
- case 'saturation':
739
- case 'lightness':
740
- return {
741
- minValue: 0,
742
- maxValue: 100,
743
- step: 1
744
- };
745
703
 
746
- case 'alpha':
704
+ var $af2d7ac9990cfee2$exports = {};
705
+
706
+ $parcel$export($af2d7ac9990cfee2$exports, "useColorAreaState", () => $af2d7ac9990cfee2$export$6df7f0e2cabc7eef);
707
+
708
+
709
+
710
+ const $af2d7ac9990cfee2$var$DEFAULT_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#ffffff');
711
+ const $af2d7ac9990cfee2$var$RGBSet = new Set([
712
+ 'red',
713
+ 'green',
714
+ 'blue'
715
+ ]);
716
+ let $af2d7ac9990cfee2$var$difference = (a, b)=>new Set([
717
+ ...a
718
+ ].filter((x)=>!b.has(x)
719
+ ))
720
+ ;
721
+ function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
722
+ let { value: value1 , defaultValue: defaultValue , xChannel: xChannel , yChannel: yChannel , onChange: onChange , onChangeEnd: onChangeEnd } = props;
723
+ if (!value1 && !defaultValue) defaultValue = $af2d7ac9990cfee2$var$DEFAULT_COLOR;
724
+ let [color, setColor] = $4tN2K$reactstatelyutils.useControlledState(value1 && $83fe1a57d631223b$export$4cde5df63f53f473(value1), defaultValue && $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
725
+ let valueRef = $4tN2K$react.useRef(color);
726
+ valueRef.current = color;
727
+ let channels = $4tN2K$react.useMemo(()=>{
728
+ if (!xChannel) switch(yChannel){
729
+ case 'red':
730
+ case 'green':
731
+ xChannel = 'blue';
732
+ break;
733
+ case 'blue':
734
+ xChannel = 'red';
735
+ break;
736
+ default:
737
+ xChannel = 'blue';
738
+ yChannel = 'green';
739
+ }
740
+ else if (!yChannel) switch(xChannel){
741
+ case 'red':
742
+ yChannel = 'green';
743
+ break;
744
+ case 'blue':
745
+ yChannel = 'red';
746
+ break;
747
+ default:
748
+ xChannel = 'blue';
749
+ yChannel = 'green';
750
+ }
751
+ let xyChannels = new Set([
752
+ xChannel,
753
+ yChannel
754
+ ]);
755
+ let zChannel = $af2d7ac9990cfee2$var$difference($af2d7ac9990cfee2$var$RGBSet, xyChannels).values().next().value;
747
756
  return {
748
- minValue: 0,
749
- maxValue: 1,
750
- step: 0.01
751
- };
752
-
753
- default:
754
- throw new Error('Unknown color channel: ' + channel);
755
- }
756
- }
757
-
758
- formatChannelValue(channel, locale) {
759
- let options;
760
- let value = this.getChannelValue(channel);
761
-
762
- switch (channel) {
763
- case 'hue':
764
- options = {
765
- style: 'unit',
766
- unit: 'degree',
767
- unitDisplay: 'narrow'
757
+ xChannel: xChannel,
758
+ yChannel: yChannel,
759
+ zChannel: zChannel
768
760
  };
769
- break;
761
+ }, [
762
+ xChannel,
763
+ yChannel
764
+ ]);
765
+ let xChannelRange = color.getChannelRange(channels.xChannel);
766
+ let yChannelRange = color.getChannelRange(channels.yChannel);
767
+ let { minValue: minValueX1 , maxValue: maxValueX1 , step: stepX , pageSize: pageSizeX } = xChannelRange;
768
+ let { minValue: minValueY1 , maxValue: maxValueY1 , step: stepY , pageSize: pageSizeY } = yChannelRange;
769
+ let [isDragging1, setDragging] = $4tN2K$react.useState(false);
770
+ let isDraggingRef = $4tN2K$react.useRef(false).current;
771
+ let xValue = color.getChannelValue(channels.xChannel);
772
+ let yValue = color.getChannelValue(channels.yChannel);
773
+ let setXValue = (v)=>{
774
+ if (v === xValue) return;
775
+ valueRef.current = color.withChannelValue(channels.xChannel, v);
776
+ setColor(valueRef.current);
777
+ };
778
+ let setYValue = (v)=>{
779
+ if (v === yValue) return;
780
+ valueRef.current = color.withChannelValue(channels.yChannel, v);
781
+ setColor(valueRef.current);
782
+ };
783
+ return {
784
+ channels: channels,
785
+ xChannelStep: stepX,
786
+ yChannelStep: stepY,
787
+ xChannelPageStep: pageSizeX,
788
+ yChannelPageStep: pageSizeY,
789
+ value: color,
790
+ setValue (value) {
791
+ let c = $83fe1a57d631223b$export$4cde5df63f53f473(value);
792
+ valueRef.current = c;
793
+ setColor(c);
794
+ },
795
+ xValue: xValue,
796
+ setXValue: setXValue,
797
+ yValue: yValue,
798
+ setYValue: setYValue,
799
+ setColorFromPoint (x, y) {
800
+ let { minValue: minValueX , maxValue: maxValueX } = color.getChannelRange(channels.xChannel);
801
+ let { minValue: minValueY , maxValue: maxValueY } = color.getChannelRange(channels.yChannel);
802
+ let newXValue = minValueX + $4tN2K$reactstatelyutils.clamp(x, 0, 1) * (maxValueX - minValueX);
803
+ let newYValue = minValueY + (1 - $4tN2K$reactstatelyutils.clamp(y, 0, 1)) * (maxValueY - minValueY);
804
+ let newColor;
805
+ if (newXValue !== xValue) {
806
+ // Round new value to multiple of step, clamp value between min and max
807
+ newXValue = $4tN2K$reactstatelyutils.snapValueToStep(newXValue, minValueX, maxValueX, stepX);
808
+ newColor = color.withChannelValue(channels.xChannel, newXValue);
809
+ }
810
+ if (newYValue !== yValue) {
811
+ // Round new value to multiple of step, clamp value between min and max
812
+ newYValue = $4tN2K$reactstatelyutils.snapValueToStep(newYValue, minValueY, maxValueY, stepY);
813
+ newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
814
+ }
815
+ if (newColor) setColor(newColor);
816
+ },
817
+ getThumbPosition () {
818
+ let x = (xValue - minValueX1) / (maxValueX1 - minValueX1);
819
+ let y = 1 - (yValue - minValueY1) / (maxValueY1 - minValueY1);
820
+ return {
821
+ x: x,
822
+ y: y
823
+ };
824
+ },
825
+ incrementX (stepSize) {
826
+ setXValue(xValue + stepSize > maxValueX1 ? maxValueX1 : $4tN2K$reactstatelyutils.snapValueToStep(xValue + stepSize, minValueX1, maxValueX1, stepX));
827
+ },
828
+ incrementY (stepSize) {
829
+ setYValue(yValue + stepSize > maxValueY1 ? maxValueY1 : $4tN2K$reactstatelyutils.snapValueToStep(yValue + stepSize, minValueY1, maxValueY1, stepY));
830
+ },
831
+ decrementX (stepSize) {
832
+ setXValue($4tN2K$reactstatelyutils.snapValueToStep(xValue - stepSize, minValueX1, maxValueX1, stepX));
833
+ },
834
+ decrementY (stepSize) {
835
+ setYValue($4tN2K$reactstatelyutils.snapValueToStep(yValue - stepSize, minValueY1, maxValueY1, stepY));
836
+ },
837
+ setDragging (isDragging) {
838
+ let wasDragging = isDraggingRef;
839
+ isDraggingRef = isDragging;
840
+ if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
841
+ setDragging(isDragging);
842
+ },
843
+ isDragging: isDragging1,
844
+ getDisplayColor () {
845
+ return color.withChannelValue('alpha', 1);
846
+ }
847
+ };
848
+ }
770
849
 
771
- case 'saturation':
772
- case 'lightness':
773
- options = {
774
- style: 'percent'
775
- };
776
- value /= 100;
777
- break;
778
850
 
779
- case 'alpha':
780
- options = {
781
- style: 'percent'
782
- };
783
- break;
851
+ var $5386a492cfd3234c$exports = {};
784
852
 
785
- default:
786
- throw new Error('Unknown color channel: ' + channel);
787
- }
853
+ $parcel$export($5386a492cfd3234c$exports, "useColorSliderState", () => $5386a492cfd3234c$export$57bc203e1c9c6d44);
788
854
 
789
- return new NumberFormatter(locale, options).format(value);
790
- }
791
855
 
792
- getColorSpace() {
793
- return 'hsl';
794
- }
795
856
 
857
+ function $5386a492cfd3234c$export$57bc203e1c9c6d44(props) {
858
+ let { channel: channel , value: value1 , defaultValue: defaultValue , onChange: onChange , locale: locale , ...otherProps } = props;
859
+ if (value1 == null && defaultValue == null) throw new Error('useColorSliderState requires a value or defaultValue');
860
+ let [color, setColor] = $4tN2K$reactstatelyutils.useControlledState(value1 && $83fe1a57d631223b$export$4cde5df63f53f473(value1), defaultValue && $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
861
+ let sliderState = $4tN2K$reactstatelyslider.useSliderState({
862
+ ...color.getChannelRange(channel),
863
+ ...otherProps,
864
+ // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
865
+ numberFormatter: null,
866
+ value: [
867
+ color.getChannelValue(channel)
868
+ ],
869
+ onChange ([v]) {
870
+ setColor(color.withChannelValue(channel, v));
871
+ },
872
+ onChangeEnd ([v]) {
873
+ // onChange will have already been called with the right value, this is just to trigger onChangeEnd
874
+ if (props.onChangeEnd) props.onChangeEnd(color.withChannelValue(channel, v));
875
+ }
876
+ });
877
+ let { step: step , pageSize: pageSize } = color.getChannelRange(channel);
878
+ return {
879
+ ...sliderState,
880
+ value: color,
881
+ setValue (value) {
882
+ setColor($83fe1a57d631223b$export$4cde5df63f53f473(value));
883
+ },
884
+ getDisplayColor () {
885
+ switch(channel){
886
+ case 'hue':
887
+ return $83fe1a57d631223b$export$6e865ea70d7724f(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
888
+ case 'lightness':
889
+ case 'brightness':
890
+ case 'saturation':
891
+ case 'red':
892
+ case 'green':
893
+ case 'blue':
894
+ return color.withChannelValue('alpha', 1);
895
+ case 'alpha':
896
+ return color;
897
+ default:
898
+ throw new Error('Unknown color channel: ' + channel);
899
+ }
900
+ },
901
+ getThumbValueLabel () {
902
+ return color.formatChannelValue(channel, locale);
903
+ },
904
+ step: step,
905
+ pageSize: pageSize
906
+ };
796
907
  }
797
908
 
798
- function $d78e953dd1c924c8b48953f9b24957b7$var$normalizeColor(v) {
799
- if (typeof v === 'string') {
800
- return parseColor(v);
801
- } else {
802
- return v;
803
- }
804
- }
805
- /**
806
- * Provides state management for a color slider component.
807
- * Color sliders allow users to adjust an individual channel of a color value.
808
- */
809
-
810
-
811
- function useColorSliderState(props) {
812
- let {
813
- channel,
814
- value,
815
- defaultValue,
816
- onChange,
817
- locale
818
- } = props,
819
- otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["channel", "value", "defaultValue", "onChange", "locale"]);
820
-
821
- if (value == null && defaultValue == null) {
822
- throw new Error('useColorSliderState requires a value or defaultValue');
823
- }
824
-
825
- let [color, setColor] = useControlledState(value && $d78e953dd1c924c8b48953f9b24957b7$var$normalizeColor(value), defaultValue && $d78e953dd1c924c8b48953f9b24957b7$var$normalizeColor(defaultValue), onChange);
826
- let sliderState = useSliderState(_babelRuntimeHelpersExtends({}, color.getChannelRange(channel), otherProps, {
827
- // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
828
- numberFormatter: null,
829
- value: [color.getChannelValue(channel)],
830
-
831
- onChange(_ref) {
832
- let [v] = _ref;
833
- setColor(color.withChannelValue(channel, v));
834
- },
835
-
836
- onChangeEnd(_ref2) {
837
- let [v] = _ref2;
838
-
839
- // onChange will have already been called with the right value, this is just to trigger onChangEnd
840
- if (props.onChangeEnd) {
841
- props.onChangeEnd(color.withChannelValue(channel, v));
842
- }
843
- }
844
909
 
845
- }));
846
- return _babelRuntimeHelpersExtends({}, sliderState, {
847
- value: color,
848
-
849
- setValue(value) {
850
- setColor($d78e953dd1c924c8b48953f9b24957b7$var$normalizeColor(value));
851
- },
852
-
853
- getDisplayColor() {
854
- switch (channel) {
855
- case 'hue':
856
- return parseColor("hsl(" + color.getChannelValue('hue') + ", 100%, 50%)");
857
-
858
- case 'lightness':
859
- case 'brightness':
860
- case 'saturation':
861
- case 'red':
862
- case 'green':
863
- case 'blue':
864
- return color.withChannelValue('alpha', 1);
865
-
866
- case 'alpha':
867
- {
868
- return color;
869
- }
870
-
871
- default:
872
- throw new Error('Unknown color channel: ' + channel);
873
- }
874
- },
910
+ var $9d7d8736d45f74b8$exports = {};
875
911
 
876
- getThumbValueLabel() {
877
- return color.formatChannelValue(channel, locale);
878
- }
912
+ $parcel$export($9d7d8736d45f74b8$exports, "useColorWheelState", () => $9d7d8736d45f74b8$export$f4301076d9336137);
879
913
 
880
- });
881
- }
882
914
 
883
- exports.useColorSliderState = useColorSliderState;
884
915
 
885
- function $dba59c0b8a82682c07fa6f5c72e73481$var$normalizeColor(v) {
886
- if (typeof v === 'string') {
887
- return parseColor(v);
888
- } else {
889
- return v;
890
- }
916
+ const $9d7d8736d45f74b8$var$DEFAULT_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('hsl(0, 100%, 50%)');
917
+ function $9d7d8736d45f74b8$var$roundToStep(value, step) {
918
+ return Math.round(value / step) * step;
891
919
  }
892
-
893
- const $dba59c0b8a82682c07fa6f5c72e73481$var$DEFAULT_COLOR = parseColor('hsl(0, 100%, 50%)');
894
-
895
- function $dba59c0b8a82682c07fa6f5c72e73481$var$roundToStep(value, step) {
896
- return Math.round(value / step) * step;
920
+ function $9d7d8736d45f74b8$var$mod(n, m) {
921
+ return (n % m + m) % m;
897
922
  }
898
-
899
- function $dba59c0b8a82682c07fa6f5c72e73481$var$mod(n, m) {
900
- return (n % m + m) % m;
923
+ function $9d7d8736d45f74b8$var$roundDown(v) {
924
+ let r = Math.floor(v);
925
+ if (r === v) return v - 1;
926
+ else return r;
901
927
  }
902
-
903
- function $dba59c0b8a82682c07fa6f5c72e73481$var$roundDown(v) {
904
- let r = Math.floor(v);
905
-
906
- if (r === v) {
907
- return v - 1;
908
- } else {
909
- return r;
910
- }
928
+ function $9d7d8736d45f74b8$var$degToRad(deg) {
929
+ return deg * Math.PI / 180;
911
930
  }
912
-
913
- function $dba59c0b8a82682c07fa6f5c72e73481$var$degToRad(deg) {
914
- return deg * Math.PI / 180;
931
+ function $9d7d8736d45f74b8$var$radToDeg(rad) {
932
+ return rad * 180 / Math.PI;
915
933
  }
916
-
917
- function $dba59c0b8a82682c07fa6f5c72e73481$var$radToDeg(rad) {
918
- return rad * 180 / Math.PI;
919
- } // 0deg = 3 o'clock. increases clockwise
920
-
921
-
922
- function $dba59c0b8a82682c07fa6f5c72e73481$var$angleToCartesian(angle, radius) {
923
- let rad = $dba59c0b8a82682c07fa6f5c72e73481$var$degToRad(360 - angle + 90);
924
- let x = Math.sin(rad) * radius;
925
- let y = Math.cos(rad) * radius;
926
- return {
927
- x,
928
- y
929
- };
934
+ // 0deg = 3 o'clock. increases clockwise
935
+ function $9d7d8736d45f74b8$var$angleToCartesian(angle, radius) {
936
+ let rad = $9d7d8736d45f74b8$var$degToRad(360 - angle + 90);
937
+ let x = Math.sin(rad) * radius;
938
+ let y = Math.cos(rad) * radius;
939
+ return {
940
+ x: x,
941
+ y: y
942
+ };
930
943
  }
931
-
932
- function $dba59c0b8a82682c07fa6f5c72e73481$var$cartesianToAngle(x, y, radius) {
933
- let deg = $dba59c0b8a82682c07fa6f5c72e73481$var$radToDeg(Math.atan2(y / radius, x / radius));
934
- return (deg + 360) % 360;
944
+ function $9d7d8736d45f74b8$var$cartesianToAngle(x, y, radius) {
945
+ let deg = $9d7d8736d45f74b8$var$radToDeg(Math.atan2(y / radius, x / radius));
946
+ return (deg + 360) % 360;
935
947
  }
936
- /**
937
- * Provides state management for a color wheel component.
938
- * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
939
- */
940
-
941
-
942
- function useColorWheelState(props) {
943
- let {
944
- defaultValue,
945
- onChange,
946
- onChangeEnd,
947
- step = 1
948
- } = props;
949
-
950
- if (!props.value && !defaultValue) {
951
- defaultValue = $dba59c0b8a82682c07fa6f5c72e73481$var$DEFAULT_COLOR;
952
- }
953
-
954
- let [value, setValue] = useControlledState($dba59c0b8a82682c07fa6f5c72e73481$var$normalizeColor(props.value), $dba59c0b8a82682c07fa6f5c72e73481$var$normalizeColor(defaultValue), onChange);
955
- let valueRef = useRef(value);
956
- valueRef.current = value;
957
- let [isDragging, setDragging] = useState(false);
958
- let isDraggingRef = useRef(false).current;
959
- let hue = value.getChannelValue('hue');
960
-
961
- function setHue(v) {
962
- if (v > 360) {
963
- // Make sure you can always get back to 0.
964
- v = 0;
965
- }
966
-
967
- v = $dba59c0b8a82682c07fa6f5c72e73481$var$roundToStep($dba59c0b8a82682c07fa6f5c72e73481$var$mod(v, 360), step);
968
-
969
- if (hue !== v) {
970
- let color = value.withChannelValue('hue', v);
971
- valueRef.current = color;
972
- setValue(color);
948
+ function $9d7d8736d45f74b8$export$f4301076d9336137(props) {
949
+ let { defaultValue: defaultValue , onChange: onChange , onChangeEnd: onChangeEnd } = props;
950
+ if (!props.value && !defaultValue) defaultValue = $9d7d8736d45f74b8$var$DEFAULT_COLOR;
951
+ let [value, setValue] = $4tN2K$reactstatelyutils.useControlledState($83fe1a57d631223b$export$4cde5df63f53f473(props.value), $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
952
+ let valueRef = $4tN2K$react.useRef(value);
953
+ valueRef.current = value;
954
+ let channelRange = value.getChannelRange('hue');
955
+ let { minValue: minValueX , maxValue: maxValueX , step: step , pageSize: pageStep } = channelRange;
956
+ let [isDragging1, setDragging] = $4tN2K$react.useState(false);
957
+ let isDraggingRef = $4tN2K$react.useRef(false).current;
958
+ let hue = value.getChannelValue('hue');
959
+ function setHue(v) {
960
+ if (v > 360) // Make sure you can always get back to 0.
961
+ v = 0;
962
+ v = $9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(v, 360), step);
963
+ if (hue !== v) {
964
+ let color = value.withChannelValue('hue', v);
965
+ valueRef.current = color;
966
+ setValue(color);
967
+ }
973
968
  }
974
- }
975
-
976
- return {
977
- value,
978
-
979
- setValue(v) {
980
- let color = $dba59c0b8a82682c07fa6f5c72e73481$var$normalizeColor(v);
981
- valueRef.current = color;
982
- setValue(color);
983
- },
984
-
985
- hue,
986
- setHue,
987
-
988
- setHueFromPoint(x, y, radius) {
989
- setHue($dba59c0b8a82682c07fa6f5c72e73481$var$cartesianToAngle(x, y, radius));
990
- },
991
-
992
- getThumbPosition(radius) {
993
- return $dba59c0b8a82682c07fa6f5c72e73481$var$angleToCartesian(value.getChannelValue('hue'), radius);
994
- },
995
-
996
- increment(minStepSize) {
997
- if (minStepSize === void 0) {
998
- minStepSize = 0;
999
- }
1000
-
1001
- let newValue = hue + Math.max(minStepSize, step);
1002
-
1003
- if (newValue > 360) {
1004
- // Make sure you can always get back to 0.
1005
- newValue = 0;
1006
- }
1007
-
1008
- setHue(newValue);
1009
- },
1010
-
1011
- decrement(minStepSize) {
1012
- if (minStepSize === void 0) {
1013
- minStepSize = 0;
1014
- }
1015
-
1016
- let s = Math.max(minStepSize, step);
1017
-
1018
- if (hue === 0) {
1019
- // We can't just subtract step because this might be the case:
1020
- // |(previous step) - 0| < step size
1021
- setHue($dba59c0b8a82682c07fa6f5c72e73481$var$roundDown(360 / s) * s);
1022
- } else {
1023
- setHue(hue - s);
1024
- }
1025
- },
969
+ return {
970
+ value: value,
971
+ step: step,
972
+ pageStep: pageStep,
973
+ setValue (v) {
974
+ let color = $83fe1a57d631223b$export$4cde5df63f53f473(v);
975
+ valueRef.current = color;
976
+ setValue(color);
977
+ },
978
+ hue: hue,
979
+ setHue: setHue,
980
+ setHueFromPoint (x, y, radius) {
981
+ setHue($9d7d8736d45f74b8$var$cartesianToAngle(x, y, radius));
982
+ },
983
+ getThumbPosition (radius) {
984
+ return $9d7d8736d45f74b8$var$angleToCartesian(value.getChannelValue('hue'), radius);
985
+ },
986
+ increment (stepSize = 1) {
987
+ let s = Math.max(stepSize, step);
988
+ let newValue = hue + s;
989
+ if (newValue >= maxValueX) // Make sure you can always get back to 0.
990
+ newValue = minValueX;
991
+ setHue($9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(newValue, 360), s));
992
+ },
993
+ decrement (stepSize = 1) {
994
+ let s = Math.max(stepSize, step);
995
+ if (hue === 0) // We can't just subtract step because this might be the case:
996
+ // |(previous step) - 0| < step size
997
+ setHue($9d7d8736d45f74b8$var$roundDown(360 / s) * s);
998
+ else setHue($9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(hue - s, 360), s));
999
+ },
1000
+ setDragging (isDragging) {
1001
+ let wasDragging = isDraggingRef;
1002
+ isDraggingRef = isDragging;
1003
+ if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
1004
+ setDragging(isDragging);
1005
+ },
1006
+ isDragging: isDragging1,
1007
+ getDisplayColor () {
1008
+ return value.withChannelValue('saturation', 100).withChannelValue('lightness', 50);
1009
+ }
1010
+ };
1011
+ }
1026
1012
 
1027
- setDragging(isDragging) {
1028
- let wasDragging = isDraggingRef;
1029
- isDraggingRef = isDragging;
1030
1013
 
1031
- if (onChangeEnd && !isDragging && wasDragging) {
1032
- onChangeEnd(valueRef.current);
1033
- }
1014
+ var $d59d0c2b2ce1568f$exports = {};
1034
1015
 
1035
- setDragging(isDragging);
1036
- },
1016
+ $parcel$export($d59d0c2b2ce1568f$exports, "useColorFieldState", () => $d59d0c2b2ce1568f$export$d52a01683abdfcd6);
1037
1017
 
1038
- isDragging,
1039
1018
 
1040
- getDisplayColor() {
1041
- return value.withChannelValue('saturation', 100).withChannelValue('lightness', 50);
1042
- }
1043
1019
 
1044
- };
1020
+ function $f8b3be23ba4462b1$export$5aadd9c0606af5c2(value) {
1021
+ return $4tN2K$react.useMemo(()=>{
1022
+ if (typeof value === 'string') try {
1023
+ return $83fe1a57d631223b$export$6e865ea70d7724f(value);
1024
+ } catch (err) {
1025
+ return undefined;
1026
+ }
1027
+ return value;
1028
+ }, [
1029
+ value
1030
+ ]);
1045
1031
  }
1046
1032
 
1047
- exports.useColorWheelState = useColorWheelState;
1048
1033
 
1049
- function $b3b9a125af848b3d936c7c032125859$export$useColor(value) {
1050
- return useMemo(() => {
1051
- if (typeof value === 'string') {
1052
- try {
1053
- return parseColor(value);
1054
- } catch (err) {
1055
- return undefined;
1056
- }
1057
- }
1058
1034
 
1059
- return value;
1060
- }, [value]);
1061
- }
1062
1035
 
1063
- const $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR = parseColor('#000000');
1064
- const $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR = parseColor('#FFFFFF');
1065
- const $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR_INT = $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR.toHexInt();
1066
- const $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR_INT = $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR.toHexInt();
1067
- /**
1068
- * Provides state management for a color field component. Color fields allow
1069
- * users to enter and adjust a hex color value.
1070
- */
1071
-
1072
- function useColorFieldState(props) {
1073
- let {
1074
- step = 1,
1075
- value,
1076
- defaultValue,
1077
- onChange
1078
- } = props;
1079
- let initialValue = $b3b9a125af848b3d936c7c032125859$export$useColor(value);
1080
- let initialDefaultValue = $b3b9a125af848b3d936c7c032125859$export$useColor(defaultValue);
1081
- let [colorValue, setColorValue] = useControlledState(initialValue, initialDefaultValue, onChange);
1082
- let [inputValue, setInputValue] = useState(() => (value || defaultValue) && colorValue ? colorValue.toString('hex') : '');
1083
-
1084
- let safelySetColorValue = newColor => {
1085
- if (typeof newColor === 'function') {
1086
- setColorValue(prev => {
1087
- let resolved = newColor(prev);
1088
-
1089
- if (!prev || !resolved) {
1090
- return resolved;
1036
+ const $d59d0c2b2ce1568f$var$MIN_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#000000');
1037
+ const $d59d0c2b2ce1568f$var$MAX_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#FFFFFF');
1038
+ const $d59d0c2b2ce1568f$var$MIN_COLOR_INT = $d59d0c2b2ce1568f$var$MIN_COLOR.toHexInt();
1039
+ const $d59d0c2b2ce1568f$var$MAX_COLOR_INT = $d59d0c2b2ce1568f$var$MAX_COLOR.toHexInt();
1040
+ function $d59d0c2b2ce1568f$export$d52a01683abdfcd6(props) {
1041
+ let { value: value1 , defaultValue: defaultValue , onChange: onChange } = props;
1042
+ let { step: step } = $d59d0c2b2ce1568f$var$MIN_COLOR.getChannelRange('red');
1043
+ let initialValue = $f8b3be23ba4462b1$export$5aadd9c0606af5c2(value1);
1044
+ let initialDefaultValue = $f8b3be23ba4462b1$export$5aadd9c0606af5c2(defaultValue);
1045
+ let [colorValue, setColorValue] = $4tN2K$reactstatelyutils.useControlledState(initialValue, initialDefaultValue, onChange);
1046
+ let [inputValue, setInputValue] = $4tN2K$react.useState(()=>(value1 || defaultValue) && colorValue ? colorValue.toString('hex') : ''
1047
+ );
1048
+ let safelySetColorValue = (newColor)=>{
1049
+ if (!colorValue || !newColor) {
1050
+ setColorValue(newColor);
1051
+ return;
1091
1052
  }
1092
-
1093
- if (resolved.toHexInt() !== prev.toHexInt()) {
1094
- return resolved;
1053
+ if (newColor.toHexInt() !== colorValue.toHexInt()) {
1054
+ setColorValue(newColor);
1055
+ return;
1095
1056
  }
1096
-
1097
- return prev;
1098
- });
1099
- return;
1100
- }
1101
-
1102
- if (!colorValue || !newColor) {
1103
- setColorValue(newColor);
1104
- return;
1105
- }
1106
-
1107
- if (newColor.toHexInt() !== colorValue.toHexInt()) {
1108
- setColorValue(newColor);
1109
- return;
1110
- }
1111
- };
1112
-
1113
- useEffect(() => {
1114
- setInputValue(colorValue ? colorValue.toString('hex') : '');
1115
- }, [colorValue, setInputValue]);
1116
- let parsedValue = useMemo(() => {
1117
- let color;
1118
-
1119
- try {
1120
- color = parseColor(inputValue.startsWith('#') ? inputValue : "#" + inputValue);
1121
- } catch (err) {
1122
- color = null;
1123
- }
1124
-
1125
- return color;
1126
- }, [parseColor, inputValue]);
1127
- let parsed = useRef(null);
1128
- parsed.current = parsedValue;
1129
-
1130
- let commit = () => {
1131
- // Set to empty state if input value is empty
1132
- if (!inputValue.length) {
1133
- safelySetColorValue(null);
1134
- setInputValue(value === undefined ? '' : colorValue.toString('hex'));
1135
- return;
1136
- } // if it failed to parse, then reset input to formatted version of current number
1137
-
1138
-
1139
- if (parsed.current == null) {
1140
- setInputValue(colorValue ? colorValue.toString('hex') : '');
1141
- return;
1057
+ };
1058
+ let prevValue = $4tN2K$react.useRef(colorValue);
1059
+ if (prevValue.current !== colorValue) {
1060
+ setInputValue(colorValue ? colorValue.toString('hex') : '');
1061
+ prevValue.current = colorValue;
1142
1062
  }
1143
-
1144
- safelySetColorValue(parsed.current); // in a controlled state, the numberValue won't change, so we won't go back to our old input without help
1145
-
1146
- let newColorValue = '';
1147
-
1148
- if (colorValue) {
1149
- newColorValue = colorValue.toString('hex');
1063
+ let parsedValue = $4tN2K$react.useMemo(()=>{
1064
+ let color;
1065
+ try {
1066
+ color = $83fe1a57d631223b$export$6e865ea70d7724f(inputValue.startsWith('#') ? inputValue : `#${inputValue}`);
1067
+ } catch (err) {
1068
+ color = null;
1069
+ }
1070
+ return color;
1071
+ }, [
1072
+ $83fe1a57d631223b$export$6e865ea70d7724f,
1073
+ inputValue
1074
+ ]);
1075
+ let parsed = $4tN2K$react.useRef(null);
1076
+ parsed.current = parsedValue;
1077
+ let commit = ()=>{
1078
+ // Set to empty state if input value is empty
1079
+ if (!inputValue.length) {
1080
+ safelySetColorValue(null);
1081
+ setInputValue(value1 === undefined ? '' : colorValue.toString('hex'));
1082
+ return;
1083
+ }
1084
+ // if it failed to parse, then reset input to formatted version of current number
1085
+ if (parsed.current == null) {
1086
+ setInputValue(colorValue ? colorValue.toString('hex') : '');
1087
+ return;
1088
+ }
1089
+ safelySetColorValue(parsed.current);
1090
+ // in a controlled state, the numberValue won't change, so we won't go back to our old input without help
1091
+ let newColorValue = '';
1092
+ if (colorValue) newColorValue = colorValue.toString('hex');
1093
+ setInputValue(newColorValue);
1094
+ };
1095
+ let increment = ()=>{
1096
+ let newValue = $d59d0c2b2ce1568f$var$addColorValue(parsed.current, step);
1097
+ // if we've arrived at the same value that was previously in the state, the
1098
+ // input value should be updated to match
1099
+ // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
1100
+ // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
1101
+ if (newValue === colorValue) setInputValue(newValue.toString('hex'));
1102
+ safelySetColorValue(newValue);
1103
+ };
1104
+ let decrement = ()=>{
1105
+ let newValue = $d59d0c2b2ce1568f$var$addColorValue(parsed.current, -step);
1106
+ // if we've arrived at the same value that was previously in the state, the
1107
+ // input value should be updated to match
1108
+ // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
1109
+ // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
1110
+ if (newValue === colorValue) setInputValue(newValue.toString('hex'));
1111
+ safelySetColorValue(newValue);
1112
+ };
1113
+ let incrementToMax = ()=>safelySetColorValue($d59d0c2b2ce1568f$var$MAX_COLOR)
1114
+ ;
1115
+ let decrementToMin = ()=>safelySetColorValue($d59d0c2b2ce1568f$var$MIN_COLOR)
1116
+ ;
1117
+ let validate = (value)=>{
1118
+ var ref;
1119
+ return value === '' || !!((ref = value.match(/^#?[0-9a-f]{0,6}$/i)) === null || ref === void 0 ? void 0 : ref[0]);
1120
+ };
1121
+ return {
1122
+ validate: validate,
1123
+ colorValue: colorValue,
1124
+ inputValue: inputValue,
1125
+ setInputValue: setInputValue,
1126
+ commit: commit,
1127
+ increment: increment,
1128
+ incrementToMax: incrementToMax,
1129
+ decrement: decrement,
1130
+ decrementToMin: decrementToMin
1131
+ };
1132
+ }
1133
+ function $d59d0c2b2ce1568f$var$addColorValue(color, step) {
1134
+ let newColor = color ? color : $d59d0c2b2ce1568f$var$MIN_COLOR;
1135
+ let colorInt = newColor.toHexInt();
1136
+ let clampInt = Math.min(Math.max(colorInt + step, $d59d0c2b2ce1568f$var$MIN_COLOR_INT), $d59d0c2b2ce1568f$var$MAX_COLOR_INT);
1137
+ if (clampInt !== colorInt) {
1138
+ let newColorString = `#${clampInt.toString(16).padStart(6, '0').toUpperCase()}`;
1139
+ newColor = $83fe1a57d631223b$export$6e865ea70d7724f(newColorString);
1150
1140
  }
1151
-
1152
- setInputValue(newColorValue);
1153
- };
1154
-
1155
- let increment = () => {
1156
- safelySetColorValue(prevColor => {
1157
- let newValue = $f59de409cf55723659fabb2f46aaa7a$var$addColorValue(parsed.current, step); // if we've arrived at the same value that was previously in the state, the
1158
- // input value should be updated to match
1159
- // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
1160
- // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
1161
-
1162
- if (newValue === prevColor) {
1163
- setInputValue(newValue.toString('hex'));
1164
- }
1165
-
1166
- return newValue;
1167
- });
1168
- };
1169
-
1170
- let decrement = () => {
1171
- safelySetColorValue(prevColor => {
1172
- let newValue = $f59de409cf55723659fabb2f46aaa7a$var$addColorValue(parsed.current, -step); // if we've arrived at the same value that was previously in the state, the
1173
- // input value should be updated to match
1174
- // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
1175
- // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
1176
-
1177
- if (newValue === prevColor) {
1178
- setInputValue(newValue.toString('hex'));
1179
- }
1180
-
1181
- return newValue;
1182
- });
1183
- };
1184
-
1185
- let incrementToMax = () => safelySetColorValue($f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR);
1186
-
1187
- let decrementToMin = () => safelySetColorValue($f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR);
1188
-
1189
- let validate = value => {
1190
- var _value$match;
1191
-
1192
- return value === '' || !!((_value$match = value.match(/^#?[0-9a-f]{0,6}$/i)) != null && _value$match[0]);
1193
- };
1194
-
1195
- return {
1196
- validate,
1197
- colorValue,
1198
- inputValue,
1199
- setInputValue,
1200
- commit,
1201
- increment,
1202
- incrementToMax,
1203
- decrement,
1204
- decrementToMin
1205
- };
1141
+ return newColor;
1206
1142
  }
1207
1143
 
1208
- exports.useColorFieldState = useColorFieldState;
1209
1144
 
1210
- function $f59de409cf55723659fabb2f46aaa7a$var$addColorValue(color, step) {
1211
- let newColor = color ? color : $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR;
1212
- let colorInt = newColor.toHexInt();
1213
- let clampInt = Math.min(Math.max(colorInt + step, $f59de409cf55723659fabb2f46aaa7a$var$MIN_COLOR_INT), $f59de409cf55723659fabb2f46aaa7a$var$MAX_COLOR_INT);
1145
+ $parcel$exportWildcard(module.exports, $af2d7ac9990cfee2$exports);
1146
+ $parcel$exportWildcard(module.exports, $5386a492cfd3234c$exports);
1147
+ $parcel$exportWildcard(module.exports, $9d7d8736d45f74b8$exports);
1148
+ $parcel$exportWildcard(module.exports, $d59d0c2b2ce1568f$exports);
1214
1149
 
1215
- if (clampInt !== colorInt) {
1216
- let newColorString = "#" + clampInt.toString(16).padStart(6, '0').toUpperCase();
1217
- newColor = parseColor(newColorString);
1218
- }
1219
1150
 
1220
- return newColor;
1221
- }
1222
1151
  //# sourceMappingURL=main.js.map