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