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