@fluentui/react-color-picker 9.3.2 → 9.3.3
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/CHANGELOG.md +11 -2
- package/lib/components/AlphaSlider/AlphaSlider.constants.js.map +1 -1
- package/lib/components/AlphaSlider/AlphaSlider.js.map +1 -1
- package/lib/components/AlphaSlider/AlphaSlider.types.js.map +1 -1
- package/lib/components/AlphaSlider/alphaSliderUtils.js.map +1 -1
- package/lib/components/AlphaSlider/index.js.map +1 -1
- package/lib/components/AlphaSlider/renderAlphaSlider.js +2 -2
- package/lib/components/AlphaSlider/renderAlphaSlider.js.map +1 -1
- package/lib/components/AlphaSlider/useAlphaSlider.js.map +1 -1
- package/lib/components/AlphaSlider/useAlphaSliderState.js +3 -4
- package/lib/components/AlphaSlider/useAlphaSliderState.js.map +1 -1
- package/lib/components/AlphaSlider/useAlphaSliderStyles.styles.raw.js.map +1 -1
- package/lib/components/ColorArea/ColorArea.constants.js.map +1 -1
- package/lib/components/ColorArea/ColorArea.js.map +1 -1
- package/lib/components/ColorArea/ColorArea.types.js.map +1 -1
- package/lib/components/ColorArea/index.js.map +1 -1
- package/lib/components/ColorArea/renderColorArea.js +2 -2
- package/lib/components/ColorArea/renderColorArea.js.map +1 -1
- package/lib/components/ColorArea/useColorArea.js.map +1 -1
- package/lib/components/ColorArea/useColorAreaStyles.styles.raw.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.types.js.map +1 -1
- package/lib/components/ColorPicker/index.js.map +1 -1
- package/lib/components/ColorPicker/renderColorPicker.js +2 -2
- package/lib/components/ColorPicker/renderColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/useColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/useColorPickerContextValues.js.map +1 -1
- package/lib/components/ColorPicker/useColorPickerStyles.styles.raw.js.map +1 -1
- package/lib/components/ColorSlider/ColorSlider.constants.js.map +1 -1
- package/lib/components/ColorSlider/ColorSlider.js.map +1 -1
- package/lib/components/ColorSlider/ColorSlider.types.js.map +1 -1
- package/lib/components/ColorSlider/index.js.map +1 -1
- package/lib/components/ColorSlider/renderColorSlider.js +2 -2
- package/lib/components/ColorSlider/renderColorSlider.js.map +1 -1
- package/lib/components/ColorSlider/useColorSlider.js +2 -3
- package/lib/components/ColorSlider/useColorSlider.js.map +1 -1
- package/lib/components/ColorSlider/useColorSliderStyles.styles.raw.js.map +1 -1
- package/lib/contexts/colorPicker.js.map +1 -1
- package/lib/types/color.js.map +1 -1
- package/lib/utils/adjustChannel.js.map +1 -1
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/createHslColor.js.map +1 -1
- package/lib/utils/createHsvColor.js.map +1 -1
- package/lib/utils/getCoordinates.js.map +1 -1
- package/lib-commonjs/AlphaSlider.cjs +8 -8
- package/lib-commonjs/ColorArea.cjs +8 -8
- package/lib-commonjs/ColorPicker.cjs +9 -9
- package/lib-commonjs/ColorPicker.cjs.map +1 -1
- package/lib-commonjs/ColorSlider.cjs +8 -8
- package/lib-commonjs/components/AlphaSlider/AlphaSlider.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/AlphaSlider.constants.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/AlphaSlider.types.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/alphaSliderUtils.cjs +4 -4
- package/lib-commonjs/components/AlphaSlider/alphaSliderUtils.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/index.cjs +8 -8
- package/lib-commonjs/components/AlphaSlider/index.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/renderAlphaSlider.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/useAlphaSlider.cjs +3 -3
- package/lib-commonjs/components/AlphaSlider/useAlphaSlider.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderState.cjs +2 -3
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderState.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderStyles.styles.cjs +3 -3
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/ColorArea.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/ColorArea.constants.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/ColorArea.types.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/index.cjs +8 -8
- package/lib-commonjs/components/ColorArea/index.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/renderColorArea.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/useColorArea.cjs +3 -3
- package/lib-commonjs/components/ColorArea/useColorArea.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/useColorAreaStyles.styles.cjs +3 -3
- package/lib-commonjs/components/ColorArea/useColorAreaStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/useColorAreaStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/ColorArea/useColorAreaStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/ColorPicker.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/ColorPicker.types.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/index.cjs +9 -9
- package/lib-commonjs/components/ColorPicker/index.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/renderColorPicker.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/useColorPicker.cjs +3 -3
- package/lib-commonjs/components/ColorPicker/useColorPicker.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/useColorPickerContextValues.cjs +3 -3
- package/lib-commonjs/components/ColorPicker/useColorPickerContextValues.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/useColorPickerStyles.styles.cjs +3 -3
- package/lib-commonjs/components/ColorPicker/useColorPickerStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/useColorPickerStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/ColorPicker/useColorPickerStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/ColorSlider.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/ColorSlider.constants.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/ColorSlider.types.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/index.cjs +8 -8
- package/lib-commonjs/components/ColorSlider/index.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/renderColorSlider.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/useColorSlider.cjs +4 -5
- package/lib-commonjs/components/ColorSlider/useColorSlider.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/useColorSliderStyles.styles.cjs +4 -4
- package/lib-commonjs/components/ColorSlider/useColorSliderStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/useColorSliderStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/ColorSlider/useColorSliderStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/contexts/colorPicker.cjs +4 -4
- package/lib-commonjs/contexts/colorPicker.cjs.map +1 -1
- package/lib-commonjs/index.cjs +27 -27
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/types/color.cjs.map +1 -1
- package/lib-commonjs/utils/adjustChannel.cjs +3 -3
- package/lib-commonjs/utils/adjustChannel.cjs.map +1 -1
- package/lib-commonjs/utils/constants.cjs +6 -6
- package/lib-commonjs/utils/constants.cjs.map +1 -1
- package/lib-commonjs/utils/createHslColor.cjs +3 -3
- package/lib-commonjs/utils/createHslColor.cjs.map +1 -1
- package/lib-commonjs/utils/createHsvColor.cjs.map +1 -1
- package/lib-commonjs/utils/getCoordinates.cjs +3 -3
- package/lib-commonjs/utils/getCoordinates.cjs.map +1 -1
- package/package.json +1 -1
- package/lib/utils/getPercent.js +0 -11
- package/lib/utils/getPercent.js.map +0 -1
- package/lib-commonjs/utils/getPercent.cjs +0 -21
- package/lib-commonjs/utils/getPercent.cjs.map +0 -1
package/lib-commonjs/index.cjs
CHANGED
|
@@ -5,86 +5,86 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
AlphaSlider
|
|
12
|
+
get AlphaSlider () {
|
|
13
13
|
return _AlphaSlider.AlphaSlider;
|
|
14
14
|
},
|
|
15
|
-
ColorArea
|
|
15
|
+
get ColorArea () {
|
|
16
16
|
return _ColorArea.ColorArea;
|
|
17
17
|
},
|
|
18
|
-
ColorPicker
|
|
18
|
+
get ColorPicker () {
|
|
19
19
|
return _ColorPicker.ColorPicker;
|
|
20
20
|
},
|
|
21
|
-
ColorSlider
|
|
21
|
+
get ColorSlider () {
|
|
22
22
|
return _ColorSlider.ColorSlider;
|
|
23
23
|
},
|
|
24
|
-
alphaSliderClassNames
|
|
24
|
+
get alphaSliderClassNames () {
|
|
25
25
|
return _AlphaSlider.alphaSliderClassNames;
|
|
26
26
|
},
|
|
27
|
-
colorAreaClassNames
|
|
27
|
+
get colorAreaClassNames () {
|
|
28
28
|
return _ColorArea.colorAreaClassNames;
|
|
29
29
|
},
|
|
30
|
-
colorPickerClassNames
|
|
30
|
+
get colorPickerClassNames () {
|
|
31
31
|
return _ColorPicker.colorPickerClassNames;
|
|
32
32
|
},
|
|
33
|
-
colorSliderClassNames
|
|
33
|
+
get colorSliderClassNames () {
|
|
34
34
|
return _ColorSlider.colorSliderClassNames;
|
|
35
35
|
},
|
|
36
|
-
renderAlphaSlider_unstable
|
|
36
|
+
get renderAlphaSlider_unstable () {
|
|
37
37
|
return _AlphaSlider.renderAlphaSlider_unstable;
|
|
38
38
|
},
|
|
39
|
-
renderColorArea_unstable
|
|
39
|
+
get renderColorArea_unstable () {
|
|
40
40
|
return _ColorArea.renderColorArea_unstable;
|
|
41
41
|
},
|
|
42
|
-
renderColorPicker_unstable
|
|
42
|
+
get renderColorPicker_unstable () {
|
|
43
43
|
return _ColorPicker.renderColorPicker_unstable;
|
|
44
44
|
},
|
|
45
|
-
renderColorSlider_unstable
|
|
45
|
+
get renderColorSlider_unstable () {
|
|
46
46
|
return _ColorSlider.renderColorSlider_unstable;
|
|
47
47
|
},
|
|
48
|
-
useAlphaSliderBase_unstable
|
|
48
|
+
get useAlphaSliderBase_unstable () {
|
|
49
49
|
return _AlphaSlider.useAlphaSliderBase_unstable;
|
|
50
50
|
},
|
|
51
|
-
useAlphaSliderStyles_unstable
|
|
51
|
+
get useAlphaSliderStyles_unstable () {
|
|
52
52
|
return _AlphaSlider.useAlphaSliderStyles_unstable;
|
|
53
53
|
},
|
|
54
|
-
useAlphaSlider_unstable
|
|
54
|
+
get useAlphaSlider_unstable () {
|
|
55
55
|
return _AlphaSlider.useAlphaSlider_unstable;
|
|
56
56
|
},
|
|
57
|
-
useColorAreaBase_unstable
|
|
57
|
+
get useColorAreaBase_unstable () {
|
|
58
58
|
return _ColorArea.useColorAreaBase_unstable;
|
|
59
59
|
},
|
|
60
|
-
useColorAreaStyles_unstable
|
|
60
|
+
get useColorAreaStyles_unstable () {
|
|
61
61
|
return _ColorArea.useColorAreaStyles_unstable;
|
|
62
62
|
},
|
|
63
|
-
useColorArea_unstable
|
|
63
|
+
get useColorArea_unstable () {
|
|
64
64
|
return _ColorArea.useColorArea_unstable;
|
|
65
65
|
},
|
|
66
|
-
useColorPickerBase_unstable
|
|
66
|
+
get useColorPickerBase_unstable () {
|
|
67
67
|
return _ColorPicker.useColorPickerBase_unstable;
|
|
68
68
|
},
|
|
69
|
-
useColorPickerContextValue_unstable
|
|
69
|
+
get useColorPickerContextValue_unstable () {
|
|
70
70
|
return _colorPicker.useColorPickerContextValue_unstable;
|
|
71
71
|
},
|
|
72
|
-
useColorPickerContextValues
|
|
72
|
+
get useColorPickerContextValues () {
|
|
73
73
|
return _ColorPicker.useColorPickerContextValues;
|
|
74
74
|
},
|
|
75
|
-
useColorPickerStyles_unstable
|
|
75
|
+
get useColorPickerStyles_unstable () {
|
|
76
76
|
return _ColorPicker.useColorPickerStyles_unstable;
|
|
77
77
|
},
|
|
78
|
-
useColorPicker_unstable
|
|
78
|
+
get useColorPicker_unstable () {
|
|
79
79
|
return _ColorPicker.useColorPicker_unstable;
|
|
80
80
|
},
|
|
81
|
-
useColorSliderBase_unstable
|
|
81
|
+
get useColorSliderBase_unstable () {
|
|
82
82
|
return _ColorSlider.useColorSliderBase_unstable;
|
|
83
83
|
},
|
|
84
|
-
useColorSliderStyles_unstable
|
|
84
|
+
get useColorSliderStyles_unstable () {
|
|
85
85
|
return _ColorSlider.useColorSliderStyles_unstable;
|
|
86
86
|
},
|
|
87
|
-
useColorSlider_unstable
|
|
87
|
+
get useColorSlider_unstable () {
|
|
88
88
|
return _ColorSlider.useColorSlider_unstable;
|
|
89
89
|
}
|
|
90
90
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type {\n ColorChannel,\n ColorSliderBaseProps,\n ColorSliderBaseState,\n ColorSliderProps,\n ColorSliderSlots,\n ColorSliderState,\n} from './ColorSlider';\nexport {\n ColorSlider,\n colorSliderClassNames,\n renderColorSlider_unstable,\n useColorSliderBase_unstable,\n useColorSliderStyles_unstable,\n useColorSlider_unstable,\n} from './ColorSlider';\nexport type {\n ColorPickerBaseProps,\n ColorPickerBaseState,\n ColorPickerProps,\n ColorPickerSlots,\n ColorPickerState,\n} from './ColorPicker';\nexport {\n ColorPicker,\n colorPickerClassNames,\n renderColorPicker_unstable,\n useColorPickerBase_unstable,\n useColorPickerContextValues,\n useColorPickerStyles_unstable,\n useColorPicker_unstable,\n} from './ColorPicker';\nexport type {\n ColorAreaBaseProps,\n ColorAreaBaseState,\n ColorAreaProps,\n ColorAreaSlots,\n ColorAreaState,\n} from './ColorArea';\nexport {\n ColorArea,\n colorAreaClassNames,\n renderColorArea_unstable,\n useColorAreaBase_unstable,\n useColorAreaStyles_unstable,\n useColorArea_unstable,\n} from './ColorArea';\nexport type {\n AlphaSliderBaseProps,\n AlphaSliderBaseState,\n AlphaSliderProps,\n AlphaSliderSlots,\n AlphaSliderState,\n} from './AlphaSlider';\nexport {\n AlphaSlider,\n alphaSliderClassNames,\n renderAlphaSlider_unstable,\n useAlphaSliderBase_unstable,\n useAlphaSliderStyles_unstable,\n useAlphaSlider_unstable,\n} from './AlphaSlider';\nexport type { ColorPickerContextValue, ColorPickerContextValues } from './contexts/colorPicker';\nexport { useColorPickerContextValue_unstable } from './contexts/colorPicker';\n"],"names":["ColorSlider","colorSliderClassNames","renderColorSlider_unstable","useColorSliderBase_unstable","useColorSliderStyles_unstable","useColorSlider_unstable","ColorPicker","colorPickerClassNames","renderColorPicker_unstable","useColorPickerBase_unstable","useColorPickerContextValues","useColorPickerStyles_unstable","useColorPicker_unstable","ColorArea","colorAreaClassNames","renderColorArea_unstable","useColorAreaBase_unstable","useColorAreaStyles_unstable","useColorArea_unstable","AlphaSlider","alphaSliderClassNames","renderAlphaSlider_unstable","useAlphaSliderBase_unstable","useAlphaSliderStyles_unstable","useAlphaSlider_unstable","useColorPickerContextValue_unstable"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type {\n ColorChannel,\n ColorSliderBaseProps,\n ColorSliderBaseState,\n ColorSliderProps,\n ColorSliderSlots,\n ColorSliderState,\n} from './ColorSlider';\nexport {\n ColorSlider,\n colorSliderClassNames,\n renderColorSlider_unstable,\n useColorSliderBase_unstable,\n useColorSliderStyles_unstable,\n useColorSlider_unstable,\n} from './ColorSlider';\nexport type {\n ColorPickerBaseProps,\n ColorPickerBaseState,\n ColorPickerProps,\n ColorPickerSlots,\n ColorPickerState,\n} from './ColorPicker';\nexport {\n ColorPicker,\n colorPickerClassNames,\n renderColorPicker_unstable,\n useColorPickerBase_unstable,\n useColorPickerContextValues,\n useColorPickerStyles_unstable,\n useColorPicker_unstable,\n} from './ColorPicker';\nexport type {\n ColorAreaBaseProps,\n ColorAreaBaseState,\n ColorAreaProps,\n ColorAreaSlots,\n ColorAreaState,\n} from './ColorArea';\nexport {\n ColorArea,\n colorAreaClassNames,\n renderColorArea_unstable,\n useColorAreaBase_unstable,\n useColorAreaStyles_unstable,\n useColorArea_unstable,\n} from './ColorArea';\nexport type {\n AlphaSliderBaseProps,\n AlphaSliderBaseState,\n AlphaSliderProps,\n AlphaSliderSlots,\n AlphaSliderState,\n} from './AlphaSlider';\nexport {\n AlphaSlider,\n alphaSliderClassNames,\n renderAlphaSlider_unstable,\n useAlphaSliderBase_unstable,\n useAlphaSliderStyles_unstable,\n useAlphaSlider_unstable,\n} from './AlphaSlider';\nexport type { ColorPickerContextValue, ColorPickerContextValues } from './contexts/colorPicker';\nexport { useColorPickerContextValue_unstable } from './contexts/colorPicker';\n"],"names":["ColorSlider","colorSliderClassNames","renderColorSlider_unstable","useColorSliderBase_unstable","useColorSliderStyles_unstable","useColorSlider_unstable","ColorPicker","colorPickerClassNames","renderColorPicker_unstable","useColorPickerBase_unstable","useColorPickerContextValues","useColorPickerStyles_unstable","useColorPicker_unstable","ColorArea","colorAreaClassNames","renderColorArea_unstable","useColorAreaBase_unstable","useColorAreaStyles_unstable","useColorArea_unstable","AlphaSlider","alphaSliderClassNames","renderAlphaSlider_unstable","useAlphaSliderBase_unstable","useAlphaSliderStyles_unstable","useAlphaSlider_unstable","useColorPickerContextValue_unstable"],"mappings":";;;;;;;;;;;QAuDEmB;uCAAW;;QAfXN;mCAAS;;;eAhBTP,wBAAW;;;eAfXN,wBAAW;;;eA+CXoB,kCAAqB;;;eAfrBN,8BAAmB;;;eAhBnBP,kCAAqB;;;eAfrBN,kCAAqB;;QA+CrBoB;sDAA0B;;;eAf1BN,mCAAwB;;;eAhBxBP,uCAA0B;;;eAf1BN,uCAA0B;;;eA+C1BoB,wCAA2B;;;eAC3BC,0CAA6B;;QAC7BC;mDAAuB;;;eAjBvBR,oCAAyB;;;eACzBC,sCAA2B;;;eAC3BC,gCAAqB;;QAlBrBT;uDAA2B;;;eAoCpBgB,gDAAmC;;;eAnC1Cf,wCAA2B;;;eAC3BC,0CAA6B;;QAC7BC;mDAAuB;;;eAlBvBT,wCAA2B;;;eAC3BC,0CAA6B;;;eAC7BC,oCAAuB;;;6BAClB,mBAAgB;6BAgBhB,mBAAgB;2BAehB,iBAAc;6BAed,mBAAgB;6BAE6B,4BAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/types/color.ts"],"sourcesContent":["export type HsvColor = {\n h: number;\n s: number;\n v: number;\n a?: number;\n};\n\nexport type HslColor = {\n h: number;\n s: number;\n l: number;\n a?: number;\n};\n"],"names":[],"mappings":""}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
adjustChannel
|
|
12
|
+
get adjustChannel () {
|
|
13
13
|
return adjustChannel;
|
|
14
14
|
},
|
|
15
|
-
clampValue
|
|
15
|
+
get clampValue () {
|
|
16
16
|
return clampValue;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/adjustChannel.ts"],"sourcesContent":["import type { ColorChannel } from '../components/ColorSlider/ColorSlider.types';\nimport { MIN, HUE_MAX, MAX as COLOR_MAX } from './constants';\nimport { clamp } from '@fluentui/react-utilities';\n\n/**\n * Clamps a given value to the valid range for a specified color channel.\n *\n * @param value - The numeric value to be clamped.\n * @param channel - The color channel to use for clamping. Defaults to 'hue'.\n * @returns The clamped value within the range defined by the color channel.\n */\nexport function clampValue(value: number, channel: ColorChannel = 'hue'): number {\n const MAX = channel === 'hue' ? HUE_MAX : COLOR_MAX;\n return clamp(value, MIN, MAX);\n}\n\nexport type ChannelActions<T> = {\n hue: T;\n saturation: T;\n value: T;\n};\n\n/**\n * Adjusts the specified color channel using the provided actions.\n *\n * @template T - The type of the result returned by the actions.\n * @param {ColorChannel} channel - The color channel to adjust.\n * @param {ChannelActions<T>} actions - An object containing actions for each color channel.\n * @returns {T} - The result of the action corresponding to the specified channel, or the hue action if the channel is not found.\n */\nexport function adjustChannel<T>(channel: ColorChannel, actions: ChannelActions<T>): T {\n return actions[channel] ?? actions.hue;\n}\n"],"names":["MIN","HUE_MAX","MAX","COLOR_MAX","clamp","clampValue","value","channel","adjustChannel","actions","hue"],"mappings":";;;;;;;;;;;;;;;;;;2BAC+C,iBAAc;gCACvC,4BAA4B;AAS3C,SAASK,WAAWC,KAAa,EAAEC,UAAwB,KAAK;IACrE,MAAML,MAAMK,YAAY,QAAQN,kBAAAA,GAAUE,cAAAA;IAC1C,WAAOC,qBAAAA,EAAME,OAAON,cAAAA,EAAKE;AAC3B;AAgBO,SAASM,cAAiBD,OAAqB,EAAEE,OAA0B;QACzEA;IAAP,OAAA,CAAOA,mBAAAA,OAAO,CAACF,QAAAA,AAAQ,MAAA,QAAhBE,qBAAAA,KAAAA,IAAAA,mBAAoBA,QAAQC,GAAG;AACxC"}
|
|
@@ -5,23 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
HUE_MAX
|
|
12
|
+
get HUE_MAX () {
|
|
13
13
|
return HUE_MAX;
|
|
14
14
|
},
|
|
15
|
-
INITIAL_COLOR
|
|
15
|
+
get INITIAL_COLOR () {
|
|
16
16
|
return INITIAL_COLOR;
|
|
17
17
|
},
|
|
18
|
-
INITIAL_COLOR_HSV
|
|
18
|
+
get INITIAL_COLOR_HSV () {
|
|
19
19
|
return INITIAL_COLOR_HSV;
|
|
20
20
|
},
|
|
21
|
-
MAX
|
|
21
|
+
get MAX () {
|
|
22
22
|
return MAX;
|
|
23
23
|
},
|
|
24
|
-
MIN
|
|
24
|
+
get MIN () {
|
|
25
25
|
return MIN;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/constants.ts"],"sourcesContent":["export const MIN = 0;\nexport const MAX = 100;\nexport const HUE_MAX = 360;\nexport const INITIAL_COLOR = '#FFF';\nexport const INITIAL_COLOR_HSV = { h: 0, s: 0, v: 1, a: 1 };\n"],"names":["MIN","MAX","HUE_MAX","INITIAL_COLOR","INITIAL_COLOR_HSV","h","s","v","a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,MAAM,EAAE;AACd,MAAMC,MAAM,IAAI;AAChB,MAAMC,UAAU,IAAI;AACpB,MAAMC,gBAAgB,OAAO;AAC7B,MAAMC,oBAAoB;IAAEC,GAAG;IAAGC,GAAG;IAAGC,GAAG;IAAGC,GAAG;AAAE,EAAE"}
|
|
@@ -11,14 +11,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
11
11
|
function _export(target, all) {
|
|
12
12
|
for(var name in all)Object.defineProperty(target, name, {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: all
|
|
14
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
_export(exports, {
|
|
18
|
-
createHslColor
|
|
18
|
+
get createHslColor () {
|
|
19
19
|
return createHslColor;
|
|
20
20
|
},
|
|
21
|
-
createHslColorString
|
|
21
|
+
get createHslColorString () {
|
|
22
22
|
return createHslColorString;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/createHslColor.ts"],"sourcesContent":["import type { HslColor, HsvColor } from '../types/color';\n\n/**\n *\n * Creates an HSL color object from a given HSV color object.\n *\n * @param color - HSV color object to convert to HSL.\n * @returns HSL color object with the same hue and alpha values, and converted saturation and lightness values.\n */\nexport function createHslColor(color: Partial<HsvColor> = {}): HslColor {\n const { h = 0, s = 0, v = 0, a = 1 } = color;\n const l = v * (1 - s / 2);\n const hslSaturation = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l);\n\n return { h, s: hslSaturation, l, a };\n}\n\n/**\n * Creates an HSL color string from a given HSV color object.\n *\n * @param color - HSV color object to convert to HSL string.\n * @returns - HSL color string in the format of \"hsla(h, s%, l%, a)\".\n */\nexport function createHslColorString(color: Partial<HsvColor> = {}): string {\n const hslColor = createHslColor(color);\n const saturation = Number((hslColor.s * 100).toFixed(2));\n const lightness = Number((hslColor.l * 100).toFixed(2));\n\n return `hsla(${hslColor.h}, ${saturation}%, ${lightness}%, ${hslColor.a})`;\n}\n"],"names":["createHslColor","color","h","s","v","a","l","hslSaturation","Math","min","createHslColorString","hslColor","saturation","Number","toFixed","lightness"],"mappings":"AAEA;;;;;;CAMC,GACD;;;;;;;;;;;;;;;eAcgBU;;;AAdT,SAASV,eAAeC,QAA2B,CAAC,CAAC;IAC1D,MAAM,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAE,GAAGJ;IACvC,MAAMK,IAAIF,IAAK,CAAA,IAAID,KAAI,CAAA;IACvB,MAAMI,gBAAgBD,MAAM,KAAKA,MAAM,IAAI,IAAKF,CAAAA,KAAIE,CAAAA,GAAKE,KAAKC,GAAG,CAACH,GAAG,IAAIA;IAEzE,OAAO;QAAEJ;QAAGC,GAAGI;QAAeD;QAAGD;IAAE;AACrC;AAQO,8BAA8BJ,QAA2B,CAAC,CAAC;IAChE,MAAMU,WAAWX,eAAeC;IAChC,MAAMW,aAAaC,OAAQF,CAAAA,SAASR,CAAC,GAAG,GAAA,CAAE,CAAGW,OAAO,CAAC;IACrD,MAAMC,YAAYF,OAAQF,UAASL,CAAC,GAAG,GAAA,CAAE,CAAGQ,OAAO,CAAC;IAEpD,OAAO,CAAC,KAAK,EAAEH,SAAST,CAAC,CAAC,EAAE,EAAEU,WAAW,GAAG,EAAEG,UAAU,GAAG,EAAEJ,SAASN,CAAC,CAAC,CAAC,CAAC;AAC5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/createHsvColor.ts"],"sourcesContent":["import type { HsvColor } from '../types/color';\n\n/**\n * Creates an HSV color object with optional hue, saturation, value, and alpha components.\n *\n * @param {Partial<HsvColor>} param0 - An object containing optional HSV color components:\n * - `h` (number): The hue component, default is 0.\n * - `s` (number): The saturation component, default is 0.\n * - `v` (number): The value component, default is 0.\n * - `a` (number): The alpha component, default is 1.\n * @returns {HsvColor} The resulting HSV color object.\n */\nexport function createHsvColor({ h = 0, s = 0, v = 0, a = 1 }: Partial<HsvColor>): HsvColor {\n return { h, s, v, a };\n}\n"],"names":["createHsvColor","h","s","v","a"],"mappings":"AAEA;;;;;;;;;CASC,GACD;;;;;;;;;;AAAO,SAASA,eAAe,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAqB;IAC9E,OAAO;QAAEH;QAAGC;QAAGC;QAAGC;IAAE;AACtB"}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getCoordinates
|
|
12
|
+
get getCoordinates () {
|
|
13
13
|
return getCoordinates;
|
|
14
14
|
},
|
|
15
|
-
roundTwoDecimal
|
|
15
|
+
get roundTwoDecimal () {
|
|
16
16
|
return roundTwoDecimal;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getCoordinates.ts"],"sourcesContent":["import { clamp } from '@fluentui/react-utilities';\n\n/**\n * Calculates the normalized coordinates of a mouse event relative to a given HTML element.\n *\n * @param element - The HTML element to calculate the coordinates relative to.\n * @param event - The mouse event containing the clientX and clientY properties.\n * @returns An object containing the normalized x and y coordinates, clamped between 0 and 1.\n */\nexport function getCoordinates(element: HTMLElement, event: PointerEvent): { x: number; y: number } {\n const rect = element.getBoundingClientRect();\n\n const newX = roundTwoDecimal((event.clientX - rect.left) / rect.width);\n const newY = roundTwoDecimal(1 - (event.clientY - rect.top) / rect.height);\n\n return {\n x: clamp(newX, 0, 1),\n y: clamp(newY, 0, 1),\n };\n}\n\n/**\n * Rounds a given number to two decimal places.\n *\n * @param num - The number to be rounded.\n * @returns The number rounded to two decimal places.\n */\nexport function roundTwoDecimal(num: number): number {\n return Math.round(num * 100) / 100;\n}\n"],"names":["clamp","getCoordinates","element","event","rect","getBoundingClientRect","newX","roundTwoDecimal","clientX","left","width","newY","clientY","top","height","x","y","num","Math","round"],"mappings":";;;;;;;;;;;QASgBC;;;;;;;gCATM,4BAA4B;AAS3C,wBAAwBC,OAAoB,EAAEC,KAAmB;IACtE,MAAMC,OAAOF,QAAQG,qBAAqB;IAE1C,MAAMC,OAAOC,gBAAiBJ,OAAMK,OAAO,GAAGJ,KAAKK,IAAAA,AAAG,IAAKL,KAAKM,KAAK;IACrE,MAAMC,OAAOJ,gBAAgB,IAAKJ,CAAAA,MAAMS,OAAO,GAAGR,KAAKS,GAAE,AAAFA,IAAOT,KAAKU,MAAM;IAEzE,OAAO;QACLC,OAAGf,qBAAAA,EAAMM,MAAM,GAAG;QAClBU,OAAGhB,qBAAAA,EAAMW,MAAM,GAAG;IACpB;AACF;AAQO,SAASJ,gBAAgBU,GAAW;IACzC,OAAOC,KAAKC,KAAK,CAACF,MAAM,OAAO;AACjC"}
|
package/package.json
CHANGED
package/lib/utils/getPercent.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the percentage of a value within a given range.
|
|
3
|
-
*
|
|
4
|
-
* @param value - The value to be converted to a percentage.
|
|
5
|
-
* @param min - The minimum value of the range.
|
|
6
|
-
* @param max - The maximum value of the range.
|
|
7
|
-
* @returns The percentage representation of the value within the range [min, max].
|
|
8
|
-
* Returns 0 if `min` is equal to `max`.
|
|
9
|
-
*/ export const getPercent = (value, min, max)=>{
|
|
10
|
-
return max === min ? 0 : (value - min) / (max - min) * 100;
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/getPercent.ts"],"sourcesContent":["/**\n * Calculates the percentage of a value within a given range.\n *\n * @param value - The value to be converted to a percentage.\n * @param min - The minimum value of the range.\n * @param max - The maximum value of the range.\n * @returns The percentage representation of the value within the range [min, max].\n * Returns 0 if `min` is equal to `max`.\n */\nexport const getPercent = (value: number, min: number, max: number): number => {\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n};\n"],"names":["getPercent","value","min","max"],"mappings":"AAAA;;;;;;;;CAQC,GACD,OAAO,MAAMA,aAAa,CAACC,OAAeC,KAAaC;IACrD,OAAOA,QAAQD,MAAM,IAAI,AAAED,CAAAA,QAAQC,GAAE,IAAMC,CAAAA,MAAMD,GAAE,IAAM;AAC3D,EAAE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the percentage of a value within a given range.
|
|
3
|
-
*
|
|
4
|
-
* @param value - The value to be converted to a percentage.
|
|
5
|
-
* @param min - The minimum value of the range.
|
|
6
|
-
* @param max - The maximum value of the range.
|
|
7
|
-
* @returns The percentage representation of the value within the range [min, max].
|
|
8
|
-
* Returns 0 if `min` is equal to `max`.
|
|
9
|
-
*/ "use strict";
|
|
10
|
-
Object.defineProperty(exports, "__esModule", {
|
|
11
|
-
value: true
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "getPercent", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function() {
|
|
16
|
-
return getPercent;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const getPercent = (value, min, max)=>{
|
|
20
|
-
return max === min ? 0 : (value - min) / (max - min) * 100;
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/getPercent.ts"],"sourcesContent":["/**\n * Calculates the percentage of a value within a given range.\n *\n * @param value - The value to be converted to a percentage.\n * @param min - The minimum value of the range.\n * @param max - The maximum value of the range.\n * @returns The percentage representation of the value within the range [min, max].\n * Returns 0 if `min` is equal to `max`.\n */\nexport const getPercent = (value: number, min: number, max: number): number => {\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n};\n"],"names":["getPercent","value","min","max"],"mappings":"AAAA;;;;;;;;CAQC,GACD;;;;;;;;;;AAAO,MAAMA,aAAa,CAACC,OAAeC,KAAaC;IACrD,OAAOA,QAAQD,MAAM,IAAMD,CAAAA,QAAQC,GAAAA,CAAE,IAAMC,MAAMD,GAAAA,CAAE,GAAM;AAC3D,EAAE"}
|