@react-stately/color 3.5.4-nightly.4552 → 3.5.4-nightly.4558
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/Color.main.js +770 -0
- package/dist/Color.main.js.map +1 -0
- package/dist/Color.mjs +764 -0
- package/dist/Color.module.js +764 -0
- package/dist/Color.module.js.map +1 -0
- package/dist/ar-AE.main.js +2 -2
- package/dist/ar-AE.main.js.map +1 -1
- package/dist/ar-AE.mjs +3 -3
- package/dist/ar-AE.module.js +2 -2
- package/dist/ar-AE.module.js.map +1 -1
- package/dist/bg-BG.main.js +2 -2
- package/dist/bg-BG.main.js.map +1 -1
- package/dist/bg-BG.mjs +3 -3
- package/dist/bg-BG.module.js +2 -2
- package/dist/bg-BG.module.js.map +1 -1
- package/dist/cs-CZ.main.js +2 -2
- package/dist/cs-CZ.main.js.map +1 -1
- package/dist/cs-CZ.mjs +3 -3
- package/dist/cs-CZ.module.js +2 -2
- package/dist/cs-CZ.module.js.map +1 -1
- package/dist/da-DK.main.js +2 -2
- package/dist/da-DK.main.js.map +1 -1
- package/dist/da-DK.mjs +3 -3
- package/dist/da-DK.module.js +2 -2
- package/dist/da-DK.module.js.map +1 -1
- package/dist/de-DE.main.js +2 -2
- package/dist/de-DE.main.js.map +1 -1
- package/dist/de-DE.mjs +3 -3
- package/dist/de-DE.module.js +2 -2
- package/dist/de-DE.module.js.map +1 -1
- package/dist/el-GR.main.js +2 -2
- package/dist/el-GR.main.js.map +1 -1
- package/dist/el-GR.mjs +3 -3
- package/dist/el-GR.module.js +2 -2
- package/dist/el-GR.module.js.map +1 -1
- package/dist/en-US.main.js +2 -2
- package/dist/en-US.main.js.map +1 -1
- package/dist/en-US.mjs +3 -3
- package/dist/en-US.module.js +2 -2
- package/dist/en-US.module.js.map +1 -1
- package/dist/es-ES.main.js +2 -2
- package/dist/es-ES.main.js.map +1 -1
- package/dist/es-ES.mjs +3 -3
- package/dist/es-ES.module.js +2 -2
- package/dist/es-ES.module.js.map +1 -1
- package/dist/et-EE.main.js +2 -2
- package/dist/et-EE.main.js.map +1 -1
- package/dist/et-EE.mjs +3 -3
- package/dist/et-EE.module.js +2 -2
- package/dist/et-EE.module.js.map +1 -1
- package/dist/fi-FI.main.js +2 -2
- package/dist/fi-FI.main.js.map +1 -1
- package/dist/fi-FI.mjs +3 -3
- package/dist/fi-FI.module.js +2 -2
- package/dist/fi-FI.module.js.map +1 -1
- package/dist/fr-FR.main.js +2 -2
- package/dist/fr-FR.main.js.map +1 -1
- package/dist/fr-FR.mjs +3 -3
- package/dist/fr-FR.module.js +2 -2
- package/dist/fr-FR.module.js.map +1 -1
- package/dist/he-IL.main.js +2 -2
- package/dist/he-IL.main.js.map +1 -1
- package/dist/he-IL.mjs +3 -3
- package/dist/he-IL.module.js +2 -2
- package/dist/he-IL.module.js.map +1 -1
- package/dist/hr-HR.main.js +2 -2
- package/dist/hr-HR.main.js.map +1 -1
- package/dist/hr-HR.mjs +3 -3
- package/dist/hr-HR.module.js +2 -2
- package/dist/hr-HR.module.js.map +1 -1
- package/dist/hu-HU.main.js +2 -2
- package/dist/hu-HU.main.js.map +1 -1
- package/dist/hu-HU.mjs +3 -3
- package/dist/hu-HU.module.js +2 -2
- package/dist/hu-HU.module.js.map +1 -1
- package/dist/import.mjs +5 -1303
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.main.js +2 -2
- package/dist/it-IT.main.js.map +1 -1
- package/dist/it-IT.mjs +3 -3
- package/dist/it-IT.module.js +2 -2
- package/dist/it-IT.module.js.map +1 -1
- package/dist/ja-JP.main.js +2 -2
- package/dist/ja-JP.main.js.map +1 -1
- package/dist/ja-JP.mjs +3 -3
- package/dist/ja-JP.module.js +2 -2
- package/dist/ja-JP.module.js.map +1 -1
- package/dist/ko-KR.main.js +2 -2
- package/dist/ko-KR.main.js.map +1 -1
- package/dist/ko-KR.mjs +3 -3
- package/dist/ko-KR.module.js +2 -2
- package/dist/ko-KR.module.js.map +1 -1
- package/dist/lt-LT.main.js +2 -2
- package/dist/lt-LT.main.js.map +1 -1
- package/dist/lt-LT.mjs +3 -3
- package/dist/lt-LT.module.js +2 -2
- package/dist/lt-LT.module.js.map +1 -1
- package/dist/lv-LV.main.js +2 -2
- package/dist/lv-LV.main.js.map +1 -1
- package/dist/lv-LV.mjs +3 -3
- package/dist/lv-LV.module.js +2 -2
- package/dist/lv-LV.module.js.map +1 -1
- package/dist/main.js +10 -1308
- package/dist/main.js.map +1 -1
- package/dist/module.js +5 -1303
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.main.js +2 -2
- package/dist/nb-NO.main.js.map +1 -1
- package/dist/nb-NO.mjs +3 -3
- package/dist/nb-NO.module.js +2 -2
- package/dist/nb-NO.module.js.map +1 -1
- package/dist/nl-NL.main.js +2 -2
- package/dist/nl-NL.main.js.map +1 -1
- package/dist/nl-NL.mjs +3 -3
- package/dist/nl-NL.module.js +2 -2
- package/dist/nl-NL.module.js.map +1 -1
- package/dist/pl-PL.main.js +2 -2
- package/dist/pl-PL.main.js.map +1 -1
- package/dist/pl-PL.mjs +3 -3
- package/dist/pl-PL.module.js +2 -2
- package/dist/pl-PL.module.js.map +1 -1
- package/dist/pt-BR.main.js +2 -2
- package/dist/pt-BR.main.js.map +1 -1
- package/dist/pt-BR.mjs +3 -3
- package/dist/pt-BR.module.js +2 -2
- package/dist/pt-BR.module.js.map +1 -1
- package/dist/pt-PT.main.js +2 -2
- package/dist/pt-PT.main.js.map +1 -1
- package/dist/pt-PT.mjs +3 -3
- package/dist/pt-PT.module.js +2 -2
- package/dist/pt-PT.module.js.map +1 -1
- package/dist/ro-RO.main.js +2 -2
- package/dist/ro-RO.main.js.map +1 -1
- package/dist/ro-RO.mjs +3 -3
- package/dist/ro-RO.module.js +2 -2
- package/dist/ro-RO.module.js.map +1 -1
- package/dist/ru-RU.main.js +2 -2
- package/dist/ru-RU.main.js.map +1 -1
- package/dist/ru-RU.mjs +3 -3
- package/dist/ru-RU.module.js +2 -2
- package/dist/ru-RU.module.js.map +1 -1
- package/dist/sk-SK.main.js +2 -2
- package/dist/sk-SK.main.js.map +1 -1
- package/dist/sk-SK.mjs +3 -3
- package/dist/sk-SK.module.js +2 -2
- package/dist/sk-SK.module.js.map +1 -1
- package/dist/sl-SI.main.js +2 -2
- package/dist/sl-SI.main.js.map +1 -1
- package/dist/sl-SI.mjs +3 -3
- package/dist/sl-SI.module.js +2 -2
- package/dist/sl-SI.module.js.map +1 -1
- package/dist/sr-SP.main.js +2 -2
- package/dist/sr-SP.main.js.map +1 -1
- package/dist/sr-SP.mjs +3 -3
- package/dist/sr-SP.module.js +2 -2
- package/dist/sr-SP.module.js.map +1 -1
- package/dist/sv-SE.main.js +2 -2
- package/dist/sv-SE.main.js.map +1 -1
- package/dist/sv-SE.mjs +3 -3
- package/dist/sv-SE.module.js +2 -2
- package/dist/sv-SE.module.js.map +1 -1
- package/dist/tr-TR.main.js +2 -2
- package/dist/tr-TR.main.js.map +1 -1
- package/dist/tr-TR.mjs +3 -3
- package/dist/tr-TR.module.js +2 -2
- package/dist/tr-TR.module.js.map +1 -1
- package/dist/uk-UA.main.js +2 -2
- package/dist/uk-UA.main.js.map +1 -1
- package/dist/uk-UA.mjs +3 -3
- package/dist/uk-UA.module.js +2 -2
- package/dist/uk-UA.module.js.map +1 -1
- package/dist/useColor.main.js +36 -0
- package/dist/useColor.main.js.map +1 -0
- package/dist/useColor.mjs +31 -0
- package/dist/useColor.module.js +31 -0
- package/dist/useColor.module.js.map +1 -0
- package/dist/useColorAreaState.main.js +124 -0
- package/dist/useColorAreaState.main.js.map +1 -0
- package/dist/useColorAreaState.mjs +119 -0
- package/dist/useColorAreaState.module.js +119 -0
- package/dist/useColorAreaState.module.js.map +1 -0
- package/dist/useColorFieldState.main.js +138 -0
- package/dist/useColorFieldState.main.js.map +1 -0
- package/dist/useColorFieldState.mjs +133 -0
- package/dist/useColorFieldState.module.js +133 -0
- package/dist/useColorFieldState.module.js.map +1 -0
- package/dist/useColorSliderState.main.js +75 -0
- package/dist/useColorSliderState.main.js.map +1 -0
- package/dist/useColorSliderState.mjs +70 -0
- package/dist/useColorSliderState.module.js +70 -0
- package/dist/useColorSliderState.module.js.map +1 -0
- package/dist/useColorWheelState.main.js +123 -0
- package/dist/useColorWheelState.main.js.map +1 -0
- package/dist/useColorWheelState.mjs +118 -0
- package/dist/useColorWheelState.module.js +118 -0
- package/dist/useColorWheelState.module.js.map +1 -0
- package/dist/zh-CN.main.js +2 -2
- package/dist/zh-CN.main.js.map +1 -1
- package/dist/zh-CN.mjs +3 -3
- package/dist/zh-CN.module.js +2 -2
- package/dist/zh-CN.module.js.map +1 -1
- package/dist/zh-TW.main.js +2 -2
- package/dist/zh-TW.main.js.map +1 -1
- package/dist/zh-TW.mjs +3 -3
- package/dist/zh-TW.module.js +2 -2
- package/dist/zh-TW.module.js.map +1 -1
- package/package.json +9 -9
- package/src/Color.ts +13 -10
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {normalizeColor as $799cddbef784668f$export$4cde5df63f53f473, parseColor as $799cddbef784668f$export$6e865ea70d7724f} from "./Color.module.js";
|
|
2
|
+
import {useSliderState as $1Eavr$useSliderState} from "@react-stately/slider";
|
|
3
|
+
import {useControlledState as $1Eavr$useControlledState} from "@react-stately/utils";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function $25a25ac0d1624665$export$57bc203e1c9c6d44(props) {
|
|
19
|
+
let { channel: channel, value: value, defaultValue: defaultValue, onChange: onChange, locale: locale, ...otherProps } = props;
|
|
20
|
+
if (value == null && defaultValue == null) throw new Error("useColorSliderState requires a value or defaultValue");
|
|
21
|
+
let [color, setColor] = (0, $1Eavr$useControlledState)(value && (0, $799cddbef784668f$export$4cde5df63f53f473)(value), defaultValue && (0, $799cddbef784668f$export$4cde5df63f53f473)(defaultValue), onChange);
|
|
22
|
+
let sliderState = (0, $1Eavr$useSliderState)({
|
|
23
|
+
...color.getChannelRange(channel),
|
|
24
|
+
...otherProps,
|
|
25
|
+
// Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
|
|
26
|
+
numberFormatter: null,
|
|
27
|
+
value: color.getChannelValue(channel),
|
|
28
|
+
onChange (v) {
|
|
29
|
+
setColor(color.withChannelValue(channel, v));
|
|
30
|
+
},
|
|
31
|
+
onChangeEnd (v) {
|
|
32
|
+
// onChange will have already been called with the right value, this is just to trigger onChangeEnd
|
|
33
|
+
if (props.onChangeEnd) props.onChangeEnd(color.withChannelValue(channel, v));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
let { step: step, pageSize: pageSize } = color.getChannelRange(channel);
|
|
37
|
+
return {
|
|
38
|
+
...sliderState,
|
|
39
|
+
value: color,
|
|
40
|
+
setValue (value) {
|
|
41
|
+
setColor((0, $799cddbef784668f$export$4cde5df63f53f473)(value));
|
|
42
|
+
},
|
|
43
|
+
getDisplayColor () {
|
|
44
|
+
switch(channel){
|
|
45
|
+
case "hue":
|
|
46
|
+
return (0, $799cddbef784668f$export$6e865ea70d7724f)(`hsl(${color.getChannelValue("hue")}, 100%, 50%)`);
|
|
47
|
+
case "lightness":
|
|
48
|
+
case "brightness":
|
|
49
|
+
case "saturation":
|
|
50
|
+
case "red":
|
|
51
|
+
case "green":
|
|
52
|
+
case "blue":
|
|
53
|
+
return color.withChannelValue("alpha", 1);
|
|
54
|
+
case "alpha":
|
|
55
|
+
return color;
|
|
56
|
+
default:
|
|
57
|
+
throw new Error("Unknown color channel: " + channel);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
getThumbValueLabel () {
|
|
61
|
+
return color.formatChannelValue(channel, locale);
|
|
62
|
+
},
|
|
63
|
+
step: step,
|
|
64
|
+
pageSize: pageSize
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
export {$25a25ac0d1624665$export$57bc203e1c9c6d44 as useColorSliderState};
|
|
70
|
+
//# sourceMappingURL=useColorSliderState.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA0BM,SAAS,0CAAoB,KAA8B;IAChE,IAAI,WAAC,OAAO,SAAE,KAAK,gBAAE,YAAY,YAAE,QAAQ,UAAE,MAAM,EAAE,GAAG,YAAW,GAAG;IACtE,IAAI,SAAS,QAAQ,gBAAgB,MACnC,MAAM,IAAI,MAAM;IAGlB,IAAI,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,yBAAiB,EAAE,SAAS,CAAA,GAAA,yCAAa,EAAE,QAAQ,gBAAgB,CAAA,GAAA,yCAAa,EAAE,eAAe;IACzH,IAAI,cAAc,CAAA,GAAA,qBAAa,EAAE;QAC/B,GAAG,MAAM,eAAe,CAAC,QAAQ;QACjC,GAAG,UAAU;QACb,8FAA8F;QAC9F,iBAAiB;QACjB,OAAO,MAAM,eAAe,CAAC;QAC7B,UAAS,CAAC;YACR,SAAS,MAAM,gBAAgB,CAAC,SAAS;QAC3C;QACA,aAAY,CAAC;YACX,mGAAmG;YACnG,IAAI,MAAM,WAAW,EACnB,MAAM,WAAW,CAAC,MAAM,gBAAgB,CAAC,SAAS;QAEtD;IACF;IAEA,IAAI,QAAC,IAAI,YAAE,QAAQ,EAAC,GAAG,MAAM,eAAe,CAAC;IAC7C,OAAO;QACL,GAAG,WAAW;QACd,OAAO;QACP,UAAS,KAAK;YACZ,SAAS,CAAA,GAAA,yCAAa,EAAE;QAC1B;QACA;YACE,OAAQ;gBACN,KAAK;oBACH,OAAO,CAAA,GAAA,wCAAS,EAAE,CAAC,IAAI,EAAE,MAAM,eAAe,CAAC,OAAO,YAAY,CAAC;gBACrE,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,KAAK;oBACH,OAAO,MAAM,gBAAgB,CAAC,SAAS;gBACzC,KAAK;oBACH,OAAO;gBAET;oBACE,MAAM,IAAI,MAAM,4BAA4B;YAChD;QACF;QACA;YACE,OAAO,MAAM,kBAAkB,CAAC,SAAS;QAC3C;cACA;kBACA;IACF;AACF","sources":["packages/@react-stately/color/src/useColorSliderState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Color, ColorSliderProps} from '@react-types/color';\nimport {normalizeColor, parseColor} from './Color';\nimport {SliderState, useSliderState} from '@react-stately/slider';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface ColorSliderState extends SliderState {\n /** The current color value represented by the color slider. */\n readonly value: Color,\n /** Sets the current color value. If a string is passed, it will be parsed to a Color. */\n setValue(value: string | Color): void,\n /** Returns the color that should be displayed in the slider instead of `value` or the optional parameter. */\n getDisplayColor(): Color\n}\n\n\nexport interface ColorSliderStateOptions extends ColorSliderProps {\n /** The locale to use for formatting the color channel value. */\n locale: string\n}\n\n/**\n * Provides state management for a color slider component.\n * Color sliders allow users to adjust an individual channel of a color value.\n */\nexport function useColorSliderState(props: ColorSliderStateOptions): ColorSliderState {\n let {channel, value, defaultValue, onChange, locale, ...otherProps} = props;\n if (value == null && defaultValue == null) {\n throw new Error('useColorSliderState requires a value or defaultValue');\n }\n\n let [color, setColor] = useControlledState(value && normalizeColor(value), defaultValue && normalizeColor(defaultValue), onChange);\n let sliderState = useSliderState({\n ...color.getChannelRange(channel),\n ...otherProps,\n // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.\n numberFormatter: null,\n value: color.getChannelValue(channel),\n onChange(v) {\n setColor(color.withChannelValue(channel, v));\n },\n onChangeEnd(v) {\n // onChange will have already been called with the right value, this is just to trigger onChangeEnd\n if (props.onChangeEnd) {\n props.onChangeEnd(color.withChannelValue(channel, v));\n }\n }\n });\n\n let {step, pageSize} = color.getChannelRange(channel);\n return {\n ...sliderState,\n value: color,\n setValue(value) {\n setColor(normalizeColor(value));\n },\n getDisplayColor() {\n switch (channel) {\n case 'hue':\n return parseColor(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);\n case 'lightness':\n case 'brightness':\n case 'saturation':\n case 'red':\n case 'green':\n case 'blue':\n return color.withChannelValue('alpha', 1);\n case 'alpha': {\n return color;\n }\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n },\n getThumbValueLabel() {\n return color.formatChannelValue(channel, locale);\n },\n step,\n pageSize\n };\n}\n"],"names":[],"version":3,"file":"useColorSliderState.module.js.map"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var $83fe1a57d631223b$exports = require("./Color.main.js");
|
|
2
|
+
var $5Frb2$reactstatelyutils = require("@react-stately/utils");
|
|
3
|
+
var $5Frb2$react = require("react");
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$export(e, n, v, s) {
|
|
7
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
$parcel$export(module.exports, "useColorWheelState", () => $9d7d8736d45f74b8$export$f4301076d9336137);
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const $9d7d8736d45f74b8$var$DEFAULT_COLOR = (0, $83fe1a57d631223b$exports.parseColor)("hsl(0, 100%, 50%)");
|
|
25
|
+
function $9d7d8736d45f74b8$var$roundToStep(value, step) {
|
|
26
|
+
return Math.round(value / step) * step;
|
|
27
|
+
}
|
|
28
|
+
function $9d7d8736d45f74b8$var$mod(n, m) {
|
|
29
|
+
return (n % m + m) % m;
|
|
30
|
+
}
|
|
31
|
+
function $9d7d8736d45f74b8$var$roundDown(v) {
|
|
32
|
+
let r = Math.floor(v);
|
|
33
|
+
if (r === v) return v - 1;
|
|
34
|
+
else return r;
|
|
35
|
+
}
|
|
36
|
+
function $9d7d8736d45f74b8$var$degToRad(deg) {
|
|
37
|
+
return deg * Math.PI / 180;
|
|
38
|
+
}
|
|
39
|
+
function $9d7d8736d45f74b8$var$radToDeg(rad) {
|
|
40
|
+
return rad * 180 / Math.PI;
|
|
41
|
+
}
|
|
42
|
+
// 0deg = 3 o'clock. increases clockwise
|
|
43
|
+
function $9d7d8736d45f74b8$var$angleToCartesian(angle, radius) {
|
|
44
|
+
let rad = $9d7d8736d45f74b8$var$degToRad(360 - angle + 90);
|
|
45
|
+
let x = Math.sin(rad) * radius;
|
|
46
|
+
let y = Math.cos(rad) * radius;
|
|
47
|
+
return {
|
|
48
|
+
x: x,
|
|
49
|
+
y: y
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function $9d7d8736d45f74b8$var$cartesianToAngle(x, y, radius) {
|
|
53
|
+
let deg = $9d7d8736d45f74b8$var$radToDeg(Math.atan2(y / radius, x / radius));
|
|
54
|
+
return (deg + 360) % 360;
|
|
55
|
+
}
|
|
56
|
+
function $9d7d8736d45f74b8$export$f4301076d9336137(props) {
|
|
57
|
+
let { defaultValue: defaultValue, onChange: onChange, onChangeEnd: onChangeEnd } = props;
|
|
58
|
+
if (!props.value && !defaultValue) defaultValue = $9d7d8736d45f74b8$var$DEFAULT_COLOR;
|
|
59
|
+
let [value, setValueState] = (0, $5Frb2$reactstatelyutils.useControlledState)((0, $83fe1a57d631223b$exports.normalizeColor)(props.value), (0, $83fe1a57d631223b$exports.normalizeColor)(defaultValue), onChange);
|
|
60
|
+
let valueRef = (0, $5Frb2$react.useRef)(value);
|
|
61
|
+
let setValue = (value)=>{
|
|
62
|
+
valueRef.current = value;
|
|
63
|
+
setValueState(value);
|
|
64
|
+
};
|
|
65
|
+
let channelRange = value.getChannelRange("hue");
|
|
66
|
+
let { minValue: minValueX, maxValue: maxValueX, step: step, pageSize: pageStep } = channelRange;
|
|
67
|
+
let [isDragging, setDragging] = (0, $5Frb2$react.useState)(false);
|
|
68
|
+
let isDraggingRef = (0, $5Frb2$react.useRef)(false);
|
|
69
|
+
let hue = value.getChannelValue("hue");
|
|
70
|
+
function setHue(v) {
|
|
71
|
+
if (v > 360) // Make sure you can always get back to 0.
|
|
72
|
+
v = 0;
|
|
73
|
+
v = $9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(v, 360), step);
|
|
74
|
+
if (hue !== v) {
|
|
75
|
+
let color = value.withChannelValue("hue", v);
|
|
76
|
+
setValue(color);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
value: value,
|
|
81
|
+
step: step,
|
|
82
|
+
pageStep: pageStep,
|
|
83
|
+
setValue (v) {
|
|
84
|
+
let color = (0, $83fe1a57d631223b$exports.normalizeColor)(v);
|
|
85
|
+
setValue(color);
|
|
86
|
+
},
|
|
87
|
+
hue: hue,
|
|
88
|
+
setHue: setHue,
|
|
89
|
+
setHueFromPoint (x, y, radius) {
|
|
90
|
+
setHue($9d7d8736d45f74b8$var$cartesianToAngle(x, y, radius));
|
|
91
|
+
},
|
|
92
|
+
getThumbPosition (radius) {
|
|
93
|
+
return $9d7d8736d45f74b8$var$angleToCartesian(value.getChannelValue("hue"), radius);
|
|
94
|
+
},
|
|
95
|
+
increment (stepSize = 1) {
|
|
96
|
+
let s = Math.max(stepSize, step);
|
|
97
|
+
let newValue = hue + s;
|
|
98
|
+
if (newValue >= maxValueX) // Make sure you can always get back to 0.
|
|
99
|
+
newValue = minValueX;
|
|
100
|
+
setHue($9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(newValue, 360), s));
|
|
101
|
+
},
|
|
102
|
+
decrement (stepSize = 1) {
|
|
103
|
+
let s = Math.max(stepSize, step);
|
|
104
|
+
if (hue === 0) // We can't just subtract step because this might be the case:
|
|
105
|
+
// |(previous step) - 0| < step size
|
|
106
|
+
setHue($9d7d8736d45f74b8$var$roundDown(360 / s) * s);
|
|
107
|
+
else setHue($9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(hue - s, 360), s));
|
|
108
|
+
},
|
|
109
|
+
setDragging (isDragging) {
|
|
110
|
+
let wasDragging = isDraggingRef.current;
|
|
111
|
+
isDraggingRef.current = isDragging;
|
|
112
|
+
if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
|
|
113
|
+
setDragging(isDragging);
|
|
114
|
+
},
|
|
115
|
+
isDragging: isDragging,
|
|
116
|
+
getDisplayColor () {
|
|
117
|
+
return value.toFormat("hsl").withChannelValue("sa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AK,GAAG,CAAC,UAAU;YAC3B,IAAI,QAAQ,GACV,8DAA8D;YAC9D,oCAAoC;YACpC,OAAO,gCAAU,MAAM,KAAK;iBAE5B,OAAO,kCAAY,0BAAI,MAAM,GAAG,MAAM;QAE1C;QACA,aAAY,UAAU;YACpB,IAAI,cAAc,cAAc,OAAO;YACvC,cAAc,OAAO,GAAG;YAExB,IAAI,eAAe,CAAC,cAAc,aAChC,YAAY,SAAS,OAAO;YAG9B,YAAY;QACd;oBACA;QACA;YACE,OAAO,MAAM,QAAQ,CAAC,OAAO,gBAAgB,CAAC,cAAc,KAAK,gBAAgB,CAAC,aAAa,IAAI,gBAAgB,CAAC,SAAS;QAC/H;IACF;AACF","sources":["packages/@react-stately/color/src/useColorWheelState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Color, ColorWheelProps} from '@react-types/color';\nimport {normalizeColor, parseColor} from './Color';\nimport {useControlledState} from '@react-stately/utils';\nimport {useRef, useState} from 'react';\n\nexport interface ColorWheelState {\n /** The current color value represented by the color wheel. */\n readonly value: Color,\n /** Sets the color value represented by the color wheel, and triggers `onChange`. */\n setValue(value: string | Color): void,\n\n /** The current value of the hue channel displayed by the color wheel. */\n readonly hue: number,\n /** Sets the hue channel of the current color value and triggers `onChange`. */\n setHue(value: number): void,\n\n /** Sets the hue channel of the current color value based on the given coordinates and radius of the color wheel, and triggers `onChange`. */\n setHueFromPoint(x: number, y: number, radius: number): void,\n /** Returns the coordinates of the thumb relative to the center point of the color wheel. */\n getThumbPosition(radius: number): {x: number, y: number},\n\n /** Increments the hue by the given amount (defaults to 1). */\n increment(stepSize?: number): void,\n /** Decrements the hue by the given amount (defaults to 1). */\n decrement(stepSize?: number): void,\n\n /** Whether the color wheel is currently being dragged. */\n readonly isDragging: boolean,\n /** Sets whether the color wheel is being dragged. */\n setDragging(value: boolean): void,\n /** Returns the color that should be displayed in the color wheel instead of `value`. */\n getDisplayColor(): Color,\n /** The step value of the hue channel, used when incrementing and decrementing. */\n step: number,\n /** The page step value of the hue channel, used when incrementing and decrementing. */\n pageStep: number\n}\n\nconst DEFAULT_COLOR = parseColor('hsl(0, 100%, 50%)');\n\nfunction roundToStep(value: number, step: number): number {\n return Math.round(value / step) * step;\n}\n\nfunction mod(n: number, m: number) {\n return ((n % m) + m) % m;\n}\n\nfunction roundDown(v: number) {\n let r = Math.floor(v);\n if (r === v) {\n return v - 1;\n } else {\n return r;\n }\n}\n\nfunction degToRad(deg: number) {\n return deg * Math.PI / 180;\n}\n\nfunction radToDeg(rad: number) {\n return rad * 180 / Math.PI;\n}\n\n// 0deg = 3 o'clock. increases clockwise\nfunction angleToCartesian(angle: number, radius: number): {x: number, y: number} {\n let rad = degToRad(360 - angle + 90);\n let x = Math.sin(rad) * (radius);\n let y = Math.cos(rad) * (radius);\n return {x, y};\n}\n\nfunction cartesianToAngle(x: number, y: number, radius: number): number {\n let deg = radToDeg(Math.atan2(y / radius, x / radius));\n return (deg + 360) % 360;\n}\n\n/**\n * Provides state management for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheelState(props: ColorWheelProps): ColorWheelState {\n let {defaultValue, onChange, onChangeEnd} = props;\n\n if (!props.value && !defaultValue) {\n defaultValue = DEFAULT_COLOR;\n }\n\n let [value, setValueState] = useControlledState(normalizeColor(props.value), normalizeColor(defaultValue), onChange);\n let valueRef = useRef(value);\n let setValue = (value: Color) => {\n valueRef.current = value;\n setValueState(value);\n };\n\n let channelRange = value.getChannelRange('hue');\n let {minValue: minValueX, maxValue: maxValueX, step: step, pageSize: pageStep} = channelRange;\n let [isDragging, setDragging] = useState(false);\n let isDraggingRef = useRef(false);\n\n let hue = value.getChannelValue('hue');\n function setHue(v: number) {\n if (v > 360) {\n // Make sure you can always get back to 0.\n v = 0;\n }\n v = roundToStep(mod(v, 360), step);\n if (hue !== v) {\n let color = value.withChannelValue('hue', v);\n setValue(color);\n }\n }\n\n return {\n value,\n step,\n pageStep,\n setValue(v) {\n let color = normalizeColor(v);\n setValue(color);\n },\n hue,\n setHue,\n setHueFromPoint(x, y, radius) {\n setHue(cartesianToAngle(x, y, radius));\n },\n getThumbPosition(radius) {\n return angleToCartesian(value.getChannelValue('hue'), radius);\n },\n increment(stepSize = 1) {\n let s = Math.max(stepSize, step);\n let newValue = hue + s;\n if (newValue >= maxValueX) {\n // Make sure you can always get back to 0.\n newValue = minValueX;\n }\n setHue(roundToStep(mod(newValue, 360), s));\n },\n decrement(stepSize = 1) {\n let s = Math.max(stepSize, step);\n if (hue === 0) {\n // We can't just subtract step because this might be the case:\n // |(previous step) - 0| < step size\n setHue(roundDown(360 / s) * s);\n } else {\n setHue(roundToStep(mod(hue - s, 360), s));\n }\n },\n setDragging(isDragging) {\n let wasDragging = isDraggingRef.current;\n isDraggingRef.current = isDragging;\n\n if (onChangeEnd && !isDragging && wasDragging) {\n onChangeEnd(valueRef.current);\n }\n\n setDragging(isDragging);\n },\n isDragging,\n getDisplayColor() {\n return value.toFormat('hsl').withChannelValue('saturation', 100).withChannelValue('lightness', 50).withChannelValue('alpha', 1);\n }\n };\n}\n"],"names":[],"version":3,"file":"useColorWheelState.main.js.map"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {normalizeColor as $799cddbef784668f$export$4cde5df63f53f473, parseColor as $799cddbef784668f$export$6e865ea70d7724f} from "./Color.mjs";
|
|
2
|
+
import {useControlledState as $d4Pfi$useControlledState} from "@react-stately/utils";
|
|
3
|
+
import {useRef as $d4Pfi$useRef, useState as $d4Pfi$useState} from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $ee4262c74a467b07$var$DEFAULT_COLOR = (0, $799cddbef784668f$export$6e865ea70d7724f)("hsl(0, 100%, 50%)");
|
|
19
|
+
function $ee4262c74a467b07$var$roundToStep(value, step) {
|
|
20
|
+
return Math.round(value / step) * step;
|
|
21
|
+
}
|
|
22
|
+
function $ee4262c74a467b07$var$mod(n, m) {
|
|
23
|
+
return (n % m + m) % m;
|
|
24
|
+
}
|
|
25
|
+
function $ee4262c74a467b07$var$roundDown(v) {
|
|
26
|
+
let r = Math.floor(v);
|
|
27
|
+
if (r === v) return v - 1;
|
|
28
|
+
else return r;
|
|
29
|
+
}
|
|
30
|
+
function $ee4262c74a467b07$var$degToRad(deg) {
|
|
31
|
+
return deg * Math.PI / 180;
|
|
32
|
+
}
|
|
33
|
+
function $ee4262c74a467b07$var$radToDeg(rad) {
|
|
34
|
+
return rad * 180 / Math.PI;
|
|
35
|
+
}
|
|
36
|
+
// 0deg = 3 o'clock. increases clockwise
|
|
37
|
+
function $ee4262c74a467b07$var$angleToCartesian(angle, radius) {
|
|
38
|
+
let rad = $ee4262c74a467b07$var$degToRad(360 - angle + 90);
|
|
39
|
+
let x = Math.sin(rad) * radius;
|
|
40
|
+
let y = Math.cos(rad) * radius;
|
|
41
|
+
return {
|
|
42
|
+
x: x,
|
|
43
|
+
y: y
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function $ee4262c74a467b07$var$cartesianToAngle(x, y, radius) {
|
|
47
|
+
let deg = $ee4262c74a467b07$var$radToDeg(Math.atan2(y / radius, x / radius));
|
|
48
|
+
return (deg + 360) % 360;
|
|
49
|
+
}
|
|
50
|
+
function $ee4262c74a467b07$export$f4301076d9336137(props) {
|
|
51
|
+
let { defaultValue: defaultValue, onChange: onChange, onChangeEnd: onChangeEnd } = props;
|
|
52
|
+
if (!props.value && !defaultValue) defaultValue = $ee4262c74a467b07$var$DEFAULT_COLOR;
|
|
53
|
+
let [value, setValueState] = (0, $d4Pfi$useControlledState)((0, $799cddbef784668f$export$4cde5df63f53f473)(props.value), (0, $799cddbef784668f$export$4cde5df63f53f473)(defaultValue), onChange);
|
|
54
|
+
let valueRef = (0, $d4Pfi$useRef)(value);
|
|
55
|
+
let setValue = (value)=>{
|
|
56
|
+
valueRef.current = value;
|
|
57
|
+
setValueState(value);
|
|
58
|
+
};
|
|
59
|
+
let channelRange = value.getChannelRange("hue");
|
|
60
|
+
let { minValue: minValueX, maxValue: maxValueX, step: step, pageSize: pageStep } = channelRange;
|
|
61
|
+
let [isDragging, setDragging] = (0, $d4Pfi$useState)(false);
|
|
62
|
+
let isDraggingRef = (0, $d4Pfi$useRef)(false);
|
|
63
|
+
let hue = value.getChannelValue("hue");
|
|
64
|
+
function setHue(v) {
|
|
65
|
+
if (v > 360) // Make sure you can always get back to 0.
|
|
66
|
+
v = 0;
|
|
67
|
+
v = $ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(v, 360), step);
|
|
68
|
+
if (hue !== v) {
|
|
69
|
+
let color = value.withChannelValue("hue", v);
|
|
70
|
+
setValue(color);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
value: value,
|
|
75
|
+
step: step,
|
|
76
|
+
pageStep: pageStep,
|
|
77
|
+
setValue (v) {
|
|
78
|
+
let color = (0, $799cddbef784668f$export$4cde5df63f53f473)(v);
|
|
79
|
+
setValue(color);
|
|
80
|
+
},
|
|
81
|
+
hue: hue,
|
|
82
|
+
setHue: setHue,
|
|
83
|
+
setHueFromPoint (x, y, radius) {
|
|
84
|
+
setHue($ee4262c74a467b07$var$cartesianToAngle(x, y, radius));
|
|
85
|
+
},
|
|
86
|
+
getThumbPosition (radius) {
|
|
87
|
+
return $ee4262c74a467b07$var$angleToCartesian(value.getChannelValue("hue"), radius);
|
|
88
|
+
},
|
|
89
|
+
increment (stepSize = 1) {
|
|
90
|
+
let s = Math.max(stepSize, step);
|
|
91
|
+
let newValue = hue + s;
|
|
92
|
+
if (newValue >= maxValueX) // Make sure you can always get back to 0.
|
|
93
|
+
newValue = minValueX;
|
|
94
|
+
setHue($ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(newValue, 360), s));
|
|
95
|
+
},
|
|
96
|
+
decrement (stepSize = 1) {
|
|
97
|
+
let s = Math.max(stepSize, step);
|
|
98
|
+
if (hue === 0) // We can't just subtract step because this might be the case:
|
|
99
|
+
// |(previous step) - 0| < step size
|
|
100
|
+
setHue($ee4262c74a467b07$var$roundDown(360 / s) * s);
|
|
101
|
+
else setHue($ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(hue - s, 360), s));
|
|
102
|
+
},
|
|
103
|
+
setDragging (isDragging) {
|
|
104
|
+
let wasDragging = isDraggingRef.current;
|
|
105
|
+
isDraggingRef.current = isDragging;
|
|
106
|
+
if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
|
|
107
|
+
setDragging(isDragging);
|
|
108
|
+
},
|
|
109
|
+
isDragging: isDragging,
|
|
110
|
+
getDisplayColor () {
|
|
111
|
+
return value.toFormat("hsl").withChannelValue("saturation", 100).withChannelValue("lightness", 50).withChannelValue("alpha", 1);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
export {$ee4262c74a467b07$export$f4301076d9336137 as useColorWheelState};
|
|
118
|
+
//# sourceMappingURL=useColorWheelState.mjs.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {normalizeColor as $799cddbef784668f$export$4cde5df63f53f473, parseColor as $799cddbef784668f$export$6e865ea70d7724f} from "./Color.module.js";
|
|
2
|
+
import {useControlledState as $d4Pfi$useControlledState} from "@react-stately/utils";
|
|
3
|
+
import {useRef as $d4Pfi$useRef, useState as $d4Pfi$useState} from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $ee4262c74a467b07$var$DEFAULT_COLOR = (0, $799cddbef784668f$export$6e865ea70d7724f)("hsl(0, 100%, 50%)");
|
|
19
|
+
function $ee4262c74a467b07$var$roundToStep(value, step) {
|
|
20
|
+
return Math.round(value / step) * step;
|
|
21
|
+
}
|
|
22
|
+
function $ee4262c74a467b07$var$mod(n, m) {
|
|
23
|
+
return (n % m + m) % m;
|
|
24
|
+
}
|
|
25
|
+
function $ee4262c74a467b07$var$roundDown(v) {
|
|
26
|
+
let r = Math.floor(v);
|
|
27
|
+
if (r === v) return v - 1;
|
|
28
|
+
else return r;
|
|
29
|
+
}
|
|
30
|
+
function $ee4262c74a467b07$var$degToRad(deg) {
|
|
31
|
+
return deg * Math.PI / 180;
|
|
32
|
+
}
|
|
33
|
+
function $ee4262c74a467b07$var$radToDeg(rad) {
|
|
34
|
+
return rad * 180 / Math.PI;
|
|
35
|
+
}
|
|
36
|
+
// 0deg = 3 o'clock. increases clockwise
|
|
37
|
+
function $ee4262c74a467b07$var$angleToCartesian(angle, radius) {
|
|
38
|
+
let rad = $ee4262c74a467b07$var$degToRad(360 - angle + 90);
|
|
39
|
+
let x = Math.sin(rad) * radius;
|
|
40
|
+
let y = Math.cos(rad) * radius;
|
|
41
|
+
return {
|
|
42
|
+
x: x,
|
|
43
|
+
y: y
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function $ee4262c74a467b07$var$cartesianToAngle(x, y, radius) {
|
|
47
|
+
let deg = $ee4262c74a467b07$var$radToDeg(Math.atan2(y / radius, x / radius));
|
|
48
|
+
return (deg + 360) % 360;
|
|
49
|
+
}
|
|
50
|
+
function $ee4262c74a467b07$export$f4301076d9336137(props) {
|
|
51
|
+
let { defaultValue: defaultValue, onChange: onChange, onChangeEnd: onChangeEnd } = props;
|
|
52
|
+
if (!props.value && !defaultValue) defaultValue = $ee4262c74a467b07$var$DEFAULT_COLOR;
|
|
53
|
+
let [value, setValueState] = (0, $d4Pfi$useControlledState)((0, $799cddbef784668f$export$4cde5df63f53f473)(props.value), (0, $799cddbef784668f$export$4cde5df63f53f473)(defaultValue), onChange);
|
|
54
|
+
let valueRef = (0, $d4Pfi$useRef)(value);
|
|
55
|
+
let setValue = (value)=>{
|
|
56
|
+
valueRef.current = value;
|
|
57
|
+
setValueState(value);
|
|
58
|
+
};
|
|
59
|
+
let channelRange = value.getChannelRange("hue");
|
|
60
|
+
let { minValue: minValueX, maxValue: maxValueX, step: step, pageSize: pageStep } = channelRange;
|
|
61
|
+
let [isDragging, setDragging] = (0, $d4Pfi$useState)(false);
|
|
62
|
+
let isDraggingRef = (0, $d4Pfi$useRef)(false);
|
|
63
|
+
let hue = value.getChannelValue("hue");
|
|
64
|
+
function setHue(v) {
|
|
65
|
+
if (v > 360) // Make sure you can always get back to 0.
|
|
66
|
+
v = 0;
|
|
67
|
+
v = $ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(v, 360), step);
|
|
68
|
+
if (hue !== v) {
|
|
69
|
+
let color = value.withChannelValue("hue", v);
|
|
70
|
+
setValue(color);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
value: value,
|
|
75
|
+
step: step,
|
|
76
|
+
pageStep: pageStep,
|
|
77
|
+
setValue (v) {
|
|
78
|
+
let color = (0, $799cddbef784668f$export$4cde5df63f53f473)(v);
|
|
79
|
+
setValue(color);
|
|
80
|
+
},
|
|
81
|
+
hue: hue,
|
|
82
|
+
setHue: setHue,
|
|
83
|
+
setHueFromPoint (x, y, radius) {
|
|
84
|
+
setHue($ee4262c74a467b07$var$cartesianToAngle(x, y, radius));
|
|
85
|
+
},
|
|
86
|
+
getThumbPosition (radius) {
|
|
87
|
+
return $ee4262c74a467b07$var$angleToCartesian(value.getChannelValue("hue"), radius);
|
|
88
|
+
},
|
|
89
|
+
increment (stepSize = 1) {
|
|
90
|
+
let s = Math.max(stepSize, step);
|
|
91
|
+
let newValue = hue + s;
|
|
92
|
+
if (newValue >= maxValueX) // Make sure you can always get back to 0.
|
|
93
|
+
newValue = minValueX;
|
|
94
|
+
setHue($ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(newValue, 360), s));
|
|
95
|
+
},
|
|
96
|
+
decrement (stepSize = 1) {
|
|
97
|
+
let s = Math.max(stepSize, step);
|
|
98
|
+
if (hue === 0) // We can't just subtract step because this might be the case:
|
|
99
|
+
// |(previous step) - 0| < step size
|
|
100
|
+
setHue($ee4262c74a467b07$var$roundDown(360 / s) * s);
|
|
101
|
+
else setHue($ee4262c74a467b07$var$roundToStep($ee4262c74a467b07$var$mod(hue - s, 360), s));
|
|
102
|
+
},
|
|
103
|
+
setDragging (isDragging) {
|
|
104
|
+
let wasDragging = isDraggingRef.current;
|
|
105
|
+
isDraggingRef.current = isDragging;
|
|
106
|
+
if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
|
|
107
|
+
setDragging(isDragging);
|
|
108
|
+
},
|
|
109
|
+
isDragging: isDragging,
|
|
110
|
+
getDisplayColor () {
|
|
111
|
+
return value.toFormat("hsl").withChannelValue("saturation", 100).withChannelValue("lightness", 50).withChannelValue("alpha", 1);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
export {$ee4262c74a467b07$export$f4301076d9336137 as useColorWheelState};
|
|
118
|
+
//# sourceMappingURL=useColorWheelState.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAwCD,MAAM,sCAAgB,CAAA,GAAA,wCAAS,EAAE;AAEjC,SAAS,kCAAY,KAAa,EAAE,IAAY;IAC9C,OAAO,KAAK,KAAK,CAAC,QAAQ,QAAQ;AACpC;AAEA,SAAS,0BAAI,CAAS,EAAE,CAAS;IAC/B,OAAO,AAAC,CAAA,AAAC,IAAI,IAAK,CAAA,IAAK;AACzB;AAEA,SAAS,gCAAU,CAAS;IAC1B,IAAI,IAAI,KAAK,KAAK,CAAC;IACnB,IAAI,MAAM,GACR,OAAO,IAAI;SAEX,OAAO;AAEX;AAEA,SAAS,+BAAS,GAAW;IAC3B,OAAO,MAAM,KAAK,EAAE,GAAG;AACzB;AAEA,SAAS,+BAAS,GAAW;IAC3B,OAAO,MAAM,MAAM,KAAK,EAAE;AAC5B;AAEA,wCAAwC;AACxC,SAAS,uCAAiB,KAAa,EAAE,MAAc;IACrD,IAAI,MAAM,+BAAS,MAAM,QAAQ;IACjC,IAAI,IAAI,KAAK,GAAG,CAAC,OAAQ;IACzB,IAAI,IAAI,KAAK,GAAG,CAAC,OAAQ;IACzB,OAAO;WAAC;WAAG;IAAC;AACd;AAEA,SAAS,uCAAiB,CAAS,EAAE,CAAS,EAAE,MAAc;IAC5D,IAAI,MAA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xD;QACA,WAAU,WAAW,CAAC;YACpB,IAAI,IAAI,KAAK,GAAG,CAAC,UAAU;YAC3B,IAAI,WAAW,MAAM;YACrB,IAAI,YAAY,WACd,0CAA0C;YAC1C,WAAW;YAEb,OAAO,kCAAY,0BAAI,UAAU,MAAM;QACzC;QACA,WAAU,WAAW,CAAC;YACpB,IAAI,IAAI,KAAK,GAAG,CAAC,UAAU;YAC3B,IAAI,QAAQ,GACV,8DAA8D;YAC9D,oCAAoC;YACpC,OAAO,gCAAU,MAAM,KAAK;iBAE5B,OAAO,kCAAY,0BAAI,MAAM,GAAG,MAAM;QAE1C;QACA,aAAY,UAAU;YACpB,IAAI,cAAc,cAAc,OAAO;YACvC,cAAc,OAAO,GAAG;YAExB,IAAI,eAAe,CAAC,cAAc,aAChC,YAAY,SAAS,OAAO;YAG9B,YAAY;QACd;oBACA;QACA;YACE,OAAO,MAAM,QAAQ,CAAC,OAAO,gBAAgB,CAAC,cAAc,KAAK,gBAAgB,CAAC,aAAa,IAAI,gBAAgB,CAAC,SAAS;QAC/H;IACF;AACF","sources":["packages/@react-stately/color/src/useColorWheelState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Color, ColorWheelProps} from '@react-types/color';\nimport {normalizeColor, parseColor} from './Color';\nimport {useControlledState} from '@react-stately/utils';\nimport {useRef, useState} from 'react';\n\nexport interface ColorWheelState {\n /** The current color value represented by the color wheel. */\n readonly value: Color,\n /** Sets the color value represented by the color wheel, and triggers `onChange`. */\n setValue(value: string | Color): void,\n\n /** The current value of the hue channel displayed by the color wheel. */\n readonly hue: number,\n /** Sets the hue channel of the current color value and triggers `onChange`. */\n setHue(value: number): void,\n\n /** Sets the hue channel of the current color value based on the given coordinates and radius of the color wheel, and triggers `onChange`. */\n setHueFromPoint(x: number, y: number, radius: number): void,\n /** Returns the coordinates of the thumb relative to the center point of the color wheel. */\n getThumbPosition(radius: number): {x: number, y: number},\n\n /** Increments the hue by the given amount (defaults to 1). */\n increment(stepSize?: number): void,\n /** Decrements the hue by the given amount (defaults to 1). */\n decrement(stepSize?: number): void,\n\n /** Whether the color wheel is currently being dragged. */\n readonly isDragging: boolean,\n /** Sets whether the color wheel is being dragged. */\n setDragging(value: boolean): void,\n /** Returns the color that should be displayed in the color wheel instead of `value`. */\n getDisplayColor(): Color,\n /** The step value of the hue channel, used when incrementing and decrementing. */\n step: number,\n /** The page step value of the hue channel, used when incrementing and decrementing. */\n pageStep: number\n}\n\nconst DEFAULT_COLOR = parseColor('hsl(0, 100%, 50%)');\n\nfunction roundToStep(value: number, step: number): number {\n return Math.round(value / step) * step;\n}\n\nfunction mod(n: number, m: number) {\n return ((n % m) + m) % m;\n}\n\nfunction roundDown(v: number) {\n let r = Math.floor(v);\n if (r === v) {\n return v - 1;\n } else {\n return r;\n }\n}\n\nfunction degToRad(deg: number) {\n return deg * Math.PI / 180;\n}\n\nfunction radToDeg(rad: number) {\n return rad * 180 / Math.PI;\n}\n\n// 0deg = 3 o'clock. increases clockwise\nfunction angleToCartesian(angle: number, radius: number): {x: number, y: number} {\n let rad = degToRad(360 - angle + 90);\n let x = Math.sin(rad) * (radius);\n let y = Math.cos(rad) * (radius);\n return {x, y};\n}\n\nfunction cartesianToAngle(x: number, y: number, radius: number): number {\n let deg = radToDeg(Math.atan2(y / radius, x / radius));\n return (deg + 360) % 360;\n}\n\n/**\n * Provides state management for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheelState(props: ColorWheelProps): ColorWheelState {\n let {defaultValue, onChange, onChangeEnd} = props;\n\n if (!props.value && !defaultValue) {\n defaultValue = DEFAULT_COLOR;\n }\n\n let [value, setValueState] = useControlledState(normalizeColor(props.value), normalizeColor(defaultValue), onChange);\n let valueRef = useRef(value);\n let setValue = (value: Color) => {\n valueRef.current = value;\n setValueState(value);\n };\n\n let channelRange = value.getChannelRange('hue');\n let {minValue: minValueX, maxValue: maxValueX, step: step, pageSize: pageStep} = channelRange;\n let [isDragging, setDragging] = useState(false);\n let isDraggingRef = useRef(false);\n\n let hue = value.getChannelValue('hue');\n function setHue(v: number) {\n if (v > 360) {\n // Make sure you can always get back to 0.\n v = 0;\n }\n v = roundToStep(mod(v, 360), step);\n if (hue !== v) {\n let color = value.withChannelValue('hue', v);\n setValue(color);\n }\n }\n\n return {\n value,\n step,\n pageStep,\n setValue(v) {\n let color = normalizeColor(v);\n setValue(color);\n },\n hue,\n setHue,\n setHueFromPoint(x, y, radius) {\n setHue(cartesianToAngle(x, y, radius));\n },\n getThumbPosition(radius) {\n return angleToCartesian(value.getChannelValue('hue'), radius);\n },\n increment(stepSize = 1) {\n let s = Math.max(stepSize, step);\n let newValue = hue + s;\n if (newValue >= maxValueX) {\n // Make sure you can always get back to 0.\n newValue = minValueX;\n }\n setHue(roundToStep(mod(newValue, 360), s));\n },\n decrement(stepSize = 1) {\n let s = Math.max(stepSize, step);\n if (hue === 0) {\n // We can't just subtract step because this might be the case:\n // |(previous step) - 0| < step size\n setHue(roundDown(360 / s) * s);\n } else {\n setHue(roundToStep(mod(hue - s, 360), s));\n }\n },\n setDragging(isDragging) {\n let wasDragging = isDraggingRef.current;\n isDraggingRef.current = isDragging;\n\n if (onChangeEnd && !isDragging && wasDragging) {\n onChangeEnd(valueRef.current);\n }\n\n setDragging(isDragging);\n },\n isDragging,\n getDisplayColor() {\n return value.toFormat('hsl').withChannelValue('saturation', 100).withChannelValue('lightness', 50).withChannelValue('alpha', 1);\n }\n };\n}\n"],"names":[],"version":3,"file":"useColorWheelState.module.js.map"}
|
package/dist/zh-CN.main.js
CHANGED
|
@@ -7,8 +7,8 @@ module.exports = {
|
|
|
7
7
|
"lightness": `\u{660E}\u{4EAE}\u{5EA6}`,
|
|
8
8
|
"red": `\u{7EA2}\u{8272}`,
|
|
9
9
|
"saturation": `\u{9971}\u{548C}\u{5EA6}`,
|
|
10
|
-
"colorName": (args)=>`${args.
|
|
11
|
-
"
|
|
10
|
+
"colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
|
|
11
|
+
"transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
|
|
12
12
|
"very dark": `very dark`,
|
|
13
13
|
"dark": `dark`,
|
|
14
14
|
"light": `light`,
|
package/dist/zh-CN.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,QAAQ,CAAC,gBAAE,CAAC;IACZ,cAAc,CAAC,gBAAE,CAAC;IAClB,SAAS,CAAC,gBAAE,CAAC;IACb,OAAO,CAAC,gBAAE,CAAC;IACX,aAAa,CAAC,wBAAG,CAAC;IAClB,OAAO,CAAC,gBAAE,CAAC;IACX,cAAc,CAAC,wBAAG,CAAC;IACnB,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,QAAQ,CAAC,gBAAE,CAAC;IACZ,cAAc,CAAC,gBAAE,CAAC;IAClB,SAAS,CAAC,gBAAE,CAAC;IACb,OAAO,CAAC,gBAAE,CAAC;IACX,aAAa,CAAC,wBAAG,CAAC;IAClB,OAAO,CAAC,gBAAE,CAAC;IACX,cAAc,CAAC,wBAAG,CAAC;IACnB,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IACrE,wBAAwB,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,KAAK,kBAAkB,CAAC,YAAY,CAAC;IACxH,aAAa,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC;IACd,SAAS,CAAC,KAAK,CAAC;IAChB,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,WAAW,CAAC,OAAO,CAAC;IACpB,WAAW,CAAC,OAAO,CAAC;IACpB,SAAS,CAAC,KAAK,CAAC;IAChB,SAAS,CAAC,KAAK,CAAC;IAChB,QAAQ,CAAC,IAAI,CAAC;IACd,QAAQ,CAAC,IAAI,CAAC;IACd,YAAY,CAAC,QAAQ,CAAC;IACtB,cAAc,CAAC,UAAU,CAAC;IAC1B,SAAS,CAAC,KAAK,CAAC;IAChB,UAAU,CAAC,MAAM,CAAC;IAClB,iBAAiB,CAAC,aAAa,CAAC;IAChC,gBAAgB,CAAC,YAAY,CAAC;IAC9B,UAAU,CAAC,MAAM,CAAC;IAClB,gBAAgB,CAAC,YAAY,CAAC;IAC9B,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,aAAa,CAAC,SAAS,CAAC;IACxB,eAAe,CAAC,WAAW,CAAC;IAC5B,UAAU,CAAC,MAAM,CAAC;IAClB,kBAAkB,CAAC,cAAc,CAAC;IAClC,WAAW,CAAC,OAAO,CAAC;IACpB,gBAAgB,CAAC,YAAY,CAAC;AAChC","sources":["packages/@react-stately/color/intl/zh-CN.json"],"sourcesContent":["{\n \"alpha\": \"Alpha\",\n \"blue\": \"蓝色\",\n \"brightness\": \"亮度\",\n \"green\": \"绿色\",\n \"hue\": \"色相\",\n \"lightness\": \"明亮度\",\n \"red\": \"红色\",\n \"saturation\": \"饱和度\",\n \"colorName\": \"{lightness} {chroma} {hue}\",\n \"transparentColorName\": \"{lightness} {chroma} {hue}, {percentTransparent} transparent\",\n \"very dark\": \"very dark\",\n \"dark\": \"dark\",\n \"light\": \"light\",\n \"very light\": \"very light\",\n \"pale\": \"pale\",\n \"grayish\": \"grayish\",\n \"vibrant\": \"vibrant\",\n \"black\": \"black\",\n \"white\": \"white\",\n \"gray\": \"gray\",\n \"pink\": \"pink\",\n \"pink red\": \"pink red\",\n \"red orange\": \"red orange\",\n \"brown\": \"brown\",\n \"orange\": \"orange\",\n \"orange yellow\": \"orange yellow\",\n \"brown yellow\": \"brown yellow\",\n \"yellow\": \"yellow\",\n \"yellow green\": \"yellow green\",\n \"green cyan\": \"green cyan\",\n \"cyan\": \"cyan\",\n \"cyan blue\": \"cyan blue\",\n \"blue purple\": \"blue purple\",\n \"purple\": \"purple\",\n \"purple magenta\": \"purple magenta\",\n \"magenta\": \"magenta\",\n \"magenta pink\": \"magenta pink\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
|
package/dist/zh-CN.mjs
CHANGED
|
@@ -8,8 +8,8 @@ $a9cedf75b94e4916$exports = {
|
|
|
8
8
|
"lightness": `\u{660E}\u{4EAE}\u{5EA6}`,
|
|
9
9
|
"red": `\u{7EA2}\u{8272}`,
|
|
10
10
|
"saturation": `\u{9971}\u{548C}\u{5EA6}`,
|
|
11
|
-
"colorName": (args)=>`${args.
|
|
12
|
-
"
|
|
11
|
+
"colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
|
|
12
|
+
"transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
|
|
13
13
|
"very dark": `very dark`,
|
|
14
14
|
"dark": `dark`,
|
|
15
15
|
"light": `light`,
|
|
@@ -41,4 +41,4 @@ $a9cedf75b94e4916$exports = {
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
export {$a9cedf75b94e4916$exports as default};
|
|
44
|
-
//# sourceMappingURL=zh-CN.
|
|
44
|
+
//# sourceMappingURL=zh-CN.mjs.map
|
package/dist/zh-CN.module.js
CHANGED
|
@@ -8,8 +8,8 @@ $a9cedf75b94e4916$exports = {
|
|
|
8
8
|
"lightness": `\u{660E}\u{4EAE}\u{5EA6}`,
|
|
9
9
|
"red": `\u{7EA2}\u{8272}`,
|
|
10
10
|
"saturation": `\u{9971}\u{548C}\u{5EA6}`,
|
|
11
|
-
"colorName": (args)=>`${args.
|
|
12
|
-
"
|
|
11
|
+
"colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
|
|
12
|
+
"transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
|
|
13
13
|
"very dark": `very dark`,
|
|
14
14
|
"dark": `dark`,
|
|
15
15
|
"light": `light`,
|
package/dist/zh-CN.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,QAAQ,CAAC,gBAAE,CAAC;IACZ,cAAc,CAAC,gBAAE,CAAC;IAClB,SAAS,CAAC,gBAAE,CAAC;IACb,OAAO,CAAC,gBAAE,CAAC;IACX,aAAa,CAAC,wBAAG,CAAC;IAClB,OAAO,CAAC,gBAAE,CAAC;IACX,cAAc,CAAC,wBAAG,CAAC;IACnB,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,QAAQ,CAAC,gBAAE,CAAC;IACZ,cAAc,CAAC,gBAAE,CAAC;IAClB,SAAS,CAAC,gBAAE,CAAC;IACb,OAAO,CAAC,gBAAE,CAAC;IACX,aAAa,CAAC,wBAAG,CAAC;IAClB,OAAO,CAAC,gBAAE,CAAC;IACX,cAAc,CAAC,wBAAG,CAAC;IACnB,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IACrE,wBAAwB,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,KAAK,kBAAkB,CAAC,YAAY,CAAC;IACxH,aAAa,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC;IACd,SAAS,CAAC,KAAK,CAAC;IAChB,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,WAAW,CAAC,OAAO,CAAC;IACpB,WAAW,CAAC,OAAO,CAAC;IACpB,SAAS,CAAC,KAAK,CAAC;IAChB,SAAS,CAAC,KAAK,CAAC;IAChB,QAAQ,CAAC,IAAI,CAAC;IACd,QAAQ,CAAC,IAAI,CAAC;IACd,YAAY,CAAC,QAAQ,CAAC;IACtB,cAAc,CAAC,UAAU,CAAC;IAC1B,SAAS,CAAC,KAAK,CAAC;IAChB,UAAU,CAAC,MAAM,CAAC;IAClB,iBAAiB,CAAC,aAAa,CAAC;IAChC,gBAAgB,CAAC,YAAY,CAAC;IAC9B,UAAU,CAAC,MAAM,CAAC;IAClB,gBAAgB,CAAC,YAAY,CAAC;IAC9B,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,aAAa,CAAC,SAAS,CAAC;IACxB,eAAe,CAAC,WAAW,CAAC;IAC5B,UAAU,CAAC,MAAM,CAAC;IAClB,kBAAkB,CAAC,cAAc,CAAC;IAClC,WAAW,CAAC,OAAO,CAAC;IACpB,gBAAgB,CAAC,YAAY,CAAC;AAChC","sources":["packages/@react-stately/color/intl/zh-CN.json"],"sourcesContent":["{\n \"alpha\": \"Alpha\",\n \"blue\": \"蓝色\",\n \"brightness\": \"亮度\",\n \"green\": \"绿色\",\n \"hue\": \"色相\",\n \"lightness\": \"明亮度\",\n \"red\": \"红色\",\n \"saturation\": \"饱和度\",\n \"colorName\": \"{lightness} {chroma} {hue}\",\n \"transparentColorName\": \"{lightness} {chroma} {hue}, {percentTransparent} transparent\",\n \"very dark\": \"very dark\",\n \"dark\": \"dark\",\n \"light\": \"light\",\n \"very light\": \"very light\",\n \"pale\": \"pale\",\n \"grayish\": \"grayish\",\n \"vibrant\": \"vibrant\",\n \"black\": \"black\",\n \"white\": \"white\",\n \"gray\": \"gray\",\n \"pink\": \"pink\",\n \"pink red\": \"pink red\",\n \"red orange\": \"red orange\",\n \"brown\": \"brown\",\n \"orange\": \"orange\",\n \"orange yellow\": \"orange yellow\",\n \"brown yellow\": \"brown yellow\",\n \"yellow\": \"yellow\",\n \"yellow green\": \"yellow green\",\n \"green cyan\": \"green cyan\",\n \"cyan\": \"cyan\",\n \"cyan blue\": \"cyan blue\",\n \"blue purple\": \"blue purple\",\n \"purple\": \"purple\",\n \"purple magenta\": \"purple magenta\",\n \"magenta\": \"magenta\",\n \"magenta pink\": \"magenta pink\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
|
package/dist/zh-TW.main.js
CHANGED
|
@@ -7,8 +7,8 @@ module.exports = {
|
|
|
7
7
|
"lightness": `\u{660E}\u{4EAE}`,
|
|
8
8
|
"red": `\u{7D05}\u{8272}`,
|
|
9
9
|
"saturation": `\u{98FD}\u{548C}\u{5EA6}`,
|
|
10
|
-
"colorName": (args)=>`${args.
|
|
11
|
-
"
|
|
10
|
+
"colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
|
|
11
|
+
"transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
|
|
12
12
|
"very dark": `very dark`,
|
|
13
13
|
"dark": `dark`,
|
|
14
14
|
"light": `light`,
|
package/dist/zh-TW.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,QAAQ,CAAC,gBAAE,CAAC;IACZ,cAAc,CAAC,gBAAE,CAAC;IAClB,SAAS,CAAC,gBAAE,CAAC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AAC,YAAY,CAAC;IAC9B,UAAU,CAAC,MAAM,CAAC;IAClB,gBAAgB,CAAC,YAAY,CAAC;IAC9B,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,aAAa,CAAC,SAAS,CAAC;IACxB,eAAe,CAAC,WAAW,CAAC;IAC5B,UAAU,CAAC,MAAM,CAAC;IAClB,kBAAkB,CAAC,cAAc,CAAC;IAClC,WAAW,CAAC,OAAO,CAAC;IACpB,gBAAgB,CAAC,YAAY,CAAC;AAChC","sources":["packages/@react-stately/color/intl/zh-TW.json"],"sourcesContent":["{\n \"alpha\": \"Alpha\",\n \"blue\": \"藍色\",\n \"brightness\": \"亮度\",\n \"green\": \"綠色\",\n \"hue\": \"色相\",\n \"lightness\": \"明亮\",\n \"red\": \"紅色\",\n \"saturation\": \"飽和度\",\n \"colorName\": \"{lightness} {chroma} {hue}\",\n \"transparentColorName\": \"{lightness} {chroma} {hue}, {percentTransparent} transparent\",\n \"very dark\": \"very dark\",\n \"dark\": \"dark\",\n \"light\": \"light\",\n \"very light\": \"very light\",\n \"pale\": \"pale\",\n \"grayish\": \"grayish\",\n \"vibrant\": \"vibrant\",\n \"black\": \"black\",\n \"white\": \"white\",\n \"gray\": \"gray\",\n \"pink\": \"pink\",\n \"pink red\": \"pink red\",\n \"red orange\": \"red orange\",\n \"brown\": \"brown\",\n \"orange\": \"orange\",\n \"orange yellow\": \"orange yellow\",\n \"brown yellow\": \"brown yellow\",\n \"yellow\": \"yellow\",\n \"yellow green\": \"yellow green\",\n \"green cyan\": \"green cyan\",\n \"cyan\": \"cyan\",\n \"cyan blue\": \"cyan blue\",\n \"blue purple\": \"blue purple\",\n \"purple\": \"purple\",\n \"purple magenta\": \"purple magenta\",\n \"magenta\": \"magenta\",\n \"magenta pink\": \"magenta pink\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
|
package/dist/zh-TW.mjs
CHANGED
|
@@ -8,8 +8,8 @@ $37cff576474bc8d4$exports = {
|
|
|
8
8
|
"lightness": `\u{660E}\u{4EAE}`,
|
|
9
9
|
"red": `\u{7D05}\u{8272}`,
|
|
10
10
|
"saturation": `\u{98FD}\u{548C}\u{5EA6}`,
|
|
11
|
-
"colorName": (args)=>`${args.
|
|
12
|
-
"
|
|
11
|
+
"colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
|
|
12
|
+
"transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
|
|
13
13
|
"very dark": `very dark`,
|
|
14
14
|
"dark": `dark`,
|
|
15
15
|
"light": `light`,
|
|
@@ -41,4 +41,4 @@ $37cff576474bc8d4$exports = {
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
export {$37cff576474bc8d4$exports as default};
|
|
44
|
-
//# sourceMappingURL=zh-TW.
|
|
44
|
+
//# sourceMappingURL=zh-TW.mjs.map
|
package/dist/zh-TW.module.js
CHANGED
|
@@ -8,8 +8,8 @@ $37cff576474bc8d4$exports = {
|
|
|
8
8
|
"lightness": `\u{660E}\u{4EAE}`,
|
|
9
9
|
"red": `\u{7D05}\u{8272}`,
|
|
10
10
|
"saturation": `\u{98FD}\u{548C}\u{5EA6}`,
|
|
11
|
-
"colorName": (args)=>`${args.
|
|
12
|
-
"
|
|
11
|
+
"colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
|
|
12
|
+
"transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
|
|
13
13
|
"very dark": `very dark`,
|
|
14
14
|
"dark": `dark`,
|
|
15
15
|
"light": `light`,
|