@react-stately/color 3.0.0-beta.2 → 3.0.0-beta.6
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 +870 -923
- package/dist/main.js.map +1 -1
- package/dist/module.js +861 -897
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -9
- package/src/Color.ts +201 -26
- package/src/useColorFieldState.ts +19 -36
- package/src/useColorWheelState.ts +11 -7
package/dist/module.js
CHANGED
|
@@ -1,1005 +1,969 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var $cdad99d1d4c78a097fa29797f20e3ec$exports = {};
|
|
15
|
-
$cdad99d1d4c78a097fa29797f20e3ec$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
|
|
16
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/cs-CZ.json
|
|
17
|
-
var $f9cd6479f5235258a90316a784221e3b$exports = {};
|
|
18
|
-
$f9cd6479f5235258a90316a784221e3b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
|
|
19
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/da-DK.json
|
|
20
|
-
var $d9a48d423b3cf4f2d44abe3c990b$exports = {};
|
|
21
|
-
$d9a48d423b3cf4f2d44abe3c990b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
|
|
22
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/de-DE.json
|
|
23
|
-
var $c98aec81a0d1f104658866432f$exports = {};
|
|
24
|
-
$c98aec81a0d1f104658866432f$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
|
|
25
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/el-GR.json
|
|
26
|
-
var $d448bd8618b5533ccc4a8cc128b5f05a$exports = {};
|
|
27
|
-
$d448bd8618b5533ccc4a8cc128b5f05a$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
|
|
28
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/en-US.json
|
|
29
|
-
var $eaffba4fd6d2bfdbccc895c90029fc1b$exports = {};
|
|
30
|
-
$eaffba4fd6d2bfdbccc895c90029fc1b$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
|
|
31
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/es-ES.json
|
|
32
|
-
var $ba4a9d986c77d6b793c00d1e2392bade$exports = {};
|
|
33
|
-
$ba4a9d986c77d6b793c00d1e2392bade$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
|
|
34
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/et-EE.json
|
|
35
|
-
var $eea6c1402487c18ea84576423346b15$exports = {};
|
|
36
|
-
$eea6c1402487c18ea84576423346b15$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
|
|
37
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/fi-FI.json
|
|
38
|
-
var $a74db7b52c67c25bc7440950d823b$exports = {};
|
|
39
|
-
$a74db7b52c67c25bc7440950d823b$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
|
|
40
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/fr-FR.json
|
|
41
|
-
var $fe5ec5953266844aed13956bf74a814$exports = {};
|
|
42
|
-
$fe5ec5953266844aed13956bf74a814$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
|
|
43
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/he-IL.json
|
|
44
|
-
var $c8b18e3105ca2bd3791c8ba8d5c080e9$exports = {};
|
|
45
|
-
$c8b18e3105ca2bd3791c8ba8d5c080e9$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
|
|
46
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/hr-HR.json
|
|
47
|
-
var $b91aba8d136e0d182ab14d$exports = {};
|
|
48
|
-
$b91aba8d136e0d182ab14d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
|
|
49
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/hu-HU.json
|
|
50
|
-
var $e4a95e1cff41940abe4abd86d$exports = {};
|
|
51
|
-
$e4a95e1cff41940abe4abd86d$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\"}");
|
|
52
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/it-IT.json
|
|
53
|
-
var $cc9b471008e063931f187b9f17ea84$exports = {};
|
|
54
|
-
$cc9b471008e063931f187b9f17ea84$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
|
|
55
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ja-JP.json
|
|
56
|
-
var $b3ba4812949b99f64ae9c5343cef182$exports = {};
|
|
57
|
-
$b3ba4812949b99f64ae9c5343cef182$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
|
|
58
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ko-KR.json
|
|
59
|
-
var $a0635388d1896feed826078018e61cc3$exports = {};
|
|
60
|
-
$a0635388d1896feed826078018e61cc3$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
|
|
61
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/lt-LT.json
|
|
62
|
-
var $b723c6ed4b6433c464915f350d7b37d$exports = {};
|
|
63
|
-
$b723c6ed4b6433c464915f350d7b37d$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
|
|
64
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/lv-LV.json
|
|
65
|
-
var $de160269d06dd11d79a46ad67519$exports = {};
|
|
66
|
-
$de160269d06dd11d79a46ad67519$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
|
|
67
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/nb-NO.json
|
|
68
|
-
var $df7f70de921632c10878ba1ec274be$exports = {};
|
|
69
|
-
$df7f70de921632c10878ba1ec274be$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
|
|
70
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/nl-NL.json
|
|
71
|
-
var $f815b3f638134acc513a2b0c77d8dce0$exports = {};
|
|
72
|
-
$f815b3f638134acc513a2b0c77d8dce0$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
|
|
73
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pl-PL.json
|
|
74
|
-
var $aee27b855fc838cae4ebd8dfbbb95e33$exports = {};
|
|
75
|
-
$aee27b855fc838cae4ebd8dfbbb95e33$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
|
|
76
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pt-BR.json
|
|
77
|
-
var $b361c9c44348e09361feb2ebb7e33$exports = {};
|
|
78
|
-
$b361c9c44348e09361feb2ebb7e33$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
|
|
79
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/pt-PT.json
|
|
80
|
-
var $d6cb1234c3b503df17397aae027f5d6f$exports = {};
|
|
81
|
-
$d6cb1234c3b503df17397aae027f5d6f$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
|
|
82
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ro-RO.json
|
|
83
|
-
var $b8d88afd8f44c22874b7fe6f22d03d1$exports = {};
|
|
84
|
-
$b8d88afd8f44c22874b7fe6f22d03d1$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
|
|
85
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/ru-RU.json
|
|
86
|
-
var $c188a27cabc6e80207754236eb1fec$exports = {};
|
|
87
|
-
$c188a27cabc6e80207754236eb1fec$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
|
|
88
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sk-SK.json
|
|
89
|
-
var $c40950a3513f1cbbb70121cc402a156f$exports = {};
|
|
90
|
-
$c40950a3513f1cbbb70121cc402a156f$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
|
|
91
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sl-SI.json
|
|
92
|
-
var $d6ba833b474990359bcaf23ae4062a5a$exports = {};
|
|
93
|
-
$d6ba833b474990359bcaf23ae4062a5a$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
|
|
94
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sr-SP.json
|
|
95
|
-
var $b540c0afbb8586393249300b9d058750$exports = {};
|
|
96
|
-
$b540c0afbb8586393249300b9d058750$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
|
|
97
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/sv-SE.json
|
|
98
|
-
var $f6f532bfe6495593ae520210aedcf6ee$exports = {};
|
|
99
|
-
$f6f532bfe6495593ae520210aedcf6ee$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
|
|
100
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/tr-TR.json
|
|
101
|
-
var $b002567dfed5d0563037184fe514$exports = {};
|
|
102
|
-
$b002567dfed5d0563037184fe514$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\"}");
|
|
103
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/uk-UA.json
|
|
104
|
-
var $e3caa848bb758a1d3e6ca0f18ece7f4$exports = {};
|
|
105
|
-
$e3caa848bb758a1d3e6ca0f18ece7f4$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
|
|
106
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/zh-CN.json
|
|
107
|
-
var $d24ec9fef3a39ede5b3f154080d42$exports = {};
|
|
108
|
-
$d24ec9fef3a39ede5b3f154080d42$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
|
|
109
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-stately/color/intl/zh-TW.json
|
|
110
|
-
var $a1e968ea81ccd941358c63d78a093ff0$exports = {};
|
|
111
|
-
$a1e968ea81ccd941358c63d78a093ff0$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
const $db5f3c2f048bca5be854d051d3f2729$var$intlMessages = {
|
|
114
|
-
"ar-AE": _babelRuntimeHelpersEsmInteropRequireDefault($b2cd9264f0b716f5f6077988ebeb8d5$exports).default,
|
|
115
|
-
"bg-BG": _babelRuntimeHelpersEsmInteropRequireDefault($cdad99d1d4c78a097fa29797f20e3ec$exports).default,
|
|
116
|
-
"cs-CZ": _babelRuntimeHelpersEsmInteropRequireDefault($f9cd6479f5235258a90316a784221e3b$exports).default,
|
|
117
|
-
"da-DK": _babelRuntimeHelpersEsmInteropRequireDefault($d9a48d423b3cf4f2d44abe3c990b$exports).default,
|
|
118
|
-
"de-DE": _babelRuntimeHelpersEsmInteropRequireDefault($c98aec81a0d1f104658866432f$exports).default,
|
|
119
|
-
"el-GR": _babelRuntimeHelpersEsmInteropRequireDefault($d448bd8618b5533ccc4a8cc128b5f05a$exports).default,
|
|
120
|
-
"en-US": _babelRuntimeHelpersEsmInteropRequireDefault($eaffba4fd6d2bfdbccc895c90029fc1b$exports).default,
|
|
121
|
-
"es-ES": _babelRuntimeHelpersEsmInteropRequireDefault($ba4a9d986c77d6b793c00d1e2392bade$exports).default,
|
|
122
|
-
"et-EE": _babelRuntimeHelpersEsmInteropRequireDefault($eea6c1402487c18ea84576423346b15$exports).default,
|
|
123
|
-
"fi-FI": _babelRuntimeHelpersEsmInteropRequireDefault($a74db7b52c67c25bc7440950d823b$exports).default,
|
|
124
|
-
"fr-FR": _babelRuntimeHelpersEsmInteropRequireDefault($fe5ec5953266844aed13956bf74a814$exports).default,
|
|
125
|
-
"he-IL": _babelRuntimeHelpersEsmInteropRequireDefault($c8b18e3105ca2bd3791c8ba8d5c080e9$exports).default,
|
|
126
|
-
"hr-HR": _babelRuntimeHelpersEsmInteropRequireDefault($b91aba8d136e0d182ab14d$exports).default,
|
|
127
|
-
"hu-HU": _babelRuntimeHelpersEsmInteropRequireDefault($e4a95e1cff41940abe4abd86d$exports).default,
|
|
128
|
-
"it-IT": _babelRuntimeHelpersEsmInteropRequireDefault($cc9b471008e063931f187b9f17ea84$exports).default,
|
|
129
|
-
"ja-JP": _babelRuntimeHelpersEsmInteropRequireDefault($b3ba4812949b99f64ae9c5343cef182$exports).default,
|
|
130
|
-
"ko-KR": _babelRuntimeHelpersEsmInteropRequireDefault($a0635388d1896feed826078018e61cc3$exports).default,
|
|
131
|
-
"lt-LT": _babelRuntimeHelpersEsmInteropRequireDefault($b723c6ed4b6433c464915f350d7b37d$exports).default,
|
|
132
|
-
"lv-LV": _babelRuntimeHelpersEsmInteropRequireDefault($de160269d06dd11d79a46ad67519$exports).default,
|
|
133
|
-
"nb-NO": _babelRuntimeHelpersEsmInteropRequireDefault($df7f70de921632c10878ba1ec274be$exports).default,
|
|
134
|
-
"nl-NL": _babelRuntimeHelpersEsmInteropRequireDefault($f815b3f638134acc513a2b0c77d8dce0$exports).default,
|
|
135
|
-
"pl-PL": _babelRuntimeHelpersEsmInteropRequireDefault($aee27b855fc838cae4ebd8dfbbb95e33$exports).default,
|
|
136
|
-
"pt-BR": _babelRuntimeHelpersEsmInteropRequireDefault($b361c9c44348e09361feb2ebb7e33$exports).default,
|
|
137
|
-
"pt-PT": _babelRuntimeHelpersEsmInteropRequireDefault($d6cb1234c3b503df17397aae027f5d6f$exports).default,
|
|
138
|
-
"ro-RO": _babelRuntimeHelpersEsmInteropRequireDefault($b8d88afd8f44c22874b7fe6f22d03d1$exports).default,
|
|
139
|
-
"ru-RU": _babelRuntimeHelpersEsmInteropRequireDefault($c188a27cabc6e80207754236eb1fec$exports).default,
|
|
140
|
-
"sk-SK": _babelRuntimeHelpersEsmInteropRequireDefault($c40950a3513f1cbbb70121cc402a156f$exports).default,
|
|
141
|
-
"sl-SI": _babelRuntimeHelpersEsmInteropRequireDefault($d6ba833b474990359bcaf23ae4062a5a$exports).default,
|
|
142
|
-
"sr-SP": _babelRuntimeHelpersEsmInteropRequireDefault($b540c0afbb8586393249300b9d058750$exports).default,
|
|
143
|
-
"sv-SE": _babelRuntimeHelpersEsmInteropRequireDefault($f6f532bfe6495593ae520210aedcf6ee$exports).default,
|
|
144
|
-
"tr-TR": _babelRuntimeHelpersEsmInteropRequireDefault($b002567dfed5d0563037184fe514$exports).default,
|
|
145
|
-
"uk-UA": _babelRuntimeHelpersEsmInteropRequireDefault($e3caa848bb758a1d3e6ca0f18ece7f4$exports).default,
|
|
146
|
-
"zh-CN": _babelRuntimeHelpersEsmInteropRequireDefault($d24ec9fef3a39ede5b3f154080d42$exports).default,
|
|
147
|
-
"zh-TW": _babelRuntimeHelpersEsmInteropRequireDefault($a1e968ea81ccd941358c63d78a093ff0$exports).default
|
|
148
|
-
};
|
|
149
|
-
const $db5f3c2f048bca5be854d051d3f2729$var$messages = new MessageDictionary($db5f3c2f048bca5be854d051d3f2729$var$intlMessages);
|
|
150
|
-
/** Parses a color from a string value. Throws an error if the string could not be parsed. */
|
|
1
|
+
import {clamp as $6YREh$clamp, toFixedNumber as $6YREh$toFixedNumber, useControlledState as $6YREh$useControlledState} from "@react-stately/utils";
|
|
2
|
+
import {MessageDictionary as $6YREh$MessageDictionary} from "@internationalized/message";
|
|
3
|
+
import {NumberFormatter as $6YREh$NumberFormatter} from "@internationalized/number";
|
|
4
|
+
import {useSliderState as $6YREh$useSliderState} from "@react-stately/slider";
|
|
5
|
+
import {useRef as $6YREh$useRef, useState as $6YREh$useState, useEffect as $6YREh$useEffect, useMemo as $6YREh$useMemo} from "react";
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
function $parcel$export(e, n, v, s) {
|
|
11
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
+
}
|
|
13
|
+
var $19b55adb42b5e1b3$exports = {};
|
|
151
14
|
|
|
152
|
-
export
|
|
153
|
-
let res = $db5f3c2f048bca5be854d051d3f2729$var$RGBColor.parse(value) || $db5f3c2f048bca5be854d051d3f2729$var$HSBColor.parse(value) || $db5f3c2f048bca5be854d051d3f2729$var$HSLColor.parse(value);
|
|
15
|
+
$parcel$export($19b55adb42b5e1b3$exports, "parseColor", () => $19b55adb42b5e1b3$export$6e865ea70d7724f);
|
|
154
16
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
17
|
+
var $675273e4af08d62e$exports = {};
|
|
18
|
+
var $077bd0bceac79457$exports = {};
|
|
19
|
+
$077bd0bceac79457$exports = JSON.parse("{\"alpha\":\"ألفا\",\"blue\":\"أزرق\",\"brightness\":\"السطوع\",\"green\":\"أخضر\",\"hue\":\"درجة اللون\",\"lightness\":\"الإضاءة\",\"red\":\"أحمر\",\"saturation\":\"التشبع\"}");
|
|
158
20
|
|
|
159
|
-
throw new Error('Invalid color value: ' + value);
|
|
160
|
-
}
|
|
161
21
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return this.toFormat('rgb').toHexInt();
|
|
165
|
-
}
|
|
22
|
+
var $cddd4812af0cd440$exports = {};
|
|
23
|
+
$cddd4812af0cd440$exports = JSON.parse("{\"alpha\":\"Алфа\",\"blue\":\"Синьо\",\"brightness\":\"Яркост\",\"green\":\"Зелено\",\"hue\":\"Оттенък\",\"lightness\":\"Лекота\",\"red\":\"Червено\",\"saturation\":\"Наситеност\"}");
|
|
166
24
|
|
|
167
|
-
getChannelValue(channel) {
|
|
168
|
-
if (channel in this) {
|
|
169
|
-
return this[channel];
|
|
170
|
-
}
|
|
171
25
|
|
|
172
|
-
|
|
173
|
-
|
|
26
|
+
var $183858b76275efe7$exports = {};
|
|
27
|
+
$183858b76275efe7$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odstín\",\"lightness\":\"Světlost\",\"red\":\"Červená\",\"saturation\":\"Sytost\"}");
|
|
174
28
|
|
|
175
|
-
withChannelValue(channel, value) {
|
|
176
|
-
if (channel in this) {
|
|
177
|
-
let x = this.clone();
|
|
178
|
-
x[channel] = value;
|
|
179
|
-
return x;
|
|
180
|
-
}
|
|
181
29
|
|
|
182
|
-
|
|
183
|
-
|
|
30
|
+
var $020bfa8dadaf30b2$exports = {};
|
|
31
|
+
$020bfa8dadaf30b2$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grøn\",\"hue\":\"Tone\",\"lightness\":\"Lyshed\",\"red\":\"Rød\",\"saturation\":\"Farvemætning\"}");
|
|
184
32
|
|
|
185
|
-
getChannelName(channel, locale) {
|
|
186
|
-
return $db5f3c2f048bca5be854d051d3f2729$var$messages.getStringForLocale(channel, locale);
|
|
187
|
-
}
|
|
188
33
|
|
|
189
|
-
}
|
|
34
|
+
var $9d6c5c82d9282c0f$exports = {};
|
|
35
|
+
$9d6c5c82d9282c0f$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Blau\",\"brightness\":\"Helligkeit\",\"green\":\"Grün\",\"hue\":\"Farbton\",\"lightness\":\"Leuchtkraft\",\"red\":\"Rot\",\"saturation\":\"Sättigung\"}");
|
|
190
36
|
|
|
191
|
-
const $db5f3c2f048bca5be854d051d3f2729$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i; // X = <negative/positive number with/without decimal places>
|
|
192
|
-
// before/after a comma, 0 or more whitespaces are allowed
|
|
193
|
-
// - rgb(X, X, X)
|
|
194
|
-
// - rgba(X, X, X, X)
|
|
195
37
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
class $db5f3c2f048bca5be854d051d3f2729$var$RGBColor extends $db5f3c2f048bca5be854d051d3f2729$var$Color {
|
|
199
|
-
constructor(red, green, blue, alpha) {
|
|
200
|
-
super();
|
|
201
|
-
this.red = red;
|
|
202
|
-
this.green = green;
|
|
203
|
-
this.blue = blue;
|
|
204
|
-
this.alpha = alpha;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
static parse(value) {
|
|
208
|
-
let m;
|
|
209
|
-
|
|
210
|
-
if (m = value.match($db5f3c2f048bca5be854d051d3f2729$var$HEX_REGEX)) {
|
|
211
|
-
if (m[1]) {
|
|
212
|
-
let r = parseInt(m[1][0] + m[1][0], 16);
|
|
213
|
-
let g = parseInt(m[1][1] + m[1][1], 16);
|
|
214
|
-
let b = parseInt(m[1][2] + m[1][2], 16);
|
|
215
|
-
return new $db5f3c2f048bca5be854d051d3f2729$var$RGBColor(r, g, b, 1);
|
|
216
|
-
} else if (m[2]) {
|
|
217
|
-
let r = parseInt(m[2][0] + m[2][1], 16);
|
|
218
|
-
let g = parseInt(m[2][2] + m[2][3], 16);
|
|
219
|
-
let b = parseInt(m[2][4] + m[2][5], 16);
|
|
220
|
-
return new $db5f3c2f048bca5be854d051d3f2729$var$RGBColor(r, g, b, 1);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (m = value.match($db5f3c2f048bca5be854d051d3f2729$var$RGB_REGEX)) {
|
|
225
|
-
var _m$;
|
|
226
|
-
|
|
227
|
-
const [r, g, b, a] = ((_m$ = m[1]) != null ? _m$ : m[2]).split(',').map(n => Number(n.trim()));
|
|
228
|
-
return new $db5f3c2f048bca5be854d051d3f2729$var$RGBColor(clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255), clamp(a != null ? a : 1, 0, 1));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
toString(format) {
|
|
233
|
-
switch (format) {
|
|
234
|
-
case 'hex':
|
|
235
|
-
return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
|
|
236
|
-
|
|
237
|
-
case 'hexa':
|
|
238
|
-
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();
|
|
239
|
-
|
|
240
|
-
case 'rgb':
|
|
241
|
-
return "rgb(" + this.red + ", " + this.green + ", " + this.blue + ")";
|
|
242
|
-
|
|
243
|
-
case 'css':
|
|
244
|
-
case 'rgba':
|
|
245
|
-
return "rgba(" + this.red + ", " + this.green + ", " + this.blue + ", " + this.alpha + ")";
|
|
246
|
-
|
|
247
|
-
default:
|
|
248
|
-
return this.toFormat(format).toString(format);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
toFormat(format) {
|
|
253
|
-
switch (format) {
|
|
254
|
-
case 'hex':
|
|
255
|
-
case 'hexa':
|
|
256
|
-
case 'rgb':
|
|
257
|
-
case 'rgba':
|
|
258
|
-
return this;
|
|
259
|
-
|
|
260
|
-
default:
|
|
261
|
-
throw new Error('Unsupported color conversion: rgb -> ' + format);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
toHexInt() {
|
|
266
|
-
return this.red << 16 | this.green << 8 | this.blue;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
clone() {
|
|
270
|
-
return new $db5f3c2f048bca5be854d051d3f2729$var$RGBColor(this.red, this.green, this.blue, this.alpha);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
getChannelRange(channel) {
|
|
274
|
-
switch (channel) {
|
|
275
|
-
case 'red':
|
|
276
|
-
case 'green':
|
|
277
|
-
case 'blue':
|
|
278
|
-
return {
|
|
279
|
-
minValue: 0,
|
|
280
|
-
maxValue: 255,
|
|
281
|
-
step: 1
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
case 'alpha':
|
|
285
|
-
return {
|
|
286
|
-
minValue: 0,
|
|
287
|
-
maxValue: 1,
|
|
288
|
-
step: 0.01
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
default:
|
|
292
|
-
throw new Error('Unknown color channel: ' + channel);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
formatChannelValue(channel, locale) {
|
|
297
|
-
let options;
|
|
298
|
-
let value = this.getChannelValue(channel);
|
|
299
|
-
|
|
300
|
-
switch (channel) {
|
|
301
|
-
case 'red':
|
|
302
|
-
case 'green':
|
|
303
|
-
case 'blue':
|
|
304
|
-
options = {
|
|
305
|
-
style: 'decimal'
|
|
306
|
-
};
|
|
307
|
-
break;
|
|
308
|
-
|
|
309
|
-
case 'alpha':
|
|
310
|
-
options = {
|
|
311
|
-
style: 'percent'
|
|
312
|
-
};
|
|
313
|
-
break;
|
|
314
|
-
|
|
315
|
-
default:
|
|
316
|
-
throw new Error('Unknown color channel: ' + channel);
|
|
317
|
-
}
|
|
38
|
+
var $854ad75b322fe89a$exports = {};
|
|
39
|
+
$854ad75b322fe89a$exports = JSON.parse("{\"alpha\":\"Άλφα\",\"blue\":\"Μπλε\",\"brightness\":\"Φωτεινότητα\",\"green\":\"Πράσινο\",\"hue\":\"Τόνος\",\"lightness\":\"Φωτεινότητα\",\"red\":\"Κόκκινο\",\"saturation\":\"Κορεσμός\"}");
|
|
318
40
|
|
|
319
|
-
return new NumberFormatter(locale, options).format(value);
|
|
320
|
-
}
|
|
321
41
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
// - hsb(X, X%, X%)
|
|
325
|
-
// - hsba(X, X%, X%, X)
|
|
42
|
+
var $be9ad9682b370ddc$exports = {};
|
|
43
|
+
$be9ad9682b370ddc$exports = JSON.parse("{\"hue\":\"Hue\",\"saturation\":\"Saturation\",\"lightness\":\"Lightness\",\"brightness\":\"Brightness\",\"red\":\"Red\",\"green\":\"Green\",\"blue\":\"Blue\",\"alpha\":\"Alpha\"}");
|
|
326
44
|
|
|
327
45
|
|
|
328
|
-
|
|
46
|
+
var $05a0b4f28c8ee761$exports = {};
|
|
47
|
+
$05a0b4f28c8ee761$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Azul\",\"brightness\":\"Brillo\",\"green\":\"Verde\",\"hue\":\"Tono\",\"lightness\":\"Luminosidad\",\"red\":\"Rojo\",\"saturation\":\"Saturación\"}");
|
|
329
48
|
|
|
330
|
-
class $db5f3c2f048bca5be854d051d3f2729$var$HSBColor extends $db5f3c2f048bca5be854d051d3f2729$var$Color {
|
|
331
|
-
constructor(hue, saturation, brightness, alpha) {
|
|
332
|
-
super();
|
|
333
|
-
this.hue = hue;
|
|
334
|
-
this.saturation = saturation;
|
|
335
|
-
this.brightness = brightness;
|
|
336
|
-
this.alpha = alpha;
|
|
337
|
-
}
|
|
338
49
|
|
|
339
|
-
|
|
340
|
-
|
|
50
|
+
var $5d177f7c41df0d7c$exports = {};
|
|
51
|
+
$5d177f7c41df0d7c$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Sinine\",\"brightness\":\"Heledus\",\"green\":\"Roheline\",\"hue\":\"Värv\",\"lightness\":\"Valgus\",\"red\":\"Punane\",\"saturation\":\"Küllastus\"}");
|
|
341
52
|
|
|
342
|
-
if (m = value.match($db5f3c2f048bca5be854d051d3f2729$var$HSB_REGEX)) {
|
|
343
|
-
var _m$2;
|
|
344
53
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
}
|
|
54
|
+
var $c0c8e1b6dbe88b42$exports = {};
|
|
55
|
+
$c0c8e1b6dbe88b42$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Sininen\",\"brightness\":\"Kirkkaus\",\"green\":\"Vihreä\",\"hue\":\"Sävy\",\"lightness\":\"Valomäärä\",\"red\":\"Punainen\",\"saturation\":\"Värikylläisyys\"}");
|
|
349
56
|
|
|
350
|
-
toString(format) {
|
|
351
|
-
switch (format) {
|
|
352
|
-
case 'css':
|
|
353
|
-
return this.toHSL().toString('css');
|
|
354
|
-
|
|
355
|
-
case 'hsb':
|
|
356
|
-
return "hsb(" + this.hue + ", " + this.saturation + "%, " + this.brightness + "%)";
|
|
357
|
-
|
|
358
|
-
case 'hsba':
|
|
359
|
-
return "hsba(" + this.hue + ", " + this.saturation + "%, " + this.brightness + "%, " + this.alpha + ")";
|
|
360
57
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
}
|
|
58
|
+
var $f78038f3c5ac85bf$exports = {};
|
|
59
|
+
$f78038f3c5ac85bf$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"Bleu\",\"brightness\":\"Luminosité\",\"green\":\"Vert\",\"hue\":\"Teinte\",\"lightness\":\"Luminosité\",\"red\":\"Rouge\",\"saturation\":\"Saturation\"}");
|
|
365
60
|
|
|
366
|
-
toFormat(format) {
|
|
367
|
-
switch (format) {
|
|
368
|
-
case 'hsb':
|
|
369
|
-
case 'hsba':
|
|
370
|
-
return this;
|
|
371
61
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
return this.toHSL();
|
|
62
|
+
var $99f849eae7055e0d$exports = {};
|
|
63
|
+
$99f849eae7055e0d$exports = JSON.parse("{\"alpha\":\"אלפא\",\"blue\":\"כחול\",\"brightness\":\"בהירות\",\"green\":\"ירוק\",\"hue\":\"גוון\",\"lightness\":\"כמות אור\",\"red\":\"אדום\",\"saturation\":\"רוויה\"}");
|
|
375
64
|
|
|
376
|
-
default:
|
|
377
|
-
throw new Error('Unsupported color conversion: hsb -> ' + format);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
65
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
var l = (2 - this.saturation / 100) * this.brightness / 2; // store the HSL components
|
|
66
|
+
var $d0b14a225bb73c77$exports = {};
|
|
67
|
+
$d0b14a225bb73c77$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Svjetlina\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvijetljenost\",\"red\":\"Crvena\",\"saturation\":\"Zasićenost\"}");
|
|
384
68
|
|
|
385
|
-
let hue = this.hue;
|
|
386
|
-
let saturation = this.saturation * this.brightness / (l < 50 ? l * 2 : 200 - l * 2);
|
|
387
|
-
let lightness = l; // correct a division-by-zero error
|
|
388
69
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
70
|
+
var $b47e94169ab16ffb$exports = {};
|
|
71
|
+
$b47e94169ab16ffb$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\"}");
|
|
392
72
|
|
|
393
|
-
return new $db5f3c2f048bca5be854d051d3f2729$var$HSLColor(hue, saturation, lightness, this.alpha);
|
|
394
|
-
}
|
|
395
73
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
74
|
+
var $3ca86f7c5a542fc2$exports = {};
|
|
75
|
+
$3ca86f7c5a542fc2$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blu\",\"brightness\":\"Luminosità\",\"green\":\"Verde\",\"hue\":\"Tonalità\",\"lightness\":\"Luminosità\",\"red\":\"Rosso\",\"saturation\":\"Saturazione\"}");
|
|
399
76
|
|
|
400
|
-
getChannelRange(channel) {
|
|
401
|
-
switch (channel) {
|
|
402
|
-
case 'hue':
|
|
403
|
-
return {
|
|
404
|
-
minValue: 0,
|
|
405
|
-
maxValue: 360,
|
|
406
|
-
step: 1
|
|
407
|
-
};
|
|
408
77
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
return {
|
|
412
|
-
minValue: 0,
|
|
413
|
-
maxValue: 100,
|
|
414
|
-
step: 1
|
|
415
|
-
};
|
|
78
|
+
var $9c9adbefd088dfec$exports = {};
|
|
79
|
+
$9c9adbefd088dfec$exports = JSON.parse("{\"alpha\":\"アルファ\",\"blue\":\"青\",\"brightness\":\"明るさ\",\"green\":\"緑\",\"hue\":\"色相\",\"lightness\":\"明度\",\"red\":\"赤\",\"saturation\":\"彩度\"}");
|
|
416
80
|
|
|
417
|
-
case 'alpha':
|
|
418
|
-
return {
|
|
419
|
-
minValue: 0,
|
|
420
|
-
maxValue: 1,
|
|
421
|
-
step: 0.01
|
|
422
|
-
};
|
|
423
81
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
formatChannelValue(channel, locale) {
|
|
430
|
-
let options;
|
|
431
|
-
let value = this.getChannelValue(channel);
|
|
432
|
-
|
|
433
|
-
switch (channel) {
|
|
434
|
-
case 'hue':
|
|
435
|
-
options = {
|
|
436
|
-
style: 'unit',
|
|
437
|
-
unit: 'degree',
|
|
438
|
-
unitDisplay: 'narrow'
|
|
439
|
-
};
|
|
440
|
-
break;
|
|
82
|
+
var $e0a855e991915bcf$exports = {};
|
|
83
|
+
$e0a855e991915bcf$exports = JSON.parse("{\"alpha\":\"알파\",\"blue\":\"파랑\",\"brightness\":\"명도\",\"green\":\"초록\",\"hue\":\"색조\",\"lightness\":\"밝기\",\"red\":\"빨강\",\"saturation\":\"채도\"}");
|
|
441
84
|
|
|
442
|
-
case 'saturation':
|
|
443
|
-
case 'brightness':
|
|
444
|
-
options = {
|
|
445
|
-
style: 'percent'
|
|
446
|
-
};
|
|
447
|
-
value /= 100;
|
|
448
|
-
break;
|
|
449
85
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
style: 'percent'
|
|
453
|
-
};
|
|
454
|
-
break;
|
|
455
|
-
|
|
456
|
-
default:
|
|
457
|
-
throw new Error('Unknown color channel: ' + channel);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
return new NumberFormatter(locale, options).format(value);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
} // X = <negative/positive number with/without decimal places>
|
|
464
|
-
// before/after a comma, 0 or more whitespaces are allowed
|
|
465
|
-
// - hsl(X, X%, X%)
|
|
466
|
-
// - hsla(X, X%, X%, X)
|
|
86
|
+
var $b2bbcc4a6d0f4ff0$exports = {};
|
|
87
|
+
$b2bbcc4a6d0f4ff0$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Mėlyna\",\"brightness\":\"Ryškumas\",\"green\":\"Žalia\",\"hue\":\"Atspalvis\",\"lightness\":\"Šviesumas\",\"red\":\"Raudona\",\"saturation\":\"Įsotinimas\"}");
|
|
467
88
|
|
|
468
89
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
function $db5f3c2f048bca5be854d051d3f2729$var$mod(n, m) {
|
|
472
|
-
return (n % m + m) % m;
|
|
473
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
90
|
+
var $d1a2e38b31bf8b62$exports = {};
|
|
91
|
+
$d1a2e38b31bf8b62$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Zila\",\"brightness\":\"Spilgtums\",\"green\":\"Zaļa\",\"hue\":\"Nokrāsa\",\"lightness\":\"Gaišums\",\"red\":\"Sarkana\",\"saturation\":\"Piesātinājums\"}");
|
|
474
92
|
|
|
475
93
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
super();
|
|
479
|
-
this.hue = hue;
|
|
480
|
-
this.saturation = saturation;
|
|
481
|
-
this.lightness = lightness;
|
|
482
|
-
this.alpha = alpha;
|
|
483
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
94
|
+
var $08e30a9af5d53702$exports = {};
|
|
95
|
+
$08e30a9af5d53702$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blå\",\"brightness\":\"Lysstyrke\",\"green\":\"Grønn\",\"hue\":\"Fargetone\",\"lightness\":\"Lyshet\",\"red\":\"Rød\",\"saturation\":\"Metning\"}");
|
|
484
96
|
|
|
485
97
|
|
|
486
|
-
|
|
487
|
-
|
|
98
|
+
var $659611dede656c7e$exports = {};
|
|
99
|
+
$659611dede656c7e$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blauw\",\"brightness\":\"Helderheid\",\"green\":\"Groen\",\"hue\":\"Kleurtoon\",\"lightness\":\"Lichtsterkte\",\"red\":\"Rood\",\"saturation\":\"Verzadiging\"}");
|
|
488
100
|
|
|
489
|
-
if (m = value.match($db5f3c2f048bca5be854d051d3f2729$var$HSL_REGEX)) {
|
|
490
|
-
var _m$3;
|
|
491
101
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
}
|
|
102
|
+
var $0f93c75b665df87b$exports = {};
|
|
103
|
+
$0f93c75b665df87b$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Niebieski\",\"brightness\":\"Jasność\",\"green\":\"Zielony\",\"hue\":\"Odcień\",\"lightness\":\"Jaskrawość\",\"red\":\"Czerwony\",\"saturation\":\"Nasycenie\"}");
|
|
496
104
|
|
|
497
|
-
toString(format) {
|
|
498
|
-
switch (format) {
|
|
499
|
-
case 'hsl':
|
|
500
|
-
return "hsl(" + this.hue + ", " + this.saturation + "%, " + this.lightness + "%)";
|
|
501
105
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
return "hsla(" + this.hue + ", " + this.saturation + "%, " + this.lightness + "%, " + this.alpha + ")";
|
|
106
|
+
var $c00ea759839bb843$exports = {};
|
|
107
|
+
$c00ea759839bb843$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Brilho\",\"green\":\"Verde\",\"hue\":\"Matiz\",\"lightness\":\"Luminosidade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
|
|
505
108
|
|
|
506
|
-
default:
|
|
507
|
-
return this.toFormat(format).toString(format);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
109
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
case 'hsl':
|
|
514
|
-
case 'hsla':
|
|
515
|
-
return this;
|
|
110
|
+
var $821dfa0d9faae4f9$exports = {};
|
|
111
|
+
$821dfa0d9faae4f9$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Azul\",\"brightness\":\"Luminosidade\",\"green\":\"Verde\",\"hue\":\"Tonalidade\",\"lightness\":\"Claridade\",\"red\":\"Vermelho\",\"saturation\":\"Saturação\"}");
|
|
516
112
|
|
|
517
|
-
default:
|
|
518
|
-
throw new Error('Unsupported color conversion: hsl -> ' + format);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
113
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
114
|
+
var $fdb474da024beb51$exports = {};
|
|
115
|
+
$fdb474da024beb51$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Albastru\",\"brightness\":\"Luminozitate\",\"green\":\"Verde\",\"hue\":\"Nuanță\",\"lightness\":\"Luminozitate\",\"red\":\"Roșu\",\"saturation\":\"Saturație\"}");
|
|
525
116
|
|
|
526
|
-
getChannelRange(channel) {
|
|
527
|
-
switch (channel) {
|
|
528
|
-
case 'hue':
|
|
529
|
-
return {
|
|
530
|
-
minValue: 0,
|
|
531
|
-
maxValue: 360,
|
|
532
|
-
step: 1
|
|
533
|
-
};
|
|
534
117
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
return {
|
|
538
|
-
minValue: 0,
|
|
539
|
-
maxValue: 100,
|
|
540
|
-
step: 1
|
|
541
|
-
};
|
|
118
|
+
var $f51a8c7858d3993f$exports = {};
|
|
119
|
+
$f51a8c7858d3993f$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синий\",\"brightness\":\"Яркость\",\"green\":\"Зеленый\",\"hue\":\"Оттенок\",\"lightness\":\"Освещенность\",\"red\":\"Красный\",\"saturation\":\"Насыщенность\"}");
|
|
542
120
|
|
|
543
|
-
case 'alpha':
|
|
544
|
-
return {
|
|
545
|
-
minValue: 0,
|
|
546
|
-
maxValue: 1,
|
|
547
|
-
step: 0.01
|
|
548
|
-
};
|
|
549
121
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
}
|
|
122
|
+
var $a69372503f9b6f3a$exports = {};
|
|
123
|
+
$a69372503f9b6f3a$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modrá\",\"brightness\":\"Jas\",\"green\":\"Zelená\",\"hue\":\"Odtieň\",\"lightness\":\"Svetlosť\",\"red\":\"Červená\",\"saturation\":\"Sýtosť\"}");
|
|
554
124
|
|
|
555
|
-
formatChannelValue(channel, locale) {
|
|
556
|
-
let options;
|
|
557
|
-
let value = this.getChannelValue(channel);
|
|
558
125
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
options = {
|
|
562
|
-
style: 'unit',
|
|
563
|
-
unit: 'degree',
|
|
564
|
-
unitDisplay: 'narrow'
|
|
565
|
-
};
|
|
566
|
-
break;
|
|
126
|
+
var $820c47d01f6be0f0$exports = {};
|
|
127
|
+
$820c47d01f6be0f0$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Modra\",\"brightness\":\"Svetlost\",\"green\":\"Zelena\",\"hue\":\"Barva\",\"lightness\":\"Lahkost\",\"red\":\"Rdeča\",\"saturation\":\"Nasičenost\"}");
|
|
567
128
|
|
|
568
|
-
case 'saturation':
|
|
569
|
-
case 'lightness':
|
|
570
|
-
options = {
|
|
571
|
-
style: 'percent'
|
|
572
|
-
};
|
|
573
|
-
value /= 100;
|
|
574
|
-
break;
|
|
575
|
-
|
|
576
|
-
case 'alpha':
|
|
577
|
-
options = {
|
|
578
|
-
style: 'percent'
|
|
579
|
-
};
|
|
580
|
-
break;
|
|
581
|
-
|
|
582
|
-
default:
|
|
583
|
-
throw new Error('Unknown color channel: ' + channel);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
return new NumberFormatter(locale, options).format(value);
|
|
587
|
-
}
|
|
588
129
|
|
|
589
|
-
}
|
|
130
|
+
var $1948f454f1b262d8$exports = {};
|
|
131
|
+
$1948f454f1b262d8$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Plava\",\"brightness\":\"Osvetljenost\",\"green\":\"Zelena\",\"hue\":\"Nijansa\",\"lightness\":\"Osvetljenje\",\"red\":\"Crvena\",\"saturation\":\"Zasićenje\"}");
|
|
590
132
|
|
|
591
|
-
function $dfa319d4be3239bcd232b84e0e071$var$normalizeColor(v) {
|
|
592
|
-
if (typeof v === 'string') {
|
|
593
|
-
return parseColor(v);
|
|
594
|
-
} else {
|
|
595
|
-
return v;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Provides state management for a color slider component.
|
|
600
|
-
* Color sliders allow users to adjust an individual channel of a color value.
|
|
601
|
-
*/
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
export function useColorSliderState(props) {
|
|
605
|
-
let {
|
|
606
|
-
channel,
|
|
607
|
-
value,
|
|
608
|
-
defaultValue,
|
|
609
|
-
onChange,
|
|
610
|
-
locale
|
|
611
|
-
} = props,
|
|
612
|
-
otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["channel", "value", "defaultValue", "onChange", "locale"]);
|
|
613
|
-
|
|
614
|
-
if (value == null && defaultValue == null) {
|
|
615
|
-
throw new Error('useColorSliderState requires a value or defaultValue');
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
let [color, setColor] = useControlledState(value && $dfa319d4be3239bcd232b84e0e071$var$normalizeColor(value), defaultValue && $dfa319d4be3239bcd232b84e0e071$var$normalizeColor(defaultValue), onChange);
|
|
619
|
-
let sliderState = useSliderState(_babelRuntimeHelpersEsmExtends({}, color.getChannelRange(channel), otherProps, {
|
|
620
|
-
// Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
|
|
621
|
-
numberFormatter: null,
|
|
622
|
-
value: [color.getChannelValue(channel)],
|
|
623
|
-
|
|
624
|
-
onChange(_ref) {
|
|
625
|
-
let [v] = _ref;
|
|
626
|
-
setColor(color.withChannelValue(channel, v));
|
|
627
|
-
},
|
|
628
|
-
|
|
629
|
-
onChangeEnd(_ref2) {
|
|
630
|
-
let [v] = _ref2;
|
|
631
|
-
|
|
632
|
-
// onChange will have already been called with the right value, this is just to trigger onChangEnd
|
|
633
|
-
if (props.onChangeEnd) {
|
|
634
|
-
props.onChangeEnd(color.withChannelValue(channel, v));
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
}));
|
|
639
|
-
return _babelRuntimeHelpersEsmExtends({}, sliderState, {
|
|
640
|
-
value: color,
|
|
641
|
-
|
|
642
|
-
setValue(value) {
|
|
643
|
-
setColor($dfa319d4be3239bcd232b84e0e071$var$normalizeColor(value));
|
|
644
|
-
},
|
|
645
|
-
|
|
646
|
-
getDisplayColor() {
|
|
647
|
-
switch (channel) {
|
|
648
|
-
case 'hue':
|
|
649
|
-
return parseColor("hsl(" + color.getChannelValue('hue') + ", 100%, 50%)");
|
|
650
|
-
|
|
651
|
-
case 'lightness':
|
|
652
|
-
case 'brightness':
|
|
653
|
-
case 'saturation':
|
|
654
|
-
case 'red':
|
|
655
|
-
case 'green':
|
|
656
|
-
case 'blue':
|
|
657
|
-
return color.withChannelValue('alpha', 1);
|
|
658
|
-
|
|
659
|
-
case 'alpha':
|
|
660
|
-
{
|
|
661
|
-
return color;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
default:
|
|
665
|
-
throw new Error('Unknown color channel: ' + channel);
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
|
|
669
|
-
getThumbValueLabel() {
|
|
670
|
-
return color.formatChannelValue(channel, locale);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
133
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
return parseColor(v);
|
|
679
|
-
} else {
|
|
680
|
-
return v;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
134
|
+
var $af6617ce4e290100$exports = {};
|
|
135
|
+
$af6617ce4e290100$exports = JSON.parse("{\"alpha\":\"Alfa\",\"blue\":\"Blått\",\"brightness\":\"Ljusstyrka\",\"green\":\"Grönt\",\"hue\":\"Nyans\",\"lightness\":\"Ljushet\",\"red\":\"Rött\",\"saturation\":\"Mättnad\"}");
|
|
683
136
|
|
|
684
|
-
const $a54bad0097d5f20f12ac194ac13764$var$DEFAULT_COLOR = parseColor('hsl(0, 100%, 50%)');
|
|
685
137
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
}
|
|
138
|
+
var $e04fd2d342e58988$exports = {};
|
|
139
|
+
$e04fd2d342e58988$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\"}");
|
|
689
140
|
|
|
690
|
-
function $a54bad0097d5f20f12ac194ac13764$var$mod(n, m) {
|
|
691
|
-
return (n % m + m) % m;
|
|
692
|
-
}
|
|
693
141
|
|
|
694
|
-
|
|
695
|
-
|
|
142
|
+
var $b969554fc221bec5$exports = {};
|
|
143
|
+
$b969554fc221bec5$exports = JSON.parse("{\"alpha\":\"Альфа\",\"blue\":\"Синій\",\"brightness\":\"Яскравість\",\"green\":\"Зелений\",\"hue\":\"Тон\",\"lightness\":\"Освітленість\",\"red\":\"Червоний\",\"saturation\":\"Насиченість\"}");
|
|
696
144
|
|
|
697
|
-
if (r === v) {
|
|
698
|
-
return v - 1;
|
|
699
|
-
} else {
|
|
700
|
-
return r;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
145
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
146
|
+
var $7910c263a77ba3c7$exports = {};
|
|
147
|
+
$7910c263a77ba3c7$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"蓝色\",\"brightness\":\"亮度\",\"green\":\"绿色\",\"hue\":\"色相\",\"lightness\":\"明亮度\",\"red\":\"红色\",\"saturation\":\"饱和度\"}");
|
|
707
148
|
|
|
708
|
-
function $a54bad0097d5f20f12ac194ac13764$var$radToDeg(rad) {
|
|
709
|
-
return rad * 180 / Math.PI;
|
|
710
|
-
} // 0deg = 3 o'clock. increases clockwise
|
|
711
149
|
|
|
150
|
+
var $e2007de7934364b7$exports = {};
|
|
151
|
+
$e2007de7934364b7$exports = JSON.parse("{\"alpha\":\"Alpha\",\"blue\":\"藍色\",\"brightness\":\"亮度\",\"green\":\"綠色\",\"hue\":\"色相\",\"lightness\":\"明亮\",\"red\":\"紅色\",\"saturation\":\"飽和度\"}");
|
|
712
152
|
|
|
713
|
-
function $a54bad0097d5f20f12ac194ac13764$var$angleToCartesian(angle, radius) {
|
|
714
|
-
let rad = $a54bad0097d5f20f12ac194ac13764$var$degToRad(360 - angle + 90);
|
|
715
|
-
let x = Math.sin(rad) * radius;
|
|
716
|
-
let y = Math.cos(rad) * radius;
|
|
717
|
-
return {
|
|
718
|
-
x,
|
|
719
|
-
y
|
|
720
|
-
};
|
|
721
|
-
}
|
|
722
153
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
if (hue !== v) {
|
|
760
|
-
setValue(value.withChannelValue('hue', v));
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
return {
|
|
765
|
-
value,
|
|
766
|
-
|
|
767
|
-
setValue(v) {
|
|
768
|
-
let color = $a54bad0097d5f20f12ac194ac13764$var$normalizeColor(v);
|
|
769
|
-
valueRef.current = color;
|
|
770
|
-
setValue(color);
|
|
771
|
-
},
|
|
772
|
-
|
|
773
|
-
hue,
|
|
774
|
-
setHue,
|
|
775
|
-
|
|
776
|
-
setHueFromPoint(x, y, radius) {
|
|
777
|
-
setHue($a54bad0097d5f20f12ac194ac13764$var$cartesianToAngle(x, y, radius));
|
|
778
|
-
},
|
|
779
|
-
|
|
780
|
-
getThumbPosition(radius) {
|
|
781
|
-
return $a54bad0097d5f20f12ac194ac13764$var$angleToCartesian(value.getChannelValue('hue'), radius);
|
|
782
|
-
},
|
|
783
|
-
|
|
784
|
-
increment(minStepSize) {
|
|
785
|
-
if (minStepSize === void 0) {
|
|
786
|
-
minStepSize = 0;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
let newValue = hue + Math.max(minStepSize, step);
|
|
790
|
-
|
|
791
|
-
if (newValue > 360) {
|
|
792
|
-
// Make sure you can always get back to 0.
|
|
793
|
-
newValue = 0;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
setHue(newValue);
|
|
797
|
-
},
|
|
798
|
-
|
|
799
|
-
decrement(minStepSize) {
|
|
800
|
-
if (minStepSize === void 0) {
|
|
801
|
-
minStepSize = 0;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
let s = Math.max(minStepSize, step);
|
|
805
|
-
|
|
806
|
-
if (hue === 0) {
|
|
807
|
-
// We can't just subtract step because this might be the case:
|
|
808
|
-
// |(previous step) - 0| < step size
|
|
809
|
-
setHue($a54bad0097d5f20f12ac194ac13764$var$roundDown(360 / s) * s);
|
|
810
|
-
} else {
|
|
811
|
-
setHue(hue - s);
|
|
812
|
-
}
|
|
813
|
-
},
|
|
814
|
-
|
|
815
|
-
setDragging(isDragging) {
|
|
816
|
-
setDragging(wasDragging => {
|
|
817
|
-
if (onChangeEnd && !isDragging && wasDragging) {
|
|
818
|
-
onChangeEnd(valueRef.current);
|
|
819
|
-
}
|
|
154
|
+
$675273e4af08d62e$exports = {
|
|
155
|
+
"ar-AE": $077bd0bceac79457$exports,
|
|
156
|
+
"bg-BG": $cddd4812af0cd440$exports,
|
|
157
|
+
"cs-CZ": $183858b76275efe7$exports,
|
|
158
|
+
"da-DK": $020bfa8dadaf30b2$exports,
|
|
159
|
+
"de-DE": $9d6c5c82d9282c0f$exports,
|
|
160
|
+
"el-GR": $854ad75b322fe89a$exports,
|
|
161
|
+
"en-US": $be9ad9682b370ddc$exports,
|
|
162
|
+
"es-ES": $05a0b4f28c8ee761$exports,
|
|
163
|
+
"et-EE": $5d177f7c41df0d7c$exports,
|
|
164
|
+
"fi-FI": $c0c8e1b6dbe88b42$exports,
|
|
165
|
+
"fr-FR": $f78038f3c5ac85bf$exports,
|
|
166
|
+
"he-IL": $99f849eae7055e0d$exports,
|
|
167
|
+
"hr-HR": $d0b14a225bb73c77$exports,
|
|
168
|
+
"hu-HU": $b47e94169ab16ffb$exports,
|
|
169
|
+
"it-IT": $3ca86f7c5a542fc2$exports,
|
|
170
|
+
"ja-JP": $9c9adbefd088dfec$exports,
|
|
171
|
+
"ko-KR": $e0a855e991915bcf$exports,
|
|
172
|
+
"lt-LT": $b2bbcc4a6d0f4ff0$exports,
|
|
173
|
+
"lv-LV": $d1a2e38b31bf8b62$exports,
|
|
174
|
+
"nb-NO": $08e30a9af5d53702$exports,
|
|
175
|
+
"nl-NL": $659611dede656c7e$exports,
|
|
176
|
+
"pl-PL": $0f93c75b665df87b$exports,
|
|
177
|
+
"pt-BR": $c00ea759839bb843$exports,
|
|
178
|
+
"pt-PT": $821dfa0d9faae4f9$exports,
|
|
179
|
+
"ro-RO": $fdb474da024beb51$exports,
|
|
180
|
+
"ru-RU": $f51a8c7858d3993f$exports,
|
|
181
|
+
"sk-SK": $a69372503f9b6f3a$exports,
|
|
182
|
+
"sl-SI": $820c47d01f6be0f0$exports,
|
|
183
|
+
"sr-SP": $1948f454f1b262d8$exports,
|
|
184
|
+
"sv-SE": $af6617ce4e290100$exports,
|
|
185
|
+
"tr-TR": $e04fd2d342e58988$exports,
|
|
186
|
+
"uk-UA": $b969554fc221bec5$exports,
|
|
187
|
+
"zh-CN": $7910c263a77ba3c7$exports,
|
|
188
|
+
"zh-TW": $e2007de7934364b7$exports
|
|
189
|
+
};
|
|
820
190
|
|
|
821
|
-
return isDragging;
|
|
822
|
-
});
|
|
823
|
-
},
|
|
824
191
|
|
|
825
|
-
isDragging,
|
|
826
192
|
|
|
827
|
-
getDisplayColor() {
|
|
828
|
-
return value.withChannelValue('saturation', 100).withChannelValue('lightness', 50);
|
|
829
|
-
}
|
|
830
193
|
|
|
831
|
-
|
|
194
|
+
const $19b55adb42b5e1b3$var$messages = new $6YREh$MessageDictionary((/*@__PURE__*/$parcel$interopDefault($675273e4af08d62e$exports)));
|
|
195
|
+
function $19b55adb42b5e1b3$export$6e865ea70d7724f(value) {
|
|
196
|
+
let res = $19b55adb42b5e1b3$var$RGBColor.parse(value) || $19b55adb42b5e1b3$var$HSBColor.parse(value) || $19b55adb42b5e1b3$var$HSLColor.parse(value);
|
|
197
|
+
if (res) return res;
|
|
198
|
+
throw new Error('Invalid color value: ' + value);
|
|
832
199
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
200
|
+
class $19b55adb42b5e1b3$var$Color {
|
|
201
|
+
toHexInt() {
|
|
202
|
+
return this.toFormat('rgb').toHexInt();
|
|
203
|
+
}
|
|
204
|
+
getChannelValue(channel) {
|
|
205
|
+
if (channel in this) return this[channel];
|
|
206
|
+
throw new Error('Unsupported color channel: ' + channel);
|
|
207
|
+
}
|
|
208
|
+
withChannelValue(channel, value) {
|
|
209
|
+
if (channel in this) {
|
|
210
|
+
let x = this.clone();
|
|
211
|
+
x[channel] = value;
|
|
212
|
+
return x;
|
|
213
|
+
}
|
|
214
|
+
throw new Error('Unsupported color channel: ' + channel);
|
|
215
|
+
}
|
|
216
|
+
getChannelName(channel, locale) {
|
|
217
|
+
return $19b55adb42b5e1b3$var$messages.getStringForLocale(channel, locale);
|
|
842
218
|
}
|
|
843
|
-
|
|
844
|
-
return value;
|
|
845
|
-
}, [value]);
|
|
846
219
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
return resolved;
|
|
220
|
+
const $19b55adb42b5e1b3$var$HEX_REGEX = /^#(?:([0-9a-f]{3})|([0-9a-f]{6}))$/i;
|
|
221
|
+
// X = <negative/positive number with/without decimal places>
|
|
222
|
+
// before/after a comma, 0 or more whitespaces are allowed
|
|
223
|
+
// - rgb(X, X, X)
|
|
224
|
+
// - rgba(X, X, X, X)
|
|
225
|
+
const $19b55adb42b5e1b3$var$RGB_REGEX = /rgb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?)\)|rgba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d(.\d+)?)\)/;
|
|
226
|
+
class $19b55adb42b5e1b3$var$RGBColor extends $19b55adb42b5e1b3$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
|
+
static parse(value) {
|
|
235
|
+
let m;
|
|
236
|
+
if (m = value.match($19b55adb42b5e1b3$var$HEX_REGEX)) {
|
|
237
|
+
if (m[1]) {
|
|
238
|
+
let r = parseInt(m[1][0] + m[1][0], 16);
|
|
239
|
+
let g = parseInt(m[1][1] + m[1][1], 16);
|
|
240
|
+
let b = parseInt(m[1][2] + m[1][2], 16);
|
|
241
|
+
return new $19b55adb42b5e1b3$var$RGBColor(r, g, b, 1);
|
|
242
|
+
} else if (m[2]) {
|
|
243
|
+
let r = parseInt(m[2][0] + m[2][1], 16);
|
|
244
|
+
let g = parseInt(m[2][2] + m[2][3], 16);
|
|
245
|
+
let b = parseInt(m[2][4] + m[2][5], 16);
|
|
246
|
+
return new $19b55adb42b5e1b3$var$RGBColor(r, g, b, 1);
|
|
247
|
+
}
|
|
876
248
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
249
|
+
if (m = value.match($19b55adb42b5e1b3$var$RGB_REGEX)) {
|
|
250
|
+
const [r, g, b, a] = (m[1] ?? m[2]).split(',').map((n)=>Number(n.trim())
|
|
251
|
+
);
|
|
252
|
+
return new $19b55adb42b5e1b3$var$RGBColor($6YREh$clamp(r, 0, 255), $6YREh$clamp(g, 0, 255), $6YREh$clamp(b, 0, 255), $6YREh$clamp(a ?? 1, 0, 1));
|
|
880
253
|
}
|
|
881
|
-
|
|
882
|
-
return prev;
|
|
883
|
-
});
|
|
884
|
-
return;
|
|
885
254
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
255
|
+
toString(format) {
|
|
256
|
+
switch(format){
|
|
257
|
+
case 'hex':
|
|
258
|
+
return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
|
|
259
|
+
case 'hexa':
|
|
260
|
+
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();
|
|
261
|
+
case 'rgb':
|
|
262
|
+
return `rgb(${this.red}, ${this.green}, ${this.blue})`;
|
|
263
|
+
case 'css':
|
|
264
|
+
case 'rgba':
|
|
265
|
+
return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
|
|
266
|
+
default:
|
|
267
|
+
return this.toFormat(format).toString(format);
|
|
268
|
+
}
|
|
890
269
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
270
|
+
toFormat(format) {
|
|
271
|
+
switch(format){
|
|
272
|
+
case 'hex':
|
|
273
|
+
case 'hexa':
|
|
274
|
+
case 'rgb':
|
|
275
|
+
case 'rgba':
|
|
276
|
+
return this;
|
|
277
|
+
case 'hsb':
|
|
278
|
+
case 'hsba':
|
|
279
|
+
return this.toHSB();
|
|
280
|
+
case 'hsl':
|
|
281
|
+
case 'hsla':
|
|
282
|
+
return this.toHSL();
|
|
283
|
+
default:
|
|
284
|
+
throw new Error('Unsupported color conversion: rgb -> ' + format);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
toHexInt() {
|
|
288
|
+
return this.red << 16 | this.green << 8 | this.blue;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Converts an RGB color value to HSB.
|
|
292
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
|
|
293
|
+
* @returns An HSBColor object.
|
|
294
|
+
*/ toHSB() {
|
|
295
|
+
const red = this.red / 255;
|
|
296
|
+
const green = this.green / 255;
|
|
297
|
+
const blue = this.blue / 255;
|
|
298
|
+
const min = Math.min(red, green, blue);
|
|
299
|
+
const brightness = Math.max(red, green, blue);
|
|
300
|
+
const chroma = brightness - min;
|
|
301
|
+
const saturation = brightness === 0 ? 0 : chroma / brightness;
|
|
302
|
+
let hue = 0; // achromatic
|
|
303
|
+
if (chroma !== 0) {
|
|
304
|
+
switch(brightness){
|
|
305
|
+
case red:
|
|
306
|
+
hue = (green - blue) / chroma + (green < blue ? 6 : 0);
|
|
307
|
+
break;
|
|
308
|
+
case green:
|
|
309
|
+
hue = (blue - red) / chroma + 2;
|
|
310
|
+
break;
|
|
311
|
+
case blue:
|
|
312
|
+
hue = (red - green) / chroma + 4;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
hue /= 6;
|
|
316
|
+
}
|
|
317
|
+
return new $19b55adb42b5e1b3$var$HSBColor($6YREh$toFixedNumber(hue * 360, 2), $6YREh$toFixedNumber(saturation * 100, 2), $6YREh$toFixedNumber(brightness * 100, 2), this.alpha);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Converts an RGB color value to HSL.
|
|
321
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
|
|
322
|
+
* @returns An HSLColor object.
|
|
323
|
+
*/ toHSL() {
|
|
324
|
+
const red = this.red / 255;
|
|
325
|
+
const green = this.green / 255;
|
|
326
|
+
const blue = this.blue / 255;
|
|
327
|
+
const min = Math.min(red, green, blue);
|
|
328
|
+
const max = Math.max(red, green, blue);
|
|
329
|
+
const lightness = (max + min) / 2;
|
|
330
|
+
const chroma = max - min;
|
|
331
|
+
let hue;
|
|
332
|
+
let saturation;
|
|
333
|
+
if (chroma === 0) hue = saturation = 0; // achromatic
|
|
334
|
+
else {
|
|
335
|
+
saturation = chroma / (lightness < 0.5 ? max + min : 2 - max - min);
|
|
336
|
+
switch(max){
|
|
337
|
+
case red:
|
|
338
|
+
hue = (green - blue) / chroma + (green < blue ? 6 : 0);
|
|
339
|
+
break;
|
|
340
|
+
case green:
|
|
341
|
+
hue = (blue - red) / chroma + 2;
|
|
342
|
+
break;
|
|
343
|
+
case blue:
|
|
344
|
+
hue = (red - green) / chroma + 4;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
hue /= 6;
|
|
348
|
+
}
|
|
349
|
+
return new $19b55adb42b5e1b3$var$HSLColor($6YREh$toFixedNumber(hue * 360, 2), $6YREh$toFixedNumber(saturation * 100, 2), $6YREh$toFixedNumber(lightness * 100, 2), this.alpha);
|
|
350
|
+
}
|
|
351
|
+
clone() {
|
|
352
|
+
return new $19b55adb42b5e1b3$var$RGBColor(this.red, this.green, this.blue, this.alpha);
|
|
353
|
+
}
|
|
354
|
+
getChannelRange(channel) {
|
|
355
|
+
switch(channel){
|
|
356
|
+
case 'red':
|
|
357
|
+
case 'green':
|
|
358
|
+
case 'blue':
|
|
359
|
+
return {
|
|
360
|
+
minValue: 0,
|
|
361
|
+
maxValue: 255,
|
|
362
|
+
step: 1
|
|
363
|
+
};
|
|
364
|
+
case 'alpha':
|
|
365
|
+
return {
|
|
366
|
+
minValue: 0,
|
|
367
|
+
maxValue: 1,
|
|
368
|
+
step: 0.01
|
|
369
|
+
};
|
|
370
|
+
default:
|
|
371
|
+
throw new Error('Unknown color channel: ' + channel);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
formatChannelValue(channel, locale) {
|
|
375
|
+
let options;
|
|
376
|
+
let value = this.getChannelValue(channel);
|
|
377
|
+
switch(channel){
|
|
378
|
+
case 'red':
|
|
379
|
+
case 'green':
|
|
380
|
+
case 'blue':
|
|
381
|
+
options = {
|
|
382
|
+
style: 'decimal'
|
|
383
|
+
};
|
|
384
|
+
break;
|
|
385
|
+
case 'alpha':
|
|
386
|
+
options = {
|
|
387
|
+
style: 'percent'
|
|
388
|
+
};
|
|
389
|
+
break;
|
|
390
|
+
default:
|
|
391
|
+
throw new Error('Unknown color channel: ' + channel);
|
|
392
|
+
}
|
|
393
|
+
return new $6YREh$NumberFormatter(locale, options).format(value);
|
|
394
|
+
}
|
|
395
|
+
getColorSpace() {
|
|
396
|
+
return 'rgb';
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
// X = <negative/positive number with/without decimal places>
|
|
400
|
+
// before/after a comma, 0 or more whitespaces are allowed
|
|
401
|
+
// - hsb(X, X%, X%)
|
|
402
|
+
// - hsba(X, X%, X%, X)
|
|
403
|
+
const $19b55adb42b5e1b3$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+)?)\)/;
|
|
404
|
+
class $19b55adb42b5e1b3$var$HSBColor extends $19b55adb42b5e1b3$var$Color {
|
|
405
|
+
constructor(hue, saturation, brightness, alpha){
|
|
406
|
+
super();
|
|
407
|
+
this.hue = hue;
|
|
408
|
+
this.saturation = saturation;
|
|
409
|
+
this.brightness = brightness;
|
|
410
|
+
this.alpha = alpha;
|
|
411
|
+
}
|
|
412
|
+
static parse(value) {
|
|
413
|
+
let m;
|
|
414
|
+
if (m = value.match($19b55adb42b5e1b3$var$HSB_REGEX)) {
|
|
415
|
+
const [h, s, b, a] = (m[1] ?? m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
|
|
416
|
+
);
|
|
417
|
+
return new $19b55adb42b5e1b3$var$HSBColor($19b55adb42b5e1b3$var$mod(h, 360), $6YREh$clamp(s, 0, 100), $6YREh$clamp(b, 0, 100), $6YREh$clamp(a ?? 1, 0, 1));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
toString(format) {
|
|
421
|
+
switch(format){
|
|
422
|
+
case 'css':
|
|
423
|
+
return this.toHSL().toString('css');
|
|
424
|
+
case 'hex':
|
|
425
|
+
return this.toRGB().toString('hex');
|
|
426
|
+
case 'hexa':
|
|
427
|
+
return this.toRGB().toString('hexa');
|
|
428
|
+
case 'hsb':
|
|
429
|
+
return `hsb(${this.hue}, ${$6YREh$toFixedNumber(this.saturation, 2)}%, ${$6YREh$toFixedNumber(this.brightness, 2)}%)`;
|
|
430
|
+
case 'hsba':
|
|
431
|
+
return `hsba(${this.hue}, ${$6YREh$toFixedNumber(this.saturation, 2)}%, ${$6YREh$toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;
|
|
432
|
+
default:
|
|
433
|
+
return this.toFormat(format).toString(format);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
toFormat(format) {
|
|
437
|
+
switch(format){
|
|
438
|
+
case 'hsb':
|
|
439
|
+
case 'hsba':
|
|
440
|
+
return this;
|
|
441
|
+
case 'hsl':
|
|
442
|
+
case 'hsla':
|
|
443
|
+
return this.toHSL();
|
|
444
|
+
case 'rgb':
|
|
445
|
+
case 'rgba':
|
|
446
|
+
return this.toRGB();
|
|
447
|
+
default:
|
|
448
|
+
throw new Error('Unsupported color conversion: hsb -> ' + format);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Converts a HSB color to HSL.
|
|
453
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
|
|
454
|
+
* @returns An HSLColor object.
|
|
455
|
+
*/ toHSL() {
|
|
456
|
+
let saturation = this.saturation / 100;
|
|
457
|
+
let brightness = this.brightness / 100;
|
|
458
|
+
let lightness = brightness * (1 - saturation / 2);
|
|
459
|
+
saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
|
|
460
|
+
return new $19b55adb42b5e1b3$var$HSLColor($6YREh$toFixedNumber(this.hue, 2), $6YREh$toFixedNumber(saturation * 100, 2), $6YREh$toFixedNumber(lightness * 100, 2), this.alpha);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Converts a HSV color value to RGB.
|
|
464
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
|
|
465
|
+
* @returns An RGBColor object.
|
|
466
|
+
*/ toRGB() {
|
|
467
|
+
let hue = this.hue;
|
|
468
|
+
let saturation = this.saturation / 100;
|
|
469
|
+
let brightness = this.brightness / 100;
|
|
470
|
+
let fn = (n, k = (n + hue / 60) % 6)=>brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0)
|
|
471
|
+
;
|
|
472
|
+
return new $19b55adb42b5e1b3$var$RGBColor(Math.round(fn(5) * 255), Math.round(fn(3) * 255), Math.round(fn(1) * 255), this.alpha);
|
|
473
|
+
}
|
|
474
|
+
clone() {
|
|
475
|
+
return new $19b55adb42b5e1b3$var$HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
|
|
476
|
+
}
|
|
477
|
+
getChannelRange(channel) {
|
|
478
|
+
switch(channel){
|
|
479
|
+
case 'hue':
|
|
480
|
+
return {
|
|
481
|
+
minValue: 0,
|
|
482
|
+
maxValue: 360,
|
|
483
|
+
step: 1
|
|
484
|
+
};
|
|
485
|
+
case 'saturation':
|
|
486
|
+
case 'brightness':
|
|
487
|
+
return {
|
|
488
|
+
minValue: 0,
|
|
489
|
+
maxValue: 100,
|
|
490
|
+
step: 1
|
|
491
|
+
};
|
|
492
|
+
case 'alpha':
|
|
493
|
+
return {
|
|
494
|
+
minValue: 0,
|
|
495
|
+
maxValue: 1,
|
|
496
|
+
step: 0.01
|
|
497
|
+
};
|
|
498
|
+
default:
|
|
499
|
+
throw new Error('Unknown color channel: ' + channel);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
formatChannelValue(channel, locale) {
|
|
503
|
+
let options;
|
|
504
|
+
let value = this.getChannelValue(channel);
|
|
505
|
+
switch(channel){
|
|
506
|
+
case 'hue':
|
|
507
|
+
options = {
|
|
508
|
+
style: 'unit',
|
|
509
|
+
unit: 'degree',
|
|
510
|
+
unitDisplay: 'narrow'
|
|
511
|
+
};
|
|
512
|
+
break;
|
|
513
|
+
case 'saturation':
|
|
514
|
+
case 'brightness':
|
|
515
|
+
options = {
|
|
516
|
+
style: 'percent'
|
|
517
|
+
};
|
|
518
|
+
value /= 100;
|
|
519
|
+
break;
|
|
520
|
+
case 'alpha':
|
|
521
|
+
options = {
|
|
522
|
+
style: 'percent'
|
|
523
|
+
};
|
|
524
|
+
break;
|
|
525
|
+
default:
|
|
526
|
+
throw new Error('Unknown color channel: ' + channel);
|
|
527
|
+
}
|
|
528
|
+
return new $6YREh$NumberFormatter(locale, options).format(value);
|
|
529
|
+
}
|
|
530
|
+
getColorSpace() {
|
|
531
|
+
return 'hsb';
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
// X = <negative/positive number with/without decimal places>
|
|
535
|
+
// before/after a comma, 0 or more whitespaces are allowed
|
|
536
|
+
// - hsl(X, X%, X%)
|
|
537
|
+
// - hsla(X, X%, X%, X)
|
|
538
|
+
const $19b55adb42b5e1b3$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+)?)\)/;
|
|
539
|
+
function $19b55adb42b5e1b3$var$mod(n, m) {
|
|
540
|
+
return (n % m + m) % m;
|
|
541
|
+
}
|
|
542
|
+
class $19b55adb42b5e1b3$var$HSLColor extends $19b55adb42b5e1b3$var$Color {
|
|
543
|
+
constructor(hue, saturation, lightness, alpha){
|
|
544
|
+
super();
|
|
545
|
+
this.hue = hue;
|
|
546
|
+
this.saturation = saturation;
|
|
547
|
+
this.lightness = lightness;
|
|
548
|
+
this.alpha = alpha;
|
|
549
|
+
}
|
|
550
|
+
static parse(value) {
|
|
551
|
+
let m;
|
|
552
|
+
if (m = value.match($19b55adb42b5e1b3$var$HSL_REGEX)) {
|
|
553
|
+
const [h, s, l, a] = (m[1] ?? m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
|
|
554
|
+
);
|
|
555
|
+
return new $19b55adb42b5e1b3$var$HSLColor($19b55adb42b5e1b3$var$mod(h, 360), $6YREh$clamp(s, 0, 100), $6YREh$clamp(l, 0, 100), $6YREh$clamp(a ?? 1, 0, 1));
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
toString(format) {
|
|
559
|
+
switch(format){
|
|
560
|
+
case 'hex':
|
|
561
|
+
return this.toRGB().toString('hex');
|
|
562
|
+
case 'hexa':
|
|
563
|
+
return this.toRGB().toString('hexa');
|
|
564
|
+
case 'hsl':
|
|
565
|
+
return `hsl(${this.hue}, ${$6YREh$toFixedNumber(this.saturation, 2)}%, ${$6YREh$toFixedNumber(this.lightness, 2)}%)`;
|
|
566
|
+
case 'css':
|
|
567
|
+
case 'hsla':
|
|
568
|
+
return `hsla(${this.hue}, ${$6YREh$toFixedNumber(this.saturation, 2)}%, ${$6YREh$toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
|
|
569
|
+
default:
|
|
570
|
+
return this.toFormat(format).toString(format);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
toFormat(format) {
|
|
574
|
+
switch(format){
|
|
575
|
+
case 'hsl':
|
|
576
|
+
case 'hsla':
|
|
577
|
+
return this;
|
|
578
|
+
case 'hsb':
|
|
579
|
+
case 'hsba':
|
|
580
|
+
return this.toHSB();
|
|
581
|
+
case 'rgb':
|
|
582
|
+
case 'rgba':
|
|
583
|
+
return this.toRGB();
|
|
584
|
+
default:
|
|
585
|
+
throw new Error('Unsupported color conversion: hsl -> ' + format);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Converts a HSL color to HSB.
|
|
590
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.
|
|
591
|
+
* @returns An HSBColor object.
|
|
592
|
+
*/ toHSB() {
|
|
593
|
+
let saturation = this.saturation / 100;
|
|
594
|
+
let lightness = this.lightness / 100;
|
|
595
|
+
let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
|
|
596
|
+
saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
|
|
597
|
+
return new $19b55adb42b5e1b3$var$HSBColor($6YREh$toFixedNumber(this.hue, 2), $6YREh$toFixedNumber(saturation * 100, 2), $6YREh$toFixedNumber(brightness * 100, 2), this.alpha);
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Converts a HSL color to RGB.
|
|
601
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.
|
|
602
|
+
* @returns An RGBColor object.
|
|
603
|
+
*/ toRGB() {
|
|
604
|
+
let hue = this.hue;
|
|
605
|
+
let saturation = this.saturation / 100;
|
|
606
|
+
let lightness = this.lightness / 100;
|
|
607
|
+
let a = saturation * Math.min(lightness, 1 - lightness);
|
|
608
|
+
let fn = (n, k = (n + hue / 30) % 12)=>lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
|
|
609
|
+
;
|
|
610
|
+
return new $19b55adb42b5e1b3$var$RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), this.alpha);
|
|
611
|
+
}
|
|
612
|
+
clone() {
|
|
613
|
+
return new $19b55adb42b5e1b3$var$HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
|
|
614
|
+
}
|
|
615
|
+
getChannelRange(channel) {
|
|
616
|
+
switch(channel){
|
|
617
|
+
case 'hue':
|
|
618
|
+
return {
|
|
619
|
+
minValue: 0,
|
|
620
|
+
maxValue: 360,
|
|
621
|
+
step: 1
|
|
622
|
+
};
|
|
623
|
+
case 'saturation':
|
|
624
|
+
case 'lightness':
|
|
625
|
+
return {
|
|
626
|
+
minValue: 0,
|
|
627
|
+
maxValue: 100,
|
|
628
|
+
step: 1
|
|
629
|
+
};
|
|
630
|
+
case 'alpha':
|
|
631
|
+
return {
|
|
632
|
+
minValue: 0,
|
|
633
|
+
maxValue: 1,
|
|
634
|
+
step: 0.01
|
|
635
|
+
};
|
|
636
|
+
default:
|
|
637
|
+
throw new Error('Unknown color channel: ' + channel);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
formatChannelValue(channel, locale) {
|
|
641
|
+
let options;
|
|
642
|
+
let value = this.getChannelValue(channel);
|
|
643
|
+
switch(channel){
|
|
644
|
+
case 'hue':
|
|
645
|
+
options = {
|
|
646
|
+
style: 'unit',
|
|
647
|
+
unit: 'degree',
|
|
648
|
+
unitDisplay: 'narrow'
|
|
649
|
+
};
|
|
650
|
+
break;
|
|
651
|
+
case 'saturation':
|
|
652
|
+
case 'lightness':
|
|
653
|
+
options = {
|
|
654
|
+
style: 'percent'
|
|
655
|
+
};
|
|
656
|
+
value /= 100;
|
|
657
|
+
break;
|
|
658
|
+
case 'alpha':
|
|
659
|
+
options = {
|
|
660
|
+
style: 'percent'
|
|
661
|
+
};
|
|
662
|
+
break;
|
|
663
|
+
default:
|
|
664
|
+
throw new Error('Unknown color channel: ' + channel);
|
|
665
|
+
}
|
|
666
|
+
return new $6YREh$NumberFormatter(locale, options).format(value);
|
|
667
|
+
}
|
|
668
|
+
getColorSpace() {
|
|
669
|
+
return 'hsl';
|
|
895
670
|
}
|
|
896
|
-
|
|
671
|
+
}
|
|
897
672
|
|
|
898
|
-
useEffect(() => {
|
|
899
|
-
setInputValue(colorValue ? colorValue.toString('hex') : '');
|
|
900
|
-
}, [colorValue, setInputValue]);
|
|
901
|
-
let parsedValue = useMemo(() => {
|
|
902
|
-
let color;
|
|
903
673
|
|
|
904
|
-
|
|
905
|
-
color = parseColor(inputValue.startsWith('#') ? inputValue : "#" + inputValue);
|
|
906
|
-
} catch (err) {
|
|
907
|
-
color = null;
|
|
908
|
-
}
|
|
674
|
+
var $86a06515e79ac54d$exports = {};
|
|
909
675
|
|
|
910
|
-
|
|
911
|
-
}, [parseColor, inputValue]);
|
|
912
|
-
let parsed = useRef(null);
|
|
913
|
-
parsed.current = parsedValue;
|
|
676
|
+
$parcel$export($86a06515e79ac54d$exports, "useColorSliderState", () => $86a06515e79ac54d$export$57bc203e1c9c6d44);
|
|
914
677
|
|
|
915
|
-
let commit = () => {
|
|
916
|
-
// Set to empty state if input value is empty
|
|
917
|
-
if (!inputValue.length) {
|
|
918
|
-
safelySetColorValue(null);
|
|
919
|
-
setInputValue(value === undefined ? '' : colorValue.toString('hex'));
|
|
920
|
-
return;
|
|
921
|
-
} // if it failed to parse, then reset input to formatted version of current number
|
|
922
678
|
|
|
923
679
|
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
680
|
+
function $86a06515e79ac54d$var$normalizeColor(v) {
|
|
681
|
+
if (typeof v === 'string') return $19b55adb42b5e1b3$export$6e865ea70d7724f(v);
|
|
682
|
+
else return v;
|
|
683
|
+
}
|
|
684
|
+
function $86a06515e79ac54d$export$57bc203e1c9c6d44(props) {
|
|
685
|
+
let { channel: channel , value: value1 , defaultValue: defaultValue , onChange: onChange , locale: locale , ...otherProps } = props;
|
|
686
|
+
if (value1 == null && defaultValue == null) throw new Error('useColorSliderState requires a value or defaultValue');
|
|
687
|
+
let [color, setColor] = $6YREh$useControlledState(value1 && $86a06515e79ac54d$var$normalizeColor(value1), defaultValue && $86a06515e79ac54d$var$normalizeColor(defaultValue), onChange);
|
|
688
|
+
let sliderState = $6YREh$useSliderState({
|
|
689
|
+
...color.getChannelRange(channel),
|
|
690
|
+
...otherProps,
|
|
691
|
+
// Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
|
|
692
|
+
numberFormatter: null,
|
|
693
|
+
value: [
|
|
694
|
+
color.getChannelValue(channel)
|
|
695
|
+
],
|
|
696
|
+
onChange ([v]) {
|
|
697
|
+
setColor(color.withChannelValue(channel, v));
|
|
698
|
+
},
|
|
699
|
+
onChangeEnd ([v]) {
|
|
700
|
+
// onChange will have already been called with the right value, this is just to trigger onChangEnd
|
|
701
|
+
if (props.onChangeEnd) props.onChangeEnd(color.withChannelValue(channel, v));
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
return {
|
|
705
|
+
...sliderState,
|
|
706
|
+
value: color,
|
|
707
|
+
setValue (value) {
|
|
708
|
+
setColor($86a06515e79ac54d$var$normalizeColor(value));
|
|
709
|
+
},
|
|
710
|
+
getDisplayColor () {
|
|
711
|
+
switch(channel){
|
|
712
|
+
case 'hue':
|
|
713
|
+
return $19b55adb42b5e1b3$export$6e865ea70d7724f(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
|
|
714
|
+
case 'lightness':
|
|
715
|
+
case 'brightness':
|
|
716
|
+
case 'saturation':
|
|
717
|
+
case 'red':
|
|
718
|
+
case 'green':
|
|
719
|
+
case 'blue':
|
|
720
|
+
return color.withChannelValue('alpha', 1);
|
|
721
|
+
case 'alpha':
|
|
722
|
+
return color;
|
|
723
|
+
default:
|
|
724
|
+
throw new Error('Unknown color channel: ' + channel);
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
getThumbValueLabel () {
|
|
728
|
+
return color.formatChannelValue(channel, locale);
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
}
|
|
928
732
|
|
|
929
|
-
safelySetColorValue(parsed.current); // in a controlled state, the numberValue won't change, so we won't go back to our old input without help
|
|
930
733
|
|
|
931
|
-
|
|
734
|
+
var $b42abd16499dffa8$exports = {};
|
|
932
735
|
|
|
933
|
-
|
|
934
|
-
newColorValue = colorValue.toString('hex');
|
|
935
|
-
}
|
|
736
|
+
$parcel$export($b42abd16499dffa8$exports, "useColorWheelState", () => $b42abd16499dffa8$export$f4301076d9336137);
|
|
936
737
|
|
|
937
|
-
setInputValue(newColorValue);
|
|
938
|
-
};
|
|
939
738
|
|
|
940
|
-
let increment = () => {
|
|
941
|
-
safelySetColorValue(prevColor => {
|
|
942
|
-
let newValue = $f1bad1ec575cba40fc263dc06b9eb3a9$var$addColorValue(parsed.current, step); // if we've arrived at the same value that was previously in the state, the
|
|
943
|
-
// input value should be updated to match
|
|
944
|
-
// ex type 4, press increment, highlight the number in the input, type 4 again, press increment
|
|
945
|
-
// you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
|
|
946
739
|
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
740
|
+
function $b42abd16499dffa8$var$normalizeColor(v) {
|
|
741
|
+
if (typeof v === 'string') return $19b55adb42b5e1b3$export$6e865ea70d7724f(v);
|
|
742
|
+
else return v;
|
|
743
|
+
}
|
|
744
|
+
const $b42abd16499dffa8$var$DEFAULT_COLOR = $19b55adb42b5e1b3$export$6e865ea70d7724f('hsl(0, 100%, 50%)');
|
|
745
|
+
function $b42abd16499dffa8$var$roundToStep(value, step) {
|
|
746
|
+
return Math.round(value / step) * step;
|
|
747
|
+
}
|
|
748
|
+
function $b42abd16499dffa8$var$mod(n, m) {
|
|
749
|
+
return (n % m + m) % m;
|
|
750
|
+
}
|
|
751
|
+
function $b42abd16499dffa8$var$roundDown(v) {
|
|
752
|
+
let r = Math.floor(v);
|
|
753
|
+
if (r === v) return v - 1;
|
|
754
|
+
else return r;
|
|
755
|
+
}
|
|
756
|
+
function $b42abd16499dffa8$var$degToRad(deg) {
|
|
757
|
+
return deg * Math.PI / 180;
|
|
758
|
+
}
|
|
759
|
+
function $b42abd16499dffa8$var$radToDeg(rad) {
|
|
760
|
+
return rad * 180 / Math.PI;
|
|
761
|
+
}
|
|
762
|
+
// 0deg = 3 o'clock. increases clockwise
|
|
763
|
+
function $b42abd16499dffa8$var$angleToCartesian(angle, radius) {
|
|
764
|
+
let rad = $b42abd16499dffa8$var$degToRad(360 - angle + 90);
|
|
765
|
+
let x = Math.sin(rad) * radius;
|
|
766
|
+
let y = Math.cos(rad) * radius;
|
|
767
|
+
return {
|
|
768
|
+
x: x,
|
|
769
|
+
y: y
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
function $b42abd16499dffa8$var$cartesianToAngle(x, y, radius) {
|
|
773
|
+
let deg = $b42abd16499dffa8$var$radToDeg(Math.atan2(y / radius, x / radius));
|
|
774
|
+
return (deg + 360) % 360;
|
|
775
|
+
}
|
|
776
|
+
function $b42abd16499dffa8$export$f4301076d9336137(props) {
|
|
777
|
+
let { defaultValue: defaultValue , onChange: onChange , onChangeEnd: onChangeEnd , step: step = 1 } = props;
|
|
778
|
+
if (!props.value && !defaultValue) defaultValue = $b42abd16499dffa8$var$DEFAULT_COLOR;
|
|
779
|
+
let [value, setValue] = $6YREh$useControlledState($b42abd16499dffa8$var$normalizeColor(props.value), $b42abd16499dffa8$var$normalizeColor(defaultValue), onChange);
|
|
780
|
+
let valueRef = $6YREh$useRef(value);
|
|
781
|
+
valueRef.current = value;
|
|
782
|
+
let [isDragging1, setDragging] = $6YREh$useState(false);
|
|
783
|
+
let isDraggingRef = $6YREh$useRef(false).current;
|
|
784
|
+
let hue = value.getChannelValue('hue');
|
|
785
|
+
function setHue(v) {
|
|
786
|
+
if (v > 360) // Make sure you can always get back to 0.
|
|
787
|
+
v = 0;
|
|
788
|
+
v = $b42abd16499dffa8$var$roundToStep($b42abd16499dffa8$var$mod(v, 360), step);
|
|
789
|
+
if (hue !== v) {
|
|
790
|
+
let color = value.withChannelValue('hue', v);
|
|
791
|
+
valueRef.current = color;
|
|
792
|
+
setValue(color);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return {
|
|
796
|
+
value: value,
|
|
797
|
+
setValue (v) {
|
|
798
|
+
let color = $b42abd16499dffa8$var$normalizeColor(v);
|
|
799
|
+
valueRef.current = color;
|
|
800
|
+
setValue(color);
|
|
801
|
+
},
|
|
802
|
+
hue: hue,
|
|
803
|
+
setHue: setHue,
|
|
804
|
+
setHueFromPoint (x, y, radius) {
|
|
805
|
+
setHue($b42abd16499dffa8$var$cartesianToAngle(x, y, radius));
|
|
806
|
+
},
|
|
807
|
+
getThumbPosition (radius) {
|
|
808
|
+
return $b42abd16499dffa8$var$angleToCartesian(value.getChannelValue('hue'), radius);
|
|
809
|
+
},
|
|
810
|
+
increment (minStepSize = 0) {
|
|
811
|
+
let newValue = hue + Math.max(minStepSize, step);
|
|
812
|
+
if (newValue > 360) // Make sure you can always get back to 0.
|
|
813
|
+
newValue = 0;
|
|
814
|
+
setHue(newValue);
|
|
815
|
+
},
|
|
816
|
+
decrement (minStepSize = 0) {
|
|
817
|
+
let s = Math.max(minStepSize, step);
|
|
818
|
+
if (hue === 0) // We can't just subtract step because this might be the case:
|
|
819
|
+
// |(previous step) - 0| < step size
|
|
820
|
+
setHue($b42abd16499dffa8$var$roundDown(360 / s) * s);
|
|
821
|
+
else setHue(hue - s);
|
|
822
|
+
},
|
|
823
|
+
setDragging (isDragging) {
|
|
824
|
+
let wasDragging = isDraggingRef;
|
|
825
|
+
isDraggingRef = isDragging;
|
|
826
|
+
if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
|
|
827
|
+
setDragging(isDragging);
|
|
828
|
+
},
|
|
829
|
+
isDragging: isDragging1,
|
|
830
|
+
getDisplayColor () {
|
|
831
|
+
return value.withChannelValue('saturation', 100).withChannelValue('lightness', 50);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
}
|
|
950
835
|
|
|
951
|
-
return newValue;
|
|
952
|
-
});
|
|
953
|
-
};
|
|
954
836
|
|
|
955
|
-
|
|
956
|
-
safelySetColorValue(prevColor => {
|
|
957
|
-
let newValue = $f1bad1ec575cba40fc263dc06b9eb3a9$var$addColorValue(parsed.current, -step); // if we've arrived at the same value that was previously in the state, the
|
|
958
|
-
// input value should be updated to match
|
|
959
|
-
// ex type 4, press increment, highlight the number in the input, type 4 again, press increment
|
|
960
|
-
// you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
|
|
837
|
+
var $d47b7df9567aae8f$exports = {};
|
|
961
838
|
|
|
962
|
-
|
|
963
|
-
setInputValue(newValue.toString('hex'));
|
|
964
|
-
}
|
|
839
|
+
$parcel$export($d47b7df9567aae8f$exports, "useColorFieldState", () => $d47b7df9567aae8f$export$d52a01683abdfcd6);
|
|
965
840
|
|
|
966
|
-
return newValue;
|
|
967
|
-
});
|
|
968
|
-
};
|
|
969
841
|
|
|
970
|
-
let incrementToMax = () => safelySetColorValue($f1bad1ec575cba40fc263dc06b9eb3a9$var$MAX_COLOR);
|
|
971
842
|
|
|
972
|
-
|
|
843
|
+
function $0887d6d920adea87$export$5aadd9c0606af5c2(value) {
|
|
844
|
+
return $6YREh$useMemo(()=>{
|
|
845
|
+
if (typeof value === 'string') try {
|
|
846
|
+
return $19b55adb42b5e1b3$export$6e865ea70d7724f(value);
|
|
847
|
+
} catch (err) {
|
|
848
|
+
return undefined;
|
|
849
|
+
}
|
|
850
|
+
return value;
|
|
851
|
+
}, [
|
|
852
|
+
value
|
|
853
|
+
]);
|
|
854
|
+
}
|
|
973
855
|
|
|
974
|
-
let validate = value => {
|
|
975
|
-
var _value$match;
|
|
976
856
|
|
|
977
|
-
return value === '' || !!((_value$match = value.match(/^#?[0-9a-f]{0,6}$/i)) == null ? void 0 : _value$match[0]);
|
|
978
|
-
};
|
|
979
857
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
858
|
+
|
|
859
|
+
const $d47b7df9567aae8f$var$MIN_COLOR = $19b55adb42b5e1b3$export$6e865ea70d7724f('#000000');
|
|
860
|
+
const $d47b7df9567aae8f$var$MAX_COLOR = $19b55adb42b5e1b3$export$6e865ea70d7724f('#FFFFFF');
|
|
861
|
+
const $d47b7df9567aae8f$var$MIN_COLOR_INT = $d47b7df9567aae8f$var$MIN_COLOR.toHexInt();
|
|
862
|
+
const $d47b7df9567aae8f$var$MAX_COLOR_INT = $d47b7df9567aae8f$var$MAX_COLOR.toHexInt();
|
|
863
|
+
function $d47b7df9567aae8f$export$d52a01683abdfcd6(props) {
|
|
864
|
+
let { step: step = 1 , value: value1 , defaultValue: defaultValue , onChange: onChange } = props;
|
|
865
|
+
let initialValue = $0887d6d920adea87$export$5aadd9c0606af5c2(value1);
|
|
866
|
+
let initialDefaultValue = $0887d6d920adea87$export$5aadd9c0606af5c2(defaultValue);
|
|
867
|
+
let [colorValue, setColorValue] = $6YREh$useControlledState(initialValue, initialDefaultValue, onChange);
|
|
868
|
+
let [inputValue, setInputValue] = $6YREh$useState(()=>(value1 || defaultValue) && colorValue ? colorValue.toString('hex') : ''
|
|
869
|
+
);
|
|
870
|
+
let safelySetColorValue = (newColor)=>{
|
|
871
|
+
if (!colorValue || !newColor) {
|
|
872
|
+
setColorValue(newColor);
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
if (newColor.toHexInt() !== colorValue.toHexInt()) {
|
|
876
|
+
setColorValue(newColor);
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
$6YREh$useEffect(()=>{
|
|
881
|
+
setInputValue(colorValue ? colorValue.toString('hex') : '');
|
|
882
|
+
}, [
|
|
883
|
+
colorValue,
|
|
884
|
+
setInputValue
|
|
885
|
+
]);
|
|
886
|
+
let parsedValue = $6YREh$useMemo(()=>{
|
|
887
|
+
let color;
|
|
888
|
+
try {
|
|
889
|
+
color = $19b55adb42b5e1b3$export$6e865ea70d7724f(inputValue.startsWith('#') ? inputValue : `#${inputValue}`);
|
|
890
|
+
} catch (err) {
|
|
891
|
+
color = null;
|
|
892
|
+
}
|
|
893
|
+
return color;
|
|
894
|
+
}, [
|
|
895
|
+
$19b55adb42b5e1b3$export$6e865ea70d7724f,
|
|
896
|
+
inputValue
|
|
897
|
+
]);
|
|
898
|
+
let parsed = $6YREh$useRef(null);
|
|
899
|
+
parsed.current = parsedValue;
|
|
900
|
+
let commit = ()=>{
|
|
901
|
+
// Set to empty state if input value is empty
|
|
902
|
+
if (!inputValue.length) {
|
|
903
|
+
safelySetColorValue(null);
|
|
904
|
+
setInputValue(value1 === undefined ? '' : colorValue.toString('hex'));
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
// if it failed to parse, then reset input to formatted version of current number
|
|
908
|
+
if (parsed.current == null) {
|
|
909
|
+
setInputValue(colorValue ? colorValue.toString('hex') : '');
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
safelySetColorValue(parsed.current);
|
|
913
|
+
// in a controlled state, the numberValue won't change, so we won't go back to our old input without help
|
|
914
|
+
let newColorValue = '';
|
|
915
|
+
if (colorValue) newColorValue = colorValue.toString('hex');
|
|
916
|
+
setInputValue(newColorValue);
|
|
917
|
+
};
|
|
918
|
+
let increment = ()=>{
|
|
919
|
+
let newValue = $d47b7df9567aae8f$var$addColorValue(parsed.current, step);
|
|
920
|
+
// if we've arrived at the same value that was previously in the state, the
|
|
921
|
+
// input value should be updated to match
|
|
922
|
+
// ex type 4, press increment, highlight the number in the input, type 4 again, press increment
|
|
923
|
+
// you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
|
|
924
|
+
if (newValue === colorValue) setInputValue(newValue.toString('hex'));
|
|
925
|
+
safelySetColorValue(newValue);
|
|
926
|
+
};
|
|
927
|
+
let decrement = ()=>{
|
|
928
|
+
let newValue = $d47b7df9567aae8f$var$addColorValue(parsed.current, -step);
|
|
929
|
+
// if we've arrived at the same value that was previously in the state, the
|
|
930
|
+
// input value should be updated to match
|
|
931
|
+
// ex type 4, press increment, highlight the number in the input, type 4 again, press increment
|
|
932
|
+
// you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
|
|
933
|
+
if (newValue === colorValue) setInputValue(newValue.toString('hex'));
|
|
934
|
+
safelySetColorValue(newValue);
|
|
935
|
+
};
|
|
936
|
+
let incrementToMax = ()=>safelySetColorValue($d47b7df9567aae8f$var$MAX_COLOR)
|
|
937
|
+
;
|
|
938
|
+
let decrementToMin = ()=>safelySetColorValue($d47b7df9567aae8f$var$MIN_COLOR)
|
|
939
|
+
;
|
|
940
|
+
let validate = (value)=>value === '' || !!value.match(/^#?[0-9a-f]{0,6}$/i)?.[0]
|
|
941
|
+
;
|
|
942
|
+
return {
|
|
943
|
+
validate: validate,
|
|
944
|
+
colorValue: colorValue,
|
|
945
|
+
inputValue: inputValue,
|
|
946
|
+
setInputValue: setInputValue,
|
|
947
|
+
commit: commit,
|
|
948
|
+
increment: increment,
|
|
949
|
+
incrementToMax: incrementToMax,
|
|
950
|
+
decrement: decrement,
|
|
951
|
+
decrementToMin: decrementToMin
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
function $d47b7df9567aae8f$var$addColorValue(color, step) {
|
|
955
|
+
let newColor = color ? color : $d47b7df9567aae8f$var$MIN_COLOR;
|
|
956
|
+
let colorInt = newColor.toHexInt();
|
|
957
|
+
let clampInt = Math.min(Math.max(colorInt + step, $d47b7df9567aae8f$var$MIN_COLOR_INT), $d47b7df9567aae8f$var$MAX_COLOR_INT);
|
|
958
|
+
if (clampInt !== colorInt) {
|
|
959
|
+
let newColorString = `#${clampInt.toString(16).padStart(6, '0').toUpperCase()}`;
|
|
960
|
+
newColor = $19b55adb42b5e1b3$export$6e865ea70d7724f(newColorString);
|
|
961
|
+
}
|
|
962
|
+
return newColor;
|
|
991
963
|
}
|
|
992
964
|
|
|
993
|
-
function $f1bad1ec575cba40fc263dc06b9eb3a9$var$addColorValue(color, step) {
|
|
994
|
-
let newColor = color ? color : $f1bad1ec575cba40fc263dc06b9eb3a9$var$MIN_COLOR;
|
|
995
|
-
let colorInt = newColor.toHexInt();
|
|
996
|
-
let clampInt = Math.min(Math.max(colorInt + step, $f1bad1ec575cba40fc263dc06b9eb3a9$var$MIN_COLOR_INT), $f1bad1ec575cba40fc263dc06b9eb3a9$var$MAX_COLOR_INT);
|
|
997
965
|
|
|
998
|
-
if (clampInt !== colorInt) {
|
|
999
|
-
let newColorString = "#" + clampInt.toString(16).padStart(6, '0').toUpperCase();
|
|
1000
|
-
newColor = parseColor(newColorString);
|
|
1001
|
-
}
|
|
1002
966
|
|
|
1003
|
-
|
|
1004
|
-
}
|
|
967
|
+
|
|
968
|
+
export {$19b55adb42b5e1b3$export$6e865ea70d7724f as parseColor, $86a06515e79ac54d$export$57bc203e1c9c6d44 as useColorSliderState, $b42abd16499dffa8$export$f4301076d9336137 as useColorWheelState, $d47b7df9567aae8f$export$d52a01683abdfcd6 as useColorFieldState};
|
|
1005
969
|
//# sourceMappingURL=module.js.map
|